@alxxsck/ai-assistant 2.25.1 → 2.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Avatar-Dvgov563.js → Avatar-C3PubeMM.js} +1 -1
- package/dist/{ChatWidgetContent-Bz5AjlS4.js → ChatWidgetContent-Dt6meIg2.js} +49 -49
- package/dist/bridge-ai-chat-widget.es.js +1 -1
- package/dist/domain/scenario/ScenarioChoiceSubmissionController.d.ts +1 -0
- package/dist/{index-CmFVo5By.js → index-DDvZeFFo.js} +2 -2
- package/dist/{mount-D5y3aEYe.js → mount-C7CMxso3.js} +792 -807
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as H, jsxs as lt, Fragment as Ti } from "react/jsx-runtime";
|
|
2
2
|
import * as R from "react";
|
|
3
3
|
import Jr, { createContext as Kn, useContext as Pr, useState as he, useRef as q, useMemo as un, useEffect as Y, useCallback as le, useId as Zi, useLayoutEffect as Dn, memo as dl, useSyncExternalStore as eu, Suspense as hl, lazy as fl, Component as pl, createElement as Do } from "react";
|
|
4
|
-
import { l as re, L as At, a as ml, n as gl, g as bl, i as Cl, P as yl, S as Il, b as vl, c as Al, o as wl } from "./index-
|
|
4
|
+
import { l as re, L as At, a as ml, n as gl, g as bl, i as Cl, P as yl, S as Il, b as vl, c as Al, o as wl } from "./index-DDvZeFFo.js";
|
|
5
5
|
import { createRoot as Sl } from "react-dom/client";
|
|
6
6
|
function _o(t) {
|
|
7
7
|
return typeof t == "object" && t != null && "pathname" in t && "search" in t && "hash" in t && "state" in t && "key" in t;
|
|
@@ -1397,7 +1397,7 @@ function qd({
|
|
|
1397
1397
|
let m = /* @__PURE__ */ new Set(), g = !1;
|
|
1398
1398
|
if (e.forEach((y) => {
|
|
1399
1399
|
let I = i.routes[y.route.id];
|
|
1400
|
-
!I || !I.hasLoader || (!l.some((
|
|
1400
|
+
!I || !I.hasLoader || (!l.some((S) => S.route.id === y.route.id) && y.route.id in u && o[y.route.id]?.shouldRevalidate || I.hasClientLoader ? g = !0 : m.add(y.route.id));
|
|
1401
1401
|
}), m.size === 0)
|
|
1402
1402
|
return [];
|
|
1403
1403
|
let b = Md(
|
|
@@ -1468,19 +1468,19 @@ var gu = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, bu = R.forwardRef(
|
|
|
1468
1468
|
unstable_defaultShouldRevalidate: h,
|
|
1469
1469
|
...f
|
|
1470
1470
|
}, m) {
|
|
1471
|
-
let { basename: g, navigator: b, unstable_useTransitions: y } = R.useContext(ot), I = typeof l == "string" && gu.test(l),
|
|
1472
|
-
l =
|
|
1473
|
-
let C = sd(l, { relative: s }),
|
|
1471
|
+
let { basename: g, navigator: b, unstable_useTransitions: y } = R.useContext(ot), I = typeof l == "string" && gu.test(l), S = iu(l, g);
|
|
1472
|
+
l = S.to;
|
|
1473
|
+
let C = sd(l, { relative: s }), E = wt(), k = null;
|
|
1474
1474
|
if (a) {
|
|
1475
1475
|
let X = Os(
|
|
1476
1476
|
a,
|
|
1477
1477
|
[],
|
|
1478
|
-
|
|
1478
|
+
E.unstable_mask ? E.unstable_mask.pathname : "/",
|
|
1479
1479
|
!0
|
|
1480
1480
|
);
|
|
1481
1481
|
g !== "/" && (X.pathname = X.pathname === "/" ? g : Lt([g, X.pathname])), k = b.createHref(X);
|
|
1482
1482
|
}
|
|
1483
|
-
let [
|
|
1483
|
+
let [z, x, D] = Vd(
|
|
1484
1484
|
r,
|
|
1485
1485
|
f
|
|
1486
1486
|
), P = jd(l, {
|
|
@@ -1494,25 +1494,25 @@ var gu = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, bu = R.forwardRef(
|
|
|
1494
1494
|
unstable_defaultShouldRevalidate: h,
|
|
1495
1495
|
unstable_useTransitions: y
|
|
1496
1496
|
});
|
|
1497
|
-
function
|
|
1497
|
+
function V(X) {
|
|
1498
1498
|
e && e(X), X.defaultPrevented || P(X);
|
|
1499
1499
|
}
|
|
1500
|
-
let
|
|
1500
|
+
let B = !(S.isExternal || i), W = (
|
|
1501
1501
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
1502
1502
|
/* @__PURE__ */ R.createElement(
|
|
1503
1503
|
"a",
|
|
1504
1504
|
{
|
|
1505
1505
|
...f,
|
|
1506
|
-
...
|
|
1507
|
-
href: (
|
|
1508
|
-
onClick:
|
|
1509
|
-
ref: Ud(m,
|
|
1506
|
+
...D,
|
|
1507
|
+
href: (B ? k : void 0) || S.absoluteURL || C,
|
|
1508
|
+
onClick: B ? V : e,
|
|
1509
|
+
ref: Ud(m, x),
|
|
1510
1510
|
target: c,
|
|
1511
1511
|
"data-discover": !I && n === "render" ? "true" : void 0
|
|
1512
1512
|
}
|
|
1513
1513
|
)
|
|
1514
1514
|
);
|
|
1515
|
-
return
|
|
1515
|
+
return z && !I ? /* @__PURE__ */ R.createElement(R.Fragment, null, W, /* @__PURE__ */ R.createElement(zd, { page: C })) : W;
|
|
1516
1516
|
}
|
|
1517
1517
|
);
|
|
1518
1518
|
bu.displayName = "Link";
|
|
@@ -1532,27 +1532,27 @@ var Hd = R.forwardRef(
|
|
|
1532
1532
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1533
1533
|
$d(d) && a === !0, b = f.encodeLocation ? f.encodeLocation(d).pathname : d.pathname, y = p.pathname, I = h && h.navigation && h.navigation.location ? h.navigation.location.pathname : null;
|
|
1534
1534
|
n || (y = y.toLowerCase(), I = I ? I.toLowerCase() : null, b = b.toLowerCase()), I && m && (I = jt(I, m) || I);
|
|
1535
|
-
const
|
|
1536
|
-
let C = y === b || !s && y.startsWith(b) && y.charAt(
|
|
1535
|
+
const S = b !== "/" && b.endsWith("/") ? b.length - 1 : b.length;
|
|
1536
|
+
let C = y === b || !s && y.startsWith(b) && y.charAt(S) === "/", E = I != null && (I === b || !s && I.startsWith(b) && I.charAt(b.length) === "/"), k = {
|
|
1537
1537
|
isActive: C,
|
|
1538
|
-
isPending:
|
|
1538
|
+
isPending: E,
|
|
1539
1539
|
isTransitioning: g
|
|
1540
|
-
},
|
|
1541
|
-
typeof r == "function" ?
|
|
1540
|
+
}, z = C ? e : void 0, x;
|
|
1541
|
+
typeof r == "function" ? x = r(k) : x = [
|
|
1542
1542
|
r,
|
|
1543
1543
|
C ? "active" : null,
|
|
1544
|
-
|
|
1544
|
+
E ? "pending" : null,
|
|
1545
1545
|
g ? "transitioning" : null
|
|
1546
1546
|
].filter(Boolean).join(" ");
|
|
1547
|
-
let
|
|
1547
|
+
let D = typeof i == "function" ? i(k) : i;
|
|
1548
1548
|
return /* @__PURE__ */ R.createElement(
|
|
1549
1549
|
bu,
|
|
1550
1550
|
{
|
|
1551
1551
|
...c,
|
|
1552
|
-
"aria-current":
|
|
1553
|
-
className:
|
|
1552
|
+
"aria-current": z,
|
|
1553
|
+
className: x,
|
|
1554
1554
|
ref: l,
|
|
1555
|
-
style:
|
|
1555
|
+
style: D,
|
|
1556
1556
|
to: o,
|
|
1557
1557
|
viewTransition: a
|
|
1558
1558
|
},
|
|
@@ -1578,10 +1578,10 @@ var Xd = R.forwardRef(
|
|
|
1578
1578
|
unstable_defaultShouldRevalidate: p,
|
|
1579
1579
|
...h
|
|
1580
1580
|
}, f) => {
|
|
1581
|
-
let { unstable_useTransitions: m } = R.useContext(ot), g = Jd(), b = Qd(a, { relative: c }), y = o.toLowerCase() === "get" ? "get" : "post", I = typeof a == "string" && gu.test(a),
|
|
1581
|
+
let { unstable_useTransitions: m } = R.useContext(ot), g = Jd(), b = Qd(a, { relative: c }), y = o.toLowerCase() === "get" ? "get" : "post", I = typeof a == "string" && gu.test(a), S = (C) => {
|
|
1582
1582
|
if (u && u(C), C.defaultPrevented) return;
|
|
1583
1583
|
C.preventDefault();
|
|
1584
|
-
let
|
|
1584
|
+
let E = C.nativeEvent.submitter, k = E?.getAttribute("formmethod") || o, z = () => g(E || C.currentTarget, {
|
|
1585
1585
|
fetcherKey: e,
|
|
1586
1586
|
method: k,
|
|
1587
1587
|
navigate: n,
|
|
@@ -1592,7 +1592,7 @@ var Xd = R.forwardRef(
|
|
|
1592
1592
|
viewTransition: d,
|
|
1593
1593
|
unstable_defaultShouldRevalidate: p
|
|
1594
1594
|
});
|
|
1595
|
-
m && n !== !1 ? R.startTransition(() =>
|
|
1595
|
+
m && n !== !1 ? R.startTransition(() => z()) : z();
|
|
1596
1596
|
};
|
|
1597
1597
|
return /* @__PURE__ */ R.createElement(
|
|
1598
1598
|
"form",
|
|
@@ -1600,7 +1600,7 @@ var Xd = R.forwardRef(
|
|
|
1600
1600
|
ref: f,
|
|
1601
1601
|
method: y,
|
|
1602
1602
|
action: b,
|
|
1603
|
-
onSubmit: r ? u :
|
|
1603
|
+
onSubmit: r ? u : S,
|
|
1604
1604
|
...h,
|
|
1605
1605
|
"data-discover": !I && t === "render" ? "true" : void 0
|
|
1606
1606
|
}
|
|
@@ -2985,34 +2985,34 @@ function bh(t, e) {
|
|
|
2985
2985
|
maxReconnectAttempts: b,
|
|
2986
2986
|
subprotocol: y,
|
|
2987
2987
|
tokenRefresher: I,
|
|
2988
|
-
historyTimestamp:
|
|
2988
|
+
historyTimestamp: S,
|
|
2989
2989
|
protocolOptions: C,
|
|
2990
|
-
concurrentSubscribes:
|
|
2990
|
+
concurrentSubscribes: E,
|
|
2991
2991
|
performFailures: k,
|
|
2992
|
-
transportConfigurator:
|
|
2993
|
-
auth:
|
|
2992
|
+
transportConfigurator: z,
|
|
2993
|
+
auth: x
|
|
2994
2994
|
} = e;
|
|
2995
2995
|
if (c = c || new zr(u), typeof n == "string") {
|
|
2996
2996
|
y = y || n;
|
|
2997
|
-
let
|
|
2998
|
-
if (C = C || {},
|
|
2997
|
+
let V = n.substring(0, n.lastIndexOf("-")), B = n.substring(n.lastIndexOf("-") + 1);
|
|
2998
|
+
if (C = C || {}, V === "actioncable-v1")
|
|
2999
2999
|
n = new Au({ logger: c, ...C });
|
|
3000
|
-
else if (
|
|
3000
|
+
else if (V === "actioncable-v1-ext")
|
|
3001
3001
|
n = new ch({
|
|
3002
3002
|
logger: c,
|
|
3003
|
-
historyTimestamp:
|
|
3003
|
+
historyTimestamp: S,
|
|
3004
3004
|
...C
|
|
3005
3005
|
});
|
|
3006
3006
|
else
|
|
3007
3007
|
throw Error(`Protocol is not supported yet: ${n}`);
|
|
3008
|
-
if (
|
|
3008
|
+
if (B === "json")
|
|
3009
3009
|
d = d || new ah(), s = s || "text";
|
|
3010
|
-
else if (
|
|
3010
|
+
else if (B === "msgpack") {
|
|
3011
3011
|
if (s = "binary", !d)
|
|
3012
3012
|
throw Error(
|
|
3013
3013
|
"Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own"
|
|
3014
3014
|
);
|
|
3015
|
-
} else if (
|
|
3015
|
+
} else if (B === "protobuf") {
|
|
3016
3016
|
if (s = s || "binary", !d)
|
|
3017
3017
|
throw Error(
|
|
3018
3018
|
"Protobuf encoder must be specified explicitly. Use `@anycable/protobuf-encoder` package or build your own"
|
|
@@ -3027,28 +3027,28 @@ function bh(t, e) {
|
|
|
3027
3027
|
subprotocol: y,
|
|
3028
3028
|
authStrategy: o,
|
|
3029
3029
|
format: s
|
|
3030
|
-
}), a && (l = new mh([l, ...a], { logger: c })),
|
|
3030
|
+
}), a && (l = new mh([l, ...a], { logger: c })), x && x.token && l.setToken(x.token, x.param || "jid"), m = m || wu(f), h !== !1 && (h = h || new Su({
|
|
3031
3031
|
pingInterval: f,
|
|
3032
3032
|
reconnectStrategy: m,
|
|
3033
3033
|
maxMissingPings: g,
|
|
3034
3034
|
maxReconnectAttempts: b,
|
|
3035
3035
|
logger: c
|
|
3036
3036
|
}));
|
|
3037
|
-
let
|
|
3037
|
+
let D = { concurrentSubscribes: E }, P = new fh({
|
|
3038
3038
|
protocol: n,
|
|
3039
3039
|
transport: l,
|
|
3040
3040
|
encoder: d,
|
|
3041
3041
|
logger: c,
|
|
3042
3042
|
lazy: p,
|
|
3043
|
-
hubOptions:
|
|
3043
|
+
hubOptions: D,
|
|
3044
3044
|
performFailures: k,
|
|
3045
|
-
transportConfigurator:
|
|
3045
|
+
transportConfigurator: z
|
|
3046
3046
|
});
|
|
3047
3047
|
return h && (h.watch(P), P.monitor = h), I && Ch(P, async () => {
|
|
3048
3048
|
try {
|
|
3049
3049
|
await I(l);
|
|
3050
|
-
} catch (
|
|
3051
|
-
return c.error("Failed to refresh authentication token: " +
|
|
3050
|
+
} catch (V) {
|
|
3051
|
+
return c.error("Failed to refresh authentication token: " + V), !1;
|
|
3052
3052
|
}
|
|
3053
3053
|
return P.connect().catch(() => {
|
|
3054
3054
|
}), !0;
|
|
@@ -3987,11 +3987,11 @@ ks.prototype.parse = function(t, e) {
|
|
|
3987
3987
|
const b = f[m];
|
|
3988
3988
|
if (b && !b.match(ea)) {
|
|
3989
3989
|
let y = "";
|
|
3990
|
-
for (let I = 0,
|
|
3990
|
+
for (let I = 0, S = b.length; I < S; I++)
|
|
3991
3991
|
b.charCodeAt(I) > 127 ? y += "x" : y += b[I];
|
|
3992
3992
|
if (!y.match(ea)) {
|
|
3993
|
-
const I = f.slice(0, m),
|
|
3994
|
-
C && (I.push(C[1]),
|
|
3993
|
+
const I = f.slice(0, m), S = f.slice(m + 1), C = b.match(A0);
|
|
3994
|
+
C && (I.push(C[1]), S.unshift(C[2])), S.length && (i = S.join(".") + i), this.hostname = I.join(".");
|
|
3995
3995
|
break;
|
|
3996
3996
|
}
|
|
3997
3997
|
}
|
|
@@ -4920,8 +4920,8 @@ function ff(t) {
|
|
|
4920
4920
|
y.attrs = [["href", m]], y.level = d++, y.markup = "linkify", y.info = "auto", l.push(y);
|
|
4921
4921
|
const I = new t.Token("text", "", 0);
|
|
4922
4922
|
I.content = g, I.level = d, l.push(I);
|
|
4923
|
-
const
|
|
4924
|
-
|
|
4923
|
+
const S = new t.Token("link_close", "a", -1);
|
|
4924
|
+
S.level = --d, S.markup = "linkify", S.info = "auto", l.push(S), p = c[h].lastIndex;
|
|
4925
4925
|
}
|
|
4926
4926
|
if (p < u.length) {
|
|
4927
4927
|
const h = new t.Token("text", "", 0);
|
|
@@ -5012,8 +5012,8 @@ function wf(t, e) {
|
|
|
5012
5012
|
g = t[n].content.charCodeAt(0);
|
|
5013
5013
|
break;
|
|
5014
5014
|
}
|
|
5015
|
-
const b = Mr(m) || Rr(m), y = Mr(g) || Rr(g), I = Tr(m),
|
|
5016
|
-
if (
|
|
5015
|
+
const b = Mr(m) || Rr(m), y = Mr(g) || Rr(g), I = Tr(m), S = Tr(g);
|
|
5016
|
+
if (S ? p = !1 : y && (I || b || (p = !1)), I ? h = !1 : b && (S || y || (h = !1)), g === 34 && d[0] === '"' && m >= 48 && m <= 57 && (h = p = !1), p && h && (p = b, h = y), !p && !h) {
|
|
5017
5017
|
f && $r(s, i, d.index, ia);
|
|
5018
5018
|
continue;
|
|
5019
5019
|
}
|
|
@@ -5024,8 +5024,8 @@ function wf(t, e) {
|
|
|
5024
5024
|
break;
|
|
5025
5025
|
if (C.single === f && r[n].level === a) {
|
|
5026
5026
|
C = r[n];
|
|
5027
|
-
let
|
|
5028
|
-
f ? (
|
|
5027
|
+
let E, k;
|
|
5028
|
+
f ? (E = e.md.options.quotes[2], k = e.md.options.quotes[3]) : (E = e.md.options.quotes[0], k = e.md.options.quotes[1]), $r(s, i, d.index, k), $r(s, C.token, C.pos, E), r.length = n;
|
|
5029
5029
|
continue e;
|
|
5030
5030
|
}
|
|
5031
5031
|
}
|
|
@@ -5188,17 +5188,17 @@ function xf(t, e, n, r) {
|
|
|
5188
5188
|
if (a !== 124 && a !== 45 && a !== 58 && !Ee(a) || o === 45 && Ee(a))
|
|
5189
5189
|
return !1;
|
|
5190
5190
|
for (; i < t.eMarks[s]; ) {
|
|
5191
|
-
const
|
|
5192
|
-
if (
|
|
5191
|
+
const S = t.src.charCodeAt(i);
|
|
5192
|
+
if (S !== 124 && S !== 45 && S !== 58 && !Ee(S))
|
|
5193
5193
|
return !1;
|
|
5194
5194
|
i++;
|
|
5195
5195
|
}
|
|
5196
5196
|
let u = ui(t, e + 1), c = u.split("|");
|
|
5197
5197
|
const l = [];
|
|
5198
|
-
for (let
|
|
5199
|
-
const C = c[
|
|
5198
|
+
for (let S = 0; S < c.length; S++) {
|
|
5199
|
+
const C = c[S].trim();
|
|
5200
5200
|
if (!C) {
|
|
5201
|
-
if (
|
|
5201
|
+
if (S === 0 || S === c.length - 1)
|
|
5202
5202
|
continue;
|
|
5203
5203
|
return !1;
|
|
5204
5204
|
}
|
|
@@ -5222,34 +5222,34 @@ function xf(t, e, n, r) {
|
|
|
5222
5222
|
g.map = [e, e + 1];
|
|
5223
5223
|
const b = t.push("tr_open", "tr", 1);
|
|
5224
5224
|
b.map = [e, e + 1];
|
|
5225
|
-
for (let
|
|
5225
|
+
for (let S = 0; S < c.length; S++) {
|
|
5226
5226
|
const C = t.push("th_open", "th", 1);
|
|
5227
|
-
l[
|
|
5228
|
-
const
|
|
5229
|
-
|
|
5227
|
+
l[S] && (C.attrs = [["style", "text-align:" + l[S]]]);
|
|
5228
|
+
const E = t.push("inline", "", 0);
|
|
5229
|
+
E.content = c[S].trim(), E.children = [], t.push("th_close", "th", -1);
|
|
5230
5230
|
}
|
|
5231
5231
|
t.push("tr_close", "tr", -1), t.push("thead_close", "thead", -1);
|
|
5232
5232
|
let y, I = 0;
|
|
5233
5233
|
for (s = e + 2; s < n && !(t.sCount[s] < t.blkIndent); s++) {
|
|
5234
|
-
let
|
|
5235
|
-
for (let
|
|
5236
|
-
if (h[
|
|
5237
|
-
|
|
5234
|
+
let S = !1;
|
|
5235
|
+
for (let E = 0, k = h.length; E < k; E++)
|
|
5236
|
+
if (h[E](t, s, n, !0)) {
|
|
5237
|
+
S = !0;
|
|
5238
5238
|
break;
|
|
5239
5239
|
}
|
|
5240
|
-
if (
|
|
5240
|
+
if (S || (u = ui(t, s).trim(), !u) || t.sCount[s] - t.blkIndent >= 4 || (c = oa(u), c.length && c[0] === "" && c.shift(), c.length && c[c.length - 1] === "" && c.pop(), I += d - c.length, I > kf))
|
|
5241
5241
|
break;
|
|
5242
5242
|
if (s === e + 2) {
|
|
5243
|
-
const
|
|
5244
|
-
|
|
5243
|
+
const E = t.push("tbody_open", "tbody", 1);
|
|
5244
|
+
E.map = y = [e + 2, 0];
|
|
5245
5245
|
}
|
|
5246
5246
|
const C = t.push("tr_open", "tr", 1);
|
|
5247
5247
|
C.map = [s, s + 1];
|
|
5248
|
-
for (let
|
|
5248
|
+
for (let E = 0; E < d; E++) {
|
|
5249
5249
|
const k = t.push("td_open", "td", 1);
|
|
5250
|
-
l[
|
|
5251
|
-
const
|
|
5252
|
-
|
|
5250
|
+
l[E] && (k.attrs = [["style", "text-align:" + l[E]]]);
|
|
5251
|
+
const z = t.push("inline", "", 0);
|
|
5252
|
+
z.content = c[E] ? c[E].trim() : "", z.children = [], t.push("td_close", "td", -1);
|
|
5253
5253
|
}
|
|
5254
5254
|
t.push("tr_close", "tr", -1);
|
|
5255
5255
|
}
|
|
@@ -5317,29 +5317,29 @@ function Mf(t, e, n, r) {
|
|
|
5317
5317
|
if (s = t.bMarks[f] + t.tShift[f], i = t.eMarks[f], s >= i)
|
|
5318
5318
|
break;
|
|
5319
5319
|
if (t.src.charCodeAt(s++) === 62 && !I) {
|
|
5320
|
-
let C = t.sCount[f] + 1,
|
|
5321
|
-
t.src.charCodeAt(s) === 32 ? (s++, C++, k = !1,
|
|
5322
|
-
let
|
|
5320
|
+
let C = t.sCount[f] + 1, E, k;
|
|
5321
|
+
t.src.charCodeAt(s) === 32 ? (s++, C++, k = !1, E = !0) : t.src.charCodeAt(s) === 9 ? (E = !0, (t.bsCount[f] + C) % 4 === 3 ? (s++, C++, k = !1) : k = !0) : E = !1;
|
|
5322
|
+
let z = C;
|
|
5323
5323
|
for (a.push(t.bMarks[f]), t.bMarks[f] = s; s < i; ) {
|
|
5324
|
-
const
|
|
5325
|
-
if (Ee(
|
|
5326
|
-
|
|
5324
|
+
const x = t.src.charCodeAt(s);
|
|
5325
|
+
if (Ee(x))
|
|
5326
|
+
x === 9 ? z += 4 - (z + t.bsCount[f] + (k ? 1 : 0)) % 4 : z++;
|
|
5327
5327
|
else
|
|
5328
5328
|
break;
|
|
5329
5329
|
s++;
|
|
5330
5330
|
}
|
|
5331
|
-
h = s >= i, u.push(t.bsCount[f]), t.bsCount[f] = t.sCount[f] + 1 + (
|
|
5331
|
+
h = s >= i, u.push(t.bsCount[f]), t.bsCount[f] = t.sCount[f] + 1 + (E ? 1 : 0), c.push(t.sCount[f]), t.sCount[f] = z - C, l.push(t.tShift[f]), t.tShift[f] = s - t.bMarks[f];
|
|
5332
5332
|
continue;
|
|
5333
5333
|
}
|
|
5334
5334
|
if (h)
|
|
5335
5335
|
break;
|
|
5336
|
-
let
|
|
5337
|
-
for (let C = 0,
|
|
5336
|
+
let S = !1;
|
|
5337
|
+
for (let C = 0, E = d.length; C < E; C++)
|
|
5338
5338
|
if (d[C](t, f, n, !0)) {
|
|
5339
|
-
|
|
5339
|
+
S = !0;
|
|
5340
5340
|
break;
|
|
5341
5341
|
}
|
|
5342
|
-
if (
|
|
5342
|
+
if (S) {
|
|
5343
5343
|
t.lineMax = f, t.blkIndent !== 0 && (a.push(t.bMarks[f]), u.push(t.bsCount[f]), l.push(t.tShift[f]), c.push(t.sCount[f]), t.sCount[f] -= t.blkIndent);
|
|
5344
5344
|
break;
|
|
5345
5345
|
}
|
|
@@ -5445,8 +5445,8 @@ function Ff(t, e, n, r) {
|
|
|
5445
5445
|
const y = t.md.block.ruler.getRules("list"), I = t.parentType;
|
|
5446
5446
|
for (t.parentType = "list"; u < n; ) {
|
|
5447
5447
|
i = h, s = t.eMarks[u];
|
|
5448
|
-
const
|
|
5449
|
-
let C =
|
|
5448
|
+
const S = t.sCount[u] + h - (t.bMarks[u] + t.tShift[u]);
|
|
5449
|
+
let C = S;
|
|
5450
5450
|
for (; i < s; ) {
|
|
5451
5451
|
const X = t.src.charCodeAt(i);
|
|
5452
5452
|
if (X === 9)
|
|
@@ -5457,15 +5457,15 @@ function Ff(t, e, n, r) {
|
|
|
5457
5457
|
break;
|
|
5458
5458
|
i++;
|
|
5459
5459
|
}
|
|
5460
|
-
const
|
|
5460
|
+
const E = i;
|
|
5461
5461
|
let k;
|
|
5462
|
-
|
|
5463
|
-
const
|
|
5462
|
+
E >= s ? k = 1 : k = C - S, k > 4 && (k = 1);
|
|
5463
|
+
const z = S + k;
|
|
5464
5464
|
a = t.push("list_item_open", "li", 1), a.markup = String.fromCharCode(f);
|
|
5465
|
-
const
|
|
5466
|
-
a.map =
|
|
5467
|
-
const
|
|
5468
|
-
if (t.listIndent = t.blkIndent, t.blkIndent =
|
|
5465
|
+
const x = [u, 0];
|
|
5466
|
+
a.map = x, d && (a.info = t.src.slice(o, h - 1));
|
|
5467
|
+
const D = t.tight, P = t.tShift[u], V = t.sCount[u], B = t.listIndent;
|
|
5468
|
+
if (t.listIndent = t.blkIndent, t.blkIndent = z, t.tight = !0, t.tShift[u] = E - t.bMarks[u], t.sCount[u] = C, E >= s && t.isEmpty(u + 1) ? t.line = Math.min(t.line + 2, n) : t.md.block.tokenize(t, u, n, !0), (!t.tight || b) && (c = !1), b = t.line - u > 1 && t.isEmpty(t.line - 1), t.blkIndent = t.listIndent, t.listIndent = B, t.tShift[u] = P, t.sCount[u] = V, t.tight = D, a = t.push("list_item_close", "li", -1), a.markup = String.fromCharCode(f), u = t.line, x[1] = u, u >= n || t.sCount[u] < t.blkIndent || t.sCount[u] - t.blkIndent >= 4)
|
|
5469
5469
|
break;
|
|
5470
5470
|
let W = !1;
|
|
5471
5471
|
for (let X = 0, N = y.length; X < N; X++)
|
|
@@ -5494,21 +5494,21 @@ function Nf(t, e, n, r) {
|
|
|
5494
5494
|
const I = t.lineMax;
|
|
5495
5495
|
if (y >= I || t.isEmpty(y))
|
|
5496
5496
|
return null;
|
|
5497
|
-
let
|
|
5498
|
-
if (t.sCount[y] - t.blkIndent > 3 && (
|
|
5499
|
-
const k = t.md.block.ruler.getRules("reference"),
|
|
5497
|
+
let S = !1;
|
|
5498
|
+
if (t.sCount[y] - t.blkIndent > 3 && (S = !0), t.sCount[y] < 0 && (S = !0), !S) {
|
|
5499
|
+
const k = t.md.block.ruler.getRules("reference"), z = t.parentType;
|
|
5500
5500
|
t.parentType = "reference";
|
|
5501
|
-
let
|
|
5502
|
-
for (let
|
|
5503
|
-
if (k[
|
|
5504
|
-
|
|
5501
|
+
let x = !1;
|
|
5502
|
+
for (let D = 0, P = k.length; D < P; D++)
|
|
5503
|
+
if (k[D](t, y, I, !0)) {
|
|
5504
|
+
x = !0;
|
|
5505
5505
|
break;
|
|
5506
5506
|
}
|
|
5507
|
-
if (t.parentType =
|
|
5507
|
+
if (t.parentType = z, x)
|
|
5508
5508
|
return null;
|
|
5509
5509
|
}
|
|
5510
|
-
const C = t.bMarks[y] + t.tShift[y],
|
|
5511
|
-
return t.src.slice(C,
|
|
5510
|
+
const C = t.bMarks[y] + t.tShift[y], E = t.eMarks[y];
|
|
5511
|
+
return t.src.slice(C, E + 1);
|
|
5512
5512
|
}
|
|
5513
5513
|
let u = t.src.slice(s, i + 1);
|
|
5514
5514
|
i = u.length;
|
|
@@ -7525,11 +7525,11 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
7525
7525
|
n && on.delete(e), ht.delete(e);
|
|
7526
7526
|
const i = t.currentThreadId === e || t.pendingCustomerMessage?.conversationId === e, o = new Set(
|
|
7527
7527
|
t.messages.filter(
|
|
7528
|
-
(
|
|
7529
|
-
).map(({ id:
|
|
7528
|
+
(D) => (D.conversationId ?? D.threadId) === e
|
|
7529
|
+
).map(({ id: D }) => D)
|
|
7530
7530
|
), a = t.pendingCustomerMessage, u = a && (a.conversationId ?? t.currentThreadId) === e ? a.id : null;
|
|
7531
|
-
for (const
|
|
7532
|
-
(
|
|
7531
|
+
for (const D of t.pendingMessageDeltas.values())
|
|
7532
|
+
(D.conversationId === e || u !== null && D.requestId === u) && o.add(D.messageId);
|
|
7533
7533
|
const c = new Set(t.loadedThreadIds);
|
|
7534
7534
|
c.delete(e);
|
|
7535
7535
|
const l = new Map(t.threadMessagesNextCursor);
|
|
@@ -7552,55 +7552,55 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
7552
7552
|
ANY_OPEN: 1,
|
|
7553
7553
|
NEWER_OPEN: 2,
|
|
7554
7554
|
EXACT_ONLY: 3
|
|
7555
|
-
},
|
|
7555
|
+
}, S = t.inactiveConversationRevalidation.get(e), C = s === "NEWER_OPEN" && r ? "NEWER_OPEN" : S && I[S] > I[s] ? S : s, E = new Map(
|
|
7556
7556
|
t.inactiveConversationRevalidation
|
|
7557
7557
|
).set(e, C), k = new Map(t.conversationScanSnapshots);
|
|
7558
7558
|
k.delete(e);
|
|
7559
|
-
const
|
|
7559
|
+
const z = new Set(
|
|
7560
7560
|
t.conversationScanCandidateIds
|
|
7561
7561
|
);
|
|
7562
|
-
|
|
7563
|
-
const
|
|
7562
|
+
z.delete(e);
|
|
7563
|
+
const x = new Set(t.concealedMessageIds);
|
|
7564
7564
|
if (n)
|
|
7565
|
-
for (const
|
|
7566
|
-
|
|
7565
|
+
for (const D of o)
|
|
7566
|
+
x.add(D);
|
|
7567
7567
|
return {
|
|
7568
7568
|
conversations: t.conversations.filter(
|
|
7569
|
-
({ id:
|
|
7569
|
+
({ id: D }) => D !== e
|
|
7570
7570
|
),
|
|
7571
|
-
threadIds: t.threadIds.filter((
|
|
7571
|
+
threadIds: t.threadIds.filter((D) => D !== e),
|
|
7572
7572
|
loadedThreadIds: c,
|
|
7573
7573
|
threadMessagesNextCursor: l,
|
|
7574
7574
|
loadingOlderThreadIds: d,
|
|
7575
7575
|
refreshingThreadIds: p,
|
|
7576
7576
|
assistantSuspendedConversationIds: h,
|
|
7577
7577
|
concealedConversationIds: f,
|
|
7578
|
-
concealedMessageIds:
|
|
7578
|
+
concealedMessageIds: x,
|
|
7579
7579
|
inactiveConversationIds: m,
|
|
7580
7580
|
inactiveConversationUpdatedAt: y,
|
|
7581
|
-
inactiveConversationRevalidation:
|
|
7582
|
-
conversationScanCandidateIds:
|
|
7581
|
+
inactiveConversationRevalidation: E,
|
|
7582
|
+
conversationScanCandidateIds: z,
|
|
7583
7583
|
conversationScanSnapshots: k,
|
|
7584
7584
|
typingByConversation: new Map(
|
|
7585
7585
|
[...t.typingByConversation].filter(
|
|
7586
|
-
([
|
|
7586
|
+
([D]) => !D.startsWith(`${e}\0`)
|
|
7587
7587
|
)
|
|
7588
7588
|
),
|
|
7589
|
-
messages: t.messages.filter(({ id:
|
|
7589
|
+
messages: t.messages.filter(({ id: D }) => !o.has(D)),
|
|
7590
7590
|
threads: new Map(
|
|
7591
|
-
[...t.threads].filter(([
|
|
7591
|
+
[...t.threads].filter(([D]) => D !== e)
|
|
7592
7592
|
),
|
|
7593
7593
|
threadsPreviews: t.threadsPreviews.filter(
|
|
7594
|
-
({ threadId:
|
|
7594
|
+
({ threadId: D }) => D !== e
|
|
7595
7595
|
),
|
|
7596
7596
|
messageStreams: new Map(
|
|
7597
7597
|
[...t.messageStreams].filter(
|
|
7598
|
-
([
|
|
7598
|
+
([D]) => !o.has(D)
|
|
7599
7599
|
)
|
|
7600
7600
|
),
|
|
7601
7601
|
pendingMessageDeltas: new Map(
|
|
7602
7602
|
[...t.pendingMessageDeltas].filter(
|
|
7603
|
-
([
|
|
7603
|
+
([D]) => !o.has(D)
|
|
7604
7604
|
)
|
|
7605
7605
|
),
|
|
7606
7606
|
...i ? {
|
|
@@ -8164,23 +8164,23 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8164
8164
|
m.pendingCustomerMessage?.conversationId,
|
|
8165
8165
|
ye?.conversationId
|
|
8166
8166
|
].filter((L) => !!L)
|
|
8167
|
-
]),
|
|
8167
|
+
]), S = g.map(
|
|
8168
8168
|
(L) => Nn(
|
|
8169
8169
|
y.get(L.id),
|
|
8170
8170
|
L
|
|
8171
8171
|
).conversation
|
|
8172
8172
|
);
|
|
8173
|
-
for (const L of
|
|
8173
|
+
for (const L of S)
|
|
8174
8174
|
ct(L.id), Oe(L.id);
|
|
8175
8175
|
const C = new Set(
|
|
8176
|
-
|
|
8177
|
-
),
|
|
8176
|
+
S.map(({ id: L }) => L)
|
|
8177
|
+
), E = S.find(
|
|
8178
8178
|
(L) => L.isCurrent
|
|
8179
|
-
)?.id, k = l && (ye?.generation === l.generation || m.currentThreadId === l.conversationId) ? l.conversationId : void 0,
|
|
8179
|
+
)?.id, k = l && (ye?.generation === l.generation || m.currentThreadId === l.conversationId) ? l.conversationId : void 0, z = m.sendInFlight ? m.pendingCustomerMessage?.conversationId ?? m.currentThreadId : void 0, x = m.sendInFlight ? m.currentThreadId : void 0, D = d && $e === d ? m.currentThreadId : void 0, P = k ?? x ?? D ?? (r || Pe !== c ? m.currentThreadId : void 0), V = new Set(
|
|
8180
8180
|
[
|
|
8181
8181
|
k,
|
|
8182
|
-
|
|
8183
|
-
|
|
8182
|
+
z,
|
|
8183
|
+
D,
|
|
8184
8184
|
P,
|
|
8185
8185
|
...[...I].filter(
|
|
8186
8186
|
(L) => Xe(
|
|
@@ -8193,13 +8193,13 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8193
8193
|
m.pendingCustomerMessage?.conversationId
|
|
8194
8194
|
] : []
|
|
8195
8195
|
].filter((L) => !!L)
|
|
8196
|
-
),
|
|
8196
|
+
), B = (L) => Se.get(L)?.minimumRevision !== void 0 || _e.has(L);
|
|
8197
8197
|
let W = [
|
|
8198
|
-
...
|
|
8198
|
+
...S,
|
|
8199
8199
|
...m.conversations.filter(
|
|
8200
|
-
({ id: L }) => !C.has(L) && (!b ||
|
|
8200
|
+
({ id: L }) => !C.has(L) && (!b || V.has(L))
|
|
8201
8201
|
).map(
|
|
8202
|
-
(L) =>
|
|
8202
|
+
(L) => E && !P ? { ...L, isCurrent: !1 } : L
|
|
8203
8203
|
)
|
|
8204
8204
|
];
|
|
8205
8205
|
P && (W = W.map((L) => ({
|
|
@@ -8212,16 +8212,16 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8212
8212
|
let A = m;
|
|
8213
8213
|
const v = [...I].filter(
|
|
8214
8214
|
(L) => !C.has(L)
|
|
8215
|
-
),
|
|
8216
|
-
(L) => !
|
|
8217
|
-
) : [],
|
|
8215
|
+
), T = b ? v.filter(
|
|
8216
|
+
(L) => !V.has(L)
|
|
8217
|
+
) : [], O = new Set(
|
|
8218
8218
|
b ? [] : v
|
|
8219
8219
|
), G = /* @__PURE__ */ new Map();
|
|
8220
8220
|
for (const L of v) {
|
|
8221
8221
|
const Je = y.get(L);
|
|
8222
|
-
Je && (!b ||
|
|
8222
|
+
Je && (!b || B(L)) && G.set(L, Je), b && B(L) && O.add(L);
|
|
8223
8223
|
}
|
|
8224
|
-
for (const L of
|
|
8224
|
+
for (const L of T)
|
|
8225
8225
|
e().actions.cancelThreadMessagesRequest(L), A.sendInFlight && (A.currentThreadId === L || A.pendingCustomerMessage?.conversationId === L) && (Mt += 1), ye?.conversationId === L && (ye.controller.abort(), ye = null), ct(L), Oe(L), A = {
|
|
8226
8226
|
...A,
|
|
8227
8227
|
...Oi(
|
|
@@ -8245,10 +8245,10 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8245
8245
|
);
|
|
8246
8246
|
for (const L of _)
|
|
8247
8247
|
te.delete(L), oe.delete(L), ie.delete(L);
|
|
8248
|
-
const de = b ? /* @__PURE__ */ new Set([..._, ...
|
|
8248
|
+
const de = b ? /* @__PURE__ */ new Set([..._, ...V]) : /* @__PURE__ */ new Set([
|
|
8249
8249
|
..._,
|
|
8250
8250
|
...A.threadIds,
|
|
8251
|
-
...
|
|
8251
|
+
...O
|
|
8252
8252
|
]), pe = new Set(
|
|
8253
8253
|
[...A.loadedThreadIds].filter(
|
|
8254
8254
|
(L) => de.has(L)
|
|
@@ -8257,7 +8257,7 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8257
8257
|
[...A.threadMessagesNextCursor].filter(
|
|
8258
8258
|
([L]) => de.has(L)
|
|
8259
8259
|
)
|
|
8260
|
-
), $ = A.currentThreadId, me = P ||
|
|
8260
|
+
), $ = A.currentThreadId, me = P || E || ($ && de.has($) ? $ : void 0);
|
|
8261
8261
|
W = W.map((L) => ({
|
|
8262
8262
|
...L,
|
|
8263
8263
|
isCurrent: L.id === me
|
|
@@ -8289,7 +8289,7 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8289
8289
|
inactiveConversationIds: te,
|
|
8290
8290
|
inactiveConversationUpdatedAt: oe,
|
|
8291
8291
|
inactiveConversationRevalidation: ie,
|
|
8292
|
-
conversationScanCandidateIds:
|
|
8292
|
+
conversationScanCandidateIds: O,
|
|
8293
8293
|
conversationScanAuthorityVersion: b ? null : u,
|
|
8294
8294
|
conversationScanSnapshots: G,
|
|
8295
8295
|
typingByConversation: A.typingByConversation,
|
|
@@ -8370,8 +8370,8 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8370
8370
|
h.delete(N), p.delete(N);
|
|
8371
8371
|
if (c.nextCursor === null) {
|
|
8372
8372
|
for (const N of [...h]) {
|
|
8373
|
-
const _ = p.get(N), A = Se.get(N)?.minimumRevision !== void 0 || _e.has(N), v = l.conversationScanAuthorityVersion ?? o,
|
|
8374
|
-
if (ye?.conversationId === N ||
|
|
8373
|
+
const _ = p.get(N), A = Se.get(N)?.minimumRevision !== void 0 || _e.has(N), v = l.conversationScanAuthorityVersion ?? o, T = l.sendInFlight ? l.pendingCustomerMessage?.conversationId ?? l.currentThreadId : void 0;
|
|
8374
|
+
if (ye?.conversationId === N || T === N || l.sendInFlight && l.currentThreadId === N || $e !== null && l.currentThreadId === N || Xe(
|
|
8375
8375
|
N,
|
|
8376
8376
|
v
|
|
8377
8377
|
)) {
|
|
@@ -8411,44 +8411,44 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8411
8411
|
)
|
|
8412
8412
|
], I = g.find(
|
|
8413
8413
|
({ isCurrent: N }) => N
|
|
8414
|
-
)?.id, C = !!(I && !ye && !l.sendInFlight && $e === null && Pe === a) ? I : l.currentThreadId,
|
|
8414
|
+
)?.id, C = !!(I && !ye && !l.sendInFlight && $e === null && Pe === a) ? I : l.currentThreadId, E = y.map((N) => ({
|
|
8415
8415
|
...N,
|
|
8416
8416
|
isCurrent: N.id === C
|
|
8417
8417
|
})), k = C !== l.currentThreadId;
|
|
8418
8418
|
k && (Pe += 1);
|
|
8419
|
-
const
|
|
8419
|
+
const z = new Set(
|
|
8420
8420
|
l.assistantSuspendedConversationIds
|
|
8421
|
-
),
|
|
8421
|
+
), x = new Set(
|
|
8422
8422
|
l.inactiveConversationIds
|
|
8423
|
-
),
|
|
8423
|
+
), D = new Map(
|
|
8424
8424
|
l.inactiveConversationUpdatedAt
|
|
8425
8425
|
), P = new Map(
|
|
8426
8426
|
l.inactiveConversationRevalidation
|
|
8427
8427
|
);
|
|
8428
8428
|
for (const N of g)
|
|
8429
|
-
|
|
8430
|
-
const
|
|
8429
|
+
x.delete(N.id), D.delete(N.id), P.delete(N.id), ns(N) ? z.add(N.id) : z.delete(N.id);
|
|
8430
|
+
const V = ts(
|
|
8431
8431
|
l,
|
|
8432
8432
|
hr(
|
|
8433
8433
|
Ia(g, n),
|
|
8434
8434
|
l.scenarioChoiceLifecycleEvents
|
|
8435
8435
|
)
|
|
8436
|
-
),
|
|
8436
|
+
), B = l.messages, W = os(
|
|
8437
8437
|
l.pendingCustomerMessage,
|
|
8438
|
-
|
|
8438
|
+
V
|
|
8439
8439
|
), X = ss(
|
|
8440
8440
|
l.messageStreams,
|
|
8441
|
-
|
|
8441
|
+
V
|
|
8442
8442
|
);
|
|
8443
8443
|
t({
|
|
8444
|
-
conversations:
|
|
8444
|
+
conversations: E,
|
|
8445
8445
|
currentThreadId: C,
|
|
8446
8446
|
currentThreadMessages: k ? [
|
|
8447
8447
|
...C ? l.threads.get(C) ?? Fn : Fn
|
|
8448
8448
|
] : l.currentThreadMessages,
|
|
8449
|
-
assistantSuspendedConversationIds:
|
|
8450
|
-
inactiveConversationIds:
|
|
8451
|
-
inactiveConversationUpdatedAt:
|
|
8449
|
+
assistantSuspendedConversationIds: z,
|
|
8450
|
+
inactiveConversationIds: x,
|
|
8451
|
+
inactiveConversationUpdatedAt: D,
|
|
8452
8452
|
inactiveConversationRevalidation: P,
|
|
8453
8453
|
conversationScanCandidateIds: h,
|
|
8454
8454
|
conversationScanAuthorityVersion: c.nextCursor === null ? null : l.conversationScanAuthorityVersion,
|
|
@@ -8463,10 +8463,10 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8463
8463
|
l,
|
|
8464
8464
|
C,
|
|
8465
8465
|
W,
|
|
8466
|
-
!!(C &&
|
|
8466
|
+
!!(C && z.has(C))
|
|
8467
8467
|
),
|
|
8468
8468
|
messages: fr(
|
|
8469
|
-
|
|
8469
|
+
B,
|
|
8470
8470
|
W,
|
|
8471
8471
|
new Set(X.keys())
|
|
8472
8472
|
),
|
|
@@ -8529,7 +8529,7 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8529
8529
|
"Conversation selection returned a different resource"
|
|
8530
8530
|
);
|
|
8531
8531
|
const d = e().conversations.find(
|
|
8532
|
-
({ id:
|
|
8532
|
+
({ id: S }) => S === l.id
|
|
8533
8533
|
), p = d ?? e().conversationScanSnapshots.get(l.id), h = Nn(
|
|
8534
8534
|
p,
|
|
8535
8535
|
l
|
|
@@ -8582,11 +8582,11 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8582
8582
|
conversationScanCandidateIds: I,
|
|
8583
8583
|
conversationScanSnapshots: y,
|
|
8584
8584
|
conversations: d ? e().conversations.map(
|
|
8585
|
-
(
|
|
8585
|
+
(S) => S.id === l.id ? { ...h, isCurrent: !0 } : { ...S, isCurrent: !1 }
|
|
8586
8586
|
) : [
|
|
8587
8587
|
{ ...h, isCurrent: !0 },
|
|
8588
|
-
...e().conversations.map((
|
|
8589
|
-
...
|
|
8588
|
+
...e().conversations.map((S) => ({
|
|
8589
|
+
...S,
|
|
8590
8590
|
isCurrent: !1
|
|
8591
8591
|
}))
|
|
8592
8592
|
],
|
|
@@ -8641,10 +8641,10 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8641
8641
|
We?.abort(), We = null, Ln(), Ve?.abort(), Ve = null, t({ isLoadingMoreConversations: !1 });
|
|
8642
8642
|
const s = ye, i = s?.rollbackThreadId ?? e().currentThreadId, o = s?.rollbackThreadMessages ?? e().currentThreadMessages;
|
|
8643
8643
|
if (s?.controller.abort(), ye = null, s && e().currentThreadId === s.conversationId) {
|
|
8644
|
-
const
|
|
8644
|
+
const S = e();
|
|
8645
8645
|
t(
|
|
8646
8646
|
yr(
|
|
8647
|
-
|
|
8647
|
+
S,
|
|
8648
8648
|
i,
|
|
8649
8649
|
o
|
|
8650
8650
|
)
|
|
@@ -8658,7 +8658,7 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8658
8658
|
let d;
|
|
8659
8659
|
try {
|
|
8660
8660
|
d = await jh(n, r, u.signal);
|
|
8661
|
-
} catch (
|
|
8661
|
+
} catch (S) {
|
|
8662
8662
|
if (!u.signal.aborted && a === Pe && e().config && Ie(e().config) === l) {
|
|
8663
8663
|
const C = e();
|
|
8664
8664
|
t(
|
|
@@ -8669,7 +8669,7 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8669
8669
|
)
|
|
8670
8670
|
);
|
|
8671
8671
|
}
|
|
8672
|
-
throw
|
|
8672
|
+
throw S;
|
|
8673
8673
|
} finally {
|
|
8674
8674
|
$e === u && ($e = null);
|
|
8675
8675
|
}
|
|
@@ -8700,7 +8700,7 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8700
8700
|
);
|
|
8701
8701
|
y.delete(d.id);
|
|
8702
8702
|
const I = Nn(
|
|
8703
|
-
e().conversations.find(({ id:
|
|
8703
|
+
e().conversations.find(({ id: S }) => S === d.id),
|
|
8704
8704
|
d
|
|
8705
8705
|
).conversation;
|
|
8706
8706
|
return ct(d.id), Oe(d.id), Pe += 1, t({
|
|
@@ -8708,11 +8708,11 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8708
8708
|
currentThreadMessages: [],
|
|
8709
8709
|
conversations: [
|
|
8710
8710
|
{ ...I, isCurrent: !0 },
|
|
8711
|
-
...e().conversations.filter(({ id:
|
|
8711
|
+
...e().conversations.filter(({ id: S }) => S !== d.id).map((S) => ({ ...S, isCurrent: !1 }))
|
|
8712
8712
|
],
|
|
8713
8713
|
threadIds: [
|
|
8714
8714
|
d.id,
|
|
8715
|
-
...e().threadIds.filter((
|
|
8715
|
+
...e().threadIds.filter((S) => S !== d.id)
|
|
8716
8716
|
],
|
|
8717
8717
|
loadedThreadIds: new Set(e().loadedThreadIds).add(d.id),
|
|
8718
8718
|
threadMessagesNextCursor: new Map(e().threadMessagesNextCursor).set(
|
|
@@ -8729,7 +8729,7 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8729
8729
|
conversationScanSnapshots: b,
|
|
8730
8730
|
assistantSuspendedConversationIds: new Set(
|
|
8731
8731
|
[...e().assistantSuspendedConversationIds].filter(
|
|
8732
|
-
(
|
|
8732
|
+
(S) => S !== d.id
|
|
8733
8733
|
)
|
|
8734
8734
|
)
|
|
8735
8735
|
}), e().actions.updateThreads(), d.id;
|
|
@@ -8746,7 +8746,7 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8746
8746
|
), y = [
|
|
8747
8747
|
i?.updatedAt,
|
|
8748
8748
|
b
|
|
8749
|
-
].filter((I) => !!I).sort((I,
|
|
8749
|
+
].filter((I) => !!I).sort((I, S) => Date.parse(S) - Date.parse(I))[0];
|
|
8750
8750
|
(!y || Date.parse(s.updatedAt) >= Date.parse(y)) && Qt(
|
|
8751
8751
|
s.id,
|
|
8752
8752
|
s.updatedAt
|
|
@@ -8858,12 +8858,12 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8858
8858
|
},
|
|
8859
8859
|
handleMessageDelta: (n) => {
|
|
8860
8860
|
const r = e().messages.find(
|
|
8861
|
-
({ id:
|
|
8861
|
+
({ id: E }) => E === n.messageId
|
|
8862
8862
|
), s = r?.conversationId ?? r?.threadId, i = e().messageStreams.get(n.messageId);
|
|
8863
8863
|
if (Js.has(n.messageId) || n.requestId && Fr.has(n.requestId) || i?.requestId && n.requestId && i.requestId !== n.requestId || i?.conversationId && n.conversationId && i.conversationId !== n.conversationId || n.conversationId && s && n.conversationId !== s || n.conversationId && en(e(), n.conversationId) || e().concealedMessageIds.has(n.messageId))
|
|
8864
8864
|
return;
|
|
8865
8865
|
const o = e().pendingCustomerMessage, a = !!(o && n.requestId === o.id), u = n.conversationId ?? s ?? i?.conversationId, c = n.requestId ? [...ht.values()].find(
|
|
8866
|
-
({ requestId:
|
|
8866
|
+
({ requestId: E }) => E === n.requestId
|
|
8867
8867
|
)?.conversationId : void 0;
|
|
8868
8868
|
if ((a && o.conversationId || c) && u && (o?.conversationId ?? c) !== u)
|
|
8869
8869
|
return;
|
|
@@ -8874,34 +8874,34 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8874
8874
|
return;
|
|
8875
8875
|
const d = u;
|
|
8876
8876
|
if (d && Oe(d), a) {
|
|
8877
|
-
const
|
|
8878
|
-
|
|
8877
|
+
const E = o.conversationId ?? u;
|
|
8878
|
+
E && fi(
|
|
8879
8879
|
o.id,
|
|
8880
|
-
|
|
8880
|
+
E,
|
|
8881
8881
|
o.createdAt
|
|
8882
8882
|
), t({
|
|
8883
|
-
...!e().currentThreadId &&
|
|
8883
|
+
...!e().currentThreadId && E ? { currentThreadId: E } : {},
|
|
8884
8884
|
pendingCustomerMessage: {
|
|
8885
8885
|
...o,
|
|
8886
8886
|
acknowledged: !0,
|
|
8887
|
-
acceptanceConfirmed: !!
|
|
8888
|
-
conversationId:
|
|
8887
|
+
acceptanceConfirmed: !!E,
|
|
8888
|
+
conversationId: E
|
|
8889
8889
|
}
|
|
8890
8890
|
});
|
|
8891
8891
|
}
|
|
8892
8892
|
const p = e().messages.findIndex(
|
|
8893
|
-
({ id:
|
|
8893
|
+
({ id: E }) => E === n.messageId
|
|
8894
8894
|
);
|
|
8895
8895
|
if (p === -1) {
|
|
8896
|
-
const
|
|
8897
|
-
if (
|
|
8898
|
-
e().actions.handleMessage(
|
|
8896
|
+
const E = Im(e(), n);
|
|
8897
|
+
if (E) {
|
|
8898
|
+
e().actions.handleMessage(E), e().actions.handleMessageDelta(n);
|
|
8899
8899
|
return;
|
|
8900
8900
|
}
|
|
8901
8901
|
const k = new Map(e().pendingMessageDeltas);
|
|
8902
8902
|
if (!k.has(n.messageId) && k.size >= am) {
|
|
8903
|
-
const
|
|
8904
|
-
|
|
8903
|
+
const z = k.keys().next().value;
|
|
8904
|
+
z && k.delete(z);
|
|
8905
8905
|
}
|
|
8906
8906
|
k.set(n.messageId, n), t({ pendingMessageDeltas: k });
|
|
8907
8907
|
return;
|
|
@@ -8930,19 +8930,19 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8930
8930
|
});
|
|
8931
8931
|
return;
|
|
8932
8932
|
}
|
|
8933
|
-
const y = (/* @__PURE__ */ new Date()).toISOString(), I = f ? ht.get(f) : void 0,
|
|
8933
|
+
const y = (/* @__PURE__ */ new Date()).toISOString(), I = f ? ht.get(f) : void 0, S = g.get(n.messageId), C = !!(I && (n.requestId === I.requestId || S?.requestId === I.requestId));
|
|
8934
8934
|
C && f && ht.delete(f), t({
|
|
8935
8935
|
messageStreams: g,
|
|
8936
8936
|
latestMessageDate: y,
|
|
8937
8937
|
responsePhase: b && C ? "idle" : e().responsePhase,
|
|
8938
8938
|
messages: e().messages.map(
|
|
8939
|
-
(
|
|
8940
|
-
...
|
|
8939
|
+
(E, k) => k === p ? {
|
|
8940
|
+
...E,
|
|
8941
8941
|
status: fe.Completed,
|
|
8942
8942
|
content: Ac(n.text),
|
|
8943
8943
|
updatedAt: y,
|
|
8944
8944
|
lastThreadMessageAt: y
|
|
8945
|
-
} :
|
|
8945
|
+
} : E
|
|
8946
8946
|
)
|
|
8947
8947
|
}), e().actions.updateThreads();
|
|
8948
8948
|
},
|
|
@@ -8971,75 +8971,75 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
8971
8971
|
return "IGNORED";
|
|
8972
8972
|
const d = Ar(o), p = o.author.type === Te.Agent, h = p && o.author.role === "ASSISTANT", m = e().messages.findIndex(
|
|
8973
8973
|
(v) => v.id === o.id || !!(o.author.type === Te.Customer && v.author.type === Te.Customer && (v.conversationId ?? v.threadId) === r && o.clientMessageId && (v.id === o.clientMessageId || v.clientMessageId === o.clientMessageId))
|
|
8974
|
-
), g = m === -1 ? void 0 : e().messages[m], b = !!(g && g.id !== o.id), y = e().messageStreams.get(o.id), I = o.author.role === "SCENARIO" && o.status === fe.Completed ? Ts(o) : "",
|
|
8974
|
+
), g = m === -1 ? void 0 : e().messages[m], b = !!(g && g.id !== o.id), y = e().messageStreams.get(o.id), I = o.author.role === "SCENARIO" && o.status === fe.Completed ? Ts(o) : "", S = !y && I && (m === -1 || g?.status === fe.Writing) ? jo(void 0, {
|
|
8975
8975
|
messageId: o.id,
|
|
8976
8976
|
sequence: o.ordinal ?? 0,
|
|
8977
8977
|
text: I,
|
|
8978
8978
|
done: !0
|
|
8979
|
-
}) : void 0, C = y ??
|
|
8980
|
-
let k = o,
|
|
8979
|
+
}) : void 0, C = y ?? S, E = !!C || !Vi(o);
|
|
8980
|
+
let k = o, z = !1;
|
|
8981
8981
|
if (m !== -1) {
|
|
8982
|
-
const v = g,
|
|
8982
|
+
const v = g, T = vc(
|
|
8983
8983
|
v,
|
|
8984
8984
|
o
|
|
8985
|
-
),
|
|
8986
|
-
|
|
8985
|
+
), O = T.status === fe.Writing && Ar(v), G = !b && Date.parse(v.updatedAt) > Date.parse(T.updatedAt), j = T.status === fe.Writing && !!C;
|
|
8986
|
+
z = G || O, k = G || O ? {
|
|
8987
8987
|
...v,
|
|
8988
8988
|
author: qn(
|
|
8989
8989
|
v.author,
|
|
8990
|
-
|
|
8990
|
+
T.author
|
|
8991
8991
|
)
|
|
8992
8992
|
} : j ? {
|
|
8993
|
-
...
|
|
8993
|
+
...T,
|
|
8994
8994
|
author: qn(
|
|
8995
8995
|
v.author,
|
|
8996
|
-
|
|
8996
|
+
T.author
|
|
8997
8997
|
),
|
|
8998
8998
|
status: C.done ? fe.Completed : fe.Writing,
|
|
8999
8999
|
content: v.content,
|
|
9000
9000
|
updatedAt: v.updatedAt,
|
|
9001
9001
|
lastThreadMessageAt: v.lastThreadMessageAt
|
|
9002
9002
|
} : {
|
|
9003
|
-
...
|
|
9003
|
+
...T,
|
|
9004
9004
|
author: qn(
|
|
9005
9005
|
v.author,
|
|
9006
|
-
|
|
9006
|
+
T.author
|
|
9007
9007
|
)
|
|
9008
9008
|
}, b && k.attachments.length === 0 && v.attachments.length > 0 && (k = { ...k, attachments: v.attachments });
|
|
9009
9009
|
}
|
|
9010
|
-
const
|
|
9011
|
-
if (
|
|
9010
|
+
const x = !!(g && (Ds(o.author) > Ds(g.author) || !g.author.role && o.author.role));
|
|
9011
|
+
if (z && !x && !l)
|
|
9012
9012
|
return "IGNORED";
|
|
9013
9013
|
Oe(r);
|
|
9014
|
-
const
|
|
9014
|
+
const D = !p && o.author.type === Te.Customer && m === -1, P = !!(c && (o.id === c.id || o.clientMessageId === c.id || C?.requestId === c.id)), V = !!(c && P);
|
|
9015
9015
|
P && o.author.type === Te.Customer && fi(
|
|
9016
9016
|
c.id,
|
|
9017
9017
|
r,
|
|
9018
9018
|
c.createdAt,
|
|
9019
9019
|
o.id
|
|
9020
9020
|
);
|
|
9021
|
-
const
|
|
9022
|
-
P && Oe(r),
|
|
9021
|
+
const B = !!(!e().currentThreadId && V), W = e().currentThreadId === r || B;
|
|
9022
|
+
P && Oe(r), V && D && k.attachments.length === 0 && c.attachments.length > 0 && (k = {
|
|
9023
9023
|
...k,
|
|
9024
9024
|
attachments: c.attachments
|
|
9025
9025
|
});
|
|
9026
9026
|
const X = h && d ? Xt(e(), r, [k]) : e().responsePhase;
|
|
9027
9027
|
t({
|
|
9028
|
-
messages:
|
|
9029
|
-
(v,
|
|
9028
|
+
messages: E ? m === -1 ? [...e().messages, k] : e().messages.map(
|
|
9029
|
+
(v, T) => T === m ? { ...k, agenticSteps: v.agenticSteps } : v
|
|
9030
9030
|
) : e().messages.filter(({ id: v }) => v !== o.id),
|
|
9031
|
-
...
|
|
9032
|
-
pendingCustomerMessage:
|
|
9031
|
+
...B ? { currentThreadId: r } : {},
|
|
9032
|
+
pendingCustomerMessage: V ? {
|
|
9033
9033
|
...c,
|
|
9034
9034
|
acknowledged: !0,
|
|
9035
9035
|
acceptanceConfirmed: c.acceptanceConfirmed === !0 || P,
|
|
9036
9036
|
conversationId: c.conversationId ?? r,
|
|
9037
|
-
canonicalMessageId:
|
|
9037
|
+
canonicalMessageId: D ? o.id : c.canonicalMessageId
|
|
9038
9038
|
} : c,
|
|
9039
|
-
...
|
|
9039
|
+
...S ? {
|
|
9040
9040
|
messageStreams: new Map(e().messageStreams).set(
|
|
9041
9041
|
o.id,
|
|
9042
|
-
|
|
9042
|
+
S
|
|
9043
9043
|
)
|
|
9044
9044
|
} : {}
|
|
9045
9045
|
});
|
|
@@ -9057,7 +9057,7 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
9057
9057
|
const v = new Map(e().pendingMessageDeltas);
|
|
9058
9058
|
v.delete(o.id), t({ pendingMessageDeltas: v }), e().actions.handleMessageDelta(A);
|
|
9059
9059
|
}
|
|
9060
|
-
return
|
|
9060
|
+
return E ? m === -1 ? "INSERTED" : g?.status !== fe.Completed && k.status === fe.Completed || g !== void 0 && ym(g, k) ? "UPDATED" : "DUPLICATE" : "IGNORED";
|
|
9061
9061
|
},
|
|
9062
9062
|
handleResponderPresentationChanged: (n) => {
|
|
9063
9063
|
if (e().concealedConversationIds.has(n.conversationId)) return;
|
|
@@ -9171,47 +9171,47 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
9171
9171
|
e().inactiveConversationIds
|
|
9172
9172
|
);
|
|
9173
9173
|
C.delete(h.id);
|
|
9174
|
-
const
|
|
9174
|
+
const E = new Map(
|
|
9175
9175
|
e().inactiveConversationUpdatedAt
|
|
9176
9176
|
);
|
|
9177
|
-
|
|
9177
|
+
E.delete(h.id);
|
|
9178
9178
|
const k = new Map(
|
|
9179
9179
|
e().inactiveConversationRevalidation
|
|
9180
9180
|
);
|
|
9181
9181
|
k.delete(h.id);
|
|
9182
|
-
const
|
|
9182
|
+
const z = new Map(
|
|
9183
9183
|
e().conversationScanSnapshots
|
|
9184
9184
|
);
|
|
9185
|
-
|
|
9186
|
-
const
|
|
9185
|
+
z.delete(h.id);
|
|
9186
|
+
const x = new Set(
|
|
9187
9187
|
e().conversationScanCandidateIds
|
|
9188
9188
|
);
|
|
9189
|
-
|
|
9190
|
-
const
|
|
9191
|
-
(
|
|
9189
|
+
x.delete(h.id);
|
|
9190
|
+
const D = e().currentThreadId, P = g ? e().conversations.map(
|
|
9191
|
+
(V) => V.id === h.id ? {
|
|
9192
9192
|
...y.conversation,
|
|
9193
|
-
isCurrent: h.id ===
|
|
9193
|
+
isCurrent: h.id === D
|
|
9194
9194
|
} : {
|
|
9195
|
-
...
|
|
9196
|
-
isCurrent:
|
|
9195
|
+
...V,
|
|
9196
|
+
isCurrent: V.id === D
|
|
9197
9197
|
}
|
|
9198
9198
|
) : [
|
|
9199
9199
|
{
|
|
9200
9200
|
...y.conversation,
|
|
9201
|
-
isCurrent: h.id ===
|
|
9201
|
+
isCurrent: h.id === D
|
|
9202
9202
|
},
|
|
9203
|
-
...e().conversations.filter(({ id:
|
|
9204
|
-
...
|
|
9205
|
-
isCurrent:
|
|
9203
|
+
...e().conversations.filter(({ id: V }) => V !== h.id).map((V) => ({
|
|
9204
|
+
...V,
|
|
9205
|
+
isCurrent: V.id === D
|
|
9206
9206
|
}))
|
|
9207
9207
|
];
|
|
9208
9208
|
t({
|
|
9209
9209
|
conversations: P,
|
|
9210
9210
|
inactiveConversationIds: C,
|
|
9211
|
-
inactiveConversationUpdatedAt:
|
|
9211
|
+
inactiveConversationUpdatedAt: E,
|
|
9212
9212
|
inactiveConversationRevalidation: k,
|
|
9213
|
-
conversationScanCandidateIds:
|
|
9214
|
-
conversationScanSnapshots:
|
|
9213
|
+
conversationScanCandidateIds: x,
|
|
9214
|
+
conversationScanSnapshots: z,
|
|
9215
9215
|
threadIds: e().threadIds.includes(h.id) ? e().threadIds : [h.id, ...e().threadIds]
|
|
9216
9216
|
}), e().actions.updateThreads();
|
|
9217
9217
|
};
|
|
@@ -9251,12 +9251,12 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
9251
9251
|
);
|
|
9252
9252
|
return;
|
|
9253
9253
|
}
|
|
9254
|
-
const
|
|
9254
|
+
const S = new Set(
|
|
9255
9255
|
e().assistantSuspendedConversationIds
|
|
9256
9256
|
);
|
|
9257
9257
|
ns(
|
|
9258
9258
|
y.conversation
|
|
9259
|
-
) ?
|
|
9259
|
+
) ? S.add(h.id) : S.delete(h.id), I(), t({ assistantSuspendedConversationIds: S }), nn({
|
|
9260
9260
|
contractVersion: 1,
|
|
9261
9261
|
signal: "PROJECTION",
|
|
9262
9262
|
outcome: "REST_RECONCILED"
|
|
@@ -9410,7 +9410,7 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
9410
9410
|
c
|
|
9411
9411
|
), f = !!(a === void 0 && e().currentThreadId === p.conversationId && (e().pendingCustomerMessage?.id === c || h.has(p.conversationId))), m = Pe === o && (a === void 0 || e().currentThreadId === a) || f;
|
|
9412
9412
|
if ([...h].some(
|
|
9413
|
-
(
|
|
9413
|
+
(x) => x !== p.conversationId
|
|
9414
9414
|
)) {
|
|
9415
9415
|
d();
|
|
9416
9416
|
return;
|
|
@@ -9441,14 +9441,14 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
9441
9441
|
e().conversationScanSnapshots
|
|
9442
9442
|
);
|
|
9443
9443
|
I.delete(p.conversationId);
|
|
9444
|
-
const
|
|
9444
|
+
const S = new Set(
|
|
9445
9445
|
e().conversationScanCandidateIds
|
|
9446
9446
|
);
|
|
9447
|
-
|
|
9448
|
-
const C = e().pendingCustomerMessage,
|
|
9447
|
+
S.delete(p.conversationId);
|
|
9448
|
+
const C = e().pendingCustomerMessage, E = new Set(
|
|
9449
9449
|
e().assistantSuspendedConversationIds
|
|
9450
9450
|
), k = e().conversations.find(
|
|
9451
|
-
({ id:
|
|
9451
|
+
({ id: x }) => x === p.conversationId
|
|
9452
9452
|
);
|
|
9453
9453
|
fi(
|
|
9454
9454
|
c,
|
|
@@ -9461,14 +9461,14 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
9461
9461
|
p.aiSuspension
|
|
9462
9462
|
), on.get(
|
|
9463
9463
|
p.conversationId
|
|
9464
|
-
)?.suspended ?? lm(k, p.aiSuspension) ?
|
|
9464
|
+
)?.suspended ?? lm(k, p.aiSuspension) ? E.add(p.conversationId) : E.delete(p.conversationId), p.assistantAdmitted || ht.delete(p.conversationId), t({
|
|
9465
9465
|
...m ? { currentThreadId: p.conversationId } : {},
|
|
9466
9466
|
inactiveConversationIds: g,
|
|
9467
9467
|
inactiveConversationUpdatedAt: b,
|
|
9468
9468
|
inactiveConversationRevalidation: y,
|
|
9469
|
-
conversationScanCandidateIds:
|
|
9469
|
+
conversationScanCandidateIds: S,
|
|
9470
9470
|
conversationScanSnapshots: I,
|
|
9471
|
-
assistantSuspendedConversationIds:
|
|
9471
|
+
assistantSuspendedConversationIds: E,
|
|
9472
9472
|
...m ? {
|
|
9473
9473
|
responsePhase: p.assistantAdmitted ? e().responsePhase : "idle"
|
|
9474
9474
|
} : {},
|
|
@@ -9480,10 +9480,10 @@ const Se = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), _e = /* @_
|
|
|
9480
9480
|
readByAssistant: p.assistantAdmitted
|
|
9481
9481
|
} : C
|
|
9482
9482
|
});
|
|
9483
|
-
for (const [
|
|
9484
|
-
if (
|
|
9483
|
+
for (const [x, D] of e().pendingMessageDeltas)
|
|
9484
|
+
if (D.requestId === c) {
|
|
9485
9485
|
const P = new Map(e().pendingMessageDeltas);
|
|
9486
|
-
P.delete(
|
|
9486
|
+
P.delete(x), t({ pendingMessageDeltas: P }), e().actions.handleMessageDelta(D);
|
|
9487
9487
|
}
|
|
9488
9488
|
p.assistantMessage && e().actions.handleMessage({
|
|
9489
9489
|
...p.assistantMessage,
|
|
@@ -12496,25 +12496,26 @@ class ib {
|
|
|
12496
12496
|
}
|
|
12497
12497
|
submit(e) {
|
|
12498
12498
|
const n = mr(e), r = this.entries.get(n);
|
|
12499
|
-
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12499
|
+
return r ? r.snapshot.status === "terminal" || r.snapshot.status === "submitting" || !r.input ? r.inFlight ?? Promise.resolve() : r.input.optionId !== e.optionId ? r.snapshot.status !== "error" ? r.inFlight ?? Promise.resolve() : this.startSubmissionWithNewIdentity(n, e) : (this.startConfirmationWindow(n, r), r.snapshot = Object.freeze({
|
|
12500
|
+
...r.snapshot,
|
|
12501
|
+
status: "submitting",
|
|
12502
|
+
lastOutcome: null,
|
|
12503
|
+
failure: null
|
|
12504
|
+
}), this.emit(n), this.send(n, r)) : this.startSubmissionWithNewIdentity(n, e);
|
|
12505
|
+
}
|
|
12506
|
+
startSubmissionWithNewIdentity(e, n) {
|
|
12507
|
+
const r = n.presentationContext ? Object.freeze({ ...n.presentationContext }) : void 0, s = Object.freeze({
|
|
12508
|
+
inputRequestId: n.inputRequestId,
|
|
12509
|
+
optionId: n.optionId,
|
|
12509
12510
|
clientEventId: this.createClientEventId(),
|
|
12510
|
-
...
|
|
12511
|
-
}),
|
|
12512
|
-
input:
|
|
12511
|
+
...r ? { presentationContext: r } : {}
|
|
12512
|
+
}), i = {
|
|
12513
|
+
input: s,
|
|
12513
12514
|
snapshot: Object.freeze({
|
|
12514
12515
|
status: "submitting",
|
|
12515
|
-
clientEventId:
|
|
12516
|
-
selectedOptionId:
|
|
12517
|
-
presentationContext:
|
|
12516
|
+
clientEventId: s.clientEventId,
|
|
12517
|
+
selectedOptionId: s.optionId,
|
|
12518
|
+
presentationContext: s.presentationContext ?? null,
|
|
12518
12519
|
lastOutcome: null,
|
|
12519
12520
|
failure: null
|
|
12520
12521
|
}),
|
|
@@ -12524,7 +12525,7 @@ class ib {
|
|
|
12524
12525
|
retryTimer: null,
|
|
12525
12526
|
transportAttempt: 0
|
|
12526
12527
|
};
|
|
12527
|
-
return this.entries.set(
|
|
12528
|
+
return this.entries.set(e, i), this.startConfirmationWindow(e, i), this.emit(e), this.pruneEntries(), this.send(e, i);
|
|
12528
12529
|
}
|
|
12529
12530
|
handleLifecycle(e, n) {
|
|
12530
12531
|
if (n.status === "PENDING") return;
|
|
@@ -12660,76 +12661,75 @@ const qc = Kn(void 0), ob = (t, e, n) => new Rh(t, e, n), ab = (t, e, n, r = {},
|
|
|
12660
12661
|
l($t.Available);
|
|
12661
12662
|
}, b = () => {
|
|
12662
12663
|
navigator.onLine && l(
|
|
12663
|
-
(
|
|
12664
|
+
(C) => C === $t.Offline ? $t.Available : C
|
|
12664
12665
|
);
|
|
12665
|
-
}
|
|
12666
|
-
let y = !0;
|
|
12667
|
-
const I = () => {
|
|
12668
|
-
y = !1;
|
|
12669
|
-
}, E = () => {
|
|
12670
|
-
y = !0;
|
|
12671
|
-
}, C = s(
|
|
12666
|
+
}, y = s(
|
|
12672
12667
|
bl(t.customerInteractionSession.accessToken),
|
|
12673
|
-
(
|
|
12668
|
+
(C) => {
|
|
12674
12669
|
g();
|
|
12675
|
-
const
|
|
12676
|
-
messageActions:
|
|
12670
|
+
const E = K.getState().actions, k = tg(C, {
|
|
12671
|
+
messageActions: E,
|
|
12677
12672
|
commandRuntime: e,
|
|
12678
12673
|
session: t.customerInteractionSession,
|
|
12679
|
-
|
|
12680
|
-
|
|
12674
|
+
// Cable history is deduplicated against the durable message store.
|
|
12675
|
+
// Treat accepted inserts and material updates as live so a genuinely
|
|
12676
|
+
// new Scenario message cannot be hidden merely because it arrived
|
|
12677
|
+
// before a restored connection's history terminal event. REST
|
|
12678
|
+
// hydration is still classified explicitly by ChatWidget.
|
|
12679
|
+
realtimeMessageSource: "LIVE",
|
|
12680
|
+
sendAck: (x) => y.acknowledgeCommand(x),
|
|
12681
12681
|
onPresenceOnline: g,
|
|
12682
12682
|
onScenarioConversation: u,
|
|
12683
12683
|
onRealtimeMessage: i,
|
|
12684
|
-
onScenarioChoiceLifecycle: (
|
|
12684
|
+
onScenarioChoiceLifecycle: (x) => {
|
|
12685
12685
|
h.handleLifecycle(
|
|
12686
12686
|
{
|
|
12687
12687
|
principalId: t.customerInteractionSession.interactionSessionId,
|
|
12688
|
-
inputRequestId:
|
|
12688
|
+
inputRequestId: x.inputRequestId
|
|
12689
12689
|
},
|
|
12690
|
-
|
|
12691
|
-
), o?.(
|
|
12690
|
+
x.lifecycle
|
|
12691
|
+
), o?.(x);
|
|
12692
12692
|
},
|
|
12693
|
-
onScenarioChoiceSubmissionResult: (
|
|
12693
|
+
onScenarioChoiceSubmissionResult: (x) => {
|
|
12694
12694
|
h.handleResult(
|
|
12695
12695
|
t.customerInteractionSession.interactionSessionId,
|
|
12696
|
-
|
|
12697
|
-
), a?.(
|
|
12696
|
+
x
|
|
12697
|
+
), a?.(x);
|
|
12698
12698
|
}
|
|
12699
|
-
}),
|
|
12700
|
-
|
|
12701
|
-
messageId:
|
|
12699
|
+
}), z = Sc(C);
|
|
12700
|
+
z?.delivery && z.delivery.status !== "DELIVERED" && z.delivery.status !== "READ" && y.acknowledgeMessageDelivery({
|
|
12701
|
+
messageId: z.id,
|
|
12702
12702
|
status: "delivered"
|
|
12703
12703
|
}).catch(
|
|
12704
|
-
(
|
|
12705
|
-
),
|
|
12706
|
-
(
|
|
12704
|
+
(x) => re.warn("Message delivery acknowledgement failed", x)
|
|
12705
|
+
), k && k.catch(
|
|
12706
|
+
(x) => re.warn("Command acknowledgement failed", x)
|
|
12707
12707
|
);
|
|
12708
12708
|
},
|
|
12709
12709
|
n
|
|
12710
12710
|
);
|
|
12711
12711
|
h.setTransport(
|
|
12712
|
-
(
|
|
12713
|
-
),
|
|
12714
|
-
(
|
|
12715
|
-
}),
|
|
12716
|
-
|
|
12717
|
-
}),
|
|
12718
|
-
|
|
12712
|
+
(C) => y.submitScenarioChoice(C)
|
|
12713
|
+
), y.channels.chat.on("info", (C) => {
|
|
12714
|
+
(C.type === "history_not_found" || C.type === "reject_history") && re.warn("Realtime history was rejected");
|
|
12715
|
+
}), y.channels.chat.on("connect", () => {
|
|
12716
|
+
console.info("[CableContext] Connected to the chat channel"), p(y), g();
|
|
12717
|
+
}), y.channels.chat.on("disconnect", (C) => {
|
|
12718
|
+
K.getState().actions.clearTransientRealtimeState(), Us(C) && n?.(), l(
|
|
12719
12719
|
navigator.onLine ? $t.Unavailable : $t.Offline
|
|
12720
|
-
), console.warn("[CableContext] Disconnected from the chat channel",
|
|
12720
|
+
), console.warn("[CableContext] Disconnected from the chat channel", C);
|
|
12721
12721
|
});
|
|
12722
|
-
const
|
|
12722
|
+
const I = () => {
|
|
12723
12723
|
document.visibilityState === "visible" && b();
|
|
12724
|
-
},
|
|
12724
|
+
}, S = () => {
|
|
12725
12725
|
l($t.Offline);
|
|
12726
12726
|
};
|
|
12727
|
-
return window.addEventListener("online", b), window.addEventListener("offline",
|
|
12728
|
-
console.warn("[CableContext] Closed the chat channel",
|
|
12727
|
+
return window.addEventListener("online", b), window.addEventListener("offline", S), window.addEventListener("focus", b), document.addEventListener("visibilitychange", I), y.channels.chat.on("close", (C) => {
|
|
12728
|
+
console.warn("[CableContext] Closed the chat channel", C);
|
|
12729
12729
|
}), () => {
|
|
12730
|
-
|
|
12730
|
+
y.unregister(), h.setTransport(
|
|
12731
12731
|
() => Promise.reject(new Error("Cable is not ready"))
|
|
12732
|
-
), window.removeEventListener("online", b), window.removeEventListener("offline",
|
|
12732
|
+
), window.removeEventListener("online", b), window.removeEventListener("offline", S), window.removeEventListener("focus", b), document.removeEventListener("visibilitychange", I);
|
|
12733
12733
|
};
|
|
12734
12734
|
}, [
|
|
12735
12735
|
e,
|
|
@@ -13129,33 +13129,33 @@ class _b {
|
|
|
13129
13129
|
let s = null, i = null, o = null, a = null;
|
|
13130
13130
|
const u = /* @__PURE__ */ new Set();
|
|
13131
13131
|
let c = !1, l = !1, d, p;
|
|
13132
|
-
const h = new Promise((C,
|
|
13133
|
-
d = C, p =
|
|
13132
|
+
const h = new Promise((C, E) => {
|
|
13133
|
+
d = C, p = E;
|
|
13134
13134
|
}), f = () => {
|
|
13135
13135
|
c || (c = !0, u.forEach((C) => clearTimeout(C)), u.clear(), r.abort(), o?.cancel().catch(() => {
|
|
13136
13136
|
}), i && (i.port.onmessage = null, i.disconnect()), s?.close().catch(() => {
|
|
13137
13137
|
}), this.active === I && (this.active = null));
|
|
13138
|
-
}, m = (C,
|
|
13138
|
+
}, m = (C, E) => {
|
|
13139
13139
|
if (c) return;
|
|
13140
13140
|
const k = s ? Db(s) : null;
|
|
13141
13141
|
if (k === null || !Number.isFinite(C) || !s || C <= k) {
|
|
13142
|
-
|
|
13142
|
+
E();
|
|
13143
13143
|
return;
|
|
13144
13144
|
}
|
|
13145
|
-
const
|
|
13145
|
+
const z = Math.min(
|
|
13146
13146
|
xb,
|
|
13147
13147
|
(C - k) / s.sampleRate * 1e3
|
|
13148
|
-
),
|
|
13149
|
-
u.delete(
|
|
13150
|
-
},
|
|
13151
|
-
u.add(
|
|
13148
|
+
), x = setTimeout(() => {
|
|
13149
|
+
u.delete(x), c || E();
|
|
13150
|
+
}, z);
|
|
13151
|
+
u.add(x);
|
|
13152
13152
|
}, g = (C) => {
|
|
13153
13153
|
if (!l) {
|
|
13154
13154
|
l = !0;
|
|
13155
13155
|
try {
|
|
13156
13156
|
n.onStopped?.(C);
|
|
13157
|
-
} catch (
|
|
13158
|
-
re.warn("Speech playback stopped callback failed",
|
|
13157
|
+
} catch (E) {
|
|
13158
|
+
re.warn("Speech playback stopped callback failed", E);
|
|
13159
13159
|
}
|
|
13160
13160
|
}
|
|
13161
13161
|
}, b = (C) => {
|
|
@@ -13177,10 +13177,10 @@ class _b {
|
|
|
13177
13177
|
r.signal
|
|
13178
13178
|
);
|
|
13179
13179
|
a = e(r.signal).then(
|
|
13180
|
-
(
|
|
13181
|
-
(
|
|
13180
|
+
(D) => ({ ok: !0, stream: D }),
|
|
13181
|
+
(D) => ({ ok: !1, error: D })
|
|
13182
13182
|
);
|
|
13183
|
-
const [, ,
|
|
13183
|
+
const [, , E] = await Hc(
|
|
13184
13184
|
Promise.all([
|
|
13185
13185
|
C,
|
|
13186
13186
|
s.audioWorklet.addModule(kb),
|
|
@@ -13191,11 +13191,11 @@ class _b {
|
|
|
13191
13191
|
r.signal
|
|
13192
13192
|
);
|
|
13193
13193
|
if (c) {
|
|
13194
|
-
|
|
13194
|
+
E.ok && await E.stream.cancel();
|
|
13195
13195
|
return;
|
|
13196
13196
|
}
|
|
13197
|
-
if (!
|
|
13198
|
-
const k =
|
|
13197
|
+
if (!E.ok) throw E.error;
|
|
13198
|
+
const k = E.stream;
|
|
13199
13199
|
if (i = new AudioWorkletNode(s, "lola-pcm-playback", {
|
|
13200
13200
|
numberOfInputs: 0,
|
|
13201
13201
|
numberOfOutputs: 1,
|
|
@@ -13204,9 +13204,9 @@ class _b {
|
|
|
13204
13204
|
sourceSampleRate: n.sampleRate,
|
|
13205
13205
|
jitterBufferMs: n.jitterBufferMs ?? 500
|
|
13206
13206
|
}
|
|
13207
|
-
}), i.port.onmessage = (
|
|
13208
|
-
if (
|
|
13209
|
-
re.debug("Scenario speech playback started"), m(
|
|
13207
|
+
}), i.port.onmessage = (D) => {
|
|
13208
|
+
if (D.data.type === "started") {
|
|
13209
|
+
re.debug("Scenario speech playback started"), m(D.data.renderContextFrame, () => {
|
|
13210
13210
|
try {
|
|
13211
13211
|
n.onStarted?.();
|
|
13212
13212
|
} catch (P) {
|
|
@@ -13215,39 +13215,39 @@ class _b {
|
|
|
13215
13215
|
});
|
|
13216
13216
|
return;
|
|
13217
13217
|
}
|
|
13218
|
-
if (
|
|
13218
|
+
if (D.data.type === "progress") {
|
|
13219
13219
|
const P = {
|
|
13220
|
-
sourceSample:
|
|
13221
|
-
renderContextFrame:
|
|
13222
|
-
mouthOpen:
|
|
13223
|
-
peak:
|
|
13220
|
+
sourceSample: D.data.sourceSample,
|
|
13221
|
+
renderContextFrame: D.data.renderContextFrame,
|
|
13222
|
+
mouthOpen: D.data.mouthOpen,
|
|
13223
|
+
peak: D.data.peak
|
|
13224
13224
|
};
|
|
13225
|
-
m(
|
|
13225
|
+
m(D.data.renderContextFrame, () => {
|
|
13226
13226
|
try {
|
|
13227
13227
|
n.onProgress?.(P);
|
|
13228
|
-
} catch (
|
|
13229
|
-
re.warn("Speech playback progress callback failed",
|
|
13228
|
+
} catch (V) {
|
|
13229
|
+
re.warn("Speech playback progress callback failed", V);
|
|
13230
13230
|
}
|
|
13231
13231
|
});
|
|
13232
13232
|
return;
|
|
13233
13233
|
}
|
|
13234
|
-
if (
|
|
13235
|
-
const P =
|
|
13236
|
-
m(
|
|
13234
|
+
if (D.data.type === "underrun" || D.data.type === "resumed") {
|
|
13235
|
+
const P = D.data.type;
|
|
13236
|
+
m(D.data.renderContextFrame, () => {
|
|
13237
13237
|
try {
|
|
13238
13238
|
P === "underrun" ? n.onUnderrun?.() : n.onResumed?.();
|
|
13239
|
-
} catch (
|
|
13240
|
-
re.warn("Speech playback lifecycle callback failed",
|
|
13239
|
+
} catch (V) {
|
|
13240
|
+
re.warn("Speech playback lifecycle callback failed", V);
|
|
13241
13241
|
}
|
|
13242
13242
|
});
|
|
13243
13243
|
return;
|
|
13244
13244
|
}
|
|
13245
|
-
if (
|
|
13245
|
+
if (D.data.type === "error") {
|
|
13246
13246
|
y(new Error("Invalid PCM16 audio stream"));
|
|
13247
13247
|
return;
|
|
13248
13248
|
}
|
|
13249
|
-
|
|
13250
|
-
|
|
13249
|
+
D.data.type === "ended" && m(
|
|
13250
|
+
D.data.renderContextFrame,
|
|
13251
13251
|
() => b(!0)
|
|
13252
13252
|
);
|
|
13253
13253
|
}, i.connect(s.destination), s.state !== "running")
|
|
@@ -13257,25 +13257,25 @@ class _b {
|
|
|
13257
13257
|
return;
|
|
13258
13258
|
}
|
|
13259
13259
|
o = k.getReader();
|
|
13260
|
-
let
|
|
13260
|
+
let z = 0, x = !1;
|
|
13261
13261
|
for (; !c; ) {
|
|
13262
|
-
const { done:
|
|
13263
|
-
if (
|
|
13262
|
+
const { done: D, value: P } = await o.read();
|
|
13263
|
+
if (D) break;
|
|
13264
13264
|
if (!P.byteLength) continue;
|
|
13265
|
-
|
|
13265
|
+
x || (x = !0, re.debug(
|
|
13266
13266
|
`Scenario speech first PCM chunk received: ${P.byteLength} bytes`
|
|
13267
|
-
)),
|
|
13268
|
-
const
|
|
13269
|
-
i.port.postMessage({ type: "chunk", bytes:
|
|
13267
|
+
)), z += P.byteLength;
|
|
13268
|
+
const V = P.slice().buffer;
|
|
13269
|
+
i.port.postMessage({ type: "chunk", bytes: V }, [V]);
|
|
13270
13270
|
}
|
|
13271
13271
|
if (c) return;
|
|
13272
|
-
if (!
|
|
13272
|
+
if (!z) throw new Error("Audio response is empty");
|
|
13273
13273
|
re.debug(
|
|
13274
|
-
`Scenario speech stream completed: ${
|
|
13274
|
+
`Scenario speech stream completed: ${z} bytes`
|
|
13275
13275
|
), i.port.postMessage({ type: "end" });
|
|
13276
13276
|
} catch (C) {
|
|
13277
13277
|
a?.then(
|
|
13278
|
-
(
|
|
13278
|
+
(E) => E.ok ? E.stream.cancel().catch(() => {
|
|
13279
13279
|
}) : void 0
|
|
13280
13280
|
), y(C);
|
|
13281
13281
|
}
|
|
@@ -13637,7 +13637,7 @@ const Kb = (t) => {
|
|
|
13637
13637
|
super("Voice startup was cancelled");
|
|
13638
13638
|
}
|
|
13639
13639
|
}
|
|
13640
|
-
const
|
|
13640
|
+
const S = (_, A = !0) => {
|
|
13641
13641
|
A && (g = _), e().localStream?.getAudioTracks().forEach((v) => v.enabled = _), e().inputAudioNode?.port.postMessage({ type: "enabled", value: _ }), t({
|
|
13642
13642
|
microphoneEnabled: _,
|
|
13643
13643
|
status: _ ? "listening" : "idle",
|
|
@@ -13651,7 +13651,7 @@ const Kb = (t) => {
|
|
|
13651
13651
|
f.values().next().value
|
|
13652
13652
|
);
|
|
13653
13653
|
l = null, d = null, p = 0, c = 0, u = 0, a && clearTimeout(a), a = null, i = null, o = null, n.stop(), t({ assistantResponseInProgress: !1 });
|
|
13654
|
-
},
|
|
13654
|
+
}, E = () => {
|
|
13655
13655
|
a && clearTimeout(a);
|
|
13656
13656
|
const _ = Math.max(0, u - performance.now());
|
|
13657
13657
|
a = setTimeout(() => {
|
|
@@ -13664,7 +13664,7 @@ const Kb = (t) => {
|
|
|
13664
13664
|
if (i) return;
|
|
13665
13665
|
const A = l ?? `xai-${_}-${h += 1}`;
|
|
13666
13666
|
let v;
|
|
13667
|
-
const
|
|
13667
|
+
const T = new ReadableStream({
|
|
13668
13668
|
start: (oe) => {
|
|
13669
13669
|
v = oe;
|
|
13670
13670
|
}
|
|
@@ -13673,7 +13673,7 @@ const Kb = (t) => {
|
|
|
13673
13673
|
u,
|
|
13674
13674
|
performance.now() + Fa
|
|
13675
13675
|
), t({ assistantResponseInProgress: !0 });
|
|
13676
|
-
const
|
|
13676
|
+
const O = () => n.playPcm16(async () => T, {
|
|
13677
13677
|
sampleRate: Dt,
|
|
13678
13678
|
jitterBufferMs: Fa,
|
|
13679
13679
|
onStarted: () => {
|
|
@@ -13687,7 +13687,7 @@ const Kb = (t) => {
|
|
|
13687
13687
|
onProgress: ({ sourceSample: oe, mouthOpen: ie }) => {
|
|
13688
13688
|
p = Math.max(p, oe), vt.dispatch({ type: "playback-progress", playbackId: A, sourceSample: oe, mouthOpen: ie });
|
|
13689
13689
|
}
|
|
13690
|
-
}), G = o, j = l, te = G ? (async () => (await G.catch(() => !1), e().generation !== _ || j !== null && f.has(j) ? !1 :
|
|
13690
|
+
}), G = o, j = l, te = G ? (async () => (await G.catch(() => !1), e().generation !== _ || j !== null && f.has(j) ? !1 : O()))() : O();
|
|
13691
13691
|
o = te, te.catch((oe) => {
|
|
13692
13692
|
e().generation === _ && (re.warn("Voice audio playback failed", oe), t({
|
|
13693
13693
|
status: "error",
|
|
@@ -13701,19 +13701,19 @@ const Kb = (t) => {
|
|
|
13701
13701
|
status: oe.status === "error" ? "error" : oe.microphoneEnabled ? "listening" : "idle"
|
|
13702
13702
|
})));
|
|
13703
13703
|
});
|
|
13704
|
-
},
|
|
13704
|
+
}, z = (_, A, v) => {
|
|
13705
13705
|
if (e().generation === v)
|
|
13706
13706
|
try {
|
|
13707
13707
|
switch (_) {
|
|
13708
13708
|
case "input_audio_buffer.speech_started":
|
|
13709
13709
|
{
|
|
13710
|
-
const
|
|
13710
|
+
const T = l, O = d, G = p;
|
|
13711
13711
|
C();
|
|
13712
13712
|
const j = e();
|
|
13713
|
-
|
|
13713
|
+
T && O && j.socket?.connected && j.session && Fs(j.socket, "voice.playback.interrupt", {
|
|
13714
13714
|
voiceSessionId: j.session.voiceSessionId,
|
|
13715
|
-
responseId:
|
|
13716
|
-
itemId:
|
|
13715
|
+
responseId: T,
|
|
13716
|
+
itemId: O,
|
|
13717
13717
|
contentIndex: 0,
|
|
13718
13718
|
playedAudioMs: G / Dt * 1e3,
|
|
13719
13719
|
playedSamples: G,
|
|
@@ -13730,24 +13730,24 @@ const Kb = (t) => {
|
|
|
13730
13730
|
});
|
|
13731
13731
|
break;
|
|
13732
13732
|
case "conversation.item.input_audio_transcription.updated": {
|
|
13733
|
-
const
|
|
13733
|
+
const T = cs(A, !0);
|
|
13734
13734
|
t({
|
|
13735
|
-
customerMessageTranscript:
|
|
13736
|
-
customerMessageTranscriptVisible: !!
|
|
13735
|
+
customerMessageTranscript: T,
|
|
13736
|
+
customerMessageTranscriptVisible: !!T
|
|
13737
13737
|
});
|
|
13738
13738
|
break;
|
|
13739
13739
|
}
|
|
13740
13740
|
case "conversation.item.input_audio_transcription.completed": {
|
|
13741
|
-
const
|
|
13741
|
+
const T = cs(A, !0);
|
|
13742
13742
|
t({
|
|
13743
|
-
customerMessageTranscript:
|
|
13744
|
-
customerMessageTranscriptVisible: !!
|
|
13743
|
+
customerMessageTranscript: T,
|
|
13744
|
+
customerMessageTranscriptVisible: !!T
|
|
13745
13745
|
});
|
|
13746
13746
|
break;
|
|
13747
13747
|
}
|
|
13748
13748
|
case "response.created": {
|
|
13749
|
-
const
|
|
13750
|
-
a && clearTimeout(a), a = null, l &&
|
|
13749
|
+
const T = Pn(A);
|
|
13750
|
+
a && clearTimeout(a), a = null, l && T && l !== T && f.add(l), l = T, c = 0, t({
|
|
13751
13751
|
errorMessage: null,
|
|
13752
13752
|
errorCode: null,
|
|
13753
13753
|
assistantResponseInProgress: !0,
|
|
@@ -13757,76 +13757,76 @@ const Kb = (t) => {
|
|
|
13757
13757
|
break;
|
|
13758
13758
|
}
|
|
13759
13759
|
case "response.output_audio.delta": {
|
|
13760
|
-
const
|
|
13761
|
-
if (
|
|
13760
|
+
const T = Pn(A);
|
|
13761
|
+
if (T && f.has(T) || l && T && T !== l)
|
|
13762
13762
|
break;
|
|
13763
|
-
!l &&
|
|
13764
|
-
const
|
|
13765
|
-
if (c +=
|
|
13763
|
+
!l && T && (l = T), typeof A.item_id == "string" && (d = A.item_id);
|
|
13764
|
+
const O = Qb(A);
|
|
13765
|
+
if (c += O.byteLength, c > Wb)
|
|
13766
13766
|
throw new Error("Voice audio response is too large");
|
|
13767
|
-
if (k(v), u = Math.max(performance.now(), u) +
|
|
13767
|
+
if (k(v), u = Math.max(performance.now(), u) + O.byteLength / 2 / Dt * 1e3, u - performance.now() > Hb)
|
|
13768
13768
|
throw new Error("Voice audio buffer is too large");
|
|
13769
|
-
t({ status: "speaking", assistantResponseInProgress: !0 }), i.enqueue(
|
|
13769
|
+
t({ status: "speaking", assistantResponseInProgress: !0 }), i.enqueue(O);
|
|
13770
13770
|
break;
|
|
13771
13771
|
}
|
|
13772
13772
|
case "response.output_audio_transcript.delta": {
|
|
13773
|
-
const
|
|
13774
|
-
if (
|
|
13773
|
+
const T = Pn(A);
|
|
13774
|
+
if (T && f.has(T) || l && T && T !== l)
|
|
13775
13775
|
break;
|
|
13776
|
-
const
|
|
13776
|
+
const O = cs(A);
|
|
13777
13777
|
t((G) => ({
|
|
13778
|
-
assistantMessageTranscript: G.assistantMessageTranscript +
|
|
13779
|
-
assistantMessageTranscriptVisible: G.assistantMessageTranscriptVisible || !!
|
|
13778
|
+
assistantMessageTranscript: G.assistantMessageTranscript + O,
|
|
13779
|
+
assistantMessageTranscriptVisible: G.assistantMessageTranscriptVisible || !!O
|
|
13780
13780
|
}));
|
|
13781
13781
|
break;
|
|
13782
13782
|
}
|
|
13783
13783
|
case "response.output_audio_transcript.done": {
|
|
13784
|
-
const
|
|
13785
|
-
if (
|
|
13784
|
+
const T = Pn(A);
|
|
13785
|
+
if (T && f.has(T) || l && T && T !== l)
|
|
13786
13786
|
break;
|
|
13787
|
-
const
|
|
13787
|
+
const O = cs(A, !0);
|
|
13788
13788
|
t({
|
|
13789
|
-
assistantMessageTranscript:
|
|
13790
|
-
assistantMessageTranscriptVisible: !!
|
|
13789
|
+
assistantMessageTranscript: O,
|
|
13790
|
+
assistantMessageTranscriptVisible: !!O
|
|
13791
13791
|
});
|
|
13792
13792
|
break;
|
|
13793
13793
|
}
|
|
13794
13794
|
case "response.output_audio.done": {
|
|
13795
|
-
const
|
|
13796
|
-
if (
|
|
13795
|
+
const T = Pn(A);
|
|
13796
|
+
if (T && f.has(T) || l && T && T !== l)
|
|
13797
13797
|
break;
|
|
13798
13798
|
i?.close(), i = null;
|
|
13799
13799
|
break;
|
|
13800
13800
|
}
|
|
13801
13801
|
case "response.done": {
|
|
13802
|
-
const
|
|
13803
|
-
if (
|
|
13802
|
+
const T = Pn(A);
|
|
13803
|
+
if (T && f.has(T) || l && T && T !== l)
|
|
13804
13804
|
break;
|
|
13805
|
-
i?.close(), i = null, l = null, c = 0,
|
|
13805
|
+
i?.close(), i = null, l = null, c = 0, E();
|
|
13806
13806
|
break;
|
|
13807
13807
|
}
|
|
13808
13808
|
case "error": {
|
|
13809
|
-
const
|
|
13810
|
-
C(), t((
|
|
13811
|
-
status:
|
|
13812
|
-
errorMessage:
|
|
13813
|
-
errorCode:
|
|
13809
|
+
const T = Kb(A);
|
|
13810
|
+
C(), t((O) => ({
|
|
13811
|
+
status: O.microphoneEnabled ? "listening" : "idle",
|
|
13812
|
+
errorMessage: T,
|
|
13813
|
+
errorCode: T ? null : "session_failed"
|
|
13814
13814
|
}));
|
|
13815
13815
|
break;
|
|
13816
13816
|
}
|
|
13817
13817
|
}
|
|
13818
|
-
} catch (
|
|
13819
|
-
re.warn(`Failed to handle voice event ${_}`,
|
|
13818
|
+
} catch (T) {
|
|
13819
|
+
re.warn(`Failed to handle voice event ${_}`, T), P("session_failed", "invalid_event");
|
|
13820
13820
|
}
|
|
13821
|
-
},
|
|
13821
|
+
}, x = (_) => {
|
|
13822
13822
|
C(), _.inputAudioNode?.port.postMessage({ type: "enabled", value: !1 }), _.inputAudioNode && (_.inputAudioNode.port.onmessage = null, _.inputAudioNode.disconnect()), _.inputAudioContext?.close().catch(() => {
|
|
13823
13823
|
}), _.socket?.removeAllListeners(), _.socket?.disconnect(), Oa(_.localStream);
|
|
13824
|
-
},
|
|
13825
|
-
|
|
13824
|
+
}, D = (_, A, v, T) => {
|
|
13825
|
+
T?.port.postMessage({ type: "enabled", value: !1 }), T && (T.port.onmessage = null, T.disconnect()), v?.close().catch(() => {
|
|
13826
13826
|
}), _?.removeAllListeners(), _?.disconnect(), Oa(A);
|
|
13827
13827
|
}, P = async (_, A) => {
|
|
13828
13828
|
const v = e();
|
|
13829
|
-
if (m = !1, g = !1, b += 1, y = !1,
|
|
13829
|
+
if (m = !1, g = !1, b += 1, y = !1, x(v), t({
|
|
13830
13830
|
...bn,
|
|
13831
13831
|
status: "error",
|
|
13832
13832
|
errorCode: _,
|
|
@@ -13839,22 +13839,22 @@ const Kb = (t) => {
|
|
|
13839
13839
|
v.session.voiceSessionId,
|
|
13840
13840
|
A
|
|
13841
13841
|
);
|
|
13842
|
-
} catch (
|
|
13843
|
-
re.warn("Failed to close invalid voice session",
|
|
13842
|
+
} catch (T) {
|
|
13843
|
+
re.warn("Failed to close invalid voice session", T);
|
|
13844
13844
|
}
|
|
13845
|
-
},
|
|
13845
|
+
}, V = async (_, A, v) => {
|
|
13846
13846
|
if (r || n.isPlaying || e().assistantResponseInProgress)
|
|
13847
13847
|
throw new Error("Assistant is already speaking");
|
|
13848
13848
|
r = !0;
|
|
13849
13849
|
try {
|
|
13850
|
-
const
|
|
13850
|
+
const T = await _();
|
|
13851
13851
|
if (e().generation !== A) return !1;
|
|
13852
|
-
const
|
|
13853
|
-
return await n.play(
|
|
13852
|
+
const O = `intro-${A}-${h += 1}`;
|
|
13853
|
+
return await n.play(T, {
|
|
13854
13854
|
onStarted: () => {
|
|
13855
13855
|
e().generation === A && (vt.dispatch({
|
|
13856
13856
|
type: "playback-started",
|
|
13857
|
-
playbackId:
|
|
13857
|
+
playbackId: O,
|
|
13858
13858
|
// Blob decoding does not expose source samples; this path is body-only.
|
|
13859
13859
|
sampleRate: Dt
|
|
13860
13860
|
}), t({
|
|
@@ -13866,12 +13866,12 @@ const Kb = (t) => {
|
|
|
13866
13866
|
}
|
|
13867
13867
|
}));
|
|
13868
13868
|
},
|
|
13869
|
-
onStopped: () => vt.dispatch({ type: "playback-stopped", playbackId:
|
|
13869
|
+
onStopped: () => vt.dispatch({ type: "playback-stopped", playbackId: O })
|
|
13870
13870
|
});
|
|
13871
13871
|
} finally {
|
|
13872
13872
|
r = !1;
|
|
13873
13873
|
}
|
|
13874
|
-
},
|
|
13874
|
+
}, B = async (_, A, v, T, O) => {
|
|
13875
13875
|
if (r || n.isPlaying || e().assistantResponseInProgress)
|
|
13876
13876
|
throw new Error("Assistant is already speaking");
|
|
13877
13877
|
r = !0;
|
|
@@ -13879,7 +13879,7 @@ const Kb = (t) => {
|
|
|
13879
13879
|
let j;
|
|
13880
13880
|
try {
|
|
13881
13881
|
if (e().generation !== v) return !1;
|
|
13882
|
-
const te = Pa(
|
|
13882
|
+
const te = Pa(T);
|
|
13883
13883
|
return await n.playPcm16(_, {
|
|
13884
13884
|
sampleRate: A,
|
|
13885
13885
|
onStarted: () => {
|
|
@@ -13889,12 +13889,12 @@ const Kb = (t) => {
|
|
|
13889
13889
|
}
|
|
13890
13890
|
vt.dispatch({
|
|
13891
13891
|
type: "playback-started",
|
|
13892
|
-
playbackId:
|
|
13892
|
+
playbackId: T,
|
|
13893
13893
|
sampleRate: A
|
|
13894
|
-
}),
|
|
13895
|
-
source:
|
|
13894
|
+
}), O && (j = Vb({
|
|
13895
|
+
source: O,
|
|
13896
13896
|
runtime: vt,
|
|
13897
|
-
playbackId:
|
|
13897
|
+
playbackId: T,
|
|
13898
13898
|
sampleRate: A,
|
|
13899
13899
|
signal: G.signal
|
|
13900
13900
|
})), t({ status: "speaking", assistantResponseInProgress: !0 });
|
|
@@ -13909,7 +13909,7 @@ const Kb = (t) => {
|
|
|
13909
13909
|
} finally {
|
|
13910
13910
|
G.abort(), await j, r = !1;
|
|
13911
13911
|
}
|
|
13912
|
-
}, W = async (_, A, v,
|
|
13912
|
+
}, W = async (_, A, v, T, O) => {
|
|
13913
13913
|
const G = new AudioContext({ latencyHint: "interactive", sampleRate: Dt });
|
|
13914
13914
|
let j = null;
|
|
13915
13915
|
try {
|
|
@@ -13942,7 +13942,7 @@ const Kb = (t) => {
|
|
|
13942
13942
|
}
|
|
13943
13943
|
);
|
|
13944
13944
|
j.port.onmessage = (ve) => {
|
|
13945
|
-
if (ve.data.type !== "chunk" || !(ve.data.bytes instanceof ArrayBuffer) || e().generation !==
|
|
13945
|
+
if (ve.data.type !== "chunk" || !(ve.data.bytes instanceof ArrayBuffer) || e().generation !== T || e().socket !== A || !e().microphoneEnabled || !A.connected)
|
|
13946
13946
|
return;
|
|
13947
13947
|
const $ = new Uint8Array(ve.data.bytes);
|
|
13948
13948
|
if ($.byteLength !== 4800) {
|
|
@@ -13956,7 +13956,7 @@ const Kb = (t) => {
|
|
|
13956
13956
|
capturedAtMonotonicMs: performance.now(),
|
|
13957
13957
|
audio: Yb($)
|
|
13958
13958
|
}), ie += 2400;
|
|
13959
|
-
}, j.port.postMessage({ type: "enabled", value:
|
|
13959
|
+
}, j.port.postMessage({ type: "enabled", value: O }), te.connect(j);
|
|
13960
13960
|
const pe = G.createGain();
|
|
13961
13961
|
return pe.gain.value = 0, j.connect(pe), pe.connect(G.destination), { context: G, node: j };
|
|
13962
13962
|
} catch (te) {
|
|
@@ -13967,13 +13967,13 @@ const Kb = (t) => {
|
|
|
13967
13967
|
const v = e();
|
|
13968
13968
|
if (v.socket !== _ || !v.config || !v.api || !m || y)
|
|
13969
13969
|
return;
|
|
13970
|
-
const
|
|
13970
|
+
const T = async (ie, de) => {
|
|
13971
13971
|
if (m = !1, g = !1, b += 1, t({
|
|
13972
13972
|
...bn,
|
|
13973
13973
|
status: "error",
|
|
13974
13974
|
errorCode: ie,
|
|
13975
13975
|
generation: v.generation + 1
|
|
13976
|
-
}),
|
|
13976
|
+
}), x(v), v.session)
|
|
13977
13977
|
try {
|
|
13978
13978
|
await In(
|
|
13979
13979
|
v.config,
|
|
@@ -13992,21 +13992,21 @@ const Kb = (t) => {
|
|
|
13992
13992
|
"voice session not found",
|
|
13993
13993
|
"session renewed"
|
|
13994
13994
|
])).has(A)) {
|
|
13995
|
-
await
|
|
13995
|
+
await T("connection_closed", "socket_closed");
|
|
13996
13996
|
return;
|
|
13997
13997
|
}
|
|
13998
13998
|
y = !0;
|
|
13999
|
-
const { config:
|
|
13999
|
+
const { config: O, api: G, session: j } = v, te = ++b, oe = v.generation + 1;
|
|
14000
14000
|
if (t({
|
|
14001
14001
|
...bn,
|
|
14002
|
-
config:
|
|
14002
|
+
config: O,
|
|
14003
14003
|
api: G,
|
|
14004
14004
|
status: "connecting",
|
|
14005
14005
|
generation: oe
|
|
14006
|
-
}),
|
|
14006
|
+
}), x(v), j)
|
|
14007
14007
|
try {
|
|
14008
14008
|
await In(
|
|
14009
|
-
|
|
14009
|
+
O,
|
|
14010
14010
|
G,
|
|
14011
14011
|
j.voiceSessionId,
|
|
14012
14012
|
"connection_lost"
|
|
@@ -14025,7 +14025,7 @@ const Kb = (t) => {
|
|
|
14025
14025
|
return;
|
|
14026
14026
|
}
|
|
14027
14027
|
try {
|
|
14028
|
-
await N(
|
|
14028
|
+
await N(O, G, {
|
|
14029
14029
|
enableMicrophone: g
|
|
14030
14030
|
});
|
|
14031
14031
|
} catch {
|
|
@@ -14034,8 +14034,8 @@ const Kb = (t) => {
|
|
|
14034
14034
|
}
|
|
14035
14035
|
}, N = async (_, A, v = {}) => {
|
|
14036
14036
|
const {
|
|
14037
|
-
session:
|
|
14038
|
-
loadSession:
|
|
14037
|
+
session: T,
|
|
14038
|
+
loadSession: O,
|
|
14039
14039
|
existingSessionId: G,
|
|
14040
14040
|
scriptedIntro: j,
|
|
14041
14041
|
enableMicrophone: te = g
|
|
@@ -14047,7 +14047,7 @@ const Kb = (t) => {
|
|
|
14047
14047
|
status: "connecting",
|
|
14048
14048
|
generation: ie
|
|
14049
14049
|
});
|
|
14050
|
-
let de = null, pe = null, ve =
|
|
14050
|
+
let de = null, pe = null, ve = T ?? null, $ = null, me = null;
|
|
14051
14051
|
const De = () => m && b === oe && e().generation === ie, Le = () => {
|
|
14052
14052
|
if (!De()) throw new I();
|
|
14053
14053
|
};
|
|
@@ -14079,7 +14079,7 @@ const Kb = (t) => {
|
|
|
14079
14079
|
};
|
|
14080
14080
|
ge.addEventListener?.("ended", Je, { once: !0 }), ge.addEventListener?.("mute", Je, { once: !0 }), de.getAudioTracks().forEach(
|
|
14081
14081
|
(qe) => qe.enabled = !j && te
|
|
14082
|
-
), ve ??=
|
|
14082
|
+
), ve ??= O ? await O() : await o1(_, A), Le(), pe = e1(_, ve);
|
|
14083
14083
|
let Et = !1, ln = 1;
|
|
14084
14084
|
pe.on(ve.websocket.serverEvent, (qe) => {
|
|
14085
14085
|
try {
|
|
@@ -14088,7 +14088,7 @@ const Kb = (t) => {
|
|
|
14088
14088
|
ve,
|
|
14089
14089
|
ln
|
|
14090
14090
|
);
|
|
14091
|
-
ln += 1,
|
|
14091
|
+
ln += 1, z(dn.type, dn.event, ie);
|
|
14092
14092
|
} catch {
|
|
14093
14093
|
P("session_failed", "invalid_event");
|
|
14094
14094
|
}
|
|
@@ -14113,7 +14113,7 @@ const Kb = (t) => {
|
|
|
14113
14113
|
inputAudioNode: me,
|
|
14114
14114
|
microphoneEnabled: !j && te
|
|
14115
14115
|
}), j) {
|
|
14116
|
-
if (!await
|
|
14116
|
+
if (!await V(
|
|
14117
14117
|
() => Ab(_, A, {
|
|
14118
14118
|
audioPath: j.path,
|
|
14119
14119
|
method: "POST",
|
|
@@ -14124,9 +14124,9 @@ const Kb = (t) => {
|
|
|
14124
14124
|
)) throw new I();
|
|
14125
14125
|
Le();
|
|
14126
14126
|
}
|
|
14127
|
-
|
|
14127
|
+
S(te, !1), t({ assistantResponseInProgress: !1 });
|
|
14128
14128
|
} catch (ge) {
|
|
14129
|
-
|
|
14129
|
+
D(
|
|
14130
14130
|
pe,
|
|
14131
14131
|
de,
|
|
14132
14132
|
$,
|
|
@@ -14170,7 +14170,7 @@ const Kb = (t) => {
|
|
|
14170
14170
|
const v = e();
|
|
14171
14171
|
if (v.status !== "connecting") {
|
|
14172
14172
|
if (v.socket?.connected && v.session) {
|
|
14173
|
-
m = !0,
|
|
14173
|
+
m = !0, S(!0);
|
|
14174
14174
|
return;
|
|
14175
14175
|
}
|
|
14176
14176
|
(v.socket || v.session) && await v.actions.endVoiceChat("restart_voice_session"), m = !0, g = !0, await N(_, A);
|
|
@@ -14180,11 +14180,11 @@ const Kb = (t) => {
|
|
|
14180
14180
|
const A = e();
|
|
14181
14181
|
return A.pendingInvitation || A.socket || A.session ? Promise.reject(
|
|
14182
14182
|
new Error("Another voice conversation is already active")
|
|
14183
|
-
) : new Promise((v,
|
|
14183
|
+
) : new Promise((v, T) => {
|
|
14184
14184
|
s = {
|
|
14185
14185
|
commandId: _.commandId,
|
|
14186
14186
|
resolve: v,
|
|
14187
|
-
reject:
|
|
14187
|
+
reject: T
|
|
14188
14188
|
}, t({
|
|
14189
14189
|
pendingInvitation: _,
|
|
14190
14190
|
errorMessage: null,
|
|
@@ -14193,8 +14193,8 @@ const Kb = (t) => {
|
|
|
14193
14193
|
});
|
|
14194
14194
|
},
|
|
14195
14195
|
acceptConversation: async (_, A) => {
|
|
14196
|
-
const v = e().pendingInvitation,
|
|
14197
|
-
if (!v ||
|
|
14196
|
+
const v = e().pendingInvitation, T = s;
|
|
14197
|
+
if (!v || T?.commandId !== v.commandId)
|
|
14198
14198
|
throw new Error("Voice invitation is no longer available");
|
|
14199
14199
|
K.setState({
|
|
14200
14200
|
currentThreadId: v.conversationId
|
|
@@ -14207,16 +14207,16 @@ const Kb = (t) => {
|
|
|
14207
14207
|
path: v.introAudioPath,
|
|
14208
14208
|
text: v.text
|
|
14209
14209
|
}
|
|
14210
|
-
}), s = null,
|
|
14211
|
-
} catch (
|
|
14212
|
-
throw s = null,
|
|
14213
|
-
|
|
14214
|
-
),
|
|
14210
|
+
}), s = null, T.resolve();
|
|
14211
|
+
} catch (O) {
|
|
14212
|
+
throw s = null, T.reject(
|
|
14213
|
+
O instanceof Error ? O : new Error("Voice session failed")
|
|
14214
|
+
), O;
|
|
14215
14215
|
}
|
|
14216
14216
|
},
|
|
14217
14217
|
declineConversation: async (_, A) => {
|
|
14218
|
-
const v = e().pendingInvitation,
|
|
14219
|
-
if (s = null, t({ pendingInvitation: null }),
|
|
14218
|
+
const v = e().pendingInvitation, T = s;
|
|
14219
|
+
if (s = null, t({ pendingInvitation: null }), T?.reject(new Error("Voice invitation was declined")), !!v)
|
|
14220
14220
|
try {
|
|
14221
14221
|
await In(
|
|
14222
14222
|
_,
|
|
@@ -14224,21 +14224,21 @@ const Kb = (t) => {
|
|
|
14224
14224
|
v.voiceSessionId,
|
|
14225
14225
|
"invitation_declined"
|
|
14226
14226
|
);
|
|
14227
|
-
} catch (
|
|
14228
|
-
re.warn("Failed to decline Lola voice session",
|
|
14227
|
+
} catch (O) {
|
|
14228
|
+
re.warn("Failed to decline Lola voice session", O);
|
|
14229
14229
|
}
|
|
14230
14230
|
},
|
|
14231
14231
|
speakText: async (_, A, v) => {
|
|
14232
|
-
const
|
|
14233
|
-
if (r || n.isPlaying ||
|
|
14232
|
+
const T = e();
|
|
14233
|
+
if (r || n.isPlaying || T.assistantResponseInProgress)
|
|
14234
14234
|
throw new Error("Assistant is already speaking");
|
|
14235
|
-
const
|
|
14236
|
-
|
|
14235
|
+
const O = T.generation, G = T.microphoneEnabled, j = T.status;
|
|
14236
|
+
T.localStream?.getAudioTracks().forEach((te) => te.enabled = !1), T.inputAudioNode?.port.postMessage({
|
|
14237
14237
|
type: "enabled",
|
|
14238
14238
|
value: !1
|
|
14239
14239
|
}), t({ microphoneEnabled: !1 });
|
|
14240
14240
|
try {
|
|
14241
|
-
if (!await
|
|
14241
|
+
if (!await B(
|
|
14242
14242
|
(oe) => wb(
|
|
14243
14243
|
_,
|
|
14244
14244
|
A,
|
|
@@ -14253,12 +14253,12 @@ const Kb = (t) => {
|
|
|
14253
14253
|
oe
|
|
14254
14254
|
),
|
|
14255
14255
|
v.sampleRate,
|
|
14256
|
-
|
|
14256
|
+
O,
|
|
14257
14257
|
v.lipSync?.playbackId ?? v.commandId,
|
|
14258
14258
|
v.lipSync ? Ec : void 0
|
|
14259
14259
|
)) throw new Error("Speech playback was cancelled");
|
|
14260
14260
|
} finally {
|
|
14261
|
-
e().generation ===
|
|
14261
|
+
e().generation === O && (e().localStream?.getAudioTracks().forEach((te) => te.enabled = G), e().inputAudioNode?.port.postMessage({
|
|
14262
14262
|
type: "enabled",
|
|
14263
14263
|
value: G
|
|
14264
14264
|
}), t({
|
|
@@ -14268,7 +14268,7 @@ const Kb = (t) => {
|
|
|
14268
14268
|
}));
|
|
14269
14269
|
}
|
|
14270
14270
|
},
|
|
14271
|
-
stopListening: () =>
|
|
14271
|
+
stopListening: () => S(!1),
|
|
14272
14272
|
endVoiceChat: async (_ = "user_hangup") => {
|
|
14273
14273
|
const A = e();
|
|
14274
14274
|
m = !1, g = !1, b += 1, y = !1, A.localStream?.getAudioTracks().forEach((G) => G.enabled = !1), A.inputAudioNode?.port.postMessage({
|
|
@@ -14277,9 +14277,9 @@ const Kb = (t) => {
|
|
|
14277
14277
|
});
|
|
14278
14278
|
const v = s;
|
|
14279
14279
|
s = null, v?.reject(new Error("Voice invitation was dismissed"));
|
|
14280
|
-
let
|
|
14280
|
+
let T = !1;
|
|
14281
14281
|
try {
|
|
14282
|
-
|
|
14282
|
+
T = await s1(
|
|
14283
14283
|
A.socket,
|
|
14284
14284
|
A.session,
|
|
14285
14285
|
_
|
|
@@ -14287,8 +14287,8 @@ const Kb = (t) => {
|
|
|
14287
14287
|
} catch (G) {
|
|
14288
14288
|
re.warn("Failed to disconnect Lola voice socket", G);
|
|
14289
14289
|
}
|
|
14290
|
-
const
|
|
14291
|
-
if (t({ ...bn, generation:
|
|
14290
|
+
const O = A.generation + 1;
|
|
14291
|
+
if (t({ ...bn, generation: O }), x(A), !T && A.session && A.config && A.api)
|
|
14292
14292
|
try {
|
|
14293
14293
|
await In(
|
|
14294
14294
|
A.config,
|
|
@@ -16448,32 +16448,32 @@ const za = (t) => ({
|
|
|
16448
16448
|
config: e,
|
|
16449
16449
|
api: n
|
|
16450
16450
|
}) => {
|
|
16451
|
-
const { t: r } = xn(), [s, i] = he(!1), o = q(!1), [a, u] = he(null), [c, l] = he(!1), [d, p] = he(!1), [h, f] = he(!1), [m, g] = he(null), b = Em(), [y, I] = he([]), [
|
|
16451
|
+
const { t: r } = xn(), [s, i] = he(!1), o = q(!1), [a, u] = he(null), [c, l] = he(!1), [d, p] = he(!1), [h, f] = he(!1), [m, g] = he(null), b = Em(), [y, I] = he([]), [S, C] = he("idle"), [E, k] = he(
|
|
16452
16452
|
null
|
|
16453
|
-
), [
|
|
16453
|
+
), [z, x] = he(null), [D, P] = he(
|
|
16454
16454
|
null
|
|
16455
|
-
), [
|
|
16455
|
+
), [V, B] = he(null), W = q(0), X = q(0), N = q(/* @__PURE__ */ new Map()), _ = q(/* @__PURE__ */ new Map()), A = q(0), v = q(null), T = q([]), O = q(
|
|
16456
16456
|
/* @__PURE__ */ new Map()
|
|
16457
16457
|
), G = q(
|
|
16458
16458
|
e.customerInteractionSession.interactionSessionId
|
|
16459
16459
|
), j = q(0), te = q(0), oe = q(null), [ie, de] = he(
|
|
16460
16460
|
() => !e.hideOpenButton
|
|
16461
|
-
), pe = q(!e.hideOpenButton), ve = le((
|
|
16462
|
-
pe.current =
|
|
16461
|
+
), pe = q(!e.hideOpenButton), ve = le((M) => {
|
|
16462
|
+
pe.current = M, de(M);
|
|
16463
16463
|
}, []), [$] = he(
|
|
16464
16464
|
() => new F1({
|
|
16465
16465
|
principalSessionId: e.customerInteractionSession.interactionSessionId,
|
|
16466
|
-
diagnostics: (
|
|
16466
|
+
diagnostics: (M, U) => re.debug(`[CompactPreview] ${M}`, U)
|
|
16467
16467
|
})
|
|
16468
16468
|
), me = Vs(), De = le(
|
|
16469
|
-
(
|
|
16470
|
-
if (G.current ===
|
|
16471
|
-
G.current =
|
|
16469
|
+
(M) => {
|
|
16470
|
+
if (G.current === M) return !1;
|
|
16471
|
+
G.current = M, j.current += 1, te.current += 1, oe.current = null;
|
|
16472
16472
|
const U = v.current;
|
|
16473
|
-
U?.leaseTimer !== null && U?.leaseTimer !== void 0 && window.clearTimeout(U.leaseTimer), v.current = null,
|
|
16473
|
+
U?.leaseTimer !== null && U?.leaseTimer !== void 0 && window.clearTimeout(U.leaseTimer), v.current = null, T.current = [], O.current.clear(), W.current = 0, N.current.clear();
|
|
16474
16474
|
for (const Q of _.current.values())
|
|
16475
16475
|
Q.close();
|
|
16476
|
-
return _.current.clear(), I([]),
|
|
16476
|
+
return _.current.clear(), I([]), B(null), C("idle"), k(null), x(null), P(null), l(!1), p(!1), f(!1), g(null), Yt(0), ve(!e.hideOpenButton), $.replacePrincipal(M), n.scenarioInteractionRuntime.transitionSurface("CLOSED", {
|
|
16477
16477
|
actor: "SYSTEM",
|
|
16478
16478
|
reason: "SYSTEM_RESTORE"
|
|
16479
16479
|
}), o.current = !1, i(!1), u(null), !0;
|
|
@@ -16489,23 +16489,23 @@ const za = (t) => ({
|
|
|
16489
16489
|
n.scenarioInteractionRuntime.getPrincipalSessionId()
|
|
16490
16490
|
);
|
|
16491
16491
|
}, [n.scenarioInteractionRuntime, De]), ge = le(
|
|
16492
|
-
(
|
|
16492
|
+
(M, U) => {
|
|
16493
16493
|
te.current += 1, oe.current = null, Le();
|
|
16494
16494
|
const Q = $.getSnapshot();
|
|
16495
|
-
!
|
|
16496
|
-
const J =
|
|
16497
|
-
if (o.current =
|
|
16498
|
-
chatOpen:
|
|
16495
|
+
!M && Q.active && Q.exitReason === "OPENED_CHAT" && $.restoreAfterError("");
|
|
16496
|
+
const J = M ? !0 : e.hideOpenButton ? !1 : pe.current;
|
|
16497
|
+
if (o.current = M, $.setRouting({
|
|
16498
|
+
chatOpen: M,
|
|
16499
16499
|
chromeVisible: J,
|
|
16500
16500
|
launcherVisible: !e.hideOpenButton
|
|
16501
|
-
}), (
|
|
16502
|
-
|
|
16501
|
+
}), (M || e.hideOpenButton) && ve(J), !n.scenarioInteractionRuntime.transitionSurface(
|
|
16502
|
+
M ? "OPEN" : "CLOSED",
|
|
16503
16503
|
U
|
|
16504
16504
|
).changed) {
|
|
16505
|
-
|
|
16505
|
+
M || l(!1);
|
|
16506
16506
|
return;
|
|
16507
16507
|
}
|
|
16508
|
-
|
|
16508
|
+
M ? p(!0) : l(!1), i(M), u(n.scenarioInteractionRuntime.getSurfaceEpisodeId());
|
|
16509
16509
|
},
|
|
16510
16510
|
[
|
|
16511
16511
|
n.scenarioInteractionRuntime,
|
|
@@ -16515,7 +16515,7 @@ const za = (t) => ({
|
|
|
16515
16515
|
ve
|
|
16516
16516
|
]
|
|
16517
16517
|
), ue = le(
|
|
16518
|
-
(
|
|
16518
|
+
(M) => {
|
|
16519
16519
|
Le();
|
|
16520
16520
|
const U = $.getSnapshot(), Q = U.active;
|
|
16521
16521
|
if (!Q) return null;
|
|
@@ -16542,8 +16542,8 @@ const za = (t) => ({
|
|
|
16542
16542
|
return te.current !== J || Ae.active?.conversationId !== Z || Ae.principalSessionId !== ae || Ae.surfaceEpisodeId !== be || Ae.exitReason !== "OPENED_CHAT" ? !1 : K.getState().currentThreadId !== Z ? (re.warn(
|
|
16543
16543
|
"Compact preview conversation selection was superseded"
|
|
16544
16544
|
), $.restoreAfterError(r("compact.openFailed")), !1) : (me(st.text), ge(!0, {
|
|
16545
|
-
...
|
|
16546
|
-
sourceCommandId:
|
|
16545
|
+
...M,
|
|
16546
|
+
sourceCommandId: M.sourceCommandId ?? Ae.active?.attributionHandle ?? Q.attributionHandle
|
|
16547
16547
|
}), !0);
|
|
16548
16548
|
}).catch((nt) => {
|
|
16549
16549
|
const Ae = $.getSnapshot();
|
|
@@ -16561,20 +16561,20 @@ const za = (t) => ({
|
|
|
16561
16561
|
ge
|
|
16562
16562
|
]
|
|
16563
16563
|
), L = le(
|
|
16564
|
-
(
|
|
16564
|
+
(M) => {
|
|
16565
16565
|
const U = {
|
|
16566
16566
|
actor: "HOST",
|
|
16567
16567
|
reason: "HOST_SET_OPEN"
|
|
16568
16568
|
};
|
|
16569
|
-
|
|
16569
|
+
M && ue(U) || ge(M, U);
|
|
16570
16570
|
},
|
|
16571
16571
|
[ue, ge]
|
|
16572
16572
|
), Je = q(null), Et = ie, [ln, Yt] = he(0), [qe, dn] = he(
|
|
16573
16573
|
() => window.innerWidth <= Ma
|
|
16574
16574
|
);
|
|
16575
16575
|
hb(e, n), Y(() => {
|
|
16576
|
-
const
|
|
16577
|
-
De(
|
|
16576
|
+
const M = e.customerInteractionSession.interactionSessionId;
|
|
16577
|
+
De(M);
|
|
16578
16578
|
}, [
|
|
16579
16579
|
e.customerInteractionSession.interactionSessionId,
|
|
16580
16580
|
De
|
|
@@ -16585,13 +16585,13 @@ const za = (t) => ({
|
|
|
16585
16585
|
launcherVisible: !e.hideOpenButton
|
|
16586
16586
|
});
|
|
16587
16587
|
}, [$, e.hideOpenButton, Et, s]), Y(() => {
|
|
16588
|
-
vs.getState().actions.updateSession(e, n).catch((
|
|
16588
|
+
vs.getState().actions.updateSession(e, n).catch((M) => re.warn("Voice session renewal failed", M));
|
|
16589
16589
|
}, [n, e]), Y(() => {
|
|
16590
|
-
const
|
|
16590
|
+
const M = () => {
|
|
16591
16591
|
const U = window.innerWidth <= Ma;
|
|
16592
16592
|
dn(U), U || l(!1);
|
|
16593
16593
|
};
|
|
16594
|
-
return window.addEventListener("resize",
|
|
16594
|
+
return window.addEventListener("resize", M), () => window.removeEventListener("resize", M);
|
|
16595
16595
|
}, []), Y(() => (n.registerSetOpen(L), () => {
|
|
16596
16596
|
n.registerSetOpen(null);
|
|
16597
16597
|
}), [n, L]), Y(() => {
|
|
@@ -16600,42 +16600,42 @@ const za = (t) => ({
|
|
|
16600
16600
|
n.scenarioInteractionRuntime,
|
|
16601
16601
|
e.customerInteractionSession.interactionSessionId
|
|
16602
16602
|
]);
|
|
16603
|
-
const Ze = le((
|
|
16604
|
-
const U =
|
|
16605
|
-
({ context: Q }) => Q.commandId !==
|
|
16603
|
+
const Ze = le((M) => {
|
|
16604
|
+
const U = T.current.filter(
|
|
16605
|
+
({ context: Q }) => Q.commandId !== M
|
|
16606
16606
|
);
|
|
16607
|
-
|
|
16607
|
+
T.current = U, I(U);
|
|
16608
16608
|
}, []), tt = le(
|
|
16609
|
-
(
|
|
16610
|
-
const U =
|
|
16611
|
-
N.current.delete(U), _.current.get(U)?.close(), _.current.delete(U), v.current?.commandId === U && (v.current.leaseTimer !== null && window.clearTimeout(v.current.leaseTimer), v.current = null,
|
|
16609
|
+
(M) => {
|
|
16610
|
+
const U = M.context.commandId;
|
|
16611
|
+
N.current.delete(U), _.current.get(U)?.close(), _.current.delete(U), v.current?.commandId === U && (v.current.leaseTimer !== null && window.clearTimeout(v.current.leaseTimer), v.current = null, x(null)), V?.commandId === U && (Ba(
|
|
16612
16612
|
e,
|
|
16613
16613
|
n,
|
|
16614
|
-
|
|
16614
|
+
V.challengeId
|
|
16615
16615
|
).catch(
|
|
16616
16616
|
(J) => re.warn("Telegram link challenge cancellation failed", J)
|
|
16617
|
-
),
|
|
16617
|
+
), B(null)), E === U && (k(null), C("idle"), P(null)), Ze(U);
|
|
16618
16618
|
},
|
|
16619
|
-
[n, e,
|
|
16619
|
+
[n, e, E, Ze, V]
|
|
16620
16620
|
);
|
|
16621
16621
|
Y(() => {
|
|
16622
|
-
const
|
|
16622
|
+
const M = y.flatMap((Z) => {
|
|
16623
16623
|
const ae = Z.context.expiresAt ? Date.parse(Z.context.expiresAt) : Number.NaN;
|
|
16624
16624
|
return Number.isFinite(ae) ? [{ expiresAt: ae, target: Z }] : [];
|
|
16625
16625
|
}).sort((Z, ae) => Z.expiresAt - ae.expiresAt);
|
|
16626
|
-
if (
|
|
16626
|
+
if (M.length === 0) return;
|
|
16627
16627
|
const U = () => {
|
|
16628
16628
|
const Z = Date.now();
|
|
16629
|
-
for (const { expiresAt: ae, target: be } of
|
|
16629
|
+
for (const { expiresAt: ae, target: be } of M) {
|
|
16630
16630
|
if (ae > Z) break;
|
|
16631
|
-
|
|
16631
|
+
T.current.some(
|
|
16632
16632
|
({ context: Me }) => Me.commandId === be.context.commandId
|
|
16633
16633
|
) && tt(be);
|
|
16634
16634
|
}
|
|
16635
16635
|
};
|
|
16636
16636
|
let Q;
|
|
16637
16637
|
const J = () => {
|
|
16638
|
-
const Z =
|
|
16638
|
+
const Z = M[0].expiresAt - Date.now();
|
|
16639
16639
|
if (Z <= 0) {
|
|
16640
16640
|
U();
|
|
16641
16641
|
return;
|
|
@@ -16648,51 +16648,51 @@ const za = (t) => ({
|
|
|
16648
16648
|
return J(), () => {
|
|
16649
16649
|
Q !== void 0 && window.clearTimeout(Q);
|
|
16650
16650
|
};
|
|
16651
|
-
}, [y, tt]), Y(() => ($.setDiagnostics((
|
|
16652
|
-
if (re.debug(`[CompactPreview] ${
|
|
16653
|
-
const Q =
|
|
16651
|
+
}, [y, tt]), Y(() => ($.setDiagnostics((M, U) => {
|
|
16652
|
+
if (re.debug(`[CompactPreview] ${M}`, U), M === "expired" && U?.kind === "CTA" && typeof U.subjectId == "string") {
|
|
16653
|
+
const Q = T.current.find(
|
|
16654
16654
|
({ context: J }) => J.commandId === U.subjectId
|
|
16655
16655
|
);
|
|
16656
16656
|
Q && tt(Q);
|
|
16657
16657
|
}
|
|
16658
16658
|
}), () => $.setDiagnostics(void 0)), [tt, $]);
|
|
16659
16659
|
const Ut = le(
|
|
16660
|
-
async (
|
|
16660
|
+
async (M) => {
|
|
16661
16661
|
const U = j.current, Q = ++X.current;
|
|
16662
|
-
N.current.set(
|
|
16662
|
+
N.current.set(M.commandId, Q);
|
|
16663
16663
|
const J = () => {
|
|
16664
|
-
const ae =
|
|
16665
|
-
return U === j.current && N.current.get(
|
|
16666
|
-
({ context: be }) => be.commandId ===
|
|
16664
|
+
const ae = M.expiresAt ? Date.parse(M.expiresAt) : Number.NaN;
|
|
16665
|
+
return U === j.current && N.current.get(M.commandId) === Q && T.current.some(
|
|
16666
|
+
({ context: be }) => be.commandId === M.commandId
|
|
16667
16667
|
) && (!Number.isFinite(ae) || ae > Date.now());
|
|
16668
16668
|
};
|
|
16669
|
-
if (
|
|
16669
|
+
if (V && V.commandId !== M.commandId)
|
|
16670
16670
|
throw new Error("Another Telegram connection is awaiting confirmation");
|
|
16671
|
-
if (!
|
|
16671
|
+
if (!V) {
|
|
16672
16672
|
const ae = window.open("about:blank", "_blank");
|
|
16673
|
-
ae && (ae.opener = null, _.current.set(
|
|
16673
|
+
ae && (ae.opener = null, _.current.set(M.commandId, ae)), k(M.commandId), C("creating"), P(null);
|
|
16674
16674
|
try {
|
|
16675
16675
|
const be = await u1(
|
|
16676
16676
|
e,
|
|
16677
16677
|
n,
|
|
16678
|
-
[
|
|
16678
|
+
[M.commandId, W.current || null].filter((Me) => Me !== null).join(":")
|
|
16679
16679
|
);
|
|
16680
|
-
return J() ? (ae && !ae.closed && (ae.location.href = be.deepLink),
|
|
16681
|
-
commandId:
|
|
16680
|
+
return J() ? (ae && !ae.closed && (ae.location.href = be.deepLink), B({
|
|
16681
|
+
commandId: M.commandId,
|
|
16682
16682
|
challengeId: be.id,
|
|
16683
16683
|
botUsername: be.botUsername,
|
|
16684
16684
|
deepLink: be.deepLink,
|
|
16685
16685
|
manualCommand: be.manualCommand
|
|
16686
16686
|
}), C("awaiting_confirmation"), P(
|
|
16687
16687
|
ae ? "cta.telegramPopupOpened" : "cta.telegramPopupBlocked"
|
|
16688
|
-
), "AWAITING_CONFIRMATION") : (ae?.close(), _.current.delete(
|
|
16688
|
+
), "AWAITING_CONFIRMATION") : (ae?.close(), _.current.delete(M.commandId), Ba(e, n, be.id).catch(
|
|
16689
16689
|
(Me) => re.warn(
|
|
16690
16690
|
"Stale Telegram link challenge cancellation failed",
|
|
16691
16691
|
Me
|
|
16692
16692
|
)
|
|
16693
16693
|
), "AWAITING_CONFIRMATION");
|
|
16694
16694
|
} catch (be) {
|
|
16695
|
-
if (ae?.close(), _.current.delete(
|
|
16695
|
+
if (ae?.close(), _.current.delete(M.commandId), !J())
|
|
16696
16696
|
return "AWAITING_CONFIRMATION";
|
|
16697
16697
|
throw C("idle"), P("cta.telegramLinkFailed"), be;
|
|
16698
16698
|
}
|
|
@@ -16701,17 +16701,17 @@ const za = (t) => ({
|
|
|
16701
16701
|
const Z = await c1(
|
|
16702
16702
|
e,
|
|
16703
16703
|
n,
|
|
16704
|
-
|
|
16704
|
+
V.challengeId
|
|
16705
16705
|
);
|
|
16706
16706
|
if (!J())
|
|
16707
16707
|
return "AWAITING_CONFIRMATION";
|
|
16708
16708
|
if (Z.linked || Z.challengeStatus === "CONFIRMED")
|
|
16709
|
-
return
|
|
16709
|
+
return B(null), C("idle"), k(null), N.current.delete(M.commandId), _.current.delete(M.commandId), Ze(M.commandId), "COMPLETED";
|
|
16710
16710
|
if (Z.challengeStatus === "PENDING_CONFIRMATION") {
|
|
16711
16711
|
const ae = await l1(
|
|
16712
16712
|
e,
|
|
16713
16713
|
n,
|
|
16714
|
-
|
|
16714
|
+
V.challengeId
|
|
16715
16715
|
);
|
|
16716
16716
|
if (!J())
|
|
16717
16717
|
return "AWAITING_CONFIRMATION";
|
|
@@ -16719,13 +16719,13 @@ const za = (t) => ({
|
|
|
16719
16719
|
throw new Error(
|
|
16720
16720
|
"Telegram link confirmation did not activate the link"
|
|
16721
16721
|
);
|
|
16722
|
-
return
|
|
16722
|
+
return B(null), C("idle"), k(null), N.current.delete(M.commandId), _.current.delete(M.commandId), Ze(M.commandId), "COMPLETED";
|
|
16723
16723
|
}
|
|
16724
|
-
return Z.challengeStatus === "EXPIRED" || Z.challengeStatus === "REVOKED" ? (W.current += 1,
|
|
16724
|
+
return Z.challengeStatus === "EXPIRED" || Z.challengeStatus === "REVOKED" ? (W.current += 1, B(null), C("idle"), P("cta.telegramLinkExpired"), "AWAITING_CONFIRMATION") : (C("awaiting_confirmation"), P("cta.telegramPressStart"), "AWAITING_CONFIRMATION");
|
|
16725
16725
|
},
|
|
16726
|
-
[n, e, Ze,
|
|
16726
|
+
[n, e, Ze, V]
|
|
16727
16727
|
), kt = le(
|
|
16728
|
-
(
|
|
16728
|
+
(M) => {
|
|
16729
16729
|
const U = n.scenarioInteractionRuntime.getPrincipalSessionId();
|
|
16730
16730
|
De(U);
|
|
16731
16731
|
const {
|
|
@@ -16733,14 +16733,14 @@ const za = (t) => ({
|
|
|
16733
16733
|
currentThreadMessages: J,
|
|
16734
16734
|
pendingCustomerMessage: Z,
|
|
16735
16735
|
threads: ae
|
|
16736
|
-
} = K.getState(), be =
|
|
16736
|
+
} = K.getState(), be = M.conversationId ?? Q, Me = be ? { ...M, conversationId: be } : M, Qe = Z && Z.conversationId === be, xe = be === Q ? J : ae.get(be ?? "") ?? [], Tt = {
|
|
16737
16737
|
context: Me,
|
|
16738
16738
|
principalSessionId: U,
|
|
16739
16739
|
threadId: be,
|
|
16740
16740
|
afterMessageId: Qe ? Z.id : xe.at(-1)?.id ?? null
|
|
16741
|
-
}, bt =
|
|
16741
|
+
}, bt = T.current.findIndex(
|
|
16742
16742
|
({ context: Ct }) => Ct.commandId === Me.commandId
|
|
16743
|
-
), nt = bt === -1 ? [...
|
|
16743
|
+
), nt = bt === -1 ? [...T.current, Tt] : T.current.map(
|
|
16744
16744
|
(Ct, Ke) => Ke === bt ? Tt : Ct
|
|
16745
16745
|
);
|
|
16746
16746
|
let Ae;
|
|
@@ -16752,67 +16752,67 @@ const za = (t) => ({
|
|
|
16752
16752
|
].filter((Jt) => Jt?.kind === "CTA").map((Jt) => Jt.subjectId)
|
|
16753
16753
|
), Ke = /* @__PURE__ */ new Set([
|
|
16754
16754
|
v.current?.commandId,
|
|
16755
|
-
|
|
16756
|
-
|
|
16755
|
+
E,
|
|
16756
|
+
V?.commandId,
|
|
16757
16757
|
...Ct
|
|
16758
16758
|
]), jr = nt.findIndex(
|
|
16759
16759
|
({ context: Jt }) => Jt.commandId !== Me.commandId && !Ke.has(Jt.commandId)
|
|
16760
16760
|
);
|
|
16761
16761
|
jr >= 0 && ([Ae] = nt.splice(jr, 1));
|
|
16762
16762
|
}
|
|
16763
|
-
|
|
16763
|
+
T.current = nt, I(nt), Ae && (N.current.delete(Ae.context.commandId), _.current.get(Ae.context.commandId)?.close(), _.current.delete(Ae.context.commandId), re.warn("Evicted stale CTA after reaching the retention limit", {
|
|
16764
16764
|
commandId: Ae.context.commandId,
|
|
16765
16765
|
limit: qa
|
|
16766
|
-
})),
|
|
16766
|
+
})), M.conversationId && $.receiveCta(Me);
|
|
16767
16767
|
},
|
|
16768
16768
|
[
|
|
16769
16769
|
n.scenarioInteractionRuntime,
|
|
16770
16770
|
$,
|
|
16771
|
-
|
|
16771
|
+
E,
|
|
16772
16772
|
De,
|
|
16773
|
-
|
|
16773
|
+
V?.commandId
|
|
16774
16774
|
]
|
|
16775
16775
|
);
|
|
16776
16776
|
Y(() => n.commandRuntime.setInternalHandlers({
|
|
16777
|
-
setAssistantVisible: (
|
|
16778
|
-
ve(
|
|
16777
|
+
setAssistantVisible: (M, U) => {
|
|
16778
|
+
ve(M), M || ge(!1, {
|
|
16779
16779
|
actor: "SCENARIO",
|
|
16780
16780
|
reason: "SCENARIO_COMMAND",
|
|
16781
16781
|
sourceCommandId: U
|
|
16782
16782
|
}), $.setRouting({
|
|
16783
|
-
chatOpen:
|
|
16784
|
-
chromeVisible:
|
|
16783
|
+
chatOpen: M ? o.current : !1,
|
|
16784
|
+
chromeVisible: M,
|
|
16785
16785
|
launcherVisible: !e.hideOpenButton
|
|
16786
16786
|
});
|
|
16787
16787
|
},
|
|
16788
|
-
setChatOpen: async (
|
|
16789
|
-
|
|
16788
|
+
setChatOpen: async (M, U) => {
|
|
16789
|
+
M && ve(!0);
|
|
16790
16790
|
const Q = {
|
|
16791
16791
|
actor: "SCENARIO",
|
|
16792
16792
|
reason: "SCENARIO_COMMAND",
|
|
16793
16793
|
sourceCommandId: U
|
|
16794
|
-
}, J =
|
|
16794
|
+
}, J = M ? ue(Q) : null;
|
|
16795
16795
|
if (J) {
|
|
16796
16796
|
if (!await J)
|
|
16797
16797
|
throw new Error("Compact preview conversation could not be opened");
|
|
16798
16798
|
return;
|
|
16799
16799
|
}
|
|
16800
|
-
ge(
|
|
16800
|
+
ge(M, Q), M && me(st.text);
|
|
16801
16801
|
},
|
|
16802
|
-
playAnimation: async (
|
|
16803
|
-
if (!Al(
|
|
16804
|
-
throw new Error(`Unsupported animation: ${
|
|
16805
|
-
await n.playAvatarAnimation(
|
|
16802
|
+
playAnimation: async (M, U) => {
|
|
16803
|
+
if (!Al(M))
|
|
16804
|
+
throw new Error(`Unsupported animation: ${M}`);
|
|
16805
|
+
await n.playAvatarAnimation(M, U);
|
|
16806
16806
|
},
|
|
16807
16807
|
showCta: kt,
|
|
16808
16808
|
connectTelegram: Ut,
|
|
16809
|
-
speakText: (
|
|
16810
|
-
startVoiceConversation: async (
|
|
16809
|
+
speakText: (M) => vs.getState().actions.speakText(e, n, M),
|
|
16810
|
+
startVoiceConversation: async (M) => {
|
|
16811
16811
|
ge(!0, {
|
|
16812
16812
|
actor: "SCENARIO",
|
|
16813
16813
|
reason: "SCENARIO_COMMAND",
|
|
16814
|
-
sourceCommandId:
|
|
16815
|
-
}), me(st.voice), await vs.getState().actions.offerConversation(
|
|
16814
|
+
sourceCommandId: M.commandId
|
|
16815
|
+
}), me(st.voice), await vs.getState().actions.offerConversation(M);
|
|
16816
16816
|
}
|
|
16817
16817
|
}), [
|
|
16818
16818
|
n,
|
|
@@ -16826,22 +16826,22 @@ const za = (t) => ({
|
|
|
16826
16826
|
ve
|
|
16827
16827
|
]);
|
|
16828
16828
|
const Hr = n.scenarioInteractionRuntime.getPrincipalSessionId(), Xr = y.some(
|
|
16829
|
-
({ principalSessionId:
|
|
16829
|
+
({ principalSessionId: M }) => M === Hr
|
|
16830
16830
|
), je = y.find(
|
|
16831
|
-
(
|
|
16831
|
+
(M) => M.principalSessionId === Hr && M.threadId === b
|
|
16832
16832
|
) ?? null, Zr = je?.context ?? null, Tn = je?.afterMessageId ?? null, mt = le(
|
|
16833
|
-
(
|
|
16834
|
-
const J = `${
|
|
16835
|
-
if (
|
|
16836
|
-
if (
|
|
16837
|
-
const ae =
|
|
16838
|
-
ae &&
|
|
16833
|
+
(M, U, Q) => {
|
|
16834
|
+
const J = `${M.principalSessionId}:${M.context.commandId}`;
|
|
16835
|
+
if (O.current.has(J)) return !1;
|
|
16836
|
+
if (O.current.set(J, U), O.current.size > 256) {
|
|
16837
|
+
const ae = O.current.keys().next().value;
|
|
16838
|
+
ae && O.current.delete(ae);
|
|
16839
16839
|
}
|
|
16840
16840
|
const Z = {
|
|
16841
16841
|
type: U,
|
|
16842
16842
|
subjectKind: "CTA",
|
|
16843
|
-
subjectId:
|
|
16844
|
-
attributionHandle:
|
|
16843
|
+
subjectId: M.context.commandId,
|
|
16844
|
+
attributionHandle: M.context.commandId
|
|
16845
16845
|
};
|
|
16846
16846
|
return Q ? n.scenarioInteractionRuntime.recordCompactEngagement(
|
|
16847
16847
|
Z,
|
|
@@ -16850,9 +16850,9 @@ const za = (t) => ({
|
|
|
16850
16850
|
},
|
|
16851
16851
|
[n.scenarioInteractionRuntime]
|
|
16852
16852
|
), Ue = le(
|
|
16853
|
-
async (
|
|
16854
|
-
const Q = n.scenarioInteractionRuntime.getPrincipalSessionId(), J =
|
|
16855
|
-
if (!J || J.principalSessionId !== Q || !
|
|
16853
|
+
async (M, U) => {
|
|
16854
|
+
const Q = n.scenarioInteractionRuntime.getPrincipalSessionId(), J = M ? y.find(({ context: xe }) => xe.commandId === M) : je;
|
|
16855
|
+
if (!J || J.principalSessionId !== Q || !M && J.threadId !== b)
|
|
16856
16856
|
return De(Q), "TERMINAL_FAILURE";
|
|
16857
16857
|
if (v.current) return "TERMINAL_FAILURE";
|
|
16858
16858
|
const Z = J.context, ae = j.current, be = ++A.current, Me = {
|
|
@@ -16860,7 +16860,7 @@ const za = (t) => ({
|
|
|
16860
16860
|
commandId: Z.commandId,
|
|
16861
16861
|
leaseTimer: null
|
|
16862
16862
|
};
|
|
16863
|
-
v.current = Me,
|
|
16863
|
+
v.current = Me, x(Z.commandId);
|
|
16864
16864
|
const Qe = new Promise(
|
|
16865
16865
|
(xe) => {
|
|
16866
16866
|
Me.leaseTimer = window.setTimeout(() => {
|
|
@@ -16868,7 +16868,7 @@ const za = (t) => ({
|
|
|
16868
16868
|
xe(vi);
|
|
16869
16869
|
return;
|
|
16870
16870
|
}
|
|
16871
|
-
v.current = null,
|
|
16871
|
+
v.current = null, x(null), Z.action === "connect_telegram" && (N.current.delete(Z.commandId), _.current.get(
|
|
16872
16872
|
Z.commandId
|
|
16873
16873
|
)?.close(), _.current.delete(Z.commandId), k(
|
|
16874
16874
|
(bt) => bt === Z.commandId ? null : bt
|
|
@@ -16886,35 +16886,35 @@ const za = (t) => ({
|
|
|
16886
16886
|
n.commandRuntime.executeCtaAction(Z),
|
|
16887
16887
|
Qe
|
|
16888
16888
|
]);
|
|
16889
|
-
return xe === vi || ae !== j.current ? "TERMINAL_FAILURE" :
|
|
16889
|
+
return xe === vi || ae !== j.current ? "TERMINAL_FAILURE" : T.current.some(
|
|
16890
16890
|
({ context: Tt }) => Tt.commandId === Z.commandId
|
|
16891
|
-
) ? xe === "COMPLETED" || xe === "TERMINAL_FAILURE" ? (Ze(Z.commandId),
|
|
16891
|
+
) ? xe === "COMPLETED" || xe === "TERMINAL_FAILURE" ? (Ze(Z.commandId), E === Z.commandId && (k(null), C("idle"), P(null)), xe) : xe === "RETRYABLE_FAILURE" ? (C(V ? "awaiting_confirmation" : "idle"), P(
|
|
16892
16892
|
Z.action === "connect_telegram" ? "cta.telegramConnectFailed" : null
|
|
16893
16893
|
), "RETRYABLE_FAILURE") : "AWAITING_CONFIRMATION" : xe;
|
|
16894
16894
|
} catch (xe) {
|
|
16895
|
-
return re.error("CTA action failed", xe), ae !== j.current || !
|
|
16895
|
+
return re.error("CTA action failed", xe), ae !== j.current || !T.current.some(
|
|
16896
16896
|
({ context: Tt }) => Tt.commandId === Z.commandId
|
|
16897
16897
|
) || Ze(Z.commandId), "TERMINAL_FAILURE";
|
|
16898
16898
|
} finally {
|
|
16899
|
-
Me.leaseTimer !== null && (window.clearTimeout(Me.leaseTimer), Me.leaseTimer = null), ae === j.current && v.current?.token === be && (v.current = null,
|
|
16899
|
+
Me.leaseTimer !== null && (window.clearTimeout(Me.leaseTimer), Me.leaseTimer = null), ae === j.current && v.current?.token === be && (v.current = null, x(null));
|
|
16900
16900
|
}
|
|
16901
16901
|
},
|
|
16902
16902
|
[
|
|
16903
16903
|
n.commandRuntime,
|
|
16904
16904
|
n.scenarioInteractionRuntime,
|
|
16905
16905
|
y,
|
|
16906
|
-
|
|
16906
|
+
E,
|
|
16907
16907
|
b,
|
|
16908
16908
|
je,
|
|
16909
16909
|
Ze,
|
|
16910
16910
|
mt,
|
|
16911
16911
|
De,
|
|
16912
|
-
|
|
16912
|
+
V
|
|
16913
16913
|
]
|
|
16914
16914
|
), at = le(
|
|
16915
|
-
(
|
|
16916
|
-
const Q = n.scenarioInteractionRuntime.getPrincipalSessionId(), J =
|
|
16917
|
-
return !J || J.principalSessionId !== Q || !
|
|
16915
|
+
(M, U) => {
|
|
16916
|
+
const Q = n.scenarioInteractionRuntime.getPrincipalSessionId(), J = M ? y.find(({ context: Z }) => Z.commandId === M) : je;
|
|
16917
|
+
return !J || J.principalSessionId !== Q || !M && J.threadId !== b ? (De(Q), !1) : v.current?.commandId === J.context.commandId ? !1 : (mt(
|
|
16918
16918
|
J,
|
|
16919
16919
|
"CTA_DISMISSED",
|
|
16920
16920
|
U
|
|
@@ -16930,22 +16930,22 @@ const za = (t) => ({
|
|
|
16930
16930
|
De
|
|
16931
16931
|
]
|
|
16932
16932
|
), tr = le(
|
|
16933
|
-
(
|
|
16933
|
+
(M) => {
|
|
16934
16934
|
const U = y.find(
|
|
16935
|
-
({ context: Z }) => Z.commandId ===
|
|
16936
|
-
), Q =
|
|
16935
|
+
({ context: Z }) => Z.commandId === M
|
|
16936
|
+
), Q = E === M, J = Q ? S === "creating" ? r("cta.preparingLink") : S === "awaiting_confirmation" ? r("cta.confirmTelegram") : S === "confirming" ? r("cta.confirming") : U?.context.label ?? null : U?.context.label ?? null;
|
|
16937
16937
|
return {
|
|
16938
|
-
busy:
|
|
16938
|
+
busy: z === M || Q && (S === "creating" || S === "confirming"),
|
|
16939
16939
|
buttonLabel: J,
|
|
16940
|
-
feedback: Q &&
|
|
16940
|
+
feedback: Q && D ? r(D) : null
|
|
16941
16941
|
};
|
|
16942
16942
|
},
|
|
16943
16943
|
[
|
|
16944
16944
|
y,
|
|
16945
|
-
|
|
16946
|
-
|
|
16947
|
-
E,
|
|
16945
|
+
D,
|
|
16946
|
+
z,
|
|
16948
16947
|
S,
|
|
16948
|
+
E,
|
|
16949
16949
|
r
|
|
16950
16950
|
]
|
|
16951
16951
|
), xt = je ? tr(je.context.commandId) : { busy: !1, buttonLabel: null, feedback: null }, gt = {
|
|
@@ -16973,9 +16973,9 @@ const za = (t) => ({
|
|
|
16973
16973
|
ctaBusy: xt.busy,
|
|
16974
16974
|
ctaButtonLabel: xt.buttonLabel,
|
|
16975
16975
|
ctaFeedback: xt.feedback,
|
|
16976
|
-
ctaTelegramBotUsername:
|
|
16977
|
-
ctaTelegramDeepLink:
|
|
16978
|
-
ctaManualCommand:
|
|
16976
|
+
ctaTelegramBotUsername: V && V.commandId === je?.context.commandId ? V.botUsername : null,
|
|
16977
|
+
ctaTelegramDeepLink: V && V.commandId === je?.context.commandId ? V.deepLink : null,
|
|
16978
|
+
ctaManualCommand: V && V.commandId === je?.context.commandId ? V.manualCommand : null,
|
|
16979
16979
|
hasUnreadCta: Xr,
|
|
16980
16980
|
compactPreviewController: $,
|
|
16981
16981
|
getCtaPresentation: tr,
|
|
@@ -17102,13 +17102,13 @@ function G1(t, e, n, r, s) {
|
|
|
17102
17102
|
), l = Math.max(1, u - o), d = Math.max(1, Math.min(e.height || 220, l)), p = r === "RIGHT" ? t.x + Fe - c : t.x, h = Vt(p, i, a - c), f = Math.max(0, t.y - hs - o), m = Math.max(
|
|
17103
17103
|
0,
|
|
17104
17104
|
u - (t.y + Fe + hs)
|
|
17105
|
-
), g = (I,
|
|
17106
|
-
const C = I === "above" ? t.y - hs - d : t.y + Fe + hs,
|
|
17105
|
+
), g = (I, S) => {
|
|
17106
|
+
const C = I === "above" ? t.y - hs - d : t.y + Fe + hs, E = Vt(C, o, u - d), k = { x: h, y: E, width: c, height: d }, z = Math.max(0, d - S);
|
|
17107
17107
|
return {
|
|
17108
17108
|
placement: I,
|
|
17109
|
-
y:
|
|
17109
|
+
y: E,
|
|
17110
17110
|
avoidanceFailed: !!(s && W1(k, s)),
|
|
17111
|
-
score:
|
|
17111
|
+
score: z * c * 2 + (s ? U1(k, s) : 0)
|
|
17112
17112
|
};
|
|
17113
17113
|
}, b = f >= m ? [g("above", f), g("below", m)] : [
|
|
17114
17114
|
g("below", m),
|
|
@@ -17275,11 +17275,11 @@ function Q1({
|
|
|
17275
17275
|
onCompactPreviewCollapse: m,
|
|
17276
17276
|
children: g
|
|
17277
17277
|
}) {
|
|
17278
|
-
const { direction: b, locale: y, t: I } = xn(), [
|
|
17278
|
+
const { direction: b, locale: y, t: I } = xn(), [S] = he(() => wi(h)), [C, E] = he(S.launcher), [k, z] = he(S.panel), [x, D] = he(null), [P, V] = he(!1), [B, W] = he(0), [X, N] = he({
|
|
17279
17279
|
width: 320,
|
|
17280
17280
|
height: 220
|
|
17281
|
-
}), [_, A] = he(null), [v,
|
|
17282
|
-
launcher:
|
|
17281
|
+
}), [_, A] = he(null), [v, T] = he($1), O = q({ launcher: C, panel: k }), G = q({
|
|
17282
|
+
launcher: S.launcherDock,
|
|
17283
17283
|
panel: k
|
|
17284
17284
|
}), j = q(!1), te = q(null), oe = q(null), ie = q(null), de = q(null), pe = q(null), ve = q(null), $ = q(!1), me = q(null), De = q(!1), Le = q(null), ge = q(null), ue = q(null), L = q(null), Je = q(null), Et = q(null), ln = q(null), Yt = q(r), qe = q(t), dn = q(!1), Ze = q(!1), tt = q(null), Ut = q(null), kt = q(null), Hr = q({
|
|
17285
17285
|
drag: !1,
|
|
@@ -17325,7 +17325,7 @@ function Q1({
|
|
|
17325
17325
|
if (!w) return;
|
|
17326
17326
|
const F = () => {
|
|
17327
17327
|
const ee = eC(w);
|
|
17328
|
-
|
|
17328
|
+
T(
|
|
17329
17329
|
(ne) => tC(ne, ee) ? ne : ee
|
|
17330
17330
|
);
|
|
17331
17331
|
};
|
|
@@ -17334,7 +17334,7 @@ function Q1({
|
|
|
17334
17334
|
};
|
|
17335
17335
|
}, []);
|
|
17336
17336
|
const tr = le((w) => {
|
|
17337
|
-
|
|
17337
|
+
O.current = { ...O.current, launcher: w }, E(w);
|
|
17338
17338
|
}, []), xt = le(
|
|
17339
17339
|
(w, F = !0) => {
|
|
17340
17340
|
const ee = Sr(w, Ue());
|
|
@@ -17345,11 +17345,11 @@ function Q1({
|
|
|
17345
17345
|
},
|
|
17346
17346
|
[Ue, tr]
|
|
17347
17347
|
), gt = le((w, F = !0) => {
|
|
17348
|
-
|
|
17348
|
+
O.current = { ...O.current, panel: w }, F && (G.current = {
|
|
17349
17349
|
...G.current,
|
|
17350
17350
|
panel: w
|
|
17351
|
-
}),
|
|
17352
|
-
}, []),
|
|
17351
|
+
}), z(w);
|
|
17352
|
+
}, []), M = le(() => {
|
|
17353
17353
|
const w = G.current;
|
|
17354
17354
|
Ha(
|
|
17355
17355
|
h,
|
|
@@ -17368,10 +17368,10 @@ function Q1({
|
|
|
17368
17368
|
G.current = {
|
|
17369
17369
|
launcher: F.launcherDock,
|
|
17370
17370
|
panel: F.panel
|
|
17371
|
-
},
|
|
17371
|
+
}, O.current = {
|
|
17372
17372
|
launcher: F.launcher,
|
|
17373
17373
|
panel: F.panel
|
|
17374
|
-
},
|
|
17374
|
+
}, E(F.launcher), z(F.panel);
|
|
17375
17375
|
}, []), Y(() => {
|
|
17376
17376
|
if (je.current === h) return;
|
|
17377
17377
|
const w = window.requestAnimationFrame(() => {
|
|
@@ -17380,10 +17380,10 @@ function Q1({
|
|
|
17380
17380
|
G.current = {
|
|
17381
17381
|
launcher: F.launcherDock,
|
|
17382
17382
|
panel: F.panel
|
|
17383
|
-
},
|
|
17383
|
+
}, O.current = {
|
|
17384
17384
|
launcher: F.launcher,
|
|
17385
17385
|
panel: F.panel
|
|
17386
|
-
},
|
|
17386
|
+
}, E(F.launcher), z(F.panel);
|
|
17387
17387
|
});
|
|
17388
17388
|
return () => window.cancelAnimationFrame(w);
|
|
17389
17389
|
}, [h]);
|
|
@@ -17420,23 +17420,23 @@ function Q1({
|
|
|
17420
17420
|
[Ue, gt]
|
|
17421
17421
|
);
|
|
17422
17422
|
Y(() => {
|
|
17423
|
-
if (!
|
|
17423
|
+
if (!x) return;
|
|
17424
17424
|
const w = document.body.style.cursor, F = document.body.style.userSelect;
|
|
17425
|
-
document.body.style.cursor = J1[
|
|
17425
|
+
document.body.style.cursor = J1[x.kind], document.body.style.userSelect = "none";
|
|
17426
17426
|
const ee = (we) => {
|
|
17427
|
-
if (we.pointerId !==
|
|
17427
|
+
if (we.pointerId !== x.pointerId) return;
|
|
17428
17428
|
const ke = {
|
|
17429
|
-
x: we.clientX -
|
|
17430
|
-
y: we.clientY -
|
|
17429
|
+
x: we.clientX - x.startPointer.x,
|
|
17430
|
+
y: we.clientY - x.startPointer.y
|
|
17431
17431
|
}, Rt = Math.hypot(ke.x, ke.y);
|
|
17432
17432
|
if (!(!j.current && Rt < Xa)) {
|
|
17433
|
-
if (Rt >= Xa && (ie.current !== null && (window.clearTimeout(ie.current), ie.current = null), !j.current &&
|
|
17433
|
+
if (Rt >= Xa && (ie.current !== null && (window.clearTimeout(ie.current), ie.current = null), !j.current && x.kind === "launcher" && (de.current !== null && (window.clearTimeout(de.current), de.current = null), at("drag", !0)), j.current = !0), x.kind === "launcher") {
|
|
17434
17434
|
const rr = Er(
|
|
17435
17435
|
{
|
|
17436
|
-
x:
|
|
17437
|
-
y:
|
|
17436
|
+
x: x.startLauncher.x + ke.x,
|
|
17437
|
+
y: x.startLauncher.y + ke.y
|
|
17438
17438
|
},
|
|
17439
|
-
|
|
17439
|
+
x.viewport
|
|
17440
17440
|
);
|
|
17441
17441
|
te.current = rr, ue.current && oe.current === null && (oe.current = window.requestAnimationFrame(
|
|
17442
17442
|
() => {
|
|
@@ -17447,11 +17447,11 @@ function Q1({
|
|
|
17447
17447
|
));
|
|
17448
17448
|
return;
|
|
17449
17449
|
}
|
|
17450
|
-
U(
|
|
17450
|
+
U(x.kind, x.startPanel, ke, !1);
|
|
17451
17451
|
}
|
|
17452
17452
|
}, ne = (we, ke) => {
|
|
17453
|
-
if (!(we.pointerId !==
|
|
17454
|
-
if (De.current = !0, ie.current !== null && (window.clearTimeout(ie.current), ie.current = null), oe.current !== null && (window.cancelAnimationFrame(oe.current), oe.current = null),
|
|
17453
|
+
if (!(we.pointerId !== x.pointerId || De.current)) {
|
|
17454
|
+
if (De.current = !0, ie.current !== null && (window.clearTimeout(ie.current), ie.current = null), oe.current !== null && (window.cancelAnimationFrame(oe.current), oe.current = null), x.kind === "launcher") {
|
|
17455
17455
|
const Rt = te.current;
|
|
17456
17456
|
te.current = null;
|
|
17457
17457
|
const rr = Ue();
|
|
@@ -17459,16 +17459,16 @@ function Q1({
|
|
|
17459
17459
|
G.current.launcher,
|
|
17460
17460
|
rr
|
|
17461
17461
|
), hn = 0, Ro = !1;
|
|
17462
|
-
if (
|
|
17463
|
-
...
|
|
17462
|
+
if (O.current = {
|
|
17463
|
+
...O.current,
|
|
17464
17464
|
launcher: Rn
|
|
17465
17465
|
}, ue.current && (ue.current.style.transform = `translate3d(${Rn.x}px, ${Rn.y}px, 0)`, ue.current.style.willChange = ""), ke && j.current && Rt) {
|
|
17466
17466
|
const Mo = Wn(Rt, rr), Mn = Sr(Mo, rr);
|
|
17467
17467
|
if (Rn = Mn, G.current = {
|
|
17468
17468
|
...G.current,
|
|
17469
17469
|
launcher: Mo
|
|
17470
|
-
},
|
|
17471
|
-
...
|
|
17470
|
+
}, O.current = {
|
|
17471
|
+
...O.current,
|
|
17472
17472
|
launcher: Mn
|
|
17473
17473
|
}, ue.current && (ue.current.style.transform = `translate3d(${Mn.x}px, ${Mn.y}px, 0)`), ue.current && typeof ue.current.animate == "function" && !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
|
|
17474
17474
|
hn = 180;
|
|
@@ -17493,12 +17493,12 @@ function Q1({
|
|
|
17493
17493
|
j.current && (de.current !== null && window.clearTimeout(de.current), hn > 0 ? de.current = window.setTimeout(() => {
|
|
17494
17494
|
de.current = null, at("drag", !1);
|
|
17495
17495
|
}, hn) : Ro = !0), Ut.current !== null && window.clearTimeout(Ut.current), Ut.current = window.setTimeout(() => {
|
|
17496
|
-
Ut.current = null,
|
|
17496
|
+
Ut.current = null, E(Rn), D(null), Ro && at("drag", !1);
|
|
17497
17497
|
}, 0);
|
|
17498
|
-
} else ke ? gt(
|
|
17499
|
-
|
|
17498
|
+
} else ke ? gt(O.current.panel) : gt(x.startPanel, !1);
|
|
17499
|
+
x.kind === "launcher" && j.current && ($.current = !0, me.current !== null && window.clearTimeout(me.current), me.current = window.setTimeout(() => {
|
|
17500
17500
|
$.current = !1, me.current = null;
|
|
17501
|
-
}, 0)), ke &&
|
|
17501
|
+
}, 0)), ke && M(), x.kind !== "launcher" && D(null), document.body.style.cursor = w, document.body.style.userSelect = F, ge.current?.classList.remove("is-interacting");
|
|
17502
17502
|
}
|
|
17503
17503
|
}, ce = (we) => ne(we, !0), Ce = (we) => ne(we, !1);
|
|
17504
17504
|
return document.addEventListener("pointermove", ee), document.addEventListener("pointerup", ce), document.addEventListener("pointercancel", Ce), document.addEventListener("lostpointercapture", Ce), () => {
|
|
@@ -17508,8 +17508,8 @@ function Q1({
|
|
|
17508
17508
|
U,
|
|
17509
17509
|
xt,
|
|
17510
17510
|
Ue,
|
|
17511
|
-
|
|
17512
|
-
|
|
17511
|
+
x,
|
|
17512
|
+
M,
|
|
17513
17513
|
gt,
|
|
17514
17514
|
at
|
|
17515
17515
|
]), Dn(() => {
|
|
@@ -17618,16 +17618,16 @@ function Q1({
|
|
|
17618
17618
|
}, J = (w, F) => {
|
|
17619
17619
|
if (w.button !== 0 || w.isPrimary === !1 || r && F !== "launcher")
|
|
17620
17620
|
return;
|
|
17621
|
-
w.preventDefault(), w.stopPropagation(),
|
|
17621
|
+
w.preventDefault(), w.stopPropagation(), V(!1);
|
|
17622
17622
|
const ee = w.currentTarget;
|
|
17623
17623
|
typeof ee.setPointerCapture == "function" && ee.setPointerCapture(w.pointerId);
|
|
17624
|
-
let ne =
|
|
17624
|
+
let ne = O.current.launcher;
|
|
17625
17625
|
if (F === "launcher" && pe.current && ue.current) {
|
|
17626
17626
|
const ce = Ue(), Ce = ue.current.getBoundingClientRect(), we = Er(
|
|
17627
17627
|
{ x: Ce.left, y: Ce.top },
|
|
17628
17628
|
ce
|
|
17629
17629
|
);
|
|
17630
|
-
pe.current.cancel(), pe.current = null, de.current !== null && (window.clearTimeout(de.current), de.current = null), at("drag", !1, !0), ne = we,
|
|
17630
|
+
pe.current.cancel(), pe.current = null, de.current !== null && (window.clearTimeout(de.current), de.current = null), at("drag", !1, !0), ne = we, O.current = { ...O.current, launcher: we }, ue.current.style.transform = `translate3d(${we.x}px, ${we.y}px, 0)`, E(we);
|
|
17631
17631
|
}
|
|
17632
17632
|
j.current = !1, De.current = !1, te.current = null, F === "launcher" && ue.current && (ue.current.style.willChange = "transform", ie.current !== null && window.clearTimeout(ie.current), ie.current = window.setTimeout(() => {
|
|
17633
17633
|
ie.current = null, De.current = !0, $.current = !0;
|
|
@@ -17638,15 +17638,15 @@ function Q1({
|
|
|
17638
17638
|
};
|
|
17639
17639
|
ve.current = () => {
|
|
17640
17640
|
document.removeEventListener("pointerup", ce), document.removeEventListener("pointercancel", ce), document.removeEventListener("lostpointercapture", ce), ve.current = null;
|
|
17641
|
-
}, document.addEventListener("pointerup", ce), document.addEventListener("pointercancel", ce), document.addEventListener("lostpointercapture", ce), ue.current?.style.removeProperty("will-change"),
|
|
17641
|
+
}, document.addEventListener("pointerup", ce), document.addEventListener("pointercancel", ce), document.addEventListener("lostpointercapture", ce), ue.current?.style.removeProperty("will-change"), D(null), W(0), V(!0), window.requestAnimationFrame(() => {
|
|
17642
17642
|
Q(0);
|
|
17643
17643
|
});
|
|
17644
|
-
}, 520)),
|
|
17644
|
+
}, 520)), D({
|
|
17645
17645
|
kind: F,
|
|
17646
17646
|
pointerId: w.pointerId,
|
|
17647
17647
|
startPointer: { x: w.clientX, y: w.clientY },
|
|
17648
17648
|
startLauncher: ne,
|
|
17649
|
-
startPanel:
|
|
17649
|
+
startPanel: O.current.panel,
|
|
17650
17650
|
viewport: Ue()
|
|
17651
17651
|
});
|
|
17652
17652
|
}, Z = () => {
|
|
@@ -17655,8 +17655,8 @@ function Q1({
|
|
|
17655
17655
|
return;
|
|
17656
17656
|
}
|
|
17657
17657
|
const w = el(
|
|
17658
|
-
|
|
17659
|
-
|
|
17658
|
+
O.current.launcher,
|
|
17659
|
+
O.current.panel,
|
|
17660
17660
|
Ue()
|
|
17661
17661
|
);
|
|
17662
17662
|
gt(w), Ha(
|
|
@@ -17684,8 +17684,8 @@ function Q1({
|
|
|
17684
17684
|
else {
|
|
17685
17685
|
const ce = Er(
|
|
17686
17686
|
{
|
|
17687
|
-
...
|
|
17688
|
-
y:
|
|
17687
|
+
...O.current.launcher,
|
|
17688
|
+
y: O.current.launcher.y + ee.y
|
|
17689
17689
|
},
|
|
17690
17690
|
Ue()
|
|
17691
17691
|
);
|
|
@@ -17694,23 +17694,23 @@ function Q1({
|
|
|
17694
17694
|
yRatio: Wn(ce, Ue()).yRatio
|
|
17695
17695
|
});
|
|
17696
17696
|
}
|
|
17697
|
-
|
|
17697
|
+
M();
|
|
17698
17698
|
return;
|
|
17699
17699
|
}
|
|
17700
|
-
U(F,
|
|
17700
|
+
U(F, O.current.panel, ee), M();
|
|
17701
17701
|
}
|
|
17702
17702
|
}, Me = () => {
|
|
17703
|
-
ie.current !== null && (window.clearTimeout(ie.current), ie.current = null), W(0),
|
|
17703
|
+
ie.current !== null && (window.clearTimeout(ie.current), ie.current = null), W(0), V(!0), window.requestAnimationFrame(() => {
|
|
17704
17704
|
Q(0);
|
|
17705
17705
|
});
|
|
17706
17706
|
}, Qe = (w) => {
|
|
17707
17707
|
xt({
|
|
17708
17708
|
...G.current.launcher,
|
|
17709
17709
|
...w
|
|
17710
|
-
}),
|
|
17710
|
+
}), M(), V(!1), L.current?.focus({ preventScroll: !0 });
|
|
17711
17711
|
}, xe = (w, F) => {
|
|
17712
17712
|
const ee = ae(w);
|
|
17713
|
-
ee && (w.preventDefault(), w.stopPropagation(), U(F,
|
|
17713
|
+
ee && (w.preventDefault(), w.stopPropagation(), U(F, O.current.panel, ee), M());
|
|
17714
17714
|
}, Tt = n && t && r ? { top: 0, left: 0 } : {
|
|
17715
17715
|
left: k.x,
|
|
17716
17716
|
top: k.y,
|
|
@@ -17766,11 +17766,11 @@ function Q1({
|
|
|
17766
17766
|
) ?? []
|
|
17767
17767
|
);
|
|
17768
17768
|
if (w.key === "Escape" && !w.defaultPrevented) {
|
|
17769
|
-
w.preventDefault(), w.stopPropagation(),
|
|
17769
|
+
w.preventDefault(), w.stopPropagation(), V(!1), L.current?.focus({ preventScroll: !0 });
|
|
17770
17770
|
return;
|
|
17771
17771
|
}
|
|
17772
17772
|
if (w.key === "Tab" && !w.defaultPrevented) {
|
|
17773
|
-
|
|
17773
|
+
V(!1);
|
|
17774
17774
|
return;
|
|
17775
17775
|
}
|
|
17776
17776
|
const ee = Math.max(
|
|
@@ -17783,7 +17783,7 @@ function Q1({
|
|
|
17783
17783
|
"div",
|
|
17784
17784
|
{
|
|
17785
17785
|
ref: ge,
|
|
17786
|
-
className: `bridge-ai-chat-widget pointer-events-none fixed inset-0 z-[9999999] ${
|
|
17786
|
+
className: `bridge-ai-chat-widget pointer-events-none fixed inset-0 z-[9999999] ${x ? "is-interacting" : ""}`,
|
|
17787
17787
|
"data-mobile": n,
|
|
17788
17788
|
"data-preview-active": !!c,
|
|
17789
17789
|
dir: b,
|
|
@@ -17946,7 +17946,7 @@ function Q1({
|
|
|
17946
17946
|
},
|
|
17947
17947
|
onBlurCapture: (w) => {
|
|
17948
17948
|
const F = w.relatedTarget;
|
|
17949
|
-
(!(F instanceof Node) || !w.currentTarget.contains(F)) &&
|
|
17949
|
+
(!(F instanceof Node) || !w.currentTarget.contains(F)) && V(!1);
|
|
17950
17950
|
},
|
|
17951
17951
|
children: [
|
|
17952
17952
|
/* @__PURE__ */ H(
|
|
@@ -17954,7 +17954,7 @@ function Q1({
|
|
|
17954
17954
|
{
|
|
17955
17955
|
type: "button",
|
|
17956
17956
|
role: "menuitem",
|
|
17957
|
-
tabIndex:
|
|
17957
|
+
tabIndex: B === 0 ? 0 : -1,
|
|
17958
17958
|
onClick: () => Qe({ side: "LEFT" }),
|
|
17959
17959
|
children: I("compact.moveLeft")
|
|
17960
17960
|
}
|
|
@@ -17964,7 +17964,7 @@ function Q1({
|
|
|
17964
17964
|
{
|
|
17965
17965
|
type: "button",
|
|
17966
17966
|
role: "menuitem",
|
|
17967
|
-
tabIndex:
|
|
17967
|
+
tabIndex: B === 1 ? 0 : -1,
|
|
17968
17968
|
onClick: () => Qe({ side: "RIGHT" }),
|
|
17969
17969
|
children: I("compact.moveRight")
|
|
17970
17970
|
}
|
|
@@ -17974,7 +17974,7 @@ function Q1({
|
|
|
17974
17974
|
{
|
|
17975
17975
|
type: "button",
|
|
17976
17976
|
role: "menuitem",
|
|
17977
|
-
tabIndex:
|
|
17977
|
+
tabIndex: B === 2 ? 0 : -1,
|
|
17978
17978
|
onClick: () => Qe({
|
|
17979
17979
|
yRatio: Math.max(
|
|
17980
17980
|
0,
|
|
@@ -17989,7 +17989,7 @@ function Q1({
|
|
|
17989
17989
|
{
|
|
17990
17990
|
type: "button",
|
|
17991
17991
|
role: "menuitem",
|
|
17992
|
-
tabIndex:
|
|
17992
|
+
tabIndex: B === 3 ? 0 : -1,
|
|
17993
17993
|
onClick: () => Qe({
|
|
17994
17994
|
yRatio: Math.min(
|
|
17995
17995
|
1,
|
|
@@ -18004,7 +18004,7 @@ function Q1({
|
|
|
18004
18004
|
{
|
|
18005
18005
|
type: "button",
|
|
18006
18006
|
role: "menuitem",
|
|
18007
|
-
tabIndex:
|
|
18007
|
+
tabIndex: B === 4 ? 0 : -1,
|
|
18008
18008
|
onClick: () => Qe({ yRatio: 0 }),
|
|
18009
18009
|
children: I("compact.moveTop")
|
|
18010
18010
|
}
|
|
@@ -18014,7 +18014,7 @@ function Q1({
|
|
|
18014
18014
|
{
|
|
18015
18015
|
type: "button",
|
|
18016
18016
|
role: "menuitem",
|
|
18017
|
-
tabIndex:
|
|
18017
|
+
tabIndex: B === 5 ? 0 : -1,
|
|
18018
18018
|
onClick: () => Qe({ yRatio: 0.5 }),
|
|
18019
18019
|
children: I("compact.moveMiddle")
|
|
18020
18020
|
}
|
|
@@ -18024,7 +18024,7 @@ function Q1({
|
|
|
18024
18024
|
{
|
|
18025
18025
|
type: "button",
|
|
18026
18026
|
role: "menuitem",
|
|
18027
|
-
tabIndex:
|
|
18027
|
+
tabIndex: B === 6 ? 0 : -1,
|
|
18028
18028
|
onClick: () => Qe({ yRatio: 1 }),
|
|
18029
18029
|
children: I("compact.moveBottom")
|
|
18030
18030
|
}
|
|
@@ -18034,9 +18034,9 @@ function Q1({
|
|
|
18034
18034
|
{
|
|
18035
18035
|
type: "button",
|
|
18036
18036
|
role: "menuitem",
|
|
18037
|
-
tabIndex:
|
|
18037
|
+
tabIndex: B === 7 ? 0 : -1,
|
|
18038
18038
|
onClick: () => {
|
|
18039
|
-
m(),
|
|
18039
|
+
m(), V(!1), L.current?.focus({ preventScroll: !0 });
|
|
18040
18040
|
},
|
|
18041
18041
|
children: I("compact.collapseQuestion")
|
|
18042
18042
|
}
|
|
@@ -18137,40 +18137,40 @@ function iC() {
|
|
|
18137
18137
|
const b = p.current, y = h.current;
|
|
18138
18138
|
if (!b || !y) return;
|
|
18139
18139
|
let I = !1;
|
|
18140
|
-
const
|
|
18141
|
-
const
|
|
18142
|
-
s(Math.min(
|
|
18140
|
+
const S = (x) => {
|
|
18141
|
+
const D = x.detail ?? 0;
|
|
18142
|
+
s(Math.min(D, 0.99));
|
|
18143
18143
|
};
|
|
18144
18144
|
let C = null;
|
|
18145
|
-
const
|
|
18145
|
+
const E = new ResizeObserver((x) => {
|
|
18146
18146
|
if (!g.current) return;
|
|
18147
|
-
const
|
|
18148
|
-
if (!
|
|
18149
|
-
const { width: P, height:
|
|
18147
|
+
const D = x.at(-1);
|
|
18148
|
+
if (!D) return;
|
|
18149
|
+
const { width: P, height: V } = D.contentRect;
|
|
18150
18150
|
C !== null && window.clearTimeout(C), C = window.setTimeout(() => {
|
|
18151
|
-
a.current?.onResize(P,
|
|
18151
|
+
a.current?.onResize(P, V), C = null;
|
|
18152
18152
|
}, 80);
|
|
18153
18153
|
});
|
|
18154
18154
|
let k = null;
|
|
18155
|
-
const
|
|
18156
|
-
return import("./Avatar-
|
|
18155
|
+
const z = r.onAvatarLoadStarted();
|
|
18156
|
+
return import("./Avatar-C3PubeMM.js").then(({ Avatar: x }) => {
|
|
18157
18157
|
if (I) return;
|
|
18158
|
-
const
|
|
18158
|
+
const D = {
|
|
18159
18159
|
...r,
|
|
18160
18160
|
onAvatarReady: (P) => {
|
|
18161
|
-
!I && a.current === k && (s(1), k && f.current && k.applyLipSyncSnapshot(f.current),
|
|
18161
|
+
!I && a.current === k && (s(1), k && f.current && k.applyLipSyncSnapshot(f.current), z.onAvatarReady(P));
|
|
18162
18162
|
},
|
|
18163
18163
|
onAvatarLoadFailed: (P) => {
|
|
18164
|
-
!I && a.current === k &&
|
|
18164
|
+
!I && a.current === k && z.onAvatarLoadFailed(P);
|
|
18165
18165
|
}
|
|
18166
18166
|
};
|
|
18167
|
-
k = new
|
|
18168
|
-
}).catch((
|
|
18169
|
-
I ||
|
|
18167
|
+
k = new x(b, y, D), k.setRenderingEnabled(g.current), a.current = k, k.addEventListener("loading_progress", S), E.observe(b);
|
|
18168
|
+
}).catch((x) => {
|
|
18169
|
+
I || z.onAvatarLoadFailed(x);
|
|
18170
18170
|
}), () => {
|
|
18171
|
-
I = !0, k?.cancelBackgroundPreload(), k?.setRenderingEnabled(!1), k?.removeEventListener("loading_progress",
|
|
18171
|
+
I = !0, k?.cancelBackgroundPreload(), k?.setRenderingEnabled(!1), k?.removeEventListener("loading_progress", S), k && a.current === k && (a.current = null, z.onAvatarLoadFailed(
|
|
18172
18172
|
new Error("Avatar was unmounted before animation playback")
|
|
18173
|
-
)), C !== null && window.clearTimeout(C),
|
|
18173
|
+
)), C !== null && window.clearTimeout(C), E.disconnect();
|
|
18174
18174
|
};
|
|
18175
18175
|
}, [r, a, s]), Y(() => {
|
|
18176
18176
|
const b = () => {
|
|
@@ -18502,7 +18502,7 @@ const IC = (t) => t ? [t] : [], il = (t) => typeof Intl.Segmenter != "function"
|
|
|
18502
18502
|
revision: i
|
|
18503
18503
|
}
|
|
18504
18504
|
].slice(-4) : [];
|
|
18505
|
-
const I = d.map(({ text:
|
|
18505
|
+
const I = d.map(({ text: S }) => S).join("");
|
|
18506
18506
|
return p = {
|
|
18507
18507
|
displayedText: y,
|
|
18508
18508
|
stableText: y.slice(
|
|
@@ -18535,8 +18535,8 @@ const IC = (t) => t ? [t] : [], il = (t) => typeof Intl.Segmenter != "function"
|
|
|
18535
18535
|
if (l) {
|
|
18536
18536
|
if (l.firstTimestamp ??= g, g - l.firstTimestamp < yC)
|
|
18537
18537
|
return null;
|
|
18538
|
-
const
|
|
18539
|
-
l = null, m(
|
|
18538
|
+
const x = l.target, D = l.text;
|
|
18539
|
+
l = null, m(x, D);
|
|
18540
18540
|
}
|
|
18541
18541
|
if (f()) return null;
|
|
18542
18542
|
if (c)
|
|
@@ -18544,16 +18544,16 @@ const IC = (t) => t ? [t] : [], il = (t) => typeof Intl.Segmenter != "function"
|
|
|
18544
18544
|
const b = n.length - s.length;
|
|
18545
18545
|
if (b <= 0) return null;
|
|
18546
18546
|
u === 0 && b * t > fC && (u = mC, o = 0, a = null);
|
|
18547
|
-
const y = u > 0, I = y ? pC : t,
|
|
18547
|
+
const y = u > 0, I = y ? pC : t, S = a === null ? I : Math.min(
|
|
18548
18548
|
Math.max(g - a, 0),
|
|
18549
18549
|
CC
|
|
18550
18550
|
);
|
|
18551
|
-
if (a = g, o = Math.min(bC, o +
|
|
18552
|
-
const
|
|
18551
|
+
if (a = g, o = Math.min(bC, o + S / I), Math.floor(o) < 1) return null;
|
|
18552
|
+
const E = y ? Math.ceil(b / u) : 1, k = y ? vC(n, s.length, E) : E, z = n.slice(
|
|
18553
18553
|
s.length,
|
|
18554
18554
|
s.length + k
|
|
18555
18555
|
);
|
|
18556
|
-
return s = s.concat(
|
|
18556
|
+
return s = s.concat(z), o = Math.max(0, o - 1), y && (u -= 1), s.length === n.length && (o = 0, a = null, u = 0), h(z);
|
|
18557
18557
|
},
|
|
18558
18558
|
flush() {
|
|
18559
18559
|
return l && (n = l.target, r = l.text, l = null), f() && p.animatedText === "" ? null : (s = n.slice(), o = 0, a = null, u = 0, c = !1, h());
|
|
@@ -18645,32 +18645,32 @@ const al = (t) => t.kind !== "INFO", FC = (t) => {
|
|
|
18645
18645
|
feedback: d,
|
|
18646
18646
|
labels: p
|
|
18647
18647
|
}) {
|
|
18648
|
-
const h = un(() => ol(e), [e]), f = Zi(), [m, g] = he(() => /* @__PURE__ */ new Set()), b = le((
|
|
18649
|
-
g((
|
|
18650
|
-
if (
|
|
18651
|
-
const P = new Set(
|
|
18652
|
-
if (P.add(
|
|
18653
|
-
const
|
|
18654
|
-
|
|
18648
|
+
const h = un(() => ol(e), [e]), f = Zi(), [m, g] = he(() => /* @__PURE__ */ new Set()), b = le((x) => {
|
|
18649
|
+
g((D) => {
|
|
18650
|
+
if (D.has(x)) return D;
|
|
18651
|
+
const P = new Set(D);
|
|
18652
|
+
if (P.add(x), P.size > 64) {
|
|
18653
|
+
const V = P.values().next().value;
|
|
18654
|
+
V !== void 0 && P.delete(V);
|
|
18655
18655
|
}
|
|
18656
18656
|
return P;
|
|
18657
18657
|
});
|
|
18658
18658
|
}, []), y = e.kind === "CHOICE" ? e.choice.options.find(
|
|
18659
|
-
({ presentation:
|
|
18659
|
+
({ presentation: x }) => x === "PRIMARY"
|
|
18660
18660
|
)?.id : void 0, I = un(() => {
|
|
18661
18661
|
if (n !== "INTERACTIVE") return [];
|
|
18662
18662
|
if (e.kind === "CTA" && e.cta.attention === "NUDGE_ONCE")
|
|
18663
18663
|
return [e.key];
|
|
18664
18664
|
if (e.kind !== "CHOICE") return [];
|
|
18665
|
-
const
|
|
18666
|
-
({ id:
|
|
18665
|
+
const x = e.choice.options.find(
|
|
18666
|
+
({ id: D, presentation: P, attention: V }) => D === y && P === "PRIMARY" && V === "NUDGE_ONCE"
|
|
18667
18667
|
);
|
|
18668
|
-
return
|
|
18669
|
-
}, [e, n, y]),
|
|
18670
|
-
for (const
|
|
18668
|
+
return x ? [`${e.key}:${x.id}`] : [];
|
|
18669
|
+
}, [e, n, y]), S = le(() => {
|
|
18670
|
+
for (const x of I) b(x);
|
|
18671
18671
|
}, [I, b]);
|
|
18672
18672
|
if (n === "IDLE" || n === "GAP") return null;
|
|
18673
|
-
const C = { ...NC, ...p },
|
|
18673
|
+
const C = { ...NC, ...p }, E = o || a || n === "ENTERING" || n === "EXITING", k = al(e), z = {
|
|
18674
18674
|
"--compact-preview-actions-delay": `${h.actionsDelayMs}ms`
|
|
18675
18675
|
};
|
|
18676
18676
|
return /* @__PURE__ */ lt(
|
|
@@ -18684,9 +18684,9 @@ const al = (t) => t.kind !== "INFO", FC = (t) => {
|
|
|
18684
18684
|
"data-kind": e.kind,
|
|
18685
18685
|
"data-phase": n,
|
|
18686
18686
|
"data-phrase-count": h.phraseCount,
|
|
18687
|
-
style:
|
|
18688
|
-
onKeyDown: (
|
|
18689
|
-
|
|
18687
|
+
style: z,
|
|
18688
|
+
onKeyDown: (x) => {
|
|
18689
|
+
x.key !== "Escape" || x.defaultPrevented || (x.preventDefault(), x.stopPropagation(), r());
|
|
18690
18690
|
},
|
|
18691
18691
|
children: [
|
|
18692
18692
|
/* @__PURE__ */ H(
|
|
@@ -18704,7 +18704,7 @@ const al = (t) => t.kind !== "INFO", FC = (t) => {
|
|
|
18704
18704
|
className: "compact-scenario-preview__dismiss",
|
|
18705
18705
|
type: "button",
|
|
18706
18706
|
"aria-label": C.dismiss,
|
|
18707
|
-
disabled:
|
|
18707
|
+
disabled: E,
|
|
18708
18708
|
onClick: r,
|
|
18709
18709
|
children: /* @__PURE__ */ H("span", { "aria-hidden": "true", children: "×" })
|
|
18710
18710
|
}
|
|
@@ -18715,24 +18715,24 @@ const al = (t) => t.kind !== "INFO", FC = (t) => {
|
|
|
18715
18715
|
className: "compact-scenario-preview__choice-group",
|
|
18716
18716
|
role: "group",
|
|
18717
18717
|
"aria-label": C.choices,
|
|
18718
|
-
children: e.choice.options.map((
|
|
18719
|
-
const
|
|
18718
|
+
children: e.choice.options.map((x) => {
|
|
18719
|
+
const D = l === x.id, P = x.presentation === "PRIMARY" && x.id === y ? "PRIMARY" : "TERTIARY", V = `${e.key}:${x.id}`, B = P === "PRIMARY" && x.attention === "NUDGE_ONCE" && n === "INTERACTIVE" && !m.has(V) ? "NUDGE_ONCE" : "NONE";
|
|
18720
18720
|
return /* @__PURE__ */ H(
|
|
18721
18721
|
"button",
|
|
18722
18722
|
{
|
|
18723
18723
|
className: "compact-scenario-preview__action",
|
|
18724
18724
|
type: "button",
|
|
18725
|
-
"data-option-id":
|
|
18725
|
+
"data-option-id": x.id,
|
|
18726
18726
|
"data-presentation": P,
|
|
18727
|
-
"data-attention":
|
|
18728
|
-
"aria-pressed":
|
|
18729
|
-
disabled:
|
|
18727
|
+
"data-attention": B,
|
|
18728
|
+
"aria-pressed": D || void 0,
|
|
18729
|
+
disabled: E || !!(l && !D),
|
|
18730
18730
|
onClick: () => {
|
|
18731
|
-
|
|
18731
|
+
S(), s(x.id);
|
|
18732
18732
|
},
|
|
18733
|
-
children:
|
|
18733
|
+
children: x.label
|
|
18734
18734
|
},
|
|
18735
|
-
`${e.key}:${
|
|
18735
|
+
`${e.key}:${x.id}`
|
|
18736
18736
|
);
|
|
18737
18737
|
})
|
|
18738
18738
|
}
|
|
@@ -18745,9 +18745,9 @@ const al = (t) => t.kind !== "INFO", FC = (t) => {
|
|
|
18745
18745
|
"data-presentation": "PRIMARY",
|
|
18746
18746
|
"data-attention": n !== "INTERACTIVE" || m.has(e.key) ? "NONE" : e.cta.attention,
|
|
18747
18747
|
"aria-busy": a || void 0,
|
|
18748
|
-
disabled:
|
|
18748
|
+
disabled: E,
|
|
18749
18749
|
onClick: () => {
|
|
18750
|
-
|
|
18750
|
+
S(), i();
|
|
18751
18751
|
},
|
|
18752
18752
|
children: u ?? e.cta.label
|
|
18753
18753
|
},
|
|
@@ -18772,29 +18772,29 @@ function OC({
|
|
|
18772
18772
|
inputRequestId: b?.kind === "CHOICE" ? b.choice.inputRequestId : `none:${b?.key ?? "idle"}`
|
|
18773
18773
|
}),
|
|
18774
18774
|
[b, e.principalSessionId]
|
|
18775
|
-
),
|
|
18776
|
-
(
|
|
18775
|
+
), S = le(
|
|
18776
|
+
(B) => c.subscribe(I, B),
|
|
18777
18777
|
[I, c]
|
|
18778
18778
|
), C = le(
|
|
18779
18779
|
() => c.getSnapshot(I),
|
|
18780
18780
|
[I, c]
|
|
18781
|
-
),
|
|
18782
|
-
|
|
18781
|
+
), E = eu(
|
|
18782
|
+
S,
|
|
18783
18783
|
C,
|
|
18784
18784
|
C
|
|
18785
18785
|
), k = le(() => {
|
|
18786
|
-
const
|
|
18787
|
-
f.current !== null && (window.clearTimeout(f.current), f.current = null),
|
|
18786
|
+
const B = h.current;
|
|
18787
|
+
f.current !== null && (window.clearTimeout(f.current), f.current = null), B.startedAtMs !== null && (B.remainingMs = Math.max(
|
|
18788
18788
|
0,
|
|
18789
|
-
|
|
18790
|
-
),
|
|
18791
|
-
}, []),
|
|
18792
|
-
const
|
|
18793
|
-
if (
|
|
18789
|
+
B.remainingMs - (Date.now() - B.startedAtMs)
|
|
18790
|
+
), B.startedAtMs = null);
|
|
18791
|
+
}, []), z = le(() => {
|
|
18792
|
+
const B = t.getSnapshot(), W = B.active, X = h.current;
|
|
18793
|
+
if (B.phase !== "ENTERING" || !W) {
|
|
18794
18794
|
k(), X.candidateKey = null, X.remainingMs = 0;
|
|
18795
18795
|
return;
|
|
18796
18796
|
}
|
|
18797
|
-
if (X.candidateKey !== W.key && (k(), X.candidateKey = W.key, X.remainingMs = FC(W)), !(
|
|
18797
|
+
if (X.candidateKey !== W.key && (k(), X.candidateKey = W.key, X.remainingMs = FC(W)), !(B.dragSuspended || f.current !== null)) {
|
|
18798
18798
|
if (r || X.remainingMs <= 0) {
|
|
18799
18799
|
X.remainingMs = 0, t.markInteractive();
|
|
18800
18800
|
return;
|
|
@@ -18805,27 +18805,27 @@ function OC({
|
|
|
18805
18805
|
}
|
|
18806
18806
|
}, [t, k, r]);
|
|
18807
18807
|
Y(() => {
|
|
18808
|
-
const
|
|
18809
|
-
if (!
|
|
18810
|
-
const W = () => s(
|
|
18811
|
-
return W(),
|
|
18808
|
+
const B = window.matchMedia?.("(prefers-reduced-motion: reduce)");
|
|
18809
|
+
if (!B) return;
|
|
18810
|
+
const W = () => s(B.matches);
|
|
18811
|
+
return W(), B.addEventListener?.("change", W), () => B.removeEventListener?.("change", W);
|
|
18812
18812
|
}, []), Y(() => {
|
|
18813
|
-
const
|
|
18814
|
-
if (!(!
|
|
18815
|
-
return i.scenarioInteractionRuntime.openCompactSurfaceEpisode(
|
|
18816
|
-
i.scenarioInteractionRuntime.closeCompactSurfaceEpisode(
|
|
18813
|
+
const B = e.surfaceEpisodeId;
|
|
18814
|
+
if (!(!B || !b))
|
|
18815
|
+
return i.scenarioInteractionRuntime.openCompactSurfaceEpisode(B), () => {
|
|
18816
|
+
i.scenarioInteractionRuntime.closeCompactSurfaceEpisode(B);
|
|
18817
18817
|
};
|
|
18818
|
-
}, [b, i.scenarioInteractionRuntime, e.surfaceEpisodeId]), Y(() => (k(),
|
|
18818
|
+
}, [b, i.scenarioInteractionRuntime, e.surfaceEpisodeId]), Y(() => (k(), z(), k), [
|
|
18819
18819
|
b?.key,
|
|
18820
18820
|
k,
|
|
18821
18821
|
r,
|
|
18822
|
-
|
|
18822
|
+
z,
|
|
18823
18823
|
e.phase
|
|
18824
18824
|
]), Y(
|
|
18825
|
-
() => t.subscribeDragSuspension((
|
|
18826
|
-
|
|
18825
|
+
() => t.subscribeDragSuspension((B) => {
|
|
18826
|
+
B ? (k(), d.current?.pause()) : (z(), d.current?.resume());
|
|
18827
18827
|
}),
|
|
18828
|
-
[t, k,
|
|
18828
|
+
[t, k, z]
|
|
18829
18829
|
), Y(() => {
|
|
18830
18830
|
m.current = null, g.current !== null && (window.clearTimeout(g.current), g.current = null);
|
|
18831
18831
|
}, [b?.key]), Y(
|
|
@@ -18836,32 +18836,17 @@ function OC({
|
|
|
18836
18836
|
), Y(() => {
|
|
18837
18837
|
if (e.phase !== "EXITING" || !b || e.exitReason === "ACTIVATED" || e.exitReason === "OPENED_CHAT")
|
|
18838
18838
|
return;
|
|
18839
|
-
|
|
18840
|
-
if (S.status === "error") {
|
|
18841
|
-
t.restoreAfterError(n("compact.answerFailed"));
|
|
18842
|
-
return;
|
|
18843
|
-
}
|
|
18844
|
-
if (S.status !== "terminal") return;
|
|
18845
|
-
}
|
|
18846
|
-
const z = window.setTimeout(
|
|
18839
|
+
const B = window.setTimeout(
|
|
18847
18840
|
() => t.completeExit(),
|
|
18848
18841
|
r ? 0 : Qa
|
|
18849
18842
|
);
|
|
18850
|
-
return () => window.clearTimeout(
|
|
18851
|
-
}, [
|
|
18852
|
-
b,
|
|
18853
|
-
|
|
18854
|
-
t,
|
|
18855
|
-
r,
|
|
18856
|
-
e.exitReason,
|
|
18857
|
-
e.phase,
|
|
18858
|
-
n
|
|
18859
|
-
]), Y(() => {
|
|
18860
|
-
const z = [b, ...e.queue].flatMap((N) => N?.deadlineAtMs === null || !N ? [] : [N.deadlineAtMs]).sort((N, _) => N - _)[0];
|
|
18861
|
-
if (z === void 0) return;
|
|
18843
|
+
return () => window.clearTimeout(B);
|
|
18844
|
+
}, [b, t, r, e.exitReason, e.phase]), Y(() => {
|
|
18845
|
+
const B = [b, ...e.queue].flatMap((N) => N?.deadlineAtMs === null || !N ? [] : [N.deadlineAtMs]).sort((N, _) => N - _)[0];
|
|
18846
|
+
if (B === void 0) return;
|
|
18862
18847
|
let W = null;
|
|
18863
18848
|
const X = () => {
|
|
18864
|
-
const N =
|
|
18849
|
+
const N = B - Date.now();
|
|
18865
18850
|
if (N <= 0) {
|
|
18866
18851
|
t.expireDue();
|
|
18867
18852
|
return;
|
|
@@ -18875,31 +18860,31 @@ function OC({
|
|
|
18875
18860
|
W !== null && window.clearTimeout(W);
|
|
18876
18861
|
};
|
|
18877
18862
|
}, [b, t, e.queue]), Y(() => {
|
|
18878
|
-
const
|
|
18879
|
-
if (!
|
|
18863
|
+
const B = l.current, W = e.surfaceEpisodeId;
|
|
18864
|
+
if (!B || !b || !W || e.dragSuspended || e.phase === "EXITING")
|
|
18880
18865
|
return;
|
|
18881
18866
|
const X = BC(b), N = `${W}:${X.subjectKind}:${X.subjectId}`;
|
|
18882
18867
|
if (p.current.has(N)) return;
|
|
18883
18868
|
let _ = null, A, v = !1;
|
|
18884
|
-
const
|
|
18869
|
+
const T = () => {
|
|
18885
18870
|
v || (_ = wl({
|
|
18886
|
-
element:
|
|
18871
|
+
element: B,
|
|
18887
18872
|
isActive: () => {
|
|
18888
|
-
const
|
|
18889
|
-
return
|
|
18873
|
+
const O = t.getSnapshot();
|
|
18874
|
+
return O.active?.key === b.key && O.surfaceEpisodeId === W && !O.dragSuspended && O.phase !== "EXITING";
|
|
18890
18875
|
},
|
|
18891
18876
|
onPresented: () => {
|
|
18892
18877
|
i.scenarioInteractionRuntime.recordCompactPresented(
|
|
18893
18878
|
X,
|
|
18894
18879
|
W
|
|
18895
18880
|
) ? (p.current.add(N), p.current.size > 64 && (p.current = /* @__PURE__ */ new Set([N]))) : A = window.setTimeout(
|
|
18896
|
-
|
|
18881
|
+
T,
|
|
18897
18882
|
PC
|
|
18898
18883
|
);
|
|
18899
18884
|
}
|
|
18900
18885
|
}), d.current = _);
|
|
18901
18886
|
};
|
|
18902
|
-
return
|
|
18887
|
+
return T(), () => {
|
|
18903
18888
|
v = !0, _?.(), d.current === _ && (d.current = null), A !== void 0 && window.clearTimeout(A);
|
|
18904
18889
|
};
|
|
18905
18890
|
}, [
|
|
@@ -18910,30 +18895,30 @@ function OC({
|
|
|
18910
18895
|
e.phase,
|
|
18911
18896
|
e.surfaceEpisodeId
|
|
18912
18897
|
]);
|
|
18913
|
-
const
|
|
18914
|
-
const
|
|
18915
|
-
if (!(!W ||
|
|
18898
|
+
const x = le(() => {
|
|
18899
|
+
const B = t.getSnapshot(), W = B.active;
|
|
18900
|
+
if (!(!W || B.phase !== "ENTERING" && B.phase !== "INTERACTIVE") && (t.beginExit(
|
|
18916
18901
|
W.kind === "CHOICE" ? "COLLAPSED" : "DISMISSED"
|
|
18917
18902
|
), W.kind === "CTA" && !o(
|
|
18918
18903
|
W.cta.commandId,
|
|
18919
|
-
|
|
18904
|
+
B.surfaceEpisodeId ?? void 0
|
|
18920
18905
|
))) {
|
|
18921
18906
|
t.restoreAfterError(n("compact.actionFailed"));
|
|
18922
18907
|
return;
|
|
18923
18908
|
}
|
|
18924
18909
|
}, [t, o, n]);
|
|
18925
18910
|
if (Y(() => {
|
|
18926
|
-
const
|
|
18927
|
-
W.key !== "Escape" || W.defaultPrevented ||
|
|
18911
|
+
const B = (W) => {
|
|
18912
|
+
W.key !== "Escape" || W.defaultPrevented || x();
|
|
18928
18913
|
};
|
|
18929
|
-
return window.addEventListener("keydown",
|
|
18930
|
-
}, [
|
|
18914
|
+
return window.addEventListener("keydown", B), () => window.removeEventListener("keydown", B);
|
|
18915
|
+
}, [x]), !b || e.phase === "IDLE" || e.phase === "GAP")
|
|
18931
18916
|
return null;
|
|
18932
|
-
const
|
|
18917
|
+
const D = (B) => {
|
|
18933
18918
|
b.kind !== "CHOICE" || e.phase !== "INTERACTIVE" || (c.submit({
|
|
18934
18919
|
principalId: e.principalSessionId,
|
|
18935
18920
|
inputRequestId: b.choice.inputRequestId,
|
|
18936
|
-
optionId:
|
|
18921
|
+
optionId: B,
|
|
18937
18922
|
...e.surfaceEpisodeId ? {
|
|
18938
18923
|
presentationContext: {
|
|
18939
18924
|
surface: "COMPACT_PREVIEW",
|
|
@@ -18945,7 +18930,7 @@ function OC({
|
|
|
18945
18930
|
if (b.kind !== "CTA" || e.phase !== "INTERACTIVE" || y.busy || m.current === b.key)
|
|
18946
18931
|
return;
|
|
18947
18932
|
m.current = b.key;
|
|
18948
|
-
const
|
|
18933
|
+
const B = b.key, W = Date.now(), X = a(
|
|
18949
18934
|
b.cta.commandId,
|
|
18950
18935
|
e.surfaceEpisodeId ?? void 0
|
|
18951
18936
|
);
|
|
@@ -18955,12 +18940,12 @@ function OC({
|
|
|
18955
18940
|
() => {
|
|
18956
18941
|
g.current = null;
|
|
18957
18942
|
const _ = t.getSnapshot();
|
|
18958
|
-
_.active?.key ===
|
|
18943
|
+
_.active?.key === B && _.exitReason === "ACTIVATED" && (m.current = null, t.completeExit());
|
|
18959
18944
|
},
|
|
18960
18945
|
Math.min($a, N)
|
|
18961
18946
|
), X.catch(() => "TERMINAL_FAILURE").then((_) => {
|
|
18962
18947
|
const A = t.getSnapshot();
|
|
18963
|
-
if (!(A.active?.key !==
|
|
18948
|
+
if (!(A.active?.key !== B || A.exitReason !== "ACTIVATED"))
|
|
18964
18949
|
if (_ === "RETRYABLE_FAILURE")
|
|
18965
18950
|
g.current !== null && (window.clearTimeout(g.current), g.current = null), m.current = null, t.restoreAfterError(n("compact.actionFailed"));
|
|
18966
18951
|
else if (_ === "AWAITING_CONFIRMATION")
|
|
@@ -18972,12 +18957,12 @@ function OC({
|
|
|
18972
18957
|
);
|
|
18973
18958
|
g.current !== null && window.clearTimeout(g.current), g.current = window.setTimeout(() => {
|
|
18974
18959
|
g.current = null;
|
|
18975
|
-
const
|
|
18976
|
-
|
|
18960
|
+
const T = t.getSnapshot();
|
|
18961
|
+
T.active?.key === B && T.exitReason === "ACTIVATED" && t.completeExit();
|
|
18977
18962
|
}, v);
|
|
18978
18963
|
}
|
|
18979
18964
|
});
|
|
18980
|
-
},
|
|
18965
|
+
}, V = e.error || (b.kind === "CTA" ? y.feedback : null) || (b.kind === "CHOICE" && E.status === "error" ? n("compact.answerFailed") : null);
|
|
18981
18966
|
return /* @__PURE__ */ H("div", { ref: l, "data-lola-compact-preview-observation": !0, children: /* @__PURE__ */ H(
|
|
18982
18967
|
LC,
|
|
18983
18968
|
{
|
|
@@ -18989,15 +18974,15 @@ function OC({
|
|
|
18989
18974
|
coalescedLabel: b.coalescedCount > 0 ? n("compact.moreMessages", {
|
|
18990
18975
|
count: b.coalescedCount
|
|
18991
18976
|
}) : null,
|
|
18992
|
-
selectedChoiceOptionId: b.kind === "CHOICE" ?
|
|
18993
|
-
feedback:
|
|
18977
|
+
selectedChoiceOptionId: b.kind === "CHOICE" ? E.selectedOptionId : null,
|
|
18978
|
+
feedback: V,
|
|
18994
18979
|
labels: {
|
|
18995
18980
|
region: n("compact.region"),
|
|
18996
18981
|
dismiss: n("compact.dismiss"),
|
|
18997
18982
|
choices: n("compact.choices")
|
|
18998
18983
|
},
|
|
18999
|
-
onDismiss:
|
|
19000
|
-
onChoice:
|
|
18984
|
+
onDismiss: x,
|
|
18985
|
+
onChoice: D,
|
|
19001
18986
|
onCta: P
|
|
19002
18987
|
},
|
|
19003
18988
|
b.key
|
|
@@ -19011,7 +18996,7 @@ function BC(t) {
|
|
|
19011
18996
|
...t.kind === "INFO" && t.message.ordinal !== void 0 ? { presentationOrdinal: t.message.ordinal } : {}
|
|
19012
18997
|
};
|
|
19013
18998
|
}
|
|
19014
|
-
const VC = 250, zC = fl(() => import("./ChatWidgetContent-
|
|
18999
|
+
const VC = 250, zC = fl(() => import("./ChatWidgetContent-Dt6meIg2.js")), GC = (t) => {
|
|
19015
19000
|
const e = /* @__PURE__ */ new Set(), n = t.getSnapshot(), r = new Set(
|
|
19016
19001
|
[n.active, ...n.queue].flatMap(
|
|
19017
19002
|
(s) => s?.messageId ? [s.messageId] : []
|
|
@@ -19039,12 +19024,12 @@ function qC() {
|
|
|
19039
19024
|
compactPreviewController: l
|
|
19040
19025
|
} = Wr(), { anycableService: d } = Uc(), { t: p } = xn(), h = Zi(), f = Vs(), m = wt(), g = Sm(), b = K((A) => A.threadIds), y = Tm(), I = c0(
|
|
19041
19026
|
g
|
|
19042
|
-
)?.inputRequestId,
|
|
19043
|
-
clearTransientRealtimeState:
|
|
19027
|
+
)?.inputRequestId, S = q(void 0), C = q(null), {
|
|
19028
|
+
clearTransientRealtimeState: E,
|
|
19044
19029
|
disposeMessageStore: k,
|
|
19045
|
-
initMessageStore:
|
|
19046
|
-
recoverMessages:
|
|
19047
|
-
updateConfig:
|
|
19030
|
+
initMessageStore: z,
|
|
19031
|
+
recoverMessages: x,
|
|
19032
|
+
updateConfig: D
|
|
19048
19033
|
} = Nm(), P = eu(
|
|
19049
19034
|
l.subscribe,
|
|
19050
19035
|
l.getSnapshot,
|
|
@@ -19058,18 +19043,18 @@ function qC() {
|
|
|
19058
19043
|
);
|
|
19059
19044
|
return () => window.clearTimeout(A);
|
|
19060
19045
|
}, [l, P.phase]);
|
|
19061
|
-
const
|
|
19046
|
+
const V = q({
|
|
19062
19047
|
api: a,
|
|
19063
19048
|
compactPreviewController: l,
|
|
19064
19049
|
config: o,
|
|
19065
19050
|
disposeMessageStore: k,
|
|
19066
|
-
initMessageStore:
|
|
19067
|
-
}),
|
|
19051
|
+
initMessageStore: z
|
|
19052
|
+
}), B = q({
|
|
19068
19053
|
accessToken: o.customerInteractionSession.accessToken,
|
|
19069
19054
|
interactionSessionId: o.customerInteractionSession.interactionSessionId
|
|
19070
19055
|
});
|
|
19071
19056
|
Y(() => {
|
|
19072
|
-
const A =
|
|
19057
|
+
const A = V.current;
|
|
19073
19058
|
return br(
|
|
19074
19059
|
A.initMessageStore(
|
|
19075
19060
|
A.config,
|
|
@@ -19078,37 +19063,37 @@ function qC() {
|
|
|
19078
19063
|
A.compactPreviewController
|
|
19079
19064
|
), () => A.disposeMessageStore();
|
|
19080
19065
|
}, []), Y(() => {
|
|
19081
|
-
const A =
|
|
19082
|
-
if (
|
|
19066
|
+
const A = B.current, v = o.customerInteractionSession;
|
|
19067
|
+
if (B.current = {
|
|
19083
19068
|
accessToken: v.accessToken,
|
|
19084
19069
|
interactionSessionId: v.interactionSessionId
|
|
19085
19070
|
}, A.interactionSessionId !== v.interactionSessionId) {
|
|
19086
|
-
br(
|
|
19071
|
+
br(z(o, a), l);
|
|
19087
19072
|
return;
|
|
19088
19073
|
}
|
|
19089
|
-
|
|
19074
|
+
D(o, a), A.accessToken !== v.accessToken && br(x(), l);
|
|
19090
19075
|
}, [
|
|
19091
19076
|
a,
|
|
19092
19077
|
l,
|
|
19093
19078
|
o,
|
|
19094
|
-
|
|
19095
|
-
|
|
19096
|
-
|
|
19079
|
+
z,
|
|
19080
|
+
x,
|
|
19081
|
+
D
|
|
19097
19082
|
]), Y(() => {
|
|
19098
|
-
!I ||
|
|
19083
|
+
!I || S.current === I || (S.current = I, f(st.text));
|
|
19099
19084
|
}, [f, I]), Y(() => {
|
|
19100
19085
|
!y || C.current === y.sequence || (C.current = y.sequence, lb(m.pathname) && f(st.text));
|
|
19101
19086
|
}, [y, m.pathname, f]), Y(() => {
|
|
19102
19087
|
if (!d?.channels.chat) return;
|
|
19103
19088
|
const A = d.channels.chat.on(
|
|
19104
19089
|
"connect",
|
|
19105
|
-
(
|
|
19106
|
-
(
|
|
19090
|
+
(T) => {
|
|
19091
|
+
(T.reconnect || T.restored) && (E(), br(x(), l));
|
|
19107
19092
|
}
|
|
19108
19093
|
), v = d.channels.chat.on(
|
|
19109
19094
|
"info",
|
|
19110
|
-
(
|
|
19111
|
-
(
|
|
19095
|
+
(T) => {
|
|
19096
|
+
(T.type === "history_not_found" || T.type === "reject_history") && (E(), br(x(), l));
|
|
19112
19097
|
}
|
|
19113
19098
|
);
|
|
19114
19099
|
return () => {
|
|
@@ -19116,9 +19101,9 @@ function qC() {
|
|
|
19116
19101
|
};
|
|
19117
19102
|
}, [
|
|
19118
19103
|
d?.channels.chat,
|
|
19119
|
-
|
|
19104
|
+
E,
|
|
19120
19105
|
l,
|
|
19121
|
-
|
|
19106
|
+
x
|
|
19122
19107
|
]);
|
|
19123
19108
|
const W = le(() => {
|
|
19124
19109
|
const A = {
|