@pluno/product-agent-web 0.1.319 → 0.1.320

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.
@@ -1,4 +1,4 @@
1
- function Ns(t, e, n) {
1
+ function Us(t, e, n) {
2
2
  t.throwIfAborted();
3
3
  let s, i = () => {
4
4
  };
@@ -20,7 +20,7 @@ function hn(t) {
20
20
  updatedAt: null
21
21
  };
22
22
  }
23
- function Ys(t, e) {
23
+ function Qs(t, e) {
24
24
  const n = t.key === e.key, s = n ? t.data : null;
25
25
  return {
26
26
  ...t,
@@ -47,10 +47,10 @@ function Hd(t, e) {
47
47
  function Kd(t, e) {
48
48
  return t.key !== e.key || t.requestId !== e.requestId ? t : { ...t, status: "error", error: e.error };
49
49
  }
50
- function Ao(t = null) {
50
+ function Ro(t = null) {
51
51
  return { authority: t, refusal: null, query: hn("account") };
52
52
  }
53
- function ls(t, e) {
53
+ function ds(t, e) {
54
54
  return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : t ?? { allowed: !0, reason: "allowed", actions: [] };
55
55
  }
56
56
  const Wd = {
@@ -146,15 +146,15 @@ const Wd = {
146
146
  embedded_widget: Hn,
147
147
  embedded_custom_ui: Hn
148
148
  };
149
- function Qs(t, e) {
149
+ function Xs(t, e) {
150
150
  return Vd[t][e] === !0;
151
151
  }
152
- function Ro() {
152
+ function To() {
153
153
  return { sources: {}, actions: {} };
154
154
  }
155
155
  function zc(t, e, n, s) {
156
156
  const i = t.account.authority, o = n.selections[n.clients[s]];
157
- return !i || !Qs(i.profile, "canManageInteractions") || !Qs(i.profile, "canManageIntegrationAuth") || n.authorityId !== i.authorityId || n.generation !== i.generation || !o || i.interactionAdapters?.integrationAuth === !1 ? [] : Object.values(t.interactions.sources).filter(
157
+ return !i || !Xs(i.profile, "canManageInteractions") || !Xs(i.profile, "canManageIntegrationAuth") || n.authorityId !== i.authorityId || n.generation !== i.generation || !o || i.interactionAdapters?.integrationAuth === !1 ? [] : Object.values(t.interactions.sources).filter(
158
158
  (r) => r.conversation_id === o.sessionId && r.payload.kind === "integration_auth" && r.lifecycle !== "completed"
159
159
  ).map((r) => {
160
160
  const a = Object.values(t.interactions.actions).filter(
@@ -258,7 +258,7 @@ function Gd(t, e, n, s) {
258
258
  }
259
259
  return { state: t, effects: o, command: null };
260
260
  }
261
- function To(t = 0) {
261
+ function Mo(t = 0) {
262
262
  return {
263
263
  localScribbleStyle: null,
264
264
  queries: {},
@@ -270,8 +270,8 @@ function To(t = 0) {
270
270
  schedulerError: null
271
271
  };
272
272
  }
273
- const Cs = (t) => t;
274
- function Us(t, e) {
273
+ const As = (t) => t;
274
+ function zs(t, e) {
275
275
  return JSON.stringify([
276
276
  t.authorityId,
277
277
  t.generation,
@@ -283,7 +283,7 @@ function Us(t, e) {
283
283
  null
284
284
  ]);
285
285
  }
286
- function Mo(t, e) {
286
+ function Po(t, e) {
287
287
  const n = {
288
288
  account: "canReadAccount",
289
289
  starterPrompts: "canReadStarterPrompts",
@@ -291,7 +291,7 @@ function Mo(t, e) {
291
291
  feedback: "canSubmitFeedback",
292
292
  generatePrompts: "canReadStarterPrompts"
293
293
  }[e.kind];
294
- if (!n || !Qs(t.profile, n))
294
+ if (!n || !Xs(t.profile, n))
295
295
  throw new Error("Feature capability unavailable.");
296
296
  }
297
297
  function ya(t, e, n) {
@@ -299,9 +299,9 @@ function ya(t, e, n) {
299
299
  const i = [];
300
300
  if (e.type === "stage7.initialize")
301
301
  return JSON.stringify(s.account.authority) !== JSON.stringify(e.authority) && (s = {
302
- account: { ...Ao(), authority: e.authority },
303
- features: To(e.now),
304
- interactions: Ro()
302
+ account: { ...Ro(), authority: e.authority },
303
+ features: Mo(e.now),
304
+ interactions: To()
305
305
  }), { state: s, effects: i };
306
306
  const o = s.account.authority;
307
307
  if (!o) return { state: s, effects: i };
@@ -316,8 +316,8 @@ function ya(t, e, n) {
316
316
  d,
317
317
  h
318
318
  ]), c = (d, h, f, m = !1) => {
319
- Mo(o, d);
320
- const g = h === "query" ? Us(o, d) : d.kind, y = a(h, f), b = JSON.stringify(d), _ = s.features.pending[y];
319
+ Po(o, d);
320
+ const g = h === "query" ? zs(o, d) : d.kind, y = a(h, f), b = JSON.stringify(d), _ = s.features.pending[y];
321
321
  if (_ && _.fingerprint !== b)
322
322
  throw new Error("Request ID was reused with a different payload.");
323
323
  if (_ && !m || h === "query" && !m && Object.values(s.features.pending).some(
@@ -326,21 +326,21 @@ function ya(t, e, n) {
326
326
  return;
327
327
  const v = { ...s.features.queries };
328
328
  if (h === "query")
329
- v[g] = Ys(
329
+ v[g] = Qs(
330
330
  v[g] ?? hn(g),
331
- { key: g, requestId: Cs(f), mode: "replace" }
331
+ { key: g, requestId: As(f), mode: "replace" }
332
332
  );
333
333
  else if (d.kind === "generatePrompts") {
334
334
  const I = {
335
335
  ...d.page,
336
336
  kind: "starterPrompts",
337
337
  includeUserSuggestions: d.includeUserSuggestions ?? !1
338
- }, k = Us(o, I);
339
- v[k] = Ys(
338
+ }, k = zs(o, I);
339
+ v[k] = Qs(
340
340
  v[k] ?? hn(k),
341
341
  {
342
342
  key: k,
343
- requestId: Cs(f),
343
+ requestId: As(f),
344
344
  mode: "replace"
345
345
  }
346
346
  );
@@ -393,14 +393,14 @@ function ya(t, e, n) {
393
393
  case "stage7.retire":
394
394
  return {
395
395
  state: {
396
- account: Ao(),
397
- features: To(r),
398
- interactions: Ro()
396
+ account: Ro(),
397
+ features: Mo(r),
398
+ interactions: To()
399
399
  },
400
400
  effects: i
401
401
  };
402
402
  case "stage7.account_refusal": {
403
- const d = ls(
403
+ const d = ds(
404
404
  void 0,
405
405
  e.code
406
406
  );
@@ -473,7 +473,7 @@ function ya(t, e, n) {
473
473
  if (!d || d.status !== "pending") break;
474
474
  const h = e.type === "effect.failed", f = { ...s.features.queries };
475
475
  let m = d.key;
476
- d.operation.kind === "generatePrompts" && (m = Us(o, {
476
+ d.operation.kind === "generatePrompts" && (m = zs(o, {
477
477
  ...d.operation.page,
478
478
  kind: "starterPrompts",
479
479
  includeUserSuggestions: d.operation.includeUserSuggestions ?? !1
@@ -481,11 +481,11 @@ function ya(t, e, n) {
481
481
  const g = f[m];
482
482
  g && (f[m] = h ? Kd(g, {
483
483
  key: m,
484
- requestId: Cs(d.requestId),
484
+ requestId: As(d.requestId),
485
485
  error: e.error
486
486
  }) : Hd(g, {
487
487
  key: m,
488
- requestId: Cs(d.requestId),
488
+ requestId: As(d.requestId),
489
489
  data: e.output.data,
490
490
  cursor: null,
491
491
  updatedAt: e.output.completedAt
@@ -532,14 +532,14 @@ function ya(t, e, n) {
532
532
  }
533
533
  return { state: s, effects: i };
534
534
  }
535
- function Xs(t, e) {
536
- return t.account.authority ? t.features.queries[Us(t.account.authority, e)] ?? null : null;
535
+ function Zs(t, e) {
536
+ return t.account.authority ? t.features.queries[zs(t.account.authority, e)] ?? null : null;
537
537
  }
538
538
  function Jd(t, e) {
539
- const n = Xs(t, e);
539
+ const n = Zs(t, e);
540
540
  return n?.status === "loading" || n?.status === "refreshing";
541
541
  }
542
- function Po(t) {
542
+ function qo(t) {
543
543
  if (!t || typeof t != "object" || Array.isArray(t))
544
544
  throw new Error("Invalid feature response object.");
545
545
  return t;
@@ -554,7 +554,7 @@ function ba(t) {
554
554
  return t.map(Yd);
555
555
  }
556
556
  function Qd(t) {
557
- const e = Po(t);
557
+ const e = qo(t);
558
558
  if (e.success !== !0)
559
559
  throw new Error(
560
560
  typeof e.message == "string" ? e.message : "Failed to submit feedback"
@@ -570,7 +570,7 @@ function Xd(t) {
570
570
  };
571
571
  return {
572
572
  "stage7.query": async ({ authority: n, query: s }) => {
573
- e(n), Mo(n, s);
573
+ e(n), Po(n, s);
574
574
  let i;
575
575
  switch (s.kind) {
576
576
  case "account":
@@ -580,7 +580,7 @@ function Xd(t) {
580
580
  };
581
581
  break;
582
582
  case "starterPrompts": {
583
- const o = Po(
583
+ const o = qo(
584
584
  await t.http.request(
585
585
  "/starter-prompts",
586
586
  { page_url: s.pageUrl },
@@ -605,7 +605,7 @@ function Xd(t) {
605
605
  return e(n), { data: i, completedAt: t.now() };
606
606
  },
607
607
  "stage7.mutate": async ({ authority: n, mutation: s }) => {
608
- e(n), Mo(n, s);
608
+ e(n), Po(n, s);
609
609
  let i;
610
610
  switch (s.kind) {
611
611
  case "feedback":
@@ -614,7 +614,7 @@ function Xd(t) {
614
614
  });
615
615
  break;
616
616
  case "generatePrompts": {
617
- const o = Po(
617
+ const o = qo(
618
618
  await t.http.request(
619
619
  "/starter-prompts",
620
620
  {},
@@ -706,7 +706,7 @@ function Bc(t, e, n) {
706
706
  (y) => y.requestId === o
707
707
  );
708
708
  if (!g && e.type === "stage7.query") {
709
- const y = Xs(m, e.query);
709
+ const y = Zs(m, e.query);
710
710
  y?.status === "error" ? h(y.error) : y?.status === "ready" && y.data && h(null, y.data);
711
711
  }
712
712
  g?.status === "error" ? h(g.error) : g?.status === "done" && h(null, g.result);
@@ -812,7 +812,7 @@ function iu(t, e, n = null, s = !0) {
812
812
  reason: r,
813
813
  recovery: a
814
814
  }), o = t.authority;
815
- return o ? Qs(
815
+ return o ? Xs(
816
816
  o.profile,
817
817
  Wd[e]
818
818
  ) ? s ? i("allowed", "none") : i("device", "settings") : i("capability", "none") : i("authentication", "login");
@@ -846,24 +846,24 @@ function ou(t, e = null) {
846
846
  } : void 0);
847
847
  return { ...s, ...a ? { auth: a } : {}, submissionGate: r };
848
848
  }
849
- const ru = "0.1.319", En = {
849
+ const ru = "0.1.320", En = {
850
850
  version: ru
851
851
  };
852
- function li(t) {
852
+ function di(t) {
853
853
  if (!t || typeof t != "object") return !1;
854
854
  const e = t;
855
855
  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);
856
856
  }
857
- function ds(t) {
857
+ function us(t) {
858
858
  if (t === null || typeof t == "string" || typeof t == "boolean") return !0;
859
859
  if (typeof t == "number") return Number.isFinite(t);
860
- if (Array.isArray(t)) return t.every(ds);
860
+ if (Array.isArray(t)) return t.every(us);
861
861
  if (typeof t != "object") return !1;
862
862
  const e = Object.getPrototypeOf(t);
863
- return e !== Object.prototype && e !== null ? !1 : Object.values(t).every(ds);
863
+ return e !== Object.prototype && e !== null ? !1 : Object.values(t).every(us);
864
864
  }
865
865
  function au(t) {
866
- if (t.details !== void 0 && !ds(t.details))
866
+ if (t.details !== void 0 && !us(t.details))
867
867
  throw new TypeError("Product Agent transported error details must be JSON-safe.");
868
868
  return {
869
869
  code: t.code,
@@ -876,7 +876,7 @@ function Wt(t, e = "runtime_error", n = "runtime") {
876
876
  const s = t !== null && typeof t == "object" ? t : null, i = typeof t == "string" ? t : s && "message" in s && typeof s.message == "string" ? s.message : "", o = s && "code" in s && typeof s.code == "string" && s.code.trim() ? s.code : e, r = s && "details" in s ? s.details : null, a = r && typeof r == "object" ? r : {}, c = {
877
877
  ...typeof a.httpStatus == "number" && Number.isInteger(a.httpStatus) && a.httpStatus >= 100 && a.httpStatus <= 599 ? { httpStatus: a.httpStatus } : {},
878
878
  // Preserve the first boundary's shape after normalization replaces the original message/prototype.
879
- errorNormalization: li(a.errorNormalization) ? a.errorNormalization : {
879
+ errorNormalization: di(a.errorNormalization) ? a.errorNormalization : {
880
880
  boundary: n,
881
881
  category: t instanceof Error ? "error" : t === null ? "null" : Array.isArray(t) ? "array" : typeof t,
882
882
  messageKind: i.trim() === "[object Object]" ? "object_coercion" : i.trim() ? "text" : typeof t == "string" || s && "message" in s && typeof s.message == "string" ? "blank" : "non_text"
@@ -905,20 +905,20 @@ function an(t) {
905
905
  if (!e) throw new Error("Display timestamps must retain the backend UTC precision.");
906
906
  return `${e[1]}.${(e[2] ?? "").padEnd(6, "0")}`;
907
907
  }
908
- function Zs(t) {
908
+ function ei(t) {
909
909
  return "revision" in t.data ? t.data.revision : null;
910
910
  }
911
911
  function Be(t) {
912
912
  return t !== null && typeof t == "object" && !Object.isFrozen(t) && (Object.values(t).forEach(Be), Object.freeze(t)), t;
913
913
  }
914
914
  function Ye(t) {
915
- if (!ds(t)) throw new Error("Conversation inputs must be JSON-safe values.");
915
+ if (!us(t)) throw new Error("Conversation inputs must be JSON-safe values.");
916
916
  return JSON.parse(JSON.stringify(t));
917
917
  }
918
918
  function Fc(t = "", e = 0) {
919
919
  return Be({ authorityId: t, generation: e, pendingRestoration: {}, proactiveQuestions: {}, sessions: {}, submissions: {}, submissionOrder: [], stops: {}, requests: {}, requestSequence: 0, deliveries: {}, operations: {}, effectsEnabled: !1, durableSubmissionIds: [], pendingDurabilityIds: [], checkpointEffectId: null, checkpointError: null });
920
920
  }
921
- function qo(t) {
921
+ function Oo(t) {
922
922
  return {
923
923
  sessionId: t,
924
924
  items: {},
@@ -935,22 +935,22 @@ function $c(t) {
935
935
  return ["history_load_failed", "request_timed_out", "connection_interrupted", "408", "425", "429"].includes(t) || /^5\d\d$/.test(t);
936
936
  }
937
937
  const lu = "Message storage has not confirmed this submission. Reconnect to check its status.";
938
- function di(t) {
938
+ function ui(t) {
939
939
  if (!Number.isSafeInteger(t) || t < 0) throw new Error("Invalid conversation revision.");
940
940
  }
941
- function Oo(t, e) {
941
+ function Do(t, e) {
942
942
  if (e.conversation_id !== t.sessionId) throw new Error("Display item belongs to another conversation.");
943
943
  if (t.removedItems[e.id]) return t;
944
944
  const n = an(e.created_at);
945
945
  an(e.updated_at);
946
- const s = Zs(e);
947
- s !== null && di(s);
946
+ const s = ei(e);
947
+ s !== null && ui(s);
948
948
  const i = t.streams[e.id];
949
949
  if (s !== null && i && (i.state === "stopped" || i.state === "finished") && s > i.revision) return t;
950
950
  const o = t.items[e.id];
951
951
  if (o) {
952
952
  if (an(o.created_at) !== n) throw new Error("Display shell timestamp changed.");
953
- const r = Zs(o);
953
+ const r = ei(o);
954
954
  if (r !== null && s !== null) {
955
955
  if (s <= r) return t;
956
956
  } else if (an(e.updated_at) <= an(o.updated_at)) return t;
@@ -958,13 +958,13 @@ function Oo(t, e) {
958
958
  return { ...t, items: { ...t.items, [e.id]: { ...e, created_at: o?.created_at ?? e.created_at } } };
959
959
  }
960
960
  function Hc(t, e) {
961
- if (di(e.revision), t.removedItems[e.item_id]) return t;
961
+ if (ui(e.revision), t.removedItems[e.item_id]) return t;
962
962
  const n = t.streams[e.item_id];
963
963
  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 } };
964
964
  }
965
- function Do(t, e) {
965
+ function Lo(t, e) {
966
966
  if (e.conversation_id !== t.sessionId) throw new Error("Execution belongs to another conversation.");
967
- if (di(e.version), t.execution && e.version <= t.execution.version) return t;
967
+ if (ui(e.version), t.execution && e.version <= t.execution.version) return t;
968
968
  const n = { ...t.executionByUserMessage };
969
969
  for (const s of gt(e)) n[s] = {
970
970
  version: e.version,
@@ -976,23 +976,23 @@ function Do(t, e) {
976
976
  function du(t) {
977
977
  const e = /* @__PURE__ */ new Set();
978
978
  for (const n of Object.values(t.items)) {
979
- const s = Zs(n), i = t.streams[n.id];
979
+ const s = ei(n), i = t.streams[n.id];
980
980
  s !== null && (!i || i.state === "open" || s < i.revision) && e.add(n.id);
981
981
  }
982
982
  for (const n of [...Object.keys(t.streams), ...Object.values(t.removedItems)])
983
983
  !t.items[n] && !t.removedItems[n] && e.add(n);
984
984
  return [...e];
985
985
  }
986
- function Ki(t, e) {
986
+ function Wi(t, e) {
987
987
  switch (e.type) {
988
988
  case "conversation.interaction.updated":
989
989
  return t;
990
990
  case "conversation.follow_ups.updated":
991
- return di(e.version), e.version > t.followUpsVersion ? { ...t, followUps: e.follow_ups, followUpsVersion: e.version } : t;
991
+ return ui(e.version), e.version > t.followUpsVersion ? { ...t, followUps: e.follow_ups, followUpsVersion: e.version } : t;
992
992
  case "conversation.item.updated":
993
- return Oo(t, e.item);
993
+ return Do(t, e.item);
994
994
  case "conversation.execution.updated":
995
- return Do(t, e.execution);
995
+ return Lo(t, e.execution);
996
996
  case "conversation.item.stream_finished":
997
997
  if (e.conversation_id !== t.sessionId) throw new Error("Stream belongs to another conversation.");
998
998
  return Hc(t, { item_id: e.item_id, revision: e.revision, state: e.state });
@@ -1006,20 +1006,20 @@ function Ki(t, e) {
1006
1006
  }
1007
1007
  }
1008
1008
  }
1009
- function Lo(t, e, n) {
1009
+ function No(t, e, n) {
1010
1010
  const s = { ...t.submissions };
1011
1011
  for (const i of Object.values(s))
1012
1012
  if (i.conversationScopeId === e.conversationScopeId && !((i.cancelled || e.cancelled) && i.userMessageId !== e.userMessageId)) {
1013
1013
  if (i.sessionId !== null && i.sessionId !== n) throw new Error("Submission scope accepted into conflicting conversations.");
1014
1014
  s[i.userMessageId] = { ...i, sessionId: n };
1015
1015
  }
1016
- return { ...t, submissions: s, sessions: { ...t.sessions, [n]: t.sessions[n] ?? qo(n) } };
1016
+ return { ...t, submissions: s, sessions: { ...t.sessions, [n]: t.sessions[n] ?? Oo(n) } };
1017
1017
  }
1018
- function No(t, e) {
1018
+ function Uo(t, e) {
1019
1019
  const n = e.clients[t.clientScopeId];
1020
1020
  return n === t.conversationScopeId || n === void 0 && t.sessionId !== null && (e.memberships[t.sessionId]?.members.length ?? 0) > 0;
1021
1021
  }
1022
- function Uo(t, e, n = !1) {
1022
+ function zo(t, e, n = !1) {
1023
1023
  if (t.authorityId !== (e.authorityId ?? "") || t.generation !== e.generation) {
1024
1024
  const o = Fc(e.authorityId ?? void 0, e.generation);
1025
1025
  if (!n || t.authorityId) return o;
@@ -1036,9 +1036,9 @@ function Uo(t, e, n = !1) {
1036
1036
  let i = Object.keys(s).length === Object.keys(t.pendingRestoration).length ? t : { ...t, pendingRestoration: s };
1037
1037
  for (const o of Object.values(t.submissions)) {
1038
1038
  if (i.pendingRestoration[o.clientScopeId] === o.conversationScopeId) continue;
1039
- o.delivery !== "accepted" && !o.cancelled && !No(o, e) && (i = { ...i, submissions: { ...i.submissions, [o.userMessageId]: { ...o, cancelled: !0, cancellationReason: o.cancellationReason ?? "owner_lost" } } });
1039
+ o.delivery !== "accepted" && !o.cancelled && !Uo(o, e) && (i = { ...i, submissions: { ...i.submissions, [o.userMessageId]: { ...o, cancelled: !0, cancellationReason: o.cancellationReason ?? "owner_lost" } } });
1040
1040
  const r = e.selections[o.conversationScopeId]?.sessionId;
1041
- r && !i.submissions[o.userMessageId].cancelled && o.sessionId === null && (i = Lo(i, i.submissions[o.userMessageId], r));
1041
+ r && !i.submissions[o.userMessageId].cancelled && o.sessionId === null && (i = No(i, i.submissions[o.userMessageId], r));
1042
1042
  }
1043
1043
  for (const [o, r] of Object.entries(i.requests)) {
1044
1044
  if ((e.memberships[r.sessionId]?.members.length ?? 0) > 0) continue;
@@ -1052,7 +1052,7 @@ function Uo(t, e, n = !1) {
1052
1052
  }
1053
1053
  return Be(i);
1054
1054
  }
1055
- function As(t) {
1055
+ function Rs(t) {
1056
1056
  return JSON.stringify(t, (e, n) => n && typeof n == "object" && !Array.isArray(n) ? Object.fromEntries(Object.entries(n).sort(([s], [i]) => s.localeCompare(i))) : n);
1057
1057
  }
1058
1058
  function uu(t, e, n, s) {
@@ -1079,8 +1079,8 @@ function uu(t, e, n, s) {
1079
1079
  let f = t.submissions;
1080
1080
  if (e.type === "effect.completed" && e.output.snapshot.conversation_id !== a.sessionId) throw new Error("Snapshot belongs to another conversation.");
1081
1081
  if (e.type === "effect.completed" && !e.output.snapshot.projection_ready && (e.output.snapshot.preparation === "pending" || e.output.snapshot.preparation === "busy")) {
1082
- for (const m of e.output.snapshot.items) m.type === "user_message" && (c = Oo(c, m));
1083
- c = Do(c, e.output.snapshot.execution), c = {
1082
+ for (const m of e.output.snapshot.items) m.type === "user_message" && (c = Do(c, m));
1083
+ c = Lo(c, e.output.snapshot.execution), c = {
1084
1084
  ...c,
1085
1085
  ...a.lane === "current" ? { preparation: e.output.snapshot.preparation } : {},
1086
1086
  queries: { ...c.queries, [a.lane]: { ...l, status: "loading", requestId: null, error: null } }
@@ -1097,10 +1097,10 @@ function uu(t, e, n, s) {
1097
1097
  a.lane === "current" && (c = { ...c, preparation: null });
1098
1098
  const g = c.queries.history, y = a.lane === "current" && (g.status === "not_requested" || m.next_cursor !== null && !c.items[m.next_cursor]);
1099
1099
  if (m.conversation_id !== a.sessionId) throw new Error("Snapshot belongs to another conversation.");
1100
- for (const b of m.removed_items) c = Ki(c, b);
1101
- for (const b of m.items) c = Oo(c, b);
1100
+ for (const b of m.removed_items) c = Wi(c, b);
1101
+ for (const b of m.items) c = Do(c, b);
1102
1102
  for (const b of m.streams) c = Hc(c, b);
1103
- if (c = Do(c, m.execution), c = Ki(c, {
1103
+ if (c = Lo(c, m.execution), c = Wi(c, {
1104
1104
  type: "conversation.follow_ups.updated",
1105
1105
  conversation_id: m.conversation_id,
1106
1106
  version: m.follow_ups_version,
@@ -1151,7 +1151,7 @@ function uu(t, e, n, s) {
1151
1151
  if (!a || a.cancelled || a.delivery === "failed") return { state: t, effects: o };
1152
1152
  const c = Ye({ pageContent: e.pageContent, sessionTabs: e.sessionTabs });
1153
1153
  if (a.contextPreparation !== null) {
1154
- if (As(a.contextPreparation) !== As(c)) throw new Error("Prepared submission context cannot change.");
1154
+ if (Rs(a.contextPreparation) !== Rs(c)) throw new Error("Prepared submission context cannot change.");
1155
1155
  return { state: t, effects: o };
1156
1156
  }
1157
1157
  i = { ...t, submissions: { ...t.submissions, [e.userMessageId]: { ...a, contextPreparation: c } } };
@@ -1162,7 +1162,7 @@ function uu(t, e, n, s) {
1162
1162
  const { type: a, authorityId: c, generation: l, prepareContext: u, reconcileAcceptance: d, waitForAuthentication: h, ...f } = e, m = t.submissions[e.userMessageId];
1163
1163
  if (m) {
1164
1164
  const { contextPreparation: I, requestedModel: k, sessionId: T, delivery: O, cancelled: G, cancellationReason: E, error: B, executionVersion: q, ...V } = m;
1165
- if (As(V) !== As(f)) throw new Error("User-message identity cannot be reused with different input.");
1165
+ if (Rs(V) !== Rs(f)) throw new Error("User-message identity cannot be reused with different input.");
1166
1166
  return { state: t, effects: o };
1167
1167
  }
1168
1168
  const g = n.selections[e.conversationScopeId], y = Object.values(t.submissions).find((I) => I.conversationScopeId === e.conversationScopeId && !I.cancelled && I.sessionId !== null), b = s.scopes[e.clientScopeId], _ = {
@@ -1182,7 +1182,7 @@ function uu(t, e, n, s) {
1182
1182
  case "conversation.submission_accepted": {
1183
1183
  const a = t.submissions[e.userMessageId];
1184
1184
  if (!a) return { state: t, effects: o };
1185
- i = Lo(t, a, e.sessionId), i = { ...i, submissions: { ...i.submissions, [e.userMessageId]: { ...i.submissions[e.userMessageId], delivery: "accepted", error: null } } };
1185
+ i = No(t, a, e.sessionId), i = { ...i, submissions: { ...i.submissions, [e.userMessageId]: { ...i.submissions[e.userMessageId], delivery: "accepted", error: null } } };
1186
1186
  break;
1187
1187
  }
1188
1188
  case "conversation.submission_delivery": {
@@ -1208,14 +1208,14 @@ function uu(t, e, n, s) {
1208
1208
  }
1209
1209
  case "conversation.display_received": {
1210
1210
  const a = Ye(e.event), c = a.type === "conversation.item.updated" ? a.item.conversation_id : a.type === "conversation.execution.updated" ? a.execution.conversation_id : a.type === "conversation.interaction.updated" ? a.interaction.conversation_id : a.conversation_id, l = a.type === "conversation.item.updated" && a.item.type === "user_message" ? t.submissions[a.item.id] : void 0;
1211
- if (l && (i = Lo(t, l, c)), !i.sessions[c] && !n.memberships[c]?.members.length && !l) return { state: t, effects: o };
1211
+ if (l && (i = No(t, l, c)), !i.sessions[c] && !n.memberships[c]?.members.length && !l) return { state: t, effects: o };
1212
1212
  n.memberships[c]?.members.length && (a.type === "conversation.interaction.updated" || a.type === "conversation.execution.updated" || a.type === "conversation.item.updated" && a.item.type === "user_message") && (r = {
1213
1213
  authorityId: t.authorityId,
1214
1214
  generation: t.generation,
1215
1215
  sessionId: c,
1216
1216
  sources: a.type === "conversation.interaction.updated" ? [a.interaction] : []
1217
1217
  });
1218
- const u = i.sessions[c] ?? qo(c), d = Ki(u, a);
1218
+ const u = i.sessions[c] ?? Oo(c), d = Wi(u, a);
1219
1219
  d !== u && (i = { ...i, sessions: { ...i.sessions, [c]: d } });
1220
1220
  break;
1221
1221
  }
@@ -1234,7 +1234,7 @@ function uu(t, e, n, s) {
1234
1234
  }
1235
1235
  case "conversation.snapshot": {
1236
1236
  if (!n.memberships[e.sessionId]?.members.length) return { state: t, effects: o };
1237
- const a = t.sessions[e.sessionId] ?? qo(e.sessionId), c = a.queries[e.lane];
1237
+ const a = t.sessions[e.sessionId] ?? Oo(e.sessionId), c = a.queries[e.lane];
1238
1238
  if (c.requestId !== null) return { state: t, effects: o };
1239
1239
  const l = {
1240
1240
  authorityId: e.authorityId,
@@ -1252,7 +1252,7 @@ function uu(t, e, n, s) {
1252
1252
  requests: { ...t.requests, [h]: { ...l, acceptedUserMessageIds: u } },
1253
1253
  sessions: { ...t.sessions, [e.sessionId]: { ...a, queries: {
1254
1254
  ...a.queries,
1255
- [e.lane]: Ys(c, { key: c.key, requestId: e.requestId, mode: l.before === null ? "replace" : "append" })
1255
+ [e.lane]: Qs(c, { key: c.key, requestId: e.requestId, mode: l.before === null ? "replace" : "append" })
1256
1256
  } } }
1257
1257
  }, o.push({ id: h, kind: "conversation.snapshot", input: l });
1258
1258
  break;
@@ -1318,7 +1318,7 @@ function Ht(t, e) {
1318
1318
  const n = t.submissions[e], s = t.deliveries[e];
1319
1319
  return !n.cancelled || s?.step === "send" || s?.step === "receipt";
1320
1320
  }
1321
- function zo(t, e, n, s = !1) {
1321
+ function Bo(t, e, n, s = !1) {
1322
1322
  if (!e.effectsEnabled || !s && t.submissions === e.submissions && t.deliveries === e.deliveries && t.operations === e.operations && t.stops === e.stops && t.sessions === e.sessions) return { state: e, effects: [] };
1323
1323
  const i = e.requestSequence + 1, o = `conversation:${e.generation}:${i}`, r = Be({ ...e, requestSequence: i, checkpointEffectId: o });
1324
1324
  return { state: r, effects: [{ id: o, kind: "conversation.checkpoint", input: {
@@ -1327,7 +1327,7 @@ function zo(t, e, n, s = !1) {
1327
1327
  checkpoint: ur(r, n)
1328
1328
  } }] };
1329
1329
  }
1330
- function Bo(t, e = null) {
1330
+ function jo(t, e = null) {
1331
1331
  return { command: Ye(t), conversationScopeId: e, phase: "waiting", effectId: null, result: null, error: null };
1332
1332
  }
1333
1333
  function pu(t) {
@@ -1339,7 +1339,7 @@ function va(t, e) {
1339
1339
  throw new Error("Conversation acceptance receipt does not match the submitted message.");
1340
1340
  return { sessionId: t.sessionId, clientMessageId: e };
1341
1341
  }
1342
- function jo(t) {
1342
+ function Fo(t) {
1343
1343
  let e = t;
1344
1344
  const n = [];
1345
1345
  if (!t.effectsEnabled || !t.authorityId) return { state: t, effects: n };
@@ -1403,7 +1403,7 @@ function jo(t) {
1403
1403
  const r = (a, c, l, u = "user_requested") => {
1404
1404
  if (e.operations[a]) return;
1405
1405
  const d = i();
1406
- e = { ...e, operations: { ...e.operations, [a]: Bo({
1406
+ e = { ...e, operations: { ...e.operations, [a]: jo({
1407
1407
  request_id: d,
1408
1408
  type: "run.stop",
1409
1409
  payload: { sessionId: c, expectedUserMessageId: l, reason: u }
@@ -1525,7 +1525,7 @@ function hu(t, e, n, s) {
1525
1525
  const m = e.output;
1526
1526
  m?.sessionId && (i = { ...i, operations: {
1527
1527
  ...i.operations,
1528
- [`cleanup:${h}`]: Bo({
1528
+ [`cleanup:${h}`]: jo({
1529
1529
  request_id: `cleanup:${f.command.request_id}`,
1530
1530
  type: "session.reset",
1531
1531
  payload: {
@@ -1564,8 +1564,8 @@ function hu(t, e, n, s) {
1564
1564
  submissions: Object.fromEntries(Object.entries(m.submissions).map(([I, k]) => [I, {
1565
1565
  ...k,
1566
1566
  executionVersion: null,
1567
- cancelled: k.cancelled || !v(k) && !No(k, n),
1568
- ...!k.cancelled && !v(k) && !No(k, n) ? { cancellationReason: "owner_lost" } : {},
1567
+ cancelled: k.cancelled || !v(k) && !Uo(k, n),
1568
+ ...!k.cancelled && !v(k) && !Uo(k, n) ? { cancellationReason: "owner_lost" } : {},
1569
1569
  delivery: (k.contextPreparation === null && !m.deliveries[I]?.handoffRecovery || !m.deliveries[I]) && !k.cancelled && k.delivery !== "accepted" ? "failed" : k.delivery === "sending" ? "uncertain" : k.delivery,
1570
1570
  error: k.contextPreparation === null && !m.deliveries[I]?.handoffRecovery && !k.cancelled && !["unauthorized", "auth_reconnecting"].includes(k.error?.code ?? "") ? { code: "context_preparation_interrupted", message: "Page context preparation was interrupted. Please send this message again.", retryable: !1 } : !m.deliveries[I] && k.delivery !== "accepted" && !k.cancelled ? { code: "submission_interrupted", message: "Message preparation was interrupted. Retry this message.", retryable: !0 } : k.error
1571
1571
  }])),
@@ -1594,7 +1594,7 @@ function hu(t, e, n, s) {
1594
1594
  }
1595
1595
  if (e.type === "conversation.restoration_resolved") {
1596
1596
  const d = { ...i.pendingRestoration };
1597
- delete d[e.clientScopeId], i = Uo({ ...i, pendingRestoration: d }, n);
1597
+ delete d[e.clientScopeId], i = zo({ ...i, pendingRestoration: d }, n);
1598
1598
  }
1599
1599
  if (e.type === "conversation.recover" && (i = {
1600
1600
  ...t,
@@ -1658,7 +1658,7 @@ function hu(t, e, n, s) {
1658
1658
  })) : t.stops;
1659
1659
  i = { ...t, stops: f, effectsEnabled: !0, operations: {
1660
1660
  ...t.operations,
1661
- [d.request_id]: Bo(d, e.conversationScopeId ?? null)
1661
+ [d.request_id]: jo(d, e.conversationScopeId ?? null)
1662
1662
  } };
1663
1663
  }
1664
1664
  }
@@ -1709,7 +1709,7 @@ function hu(t, e, n, s) {
1709
1709
  return h && !h.cancelled && !["accepted", "failed"].includes(h.delivery) && !a.durableSubmissionIds.includes(d);
1710
1710
  });
1711
1711
  c.length !== a.pendingDurabilityIds.length && (a = { ...a, pendingDurabilityIds: c });
1712
- const l = jo(a), u = zo(t, l.state, n, e.type === "conversation.recover" && t.checkpointError !== null);
1712
+ const l = Fo(a), u = Bo(t, l.state, n, e.type === "conversation.recover" && t.checkpointError !== null);
1713
1713
  return { state: u.state, effects: [...u.effects, ...r.effects, ...l.effects], interactionSources: r.interactionSources };
1714
1714
  }
1715
1715
  const gu = [
@@ -1952,7 +1952,7 @@ function _u(t, e, n) {
1952
1952
  projectionReady: typeof i?.projection_ready == "boolean" ? i.projection_ready : null
1953
1953
  };
1954
1954
  }
1955
- function ei(t) {
1955
+ function ti(t) {
1956
1956
  const e = t.closest("[data-conversation-gate]")?.dataset.conversationGate;
1957
1957
  return e === "authentication" || e === "signup" ? e : "none";
1958
1958
  }
@@ -1968,7 +1968,7 @@ function vu(t) {
1968
1968
  e = Math.imul(e ^ t.charCodeAt(s), 16777619) >>> 0, n = Math.imul(n ^ t.charCodeAt(s), 33) >>> 0;
1969
1969
  return `selection:${e.toString(16)}:${n.toString(16)}`;
1970
1970
  }
1971
- const Fo = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], ot = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), cn = (t) => t === null || ot(t), Yc = (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));
1971
+ const $o = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], ot = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), cn = (t) => t === null || ot(t), Yc = (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));
1972
1972
  function Qc(t) {
1973
1973
  if (!t || typeof t != "object") return !1;
1974
1974
  const e = t;
@@ -1987,7 +1987,7 @@ function Iu(t, e) {
1987
1987
  };
1988
1988
  return Qc(s) ? s : void 0;
1989
1989
  }
1990
- function $o(t) {
1990
+ function Ho(t) {
1991
1991
  const e = (n) => t[n].filter(ot).slice(-20);
1992
1992
  return {
1993
1993
  sessionId: ot(t.selectedSessionId) ? t.selectedSessionId : null,
@@ -1999,7 +1999,7 @@ function $o(t) {
1999
1999
  thinkingSequence: (t.thinkingSequence ?? []).slice(-20),
2000
2000
  runtimeItemCount: t.runtimeItemCount ?? 0,
2001
2001
  welcome: t.welcome ?? !1,
2002
- truncated: (t.thinkingSequence?.length ?? 0) > 20 || Fo.some((n) => t[n].length > 20 || t[n].some((s) => !ot(s)))
2002
+ truncated: (t.thinkingSequence?.length ?? 0) > 20 || $o.some((n) => t[n].length > 20 || t[n].some((s) => !ot(s)))
2003
2003
  };
2004
2004
  }
2005
2005
  function Xc(t) {
@@ -2021,17 +2021,17 @@ function Xc(t) {
2021
2021
  };
2022
2022
  }
2023
2023
  function Su(t, e, n) {
2024
- const s = $o(t), i = n ? Xc(n) : { truncated: !1 };
2024
+ const s = Ho(t), i = n ? Xc(n) : { truncated: !1 };
2025
2025
  return {
2026
- before: e ? $o(e) : null,
2026
+ before: e ? Ho(e) : null,
2027
2027
  current: { ...s, ...i, truncated: s.truncated || i.truncated }
2028
2028
  };
2029
2029
  }
2030
2030
  function xu(t, e, n = {}) {
2031
- const s = (r, a) => Array.from(t.querySelectorAll(r)).flatMap((c) => c.getAttribute(a) ?? []), i = $o({
2031
+ const s = (r, a) => Array.from(t.querySelectorAll(r)).flatMap((c) => c.getAttribute(a) ?? []), i = Ho({
2032
2032
  selectedSessionId: e.sessionId,
2033
2033
  runtimeItemCount: e.messages.length,
2034
- welcome: ei(t) === "none" && !!t.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report), .empty-state--starter"),
2034
+ welcome: ti(t) === "none" && !!t.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report), .empty-state--starter"),
2035
2035
  messageKeys: Array.from(t.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]")).flatMap((r) => r.dataset.messageKey ?? r.dataset.entryKey ?? []),
2036
2036
  canonicalItemKeys: s("[data-canonical-item-key]", "data-canonical-item-key"),
2037
2037
  terminalResponseKeys: s("[data-terminal-response-key]", "data-terminal-response-key"),
@@ -2044,14 +2044,14 @@ function xu(t, e, n = {}) {
2044
2044
  ...i,
2045
2045
  ...o,
2046
2046
  truncated: i.truncated || o.truncated,
2047
- context: Ho(t, e, n)
2047
+ context: Ko(t, e, n)
2048
2048
  };
2049
2049
  }
2050
- function Ho(t, e, n = {}) {
2050
+ function Ko(t, e, n = {}) {
2051
2051
  const s = e.conversationDiagnostics;
2052
2052
  return {
2053
2053
  sdkVersion: En.version,
2054
- presentationGate: ei(t),
2054
+ presentationGate: ti(t),
2055
2055
  capturedAt: Date.now(),
2056
2056
  selectionKey: vu(e.selectionKey),
2057
2057
  userId: pe(e.user?.id),
@@ -2080,7 +2080,7 @@ function Eu(t) {
2080
2080
  const e = (s) => {
2081
2081
  if (!s || typeof s != "object") return !1;
2082
2082
  const i = s;
2083
- return Object.keys(s).every((o) => [...Fo, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(o)) && (i.duplicateToolCalls === void 0 || Array.isArray(i.duplicateToolCalls) && i.duplicateToolCalls.length <= 5 && i.duplicateToolCalls.every((o) => o && Object.keys(o).every((r) => ["key", "count", "rows", "truncated"].includes(r)) && cn(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((r) => r && Object.keys(r).every((a) => ["itemId", "groupId"].includes(a)) && cn(r.itemId) && cn(r.groupId)))) && (i.context === void 0 || ku(i.context)) && (i.thinkingSequence === void 0 || Array.isArray(i.thinkingSequence) && i.thinkingSequence.length <= 20 && i.thinkingSequence.every((o) => o === "user" || o === "thinking")) && cn(i.sessionId) && Number.isSafeInteger(i.runtimeItemCount) && i.runtimeItemCount >= 0 && typeof i.welcome == "boolean" && typeof i.truncated == "boolean" && Fo.every((o) => Array.isArray(i[o]) && i[o].length <= 20 && i[o].every(ot));
2083
+ return Object.keys(s).every((o) => [...$o, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(o)) && (i.duplicateToolCalls === void 0 || Array.isArray(i.duplicateToolCalls) && i.duplicateToolCalls.length <= 5 && i.duplicateToolCalls.every((o) => o && Object.keys(o).every((r) => ["key", "count", "rows", "truncated"].includes(r)) && cn(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((r) => r && Object.keys(r).every((a) => ["itemId", "groupId"].includes(a)) && cn(r.itemId) && cn(r.groupId)))) && (i.context === void 0 || ku(i.context)) && (i.thinkingSequence === void 0 || Array.isArray(i.thinkingSequence) && i.thinkingSequence.length <= 20 && i.thinkingSequence.every((o) => o === "user" || o === "thinking")) && cn(i.sessionId) && Number.isSafeInteger(i.runtimeItemCount) && i.runtimeItemCount >= 0 && typeof i.welcome == "boolean" && typeof i.truncated == "boolean" && $o.every((o) => Array.isArray(i[o]) && i[o].length <= 20 && i[o].every(ot));
2084
2084
  }, n = t;
2085
2085
  return (n.before === null || e(n.before)) && e(n.current);
2086
2086
  }
@@ -2173,7 +2173,7 @@ function Mu(t, e, n, s, i = {}) {
2173
2173
  requestId: pe(o?.httpRequest?.requestId ?? o?.errorRequestId ?? o?.queryRequestId),
2174
2174
  ...pe(o?.failedClientMessageId) ? { clientMessageId: o.failedClientMessageId } : {},
2175
2175
  code: o ? pe(t.lastErrorCode) : null,
2176
- ...li(o?.errorNormalization) ? { normalization: o.errorNormalization } : {},
2176
+ ...di(o?.errorNormalization) ? { normalization: o.errorNormalization } : {},
2177
2177
  builds: { sdk: En.version, ...i }
2178
2178
  };
2179
2179
  }
@@ -2183,7 +2183,7 @@ function Xn(t, e = "runtime") {
2183
2183
  `).replace(/\n\s*at\s/g, `
2184
2184
  frame `)) : void 0;
2185
2185
  return {
2186
- ...li(n.details?.errorNormalization) ? { normalization: n.details.errorNormalization } : {},
2186
+ ...di(n.details?.errorNormalization) ? { normalization: n.details.errorNormalization } : {},
2187
2187
  category: t instanceof Error ? "error" : t === null ? "null" : Array.isArray(t) ? "array" : typeof t,
2188
2188
  code: pn(n.code),
2189
2189
  message: pn(n.message),
@@ -2276,7 +2276,7 @@ function Ou(t, e) {
2276
2276
  }
2277
2277
  return { schema: 1, authorityId: t.authorityId, operations: t.operations, stops: t.stops, requestSequence: t.requestSequence, submissions: n, submissionOrder: Object.keys(n), deliveries: s };
2278
2278
  }
2279
- function Wi(t) {
2279
+ function Vi(t) {
2280
2280
  try {
2281
2281
  return window.sessionStorage.getItem(t);
2282
2282
  } catch (e) {
@@ -2359,11 +2359,11 @@ wt.pong = "3";
2359
2359
  wt.message = "4";
2360
2360
  wt.upgrade = "5";
2361
2361
  wt.noop = "6";
2362
- const zs = /* @__PURE__ */ Object.create(null);
2362
+ const Bs = /* @__PURE__ */ Object.create(null);
2363
2363
  Object.keys(wt).forEach((t) => {
2364
- zs[wt[t]] = t;
2364
+ Bs[wt[t]] = t;
2365
2365
  });
2366
- const Ko = { type: "error", data: "parser error" }, el = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", tl = typeof ArrayBuffer == "function", nl = (t) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(t) : t && t.buffer instanceof ArrayBuffer, gr = ({ type: t, data: e }, n, s) => el && e instanceof Blob ? n ? s(e) : xa(e, s) : tl && (e instanceof ArrayBuffer || nl(e)) ? n ? s(e) : xa(new Blob([e]), s) : s(wt[t] + (e || "")), xa = (t, e) => {
2366
+ const Wo = { type: "error", data: "parser error" }, el = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", tl = typeof ArrayBuffer == "function", nl = (t) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(t) : t && t.buffer instanceof ArrayBuffer, gr = ({ type: t, data: e }, n, s) => el && e instanceof Blob ? n ? s(e) : xa(e, s) : tl && (e instanceof ArrayBuffer || nl(e)) ? n ? s(e) : xa(new Blob([e]), s) : s(wt[t] + (e || "")), xa = (t, e) => {
2367
2367
  const n = new FileReader();
2368
2368
  return n.onload = function() {
2369
2369
  const s = n.result.split(",")[1];
@@ -2373,14 +2373,14 @@ const Ko = { type: "error", data: "parser error" }, el = typeof Blob == "functio
2373
2373
  function ka(t) {
2374
2374
  return t instanceof Uint8Array ? t : t instanceof ArrayBuffer ? new Uint8Array(t) : new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
2375
2375
  }
2376
- let Vi;
2376
+ let Gi;
2377
2377
  function Lu(t, e) {
2378
2378
  if (el && t.data instanceof Blob)
2379
2379
  return t.data.arrayBuffer().then(ka).then(e);
2380
2380
  if (tl && (t.data instanceof ArrayBuffer || nl(t.data)))
2381
2381
  return e(ka(t.data));
2382
2382
  gr(t, !1, (n) => {
2383
- Vi || (Vi = new TextEncoder()), e(Vi.encode(n));
2383
+ Gi || (Gi = new TextEncoder()), e(Gi.encode(n));
2384
2384
  });
2385
2385
  }
2386
2386
  const Ea = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", es = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
@@ -2403,12 +2403,12 @@ const Nu = (t) => {
2403
2403
  return n === "b" ? {
2404
2404
  type: "message",
2405
2405
  data: zu(t.substring(1), e)
2406
- } : zs[n] ? t.length > 1 ? {
2407
- type: zs[n],
2406
+ } : Bs[n] ? t.length > 1 ? {
2407
+ type: Bs[n],
2408
2408
  data: t.substring(1)
2409
2409
  } : {
2410
- type: zs[n]
2411
- } : Ko;
2410
+ type: Bs[n]
2411
+ } : Wo;
2412
2412
  }, zu = (t, e) => {
2413
2413
  if (Uu) {
2414
2414
  const n = Nu(t);
@@ -2454,11 +2454,11 @@ function Fu() {
2454
2454
  }
2455
2455
  });
2456
2456
  }
2457
- let Gi;
2458
- function Rs(t) {
2457
+ let Ji;
2458
+ function Ts(t) {
2459
2459
  return t.reduce((e, n) => e + n.length, 0);
2460
2460
  }
2461
- function Ts(t, e) {
2461
+ function Ms(t, e) {
2462
2462
  if (t[0].length === e)
2463
2463
  return t.shift();
2464
2464
  const n = new Uint8Array(e);
@@ -2468,39 +2468,39 @@ function Ts(t, e) {
2468
2468
  return t.length && s < t[0].length && (t[0] = t[0].slice(s)), n;
2469
2469
  }
2470
2470
  function $u(t, e) {
2471
- Gi || (Gi = new TextDecoder());
2471
+ Ji || (Ji = new TextDecoder());
2472
2472
  const n = [];
2473
2473
  let s = 0, i = -1, o = !1;
2474
2474
  return new TransformStream({
2475
2475
  transform(r, a) {
2476
2476
  for (n.push(r); ; ) {
2477
2477
  if (s === 0) {
2478
- if (Rs(n) < 1)
2478
+ if (Ts(n) < 1)
2479
2479
  break;
2480
- const c = Ts(n, 1);
2480
+ const c = Ms(n, 1);
2481
2481
  o = (c[0] & 128) === 128, i = c[0] & 127, i < 126 ? s = 3 : i === 126 ? s = 1 : s = 2;
2482
2482
  } else if (s === 1) {
2483
- if (Rs(n) < 2)
2483
+ if (Ts(n) < 2)
2484
2484
  break;
2485
- const c = Ts(n, 2);
2485
+ const c = Ms(n, 2);
2486
2486
  i = new DataView(c.buffer, c.byteOffset, c.length).getUint16(0), s = 3;
2487
2487
  } else if (s === 2) {
2488
- if (Rs(n) < 8)
2488
+ if (Ts(n) < 8)
2489
2489
  break;
2490
- const c = Ts(n, 8), l = new DataView(c.buffer, c.byteOffset, c.length), u = l.getUint32(0);
2490
+ const c = Ms(n, 8), l = new DataView(c.buffer, c.byteOffset, c.length), u = l.getUint32(0);
2491
2491
  if (u > Math.pow(2, 21) - 1) {
2492
- a.enqueue(Ko);
2492
+ a.enqueue(Wo);
2493
2493
  break;
2494
2494
  }
2495
2495
  i = u * Math.pow(2, 32) + l.getUint32(4), s = 3;
2496
2496
  } else {
2497
- if (Rs(n) < i)
2497
+ if (Ts(n) < i)
2498
2498
  break;
2499
- const c = Ts(n, i);
2500
- a.enqueue(fr(o ? c : Gi.decode(c), e)), s = 0;
2499
+ const c = Ms(n, i);
2500
+ a.enqueue(fr(o ? c : Ji.decode(c), e)), s = 0;
2501
2501
  }
2502
2502
  if (i === 0 || i > t) {
2503
- a.enqueue(Ko);
2503
+ a.enqueue(Wo);
2504
2504
  break;
2505
2505
  }
2506
2506
  }
@@ -2557,12 +2557,12 @@ Ie.prototype.listeners = function(t) {
2557
2557
  Ie.prototype.hasListeners = function(t) {
2558
2558
  return !!this.listeners(t).length;
2559
2559
  };
2560
- const ui = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, n) => n(e, 0), rt = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Ku = "arraybuffer";
2560
+ const pi = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, n) => n(e, 0), rt = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Ku = "arraybuffer";
2561
2561
  function rl(t, ...e) {
2562
2562
  return e.reduce((n, s) => (t.hasOwnProperty(s) && (n[s] = t[s]), n), {});
2563
2563
  }
2564
2564
  const Wu = rt.setTimeout, Vu = rt.clearTimeout;
2565
- function pi(t, e) {
2565
+ function hi(t, e) {
2566
2566
  e.useNativeTimers ? (t.setTimeoutFn = Wu.bind(rt), t.clearTimeoutFn = Vu.bind(rt)) : (t.setTimeoutFn = rt.setTimeout.bind(rt), t.clearTimeoutFn = rt.clearTimeout.bind(rt));
2567
2567
  }
2568
2568
  const Gu = 1.33;
@@ -2605,7 +2605,7 @@ class mr extends Ie {
2605
2605
  * @protected
2606
2606
  */
2607
2607
  constructor(e) {
2608
- super(), this.writable = !1, pi(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
2608
+ super(), this.writable = !1, hi(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
2609
2609
  }
2610
2610
  /**
2611
2611
  * Emits an error.
@@ -2837,7 +2837,7 @@ class sp extends ep {
2837
2837
  }), this.pollXhr = e;
2838
2838
  }
2839
2839
  }
2840
- let Sn = class Bs extends Ie {
2840
+ let Sn = class js extends Ie {
2841
2841
  /**
2842
2842
  * Request constructor
2843
2843
  *
@@ -2845,7 +2845,7 @@ let Sn = class Bs extends Ie {
2845
2845
  * @package
2846
2846
  */
2847
2847
  constructor(e, n, s) {
2848
- super(), this.createRequest = e, pi(this, s), this._opts = s, this._method = s.method || "GET", this._uri = n, this._data = s.data !== void 0 ? s.data : null, this._create();
2848
+ super(), this.createRequest = e, hi(this, s), this._opts = s, this._method = s.method || "GET", this._uri = n, this._data = s.data !== void 0 ? s.data : null, this._create();
2849
2849
  }
2850
2850
  /**
2851
2851
  * Creates the XHR object and sends the request.
@@ -2891,7 +2891,7 @@ let Sn = class Bs extends Ie {
2891
2891
  }, 0);
2892
2892
  return;
2893
2893
  }
2894
- typeof document < "u" && (this._index = Bs.requestsCount++, Bs.requests[this._index] = this);
2894
+ typeof document < "u" && (this._index = js.requestsCount++, js.requests[this._index] = this);
2895
2895
  }
2896
2896
  /**
2897
2897
  * Called upon error.
@@ -2913,7 +2913,7 @@ let Sn = class Bs extends Ie {
2913
2913
  this._xhr.abort();
2914
2914
  } catch {
2915
2915
  }
2916
- typeof document < "u" && delete Bs.requests[this._index], this._xhr = null;
2916
+ typeof document < "u" && delete js.requests[this._index], this._xhr = null;
2917
2917
  }
2918
2918
  }
2919
2919
  /**
@@ -3014,7 +3014,7 @@ class rp extends mr {
3014
3014
  this.doWrite(s, o);
3015
3015
  } catch {
3016
3016
  }
3017
- i && ui(() => {
3017
+ i && pi(() => {
3018
3018
  this.writable = !0, this.emitReserved("drain");
3019
3019
  }, this.setTimeoutFn);
3020
3020
  });
@@ -3034,10 +3034,10 @@ class rp extends mr {
3034
3034
  return this.opts.timestampRequests && (n[this.opts.timestampParam] = al()), this.supportsBinary || (n.b64 = 1), this.createUri(e, n);
3035
3035
  }
3036
3036
  }
3037
- const Ji = rt.WebSocket || rt.MozWebSocket;
3037
+ const Yi = rt.WebSocket || rt.MozWebSocket;
3038
3038
  class ap extends rp {
3039
3039
  createSocket(e, n, s) {
3040
- return dl ? new Ji(e, n, s) : n ? new Ji(e, n) : new Ji(e);
3040
+ return dl ? new Yi(e, n, s) : n ? new Yi(e, n) : new Yi(e);
3041
3041
  }
3042
3042
  doWrite(e, n) {
3043
3043
  this.ws.send(n);
@@ -3078,7 +3078,7 @@ class cp extends mr {
3078
3078
  for (let n = 0; n < e.length; n++) {
3079
3079
  const s = e[n], i = n === e.length - 1;
3080
3080
  this._writer.write(s).then(() => {
3081
- i && ui(() => {
3081
+ i && pi(() => {
3082
3082
  this.writable = !0, this.emitReserved("drain");
3083
3083
  }, this.setTimeoutFn);
3084
3084
  });
@@ -3109,7 +3109,7 @@ const lp = {
3109
3109
  "query",
3110
3110
  "anchor"
3111
3111
  ];
3112
- function Wo(t) {
3112
+ function Vo(t) {
3113
3113
  if (t.length > 8e3)
3114
3114
  throw "URI too long";
3115
3115
  const e = t, n = t.indexOf("["), s = t.indexOf("]");
@@ -3129,9 +3129,9 @@ function hp(t, e) {
3129
3129
  i && (n[i] = o);
3130
3130
  }), n;
3131
3131
  }
3132
- const Vo = typeof addEventListener == "function" && typeof removeEventListener == "function", js = [];
3133
- Vo && addEventListener("offline", () => {
3134
- js.forEach((t) => t());
3132
+ const Go = typeof addEventListener == "function" && typeof removeEventListener == "function", Fs = [];
3133
+ Go && addEventListener("offline", () => {
3134
+ Fs.forEach((t) => t());
3135
3135
  }, !1);
3136
3136
  class Kt extends Ie {
3137
3137
  /**
@@ -3142,10 +3142,10 @@ class Kt extends Ie {
3142
3142
  */
3143
3143
  constructor(e, n) {
3144
3144
  if (super(), this.binaryType = Ku, 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) {
3145
- const s = Wo(e);
3145
+ const s = Vo(e);
3146
3146
  n.hostname = s.host, n.secure = s.protocol === "https" || s.protocol === "wss", n.port = s.port, s.query && (n.query = s.query);
3147
- } else n.host && (n.hostname = Wo(n.host).host);
3148
- pi(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((s) => {
3147
+ } else n.host && (n.hostname = Vo(n.host).host);
3148
+ hi(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((s) => {
3149
3149
  const i = s.prototype.name;
3150
3150
  this.transports.push(i), this._transportsByName[i] = s;
3151
3151
  }), this.opts = Object.assign({
@@ -3162,13 +3162,13 @@ class Kt extends Ie {
3162
3162
  },
3163
3163
  transportOptions: {},
3164
3164
  closeOnBeforeunload: !1
3165
- }, n), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Xu(this.opts.query)), Vo && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
3165
+ }, n), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Xu(this.opts.query)), Go && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
3166
3166
  this.transport && (this.transport.removeAllListeners(), this.transport.close());
3167
3167
  }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
3168
3168
  this._onClose("transport close", {
3169
3169
  description: "network connection lost"
3170
3170
  });
3171
- }, js.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
3171
+ }, Fs.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
3172
3172
  }
3173
3173
  /**
3174
3174
  * Creates transport of the given type.
@@ -3317,7 +3317,7 @@ class Kt extends Ie {
3317
3317
  if (!this._pingTimeoutTime)
3318
3318
  return !0;
3319
3319
  const e = Date.now() > this._pingTimeoutTime;
3320
- return e && (this._pingTimeoutTime = 0, ui(() => {
3320
+ return e && (this._pingTimeoutTime = 0, pi(() => {
3321
3321
  this._onClose("ping timeout");
3322
3322
  }, this.setTimeoutFn)), e;
3323
3323
  }
@@ -3395,9 +3395,9 @@ class Kt extends Ie {
3395
3395
  */
3396
3396
  _onClose(e, n) {
3397
3397
  if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
3398
- if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), Vo && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
3399
- const s = js.indexOf(this._offlineEventListener);
3400
- s !== -1 && js.splice(s, 1);
3398
+ if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), Go && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
3399
+ const s = Fs.indexOf(this._offlineEventListener);
3400
+ s !== -1 && Fs.splice(s, 1);
3401
3401
  }
3402
3402
  this.readyState = "closed", this.id = null, this.emitReserved("close", e, n), this.writeBuffer = [], this._prevBufferLen = 0;
3403
3403
  }
@@ -3484,7 +3484,7 @@ let fp = class extends gp {
3484
3484
  };
3485
3485
  function mp(t, e = "", n) {
3486
3486
  let s = t;
3487
- 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), s = Wo(t)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
3487
+ 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), s = Vo(t)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
3488
3488
  const o = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
3489
3489
  return s.id = s.protocol + "://" + o + ":" + s.port + e, s.href = s.protocol + "://" + o + (n && n.port === s.port ? "" : ":" + s.port), s;
3490
3490
  }
@@ -3492,29 +3492,29 @@ const yp = typeof ArrayBuffer == "function", bp = (t) => typeof ArrayBuffer.isVi
3492
3492
  function yr(t) {
3493
3493
  return yp && (t instanceof ArrayBuffer || bp(t)) || wp && t instanceof Blob || _p && t instanceof File;
3494
3494
  }
3495
- function Fs(t, e) {
3495
+ function $s(t, e) {
3496
3496
  if (!t || typeof t != "object")
3497
3497
  return !1;
3498
3498
  if (Array.isArray(t)) {
3499
3499
  for (let n = 0, s = t.length; n < s; n++)
3500
- if (Fs(t[n]))
3500
+ if ($s(t[n]))
3501
3501
  return !0;
3502
3502
  return !1;
3503
3503
  }
3504
3504
  if (yr(t))
3505
3505
  return !0;
3506
3506
  if (t.toJSON && typeof t.toJSON == "function" && arguments.length === 1)
3507
- return Fs(t.toJSON(), !0);
3507
+ return $s(t.toJSON(), !0);
3508
3508
  for (const n in t)
3509
- if (Object.prototype.hasOwnProperty.call(t, n) && Fs(t[n]))
3509
+ if (Object.prototype.hasOwnProperty.call(t, n) && $s(t[n]))
3510
3510
  return !0;
3511
3511
  return !1;
3512
3512
  }
3513
3513
  function vp(t) {
3514
3514
  const e = [], n = t.data, s = t;
3515
- return s.data = $s(n, e), s.attachments = e.length, { packet: s, buffers: e };
3515
+ return s.data = Hs(n, e), s.attachments = e.length, { packet: s, buffers: e };
3516
3516
  }
3517
- function $s(t, e, n) {
3517
+ function Hs(t, e, n) {
3518
3518
  if (!t)
3519
3519
  return t;
3520
3520
  if (yr(t)) {
@@ -3523,22 +3523,22 @@ function $s(t, e, n) {
3523
3523
  } else if (Array.isArray(t)) {
3524
3524
  const s = new Array(t.length);
3525
3525
  for (let i = 0; i < t.length; i++)
3526
- s[i] = $s(t[i], e);
3526
+ s[i] = Hs(t[i], e);
3527
3527
  return s;
3528
3528
  } else if (typeof t == "object" && !(t instanceof Date)) {
3529
3529
  if (t.toJSON && typeof t.toJSON == "function" && !n)
3530
- return $s(t.toJSON(), e, !0);
3530
+ return Hs(t.toJSON(), e, !0);
3531
3531
  const s = {};
3532
3532
  for (const i in t)
3533
- Object.prototype.hasOwnProperty.call(t, i) && (s[i] = $s(t[i], e));
3533
+ Object.prototype.hasOwnProperty.call(t, i) && (s[i] = Hs(t[i], e));
3534
3534
  return s;
3535
3535
  }
3536
3536
  return t;
3537
3537
  }
3538
3538
  function Ip(t, e) {
3539
- return t.data = Go(t.data, e), delete t.attachments, t;
3539
+ return t.data = Jo(t.data, e), delete t.attachments, t;
3540
3540
  }
3541
- function Go(t, e) {
3541
+ function Jo(t, e) {
3542
3542
  if (!t)
3543
3543
  return t;
3544
3544
  if (t && t._placeholder === !0) {
@@ -3547,10 +3547,10 @@ function Go(t, e) {
3547
3547
  throw new Error("illegal attachments");
3548
3548
  } else if (Array.isArray(t))
3549
3549
  for (let n = 0; n < t.length; n++)
3550
- t[n] = Go(t[n], e);
3550
+ t[n] = Jo(t[n], e);
3551
3551
  else if (typeof t == "object")
3552
3552
  for (const n in t)
3553
- Object.prototype.hasOwnProperty.call(t, n) && (t[n] = Go(t[n], e));
3553
+ Object.prototype.hasOwnProperty.call(t, n) && (t[n] = Jo(t[n], e));
3554
3554
  return t;
3555
3555
  }
3556
3556
  const Sp = [
@@ -3587,7 +3587,7 @@ class xp {
3587
3587
  * @param {Object} obj - packet object
3588
3588
  */
3589
3589
  encode(e) {
3590
- return (e.type === Q.EVENT || e.type === Q.ACK) && Fs(e) ? this.encodeAsBinary({
3590
+ return (e.type === Q.EVENT || e.type === Q.ACK) && $s(e) ? this.encodeAsBinary({
3591
3591
  type: e.type === Q.EVENT ? Q.BINARY_EVENT : Q.BINARY_ACK,
3592
3592
  nsp: e.nsp,
3593
3593
  data: e.data,
@@ -4398,10 +4398,10 @@ Cn.prototype.setMax = function(t) {
4398
4398
  Cn.prototype.setJitter = function(t) {
4399
4399
  this.jitter = t;
4400
4400
  };
4401
- class Jo extends Ie {
4401
+ class Yo extends Ie {
4402
4402
  constructor(e, n) {
4403
4403
  var s;
4404
- 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, pi(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((s = n.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new Cn({
4404
+ 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, hi(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((s = n.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new Cn({
4405
4405
  min: this.reconnectionDelay(),
4406
4406
  max: this.reconnectionDelayMax(),
4407
4407
  jitter: this.randomizationFactor()
@@ -4519,7 +4519,7 @@ class Jo extends Ie {
4519
4519
  * @private
4520
4520
  */
4521
4521
  ondecoded(e) {
4522
- ui(() => {
4522
+ pi(() => {
4523
4523
  this.emitReserved("packet", e);
4524
4524
  }, this.setTimeoutFn);
4525
4525
  }
@@ -4637,17 +4637,17 @@ class Jo extends Ie {
4637
4637
  }
4638
4638
  }
4639
4639
  const Wn = {};
4640
- function Hs(t, e) {
4640
+ function Ks(t, e) {
4641
4641
  typeof t == "object" && (e = t, t = void 0), e = e || {};
4642
4642
  const n = mp(t, e.path || "/socket.io"), s = n.source, i = n.id, o = n.path, r = Wn[i] && o in Wn[i].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || r;
4643
4643
  let c;
4644
- return a ? c = new Jo(s, e) : (Wn[i] || (Wn[i] = new Jo(s, e)), c = Wn[i]), n.query && !e.query && (e.query = n.queryKey), c.socket(n.path, e);
4644
+ return a ? c = new Yo(s, e) : (Wn[i] || (Wn[i] = new Yo(s, e)), c = Wn[i]), n.query && !e.query && (e.query = n.queryKey), c.socket(n.path, e);
4645
4645
  }
4646
- Object.assign(Hs, {
4647
- Manager: Jo,
4646
+ Object.assign(Ks, {
4647
+ Manager: Yo,
4648
4648
  Socket: pl,
4649
- io: Hs,
4650
- connect: Hs
4649
+ io: Ks,
4650
+ connect: Ks
4651
4651
  });
4652
4652
  const Rp = 9e4, Tp = /* @__PURE__ */ new Set([
4653
4653
  "chat.user_message",
@@ -4675,7 +4675,7 @@ function Ra(t, e) {
4675
4675
  }
4676
4676
  class Mp {
4677
4677
  constructor(e) {
4678
- this.options = e, this.socket = Hs(`${e.backendUrl.replace(/\/$/, "")}/product-agent`, {
4678
+ this.options = e, this.socket = Ks(`${e.backendUrl.replace(/\/$/, "")}/product-agent`, {
4679
4679
  path: "/api/product-agent/socket.io",
4680
4680
  transports: ["websocket"],
4681
4681
  autoConnect: !1,
@@ -5089,7 +5089,7 @@ function Pp(t) {
5089
5089
  const g = d.engine.getState().slices, y = g.conversation.submissions[r.submission.userMessageId];
5090
5090
  (!$e(t) || !y || y.cancelled || y.requestId !== r.submission.requestId || g.directory.clients[y.clientScopeId] !== y.conversationScopeId) && l(Object.assign(new Error("Submission preparation was retired."), { code: "aborted", retryable: !1 }));
5091
5091
  }, f = d.engine.subscribe(h), m = d.onDispose(() => l(Object.assign(new Error("Submission runtime was disposed."), { code: "aborted" })));
5092
- return h(), Ns(a.signal, () => t.prepareSubmission(r, a.signal).then((g) => (a.signal.aborted && c.mark("context_discarded"), g), (g) => {
5092
+ return h(), Us(a.signal, () => t.prepareSubmission(r, a.signal).then((g) => (a.signal.aborted && c.mark("context_discarded"), g), (g) => {
5093
5093
  throw a.signal.aborted && c.mark("context_discarded"), g;
5094
5094
  })).then((g) => (h(), a.signal.throwIfAborted(), g)).catch((g) => (l(g), s(g, { operation: "conversation.prepare", requestId: r.submission.userMessageId }))).finally(() => {
5095
5095
  clearTimeout(u), f(), m();
@@ -5138,7 +5138,7 @@ function Pp(t) {
5138
5138
  "conversations",
5139
5139
  { timing: l }
5140
5140
  );
5141
- if (We(t, r), u.request_id !== r.command.request_id || !ds(u.result)) throw Object.assign(new Error("Conversation response identity mismatch."), { code: "acceptance_identity_mismatch" });
5141
+ if (We(t, r), u.request_id !== r.command.request_id || !us(u.result)) throw Object.assign(new Error("Conversation response identity mismatch."), { code: "acceptance_identity_mismatch" });
5142
5142
  if (r.command.type.startsWith("chat.")) {
5143
5143
  const d = u.result;
5144
5144
  if (typeof d?.sessionId != "string" || !d.sessionId || d.clientMessageId !== r.command.payload.clientMessageId || r.command.payload.sessionId && d.sessionId !== r.command.payload.sessionId) throw Object.assign(new Error("Conversation acceptance identity mismatch."), { code: "acceptance_identity_mismatch" });
@@ -5434,7 +5434,7 @@ function Ft(t, e, n) {
5434
5434
  return Z < J ? -1 : Z > J ? 1 : S.id < D.id ? -1 : S.id > D.id ? 1 : 0;
5435
5435
  }), c = r.filter((S) => (!S.cancelled || S.conversationScopeId === n && (S.sessionId === null || S.sessionId === i || i === null && S === r[r.length - 1])) && !o?.items[S.userMessageId] && !o?.removedItems[S.userMessageId]), l = {};
5436
5436
  for (const S of a) {
5437
- const D = Zs(S);
5437
+ const D = ei(S);
5438
5438
  if (D === null) continue;
5439
5439
  const Z = o?.streams[S.id];
5440
5440
  l[S.id] = Z ? Z.state === "open" ? "open" : D < Z.revision ? "awaiting_content" : Z.state : "open";
@@ -5657,7 +5657,7 @@ function $p(t, e, n, s) {
5657
5657
  return { ...o, role: "system", dataType: "run_status", content: t.data.message, loading: !1 };
5658
5658
  }
5659
5659
  }
5660
- function Yi(t, e, n, s) {
5660
+ function Qi(t, e, n, s) {
5661
5661
  const i = /* @__PURE__ */ new Map();
5662
5662
  for (const E of t.segments)
5663
5663
  for (const B of [...E.activityIds, ...E.outcomeIds]) i.set(B, E.userMessageId);
@@ -5719,7 +5719,7 @@ function Yi(t, e, n, s) {
5719
5719
  ...I ? { errorMessageFingerprint: hr(pn(I.message)) } : {},
5720
5720
  ...u && I && I === u.error && !f ? { failedClientMessageId: u.userMessageId } : {},
5721
5721
  ...typeof I?.details?.requestId == "string" ? { errorRequestId: I.details.requestId } : {},
5722
- ...li(I?.details?.errorNormalization) ? { errorNormalization: I.details.errorNormalization } : {},
5722
+ ...di(I?.details?.errorNormalization) ? { errorNormalization: I.details.errorNormalization } : {},
5723
5723
  ...s ? { owner: s } : {},
5724
5724
  ...Vt(I?.details?.httpRequest) ? { httpRequest: I.details.httpRequest } : {},
5725
5725
  queryStatus: e?.status ?? null,
@@ -5920,7 +5920,7 @@ class fl {
5920
5920
  throw new P(U === "embedded_submission_conflict" ? "This message conflicts with an earlier submission. Review the conversation before retrying." : "This earlier submission cannot be verified. Review the conversation before retrying.", U, !1, void 0, !0);
5921
5921
  if (o === "conversations" && e === "/commands" && (q.status === 409 && U?.code === "executor_not_ready" && U.retryable === !0 || q.status === 403 && U === "Register the executor before commands"))
5922
5922
  throw new P("Reconnecting the browser before continuing.", "executor_not_ready");
5923
- if (q.status !== 401 && U && typeof U == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(U.code) || !ls(void 0, U.code).allowed) && typeof U.message == "string")
5923
+ if (q.status !== 401 && U && typeof U == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(U.code) || !ds(void 0, U.code).allowed) && typeof U.message == "string")
5924
5924
  throw new P(U.message, U.code, !1, {
5925
5925
  ...typeof U.blockedOrigin == "string" ? { blockedOrigin: U.blockedOrigin } : {},
5926
5926
  ...typeof U.securitySettingsUrl == "string" ? { securitySettingsUrl: U.securitySettingsUrl } : {}
@@ -5973,15 +5973,15 @@ class fl {
5973
5973
  }
5974
5974
  }
5975
5975
  }
5976
- function us(t) {
5976
+ function ps(t) {
5977
5977
  if (t !== null && typeof t == "object" && !Object.isFrozen(t)) {
5978
- for (const e of Object.values(t)) us(e);
5978
+ for (const e of Object.values(t)) ps(e);
5979
5979
  Object.freeze(t);
5980
5980
  }
5981
5981
  return t;
5982
5982
  }
5983
5983
  function ml() {
5984
- return us({
5984
+ return ps({
5985
5985
  authorityId: null,
5986
5986
  generation: 0,
5987
5987
  entities: {},
@@ -6016,7 +6016,7 @@ function ts(t) {
6016
6016
  const e = t.error;
6017
6017
  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));
6018
6018
  }
6019
- const Qi = { activeIntervalMs: 3e3, idleIntervalMs: 15e3, maxFailureIntervalMs: 3e4 };
6019
+ const Xi = { activeIntervalMs: 3e3, idleIntervalMs: 15e3, maxFailureIntervalMs: 3e4 };
6020
6020
  function Ve(t) {
6021
6021
  const e = t.currentAuthority();
6022
6022
  return e.authorityId === t.authority.authorityId && e.generation === t.authority.generation;
@@ -6112,7 +6112,7 @@ class Qp {
6112
6112
  if (n) for (const [i, o] of Object.entries(e)) {
6113
6113
  if (!o.observe || this.observations.has(i)) continue;
6114
6114
  const r = this.options.recovery?.(i), a = new Zn({
6115
- ...Qi,
6115
+ ...Xi,
6116
6116
  isActiveTurn: () => this.options.isActiveTurn(i),
6117
6117
  poll: async () => {
6118
6118
  try {
@@ -6148,8 +6148,8 @@ class Qp {
6148
6148
  const r = this.queryRetries.get(o) ?? { timer: null };
6149
6149
  if (r.timer !== null) continue;
6150
6150
  const a = Math.min(
6151
- Qi.activeIntervalMs * 2 ** Math.min(i.consecutiveFailures - 1, 4),
6152
- Qi.maxFailureIntervalMs
6151
+ Xi.activeIntervalMs * 2 ** Math.min(i.consecutiveFailures - 1, 4),
6152
+ Xi.maxFailureIntervalMs
6153
6153
  );
6154
6154
  r.timer = setTimeout(() => {
6155
6155
  r.timer = null, !this.queryRequests.has(o) && this.refreshObservedQuery(i.query).catch((c) => this.report(c));
@@ -6773,7 +6773,7 @@ class Se extends EventTarget {
6773
6773
  }), i;
6774
6774
  }
6775
6775
  }
6776
- const Yo = /* @__PURE__ */ new WeakMap(), ln = (t) => t === null || typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t);
6776
+ const Qo = /* @__PURE__ */ new WeakMap(), ln = (t) => t === null || typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t);
6777
6777
  function nh(t) {
6778
6778
  if (!t || typeof t != "object") return !1;
6779
6779
  const e = t;
@@ -6781,7 +6781,7 @@ function nh(t) {
6781
6781
  }
6782
6782
  function sh(t, e, n) {
6783
6783
  if (!nh(n)) return;
6784
- const s = Yo.get(t) ?? /* @__PURE__ */ new Map();
6784
+ const s = Qo.get(t) ?? /* @__PURE__ */ new Map();
6785
6785
  s.set(e, {
6786
6786
  observedAt: n.observedAt,
6787
6787
  sessionId: n.sessionId,
@@ -6790,10 +6790,10 @@ function sh(t, e, n) {
6790
6790
  panelVisible: n.panelVisible,
6791
6791
  documentVisible: n.documentVisible,
6792
6792
  loading: n.loading
6793
- }), s.size > 2 && s.delete(s.keys().next().value), Yo.set(t, s);
6793
+ }), s.size > 2 && s.delete(s.keys().next().value), Qo.set(t, s);
6794
6794
  }
6795
6795
  function ih(t, e, n) {
6796
- const s = Yo.get(t)?.get(e);
6796
+ const s = Qo.get(t)?.get(e);
6797
6797
  return s?.sessionId === n ? s : null;
6798
6798
  }
6799
6799
  function oh(t, e, n, s, i, o, r, a, c = null, l = !1) {
@@ -6977,20 +6977,20 @@ function lh(t, e, n, s) {
6977
6977
  const i = t.clients[e];
6978
6978
  return i === void 0 || t.selections[i].sessionId === n ? !0 : !s || Object.values(s.pendingRestoration).includes(i) || Object.values(s.submissions).some((o) => o.conversationScopeId === i && !o.cancelled) ? !1 : t.selections[i].sessionId === null || Ft(s, t, i).isDraftSession;
6979
6979
  }
6980
- function Qo(t) {
6980
+ function Xo(t) {
6981
6981
  return {
6982
6982
  ...t,
6983
6983
  metadataRevision: t.metadataRevision + 1,
6984
6984
  queries: Object.fromEntries(Object.entries(t.queries).map(([e, n]) => [e, { ...n, invalidated: !0 }]))
6985
6985
  };
6986
6986
  }
6987
- function Xi(t, e, n) {
6987
+ function Zi(t, e, n) {
6988
6988
  if (e.conversation_id !== e.conversation.id || !Number.isSafeInteger(e.version) || e.version < 0)
6989
6989
  throw new Error("Invalid conversation metadata envelope identity or version.");
6990
6990
  const s = t.entities[e.conversation_id];
6991
6991
  if (s && s.version >= e.version) return t;
6992
6992
  const i = { ...e, conversation: { ...e.conversation } }, o = { ...t, entities: { ...t.entities, [e.conversation_id]: i } };
6993
- return n ? Qo(o) : o;
6993
+ return n ? Xo(o) : o;
6994
6994
  }
6995
6995
  function dn(t, e, n) {
6996
6996
  let s = t;
@@ -7011,11 +7011,11 @@ function dn(t, e, n) {
7011
7011
  const r = { ...t.requests };
7012
7012
  if (delete r[e.effectId], s = { ...t, requests: r }, o.kind === "directory.query") {
7013
7013
  const a = we(o.input.query), c = t.queries[a];
7014
- if (c.requestId !== o.input.requestId) return { state: us(s), effects: i };
7014
+ if (c.requestId !== o.input.requestId) return { state: ps(s), effects: i };
7015
7015
  if (e.type === "effect.failed")
7016
7016
  s = { ...s, queries: { ...s.queries, [a]: { ...c, status: "error", error: { ...e.error }, requestId: null, consecutiveFailures: c.consecutiveFailures + 1 } } };
7017
7017
  else if (e.effectKind === "directory.query") {
7018
- for (const g of e.output.entries) s = Xi(s, g, !0);
7018
+ for (const g of e.output.entries) s = Zi(s, g, !0);
7019
7019
  const l = e.output.entries.map((g) => g.conversation_id), u = { ...s.durableActivityBySessionId }, d = { ...s.activityBySessionId }, h = { ...s.activityRevisionBySessionId };
7020
7020
  for (const g of e.output.entries) {
7021
7021
  if (typeof g.is_active != "boolean") continue;
@@ -7043,7 +7043,7 @@ function dn(t, e, n) {
7043
7043
  } else {
7044
7044
  if (e.type === "effect.completed" && e.effectKind === "directory.mutate") {
7045
7045
  if (e.output.conversation_id !== o.input.sessionId) throw new Error("Mutation response has the wrong conversation identity.");
7046
- s = Xi(s, e.output, !0);
7046
+ s = Zi(s, e.output, !0);
7047
7047
  }
7048
7048
  const a = { ...s.mutations[o.input.sessionId] };
7049
7049
  for (const c of ["title", "pinned"]) {
@@ -7056,9 +7056,9 @@ function dn(t, e, n) {
7056
7056
  if (e.authorityId !== (t.authorityId ?? "") || e.generation !== t.generation)
7057
7057
  return { state: t, effects: i };
7058
7058
  if (e.type === "directory.metadata_received")
7059
- s = Xi(t, e.metadata, !0);
7059
+ s = Zi(t, e.metadata, !0);
7060
7060
  else if (e.type === "directory.invalidate")
7061
- s = Qo(t);
7061
+ s = Xo(t);
7062
7062
  else if (e.type === "directory.optimistic_upsert")
7063
7063
  s = { ...t, optimisticEntries: {
7064
7064
  ...t.optimisticEntries,
@@ -7106,7 +7106,7 @@ function dn(t, e, n) {
7106
7106
  query: u,
7107
7107
  cursor: e.cursor !== void 0 ? e.cursor : e.mode === "append" ? l?.cursor ?? null : null
7108
7108
  } }, s = { ...t, queries: { ...t.queries, [c]: {
7109
- ...Ys(l ?? hn(c), { key: c, requestId: e.requestId, mode: e.mode }),
7109
+ ...Qs(l ?? hn(c), { key: c, requestId: e.requestId, mode: e.mode }),
7110
7110
  query: u,
7111
7111
  requestSequence: t.requestSequence + 1,
7112
7112
  mode: e.mode,
@@ -7125,13 +7125,13 @@ function dn(t, e, n) {
7125
7125
  const d = c[u];
7126
7126
  d !== void 0 && (l[u] = { requestId: e.requestId, value: d, status: "pending", error: null });
7127
7127
  }
7128
- s = Qo({ ...t, mutations: { ...t.mutations, [e.sessionId]: l } });
7128
+ s = Xo({ ...t, mutations: { ...t.mutations, [e.sessionId]: l } });
7129
7129
  }
7130
7130
  s = { ...s, requestSequence: t.requestSequence + 1, requests: { ...s.requests, [o]: a } }, i.push({ id: o, ...a });
7131
7131
  } else
7132
7132
  s = ch(t, e, n);
7133
7133
  }
7134
- return { state: us(s), effects: i };
7134
+ return { state: ps(s), effects: i };
7135
7135
  }
7136
7136
  function dh(t) {
7137
7137
  const e = { ...t.entities };
@@ -7146,7 +7146,7 @@ function dh(t) {
7146
7146
  activityRevision: i,
7147
7147
  ...o
7148
7148
  } = t;
7149
- return us({
7149
+ return ps({
7150
7150
  ...o,
7151
7151
  entities: e,
7152
7152
  activityBySessionId: { ...n, ...t.activityBySessionId },
@@ -7437,9 +7437,9 @@ class bh {
7437
7437
  constructor(e = mh, n = {}, s) {
7438
7438
  this.conversationPorts = { ...yh, ...n }, this.featurePorts = s ?? {}, this.engine = new ph({
7439
7439
  initialState: Object.freeze({ revision: 0, slices: Object.freeze({
7440
- account: Be(Ao()),
7441
- features: Be(To()),
7442
- interactions: Be(Ro()),
7440
+ account: Be(Ro()),
7441
+ features: Be(Mo()),
7442
+ interactions: Be(To()),
7443
7443
  modelSelection: rh(),
7444
7444
  directory: ml(),
7445
7445
  conversation: Fc()
@@ -7453,7 +7453,7 @@ class bh {
7453
7453
  return { state: Object.freeze({ revision: i.revision + 1, slices: Object.freeze({ ...i.slices, ...l }) }), effects: c.effects };
7454
7454
  }
7455
7455
  if (gh(r)) {
7456
- const c = dn(i.slices.directory, r, i.slices.conversation), l = jo(Uo(i.slices.conversation, c.state, r.type === "directory.authority_replace" && r.adoptLocalSubmissions === !0)), u = zo(i.slices.conversation, l.state, c.state, c.state.clients !== i.slices.directory.clients), d = u.state, h = $a(i.slices.conversation, d, c.state);
7456
+ const c = dn(i.slices.directory, r, i.slices.conversation), l = Fo(zo(i.slices.conversation, c.state, r.type === "directory.authority_replace" && r.adoptLocalSubmissions === !0)), u = Bo(i.slices.conversation, l.state, c.state, c.state.clients !== i.slices.directory.clients), d = u.state, h = $a(i.slices.conversation, d, c.state);
7457
7457
  return { state: h === i.slices.directory && d === i.slices.conversation ? i : Object.freeze({
7458
7458
  revision: i.revision + 1,
7459
7459
  slices: Object.freeze({ ...i.slices, directory: h, conversation: d })
@@ -7487,7 +7487,7 @@ class bh {
7487
7487
  }).state);
7488
7488
  }
7489
7489
  l = $a(i.slices.conversation, c.state, l);
7490
- const d = jo(Uo(c.state, l)), h = zo(c.state, d.state, l);
7490
+ const d = Fo(zo(c.state, l)), h = Bo(c.state, d.state, l);
7491
7491
  let f = i.slices;
7492
7492
  const m = [], g = c.interactionSources, y = f.account.authority;
7493
7493
  if (g && y && y.authorityId === g.authorityId && y.generation === g.generation) {
@@ -7572,13 +7572,13 @@ class bh {
7572
7572
  }
7573
7573
  }
7574
7574
  }
7575
- const wh = "pluno-product-agent-attachments", _h = 1, Xo = "files", vh = 1440 * 60 * 1e3;
7575
+ const wh = "pluno-product-agent-attachments", _h = 1, Zo = "files", vh = 1440 * 60 * 1e3;
7576
7576
  async function Ih(t) {
7577
- const e = await hi();
7577
+ const e = await gi();
7578
7578
  await wl(e, "readwrite", (n) => n.put(t));
7579
7579
  }
7580
7580
  async function Ha(t) {
7581
- const e = await hi(), n = await wl(
7581
+ const e = await gi(), n = await wl(
7582
7582
  e,
7583
7583
  "readonly",
7584
7584
  (i) => i.get(t)
@@ -7589,7 +7589,7 @@ async function Ha(t) {
7589
7589
  return await bl(t, { lastUsedAt: s }), { ...n, lastUsedAt: s };
7590
7590
  }
7591
7591
  async function bl(t, e) {
7592
- const n = await hi();
7592
+ const n = await gi();
7593
7593
  await _r(n, "readwrite", async (s) => {
7594
7594
  const i = await vr(
7595
7595
  s.get(t)
@@ -7601,17 +7601,17 @@ async function bl(t, e) {
7601
7601
  });
7602
7602
  }
7603
7603
  async function Sh(t = vh) {
7604
- const e = await hi(), n = Date.now() - t;
7604
+ const e = await gi(), n = Date.now() - t;
7605
7605
  await _r(e, "readwrite", async (s) => {
7606
7606
  const i = s.index("lastUsedAt");
7607
7607
  (await vr(i.getAllKeys(IDBKeyRange.upperBound(n)))).forEach((r) => s.delete(r));
7608
7608
  });
7609
7609
  }
7610
- function hi() {
7610
+ function gi() {
7611
7611
  return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((t, e) => {
7612
7612
  const n = indexedDB.open(wh, _h);
7613
7613
  n.onupgradeneeded = () => {
7614
- const i = n.result.createObjectStore(Xo, { keyPath: "attachmentId" });
7614
+ const i = n.result.createObjectStore(Zo, { keyPath: "attachmentId" });
7615
7615
  i.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), i.createIndex("sessionId", "sessionId", { unique: !1 }), i.createIndex("origin", "origin", { unique: !1 });
7616
7616
  }, n.onsuccess = () => t(n.result), n.onerror = () => e(n.error ?? new Error("Failed to open Product Agent attachment storage"));
7617
7617
  });
@@ -7621,7 +7621,7 @@ async function wl(t, e, n) {
7621
7621
  }
7622
7622
  function _r(t, e, n) {
7623
7623
  return new Promise((s, i) => {
7624
- const o = t.transaction(Xo, e), r = o.objectStore(Xo);
7624
+ const o = t.transaction(Zo, e), r = o.objectStore(Zo);
7625
7625
  let a, c = !1;
7626
7626
  n(r).then((l) => {
7627
7627
  a = l;
@@ -7683,11 +7683,11 @@ const Ch = "save_runtime_captured_skill";
7683
7683
  function Ah(t) {
7684
7684
  return (t.type === "function_call" || t.type === "tool_call") && t.name === Ch;
7685
7685
  }
7686
- const Zi = "pluno.productAgent.transportId", Rh = "pluno.productAgent.transportIdentity", eo = "pluno.productAgent.transportIdentity.event", Th = 50, Mh = globalThis.setTimeout.bind(globalThis);
7686
+ const eo = "pluno.productAgent.transportId", Rh = "pluno.productAgent.transportIdentity", to = "pluno.productAgent.transportIdentity.event", Th = 50, Mh = globalThis.setTimeout.bind(globalThis);
7687
7687
  let Gn = null;
7688
- const Ks = /* @__PURE__ */ new Set(), to = /* @__PURE__ */ new Map();
7688
+ const Ws = /* @__PURE__ */ new Set(), no = /* @__PURE__ */ new Map();
7689
7689
  async function Ph(t = Il()) {
7690
- const e = t.randomUUID(), n = t.storage.getItem(Zi);
7690
+ const e = t.randomUUID(), n = t.storage.getItem(eo);
7691
7691
  let s = n ?? t.randomUUID(), i = !1, o = !1;
7692
7692
  const r = t.channel.subscribe((c) => {
7693
7693
  if (!(c.senderId === e || c.transportId !== s)) {
@@ -7705,7 +7705,7 @@ async function Ph(t = Il()) {
7705
7705
  }
7706
7706
  });
7707
7707
  if (!n)
7708
- t.storage.setItem(Zi, s), i = !0;
7708
+ t.storage.setItem(eo, s), i = !0;
7709
7709
  else if (t.skipStoredIdentityCollisionCheck)
7710
7710
  i = !0;
7711
7711
  else
@@ -7714,7 +7714,7 @@ async function Ph(t = Il()) {
7714
7714
  i = !0;
7715
7715
  break;
7716
7716
  }
7717
- s = t.randomUUID(), t.storage.setItem(Zi, s);
7717
+ s = t.randomUUID(), t.storage.setItem(eo, s);
7718
7718
  }
7719
7719
  let a = !1;
7720
7720
  return {
@@ -7730,24 +7730,24 @@ async function qh(t = !1) {
7730
7730
  skipStoredIdentityCollisionCheck: t
7731
7731
  }), Gn.then((i) => {
7732
7732
  const o = (r) => {
7733
- r.persisted || (i.release(), Gn = null, Ks.clear(), window.removeEventListener("pagehide", o));
7733
+ r.persisted || (i.release(), Gn = null, Ws.clear(), window.removeEventListener("pagehide", o));
7734
7734
  };
7735
7735
  window.addEventListener("pagehide", o);
7736
7736
  }));
7737
7737
  const e = await Gn, n = Oh();
7738
- Ks.add(n);
7738
+ Ws.add(n);
7739
7739
  let s = !1;
7740
7740
  return {
7741
7741
  // A stable per-tab base keeps reload routing intact, while slots isolate multiple live SDK instances in one tab.
7742
7742
  transportId: n === 0 ? e.transportId : `${e.transportId}.${n}`,
7743
7743
  release: () => {
7744
- s || (s = !0, Ks.delete(n));
7744
+ s || (s = !0, Ws.delete(n));
7745
7745
  }
7746
7746
  };
7747
7747
  }
7748
7748
  function Oh() {
7749
7749
  let t = 0;
7750
- for (; Ks.has(t); )
7750
+ for (; Ws.has(t); )
7751
7751
  t += 1;
7752
7752
  return t;
7753
7753
  }
@@ -7763,13 +7763,13 @@ function Dh() {
7763
7763
  return {
7764
7764
  getItem: (t) => {
7765
7765
  try {
7766
- return window.sessionStorage?.getItem(t) ?? to.get(t) ?? null;
7766
+ return window.sessionStorage?.getItem(t) ?? no.get(t) ?? null;
7767
7767
  } catch {
7768
- return to.get(t) ?? null;
7768
+ return no.get(t) ?? null;
7769
7769
  }
7770
7770
  },
7771
7771
  setItem: (t, e) => {
7772
- to.set(t, e);
7772
+ no.set(t, e);
7773
7773
  try {
7774
7774
  window.sessionStorage?.setItem(t, e);
7775
7775
  } catch {
@@ -7793,7 +7793,7 @@ function Lh() {
7793
7793
  }
7794
7794
  function Nh() {
7795
7795
  const t = /* @__PURE__ */ new Set(), e = (n) => {
7796
- if (n.key !== eo || !n.newValue)
7796
+ if (n.key !== to || !n.newValue)
7797
7797
  return;
7798
7798
  const s = JSON.parse(n.newValue);
7799
7799
  for (const i of t)
@@ -7802,9 +7802,9 @@ function Nh() {
7802
7802
  return window.addEventListener("storage", e), {
7803
7803
  postMessage: (n) => {
7804
7804
  window.localStorage.setItem(
7805
- eo,
7805
+ to,
7806
7806
  JSON.stringify({ ...n, eventId: crypto.randomUUID() })
7807
- ), window.localStorage.removeItem(eo);
7807
+ ), window.localStorage.removeItem(to);
7808
7808
  },
7809
7809
  subscribe: (n) => (t.add(n), () => t.delete(n)),
7810
7810
  close: () => {
@@ -7835,16 +7835,13 @@ const zh = [
7835
7835
  "anthropic/claude-sonnet-5",
7836
7836
  "deepseek/deepseek-chat-v3.1",
7837
7837
  "deepseek/deepseek-v4-flash",
7838
- "gpt-5.4-nano",
7839
- "gpt-5.4-mini",
7840
- "gpt-5.4",
7841
7838
  "gpt-5.6-luna",
7842
7839
  "gpt-5.6-terra",
7843
7840
  "gpt-5.6-sol",
7844
7841
  "gpt-6.1-sol",
7845
7842
  "gpt-6-sol",
7846
7843
  "gpt-6-luna"
7847
- ], Zo = (t) => typeof t == "string" && zh.includes(t), no = /* @__PURE__ */ new Map();
7844
+ ], is = (t) => typeof t == "string" && zh.includes(t), so = /* @__PURE__ */ new Map();
7848
7845
  function Bh(t, e, n) {
7849
7846
  const s = `pluno.productAgent.modelClientScope:${e}`, i = t.getItem(s);
7850
7847
  if (i) return i;
@@ -7854,24 +7851,24 @@ function Bh(t, e, n) {
7854
7851
  function jh(t, e) {
7855
7852
  try {
7856
7853
  const n = Bh(window.sessionStorage, t, e);
7857
- return no.set(t, n), n;
7854
+ return so.set(t, n), n;
7858
7855
  } catch (n) {
7859
7856
  if (!(n instanceof DOMException) || n.name !== "SecurityError" && n.name !== "QuotaExceededError") throw n;
7860
- const s = no.get(t) ?? e();
7861
- return no.set(t, s), s;
7857
+ const s = so.get(t) ?? e();
7858
+ return so.set(t, s), s;
7862
7859
  }
7863
7860
  }
7864
7861
  function Fh(t) {
7865
7862
  if (!t || typeof t != "object") return;
7866
7863
  const e = t, n = e.requestedModel ?? e.requested_model, s = e.effectiveModel ?? e.effective_model, i = e.provider;
7867
- if (!(!Zo(n) || !Zo(s) || i !== "openrouter" && i !== "azure" && i !== "openai"))
7864
+ if (!(!is(n) || !is(s) || i !== "openrouter" && i !== "azure" && i !== "openai"))
7868
7865
  return Object.freeze({ requestedModel: n, effectiveModel: s, provider: i });
7869
7866
  }
7870
7867
  const xl = (t, e) => cu(
7871
7868
  t.engine.getState().slices.modelSelection,
7872
7869
  e
7873
7870
  );
7874
- function so(t, e, n, s) {
7871
+ function io(t, e, n, s) {
7875
7872
  return t.engine.dispatch({
7876
7873
  type: "model.submission_capture",
7877
7874
  clientScopeId: e,
@@ -7890,7 +7887,7 @@ function $h(t, e, n, s, i, o) {
7890
7887
  updatedAt: o ? Date.parse(o) : void 0
7891
7888
  });
7892
7889
  }
7893
- function io(t, e, n, s) {
7890
+ function oo(t, e, n, s) {
7894
7891
  if (Array.isArray(s))
7895
7892
  for (const i of s) {
7896
7893
  if (!i || typeof i != "object") continue;
@@ -7968,7 +7965,7 @@ class Ge extends Error {
7968
7965
  retryAfterMs;
7969
7966
  }
7970
7967
  let Qh = 0;
7971
- function oo(t) {
7968
+ function ro(t) {
7972
7969
  const e = {};
7973
7970
  for (const c of [
7974
7971
  "type",
@@ -8045,14 +8042,14 @@ function wn(t, e, n) {
8045
8042
  };
8046
8043
  window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: i }));
8047
8044
  }
8048
- const Xh = "https://app.pluno.ai", Zh = 2e4, eg = 1e4, tg = 6e4, ng = 6e4, sg = 1e4, ig = 1e4, og = 1e3, er = 3e4, Wa = 0.2, ro = 6e4, ao = 3, Va = "Still connecting to Pluno. Retrying automatically.", rg = 1e3, ag = 100, Ga = 3, cg = [300, 1e3], kl = 50 * 1024 * 1024, lg = /* @__PURE__ */ new Set([
8045
+ const Xh = "https://app.pluno.ai", Zh = 2e4, eg = 1e4, tg = 6e4, ng = 6e4, sg = 1e4, ig = 1e4, og = 1e3, er = 3e4, Wa = 0.2, ao = 6e4, co = 3, Va = "Still connecting to Pluno. Retrying automatically.", rg = 1e3, ag = 100, Ga = 3, cg = [300, 1e3], kl = 50 * 1024 * 1024, lg = /* @__PURE__ */ new Set([
8049
8046
  ".jpeg:image/jpeg",
8050
8047
  ".jpg:image/jpeg",
8051
8048
  ".pdf:application/pdf",
8052
8049
  ".png:image/png",
8053
8050
  ".webp:image/webp"
8054
- ]), dg = ".pdf,.png,.jpg,.jpeg,.webp", Ir = 64e3, co = 4e3, Sr = 30, ug = 2e3, pg = 1e3, El = "Image is too large for model vision input.", hg = "pluno.productAgent.state.", tr = "pluno.productAgent.pendingEvents.", gi = "pluno.productAgent.activeToolCalls.", gg = 100, Ws = /* @__PURE__ */ new Set();
8055
- let Ms = null;
8051
+ ]), dg = ".pdf,.png,.jpg,.jpeg,.webp", Ir = 64e3, lo = 4e3, Sr = 30, ug = 2e3, pg = 1e3, El = "Image is too large for model vision input.", hg = "pluno.productAgent.state.", tr = "pluno.productAgent.pendingEvents.", fi = "pluno.productAgent.activeToolCalls.", gg = 100, Vs = /* @__PURE__ */ new Set();
8052
+ let Ps = null;
8056
8053
  function fg(t, e = Math.random) {
8057
8054
  const n = Math.min(er, og * 2 ** t), s = 1 - Wa + e() * Wa * 2;
8058
8055
  return Math.min(er, Math.round(n * s));
@@ -8068,7 +8065,7 @@ function mg(t) {
8068
8065
  return null;
8069
8066
  }
8070
8067
  }
8071
- function lo(t) {
8068
+ function uo(t) {
8072
8069
  if (t instanceof Ge)
8073
8070
  return t.retryable;
8074
8071
  if (t && typeof t == "object") {
@@ -8078,7 +8075,7 @@ function lo(t) {
8078
8075
  }
8079
8076
  return !0;
8080
8077
  }
8081
- function Ps(t) {
8078
+ function qs(t) {
8082
8079
  const e = Wt(t, "connection_failed", "web_transport");
8083
8080
  if (t instanceof Error && t.message === e.message) return t;
8084
8081
  if (t && typeof t == "object" && !("message" in t)) {
@@ -8088,13 +8085,13 @@ function Ps(t) {
8088
8085
  }
8089
8086
  return Object.assign(new Error(e.message), e);
8090
8087
  }
8091
- function uo(t) {
8088
+ function po(t) {
8092
8089
  return t === "main_web_chat" ? ["pinned", "recent"] : ["all"];
8093
8090
  }
8094
8091
  class xr {
8095
8092
  constructor(e, n) {
8096
8093
  this.options = e, this.transportIdentity = n, this.directoryAuthority = {
8097
- authorityId: Wi(`pa.authority:${e.clientId}`) ?? `${e.clientId}:${e.runtimeCommunityId ?? e.productVariant}`,
8094
+ authorityId: Vi(`pa.authority:${e.clientId}`) ?? `${e.clientId}:${e.runtimeCommunityId ?? e.productVariant}`,
8098
8095
  generation: 1
8099
8096
  }, this.directoryHttp = new fl({
8100
8097
  backendUrl: e.backendUrl,
@@ -8248,6 +8245,8 @@ class xr {
8248
8245
  n in e && Object.assign(this.platformState, { [n]: e[n] });
8249
8246
  }
8250
8247
  static async init(e) {
8248
+ if (e.model !== void 0 && !is(e.model))
8249
+ throw new Error(`Unsupported Product Agent model: ${e.model}`);
8251
8250
  if (e.productVariant === "personal") throw new P("Personal Product Agent has retired.", "personal_product_agent_retired", !1);
8252
8251
  const n = e, s = await qh(
8253
8252
  n.skipStoredTransportIdentityCollisionCheck === !0
@@ -8285,13 +8284,13 @@ class xr {
8285
8284
  isActiveTurn: (e) => this.clientRuntime.engine.getProjection().directory.activityBySessionId[e] === !0,
8286
8285
  nextRequestId: Oe,
8287
8286
  onError: (e) => {
8288
- this.handleDirectoryTransportError(e), this.emit("error", Ps(e));
8287
+ this.handleDirectoryTransportError(e), this.emit("error", qs(e));
8289
8288
  },
8290
8289
  wakeup: { start: () => {
8291
8290
  }, stop: () => {
8292
8291
  } },
8293
8292
  enabled: () => !!this.token && !this.authenticationFailure && !this.refreshingDefaultCredentials && this.state.status !== "closed",
8294
- observedQueries: () => uo(this.options.entrySurface).map((e) => this.getDirectoryQuery(e))
8293
+ observedQueries: () => po(this.options.entrySurface).map((e) => this.getDirectoryQuery(e))
8295
8294
  });
8296
8295
  }
8297
8296
  operationTimingReporter = () => {
@@ -8308,7 +8307,7 @@ class xr {
8308
8307
  });
8309
8308
  const i = `pa.conversation.delivery:${this.modelClientScopeId}:${n.authorityId}`, o = `${i}:cancellations`;
8310
8309
  this.authenticatedUserId && this.options.restorePersistedState === !1 && sessionStorage.removeItem(o);
8311
- const r = this.authenticatedUserId ? Wi(o) : null, a = bu({
8310
+ const r = this.authenticatedUserId ? Vi(o) : null, a = bu({
8312
8311
  authorityId: n.authorityId,
8313
8312
  isCurrent: s,
8314
8313
  read: async () => r ? JSON.parse(r) : null,
@@ -8331,7 +8330,7 @@ class xr {
8331
8330
  requestId: g.requestId,
8332
8331
  clientMessageId: g.userMessageId,
8333
8332
  sessionId: g.sessionId
8334
- }), v = (k, T) => _.measure(k, () => Ns(b, T));
8333
+ }), v = (k, T) => _.measure(k, () => Us(b, T));
8335
8334
  let I = g.contextPreparation ?? { pageContent: "", sessionTabs: [] };
8336
8335
  if (g.contextPreparation === null) {
8337
8336
  await v("first_frame", () => new Promise((T) => {
@@ -8352,9 +8351,9 @@ class xr {
8352
8351
  }
8353
8352
  if (await v("authentication", () => this.waitForAuthentication()), !s() || n !== this.directoryAuthority || this.clientRuntime.isDisposed) throw new Error("Submission authority was retired.");
8354
8353
  for (const k of y)
8355
- if (!k.uploaded && (await Ns(b, () => (this.attachmentPersistence.get(k.sourceId) ?? Promise.resolve()).catch(() => {
8354
+ if (!k.uploaded && (await Us(b, () => (this.attachmentPersistence.get(k.sourceId) ?? Promise.resolve()).catch(() => {
8356
8355
  throw Object.assign(new Error("Attachment files could not be stored. Attach the files again and send a new message."), { code: "attachment_source_unavailable", retryable: !1 });
8357
- })), !await Ns(b, () => Ha(k.sourceId))))
8356
+ })), !await Us(b, () => Ha(k.sourceId))))
8358
8357
  throw Object.assign(new Error("Attachment files are unavailable. Attach the files again and send a new message."), { code: "attachment_source_unavailable", retryable: !1 });
8359
8358
  return b.throwIfAborted(), _.mark("context_ready"), { ...I, now: Date.now() };
8360
8359
  },
@@ -8386,7 +8385,7 @@ class xr {
8386
8385
  onTiming: (g) => {
8387
8386
  s() && this.reportOperationTiming(g);
8388
8387
  },
8389
- onCommand: (g) => wn("client_event", g.type, oo({ ...g.payload, type: g.type })),
8388
+ onCommand: (g) => wn("client_event", g.type, ro({ ...g.payload, type: g.type })),
8390
8389
  onError: (g, y) => {
8391
8390
  if (this.options.productVariant === "customer_embedded" && y.operation === "conversation.snapshot" && g instanceof P && g.code === "conversation_access_denied") {
8392
8391
  y.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
@@ -8396,7 +8395,7 @@ class xr {
8396
8395
  }
8397
8396
  })
8398
8397
  });
8399
- const c = this.clientRuntime.engine.getState().slices.conversation, l = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null : Wi(i);
8398
+ const c = this.clientRuntime.engine.getState().slices.conversation, l = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null : Vi(i);
8400
8399
  if (this.authenticatedUserId && !c.submissionOrder.length && !Object.keys(c.operations).length) {
8401
8400
  const g = this.queuedClientEvents.filter((_) => _.type === "chat.user_message"), y = l ? JSON.parse(l) : g.length ? Ou(c, g.map((_) => {
8402
8401
  const { type: v, ...I } = _, k = this.clientRuntime.engine.getState().slices.directory, T = k.clients[this.modelClientScopeId];
@@ -8468,7 +8467,7 @@ class xr {
8468
8467
  I && (I.sessionId = v.sessionId), this.emit("ack", { clientMessageId: v.userMessageId, sessionId: v.sessionId });
8469
8468
  const k = v.sessionId;
8470
8469
  k && this.getState().sessionId === k && this.directoryHttp.request(`/sessions/${encodeURIComponent(k)}/history`, { limit: 200 }).then((T) => {
8471
- s() && this.getState().sessionId === k && this.state.status !== "closed" && io(this.clientRuntime, this.modelClientScopeId, k, T.turns);
8470
+ s() && this.getState().sessionId === k && this.state.status !== "closed" && oo(this.clientRuntime, this.modelClientScopeId, k, T.turns);
8472
8471
  }).catch((T) => {
8473
8472
  s() && this.getState().sessionId === k && this.handleDirectoryTransportError(T);
8474
8473
  });
@@ -8478,7 +8477,7 @@ class xr {
8478
8477
  for (const [v, I] of Object.entries(g.directory.clients)) {
8479
8478
  if (!v.startsWith(`background:${this.modelClientScopeId}:`)) continue;
8480
8479
  const k = Ft(g.conversation, g.directory, I), T = k.sessionId ? g.conversation.sessions[k.sessionId] : void 0;
8481
- if (this.firstResponseTimersByClientMessageId.size && (u(Yi(k, T?.queries.current, this.options.backendUrl).messages, k.sessionId), ["failed", "stopped"].includes(k.activity.phase)))
8480
+ if (this.firstResponseTimersByClientMessageId.size && (u(Qi(k, T?.queries.current, this.options.backendUrl).messages, k.sessionId), ["failed", "stopped"].includes(k.activity.phase)))
8482
8481
  for (const G of gt(T?.execution)) this.clearFirstResponseTimer(G);
8483
8482
  const O = k.activity.phase === "completed" && gt(T?.execution).some((G) => this.firstResponseTimersByClientMessageId.has(G));
8484
8483
  (b && k.sessionId === this.getState().sessionId || !O && ["completed", "failed", "stopped"].includes(k.activity.phase)) && this.directoryScope.detach(v);
@@ -8511,7 +8510,7 @@ class xr {
8511
8510
  }
8512
8511
  }
8513
8512
  handleDirectoryTransportError(e) {
8514
- if (!(e instanceof P) || this.authenticationFailure || !["unauthorized", "update_required", "service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(e.code) && ls(void 0, e.code).allowed) return;
8513
+ if (!(e instanceof P) || this.authenticationFailure || !["unauthorized", "update_required", "service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(e.code) && ds(void 0, e.code).allowed) return;
8515
8514
  const n = e.detail && typeof e.detail == "object" ? e.detail : {};
8516
8515
  this.handleServerEvent({
8517
8516
  ...n,
@@ -8544,12 +8543,12 @@ class xr {
8544
8543
  return s.add(n), this.listeners[e] = s, () => s.delete(n);
8545
8544
  }
8546
8545
  getState() {
8547
- const e = this.clientRuntime.engine.getState().slices, n = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, s = Ft(e.conversation, e.directory, n), i = Yi(
8546
+ const e = this.clientRuntime.engine.getState().slices, n = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, s = Ft(e.conversation, e.directory, n), i = Qi(
8548
8547
  s,
8549
8548
  s.sessionId ? e.conversation.sessions[s.sessionId]?.queries.current : void 0,
8550
8549
  this.options.backendUrl,
8551
8550
  this.clientRuntime.engine.getDiagnostics({ clientScopeId: this.modelClientScopeId, scopeId: n, sessionId: s.sessionId })
8552
- ), o = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, r = { kind: "starterPrompts", ...o, includeUserSuggestions: !1 }, a = Xs(e, r), c = Xs(e, { kind: "appearance", ...o }), l = c?.data?.kind === "appearance" ? c.data.value : null;
8551
+ ), o = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, r = { kind: "starterPrompts", ...o, includeUserSuggestions: !1 }, a = Zs(e, r), c = Zs(e, { kind: "appearance", ...o }), l = c?.data?.kind === "appearance" ? c.data.value : null;
8553
8552
  return {
8554
8553
  ...this.platformState,
8555
8554
  ...i,
@@ -8737,8 +8736,8 @@ class xr {
8737
8736
  this.handleDirectoryTransportError(o);
8738
8737
  return;
8739
8738
  }
8740
- const r = Ps(o);
8741
- if (lo(o)) {
8739
+ const r = qs(o);
8740
+ if (uo(o)) {
8742
8741
  ze("web-sdk.agent", "Pluno connection attempt failed; retrying", {
8743
8742
  message: r.message,
8744
8743
  reconnectAttempt: this.reconnectAttempts
@@ -8805,14 +8804,14 @@ class xr {
8805
8804
  sessionId: this.getState().sessionId
8806
8805
  });
8807
8806
  r.mark("submit");
8808
- const a = so(
8807
+ const a = io(
8809
8808
  this.clientRuntime,
8810
8809
  this.modelClientScopeId,
8811
8810
  o,
8812
8811
  n.requestedModel ?? this.getModel()
8813
8812
  ), c = this.submissionIntentRevision, l = this.authenticatedUserId;
8814
8813
  if (n.initiatedBy || this.startFirstResponseTimer(o, n.submittedAt), l || await r.measure("authentication", () => this.waitForAuthentication()), this.clientRuntime.isDisposed || c !== this.submissionIntentRevision || l && l !== this.authenticatedUserId) return null;
8815
- so(this.clientRuntime, this.modelClientScopeId, o, a ?? null);
8814
+ io(this.clientRuntime, this.modelClientScopeId, o, a ?? null);
8816
8815
  const u = this.clientRuntime.engine.getState().slices.conversation.submissions[o];
8817
8816
  if (u && (u.content !== s || JSON.stringify(u.attachments.map((y) => y.sourceId)) !== JSON.stringify(i.map((y) => y.id ?? y.storageKey ?? y.sandboxPath)))) throw new Error("User-message identity cannot be reused with different input.");
8818
8817
  const d = yt(), h = !u && !n.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== d.url, m = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
@@ -8898,6 +8897,7 @@ class xr {
8898
8897
  return this.draftModel;
8899
8898
  }
8900
8899
  setModel(e) {
8900
+ if (!is(e)) throw new Error(`Unsupported Product Agent model: ${e}`);
8901
8901
  const n = e;
8902
8902
  this.draftModelExplicit = !0, this.draftModel !== n && (this.draftModel = n, this.emit("state", this.getState()));
8903
8903
  }
@@ -8906,7 +8906,7 @@ class xr {
8906
8906
  if (!o) return !1;
8907
8907
  if (o.type === "preparation") {
8908
8908
  const r = Oe(), a = Hp(o.submission);
8909
- return so(this.clientRuntime, this.modelClientScopeId, r, o.submission.requestedModel), this.sendMessage(a.content, { clientMessageId: r, attachments: a.attachments, proactiveSuggestionQuestion: a.proactiveSuggestionQuestion }).catch((c) => this.emit("error", Ps(c))), !0;
8909
+ return io(this.clientRuntime, this.modelClientScopeId, r, o.submission.requestedModel), this.sendMessage(a.content, { clientMessageId: r, attachments: a.attachments, proactiveSuggestionQuestion: a.proactiveSuggestionQuestion }).catch((c) => this.emit("error", qs(c))), !0;
8910
8910
  }
8911
8911
  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: {
8912
8912
  request_id: Oe(),
@@ -9061,7 +9061,7 @@ class xr {
9061
9061
  }
9062
9062
  getSessionHistoryState() {
9063
9063
  return this.clientRuntime.project("directory", { core: () => {
9064
- const e = this.clientRuntime.engine.getProjection().directory, n = e.queries[we(this.getDirectoryQuery())], s = uo(this.options.entrySurface).map((u) => this.getDirectoryQuery(u)).map((u) => e.queries[we(u)]).filter((u) => u !== void 0), i = Object.values(e.optimisticEntries).reverse(), o = Jp(s), r = new Set(i.flatMap((u) => u.sessionId ? [u.sessionId] : [])), a = [...i.map((u) => u.id), ...o.filter((u) => !r.has(u))], c = Object.fromEntries([
9064
+ const e = this.clientRuntime.engine.getProjection().directory, n = e.queries[we(this.getDirectoryQuery())], s = po(this.options.entrySurface).map((u) => this.getDirectoryQuery(u)).map((u) => e.queries[we(u)]).filter((u) => u !== void 0), i = Object.values(e.optimisticEntries).reverse(), o = Jp(s), r = new Set(i.flatMap((u) => u.sessionId ? [u.sessionId] : [])), a = [...i.map((u) => u.id), ...o.filter((u) => !r.has(u))], c = Object.fromEntries([
9065
9065
  ...i.map((u) => [u.id, {
9066
9066
  id: u.id,
9067
9067
  title: null,
@@ -9091,7 +9091,7 @@ class xr {
9091
9091
  }
9092
9092
  refreshSessionHistory() {
9093
9093
  return this.clientRuntime.route("directory", { core: async () => {
9094
- await Promise.all(uo(this.options.entrySurface).map((e) => this.getDirectoryQuery(e)).map((e) => this.refreshDirectoryQuery(e, e.kind === "pinned")));
9094
+ await Promise.all(po(this.options.entrySurface).map((e) => this.getDirectoryQuery(e)).map((e) => this.refreshDirectoryQuery(e, e.kind === "pinned")));
9095
9095
  } });
9096
9096
  }
9097
9097
  loadMoreSessionHistory() {
@@ -9245,7 +9245,7 @@ class xr {
9245
9245
  })), !0;
9246
9246
  }
9247
9247
  try {
9248
- return n.send(JSON.stringify(e)), wn("client_event", e.type, oo(e)), !0;
9248
+ return n.send(JSON.stringify(e)), wn("client_event", e.type, ro(e)), !0;
9249
9249
  } catch (s) {
9250
9250
  return ze("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
9251
9251
  message: s instanceof Error ? s.message : String(s),
@@ -9258,7 +9258,7 @@ class xr {
9258
9258
  let s = this.getState();
9259
9259
  if (e === "first_response_slow" && n.sessionId && n.sessionId !== s.sessionId) {
9260
9260
  const { conversation: m, directory: g } = this.clientRuntime.engine.getState().slices, y = Object.values(g.clients).find((b) => g.selections[b]?.sessionId === n.sessionId);
9261
- y && (s = { ...s, ...Yi(
9261
+ y && (s = { ...s, ...Qi(
9262
9262
  Ft(m, g, y),
9263
9263
  m.sessions[n.sessionId]?.queries.current,
9264
9264
  this.options.backendUrl
@@ -9324,7 +9324,7 @@ class xr {
9324
9324
  missedResponseChecks: s,
9325
9325
  timer: window.setTimeout(() => this.recordFirstResponseMiss(e), Math.max(
9326
9326
  0,
9327
- i + (s + 1) * ro - Date.now()
9327
+ i + (s + 1) * ao - Date.now()
9328
9328
  ))
9329
9329
  });
9330
9330
  }
@@ -9334,13 +9334,13 @@ class xr {
9334
9334
  return;
9335
9335
  const s = Date.now() - n.submittedAt;
9336
9336
  if (n.missedResponseChecks = Math.min(
9337
- ao,
9338
- Math.max(n.missedResponseChecks + 1, Math.floor(s / ro))
9339
- ), n.missedResponseChecks >= ao) {
9337
+ co,
9338
+ Math.max(n.missedResponseChecks + 1, Math.floor(s / ao))
9339
+ ), n.missedResponseChecks >= co) {
9340
9340
  this.reportFirstResponseSlow(e);
9341
9341
  return;
9342
9342
  }
9343
- const i = n.submittedAt + (n.missedResponseChecks + 1) * ro;
9343
+ const i = n.submittedAt + (n.missedResponseChecks + 1) * ao;
9344
9344
  n.timer = window.setTimeout(
9345
9345
  () => this.recordFirstResponseMiss(e),
9346
9346
  Math.max(0, i - Date.now())
@@ -9348,7 +9348,7 @@ class xr {
9348
9348
  }
9349
9349
  reportFirstResponseSlow(e) {
9350
9350
  const n = this.firstResponseTimersByClientMessageId.get(e);
9351
- n && (n.missedResponseChecks = ao, window.clearTimeout(n.timer), this.reportHealthSignal("first_response_slow", {
9351
+ n && (n.missedResponseChecks = co, window.clearTimeout(n.timer), this.reportHealthSignal("first_response_slow", {
9352
9352
  ...n.sessionId ? { sessionId: n.sessionId } : {},
9353
9353
  clientMessageId: e,
9354
9354
  durationMs: Date.now() - n.submittedAt,
@@ -9521,7 +9521,7 @@ class xr {
9521
9521
  applyAuthenticatedDirectoryIdentity(e) {
9522
9522
  const n = Za(e);
9523
9523
  if (!n) return !1;
9524
- const s = go(e, "runtimeCommunityId") ?? this.directoryHttp.auth.community_id, i = `${this.options.clientId}:${n.id}:${s ?? this.options.productVariant}`, o = this.directoryAuthority.authorityId !== i, r = this.authenticatedUserId === null, a = r ? Object.values(this.clientRuntime.engine.getState().slices.conversation.operations).filter((u) => ["waiting", "running", "uncertain"].includes(u.phase) && (u.command.type === "run.stop" || u.command.type === "session.reset")).map((u) => u.command) : [], c = r && this.directoryAuthority.authorityId === `${this.options.clientId}:${this.options.runtimeCommunityId ?? this.options.productVariant}` ? this.state.sessionId : null;
9524
+ const s = fo(e, "runtimeCommunityId") ?? this.directoryHttp.auth.community_id, i = `${this.options.clientId}:${n.id}:${s ?? this.options.productVariant}`, o = this.directoryAuthority.authorityId !== i, r = this.authenticatedUserId === null, a = r ? Object.values(this.clientRuntime.engine.getState().slices.conversation.operations).filter((u) => ["waiting", "running", "uncertain"].includes(u.phase) && (u.command.type === "run.stop" || u.command.type === "session.reset")).map((u) => u.command) : [], c = r && this.directoryAuthority.authorityId === `${this.options.clientId}:${this.options.runtimeCommunityId ?? this.options.productVariant}` ? this.state.sessionId : null;
9525
9525
  if (this.authenticatedUserId = n.id, this.directoryHttp.auth.community_id = s, Du(this.options.clientId, i), o) {
9526
9526
  const u = this.directoryAuthority;
9527
9527
  this.directoryObservation.dispose(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.directoryAuthority = { authorityId: i, generation: u.generation + 1 }, this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "directory.authority_replace", expectedGeneration: u.generation }), this.createDirectoryAdapters();
@@ -9589,7 +9589,7 @@ class xr {
9589
9589
  }
9590
9590
  }
9591
9591
  handleServerEvent(e) {
9592
- if (wn("server_event", e.type, oo(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
9592
+ if (wn("server_event", e.type, ro(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
9593
9593
  this.conversationObservation?.receive(e);
9594
9594
  return;
9595
9595
  }
@@ -9625,11 +9625,11 @@ class xr {
9625
9625
  return;
9626
9626
  }
9627
9627
  if (e.type === "conversation.routing") {
9628
- e.sessionId === this.state.sessionId && io(this.clientRuntime, this.modelClientScopeId, String(e.sessionId), e.turns);
9628
+ e.sessionId === this.state.sessionId && oo(this.clientRuntime, this.modelClientScopeId, String(e.sessionId), e.turns);
9629
9629
  return;
9630
9630
  }
9631
9631
  if (e.type === "session.updated" || e.type === "conversation.state") {
9632
- go(e.session, "id") === this.state.sessionId && (this.updateHistoricalModelFromSession(e.session), io(this.clientRuntime, this.modelClientScopeId, this.state.sessionId, e.turns));
9632
+ fo(e.session, "id") === this.state.sessionId && (this.updateHistoricalModelFromSession(e.session), oo(this.clientRuntime, this.modelClientScopeId, this.state.sessionId, e.turns));
9633
9633
  return;
9634
9634
  }
9635
9635
  if (e.type === "tool.call")
@@ -9639,7 +9639,7 @@ class xr {
9639
9639
  this.setState({ status: "reconnecting", lastError: String(e.message), lastErrorCode: e.code });
9640
9640
  return;
9641
9641
  }
9642
- if (e.code === "service_origin_not_allowed" || e.code === "security_control_enforcement_unavailable" || !ls(void 0, String(e.code)).allowed) {
9642
+ if (e.code === "service_origin_not_allowed" || e.code === "security_control_enforcement_unavailable" || !ds(void 0, String(e.code)).allowed) {
9643
9643
  this.applyAccountSubmissionError(String(e.code)), this.setState({
9644
9644
  status: "error",
9645
9645
  lastError: String(e.message),
@@ -9679,14 +9679,14 @@ class xr {
9679
9679
  }
9680
9680
  updateHistoricalModelFromSession(e) {
9681
9681
  if (!e || typeof e != "object") return;
9682
- const n = go(e, "id");
9682
+ const n = fo(e, "id");
9683
9683
  if (!n) return;
9684
9684
  const s = e.metadata, o = s && typeof s == "object" ? s.model : void 0;
9685
9685
  this.clientRuntime.engine.accept({
9686
9686
  type: "model.history_received",
9687
9687
  clientScopeId: this.modelClientScopeId,
9688
9688
  sessionId: n,
9689
- model: Zo(o) ? o : void 0
9689
+ model: is(o) ? o : void 0
9690
9690
  });
9691
9691
  }
9692
9692
  async executeToolCall(e) {
@@ -9827,7 +9827,7 @@ class xr {
9827
9827
  this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null, this.embeddedRecoveryTokenExpired = !1;
9828
9828
  }
9829
9829
  connectionFailureDiagnostic(e, n) {
9830
- const s = e instanceof Ge ? e.status : e instanceof P && e.code === "unauthorized" ? 401 : e instanceof P && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, i = s !== void 0 && Number.isInteger(s) && s >= 400 && s <= 599 ? s : void 0, r = !(e instanceof P && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && lo(e) && i !== 401 && i !== 403;
9830
+ const s = e instanceof Ge ? e.status : e instanceof P && e.code === "unauthorized" ? 401 : e instanceof P && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, i = s !== void 0 && Number.isInteger(s) && s >= 400 && s <= 599 ? s : void 0, r = !(e instanceof P && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && uo(e) && i !== 401 && i !== 403;
9831
9831
  return {
9832
9832
  stage: n,
9833
9833
  ...i !== void 0 ? { httpStatus: i } : {},
@@ -9930,7 +9930,7 @@ class xr {
9930
9930
  this.directoryHttp.auth.token = r, i = "bootstrap", this.lastRecoveryStage = i, await this.replaceDefaultTransportCredentials(e), this.reportTransportDiagnostic("auth_refresh_validated", s);
9931
9931
  })().catch((r) => {
9932
9932
  if (this.socket !== e || this.state.status === "closed") throw r;
9933
- if (this.reportTransportDiagnostic("auth_refresh_failed", { ...s, ...this.connectionFailureDiagnostic(r, i) }), this.credentialRecoveryFailure = Ps(r), r instanceof P && ["unauthorized", "403", "update_required"].includes(r.code) || !lo(r)) {
9933
+ if (this.reportTransportDiagnostic("auth_refresh_failed", { ...s, ...this.connectionFailureDiagnostic(r, i) }), this.credentialRecoveryFailure = qs(r), r instanceof P && ["unauthorized", "403", "update_required"].includes(r.code) || !uo(r)) {
9934
9934
  const a = r instanceof P ? r : new P(r instanceof Ge ? r.message : "Your session could not be refreshed. Try again.", this.options.productVariant === "customer_embedded" ? "connection_failed" : "unauthorized", !1);
9935
9935
  throw this.stopAuthentication(a), a;
9936
9936
  }
@@ -9988,7 +9988,7 @@ class xr {
9988
9988
  this.listeners[e]?.forEach((i) => i(n));
9989
9989
  }
9990
9990
  }
9991
- const po = /* @__PURE__ */ new WeakMap();
9991
+ const ho = /* @__PURE__ */ new WeakMap();
9992
9992
  function yg(t) {
9993
9993
  const e = window.__plunoProductAgentNetworkCapture ?? bg();
9994
9994
  return e.subscribers.add(t), () => {
@@ -10015,8 +10015,8 @@ function bg() {
10015
10015
  const b = f instanceof Request ? f : null, _ = bf(f, b), v = Ll(m?.headers ?? b?.headers);
10016
10016
  if (!_n(_, v, m?.body)) {
10017
10017
  const k = {
10018
- requestId: fo("fetch"),
10019
- url: Tt(_, co),
10018
+ requestId: mo("fetch"),
10019
+ url: Tt(_, lo),
10020
10020
  method: (m?.method ?? b?.method ?? "GET").toUpperCase(),
10021
10021
  requestHeaders: v,
10022
10022
  requestBody: sc(m?.body),
@@ -10047,21 +10047,21 @@ function bg() {
10047
10047
  return y;
10048
10048
  }, a = function(f, m, g, y, b) {
10049
10049
  const _ = s.call(this, f, m, g ?? !0, y ?? void 0, b ?? void 0), v = typeof m == "string" ? m : m.toString();
10050
- return po.set(this, {
10051
- requestId: fo("xhr"),
10050
+ return ho.set(this, {
10051
+ requestId: mo("xhr"),
10052
10052
  method: String(f ?? "GET").toUpperCase(),
10053
- url: Tt(v, co),
10053
+ url: Tt(v, lo),
10054
10054
  requestHeaders: {},
10055
10055
  startedAtMs: Date.now(),
10056
10056
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
10057
10057
  excluded: _n(v)
10058
10058
  }), _;
10059
10059
  }, c = function(f, m) {
10060
- const g = i.call(this, f, m), y = po.get(this);
10060
+ const g = i.call(this, f, m), y = ho.get(this);
10061
10061
  return y && Object.keys(y.requestHeaders).length < Sr && (y.requestHeaders[f] = Cr(f, m), y.excluded = y.excluded || _n(y.url, y.requestHeaders)), g;
10062
10062
  }, l = function(f) {
10063
10063
  try {
10064
- const m = po.get(this);
10064
+ const m = ho.get(this);
10065
10065
  m && (m.excluded = m.excluded || _n(m.url, m.requestHeaders, f), m.requestBody = sc(f), m.excluded || this.addEventListener(
10066
10066
  "loadend",
10067
10067
  () => {
@@ -10118,8 +10118,8 @@ function bg() {
10118
10118
  continue;
10119
10119
  const g = performance.timeOrigin + m.startTime;
10120
10120
  e({
10121
- requestId: fo("resource"),
10122
- url: Tt(m.name, co),
10121
+ requestId: mo("resource"),
10122
+ url: Tt(m.name, lo),
10123
10123
  method: "GET",
10124
10124
  resourceType: "resource",
10125
10125
  responseStatus: m.responseStatus,
@@ -10358,13 +10358,13 @@ function Lg() {
10358
10358
  };
10359
10359
  }
10360
10360
  function Ng(t) {
10361
- return Ws.add(t), Ms || (Ms = Ug()), () => {
10362
- Ws.delete(t), Ws.size === 0 && (Ms?.(), Ms = null);
10361
+ return Vs.add(t), Ps || (Ps = Ug()), () => {
10362
+ Vs.delete(t), Vs.size === 0 && (Ps?.(), Ps = null);
10363
10363
  };
10364
10364
  }
10365
10365
  function Ug() {
10366
10366
  const t = () => {
10367
- for (const o of Array.from(Ws))
10367
+ for (const o of Array.from(Vs))
10368
10368
  o();
10369
10369
  }, e = window.history.pushState.bind(window.history), n = window.history.replaceState.bind(window.history), s = ((...o) => {
10370
10370
  const r = e(...o);
@@ -10389,9 +10389,9 @@ function kr() {
10389
10389
  (g) => Cl(g) && !g.parentElement?.closest(s)
10390
10390
  );
10391
10391
  for (const g of i.slice(0, 3))
10392
- n("Active overlay", ho(is(g), e));
10393
- const o = zg(), r = o ? ho(is(o), e) : "";
10394
- n("Main page content", r), n("Additional visible page text", ho(is(document.body), e));
10392
+ n("Active overlay", go(os(g), e));
10393
+ const o = zg(), r = o ? go(os(o), e) : "";
10394
+ n("Main page content", r), n("Additional visible page text", go(os(document.body), e));
10395
10395
  const a = t.map(([g, y]) => `${g}:
10396
10396
  ${y}`).join(`
10397
10397
 
@@ -10402,7 +10402,7 @@ Visible page text:
10402
10402
  `, d = 12e3 - l.length - u.length, h = Math.min(a.length, 7900), f = c.slice(0, d - h), m = a.slice(0, d - f.length);
10403
10403
  return `${l}${f}${u}${m}`;
10404
10404
  }
10405
- function is(t) {
10405
+ function os(t) {
10406
10406
  return t.innerText ?? t.textContent ?? "";
10407
10407
  }
10408
10408
  function kn(t) {
@@ -10413,7 +10413,7 @@ function kn(t) {
10413
10413
 
10414
10414
  `).trim();
10415
10415
  }
10416
- function ho(t, e) {
10416
+ function go(t, e) {
10417
10417
  let n = kn(t);
10418
10418
  for (const s of e)
10419
10419
  n = n.replace(s, "");
@@ -10424,7 +10424,7 @@ function Cl(t) {
10424
10424
  return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
10425
10425
  }
10426
10426
  function zg() {
10427
- return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Cl).sort((t, e) => is(e).length - is(t).length)[0] ?? null;
10427
+ return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Cl).sort((t, e) => os(e).length - os(t).length)[0] ?? null;
10428
10428
  }
10429
10429
  function Bg(t, e) {
10430
10430
  const n = /* @__PURE__ */ new Set([
@@ -10553,7 +10553,7 @@ function Bg(t, e) {
10553
10553
  oe.push(Al(O, c, r, z.slice(0, 180)));
10554
10554
  }
10555
10555
  for (const C of xe)
10556
- oe.push(...qs(C, H));
10556
+ oe.push(...Os(C, H));
10557
10557
  const x = _e.flatMap((C) => C.lines);
10558
10558
  if (x.length > 0) {
10559
10559
  const C = x.slice(0, 20);
@@ -10561,9 +10561,9 @@ function Bg(t, e) {
10561
10561
  const z = E.includes("tooltip") || E.includes("popper") || E.includes("loader");
10562
10562
  if (G < 2 && !z) {
10563
10563
  const Y = Me ? "#shadow-root" : `${E} #shadow-root`;
10564
- oe.push(...qs([Y, ...qs(C, 1)], H));
10564
+ oe.push(...Os([Y, ...Os(C, 1)], H));
10565
10565
  } else
10566
- oe.push(...qs(C, H));
10566
+ oe.push(...Os(C, H));
10567
10567
  }
10568
10568
  return {
10569
10569
  lines: oe,
@@ -10672,7 +10672,7 @@ function Fg(t, e, n, s) {
10672
10672
  function Qa(t) {
10673
10673
  return t instanceof HTMLElement ? t : t?.parentElement instanceof HTMLElement ? t.parentElement : null;
10674
10674
  }
10675
- function qs(t, e) {
10675
+ function Os(t, e) {
10676
10676
  if (e === 0)
10677
10677
  return t;
10678
10678
  const n = " ".repeat(e);
@@ -11032,7 +11032,7 @@ function ec(t) {
11032
11032
  return typeof n.text == "string" ? n.text : typeof n.content == "string" ? n.content : "";
11033
11033
  }).filter(Boolean).join("") : "";
11034
11034
  }
11035
- function go(t, e) {
11035
+ function fo(t, e) {
11036
11036
  return t && typeof t == "object" && typeof t[e] == "string" ? t[e] : null;
11037
11037
  }
11038
11038
  function rf(t, e) {
@@ -11080,7 +11080,7 @@ function sn(t, e) {
11080
11080
  }
11081
11081
  function Tl(t, e) {
11082
11082
  try {
11083
- const n = `${gi}${t}`, s = location.href, i = location.origin, o = Array.from(e, (r) => ({
11083
+ const n = `${fi}${t}`, s = location.href, i = location.origin, o = Array.from(e, (r) => ({
11084
11084
  ...r,
11085
11085
  storedAt: Date.now(),
11086
11086
  unloadUrl: s,
@@ -11096,7 +11096,7 @@ function Tl(t, e) {
11096
11096
  }
11097
11097
  function tc(t, e) {
11098
11098
  try {
11099
- if (window.sessionStorage.getItem(`${gi}${t}`) === null)
11099
+ if (window.sessionStorage.getItem(`${fi}${t}`) === null)
11100
11100
  return;
11101
11101
  } catch {
11102
11102
  return;
@@ -11105,7 +11105,7 @@ function tc(t, e) {
11105
11105
  }
11106
11106
  function cf(t) {
11107
11107
  try {
11108
- const e = `${gi}${t}`, n = window.sessionStorage.getItem(e);
11108
+ const e = `${fi}${t}`, n = window.sessionStorage.getItem(e);
11109
11109
  if (window.sessionStorage.removeItem(e), !n)
11110
11110
  return [];
11111
11111
  const s = JSON.parse(n);
@@ -11153,7 +11153,7 @@ function uf(t, e) {
11153
11153
  }
11154
11154
  function pf(t) {
11155
11155
  try {
11156
- window.sessionStorage.removeItem(`${gi}${t}`);
11156
+ window.sessionStorage.removeItem(`${fi}${t}`);
11157
11157
  } catch {
11158
11158
  return;
11159
11159
  }
@@ -11268,7 +11268,7 @@ function Ll(t) {
11268
11268
  return e;
11269
11269
  }
11270
11270
  function Cr(t, e) {
11271
- return $l(t) ? fi : Tt(ni(e), ug);
11271
+ return $l(t) ? mi : Tt(si(e), ug);
11272
11272
  }
11273
11273
  function bf(t, e) {
11274
11274
  return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
@@ -11339,11 +11339,11 @@ function ic(t) {
11339
11339
  return t;
11340
11340
  const e = t.trim();
11341
11341
  if (!e.startsWith("{") && !e.startsWith("["))
11342
- return ni(t);
11342
+ return si(t);
11343
11343
  try {
11344
11344
  return JSON.stringify(st(JSON.parse(t)));
11345
11345
  } catch {
11346
- return ni(t);
11346
+ return si(t);
11347
11347
  }
11348
11348
  }
11349
11349
  function Nl(t) {
@@ -11397,7 +11397,7 @@ function kf(t) {
11397
11397
  function Tt(t, e = Ir) {
11398
11398
  return t.length <= e ? t : `${t.slice(0, e)}... [truncated ${t.length - e} chars]`;
11399
11399
  }
11400
- function fo(t) {
11400
+ function mo(t) {
11401
11401
  return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
11402
11402
  }
11403
11403
  class Ul extends Error {
@@ -11433,13 +11433,13 @@ function Rf(t) {
11433
11433
  function Tf(t) {
11434
11434
  return t === 401 || t === 403;
11435
11435
  }
11436
- const fi = "[REDACTED_SECRET]", Mt = "[REDACTED_TOKEN]", Mf = "[REDACTED_SIGNED_URL]", Pf = 20, qf = /^(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, zl = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Bl = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, jl = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Fl = /\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, Of = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Df = /\bhttps?:\/\/[^\s"'<>]+/gi, Lf = /[),.;\]]+$/;
11436
+ const mi = "[REDACTED_SECRET]", Mt = "[REDACTED_TOKEN]", Mf = "[REDACTED_SIGNED_URL]", Pf = 20, qf = /^(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, zl = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Bl = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, jl = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Fl = /\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, Of = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Df = /\bhttps?:\/\/[^\s"'<>]+/gi, Lf = /[),.;\]]+$/;
11437
11437
  function st(t) {
11438
- return ti(t, 0, /* @__PURE__ */ new WeakSet());
11438
+ return ni(t, 0, /* @__PURE__ */ new WeakSet());
11439
11439
  }
11440
- function ti(t, e, n) {
11440
+ function ni(t, e, n) {
11441
11441
  if (typeof t == "string")
11442
- return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : ni(t);
11442
+ return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : si(t);
11443
11443
  if (t === null || typeof t != "object")
11444
11444
  return t;
11445
11445
  if (e >= Pf)
@@ -11447,10 +11447,10 @@ function ti(t, e, n) {
11447
11447
  if (n.has(t))
11448
11448
  return "[REDACTED_CIRCULAR]";
11449
11449
  if (n.add(t), Array.isArray(t))
11450
- return t.map((i) => ti(i, e + 1, n));
11450
+ return t.map((i) => ni(i, e + 1, n));
11451
11451
  const s = {};
11452
11452
  for (const [i, o] of Object.entries(t))
11453
- i === "pageContent" ? s[i] = o : $l(i) ? s[i] = fi : s[i] = i.toLowerCase() === "url" ? Nf(o) : ti(o, e + 1, n);
11453
+ i === "pageContent" ? s[i] = o : $l(i) ? s[i] = mi : s[i] = i.toLowerCase() === "url" ? Nf(o) : ni(o, e + 1, n);
11454
11454
  return s;
11455
11455
  }
11456
11456
  function $l(t) {
@@ -11458,7 +11458,7 @@ function $l(t) {
11458
11458
  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");
11459
11459
  }
11460
11460
  function Nf(t) {
11461
- return typeof t == "string" ? Hl(t) : ti(t, 0, /* @__PURE__ */ new WeakSet());
11461
+ return typeof t == "string" ? Hl(t) : ni(t, 0, /* @__PURE__ */ new WeakSet());
11462
11462
  }
11463
11463
  function Hl(t) {
11464
11464
  try {
@@ -11470,11 +11470,11 @@ function Hl(t) {
11470
11470
  return Uf(t);
11471
11471
  }
11472
11472
  }
11473
- function ni(t) {
11474
- return t.replace(Of, Mf).replace(Df, zf).replace(zl, `Bearer ${Mt}`).replace(Bl, `Basic ${Mt}`).replace(jl, Mt).replace(Fl, (e, n) => `${n}: ${fi}`);
11473
+ function si(t) {
11474
+ return t.replace(Of, Mf).replace(Df, zf).replace(zl, `Bearer ${Mt}`).replace(Bl, `Basic ${Mt}`).replace(jl, Mt).replace(Fl, (e, n) => `${n}: ${mi}`);
11475
11475
  }
11476
11476
  function Uf(t) {
11477
- return t.replace(zl, `Bearer ${Mt}`).replace(Bl, `Basic ${Mt}`).replace(jl, Mt).replace(Fl, (e, n) => `${n}: ${fi}`);
11477
+ return t.replace(zl, `Bearer ${Mt}`).replace(Bl, `Basic ${Mt}`).replace(jl, Mt).replace(Fl, (e, n) => `${n}: ${mi}`);
11478
11478
  }
11479
11479
  function zf(t) {
11480
11480
  const e = t.match(Lf)?.[0] ?? "", n = e ? t.slice(0, -e.length) : t;
@@ -11523,8 +11523,8 @@ function Kf(t) {
11523
11523
  return nr(t) > 0.5 ? [24, 24, 27] : [250, 250, 249];
11524
11524
  }
11525
11525
  const Wf = "Looks like no message is sent yet";
11526
- function os(t) {
11527
- if (!ls(void 0, t).allowed) return "bottom_notice";
11526
+ function rs(t) {
11527
+ if (!ds(void 0, t).allowed) return "bottom_notice";
11528
11528
  switch (t) {
11529
11529
  case "submission_checkpoint_pending":
11530
11530
  case "connection_failed":
@@ -11545,17 +11545,17 @@ function Vf(t) {
11545
11545
  return {
11546
11546
  // A failed transcript read is not an execution outcome. Hide conflicting progress copy only;
11547
11547
  // keep the underlying execution state and Stop authority unchanged.
11548
- showProgress: !t.lastError || os(e) !== "conversation",
11548
+ showProgress: !t.lastError || rs(e) !== "conversation",
11549
11549
  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"]
11550
11550
  };
11551
11551
  }
11552
- const Gf = "#7c3aed", si = "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", ii = "#2c2a1e", rc = [253, 250, 241], ac = 3.5;
11552
+ const Gf = "#7c3aed", ii = "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", oi = "#2c2a1e", rc = [253, 250, 241], ac = 3.5;
11553
11553
  function Kl(t) {
11554
11554
  const e = Wl(t);
11555
- if (cc(rs(e), rc) >= ac)
11555
+ if (cc(as(e), rc) >= ac)
11556
11556
  return e;
11557
- let s = rs(e);
11558
- const i = rs(ii);
11557
+ let s = as(e);
11558
+ const i = as(oi);
11559
11559
  for (let o = 0; o < 6; o += 1)
11560
11560
  if (s = Qf(s, i, 0.22), cc(s, rc) >= ac)
11561
11561
  return sr(s);
@@ -11570,7 +11570,7 @@ function Jf() {
11570
11570
  return n;
11571
11571
  }
11572
11572
  function Yf(t) {
11573
- const e = Wl(t), n = ir(rs(e));
11573
+ const e = Wl(t), n = ir(as(e));
11574
11574
  return n > 0.86 ? {
11575
11575
  top: "#ffffff",
11576
11576
  middle: "#f6f6f6",
@@ -11610,7 +11610,7 @@ function Wl(t) {
11610
11610
  const e = t.trim();
11611
11611
  return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : Gf;
11612
11612
  }
11613
- function rs(t) {
11613
+ function as(t) {
11614
11614
  return [
11615
11615
  Number.parseInt(t.slice(1, 3), 16),
11616
11616
  Number.parseInt(t.slice(3, 5), 16),
@@ -11641,7 +11641,7 @@ function Qf(t, e, n) {
11641
11641
  ];
11642
11642
  }
11643
11643
  function mt(t, e, n) {
11644
- const [s, i, o] = Xf(rs(t));
11644
+ const [s, i, o] = Xf(as(t));
11645
11645
  return sr(Zf(s, or(i + n), or(o + e)));
11646
11646
  }
11647
11647
  function Xf([t, e, n]) {
@@ -11656,12 +11656,12 @@ function Zf(t, e, n) {
11656
11656
  return [n * 255, n * 255, n * 255];
11657
11657
  const s = n < 0.5 ? n * (1 + e) : n + e - n * e, i = 2 * n - s;
11658
11658
  return [
11659
- mo(i, s, t + 1 / 3) * 255,
11660
- mo(i, s, t) * 255,
11661
- mo(i, s, t - 1 / 3) * 255
11659
+ yo(i, s, t + 1 / 3) * 255,
11660
+ yo(i, s, t) * 255,
11661
+ yo(i, s, t - 1 / 3) * 255
11662
11662
  ];
11663
11663
  }
11664
- function mo(t, e, n) {
11664
+ function yo(t, e, n) {
11665
11665
  let s = n;
11666
11666
  return s < 0 && (s += 1), s > 1 && (s -= 1), s < 1 / 6 ? t + (e - t) * 6 * s : s < 1 / 2 ? e : s < 2 / 3 ? t + (e - t) * (2 / 3 - s) * 6 : t;
11667
11667
  }
@@ -11758,7 +11758,7 @@ function cm(t, e) {
11758
11758
  (s, i) => e && i === n && !s.terminal
11759
11759
  );
11760
11760
  }
11761
- const lm = 80, dm = 64e3, dc = 60, yo = 160;
11761
+ const lm = 80, dm = 64e3, dc = 60, bo = 160;
11762
11762
  function um(t, e, n, s) {
11763
11763
  const i = /* @__PURE__ */ new Map(), o = [], r = [];
11764
11764
  let a = 0, c = 0, l = 0, u = crypto.randomUUID(), d = s.getState();
@@ -11784,7 +11784,7 @@ function um(t, e, n, s) {
11784
11784
  ce(), S = null, D !== null && b.clearTimeout(D), D = null, _ = void 0, v = void 0, I.clear(), G.clear(), E !== null && b.clearTimeout(E), E = null, H && O.clear();
11785
11785
  }
11786
11786
  function he() {
11787
- if (ei(e) !== "none") {
11787
+ if (ti(e) !== "none") {
11788
11788
  le(!0);
11789
11789
  return;
11790
11790
  }
@@ -11858,14 +11858,14 @@ function um(t, e, n, s) {
11858
11858
  ie.before && (ie.before.context = v);
11859
11859
  const ae = Math.floor(se - ee.monotonicMs);
11860
11860
  ie.current.context = {
11861
- ...Ho(e, d, { renderSource: "observer" }),
11861
+ ...Ko(e, d, { renderSource: "observer" }),
11862
11862
  firstObservedAt: ee.occurredAt,
11863
11863
  confirmationMs: ae
11864
11864
  }, s.reportInvalidStateTransition?.(`ui_invariant:${L}`, void 0, ie);
11865
11865
  } else
11866
11866
  G.set(L, ee);
11867
11867
  }
11868
- ye.length === 0 && W && (_ = $, v = Ho(e, d, { renderSource: "observer" }), I = new Map(Array.from(e.querySelectorAll("[data-terminal-response-key][data-canonical-item-key]")).map((L) => [L.dataset.terminalResponseKey, L.dataset.canonicalItemKey]))), E !== null && b.clearTimeout(E), E = G.size ? b.setTimeout(() => {
11868
+ ye.length === 0 && W && (_ = $, v = Ko(e, d, { renderSource: "observer" }), I = new Map(Array.from(e.querySelectorAll("[data-terminal-response-key][data-canonical-item-key]")).map((L) => [L.dataset.terminalResponseKey, L.dataset.canonicalItemKey]))), E !== null && b.clearTimeout(E), E = G.size ? b.setTimeout(() => {
11869
11869
  E = null, he();
11870
11870
  }, Math.max(1, 250 - (se - Math.min(...Array.from(G.values(), (L) => L.monotonicMs))))) : null;
11871
11871
  }
@@ -11873,17 +11873,17 @@ function um(t, e, n, s) {
11873
11873
  const x = H !== "runtime", C = x ? e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]") : null, z = C?.length ?? d.messages.length, Y = [];
11874
11874
  for (let ne = Math.max(0, z - dc); ne < z; ne += 1) {
11875
11875
  const se = C ? C[ne].dataset.messageKey ?? C[ne].dataset.entryKey : d.messages[ne].id;
11876
- se && Y.push(se.slice(0, yo));
11876
+ se && Y.push(se.slice(0, bo));
11877
11877
  }
11878
11878
  const re = {
11879
- session_id: d.sessionId?.slice(0, yo) ?? null,
11880
- run_id: (d.assistantDraftRunId ?? d.messages[d.messages.length - 1]?.runId)?.slice(0, yo) ?? null,
11879
+ session_id: d.sessionId?.slice(0, bo) ?? null,
11880
+ run_id: (d.assistantDraftRunId ?? d.messages[d.messages.length - 1]?.runId)?.slice(0, bo) ?? null,
11881
11881
  item_keys: Y,
11882
11882
  item_count: z,
11883
11883
  items_truncated: z > dc,
11884
11884
  thinking: d.isThinking,
11885
11885
  loading: d.isLoadingSession,
11886
- welcome: x && ei(e) === "none" && !!e.querySelector(".pluno-pa-widget__empty-state--starter, .empty-state--starter"),
11886
+ welcome: x && ti(e) === "none" && !!e.querySelector(".pluno-pa-widget__empty-state--starter, .empty-state--starter"),
11887
11887
  error: !!d.lastError,
11888
11888
  connected: d.status === "connected",
11889
11889
  visible: e.getClientRects().length > 0,
@@ -11980,7 +11980,7 @@ function um(t, e, n, s) {
11980
11980
  }
11981
11981
  const pm = [100, 500, 1500, 4e3];
11982
11982
  let hm = 0;
11983
- const gm = "product-agent:sdk-preview-socket-connect", fm = "product-agent:sdk-preview-socket-send", mm = "product-agent:sdk-preview-socket-close", ym = "product-agent:sdk-preview-socket-open", bm = "product-agent:sdk-preview-socket-message", wm = "product-agent:sdk-preview-socket-error", _m = "product-agent:sdk-preview-socket-closed", uc = "product-agent:sdk-preview-socket-id", Gl = "data-pluno-auto-mounted", Ct = "__plunoProductAgentAutoMountOwner", vm = "pluno.productAgent.widgetClientId.", bo = /* @__PURE__ */ new Set(), Im = "product-agent:preview-diagnostic", Sm = 3, pc = 'dialog[open], [aria-modal="true"], [role="dialog"]', hc = 1500, xm = 5e3, km = 500, Em = "Could not load recent chats. Please try again.", At = {
11983
+ const gm = "product-agent:sdk-preview-socket-connect", fm = "product-agent:sdk-preview-socket-send", mm = "product-agent:sdk-preview-socket-close", ym = "product-agent:sdk-preview-socket-open", bm = "product-agent:sdk-preview-socket-message", wm = "product-agent:sdk-preview-socket-error", _m = "product-agent:sdk-preview-socket-closed", uc = "product-agent:sdk-preview-socket-id", Gl = "data-pluno-auto-mounted", Ct = "__plunoProductAgentAutoMountOwner", vm = "pluno.productAgent.widgetClientId.", wo = /* @__PURE__ */ new Set(), Im = "product-agent:preview-diagnostic", Sm = 3, pc = 'dialog[open], [aria-modal="true"], [role="dialog"]', hc = 1500, xm = 5e3, km = 500, Em = "Could not load recent chats. Please try again.", At = {
11984
11984
  launcherLabel: "Ask for anything...",
11985
11985
  accentColor: "#7c3aed",
11986
11986
  colorScheme: "light",
@@ -12025,7 +12025,7 @@ const gm = "product-agent:sdk-preview-socket-connect", fm = "product-agent:sdk-p
12025
12025
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
12026
12026
  pathStrokeWidth: "2.45"
12027
12027
  }
12028
- ], Um = 11, zm = 13, oi = 4, Tr = 10, Mr = 40, Bm = "movable-launcher-position-v2", Xl = "pluno-pa-widget-styles", Zl = "data-pluno-pa-widget-styles", jm = "__plunoExtensionWidgetOwner";
12028
+ ], Um = 11, zm = 13, ri = 4, Tr = 10, Mr = 40, Bm = "movable-launcher-position-v2", Xl = "pluno-pa-widget-styles", Zl = "data-pluno-pa-widget-styles", jm = "__plunoExtensionWidgetOwner";
12029
12029
  let mc = 0;
12030
12030
  function Fm(t) {
12031
12031
  return (e) => new Rt(e, t);
@@ -12141,7 +12141,7 @@ async function $m(t = {}) {
12141
12141
  `${e.mobilePanelTopOffset}px`
12142
12142
  ), l.classList.add(`pluno-pa-widget--${e.colorScheme}`), e.scribbleStyle && l.classList.add("pluno-pa-widget--scribble"), h === "minimized" && (l.classList.add("pluno-pa-widget--minimized"), Bt(
12143
12143
  l,
12144
- _o(
12144
+ vo(
12145
12145
  l,
12146
12146
  f,
12147
12147
  e.position
@@ -12243,9 +12243,9 @@ async function $m(t = {}) {
12243
12243
  const ne = /* @__PURE__ */ new Map();
12244
12244
  let se = null, L = null;
12245
12245
  const ee = (p) => p === N ? "widget_composer" : p === T ? "widget_launcher" : p && c.contains(p) ? "widget_control" : p === v.body ? "body" : p === v.documentElement ? "document" : p ? "host_page" : "none", ie = (p, w, A = {}) => {
12246
- const R = xo(v), F = A.skipIfAlreadyFocused === !0 && R === p;
12246
+ const R = ko(v), F = A.skipIfAlreadyFocused === !0 && R === p;
12247
12247
  F || (A.preventScroll ? p.focus({ preventScroll: !0 }) : p.focus());
12248
- const de = xo(v);
12248
+ const de = ko(v);
12249
12249
  return pt(
12250
12250
  "web-sdk.widget.focus",
12251
12251
  "Programmatic widget focus",
@@ -12332,8 +12332,8 @@ async function $m(t = {}) {
12332
12332
  throw ve?.release(), a.remove(), p;
12333
12333
  }
12334
12334
  let An = M.getState().sessionId, Rn = M.getState().selectionKey, Jt = M.getState().user?.id ?? null;
12335
- const wi = e.model ?? "gpt-6.1-sol";
12336
- let fn = wi, _i = M.getAccount()?.auth?.workspace?.id ?? null;
12335
+ const _i = e.model ?? "gpt-6.1-sol";
12336
+ let fn = _i, vi = M.getAccount()?.auth?.workspace?.id ?? null;
12337
12337
  _.appendChild(a), pt(
12338
12338
  "web-sdk.widget",
12339
12339
  "Applied initial widget appearance",
@@ -12344,46 +12344,46 @@ async function $m(t = {}) {
12344
12344
  cssAccent: l.style.getPropertyValue("--pluno-pa-accent")
12345
12345
  }
12346
12346
  );
12347
- const vi = new Set(d.openToolGroupKeys);
12347
+ const Ii = new Set(d.openToolGroupKeys);
12348
12348
  let lt = null, Ke = !1, qt = !1, vt = {
12349
12349
  enabled: !0
12350
- }, Ot = 0, Ii = null, Yt = null, Qt = null, ps = null, Tn = !1, me = null, Ur = "local";
12350
+ }, Ot = 0, Si = null, Yt = null, Qt = null, hs = null, Tn = !1, me = null, Ur = "local";
12351
12351
  const zr = (p) => An !== null && An !== p.sessionId || Jt !== null && Jt !== (p.user?.id ?? null) || Rn !== void 0 && Rn !== p.selectionKey, Br = (p) => xu(x, p, {
12352
12352
  renderSource: Ur,
12353
12353
  guardCreatedAt: me?.createdAt ?? null,
12354
12354
  selectionFencePending: zr(p)
12355
- }), hs = /* @__PURE__ */ new Set();
12356
- let Mn = "", Ue = !1, et = null, jr = location.origin, Fr = M.getState().sessionId, $r = M.getState().user?.id ?? null, Si = M.getState().status, It = () => {
12357
- }, xi = "", je = M.getSessionHistoryState();
12355
+ }), gs = /* @__PURE__ */ new Set();
12356
+ let Mn = "", Ue = !1, et = null, jr = location.origin, Fr = M.getState().sessionId, $r = M.getState().user?.id ?? null, xi = M.getState().status, It = () => {
12357
+ }, ki = "", je = M.getSessionHistoryState();
12358
12358
  const wd = M.subscribeSessionHistory((p) => {
12359
12359
  je = p, Ke || It();
12360
12360
  }), tt = (p, w) => {
12361
12361
  vt = { enabled: p, reason: w };
12362
12362
  }, dt = () => {
12363
12363
  oe.hidden = !0;
12364
- }, ki = () => {
12364
+ }, Ei = () => {
12365
12365
  x.clientHeight === 0 || x.scrollHeight - x.scrollTop - x.clientHeight > 1 || (tt(!0, "bottom"), dt());
12366
- }, Ei = (p, w, A) => {
12366
+ }, Ci = (p, w, A) => {
12367
12367
  const R = `${p}:${w ?? "current-view"}`;
12368
- hs.has(R) || (hs.add(R), M.reportInvalidStateTransition?.(p, w, A));
12368
+ gs.has(R) || (gs.add(R), M.reportInvalidStateTransition?.(p, w, A));
12369
12369
  }, _d = () => {
12370
- Au(Tn, Ei), oe.hidden = !1;
12370
+ Au(Tn, Ci), oe.hidden = !1;
12371
12371
  }, Hr = () => {
12372
- me?.observedConversation && x.querySelector(".pluno-pa-widget__empty-state--starter") && (me.observedWelcome ??= Br(M.getState())), me?.observedWelcome && !me.pendingSubmission && (Ei("submitted_turn_returned_to_welcome_without_new_chat", me.clientMessageId, {
12372
+ me?.observedConversation && x.querySelector(".pluno-pa-widget__empty-state--starter") && (me.observedWelcome ??= Br(M.getState())), me?.observedWelcome && !me.pendingSubmission && (Ci("submitted_turn_returned_to_welcome_without_new_chat", me.clientMessageId, {
12373
12373
  before: me.observedConversation,
12374
12374
  current: me.observedWelcome
12375
12375
  }), me = null);
12376
12376
  }, vd = (p = "jump") => {
12377
12377
  tt(!0, p), dt(), vn(x, () => vt.enabled), Ot = x.scrollTop;
12378
- }, gs = (p) => {
12379
- Ii = p, p === "up" && x.scrollTop < Ot - 1 && (Tn = !0, tt(!1, "userScroll")), Yt !== null && window.clearTimeout(Yt), Yt = window.setTimeout(() => {
12380
- Ii = null, Yt = null;
12378
+ }, fs = (p) => {
12379
+ Si = p, p === "up" && x.scrollTop < Ot - 1 && (Tn = !0, tt(!1, "userScroll")), Yt !== null && window.clearTimeout(Yt), Yt = window.setTimeout(() => {
12380
+ Si = null, Yt = null;
12381
12381
  }, 500);
12382
12382
  };
12383
12383
  It = () => {
12384
12384
  const p = Kp(je.data), w = je.status === "loading" || je.status === "refreshing" || je.status === "loading_more";
12385
12385
  if (be.hidden = e.layout === "page" || s(), s() && (Ue = !1), Xe.hidden = !Ue, be.setAttribute("aria-expanded", String(Ue)), !Ue) {
12386
- xi = "";
12386
+ ki = "";
12387
12387
  return;
12388
12388
  }
12389
12389
  const A = JSON.stringify([
@@ -12392,8 +12392,8 @@ async function $m(t = {}) {
12392
12392
  M.getState().sessionId,
12393
12393
  p.map((R) => kc(R.lastActiveAt, Date.now()))
12394
12394
  ]);
12395
- if (A !== xi) {
12396
- if (xi = A, Ee.classList.toggle(
12395
+ if (A !== ki) {
12396
+ if (ki = A, Ee.classList.toggle(
12397
12397
  "pluno-pa-widget__history-list--center",
12398
12398
  w && p.length === 0
12399
12399
  ), Ee.replaceChildren(), w && p.length === 0) {
@@ -12414,7 +12414,7 @@ async function $m(t = {}) {
12414
12414
  );
12415
12415
  const ue = document.createElement("small");
12416
12416
  ue.className = "pluno-pa-widget__history-path", ue.textContent = ay(R), F.append(ke, Re, ue), F.addEventListener("click", () => {
12417
- Ue = !1, It(), me = null, Tn = !1, hs.clear(), tt(!0, "newSession"), dt(), M.loadSession(R.id), Ae(M.getState()), ae("history_session_selected");
12417
+ Ue = !1, It(), me = null, Tn = !1, gs.clear(), tt(!0, "newSession"), dt(), M.loadSession(R.id), Ae(M.getState()), ae("history_session_selected");
12418
12418
  }), Ee.appendChild(F);
12419
12419
  }
12420
12420
  if (w && p.length > 0) {
@@ -12424,7 +12424,7 @@ async function $m(t = {}) {
12424
12424
  Me.textContent = (je.status === "error" ? Em : null) ?? (!w && p.length === 0 ? "No recent chats for this page yet." : ""), Me.hidden = Me.textContent.length === 0, Me.classList.toggle("pluno-pa-widget__history-error", je.status === "error"), H.hidden = je.status !== "error", H.disabled = w;
12425
12425
  }
12426
12426
  };
12427
- const Ci = (p = !1) => {
12427
+ const Ai = (p = !1) => {
12428
12428
  if (et !== null && (window.clearTimeout(et), et = null), !(e.layout === "page" || e.loginRequired || e.signupRequired || z || !p && M.getState().status !== "connected"))
12429
12429
  return z = !0, M.refreshSessionHistory().catch(() => {
12430
12430
  }).finally(() => {
@@ -12432,13 +12432,13 @@ async function $m(t = {}) {
12432
12432
  });
12433
12433
  };
12434
12434
  H.addEventListener("click", () => {
12435
- H.disabled = !0, Promise.resolve(Ci(!0)).finally(() => {
12435
+ H.disabled = !0, Promise.resolve(Ai(!0)).finally(() => {
12436
12436
  H.disabled = !1;
12437
12437
  });
12438
12438
  });
12439
- const Ai = () => {
12439
+ const Ri = () => {
12440
12440
  et === null && (et = window.setTimeout(() => {
12441
- et = null, !(Ke || !l.classList.contains("pluno-pa-widget--open")) && Ci();
12441
+ et = null, !(Ke || !l.classList.contains("pluno-pa-widget--open")) && Ai();
12442
12442
  }, 0));
12443
12443
  }, Id = () => {
12444
12444
  const p = je.data?.nextCursor ?? null;
@@ -12451,10 +12451,10 @@ async function $m(t = {}) {
12451
12451
  subtree: !0
12452
12452
  }), Kr();
12453
12453
  const Pn = (p = !0) => {
12454
- const w = as(l, p);
12455
- return Vs(
12454
+ const w = cs(l, p);
12455
+ return Gs(
12456
12456
  l,
12457
- f ? Gs(f, w) : Qm(
12457
+ f ? Js(f, w) : Qm(
12458
12458
  l,
12459
12459
  e.position,
12460
12460
  w
@@ -12465,26 +12465,26 @@ async function $m(t = {}) {
12465
12465
  pb(e, {
12466
12466
  isOpen: l.classList.contains("pluno-pa-widget--open"),
12467
12467
  composerValue: N.value,
12468
- openToolGroupKeys: [...vi],
12468
+ openToolGroupKeys: [...Ii],
12469
12469
  launcherPosition: m ? f : null,
12470
12470
  panelSize: g
12471
12471
  });
12472
- }, fs = (p, w) => {
12472
+ }, ms = (p, w) => {
12473
12473
  e.onDisplayStateChange?.(p, w);
12474
12474
  }, qn = (p, w = !0, A = "external_request") => {
12475
12475
  const R = l.classList.contains("pluno-pa-widget--minimized");
12476
12476
  if (Dc(e, p), p === "shown") {
12477
- l.classList.remove("pluno-pa-widget--minimized"), I.removeAttribute("tabindex"), I.removeAttribute("role"), I.removeAttribute("aria-label"), !l.classList.contains("pluno-pa-widget--open") && !l.classList.contains("pluno-pa-widget--closing") && On(!1), w && fs("shown", A);
12477
+ l.classList.remove("pluno-pa-widget--minimized"), I.removeAttribute("tabindex"), I.removeAttribute("role"), I.removeAttribute("aria-label"), !l.classList.contains("pluno-pa-widget--open") && !l.classList.contains("pluno-pa-widget--closing") && On(!1), w && ms("shown", A);
12478
12478
  return;
12479
12479
  }
12480
12480
  lt !== null && (window.clearTimeout(lt), lt = null), l.classList.remove("pluno-pa-widget--open"), l.classList.remove("pluno-pa-widget--closing"), l.classList.add("pluno-pa-widget--minimized"), I.hidden = !1, I.setAttribute("role", "button"), I.setAttribute("aria-label", "Open Pluno"), E.hidden = !0, U.hidden = !0, I.tabIndex = 0, N.value = "", Bt(
12481
12481
  l,
12482
- _o(
12482
+ vo(
12483
12483
  l,
12484
12484
  f,
12485
12485
  e.position
12486
12486
  )
12487
- ), Ic(l), Fe(), !R && e.layout === "floating" && M.recordWidgetLifecycle("minimized", A), w && fs("minimized", A);
12487
+ ), Ic(l), Fe(), !R && e.layout === "floating" && M.recordWidgetLifecycle("minimized", A), w && ms("minimized", A);
12488
12488
  }, Xt = (p, w = {}) => {
12489
12489
  sy(p, {
12490
12490
  debugVersion: Bm,
@@ -12496,9 +12496,9 @@ async function $m(t = {}) {
12496
12496
  right: l.style.right,
12497
12497
  bottom: l.style.bottom
12498
12498
  },
12499
- rootRect: So(l),
12500
- launcherRect: So(I),
12501
- panelRect: So(E),
12499
+ rootRect: xo(l),
12500
+ launcherRect: xo(I),
12501
+ panelRect: xo(E),
12502
12502
  viewport: Qe(),
12503
12503
  panelHidden: E.hidden,
12504
12504
  closeHidden: U.hidden,
@@ -12511,7 +12511,7 @@ async function $m(t = {}) {
12511
12511
  return Bt(l, w), Xt("Applied stored closed launcher position", {
12512
12512
  visibleLauncherPosition: w
12513
12513
  }), w;
12514
- }, ms = (p, w) => {
12514
+ }, ys = (p, w) => {
12515
12515
  if (!p || !w) {
12516
12516
  Ic(l);
12517
12517
  return;
@@ -12520,14 +12520,14 @@ async function $m(t = {}) {
12520
12520
  x: p.x - w.x,
12521
12521
  y: p.y - w.y
12522
12522
  });
12523
- }, Ri = () => {
12523
+ }, Ti = () => {
12524
12524
  const p = rn(g).width;
12525
12525
  return E.getBoundingClientRect().width || p;
12526
12526
  }, Vr = () => {
12527
12527
  if (l.classList.contains("pluno-pa-widget--minimized")) {
12528
12528
  Bt(
12529
12529
  l,
12530
- _o(
12530
+ vo(
12531
12531
  l,
12532
12532
  f,
12533
12533
  e.position
@@ -12537,14 +12537,14 @@ async function $m(t = {}) {
12537
12537
  }
12538
12538
  const p = On();
12539
12539
  if (l.classList.contains("pluno-pa-widget--open") || l.classList.contains("pluno-pa-widget--closing")) {
12540
- wo(l, g);
12540
+ _o(l, g);
12541
12541
  const w = rn(g);
12542
- ko(
12542
+ Eo(
12543
12543
  q,
12544
- Ri()
12544
+ Ti()
12545
12545
  );
12546
12546
  const A = ss(
12547
- y ? Gs(y, w) : Io(
12547
+ y ? Js(y, w) : So(
12548
12548
  l,
12549
12549
  p,
12550
12550
  e.position,
@@ -12552,7 +12552,7 @@ async function $m(t = {}) {
12552
12552
  ),
12553
12553
  w
12554
12554
  );
12555
- ms(A, p), Xt(
12555
+ ys(A, p), Xt(
12556
12556
  "Applied open panel position after viewport resize",
12557
12557
  { openPanelPosition: A }
12558
12558
  );
@@ -12569,12 +12569,12 @@ async function $m(t = {}) {
12569
12569
  launcherDragHandle: k,
12570
12570
  getPosition: () => Pn(),
12571
12571
  setPosition: (p) => {
12572
- const w = p, A = as(l), R = Vs(
12572
+ const w = p, A = cs(l), R = Gs(
12573
12573
  l,
12574
12574
  p,
12575
12575
  A
12576
12576
  );
12577
- f = vo(
12577
+ f = Io(
12578
12578
  R,
12579
12579
  A
12580
12580
  ), y = null, Bt(l, R), Xt("Dragging closed launcher", {
@@ -12584,12 +12584,12 @@ async function $m(t = {}) {
12584
12584
  persist: () => {
12585
12585
  m = !0, Fe(), Xt("Persisted closed launcher drag position");
12586
12586
  }
12587
- })) : Bt(l, null), wo(l, g);
12587
+ })) : Bt(l, null), _o(l, g);
12588
12588
  const Jr = () => {
12589
12589
  const p = rn(g), w = Pn();
12590
12590
  return {
12591
12591
  position: ss(
12592
- y ? Gs(y, p) : Io(
12592
+ y ? Js(y, p) : So(
12593
12593
  l,
12594
12594
  w,
12595
12595
  e.position,
@@ -12600,25 +12600,25 @@ async function $m(t = {}) {
12600
12600
  size: p
12601
12601
  };
12602
12602
  }, Sd = (p) => {
12603
- g = mi(p.size), wo(l, g), ko(
12603
+ g = yi(p.size), _o(l, g), Eo(
12604
12604
  q,
12605
- Ri()
12605
+ Ti()
12606
12606
  );
12607
12607
  const w = ss(
12608
12608
  p.position,
12609
12609
  rn(g)
12610
12610
  );
12611
- y = vo(
12611
+ y = Io(
12612
12612
  w,
12613
12613
  rn(g)
12614
12614
  );
12615
12615
  const A = Pn();
12616
- ms(w, A);
12616
+ ys(w, A);
12617
12617
  }, xd = (p) => {
12618
12618
  const w = rn(g), A = ss(
12619
12619
  p,
12620
12620
  w
12621
- ), R = as(l), F = Vs(
12621
+ ), R = cs(l), F = Gs(
12622
12622
  l,
12623
12623
  ty(
12624
12624
  A,
@@ -12628,10 +12628,10 @@ async function $m(t = {}) {
12628
12628
  ),
12629
12629
  R
12630
12630
  );
12631
- f = vo(
12631
+ f = Io(
12632
12632
  F,
12633
12633
  R
12634
- ), m = !0, y = null, Bt(l, F), ms(A, F);
12634
+ ), m = !0, y = null, Bt(l, F), ys(A, F);
12635
12635
  }, kd = e.movableLauncher && B ? Gm({
12636
12636
  root: l,
12637
12637
  handle: B,
@@ -12648,28 +12648,28 @@ async function $m(t = {}) {
12648
12648
  }) : () => {
12649
12649
  }, St = (p = "", w = !0, A = !0, R = "external_request") => {
12650
12650
  const F = l.classList.contains("pluno-pa-widget--open") || !E.hidden && !l.classList.contains("pluno-pa-widget--closing");
12651
- Nn && (Nn = !1, qi()), l.classList.contains("pluno-pa-widget--open") || (y = null), lt !== null && (window.clearTimeout(lt), lt = null), qn("shown", !1), E.hidden = !1, U.hidden = !1, ko(
12651
+ Nn && (Nn = !1, Oi()), l.classList.contains("pluno-pa-widget--open") || (y = null), lt !== null && (window.clearTimeout(lt), lt = null), qn("shown", !1), E.hidden = !1, U.hidden = !1, Eo(
12652
12652
  q,
12653
- Ri()
12653
+ Ti()
12654
12654
  ), l.classList.remove("pluno-pa-widget--closing");
12655
- const de = On(), ke = Io(
12655
+ const de = On(), ke = So(
12656
12656
  l,
12657
12657
  de,
12658
12658
  e.position,
12659
12659
  g
12660
12660
  );
12661
- if (ms(ke, de), Xt("Opening launcher at clamped open panel position", {
12661
+ if (ys(ke, de), Xt("Opening launcher at clamped open panel position", {
12662
12662
  openPanelPosition: ke,
12663
12663
  visibleLauncherPosition: de
12664
12664
  }), tt(!0, "open"), dt(), !F && e.layout === "floating" && M.recordWidgetLifecycle("opened", R), !w) {
12665
- l.classList.add("pluno-pa-widget--open"), F || Ai(), I.hidden = !0, p && (N.value = p, Yn(N)), vn(x, () => vt.enabled), Ot = x.scrollTop, A && (ie(N, "panel_open_immediate"), N.setSelectionRange(N.value.length, N.value.length)), Fe(), fs("shown", R), e.onPanelOpenChange?.(!0, R);
12665
+ l.classList.add("pluno-pa-widget--open"), F || Ri(), I.hidden = !0, p && (N.value = p, Yn(N)), vn(x, () => vt.enabled), Ot = x.scrollTop, A && (ie(N, "panel_open_immediate"), N.setSelectionRange(N.value.length, N.value.length)), Fe(), ms("shown", R), e.onPanelOpenChange?.(!0, R);
12666
12666
  return;
12667
12667
  }
12668
12668
  const Re = Date.now();
12669
12669
  window.requestAnimationFrame(() => {
12670
- l.classList.add("pluno-pa-widget--open"), F || Ai(), p && (N.value = p, Yn(N)), vn(x, () => vt.enabled), Ot = x.scrollTop, A && (ie(N, "panel_open_animation", {
12670
+ l.classList.add("pluno-pa-widget--open"), F || Ri(), p && (N.value = p, Yn(N)), vn(x, () => vt.enabled), Ot = x.scrollTop, A && (ie(N, "panel_open_animation", {
12671
12671
  scheduledAt: Re
12672
- }), N.setSelectionRange(N.value.length, N.value.length)), Fe(), fs("shown", R), e.onPanelOpenChange?.(!0, R), lt = window.setTimeout(() => {
12672
+ }), N.setSelectionRange(N.value.length, N.value.length)), Fe(), ms("shown", R), e.onPanelOpenChange?.(!0, R), lt = window.setTimeout(() => {
12673
12673
  I.hidden = !0, vn(x, () => vt.enabled), Ot = x.scrollTop;
12674
12674
  }, 220);
12675
12675
  });
@@ -12695,8 +12695,8 @@ async function $m(t = {}) {
12695
12695
  const p = T.value;
12696
12696
  St(p, !0, !0, "launcher_input"), T.value = "";
12697
12697
  });
12698
- let Dn = null, Dt = null, ys = null, Zt = null, ft = null, Pe = null;
12699
- const bs = (p) => p === T || p === N, Xr = (p) => p.composedPath().find(bs) ?? null, Cd = (p) => {
12698
+ let Dn = null, Dt = null, bs = null, Zt = null, ft = null, Pe = null;
12699
+ const ws = (p) => p === T || p === N, Xr = (p) => p.composedPath().find(ws) ?? null, Cd = (p) => {
12700
12700
  let w = p;
12701
12701
  for (; w; ) {
12702
12702
  if (w.assignedSlot)
@@ -12704,7 +12704,7 @@ async function $m(t = {}) {
12704
12704
  w = w.parentElement;
12705
12705
  }
12706
12706
  return null;
12707
- }, Ti = (p) => {
12707
+ }, Mi = (p) => {
12708
12708
  if (!(p instanceof Element) || p.getRootNode() === l.getRootNode())
12709
12709
  return null;
12710
12710
  let w = p;
@@ -12721,7 +12721,7 @@ async function $m(t = {}) {
12721
12721
  w = F instanceof ShadowRoot ? F.host : null;
12722
12722
  }
12723
12723
  return null;
12724
- }, Mi = () => xo(v), Ad = (p) => {
12724
+ }, Pi = () => ko(v), Ad = (p) => {
12725
12725
  if (!p.isConnected || !p.matches(pc))
12726
12726
  return !1;
12727
12727
  if (!(p instanceof HTMLElement))
@@ -12732,7 +12732,7 @@ async function $m(t = {}) {
12732
12732
  return p.checkVisibility();
12733
12733
  const w = window.getComputedStyle(p);
12734
12734
  return w.display !== "none" && w.visibility !== "hidden";
12735
- }, Pi = (p, w) => {
12735
+ }, qi = (p, w) => {
12736
12736
  if (!w)
12737
12737
  return;
12738
12738
  ft !== null && window.clearTimeout(ft);
@@ -12745,17 +12745,17 @@ async function $m(t = {}) {
12745
12745
  }, 0);
12746
12746
  }, Ln = (p, w = null) => {
12747
12747
  if (xt === p) {
12748
- p && Pi(p, w);
12748
+ p && qi(p, w);
12749
12749
  return;
12750
12750
  }
12751
- xt = p, p !== null ? (Pi(p, w), Zt = window.setInterval(() => {
12751
+ xt = p, p !== null ? (qi(p, w), Zt = window.setInterval(() => {
12752
12752
  const A = xt;
12753
12753
  if (!A || !Ad(A)) {
12754
12754
  Ln(null);
12755
12755
  return;
12756
12756
  }
12757
- Pi(A, null);
12758
- }, km)) : (Zt !== null && (window.clearInterval(Zt), Zt = null), ft !== null && (window.clearTimeout(ft), ft = null), ys = null);
12757
+ qi(A, null);
12758
+ }, km)) : (Zt !== null && (window.clearInterval(Zt), Zt = null), ft !== null && (window.clearTimeout(ft), ft = null), bs = null);
12759
12759
  }, Rd = () => {
12760
12760
  Zt !== null && (window.clearInterval(Zt), Zt = null), ft !== null && (window.clearTimeout(ft), ft = null), Pe !== null && (window.clearTimeout(Pe), Pe = null);
12761
12761
  }, Zr = (p) => {
@@ -12764,19 +12764,19 @@ async function $m(t = {}) {
12764
12764
  return;
12765
12765
  const A = Date.now();
12766
12766
  Dt = A, Dn = A, Pe !== null && window.clearTimeout(Pe);
12767
- const R = xt ?? Ti(Mi());
12767
+ const R = xt ?? Mi(Pi());
12768
12768
  R && (Ln(R, w), p.stopImmediatePropagation()), Pe = window.setTimeout(() => {
12769
12769
  if (Pe = null, Dt !== A)
12770
12770
  return;
12771
- const F = Mi();
12771
+ const F = Pi();
12772
12772
  if (F === w) {
12773
12773
  Dt = null;
12774
12774
  return;
12775
12775
  }
12776
- const de = Ti(F);
12776
+ const de = Mi(F);
12777
12777
  de && Ln(de, w);
12778
12778
  }, 0);
12779
- }, ws = (p) => {
12779
+ }, _s = (p) => {
12780
12780
  const w = Xr(p);
12781
12781
  w && (Dn = Date.now(), xt !== null && (p.stopImmediatePropagation(), Dt = null, Pe !== null && (window.clearTimeout(Pe), Pe = null), Fe(), p.type === "focus" && w === T && Qr()));
12782
12782
  };
@@ -12786,18 +12786,18 @@ async function $m(t = {}) {
12786
12786
  !0
12787
12787
  ), v.defaultView?.addEventListener(
12788
12788
  "focus",
12789
- ws,
12789
+ _s,
12790
12790
  !0
12791
12791
  ), v.defaultView?.addEventListener(
12792
12792
  "focusin",
12793
- ws,
12793
+ _s,
12794
12794
  !0
12795
12795
  ), l.addEventListener("pointerdown", (p) => {
12796
- bs(p.target) && p.stopPropagation();
12796
+ ws(p.target) && p.stopPropagation();
12797
12797
  }), l.addEventListener("focusin", (p) => {
12798
- bs(p.target) && (p.stopPropagation(), Dn = Date.now(), Dt = null, Pe !== null && (window.clearTimeout(Pe), Pe = null), Fe());
12798
+ ws(p.target) && (p.stopPropagation(), Dn = Date.now(), Dt = null, Pe !== null && (window.clearTimeout(Pe), Pe = null), Fe());
12799
12799
  }), l.addEventListener("focusout", (p) => {
12800
- if (!bs(p.target) || xt !== null)
12800
+ if (!ws(p.target) || xt !== null)
12801
12801
  return;
12802
12802
  const w = Dn;
12803
12803
  if (Dn = null, w === null || Date.now() - w > hc)
@@ -12805,16 +12805,16 @@ async function $m(t = {}) {
12805
12805
  const A = p.target, R = Dt !== null && Date.now() - Dt <= hc;
12806
12806
  Dt = null, Pe !== null && (window.clearTimeout(Pe), Pe = null);
12807
12807
  const F = (de) => {
12808
- const ke = Ti(de);
12808
+ const ke = Mi(de);
12809
12809
  if (!ke)
12810
12810
  return !1;
12811
12811
  if (R)
12812
12812
  return Ln(ke, A), !0;
12813
12813
  const Re = Date.now();
12814
- return ys !== null && Re - ys <= xm ? (Ln(ke, A), !0) : (ys = Re, !0);
12814
+ return bs !== null && Re - bs <= xm ? (Ln(ke, A), !0) : (bs = Re, !0);
12815
12815
  };
12816
12816
  F(p.relatedTarget) || window.setTimeout(() => {
12817
- xt === null && A.isConnected && F(Mi());
12817
+ xt === null && A.isConnected && F(Pi());
12818
12818
  }, 0);
12819
12819
  }), I.addEventListener("keydown", (p) => {
12820
12820
  !l.classList.contains("pluno-pa-widget--minimized") || p.key !== "Enter" && p.key !== " " || (p.preventDefault(), St("", !0, !0, "minimized_launcher"));
@@ -12823,53 +12823,53 @@ async function $m(t = {}) {
12823
12823
  }), G?.addEventListener("click", (p) => {
12824
12824
  p.preventDefault(), p.stopPropagation(), qn("minimized", !0, "minimize_button");
12825
12825
  }), U.addEventListener("click", () => Yr("close_button")), x.addEventListener("wheel", (p) => {
12826
- gs(p.deltaY < 0 ? "up" : null);
12826
+ fs(p.deltaY < 0 ? "up" : null);
12827
12827
  }), x.addEventListener("pointerdown", (p) => {
12828
12828
  Qt = p.target === x ? p.clientY : null;
12829
12829
  }), x.addEventListener("pointermove", (p) => {
12830
- Qt !== null && p.clientY < Qt - 1 && gs("up"), Qt !== null && (Qt = p.clientY);
12830
+ Qt !== null && p.clientY < Qt - 1 && fs("up"), Qt !== null && (Qt = p.clientY);
12831
12831
  }), x.addEventListener("pointerup", () => {
12832
12832
  Qt = null;
12833
12833
  }), x.addEventListener("pointercancel", () => {
12834
12834
  Qt = null;
12835
12835
  }), x.addEventListener("touchstart", (p) => {
12836
- ps = p.touches[0]?.clientY ?? null;
12836
+ hs = p.touches[0]?.clientY ?? null;
12837
12837
  }), x.addEventListener("touchmove", (p) => {
12838
12838
  const w = p.touches[0]?.clientY ?? null;
12839
- w !== null && ps !== null && gs(w > ps ? "up" : null), ps = w;
12839
+ w !== null && hs !== null && fs(w > hs ? "up" : null), hs = w;
12840
12840
  }), x.addEventListener("keydown", (p) => {
12841
- (p.key === "ArrowUp" || p.key === "PageUp" || p.key === "Home") && gs("up");
12841
+ (p.key === "ArrowUp" || p.key === "PageUp" || p.key === "Home") && fs("up");
12842
12842
  }), x.addEventListener("scroll", () => {
12843
- x.scrollTop < Ot - 1 && Ii === "up" && (Tn = !0, tt(!1, "userScroll")), Ot = x.scrollTop, ki();
12843
+ x.scrollTop < Ot - 1 && Si === "up" && (Tn = !0, tt(!1, "userScroll")), Ot = x.scrollTop, Ei();
12844
12844
  }), oe.addEventListener("click", () => {
12845
12845
  vd();
12846
12846
  });
12847
12847
  const ea = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
12848
12848
  ([p]) => {
12849
- p?.isIntersecting && ki();
12849
+ p?.isIntersecting && Ei();
12850
12850
  },
12851
12851
  { root: x, threshold: 0 }
12852
12852
  );
12853
12853
  ea?.observe(C);
12854
- const ta = typeof ResizeObserver > "u" ? null : new ResizeObserver(ki);
12854
+ const ta = typeof ResizeObserver > "u" ? null : new ResizeObserver(Ei);
12855
12855
  ta?.observe(x);
12856
12856
  const na = l.querySelector(".pluno-pa-widget__permission-overlay"), sa = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
12857
12857
  const p = na.offsetHeight;
12858
12858
  x.style.paddingBottom = `${p > 0 ? p + 24 : 12}px`, oe.style.bottom = `${p > 0 ? p + 18 : 12}px`, vt.enabled && vn(x, () => vt.enabled);
12859
12859
  });
12860
12860
  sa?.observe(na);
12861
- let xt = null, Nn = !1, _s = M.getState().status === "connected";
12862
- const vs = () => {
12861
+ let xt = null, Nn = !1, vs = M.getState().status === "connected";
12862
+ const Is = () => {
12863
12863
  const p = M.getState().status;
12864
- return !_s && M.getState().lastErrorCode !== "connection_failed" && (p === "idle" || p === "connecting" || p === "reconnecting");
12864
+ return !vs && M.getState().lastErrorCode !== "connection_failed" && (p === "idle" || p === "connecting" || p === "reconnecting");
12865
12865
  }, Td = () => M.getState().status !== "connected", en = () => Td(), Md = () => {
12866
12866
  const p = M.getState().status;
12867
- return vs() ? !1 : p !== "connected" && !(_s && p === "reconnecting");
12867
+ return Is() ? !1 : p !== "connected" && !(vs && p === "reconnecting");
12868
12868
  }, mn = () => {
12869
12869
  const p = s(), w = M.getState(), A = !w.isThinking && !w.pendingMessageStatus && !!w.lastError;
12870
12870
  T.readOnly = !1, N.readOnly = !1, T.placeholder = p ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : A ? "Needs attention" : Nn ? "New update" : e.launcherLabel, N.placeholder = p ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : At.launcherLabel, S.hidden = p;
12871
12871
  }, ia = () => [...ne.values()].some((p) => p.revision === ge && p.generation === W), yn = () => !M.getState().isLoadingSession && !Md() && !Qn(e.billingStatus) && !ia(), oa = () => {
12872
- const p = M.getState(), w = !vs() && [...ne.values()].some((A) => A.revision === ge && A.generation === W);
12872
+ const p = M.getState(), w = !Is() && [...ne.values()].some((A) => A.revision === ge && A.generation === W);
12873
12873
  return Wp({
12874
12874
  hasRunningAssistantTurn: w || p.isThinking || p.turnPhase !== null || p.pendingMessageStatus !== null,
12875
12875
  // Retained text already submitted by this revision must not hide Stop behind a disabled Send.
@@ -12884,15 +12884,15 @@ async function $m(t = {}) {
12884
12884
  }), xe.disabled = s() || en() || Qn(e.billingStatus);
12885
12885
  };
12886
12886
  mn();
12887
- const qi = () => {
12887
+ const Oi = () => {
12888
12888
  const p = M.getState(), w = p.isThinking, A = p.turnPhase !== null, R = p.turnPhase === "sending", F = O?.lastElementChild;
12889
12889
  F && (F.textContent = "Working..."), l.classList.toggle("pluno-pa-widget--thinking", w), l.classList.toggle("pluno-pa-widget--sending", R), l.classList.toggle(
12890
12890
  "pluno-pa-widget--unread",
12891
12891
  !A && (Nn || !!p.lastError)
12892
12892
  ), mn();
12893
12893
  };
12894
- qi();
12895
- const Oi = () => {
12894
+ Oi();
12895
+ const Di = () => {
12896
12896
  if (!(s() || Ke))
12897
12897
  return mn(), Ce(), M.connect().then(
12898
12898
  () => {
@@ -12908,11 +12908,11 @@ async function $m(t = {}) {
12908
12908
  ));
12909
12909
  }
12910
12910
  );
12911
- }, Is = (p) => {
12911
+ }, Ss = (p) => {
12912
12912
  L !== null && window.clearTimeout(L), D.textContent = p, D.hidden = !1, L = window.setTimeout(() => {
12913
12913
  D.textContent = "", D.hidden = !0, L = null;
12914
12914
  }, 3e3);
12915
- }, Di = (p, w) => {
12915
+ }, Li = (p, w) => {
12916
12916
  const A = ne.get(p);
12917
12917
  if (!A || w !== void 0 && A.submittedAt !== w || (ne.delete(p), A.generation !== W || A.revision !== ge)) return;
12918
12918
  const R = new Set(A.attachments);
@@ -12929,12 +12929,12 @@ async function $m(t = {}) {
12929
12929
  p.submittedAt,
12930
12930
  p.requestedModel
12931
12931
  ).then((A) => {
12932
- w === W && (M.getState().receipts === void 0 && Di(p.clientMessageId), me?.clientMessageId === p.clientMessageId && (me.pendingSubmission = !1, A && (me.clientMessageId = A), Hr()));
12932
+ w === W && (M.getState().receipts === void 0 && Li(p.clientMessageId), me?.clientMessageId === p.clientMessageId && (me.pendingSubmission = !1, A && (me.clientMessageId = A), Hr()));
12933
12933
  }).catch((A) => {
12934
12934
  if (w !== W) return;
12935
12935
  me?.clientMessageId === p.clientMessageId && (me = null), ne.delete(p.clientMessageId), ct();
12936
12936
  const R = A instanceof Error ? A.message : "Failed to upload attachment";
12937
- M.getState().lastError !== R && Is(R);
12937
+ M.getState().lastError !== R && Ss(R);
12938
12938
  }).finally(() => {
12939
12939
  w === W && Ce();
12940
12940
  });
@@ -12943,7 +12943,7 @@ async function $m(t = {}) {
12943
12943
  return;
12944
12944
  const p = se;
12945
12945
  se = null, ra(p);
12946
- }, Li = () => {
12946
+ }, Ni = () => {
12947
12947
  const p = N.value, w = p.trim(), A = [...j];
12948
12948
  if (se !== null || ia() || !yn() || !w && A.length === 0)
12949
12949
  return;
@@ -12964,7 +12964,7 @@ async function $m(t = {}) {
12964
12964
  observedConversation: null,
12965
12965
  observedWelcome: null,
12966
12966
  pendingSubmission: !0
12967
- }, vs() && !e.runtimeClient) {
12967
+ }, Is() && !e.runtimeClient) {
12968
12968
  se = R;
12969
12969
  return;
12970
12970
  }
@@ -12979,14 +12979,14 @@ async function $m(t = {}) {
12979
12979
  e.onSignupClick?.();
12980
12980
  return;
12981
12981
  }
12982
- yn() && (qt = !0, tt(!0, "send"), dt(), Li());
12982
+ yn() && (qt = !0, tt(!0, "send"), dt(), Ni());
12983
12983
  });
12984
12984
  let Un = 0;
12985
12985
  const Lt = () => {
12986
12986
  Un = 0, l.classList.remove("pluno-pa-widget--drag-over");
12987
12987
  }, Pd = () => {
12988
12988
  L !== null && (window.clearTimeout(L), L = null), D.textContent = "", D.hidden = !0;
12989
- }, Ni = async (p) => {
12989
+ }, Ui = async (p) => {
12990
12990
  if (!e.attachmentsEnabled || p.length === 0 || en())
12991
12991
  return;
12992
12992
  const w = Ry(
@@ -13000,26 +13000,26 @@ async function $m(t = {}) {
13000
13000
  }
13001
13001
  ae("attachment_added");
13002
13002
  }, qd = async (p) => {
13003
- await Ni(p), !(p.length === 0 || xt !== null) && ie(N, "attachment_picker_completed");
13003
+ await Ui(p), !(p.length === 0 || xt !== null) && ie(N, "attachment_picker_completed");
13004
13004
  };
13005
13005
  xe.addEventListener("click", () => {
13006
13006
  e.loginRequired || en() || Qn(e.billingStatus) || he.click();
13007
13007
  }), he.addEventListener("change", () => {
13008
13008
  const p = Array.from(he.files ?? []);
13009
13009
  he.value = "", qd(p).catch((w) => {
13010
- Is(
13010
+ Ss(
13011
13011
  w instanceof Error ? w.message : "Failed to attach file"
13012
13012
  ), pt("web-sdk.widget", "Attachment failed", {
13013
13013
  ...Xn(w)
13014
13014
  });
13015
13015
  });
13016
13016
  }), l.addEventListener("dragenter", (p) => {
13017
- !e.attachmentsEnabled || !Os(p.dataTransfer) || e.loginRequired || en() || (p.preventDefault(), p.stopPropagation(), Un += 1, l.classList.add("pluno-pa-widget--drag-over"));
13017
+ !e.attachmentsEnabled || !Ds(p.dataTransfer) || e.loginRequired || en() || (p.preventDefault(), p.stopPropagation(), Un += 1, l.classList.add("pluno-pa-widget--drag-over"));
13018
13018
  }), l.addEventListener("dragover", (p) => {
13019
13019
  const w = p.dataTransfer;
13020
- !e.attachmentsEnabled || !Os(w) || e.loginRequired || en() || (p.preventDefault(), p.stopPropagation(), w.dropEffect = "copy");
13020
+ !e.attachmentsEnabled || !Ds(w) || e.loginRequired || en() || (p.preventDefault(), p.stopPropagation(), w.dropEffect = "copy");
13021
13021
  }), l.addEventListener("dragleave", (p) => {
13022
- Os(p.dataTransfer) && (p.stopPropagation(), Un = Math.max(0, Un - 1), Un === 0 && l.classList.remove("pluno-pa-widget--drag-over"));
13022
+ Ds(p.dataTransfer) && (p.stopPropagation(), Un = Math.max(0, Un - 1), Un === 0 && l.classList.remove("pluno-pa-widget--drag-over"));
13023
13023
  });
13024
13024
  const ca = (p) => {
13025
13025
  l.classList.contains("pluno-pa-widget--drag-over") && !p.composedPath().includes(l) && Lt();
@@ -13030,8 +13030,8 @@ async function $m(t = {}) {
13030
13030
  !0
13031
13031
  ), v.addEventListener("drop", Lt, !0), v.addEventListener("dragend", Lt, !0), v.defaultView?.addEventListener("blur", Lt), l.addEventListener("drop", (p) => {
13032
13032
  const w = p.dataTransfer;
13033
- !e.attachmentsEnabled || !Os(w) || e.loginRequired || en() || (p.preventDefault(), p.stopPropagation(), Lt(), Ni(w.files).catch((A) => {
13034
- Is(
13033
+ !e.attachmentsEnabled || !Ds(w) || e.loginRequired || en() || (p.preventDefault(), p.stopPropagation(), Lt(), Ui(w.files).catch((A) => {
13034
+ Ss(
13035
13035
  A instanceof Error ? A.message : "Failed to attach file"
13036
13036
  ), pt("web-sdk.widget", "Attachment failed", {
13037
13037
  ...Xn(A)
@@ -13040,8 +13040,8 @@ async function $m(t = {}) {
13040
13040
  }), l.addEventListener("paste", (p) => {
13041
13041
  p.stopPropagation();
13042
13042
  const w = p.clipboardData, A = Array.from(w?.files ?? []);
13043
- !e.attachmentsEnabled || A.length === 0 || e.loginRequired || en() || (p.preventDefault(), Ni(A).catch((R) => {
13044
- Is(
13043
+ !e.attachmentsEnabled || A.length === 0 || e.loginRequired || en() || (p.preventDefault(), Ui(A).catch((R) => {
13044
+ Ss(
13045
13045
  R instanceof Error ? R.message : "Failed to attach file"
13046
13046
  ), pt("web-sdk.widget", "Attachment failed", {
13047
13047
  ...Xn(R)
@@ -13060,9 +13060,9 @@ async function $m(t = {}) {
13060
13060
  return;
13061
13061
  }
13062
13062
  const w = N.value.trim().length > 0 || j.length > 0;
13063
- qt = !0, tt(!0, "send"), dt(), Li(), Ae(M.getState()), Ce(), w && ae("send_button_submit");
13063
+ qt = !0, tt(!0, "send"), dt(), Ni(), Ae(M.getState()), Ce(), w && ae("send_button_submit");
13064
13064
  }), be.addEventListener("click", () => {
13065
- Ue = !Ue, It(), Ue && (je.data === null || je.status === "error") && je.status !== "loading" && Ci(), Ue || ae("history_closed");
13065
+ Ue = !Ue, It(), Ue && (je.data === null || je.status === "error") && je.status !== "loading" && Ai(), Ue || ae("history_closed");
13066
13066
  }), Ze.addEventListener("click", () => {
13067
13067
  Ue = !1, It(), ae("history_closed");
13068
13068
  }), Ee.addEventListener("scroll", Id), N.addEventListener("input", () => {
@@ -13073,7 +13073,7 @@ async function $m(t = {}) {
13073
13073
  e.onLoginClick?.();
13074
13074
  return;
13075
13075
  }
13076
- yn() && (qt = !0, tt(!0, "send"), dt(), Li(), Ae(M.getState()), Ce());
13076
+ yn() && (qt = !0, tt(!0, "send"), dt(), Ni(), Ae(M.getState()), Ce());
13077
13077
  }
13078
13078
  }), l.addEventListener("click", (p) => {
13079
13079
  const w = p.target instanceof Element ? p.target : null;
@@ -13133,45 +13133,45 @@ async function $m(t = {}) {
13133
13133
  p.key !== "Escape" || !Ue || (Ue = !1, It(), ae("history_escape"));
13134
13134
  }), d.composerValue && (N.value = d.composerValue, Yn(N)), e.layout === "page" ? St(N.value, !1, !0, "external_request") : h === "minimized" ? qn("minimized", !1) : e.initialDisplayState === void 0 && d.isOpen && St(N.value, !1, !1, "restored_state");
13135
13135
  const zn = () => u;
13136
- let Ui = M.getState().appearance !== null, zi = M.getInteractions();
13136
+ let zi = M.getState().appearance !== null, Bi = M.getInteractions();
13137
13137
  const Od = (p, w, A) => p ? M.actOnInteraction(
13138
13138
  p.id,
13139
13139
  w,
13140
13140
  p.revision,
13141
13141
  { ...A, expectedSourceVersion: p.sourceVersion, ...w === "run" ? { requestedModel: fn } : {} }
13142
13142
  ) : Promise.resolve();
13143
- let Bi = M.getState().isThinking;
13144
- const Bn = /* @__PURE__ */ new Map(), Ss = /* @__PURE__ */ new Map(), xs = /* @__PURE__ */ new Map(), ks = /* @__PURE__ */ new Map(), Dd = async (p, w, A) => {
13145
- const R = ks.get(p) ?? /* @__PURE__ */ new Set();
13143
+ let ji = M.getState().isThinking;
13144
+ const Bn = /* @__PURE__ */ new Map(), xs = /* @__PURE__ */ new Map(), ks = /* @__PURE__ */ new Map(), Es = /* @__PURE__ */ new Map(), Dd = async (p, w, A) => {
13145
+ const R = Es.get(p) ?? /* @__PURE__ */ new Set();
13146
13146
  if (!R.has(w)) {
13147
- ks.set(p, R), R.add(w), Ae(M.getState());
13147
+ Es.set(p, R), R.add(w), Ae(M.getState());
13148
13148
  try {
13149
13149
  await A();
13150
13150
  } finally {
13151
- R.delete(w), R.size || ks.delete(p), Ke || Ae(M.getState());
13151
+ R.delete(w), R.size || Es.delete(p), Ke || Ae(M.getState());
13152
13152
  }
13153
13153
  }
13154
13154
  };
13155
13155
  let bn = null;
13156
- const ji = (p = {}) => {
13157
- W++, ne.clear(), X(), se = null, me = null, Tn = !1, hs.clear(), qt = !0, tt(!0, "newSession"), dt(), Ue = !1, It();
13156
+ const Fi = (p = {}) => {
13157
+ W++, ne.clear(), X(), se = null, me = null, Tn = !1, gs.clear(), qt = !0, tt(!0, "newSession"), dt(), Ue = !1, It();
13158
13158
  const w = Promise.resolve(M.startNewSession(p));
13159
- return vi.clear(), N.value = "", j = [], ct(), Yn(N), Fe(), Ce(), ie(N, "new_chat"), Ae(M.getState()), w;
13159
+ return Ii.clear(), N.value = "", j = [], ct(), Yn(N), Fe(), Ce(), ie(N, "new_chat"), Ae(M.getState()), w;
13160
13160
  }, jn = (p) => {
13161
13161
  if (s() || !p || e.layout === "page") {
13162
13162
  bn?.remove(), bn = null;
13163
13163
  return;
13164
13164
  }
13165
- bn || (bn = yi(
13165
+ bn || (bn = bi(
13166
13166
  "pluno-pa-widget__new-chat",
13167
13167
  "New chat",
13168
13168
  by(),
13169
13169
  !1
13170
- ), bn.addEventListener("click", () => ji()), Ne.insertBefore(bn, be));
13170
+ ), bn.addEventListener("click", () => Fi()), Ne.insertBefore(bn, be));
13171
13171
  }, kt = document.createElement("div");
13172
13172
  kt.className = "pluno-pa-widget__error";
13173
- const Fi = document.createTextNode("");
13174
- kt.appendChild(Fi);
13173
+ const $i = document.createTextNode("");
13174
+ kt.appendChild($i);
13175
13175
  const Nt = document.createElement("a");
13176
13176
  Nt.className = "pluno-pa-widget__error-retry", Nt.target = "_blank", Nt.rel = "noreferrer", Nt.textContent = "Security settings";
13177
13177
  const ut = document.createElement("button");
@@ -13185,7 +13185,7 @@ async function $m(t = {}) {
13185
13185
  let p;
13186
13186
  try {
13187
13187
  await Promise.race([
13188
- Oi(),
13188
+ Di(),
13189
13189
  new Promise((w) => {
13190
13190
  p = setTimeout(w, 9e4);
13191
13191
  })
@@ -13197,7 +13197,7 @@ async function $m(t = {}) {
13197
13197
  ut.addEventListener("click", () => {
13198
13198
  Ld();
13199
13199
  });
13200
- let tn = !1, Fn = null, Es = 0, $i = 0;
13200
+ let tn = !1, Fn = null, Cs = 0, Hi = 0;
13201
13201
  const Ae = (p, w = {}) => {
13202
13202
  zr(p) && (me = null), Ur = w.renderSource ?? "local";
13203
13203
  const A = n();
@@ -13223,12 +13223,12 @@ async function $m(t = {}) {
13223
13223
  Ut
13224
13224
  ]);
13225
13225
  if (ga !== R) {
13226
- ga = R, ce.hidden = s() || !p.lastError || os(p.lastErrorCode) !== "bottom_notice";
13226
+ ga = R, ce.hidden = s() || !p.lastError || rs(p.lastErrorCode) !== "bottom_notice";
13227
13227
  const ue = ce.hidden ? "" : p.lastError ?? "";
13228
- Fi.data !== ue && (Fi.data = ue), ce.hidden ? kt.remove() : kt.parentElement !== ce && ce.appendChild(kt), p.lastErrorSecuritySettingsUrl ? (Nt.href = p.lastErrorSecuritySettingsUrl, Nt.parentElement !== kt && kt.insertBefore(Nt, ut.parentElement ? ut : null)) : Nt.remove(), p.lastErrorCode === "connection_failed" || p.lastErrorCode === "auth_reconnecting" || p.lastErrorCode === "submission_checkpoint_pending" ? (ut.disabled = Ut, ut.setAttribute("aria-busy", String(Ut)), pa.hidden = !Ut, ha.data = Ut ? "Trying" : "Try again", ut.parentElement !== kt && kt.appendChild(ut)) : ut.remove();
13228
+ $i.data !== ue && ($i.data = ue), ce.hidden ? kt.remove() : kt.parentElement !== ce && ce.appendChild(kt), p.lastErrorSecuritySettingsUrl ? (Nt.href = p.lastErrorSecuritySettingsUrl, Nt.parentElement !== kt && kt.insertBefore(Nt, ut.parentElement ? ut : null)) : Nt.remove(), p.lastErrorCode === "connection_failed" || p.lastErrorCode === "auth_reconnecting" || p.lastErrorCode === "submission_checkpoint_pending" ? (ut.disabled = Ut, ut.setAttribute("aria-busy", String(Ut)), pa.hidden = !Ut, ha.data = Ut ? "Trying" : "Try again", ut.parentElement !== kt && kt.appendChild(ut)) : ut.remove();
13229
13229
  }
13230
13230
  if (A) {
13231
- Mn = "", Bn.clear(), Ss.clear(), xs.clear(), x.replaceChildren(), Ds(
13231
+ Mn = "", Bn.clear(), xs.clear(), ks.clear(), x.replaceChildren(), Ls(
13232
13232
  J,
13233
13233
  _e,
13234
13234
  jn,
@@ -13242,10 +13242,10 @@ async function $m(t = {}) {
13242
13242
  return;
13243
13243
  }
13244
13244
  if (e.loginRequired) {
13245
- Mn = "", Bn.clear(), Ss.clear(), xs.clear(), x.replaceChildren();
13245
+ Mn = "", Bn.clear(), xs.clear(), ks.clear(), x.replaceChildren();
13246
13246
  const ue = e.billingStatus?.auth, Et = e.extensionRuntime?.retryAuth;
13247
13247
  if (ue?.status === "error" && (ue.errorCode === "browser_session_unavailable" || ue.errorCode === "backend_auth_pending") && Et) {
13248
- Ds(
13248
+ Ls(
13249
13249
  J,
13250
13250
  _e,
13251
13251
  jn,
@@ -13259,16 +13259,16 @@ async function $m(t = {}) {
13259
13259
  );
13260
13260
  const qe = J.querySelector(".pluno-pa-widget__login");
13261
13261
  qe.disabled = tn, qe.setAttribute("aria-busy", String(tn)), tn && qe.prepend(xn()), qe.addEventListener("click", () => {
13262
- const $n = ++Es, $d = $i;
13262
+ const $n = ++Cs, $d = Hi;
13263
13263
  tn = !0, Fn = null, Ae(M.getState()), Et().catch((ma) => {
13264
- $n !== Es || $d !== $i || (Fn = ma instanceof Error ? ma.message : "Close and reopen Pluno to try again.");
13264
+ $n !== Cs || $d !== Hi || (Fn = ma instanceof Error ? ma.message : "Close and reopen Pluno to try again.");
13265
13265
  }).finally(() => {
13266
- $n === Es && (tn = !1, Ke || Ae(M.getState()));
13266
+ $n === Cs && (tn = !1, Ke || Ae(M.getState()));
13267
13267
  });
13268
13268
  });
13269
13269
  return;
13270
13270
  }
13271
- J.classList.add("pluno-pa-widget__access-notice--login-only"), Ds(
13271
+ J.classList.add("pluno-pa-widget__access-notice--login-only"), Ls(
13272
13272
  J,
13273
13273
  _e,
13274
13274
  jn,
@@ -13282,7 +13282,7 @@ async function $m(t = {}) {
13282
13282
  return;
13283
13283
  }
13284
13284
  if (e.signupRequired) {
13285
- Mn = "", Bn.clear(), Ss.clear(), xs.clear(), x.replaceChildren(), Ds(
13285
+ Mn = "", Bn.clear(), xs.clear(), ks.clear(), x.replaceChildren(), Ls(
13286
13286
  J,
13287
13287
  _e,
13288
13288
  jn,
@@ -13297,10 +13297,10 @@ async function $m(t = {}) {
13297
13297
  }
13298
13298
  const F = JSON.stringify([
13299
13299
  ry(p),
13300
- zi,
13300
+ Bi,
13301
13301
  p.status,
13302
13302
  p.user,
13303
- vs()
13303
+ Is()
13304
13304
  ]), de = F !== Mn;
13305
13305
  Mn = F;
13306
13306
  const ke = qt || vt.enabled;
@@ -13312,10 +13312,10 @@ async function $m(t = {}) {
13312
13312
  p,
13313
13313
  ke,
13314
13314
  () => vt.enabled,
13315
- vi,
13315
+ Ii,
13316
13316
  Bn,
13317
- Ss,
13318
13317
  xs,
13318
+ ks,
13319
13319
  Fe,
13320
13320
  zn,
13321
13321
  (ue, Et) => {
@@ -13323,14 +13323,14 @@ async function $m(t = {}) {
13323
13323
  },
13324
13324
  (ue) => (qt = !0, tt(!0, "send"), dt(), M.retryLastMessage(ue)),
13325
13325
  () => p.sessionId ? M.loadSession(p.sessionId) : void 0,
13326
- () => ji(),
13327
- ks.get(p.selectionKey ?? p.sessionId ?? "draft"),
13326
+ () => Fi(),
13327
+ Es.get(p.selectionKey ?? p.sessionId ?? "draft"),
13328
13328
  (ue, Et) => {
13329
13329
  Dd(p.selectionKey ?? p.sessionId ?? "draft", ue, Et);
13330
13330
  },
13331
13331
  e.attachmentPreviewUrlResolver,
13332
13332
  {
13333
- cards: zi.filter((ue) => ue.placement === "turn"),
13333
+ cards: Bi.filter((ue) => ue.placement === "turn"),
13334
13334
  act: (ue, Et, qe) => {
13335
13335
  Od(ue, Et, { sharePlatform: qe }).catch(() => {
13336
13336
  });
@@ -13350,31 +13350,31 @@ async function $m(t = {}) {
13350
13350
  fa
13351
13351
  );
13352
13352
  const Nd = M.subscribeInteractions((p) => {
13353
- zi = p, Ke || Ae(M.getState(), { skipUnchangedTimeline: !0, renderSource: "interactions" });
13353
+ Bi = p, Ke || Ae(M.getState(), { skipUnchangedTimeline: !0, renderSource: "interactions" });
13354
13354
  }), Ud = M.subscribeAccount((p) => {
13355
- if (!p && !_s) return;
13355
+ if (!p && !vs) return;
13356
13356
  const w = p?.auth, A = w?.workspace?.id;
13357
- A && (_i !== null && _i !== A && (fn = wi), _i = A), (w?.status !== "error" || w.errorCode !== "browser_session_unavailable" && w.errorCode !== "backend_auth_pending") && (Es += 1, Fn = null, tn = !1);
13357
+ A && (vi !== null && vi !== A && (fn = _i), vi = A), (w?.status !== "error" || w.errorCode !== "browser_session_unavailable" && w.errorCode !== "backend_auth_pending") && (Cs += 1, Fn = null, tn = !1);
13358
13358
  const R = s();
13359
- e.billingStatus = p, i(p), mn(), Ae(M.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), re(), Ce(), queueMicrotask(aa), R && !s() && Oi();
13359
+ e.billingStatus = p, i(p), mn(), Ae(M.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), re(), Ce(), queueMicrotask(aa), R && !s() && Di();
13360
13360
  });
13361
13361
  M.on("state", (p) => {
13362
13362
  const w = p.user?.id ?? null;
13363
- Jt !== null && Jt !== w && (fn = wi), (An !== null && An !== p.sessionId || Jt !== null && Jt !== w || Rn !== void 0 && Rn !== p.selectionKey) && (W++, ne.clear(), me = null), Rn = p.selectionKey, An = p.sessionId, Jt = w;
13363
+ Jt !== null && Jt !== w && (fn = _i), (An !== null && An !== p.sessionId || Jt !== null && Jt !== w || Rn !== void 0 && Rn !== p.selectionKey) && (W++, ne.clear(), me = null), Rn = p.selectionKey, An = p.sessionId, Jt = w;
13364
13364
  for (const Re of p.messages)
13365
- Re.role === "user" && Di(Re.id);
13366
- for (const Re of p.receipts ?? []) Di(Re.userMessageId, Re.acceptedRendererRevision);
13367
- e.extensionRuntime && ($i += 1, Fn = null), p.status === "connected" && (_s = !0, se && queueMicrotask(() => {
13365
+ Re.role === "user" && Li(Re.id);
13366
+ for (const Re of p.receipts ?? []) Li(Re.userMessageId, Re.acceptedRendererRevision);
13367
+ e.extensionRuntime && (Hi += 1, Fn = null), p.status === "connected" && (vs = !0, se && queueMicrotask(() => {
13368
13368
  aa();
13369
13369
  }));
13370
- const A = Bi && !p.isThinking, R = jr !== location.origin || Fr !== p.sessionId || $r !== (p.user?.id ?? null), F = Bi !== p.isThinking, de = Si !== "connected" && p.status === "connected", ke = Si === "connected" && p.status !== "connected";
13371
- jr = location.origin, Fr = p.sessionId, $r = p.user?.id ?? null, Si = p.status, Bi = p.isThinking, ke && et !== null && (window.clearTimeout(et), et = null), l.classList.contains("pluno-pa-widget--open") && p.status === "connected" && (R || F || de) && Ai(), A && !l.classList.contains("pluno-pa-widget--open") && (Nn = !0), qi(), p.appearance ? (Ui = !0, pt(
13370
+ const A = ji && !p.isThinking, R = jr !== location.origin || Fr !== p.sessionId || $r !== (p.user?.id ?? null), F = ji !== p.isThinking, de = xi !== "connected" && p.status === "connected", ke = xi === "connected" && p.status !== "connected";
13371
+ jr = location.origin, Fr = p.sessionId, $r = p.user?.id ?? null, xi = p.status, ji = p.isThinking, ke && et !== null && (window.clearTimeout(et), et = null), l.classList.contains("pluno-pa-widget--open") && p.status === "connected" && (R || F || de) && Ri(), A && !l.classList.contains("pluno-pa-widget--open") && (Nn = !0), Oi(), p.appearance ? (zi = !0, pt(
13372
13372
  "web-sdk.widget",
13373
13373
  "Agent state supplied appearance",
13374
13374
  {
13375
13375
  appearance: p.appearance
13376
13376
  }
13377
- ), Hi(p.appearance, "agent.state.appearance")) : Ui && (Ui = !1, pt(
13377
+ ), Ki(p.appearance, "agent.state.appearance")) : zi && (zi = !1, pt(
13378
13378
  "web-sdk.widget",
13379
13379
  "Agent state cleared appearance; reverting to configured widget options",
13380
13380
  {
@@ -13382,10 +13382,10 @@ async function $m(t = {}) {
13382
13382
  fallbackColorScheme: e.colorScheme,
13383
13383
  fallbackFontFamily: e.fontFamily
13384
13384
  }
13385
- ), Hi({}, "agent.state.appearance-cleared")), Ae(p, { skipUnchangedTimeline: !0, renderSource: "state" }), Ce();
13385
+ ), Ki({}, "agent.state.appearance-cleared")), Ae(p, { skipUnchangedTimeline: !0, renderSource: "state" }), Ce();
13386
13386
  });
13387
13387
  const zd = M.getState();
13388
- Ae(zd), Ce(), Oi();
13388
+ Ae(zd), Ce(), Di();
13389
13389
  const Bd = Ru(l, (p, w, A, R, F) => {
13390
13390
  const de = Iu(M.getState(), R);
13391
13391
  M.reportDisplayedError?.(p, w, A, de ?? void 0, F);
@@ -13394,14 +13394,14 @@ async function $m(t = {}) {
13394
13394
  l,
13395
13395
  e.extensionRuntime || e.entrySurface === "extension_widget" ? "extension_widget" : e.entrySurface === "main_web_chat" ? "main_web_chat" : "embedded_widget",
13396
13396
  M
13397
- ), Fd = Tu(l, Ei);
13397
+ ), Fd = Tu(l, Ci);
13398
13398
  return {
13399
13399
  agent: M,
13400
- startNewChat: ji,
13400
+ startNewChat: Fi,
13401
13401
  getSelectedModel: () => fn,
13402
13402
  host: a,
13403
13403
  updateAppearance: (p) => {
13404
- p.scribbleStyle !== void 0 && (e.scribbleStyle = p.scribbleStyle), Hi(p, "widgetHandle.updateAppearance");
13404
+ p.scribbleStyle !== void 0 && (e.scribbleStyle = p.scribbleStyle), Ki(p, "widgetHandle.updateAppearance");
13405
13405
  },
13406
13406
  openPanel: (p) => {
13407
13407
  const w = typeof p == "string" ? p : N.value, A = typeof p == "object" ? p.focusComposer !== !1 : !0, R = typeof p == "object" ? p.trigger ?? "external_request" : "external_request";
@@ -13432,11 +13432,11 @@ async function $m(t = {}) {
13432
13432
  !0
13433
13433
  ), v.defaultView?.removeEventListener(
13434
13434
  "focus",
13435
- ws,
13435
+ _s,
13436
13436
  !0
13437
13437
  ), v.defaultView?.removeEventListener(
13438
13438
  "focusin",
13439
- ws,
13439
+ _s,
13440
13440
  !0
13441
13441
  ), v.removeEventListener(
13442
13442
  "dragover",
@@ -13448,7 +13448,7 @@ async function $m(t = {}) {
13448
13448
  ), window.removeEventListener("resize", Vr), Gr(), kd(), Ed(), L !== null && window.clearTimeout(L), et !== null && (window.clearTimeout(et), et = null), wd(), Yt !== null && (window.clearTimeout(Yt), Yt = null), Gt && M.destroy(), ve?.release(), a.remove());
13449
13449
  }
13450
13450
  };
13451
- function Hi(p, w) {
13451
+ function Ki(p, w) {
13452
13452
  const A = p.accentColor ?? e.accentColor, R = p.colorScheme ?? e.colorScheme, F = p.fontFamily ?? e.fontFamily, de = p.scribbleStyle ?? e.scribbleStyle, ke = JSON.stringify([A, R, F, de]);
13453
13453
  ke !== b && (b = ke, u = yc(
13454
13454
  A,
@@ -13546,7 +13546,7 @@ function Vm({
13546
13546
  return;
13547
13547
  _.preventDefault();
13548
13548
  const v = _.clientX - a.x, I = _.clientY - a.y;
13549
- !l && Math.hypot(v, I) < oi || (l = !0, t.classList.add("pluno-pa-widget--dragging"), i({ x: c.x + v, y: c.y + I }));
13549
+ !l && Math.hypot(v, I) < ri || (l = !0, t.classList.add("pluno-pa-widget--dragging"), i({ x: c.x + v, y: c.y + I }));
13550
13550
  }, m = (_) => {
13551
13551
  r === _.pointerId && (_.preventDefault(), _.stopPropagation(), l && (u = { x: _.clientX, y: _.clientY }, o()), d());
13552
13552
  }, g = (_) => {
@@ -13557,7 +13557,7 @@ function Vm({
13557
13557
  const v = Math.hypot(
13558
13558
  _.clientX - u.x,
13559
13559
  _.clientY - u.y
13560
- ) <= oi;
13560
+ ) <= ri;
13561
13561
  u = null, v && (_.preventDefault(), _.stopPropagation());
13562
13562
  }, b = (_) => {
13563
13563
  if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
@@ -13587,7 +13587,7 @@ function Gm({
13587
13587
  return;
13588
13588
  g.preventDefault(), g.stopPropagation();
13589
13589
  const y = g.clientX - r.x, b = g.clientY - r.y;
13590
- !c && Math.hypot(y, b) < oi || (c = !0, t.classList.add("pluno-pa-widget--panel-dragging"), s({ x: a.x + y, y: a.y + b }));
13590
+ !c && Math.hypot(y, b) < ri || (c = !0, t.classList.add("pluno-pa-widget--panel-dragging"), s({ x: a.x + y, y: a.y + b }));
13591
13591
  }, h = (g) => {
13592
13592
  o === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), l());
13593
13593
  }, f = (g) => {
@@ -13619,7 +13619,7 @@ function Jm({
13619
13619
  return;
13620
13620
  y.preventDefault(), y.stopPropagation();
13621
13621
  const b = y.clientX - a.x, _ = y.clientY - a.y;
13622
- !l && Math.hypot(b, _) < oi || (l = !0, t.classList.add("pluno-pa-widget--resizing"), s(
13622
+ !l && Math.hypot(b, _) < ri || (l = !0, t.classList.add("pluno-pa-widget--resizing"), s(
13623
13623
  _c(c, r, b, _)
13624
13624
  ));
13625
13625
  }, f = (y) => {
@@ -13719,7 +13719,7 @@ function vc({
13719
13719
  }
13720
13720
  return { leading: t, length: e };
13721
13721
  }
13722
- function as(t, e = !0) {
13722
+ function cs(t, e = !0) {
13723
13723
  const n = Qe();
13724
13724
  if (t.classList.contains("pluno-pa-widget--minimized")) {
13725
13725
  const o = typeof window.matchMedia == "function" && window.matchMedia("(hover: none), (pointer: coarse)").matches ? Rm : Am;
@@ -13753,9 +13753,9 @@ function Ym() {
13753
13753
  };
13754
13754
  }
13755
13755
  function rn(t = null) {
13756
- return t ? mi(t) : Ym();
13756
+ return t ? yi(t) : Ym();
13757
13757
  }
13758
- function mi(t) {
13758
+ function yi(t) {
13759
13759
  const e = Qe();
13760
13760
  return {
13761
13761
  width: at(
@@ -13782,12 +13782,12 @@ function mi(t) {
13782
13782
  )
13783
13783
  };
13784
13784
  }
13785
- function wo(t, e) {
13785
+ function _o(t, e) {
13786
13786
  if (!e) {
13787
13787
  t.style.removeProperty("--pluno-pa-panel-width"), t.style.removeProperty("--pluno-pa-panel-height");
13788
13788
  return;
13789
13789
  }
13790
- const n = mi(e);
13790
+ const n = yi(e);
13791
13791
  t.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), t.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
13792
13792
  }
13793
13793
  function Qm(t, e, n) {
@@ -13803,11 +13803,11 @@ function Qm(t, e, n) {
13803
13803
  y: r.height - 24 - n.height
13804
13804
  };
13805
13805
  }
13806
- function _o(t, e, n) {
13807
- const s = as(t, !1);
13808
- return e ? Vs(
13806
+ function vo(t, e, n) {
13807
+ const s = cs(t, !1);
13808
+ return e ? Gs(
13809
13809
  t,
13810
- Gs(e, s),
13810
+ Js(e, s),
13811
13811
  s
13812
13812
  ) : Xm(n === "bottom-left" ? "bottom-left" : "bottom-right", s, Tm);
13813
13813
  }
@@ -13818,7 +13818,7 @@ function Xm(t, e, n) {
13818
13818
  y: t.startsWith("bottom") ? Math.max(0, s.height - e.height - n) : n
13819
13819
  };
13820
13820
  }
13821
- function Vs(t, e, n) {
13821
+ function Gs(t, e, n) {
13822
13822
  const s = Qe(), i = fe + ey(t);
13823
13823
  return {
13824
13824
  x: at(
@@ -13839,14 +13839,14 @@ function Vs(t, e, n) {
13839
13839
  )
13840
13840
  };
13841
13841
  }
13842
- function Gs(t, e) {
13842
+ function Js(t, e) {
13843
13843
  const n = Qe();
13844
13844
  return {
13845
13845
  x: t.anchor.endsWith("right") ? n.width - e.width - t.x : t.x,
13846
13846
  y: t.anchor.startsWith("bottom") ? n.height - e.height - t.y : t.y
13847
13847
  };
13848
13848
  }
13849
- function vo(t, e) {
13849
+ function Io(t, e) {
13850
13850
  const n = Zm(t, e), s = Qe();
13851
13851
  return {
13852
13852
  anchor: n,
@@ -13861,8 +13861,8 @@ function Zm(t, e) {
13861
13861
  function ey(t) {
13862
13862
  return t.classList.contains("pluno-pa-widget--scribble") ? zm : Um;
13863
13863
  }
13864
- function Io(t, e, n, s = null) {
13865
- const i = as(t), o = rn(s), r = {
13864
+ function So(t, e, n, s = null) {
13865
+ const i = cs(t), o = rn(s), r = {
13866
13866
  x: n === "bottom-left" ? e.x : e.x + i.width - o.width,
13867
13867
  y: e.y + i.height - o.height
13868
13868
  };
@@ -13917,7 +13917,7 @@ function Qe() {
13917
13917
  height: window.innerHeight || document.documentElement.clientHeight || Yl + fe * 2
13918
13918
  };
13919
13919
  }
13920
- function So(t) {
13920
+ function xo(t) {
13921
13921
  const e = t.getBoundingClientRect();
13922
13922
  return {
13923
13923
  x: Math.round(e.x),
@@ -13954,7 +13954,7 @@ async function iy(t, e, n, s, i, o, r) {
13954
13954
  attachments: n.length > 0 ? n.map(oy) : void 0
13955
13955
  });
13956
13956
  }
13957
- function xo(t) {
13957
+ function ko(t) {
13958
13958
  let e = t.activeElement;
13959
13959
  for (; e?.shadowRoot?.activeElement; )
13960
13960
  e = e.shadowRoot.activeElement;
@@ -14052,7 +14052,7 @@ function cy(t, e, n, s, i) {
14052
14052
  i
14053
14053
  )
14054
14054
  ), t.appendChild(
14055
- yi(
14055
+ bi(
14056
14056
  "pluno-pa-widget__close",
14057
14057
  "Close",
14058
14058
  yy(16),
@@ -14084,7 +14084,7 @@ function ly(t, e, n, s) {
14084
14084
  r.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(r);
14085
14085
  const a = document.createElement("input");
14086
14086
  a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = t, a.setAttribute("aria-label", t), i.appendChild(a);
14087
- const c = bi("Working...");
14087
+ const c = wi("Working...");
14088
14088
  if (c.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(c), s) {
14089
14089
  const l = document.createElement("button");
14090
14090
  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", i.appendChild(l);
@@ -14119,7 +14119,7 @@ function dy(t, e) {
14119
14119
  d.className = "pluno-pa-widget__connection-notice", d.hidden = !0, c.append(u, l, d), i.append(c, a);
14120
14120
  const h = document.createElement("div");
14121
14121
  return h.className = "pluno-pa-widget__top-actions", h.appendChild(
14122
- yi(
14122
+ bi(
14123
14123
  "pluno-pa-widget__history",
14124
14124
  lr(),
14125
14125
  wy(),
@@ -14188,7 +14188,7 @@ function py() {
14188
14188
  e.className = "pluno-pa-widget__history-header";
14189
14189
  const n = document.createElement("strong");
14190
14190
  n.textContent = lr();
14191
- const s = yi(
14191
+ const s = bi(
14192
14192
  "pluno-pa-widget__history-close",
14193
14193
  "Close recent chats",
14194
14194
  rd(),
@@ -14354,12 +14354,12 @@ function gy(t, e) {
14354
14354
  "flood-opacity": "0.22"
14355
14355
  });
14356
14356
  const g = K(o, "clipPath", { id: s.boltClip });
14357
- K(g, "path", { d: si });
14357
+ K(g, "path", { d: ii });
14358
14358
  const y = K(i, "g", {
14359
14359
  filter: it(s.softDropShadow)
14360
14360
  });
14361
14361
  K(y, "path", {
14362
- d: si,
14362
+ d: ii,
14363
14363
  fill: it(s.boltEdge)
14364
14364
  });
14365
14365
  const b = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
@@ -14426,7 +14426,7 @@ function fy(t, e) {
14426
14426
  clip: `${e}-scribbleBoltClip`,
14427
14427
  wobble: `${e}-scribbleBoltWobble`
14428
14428
  }, i = sd(), o = K(i, "defs"), r = K(o, "clipPath", { id: s.clip });
14429
- K(r, "path", { d: si });
14429
+ K(r, "path", { d: ii });
14430
14430
  const a = K(o, "filter", {
14431
14431
  id: s.wobble,
14432
14432
  x: "-10%",
@@ -14461,9 +14461,9 @@ function fy(t, e) {
14461
14461
  opacity: "0.9",
14462
14462
  transform: "rotate(-14 627 600)"
14463
14463
  }), K(c, "path", {
14464
- d: si,
14464
+ d: ii,
14465
14465
  fill: "none",
14466
- stroke: ii,
14466
+ stroke: oi,
14467
14467
  "stroke-width": "18",
14468
14468
  "stroke-linejoin": "round"
14469
14469
  }), Cc(
@@ -14522,14 +14522,14 @@ function Cc(t, e, n, s, i, o, r, a) {
14522
14522
  rx: "73",
14523
14523
  ry: "80",
14524
14524
  fill: "#ffffff",
14525
- stroke: ii,
14525
+ stroke: oi,
14526
14526
  "stroke-width": "13"
14527
14527
  }), K(c, "ellipse", {
14528
14528
  cx: i,
14529
14529
  cy: o,
14530
14530
  rx: "45",
14531
14531
  ry: "53",
14532
- fill: ii
14532
+ fill: oi
14533
14533
  }), K(c, "circle", {
14534
14534
  cx: r,
14535
14535
  cy: a,
@@ -14548,7 +14548,7 @@ function Te(t, e, n, s) {
14548
14548
  function it(t) {
14549
14549
  return `url(#${t})`;
14550
14550
  }
14551
- function yi(t, e, n, s) {
14551
+ function bi(t, e, n, s) {
14552
14552
  const i = document.createElement("button");
14553
14553
  return i.type = "button", i.className = t, i.setAttribute("aria-label", e), i.title = e, i.hidden = s, i.appendChild(n), i;
14554
14554
  }
@@ -14560,10 +14560,10 @@ function my() {
14560
14560
  width: "0",
14561
14561
  height: "0"
14562
14562
  }), e = te("defs");
14563
- return e.appendChild(Eo("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(
14564
- Eo("pluno-pa-scribble-wobble-2", "5", "15")
14563
+ return e.appendChild(Co("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(
14564
+ Co("pluno-pa-scribble-wobble-2", "5", "15")
14565
14565
  ), e.appendChild(
14566
- Eo("pluno-pa-scribble-wobble-3", "9", "19")
14566
+ Co("pluno-pa-scribble-wobble-3", "9", "19")
14567
14567
  ), t.appendChild(e), t;
14568
14568
  }
14569
14569
  function id(t, e) {
@@ -14575,7 +14575,7 @@ function id(t, e) {
14575
14575
  });
14576
14576
  return od(n, e), n;
14577
14577
  }
14578
- function ko(t, e) {
14578
+ function Eo(t, e) {
14579
14579
  if (!t)
14580
14580
  return;
14581
14581
  const n = Math.max(
@@ -14623,7 +14623,7 @@ function od(t, e) {
14623
14623
  ), t.appendChild(o);
14624
14624
  }
14625
14625
  }
14626
- function Eo(t, e, n) {
14626
+ function Co(t, e, n) {
14627
14627
  const s = te("filter", {
14628
14628
  id: t,
14629
14629
  x: "-8%",
@@ -14874,7 +14874,7 @@ function ky(t, e, n) {
14874
14874
  }
14875
14875
  }
14876
14876
  function Ey(t) {
14877
- const e = Pr(t), n = ri(t);
14877
+ const e = Pr(t), n = ai(t);
14878
14878
  if (e === "image" && n) {
14879
14879
  const s = document.createElement("img");
14880
14880
  return s.src = n, s.alt = "", s.setAttribute("aria-hidden", "true"), s.addEventListener(
@@ -14895,7 +14895,7 @@ function Ey(t) {
14895
14895
  return un(t);
14896
14896
  }
14897
14897
  function Cy(t, e) {
14898
- const n = Pr(t), s = ri(t);
14898
+ const n = Pr(t), s = ai(t);
14899
14899
  if (n === "image" && s) {
14900
14900
  const i = document.createElement("img");
14901
14901
  i.className = "pluno-pa-widget__message-attachment-preview", i.alt = t.name;
@@ -14922,7 +14922,7 @@ function Cy(t, e) {
14922
14922
  };
14923
14923
  let r = s;
14924
14924
  const a = () => {
14925
- const c = ri(o);
14925
+ const c = ai(o);
14926
14926
  if (c && c !== r) {
14927
14927
  r = c, i.src = c;
14928
14928
  return;
@@ -14942,7 +14942,7 @@ function Ay(t, e, n, s, i, o) {
14942
14942
  un(e(), "message")
14943
14943
  );
14944
14944
  }, l = () => {
14945
- const f = ri(e());
14945
+ const f = ai(e());
14946
14946
  if (f && f !== r) {
14947
14947
  r = f, t.addEventListener("error", l, {
14948
14948
  once: !0
@@ -14999,7 +14999,7 @@ function un(t, e = "composer") {
14999
14999
  function Pr(t) {
15000
15000
  return t.mimeType.startsWith("image/") ? "image" : t.mimeType === "application/pdf" ? "pdf" : t.mimeType.startsWith("video/") ? "video" : "file";
15001
15001
  }
15002
- function ri(t) {
15002
+ function ai(t) {
15003
15003
  return "previewUrl" in t && t.previewUrl ? t.previewUrl : t.fileUrl ?? "";
15004
15004
  }
15005
15005
  function Rc(t) {
@@ -15018,7 +15018,7 @@ function Ry(t, e, n) {
15018
15018
  function Ty(t) {
15019
15019
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(t) : void 0;
15020
15020
  }
15021
- function Os(t) {
15021
+ function Ds(t) {
15022
15022
  return !!(t && Array.from(t.types).includes("Files"));
15023
15023
  }
15024
15024
  function My(t, e, n = !1, s) {
@@ -15059,7 +15059,7 @@ function qy(t) {
15059
15059
  if (r.textContent = i ? "Complete onboarding to unlock credits and start using Pluno." : qr(t.pricingUrl) ? "Contact support to continue your product trial." : s ? "Earn bonus credits or upgrade to keep using Pluno on this product." : "Open billing to keep using Pluno.", e.appendChild(r), i) {
15060
15060
  const a = document.createElement("div");
15061
15061
  a.className = "pluno-pa-widget__billing-action-card-actions", a.appendChild(
15062
- Js("Complete onboarding", t.onboardingUrl ?? "")
15062
+ Ys("Complete onboarding", t.onboardingUrl ?? "")
15063
15063
  ), e.appendChild(a);
15064
15064
  } else
15065
15065
  e.appendChild(
@@ -15080,13 +15080,13 @@ function Qn(t) {
15080
15080
  }
15081
15081
  function Dy(t, e, n) {
15082
15082
  const s = document.createElement("div");
15083
- return s.className = n, qr(t.pricingUrl) ? (s.appendChild(Js("Contact support", t.pricingUrl)), s) : (s.appendChild(
15084
- Js(e, t.pricingUrl)
15083
+ return s.className = n, qr(t.pricingUrl) ? (s.appendChild(Ys("Contact support", t.pricingUrl)), s) : (s.appendChild(
15084
+ Ys(e, t.pricingUrl)
15085
15085
  ), s.appendChild(
15086
- Js("Earn credits", t.earnCreditsUrl)
15086
+ Ys("Earn credits", t.earnCreditsUrl)
15087
15087
  ), s);
15088
15088
  }
15089
- function Js(t, e) {
15089
+ function Ys(t, e) {
15090
15090
  const n = document.createElement("button");
15091
15091
  if (n.type = "button", t === "Earn credits") {
15092
15092
  const s = document.createElement("span");
@@ -15149,12 +15149,12 @@ function Ly(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, _, v, I) {
15149
15149
  const x = document.createElement("div");
15150
15150
  x.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--conversation", x.textContent = Wf, D(x);
15151
15151
  }
15152
- if (!i.lastError || os(i.lastErrorCode) === "bottom_notice") {
15152
+ if (!i.lastError || rs(i.lastErrorCode) === "bottom_notice") {
15153
15153
  D(e), bt(t, q);
15154
15154
  return;
15155
15155
  }
15156
15156
  }
15157
- if (O.length === 0 && !Z && !i.assistantDraft && (!i.lastError || os(i.lastErrorCode) === "bottom_notice") && !i.pendingMessageStatus && !i.isThinking) {
15157
+ if (O.length === 0 && !Z && !i.assistantDraft && (!i.lastError || rs(i.lastErrorCode) === "bottom_notice") && !i.pendingMessageStatus && !i.isThinking) {
15158
15158
  const x = JSON.stringify([
15159
15159
  i.sessionId,
15160
15160
  i.user?.id,
@@ -15273,14 +15273,14 @@ function Ly(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, _, v, I) {
15273
15273
  if (C.role === "system") {
15274
15274
  if (C.dataType === "run_error" || C.dataType === "run_status") {
15275
15275
  const $ = be(), X = O.some(
15276
- (ye) => ye.role === "tool" && ai(ye, C)
15276
+ (ye) => ye.role === "tool" && ci(ye, C)
15277
15277
  );
15278
15278
  if (!$ && !X) {
15279
- const ye = cs(h());
15279
+ const ye = ls(h());
15280
15280
  ye.classList.add("pluno-pa-widget__terminal-marker"), D(ye);
15281
15281
  }
15282
15282
  const W = document.createElement("div"), ge = C.dataType === "run_error";
15283
- if (W.className = ge ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", W.dataset.messageKey = Or(C), W.dataset.canonicalItemKey = C.id, W.dataset.messageRole = "system", C.provisional || (W.dataset.terminalResponseKey = C.id), C.runId && (W.dataset.runId = C.runId), W.textContent = ci(
15283
+ if (W.className = ge ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", W.dataset.messageKey = Or(C), W.dataset.canonicalItemKey = C.id, W.dataset.messageRole = "system", C.provisional || (W.dataset.terminalResponseKey = C.id), C.runId && (W.dataset.runId = C.runId), W.textContent = li(
15284
15284
  C.content
15285
15285
  ), ge && C.securitySettingsUrl) {
15286
15286
  const ye = document.createElement("a");
@@ -15291,11 +15291,11 @@ function Ly(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, _, v, I) {
15291
15291
  continue;
15292
15292
  }
15293
15293
  C.role;
15294
- const z = be(), Y = ci(C.content), re = C.role === "assistant" && O.some(
15295
- ($) => $.role === "tool" && ai($, C)
15294
+ const z = be(), Y = li(C.content), re = C.role === "assistant" && O.some(
15295
+ ($) => $.role === "tool" && ci($, C)
15296
15296
  );
15297
15297
  if (C.role === "assistant" && !z && !re) {
15298
- const $ = cs(h());
15298
+ const $ = ls(h());
15299
15299
  D($), ce = null, le = $;
15300
15300
  }
15301
15301
  const j = Uy(
@@ -15335,8 +15335,8 @@ function Ly(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, _, v, I) {
15335
15335
  D(C), ce = null, le = C;
15336
15336
  }
15337
15337
  }
15338
- if (i.lastError && os(i.lastErrorCode) === "conversation") {
15339
- const z = O.slice(O.map((j) => j.role).lastIndexOf("user") + 1).some((j) => j.role === "assistant" || j.role === "tool") ? document.createElement("article") : cs(h());
15338
+ if (i.lastError && rs(i.lastErrorCode) === "conversation") {
15339
+ const z = O.slice(O.map((j) => j.role).lastIndexOf("user") + 1).some((j) => j.role === "assistant" || j.role === "tool") ? document.createElement("article") : ls(h());
15340
15340
  z.classList.add("pluno-pa-widget__terminal-marker");
15341
15341
  const Y = document.createElement("div");
15342
15342
  Y.className = "pluno-pa-widget__error", i.historyRefreshFailure && (Y.dataset.historyRefreshFailure = JSON.stringify(i.historyRefreshFailure));
@@ -15540,7 +15540,7 @@ function Vy(t) {
15540
15540
  if (!n.respondsToUserMessageId)
15541
15541
  return [...t.messages, n];
15542
15542
  const s = t.messages.findIndex(
15543
- (r) => ai(r, n) && dr(r)
15543
+ (r) => ci(r, n) && dr(r)
15544
15544
  );
15545
15545
  if (s !== -1)
15546
15546
  return [
@@ -15550,7 +15550,7 @@ function Vy(t) {
15550
15550
  ];
15551
15551
  let i = -1;
15552
15552
  for (let r = t.messages.length - 1; r >= 0; r -= 1)
15553
- if (ai(t.messages[r], n)) {
15553
+ if (ci(t.messages[r], n)) {
15554
15554
  i = r;
15555
15555
  break;
15556
15556
  }
@@ -15568,7 +15568,7 @@ function Gy(t, e) {
15568
15568
  return r ? i.has(r.id) ? [] : (i.add(r.id), r.activityIds.flatMap((a) => n.has(a) ? [n.get(a)] : [])) : [o];
15569
15569
  });
15570
15570
  }
15571
- function ai(t, e) {
15571
+ function ci(t, e) {
15572
15572
  return t.respondsToUserMessageId && e.respondsToUserMessageId ? t.respondsToUserMessageId === e.respondsToUserMessageId : !!(t.runId && t.runId === e.runId);
15573
15573
  }
15574
15574
  function pd(t) {
@@ -15577,7 +15577,7 @@ function pd(t) {
15577
15577
  function dr(t) {
15578
15578
  return t.role === "system" && t.dataType === "run_status" && t.loading === !0;
15579
15579
  }
15580
- function Ds(t, e, n, s, i, o, r, a, c) {
15580
+ function Ls(t, e, n, s, i, o, r, a, c) {
15581
15581
  t.replaceChildren(), Dr(e, !1), e.disabled = !0, n(!1);
15582
15582
  const l = document.createElement("div");
15583
15583
  l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
@@ -15623,7 +15623,7 @@ function Qy(t) {
15623
15623
  const e = document.createElement("time");
15624
15624
  return e.className = "pluno-pa-widget__message-timestamp", e.dateTime = t, e.textContent = rm(t), e;
15625
15625
  }
15626
- function ci(t) {
15626
+ function li(t) {
15627
15627
  return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
15628
15628
  }
15629
15629
  function Xy(t, e, n, s, i, o, r, a = !0) {
@@ -15642,7 +15642,7 @@ function Xy(t, e, n, s, i, o, r, a = !0) {
15642
15642
  r
15643
15643
  ), T = JSON.stringify(r), O = document.createElement("div");
15644
15644
  O.className = "pluno-pa-widget__tool-active-content";
15645
- const G = bi(), E = document.createElement("details"), B = document.createElement("summary");
15645
+ const G = wi(), E = document.createElement("details"), B = document.createElement("summary");
15646
15646
  B.className = "pluno-pa-widget__tool-summary";
15647
15647
  const q = document.createElement("div");
15648
15648
  q.className = "pluno-pa-widget__tool-summary-title", B.appendChild(q), B.addEventListener("click", () => {
@@ -15689,7 +15689,7 @@ function Xy(t, e, n, s, i, o, r, a = !0) {
15689
15689
  }
15690
15690
  const g = d.details;
15691
15691
  g.open = n.has(l) || !n.has(`closed:${l}`) && !a, f.classList.toggle("pluno-pa-widget__tool-group--open", g.open);
15692
- const y = t[t.length - 1], b = ci(
15692
+ const y = t[t.length - 1], b = li(
15693
15693
  y.content
15694
15694
  ).trim(), _ = y.phase === "commentary", v = b ? _ ? b : gd(b) : c ? "Steered" : "Thinking...";
15695
15695
  return f.dataset.collapsedActivityTitle = v, d.summaryTitle.replaceChildren(), d.summaryTitle.classList.add(
@@ -15711,7 +15711,7 @@ function Zy(t, e, n, s) {
15711
15711
  s.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;
15712
15712
  const d = u.querySelector(".pluno-pa-widget__tool-line-text") ?? document.createElement("div");
15713
15713
  d.className = "pluno-pa-widget__tool-line-text";
15714
- const h = ci(c.content) || (c.phase === "commentary" ? "" : "Run tool"), f = c.phase === "commentary" ? h : gd(h);
15714
+ const h = li(c.content) || (c.phase === "commentary" ? "" : "Run tool"), f = c.phase === "commentary" ? h : gd(h);
15715
15715
  i[a] ? (d.classList.add("pluno-pa-widget__tool-line-text--loading"), d.dataset.loadingText = Bp(f)) : delete d.dataset.loadingText, d.classList.add("pluno-pa-widget__tool-line-markdown"), d.replaceChildren();
15716
15716
  const m = document.createElement("div");
15717
15717
  if (m.className = "pluno-pa-widget__tool-line-markdown", Lr(m, f), d.append(m), i[a]) {
@@ -15748,7 +15748,7 @@ function gd(t) {
15748
15748
  const e = t.trim() || "Run tool", n = e.codePointAt(0) ?? 0;
15749
15749
  return n >= 126976 && n <= 129791 || n >= 9728 && n <= 10175 || n >= 127462 && n <= 127487 ? e : `🛠️ ${e}`;
15750
15750
  }
15751
- function cs(t) {
15751
+ function ls(t) {
15752
15752
  const e = document.createElement("article");
15753
15753
  return e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", e.appendChild(
15754
15754
  Pt(
@@ -15771,7 +15771,7 @@ function Pc(t, e, n, s, i = "Thinking...") {
15771
15771
  r.character?.replaceWith(c), r.character = c, r.characterSignature = a;
15772
15772
  }
15773
15773
  } else {
15774
- const c = cs(s), l = bi(i);
15774
+ const c = ls(s), l = wi(i);
15775
15775
  c.classList.add("pluno-pa-widget__thinking-marker"), c.appendChild(l), r = {
15776
15776
  node: c,
15777
15777
  status: l,
@@ -15786,16 +15786,16 @@ function qc(t, e, n, s = "Thinking...") {
15786
15786
  e.add(i);
15787
15787
  let o = t.get(i);
15788
15788
  if (!o) {
15789
- const r = bi(s);
15789
+ const r = wi(s);
15790
15790
  o = { node: r, status: r }, t.set(i, o);
15791
15791
  }
15792
15792
  return fd(o.status, s), o.node;
15793
15793
  }
15794
15794
  function tb(t) {
15795
- const e = cs(t), n = document.createElement("div");
15795
+ const e = ls(t), n = document.createElement("div");
15796
15796
  return n.className = "pluno-pa-widget__status", n.textContent = "Steered", e.appendChild(n), e;
15797
15797
  }
15798
- function bi(t = "Thinking...") {
15798
+ function wi(t = "Thinking...") {
15799
15799
  const e = document.createElement("div");
15800
15800
  e.className = "pluno-pa-widget__status", e.dataset.thinkingStatus = "true";
15801
15801
  const n = document.createElement("span");
@@ -15818,7 +15818,7 @@ function xn() {
15818
15818
  function Dr(t, e) {
15819
15819
  t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ? Iy() : ad());
15820
15820
  }
15821
- function Co(t) {
15821
+ function Ao(t) {
15822
15822
  let e = t.trim();
15823
15823
  if (!e.includes("|"))
15824
15824
  return null;
@@ -15837,7 +15837,7 @@ function sb(t) {
15837
15837
  return e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null;
15838
15838
  }
15839
15839
  function ib(t, e) {
15840
- const n = Co(t[e] ?? ""), s = Co(t[e + 1] ?? "");
15840
+ const n = Ao(t[e] ?? ""), s = Ao(t[e + 1] ?? "");
15841
15841
  if (!n || !s || n.length !== s.length)
15842
15842
  return null;
15843
15843
  const i = [];
@@ -15857,7 +15857,7 @@ function ib(t, e) {
15857
15857
  const l = document.createElement("tbody");
15858
15858
  let u = e + 2;
15859
15859
  for (; u < t.length && t[u].trim(); ) {
15860
- const d = Co(t[u]);
15860
+ const d = Ao(t[u]);
15861
15861
  if (!d)
15862
15862
  break;
15863
15863
  const h = document.createElement("tr");
@@ -18802,9 +18802,9 @@ function db(t) {
18802
18802
  return { clientId: t, release: () => {
18803
18803
  } };
18804
18804
  let e = 0;
18805
- for (; bo.has(e); )
18805
+ for (; wo.has(e); )
18806
18806
  e += 1;
18807
- bo.add(e);
18807
+ wo.add(e);
18808
18808
  const n = `${vm}${e}`;
18809
18809
  let s = crypto.randomUUID();
18810
18810
  try {
@@ -18815,7 +18815,7 @@ function db(t) {
18815
18815
  return {
18816
18816
  clientId: s,
18817
18817
  release: () => {
18818
- i || (i = !0, bo.delete(e));
18818
+ i || (i = !0, wo.delete(e));
18819
18819
  }
18820
18820
  };
18821
18821
  }
@@ -18832,7 +18832,7 @@ function ub(t) {
18832
18832
  (s) => typeof s == "string"
18833
18833
  ) : [],
18834
18834
  launcherPosition: hb(n.launcherPosition) ? n.launcherPosition : null,
18835
- panelSize: gb(n.panelSize) ? mi(n.panelSize) : null
18835
+ panelSize: gb(n.panelSize) ? yi(n.panelSize) : null
18836
18836
  };
18837
18837
  } catch {
18838
18838
  return Lc();
@@ -18948,7 +18948,7 @@ class Rt extends EventTarget {
18948
18948
  ), this.cleanup();
18949
18949
  }), window.dispatchEvent(
18950
18950
  new CustomEvent(
18951
- Ls(
18951
+ Ns(
18952
18952
  gm,
18953
18953
  this.channelId
18954
18954
  ),
@@ -18979,7 +18979,7 @@ class Rt extends EventTarget {
18979
18979
  );
18980
18980
  window.dispatchEvent(
18981
18981
  new CustomEvent(
18982
- Ls(fm, this.channelId),
18982
+ Ns(fm, this.channelId),
18983
18983
  {
18984
18984
  detail: {
18985
18985
  socketId: this.socketId,
@@ -18992,7 +18992,7 @@ class Rt extends EventTarget {
18992
18992
  close(e, n) {
18993
18993
  this.readyState !== Rt.CLOSED && (this.readyState = Rt.CLOSING, window.dispatchEvent(
18994
18994
  new CustomEvent(
18995
- Ls(mm, this.channelId),
18995
+ Ns(mm, this.channelId),
18996
18996
  {
18997
18997
  detail: { socketId: this.socketId, code: e, reason: n }
18998
18998
  }
@@ -19000,7 +19000,7 @@ class Rt extends EventTarget {
19000
19000
  ), this.cleanup());
19001
19001
  }
19002
19002
  addPreviewListener(e, n) {
19003
- const s = Ls(
19003
+ const s = Ns(
19004
19004
  e,
19005
19005
  this.channelId
19006
19006
  ), i = (o) => {
@@ -19023,7 +19023,7 @@ function wb() {
19023
19023
  const e = crypto.randomUUID();
19024
19024
  return window.sessionStorage.setItem(uc, e), e;
19025
19025
  }
19026
- function Ls(t, e) {
19026
+ function Ns(t, e) {
19027
19027
  return `${t}:${e}`;
19028
19028
  }
19029
19029
  function _b(t) {