@pluno/product-agent-web 0.1.181 → 0.1.182
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/product-agent-widget.js +351 -350
- package/package.json +1 -1
|
@@ -648,7 +648,7 @@ class Qs {
|
|
|
648
648
|
}, i);
|
|
649
649
|
try {
|
|
650
650
|
Nl().catch((o) => {
|
|
651
|
-
|
|
651
|
+
J("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
652
652
|
message: o instanceof Error ? o.message : String(o)
|
|
653
653
|
});
|
|
654
654
|
}), n.disableNetworkCapture || s.enableNetworkCapture(), s.startPageLifecycleRecovery(), s.startStarterPromptUrlWatcher(), e.autoConnect !== !1 && await s.connect();
|
|
@@ -684,9 +684,9 @@ class Qs {
|
|
|
684
684
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
685
685
|
const n = ip(this.options.backendUrl), i = this.options.webSocketFactory?.(n) ?? new WebSocket(n);
|
|
686
686
|
this.socket = i, this.socketConnectTimer = window.setTimeout(() => {
|
|
687
|
-
this.socket === i && i.readyState === WebSocket.CONNECTING && (
|
|
687
|
+
this.socket === i && i.readyState === WebSocket.CONNECTING && (J("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(i));
|
|
688
688
|
}, _d), i.addEventListener("open", () => {
|
|
689
|
-
this.socket !== i || (this.clearSocketConnectTimer(),
|
|
689
|
+
this.socket !== i || (this.clearSocketConnectTimer(), J("web-sdk.agent", "Pluno socket opened", {
|
|
690
690
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
691
691
|
isThinking: this.state.isThinking
|
|
692
692
|
}), !(this.token ? this.sendNow({
|
|
@@ -696,7 +696,7 @@ class Qs {
|
|
|
696
696
|
transportId: this.transportIdentity.transportId,
|
|
697
697
|
pageUrl: location.href
|
|
698
698
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
699
|
-
this.socket === i && (
|
|
699
|
+
this.socket === i && (J("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(i));
|
|
700
700
|
}, Sd));
|
|
701
701
|
}), i.addEventListener("message", (s) => {
|
|
702
702
|
this.socket === i && this.handleServerEvent(up(s.data));
|
|
@@ -708,7 +708,7 @@ class Qs {
|
|
|
708
708
|
(r) => r.type === "chat.user_message" && r.clientMessageId === o.clientMessageId
|
|
709
709
|
) && (this.queuedClientEvents.push(o), Pt(this.options.clientId, this.queuedClientEvents), this.setState({ pendingMessageStatus: "reconnecting" })), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), i.readyState !== WebSocket.CLOSED && i.readyState !== WebSocket.CLOSING && i.close();
|
|
710
710
|
}), i.addEventListener("close", (s) => {
|
|
711
|
-
this.socket === i && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (
|
|
711
|
+
this.socket === i && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (J("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
712
712
|
code: typeof s?.code == "number" ? s.code : null,
|
|
713
713
|
reason: typeof s?.reason == "string" ? s.reason : "",
|
|
714
714
|
wasClean: typeof s?.wasClean == "boolean" ? s.wasClean : null,
|
|
@@ -716,7 +716,7 @@ class Qs {
|
|
|
716
716
|
isThinking: this.state.isThinking
|
|
717
717
|
}), this.setReconnectingState(), this.scheduleReconnect()));
|
|
718
718
|
}), i.addEventListener("error", () => {
|
|
719
|
-
this.socket !== i || this.state.status === "closed" || (
|
|
719
|
+
this.socket !== i || this.state.status === "closed" || (J("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
|
|
720
720
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
721
721
|
isThinking: this.state.isThinking
|
|
722
722
|
}), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), i.readyState !== WebSocket.CLOSED && i.readyState !== WebSocket.CLOSING && i.close());
|
|
@@ -779,7 +779,7 @@ class Qs {
|
|
|
779
779
|
async sendMessage(e, n = {}) {
|
|
780
780
|
const i = e.trim(), s = n.attachments ?? [];
|
|
781
781
|
if (this.options.productVariant === "customer_embedded" && (s.forEach(Ca), s.reduce(
|
|
782
|
-
(
|
|
782
|
+
(R, L) => R + L.sizeBytes,
|
|
783
783
|
0
|
|
784
784
|
) > oa))
|
|
785
785
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
@@ -820,15 +820,15 @@ class Qs {
|
|
|
820
820
|
}), c || this.emit("message", d);
|
|
821
821
|
try {
|
|
822
822
|
const T = [];
|
|
823
|
-
for (const
|
|
824
|
-
const
|
|
825
|
-
if (
|
|
826
|
-
T.push(
|
|
823
|
+
for (const R of o) {
|
|
824
|
+
const L = R.id ? this.attachmentFiles.get(R.id) : void 0;
|
|
825
|
+
if (R.sandboxPath || R.storageKey) {
|
|
826
|
+
T.push(R);
|
|
827
827
|
continue;
|
|
828
828
|
}
|
|
829
|
-
if (!
|
|
830
|
-
throw new Error(`Attachment bytes are unavailable for ${
|
|
831
|
-
T.push(await this.uploadAttachmentForMessage({ file:
|
|
829
|
+
if (!L)
|
|
830
|
+
throw new Error(`Attachment bytes are unavailable for ${R.name}`);
|
|
831
|
+
T.push(await this.uploadAttachmentForMessage({ file: L, attachment: R }));
|
|
832
832
|
}
|
|
833
833
|
o = T;
|
|
834
834
|
} catch (T) {
|
|
@@ -899,7 +899,7 @@ class Qs {
|
|
|
899
899
|
createdAt: s,
|
|
900
900
|
lastUsedAt: s
|
|
901
901
|
}).catch((o) => {
|
|
902
|
-
|
|
902
|
+
J("web-sdk.attachments", "Failed to store Product Agent attachment", {
|
|
903
903
|
attachmentId: n,
|
|
904
904
|
name: i.name,
|
|
905
905
|
message: o instanceof Error ? o.message : String(o)
|
|
@@ -961,7 +961,7 @@ class Qs {
|
|
|
961
961
|
storageKey: l.storageKey,
|
|
962
962
|
lastUsedAt: Date.now()
|
|
963
963
|
}).catch((d) => {
|
|
964
|
-
|
|
964
|
+
J("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
|
|
965
965
|
attachmentId: n.id,
|
|
966
966
|
name: l.name,
|
|
967
967
|
message: d instanceof Error ? d.message : String(d)
|
|
@@ -1231,7 +1231,7 @@ class Qs {
|
|
|
1231
1231
|
} catch (r) {
|
|
1232
1232
|
if (r instanceof ni)
|
|
1233
1233
|
throw r;
|
|
1234
|
-
|
|
1234
|
+
J("web-sdk.history", "HTTP session history page failed; retrying", {
|
|
1235
1235
|
sessionId: e,
|
|
1236
1236
|
hasCursor: !!i,
|
|
1237
1237
|
retryDelayMs: o,
|
|
@@ -1245,7 +1245,7 @@ class Qs {
|
|
|
1245
1245
|
return;
|
|
1246
1246
|
const o = i instanceof Error ? i.message : String(i);
|
|
1247
1247
|
if (s) {
|
|
1248
|
-
this.sessionActivityRequestId = null,
|
|
1248
|
+
this.sessionActivityRequestId = null, J("web-sdk.history", "Background session activity hydration stopped", {
|
|
1249
1249
|
sessionId: n,
|
|
1250
1250
|
message: o
|
|
1251
1251
|
});
|
|
@@ -1257,7 +1257,7 @@ class Qs {
|
|
|
1257
1257
|
message: o,
|
|
1258
1258
|
requestId: e,
|
|
1259
1259
|
sessionId: n
|
|
1260
|
-
}),
|
|
1260
|
+
}), J("web-sdk.history", "HTTP session history page failed permanently", {
|
|
1261
1261
|
sessionId: n,
|
|
1262
1262
|
message: o
|
|
1263
1263
|
});
|
|
@@ -1283,7 +1283,7 @@ class Qs {
|
|
|
1283
1283
|
try {
|
|
1284
1284
|
return n.send(JSON.stringify(e)), cs("client_event", e.type, Ko(e)), !0;
|
|
1285
1285
|
} catch (i) {
|
|
1286
|
-
return
|
|
1286
|
+
return J("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
1287
1287
|
message: i instanceof Error ? i.message : String(i),
|
|
1288
1288
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
1289
1289
|
isThinking: this.state.isThinking
|
|
@@ -1315,7 +1315,7 @@ class Qs {
|
|
|
1315
1315
|
}
|
|
1316
1316
|
}));
|
|
1317
1317
|
} catch (s) {
|
|
1318
|
-
|
|
1318
|
+
J("web-sdk.agent", "Pluno health signal send failed", {
|
|
1319
1319
|
name: e,
|
|
1320
1320
|
message: s instanceof Error ? s.message : String(s)
|
|
1321
1321
|
});
|
|
@@ -1444,7 +1444,7 @@ class Qs {
|
|
|
1444
1444
|
return r === null || r <= o.stoppedCausalSequence;
|
|
1445
1445
|
}
|
|
1446
1446
|
if (o.stoppedAt) {
|
|
1447
|
-
const r =
|
|
1447
|
+
const r = Z(i, "createdAt");
|
|
1448
1448
|
return !!(r && Date.parse(r) <= Date.parse(o.stoppedAt));
|
|
1449
1449
|
}
|
|
1450
1450
|
return !1;
|
|
@@ -1469,9 +1469,9 @@ class Qs {
|
|
|
1469
1469
|
return;
|
|
1470
1470
|
}
|
|
1471
1471
|
if (e.type === "session.item" && this.rememberDurablyStoppedTurn(
|
|
1472
|
-
|
|
1472
|
+
Z(e.item, "sessionId") ?? this.state.sessionId,
|
|
1473
1473
|
ve(e.item),
|
|
1474
|
-
|
|
1474
|
+
Z(e.item, "createdAt")
|
|
1475
1475
|
), !(e.type === "session.updated" && typeof e.warmupId == "string" && e.warmupId !== this.activeComposerWarmupId)) {
|
|
1476
1476
|
if (e.type === "runtime.warmup_ack" && typeof e.warmupId == "string" && e.warmupId === this.pendingComposerWarmup?.event.warmupId) {
|
|
1477
1477
|
this.clearPendingWarmupAckTimer(), this.pendingComposerWarmup.acknowledged = !0;
|
|
@@ -1512,7 +1512,7 @@ class Qs {
|
|
|
1512
1512
|
const n = _p(e.user);
|
|
1513
1513
|
this.authenticatedSocket !== this.socket && this.authenticatedUserId && n && n.id !== this.authenticatedUserId && this.resetForAuthenticationScopeChange(), this.authenticatedUserId = n?.id ?? null, this.authenticatedSocket = this.socket, this.flushPendingWidgetLifecycleEvents(), this.flushPendingComposerWarmup(), this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingPassiveWarmup(), this.startHeartbeat();
|
|
1514
1514
|
const i = mp(e), s = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
1515
|
-
|
|
1515
|
+
J("web-sdk.agent", "Received auth.ok appearance", {
|
|
1516
1516
|
hasAppearance: s,
|
|
1517
1517
|
rawAppearance: e.appearance,
|
|
1518
1518
|
normalizedAppearance: i
|
|
@@ -1538,19 +1538,19 @@ class Qs {
|
|
|
1538
1538
|
return;
|
|
1539
1539
|
}
|
|
1540
1540
|
if (e.type === "conversation.state") {
|
|
1541
|
-
const n = Array.isArray(e.items) ? e.items : [], i =
|
|
1541
|
+
const n = Array.isArray(e.items) ? e.items : [], i = Z(e.session, "id") ?? this.state.sessionId, s = typeof e.requestId == "string" ? e.requestId : null, o = this.state.isLoadingSession && this.sessionLoadRequestId === null && s === null && i === this.state.sessionId && this.canLoadSessionHistoryOverHttp();
|
|
1542
1542
|
if (s && s !== this.sessionLoadRequestId || this.state.isLoadingSession && this.sessionLoadRequestId !== null && s === null || this.state.isLoadingSession && i !== this.state.sessionId)
|
|
1543
1543
|
return;
|
|
1544
1544
|
this.updatePersonalModelFromSession(e.session), i === this.state.sessionId && this.clearSessionLoadRequest();
|
|
1545
|
-
for (const
|
|
1545
|
+
for (const X of n)
|
|
1546
1546
|
this.rememberDurablyStoppedTurn(
|
|
1547
1547
|
i,
|
|
1548
|
-
ve(
|
|
1549
|
-
|
|
1548
|
+
ve(X),
|
|
1549
|
+
Z(X, "createdAt")
|
|
1550
1550
|
);
|
|
1551
1551
|
const r = Xt(n), l = r === null ? null : n[r], d = ve(l), c = this.findStoppedTurn(i, {
|
|
1552
1552
|
clientMessageId: d?.clientMessageId,
|
|
1553
|
-
respondsToUserMessageId:
|
|
1553
|
+
respondsToUserMessageId: Z(l, "id"),
|
|
1554
1554
|
runId: d?.runId
|
|
1555
1555
|
}), u = this.filterStoppedSnapshotItems(n, i), p = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, h = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, y = e.isRetrying === !0, b = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
|
|
1556
1556
|
p && h && (this.pendingClientMessageId = h);
|
|
@@ -1565,41 +1565,41 @@ class Qs {
|
|
|
1565
1565
|
this.rememberUserMessageClientMessageIds(u);
|
|
1566
1566
|
const x = jp(u);
|
|
1567
1567
|
if (x) {
|
|
1568
|
-
const
|
|
1568
|
+
const X = Gp(u, x);
|
|
1569
1569
|
this.retryAttemptsByClientMessageId[x] = Math.max(
|
|
1570
1570
|
this.retryAttemptsByClientMessageId[x] ?? 0,
|
|
1571
|
-
|
|
1571
|
+
X
|
|
1572
1572
|
);
|
|
1573
1573
|
}
|
|
1574
|
-
const _ = u.filter((
|
|
1575
|
-
const F = ve(
|
|
1574
|
+
const _ = u.filter((X) => {
|
|
1575
|
+
const F = ve(X);
|
|
1576
1576
|
return pr(F) ? !1 : !F || !x || !Si(F) ? !0 : Ls(u, F) !== x;
|
|
1577
|
-
}),
|
|
1577
|
+
}), R = ha(
|
|
1578
1578
|
this.state.messages,
|
|
1579
1579
|
lr(_, this.options.backendUrl)
|
|
1580
|
-
),
|
|
1581
|
-
(
|
|
1582
|
-
ve(
|
|
1580
|
+
), L = dr(R), B = f ? m?.content ?? "" : this.state.assistantDraft, $ = f ? m?.itemId ?? null : this.state.assistantDraftItemId, q = f ? m?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, W = f ? m?.runId ?? null : this.state.assistantDraftRunId, Q = u.some(
|
|
1581
|
+
(X, F) => cr(
|
|
1582
|
+
ve(X),
|
|
1583
1583
|
B,
|
|
1584
1584
|
$,
|
|
1585
1585
|
q,
|
|
1586
1586
|
W,
|
|
1587
1587
|
Kp(u, F)
|
|
1588
1588
|
)
|
|
1589
|
-
),
|
|
1590
|
-
if (!
|
|
1589
|
+
), ne = f ? m?.content ?? "" : this.state.assistantDraft, K = !!m?.content && !Q, de = L && (!ne || Q), ie = Fp(R), C = de && ie ? "completed" : c ? "stopped" : de ? "failed" : null;
|
|
1590
|
+
if (!L && $p(this.state.messages, u))
|
|
1591
1591
|
return;
|
|
1592
1592
|
this.lastUserMessagePageUrl = Hp(u);
|
|
1593
1593
|
const M = de || c ? null : Rs(u);
|
|
1594
1594
|
if (this.latestRecoverableClientMessageId = M, ie && this.clearRetryTimers(), this.setState({
|
|
1595
|
-
sessionId:
|
|
1596
|
-
messages:
|
|
1595
|
+
sessionId: Z(e.session, "id") ?? this.state.sessionId,
|
|
1596
|
+
messages: R,
|
|
1597
1597
|
isLoadingSession: !1,
|
|
1598
1598
|
...p ? { pendingMessageStatus: p } : {},
|
|
1599
1599
|
...b ? { turnPhase: b } : {},
|
|
1600
1600
|
isRetrying: y,
|
|
1601
1601
|
...C && this.state.taskStatus === "working" ? { taskStatus: C } : {},
|
|
1602
|
-
...
|
|
1602
|
+
...Q ? {
|
|
1603
1603
|
assistantDraft: "",
|
|
1604
1604
|
assistantDraftItemId: null,
|
|
1605
1605
|
assistantDraftPhase: null,
|
|
@@ -1632,14 +1632,14 @@ class Qs {
|
|
|
1632
1632
|
else if (!c && (K || M)) {
|
|
1633
1633
|
if (M) {
|
|
1634
1634
|
this.activeClientMessageId = M;
|
|
1635
|
-
const
|
|
1636
|
-
this.activeResponseUserMessageId =
|
|
1635
|
+
const X = Xt(u), F = X === null ? null : u[X];
|
|
1636
|
+
this.activeResponseUserMessageId = Z(F, "id");
|
|
1637
1637
|
}
|
|
1638
1638
|
this.markThinkingProgress();
|
|
1639
1639
|
}
|
|
1640
1640
|
if (x) {
|
|
1641
|
-
const
|
|
1642
|
-
|
|
1641
|
+
const X = Z(e.session, "id") ?? this.state.sessionId;
|
|
1642
|
+
X && this.retryAfterInterruptedRun(X, x);
|
|
1643
1643
|
}
|
|
1644
1644
|
o && i && window.setTimeout(() => {
|
|
1645
1645
|
this.autoLoadSessionActivity(i);
|
|
@@ -1677,7 +1677,7 @@ class Qs {
|
|
|
1677
1677
|
}
|
|
1678
1678
|
if (e.type === "session.updated") {
|
|
1679
1679
|
this.clearRunAckResyncRetryTimer();
|
|
1680
|
-
const n =
|
|
1680
|
+
const n = Z(e.session, "id");
|
|
1681
1681
|
n && typeof e.warmupId == "string" && e.warmupId === this.pendingComposerWarmup?.event.warmupId && (this.pendingComposerWarmup.event = {
|
|
1682
1682
|
...this.pendingComposerWarmup.event,
|
|
1683
1683
|
sessionId: n
|
|
@@ -1691,7 +1691,7 @@ class Qs {
|
|
|
1691
1691
|
const n = ve(e.item);
|
|
1692
1692
|
if (Si(n)) {
|
|
1693
1693
|
typeof n?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(n.runId);
|
|
1694
|
-
const s =
|
|
1694
|
+
const s = Z(e.item, "sessionId") ?? this.state.sessionId, o = n ? Ve(n) : null, r = o ? this.clientMessageIdsByUserMessageItemId.get(o) : null, l = typeof n?.clientMessageId == "string" ? n.clientMessageId : r ?? (o ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
|
|
1695
1695
|
if (s && l) {
|
|
1696
1696
|
this.retryAfterInterruptedRun(s, l);
|
|
1697
1697
|
return;
|
|
@@ -1706,7 +1706,7 @@ class Qs {
|
|
|
1706
1706
|
const i = ga(e.item, this.options.backendUrl);
|
|
1707
1707
|
if (i) {
|
|
1708
1708
|
const s = Zp(n, i), o = i.callId ? this.pendingToolLoadingByCallId.get(i.callId) : void 0;
|
|
1709
|
-
i.callId && o !== void 0 && (i.loading = o, this.pendingToolLoadingByCallId.delete(i.callId)),
|
|
1709
|
+
i.callId && o !== void 0 && (i.loading = o, this.pendingToolLoadingByCallId.delete(i.callId)), rt(i) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Yp(n) && this.clearRunAckResyncRetryTimer();
|
|
1710
1710
|
const r = Ps(this.state.messages, i), l = dr(r), d = cr(
|
|
1711
1711
|
n,
|
|
1712
1712
|
this.state.assistantDraft,
|
|
@@ -1717,7 +1717,7 @@ class Qs {
|
|
|
1717
1717
|
r,
|
|
1718
1718
|
r.findIndex((p) => p.id === i.id)
|
|
1719
1719
|
)
|
|
1720
|
-
), c = l && (!this.state.assistantDraft || d), u = _i(i) && (c ||
|
|
1720
|
+
), c = l && (!this.state.assistantDraft || d), u = _i(i) && (c || rt(i) && !this.state.isThinking && this.activeClientMessageId === null);
|
|
1721
1721
|
this.setState({
|
|
1722
1722
|
messages: r,
|
|
1723
1723
|
...d ? {
|
|
@@ -1980,10 +1980,10 @@ class Qs {
|
|
|
1980
1980
|
}
|
|
1981
1981
|
rememberUserMessageClientMessageIds(e) {
|
|
1982
1982
|
for (const n of e) {
|
|
1983
|
-
const i =
|
|
1983
|
+
const i = Z(n, "id"), s = ve(n);
|
|
1984
1984
|
i && s?.type === "message" && s.role === "user" && s.optimistic !== !0 && !i.startsWith("optimistic-user-message:") && typeof s.clientMessageId == "string" && (this.clientMessageIdsByUserMessageItemId.set(i, s.clientMessageId), s.clientMessageId === this.pendingClientMessageId && this.promotePendingDelivery(
|
|
1985
1985
|
s.clientMessageId,
|
|
1986
|
-
|
|
1986
|
+
Z(n, "sessionId") ?? this.state.sessionId,
|
|
1987
1987
|
i,
|
|
1988
1988
|
null
|
|
1989
1989
|
), s.clientMessageId === this.activeClientMessageId && (this.activeResponseUserMessageId = i));
|
|
@@ -2122,7 +2122,7 @@ class Qs {
|
|
|
2122
2122
|
}, Qo);
|
|
2123
2123
|
}
|
|
2124
2124
|
recoverMissedRunAck(e) {
|
|
2125
|
-
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (
|
|
2125
|
+
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (J("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
2126
2126
|
sessionId: this.state.sessionId,
|
|
2127
2127
|
clientMessageId: e
|
|
2128
2128
|
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleRunAckResyncRetry(e));
|
|
@@ -2135,7 +2135,7 @@ class Qs {
|
|
|
2135
2135
|
status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
|
|
2136
2136
|
isThinking: !0,
|
|
2137
2137
|
lastError: null
|
|
2138
|
-
}),
|
|
2138
|
+
}), J("web-sdk.agent", "Pluno run ack recovery retrying last user message", {
|
|
2139
2139
|
sessionId: this.state.sessionId,
|
|
2140
2140
|
clientMessageId: e
|
|
2141
2141
|
}), this.state.sessionId ? this.send({
|
|
@@ -2157,7 +2157,7 @@ class Qs {
|
|
|
2157
2157
|
return;
|
|
2158
2158
|
const e = this.activeClientMessageId;
|
|
2159
2159
|
if (!e) {
|
|
2160
|
-
|
|
2160
|
+
J("web-sdk.agent", "Pluno thinking watchdog stopped without a recoverable message id", {
|
|
2161
2161
|
sessionId: this.state.sessionId
|
|
2162
2162
|
}), this.reportHealthSignal("run_recovery_exhausted", {
|
|
2163
2163
|
reason: "missing_client_message_id"
|
|
@@ -2174,7 +2174,7 @@ class Qs {
|
|
|
2174
2174
|
}
|
|
2175
2175
|
const n = this.thinkingWatchdogResyncAttemptsByClientMessageId[e] ?? 0, i = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
2176
2176
|
if (i >= bn) {
|
|
2177
|
-
|
|
2177
|
+
J("web-sdk.agent", "Pluno run recovery retry exhausted", {
|
|
2178
2178
|
sessionId: this.state.sessionId,
|
|
2179
2179
|
clientMessageId: e
|
|
2180
2180
|
}), this.state.sessionId ? this.requestSessionRecoveryExhaustion(this.state.sessionId, e) : (this.setState({
|
|
@@ -2186,7 +2186,7 @@ class Qs {
|
|
|
2186
2186
|
return;
|
|
2187
2187
|
}
|
|
2188
2188
|
if (n < 1) {
|
|
2189
|
-
this.thinkingWatchdogResyncAttemptsByClientMessageId[e] = n + 1,
|
|
2189
|
+
this.thinkingWatchdogResyncAttemptsByClientMessageId[e] = n + 1, J("web-sdk.agent", "Pluno thinking watchdog resyncing session", {
|
|
2190
2190
|
sessionId: this.state.sessionId,
|
|
2191
2191
|
clientMessageId: e,
|
|
2192
2192
|
resyncAttempts: n + 1
|
|
@@ -2197,7 +2197,7 @@ class Qs {
|
|
|
2197
2197
|
status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
|
|
2198
2198
|
isThinking: !0,
|
|
2199
2199
|
lastError: null
|
|
2200
|
-
}),
|
|
2200
|
+
}), J("web-sdk.agent", "Pluno thinking watchdog scheduling retry for last user message", {
|
|
2201
2201
|
sessionId: this.state.sessionId,
|
|
2202
2202
|
clientMessageId: e,
|
|
2203
2203
|
retryAttempts: i + 1
|
|
@@ -2345,7 +2345,7 @@ class Qs {
|
|
|
2345
2345
|
const e = Ud(this.reconnectAttempts);
|
|
2346
2346
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
2347
2347
|
this.reconnectTimer = null, this.connect().catch((n) => {
|
|
2348
|
-
|
|
2348
|
+
J("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
2349
2349
|
message: n instanceof Error ? n.message : String(n),
|
|
2350
2350
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
2351
2351
|
isThinking: this.state.isThinking
|
|
@@ -2357,7 +2357,7 @@ class Qs {
|
|
|
2357
2357
|
this.stopHeartbeat(), this.heartbeatTimer = window.setInterval(() => {
|
|
2358
2358
|
const e = this.socket;
|
|
2359
2359
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
2360
|
-
this.socket === e && (
|
|
2360
|
+
this.socket === e && (J("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
2361
2361
|
}, bd));
|
|
2362
2362
|
}, wd);
|
|
2363
2363
|
}
|
|
@@ -2445,7 +2445,7 @@ function qd() {
|
|
|
2445
2445
|
try {
|
|
2446
2446
|
const x = y instanceof Request ? y : null, _ = _c(y, x), T = ka(b?.headers ?? x?.headers);
|
|
2447
2447
|
if (!Kt(_, T, b?.body)) {
|
|
2448
|
-
const
|
|
2448
|
+
const L = {
|
|
2449
2449
|
requestId: fs("fetch"),
|
|
2450
2450
|
url: ot(_, us),
|
|
2451
2451
|
method: (b?.method ?? x?.method ?? "GET").toUpperCase(),
|
|
@@ -2456,9 +2456,9 @@ function qd() {
|
|
|
2456
2456
|
};
|
|
2457
2457
|
f.then(
|
|
2458
2458
|
(B) => {
|
|
2459
|
-
Sc(B,
|
|
2459
|
+
Sc(B, L, m, e).catch(() => {
|
|
2460
2460
|
e({
|
|
2461
|
-
...
|
|
2461
|
+
...L,
|
|
2462
2462
|
responseStatus: B.status,
|
|
2463
2463
|
durationMs: Date.now() - m
|
|
2464
2464
|
});
|
|
@@ -2466,7 +2466,7 @@ function qd() {
|
|
|
2466
2466
|
},
|
|
2467
2467
|
(B) => {
|
|
2468
2468
|
e({
|
|
2469
|
-
...
|
|
2469
|
+
...L,
|
|
2470
2470
|
errorText: ot(B instanceof Error ? B.message : String(B)),
|
|
2471
2471
|
durationMs: Date.now() - m
|
|
2472
2472
|
});
|
|
@@ -2589,7 +2589,7 @@ function qd() {
|
|
|
2589
2589
|
};
|
|
2590
2590
|
return window.__plunoProductAgentNetworkCapture = p, p;
|
|
2591
2591
|
}
|
|
2592
|
-
function
|
|
2592
|
+
function J(t, e, n) {
|
|
2593
2593
|
if (typeof window > "u")
|
|
2594
2594
|
return;
|
|
2595
2595
|
const i = window, s = {
|
|
@@ -3021,15 +3021,15 @@ function lp(t, e) {
|
|
|
3021
3021
|
e && h.add(e);
|
|
3022
3022
|
let y = 0;
|
|
3023
3023
|
const b = (T) => {
|
|
3024
|
-
const
|
|
3025
|
-
return
|
|
3024
|
+
const R = T.getAttribute("role");
|
|
3025
|
+
return R && !r.has(R) ? R : "";
|
|
3026
3026
|
}, m = (T) => {
|
|
3027
|
-
const
|
|
3028
|
-
return `${T.tagName.toLowerCase()}|${b(T)}|${
|
|
3029
|
-
}, f = (T,
|
|
3027
|
+
const R = T.getAttribute("data-testid") || T.getAttribute("data-test") || T.getAttribute("data-qa") || T.getAttribute("data-cy") || "";
|
|
3028
|
+
return `${T.tagName.toLowerCase()}|${b(T)}|${R}`;
|
|
3029
|
+
}, f = (T, R, L) => {
|
|
3030
3030
|
const B = ($, q) => {
|
|
3031
|
-
const W = $.tagName.toLowerCase(),
|
|
3032
|
-
if (y >= 1e3 && !
|
|
3031
|
+
const W = $.tagName.toLowerCase(), Q = window.getComputedStyle($), ne = u.has($);
|
|
3032
|
+
if (y >= 1e3 && !ne || L.has($) || o.has(W) || $.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || Q.display === "none" || Q.visibility === "hidden")
|
|
3033
3033
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
3034
3034
|
y += 1;
|
|
3035
3035
|
const K = b($), de = ca($), ie = l.has(K) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(W) || W === "a" && $.hasAttribute("href"), xe = Array.from($.children).filter((S) => S instanceof HTMLElement), C = /* @__PURE__ */ new Map();
|
|
@@ -3037,10 +3037,10 @@ function lp(t, e) {
|
|
|
3037
3037
|
const z = m(S);
|
|
3038
3038
|
C.set(z, (C.get(z) ?? 0) + 1);
|
|
3039
3039
|
}
|
|
3040
|
-
const M = /* @__PURE__ */ new Map(),
|
|
3040
|
+
const M = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map();
|
|
3041
3041
|
for (const S of xe) {
|
|
3042
|
-
const z = m(S), E =
|
|
3043
|
-
|
|
3042
|
+
const z = m(S), E = X.get(z) ?? 0;
|
|
3043
|
+
X.set(z, E + 1), (C.get(z) ?? 0) > 8 && E >= 6 && !u.has(S) && M.set(z, (M.get(z) ?? 0) + 1);
|
|
3044
3044
|
}
|
|
3045
3045
|
const F = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Set(), he = [], me = [];
|
|
3046
3046
|
for (const S of xe) {
|
|
@@ -3058,7 +3058,7 @@ function lp(t, e) {
|
|
|
3058
3058
|
S instanceof HTMLElement && Ye.push(B(S, q + 1));
|
|
3059
3059
|
const se = [...me, ...Ye], Ue = de.length > 0 || ie || se.some((S) => S.hasUsefulContent), Ie = Yt(
|
|
3060
3060
|
[de, ...se.map((S) => S.textPreview)].filter(Boolean).join(" ")
|
|
3061
|
-
).slice(0, 180), ye = $.hasAttribute("contenteditable") && (de.length > 0 || !$.querySelector("[contenteditable]")), Te = c.some((S) => $.hasAttribute(S)) || !!K || ye, O = ($.getClientRects().length > 0 ||
|
|
3061
|
+
).slice(0, 180), ye = $.hasAttribute("contenteditable") && (de.length > 0 || !$.querySelector("[contenteditable]")), Te = c.some((S) => $.hasAttribute(S)) || !!K || ye, O = ($.getClientRects().length > 0 || Q.display === "contents") && (n.has(W) || Te || ne) && (Ue || ne) && (!s.has(W) || Ue || Te || ne), Xe = O ? 1 : 0, oe = [];
|
|
3062
3062
|
if (O) {
|
|
3063
3063
|
const S = se.some((E) => E.containsTextElement), z = i.has(W) && !S ? Ie : de;
|
|
3064
3064
|
oe.push(pa($, d, r, z.slice(0, 180)));
|
|
@@ -3083,7 +3083,7 @@ function lp(t, e) {
|
|
|
3083
3083
|
containsTextElement: i.has(W) || se.some((S) => S.containsTextElement)
|
|
3084
3084
|
};
|
|
3085
3085
|
};
|
|
3086
|
-
return [`--- ${
|
|
3086
|
+
return [`--- ${R} ---`, ...B(T, 0).lines].join(`
|
|
3087
3087
|
`);
|
|
3088
3088
|
}, x = [], _ = Yt(window.getSelection()?.toString() ?? "");
|
|
3089
3089
|
_ && x.push(`--- selected text ---
|
|
@@ -3319,13 +3319,13 @@ function Sp(t) {
|
|
|
3319
3319
|
return Array.isArray(t) ? t.flatMap((e) => {
|
|
3320
3320
|
if (!e || typeof e != "object")
|
|
3321
3321
|
return [];
|
|
3322
|
-
const n = e, i =
|
|
3322
|
+
const n = e, i = Z(n, "id"), s = Z(n, "createdAt"), o = Z(n, "updatedAt"), r = Z(n, "lastActiveAt");
|
|
3323
3323
|
return !i || !s || !o || !r ? [] : [
|
|
3324
3324
|
{
|
|
3325
3325
|
id: i,
|
|
3326
|
-
title:
|
|
3327
|
-
customTitle:
|
|
3328
|
-
firstUserMessage:
|
|
3326
|
+
title: Z(n, "title"),
|
|
3327
|
+
customTitle: Z(n, "customTitle"),
|
|
3328
|
+
firstUserMessage: Z(n, "firstUserMessage"),
|
|
3329
3329
|
currentPage: n.currentPage ?? null,
|
|
3330
3330
|
createdAt: s,
|
|
3331
3331
|
updatedAt: o,
|
|
@@ -3734,7 +3734,7 @@ function dr(t) {
|
|
|
3734
3734
|
for (let s = t.length - 1; s > e; s -= 1) {
|
|
3735
3735
|
const o = t[s];
|
|
3736
3736
|
if (!o.respondsToUserMessageId) {
|
|
3737
|
-
if (
|
|
3737
|
+
if (rt(o))
|
|
3738
3738
|
return !0;
|
|
3739
3739
|
if (o.role === "system") {
|
|
3740
3740
|
if (o.dataType === "run_error")
|
|
@@ -3769,11 +3769,11 @@ function Wp(t, e, n) {
|
|
|
3769
3769
|
function Fp(t) {
|
|
3770
3770
|
const e = ba(t);
|
|
3771
3771
|
if (e === null)
|
|
3772
|
-
return t.some(
|
|
3772
|
+
return t.some(rt);
|
|
3773
3773
|
const n = t[e].id;
|
|
3774
3774
|
return t.some((i) => i.respondsToUserMessageId === n) ? t.some(
|
|
3775
|
-
(i) => i.respondsToUserMessageId === n &&
|
|
3776
|
-
) : t.slice(e + 1).some(
|
|
3775
|
+
(i) => i.respondsToUserMessageId === n && rt(i)
|
|
3776
|
+
) : t.slice(e + 1).some(rt);
|
|
3777
3777
|
}
|
|
3778
3778
|
function ba(t) {
|
|
3779
3779
|
for (let e = t.length - 1; e >= 0; e -= 1)
|
|
@@ -3782,7 +3782,7 @@ function ba(t) {
|
|
|
3782
3782
|
return null;
|
|
3783
3783
|
}
|
|
3784
3784
|
function _i(t) {
|
|
3785
|
-
return
|
|
3785
|
+
return rt(t) ? !0 : t.role !== "system" ? !1 : t.dataType === "run_error" ? !0 : t.dataType === "run_status" && t.loading !== !0;
|
|
3786
3786
|
}
|
|
3787
3787
|
function Xt(t) {
|
|
3788
3788
|
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
@@ -3872,7 +3872,7 @@ function Ls(t, e) {
|
|
|
3872
3872
|
const n = Ve(e);
|
|
3873
3873
|
if (!n)
|
|
3874
3874
|
return null;
|
|
3875
|
-
const i = t.find((o) =>
|
|
3875
|
+
const i = t.find((o) => Z(o, "id") === n), s = ve(i);
|
|
3876
3876
|
return s?.type === "message" && s.role === "user" && typeof s.clientMessageId == "string" ? s.clientMessageId : null;
|
|
3877
3877
|
}
|
|
3878
3878
|
function Gp(t, e) {
|
|
@@ -3901,7 +3901,7 @@ function Kp(t, e) {
|
|
|
3901
3901
|
for (let n = e - 1; n >= 0; n -= 1) {
|
|
3902
3902
|
const i = ve(t[n]);
|
|
3903
3903
|
if (i?.type === "message" && i.role === "user")
|
|
3904
|
-
return
|
|
3904
|
+
return Z(t[n], "id");
|
|
3905
3905
|
}
|
|
3906
3906
|
return null;
|
|
3907
3907
|
}
|
|
@@ -3917,7 +3917,7 @@ function Vp(t) {
|
|
|
3917
3917
|
const e = t;
|
|
3918
3918
|
return e.type === "message" && e.role === "assistant" ? !0 : e.type === "run_error" ? e.stage !== "tool_execution" : e.type === "run_status" && (e.status === "stopped" || e.status === "interrupted" || e.status === "failed");
|
|
3919
3919
|
}
|
|
3920
|
-
function
|
|
3920
|
+
function rt(t) {
|
|
3921
3921
|
return t.role === "assistant" && t.phase !== "commentary";
|
|
3922
3922
|
}
|
|
3923
3923
|
function Yp(t) {
|
|
@@ -3951,7 +3951,7 @@ function hi(t) {
|
|
|
3951
3951
|
return t?.type === "run_status" && t.status === "stopped";
|
|
3952
3952
|
}
|
|
3953
3953
|
function Zp(t, e) {
|
|
3954
|
-
return
|
|
3954
|
+
return rt(e) ? "completed" : hi(t) ? "stopped" : !Si(t) && (t?.type === "run_error" || t?.type === "run_status" && (t.status === "failed" || t.status === "interrupted")) ? "failed" : null;
|
|
3955
3955
|
}
|
|
3956
3956
|
function ur(t, e, n) {
|
|
3957
3957
|
const i = new Set(
|
|
@@ -3999,7 +3999,7 @@ function gr(t) {
|
|
|
3999
3999
|
}
|
|
4000
4000
|
function tc(t, e) {
|
|
4001
4001
|
return t.some(
|
|
4002
|
-
(n) => n.respondsToUserMessageId === e && (
|
|
4002
|
+
(n) => n.respondsToUserMessageId === e && (rt(n) || n.role === "system" && (n.dataType === "run_error" || n.dataType === "run_status" && n.loading !== !0))
|
|
4003
4003
|
);
|
|
4004
4004
|
}
|
|
4005
4005
|
function nc(t, e) {
|
|
@@ -4046,7 +4046,7 @@ function rc(t, e) {
|
|
|
4046
4046
|
function An(t, e) {
|
|
4047
4047
|
return !!(t.respondsToUserMessageId && t.respondsToUserMessageId === e.respondsToUserMessageId);
|
|
4048
4048
|
}
|
|
4049
|
-
function
|
|
4049
|
+
function Z(t, e) {
|
|
4050
4050
|
return t && typeof t == "object" && typeof t[e] == "string" ? t[e] : null;
|
|
4051
4051
|
}
|
|
4052
4052
|
function ac(t, e) {
|
|
@@ -4467,7 +4467,7 @@ function Mc(t) {
|
|
|
4467
4467
|
function Pc(t) {
|
|
4468
4468
|
return t === 401 || t === 403;
|
|
4469
4469
|
}
|
|
4470
|
-
const Li = "[REDACTED_SECRET]",
|
|
4470
|
+
const Li = "[REDACTED_SECRET]", at = "[REDACTED_TOKEN]", Rc = "[REDACTED_SIGNED_URL]", Lc = 20, Dc = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, Aa = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Ma = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Pa = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Ra = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, Uc = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Nc = /\bhttps?:\/\/[^\s"'<>]+/gi, Oc = /[),.;\]]+$/;
|
|
4471
4471
|
function We(t) {
|
|
4472
4472
|
return xi(t, 0, /* @__PURE__ */ new WeakSet());
|
|
4473
4473
|
}
|
|
@@ -4498,17 +4498,17 @@ function Da(t) {
|
|
|
4498
4498
|
try {
|
|
4499
4499
|
const e = new URL(t, location.href);
|
|
4500
4500
|
for (const n of Array.from(e.searchParams.keys()))
|
|
4501
|
-
Dc.test(n) && e.searchParams.set(n,
|
|
4502
|
-
return e.username && (e.username =
|
|
4501
|
+
Dc.test(n) && e.searchParams.set(n, at);
|
|
4502
|
+
return e.username && (e.username = at), e.password && (e.password = at), e.toString();
|
|
4503
4503
|
} catch {
|
|
4504
4504
|
return zc(t);
|
|
4505
4505
|
}
|
|
4506
4506
|
}
|
|
4507
4507
|
function Ii(t) {
|
|
4508
|
-
return t.replace(Uc, Rc).replace(Nc, Bc).replace(Aa, `Bearer ${
|
|
4508
|
+
return t.replace(Uc, Rc).replace(Nc, Bc).replace(Aa, `Bearer ${at}`).replace(Ma, `Basic ${at}`).replace(Pa, at).replace(Ra, (e, n) => `${n}: ${Li}`);
|
|
4509
4509
|
}
|
|
4510
4510
|
function zc(t) {
|
|
4511
|
-
return t.replace(Aa, `Bearer ${
|
|
4511
|
+
return t.replace(Aa, `Bearer ${at}`).replace(Ma, `Basic ${at}`).replace(Pa, at).replace(Ra, (e, n) => `${n}: ${Li}`);
|
|
4512
4512
|
}
|
|
4513
4513
|
function Bc(t) {
|
|
4514
4514
|
const e = t.match(Oc)?.[0] ?? "", n = e ? t.slice(0, -e.length) : t;
|
|
@@ -5020,7 +5020,7 @@ async function Qu(t = {}) {
|
|
|
5020
5020
|
r.style.setProperty(
|
|
5021
5021
|
"--pluno-pa-mobile-panel-top-offset",
|
|
5022
5022
|
`${e.mobilePanelTopOffset}px`
|
|
5023
|
-
), r.classList.add(`pluno-pa-widget--${e.colorScheme}`), e.scribbleStyle && r.classList.add("pluno-pa-widget--scribble"), c === "minimized" && (r.classList.add("pluno-pa-widget--minimized"),
|
|
5023
|
+
), r.classList.add(`pluno-pa-widget--${e.colorScheme}`), e.scribbleStyle && r.classList.add("pluno-pa-widget--scribble"), c === "minimized" && (r.classList.add("pluno-pa-widget--minimized"), wt(
|
|
5024
5024
|
r,
|
|
5025
5025
|
_s(
|
|
5026
5026
|
r,
|
|
@@ -5041,9 +5041,9 @@ async function Qu(t = {}) {
|
|
|
5041
5041
|
".pluno-pa-widget__launcher-input"
|
|
5042
5042
|
), T = r.querySelector(
|
|
5043
5043
|
".pluno-pa-widget__status--launcher"
|
|
5044
|
-
),
|
|
5044
|
+
), R = r.querySelector(
|
|
5045
5045
|
".pluno-pa-widget__launcher-minimize"
|
|
5046
|
-
),
|
|
5046
|
+
), L = r.querySelector(".pluno-pa-widget__panel"), B = r.querySelector(
|
|
5047
5047
|
".pluno-pa-widget__panel-drag-handle"
|
|
5048
5048
|
), $ = r.querySelector(
|
|
5049
5049
|
".pluno-pa-widget__scribble-spirals--panel"
|
|
@@ -5051,9 +5051,9 @@ async function Qu(t = {}) {
|
|
|
5051
5051
|
r.querySelectorAll(".pluno-pa-widget__resize-handle")
|
|
5052
5052
|
), W = r.querySelector(
|
|
5053
5053
|
".pluno-pa-widget__close"
|
|
5054
|
-
),
|
|
5054
|
+
), Q = r.querySelector(
|
|
5055
5055
|
".pluno-pa-widget__composer"
|
|
5056
|
-
),
|
|
5056
|
+
), ne = r.querySelector(
|
|
5057
5057
|
".pluno-pa-widget__attachment-error"
|
|
5058
5058
|
), K = r.querySelector(
|
|
5059
5059
|
".pluno-pa-widget__billing-status"
|
|
@@ -5067,7 +5067,7 @@ async function Qu(t = {}) {
|
|
|
5067
5067
|
".pluno-pa-widget__input"
|
|
5068
5068
|
), M = r.querySelector(
|
|
5069
5069
|
".pluno-pa-widget__model-picker"
|
|
5070
|
-
),
|
|
5070
|
+
), X = r.querySelector(
|
|
5071
5071
|
".pluno-pa-widget__model-trigger span"
|
|
5072
5072
|
), F = Array.from(
|
|
5073
5073
|
r.querySelectorAll(".pluno-pa-widget__model-option")
|
|
@@ -5107,11 +5107,11 @@ async function Qu(t = {}) {
|
|
|
5107
5107
|
".pluno-pa-widget__tab-groups-suggestion-enable"
|
|
5108
5108
|
), pe = r.querySelector(
|
|
5109
5109
|
".pluno-pa-widget__tab-groups-suggestion-dismiss"
|
|
5110
|
-
),
|
|
5110
|
+
), D = r.querySelector(
|
|
5111
5111
|
".pluno-pa-widget__proactive-suggestion"
|
|
5112
5112
|
), j = r.querySelector(
|
|
5113
5113
|
".pluno-pa-widget__proactive-suggestion-query"
|
|
5114
|
-
),
|
|
5114
|
+
), dt = r.querySelector(
|
|
5115
5115
|
".pluno-pa-widget__proactive-suggestion-run"
|
|
5116
5116
|
), Ot = r.querySelector(
|
|
5117
5117
|
".pluno-pa-widget__proactive-suggestion-edit"
|
|
@@ -5130,7 +5130,7 @@ async function Qu(t = {}) {
|
|
|
5130
5130
|
), Mn = r.querySelector(
|
|
5131
5131
|
".pluno-pa-widget__proactive-suggestion-feedback-status"
|
|
5132
5132
|
);
|
|
5133
|
-
if (!f || !_ || !
|
|
5133
|
+
if (!f || !_ || !L || !W || !Q || !ne || !K || !de || !ie || !xe || !C || !M || !X || !V || !he || !me || !Ye || !se || !Ue || !Ie || !ye || !Te || !O || !Xe)
|
|
5134
5134
|
throw new Error("Failed to mount Pluno widget");
|
|
5135
5135
|
if (e.movableLauncher && !x)
|
|
5136
5136
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
@@ -5138,7 +5138,7 @@ async function Qu(t = {}) {
|
|
|
5138
5138
|
throw new Error("Failed to mount Pluno widget panel drag handle");
|
|
5139
5139
|
let Fe = null, ce = "idle";
|
|
5140
5140
|
const Pn = () => {
|
|
5141
|
-
if (!(
|
|
5141
|
+
if (!(D !== null && !D.hidden && !r.classList.contains("pluno-pa-widget--proactive-suggestion-in-panel") && e.layout === "floating")) {
|
|
5142
5142
|
r.classList.remove("pluno-pa-widget--proactive-suggestion-below");
|
|
5143
5143
|
return;
|
|
5144
5144
|
}
|
|
@@ -5146,18 +5146,18 @@ async function Qu(t = {}) {
|
|
|
5146
5146
|
"pluno-pa-widget--proactive-suggestion-below",
|
|
5147
5147
|
pg(
|
|
5148
5148
|
f.getBoundingClientRect(),
|
|
5149
|
-
|
|
5149
|
+
D.getBoundingClientRect().height
|
|
5150
5150
|
)
|
|
5151
5151
|
);
|
|
5152
5152
|
}, ke = () => {
|
|
5153
|
-
if (!
|
|
5153
|
+
if (!D || !j || !uo || !go || !Ce || !Jt || !Mn)
|
|
5154
5154
|
return;
|
|
5155
5155
|
const a = e.proactiveSuggestion ?? Fe, g = a !== null && !I.getState().isThinking, w = O.querySelector(
|
|
5156
5156
|
".pluno-pa-widget__proactive-suggestion-slot"
|
|
5157
|
-
), v = !
|
|
5158
|
-
|
|
5157
|
+
), v = !L.hidden && !r.classList.contains("pluno-pa-widget--closing"), P = g && v && w !== null;
|
|
5158
|
+
P ? w.appendChild(D) : D.parentElement !== r && r.insertBefore(D, W), D.hidden = !g, r.classList.toggle("pluno-pa-widget--proactive-suggestion", g), r.classList.toggle(
|
|
5159
5159
|
"pluno-pa-widget--proactive-suggestion-in-panel",
|
|
5160
|
-
|
|
5160
|
+
P
|
|
5161
5161
|
), j.textContent = a?.suggestedQuery ?? "", uo.hidden = e.proactiveSuggestion === null, go.hidden = Fe === null;
|
|
5162
5162
|
const H = ce === "success";
|
|
5163
5163
|
Ce.hidden = H, Jt.hidden = H, Jt.disabled = ce === "submitting" || Ce.value.trim().length === 0, Jt.textContent = ce === "submitting" ? "Sending…" : "Send feedback", Mn.textContent = ce === "success" ? "Thanks — this helps improve your suggestions." : ce === "error" ? "Couldn’t send feedback. Please try again." : "Tell Pluno what made this suggestion miss the mark.", Mn.classList.toggle(
|
|
@@ -5186,9 +5186,9 @@ async function Qu(t = {}) {
|
|
|
5186
5186
|
};
|
|
5187
5187
|
xe.hidden = !e.attachmentsEnabled, ie.disabled = !e.attachmentsEnabled, ie.accept = e.productVariant === "personal" ? "" : Md, Wr(_), Wr(C);
|
|
5188
5188
|
let ue = [], Rn = !1, Qt = null, Ze = null;
|
|
5189
|
-
const zi = (a) => a === C ? "widget_composer" : a === _ ? "widget_launcher" : a && o.contains(a) ? "widget_control" : a === m.body ? "body" : a === m.documentElement ? "document" : a ? "host_page" : "none",
|
|
5190
|
-
const v = li(m),
|
|
5191
|
-
|
|
5189
|
+
const zi = (a) => a === C ? "widget_composer" : a === _ ? "widget_launcher" : a && o.contains(a) ? "widget_control" : a === m.body ? "body" : a === m.documentElement ? "document" : a ? "host_page" : "none", pt = (a, g, w = {}) => {
|
|
5190
|
+
const v = li(m), P = w.skipIfAlreadyFocused === !0 && v === a;
|
|
5191
|
+
P || (w.preventScroll ? a.focus({ preventScroll: !0 }) : a.focus());
|
|
5192
5192
|
const H = li(m);
|
|
5193
5193
|
return Se(
|
|
5194
5194
|
"web-sdk.widget.focus",
|
|
@@ -5202,7 +5202,7 @@ async function Qu(t = {}) {
|
|
|
5202
5202
|
previousFocus: zi(v),
|
|
5203
5203
|
requestedFocus: zi(a),
|
|
5204
5204
|
resultingFocus: zi(H),
|
|
5205
|
-
focusSkipped:
|
|
5205
|
+
focusSkipped: P,
|
|
5206
5206
|
focusSucceeded: H === a,
|
|
5207
5207
|
hostConnected: s.isConnected,
|
|
5208
5208
|
panelOpen: r.classList.contains("pluno-pa-widget--open"),
|
|
@@ -5211,8 +5211,8 @@ async function Qu(t = {}) {
|
|
|
5211
5211
|
hasSession: !!I.getState().sessionId,
|
|
5212
5212
|
isThinking: I.getState().isThinking
|
|
5213
5213
|
}
|
|
5214
|
-
), !
|
|
5215
|
-
},
|
|
5214
|
+
), !P && H === a;
|
|
5215
|
+
}, ct = (a) => !C.isConnected || C.disabled || C.readOnly || !r.classList.contains("pluno-pa-widget--open") || e.loginRequired || e.signupRequired || Pe(e.billingStatus) ? !1 : pt(C, a, {
|
|
5216
5216
|
preventScroll: !0,
|
|
5217
5217
|
skipIfAlreadyFocused: !0
|
|
5218
5218
|
}), en = () => {
|
|
@@ -5222,7 +5222,7 @@ async function Qu(t = {}) {
|
|
|
5222
5222
|
(a) => {
|
|
5223
5223
|
ue = ue.filter(
|
|
5224
5224
|
(g, w) => w !== a
|
|
5225
|
-
), en(), Y(I.getState()), le(),
|
|
5225
|
+
), en(), Y(I.getState()), le(), ct("remove_attachment");
|
|
5226
5226
|
}
|
|
5227
5227
|
);
|
|
5228
5228
|
}, ho = e.loginRequired || e.signupRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (e.tokenEndpoint ? async () => dl(e.tokenEndpoint) : void 0);
|
|
@@ -5272,7 +5272,7 @@ async function Qu(t = {}) {
|
|
|
5272
5272
|
M.hidden = !mo;
|
|
5273
5273
|
const qt = () => {
|
|
5274
5274
|
const a = ui.find((w) => w.value === He), g = tn;
|
|
5275
|
-
|
|
5275
|
+
X.textContent = a?.label ?? He, M.dataset.loading = String(g), M.setAttribute("aria-disabled", String(g));
|
|
5276
5276
|
for (const w of F) {
|
|
5277
5277
|
const v = w.dataset.model === He;
|
|
5278
5278
|
w.classList.toggle("is-selected", v), w.setAttribute("aria-selected", String(v)), w.disabled = g;
|
|
@@ -5318,7 +5318,7 @@ async function Qu(t = {}) {
|
|
|
5318
5318
|
const Wi = new Set(d.openToolGroupKeys), vt = new Set(
|
|
5319
5319
|
d.seenShareCandidateIds
|
|
5320
5320
|
), nn = new Set(vt);
|
|
5321
|
-
let sn = d.sharePromptsDisabled, Ne = null,
|
|
5321
|
+
let sn = d.sharePromptsDisabled, Ne = null, ut = null, ee = !1, on = !(e.loginRequired || e.signupRequired), gt = !1, xt = {
|
|
5322
5322
|
enabled: !0
|
|
5323
5323
|
}, It = 0, Fi = null, Tt = null, Ct = null, Dn = null, bo = "", _e = !1, Ee = !1, $e = [], rn = null, kt = null, Un = !1, Et = 0, Ae = null, yo = location.origin, _o = I.getState().sessionId, So = I.getState().user?.id ?? null, Hi = I.getState().status;
|
|
5324
5324
|
const Oe = (a, g) => {
|
|
@@ -5351,9 +5351,9 @@ async function Qu(t = {}) {
|
|
|
5351
5351
|
a.lastActiveAt,
|
|
5352
5352
|
Date.now()
|
|
5353
5353
|
);
|
|
5354
|
-
const
|
|
5355
|
-
|
|
5356
|
-
_e = !1, kt = null, ze(), Oe(!0, "newSession"), qe(), I.loadSession(a.id), pn = null, Y(I.getState()),
|
|
5354
|
+
const P = document.createElement("small");
|
|
5355
|
+
P.className = "pluno-pa-widget__history-path", P.textContent = xg(a), g.append(w, v, P), g.addEventListener("click", () => {
|
|
5356
|
+
_e = !1, kt = null, ze(), Oe(!0, "newSession"), qe(), I.loadSession(a.id), pn = null, Y(I.getState()), ct("history_session_selected");
|
|
5357
5357
|
}), se.appendChild(g);
|
|
5358
5358
|
}
|
|
5359
5359
|
if (Ee && $e.length > 0) {
|
|
@@ -5366,11 +5366,11 @@ async function Qu(t = {}) {
|
|
|
5366
5366
|
Ee = !0, kt = null, ze();
|
|
5367
5367
|
try {
|
|
5368
5368
|
const w = await I.listSessions({ cursor: a, limit: 20 });
|
|
5369
|
-
if (g !== Et ||
|
|
5369
|
+
if (g !== Et || ee)
|
|
5370
5370
|
return;
|
|
5371
5371
|
$e = a ? [...$e, ...w.sessions] : w.sessions, rn = w.nextCursor, a || (Un = !0);
|
|
5372
5372
|
} catch (w) {
|
|
5373
|
-
if (g !== Et ||
|
|
5373
|
+
if (g !== Et || ee)
|
|
5374
5374
|
return;
|
|
5375
5375
|
Se(
|
|
5376
5376
|
"web-sdk.widget",
|
|
@@ -5380,7 +5380,7 @@ async function Qu(t = {}) {
|
|
|
5380
5380
|
}
|
|
5381
5381
|
), kt = Ou;
|
|
5382
5382
|
} finally {
|
|
5383
|
-
if (g !== Et ||
|
|
5383
|
+
if (g !== Et || ee)
|
|
5384
5384
|
return;
|
|
5385
5385
|
Ee = !1, ze();
|
|
5386
5386
|
}
|
|
@@ -5389,12 +5389,12 @@ async function Qu(t = {}) {
|
|
|
5389
5389
|
Ae !== null && (window.clearTimeout(Ae), Ae = null), Et += 1, Ee = !1, $e = [], rn = null, kt = null, Un = !1, ze(), !(e.layout === "page" || e.loginRequired || e.signupRequired) && vo(null, Et);
|
|
5390
5390
|
}, On = () => {
|
|
5391
5391
|
Ae === null && (Ae = window.setTimeout(() => {
|
|
5392
|
-
Ae = null, !(
|
|
5392
|
+
Ae = null, !(ee || !r.classList.contains("pluno-pa-widget--open")) && xo();
|
|
5393
5393
|
}, 0));
|
|
5394
5394
|
}, ml = () => {
|
|
5395
5395
|
!rn || Ee || se.scrollHeight - se.scrollTop - se.clientHeight <= 24 && vo(rn);
|
|
5396
5396
|
}, Io = () => {
|
|
5397
|
-
|
|
5397
|
+
ee || typeof document > "u" || (Vr(o, e.accentColor), s.isConnected || (e.mountTarget?.isConnected ? e.mountTarget.appendChild(s) : e.mountTarget || m.body?.appendChild(s)));
|
|
5398
5398
|
}, To = new MutationObserver(Io);
|
|
5399
5399
|
To.observe(m.documentElement, {
|
|
5400
5400
|
childList: !0,
|
|
@@ -5411,7 +5411,7 @@ async function Qu(t = {}) {
|
|
|
5411
5411
|
),
|
|
5412
5412
|
g
|
|
5413
5413
|
);
|
|
5414
|
-
},
|
|
5414
|
+
}, te = () => {
|
|
5415
5415
|
const a = wg(
|
|
5416
5416
|
o,
|
|
5417
5417
|
_,
|
|
@@ -5438,14 +5438,14 @@ async function Qu(t = {}) {
|
|
|
5438
5438
|
r.classList.remove("pluno-pa-widget--minimized"), f.removeAttribute("tabindex"), f.removeAttribute("role"), f.removeAttribute("aria-label"), !r.classList.contains("pluno-pa-widget--open") && !r.classList.contains("pluno-pa-widget--closing") && dn(!1), g && qn("shown", w);
|
|
5439
5439
|
return;
|
|
5440
5440
|
}
|
|
5441
|
-
Ne !== null && (window.clearTimeout(Ne), Ne = null), r.classList.remove("pluno-pa-widget--open"), r.classList.remove("pluno-pa-widget--closing"), r.classList.add("pluno-pa-widget--minimized"), f.hidden = !1, f.setAttribute("role", "button"), f.setAttribute("aria-label", "Open Pluno"),
|
|
5441
|
+
Ne !== null && (window.clearTimeout(Ne), Ne = null), r.classList.remove("pluno-pa-widget--open"), r.classList.remove("pluno-pa-widget--closing"), r.classList.add("pluno-pa-widget--minimized"), f.hidden = !1, f.setAttribute("role", "button"), f.setAttribute("aria-label", "Open Pluno"), L.hidden = !0, W.hidden = !0, f.tabIndex = 0, C.value = "", ke(), wt(
|
|
5442
5442
|
r,
|
|
5443
5443
|
_s(
|
|
5444
5444
|
r,
|
|
5445
5445
|
u,
|
|
5446
5446
|
e.position
|
|
5447
5447
|
)
|
|
5448
|
-
), Or(r),
|
|
5448
|
+
), Or(r), te(), !v && e.layout === "floating" && I.recordWidgetLifecycle("minimized", w), g && qn("minimized", w);
|
|
5449
5449
|
}, At = (a, g = {}) => {
|
|
5450
5450
|
mg(a, {
|
|
5451
5451
|
debugVersion: Ju,
|
|
@@ -5459,20 +5459,20 @@ async function Qu(t = {}) {
|
|
|
5459
5459
|
},
|
|
5460
5460
|
rootRect: xs(r),
|
|
5461
5461
|
launcherRect: xs(f),
|
|
5462
|
-
panelRect: xs(
|
|
5462
|
+
panelRect: xs(L),
|
|
5463
5463
|
viewport: be(),
|
|
5464
|
-
panelHidden:
|
|
5464
|
+
panelHidden: L.hidden,
|
|
5465
5465
|
closeHidden: W.hidden,
|
|
5466
5466
|
...g
|
|
5467
5467
|
});
|
|
5468
5468
|
}, dn = (a = !0) => {
|
|
5469
5469
|
if (!u) {
|
|
5470
|
-
|
|
5470
|
+
wt(r, null);
|
|
5471
5471
|
const w = an(a);
|
|
5472
5472
|
return Pn(), w;
|
|
5473
5473
|
}
|
|
5474
5474
|
const g = an(a);
|
|
5475
|
-
return
|
|
5475
|
+
return wt(r, g), Pn(), At("Applied stored closed launcher position", {
|
|
5476
5476
|
visibleLauncherPosition: g
|
|
5477
5477
|
}), g;
|
|
5478
5478
|
}, zn = (a, g) => {
|
|
@@ -5486,10 +5486,10 @@ async function Qu(t = {}) {
|
|
|
5486
5486
|
});
|
|
5487
5487
|
}, $i = () => {
|
|
5488
5488
|
const a = Rt(h).width;
|
|
5489
|
-
return
|
|
5489
|
+
return L.getBoundingClientRect().width || a;
|
|
5490
5490
|
}, Co = () => {
|
|
5491
5491
|
if (r.classList.contains("pluno-pa-widget--minimized")) {
|
|
5492
|
-
|
|
5492
|
+
wt(
|
|
5493
5493
|
r,
|
|
5494
5494
|
_s(
|
|
5495
5495
|
r,
|
|
@@ -5541,14 +5541,14 @@ async function Qu(t = {}) {
|
|
|
5541
5541
|
u = Ss(
|
|
5542
5542
|
v,
|
|
5543
5543
|
w
|
|
5544
|
-
), y = null,
|
|
5544
|
+
), y = null, wt(r, v), Pn(), At("Dragging closed launcher", {
|
|
5545
5545
|
requestedPosition: g
|
|
5546
5546
|
});
|
|
5547
5547
|
},
|
|
5548
5548
|
persist: () => {
|
|
5549
|
-
p = !0,
|
|
5549
|
+
p = !0, te(), At("Persisted closed launcher drag position");
|
|
5550
5550
|
}
|
|
5551
|
-
})) :
|
|
5551
|
+
})) : wt(r, null), ys(r, h);
|
|
5552
5552
|
const Eo = () => {
|
|
5553
5553
|
const a = Rt(h), g = an();
|
|
5554
5554
|
return {
|
|
@@ -5582,7 +5582,7 @@ async function Qu(t = {}) {
|
|
|
5582
5582
|
const g = Rt(h), w = vn(
|
|
5583
5583
|
a,
|
|
5584
5584
|
g
|
|
5585
|
-
), v = Cn(r),
|
|
5585
|
+
), v = Cn(r), P = fi(
|
|
5586
5586
|
r,
|
|
5587
5587
|
gg(
|
|
5588
5588
|
w,
|
|
@@ -5593,22 +5593,22 @@ async function Qu(t = {}) {
|
|
|
5593
5593
|
v
|
|
5594
5594
|
);
|
|
5595
5595
|
u = Ss(
|
|
5596
|
-
|
|
5596
|
+
P,
|
|
5597
5597
|
v
|
|
5598
|
-
), p = !0, y = null,
|
|
5598
|
+
), p = !0, y = null, wt(r, P), zn(w, P);
|
|
5599
5599
|
}, bl = e.movableLauncher && B ? og({
|
|
5600
5600
|
root: r,
|
|
5601
5601
|
handle: B,
|
|
5602
5602
|
getPosition: () => Eo().position,
|
|
5603
5603
|
setPosition: wl,
|
|
5604
|
-
persist:
|
|
5604
|
+
persist: te
|
|
5605
5605
|
}) : () => {
|
|
5606
5606
|
}, yl = q.length > 0 ? rg({
|
|
5607
5607
|
root: r,
|
|
5608
5608
|
handles: q,
|
|
5609
5609
|
getBounds: Eo,
|
|
5610
5610
|
setBounds: fl,
|
|
5611
|
-
persist:
|
|
5611
|
+
persist: te
|
|
5612
5612
|
}) : () => {
|
|
5613
5613
|
};
|
|
5614
5614
|
let ji = !1;
|
|
@@ -5617,7 +5617,7 @@ async function Qu(t = {}) {
|
|
|
5617
5617
|
ji = !0;
|
|
5618
5618
|
try {
|
|
5619
5619
|
const a = await e.billingStatusLoader();
|
|
5620
|
-
if (
|
|
5620
|
+
if (ee)
|
|
5621
5621
|
return;
|
|
5622
5622
|
Hr(
|
|
5623
5623
|
e.billingStatus,
|
|
@@ -5639,9 +5639,9 @@ async function Qu(t = {}) {
|
|
|
5639
5639
|
const Mo = (a) => {
|
|
5640
5640
|
const g = Date.now(), w = window.location.href;
|
|
5641
5641
|
a === "composer_input" && pn?.scope === w && g - pn.requestedAt < wu || (a === "composer_input" && (pn = { scope: w, requestedAt: g }), I.warmup(a));
|
|
5642
|
-
}, Be = (a = "", g = !0, w = !0, v = !0,
|
|
5643
|
-
const H = r.classList.contains("pluno-pa-widget--open") || !
|
|
5644
|
-
!H && v && Mo("panel_open"), Ao(), gn && (gn = !1, Zi()), r.classList.contains("pluno-pa-widget--open") || (y = null), Ne !== null && (window.clearTimeout(Ne), Ne = null), ln("shown", !1),
|
|
5642
|
+
}, Be = (a = "", g = !0, w = !0, v = !0, P = "external_request") => {
|
|
5643
|
+
const H = r.classList.contains("pluno-pa-widget--open") || !L.hidden && !r.classList.contains("pluno-pa-widget--closing");
|
|
5644
|
+
!H && v && Mo("panel_open"), Ao(), gn && (gn = !1, Zi()), r.classList.contains("pluno-pa-widget--open") || (y = null), Ne !== null && (window.clearTimeout(Ne), Ne = null), ln("shown", !1), L.hidden = !1, W.hidden = !1, Is(
|
|
5645
5645
|
$,
|
|
5646
5646
|
$i()
|
|
5647
5647
|
), r.classList.remove("pluno-pa-widget--closing"), ke();
|
|
@@ -5654,22 +5654,22 @@ async function Qu(t = {}) {
|
|
|
5654
5654
|
if (zn(Ge, U), At("Opening launcher at clamped open panel position", {
|
|
5655
5655
|
openPanelPosition: Ge,
|
|
5656
5656
|
visibleLauncherPosition: U
|
|
5657
|
-
}), Oe(!0, "open"), qe(), !H && e.layout === "floating" && I.recordWidgetLifecycle("opened",
|
|
5658
|
-
r.classList.add("pluno-pa-widget--open"), H || On(), f.hidden = !0, a && (C.value = a, Sn(C)), xn(O, () => xt.enabled), It = O.scrollTop, w && (
|
|
5657
|
+
}), Oe(!0, "open"), qe(), !H && e.layout === "floating" && I.recordWidgetLifecycle("opened", P), !g) {
|
|
5658
|
+
r.classList.add("pluno-pa-widget--open"), H || On(), f.hidden = !0, a && (C.value = a, Sn(C)), xn(O, () => xt.enabled), It = O.scrollTop, w && (pt(C, "panel_open_immediate"), C.setSelectionRange(C.value.length, C.value.length)), te(), qn("shown", P), e.onPanelOpenChange?.(!0, P);
|
|
5659
5659
|
return;
|
|
5660
5660
|
}
|
|
5661
5661
|
const Rl = Date.now();
|
|
5662
5662
|
window.requestAnimationFrame(() => {
|
|
5663
|
-
r.classList.add("pluno-pa-widget--open"), H || On(), a && (C.value = a, Sn(C)), xn(O, () => xt.enabled), It = O.scrollTop, w && (
|
|
5663
|
+
r.classList.add("pluno-pa-widget--open"), H || On(), a && (C.value = a, Sn(C)), xn(O, () => xt.enabled), It = O.scrollTop, w && (pt(C, "panel_open_animation", {
|
|
5664
5664
|
scheduledAt: Rl
|
|
5665
|
-
}), C.setSelectionRange(C.value.length, C.value.length)),
|
|
5665
|
+
}), C.setSelectionRange(C.value.length, C.value.length)), te(), qn("shown", P), e.onPanelOpenChange?.(!0, P), Ne = window.setTimeout(() => {
|
|
5666
5666
|
f.hidden = !0, xn(O, () => xt.enabled), It = O.scrollTop;
|
|
5667
5667
|
}, 220);
|
|
5668
5668
|
});
|
|
5669
5669
|
}, Gi = (a = "external_request") => {
|
|
5670
|
-
const g = r.classList.contains("pluno-pa-widget--open") || !
|
|
5671
|
-
Ne !== null && (window.clearTimeout(Ne), Ne = null), f.hidden = !1, u && (dn(!1), At("Closing launcher at stored position")), r.classList.remove("pluno-pa-widget--open"), r.classList.add("pluno-pa-widget--closing"), ke(),
|
|
5672
|
-
|
|
5670
|
+
const g = r.classList.contains("pluno-pa-widget--open") || !L.hidden && !r.classList.contains("pluno-pa-widget--closing");
|
|
5671
|
+
Ne !== null && (window.clearTimeout(Ne), Ne = null), f.hidden = !1, u && (dn(!1), At("Closing launcher at stored position")), r.classList.remove("pluno-pa-widget--open"), r.classList.add("pluno-pa-widget--closing"), ke(), te(), g && e.layout === "floating" && I.recordWidgetLifecycle("closed", a), e.onPanelOpenChange?.(!1, a), Ne = window.setTimeout(() => {
|
|
5672
|
+
L.hidden = !0, W.hidden = !0, y = null, r.classList.remove("pluno-pa-widget--closing");
|
|
5673
5673
|
}, 220);
|
|
5674
5674
|
};
|
|
5675
5675
|
f.addEventListener("submit", (a) => {
|
|
@@ -5688,7 +5688,7 @@ async function Qu(t = {}) {
|
|
|
5688
5688
|
const a = _.value;
|
|
5689
5689
|
Be(a, !0, !0, !0, "launcher_input"), _.value = "";
|
|
5690
5690
|
});
|
|
5691
|
-
let cn = null,
|
|
5691
|
+
let cn = null, ht = null, Bn = null, Mt = null, je = null, ae = null;
|
|
5692
5692
|
const Wn = (a) => a === _ || a === C, Ro = (a) => a.composedPath().find(Wn) ?? null, _l = (a) => {
|
|
5693
5693
|
let g = a;
|
|
5694
5694
|
for (; g; ) {
|
|
@@ -5710,8 +5710,8 @@ async function Qu(t = {}) {
|
|
|
5710
5710
|
g = v;
|
|
5711
5711
|
continue;
|
|
5712
5712
|
}
|
|
5713
|
-
const
|
|
5714
|
-
g =
|
|
5713
|
+
const P = g.getRootNode();
|
|
5714
|
+
g = P instanceof ShadowRoot ? P.host : null;
|
|
5715
5715
|
}
|
|
5716
5716
|
return null;
|
|
5717
5717
|
}, Vi = () => li(m), Sl = (a) => {
|
|
@@ -5731,7 +5731,7 @@ async function Qu(t = {}) {
|
|
|
5731
5731
|
je !== null && window.clearTimeout(je);
|
|
5732
5732
|
const w = Date.now();
|
|
5733
5733
|
je = window.setTimeout(() => {
|
|
5734
|
-
je = null, Qe === a && g.isConnected &&
|
|
5734
|
+
je = null, Qe === a && g.isConnected && pt(g, "host_modal_recovery", {
|
|
5735
5735
|
preventScroll: !0,
|
|
5736
5736
|
scheduledAt: w
|
|
5737
5737
|
});
|
|
@@ -5756,22 +5756,22 @@ async function Qu(t = {}) {
|
|
|
5756
5756
|
if (!g)
|
|
5757
5757
|
return;
|
|
5758
5758
|
const w = Date.now();
|
|
5759
|
-
|
|
5759
|
+
ht = w, cn = w, ae !== null && window.clearTimeout(ae);
|
|
5760
5760
|
const v = Qe ?? Ki(Vi());
|
|
5761
5761
|
v && (un(v, g), a.stopImmediatePropagation()), ae = window.setTimeout(() => {
|
|
5762
|
-
if (ae = null,
|
|
5762
|
+
if (ae = null, ht !== w)
|
|
5763
5763
|
return;
|
|
5764
|
-
const
|
|
5765
|
-
if (
|
|
5766
|
-
|
|
5764
|
+
const P = Vi();
|
|
5765
|
+
if (P === g) {
|
|
5766
|
+
ht = null;
|
|
5767
5767
|
return;
|
|
5768
5768
|
}
|
|
5769
|
-
const H = Ki(
|
|
5769
|
+
const H = Ki(P);
|
|
5770
5770
|
H && un(H, g);
|
|
5771
5771
|
}, 0);
|
|
5772
5772
|
}, Fn = (a) => {
|
|
5773
5773
|
const g = Ro(a);
|
|
5774
|
-
g && (cn = Date.now(), Qe !== null && (a.stopImmediatePropagation(),
|
|
5774
|
+
g && (cn = Date.now(), Qe !== null && (a.stopImmediatePropagation(), ht = null, ae !== null && (window.clearTimeout(ae), ae = null), te(), a.type === "focus" && g === _ && Po()));
|
|
5775
5775
|
};
|
|
5776
5776
|
m.defaultView?.addEventListener(
|
|
5777
5777
|
"pointerdown",
|
|
@@ -5788,16 +5788,16 @@ async function Qu(t = {}) {
|
|
|
5788
5788
|
), r.addEventListener("pointerdown", (a) => {
|
|
5789
5789
|
Wn(a.target) && a.stopPropagation();
|
|
5790
5790
|
}), r.addEventListener("focusin", (a) => {
|
|
5791
|
-
Wn(a.target) && (a.stopPropagation(), cn = Date.now(),
|
|
5791
|
+
Wn(a.target) && (a.stopPropagation(), cn = Date.now(), ht = null, ae !== null && (window.clearTimeout(ae), ae = null), te());
|
|
5792
5792
|
}), r.addEventListener("focusout", (a) => {
|
|
5793
5793
|
if (!Wn(a.target) || Qe !== null)
|
|
5794
5794
|
return;
|
|
5795
5795
|
const g = cn;
|
|
5796
5796
|
if (cn = null, g === null || Date.now() - g > Er)
|
|
5797
5797
|
return;
|
|
5798
|
-
const w = a.target, v =
|
|
5799
|
-
|
|
5800
|
-
const
|
|
5798
|
+
const w = a.target, v = ht !== null && Date.now() - ht <= Er;
|
|
5799
|
+
ht = null, ae !== null && (window.clearTimeout(ae), ae = null);
|
|
5800
|
+
const P = (H) => {
|
|
5801
5801
|
const U = Ki(H);
|
|
5802
5802
|
if (!U)
|
|
5803
5803
|
return !1;
|
|
@@ -5806,14 +5806,14 @@ async function Qu(t = {}) {
|
|
|
5806
5806
|
const Ge = Date.now();
|
|
5807
5807
|
return Bn !== null && Ge - Bn <= Uu ? (un(U, w), !0) : (Bn = Ge, !0);
|
|
5808
5808
|
};
|
|
5809
|
-
|
|
5810
|
-
Qe === null && w.isConnected &&
|
|
5809
|
+
P(a.relatedTarget) || window.setTimeout(() => {
|
|
5810
|
+
Qe === null && w.isConnected && P(Vi());
|
|
5811
5811
|
}, 0);
|
|
5812
5812
|
}), f.addEventListener("keydown", (a) => {
|
|
5813
5813
|
!r.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), Be("", !0, !0, !0, "minimized_launcher"));
|
|
5814
|
-
}),
|
|
5814
|
+
}), R?.addEventListener("pointerdown", (a) => {
|
|
5815
5815
|
a.stopPropagation();
|
|
5816
|
-
}),
|
|
5816
|
+
}), R?.addEventListener("click", (a) => {
|
|
5817
5817
|
a.preventDefault(), a.stopPropagation(), ln("minimized", !0, "minimize_button");
|
|
5818
5818
|
}), W.addEventListener("click", () => Gi("close_button")), O.addEventListener("wheel", (a) => {
|
|
5819
5819
|
Nn(a.deltaY < 0 ? "up" : null);
|
|
@@ -5849,32 +5849,32 @@ async function Qu(t = {}) {
|
|
|
5849
5849
|
const Ji = () => {
|
|
5850
5850
|
const a = I.getState().status;
|
|
5851
5851
|
return !Xi && (on || a === "idle" || a === "connecting" || a === "reconnecting");
|
|
5852
|
-
},
|
|
5852
|
+
}, mt = () => on || I.getState().status !== "connected", Hn = () => {
|
|
5853
5853
|
const a = I.getState().status;
|
|
5854
5854
|
return Ji() ? !1 : a !== "connected" && !(Xi && a === "reconnecting");
|
|
5855
5855
|
}, Bt = () => {
|
|
5856
5856
|
const a = zt(), g = I.getState(), w = !g.isThinking && !g.pendingMessageStatus && !!g.lastError;
|
|
5857
|
-
_.readOnly = !1, C.readOnly = !1, _.placeholder = a ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : w ? "Needs attention" : gn ? "New update" : e.launcherLabel, C.placeholder = a ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : it.launcherLabel,
|
|
5857
|
+
_.readOnly = !1, C.readOnly = !1, _.placeholder = a ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : w ? "Needs attention" : gn ? "New update" : e.launcherLabel, C.placeholder = a ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : it.launcherLabel, Q.hidden = a;
|
|
5858
5858
|
}, le = () => {
|
|
5859
5859
|
const a = I.getState(), g = a.isThinking;
|
|
5860
|
-
V.disabled = Hn() || Pe(e.billingStatus) || a.pendingMessageStatus !== null || Rn && !g || !g && C.value.trim().length === 0 && ue.length === 0, xe.disabled = zt() ||
|
|
5860
|
+
V.disabled = Hn() || Pe(e.billingStatus) || a.pendingMessageStatus !== null || Rn && !g || !g && C.value.trim().length === 0 && ue.length === 0, xe.disabled = zt() || mt() || Pe(e.billingStatus);
|
|
5861
5861
|
};
|
|
5862
5862
|
Bt();
|
|
5863
5863
|
const Zi = () => {
|
|
5864
|
-
const a = I.getState(), g = a.isThinking, w = a.turnPhase !== null, v = a.turnPhase === "sending",
|
|
5865
|
-
|
|
5864
|
+
const a = I.getState(), g = a.isThinking, w = a.turnPhase !== null, v = a.turnPhase === "sending", P = T?.lastElementChild;
|
|
5865
|
+
P && (P.textContent = "Working..."), r.classList.toggle("pluno-pa-widget--thinking", g), r.classList.toggle("pluno-pa-widget--sending", v), r.classList.toggle(
|
|
5866
5866
|
"pluno-pa-widget--unread",
|
|
5867
5867
|
!w && (gn || !!a.lastError)
|
|
5868
5868
|
), Bt();
|
|
5869
5869
|
};
|
|
5870
5870
|
Zi();
|
|
5871
5871
|
const Qi = () => {
|
|
5872
|
-
zt() ||
|
|
5872
|
+
zt() || ee || (on = !0, Bt(), le(), I.connect().then(
|
|
5873
5873
|
() => {
|
|
5874
|
-
|
|
5874
|
+
ee || (on = !1, Bt(), le());
|
|
5875
5875
|
},
|
|
5876
5876
|
(a) => {
|
|
5877
|
-
|
|
5877
|
+
ee || (on = !1, Bt(), le(), Se(
|
|
5878
5878
|
"web-sdk.widget",
|
|
5879
5879
|
"Failed to connect Product Agent widget",
|
|
5880
5880
|
{
|
|
@@ -5884,8 +5884,8 @@ async function Qu(t = {}) {
|
|
|
5884
5884
|
}
|
|
5885
5885
|
));
|
|
5886
5886
|
}, $n = (a) => {
|
|
5887
|
-
Ze !== null && window.clearTimeout(Ze),
|
|
5888
|
-
|
|
5887
|
+
Ze !== null && window.clearTimeout(Ze), ne.textContent = a, ne.hidden = !1, Ze = window.setTimeout(() => {
|
|
5888
|
+
ne.textContent = "", ne.hidden = !0, Ze = null;
|
|
5889
5889
|
}, 3e3);
|
|
5890
5890
|
}, Uo = (a) => {
|
|
5891
5891
|
fg(
|
|
@@ -5905,7 +5905,7 @@ async function Qu(t = {}) {
|
|
|
5905
5905
|
Rn = !1, le();
|
|
5906
5906
|
});
|
|
5907
5907
|
}, jn = () => {
|
|
5908
|
-
if (
|
|
5908
|
+
if (ee || !Qt || I.getState().status !== "connected" || zt() || Pe(e.billingStatus))
|
|
5909
5909
|
return;
|
|
5910
5910
|
const a = Qt;
|
|
5911
5911
|
Qt = null, Uo(a);
|
|
@@ -5918,18 +5918,18 @@ async function Qu(t = {}) {
|
|
|
5918
5918
|
ue = ue.filter(
|
|
5919
5919
|
(H) => !v.has(H)
|
|
5920
5920
|
), C.value === a && (C.value = "", C.style.height = "22px", C.style.overflowY = "hidden", C.dispatchEvent(new Event("input", { bubbles: !0 }))), en(), le();
|
|
5921
|
-
const
|
|
5921
|
+
const P = {
|
|
5922
5922
|
inputValue: a,
|
|
5923
5923
|
value: g,
|
|
5924
5924
|
attachments: w
|
|
5925
5925
|
};
|
|
5926
5926
|
if (Ji()) {
|
|
5927
|
-
Qt =
|
|
5927
|
+
Qt = P;
|
|
5928
5928
|
return;
|
|
5929
5929
|
}
|
|
5930
|
-
Uo(
|
|
5930
|
+
Uo(P);
|
|
5931
5931
|
};
|
|
5932
|
-
|
|
5932
|
+
Q.addEventListener("submit", (a) => {
|
|
5933
5933
|
if (a.preventDefault(), e.loginRequired) {
|
|
5934
5934
|
e.onLoginClick?.();
|
|
5935
5935
|
return;
|
|
@@ -5938,13 +5938,13 @@ async function Qu(t = {}) {
|
|
|
5938
5938
|
e.onSignupClick?.();
|
|
5939
5939
|
return;
|
|
5940
5940
|
}
|
|
5941
|
-
Hn() || Pe(e.billingStatus) || (
|
|
5941
|
+
Hn() || Pe(e.billingStatus) || (gt = !0, Oe(!0, "send"), qe(), es());
|
|
5942
5942
|
});
|
|
5943
5943
|
let hn = 0;
|
|
5944
|
-
const
|
|
5944
|
+
const ft = () => {
|
|
5945
5945
|
hn = 0, r.classList.remove("pluno-pa-widget--drag-over");
|
|
5946
5946
|
}, xl = () => {
|
|
5947
|
-
Ze !== null && (window.clearTimeout(Ze), Ze = null),
|
|
5947
|
+
Ze !== null && (window.clearTimeout(Ze), Ze = null), ne.textContent = "", ne.hidden = !0;
|
|
5948
5948
|
}, ts = async (a) => {
|
|
5949
5949
|
if (!e.attachmentsEnabled || a.length === 0)
|
|
5950
5950
|
return;
|
|
@@ -5957,12 +5957,12 @@ async function Qu(t = {}) {
|
|
|
5957
5957
|
Be("", !0, !0, !0, "attachment_drop");
|
|
5958
5958
|
return;
|
|
5959
5959
|
}
|
|
5960
|
-
|
|
5960
|
+
ct("attachment_added");
|
|
5961
5961
|
}, Il = async (a) => {
|
|
5962
|
-
await ts(a), !(a.length === 0 || Qe !== null) &&
|
|
5962
|
+
await ts(a), !(a.length === 0 || Qe !== null) && pt(C, "attachment_picker_completed");
|
|
5963
5963
|
};
|
|
5964
5964
|
xe.addEventListener("click", () => {
|
|
5965
|
-
e.loginRequired ||
|
|
5965
|
+
e.loginRequired || mt() || Pe(e.billingStatus) || ie.click();
|
|
5966
5966
|
}), ie.addEventListener("change", () => {
|
|
5967
5967
|
const a = Array.from(ie.files ?? []);
|
|
5968
5968
|
ie.value = "", Il(a).catch((g) => {
|
|
@@ -5973,23 +5973,23 @@ async function Qu(t = {}) {
|
|
|
5973
5973
|
});
|
|
5974
5974
|
});
|
|
5975
5975
|
}), r.addEventListener("dragenter", (a) => {
|
|
5976
|
-
!e.attachmentsEnabled || !di(a.dataTransfer) || e.loginRequired ||
|
|
5976
|
+
!e.attachmentsEnabled || !di(a.dataTransfer) || e.loginRequired || mt() || (a.preventDefault(), a.stopPropagation(), hn += 1, r.classList.add("pluno-pa-widget--drag-over"));
|
|
5977
5977
|
}), r.addEventListener("dragover", (a) => {
|
|
5978
5978
|
const g = a.dataTransfer;
|
|
5979
|
-
!e.attachmentsEnabled || !di(g) || e.loginRequired ||
|
|
5979
|
+
!e.attachmentsEnabled || !di(g) || e.loginRequired || mt() || (a.preventDefault(), a.stopPropagation(), g.dropEffect = "copy");
|
|
5980
5980
|
}), r.addEventListener("dragleave", (a) => {
|
|
5981
5981
|
di(a.dataTransfer) && (a.stopPropagation(), hn = Math.max(0, hn - 1), hn === 0 && r.classList.remove("pluno-pa-widget--drag-over"));
|
|
5982
5982
|
});
|
|
5983
5983
|
const No = (a) => {
|
|
5984
|
-
r.classList.contains("pluno-pa-widget--drag-over") && !a.composedPath().includes(r) &&
|
|
5984
|
+
r.classList.contains("pluno-pa-widget--drag-over") && !a.composedPath().includes(r) && ft();
|
|
5985
5985
|
};
|
|
5986
5986
|
m.addEventListener(
|
|
5987
5987
|
"dragover",
|
|
5988
5988
|
No,
|
|
5989
5989
|
!0
|
|
5990
|
-
), m.addEventListener("drop",
|
|
5990
|
+
), m.addEventListener("drop", ft, !0), m.addEventListener("dragend", ft, !0), m.defaultView?.addEventListener("blur", ft), r.addEventListener("drop", (a) => {
|
|
5991
5991
|
const g = a.dataTransfer;
|
|
5992
|
-
!e.attachmentsEnabled || !di(g) || e.loginRequired ||
|
|
5992
|
+
!e.attachmentsEnabled || !di(g) || e.loginRequired || mt() || (a.preventDefault(), a.stopPropagation(), ft(), ts(g.files).catch((w) => {
|
|
5993
5993
|
$n(
|
|
5994
5994
|
w instanceof Error ? w.message : "Failed to attach file"
|
|
5995
5995
|
), Se("web-sdk.widget", "Attachment failed", {
|
|
@@ -5999,7 +5999,7 @@ async function Qu(t = {}) {
|
|
|
5999
5999
|
}), r.addEventListener("paste", (a) => {
|
|
6000
6000
|
a.stopPropagation();
|
|
6001
6001
|
const g = a.clipboardData, w = Array.from(g?.files ?? []);
|
|
6002
|
-
!e.attachmentsEnabled || w.length === 0 || e.loginRequired ||
|
|
6002
|
+
!e.attachmentsEnabled || w.length === 0 || e.loginRequired || mt() || (a.preventDefault(), ts(w).catch((v) => {
|
|
6003
6003
|
$n(
|
|
6004
6004
|
v instanceof Error ? v.message : "Failed to attach file"
|
|
6005
6005
|
), Se("web-sdk.widget", "Attachment failed", {
|
|
@@ -6018,26 +6018,26 @@ async function Qu(t = {}) {
|
|
|
6018
6018
|
if (I.getState().pendingMessageStatus || Hn())
|
|
6019
6019
|
return;
|
|
6020
6020
|
const a = C.value.trim().length > 0 || ue.length > 0;
|
|
6021
|
-
|
|
6021
|
+
gt = !0, Oe(!0, "send"), qe(), es(), Y(I.getState()), le(), a && ct("send_button_submit");
|
|
6022
6022
|
}), me.addEventListener("click", () => {
|
|
6023
|
-
_e = !_e, kt = null, ze(), _e && $e.length === 0 && !Ee && !Un && xo(), _e ||
|
|
6023
|
+
_e = !_e, kt = null, ze(), _e && $e.length === 0 && !Ee && !Un && xo(), _e || ct("history_closed");
|
|
6024
6024
|
}), Ue.addEventListener("click", () => {
|
|
6025
|
-
_e = !1, ze(),
|
|
6025
|
+
_e = !1, ze(), ct("history_closed");
|
|
6026
6026
|
}), se.addEventListener("scroll", ml), C.addEventListener("input", () => {
|
|
6027
|
-
C.value.trim() && Mo("composer_input"), Sn(C),
|
|
6027
|
+
C.value.trim() && Mo("composer_input"), Sn(C), te(), le(), kl();
|
|
6028
6028
|
}), C.addEventListener("keydown", (a) => {
|
|
6029
6029
|
if (!(a.key !== "Enter" || a.shiftKey)) {
|
|
6030
6030
|
if (a.preventDefault(), e.loginRequired) {
|
|
6031
6031
|
e.onLoginClick?.();
|
|
6032
6032
|
return;
|
|
6033
6033
|
}
|
|
6034
|
-
Hn() || (
|
|
6034
|
+
Hn() || (gt = !0, Oe(!0, "send"), qe(), es(), Y(I.getState()), le());
|
|
6035
6035
|
}
|
|
6036
6036
|
}), r.addEventListener("click", (a) => {
|
|
6037
6037
|
const g = a.target instanceof Element ? a.target : null;
|
|
6038
|
-
g?.closest("a[href]") &&
|
|
6039
|
-
const v = window.getSelection(),
|
|
6040
|
-
lu(a.target, a.detail,
|
|
6038
|
+
g?.closest("a[href]") && te(), _e && pu(g, Ye, me) && (_e = !1, ze());
|
|
6039
|
+
const v = window.getSelection(), P = !!(v && !v.isCollapsed && v.anchorNode && r.contains(v.anchorNode));
|
|
6040
|
+
lu(a.target, a.detail, P) && ct("passive_surface_click");
|
|
6041
6041
|
}), r.addEventListener("copy", (a) => {
|
|
6042
6042
|
a.clipboardData && window.getSelection() && !window.getSelection()?.isCollapsed && window.getSelection()?.anchorNode && window.getSelection()?.focusNode && r.contains(window.getSelection()?.anchorNode ?? null) && r.contains(window.getSelection()?.focusNode ?? null) && window.getSelection()?.toString() && (a.clipboardData.clearData(), a.clipboardData.setData(
|
|
6043
6043
|
"text/plain",
|
|
@@ -6062,14 +6062,14 @@ async function Qu(t = {}) {
|
|
|
6062
6062
|
tl(a), a.stopPropagation();
|
|
6063
6063
|
return;
|
|
6064
6064
|
}
|
|
6065
|
-
a.key !== "Escape" || !_e || (_e = !1, ze(),
|
|
6065
|
+
a.key !== "Escape" || !_e || (_e = !1, ze(), ct("history_escape"));
|
|
6066
6066
|
}), d.composerValue && (C.value = d.composerValue, Sn(C)), e.layout === "page" ? Be(C.value, !1, !0, !1, "external_request") : c === "minimized" ? ln("minimized", !1) : e.initialDisplayState === void 0 && d.isOpen && Be(C.value, !1, !1, !1, "restored_state"), bg(
|
|
6067
6067
|
d,
|
|
6068
6068
|
r,
|
|
6069
6069
|
_,
|
|
6070
6070
|
C,
|
|
6071
6071
|
(a, g, w) => {
|
|
6072
|
-
|
|
6072
|
+
pt(a, "persisted_focus_restore", {
|
|
6073
6073
|
preventScroll: !0,
|
|
6074
6074
|
persistedFocusAgeMs: g,
|
|
6075
6075
|
scheduledAt: w
|
|
@@ -6088,7 +6088,7 @@ async function Qu(t = {}) {
|
|
|
6088
6088
|
const a = I.getState();
|
|
6089
6089
|
return a.assistantDraft.trim().length > 0 && a.assistantDraftPhase !== "commentary";
|
|
6090
6090
|
}, Tl = async () => {
|
|
6091
|
-
if (!fn || !oe || Ht ||
|
|
6091
|
+
if (!fn || !oe || Ht || ee || !I.getState().isThinking || Yn())
|
|
6092
6092
|
return;
|
|
6093
6093
|
let a;
|
|
6094
6094
|
try {
|
|
@@ -6096,7 +6096,7 @@ async function Qu(t = {}) {
|
|
|
6096
6096
|
} catch {
|
|
6097
6097
|
return;
|
|
6098
6098
|
}
|
|
6099
|
-
a.enabled || a.neverSuggest || !I.getState().isThinking || Yn() || Ht ||
|
|
6099
|
+
a.enabled || a.neverSuggest || !I.getState().isThinking || Yn() || Ht || ee || (oe.hidden = !1);
|
|
6100
6100
|
};
|
|
6101
6101
|
k?.addEventListener("click", () => {
|
|
6102
6102
|
Ht = !0, Vn(), fn?.enable().catch(() => {
|
|
@@ -6110,10 +6110,10 @@ async function Qu(t = {}) {
|
|
|
6110
6110
|
const Xn = e.tabGroups;
|
|
6111
6111
|
let $t = !1;
|
|
6112
6112
|
const Jn = async () => {
|
|
6113
|
-
if (!Xn || !E || $t ||
|
|
6113
|
+
if (!Xn || !E || $t || ee)
|
|
6114
6114
|
return;
|
|
6115
6115
|
const a = await Xn.getState().catch(() => null);
|
|
6116
|
-
!a || $t ||
|
|
6116
|
+
!a || $t || ee || (E.hidden = !a.permissionNeeded);
|
|
6117
6117
|
};
|
|
6118
6118
|
Je?.addEventListener("click", () => {
|
|
6119
6119
|
$t = !0, E && (E.hidden = !0), Xn?.enable().catch(() => {
|
|
@@ -6149,11 +6149,11 @@ async function Qu(t = {}) {
|
|
|
6149
6149
|
}, Al = async (a) => {
|
|
6150
6150
|
await e.personalChannelConnectionHandler?.(a);
|
|
6151
6151
|
}, ei = (a = {}) => {
|
|
6152
|
-
|
|
6152
|
+
gt = !0, Oe(!0, "newSession"), qe(), _e = !1, ze(), I.startNewSession(a), pn = null, Wi.clear(), et.clear(), Qn.clear(), C.value = "", ue = [], en(), Sn(C), te(), le(), pt(C, "new_chat"), Y(I.getState());
|
|
6153
6153
|
};
|
|
6154
|
-
|
|
6154
|
+
dt?.addEventListener("click", () => {
|
|
6155
6155
|
const a = e.proactiveSuggestion;
|
|
6156
|
-
!a ||
|
|
6156
|
+
!a || mt() || (Fe = null, e.proactiveSuggestion = null, e.onProactiveSuggestionTaskStart?.(a.id), ei(), Be("", !0, !1, !0, "proactive_suggestion"), I.sendMessage(a.suggestedQuery));
|
|
6157
6157
|
}), fe?.addEventListener("click", () => {
|
|
6158
6158
|
const a = e.proactiveSuggestion ?? Fe;
|
|
6159
6159
|
if (!a)
|
|
@@ -6200,7 +6200,7 @@ async function Qu(t = {}) {
|
|
|
6200
6200
|
!1
|
|
6201
6201
|
), Gt.addEventListener("click", () => ei()), he.insertBefore(Gt, me));
|
|
6202
6202
|
}, Y = (a) => {
|
|
6203
|
-
if (qt(),
|
|
6203
|
+
if (qt(), ut !== null && (window.clearTimeout(ut), ut = null), ze(), ke(), lo(a.lastErrorCode) ? Wt = a.lastErrorCode : e.billingStatus?.creditsUsed !== null && !Pe(e.billingStatus) && (Wt = null), Zt(Wt), e.loginRequired) {
|
|
6204
6204
|
Zn.clear(), ss.clear(), Gr(
|
|
6205
6205
|
O,
|
|
6206
6206
|
V,
|
|
@@ -6228,8 +6228,8 @@ async function Qu(t = {}) {
|
|
|
6228
6228
|
}
|
|
6229
6229
|
const g = _g(a), w = g !== bo;
|
|
6230
6230
|
bo = g;
|
|
6231
|
-
const v =
|
|
6232
|
-
|
|
6231
|
+
const v = gt || xt.enabled;
|
|
6232
|
+
gt = !1, oh(
|
|
6233
6233
|
O,
|
|
6234
6234
|
Xe,
|
|
6235
6235
|
V,
|
|
@@ -6244,13 +6244,13 @@ async function Qu(t = {}) {
|
|
|
6244
6244
|
Wi,
|
|
6245
6245
|
Zn,
|
|
6246
6246
|
ss,
|
|
6247
|
-
|
|
6247
|
+
te,
|
|
6248
6248
|
Gn,
|
|
6249
6249
|
(U) => {
|
|
6250
|
-
|
|
6250
|
+
mt() || (zo(), gt = !0, Oe(!0, "send"), qe(), I.sendMessage(U));
|
|
6251
6251
|
},
|
|
6252
6252
|
() => {
|
|
6253
|
-
|
|
6253
|
+
gt = !0, Oe(!0, "send"), qe(), I.retryLastMessage();
|
|
6254
6254
|
},
|
|
6255
6255
|
e.morningReport,
|
|
6256
6256
|
() => {
|
|
@@ -6277,27 +6277,27 @@ async function Qu(t = {}) {
|
|
|
6277
6277
|
characterIconOptions: Gn(),
|
|
6278
6278
|
socialPostRewardsUrl: e.socialPostRewardsUrl,
|
|
6279
6279
|
onSeen: (U) => {
|
|
6280
|
-
vt.add(U.id),
|
|
6280
|
+
vt.add(U.id), te();
|
|
6281
6281
|
},
|
|
6282
6282
|
onReferralCopy: (U) => {
|
|
6283
6283
|
Ml(U);
|
|
6284
6284
|
},
|
|
6285
6285
|
onSocialShare: (U) => {
|
|
6286
|
-
vt.add(U.id), nn.add(U.id),
|
|
6286
|
+
vt.add(U.id), nn.add(U.id), te();
|
|
6287
6287
|
},
|
|
6288
6288
|
onDismiss: (U) => {
|
|
6289
|
-
vt.add(U.id), nn.add(U.id),
|
|
6289
|
+
vt.add(U.id), nn.add(U.id), te(), mn = null, Y(I.getState());
|
|
6290
6290
|
},
|
|
6291
6291
|
onDisable: (U) => {
|
|
6292
|
-
sn = !0, vt.add(U.id), nn.add(U.id),
|
|
6292
|
+
sn = !0, vt.add(U.id), nn.add(U.id), te(), Hh(e, !0), mn = null, Y(I.getState());
|
|
6293
6293
|
}
|
|
6294
6294
|
} : void 0,
|
|
6295
6295
|
e.proactiveSuggestion !== null || Fe !== null
|
|
6296
6296
|
), ke();
|
|
6297
|
-
const
|
|
6298
|
-
H !== null && (
|
|
6297
|
+
const P = a.messages.map((U) => U.scheduledCheckInAt).filter((U) => !!U).filter((U) => bi(U) !== null).sort((U, Ge) => Date.parse(U) - Date.parse(Ge))[0] ?? null, H = P ? dd(P) : null;
|
|
6298
|
+
H !== null && (ut = window.setTimeout(
|
|
6299
6299
|
() => {
|
|
6300
|
-
|
|
6300
|
+
ut = null, ee || Y(I.getState());
|
|
6301
6301
|
},
|
|
6302
6302
|
Math.min(H, 2147483647)
|
|
6303
6303
|
)), v ? (It = O.scrollTop, qe()) : w && Sg(a) && gl();
|
|
@@ -6331,14 +6331,14 @@ async function Qu(t = {}) {
|
|
|
6331
6331
|
} finally {
|
|
6332
6332
|
Qn.delete(w.authRequestId);
|
|
6333
6333
|
}
|
|
6334
|
-
|
|
6334
|
+
ee || Y(I.getState());
|
|
6335
6335
|
}
|
|
6336
6336
|
})
|
|
6337
6337
|
);
|
|
6338
6338
|
};
|
|
6339
6339
|
qo = nu(
|
|
6340
6340
|
(a) => {
|
|
6341
|
-
jt = a, !
|
|
6341
|
+
jt = a, !ee && Cs(I.getState(), os()) && Y(I.getState());
|
|
6342
6342
|
},
|
|
6343
6343
|
{
|
|
6344
6344
|
backendUrl: e.backendUrl,
|
|
@@ -6353,8 +6353,8 @@ async function Qu(t = {}) {
|
|
|
6353
6353
|
a.taskStatus ? Ln?.setStatus(a.taskStatus) : Ln?.clear(), a.status === "connected" && (Xi = !0, Qt && queueMicrotask(() => {
|
|
6354
6354
|
jn();
|
|
6355
6355
|
})), Jn();
|
|
6356
|
-
const g = is && !a.isThinking, w = yo !== location.origin || _o !== a.sessionId || So !== (a.user?.id ?? null), v = is !== a.isThinking,
|
|
6357
|
-
yo = location.origin, _o = a.sessionId, So = a.user?.id ?? null, Hi = a.status, is = a.isThinking, H && (Ae !== null && (window.clearTimeout(Ae), Ae = null), Et += 1, Ee = !1, $e = [], rn = null, kt = null, Un = !1, ze()), r.classList.contains("pluno-pa-widget--open") && a.status === "connected" && (w || v ||
|
|
6356
|
+
const g = is && !a.isThinking, w = yo !== location.origin || _o !== a.sessionId || So !== (a.user?.id ?? null), v = is !== a.isThinking, P = Hi !== "connected" && a.status === "connected", H = Hi === "connected" && a.status !== "connected";
|
|
6357
|
+
yo = location.origin, _o = a.sessionId, So = a.user?.id ?? null, Hi = a.status, is = a.isThinking, H && (Ae !== null && (window.clearTimeout(Ae), Ae = null), Et += 1, Ee = !1, $e = [], rn = null, kt = null, Un = !1, ze()), r.classList.contains("pluno-pa-widget--open") && a.status === "connected" && (w || v || P) && On(), a.isThinking && !Yn() && fn && !Ht && Ft === null && oe?.hidden !== !1 && (Ft = window.setTimeout(() => {
|
|
6358
6358
|
Ft = null, Tl();
|
|
6359
6359
|
}, yu)), (!a.isThinking || Yn()) && (Oo(), Vn()), g && !r.classList.contains("pluno-pa-widget--open") && (gn = !0), Zi(), a.appearance ? (ns = !0, Se(
|
|
6360
6360
|
"web-sdk.widget",
|
|
@@ -6374,7 +6374,7 @@ async function Qu(t = {}) {
|
|
|
6374
6374
|
});
|
|
6375
6375
|
const ti = I.getState();
|
|
6376
6376
|
return ti.taskStatus && Ln?.setStatus(ti.taskStatus), Y(ti), sn || Promise.resolve(Fh(e)).then((a) => {
|
|
6377
|
-
!a ||
|
|
6377
|
+
!a || ee || (sn = !0, te(), Y(I.getState()));
|
|
6378
6378
|
}).catch(() => {
|
|
6379
6379
|
}), Wo(ti), le(), Qi(), {
|
|
6380
6380
|
agent: I,
|
|
@@ -6415,7 +6415,7 @@ async function Qu(t = {}) {
|
|
|
6415
6415
|
a && (Fe = null, ce = "idle", Ce && (Ce.value = "")), e.proactiveSuggestion = a ?? null, ke();
|
|
6416
6416
|
},
|
|
6417
6417
|
destroy: () => {
|
|
6418
|
-
|
|
6418
|
+
ee || (te(), ee = !0, To.disconnect(), m.removeEventListener(
|
|
6419
6419
|
"selectionchange",
|
|
6420
6420
|
Bo
|
|
6421
6421
|
), m.removeEventListener("pointerdown", wo, !0), Do?.disconnect(), vl(), m.defaultView?.removeEventListener(
|
|
@@ -6434,10 +6434,10 @@ async function Qu(t = {}) {
|
|
|
6434
6434
|
"dragover",
|
|
6435
6435
|
No,
|
|
6436
6436
|
!0
|
|
6437
|
-
), m.removeEventListener("drop",
|
|
6437
|
+
), m.removeEventListener("drop", ft, !0), m.removeEventListener("dragend", ft, !0), m.defaultView?.removeEventListener(
|
|
6438
6438
|
"blur",
|
|
6439
|
-
|
|
6440
|
-
), window.removeEventListener("resize", Co), ko(), bl(), yl(), Ze !== null && window.clearTimeout(Ze), Ae !== null && (window.clearTimeout(Ae), Ae = null), Tt !== null && (window.clearTimeout(Tt), Tt = null),
|
|
6439
|
+
ft
|
|
6440
|
+
), window.removeEventListener("resize", Co), ko(), bl(), yl(), Ze !== null && window.clearTimeout(Ze), Ae !== null && (window.clearTimeout(Ae), Ae = null), Tt !== null && (window.clearTimeout(Tt), Tt = null), ut !== null && (window.clearTimeout(ut), ut = null), Oo(), qo(), Ln?.clear(), I.destroy(), Bi.release(), s.remove());
|
|
6441
6441
|
}
|
|
6442
6442
|
};
|
|
6443
6443
|
async function Ml(a) {
|
|
@@ -6449,7 +6449,7 @@ async function Qu(t = {}) {
|
|
|
6449
6449
|
const g = await e.referralLinkLoader();
|
|
6450
6450
|
if (!g)
|
|
6451
6451
|
throw new Error("Pluno did not return a referral link.");
|
|
6452
|
-
await Pl(g), vt.add(a.id), nn.add(a.id),
|
|
6452
|
+
await Pl(g), vt.add(a.id), nn.add(a.id), te();
|
|
6453
6453
|
} catch (g) {
|
|
6454
6454
|
mn = g instanceof Error ? g.message : "Could not copy referral link.";
|
|
6455
6455
|
} finally {
|
|
@@ -6470,27 +6470,27 @@ async function Qu(t = {}) {
|
|
|
6470
6470
|
if (v.select(), v.setSelectionRange(0, a.length), !document.execCommand("copy"))
|
|
6471
6471
|
throw new Error("Could not copy referral link.");
|
|
6472
6472
|
} finally {
|
|
6473
|
-
v.remove(), w?.isConnected &&
|
|
6473
|
+
v.remove(), w?.isConnected && pt(w, "referral_copy_restore", {
|
|
6474
6474
|
preventScroll: !0
|
|
6475
6475
|
});
|
|
6476
6476
|
}
|
|
6477
6477
|
}
|
|
6478
6478
|
function as(a, g) {
|
|
6479
|
-
const w = a.accentColor ?? e.accentColor, v = a.colorScheme ?? e.colorScheme,
|
|
6479
|
+
const w = a.accentColor ?? e.accentColor, v = a.colorScheme ?? e.colorScheme, P = a.fontFamily ?? e.fontFamily, H = a.scribbleStyle ?? e.scribbleStyle;
|
|
6480
6480
|
l = Rr(
|
|
6481
6481
|
w,
|
|
6482
6482
|
H
|
|
6483
6483
|
), Lr(r, l, {
|
|
6484
6484
|
accentColor: w,
|
|
6485
6485
|
colorScheme: v,
|
|
6486
|
-
fontFamily:
|
|
6486
|
+
fontFamily: P,
|
|
6487
6487
|
scribbleStyle: H
|
|
6488
6488
|
}), Se("web-sdk.widget", "Updated widget appearance", {
|
|
6489
6489
|
source: g,
|
|
6490
6490
|
inputAppearance: a,
|
|
6491
6491
|
appliedAccentColor: w,
|
|
6492
6492
|
appliedColorScheme: v,
|
|
6493
|
-
appliedFontFamily:
|
|
6493
|
+
appliedFontFamily: P,
|
|
6494
6494
|
appliedScribbleStyle: H,
|
|
6495
6495
|
cssAccent: r.style.getPropertyValue("--pluno-pa-accent")
|
|
6496
6496
|
});
|
|
@@ -6540,7 +6540,7 @@ function Lr(t, e, n) {
|
|
|
6540
6540
|
);
|
|
6541
6541
|
for (const o of s)
|
|
6542
6542
|
o.replaceWith(
|
|
6543
|
-
|
|
6543
|
+
lt(
|
|
6544
6544
|
Array.from(o.classList).join(" "),
|
|
6545
6545
|
e
|
|
6546
6546
|
)
|
|
@@ -6575,8 +6575,8 @@ function sg({
|
|
|
6575
6575
|
if (r !== _.pointerId || !l || !d)
|
|
6576
6576
|
return;
|
|
6577
6577
|
_.preventDefault();
|
|
6578
|
-
const T = _.clientX - l.x,
|
|
6579
|
-
!c && Math.hypot(T,
|
|
6578
|
+
const T = _.clientX - l.x, R = _.clientY - l.y;
|
|
6579
|
+
!c && Math.hypot(T, R) < ki || (c = !0, t.classList.add("pluno-pa-widget--dragging"), s({ x: d.x + T, y: d.y + R }));
|
|
6580
6580
|
}, b = (_) => {
|
|
6581
6581
|
r === _.pointerId && (_.preventDefault(), _.stopPropagation(), c && (u = { x: _.clientX, y: _.clientY }, o()), p());
|
|
6582
6582
|
}, m = (_) => {
|
|
@@ -6592,9 +6592,9 @@ function sg({
|
|
|
6592
6592
|
}, x = (_) => {
|
|
6593
6593
|
if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
|
|
6594
6594
|
return;
|
|
6595
|
-
const T = _.shiftKey ? ro : oo,
|
|
6596
|
-
let
|
|
6597
|
-
_.key === "ArrowUp" ?
|
|
6595
|
+
const T = _.shiftKey ? ro : oo, R = i();
|
|
6596
|
+
let L = null;
|
|
6597
|
+
_.key === "ArrowUp" ? L = { x: R.x, y: R.y - T } : _.key === "ArrowDown" ? L = { x: R.x, y: R.y + T } : _.key === "ArrowLeft" ? L = { x: R.x - T, y: R.y } : _.key === "ArrowRight" && (L = { x: R.x + T, y: R.y }), L && (_.preventDefault(), _.stopPropagation(), s(L), o());
|
|
6598
6598
|
};
|
|
6599
6599
|
return e.addEventListener("pointerdown", h), e.addEventListener("pointermove", y), e.addEventListener("pointerup", b), e.addEventListener("pointercancel", m), e.addEventListener("click", f, !0), n.addEventListener("keydown", x), () => {
|
|
6600
6600
|
e.removeEventListener("pointerdown", h), e.removeEventListener("pointermove", y), e.removeEventListener("pointerup", b), e.removeEventListener("pointercancel", m), e.removeEventListener("click", f, !0), n.removeEventListener("keydown", x);
|
|
@@ -6657,9 +6657,9 @@ function rg({
|
|
|
6657
6657
|
}, b = (f) => {
|
|
6658
6658
|
o === f.pointerId && (f.preventDefault(), u());
|
|
6659
6659
|
}, m = (f) => {
|
|
6660
|
-
const _ = f.currentTarget.dataset.resizeDirection, T = f.shiftKey ? ro : oo,
|
|
6661
|
-
let
|
|
6662
|
-
Dr(_) && (f.key === "ArrowLeft" ?
|
|
6660
|
+
const _ = f.currentTarget.dataset.resizeDirection, T = f.shiftKey ? ro : oo, R = n();
|
|
6661
|
+
let L = 0, B = 0;
|
|
6662
|
+
Dr(_) && (f.key === "ArrowLeft" ? L = -T : f.key === "ArrowRight" ? L = T : f.key === "ArrowUp" ? B = -T : f.key === "ArrowDown" && (B = T), !(L === 0 && B === 0) && (f.preventDefault(), f.stopPropagation(), i(Ur(R, _, L, B)), s()));
|
|
6663
6663
|
};
|
|
6664
6664
|
for (const f of e)
|
|
6665
6665
|
f.addEventListener("pointerdown", p), f.addEventListener("pointermove", h), f.addEventListener("pointerup", y), f.addEventListener("pointercancel", b), f.addEventListener("keydown", m);
|
|
@@ -6931,7 +6931,7 @@ function vn(t, e) {
|
|
|
6931
6931
|
)
|
|
6932
6932
|
};
|
|
6933
6933
|
}
|
|
6934
|
-
function
|
|
6934
|
+
function wt(t, e) {
|
|
6935
6935
|
if (t.classList.toggle("pluno-pa-widget--custom-position", e !== null), t.classList.toggle(
|
|
6936
6936
|
"pluno-pa-widget--proactive-suggestion-left-aligned",
|
|
6937
6937
|
e !== null && e.x < be().width / 2
|
|
@@ -7094,7 +7094,7 @@ function Cg(t, e, n, i) {
|
|
|
7094
7094
|
10
|
|
7095
7095
|
)
|
|
7096
7096
|
), s.appendChild(
|
|
7097
|
-
|
|
7097
|
+
lt(
|
|
7098
7098
|
"pluno-pa-widget__character--launcher",
|
|
7099
7099
|
e
|
|
7100
7100
|
)
|
|
@@ -7138,21 +7138,21 @@ function kg(t, e) {
|
|
|
7138
7138
|
zg(),
|
|
7139
7139
|
!0
|
|
7140
7140
|
)
|
|
7141
|
-
), s.appendChild(c), s.appendChild(Rg()), n.appendChild(s), n.appendChild(Eg()), n.appendChild(Ag()), n.appendChild(Pg()), n.appendChild(
|
|
7142
|
-
|
|
7143
|
-
), n.appendChild(
|
|
7144
|
-
|
|
7141
|
+
), s.appendChild(c), s.appendChild(Rg()), n.appendChild(s), n.appendChild(Eg()), n.appendChild(Ag()), n.appendChild(Pg()), n.appendChild(bt("left", "Resize Pluno from left")), n.appendChild(
|
|
7142
|
+
bt("right", "Resize Pluno from right")
|
|
7143
|
+
), n.appendChild(bt("top", "Resize Pluno from top")), n.appendChild(
|
|
7144
|
+
bt("bottom", "Resize Pluno from bottom")
|
|
7145
7145
|
), n.appendChild(
|
|
7146
|
-
|
|
7146
|
+
bt("top-left", "Resize Pluno from top left")
|
|
7147
7147
|
), n.appendChild(
|
|
7148
|
-
|
|
7148
|
+
bt("top-right", "Resize Pluno from top right")
|
|
7149
7149
|
), n.appendChild(
|
|
7150
|
-
|
|
7150
|
+
bt("bottom-left", "Resize Pluno from bottom left")
|
|
7151
7151
|
), n.appendChild(
|
|
7152
|
-
|
|
7152
|
+
bt("bottom-right", "Resize Pluno from bottom right")
|
|
7153
7153
|
), n;
|
|
7154
7154
|
}
|
|
7155
|
-
function
|
|
7155
|
+
function bt(t, e) {
|
|
7156
7156
|
const n = document.createElement("button");
|
|
7157
7157
|
return n.type = "button", n.className = [
|
|
7158
7158
|
"pluno-pa-widget__resize-handle",
|
|
@@ -7287,7 +7287,7 @@ function Rg() {
|
|
|
7287
7287
|
function Lg(t) {
|
|
7288
7288
|
const e = document.createElement("div");
|
|
7289
7289
|
return e.className = "pluno-pa-widget__empty-state", e.appendChild(
|
|
7290
|
-
|
|
7290
|
+
lt(
|
|
7291
7291
|
"pluno-pa-widget__character--empty",
|
|
7292
7292
|
t
|
|
7293
7293
|
)
|
|
@@ -7309,7 +7309,7 @@ function Ka(t, e) {
|
|
|
7309
7309
|
)
|
|
7310
7310
|
);
|
|
7311
7311
|
}
|
|
7312
|
-
function
|
|
7312
|
+
function lt(t, e) {
|
|
7313
7313
|
const n = `pluno-pa-character-${Pr}`;
|
|
7314
7314
|
Pr += 1;
|
|
7315
7315
|
const i = e.scribbleStyle ? Ug(e.accentColor, n) : Dg(e.accentColor, n), s = t.split(/\s+/).filter(Boolean);
|
|
@@ -8266,22 +8266,22 @@ function Cs(t, e) {
|
|
|
8266
8266
|
(i) => !il(i)
|
|
8267
8267
|
).length === 0 && !t.assistantDraft && !t.lastError && !t.isThinking && !e;
|
|
8268
8268
|
}
|
|
8269
|
-
function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T,
|
|
8270
|
-
const
|
|
8269
|
+
function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, R, L, B, $, q, W = !1) {
|
|
8270
|
+
const Q = wh(o), ne = Q.flatMap((k) => {
|
|
8271
8271
|
const S = k.scheduledCheckInAt ? bi(k.scheduledCheckInAt) : null;
|
|
8272
|
-
return S && k.scheduledCheckInAt ? [{
|
|
8273
|
-
}).sort((k, S) => Date.parse(k.dueAt) - Date.parse(S.dueAt))
|
|
8274
|
-
|
|
8272
|
+
return S && k.scheduledCheckInAt ? [{ dueAt: k.scheduledCheckInAt, label: S }] : [];
|
|
8273
|
+
}).sort((k, S) => Date.parse(k.dueAt) - Date.parse(S.dueAt)), K = bh(
|
|
8274
|
+
Q.filter(
|
|
8275
8275
|
(k) => !il(k) && !k.scheduledCheckInAt
|
|
8276
8276
|
)
|
|
8277
8277
|
), de = t.scrollTop, ie = [], xe = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set(), M = (k) => {
|
|
8278
8278
|
ie.push(k);
|
|
8279
8279
|
};
|
|
8280
8280
|
rl(n, o.isThinking), n.disabled = o.pendingMessageStatus !== null, s.hidden = !d, d && l !== null && Ka(s, l);
|
|
8281
|
-
const
|
|
8282
|
-
if (i(
|
|
8281
|
+
const X = K.length > 0 || !!o.assistantDraft || o.pendingMessageStatus !== null || o.isThinking;
|
|
8282
|
+
if (i(X), o.isLoadingSession) {
|
|
8283
8283
|
const k = document.createElement("div");
|
|
8284
|
-
k.className = "pluno-pa-widget__transcript-loading", k.setAttribute("role", "status"), k.textContent = "Loading chat...", h.clear(), y.clear(), M(k), M(e),
|
|
8284
|
+
k.className = "pluno-pa-widget__transcript-loading", k.setAttribute("role", "status"), k.textContent = "Loading chat...", h.clear(), y.clear(), M(k), M(e), yt(t, ie);
|
|
8285
8285
|
return;
|
|
8286
8286
|
}
|
|
8287
8287
|
if (_ || K.length === 0 && !o.assistantDraft && !o.lastError && !o.pendingMessageStatus && !o.isThinking) {
|
|
@@ -8289,7 +8289,7 @@ function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, L, D, B,
|
|
|
8289
8289
|
k.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (_ ? " pluno-pa-widget__empty-state--morning-report" : "");
|
|
8290
8290
|
const S = document.createElement("div");
|
|
8291
8291
|
S.className = "pluno-pa-widget__empty-hero";
|
|
8292
|
-
const z =
|
|
8292
|
+
const z = lt(
|
|
8293
8293
|
"pluno-pa-widget__character--empty",
|
|
8294
8294
|
m()
|
|
8295
8295
|
);
|
|
@@ -8304,20 +8304,20 @@ function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, L, D, B,
|
|
|
8304
8304
|
} else {
|
|
8305
8305
|
const E = _?.prompts ?? o.starterPrompts, Je = E.length === 0 && r, pe = document.createElement("div");
|
|
8306
8306
|
if (pe.className = E.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", E.length === 0 && !o.starterPromptsLoading && !Je && pe.setAttribute("aria-hidden", "true"), E.length > 0)
|
|
8307
|
-
for (const
|
|
8307
|
+
for (const D of E) {
|
|
8308
8308
|
const j = document.createElement("button");
|
|
8309
|
-
j.type = "button", j.className = "pluno-pa-widget__starter-prompt", j.textContent = `"${
|
|
8310
|
-
f(
|
|
8309
|
+
j.type = "button", j.className = "pluno-pa-widget__starter-prompt", j.textContent = `"${D}"`, j.addEventListener("click", () => {
|
|
8310
|
+
f(D);
|
|
8311
8311
|
}), pe.appendChild(j);
|
|
8312
8312
|
}
|
|
8313
8313
|
else if (Je) {
|
|
8314
|
-
const
|
|
8315
|
-
|
|
8314
|
+
const D = document.createElement("button");
|
|
8315
|
+
D.type = "button", D.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", D.disabled = !0, D.tabIndex = -1, D.textContent = "Connecting...", pe.appendChild(D);
|
|
8316
8316
|
} else if (o.starterPromptsLoading) {
|
|
8317
|
-
const
|
|
8318
|
-
|
|
8317
|
+
const D = document.createElement("button");
|
|
8318
|
+
D.type = "button", D.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", D.disabled = !0, D.tabIndex = -1, D.textContent = "Finding example tasks...", pe.appendChild(D);
|
|
8319
8319
|
} else
|
|
8320
|
-
for (let
|
|
8320
|
+
for (let D = 0; D < Du; D += 1) {
|
|
8321
8321
|
const j = document.createElement("button");
|
|
8322
8322
|
j.type = "button", j.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", j.disabled = !0, j.tabIndex = -1, j.textContent = "", pe.appendChild(j);
|
|
8323
8323
|
}
|
|
@@ -8327,7 +8327,7 @@ function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, L, D, B,
|
|
|
8327
8327
|
const E = document.createElement("button");
|
|
8328
8328
|
E.type = "button", E.className = "pluno-pa-widget__morning-report-snooze", E.textContent = "Snooze morning report", E.addEventListener("click", T), k.appendChild(E);
|
|
8329
8329
|
}
|
|
8330
|
-
h.clear(), y.clear(), M(k), M(e),
|
|
8330
|
+
h.clear(), y.clear(), M(k), M(e), yt(t, ie);
|
|
8331
8331
|
return;
|
|
8332
8332
|
}
|
|
8333
8333
|
let F = null, V = null, he = [], me = [];
|
|
@@ -8358,7 +8358,7 @@ function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, L, D, B,
|
|
|
8358
8358
|
for (let k = 0; k < K.length; k += 1) {
|
|
8359
8359
|
const S = K[k];
|
|
8360
8360
|
if (S.role === "tool" && S.integrationAuthRequest && B) {
|
|
8361
|
-
const
|
|
8361
|
+
const D = rh(
|
|
8362
8362
|
S.integrationAuthRequest,
|
|
8363
8363
|
B.states.get(
|
|
8364
8364
|
S.integrationAuthRequest.authRequestId
|
|
@@ -8367,7 +8367,7 @@ function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, L, D, B,
|
|
|
8367
8367
|
},
|
|
8368
8368
|
B.onConnect
|
|
8369
8369
|
);
|
|
8370
|
-
me.push(
|
|
8370
|
+
me.push(D);
|
|
8371
8371
|
continue;
|
|
8372
8372
|
}
|
|
8373
8373
|
if (S.role === "tool" && S.personalChannelConnectionRequest && $) {
|
|
@@ -8380,7 +8380,7 @@ function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, L, D, B,
|
|
|
8380
8380
|
continue;
|
|
8381
8381
|
}
|
|
8382
8382
|
if (S.role === "tool") {
|
|
8383
|
-
he.length > 0 && !
|
|
8383
|
+
he.length > 0 && !St(he[0], S) && ye(), he.push(S);
|
|
8384
8384
|
continue;
|
|
8385
8385
|
}
|
|
8386
8386
|
if (S.role === "system" && S.dataType === "run_status" && S.steered === !0) {
|
|
@@ -8409,47 +8409,40 @@ function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, L, D, B,
|
|
|
8409
8409
|
}
|
|
8410
8410
|
if (S.role === "system") {
|
|
8411
8411
|
if (S.dataType === "run_error" || S.dataType === "run_status") {
|
|
8412
|
-
const
|
|
8413
|
-
(fe) => fe.role === "tool" &&
|
|
8412
|
+
const D = ye(), j = K.some(
|
|
8413
|
+
(fe) => fe.role === "tool" && St(fe, S)
|
|
8414
8414
|
);
|
|
8415
|
-
if (!
|
|
8415
|
+
if (!D && !j) {
|
|
8416
8416
|
const fe = kn(m());
|
|
8417
8417
|
fe.classList.add("pluno-pa-widget__terminal-marker"), M(fe);
|
|
8418
8418
|
}
|
|
8419
|
-
const
|
|
8420
|
-
if (
|
|
8419
|
+
const dt = document.createElement("div"), Ot = S.dataType === "run_error";
|
|
8420
|
+
if (dt.className = Ot ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", dt.textContent = Mi(
|
|
8421
8421
|
S.content
|
|
8422
8422
|
), Ot && S.securitySettingsUrl) {
|
|
8423
8423
|
const fe = document.createElement("a");
|
|
8424
|
-
fe.className = "pluno-pa-widget__error-retry", fe.href = S.securitySettingsUrl, fe.target = "_blank", fe.rel = "noreferrer", fe.textContent = "Security settings",
|
|
8424
|
+
fe.className = "pluno-pa-widget__error-retry", fe.href = S.securitySettingsUrl, fe.target = "_blank", fe.rel = "noreferrer", fe.textContent = "Security settings", dt.appendChild(fe);
|
|
8425
8425
|
}
|
|
8426
|
-
M(
|
|
8426
|
+
M(dt), F = Ot ? dt : null, V = Ot ? null : dt, Te();
|
|
8427
8427
|
}
|
|
8428
8428
|
continue;
|
|
8429
8429
|
}
|
|
8430
8430
|
S.role === "user" && Te();
|
|
8431
8431
|
const z = ye(), E = Mi(S.content), Je = S.role === "assistant" && K.some(
|
|
8432
|
-
(
|
|
8432
|
+
(D) => D.role === "tool" && St(D, S)
|
|
8433
8433
|
);
|
|
8434
8434
|
if (S.role === "assistant" && !z && !Je) {
|
|
8435
|
-
const
|
|
8436
|
-
M(
|
|
8435
|
+
const D = kn(m());
|
|
8436
|
+
M(D), F = null, V = D;
|
|
8437
8437
|
}
|
|
8438
8438
|
const pe = lh(
|
|
8439
8439
|
S,
|
|
8440
8440
|
E,
|
|
8441
8441
|
h,
|
|
8442
8442
|
xe,
|
|
8443
|
-
|
|
8443
|
+
L
|
|
8444
8444
|
);
|
|
8445
|
-
|
|
8446
|
-
const P = document.createElement("div");
|
|
8447
|
-
P.className = "pluno-pa-widget__next-check-in", P.append(
|
|
8448
|
-
Bg(X.dueAt),
|
|
8449
|
-
document.createTextNode(X.label)
|
|
8450
|
-
), M(P), F = null, V = P;
|
|
8451
|
-
}
|
|
8452
|
-
S.role === "assistant" && Te();
|
|
8445
|
+
M(pe), F = pe, V = null, S.role === "assistant" && Te();
|
|
8453
8446
|
}
|
|
8454
8447
|
const O = ye(), Xe = K[K.length - 1]?.role === "assistant";
|
|
8455
8448
|
if (o.turnPhase && !o.assistantDraft && !se && !Xe && !Ye)
|
|
@@ -8476,12 +8469,12 @@ function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, L, D, B,
|
|
|
8476
8469
|
const E = document.createElement("button");
|
|
8477
8470
|
E.type = "button", E.className = "pluno-pa-widget__error-retry", E.textContent = "Try again", E.addEventListener(
|
|
8478
8471
|
"click",
|
|
8479
|
-
o.lastErrorCode === "connection_failed" ?
|
|
8472
|
+
o.lastErrorCode === "connection_failed" ? R : x
|
|
8480
8473
|
), S.appendChild(E);
|
|
8481
8474
|
}
|
|
8482
8475
|
k.appendChild(S), M(k), F = null, V = k;
|
|
8483
8476
|
}
|
|
8484
|
-
const oe = q ? q.actionCandidate ?? (o.isThinking ? null : Kc(
|
|
8477
|
+
const oe = q ? q.actionCandidate ?? (o.isThinking ? null : Kc(Q)) : null;
|
|
8485
8478
|
if (q && oe && !q.dismissedCandidateIds.has(oe.id)) {
|
|
8486
8479
|
const k = Ih(oe, {
|
|
8487
8480
|
isActing: q.actionCandidate?.id === oe.id,
|
|
@@ -8495,7 +8488,15 @@ function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, L, D, B,
|
|
|
8495
8488
|
});
|
|
8496
8489
|
M(k), q.onSeen(oe), F = null, V = k;
|
|
8497
8490
|
}
|
|
8498
|
-
Te()
|
|
8491
|
+
Te();
|
|
8492
|
+
for (const k of ne) {
|
|
8493
|
+
const S = document.createElement("div");
|
|
8494
|
+
S.className = "pluno-pa-widget__next-check-in", S.append(
|
|
8495
|
+
Bg(k.dueAt),
|
|
8496
|
+
document.createTextNode(k.label)
|
|
8497
|
+
), M(S), F = null, V = S;
|
|
8498
|
+
}
|
|
8499
|
+
F?.classList.add(
|
|
8499
8500
|
"pluno-pa-widget__message--bottom-reserve"
|
|
8500
8501
|
), V?.classList.add(
|
|
8501
8502
|
"pluno-pa-widget__bottom-reserve-compact"
|
|
@@ -8505,7 +8506,7 @@ function oh(t, e, n, i, s, o, r, l, d, c, u, p, h, y, b, m, f, x, _, T, L, D, B,
|
|
|
8505
8506
|
), fh(
|
|
8506
8507
|
y,
|
|
8507
8508
|
C
|
|
8508
|
-
),
|
|
8509
|
+
), yt(t, ie), c ? xn(t, u) : t.scrollTop = de;
|
|
8509
8510
|
}
|
|
8510
8511
|
function rh(t, e, n) {
|
|
8511
8512
|
const i = document.createElement("section");
|
|
@@ -8643,7 +8644,7 @@ function fh(t, e) {
|
|
|
8643
8644
|
for (const n of t.keys())
|
|
8644
8645
|
e.has(n) || t.delete(n);
|
|
8645
8646
|
}
|
|
8646
|
-
function
|
|
8647
|
+
function yt(t, e) {
|
|
8647
8648
|
let n = t.firstChild;
|
|
8648
8649
|
for (const i of e) {
|
|
8649
8650
|
if (i === n) {
|
|
@@ -8677,7 +8678,7 @@ function wh(t) {
|
|
|
8677
8678
|
if (!e.respondsToUserMessageId)
|
|
8678
8679
|
return [...t.messages, e];
|
|
8679
8680
|
const n = t.messages.findIndex(
|
|
8680
|
-
(o) =>
|
|
8681
|
+
(o) => St(o, e) && Ks(o)
|
|
8681
8682
|
);
|
|
8682
8683
|
if (n !== -1)
|
|
8683
8684
|
return [
|
|
@@ -8687,7 +8688,7 @@ function wh(t) {
|
|
|
8687
8688
|
];
|
|
8688
8689
|
let i = -1;
|
|
8689
8690
|
for (let o = t.messages.length - 1; o >= 0; o -= 1)
|
|
8690
|
-
if (
|
|
8691
|
+
if (St(t.messages[o], e)) {
|
|
8691
8692
|
i = o;
|
|
8692
8693
|
break;
|
|
8693
8694
|
}
|
|
@@ -8730,7 +8731,7 @@ function bh(t) {
|
|
|
8730
8731
|
), d = /* @__PURE__ */ new Map();
|
|
8731
8732
|
for (let p = 0; p < r.length; p += 1) {
|
|
8732
8733
|
const h = r[p], y = h.role === "tool" && l.some(
|
|
8733
|
-
(f) =>
|
|
8734
|
+
(f) => St(h, f)
|
|
8734
8735
|
) ? { ...h, steered: !0 } : h;
|
|
8735
8736
|
if (y.role !== "tool" || y.integrationAuthRequest || y.personalChannelConnectionRequest)
|
|
8736
8737
|
continue;
|
|
@@ -8741,7 +8742,7 @@ function bh(t) {
|
|
|
8741
8742
|
for (const p of r) {
|
|
8742
8743
|
if (p.role === "system" && p.dataType === "run_status" && p.steered === !0 && [...d.values()].some(
|
|
8743
8744
|
(y) => y.some(
|
|
8744
|
-
(b) =>
|
|
8745
|
+
(b) => St(b, p)
|
|
8745
8746
|
)
|
|
8746
8747
|
))
|
|
8747
8748
|
continue;
|
|
@@ -8756,7 +8757,7 @@ function bh(t) {
|
|
|
8756
8757
|
}
|
|
8757
8758
|
function jr(t, e, n) {
|
|
8758
8759
|
return !n || !t.respondsToUserMessageId || t.steered === !0 ? !1 : !e.some(
|
|
8759
|
-
(i) => (yh(i) || _h(i)) &&
|
|
8760
|
+
(i) => (yh(i) || _h(i)) && St(t, i)
|
|
8760
8761
|
);
|
|
8761
8762
|
}
|
|
8762
8763
|
function yh(t) {
|
|
@@ -8765,7 +8766,7 @@ function yh(t) {
|
|
|
8765
8766
|
function _h(t) {
|
|
8766
8767
|
return t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0);
|
|
8767
8768
|
}
|
|
8768
|
-
function
|
|
8769
|
+
function St(t, e) {
|
|
8769
8770
|
return t.respondsToUserMessageId && e.respondsToUserMessageId ? t.respondsToUserMessageId === e.respondsToUserMessageId : !!(t.runId && t.runId === e.runId);
|
|
8770
8771
|
}
|
|
8771
8772
|
function Gs(t) {
|
|
@@ -8778,7 +8779,7 @@ function Gr(t, e, n, i, s, o, r, l) {
|
|
|
8778
8779
|
t.replaceChildren(), rl(e, !1), e.disabled = !0, n(!1);
|
|
8779
8780
|
const d = document.createElement("div");
|
|
8780
8781
|
d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
8781
|
-
const c =
|
|
8782
|
+
const c = lt(
|
|
8782
8783
|
"pluno-pa-widget__character--empty",
|
|
8783
8784
|
i()
|
|
8784
8785
|
);
|
|
@@ -8819,7 +8820,7 @@ function Ih(t, e) {
|
|
|
8819
8820
|
i.className = "pluno-pa-widget__share-prompt";
|
|
8820
8821
|
const s = document.createElement("div");
|
|
8821
8822
|
s.className = "pluno-pa-widget__share-prompt-body", s.appendChild(
|
|
8822
|
-
|
|
8823
|
+
lt(
|
|
8823
8824
|
"pluno-pa-widget__share-prompt-icon",
|
|
8824
8825
|
e.characterIconOptions
|
|
8825
8826
|
)
|
|
@@ -8910,36 +8911,36 @@ function kh(t, e, n, i, s, o, r) {
|
|
|
8910
8911
|
t
|
|
8911
8912
|
);
|
|
8912
8913
|
if (!c) {
|
|
8913
|
-
const T = document.createElement("article"),
|
|
8914
|
+
const T = document.createElement("article"), R = lt(
|
|
8914
8915
|
"pluno-pa-widget__character--tool-group",
|
|
8915
8916
|
r
|
|
8916
|
-
),
|
|
8917
|
+
), L = JSON.stringify(r), B = document.createElement("div");
|
|
8917
8918
|
B.className = "pluno-pa-widget__tool-active-content";
|
|
8918
8919
|
const $ = En(), q = document.createElement("details"), W = document.createElement("summary");
|
|
8919
8920
|
W.className = "pluno-pa-widget__tool-summary";
|
|
8920
|
-
const
|
|
8921
|
-
|
|
8922
|
-
|
|
8921
|
+
const Q = document.createElement("div");
|
|
8922
|
+
Q.className = "pluno-pa-widget__tool-summary-title", W.appendChild(Q), W.addEventListener("click", () => {
|
|
8923
|
+
Q.textContent = q.open ? T.dataset.collapsedActivityTitle ?? "Activity" : "Activity";
|
|
8923
8924
|
}), q.appendChild(W);
|
|
8924
|
-
const
|
|
8925
|
-
|
|
8925
|
+
const ne = document.createElement("div");
|
|
8926
|
+
ne.className = "pluno-pa-widget__tool-lines", q.addEventListener("toggle", () => {
|
|
8926
8927
|
const K = T.dataset.responseGroupKey ?? d;
|
|
8927
|
-
T.classList.toggle("pluno-pa-widget__tool-group--open", q.open),
|
|
8928
|
+
T.classList.toggle("pluno-pa-widget__tool-group--open", q.open), Q.textContent = q.open ? "Activity" : T.dataset.collapsedActivityTitle ?? "Activity", q.open ? n.add(K) : n.delete(K), o();
|
|
8928
8929
|
}), c = {
|
|
8929
8930
|
node: T,
|
|
8930
|
-
character:
|
|
8931
|
-
characterSignature:
|
|
8931
|
+
character: R,
|
|
8932
|
+
characterSignature: L,
|
|
8932
8933
|
activeContent: B,
|
|
8933
8934
|
thinkingStatus: $,
|
|
8934
8935
|
details: q,
|
|
8935
8936
|
summary: W,
|
|
8936
|
-
summaryTitle:
|
|
8937
|
-
lines:
|
|
8937
|
+
summaryTitle: Q,
|
|
8938
|
+
lines: ne,
|
|
8938
8939
|
lineNodes: /* @__PURE__ */ new Map()
|
|
8939
8940
|
}, i.set(d, c);
|
|
8940
8941
|
}
|
|
8941
8942
|
const u = c, p = JSON.stringify(r);
|
|
8942
|
-
u.characterSignature !== p && (u.character =
|
|
8943
|
+
u.characterSignature !== p && (u.character = lt(
|
|
8943
8944
|
"pluno-pa-widget__character--tool-group",
|
|
8944
8945
|
r
|
|
8945
8946
|
), u.characterSignature = p);
|
|
@@ -8955,10 +8956,10 @@ function kh(t, e, n, i, s, o, r) {
|
|
|
8955
8956
|
);
|
|
8956
8957
|
if (e) {
|
|
8957
8958
|
const T = u.activeContent;
|
|
8958
|
-
return
|
|
8959
|
+
return yt(T, [
|
|
8959
8960
|
u.thinkingStatus,
|
|
8960
8961
|
y
|
|
8961
|
-
]),
|
|
8962
|
+
]), yt(h, [u.character, T]), h;
|
|
8962
8963
|
}
|
|
8963
8964
|
const b = u.details;
|
|
8964
8965
|
b.open = n.has(d), h.classList.toggle("pluno-pa-widget__tool-group--open", b.open);
|
|
@@ -8970,7 +8971,7 @@ function kh(t, e, n, i, s, o, r) {
|
|
|
8970
8971
|
), po(
|
|
8971
8972
|
u.summaryTitle,
|
|
8972
8973
|
b.open ? "Activity" : _
|
|
8973
|
-
),
|
|
8974
|
+
), yt(b, [u.summary, y]), yt(h, [u.character, b]), h;
|
|
8974
8975
|
}
|
|
8975
8976
|
function Eh(t, e, n, i) {
|
|
8976
8977
|
const s = [...t].reverse().find((l) => l.phase !== "commentary"), o = [], r = /* @__PURE__ */ new Set();
|
|
@@ -8986,7 +8987,7 @@ function Eh(t, e, n, i) {
|
|
|
8986
8987
|
}
|
|
8987
8988
|
for (const l of i.keys())
|
|
8988
8989
|
r.has(l) || i.delete(l);
|
|
8989
|
-
return
|
|
8990
|
+
return yt(n, o), n;
|
|
8990
8991
|
}
|
|
8991
8992
|
function Ah(t, e, n) {
|
|
8992
8993
|
const i = t.get(e);
|
|
@@ -9015,7 +9016,7 @@ function ol(t) {
|
|
|
9015
9016
|
function kn(t) {
|
|
9016
9017
|
const e = document.createElement("article");
|
|
9017
9018
|
return e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", e.appendChild(
|
|
9018
|
-
|
|
9019
|
+
lt(
|
|
9019
9020
|
"pluno-pa-widget__character--tool-group",
|
|
9020
9021
|
t
|
|
9021
9022
|
)
|
|
@@ -9082,7 +9083,7 @@ function Dh(t, e) {
|
|
|
9082
9083
|
const r = document.createElement("table"), l = document.createElement("thead"), d = document.createElement("tr");
|
|
9083
9084
|
n.forEach((p, h) => {
|
|
9084
9085
|
const y = document.createElement("th"), b = s[h];
|
|
9085
|
-
b && y.classList.add(`pluno-pa-widget__table-cell--${b}`),
|
|
9086
|
+
b && y.classList.add(`pluno-pa-widget__table-cell--${b}`), _t(y, p), d.appendChild(y);
|
|
9086
9087
|
}), l.appendChild(d), r.appendChild(l);
|
|
9087
9088
|
const c = document.createElement("tbody");
|
|
9088
9089
|
let u = e + 2;
|
|
@@ -9093,7 +9094,7 @@ function Dh(t, e) {
|
|
|
9093
9094
|
const h = document.createElement("tr");
|
|
9094
9095
|
n.forEach((y, b) => {
|
|
9095
9096
|
const m = document.createElement("td"), f = s[b];
|
|
9096
|
-
f && m.classList.add(`pluno-pa-widget__table-cell--${f}`),
|
|
9097
|
+
f && m.classList.add(`pluno-pa-widget__table-cell--${f}`), _t(m, p[b] ?? ""), h.appendChild(m);
|
|
9097
9098
|
}), c.appendChild(h), u += 1;
|
|
9098
9099
|
}
|
|
9099
9100
|
return r.appendChild(c), o.appendChild(r), { element: o, nextIndex: u };
|
|
@@ -9127,14 +9128,14 @@ function po(t, e) {
|
|
|
9127
9128
|
const l = s.match(/^(#{1,6})\s+(.+)$/);
|
|
9128
9129
|
if (l) {
|
|
9129
9130
|
const p = document.createElement(`h${l[1].length}`);
|
|
9130
|
-
|
|
9131
|
+
_t(p, l[2]), t.appendChild(p), i += 1;
|
|
9131
9132
|
continue;
|
|
9132
9133
|
}
|
|
9133
9134
|
if (/^\s*[-*+]\s+/.test(s)) {
|
|
9134
9135
|
const p = document.createElement("ul");
|
|
9135
9136
|
for (; i < n.length && /^\s*[-*+]\s+/.test(n[i]); ) {
|
|
9136
9137
|
const h = document.createElement("li");
|
|
9137
|
-
|
|
9138
|
+
_t(h, n[i].replace(/^\s*[-*+]\s+/, "")), p.appendChild(h), i += 1;
|
|
9138
9139
|
}
|
|
9139
9140
|
t.appendChild(p);
|
|
9140
9141
|
continue;
|
|
@@ -9144,7 +9145,7 @@ function po(t, e) {
|
|
|
9144
9145
|
const p = document.createElement("ol");
|
|
9145
9146
|
for (p.start = Number(d[1]); i < n.length && /^\s*\d+\.\s+/.test(n[i]); ) {
|
|
9146
9147
|
const h = document.createElement("li");
|
|
9147
|
-
|
|
9148
|
+
_t(h, n[i].replace(/^\s*\d+\.\s+/, "")), p.appendChild(h), i += 1;
|
|
9148
9149
|
}
|
|
9149
9150
|
t.appendChild(p);
|
|
9150
9151
|
continue;
|
|
@@ -9154,11 +9155,11 @@ function po(t, e) {
|
|
|
9154
9155
|
c.push(n[i]), i += 1;
|
|
9155
9156
|
const u = document.createElement("p");
|
|
9156
9157
|
c.forEach((p, h) => {
|
|
9157
|
-
h > 0 && u.appendChild(document.createElement("br")),
|
|
9158
|
+
h > 0 && u.appendChild(document.createElement("br")), _t(u, p);
|
|
9158
9159
|
}), t.appendChild(u);
|
|
9159
9160
|
}
|
|
9160
9161
|
}
|
|
9161
|
-
function
|
|
9162
|
+
function _t(t, e) {
|
|
9162
9163
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
9163
9164
|
let i = 0;
|
|
9164
9165
|
for (const s of e.matchAll(n)) {
|
|
@@ -9172,10 +9173,10 @@ function St(t, e) {
|
|
|
9172
9173
|
l.textContent = r.slice(1, -1), t.appendChild(l);
|
|
9173
9174
|
} else if (r.startsWith("**")) {
|
|
9174
9175
|
const l = document.createElement("strong");
|
|
9175
|
-
|
|
9176
|
+
_t(l, r.slice(2, -2)), t.appendChild(l);
|
|
9176
9177
|
} else if (r.startsWith("*")) {
|
|
9177
9178
|
const l = document.createElement("em");
|
|
9178
|
-
|
|
9179
|
+
_t(l, r.slice(1, -1)), t.appendChild(l);
|
|
9179
9180
|
} else {
|
|
9180
9181
|
const l = r.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
9181
9182
|
if (l && Uh(l[2])) {
|