@usereq/widget 1.0.0-experimental.0 → 1.0.0-experimental.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/embed.mjs CHANGED
@@ -1,4 +1,4 @@
1
- async function Vt(e) {
1
+ async function en(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 ne(e) {
51
51
  "@babel/helpers - typeof";
52
- return Z = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
52
+ return ne = 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
+ }, ne(e);
57
57
  }
58
- function Kt(e, t) {
59
- if (Z(e) != "object" || !e) return e;
58
+ function tn(e, t) {
59
+ if (ne(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 (ne(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 nn(e) {
69
+ var t = tn(e, "string");
70
+ return ne(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 Fe(e, t, n) {
73
+ return (t = nn(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 K = 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), Fe(this, "status", void 0), Fe(this, "code", void 0), this.status = e, this.code = t;
83
83
  }
84
84
  };
85
- async function Pe(e) {
85
+ async function oe(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 K(e.status, t, n);
94
94
  }
95
- var Fe = (e, t = {}) => ({
95
+ var We = (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 rn(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() : oe(r);
106
106
  }
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);
107
+ async function on(e, t) {
108
+ const n = await fetch(`${e.base}/api/embed/sessions`, We(t));
109
+ return n.ok ? n.json() : oe(n);
110
110
  }
111
- async function Qt(e, t, n, r, o) {
111
+ var Le = (e) => ({ Authorization: `Bearer ${e}` });
112
+ async function sn(e, t) {
113
+ const n = await fetch(`${e.base}/api/embed/sessions/current`, { headers: Le(t) });
114
+ return n.ok ? n.json() : oe(n);
115
+ }
116
+ async function an(e, t) {
117
+ const n = await fetch(`${e.base}/api/embed/sessions/current/end`, {
118
+ method: "POST",
119
+ headers: Le(t)
120
+ });
121
+ return n.ok ? n.json() : oe(n);
122
+ }
123
+ async function ln(e, t, n, r, o) {
112
124
  const i = await fetch(`${e.base}/api/embed/chat`, {
113
- ...Fe({
125
+ ...We({
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
+ }, Le(t)),
124
136
  signal: o
125
137
  });
126
- return !i.ok || !i.body ? Pe(i) : Vt(i.body);
138
+ return !i.ok || !i.body ? oe(i) : en(i.body);
127
139
  }
128
- async function en(e, t) {
140
+ async function cn(e, t) {
129
141
  try {
130
142
  const n = await fetch(`${e.base}/api/embed/events`, {
131
- ...Fe(t),
143
+ ...We(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 V = (e) => typeof e == "object" && e !== null;
152
+ function yt(e) {
153
+ return V(e) && typeof e.id == "string" && V(e.config) && typeof e.config.type == "string" && V(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 un(e) {
156
+ return V(e) && typeof e.id == "string" && typeof e.mode == "string" && V(e.config) && Array.isArray(e.members) && e.members.every((t) => V(t) && yt(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 dn(e, t) {
159
+ return !V(e) || e.kind !== t ? null : t === "widget" && yt(e.payload) || t === "group" && un(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 we, q, xt, fn, Y, et, wt, St, Te, fe, ee, kt, Ne, je, Be, pn, ge = {}, me = [], hn = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Se = 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 Oe(e) {
155
167
  e && e.parentNode && e.parentNode.removeChild(e);
156
168
  }
157
- function sn(e, t, n) {
169
+ function _n(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 ? we.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 pe(e, a, r, o, null);
162
174
  }
163
- function oe(e, t, n, r, o) {
175
+ function pe(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 ? ++xt : 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 && q.vnode != null && q.vnode(i), i;
180
192
  }
181
- function W(e) {
193
+ function U(e) {
182
194
  return e.children;
183
195
  }
184
- function ae(e, t) {
196
+ function he(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 J(e, t) {
200
+ if (t == null) return e.__ ? J(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" ? J(e) : null;
191
203
  }
192
- function ln(e) {
204
+ function gn(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, q.vnode && q.vnode(i), Ye(e.__P, i, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n == null ? J(t) : n, !!(32 & t.__u), o), i.__v = t.__v, i.__.__k[i.__i] = i, Tt(r, i, o), t.__e = t.__ = null, i.__e != n && $t(i);
196
208
  }
197
209
  }
198
- function yt(e) {
210
+ function $t(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
+ }), $t(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 tt(e) {
216
+ (!e.__d && (e.__d = !0) && Y.push(e) && !be.__r++ || et != q.debounceRendering) && ((et = q.debounceRendering) || wt)(be);
205
217
  }
206
- function fe() {
218
+ function be() {
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; Y.length; ) Y.length > t && Y.sort(St), e = Y.shift(), t = Y.length, gn(e);
209
221
  } finally {
210
- L.length = fe.__r = 0;
222
+ Y.length = be.__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 Ct(e, t, n, r, o, i, a, u, d, c, f) {
226
+ var h, l, p, m, x, v, _ = r && r.__k || me, g = t.length;
227
+ for (d = mn(n, t, _, d, g), h = 0; h < g; h++) (p = n.__k[h]) != null && (l = p.__i != -1 && _[p.__i] || ge, p.__i = h, v = Ye(e, p, l, o, i, a, u, d, c, f), m = p.__e, p.ref && l.ref != p.ref && (l.ref && Ue(l.ref, null, p), f.push(p.ref, p.__c || m, p)), x == null && m != null && (x = m), 4 & p.__u ? (d = qt(p, d, e), l.__e && (l.__e = null)) : typeof p.type == "function" && v !== void 0 ? d = v : 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 mn(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] = pe(null, a, null, null, null) : Se(a) ? a = e.__k[i] = pe(U, { children: a }, null, null, null) : a.constructor === void 0 && a.__b > 0 ? a = e.__k[i] = pe(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 = bn(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 = J(u)), At(u, u));
222
234
  return r;
223
235
  }
224
- function wt(e, t, n) {
236
+ function qt(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 = qt(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 = J(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 bn(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 nt(e, t, n) {
257
+ t[0] == "-" ? e.setProperty(t, n == null ? "" : n) : e[t] = n == null ? "" : typeof n != "number" || hn.test(t) ? n : n + "px";
246
258
  }
247
- function te(e, t, n, r, o) {
259
+ function ce(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 || nt(e.style, t, "");
264
+ if (n) for (t in n) r && n[t] == r[t] || nt(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(kt, "$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[ee] = r[ee] : (n[ee] = Ne, e.addEventListener(t, i ? Be : je, i)) : e.removeEventListener(t, i ? Be : je, 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 rt(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[fe] == null) t[fe] = Ne++;
282
+ else if (t[fe] < n[ee]) return;
283
+ return n(q.event ? q.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, v, _, g, y, $, C, A, w, I, S, 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 = q.__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], C = f ? $ ? $.props.value : f.__ : r, n.__c ? _ = (l = t.__c = n.__c).__ = l.__E : (y ? t.__c = l = new T(g, C) : (t.__c = l = new he(g, C), l.constructor = T, l.render = yn), $ && $.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, C), t.__v == n.__v || !l.__e && l.shouldComponentUpdate != null && l.shouldComponentUpdate(g, l.__s, C) === !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
+ }), me.push.apply(l.__h, l._sb), l._sb = [], l.__h.length && a.push(l), u = J(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, C), y && l.componentDidUpdate != null && l.__h.push(function() {
303
+ l.componentDidUpdate(m, x, v);
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 = C, l.props = g, l.__P = e, l.__e = !1, A = q.__r, w = 0, y) l.state = l.__s, l.__d = !1, A && A(t), f = l.render(l.props, l.state, l.context), me.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, A && A(t), f = l.render(l.props, l.state, l.context), l.state = l.__s;
309
+ while (l.__d && ++w < 25);
310
+ l.state = l.__s, l.getChildContext != null && (r = L(L({}, r), l.getChildContext())), y && !p && l.getSnapshotBeforeUpdate != null && (v = l.getSnapshotBeforeUpdate(m, x)), I = f != null && f.type === U && f.key == null ? Mt(f.props.children) : f, u = Ct(e, Se(I) ? I : [I], 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 (S = i.length; S--; ) Oe(i[S]);
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 || It(t), q.__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 = vn(n.__e, t, n, r, o, i, a, d, c);
321
+ return (f = q.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 It(e) {
324
+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(It));
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 Tt(e, t, n) {
327
+ for (var r = 0; r < n.length; r++) Ue(n[r], n[++r], n[++r]);
328
+ q.__c && q.__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
+ q.__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 Mt(e) {
339
+ return typeof e != "object" || e == null || e.__b > 0 ? e : Se(e) ? e.map(Mt) : 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 vn(e, t, n, r, o, i, a, u, d) {
342
+ var c, f, h, l, p, m, x, v = n.props || ge, _ = 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 && (q.__m && q.__m(t, i), u = !1), i = null;
340
352
  }
341
- if (g == null) w === _ || u && e.data == _ || (e.data = _);
353
+ if (g == null) v === _ || 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 && we.call(e.childNodes), !u && i != null) for (v = {}, c = 0; c < e.attributes.length; c++) v[(p = e.attributes[c]).name] = p.value;
356
+ for (c in v) p = v[c], c == "dangerouslySetInnerHTML" ? h = p : c == "children" || c in _ || c == "value" && "defaultValue" in _ || c == "checked" && "defaultChecked" in _ || ce(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" || v[c] === p || ce(e, c, p, v[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 = ""), Ct(t.type == "template" ? e.content : e, Se(l) ? l : [l], t, n, r, g == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, i, a, i ? i[0] : n.__k && J(n, 0), u, d), i != null) for (c = i.length; c--; ) Oe(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 != v[c]) && ce(e, c, m, v[c], o), c = "checked", x != null && x != e[c] && ce(e, c, x, v[c], o));
349
361
  }
350
362
  return e;
351
363
  }
352
- function Le(e, t, n) {
364
+ function Ue(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
+ q.__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 (q.unmount && q.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || Ue(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
+ q.__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 || Oe(e.__e), e.__c = e.__ = e.__e = void 0;
374
386
  }
375
- function fn(e, t, n) {
387
+ function yn(e, t, n) {
376
388
  return this.constructor(e, n);
377
389
  }
378
- function Ze(e, t, n) {
390
+ function it(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), q.__ && q.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, i = [], a = [], Ye(t, e = (!r && n || t).__k = _n(U, null, [e]), o || ge, ge, t.namespaceURI, !r && n ? [n] : o ? null : t.firstChild ? we.call(t.childNodes) : null, i, !r && n ? n : o ? o.__e : t.firstChild, r, a), Tt(i, e, a), e.props.children = null;
381
393
  }
382
- _e = de.slice, C = { __e: function(e, t, n, r) {
394
+ we = me.slice, q = { __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
+ } }, xt = 0, fn = 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
+ }, he.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), tt(this));
406
+ }, he.prototype.forceUpdate = function(e) {
407
+ this.__v && (this.__e = !0, e && this.__h.push(e), tt(this));
408
+ }, he.prototype.render = U, Y = [], wt = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, St = 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
+ }, be.__r = 0, Te = Math.random().toString(8), fe = "__d" + Te, ee = "__a" + Te, kt = /(PointerCapture)$|Capture$/i, Ne = 0, je = rt(!1), Be = rt(!0), pn = 0;
411
+ var re, R, Me, ot, ie = 0, zt = [], H = q, st = H.__b, at = H.__r, lt = H.diffed, ct = H.__c, ut = H.unmount, dt = H.__;
412
+ function Ge(e, t) {
413
+ H.__h && H.__h(R, e, ie || t), ie = 0;
414
+ var n = R.__H || (R.__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 ie = 1, xn(Ht, 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 xn(e, t, n) {
424
+ var r = Ge(re++, 2);
425
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Ht(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 = R, !R.__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
+ R.__f = !0;
445
+ var i = R.shouldComponentUpdate, a = R.componentWillUpdate;
446
+ R.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
+ }, R.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 = Ge(re++, 3);
458
+ !H.__s && Rt(n.__H, t) && (n.__ = e, n.u = t, R.__H.__h.push(n));
447
459
  }
448
- function F(e) {
449
- return ee = 5, he(function() {
460
+ function D(e) {
461
+ return ie = 5, ve(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 ve(e, t) {
466
+ var n = Ge(re++, 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 ie = 8, ve(function() {
459
471
  return e;
460
472
  }, t);
461
473
  }
462
- function pn() {
463
- for (var e; e = qt.shift(); ) {
474
+ function wn() {
475
+ for (var e; e = zt.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(_e), t.__h.some(De), t.__h = [];
467
479
  } catch (n) {
468
- t.__h = [], T.__e(n, e.__v);
480
+ t.__h = [], H.__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
+ H.__b = function(e) {
485
+ R = null, st && st(e);
486
+ }, H.__ = function(e, t) {
487
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), dt && dt(e, t);
488
+ }, H.__r = function(e) {
489
+ at && at(e), re = 0;
490
+ var t = (R = e.__c).__H;
491
+ t && (Me === R ? (t.__h = [], R.__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(_e), t.__h.some(De), t.__h = [], re = 0)), Me = R;
494
+ }, H.diffed = function(e) {
495
+ lt && lt(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 && (zt.push(t) !== 1 && ot === H.requestAnimationFrame || ((ot = H.requestAnimationFrame) || Sn)(wn)), 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
+ })), Me = R = null;
500
+ }, H.__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(_e), n.__h = n.__h.filter(function(r) {
504
+ return !r.__ || De(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 = [], H.__e(r, n.__v);
498
510
  }
499
- }), rt && rt(e, t);
500
- }, T.unmount = function(e) {
501
- it && it(e);
511
+ }), ct && ct(e, t);
512
+ }, H.unmount = function(e) {
513
+ ut && ut(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
+ _e(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 && H.__e(t, n.__v));
510
522
  };
511
- var at = typeof requestAnimationFrame == "function";
512
- function _n(e) {
523
+ var ft = typeof requestAnimationFrame == "function";
524
+ function Sn(e) {
513
525
  var t, n = function() {
514
- clearTimeout(r), at && cancelAnimationFrame(t), setTimeout(e);
526
+ clearTimeout(r), ft && cancelAnimationFrame(t), setTimeout(e);
515
527
  }, r = setTimeout(n, 35);
516
- at && (t = requestAnimationFrame(n));
528
+ ft && (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 _e(e) {
531
+ var t = R, n = e.__c;
532
+ typeof n == "function" && (e.__c = void 0, n()), R = t;
521
533
  }
522
- function Re(e) {
523
- var t = M;
524
- e.__c = e.__(), M = t;
534
+ function De(e) {
535
+ var t = R;
536
+ e.__c = e.__(), R = 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 Ht(e, t) {
532
544
  return typeof t == "function" ? t(e) : t;
533
545
  }
534
- var gn = `
546
+ var kn = `
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 se(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 ae(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 Et(e, t) {
593
+ try {
594
+ window[e].removeItem(t);
595
+ } catch {
596
+ }
597
+ }
598
+ var $n = 2e3, Cn = 20, qn = 100;
599
+ function Ke(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 pt = "usereq:visitor";
606
+ function Pt() {
607
+ const e = se("localStorage", pt);
590
608
  if (e) return e;
591
- const t = Ne();
592
- return be("localStorage", st, t), t;
609
+ const t = Ke();
610
+ return ae("localStorage", pt, t), t;
593
611
  }
594
- function yn(e, t) {
612
+ function In(e, t) {
595
613
  const n = [];
596
614
  let r = null;
597
- const o = Tt(), i = () => {
615
+ const o = Pt(), 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, qn);
618
+ cn(e, { events: u });
601
619
  }
602
620
  }, a = (u, d = {}) => {
603
621
  n.push({
604
- id: Ne(),
622
+ id: Ke(),
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 >= Cn ? i() : r === null && (r = window.setTimeout(i, $n));
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 Ft = (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 Tn(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 Mn(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 && se("sessionStorage", Ft(n.id))) && n.conditions.every((r) => Tn(r, t)))
656
674
  return n;
657
675
  return null;
658
676
  }
659
- function Et(e, t, n) {
677
+ function jt(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 Bt(e, t, n) {
746
+ const r = Mn(e, t);
747
+ return r ? jt(r.trigger, r.triggerParams, () => {
748
+ r.once && ae("sessionStorage", Ft(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 ht = (e) => `usereq:split:${e}`, Dt = (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 ke(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 zn(e) {
763
+ const t = ke(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 = se("localStorage", ht(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(`${Pt()}:${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 ae("localStorage", ht(e.id), a.widget.id), a;
759
777
  }
760
- function Rt(e) {
778
+ function Wt(e) {
761
779
  var t, n;
762
- const r = ve(e.members);
780
+ const r = ke(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 = se("sessionStorage", Dt(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 = ke(e.members), o = r.findIndex((i) => i.widget.id === t.widget.id);
789
+ return jt(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
+ ae("sessionStorage", Dt(e.id), String(a)), n((i = r[a]) !== null && i !== void 0 ? i : null);
779
797
  });
780
798
  }
781
- function Cn(e) {
799
+ function Hn(e) {
782
800
  switch (e.mode) {
783
801
  case "split": {
784
- const t = Sn(e);
802
+ const t = zn(e);
785
803
  return t ? [t.widget] : [];
786
804
  }
787
805
  case "sequence": {
788
- const t = Rt(e);
806
+ const t = Wt(e);
789
807
  return t ? [t.widget] : [];
790
808
  }
791
809
  case "parallel":
792
- return ve(e.members).map((t) => t.widget);
810
+ return ke(e.members).map((t) => t.widget);
793
811
  }
794
812
  }
795
- function qn(e) {
813
+ function En(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 = _t(getComputedStyle(document.body).backgroundColor)) !== null && t !== void 0 ? t : _t(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 _t(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 Pn(e = window.innerWidth) {
812
830
  return e < 640 ? "mobile" : e < 1024 ? "tablet" : "desktop";
813
831
  }
814
- function Mn() {
832
+ function Fn() {
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: Pn()
832
850
  };
833
851
  }
834
- function Pt(e) {
852
+ function Lt(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 jn(e) {
861
+ const { r: t, g: n, b: r } = Lt(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 le = (e) => e ? "245,245,241" : "21,23,30";
865
+ function Bn(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 } = Lt(r);
854
872
  return `rgba(${o},${i},${a},${n.alpha / 100})`;
855
873
  })(),
856
- accentText: Tn(r),
874
+ accentText: jn(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: le(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 Dn = 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: --Dn,
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 q.vnode && q.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 Nt = ({ 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
+ }), Ot = ({ 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
+ }), $e = ({ 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
+ }), Ve = ({ 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
+ }), Wn = ({ 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
+ }), Ln = ({ 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
+ }), Nn = ({ 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
+ }), On = ({ 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
+ }), Un = ({ 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
+ }), Gn = ({ 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 Kn({ 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,101 @@ 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($e, { size: 14 })
1043
1068
  })
1044
1069
  ]
1045
1070
  });
1046
1071
  }
1047
- var Ie = {
1072
+ var ze = {
1048
1073
  holdMs: 1260,
1049
1074
  gapMs: 1520,
1050
1075
  jitterMs: 100
1051
1076
  };
1052
- function Ln(e, t = Math.random) {
1077
+ function Vn(e, t = Math.random) {
1053
1078
  const n = [];
1054
1079
  let r = 0;
1055
1080
  for (let o = 0; o < e; o++) {
1056
- if (o === 0) r += Ie.holdMs;
1081
+ if (o === 0) r += ze.holdMs;
1057
1082
  else {
1058
- const i = Math.round((t() * 2 - 1) * Ie.jitterMs);
1059
- r += Math.max(0, Ie.gapMs + i);
1083
+ const i = Math.round((t() * 2 - 1) * ze.jitterMs);
1084
+ r += Math.max(0, ze.gapMs + i);
1060
1085
  }
1061
1086
  n.push(r);
1062
1087
  }
1063
1088
  return n;
1064
1089
  }
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 = [];
1090
+ var ye = (e) => `usereq:session:${e}`;
1091
+ function Xn(e, t = Date.now()) {
1092
+ const n = se("localStorage", ye(e));
1093
+ if (!n) return null;
1094
+ try {
1095
+ const r = JSON.parse(n);
1096
+ 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;
1097
+ const o = Date.parse(r.expiresAt);
1098
+ return !Number.isFinite(o) || o <= t ? (Et("localStorage", ye(e)), null) : {
1099
+ token: r.token,
1100
+ conversationId: r.conversationId,
1101
+ expiresAt: r.expiresAt
1102
+ };
1103
+ } catch {
1104
+ return null;
1105
+ }
1106
+ }
1107
+ function Jn(e, t) {
1108
+ ae("localStorage", ye(e), JSON.stringify(t));
1109
+ }
1110
+ function Zn(e) {
1111
+ Et("localStorage", ye(e));
1112
+ }
1113
+ function Qn(e) {
1114
+ const t = e.parts.map((n) => n.text).filter((n) => n.trim());
1115
+ return t.length === 0 ? null : {
1116
+ id: e.id,
1117
+ role: e.role,
1118
+ parts: t,
1119
+ shown: t.length
1069
1120
  };
1070
- P(() => () => w(), []);
1071
- const _ = X(async () => {
1072
- if (l.current) return l.current;
1073
- const v = await Zt(e, {
1121
+ }
1122
+ function er(e, t, n, r) {
1123
+ 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), v = D([]), _ = D(null), g = () => {
1124
+ for (const w of v.current) window.clearTimeout(w);
1125
+ v.current = [];
1126
+ };
1127
+ P(() => () => g(), []);
1128
+ const y = t.id, $ = O(() => {
1129
+ m.current = null, h(null), Zn(y);
1130
+ }, [y]);
1131
+ P(() => {
1132
+ const w = Xn(y);
1133
+ if (!w) return;
1134
+ let I = !1;
1135
+ return m.current = {
1136
+ token: w.token,
1137
+ conversationId: w.conversationId
1138
+ }, h(w.conversationId), sn(e, w.token).then((S) => {
1139
+ if (!I) {
1140
+ if (S.ended) {
1141
+ $();
1142
+ return;
1143
+ }
1144
+ i(S.messages.flatMap((T) => {
1145
+ const M = Qn(T);
1146
+ return M ? [M] : [];
1147
+ }));
1148
+ }
1149
+ }).catch((S) => {
1150
+ I || S instanceof K && S.status < 500 && $();
1151
+ }), () => {
1152
+ I = !0;
1153
+ };
1154
+ }, [
1155
+ e,
1156
+ y,
1157
+ $
1158
+ ]);
1159
+ const C = O(async () => {
1160
+ if (m.current) return m.current;
1161
+ const w = await on(e, {
1074
1162
  kind: n.kind,
1075
1163
  id: n.id,
1076
1164
  widgetId: n.kind === "group" ? t.id : void 0,
@@ -1078,74 +1166,121 @@ function Wn(e, t, n, r) {
1078
1166
  referrer: r.referrer || void 0,
1079
1167
  utm: Object.keys(r.utm).length ? r.utm : void 0
1080
1168
  });
1081
- return l.current = {
1082
- token: v.token,
1083
- conversationId: v.conversationId
1084
- }, p(v.conversationId), l.current;
1169
+ return m.current = {
1170
+ token: w.token,
1171
+ conversationId: w.conversationId
1172
+ }, Jn(y, {
1173
+ token: w.token,
1174
+ conversationId: w.conversationId,
1175
+ expiresAt: w.expiresAt
1176
+ }), h(w.conversationId), m.current;
1085
1177
  }, [
1086
1178
  e,
1087
1179
  n.kind,
1088
1180
  n.id,
1089
1181
  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);
1182
+ r,
1183
+ y
1184
+ ]), A = O(async (w, I) => {
1185
+ var S;
1186
+ (S = x.current) === null || S === void 0 || S.abort();
1187
+ const T = new AbortController();
1188
+ x.current = T, g(), u(!0), c(null);
1096
1189
  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,
1190
+ const { token: M } = await C(), G = await ln(e, M, w, I, T.signal);
1191
+ if (T.signal.aborted) return;
1192
+ const F = G.parts.filter((W) => W.trim());
1193
+ if (F.length === 0) throw new Error("The agent did not answer. Try again.");
1194
+ i((W) => [...W, {
1195
+ id: G.id,
1103
1196
  role: "assistant",
1104
- parts: H,
1197
+ parts: F,
1105
1198
  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.");
1199
+ }]), v.current = Vn(F.length).map((W, Q) => window.setTimeout(() => {
1200
+ i((N) => N.map((B) => B.id === G.id ? {
1201
+ ...B,
1202
+ shown: Q + 1
1203
+ } : B)), Q === F.length - 1 && u(!1);
1204
+ }, W));
1205
+ } catch (M) {
1206
+ if (T.signal.aborted) return;
1207
+ M instanceof K && (M.status === 401 || M.status === 409) && $(), u(!1), c(M instanceof K ? 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
1208
  }
1116
- }, [e, _]);
1209
+ }, [
1210
+ e,
1211
+ C,
1212
+ $
1213
+ ]);
1117
1214
  return {
1118
1215
  turns: o,
1119
1216
  busy: a,
1120
1217
  error: d,
1121
1218
  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
1219
+ stopping: l,
1220
+ send: O((w) => {
1221
+ const I = w.trim().slice(0, 4e3);
1222
+ if (!I || a || l) return;
1223
+ const S = {
1224
+ id: Ke(),
1225
+ text: I
1128
1226
  };
1129
- y.current = x, i((q) => [...q, {
1130
- id: x.id,
1227
+ _.current = S, i((T) => [...T, {
1228
+ id: S.id,
1131
1229
  role: "user",
1132
- parts: [k],
1230
+ parts: [I],
1133
1231
  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
- }, [])
1232
+ }]), A(S, "submit-message");
1233
+ }, [
1234
+ a,
1235
+ l,
1236
+ A
1237
+ ]),
1238
+ retry: O(() => {
1239
+ !_.current || a || l || A(_.current, "regenerate-message");
1240
+ }, [
1241
+ a,
1242
+ l,
1243
+ A
1244
+ ]),
1245
+ stop: O(() => {
1246
+ var w;
1247
+ (w = x.current) === null || w === void 0 || w.abort(), x.current = null, g(), i((I) => I.map((S) => S.role === "assistant" && S.shown < S.parts.length ? {
1248
+ ...S,
1249
+ shown: S.parts.length
1250
+ } : S)), u(!1);
1251
+ }, []),
1252
+ askToStop: O(() => {
1253
+ !m.current || a || p({
1254
+ busy: !1,
1255
+ error: null
1256
+ });
1257
+ }, [a]),
1258
+ answerStop: O(async (w) => {
1259
+ const I = m.current;
1260
+ if (!w || !I) {
1261
+ p(null);
1262
+ return;
1263
+ }
1264
+ p({
1265
+ busy: !0,
1266
+ error: null
1267
+ });
1268
+ try {
1269
+ await an(e, I.token);
1270
+ } catch (S) {
1271
+ if (!(S instanceof K && (S.status === 401 || S.status === 409))) {
1272
+ p({
1273
+ busy: !1,
1274
+ error: S instanceof K ? S.message : "Could not stop the conversation. Try again."
1275
+ });
1276
+ return;
1277
+ }
1278
+ }
1279
+ $(), _.current = null, i([]), c(null), p(null);
1280
+ }, [e, $])
1146
1281
  };
1147
1282
  }
1148
- function Nn() {
1283
+ function tr() {
1149
1284
  const e = "(max-width: 639px)", [t, n] = E(() => {
1150
1285
  var r, o, i;
1151
1286
  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 +1293,9 @@ function Nn() {
1158
1293
  return i.addEventListener("change", a), () => i.removeEventListener("change", a);
1159
1294
  }, []), t;
1160
1295
  }
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 = (_) => {
1296
+ var nr = 0.5, gt = 120, Re = () => document.documentElement.clientHeight;
1297
+ function Ut({ look: e, pinned: t, onClose: n, children: r }) {
1298
+ const [o, i] = E("half"), [a, u] = E(null), d = D(null), c = D(null), f = (_) => {
1164
1299
  const g = d.current;
1165
1300
  g && (_.currentTarget.setPointerCapture(_.pointerId), c.current = {
1166
1301
  startY: _.clientY,
@@ -1169,50 +1304,50 @@ function Dt({ look: e, pinned: t, onClose: n, children: r }) {
1169
1304
  lastAt: _.timeStamp,
1170
1305
  velocity: 0
1171
1306
  }, u(c.current.startHeight));
1172
- }, p = (_) => {
1307
+ }, h = (_) => {
1173
1308
  const g = c.current;
1174
1309
  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)));
1310
+ const y = _.timeStamp - g.lastAt;
1311
+ y > 0 && (g.velocity = (_.clientY - g.lastY) / y), g.lastY = _.clientY, g.lastAt = _.timeStamp;
1312
+ const $ = g.startHeight + (g.startY - _.clientY);
1313
+ u(Math.max(gt, Math.min(Re(), $)));
1179
1314
  }, l = () => {
1180
1315
  const _ = c.current;
1181
1316
  if (!_) return;
1182
1317
  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") {
1318
+ const g = Math.max(gt, Math.min(Re(), _.startHeight + (_.startY - _.lastY))), y = Re();
1319
+ let $;
1320
+ if (_.velocity < -0.5 ? $ = "full" : _.velocity > nr ? $ = o === "full" ? "half" : "closed" : g > y * 0.75 ? $ = "full" : g < y * 0.3 ? $ = "closed" : $ = "half", u(null), $ === "closed") {
1186
1321
  t ? i("half") : n();
1187
1322
  return;
1188
1323
  }
1189
- i(k);
1190
- }, { ink: h, surfaceBg: m, rad: y } = e, w = o === "full" && a === null;
1324
+ i($);
1325
+ }, { ink: p, surfaceBg: m, rad: x } = e, v = o === "full" && a === null;
1191
1326
  return /* @__PURE__ */ s("div", {
1192
1327
  ref: d,
1193
1328
  class: [
1194
1329
  "uq-fixed uq-drawer uq-slide",
1195
- w ? "uq-drawer-full" : "uq-drawer-half",
1330
+ v ? "uq-drawer-full" : "uq-drawer-half",
1196
1331
  a !== null && "uq-drawer-held"
1197
1332
  ].filter(Boolean).join(" "),
1198
1333
  role: "dialog",
1199
1334
  "aria-modal": "false",
1200
1335
  style: {
1201
1336
  height: a !== null ? a : void 0,
1202
- borderRadius: w ? 0 : `${y}px ${y}px 0 0`,
1203
- borderTop: `1px solid rgba(${h},.12)`,
1337
+ borderRadius: v ? 0 : `${x}px ${x}px 0 0`,
1338
+ borderTop: `1px solid rgba(${p},.12)`,
1204
1339
  background: m,
1205
1340
  boxShadow: "0 -12px 40px rgba(0,0,0,.18)"
1206
1341
  },
1207
1342
  children: [/* @__PURE__ */ s("div", {
1208
1343
  class: "uq-grab",
1209
1344
  onPointerDown: f,
1210
- onPointerMove: p,
1345
+ onPointerMove: h,
1211
1346
  onPointerUp: l,
1212
1347
  onPointerCancel: l,
1213
- "aria-label": w ? "Drag down to shrink or close" : "Drag up to expand",
1348
+ "aria-label": v ? "Drag down to shrink or close" : "Drag up to expand",
1214
1349
  style: { background: m },
1215
- children: /* @__PURE__ */ s("span", { style: { background: `rgba(${h},.25)` } })
1350
+ children: /* @__PURE__ */ s("span", { style: { background: `rgba(${p},.25)` } })
1216
1351
  }), r]
1217
1352
  });
1218
1353
  }
@@ -1260,25 +1395,25 @@ var b = {
1260
1395
  composerHeight: 36,
1261
1396
  sendSize: 36,
1262
1397
  sendIcon: 20
1263
- }, Yn = 3600, Oe = (e) => e.welcome || "Hi! Ask me anything before you buy.";
1264
- function Lt(e, t = "Type your message…") {
1398
+ }, rr = 3600, Xe = (e) => e.welcome || "Hi! Ask me anything before you buy.";
1399
+ function Gt(e, t = "Type your message…") {
1265
1400
  const n = e.spotlights.filter((a) => a.trim()), [r, o] = E(0);
1266
1401
  P(() => {
1267
1402
  if (n.length < 2) return;
1268
- const a = window.setInterval(() => o((u) => u + 1), Yn);
1403
+ const a = window.setInterval(() => o((u) => u + 1), rr);
1269
1404
  return () => window.clearInterval(a);
1270
1405
  }, [n.length]);
1271
1406
  const i = e.placeholder || t;
1272
1407
  return n.length ? n[r % n.length] : i;
1273
1408
  }
1274
- function we(e) {
1275
- const t = F(null);
1409
+ function Ce(e) {
1410
+ const t = D(null);
1276
1411
  return P(() => {
1277
1412
  const n = t.current;
1278
1413
  n && (n.scrollTop = n.scrollHeight);
1279
1414
  }, e), t;
1280
1415
  }
1281
- function Wt(e) {
1416
+ function Kt(e) {
1282
1417
  const t = e ? "dark" : "light";
1283
1418
  return {
1284
1419
  surface: b.surface[t],
@@ -1287,7 +1422,7 @@ function Wt(e) {
1287
1422
  border: b.border[t]
1288
1423
  };
1289
1424
  }
1290
- var Y = (e, t = {}) => ({
1425
+ var X = (e, t = {}) => ({
1291
1426
  width: e,
1292
1427
  height: e,
1293
1428
  borderRadius: "50%",
@@ -1297,7 +1432,7 @@ var Y = (e, t = {}) => ({
1297
1432
  flexShrink: 0,
1298
1433
  ...t
1299
1434
  });
1300
- function Ye({ payload: e, size: t, font: n, palette: r, fallback: o }) {
1435
+ function Je({ payload: e, size: t, font: n, palette: r, fallback: o }) {
1301
1436
  var i, a, u, d;
1302
1437
  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
1438
  return f ? /* @__PURE__ */ s("img", {
@@ -1305,9 +1440,9 @@ function Ye({ payload: e, size: t, font: n, palette: r, fallback: o }) {
1305
1440
  alt: "",
1306
1441
  width: t,
1307
1442
  height: t,
1308
- style: Y(t, { objectFit: "cover" })
1443
+ style: X(t, { objectFit: "cover" })
1309
1444
  }) : /* @__PURE__ */ s("span", {
1310
- style: Y(t, {
1445
+ style: X(t, {
1311
1446
  background: r.bubble,
1312
1447
  color: r.muted,
1313
1448
  fontSize: n,
@@ -1317,7 +1452,7 @@ function Ye({ payload: e, size: t, font: n, palette: r, fallback: o }) {
1317
1452
  children: c ? c.trim().charAt(0).toUpperCase() : "A"
1318
1453
  });
1319
1454
  }
1320
- function dt({ text: e, mine: t, runStart: n, look: r, config: o, payload: i, palette: a, children: u }) {
1455
+ function He({ text: e, mine: t, runStart: n, look: r, config: o, payload: i, palette: a, children: u }) {
1321
1456
  return /* @__PURE__ */ s("div", {
1322
1457
  class: "uq-rise",
1323
1458
  style: {
@@ -1327,7 +1462,7 @@ function dt({ text: e, mine: t, runStart: n, look: r, config: o, payload: i, pal
1327
1462
  justifyContent: t ? "flex-end" : "flex-start",
1328
1463
  marginTop: n ? 6 : 2
1329
1464
  },
1330
- children: [!t && (n ? /* @__PURE__ */ s(Ye, {
1465
+ children: [!t && (n ? /* @__PURE__ */ s(Je, {
1331
1466
  payload: i,
1332
1467
  size: b.avatarSize,
1333
1468
  font: 12,
@@ -1336,7 +1471,7 @@ function dt({ text: e, mine: t, runStart: n, look: r, config: o, payload: i, pal
1336
1471
  width: b.avatarSize,
1337
1472
  flexShrink: 0
1338
1473
  } })), /* @__PURE__ */ s("div", {
1339
- class: S(o, t ? "userMessage" : "botMessage"),
1474
+ class: k(o, t ? "userMessage" : "botMessage"),
1340
1475
  style: {
1341
1476
  maxWidth: b.bubbleMaxWidth,
1342
1477
  padding: u ? "8px 12px" : b.bubblePadding,
@@ -1352,52 +1487,111 @@ function dt({ text: e, mine: t, runStart: n, look: r, config: o, payload: i, pal
1352
1487
  })]
1353
1488
  });
1354
1489
  }
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([
1490
+ function ir({ chat: e, stopping: t }) {
1491
+ const n = {
1492
+ padding: "6px 12px",
1493
+ borderRadius: 999,
1494
+ fontSize: 13,
1495
+ fontWeight: 600,
1496
+ lineHeight: 1.3,
1497
+ opacity: t.busy ? 0.6 : 1
1498
+ };
1499
+ return /* @__PURE__ */ s("div", {
1500
+ class: "uq-stop",
1501
+ style: {
1502
+ display: "flex",
1503
+ flexDirection: "column",
1504
+ gap: 8
1505
+ },
1506
+ children: [
1507
+ /* @__PURE__ */ s("span", {
1508
+ style: { fontWeight: 600 },
1509
+ children: "Stop the conversation?"
1510
+ }),
1511
+ /* @__PURE__ */ s("span", { children: "Do you want to stop this conversation?" }),
1512
+ /* @__PURE__ */ s("div", {
1513
+ style: {
1514
+ display: "flex",
1515
+ gap: 6,
1516
+ flexWrap: "wrap"
1517
+ },
1518
+ children: [/* @__PURE__ */ s("button", {
1519
+ type: "button",
1520
+ onClick: () => e.answerStop(!1),
1521
+ disabled: t.busy,
1522
+ style: {
1523
+ ...n,
1524
+ border: `1px solid ${b.blue}`,
1525
+ color: b.blue
1526
+ },
1527
+ children: "Keep chatting"
1528
+ }), /* @__PURE__ */ s("button", {
1529
+ type: "button",
1530
+ onClick: () => e.answerStop(!0),
1531
+ disabled: t.busy,
1532
+ style: {
1533
+ ...n,
1534
+ background: b.gradient,
1535
+ color: "#fff"
1536
+ },
1537
+ children: t.busy ? "Stopping…" : "Stop conversation"
1538
+ })]
1539
+ }),
1540
+ t.error && /* @__PURE__ */ s("span", {
1541
+ class: "uq-fade",
1542
+ style: { opacity: 0.7 },
1543
+ children: t.error
1544
+ })
1545
+ ]
1546
+ });
1547
+ }
1548
+ function mt({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobile: a, fill: u = !1, onMinimize: d, onClose: c }) {
1549
+ var f, h, l, p;
1550
+ const m = Kt(n.hostDark), { surface: x, bubble: v, muted: _, border: g } = m, y = Gt(t, b.composerPlaceholder), $ = (f = (h = e.agent) === null || h === void 0 ? void 0 : h.name) !== null && f !== void 0 ? f : null, C = !!(!((l = e.agent) === null || l === void 0) && l.live), A = Ce([
1358
1551
  r.turns,
1359
1552
  r.busy,
1360
- r.error
1361
- ]), [$, z] = E(""), H = F(null);
1553
+ r.error,
1554
+ r.stopping
1555
+ ]), [w, I] = E(""), S = D(null);
1362
1556
  P(() => {
1363
- var I;
1364
- o > 0 && ((I = H.current) === null || I === void 0 || I.focus());
1557
+ var z;
1558
+ o > 0 && ((z = S.current) === null || z === void 0 || z.focus());
1365
1559
  }, [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 = [{
1560
+ const T = C && !r.stopping, M = (z) => {
1561
+ z.preventDefault(), T && (r.send(w), I(""));
1562
+ }, G = !((p = t.cta) === null || p === void 0 || (p = p.href) === null || p === void 0) && p.trim() ? t.cta : null, F = [{
1369
1563
  key: "welcome",
1370
- text: Oe(t),
1564
+ text: Xe(t),
1371
1565
  mine: !1
1372
1566
  }];
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 : "",
1567
+ for (const z of r.turns) if (z.role === "user") {
1568
+ var W;
1569
+ F.push({
1570
+ key: z.id,
1571
+ text: (W = z.parts[0]) !== null && W !== void 0 ? W : "",
1378
1572
  mine: !0
1379
1573
  });
1380
- } else I.parts.slice(0, I.shown).forEach((G, ke) => {
1381
- D.push({
1382
- key: `${I.id}:${ke}`,
1383
- text: G,
1574
+ } else z.parts.slice(0, z.shown).forEach((Z, qe) => {
1575
+ F.push({
1576
+ key: `${z.id}:${qe}`,
1577
+ text: Z,
1384
1578
  mine: !1
1385
1579
  });
1386
1580
  });
1387
- const Gt = D[D.length - 1], V = (I, G, ke, Se, Ge) => /* @__PURE__ */ s("button", {
1581
+ const Q = F[F.length - 1], N = (z, Z, qe, Ie, Qe) => /* @__PURE__ */ s("button", {
1388
1582
  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
1583
+ class: Qe ? k(t, Qe) : void 0,
1584
+ onClick: Ie,
1585
+ disabled: !Ie,
1586
+ "aria-label": Z,
1587
+ style: X(a ? 36 : b.headerButton, {
1588
+ color: qe,
1589
+ opacity: Ie ? 1 : 0.6
1396
1590
  }),
1397
- children: I
1398
- }), K = b.headerIcon;
1591
+ children: z
1592
+ }), B = b.headerIcon;
1399
1593
  return /* @__PURE__ */ s("div", {
1400
- class: S(t, "panel"),
1594
+ class: k(t, "panel"),
1401
1595
  style: {
1402
1596
  display: "flex",
1403
1597
  flexDirection: "column",
@@ -1405,7 +1599,7 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1405
1599
  overflow: "hidden",
1406
1600
  border: u ? void 0 : `1px solid ${g}`,
1407
1601
  boxShadow: u ? void 0 : b.panelShadow,
1408
- background: y,
1602
+ background: x,
1409
1603
  color: `rgb(${n.ink})`,
1410
1604
  ...u ? {
1411
1605
  flex: 1,
@@ -1417,7 +1611,7 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1417
1611
  },
1418
1612
  children: [
1419
1613
  /* @__PURE__ */ s("div", {
1420
- class: S(t, "header"),
1614
+ class: k(t, "header"),
1421
1615
  style: {
1422
1616
  display: "flex",
1423
1617
  alignItems: "center",
@@ -1426,7 +1620,7 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1426
1620
  borderBottom: `1px solid ${g}`
1427
1621
  },
1428
1622
  children: [
1429
- /* @__PURE__ */ s(Ye, {
1623
+ /* @__PURE__ */ s(Je, {
1430
1624
  payload: e,
1431
1625
  size: b.headerAvatar,
1432
1626
  font: 14,
@@ -1448,25 +1642,26 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1448
1642
  textOverflow: "ellipsis",
1449
1643
  whiteSpace: "nowrap"
1450
1644
  },
1451
- children: k ? k.split("—")[0].trim() : "Chat"
1645
+ children: $ ? $.split("—")[0].trim() : "Chat"
1452
1646
  }), /* @__PURE__ */ s("span", {
1453
1647
  style: {
1454
1648
  color: _,
1455
1649
  opacity: 0.7,
1456
1650
  display: "flex"
1457
1651
  },
1458
- children: /* @__PURE__ */ s(Bt, { size: 16 })
1652
+ children: /* @__PURE__ */ s(Yt, { size: 16 })
1459
1653
  })]
1460
1654
  }),
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")
1655
+ N(/* @__PURE__ */ s(Wn, { size: B }), "Call (unavailable)", b.blue),
1656
+ N(/* @__PURE__ */ s(Ln, { size: B }), "Video call (unavailable)", b.blue),
1657
+ N(/* @__PURE__ */ s(Nn, { size: B }), "Details (unavailable)", _),
1658
+ r.sessionId && N(/* @__PURE__ */ s(Ve, { size: B }), "Stop conversation", _, r.busy || r.stopping ? void 0 : r.askToStop, "stopButton"),
1659
+ d && N(/* @__PURE__ */ s(On, { size: B }), "Minimize chat", _, d),
1660
+ c && N(/* @__PURE__ */ s($e, { size: B }), "Close chat", _, c, "close")
1466
1661
  ]
1467
1662
  }),
1468
1663
  /* @__PURE__ */ s("div", {
1469
- ref: q,
1664
+ ref: A,
1470
1665
  style: {
1471
1666
  flex: 1,
1472
1667
  minHeight: 0,
@@ -1477,18 +1672,30 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1477
1672
  overscrollBehavior: "contain"
1478
1673
  },
1479
1674
  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,
1675
+ F.map((z, Z) => /* @__PURE__ */ s(He, {
1676
+ text: z.text,
1677
+ mine: z.mine,
1678
+ runStart: Z === 0 || F[Z - 1].mine !== z.mine,
1484
1679
  look: n,
1485
1680
  config: t,
1486
1681
  payload: e,
1487
1682
  palette: m
1488
- }, I.key)),
1489
- r.busy && /* @__PURE__ */ s(dt, {
1683
+ }, z.key)),
1684
+ r.stopping && /* @__PURE__ */ s(He, {
1490
1685
  mine: !1,
1491
- runStart: Gt.mine,
1686
+ runStart: Q.mine,
1687
+ look: n,
1688
+ config: t,
1689
+ payload: e,
1690
+ palette: m,
1691
+ children: /* @__PURE__ */ s(ir, {
1692
+ chat: r,
1693
+ stopping: r.stopping
1694
+ })
1695
+ }),
1696
+ r.busy && /* @__PURE__ */ s(He, {
1697
+ mine: !1,
1698
+ runStart: Q.mine,
1492
1699
  look: n,
1493
1700
  config: t,
1494
1701
  payload: e,
@@ -1536,7 +1743,7 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1536
1743
  })
1537
1744
  ]
1538
1745
  }),
1539
- R && /* @__PURE__ */ s("div", {
1746
+ G && /* @__PURE__ */ s("div", {
1540
1747
  style: {
1541
1748
  display: "flex",
1542
1749
  justifyContent: "flex-end",
@@ -1544,7 +1751,7 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1544
1751
  },
1545
1752
  children: /* @__PURE__ */ s("a", {
1546
1753
  class: "uq-cta",
1547
- href: R.href,
1754
+ href: G.href,
1548
1755
  target: "_blank",
1549
1756
  rel: "noopener noreferrer",
1550
1757
  onClick: i,
@@ -1560,12 +1767,12 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1560
1767
  fontWeight: 600,
1561
1768
  boxShadow: b.ctaShadow
1562
1769
  },
1563
- children: [R.label || "Learn more", /* @__PURE__ */ s(jn, { size: 16 })]
1770
+ children: [G.label || "Learn more", /* @__PURE__ */ s(Un, { size: 16 })]
1564
1771
  })
1565
1772
  }),
1566
1773
  /* @__PURE__ */ s("form", {
1567
- class: S(t, "composer"),
1568
- onSubmit: A,
1774
+ class: k(t, "composer"),
1775
+ onSubmit: M,
1569
1776
  style: {
1570
1777
  display: "flex",
1571
1778
  alignItems: "center",
@@ -1574,12 +1781,12 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1574
1781
  borderTop: `1px solid ${g}`
1575
1782
  },
1576
1783
  children: [/* @__PURE__ */ s("input", {
1577
- ref: H,
1784
+ ref: S,
1578
1785
  type: "text",
1579
- value: $,
1580
- onInput: (I) => z(I.target.value),
1581
- placeholder: v,
1582
- disabled: !x,
1786
+ value: w,
1787
+ onInput: (z) => I(z.target.value),
1788
+ placeholder: y,
1789
+ disabled: !T,
1583
1790
  maxLength: 4e3,
1584
1791
  "aria-label": "Message",
1585
1792
  autoComplete: "off",
@@ -1588,17 +1795,17 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1588
1795
  minHeight: b.composerHeight,
1589
1796
  padding: "0 12px",
1590
1797
  borderRadius: b.composerRadius,
1591
- background: w,
1798
+ background: v,
1592
1799
  color: `rgb(${n.ink})`,
1593
1800
  fontSize: a ? 16 : 14,
1594
1801
  "--uq-placeholder": _
1595
1802
  }
1596
1803
  }), r.busy ? /* @__PURE__ */ s("button", {
1597
1804
  type: "button",
1598
- class: S(t, "sendButton"),
1805
+ class: k(t, "sendButton"),
1599
1806
  onClick: r.stop,
1600
1807
  "aria-label": "Stop",
1601
- style: Y(b.sendSize, { color: b.blue }),
1808
+ style: X(b.sendSize, { color: b.blue }),
1602
1809
  children: /* @__PURE__ */ s("span", { style: {
1603
1810
  width: 10,
1604
1811
  height: 10,
@@ -1607,32 +1814,32 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1607
1814
  } })
1608
1815
  }) : /* @__PURE__ */ s("button", {
1609
1816
  type: "submit",
1610
- class: S(t, "sendButton"),
1611
- disabled: !x || !$.trim(),
1817
+ class: k(t, "sendButton"),
1818
+ disabled: !T || !w.trim(),
1612
1819
  "aria-label": "Send",
1613
- style: Y(b.sendSize, {
1820
+ style: X(b.sendSize, {
1614
1821
  color: b.blue,
1615
- opacity: x && $.trim() ? 1 : 0.5
1822
+ opacity: T && w.trim() ? 1 : 0.5
1616
1823
  }),
1617
- children: /* @__PURE__ */ s(Fn, { size: b.sendIcon })
1824
+ children: /* @__PURE__ */ s(Yn, { size: b.sendIcon })
1618
1825
  })]
1619
1826
  })
1620
1827
  ]
1621
1828
  });
1622
1829
  }
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);
1830
+ function or({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open: a, setOpen: u, pinned: d, onCta: c }) {
1831
+ const f = Kt(n.hostDark), { side: h, offsetY: l } = n, p = d ? void 0 : () => u(!1);
1625
1832
  if (a && o) {
1626
1833
  const m = {
1627
1834
  ...n,
1628
1835
  surfaceBg: f.surface,
1629
1836
  rad: b.panelRadius
1630
1837
  };
1631
- return /* @__PURE__ */ s(Dt, {
1838
+ return /* @__PURE__ */ s(Ut, {
1632
1839
  look: m,
1633
1840
  pinned: d,
1634
1841
  onClose: () => u(!1),
1635
- children: /* @__PURE__ */ s(ft, {
1842
+ children: /* @__PURE__ */ s(mt, {
1636
1843
  payload: e,
1637
1844
  config: t,
1638
1845
  look: n,
@@ -1641,18 +1848,18 @@ function Un({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open
1641
1848
  onCta: c,
1642
1849
  mobile: !0,
1643
1850
  fill: !0,
1644
- onClose: h
1851
+ onClose: p
1645
1852
  })
1646
1853
  });
1647
1854
  }
1648
- return /* @__PURE__ */ s(W, { children: [a && /* @__PURE__ */ s("div", {
1855
+ return /* @__PURE__ */ s(U, { children: [a && /* @__PURE__ */ s("div", {
1649
1856
  class: "uq-fixed uq-rise",
1650
1857
  style: {
1651
1858
  bottom: l + b.launcherSize + b.panelGap,
1652
1859
  width: b.panelWidth,
1653
- ...p
1860
+ ...h
1654
1861
  },
1655
- children: /* @__PURE__ */ s(ft, {
1862
+ children: /* @__PURE__ */ s(mt, {
1656
1863
  payload: e,
1657
1864
  config: t,
1658
1865
  look: n,
@@ -1660,12 +1867,12 @@ function Un({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open
1660
1867
  focus: i,
1661
1868
  onCta: c,
1662
1869
  mobile: !1,
1663
- onMinimize: h,
1664
- onClose: h
1870
+ onMinimize: p,
1871
+ onClose: p
1665
1872
  })
1666
1873
  }), /* @__PURE__ */ s("button", {
1667
1874
  type: "button",
1668
- class: S(t, "launcher", "uq-fixed"),
1875
+ class: k(t, "launcher", "uq-fixed"),
1669
1876
  "aria-label": a ? "Close chat" : "Open chat",
1670
1877
  "aria-expanded": a,
1671
1878
  onClick: () => {
@@ -1673,10 +1880,10 @@ function Un({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open
1673
1880
  },
1674
1881
  style: {
1675
1882
  bottom: l,
1676
- ...Y(b.launcherSize, { boxShadow: b.launcherShadow }),
1677
- ...p
1883
+ ...X(b.launcherSize, { boxShadow: b.launcherShadow }),
1884
+ ...h
1678
1885
  },
1679
- children: [/* @__PURE__ */ s(Ye, {
1886
+ children: [/* @__PURE__ */ s(Je, {
1680
1887
  payload: e,
1681
1888
  size: b.launcherSize,
1682
1889
  font: 16,
@@ -1696,29 +1903,29 @@ function Un({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open
1696
1903
  justifyContent: "center",
1697
1904
  color: "#fff"
1698
1905
  },
1699
- children: /* @__PURE__ */ s(Bt, { size: 28 })
1906
+ children: /* @__PURE__ */ s(Yt, { size: 28 })
1700
1907
  }) : /* @__PURE__ */ s("span", {
1701
1908
  style: {
1702
1909
  position: "absolute",
1703
1910
  right: -4,
1704
1911
  bottom: -4,
1705
- ...Y(b.badgeSize, {
1912
+ ...X(b.badgeSize, {
1706
1913
  background: b.accent,
1707
1914
  color: "#fff",
1708
1915
  boxShadow: `0 0 0 2px ${f.surface}`
1709
1916
  })
1710
1917
  },
1711
- children: /* @__PURE__ */ s(Bn, {
1918
+ children: /* @__PURE__ */ s(Gn, {
1712
1919
  size: 12,
1713
1920
  d: b.logo
1714
1921
  })
1715
1922
  })]
1716
1923
  })] });
1717
1924
  }
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;
1925
+ function te({ text: e, mine: t, onDark: n, look: r, config: o, children: i }) {
1926
+ const a = le(n), { isGlass: u, accentFill: d, accentText: c, rad: f } = r;
1720
1927
  return /* @__PURE__ */ s("div", {
1721
- class: S(o, t ? "userMessage" : "botMessage", "uq-rise"),
1928
+ class: k(o, t ? "userMessage" : "botMessage", "uq-rise"),
1722
1929
  style: {
1723
1930
  alignSelf: t ? "flex-end" : "flex-start",
1724
1931
  maxWidth: t ? "78%" : "84%",
@@ -1736,7 +1943,7 @@ function le({ text: e, mine: t, onDark: n, look: r, config: o, children: i }) {
1736
1943
  children: i != null ? i : e
1737
1944
  });
1738
1945
  }
1739
- var Gn = (e) => /* @__PURE__ */ s(le, {
1946
+ var sr = (e) => /* @__PURE__ */ s(te, {
1740
1947
  mine: !1,
1741
1948
  ...e,
1742
1949
  children: /* @__PURE__ */ s("span", {
@@ -1749,7 +1956,96 @@ var Gn = (e) => /* @__PURE__ */ s(le, {
1749
1956
  ]
1750
1957
  })
1751
1958
  });
1752
- function Nt({ config: e, look: t, onClick: n }) {
1959
+ function ar({ chat: e, onDark: t, look: n, config: r }) {
1960
+ const o = e.stopping;
1961
+ if (!o) return null;
1962
+ const { isGlass: i, accent: a, accentFill: u, accentText: d, rad: c } = n, f = i ? "#fff" : a, h = {
1963
+ padding: "5px 10px",
1964
+ borderRadius: c,
1965
+ fontSize: 11.5,
1966
+ fontWeight: 500,
1967
+ lineHeight: 1.3,
1968
+ opacity: o.busy ? 0.6 : 1
1969
+ };
1970
+ return /* @__PURE__ */ s(te, {
1971
+ mine: !1,
1972
+ onDark: t,
1973
+ look: n,
1974
+ config: r,
1975
+ children: /* @__PURE__ */ s("div", {
1976
+ class: "uq-stop",
1977
+ style: {
1978
+ display: "flex",
1979
+ flexDirection: "column",
1980
+ gap: 8
1981
+ },
1982
+ children: [
1983
+ /* @__PURE__ */ s("span", {
1984
+ style: { fontWeight: 600 },
1985
+ children: "Stop the conversation?"
1986
+ }),
1987
+ /* @__PURE__ */ s("span", { children: "Do you want to stop this conversation?" }),
1988
+ /* @__PURE__ */ s("div", {
1989
+ style: {
1990
+ display: "flex",
1991
+ gap: 6,
1992
+ flexWrap: "wrap"
1993
+ },
1994
+ children: [/* @__PURE__ */ s("button", {
1995
+ type: "button",
1996
+ onClick: () => e.answerStop(!1),
1997
+ disabled: o.busy,
1998
+ style: {
1999
+ ...h,
2000
+ border: `1px solid ${f}`,
2001
+ color: f
2002
+ },
2003
+ children: "Keep chatting"
2004
+ }), /* @__PURE__ */ s("button", {
2005
+ type: "button",
2006
+ onClick: () => e.answerStop(!0),
2007
+ disabled: o.busy,
2008
+ style: {
2009
+ ...h,
2010
+ background: u,
2011
+ color: d
2012
+ },
2013
+ children: o.busy ? "Stopping…" : "Stop conversation"
2014
+ })]
2015
+ }),
2016
+ o.error && /* @__PURE__ */ s("span", {
2017
+ class: "uq-fade",
2018
+ style: { opacity: 0.7 },
2019
+ children: o.error
2020
+ })
2021
+ ]
2022
+ })
2023
+ });
2024
+ }
2025
+ function Vt({ config: e, look: t, onDark: n, chat: r, size: o }) {
2026
+ if (!r.sessionId) return null;
2027
+ const i = le(n), a = !r.busy && !r.stopping;
2028
+ return /* @__PURE__ */ s("button", {
2029
+ type: "button",
2030
+ class: k(e, "stopButton"),
2031
+ onClick: r.askToStop,
2032
+ disabled: !a,
2033
+ "aria-label": "Stop conversation",
2034
+ style: {
2035
+ width: o,
2036
+ height: o,
2037
+ borderRadius: t.rad,
2038
+ color: t.isGlass ? "#fff" : `rgb(${i})`,
2039
+ opacity: a ? 0.55 : 0.3,
2040
+ display: "flex",
2041
+ alignItems: "center",
2042
+ justifyContent: "center",
2043
+ flexShrink: 0
2044
+ },
2045
+ children: /* @__PURE__ */ s(Ve, { size: o - 9 })
2046
+ });
2047
+ }
2048
+ function Xt({ config: e, look: t, onClick: n }) {
1753
2049
  var r;
1754
2050
  const o = !((r = e.cta) === null || r === void 0 || (r = r.href) === null || r === void 0) && r.trim() ? e.cta : null;
1755
2051
  return o ? /* @__PURE__ */ s("a", {
@@ -1772,111 +2068,127 @@ function Nt({ config: e, look: t, onClick: n }) {
1772
2068
  children: o.label || "Learn more"
1773
2069
  }) : null;
1774
2070
  }
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);
2071
+ function Jt({ config: e, look: t, onDark: n, hint: r, chat: o, disabled: i, focus: a, withStop: u = !1 }) {
2072
+ const d = le(n), { isGlass: c, accentFill: f, accentText: h, rad: l } = t, [p, m] = E(""), x = D(null);
1777
2073
  P(() => {
1778
- var _;
1779
- a > 0 && ((_ = m.current) === null || _ === void 0 || _.focus());
2074
+ var y;
2075
+ a > 0 && ((y = x.current) === null || y === void 0 || y.focus());
1780
2076
  }, [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})`;
2077
+ const v = i || !!o.stopping, _ = (y) => {
2078
+ y.preventDefault(), !v && (o.send(p), m(""));
2079
+ }, g = c ? "rgba(255,255,255,.75)" : `rgba(${d},${n ? 0.6 : 0.45})`;
1784
2080
  return /* @__PURE__ */ s("form", {
1785
- class: S(e, "composer"),
1786
- onSubmit: y,
2081
+ class: k(e, "composer"),
2082
+ onSubmit: _,
1787
2083
  style: {
1788
2084
  display: "flex",
1789
2085
  alignItems: "center",
1790
2086
  gap: 8,
1791
2087
  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
2088
+ borderRadius: l,
2089
+ border: c ? "1px solid rgba(255,255,255,.35)" : `1px solid rgba(${d},${n ? 0.28 : 0.12})`,
2090
+ background: c ? "rgba(10,12,18,.3)" : `rgba(${d},${n ? 0.08 : 0.02})`,
2091
+ backdropFilter: c || n ? "blur(6px)" : void 0
1796
2092
  },
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
- })]
2093
+ children: [
2094
+ /* @__PURE__ */ s("input", {
2095
+ ref: x,
2096
+ type: "text",
2097
+ value: p,
2098
+ onInput: (y) => m(y.target.value),
2099
+ placeholder: r || "Message…",
2100
+ disabled: v,
2101
+ maxLength: 4e3,
2102
+ "aria-label": "Message",
2103
+ autoComplete: "off",
2104
+ style: {
2105
+ flex: 1,
2106
+ fontSize: 11.5,
2107
+ color: c ? "#fff" : `rgb(${d})`,
2108
+ "--uq-placeholder": g
2109
+ }
2110
+ }),
2111
+ u && /* @__PURE__ */ s(Vt, {
2112
+ config: e,
2113
+ look: t,
2114
+ onDark: n,
2115
+ chat: o,
2116
+ size: 24
2117
+ }),
2118
+ o.busy ? /* @__PURE__ */ s("button", {
2119
+ type: "button",
2120
+ class: k(e, "sendButton"),
2121
+ onClick: o.stop,
2122
+ "aria-label": "Stop",
2123
+ style: {
2124
+ width: 24,
2125
+ height: 24,
2126
+ borderRadius: l,
2127
+ background: f,
2128
+ color: h,
2129
+ display: "flex",
2130
+ alignItems: "center",
2131
+ justifyContent: "center",
2132
+ flexShrink: 0
2133
+ },
2134
+ children: /* @__PURE__ */ s("span", { style: {
2135
+ width: 8,
2136
+ height: 8,
2137
+ background: "currentColor",
2138
+ borderRadius: 1
2139
+ } })
2140
+ }) : /* @__PURE__ */ s("button", {
2141
+ type: "submit",
2142
+ class: k(e, "sendButton"),
2143
+ disabled: v,
2144
+ "aria-label": "Send",
2145
+ style: {
2146
+ width: 24,
2147
+ height: 24,
2148
+ borderRadius: l,
2149
+ background: f,
2150
+ color: h,
2151
+ display: "flex",
2152
+ alignItems: "center",
2153
+ justifyContent: "center",
2154
+ flexShrink: 0,
2155
+ opacity: v ? 0.5 : 1
2156
+ },
2157
+ children: /* @__PURE__ */ s(Ot, { size: 13 })
2158
+ })
2159
+ ]
1854
2160
  });
1855
2161
  }
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, {
2162
+ function Ze({ welcome: e, chat: t, onDark: n, look: r, config: o }) {
2163
+ const i = le(n);
2164
+ return /* @__PURE__ */ s(U, { children: [
2165
+ /* @__PURE__ */ s(te, {
1860
2166
  text: e,
1861
2167
  mine: !1,
1862
2168
  onDark: n,
1863
2169
  look: r,
1864
2170
  config: o
1865
2171
  }),
1866
- t.turns.map((a) => a.role === "user" ? /* @__PURE__ */ s(le, {
2172
+ t.turns.map((a) => a.role === "user" ? /* @__PURE__ */ s(te, {
1867
2173
  text: a.parts[0],
1868
2174
  mine: !0,
1869
2175
  onDark: n,
1870
2176
  look: r,
1871
2177
  config: o
1872
- }, a.id) : a.parts.slice(0, a.shown).map((u, d) => /* @__PURE__ */ s(le, {
2178
+ }, a.id) : a.parts.slice(0, a.shown).map((u, d) => /* @__PURE__ */ s(te, {
1873
2179
  text: u,
1874
2180
  mine: !1,
1875
2181
  onDark: n,
1876
2182
  look: r,
1877
2183
  config: o
1878
2184
  }, `${a.id}:${d}`))),
1879
- t.busy && /* @__PURE__ */ s(Gn, {
2185
+ /* @__PURE__ */ s(ar, {
2186
+ chat: t,
2187
+ onDark: n,
2188
+ look: r,
2189
+ config: o
2190
+ }),
2191
+ t.busy && /* @__PURE__ */ s(sr, {
1880
2192
  onDark: n,
1881
2193
  look: r,
1882
2194
  config: o
@@ -1904,20 +2216,21 @@ function Ue({ welcome: e, chat: t, onDark: n, look: r, config: o }) {
1904
2216
  })
1905
2217
  ] });
1906
2218
  }
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([
2219
+ function Ee({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus: a, onCta: u, fill: d = !1, onClose: c }) {
2220
+ var f, h, l;
2221
+ const { ink: p, surfaceBg: m, hostDark: x, accentFill: v, accentText: _, rad: g } = n, y = (f = (h = e.agent) === null || h === void 0 ? void 0 : h.name) !== null && f !== void 0 ? f : null, $ = y ? y.trim().charAt(0).toUpperCase() : "A", C = Xe(t), A = Ce([
1910
2222
  r.turns,
1911
2223
  r.busy,
1912
- r.error
1913
- ]), $ = !!(!((l = e.agent) === null || l === void 0) && l.live);
2224
+ r.error,
2225
+ r.stopping
2226
+ ]), w = !!(!((l = e.agent) === null || l === void 0) && l.live);
1914
2227
  return /* @__PURE__ */ s("div", {
1915
- class: S(t, "panel"),
2228
+ class: k(t, "panel"),
1916
2229
  style: {
1917
2230
  width: "100%",
1918
2231
  borderRadius: d ? 0 : g,
1919
2232
  overflow: "hidden",
1920
- border: d ? void 0 : `1px solid rgba(${h},.12)`,
2233
+ border: d ? void 0 : `1px solid rgba(${p},.12)`,
1921
2234
  boxShadow: o ? "0 18px 44px rgba(0,0,0,.16)" : void 0,
1922
2235
  background: m,
1923
2236
  ...d ? {
@@ -1929,13 +2242,13 @@ function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus
1929
2242
  },
1930
2243
  children: [
1931
2244
  /* @__PURE__ */ s("div", {
1932
- class: S(t, "header"),
2245
+ class: k(t, "header"),
1933
2246
  style: {
1934
2247
  display: "flex",
1935
2248
  alignItems: "center",
1936
2249
  gap: 8,
1937
2250
  padding: "10px 12px",
1938
- background: w,
2251
+ background: v,
1939
2252
  color: _
1940
2253
  },
1941
2254
  children: [
@@ -1952,14 +2265,14 @@ function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus
1952
2265
  fontWeight: 600,
1953
2266
  color: _
1954
2267
  },
1955
- children: k
2268
+ children: $
1956
2269
  }),
1957
2270
  /* @__PURE__ */ s("span", {
1958
2271
  style: {
1959
2272
  fontSize: 12,
1960
2273
  fontWeight: 500
1961
2274
  },
1962
- children: v ? v.split("—")[0].trim() : "Chat"
2275
+ children: y ? y.split("—")[0].trim() : "Chat"
1963
2276
  }),
1964
2277
  /* @__PURE__ */ s("span", {
1965
2278
  style: {
@@ -1967,11 +2280,31 @@ function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus
1967
2280
  fontSize: 10,
1968
2281
  opacity: 0.8
1969
2282
  },
1970
- children: $ ? "online" : "offline"
2283
+ children: w ? "online" : "offline"
2284
+ }),
2285
+ r.sessionId && /* @__PURE__ */ s("button", {
2286
+ type: "button",
2287
+ class: k(t, "stopButton"),
2288
+ onClick: r.askToStop,
2289
+ disabled: r.busy || !!r.stopping,
2290
+ "aria-label": "Stop conversation",
2291
+ style: {
2292
+ width: 28,
2293
+ height: 28,
2294
+ marginRight: c ? 0 : -6,
2295
+ borderRadius: "50%",
2296
+ display: "flex",
2297
+ alignItems: "center",
2298
+ justifyContent: "center",
2299
+ color: _,
2300
+ opacity: r.busy || r.stopping ? 0.5 : 0.9,
2301
+ flexShrink: 0
2302
+ },
2303
+ children: /* @__PURE__ */ s(Ve, { size: 15 })
1971
2304
  }),
1972
2305
  c && /* @__PURE__ */ s("button", {
1973
2306
  type: "button",
1974
- class: S(t, "close"),
2307
+ class: k(t, "close"),
1975
2308
  onClick: c,
1976
2309
  "aria-label": "Close chat",
1977
2310
  style: {
@@ -1985,12 +2318,12 @@ function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus
1985
2318
  color: _,
1986
2319
  flexShrink: 0
1987
2320
  },
1988
- children: /* @__PURE__ */ s(xe, { size: 16 })
2321
+ children: /* @__PURE__ */ s($e, { size: 16 })
1989
2322
  })
1990
2323
  ]
1991
2324
  }),
1992
2325
  /* @__PURE__ */ s("div", {
1993
- ref: q,
2326
+ ref: A,
1994
2327
  style: {
1995
2328
  display: "flex",
1996
2329
  flexDirection: "column",
@@ -2003,10 +2336,10 @@ function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus
2003
2336
  overflowY: "auto",
2004
2337
  overscrollBehavior: "contain"
2005
2338
  },
2006
- children: /* @__PURE__ */ s(Ue, {
2007
- welcome: x,
2339
+ children: /* @__PURE__ */ s(Ze, {
2340
+ welcome: C,
2008
2341
  chat: r,
2009
- onDark: y,
2342
+ onDark: x,
2010
2343
  look: n,
2011
2344
  config: t
2012
2345
  })
@@ -2019,82 +2352,82 @@ function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus
2019
2352
  padding: "0 12px 12px",
2020
2353
  background: m
2021
2354
  },
2022
- children: [/* @__PURE__ */ s(Nt, {
2355
+ children: [/* @__PURE__ */ s(Xt, {
2023
2356
  config: t,
2024
2357
  look: n,
2025
2358
  onClick: u
2026
- }), /* @__PURE__ */ s(Ot, {
2359
+ }), /* @__PURE__ */ s(Jt, {
2027
2360
  config: t,
2028
2361
  look: n,
2029
- onDark: y,
2362
+ onDark: x,
2030
2363
  hint: i,
2031
2364
  chat: r,
2032
- disabled: !$,
2365
+ disabled: !w,
2033
2366
  focus: a
2034
2367
  })]
2035
2368
  })
2036
2369
  ]
2037
2370
  });
2038
2371
  }
2039
- function Vn({ payload: e, look: t, api: n, embed: r, page: o, reporter: i, open: a, setOpen: u, pinned: d, focus: c }) {
2372
+ function lr({ payload: e, look: t, api: n, embed: r, page: o, reporter: i, open: a, setOpen: u, pinned: d, focus: c }) {
2040
2373
  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;
2374
+ const h = e.config, l = er(n, e, r, o), p = Gt(h), { accentFill: m, accentText: x, rad: v, side: _, offsetY: g } = t, y = tr(), $ = !!(!((f = e.agent) === null || f === void 0) && f.live), C = Xe(h), A = () => {
2375
+ var I, S;
2043
2376
  return i.report("cta.clicked", {
2044
2377
  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 }
2378
+ sessionId: (I = l.sessionId) !== null && I !== void 0 ? I : void 0,
2379
+ payload: { href: (S = h.cta) === null || S === void 0 ? void 0 : S.href }
2047
2380
  });
2048
2381
  };
2049
- if (t.isMessenger) return /* @__PURE__ */ s(Un, {
2382
+ if (t.isMessenger) return /* @__PURE__ */ s(or, {
2050
2383
  payload: e,
2051
- config: p,
2384
+ config: h,
2052
2385
  look: t,
2053
2386
  chat: l,
2054
- mobile: v,
2387
+ mobile: y,
2055
2388
  focus: c,
2056
2389
  open: a,
2057
2390
  setOpen: u,
2058
2391
  pinned: d,
2059
- onCta: q
2392
+ onCta: A
2060
2393
  });
2061
- if (p.variant === "bubble")
2062
- return a && v ? /* @__PURE__ */ s(Dt, {
2394
+ if (h.variant === "bubble")
2395
+ return a && y ? /* @__PURE__ */ s(Ut, {
2063
2396
  look: t,
2064
2397
  pinned: d,
2065
2398
  onClose: () => u(!1),
2066
- children: /* @__PURE__ */ s(Te, {
2399
+ children: /* @__PURE__ */ s(Ee, {
2067
2400
  payload: e,
2068
- config: p,
2401
+ config: h,
2069
2402
  look: t,
2070
2403
  chat: l,
2071
2404
  shadow: !1,
2072
- hint: h,
2405
+ hint: p,
2073
2406
  focus: c,
2074
- onCta: q,
2407
+ onCta: A,
2075
2408
  fill: !0,
2076
2409
  onClose: d ? void 0 : () => u(!1)
2077
2410
  })
2078
- }) : /* @__PURE__ */ s(W, { children: [a && /* @__PURE__ */ s("div", {
2411
+ }) : /* @__PURE__ */ s(U, { children: [a && /* @__PURE__ */ s("div", {
2079
2412
  class: "uq-fixed uq-rise",
2080
2413
  style: {
2081
2414
  bottom: g + 54,
2082
2415
  width: 296,
2083
2416
  ..._
2084
2417
  },
2085
- children: /* @__PURE__ */ s(Te, {
2418
+ children: /* @__PURE__ */ s(Ee, {
2086
2419
  payload: e,
2087
- config: p,
2420
+ config: h,
2088
2421
  look: t,
2089
2422
  chat: l,
2090
2423
  shadow: !0,
2091
- hint: h,
2424
+ hint: p,
2092
2425
  focus: c,
2093
- onCta: q
2426
+ onCta: A
2094
2427
  })
2095
2428
  }), /* @__PURE__ */ s("button", {
2096
2429
  type: "button",
2097
- class: S(p, "launcher", "uq-fixed"),
2430
+ class: k(h, "launcher", "uq-fixed"),
2098
2431
  "aria-label": a ? "Close chat" : "Open chat",
2099
2432
  "aria-expanded": a,
2100
2433
  onClick: () => {
@@ -2104,52 +2437,53 @@ function Vn({ payload: e, look: t, api: n, embed: r, page: o, reporter: i, open:
2104
2437
  bottom: g,
2105
2438
  width: 44,
2106
2439
  height: 44,
2107
- borderRadius: Math.min(22, w * 2),
2440
+ borderRadius: Math.min(22, v * 2),
2108
2441
  background: m,
2109
- color: y,
2442
+ color: x,
2110
2443
  display: "flex",
2111
2444
  alignItems: "center",
2112
2445
  justifyContent: "center",
2113
2446
  boxShadow: "0 10px 26px rgba(0,0,0,.24)",
2114
2447
  ..._
2115
2448
  },
2116
- children: /* @__PURE__ */ s(Ft, { size: 20 })
2449
+ children: /* @__PURE__ */ s(Nt, { size: 20 })
2117
2450
  })] });
2118
- if (p.variant === "box") return /* @__PURE__ */ s("div", {
2451
+ if (h.variant === "box") return /* @__PURE__ */ s("div", {
2119
2452
  class: "uq-inline",
2120
- children: /* @__PURE__ */ s(Te, {
2453
+ children: /* @__PURE__ */ s(Ee, {
2121
2454
  payload: e,
2122
- config: p,
2455
+ config: h,
2123
2456
  look: t,
2124
2457
  chat: l,
2125
2458
  shadow: !1,
2126
- hint: h,
2459
+ hint: p,
2127
2460
  focus: c,
2128
- onCta: q
2461
+ onCta: A
2129
2462
  })
2130
2463
  });
2131
- const $ = {
2464
+ const w = {
2132
2465
  payload: e,
2133
- config: p,
2466
+ config: h,
2134
2467
  look: t,
2135
2468
  chat: l,
2136
- hint: h,
2137
- mobile: v,
2469
+ hint: p,
2470
+ mobile: y,
2138
2471
  focus: c,
2139
- live: k,
2140
- welcome: x,
2141
- onCta: q
2472
+ live: $,
2473
+ welcome: C,
2474
+ onCta: A
2142
2475
  };
2143
- return p.variant === "chatbar" ? /* @__PURE__ */ s(Kn, { ...$ }) : /* @__PURE__ */ s(Xn, { ...$ });
2476
+ return h.variant === "chatbar" ? /* @__PURE__ */ s(cr, { ...w }) : /* @__PURE__ */ s(ur, { ...w });
2144
2477
  }
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([
2478
+ function cr({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a, welcome: u }) {
2479
+ const { ink: d, hostDark: c, accentFill: f, accentText: h, rad: l } = t, p = Ce([
2147
2480
  n.turns,
2148
2481
  n.busy,
2149
- n.error
2150
- ]), m = n.turns.length > 0;
2482
+ n.error,
2483
+ n.stopping
2484
+ ]), m = n.turns.length > 0 || n.stopping !== null, x = !a || n.stopping !== null;
2151
2485
  return /* @__PURE__ */ s("div", {
2152
- class: S(e, "panel", "uq-fixed"),
2486
+ class: k(e, "panel", "uq-fixed"),
2153
2487
  style: {
2154
2488
  left: 0,
2155
2489
  right: 0,
@@ -2163,7 +2497,7 @@ function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2163
2497
  boxShadow: "0 -10px 30px rgba(0,0,0,.12)"
2164
2498
  },
2165
2499
  children: [m && /* @__PURE__ */ s("div", {
2166
- ref: h,
2500
+ ref: p,
2167
2501
  style: {
2168
2502
  display: "flex",
2169
2503
  flexDirection: "column",
@@ -2171,7 +2505,7 @@ function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2171
2505
  maxHeight: "min(50vh, 320px)",
2172
2506
  overflowY: "auto"
2173
2507
  },
2174
- children: /* @__PURE__ */ s(Ue, {
2508
+ children: /* @__PURE__ */ s(Ze, {
2175
2509
  welcome: u,
2176
2510
  chat: n,
2177
2511
  onDark: c,
@@ -2186,22 +2520,22 @@ function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2186
2520
  },
2187
2521
  children: [
2188
2522
  /* @__PURE__ */ s("span", {
2189
- class: S(e, "launcher"),
2523
+ class: k(e, "launcher"),
2190
2524
  style: {
2191
2525
  width: 26,
2192
2526
  height: 26,
2193
2527
  borderRadius: l,
2194
2528
  background: f,
2195
- color: p,
2529
+ color: h,
2196
2530
  display: "flex",
2197
2531
  alignItems: "center",
2198
2532
  justifyContent: "center",
2199
2533
  flexShrink: 0
2200
2534
  },
2201
- children: /* @__PURE__ */ s(Ft, { size: 14 })
2535
+ children: /* @__PURE__ */ s(Nt, { size: 14 })
2202
2536
  }),
2203
2537
  /* @__PURE__ */ s("span", {
2204
- class: S(e, "botMessage"),
2538
+ class: k(e, "botMessage"),
2205
2539
  style: {
2206
2540
  flex: 1,
2207
2541
  minWidth: 0,
@@ -2214,11 +2548,11 @@ function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2214
2548
  children: u
2215
2549
  }),
2216
2550
  /* @__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 = "");
2551
+ class: k(e, "composer"),
2552
+ onSubmit: (v) => {
2553
+ v.preventDefault();
2554
+ const _ = v.currentTarget.elements.namedItem("message");
2555
+ !_ || x || (n.send(_.value), _.value = "");
2222
2556
  },
2223
2557
  style: {
2224
2558
  display: "flex",
@@ -2230,62 +2564,73 @@ function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2230
2564
  border: `1px solid rgba(${d},.14)`,
2231
2565
  minWidth: o ? 0 : 220
2232
2566
  },
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
- })]
2567
+ children: [
2568
+ /* @__PURE__ */ s("input", {
2569
+ name: "message",
2570
+ type: "text",
2571
+ placeholder: r,
2572
+ disabled: x,
2573
+ maxLength: 4e3,
2574
+ "aria-label": "Message",
2575
+ autoComplete: "off",
2576
+ ref: (v) => {
2577
+ v && i > 0 && v.focus();
2578
+ },
2579
+ style: {
2580
+ flex: 1,
2581
+ fontSize: 11.5,
2582
+ color: `rgb(${d})`,
2583
+ "--uq-placeholder": `rgba(${d},.45)`
2584
+ }
2585
+ }),
2586
+ /* @__PURE__ */ s(Vt, {
2587
+ config: e,
2588
+ look: t,
2589
+ onDark: c,
2590
+ chat: n,
2591
+ size: 22
2592
+ }),
2593
+ /* @__PURE__ */ s("button", {
2594
+ type: n.busy ? "button" : "submit",
2595
+ class: k(e, "sendButton"),
2596
+ onClick: n.busy ? n.stop : void 0,
2597
+ disabled: x,
2598
+ "aria-label": n.busy ? "Stop" : "Send",
2599
+ style: {
2600
+ width: 22,
2601
+ height: 22,
2602
+ borderRadius: l,
2603
+ background: f,
2604
+ color: h,
2605
+ display: "flex",
2606
+ alignItems: "center",
2607
+ justifyContent: "center",
2608
+ flexShrink: 0
2609
+ },
2610
+ children: n.busy ? /* @__PURE__ */ s("span", { style: {
2611
+ width: 7,
2612
+ height: 7,
2613
+ background: "currentColor",
2614
+ borderRadius: 1
2615
+ } }) : /* @__PURE__ */ s(Ot, { size: 12 })
2616
+ })
2617
+ ]
2274
2618
  })
2275
2619
  ]
2276
2620
  })]
2277
2621
  });
2278
2622
  }
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([
2623
+ function ur({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a, welcome: u, onCta: d }) {
2624
+ const { hostDark: c, side: f, offsetY: h } = t, l = c, p = Ce([
2281
2625
  n.turns,
2282
2626
  n.busy,
2283
- n.error
2627
+ n.error,
2628
+ n.stopping
2284
2629
  ]);
2285
2630
  return /* @__PURE__ */ s("div", {
2286
- class: S(e, "panel", "uq-fixed"),
2631
+ class: k(e, "panel", "uq-fixed"),
2287
2632
  style: {
2288
- bottom: p,
2633
+ bottom: h,
2289
2634
  width: o ? `calc(100% - ${e.appearance.offsetX * 2}px)` : 320,
2290
2635
  display: "flex",
2291
2636
  flexDirection: "column",
@@ -2294,7 +2639,7 @@ function Xn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2294
2639
  },
2295
2640
  children: [
2296
2641
  /* @__PURE__ */ s("div", {
2297
- ref: h,
2642
+ ref: p,
2298
2643
  style: {
2299
2644
  display: "flex",
2300
2645
  flexDirection: "column",
@@ -2302,7 +2647,7 @@ function Xn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2302
2647
  maxHeight: "min(60vh, 420px)",
2303
2648
  overflowY: "auto"
2304
2649
  },
2305
- children: /* @__PURE__ */ s(Ue, {
2650
+ children: /* @__PURE__ */ s(Ze, {
2306
2651
  welcome: u,
2307
2652
  chat: n,
2308
2653
  onDark: l,
@@ -2310,30 +2655,31 @@ function Xn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2310
2655
  config: e
2311
2656
  })
2312
2657
  }),
2313
- /* @__PURE__ */ s(Nt, {
2658
+ /* @__PURE__ */ s(Xt, {
2314
2659
  config: e,
2315
2660
  look: t,
2316
2661
  onClick: d
2317
2662
  }),
2318
- /* @__PURE__ */ s(Ot, {
2663
+ /* @__PURE__ */ s(Jt, {
2319
2664
  config: e,
2320
2665
  look: t,
2321
2666
  onDark: l,
2322
2667
  hint: r,
2323
2668
  chat: n,
2324
2669
  disabled: !a,
2325
- focus: i
2670
+ focus: i,
2671
+ withStop: !0
2326
2672
  })
2327
2673
  ]
2328
2674
  });
2329
2675
  }
2330
- var Jn = (e) => /^https?:\/\//i.test(e);
2331
- function Zn({ config: e, block: t, index: n, look: r, onCta: o }) {
2676
+ var dr = (e) => /^https?:\/\//i.test(e);
2677
+ function fr({ config: e, block: t, index: n, look: r, onCta: o }) {
2332
2678
  const { ink: i, accent: a, accentFill: u, accentText: d, rad: c } = r, f = [
2333
2679
  "uq-block",
2334
2680
  `uq-block-${t.kind}`,
2335
2681
  t.cssClass.trim()
2336
- ].filter(Boolean).join(" "), p = "align" in t ? t.align : "center", l = {
2682
+ ].filter(Boolean).join(" "), h = "align" in t ? t.align : "center", l = {
2337
2683
  class: f,
2338
2684
  "data-uq-block": n
2339
2685
  };
@@ -2346,7 +2692,7 @@ function Zn({ config: e, block: t, index: n, look: r, onCta: o }) {
2346
2692
  fontSize: t.size === "lg" ? 21 : t.size === "sm" ? 15 : 18,
2347
2693
  fontWeight: 600,
2348
2694
  letterSpacing: "-0.02em",
2349
- textAlign: p,
2695
+ textAlign: h,
2350
2696
  color: t.color || `rgb(${i})`
2351
2697
  },
2352
2698
  children: t.text
@@ -2357,14 +2703,14 @@ function Zn({ config: e, block: t, index: n, look: r, onCta: o }) {
2357
2703
  style: {
2358
2704
  fontSize: 12.5,
2359
2705
  lineHeight: 1.5,
2360
- textAlign: p,
2706
+ textAlign: h,
2361
2707
  color: t.color || `rgba(${i},.65)`,
2362
2708
  whiteSpace: "pre-wrap"
2363
2709
  },
2364
2710
  children: t.text
2365
2711
  });
2366
2712
  case "media":
2367
- return !t.src || !Jn(t.src) ? null : t.mediaType === "video" ? /* @__PURE__ */ s("video", {
2713
+ return !t.src || !dr(t.src) ? null : t.mediaType === "video" ? /* @__PURE__ */ s("video", {
2368
2714
  ...l,
2369
2715
  src: t.src,
2370
2716
  muted: !0,
@@ -2416,7 +2762,7 @@ function Zn({ config: e, block: t, index: n, look: r, onCta: o }) {
2416
2762
  case "cta":
2417
2763
  return /* @__PURE__ */ s("a", {
2418
2764
  ...l,
2419
- class: `${S(e, "cta")} ${f}`,
2765
+ class: `${k(e, "cta")} ${f}`,
2420
2766
  href: t.href || "#",
2421
2767
  target: t.newTab ? "_blank" : void 0,
2422
2768
  rel: t.newTab ? "noopener noreferrer" : void 0,
@@ -2437,17 +2783,17 @@ function Zn({ config: e, block: t, index: n, look: r, onCta: o }) {
2437
2783
  });
2438
2784
  }
2439
2785
  }
2440
- function Qn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }) {
2786
+ function pr({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }) {
2441
2787
  const a = e.config, { ink: u, surfaceBg: d, rad: c } = t;
2442
2788
  if (!r) return null;
2443
2789
  const f = () => {
2444
2790
  i || o(!1);
2445
- }, p = (l) => n.report("cta.clicked", {
2791
+ }, h = (l) => n.report("cta.clicked", {
2446
2792
  widgetId: e.id,
2447
2793
  payload: { href: l }
2448
2794
  });
2449
2795
  return /* @__PURE__ */ s("div", {
2450
- class: S(a, "scrim", "uq-fixed uq-fade"),
2796
+ class: k(a, "scrim", "uq-fixed uq-fade"),
2451
2797
  onClick: f,
2452
2798
  style: {
2453
2799
  inset: 0,
@@ -2458,7 +2804,7 @@ function Qn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }
2458
2804
  padding: 24
2459
2805
  },
2460
2806
  children: /* @__PURE__ */ s("div", {
2461
- class: S(a, "card", "uq-rise"),
2807
+ class: k(a, "card", "uq-rise"),
2462
2808
  role: "dialog",
2463
2809
  "aria-modal": "true",
2464
2810
  onClick: (l) => l.stopPropagation(),
@@ -2480,7 +2826,7 @@ function Qn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }
2480
2826
  },
2481
2827
  children: [!i && /* @__PURE__ */ s("button", {
2482
2828
  type: "button",
2483
- class: S(a, "close"),
2829
+ class: k(a, "close"),
2484
2830
  onClick: f,
2485
2831
  "aria-label": "Close",
2486
2832
  style: {
@@ -2495,26 +2841,26 @@ function Qn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }
2495
2841
  justifyContent: "center",
2496
2842
  color: `rgba(${u},.55)`
2497
2843
  },
2498
- children: /* @__PURE__ */ s(xe, { size: 14 })
2499
- }), a.blocks.map((l, h) => /* @__PURE__ */ s(Zn, {
2844
+ children: /* @__PURE__ */ s($e, { size: 14 })
2845
+ }), a.blocks.map((l, p) => /* @__PURE__ */ s(fr, {
2500
2846
  config: a,
2501
2847
  block: l,
2502
- index: h,
2848
+ index: p,
2503
2849
  look: t,
2504
- onCta: p
2505
- }, h))]
2850
+ onCta: h
2851
+ }, p))]
2506
2852
  })
2507
2853
  });
2508
2854
  }
2509
- var er = 3600;
2510
- function tr({ payload: e, look: t, open: n }) {
2855
+ var hr = 3600;
2856
+ function _r({ payload: e, look: t, open: n }) {
2511
2857
  const r = e.config, { ink: o, accent: i, surfaceBg: a, rad: u } = t, d = r.quotes, [c, f] = E(0);
2512
2858
  if (P(() => {
2513
2859
  if (d.length < 2) return;
2514
- const h = window.setInterval(() => f((m) => m + 1), er);
2515
- return () => window.clearInterval(h);
2860
+ const p = window.setInterval(() => f((m) => m + 1), hr);
2861
+ return () => window.clearInterval(p);
2516
2862
  }, [d.length]), !n || d.length === 0) return null;
2517
- const p = c % d.length, l = d[p];
2863
+ const h = c % d.length, l = d[h];
2518
2864
  return /* @__PURE__ */ s("div", {
2519
2865
  class: "uq-fixed uq-fade",
2520
2866
  style: {
@@ -2527,7 +2873,7 @@ function tr({ payload: e, look: t, open: n }) {
2527
2873
  pointerEvents: "none"
2528
2874
  },
2529
2875
  children: /* @__PURE__ */ s("figure", {
2530
- class: S(r, "frame"),
2876
+ class: k(r, "frame"),
2531
2877
  style: {
2532
2878
  width: "100%",
2533
2879
  maxWidth: 440,
@@ -2543,7 +2889,7 @@ function tr({ payload: e, look: t, open: n }) {
2543
2889
  pointerEvents: "auto"
2544
2890
  },
2545
2891
  children: [/* @__PURE__ */ s("blockquote", {
2546
- class: S(r, "quote", "uq-fade"),
2892
+ class: k(r, "quote", "uq-fade"),
2547
2893
  style: {
2548
2894
  fontSize: 13.5,
2549
2895
  lineHeight: 1.55,
@@ -2554,14 +2900,14 @@ function tr({ payload: e, look: t, open: n }) {
2554
2900
  l.text || "…",
2555
2901
  "”"
2556
2902
  ]
2557
- }, p), /* @__PURE__ */ s("figcaption", {
2903
+ }, h), /* @__PURE__ */ s("figcaption", {
2558
2904
  style: {
2559
2905
  display: "flex",
2560
2906
  alignItems: "center",
2561
2907
  gap: 10
2562
2908
  },
2563
2909
  children: [/* @__PURE__ */ s("span", {
2564
- class: S(r, "author"),
2910
+ class: k(r, "author"),
2565
2911
  style: {
2566
2912
  fontFamily: "monospace",
2567
2913
  fontSize: 11,
@@ -2569,24 +2915,24 @@ function tr({ payload: e, look: t, open: n }) {
2569
2915
  },
2570
2916
  children: l.author || "—"
2571
2917
  }), /* @__PURE__ */ s("span", {
2572
- class: S(r, "dots"),
2918
+ class: k(r, "dots"),
2573
2919
  style: {
2574
2920
  marginLeft: "auto",
2575
2921
  display: "flex",
2576
2922
  gap: 4
2577
2923
  },
2578
- children: d.map((h, m) => /* @__PURE__ */ s("span", { style: {
2924
+ children: d.map((p, m) => /* @__PURE__ */ s("span", { style: {
2579
2925
  width: 5,
2580
2926
  height: 5,
2581
2927
  borderRadius: "50%",
2582
- background: m === p ? i : `rgba(${o},.18)`
2928
+ background: m === h ? i : `rgba(${o},.18)`
2583
2929
  } }, m))
2584
2930
  })]
2585
2931
  })]
2586
2932
  })
2587
2933
  });
2588
2934
  }
2589
- function nr(e) {
2935
+ function gr(e) {
2590
2936
  switch (e.config.type) {
2591
2937
  case "chat":
2592
2938
  case "exit-popup":
@@ -2596,7 +2942,7 @@ function nr(e) {
2596
2942
  return !0;
2597
2943
  }
2598
2944
  }
2599
- function rr(e) {
2945
+ function mr(e) {
2600
2946
  return e.rules.length > 0 || e.config.type !== "exit-popup" ? e.rules : [{
2601
2947
  id: `default:${e.id}`,
2602
2948
  trigger: "exit_intent",
@@ -2610,47 +2956,47 @@ function rr(e) {
2610
2956
  }
2611
2957
  }];
2612
2958
  }
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);
2959
+ function Zt({ payload: e, api: t, embed: n, page: r, reporter: o, hostDark: i, kick: a = null }) {
2960
+ const u = ve(() => Bn(e.config, i), [e, i]), d = ve(() => mr(e), [e]), [c, f] = E(d.length === 0), [h, l] = E(() => d.length === 0 && gr(e)), [p, m] = E(!1), [x, v] = E(0), _ = D(h), g = (C) => {
2961
+ l(C), C !== _.current && (_.current = C, o.report(C ? "surface.opened" : "surface.closed", { widgetId: e.id }));
2962
+ }, y = ({ autoStart: C, pinned: A }) => {
2963
+ f(!0), m(A), g(!0), C && v((w) => w + 1);
2618
2964
  };
2619
- if (P(() => zt(d, r, (x) => {
2965
+ if (P(() => Bt(d, r, (C) => {
2620
2966
  o.report("rule.fired", {
2621
2967
  widgetId: e.id,
2622
2968
  payload: {
2623
- ruleId: x.id,
2624
- trigger: x.trigger
2969
+ ruleId: C.id,
2970
+ trigger: C.trigger
2625
2971
  }
2626
- }), v(x.actionConfig);
2972
+ }), y(C.actionConfig);
2627
2973
  }), [e.id]), P(() => {
2628
- a && v(a.action);
2974
+ a && y(a.action);
2629
2975
  }, [a]), !c) return null;
2630
- const k = {
2976
+ const $ = {
2631
2977
  payload: e,
2632
2978
  look: u,
2633
2979
  api: t,
2634
2980
  embed: n,
2635
2981
  page: r,
2636
2982
  reporter: o,
2637
- open: p,
2983
+ open: h,
2638
2984
  setOpen: g,
2639
- pinned: h,
2640
- focus: y
2985
+ pinned: p,
2986
+ focus: x
2641
2987
  };
2642
2988
  switch (e.config.type) {
2643
2989
  case "chat":
2644
- return /* @__PURE__ */ s(Vn, { ...k });
2990
+ return /* @__PURE__ */ s(lr, { ...$ });
2645
2991
  case "exit-popup":
2646
- return /* @__PURE__ */ s(Qn, { ...k });
2992
+ return /* @__PURE__ */ s(pr, { ...$ });
2647
2993
  case "banner":
2648
- return /* @__PURE__ */ s(Dn, { ...k });
2994
+ return /* @__PURE__ */ s(Kn, { ...$ });
2649
2995
  case "testimonial":
2650
- return /* @__PURE__ */ s(tr, { ...k });
2996
+ return /* @__PURE__ */ s(_r, { ...$ });
2651
2997
  }
2652
2998
  }
2653
- function ir(e) {
2999
+ function br(e) {
2654
3000
  const t = [], n = e.config.appearance.customCss.trim();
2655
3001
  return n && t.push(n), e.config.type === "exit-popup" && e.config.blocks.forEach((r, o) => {
2656
3002
  const i = r.css.trim();
@@ -2658,18 +3004,18 @@ function ir(e) {
2658
3004
  }), t.join(`
2659
3005
  `);
2660
3006
  }
2661
- function or(e) {
3007
+ function vr(e) {
2662
3008
  return e.kind === "widget" ? [e.payload] : e.payload.members.map((t) => t.widget);
2663
3009
  }
2664
- var ar = {
3010
+ var yr = {
2665
3011
  report: () => {
2666
3012
  },
2667
3013
  flush: () => {
2668
3014
  }
2669
3015
  };
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) => {
3016
+ function xr({ group: e, ...t }) {
3017
+ const [n, r] = E(e.rules.length === 0), [o, i] = E(null), [a, u] = E(() => Hn(e));
3018
+ return P(() => Bt(e.rules, t.page, (d) => {
2673
3019
  t.reporter.report("rule.fired", { payload: {
2674
3020
  ruleId: d.id,
2675
3021
  trigger: d.trigger
@@ -2682,89 +3028,89 @@ function sr({ group: e, ...t }) {
2682
3028
  });
2683
3029
  }), [e.id]), P(() => {
2684
3030
  if (e.mode !== "sequence" || !n) return;
2685
- const d = Rt(e);
3031
+ const d = Wt(e);
2686
3032
  if (d)
2687
- return $n(e, d, (c) => u(c ? [c.widget] : []));
3033
+ return Rn(e, d, (c) => u(c ? [c.widget] : []));
2688
3034
  }, [
2689
3035
  e.id,
2690
3036
  e.mode,
2691
3037
  n,
2692
3038
  a
2693
- ]), n ? /* @__PURE__ */ s(W, { children: a.map((d) => /* @__PURE__ */ s("div", {
3039
+ ]), n ? /* @__PURE__ */ s(U, { children: a.map((d) => /* @__PURE__ */ s("div", {
2694
3040
  "data-uq-widget": d.id,
2695
3041
  style: "display:contents",
2696
- children: /* @__PURE__ */ s(Yt, {
3042
+ children: /* @__PURE__ */ s(Zt, {
2697
3043
  payload: d,
2698
3044
  kick: o,
2699
3045
  ...t
2700
3046
  })
2701
3047
  }, d.id)) }) : null;
2702
3048
  }
2703
- function lr({ snapshot: e, ...t }) {
3049
+ function wr({ snapshot: e, ...t }) {
2704
3050
  const n = {
2705
3051
  kind: e.kind,
2706
3052
  id: e.payload.id
2707
3053
  };
2708
- return e.kind === "group" ? /* @__PURE__ */ s(sr, {
3054
+ return e.kind === "group" ? /* @__PURE__ */ s(xr, {
2709
3055
  group: e.payload,
2710
3056
  embed: n,
2711
3057
  ...t
2712
3058
  }) : /* @__PURE__ */ s("div", {
2713
3059
  "data-uq-widget": e.payload.id,
2714
3060
  style: "display:contents",
2715
- children: /* @__PURE__ */ s(Yt, {
3061
+ children: /* @__PURE__ */ s(Zt, {
2716
3062
  payload: e.payload,
2717
3063
  embed: n,
2718
3064
  ...t
2719
3065
  })
2720
3066
  });
2721
3067
  }
2722
- function cr(e, t, n = {}) {
3068
+ function Sr(e, t, n = {}) {
2723
3069
  var r, o, i;
2724
3070
  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
3071
  kind: e.kind,
2726
3072
  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");
3073
+ }, c = n.silent ? yr : In(u, d), f = En((i = n.theme) !== null && i !== void 0 ? i : null), h = Fn(), l = document.createElement("style");
2728
3074
  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,
3075
+ const p = document.createElement("div");
3076
+ p.setAttribute("data-uq-root", ""), p.style.display = "contents", a.appendChild(p);
3077
+ const m = (x) => {
3078
+ l.textContent = [kn, ...vr(x).map(br)].join(`
3079
+ `), it(/* @__PURE__ */ s(wr, {
3080
+ snapshot: x,
2735
3081
  api: u,
2736
- page: p,
3082
+ page: h,
2737
3083
  reporter: c,
2738
3084
  hostDark: f
2739
- }), h);
3085
+ }), p);
2740
3086
  };
2741
3087
  return m(e), c.report("embed.loaded", { payload: { version: e.payload.version } }), {
2742
3088
  update: m,
2743
3089
  unmount: () => {
2744
- Ze(null, h), c.flush(), l.remove(), h.remove();
3090
+ it(null, p), c.flush(), l.remove(), p.remove();
2745
3091
  }
2746
3092
  };
2747
3093
  }
2748
- function Ut(e, t) {
3094
+ function Qt(e, t) {
2749
3095
  if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
2750
3096
  }
2751
- function ur(e, t) {
2752
- Ut(e, t), t.add(e);
3097
+ function kr(e, t) {
3098
+ Qt(e, t), t.add(e);
2753
3099
  }
2754
- function ht(e, t, n) {
2755
- Ut(e, t), t.set(e, n);
3100
+ function bt(e, t, n) {
3101
+ Qt(e, t), t.set(e, n);
2756
3102
  }
2757
- function pe(e, t, n) {
3103
+ function xe(e, t, n) {
2758
3104
  if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
2759
3105
  throw new TypeError("Private element is not present on this object");
2760
3106
  }
2761
- function ne(e, t) {
2762
- return e.get(pe(e, t));
3107
+ function ue(e, t) {
3108
+ return e.get(xe(e, t));
2763
3109
  }
2764
- function re(e, t, n) {
2765
- return e.set(pe(e, t), n), n;
3110
+ function de(e, t, n) {
3111
+ return e.set(xe(e, t), n), n;
2766
3112
  }
2767
- var dr = {
3113
+ var $r = {
2768
3114
  widget: {
2769
3115
  element: "usereq-widget",
2770
3116
  attribute: "widget-id"
@@ -2774,66 +3120,66 @@ var dr = {
2774
3120
  attribute: "group-id"
2775
3121
  }
2776
3122
  };
2777
- function Ae(e) {
3123
+ function Pe(e) {
2778
3124
  console.warn(`[usereq] ${e}`);
2779
3125
  }
2780
- function pt(e) {
2781
- const { element: t, attribute: n } = dr[e];
3126
+ function vt(e) {
3127
+ const { element: t, attribute: n } = $r[e];
2782
3128
  if (customElements.get(t)) return;
2783
3129
  var r = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakSet();
2784
3130
  class a extends HTMLElement {
2785
3131
  constructor(...c) {
2786
- super(...c), ur(this, i), ht(this, r, null), ht(this, o, 0);
3132
+ super(...c), kr(this, i), bt(this, r, null), bt(this, o, 0);
2787
3133
  }
2788
3134
  connectedCallback() {
2789
- pe(i, this, u).call(this);
3135
+ xe(i, this, u).call(this);
2790
3136
  }
2791
3137
  disconnectedCallback() {
2792
3138
  var c;
2793
- (c = ne(r, this)) === null || c === void 0 || c.unmount(), re(r, this, null);
3139
+ (c = ue(r, this)) === null || c === void 0 || c.unmount(), de(r, this, null);
2794
3140
  }
2795
- attributeChangedCallback(c, f, p) {
2796
- f !== p && this.isConnected && pe(i, this, u).call(this);
3141
+ attributeChangedCallback(c, f, h) {
3142
+ f !== h && this.isConnected && xe(i, this, u).call(this);
2797
3143
  }
2798
3144
  }
2799
3145
  async function u() {
2800
- var d, c, f, p;
3146
+ var d, c, f, h;
2801
3147
  const l = (d = this.getAttribute(n)) === null || d === void 0 ? void 0 : d.trim();
2802
3148
  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;
3149
+ const p = de(o, this, (c = ue(o, this), ++c));
3150
+ (f = ue(r, this)) === null || f === void 0 || f.unmount(), de(r, this, null);
3151
+ const m = ((h = this.getAttribute("api-url")) !== null && h !== void 0 ? h : "https://api.usereq.com").replace(/\/+$/, ""), x = this.getAttribute("theme"), v = x === "light" || x === "dark" ? x : null;
2806
3152
  let _;
2807
3153
  try {
2808
- const g = await Jt({ base: m }, e, l);
2809
- _ = nn(g, e);
3154
+ const g = await rn({ base: m }, e, l);
3155
+ _ = dn(g, e);
2810
3156
  } catch (g) {
2811
- g instanceof ce ? Ae(`${t} ${l}: ${g.message} (${g.code})`) : Ae(`${t} ${l}: could not reach ${m}.`);
3157
+ g instanceof K ? Pe(`${t} ${l}: ${g.message} (${g.code})`) : Pe(`${t} ${l}: could not reach ${m}.`);
2812
3158
  return;
2813
3159
  }
2814
- if (!(h !== ne(o, this) || !this.isConnected)) {
3160
+ if (!(p !== ue(o, this) || !this.isConnected)) {
2815
3161
  if (!_) {
2816
- Ae(`${t} ${l}: the response was not a ${e} snapshot.`);
3162
+ Pe(`${t} ${l}: the response was not a ${e} snapshot.`);
2817
3163
  return;
2818
3164
  }
2819
- re(r, this, cr(_, this, {
3165
+ de(r, this, Sr(_, this, {
2820
3166
  apiUrl: m,
2821
- theme: w
3167
+ theme: v
2822
3168
  }));
2823
3169
  }
2824
3170
  }
2825
- Ee(a, "observedAttributes", [
3171
+ Fe(a, "observedAttributes", [
2826
3172
  n,
2827
3173
  "api-url",
2828
3174
  "theme"
2829
3175
  ]), customElements.define(t, a);
2830
3176
  }
2831
- function fr() {
2832
- pt("widget"), pt("group");
3177
+ function Cr() {
3178
+ vt("widget"), vt("group");
2833
3179
  }
2834
- fr();
3180
+ Cr();
2835
3181
  export {
2836
- cr as render
3182
+ Sr as render
2837
3183
  };
2838
3184
 
2839
3185
  //# sourceMappingURL=embed.mjs.map