@usereq/widget 0.2.25 → 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/README.md +35 -145
- package/dist/embed.js +38 -0
- package/dist/embed.js.map +1 -0
- package/dist/embed.mjs +3185 -0
- package/dist/embed.mjs.map +1 -0
- package/package.json +35 -81
- package/dist/widget.js +0 -255
- package/src/chat-widget/chat-widget-appearance.ts +0 -134
- package/src/chat-widget/message-reveal.ts +0 -52
- package/src/chat-widget/stop-confirmation.ts +0 -288
- package/src/custom-element/agent-widget-element.tsx +0 -682
- package/src/embed.ts +0 -8
- package/src/index.ts +0 -9
- package/src/register.ts +0 -15
- package/src/renderer/index.ts +0 -6
- package/src/renderer/widget-runtime.tsx +0 -395
- package/src/runtime/api-origin.ts +0 -29
- package/src/runtime/api.ts +0 -123
- package/src/runtime/bootstrap.ts +0 -366
- package/src/runtime/debug.ts +0 -104
- package/src/runtime/messages.ts +0 -12
- package/src/runtime/session-storage.ts +0 -32
- package/src/runtime/trigger-rule.ts +0 -182
- package/src/shared/shadow-css.ts +0 -15
- package/src/shared/shadow-theme.ts +0 -115
- package/src/shared/stop-confirmation.ts +0 -20
- package/src/shared/widget-config.ts +0 -171
- package/src/styles/widget.css.ts +0 -83
- package/src/types.ts +0 -98
- package/src/vite-env.d.ts +0 -4
package/dist/embed.mjs
ADDED
|
@@ -0,0 +1,3185 @@
|
|
|
1
|
+
async function en(e) {
|
|
2
|
+
const t = e.getReader(), n = new TextDecoder();
|
|
3
|
+
let r = "", o = "";
|
|
4
|
+
const i = [], a = /* @__PURE__ */ new Map(), u = (d) => {
|
|
5
|
+
if (!d.startsWith("data:")) return;
|
|
6
|
+
const c = d.slice(5).trim();
|
|
7
|
+
if (!c || c === "[DONE]") return;
|
|
8
|
+
let f;
|
|
9
|
+
try {
|
|
10
|
+
f = JSON.parse(c);
|
|
11
|
+
} catch {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
switch (f.type) {
|
|
15
|
+
case "start":
|
|
16
|
+
"messageId" in f && f.messageId && (o = f.messageId);
|
|
17
|
+
break;
|
|
18
|
+
case "text-start":
|
|
19
|
+
"id" in f && (i.push(f.id), a.set(f.id, ""));
|
|
20
|
+
break;
|
|
21
|
+
case "text-delta":
|
|
22
|
+
if ("id" in f && "delta" in f) {
|
|
23
|
+
var h;
|
|
24
|
+
a.set(f.id, ((h = a.get(f.id)) !== null && h !== void 0 ? h : "") + f.delta);
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
case "error":
|
|
28
|
+
throw new Error("errorText" in f ? f.errorText : "The reply failed.");
|
|
29
|
+
case "abort":
|
|
30
|
+
throw new Error("The reply was cut short.");
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
for (; ; ) {
|
|
34
|
+
const { done: d, value: c } = await t.read();
|
|
35
|
+
if (d) break;
|
|
36
|
+
r += n.decode(c, { stream: !0 });
|
|
37
|
+
let f;
|
|
38
|
+
for (; (f = r.indexOf(`
|
|
39
|
+
`)) !== -1; )
|
|
40
|
+
u(r.slice(0, f).replace(/\r$/, "")), r = r.slice(f + 1);
|
|
41
|
+
}
|
|
42
|
+
return r && u(r), {
|
|
43
|
+
id: o || `reply-${Date.now()}`,
|
|
44
|
+
parts: i.map((d) => {
|
|
45
|
+
var c;
|
|
46
|
+
return (c = a.get(d)) !== null && c !== void 0 ? c : "";
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function ne(e) {
|
|
51
|
+
"@babel/helpers - typeof";
|
|
52
|
+
return ne = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
53
|
+
return typeof t;
|
|
54
|
+
} : function(t) {
|
|
55
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
56
|
+
}, ne(e);
|
|
57
|
+
}
|
|
58
|
+
function tn(e, t) {
|
|
59
|
+
if (ne(e) != "object" || !e) return e;
|
|
60
|
+
var n = e[Symbol.toPrimitive];
|
|
61
|
+
if (n !== void 0) {
|
|
62
|
+
var r = n.call(e, t || "default");
|
|
63
|
+
if (ne(r) != "object") return r;
|
|
64
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
65
|
+
}
|
|
66
|
+
return (t === "string" ? String : Number)(e);
|
|
67
|
+
}
|
|
68
|
+
function nn(e) {
|
|
69
|
+
var t = tn(e, "string");
|
|
70
|
+
return ne(t) == "symbol" ? t : t + "";
|
|
71
|
+
}
|
|
72
|
+
function Fe(e, t, n) {
|
|
73
|
+
return (t = nn(t)) in e ? Object.defineProperty(e, t, {
|
|
74
|
+
value: n,
|
|
75
|
+
enumerable: !0,
|
|
76
|
+
configurable: !0,
|
|
77
|
+
writable: !0
|
|
78
|
+
}) : e[t] = n, e;
|
|
79
|
+
}
|
|
80
|
+
var K = class extends Error {
|
|
81
|
+
constructor(e, t, n) {
|
|
82
|
+
super(n), Fe(this, "status", void 0), Fe(this, "code", void 0), this.status = e, this.code = t;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
async function oe(e) {
|
|
86
|
+
let t = "request_failed", n = `The request failed (${e.status}).`;
|
|
87
|
+
try {
|
|
88
|
+
var r, o;
|
|
89
|
+
const i = await e.json();
|
|
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
|
+
} catch {
|
|
92
|
+
}
|
|
93
|
+
throw new K(e.status, t, n);
|
|
94
|
+
}
|
|
95
|
+
var We = (e, t = {}) => ({
|
|
96
|
+
method: "POST",
|
|
97
|
+
headers: {
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
...t
|
|
100
|
+
},
|
|
101
|
+
body: JSON.stringify(e)
|
|
102
|
+
});
|
|
103
|
+
async function rn(e, t, n) {
|
|
104
|
+
const r = await fetch(`${e.base}/api/embed/${t}/${n}`);
|
|
105
|
+
return r.ok ? r.json() : oe(r);
|
|
106
|
+
}
|
|
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
|
+
}
|
|
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) {
|
|
124
|
+
const i = await fetch(`${e.base}/api/embed/chat`, {
|
|
125
|
+
...We({
|
|
126
|
+
message: {
|
|
127
|
+
id: n.id,
|
|
128
|
+
role: "user",
|
|
129
|
+
parts: [{
|
|
130
|
+
type: "text",
|
|
131
|
+
text: n.text
|
|
132
|
+
}]
|
|
133
|
+
},
|
|
134
|
+
trigger: r
|
|
135
|
+
}, Le(t)),
|
|
136
|
+
signal: o
|
|
137
|
+
});
|
|
138
|
+
return !i.ok || !i.body ? oe(i) : en(i.body);
|
|
139
|
+
}
|
|
140
|
+
async function cn(e, t) {
|
|
141
|
+
try {
|
|
142
|
+
const n = await fetch(`${e.base}/api/embed/events`, {
|
|
143
|
+
...We(t),
|
|
144
|
+
keepalive: !0
|
|
145
|
+
});
|
|
146
|
+
return n.ok ? await n.json() : null;
|
|
147
|
+
} catch {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
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);
|
|
154
|
+
}
|
|
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);
|
|
157
|
+
}
|
|
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;
|
|
160
|
+
}
|
|
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) {
|
|
163
|
+
for (var n in t) e[n] = t[n];
|
|
164
|
+
return e;
|
|
165
|
+
}
|
|
166
|
+
function Oe(e) {
|
|
167
|
+
e && e.parentNode && e.parentNode.removeChild(e);
|
|
168
|
+
}
|
|
169
|
+
function _n(e, t, n) {
|
|
170
|
+
var r, o, i, a = {};
|
|
171
|
+
for (i in t) i == "key" ? r = t[i] : i == "ref" ? o = t[i] : a[i] = t[i];
|
|
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);
|
|
174
|
+
}
|
|
175
|
+
function pe(e, t, n, r, o) {
|
|
176
|
+
var i = {
|
|
177
|
+
type: e,
|
|
178
|
+
props: t,
|
|
179
|
+
key: n,
|
|
180
|
+
ref: r,
|
|
181
|
+
__k: null,
|
|
182
|
+
__: null,
|
|
183
|
+
__b: 0,
|
|
184
|
+
__e: null,
|
|
185
|
+
__c: null,
|
|
186
|
+
constructor: void 0,
|
|
187
|
+
__v: o == null ? ++xt : o,
|
|
188
|
+
__i: -1,
|
|
189
|
+
__u: 0
|
|
190
|
+
};
|
|
191
|
+
return o == null && q.vnode != null && q.vnode(i), i;
|
|
192
|
+
}
|
|
193
|
+
function U(e) {
|
|
194
|
+
return e.children;
|
|
195
|
+
}
|
|
196
|
+
function he(e, t) {
|
|
197
|
+
this.props = e, this.context = t;
|
|
198
|
+
}
|
|
199
|
+
function J(e, t) {
|
|
200
|
+
if (t == null) return e.__ ? J(e.__, e.__i + 1) : null;
|
|
201
|
+
for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
|
|
202
|
+
return typeof e.type == "function" ? J(e) : null;
|
|
203
|
+
}
|
|
204
|
+
function gn(e) {
|
|
205
|
+
if (e.__P && e.__d) {
|
|
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);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function $t(e) {
|
|
211
|
+
if ((e = e.__) != null && e.__c != null) return e.__e = e.__c.base = null, e.__k.some(function(t) {
|
|
212
|
+
if (t != null && t.__e != null) return e.__e = e.__c.base = t.__e;
|
|
213
|
+
}), $t(e);
|
|
214
|
+
}
|
|
215
|
+
function tt(e) {
|
|
216
|
+
(!e.__d && (e.__d = !0) && Y.push(e) && !be.__r++ || et != q.debounceRendering) && ((et = q.debounceRendering) || wt)(be);
|
|
217
|
+
}
|
|
218
|
+
function be() {
|
|
219
|
+
try {
|
|
220
|
+
for (var e, t = 1; Y.length; ) Y.length > t && Y.sort(St), e = Y.shift(), t = Y.length, gn(e);
|
|
221
|
+
} finally {
|
|
222
|
+
Y.length = be.__r = 0;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
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;
|
|
229
|
+
}
|
|
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));
|
|
234
|
+
return r;
|
|
235
|
+
}
|
|
236
|
+
function qt(e, t, n) {
|
|
237
|
+
var r, o;
|
|
238
|
+
if (typeof e.type == "function") {
|
|
239
|
+
for (r = e.__k, o = 0; r && o < r.length; o++) r[o] && (r[o].__ = e, t = qt(r[o], t, n));
|
|
240
|
+
return t;
|
|
241
|
+
}
|
|
242
|
+
e.__e != t && (t && e.type && !t.parentNode && (t = J(e)), t = n.insertBefore(e.__e, t || null));
|
|
243
|
+
do
|
|
244
|
+
t = t && t.nextSibling;
|
|
245
|
+
while (t != null && t.nodeType == 8);
|
|
246
|
+
return t;
|
|
247
|
+
}
|
|
248
|
+
function bn(e, t, n, r) {
|
|
249
|
+
var o, i, a, u = e.key, d = e.type, c = t[n], f = c != null && (2 & c.__u) == 0;
|
|
250
|
+
if (c === null && u == null || f && u == c.key && d == c.type) return n;
|
|
251
|
+
if (r > (f ? 1 : 0)) {
|
|
252
|
+
for (o = n - 1, i = n + 1; o >= 0 || i < t.length; ) if ((c = t[a = o >= 0 ? o-- : i++]) != null && (2 & c.__u) == 0 && u == c.key && d == c.type) return a;
|
|
253
|
+
}
|
|
254
|
+
return -1;
|
|
255
|
+
}
|
|
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";
|
|
258
|
+
}
|
|
259
|
+
function ce(e, t, n, r, o) {
|
|
260
|
+
var i, a;
|
|
261
|
+
e: if (t == "style") if (typeof n == "string") e.style.cssText = n;
|
|
262
|
+
else {
|
|
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]);
|
|
265
|
+
}
|
|
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);
|
|
267
|
+
else {
|
|
268
|
+
if (o == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
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 {
|
|
270
|
+
e[t] = n == null ? "" : n;
|
|
271
|
+
break e;
|
|
272
|
+
} catch {
|
|
273
|
+
}
|
|
274
|
+
typeof n == "function" || (n == null || n === !1 && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
function rt(e) {
|
|
278
|
+
return function(t) {
|
|
279
|
+
if (this.l) {
|
|
280
|
+
var n = this.l[t.type + e];
|
|
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);
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
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;
|
|
289
|
+
if (t.constructor !== void 0) return null;
|
|
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;
|
|
293
|
+
try {
|
|
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);
|
|
295
|
+
else {
|
|
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);
|
|
300
|
+
break e;
|
|
301
|
+
}
|
|
302
|
+
l.componentWillUpdate != null && l.componentWillUpdate(g, l.__s, C), y && l.componentDidUpdate != null && l.__h.push(function() {
|
|
303
|
+
l.componentDidUpdate(m, x, v);
|
|
304
|
+
});
|
|
305
|
+
}
|
|
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 = [];
|
|
307
|
+
else do
|
|
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) {
|
|
314
|
+
for (t.__u |= d ? 160 : 128; u && u.nodeType == 8 && u.nextSibling; ) u = u.nextSibling;
|
|
315
|
+
i != null && (i[i.indexOf(u)] = null), t.__e = u;
|
|
316
|
+
} else if (i != null) for (S = i.length; S--; ) Oe(i[S]);
|
|
317
|
+
} else t.__e = n.__e;
|
|
318
|
+
t.__k == null && (t.__k = n.__k || []), M.then || It(t), q.__e(M, t, n);
|
|
319
|
+
}
|
|
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;
|
|
322
|
+
}
|
|
323
|
+
function It(e) {
|
|
324
|
+
e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(It));
|
|
325
|
+
}
|
|
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) {
|
|
329
|
+
try {
|
|
330
|
+
e = o.__h, o.__h = [], e.some(function(i) {
|
|
331
|
+
i.call(o);
|
|
332
|
+
});
|
|
333
|
+
} catch (i) {
|
|
334
|
+
q.__e(i, o.__v);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
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);
|
|
340
|
+
}
|
|
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;
|
|
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) {
|
|
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;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (e == null) {
|
|
350
|
+
if (g == null) return document.createTextNode(_);
|
|
351
|
+
e = document.createElementNS(o, g, _.is && _), u && (q.__m && q.__m(t, i), u = !1), i = null;
|
|
352
|
+
}
|
|
353
|
+
if (g == null) v === _ || u && e.data == _ || (e.data = _);
|
|
354
|
+
else {
|
|
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));
|
|
361
|
+
}
|
|
362
|
+
return e;
|
|
363
|
+
}
|
|
364
|
+
function Ue(e, t, n) {
|
|
365
|
+
try {
|
|
366
|
+
if (typeof e == "function") {
|
|
367
|
+
var r = typeof e.__u == "function";
|
|
368
|
+
r && e.__u(), r && t == null || (e.__u = e(t));
|
|
369
|
+
} else e.current = t;
|
|
370
|
+
} catch (o) {
|
|
371
|
+
q.__e(o, n);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function At(e, t, n) {
|
|
375
|
+
var r, o;
|
|
376
|
+
if (q.unmount && q.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || Ue(r, null, t)), (r = e.__c) != null) {
|
|
377
|
+
if (r.componentWillUnmount) try {
|
|
378
|
+
r.componentWillUnmount();
|
|
379
|
+
} catch (i) {
|
|
380
|
+
q.__e(i, t);
|
|
381
|
+
}
|
|
382
|
+
r.base = r.__P = r.__n = null;
|
|
383
|
+
}
|
|
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;
|
|
386
|
+
}
|
|
387
|
+
function yn(e, t, n) {
|
|
388
|
+
return this.constructor(e, n);
|
|
389
|
+
}
|
|
390
|
+
function it(e, t, n) {
|
|
391
|
+
var r, o, i, a;
|
|
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;
|
|
393
|
+
}
|
|
394
|
+
we = me.slice, q = { __e: function(e, t, n, r) {
|
|
395
|
+
for (var o, i, a; t = t.__; ) if ((o = t.__c) && !o.__) try {
|
|
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;
|
|
397
|
+
} catch (u) {
|
|
398
|
+
e = u;
|
|
399
|
+
}
|
|
400
|
+
throw e;
|
|
401
|
+
} }, xt = 0, fn = function(e) {
|
|
402
|
+
return e != null && e.constructor === void 0;
|
|
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) {
|
|
409
|
+
return e.__v.__b - t.__v.__b;
|
|
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 = {
|
|
415
|
+
__: [],
|
|
416
|
+
__h: []
|
|
417
|
+
});
|
|
418
|
+
return e >= n.__.length && n.__.push({}), n.__[e];
|
|
419
|
+
}
|
|
420
|
+
function E(e) {
|
|
421
|
+
return ie = 1, xn(Ht, e);
|
|
422
|
+
}
|
|
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) {
|
|
426
|
+
var d = r.__N ? r.__N[0] : r.__[0], c = r.t(d, u);
|
|
427
|
+
d !== c && (r.__N = [c, r.__[1]], r.__c.setState({}));
|
|
428
|
+
}], r.__c = R, !R.__f)) {
|
|
429
|
+
var o = function(u, d, c) {
|
|
430
|
+
if (!r.__c.__H) return !0;
|
|
431
|
+
var f = !1, h = r.__c.props !== u;
|
|
432
|
+
if (r.__c.__H.__.some(function(p) {
|
|
433
|
+
if (p.__N) {
|
|
434
|
+
f = !0;
|
|
435
|
+
var m = p.__[0];
|
|
436
|
+
p.__ = p.__N, p.__N = void 0, m !== p.__[0] && (h = !0);
|
|
437
|
+
}
|
|
438
|
+
}), i) {
|
|
439
|
+
var l = i.call(this, u, d, c);
|
|
440
|
+
return f ? l || h : l;
|
|
441
|
+
}
|
|
442
|
+
return !f || h;
|
|
443
|
+
};
|
|
444
|
+
R.__f = !0;
|
|
445
|
+
var i = R.shouldComponentUpdate, a = R.componentWillUpdate;
|
|
446
|
+
R.componentWillUpdate = function(u, d, c) {
|
|
447
|
+
if (this.__e) {
|
|
448
|
+
var f = i;
|
|
449
|
+
i = void 0, o(u, d, c), i = f;
|
|
450
|
+
}
|
|
451
|
+
a && a.call(this, u, d, c);
|
|
452
|
+
}, R.shouldComponentUpdate = o;
|
|
453
|
+
}
|
|
454
|
+
return r.__N || r.__;
|
|
455
|
+
}
|
|
456
|
+
function P(e, t) {
|
|
457
|
+
var n = Ge(re++, 3);
|
|
458
|
+
!H.__s && Rt(n.__H, t) && (n.__ = e, n.u = t, R.__H.__h.push(n));
|
|
459
|
+
}
|
|
460
|
+
function D(e) {
|
|
461
|
+
return ie = 5, ve(function() {
|
|
462
|
+
return { current: e };
|
|
463
|
+
}, []);
|
|
464
|
+
}
|
|
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.__;
|
|
468
|
+
}
|
|
469
|
+
function O(e, t) {
|
|
470
|
+
return ie = 8, ve(function() {
|
|
471
|
+
return e;
|
|
472
|
+
}, t);
|
|
473
|
+
}
|
|
474
|
+
function wn() {
|
|
475
|
+
for (var e; e = zt.shift(); ) {
|
|
476
|
+
var t = e.__H;
|
|
477
|
+
if (e.__P && t) try {
|
|
478
|
+
t.__h.some(_e), t.__h.some(De), t.__h = [];
|
|
479
|
+
} catch (n) {
|
|
480
|
+
t.__h = [], H.__e(n, e.__v);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
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) {
|
|
492
|
+
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
493
|
+
})) : (t.__h.some(_e), t.__h.some(De), t.__h = [], re = 0)), Me = R;
|
|
494
|
+
}, H.diffed = function(e) {
|
|
495
|
+
lt && lt(e);
|
|
496
|
+
var t = e.__c;
|
|
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) {
|
|
498
|
+
n.u && (n.__H = n.u, n.u = void 0);
|
|
499
|
+
})), Me = R = null;
|
|
500
|
+
}, H.__c = function(e, t) {
|
|
501
|
+
t.some(function(n) {
|
|
502
|
+
try {
|
|
503
|
+
n.__h.some(_e), n.__h = n.__h.filter(function(r) {
|
|
504
|
+
return !r.__ || De(r);
|
|
505
|
+
});
|
|
506
|
+
} catch (r) {
|
|
507
|
+
t.some(function(o) {
|
|
508
|
+
o.__h && (o.__h = []);
|
|
509
|
+
}), t = [], H.__e(r, n.__v);
|
|
510
|
+
}
|
|
511
|
+
}), ct && ct(e, t);
|
|
512
|
+
}, H.unmount = function(e) {
|
|
513
|
+
ut && ut(e);
|
|
514
|
+
var t, n = e.__c;
|
|
515
|
+
n && n.__H && (n.__H.__.some(function(r) {
|
|
516
|
+
try {
|
|
517
|
+
_e(r);
|
|
518
|
+
} catch (o) {
|
|
519
|
+
t = o;
|
|
520
|
+
}
|
|
521
|
+
}), n.__H = void 0, t && H.__e(t, n.__v));
|
|
522
|
+
};
|
|
523
|
+
var ft = typeof requestAnimationFrame == "function";
|
|
524
|
+
function Sn(e) {
|
|
525
|
+
var t, n = function() {
|
|
526
|
+
clearTimeout(r), ft && cancelAnimationFrame(t), setTimeout(e);
|
|
527
|
+
}, r = setTimeout(n, 35);
|
|
528
|
+
ft && (t = requestAnimationFrame(n));
|
|
529
|
+
}
|
|
530
|
+
function _e(e) {
|
|
531
|
+
var t = R, n = e.__c;
|
|
532
|
+
typeof n == "function" && (e.__c = void 0, n()), R = t;
|
|
533
|
+
}
|
|
534
|
+
function De(e) {
|
|
535
|
+
var t = R;
|
|
536
|
+
e.__c = e.__(), R = t;
|
|
537
|
+
}
|
|
538
|
+
function Rt(e, t) {
|
|
539
|
+
return !e || e.length !== t.length || t.some(function(n, r) {
|
|
540
|
+
return n !== e[r];
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
function Ht(e, t) {
|
|
544
|
+
return typeof t == "function" ? t(e) : t;
|
|
545
|
+
}
|
|
546
|
+
var kn = `
|
|
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}
|
|
548
|
+
:host([hidden]){display:none}
|
|
549
|
+
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
|
|
550
|
+
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
|
|
551
|
+
input{font:inherit;color:inherit;background:none;border:0;outline:0;min-width:0}
|
|
552
|
+
input::placeholder{color:var(--uq-placeholder,inherit);opacity:1}
|
|
553
|
+
input:disabled{cursor:not-allowed}
|
|
554
|
+
button:disabled{cursor:default}
|
|
555
|
+
a{color:inherit;text-decoration:none}
|
|
556
|
+
img,video{display:block;max-width:100%}
|
|
557
|
+
.uq-fixed{position:fixed;z-index:2147483000}
|
|
558
|
+
.uq-inline{display:block}
|
|
559
|
+
.uq-dots{display:inline-flex;gap:3px;align-items:center;height:10px}
|
|
560
|
+
.uq-dots span{width:5px;height:5px;border-radius:50%;background:currentColor;opacity:.35;animation:uq-dot 1.2s infinite ease-in-out}
|
|
561
|
+
.uq-dots span:nth-child(2){animation-delay:.15s}
|
|
562
|
+
.uq-dots span:nth-child(3){animation-delay:.3s}
|
|
563
|
+
@keyframes uq-dot{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:.9;transform:translateY(-2px)}}
|
|
564
|
+
.uq-rise{animation:uq-rise .22s ease-out both}
|
|
565
|
+
@keyframes uq-rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
|
566
|
+
.uq-fade{animation:uq-fade .18s ease-out both}
|
|
567
|
+
@keyframes uq-fade{from{opacity:0}to{opacity:1}}
|
|
568
|
+
.uq-drawer{left:0;right:0;bottom:0;display:flex;flex-direction:column;overflow:hidden;padding-bottom:env(safe-area-inset-bottom);transition:height .28s cubic-bezier(.32,.72,0,1),border-radius .28s ease}
|
|
569
|
+
.uq-drawer-half{height:50%}
|
|
570
|
+
.uq-drawer-full{height:100%}
|
|
571
|
+
.uq-drawer-held{transition:none}
|
|
572
|
+
.uq-grab{flex-shrink:0;height:22px;display:flex;align-items:center;justify-content:center;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}
|
|
573
|
+
.uq-grab:active{cursor:grabbing}
|
|
574
|
+
.uq-grab span{width:36px;height:4px;border-radius:2px}
|
|
575
|
+
.uq-slide{animation:uq-slide .3s cubic-bezier(.32,.72,0,1) both}
|
|
576
|
+
@keyframes uq-slide{from{transform:translateY(100%)}to{transform:none}}
|
|
577
|
+
@media (prefers-reduced-motion:reduce){.uq-rise,.uq-fade,.uq-slide,.uq-dots span{animation:none}.uq-drawer{transition:none}}
|
|
578
|
+
`;
|
|
579
|
+
function se(e, t) {
|
|
580
|
+
try {
|
|
581
|
+
return window[e].getItem(t);
|
|
582
|
+
} catch {
|
|
583
|
+
return null;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
function ae(e, t, n) {
|
|
587
|
+
try {
|
|
588
|
+
window[e].setItem(t, n);
|
|
589
|
+
} catch {
|
|
590
|
+
}
|
|
591
|
+
}
|
|
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()) {
|
|
600
|
+
const t = /* @__PURE__ */ new Uint8Array(16);
|
|
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;
|
|
602
|
+
const n = Array.from(t, (r) => r.toString(16).padStart(2, "0")).join("");
|
|
603
|
+
return `${n.slice(0, 8)}-${n.slice(8, 12)}-${n.slice(12, 16)}-${n.slice(16, 20)}-${n.slice(20)}`;
|
|
604
|
+
}
|
|
605
|
+
var pt = "usereq:visitor";
|
|
606
|
+
function Pt() {
|
|
607
|
+
const e = se("localStorage", pt);
|
|
608
|
+
if (e) return e;
|
|
609
|
+
const t = Ke();
|
|
610
|
+
return ae("localStorage", pt, t), t;
|
|
611
|
+
}
|
|
612
|
+
function In(e, t) {
|
|
613
|
+
const n = [];
|
|
614
|
+
let r = null;
|
|
615
|
+
const o = Pt(), i = () => {
|
|
616
|
+
for (r !== null && (window.clearTimeout(r), r = null); n.length > 0; ) {
|
|
617
|
+
const u = n.splice(0, qn);
|
|
618
|
+
cn(e, { events: u });
|
|
619
|
+
}
|
|
620
|
+
}, a = (u, d = {}) => {
|
|
621
|
+
n.push({
|
|
622
|
+
id: Ke(),
|
|
623
|
+
type: u,
|
|
624
|
+
embedKind: t.kind,
|
|
625
|
+
embedId: t.id,
|
|
626
|
+
widgetId: d.widgetId,
|
|
627
|
+
sessionId: d.sessionId,
|
|
628
|
+
clientKey: o,
|
|
629
|
+
url: window.location.href.slice(0, 2e3),
|
|
630
|
+
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
631
|
+
payload: d.payload
|
|
632
|
+
}), n.length >= Cn ? i() : r === null && (r = window.setTimeout(i, $n));
|
|
633
|
+
};
|
|
634
|
+
return window.addEventListener("pagehide", i), document.addEventListener("visibilitychange", () => {
|
|
635
|
+
document.visibilityState === "hidden" && i();
|
|
636
|
+
}), {
|
|
637
|
+
report: a,
|
|
638
|
+
flush: i
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
var Ft = (e) => `usereq:once:${e}`;
|
|
642
|
+
function Ae(e, t, n) {
|
|
643
|
+
switch (e) {
|
|
644
|
+
case "is":
|
|
645
|
+
return t === n;
|
|
646
|
+
case "starts_with":
|
|
647
|
+
return t.startsWith(n);
|
|
648
|
+
case "contains":
|
|
649
|
+
return t.includes(n);
|
|
650
|
+
case "matches":
|
|
651
|
+
try {
|
|
652
|
+
return new RegExp(n).test(t);
|
|
653
|
+
} catch {
|
|
654
|
+
return !1;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
function Tn(e, t) {
|
|
659
|
+
switch (e.kind) {
|
|
660
|
+
case "path":
|
|
661
|
+
return e.value === "*" || Ae(e.op, t.path, e.value);
|
|
662
|
+
case "utm":
|
|
663
|
+
var n;
|
|
664
|
+
return Ae(e.op, (n = t.utm[e.param]) !== null && n !== void 0 ? n : "", e.value);
|
|
665
|
+
case "device":
|
|
666
|
+
return t.device === e.value;
|
|
667
|
+
case "referrer":
|
|
668
|
+
return Ae(e.op, t.referrer, e.value);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
function Mn(e, t) {
|
|
672
|
+
for (const n of e)
|
|
673
|
+
if (!(n.once && se("sessionStorage", Ft(n.id))) && n.conditions.every((r) => Tn(r, t)))
|
|
674
|
+
return n;
|
|
675
|
+
return null;
|
|
676
|
+
}
|
|
677
|
+
function jt(e, t, n) {
|
|
678
|
+
let r = !1, o = () => {
|
|
679
|
+
};
|
|
680
|
+
const i = () => {
|
|
681
|
+
r || (r = !0, o(), n());
|
|
682
|
+
};
|
|
683
|
+
switch (e) {
|
|
684
|
+
case "page_load": {
|
|
685
|
+
const d = window.setTimeout(i, 0);
|
|
686
|
+
o = () => window.clearTimeout(d);
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
case "time_on_page": {
|
|
690
|
+
const d = Number(t.seconds) || 0, c = window.setTimeout(i, d * 1e3);
|
|
691
|
+
o = () => window.clearTimeout(c);
|
|
692
|
+
break;
|
|
693
|
+
}
|
|
694
|
+
case "scroll_depth": {
|
|
695
|
+
const d = Number(t.percent) || 0, c = () => {
|
|
696
|
+
const f = document.documentElement.scrollHeight - window.innerHeight;
|
|
697
|
+
(f <= 0 ? 100 : window.scrollY / f * 100) >= d && i();
|
|
698
|
+
};
|
|
699
|
+
window.addEventListener("scroll", c, { passive: !0 }), o = () => window.removeEventListener("scroll", c), c();
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
case "element_click": {
|
|
703
|
+
var a;
|
|
704
|
+
const d = String((a = t.selector) !== null && a !== void 0 ? a : ""), c = (f) => {
|
|
705
|
+
const h = f.target;
|
|
706
|
+
if (!(!(h instanceof Element) || !d))
|
|
707
|
+
try {
|
|
708
|
+
h.closest(d) && i();
|
|
709
|
+
} catch {
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
document.addEventListener("click", c, !0), o = () => document.removeEventListener("click", c, !0);
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
case "element_visible": {
|
|
716
|
+
var u;
|
|
717
|
+
const d = String((u = t.selector) !== null && u !== void 0 ? u : "");
|
|
718
|
+
let c = null;
|
|
719
|
+
const f = () => {
|
|
720
|
+
let h = null;
|
|
721
|
+
try {
|
|
722
|
+
h = d ? document.querySelector(d) : null;
|
|
723
|
+
} catch {
|
|
724
|
+
h = null;
|
|
725
|
+
}
|
|
726
|
+
return h ? (c = new IntersectionObserver((l) => {
|
|
727
|
+
l.some((p) => p.isIntersecting) && i();
|
|
728
|
+
}), c.observe(h), !0) : !1;
|
|
729
|
+
};
|
|
730
|
+
!f() && document.readyState === "loading" && document.addEventListener("DOMContentLoaded", () => void f(), { once: !0 }), o = () => c == null ? void 0 : c.disconnect();
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
case "exit_intent": {
|
|
734
|
+
const d = (c) => {
|
|
735
|
+
c.relatedTarget === null && c.clientY <= 0 && i();
|
|
736
|
+
};
|
|
737
|
+
document.addEventListener("mouseout", d), o = () => document.removeEventListener("mouseout", d);
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return () => {
|
|
742
|
+
r = !0, o();
|
|
743
|
+
};
|
|
744
|
+
}
|
|
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);
|
|
749
|
+
}) : () => {
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
var ht = (e) => `usereq:split:${e}`, Dt = (e) => `usereq:seq:${e}`;
|
|
753
|
+
function An(e) {
|
|
754
|
+
let t = 2166136261;
|
|
755
|
+
for (let n = 0; n < e.length; n++)
|
|
756
|
+
t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
757
|
+
return t >>> 0;
|
|
758
|
+
}
|
|
759
|
+
function ke(e) {
|
|
760
|
+
return [...e].sort((t, n) => t.position - n.position);
|
|
761
|
+
}
|
|
762
|
+
function zn(e) {
|
|
763
|
+
const t = ke(e.members);
|
|
764
|
+
if (t.length === 0) return null;
|
|
765
|
+
const n = se("localStorage", ht(e.id)), r = n ? t.find((u) => u.widget.id === n) : void 0;
|
|
766
|
+
if (r) return r;
|
|
767
|
+
const o = t.reduce((u, d) => u + d.weight, 0);
|
|
768
|
+
let i = An(`${Pt()}:${e.config.salt}`) % o, a = t[t.length - 1];
|
|
769
|
+
for (const u of t) {
|
|
770
|
+
if (i < u.weight) {
|
|
771
|
+
a = u;
|
|
772
|
+
break;
|
|
773
|
+
}
|
|
774
|
+
i -= u.weight;
|
|
775
|
+
}
|
|
776
|
+
return ae("localStorage", ht(e.id), a.widget.id), a;
|
|
777
|
+
}
|
|
778
|
+
function Wt(e) {
|
|
779
|
+
var t, n;
|
|
780
|
+
const r = ke(e.members);
|
|
781
|
+
if (r.length === 0) return null;
|
|
782
|
+
const o = Number((t = se("sessionStorage", Dt(e.id))) !== null && t !== void 0 ? t : 0);
|
|
783
|
+
return (n = r[Number.isFinite(o) ? Math.min(o, r.length - 1) : 0]) !== null && n !== void 0 ? n : null;
|
|
784
|
+
}
|
|
785
|
+
function Rn(e, t, n) {
|
|
786
|
+
if (!t.advanceOn) return () => {
|
|
787
|
+
};
|
|
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, () => {
|
|
790
|
+
var i;
|
|
791
|
+
const a = o + 1 < r.length ? o + 1 : null;
|
|
792
|
+
if (a === null) {
|
|
793
|
+
n(null);
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
ae("sessionStorage", Dt(e.id), String(a)), n((i = r[a]) !== null && i !== void 0 ? i : null);
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
function Hn(e) {
|
|
800
|
+
switch (e.mode) {
|
|
801
|
+
case "split": {
|
|
802
|
+
const t = zn(e);
|
|
803
|
+
return t ? [t.widget] : [];
|
|
804
|
+
}
|
|
805
|
+
case "sequence": {
|
|
806
|
+
const t = Wt(e);
|
|
807
|
+
return t ? [t.widget] : [];
|
|
808
|
+
}
|
|
809
|
+
case "parallel":
|
|
810
|
+
return ke(e.members).map((t) => t.widget);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
function En(e) {
|
|
814
|
+
var t, n, r, o;
|
|
815
|
+
if (e) return e === "dark";
|
|
816
|
+
const i = (t = _t(getComputedStyle(document.body).backgroundColor)) !== null && t !== void 0 ? t : _t(getComputedStyle(document.documentElement).backgroundColor);
|
|
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;
|
|
818
|
+
}
|
|
819
|
+
function _t(e) {
|
|
820
|
+
const t = /rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)(?:[,\s/]+([\d.]+))?/.exec(e);
|
|
821
|
+
if (!t || (t[4] === void 0 ? 1 : Number(t[4])) < 0.5) return null;
|
|
822
|
+
const [n, r, o] = [
|
|
823
|
+
Number(t[1]),
|
|
824
|
+
Number(t[2]),
|
|
825
|
+
Number(t[3])
|
|
826
|
+
];
|
|
827
|
+
return (0.299 * n + 0.587 * r + 0.114 * o) / 255;
|
|
828
|
+
}
|
|
829
|
+
function Pn(e = window.innerWidth) {
|
|
830
|
+
return e < 640 ? "mobile" : e < 1024 ? "tablet" : "desktop";
|
|
831
|
+
}
|
|
832
|
+
function Fn() {
|
|
833
|
+
const e = new URL(window.location.href), t = {};
|
|
834
|
+
for (const n of [
|
|
835
|
+
"source",
|
|
836
|
+
"medium",
|
|
837
|
+
"campaign",
|
|
838
|
+
"term",
|
|
839
|
+
"content"
|
|
840
|
+
]) {
|
|
841
|
+
const r = e.searchParams.get(`utm_${n}`);
|
|
842
|
+
r && (t[n] = r);
|
|
843
|
+
}
|
|
844
|
+
return {
|
|
845
|
+
href: e.href.slice(0, 2e3),
|
|
846
|
+
path: e.pathname,
|
|
847
|
+
referrer: document.referrer.slice(0, 2e3),
|
|
848
|
+
utm: t,
|
|
849
|
+
device: Pn()
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
function Lt(e) {
|
|
853
|
+
const t = e.replace("#", "");
|
|
854
|
+
return {
|
|
855
|
+
r: parseInt(t.slice(0, 2), 16),
|
|
856
|
+
g: parseInt(t.slice(2, 4), 16),
|
|
857
|
+
b: parseInt(t.slice(4, 6), 16)
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
function jn(e) {
|
|
861
|
+
const { r: t, g: n, b: r } = Lt(e);
|
|
862
|
+
return (0.299 * t + 0.587 * n + 0.114 * r) / 255 > 0.62 ? "#15171e" : "#ffffff";
|
|
863
|
+
}
|
|
864
|
+
var le = (e) => e ? "245,245,241" : "21,23,30";
|
|
865
|
+
function Bn(e, t) {
|
|
866
|
+
const n = e.appearance, r = n.accent;
|
|
867
|
+
return {
|
|
868
|
+
accent: r,
|
|
869
|
+
accentFill: (() => {
|
|
870
|
+
if (n.alpha >= 100) return r;
|
|
871
|
+
const { r: o, g: i, b: a } = Lt(r);
|
|
872
|
+
return `rgba(${o},${i},${a},${n.alpha / 100})`;
|
|
873
|
+
})(),
|
|
874
|
+
accentText: jn(r),
|
|
875
|
+
rad: n.radius,
|
|
876
|
+
isGlass: e.type === "chat" && e.variant === "stream" && n.skin === "glass",
|
|
877
|
+
isMessenger: e.type === "chat" && e.variant === "bubble" && e.preset === "facebook-messenger",
|
|
878
|
+
hostDark: t,
|
|
879
|
+
ink: le(t),
|
|
880
|
+
surfaceBg: t ? "#181b22" : "#ffffff",
|
|
881
|
+
side: n.position === "bottom-right" ? { right: n.offsetX } : { left: n.offsetX },
|
|
882
|
+
offsetY: n.offsetY
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
function k(e, t, n) {
|
|
886
|
+
const r = e.appearance.parts[t], o = [`uq-${t}`];
|
|
887
|
+
return n && o.push(n), r && o.push(r.trim()), o.join(" ");
|
|
888
|
+
}
|
|
889
|
+
var Dn = 0;
|
|
890
|
+
function s(e, t, n, r, o, i) {
|
|
891
|
+
t || (t = {});
|
|
892
|
+
var a, u, d = t;
|
|
893
|
+
if ("ref" in d) for (u in d = {}, t) u == "ref" ? a = t[u] : d[u] = t[u];
|
|
894
|
+
var c = {
|
|
895
|
+
type: e,
|
|
896
|
+
props: d,
|
|
897
|
+
key: n,
|
|
898
|
+
ref: a,
|
|
899
|
+
__k: null,
|
|
900
|
+
__: null,
|
|
901
|
+
__b: 0,
|
|
902
|
+
__e: null,
|
|
903
|
+
__c: null,
|
|
904
|
+
constructor: void 0,
|
|
905
|
+
__v: --Dn,
|
|
906
|
+
__i: -1,
|
|
907
|
+
__u: 0,
|
|
908
|
+
__source: o,
|
|
909
|
+
__self: i
|
|
910
|
+
};
|
|
911
|
+
if (typeof e == "function" && (a = e.defaultProps)) for (u in a) d[u] === void 0 && (d[u] = a[u]);
|
|
912
|
+
return q.vnode && q.vnode(c), c;
|
|
913
|
+
}
|
|
914
|
+
function j({ size: e, children: t }) {
|
|
915
|
+
return /* @__PURE__ */ s("svg", {
|
|
916
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
917
|
+
width: e,
|
|
918
|
+
height: e,
|
|
919
|
+
viewBox: "0 0 24 24",
|
|
920
|
+
fill: "none",
|
|
921
|
+
stroke: "currentColor",
|
|
922
|
+
"stroke-width": "2",
|
|
923
|
+
"stroke-linecap": "round",
|
|
924
|
+
"stroke-linejoin": "round",
|
|
925
|
+
"aria-hidden": "true",
|
|
926
|
+
children: t
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
var Nt = ({ size: e }) => /* @__PURE__ */ s(j, {
|
|
930
|
+
size: e,
|
|
931
|
+
children: [
|
|
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" }),
|
|
933
|
+
/* @__PURE__ */ s("path", { d: "M20 2v4" }),
|
|
934
|
+
/* @__PURE__ */ s("path", { d: "M22 4h-4" }),
|
|
935
|
+
/* @__PURE__ */ s("circle", {
|
|
936
|
+
cx: "4",
|
|
937
|
+
cy: "20",
|
|
938
|
+
r: "2"
|
|
939
|
+
})
|
|
940
|
+
]
|
|
941
|
+
}), Ot = ({ size: e }) => /* @__PURE__ */ s(j, {
|
|
942
|
+
size: e,
|
|
943
|
+
children: [/* @__PURE__ */ s("path", { d: "M5 12h14" }), /* @__PURE__ */ s("path", { d: "m12 5 7 7-7 7" })]
|
|
944
|
+
}), $e = ({ size: e }) => /* @__PURE__ */ s(j, {
|
|
945
|
+
size: e,
|
|
946
|
+
children: [/* @__PURE__ */ s("path", { d: "M18 6 6 18" }), /* @__PURE__ */ s("path", { d: "m6 6 12 12" })]
|
|
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, {
|
|
955
|
+
size: e,
|
|
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" })
|
|
957
|
+
}), Ln = ({ size: e }) => /* @__PURE__ */ s(j, {
|
|
958
|
+
size: e,
|
|
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", {
|
|
960
|
+
x: "2",
|
|
961
|
+
y: "6",
|
|
962
|
+
width: "14",
|
|
963
|
+
height: "12",
|
|
964
|
+
rx: "2"
|
|
965
|
+
})]
|
|
966
|
+
}), Nn = ({ size: e }) => /* @__PURE__ */ s(j, {
|
|
967
|
+
size: e,
|
|
968
|
+
children: [
|
|
969
|
+
/* @__PURE__ */ s("circle", {
|
|
970
|
+
cx: "12",
|
|
971
|
+
cy: "12",
|
|
972
|
+
r: "10"
|
|
973
|
+
}),
|
|
974
|
+
/* @__PURE__ */ s("path", { d: "M12 16v-4" }),
|
|
975
|
+
/* @__PURE__ */ s("path", { d: "M12 8h.01" })
|
|
976
|
+
]
|
|
977
|
+
}), Yt = ({ size: e }) => /* @__PURE__ */ s(j, {
|
|
978
|
+
size: e,
|
|
979
|
+
children: /* @__PURE__ */ s("path", { d: "m6 9 6 6 6-6" })
|
|
980
|
+
}), On = ({ size: e }) => /* @__PURE__ */ s(j, {
|
|
981
|
+
size: e,
|
|
982
|
+
children: /* @__PURE__ */ s("path", { d: "M5 12h14" })
|
|
983
|
+
}), Yn = ({ size: e }) => /* @__PURE__ */ s(j, {
|
|
984
|
+
size: e,
|
|
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" })]
|
|
986
|
+
}), Un = ({ size: e }) => /* @__PURE__ */ s(j, {
|
|
987
|
+
size: e,
|
|
988
|
+
children: [
|
|
989
|
+
/* @__PURE__ */ s("path", { d: "M15 3h6v6" }),
|
|
990
|
+
/* @__PURE__ */ s("path", { d: "M10 14 21 3" }),
|
|
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" })
|
|
992
|
+
]
|
|
993
|
+
}), Gn = ({ size: e, d: t }) => /* @__PURE__ */ s("svg", {
|
|
994
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
995
|
+
width: e,
|
|
996
|
+
height: e,
|
|
997
|
+
viewBox: "0 0 24 24",
|
|
998
|
+
fill: "currentColor",
|
|
999
|
+
"aria-hidden": "true",
|
|
1000
|
+
children: /* @__PURE__ */ s("path", { d: t })
|
|
1001
|
+
});
|
|
1002
|
+
function Kn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }) {
|
|
1003
|
+
var a;
|
|
1004
|
+
const u = e.config, { accentFill: d, accentText: c, rad: f } = t;
|
|
1005
|
+
if (!r) return null;
|
|
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 };
|
|
1007
|
+
return /* @__PURE__ */ s("div", {
|
|
1008
|
+
class: k(u, "strip", "uq-fixed uq-fade"),
|
|
1009
|
+
role: "region",
|
|
1010
|
+
"aria-label": "Announcement",
|
|
1011
|
+
style: {
|
|
1012
|
+
left: 0,
|
|
1013
|
+
right: 0,
|
|
1014
|
+
...p,
|
|
1015
|
+
display: "flex",
|
|
1016
|
+
alignItems: "center",
|
|
1017
|
+
justifyContent: "center",
|
|
1018
|
+
gap: 14,
|
|
1019
|
+
padding: "11px 14px",
|
|
1020
|
+
background: d,
|
|
1021
|
+
color: c
|
|
1022
|
+
},
|
|
1023
|
+
children: [
|
|
1024
|
+
/* @__PURE__ */ s("span", {
|
|
1025
|
+
class: k(u, "text"),
|
|
1026
|
+
style: {
|
|
1027
|
+
fontSize: 12.5,
|
|
1028
|
+
fontWeight: 500
|
|
1029
|
+
},
|
|
1030
|
+
children: u.text
|
|
1031
|
+
}),
|
|
1032
|
+
h && /* @__PURE__ */ s("a", {
|
|
1033
|
+
class: k(u, "cta"),
|
|
1034
|
+
href: l || "#",
|
|
1035
|
+
target: l ? "_blank" : void 0,
|
|
1036
|
+
rel: l ? "noopener noreferrer" : void 0,
|
|
1037
|
+
onClick: () => n.report("cta.clicked", {
|
|
1038
|
+
widgetId: e.id,
|
|
1039
|
+
payload: { href: l }
|
|
1040
|
+
}),
|
|
1041
|
+
style: {
|
|
1042
|
+
fontSize: 11.5,
|
|
1043
|
+
padding: "5px 10px",
|
|
1044
|
+
borderRadius: f,
|
|
1045
|
+
border: `1px solid ${c}`,
|
|
1046
|
+
whiteSpace: "nowrap"
|
|
1047
|
+
},
|
|
1048
|
+
children: h.label
|
|
1049
|
+
}),
|
|
1050
|
+
!i && /* @__PURE__ */ s("button", {
|
|
1051
|
+
type: "button",
|
|
1052
|
+
class: k(u, "close"),
|
|
1053
|
+
onClick: () => o(!1),
|
|
1054
|
+
"aria-label": "Close",
|
|
1055
|
+
style: {
|
|
1056
|
+
position: "absolute",
|
|
1057
|
+
right: 10,
|
|
1058
|
+
top: "50%",
|
|
1059
|
+
transform: "translateY(-50%)",
|
|
1060
|
+
width: 24,
|
|
1061
|
+
height: 24,
|
|
1062
|
+
display: "flex",
|
|
1063
|
+
alignItems: "center",
|
|
1064
|
+
justifyContent: "center",
|
|
1065
|
+
opacity: 0.7
|
|
1066
|
+
},
|
|
1067
|
+
children: /* @__PURE__ */ s($e, { size: 14 })
|
|
1068
|
+
})
|
|
1069
|
+
]
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
var ze = {
|
|
1073
|
+
holdMs: 1260,
|
|
1074
|
+
gapMs: 1520,
|
|
1075
|
+
jitterMs: 100
|
|
1076
|
+
};
|
|
1077
|
+
function Vn(e, t = Math.random) {
|
|
1078
|
+
const n = [];
|
|
1079
|
+
let r = 0;
|
|
1080
|
+
for (let o = 0; o < e; o++) {
|
|
1081
|
+
if (o === 0) r += ze.holdMs;
|
|
1082
|
+
else {
|
|
1083
|
+
const i = Math.round((t() * 2 - 1) * ze.jitterMs);
|
|
1084
|
+
r += Math.max(0, ze.gapMs + i);
|
|
1085
|
+
}
|
|
1086
|
+
n.push(r);
|
|
1087
|
+
}
|
|
1088
|
+
return n;
|
|
1089
|
+
}
|
|
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
|
|
1120
|
+
};
|
|
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, {
|
|
1162
|
+
kind: n.kind,
|
|
1163
|
+
id: n.id,
|
|
1164
|
+
widgetId: n.kind === "group" ? t.id : void 0,
|
|
1165
|
+
landingUrl: r.href,
|
|
1166
|
+
referrer: r.referrer || void 0,
|
|
1167
|
+
utm: Object.keys(r.utm).length ? r.utm : void 0
|
|
1168
|
+
});
|
|
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;
|
|
1177
|
+
}, [
|
|
1178
|
+
e,
|
|
1179
|
+
n.kind,
|
|
1180
|
+
n.id,
|
|
1181
|
+
t.id,
|
|
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);
|
|
1189
|
+
try {
|
|
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,
|
|
1196
|
+
role: "assistant",
|
|
1197
|
+
parts: F,
|
|
1198
|
+
shown: 0
|
|
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.");
|
|
1208
|
+
}
|
|
1209
|
+
}, [
|
|
1210
|
+
e,
|
|
1211
|
+
C,
|
|
1212
|
+
$
|
|
1213
|
+
]);
|
|
1214
|
+
return {
|
|
1215
|
+
turns: o,
|
|
1216
|
+
busy: a,
|
|
1217
|
+
error: d,
|
|
1218
|
+
sessionId: f,
|
|
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
|
|
1226
|
+
};
|
|
1227
|
+
_.current = S, i((T) => [...T, {
|
|
1228
|
+
id: S.id,
|
|
1229
|
+
role: "user",
|
|
1230
|
+
parts: [I],
|
|
1231
|
+
shown: 1
|
|
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, $])
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
function tr() {
|
|
1284
|
+
const e = "(max-width: 639px)", [t, n] = E(() => {
|
|
1285
|
+
var r, o, i;
|
|
1286
|
+
return (r = (o = (i = window).matchMedia) === null || o === void 0 ? void 0 : o.call(i, e).matches) !== null && r !== void 0 ? r : !1;
|
|
1287
|
+
});
|
|
1288
|
+
return P(() => {
|
|
1289
|
+
var r, o;
|
|
1290
|
+
const i = (r = (o = window).matchMedia) === null || r === void 0 ? void 0 : r.call(o, e);
|
|
1291
|
+
if (!i) return;
|
|
1292
|
+
const a = () => n(i.matches);
|
|
1293
|
+
return i.addEventListener("change", a), () => i.removeEventListener("change", a);
|
|
1294
|
+
}, []), t;
|
|
1295
|
+
}
|
|
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 = (_) => {
|
|
1299
|
+
const g = d.current;
|
|
1300
|
+
g && (_.currentTarget.setPointerCapture(_.pointerId), c.current = {
|
|
1301
|
+
startY: _.clientY,
|
|
1302
|
+
startHeight: g.getBoundingClientRect().height,
|
|
1303
|
+
lastY: _.clientY,
|
|
1304
|
+
lastAt: _.timeStamp,
|
|
1305
|
+
velocity: 0
|
|
1306
|
+
}, u(c.current.startHeight));
|
|
1307
|
+
}, h = (_) => {
|
|
1308
|
+
const g = c.current;
|
|
1309
|
+
if (!g) return;
|
|
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(), $)));
|
|
1314
|
+
}, l = () => {
|
|
1315
|
+
const _ = c.current;
|
|
1316
|
+
if (!_) return;
|
|
1317
|
+
c.current = null;
|
|
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") {
|
|
1321
|
+
t ? i("half") : n();
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
i($);
|
|
1325
|
+
}, { ink: p, surfaceBg: m, rad: x } = e, v = o === "full" && a === null;
|
|
1326
|
+
return /* @__PURE__ */ s("div", {
|
|
1327
|
+
ref: d,
|
|
1328
|
+
class: [
|
|
1329
|
+
"uq-fixed uq-drawer uq-slide",
|
|
1330
|
+
v ? "uq-drawer-full" : "uq-drawer-half",
|
|
1331
|
+
a !== null && "uq-drawer-held"
|
|
1332
|
+
].filter(Boolean).join(" "),
|
|
1333
|
+
role: "dialog",
|
|
1334
|
+
"aria-modal": "false",
|
|
1335
|
+
style: {
|
|
1336
|
+
height: a !== null ? a : void 0,
|
|
1337
|
+
borderRadius: v ? 0 : `${x}px ${x}px 0 0`,
|
|
1338
|
+
borderTop: `1px solid rgba(${p},.12)`,
|
|
1339
|
+
background: m,
|
|
1340
|
+
boxShadow: "0 -12px 40px rgba(0,0,0,.18)"
|
|
1341
|
+
},
|
|
1342
|
+
children: [/* @__PURE__ */ s("div", {
|
|
1343
|
+
class: "uq-grab",
|
|
1344
|
+
onPointerDown: f,
|
|
1345
|
+
onPointerMove: h,
|
|
1346
|
+
onPointerUp: l,
|
|
1347
|
+
onPointerCancel: l,
|
|
1348
|
+
"aria-label": v ? "Drag down to shrink or close" : "Drag up to expand",
|
|
1349
|
+
style: { background: m },
|
|
1350
|
+
children: /* @__PURE__ */ s("span", { style: { background: `rgba(${p},.25)` } })
|
|
1351
|
+
}), r]
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
var b = {
|
|
1355
|
+
accent: "#7B5BFF",
|
|
1356
|
+
gradient: "linear-gradient(135deg,#00B2FF 0%,#006AFF 38%,#8E5BFF 100%)",
|
|
1357
|
+
blue: "#0084FF",
|
|
1358
|
+
surface: {
|
|
1359
|
+
light: "#ffffff",
|
|
1360
|
+
dark: "#242526"
|
|
1361
|
+
},
|
|
1362
|
+
bubble: {
|
|
1363
|
+
light: "#f5f5f5",
|
|
1364
|
+
dark: "#404040"
|
|
1365
|
+
},
|
|
1366
|
+
muted: {
|
|
1367
|
+
light: "#8e8e8e",
|
|
1368
|
+
dark: "#a8a8a8"
|
|
1369
|
+
},
|
|
1370
|
+
border: {
|
|
1371
|
+
light: "rgba(0,0,0,.1)",
|
|
1372
|
+
dark: "rgba(255,255,255,.12)"
|
|
1373
|
+
},
|
|
1374
|
+
panelWidth: 372,
|
|
1375
|
+
panelHeight: 520,
|
|
1376
|
+
panelRadius: 24,
|
|
1377
|
+
panelGap: 14,
|
|
1378
|
+
panelShadow: "0 8px 32px rgba(0,0,0,.16)",
|
|
1379
|
+
launcherSize: 60,
|
|
1380
|
+
launcherShadow: "0 6px 20px rgba(123,91,255,.4)",
|
|
1381
|
+
badgeSize: 20,
|
|
1382
|
+
logo: "M12 2C6.48 2 2 6.18 2 11.32c0 2.93 1.45 5.55 3.7 7.27v3.4l3.39-1.86a10.5 10.5 0 0 0 2.91.41c5.52 0 10-4.18 10-9.22S17.52 2 12 2Zm1.06 12.42-2.55-2.72-4.97 2.72 5.46-5.8 2.61 2.72 4.91-2.72-5.46 5.8Z",
|
|
1383
|
+
headerAvatar: 40,
|
|
1384
|
+
headerButton: 28,
|
|
1385
|
+
headerIcon: 18,
|
|
1386
|
+
nameFont: 15,
|
|
1387
|
+
avatarSize: 28,
|
|
1388
|
+
bubbleRadius: 18,
|
|
1389
|
+
bubbleFont: 14,
|
|
1390
|
+
bubblePadding: "6px 12px",
|
|
1391
|
+
bubbleMaxWidth: "78%",
|
|
1392
|
+
ctaShadow: "0 4px 12px rgba(123,91,255,.32)",
|
|
1393
|
+
composerPlaceholder: "Aa",
|
|
1394
|
+
composerRadius: 24,
|
|
1395
|
+
composerHeight: 36,
|
|
1396
|
+
sendSize: 36,
|
|
1397
|
+
sendIcon: 20
|
|
1398
|
+
}, rr = 3600, Xe = (e) => e.welcome || "Hi! Ask me anything before you buy.";
|
|
1399
|
+
function Gt(e, t = "Type your message…") {
|
|
1400
|
+
const n = e.spotlights.filter((a) => a.trim()), [r, o] = E(0);
|
|
1401
|
+
P(() => {
|
|
1402
|
+
if (n.length < 2) return;
|
|
1403
|
+
const a = window.setInterval(() => o((u) => u + 1), rr);
|
|
1404
|
+
return () => window.clearInterval(a);
|
|
1405
|
+
}, [n.length]);
|
|
1406
|
+
const i = e.placeholder || t;
|
|
1407
|
+
return n.length ? n[r % n.length] : i;
|
|
1408
|
+
}
|
|
1409
|
+
function Ce(e) {
|
|
1410
|
+
const t = D(null);
|
|
1411
|
+
return P(() => {
|
|
1412
|
+
const n = t.current;
|
|
1413
|
+
n && (n.scrollTop = n.scrollHeight);
|
|
1414
|
+
}, e), t;
|
|
1415
|
+
}
|
|
1416
|
+
function Kt(e) {
|
|
1417
|
+
const t = e ? "dark" : "light";
|
|
1418
|
+
return {
|
|
1419
|
+
surface: b.surface[t],
|
|
1420
|
+
bubble: b.bubble[t],
|
|
1421
|
+
muted: b.muted[t],
|
|
1422
|
+
border: b.border[t]
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
var X = (e, t = {}) => ({
|
|
1426
|
+
width: e,
|
|
1427
|
+
height: e,
|
|
1428
|
+
borderRadius: "50%",
|
|
1429
|
+
display: "flex",
|
|
1430
|
+
alignItems: "center",
|
|
1431
|
+
justifyContent: "center",
|
|
1432
|
+
flexShrink: 0,
|
|
1433
|
+
...t
|
|
1434
|
+
});
|
|
1435
|
+
function Je({ payload: e, size: t, font: n, palette: r, fallback: o }) {
|
|
1436
|
+
var i, a, u, d;
|
|
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;
|
|
1438
|
+
return f ? /* @__PURE__ */ s("img", {
|
|
1439
|
+
src: f,
|
|
1440
|
+
alt: "",
|
|
1441
|
+
width: t,
|
|
1442
|
+
height: t,
|
|
1443
|
+
style: X(t, { objectFit: "cover" })
|
|
1444
|
+
}) : /* @__PURE__ */ s("span", {
|
|
1445
|
+
style: X(t, {
|
|
1446
|
+
background: r.bubble,
|
|
1447
|
+
color: r.muted,
|
|
1448
|
+
fontSize: n,
|
|
1449
|
+
fontWeight: 600,
|
|
1450
|
+
...o
|
|
1451
|
+
}),
|
|
1452
|
+
children: c ? c.trim().charAt(0).toUpperCase() : "A"
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
function He({ text: e, mine: t, runStart: n, look: r, config: o, payload: i, palette: a, children: u }) {
|
|
1456
|
+
return /* @__PURE__ */ s("div", {
|
|
1457
|
+
class: "uq-rise",
|
|
1458
|
+
style: {
|
|
1459
|
+
display: "flex",
|
|
1460
|
+
alignItems: "flex-end",
|
|
1461
|
+
gap: 6,
|
|
1462
|
+
justifyContent: t ? "flex-end" : "flex-start",
|
|
1463
|
+
marginTop: n ? 6 : 2
|
|
1464
|
+
},
|
|
1465
|
+
children: [!t && (n ? /* @__PURE__ */ s(Je, {
|
|
1466
|
+
payload: i,
|
|
1467
|
+
size: b.avatarSize,
|
|
1468
|
+
font: 12,
|
|
1469
|
+
palette: a
|
|
1470
|
+
}) : /* @__PURE__ */ s("span", { style: {
|
|
1471
|
+
width: b.avatarSize,
|
|
1472
|
+
flexShrink: 0
|
|
1473
|
+
} })), /* @__PURE__ */ s("div", {
|
|
1474
|
+
class: k(o, t ? "userMessage" : "botMessage"),
|
|
1475
|
+
style: {
|
|
1476
|
+
maxWidth: b.bubbleMaxWidth,
|
|
1477
|
+
padding: u ? "8px 12px" : b.bubblePadding,
|
|
1478
|
+
borderRadius: b.bubbleRadius,
|
|
1479
|
+
background: t ? b.gradient : a.bubble,
|
|
1480
|
+
color: t ? "#fff" : `rgb(${r.ink})`,
|
|
1481
|
+
fontSize: b.bubbleFont,
|
|
1482
|
+
lineHeight: 1.375,
|
|
1483
|
+
whiteSpace: "pre-wrap",
|
|
1484
|
+
overflowWrap: "anywhere"
|
|
1485
|
+
},
|
|
1486
|
+
children: u != null ? u : e
|
|
1487
|
+
})]
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
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([
|
|
1551
|
+
r.turns,
|
|
1552
|
+
r.busy,
|
|
1553
|
+
r.error,
|
|
1554
|
+
r.stopping
|
|
1555
|
+
]), [w, I] = E(""), S = D(null);
|
|
1556
|
+
P(() => {
|
|
1557
|
+
var z;
|
|
1558
|
+
o > 0 && ((z = S.current) === null || z === void 0 || z.focus());
|
|
1559
|
+
}, [o]);
|
|
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 = [{
|
|
1563
|
+
key: "welcome",
|
|
1564
|
+
text: Xe(t),
|
|
1565
|
+
mine: !1
|
|
1566
|
+
}];
|
|
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 : "",
|
|
1572
|
+
mine: !0
|
|
1573
|
+
});
|
|
1574
|
+
} else z.parts.slice(0, z.shown).forEach((Z, qe) => {
|
|
1575
|
+
F.push({
|
|
1576
|
+
key: `${z.id}:${qe}`,
|
|
1577
|
+
text: Z,
|
|
1578
|
+
mine: !1
|
|
1579
|
+
});
|
|
1580
|
+
});
|
|
1581
|
+
const Q = F[F.length - 1], N = (z, Z, qe, Ie, Qe) => /* @__PURE__ */ s("button", {
|
|
1582
|
+
type: "button",
|
|
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
|
|
1590
|
+
}),
|
|
1591
|
+
children: z
|
|
1592
|
+
}), B = b.headerIcon;
|
|
1593
|
+
return /* @__PURE__ */ s("div", {
|
|
1594
|
+
class: k(t, "panel"),
|
|
1595
|
+
style: {
|
|
1596
|
+
display: "flex",
|
|
1597
|
+
flexDirection: "column",
|
|
1598
|
+
borderRadius: u ? 0 : b.panelRadius,
|
|
1599
|
+
overflow: "hidden",
|
|
1600
|
+
border: u ? void 0 : `1px solid ${g}`,
|
|
1601
|
+
boxShadow: u ? void 0 : b.panelShadow,
|
|
1602
|
+
background: x,
|
|
1603
|
+
color: `rgb(${n.ink})`,
|
|
1604
|
+
...u ? {
|
|
1605
|
+
flex: 1,
|
|
1606
|
+
minHeight: 0
|
|
1607
|
+
} : {
|
|
1608
|
+
height: b.panelHeight,
|
|
1609
|
+
maxHeight: `calc(100vh - ${n.offsetY + b.launcherSize + b.panelGap + 12}px)`
|
|
1610
|
+
}
|
|
1611
|
+
},
|
|
1612
|
+
children: [
|
|
1613
|
+
/* @__PURE__ */ s("div", {
|
|
1614
|
+
class: k(t, "header"),
|
|
1615
|
+
style: {
|
|
1616
|
+
display: "flex",
|
|
1617
|
+
alignItems: "center",
|
|
1618
|
+
gap: 8,
|
|
1619
|
+
padding: "10px 12px",
|
|
1620
|
+
borderBottom: `1px solid ${g}`
|
|
1621
|
+
},
|
|
1622
|
+
children: [
|
|
1623
|
+
/* @__PURE__ */ s(Je, {
|
|
1624
|
+
payload: e,
|
|
1625
|
+
size: b.headerAvatar,
|
|
1626
|
+
font: 14,
|
|
1627
|
+
palette: m
|
|
1628
|
+
}),
|
|
1629
|
+
/* @__PURE__ */ s("span", {
|
|
1630
|
+
style: {
|
|
1631
|
+
flex: 1,
|
|
1632
|
+
minWidth: 0,
|
|
1633
|
+
display: "flex",
|
|
1634
|
+
alignItems: "center",
|
|
1635
|
+
gap: 2
|
|
1636
|
+
},
|
|
1637
|
+
children: [/* @__PURE__ */ s("span", {
|
|
1638
|
+
style: {
|
|
1639
|
+
fontSize: b.nameFont,
|
|
1640
|
+
fontWeight: 600,
|
|
1641
|
+
overflow: "hidden",
|
|
1642
|
+
textOverflow: "ellipsis",
|
|
1643
|
+
whiteSpace: "nowrap"
|
|
1644
|
+
},
|
|
1645
|
+
children: $ ? $.split("—")[0].trim() : "Chat"
|
|
1646
|
+
}), /* @__PURE__ */ s("span", {
|
|
1647
|
+
style: {
|
|
1648
|
+
color: _,
|
|
1649
|
+
opacity: 0.7,
|
|
1650
|
+
display: "flex"
|
|
1651
|
+
},
|
|
1652
|
+
children: /* @__PURE__ */ s(Yt, { size: 16 })
|
|
1653
|
+
})]
|
|
1654
|
+
}),
|
|
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")
|
|
1661
|
+
]
|
|
1662
|
+
}),
|
|
1663
|
+
/* @__PURE__ */ s("div", {
|
|
1664
|
+
ref: A,
|
|
1665
|
+
style: {
|
|
1666
|
+
flex: 1,
|
|
1667
|
+
minHeight: 0,
|
|
1668
|
+
padding: "6px 12px 12px",
|
|
1669
|
+
display: "flex",
|
|
1670
|
+
flexDirection: "column",
|
|
1671
|
+
overflowY: "auto",
|
|
1672
|
+
overscrollBehavior: "contain"
|
|
1673
|
+
},
|
|
1674
|
+
children: [
|
|
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,
|
|
1679
|
+
look: n,
|
|
1680
|
+
config: t,
|
|
1681
|
+
payload: e,
|
|
1682
|
+
palette: m
|
|
1683
|
+
}, z.key)),
|
|
1684
|
+
r.stopping && /* @__PURE__ */ s(He, {
|
|
1685
|
+
mine: !1,
|
|
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,
|
|
1699
|
+
look: n,
|
|
1700
|
+
config: t,
|
|
1701
|
+
payload: e,
|
|
1702
|
+
palette: m,
|
|
1703
|
+
children: /* @__PURE__ */ s("span", {
|
|
1704
|
+
class: "uq-dots",
|
|
1705
|
+
"aria-label": "Typing",
|
|
1706
|
+
style: { gap: 4 },
|
|
1707
|
+
children: [
|
|
1708
|
+
/* @__PURE__ */ s("span", { style: {
|
|
1709
|
+
width: 6,
|
|
1710
|
+
height: 6
|
|
1711
|
+
} }),
|
|
1712
|
+
/* @__PURE__ */ s("span", { style: {
|
|
1713
|
+
width: 6,
|
|
1714
|
+
height: 6
|
|
1715
|
+
} }),
|
|
1716
|
+
/* @__PURE__ */ s("span", { style: {
|
|
1717
|
+
width: 6,
|
|
1718
|
+
height: 6
|
|
1719
|
+
} })
|
|
1720
|
+
]
|
|
1721
|
+
})
|
|
1722
|
+
}),
|
|
1723
|
+
r.error && /* @__PURE__ */ s("div", {
|
|
1724
|
+
class: "uq-error uq-fade",
|
|
1725
|
+
style: {
|
|
1726
|
+
display: "flex",
|
|
1727
|
+
gap: 8,
|
|
1728
|
+
marginTop: 6,
|
|
1729
|
+
paddingLeft: b.avatarSize + 6,
|
|
1730
|
+
fontSize: 12,
|
|
1731
|
+
color: _
|
|
1732
|
+
},
|
|
1733
|
+
children: [/* @__PURE__ */ s("span", { children: r.error }), /* @__PURE__ */ s("button", {
|
|
1734
|
+
type: "button",
|
|
1735
|
+
onClick: r.retry,
|
|
1736
|
+
style: {
|
|
1737
|
+
color: b.blue,
|
|
1738
|
+
fontWeight: 500,
|
|
1739
|
+
textDecoration: "underline"
|
|
1740
|
+
},
|
|
1741
|
+
children: "Retry"
|
|
1742
|
+
})]
|
|
1743
|
+
})
|
|
1744
|
+
]
|
|
1745
|
+
}),
|
|
1746
|
+
G && /* @__PURE__ */ s("div", {
|
|
1747
|
+
style: {
|
|
1748
|
+
display: "flex",
|
|
1749
|
+
justifyContent: "flex-end",
|
|
1750
|
+
padding: "8px 12px"
|
|
1751
|
+
},
|
|
1752
|
+
children: /* @__PURE__ */ s("a", {
|
|
1753
|
+
class: "uq-cta",
|
|
1754
|
+
href: G.href,
|
|
1755
|
+
target: "_blank",
|
|
1756
|
+
rel: "noopener noreferrer",
|
|
1757
|
+
onClick: i,
|
|
1758
|
+
style: {
|
|
1759
|
+
display: "inline-flex",
|
|
1760
|
+
alignItems: "center",
|
|
1761
|
+
gap: 6,
|
|
1762
|
+
padding: "8px 16px",
|
|
1763
|
+
borderRadius: 999,
|
|
1764
|
+
background: b.gradient,
|
|
1765
|
+
color: "#fff",
|
|
1766
|
+
fontSize: 14,
|
|
1767
|
+
fontWeight: 600,
|
|
1768
|
+
boxShadow: b.ctaShadow
|
|
1769
|
+
},
|
|
1770
|
+
children: [G.label || "Learn more", /* @__PURE__ */ s(Un, { size: 16 })]
|
|
1771
|
+
})
|
|
1772
|
+
}),
|
|
1773
|
+
/* @__PURE__ */ s("form", {
|
|
1774
|
+
class: k(t, "composer"),
|
|
1775
|
+
onSubmit: M,
|
|
1776
|
+
style: {
|
|
1777
|
+
display: "flex",
|
|
1778
|
+
alignItems: "center",
|
|
1779
|
+
gap: 4,
|
|
1780
|
+
padding: 8,
|
|
1781
|
+
borderTop: `1px solid ${g}`
|
|
1782
|
+
},
|
|
1783
|
+
children: [/* @__PURE__ */ s("input", {
|
|
1784
|
+
ref: S,
|
|
1785
|
+
type: "text",
|
|
1786
|
+
value: w,
|
|
1787
|
+
onInput: (z) => I(z.target.value),
|
|
1788
|
+
placeholder: y,
|
|
1789
|
+
disabled: !T,
|
|
1790
|
+
maxLength: 4e3,
|
|
1791
|
+
"aria-label": "Message",
|
|
1792
|
+
autoComplete: "off",
|
|
1793
|
+
style: {
|
|
1794
|
+
flex: 1,
|
|
1795
|
+
minHeight: b.composerHeight,
|
|
1796
|
+
padding: "0 12px",
|
|
1797
|
+
borderRadius: b.composerRadius,
|
|
1798
|
+
background: v,
|
|
1799
|
+
color: `rgb(${n.ink})`,
|
|
1800
|
+
fontSize: a ? 16 : 14,
|
|
1801
|
+
"--uq-placeholder": _
|
|
1802
|
+
}
|
|
1803
|
+
}), r.busy ? /* @__PURE__ */ s("button", {
|
|
1804
|
+
type: "button",
|
|
1805
|
+
class: k(t, "sendButton"),
|
|
1806
|
+
onClick: r.stop,
|
|
1807
|
+
"aria-label": "Stop",
|
|
1808
|
+
style: X(b.sendSize, { color: b.blue }),
|
|
1809
|
+
children: /* @__PURE__ */ s("span", { style: {
|
|
1810
|
+
width: 10,
|
|
1811
|
+
height: 10,
|
|
1812
|
+
background: "currentColor",
|
|
1813
|
+
borderRadius: 2
|
|
1814
|
+
} })
|
|
1815
|
+
}) : /* @__PURE__ */ s("button", {
|
|
1816
|
+
type: "submit",
|
|
1817
|
+
class: k(t, "sendButton"),
|
|
1818
|
+
disabled: !T || !w.trim(),
|
|
1819
|
+
"aria-label": "Send",
|
|
1820
|
+
style: X(b.sendSize, {
|
|
1821
|
+
color: b.blue,
|
|
1822
|
+
opacity: T && w.trim() ? 1 : 0.5
|
|
1823
|
+
}),
|
|
1824
|
+
children: /* @__PURE__ */ s(Yn, { size: b.sendIcon })
|
|
1825
|
+
})]
|
|
1826
|
+
})
|
|
1827
|
+
]
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
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);
|
|
1832
|
+
if (a && o) {
|
|
1833
|
+
const m = {
|
|
1834
|
+
...n,
|
|
1835
|
+
surfaceBg: f.surface,
|
|
1836
|
+
rad: b.panelRadius
|
|
1837
|
+
};
|
|
1838
|
+
return /* @__PURE__ */ s(Ut, {
|
|
1839
|
+
look: m,
|
|
1840
|
+
pinned: d,
|
|
1841
|
+
onClose: () => u(!1),
|
|
1842
|
+
children: /* @__PURE__ */ s(mt, {
|
|
1843
|
+
payload: e,
|
|
1844
|
+
config: t,
|
|
1845
|
+
look: n,
|
|
1846
|
+
chat: r,
|
|
1847
|
+
focus: i,
|
|
1848
|
+
onCta: c,
|
|
1849
|
+
mobile: !0,
|
|
1850
|
+
fill: !0,
|
|
1851
|
+
onClose: p
|
|
1852
|
+
})
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
return /* @__PURE__ */ s(U, { children: [a && /* @__PURE__ */ s("div", {
|
|
1856
|
+
class: "uq-fixed uq-rise",
|
|
1857
|
+
style: {
|
|
1858
|
+
bottom: l + b.launcherSize + b.panelGap,
|
|
1859
|
+
width: b.panelWidth,
|
|
1860
|
+
...h
|
|
1861
|
+
},
|
|
1862
|
+
children: /* @__PURE__ */ s(mt, {
|
|
1863
|
+
payload: e,
|
|
1864
|
+
config: t,
|
|
1865
|
+
look: n,
|
|
1866
|
+
chat: r,
|
|
1867
|
+
focus: i,
|
|
1868
|
+
onCta: c,
|
|
1869
|
+
mobile: !1,
|
|
1870
|
+
onMinimize: p,
|
|
1871
|
+
onClose: p
|
|
1872
|
+
})
|
|
1873
|
+
}), /* @__PURE__ */ s("button", {
|
|
1874
|
+
type: "button",
|
|
1875
|
+
class: k(t, "launcher", "uq-fixed"),
|
|
1876
|
+
"aria-label": a ? "Close chat" : "Open chat",
|
|
1877
|
+
"aria-expanded": a,
|
|
1878
|
+
onClick: () => {
|
|
1879
|
+
a && d || u(!a);
|
|
1880
|
+
},
|
|
1881
|
+
style: {
|
|
1882
|
+
bottom: l,
|
|
1883
|
+
...X(b.launcherSize, { boxShadow: b.launcherShadow }),
|
|
1884
|
+
...h
|
|
1885
|
+
},
|
|
1886
|
+
children: [/* @__PURE__ */ s(Je, {
|
|
1887
|
+
payload: e,
|
|
1888
|
+
size: b.launcherSize,
|
|
1889
|
+
font: 16,
|
|
1890
|
+
palette: f,
|
|
1891
|
+
fallback: {
|
|
1892
|
+
background: b.gradient,
|
|
1893
|
+
color: "#fff"
|
|
1894
|
+
}
|
|
1895
|
+
}), a ? /* @__PURE__ */ s("span", {
|
|
1896
|
+
style: {
|
|
1897
|
+
position: "absolute",
|
|
1898
|
+
inset: 0,
|
|
1899
|
+
borderRadius: "50%",
|
|
1900
|
+
background: "rgba(0,0,0,.45)",
|
|
1901
|
+
display: "flex",
|
|
1902
|
+
alignItems: "center",
|
|
1903
|
+
justifyContent: "center",
|
|
1904
|
+
color: "#fff"
|
|
1905
|
+
},
|
|
1906
|
+
children: /* @__PURE__ */ s(Yt, { size: 28 })
|
|
1907
|
+
}) : /* @__PURE__ */ s("span", {
|
|
1908
|
+
style: {
|
|
1909
|
+
position: "absolute",
|
|
1910
|
+
right: -4,
|
|
1911
|
+
bottom: -4,
|
|
1912
|
+
...X(b.badgeSize, {
|
|
1913
|
+
background: b.accent,
|
|
1914
|
+
color: "#fff",
|
|
1915
|
+
boxShadow: `0 0 0 2px ${f.surface}`
|
|
1916
|
+
})
|
|
1917
|
+
},
|
|
1918
|
+
children: /* @__PURE__ */ s(Gn, {
|
|
1919
|
+
size: 12,
|
|
1920
|
+
d: b.logo
|
|
1921
|
+
})
|
|
1922
|
+
})]
|
|
1923
|
+
})] });
|
|
1924
|
+
}
|
|
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;
|
|
1927
|
+
return /* @__PURE__ */ s("div", {
|
|
1928
|
+
class: k(o, t ? "userMessage" : "botMessage", "uq-rise"),
|
|
1929
|
+
style: {
|
|
1930
|
+
alignSelf: t ? "flex-end" : "flex-start",
|
|
1931
|
+
maxWidth: t ? "78%" : "84%",
|
|
1932
|
+
padding: "8px 10px",
|
|
1933
|
+
borderRadius: f,
|
|
1934
|
+
background: t ? d : u ? "rgba(10,12,18,.42)" : `rgba(${a},${n ? 0.1 : 0.06})`,
|
|
1935
|
+
color: t ? c : u ? "#fff" : `rgb(${a})`,
|
|
1936
|
+
backdropFilter: !t && u ? "blur(6px)" : void 0,
|
|
1937
|
+
fontSize: 12,
|
|
1938
|
+
lineHeight: 1.45,
|
|
1939
|
+
textShadow: !t && u ? "0 1px 2px rgba(0,0,0,.5)" : void 0,
|
|
1940
|
+
whiteSpace: "pre-wrap",
|
|
1941
|
+
overflowWrap: "anywhere"
|
|
1942
|
+
},
|
|
1943
|
+
children: i != null ? i : e
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
var sr = (e) => /* @__PURE__ */ s(te, {
|
|
1947
|
+
mine: !1,
|
|
1948
|
+
...e,
|
|
1949
|
+
children: /* @__PURE__ */ s("span", {
|
|
1950
|
+
class: "uq-dots",
|
|
1951
|
+
"aria-label": "Typing",
|
|
1952
|
+
children: [
|
|
1953
|
+
/* @__PURE__ */ s("span", {}),
|
|
1954
|
+
/* @__PURE__ */ s("span", {}),
|
|
1955
|
+
/* @__PURE__ */ s("span", {})
|
|
1956
|
+
]
|
|
1957
|
+
})
|
|
1958
|
+
});
|
|
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 }) {
|
|
2049
|
+
var r;
|
|
2050
|
+
const o = !((r = e.cta) === null || r === void 0 || (r = r.href) === null || r === void 0) && r.trim() ? e.cta : null;
|
|
2051
|
+
return o ? /* @__PURE__ */ s("a", {
|
|
2052
|
+
class: "uq-cta",
|
|
2053
|
+
href: o.href,
|
|
2054
|
+
target: "_blank",
|
|
2055
|
+
rel: "noopener noreferrer",
|
|
2056
|
+
onClick: n,
|
|
2057
|
+
style: {
|
|
2058
|
+
display: "flex",
|
|
2059
|
+
alignItems: "center",
|
|
2060
|
+
justifyContent: "center",
|
|
2061
|
+
padding: "9px 12px",
|
|
2062
|
+
borderRadius: t.rad,
|
|
2063
|
+
background: t.accentFill,
|
|
2064
|
+
color: t.accentText,
|
|
2065
|
+
fontSize: 12,
|
|
2066
|
+
fontWeight: 500
|
|
2067
|
+
},
|
|
2068
|
+
children: o.label || "Learn more"
|
|
2069
|
+
}) : null;
|
|
2070
|
+
}
|
|
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);
|
|
2073
|
+
P(() => {
|
|
2074
|
+
var y;
|
|
2075
|
+
a > 0 && ((y = x.current) === null || y === void 0 || y.focus());
|
|
2076
|
+
}, [a]);
|
|
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})`;
|
|
2080
|
+
return /* @__PURE__ */ s("form", {
|
|
2081
|
+
class: k(e, "composer"),
|
|
2082
|
+
onSubmit: _,
|
|
2083
|
+
style: {
|
|
2084
|
+
display: "flex",
|
|
2085
|
+
alignItems: "center",
|
|
2086
|
+
gap: 8,
|
|
2087
|
+
padding: "7px 8px 7px 11px",
|
|
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
|
|
2092
|
+
},
|
|
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
|
+
]
|
|
2160
|
+
});
|
|
2161
|
+
}
|
|
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, {
|
|
2166
|
+
text: e,
|
|
2167
|
+
mine: !1,
|
|
2168
|
+
onDark: n,
|
|
2169
|
+
look: r,
|
|
2170
|
+
config: o
|
|
2171
|
+
}),
|
|
2172
|
+
t.turns.map((a) => a.role === "user" ? /* @__PURE__ */ s(te, {
|
|
2173
|
+
text: a.parts[0],
|
|
2174
|
+
mine: !0,
|
|
2175
|
+
onDark: n,
|
|
2176
|
+
look: r,
|
|
2177
|
+
config: o
|
|
2178
|
+
}, a.id) : a.parts.slice(0, a.shown).map((u, d) => /* @__PURE__ */ s(te, {
|
|
2179
|
+
text: u,
|
|
2180
|
+
mine: !1,
|
|
2181
|
+
onDark: n,
|
|
2182
|
+
look: r,
|
|
2183
|
+
config: o
|
|
2184
|
+
}, `${a.id}:${d}`))),
|
|
2185
|
+
/* @__PURE__ */ s(ar, {
|
|
2186
|
+
chat: t,
|
|
2187
|
+
onDark: n,
|
|
2188
|
+
look: r,
|
|
2189
|
+
config: o
|
|
2190
|
+
}),
|
|
2191
|
+
t.busy && /* @__PURE__ */ s(sr, {
|
|
2192
|
+
onDark: n,
|
|
2193
|
+
look: r,
|
|
2194
|
+
config: o
|
|
2195
|
+
}),
|
|
2196
|
+
t.error && /* @__PURE__ */ s("div", {
|
|
2197
|
+
class: "uq-error uq-fade",
|
|
2198
|
+
style: {
|
|
2199
|
+
alignSelf: "flex-start",
|
|
2200
|
+
display: "flex",
|
|
2201
|
+
gap: 8,
|
|
2202
|
+
fontSize: 11.5,
|
|
2203
|
+
color: r.isGlass ? "rgba(255,255,255,.8)" : `rgba(${i},.6)`,
|
|
2204
|
+
textShadow: r.isGlass ? "0 1px 2px rgba(0,0,0,.5)" : void 0
|
|
2205
|
+
},
|
|
2206
|
+
children: [/* @__PURE__ */ s("span", { children: t.error }), /* @__PURE__ */ s("button", {
|
|
2207
|
+
type: "button",
|
|
2208
|
+
onClick: t.retry,
|
|
2209
|
+
style: {
|
|
2210
|
+
color: r.isGlass ? "#fff" : r.accent,
|
|
2211
|
+
fontWeight: 500,
|
|
2212
|
+
textDecoration: "underline"
|
|
2213
|
+
},
|
|
2214
|
+
children: "Retry"
|
|
2215
|
+
})]
|
|
2216
|
+
})
|
|
2217
|
+
] });
|
|
2218
|
+
}
|
|
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([
|
|
2222
|
+
r.turns,
|
|
2223
|
+
r.busy,
|
|
2224
|
+
r.error,
|
|
2225
|
+
r.stopping
|
|
2226
|
+
]), w = !!(!((l = e.agent) === null || l === void 0) && l.live);
|
|
2227
|
+
return /* @__PURE__ */ s("div", {
|
|
2228
|
+
class: k(t, "panel"),
|
|
2229
|
+
style: {
|
|
2230
|
+
width: "100%",
|
|
2231
|
+
borderRadius: d ? 0 : g,
|
|
2232
|
+
overflow: "hidden",
|
|
2233
|
+
border: d ? void 0 : `1px solid rgba(${p},.12)`,
|
|
2234
|
+
boxShadow: o ? "0 18px 44px rgba(0,0,0,.16)" : void 0,
|
|
2235
|
+
background: m,
|
|
2236
|
+
...d ? {
|
|
2237
|
+
flex: 1,
|
|
2238
|
+
minHeight: 0,
|
|
2239
|
+
display: "flex",
|
|
2240
|
+
flexDirection: "column"
|
|
2241
|
+
} : {}
|
|
2242
|
+
},
|
|
2243
|
+
children: [
|
|
2244
|
+
/* @__PURE__ */ s("div", {
|
|
2245
|
+
class: k(t, "header"),
|
|
2246
|
+
style: {
|
|
2247
|
+
display: "flex",
|
|
2248
|
+
alignItems: "center",
|
|
2249
|
+
gap: 8,
|
|
2250
|
+
padding: "10px 12px",
|
|
2251
|
+
background: v,
|
|
2252
|
+
color: _
|
|
2253
|
+
},
|
|
2254
|
+
children: [
|
|
2255
|
+
/* @__PURE__ */ s("span", {
|
|
2256
|
+
style: {
|
|
2257
|
+
width: 20,
|
|
2258
|
+
height: 20,
|
|
2259
|
+
borderRadius: "50%",
|
|
2260
|
+
background: "rgba(255,255,255,.25)",
|
|
2261
|
+
display: "flex",
|
|
2262
|
+
alignItems: "center",
|
|
2263
|
+
justifyContent: "center",
|
|
2264
|
+
fontSize: 10,
|
|
2265
|
+
fontWeight: 600,
|
|
2266
|
+
color: _
|
|
2267
|
+
},
|
|
2268
|
+
children: $
|
|
2269
|
+
}),
|
|
2270
|
+
/* @__PURE__ */ s("span", {
|
|
2271
|
+
style: {
|
|
2272
|
+
fontSize: 12,
|
|
2273
|
+
fontWeight: 500
|
|
2274
|
+
},
|
|
2275
|
+
children: y ? y.split("—")[0].trim() : "Chat"
|
|
2276
|
+
}),
|
|
2277
|
+
/* @__PURE__ */ s("span", {
|
|
2278
|
+
style: {
|
|
2279
|
+
marginLeft: "auto",
|
|
2280
|
+
fontSize: 10,
|
|
2281
|
+
opacity: 0.8
|
|
2282
|
+
},
|
|
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 })
|
|
2304
|
+
}),
|
|
2305
|
+
c && /* @__PURE__ */ s("button", {
|
|
2306
|
+
type: "button",
|
|
2307
|
+
class: k(t, "close"),
|
|
2308
|
+
onClick: c,
|
|
2309
|
+
"aria-label": "Close chat",
|
|
2310
|
+
style: {
|
|
2311
|
+
width: 28,
|
|
2312
|
+
height: 28,
|
|
2313
|
+
marginRight: -6,
|
|
2314
|
+
borderRadius: "50%",
|
|
2315
|
+
display: "flex",
|
|
2316
|
+
alignItems: "center",
|
|
2317
|
+
justifyContent: "center",
|
|
2318
|
+
color: _,
|
|
2319
|
+
flexShrink: 0
|
|
2320
|
+
},
|
|
2321
|
+
children: /* @__PURE__ */ s($e, { size: 16 })
|
|
2322
|
+
})
|
|
2323
|
+
]
|
|
2324
|
+
}),
|
|
2325
|
+
/* @__PURE__ */ s("div", {
|
|
2326
|
+
ref: A,
|
|
2327
|
+
style: {
|
|
2328
|
+
display: "flex",
|
|
2329
|
+
flexDirection: "column",
|
|
2330
|
+
gap: 7,
|
|
2331
|
+
padding: 12,
|
|
2332
|
+
background: m,
|
|
2333
|
+
maxHeight: d ? void 0 : "min(58vh, 380px)",
|
|
2334
|
+
flex: d ? 1 : void 0,
|
|
2335
|
+
minHeight: d ? 0 : void 0,
|
|
2336
|
+
overflowY: "auto",
|
|
2337
|
+
overscrollBehavior: "contain"
|
|
2338
|
+
},
|
|
2339
|
+
children: /* @__PURE__ */ s(Ze, {
|
|
2340
|
+
welcome: C,
|
|
2341
|
+
chat: r,
|
|
2342
|
+
onDark: x,
|
|
2343
|
+
look: n,
|
|
2344
|
+
config: t
|
|
2345
|
+
})
|
|
2346
|
+
}),
|
|
2347
|
+
/* @__PURE__ */ s("div", {
|
|
2348
|
+
style: {
|
|
2349
|
+
display: "flex",
|
|
2350
|
+
flexDirection: "column",
|
|
2351
|
+
gap: 8,
|
|
2352
|
+
padding: "0 12px 12px",
|
|
2353
|
+
background: m
|
|
2354
|
+
},
|
|
2355
|
+
children: [/* @__PURE__ */ s(Xt, {
|
|
2356
|
+
config: t,
|
|
2357
|
+
look: n,
|
|
2358
|
+
onClick: u
|
|
2359
|
+
}), /* @__PURE__ */ s(Jt, {
|
|
2360
|
+
config: t,
|
|
2361
|
+
look: n,
|
|
2362
|
+
onDark: x,
|
|
2363
|
+
hint: i,
|
|
2364
|
+
chat: r,
|
|
2365
|
+
disabled: !w,
|
|
2366
|
+
focus: a
|
|
2367
|
+
})]
|
|
2368
|
+
})
|
|
2369
|
+
]
|
|
2370
|
+
});
|
|
2371
|
+
}
|
|
2372
|
+
function lr({ payload: e, look: t, api: n, embed: r, page: o, reporter: i, open: a, setOpen: u, pinned: d, focus: c }) {
|
|
2373
|
+
var f;
|
|
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;
|
|
2376
|
+
return i.report("cta.clicked", {
|
|
2377
|
+
widgetId: e.id,
|
|
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 }
|
|
2380
|
+
});
|
|
2381
|
+
};
|
|
2382
|
+
if (t.isMessenger) return /* @__PURE__ */ s(or, {
|
|
2383
|
+
payload: e,
|
|
2384
|
+
config: h,
|
|
2385
|
+
look: t,
|
|
2386
|
+
chat: l,
|
|
2387
|
+
mobile: y,
|
|
2388
|
+
focus: c,
|
|
2389
|
+
open: a,
|
|
2390
|
+
setOpen: u,
|
|
2391
|
+
pinned: d,
|
|
2392
|
+
onCta: A
|
|
2393
|
+
});
|
|
2394
|
+
if (h.variant === "bubble")
|
|
2395
|
+
return a && y ? /* @__PURE__ */ s(Ut, {
|
|
2396
|
+
look: t,
|
|
2397
|
+
pinned: d,
|
|
2398
|
+
onClose: () => u(!1),
|
|
2399
|
+
children: /* @__PURE__ */ s(Ee, {
|
|
2400
|
+
payload: e,
|
|
2401
|
+
config: h,
|
|
2402
|
+
look: t,
|
|
2403
|
+
chat: l,
|
|
2404
|
+
shadow: !1,
|
|
2405
|
+
hint: p,
|
|
2406
|
+
focus: c,
|
|
2407
|
+
onCta: A,
|
|
2408
|
+
fill: !0,
|
|
2409
|
+
onClose: d ? void 0 : () => u(!1)
|
|
2410
|
+
})
|
|
2411
|
+
}) : /* @__PURE__ */ s(U, { children: [a && /* @__PURE__ */ s("div", {
|
|
2412
|
+
class: "uq-fixed uq-rise",
|
|
2413
|
+
style: {
|
|
2414
|
+
bottom: g + 54,
|
|
2415
|
+
width: 296,
|
|
2416
|
+
..._
|
|
2417
|
+
},
|
|
2418
|
+
children: /* @__PURE__ */ s(Ee, {
|
|
2419
|
+
payload: e,
|
|
2420
|
+
config: h,
|
|
2421
|
+
look: t,
|
|
2422
|
+
chat: l,
|
|
2423
|
+
shadow: !0,
|
|
2424
|
+
hint: p,
|
|
2425
|
+
focus: c,
|
|
2426
|
+
onCta: A
|
|
2427
|
+
})
|
|
2428
|
+
}), /* @__PURE__ */ s("button", {
|
|
2429
|
+
type: "button",
|
|
2430
|
+
class: k(h, "launcher", "uq-fixed"),
|
|
2431
|
+
"aria-label": a ? "Close chat" : "Open chat",
|
|
2432
|
+
"aria-expanded": a,
|
|
2433
|
+
onClick: () => {
|
|
2434
|
+
a && d || u(!a);
|
|
2435
|
+
},
|
|
2436
|
+
style: {
|
|
2437
|
+
bottom: g,
|
|
2438
|
+
width: 44,
|
|
2439
|
+
height: 44,
|
|
2440
|
+
borderRadius: Math.min(22, v * 2),
|
|
2441
|
+
background: m,
|
|
2442
|
+
color: x,
|
|
2443
|
+
display: "flex",
|
|
2444
|
+
alignItems: "center",
|
|
2445
|
+
justifyContent: "center",
|
|
2446
|
+
boxShadow: "0 10px 26px rgba(0,0,0,.24)",
|
|
2447
|
+
..._
|
|
2448
|
+
},
|
|
2449
|
+
children: /* @__PURE__ */ s(Nt, { size: 20 })
|
|
2450
|
+
})] });
|
|
2451
|
+
if (h.variant === "box") return /* @__PURE__ */ s("div", {
|
|
2452
|
+
class: "uq-inline",
|
|
2453
|
+
children: /* @__PURE__ */ s(Ee, {
|
|
2454
|
+
payload: e,
|
|
2455
|
+
config: h,
|
|
2456
|
+
look: t,
|
|
2457
|
+
chat: l,
|
|
2458
|
+
shadow: !1,
|
|
2459
|
+
hint: p,
|
|
2460
|
+
focus: c,
|
|
2461
|
+
onCta: A
|
|
2462
|
+
})
|
|
2463
|
+
});
|
|
2464
|
+
const w = {
|
|
2465
|
+
payload: e,
|
|
2466
|
+
config: h,
|
|
2467
|
+
look: t,
|
|
2468
|
+
chat: l,
|
|
2469
|
+
hint: p,
|
|
2470
|
+
mobile: y,
|
|
2471
|
+
focus: c,
|
|
2472
|
+
live: $,
|
|
2473
|
+
welcome: C,
|
|
2474
|
+
onCta: A
|
|
2475
|
+
};
|
|
2476
|
+
return h.variant === "chatbar" ? /* @__PURE__ */ s(cr, { ...w }) : /* @__PURE__ */ s(ur, { ...w });
|
|
2477
|
+
}
|
|
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([
|
|
2480
|
+
n.turns,
|
|
2481
|
+
n.busy,
|
|
2482
|
+
n.error,
|
|
2483
|
+
n.stopping
|
|
2484
|
+
]), m = n.turns.length > 0 || n.stopping !== null, x = !a || n.stopping !== null;
|
|
2485
|
+
return /* @__PURE__ */ s("div", {
|
|
2486
|
+
class: k(e, "panel", "uq-fixed"),
|
|
2487
|
+
style: {
|
|
2488
|
+
left: 0,
|
|
2489
|
+
right: 0,
|
|
2490
|
+
bottom: 0,
|
|
2491
|
+
padding: "10px 12px",
|
|
2492
|
+
background: c ? "rgba(24,27,34,.97)" : "rgba(255,255,255,.97)",
|
|
2493
|
+
borderTop: `1px solid rgba(${d},.12)`,
|
|
2494
|
+
display: "flex",
|
|
2495
|
+
flexDirection: "column",
|
|
2496
|
+
gap: 10,
|
|
2497
|
+
boxShadow: "0 -10px 30px rgba(0,0,0,.12)"
|
|
2498
|
+
},
|
|
2499
|
+
children: [m && /* @__PURE__ */ s("div", {
|
|
2500
|
+
ref: p,
|
|
2501
|
+
style: {
|
|
2502
|
+
display: "flex",
|
|
2503
|
+
flexDirection: "column",
|
|
2504
|
+
gap: 7,
|
|
2505
|
+
maxHeight: "min(50vh, 320px)",
|
|
2506
|
+
overflowY: "auto"
|
|
2507
|
+
},
|
|
2508
|
+
children: /* @__PURE__ */ s(Ze, {
|
|
2509
|
+
welcome: u,
|
|
2510
|
+
chat: n,
|
|
2511
|
+
onDark: c,
|
|
2512
|
+
look: t,
|
|
2513
|
+
config: e
|
|
2514
|
+
})
|
|
2515
|
+
}), /* @__PURE__ */ s("div", {
|
|
2516
|
+
style: {
|
|
2517
|
+
display: "flex",
|
|
2518
|
+
alignItems: "center",
|
|
2519
|
+
gap: 10
|
|
2520
|
+
},
|
|
2521
|
+
children: [
|
|
2522
|
+
/* @__PURE__ */ s("span", {
|
|
2523
|
+
class: k(e, "launcher"),
|
|
2524
|
+
style: {
|
|
2525
|
+
width: 26,
|
|
2526
|
+
height: 26,
|
|
2527
|
+
borderRadius: l,
|
|
2528
|
+
background: f,
|
|
2529
|
+
color: h,
|
|
2530
|
+
display: "flex",
|
|
2531
|
+
alignItems: "center",
|
|
2532
|
+
justifyContent: "center",
|
|
2533
|
+
flexShrink: 0
|
|
2534
|
+
},
|
|
2535
|
+
children: /* @__PURE__ */ s(Nt, { size: 14 })
|
|
2536
|
+
}),
|
|
2537
|
+
/* @__PURE__ */ s("span", {
|
|
2538
|
+
class: k(e, "botMessage"),
|
|
2539
|
+
style: {
|
|
2540
|
+
flex: 1,
|
|
2541
|
+
minWidth: 0,
|
|
2542
|
+
fontSize: 12,
|
|
2543
|
+
color: `rgb(${d})`,
|
|
2544
|
+
overflow: "hidden",
|
|
2545
|
+
whiteSpace: "nowrap",
|
|
2546
|
+
textOverflow: "ellipsis"
|
|
2547
|
+
},
|
|
2548
|
+
children: u
|
|
2549
|
+
}),
|
|
2550
|
+
/* @__PURE__ */ s("form", {
|
|
2551
|
+
class: k(e, "composer"),
|
|
2552
|
+
onSubmit: (v) => {
|
|
2553
|
+
v.preventDefault();
|
|
2554
|
+
const _ = v.currentTarget.elements.namedItem("message");
|
|
2555
|
+
!_ || x || (n.send(_.value), _.value = "");
|
|
2556
|
+
},
|
|
2557
|
+
style: {
|
|
2558
|
+
display: "flex",
|
|
2559
|
+
alignItems: "center",
|
|
2560
|
+
gap: 8,
|
|
2561
|
+
flexShrink: 0,
|
|
2562
|
+
padding: "6px 8px 6px 11px",
|
|
2563
|
+
borderRadius: l,
|
|
2564
|
+
border: `1px solid rgba(${d},.14)`,
|
|
2565
|
+
minWidth: o ? 0 : 220
|
|
2566
|
+
},
|
|
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
|
+
]
|
|
2618
|
+
})
|
|
2619
|
+
]
|
|
2620
|
+
})]
|
|
2621
|
+
});
|
|
2622
|
+
}
|
|
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([
|
|
2625
|
+
n.turns,
|
|
2626
|
+
n.busy,
|
|
2627
|
+
n.error,
|
|
2628
|
+
n.stopping
|
|
2629
|
+
]);
|
|
2630
|
+
return /* @__PURE__ */ s("div", {
|
|
2631
|
+
class: k(e, "panel", "uq-fixed"),
|
|
2632
|
+
style: {
|
|
2633
|
+
bottom: h,
|
|
2634
|
+
width: o ? `calc(100% - ${e.appearance.offsetX * 2}px)` : 320,
|
|
2635
|
+
display: "flex",
|
|
2636
|
+
flexDirection: "column",
|
|
2637
|
+
gap: 7,
|
|
2638
|
+
...f
|
|
2639
|
+
},
|
|
2640
|
+
children: [
|
|
2641
|
+
/* @__PURE__ */ s("div", {
|
|
2642
|
+
ref: p,
|
|
2643
|
+
style: {
|
|
2644
|
+
display: "flex",
|
|
2645
|
+
flexDirection: "column",
|
|
2646
|
+
gap: 7,
|
|
2647
|
+
maxHeight: "min(60vh, 420px)",
|
|
2648
|
+
overflowY: "auto"
|
|
2649
|
+
},
|
|
2650
|
+
children: /* @__PURE__ */ s(Ze, {
|
|
2651
|
+
welcome: u,
|
|
2652
|
+
chat: n,
|
|
2653
|
+
onDark: l,
|
|
2654
|
+
look: t,
|
|
2655
|
+
config: e
|
|
2656
|
+
})
|
|
2657
|
+
}),
|
|
2658
|
+
/* @__PURE__ */ s(Xt, {
|
|
2659
|
+
config: e,
|
|
2660
|
+
look: t,
|
|
2661
|
+
onClick: d
|
|
2662
|
+
}),
|
|
2663
|
+
/* @__PURE__ */ s(Jt, {
|
|
2664
|
+
config: e,
|
|
2665
|
+
look: t,
|
|
2666
|
+
onDark: l,
|
|
2667
|
+
hint: r,
|
|
2668
|
+
chat: n,
|
|
2669
|
+
disabled: !a,
|
|
2670
|
+
focus: i,
|
|
2671
|
+
withStop: !0
|
|
2672
|
+
})
|
|
2673
|
+
]
|
|
2674
|
+
});
|
|
2675
|
+
}
|
|
2676
|
+
var dr = (e) => /^https?:\/\//i.test(e);
|
|
2677
|
+
function fr({ config: e, block: t, index: n, look: r, onCta: o }) {
|
|
2678
|
+
const { ink: i, accent: a, accentFill: u, accentText: d, rad: c } = r, f = [
|
|
2679
|
+
"uq-block",
|
|
2680
|
+
`uq-block-${t.kind}`,
|
|
2681
|
+
t.cssClass.trim()
|
|
2682
|
+
].filter(Boolean).join(" "), h = "align" in t ? t.align : "center", l = {
|
|
2683
|
+
class: f,
|
|
2684
|
+
"data-uq-block": n
|
|
2685
|
+
};
|
|
2686
|
+
switch (t.kind) {
|
|
2687
|
+
case "headline":
|
|
2688
|
+
return /* @__PURE__ */ s("div", {
|
|
2689
|
+
...l,
|
|
2690
|
+
style: {
|
|
2691
|
+
fontFamily: "var(--font-display, inherit)",
|
|
2692
|
+
fontSize: t.size === "lg" ? 21 : t.size === "sm" ? 15 : 18,
|
|
2693
|
+
fontWeight: 600,
|
|
2694
|
+
letterSpacing: "-0.02em",
|
|
2695
|
+
textAlign: h,
|
|
2696
|
+
color: t.color || `rgb(${i})`
|
|
2697
|
+
},
|
|
2698
|
+
children: t.text
|
|
2699
|
+
});
|
|
2700
|
+
case "text":
|
|
2701
|
+
return /* @__PURE__ */ s("div", {
|
|
2702
|
+
...l,
|
|
2703
|
+
style: {
|
|
2704
|
+
fontSize: 12.5,
|
|
2705
|
+
lineHeight: 1.5,
|
|
2706
|
+
textAlign: h,
|
|
2707
|
+
color: t.color || `rgba(${i},.65)`,
|
|
2708
|
+
whiteSpace: "pre-wrap"
|
|
2709
|
+
},
|
|
2710
|
+
children: t.text
|
|
2711
|
+
});
|
|
2712
|
+
case "media":
|
|
2713
|
+
return !t.src || !dr(t.src) ? null : t.mediaType === "video" ? /* @__PURE__ */ s("video", {
|
|
2714
|
+
...l,
|
|
2715
|
+
src: t.src,
|
|
2716
|
+
muted: !0,
|
|
2717
|
+
loop: !0,
|
|
2718
|
+
autoPlay: !0,
|
|
2719
|
+
playsInline: !0,
|
|
2720
|
+
style: {
|
|
2721
|
+
width: "100%",
|
|
2722
|
+
maxHeight: 200,
|
|
2723
|
+
objectFit: "cover",
|
|
2724
|
+
borderRadius: c,
|
|
2725
|
+
background: "#000"
|
|
2726
|
+
}
|
|
2727
|
+
}) : /* @__PURE__ */ s("img", {
|
|
2728
|
+
...l,
|
|
2729
|
+
src: t.src,
|
|
2730
|
+
alt: t.alt || "",
|
|
2731
|
+
style: {
|
|
2732
|
+
width: "100%",
|
|
2733
|
+
maxHeight: 200,
|
|
2734
|
+
objectFit: "cover",
|
|
2735
|
+
borderRadius: c
|
|
2736
|
+
}
|
|
2737
|
+
});
|
|
2738
|
+
case "quote":
|
|
2739
|
+
return /* @__PURE__ */ s("div", {
|
|
2740
|
+
...l,
|
|
2741
|
+
style: { textAlign: "center" },
|
|
2742
|
+
children: [/* @__PURE__ */ s("div", {
|
|
2743
|
+
style: {
|
|
2744
|
+
fontSize: 13,
|
|
2745
|
+
fontStyle: "italic",
|
|
2746
|
+
color: `rgb(${i})`
|
|
2747
|
+
},
|
|
2748
|
+
children: [
|
|
2749
|
+
"“",
|
|
2750
|
+
t.text,
|
|
2751
|
+
"”"
|
|
2752
|
+
]
|
|
2753
|
+
}), /* @__PURE__ */ s("div", {
|
|
2754
|
+
style: {
|
|
2755
|
+
fontSize: 11,
|
|
2756
|
+
color: `rgba(${i},.55)`,
|
|
2757
|
+
marginTop: 4
|
|
2758
|
+
},
|
|
2759
|
+
children: t.author
|
|
2760
|
+
})]
|
|
2761
|
+
});
|
|
2762
|
+
case "cta":
|
|
2763
|
+
return /* @__PURE__ */ s("a", {
|
|
2764
|
+
...l,
|
|
2765
|
+
class: `${k(e, "cta")} ${f}`,
|
|
2766
|
+
href: t.href || "#",
|
|
2767
|
+
target: t.newTab ? "_blank" : void 0,
|
|
2768
|
+
rel: t.newTab ? "noopener noreferrer" : void 0,
|
|
2769
|
+
onClick: () => o(t.href),
|
|
2770
|
+
style: {
|
|
2771
|
+
display: "block",
|
|
2772
|
+
marginTop: 4,
|
|
2773
|
+
padding: "10px 14px",
|
|
2774
|
+
borderRadius: c,
|
|
2775
|
+
background: t.style === "outline" ? "transparent" : u,
|
|
2776
|
+
border: t.style === "outline" ? `1px solid ${a}` : void 0,
|
|
2777
|
+
color: t.style === "outline" ? a : d,
|
|
2778
|
+
fontSize: 13,
|
|
2779
|
+
fontWeight: 500,
|
|
2780
|
+
textAlign: "center"
|
|
2781
|
+
},
|
|
2782
|
+
children: t.label
|
|
2783
|
+
});
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
function pr({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }) {
|
|
2787
|
+
const a = e.config, { ink: u, surfaceBg: d, rad: c } = t;
|
|
2788
|
+
if (!r) return null;
|
|
2789
|
+
const f = () => {
|
|
2790
|
+
i || o(!1);
|
|
2791
|
+
}, h = (l) => n.report("cta.clicked", {
|
|
2792
|
+
widgetId: e.id,
|
|
2793
|
+
payload: { href: l }
|
|
2794
|
+
});
|
|
2795
|
+
return /* @__PURE__ */ s("div", {
|
|
2796
|
+
class: k(a, "scrim", "uq-fixed uq-fade"),
|
|
2797
|
+
onClick: f,
|
|
2798
|
+
style: {
|
|
2799
|
+
inset: 0,
|
|
2800
|
+
background: "rgba(8,10,16,.5)",
|
|
2801
|
+
display: "flex",
|
|
2802
|
+
alignItems: "center",
|
|
2803
|
+
justifyContent: "center",
|
|
2804
|
+
padding: 24
|
|
2805
|
+
},
|
|
2806
|
+
children: /* @__PURE__ */ s("div", {
|
|
2807
|
+
class: k(a, "card", "uq-rise"),
|
|
2808
|
+
role: "dialog",
|
|
2809
|
+
"aria-modal": "true",
|
|
2810
|
+
onClick: (l) => l.stopPropagation(),
|
|
2811
|
+
style: {
|
|
2812
|
+
position: "relative",
|
|
2813
|
+
width: "100%",
|
|
2814
|
+
maxWidth: 340,
|
|
2815
|
+
maxHeight: "calc(100vh - 48px)",
|
|
2816
|
+
overflowY: "auto",
|
|
2817
|
+
background: d,
|
|
2818
|
+
borderRadius: c,
|
|
2819
|
+
padding: "22px 20px",
|
|
2820
|
+
boxShadow: "0 24px 60px rgba(0,0,0,.3)",
|
|
2821
|
+
display: "flex",
|
|
2822
|
+
flexDirection: "column",
|
|
2823
|
+
gap: 10,
|
|
2824
|
+
textAlign: "center",
|
|
2825
|
+
color: `rgb(${u})`
|
|
2826
|
+
},
|
|
2827
|
+
children: [!i && /* @__PURE__ */ s("button", {
|
|
2828
|
+
type: "button",
|
|
2829
|
+
class: k(a, "close"),
|
|
2830
|
+
onClick: f,
|
|
2831
|
+
"aria-label": "Close",
|
|
2832
|
+
style: {
|
|
2833
|
+
position: "absolute",
|
|
2834
|
+
top: 8,
|
|
2835
|
+
right: 8,
|
|
2836
|
+
width: 24,
|
|
2837
|
+
height: 24,
|
|
2838
|
+
borderRadius: "50%",
|
|
2839
|
+
display: "flex",
|
|
2840
|
+
alignItems: "center",
|
|
2841
|
+
justifyContent: "center",
|
|
2842
|
+
color: `rgba(${u},.55)`
|
|
2843
|
+
},
|
|
2844
|
+
children: /* @__PURE__ */ s($e, { size: 14 })
|
|
2845
|
+
}), a.blocks.map((l, p) => /* @__PURE__ */ s(fr, {
|
|
2846
|
+
config: a,
|
|
2847
|
+
block: l,
|
|
2848
|
+
index: p,
|
|
2849
|
+
look: t,
|
|
2850
|
+
onCta: h
|
|
2851
|
+
}, p))]
|
|
2852
|
+
})
|
|
2853
|
+
});
|
|
2854
|
+
}
|
|
2855
|
+
var hr = 3600;
|
|
2856
|
+
function _r({ payload: e, look: t, open: n }) {
|
|
2857
|
+
const r = e.config, { ink: o, accent: i, surfaceBg: a, rad: u } = t, d = r.quotes, [c, f] = E(0);
|
|
2858
|
+
if (P(() => {
|
|
2859
|
+
if (d.length < 2) return;
|
|
2860
|
+
const p = window.setInterval(() => f((m) => m + 1), hr);
|
|
2861
|
+
return () => window.clearInterval(p);
|
|
2862
|
+
}, [d.length]), !n || d.length === 0) return null;
|
|
2863
|
+
const h = c % d.length, l = d[h];
|
|
2864
|
+
return /* @__PURE__ */ s("div", {
|
|
2865
|
+
class: "uq-fixed uq-fade",
|
|
2866
|
+
style: {
|
|
2867
|
+
left: 0,
|
|
2868
|
+
right: 0,
|
|
2869
|
+
bottom: 0,
|
|
2870
|
+
display: "flex",
|
|
2871
|
+
justifyContent: "center",
|
|
2872
|
+
padding: 24,
|
|
2873
|
+
pointerEvents: "none"
|
|
2874
|
+
},
|
|
2875
|
+
children: /* @__PURE__ */ s("figure", {
|
|
2876
|
+
class: k(r, "frame"),
|
|
2877
|
+
style: {
|
|
2878
|
+
width: "100%",
|
|
2879
|
+
maxWidth: 440,
|
|
2880
|
+
background: a,
|
|
2881
|
+
border: `1px solid rgba(${o},.12)`,
|
|
2882
|
+
borderLeft: `3px solid ${i}`,
|
|
2883
|
+
borderRadius: u,
|
|
2884
|
+
padding: "16px 18px",
|
|
2885
|
+
display: "flex",
|
|
2886
|
+
flexDirection: "column",
|
|
2887
|
+
gap: 9,
|
|
2888
|
+
boxShadow: "0 14px 34px rgba(0,0,0,.12)",
|
|
2889
|
+
pointerEvents: "auto"
|
|
2890
|
+
},
|
|
2891
|
+
children: [/* @__PURE__ */ s("blockquote", {
|
|
2892
|
+
class: k(r, "quote", "uq-fade"),
|
|
2893
|
+
style: {
|
|
2894
|
+
fontSize: 13.5,
|
|
2895
|
+
lineHeight: 1.55,
|
|
2896
|
+
color: `rgb(${o})`
|
|
2897
|
+
},
|
|
2898
|
+
children: [
|
|
2899
|
+
"“",
|
|
2900
|
+
l.text || "…",
|
|
2901
|
+
"”"
|
|
2902
|
+
]
|
|
2903
|
+
}, h), /* @__PURE__ */ s("figcaption", {
|
|
2904
|
+
style: {
|
|
2905
|
+
display: "flex",
|
|
2906
|
+
alignItems: "center",
|
|
2907
|
+
gap: 10
|
|
2908
|
+
},
|
|
2909
|
+
children: [/* @__PURE__ */ s("span", {
|
|
2910
|
+
class: k(r, "author"),
|
|
2911
|
+
style: {
|
|
2912
|
+
fontFamily: "monospace",
|
|
2913
|
+
fontSize: 11,
|
|
2914
|
+
color: `rgba(${o},.55)`
|
|
2915
|
+
},
|
|
2916
|
+
children: l.author || "—"
|
|
2917
|
+
}), /* @__PURE__ */ s("span", {
|
|
2918
|
+
class: k(r, "dots"),
|
|
2919
|
+
style: {
|
|
2920
|
+
marginLeft: "auto",
|
|
2921
|
+
display: "flex",
|
|
2922
|
+
gap: 4
|
|
2923
|
+
},
|
|
2924
|
+
children: d.map((p, m) => /* @__PURE__ */ s("span", { style: {
|
|
2925
|
+
width: 5,
|
|
2926
|
+
height: 5,
|
|
2927
|
+
borderRadius: "50%",
|
|
2928
|
+
background: m === h ? i : `rgba(${o},.18)`
|
|
2929
|
+
} }, m))
|
|
2930
|
+
})]
|
|
2931
|
+
})]
|
|
2932
|
+
})
|
|
2933
|
+
});
|
|
2934
|
+
}
|
|
2935
|
+
function gr(e) {
|
|
2936
|
+
switch (e.config.type) {
|
|
2937
|
+
case "chat":
|
|
2938
|
+
case "exit-popup":
|
|
2939
|
+
return !1;
|
|
2940
|
+
case "banner":
|
|
2941
|
+
case "testimonial":
|
|
2942
|
+
return !0;
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
function mr(e) {
|
|
2946
|
+
return e.rules.length > 0 || e.config.type !== "exit-popup" ? e.rules : [{
|
|
2947
|
+
id: `default:${e.id}`,
|
|
2948
|
+
trigger: "exit_intent",
|
|
2949
|
+
triggerParams: {},
|
|
2950
|
+
conditions: [],
|
|
2951
|
+
once: !0,
|
|
2952
|
+
actionConfig: {
|
|
2953
|
+
open: !1,
|
|
2954
|
+
autoStart: !1,
|
|
2955
|
+
pinned: !1
|
|
2956
|
+
}
|
|
2957
|
+
}];
|
|
2958
|
+
}
|
|
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);
|
|
2964
|
+
};
|
|
2965
|
+
if (P(() => Bt(d, r, (C) => {
|
|
2966
|
+
o.report("rule.fired", {
|
|
2967
|
+
widgetId: e.id,
|
|
2968
|
+
payload: {
|
|
2969
|
+
ruleId: C.id,
|
|
2970
|
+
trigger: C.trigger
|
|
2971
|
+
}
|
|
2972
|
+
}), y(C.actionConfig);
|
|
2973
|
+
}), [e.id]), P(() => {
|
|
2974
|
+
a && y(a.action);
|
|
2975
|
+
}, [a]), !c) return null;
|
|
2976
|
+
const $ = {
|
|
2977
|
+
payload: e,
|
|
2978
|
+
look: u,
|
|
2979
|
+
api: t,
|
|
2980
|
+
embed: n,
|
|
2981
|
+
page: r,
|
|
2982
|
+
reporter: o,
|
|
2983
|
+
open: h,
|
|
2984
|
+
setOpen: g,
|
|
2985
|
+
pinned: p,
|
|
2986
|
+
focus: x
|
|
2987
|
+
};
|
|
2988
|
+
switch (e.config.type) {
|
|
2989
|
+
case "chat":
|
|
2990
|
+
return /* @__PURE__ */ s(lr, { ...$ });
|
|
2991
|
+
case "exit-popup":
|
|
2992
|
+
return /* @__PURE__ */ s(pr, { ...$ });
|
|
2993
|
+
case "banner":
|
|
2994
|
+
return /* @__PURE__ */ s(Kn, { ...$ });
|
|
2995
|
+
case "testimonial":
|
|
2996
|
+
return /* @__PURE__ */ s(_r, { ...$ });
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
function br(e) {
|
|
3000
|
+
const t = [], n = e.config.appearance.customCss.trim();
|
|
3001
|
+
return n && t.push(n), e.config.type === "exit-popup" && e.config.blocks.forEach((r, o) => {
|
|
3002
|
+
const i = r.css.trim();
|
|
3003
|
+
i && t.push(`[data-uq-widget="${e.id}"] [data-uq-block="${o}"]{${i}}`);
|
|
3004
|
+
}), t.join(`
|
|
3005
|
+
`);
|
|
3006
|
+
}
|
|
3007
|
+
function vr(e) {
|
|
3008
|
+
return e.kind === "widget" ? [e.payload] : e.payload.members.map((t) => t.widget);
|
|
3009
|
+
}
|
|
3010
|
+
var yr = {
|
|
3011
|
+
report: () => {
|
|
3012
|
+
},
|
|
3013
|
+
flush: () => {
|
|
3014
|
+
}
|
|
3015
|
+
};
|
|
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) => {
|
|
3019
|
+
t.reporter.report("rule.fired", { payload: {
|
|
3020
|
+
ruleId: d.id,
|
|
3021
|
+
trigger: d.trigger
|
|
3022
|
+
} }), r(!0), i((c) => {
|
|
3023
|
+
var f;
|
|
3024
|
+
return {
|
|
3025
|
+
action: d.actionConfig,
|
|
3026
|
+
n: ((f = c == null ? void 0 : c.n) !== null && f !== void 0 ? f : 0) + 1
|
|
3027
|
+
};
|
|
3028
|
+
});
|
|
3029
|
+
}), [e.id]), P(() => {
|
|
3030
|
+
if (e.mode !== "sequence" || !n) return;
|
|
3031
|
+
const d = Wt(e);
|
|
3032
|
+
if (d)
|
|
3033
|
+
return Rn(e, d, (c) => u(c ? [c.widget] : []));
|
|
3034
|
+
}, [
|
|
3035
|
+
e.id,
|
|
3036
|
+
e.mode,
|
|
3037
|
+
n,
|
|
3038
|
+
a
|
|
3039
|
+
]), n ? /* @__PURE__ */ s(U, { children: a.map((d) => /* @__PURE__ */ s("div", {
|
|
3040
|
+
"data-uq-widget": d.id,
|
|
3041
|
+
style: "display:contents",
|
|
3042
|
+
children: /* @__PURE__ */ s(Zt, {
|
|
3043
|
+
payload: d,
|
|
3044
|
+
kick: o,
|
|
3045
|
+
...t
|
|
3046
|
+
})
|
|
3047
|
+
}, d.id)) }) : null;
|
|
3048
|
+
}
|
|
3049
|
+
function wr({ snapshot: e, ...t }) {
|
|
3050
|
+
const n = {
|
|
3051
|
+
kind: e.kind,
|
|
3052
|
+
id: e.payload.id
|
|
3053
|
+
};
|
|
3054
|
+
return e.kind === "group" ? /* @__PURE__ */ s(xr, {
|
|
3055
|
+
group: e.payload,
|
|
3056
|
+
embed: n,
|
|
3057
|
+
...t
|
|
3058
|
+
}) : /* @__PURE__ */ s("div", {
|
|
3059
|
+
"data-uq-widget": e.payload.id,
|
|
3060
|
+
style: "display:contents",
|
|
3061
|
+
children: /* @__PURE__ */ s(Zt, {
|
|
3062
|
+
payload: e.payload,
|
|
3063
|
+
embed: n,
|
|
3064
|
+
...t
|
|
3065
|
+
})
|
|
3066
|
+
});
|
|
3067
|
+
}
|
|
3068
|
+
function Sr(e, t, n = {}) {
|
|
3069
|
+
var r, o, i;
|
|
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 = {
|
|
3071
|
+
kind: e.kind,
|
|
3072
|
+
id: e.payload.id
|
|
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");
|
|
3074
|
+
a.appendChild(l);
|
|
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,
|
|
3081
|
+
api: u,
|
|
3082
|
+
page: h,
|
|
3083
|
+
reporter: c,
|
|
3084
|
+
hostDark: f
|
|
3085
|
+
}), p);
|
|
3086
|
+
};
|
|
3087
|
+
return m(e), c.report("embed.loaded", { payload: { version: e.payload.version } }), {
|
|
3088
|
+
update: m,
|
|
3089
|
+
unmount: () => {
|
|
3090
|
+
it(null, p), c.flush(), l.remove(), p.remove();
|
|
3091
|
+
}
|
|
3092
|
+
};
|
|
3093
|
+
}
|
|
3094
|
+
function Qt(e, t) {
|
|
3095
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
3096
|
+
}
|
|
3097
|
+
function kr(e, t) {
|
|
3098
|
+
Qt(e, t), t.add(e);
|
|
3099
|
+
}
|
|
3100
|
+
function bt(e, t, n) {
|
|
3101
|
+
Qt(e, t), t.set(e, n);
|
|
3102
|
+
}
|
|
3103
|
+
function xe(e, t, n) {
|
|
3104
|
+
if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
3105
|
+
throw new TypeError("Private element is not present on this object");
|
|
3106
|
+
}
|
|
3107
|
+
function ue(e, t) {
|
|
3108
|
+
return e.get(xe(e, t));
|
|
3109
|
+
}
|
|
3110
|
+
function de(e, t, n) {
|
|
3111
|
+
return e.set(xe(e, t), n), n;
|
|
3112
|
+
}
|
|
3113
|
+
var $r = {
|
|
3114
|
+
widget: {
|
|
3115
|
+
element: "usereq-widget",
|
|
3116
|
+
attribute: "widget-id"
|
|
3117
|
+
},
|
|
3118
|
+
group: {
|
|
3119
|
+
element: "usereq-group",
|
|
3120
|
+
attribute: "group-id"
|
|
3121
|
+
}
|
|
3122
|
+
};
|
|
3123
|
+
function Pe(e) {
|
|
3124
|
+
console.warn(`[usereq] ${e}`);
|
|
3125
|
+
}
|
|
3126
|
+
function vt(e) {
|
|
3127
|
+
const { element: t, attribute: n } = $r[e];
|
|
3128
|
+
if (customElements.get(t)) return;
|
|
3129
|
+
var r = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakSet();
|
|
3130
|
+
class a extends HTMLElement {
|
|
3131
|
+
constructor(...c) {
|
|
3132
|
+
super(...c), kr(this, i), bt(this, r, null), bt(this, o, 0);
|
|
3133
|
+
}
|
|
3134
|
+
connectedCallback() {
|
|
3135
|
+
xe(i, this, u).call(this);
|
|
3136
|
+
}
|
|
3137
|
+
disconnectedCallback() {
|
|
3138
|
+
var c;
|
|
3139
|
+
(c = ue(r, this)) === null || c === void 0 || c.unmount(), de(r, this, null);
|
|
3140
|
+
}
|
|
3141
|
+
attributeChangedCallback(c, f, h) {
|
|
3142
|
+
f !== h && this.isConnected && xe(i, this, u).call(this);
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
async function u() {
|
|
3146
|
+
var d, c, f, h;
|
|
3147
|
+
const l = (d = this.getAttribute(n)) === null || d === void 0 ? void 0 : d.trim();
|
|
3148
|
+
if (!l) return;
|
|
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;
|
|
3152
|
+
let _;
|
|
3153
|
+
try {
|
|
3154
|
+
const g = await rn({ base: m }, e, l);
|
|
3155
|
+
_ = dn(g, e);
|
|
3156
|
+
} catch (g) {
|
|
3157
|
+
g instanceof K ? Pe(`${t} ${l}: ${g.message} (${g.code})`) : Pe(`${t} ${l}: could not reach ${m}.`);
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
3160
|
+
if (!(p !== ue(o, this) || !this.isConnected)) {
|
|
3161
|
+
if (!_) {
|
|
3162
|
+
Pe(`${t} ${l}: the response was not a ${e} snapshot.`);
|
|
3163
|
+
return;
|
|
3164
|
+
}
|
|
3165
|
+
de(r, this, Sr(_, this, {
|
|
3166
|
+
apiUrl: m,
|
|
3167
|
+
theme: v
|
|
3168
|
+
}));
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
Fe(a, "observedAttributes", [
|
|
3172
|
+
n,
|
|
3173
|
+
"api-url",
|
|
3174
|
+
"theme"
|
|
3175
|
+
]), customElements.define(t, a);
|
|
3176
|
+
}
|
|
3177
|
+
function Cr() {
|
|
3178
|
+
vt("widget"), vt("group");
|
|
3179
|
+
}
|
|
3180
|
+
Cr();
|
|
3181
|
+
export {
|
|
3182
|
+
Sr as render
|
|
3183
|
+
};
|
|
3184
|
+
|
|
3185
|
+
//# sourceMappingURL=embed.mjs.map
|