@pluno/product-agent-web 0.1.234 → 0.1.235

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.
@@ -34,11 +34,11 @@ function $u(t) {
34
34
  e = Math.imul(e ^ t.charCodeAt(i), 16777619) >>> 0, n = Math.imul(n ^ t.charCodeAt(i), 33) >>> 0;
35
35
  return `selection:${e.toString(16)}:${n.toString(16)}`;
36
36
  }
37
- const sr = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], Un = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), cs = (t) => t === null || Un(t), Ol = (t) => typeof t == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:Z|\+00:00)$/.test(t) && Number.isFinite(Date.parse(t));
37
+ const sr = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], Bn = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), cs = (t) => t === null || Bn(t), Ol = (t) => typeof t == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:Z|\+00:00)$/.test(t) && Number.isFinite(Date.parse(t));
38
38
  function Nl(t) {
39
39
  if (!t || typeof t != "object") return !1;
40
40
  const e = t;
41
- return Object.keys(t).every((n) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(n)) && cs(e.sessionId) && Un(e.itemId) && cs(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && cs(e.runId) && (e.createdAt === null || Ol(e.createdAt));
41
+ return Object.keys(t).every((n) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(n)) && cs(e.sessionId) && Bn(e.itemId) && cs(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && cs(e.runId) && (e.createdAt === null || Ol(e.createdAt));
42
42
  }
43
43
  function Fu(t, e) {
44
44
  const n = t.messages.find((s) => s.id === e && s.dataType === "run_error");
@@ -54,9 +54,9 @@ function Fu(t, e) {
54
54
  return Nl(i) ? i : void 0;
55
55
  }
56
56
  function or(t) {
57
- const e = (n) => t[n].filter(Un).slice(-20);
57
+ const e = (n) => t[n].filter(Bn).slice(-20);
58
58
  return {
59
- sessionId: Un(t.selectedSessionId) ? t.selectedSessionId : null,
59
+ sessionId: Bn(t.selectedSessionId) ? t.selectedSessionId : null,
60
60
  messageKeys: e("messageKeys"),
61
61
  canonicalItemKeys: e("canonicalItemKeys"),
62
62
  terminalResponseKeys: e("terminalResponseKeys"),
@@ -65,7 +65,7 @@ function or(t) {
65
65
  thinkingSequence: (t.thinkingSequence ?? []).slice(-20),
66
66
  runtimeItemCount: t.runtimeItemCount ?? 0,
67
67
  welcome: t.welcome ?? !1,
68
- truncated: (t.thinkingSequence?.length ?? 0) > 20 || sr.some((n) => t[n].length > 20 || t[n].some((i) => !Un(i)))
68
+ truncated: (t.thinkingSequence?.length ?? 0) > 20 || sr.some((n) => t[n].length > 20 || t[n].some((i) => !Bn(i)))
69
69
  };
70
70
  }
71
71
  function ju(t, e) {
@@ -113,7 +113,7 @@ function Wu(t) {
113
113
  const e = (i) => {
114
114
  if (!i || typeof i != "object") return !1;
115
115
  const s = i;
116
- return Object.keys(i).every((o) => [...sr, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context"].includes(o)) && (s.context === void 0 || Ku(s.context)) && (s.thinkingSequence === void 0 || Array.isArray(s.thinkingSequence) && s.thinkingSequence.length <= 20 && s.thinkingSequence.every((o) => o === "user" || o === "thinking")) && cs(s.sessionId) && Number.isSafeInteger(s.runtimeItemCount) && s.runtimeItemCount >= 0 && typeof s.welcome == "boolean" && typeof s.truncated == "boolean" && sr.every((o) => Array.isArray(s[o]) && s[o].length <= 20 && s[o].every(Un));
116
+ return Object.keys(i).every((o) => [...sr, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context"].includes(o)) && (s.context === void 0 || Ku(s.context)) && (s.thinkingSequence === void 0 || Array.isArray(s.thinkingSequence) && s.thinkingSequence.length <= 20 && s.thinkingSequence.every((o) => o === "user" || o === "thinking")) && cs(s.sessionId) && Number.isSafeInteger(s.runtimeItemCount) && s.runtimeItemCount >= 0 && typeof s.welcome == "boolean" && typeof s.truncated == "boolean" && sr.every((o) => Array.isArray(s[o]) && s[o].length <= 20 && s[o].every(Bn));
117
117
  }, n = t;
118
118
  return (n.before === null || e(n.before)) && e(n.current);
119
119
  }
@@ -214,7 +214,7 @@ function Or(t) {
214
214
  const e = t;
215
215
  return Object.keys(e).every((n) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs"].includes(n)) && (e.entrySurface === void 0 || ["extension_sidepanel", "extension_widget", "main_web_chat", "embedded_widget", "embedded_custom_ui", "automation", "mcp", "whatsapp"].includes(e.entrySurface)) && ["send", "stop"].includes(e.operation) && ["renderer", "sdk", "extension", "http"].includes(e.layer) && Qu.includes(e.stage) && ["started", "completed", "failed", "observed"].includes(e.status) && Zi(e.spanId) && Zi(e.requestId) && (e.clientMessageId === null || Zi(e.clientMessageId)) && (e.sessionId === null || Zi(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
216
216
  }
217
- function Bn(t, e) {
217
+ function zn(t, e) {
218
218
  if (!t) return {
219
219
  mark: (s) => {
220
220
  },
@@ -386,19 +386,19 @@ function Ft(t) {
386
386
  function vs(t) {
387
387
  return "revision" in t.data ? t.data.revision : null;
388
388
  }
389
- function jn(t) {
389
+ function Hn(t) {
390
390
  if (t === null || typeof t == "string" || typeof t == "boolean") return !0;
391
391
  if (typeof t == "number") return Number.isFinite(t);
392
- if (Array.isArray(t)) return t.every(jn);
392
+ if (Array.isArray(t)) return t.every(Hn);
393
393
  if (typeof t != "object") return !1;
394
394
  const e = Object.getPrototypeOf(t);
395
- return e !== Object.prototype && e !== null ? !1 : Object.values(t).every(jn);
395
+ return e !== Object.prototype && e !== null ? !1 : Object.values(t).every(Hn);
396
396
  }
397
397
  function Mt(t) {
398
398
  return t !== null && typeof t == "object" && !Object.isFrozen(t) && (Object.values(t).forEach(Mt), Object.freeze(t)), t;
399
399
  }
400
400
  function vt(t) {
401
- if (!jn(t)) throw new Error("Conversation inputs must be JSON-safe values.");
401
+ if (!Hn(t)) throw new Error("Conversation inputs must be JSON-safe values.");
402
402
  return JSON.parse(JSON.stringify(t));
403
403
  }
404
404
  function Bl(t = "", e = 0) {
@@ -552,23 +552,23 @@ function dp(t, e, n, i) {
552
552
  else {
553
553
  const h = vt(e.output.snapshot);
554
554
  r.lane === "current" && (c = { ...c, preparation: null });
555
- const g = c.queries.history, y = r.lane === "current" && (g.status === "not_requested" || h.next_cursor !== null && !c.items[h.next_cursor]);
555
+ const f = c.queries.history, y = r.lane === "current" && (f.status === "not_requested" || h.next_cursor !== null && !c.items[h.next_cursor]);
556
556
  if (h.conversation_id !== r.sessionId) throw new Error("Snapshot belongs to another conversation.");
557
- for (const f of h.removed_items) c = Eo(c, f);
558
- for (const f of h.items) c = ar(c, f);
559
- for (const f of h.streams) c = zl(c, f);
557
+ for (const g of h.removed_items) c = Eo(c, g);
558
+ for (const g of h.items) c = ar(c, g);
559
+ for (const g of h.streams) c = zl(c, g);
560
560
  if (c = cr(c, h.execution), c = Eo(c, {
561
561
  type: "conversation.follow_ups.updated",
562
562
  conversation_id: h.conversation_id,
563
563
  version: h.follow_ups_version,
564
564
  follow_ups: h.follow_ups
565
- }), h.interactions.some((f) => f.conversation_id !== h.conversation_id)) throw new Error("Interaction belongs to another conversation.");
565
+ }), h.interactions.some((g) => g.conversation_id !== h.conversation_id)) throw new Error("Interaction belongs to another conversation.");
566
566
  if (a = { authorityId: t.authorityId, generation: t.generation, sessionId: r.sessionId, sources: h.interactions }, h.execution.version === c.execution?.version)
567
- for (const f of r.acceptedUserMessageIds) {
568
- const w = l[f];
569
- w.executionVersion === null && (l = {
567
+ for (const g of r.acceptedUserMessageIds) {
568
+ const b = l[g];
569
+ b.executionVersion === null && (l = {
570
570
  ...l,
571
- [f]: { ...w, executionVersion: h.execution.version }
571
+ [g]: { ...b, executionVersion: h.execution.version }
572
572
  });
573
573
  }
574
574
  if (c = { ...c, queries: { ...c.queries, [r.lane]: {
@@ -580,9 +580,9 @@ function dp(t, e, n, i) {
580
580
  cursor: h.next_cursor,
581
581
  updatedAt: e.output.updatedAt
582
582
  } } }, y) {
583
- for (const [f, w] of Object.entries(p))
584
- w.sessionId === r.sessionId && w.lane === "history" && delete p[f];
585
- c = { ...c, queries: { ...c.queries, history: { ...c.queries.current, key: g.key } } };
583
+ for (const [g, b] of Object.entries(p))
584
+ b.sessionId === r.sessionId && b.lane === "history" && delete p[g];
585
+ c = { ...c, queries: { ...c.queries, history: { ...c.queries.current, key: f.key } } };
586
586
  }
587
587
  }
588
588
  s = { ...t, requests: p, submissions: l, sessions: { ...t.sessions, [c.sessionId]: c } };
@@ -616,18 +616,18 @@ function dp(t, e, n, i) {
616
616
  if (es(L) !== es(l)) throw new Error("User-message identity cannot be reused with different input.");
617
617
  return { state: t, effects: o };
618
618
  }
619
- const g = n.selections[e.conversationScopeId], y = Object.values(t.submissions).find((S) => S.conversationScopeId === e.conversationScopeId && !S.cancelled && S.sessionId !== null), f = i.scopes[e.clientScopeId], w = {
619
+ const f = n.selections[e.conversationScopeId], y = Object.values(t.submissions).find((S) => S.conversationScopeId === e.conversationScopeId && !S.cancelled && S.sessionId !== null), g = i.scopes[e.clientScopeId], b = {
620
620
  ...vt(l),
621
621
  ...p ? { contextPreparation: null } : {},
622
622
  // Extension staging can await page context after the picker has already changed.
623
- requestedModel: f?.submissions[e.userMessageId] ? f.submissions[e.userMessageId].requestedModel ?? null : f ? Nr(f) ?? null : null,
624
- sessionId: g.sessionId ?? y?.sessionId ?? null,
623
+ requestedModel: g?.submissions[e.userMessageId] ? g.submissions[e.userMessageId].requestedModel ?? null : g ? Nr(g) ?? null : null,
624
+ sessionId: f.sessionId ?? y?.sessionId ?? null,
625
625
  delivery: "staged",
626
626
  cancelled: !1,
627
627
  error: null,
628
628
  executionVersion: null
629
- }, b = { ...t.proactiveQuestions };
630
- delete b[e.conversationScopeId], s = { ...t, proactiveQuestions: b, submissions: { ...t.submissions, [e.userMessageId]: w }, submissionOrder: [...t.submissionOrder, e.userMessageId] };
629
+ }, w = { ...t.proactiveQuestions };
630
+ delete w[e.conversationScopeId], s = { ...t, proactiveQuestions: w, submissions: { ...t.submissions, [e.userMessageId]: b }, submissionOrder: [...t.submissionOrder, e.userMessageId] };
631
631
  break;
632
632
  }
633
633
  case "conversation.submission_accepted": {
@@ -644,14 +644,14 @@ function dp(t, e, n, i) {
644
644
  }
645
645
  case "conversation.stop": {
646
646
  if (n.clients[e.clientScopeId] !== e.conversationScopeId) return { state: t, effects: o };
647
- const r = n.selections[e.conversationScopeId].sessionId, c = r ? t.sessions[r]?.execution : null, u = Object.values(t.submissions).filter((f) => (r ? f.sessionId === r : f.conversationScopeId === e.conversationScopeId) && (!e.userMessageIds || e.userMessageIds.includes(f.userMessageId))), p = u.filter((f) => !f.cancelled && (f.delivery !== "failed" || t.deliveries[f.userMessageId]?.phase === "paused") && (f.delivery !== "accepted" || f.executionVersion === null)), l = p.length > 0, h = c && ["queued", "thinking", "steering", "stopping"].includes(c.phase) && (!e.userMessageIds || jt(c).some((f) => e.userMessageIds.includes(f)));
647
+ const r = n.selections[e.conversationScopeId].sessionId, c = r ? t.sessions[r]?.execution : null, u = Object.values(t.submissions).filter((g) => (r ? g.sessionId === r : g.conversationScopeId === e.conversationScopeId) && (!e.userMessageIds || e.userMessageIds.includes(g.userMessageId))), p = u.filter((g) => !g.cancelled && (g.delivery !== "failed" || t.deliveries[g.userMessageId]?.phase === "paused") && (g.delivery !== "accepted" || g.executionVersion === null)), l = p.length > 0, h = c && ["queued", "thinking", "steering", "stopping"].includes(c.phase) && (!e.userMessageIds || jt(c).some((g) => e.userMessageIds.includes(g)));
648
648
  if (!l && !h && (c || !e.userMessageIds?.length)) return { state: t, effects: o };
649
- const g = Array.from(new Set(e.userMessageIds ?? [...p.map((f) => f.userMessageId), ...h ? jt(c) : []])), y = { ...t.submissions };
650
- for (const f of u)
651
- g.includes(f.userMessageId) && f.delivery !== "accepted" && (y[f.userMessageId] = { ...f, cancelled: !0 });
649
+ const f = Array.from(new Set(e.userMessageIds ?? [...p.map((g) => g.userMessageId), ...h ? jt(c) : []])), y = { ...t.submissions };
650
+ for (const g of u)
651
+ f.includes(g.userMessageId) && g.delivery !== "accepted" && (y[g.userMessageId] = { ...g, cancelled: !0 });
652
652
  s = { ...t, submissions: y, stops: { ...t.stops, [e.conversationScopeId]: {
653
653
  requestId: e.requestId,
654
- userMessageIds: g,
654
+ userMessageIds: f,
655
655
  executionVersion: c?.version ?? -1,
656
656
  reason: e.reason ?? "user_requested"
657
657
  } } };
@@ -696,7 +696,7 @@ function dp(t, e, n, i) {
696
696
  before: e.lane === "history" ? c.cursor : null,
697
697
  refreshItemIds: lp(r),
698
698
  retryPreparation: c.error?.code === "history_preparation_failed"
699
- }, p = Object.values(t.submissions).filter((g) => g.sessionId === e.sessionId && g.delivery === "accepted" && g.executionVersion === null).map((g) => g.userMessageId), l = t.requestSequence + 1, h = `conversation:${t.generation}:${l}`;
699
+ }, p = Object.values(t.submissions).filter((f) => f.sessionId === e.sessionId && f.delivery === "accepted" && f.executionVersion === null).map((f) => f.userMessageId), l = t.requestSequence + 1, h = `conversation:${t.generation}:${l}`;
700
700
  s = {
701
701
  ...t,
702
702
  requestSequence: l,
@@ -723,15 +723,15 @@ function Fl(t, e) {
723
723
  if (l.cancelled && n.has(l.conversationScopeId) && t.stops[l.conversationScopeId]?.userMessageIds.includes(p) && !h?.items[p] && !h?.removedItems[p]) return !0;
724
724
  if (l.delivery === "accepted") {
725
725
  if (l.cancelled) return !s(p);
726
- const g = l.sessionId ? t.sessions[l.sessionId] : void 0;
727
- return l.executionVersion === null || !(g?.items[p] || g?.removedItems[p]);
726
+ const f = l.sessionId ? t.sessions[l.sessionId] : void 0;
727
+ return l.executionVersion === null || !(f?.items[p] || f?.removedItems[p]);
728
728
  }
729
729
  return !l.cancelled || Cn(t, p) || t.deliveries[p]?.phase === "running";
730
730
  }).map(([p, l]) => [p, l.delivery === "accepted" || l.cancelled ? { ...l, context: {}, contextPreparation: { pageContent: "", sessionTabs: [] } } : l])), a = Object.fromEntries(Object.entries(t.deliveries).filter(([p]) => p in o).map(([p, l]) => [p, o[p].delivery === "accepted" ? { ...l, phase: "done", effectId: null, command: null, uploads: [], completedUploads: 0 } : o[p].cancelled ? { ...l, command: null } : l])), r = Object.fromEntries(Object.entries(t.stops).filter(([p, l]) => l.userMessageIds.some((h) => {
731
731
  if (o[h]) return !0;
732
732
  if (!s(h)) return i.some((y) => y.command.payload.expectedUserMessageId === h && y.phase !== "done");
733
- const g = Object.values(t.sessions).find((y) => y.executionByUserMessage[h])?.executionByUserMessage[h];
734
- return n.has(p) && (!g || g.version <= l.executionVersion || !["completed", "failed", "stopped"].includes(g.phase));
733
+ const f = Object.values(t.sessions).find((y) => y.executionByUserMessage[h])?.executionByUserMessage[h];
734
+ return n.has(p) && (!f || f.version <= l.executionVersion || !["completed", "failed", "stopped"].includes(f.phase));
735
735
  }))), c = new Set(Object.values(r).flatMap((p) => p.userMessageIds)), u = Object.fromEntries(Object.entries(t.operations).filter(([, p]) => {
736
736
  if (!["done", "failed"].includes(p.phase)) return !0;
737
737
  if (p.command.type === "run.stop") return c.has(String(p.command.payload.expectedUserMessageId)) || Object.values(o).some((h) => h.cancelled && h.userMessageId === p.command.payload.expectedUserMessageId);
@@ -739,7 +739,7 @@ function Fl(t, e) {
739
739
  if (p.command.type === "runtime.warmup") return e.selections[p.conversationScopeId]?.sessionId !== p.result?.sessionId;
740
740
  if (p.command.type !== "attachment.prepare") return !1;
741
741
  const l = p.command.payload.source;
742
- return !Object.values(t.submissions).some((h) => h.conversationScopeId === p.conversationScopeId && h.delivery === "accepted" && h.attachments.some((g) => g.sourceId === l.sourceId));
742
+ return !Object.values(t.submissions).some((h) => h.conversationScopeId === p.conversationScopeId && h.delivery === "accepted" && h.attachments.some((f) => f.sourceId === l.sourceId));
743
743
  }));
744
744
  return Mt({
745
745
  schema: 1,
@@ -795,15 +795,15 @@ function pr(t) {
795
795
  c = { ...c, uploads: [...c.uploads, h.uploaded] };
796
796
  continue;
797
797
  }
798
- const g = Object.values(e.operations).find((y) => y.command.type === "attachment.prepare" && y.conversationScopeId === r.conversationScopeId && y.phase === "done" && y.command.payload.source.sourceId === h.sourceId && y.result?.sessionId === r.sessionId);
799
- if (!g) break;
800
- c = { ...c, uploads: [...c.uploads, g.result.attachment] };
798
+ const f = Object.values(e.operations).find((y) => y.command.type === "attachment.prepare" && y.conversationScopeId === r.conversationScopeId && y.phase === "done" && y.command.payload.source.sourceId === h.sourceId && y.result?.sessionId === r.sessionId);
799
+ if (!f) break;
800
+ c = { ...c, uploads: [...c.uploads, f.result.attachment] };
801
801
  }
802
802
  for (; c.completedUploads < c.uploads.length && r.attachments[c.completedUploads].uploaded; )
803
803
  c = { ...c, completedUploads: c.completedUploads + 1 };
804
804
  if (!r.cancelled && c.uploads.length === r.attachments.length && c.completedUploads === c.uploads.length && t.submissionOrder.slice(0, t.submissionOrder.indexOf(a)).some((h) => {
805
- const g = e.submissions[h];
806
- return (g.conversationScopeId === r.conversationScopeId || r.sessionId !== null && g.sessionId === r.sessionId) && g.delivery !== "accepted" && (g.delivery !== "failed" || e.deliveries[h]?.phase === "paused") && (!g.cancelled || Cn(e, h));
805
+ const f = e.submissions[h];
806
+ return (f.conversationScopeId === r.conversationScopeId || r.sessionId !== null && f.sessionId === r.sessionId) && f.delivery !== "accepted" && (f.delivery !== "failed" || e.deliveries[h]?.phase === "paused") && (!f.cancelled || Cn(e, h));
807
807
  })) continue;
808
808
  const u = s();
809
809
  let p, l = c.command;
@@ -877,46 +877,46 @@ function hp(t, e, n, i) {
877
877
  e.effectKind === "conversation.checkpoint" && e.effectId === t.checkpointEffectId && (s = { ...s, checkpointEffectId: null, checkpointError: e.type === "effect.failed" ? e.error : null });
878
878
  const p = Object.keys(t.deliveries).find((h) => t.deliveries[h].effectId === e.effectId), l = Object.keys(t.operations).find((h) => t.operations[h].effectId === e.effectId);
879
879
  if (p) {
880
- const h = t.deliveries[p], g = t.submissions[p];
880
+ const h = t.deliveries[p], f = t.submissions[p];
881
881
  let y = { ...h, phase: "waiting", effectId: null };
882
882
  if (e.type === "effect.failed") {
883
- const f = e.error.retryable ? "uncertain" : "failed";
884
- y = { ...y, phase: f }, !g.cancelled && g.delivery !== "accepted" && (s = { ...s, submissions: {
883
+ const g = e.error.retryable ? "uncertain" : "failed";
884
+ y = { ...y, phase: g }, !f.cancelled && f.delivery !== "accepted" && (s = { ...s, submissions: {
885
885
  ...s.submissions,
886
- [p]: { ...g, delivery: f, error: e.error }
886
+ [p]: { ...f, delivery: g, error: e.error }
887
887
  } });
888
888
  } else if (e.effectKind === "conversation.upload") {
889
- const f = vt(e.output), w = g.attachments[h.uploads.length];
890
- if (f.attachment.id !== w.sourceId || f.attachment.size_bytes !== w.sizeBytes || g.sessionId !== null && g.sessionId !== f.sessionId)
889
+ const g = vt(e.output), b = f.attachments[h.uploads.length];
890
+ if (g.attachment.id !== b.sourceId || g.attachment.size_bytes !== b.sizeBytes || f.sessionId !== null && f.sessionId !== g.sessionId)
891
891
  throw new Error("Upload does not match the captured attachment or conversation.");
892
- y = { ...y, uploads: [...h.uploads, f.attachment] };
893
- const b = Object.fromEntries(Object.entries(s.submissions).map(([S, R]) => [
892
+ y = { ...y, uploads: [...h.uploads, g.attachment] };
893
+ const w = Object.fromEntries(Object.entries(s.submissions).map(([S, R]) => [
894
894
  S,
895
- R.conversationScopeId === g.conversationScopeId && (S === p || !R.cancelled && !g.cancelled) ? { ...R, sessionId: f.sessionId } : R
895
+ R.conversationScopeId === f.conversationScopeId && (S === p || !R.cancelled && !f.cancelled) ? { ...R, sessionId: g.sessionId } : R
896
896
  ]));
897
- s = { ...s, submissions: b };
897
+ s = { ...s, submissions: w };
898
898
  } else if (e.effectKind === "conversation.receipt")
899
899
  if (e.output === null) y = { ...y, phase: "uncertain" };
900
900
  else {
901
- const f = dc(e.output, p);
901
+ const g = dc(e.output, p);
902
902
  y = { ...y, phase: "done" }, o = {
903
903
  type: "conversation.submission_accepted",
904
904
  authorityId: t.authorityId,
905
905
  generation: t.generation,
906
906
  userMessageId: p,
907
- sessionId: f.sessionId
907
+ sessionId: g.sessionId
908
908
  };
909
909
  }
910
910
  else if (e.effectKind === "conversation.command" && h.step === "complete")
911
911
  y = { ...y, completedUploads: h.completedUploads + 1, command: null };
912
912
  else if (e.effectKind === "conversation.command" && h.step === "send") {
913
- const f = dc(e.output, p);
913
+ const g = dc(e.output, p);
914
914
  y = { ...y, phase: "done" }, o = {
915
915
  type: "conversation.submission_accepted",
916
916
  authorityId: t.authorityId,
917
917
  generation: t.generation,
918
918
  userMessageId: p,
919
- sessionId: f.sessionId
919
+ sessionId: g.sessionId
920
920
  };
921
921
  }
922
922
  s = { ...s, deliveries: { ...s.deliveries, [p]: y } };
@@ -929,14 +929,14 @@ function hp(t, e, n, i) {
929
929
  error: e.type === "effect.failed" ? e.error : null,
930
930
  result: e.type === "effect.completed" ? vt(e.output) : null
931
931
  } } }, e.type === "effect.completed" && ["runtime.warmup", "attachment.prepare"].includes(h.command.type) && !h.command.payload.sessionId && h.conversationScopeId && !Object.values(n.clients).includes(h.conversationScopeId)) {
932
- const g = e.output;
933
- g?.sessionId && (s = { ...s, operations: {
932
+ const f = e.output;
933
+ f?.sessionId && (s = { ...s, operations: {
934
934
  ...s.operations,
935
935
  [`cleanup:${l}`]: ur({
936
936
  request_id: `cleanup:${h.command.request_id}`,
937
937
  type: "session.reset",
938
938
  payload: {
939
- sessionId: g.sessionId,
939
+ sessionId: f.sessionId,
940
940
  ...h.command.payload.warmupId ? { warmupId: h.command.payload.warmupId } : {},
941
941
  ...h.command.payload.page ? { page: h.command.payload.page } : {}
942
942
  }
@@ -949,28 +949,28 @@ function hp(t, e, n, i) {
949
949
  const p = vt(e.checkpoint);
950
950
  if (p.schema !== 1 || p.authorityId !== t.authorityId || t.submissionOrder.length || Object.keys(t.operations).length)
951
951
  throw new Error("Delivery restoration requires an empty engine with the same authenticated authority.");
952
- const { schema: l, authorityId: h, ...g } = p;
952
+ const { schema: l, authorityId: h, ...f } = p;
953
953
  s = {
954
954
  ...t,
955
- ...g,
955
+ ...f,
956
956
  requestSequence: Math.max(t.requestSequence, p.requestSequence),
957
957
  effectsEnabled: !0,
958
- submissions: Object.fromEntries(Object.entries(p.submissions).map(([y, f]) => [y, {
959
- ...f,
958
+ submissions: Object.fromEntries(Object.entries(p.submissions).map(([y, g]) => [y, {
959
+ ...g,
960
960
  executionVersion: null,
961
- cancelled: f.cancelled || !$l(f, n),
962
- delivery: f.contextPreparation === null && !f.cancelled ? "failed" : f.delivery === "sending" ? "uncertain" : f.delivery,
963
- error: f.contextPreparation === null && !f.cancelled ? { code: "context_preparation_interrupted", message: "Page context preparation was interrupted. Please send this message again.", retryable: !1 } : f.error
961
+ cancelled: g.cancelled || !$l(g, n),
962
+ delivery: g.contextPreparation === null && !g.cancelled ? "failed" : g.delivery === "sending" ? "uncertain" : g.delivery,
963
+ error: g.contextPreparation === null && !g.cancelled ? { code: "context_preparation_interrupted", message: "Page context preparation was interrupted. Please send this message again.", retryable: !1 } : g.error
964
964
  }])),
965
- deliveries: Object.fromEntries(Object.entries(p.deliveries).map(([y, f]) => [y, {
966
- ...f,
965
+ deliveries: Object.fromEntries(Object.entries(p.deliveries).map(([y, g]) => [y, {
966
+ ...g,
967
967
  effectId: null,
968
- phase: ["running", "waiting"].includes(f.phase) ? "uncertain" : f.phase
968
+ phase: ["running", "waiting"].includes(g.phase) ? "uncertain" : g.phase
969
969
  }])),
970
- operations: Object.fromEntries(Object.entries(p.operations).map(([y, f]) => [y, {
971
- ...f,
970
+ operations: Object.fromEntries(Object.entries(p.operations).map(([y, g]) => [y, {
971
+ ...g,
972
972
  effectId: null,
973
- phase: ["running", "waiting"].includes(f.phase) ? "uncertain" : f.phase
973
+ phase: ["running", "waiting"].includes(g.phase) ? "uncertain" : g.phase
974
974
  }]))
975
975
  };
976
976
  }
@@ -1021,10 +1021,10 @@ function hp(t, e, n, i) {
1021
1021
  const l = t.operations[p.request_id];
1022
1022
  if (l && (JSON.stringify(l.command) !== JSON.stringify(p) || l.conversationScopeId !== (e.conversationScopeId ?? null))) throw new Error("Command identity changed.");
1023
1023
  if (!l) {
1024
- const h = p.type === "chat.retry_last_user_message" ? Object.fromEntries(Object.entries(t.stops).flatMap(([g, y]) => {
1025
- if (n.selections[g]?.sessionId !== p.payload.sessionId) return [[g, y]];
1026
- const f = y.userMessageIds.filter((w) => w !== p.payload.clientMessageId);
1027
- return f.length ? [[g, { ...y, userMessageIds: f }]] : [];
1024
+ const h = p.type === "chat.retry_last_user_message" ? Object.fromEntries(Object.entries(t.stops).flatMap(([f, y]) => {
1025
+ if (n.selections[f]?.sessionId !== p.payload.sessionId) return [[f, y]];
1026
+ const g = y.userMessageIds.filter((b) => b !== p.payload.clientMessageId);
1027
+ return g.length ? [[f, { ...y, userMessageIds: g }]] : [];
1028
1028
  })) : t.stops;
1029
1029
  s = { ...t, stops: h, effectsEnabled: !0, operations: {
1030
1030
  ...t.operations,
@@ -1137,7 +1137,7 @@ function gp(t) {
1137
1137
  };
1138
1138
  return {
1139
1139
  "conversation.checkpoint": async (a) => (Ye(t, a), await n(a.checkpoint).catch(i), Ye(t, a), null),
1140
- "conversation.receipt": (a) => Bn(t.onTiming, {
1140
+ "conversation.receipt": (a) => zn(t.onTiming, {
1141
1141
  operation: "send",
1142
1142
  layer: "http",
1143
1143
  requestId: a.userMessageId,
@@ -1155,7 +1155,7 @@ function gp(t) {
1155
1155
  }).catch(i)),
1156
1156
  "conversation.command": (a) => Promise.resolve().then(async () => {
1157
1157
  Ye(t, a), (a.command.type === "chat.user_message" || a.command.type === "attachment.upload_completed") && o(String(a.command.payload.clientMessageId));
1158
- const r = a.command.payload, c = Bn(["chat.user_message", "chat.retry_last_user_message", "run.stop", "attachment.upload_completed"].includes(a.command.type) ? t.onTiming : void 0, {
1158
+ const r = a.command.payload, c = zn(["chat.user_message", "chat.retry_last_user_message", "run.stop", "attachment.upload_completed"].includes(a.command.type) ? t.onTiming : void 0, {
1159
1159
  operation: a.command.type === "run.stop" ? "stop" : "send",
1160
1160
  layer: "http",
1161
1161
  requestId: a.command.request_id,
@@ -1171,7 +1171,7 @@ function gp(t) {
1171
1171
  "conversations",
1172
1172
  { timing: c }
1173
1173
  ));
1174
- if (Ye(t, a), u.request_id !== a.command.request_id || !jn(u.result)) throw new Error("Conversation response identity mismatch.");
1174
+ if (Ye(t, a), u.request_id !== a.command.request_id || !Hn(u.result)) throw new Error("Conversation response identity mismatch.");
1175
1175
  if (a.command.type.startsWith("chat.")) {
1176
1176
  const p = u.result;
1177
1177
  if (typeof p?.sessionId != "string" || !p.sessionId || p.clientMessageId !== a.command.payload.clientMessageId || a.command.payload.sessionId && p.sessionId !== a.command.payload.sessionId) throw new Error("Conversation acceptance identity mismatch.");
@@ -1181,7 +1181,7 @@ function gp(t) {
1181
1181
  if (r instanceof Error && "code" in r && r.code === "403") throw Co(r);
1182
1182
  return i(r);
1183
1183
  }),
1184
- "conversation.upload": (a) => Bn(t.onTiming, {
1184
+ "conversation.upload": (a) => zn(t.onTiming, {
1185
1185
  operation: "send",
1186
1186
  layer: "http",
1187
1187
  requestId: a.submission.userMessageId,
@@ -1190,8 +1190,8 @@ function gp(t) {
1190
1190
  }).measure("attachment_upload", () => Promise.resolve().then(async () => {
1191
1191
  const r = () => {
1192
1192
  if (Ye(t, a), !a.preparationId) return o(a.submission.userMessageId);
1193
- const g = t.runtime().engine.getState().slices.directory;
1194
- if (!Object.values(g.clients).includes(a.submission.conversationScopeId))
1193
+ const f = t.runtime().engine.getState().slices.directory;
1194
+ if (!Object.values(f.clients).includes(a.submission.conversationScopeId))
1195
1195
  throw Object.assign(new Error("Attachment preparation was cancelled."), { code: "submission_cancelled", retryable: !1 });
1196
1196
  };
1197
1197
  r(), await n(), r();
@@ -1214,8 +1214,8 @@ function gp(t) {
1214
1214
  if (r(), !p.sessionId || a.submission.sessionId && p.sessionId !== a.submission.sessionId || p.attachment.id !== a.source.sourceId || p.attachment.mimeType !== a.source.mimeType || p.attachment.sizeBytes !== a.source.sizeBytes)
1215
1215
  throw Object.assign(new Error("Attachment preparation identity mismatch."), { code: "attachment_identity_mismatch", retryable: !1 });
1216
1216
  if ("uploadUrl" in p) {
1217
- const g = await fetch(t.http.resolveUrl(p.uploadUrl), { method: p.uploadMethod, headers: p.uploadHeaders, body: c });
1218
- if (!g.ok) throw Object.assign(new Error("Attachment transfer failed."), { code: String(g.status) });
1217
+ const f = await fetch(t.http.resolveUrl(p.uploadUrl), { method: p.uploadMethod, headers: p.uploadHeaders, body: c });
1218
+ if (!f.ok) throw Object.assign(new Error("Attachment transfer failed."), { code: String(f.status) });
1219
1219
  }
1220
1220
  r();
1221
1221
  const l = p.attachment, h = {
@@ -1386,7 +1386,7 @@ class fp {
1386
1386
  }
1387
1387
  }
1388
1388
  const mp = /(`+)(?!`)[\s\S]*?\1(?!`)/g, yp = "/api/product-agent/attachments/download", wp = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
1389
- function Nn(t, e) {
1389
+ function Un(t, e) {
1390
1390
  return e ? t.replace(
1391
1391
  wp,
1392
1392
  (n, i, s, o) => `${i}${new URL(s, e).toString()}${o}`
@@ -1502,21 +1502,21 @@ function Ip(t, e, n, i) {
1502
1502
  };
1503
1503
  switch (t.type) {
1504
1504
  case "user_message":
1505
- return { ...o, role: "user", content: Nn(t.data.content, i), attachments: t.data.attachments.map((a) => gc(a, i)) };
1505
+ return { ...o, role: "user", content: Un(t.data.content, i), attachments: t.data.attachments.map((a) => gc(a, i)) };
1506
1506
  case "final_response":
1507
1507
  return {
1508
1508
  ...o,
1509
1509
  role: "assistant",
1510
1510
  phase: "final_answer",
1511
- content: Nn(t.data.content, i),
1511
+ content: Un(t.data.content, i),
1512
1512
  attachments: t.data.attachments.map((a) => gc(a, i)),
1513
1513
  loading: s,
1514
1514
  streamState: n
1515
1515
  };
1516
1516
  case "commentary":
1517
- return { ...o, role: "tool", phase: "commentary", dataType: "commentary_history", content: Nn(t.data.content, i), loading: s };
1517
+ return { ...o, role: "tool", phase: "commentary", dataType: "commentary_history", content: Un(t.data.content, i), loading: s };
1518
1518
  case "tool_summary":
1519
- return { ...o, role: "tool", dataType: "tool_summary", content: Nn(t.data.content, i), loading: s };
1519
+ return { ...o, role: "tool", dataType: "tool_summary", content: Un(t.data.content, i), loading: s };
1520
1520
  // The supported public renderer recognizes run_error; a bare error system row is silently omitted.
1521
1521
  case "error":
1522
1522
  return {
@@ -1563,8 +1563,8 @@ function xp(t, e, n, i) {
1563
1563
  createdAt: "",
1564
1564
  loading: !1
1565
1565
  });
1566
- const r = t.activity.phase, c = t.submissions.filter((C) => !C.cancelled && !["accepted", "failed"].includes(C.delivery)), u = t.submissions[t.submissions.length - 1], p = [...t.items].reverse().find((C) => C.type === "user_message"), l = ["queued", "thinking", "steering", "awaiting_execution"].includes(r), h = u?.delivery === "failed" && (l && t.activity.userMessageId != null && t.activity.userMessageId !== u.userMessageId || p !== void 0 && p.id !== u.userMessageId && Date.parse(p.created_at) > u.submittedAt), g = new Map(t.submissions.filter((C) => (C !== u || h) && !C.cancelled && C.delivery === "failed" && C.error).map((C) => [C.userMessageId, C])), y = a.flatMap((C) => {
1567
- const D = C.role === "user" ? g.get(C.id) : void 0;
1566
+ const r = t.activity.phase, c = t.submissions.filter((C) => !C.cancelled && !["accepted", "failed"].includes(C.delivery)), u = t.submissions[t.submissions.length - 1], p = [...t.items].reverse().find((C) => C.type === "user_message"), l = ["queued", "thinking", "steering", "awaiting_execution"].includes(r), h = u?.delivery === "failed" && (l && t.activity.userMessageId != null && t.activity.userMessageId !== u.userMessageId || p !== void 0 && p.id !== u.userMessageId && Date.parse(p.created_at) > u.submittedAt), f = new Map(t.submissions.filter((C) => (C !== u || h) && !C.cancelled && C.delivery === "failed" && C.error).map((C) => [C.userMessageId, C])), y = a.flatMap((C) => {
1567
+ const D = C.role === "user" ? f.get(C.id) : void 0;
1568
1568
  return D?.error ? [C, {
1569
1569
  id: `submission-error:${D.userMessageId}`,
1570
1570
  role: "system",
@@ -1575,7 +1575,7 @@ function xp(t, e, n, i) {
1575
1575
  loading: !1,
1576
1576
  ...typeof D.error.details?.securitySettingsUrl == "string" ? { securitySettingsUrl: D.error.details.securitySettingsUrl } : {}
1577
1577
  }] : [C];
1578
- }), f = u?.delivery === "failed" && !u.cancelled && !h ? u.error : e?.error ?? null, w = {
1578
+ }), g = u?.delivery === "failed" && !u.cancelled && !h ? u.error : e?.error ?? null, b = {
1579
1579
  conversationDiagnostics: {
1580
1580
  ...i ? { owner: i } : {},
1581
1581
  queryStatus: e?.status ?? null,
@@ -1605,15 +1605,15 @@ function xp(t, e, n, i) {
1605
1605
  turnPhase: r === "submitting" ? "sending" : ["queued", "awaiting_execution"].includes(r) ? "starting" : ["thinking", "steering"].includes(r) ? "thinking" : null,
1606
1606
  isThinking: l,
1607
1607
  taskStatus: r === "completed" ? "completed" : r === "failed" ? "failed" : r === "stopped" || r === "stopping" ? "stopped" : l || r === "submitting" ? "working" : null,
1608
- lastError: f?.message ?? null,
1609
- lastErrorCode: f?.code ?? null,
1610
- lastErrorSecuritySettingsUrl: typeof f?.details?.securitySettingsUrl == "string" ? f.details.securitySettingsUrl : null
1611
- }, b = t.optimistic.filter((C) => C.cancelled && !t.stop?.userMessageIds.includes(C.userMessageId)).map((C) => C.userMessageId), S = hc(w, "", "stopped", b), R = { ...w, messages: S.messages, segments: S.segments };
1608
+ lastError: g?.message ?? null,
1609
+ lastErrorCode: g?.code ?? null,
1610
+ lastErrorSecuritySettingsUrl: typeof g?.details?.securitySettingsUrl == "string" ? g.details.securitySettingsUrl : null
1611
+ }, w = t.optimistic.filter((C) => C.cancelled && !t.stop?.userMessageIds.includes(C.userMessageId)).map((C) => C.userMessageId), S = hc(b, "", "stopped", w), R = { ...b, messages: S.messages, segments: S.segments };
1612
1612
  if (!t.stop) return R;
1613
1613
  const k = hc(R, "", t.stop.pending ? "stopping" : "stopped", t.stop.userMessageIds);
1614
- return { ...w, messages: k.messages, segments: k.segments };
1614
+ return { ...b, messages: k.messages, segments: k.segments };
1615
1615
  }
1616
- function zn(t, e, n) {
1616
+ function $n(t, e, n) {
1617
1617
  const i = t.submissionOrder.map((I) => t.submissions[I]).filter((I) => I.conversationScopeId === n), s = e.selections[n]?.sessionId ?? i.find((I) => !I.cancelled && I.sessionId !== null)?.sessionId ?? null, o = s ? t.sessions[s] : void 0, a = t.submissionOrder.map((I) => t.submissions[I]).filter((I) => s ? I.sessionId === s || I.sessionId === null && I.conversationScopeId === n : I.conversationScopeId === n), r = Object.values(o?.items ?? {}).sort((I, O) => {
1618
1618
  const V = Ft(I.created_at), Y = Ft(O.created_at);
1619
1619
  return V < Y ? -1 : V > Y ? 1 : I.id < O.id ? -1 : I.id > O.id ? 1 : 0;
@@ -1646,14 +1646,14 @@ function zn(t, e, n) {
1646
1646
  collapsed: !1
1647
1647
  });
1648
1648
  }
1649
- const l = o?.execution, h = a.filter((I) => !I.cancelled && I.delivery !== "failed"), g = h.filter((I) => I.delivery !== "accepted" && I.executionVersion === null), y = h.filter((I) => I.delivery === "accepted" && I.executionVersion === null), f = h[h.length - 1], w = g.length > 0, b = f !== void 0 && y.includes(f);
1650
- let S = w ? "submitting" : b ? "awaiting_execution" : l?.phase ?? "idle";
1651
- const R = Object.entries(t.stops).filter(([I]) => I === n || s !== null && e.selections[I]?.sessionId === s).map(([, I]) => I).find((I) => (!a.length || I.userMessageIds.includes(a[a.length - 1].userMessageId) || !w && !b && jt(l).some((O) => I.userMessageIds.includes(O))) && (!l || l.version <= I.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(l.phase) || a.some((O) => O.cancelled && O.executionVersion === null && I.userMessageIds.includes(O.userMessageId)))), k = l && ["thinking", "steering", "queued", "stopping"].includes(l.phase) || a.some((I) => I.delivery === "accepted" && I.executionVersion === null && R?.userMessageIds.includes(I.userMessageId));
1652
- R && k && !w && (!l || !["thinking", "steering", "queued", "stopping"].includes(l.phase) || jt(l).every((I) => R.userMessageIds.includes(I))) && (S = "stopping"), R && !k && !w && a.some((I) => I.cancelled && I.executionVersion === null && R.userMessageIds.includes(I.userMessageId)) && (S = a.some((I) => R.userMessageIds.includes(I.userMessageId) && ["sending", "uncertain"].includes(I.delivery)) ? "stopping" : "stopped");
1649
+ const l = o?.execution, h = a.filter((I) => !I.cancelled && I.delivery !== "failed"), f = h.filter((I) => I.delivery !== "accepted" && I.executionVersion === null), y = h.filter((I) => I.delivery === "accepted" && I.executionVersion === null), g = h[h.length - 1], b = f.length > 0, w = g !== void 0 && y.includes(g);
1650
+ let S = b ? "submitting" : w ? "awaiting_execution" : l?.phase ?? "idle";
1651
+ const R = Object.entries(t.stops).filter(([I]) => I === n || s !== null && e.selections[I]?.sessionId === s).map(([, I]) => I).find((I) => (!a.length || I.userMessageIds.includes(a[a.length - 1].userMessageId) || !b && !w && jt(l).some((O) => I.userMessageIds.includes(O))) && (!l || l.version <= I.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(l.phase) || a.some((O) => O.cancelled && O.executionVersion === null && I.userMessageIds.includes(O.userMessageId)))), k = l && ["thinking", "steering", "queued", "stopping"].includes(l.phase) || a.some((I) => I.delivery === "accepted" && I.executionVersion === null && R?.userMessageIds.includes(I.userMessageId));
1652
+ R && k && !b && (!l || !["thinking", "steering", "queued", "stopping"].includes(l.phase) || jt(l).every((I) => R.userMessageIds.includes(I))) && (S = "stopping"), R && !k && !b && a.some((I) => I.cancelled && I.executionVersion === null && R.userMessageIds.includes(I.userMessageId)) && (S = a.some((I) => R.userMessageIds.includes(I.userMessageId) && ["sending", "uncertain"].includes(I.delivery)) ? "stopping" : "stopped");
1653
1653
  const C = ["thinking", "steering", "queued"].includes(S), D = t.stops[n] ?? R, q = D?.userMessageIds.filter((I) => !["completed", "failed"].includes(o?.executionByUserMessage[I]?.phase ?? "")) ?? [], Z = q.some((I) => {
1654
1654
  const O = a.find((Y) => Y.userMessageId === I);
1655
1655
  return !Object.values(t.operations).some((Y) => Y.command.type === "run.stop" && Y.command.payload.expectedUserMessageId === I && Y.phase === "done") && (O?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(O.delivery) || !!(l && jt(l).includes(I) && ["thinking", "steering", "queued", "stopping"].includes(l.phase)));
1656
- }), L = l?.user_message_ids ?? [], de = w || b ? f?.userMessageId ?? null : L[L.length - 1] ?? null, se = p.find((I) => I.userMessageId === de), fe = C ? [...se?.activityIds ?? []].reverse().find((I) => u[I] === "open") ?? null : null, te = s !== null && !!e.selections[n]?.provisionalId && r.length === 0 && a.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
1656
+ }), L = l?.user_message_ids ?? [], de = b || w ? g?.userMessageId ?? null : L[L.length - 1] ?? null, se = p.find((I) => I.userMessageId === de), fe = C ? [...se?.activityIds ?? []].reverse().find((I) => u[I] === "open") ?? null : null, te = s !== null && !!e.selections[n]?.provisionalId && r.length === 0 && a.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
1657
1657
  (!o?.execution || o.execution.phase === "idle" && o.execution.user_message_ids.length === 0) && Object.values(t.operations).some((I) => I.conversationScopeId === n && I.phase === "done" && ["runtime.warmup", "attachment.prepare"].includes(I.command.type) && !I.command.payload.sessionId && I.result?.sessionId === s);
1658
1658
  return Mt({
1659
1659
  selectionKey: n ? JSON.stringify([t.authorityId, t.generation, n]) : void 0,
@@ -1684,7 +1684,7 @@ function kp(t, e) {
1684
1684
  return t.sessionId && i ? { type: "execution", userMessageId: i, sessionId: t.sessionId } : null;
1685
1685
  }
1686
1686
  function Ep(t, e) {
1687
- return Mt({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((n) => [n, zn(t, e, n)])) });
1687
+ return Mt({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((n) => [n, $n(t, e, n)])) });
1688
1688
  }
1689
1689
  function Cp(t, e) {
1690
1690
  if (!e) return !1;
@@ -2193,7 +2193,7 @@ class Yp extends Vp {
2193
2193
  }), this.pollXhr = e;
2194
2194
  }
2195
2195
  }
2196
- let $n = class us extends Ie {
2196
+ let Fn = class us extends Ie {
2197
2197
  /**
2198
2198
  * Request constructor
2199
2199
  *
@@ -2290,8 +2290,8 @@ let $n = class us extends Ie {
2290
2290
  this._cleanup();
2291
2291
  }
2292
2292
  };
2293
- $n.requestsCount = 0;
2294
- $n.requests = {};
2293
+ Fn.requestsCount = 0;
2294
+ Fn.requests = {};
2295
2295
  if (typeof document < "u") {
2296
2296
  if (typeof attachEvent == "function")
2297
2297
  attachEvent("onunload", wc);
@@ -2301,8 +2301,8 @@ if (typeof document < "u") {
2301
2301
  }
2302
2302
  }
2303
2303
  function wc() {
2304
- for (let t in $n.requests)
2305
- $n.requests.hasOwnProperty(t) && $n.requests[t].abort();
2304
+ for (let t in Fn.requests)
2305
+ Fn.requests.hasOwnProperty(t) && Fn.requests[t].abort();
2306
2306
  }
2307
2307
  const Xp = (function() {
2308
2308
  const t = ed({
@@ -2317,7 +2317,7 @@ class Qp extends Yp {
2317
2317
  this.supportsBinary = Xp && !n;
2318
2318
  }
2319
2319
  request(e = {}) {
2320
- return Object.assign(e, { xd: this.xd }, this.opts), new $n(ed, this.uri(), e);
2320
+ return Object.assign(e, { xd: this.xd }, this.opts), new Fn(ed, this.uri(), e);
2321
2321
  }
2322
2322
  }
2323
2323
  function ed(t) {
@@ -3731,10 +3731,10 @@ class id extends Ie {
3731
3731
  }
3732
3732
  }
3733
3733
  }
3734
- function Wn(t) {
3734
+ function Vn(t) {
3735
3735
  t = t || {}, this.ms = t.min || 100, this.max = t.max || 1e4, this.factor = t.factor || 2, this.jitter = t.jitter > 0 && t.jitter <= 1 ? t.jitter : 0, this.attempts = 0;
3736
3736
  }
3737
- Wn.prototype.duration = function() {
3737
+ Vn.prototype.duration = function() {
3738
3738
  var t = this.ms * Math.pow(this.factor, this.attempts++);
3739
3739
  if (this.jitter) {
3740
3740
  var e = Math.random(), n = Math.floor(e * this.jitter * t);
@@ -3742,22 +3742,22 @@ Wn.prototype.duration = function() {
3742
3742
  }
3743
3743
  return Math.min(t, this.max) | 0;
3744
3744
  };
3745
- Wn.prototype.reset = function() {
3745
+ Vn.prototype.reset = function() {
3746
3746
  this.attempts = 0;
3747
3747
  };
3748
- Wn.prototype.setMin = function(t) {
3748
+ Vn.prototype.setMin = function(t) {
3749
3749
  this.ms = t;
3750
3750
  };
3751
- Wn.prototype.setMax = function(t) {
3751
+ Vn.prototype.setMax = function(t) {
3752
3752
  this.max = t;
3753
3753
  };
3754
- Wn.prototype.setJitter = function(t) {
3754
+ Vn.prototype.setJitter = function(t) {
3755
3755
  this.jitter = t;
3756
3756
  };
3757
3757
  class yr extends Ie {
3758
3758
  constructor(e, n) {
3759
3759
  var i;
3760
- super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (n = e, e = void 0), n = n || {}, n.path = n.path || "/socket.io", this.opts = n, Ds(this, n), this.reconnection(n.reconnection !== !1), this.reconnectionAttempts(n.reconnectionAttempts || 1 / 0), this.reconnectionDelay(n.reconnectionDelay || 1e3), this.reconnectionDelayMax(n.reconnectionDelayMax || 5e3), this.randomizationFactor((i = n.randomizationFactor) !== null && i !== void 0 ? i : 0.5), this.backoff = new Wn({
3760
+ super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (n = e, e = void 0), n = n || {}, n.path = n.path || "/socket.io", this.opts = n, Ds(this, n), this.reconnection(n.reconnection !== !1), this.reconnectionAttempts(n.reconnectionAttempts || 1 / 0), this.reconnectionDelay(n.reconnectionDelay || 1e3), this.reconnectionDelayMax(n.reconnectionDelayMax || 5e3), this.randomizationFactor((i = n.randomizationFactor) !== null && i !== void 0 ? i : 0.5), this.backoff = new Vn({
3761
3761
  min: this.reconnectionDelay(),
3762
3762
  max: this.reconnectionDelayMax(),
3763
3763
  jitter: this.randomizationFactor()
@@ -3992,12 +3992,12 @@ class yr extends Ie {
3992
3992
  this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
3993
3993
  }
3994
3994
  }
3995
- const fi = {};
3995
+ const mi = {};
3996
3996
  function fs(t, e) {
3997
3997
  typeof t == "object" && (e = t, t = void 0), e = e || {};
3998
- const n = lh(t, e.path || "/socket.io"), i = n.source, s = n.id, o = n.path, a = fi[s] && o in fi[s].nsps, r = e.forceNew || e["force new connection"] || e.multiplex === !1 || a;
3998
+ const n = lh(t, e.path || "/socket.io"), i = n.source, s = n.id, o = n.path, a = mi[s] && o in mi[s].nsps, r = e.forceNew || e["force new connection"] || e.multiplex === !1 || a;
3999
3999
  let c;
4000
- return r ? c = new yr(i, e) : (fi[s] || (fi[s] = new yr(i, e)), c = fi[s]), n.query && !e.query && (e.query = n.queryKey), c.socket(n.path, e);
4000
+ return r ? c = new yr(i, e) : (mi[s] || (mi[s] = new yr(i, e)), c = mi[s]), n.query && !e.query && (e.query = n.queryKey), c.socket(n.path, e);
4001
4001
  }
4002
4002
  Object.assign(fs, {
4003
4003
  Manager: yr,
@@ -4280,7 +4280,7 @@ class xh {
4280
4280
  connection_id: `pa-sio:${this.socket.id}`,
4281
4281
  request_id: s,
4282
4282
  session_id: e.sessionId ?? e.session_id
4283
- }).replace(/[\u007f-\uffff]/g, (g) => `\\u${g.charCodeAt(0).toString(16).padStart(4, "0")}`)
4283
+ }).replace(/[\u007f-\uffff]/g, (f) => `\\u${f.charCodeAt(0).toString(16).padStart(4, "0")}`)
4284
4284
  },
4285
4285
  body: JSON.stringify({ request_id: s, type: "tool.result", payload: e })
4286
4286
  });
@@ -4352,19 +4352,19 @@ class sd {
4352
4352
  const l = this.options.authenticationFailure?.();
4353
4353
  if (l) throw l;
4354
4354
  const h = this.auth.token;
4355
- let g = null;
4355
+ let f = null;
4356
4356
  try {
4357
4357
  let y = i;
4358
4358
  if (o === "conversations" && e === "/commands" && this.auth.role !== "session_surface" && this.options.executorConnection) {
4359
- if (g = this.options.executorConnection(), !g) throw new U("Reconnecting the browser before continuing.", "executor_not_ready");
4360
- const w = i;
4361
- y = { ...w, context: { ...w.context, connection_id: g } };
4359
+ if (f = this.options.executorConnection(), !f) throw new U("Reconnecting the browser before continuing.", "executor_not_ready");
4360
+ const b = i;
4361
+ y = { ...b, context: { ...b.context, connection_id: f } };
4362
4362
  }
4363
- const f = await (a.timing ? a.timing.measure("http_request", () => this.requestOnce(e, n, y, s, o, a.signal)) : this.requestOnce(e, n, y, s, o, a.signal));
4364
- return c(), f;
4363
+ const g = await (a.timing ? a.timing.measure("http_request", () => this.requestOnce(e, n, y, s, o, a.signal)) : this.requestOnce(e, n, y, s, o, a.signal));
4364
+ return c(), g;
4365
4365
  } catch (y) {
4366
- if (c(), y instanceof U && y.code === "executor_not_ready" && g && p === 0 && this.options.restoreExecutor) {
4367
- await this.options.restoreExecutor(g), c();
4366
+ if (c(), y instanceof U && y.code === "executor_not_ready" && f && p === 0 && this.options.restoreExecutor) {
4367
+ await this.options.restoreExecutor(f), c();
4368
4368
  continue;
4369
4369
  }
4370
4370
  if (!(y instanceof U) || !["unauthorized", "403"].includes(y.code) || !this.options.recoverAuthentication || !u || (await this.options.recoverAuthentication(h, y, u && p === 0), c(), !u || p !== 0)) throw y;
@@ -4373,42 +4373,43 @@ class sd {
4373
4373
  }
4374
4374
  async requestOnce(e, n, i, s, o, a) {
4375
4375
  const r = this.auth.client_kind === "embed", c = new URL(`/api/product-agent/${o ?? (r ? "embed" : "runtime")}${e}`, this.options.backendUrl), u = o === "conversations" ? {} : r ? { client_id: this.auth.client_id, transport_id: this.auth.transport_id } : { community_id: this.auth.community_id, automation_run_id: this.auth.automation_run_id };
4376
- for (const [y, f] of Object.entries({ ...u, ...n }))
4377
- f != null && c.searchParams.set(y, String(f));
4376
+ for (const [g, b] of Object.entries({ ...u, ...n }))
4377
+ b != null && c.searchParams.set(g, String(b));
4378
4378
  this.requests.signal.throwIfAborted(), a?.throwIfAborted();
4379
4379
  const p = new AbortController(), l = () => p.abort();
4380
4380
  this.requests.signal.addEventListener("abort", l, { once: !0 }), a?.addEventListener("abort", l, { once: !0 });
4381
- let h = !1;
4382
- const g = setTimeout(() => {
4383
- h = !0, l();
4381
+ const h = crypto.randomUUID();
4382
+ let f = !1;
4383
+ const y = setTimeout(() => {
4384
+ f = !0, l();
4384
4385
  }, 15e3);
4385
4386
  try {
4386
- const y = await fetch(c, {
4387
+ const g = await fetch(c, {
4387
4388
  method: s ?? (i === void 0 ? "GET" : "POST"),
4388
4389
  cache: "no-store",
4389
4390
  signal: p.signal,
4390
- headers: { authorization: r || o === "conversations" ? `Bearer ${this.auth.token}` : this.auth.token, "content-type": "application/json" },
4391
+ headers: { "x-product-agent-auth-request-id": h, authorization: r || o === "conversations" ? `Bearer ${this.auth.token}` : this.auth.token, "content-type": "application/json" },
4391
4392
  ...i === void 0 ? {} : { body: JSON.stringify(i) }
4392
4393
  });
4393
- if (!y.ok) {
4394
- const f = y.status === 401 ? "unauthorized" : y.status === 426 ? "update_required" : String(y.status), w = (await y.json().catch(() => null))?.detail;
4395
- if (o === "conversations" && e.endsWith("/snapshot") && y.status === 409 && w === "Display projection is not enabled")
4394
+ if (!g.ok) {
4395
+ const b = g.status === 401 ? "unauthorized" : g.status === 426 ? "update_required" : String(g.status), w = (await g.json().catch(() => null))?.detail;
4396
+ if (o === "conversations" && e.endsWith("/snapshot") && g.status === 409 && w === "Display projection is not enabled")
4396
4397
  throw new U("Conversation history is unavailable. Try loading this chat again after the service is ready.", "display_projection_disabled");
4397
- if (o === "conversations" && e === "/commands" && (y.status === 409 && w?.code === "executor_not_ready" && w.retryable === !0 || y.status === 403 && w === "Register the executor before commands"))
4398
+ if (o === "conversations" && e === "/commands" && (g.status === 409 && w?.code === "executor_not_ready" && w.retryable === !0 || g.status === 403 && w === "Register the executor before commands"))
4398
4399
  throw new U("Reconnecting the browser before continuing.", "executor_not_ready");
4399
- if (y.status !== 401 && w && typeof w == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(w.code) || !ki(void 0, w.code).allowed) && typeof w.message == "string")
4400
+ if (g.status !== 401 && w && typeof w == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(w.code) || !ki(void 0, w.code).allowed) && typeof w.message == "string")
4400
4401
  throw new U(w.message, w.code, !1, {
4401
4402
  ...typeof w.blockedOrigin == "string" ? { blockedOrigin: w.blockedOrigin } : {},
4402
4403
  ...typeof w.securitySettingsUrl == "string" ? { securitySettingsUrl: w.securitySettingsUrl } : {}
4403
4404
  });
4404
- const b = w === "Token expired" ? "token_expired" : w?.reason, S = y.status === 401 && ["missing_token", "token_expired", "invalid_token", "user_not_found"].includes(b) ? { reason: b, retryable: b === "token_expired" && (w === "Token expired" || w.retryable === !0) } : void 0;
4405
- throw new U(y.status === 401 ? "Your session expired or is invalid. Reconnect to continue." : y.status === 403 ? "You don't have access to this conversation. Check your access and reconnect." : `Product Agent request failed (${y.status})`, f, !1, S);
4405
+ const S = w === "Token expired" ? "token_expired" : w === "Invalid token" ? "invalid_token" : w?.reason, R = g.status === 401 && ["missing_token", "token_expired", "invalid_token", "user_not_found"].includes(S) ? { requestId: h, authTransport: "http", authEndpoint: `${o ?? (r ? "embed" : "runtime")}:${["snapshot", "me", "bootstrap", "commands", "activity", "session-history"].includes(e.split("/").pop()) ? e.split("/").pop() : "other"}`, reason: S, retryable: S === "token_expired" && (w === "Token expired" || w.retryable === !0) } : void 0;
4406
+ throw new U(g.status === 401 ? "Your session expired or is invalid. Reconnect to continue." : g.status === 403 ? "You don't have access to this conversation. Check your access and reconnect." : `Product Agent request failed (${g.status})`, b, !1, R);
4406
4407
  }
4407
- return await y.json();
4408
- } catch (y) {
4409
- throw h && !this.requests.signal.aborted && !a?.aborted ? new U("The request timed out. Please try again.", "request_timed_out", !0) : y;
4408
+ return await g.json();
4409
+ } catch (g) {
4410
+ throw f && !this.requests.signal.aborted && !a?.aborted ? new U("The request timed out. Please try again.", "request_timed_out", !0) : g;
4410
4411
  } finally {
4411
- clearTimeout(g), this.requests.signal.removeEventListener("abort", l), a?.removeEventListener("abort", l);
4412
+ clearTimeout(y), this.requests.signal.removeEventListener("abort", l), a?.removeEventListener("abort", l);
4412
4413
  }
4413
4414
  }
4414
4415
  }
@@ -4441,7 +4442,7 @@ function od() {
4441
4442
  requestSequence: 0
4442
4443
  });
4443
4444
  }
4444
- function Me(t) {
4445
+ function qe(t) {
4445
4446
  return JSON.stringify([t.kind, t.origin, t.limit]);
4446
4447
  }
4447
4448
  function kh(t) {
@@ -4452,7 +4453,7 @@ function Qe(t) {
4452
4453
  const e = t.currentAuthority();
4453
4454
  return e.authorityId === t.authority.authorityId && e.generation === t.authority.generation;
4454
4455
  }
4455
- function mi(t, e) {
4456
+ function yi(t, e) {
4456
4457
  if (!Qe(t) || e.authorityId !== t.authority.authorityId || e.generation !== t.authority.generation)
4457
4458
  throw new Error("Directory authority is no longer current.");
4458
4459
  }
@@ -4487,18 +4488,18 @@ function Ch(t) {
4487
4488
  return {
4488
4489
  "directory.query": async (i) => {
4489
4490
  try {
4490
- mi(t, i);
4491
+ yi(t, i);
4491
4492
  const s = Si(i.query), o = { origin: s.origin, pinned: s.kind === "pinned", cursor: i.cursor, limit: s.limit };
4492
4493
  let a;
4493
4494
  if (t.http.auth.client_kind === "embed") {
4494
4495
  const r = await t.http.request("/conversations", { ...o, page_url: s.origin ?? t.pageUrl() });
4495
- mi(t, i), a = { entries: await Promise.all(r.sessions.map(async (u) => ({
4496
+ yi(t, i), a = { entries: await Promise.all(r.sessions.map(async (u) => ({
4496
4497
  ...await rd(t.http, u.id),
4497
4498
  ...typeof u.isActive == "boolean" ? { is_active: u.isActive } : {}
4498
4499
  }))), next_cursor: r.nextCursor };
4499
4500
  } else
4500
4501
  a = await t.http.request("/conversations", o, void 0, "GET", e);
4501
- return mi(t, i), { ...a, updatedAt: t.now() };
4502
+ return yi(t, i), { ...a, updatedAt: t.now() };
4502
4503
  } catch (s) {
4503
4504
  throw Qe({ authority: i, currentAuthority: t.currentAuthority }) && t.onError?.(s), s;
4504
4505
  }
@@ -4507,9 +4508,9 @@ function Ch(t) {
4507
4508
  const o = (n.get(i.sessionId) ?? Promise.resolve()).catch(() => {
4508
4509
  }).then(async () => {
4509
4510
  try {
4510
- mi(t, i);
4511
+ yi(t, i);
4511
4512
  const r = await t.http.request(`/conversations/${encodeURIComponent(i.sessionId)}`, {}, i.patch, "PATCH", e);
4512
- return mi(t, i), r;
4513
+ return yi(t, i), r;
4513
4514
  } catch (r) {
4514
4515
  throw Qe({ authority: i, currentAuthority: t.currentAuthority }) && t.onError?.(r), r;
4515
4516
  }
@@ -4574,26 +4575,26 @@ class Ah {
4574
4575
  open(e, n = "replace", i) {
4575
4576
  if (this.disposed || !Qe(this.boundary)) return Promise.resolve();
4576
4577
  e = Si(e);
4577
- const s = Me(e);
4578
+ const s = qe(e);
4578
4579
  return n === "replace" && this.options.runtime.engine.getState().slices.directory.queries[s]?.requestId ? (this.refreshAfterRequest.add(s), Promise.resolve()) : (this.requestPage(e, n, i).catch((o) => this.report(o)), Promise.resolve());
4579
4580
  }
4580
4581
  requestPage(e, n = "replace", i) {
4581
4582
  return e = Si(e), this.enqueueQuery(e, () => this.readPage(e, n, i));
4582
4583
  }
4583
4584
  enqueueQuery(e, n) {
4584
- const i = Me(e), s = this.queryRequests.get(i), o = (async () => (await s?.catch(() => {
4585
+ const i = qe(e), s = this.queryRequests.get(i), o = (async () => (await s?.catch(() => {
4585
4586
  }), n()))();
4586
4587
  return this.queryRequests.set(i, o), o.finally(() => {
4587
4588
  if (this.queryRequests.get(i) === o) {
4588
4589
  this.queryRequests.delete(i);
4589
4590
  for (const a of this.observedQueryStates())
4590
- a.status === "ready" && a.invalidated && this.isObserved(a.query) && !this.queryRequests.has(Me(a.query)) && this.refreshObservedQuery(a.query).catch((r) => this.report(r));
4591
+ a.status === "ready" && a.invalidated && this.isObserved(a.query) && !this.queryRequests.has(qe(a.query)) && this.refreshObservedQuery(a.query).catch((r) => this.report(r));
4591
4592
  }
4592
4593
  }).catch(() => {
4593
4594
  }), o;
4594
4595
  }
4595
4596
  async readPage(e, n, i) {
4596
- for (; !this.disposed && Qe(this.boundary) && this.options.runtime.engine.getState().slices.directory.queries[Me(e)]?.requestId; )
4597
+ for (; !this.disposed && Qe(this.boundary) && this.options.runtime.engine.getState().slices.directory.queries[qe(e)]?.requestId; )
4597
4598
  await this.waitForQuery(e, !1);
4598
4599
  if (this.disposed || !Qe(this.boundary)) throw new Error("Directory authority is no longer current.");
4599
4600
  return await this.options.runtime.engine.dispatch({
@@ -4603,7 +4604,7 @@ class Ah {
4603
4604
  requestId: this.options.nextRequestId(),
4604
4605
  mode: n,
4605
4606
  ...i !== void 0 ? { cursor: i } : {}
4606
- }), await this.waitForQuery(e, !0), this.options.runtime.engine.getState().slices.directory.queries[Me(e)]?.pageData ?? [];
4607
+ }), await this.waitForQuery(e, !0), this.options.runtime.engine.getState().slices.directory.queries[qe(e)]?.pageData ?? [];
4607
4608
  }
4608
4609
  refresh(e, n = !1) {
4609
4610
  return this.refreshPages(e, n, () => !0);
@@ -4614,15 +4615,15 @@ class Ah {
4614
4615
  refreshPages(e, n, i) {
4615
4616
  return e = Si(e), this.enqueueQuery(e, async () => {
4616
4617
  if (!i() || (await this.readPage(e, "replace"), !n)) return;
4617
- let s = this.options.runtime.engine.getState().slices.directory.queries[Me(e)]?.cursor ?? null;
4618
+ let s = this.options.runtime.engine.getState().slices.directory.queries[qe(e)]?.cursor ?? null;
4618
4619
  for (; s !== null && i(); ) {
4619
4620
  const o = s;
4620
- if (await this.readPage(e, "append", o), s = this.options.runtime.engine.getState().slices.directory.queries[Me(e)]?.cursor ?? null, s === o) throw new Error("Conversation directory returned the same cursor twice");
4621
+ if (await this.readPage(e, "append", o), s = this.options.runtime.engine.getState().slices.directory.queries[qe(e)]?.cursor ?? null, s === o) throw new Error("Conversation directory returned the same cursor twice");
4621
4622
  }
4622
4623
  });
4623
4624
  }
4624
4625
  waitForQuery(e, n) {
4625
- const i = Me(e);
4626
+ const i = qe(e);
4626
4627
  return new Promise((s, o) => {
4627
4628
  let a = null;
4628
4629
  const r = () => {
@@ -4639,10 +4640,10 @@ class Ah {
4639
4640
  }
4640
4641
  observedQueryStates() {
4641
4642
  const e = this.options.runtime.engine.getState().slices.directory.queries;
4642
- return this.options.observedQueries().flatMap((n) => e[Me(Si(n))] ?? []);
4643
+ return this.options.observedQueries().flatMap((n) => e[qe(Si(n))] ?? []);
4643
4644
  }
4644
4645
  isObserved(e) {
4645
- return !this.disposed && Qe(this.boundary) && (this.options.enabled?.() ?? !0) && this.observedQueryStates().some((n) => Me(n.query) === Me(e));
4646
+ return !this.disposed && Qe(this.boundary) && (this.options.enabled?.() ?? !0) && this.observedQueryStates().some((n) => qe(n.query) === qe(e));
4646
4647
  }
4647
4648
  async refreshObservedQueries() {
4648
4649
  await Promise.all(this.observedQueryStates().map((e) => this.refreshObservedQuery(e.query)));
@@ -4758,16 +4759,16 @@ class Rh {
4758
4759
  if (e !== void 0 && o.some((c) => c.sessionId !== e)) return !1;
4759
4760
  const a = [], r = new Set(o.map((c) => c.sessionId));
4760
4761
  for (const c of r) {
4761
- const u = o.filter((g) => g.sessionId === c), p = c === null ? u[0] : u.find((g) => g.clientScopeId === i.mains[c]) ?? this.choose(u), l = [p, ...u.filter((g) => g !== p)], h = /* @__PURE__ */ new Set();
4762
- for (const g of l) {
4763
- const y = { ...this.options.authority, clientScopeId: g.clientScopeId, conversationScopeId: g.conversationScopeId, replacement: null };
4764
- g.provisionalId !== null && !h.has(g.conversationScopeId) ? (a.push({ ...y, type: "directory.provisional", provisionalId: g.provisionalId }), c !== null && (a.push({
4762
+ const u = o.filter((f) => f.sessionId === c), p = c === null ? u[0] : u.find((f) => f.clientScopeId === i.mains[c]) ?? this.choose(u), l = [p, ...u.filter((f) => f !== p)], h = /* @__PURE__ */ new Set();
4763
+ for (const f of l) {
4764
+ const y = { ...this.options.authority, clientScopeId: f.clientScopeId, conversationScopeId: f.conversationScopeId, replacement: null };
4765
+ f.provisionalId !== null && !h.has(f.conversationScopeId) ? (a.push({ ...y, type: "directory.provisional", provisionalId: f.provisionalId }), c !== null && (a.push({
4765
4766
  ...this.options.authority,
4766
4767
  type: "directory.accepted",
4767
- conversationScopeId: g.conversationScopeId,
4768
- provisionalId: g.provisionalId,
4768
+ conversationScopeId: f.conversationScopeId,
4769
+ provisionalId: f.provisionalId,
4769
4770
  sessionId: c
4770
- }), h.add(g.conversationScopeId))) : a.push({ ...y, type: "directory.bind", sessionId: c, reason: "user" });
4771
+ }), h.add(f.conversationScopeId))) : a.push({ ...y, type: "directory.bind", sessionId: c, reason: "user" });
4771
4772
  }
4772
4773
  }
4773
4774
  return await Promise.all(a.map((c) => this.options.runtime.engine.dispatch(c))), !0;
@@ -4801,7 +4802,7 @@ function Mh(t, e, n = () => crypto.randomUUID()) {
4801
4802
  };
4802
4803
  }
4803
4804
  }
4804
- class Ne extends EventTarget {
4805
+ class Te extends EventTarget {
4805
4806
  constructor(e) {
4806
4807
  super(), this.options = e, this.httpTransport = new sd({
4807
4808
  ...e,
@@ -5034,7 +5035,7 @@ class Ne extends EventTarget {
5034
5035
  if (i === "auth.session") {
5035
5036
  if (this.initialized) return;
5036
5037
  this.initialized = !0;
5037
- const h = this.bootstrapRequests.signal, g = this.credentialBootstrap ?? await this.httpTransport.request(
5038
+ const h = this.bootstrapRequests.signal, f = this.credentialBootstrap ?? await this.httpTransport.request(
5038
5039
  o ? "/bootstrap" : "/me",
5039
5040
  o ? r : {},
5040
5041
  void 0,
@@ -5042,8 +5043,8 @@ class Ne extends EventTarget {
5042
5043
  void 0,
5043
5044
  { signal: h }
5044
5045
  );
5045
- if (h.aborted || !this.isCurrent(n) || (this.credentialBootstrap = null, !this.options.auth.community_id && g.user?.runtimeCommunityId && (this.options.auth.community_id = g.user.runtimeCommunityId), this.receive({ type: "auth.ok", ...g }), h.aborted)) return;
5046
- this.options.auth.client_kind === "extension" && this.receive({ type: "executor.registered", userId: g.user.id }), this.bootstrapped = !0;
5046
+ if (h.aborted || !this.isCurrent(n) || (this.credentialBootstrap = null, !this.options.auth.community_id && f.user?.runtimeCommunityId && (this.options.auth.community_id = f.user.runtimeCommunityId), this.receive({ type: "auth.ok", ...f }), h.aborted)) return;
5047
+ this.options.auth.client_kind === "extension" && this.receive({ type: "executor.registered", userId: f.user.id }), this.bootstrapped = !0;
5047
5048
  for (const y of this.beforeBootstrap.splice(0)) this.receive(y);
5048
5049
  this.synchronizeReferences(), this.options.auth.client_kind === "web" && this.loadUserSuggestions(h);
5049
5050
  return;
@@ -5053,8 +5054,8 @@ class Ne extends EventTarget {
5053
5054
  return;
5054
5055
  }
5055
5056
  if (i === "starter_prompts.page_url" || i === "starter_prompts.page_context") {
5056
- const h = ++this.promptRevision, g = await this.http("/starter-prompts", r, i === "starter_prompts.page_context" ? { page_url: a, page_title: e.pageTitle ?? "", html_content: e.htmlContent ?? "" } : void 0);
5057
- this.isCurrent(n) && h === this.promptRevision && a === this.options.pageUrl() && this.receive({ type: "starterPrompts.updated", ...g });
5057
+ const h = ++this.promptRevision, f = await this.http("/starter-prompts", r, i === "starter_prompts.page_context" ? { page_url: a, page_title: e.pageTitle ?? "", html_content: e.htmlContent ?? "" } : void 0);
5058
+ this.isCurrent(n) && h === this.promptRevision && a === this.options.pageUrl() && this.receive({ type: "starterPrompts.updated", ...f });
5058
5059
  return;
5059
5060
  }
5060
5061
  if (i === "session.load") {
@@ -5409,7 +5410,7 @@ function kn(t, e) {
5409
5410
  if (!s || s.kind !== e.effectKind) return { state: t, effects: i };
5410
5411
  const o = { ...t.requests };
5411
5412
  if (delete o[e.effectId], n = { ...t, requests: o }, s.kind === "directory.query") {
5412
- const a = Me(s.input.query), r = t.queries[a];
5413
+ const a = qe(s.input.query), r = t.queries[a];
5413
5414
  if (r.requestId !== s.input.requestId) return { state: Mi(n), effects: i };
5414
5415
  if (e.type === "effect.failed")
5415
5416
  n = { ...n, queries: { ...n.queries, [a]: { ...r, status: "error", error: { ...e.error }, requestId: null } } };
@@ -5419,16 +5420,16 @@ function kn(t, e) {
5419
5420
  for (const y of e.output.entries) {
5420
5421
  if (typeof y.is_active != "boolean") continue;
5421
5422
  u[y.conversation_id] = y.is_active;
5422
- const f = r.startedAtActivityRevisionBySessionId[y.conversation_id];
5423
- f !== void 0 && l[y.conversation_id] === f && (delete p[y.conversation_id], delete l[y.conversation_id]);
5423
+ const g = r.startedAtActivityRevisionBySessionId[y.conversation_id];
5424
+ g !== void 0 && l[y.conversation_id] === g && (delete p[y.conversation_id], delete l[y.conversation_id]);
5424
5425
  }
5425
5426
  n = { ...n, durableActivityBySessionId: u, activityBySessionId: p, activityRevisionBySessionId: l };
5426
5427
  const h = Object.fromEntries(Object.entries(n.optimisticEntries).filter(([, y]) => y.sessionId === null || !c.includes(y.sessionId)));
5427
5428
  n = { ...n, optimisticEntries: h };
5428
- const g = [.../* @__PURE__ */ new Set([...r.mode === "append" ? r.data ?? [] : [], ...c])];
5429
+ const f = [.../* @__PURE__ */ new Set([...r.mode === "append" ? r.data ?? [] : [], ...c])];
5429
5430
  n = { ...n, queries: { ...n.queries, [a]: {
5430
5431
  ...r,
5431
- data: g,
5432
+ data: f,
5432
5433
  pageData: c,
5433
5434
  status: "ready",
5434
5435
  requestId: null,
@@ -5494,7 +5495,7 @@ function kn(t, e) {
5494
5495
  const s = `${t.generation}:${t.requestSequence + 1}`, o = { authorityId: e.authorityId, generation: e.generation, requestId: e.requestId };
5495
5496
  let a;
5496
5497
  if (e.type === "directory.query") {
5497
- const r = Me(e.query), c = t.queries[r];
5498
+ const r = qe(e.query), c = t.queries[r];
5498
5499
  if (c?.requestId !== null && c?.requestId !== void 0) return { state: t, effects: i };
5499
5500
  if (e.mode === "append" && e.cursor === void 0 && (!c?.data || c.cursor === null)) return { state: t, effects: i };
5500
5501
  const u = { ...e.query };
@@ -5746,7 +5747,7 @@ class Wh {
5746
5747
  }
5747
5748
  }
5748
5749
  function Vh(t) {
5749
- if (t.details !== void 0 && !jn(t.details))
5750
+ if (t.details !== void 0 && !Hn(t.details))
5750
5751
  throw new TypeError("Product Agent transported error details must be JSON-safe.");
5751
5752
  return {
5752
5753
  code: t.code,
@@ -5829,7 +5830,7 @@ function Rc(t, e, n) {
5829
5830
  for (const [a, r] of Object.entries(n.memberships)) {
5830
5831
  const c = n.clients[r.members[0]];
5831
5832
  if (!c) continue;
5832
- const u = zn(e, n, c), p = zn(t, n, c);
5833
+ const u = $n(e, n, c), p = $n(t, n, c);
5833
5834
  if (u.activity.phase === p.activity.phase) continue;
5834
5835
  const l = ["submitting", "awaiting_execution", "thinking", "steering", "queued", "stopping"].includes(u.activity.phase);
5835
5836
  i = kn(i, { ...s, type: "directory.activity_set", sessionId: a, active: l }).state;
@@ -5864,27 +5865,27 @@ class Zh {
5864
5865
  if (Yh(a)) {
5865
5866
  const c = hp(s.slices.conversation, a, s.slices.directory, s.slices.modelSelection);
5866
5867
  let u = s.slices.directory;
5867
- for (const [g, y] of Object.entries(c.state.operations)) {
5868
- if (!["runtime.warmup", "attachment.prepare"].includes(y.command.type) || !y.conversationScopeId || y.phase !== "done" || s.slices.conversation.operations[g]?.phase === "done") continue;
5869
- const f = y.result, w = u.selections[y.conversationScopeId];
5870
- f?.sessionId && w?.provisionalId && w.sessionId === null && Object.values(u.clients).includes(y.conversationScopeId) && (u = kn(u, {
5868
+ for (const [f, y] of Object.entries(c.state.operations)) {
5869
+ if (!["runtime.warmup", "attachment.prepare"].includes(y.command.type) || !y.conversationScopeId || y.phase !== "done" || s.slices.conversation.operations[f]?.phase === "done") continue;
5870
+ const g = y.result, b = u.selections[y.conversationScopeId];
5871
+ g?.sessionId && b?.provisionalId && b.sessionId === null && Object.values(u.clients).includes(y.conversationScopeId) && (u = kn(u, {
5871
5872
  authorityId: c.state.authorityId,
5872
5873
  generation: c.state.generation,
5873
5874
  type: "directory.accepted",
5874
5875
  conversationScopeId: y.conversationScopeId,
5875
- provisionalId: w.provisionalId,
5876
- sessionId: f.sessionId
5876
+ provisionalId: b.provisionalId,
5877
+ sessionId: g.sessionId
5877
5878
  }).state);
5878
5879
  }
5879
- const p = Object.values(c.state.submissions).find((g) => g.delivery === "accepted" && s.slices.conversation.submissions[g.userMessageId]?.delivery !== "accepted");
5880
+ const p = Object.values(c.state.submissions).find((f) => f.delivery === "accepted" && s.slices.conversation.submissions[f.userMessageId]?.delivery !== "accepted");
5880
5881
  if (p) {
5881
- const g = u.selections[p.conversationScopeId];
5882
- !p.cancelled && g?.provisionalId && (u = kn(u, {
5882
+ const f = u.selections[p.conversationScopeId];
5883
+ !p.cancelled && f?.provisionalId && (u = kn(u, {
5883
5884
  type: "directory.accepted",
5884
5885
  authorityId: c.state.authorityId,
5885
5886
  generation: c.state.generation,
5886
5887
  conversationScopeId: p.conversationScopeId,
5887
- provisionalId: g.provisionalId,
5888
+ provisionalId: f.provisionalId,
5888
5889
  sessionId: p.sessionId
5889
5890
  }).state);
5890
5891
  }
@@ -5925,7 +5926,7 @@ class Zh {
5925
5926
  code: s instanceof Error && "retryable" in s && typeof s.retryable == "boolean" && "code" in s && typeof s.code == "string" ? s.code : "runtime_error",
5926
5927
  message: s instanceof Error ? s.message : String(s),
5927
5928
  retryable: s instanceof Error && "retryable" in s && s.retryable === !0,
5928
- ...s instanceof Error && "details" in s && s.details !== null && typeof s.details == "object" && !Array.isArray(s.details) && jn(s.details) ? { details: s.details } : {}
5929
+ ...s instanceof Error && "details" in s && s.details !== null && typeof s.details == "object" && !Array.isArray(s.details) && Hn(s.details) ? { details: s.details } : {}
5929
5930
  })
5930
5931
  });
5931
5932
  }
@@ -6116,7 +6117,7 @@ function pg(t) {
6116
6117
  return (t.type === "function_call" || t.type === "tool_call") && t.name === ug;
6117
6118
  }
6118
6119
  const Mo = "pluno.productAgent.transportId", hg = "pluno.productAgent.transportIdentity", qo = "pluno.productAgent.transportIdentity.event", gg = 50, fg = globalThis.setTimeout.bind(globalThis);
6119
- let yi = null;
6120
+ let wi = null;
6120
6121
  const ms = /* @__PURE__ */ new Set(), Do = /* @__PURE__ */ new Map();
6121
6122
  async function mg(t = hd()) {
6122
6123
  const e = t.randomUUID(), n = t.storage.getItem(Mo);
@@ -6157,16 +6158,16 @@ async function mg(t = hd()) {
6157
6158
  };
6158
6159
  }
6159
6160
  async function yg(t = !1) {
6160
- yi || (yi = mg({
6161
+ wi || (wi = mg({
6161
6162
  ...hd(),
6162
6163
  skipStoredIdentityCollisionCheck: t
6163
- }), yi.then((s) => {
6164
+ }), wi.then((s) => {
6164
6165
  const o = (a) => {
6165
- a.persisted || (s.release(), yi = null, ms.clear(), window.removeEventListener("pagehide", o));
6166
+ a.persisted || (s.release(), wi = null, ms.clear(), window.removeEventListener("pagehide", o));
6166
6167
  };
6167
6168
  window.addEventListener("pagehide", o);
6168
6169
  }));
6169
- const e = await yi, n = wg();
6170
+ const e = await wi, n = wg();
6170
6171
  ms.add(n);
6171
6172
  let i = !1;
6172
6173
  return {
@@ -6282,7 +6283,7 @@ function xg(t) {
6282
6283
  dueAt: n.dueAt
6283
6284
  };
6284
6285
  }
6285
- function Hn(t, e = /* @__PURE__ */ new Date()) {
6286
+ function Kn(t, e = /* @__PURE__ */ new Date()) {
6286
6287
  const n = new Date(t), i = n.getTime() - e.getTime();
6287
6288
  if (!Number.isFinite(i) || i <= 0)
6288
6289
  return null;
@@ -6304,13 +6305,13 @@ function Hn(t, e = /* @__PURE__ */ new Date()) {
6304
6305
  })} ${o}`;
6305
6306
  }
6306
6307
  function kg(t, e = /* @__PURE__ */ new Date()) {
6307
- const n = Hn(t, e), i = Date.parse(t) - e.getTime();
6308
+ const n = Kn(t, e), i = Date.parse(t) - e.getTime();
6308
6309
  if (!n || !Number.isFinite(i) || i <= 0)
6309
6310
  return null;
6310
6311
  let s = 1, o = 0, a = Math.ceil(i);
6311
6312
  for (; s < a; ) {
6312
6313
  const r = Math.floor((s + a) / 2);
6313
- Hn(
6314
+ Kn(
6314
6315
  t,
6315
6316
  new Date(e.getTime() + r)
6316
6317
  ) === n ? (o = r, s = r + 1) : a = r;
@@ -6754,7 +6755,7 @@ function Uo(t) {
6754
6755
  }
6755
6756
  return { ...e, ...np(t) };
6756
6757
  }
6757
- function wi(t, e, n) {
6758
+ function qn(t, e, n) {
6758
6759
  if (typeof window > "u")
6759
6760
  return;
6760
6761
  const i = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
@@ -6806,7 +6807,7 @@ function zc(t) {
6806
6807
  }
6807
6808
  return !0;
6808
6809
  }
6809
- function qn(t) {
6810
+ function Dn(t) {
6810
6811
  if (t instanceof Error)
6811
6812
  return t;
6812
6813
  if (t && typeof t == "object") {
@@ -6829,8 +6830,8 @@ class Gr {
6829
6830
  authenticationFailure: () => this.authenticationFailure,
6830
6831
  pendingAuthentication: () => this.credentialRecovery ?? (this.credentialRecoveryFailure ? Promise.reject(this.credentialRecoveryFailure) : null),
6831
6832
  recoverAuthentication: (s, o, a) => this.recoverHttpAuthentication(s, o, a),
6832
- executorConnection: () => this.socket instanceof Ne ? this.socket.connectionId : null,
6833
- restoreExecutor: (s) => this.socket instanceof Ne ? this.socket.restoreExecutor(s) : Promise.reject(new U("Browser is reconnecting.", "executor_not_ready")),
6833
+ executorConnection: () => this.socket instanceof Te ? this.socket.connectionId : null,
6834
+ restoreExecutor: (s) => this.socket instanceof Te ? this.socket.restoreExecutor(s) : Promise.reject(new U("Browser is reconnecting.", "executor_not_ready")),
6834
6835
  auth: {
6835
6836
  protocol: 1,
6836
6837
  token: e.token ?? "",
@@ -6889,6 +6890,8 @@ class Gr {
6889
6890
  connectionInProgress = !1;
6890
6891
  token = null;
6891
6892
  rejectedTransportToken = null;
6893
+ /** @internal */
6894
+ invalidCredentialRecoveryAttempted = !1;
6892
6895
  refreshingDefaultCredentials = !1;
6893
6896
  credentialRecovery = null;
6894
6897
  credentialRecoveryFailure = null;
@@ -7027,9 +7030,9 @@ class Gr {
7027
7030
  authority: this.directoryAuthority,
7028
7031
  http: this.directoryHttp,
7029
7032
  isActiveTurn: (n) => this.clientRuntime.engine.getProjection().directory.activityBySessionId[n] === !0,
7030
- nextRequestId: Re,
7033
+ nextRequestId: Pe,
7031
7034
  onError: (n) => {
7032
- this.handleDirectoryTransportError(n), this.emit("error", qn(n));
7035
+ this.handleDirectoryTransportError(n), this.emit("error", Dn(n));
7033
7036
  },
7034
7037
  wakeup: { start: () => {
7035
7038
  }, stop: () => {
@@ -7062,14 +7065,14 @@ class Gr {
7062
7065
  isCurrent: i,
7063
7066
  http: this.directoryHttp,
7064
7067
  now: () => Date.now(),
7065
- connectionId: () => this.socket instanceof Ne ? this.socket.connectionId : null,
7068
+ connectionId: () => this.socket instanceof Te ? this.socket.connectionId : null,
7066
7069
  prepareUpload: this.options.prepareAttachmentUpload ?? (this.options.productVariant === "customer_embedded" ? (l) => this.prepareEmbedAttachmentUpload(l, i) : void 0),
7067
- onUploaded: async (l, h, g) => {
7070
+ onUploaded: async (l, h, f) => {
7068
7071
  await ld(l, {
7069
7072
  sessionId: h,
7070
- sandboxPath: g.sandbox_path ?? void 0,
7071
- storageKey: g.storage_key ?? void 0,
7072
- fileUrl: g.file_url ? new URL(g.file_url, this.options.backendUrl).toString() : void 0,
7073
+ sandboxPath: f.sandbox_path ?? void 0,
7074
+ storageKey: f.storage_key ?? void 0,
7075
+ fileUrl: f.file_url ? new URL(f.file_url, this.options.backendUrl).toString() : void 0,
7073
7076
  lastUsedAt: Date.now()
7074
7077
  }).catch((y) => Ue("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
7075
7078
  attachmentId: l,
@@ -7089,22 +7092,22 @@ class Gr {
7089
7092
  onTiming: (l) => {
7090
7093
  i() && this.reportOperationTiming(l);
7091
7094
  },
7092
- onCommand: (l) => wi("client_event", l.type, Uo({ ...l.payload, type: l.type })),
7095
+ onCommand: (l) => qn("client_event", l.type, Uo({ ...l.payload, type: l.type })),
7093
7096
  onError: (l) => this.handleDirectoryTransportError(l)
7094
7097
  }),
7095
7098
  "conversation.interactions": this.createConversationInteractionPort()
7096
7099
  });
7097
7100
  const o = this.clientRuntime.engine.getState().slices.conversation, a = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null : cc(s);
7098
7101
  if (this.authenticatedUserId && !o.submissionOrder.length && !Object.keys(o.operations).length) {
7099
- const l = this.queuedClientEvents.filter((g) => g.type === "chat.user_message"), h = a ? JSON.parse(a) : l.length ? rp(o, l.map((g) => {
7100
- const { type: y, ...f } = g, w = this.clientRuntime.engine.getState().slices.directory, b = w.clients[this.modelClientScopeId];
7102
+ const l = this.queuedClientEvents.filter((f) => f.type === "chat.user_message"), h = a ? JSON.parse(a) : l.length ? rp(o, l.map((f) => {
7103
+ const { type: y, ...g } = f, b = this.clientRuntime.engine.getState().slices.directory, w = b.clients[this.modelClientScopeId];
7101
7104
  return {
7102
- command: { type: y, request_id: g.clientMessageId, payload: JSON.parse(JSON.stringify(f)) },
7103
- requestedModel: g.model ?? null,
7105
+ command: { type: y, request_id: f.clientMessageId, payload: JSON.parse(JSON.stringify(g)) },
7106
+ requestedModel: f.model ?? null,
7104
7107
  clientScopeId: this.modelClientScopeId,
7105
- conversationScopeId: b,
7108
+ conversationScopeId: w,
7106
7109
  viewId: `sdk:${this.modelClientScopeId}`,
7107
- sessionId: g.sessionId ?? w.selections[b]?.sessionId ?? null,
7110
+ sessionId: f.sessionId ?? b.selections[w]?.sessionId ?? null,
7108
7111
  entrySurface: this.options.entrySurface,
7109
7112
  submittedAt: Date.now()
7110
7113
  };
@@ -7120,19 +7123,19 @@ class Gr {
7120
7123
  enabled: () => !!this.token && !this.authenticationFailure && !this.refreshingDefaultCredentials && this.state.status !== "closed",
7121
7124
  socket: {
7122
7125
  retain: async (l, h) => {
7123
- const g = this.socket;
7124
- g instanceof Ne && await g.directoryRooms.retain(l, h).catch((y) => {
7125
- if (this.socket === g) throw y;
7126
+ const f = this.socket;
7127
+ f instanceof Te && await f.directoryRooms.retain(l, h).catch((y) => {
7128
+ if (this.socket === f) throw y;
7126
7129
  });
7127
7130
  },
7128
7131
  release: async (l, h) => {
7129
- const g = this.socket;
7130
- g instanceof Ne && await g.directoryRooms.release(l, h).catch((y) => {
7131
- if (this.socket === g) throw y;
7132
+ const f = this.socket;
7133
+ f instanceof Te && await f.directoryRooms.release(l, h).catch((y) => {
7134
+ if (this.socket === f) throw y;
7132
7135
  });
7133
7136
  }
7134
7137
  },
7135
- nextRequestId: Re,
7138
+ nextRequestId: Pe,
7136
7139
  wakeup: { start: () => {
7137
7140
  }, stop: () => {
7138
7141
  } },
@@ -7142,34 +7145,34 @@ class Gr {
7142
7145
  this.conversationUnsubscribe = this.clientRuntime.engine.subscribe(() => {
7143
7146
  const l = this.clientRuntime.engine.getState().slices, h = c;
7144
7147
  c = l.conversation;
7145
- const g = p !== l.directory.clients[this.modelClientScopeId];
7148
+ const f = p !== l.directory.clients[this.modelClientScopeId];
7146
7149
  p = l.directory.clients[this.modelClientScopeId], u !== l.directory.selections && (u = l.directory.selections, this.directoryScope.persist());
7147
- for (const f of Object.values(l.conversation.submissions)) {
7148
- if (f.delivery === "accepted" && h.submissions[f.userMessageId]?.delivery !== "accepted") {
7149
- this.emit("ack", { clientMessageId: f.userMessageId, sessionId: f.sessionId });
7150
- const w = f.sessionId;
7151
- w && this.getState().sessionId === w && this.directoryHttp.request(`/sessions/${encodeURIComponent(w)}/history`, { limit: 200 }).then((b) => {
7152
- i() && this.getState().sessionId === w && this.state.status !== "closed" && Oo(this.clientRuntime, this.modelClientScopeId, w, b.turns);
7153
- }).catch((b) => {
7154
- i() && this.getState().sessionId === w && this.handleDirectoryTransportError(b);
7150
+ for (const g of Object.values(l.conversation.submissions)) {
7151
+ if (g.delivery === "accepted" && h.submissions[g.userMessageId]?.delivery !== "accepted") {
7152
+ this.emit("ack", { clientMessageId: g.userMessageId, sessionId: g.sessionId });
7153
+ const b = g.sessionId;
7154
+ b && this.getState().sessionId === b && this.directoryHttp.request(`/sessions/${encodeURIComponent(b)}/history`, { limit: 200 }).then((w) => {
7155
+ i() && this.getState().sessionId === b && this.state.status !== "closed" && Oo(this.clientRuntime, this.modelClientScopeId, b, w.turns);
7156
+ }).catch((w) => {
7157
+ i() && this.getState().sessionId === b && this.handleDirectoryTransportError(w);
7155
7158
  });
7156
7159
  }
7157
- (f.cancelled || f.delivery === "failed") && this.clearFirstResponseTimer(f.userMessageId);
7160
+ (g.cancelled || g.delivery === "failed") && this.clearFirstResponseTimer(g.userMessageId);
7158
7161
  }
7159
- for (const [f, w] of Object.entries(l.directory.clients)) {
7160
- if (!f.startsWith(`background:${this.modelClientScopeId}:`)) continue;
7161
- const b = zn(l.conversation, l.directory, w);
7162
- (g && b.sessionId === this.getState().sessionId || ["completed", "failed", "stopped"].includes(b.activity.phase)) && this.directoryScope.detach(f);
7162
+ for (const [g, b] of Object.entries(l.directory.clients)) {
7163
+ if (!g.startsWith(`background:${this.modelClientScopeId}:`)) continue;
7164
+ const w = $n(l.conversation, l.directory, b);
7165
+ (f && w.sessionId === this.getState().sessionId || ["completed", "failed", "stopped"].includes(w.activity.phase)) && this.directoryScope.detach(g);
7163
7166
  }
7164
7167
  const y = this.getState();
7165
- for (const f of y.messages) {
7166
- const w = r.get(f.id);
7167
- if ((!w || w.content !== f.content || w.loading !== f.loading) && this.emit("message", f), f.content.trim() && f.content !== w?.content) {
7168
- const b = f.role === "assistant" || f.dataType === "commentary_history";
7169
- b && f.content.startsWith(w?.content ?? "") && this.emit("delta", f.content.slice(w?.content.length ?? 0)), (b || f.dataType === "tool_summary") && this.clearFirstResponseTimer(f.respondsToUserMessageId ?? null, !0);
7168
+ for (const g of y.messages) {
7169
+ const b = r.get(g.id);
7170
+ if ((!b || b.content !== g.content || b.loading !== g.loading) && this.emit("message", g), g.content.trim() && g.content !== b?.content) {
7171
+ const w = g.role === "assistant" || g.dataType === "commentary_history";
7172
+ w && g.content.startsWith(b?.content ?? "") && this.emit("delta", g.content.slice(b?.content.length ?? 0)), (w || g.dataType === "tool_summary") && this.clearFirstResponseTimer(g.respondsToUserMessageId ?? null, !0);
7170
7173
  }
7171
7174
  }
7172
- r = new Map(y.messages.map((f) => [f.id, f])), this.rebuildRuntimeInteractions(), this.emit("state", y);
7175
+ r = new Map(y.messages.map((g) => [g.id, g])), this.rebuildRuntimeInteractions(), this.emit("state", y);
7173
7176
  }), this.conversationObservation.wake();
7174
7177
  }
7175
7178
  async initializeDirectory() {
@@ -7183,7 +7186,7 @@ class Gr {
7183
7186
  this.modelClientScopeId,
7184
7187
  this.directoryConversationScopeId,
7185
7188
  n
7186
- ) : (this.directoryProvisionalId = Re(), await this.directoryScope.provisional(
7189
+ ) : (this.directoryProvisionalId = Pe(), await this.directoryScope.provisional(
7187
7190
  this.modelClientScopeId,
7188
7191
  this.directoryConversationScopeId,
7189
7192
  this.directoryProvisionalId
@@ -7212,7 +7215,7 @@ class Gr {
7212
7215
  );
7213
7216
  }
7214
7217
  async beginDirectoryProvisional() {
7215
- const e = Re();
7218
+ const e = Pe();
7216
7219
  this.directoryProvisionalId = e, this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}:${e}`, await this.directoryScope.provisional(
7217
7220
  this.modelClientScopeId,
7218
7221
  this.directoryConversationScopeId,
@@ -7224,7 +7227,7 @@ class Gr {
7224
7227
  return i.add(n), this.listeners[e] = i, () => i.delete(n);
7225
7228
  }
7226
7229
  getState() {
7227
- const e = this.clientRuntime.engine.getState().slices, n = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, i = zn(e.conversation, e.directory, n), s = xp(
7230
+ const e = this.clientRuntime.engine.getState().slices, n = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, i = $n(e.conversation, e.directory, n), s = xp(
7228
7231
  i,
7229
7232
  i.sessionId ? e.conversation.sessions[i.sessionId]?.queries.current : void 0,
7230
7233
  this.options.backendUrl,
@@ -7252,7 +7255,7 @@ class Gr {
7252
7255
  ...this.directoryAuthority,
7253
7256
  type: "conversation.proactive_edit",
7254
7257
  conversationScopeId: i,
7255
- id: `proactive-edit:${Re()}`,
7258
+ id: `proactive-edit:${Pe()}`,
7256
7259
  content: n
7257
7260
  });
7258
7261
  }
@@ -7301,7 +7304,7 @@ class Gr {
7301
7304
  }
7302
7305
  async connect() {
7303
7306
  return this.clientRuntime.route("conversation", { core: async () => {
7304
- if (this.socket instanceof Ne && this.socket.initialReadinessExpired) {
7307
+ if (this.socket instanceof Te && this.socket.initialReadinessExpired) {
7305
7308
  const s = this.socket;
7306
7309
  await new Promise((o) => {
7307
7310
  const a = () => {
@@ -7332,11 +7335,11 @@ class Gr {
7332
7335
  this.setState({ status: "error", lastError: i });
7333
7336
  return;
7334
7337
  }
7335
- if (this.socket instanceof Ne) {
7338
+ if (this.socket instanceof Te) {
7336
7339
  await this.replaceDefaultTransportCredentials(this.socket);
7337
7340
  return;
7338
7341
  }
7339
- const s = Df(this.options.backendUrl), o = this.options.webSocketFactory?.(s) ?? new Ne({
7342
+ const s = Df(this.options.backendUrl), o = this.options.webSocketFactory?.(s) ?? new Te({
7340
7343
  displaySchema: "canonical",
7341
7344
  backendUrl: this.options.backendUrl,
7342
7345
  entrySurface: this.options.entrySurface,
@@ -7377,12 +7380,12 @@ class Gr {
7377
7380
  if (this.socket !== o)
7378
7381
  return;
7379
7382
  const r = Hc(a.data);
7380
- if (o instanceof Ne && r.type === "tool.call" && !Hf(r)) {
7383
+ if (o instanceof Te && r.type === "tool.call" && !Hf(r)) {
7381
7384
  this.setState({ status: "error", lastError: "Invalid tool-call envelope", lastErrorCode: "invalid_tool_call" });
7382
7385
  return;
7383
7386
  }
7384
7387
  const c = this.handleServerEvent(r);
7385
- o instanceof Ne && r.type === "tool.call" && c === !0 && o.acceptMessage(a);
7388
+ o instanceof Te && r.type === "tool.call" && c === !0 && o.acceptMessage(a);
7386
7389
  }), o.addEventListener("sendfailure", (a) => {
7387
7390
  this.socket === o && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), o.readyState !== WebSocket.CLOSED && o.readyState !== WebSocket.CLOSING && o.close());
7388
7391
  }), o.addEventListener("close", (a) => {
@@ -7409,7 +7412,7 @@ class Gr {
7409
7412
  this.handleDirectoryTransportError(s);
7410
7413
  return;
7411
7414
  }
7412
- const o = qn(s);
7415
+ const o = Dn(s);
7413
7416
  if (zc(s)) {
7414
7417
  Ue("web-sdk.agent", "Pluno connection attempt failed; retrying", {
7415
7418
  message: o.message,
@@ -7455,7 +7458,7 @@ class Gr {
7455
7458
  this.authenticatingWarmupHints.delete(r), !(this.clientRuntime.isDisposed || o !== this.submissionIntentRevision || a && a !== this.authenticatedUserId) && this.warmup(e);
7456
7459
  }, (c) => {
7457
7460
  this.authenticatingWarmupHints.delete(r), this.clientRuntime.isDisposed || Ue("web-sdk.warmup", "Authentication did not admit the warm-up hint", {
7458
- message: qn(c).message
7461
+ message: Dn(c).message
7459
7462
  });
7460
7463
  });
7461
7464
  return;
@@ -7463,13 +7466,13 @@ class Gr {
7463
7466
  if (!this.token) return;
7464
7467
  const n = this.getState().sessionId, i = this.activeComposerWarmupId ? this.clientRuntime.engine.getState().slices.conversation.operations[this.activeComposerWarmupId] : void 0;
7465
7468
  if (e === "composer_input" && i && ["waiting", "running", "uncertain"].includes(i.phase)) return;
7466
- const s = e === "composer_input" ? Re() : null;
7469
+ const s = e === "composer_input" ? Pe() : null;
7467
7470
  s && (this.activeComposerWarmupId = s), this.clientRuntime.engine.dispatch({
7468
7471
  ...this.directoryAuthority,
7469
7472
  type: "conversation.operation",
7470
7473
  ...s ? { conversationScopeId: this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId] } : {},
7471
7474
  command: {
7472
- request_id: s ?? Re(),
7475
+ request_id: s ?? Pe(),
7473
7476
  type: "runtime.warmup",
7474
7477
  payload: {
7475
7478
  reason: e,
@@ -7503,7 +7506,7 @@ class Gr {
7503
7506
  if (!i && !s.length) return null;
7504
7507
  if (this.options.productVariant === "customer_embedded" && (s.forEach(Cd), s.reduce((k, C) => k + C.sizeBytes, 0) > md))
7505
7508
  throw new Error("Embedded attachments must total at most 50 MB per message");
7506
- const o = n.clientMessageId ?? Re(), a = Bn(this.operationTimingReporter, {
7509
+ const o = n.clientMessageId ?? Pe(), a = zn(this.operationTimingReporter, {
7507
7510
  operation: "send",
7508
7511
  layer: "sdk",
7509
7512
  requestId: o,
@@ -7513,7 +7516,7 @@ class Gr {
7513
7516
  a.mark("submit");
7514
7517
  const r = Lc(this.clientRuntime, this.modelClientScopeId, o), c = this.submissionIntentRevision, u = this.authenticatedUserId;
7515
7518
  n.initiatedBy || this.startFirstResponseTimer(o, n.submittedAt);
7516
- const p = a.measure("authentication", () => this.waitForAuthentication()).then(() => null, (k) => qn(k));
7519
+ const p = a.measure("authentication", () => this.waitForAuthentication()).then(() => null, (k) => Dn(k));
7517
7520
  if (!u) {
7518
7521
  const k = await p;
7519
7522
  if (k) throw k;
@@ -7522,16 +7525,16 @@ class Gr {
7522
7525
  Lc(this.clientRuntime, this.modelClientScopeId, o, r ?? null);
7523
7526
  const l = this.clientRuntime.engine.getState().slices.conversation.submissions[o];
7524
7527
  if (l && (l.content !== i || JSON.stringify(l.attachments.map((k) => k.sourceId)) !== JSON.stringify(s.map((k) => k.id ?? k.storageKey ?? k.sandboxPath)))) throw new Error("User-message identity cannot be reused with different input.");
7525
- const h = yt(), g = !l && !n.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== h.url, f = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
7526
- if (!f) throw new Error("Conversation selection is not initialized.");
7528
+ const h = yt(), f = !l && !n.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== h.url, g = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
7529
+ if (!g) throw new Error("Conversation selection is not initialized.");
7527
7530
  l || await this.clientRuntime.engine.dispatch({
7528
7531
  ...this.directoryAuthority,
7529
7532
  type: "conversation.submission_stage",
7530
- prepareContext: g,
7533
+ prepareContext: f,
7531
7534
  userMessageId: o,
7532
7535
  requestId: o,
7533
7536
  clientScopeId: this.modelClientScopeId,
7534
- conversationScopeId: f,
7537
+ conversationScopeId: g,
7535
7538
  viewId: `sdk:${this.modelClientScopeId}`,
7536
7539
  rendererRevision: n.submittedAt ?? ++this.composerRevision,
7537
7540
  content: i,
@@ -7558,7 +7561,7 @@ class Gr {
7558
7561
  invocation: Mf(n.invocation ?? n.initiatedBy),
7559
7562
  entrySurface: this.options.entrySurface,
7560
7563
  submittedAt: n.submittedAt ?? Date.now()
7561
- }), g && await a.measure("first_frame", () => new Promise((k) => {
7564
+ }), f && await a.measure("first_frame", () => new Promise((k) => {
7562
7565
  if (document.visibilityState !== "visible") {
7563
7566
  setTimeout(k, 0);
7564
7567
  return;
@@ -7586,26 +7589,26 @@ class Gr {
7586
7589
  userMessageId: o,
7587
7590
  requestId: o,
7588
7591
  delivery: "failed",
7589
- error: { code: "page_capture_failed", message: qn(k).message, retryable: !1 }
7592
+ error: { code: "page_capture_failed", message: Dn(k).message, retryable: !1 }
7590
7593
  }), k;
7591
7594
  }), a.mark("context_ready");
7592
- const w = await p;
7595
+ const b = await p;
7593
7596
  if (this.clientRuntime.isDisposed || c !== this.submissionIntentRevision || u && u !== this.authenticatedUserId) return null;
7594
- if (w)
7597
+ if (b)
7595
7598
  throw this.clientRuntime.engine.accept({
7596
7599
  ...this.directoryAuthority,
7597
7600
  type: "conversation.submission_delivery",
7598
7601
  userMessageId: o,
7599
7602
  requestId: o,
7600
7603
  delivery: "failed",
7601
- error: { code: "authentication_failed", message: w.message, retryable: !1 }
7602
- }), w;
7603
- const b = this.clientRuntime.engine.getState().slices.conversation.submissions[o], S = b?.invocation === "user" && b.contextPreparation?.pageContent ? b.context.page?.url : null, R = this.directoryAuthority;
7604
+ error: { code: "authentication_failed", message: b.message, retryable: !1 }
7605
+ }), b;
7606
+ const w = this.clientRuntime.engine.getState().slices.conversation.submissions[o], S = w?.invocation === "user" && w.contextPreparation?.pageContent ? w.context.page?.url : null, R = this.directoryAuthority;
7604
7607
  return await this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.submit", userMessageId: o, now: Date.now() }), this.clientRuntime.isDisposed ? null : new Promise((k, C) => {
7605
7608
  let D = null, q = null;
7606
7609
  const Z = () => {
7607
7610
  const L = this.clientRuntime.engine.getState().slices.conversation.submissions[o];
7608
- L && !L.cancelled && L.delivery !== "accepted" && L.delivery !== "failed" || (D?.(), q?.(), L?.delivery === "failed" && !L.cancelled ? C(new Error(L.error?.message ?? "Message delivery failed.")) : (L?.delivery === "accepted" && !L.cancelled && typeof S == "string" && c === this.submissionIntentRevision && R === this.directoryAuthority && this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId] === f && (this.lastUserMessagePageUrl = S), k(L?.delivery === "accepted" && !L.cancelled ? o : null)));
7611
+ L && !L.cancelled && L.delivery !== "accepted" && L.delivery !== "failed" || (D?.(), q?.(), L?.delivery === "failed" && !L.cancelled ? C(new Error(L.error?.message ?? "Message delivery failed.")) : (L?.delivery === "accepted" && !L.cancelled && typeof S == "string" && c === this.submissionIntentRevision && R === this.directoryAuthority && this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId] === g && (this.lastUserMessagePageUrl = S), k(L?.delivery === "accepted" && !L.cancelled ? o : null)));
7609
7612
  };
7610
7613
  D = this.clientRuntime.engine.subscribe(Z), q = this.clientRuntime.onDispose(() => {
7611
7614
  D?.(), k(null);
@@ -7641,9 +7644,9 @@ class Gr {
7641
7644
  } });
7642
7645
  }
7643
7646
  retryLastMessage() {
7644
- const e = this.clientRuntime.engine.getState().slices, n = e.directory.clients[this.modelClientScopeId], i = zn(e.conversation, e.directory, n), s = kp(i);
7647
+ const e = this.clientRuntime.engine.getState().slices, n = e.directory.clients[this.modelClientScopeId], i = $n(e.conversation, e.directory, n), s = kp(i);
7645
7648
  return s ? s.type === "delivery" ? (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.submit", userMessageId: s.userMessageId, now: Date.now(), manualRetry: !0 }), !0) : (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.operation", command: {
7646
- request_id: Re(),
7649
+ request_id: Pe(),
7647
7650
  type: "chat.retry_last_user_message",
7648
7651
  payload: {
7649
7652
  sessionId: s.sessionId,
@@ -7654,7 +7657,7 @@ class Gr {
7654
7657
  }
7655
7658
  createLocalAttachment(e) {
7656
7659
  this.options.productVariant === "customer_embedded" && Ed(e);
7657
- const n = Re(), i = {
7660
+ const n = Pe(), i = {
7658
7661
  id: n,
7659
7662
  name: e.name || "attachment",
7660
7663
  mimeType: kd(e),
@@ -7697,14 +7700,14 @@ class Gr {
7697
7700
  } }
7698
7701
  }), new Promise((u, p) => {
7699
7702
  let l, h;
7700
- const g = () => {
7701
- const y = this.clientRuntime.engine.getState().slices, f = y.conversation.operations[c], w = y.directory.authorityId !== a.authorityId || y.directory.clients[this.modelClientScopeId] !== r;
7702
- if (!w && f && !["done", "failed"].includes(f.phase)) return;
7703
- if (l?.(), h?.(), w || !f || f.phase === "failed") {
7704
- p(new Error(f?.error?.message ?? "Attachment preparation was cancelled."));
7703
+ const f = () => {
7704
+ const y = this.clientRuntime.engine.getState().slices, g = y.conversation.operations[c], b = y.directory.authorityId !== a.authorityId || y.directory.clients[this.modelClientScopeId] !== r;
7705
+ if (!b && g && !["done", "failed"].includes(g.phase)) return;
7706
+ if (l?.(), h?.(), b || !g || g.phase === "failed") {
7707
+ p(new Error(g?.error?.message ?? "Attachment preparation was cancelled."));
7705
7708
  return;
7706
7709
  }
7707
- const S = f.result.attachment;
7710
+ const S = g.result.attachment;
7708
7711
  u(xd({
7709
7712
  id: S.id,
7710
7713
  name: S.name,
@@ -7715,9 +7718,9 @@ class Gr {
7715
7718
  fileUrl: S.file_url
7716
7719
  }, this.options.backendUrl));
7717
7720
  };
7718
- l = this.clientRuntime.engine.subscribe(g), h = this.clientRuntime.onDispose(() => {
7721
+ l = this.clientRuntime.engine.subscribe(f), h = this.clientRuntime.onDispose(() => {
7719
7722
  l?.(), p(new Error("Product Agent was disposed."));
7720
- }), g();
7723
+ }), f();
7721
7724
  });
7722
7725
  }
7723
7726
  async prepareEmbedAttachmentUpload(e, n) {
@@ -7743,10 +7746,10 @@ class Gr {
7743
7746
  }
7744
7747
  stop() {
7745
7748
  const e = this.getState();
7746
- Bn((n) => this.reportOperationTiming(n), {
7749
+ zn((n) => this.reportOperationTiming(n), {
7747
7750
  operation: "stop",
7748
7751
  layer: "sdk",
7749
- requestId: Re(),
7752
+ requestId: Pe(),
7750
7753
  clientMessageId: e.activeResponseUserMessageId ?? e.messages.filter((n) => n.role === "user").slice(-1)[0]?.id ?? null,
7751
7754
  sessionId: e.sessionId
7752
7755
  }).mark("stop"), this.stopConversation("user_requested");
@@ -7763,7 +7766,7 @@ class Gr {
7763
7766
  type: "conversation.stop",
7764
7767
  clientScopeId: this.modelClientScopeId,
7765
7768
  conversationScopeId: i,
7766
- requestId: Re(),
7769
+ requestId: Pe(),
7767
7770
  reason: e
7768
7771
  });
7769
7772
  }
@@ -7773,7 +7776,7 @@ class Gr {
7773
7776
  resetConversationSelection(e) {
7774
7777
  const n = this.getState();
7775
7778
  this.retainNavigatedConversation(), !this.options.keepRunsActiveOnSessionNavigation && e.notifyTransport !== !1 && this.stopConversation("new_chat"), this.cleanupSessionBrowserApis(), e.notifyTransport !== !1 && n.sessionId && this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.operation", command: {
7776
- request_id: Re(),
7779
+ request_id: Pe(),
7777
7780
  type: "session.reset",
7778
7781
  payload: {
7779
7782
  sessionId: n.sessionId,
@@ -7788,7 +7791,7 @@ class Gr {
7788
7791
  n,
7789
7792
  i !== null ? "append" : "replace",
7790
7793
  i ?? void 0
7791
- ), o = this.clientRuntime.engine.getProjection().directory, a = o.queries[Me(n)];
7794
+ ), o = this.clientRuntime.engine.getProjection().directory, a = o.queries[qe(n)];
7792
7795
  if (a.error) throw new Error(a.error.message);
7793
7796
  return {
7794
7797
  sessions: s.map((r) => this.toSessionHistoryEntry(o.entities[r])),
@@ -7798,7 +7801,7 @@ class Gr {
7798
7801
  }
7799
7802
  getSessionHistoryState() {
7800
7803
  return this.clientRuntime.project("directory", { core: () => {
7801
- const e = this.clientRuntime.engine.getProjection().directory, n = e.queries[Me(this.getDirectoryQuery("recent"))], s = [e.queries[Me(this.getDirectoryQuery("pinned"))], n].filter((l) => l !== void 0), o = Object.values(e.optimisticEntries).reverse(), a = [...new Set(s.flatMap((l) => l.data ?? []))], r = new Set(o.flatMap((l) => l.sessionId ? [l.sessionId] : [])), c = [...o.map((l) => l.id), ...a.filter((l) => !r.has(l))], u = Object.fromEntries([
7804
+ const e = this.clientRuntime.engine.getProjection().directory, n = e.queries[qe(this.getDirectoryQuery("recent"))], s = [e.queries[qe(this.getDirectoryQuery("pinned"))], n].filter((l) => l !== void 0), o = Object.values(e.optimisticEntries).reverse(), a = [...new Set(s.flatMap((l) => l.data ?? []))], r = new Set(o.flatMap((l) => l.sessionId ? [l.sessionId] : [])), c = [...o.map((l) => l.id), ...a.filter((l) => !r.has(l))], u = Object.fromEntries([
7802
7805
  ...o.map((l) => [l.id, {
7803
7806
  id: l.id,
7804
7807
  title: null,
@@ -7836,13 +7839,13 @@ class Gr {
7836
7839
  }
7837
7840
  loadMoreSessionHistory() {
7838
7841
  return this.clientRuntime.route("directory", { core: async () => {
7839
- const e = this.getDirectoryQuery("recent"), n = this.clientRuntime.engine.getState().slices.directory.queries[Me(e)];
7842
+ const e = this.getDirectoryQuery("recent"), n = this.clientRuntime.engine.getState().slices.directory.queries[qe(e)];
7840
7843
  n?.cursor && await this.directoryObservation.requestPage(e, "append", n.cursor);
7841
7844
  } });
7842
7845
  }
7843
7846
  setSessionPinned(e, n) {
7844
7847
  return this.clientRuntime.route("directory", { core: async () => {
7845
- const i = Re();
7848
+ const i = Pe();
7846
7849
  await this.clientRuntime.engine.dispatch({
7847
7850
  ...this.directoryAuthority,
7848
7851
  type: "directory.mutate",
@@ -7862,7 +7865,7 @@ class Gr {
7862
7865
  }
7863
7866
  renameSession(e, n) {
7864
7867
  return this.clientRuntime.route("directory", { core: async () => {
7865
- const i = Re();
7868
+ const i = Pe();
7866
7869
  await this.clientRuntime.engine.dispatch({
7867
7870
  ...this.directoryAuthority,
7868
7871
  type: "directory.mutate",
@@ -8120,7 +8123,7 @@ class Gr {
8120
8123
  const n = this.clientRuntime.engine.getProjection().directory;
8121
8124
  if (Object.values(n.optimisticEntries).some((s) => s.id === e && s.sessionId === null)) return;
8122
8125
  !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.stopConversation("session_switch"), this.retainNavigatedConversation();
8123
- const i = "conversation:" + this.modelClientScopeId + ":" + Re();
8126
+ const i = "conversation:" + this.modelClientScopeId + ":" + Pe();
8124
8127
  this.directoryConversationScopeId = i, this.lastUserMessagePageUrl = null, this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: e }), this.directoryScope.bind(this.modelClientScopeId, this.directoryConversationScopeId, e).then(async () => {
8125
8128
  await this.directoryScope.persist(), this.state.sessionId === e && (n.intents[e]?.observe && this.conversationObservation?.refresh(e).catch((s) => this.handleDirectoryTransportError(s)), this.send({ type: "page.upsert", sessionId: e, page: yt(), model: this.getModel() }));
8126
8129
  });
@@ -8133,14 +8136,14 @@ class Gr {
8133
8136
  if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
8134
8137
  return !1;
8135
8138
  const n = this.socket;
8136
- if ((e.type === "tool.result" || e.type === "run.stop") && n instanceof Ne) {
8139
+ if ((e.type === "tool.result" || e.type === "run.stop") && n instanceof Te) {
8137
8140
  const i = this.queuedClientEvents.find((s) => "sessionId" in s && s.sessionId === e.sessionId && (e.type === "tool.result" && s.type === "tool.result" && s.callId === e.callId || e.type === "run.stop" && s.type === "run.stop" && s.expectedUserMessageId === e.expectedUserMessageId)) ?? e;
8138
8141
  return this.queuedClientEvents.includes(i) || this.queuedClientEvents.push(i), Sn(this.options.clientId, this.queuedClientEvents), this.pendingRetainedCommandDeliveries.has(i) || (this.pendingRetainedCommandDeliveries.add(i), n.sendRetainedCommand(st(i)).then((s) => {
8139
8142
  this.pendingRetainedCommandDeliveries.delete(i), s && (this.queuedClientEvents = this.queuedClientEvents.filter((o) => o !== i), Sn(this.options.clientId, this.queuedClientEvents));
8140
8143
  })), !0;
8141
8144
  }
8142
8145
  try {
8143
- return n.send(JSON.stringify(e)), wi("client_event", e.type, Uo(e)), !0;
8146
+ return n.send(JSON.stringify(e)), qn("client_event", e.type, Uo(e)), !0;
8144
8147
  } catch (i) {
8145
8148
  return Ue("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
8146
8149
  message: i instanceof Error ? i.message : String(i),
@@ -8181,8 +8184,8 @@ class Gr {
8181
8184
  ...n,
8182
8185
  ...n.renderedError?.runId ? { runId: n.renderedError.runId } : {}
8183
8186
  }, { responseDiagnostics: a, renderedError: r, uiInvariant: c, timings: u, ...p } = o;
8184
- for (const l of u ?? []) wi("client_event", "operation_timing", { ...l });
8185
- if (wi("client_event", "runtime.health", { ...p, signalName: e }), this.options.productVariant === "customer_embedded" || !this.socket || this.socket.readyState !== WebSocket.OPEN || this.authenticatedSocket !== this.socket) {
8187
+ for (const l of u ?? []) qn("client_event", "operation_timing", { ...l });
8188
+ if (qn("client_event", "runtime.health", { ...p, signalName: e }), this.options.productVariant === "customer_embedded" || !this.socket || this.socket.readyState !== WebSocket.OPEN || this.authenticatedSocket !== this.socket) {
8186
8189
  this.queueHealthDiagnostic(o);
8187
8190
  return;
8188
8191
  }
@@ -8253,7 +8256,7 @@ class Gr {
8253
8256
  }
8254
8257
  /** @internal */
8255
8258
  reportTransportDiagnostic(e, n = {}) {
8256
- const i = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online", s = `${e}:${n.closeCode ?? "none"}:${i}`, o = (/* @__PURE__ */ new Date()).toISOString(), a = this.transportDiagnosticEpisodes.get(s), r = {
8259
+ const i = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online", s = `${e}:${n.requestId ?? n.connectionAttemptId ?? "none"}:${n.closeCode ?? "none"}:${i}`, o = (/* @__PURE__ */ new Date()).toISOString(), a = this.transportDiagnosticEpisodes.get(s), r = {
8257
8260
  id: a?.id ?? crypto.randomUUID(),
8258
8261
  phase: e,
8259
8262
  entrySurface: this.options.entrySurface,
@@ -8264,7 +8267,7 @@ class Gr {
8264
8267
  connectivity: i,
8265
8268
  ...n
8266
8269
  };
8267
- this.transportDiagnosticEpisodes.set(s, r), [1, 3, 10, 30, 100].includes(r.occurrenceCount) && (this.pendingTransportDiagnostics = [
8270
+ this.transportDiagnosticEpisodes.set(s, r), this.transportDiagnosticEpisodes.size > 20 && this.transportDiagnosticEpisodes.delete(this.transportDiagnosticEpisodes.keys().next().value), e.startsWith("auth_") && qn("client_event", "authentication_diagnostic", { ...r }), [1, 3, 10, 30, 100].includes(r.occurrenceCount) && (this.pendingTransportDiagnostics = [
8268
8271
  ...this.pendingTransportDiagnostics.filter((c) => c.id !== r.id),
8269
8272
  r
8270
8273
  ], this.pendingTransportDiagnostics.splice(0, Math.max(0, this.pendingTransportDiagnostics.length - 20)), this.flushClientDiagnostics());
@@ -8275,6 +8278,7 @@ class Gr {
8275
8278
  }
8276
8279
  /** @internal */
8277
8280
  async flushClientDiagnostics() {
8281
+ if (this.refreshingDefaultCredentials) return;
8278
8282
  if (this.clientDiagnosticsFlush)
8279
8283
  return await this.clientDiagnosticsFlush;
8280
8284
  if (this.clientDiagnosticsRetryTimer !== null || this.pendingTransportDiagnostics.length === 0 && this.pendingHealthDiagnostics.length === 0)
@@ -8298,12 +8302,16 @@ class Gr {
8298
8302
  this.scheduleClientDiagnosticsRetry();
8299
8303
  return;
8300
8304
  }
8301
- const n = this.pendingTransportDiagnostics.slice(0, 20), i = this.pendingHealthDiagnostics.slice(0, 20), s = this.options.productVariant === "customer_embedded" ? "/api/product-agent/embed/diagnostics" : "/api/product-agent/runtime/diagnostics";
8305
+ const n = this.pendingTransportDiagnostics.slice(0, 20), i = this.pendingHealthDiagnostics.slice(0, 20), s = [...n].reverse().find((r) => r.phase.startsWith("auth_")), o = s?.requestId ?? s?.connectionAttemptId, a = this.options.productVariant === "customer_embedded" ? "/api/product-agent/embed/diagnostics" : "/api/product-agent/runtime/diagnostics";
8302
8306
  try {
8303
- const o = await fetch(new URL(s, this.options.backendUrl), {
8307
+ const r = await fetch(new URL(a, this.options.backendUrl), {
8304
8308
  method: "POST",
8305
8309
  headers: {
8306
8310
  "content-type": "application/json",
8311
+ // Authentication can reject diagnostics too. These bounded hints let that rejection log retain
8312
+ // the recovery outcome without accepting an unauthenticated body or weakening access checks.
8313
+ ...s ? { "x-product-agent-auth-phase": s.phase } : {},
8314
+ ...o ? { "x-product-agent-auth-request-id": o } : {},
8307
8315
  authorization: this.options.productVariant === "customer_embedded" ? `Bearer ${e}` : e
8308
8316
  },
8309
8317
  body: JSON.stringify({
@@ -8314,24 +8322,24 @@ class Gr {
8314
8322
  }),
8315
8323
  signal: AbortSignal.timeout(1e4)
8316
8324
  });
8317
- if (o.status === 401 || o.status === 403) {
8318
- const c = new Set(n.map((p) => p.id)), u = new Set(i.map((p) => p.id));
8325
+ if (r.status === 401 || r.status === 403) {
8326
+ const p = new Set(n.map((h) => h.id)), l = new Set(i.map((h) => h.id));
8319
8327
  this.pendingTransportDiagnostics = this.pendingTransportDiagnostics.filter(
8320
- (p) => !c.has(p.id)
8328
+ (h) => !p.has(h.id)
8321
8329
  ), this.pendingHealthDiagnostics = this.pendingHealthDiagnostics.filter(
8322
- (p) => !u.has(p.id)
8330
+ (h) => !l.has(h.id)
8323
8331
  );
8324
8332
  return;
8325
8333
  }
8326
- if (!o.ok)
8327
- throw new Error(`Client diagnostic upload failed (${o.status})`);
8328
- const a = new Map(
8329
- n.map((c) => [c.id, c.occurrenceCount])
8330
- ), r = new Set(i.map((c) => c.id));
8334
+ if (!r.ok)
8335
+ throw new Error(`Client diagnostic upload failed (${r.status})`);
8336
+ const c = new Map(
8337
+ n.map((p) => [p.id, p.occurrenceCount])
8338
+ ), u = new Set(i.map((p) => p.id));
8331
8339
  this.pendingTransportDiagnostics = this.pendingTransportDiagnostics.filter(
8332
- (c) => !a.has(c.id) || c.occurrenceCount > (a.get(c.id) ?? 0)
8340
+ (p) => !c.has(p.id) || p.occurrenceCount > (c.get(p.id) ?? 0)
8333
8341
  ), this.pendingHealthDiagnostics = this.pendingHealthDiagnostics.filter(
8334
- (c) => !r.has(c.id)
8342
+ (p) => !u.has(p.id)
8335
8343
  );
8336
8344
  } catch {
8337
8345
  this.scheduleClientDiagnosticsRetry();
@@ -8377,7 +8385,7 @@ class Gr {
8377
8385
  }
8378
8386
  flushQueuedClientEvents() {
8379
8387
  const e = [...this.queuedClientEvents];
8380
- this.queuedClientEvents = this.queuedClientEvents.filter((n) => (n.type === "tool.result" || n.type === "run.stop") && this.socket instanceof Ne), Sn(this.options.clientId, this.queuedClientEvents);
8388
+ this.queuedClientEvents = this.queuedClientEvents.filter((n) => (n.type === "tool.result" || n.type === "run.stop") && this.socket instanceof Te), Sn(this.options.clientId, this.queuedClientEvents);
8381
8389
  for (let n = 0; n < e.length; n++)
8382
8390
  if (!this.sendNow(st(e[n]))) {
8383
8391
  this.queuedClientEvents.unshift(...e.slice(n).filter((i) => !this.queuedClientEvents.includes(i)));
@@ -8396,7 +8404,7 @@ class Gr {
8396
8404
  const u = this.directoryAuthority;
8397
8405
  this.directoryObservation.dispose(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.directoryAuthority = { authorityId: s, generation: u.generation + 1 }, this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "directory.authority_replace", expectedGeneration: u.generation }), this.createDirectoryAdapters();
8398
8406
  const p = this.getModel();
8399
- a || (this.pendingWidgetLifecycleEvents = []), this.resetForAuthenticationScopeChange(), c && (this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}:${Re()}`, this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: c }), this.directoryScope.bind(this.modelClientScopeId, this.directoryConversationScopeId, c).then(() => this.directoryScope.persist())), p && this.setModel(p);
8407
+ a || (this.pendingWidgetLifecycleEvents = []), this.resetForAuthenticationScopeChange(), c && (this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}:${Pe()}`, this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: c }), this.directoryScope.bind(this.modelClientScopeId, this.directoryConversationScopeId, c).then(() => this.directoryScope.persist())), p && this.setModel(p);
8400
8408
  }
8401
8409
  if (o || a) {
8402
8410
  const u = this.directoryAuthority;
@@ -8404,16 +8412,16 @@ class Gr {
8404
8412
  if (this.clientRuntime.isDisposed || this.directoryAuthority !== u) return;
8405
8413
  let p = !1;
8406
8414
  for (const l of r) {
8407
- const h = this.clientRuntime.engine.getState().slices.directory, g = h.clients[this.modelClientScopeId];
8408
- if (l.type === "run.stop" && h.selections[g]?.sessionId === l.payload.sessionId) {
8415
+ const h = this.clientRuntime.engine.getState().slices.directory, f = h.clients[this.modelClientScopeId];
8416
+ if (l.type === "run.stop" && h.selections[f]?.sessionId === l.payload.sessionId) {
8409
8417
  if (p) continue;
8410
8418
  p = !0;
8411
- const y = r.filter((f) => f.type === "run.stop" && f.payload.sessionId === l.payload.sessionId).map((f) => String(f.payload.expectedUserMessageId));
8419
+ const y = r.filter((g) => g.type === "run.stop" && g.payload.sessionId === l.payload.sessionId).map((g) => String(g.payload.expectedUserMessageId));
8412
8420
  await this.clientRuntime.engine.dispatch({
8413
8421
  ...u,
8414
8422
  type: "conversation.stop",
8415
8423
  clientScopeId: this.modelClientScopeId,
8416
- conversationScopeId: g,
8424
+ conversationScopeId: f,
8417
8425
  requestId: l.request_id,
8418
8426
  reason: l.payload.reason,
8419
8427
  userMessageIds: y
@@ -8444,7 +8452,7 @@ class Gr {
8444
8452
  }
8445
8453
  }
8446
8454
  handleServerEvent(e) {
8447
- if (wi("server_event", e.type, Uo(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
8455
+ if (qn("server_event", e.type, Uo(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
8448
8456
  this.conversationObservation?.receive(e);
8449
8457
  return;
8450
8458
  }
@@ -8515,13 +8523,30 @@ class Gr {
8515
8523
  });
8516
8524
  return;
8517
8525
  }
8526
+ if (!this.options.webSocketFactory && (e.code === "unauthorized" || e.code === "401") && e.reason === "invalid_token" && (this.canRefreshInvalidCredential() || this.credentialRecovery !== null)) {
8527
+ const n = this.socket;
8528
+ if (n instanceof Te) {
8529
+ this.credentialRecovery || this.refreshCredentials(
8530
+ n,
8531
+ !0,
8532
+ new U("", "unauthorized", !1, {
8533
+ reason: e.reason,
8534
+ authTransport: e.authTransport,
8535
+ requestId: e.requestId,
8536
+ authEndpoint: e.authEndpoint
8537
+ })
8538
+ ).catch(() => {
8539
+ });
8540
+ return;
8541
+ }
8542
+ }
8518
8543
  if ((e.code === "unauthorized" || e.code === "401") && e.reason === "token_expired" && e.retryable === !0 && this.options.tokenProvider) {
8519
8544
  const n = this.socket;
8520
- n instanceof Ne ? this.refreshDefaultTransportCredentials(n) : (this.invalidateProviderToken(), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.setReconnectingState(), this.socket = null, this.scheduleReconnect(), n?.close());
8545
+ n instanceof Te ? this.refreshDefaultTransportCredentials(n) : (this.invalidateProviderToken(), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.setReconnectingState(), this.socket = null, this.scheduleReconnect(), n?.close());
8521
8546
  return;
8522
8547
  }
8523
8548
  if (!this.options.webSocketFactory && (e.code === "unauthorized" || e.code === "update_required" || e.code === "executor_replaced")) {
8524
- this.stopAuthentication(new U(String(e.message), String(e.code), !1));
8549
+ this.stopAuthentication(new U(String(e.message), String(e.code), !1, { reason: e.reason, authTransport: "socket" }));
8525
8550
  return;
8526
8551
  }
8527
8552
  ["unauthorized", "update_required", "executor_replaced", "connection_failed"].includes(String(e.code)) && this.setState({ status: "error", lastError: String(e.message), lastErrorCode: String(e.code) });
@@ -8681,7 +8706,7 @@ class Gr {
8681
8706
  Math.max(hf(this.reconnectAttempts), e)
8682
8707
  );
8683
8708
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
8684
- this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof Ne ? this.refreshDefaultTransportCredentials(this.socket) : this.connect()).catch((s) => {
8709
+ this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof Te ? this.refreshDefaultTransportCredentials(this.socket) : this.connect()).catch((s) => {
8685
8710
  Ue("web-sdk.agent", "Pluno reconnect failed; retrying", {
8686
8711
  message: s instanceof Error ? s.message : String(s),
8687
8712
  queuedClientEventCount: this.queuedClientEvents.length,
@@ -8713,43 +8738,70 @@ class Gr {
8713
8738
  local_runtime_client_id: this.options.localRuntimeClientId ?? void 0
8714
8739
  }, a, o), this.refreshingDefaultCredentials = !1;
8715
8740
  }
8741
+ /** @internal */
8742
+ canRefreshInvalidCredential() {
8743
+ return !this.invalidCredentialRecoveryAttempted && !this.options.token && !!this.options.tokenProvider && this.options.productVariant === "personal" && ["main_web_chat", "automation"].includes(this.options.entrySurface);
8744
+ }
8745
+ /** @internal */
8746
+ authenticationDiagnostic(e) {
8747
+ const n = e?.detail;
8748
+ return {
8749
+ authReason: ["invalid_token", "token_expired", "missing_token", "user_not_found"].includes(n?.reason ?? "") ? n.reason : "unknown",
8750
+ authTransport: n?.authTransport === "http" ? "http" : "socket",
8751
+ ...n?.requestId && /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(n.requestId) ? { requestId: n.requestId, .../^(runtime|embed|extension|conversations):(snapshot|me|bootstrap|commands|activity|session-history|other)$/.test(n.authEndpoint ?? "") ? { authEndpoint: n.authEndpoint } : {} } : {},
8752
+ ...this.socket instanceof Te ? { connectionAttemptId: this.socket.connectionAttempt?.connectionAttemptId } : {}
8753
+ };
8754
+ }
8716
8755
  stopAuthentication(e) {
8717
- this.authenticationFailure = e, this.rejectedTransportToken = e.code === "403" ? null : this.token, this.refreshingDefaultCredentials = !1, this.reconnectTimer !== null && window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.clearSocketPhaseTimers(), this.stopHeartbeat();
8756
+ this.reportTransportDiagnostic("auth_rejected", this.authenticationDiagnostic(e)), e.code === "unauthorized" && (e = new U("Your chat session could not be refreshed. Reload the page to reconnect.", e.code, !1, e.detail)), this.authenticationFailure = e, this.rejectedTransportToken = e.code === "403" ? null : this.token, this.refreshingDefaultCredentials = !1, this.reconnectTimer !== null && window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.clearSocketPhaseTimers(), this.stopHeartbeat();
8718
8757
  const n = this.socket;
8719
8758
  this.socket = null, this.setState({ status: "error", lastError: e.message, lastErrorCode: e.code }), n?.close(), this.directoryObservation?.reconcile(), this.conversationObservation?.wake();
8720
8759
  }
8721
8760
  async recoverHttpAuthentication(e, n, i) {
8722
8761
  if (this.authenticationFailure) throw this.authenticationFailure;
8723
8762
  const s = n.detail;
8724
- if (n.code === "unauthorized" && s?.reason === "token_expired" && s.retryable === !0 && this.options.tokenProvider && i) {
8763
+ if (n.code === "unauthorized" && s?.reason === "invalid_token" && this.invalidCredentialRecoveryAttempted) {
8725
8764
  if (this.credentialRecovery) return this.credentialRecovery;
8726
8765
  if (this.directoryHttp.auth.token !== e) return;
8727
- const o = this.socket;
8728
- if (o instanceof Ne) return this.refreshCredentials(o);
8766
+ }
8767
+ const o = s?.reason === "invalid_token" && this.canRefreshInvalidCredential();
8768
+ if (n.code === "unauthorized" && (s?.reason === "token_expired" && s.retryable === !0 || o) && this.options.tokenProvider && i) {
8769
+ if (this.credentialRecovery) return this.credentialRecovery;
8770
+ if (this.directoryHttp.auth.token !== e) return;
8771
+ const a = this.socket;
8772
+ if (a instanceof Te) return this.refreshCredentials(a, o, n);
8729
8773
  if (this.options.webSocketFactory) throw n;
8730
8774
  }
8731
8775
  throw this.stopAuthentication(n), n;
8732
8776
  }
8733
- refreshCredentials(e) {
8777
+ refreshCredentials(e, n = !1, i) {
8734
8778
  if (this.credentialRecovery) return this.credentialRecovery;
8735
- this.credentialRecoveryFailure = null, this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.refreshingDefaultCredentials = !0, e.pause(), this.setReconnectingState(), this.directoryObservation.reconcile(), this.conversationObservation?.wake();
8736
- const n = (async () => {
8737
- const i = await this.acquireToken("connect", { forceRefresh: !0 });
8779
+ this.credentialRecoveryFailure = null;
8780
+ const s = this.token, o = this.authenticationDiagnostic(i ?? new U(
8781
+ "",
8782
+ "unauthorized",
8783
+ !1,
8784
+ { reason: n ? "invalid_token" : "token_expired" }
8785
+ ));
8786
+ n && (this.invalidCredentialRecoveryAttempted = !0), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.refreshingDefaultCredentials = !0, this.reportTransportDiagnostic("auth_refresh_started", o), e.pause(), this.setReconnectingState(), this.directoryObservation.reconcile(), this.conversationObservation?.wake();
8787
+ const a = (async () => {
8788
+ const r = await this.acquireToken("connect", { forceRefresh: !0 });
8738
8789
  if (this.socket !== e || this.state.status === "closed" || this.clientRuntime.isDisposed)
8739
8790
  throw new U("Conversation authority was retired.", "authority_retired", !0);
8740
- if (!i) throw new _t("Pluno token provider did not return a token", !1);
8741
- this.directoryHttp.auth.token = i, await this.replaceDefaultTransportCredentials(e);
8742
- })().catch((i) => {
8743
- if (this.credentialRecoveryFailure = qn(i), this.socket !== e || this.state.status === "closed") throw i;
8744
- if (i instanceof U && ["unauthorized", "403", "update_required"].includes(i.code) || !zc(i)) {
8745
- const s = i instanceof U ? i : new U("Your session could not be refreshed. Reconnect to continue.", "unauthorized", !1);
8746
- throw this.stopAuthentication(s), s;
8791
+ if (!r) throw new _t("Pluno token provider did not return a token", !1);
8792
+ if (n && r === s) throw new U("Credential did not change.", "unauthorized", !1);
8793
+ this.directoryHttp.auth.token = r, await this.replaceDefaultTransportCredentials(e), this.reportTransportDiagnostic("auth_refresh_validated", o);
8794
+ })().catch((r) => {
8795
+ if (this.reportTransportDiagnostic("auth_refresh_failed", o), this.credentialRecoveryFailure = Dn(r), this.socket !== e || this.state.status === "closed") throw r;
8796
+ if (r instanceof U && ["unauthorized", "403", "update_required"].includes(r.code) || !zc(r)) {
8797
+ const c = r instanceof U ? r : new U("Your session could not be refreshed. Reconnect to continue.", "unauthorized", !1);
8798
+ throw this.stopAuthentication(c), c;
8747
8799
  }
8748
- throw this.scheduleReconnect(), i;
8800
+ throw this.scheduleReconnect(), r;
8749
8801
  }).finally(() => {
8750
- this.credentialRecovery === n && (this.credentialRecovery = null);
8802
+ this.credentialRecovery === a && (this.credentialRecovery = null), this.flushClientDiagnostics();
8751
8803
  });
8752
- return this.credentialRecovery = n, n;
8804
+ return this.credentialRecovery = a, a;
8753
8805
  }
8754
8806
  async refreshDefaultTransportCredentials(e) {
8755
8807
  this.authenticationFailure || await this.refreshCredentials(e).catch((n) => {
@@ -8788,7 +8840,7 @@ class Gr {
8788
8840
  this.clientRuntime.isDisposed || (this.state = e, this.clientRuntime.engine.dispatch({ type: "activeUsers.authenticate", authenticated: !!(this.token && this.state.user && this.state.status !== "closed") }), this.rebuildRuntimeInteractions(), this.emit("state", this.getState()));
8789
8841
  }
8790
8842
  setReconnectingState() {
8791
- if (this.socket instanceof Ne && this.socket.initialReadinessExpired) return;
8843
+ if (this.socket instanceof Te && this.socket.initialReadinessExpired) return;
8792
8844
  this.conversationObservation?.wake();
8793
8845
  const e = this.state.lastError !== null && (!this.state.isThinking || this.state.lastErrorCode === "connection_failed");
8794
8846
  this.setState({
@@ -8808,39 +8860,39 @@ function ff(t) {
8808
8860
  }
8809
8861
  function mf() {
8810
8862
  const t = /* @__PURE__ */ new Set(), e = (h) => {
8811
- t.forEach((g) => {
8863
+ t.forEach((f) => {
8812
8864
  try {
8813
- g(h);
8865
+ f(h);
8814
8866
  } catch {
8815
8867
  }
8816
8868
  });
8817
- }, n = window.fetch, i = XMLHttpRequest.prototype.open, s = XMLHttpRequest.prototype.setRequestHeader, o = XMLHttpRequest.prototype.send, a = function(g, y) {
8818
- const f = Date.now();
8819
- let w;
8869
+ }, n = window.fetch, i = XMLHttpRequest.prototype.open, s = XMLHttpRequest.prototype.setRequestHeader, o = XMLHttpRequest.prototype.send, a = function(f, y) {
8870
+ const g = Date.now();
8871
+ let b;
8820
8872
  try {
8821
- w = n.call(this, g, y);
8822
- } catch (b) {
8823
- throw b;
8873
+ b = n.call(this, f, y);
8874
+ } catch (w) {
8875
+ throw w;
8824
8876
  }
8825
8877
  try {
8826
- const b = g instanceof Request ? g : null, S = mm(g, b), R = Ad(y?.headers ?? b?.headers);
8827
- if (!Ln(S, R, y?.body)) {
8878
+ const w = f instanceof Request ? f : null, S = mm(f, w), R = Ad(y?.headers ?? w?.headers);
8879
+ if (!On(S, R, y?.body)) {
8828
8880
  const C = {
8829
8881
  requestId: Ko("fetch"),
8830
8882
  url: Ht(S, $o),
8831
- method: (y?.method ?? b?.method ?? "GET").toUpperCase(),
8883
+ method: (y?.method ?? w?.method ?? "GET").toUpperCase(),
8832
8884
  requestHeaders: R,
8833
8885
  requestBody: Yc(y?.body),
8834
8886
  resourceType: "fetch",
8835
- startedAt: new Date(f).toISOString()
8887
+ startedAt: new Date(g).toISOString()
8836
8888
  };
8837
- w.then(
8889
+ b.then(
8838
8890
  (D) => {
8839
- ym(D, C, f, e).catch(() => {
8891
+ ym(D, C, g, e).catch(() => {
8840
8892
  e({
8841
8893
  ...C,
8842
8894
  responseStatus: D.status,
8843
- durationMs: Date.now() - f
8895
+ durationMs: Date.now() - g
8844
8896
  });
8845
8897
  });
8846
8898
  },
@@ -8848,37 +8900,37 @@ function mf() {
8848
8900
  e({
8849
8901
  ...C,
8850
8902
  errorText: Ht(D instanceof Error ? D.message : String(D)),
8851
- durationMs: Date.now() - f
8903
+ durationMs: Date.now() - g
8852
8904
  });
8853
8905
  }
8854
8906
  );
8855
8907
  }
8856
8908
  } catch {
8857
8909
  }
8858
- return w;
8859
- }, r = function(g, y, f, w, b) {
8860
- const S = i.call(this, g, y, f ?? !0, w ?? void 0, b ?? void 0), R = typeof y == "string" ? y : y.toString();
8910
+ return b;
8911
+ }, r = function(f, y, g, b, w) {
8912
+ const S = i.call(this, f, y, g ?? !0, b ?? void 0, w ?? void 0), R = typeof y == "string" ? y : y.toString();
8861
8913
  return Fo.set(this, {
8862
8914
  requestId: Ko("xhr"),
8863
- method: String(g ?? "GET").toUpperCase(),
8915
+ method: String(f ?? "GET").toUpperCase(),
8864
8916
  url: Ht(R, $o),
8865
8917
  requestHeaders: {},
8866
8918
  startedAtMs: Date.now(),
8867
8919
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
8868
- excluded: Ln(R)
8920
+ excluded: On(R)
8869
8921
  }), S;
8870
- }, c = function(g, y) {
8871
- const f = s.call(this, g, y), w = Fo.get(this);
8872
- return w && Object.keys(w.requestHeaders).length < Vr && (w.requestHeaders[g] = Xr(g, y), w.excluded = w.excluded || Ln(w.url, w.requestHeaders)), f;
8873
- }, u = function(g) {
8922
+ }, c = function(f, y) {
8923
+ const g = s.call(this, f, y), b = Fo.get(this);
8924
+ return b && Object.keys(b.requestHeaders).length < Vr && (b.requestHeaders[f] = Xr(f, y), b.excluded = b.excluded || On(b.url, b.requestHeaders)), g;
8925
+ }, u = function(f) {
8874
8926
  try {
8875
8927
  const y = Fo.get(this);
8876
- y && (y.excluded = y.excluded || Ln(y.url, y.requestHeaders, g), y.requestBody = Yc(g), y.excluded || this.addEventListener(
8928
+ y && (y.excluded = y.excluded || On(y.url, y.requestHeaders, f), y.requestBody = Yc(f), y.excluded || this.addEventListener(
8877
8929
  "loadend",
8878
8930
  () => {
8879
8931
  queueMicrotask(() => {
8880
8932
  try {
8881
- const f = Im(this.getAllResponseHeaders());
8933
+ const g = Im(this.getAllResponseHeaders());
8882
8934
  e({
8883
8935
  requestId: y.requestId,
8884
8936
  url: y.url,
@@ -8887,8 +8939,8 @@ function mf() {
8887
8939
  requestBody: y.requestBody,
8888
8940
  resourceType: "xhr",
8889
8941
  responseStatus: this.status,
8890
- responseHeaders: f,
8891
- responseBody: bm(this, f),
8942
+ responseHeaders: g,
8943
+ responseBody: bm(this, g),
8892
8944
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
8893
8945
  startedAt: y.startedAt,
8894
8946
  durationMs: Date.now() - y.startedAtMs
@@ -8902,7 +8954,7 @@ function mf() {
8902
8954
  ));
8903
8955
  } catch {
8904
8956
  }
8905
- return o.call(this, g ?? null);
8957
+ return o.call(this, f ?? null);
8906
8958
  };
8907
8959
  try {
8908
8960
  window.fetch = a;
@@ -8923,18 +8975,18 @@ function mf() {
8923
8975
  let p = null;
8924
8976
  if (typeof PerformanceObserver < "u") {
8925
8977
  p = new PerformanceObserver((h) => {
8926
- for (const g of h.getEntries()) {
8927
- const y = g;
8928
- if (y.initiatorType === "fetch" || y.initiatorType === "xmlhttprequest" || Ln(y.name))
8978
+ for (const f of h.getEntries()) {
8979
+ const y = f;
8980
+ if (y.initiatorType === "fetch" || y.initiatorType === "xmlhttprequest" || On(y.name))
8929
8981
  continue;
8930
- const f = performance.timeOrigin + y.startTime;
8982
+ const g = performance.timeOrigin + y.startTime;
8931
8983
  e({
8932
8984
  requestId: Ko("resource"),
8933
8985
  url: Ht(y.name, $o),
8934
8986
  method: "GET",
8935
8987
  resourceType: "resource",
8936
8988
  responseStatus: y.responseStatus,
8937
- startedAt: new Date(f).toISOString(),
8989
+ startedAt: new Date(g).toISOString(),
8938
8990
  durationMs: y.duration
8939
8991
  });
8940
8992
  }
@@ -9238,32 +9290,32 @@ function Uf() {
9238
9290
  function Jr() {
9239
9291
  if (!document.body)
9240
9292
  return "";
9241
- const t = [], e = [], n = (f, w) => {
9242
- const b = Kn(w);
9243
- !b || e.includes(b) || (t.push([f, b]), e.push(b));
9293
+ const t = [], e = [], n = (g, b) => {
9294
+ const w = Wn(b);
9295
+ !w || e.includes(w) || (t.push([g, w]), e.push(w));
9244
9296
  };
9245
9297
  n("Selected text", window.getSelection()?.toString() ?? "");
9246
9298
  const i = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", s = Array.from(document.querySelectorAll(i)).filter(
9247
- (f) => wd(f) && !f.parentElement?.closest(i)
9299
+ (g) => wd(g) && !g.parentElement?.closest(i)
9248
9300
  );
9249
- for (const f of s.slice(0, 3))
9250
- n("Active overlay", jo(Ci(f), e));
9301
+ for (const g of s.slice(0, 3))
9302
+ n("Active overlay", jo(Ci(g), e));
9251
9303
  const o = Bf(), a = o ? jo(Ci(o), e) : "";
9252
9304
  n("Main page content", a), n("Additional visible page text", jo(Ci(document.body), e));
9253
- const r = t.map(([f, w]) => `${f}:
9254
- ${w}`).join(`
9305
+ const r = t.map(([g, b]) => `${g}:
9306
+ ${b}`).join(`
9255
9307
 
9256
9308
  `).trim().slice(0, 12e3), c = zf(s, o).trim(), u = `Simplified DOM outline:
9257
9309
  `, p = `
9258
9310
 
9259
9311
  Visible page text:
9260
- `, l = 12e3 - u.length - p.length, h = Math.min(r.length, 7900), g = c.slice(0, l - h), y = r.slice(0, l - g.length);
9261
- return `${u}${g}${p}${y}`;
9312
+ `, l = 12e3 - u.length - p.length, h = Math.min(r.length, 7900), f = c.slice(0, l - h), y = r.slice(0, l - f.length);
9313
+ return `${u}${f}${p}${y}`;
9262
9314
  }
9263
9315
  function Ci(t) {
9264
9316
  return t.innerText ?? t.textContent ?? "";
9265
9317
  }
9266
- function Kn(t) {
9318
+ function Wn(t) {
9267
9319
  return (t ?? "").replace(/\u00a0/g, " ").replace(/\r\n?/g, `
9268
9320
  `).split(`
9269
9321
  `).map((e) => e.replace(/[ \t]+/g, " ").trim()).join(`
@@ -9272,10 +9324,10 @@ function Kn(t) {
9272
9324
  `).trim();
9273
9325
  }
9274
9326
  function jo(t, e) {
9275
- let n = Kn(t);
9327
+ let n = Wn(t);
9276
9328
  for (const i of e)
9277
9329
  n = n.replace(i, "");
9278
- return Kn(n);
9330
+ return Wn(n);
9279
9331
  }
9280
9332
  function wd(t) {
9281
9333
  const e = window.getComputedStyle(t);
@@ -9366,32 +9418,32 @@ function zf(t, e) {
9366
9418
  "data-cy"
9367
9419
  ], u = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: p, priorityTargets: l } = $f(), h = new Set(t);
9368
9420
  e && h.add(e);
9369
- let g = 0;
9421
+ let f = 0;
9370
9422
  const y = (R) => {
9371
9423
  const k = R.getAttribute("role");
9372
9424
  return k && !a.has(k) ? k : "";
9373
- }, f = (R) => {
9425
+ }, g = (R) => {
9374
9426
  const k = R.getAttribute("data-testid") || R.getAttribute("data-test") || R.getAttribute("data-qa") || R.getAttribute("data-cy") || "";
9375
9427
  return `${R.tagName.toLowerCase()}|${y(R)}|${k}`;
9376
- }, w = (R, k, C) => {
9428
+ }, b = (R, k, C) => {
9377
9429
  const D = (q, Z) => {
9378
9430
  const L = q.tagName.toLowerCase(), de = window.getComputedStyle(q), se = p.has(q);
9379
- if (g >= 1e3 && !se || C.has(q) || o.has(L) || q.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || de.display === "none" || de.visibility === "hidden")
9431
+ if (f >= 1e3 && !se || C.has(q) || o.has(L) || q.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || de.display === "none" || de.visibility === "hidden")
9380
9432
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
9381
- g += 1;
9433
+ f += 1;
9382
9434
  const fe = y(q), te = _d(q), I = r.has(fe) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(L) || L === "a" && q.hasAttribute("href"), O = Array.from(q.children).filter((T) => T instanceof HTMLElement), V = /* @__PURE__ */ new Map();
9383
9435
  for (const T of O) {
9384
- const j = f(T);
9436
+ const j = g(T);
9385
9437
  V.set(j, (V.get(j) ?? 0) + 1);
9386
9438
  }
9387
9439
  const Y = /* @__PURE__ */ new Map(), ve = /* @__PURE__ */ new Map();
9388
9440
  for (const T of O) {
9389
- const j = f(T), oe = ve.get(j) ?? 0;
9441
+ const j = g(T), oe = ve.get(j) ?? 0;
9390
9442
  ve.set(j, oe + 1), (V.get(j) ?? 0) > 8 && oe >= 6 && !p.has(T) && Y.set(j, (Y.get(j) ?? 0) + 1);
9391
9443
  }
9392
9444
  const ue = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Set(), pe = [], je = [];
9393
9445
  for (const T of O) {
9394
- const j = f(T), oe = V.get(j) ?? 0, ke = ue.get(j) ?? 0;
9446
+ const j = g(T), oe = V.get(j) ?? 0, ke = ue.get(j) ?? 0;
9395
9447
  if (ue.set(j, ke + 1), oe > 8 && ke >= 6 && !p.has(T)) {
9396
9448
  P.has(j) || (pe.push([`… ${Y.get(j) ?? 0} similar siblings omitted`]), P.add(j));
9397
9449
  continue;
@@ -9403,7 +9455,7 @@ function zf(t, e) {
9403
9455
  if (q.shadowRoot)
9404
9456
  for (const T of Array.from(q.shadowRoot.children))
9405
9457
  T instanceof HTMLElement && W.push(D(T, Z + 1));
9406
- const xe = [...je, ...W], He = te.length > 0 || I || xe.some((T) => T.hasUsefulContent), ie = Kn(
9458
+ const xe = [...je, ...W], He = te.length > 0 || I || xe.some((T) => T.hasUsefulContent), ie = Wn(
9407
9459
  [te, ...xe.map((T) => T.textPreview)].filter(Boolean).join(" ")
9408
9460
  ).slice(0, 180), re = q.hasAttribute("contenteditable") && (te.length > 0 || !q.querySelector("[contenteditable]")), N = u.some((T) => q.hasAttribute(T)) || !!fe || re, ae = (q.getClientRects().length > 0 || de.display === "contents") && (n.has(L) || N || se) && (He || se) && (!s.has(L) || He || N || se), X = ae ? 1 : 0, he = [];
9409
9461
  if (ae) {
@@ -9432,16 +9484,16 @@ function zf(t, e) {
9432
9484
  };
9433
9485
  return [`--- ${k} ---`, ...D(R, 0).lines].join(`
9434
9486
  `);
9435
- }, b = [], S = Kn(window.getSelection()?.toString() ?? "");
9436
- S && b.push(`--- selected text ---
9437
- ${JSON.stringify(S)}`), l.length > 0 && b.push(Ff(l, n, c, a));
9487
+ }, w = [], S = Wn(window.getSelection()?.toString() ?? "");
9488
+ S && w.push(`--- selected text ---
9489
+ ${JSON.stringify(S)}`), l.length > 0 && w.push(Ff(l, n, c, a));
9438
9490
  for (const R of t.slice(0, 3))
9439
- b.push(w(R, "active overlay DOM", /* @__PURE__ */ new Set()));
9440
- if (e && b.push(w(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
9491
+ w.push(b(R, "active overlay DOM", /* @__PURE__ */ new Set()));
9492
+ if (e && w.push(b(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
9441
9493
  const R = e || t.length ? "other visible DOM" : "visible DOM";
9442
- b.push(w(document.body, R, h));
9494
+ w.push(b(document.body, R, h));
9443
9495
  }
9444
- return b.join(`
9496
+ return w.join(`
9445
9497
 
9446
9498
  `);
9447
9499
  }
@@ -9537,7 +9589,7 @@ function ss(t, e) {
9537
9589
  return t.map((i) => `${n}${i}`);
9538
9590
  }
9539
9591
  function _d(t) {
9540
- return Kn(
9592
+ return Wn(
9541
9593
  Array.from(t.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
9542
9594
  );
9543
9595
  }
@@ -9649,7 +9701,7 @@ function Yf() {
9649
9701
  const n = crypto.randomUUID();
9650
9702
  return window.localStorage.setItem(t, n), n;
9651
9703
  }
9652
- function Re() {
9704
+ function Pe() {
9653
9705
  return crypto.randomUUID();
9654
9706
  }
9655
9707
  function Wc(t) {
@@ -9677,7 +9729,7 @@ function Xf(t, e) {
9677
9729
  id: typeof s.id == "string" ? s.id : String(n.id ?? crypto.randomUUID()),
9678
9730
  role: "assistant",
9679
9731
  ...s.phase === "commentary" || s.phase === "final_answer" ? { phase: s.phase } : {},
9680
- content: Nn(
9732
+ content: Un(
9681
9733
  Vc(s.content),
9682
9734
  e
9683
9735
  ),
@@ -9694,7 +9746,7 @@ function Xf(t, e) {
9694
9746
  id: String(n.id ?? crypto.randomUUID()),
9695
9747
  role: o,
9696
9748
  ...s.phase === "commentary" || s.phase === "final_answer" ? { phase: s.phase } : {},
9697
- content: Nn(
9749
+ content: Un(
9698
9750
  Vc(s.content),
9699
9751
  e
9700
9752
  ),
@@ -10216,7 +10268,7 @@ function Td(t) {
10216
10268
  const e = t.get("content-type")?.toLowerCase() ?? "", n = t.get("content-length"), i = Number(n);
10217
10269
  return n !== null && Number.isInteger(i) && i >= 0 && i <= Wr && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
10218
10270
  }
10219
- function Ln(t, e = {}, n) {
10271
+ function On(t, e = {}, n) {
10220
10272
  if (Sm(n))
10221
10273
  return !0;
10222
10274
  const i = Object.entries(e).find(([s]) => s.toLowerCase() === "content-type")?.[1]?.toLowerCase();
@@ -10233,7 +10285,7 @@ function Ln(t, e = {}, n) {
10233
10285
  }
10234
10286
  }
10235
10287
  function vm(t, e) {
10236
- if (Ln(t))
10288
+ if (On(t))
10237
10289
  return !0;
10238
10290
  try {
10239
10291
  const n = new URL(t, location.href), i = new URL(e);
@@ -10598,7 +10650,7 @@ ${c.textContent.trim()}`), p = c.closest("[data-canonical-item-key]")?.dataset.c
10598
10650
  const h = c.cloneNode(!0);
10599
10651
  h.querySelectorAll(
10600
10652
  "button:not(.error__link), a.error__link, a.pluno-pa-widget__error-retry, svg, [hidden], [aria-hidden='true']"
10601
- ).forEach((g) => g.remove()), e(a, u, cd(h.textContent ?? ""), ...p ? [p] : []);
10653
+ ).forEach((f) => f.remove()), e(a, u, cd(h.textContent ?? ""), ...p ? [p] : []);
10602
10654
  }
10603
10655
  }, o = new MutationObserver(s);
10604
10656
  return o.observe(t, {
@@ -10648,13 +10700,13 @@ function ry(t) {
10648
10700
  e ^= t.charCodeAt(n), e = Math.imul(e, 16777619);
10649
10701
  return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
10650
10702
  }
10651
- const ay = "0.1.234", cy = 80, ly = 64e3, il = 60, Vo = 160;
10703
+ const ay = "0.1.235", cy = 80, ly = 64e3, il = 60, Vo = 160;
10652
10704
  function dy(t, e, n, i) {
10653
10705
  const s = /* @__PURE__ */ new Map(), o = [], a = [];
10654
10706
  let r = 0, c = 0, u = 0, p = crypto.randomUUID(), l = i.getState();
10655
10707
  e.dataset.executionKey = l.activity?.executionKey ?? "";
10656
- let h = l.user?.id, g = null, y = "", f = "", w = "";
10657
- const b = e.ownerDocument.defaultView;
10708
+ let h = l.user?.id, f = null, y = "", g = "", b = "";
10709
+ const w = e.ownerDocument.defaultView;
10658
10710
  let S, R = /* @__PURE__ */ new Map(), k = l.sessionId;
10659
10711
  const C = /* @__PURE__ */ new Set(), D = /* @__PURE__ */ new Map();
10660
10712
  let q = null, Z = null, L = null, de = 0, se = null, fe = null, te = null;
@@ -10664,24 +10716,24 @@ function dy(t, e, n, i) {
10664
10716
  Array.from(e.querySelectorAll('[data-message-role="user"]')).slice(-1)[0]?.dataset.messageKey,
10665
10717
  Array.from(e.querySelectorAll('[data-message-role="user"]')).slice(-1)[0]?.dataset.entryKey
10666
10718
  ]), O = (N) => {
10667
- const ae = b.getComputedStyle(N);
10719
+ const ae = w.getComputedStyle(N);
10668
10720
  return N.getClientRects().length > 0 && ae.visibility !== "hidden" && ae.opacity !== "0" && ae.pointerEvents !== "none" && !N.matches(":disabled") && N.getAttribute("aria-disabled") !== "true" && !N.closest("[inert]");
10669
10721
  };
10670
10722
  function V() {
10671
- Z !== null && b.clearTimeout(Z), Z = null, L = null;
10723
+ Z !== null && w.clearTimeout(Z), Z = null, L = null;
10672
10724
  }
10673
10725
  function Y(N = !1) {
10674
- V(), fe = null, te !== null && b.clearTimeout(te), te = null, S = void 0, R.clear(), D.clear(), q !== null && b.clearTimeout(q), q = null, N && C.clear();
10726
+ V(), fe = null, te !== null && w.clearTimeout(te), te = null, S = void 0, R.clear(), D.clear(), q !== null && w.clearTimeout(q), q = null, N && C.clear();
10675
10727
  }
10676
10728
  function ve() {
10677
- const N = e.querySelector(".pluno-pa-widget__panel") ?? e, ae = b.getComputedStyle(N);
10729
+ const N = e.querySelector(".pluno-pa-widget__panel") ?? e, ae = w.getComputedStyle(N);
10678
10730
  if (l.isLoadingSession || e.ownerDocument.hidden || !N.getClientRects().length || ae.visibility === "hidden" || ae.display === "none" || ae.opacity === "0") {
10679
10731
  Y();
10680
10732
  return;
10681
10733
  }
10682
10734
  const X = (_, E) => Array.from(e.querySelectorAll(_)).flatMap((B) => B.getAttribute(E) ? [B.getAttribute(E)] : []), he = ".pluno-pa-widget__tool-group--active, .tool-group--active, .pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]", me = [];
10683
10735
  for (const _ of Array.from(e.querySelectorAll(`${he}, [data-message-role="user"]`))) {
10684
- const E = b.getComputedStyle(_);
10736
+ const E = w.getComputedStyle(_);
10685
10737
  !_.getClientRects().length || E.visibility === "hidden" || E.opacity === "0" || _.parentElement?.closest(he) || me.push(_.dataset.messageRole === "user" ? "user" : "thinking");
10686
10738
  }
10687
10739
  let T = 0;
@@ -10697,11 +10749,11 @@ function dy(t, e, n, i) {
10697
10749
  for (let K = 0; K < Q.length; K += 1)
10698
10750
  H = Math.imul(H ^ Q.charCodeAt(K), 16777619) >>> 0;
10699
10751
  }
10700
- const be = b.performance.now();
10701
- H !== L && (L = H, de = be), T = be - de, Z !== null && b.clearTimeout(Z), Z = T < 3e5 ? b.setTimeout(ve, 3e5 - T) : null;
10752
+ const be = w.performance.now();
10753
+ H !== L && (L = H, de = be), T = be - de, Z !== null && w.clearTimeout(Z), Z = T < 3e5 ? w.setTimeout(ve, 3e5 - T) : null;
10702
10754
  } else
10703
10755
  V(), C.delete("thinking-without-progress");
10704
- const j = Array.from(e.querySelectorAll(".pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]")).some((_) => _.getClientRects().length > 0 && b.getComputedStyle(_).visibility !== "hidden" && b.getComputedStyle(_).opacity !== "0"), oe = l.isThinking || l.turnPhase != null || l.pendingMessageStatus != null || j;
10756
+ const j = Array.from(e.querySelectorAll(".pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]")).some((_) => _.getClientRects().length > 0 && w.getComputedStyle(_).visibility !== "hidden" && w.getComputedStyle(_).opacity !== "0"), oe = l.isThinking || l.turnPhase != null || l.pendingMessageStatus != null || j;
10705
10757
  (!oe || fe && fe.responseKey !== I()) && (fe = null);
10706
10758
  const ke = {
10707
10759
  executionKey: l.activity?.executionKey,
@@ -10711,7 +10763,7 @@ function dy(t, e, n, i) {
10711
10763
  enabledStopControlCount: Array.from(e.querySelectorAll(
10712
10764
  'button[aria-label="Stop"], button[aria-label="Stop generating"]'
10713
10765
  )).filter(O).length,
10714
- stopPendingMs: fe ? b.performance.now() - fe.at : 0,
10766
+ stopPendingMs: fe ? w.performance.now() - fe.at : 0,
10715
10767
  thinkingSequence: me,
10716
10768
  thinkingIdleMs: T,
10717
10769
  messageKeys: Array.from(e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]")).flatMap((_) => _.dataset.messageKey ?? _.dataset.entryKey ?? []),
@@ -10734,13 +10786,13 @@ function dy(t, e, n, i) {
10734
10786
  })
10735
10787
  } : void 0, Ke = zg(ke, Ee), St = new Set(Ke.map((_) => _.code));
10736
10788
  for (const _ of D.keys()) St.has(_) || D.delete(_);
10737
- const ye = b.performance.now();
10789
+ const ye = w.performance.now();
10738
10790
  for (const { code: _ } of Ke) {
10739
10791
  if (C.has(_)) continue;
10740
10792
  const E = D.get(_) ?? ye;
10741
10793
  ye - E >= 250 ? (C.add(_), D.delete(_), i.reportInvalidStateTransition?.(`ui_invariant:${_}`, void 0, ju(ke, S))) : D.set(_, E);
10742
10794
  }
10743
- Ke.length === 0 && (S = ke, R = new Map(Array.from(e.querySelectorAll("[data-terminal-response-key][data-canonical-item-key]")).map((_) => [_.dataset.terminalResponseKey, _.dataset.canonicalItemKey]))), q !== null && b.clearTimeout(q), q = D.size ? b.setTimeout(() => {
10795
+ Ke.length === 0 && (S = ke, R = new Map(Array.from(e.querySelectorAll("[data-terminal-response-key][data-canonical-item-key]")).map((_) => [_.dataset.terminalResponseKey, _.dataset.canonicalItemKey]))), q !== null && w.clearTimeout(q), q = D.size ? w.setTimeout(() => {
10744
10796
  q = null, ve();
10745
10797
  }, Math.max(1, 250 - (ye - Math.min(...D.values())))) : null;
10746
10798
  }
@@ -10768,7 +10820,7 @@ function dy(t, e, n, i) {
10768
10820
  };
10769
10821
  if (N === "paint" && i.reportResponseVisibility) {
10770
10822
  const _ = e.querySelector(".pluno-pa-widget__panel") ?? e, E = (Se) => {
10771
- const Ce = b.getComputedStyle(Se);
10823
+ const Ce = w.getComputedStyle(Se);
10772
10824
  return Se.getClientRects().length > 0 && Ce.visibility !== "hidden" && Ce.display !== "none" && Ce.opacity !== "0";
10773
10825
  }, B = E(_) && E(e), H = !e.ownerDocument.hidden, be = new Set(Array.from(e.querySelectorAll("[data-canonical-item-key]")).filter(E).map((Se) => Se.dataset.canonicalItemKey)), z = B && H && !l.isLoadingSession ? [...l.messages].reverse().find((Se) => (Se.role === "assistant" || Se.dataType === "commentary_history" || Se.dataType === "tool_summary") && be.has(Se.id)) : void 0, ee = B && H && !l.isLoadingSession && !!l.assistantDraft.trim() && Array.from(e.querySelectorAll("[data-message-key], [data-entry-key]")).some((Se) => E(Se) && (Se.dataset.messageKey === `assistant:${l.assistantDraftItemId}` || Se.dataset.entryKey === l.assistantDraftItemId)), Q = {
10774
10826
  sessionId: l.sessionId,
@@ -10778,12 +10830,12 @@ function dy(t, e, n, i) {
10778
10830
  documentVisible: H,
10779
10831
  loading: l.isLoadingSession
10780
10832
  }, K = JSON.stringify(Q);
10781
- K !== w && (w = K, i.reportResponseVisibility({ ...Q, observedAt: (/* @__PURE__ */ new Date()).toISOString() }));
10833
+ K !== b && (b = K, i.reportResponseVisibility({ ...Q, observedAt: (/* @__PURE__ */ new Date()).toISOString() }));
10782
10834
  }
10783
10835
  const oe = [...l.messages].reverse().find((_) => _.role === "user" && (!l.activeResponseUserMessageId || _.id === l.activeResponseUserMessageId)), ke = l.activity?.phase === "submitting" || l.turnPhase === "sending" || l.pendingMessageStatus === "sending", Ee = l.activity?.phase === "stopping";
10784
10836
  if (oe && i.reportOperationTiming) {
10785
10837
  const _ = Ee || l.activity?.phase === "stopped" ? "stop" : "send", E = `${_}:${oe.id}`;
10786
- (ke || Ee) && !s.has(E) && (s.set(E, { timer: Bn((be) => i.reportOperationTiming?.(be), {
10838
+ (ke || Ee) && !s.has(E) && (s.set(E, { timer: zn((be) => i.reportOperationTiming?.(be), {
10787
10839
  operation: _,
10788
10840
  layer: "renderer",
10789
10841
  entrySurface: n,
@@ -10801,12 +10853,12 @@ function dy(t, e, n, i) {
10801
10853
  }
10802
10854
  }
10803
10855
  const Ke = JSON.stringify(j);
10804
- if (N === "runtime" && Ke === y || N === "paint" && Ke === f) return;
10805
- N === "runtime" && (y = Ke), N === "paint" && (f = Ke);
10856
+ if (N === "runtime" && Ke === y || N === "paint" && Ke === g) return;
10857
+ N === "runtime" && (y = Ke), N === "paint" && (g = Ke);
10806
10858
  const St = {
10807
10859
  sequence: ++u,
10808
10860
  occurred_at: (/* @__PURE__ */ new Date()).toISOString(),
10809
- monotonic_ms: Math.round(b.performance.now()),
10861
+ monotonic_ms: Math.round(w.performance.now()),
10810
10862
  kind: N,
10811
10863
  action: ae,
10812
10864
  ...j
@@ -10815,12 +10867,12 @@ function dy(t, e, n, i) {
10815
10867
  o.shift(), r -= a.shift(), c += 1;
10816
10868
  }
10817
10869
  function P() {
10818
- g === null && (g = b.requestAnimationFrame(() => {
10819
- g = null, ue("paint"), ve();
10870
+ f === null && (f = w.requestAnimationFrame(() => {
10871
+ f = null, ue("paint"), ve();
10820
10872
  }));
10821
10873
  }
10822
10874
  const pe = i.on("state", (N) => {
10823
- N.user?.id !== h || N.sessionId !== k ? (Y(!0), k = N.sessionId) : N.isLoadingSession && Y(), N.user?.id !== h && (s.clear(), o.length = 0, a.length = 0, r = 0, c = 0, u = 0, p = crypto.randomUUID(), y = "", f = "", w = "", h = N.user?.id), l = N, e.dataset.executionKey = l.activity?.executionKey ?? "", ue("runtime"), P();
10875
+ N.user?.id !== h || N.sessionId !== k ? (Y(!0), k = N.sessionId) : N.isLoadingSession && Y(), N.user?.id !== h && (s.clear(), o.length = 0, a.length = 0, r = 0, c = 0, u = 0, p = crypto.randomUUID(), y = "", g = "", b = "", h = N.user?.id), l = N, e.dataset.executionKey = l.activity?.executionKey ?? "", ue("runtime"), P();
10824
10876
  }), je = new MutationObserver(P);
10825
10877
  je.observe(e, {
10826
10878
  subtree: !0,
@@ -10831,7 +10883,7 @@ function dy(t, e, n, i) {
10831
10883
  });
10832
10884
  const W = (N) => {
10833
10885
  const ae = N.target?.closest?.("button"), X = ae?.getAttribute("aria-label") ?? ae?.getAttribute("title"), he = X === "New chat" ? "new_chat" : X === "Send" || X === "Send message" ? "send" : X === "Stop" || X === "Stop generating" ? "stop" : X === "Retry" || X === "Retry message" ? "retry" : null;
10834
- ue("click", he), he === "stop" && ae && O(ae) && (fe = { at: b.performance.now(), responseKey: I() }, te !== null && b.clearTimeout(te), te = b.setTimeout(ve, 1e3)), he === "new_chat" && Y(!0);
10886
+ ue("click", he), he === "stop" && ae && O(ae) && (fe = { at: w.performance.now(), responseKey: I() }, te !== null && w.clearTimeout(te), te = w.setTimeout(ve, 1e3)), he === "new_chat" && Y(!0);
10835
10887
  }, xe = () => ue("submit"), He = () => ue("focus");
10836
10888
  e.addEventListener("click", W, !0), e.addEventListener("submit", xe, !0), e.addEventListener("focusin", He, !0), e.addEventListener("input", P, !0);
10837
10889
  const ie = () => {
@@ -10848,7 +10900,7 @@ function dy(t, e, n, i) {
10848
10900
  records: o.map((N) => ({ ...N, item_keys: [...N.item_keys] }))
10849
10901
  }),
10850
10902
  dispose: () => {
10851
- pe(), je.disconnect(), Y(!0), g !== null && b.cancelAnimationFrame(g), e.removeEventListener("click", W, !0), e.removeEventListener("submit", xe, !0), e.removeEventListener("focusin", He, !0), e.removeEventListener("input", P, !0), e.ownerDocument.removeEventListener("visibilitychange", ie), t.__plunoUiFlightRecorder === re && delete t.__plunoUiFlightRecorder;
10903
+ pe(), je.disconnect(), Y(!0), f !== null && w.cancelAnimationFrame(f), e.removeEventListener("click", W, !0), e.removeEventListener("submit", xe, !0), e.removeEventListener("focusin", He, !0), e.removeEventListener("input", P, !0), e.ownerDocument.removeEventListener("visibilitychange", ie), t.__plunoUiFlightRecorder === re && delete t.__plunoUiFlightRecorder;
10852
10904
  }
10853
10905
  };
10854
10906
  return t.__plunoUiFlightRecorder = re, ue("runtime"), P(), re;
@@ -11007,7 +11059,7 @@ async function jy(t = {}) {
11007
11059
  ), a.appendChild(r);
11008
11060
  const u = _b(e), p = e.layout === "floating" ? e.initialDisplayState ?? wb(e) : "shown";
11009
11061
  Pl(e, p);
11010
- let l = e.movableLauncher ? u.launcherPosition : null, h = l !== null, g = u.panelSize, y = null;
11062
+ let l = e.movableLauncher ? u.launcherPosition : null, h = l !== null, f = u.panelSize, y = null;
11011
11063
  r.style.setProperty(
11012
11064
  "--pluno-pa-mobile-panel-top-offset",
11013
11065
  `${e.mobilePanelTopOffset}px`
@@ -11019,7 +11071,7 @@ async function jy(t = {}) {
11019
11071
  e.position
11020
11072
  )
11021
11073
  )), Rl(a, e.accentColor);
11022
- let f = JSON.stringify([
11074
+ let g = JSON.stringify([
11023
11075
  e.accentColor,
11024
11076
  e.colorScheme,
11025
11077
  e.fontFamily,
@@ -11031,7 +11083,7 @@ async function jy(t = {}) {
11031
11083
  fontFamily: e.fontFamily,
11032
11084
  scribbleStyle: e.scribbleStyle
11033
11085
  });
11034
- const w = e.mountTarget ?? await yb(), b = w.ownerDocument, S = r.querySelector(
11086
+ const b = e.mountTarget ?? await yb(), w = b.ownerDocument, S = r.querySelector(
11035
11087
  ".pluno-pa-widget__launcher"
11036
11088
  ), R = r.querySelector(
11037
11089
  ".pluno-pa-widget__launcher-drag-handle"
@@ -11129,7 +11181,7 @@ async function jy(t = {}) {
11129
11181
  ".pluno-pa-widget__proactive-suggestion-feedback"
11130
11182
  ), It = r.querySelector(
11131
11183
  ".pluno-pa-widget__proactive-suggestion-feedback-input"
11132
- ), Vn = r.querySelector(
11184
+ ), Gn = r.querySelector(
11133
11185
  ".pluno-pa-widget__proactive-suggestion-feedback-submit"
11134
11186
  ), qi = r.querySelector(
11135
11187
  ".pluno-pa-widget__proactive-suggestion-feedback-status"
@@ -11154,7 +11206,7 @@ async function jy(t = {}) {
11154
11206
  )
11155
11207
  );
11156
11208
  }, lt = () => {
11157
- if (!H || !be || !Ce || !ca || !It || !Vn || !qi)
11209
+ if (!H || !be || !Ce || !ca || !It || !Gn || !qi)
11158
11210
  return;
11159
11211
  const d = e.proactiveSuggestion ?? Wt, m = d !== null && !A.getState().isThinking, v = q.querySelector(
11160
11212
  ".pluno-pa-widget__proactive-suggestion-slot"
@@ -11164,7 +11216,7 @@ async function jy(t = {}) {
11164
11216
  M
11165
11217
  ), be.textContent = d?.question ?? "", Ce.hidden = e.proactiveSuggestion === null || dn, ca.hidden = Wt === null;
11166
11218
  const ne = We === "success";
11167
- It.hidden = ne, Vn.hidden = ne, Vn.disabled = We === "submitting" || It.value.trim().length === 0, Vn.textContent = We === "submitting" ? "Sending…" : "Send feedback", qi.textContent = We === "success" ? "Thanks — this helps improve your suggestions." : We === "error" ? "Couldn’t send feedback. Please try again." : "Tell Pluno what made this suggestion miss the mark.", qi.classList.toggle(
11219
+ It.hidden = ne, Gn.hidden = ne, Gn.disabled = We === "submitting" || It.value.trim().length === 0, Gn.textContent = We === "submitting" ? "Sending…" : "Send feedback", qi.textContent = We === "success" ? "Thanks — this helps improve your suggestions." : We === "error" ? "Couldn’t send feedback. Please try again." : "Tell Pluno what made this suggestion miss the mark.", qi.classList.toggle(
11168
11220
  "pluno-pa-widget__proactive-suggestion-feedback-status--success",
11169
11221
  ne
11170
11222
  ), qi.classList.toggle(
@@ -11189,17 +11241,17 @@ async function jy(t = {}) {
11189
11241
  };
11190
11242
  ue.hidden = !e.attachmentsEnabled, ve.disabled = !e.attachmentsEnabled, ve.accept = e.productVariant === "personal" ? "" : cf, Sl(k), Sl(P);
11191
11243
  let Ze = [];
11192
- const Gn = /* @__PURE__ */ new Map(), la = () => {
11193
- for (const d of Gn.values()) URL.revokeObjectURL?.(d);
11194
- Gn.clear();
11244
+ const Jn = /* @__PURE__ */ new Map(), la = () => {
11245
+ for (const d of Jn.values()) URL.revokeObjectURL?.(d);
11246
+ Jn.clear();
11195
11247
  };
11196
11248
  let dt = 0, Vt = 0, da = 0;
11197
11249
  const xt = /* @__PURE__ */ new Map();
11198
11250
  let Gt = null, qt = null;
11199
- const Hs = (d) => d === P ? "widget_composer" : d === k ? "widget_launcher" : d && a.contains(d) ? "widget_control" : d === b.body ? "body" : d === b.documentElement ? "document" : d ? "host_page" : "none", un = (d, m, v = {}) => {
11200
- const x = os(b), M = v.skipIfAlreadyFocused === !0 && x === d;
11251
+ const Hs = (d) => d === P ? "widget_composer" : d === k ? "widget_launcher" : d && a.contains(d) ? "widget_control" : d === w.body ? "body" : d === w.documentElement ? "document" : d ? "host_page" : "none", un = (d, m, v = {}) => {
11252
+ const x = os(w), M = v.skipIfAlreadyFocused === !0 && x === d;
11201
11253
  M || (v.preventScroll ? d.focus({ preventScroll: !0 }) : d.focus());
11202
- const ne = os(b);
11254
+ const ne = os(w);
11203
11255
  return Xe(
11204
11256
  "web-sdk.widget.focus",
11205
11257
  "Programmatic widget focus",
@@ -11221,17 +11273,17 @@ async function jy(t = {}) {
11221
11273
  isThinking: A.getState().isThinking
11222
11274
  }
11223
11275
  ), !M && ne === d;
11224
- }, Jt = (d) => !P.isConnected || P.disabled || P.readOnly || !r.classList.contains("pluno-pa-widget--open") || e.loginRequired || e.signupRequired || Dn(e.billingStatus) ? !1 : un(P, d, {
11276
+ }, Jt = (d) => !P.isConnected || P.disabled || P.readOnly || !r.classList.contains("pluno-pa-widget--open") || e.loginRequired || e.signupRequired || Ln(e.billingStatus) ? !1 : un(P, d, {
11225
11277
  preventScroll: !0,
11226
11278
  skipIfAlreadyFocused: !0
11227
- }), Jn = () => {
11279
+ }), Yn = () => {
11228
11280
  Pw(
11229
11281
  Y,
11230
11282
  Ze,
11231
11283
  (d) => {
11232
11284
  Vt++, Ze = Ze.filter(
11233
11285
  (m, v) => v !== d
11234
- ), Jn(), _e(A.getState()), Te(), Jt("remove_attachment");
11286
+ ), Yn(), _e(A.getState()), Re(), Jt("remove_attachment");
11235
11287
  }
11236
11288
  );
11237
11289
  }, ua = e.loginRequired || e.signupRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (e.tokenEndpoint ? async (d) => xb(
@@ -11286,13 +11338,13 @@ async function jy(t = {}) {
11286
11338
  } catch (d) {
11287
11339
  throw Ks?.release(), o.remove(), d;
11288
11340
  }
11289
- let Yn = A.getState().sessionId, Xn = A.getState().selectionKey, Qn = A.getState().user?.id ?? null, kt = ws.find(
11341
+ let Xn = A.getState().sessionId, Qn = A.getState().selectionKey, Zn = A.getState().user?.id ?? null, kt = ws.find(
11290
11342
  (d) => d.value === e.model
11291
- )?.value ?? ks[0].value, Zn = !1;
11343
+ )?.value ?? ks[0].value, ei = !1;
11292
11344
  const ha = e.productVariant === "personal" && e.onModelChange !== void 0;
11293
11345
  pe.hidden = !ha;
11294
11346
  const Rn = () => {
11295
- const d = ws.find((v) => v.value === kt), m = Zn;
11347
+ const d = ws.find((v) => v.value === kt), m = ei;
11296
11348
  je.textContent = d?.label ?? kt, pe.dataset.loading = String(m), pe.setAttribute("aria-disabled", String(m));
11297
11349
  for (const v of W) {
11298
11350
  const x = v.dataset.model === kt;
@@ -11302,29 +11354,29 @@ async function jy(t = {}) {
11302
11354
  kt = d, A.setModel(d), Rn();
11303
11355
  };
11304
11356
  Rn(), pe.addEventListener("toggle", () => {
11305
- pe.open && Zn && (pe.open = !1), pe.open || pe.querySelector(".pluno-pa-widget__model-more")?.removeAttribute("open");
11357
+ pe.open && ei && (pe.open = !1), pe.open || pe.querySelector(".pluno-pa-widget__model-more")?.removeAttribute("open");
11306
11358
  });
11307
11359
  const ga = (d) => {
11308
11360
  pe.open && !d.composedPath().includes(pe) && (pe.open = !1);
11309
11361
  };
11310
- b.addEventListener("pointerdown", ga, !0);
11362
+ w.addEventListener("pointerdown", ga, !0);
11311
11363
  for (const d of W)
11312
11364
  d.addEventListener("click", () => {
11313
11365
  const m = ws.find((x) => x.value === d.dataset.model);
11314
- if (!m || m.value === kt && A.getModel() === m.value || Zn) {
11366
+ if (!m || m.value === kt && A.getModel() === m.value || ei) {
11315
11367
  pe.open = !1;
11316
11368
  return;
11317
11369
  }
11318
11370
  const v = kt;
11319
- kt = m.value, Zn = !0, pe.open = !1, pe.title = "", Rn(), Promise.resolve(e.onModelChange?.(m.value)).then(() => gu(m.value)).catch(() => {
11371
+ kt = m.value, ei = !0, pe.open = !1, pe.title = "", Rn(), Promise.resolve(e.onModelChange?.(m.value)).then(() => gu(m.value)).catch(() => {
11320
11372
  kt = v, pe.title = "Could not change model";
11321
11373
  }).finally(() => {
11322
- Zn = !1, Rn();
11374
+ ei = !1, Rn();
11323
11375
  });
11324
11376
  });
11325
- w.appendChild(o);
11377
+ b.appendChild(o);
11326
11378
  const Li = e.manageTaskPageTitle && e.productVariant === "personal" && e.entrySurface === "main_web_chat" ? new Og(
11327
- Ng(b)
11379
+ Ng(w)
11328
11380
  ) : null;
11329
11381
  Xe(
11330
11382
  "web-sdk.widget",
@@ -11337,10 +11389,10 @@ async function jy(t = {}) {
11337
11389
  }
11338
11390
  );
11339
11391
  const Ws = new Set(u.openToolGroupKeys);
11340
- let ut = null, Yt = null, qe = !1, Xt = !1, Dt = {
11392
+ let ut = null, Yt = null, De = !1, Xt = !1, Dt = {
11341
11393
  enabled: !0
11342
- }, Qt = 0, Vs = null, pn = null, hn = null, Oi = null, ei = !1, ge = null, fa = "local";
11343
- const ma = (d) => Yn !== null && Yn !== d.sessionId || Qn !== null && Qn !== (d.user?.id ?? null) || Xn !== void 0 && Xn !== d.selectionKey, ya = (d) => Hu(T, d, {
11394
+ }, Qt = 0, Vs = null, pn = null, hn = null, Oi = null, ti = !1, ge = null, fa = "local";
11395
+ const ma = (d) => Xn !== null && Xn !== d.sessionId || Zn !== null && Zn !== (d.user?.id ?? null) || Qn !== void 0 && Qn !== d.selectionKey, ya = (d) => Hu(T, d, {
11344
11396
  renderSource: fa,
11345
11397
  guardCreatedAt: ge?.createdAt ?? null,
11346
11398
  selectionFencePending: ma(d)
@@ -11348,7 +11400,7 @@ async function jy(t = {}) {
11348
11400
  let Ui = "", Fe = !1, et = null, wa = location.origin, ba = A.getState().sessionId, _a = A.getState().user?.id ?? null, Gs = A.getState().status, Lt = () => {
11349
11401
  }, Js = "", tt = A.getSessionHistoryState();
11350
11402
  const fu = A.subscribeSessionHistory((d) => {
11351
- tt = d, qe || Lt();
11403
+ tt = d, De || Lt();
11352
11404
  }), nt = (d, m) => {
11353
11405
  Dt = { enabled: d, reason: m };
11354
11406
  }, pt = () => {
@@ -11357,16 +11409,16 @@ async function jy(t = {}) {
11357
11409
  const x = `${d}:${m ?? "current-view"}`;
11358
11410
  Ni.has(x) || (Ni.add(x), A.reportInvalidStateTransition?.(d, m, v));
11359
11411
  }, mu = () => {
11360
- iy(ei, Bi), he.hidden = !1;
11412
+ iy(ti, Bi), he.hidden = !1;
11361
11413
  }, va = () => {
11362
11414
  ge?.observedConversation && T.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report)") && (ge.observedWelcome ??= ya(A.getState())), ge?.observedWelcome && !ge.pendingSubmission && (Bi("submitted_turn_returned_to_welcome_without_new_chat", ge.clientMessageId, {
11363
11415
  before: ge.observedConversation,
11364
11416
  current: ge.observedWelcome
11365
11417
  }), ge = null);
11366
11418
  }, yu = (d = "jump") => {
11367
- nt(!0, d), pt(), On(T, () => Dt.enabled), Qt = T.scrollTop;
11419
+ nt(!0, d), pt(), Nn(T, () => Dt.enabled), Qt = T.scrollTop;
11368
11420
  }, zi = (d) => {
11369
- Vs = d, d === "up" && T.scrollTop < Qt - 1 && (ei = !0, nt(!1, "userScroll")), pn !== null && window.clearTimeout(pn), pn = window.setTimeout(() => {
11421
+ Vs = d, d === "up" && T.scrollTop < Qt - 1 && (ti = !0, nt(!1, "userScroll")), pn !== null && window.clearTimeout(pn), pn = window.setTimeout(() => {
11370
11422
  Vs = null, pn = null;
11371
11423
  }, 500);
11372
11424
  };
@@ -11397,16 +11449,16 @@ async function jy(t = {}) {
11397
11449
  M.disabled = m || ne, ne && M.setAttribute("aria-current", "page");
11398
11450
  const Ae = document.createElement("span");
11399
11451
  if (Ae.className = "pluno-pa-widget__history-item-title", Ae.textContent = yl(x), M.setAttribute("aria-label", yl(x)), x.isPinned) {
11400
- const Oe = document.createElementNS("http://www.w3.org/2000/svg", "svg");
11401
- Oe.setAttribute("viewBox", "0 0 24 24"), Oe.setAttribute("width", "12"), Oe.setAttribute("height", "12"), Oe.setAttribute("role", "img"), Oe.setAttribute("aria-label", "Pinned conversation"), Oe.style.cssText = "display:inline-block;margin-right:6px;vertical-align:middle", Oe.setAttribute("fill", "none"), Oe.setAttribute("stroke", "currentColor"), Oe.setAttribute("stroke-width", "2"), Oe.setAttribute("stroke-linecap", "round"), Oe.setAttribute("stroke-linejoin", "round");
11452
+ const Ne = document.createElementNS("http://www.w3.org/2000/svg", "svg");
11453
+ Ne.setAttribute("viewBox", "0 0 24 24"), Ne.setAttribute("width", "12"), Ne.setAttribute("height", "12"), Ne.setAttribute("role", "img"), Ne.setAttribute("aria-label", "Pinned conversation"), Ne.style.cssText = "display:inline-block;margin-right:6px;vertical-align:middle", Ne.setAttribute("fill", "none"), Ne.setAttribute("stroke", "currentColor"), Ne.setAttribute("stroke-width", "2"), Ne.setAttribute("stroke-linecap", "round"), Ne.setAttribute("stroke-linejoin", "round");
11402
11454
  for (const $ of [
11403
11455
  "M12 17v5",
11404
11456
  "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"
11405
11457
  ]) {
11406
11458
  const mt = document.createElementNS("http://www.w3.org/2000/svg", "path");
11407
- mt.setAttribute("d", $), Oe.append(mt);
11459
+ mt.setAttribute("d", $), Ne.append(mt);
11408
11460
  }
11409
- Ae.prepend(Oe);
11461
+ Ae.prepend(Ne);
11410
11462
  }
11411
11463
  const we = document.createElement("time");
11412
11464
  we.className = "pluno-pa-widget__history-time", we.dateTime = x.lastActiveAt, we.textContent = wl(
@@ -11415,7 +11467,7 @@ async function jy(t = {}) {
11415
11467
  );
11416
11468
  const ft = document.createElement("small");
11417
11469
  ft.className = "pluno-pa-widget__history-path", ft.textContent = lw(x), M.append(Ae, we, ft), M.addEventListener("click", () => {
11418
- Fe = !1, Lt(), ge = null, ei = !1, Ni.clear(), nt(!0, "newSession"), pt(), A.loadSession(x.id), oi = null, _e(A.getState()), Jt("history_session_selected");
11470
+ Fe = !1, Lt(), ge = null, ti = !1, Ni.clear(), nt(!0, "newSession"), pt(), A.loadSession(x.id), ri = null, _e(A.getState()), Jt("history_session_selected");
11419
11471
  }), N.appendChild(M);
11420
11472
  }
11421
11473
  if (m && d.length > 0) {
@@ -11430,19 +11482,19 @@ async function jy(t = {}) {
11430
11482
  });
11431
11483
  }, Ys = () => {
11432
11484
  et === null && (et = window.setTimeout(() => {
11433
- et = null, !(qe || !r.classList.contains("pluno-pa-widget--open")) && Sa();
11485
+ et = null, !(De || !r.classList.contains("pluno-pa-widget--open")) && Sa();
11434
11486
  }, 0));
11435
11487
  }, wu = () => {
11436
11488
  const d = tt.data?.nextCursor ?? null;
11437
11489
  tt.status === "loading_more" || !d || N.scrollHeight - N.scrollTop - N.clientHeight <= 24 && A.loadMoreSessionHistory();
11438
11490
  }, Ia = () => {
11439
- qe || typeof document > "u" || (Rl(a, e.accentColor), o.isConnected || (e.mountTarget?.isConnected ? e.mountTarget.appendChild(o) : e.mountTarget || b.body?.appendChild(o)));
11491
+ De || typeof document > "u" || (Rl(a, e.accentColor), o.isConnected || (e.mountTarget?.isConnected ? e.mountTarget.appendChild(o) : e.mountTarget || w.body?.appendChild(o)));
11440
11492
  }, xa = new MutationObserver(Ia);
11441
- xa.observe(b.documentElement, {
11493
+ xa.observe(w.documentElement, {
11442
11494
  childList: !0,
11443
11495
  subtree: !0
11444
11496
  }), Ia();
11445
- const ti = (d = !0) => {
11497
+ const ni = (d = !0) => {
11446
11498
  const m = Ti(r, d);
11447
11499
  return bs(
11448
11500
  r,
@@ -11459,14 +11511,14 @@ async function jy(t = {}) {
11459
11511
  composerValue: P.value,
11460
11512
  openToolGroupKeys: [...Ws],
11461
11513
  launcherPosition: h ? l : null,
11462
- panelSize: g
11514
+ panelSize: f
11463
11515
  });
11464
11516
  }, $i = (d, m) => {
11465
11517
  e.onDisplayStateChange?.(d, m);
11466
- }, ni = (d, m = !0, v = "external_request") => {
11518
+ }, ii = (d, m = !0, v = "external_request") => {
11467
11519
  const x = r.classList.contains("pluno-pa-widget--minimized");
11468
11520
  if (Pl(e, d), d === "shown") {
11469
- r.classList.remove("pluno-pa-widget--minimized"), S.removeAttribute("tabindex"), S.removeAttribute("role"), S.removeAttribute("aria-label"), !r.classList.contains("pluno-pa-widget--open") && !r.classList.contains("pluno-pa-widget--closing") && ii(!1), m && $i("shown", v);
11521
+ r.classList.remove("pluno-pa-widget--minimized"), S.removeAttribute("tabindex"), S.removeAttribute("role"), S.removeAttribute("aria-label"), !r.classList.contains("pluno-pa-widget--open") && !r.classList.contains("pluno-pa-widget--closing") && si(!1), m && $i("shown", v);
11470
11522
  return;
11471
11523
  }
11472
11524
  ut !== null && (window.clearTimeout(ut), ut = null), r.classList.remove("pluno-pa-widget--open"), r.classList.remove("pluno-pa-widget--closing"), r.classList.add("pluno-pa-widget--minimized"), S.hidden = !1, S.setAttribute("role", "button"), S.setAttribute("aria-label", "Open Pluno"), q.hidden = !0, se.hidden = !0, S.tabIndex = 0, P.value = "", lt(), rn(
@@ -11496,13 +11548,13 @@ async function jy(t = {}) {
11496
11548
  closeHidden: se.hidden,
11497
11549
  ...m
11498
11550
  });
11499
- }, ii = (d = !0) => {
11551
+ }, si = (d = !0) => {
11500
11552
  if (!l) {
11501
11553
  rn(r, null);
11502
- const v = ti(d);
11554
+ const v = ni(d);
11503
11555
  return Di(), v;
11504
11556
  }
11505
- const m = ti(d);
11557
+ const m = ni(d);
11506
11558
  return rn(r, m), Di(), gn("Applied stored closed launcher position", {
11507
11559
  visibleLauncherPosition: m
11508
11560
  }), m;
@@ -11516,7 +11568,7 @@ async function jy(t = {}) {
11516
11568
  y: d.y - m.y
11517
11569
  });
11518
11570
  }, Xs = () => {
11519
- const d = In(g).width;
11571
+ const d = In(f).width;
11520
11572
  return q.getBoundingClientRect().width || d;
11521
11573
  }, ka = () => {
11522
11574
  if (r.classList.contains("pluno-pa-widget--minimized")) {
@@ -11530,10 +11582,10 @@ async function jy(t = {}) {
11530
11582
  );
11531
11583
  return;
11532
11584
  }
11533
- const d = ii();
11585
+ const d = si();
11534
11586
  if (r.classList.contains("pluno-pa-widget--open") || r.classList.contains("pluno-pa-widget--closing")) {
11535
- Jo(r, g);
11536
- const m = In(g);
11587
+ Jo(r, f);
11588
+ const m = In(f);
11537
11589
  er(
11538
11590
  L,
11539
11591
  Xs()
@@ -11543,7 +11595,7 @@ async function jy(t = {}) {
11543
11595
  r,
11544
11596
  d,
11545
11597
  e.position,
11546
- g
11598
+ f
11547
11599
  ),
11548
11600
  m
11549
11601
  );
@@ -11558,11 +11610,11 @@ async function jy(t = {}) {
11558
11610
  };
11559
11611
  let Ea = () => {
11560
11612
  };
11561
- window.addEventListener("resize", ka), e.movableLauncher && R ? (ii(), Ea = Gy({
11613
+ window.addEventListener("resize", ka), e.movableLauncher && R ? (si(), Ea = Gy({
11562
11614
  root: r,
11563
11615
  launcher: S,
11564
11616
  launcherDragHandle: R,
11565
- getPosition: () => ti(),
11617
+ getPosition: () => ni(),
11566
11618
  setPosition: (d) => {
11567
11619
  const m = d, v = Ti(r), x = bs(
11568
11620
  r,
@@ -11579,38 +11631,38 @@ async function jy(t = {}) {
11579
11631
  persist: () => {
11580
11632
  h = !0, Ve(), gn("Persisted closed launcher drag position");
11581
11633
  }
11582
- })) : rn(r, null), Jo(r, g);
11634
+ })) : rn(r, null), Jo(r, f);
11583
11635
  const Ca = () => {
11584
- const d = In(g), m = ti();
11636
+ const d = In(f), m = ni();
11585
11637
  return {
11586
11638
  position: xi(
11587
11639
  y ? _s(y, d) : Qo(
11588
11640
  r,
11589
11641
  m,
11590
11642
  e.position,
11591
- g
11643
+ f
11592
11644
  ),
11593
11645
  d
11594
11646
  ),
11595
11647
  size: d
11596
11648
  };
11597
11649
  }, bu = (d) => {
11598
- g = Bs(d.size), Jo(r, g), er(
11650
+ f = Bs(d.size), Jo(r, f), er(
11599
11651
  L,
11600
11652
  Xs()
11601
11653
  );
11602
11654
  const m = xi(
11603
11655
  d.position,
11604
- In(g)
11656
+ In(f)
11605
11657
  );
11606
11658
  y = Xo(
11607
11659
  m,
11608
- In(g)
11660
+ In(f)
11609
11661
  );
11610
- const v = ti();
11662
+ const v = ni();
11611
11663
  Fi(m, v);
11612
11664
  }, _u = (d) => {
11613
- const m = In(g), v = xi(
11665
+ const m = In(f), v = xi(
11614
11666
  d,
11615
11667
  m
11616
11668
  ), x = Ti(r), M = bs(
@@ -11643,17 +11695,17 @@ async function jy(t = {}) {
11643
11695
  }) : () => {
11644
11696
  }, fn = document.createElement("div");
11645
11697
  fn.className = "pluno-pa-widget__account-load-notice", fn.hidden = !0;
11646
- const si = document.createElement("div");
11647
- si.className = "pluno-pa-widget__error";
11698
+ const oi = document.createElement("div");
11699
+ oi.className = "pluno-pa-widget__error";
11648
11700
  const mn = document.createElement("button");
11649
11701
  mn.type = "button", mn.className = "pluno-pa-widget__error-retry";
11650
- const Aa = Fn(), Ta = document.createTextNode("Try again");
11651
- mn.append(Aa, Ta), si.append("Pluno could not load your account. Try again.", mn), V.after(fn);
11702
+ const Aa = jn(), Ta = document.createTextNode("Try again");
11703
+ mn.append(Aa, Ta), oi.append("Pluno could not load your account. Try again.", mn), V.after(fn);
11652
11704
  let Qs = !1, yn = !1;
11653
11705
  const Zs = () => {
11654
- fn.hidden = !Qs || !!e.billingStatus || e.productVariant !== "personal" || Ot(), fn.hidden ? si.remove() : si.parentElement !== fn && fn.append(si), mn.disabled = yn, mn.setAttribute("aria-busy", String(yn)), Aa.hidden = !yn, Ta.data = yn ? "Retrying" : "Try again";
11706
+ fn.hidden = !Qs || !!e.billingStatus || e.productVariant !== "personal" || Ot(), fn.hidden ? oi.remove() : oi.parentElement !== fn && fn.append(oi), mn.disabled = yn, mn.setAttribute("aria-busy", String(yn)), Aa.hidden = !yn, Ta.data = yn ? "Retrying" : "Try again";
11655
11707
  }, eo = async () => {
11656
- if (!(yn || qe)) {
11708
+ if (!(yn || De)) {
11657
11709
  yn = !0, Zs();
11658
11710
  try {
11659
11711
  await A.refreshAccount(), Qs = !1;
@@ -11664,19 +11716,19 @@ async function jy(t = {}) {
11664
11716
  { message: d instanceof Error ? d.message : String(d) }
11665
11717
  );
11666
11718
  } finally {
11667
- yn = !1, qe || Zs();
11719
+ yn = !1, De || Zs();
11668
11720
  }
11669
11721
  }
11670
11722
  };
11671
11723
  mn.addEventListener("click", () => {
11672
11724
  eo();
11673
11725
  });
11674
- let oi = null;
11726
+ let ri = null;
11675
11727
  const Ra = (d) => {
11676
11728
  if (Ot())
11677
11729
  return;
11678
11730
  const m = Date.now(), v = window.location.href;
11679
- d === "composer_input" && oi?.scope === v && m - oi.requestedAt < uy || (d === "composer_input" && (oi = { scope: v, requestedAt: m }), Promise.resolve(A.warmup(d)).catch((x) => {
11731
+ d === "composer_input" && ri?.scope === v && m - ri.requestedAt < uy || (d === "composer_input" && (ri = { scope: v, requestedAt: m }), Promise.resolve(A.warmup(d)).catch((x) => {
11680
11732
  Xe(
11681
11733
  "web-sdk.widget",
11682
11734
  "Failed to warm Product Agent sandbox",
@@ -11685,34 +11737,34 @@ async function jy(t = {}) {
11685
11737
  }));
11686
11738
  }, ht = (d = "", m = !0, v = !0, x = !0, M = "external_request") => {
11687
11739
  const ne = r.classList.contains("pluno-pa-widget--open") || !q.hidden && !r.classList.contains("pluno-pa-widget--closing");
11688
- !ne && x && Ra("panel_open"), eo(), ci && (ci = !1, lo()), r.classList.contains("pluno-pa-widget--open") || (y = null), ut !== null && (window.clearTimeout(ut), ut = null), ni("shown", !1), q.hidden = !1, se.hidden = !1, er(
11740
+ !ne && x && Ra("panel_open"), eo(), li && (li = !1, lo()), r.classList.contains("pluno-pa-widget--open") || (y = null), ut !== null && (window.clearTimeout(ut), ut = null), ii("shown", !1), q.hidden = !1, se.hidden = !1, er(
11689
11741
  L,
11690
11742
  Xs()
11691
11743
  ), r.classList.remove("pluno-pa-widget--closing"), lt();
11692
- const Ae = ii(), we = Qo(
11744
+ const Ae = si(), we = Qo(
11693
11745
  r,
11694
11746
  Ae,
11695
11747
  e.position,
11696
- g
11748
+ f
11697
11749
  );
11698
11750
  if (Fi(we, Ae), gn("Opening launcher at clamped open panel position", {
11699
11751
  openPanelPosition: we,
11700
11752
  visibleLauncherPosition: Ae
11701
11753
  }), nt(!0, "open"), pt(), !ne && e.layout === "floating" && A.recordWidgetLifecycle("opened", M), !m) {
11702
- r.classList.add("pluno-pa-widget--open"), ne || Ys(), S.hidden = !0, d && (P.value = d, _i(P)), On(T, () => Dt.enabled), Qt = T.scrollTop, v && (un(P, "panel_open_immediate"), P.setSelectionRange(P.value.length, P.value.length)), Ve(), $i("shown", M), e.onPanelOpenChange?.(!0, M);
11754
+ r.classList.add("pluno-pa-widget--open"), ne || Ys(), S.hidden = !0, d && (P.value = d, _i(P)), Nn(T, () => Dt.enabled), Qt = T.scrollTop, v && (un(P, "panel_open_immediate"), P.setSelectionRange(P.value.length, P.value.length)), Ve(), $i("shown", M), e.onPanelOpenChange?.(!0, M);
11703
11755
  return;
11704
11756
  }
11705
11757
  const ft = Date.now();
11706
11758
  window.requestAnimationFrame(() => {
11707
- r.classList.add("pluno-pa-widget--open"), ne || Ys(), d && (P.value = d, _i(P)), On(T, () => Dt.enabled), Qt = T.scrollTop, v && (un(P, "panel_open_animation", {
11759
+ r.classList.add("pluno-pa-widget--open"), ne || Ys(), d && (P.value = d, _i(P)), Nn(T, () => Dt.enabled), Qt = T.scrollTop, v && (un(P, "panel_open_animation", {
11708
11760
  scheduledAt: ft
11709
11761
  }), P.setSelectionRange(P.value.length, P.value.length)), Ve(), $i("shown", M), e.onPanelOpenChange?.(!0, M), ut = window.setTimeout(() => {
11710
- S.hidden = !0, On(T, () => Dt.enabled), Qt = T.scrollTop;
11762
+ S.hidden = !0, Nn(T, () => Dt.enabled), Qt = T.scrollTop;
11711
11763
  }, 220);
11712
11764
  });
11713
11765
  }, to = (d = "external_request") => {
11714
11766
  const m = r.classList.contains("pluno-pa-widget--open") || !q.hidden && !r.classList.contains("pluno-pa-widget--closing");
11715
- ut !== null && (window.clearTimeout(ut), ut = null), S.hidden = !1, l && (ii(!1), gn("Closing launcher at stored position")), r.classList.remove("pluno-pa-widget--open"), r.classList.add("pluno-pa-widget--closing"), lt(), Ve(), m && e.layout === "floating" && A.recordWidgetLifecycle("closed", d), e.onPanelOpenChange?.(!1, d), ut = window.setTimeout(() => {
11767
+ ut !== null && (window.clearTimeout(ut), ut = null), S.hidden = !1, l && (si(!1), gn("Closing launcher at stored position")), r.classList.remove("pluno-pa-widget--open"), r.classList.add("pluno-pa-widget--closing"), lt(), Ve(), m && e.layout === "floating" && A.recordWidgetLifecycle("closed", d), e.onPanelOpenChange?.(!1, d), ut = window.setTimeout(() => {
11716
11768
  q.hidden = !0, se.hidden = !0, y = null, r.classList.remove("pluno-pa-widget--closing");
11717
11769
  }, 220);
11718
11770
  };
@@ -11732,7 +11784,7 @@ async function jy(t = {}) {
11732
11784
  const d = k.value;
11733
11785
  ht(d, !0, !0, !0, "launcher_input"), k.value = "";
11734
11786
  });
11735
- let ri = null, Zt = null, ji = null, wn = null, Et = null, De = null;
11787
+ let ai = null, Zt = null, ji = null, wn = null, Et = null, Le = null;
11736
11788
  const Hi = (d) => d === k || d === P, Ma = (d) => d.composedPath().find(Hi) ?? null, Iu = (d) => {
11737
11789
  let m = d;
11738
11790
  for (; m; ) {
@@ -11758,7 +11810,7 @@ async function jy(t = {}) {
11758
11810
  m = M instanceof ShadowRoot ? M.host : null;
11759
11811
  }
11760
11812
  return null;
11761
- }, io = () => os(b), xu = (d) => {
11813
+ }, io = () => os(w), xu = (d) => {
11762
11814
  if (!d.isConnected || !d.matches(ol))
11763
11815
  return !1;
11764
11816
  if (!(d instanceof HTMLElement))
@@ -11780,7 +11832,7 @@ async function jy(t = {}) {
11780
11832
  scheduledAt: v
11781
11833
  });
11782
11834
  }, 0);
11783
- }, ai = (d, m = null) => {
11835
+ }, ci = (d, m = null) => {
11784
11836
  if (Nt === d) {
11785
11837
  d && so(d, m);
11786
11838
  return;
@@ -11788,22 +11840,22 @@ async function jy(t = {}) {
11788
11840
  Nt = d, d !== null ? (so(d, m), wn = window.setInterval(() => {
11789
11841
  const v = Nt;
11790
11842
  if (!v || !xu(v)) {
11791
- ai(null);
11843
+ ci(null);
11792
11844
  return;
11793
11845
  }
11794
11846
  so(v, null);
11795
11847
  }, ky)) : (wn !== null && (window.clearInterval(wn), wn = null), Et !== null && (window.clearTimeout(Et), Et = null), ji = null);
11796
11848
  }, ku = () => {
11797
- wn !== null && (window.clearInterval(wn), wn = null), Et !== null && (window.clearTimeout(Et), Et = null), De !== null && (window.clearTimeout(De), De = null);
11849
+ wn !== null && (window.clearInterval(wn), wn = null), Et !== null && (window.clearTimeout(Et), Et = null), Le !== null && (window.clearTimeout(Le), Le = null);
11798
11850
  }, qa = (d) => {
11799
11851
  const m = Ma(d);
11800
11852
  if (!m)
11801
11853
  return;
11802
11854
  const v = Date.now();
11803
- Zt = v, ri = v, De !== null && window.clearTimeout(De);
11855
+ Zt = v, ai = v, Le !== null && window.clearTimeout(Le);
11804
11856
  const x = Nt ?? no(io());
11805
- x && (ai(x, m), d.stopImmediatePropagation()), De = window.setTimeout(() => {
11806
- if (De = null, Zt !== v)
11857
+ x && (ci(x, m), d.stopImmediatePropagation()), Le = window.setTimeout(() => {
11858
+ if (Le = null, Zt !== v)
11807
11859
  return;
11808
11860
  const M = io();
11809
11861
  if (M === m) {
@@ -11811,44 +11863,44 @@ async function jy(t = {}) {
11811
11863
  return;
11812
11864
  }
11813
11865
  const ne = no(M);
11814
- ne && ai(ne, m);
11866
+ ne && ci(ne, m);
11815
11867
  }, 0);
11816
11868
  }, Ki = (d) => {
11817
11869
  const m = Ma(d);
11818
- m && (ri = Date.now(), Nt !== null && (d.stopImmediatePropagation(), Zt = null, De !== null && (window.clearTimeout(De), De = null), Ve(), d.type === "focus" && m === k && Pa()));
11870
+ m && (ai = Date.now(), Nt !== null && (d.stopImmediatePropagation(), Zt = null, Le !== null && (window.clearTimeout(Le), Le = null), Ve(), d.type === "focus" && m === k && Pa()));
11819
11871
  };
11820
- b.defaultView?.addEventListener(
11872
+ w.defaultView?.addEventListener(
11821
11873
  "pointerdown",
11822
11874
  qa,
11823
11875
  !0
11824
- ), b.defaultView?.addEventListener(
11876
+ ), w.defaultView?.addEventListener(
11825
11877
  "focus",
11826
11878
  Ki,
11827
11879
  !0
11828
- ), b.defaultView?.addEventListener(
11880
+ ), w.defaultView?.addEventListener(
11829
11881
  "focusin",
11830
11882
  Ki,
11831
11883
  !0
11832
11884
  ), r.addEventListener("pointerdown", (d) => {
11833
11885
  Hi(d.target) && d.stopPropagation();
11834
11886
  }), r.addEventListener("focusin", (d) => {
11835
- Hi(d.target) && (d.stopPropagation(), ri = Date.now(), Zt = null, De !== null && (window.clearTimeout(De), De = null), Ve());
11887
+ Hi(d.target) && (d.stopPropagation(), ai = Date.now(), Zt = null, Le !== null && (window.clearTimeout(Le), Le = null), Ve());
11836
11888
  }), r.addEventListener("focusout", (d) => {
11837
11889
  if (!Hi(d.target) || Nt !== null)
11838
11890
  return;
11839
- const m = ri;
11840
- if (ri = null, m === null || Date.now() - m > rl)
11891
+ const m = ai;
11892
+ if (ai = null, m === null || Date.now() - m > rl)
11841
11893
  return;
11842
11894
  const v = d.target, x = Zt !== null && Date.now() - Zt <= rl;
11843
- Zt = null, De !== null && (window.clearTimeout(De), De = null);
11895
+ Zt = null, Le !== null && (window.clearTimeout(Le), Le = null);
11844
11896
  const M = (ne) => {
11845
11897
  const Ae = no(ne);
11846
11898
  if (!Ae)
11847
11899
  return !1;
11848
11900
  if (x)
11849
- return ai(Ae, v), !0;
11901
+ return ci(Ae, v), !0;
11850
11902
  const we = Date.now();
11851
- return ji !== null && we - ji <= xy ? (ai(Ae, v), !0) : (ji = we, !0);
11903
+ return ji !== null && we - ji <= xy ? (ci(Ae, v), !0) : (ji = we, !0);
11852
11904
  };
11853
11905
  M(d.relatedTarget) || window.setTimeout(() => {
11854
11906
  Nt === null && v.isConnected && M(io());
@@ -11858,7 +11910,7 @@ async function jy(t = {}) {
11858
11910
  }), D?.addEventListener("pointerdown", (d) => {
11859
11911
  d.stopPropagation();
11860
11912
  }), D?.addEventListener("click", (d) => {
11861
- d.preventDefault(), d.stopPropagation(), ni("minimized", !0, "minimize_button");
11913
+ d.preventDefault(), d.stopPropagation(), ii("minimized", !0, "minimize_button");
11862
11914
  }), se.addEventListener("click", () => to("close_button")), T.addEventListener("wheel", (d) => {
11863
11915
  zi(d.deltaY < 0 ? "up" : null);
11864
11916
  }), T.addEventListener("pointerdown", (d) => {
@@ -11877,7 +11929,7 @@ async function jy(t = {}) {
11877
11929
  }), T.addEventListener("keydown", (d) => {
11878
11930
  (d.key === "ArrowUp" || d.key === "PageUp" || d.key === "Home") && zi("up");
11879
11931
  }), T.addEventListener("scroll", () => {
11880
- T.scrollTop < Qt - 1 && Vs === "up" && (ei = !0, nt(!1, "userScroll")), Qt = T.scrollTop;
11932
+ T.scrollTop < Qt - 1 && Vs === "up" && (ti = !0, nt(!1, "userScroll")), Qt = T.scrollTop;
11881
11933
  }), he.addEventListener("click", () => {
11882
11934
  yu();
11883
11935
  });
@@ -11890,11 +11942,11 @@ async function jy(t = {}) {
11890
11942
  Da?.observe(j);
11891
11943
  const La = r.querySelector(".pluno-pa-widget__permission-overlay"), Oa = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
11892
11944
  const d = La.offsetHeight;
11893
- T.style.paddingBottom = `${d > 0 ? d + 24 : 12}px`, Dt.enabled && On(T, () => Dt.enabled);
11945
+ T.style.paddingBottom = `${d > 0 ? d + 24 : 12}px`, Dt.enabled && Nn(T, () => Dt.enabled);
11894
11946
  });
11895
11947
  Oa?.observe(La);
11896
11948
  const Ot = () => e.loginRequired || e.signupRequired;
11897
- let Nt = null, ci = !1, oo = A.getState().status === "connected";
11949
+ let Nt = null, li = !1, oo = A.getState().status === "connected";
11898
11950
  const Wi = () => {
11899
11951
  const d = A.getState().status;
11900
11952
  return !oo && A.getState().lastErrorCode !== "connection_failed" && (d === "idle" || d === "connecting" || d === "reconnecting");
@@ -11907,7 +11959,7 @@ async function jy(t = {}) {
11907
11959
  return Wi() ? !1 : d !== "connected" && !(oo && d === "reconnecting");
11908
11960
  }, Pn = () => {
11909
11961
  const d = Ot(), m = A.getState(), v = !m.isThinking && !m.pendingMessageStatus && !!m.lastError;
11910
- k.readOnly = !1, P.readOnly = !1, k.placeholder = d ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : v ? "Needs attention" : ci ? "New update" : e.launcherLabel, P.placeholder = d ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : zt.launcherLabel, fe.hidden = d;
11962
+ k.readOnly = !1, P.readOnly = !1, k.placeholder = d ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : v ? "Needs attention" : li ? "New update" : e.launcherLabel, P.placeholder = d ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : zt.launcherLabel, fe.hidden = d;
11911
11963
  }, co = () => [...xt.values()].some((d) => d.revision === Vt && d.generation === dt), Na = () => {
11912
11964
  const d = A.getState(), m = e.billingStatus;
11913
11965
  return {
@@ -11921,7 +11973,7 @@ async function jy(t = {}) {
11921
11973
  // Delivery belongs to an earlier immutable input; only the current composer handoff blocks Send.
11922
11974
  hasPendingMessage: !1
11923
11975
  };
11924
- }, en = () => e.productVariant === "personal" ? rc(Na()) : !ao() && !Dn(e.billingStatus) && !co(), Ua = () => {
11976
+ }, en = () => e.productVariant === "personal" ? rc(Na()) : !ao() && !Ln(e.billingStatus) && !co(), Ua = () => {
11925
11977
  const d = A.getState(), m = !Wi() && [...xt.values()].some((v) => v.revision === Vt && v.generation === dt);
11926
11978
  return Ju({
11927
11979
  hasRunningAssistantTurn: m || d.isThinking || d.turnPhase !== null || d.pendingMessageStatus !== null,
@@ -11930,29 +11982,29 @@ async function jy(t = {}) {
11930
11982
  hasPreSubmittedAttachment: Ze.length > 0,
11931
11983
  canSubmitMessage: en()
11932
11984
  });
11933
- }, Te = () => {
11985
+ }, Re = () => {
11934
11986
  const d = Ua();
11935
11987
  oa(xe, d.action === "stop"), xe.disabled = d.disabled, e.productVariant === "personal" && (z && (z.disabled = !en()), r.querySelectorAll(".pluno-pa-widget__starter-prompt").forEach((m) => {
11936
11988
  m.disabled = !en();
11937
- })), ue.disabled = Ot() || bn() || e.productVariant !== "personal" && Dn(e.billingStatus);
11989
+ })), ue.disabled = Ot() || bn() || e.productVariant !== "personal" && Ln(e.billingStatus);
11938
11990
  };
11939
11991
  Pn();
11940
11992
  const lo = () => {
11941
11993
  const d = A.getState(), m = d.isThinking, v = d.turnPhase !== null, x = d.turnPhase === "sending", M = C?.lastElementChild;
11942
11994
  M && (M.textContent = "Working..."), r.classList.toggle("pluno-pa-widget--thinking", m), r.classList.toggle("pluno-pa-widget--sending", x), r.classList.toggle(
11943
11995
  "pluno-pa-widget--unread",
11944
- !v && (ci || !!d.lastError)
11996
+ !v && (li || !!d.lastError)
11945
11997
  ), Pn();
11946
11998
  };
11947
11999
  lo();
11948
12000
  const uo = () => {
11949
- if (!(Ot() || qe))
11950
- return Pn(), Te(), A.connect().then(
12001
+ if (!(Ot() || De))
12002
+ return Pn(), Re(), A.connect().then(
11951
12003
  () => {
11952
- qe || (Pn(), Te());
12004
+ De || (Pn(), Re());
11953
12005
  },
11954
12006
  (d) => {
11955
- qe || (Pn(), Te(), Xe(
12007
+ De || (Pn(), Re(), Xe(
11956
12008
  "web-sdk.widget",
11957
12009
  "Failed to connect Product Agent widget",
11958
12010
  {
@@ -11969,7 +12021,7 @@ async function jy(t = {}) {
11969
12021
  const v = xt.get(d);
11970
12022
  if (!v || m !== void 0 && v.submittedAt !== m || (xt.delete(d), v.generation !== dt || v.revision !== Vt)) return;
11971
12023
  const x = new Set(v.attachments);
11972
- Ze = Ze.filter((M) => !x.has(M)), P.value = "", P.dispatchEvent(new Event("input", { bubbles: !0 })), Jn(), Te();
12024
+ Ze = Ze.filter((M) => !x.has(M)), P.value = "", P.dispatchEvent(new Event("input", { bubbles: !0 })), Yn(), Re();
11973
12025
  }, Ba = (d) => {
11974
12026
  const m = dt, v = dn ? Tn : null;
11975
12027
  rw(
@@ -11984,14 +12036,14 @@ async function jy(t = {}) {
11984
12036
  m === dt && (A.getState().receipts === void 0 && po(d.clientMessageId), ge?.clientMessageId === d.clientMessageId && (ge.pendingSubmission = !1, x && (ge.clientMessageId = x), va()), v && (dn = !1, Tn = null, e.proactiveSuggestion = null, lt()));
11985
12037
  }).catch((x) => {
11986
12038
  if (m !== dt) return;
11987
- ge?.clientMessageId === d.clientMessageId && (ge = null), xt.delete(d.clientMessageId), Jn();
12039
+ ge?.clientMessageId === d.clientMessageId && (ge = null), xt.delete(d.clientMessageId), Yn();
11988
12040
  const M = x instanceof Error ? x.message : "Failed to upload attachment";
11989
12041
  A.getState().lastError !== M && Vi(M);
11990
12042
  }).finally(() => {
11991
- m === dt && Te();
12043
+ m === dt && Re();
11992
12044
  });
11993
12045
  }, za = () => {
11994
- if (qe || !Gt || e.productVariant === "personal" && !rc({ ...Na(), isSubmitting: !1 }) || A.getState().status !== "connected" || Ot() || Dn(e.billingStatus))
12046
+ if (De || !Gt || e.productVariant === "personal" && !rc({ ...Na(), isSubmitting: !1 }) || A.getState().status !== "connected" || Ot() || Ln(e.billingStatus))
11995
12047
  return;
11996
12048
  const d = Gt;
11997
12049
  Gt = null, Ba(d);
@@ -12000,7 +12052,7 @@ async function jy(t = {}) {
12000
12052
  if (Gt !== null || co() || e.productVariant === "personal" && !en() || !m && v.length === 0)
12001
12053
  return;
12002
12054
  for (const M of v)
12003
- M.id && M.previewUrl && Gn.set(M.id, M.previewUrl);
12055
+ M.id && M.previewUrl && Jn.set(M.id, M.previewUrl);
12004
12056
  if ([...xt.values()].some((M) => M.revision === Vt && M.generation === dt)) return;
12005
12057
  const x = {
12006
12058
  inputValue: d,
@@ -12009,7 +12061,7 @@ async function jy(t = {}) {
12009
12061
  clientMessageId: crypto.randomUUID(),
12010
12062
  submittedAt: Math.max(Date.now(), da + 1)
12011
12063
  };
12012
- if (da = x.submittedAt, xt.set(x.clientMessageId, { ...x, revision: Vt, generation: dt }), Te(), ge = {
12064
+ if (da = x.submittedAt, xt.set(x.clientMessageId, { ...x, revision: Vt, generation: dt }), Re(), ge = {
12013
12065
  createdAt: Date.now(),
12014
12066
  clientMessageId: x.clientMessageId,
12015
12067
  observedConversation: null,
@@ -12030,11 +12082,11 @@ async function jy(t = {}) {
12030
12082
  e.onSignupClick?.();
12031
12083
  return;
12032
12084
  }
12033
- (e.productVariant === "personal" ? !en() : ao() || Dn(e.billingStatus)) || (Xt = !0, nt(!0, "send"), pt(), ho());
12085
+ (e.productVariant === "personal" ? !en() : ao() || Ln(e.billingStatus)) || (Xt = !0, nt(!0, "send"), pt(), ho());
12034
12086
  });
12035
- let li = 0;
12087
+ let di = 0;
12036
12088
  const tn = () => {
12037
- li = 0, r.classList.remove("pluno-pa-widget--drag-over");
12089
+ di = 0, r.classList.remove("pluno-pa-widget--drag-over");
12038
12090
  }, Eu = () => {
12039
12091
  qt !== null && (window.clearTimeout(qt), qt = null), te.textContent = "", te.hidden = !0;
12040
12092
  }, go = async (d) => {
@@ -12045,7 +12097,7 @@ async function jy(t = {}) {
12045
12097
  d,
12046
12098
  e.productVariant === "customer_embedded"
12047
12099
  );
12048
- if (Vt++, Ze = [...Ze, ...m], Jn(), Eu(), Te(), _e(A.getState()), !r.classList.contains("pluno-pa-widget--open")) {
12100
+ if (Vt++, Ze = [...Ze, ...m], Yn(), Eu(), Re(), _e(A.getState()), !r.classList.contains("pluno-pa-widget--open")) {
12049
12101
  ht("", !0, !0, !0, "attachment_drop");
12050
12102
  return;
12051
12103
  }
@@ -12054,7 +12106,7 @@ async function jy(t = {}) {
12054
12106
  await go(d), !(d.length === 0 || Nt !== null) && un(P, "attachment_picker_completed");
12055
12107
  };
12056
12108
  ue.addEventListener("click", () => {
12057
- e.loginRequired || bn() || e.productVariant !== "personal" && Dn(e.billingStatus) || ve.click();
12109
+ e.loginRequired || bn() || e.productVariant !== "personal" && Ln(e.billingStatus) || ve.click();
12058
12110
  }), ve.addEventListener("change", () => {
12059
12111
  const d = Array.from(ve.files ?? []);
12060
12112
  ve.value = "", Cu(d).catch((m) => {
@@ -12065,21 +12117,21 @@ async function jy(t = {}) {
12065
12117
  });
12066
12118
  });
12067
12119
  }), r.addEventListener("dragenter", (d) => {
12068
- !e.attachmentsEnabled || !rs(d.dataTransfer) || e.loginRequired || bn() || (d.preventDefault(), d.stopPropagation(), li += 1, r.classList.add("pluno-pa-widget--drag-over"));
12120
+ !e.attachmentsEnabled || !rs(d.dataTransfer) || e.loginRequired || bn() || (d.preventDefault(), d.stopPropagation(), di += 1, r.classList.add("pluno-pa-widget--drag-over"));
12069
12121
  }), r.addEventListener("dragover", (d) => {
12070
12122
  const m = d.dataTransfer;
12071
12123
  !e.attachmentsEnabled || !rs(m) || e.loginRequired || bn() || (d.preventDefault(), d.stopPropagation(), m.dropEffect = "copy");
12072
12124
  }), r.addEventListener("dragleave", (d) => {
12073
- rs(d.dataTransfer) && (d.stopPropagation(), li = Math.max(0, li - 1), li === 0 && r.classList.remove("pluno-pa-widget--drag-over"));
12125
+ rs(d.dataTransfer) && (d.stopPropagation(), di = Math.max(0, di - 1), di === 0 && r.classList.remove("pluno-pa-widget--drag-over"));
12074
12126
  });
12075
12127
  const $a = (d) => {
12076
12128
  r.classList.contains("pluno-pa-widget--drag-over") && !d.composedPath().includes(r) && tn();
12077
12129
  };
12078
- b.addEventListener(
12130
+ w.addEventListener(
12079
12131
  "dragover",
12080
12132
  $a,
12081
12133
  !0
12082
- ), b.addEventListener("drop", tn, !0), b.addEventListener("dragend", tn, !0), b.defaultView?.addEventListener("blur", tn), r.addEventListener("drop", (d) => {
12134
+ ), w.addEventListener("drop", tn, !0), w.addEventListener("dragend", tn, !0), w.defaultView?.addEventListener("blur", tn), r.addEventListener("drop", (d) => {
12083
12135
  const m = d.dataTransfer;
12084
12136
  !e.attachmentsEnabled || !rs(m) || e.loginRequired || bn() || (d.preventDefault(), d.stopPropagation(), tn(), go(m.files).catch((v) => {
12085
12137
  Vi(
@@ -12107,24 +12159,24 @@ async function jy(t = {}) {
12107
12159
  if (d.disabled)
12108
12160
  return;
12109
12161
  if (d.action === "stop") {
12110
- xt.clear(), Gt = null, ge = null, A.stop(), Te();
12162
+ xt.clear(), Gt = null, ge = null, A.stop(), Re();
12111
12163
  return;
12112
12164
  }
12113
12165
  const m = P.value.trim().length > 0 || Ze.length > 0;
12114
- Xt = !0, nt(!0, "send"), pt(), ho(), _e(A.getState()), Te(), m && Jt("send_button_submit");
12166
+ Xt = !0, nt(!0, "send"), pt(), ho(), _e(A.getState()), Re(), m && Jt("send_button_submit");
12115
12167
  }), ie.addEventListener("click", () => {
12116
12168
  Fe = !Fe, Lt(), Fe && tt.data === null && tt.status !== "loading" && Sa(), Fe || Jt("history_closed");
12117
12169
  }), ae.addEventListener("click", () => {
12118
12170
  Fe = !1, Lt(), Jt("history_closed");
12119
12171
  }), N.addEventListener("scroll", wu), P.addEventListener("input", () => {
12120
- Vt++, P.value.trim() && Ra("composer_input"), _i(P), Ve(), Te(), Ja();
12172
+ Vt++, P.value.trim() && Ra("composer_input"), _i(P), Ve(), Re(), Ja();
12121
12173
  }), P.addEventListener("keydown", (d) => {
12122
12174
  if (!(d.key !== "Enter" || d.shiftKey || d.isComposing || d.keyCode === 229)) {
12123
12175
  if (d.preventDefault(), e.loginRequired) {
12124
12176
  e.onLoginClick?.();
12125
12177
  return;
12126
12178
  }
12127
- (e.productVariant === "personal" ? !en() : ao()) || (Xt = !0, nt(!0, "send"), pt(), ho(), _e(A.getState()), Te());
12179
+ (e.productVariant === "personal" ? !en() : ao()) || (Xt = !0, nt(!0, "send"), pt(), ho(), _e(A.getState()), Re());
12128
12180
  }
12129
12181
  }), r.addEventListener("click", (d) => {
12130
12182
  const m = d.target instanceof Element ? d.target : null;
@@ -12138,7 +12190,7 @@ async function jy(t = {}) {
12138
12190
  }, Ha = (d) => {
12139
12191
  if (!Fa || q.hidden || r.classList.contains("pluno-pa-widget--closing"))
12140
12192
  return;
12141
- const m = a.activeElement ?? b.activeElement, v = Xm(d, m);
12193
+ const m = a.activeElement ?? w.activeElement, v = Xm(d, m);
12142
12194
  if (!v || P.disabled || P.readOnly)
12143
12195
  return;
12144
12196
  d.preventDefault();
@@ -12150,11 +12202,11 @@ async function jy(t = {}) {
12150
12202
  );
12151
12203
  P.value = x.value, P.dispatchEvent(new Event("input", { bubbles: !0 })), Ym(P), P.setSelectionRange(x.caret, x.caret);
12152
12204
  };
12153
- b.addEventListener(
12205
+ w.addEventListener(
12154
12206
  "pointerdown",
12155
12207
  ja,
12156
12208
  !0
12157
- ), b.addEventListener(
12209
+ ), w.addEventListener(
12158
12210
  "keydown",
12159
12211
  Ha
12160
12212
  ), r.addEventListener("copy", (d) => {
@@ -12182,9 +12234,9 @@ async function jy(t = {}) {
12182
12234
  return;
12183
12235
  }
12184
12236
  d.key !== "Escape" || !Fe || (Fe = !1, Lt(), Jt("history_escape"));
12185
- }), u.composerValue && (P.value = u.composerValue, _i(P)), e.layout === "page" ? ht(P.value, !1, !0, !1, "external_request") : p === "minimized" ? ni("minimized", !1) : e.initialDisplayState === void 0 && u.isOpen && ht(P.value, !1, !1, !1, "restored_state");
12186
- const di = () => c;
12187
- let fo = A.getState().appearance !== null, Gi = null, ui = null, Ct = A.getInteractions();
12237
+ }), u.composerValue && (P.value = u.composerValue, _i(P)), e.layout === "page" ? ht(P.value, !1, !0, !1, "external_request") : p === "minimized" ? ii("minimized", !1) : e.initialDisplayState === void 0 && u.isOpen && ht(P.value, !1, !1, !1, "restored_state");
12238
+ const ui = () => c;
12239
+ let fo = A.getState().appearance !== null, Gi = null, pi = null, Ct = A.getInteractions();
12188
12240
  const ce = (d) => Ct.find(
12189
12241
  (m) => m.kind === d && m.eligible && m.status === "presentable"
12190
12242
  ), Ka = (d) => Ct.find((m) => m.kind === d), Wa = () => {
@@ -12194,7 +12246,7 @@ async function jy(t = {}) {
12194
12246
  m && (_ && (_.textContent = m.presentation.body), E && (E.textContent = m.presentation.actionLabels.enable ?? "Enable grouping"), B && (B.textContent = m.presentation.actionLabels.later ?? "Not now"));
12195
12247
  };
12196
12248
  Wa();
12197
- const Le = (d, m, v) => d ? A.actOnInteraction(
12249
+ const Oe = (d, m, v) => d ? A.actOnInteraction(
12198
12250
  d.id,
12199
12251
  m,
12200
12252
  d.revision,
@@ -12206,15 +12258,15 @@ async function jy(t = {}) {
12206
12258
  };
12207
12259
  Ee?.addEventListener("click", () => {
12208
12260
  const d = ce("task_notifications");
12209
- yo(), Le(d, "enable").catch(() => {
12261
+ yo(), Oe(d, "enable").catch(() => {
12210
12262
  });
12211
12263
  }), Ke?.addEventListener("click", () => {
12212
12264
  const d = ce("task_notifications");
12213
- yo(), Le(d, "later").catch(() => {
12265
+ yo(), Oe(d, "later").catch(() => {
12214
12266
  });
12215
12267
  }), St?.addEventListener("click", () => {
12216
12268
  const d = ce("task_notifications");
12217
- yo(), Le(d, "never").catch(() => {
12269
+ yo(), Oe(d, "never").catch(() => {
12218
12270
  });
12219
12271
  });
12220
12272
  const Va = async () => {
@@ -12222,11 +12274,11 @@ async function jy(t = {}) {
12222
12274
  };
12223
12275
  E?.addEventListener("click", () => {
12224
12276
  const d = ce("tab_group_permission");
12225
- ye && (ye.hidden = !0), Le(d, "enable").catch(() => {
12277
+ ye && (ye.hidden = !0), Oe(d, "enable").catch(() => {
12226
12278
  });
12227
12279
  }), B?.addEventListener("click", () => {
12228
12280
  const d = ce("tab_group_permission");
12229
- ye && (ye.hidden = !0), Le(d, "later").catch(() => {
12281
+ ye && (ye.hidden = !0), Oe(d, "later").catch(() => {
12230
12282
  });
12231
12283
  }), Va();
12232
12284
  let _n = null;
@@ -12251,17 +12303,17 @@ async function jy(t = {}) {
12251
12303
  const m = Ct.find(
12252
12304
  (v) => v.kind === "integration_connection" && v.payload.request.authRequestId === d.authRequestId && v.eligible && v.status === "presentable"
12253
12305
  );
12254
- m && await Le(m, "connect");
12306
+ m && await Oe(m, "connect");
12255
12307
  }, Ru = async (d) => {
12256
12308
  const m = ce("personal_channel_connection");
12257
- m?.payload.request.requestId === d.requestId && await Le(m, "connect");
12258
- }, pi = (d = {}) => {
12259
- dt++, xt.clear(), la(), Gt = null, ge = null, ei = !1, Ni.clear(), Xt = !0, nt(!0, "newSession"), pt(), Fe = !1, Lt();
12309
+ m?.payload.request.requestId === d.requestId && await Oe(m, "connect");
12310
+ }, hi = (d = {}) => {
12311
+ dt++, xt.clear(), la(), Gt = null, ge = null, ti = !1, Ni.clear(), Xt = !0, nt(!0, "newSession"), pt(), Fe = !1, Lt();
12260
12312
  const m = Promise.resolve(A.startNewSession(d));
12261
- return oi = null, Ws.clear(), Yi.clear(), P.value = "", Ze = [], Jn(), _i(P), Ve(), Te(), un(P, "new_chat"), _e(A.getState()), m;
12313
+ return ri = null, Ws.clear(), Yi.clear(), P.value = "", Ze = [], Yn(), _i(P), Ve(), Re(), un(P, "new_chat"), _e(A.getState()), m;
12262
12314
  }, Ya = (d) => {
12263
12315
  window.requestAnimationFrame(() => {
12264
- qe || q.hidden || b.visibilityState === "hidden" || Array.from(T.querySelectorAll("[data-message-key]")).some(
12316
+ De || q.hidden || w.visibilityState === "hidden" || Array.from(T.querySelectorAll("[data-message-key]")).some(
12265
12317
  (m) => d.has(m.dataset.messageKey)
12266
12318
  ) && Bi("proactive_suggestion_previous_chat_visible");
12267
12319
  });
@@ -12274,7 +12326,7 @@ async function jy(t = {}) {
12274
12326
  return;
12275
12327
  Wt = null, dn = !1, Tn = null, e.proactiveSuggestion = null;
12276
12328
  const m = Xa();
12277
- await pi(), ht("", !0, !1, !0, "proactive_suggestion"), Ya(m), A.sendMessage("Yes", {
12329
+ await hi(), ht("", !0, !1, !0, "proactive_suggestion"), Ya(m), A.sendMessage("Yes", {
12278
12330
  proactiveSuggestionQuestion: d.question
12279
12331
  });
12280
12332
  });
@@ -12284,7 +12336,7 @@ async function jy(t = {}) {
12284
12336
  const m = e.proactiveSuggestion !== null;
12285
12337
  if (e.proactiveSuggestion = null, Wt = null, dn = !1, Tn = null, We = "idle", It && (It.value = ""), m) {
12286
12338
  const v = ce("proactive_suggestion");
12287
- v && Le(v, "dismiss").catch(() => {
12339
+ v && Oe(v, "dismiss").catch(() => {
12288
12340
  });
12289
12341
  }
12290
12342
  lt();
@@ -12295,9 +12347,9 @@ async function jy(t = {}) {
12295
12347
  return;
12296
12348
  Wt = null, dn = !0, Tn = d, e.proactiveSuggestion = null;
12297
12349
  const m = Xa();
12298
- await pi(), A.stageProactiveSuggestionQuestion(d.question);
12350
+ await hi(), A.stageProactiveSuggestionQuestion(d.question);
12299
12351
  const v = ce("proactive_suggestion");
12300
- v && Le(v, "edit").catch(() => {
12352
+ v && Oe(v, "edit").catch(() => {
12301
12353
  }), ht("Yes, but ", !0, !0, !0, "proactive_suggestion"), Ya(m), window.requestAnimationFrame(() => {
12302
12354
  P.dispatchEvent(new Event("input", { bubbles: !0 })), P.setSelectionRange(P.value.length, P.value.length);
12303
12355
  });
@@ -12307,16 +12359,16 @@ async function jy(t = {}) {
12307
12359
  return;
12308
12360
  Wt = d, dn = !1, Tn = null, We = "idle", It && (It.value = ""), e.proactiveSuggestion = null;
12309
12361
  const m = ce("proactive_suggestion");
12310
- m && Le(m, "never").catch(() => {
12362
+ m && Oe(m, "never").catch(() => {
12311
12363
  }), lt(), window.requestAnimationFrame(() => It?.focus());
12312
12364
  }), It?.addEventListener("input", () => {
12313
12365
  We === "error" && (We = "idle"), lt();
12314
- }), Vn?.addEventListener("click", async () => {
12366
+ }), Gn?.addEventListener("click", async () => {
12315
12367
  const d = Wt, m = It?.value.trim() ?? "";
12316
12368
  if (!(!d || !m || We === "submitting")) {
12317
12369
  We = "submitting", lt();
12318
12370
  try {
12319
- await Le(
12371
+ await Oe(
12320
12372
  Ct.find((v) => v.kind === "proactive_suggestion" && v.payload.suggestion.id === d.id),
12321
12373
  "submit_feedback",
12322
12374
  { feedback: m }
@@ -12337,7 +12389,7 @@ async function jy(t = {}) {
12337
12389
  "New chat",
12338
12390
  Sw(),
12339
12391
  !1
12340
- ), Mn.addEventListener("click", () => pi()), He.insertBefore(Mn, ie));
12392
+ ), Mn.addEventListener("click", () => hi()), He.insertBefore(Mn, ie));
12341
12393
  }, Ut = document.createElement("div");
12342
12394
  Ut.className = "pluno-pa-widget__error";
12343
12395
  const _o = document.createTextNode("");
@@ -12346,7 +12398,7 @@ async function jy(t = {}) {
12346
12398
  nn.className = "pluno-pa-widget__error-retry", nn.target = "_blank", nn.rel = "noreferrer", nn.textContent = "Security settings";
12347
12399
  const gt = document.createElement("button");
12348
12400
  gt.type = "button", gt.className = "pluno-pa-widget__error-retry";
12349
- const Za = Fn(), ec = document.createTextNode("Try again");
12401
+ const Za = jn(), ec = document.createTextNode("Try again");
12350
12402
  gt.append(Za, ec);
12351
12403
  let tc = "", sn = !1;
12352
12404
  const Pu = async () => {
@@ -12361,19 +12413,19 @@ async function jy(t = {}) {
12361
12413
  })
12362
12414
  ]);
12363
12415
  } finally {
12364
- clearTimeout(d), sn = !1, qe || _e(A.getState());
12416
+ clearTimeout(d), sn = !1, De || _e(A.getState());
12365
12417
  }
12366
12418
  };
12367
12419
  gt.addEventListener("click", () => {
12368
12420
  Pu();
12369
12421
  });
12370
- let vn = !1, hi = null, Qi = 0, vo = 0;
12422
+ let vn = !1, gi = null, Qi = 0, vo = 0;
12371
12423
  const _e = (d, m = {}) => {
12372
12424
  ma(d) && (ge = null), fa = m.renderSource ?? "local", Zs(), r.classList.toggle("pluno-pa-widget--logged-out", e.loginRequired && e.entrySurface === "extension_widget"), O.classList.remove("pluno-pa-widget__access-notice--login-only"), d = { ...d, messages: d.messages.map(($) => {
12373
- if (!$.attachments?.some((Ge) => Ge.id && !Ge.fileUrl && Gn.has(Ge.id))) return $;
12425
+ if (!$.attachments?.some((Ge) => Ge.id && !Ge.fileUrl && Jn.has(Ge.id))) return $;
12374
12426
  const mt = $.attachments.map((Ge) => {
12375
- const gi = Ge.id ? Gn.get(Ge.id) : void 0;
12376
- return gi && !Ge.fileUrl ? { ...Ge, previewUrl: gi } : Ge;
12427
+ const fi = Ge.id ? Jn.get(Ge.id) : void 0;
12428
+ return fi && !Ge.fileUrl ? { ...Ge, previewUrl: fi } : Ge;
12377
12429
  });
12378
12430
  return Object.create(Object.getPrototypeOf($), {
12379
12431
  ...Object.getOwnPropertyDescriptors($),
@@ -12400,8 +12452,8 @@ async function jy(t = {}) {
12400
12452
  O,
12401
12453
  xe,
12402
12454
  Xi,
12403
- di,
12404
- (hi ?? $.message).replace(new RegExp("(?<=[.!?])\\s+", "g"), `
12455
+ ui,
12456
+ (gi ?? $.message).replace(new RegExp("(?<=[.!?])\\s+", "g"), `
12405
12457
  `),
12406
12458
  vn ? "Trying..." : "Try again",
12407
12459
  void 0,
@@ -12409,12 +12461,12 @@ async function jy(t = {}) {
12409
12461
  void 0
12410
12462
  );
12411
12463
  const Ge = O.querySelector(".pluno-pa-widget__login");
12412
- Ge.disabled = vn, Ge.setAttribute("aria-busy", String(vn)), vn && Ge.prepend(Fn()), Ge.addEventListener("click", () => {
12413
- const gi = ++Qi, Bu = vo;
12414
- vn = !0, hi = null, _e(A.getState()), mt().catch((oc) => {
12415
- gi !== Qi || Bu !== vo || (hi = oc instanceof Error ? oc.message : "Close and reopen Pluno to try again.");
12464
+ Ge.disabled = vn, Ge.setAttribute("aria-busy", String(vn)), vn && Ge.prepend(jn()), Ge.addEventListener("click", () => {
12465
+ const fi = ++Qi, Bu = vo;
12466
+ vn = !0, gi = null, _e(A.getState()), mt().catch((oc) => {
12467
+ fi !== Qi || Bu !== vo || (gi = oc instanceof Error ? oc.message : "Close and reopen Pluno to try again.");
12416
12468
  }).finally(() => {
12417
- gi === Qi && (vn = !1, qe || _e(A.getState()));
12469
+ fi === Qi && (vn = !1, De || _e(A.getState()));
12418
12470
  });
12419
12471
  });
12420
12472
  return;
@@ -12423,7 +12475,7 @@ async function jy(t = {}) {
12423
12475
  O,
12424
12476
  xe,
12425
12477
  Xi,
12426
- di,
12478
+ ui,
12427
12479
  e.entrySurface === "extension_widget" ? null : "Log in to use Pluno on this page.",
12428
12480
  e.loginButtonLabel,
12429
12481
  e.loginUrl,
@@ -12437,7 +12489,7 @@ async function jy(t = {}) {
12437
12489
  O,
12438
12490
  xe,
12439
12491
  Xi,
12440
- di,
12492
+ ui,
12441
12493
  "Complete signup to unlock your free trial credits.",
12442
12494
  e.signupButtonLabel,
12443
12495
  e.signupUrl,
@@ -12471,7 +12523,7 @@ async function jy(t = {}) {
12471
12523
  wo,
12472
12524
  bo,
12473
12525
  Ve,
12474
- di,
12526
+ ui,
12475
12527
  ($) => {
12476
12528
  (e.productVariant === "personal" ? !en() : ro()) || (Xt = !0, nt(!0, "send"), pt(), A.sendMessage($));
12477
12529
  },
@@ -12481,13 +12533,13 @@ async function jy(t = {}) {
12481
12533
  e.morningReport,
12482
12534
  () => {
12483
12535
  const $ = ce("morning_report");
12484
- $ && Le($, "later").catch(() => {
12536
+ $ && Oe($, "later").catch(() => {
12485
12537
  }), to("morning_report_snooze"), _e(A.getState());
12486
12538
  },
12487
12539
  () => {
12488
12540
  d.sessionId && A.loadSession(d.sessionId);
12489
12541
  },
12490
- () => pi(),
12542
+ () => hi(),
12491
12543
  e.attachmentPreviewUrlResolver,
12492
12544
  Ka("integration_connection") ? {
12493
12545
  requests: Ct.flatMap(($) => $.kind === "integration_connection" ? [$.payload.request] : []),
@@ -12512,8 +12564,8 @@ async function jy(t = {}) {
12512
12564
  presentation: ce("social_share")?.presentation,
12513
12565
  dismissedCandidateIds: /* @__PURE__ */ new Set(),
12514
12566
  actionCandidate: Gi,
12515
- error: ui,
12516
- characterIconOptions: di(),
12567
+ error: pi,
12568
+ characterIconOptions: ui(),
12517
12569
  socialPostRewardsUrl: e.socialPostRewardsUrl,
12518
12570
  onSeen: () => {
12519
12571
  },
@@ -12522,36 +12574,36 @@ async function jy(t = {}) {
12522
12574
  },
12523
12575
  onSocialShare: ($) => {
12524
12576
  const mt = ce("social_share");
12525
- Le(mt, "dismiss").catch(() => {
12577
+ Oe(mt, "dismiss").catch(() => {
12526
12578
  });
12527
12579
  },
12528
12580
  onDismiss: () => {
12529
12581
  const $ = ce("social_share");
12530
- Le($, "dismiss").catch(() => {
12531
- }), ui = null, _e(A.getState());
12582
+ Oe($, "dismiss").catch(() => {
12583
+ }), pi = null, _e(A.getState());
12532
12584
  },
12533
12585
  onDisable: () => {
12534
12586
  const $ = ce("social_share");
12535
- Le($, "dont_show_again").catch(() => {
12536
- }), ui = null, _e(A.getState());
12587
+ Oe($, "dont_show_again").catch(() => {
12588
+ }), pi = null, _e(A.getState());
12537
12589
  }
12538
12590
  } : void 0
12539
12591
  );
12540
12592
  const Ae = !!T.querySelector(
12541
12593
  ".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report)"
12542
12594
  );
12543
- ge && !ge.observedWelcome && !Ae && ml(d) && (ge.observedConversation = ya(d)), va(), Te(), lt();
12544
- const we = Array.isArray(d.activeScheduledFollowUps) ? d.activeScheduledFollowUps : null, ft = (we !== null ? we.map(($) => $.dueAt) : d.messages.map(($) => $.scheduledCheckInAt)).filter(($) => !!$).filter(($) => Hn($) !== null).sort(($, mt) => Date.parse($) - Date.parse(mt))[0] ?? null, Oe = ft ? kg(ft) : null;
12545
- Oe !== null && (Yt = window.setTimeout(
12595
+ ge && !ge.observedWelcome && !Ae && ml(d) && (ge.observedConversation = ya(d)), va(), Re(), lt();
12596
+ const we = Array.isArray(d.activeScheduledFollowUps) ? d.activeScheduledFollowUps : null, ft = (we !== null ? we.map(($) => $.dueAt) : d.messages.map(($) => $.scheduledCheckInAt)).filter(($) => !!$).filter(($) => Kn($) !== null).sort(($, mt) => Date.parse($) - Date.parse(mt))[0] ?? null, Ne = ft ? kg(ft) : null;
12597
+ Ne !== null && (Yt = window.setTimeout(
12546
12598
  () => {
12547
- Yt = null, qe || _e(A.getState());
12599
+ Yt = null, De || _e(A.getState());
12548
12600
  },
12549
- Math.min(Oe, 2147483647)
12601
+ Math.min(Ne, 2147483647)
12550
12602
  )), ne ? (Qt = T.scrollTop, pt()) : M && ml(d) && mu();
12551
12603
  }, nc = () => {
12552
- b.getSelection()?.isCollapsed !== !1 && Jw(Ji) && _e(A.getState());
12604
+ w.getSelection()?.isCollapsed !== !1 && Jw(Ji) && _e(A.getState());
12553
12605
  };
12554
- b.addEventListener(
12606
+ w.addEventListener(
12555
12607
  "selectionchange",
12556
12608
  nc
12557
12609
  );
@@ -12566,12 +12618,12 @@ async function jy(t = {}) {
12566
12618
  status: m.payload.status,
12567
12619
  error: m.payload.error ?? void 0
12568
12620
  });
12569
- qe || _e(A.getState(), { skipUnchangedTimeline: !0, renderSource: "interactions" });
12621
+ De || _e(A.getState(), { skipUnchangedTimeline: !0, renderSource: "interactions" });
12570
12622
  }), qu = A.subscribeAccount((d) => {
12571
12623
  const m = d?.auth;
12572
- (m?.status !== "error" || m.errorCode !== "browser_session_unavailable" && m.errorCode !== "backend_auth_pending") && (Qi += 1, hi = null, vn = !1);
12624
+ (m?.status !== "error" || m.errorCode !== "browser_session_unavailable" && m.errorCode !== "backend_auth_pending") && (Qi += 1, gi = null, vn = !1);
12573
12625
  const v = Ot();
12574
- e.billingStatus = d, n(d), So(A.getState()), Pn(), _e(A.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), js(), Te(), za(), v && !Ot() && uo();
12626
+ e.billingStatus = d, n(d), So(A.getState()), Pn(), _e(A.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), js(), Re(), za(), v && !Ot() && uo();
12575
12627
  });
12576
12628
  let Io = !1, xo = null;
12577
12629
  const ic = (d) => {
@@ -12579,11 +12631,11 @@ async function jy(t = {}) {
12579
12631
  };
12580
12632
  A.on("state", (d) => {
12581
12633
  const m = d.user?.id ?? null;
12582
- (Yn !== null && Yn !== d.sessionId || Qn !== null && Qn !== m || Xn !== void 0 && Xn !== d.selectionKey) && (dt++, xt.clear(), ge = null), Xn = d.selectionKey, Yn = d.sessionId, Qn = m;
12634
+ (Xn !== null && Xn !== d.sessionId || Zn !== null && Zn !== m || Qn !== void 0 && Qn !== d.selectionKey) && (dt++, xt.clear(), ge = null), Qn = d.selectionKey, Xn = d.sessionId, Zn = m;
12583
12635
  for (const we of d.messages)
12584
12636
  we.role === "user" && po(we.id);
12585
12637
  for (const we of d.receipts ?? []) po(we.userMessageId, we.acceptedRendererRevision);
12586
- if (e.extensionRuntime && (vo += 1, hi = null), So(d), ha) {
12638
+ if (e.extensionRuntime && (vo += 1, gi = null), So(d), ha) {
12587
12639
  const we = A.getModel(), ft = Bm(we) ? we : ks[0].value;
12588
12640
  ft !== kt && (kt = ft, Rn());
12589
12641
  }
@@ -12591,7 +12643,7 @@ async function jy(t = {}) {
12591
12643
  za();
12592
12644
  })), Va();
12593
12645
  const v = mo && !d.isThinking, x = wa !== location.origin || ba !== d.sessionId || _a !== (d.user?.id ?? null), M = mo !== d.isThinking, ne = Gs !== "connected" && d.status === "connected", Ae = Gs === "connected" && d.status !== "connected";
12594
- wa = location.origin, ba = d.sessionId, _a = d.user?.id ?? null, Gs = d.status, mo = d.isThinking, Ae && et !== null && (window.clearTimeout(et), et = null), r.classList.contains("pluno-pa-widget--open") && d.status === "connected" && (x || M || ne) && Ys(), oe && (oe.hidden = ce("task_notifications") === void 0), ye && (ye.hidden = ce("tab_group_permission") === void 0), v && !r.classList.contains("pluno-pa-widget--open") && (ci = !0), lo(), d.appearance ? (fo = !0, Xe(
12646
+ wa = location.origin, ba = d.sessionId, _a = d.user?.id ?? null, Gs = d.status, mo = d.isThinking, Ae && et !== null && (window.clearTimeout(et), et = null), r.classList.contains("pluno-pa-widget--open") && d.status === "connected" && (x || M || ne) && Ys(), oe && (oe.hidden = ce("task_notifications") === void 0), ye && (ye.hidden = ce("tab_group_permission") === void 0), v && !r.classList.contains("pluno-pa-widget--open") && (li = !0), lo(), d.appearance ? (fo = !0, Xe(
12595
12647
  "web-sdk.widget",
12596
12648
  "Agent state supplied appearance",
12597
12649
  {
@@ -12605,10 +12657,10 @@ async function jy(t = {}) {
12605
12657
  fallbackColorScheme: e.colorScheme,
12606
12658
  fallbackFontFamily: e.fontFamily
12607
12659
  }
12608
- ), ko({}, "agent.state.appearance-cleared")), _e(d, { skipUnchangedTimeline: !0, renderSource: "state" }), Te(), v && eo();
12660
+ ), ko({}, "agent.state.appearance-cleared")), _e(d, { skipUnchangedTimeline: !0, renderSource: "state" }), Re(), v && eo();
12609
12661
  });
12610
12662
  const sc = A.getState();
12611
- ic(sc), _e(sc), Te(), uo();
12663
+ ic(sc), _e(sc), Re(), uo();
12612
12664
  const Du = sy(r, (d, m, v, x) => {
12613
12665
  const M = Fu(A.getState(), x);
12614
12666
  A.reportDisplayedError?.(d, m, v, ...M ? [M] : []);
@@ -12620,7 +12672,7 @@ async function jy(t = {}) {
12620
12672
  ), Ou = oy(r, Bi);
12621
12673
  return {
12622
12674
  agent: A,
12623
- startNewChat: pi,
12675
+ startNewChat: hi,
12624
12676
  host: o,
12625
12677
  updateAppearance: (d) => {
12626
12678
  d.scribbleStyle !== void 0 && (e.scribbleStyle = d.scribbleStyle), ko(d, "widgetHandle.updateAppearance");
@@ -12632,39 +12684,39 @@ async function jy(t = {}) {
12632
12684
  closePanel: to,
12633
12685
  updateDisplayState: (d) => {
12634
12686
  if (d === "shown") {
12635
- ni("shown", !1);
12687
+ ii("shown", !1);
12636
12688
  return;
12637
12689
  }
12638
- ni("minimized", !1);
12690
+ ii("minimized", !1);
12639
12691
  },
12640
12692
  destroy: () => {
12641
- qe || (Du(), Lu.dispose(), Ou(), Ve(), qe = !0, la(), Mu(), qu(), xa.disconnect(), b.removeEventListener(
12693
+ De || (Du(), Lu.dispose(), Ou(), Ve(), De = !0, la(), Mu(), qu(), xa.disconnect(), w.removeEventListener(
12642
12694
  "selectionchange",
12643
12695
  nc
12644
- ), b.removeEventListener("pointerdown", ga, !0), b.removeEventListener(
12696
+ ), w.removeEventListener("pointerdown", ga, !0), w.removeEventListener(
12645
12697
  "pointerdown",
12646
12698
  ja,
12647
12699
  !0
12648
- ), b.removeEventListener(
12700
+ ), w.removeEventListener(
12649
12701
  "keydown",
12650
12702
  Ha
12651
- ), Da?.disconnect(), Oa?.disconnect(), ku(), b.defaultView?.removeEventListener(
12703
+ ), Da?.disconnect(), Oa?.disconnect(), ku(), w.defaultView?.removeEventListener(
12652
12704
  "pointerdown",
12653
12705
  qa,
12654
12706
  !0
12655
- ), b.defaultView?.removeEventListener(
12707
+ ), w.defaultView?.removeEventListener(
12656
12708
  "focus",
12657
12709
  Ki,
12658
12710
  !0
12659
- ), b.defaultView?.removeEventListener(
12711
+ ), w.defaultView?.removeEventListener(
12660
12712
  "focusin",
12661
12713
  Ki,
12662
12714
  !0
12663
- ), b.removeEventListener(
12715
+ ), w.removeEventListener(
12664
12716
  "dragover",
12665
12717
  $a,
12666
12718
  !0
12667
- ), b.removeEventListener("drop", tn, !0), b.removeEventListener("dragend", tn, !0), b.defaultView?.removeEventListener(
12719
+ ), w.removeEventListener("drop", tn, !0), w.removeEventListener("dragend", tn, !0), w.defaultView?.removeEventListener(
12668
12720
  "blur",
12669
12721
  tn
12670
12722
  ), window.removeEventListener("resize", ka), Ea(), vu(), Su(), qt !== null && window.clearTimeout(qt), et !== null && (window.clearTimeout(et), et = null), fu(), pn !== null && (window.clearTimeout(pn), pn = null), Yt !== null && (window.clearTimeout(Yt), Yt = null), Li?.clear(), pa && A.destroy(), Ks?.release(), o.remove());
@@ -12672,7 +12724,7 @@ async function jy(t = {}) {
12672
12724
  };
12673
12725
  async function Nu(d) {
12674
12726
  if (!Gi) {
12675
- Gi = d, ui = null, _e(A.getState());
12727
+ Gi = d, pi = null, _e(A.getState());
12676
12728
  try {
12677
12729
  if (!e.referralLinkLoader)
12678
12730
  throw new Error("Referral sharing is not available here.");
@@ -12682,11 +12734,11 @@ async function jy(t = {}) {
12682
12734
  await Uu(m);
12683
12735
  const v = ce("social_share");
12684
12736
  if (v) {
12685
- await Le(v, "dismiss");
12737
+ await Oe(v, "dismiss");
12686
12738
  return;
12687
12739
  }
12688
12740
  } catch (m) {
12689
- ui = m instanceof Error ? m.message : "Could not copy referral link.";
12741
+ pi = m instanceof Error ? m.message : "Could not copy referral link.";
12690
12742
  } finally {
12691
12743
  Gi = null, _e(A.getState());
12692
12744
  }
@@ -12699,7 +12751,7 @@ async function jy(t = {}) {
12699
12751
  return;
12700
12752
  } catch {
12701
12753
  }
12702
- const m = os(b), v = m instanceof HTMLElement ? m : null, x = document.createElement("textarea");
12754
+ const m = os(w), v = m instanceof HTMLElement ? m : null, x = document.createElement("textarea");
12703
12755
  x.value = d, x.readOnly = !0, x.setAttribute("aria-hidden", "true"), x.style.position = "fixed", x.style.left = "-9999px", x.style.opacity = "0", document.body.appendChild(x);
12704
12756
  try {
12705
12757
  if (x.select(), x.setSelectionRange(0, d.length), !document.execCommand("copy"))
@@ -12712,7 +12764,7 @@ async function jy(t = {}) {
12712
12764
  }
12713
12765
  function ko(d, m) {
12714
12766
  const v = d.accentColor ?? e.accentColor, x = d.colorScheme ?? e.colorScheme, M = d.fontFamily ?? e.fontFamily, ne = d.scribbleStyle ?? e.scribbleStyle, Ae = JSON.stringify([v, x, M, ne]);
12715
- Ae !== f && (f = Ae, c = dl(
12767
+ Ae !== g && (g = Ae, c = dl(
12716
12768
  v,
12717
12769
  ne
12718
12770
  ), ul(r, c, {
@@ -12806,7 +12858,7 @@ function Gy({
12806
12858
  a = null, r = null, c = null, u = !1, t.classList.remove("pluno-pa-widget--dragging");
12807
12859
  }, h = (S) => {
12808
12860
  t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (S.preventDefault(), S.stopPropagation(), a = S.pointerId, r = { x: S.clientX, y: S.clientY }, c = i(), u = !1, e.setPointerCapture?.(S.pointerId));
12809
- }, g = (S) => {
12861
+ }, f = (S) => {
12810
12862
  if (a !== S.pointerId || !r || !c)
12811
12863
  return;
12812
12864
  S.preventDefault();
@@ -12814,9 +12866,9 @@ function Gy({
12814
12866
  !u && Math.hypot(R, k) < As || (u = !0, t.classList.add("pluno-pa-widget--dragging"), s({ x: c.x + R, y: c.y + k }));
12815
12867
  }, y = (S) => {
12816
12868
  a === S.pointerId && (S.preventDefault(), S.stopPropagation(), u && (p = { x: S.clientX, y: S.clientY }, o()), l());
12817
- }, f = (S) => {
12869
+ }, g = (S) => {
12818
12870
  a === S.pointerId && (S.preventDefault(), l());
12819
- }, w = (S) => {
12871
+ }, b = (S) => {
12820
12872
  if (!p)
12821
12873
  return;
12822
12874
  const R = Math.hypot(
@@ -12824,15 +12876,15 @@ function Gy({
12824
12876
  S.clientY - p.y
12825
12877
  ) <= As;
12826
12878
  p = null, R && (S.preventDefault(), S.stopPropagation());
12827
- }, b = (S) => {
12879
+ }, w = (S) => {
12828
12880
  if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
12829
12881
  return;
12830
12882
  const R = S.shiftKey ? ta : ea, k = i();
12831
12883
  let C = null;
12832
12884
  S.key === "ArrowUp" ? C = { x: k.x, y: k.y - R } : S.key === "ArrowDown" ? C = { x: k.x, y: k.y + R } : S.key === "ArrowLeft" ? C = { x: k.x - R, y: k.y } : S.key === "ArrowRight" && (C = { x: k.x + R, y: k.y }), C && (S.preventDefault(), S.stopPropagation(), s(C), o());
12833
12885
  };
12834
- return e.addEventListener("pointerdown", h), e.addEventListener("pointermove", g), e.addEventListener("pointerup", y), e.addEventListener("pointercancel", f), e.addEventListener("click", w, !0), n.addEventListener("keydown", b), () => {
12835
- e.removeEventListener("pointerdown", h), e.removeEventListener("pointermove", g), e.removeEventListener("pointerup", y), e.removeEventListener("pointercancel", f), e.removeEventListener("click", w, !0), n.removeEventListener("keydown", b);
12886
+ return e.addEventListener("pointerdown", h), e.addEventListener("pointermove", f), e.addEventListener("pointerup", y), e.addEventListener("pointercancel", g), e.addEventListener("click", b, !0), n.addEventListener("keydown", w), () => {
12887
+ e.removeEventListener("pointerdown", h), e.removeEventListener("pointermove", f), e.removeEventListener("pointerup", y), e.removeEventListener("pointercancel", g), e.removeEventListener("click", b, !0), n.removeEventListener("keydown", w);
12836
12888
  };
12837
12889
  }
12838
12890
  function Jy({
@@ -12845,25 +12897,25 @@ function Jy({
12845
12897
  let o = null, a = null, r = null, c = !1;
12846
12898
  const u = () => {
12847
12899
  o = null, a = null, r = null, c = !1, t.classList.remove("pluno-pa-widget--panel-dragging");
12848
- }, p = (f) => {
12849
- t.classList.contains("pluno-pa-widget--open") && (f.preventDefault(), f.stopPropagation(), o = f.pointerId, a = { x: f.clientX, y: f.clientY }, r = n(), c = !1, e.setPointerCapture?.(f.pointerId));
12850
- }, l = (f) => {
12851
- if (o !== f.pointerId || !a || !r)
12900
+ }, p = (g) => {
12901
+ t.classList.contains("pluno-pa-widget--open") && (g.preventDefault(), g.stopPropagation(), o = g.pointerId, a = { x: g.clientX, y: g.clientY }, r = n(), c = !1, e.setPointerCapture?.(g.pointerId));
12902
+ }, l = (g) => {
12903
+ if (o !== g.pointerId || !a || !r)
12852
12904
  return;
12853
- f.preventDefault(), f.stopPropagation();
12854
- const w = f.clientX - a.x, b = f.clientY - a.y;
12855
- !c && Math.hypot(w, b) < As || (c = !0, t.classList.add("pluno-pa-widget--panel-dragging"), i({ x: r.x + w, y: r.y + b }));
12856
- }, h = (f) => {
12857
- o === f.pointerId && (f.preventDefault(), f.stopPropagation(), c && s(), u());
12858
- }, g = (f) => {
12859
- o === f.pointerId && (f.preventDefault(), u());
12860
- }, y = (f) => {
12861
- const w = f.shiftKey ? ta : ea, b = n();
12905
+ g.preventDefault(), g.stopPropagation();
12906
+ const b = g.clientX - a.x, w = g.clientY - a.y;
12907
+ !c && Math.hypot(b, w) < As || (c = !0, t.classList.add("pluno-pa-widget--panel-dragging"), i({ x: r.x + b, y: r.y + w }));
12908
+ }, h = (g) => {
12909
+ o === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && s(), u());
12910
+ }, f = (g) => {
12911
+ o === g.pointerId && (g.preventDefault(), u());
12912
+ }, y = (g) => {
12913
+ const b = g.shiftKey ? ta : ea, w = n();
12862
12914
  let S = null;
12863
- f.key === "ArrowUp" ? S = { x: b.x, y: b.y - w } : f.key === "ArrowDown" ? S = { x: b.x, y: b.y + w } : f.key === "ArrowLeft" ? S = { x: b.x - w, y: b.y } : f.key === "ArrowRight" && (S = { x: b.x + w, y: b.y }), S && (f.preventDefault(), f.stopPropagation(), i(S), s());
12915
+ g.key === "ArrowUp" ? S = { x: w.x, y: w.y - b } : g.key === "ArrowDown" ? S = { x: w.x, y: w.y + b } : g.key === "ArrowLeft" ? S = { x: w.x - b, y: w.y } : g.key === "ArrowRight" && (S = { x: w.x + b, y: w.y }), S && (g.preventDefault(), g.stopPropagation(), i(S), s());
12864
12916
  };
12865
- return e.addEventListener("pointerdown", p), e.addEventListener("pointermove", l), e.addEventListener("pointerup", h), e.addEventListener("pointercancel", g), e.addEventListener("keydown", y), () => {
12866
- e.removeEventListener("pointerdown", p), e.removeEventListener("pointermove", l), e.removeEventListener("pointerup", h), e.removeEventListener("pointercancel", g), e.removeEventListener("keydown", y);
12917
+ return e.addEventListener("pointerdown", p), e.addEventListener("pointermove", l), e.addEventListener("pointerup", h), e.addEventListener("pointercancel", f), e.addEventListener("keydown", y), () => {
12918
+ e.removeEventListener("pointerdown", p), e.removeEventListener("pointermove", l), e.removeEventListener("pointerup", h), e.removeEventListener("pointercancel", f), e.removeEventListener("keydown", y);
12867
12919
  };
12868
12920
  }
12869
12921
  function Yy({
@@ -12876,31 +12928,31 @@ function Yy({
12876
12928
  let o = null, a = null, r = null, c = null, u = !1;
12877
12929
  const p = () => {
12878
12930
  o = null, a = null, r = null, c = null, u = !1, t.classList.remove("pluno-pa-widget--resizing");
12879
- }, l = (w) => {
12880
- const b = w.currentTarget, S = b.dataset.resizeDirection;
12881
- !t.classList.contains("pluno-pa-widget--open") || !pl(S) || (w.preventDefault(), w.stopPropagation(), o = w.pointerId, a = S, r = { x: w.clientX, y: w.clientY }, c = n(), u = !1, b.setPointerCapture?.(w.pointerId));
12882
- }, h = (w) => {
12883
- if (o !== w.pointerId || !a || !r || !c)
12931
+ }, l = (b) => {
12932
+ const w = b.currentTarget, S = w.dataset.resizeDirection;
12933
+ !t.classList.contains("pluno-pa-widget--open") || !pl(S) || (b.preventDefault(), b.stopPropagation(), o = b.pointerId, a = S, r = { x: b.clientX, y: b.clientY }, c = n(), u = !1, w.setPointerCapture?.(b.pointerId));
12934
+ }, h = (b) => {
12935
+ if (o !== b.pointerId || !a || !r || !c)
12884
12936
  return;
12885
- w.preventDefault(), w.stopPropagation();
12886
- const b = w.clientX - r.x, S = w.clientY - r.y;
12887
- !u && Math.hypot(b, S) < As || (u = !0, t.classList.add("pluno-pa-widget--resizing"), i(
12888
- hl(c, a, b, S)
12937
+ b.preventDefault(), b.stopPropagation();
12938
+ const w = b.clientX - r.x, S = b.clientY - r.y;
12939
+ !u && Math.hypot(w, S) < As || (u = !0, t.classList.add("pluno-pa-widget--resizing"), i(
12940
+ hl(c, a, w, S)
12889
12941
  ));
12890
- }, g = (w) => {
12891
- o === w.pointerId && (w.preventDefault(), w.stopPropagation(), u && s(), p());
12892
- }, y = (w) => {
12893
- o === w.pointerId && (w.preventDefault(), p());
12894
- }, f = (w) => {
12895
- const S = w.currentTarget.dataset.resizeDirection, R = w.shiftKey ? ta : ea, k = n();
12942
+ }, f = (b) => {
12943
+ o === b.pointerId && (b.preventDefault(), b.stopPropagation(), u && s(), p());
12944
+ }, y = (b) => {
12945
+ o === b.pointerId && (b.preventDefault(), p());
12946
+ }, g = (b) => {
12947
+ const S = b.currentTarget.dataset.resizeDirection, R = b.shiftKey ? ta : ea, k = n();
12896
12948
  let C = 0, D = 0;
12897
- pl(S) && (w.key === "ArrowLeft" ? C = -R : w.key === "ArrowRight" ? C = R : w.key === "ArrowUp" ? D = -R : w.key === "ArrowDown" && (D = R), !(C === 0 && D === 0) && (w.preventDefault(), w.stopPropagation(), i(hl(k, S, C, D)), s()));
12949
+ pl(S) && (b.key === "ArrowLeft" ? C = -R : b.key === "ArrowRight" ? C = R : b.key === "ArrowUp" ? D = -R : b.key === "ArrowDown" && (D = R), !(C === 0 && D === 0) && (b.preventDefault(), b.stopPropagation(), i(hl(k, S, C, D)), s()));
12898
12950
  };
12899
- for (const w of e)
12900
- w.addEventListener("pointerdown", l), w.addEventListener("pointermove", h), w.addEventListener("pointerup", g), w.addEventListener("pointercancel", y), w.addEventListener("keydown", f);
12951
+ for (const b of e)
12952
+ b.addEventListener("pointerdown", l), b.addEventListener("pointermove", h), b.addEventListener("pointerup", f), b.addEventListener("pointercancel", y), b.addEventListener("keydown", g);
12901
12953
  return () => {
12902
- for (const w of e)
12903
- w.removeEventListener("pointerdown", l), w.removeEventListener("pointermove", h), w.removeEventListener("pointerup", g), w.removeEventListener("pointercancel", y), w.removeEventListener("keydown", f);
12954
+ for (const b of e)
12955
+ b.removeEventListener("pointerdown", l), b.removeEventListener("pointermove", h), b.removeEventListener("pointerup", f), b.removeEventListener("pointercancel", y), b.removeEventListener("keydown", g);
12904
12956
  };
12905
12957
  }
12906
12958
  function pl(t) {
@@ -13236,7 +13288,7 @@ function aw(t) {
13236
13288
  function _i(t) {
13237
13289
  t.style.height = "0px", t.style.height = `${t.scrollHeight}px`, t.style.overflowY = t.scrollHeight > t.clientHeight ? "auto" : "hidden";
13238
13290
  }
13239
- function On(t, e = () => !0) {
13291
+ function Nn(t, e = () => !0) {
13240
13292
  t.scrollTop = t.scrollHeight, window.requestAnimationFrame(() => {
13241
13293
  e() && (t.scrollTop = t.scrollHeight);
13242
13294
  });
@@ -13275,7 +13327,7 @@ function cw(t) {
13275
13327
  starterPromptsLoading: t.starterPromptsLoading,
13276
13328
  activeScheduledFollowUps: t.activeScheduledFollowUps,
13277
13329
  // A wall-clock change can alter labels without changing the authoritative schedule snapshot.
13278
- scheduledCheckInLabels: (Array.isArray(t.activeScheduledFollowUps) ? t.activeScheduledFollowUps.map((e) => e.dueAt) : t.messages.map((e) => e.scheduledCheckInAt)).map((e) => e ? Hn(e) : null),
13330
+ scheduledCheckInLabels: (Array.isArray(t.activeScheduledFollowUps) ? t.activeScheduledFollowUps.map((e) => e.dueAt) : t.messages.map((e) => e.scheduledCheckInAt)).map((e) => e ? Kn(e) : null),
13279
13331
  appearance: t.appearance
13280
13332
  });
13281
13333
  }
@@ -13367,8 +13419,8 @@ function pw(t, e) {
13367
13419
  );
13368
13420
  const i = document.createElement("div");
13369
13421
  if (i.className = "pluno-pa-widget__drop-overlay", i.setAttribute("aria-hidden", "true"), i.textContent = "Drop files to attach", n.appendChild(i), e) {
13370
- const f = document.createElement("button");
13371
- f.type = "button", f.className = "pluno-pa-widget__panel-drag-handle", f.setAttribute("aria-label", "Move Pluno widget"), f.title = "Move Pluno widget", n.appendChild(f);
13422
+ const g = document.createElement("button");
13423
+ g.type = "button", g.className = "pluno-pa-widget__panel-drag-handle", g.setAttribute("aria-label", "Move Pluno widget"), g.title = "Move Pluno widget", n.appendChild(g);
13372
13424
  }
13373
13425
  const s = document.createElement("div");
13374
13426
  s.className = "pluno-pa-widget__timeline-wrap";
@@ -13388,15 +13440,15 @@ function pw(t, e) {
13388
13440
  l.className = "pluno-pa-widget__access-notice", l.hidden = !0;
13389
13441
  const h = document.createElement("div");
13390
13442
  h.className = "pluno-pa-widget__connection-notice", h.hidden = !0, u.append(l, p, h), u.append(c, hw(), gw()), s.appendChild(u);
13391
- const g = document.createElement("div");
13392
- g.className = "pluno-pa-widget__top-actions", g.appendChild(
13443
+ const f = document.createElement("div");
13444
+ f.className = "pluno-pa-widget__top-actions", f.appendChild(
13393
13445
  zs(
13394
13446
  "pluno-pa-widget__history",
13395
13447
  Pr(),
13396
13448
  xw(),
13397
13449
  !0
13398
13450
  )
13399
- ), s.appendChild(g), s.appendChild(yw()), n.appendChild(s);
13451
+ ), s.appendChild(f), s.appendChild(yw()), n.appendChild(s);
13400
13452
  const y = document.createElement("div");
13401
13453
  return y.className = "pluno-pa-widget__proactive-suggestion-slot", n.appendChild(y), n.appendChild(mw()), n.appendChild(an("left", "Resize Pluno from left")), n.appendChild(
13402
13454
  an("right", "Resize Pluno from right")
@@ -13508,23 +13560,23 @@ function mw() {
13508
13560
  h.className = "pluno-pa-widget__model-menu";
13509
13561
  for (const k of ks)
13510
13562
  h.appendChild(bl(k));
13511
- const g = document.createElement("details");
13512
- g.className = "pluno-pa-widget__model-more";
13513
- const y = document.createElement("summary"), f = document.createElement("span");
13514
- f.textContent = "More";
13515
- const w = Mr(12);
13516
- w.classList.add("pluno-pa-widget__model-more-chevron"), y.append(f, w), g.appendChild(y);
13563
+ const f = document.createElement("details");
13564
+ f.className = "pluno-pa-widget__model-more";
13565
+ const y = document.createElement("summary"), g = document.createElement("span");
13566
+ g.textContent = "More";
13567
+ const b = Mr(12);
13568
+ b.classList.add("pluno-pa-widget__model-more-chevron"), y.append(g, b), f.appendChild(y);
13517
13569
  for (const k of Nd) {
13518
13570
  const C = bl(k);
13519
- C.classList.add("pluno-pa-widget__model-more-option"), g.appendChild(C);
13571
+ C.classList.add("pluno-pa-widget__model-more-option"), f.appendChild(C);
13520
13572
  }
13521
- h.appendChild(g), u.appendChild(h), c.appendChild(u);
13522
- const b = document.createElement("div");
13523
- b.className = "pluno-pa-widget__composer-meta";
13573
+ h.appendChild(f), u.appendChild(h), c.appendChild(u);
13574
+ const w = document.createElement("div");
13575
+ w.className = "pluno-pa-widget__composer-meta";
13524
13576
  const S = document.createElement("a");
13525
- S.className = "pluno-pa-widget__powered-by", S.href = "https://pluno.ai", S.target = "_blank", S.rel = "noopener noreferrer", S.textContent = "Powered by Pluno.ai.", b.appendChild(S);
13577
+ S.className = "pluno-pa-widget__powered-by", S.href = "https://pluno.ai", S.target = "_blank", S.rel = "noopener noreferrer", S.textContent = "Powered by Pluno.ai.", w.appendChild(S);
13526
13578
  const R = document.createElement("span");
13527
- return R.className = "pluno-pa-widget__ai-disclaimer", R.textContent = "AI can make mistakes. Verify outputs.", b.appendChild(R), c.appendChild(b), t.appendChild(c), t;
13579
+ return R.className = "pluno-pa-widget__ai-disclaimer", R.textContent = "AI can make mistakes. Verify outputs.", w.appendChild(R), c.appendChild(w), t.appendChild(c), t;
13528
13580
  }
13529
13581
  function bl(t) {
13530
13582
  const e = document.createElement("button");
@@ -13610,7 +13662,7 @@ function bw(t, e) {
13610
13662
  y2: "1040",
13611
13663
  gradientUnits: "userSpaceOnUse"
13612
13664
  });
13613
- Pe(a, "0", n.top), Pe(a, "0.36", n.middle), Pe(a, "0.72", n.bottom), Pe(a, "1", n.bottom);
13665
+ Me(a, "0", n.top), Me(a, "0.36", n.middle), Me(a, "0.72", n.bottom), Me(a, "1", n.bottom);
13614
13666
  const r = F(o, "linearGradient", {
13615
13667
  id: i.boltEdge,
13616
13668
  x1: "470",
@@ -13619,28 +13671,28 @@ function bw(t, e) {
13619
13671
  y2: "980",
13620
13672
  gradientUnits: "userSpaceOnUse"
13621
13673
  });
13622
- Pe(r, "0", n.edgeStart), Pe(r, "0.32", n.edgeMiddle), Pe(r, "0.78", n.edgeEnd), Pe(r, "1", n.edgeEnd);
13674
+ Me(r, "0", n.edgeStart), Me(r, "0.32", n.edgeMiddle), Me(r, "0.78", n.edgeEnd), Me(r, "1", n.edgeEnd);
13623
13675
  const c = F(o, "radialGradient", {
13624
13676
  id: i.boltGlow,
13625
13677
  cx: "50%",
13626
13678
  cy: "22%",
13627
13679
  r: "82%"
13628
13680
  });
13629
- Pe(c, "0", n.glow, "0.72"), Pe(c, "0.5", n.middle, "0.44"), Pe(c, "1", n.bottom, "0");
13681
+ Me(c, "0", n.glow, "0.72"), Me(c, "0.5", n.middle, "0.44"), Me(c, "1", n.bottom, "0");
13630
13682
  const u = F(o, "radialGradient", {
13631
13683
  id: i.eyeWhite,
13632
13684
  cx: "35%",
13633
13685
  cy: "25%",
13634
13686
  r: "70%"
13635
13687
  });
13636
- Pe(u, "0", "#ffffff"), Pe(u, "0.72", "#ffffff"), Pe(u, "1", "#e5e5e5");
13688
+ Me(u, "0", "#ffffff"), Me(u, "0.72", "#ffffff"), Me(u, "1", "#e5e5e5");
13637
13689
  const p = F(o, "radialGradient", {
13638
13690
  id: i.pupil,
13639
13691
  cx: "42%",
13640
13692
  cy: "38%",
13641
13693
  r: "65%"
13642
13694
  });
13643
- Pe(p, "0", "#2a1f10"), Pe(p, "0.52", "#080604"), Pe(p, "1", "#000000");
13695
+ Me(p, "0", "#2a1f10"), Me(p, "0.52", "#080604"), Me(p, "1", "#000000");
13644
13696
  const l = F(o, "filter", {
13645
13697
  id: i.softDropShadow,
13646
13698
  x: "-18%",
@@ -13689,7 +13741,7 @@ function bw(t, e) {
13689
13741
  in2: "innerLight",
13690
13742
  mode: "screen"
13691
13743
  });
13692
- const g = F(o, "filter", {
13744
+ const f = F(o, "filter", {
13693
13745
  id: i.eyeShadow,
13694
13746
  x: "-24%",
13695
13747
  y: "-20%",
@@ -13697,7 +13749,7 @@ function bw(t, e) {
13697
13749
  height: "148%",
13698
13750
  "color-interpolation-filters": "sRGB"
13699
13751
  });
13700
- F(g, "feDropShadow", {
13752
+ F(f, "feDropShadow", {
13701
13753
  dx: "0",
13702
13754
  dy: "8",
13703
13755
  stdDeviation: "5",
@@ -13719,26 +13771,26 @@ function bw(t, e) {
13719
13771
  "flood-color": "#000000",
13720
13772
  "flood-opacity": "0.22"
13721
13773
  });
13722
- const f = F(o, "clipPath", { id: i.boltClip });
13723
- F(f, "path", { d: Es });
13724
- const w = F(s, "g", {
13774
+ const g = F(o, "clipPath", { id: i.boltClip });
13775
+ F(g, "path", { d: Es });
13776
+ const b = F(s, "g", {
13725
13777
  filter: ot(i.softDropShadow)
13726
13778
  });
13727
- F(w, "path", {
13779
+ F(b, "path", {
13728
13780
  d: Es,
13729
13781
  fill: ot(i.boltEdge)
13730
13782
  });
13731
- const b = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
13732
- F(w, "path", {
13733
- d: b,
13783
+ const w = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
13784
+ F(b, "path", {
13785
+ d: w,
13734
13786
  fill: ot(i.boltFill),
13735
13787
  filter: ot(i.innerDepth)
13736
- }), F(w, "path", {
13737
- d: b,
13788
+ }), F(b, "path", {
13789
+ d: w,
13738
13790
  fill: ot(i.boltGlow),
13739
13791
  opacity: "0.74"
13740
13792
  });
13741
- const S = F(w, "g", {
13793
+ const S = F(b, "g", {
13742
13794
  "clip-path": ot(i.boltClip),
13743
13795
  opacity: "0.42"
13744
13796
  });
@@ -13907,7 +13959,7 @@ function F(t, e, n = {}) {
13907
13959
  const i = J(e, n);
13908
13960
  return t.appendChild(i), i;
13909
13961
  }
13910
- function Pe(t, e, n, i) {
13962
+ function Me(t, e, n, i) {
13911
13963
  const s = { offset: e, "stop-color": n };
13912
13964
  i !== void 0 && (s["stop-opacity"] = i), F(t, "stop", s);
13913
13965
  }
@@ -14340,11 +14392,11 @@ function Dw(t, e, n, i, s, o) {
14340
14392
  En(e(), "message")
14341
14393
  );
14342
14394
  }, u = () => {
14343
- const g = Ts(e());
14344
- if (g && g !== a) {
14345
- a = g, t.addEventListener("error", u, {
14395
+ const f = Ts(e());
14396
+ if (f && f !== a) {
14397
+ a = f, t.addEventListener("error", u, {
14346
14398
  once: !0
14347
- }), s(g);
14399
+ }), s(f);
14348
14400
  return;
14349
14401
  }
14350
14402
  c();
@@ -14358,27 +14410,27 @@ function Dw(t, e, n, i, s, o) {
14358
14410
  let p = 0;
14359
14411
  const l = () => {
14360
14412
  i(e()).then(
14361
- (g) => {
14413
+ (f) => {
14362
14414
  if (t.isConnected) {
14363
- if (!g) {
14415
+ if (!f) {
14364
14416
  h();
14365
14417
  return;
14366
14418
  }
14367
- t.addEventListener("error", h, { once: !0 }), s(g);
14419
+ t.addEventListener("error", h, { once: !0 }), s(f);
14368
14420
  }
14369
14421
  },
14370
14422
  h
14371
14423
  );
14372
14424
  }, h = () => {
14373
14425
  o();
14374
- const g = py[p];
14375
- if (p += 1, g === void 0) {
14426
+ const f = py[p];
14427
+ if (p += 1, f === void 0) {
14376
14428
  c();
14377
14429
  return;
14378
14430
  }
14379
14431
  window.setTimeout(() => {
14380
14432
  t.isConnected && l();
14381
- }, g);
14433
+ }, f);
14382
14434
  };
14383
14435
  l();
14384
14436
  }
@@ -14470,7 +14522,7 @@ function zw(t) {
14470
14522
  const e = Lr(t);
14471
14523
  return t !== null && (e.state === "paid_credit_fallback" || e.state === "action_required");
14472
14524
  }
14473
- function Dn(t) {
14525
+ function Ln(t) {
14474
14526
  return Lr(t).state === "action_required";
14475
14527
  }
14476
14528
  function $w(t, e, n) {
@@ -14503,16 +14555,16 @@ function xl(t, e) {
14503
14555
  const i = n[1], s = e ? "Finding example tasks..." : " ";
14504
14556
  i.textContent !== s && (i.textContent = s), i.classList.toggle("pluno-pa-widget__starter-placeholder--loading", e), i.parentElement.setAttribute("aria-hidden", String(!e));
14505
14557
  }
14506
- function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D, q, Z, L) {
14558
+ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, f, y, g, b, w, S, R, k, C, D, q, Z, L) {
14507
14559
  const de = Xu(o), se = Zw(o), fe = Array.isArray(o.activeScheduledFollowUps) ? o.activeScheduledFollowUps : null, te = /* @__PURE__ */ new Map();
14508
14560
  if (fe !== null)
14509
14561
  for (const _ of fe) {
14510
- const E = Hn(_.dueAt);
14562
+ const E = Kn(_.dueAt);
14511
14563
  E && te.set(_.taskId, { dueAt: _.dueAt, label: E });
14512
14564
  }
14513
14565
  else
14514
14566
  for (const _ of se) {
14515
- const E = _.scheduledCheckInAt ? Hn(_.scheduledCheckInAt) : null;
14567
+ const E = _.scheduledCheckInAt ? Kn(_.scheduledCheckInAt) : null;
14516
14568
  if (!E || !_.scheduledCheckInAt)
14517
14569
  continue;
14518
14570
  const B = _.scheduledCheckInId ?? _.id;
@@ -14552,13 +14604,13 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14552
14604
  const xe = !!(q?.requests.length || Z || L?.candidate), He = xe || O.length > 0 || I.length > 0 || !!o.assistantDraft || o.pendingMessageStatus !== null || o.isThinking;
14553
14605
  if (i(He || !!o.historyPreparation), o.historyPreparation && He) {
14554
14606
  const _ = document.createElement("div");
14555
- _.className = "pluno-pa-widget__transcript-loading", _.setAttribute("role", "status"), _.append(Fn(), document.createTextNode("Preparing this conversation…")), W(_);
14607
+ _.className = "pluno-pa-widget__transcript-loading", _.setAttribute("role", "status"), _.append(jn(), document.createTextNode("Preparing this conversation…")), W(_);
14556
14608
  }
14557
14609
  if (o.isLoadingSession && !He) {
14558
14610
  const _ = document.createElement("div");
14559
14611
  _.className = "pluno-pa-widget__transcript-loading", _.setAttribute("role", "status");
14560
14612
  const E = document.createElement("span");
14561
- E.textContent = o.historyPreparation ? "Preparing this conversation…" : "Loading chat...", _.append(Fn(), E), l.clear(), h.clear(), g.clear(), W(_), W(e), Tt(t, ue);
14613
+ E.textContent = o.historyPreparation ? "Preparing this conversation…" : "Loading chat...", _.append(jn(), E), l.clear(), h.clear(), f.clear(), W(_), W(e), Tt(t, ue);
14562
14614
  return;
14563
14615
  }
14564
14616
  if (!He && o.sessionId && !o.isDraftSession) {
@@ -14577,7 +14629,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14577
14629
  o.user?.id,
14578
14630
  S,
14579
14631
  o.starterPrompts,
14580
- f()
14632
+ g()
14581
14633
  ]), E = l.get("welcome");
14582
14634
  if (E?.renderSignature === _) {
14583
14635
  xl(E.node, o.starterPromptsLoading), W(E.node), W(e), Tt(t, ue);
@@ -14589,7 +14641,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14589
14641
  H.className = "pluno-pa-widget__empty-hero";
14590
14642
  const be = Pt(
14591
14643
  "pluno-pa-widget__character--empty",
14592
- f()
14644
+ g()
14593
14645
  );
14594
14646
  if (H.appendChild(be), B.appendChild(H), S) {
14595
14647
  const Q = document.createElement("h2");
@@ -14601,7 +14653,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14601
14653
  for (const Q of z) {
14602
14654
  const K = document.createElement("button");
14603
14655
  K.type = "button", K.className = "pluno-pa-widget__starter-prompt", K.textContent = Q, K.addEventListener("click", () => {
14604
- w(Q);
14656
+ b(Q);
14605
14657
  }), ee.appendChild(K);
14606
14658
  }
14607
14659
  else
@@ -14613,7 +14665,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14613
14665
  const Q = document.createElement("button");
14614
14666
  Q.type = "button", Q.className = "pluno-pa-widget__morning-report-snooze", Q.textContent = "Snooze morning report", Q.addEventListener("click", R), B.appendChild(Q);
14615
14667
  }
14616
- l.clear(), h.clear(), g.clear(), W(B), l.set("welcome", { node: B, renderSignature: _ }), W(e), Tt(t, ue);
14668
+ l.clear(), h.clear(), f.clear(), W(B), l.set("welcome", { node: B, renderSignature: _ }), W(e), Tt(t, ue);
14617
14669
  return;
14618
14670
  }
14619
14671
  let ie = null, re = null, N = [], ae = [];
@@ -14633,7 +14685,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14633
14685
  h,
14634
14686
  pe,
14635
14687
  y,
14636
- f(),
14688
+ g(),
14637
14689
  V.get(N[0].id)?.collapsed ?? !0
14638
14690
  );
14639
14691
  return W(E), ie = null, re = E, N = [], T = _, !0;
@@ -14677,7 +14729,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14677
14729
  }
14678
14730
  if (E.role === "system" && E.dataType === "run_status" && E.steered === !0) {
14679
14731
  if (!j()) {
14680
- const Q = db(f());
14732
+ const Q = db(g());
14681
14733
  W(Q), ie = null, re = Q;
14682
14734
  }
14683
14735
  continue;
@@ -14689,7 +14741,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14689
14741
  if (ee) {
14690
14742
  if (!T) {
14691
14743
  const K = Tl(
14692
- g,
14744
+ f,
14693
14745
  je,
14694
14746
  Q,
14695
14747
  me
@@ -14698,10 +14750,10 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14698
14750
  }
14699
14751
  } else {
14700
14752
  const K = Al(
14701
- g,
14753
+ f,
14702
14754
  je,
14703
14755
  Q,
14704
- f(),
14756
+ g(),
14705
14757
  me
14706
14758
  );
14707
14759
  W(K), ie = null, re = K;
@@ -14714,7 +14766,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14714
14766
  (Ce) => Ce.role === "tool" && Rs(Ce, E)
14715
14767
  );
14716
14768
  if (!ee && !Q) {
14717
- const Ce = Ri(f());
14769
+ const Ce = Ri(g());
14718
14770
  Ce.classList.add("pluno-pa-widget__terminal-marker"), W(Ce);
14719
14771
  }
14720
14772
  const K = document.createElement("div"), Se = E.dataType === "run_error";
@@ -14733,7 +14785,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14733
14785
  (ee) => ee.role === "tool" && Rs(ee, E)
14734
14786
  );
14735
14787
  if (E.role === "assistant" && !B && !be) {
14736
- const ee = Ri(f());
14788
+ const ee = Ri(g());
14737
14789
  W(ee), ie = null, re = ee;
14738
14790
  }
14739
14791
  const z = Hw(
@@ -14751,7 +14803,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14751
14803
  if (Ke) {
14752
14804
  if (!T) {
14753
14805
  const E = Tl(
14754
- g,
14806
+ f,
14755
14807
  je,
14756
14808
  _,
14757
14809
  me
@@ -14760,17 +14812,17 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14760
14812
  }
14761
14813
  } else {
14762
14814
  const E = Al(
14763
- g,
14815
+ f,
14764
14816
  je,
14765
14817
  _,
14766
- f(),
14818
+ g(),
14767
14819
  me
14768
14820
  );
14769
14821
  W(E), ie = null, re = E;
14770
14822
  }
14771
14823
  }
14772
14824
  if (o.lastError && Ei(o.lastErrorCode) === "conversation") {
14773
- const B = O.slice(O.map((z) => z.role).lastIndexOf("user") + 1).some((z) => z.role === "assistant" || z.role === "tool") ? document.createElement("article") : Ri(f());
14825
+ const B = O.slice(O.map((z) => z.role).lastIndexOf("user") + 1).some((z) => z.role === "assistant" || z.role === "tool") ? document.createElement("article") : Ri(g());
14774
14826
  B.classList.add("pluno-pa-widget__terminal-marker");
14775
14827
  const H = document.createElement("div");
14776
14828
  H.className = "pluno-pa-widget__error";
@@ -14781,7 +14833,7 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14781
14833
  }
14782
14834
  for (const z of de.actions) {
14783
14835
  const ee = document.createElement("button");
14784
- ee.type = "button", ee.className = "pluno-pa-widget__error-retry", ee.textContent = z === "new_chat" ? "Start new chat" : "Try again", ee.addEventListener("click", z === "retry_history" ? k : z === "retry_message" ? b : C), H.appendChild(ee);
14836
+ ee.type = "button", ee.className = "pluno-pa-widget__error-retry", ee.textContent = z === "new_chat" ? "Start new chat" : "Try again", ee.addEventListener("click", z === "retry_history" ? k : z === "retry_message" ? w : C), H.appendChild(ee);
14785
14837
  }
14786
14838
  B.appendChild(H), W(B), ie = null, re = B;
14787
14839
  }
@@ -14837,9 +14889,9 @@ function jw(t, e, n, i, s, o, a, r, c, u, p, l, h, g, y, f, w, b, S, R, k, C, D,
14837
14889
  h,
14838
14890
  pe
14839
14891
  ), Qw(
14840
- g,
14892
+ f,
14841
14893
  je
14842
- ), Tt(t, ue), c ? On(t, u) : t.scrollTop = ve;
14894
+ ), Tt(t, ue), c ? Nn(t, u) : t.scrollTop = ve;
14843
14895
  }
14844
14896
  function kl(t, e, n, i) {
14845
14897
  const s = document.createElement("section");
@@ -15146,11 +15198,11 @@ function sb(t, e) {
15146
15198
  const h = document.createElement("button");
15147
15199
  h.type = "button", h.className = "pluno-pa-widget__share-prompt-draft", h.disabled = e.isActing, h.addEventListener("click", () => {
15148
15200
  e.onReferralCopy(t);
15149
- }), e.isActing ? (h.appendChild(Fn()), h.appendChild(document.createTextNode("Copying..."))) : h.textContent = "Copy invite link", u.appendChild(h);
15201
+ }), e.isActing ? (h.appendChild(jn()), h.appendChild(document.createTextNode("Copying..."))) : h.textContent = "Copy invite link", u.appendChild(h);
15150
15202
  } else
15151
15203
  for (const h of ob()) {
15152
- const g = document.createElement("a");
15153
- g.className = "pluno-pa-widget__share-prompt-social", g.href = h.href, g.target = "_blank", g.rel = "noopener noreferrer", g.setAttribute("aria-label", `Open ${h.label}`), g.title = h.label, g.appendChild(rb(h.id)), g.addEventListener("click", () => e.onSocialShare(t)), u.appendChild(g);
15204
+ const f = document.createElement("a");
15205
+ f.className = "pluno-pa-widget__share-prompt-social", f.href = h.href, f.target = "_blank", f.rel = "noopener noreferrer", f.setAttribute("aria-label", `Open ${h.label}`), f.title = h.label, f.appendChild(rb(h.id)), f.addEventListener("click", () => e.onSocialShare(t)), u.appendChild(f);
15154
15206
  }
15155
15207
  const p = document.createElement("button");
15156
15208
  p.type = "button", p.className = "pluno-pa-widget__share-prompt-dismiss", p.setAttribute("aria-label", "Dismiss share prompt"), p.title = "Dismiss", p.textContent = e.presentation?.actionLabels.dismiss ?? "Dismiss", p.addEventListener("click", () => e.onDismiss(t)), u.appendChild(p), c.appendChild(u);
@@ -15236,8 +15288,8 @@ function ab(t, e, n, i, s, o, a, r = !0) {
15236
15288
  "pluno-pa-widget__character--tool-group",
15237
15289
  a
15238
15290
  ), l.characterSignature = h);
15239
- const g = l.node;
15240
- g.className = "pluno-pa-widget__tool-group", g.dataset.responseGroupKey = u, g.classList.toggle("pluno-pa-widget__tool-group--active", e), g.title = new Date(
15291
+ const f = l.node;
15292
+ f.className = "pluno-pa-widget__tool-group", f.dataset.responseGroupKey = u, f.classList.toggle("pluno-pa-widget__tool-group--active", e), f.title = new Date(
15241
15293
  t[t.length - 1].createdAt
15242
15294
  ).toLocaleString();
15243
15295
  const y = cb(
@@ -15251,19 +15303,19 @@ function ab(t, e, n, i, s, o, a, r = !0) {
15251
15303
  return Tt(k, [
15252
15304
  l.thinkingStatus,
15253
15305
  y
15254
- ]), Tt(g, [l.character, k]), g;
15255
- }
15256
- const f = l.details;
15257
- f.open = n.has(u) || !n.has(`closed:${u}`) && !r, g.classList.toggle("pluno-pa-widget__tool-group--open", f.open);
15258
- const w = t[t.length - 1], b = Ps(
15259
- w.content
15260
- ).trim(), S = w.phase === "commentary", R = b ? S ? b : lu(b) : c ? "Steered" : "Thinking...";
15261
- return g.dataset.collapsedActivityTitle = R, l.summaryTitle.replaceChildren(), l.summaryTitle.classList.add(
15306
+ ]), Tt(f, [l.character, k]), f;
15307
+ }
15308
+ const g = l.details;
15309
+ g.open = n.has(u) || !n.has(`closed:${u}`) && !r, f.classList.toggle("pluno-pa-widget__tool-group--open", g.open);
15310
+ const b = t[t.length - 1], w = Ps(
15311
+ b.content
15312
+ ).trim(), S = b.phase === "commentary", R = w ? S ? w : lu(w) : c ? "Steered" : "Thinking...";
15313
+ return f.dataset.collapsedActivityTitle = R, l.summaryTitle.replaceChildren(), l.summaryTitle.classList.add(
15262
15314
  "pluno-pa-widget__tool-summary-markdown"
15263
15315
  ), ra(
15264
15316
  l.summaryTitle,
15265
- f.open ? "Activities" : R
15266
- ), Tt(f, [l.summary, y]), Tt(g, [l.character, f]), g;
15317
+ g.open ? "Activities" : R
15318
+ ), Tt(g, [l.summary, y]), Tt(f, [l.character, g]), f;
15267
15319
  }
15268
15320
  function cb(t, e, n, i) {
15269
15321
  const s = ty(
@@ -15277,12 +15329,12 @@ function cb(t, e, n, i) {
15277
15329
  i.set(u, p), p.className = "pluno-pa-widget__tool-line", p.dataset.eventType = c.phase === "commentary" ? "commentary" : "tool", c.phase === "commentary" ? delete p.dataset.toolCallKey : p.dataset.toolCallKey = u, p.dataset.canonicalItemKey = c.id, c.runId ? p.dataset.runId = c.runId : delete p.dataset.runId;
15278
15330
  const l = p.querySelector(".pluno-pa-widget__tool-line-text") ?? document.createElement("div");
15279
15331
  l.className = "pluno-pa-widget__tool-line-text";
15280
- const h = Ps(c.content) || (c.phase === "commentary" ? "" : "Run tool"), g = c.phase === "commentary" ? h : lu(h);
15281
- s[r] ? (l.classList.add("pluno-pa-widget__tool-line-text--loading"), l.dataset.loadingText = _p(g)) : delete l.dataset.loadingText, l.classList.add("pluno-pa-widget__tool-line-markdown"), l.replaceChildren();
15332
+ const h = Ps(c.content) || (c.phase === "commentary" ? "" : "Run tool"), f = c.phase === "commentary" ? h : lu(h);
15333
+ s[r] ? (l.classList.add("pluno-pa-widget__tool-line-text--loading"), l.dataset.loadingText = _p(f)) : delete l.dataset.loadingText, l.classList.add("pluno-pa-widget__tool-line-markdown"), l.replaceChildren();
15282
15334
  const y = document.createElement("div");
15283
- if (y.className = "pluno-pa-widget__tool-line-markdown", ra(y, g), l.append(y), s[r]) {
15284
- const f = y.cloneNode(!0);
15285
- f.classList.add("pluno-pa-widget__tool-loading-overlay"), f.setAttribute("aria-hidden", "true"), f.inert = !0, l.append(f);
15335
+ if (y.className = "pluno-pa-widget__tool-line-markdown", ra(y, f), l.append(y), s[r]) {
15336
+ const g = y.cloneNode(!0);
15337
+ g.classList.add("pluno-pa-widget__tool-loading-overlay"), g.setAttribute("aria-hidden", "true"), g.inert = !0, l.append(g);
15286
15338
  }
15287
15339
  p.replaceChildren(l), o.push(p);
15288
15340
  }
@@ -15377,7 +15429,7 @@ function ub(t) {
15377
15429
  const e = t[0];
15378
15430
  return e ? `tools:${ou(e)}` : "tools:empty";
15379
15431
  }
15380
- function Fn() {
15432
+ function jn() {
15381
15433
  const t = document.createElement("span");
15382
15434
  return t.className = "pluno-pa-widget__spinner", t.setAttribute("aria-hidden", "true"), t;
15383
15435
  }
@@ -15417,8 +15469,8 @@ function hb(t, e) {
15417
15469
  o.className = "pluno-pa-widget__table-scroll";
15418
15470
  const a = document.createElement("table"), r = document.createElement("thead"), c = document.createElement("tr");
15419
15471
  n.forEach((l, h) => {
15420
- const g = document.createElement("th"), y = s[h];
15421
- y && g.classList.add(`pluno-pa-widget__table-cell--${y}`), cn(g, l), c.appendChild(g);
15472
+ const f = document.createElement("th"), y = s[h];
15473
+ y && f.classList.add(`pluno-pa-widget__table-cell--${y}`), cn(f, l), c.appendChild(f);
15422
15474
  }), r.appendChild(c), a.appendChild(r);
15423
15475
  const u = document.createElement("tbody");
15424
15476
  let p = e + 2;
@@ -15427,9 +15479,9 @@ function hb(t, e) {
15427
15479
  if (!l)
15428
15480
  break;
15429
15481
  const h = document.createElement("tr");
15430
- n.forEach((g, y) => {
15431
- const f = document.createElement("td"), w = s[y];
15432
- w && f.classList.add(`pluno-pa-widget__table-cell--${w}`), cn(f, l[y] ?? ""), h.appendChild(f);
15482
+ n.forEach((f, y) => {
15483
+ const g = document.createElement("td"), b = s[y];
15484
+ b && g.classList.add(`pluno-pa-widget__table-cell--${b}`), cn(g, l[y] ?? ""), h.appendChild(g);
15433
15485
  }), u.appendChild(h), p += 1;
15434
15486
  }
15435
15487
  return a.appendChild(u), o.appendChild(a), { element: o, nextIndex: p };
@@ -15450,9 +15502,9 @@ function ra(t, e) {
15450
15502
  for (i += 1; i < n.length && !/^```\s*$/.test(n[i]); )
15451
15503
  l.push(n[i]), i += 1;
15452
15504
  i += i < n.length ? 1 : 0;
15453
- const h = document.createElement("pre"), g = document.createElement("code");
15454
- g.textContent = l.join(`
15455
- `), h.appendChild(g), t.appendChild(h);
15505
+ const h = document.createElement("pre"), f = document.createElement("code");
15506
+ f.textContent = l.join(`
15507
+ `), h.appendChild(f), t.appendChild(h);
15456
15508
  continue;
15457
15509
  }
15458
15510
  const a = hb(n, i);