@pluno/product-agent-web 0.1.306 → 0.1.307

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.
@@ -52,7 +52,7 @@ function th(t, e, n) {
52
52
  function nh([t, e, n], i) {
53
53
  return `rgba(${Math.round(t)}, ${Math.round(e)}, ${Math.round(n)}, ${i})`;
54
54
  }
55
- function Vr([t, e, n]) {
55
+ function Gr([t, e, n]) {
56
56
  const i = (s) => {
57
57
  const o = s / 255;
58
58
  return o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4);
@@ -60,7 +60,7 @@ function Vr([t, e, n]) {
60
60
  return 0.2126 * i(t) + 0.7152 * i(e) + 0.0722 * i(n);
61
61
  }
62
62
  function il(t, e) {
63
- const n = Vr(t), i = Vr(e), [s, o] = n > i ? [n, i] : [i, n];
63
+ const n = Gr(t), i = Gr(e), [s, o] = n > i ? [n, i] : [i, n];
64
64
  return (s + 0.05) / (o + 0.05);
65
65
  }
66
66
  function ih(t, e, n, i) {
@@ -74,9 +74,9 @@ function ih(t, e, n, i) {
74
74
  return sh(e);
75
75
  }
76
76
  function sh(t) {
77
- return Vr(t) > 0.5 ? [24, 24, 27] : [250, 250, 249];
77
+ return Gr(t) > 0.5 ? [24, 24, 27] : [250, 250, 249];
78
78
  }
79
- const oh = "0.1.306", ci = {
79
+ const oh = "0.1.307", ci = {
80
80
  version: oh
81
81
  }, fe = (t) => typeof t == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(t) ? t : null;
82
82
  function Ld(t) {
@@ -107,7 +107,7 @@ function rh(t, e, n) {
107
107
  projectionReady: typeof s?.projection_ready == "boolean" ? s.projection_ready : null
108
108
  };
109
109
  }
110
- function Js(t) {
110
+ function Qs(t) {
111
111
  const e = t.closest("[data-conversation-gate]")?.dataset.conversationGate;
112
112
  return e === "authentication" || e === "signup" ? e : "none";
113
113
  }
@@ -123,7 +123,7 @@ function ah(t) {
123
123
  e = Math.imul(e ^ t.charCodeAt(i), 16777619) >>> 0, n = Math.imul(n ^ t.charCodeAt(i), 33) >>> 0;
124
124
  return `selection:${e.toString(16)}:${n.toString(16)}`;
125
125
  }
126
- const Gr = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], wt = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), Bn = (t) => t === null || wt(t), Ud = (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));
126
+ const Jr = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], wt = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), Bn = (t) => t === null || wt(t), Ud = (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));
127
127
  function zd(t) {
128
128
  if (!t || typeof t != "object") return !1;
129
129
  const e = t;
@@ -142,7 +142,7 @@ function ch(t, e) {
142
142
  };
143
143
  return zd(i) ? i : void 0;
144
144
  }
145
- function Jr(t) {
145
+ function Qr(t) {
146
146
  const e = (n) => t[n].filter(wt).slice(-20);
147
147
  return {
148
148
  sessionId: wt(t.selectedSessionId) ? t.selectedSessionId : null,
@@ -154,7 +154,7 @@ function Jr(t) {
154
154
  thinkingSequence: (t.thinkingSequence ?? []).slice(-20),
155
155
  runtimeItemCount: t.runtimeItemCount ?? 0,
156
156
  welcome: t.welcome ?? !1,
157
- truncated: (t.thinkingSequence?.length ?? 0) > 20 || Gr.some((n) => t[n].length > 20 || t[n].some((i) => !wt(i)))
157
+ truncated: (t.thinkingSequence?.length ?? 0) > 20 || Jr.some((n) => t[n].length > 20 || t[n].some((i) => !wt(i)))
158
158
  };
159
159
  }
160
160
  function Bd(t) {
@@ -176,17 +176,17 @@ function Bd(t) {
176
176
  };
177
177
  }
178
178
  function lh(t, e, n) {
179
- const i = Jr(t), s = n ? Bd(n) : { truncated: !1 };
179
+ const i = Qr(t), s = n ? Bd(n) : { truncated: !1 };
180
180
  return {
181
- before: e ? Jr(e) : null,
181
+ before: e ? Qr(e) : null,
182
182
  current: { ...i, ...s, truncated: i.truncated || s.truncated }
183
183
  };
184
184
  }
185
185
  function dh(t, e, n = {}) {
186
- const i = (a, r) => Array.from(t.querySelectorAll(a)).flatMap((c) => c.getAttribute(r) ?? []), s = Jr({
186
+ const i = (a, r) => Array.from(t.querySelectorAll(a)).flatMap((c) => c.getAttribute(r) ?? []), s = Qr({
187
187
  selectedSessionId: e.sessionId,
188
188
  runtimeItemCount: e.messages.length,
189
- welcome: Js(t) === "none" && !!t.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report), .empty-state--starter"),
189
+ welcome: Qs(t) === "none" && !!t.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report), .empty-state--starter"),
190
190
  messageKeys: Array.from(t.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]")).flatMap((a) => a.dataset.messageKey ?? a.dataset.entryKey ?? []),
191
191
  canonicalItemKeys: i("[data-canonical-item-key]", "data-canonical-item-key"),
192
192
  terminalResponseKeys: i("[data-terminal-response-key]", "data-terminal-response-key"),
@@ -199,14 +199,14 @@ function dh(t, e, n = {}) {
199
199
  ...s,
200
200
  ...o,
201
201
  truncated: s.truncated || o.truncated,
202
- context: Qr(t, e, n)
202
+ context: Yr(t, e, n)
203
203
  };
204
204
  }
205
- function Qr(t, e, n = {}) {
205
+ function Yr(t, e, n = {}) {
206
206
  const i = e.conversationDiagnostics;
207
207
  return {
208
208
  sdkVersion: ci.version,
209
- presentationGate: Js(t),
209
+ presentationGate: Qs(t),
210
210
  capturedAt: Date.now(),
211
211
  selectionKey: ah(e.selectionKey),
212
212
  userId: fe(e.user?.id),
@@ -235,11 +235,11 @@ function ph(t) {
235
235
  const e = (i) => {
236
236
  if (!i || typeof i != "object") return !1;
237
237
  const s = i;
238
- return Object.keys(i).every((o) => [...Gr, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(o)) && (s.duplicateToolCalls === void 0 || Array.isArray(s.duplicateToolCalls) && s.duplicateToolCalls.length <= 5 && s.duplicateToolCalls.every((o) => o && Object.keys(o).every((a) => ["key", "count", "rows", "truncated"].includes(a)) && Bn(o.key) && Number.isSafeInteger(o.count) && o.count >= 2 && typeof o.truncated == "boolean" && Array.isArray(o.rows) && o.rows.length >= 1 && o.rows.length <= 5 && o.rows.length <= o.count && o.rows.every((a) => a && Object.keys(a).every((r) => ["itemId", "groupId"].includes(r)) && Bn(a.itemId) && Bn(a.groupId)))) && (s.context === void 0 || uh(s.context)) && (s.thinkingSequence === void 0 || Array.isArray(s.thinkingSequence) && s.thinkingSequence.length <= 20 && s.thinkingSequence.every((o) => o === "user" || o === "thinking")) && Bn(s.sessionId) && Number.isSafeInteger(s.runtimeItemCount) && s.runtimeItemCount >= 0 && typeof s.welcome == "boolean" && typeof s.truncated == "boolean" && Gr.every((o) => Array.isArray(s[o]) && s[o].length <= 20 && s[o].every(wt));
238
+ return Object.keys(i).every((o) => [...Jr, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(o)) && (s.duplicateToolCalls === void 0 || Array.isArray(s.duplicateToolCalls) && s.duplicateToolCalls.length <= 5 && s.duplicateToolCalls.every((o) => o && Object.keys(o).every((a) => ["key", "count", "rows", "truncated"].includes(a)) && Bn(o.key) && Number.isSafeInteger(o.count) && o.count >= 2 && typeof o.truncated == "boolean" && Array.isArray(o.rows) && o.rows.length >= 1 && o.rows.length <= 5 && o.rows.length <= o.count && o.rows.every((a) => a && Object.keys(a).every((r) => ["itemId", "groupId"].includes(r)) && Bn(a.itemId) && Bn(a.groupId)))) && (s.context === void 0 || uh(s.context)) && (s.thinkingSequence === void 0 || Array.isArray(s.thinkingSequence) && s.thinkingSequence.length <= 20 && s.thinkingSequence.every((o) => o === "user" || o === "thinking")) && Bn(s.sessionId) && Number.isSafeInteger(s.runtimeItemCount) && s.runtimeItemCount >= 0 && typeof s.welcome == "boolean" && typeof s.truncated == "boolean" && Jr.every((o) => Array.isArray(s[o]) && s[o].length <= 20 && s[o].every(wt));
239
239
  }, n = t;
240
240
  return (n.before === null || e(n.before)) && e(n.current);
241
241
  }
242
- function po(t) {
242
+ function ho(t) {
243
243
  if (!t || typeof t != "object") return !1;
244
244
  const e = t;
245
245
  return Object.keys(t).every((n) => ["boundary", "category", "messageKind"].includes(n)) && ["runtime", "web_transport", "extension_ipc"].includes(e.boundary) && ["error", "object", "null", "array", "string", "undefined", "number", "boolean", "bigint", "symbol", "function"].includes(e.category) && ["object_coercion", "text", "blank", "non_text"].includes(e.messageKind);
@@ -266,7 +266,7 @@ function Xt(t, e = "runtime_error", n = "runtime") {
266
266
  const i = t !== null && typeof t == "object" ? t : null, s = typeof t == "string" ? t : i && "message" in i && typeof i.message == "string" ? i.message : "", o = i && "code" in i && typeof i.code == "string" && i.code.trim() ? i.code : e, a = i && "details" in i ? i.details : null, r = a && typeof a == "object" ? a : {}, c = {
267
267
  ...typeof r.httpStatus == "number" && Number.isInteger(r.httpStatus) && r.httpStatus >= 100 && r.httpStatus <= 599 ? { httpStatus: r.httpStatus } : {},
268
268
  // Preserve the first boundary's shape after normalization replaces the original message/prototype.
269
- errorNormalization: po(r.errorNormalization) ? r.errorNormalization : {
269
+ errorNormalization: ho(r.errorNormalization) ? r.errorNormalization : {
270
270
  boundary: n,
271
271
  category: t instanceof Error ? "error" : t === null ? "null" : Array.isArray(t) ? "array" : typeof t,
272
272
  messageKind: s.trim() === "[object Object]" ? "object_coercion" : s.trim() ? "text" : typeof t == "string" || i && "message" in i && typeof i.message == "string" ? "blank" : "non_text"
@@ -297,7 +297,7 @@ function Ln(t, e = "runtime") {
297
297
  `).replace(/\n\s*at\s/g, `
298
298
  frame `)) : void 0;
299
299
  return {
300
- ...po(n.details?.errorNormalization) ? { normalization: n.details.errorNormalization } : {},
300
+ ...ho(n.details?.errorNormalization) ? { normalization: n.details.errorNormalization } : {},
301
301
  category: t instanceof Error ? "error" : t === null ? "null" : Array.isArray(t) ? "array" : typeof t,
302
302
  code: Hn(n.code),
303
303
  message: Hn(n.message),
@@ -358,7 +358,7 @@ function bh(t) {
358
358
  actions: ["history_load_failed", "display_projection_disabled", "projection_not_ready", "history_preparation_failed"].includes(e ?? "") ? ["retry_history", "new_chat"] : ["run_recovery_exhausted", "transient_model_error", "run_still_active", "message_delivery_failed", "message_acceptance_unconfirmed", "context_preparation_interrupted"].includes(e ?? "") ? ["retry_message"] : ["new_chat"]
359
359
  };
360
360
  }
361
- const Qs = [
361
+ const Ys = [
362
362
  { value: "gpt-6-sol", label: "gpt-6-sol", price: "$$" },
363
363
  { value: "gpt-6-luna", label: "gpt-6-luna", price: "$" },
364
364
  { value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash", price: "$" },
@@ -367,7 +367,7 @@ const Qs = [
367
367
  function wh(t) {
368
368
  return t.length <= 4 ? { primary: t, more: [] } : { primary: t.slice(0, 3), more: t.slice(3) };
369
369
  }
370
- const jd = wh(Qs), Qi = jd.primary, rl = jd.more, _h = (t) => Qs.some((e) => e.value === t), vh = (t) => t.label, Nn = (t) => t === "gpt-5.6-sol" || t === "gpt-5.6-terra" || t === "anthropic/claude-sonnet-5" ? "gpt-6-sol" : t === "anthropic/claude-opus-5" ? "anthropic/claude-opus-5.5" : _h(t) ? t : void 0;
370
+ const jd = wh(Ys), Qi = jd.primary, rl = jd.more, _h = (t) => Ys.some((e) => e.value === t), vh = (t) => t.label, Nn = (t) => t === "gpt-5.6-sol" || t === "gpt-5.6-terra" || t === "anthropic/claude-sonnet-5" ? "gpt-6-sol" : t === "anthropic/claude-opus-5" ? "anthropic/claude-opus-5.5" : _h(t) ? t : void 0;
371
371
  function Ls(t, e, n) {
372
372
  t.throwIfAborted();
373
373
  let i, s = () => {
@@ -379,18 +379,18 @@ function Ls(t, e, n) {
379
379
  clearTimeout(i), t.removeEventListener("abort", s);
380
380
  });
381
381
  }
382
- const Yr = ["main-chat-omnibox-hint", "main-chat-whatsapp-hint"], Xr = "pluno.productAgent.deviceHints", al = ["pluno.productAgent.omniboxHintDismissed", "pluno.productAgent.whatsappHintDismissed"], cl = "pluno.productAgent.mainChatPromptDecisions";
383
- function Zr(t) {
384
- const e = JSON.parse(t.getItem(Xr) ?? "{}"), n = JSON.parse(t.getItem(cl) ?? "[]"), i = Object.fromEntries(Yr.map((s, o) => [s, e[s] === !0 || t.getItem(al[o]) === "true" || n.some((a) => a.scope.level === "device" && a.scope.key === "main-web-chat" && (a.promptKey === s || a.action === "dont_show_again" && a.category === (o ? "connections" : "product-tips")) && ["dismiss", "never", "dont_show_again"].includes(a.action))]));
385
- t.setItem(Xr, JSON.stringify(i));
382
+ const Xr = ["main-chat-omnibox-hint", "main-chat-whatsapp-hint"], Zr = "pluno.productAgent.deviceHints", al = ["pluno.productAgent.omniboxHintDismissed", "pluno.productAgent.whatsappHintDismissed"], cl = "pluno.productAgent.mainChatPromptDecisions";
383
+ function ea(t) {
384
+ const e = JSON.parse(t.getItem(Zr) ?? "{}"), n = JSON.parse(t.getItem(cl) ?? "[]"), i = Object.fromEntries(Xr.map((s, o) => [s, e[s] === !0 || t.getItem(al[o]) === "true" || n.some((a) => a.scope.level === "device" && a.scope.key === "main-web-chat" && (a.promptKey === s || a.action === "dont_show_again" && a.category === (o ? "connections" : "product-tips")) && ["dismiss", "never", "dont_show_again"].includes(a.action))]));
385
+ t.setItem(Zr, JSON.stringify(i));
386
386
  for (const s of al) t.removeItem(s);
387
- return t.setItem(cl, JSON.stringify(n.filter((s) => !Yr.includes(s.promptKey)))), i;
387
+ return t.setItem(cl, JSON.stringify(n.filter((s) => !Xr.includes(s.promptKey)))), i;
388
388
  }
389
389
  function Ih(t, e) {
390
- if (!Yr.includes(e)) throw new Error("Unknown device hint.");
391
- t.setItem(Xr, JSON.stringify({ ...Zr(t), [e]: !0 }));
390
+ if (!Xr.includes(e)) throw new Error("Unknown device hint.");
391
+ t.setItem(Zr, JSON.stringify({ ...ea(t), [e]: !0 }));
392
392
  }
393
- function rr(t, e, n, i) {
393
+ function ar(t, e, n, i) {
394
394
  if (n.authorityId !== t.account.authority?.authorityId || n.generation !== t.account.authority.generation) return t;
395
395
  const s = {};
396
396
  let o = t.interactions.openingGeneration;
@@ -465,7 +465,7 @@ const $d = {
465
465
  read_hosted_browser_eligibility: "canReadHostedBrowserEligibility",
466
466
  manage_interactions: "canManageInteractions",
467
467
  invoke_conversation_action: "canInvokeConversationActions"
468
- }, ea = {
468
+ }, ta = {
469
469
  canConnect: !0,
470
470
  canRenderConversation: !0,
471
471
  canShowPersonalFeatures: !0,
@@ -512,7 +512,7 @@ const $d = {
512
512
  canManageInteractions: !0,
513
513
  canInvokeConversationActions: !0
514
514
  }, Sh = {
515
- ...ea,
515
+ ...ta,
516
516
  canExecuteCurrentPageTools: !1,
517
517
  canManageTabs: !1,
518
518
  canUseSandboxFiles: !1,
@@ -568,8 +568,8 @@ const $d = {
568
568
  canManageInteractions: !0,
569
569
  canInvokeConversationActions: !0
570
570
  }, kh = {
571
- extension_sidepanel: ea,
572
- extension_widget: ea,
571
+ extension_sidepanel: ta,
572
+ extension_widget: ta,
573
573
  main_web_chat: Sh,
574
574
  embedded_widget: ll,
575
575
  embedded_custom_ui: ll
@@ -601,7 +601,7 @@ function Gt(t) {
601
601
  if (!e) throw new Error("Display timestamps must retain the backend UTC precision.");
602
602
  return `${e[1]}.${(e[2] ?? "").padEnd(6, "0")}`;
603
603
  }
604
- function Ys(t) {
604
+ function Xs(t) {
605
605
  return "revision" in t.data ? t.data.revision : null;
606
606
  }
607
607
  function Zt(t) {
@@ -629,7 +629,7 @@ function ni(t, e) {
629
629
  updatedAt: n ? t.updatedAt : null
630
630
  };
631
631
  }
632
- function ar(t, e) {
632
+ function cr(t, e) {
633
633
  return t.key !== e.key || t.requestId !== e.requestId ? t : {
634
634
  ...t,
635
635
  status: "ready",
@@ -652,7 +652,7 @@ function lt(t) {
652
652
  function Kd(t = "", e = 0) {
653
653
  return Ve({ authorityId: t, generation: e, pendingRestoration: {}, proactiveQuestions: {}, sessions: {}, submissions: {}, submissionOrder: [], stops: {}, requests: {}, requestSequence: 0, deliveries: {}, operations: {}, effectsEnabled: !1, durableSubmissionIds: [], pendingDurabilityIds: [], checkpointEffectId: null, checkpointError: null });
654
654
  }
655
- function ta(t) {
655
+ function na(t) {
656
656
  return {
657
657
  sessionId: t,
658
658
  items: {},
@@ -679,7 +679,7 @@ function Jt(t, e, n) {
679
679
  return te < ne ? -1 : te > ne ? 1 : C.id < U.id ? -1 : C.id > U.id ? 1 : 0;
680
680
  }), c = a.filter((C) => (!C.cancelled || C.conversationScopeId === n && (C.sessionId === null || C.sessionId === s || s === null && C === a[a.length - 1])) && !o?.items[C.userMessageId] && !o?.removedItems[C.userMessageId]), l = {};
681
681
  for (const C of r) {
682
- const U = Ys(C);
682
+ const U = Xs(C);
683
683
  if (U === null) continue;
684
684
  const te = o?.streams[C.id];
685
685
  l[C.id] = te ? te.state === "open" ? "open" : U < te.revision ? "awaiting_content" : te.state : "open";
@@ -773,7 +773,7 @@ function Gd(t) {
773
773
  function La(t) {
774
774
  if (!{ social_share: ["dismiss", "shared"], proactive_suggestion: ["not_now", "never"], morning_report: ["snooze"] }[t.category]?.some((n) => n === t.action)) throw new Error("Unsupported category action.");
775
775
  }
776
- function cr(t, e) {
776
+ function lr(t, e) {
777
777
  const n = { ...t.decisions };
778
778
  for (const i of e) {
779
779
  if (La(i.request), i.decisionKey !== Gd(i.request)) throw new Error("Decision scope does not match its category.");
@@ -1122,13 +1122,13 @@ function Ph(t, e, n, i) {
1122
1122
  }
1123
1123
  return { state: s, effects: o };
1124
1124
  }
1125
- function na(t = null) {
1125
+ function ia(t = null) {
1126
1126
  return { authority: t, refusal: null, paidFallbackBySession: {}, query: Zt("account"), preferences: null };
1127
1127
  }
1128
1128
  function qh(t, e) {
1129
1129
  return t.preferences && e.preferencesVersion <= t.preferences.preferencesVersion ? t : { ...t, preferences: e };
1130
1130
  }
1131
- function ia() {
1131
+ function sa() {
1132
1132
  return {
1133
1133
  promptActions: {},
1134
1134
  openings: {},
@@ -1156,7 +1156,7 @@ function ia() {
1156
1156
  deviceErrors: {}
1157
1157
  };
1158
1158
  }
1159
- function sa(t = 0) {
1159
+ function oa(t = 0) {
1160
1160
  return { suggestionReadFailures: 0, suggestionRetryAfter: null, localScribbleStyle: null, originContextQueries: {}, contextObservers: {}, contextReads: {}, contextRunOrigins: {}, appearanceEpochs: {}, appearanceQueries: {}, polls: {}, queries: {}, pending: {}, queuedPreferences: {}, desiredPreferences: {}, refreshBatch: null, refreshQueuedRequestId: null, refreshAt: null, failures: 0, now: t, timerId: null, timerDeadline: null, timerRevision: 0, refreshRequired: !1, schedulerError: null, deepFlows: {} };
1161
1161
  }
1162
1162
  function yt(t, e) {
@@ -1223,7 +1223,7 @@ function pl(t) {
1223
1223
  function Mn(t, e, n) {
1224
1224
  return JSON.stringify(["stage7", t.authorityId, t.generation, e, n]);
1225
1225
  }
1226
- function oa(t, e, n) {
1226
+ function ra(t, e, n) {
1227
1227
  let i = t;
1228
1228
  const s = [], o = (m) => {
1229
1229
  i = { ...i, features: { ...i.features, ...m } };
@@ -1232,12 +1232,12 @@ function oa(t, e, n) {
1232
1232
  };
1233
1233
  if (e.type === "stage7.initialize") {
1234
1234
  const m = i.account.authority;
1235
- return m && JSON.stringify(m) === JSON.stringify(e.authority) ? { state: i, effects: s } : { state: { account: na(e.authority), features: sa(e.now), interactions: ia() }, effects: s };
1235
+ return m && JSON.stringify(m) === JSON.stringify(e.authority) ? { state: i, effects: s } : { state: { account: ia(e.authority), features: oa(e.now), interactions: sa() }, effects: s };
1236
1236
  }
1237
1237
  const r = i.account.authority;
1238
1238
  if (!r) return { state: i, effects: s };
1239
1239
  if ("authority" in e && JSON.stringify(e.authority) !== JSON.stringify(r)) return { state: i, effects: s };
1240
- if (e.type === "stage7.retire") return { state: { account: na(), features: sa(e.now), interactions: ia() }, effects: s };
1240
+ if (e.type === "stage7.retire") return { state: { account: ia(), features: oa(e.now), interactions: sa() }, effects: s };
1241
1241
  "now" in e && o({ now: e.now });
1242
1242
  const c = (m, w) => {
1243
1243
  const I = { ...i.features.contextObservers }, E = I[m];
@@ -1261,7 +1261,7 @@ function oa(t, e, n) {
1261
1261
  if (e.type === "stage7.act" || e.type === "stage7.retry_action" || (e.type === "effect.completed" || e.type === "effect.failed") && e.effectKind === "stage7.platform") {
1262
1262
  const m = Th(i, e, n.conversation, n.directory);
1263
1263
  if (!m.command) return { state: m.state, effects: m.effects };
1264
- const w = oa(m.state, m.command, n);
1264
+ const w = ra(m.state, m.command, n);
1265
1265
  return { state: w.state, effects: [...m.effects, ...w.effects] };
1266
1266
  }
1267
1267
  const u = (m, w, I) => {
@@ -1292,7 +1292,7 @@ function oa(t, e, n) {
1292
1292
  const E = m.kind === "preferencePrompts" ? m.value[I] : m.feature === I ? m.value : null;
1293
1293
  E && E.revision > i.interactions.preferencePrompts[I].revision && d(I, E.requestId);
1294
1294
  }
1295
- m.kind === "preferences" && (i = { ...i, account: qh(i.account, m.value) }), m.kind === "preferencePrompts" && (i = { ...i, interactions: dl(i.interactions, m.value) }), m.kind === "preferencePrompt" && (i = { ...i, interactions: dl(i.interactions, { ...i.interactions.preferencePrompts, [m.feature]: m.value }) }), m.kind === "decisions" && (i = { ...i, interactions: cr(i.interactions, m.decisions) }), m.kind === "decision" && (i = { ...i, interactions: cr(i.interactions, [m.value]) });
1295
+ m.kind === "preferences" && (i = { ...i, account: qh(i.account, m.value) }), m.kind === "preferencePrompts" && (i = { ...i, interactions: dl(i.interactions, m.value) }), m.kind === "preferencePrompt" && (i = { ...i, interactions: dl(i.interactions, { ...i.interactions.preferencePrompts, [m.feature]: m.value }) }), m.kind === "decisions" && (i = { ...i, interactions: lr(i.interactions, m.decisions) }), m.kind === "decision" && (i = { ...i, interactions: lr(i.interactions, [m.value]) });
1296
1296
  }, f = (m, w) => {
1297
1297
  const I = i.interactions.deviceFacts[m];
1298
1298
  if (!(w.revision <= I.revision) && ((Ns(i, m) === !0 || i.features.desiredPreferences[m] === !0) && (w.permission === "granted" && I.permission !== "granted" || w.snoozedUntil && w.snoozedUntil !== I.snoozedUntil) && d(m, null), a({ deviceFacts: { ...i.interactions.deviceFacts, [m]: w } }), i.features.desiredPreferences[m] === !0 && Ns(i, m) !== !0)) {
@@ -1436,7 +1436,7 @@ function oa(t, e, n) {
1436
1436
  }
1437
1437
  break;
1438
1438
  case "stage7.observe_work":
1439
- i = rr(i, n.conversation, n.directory, e.now);
1439
+ i = ar(i, n.conversation, n.directory, e.now);
1440
1440
  break;
1441
1441
  case "stage7.bridge_ready":
1442
1442
  a({ bridgeReady: e.ready, bridgeError: e.ready ? null : e.error ?? null });
@@ -1451,7 +1451,7 @@ function oa(t, e, n) {
1451
1451
  const m = n.directory.clients[e.clientScopeId];
1452
1452
  if (!m) break;
1453
1453
  const w = { ...i.interactions.openings };
1454
- e.open || delete w[m], a({ openings: w, closedScopes: { ...i.interactions.closedScopes, [m]: !e.open } }), i = rr(i, n.conversation, n.directory, e.now);
1454
+ e.open || delete w[m], a({ openings: w, closedScopes: { ...i.interactions.closedScopes, [m]: !e.open } }), i = ar(i, n.conversation, n.directory, e.now);
1455
1455
  break;
1456
1456
  }
1457
1457
  case "stage7.prompt_shown": {
@@ -1486,7 +1486,7 @@ function oa(t, e, n) {
1486
1486
  break;
1487
1487
  case "stage7.import_legacy_decisions":
1488
1488
  if (!r.profile.startsWith("extension_") || e.decisions.some((m) => m.revision !== 0)) throw new Error("Invalid legacy decision import.");
1489
- i = { ...i, interactions: cr(i.interactions, e.decisions) };
1489
+ i = { ...i, interactions: lr(i.interactions, e.decisions) };
1490
1490
  break;
1491
1491
  case "stage7.device_hints": {
1492
1492
  if (r.profile !== "main_web_chat") throw new Error("Main-web hints unavailable.");
@@ -1549,7 +1549,7 @@ function oa(t, e, n) {
1549
1549
  if (e.effectKind === "stage7.wait") {
1550
1550
  if (e.effectId !== i.features.timerId) break;
1551
1551
  if (o({ timerId: null, timerDeadline: null, schedulerError: e.type === "effect.failed" ? e.error : null }), e.type === "effect.completed") {
1552
- o({ now: e.output.now }), i = rr(i, n.conversation, n.directory, e.output.now);
1552
+ o({ now: e.output.now }), i = ar(i, n.conversation, n.directory, e.output.now);
1553
1553
  for (const [I, E] of Object.entries(i.features.polls)) {
1554
1554
  if (E.deadline > e.output.now) continue;
1555
1555
  Object.values(i.features.pending).some((k) => k.mode === "query" && k.key === I && k.status === "pending") || y(E.query.kind === "originContext" ? { ...E.query, trigger: "poll" } : E.query, `poll:${I}:${e.output.now}`, !0);
@@ -1597,7 +1597,7 @@ function oa(t, e, n) {
1597
1597
  o({ queries: { ...i.features.queries, [m.key]: Ss(E, { key: m.key, requestId: Ct(m.requestId), error: e.error }) } }), m.operation.kind === "account" && (i = { ...i, account: { ...i.account, query: Ss(i.account.query, { key: m.key, requestId: Ct(m.requestId), error: e.error }) } });
1598
1598
  else {
1599
1599
  if (e.output.data.kind !== m.operation.kind) throw new Error("Feature response kind does not match the query.");
1600
- o({ now: e.output.completedAt, queries: { ...i.features.queries, [m.key]: ar(E, { key: m.key, requestId: Ct(m.requestId), data: e.output.data, cursor: null, updatedAt: e.output.completedAt }) } }), p(e.output.data, m.requestId), e.output.data.kind === "account" && (i = { ...i, account: { ...i.account, refusal: null, query: ar(i.account.query, { key: m.key, requestId: Ct(m.requestId), data: e.output.data.value, cursor: null, updatedAt: e.output.completedAt }) } });
1600
+ o({ now: e.output.completedAt, queries: { ...i.features.queries, [m.key]: cr(E, { key: m.key, requestId: Ct(m.requestId), data: e.output.data, cursor: null, updatedAt: e.output.completedAt }) } }), p(e.output.data, m.requestId), e.output.data.kind === "account" && (i = { ...i, account: { ...i.account, refusal: null, query: cr(i.account.query, { key: m.key, requestId: Ct(m.requestId), data: e.output.data.value, cursor: null, updatedAt: e.output.completedAt }) } });
1601
1601
  }
1602
1602
  } else if (!w)
1603
1603
  o({ now: e.output.completedAt }), p(e.output.data, m.requestId);
@@ -1622,7 +1622,7 @@ function oa(t, e, n) {
1622
1622
  }
1623
1623
  if (_(e.effectId, w), m.operation.kind === "generatePrompts") {
1624
1624
  const I = { kind: "starterPrompts", ...m.operation.page, includeUserSuggestions: m.operation.includeUserSuggestions ?? !1 }, E = yt(r, I), T = i.features.queries[E];
1625
- T?.requestId === m.requestId && o({ queries: { ...i.features.queries, [E]: w ? Ss(T, { key: E, requestId: Ct(m.requestId), error: e.error }) : ar(T, { key: E, requestId: Ct(m.requestId), data: e.output.data, cursor: null, updatedAt: e.output.completedAt }) } });
1625
+ T?.requestId === m.requestId && o({ queries: { ...i.features.queries, [E]: w ? Ss(T, { key: E, requestId: Ct(m.requestId), error: e.error }) : cr(T, { key: E, requestId: Ct(m.requestId), data: e.output.data, cursor: null, updatedAt: e.output.completedAt }) } });
1626
1626
  }
1627
1627
  if (!w && e.output.data.kind === "originContext") {
1628
1628
  const I = e.output.data, E = m.operation.kind === "originContext" || m.operation.kind === "refreshContext" ? m.operation.origin : null;
@@ -1719,11 +1719,11 @@ function oa(t, e, n) {
1719
1719
  }
1720
1720
  return { state: i, effects: s };
1721
1721
  }
1722
- function Xs(t, e) {
1722
+ function Zs(t, e) {
1723
1723
  return t.account.authority ? t.features.queries[yt(t.account.authority, e)] ?? null : null;
1724
1724
  }
1725
1725
  function Oh(t, e) {
1726
- const n = Xs(t, e);
1726
+ const n = Zs(t, e);
1727
1727
  return n?.status === "loading" || n?.status === "refreshing" || !!(t.account.authority && t.features.polls[yt(t.account.authority, e)]);
1728
1728
  }
1729
1729
  const Dh = {
@@ -1843,14 +1843,14 @@ function oi(t) {
1843
1843
  if (typeof t != "boolean") throw new Error("Invalid feature response boolean.");
1844
1844
  return t;
1845
1845
  }
1846
- function lr(t) {
1846
+ function dr(t) {
1847
1847
  return t === null ? null : oi(t);
1848
1848
  }
1849
1849
  function Us(t) {
1850
1850
  if (!Array.isArray(t)) throw new Error("Invalid feature string list.");
1851
1851
  return t.map(ae);
1852
1852
  }
1853
- function Zs(t) {
1853
+ function eo(t) {
1854
1854
  const e = Tt(t);
1855
1855
  if (e !== null && !Number.isFinite(Date.parse(e))) throw new Error("Invalid feature deadline.");
1856
1856
  return e;
@@ -1858,31 +1858,31 @@ function Zs(t) {
1858
1858
  function Oi(t) {
1859
1859
  const e = me(t);
1860
1860
  return {
1861
- taskNotificationsEnabled: lr(e.taskNotificationsEnabled),
1862
- tabGroupingEnabled: lr(e.tabGroupingEnabled),
1861
+ taskNotificationsEnabled: dr(e.taskNotificationsEnabled),
1862
+ tabGroupingEnabled: dr(e.tabGroupingEnabled),
1863
1863
  preferencesVersion: Wn(e.preferencesVersion),
1864
- scribbleStyleEnabled: lr(e.scribbleStyleEnabled),
1864
+ scribbleStyleEnabled: dr(e.scribbleStyleEnabled),
1865
1865
  blockedOrigins: Us(e.blockedServiceOrigins),
1866
1866
  personalInstructions: Tt(e.personalInstructions),
1867
1867
  securityPolicyVersion: Wn(e.securityPolicyVersion)
1868
1868
  };
1869
1869
  }
1870
- function eo(t) {
1870
+ function to(t) {
1871
1871
  const e = me(t);
1872
- return { eligibleSince: Zs(e.eligibleSince), revision: Wn(e.revision), requestId: Tt(e.requestId), snoozedUntil: Zs(e.snoozedUntil) };
1872
+ return { eligibleSince: eo(e.eligibleSince), revision: Wn(e.revision), requestId: Tt(e.requestId), snoozedUntil: eo(e.snoozedUntil) };
1873
1873
  }
1874
1874
  function Nh(t) {
1875
1875
  const e = me(t);
1876
- return { notifications: eo(e.notifications), tab_grouping: eo(e.tabGrouping) };
1876
+ return { notifications: to(e.notifications), tab_grouping: to(e.tabGrouping) };
1877
1877
  }
1878
1878
  function hl(t) {
1879
1879
  const e = me(t), n = me(e.request), i = ae(n.category), s = ae(n.action), o = { category: i, action: s, promptKey: ae(n.promptKey), expectedRevision: Wn(n.expectedRevision) };
1880
1880
  La(o);
1881
1881
  const a = ae(e.outcome);
1882
1882
  if (!["resolved", "snoozed", "suppressed"].includes(a)) throw new Error("Invalid decision outcome.");
1883
- const r = Zs(e.decidedAt);
1883
+ const r = eo(e.decidedAt);
1884
1884
  if (r === null) throw new Error("Missing decision acceptance time.");
1885
- const c = Zs(e.nextEligibleAt);
1885
+ const c = eo(e.nextEligibleAt);
1886
1886
  if (a === "snoozed" && c === null) throw new Error("Missing decision deadline.");
1887
1887
  return {
1888
1888
  decisionKey: ae(e.decisionKey),
@@ -1893,7 +1893,7 @@ function hl(t) {
1893
1893
  nextEligibleAt: c
1894
1894
  };
1895
1895
  }
1896
- function dr(t) {
1896
+ function ur(t) {
1897
1897
  const e = me(t);
1898
1898
  return {
1899
1899
  eventTypeRegex: ae(e.eventTypeRegex),
@@ -1906,14 +1906,14 @@ function dr(t) {
1906
1906
  function Uh(t) {
1907
1907
  const e = me(t), n = me(e.condition), i = { id: ae(e.id), suggestedQuery: ae(e.suggestedQuery) };
1908
1908
  if (n.template === "page_visit") return { ...i, condition: { template: n.template, urlRegex: ae(n.urlRegex) } };
1909
- if (n.template === "semantic_interaction") return { ...i, condition: { template: n.template, event: dr(n.event) } };
1909
+ if (n.template === "semantic_interaction") return { ...i, condition: { template: n.template, event: ur(n.event) } };
1910
1910
  if (n.template === "event_sequence") {
1911
1911
  if (!Array.isArray(n.steps)) throw new Error("Invalid proactive sequence.");
1912
- return { ...i, condition: { template: n.template, steps: n.steps.map(dr), withinSeconds: Wn(n.withinSeconds) } };
1912
+ return { ...i, condition: { template: n.template, steps: n.steps.map(ur), withinSeconds: Wn(n.withinSeconds) } };
1913
1913
  }
1914
1914
  if (n.template === "page_state_after_event") {
1915
1915
  const s = me(n.state);
1916
- return { ...i, condition: { template: n.template, event: dr(n.event), withinSeconds: Wn(n.withinSeconds), state: {
1916
+ return { ...i, condition: { template: n.template, event: ur(n.event), withinSeconds: Wn(n.withinSeconds), state: {
1917
1917
  urlRegex: ae(s.urlRegex),
1918
1918
  ...s.textRegex == null ? {} : { textRegex: ae(s.textRegex) },
1919
1919
  ...s.roleRegex == null ? {} : { roleRegex: ae(s.roleRegex) },
@@ -1949,7 +1949,7 @@ function xs(t) {
1949
1949
  if (!oi(e.success)) throw new Error(Tt(e.message) ?? "Failed to submit feedback");
1950
1950
  return { kind: "ack", success: !0 };
1951
1951
  }
1952
- function ur(t) {
1952
+ function pr(t) {
1953
1953
  const e = t.page;
1954
1954
  return {
1955
1955
  community_id: t.communityId,
@@ -2055,20 +2055,20 @@ function zh(t) {
2055
2055
  c = { kind: "preferences", value: Oi(await r("/preferences", { blocked_service_origins: s.origins, security_policy_version: s.expectedSecurityVersion }, "PATCH")) };
2056
2056
  break;
2057
2057
  case "preferenceAcknowledge":
2058
- c = { kind: "preferencePrompt", feature: s.feature, value: eo(await r(`/preference-prompts/${s.feature}/acknowledge`, { request_id: o, expected_revision: s.expectedRevision, action: s.action })) };
2058
+ c = { kind: "preferencePrompt", feature: s.feature, value: to(await r(`/preference-prompts/${s.feature}/acknowledge`, { request_id: o, expected_revision: s.expectedRevision, action: s.action })) };
2059
2059
  break;
2060
2060
  case "preferenceSnooze":
2061
- c = { kind: "preferencePrompt", feature: s.feature, value: eo(await r(`/preference-prompts/${s.feature}/snooze`, { request_id: o, expected_revision: s.expectedRevision })) };
2061
+ c = { kind: "preferencePrompt", feature: s.feature, value: to(await r(`/preference-prompts/${s.feature}/snooze`, { request_id: o, expected_revision: s.expectedRevision })) };
2062
2062
  break;
2063
2063
  case "decision":
2064
2064
  c = { kind: "decision", value: hl(await r("/interaction-decisions", { category: s.category, prompt_key: s.promptKey, action: s.action, request_id: o, expected_revision: s.expectedRevision })) };
2065
2065
  break;
2066
2066
  case "feedback":
2067
- c = xs(a ? { success: await t.embedded.feedback(s.message) } : await r("/feedback", { ...ur(s.context), feedback_type: "general", message: s.message }));
2067
+ c = xs(a ? { success: await t.embedded.feedback(s.message) } : await r("/feedback", { ...pr(s.context), feedback_type: "general", message: s.message }));
2068
2068
  break;
2069
2069
  case "proactiveFeedback":
2070
2070
  c = xs(await r("/feedback", {
2071
- ...ur(s.context),
2071
+ ...pr(s.context),
2072
2072
  feedback_type: "proactive_suggestion",
2073
2073
  proactive_suggestion_action: "feedback",
2074
2074
  proactive_suggestion_id: s.suggestionId,
@@ -2081,7 +2081,7 @@ function zh(t) {
2081
2081
  c = xs(await r("/feedback/target", { feedback_type: "target_rating", target_id: s.targetId, rating: s.rating, ...s.comment === void 0 ? {} : { comment: s.comment } }));
2082
2082
  break;
2083
2083
  case "report":
2084
- c = xs(await r("/feedback", { ...ur(s.context), feedback_type: "chat_report", session_id: s.sessionId, message: s.message, ui_evidence: s.uiEvidence, widget_evidence_available: s.widgetEvidenceAvailable }));
2084
+ c = xs(await r("/feedback", { ...pr(s.context), feedback_type: "chat_report", session_id: s.sessionId, message: s.message, ui_evidence: s.uiEvidence, widget_evidence_available: s.widgetEvidenceAvailable }));
2085
2085
  break;
2086
2086
  case "generatePrompts": {
2087
2087
  const l = me(await r("/starter-prompts", { page_url: s.page.pageUrl, html_content: s.htmlContent, page_title: s.pageTitle }, "POST", a ? {} : { origin: s.page.origin, include_user_suggestions: s.includeUserSuggestions ?? !1 }));
@@ -2157,7 +2157,7 @@ function jh(t, e) {
2157
2157
  async function Fh(t, e, n) {
2158
2158
  await t.engine.dispatch({ type: "stage7.initialize", authority: e, now: n }), await t.engine.dispatch({ type: "stage7.reconcile", authority: e, now: n, requestId: crypto.randomUUID(), reason: "startup" });
2159
2159
  }
2160
- function pr(t, e, n = {}) {
2160
+ function hr(t, e, n = {}) {
2161
2161
  return Xd(t, { type: "stage7.query", query: e, force: n.force });
2162
2162
  }
2163
2163
  function $h(t, e, n) {
@@ -2186,7 +2186,7 @@ function Xd(t, e, n) {
2186
2186
  }
2187
2187
  const g = Object.values(y.features.pending).find((b) => b.requestId === o);
2188
2188
  if (!g && e.type === "stage7.query") {
2189
- const b = Xs(y, e.query);
2189
+ const b = Zs(y, e.query);
2190
2190
  b?.status === "error" ? p(b.error) : b?.status === "ready" && b.data && p(null, b.data);
2191
2191
  }
2192
2192
  g?.status === "error" ? p(g.error) : g?.status === "done" && p(null, g.result);
@@ -2296,22 +2296,22 @@ function Vh(t, e = null) {
2296
2296
  return { ...i, ...r ? { auth: r } : {}, submissionGate: a, usingPaidCreditFallback: e ? t.paidFallbackBySession[e] ?? !1 : !1 };
2297
2297
  }
2298
2298
  const Zd = (t) => t.selectedModel ?? t.historyModel ?? t.defaultModel, Gh = (t, e) => t.scopes[e];
2299
- function ho(t) {
2299
+ function go(t) {
2300
2300
  if (!Number.isSafeInteger(t) || t < 0) throw new Error("Invalid conversation revision.");
2301
2301
  }
2302
- function ra(t, e) {
2302
+ function aa(t, e) {
2303
2303
  if (e.conversation_id !== t.sessionId) throw new Error("Display item belongs to another conversation.");
2304
2304
  if (t.removedItems[e.id]) return t;
2305
2305
  const n = Gt(e.created_at);
2306
2306
  Gt(e.updated_at);
2307
- const i = Ys(e);
2308
- i !== null && ho(i);
2307
+ const i = Xs(e);
2308
+ i !== null && go(i);
2309
2309
  const s = t.streams[e.id];
2310
2310
  if (i !== null && s && (s.state === "stopped" || s.state === "finished") && i > s.revision) return t;
2311
2311
  const o = t.items[e.id];
2312
2312
  if (o) {
2313
2313
  if (Gt(o.created_at) !== n) throw new Error("Display shell timestamp changed.");
2314
- const a = Ys(o);
2314
+ const a = Xs(o);
2315
2315
  if (a !== null && i !== null) {
2316
2316
  if (i <= a) return t;
2317
2317
  } else if (Gt(e.updated_at) <= Gt(o.updated_at)) return t;
@@ -2319,13 +2319,13 @@ function ra(t, e) {
2319
2319
  return { ...t, items: { ...t.items, [e.id]: { ...e, created_at: o?.created_at ?? e.created_at } } };
2320
2320
  }
2321
2321
  function eu(t, e) {
2322
- if (ho(e.revision), t.removedItems[e.item_id]) return t;
2322
+ if (go(e.revision), t.removedItems[e.item_id]) return t;
2323
2323
  const n = t.streams[e.item_id];
2324
2324
  return n && (n.state === "stopped" || e.revision < n.revision || n.state !== "open" && (e.state === "open" || e.revision === n.revision) || n.state === e.state && n.revision === e.revision) ? t : { ...t, streams: { ...t.streams, [e.item_id]: e } };
2325
2325
  }
2326
- function aa(t, e) {
2326
+ function ca(t, e) {
2327
2327
  if (e.conversation_id !== t.sessionId) throw new Error("Execution belongs to another conversation.");
2328
- if (ho(e.version), t.execution && e.version <= t.execution.version) return t;
2328
+ if (go(e.version), t.execution && e.version <= t.execution.version) return t;
2329
2329
  const n = { ...t.executionByUserMessage };
2330
2330
  for (const i of Pt(e)) n[i] = {
2331
2331
  version: e.version,
@@ -2337,23 +2337,23 @@ function aa(t, e) {
2337
2337
  function Jh(t) {
2338
2338
  const e = /* @__PURE__ */ new Set();
2339
2339
  for (const n of Object.values(t.items)) {
2340
- const i = Ys(n), s = t.streams[n.id];
2340
+ const i = Xs(n), s = t.streams[n.id];
2341
2341
  i !== null && (!s || s.state === "open" || i < s.revision) && e.add(n.id);
2342
2342
  }
2343
2343
  for (const n of [...Object.keys(t.streams), ...Object.values(t.removedItems)])
2344
2344
  !t.items[n] && !t.removedItems[n] && e.add(n);
2345
2345
  return [...e];
2346
2346
  }
2347
- function hr(t, e) {
2347
+ function gr(t, e) {
2348
2348
  switch (e.type) {
2349
2349
  case "conversation.interaction.updated":
2350
2350
  return t;
2351
2351
  case "conversation.follow_ups.updated":
2352
- return ho(e.version), e.version > t.followUpsVersion ? { ...t, followUps: e.follow_ups, followUpsVersion: e.version } : t;
2352
+ return go(e.version), e.version > t.followUpsVersion ? { ...t, followUps: e.follow_ups, followUpsVersion: e.version } : t;
2353
2353
  case "conversation.item.updated":
2354
- return ra(t, e.item);
2354
+ return aa(t, e.item);
2355
2355
  case "conversation.execution.updated":
2356
- return aa(t, e.execution);
2356
+ return ca(t, e.execution);
2357
2357
  case "conversation.item.stream_finished":
2358
2358
  if (e.conversation_id !== t.sessionId) throw new Error("Stream belongs to another conversation.");
2359
2359
  return eu(t, { item_id: e.item_id, revision: e.revision, state: e.state });
@@ -2367,20 +2367,20 @@ function hr(t, e) {
2367
2367
  }
2368
2368
  }
2369
2369
  }
2370
- function ca(t, e, n) {
2370
+ function la(t, e, n) {
2371
2371
  const i = { ...t.submissions };
2372
2372
  for (const s of Object.values(i))
2373
2373
  if (s.conversationScopeId === e.conversationScopeId && !((s.cancelled || e.cancelled) && s.userMessageId !== e.userMessageId)) {
2374
2374
  if (s.sessionId !== null && s.sessionId !== n) throw new Error("Submission scope accepted into conflicting conversations.");
2375
2375
  i[s.userMessageId] = { ...s, sessionId: n };
2376
2376
  }
2377
- return { ...t, submissions: i, sessions: { ...t.sessions, [n]: t.sessions[n] ?? ta(n) } };
2377
+ return { ...t, submissions: i, sessions: { ...t.sessions, [n]: t.sessions[n] ?? na(n) } };
2378
2378
  }
2379
- function la(t, e) {
2379
+ function da(t, e) {
2380
2380
  const n = e.clients[t.clientScopeId];
2381
2381
  return n === t.conversationScopeId || n === void 0 && t.sessionId !== null && (e.memberships[t.sessionId]?.members.length ?? 0) > 0;
2382
2382
  }
2383
- function da(t, e, n = !1) {
2383
+ function ua(t, e, n = !1) {
2384
2384
  if (t.authorityId !== (e.authorityId ?? "") || t.generation !== e.generation) {
2385
2385
  const o = Kd(e.authorityId ?? void 0, e.generation);
2386
2386
  if (!n || t.authorityId) return o;
@@ -2397,9 +2397,9 @@ function da(t, e, n = !1) {
2397
2397
  let s = Object.keys(i).length === Object.keys(t.pendingRestoration).length ? t : { ...t, pendingRestoration: i };
2398
2398
  for (const o of Object.values(t.submissions)) {
2399
2399
  if (s.pendingRestoration[o.clientScopeId] === o.conversationScopeId) continue;
2400
- o.delivery !== "accepted" && !o.cancelled && !la(o, e) && (s = { ...s, submissions: { ...s.submissions, [o.userMessageId]: { ...o, cancelled: !0, cancellationReason: o.cancellationReason ?? "owner_lost" } } });
2400
+ o.delivery !== "accepted" && !o.cancelled && !da(o, e) && (s = { ...s, submissions: { ...s.submissions, [o.userMessageId]: { ...o, cancelled: !0, cancellationReason: o.cancellationReason ?? "owner_lost" } } });
2401
2401
  const a = e.selections[o.conversationScopeId]?.sessionId;
2402
- a && !s.submissions[o.userMessageId].cancelled && o.sessionId === null && (s = ca(s, s.submissions[o.userMessageId], a));
2402
+ a && !s.submissions[o.userMessageId].cancelled && o.sessionId === null && (s = la(s, s.submissions[o.userMessageId], a));
2403
2403
  }
2404
2404
  for (const [o, a] of Object.entries(s.requests)) {
2405
2405
  if ((e.memberships[a.sessionId]?.members.length ?? 0) > 0) continue;
@@ -2440,8 +2440,8 @@ function Qh(t, e, n, i) {
2440
2440
  let f = t.submissions;
2441
2441
  if (e.type === "effect.completed" && e.output.snapshot.conversation_id !== r.sessionId) throw new Error("Snapshot belongs to another conversation.");
2442
2442
  if (e.type === "effect.completed" && !e.output.snapshot.projection_ready && (e.output.snapshot.preparation === "pending" || e.output.snapshot.preparation === "busy")) {
2443
- for (const y of e.output.snapshot.items) y.type === "user_message" && (c = ra(c, y));
2444
- c = aa(c, e.output.snapshot.execution), c = {
2443
+ for (const y of e.output.snapshot.items) y.type === "user_message" && (c = aa(c, y));
2444
+ c = ca(c, e.output.snapshot.execution), c = {
2445
2445
  ...c,
2446
2446
  ...r.lane === "current" ? { preparation: e.output.snapshot.preparation } : {},
2447
2447
  queries: { ...c.queries, [r.lane]: { ...l, status: "loading", requestId: null, error: null } }
@@ -2458,10 +2458,10 @@ function Qh(t, e, n, i) {
2458
2458
  r.lane === "current" && (c = { ...c, preparation: null });
2459
2459
  const g = c.queries.history, b = r.lane === "current" && (g.status === "not_requested" || y.next_cursor !== null && !c.items[y.next_cursor]);
2460
2460
  if (y.conversation_id !== r.sessionId) throw new Error("Snapshot belongs to another conversation.");
2461
- for (const _ of y.removed_items) c = hr(c, _);
2462
- for (const _ of y.items) c = ra(c, _);
2461
+ for (const _ of y.removed_items) c = gr(c, _);
2462
+ for (const _ of y.items) c = aa(c, _);
2463
2463
  for (const _ of y.streams) c = eu(c, _);
2464
- if (c = aa(c, y.execution), c = hr(c, {
2464
+ if (c = ca(c, y.execution), c = gr(c, {
2465
2465
  type: "conversation.follow_ups.updated",
2466
2466
  conversation_id: y.conversation_id,
2467
2467
  version: y.follow_ups_version,
@@ -2543,7 +2543,7 @@ function Qh(t, e, n, i) {
2543
2543
  case "conversation.submission_accepted": {
2544
2544
  const r = t.submissions[e.userMessageId];
2545
2545
  if (!r) return { state: t, effects: o };
2546
- s = ca(t, r, e.sessionId), s = { ...s, submissions: { ...s.submissions, [e.userMessageId]: { ...s.submissions[e.userMessageId], delivery: "accepted", error: null } } };
2546
+ s = la(t, r, e.sessionId), s = { ...s, submissions: { ...s.submissions, [e.userMessageId]: { ...s.submissions[e.userMessageId], delivery: "accepted", error: null } } };
2547
2547
  break;
2548
2548
  }
2549
2549
  case "conversation.submission_delivery": {
@@ -2569,14 +2569,14 @@ function Qh(t, e, n, i) {
2569
2569
  }
2570
2570
  case "conversation.display_received": {
2571
2571
  const r = lt(e.event), c = r.type === "conversation.item.updated" ? r.item.conversation_id : r.type === "conversation.execution.updated" ? r.execution.conversation_id : r.type === "conversation.interaction.updated" ? r.interaction.conversation_id : r.conversation_id, l = r.type === "conversation.item.updated" && r.item.type === "user_message" ? t.submissions[r.item.id] : void 0;
2572
- if (l && (s = ca(t, l, c)), !s.sessions[c] && !n.memberships[c]?.members.length && !l) return { state: t, effects: o };
2572
+ if (l && (s = la(t, l, c)), !s.sessions[c] && !n.memberships[c]?.members.length && !l) return { state: t, effects: o };
2573
2573
  n.memberships[c]?.members.length && (r.type === "conversation.interaction.updated" || r.type === "conversation.execution.updated" || r.type === "conversation.item.updated" && r.item.type === "user_message") && (a = {
2574
2574
  authorityId: t.authorityId,
2575
2575
  generation: t.generation,
2576
2576
  sessionId: c,
2577
2577
  sources: r.type === "conversation.interaction.updated" ? [r.interaction] : []
2578
2578
  });
2579
- const u = s.sessions[c] ?? ta(c), d = hr(u, r);
2579
+ const u = s.sessions[c] ?? na(c), d = gr(u, r);
2580
2580
  d !== u && (s = { ...s, sessions: { ...s.sessions, [c]: d } });
2581
2581
  break;
2582
2582
  }
@@ -2595,7 +2595,7 @@ function Qh(t, e, n, i) {
2595
2595
  }
2596
2596
  case "conversation.snapshot": {
2597
2597
  if (!n.memberships[e.sessionId]?.members.length) return { state: t, effects: o };
2598
- const r = t.sessions[e.sessionId] ?? ta(e.sessionId), c = r.queries[e.lane];
2598
+ const r = t.sessions[e.sessionId] ?? na(e.sessionId), c = r.queries[e.lane];
2599
2599
  if (c.requestId !== null) return { state: t, effects: o };
2600
2600
  const l = {
2601
2601
  authorityId: e.authorityId,
@@ -2682,7 +2682,7 @@ function mn(t, e) {
2682
2682
  const n = t.submissions[e], i = t.deliveries[e];
2683
2683
  return !n.cancelled || i?.step === "send" || i?.step === "receipt";
2684
2684
  }
2685
- function ua(t, e, n, i = !1) {
2685
+ function pa(t, e, n, i = !1) {
2686
2686
  if (!e.effectsEnabled || !i && t.submissions === e.submissions && t.deliveries === e.deliveries && t.operations === e.operations && t.stops === e.stops && t.sessions === e.sessions) return { state: e, effects: [] };
2687
2687
  const s = e.requestSequence + 1, o = `conversation:${e.generation}:${s}`, a = Ve({ ...e, requestSequence: s, checkpointEffectId: o });
2688
2688
  return { state: a, effects: [{ id: o, kind: "conversation.checkpoint", input: {
@@ -2691,7 +2691,7 @@ function ua(t, e, n, i = !1) {
2691
2691
  checkpoint: Na(a, n)
2692
2692
  } }] };
2693
2693
  }
2694
- function pa(t, e = null) {
2694
+ function ha(t, e = null) {
2695
2695
  return { command: lt(t), conversationScopeId: e, phase: "waiting", effectId: null, result: null, error: null };
2696
2696
  }
2697
2697
  function Yh(t) {
@@ -2703,7 +2703,7 @@ function fl(t, e) {
2703
2703
  throw new Error("Conversation acceptance receipt does not match the submitted message.");
2704
2704
  return { sessionId: t.sessionId, clientMessageId: e };
2705
2705
  }
2706
- function ha(t) {
2706
+ function ga(t) {
2707
2707
  let e = t;
2708
2708
  const n = [];
2709
2709
  if (!t.effectsEnabled || !t.authorityId) return { state: t, effects: n };
@@ -2767,7 +2767,7 @@ function ha(t) {
2767
2767
  const a = (r, c, l, u = "user_requested") => {
2768
2768
  if (e.operations[r]) return;
2769
2769
  const d = s();
2770
- e = { ...e, operations: { ...e.operations, [r]: pa({
2770
+ e = { ...e, operations: { ...e.operations, [r]: ha({
2771
2771
  request_id: d,
2772
2772
  type: "run.stop",
2773
2773
  payload: { sessionId: c, expectedUserMessageId: l, reason: u }
@@ -2893,7 +2893,7 @@ function Xh(t, e, n, i) {
2893
2893
  const y = e.output;
2894
2894
  y?.sessionId && (s = { ...s, operations: {
2895
2895
  ...s.operations,
2896
- [`cleanup:${p}`]: pa({
2896
+ [`cleanup:${p}`]: ha({
2897
2897
  request_id: `cleanup:${f.command.request_id}`,
2898
2898
  type: "session.reset",
2899
2899
  payload: {
@@ -2933,8 +2933,8 @@ function Xh(t, e, n, i) {
2933
2933
  submissions: Object.fromEntries(Object.entries(y.submissions).map(([m, w]) => [m, {
2934
2934
  ...w,
2935
2935
  executionVersion: null,
2936
- cancelled: w.cancelled || !x(w) && !la(w, n),
2937
- ...!w.cancelled && !x(w) && !la(w, n) ? { cancellationReason: "owner_lost" } : {},
2936
+ cancelled: w.cancelled || !x(w) && !da(w, n),
2937
+ ...!w.cancelled && !x(w) && !da(w, n) ? { cancellationReason: "owner_lost" } : {},
2938
2938
  delivery: (w.contextPreparation === null && !y.deliveries[m]?.handoffRecovery || !y.deliveries[m]) && !w.cancelled && w.delivery !== "accepted" ? "failed" : w.delivery === "sending" ? "uncertain" : w.delivery,
2939
2939
  error: w.contextPreparation === null && !y.deliveries[m]?.handoffRecovery && !w.cancelled && !["unauthorized", "auth_reconnecting"].includes(w.error?.code ?? "") ? { code: "context_preparation_interrupted", message: "Page context preparation was interrupted. Please send this message again.", retryable: !1 } : !y.deliveries[m] && w.delivery !== "accepted" && !w.cancelled ? { code: "submission_interrupted", message: "Message preparation was interrupted. Retry this message.", retryable: !0 } : w.error
2940
2940
  }])),
@@ -2962,7 +2962,7 @@ function Xh(t, e, n, i) {
2962
2962
  }
2963
2963
  if (e.type === "conversation.restoration_resolved") {
2964
2964
  const d = { ...s.pendingRestoration };
2965
- delete d[e.clientScopeId], s = da({ ...s, pendingRestoration: d }, n);
2965
+ delete d[e.clientScopeId], s = ua({ ...s, pendingRestoration: d }, n);
2966
2966
  }
2967
2967
  if (e.type === "conversation.recover" && (s = {
2968
2968
  ...t,
@@ -3026,7 +3026,7 @@ function Xh(t, e, n, i) {
3026
3026
  })) : t.stops;
3027
3027
  s = { ...t, stops: f, effectsEnabled: !0, operations: {
3028
3028
  ...t.operations,
3029
- [d.request_id]: pa(d, e.conversationScopeId ?? null)
3029
+ [d.request_id]: ha(d, e.conversationScopeId ?? null)
3030
3030
  } };
3031
3031
  }
3032
3032
  }
@@ -3077,7 +3077,7 @@ function Xh(t, e, n, i) {
3077
3077
  return p && !p.cancelled && !["accepted", "failed"].includes(p.delivery) && !r.durableSubmissionIds.includes(d);
3078
3078
  });
3079
3079
  c.length !== r.pendingDurabilityIds.length && (r = { ...r, pendingDurabilityIds: c });
3080
- const l = ha(r), u = ua(t, l.state, n, e.type === "conversation.recover" && t.checkpointError !== null);
3080
+ const l = ga(r), u = pa(t, l.state, n, e.type === "conversation.recover" && t.checkpointError !== null);
3081
3081
  return { state: u.state, effects: [...u.effects, ...a.effects, ...l.effects], interactionSources: a.interactionSources };
3082
3082
  }
3083
3083
  const Zh = [
@@ -3378,7 +3378,7 @@ function lg(t, e, n, i, s = {}) {
3378
3378
  requestId: fe(o?.httpRequest?.requestId ?? o?.errorRequestId ?? o?.queryRequestId),
3379
3379
  ...fe(o?.failedClientMessageId) ? { clientMessageId: o.failedClientMessageId } : {},
3380
3380
  code: o ? fe(t.lastErrorCode) : null,
3381
- ...po(o?.errorNormalization) ? { normalization: o.errorNormalization } : {},
3381
+ ...ho(o?.errorNormalization) ? { normalization: o.errorNormalization } : {},
3382
3382
  builds: { sdk: ci.version, ...s }
3383
3383
  };
3384
3384
  }
@@ -3483,7 +3483,7 @@ function gg(t, e) {
3483
3483
  }
3484
3484
  return { schema: 1, authorityId: t.authorityId, operations: t.operations, stops: t.stops, requestSequence: t.requestSequence, submissions: n, submissionOrder: Object.keys(n), deliveries: i };
3485
3485
  }
3486
- function gr(t) {
3486
+ function fr(t) {
3487
3487
  try {
3488
3488
  return window.sessionStorage.getItem(t);
3489
3489
  } catch (e) {
@@ -3570,7 +3570,7 @@ const zs = /* @__PURE__ */ Object.create(null);
3570
3570
  Object.keys(Nt).forEach((t) => {
3571
3571
  zs[Nt[t]] = t;
3572
3572
  });
3573
- const ga = { type: "error", data: "parser error" }, ou = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", ru = typeof ArrayBuffer == "function", au = (t) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(t) : t && t.buffer instanceof ArrayBuffer, Ba = ({ type: t, data: e }, n, i) => ou && e instanceof Blob ? n ? i(e) : yl(e, i) : ru && (e instanceof ArrayBuffer || au(e)) ? n ? i(e) : yl(new Blob([e]), i) : i(Nt[t] + (e || "")), yl = (t, e) => {
3573
+ const fa = { type: "error", data: "parser error" }, ou = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", ru = typeof ArrayBuffer == "function", au = (t) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(t) : t && t.buffer instanceof ArrayBuffer, Ba = ({ type: t, data: e }, n, i) => ou && e instanceof Blob ? n ? i(e) : yl(e, i) : ru && (e instanceof ArrayBuffer || au(e)) ? n ? i(e) : yl(new Blob([e]), i) : i(Nt[t] + (e || "")), yl = (t, e) => {
3574
3574
  const n = new FileReader();
3575
3575
  return n.onload = function() {
3576
3576
  const i = n.result.split(",")[1];
@@ -3580,14 +3580,14 @@ const ga = { type: "error", data: "parser error" }, ou = typeof Blob == "functio
3580
3580
  function bl(t) {
3581
3581
  return t instanceof Uint8Array ? t : t instanceof ArrayBuffer ? new Uint8Array(t) : new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
3582
3582
  }
3583
- let fr;
3583
+ let mr;
3584
3584
  function mg(t, e) {
3585
3585
  if (ou && t.data instanceof Blob)
3586
3586
  return t.data.arrayBuffer().then(bl).then(e);
3587
3587
  if (ru && (t.data instanceof ArrayBuffer || au(t.data)))
3588
3588
  return e(bl(t.data));
3589
3589
  Ba(t, !1, (n) => {
3590
- fr || (fr = new TextEncoder()), e(fr.encode(n));
3590
+ mr || (mr = new TextEncoder()), e(mr.encode(n));
3591
3591
  });
3592
3592
  }
3593
3593
  const wl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ki = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
@@ -3615,7 +3615,7 @@ const yg = (t) => {
3615
3615
  data: t.substring(1)
3616
3616
  } : {
3617
3617
  type: zs[n]
3618
- } : ga;
3618
+ } : fa;
3619
3619
  }, wg = (t, e) => {
3620
3620
  if (bg) {
3621
3621
  const n = yg(t);
@@ -3661,7 +3661,7 @@ function Ig() {
3661
3661
  }
3662
3662
  });
3663
3663
  }
3664
- let mr;
3664
+ let yr;
3665
3665
  function Cs(t) {
3666
3666
  return t.reduce((e, n) => e + n.length, 0);
3667
3667
  }
@@ -3675,7 +3675,7 @@ function As(t, e) {
3675
3675
  return t.length && i < t[0].length && (t[0] = t[0].slice(i)), n;
3676
3676
  }
3677
3677
  function Sg(t, e) {
3678
- mr || (mr = new TextDecoder());
3678
+ yr || (yr = new TextDecoder());
3679
3679
  const n = [];
3680
3680
  let i = 0, s = -1, o = !1;
3681
3681
  return new TransformStream({
@@ -3696,7 +3696,7 @@ function Sg(t, e) {
3696
3696
  break;
3697
3697
  const c = As(n, 8), l = new DataView(c.buffer, c.byteOffset, c.length), u = l.getUint32(0);
3698
3698
  if (u > Math.pow(2, 21) - 1) {
3699
- r.enqueue(ga);
3699
+ r.enqueue(fa);
3700
3700
  break;
3701
3701
  }
3702
3702
  s = u * Math.pow(2, 32) + l.getUint32(4), i = 3;
@@ -3704,10 +3704,10 @@ function Sg(t, e) {
3704
3704
  if (Cs(n) < s)
3705
3705
  break;
3706
3706
  const c = As(n, s);
3707
- r.enqueue(ja(o ? c : mr.decode(c), e)), i = 0;
3707
+ r.enqueue(ja(o ? c : yr.decode(c), e)), i = 0;
3708
3708
  }
3709
3709
  if (s === 0 || s > t) {
3710
- r.enqueue(ga);
3710
+ r.enqueue(fa);
3711
3711
  break;
3712
3712
  }
3713
3713
  }
@@ -3764,12 +3764,12 @@ Ce.prototype.listeners = function(t) {
3764
3764
  Ce.prototype.hasListeners = function(t) {
3765
3765
  return !!this.listeners(t).length;
3766
3766
  };
3767
- const go = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, n) => n(e, 0), _t = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), xg = "arraybuffer";
3767
+ const fo = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, n) => n(e, 0), _t = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), xg = "arraybuffer";
3768
3768
  function uu(t, ...e) {
3769
3769
  return e.reduce((n, i) => (t.hasOwnProperty(i) && (n[i] = t[i]), n), {});
3770
3770
  }
3771
3771
  const Eg = _t.setTimeout, Cg = _t.clearTimeout;
3772
- function fo(t, e) {
3772
+ function mo(t, e) {
3773
3773
  e.useNativeTimers ? (t.setTimeoutFn = Eg.bind(_t), t.clearTimeoutFn = Cg.bind(_t)) : (t.setTimeoutFn = _t.setTimeout.bind(_t), t.clearTimeoutFn = _t.clearTimeout.bind(_t));
3774
3774
  }
3775
3775
  const Ag = 1.33;
@@ -3812,7 +3812,7 @@ class Fa extends Ce {
3812
3812
  * @protected
3813
3813
  */
3814
3814
  constructor(e) {
3815
- super(), this.writable = !1, fo(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
3815
+ super(), this.writable = !1, mo(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
3816
3816
  }
3817
3817
  /**
3818
3818
  * Emits an error.
@@ -4052,7 +4052,7 @@ let ii = class Bs extends Ce {
4052
4052
  * @package
4053
4053
  */
4054
4054
  constructor(e, n, i) {
4055
- super(), this.createRequest = e, fo(this, i), this._opts = i, this._method = i.method || "GET", this._uri = n, this._data = i.data !== void 0 ? i.data : null, this._create();
4055
+ super(), this.createRequest = e, mo(this, i), this._opts = i, this._method = i.method || "GET", this._uri = n, this._data = i.data !== void 0 ? i.data : null, this._create();
4056
4056
  }
4057
4057
  /**
4058
4058
  * Creates the XHR object and sends the request.
@@ -4221,7 +4221,7 @@ class Bg extends Fa {
4221
4221
  this.doWrite(i, o);
4222
4222
  } catch {
4223
4223
  }
4224
- s && go(() => {
4224
+ s && fo(() => {
4225
4225
  this.writable = !0, this.emitReserved("drain");
4226
4226
  }, this.setTimeoutFn);
4227
4227
  });
@@ -4241,10 +4241,10 @@ class Bg extends Fa {
4241
4241
  return this.opts.timestampRequests && (n[this.opts.timestampParam] = pu()), this.supportsBinary || (n.b64 = 1), this.createUri(e, n);
4242
4242
  }
4243
4243
  }
4244
- const yr = _t.WebSocket || _t.MozWebSocket;
4244
+ const br = _t.WebSocket || _t.MozWebSocket;
4245
4245
  class jg extends Bg {
4246
4246
  createSocket(e, n, i) {
4247
- return fu ? new yr(e, n, i) : n ? new yr(e, n) : new yr(e);
4247
+ return fu ? new br(e, n, i) : n ? new br(e, n) : new br(e);
4248
4248
  }
4249
4249
  doWrite(e, n) {
4250
4250
  this.ws.send(n);
@@ -4285,7 +4285,7 @@ class Fg extends Fa {
4285
4285
  for (let n = 0; n < e.length; n++) {
4286
4286
  const i = e[n], s = n === e.length - 1;
4287
4287
  this._writer.write(i).then(() => {
4288
- s && go(() => {
4288
+ s && fo(() => {
4289
4289
  this.writable = !0, this.emitReserved("drain");
4290
4290
  }, this.setTimeoutFn);
4291
4291
  });
@@ -4316,7 +4316,7 @@ const $g = {
4316
4316
  "query",
4317
4317
  "anchor"
4318
4318
  ];
4319
- function fa(t) {
4319
+ function ma(t) {
4320
4320
  if (t.length > 8e3)
4321
4321
  throw "URI too long";
4322
4322
  const e = t, n = t.indexOf("["), i = t.indexOf("]");
@@ -4336,8 +4336,8 @@ function Vg(t, e) {
4336
4336
  s && (n[s] = o);
4337
4337
  }), n;
4338
4338
  }
4339
- const ma = typeof addEventListener == "function" && typeof removeEventListener == "function", js = [];
4340
- ma && addEventListener("offline", () => {
4339
+ const ya = typeof addEventListener == "function" && typeof removeEventListener == "function", js = [];
4340
+ ya && addEventListener("offline", () => {
4341
4341
  js.forEach((t) => t());
4342
4342
  }, !1);
4343
4343
  class yn extends Ce {
@@ -4349,10 +4349,10 @@ class yn extends Ce {
4349
4349
  */
4350
4350
  constructor(e, n) {
4351
4351
  if (super(), this.binaryType = xg, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (n = e, e = null), e) {
4352
- const i = fa(e);
4352
+ const i = ma(e);
4353
4353
  n.hostname = i.host, n.secure = i.protocol === "https" || i.protocol === "wss", n.port = i.port, i.query && (n.query = i.query);
4354
- } else n.host && (n.hostname = fa(n.host).host);
4355
- fo(this, n), this.secure = n.secure != null ? n.secure : typeof location < "u" && location.protocol === "https:", n.hostname && !n.port && (n.port = this.secure ? "443" : "80"), this.hostname = n.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = n.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, n.transports.forEach((i) => {
4354
+ } else n.host && (n.hostname = ma(n.host).host);
4355
+ mo(this, n), this.secure = n.secure != null ? n.secure : typeof location < "u" && location.protocol === "https:", n.hostname && !n.port && (n.port = this.secure ? "443" : "80"), this.hostname = n.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = n.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, n.transports.forEach((i) => {
4356
4356
  const s = i.prototype.name;
4357
4357
  this.transports.push(s), this._transportsByName[s] = i;
4358
4358
  }), this.opts = Object.assign({
@@ -4369,7 +4369,7 @@ class yn extends Ce {
4369
4369
  },
4370
4370
  transportOptions: {},
4371
4371
  closeOnBeforeunload: !1
4372
- }, n), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = qg(this.opts.query)), ma && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
4372
+ }, n), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = qg(this.opts.query)), ya && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
4373
4373
  this.transport && (this.transport.removeAllListeners(), this.transport.close());
4374
4374
  }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
4375
4375
  this._onClose("transport close", {
@@ -4524,7 +4524,7 @@ class yn extends Ce {
4524
4524
  if (!this._pingTimeoutTime)
4525
4525
  return !0;
4526
4526
  const e = Date.now() > this._pingTimeoutTime;
4527
- return e && (this._pingTimeoutTime = 0, go(() => {
4527
+ return e && (this._pingTimeoutTime = 0, fo(() => {
4528
4528
  this._onClose("ping timeout");
4529
4529
  }, this.setTimeoutFn)), e;
4530
4530
  }
@@ -4602,7 +4602,7 @@ class yn extends Ce {
4602
4602
  */
4603
4603
  _onClose(e, n) {
4604
4604
  if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
4605
- if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), ma && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
4605
+ if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), ya && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
4606
4606
  const i = js.indexOf(this._offlineEventListener);
4607
4607
  i !== -1 && js.splice(i, 1);
4608
4608
  }
@@ -4691,7 +4691,7 @@ let Jg = class extends Gg {
4691
4691
  };
4692
4692
  function Qg(t, e = "", n) {
4693
4693
  let i = t;
4694
- n = n || typeof location < "u" && location, t == null && (t = n.protocol + "//" + n.host), typeof t == "string" && (t.charAt(0) === "/" && (t.charAt(1) === "/" ? t = n.protocol + t : t = n.host + t), /^(https?|wss?):\/\//.test(t) || (typeof n < "u" ? t = n.protocol + "//" + t : t = "https://" + t), i = fa(t)), i.port || (/^(http|ws)$/.test(i.protocol) ? i.port = "80" : /^(http|ws)s$/.test(i.protocol) && (i.port = "443")), i.path = i.path || "/";
4694
+ n = n || typeof location < "u" && location, t == null && (t = n.protocol + "//" + n.host), typeof t == "string" && (t.charAt(0) === "/" && (t.charAt(1) === "/" ? t = n.protocol + t : t = n.host + t), /^(https?|wss?):\/\//.test(t) || (typeof n < "u" ? t = n.protocol + "//" + t : t = "https://" + t), i = ma(t)), i.port || (/^(http|ws)$/.test(i.protocol) ? i.port = "80" : /^(http|ws)s$/.test(i.protocol) && (i.port = "443")), i.path = i.path || "/";
4695
4695
  const o = i.host.indexOf(":") !== -1 ? "[" + i.host + "]" : i.host;
4696
4696
  return i.id = i.protocol + "://" + o + ":" + i.port + e, i.href = i.protocol + "://" + o + (n && n.port === i.port ? "" : ":" + i.port), i;
4697
4697
  }
@@ -4743,9 +4743,9 @@ function $s(t, e, n) {
4743
4743
  return t;
4744
4744
  }
4745
4745
  function nf(t, e) {
4746
- return t.data = ya(t.data, e), delete t.attachments, t;
4746
+ return t.data = ba(t.data, e), delete t.attachments, t;
4747
4747
  }
4748
- function ya(t, e) {
4748
+ function ba(t, e) {
4749
4749
  if (!t)
4750
4750
  return t;
4751
4751
  if (t && t._placeholder === !0) {
@@ -4754,10 +4754,10 @@ function ya(t, e) {
4754
4754
  throw new Error("illegal attachments");
4755
4755
  } else if (Array.isArray(t))
4756
4756
  for (let n = 0; n < t.length; n++)
4757
- t[n] = ya(t[n], e);
4757
+ t[n] = ba(t[n], e);
4758
4758
  else if (typeof t == "object")
4759
4759
  for (const n in t)
4760
- Object.prototype.hasOwnProperty.call(t, n) && (t[n] = ya(t[n], e));
4760
+ Object.prototype.hasOwnProperty.call(t, n) && (t[n] = ba(t[n], e));
4761
4761
  return t;
4762
4762
  }
4763
4763
  const sf = [
@@ -5605,10 +5605,10 @@ li.prototype.setMax = function(t) {
5605
5605
  li.prototype.setJitter = function(t) {
5606
5606
  this.jitter = t;
5607
5607
  };
5608
- class ba extends Ce {
5608
+ class wa extends Ce {
5609
5609
  constructor(e, n) {
5610
5610
  var i;
5611
- 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, fo(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 li({
5611
+ 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, mo(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 li({
5612
5612
  min: this.reconnectionDelay(),
5613
5613
  max: this.reconnectionDelayMax(),
5614
5614
  jitter: this.randomizationFactor()
@@ -5726,7 +5726,7 @@ class ba extends Ce {
5726
5726
  * @private
5727
5727
  */
5728
5728
  ondecoded(e) {
5729
- go(() => {
5729
+ fo(() => {
5730
5730
  this.emitReserved("packet", e);
5731
5731
  }, this.setTimeoutFn);
5732
5732
  }
@@ -5848,10 +5848,10 @@ function Hs(t, e) {
5848
5848
  typeof t == "object" && (e = t, t = void 0), e = e || {};
5849
5849
  const n = Qg(t, e.path || "/socket.io"), i = n.source, s = n.id, o = n.path, a = Ni[s] && o in Ni[s].nsps, r = e.forceNew || e["force new connection"] || e.multiplex === !1 || a;
5850
5850
  let c;
5851
- return r ? c = new ba(i, e) : (Ni[s] || (Ni[s] = new ba(i, e)), c = Ni[s]), n.query && !e.query && (e.query = n.queryKey), c.socket(n.path, e);
5851
+ return r ? c = new wa(i, e) : (Ni[s] || (Ni[s] = new wa(i, e)), c = Ni[s]), n.query && !e.query && (e.query = n.queryKey), c.socket(n.path, e);
5852
5852
  }
5853
5853
  Object.assign(Hs, {
5854
- Manager: ba,
5854
+ Manager: wa,
5855
5855
  Socket: yu,
5856
5856
  io: Hs,
5857
5857
  connect: Hs
@@ -6803,7 +6803,7 @@ function If(t, e, n, i) {
6803
6803
  return { ...o, role: "system", dataType: "run_status", content: t.data.message, loading: !1 };
6804
6804
  }
6805
6805
  }
6806
- function br(t, e, n, i) {
6806
+ function wr(t, e, n, i) {
6807
6807
  const s = /* @__PURE__ */ new Map();
6808
6808
  for (const k of t.segments)
6809
6809
  for (const M of [...k.activityIds, ...k.outcomeIds]) s.set(M, k.userMessageId);
@@ -6865,7 +6865,7 @@ function br(t, e, n, i) {
6865
6865
  ...m ? { errorMessageFingerprint: za(Hn(m.message)) } : {},
6866
6866
  ...u && m && m === u.error && !f ? { failedClientMessageId: u.userMessageId } : {},
6867
6867
  ...typeof m?.details?.requestId == "string" ? { errorRequestId: m.details.requestId } : {},
6868
- ...po(m?.details?.errorNormalization) ? { errorNormalization: m.details.errorNormalization } : {},
6868
+ ...ho(m?.details?.errorNormalization) ? { errorNormalization: m.details.errorNormalization } : {},
6869
6869
  ...i ? { owner: i } : {},
6870
6870
  ...wn(m?.details?.httpRequest) ? { httpRequest: m.details.httpRequest } : {},
6871
6871
  queryStatus: e?.status ?? null,
@@ -7138,7 +7138,7 @@ function Wi(t) {
7138
7138
  const e = t.error;
7139
7139
  return t.status === "error" && t.consecutiveFailures < 10 && e !== null && !["unauthorized", "401", "403", "authority_retired"].includes(e.code) && (e.retryable || /^5\d\d$/.test(e.code) || ["runtime_error", "connection_interrupted", "request_timed_out", "408", "429"].includes(e.code));
7140
7140
  }
7141
- const wr = { activeIntervalMs: 3e3, idleIntervalMs: 15e3, maxFailureIntervalMs: 3e4 };
7141
+ const _r = { activeIntervalMs: 3e3, idleIntervalMs: 15e3, maxFailureIntervalMs: 3e4 };
7142
7142
  function ct(t) {
7143
7143
  const e = t.currentAuthority();
7144
7144
  return e.authorityId === t.authority.authorityId && e.generation === t.authority.generation;
@@ -7234,7 +7234,7 @@ class Af {
7234
7234
  if (n) for (const [s, o] of Object.entries(e)) {
7235
7235
  if (!o.observe || this.observations.has(s)) continue;
7236
7236
  const a = this.options.recovery?.(s), r = new Hi({
7237
- ...wr,
7237
+ ..._r,
7238
7238
  isActiveTurn: () => this.options.isActiveTurn(s),
7239
7239
  poll: async () => {
7240
7240
  try {
@@ -7270,8 +7270,8 @@ class Af {
7270
7270
  const a = this.queryRetries.get(o) ?? { timer: null };
7271
7271
  if (a.timer !== null) continue;
7272
7272
  const r = Math.min(
7273
- wr.activeIntervalMs * 2 ** Math.min(s.consecutiveFailures - 1, 4),
7274
- wr.maxFailureIntervalMs
7273
+ _r.activeIntervalMs * 2 ** Math.min(s.consecutiveFailures - 1, 4),
7274
+ _r.maxFailureIntervalMs
7275
7275
  );
7276
7276
  a.timer = setTimeout(() => {
7277
7277
  a.timer = null, !this.queryRequests.has(o) && this.refreshObservedQuery(s.query).catch((c) => this.report(c));
@@ -7898,7 +7898,7 @@ class Ee extends EventTarget {
7898
7898
  }), o;
7899
7899
  }
7900
7900
  }
7901
- const wa = /* @__PURE__ */ new WeakMap(), jn = (t) => t === null || typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t);
7901
+ const _a = /* @__PURE__ */ new WeakMap(), jn = (t) => t === null || typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t);
7902
7902
  function Mf(t) {
7903
7903
  if (!t || typeof t != "object") return !1;
7904
7904
  const e = t;
@@ -7906,7 +7906,7 @@ function Mf(t) {
7906
7906
  }
7907
7907
  function Of(t, e, n) {
7908
7908
  if (!Mf(n)) return;
7909
- const i = wa.get(t) ?? /* @__PURE__ */ new Map();
7909
+ const i = _a.get(t) ?? /* @__PURE__ */ new Map();
7910
7910
  i.set(e, {
7911
7911
  observedAt: n.observedAt,
7912
7912
  sessionId: n.sessionId,
@@ -7915,10 +7915,10 @@ function Of(t, e, n) {
7915
7915
  panelVisible: n.panelVisible,
7916
7916
  documentVisible: n.documentVisible,
7917
7917
  loading: n.loading
7918
- }), i.size > 2 && i.delete(i.keys().next().value), wa.set(t, i);
7918
+ }), i.size > 2 && i.delete(i.keys().next().value), _a.set(t, i);
7919
7919
  }
7920
7920
  function Df(t, e, n) {
7921
- const i = wa.get(t)?.get(e);
7921
+ const i = _a.get(t)?.get(e);
7922
7922
  return i?.sessionId === n ? i : null;
7923
7923
  }
7924
7924
  function Lf(t, e, n, i, s, o, a, r, c = null, l = !1) {
@@ -8139,20 +8139,20 @@ function $f(t, e, n, i) {
8139
8139
  const s = t.clients[e];
8140
8140
  return s === void 0 || t.selections[s].sessionId === n ? !0 : !i || Object.values(i.pendingRestoration).includes(s) || Object.values(i.submissions).some((o) => o.conversationScopeId === s && !o.cancelled) ? !1 : t.selections[s].sessionId === null || Jt(i, t, s).isDraftSession;
8141
8141
  }
8142
- function _a(t) {
8142
+ function va(t) {
8143
8143
  return {
8144
8144
  ...t,
8145
8145
  metadataRevision: t.metadataRevision + 1,
8146
8146
  queries: Object.fromEntries(Object.entries(t.queries).map(([e, n]) => [e, { ...n, invalidated: !0 }]))
8147
8147
  };
8148
8148
  }
8149
- function _r(t, e, n) {
8149
+ function vr(t, e, n) {
8150
8150
  if (e.conversation_id !== e.conversation.id || !Number.isSafeInteger(e.version) || e.version < 0)
8151
8151
  throw new Error("Invalid conversation metadata envelope identity or version.");
8152
8152
  const i = t.entities[e.conversation_id];
8153
8153
  if (i && i.version >= e.version) return t;
8154
8154
  const s = { ...e, conversation: { ...e.conversation } }, o = { ...t, entities: { ...t.entities, [e.conversation_id]: s } };
8155
- return n ? _a(o) : o;
8155
+ return n ? va(o) : o;
8156
8156
  }
8157
8157
  function Fn(t, e, n) {
8158
8158
  let i = t;
@@ -8177,7 +8177,7 @@ function Fn(t, e, n) {
8177
8177
  if (e.type === "effect.failed")
8178
8178
  i = { ...i, queries: { ...i.queries, [r]: { ...c, status: "error", error: { ...e.error }, requestId: null, consecutiveFailures: c.consecutiveFailures + 1 } } };
8179
8179
  else if (e.effectKind === "directory.query") {
8180
- for (const g of e.output.entries) i = _r(i, g, !0);
8180
+ for (const g of e.output.entries) i = vr(i, g, !0);
8181
8181
  const l = e.output.entries.map((g) => g.conversation_id), u = { ...i.durableActivityBySessionId }, d = { ...i.activityBySessionId }, p = { ...i.activityRevisionBySessionId };
8182
8182
  for (const g of e.output.entries) {
8183
8183
  if (typeof g.is_active != "boolean") continue;
@@ -8205,7 +8205,7 @@ function Fn(t, e, n) {
8205
8205
  } else {
8206
8206
  if (e.type === "effect.completed" && e.effectKind === "directory.mutate") {
8207
8207
  if (e.output.conversation_id !== o.input.sessionId) throw new Error("Mutation response has the wrong conversation identity.");
8208
- i = _r(i, e.output, !0);
8208
+ i = vr(i, e.output, !0);
8209
8209
  }
8210
8210
  const r = { ...i.mutations[o.input.sessionId] };
8211
8211
  for (const c of ["title", "pinned"]) {
@@ -8218,9 +8218,9 @@ function Fn(t, e, n) {
8218
8218
  if (e.authorityId !== (t.authorityId ?? "") || e.generation !== t.generation)
8219
8219
  return { state: t, effects: s };
8220
8220
  if (e.type === "directory.metadata_received")
8221
- i = _r(t, e.metadata, !0);
8221
+ i = vr(t, e.metadata, !0);
8222
8222
  else if (e.type === "directory.invalidate")
8223
- i = _a(t);
8223
+ i = va(t);
8224
8224
  else if (e.type === "directory.optimistic_upsert")
8225
8225
  i = { ...t, optimisticEntries: {
8226
8226
  ...t.optimisticEntries,
@@ -8287,7 +8287,7 @@ function Fn(t, e, n) {
8287
8287
  const d = c[u];
8288
8288
  d !== void 0 && (l[u] = { requestId: e.requestId, value: d, status: "pending", error: null });
8289
8289
  }
8290
- i = _a({ ...t, mutations: { ...t.mutations, [e.sessionId]: l } });
8290
+ i = va({ ...t, mutations: { ...t.mutations, [e.sessionId]: l } });
8291
8291
  }
8292
8292
  i = { ...i, requestSequence: t.requestSequence + 1, requests: { ...i.requests, [o]: r } }, s.push({ id: o, ...r });
8293
8293
  } else
@@ -8600,9 +8600,9 @@ class Xf {
8600
8600
  constructor(e = Qf, n = {}, i, s) {
8601
8601
  this.conversationPorts = { ...Yf, ...n }, this.featurePorts = s ?? {}, this.engine = new Wf({
8602
8602
  initialState: Object.freeze({ revision: 0, slices: Object.freeze({
8603
- account: Ve(na()),
8604
- features: Ve(sa()),
8605
- interactions: Ve(ia()),
8603
+ account: Ve(ia()),
8604
+ features: Ve(oa()),
8605
+ interactions: Ve(sa()),
8606
8606
  modelSelection: Bf(),
8607
8607
  directory: _u(),
8608
8608
  conversation: Kd(),
@@ -8611,7 +8611,7 @@ class Xf {
8611
8611
  reducer: (o, a) => {
8612
8612
  const r = a.value;
8613
8613
  if (r.type.startsWith("stage7.") || (r.type === "effect.completed" || r.type === "effect.failed") && r.effectKind.startsWith("stage7.")) {
8614
- const l = oa(o.slices, r, o.slices);
8614
+ const l = ra(o.slices, r, o.slices);
8615
8615
  if (l.state === o.slices) return { state: o, effects: l.effects };
8616
8616
  const u = Ve(lt({ account: l.state.account, features: l.state.features, interactions: l.state.interactions }));
8617
8617
  return { state: Object.freeze({ revision: o.revision + 1, slices: Object.freeze({ ...o.slices, ...u }) }), effects: l.effects };
@@ -8621,7 +8621,7 @@ class Xf {
8621
8621
  return { state: l.state === o.slices.activeUsers ? o : Object.freeze({ revision: o.revision + 1, slices: Object.freeze({ ...o.slices, activeUsers: l.state }) }), effects: l.effects };
8622
8622
  }
8623
8623
  if (Gf(r)) {
8624
- const l = Fn(o.slices.directory, r, o.slices.conversation), u = ha(da(o.slices.conversation, l.state, r.type === "directory.authority_replace" && r.adoptLocalSubmissions === !0)), d = ua(o.slices.conversation, u.state, l.state, l.state.clients !== o.slices.directory.clients), p = d.state, f = Ul(o.slices.conversation, p, l.state);
8624
+ const l = Fn(o.slices.directory, r, o.slices.conversation), u = ga(ua(o.slices.conversation, l.state, r.type === "directory.authority_replace" && r.adoptLocalSubmissions === !0)), d = pa(o.slices.conversation, u.state, l.state, l.state.clients !== o.slices.directory.clients), p = d.state, f = Ul(o.slices.conversation, p, l.state);
8625
8625
  return { state: f === o.slices.directory && p === o.slices.conversation ? o : Object.freeze({
8626
8626
  revision: o.revision + 1,
8627
8627
  slices: Object.freeze({ ...o.slices, directory: f, conversation: p })
@@ -8655,11 +8655,11 @@ class Xf {
8655
8655
  }).state);
8656
8656
  }
8657
8657
  u = Ul(o.slices.conversation, l.state, u);
8658
- const p = ha(da(l.state, u)), f = ua(l.state, p.state, u);
8658
+ const p = ga(ua(l.state, u)), f = pa(l.state, p.state, u);
8659
8659
  let y = o.slices;
8660
8660
  const g = [], b = l.interactionSources, _ = y.account.authority;
8661
8661
  if (b && _ && _.authorityId === b.authorityId && _.generation === b.generation) {
8662
- const S = oa(y, { type: "stage7.sources", authority: _, now: y.features.now, sources: b.sources }, { conversation: f.state, directory: u });
8662
+ const S = ra(y, { type: "stage7.sources", authority: _, now: y.features.now, sources: b.sources }, { conversation: f.state, directory: u });
8663
8663
  y = Ve(lt({ account: S.state.account, features: S.state.features, interactions: S.state.interactions })), g.push(...S.effects);
8664
8664
  }
8665
8665
  return { state: f.state === o.slices.conversation && u === o.slices.directory && y === o.slices ? o : Object.freeze({
@@ -8755,13 +8755,13 @@ class Xf {
8755
8755
  }
8756
8756
  }
8757
8757
  }
8758
- const Zf = "pluno-product-agent-attachments", em = 1, va = "files", tm = 1440 * 60 * 1e3;
8758
+ const Zf = "pluno-product-agent-attachments", em = 1, Ia = "files", tm = 1440 * 60 * 1e3;
8759
8759
  async function nm(t) {
8760
- const e = await mo();
8760
+ const e = await yo();
8761
8761
  await ku(e, "readwrite", (n) => n.put(t));
8762
8762
  }
8763
8763
  async function zl(t) {
8764
- const e = await mo(), n = await ku(
8764
+ const e = await yo(), n = await ku(
8765
8765
  e,
8766
8766
  "readonly",
8767
8767
  (s) => s.get(t)
@@ -8772,7 +8772,7 @@ async function zl(t) {
8772
8772
  return await Su(t, { lastUsedAt: i }), { ...n, lastUsedAt: i };
8773
8773
  }
8774
8774
  async function Su(t, e) {
8775
- const n = await mo();
8775
+ const n = await yo();
8776
8776
  await Ka(n, "readwrite", async (i) => {
8777
8777
  const s = await Wa(
8778
8778
  i.get(t)
@@ -8784,17 +8784,17 @@ async function Su(t, e) {
8784
8784
  });
8785
8785
  }
8786
8786
  async function im(t = tm) {
8787
- const e = await mo(), n = Date.now() - t;
8787
+ const e = await yo(), n = Date.now() - t;
8788
8788
  await Ka(e, "readwrite", async (i) => {
8789
8789
  const s = i.index("lastUsedAt");
8790
8790
  (await Wa(s.getAllKeys(IDBKeyRange.upperBound(n)))).forEach((a) => i.delete(a));
8791
8791
  });
8792
8792
  }
8793
- function mo() {
8793
+ function yo() {
8794
8794
  return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((t, e) => {
8795
8795
  const n = indexedDB.open(Zf, em);
8796
8796
  n.onupgradeneeded = () => {
8797
- const s = n.result.createObjectStore(va, { keyPath: "attachmentId" });
8797
+ const s = n.result.createObjectStore(Ia, { keyPath: "attachmentId" });
8798
8798
  s.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), s.createIndex("sessionId", "sessionId", { unique: !1 }), s.createIndex("origin", "origin", { unique: !1 });
8799
8799
  }, n.onsuccess = () => t(n.result), n.onerror = () => e(n.error ?? new Error("Failed to open Product Agent attachment storage"));
8800
8800
  });
@@ -8804,7 +8804,7 @@ async function ku(t, e, n) {
8804
8804
  }
8805
8805
  function Ka(t, e, n) {
8806
8806
  return new Promise((i, s) => {
8807
- const o = t.transaction(va, e), a = o.objectStore(va);
8807
+ const o = t.transaction(Ia, e), a = o.objectStore(Ia);
8808
8808
  let r, c = !1;
8809
8809
  n(a).then((l) => {
8810
8810
  r = l;
@@ -8872,11 +8872,11 @@ const cm = "save_runtime_captured_skill";
8872
8872
  function lm(t) {
8873
8873
  return (t.type === "function_call" || t.type === "tool_call") && t.name === cm;
8874
8874
  }
8875
- const vr = "pluno.productAgent.transportId", dm = "pluno.productAgent.transportIdentity", Ir = "pluno.productAgent.transportIdentity.event", um = 50, pm = globalThis.setTimeout.bind(globalThis);
8875
+ const Ir = "pluno.productAgent.transportId", dm = "pluno.productAgent.transportIdentity", Sr = "pluno.productAgent.transportIdentity.event", um = 50, pm = globalThis.setTimeout.bind(globalThis);
8876
8876
  let zi = null;
8877
- const Ks = /* @__PURE__ */ new Set(), Sr = /* @__PURE__ */ new Map();
8877
+ const Ks = /* @__PURE__ */ new Set(), kr = /* @__PURE__ */ new Map();
8878
8878
  async function hm(t = Eu()) {
8879
- const e = t.randomUUID(), n = t.storage.getItem(vr);
8879
+ const e = t.randomUUID(), n = t.storage.getItem(Ir);
8880
8880
  let i = n ?? t.randomUUID(), s = !1, o = !1;
8881
8881
  const a = t.channel.subscribe((c) => {
8882
8882
  if (!(c.senderId === e || c.transportId !== i)) {
@@ -8894,7 +8894,7 @@ async function hm(t = Eu()) {
8894
8894
  }
8895
8895
  });
8896
8896
  if (!n)
8897
- t.storage.setItem(vr, i), s = !0;
8897
+ t.storage.setItem(Ir, i), s = !0;
8898
8898
  else if (t.skipStoredIdentityCollisionCheck)
8899
8899
  s = !0;
8900
8900
  else
@@ -8903,7 +8903,7 @@ async function hm(t = Eu()) {
8903
8903
  s = !0;
8904
8904
  break;
8905
8905
  }
8906
- i = t.randomUUID(), t.storage.setItem(vr, i);
8906
+ i = t.randomUUID(), t.storage.setItem(Ir, i);
8907
8907
  }
8908
8908
  let r = !1;
8909
8909
  return {
@@ -8952,13 +8952,13 @@ function mm() {
8952
8952
  return {
8953
8953
  getItem: (t) => {
8954
8954
  try {
8955
- return window.sessionStorage?.getItem(t) ?? Sr.get(t) ?? null;
8955
+ return window.sessionStorage?.getItem(t) ?? kr.get(t) ?? null;
8956
8956
  } catch {
8957
- return Sr.get(t) ?? null;
8957
+ return kr.get(t) ?? null;
8958
8958
  }
8959
8959
  },
8960
8960
  setItem: (t, e) => {
8961
- Sr.set(t, e);
8961
+ kr.set(t, e);
8962
8962
  try {
8963
8963
  window.sessionStorage?.setItem(t, e);
8964
8964
  } catch {
@@ -8982,7 +8982,7 @@ function ym() {
8982
8982
  }
8983
8983
  function bm() {
8984
8984
  const t = /* @__PURE__ */ new Set(), e = (n) => {
8985
- if (n.key !== Ir || !n.newValue)
8985
+ if (n.key !== Sr || !n.newValue)
8986
8986
  return;
8987
8987
  const i = JSON.parse(n.newValue);
8988
8988
  for (const s of t)
@@ -8991,9 +8991,9 @@ function bm() {
8991
8991
  return window.addEventListener("storage", e), {
8992
8992
  postMessage: (n) => {
8993
8993
  window.localStorage.setItem(
8994
- Ir,
8994
+ Sr,
8995
8995
  JSON.stringify({ ...n, eventId: crypto.randomUUID() })
8996
- ), window.localStorage.removeItem(Ir);
8996
+ ), window.localStorage.removeItem(Sr);
8997
8997
  },
8998
8998
  subscribe: (n) => (t.add(n), () => t.delete(n)),
8999
8999
  close: () => {
@@ -9088,7 +9088,7 @@ const Sm = [
9088
9088
  "gpt-5.6-sol",
9089
9089
  "gpt-6-sol",
9090
9090
  "gpt-6-luna"
9091
- ], to = (t) => typeof t == "string" && Sm.includes(t), kr = /* @__PURE__ */ new Map();
9091
+ ], no = (t) => typeof t == "string" && Sm.includes(t), xr = /* @__PURE__ */ new Map();
9092
9092
  function km(t, e, n) {
9093
9093
  const i = `pluno.productAgent.modelClientScope:${e}`, s = t.getItem(i);
9094
9094
  if (s) return s;
@@ -9098,24 +9098,24 @@ function km(t, e, n) {
9098
9098
  function xm(t, e) {
9099
9099
  try {
9100
9100
  const n = km(window.sessionStorage, t, e);
9101
- return kr.set(t, n), n;
9101
+ return xr.set(t, n), n;
9102
9102
  } catch (n) {
9103
9103
  if (!(n instanceof DOMException) || n.name !== "SecurityError" && n.name !== "QuotaExceededError") throw n;
9104
- const i = kr.get(t) ?? e();
9105
- return kr.set(t, i), i;
9104
+ const i = xr.get(t) ?? e();
9105
+ return xr.set(t, i), i;
9106
9106
  }
9107
9107
  }
9108
9108
  function Em(t) {
9109
9109
  if (!t || typeof t != "object") return;
9110
9110
  const e = t, n = e.requestedModel ?? e.requested_model, i = e.effectiveModel ?? e.effective_model, s = e.provider;
9111
- if (!(!to(n) || !to(i) || s !== "openrouter" && s !== "azure" && s !== "openai"))
9111
+ if (!(!no(n) || !no(i) || s !== "openrouter" && s !== "azure" && s !== "openai"))
9112
9112
  return Object.freeze({ requestedModel: n, effectiveModel: i, provider: s });
9113
9113
  }
9114
9114
  const Au = (t, e) => Gh(
9115
9115
  t.engine.getState().slices.modelSelection,
9116
9116
  e
9117
9117
  );
9118
- function xr(t, e, n, i) {
9118
+ function Er(t, e, n, i) {
9119
9119
  return t.engine.dispatch({
9120
9120
  type: "model.submission_capture",
9121
9121
  clientScopeId: e,
@@ -9134,7 +9134,7 @@ function Cm(t, e, n, i, s, o) {
9134
9134
  updatedAt: o ? Date.parse(o) : void 0
9135
9135
  });
9136
9136
  }
9137
- function Er(t, e, n, i) {
9137
+ function Cr(t, e, n, i) {
9138
9138
  if (Array.isArray(i))
9139
9139
  for (const s of i) {
9140
9140
  if (!s || typeof s != "object") continue;
@@ -9156,8 +9156,8 @@ const Am = {
9156
9156
  stopped: "⏹️"
9157
9157
  }, Rm = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
9158
9158
  function Tm(t, e) {
9159
- if (!e) return no(t);
9160
- const n = no(t), i = `${Am[e]} Pluno`;
9159
+ if (!e) return io(t);
9160
+ const n = io(t), i = `${Am[e]} Pluno`;
9161
9161
  return n ? `${i}: ${n}` : i;
9162
9162
  }
9163
9163
  class Pm {
@@ -9182,10 +9182,10 @@ class Pm {
9182
9182
  }
9183
9183
  applyStatus(e) {
9184
9184
  const n = this.titleDocument.getTitle();
9185
- n !== this.lastAppliedTitle && (this.baseTitle = no(n)), this.status = e, this.stopObserving || (this.stopObserving = this.titleDocument.observeTitle(() => this.handleTitleChanged())), this.applyTitle();
9185
+ n !== this.lastAppliedTitle && (this.baseTitle = io(n)), this.status = e, this.stopObserving || (this.stopObserving = this.titleDocument.observeTitle(() => this.handleTitleChanged())), this.applyTitle();
9186
9186
  }
9187
9187
  applyClear() {
9188
- const e = this.titleDocument.getTitle(), n = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ? no(e) : e;
9188
+ const e = this.titleDocument.getTitle(), n = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ? io(e) : e;
9189
9189
  this.status = null, this.lastAppliedTitle = null, this.stopObserving?.(), this.stopObserving = null, n ? this.titleDocument.setTitle(this.baseTitle) : i !== e && this.titleDocument.setTitle(i);
9190
9190
  }
9191
9191
  handleTitleChanged() {
@@ -9214,7 +9214,7 @@ function qm(t) {
9214
9214
  }
9215
9215
  };
9216
9216
  }
9217
- function no(t) {
9217
+ function io(t) {
9218
9218
  return t.replace(Rm, "");
9219
9219
  }
9220
9220
  const Mm = {
@@ -9280,7 +9280,7 @@ class Ze extends Error {
9280
9280
  retryAfterMs;
9281
9281
  }
9282
9282
  let jm = 0;
9283
- function Cr(t) {
9283
+ function Ar(t) {
9284
9284
  const e = {};
9285
9285
  for (const c of [
9286
9286
  "type",
@@ -9366,17 +9366,17 @@ function Xn(t, e, n) {
9366
9366
  };
9367
9367
  window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: s }));
9368
9368
  }
9369
- const Fm = "https://app.pluno.ai", $m = 2e4, Hm = 1e4, Km = 6e4, Wm = 6e4, Vm = 1e4, Gm = 1e4, Jm = 1e3, Ia = 3e4, $l = 0.2, Ar = 6e4, Rr = 3, Hl = "Still connecting to Pluno. Retrying automatically.", Qm = 1e3, Ym = 100, Kl = 3, Xm = [300, 1e3], Ru = 50 * 1024 * 1024, Zm = /* @__PURE__ */ new Set([
9369
+ const Fm = "https://app.pluno.ai", $m = 2e4, Hm = 1e4, Km = 6e4, Wm = 6e4, Vm = 1e4, Gm = 1e4, Jm = 1e3, Sa = 3e4, $l = 0.2, Rr = 6e4, Tr = 3, Hl = "Still connecting to Pluno. Retrying automatically.", Qm = 1e3, Ym = 100, Kl = 3, Xm = [300, 1e3], Ru = 50 * 1024 * 1024, Zm = /* @__PURE__ */ new Set([
9370
9370
  ".jpeg:image/jpeg",
9371
9371
  ".jpg:image/jpeg",
9372
9372
  ".pdf:application/pdf",
9373
9373
  ".png:image/png",
9374
9374
  ".webp:image/webp"
9375
- ]), ey = ".pdf,.png,.jpg,.jpeg,.webp", Ga = 64e3, Tr = 4e3, Ja = 30, ty = 2e3, ny = 1e3, Tu = "Image is too large for model vision input.", iy = "pluno.productAgent.state.", Sa = "pluno.productAgent.pendingEvents.", yo = "pluno.productAgent.activeToolCalls.", sy = 100, Ws = /* @__PURE__ */ new Set();
9375
+ ]), ey = ".pdf,.png,.jpg,.jpeg,.webp", Ga = 64e3, Pr = 4e3, Ja = 30, ty = 2e3, ny = 1e3, Tu = "Image is too large for model vision input.", iy = "pluno.productAgent.state.", ka = "pluno.productAgent.pendingEvents.", bo = "pluno.productAgent.activeToolCalls.", sy = 100, Ws = /* @__PURE__ */ new Set();
9376
9376
  let Rs = null;
9377
9377
  function oy(t, e = Math.random) {
9378
- const n = Math.min(Ia, Jm * 2 ** t), i = 1 - $l + e() * $l * 2;
9379
- return Math.min(Ia, Math.round(n * i));
9378
+ const n = Math.min(Sa, Jm * 2 ** t), i = 1 - $l + e() * $l * 2;
9379
+ return Math.min(Sa, Math.round(n * i));
9380
9380
  }
9381
9381
  function ry(t) {
9382
9382
  const e = t.split(".")[1];
@@ -9389,7 +9389,7 @@ function ry(t) {
9389
9389
  return null;
9390
9390
  }
9391
9391
  }
9392
- function Pr(t) {
9392
+ function qr(t) {
9393
9393
  if (t instanceof Ze)
9394
9394
  return t.retryable;
9395
9395
  if (t && typeof t == "object") {
@@ -9409,13 +9409,13 @@ function Bi(t) {
9409
9409
  }
9410
9410
  return Object.assign(new Error(e.message), e);
9411
9411
  }
9412
- function qr(t) {
9412
+ function Mr(t) {
9413
9413
  return t === "main_web_chat" ? ["pinned", "recent"] : ["all"];
9414
9414
  }
9415
9415
  class Qa {
9416
9416
  constructor(e, n) {
9417
9417
  this.options = e, this.transportIdentity = n, this.directoryAuthority = {
9418
- authorityId: gr(`pa.authority:${e.clientId}`) ?? `${e.clientId}:${e.runtimeCommunityId ?? e.productVariant}`,
9418
+ authorityId: fr(`pa.authority:${e.clientId}`) ?? `${e.clientId}:${e.runtimeCommunityId ?? e.productVariant}`,
9419
9419
  generation: 1
9420
9420
  }, this.directoryHttp = new wu({
9421
9421
  backendUrl: e.backendUrl,
@@ -9622,7 +9622,7 @@ class Qa {
9622
9622
  }, stop: () => {
9623
9623
  } },
9624
9624
  enabled: () => !!this.token && !this.authenticationFailure && !this.refreshingDefaultCredentials && this.state.status !== "closed",
9625
- observedQueries: () => qr(this.options.entrySurface).map((n) => this.getDirectoryQuery(n))
9625
+ observedQueries: () => Mr(this.options.entrySurface).map((n) => this.getDirectoryQuery(n))
9626
9626
  });
9627
9627
  let e = this.clientRuntime.engine.getProjection().activeUsers.query.data;
9628
9628
  this.clientRuntime.engine.subscribe((n) => {
@@ -9643,7 +9643,7 @@ class Qa {
9643
9643
  });
9644
9644
  const s = `pa.conversation.delivery:${this.modelClientScopeId}:${n.authorityId}`, o = `${s}:cancellations`;
9645
9645
  this.authenticatedUserId && this.options.restorePersistedState === !1 && sessionStorage.removeItem(o);
9646
- const a = this.authenticatedUserId ? gr(o) : null, r = ig({
9646
+ const a = this.authenticatedUserId ? fr(o) : null, r = ig({
9647
9647
  authorityId: n.authorityId,
9648
9648
  isCurrent: i,
9649
9649
  read: async () => a ? JSON.parse(a) : null,
@@ -9721,7 +9721,7 @@ class Qa {
9721
9721
  onTiming: (g) => {
9722
9722
  i() && this.reportOperationTiming(g);
9723
9723
  },
9724
- onCommand: (g) => Xn("client_event", g.type, Cr({ ...g.payload, type: g.type })),
9724
+ onCommand: (g) => Xn("client_event", g.type, Ar({ ...g.payload, type: g.type })),
9725
9725
  onError: (g, b) => {
9726
9726
  if (this.options.productVariant === "customer_embedded" && b.operation === "conversation.snapshot" && g instanceof N && g.code === "conversation_access_denied") {
9727
9727
  b.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
@@ -9731,7 +9731,7 @@ class Qa {
9731
9731
  }
9732
9732
  })
9733
9733
  });
9734
- const c = this.clientRuntime.engine.getState().slices.conversation, l = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null : gr(s);
9734
+ const c = this.clientRuntime.engine.getState().slices.conversation, l = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null : fr(s);
9735
9735
  if (this.authenticatedUserId && !c.submissionOrder.length && !Object.keys(c.operations).length) {
9736
9736
  const g = this.queuedClientEvents.filter((S) => S.type === "chat.user_message"), b = l ? JSON.parse(l) : g.length ? gg(c, g.map((S) => {
9737
9737
  const { type: x, ...m } = S, w = this.clientRuntime.engine.getState().slices.directory, I = w.clients[this.modelClientScopeId];
@@ -9803,7 +9803,7 @@ class Qa {
9803
9803
  m && (m.sessionId = x.sessionId), this.emit("ack", { clientMessageId: x.userMessageId, sessionId: x.sessionId });
9804
9804
  const w = x.sessionId;
9805
9805
  w && this.getState().sessionId === w && this.directoryHttp.request(`/sessions/${encodeURIComponent(w)}/history`, { limit: 200 }).then((I) => {
9806
- i() && this.getState().sessionId === w && this.state.status !== "closed" && Er(this.clientRuntime, this.modelClientScopeId, w, I.turns);
9806
+ i() && this.getState().sessionId === w && this.state.status !== "closed" && Cr(this.clientRuntime, this.modelClientScopeId, w, I.turns);
9807
9807
  }).catch((I) => {
9808
9808
  i() && this.getState().sessionId === w && this.handleDirectoryTransportError(I);
9809
9809
  });
@@ -9813,7 +9813,7 @@ class Qa {
9813
9813
  for (const [x, m] of Object.entries(g.directory.clients)) {
9814
9814
  if (!x.startsWith(`background:${this.modelClientScopeId}:`)) continue;
9815
9815
  const w = Jt(g.conversation, g.directory, m), I = w.sessionId ? g.conversation.sessions[w.sessionId] : void 0;
9816
- if (this.firstResponseTimersByClientMessageId.size && (u(br(w, I?.queries.current, this.options.backendUrl).messages, w.sessionId), ["failed", "stopped"].includes(w.activity.phase)))
9816
+ if (this.firstResponseTimersByClientMessageId.size && (u(wr(w, I?.queries.current, this.options.backendUrl).messages, w.sessionId), ["failed", "stopped"].includes(w.activity.phase)))
9817
9817
  for (const T of Pt(I?.execution)) this.clearFirstResponseTimer(T);
9818
9818
  const E = w.activity.phase === "completed" && Pt(I?.execution).some((T) => this.firstResponseTimersByClientMessageId.has(T));
9819
9819
  (_ && w.sessionId === this.getState().sessionId || !E && ["completed", "failed", "stopped"].includes(w.activity.phase)) && this.directoryScope.detach(x);
@@ -9879,12 +9879,12 @@ class Qa {
9879
9879
  return i.add(n), this.listeners[e] = i, () => i.delete(n);
9880
9880
  }
9881
9881
  getState() {
9882
- const e = this.clientRuntime.engine.getState().slices, n = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, i = Jt(e.conversation, e.directory, n), s = br(
9882
+ const e = this.clientRuntime.engine.getState().slices, n = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, i = Jt(e.conversation, e.directory, n), s = wr(
9883
9883
  i,
9884
9884
  i.sessionId ? e.conversation.sessions[i.sessionId]?.queries.current : void 0,
9885
9885
  this.options.backendUrl,
9886
9886
  this.clientRuntime.engine.getDiagnostics({ clientScopeId: this.modelClientScopeId, scopeId: n, sessionId: i.sessionId })
9887
- ), o = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, a = this.options.productVariant === "personal" ? { kind: "userSuggestedTasks" } : { kind: "starterPrompts", ...o, includeUserSuggestions: !1 }, r = Xs(e, a), c = Xs(e, { kind: "appearance", ...o }), l = c?.data?.kind === "appearance" ? c.data.value : null;
9887
+ ), o = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, a = this.options.productVariant === "personal" ? { kind: "userSuggestedTasks" } : { kind: "starterPrompts", ...o, includeUserSuggestions: !1 }, r = Zs(e, a), c = Zs(e, { kind: "appearance", ...o }), l = c?.data?.kind === "appearance" ? c.data.value : null;
9888
9888
  return {
9889
9889
  ...this.platformState,
9890
9890
  ...s,
@@ -10074,7 +10074,7 @@ class Qa {
10074
10074
  return;
10075
10075
  }
10076
10076
  const a = Bi(o);
10077
- if (Pr(o)) {
10077
+ if (qr(o)) {
10078
10078
  Be("web-sdk.agent", "Pluno connection attempt failed; retrying", {
10079
10079
  message: a.message,
10080
10080
  reconnectAttempt: this.reconnectAttempts
@@ -10194,14 +10194,14 @@ class Qa {
10194
10194
  sessionId: this.getState().sessionId
10195
10195
  });
10196
10196
  a.mark("submit");
10197
- const r = xr(
10197
+ const r = Er(
10198
10198
  this.clientRuntime,
10199
10199
  this.modelClientScopeId,
10200
10200
  o,
10201
10201
  n.requestedModel ?? this.getModel()
10202
10202
  ), c = this.submissionIntentRevision, l = this.authenticatedUserId;
10203
10203
  if (n.initiatedBy || this.startFirstResponseTimer(o, n.submittedAt), l || await a.measure("authentication", () => this.waitForAuthentication()), this.clientRuntime.isDisposed || c !== this.submissionIntentRevision || l && l !== this.authenticatedUserId) return null;
10204
- xr(this.clientRuntime, this.modelClientScopeId, o, r ?? null);
10204
+ Er(this.clientRuntime, this.modelClientScopeId, o, r ?? null);
10205
10205
  const u = this.clientRuntime.engine.getState().slices.conversation.submissions[o];
10206
10206
  if (u && (u.content !== i || JSON.stringify(u.attachments.map((b) => b.sourceId)) !== JSON.stringify(s.map((b) => b.id ?? b.storageKey ?? b.sandboxPath)))) throw new Error("User-message identity cannot be reused with different input.");
10207
10207
  const d = At(), p = !u && !n.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== d.url, y = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
@@ -10295,7 +10295,7 @@ class Qa {
10295
10295
  if (!o) return !1;
10296
10296
  if (o.type === "preparation") {
10297
10297
  const a = Me(), r = Sf(o.submission);
10298
- return xr(this.clientRuntime, this.modelClientScopeId, a, o.submission.requestedModel), this.sendMessage(r.content, { clientMessageId: a, attachments: r.attachments, proactiveSuggestionQuestion: r.proactiveSuggestionQuestion }).catch((c) => this.emit("error", Bi(c))), !0;
10298
+ return Er(this.clientRuntime, this.modelClientScopeId, a, o.submission.requestedModel), this.sendMessage(r.content, { clientMessageId: a, attachments: r.attachments, proactiveSuggestionQuestion: r.proactiveSuggestionQuestion }).catch((c) => this.emit("error", Bi(c))), !0;
10299
10299
  }
10300
10300
  return o.type === "delivery" ? (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.submit", userMessageId: o.userMessageId, now: Date.now(), manualRetry: !0 }), !0) : (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.operation", command: {
10301
10301
  request_id: Me(),
@@ -10451,7 +10451,7 @@ class Qa {
10451
10451
  }
10452
10452
  getSessionHistoryState() {
10453
10453
  return this.clientRuntime.project("directory", { core: () => {
10454
- const e = this.clientRuntime.engine.getProjection().directory, n = e.queries[Se(this.getDirectoryQuery())], i = qr(this.options.entrySurface).map((u) => this.getDirectoryQuery(u)).map((u) => e.queries[Se(u)]).filter((u) => u !== void 0), s = Object.values(e.optimisticEntries).reverse(), o = Ef(i), a = new Set(s.flatMap((u) => u.sessionId ? [u.sessionId] : [])), r = [...s.map((u) => u.id), ...o.filter((u) => !a.has(u))], c = Object.fromEntries([
10454
+ const e = this.clientRuntime.engine.getProjection().directory, n = e.queries[Se(this.getDirectoryQuery())], i = Mr(this.options.entrySurface).map((u) => this.getDirectoryQuery(u)).map((u) => e.queries[Se(u)]).filter((u) => u !== void 0), s = Object.values(e.optimisticEntries).reverse(), o = Ef(i), a = new Set(s.flatMap((u) => u.sessionId ? [u.sessionId] : [])), r = [...s.map((u) => u.id), ...o.filter((u) => !a.has(u))], c = Object.fromEntries([
10455
10455
  ...s.map((u) => [u.id, {
10456
10456
  id: u.id,
10457
10457
  title: null,
@@ -10481,7 +10481,7 @@ class Qa {
10481
10481
  }
10482
10482
  refreshSessionHistory() {
10483
10483
  return this.clientRuntime.route("directory", { core: async () => {
10484
- await Promise.all(qr(this.options.entrySurface).map((e) => this.getDirectoryQuery(e)).map((e) => this.refreshDirectoryQuery(e, e.kind === "pinned")));
10484
+ await Promise.all(Mr(this.options.entrySurface).map((e) => this.getDirectoryQuery(e)).map((e) => this.refreshDirectoryQuery(e, e.kind === "pinned")));
10485
10485
  } });
10486
10486
  }
10487
10487
  loadMoreSessionHistory() {
@@ -10618,7 +10618,7 @@ class Qa {
10618
10618
  if (!i() || !s) return;
10619
10619
  this.clientRuntime.engine.getState().slices.account.authority || this.applyAuthenticatedDirectoryIdentity(s.user);
10620
10620
  }
10621
- await pr(this.clientRuntime, { kind: "account" });
10621
+ await hr(this.clientRuntime, { kind: "account" });
10622
10622
  }
10623
10623
  }
10624
10624
  installFeaturePorts() {
@@ -10744,7 +10744,7 @@ class Qa {
10744
10744
  this.clientRuntime.onDispose(() => c?.()), jh(this.clientRuntime, () => Date.now());
10745
10745
  const l = () => {
10746
10746
  const u = this.clientRuntime.engine.getState().slices.account.authority;
10747
- u?.profile === "main_web_chat" && this.options.entrySurface === "main_web_chat" && this.clientRuntime.engine.dispatch({ type: "stage7.device_hints", authority: u, now: Date.now(), hints: Zr(localStorage) });
10747
+ u?.profile === "main_web_chat" && this.options.entrySurface === "main_web_chat" && this.clientRuntime.engine.dispatch({ type: "stage7.device_hints", authority: u, now: Date.now(), hints: ea(localStorage) });
10748
10748
  };
10749
10749
  window.addEventListener("storage", l), this.clientRuntime.onDispose(() => window.removeEventListener("storage", l)), this.clientRuntime.onDispose(() => {
10750
10750
  e.dispose(), r(), this.options.runtimeAdapters?.featurePermissions?.dispose?.();
@@ -10779,7 +10779,7 @@ class Qa {
10779
10779
  })), !0;
10780
10780
  }
10781
10781
  try {
10782
- return n.send(JSON.stringify(e)), Xn("client_event", e.type, Cr(e)), !0;
10782
+ return n.send(JSON.stringify(e)), Xn("client_event", e.type, Ar(e)), !0;
10783
10783
  } catch (i) {
10784
10784
  return Be("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
10785
10785
  message: i instanceof Error ? i.message : String(i),
@@ -10792,7 +10792,7 @@ class Qa {
10792
10792
  let i = this.getState();
10793
10793
  if (e === "first_response_slow" && n.sessionId && n.sessionId !== i.sessionId) {
10794
10794
  const { conversation: y, directory: g } = this.clientRuntime.engine.getState().slices, b = Object.values(g.clients).find((_) => g.selections[_]?.sessionId === n.sessionId);
10795
- b && (i = { ...i, ...br(
10795
+ b && (i = { ...i, ...wr(
10796
10796
  Jt(y, g, b),
10797
10797
  y.sessions[n.sessionId]?.queries.current,
10798
10798
  this.options.backendUrl
@@ -10858,7 +10858,7 @@ class Qa {
10858
10858
  missedResponseChecks: i,
10859
10859
  timer: window.setTimeout(() => this.recordFirstResponseMiss(e), Math.max(
10860
10860
  0,
10861
- s + (i + 1) * Ar - Date.now()
10861
+ s + (i + 1) * Rr - Date.now()
10862
10862
  ))
10863
10863
  });
10864
10864
  }
@@ -10868,13 +10868,13 @@ class Qa {
10868
10868
  return;
10869
10869
  const i = Date.now() - n.submittedAt;
10870
10870
  if (n.missedResponseChecks = Math.min(
10871
- Rr,
10872
- Math.max(n.missedResponseChecks + 1, Math.floor(i / Ar))
10873
- ), n.missedResponseChecks >= Rr) {
10871
+ Tr,
10872
+ Math.max(n.missedResponseChecks + 1, Math.floor(i / Rr))
10873
+ ), n.missedResponseChecks >= Tr) {
10874
10874
  this.reportFirstResponseSlow(e);
10875
10875
  return;
10876
10876
  }
10877
- const s = n.submittedAt + (n.missedResponseChecks + 1) * Ar;
10877
+ const s = n.submittedAt + (n.missedResponseChecks + 1) * Rr;
10878
10878
  n.timer = window.setTimeout(
10879
10879
  () => this.recordFirstResponseMiss(e),
10880
10880
  Math.max(0, s - Date.now())
@@ -10882,7 +10882,7 @@ class Qa {
10882
10882
  }
10883
10883
  reportFirstResponseSlow(e) {
10884
10884
  const n = this.firstResponseTimersByClientMessageId.get(e);
10885
- n && (n.missedResponseChecks = Rr, window.clearTimeout(n.timer), this.reportHealthSignal("first_response_slow", {
10885
+ n && (n.missedResponseChecks = Tr, window.clearTimeout(n.timer), this.reportHealthSignal("first_response_slow", {
10886
10886
  ...n.sessionId ? { sessionId: n.sessionId } : {},
10887
10887
  clientMessageId: e,
10888
10888
  durationMs: Date.now() - n.submittedAt,
@@ -11027,8 +11027,8 @@ class Qa {
11027
11027
  if (!this.clientRuntime.engine.getState().slices.account.authority || this.state.status === "closed") return Promise.resolve();
11028
11028
  const e = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href };
11029
11029
  return Promise.all([
11030
- pr(this.clientRuntime, { kind: "appearance", ...e }),
11031
- pr(this.clientRuntime, this.options.productVariant === "personal" ? { kind: "userSuggestedTasks" } : { kind: "starterPrompts", ...e, includeUserSuggestions: !1 }).then(async (n) => {
11030
+ hr(this.clientRuntime, { kind: "appearance", ...e }),
11031
+ hr(this.clientRuntime, this.options.productVariant === "personal" ? { kind: "userSuggestedTasks" } : { kind: "starterPrompts", ...e, includeUserSuggestions: !1 }).then(async (n) => {
11032
11032
  n.kind === "starterPrompts" && n.prompts.length === 0 && location.href === e.pageUrl && await this.requestTransientStarterPrompts();
11033
11033
  })
11034
11034
  ]).then(() => {
@@ -11072,7 +11072,7 @@ class Qa {
11072
11072
  }
11073
11073
  };
11074
11074
  if (Fh(this.clientRuntime, l, Date.now()).then(async () => {
11075
- this.options.entrySurface === "main_web_chat" && l.profile === "main_web_chat" && await this.clientRuntime.engine.dispatch({ type: "stage7.device_hints", authority: l, now: Date.now(), hints: Zr(localStorage) }), await this.refreshStarterPromptsForCurrentUrl();
11075
+ this.options.entrySurface === "main_web_chat" && l.profile === "main_web_chat" && await this.clientRuntime.engine.dispatch({ type: "stage7.device_hints", authority: l, now: Date.now(), hints: ea(localStorage) }), await this.refreshStarterPromptsForCurrentUrl();
11076
11076
  }).catch(() => {
11077
11077
  }), o || a) {
11078
11078
  const u = this.directoryAuthority;
@@ -11124,7 +11124,7 @@ class Qa {
11124
11124
  }
11125
11125
  }
11126
11126
  handleServerEvent(e) {
11127
- if (Xn("server_event", e.type, Cr(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
11127
+ if (Xn("server_event", e.type, Ar(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
11128
11128
  this.conversationObservation?.receive(e);
11129
11129
  return;
11130
11130
  }
@@ -11160,11 +11160,11 @@ class Qa {
11160
11160
  return;
11161
11161
  }
11162
11162
  if (e.type === "conversation.routing") {
11163
- e.sessionId === this.state.sessionId && Er(this.clientRuntime, this.modelClientScopeId, String(e.sessionId), e.turns);
11163
+ e.sessionId === this.state.sessionId && Cr(this.clientRuntime, this.modelClientScopeId, String(e.sessionId), e.turns);
11164
11164
  return;
11165
11165
  }
11166
11166
  if (e.type === "session.updated" || e.type === "conversation.state") {
11167
- Ps(e.session, "id") === this.state.sessionId && (this.updatePersonalModelFromSession(e.session), this.updateAccountFallbackFromSession(e.session), Er(this.clientRuntime, this.modelClientScopeId, this.state.sessionId, e.turns));
11167
+ Ps(e.session, "id") === this.state.sessionId && (this.updatePersonalModelFromSession(e.session), this.updateAccountFallbackFromSession(e.session), Cr(this.clientRuntime, this.modelClientScopeId, this.state.sessionId, e.turns));
11168
11168
  return;
11169
11169
  }
11170
11170
  if (e.type === "tool.call")
@@ -11238,8 +11238,8 @@ class Qa {
11238
11238
  type: "model.history_received",
11239
11239
  clientScopeId: this.modelClientScopeId,
11240
11240
  sessionId: n,
11241
- model: to(o) ? o : void 0
11242
- }), this.state.sessionId === n && this.options.productVariant === "personal" && !this.draftModelExplicit && to(o) && this.draftModel !== o && (this.draftModel = o, this.emit("state", this.getState()));
11241
+ model: no(o) ? o : void 0
11242
+ }), this.state.sessionId === n && this.options.productVariant === "personal" && !this.draftModelExplicit && no(o) && this.draftModel !== o && (this.draftModel = o, this.emit("state", this.getState()));
11243
11243
  }
11244
11244
  updateAccountFallbackFromSession(e) {
11245
11245
  if (!e || typeof e != "object") return;
@@ -11386,7 +11386,7 @@ class Qa {
11386
11386
  this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null;
11387
11387
  }
11388
11388
  connectionFailureDiagnostic(e, n) {
11389
- const i = e instanceof Ze ? e.status : e instanceof N && e.code === "unauthorized" ? 401 : e instanceof N && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, s = i !== void 0 && Number.isInteger(i) && i >= 400 && i <= 599 ? i : void 0, a = !(e instanceof N && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && Pr(e) && s !== 401 && s !== 403;
11389
+ const i = e instanceof Ze ? e.status : e instanceof N && e.code === "unauthorized" ? 401 : e instanceof N && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, s = i !== void 0 && Number.isInteger(i) && i >= 400 && i <= 599 ? i : void 0, a = !(e instanceof N && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && qr(e) && s !== 401 && s !== 403;
11390
11390
  return {
11391
11391
  stage: n,
11392
11392
  ...s !== void 0 ? { httpStatus: s } : {},
@@ -11398,7 +11398,7 @@ class Qa {
11398
11398
  if (this.reconnectTimer !== null || this.authenticationFailure || this.state.status === "closed")
11399
11399
  return;
11400
11400
  const n = Math.min(
11401
- Ia,
11401
+ Sa,
11402
11402
  Math.max(oy(this.reconnectAttempts), e)
11403
11403
  );
11404
11404
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
@@ -11499,7 +11499,7 @@ class Qa {
11499
11499
  this.directoryHttp.auth.token = c, a = "bootstrap", this.lastRecoveryStage = a, await this.replaceDefaultTransportCredentials(e), this.reportTransportDiagnostic("auth_refresh_validated", o);
11500
11500
  })().catch((c) => {
11501
11501
  if (this.socket !== e || this.state.status === "closed") throw c;
11502
- if (this.reportTransportDiagnostic("auth_refresh_failed", { ...o, ...this.connectionFailureDiagnostic(c, a) }), this.credentialRecoveryFailure = Bi(c), c instanceof N && ["unauthorized", "403", "update_required"].includes(c.code) || !Pr(c)) {
11502
+ if (this.reportTransportDiagnostic("auth_refresh_failed", { ...o, ...this.connectionFailureDiagnostic(c, a) }), this.credentialRecoveryFailure = Bi(c), c instanceof N && ["unauthorized", "403", "update_required"].includes(c.code) || !qr(c)) {
11503
11503
  const l = c instanceof N ? c : new N(c instanceof Ze ? c.message : "Your session could not be refreshed. Try again.", this.options.productVariant === "customer_embedded" ? "connection_failed" : "unauthorized", !1);
11504
11504
  throw this.stopAuthentication(l), l;
11505
11505
  }
@@ -11557,7 +11557,7 @@ class Qa {
11557
11557
  this.listeners[e]?.forEach((s) => s(n));
11558
11558
  }
11559
11559
  }
11560
- const Mr = /* @__PURE__ */ new WeakMap();
11560
+ const Or = /* @__PURE__ */ new WeakMap();
11561
11561
  function ay(t) {
11562
11562
  const e = window.__plunoProductAgentNetworkCapture ?? cy();
11563
11563
  return e.subscribers.add(t), () => {
@@ -11584,8 +11584,8 @@ function cy() {
11584
11584
  const _ = f instanceof Request ? f : null, S = cb(f, _), x = Bu(y?.headers ?? _?.headers);
11585
11585
  if (!Zn(S, x, y?.body)) {
11586
11586
  const w = {
11587
- requestId: Dr("fetch"),
11588
- url: Qt(S, Tr),
11587
+ requestId: Lr("fetch"),
11588
+ url: Qt(S, Pr),
11589
11589
  method: (y?.method ?? _?.method ?? "GET").toUpperCase(),
11590
11590
  requestHeaders: x,
11591
11591
  requestBody: ed(y?.body),
@@ -11616,21 +11616,21 @@ function cy() {
11616
11616
  return b;
11617
11617
  }, r = function(f, y, g, b, _) {
11618
11618
  const S = i.call(this, f, y, g ?? !0, b ?? void 0, _ ?? void 0), x = typeof y == "string" ? y : y.toString();
11619
- return Mr.set(this, {
11620
- requestId: Dr("xhr"),
11619
+ return Or.set(this, {
11620
+ requestId: Lr("xhr"),
11621
11621
  method: String(f ?? "GET").toUpperCase(),
11622
- url: Qt(x, Tr),
11622
+ url: Qt(x, Pr),
11623
11623
  requestHeaders: {},
11624
11624
  startedAtMs: Date.now(),
11625
11625
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
11626
11626
  excluded: Zn(x)
11627
11627
  }), S;
11628
11628
  }, c = function(f, y) {
11629
- const g = s.call(this, f, y), b = Mr.get(this);
11629
+ const g = s.call(this, f, y), b = Or.get(this);
11630
11630
  return b && Object.keys(b.requestHeaders).length < Ja && (b.requestHeaders[f] = Za(f, y), b.excluded = b.excluded || Zn(b.url, b.requestHeaders)), g;
11631
11631
  }, l = function(f) {
11632
11632
  try {
11633
- const y = Mr.get(this);
11633
+ const y = Or.get(this);
11634
11634
  y && (y.excluded = y.excluded || Zn(y.url, y.requestHeaders, f), y.requestBody = ed(f), y.excluded || this.addEventListener(
11635
11635
  "loadend",
11636
11636
  () => {
@@ -11687,8 +11687,8 @@ function cy() {
11687
11687
  continue;
11688
11688
  const g = performance.timeOrigin + y.startTime;
11689
11689
  e({
11690
- requestId: Dr("resource"),
11691
- url: Qt(y.name, Tr),
11690
+ requestId: Lr("resource"),
11691
+ url: Qt(y.name, Pr),
11692
11692
  method: "GET",
11693
11693
  resourceType: "resource",
11694
11694
  responseStatus: y.responseStatus,
@@ -12002,9 +12002,9 @@ function Ya() {
12002
12002
  (g) => Pu(g) && !g.parentElement?.closest(i)
12003
12003
  );
12004
12004
  for (const g of s.slice(0, 3))
12005
- n("Active overlay", Or(Yi(g), e));
12006
- const o = Ty(), a = o ? Or(Yi(o), e) : "";
12007
- n("Main page content", a), n("Additional visible page text", Or(Yi(document.body), e));
12005
+ n("Active overlay", Dr(Yi(g), e));
12006
+ const o = Ty(), a = o ? Dr(Yi(o), e) : "";
12007
+ n("Main page content", a), n("Additional visible page text", Dr(Yi(document.body), e));
12008
12008
  const r = t.map(([g, b]) => `${g}:
12009
12009
  ${b}`).join(`
12010
12010
 
@@ -12026,7 +12026,7 @@ function ai(t) {
12026
12026
 
12027
12027
  `).trim();
12028
12028
  }
12029
- function Or(t, e) {
12029
+ function Dr(t, e) {
12030
12030
  let n = ai(t);
12031
12031
  for (const i of e)
12032
12032
  n = n.replace(i, "");
@@ -12667,7 +12667,7 @@ function Qy(t, e) {
12667
12667
  }
12668
12668
  function Yy(t) {
12669
12669
  try {
12670
- const e = window.localStorage.getItem(`${Sa}${t}`);
12670
+ const e = window.localStorage.getItem(`${ka}${t}`);
12671
12671
  if (!e)
12672
12672
  return [];
12673
12673
  const n = JSON.parse(e);
@@ -12680,11 +12680,11 @@ function Dn(t, e) {
12680
12680
  try {
12681
12681
  const n = e.filter(Xa);
12682
12682
  if (n.length === 0) {
12683
- window.localStorage.removeItem(`${Sa}${t}`);
12683
+ window.localStorage.removeItem(`${ka}${t}`);
12684
12684
  return;
12685
12685
  }
12686
12686
  window.localStorage.setItem(
12687
- `${Sa}${t}`,
12687
+ `${ka}${t}`,
12688
12688
  JSON.stringify(n.slice(-25))
12689
12689
  );
12690
12690
  } catch {
@@ -12693,7 +12693,7 @@ function Dn(t, e) {
12693
12693
  }
12694
12694
  function Ou(t, e) {
12695
12695
  try {
12696
- const n = `${yo}${t}`, i = location.href, s = location.origin, o = Array.from(e, (a) => ({
12696
+ const n = `${bo}${t}`, i = location.href, s = location.origin, o = Array.from(e, (a) => ({
12697
12697
  ...a,
12698
12698
  storedAt: Date.now(),
12699
12699
  unloadUrl: i,
@@ -12709,7 +12709,7 @@ function Ou(t, e) {
12709
12709
  }
12710
12710
  function Xl(t, e) {
12711
12711
  try {
12712
- if (window.sessionStorage.getItem(`${yo}${t}`) === null)
12712
+ if (window.sessionStorage.getItem(`${bo}${t}`) === null)
12713
12713
  return;
12714
12714
  } catch {
12715
12715
  return;
@@ -12718,7 +12718,7 @@ function Xl(t, e) {
12718
12718
  }
12719
12719
  function Xy(t) {
12720
12720
  try {
12721
- const e = `${yo}${t}`, n = window.sessionStorage.getItem(e);
12721
+ const e = `${bo}${t}`, n = window.sessionStorage.getItem(e);
12722
12722
  if (window.sessionStorage.removeItem(e), !n)
12723
12723
  return [];
12724
12724
  const i = JSON.parse(n);
@@ -12766,7 +12766,7 @@ function tb(t, e) {
12766
12766
  }
12767
12767
  function nb(t) {
12768
12768
  try {
12769
- window.sessionStorage.removeItem(`${yo}${t}`);
12769
+ window.sessionStorage.removeItem(`${bo}${t}`);
12770
12770
  } catch {
12771
12771
  return;
12772
12772
  }
@@ -12881,7 +12881,7 @@ function Bu(t) {
12881
12881
  return e;
12882
12882
  }
12883
12883
  function Za(t, e) {
12884
- return Vu(t) ? bo : Qt(so(e), ty);
12884
+ return Vu(t) ? wo : Qt(oo(e), ty);
12885
12885
  }
12886
12886
  function cb(t, e) {
12887
12887
  return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
@@ -12952,11 +12952,11 @@ function td(t) {
12952
12952
  return t;
12953
12953
  const e = t.trim();
12954
12954
  if (!e.startsWith("{") && !e.startsWith("["))
12955
- return so(t);
12955
+ return oo(t);
12956
12956
  try {
12957
12957
  return JSON.stringify(mt(JSON.parse(t)));
12958
12958
  } catch {
12959
- return so(t);
12959
+ return oo(t);
12960
12960
  }
12961
12961
  }
12962
12962
  function ju(t) {
@@ -13010,7 +13010,7 @@ function fb(t) {
13010
13010
  function Qt(t, e = Ga) {
13011
13011
  return t.length <= e ? t : `${t.slice(0, e)}... [truncated ${t.length - e} chars]`;
13012
13012
  }
13013
- function Dr(t) {
13013
+ function Lr(t) {
13014
13014
  return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
13015
13015
  }
13016
13016
  class Fu extends Error {
@@ -13046,13 +13046,13 @@ function wb(t) {
13046
13046
  function _b(t) {
13047
13047
  return t === 401 || t === 403;
13048
13048
  }
13049
- const bo = "[REDACTED_SECRET]", Yt = "[REDACTED_TOKEN]", vb = "[REDACTED_SIGNED_URL]", Ib = 20, Sb = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, $u = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Hu = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Ku = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Wu = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, kb = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, xb = /\bhttps?:\/\/[^\s"'<>]+/gi, Eb = /[),.;\]]+$/;
13049
+ const wo = "[REDACTED_SECRET]", Yt = "[REDACTED_TOKEN]", vb = "[REDACTED_SIGNED_URL]", Ib = 20, Sb = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, $u = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Hu = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Ku = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Wu = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, kb = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, xb = /\bhttps?:\/\/[^\s"'<>]+/gi, Eb = /[),.;\]]+$/;
13050
13050
  function mt(t) {
13051
- return io(t, 0, /* @__PURE__ */ new WeakSet());
13051
+ return so(t, 0, /* @__PURE__ */ new WeakSet());
13052
13052
  }
13053
- function io(t, e, n) {
13053
+ function so(t, e, n) {
13054
13054
  if (typeof t == "string")
13055
- return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : so(t);
13055
+ return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : oo(t);
13056
13056
  if (t === null || typeof t != "object")
13057
13057
  return t;
13058
13058
  if (e >= Ib)
@@ -13060,10 +13060,10 @@ function io(t, e, n) {
13060
13060
  if (n.has(t))
13061
13061
  return "[REDACTED_CIRCULAR]";
13062
13062
  if (n.add(t), Array.isArray(t))
13063
- return t.map((s) => io(s, e + 1, n));
13063
+ return t.map((s) => so(s, e + 1, n));
13064
13064
  const i = {};
13065
13065
  for (const [s, o] of Object.entries(t))
13066
- s === "pageContent" ? i[s] = o : Vu(s) ? i[s] = bo : i[s] = s.toLowerCase() === "url" ? Cb(o) : io(o, e + 1, n);
13066
+ s === "pageContent" ? i[s] = o : Vu(s) ? i[s] = wo : i[s] = s.toLowerCase() === "url" ? Cb(o) : so(o, e + 1, n);
13067
13067
  return i;
13068
13068
  }
13069
13069
  function Vu(t) {
@@ -13071,7 +13071,7 @@ function Vu(t) {
13071
13071
  return e.includes("authorization") || e.includes("cookie") || e.includes("password") || e.includes("passwd") || e === "pwd" || e.includes("secret") || e === "token" || e.endsWith("token") || e.includes("apikey") || e.includes("csrf") || e.includes("xsrf") || e === "jwt" || e === "session" || e === "signature" || e.includes("privatekey");
13072
13072
  }
13073
13073
  function Cb(t) {
13074
- return typeof t == "string" ? Gu(t) : io(t, 0, /* @__PURE__ */ new WeakSet());
13074
+ return typeof t == "string" ? Gu(t) : so(t, 0, /* @__PURE__ */ new WeakSet());
13075
13075
  }
13076
13076
  function Gu(t) {
13077
13077
  try {
@@ -13083,11 +13083,11 @@ function Gu(t) {
13083
13083
  return Ab(t);
13084
13084
  }
13085
13085
  }
13086
- function so(t) {
13087
- return t.replace(kb, vb).replace(xb, Rb).replace($u, `Bearer ${Yt}`).replace(Hu, `Basic ${Yt}`).replace(Ku, Yt).replace(Wu, (e, n) => `${n}: ${bo}`);
13086
+ function oo(t) {
13087
+ return t.replace(kb, vb).replace(xb, Rb).replace($u, `Bearer ${Yt}`).replace(Hu, `Basic ${Yt}`).replace(Ku, Yt).replace(Wu, (e, n) => `${n}: ${wo}`);
13088
13088
  }
13089
13089
  function Ab(t) {
13090
- return t.replace($u, `Bearer ${Yt}`).replace(Hu, `Basic ${Yt}`).replace(Ku, Yt).replace(Wu, (e, n) => `${n}: ${bo}`);
13090
+ return t.replace($u, `Bearer ${Yt}`).replace(Hu, `Basic ${Yt}`).replace(Ku, Yt).replace(Wu, (e, n) => `${n}: ${wo}`);
13091
13091
  }
13092
13092
  function Rb(t) {
13093
13093
  const e = t.match(Eb)?.[0] ?? "", n = e ? t.slice(0, -e.length) : t;
@@ -13095,17 +13095,17 @@ function Rb(t) {
13095
13095
  }
13096
13096
  const Tb = Object.freeze({
13097
13097
  init: (t) => Qa.init(t)
13098
- }), Pb = "#7c3aed", oo = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", ro = "#2c2a1e", nd = [253, 250, 241], id = 3.5;
13098
+ }), Pb = "#7c3aed", ro = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", ao = "#2c2a1e", nd = [253, 250, 241], id = 3.5;
13099
13099
  function Ju(t) {
13100
13100
  const e = Qu(t);
13101
13101
  if (sd(Xi(e), nd) >= id)
13102
13102
  return e;
13103
13103
  let i = Xi(e);
13104
- const s = Xi(ro);
13104
+ const s = Xi(ao);
13105
13105
  for (let o = 0; o < 6; o += 1)
13106
13106
  if (i = Ob(i, s, 0.22), sd(i, nd) >= id)
13107
- return ka(i);
13108
- return ka(i);
13107
+ return xa(i);
13108
+ return xa(i);
13109
13109
  }
13110
13110
  function qb() {
13111
13111
  let n = "M 280 120", i = !1, s = 0;
@@ -13116,7 +13116,7 @@ function qb() {
13116
13116
  return n;
13117
13117
  }
13118
13118
  function Mb(t) {
13119
- const e = Qu(t), n = xa(Xi(e));
13119
+ const e = Qu(t), n = Ea(Xi(e));
13120
13120
  return n > 0.86 ? {
13121
13121
  top: "#ffffff",
13122
13122
  middle: "#f6f6f6",
@@ -13163,11 +13163,11 @@ function Xi(t) {
13163
13163
  Number.parseInt(t.slice(5, 7), 16)
13164
13164
  ];
13165
13165
  }
13166
- function ka([t, e, n]) {
13166
+ function xa([t, e, n]) {
13167
13167
  const i = (s) => Math.max(0, Math.min(255, Math.round(s))).toString(16).padStart(2, "0");
13168
13168
  return `#${i(t)}${i(e)}${i(n)}`;
13169
13169
  }
13170
- function xa([t, e, n]) {
13170
+ function Ea([t, e, n]) {
13171
13171
  const i = (s) => {
13172
13172
  const o = s / 255;
13173
13173
  return o <= 0.04045 ? o / 12.92 : ((o + 0.055) / 1.055) ** 2.4;
@@ -13175,11 +13175,11 @@ function xa([t, e, n]) {
13175
13175
  return 0.2126 * i(t) + 0.7152 * i(e) + 0.0722 * i(n);
13176
13176
  }
13177
13177
  function sd(t, e) {
13178
- const n = xa(t), i = xa(e), [s, o] = n > i ? [n, i] : [i, n];
13178
+ const n = Ea(t), i = Ea(e), [s, o] = n > i ? [n, i] : [i, n];
13179
13179
  return (s + 0.05) / (o + 0.05);
13180
13180
  }
13181
13181
  function Ob(t, e, n) {
13182
- const i = Ea(n);
13182
+ const i = Ca(n);
13183
13183
  return [
13184
13184
  t[0] + (e[0] - t[0]) * i,
13185
13185
  t[1] + (e[1] - t[1]) * i,
@@ -13188,7 +13188,7 @@ function Ob(t, e, n) {
13188
13188
  }
13189
13189
  function Dt(t, e, n) {
13190
13190
  const [i, s, o] = Db(Xi(t));
13191
- return ka(Lb(i, Ea(s + n), Ea(o + e)));
13191
+ return xa(Lb(i, Ca(s + n), Ca(o + e)));
13192
13192
  }
13193
13193
  function Db([t, e, n]) {
13194
13194
  const i = t / 255, s = e / 255, o = n / 255, a = Math.max(i, s, o), r = Math.min(i, s, o), c = (a + r) / 2;
@@ -13202,16 +13202,16 @@ function Lb(t, e, n) {
13202
13202
  return [n * 255, n * 255, n * 255];
13203
13203
  const i = n < 0.5 ? n * (1 + e) : n + e - n * e, s = 2 * n - i;
13204
13204
  return [
13205
- Lr(s, i, t + 1 / 3) * 255,
13206
- Lr(s, i, t) * 255,
13207
- Lr(s, i, t - 1 / 3) * 255
13205
+ Nr(s, i, t + 1 / 3) * 255,
13206
+ Nr(s, i, t) * 255,
13207
+ Nr(s, i, t - 1 / 3) * 255
13208
13208
  ];
13209
13209
  }
13210
- function Lr(t, e, n) {
13210
+ function Nr(t, e, n) {
13211
13211
  let i = n;
13212
13212
  return i < 0 && (i += 1), i > 1 && (i -= 1), i < 1 / 6 ? t + (e - t) * 6 * i : i < 1 / 2 ? e : i < 2 / 3 ? t + (e - t) * (2 / 3 - i) * 6 : t;
13213
13213
  }
13214
- function Ea(t) {
13214
+ function Ca(t) {
13215
13215
  return Math.max(0, Math.min(1, t));
13216
13216
  }
13217
13217
  const Yu = [
@@ -13304,7 +13304,7 @@ function Kb(t, e) {
13304
13304
  (i, s) => e && s === n && !i.terminal
13305
13305
  );
13306
13306
  }
13307
- const Wb = 80, Vb = 64e3, rd = 60, Nr = 160;
13307
+ const Wb = 80, Vb = 64e3, rd = 60, Ur = 160;
13308
13308
  function Gb(t, e, n, i) {
13309
13309
  const s = /* @__PURE__ */ new Map(), o = [], a = [];
13310
13310
  let r = 0, c = 0, l = 0, u = crypto.randomUUID(), d = i.getState();
@@ -13330,7 +13330,7 @@ function Gb(t, e, n, i) {
13330
13330
  Oe(), C = null, U !== null && _.clearTimeout(U), U = null, S = void 0, x = void 0, m.clear(), T.clear(), k !== null && _.clearTimeout(k), k = null, V && E.clear();
13331
13331
  }
13332
13332
  function Ae() {
13333
- if (Js(e) !== "none") {
13333
+ if (Qs(e) !== "none") {
13334
13334
  we(!0);
13335
13335
  return;
13336
13336
  }
@@ -13404,14 +13404,14 @@ function Gb(t, e, n, i) {
13404
13404
  J.before && (J.before.context = x);
13405
13405
  const H = Math.floor(X - $.monotonicMs);
13406
13406
  J.current.context = {
13407
- ...Qr(e, d, { renderSource: "observer" }),
13407
+ ...Yr(e, d, { renderSource: "observer" }),
13408
13408
  firstObservedAt: $.occurredAt,
13409
13409
  confirmationMs: H
13410
13410
  }, i.reportInvalidStateTransition?.(`ui_invariant:${D}`, void 0, J);
13411
13411
  } else
13412
13412
  T.set(D, $);
13413
13413
  }
13414
- ce.length === 0 && P && (S = De, x = Qr(e, d, { renderSource: "observer" }), m = new Map(Array.from(e.querySelectorAll("[data-terminal-response-key][data-canonical-item-key]")).map((D) => [D.dataset.terminalResponseKey, D.dataset.canonicalItemKey]))), k !== null && _.clearTimeout(k), k = T.size ? _.setTimeout(() => {
13414
+ ce.length === 0 && P && (S = De, x = Yr(e, d, { renderSource: "observer" }), m = new Map(Array.from(e.querySelectorAll("[data-terminal-response-key][data-canonical-item-key]")).map((D) => [D.dataset.terminalResponseKey, D.dataset.canonicalItemKey]))), k !== null && _.clearTimeout(k), k = T.size ? _.setTimeout(() => {
13415
13415
  k = null, Ae();
13416
13416
  }, Math.max(1, 250 - (X - Math.min(...Array.from(T.values(), (D) => D.monotonicMs))))) : null;
13417
13417
  }
@@ -13419,17 +13419,17 @@ function Gb(t, e, n, i) {
13419
13419
  const oe = V !== "runtime", K = oe ? e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]") : null, ie = K?.length ?? d.messages.length, ye = [];
13420
13420
  for (let Y = Math.max(0, ie - rd); Y < ie; Y += 1) {
13421
13421
  const X = K ? K[Y].dataset.messageKey ?? K[Y].dataset.entryKey : d.messages[Y].id;
13422
- X && ye.push(X.slice(0, Nr));
13422
+ X && ye.push(X.slice(0, Ur));
13423
13423
  }
13424
13424
  const G = {
13425
- session_id: d.sessionId?.slice(0, Nr) ?? null,
13426
- run_id: (d.assistantDraftRunId ?? d.messages[d.messages.length - 1]?.runId)?.slice(0, Nr) ?? null,
13425
+ session_id: d.sessionId?.slice(0, Ur) ?? null,
13426
+ run_id: (d.assistantDraftRunId ?? d.messages[d.messages.length - 1]?.runId)?.slice(0, Ur) ?? null,
13427
13427
  item_keys: ye,
13428
13428
  item_count: ie,
13429
13429
  items_truncated: ie > rd,
13430
13430
  thinking: d.isThinking,
13431
13431
  loading: d.isLoadingSession,
13432
- welcome: oe && Js(e) === "none" && !!e.querySelector(".pluno-pa-widget__empty-state--starter, .empty-state--starter"),
13432
+ welcome: oe && Qs(e) === "none" && !!e.querySelector(".pluno-pa-widget__empty-state--starter, .empty-state--starter"),
13433
13433
  error: !!d.lastError,
13434
13434
  connected: d.status === "connected",
13435
13435
  visible: e.getClientRects().length > 0,
@@ -13526,7 +13526,7 @@ function Gb(t, e, n, i) {
13526
13526
  }
13527
13527
  const Jb = 6e4, Qb = [100, 500, 1500, 4e3];
13528
13528
  let Yb = 0;
13529
- const Xb = "product-agent:sdk-preview-socket-connect", Zb = "product-agent:sdk-preview-socket-send", ew = "product-agent:sdk-preview-socket-close", tw = "product-agent:sdk-preview-socket-open", nw = "product-agent:sdk-preview-socket-message", iw = "product-agent:sdk-preview-socket-error", sw = "product-agent:sdk-preview-socket-closed", ad = "product-agent:sdk-preview-socket-id", Xu = "data-pluno-auto-mounted", Kt = "__plunoProductAgentAutoMountOwner", ow = "pluno.productAgent.widgetClientId.", Ur = /* @__PURE__ */ new Set(), rw = "product-agent:preview-diagnostic", aw = 3, cd = 'dialog[open], [aria-modal="true"], [role="dialog"]', ld = 1500, cw = 5e3, lw = 500, dw = "Could not load recent chats. Please try again.", Wt = {
13529
+ const Xb = "product-agent:sdk-preview-socket-connect", Zb = "product-agent:sdk-preview-socket-send", ew = "product-agent:sdk-preview-socket-close", tw = "product-agent:sdk-preview-socket-open", nw = "product-agent:sdk-preview-socket-message", iw = "product-agent:sdk-preview-socket-error", sw = "product-agent:sdk-preview-socket-closed", ad = "product-agent:sdk-preview-socket-id", Xu = "data-pluno-auto-mounted", Kt = "__plunoProductAgentAutoMountOwner", ow = "pluno.productAgent.widgetClientId.", zr = /* @__PURE__ */ new Set(), rw = "product-agent:preview-diagnostic", aw = 3, cd = 'dialog[open], [aria-modal="true"], [role="dialog"]', ld = 1500, cw = 5e3, lw = 500, dw = "Could not load recent chats. Please try again.", Wt = {
13530
13530
  launcherLabel: "Ask for anything...",
13531
13531
  accentColor: "#7c3aed",
13532
13532
  colorScheme: "light",
@@ -13534,7 +13534,7 @@ const Xb = "product-agent:sdk-preview-socket-connect", Zb = "product-agent:sdk-p
13534
13534
  scribbleStyle: !0,
13535
13535
  position: "bottom-right",
13536
13536
  movableLauncher: !0
13537
- }, uw = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', dd = "pluno-pa-scribble-font", Zu = 190, ep = 41, pw = 22, hw = 32, gw = 1, fw = 48, ec = 420, mw = 520, yw = 0.24, tc = 680, bw = 800, ww = 0.76, ge = 8, Vn = 50, Ca = 12, tp = "http://www.w3.org/2000/svg", Aa = 26, Ra = 8, _w = 36, Ta = 16, vw = 4, ud = [
13537
+ }, uw = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', dd = "pluno-pa-scribble-font", Zu = 190, ep = 41, pw = 22, hw = 32, gw = 1, fw = 48, ec = 420, mw = 520, yw = 0.24, tc = 680, bw = 800, ww = 0.76, ge = 8, Vn = 50, Aa = 12, tp = "http://www.w3.org/2000/svg", Ra = 26, Ta = 8, _w = 36, Pa = 16, vw = 4, ud = [
13538
13538
  {
13539
13539
  ellipseCx: "17.5",
13540
13540
  ellipseCy: "24.5",
@@ -13571,7 +13571,7 @@ const Xb = "product-agent:sdk-preview-socket-connect", Zb = "product-agent:sdk-p
13571
13571
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
13572
13572
  pathStrokeWidth: "2.45"
13573
13573
  }
13574
- ], Iw = 11, Sw = 13, ao = 4, nc = 10, ic = 40, kw = "movable-launcher-position-v2", np = "pluno-pa-widget-styles", ip = "data-pluno-pa-widget-styles", xw = "__plunoExtensionWidgetOwner";
13574
+ ], Iw = 11, Sw = 13, co = 4, nc = 10, ic = 40, kw = "movable-launcher-position-v2", np = "pluno-pa-widget-styles", ip = "data-pluno-pa-widget-styles", xw = "__plunoExtensionWidgetOwner";
13575
13575
  let pd = 0;
13576
13576
  function Ew(t) {
13577
13577
  return (e) => new Vt(e, t);
@@ -13691,7 +13691,7 @@ async function Cw(t = {}) {
13691
13691
  `${e.mobilePanelTopOffset}px`
13692
13692
  ), l.classList.add(`pluno-pa-widget--${e.colorScheme}`), e.scribbleStyle && l.classList.add("pluno-pa-widget--scribble"), p === "minimized" && (l.classList.add("pluno-pa-widget--minimized"), hn(
13693
13693
  l,
13694
- Br(
13694
+ jr(
13695
13695
  l,
13696
13696
  f,
13697
13697
  e.position
@@ -13854,18 +13854,18 @@ async function Cw(t = {}) {
13854
13854
  st === "error"
13855
13855
  ), ss();
13856
13856
  };
13857
- let Io = !1;
13858
- const So = () => {
13857
+ let So = !1;
13858
+ const ko = () => {
13859
13859
  if (i()) {
13860
13860
  te.hidden = !0, te.replaceChildren();
13861
13861
  return;
13862
13862
  }
13863
- e.billingStatus?.usingPaidCreditFallback !== !0 && (Io = !1), __(
13863
+ e.billingStatus?.usingPaidCreditFallback !== !0 && (So = !1), __(
13864
13864
  te,
13865
13865
  e.billingStatus,
13866
- Io,
13866
+ So,
13867
13867
  () => {
13868
- Io = !0, So();
13868
+ So = !0, ko();
13869
13869
  }
13870
13870
  );
13871
13871
  };
@@ -13878,7 +13878,7 @@ async function Cw(t = {}) {
13878
13878
  let St = 0, en = 0, uc = 0;
13879
13879
  const qt = /* @__PURE__ */ new Map();
13880
13880
  let tn = null, Bt = null;
13881
- const ko = (h) => h === F ? "widget_composer" : h === I ? "widget_launcher" : h && c.contains(h) ? "widget_control" : h === x.body ? "body" : h === x.documentElement ? "document" : h ? "host_page" : "none", _n = (h, v, A = {}) => {
13881
+ const xo = (h) => h === F ? "widget_composer" : h === I ? "widget_launcher" : h && c.contains(h) ? "widget_control" : h === x.body ? "body" : h === x.documentElement ? "document" : h ? "host_page" : "none", _n = (h, v, A = {}) => {
13882
13882
  const R = qs(x), j = A.skipIfAlreadyFocused === !0 && R === h;
13883
13883
  j || (A.preventScroll ? h.focus({ preventScroll: !0 }) : h.focus());
13884
13884
  const ee = qs(x);
@@ -13890,9 +13890,9 @@ async function Cw(t = {}) {
13890
13890
  mountId: o,
13891
13891
  widgetAgeMs: Date.now() - a,
13892
13892
  scheduledDelayMs: A.scheduledAt === void 0 ? null : Date.now() - A.scheduledAt,
13893
- previousFocus: ko(R),
13894
- requestedFocus: ko(h),
13895
- resultingFocus: ko(ee),
13893
+ previousFocus: xo(R),
13894
+ requestedFocus: xo(h),
13895
+ resultingFocus: xo(ee),
13896
13896
  focusSkipped: j,
13897
13897
  focusSucceeded: ee === h,
13898
13898
  hostConnected: r.isConnected,
@@ -13922,7 +13922,7 @@ async function Cw(t = {}) {
13922
13922
  ) : void 0);
13923
13923
  if (!e.loginRequired && !e.signupRequired && !e.token && !pc && !e.webSocketFactory && !e.runtimeClient)
13924
13924
  throw new Error("Pluno widget requires token or tokenEndpoint");
13925
- const xo = e.runtimeClient === void 0, Eo = xo ? iv(e.clientId) : null;
13925
+ const Eo = e.runtimeClient === void 0, Co = Eo ? iv(e.clientId) : null;
13926
13926
  let O;
13927
13927
  try {
13928
13928
  if (e.runtimeClient)
@@ -13940,7 +13940,7 @@ async function Cw(t = {}) {
13940
13940
  }),
13941
13941
  entrySurface: e.entrySurface ?? (e.extensionRuntime ? "extension_widget" : "embedded_widget"),
13942
13942
  initialStarterPrompts: e.initialStarterPrompts,
13943
- clientId: Eo.clientId,
13943
+ clientId: Co.clientId,
13944
13944
  restorePersistedState: e.restorePersistedState,
13945
13945
  expectedPersistedSessionId: e.expectedPersistedSessionId,
13946
13946
  runtimeCommunityId: e.runtimeCommunityId,
@@ -13986,22 +13986,22 @@ async function Cw(t = {}) {
13986
13986
  O = await Tb.init(h);
13987
13987
  }
13988
13988
  } catch (h) {
13989
- throw Eo?.release(), r.remove(), h;
13989
+ throw Co?.release(), r.remove(), h;
13990
13990
  }
13991
13991
  let pi = O.getState().sessionId, hi = O.getState().selectionKey, vn = O.getState().user?.id ?? null;
13992
- const Co = (e.productVariant === "personal" ? Nn(e.model) : e.model) ?? (e.productVariant === "personal" ? Qi[0].value : "gpt-5.6-terra");
13993
- let ot = Co, hc = !1, Ao = O.getAccount()?.auth?.workspace?.id ?? null;
13992
+ const Ao = (e.productVariant === "personal" ? Nn(e.model) : e.model) ?? (e.productVariant === "personal" ? Qi[0].value : "gpt-5.6-terra");
13993
+ let ot = Ao, hc = !1, Ro = O.getAccount()?.auth?.workspace?.id ?? null;
13994
13994
  const gc = e.productVariant === "personal" && e.onModelChange !== void 0;
13995
13995
  Z.hidden = !gc;
13996
13996
  const gi = () => {
13997
- const h = Qs.find((v) => v.value === ot);
13997
+ const h = Ys.find((v) => v.value === ot);
13998
13998
  nt.textContent = h?.label ?? ot;
13999
13999
  for (const v of Ge) {
14000
14000
  const A = v.dataset.model === ot;
14001
14001
  v.classList.toggle("is-selected", A), v.setAttribute("aria-selected", String(A));
14002
14002
  }
14003
14003
  }, xp = (h) => {
14004
- ot = h, xo && O.setModel(h), gi();
14004
+ ot = h, Eo && O.setModel(h), gi();
14005
14005
  };
14006
14006
  gi(), Z.addEventListener("toggle", () => {
14007
14007
  Z.open || Z.querySelector(".pluno-pa-widget__model-more")?.removeAttribute("open");
@@ -14012,7 +14012,7 @@ async function Cw(t = {}) {
14012
14012
  x.addEventListener("pointerdown", fc, !0);
14013
14013
  for (const h of Ge)
14014
14014
  h.addEventListener("click", () => {
14015
- const v = Qs.find((A) => A.value === h.dataset.model);
14015
+ const v = Ys.find((A) => A.value === h.dataset.model);
14016
14016
  if (!v || v.value === ot) {
14017
14017
  Z.open = !1;
14018
14018
  return;
@@ -14034,46 +14034,46 @@ async function Cw(t = {}) {
14034
14034
  cssAccent: l.style.getPropertyValue("--pluno-pa-accent")
14035
14035
  }
14036
14036
  );
14037
- const Ro = new Set(d.openToolGroupKeys);
14037
+ const To = new Set(d.openToolGroupKeys);
14038
14038
  let kt = null, sn = null, Ue = !1, on = !1, jt = {
14039
14039
  enabled: !0
14040
- }, rn = 0, To = null, In = null, Sn = null, rs = null, fi = !1, be = null, mc = "local";
14040
+ }, rn = 0, Po = null, In = null, Sn = null, rs = null, fi = !1, be = null, mc = "local";
14041
14041
  const yc = (h) => pi !== null && pi !== h.sessionId || vn !== null && vn !== (h.user?.id ?? null) || hi !== void 0 && hi !== h.selectionKey, bc = (h) => dh(G, h, {
14042
14042
  renderSource: mc,
14043
14043
  guardCreatedAt: be?.createdAt ?? null,
14044
14044
  selectionFencePending: yc(h)
14045
14045
  }), as = /* @__PURE__ */ new Set();
14046
- let mi = "", He = !1, pt = null, wc = location.origin, _c = O.getState().sessionId, vc = O.getState().user?.id ?? null, Po = O.getState().status, Ft = () => {
14047
- }, qo = "", Qe = O.getSessionHistoryState();
14046
+ let mi = "", He = !1, pt = null, wc = location.origin, _c = O.getState().sessionId, vc = O.getState().user?.id ?? null, qo = O.getState().status, Ft = () => {
14047
+ }, Mo = "", Qe = O.getSessionHistoryState();
14048
14048
  const Ep = O.subscribeSessionHistory((h) => {
14049
14049
  Qe = h, Ue || Ft();
14050
14050
  }), ht = (h, v) => {
14051
14051
  jt = { enabled: h, reason: v };
14052
14052
  }, xt = () => {
14053
14053
  ie.hidden = !0;
14054
- }, Mo = () => {
14054
+ }, Oo = () => {
14055
14055
  G.clientHeight === 0 || G.scrollHeight - G.scrollTop - G.clientHeight > 1 || (ht(!0, "bottom"), xt());
14056
- }, Oo = (h, v, A) => {
14056
+ }, Do = (h, v, A) => {
14057
14057
  const R = `${h}:${v ?? "current-view"}`;
14058
14058
  as.has(R) || (as.add(R), O.reportInvalidStateTransition?.(h, v, A));
14059
14059
  }, Cp = () => {
14060
- rg(fi, Oo), ie.hidden = !1;
14060
+ rg(fi, Do), ie.hidden = !1;
14061
14061
  }, Ic = () => {
14062
- be?.observedConversation && G.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report)") && (be.observedWelcome ??= bc(O.getState())), be?.observedWelcome && !be.pendingSubmission && (Oo("submitted_turn_returned_to_welcome_without_new_chat", be.clientMessageId, {
14062
+ be?.observedConversation && G.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report)") && (be.observedWelcome ??= bc(O.getState())), be?.observedWelcome && !be.pendingSubmission && (Do("submitted_turn_returned_to_welcome_without_new_chat", be.clientMessageId, {
14063
14063
  before: be.observedConversation,
14064
14064
  current: be.observedWelcome
14065
14065
  }), be = null);
14066
14066
  }, Ap = (h = "jump") => {
14067
14067
  ht(!0, h), xt(), ei(G, () => jt.enabled), rn = G.scrollTop;
14068
14068
  }, cs = (h) => {
14069
- To = h, h === "up" && G.scrollTop < rn - 1 && (fi = !0, ht(!1, "userScroll")), In !== null && window.clearTimeout(In), In = window.setTimeout(() => {
14070
- To = null, In = null;
14069
+ Po = h, h === "up" && G.scrollTop < rn - 1 && (fi = !0, ht(!1, "userScroll")), In !== null && window.clearTimeout(In), In = window.setTimeout(() => {
14070
+ Po = null, In = null;
14071
14071
  }, 500);
14072
14072
  };
14073
14073
  Ft = () => {
14074
14074
  const h = gh(Qe.data), v = Qe.status === "loading" || Qe.status === "refreshing" || Qe.status === "loading_more";
14075
14075
  if (ve.hidden = e.layout === "page" || i(), i() && (He = !1), it.hidden = !He, ve.setAttribute("aria-expanded", String(He)), !He) {
14076
- qo = "";
14076
+ Mo = "";
14077
14077
  return;
14078
14078
  }
14079
14079
  const A = JSON.stringify([
@@ -14082,8 +14082,8 @@ async function Cw(t = {}) {
14082
14082
  O.getState().sessionId,
14083
14083
  h.map((R) => vd(R.lastActiveAt, Date.now()))
14084
14084
  ]);
14085
- if (A !== qo) {
14086
- if (qo = A, V.classList.toggle(
14085
+ if (A !== Mo) {
14086
+ if (Mo = A, V.classList.toggle(
14087
14087
  "pluno-pa-widget__history-list--center",
14088
14088
  v && h.length === 0
14089
14089
  ), V.replaceChildren(), v && h.length === 0) {
@@ -14114,7 +14114,7 @@ async function Cw(t = {}) {
14114
14114
  oe.textContent = (Qe.status === "error" ? dw : null) ?? (!v && h.length === 0 ? "No recent chats for this page yet." : ""), oe.hidden = oe.textContent.length === 0, oe.classList.toggle("pluno-pa-widget__history-error", Qe.status === "error"), K.hidden = Qe.status !== "error", K.disabled = v;
14115
14115
  }
14116
14116
  };
14117
- const Do = (h = !1) => {
14117
+ const Lo = (h = !1) => {
14118
14118
  if (pt !== null && (window.clearTimeout(pt), pt = null), !(e.layout === "page" || e.loginRequired || e.signupRequired || ke || !h && O.getState().status !== "connected"))
14119
14119
  return ke = !0, O.refreshSessionHistory().catch(() => {
14120
14120
  }).finally(() => {
@@ -14122,13 +14122,13 @@ async function Cw(t = {}) {
14122
14122
  });
14123
14123
  };
14124
14124
  K.addEventListener("click", () => {
14125
- K.disabled = !0, Promise.resolve(Do(!0)).finally(() => {
14125
+ K.disabled = !0, Promise.resolve(Lo(!0)).finally(() => {
14126
14126
  K.disabled = !1;
14127
14127
  });
14128
14128
  });
14129
- const Lo = () => {
14129
+ const No = () => {
14130
14130
  pt === null && (pt = window.setTimeout(() => {
14131
- pt = null, !(Ue || !l.classList.contains("pluno-pa-widget--open")) && Do();
14131
+ pt = null, !(Ue || !l.classList.contains("pluno-pa-widget--open")) && Lo();
14132
14132
  }, 0));
14133
14133
  }, Rp = () => {
14134
14134
  const h = Qe.data?.nextCursor ?? null;
@@ -14155,7 +14155,7 @@ async function Cw(t = {}) {
14155
14155
  ov(e, {
14156
14156
  isOpen: l.classList.contains("pluno-pa-widget--open"),
14157
14157
  composerValue: F.value,
14158
- openToolGroupKeys: [...Ro],
14158
+ openToolGroupKeys: [...To],
14159
14159
  launcherPosition: y ? f : null,
14160
14160
  panelSize: g
14161
14161
  });
@@ -14169,7 +14169,7 @@ async function Cw(t = {}) {
14169
14169
  }
14170
14170
  kt !== null && (window.clearTimeout(kt), kt = null), l.classList.remove("pluno-pa-widget--open"), l.classList.remove("pluno-pa-widget--closing"), l.classList.add("pluno-pa-widget--minimized"), m.hidden = !1, m.setAttribute("role", "button"), m.setAttribute("aria-label", "Open Pluno"), k.hidden = !0, B.hidden = !0, m.tabIndex = 0, F.value = "", dt(), hn(
14171
14171
  l,
14172
- Br(
14172
+ jr(
14173
14173
  l,
14174
14174
  f,
14175
14175
  e.position
@@ -14186,9 +14186,9 @@ async function Cw(t = {}) {
14186
14186
  right: l.style.right,
14187
14187
  bottom: l.style.bottom
14188
14188
  },
14189
- rootRect: $r(l),
14190
- launcherRect: $r(m),
14191
- panelRect: $r(k),
14189
+ rootRect: Hr(l),
14190
+ launcherRect: Hr(m),
14191
+ panelRect: Hr(k),
14192
14192
  viewport: tt(),
14193
14193
  panelHidden: k.hidden,
14194
14194
  closeHidden: B.hidden,
@@ -14213,14 +14213,14 @@ async function Cw(t = {}) {
14213
14213
  x: h.x - v.x,
14214
14214
  y: h.y - v.y
14215
14215
  });
14216
- }, No = () => {
14216
+ }, Uo = () => {
14217
14217
  const h = zn(g).width;
14218
14218
  return k.getBoundingClientRect().width || h;
14219
14219
  }, xc = () => {
14220
14220
  if (l.classList.contains("pluno-pa-widget--minimized")) {
14221
14221
  hn(
14222
14222
  l,
14223
- Br(
14223
+ jr(
14224
14224
  l,
14225
14225
  f,
14226
14226
  e.position
@@ -14230,14 +14230,14 @@ async function Cw(t = {}) {
14230
14230
  }
14231
14231
  const h = wi();
14232
14232
  if (l.classList.contains("pluno-pa-widget--open") || l.classList.contains("pluno-pa-widget--closing")) {
14233
- zr(l, g);
14233
+ Br(l, g);
14234
14234
  const v = zn(g);
14235
- Hr(
14235
+ Kr(
14236
14236
  q,
14237
- No()
14237
+ Uo()
14238
14238
  );
14239
14239
  const A = Gi(
14240
- b ? Gs(b, v) : Fr(
14240
+ b ? Gs(b, v) : $r(
14241
14241
  l,
14242
14242
  h,
14243
14243
  e.position,
@@ -14267,7 +14267,7 @@ async function Cw(t = {}) {
14267
14267
  h,
14268
14268
  A
14269
14269
  );
14270
- f = jr(
14270
+ f = Fr(
14271
14271
  R,
14272
14272
  A
14273
14273
  ), b = null, hn(l, R), ss(), kn("Dragging closed launcher", {
@@ -14277,12 +14277,12 @@ async function Cw(t = {}) {
14277
14277
  persist: () => {
14278
14278
  y = !0, Ye(), kn("Persisted closed launcher drag position");
14279
14279
  }
14280
- })) : hn(l, null), zr(l, g);
14280
+ })) : hn(l, null), Br(l, g);
14281
14281
  const Cc = () => {
14282
14282
  const h = zn(g), v = yi();
14283
14283
  return {
14284
14284
  position: Gi(
14285
- b ? Gs(b, h) : Fr(
14285
+ b ? Gs(b, h) : $r(
14286
14286
  l,
14287
14287
  v,
14288
14288
  e.position,
@@ -14293,15 +14293,15 @@ async function Cw(t = {}) {
14293
14293
  size: h
14294
14294
  };
14295
14295
  }, Tp = (h) => {
14296
- g = wo(h.size), zr(l, g), Hr(
14296
+ g = _o(h.size), Br(l, g), Kr(
14297
14297
  q,
14298
- No()
14298
+ Uo()
14299
14299
  );
14300
14300
  const v = Gi(
14301
14301
  h.position,
14302
14302
  zn(g)
14303
14303
  );
14304
- b = jr(
14304
+ b = Fr(
14305
14305
  v,
14306
14306
  zn(g)
14307
14307
  );
@@ -14321,7 +14321,7 @@ async function Cw(t = {}) {
14321
14321
  ),
14322
14322
  R
14323
14323
  );
14324
- f = jr(
14324
+ f = Fr(
14325
14325
  j,
14326
14326
  R
14327
14327
  ), y = !0, b = null, hn(l, j), ds(A, j);
@@ -14347,28 +14347,28 @@ async function Cw(t = {}) {
14347
14347
  En.type = "button", En.className = "pluno-pa-widget__error-retry";
14348
14348
  const Ac = bn(), Rc = document.createTextNode("Try again");
14349
14349
  En.append(Ac, Rc), _i.append("Pluno could not load your account. Try again.", En), Oe.after(xn);
14350
- let Uo = !1, Cn = !1;
14351
- const zo = () => {
14350
+ let zo = !1, Cn = !1;
14351
+ const Bo = () => {
14352
14352
  const h = O.getState().status === "error" && ["unauthorized", "invalid_token", "update_required"].includes(O.getState().lastErrorCode ?? ""), v = !!e.billingStatus && e.billingStatus?.submissionGate?.reason !== "connection_required";
14353
- xn.hidden = h || O.getState().status !== "connected" || !Uo || v || e.productVariant !== "personal" || i(), xn.hidden ? _i.remove() : _i.parentElement !== xn && xn.append(_i), En.disabled = Cn, En.setAttribute("aria-busy", String(Cn)), Ac.hidden = !Cn, Rc.data = Cn ? "Trying" : "Try again";
14354
- }, Bo = async () => {
14353
+ xn.hidden = h || O.getState().status !== "connected" || !zo || v || e.productVariant !== "personal" || i(), xn.hidden ? _i.remove() : _i.parentElement !== xn && xn.append(_i), En.disabled = Cn, En.setAttribute("aria-busy", String(Cn)), Ac.hidden = !Cn, Rc.data = Cn ? "Trying" : "Try again";
14354
+ }, jo = async () => {
14355
14355
  if (!(Cn || Ue)) {
14356
- Cn = !0, zo();
14356
+ Cn = !0, Bo();
14357
14357
  try {
14358
- await O.refreshAccount(), Uo = !1;
14358
+ await O.refreshAccount(), zo = !1;
14359
14359
  } catch (h) {
14360
- Uo = !0, at(
14360
+ zo = !0, at(
14361
14361
  "web-sdk.widget",
14362
14362
  "Failed to refresh billing status",
14363
14363
  Ln(h)
14364
14364
  );
14365
14365
  } finally {
14366
- Cn = !1, Ue || zo();
14366
+ Cn = !1, Ue || Bo();
14367
14367
  }
14368
14368
  }
14369
14369
  };
14370
14370
  En.addEventListener("click", () => {
14371
- Bo();
14371
+ jo();
14372
14372
  });
14373
14373
  let vi = null;
14374
14374
  const Tc = (h) => {
@@ -14384,11 +14384,11 @@ async function Cw(t = {}) {
14384
14384
  }));
14385
14385
  }, Mt = (h = "", v = !0, A = !0, R = !0, j = "external_request") => {
14386
14386
  const ee = l.classList.contains("pluno-pa-widget--open") || !k.hidden && !l.classList.contains("pluno-pa-widget--closing");
14387
- !ee && R && Tc("panel_open"), Bo(), ki && (ki = !1, Ko()), l.classList.contains("pluno-pa-widget--open") || (b = null), kt !== null && (window.clearTimeout(kt), kt = null), bi("shown", !1), k.hidden = !1, B.hidden = !1, Hr(
14387
+ !ee && R && Tc("panel_open"), jo(), ki && (ki = !1, Wo()), l.classList.contains("pluno-pa-widget--open") || (b = null), kt !== null && (window.clearTimeout(kt), kt = null), bi("shown", !1), k.hidden = !1, B.hidden = !1, Kr(
14388
14388
  q,
14389
- No()
14389
+ Uo()
14390
14390
  ), l.classList.remove("pluno-pa-widget--closing"), dt();
14391
- const he = wi(), Ie = Fr(
14391
+ const he = wi(), Ie = $r(
14392
14392
  l,
14393
14393
  he,
14394
14394
  e.position,
@@ -14398,18 +14398,18 @@ async function Cw(t = {}) {
14398
14398
  openPanelPosition: Ie,
14399
14399
  visibleLauncherPosition: he
14400
14400
  }), ht(!0, "open"), xt(), !ee && e.layout === "floating" && O.recordWidgetLifecycle("opened", j), !v) {
14401
- l.classList.add("pluno-pa-widget--open"), ee || Lo(), m.hidden = !0, h && (F.value = h, Fi(F)), ei(G, () => jt.enabled), rn = G.scrollTop, A && (_n(F, "panel_open_immediate"), F.setSelectionRange(F.value.length, F.value.length)), Ye(), ls("shown", j), e.onPanelOpenChange?.(!0, j);
14401
+ l.classList.add("pluno-pa-widget--open"), ee || No(), m.hidden = !0, h && (F.value = h, Fi(F)), ei(G, () => jt.enabled), rn = G.scrollTop, A && (_n(F, "panel_open_immediate"), F.setSelectionRange(F.value.length, F.value.length)), Ye(), ls("shown", j), e.onPanelOpenChange?.(!0, j);
14402
14402
  return;
14403
14403
  }
14404
14404
  const gt = Date.now();
14405
14405
  window.requestAnimationFrame(() => {
14406
- l.classList.add("pluno-pa-widget--open"), ee || Lo(), h && (F.value = h, Fi(F)), ei(G, () => jt.enabled), rn = G.scrollTop, A && (_n(F, "panel_open_animation", {
14406
+ l.classList.add("pluno-pa-widget--open"), ee || No(), h && (F.value = h, Fi(F)), ei(G, () => jt.enabled), rn = G.scrollTop, A && (_n(F, "panel_open_animation", {
14407
14407
  scheduledAt: gt
14408
14408
  }), F.setSelectionRange(F.value.length, F.value.length)), Ye(), ls("shown", j), e.onPanelOpenChange?.(!0, j), kt = window.setTimeout(() => {
14409
14409
  m.hidden = !0, ei(G, () => jt.enabled), rn = G.scrollTop;
14410
14410
  }, 220);
14411
14411
  });
14412
- }, jo = (h = "external_request") => {
14412
+ }, Fo = (h = "external_request") => {
14413
14413
  const v = l.classList.contains("pluno-pa-widget--open") || !k.hidden && !l.classList.contains("pluno-pa-widget--closing");
14414
14414
  kt !== null && (window.clearTimeout(kt), kt = null), m.hidden = !1, f && (wi(!1), kn("Closing launcher at stored position")), l.classList.remove("pluno-pa-widget--open"), l.classList.add("pluno-pa-widget--closing"), dt(), Ye(), v && e.layout === "floating" && O.recordWidgetLifecycle("closed", h), e.onPanelOpenChange?.(!1, h), kt = window.setTimeout(() => {
14415
14415
  k.hidden = !0, B.hidden = !0, b = null, l.classList.remove("pluno-pa-widget--closing");
@@ -14440,7 +14440,7 @@ async function Cw(t = {}) {
14440
14440
  v = v.parentElement;
14441
14441
  }
14442
14442
  return null;
14443
- }, Fo = (h) => {
14443
+ }, $o = (h) => {
14444
14444
  if (!(h instanceof Element) || h.getRootNode() === l.getRootNode())
14445
14445
  return null;
14446
14446
  let v = h;
@@ -14457,7 +14457,7 @@ async function Cw(t = {}) {
14457
14457
  v = j instanceof ShadowRoot ? j.host : null;
14458
14458
  }
14459
14459
  return null;
14460
- }, $o = () => qs(x), Dp = (h) => {
14460
+ }, Ho = () => qs(x), Dp = (h) => {
14461
14461
  if (!h.isConnected || !h.matches(cd))
14462
14462
  return !1;
14463
14463
  if (!(h instanceof HTMLElement))
@@ -14468,7 +14468,7 @@ async function Cw(t = {}) {
14468
14468
  return h.checkVisibility();
14469
14469
  const v = window.getComputedStyle(h);
14470
14470
  return v.display !== "none" && v.visibility !== "hidden";
14471
- }, Ho = (h, v) => {
14471
+ }, Ko = (h, v) => {
14472
14472
  if (!v)
14473
14473
  return;
14474
14474
  Ot !== null && window.clearTimeout(Ot);
@@ -14481,16 +14481,16 @@ async function Cw(t = {}) {
14481
14481
  }, 0);
14482
14482
  }, Si = (h, v = null) => {
14483
14483
  if ($t === h) {
14484
- h && Ho(h, v);
14484
+ h && Ko(h, v);
14485
14485
  return;
14486
14486
  }
14487
- $t = h, h !== null ? (Ho(h, v), An = window.setInterval(() => {
14487
+ $t = h, h !== null ? (Ko(h, v), An = window.setInterval(() => {
14488
14488
  const A = $t;
14489
14489
  if (!A || !Dp(A)) {
14490
14490
  Si(null);
14491
14491
  return;
14492
14492
  }
14493
- Ho(A, null);
14493
+ Ko(A, null);
14494
14494
  }, lw)) : (An !== null && (window.clearInterval(An), An = null), Ot !== null && (window.clearTimeout(Ot), Ot = null), us = null);
14495
14495
  }, Lp = () => {
14496
14496
  An !== null && (window.clearInterval(An), An = null), Ot !== null && (window.clearTimeout(Ot), Ot = null), ze !== null && (window.clearTimeout(ze), ze = null);
@@ -14500,16 +14500,16 @@ async function Cw(t = {}) {
14500
14500
  return;
14501
14501
  const A = Date.now();
14502
14502
  an = A, Ii = A, ze !== null && window.clearTimeout(ze);
14503
- const R = $t ?? Fo($o());
14503
+ const R = $t ?? $o(Ho());
14504
14504
  R && (Si(R, v), h.stopImmediatePropagation()), ze = window.setTimeout(() => {
14505
14505
  if (ze = null, an !== A)
14506
14506
  return;
14507
- const j = $o();
14507
+ const j = Ho();
14508
14508
  if (j === v) {
14509
14509
  an = null;
14510
14510
  return;
14511
14511
  }
14512
- const ee = Fo(j);
14512
+ const ee = $o(j);
14513
14513
  ee && Si(ee, v);
14514
14514
  }, 0);
14515
14515
  }, hs = (h) => {
@@ -14541,7 +14541,7 @@ async function Cw(t = {}) {
14541
14541
  const A = h.target, R = an !== null && Date.now() - an <= ld;
14542
14542
  an = null, ze !== null && (window.clearTimeout(ze), ze = null);
14543
14543
  const j = (ee) => {
14544
- const he = Fo(ee);
14544
+ const he = $o(ee);
14545
14545
  if (!he)
14546
14546
  return !1;
14547
14547
  if (R)
@@ -14550,7 +14550,7 @@ async function Cw(t = {}) {
14550
14550
  return us !== null && Ie - us <= cw ? (Si(he, A), !0) : (us = Ie, !0);
14551
14551
  };
14552
14552
  j(h.relatedTarget) || window.setTimeout(() => {
14553
- $t === null && A.isConnected && j($o());
14553
+ $t === null && A.isConnected && j(Ho());
14554
14554
  }, 0);
14555
14555
  }), m.addEventListener("keydown", (h) => {
14556
14556
  !l.classList.contains("pluno-pa-widget--minimized") || h.key !== "Enter" && h.key !== " " || (h.preventDefault(), Mt("", !0, !0, !0, "minimized_launcher"));
@@ -14558,7 +14558,7 @@ async function Cw(t = {}) {
14558
14558
  h.stopPropagation();
14559
14559
  }), T?.addEventListener("click", (h) => {
14560
14560
  h.preventDefault(), h.stopPropagation(), bi("minimized", !0, "minimize_button");
14561
- }), B.addEventListener("click", () => jo("close_button")), G.addEventListener("wheel", (h) => {
14561
+ }), B.addEventListener("click", () => Fo("close_button")), G.addEventListener("wheel", (h) => {
14562
14562
  cs(h.deltaY < 0 ? "up" : null);
14563
14563
  }), G.addEventListener("pointerdown", (h) => {
14564
14564
  Sn = h.target === G ? h.clientY : null;
@@ -14576,18 +14576,18 @@ async function Cw(t = {}) {
14576
14576
  }), G.addEventListener("keydown", (h) => {
14577
14577
  (h.key === "ArrowUp" || h.key === "PageUp" || h.key === "Home") && cs("up");
14578
14578
  }), G.addEventListener("scroll", () => {
14579
- G.scrollTop < rn - 1 && To === "up" && (fi = !0, ht(!1, "userScroll")), rn = G.scrollTop, Mo();
14579
+ G.scrollTop < rn - 1 && Po === "up" && (fi = !0, ht(!1, "userScroll")), rn = G.scrollTop, Oo();
14580
14580
  }), ie.addEventListener("click", () => {
14581
14581
  Ap();
14582
14582
  });
14583
14583
  const Oc = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
14584
14584
  ([h]) => {
14585
- h?.isIntersecting && Mo();
14585
+ h?.isIntersecting && Oo();
14586
14586
  },
14587
14587
  { root: G, threshold: 0 }
14588
14588
  );
14589
14589
  Oc?.observe(Te);
14590
- const Dc = typeof ResizeObserver > "u" ? null : new ResizeObserver(Mo);
14590
+ const Dc = typeof ResizeObserver > "u" ? null : new ResizeObserver(Oo);
14591
14591
  Dc?.observe(G);
14592
14592
  const Lc = l.querySelector(".pluno-pa-widget__permission-overlay"), Nc = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
14593
14593
  const h = Lc.offsetHeight;
@@ -14637,15 +14637,15 @@ async function Cw(t = {}) {
14637
14637
  }), Re.disabled = i() || Rn() || e.productVariant !== "personal" && $i(e.billingStatus);
14638
14638
  };
14639
14639
  Jn();
14640
- const Ko = () => {
14640
+ const Wo = () => {
14641
14641
  const h = O.getState(), v = h.isThinking, A = h.turnPhase !== null, R = h.turnPhase === "sending", j = E?.lastElementChild;
14642
14642
  j && (j.textContent = "Working..."), l.classList.toggle("pluno-pa-widget--thinking", v), l.classList.toggle("pluno-pa-widget--sending", R), l.classList.toggle(
14643
14643
  "pluno-pa-widget--unread",
14644
14644
  !A && (ki || !!h.lastError)
14645
14645
  ), Jn();
14646
14646
  };
14647
- Ko();
14648
- const Wo = () => {
14647
+ Wo();
14648
+ const Vo = () => {
14649
14649
  if (!(i() || Ue))
14650
14650
  return Jn(), Le(), O.connect().then(
14651
14651
  () => {
@@ -14665,7 +14665,7 @@ async function Cw(t = {}) {
14665
14665
  Bt !== null && window.clearTimeout(Bt), U.textContent = h, U.hidden = !1, Bt = window.setTimeout(() => {
14666
14666
  U.textContent = "", U.hidden = !0, Bt = null;
14667
14667
  }, 3e3);
14668
- }, Vo = (h, v) => {
14668
+ }, Go = (h, v) => {
14669
14669
  const A = qt.get(h);
14670
14670
  if (!A || v !== void 0 && A.submittedAt !== v || (qt.delete(h), A.generation !== St || A.revision !== en)) return;
14671
14671
  const R = new Set(A.attachments);
@@ -14682,7 +14682,7 @@ async function Cw(t = {}) {
14682
14682
  h.submittedAt,
14683
14683
  h.requestedModel
14684
14684
  ).then((R) => {
14685
- v === St && (O.getState().receipts === void 0 && Vo(h.clientMessageId), be?.clientMessageId === h.clientMessageId && (be.pendingSubmission = !1, R && (be.clientMessageId = R), Ic()), A && (Gn = !1, is = null, e.proactiveSuggestion = null, dt()));
14685
+ v === St && (O.getState().receipts === void 0 && Go(h.clientMessageId), be?.clientMessageId === h.clientMessageId && (be.pendingSubmission = !1, R && (be.clientMessageId = R), Ic()), A && (Gn = !1, is = null, e.proactiveSuggestion = null, dt()));
14686
14686
  }).catch((R) => {
14687
14687
  if (v !== St) return;
14688
14688
  be?.clientMessageId === h.clientMessageId && (be = null), qt.delete(h.clientMessageId), ui();
@@ -14696,7 +14696,7 @@ async function Cw(t = {}) {
14696
14696
  return;
14697
14697
  const h = tn;
14698
14698
  tn = null, Bc(h);
14699
- }, Go = () => {
14699
+ }, Jo = () => {
14700
14700
  const h = F.value, v = h.trim(), A = [...ut];
14701
14701
  if (tn !== null || fs() || !Tn() || !v && A.length === 0)
14702
14702
  return;
@@ -14732,14 +14732,14 @@ async function Cw(t = {}) {
14732
14732
  e.onSignupClick?.();
14733
14733
  return;
14734
14734
  }
14735
- Tn() && (on = !0, ht(!0, "send"), xt(), Go());
14735
+ Tn() && (on = !0, ht(!0, "send"), xt(), Jo());
14736
14736
  });
14737
14737
  let Ei = 0;
14738
14738
  const cn = () => {
14739
14739
  Ei = 0, l.classList.remove("pluno-pa-widget--drag-over");
14740
14740
  }, zp = () => {
14741
14741
  Bt !== null && (window.clearTimeout(Bt), Bt = null), U.textContent = "", U.hidden = !0;
14742
- }, Jo = async (h) => {
14742
+ }, Qo = async (h) => {
14743
14743
  if (!e.attachmentsEnabled || h.length === 0 || e.productVariant === "personal" && Rn())
14744
14744
  return;
14745
14745
  const v = b_(
@@ -14753,7 +14753,7 @@ async function Cw(t = {}) {
14753
14753
  }
14754
14754
  nn("attachment_added");
14755
14755
  }, Bp = async (h) => {
14756
- await Jo(h), !(h.length === 0 || $t !== null) && _n(F, "attachment_picker_completed");
14756
+ await Qo(h), !(h.length === 0 || $t !== null) && _n(F, "attachment_picker_completed");
14757
14757
  };
14758
14758
  Re.addEventListener("click", () => {
14759
14759
  e.loginRequired || Rn() || e.productVariant !== "personal" && $i(e.billingStatus) || Ae.click();
@@ -14783,7 +14783,7 @@ async function Cw(t = {}) {
14783
14783
  !0
14784
14784
  ), x.addEventListener("drop", cn, !0), x.addEventListener("dragend", cn, !0), x.defaultView?.addEventListener("blur", cn), l.addEventListener("drop", (h) => {
14785
14785
  const v = h.dataTransfer;
14786
- !e.attachmentsEnabled || !Ms(v) || e.loginRequired || Rn() || (h.preventDefault(), h.stopPropagation(), cn(), Jo(v.files).catch((A) => {
14786
+ !e.attachmentsEnabled || !Ms(v) || e.loginRequired || Rn() || (h.preventDefault(), h.stopPropagation(), cn(), Qo(v.files).catch((A) => {
14787
14787
  ms(
14788
14788
  A instanceof Error ? A.message : "Failed to attach file"
14789
14789
  ), at("web-sdk.widget", "Attachment failed", {
@@ -14793,7 +14793,7 @@ async function Cw(t = {}) {
14793
14793
  }), l.addEventListener("paste", (h) => {
14794
14794
  h.stopPropagation();
14795
14795
  const v = h.clipboardData, A = Array.from(v?.files ?? []);
14796
- !e.attachmentsEnabled || A.length === 0 || e.loginRequired || Rn() || (h.preventDefault(), Jo(A).catch((R) => {
14796
+ !e.attachmentsEnabled || A.length === 0 || e.loginRequired || Rn() || (h.preventDefault(), Qo(A).catch((R) => {
14797
14797
  ms(
14798
14798
  R instanceof Error ? R.message : "Failed to attach file"
14799
14799
  ), at("web-sdk.widget", "Attachment failed", {
@@ -14813,9 +14813,9 @@ async function Cw(t = {}) {
14813
14813
  return;
14814
14814
  }
14815
14815
  const v = F.value.trim().length > 0 || ut.length > 0;
14816
- on = !0, ht(!0, "send"), xt(), Go(), xe(O.getState()), Le(), v && nn("send_button_submit");
14816
+ on = !0, ht(!0, "send"), xt(), Jo(), xe(O.getState()), Le(), v && nn("send_button_submit");
14817
14817
  }), ve.addEventListener("click", () => {
14818
- He = !He, Ft(), He && (Qe.data === null || Qe.status === "error") && Qe.status !== "loading" && Do(), He || nn("history_closed");
14818
+ He = !He, Ft(), He && (Qe.data === null || Qe.status === "error") && Qe.status !== "loading" && Lo(), He || nn("history_closed");
14819
14819
  }), pe.addEventListener("click", () => {
14820
14820
  He = !1, Ft(), nn("history_closed");
14821
14821
  }), V.addEventListener("scroll", Rp), F.addEventListener("input", () => {
@@ -14826,7 +14826,7 @@ async function Cw(t = {}) {
14826
14826
  e.onLoginClick?.();
14827
14827
  return;
14828
14828
  }
14829
- Tn() && (on = !0, ht(!0, "send"), xt(), Go(), xe(O.getState()), Le());
14829
+ Tn() && (on = !0, ht(!0, "send"), xt(), Jo(), xe(O.getState()), Le());
14830
14830
  }
14831
14831
  }), l.addEventListener("click", (h) => {
14832
14832
  const v = h.target instanceof Element ? h.target : null;
@@ -14886,19 +14886,19 @@ async function Cw(t = {}) {
14886
14886
  h.key !== "Escape" || !He || (He = !1, Ft(), nn("history_escape"));
14887
14887
  }), d.composerValue && (F.value = d.composerValue, Fi(F)), e.layout === "page" ? Mt(F.value, !1, !0, !1, "external_request") : p === "minimized" ? bi("minimized", !1) : e.initialDisplayState === void 0 && d.isOpen && Mt(F.value, !1, !1, !1, "restored_state");
14888
14888
  const Ci = () => u;
14889
- let Qo = O.getState().appearance !== null, Ai = O.getInteractions();
14889
+ let Yo = O.getState().appearance !== null, Ai = O.getInteractions();
14890
14890
  const Xe = (h) => Ai.find(
14891
14891
  (v) => v.kind === h && v.eligible
14892
14892
  ), ys = Zp(() => bs()), Wc = (h) => Xp(
14893
14893
  JSON.stringify([O.getState().user?.id, O.getState().sessionId]),
14894
14894
  h
14895
- ), Yo = /* @__PURE__ */ new WeakMap(), bs = () => {
14895
+ ), Xo = /* @__PURE__ */ new WeakMap(), bs = () => {
14896
14896
  const h = Ai.filter((v) => v.kind === "task_notifications" || v.kind === "tab_group_permission");
14897
14897
  ys.sync(h.map((v) => ({ key: Wc(v), card: v })));
14898
14898
  for (const [v, A] of [[De, Xe("task_notifications")], [$e, Xe("tab_group_permission")]]) {
14899
14899
  if (!v) continue;
14900
14900
  if (v.hidden = !A, !A) {
14901
- Yo.delete(v);
14901
+ Xo.delete(v);
14902
14902
  continue;
14903
14903
  }
14904
14904
  const R = A.payload.openingGeneration;
@@ -14909,8 +14909,8 @@ async function Cw(t = {}) {
14909
14909
  const j = Wc(A), ee = ys.get(j), he = A.status === "pending" || !!ee?.action;
14910
14910
  v.setAttribute("aria-busy", String(he));
14911
14911
  const Ie = JSON.stringify([j, A, ee?.action, ee?.error]);
14912
- if (Yo.get(v) === Ie) continue;
14913
- Yo.set(v, Ie), v.replaceChildren();
14912
+ if (Xo.get(v) === Ie) continue;
14913
+ Xo.set(v, Ie), v.replaceChildren();
14914
14914
  const gt = document.createElement("span");
14915
14915
  gt.className = "pluno-pa-widget__notify-suggestion-label", gt.textContent = A.presentation.body;
14916
14916
  const Yn = document.createElement("div");
@@ -14934,7 +14934,7 @@ async function Cw(t = {}) {
14934
14934
  h.revision,
14935
14935
  { ...A, expectedSourceVersion: h.sourceVersion, ...v === "run" ? { requestedModel: ot } : {} }
14936
14936
  ) : Promise.resolve();
14937
- let Xo = O.getState().isThinking;
14937
+ let Zo = O.getState().isThinking;
14938
14938
  const jp = async () => {
14939
14939
  bs();
14940
14940
  };
@@ -14962,11 +14962,11 @@ async function Cw(t = {}) {
14962
14962
  }
14963
14963
  };
14964
14964
  let Qn = null;
14965
- const Zo = (h = {}) => {
14965
+ const er = (h = {}) => {
14966
14966
  e.productVariant === "personal" && O.refreshSessionHistory().catch(() => {
14967
14967
  }), St++, qt.clear(), dc(), tn = null, be = null, fi = !1, as.clear(), on = !0, ht(!0, "newSession"), xt(), He = !1, Ft();
14968
14968
  const v = Promise.resolve(O.startNewSession(h));
14969
- return vi = null, Ro.clear(), F.value = "", ut = [], ui(), Fi(F), Ye(), Le(), _n(F, "new_chat"), xe(O.getState()), v;
14969
+ return vi = null, To.clear(), F.value = "", ut = [], ui(), Fi(F), Ye(), Le(), _n(F, "new_chat"), xe(O.getState()), v;
14970
14970
  };
14971
14971
  ce?.addEventListener("click", () => {
14972
14972
  ln(Xe("proactive_suggestion"), "run").catch(() => {
@@ -15005,16 +15005,16 @@ async function Cw(t = {}) {
15005
15005
  Qn?.remove(), Qn = null;
15006
15006
  return;
15007
15007
  }
15008
- Qn || (Qn = _o(
15008
+ Qn || (Qn = vo(
15009
15009
  "pluno-pa-widget__new-chat",
15010
15010
  "New chat",
15011
15011
  o_(),
15012
15012
  !1
15013
- ), Qn.addEventListener("click", () => Zo()), _e.insertBefore(Qn, ve));
15013
+ ), Qn.addEventListener("click", () => er()), _e.insertBefore(Qn, ve));
15014
15014
  }, Ht = document.createElement("div");
15015
15015
  Ht.className = "pluno-pa-widget__error";
15016
- const er = document.createTextNode("");
15017
- Ht.appendChild(er);
15016
+ const tr = document.createTextNode("");
15017
+ Ht.appendChild(tr);
15018
15018
  const dn = document.createElement("a");
15019
15019
  dn.className = "pluno-pa-widget__error-retry", dn.target = "_blank", dn.rel = "noreferrer", dn.textContent = "Security settings";
15020
15020
  const Et = document.createElement("button");
@@ -15028,7 +15028,7 @@ async function Cw(t = {}) {
15028
15028
  let h;
15029
15029
  try {
15030
15030
  await Promise.race([
15031
- Wo(),
15031
+ Vo(),
15032
15032
  new Promise((v) => {
15033
15033
  h = setTimeout(v, 9e4);
15034
15034
  })
@@ -15040,11 +15040,11 @@ async function Cw(t = {}) {
15040
15040
  Et.addEventListener("click", () => {
15041
15041
  Hp();
15042
15042
  });
15043
- let qn = !1, Pi = null, Is = 0, tr = 0;
15043
+ let qn = !1, Pi = null, Is = 0, nr = 0;
15044
15044
  const xe = (h, v = {}) => {
15045
15045
  yc(h) && (be = null), mc = v.renderSource ?? "local";
15046
15046
  const A = n();
15047
- l.dataset.conversationGate = e.loginRequired || A ? "authentication" : e.signupRequired ? "signup" : "none", zo(), l.classList.toggle(
15047
+ l.dataset.conversationGate = e.loginRequired || A ? "authentication" : e.signupRequired ? "signup" : "none", Bo(), l.classList.toggle(
15048
15048
  "pluno-pa-widget--logged-out",
15049
15049
  (e.loginRequired || A) && e.entrySurface === "extension_widget"
15050
15050
  ), ne.classList.remove("pluno-pa-widget__access-notice--login-only"), h = { ...h, messages: h.messages.map((W) => {
@@ -15057,7 +15057,7 @@ async function Cw(t = {}) {
15057
15057
  ...Object.getOwnPropertyDescriptors(W),
15058
15058
  attachments: { value: Pe, enumerable: !0, configurable: !0 }
15059
15059
  });
15060
- }) }, gi(), sn !== null && (window.clearTimeout(sn), sn = null), Ft(), dt(), So(), ne.hidden = !i(), ne.hidden && ne.replaceChildren();
15060
+ }) }, gi(), sn !== null && (window.clearTimeout(sn), sn = null), Ft(), dt(), ko(), ne.hidden = !i(), ne.hidden && ne.replaceChildren();
15061
15061
  const R = JSON.stringify([
15062
15062
  i(),
15063
15063
  h.lastError,
@@ -15068,7 +15068,7 @@ async function Cw(t = {}) {
15068
15068
  if (Xc !== R) {
15069
15069
  Xc = R, Oe.hidden = i() || !h.lastError || Ji(h.lastErrorCode) !== "bottom_notice";
15070
15070
  const W = Oe.hidden ? "" : h.lastError ?? "";
15071
- er.data !== W && (er.data = W), Oe.hidden ? Ht.remove() : Ht.parentElement !== Oe && Oe.appendChild(Ht), h.lastErrorSecuritySettingsUrl ? (dn.href = h.lastErrorSecuritySettingsUrl, dn.parentElement !== Ht && Ht.insertBefore(dn, Et.parentElement ? Et : null)) : dn.remove(), h.lastErrorCode === "connection_failed" || h.lastErrorCode === "auth_reconnecting" || h.lastErrorCode === "submission_checkpoint_pending" ? (Et.disabled = un, Et.setAttribute("aria-busy", String(un)), Qc.hidden = !un, Yc.data = un ? "Trying" : "Try again", Et.parentElement !== Ht && Ht.appendChild(Et)) : Et.remove();
15071
+ tr.data !== W && (tr.data = W), Oe.hidden ? Ht.remove() : Ht.parentElement !== Oe && Oe.appendChild(Ht), h.lastErrorSecuritySettingsUrl ? (dn.href = h.lastErrorSecuritySettingsUrl, dn.parentElement !== Ht && Ht.insertBefore(dn, Et.parentElement ? Et : null)) : dn.remove(), h.lastErrorCode === "connection_failed" || h.lastErrorCode === "auth_reconnecting" || h.lastErrorCode === "submission_checkpoint_pending" ? (Et.disabled = un, Et.setAttribute("aria-busy", String(un)), Qc.hidden = !un, Yc.data = un ? "Trying" : "Try again", Et.parentElement !== Ht && Ht.appendChild(Et)) : Et.remove();
15072
15072
  }
15073
15073
  if (A) {
15074
15074
  mi = "", Ri.clear(), ws.clear(), _s.clear(), G.replaceChildren(), Os(
@@ -15102,9 +15102,9 @@ async function Cw(t = {}) {
15102
15102
  );
15103
15103
  const qe = ne.querySelector(".pluno-pa-widget__login");
15104
15104
  qe.disabled = qn, qe.setAttribute("aria-busy", String(qn)), qn && qe.prepend(bn()), qe.addEventListener("click", () => {
15105
- const Mi = ++Is, Yp = tr;
15105
+ const Mi = ++Is, Yp = nr;
15106
15106
  qn = !0, Pi = null, xe(O.getState()), Pe().catch((nl) => {
15107
- Mi !== Is || Yp !== tr || (Pi = nl instanceof Error ? nl.message : "Close and reopen Pluno to try again.");
15107
+ Mi !== Is || Yp !== nr || (Pi = nl instanceof Error ? nl.message : "Close and reopen Pluno to try again.");
15108
15108
  }).finally(() => {
15109
15109
  Mi === Is && (qn = !1, Ue || xe(O.getState()));
15110
15110
  });
@@ -15158,7 +15158,7 @@ async function Cw(t = {}) {
15158
15158
  Vc(h),
15159
15159
  he,
15160
15160
  () => jt.enabled,
15161
- Ro,
15161
+ To,
15162
15162
  Ri,
15163
15163
  ws,
15164
15164
  _s,
@@ -15177,11 +15177,11 @@ async function Cw(t = {}) {
15177
15177
  () => {
15178
15178
  const W = Xe("morning_report");
15179
15179
  W && ln(W, "snooze").then(() => {
15180
- jo("morning_report_snooze"), xe(O.getState());
15180
+ Fo("morning_report_snooze"), xe(O.getState());
15181
15181
  }).catch(() => xe(O.getState()));
15182
15182
  },
15183
15183
  () => h.sessionId ? O.loadSession(h.sessionId) : void 0,
15184
- () => Zo(),
15184
+ () => er(),
15185
15185
  vs.get(h.selectionKey ?? h.sessionId ?? "draft"),
15186
15186
  (W, Pe) => {
15187
15187
  $p(h.selectionKey ?? h.sessionId ?? "draft", W, Pe);
@@ -15215,41 +15215,41 @@ async function Cw(t = {}) {
15215
15215
  "selectionchange",
15216
15216
  Zc
15217
15217
  );
15218
- const nr = (h) => {
15218
+ const ir = (h) => {
15219
15219
  Pn = e.entrySurface === "extension_widget" || h.user && !e.loginRequired ? h.activeUsersCount ?? null : null, Gc();
15220
15220
  };
15221
- nr(O.getState());
15221
+ ir(O.getState());
15222
15222
  const Kp = O.subscribeInteractions((h) => {
15223
15223
  Ai = h, bs(), e.morningReport = Xe("morning_report")?.payload ?? null, e.proactiveSuggestion = Xe("proactive_suggestion")?.payload.suggestion ?? null, Ue || xe(O.getState(), { skipUnchangedTimeline: !0, renderSource: "interactions" });
15224
15224
  }), Wp = O.subscribeAccount((h) => {
15225
15225
  if (!h && !gs) return;
15226
15226
  const v = h?.auth, A = v?.workspace?.id;
15227
- A && (Ao !== null && Ao !== A && (ot = Co, gi()), Ao = A), (v?.status !== "error" || v.errorCode !== "browser_session_unavailable" && v.errorCode !== "backend_auth_pending") && (Is += 1, Pi = null, qn = !1);
15227
+ A && (Ro !== null && Ro !== A && (ot = Ao, gi()), Ro = A), (v?.status !== "error" || v.errorCode !== "browser_session_unavailable" && v.errorCode !== "backend_auth_pending") && (Is += 1, Pi = null, qn = !1);
15228
15228
  const R = i();
15229
- e.billingStatus = h, s(h), nr(O.getState()), Jn(), xe(O.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), So(), Le(), queueMicrotask(jc), R && !i() && Wo();
15229
+ e.billingStatus = h, s(h), ir(O.getState()), Jn(), xe(O.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), ko(), Le(), queueMicrotask(jc), R && !i() && Vo();
15230
15230
  });
15231
- let ir = !1, sr = null;
15231
+ let sr = !1, or = null;
15232
15232
  const el = (h) => {
15233
- os && ((!h.taskStatus || sr !== null && sr !== h.sessionId) && (ir = !1), sr = h.sessionId, h.taskStatus === "working" && (ir = !0), ir && h.taskStatus ? os.setStatus(h.taskStatus) : os.clear());
15233
+ os && ((!h.taskStatus || or !== null && or !== h.sessionId) && (sr = !1), or = h.sessionId, h.taskStatus === "working" && (sr = !0), sr && h.taskStatus ? os.setStatus(h.taskStatus) : os.clear());
15234
15234
  };
15235
15235
  O.on("state", (h) => {
15236
15236
  const v = h.user?.id ?? null;
15237
- vn !== null && vn !== v && (ot = Co, gi()), (pi !== null && pi !== h.sessionId || vn !== null && vn !== v || hi !== void 0 && hi !== h.selectionKey) && (St++, qt.clear(), be = null), hi = h.selectionKey, pi = h.sessionId, vn = v;
15237
+ vn !== null && vn !== v && (ot = Ao, gi()), (pi !== null && pi !== h.sessionId || vn !== null && vn !== v || hi !== void 0 && hi !== h.selectionKey) && (St++, qt.clear(), be = null), hi = h.selectionKey, pi = h.sessionId, vn = v;
15238
15238
  for (const Ie of h.messages)
15239
- Ie.role === "user" && Vo(Ie.id);
15240
- for (const Ie of h.receipts ?? []) Vo(Ie.userMessageId, Ie.acceptedRendererRevision);
15241
- e.extensionRuntime && (tr += 1, Pi = null), nr(h), el(h), h.status === "connected" && (e.productVariant === "personal" && !gc && e.layout === "page" && !hc && (hc = !0, O.refreshSessionHistory().catch(() => {
15239
+ Ie.role === "user" && Go(Ie.id);
15240
+ for (const Ie of h.receipts ?? []) Go(Ie.userMessageId, Ie.acceptedRendererRevision);
15241
+ e.extensionRuntime && (nr += 1, Pi = null), ir(h), el(h), h.status === "connected" && (e.productVariant === "personal" && !gc && e.layout === "page" && !hc && (hc = !0, O.refreshSessionHistory().catch(() => {
15242
15242
  })), gs = !0, tn && queueMicrotask(() => {
15243
15243
  jc();
15244
15244
  })), jp();
15245
- const A = Xo && !h.isThinking, R = wc !== location.origin || _c !== h.sessionId || vc !== (h.user?.id ?? null), j = Xo !== h.isThinking, ee = Po !== "connected" && h.status === "connected", he = Po === "connected" && h.status !== "connected";
15246
- wc = location.origin, _c = h.sessionId, vc = h.user?.id ?? null, Po = h.status, Xo = h.isThinking, he && pt !== null && (window.clearTimeout(pt), pt = null), l.classList.contains("pluno-pa-widget--open") && h.status === "connected" && (R || j || ee) && Lo(), De && (De.hidden = Xe("task_notifications") === void 0), $e && ($e.hidden = Xe("tab_group_permission") === void 0), A && !l.classList.contains("pluno-pa-widget--open") && (ki = !0), Ko(), h.appearance ? (Qo = !0, at(
15245
+ const A = Zo && !h.isThinking, R = wc !== location.origin || _c !== h.sessionId || vc !== (h.user?.id ?? null), j = Zo !== h.isThinking, ee = qo !== "connected" && h.status === "connected", he = qo === "connected" && h.status !== "connected";
15246
+ wc = location.origin, _c = h.sessionId, vc = h.user?.id ?? null, qo = h.status, Zo = h.isThinking, he && pt !== null && (window.clearTimeout(pt), pt = null), l.classList.contains("pluno-pa-widget--open") && h.status === "connected" && (R || j || ee) && No(), De && (De.hidden = Xe("task_notifications") === void 0), $e && ($e.hidden = Xe("tab_group_permission") === void 0), A && !l.classList.contains("pluno-pa-widget--open") && (ki = !0), Wo(), h.appearance ? (Yo = !0, at(
15247
15247
  "web-sdk.widget",
15248
15248
  "Agent state supplied appearance",
15249
15249
  {
15250
15250
  appearance: h.appearance
15251
15251
  }
15252
- ), or(h.appearance, "agent.state.appearance")) : Qo && (Qo = !1, at(
15252
+ ), rr(h.appearance, "agent.state.appearance")) : Yo && (Yo = !1, at(
15253
15253
  "web-sdk.widget",
15254
15254
  "Agent state cleared appearance; reverting to configured widget options",
15255
15255
  {
@@ -15257,10 +15257,10 @@ async function Cw(t = {}) {
15257
15257
  fallbackColorScheme: e.colorScheme,
15258
15258
  fallbackFontFamily: e.fontFamily
15259
15259
  }
15260
- ), or({}, "agent.state.appearance-cleared")), xe(h, { skipUnchangedTimeline: !0, renderSource: "state" }), Le(), A && Bo();
15260
+ ), rr({}, "agent.state.appearance-cleared")), xe(h, { skipUnchangedTimeline: !0, renderSource: "state" }), Le(), A && jo();
15261
15261
  });
15262
15262
  const tl = O.getState();
15263
- el(tl), xe(tl), Le(), Wo();
15263
+ el(tl), xe(tl), Le(), Vo();
15264
15264
  const Vp = ag(l, (h, v, A, R, j) => {
15265
15265
  const ee = ch(O.getState(), R);
15266
15266
  O.reportDisplayedError?.(h, v, A, ee ?? void 0, j);
@@ -15269,20 +15269,20 @@ async function Cw(t = {}) {
15269
15269
  l,
15270
15270
  e.extensionRuntime || e.entrySurface === "extension_widget" ? "extension_widget" : e.entrySurface === "main_web_chat" ? "main_web_chat" : "embedded_widget",
15271
15271
  O
15272
- ), Jp = cg(l, Oo);
15272
+ ), Jp = cg(l, Do);
15273
15273
  return {
15274
15274
  agent: O,
15275
- startNewChat: Zo,
15275
+ startNewChat: er,
15276
15276
  getSelectedModel: () => ot,
15277
15277
  host: r,
15278
15278
  updateAppearance: (h) => {
15279
- h.scribbleStyle !== void 0 && (e.scribbleStyle = h.scribbleStyle), or(h, "widgetHandle.updateAppearance");
15279
+ h.scribbleStyle !== void 0 && (e.scribbleStyle = h.scribbleStyle), rr(h, "widgetHandle.updateAppearance");
15280
15280
  },
15281
15281
  openPanel: (h) => {
15282
15282
  const v = typeof h == "string" ? h : F.value, A = typeof h == "object" ? h.focusComposer !== !1 : !0, R = typeof h == "object" ? h.trigger ?? "external_request" : "external_request";
15283
15283
  R === "proactive_suggestion" && e.proactiveSuggestion && (is = e.proactiveSuggestion, Gn = !0, dt()), Mt(R === "proactive_suggestion" ? "Yes, but " : v, !1, A, !0, R);
15284
15284
  },
15285
- closePanel: jo,
15285
+ closePanel: Fo,
15286
15286
  updateDisplayState: (h) => {
15287
15287
  if (h === "shown") {
15288
15288
  bi("shown", !1);
@@ -15320,7 +15320,7 @@ async function Cw(t = {}) {
15320
15320
  ), x.removeEventListener("drop", cn, !0), x.removeEventListener("dragend", cn, !0), x.defaultView?.removeEventListener(
15321
15321
  "blur",
15322
15322
  cn
15323
- ), window.removeEventListener("resize", xc), Ec(), qp(), Mp(), Bt !== null && window.clearTimeout(Bt), pt !== null && (window.clearTimeout(pt), pt = null), Ep(), In !== null && (window.clearTimeout(In), In = null), sn !== null && (window.clearTimeout(sn), sn = null), os?.clear(), xo && O.destroy(), Eo?.release(), r.remove());
15323
+ ), window.removeEventListener("resize", xc), Ec(), qp(), Mp(), Bt !== null && window.clearTimeout(Bt), pt !== null && (window.clearTimeout(pt), pt = null), Ep(), In !== null && (window.clearTimeout(In), In = null), sn !== null && (window.clearTimeout(sn), sn = null), os?.clear(), Eo && O.destroy(), Co?.release(), r.remove());
15324
15324
  }
15325
15325
  };
15326
15326
  async function Qp(h) {
@@ -15341,7 +15341,7 @@ async function Cw(t = {}) {
15341
15341
  });
15342
15342
  }
15343
15343
  }
15344
- function or(h, v) {
15344
+ function rr(h, v) {
15345
15345
  const A = h.accentColor ?? e.accentColor, R = h.colorScheme ?? e.colorScheme, j = h.fontFamily ?? e.fontFamily, ee = h.scribbleStyle ?? e.scribbleStyle, he = JSON.stringify([A, R, j, ee]);
15346
15346
  he !== _ && (_ = he, u = hd(
15347
15347
  A,
@@ -15439,7 +15439,7 @@ function Pw({
15439
15439
  return;
15440
15440
  S.preventDefault();
15441
15441
  const x = S.clientX - r.x, m = S.clientY - r.y;
15442
- !l && Math.hypot(x, m) < ao || (l = !0, t.classList.add("pluno-pa-widget--dragging"), s({ x: c.x + x, y: c.y + m }));
15442
+ !l && Math.hypot(x, m) < co || (l = !0, t.classList.add("pluno-pa-widget--dragging"), s({ x: c.x + x, y: c.y + m }));
15443
15443
  }, y = (S) => {
15444
15444
  a === S.pointerId && (S.preventDefault(), S.stopPropagation(), l && (u = { x: S.clientX, y: S.clientY }, o()), d());
15445
15445
  }, g = (S) => {
@@ -15450,7 +15450,7 @@ function Pw({
15450
15450
  const x = Math.hypot(
15451
15451
  S.clientX - u.x,
15452
15452
  S.clientY - u.y
15453
- ) <= ao;
15453
+ ) <= co;
15454
15454
  u = null, x && (S.preventDefault(), S.stopPropagation());
15455
15455
  }, _ = (S) => {
15456
15456
  if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
@@ -15480,7 +15480,7 @@ function qw({
15480
15480
  return;
15481
15481
  g.preventDefault(), g.stopPropagation();
15482
15482
  const b = g.clientX - a.x, _ = g.clientY - a.y;
15483
- !c && Math.hypot(b, _) < ao || (c = !0, t.classList.add("pluno-pa-widget--panel-dragging"), i({ x: r.x + b, y: r.y + _ }));
15483
+ !c && Math.hypot(b, _) < co || (c = !0, t.classList.add("pluno-pa-widget--panel-dragging"), i({ x: r.x + b, y: r.y + _ }));
15484
15484
  }, p = (g) => {
15485
15485
  o === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && s(), l());
15486
15486
  }, f = (g) => {
@@ -15512,7 +15512,7 @@ function Mw({
15512
15512
  return;
15513
15513
  b.preventDefault(), b.stopPropagation();
15514
15514
  const _ = b.clientX - r.x, S = b.clientY - r.y;
15515
- !l && Math.hypot(_, S) < ao || (l = !0, t.classList.add("pluno-pa-widget--resizing"), i(
15515
+ !l && Math.hypot(_, S) < co || (l = !0, t.classList.add("pluno-pa-widget--resizing"), i(
15516
15516
  md(c, a, _, S)
15517
15517
  ));
15518
15518
  }, f = (b) => {
@@ -15646,9 +15646,9 @@ function Ow() {
15646
15646
  };
15647
15647
  }
15648
15648
  function zn(t = null) {
15649
- return t ? wo(t) : Ow();
15649
+ return t ? _o(t) : Ow();
15650
15650
  }
15651
- function wo(t) {
15651
+ function _o(t) {
15652
15652
  const e = tt();
15653
15653
  return {
15654
15654
  width: vt(
@@ -15675,12 +15675,12 @@ function wo(t) {
15675
15675
  )
15676
15676
  };
15677
15677
  }
15678
- function zr(t, e) {
15678
+ function Br(t, e) {
15679
15679
  if (!e) {
15680
15680
  t.style.removeProperty("--pluno-pa-panel-width"), t.style.removeProperty("--pluno-pa-panel-height");
15681
15681
  return;
15682
15682
  }
15683
- const n = wo(e);
15683
+ const n = _o(e);
15684
15684
  t.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), t.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
15685
15685
  }
15686
15686
  function Dw(t, e, n) {
@@ -15696,7 +15696,7 @@ function Dw(t, e, n) {
15696
15696
  y: a.height - 24 - n.height
15697
15697
  };
15698
15698
  }
15699
- function Br(t, e, n) {
15699
+ function jr(t, e, n) {
15700
15700
  const i = Zi(t, !1);
15701
15701
  return e ? Vs(
15702
15702
  t,
@@ -15735,7 +15735,7 @@ function Vs(t, e, n) {
15735
15735
  function Nw(t, e) {
15736
15736
  if (e <= 0)
15737
15737
  return !1;
15738
- const n = tt(), i = t.top - ge - Ca, s = n.height - t.bottom - ge - Ca;
15738
+ const n = tt(), i = t.top - ge - Aa, s = n.height - t.bottom - ge - Aa;
15739
15739
  return i < e && s >= e;
15740
15740
  }
15741
15741
  function Gs(t, e) {
@@ -15745,7 +15745,7 @@ function Gs(t, e) {
15745
15745
  y: t.anchor.startsWith("bottom") ? n.height - e.height - t.y : t.y
15746
15746
  };
15747
15747
  }
15748
- function jr(t, e) {
15748
+ function Fr(t, e) {
15749
15749
  const n = Uw(t, e), i = tt();
15750
15750
  return {
15751
15751
  anchor: n,
@@ -15760,7 +15760,7 @@ function Uw(t, e) {
15760
15760
  function zw(t) {
15761
15761
  return t.classList.contains("pluno-pa-widget--scribble") ? Sw : Iw;
15762
15762
  }
15763
- function Fr(t, e, n, i = null) {
15763
+ function $r(t, e, n, i = null) {
15764
15764
  const s = Zi(t), o = zn(i), a = {
15765
15765
  x: n === "bottom-left" ? e.x : e.x + s.width - o.width,
15766
15766
  y: e.y + s.height - o.height
@@ -15816,7 +15816,7 @@ function tt() {
15816
15816
  height: window.innerHeight || document.documentElement.clientHeight || ep + ge * 2
15817
15817
  };
15818
15818
  }
15819
- function $r(t) {
15819
+ function Hr(t) {
15820
15820
  const e = t.getBoundingClientRect();
15821
15821
  return {
15822
15822
  x: Math.round(e.x),
@@ -15952,10 +15952,10 @@ function Vw(t, e, n, i, s) {
15952
15952
  s
15953
15953
  )
15954
15954
  ), t.appendChild(Xw()), t.appendChild(
15955
- _o(
15955
+ vo(
15956
15956
  "pluno-pa-widget__close",
15957
15957
  "Close",
15958
- qa(16),
15958
+ Ma(16),
15959
15959
  !0
15960
15960
  )
15961
15961
  ), t.appendChild(Jw(n, i));
@@ -15984,7 +15984,7 @@ function Gw(t, e, n, i) {
15984
15984
  a.className = "pluno-pa-widget__launcher-run-indicator", s.appendChild(a);
15985
15985
  const r = document.createElement("input");
15986
15986
  r.className = "pluno-pa-widget__launcher-input", r.type = "text", r.placeholder = t, r.setAttribute("aria-label", t), s.appendChild(r);
15987
- const c = vo("Working...");
15987
+ const c = Io("Working...");
15988
15988
  if (c.classList.add("pluno-pa-widget__status--launcher"), s.appendChild(c), i) {
15989
15989
  const l = document.createElement("button");
15990
15990
  l.type = "button", l.className = "pluno-pa-widget__launcher-minimize", l.textContent = "-", l.setAttribute("aria-label", "Minimize Pluno on this site"), l.title = "Minimize Pluno on this site", s.appendChild(l);
@@ -16021,9 +16021,9 @@ function Jw(t, e) {
16021
16021
  p.className = "pluno-pa-widget__connection-notice", p.hidden = !0, l.append(d, u, p), l.append(Qw(), Yw()), s.append(l, c);
16022
16022
  const f = document.createElement("div");
16023
16023
  f.className = "pluno-pa-widget__top-actions", f.appendChild(
16024
- _o(
16024
+ vo(
16025
16025
  "pluno-pa-widget__history",
16026
- Pa(),
16026
+ qa(),
16027
16027
  a_(),
16028
16028
  !0
16029
16029
  )
@@ -16134,7 +16134,7 @@ function Zw() {
16134
16134
  const u = document.createElement("summary");
16135
16135
  u.className = "pluno-pa-widget__model-trigger";
16136
16136
  const d = document.createElement("span");
16137
- u.append(d, qa(12)), l.appendChild(u);
16137
+ u.append(d, Ma(12)), l.appendChild(u);
16138
16138
  const p = document.createElement("div");
16139
16139
  p.className = "pluno-pa-widget__model-menu";
16140
16140
  for (const b of Qi)
@@ -16144,7 +16144,7 @@ function Zw() {
16144
16144
  b.className = "pluno-pa-widget__model-more";
16145
16145
  const _ = document.createElement("summary"), S = document.createElement("span");
16146
16146
  S.textContent = "More";
16147
- const x = qa(12);
16147
+ const x = Ma(12);
16148
16148
  x.classList.add("pluno-pa-widget__model-more-chevron"), _.append(S, x), b.appendChild(_);
16149
16149
  for (const m of rl) {
16150
16150
  const w = Id(m);
@@ -16168,17 +16168,17 @@ function Id(t) {
16168
16168
  const i = document.createElement("span");
16169
16169
  return i.className = "pluno-pa-widget__model-price", i.textContent = t.price, e.append(n, i), e.setAttribute("role", "option"), e;
16170
16170
  }
16171
- function Pa() {
16171
+ function qa() {
16172
16172
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
16173
16173
  }
16174
16174
  function e_() {
16175
16175
  const t = document.createElement("section");
16176
- t.className = "pluno-pa-widget__history-panel", t.hidden = !0, t.setAttribute("aria-label", Pa());
16176
+ t.className = "pluno-pa-widget__history-panel", t.hidden = !0, t.setAttribute("aria-label", qa());
16177
16177
  const e = document.createElement("div");
16178
16178
  e.className = "pluno-pa-widget__history-header";
16179
16179
  const n = document.createElement("strong");
16180
- n.textContent = Pa();
16181
- const i = _o(
16180
+ n.textContent = qa();
16181
+ const i = vo(
16182
16182
  "pluno-pa-widget__history-close",
16183
16183
  "Close recent chats",
16184
16184
  sc(),
@@ -16356,12 +16356,12 @@ function n_(t, e) {
16356
16356
  "flood-opacity": "0.22"
16357
16357
  });
16358
16358
  const g = Q(o, "clipPath", { id: i.boltClip });
16359
- Q(g, "path", { d: oo });
16359
+ Q(g, "path", { d: ro });
16360
16360
  const b = Q(s, "g", {
16361
16361
  filter: bt(i.softDropShadow)
16362
16362
  });
16363
16363
  Q(b, "path", {
16364
- d: oo,
16364
+ d: ro,
16365
16365
  fill: bt(i.boltEdge)
16366
16366
  });
16367
16367
  const _ = "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";
@@ -16428,7 +16428,7 @@ function i_(t, e) {
16428
16428
  clip: `${e}-scribbleBoltClip`,
16429
16429
  wobble: `${e}-scribbleBoltWobble`
16430
16430
  }, s = cp(), o = Q(s, "defs"), a = Q(o, "clipPath", { id: i.clip });
16431
- Q(a, "path", { d: oo });
16431
+ Q(a, "path", { d: ro });
16432
16432
  const r = Q(o, "filter", {
16433
16433
  id: i.wobble,
16434
16434
  x: "-10%",
@@ -16463,9 +16463,9 @@ function i_(t, e) {
16463
16463
  opacity: "0.9",
16464
16464
  transform: "rotate(-14 627 600)"
16465
16465
  }), Q(c, "path", {
16466
- d: oo,
16466
+ d: ro,
16467
16467
  fill: "none",
16468
- stroke: ro,
16468
+ stroke: ao,
16469
16469
  "stroke-width": "18",
16470
16470
  "stroke-linejoin": "round"
16471
16471
  }), kd(
@@ -16524,14 +16524,14 @@ function kd(t, e, n, i, s, o, a, r) {
16524
16524
  rx: "73",
16525
16525
  ry: "80",
16526
16526
  fill: "#ffffff",
16527
- stroke: ro,
16527
+ stroke: ao,
16528
16528
  "stroke-width": "13"
16529
16529
  }), Q(c, "ellipse", {
16530
16530
  cx: s,
16531
16531
  cy: o,
16532
16532
  rx: "45",
16533
16533
  ry: "53",
16534
- fill: ro
16534
+ fill: ao
16535
16535
  }), Q(c, "circle", {
16536
16536
  cx: a,
16537
16537
  cy: r,
@@ -16550,7 +16550,7 @@ function Ne(t, e, n, i) {
16550
16550
  function bt(t) {
16551
16551
  return `url(#${t})`;
16552
16552
  }
16553
- function _o(t, e, n, i) {
16553
+ function vo(t, e, n, i) {
16554
16554
  const s = document.createElement("button");
16555
16555
  return s.type = "button", s.className = t, s.setAttribute("aria-label", e), s.title = e, s.hidden = i, s.appendChild(n), s;
16556
16556
  }
@@ -16562,10 +16562,10 @@ function s_() {
16562
16562
  width: "0",
16563
16563
  height: "0"
16564
16564
  }), e = le("defs");
16565
- return e.appendChild(Kr("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(
16566
- Kr("pluno-pa-scribble-wobble-2", "5", "15")
16565
+ return e.appendChild(Wr("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(
16566
+ Wr("pluno-pa-scribble-wobble-2", "5", "15")
16567
16567
  ), e.appendChild(
16568
- Kr("pluno-pa-scribble-wobble-3", "9", "19")
16568
+ Wr("pluno-pa-scribble-wobble-3", "9", "19")
16569
16569
  ), t.appendChild(e), t;
16570
16570
  }
16571
16571
  function lp(t, e) {
@@ -16577,16 +16577,16 @@ function lp(t, e) {
16577
16577
  });
16578
16578
  return dp(n, e), n;
16579
16579
  }
16580
- function Hr(t, e) {
16580
+ function Kr(t, e) {
16581
16581
  if (!t)
16582
16582
  return;
16583
16583
  const n = Math.max(
16584
16584
  0,
16585
- e - Ta * 2
16585
+ e - Pa * 2
16586
16586
  ), i = Math.max(
16587
16587
  vw,
16588
16588
  Math.floor(
16589
- (n - Ra * 2) / Aa
16589
+ (n - Ta * 2) / Ra
16590
16590
  )
16591
16591
  );
16592
16592
  dp(t, i);
@@ -16594,14 +16594,14 @@ function Hr(t, e) {
16594
16594
  function dp(t, e) {
16595
16595
  if (t.dataset.spiralCount === `${e}`)
16596
16596
  return;
16597
- const n = e * Aa + Ra * 2;
16597
+ const n = e * Ra + Ta * 2;
16598
16598
  t.dataset.spiralCount = `${e}`, t.setAttribute(
16599
16599
  "viewBox",
16600
16600
  `0 0 ${n} ${_w}`
16601
16601
  ), t.replaceChildren();
16602
16602
  for (let i = 0; i < e; i += 1) {
16603
16603
  const s = ud[i % ud.length], o = le("g", {
16604
- transform: `translate(${Ra + i * Aa} 0)`
16604
+ transform: `translate(${Ta + i * Ra} 0)`
16605
16605
  });
16606
16606
  o.appendChild(
16607
16607
  le("ellipse", {
@@ -16625,7 +16625,7 @@ function dp(t, e) {
16625
16625
  ), t.appendChild(o);
16626
16626
  }
16627
16627
  }
16628
- function Kr(t, e, n) {
16628
+ function Wr(t, e, n) {
16629
16629
  const i = le("filter", {
16630
16630
  id: t,
16631
16631
  x: "-8%",
@@ -16668,7 +16668,7 @@ function Kr(t, e, n) {
16668
16668
  })
16669
16669
  ), i;
16670
16670
  }
16671
- function qa(t) {
16671
+ function Ma(t) {
16672
16672
  const e = It(
16673
16673
  "0 0 24 24",
16674
16674
  t,
@@ -16908,7 +16908,7 @@ function g_(t, e, n) {
16908
16908
  }
16909
16909
  }
16910
16910
  function f_(t) {
16911
- const e = oc(t), n = co(t);
16911
+ const e = oc(t), n = lo(t);
16912
16912
  if (e === "image" && n) {
16913
16913
  const i = document.createElement("img");
16914
16914
  return i.src = n, i.alt = "", i.setAttribute("aria-hidden", "true"), i.addEventListener(
@@ -16929,7 +16929,7 @@ function f_(t) {
16929
16929
  return $n(t);
16930
16930
  }
16931
16931
  function m_(t, e) {
16932
- const n = oc(t), i = co(t);
16932
+ const n = oc(t), i = lo(t);
16933
16933
  if (n === "image" && i) {
16934
16934
  const s = document.createElement("img");
16935
16935
  s.className = "pluno-pa-widget__message-attachment-preview", s.alt = t.name;
@@ -16956,7 +16956,7 @@ function m_(t, e) {
16956
16956
  };
16957
16957
  let a = i;
16958
16958
  const r = () => {
16959
- const c = co(o);
16959
+ const c = lo(o);
16960
16960
  if (c && c !== a) {
16961
16961
  a = c, s.src = c;
16962
16962
  return;
@@ -16976,7 +16976,7 @@ function y_(t, e, n, i, s, o) {
16976
16976
  $n(e(), "message")
16977
16977
  );
16978
16978
  }, l = () => {
16979
- const f = co(e());
16979
+ const f = lo(e());
16980
16980
  if (f && f !== a) {
16981
16981
  a = f, t.addEventListener("error", l, {
16982
16982
  once: !0
@@ -17033,7 +17033,7 @@ function $n(t, e = "composer") {
17033
17033
  function oc(t) {
17034
17034
  return t.mimeType.startsWith("image/") ? "image" : t.mimeType === "application/pdf" ? "pdf" : t.mimeType.startsWith("video/") ? "video" : "file";
17035
17035
  }
17036
- function co(t) {
17036
+ function lo(t) {
17037
17037
  return "previewUrl" in t && t.previewUrl ? t.previewUrl : t.fileUrl ?? "";
17038
17038
  }
17039
17039
  function Ed(t) {
@@ -17079,7 +17079,7 @@ function v_(t, e) {
17079
17079
  const i = document.createElement("span");
17080
17080
  i.append("Using cheaper model - ");
17081
17081
  const s = document.createElement("a");
17082
- return s.href = t.pricingUrl, s.target = "_blank", s.rel = "noopener noreferrer", s.textContent = "upgrade here", i.appendChild(s), n.appendChild(i), n;
17082
+ return s.href = t.pricingUrl, s.target = "_blank", s.rel = "noopener noreferrer", s.textContent = t.pricingUrl.startsWith("mailto:") ? "contact support" : "upgrade here", i.appendChild(s), n.appendChild(i), n;
17083
17083
  }
17084
17084
  function I_(t) {
17085
17085
  const e = document.createElement("div");
@@ -17087,10 +17087,10 @@ function I_(t) {
17087
17087
  const n = t.submissionGate?.reason, i = n === "credits_exhausted", s = n === "onboarding_required", o = document.createElement("strong");
17088
17088
  o.textContent = s ? "Complete onboarding" : i ? "Credits used up" : "Billing needs attention", e.appendChild(o);
17089
17089
  const a = document.createElement("span");
17090
- if (a.textContent = s ? "Complete onboarding to unlock credits and start using Pluno." : i ? "Earn bonus credits or upgrade to keep using Pluno on this product." : "Open billing to keep using Pluno.", e.appendChild(a), s) {
17090
+ if (a.textContent = s ? "Complete onboarding to unlock credits and start using Pluno." : t.pricingUrl.startsWith("mailto:") ? "Contact support to continue your product trial." : i ? "Earn bonus credits or upgrade to keep using Pluno on this product." : "Open billing to keep using Pluno.", e.appendChild(a), s) {
17091
17091
  const r = document.createElement("div");
17092
17092
  r.className = "pluno-pa-widget__billing-action-card-actions", r.appendChild(
17093
- Ma("Complete onboarding", t.onboardingUrl ?? "")
17093
+ Js("Complete onboarding", t.onboardingUrl ?? "")
17094
17094
  ), e.appendChild(r);
17095
17095
  } else
17096
17096
  e.appendChild(
@@ -17111,13 +17111,13 @@ function $i(t) {
17111
17111
  }
17112
17112
  function k_(t, e, n) {
17113
17113
  const i = document.createElement("div");
17114
- return i.className = n, i.appendChild(
17115
- Ma(e, t.pricingUrl)
17114
+ return i.className = n, t.pricingUrl.startsWith("mailto:") ? (i.appendChild(Js("Contact support", t.pricingUrl)), i) : (i.appendChild(
17115
+ Js(e, t.pricingUrl)
17116
17116
  ), i.appendChild(
17117
- Ma("Earn credits", t.earnCreditsUrl)
17118
- ), i;
17117
+ Js("Earn credits", t.earnCreditsUrl)
17118
+ ), i);
17119
17119
  }
17120
- function Ma(t, e) {
17120
+ function Js(t, e) {
17121
17121
  const n = document.createElement("button");
17122
17122
  if (n.type = "button", t === "Earn credits") {
17123
17123
  const i = document.createElement("span");
@@ -17360,14 +17360,14 @@ function E_(t, e, n, i, s, o, a, r, c, l, u, d, p, f, y, g, b, _, S, x, m, w, I,
17360
17360
  if (L.role === "system") {
17361
17361
  if (L.dataType === "run_error" || L.dataType === "run_status") {
17362
17362
  const $ = K(), J = U.some(
17363
- (se) => se.role === "tool" && lo(se, L)
17363
+ (se) => se.role === "tool" && uo(se, L)
17364
17364
  );
17365
17365
  if (!$ && !J) {
17366
17366
  const se = es(g());
17367
17367
  se.classList.add("pluno-pa-widget__terminal-marker"), Z(se);
17368
17368
  }
17369
17369
  const H = document.createElement("div"), de = L.dataType === "run_error";
17370
- if (H.className = de ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", H.dataset.messageKey = rc(L), H.dataset.canonicalItemKey = L.id, H.dataset.messageRole = "system", L.provisional || (H.dataset.terminalResponseKey = L.id), L.runId && (H.dataset.runId = L.runId), H.textContent = uo(
17370
+ if (H.className = de ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", H.dataset.messageKey = rc(L), H.dataset.canonicalItemKey = L.id, H.dataset.messageRole = "system", L.provisional || (H.dataset.terminalResponseKey = L.id), L.runId && (H.dataset.runId = L.runId), H.textContent = po(
17371
17371
  L.content
17372
17372
  ), de && L.securitySettingsUrl) {
17373
17373
  const se = document.createElement("a");
@@ -17378,8 +17378,8 @@ function E_(t, e, n, i, s, o, a, r, c, l, u, d, p, f, y, g, b, _, S, x, m, w, I,
17378
17378
  continue;
17379
17379
  }
17380
17380
  L.role;
17381
- const ce = K(), Y = uo(L.content), X = L.role === "assistant" && U.some(
17382
- ($) => $.role === "tool" && lo($, L)
17381
+ const ce = K(), Y = po(L.content), X = L.role === "assistant" && U.some(
17382
+ ($) => $.role === "tool" && uo($, L)
17383
17383
  );
17384
17384
  if (L.role === "assistant" && !ce && !X) {
17385
17385
  const $ = es(g());
@@ -17647,7 +17647,7 @@ function U_(t) {
17647
17647
  if (!n.respondsToUserMessageId)
17648
17648
  return [...t.messages, n];
17649
17649
  const i = t.messages.findIndex(
17650
- (a) => lo(a, n) && Oa(a)
17650
+ (a) => uo(a, n) && Oa(a)
17651
17651
  );
17652
17652
  if (i !== -1)
17653
17653
  return [
@@ -17657,7 +17657,7 @@ function U_(t) {
17657
17657
  ];
17658
17658
  let s = -1;
17659
17659
  for (let a = t.messages.length - 1; a >= 0; a -= 1)
17660
- if (lo(t.messages[a], n)) {
17660
+ if (uo(t.messages[a], n)) {
17661
17661
  s = a;
17662
17662
  break;
17663
17663
  }
@@ -17675,7 +17675,7 @@ function z_(t, e) {
17675
17675
  return a ? s.has(a.id) ? [] : (s.add(a.id), a.activityIds.flatMap((r) => n.has(r) ? [n.get(r)] : [])) : [o];
17676
17676
  });
17677
17677
  }
17678
- function lo(t, e) {
17678
+ function uo(t, e) {
17679
17679
  return t.respondsToUserMessageId && e.respondsToUserMessageId ? t.respondsToUserMessageId === e.respondsToUserMessageId : !!(t.runId && t.runId === e.runId);
17680
17680
  }
17681
17681
  function mp(t) {
@@ -17814,7 +17814,7 @@ function H_(t) {
17814
17814
  function bp(t) {
17815
17815
  return t.role === "tool" && t.toolName === Va;
17816
17816
  }
17817
- function uo(t) {
17817
+ function po(t) {
17818
17818
  return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
17819
17819
  }
17820
17820
  function K_(t, e, n, i, s, o, a, r = !0) {
@@ -17833,7 +17833,7 @@ function K_(t, e, n, i, s, o, a, r = !0) {
17833
17833
  a
17834
17834
  ), I = JSON.stringify(a), E = document.createElement("div");
17835
17835
  E.className = "pluno-pa-widget__tool-active-content";
17836
- const T = vo(), k = document.createElement("details"), M = document.createElement("summary");
17836
+ const T = Io(), k = document.createElement("details"), M = document.createElement("summary");
17837
17837
  M.className = "pluno-pa-widget__tool-summary";
17838
17838
  const q = document.createElement("div");
17839
17839
  q.className = "pluno-pa-widget__tool-summary-title", M.appendChild(q), M.addEventListener("click", () => {
@@ -17880,7 +17880,7 @@ function K_(t, e, n, i, s, o, a, r = !0) {
17880
17880
  }
17881
17881
  const g = d.details;
17882
17882
  g.open = n.has(l) || !n.has(`closed:${l}`) && !r, f.classList.toggle("pluno-pa-widget__tool-group--open", g.open);
17883
- const b = t[t.length - 1], _ = uo(
17883
+ const b = t[t.length - 1], _ = po(
17884
17884
  b.content
17885
17885
  ).trim(), S = b.phase === "commentary", x = _ ? S ? _ : _p(_) : c ? "Steered" : "Thinking...";
17886
17886
  return f.dataset.collapsedActivityTitle = x, d.summaryTitle.replaceChildren(), d.summaryTitle.classList.add(
@@ -17902,7 +17902,7 @@ function W_(t, e, n, i) {
17902
17902
  i.set(l, u), u.className = "pluno-pa-widget__tool-line", u.dataset.eventType = c.phase === "commentary" ? "commentary" : "tool", c.phase === "commentary" ? delete u.dataset.toolCallKey : u.dataset.toolCallKey = l, u.dataset.canonicalItemKey = c.id, c.runId ? u.dataset.runId = c.runId : delete u.dataset.runId;
17903
17903
  const d = u.querySelector(".pluno-pa-widget__tool-line-text") ?? document.createElement("div");
17904
17904
  d.className = "pluno-pa-widget__tool-line-text";
17905
- const p = uo(c.content) || (c.phase === "commentary" ? "" : "Run tool"), f = c.phase === "commentary" ? p : _p(p);
17905
+ const p = po(c.content) || (c.phase === "commentary" ? "" : "Run tool"), f = c.phase === "commentary" ? p : _p(p);
17906
17906
  s[r] ? (d.classList.add("pluno-pa-widget__tool-line-text--loading"), d.dataset.loadingText = wf(f)) : delete d.dataset.loadingText, d.classList.add("pluno-pa-widget__tool-line-markdown"), d.replaceChildren();
17907
17907
  const y = document.createElement("div");
17908
17908
  if (y.className = "pluno-pa-widget__tool-line-markdown", cc(y, f), d.append(y), s[r]) {
@@ -17962,7 +17962,7 @@ function Rd(t, e, n, i, s = "Thinking...") {
17962
17962
  a.character?.replaceWith(c), a.character = c, a.characterSignature = r;
17963
17963
  }
17964
17964
  } else {
17965
- const c = es(i), l = vo(s);
17965
+ const c = es(i), l = Io(s);
17966
17966
  c.classList.add("pluno-pa-widget__thinking-marker"), c.appendChild(l), a = {
17967
17967
  node: c,
17968
17968
  status: l,
@@ -17977,7 +17977,7 @@ function Td(t, e, n, i = "Thinking...") {
17977
17977
  e.add(s);
17978
17978
  let o = t.get(s);
17979
17979
  if (!o) {
17980
- const a = vo(i);
17980
+ const a = Io(i);
17981
17981
  o = { node: a, status: a }, t.set(s, o);
17982
17982
  }
17983
17983
  return vp(o.status, i), o.node;
@@ -17986,7 +17986,7 @@ function G_(t) {
17986
17986
  const e = es(t), n = document.createElement("div");
17987
17987
  return n.className = "pluno-pa-widget__status", n.textContent = "Steered", e.appendChild(n), e;
17988
17988
  }
17989
- function vo(t = "Thinking...") {
17989
+ function Io(t = "Thinking...") {
17990
17990
  const e = document.createElement("div");
17991
17991
  e.className = "pluno-pa-widget__status", e.dataset.thinkingStatus = "true";
17992
17992
  const n = document.createElement("span");
@@ -18009,7 +18009,7 @@ function bn() {
18009
18009
  function ac(t, e) {
18010
18010
  t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ? u_() : up());
18011
18011
  }
18012
- function Wr(t) {
18012
+ function Vr(t) {
18013
18013
  let e = t.trim();
18014
18014
  if (!e.includes("|"))
18015
18015
  return null;
@@ -18028,7 +18028,7 @@ function Q_(t) {
18028
18028
  return e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null;
18029
18029
  }
18030
18030
  function Y_(t, e) {
18031
- const n = Wr(t[e] ?? ""), i = Wr(t[e + 1] ?? "");
18031
+ const n = Vr(t[e] ?? ""), i = Vr(t[e + 1] ?? "");
18032
18032
  if (!n || !i || n.length !== i.length)
18033
18033
  return null;
18034
18034
  const s = [];
@@ -18048,7 +18048,7 @@ function Y_(t, e) {
18048
18048
  const l = document.createElement("tbody");
18049
18049
  let u = e + 2;
18050
18050
  for (; u < t.length && t[u].trim(); ) {
18051
- const d = Wr(t[u]);
18051
+ const d = Vr(t[u]);
18052
18052
  if (!d)
18053
18053
  break;
18054
18054
  const p = document.createElement("tr");
@@ -19911,7 +19911,7 @@ function Pd(t, e) {
19911
19911
  left: 0;
19912
19912
  }
19913
19913
  .pluno-pa-widget--proactive-suggestion-below .pluno-pa-widget__proactive-suggestion {
19914
- top: calc(var(--pluno-pa-launcher-height) + ${Ca}px);
19914
+ top: calc(var(--pluno-pa-launcher-height) + ${Aa}px);
19915
19915
  bottom: auto;
19916
19916
  }
19917
19917
  .pluno-pa-widget__proactive-suggestion-slot {
@@ -21066,8 +21066,8 @@ function Pd(t, e) {
21066
21066
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
21067
21067
  position: absolute;
21068
21068
  top: -16px;
21069
- left: ${Ta}px;
21070
- width: calc(100% - ${Ta * 2}px);
21069
+ left: ${Pa}px;
21070
+ width: calc(100% - ${Pa * 2}px);
21071
21071
  height: 36px;
21072
21072
  z-index: 3;
21073
21073
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -21690,9 +21690,9 @@ function iv(t) {
21690
21690
  return { clientId: t, release: () => {
21691
21691
  } };
21692
21692
  let e = 0;
21693
- for (; Ur.has(e); )
21693
+ for (; zr.has(e); )
21694
21694
  e += 1;
21695
- Ur.add(e);
21695
+ zr.add(e);
21696
21696
  const n = `${ow}${e}`;
21697
21697
  let i = crypto.randomUUID();
21698
21698
  try {
@@ -21703,7 +21703,7 @@ function iv(t) {
21703
21703
  return {
21704
21704
  clientId: i,
21705
21705
  release: () => {
21706
- s || (s = !0, Ur.delete(e));
21706
+ s || (s = !0, zr.delete(e));
21707
21707
  }
21708
21708
  };
21709
21709
  }
@@ -21720,7 +21720,7 @@ function sv(t) {
21720
21720
  (i) => typeof i == "string"
21721
21721
  ) : [],
21722
21722
  launcherPosition: rv(n.launcherPosition) ? n.launcherPosition : null,
21723
- panelSize: av(n.panelSize) ? wo(n.panelSize) : null
21723
+ panelSize: av(n.panelSize) ? _o(n.panelSize) : null
21724
21724
  };
21725
21725
  } catch {
21726
21726
  return Md();