@pluno/product-agent-web 0.1.80 → 0.1.81

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,11 +1,11 @@
1
- const te = "pluno-product-agent-attachments";
1
+ const se = "pluno-product-agent-attachments";
2
2
  const tt = "files";
3
- async function Ut(e) {
3
+ async function Dt(e) {
4
4
  const t = await F();
5
- await Nt(t, "readwrite", (s) => s.put(e));
5
+ await vt(t, "readwrite", (s) => s.put(e));
6
6
  }
7
- async function ee(e) {
8
- const t = await F(), s = await Nt(
7
+ async function ne(e) {
8
+ const t = await F(), s = await vt(
9
9
  t,
10
10
  "readonly",
11
11
  (r) => r.get(e)
@@ -13,12 +13,12 @@ async function ee(e) {
13
13
  if (!s)
14
14
  return null;
15
15
  const n = Date.now();
16
- return await Dt(e, { lastUsedAt: n }), { ...s, lastUsedAt: n };
16
+ return await Nt(e, { lastUsedAt: n }), { ...s, lastUsedAt: n };
17
17
  }
18
- async function Dt(e, t) {
18
+ async function Nt(e, t) {
19
19
  const s = await F();
20
- await at(s, "readwrite", async (n) => {
21
- const r = await ct(
20
+ await ct(s, "readwrite", async (n) => {
21
+ const r = await lt(
22
22
  n.get(e)
23
23
  );
24
24
  r && n.put({
@@ -27,31 +27,31 @@ async function Dt(e, t) {
27
27
  });
28
28
  });
29
29
  }
30
- async function se(e = 864e5) {
30
+ async function re(e = 864e5) {
31
31
  const t = await F(), s = Date.now() - e;
32
- await at(t, "readwrite", async (n) => {
32
+ await ct(t, "readwrite", async (n) => {
33
33
  const r = n.index("lastUsedAt");
34
- (await ct(r.getAllKeys(IDBKeyRange.upperBound(s)))).forEach((o) => n.delete(o));
34
+ (await lt(r.getAllKeys(IDBKeyRange.upperBound(s)))).forEach((o) => n.delete(o));
35
35
  });
36
36
  }
37
37
  function F() {
38
38
  return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((e, t) => {
39
- const s = indexedDB.open(te, 1);
39
+ const s = indexedDB.open(se, 1);
40
40
  s.onupgradeneeded = () => {
41
41
  const r = s.result.createObjectStore(tt, { keyPath: "attachmentId" });
42
42
  r.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), r.createIndex("sessionId", "sessionId", { unique: !1 }), r.createIndex("origin", "origin", { unique: !1 });
43
43
  }, s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Failed to open Product Agent attachment storage"));
44
44
  });
45
45
  }
46
- async function Nt(e, t, s) {
47
- return await at(e, t, async (n) => await ct(s(n)));
46
+ async function vt(e, t, s) {
47
+ return await ct(e, t, async (n) => await lt(s(n)));
48
48
  }
49
- function at(e, t, s) {
49
+ function ct(e, t, s) {
50
50
  return new Promise((n, r) => {
51
51
  const i = e.transaction(tt, t), o = i.objectStore(tt);
52
- let c, u = !1;
52
+ let a, u = !1;
53
53
  s(o).then((l) => {
54
- c = l;
54
+ a = l;
55
55
  }).catch((l) => {
56
56
  u = !0;
57
57
  try {
@@ -60,7 +60,7 @@ function at(e, t, s) {
60
60
  }
61
61
  r(l);
62
62
  }), i.oncomplete = () => {
63
- u || n(c);
63
+ u || n(a);
64
64
  }, i.onerror = () => {
65
65
  u || (u = !0, r(i.error ?? new Error("Product Agent attachment storage transaction failed")));
66
66
  }, i.onabort = () => {
@@ -68,16 +68,16 @@ function at(e, t, s) {
68
68
  };
69
69
  });
70
70
  }
71
- function ct(e) {
71
+ function lt(e) {
72
72
  return new Promise((t, s) => {
73
73
  e.onsuccess = () => t(e.result), e.onerror = () => s(e.error ?? new Error("Product Agent attachment storage request failed"));
74
74
  });
75
75
  }
76
- function ne(e) {
76
+ function ie(e) {
77
77
  return e !== null && (typeof e == "object" || typeof e == "function");
78
78
  }
79
- function re(e, t, s) {
80
- const n = Reflect.get(e, "pluno"), r = ne(n) ? n : {};
79
+ function Ot(e, t, s) {
80
+ const n = Reflect.get(e, "pluno"), r = ie(n) ? n : {};
81
81
  if (r !== n && !Reflect.set(e, "pluno", r))
82
82
  return null;
83
83
  const i = Object.getOwnPropertyDescriptor(r, t);
@@ -91,22 +91,22 @@ function re(e, t, s) {
91
91
  }
92
92
  };
93
93
  }
94
- const et = "pluno.productAgent.scheduledChatContinuation.", vt = "plunoScheduledContinuation", lt = 10080 * 6e4, ie = 5e3, oe = 15e3;
95
- function ae(e, { callId: t }) {
94
+ const et = "pluno.productAgent.scheduledChatContinuation.", Lt = "plunoScheduledContinuation", ut = 10080 * 6e4, oe = 5e3, ae = 15e3;
95
+ function ce(e, { callId: t }) {
96
96
  return `const plunoScheduledContinuation = Object.freeze(${JSON.stringify({
97
97
  defaultTaskId: `scheduled-${t}`,
98
- resultKey: vt,
99
- expiresAfterDueMs: lt
98
+ resultKey: Lt,
99
+ expiresAfterDueMs: ut
100
100
  })});
101
101
  ${e}`;
102
102
  }
103
- async function ce(e, {
103
+ async function le(e, {
104
104
  clientId: t,
105
105
  sessionId: s,
106
106
  callId: n
107
107
  }, r) {
108
108
  try {
109
- const i = le(e, {
109
+ const i = ue(e, {
110
110
  clientId: t,
111
111
  sessionId: s,
112
112
  callId: n
@@ -115,19 +115,19 @@ async function ce(e, {
115
115
  return e;
116
116
  if (!await r(i))
117
117
  throw new Error("Scheduled continuations are unavailable in this runtime.");
118
- return mt(e, {
118
+ return Tt(e, {
119
119
  ok: !0,
120
120
  id: i.id,
121
121
  dueAt: i.dueAt
122
122
  });
123
123
  } catch (i) {
124
- return mt(e, {
124
+ return Tt(e, {
125
125
  ok: !1,
126
126
  error: i instanceof Error ? i.message : String(i)
127
127
  });
128
128
  }
129
129
  }
130
- function le(e, {
130
+ function ue(e, {
131
131
  clientId: t,
132
132
  sessionId: s,
133
133
  callId: n
@@ -137,37 +137,37 @@ function le(e, {
137
137
  const r = e;
138
138
  if (r.ok !== !0 || !r.result || typeof r.result != "object")
139
139
  return null;
140
- const i = r.result[vt];
140
+ const i = r.result[Lt];
141
141
  if (i === void 0)
142
142
  return null;
143
143
  if (!i || typeof i != "object")
144
144
  throw new Error("Scheduled continuation instruction must be an object.");
145
- const o = i, c = `scheduled-${n}`;
146
- if ((o.id ?? c) !== c)
145
+ const o = i, a = `scheduled-${n}`;
146
+ if ((o.id ?? a) !== a)
147
147
  throw new Error("Scheduled continuation id must use plunoScheduledContinuation.defaultTaskId.");
148
148
  if (typeof o.prompt != "string" || o.prompt.trim().length === 0)
149
149
  throw new Error("Scheduled continuation prompt must be a non-empty string.");
150
150
  if (typeof o.dueAt != "number" || !Number.isFinite(o.dueAt))
151
151
  throw new Error("Scheduled continuation dueAt must be a finite Unix time in milliseconds.");
152
152
  return {
153
- id: c,
153
+ id: a,
154
154
  clientId: t,
155
155
  sessionId: s,
156
156
  prompt: o.prompt.trim(),
157
157
  dueAt: o.dueAt,
158
- expiresAt: o.dueAt + lt
158
+ expiresAt: o.dueAt + ut
159
159
  };
160
160
  }
161
- function ue(e) {
162
- const t = e.storage === void 0 ? de() : e.storage;
161
+ function de(e) {
162
+ const t = e.storage === void 0 ? he() : e.storage;
163
163
  let s = null, n = !1, r = !1, i = !1, o = t !== null;
164
- const c = /* @__PURE__ */ new Map(), u = () => {
164
+ const a = /* @__PURE__ */ new Map(), u = () => {
165
165
  s !== null && (clearTimeout(s), s = null);
166
166
  }, l = () => {
167
167
  u(), !(i || !o) && (s = setTimeout(() => {
168
168
  s = null, h();
169
- }, ie));
170
- }, a = () => {
169
+ }, oe));
170
+ }, c = () => {
171
171
  o = !1, u();
172
172
  }, h = async () => {
173
173
  if (!(i || !o || !t)) {
@@ -178,8 +178,8 @@ function ue(e) {
178
178
  n = !0;
179
179
  try {
180
180
  const f = Date.now();
181
- for (const [g, I] of c)
182
- I <= f && c.delete(g);
181
+ for (const [g, I] of a)
182
+ I <= f && a.delete(g);
183
183
  const w = await t.list(), m = [];
184
184
  for (const g of w) {
185
185
  if (!U(g)) {
@@ -188,23 +188,23 @@ function ue(e) {
188
188
  continue;
189
189
  }
190
190
  if (g.expiresAt <= f) {
191
- await t.remove(g.id), c.delete(g.id);
191
+ await t.remove(g.id), a.delete(g.id);
192
192
  continue;
193
193
  }
194
194
  m.push(g);
195
195
  }
196
196
  e.onTasksChanged?.(m);
197
197
  for (const g of m)
198
- if (!(g.clientId !== e.clientId || g.dueAt > f || c.has(g.id) || !await e.canDeliver(g))) {
199
- c.set(g.id, f + oe);
198
+ if (!(g.clientId !== e.clientId || g.dueAt > f || a.has(g.id) || !await e.canDeliver(g))) {
199
+ a.set(g.id, f + ae);
200
200
  try {
201
201
  await e.deliver(g);
202
202
  } catch {
203
- c.delete(g.id);
203
+ a.delete(g.id);
204
204
  }
205
205
  }
206
206
  } catch {
207
- a();
207
+ c();
208
208
  } finally {
209
209
  n = !1, r ? (r = !1, h()) : l();
210
210
  }
@@ -215,15 +215,15 @@ function ue(e) {
215
215
  try {
216
216
  return await t.set(f), e.onTasksChanged?.((await t.list()).filter(U)), await h(), !0;
217
217
  } catch {
218
- return a(), !1;
218
+ return c(), !1;
219
219
  }
220
220
  }, p = async (f) => {
221
- if (c.delete(f), i || !o || !t)
221
+ if (a.delete(f), i || !o || !t)
222
222
  return !1;
223
223
  try {
224
224
  return await t.remove(f), e.onTasksChanged?.((await t.list()).filter(U)), !0;
225
225
  } catch {
226
- return a(), !1;
226
+ return c(), !1;
227
227
  }
228
228
  }, d = t?.subscribe?.(() => {
229
229
  h();
@@ -234,7 +234,7 @@ function ue(e) {
234
234
  acknowledgeTask: p,
235
235
  isAvailable: () => o,
236
236
  destroy() {
237
- i = !0, u(), d?.(), c.clear();
237
+ i = !0, u(), d?.(), a.clear();
238
238
  }
239
239
  };
240
240
  }
@@ -242,9 +242,9 @@ function U(e) {
242
242
  if (!e || typeof e != "object")
243
243
  return !1;
244
244
  const t = e;
245
- return typeof t.id == "string" && t.id.length > 0 && typeof t.clientId == "string" && t.clientId.length > 0 && typeof t.sessionId == "string" && t.sessionId.length > 0 && typeof t.prompt == "string" && t.prompt.trim().length > 0 && typeof t.dueAt == "number" && Number.isFinite(t.dueAt) && typeof t.expiresAt == "number" && Number.isFinite(t.expiresAt) && t.expiresAt === t.dueAt + lt;
245
+ return typeof t.id == "string" && t.id.length > 0 && typeof t.clientId == "string" && t.clientId.length > 0 && typeof t.sessionId == "string" && t.sessionId.length > 0 && typeof t.prompt == "string" && t.prompt.trim().length > 0 && typeof t.dueAt == "number" && Number.isFinite(t.dueAt) && typeof t.expiresAt == "number" && Number.isFinite(t.expiresAt) && t.expiresAt === t.dueAt + ut;
246
246
  }
247
- function de() {
247
+ function he() {
248
248
  let e;
249
249
  try {
250
250
  e = window.localStorage, e.length;
@@ -283,7 +283,7 @@ function de() {
283
283
  }
284
284
  };
285
285
  }
286
- function mt(e, t) {
286
+ function Tt(e, t) {
287
287
  return {
288
288
  ...e && typeof e == "object" ? e : { result: e },
289
289
  ...t.ok === !1 ? { ok: !1 } : {},
@@ -293,10 +293,10 @@ function mt(e, t) {
293
293
  function G(e) {
294
294
  return `${et}${e}`;
295
295
  }
296
- const X = "pluno.productAgent.transportId", he = "pluno.productAgent.transportIdentity", K = "pluno.productAgent.transportIdentity.event", pe = 50, fe = globalThis.setTimeout.bind(globalThis);
296
+ const X = "pluno.productAgent.transportId", pe = "pluno.productAgent.transportIdentity", K = "pluno.productAgent.transportIdentity.event", fe = 50, ge = globalThis.setTimeout.bind(globalThis);
297
297
  let M = null;
298
298
  const L = /* @__PURE__ */ new Set();
299
- async function ge(e = Ot()) {
299
+ async function me(e = Bt()) {
300
300
  const t = e.randomUUID(), s = e.storage.getItem(X);
301
301
  let n = s ?? e.randomUUID(), r = !1, i = !1;
302
302
  const o = e.channel.subscribe((u) => {
@@ -324,22 +324,22 @@ async function ge(e = Ot()) {
324
324
  }
325
325
  n = e.randomUUID(), e.storage.setItem(X, n);
326
326
  }
327
- let c = !1;
327
+ let a = !1;
328
328
  return {
329
329
  transportId: n,
330
330
  release: () => {
331
- c || (c = !0, o(), e.channel.close());
331
+ a || (a = !0, o(), e.channel.close());
332
332
  }
333
333
  };
334
334
  }
335
- async function me() {
336
- M || (M = ge(Ot()), M.then((n) => {
335
+ async function ye() {
336
+ M || (M = me(Bt()), M.then((n) => {
337
337
  const r = (i) => {
338
338
  i.persisted || (n.release(), M = null, L.clear(), window.removeEventListener("pagehide", r));
339
339
  };
340
340
  window.addEventListener("pagehide", r);
341
341
  }));
342
- const e = await M, t = ye();
342
+ const e = await M, t = Te();
343
343
  L.add(t);
344
344
  let s = !1;
345
345
  return {
@@ -350,23 +350,23 @@ async function me() {
350
350
  }
351
351
  };
352
352
  }
353
- function ye() {
353
+ function Te() {
354
354
  let e = 0;
355
355
  for (; L.has(e); )
356
356
  e += 1;
357
357
  return e;
358
358
  }
359
- function Ot() {
359
+ function Bt() {
360
360
  return {
361
361
  storage: window.sessionStorage,
362
- channel: Te(),
362
+ channel: we(),
363
363
  randomUUID: () => crypto.randomUUID(),
364
- settle: () => new Promise((e) => fe(e, pe))
364
+ settle: () => new Promise((e) => ge(e, fe))
365
365
  };
366
366
  }
367
- function Te() {
367
+ function we() {
368
368
  if (typeof BroadcastChannel < "u") {
369
- const e = new BroadcastChannel(he);
369
+ const e = new BroadcastChannel(pe);
370
370
  return {
371
371
  postMessage: (t) => e.postMessage(t),
372
372
  subscribe: (t) => {
@@ -376,9 +376,9 @@ function Te() {
376
376
  close: () => e.close()
377
377
  };
378
378
  }
379
- return we();
379
+ return Ie();
380
380
  }
381
- function we() {
381
+ function Ie() {
382
382
  const e = /* @__PURE__ */ new Set(), t = (s) => {
383
383
  if (s.key !== K || !s.newValue)
384
384
  return;
@@ -399,15 +399,15 @@ function we() {
399
399
  }
400
400
  };
401
401
  }
402
- const st = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Ie = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Ae = ".pluno-pa-widget__panel", Se = ".pluno-pa-widget__timeline", yt = `${st}[data-pluno-sdk-preview-channel]`, ke = "https://app.pluno.ai", Ee = "gpt-5.6-sol", Re = 2e4, Ce = 1e4, _e = 1e4, be = 1e4, Me = 1e4, Pe = 1e3, Tt = 3e4, wt = 0.2, It = 6e4, Ue = 15e3, D = 3, De = 2e3, Ne = 15e3, ve = 1e3, Oe = 100, Le = 8e3, Be = 15e3, At = 3, xe = [300, 1e3], ut = 64e3, J = 4e3, dt = 30, qe = 2e3, He = 1e3, Fe = 200 * 1024 * 1024, We = "Image is too large for model vision input.", je = 100, Lt = "pluno.productAgent.state.", nt = "pluno.productAgent.pendingEvents.", W = "pluno.productAgent.activeToolCalls.", $e = 100;
402
+ const st = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Ae = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Se = ".pluno-pa-widget__panel", ke = ".pluno-pa-widget__timeline", wt = `${st}[data-pluno-sdk-preview-channel]`, Ee = "https://app.pluno.ai", Re = "gpt-5.6-sol", Ce = 2e4, _e = 1e4, be = 1e4, Me = 1e4, Pe = 1e4, Ue = 1e3, It = 3e4, At = 0.2, St = 6e4, De = 15e3, D = 3, Ne = 2e3, ve = 15e3, Oe = 1e3, Le = 100, Be = 8e3, xe = 15e3, kt = 3, qe = [300, 1e3], dt = 64e3, J = 4e3, ht = 30, He = 2e3, Fe = 1e3, We = 200 * 1024 * 1024, pt = "Image is too large for model vision input.", je = 100, xt = "pluno.productAgent.state.", nt = "pluno.productAgent.pendingEvents.", W = "pluno.productAgent.activeToolCalls.", $e = 100;
403
403
  function N(e, t = 0) {
404
- return Math.max(t, De * 4 ** e);
404
+ return Math.max(t, Ne * 4 ** e);
405
405
  }
406
406
  const B = /* @__PURE__ */ new Set();
407
407
  let v = null;
408
408
  function ze(e, t = Math.random) {
409
- const s = Math.min(Tt, Pe * 2 ** e), n = 1 - wt + t() * wt * 2;
410
- return Math.min(Tt, Math.round(s * n));
409
+ const s = Math.min(It, Ue * 2 ** e), n = 1 - At + t() * At * 2;
410
+ return Math.min(It, Math.round(s * n));
411
411
  }
412
412
  function Ge(e, t, s) {
413
413
  return new Promise((n, r) => {
@@ -422,13 +422,13 @@ function Ge(e, t, s) {
422
422
  );
423
423
  });
424
424
  }
425
- class Bt {
425
+ class qt {
426
426
  constructor(t, s) {
427
427
  this.options = t, this.transportIdentity = s, this.state = {
428
428
  ...this.state,
429
- starterPrompts: hs(t.initialStarterPrompts)
429
+ starterPrompts: ws(t.initialStarterPrompts)
430
430
  };
431
- const n = t.restorePersistedState === !1 ? null : Ws(t.clientId, t.expectedPersistedSessionId);
431
+ const n = t.restorePersistedState === !1 ? null : Js(t.clientId, t.expectedPersistedSessionId);
432
432
  n && (this.state = {
433
433
  ...this.state,
434
434
  ...n,
@@ -439,10 +439,10 @@ class Bt {
439
439
  assistantDraftRunId: null,
440
440
  isThinking: !1,
441
441
  lastError: null
442
- }), this.queuedClientEvents = Js(
443
- $s(t.clientId),
444
- Gs(t.clientId)
445
- ), P(t.clientId, this.queuedClientEvents), this.scheduledChatContinuationScheduler = ue({
442
+ }), this.queuedClientEvents = sn(
443
+ Vs(t.clientId),
444
+ Qs(t.clientId)
445
+ ), P(t.clientId, this.queuedClientEvents), this.scheduledChatContinuationScheduler = de({
446
446
  clientId: t.clientId,
447
447
  canDeliver: (r) => r.sessionId === this.state.sessionId,
448
448
  deliver: async (r) => {
@@ -507,14 +507,14 @@ class Bt {
507
507
  lastErrorCode: null
508
508
  };
509
509
  static async init(t) {
510
- const s = await me(), n = new Bt({
510
+ const s = await ye(), n = new qt({
511
511
  ...t,
512
- backendUrl: ns(t.backendUrl ?? ke),
513
- clientId: t.clientId ?? ys(),
514
- model: t.model ?? Ee
512
+ backendUrl: us(t.backendUrl ?? Ee),
513
+ clientId: t.clientId ?? Es(),
514
+ model: t.model ?? Re
515
515
  }, s);
516
516
  try {
517
- se().catch((r) => {
517
+ re().catch((r) => {
518
518
  y("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
519
519
  message: r instanceof Error ? r.message : String(r)
520
520
  });
@@ -546,14 +546,14 @@ class Bt {
546
546
  lastError: null
547
547
  });
548
548
  try {
549
- if (this.token = this.options.token ?? (this.options.tokenProvider ? await Ge(this.options.tokenProvider(), _e, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
549
+ if (this.token = this.options.token ?? (this.options.tokenProvider ? await Ge(this.options.tokenProvider(), be, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
550
550
  return;
551
551
  if (!this.token && !this.options.webSocketFactory)
552
552
  throw new Error("Pluno requires a token or tokenProvider");
553
- const s = is(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
553
+ const s = hs(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
554
554
  this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
555
555
  this.socket === n && n.readyState === WebSocket.CONNECTING && (y("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
556
- }, be), n.addEventListener("open", () => {
556
+ }, Me), n.addEventListener("open", () => {
557
557
  this.socket !== n || (this.clearSocketConnectTimer(), y("web-sdk.agent", "Pluno socket opened", {
558
558
  queuedClientEventCount: this.queuedClientEvents.length,
559
559
  isThinking: this.state.isThinking
@@ -565,9 +565,9 @@ class Bt {
565
565
  pageUrl: location.href
566
566
  }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
567
567
  this.socket === n && (y("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
568
- }, Me));
568
+ }, Pe));
569
569
  }), n.addEventListener("message", (r) => {
570
- this.socket === n && this.handleServerEvent(ds(r.data));
570
+ this.socket === n && this.handleServerEvent(Ts(r.data));
571
571
  }), n.addEventListener("close", (r) => {
572
572
  this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (y("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
573
573
  code: typeof r?.code == "number" ? r.code : null,
@@ -600,23 +600,23 @@ class Bt {
600
600
  this.connectionAttemptId += 1, this.setState({ status: "closed", isThinking: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.socket?.close(), this.socket = null;
601
601
  }
602
602
  destroy() {
603
- this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), this.scheduledChatContinuationScheduler.destroy(), Vs(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
603
+ this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), this.scheduledChatContinuationScheduler.destroy(), nn(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
604
604
  for (const t of Object.values(this.listeners))
605
605
  t?.clear();
606
606
  }
607
607
  sendMessage(t, s = {}) {
608
- const n = t.trim(), r = s.attachments ?? [], i = r.map(ft);
608
+ const n = t.trim(), r = s.attachments ?? [], i = r.map(mt);
609
609
  if (!n && i.length === 0)
610
610
  return null;
611
- const o = A(), c = s.clientMessageId ?? O();
611
+ const o = A(), a = s.clientMessageId ?? O();
612
612
  this.retryableClientMessageId = null;
613
613
  const u = {
614
- id: `local-${c}`,
614
+ id: `local-${a}`,
615
615
  role: "user",
616
616
  content: n,
617
617
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
618
618
  ...r.length > 0 ? { attachments: r } : {}
619
- }, l = this.state.messages.some((h) => h.id === u.id || h.clientMessageId === c);
619
+ }, l = this.state.messages.some((h) => h.id === u.id || h.clientMessageId === a);
620
620
  this.setState({
621
621
  messages: l ? this.state.messages : [...this.state.messages, u],
622
622
  ...this.state.isThinking ? {} : {
@@ -627,17 +627,17 @@ class Bt {
627
627
  isThinking: !0,
628
628
  lastError: null
629
629
  }), l || this.emit("message", u);
630
- const a = {
630
+ const c = {
631
631
  type: "chat.user_message",
632
632
  sessionId: this.state.sessionId ?? void 0,
633
- clientMessageId: c,
633
+ clientMessageId: a,
634
634
  content: n,
635
635
  attachments: i.length > 0 ? i : void 0,
636
636
  page: o,
637
637
  model: this.options.model,
638
- metadata: St(this.options.metadata)
638
+ metadata: Et(this.options.metadata)
639
639
  };
640
- return this.activeClientMessageId = c, this.activeUserMessageEvent = a, this.markThinkingProgress(), this.send(a), this.startBackgroundAttachmentUploads(c, i), c;
640
+ return this.activeClientMessageId = a, this.activeUserMessageEvent = c, this.markThinkingProgress(), this.send(c), this.startBackgroundAttachmentUploads(a, i), a;
641
641
  }
642
642
  retryLastMessage() {
643
643
  const t = this.state.sessionId, s = this.retryableClientMessageId;
@@ -647,12 +647,12 @@ class Bt {
647
647
  const s = O(), n = {
648
648
  id: s,
649
649
  name: t.name || "attachment",
650
- mimeType: bt(t),
650
+ mimeType: Mt(t),
651
651
  sizeBytes: t.size
652
652
  };
653
653
  this.attachmentFiles.set(s, t), this.attachmentBlobCache.set(s, t);
654
654
  const r = Date.now();
655
- return Ut({
655
+ return Dt({
656
656
  attachmentId: s,
657
657
  name: n.name,
658
658
  mimeType: n.mimeType,
@@ -707,17 +707,17 @@ class Bt {
707
707
  waitForSession: r,
708
708
  notifyCompletion: i
709
709
  }) {
710
- const o = r ? await this.waitForSessionId() : this.state.sessionId, c = bt(t), u = {
710
+ const o = r ? await this.waitForSessionId() : this.state.sessionId, a = Mt(t), u = {
711
711
  sessionId: o ?? void 0,
712
712
  attachmentId: s.id,
713
713
  clientId: this.options.clientId,
714
714
  transportId: this.transportIdentity.transportId,
715
715
  name: t.name || "attachment",
716
- mimeType: c,
716
+ mimeType: a,
717
717
  sizeBytes: t.size,
718
718
  page: A(),
719
719
  model: this.options.model,
720
- metadata: St(this.options.metadata)
720
+ metadata: Et(this.options.metadata)
721
721
  }, l = this.options.prepareAttachmentUpload ? await Q(
722
722
  () => this.options.prepareAttachmentUpload(u),
723
723
  "Failed to prepare attachment upload"
@@ -732,30 +732,30 @@ class Bt {
732
732
  throw new x("Failed to upload attachment", h.status);
733
733
  return h;
734
734
  }, "Failed to upload attachment"), this.setState({ sessionId: l.sessionId });
735
- const a = zt(l.attachment, this.options.backendUrl);
736
- return this.updateAttachmentInState(s.id, a), s.id && Dt(s.id, {
735
+ const c = Xt(l.attachment, this.options.backendUrl);
736
+ return this.updateAttachmentInState(s.id, c), s.id && Nt(s.id, {
737
737
  sessionId: l.sessionId,
738
- fileUrl: a.fileUrl,
739
- gcsPath: a.gcsPath,
738
+ fileUrl: c.fileUrl,
739
+ gcsPath: c.gcsPath,
740
740
  lastUsedAt: Date.now()
741
741
  }).catch((h) => {
742
742
  y("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
743
743
  attachmentId: s.id,
744
- name: a.name,
744
+ name: c.name,
745
745
  message: h instanceof Error ? h.message : String(h)
746
746
  });
747
- }), i && a.gcsPath && this.send({
747
+ }), i && c.gcsPath && this.send({
748
748
  type: "attachment.upload_completed",
749
749
  sessionId: l.sessionId,
750
750
  clientMessageId: n,
751
- attachment: a
752
- }), a;
751
+ attachment: c
752
+ }), c;
753
753
  }
754
754
  waitForSessionId() {
755
755
  return this.state.sessionId ? Promise.resolve(this.state.sessionId) : new Promise((t, s) => {
756
756
  const n = window.setTimeout(() => {
757
757
  r(), s(new Error("Timed out waiting for Pluno session before persisting attachment"));
758
- }, Be), r = this.on("state", (i) => {
758
+ }, xe), r = this.on("state", (i) => {
759
759
  i.sessionId && (window.clearTimeout(n), r(), t(i.sessionId));
760
760
  });
761
761
  });
@@ -777,7 +777,7 @@ class Bt {
777
777
  const n = await this.fetchEmbedAttachmentUpload(t);
778
778
  if (n.ok)
779
779
  return await n.json();
780
- if (gn(n.status) && this.options.tokenProvider && !s) {
780
+ if (Sn(n.status) && this.options.tokenProvider && !s) {
781
781
  s = !0;
782
782
  const r = await this.fetchEmbedAttachmentUpload(t);
783
783
  if (r.ok)
@@ -820,10 +820,10 @@ class Bt {
820
820
  }
821
821
  listSessions(t = {}) {
822
822
  const s = O(), n = new Promise((i, o) => {
823
- const c = window.setTimeout(() => {
823
+ const a = window.setTimeout(() => {
824
824
  this.pendingSessionHistoryRequests.delete(s), o(new Error("Session history did not respond in time"));
825
- }, Le);
826
- this.pendingSessionHistoryRequests.set(s, { resolve: i, reject: o, timeout: c });
825
+ }, Be);
826
+ this.pendingSessionHistoryRequests.set(s, { resolve: i, reject: o, timeout: a });
827
827
  }), r = {
828
828
  type: "sessions.list",
829
829
  requestId: s,
@@ -879,7 +879,7 @@ class Bt {
879
879
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
880
880
  return;
881
881
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
882
- const t = os();
882
+ const t = ps();
883
883
  this.sendNow(
884
884
  S({
885
885
  type: "starter_prompts.page_context",
@@ -890,7 +890,7 @@ class Bt {
890
890
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
891
891
  }
892
892
  startStarterPromptUrlWatcher() {
893
- this.locationChangeCleanup || (this.locationChangeCleanup = as(() => this.handleStarterPromptUrlChange()));
893
+ this.locationChangeCleanup || (this.locationChangeCleanup = fs(() => this.handleStarterPromptUrlChange()));
894
894
  }
895
895
  handleStarterPromptUrlChange() {
896
896
  const t = location.href;
@@ -932,17 +932,17 @@ class Bt {
932
932
  }
933
933
  if (Je(t) && this.markThinkingProgress(), t.type === "auth.ok") {
934
934
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.startHeartbeat();
935
- const s = ps(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
935
+ const s = Is(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
936
936
  y("web-sdk.agent", "Received auth.ok appearance", {
937
937
  hasAppearance: n,
938
938
  rawAppearance: t.appearance,
939
939
  normalizedAppearance: s
940
- }), this.runtimeHelperJavascript = fs(t.runtimeHelpers)?.javascript ?? null;
941
- const r = Rt(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), o = t.starterPromptsLoading === !0, c = {
942
- user: Ts(t.user),
940
+ }), this.runtimeHelperJavascript = As(t.runtimeHelpers)?.javascript ?? null;
941
+ const r = Ct(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), o = t.starterPromptsLoading === !0, a = {
942
+ user: Rs(t.user),
943
943
  status: "connected"
944
944
  };
945
- (i || this.state.starterPrompts.length === 0) && (c.starterPrompts = r, c.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (c.appearance = s), this.setState(c), i && r.length === 0 && !o && !ls() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
945
+ (i || this.state.starterPrompts.length === 0) && (a.starterPrompts = r, a.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (a.appearance = s), this.setState(a), i && r.length === 0 && !o && !ms() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
946
946
  type: "page.upsert",
947
947
  sessionId: this.state.sessionId,
948
948
  page: A(),
@@ -952,28 +952,28 @@ class Bt {
952
952
  }
953
953
  if (t.type === "starterPrompts.updated") {
954
954
  this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0, this.setState({
955
- starterPrompts: Rt(t, "starterPrompts"),
955
+ starterPrompts: Ct(t, "starterPrompts"),
956
956
  starterPromptsLoading: !1
957
957
  });
958
958
  return;
959
959
  }
960
960
  if (t.type === "conversation.state") {
961
- const s = Array.isArray(t.items) ? t.items : [], n = vs(s);
961
+ const s = Array.isArray(t.items) ? t.items : [], n = Fs(s);
962
962
  if (n) {
963
- const c = Os(s, n);
963
+ const a = Ws(s, n);
964
964
  this.retryAttemptsByClientMessageId[n] = Math.max(
965
965
  this.retryAttemptsByClientMessageId[n] ?? 0,
966
- c
966
+ a
967
967
  );
968
968
  }
969
- const r = _s(
969
+ const r = vs(
970
970
  this.state.messages,
971
- ws(s, this.options.backendUrl)
972
- ), i = Ct(r);
973
- if (!i && Ns(this.state.messages, s))
971
+ Cs(s, this.options.backendUrl)
972
+ ), i = _t(r);
973
+ if (!i && Hs(this.state.messages, s))
974
974
  return;
975
- const o = i ? null : rt(s);
976
- if (this.latestRecoverableClientMessageId = o, Us(r) && this.clearRetryTimers(), this.setState({
975
+ const o = i ? null : it(s);
976
+ if (this.latestRecoverableClientMessageId = o, xs(r) && this.clearRetryTimers(), this.setState({
977
977
  sessionId: k(t.session, "id") ?? this.state.sessionId,
978
978
  messages: r,
979
979
  ...i ? { assistantDraft: "", assistantDraftRespondsToUserMessageId: null, assistantDraftRunId: null, isThinking: !1 } : o ? {
@@ -984,15 +984,15 @@ class Bt {
984
984
  lastError: null
985
985
  } : {}
986
986
  }), i ? (this.retryableClientMessageId = null, this.clearThinkingWatchdog()) : o && (this.activeClientMessageId = o, this.markThinkingProgress()), n) {
987
- const c = k(t.session, "id") ?? this.state.sessionId;
988
- c && this.retryAfterInterruptedRun(c, n);
987
+ const a = k(t.session, "id") ?? this.state.sessionId;
988
+ a && this.retryAfterInterruptedRun(a, n);
989
989
  }
990
990
  return;
991
991
  }
992
992
  if (t.type === "sessions.page") {
993
993
  const s = typeof t.requestId == "string" ? t.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
994
994
  s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
995
- sessions: Is(t.sessions),
995
+ sessions: _s(t.sessions),
996
996
  nextCursor: typeof t.nextCursor == "string" ? t.nextCursor : null
997
997
  }));
998
998
  return;
@@ -1002,12 +1002,12 @@ class Bt {
1002
1002
  return;
1003
1003
  }
1004
1004
  if (t.type === "session.item") {
1005
- const s = qt(t.item, this.options.backendUrl);
1005
+ const s = Ft(t.item, this.options.backendUrl);
1006
1006
  if (s) {
1007
1007
  s.role === "assistant" && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
1008
1008
  const n = t.item.data;
1009
- Ls(n) && this.clearRunAckResyncRetryTimer();
1010
- const r = Cs(this.state.messages, s), i = Ct(r);
1009
+ js(n) && this.clearRunAckResyncRetryTimer();
1010
+ const r = Ns(this.state.messages, s), i = _t(r);
1011
1011
  this.setState({
1012
1012
  messages: r,
1013
1013
  assistantDraft: s.role === "assistant" ? "" : this.state.assistantDraft,
@@ -1055,13 +1055,13 @@ class Bt {
1055
1055
  if (this.retryAfterRetryableError(t))
1056
1056
  return;
1057
1057
  o && r && i && (this.retryableClientMessageId = i);
1058
- const c = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), u = rs(c.message);
1058
+ const a = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), u = ds(a.message);
1059
1059
  u && console.error(u), this.setState({
1060
1060
  status: "error",
1061
1061
  isThinking: !1,
1062
- lastError: c.message,
1062
+ lastError: a.message,
1063
1063
  lastErrorCode: typeof t.code == "string" ? t.code : null
1064
- }), this.clearThinkingWatchdog(), this.emit("error", c);
1064
+ }), this.clearThinkingWatchdog(), this.emit("error", a);
1065
1065
  }
1066
1066
  }
1067
1067
  retryAfterRetryableError(t) {
@@ -1070,10 +1070,10 @@ class Bt {
1070
1070
  return !1;
1071
1071
  if (t.code === "run_still_active") {
1072
1072
  if (this.retryableClientMessageId = n, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.retryTimersByClientMessageId[n] === void 0) {
1073
- const c = typeof t.retryAfterMs == "number" ? t.retryAfterMs : 2e3;
1073
+ const a = typeof t.retryAfterMs == "number" ? t.retryAfterMs : 2e3;
1074
1074
  this.retryTimersByClientMessageId[n] = window.setTimeout(() => {
1075
1075
  delete this.retryTimersByClientMessageId[n], this.resyncThinkingSession(), this.markThinkingProgress();
1076
- }, c);
1076
+ }, a);
1077
1077
  }
1078
1078
  return !0;
1079
1079
  }
@@ -1121,7 +1121,7 @@ class Bt {
1121
1121
  this.pendingSessionHistoryRequests.clear();
1122
1122
  }
1123
1123
  markThinkingProgress() {
1124
- !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(It), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
1124
+ !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(St), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
1125
1125
  }
1126
1126
  scheduleThinkingWatchdog(t) {
1127
1127
  this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
@@ -1138,7 +1138,7 @@ class Bt {
1138
1138
  scheduleRunAckWatchdog(t) {
1139
1139
  this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
1140
1140
  this.runAckWatchdogTimer = null, this.recoverMissedRunAck(t);
1141
- }, Ne);
1141
+ }, ve);
1142
1142
  }
1143
1143
  recoverMissedRunAck(t) {
1144
1144
  !this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (y("web-sdk.agent", "Pluno run ack missed; resyncing session", {
@@ -1162,7 +1162,7 @@ class Bt {
1162
1162
  sessionId: this.state.sessionId,
1163
1163
  clientMessageId: t,
1164
1164
  automatic: !0
1165
- }) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(It)));
1165
+ }) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(St)));
1166
1166
  }, N(s)));
1167
1167
  }
1168
1168
  clearRunAckResyncRetryTimer() {
@@ -1202,7 +1202,7 @@ class Bt {
1202
1202
  sessionId: this.state.sessionId,
1203
1203
  clientMessageId: t,
1204
1204
  resyncAttempts: s + 1
1205
- }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Ue);
1205
+ }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(De);
1206
1206
  return;
1207
1207
  }
1208
1208
  this.setState({
@@ -1234,7 +1234,7 @@ class Bt {
1234
1234
  const s = typeof t.sessionId == "string" ? t.sessionId : null, n = typeof t.callId == "string" ? t.callId : null, r = typeof t.toolName == "string" ? t.toolName : null, i = typeof t.summary == "string" ? t.summary : "Running browser tool", o = t.rawInput;
1235
1235
  if (!s || !n || !r)
1236
1236
  return;
1237
- if (r !== "execute_code" || !sn(o)) {
1237
+ if (r !== "execute_code" || !un(o)) {
1238
1238
  this.send({
1239
1239
  type: "tool.result",
1240
1240
  sessionId: s,
@@ -1250,7 +1250,7 @@ class Bt {
1250
1250
  });
1251
1251
  return;
1252
1252
  }
1253
- const c = Ze(this.state.messages);
1253
+ const a = Ze(this.state.messages);
1254
1254
  this.activeBrowserToolCalls.set(n, {
1255
1255
  event: {
1256
1256
  type: "tool.result",
@@ -1264,26 +1264,26 @@ class Bt {
1264
1264
  startedAtMs: Date.now(),
1265
1265
  startedAtUrl: location.href,
1266
1266
  startedAtOrigin: location.origin
1267
- }), this.installSessionUserFilesApi(c);
1267
+ }), this.installSessionUserFilesApi(a);
1268
1268
  let u = null, l;
1269
- u = await this.executeRuntimeHelper(), l = await Et({
1269
+ u = await this.executeRuntimeHelper(), l = await Rt({
1270
1270
  ...o,
1271
- javascript: ae(o.javascript, {
1271
+ javascript: ce(o.javascript, {
1272
1272
  callId: n
1273
1273
  })
1274
- }).catch((a) => ({
1274
+ }).catch((c) => ({
1275
1275
  ok: !1,
1276
1276
  exception: {
1277
- message: a instanceof Error ? a.message : String(a)
1277
+ message: c instanceof Error ? c.message : String(c)
1278
1278
  }
1279
- })), l = await ce(
1279
+ })), l = await le(
1280
1280
  l,
1281
1281
  {
1282
1282
  clientId: this.options.clientId,
1283
1283
  sessionId: s,
1284
1284
  callId: n
1285
1285
  },
1286
- (a) => this.scheduledChatContinuationScheduler.scheduleTask(a)
1286
+ (c) => this.scheduledChatContinuationScheduler.scheduleTask(c)
1287
1287
  ), this.activeBrowserToolCalls.delete(n), this.send({
1288
1288
  type: "tool.result",
1289
1289
  sessionId: s,
@@ -1291,14 +1291,14 @@ class Bt {
1291
1291
  toolName: r,
1292
1292
  summary: o.summary,
1293
1293
  rawInput: S(o),
1294
- rawOutput: S(gs(l, u))
1295
- }), zs(this.options.clientId, this.activeBrowserToolCalls.values());
1294
+ rawOutput: S(Ss(l, u))
1295
+ }), Zs(this.options.clientId, this.activeBrowserToolCalls.values());
1296
1296
  }
1297
1297
  startPageLifecycleRecovery() {
1298
1298
  if (this.pageLifecycleCleanup)
1299
1299
  return;
1300
1300
  const t = () => {
1301
- jt(this.options.clientId, this.activeBrowserToolCalls.values());
1301
+ zt(this.options.clientId, this.activeBrowserToolCalls.values());
1302
1302
  };
1303
1303
  window.addEventListener("pagehide", t), window.addEventListener("beforeunload", t), this.pageLifecycleCleanup = () => {
1304
1304
  window.removeEventListener("pagehide", t), window.removeEventListener("beforeunload", t);
@@ -1308,23 +1308,23 @@ class Bt {
1308
1308
  this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup = Qe(t, this.attachmentFiles, this.attachmentBlobCache);
1309
1309
  }
1310
1310
  cleanupSessionUserFilesApi() {
1311
- this.sessionUserFilesApiCleanup && (ts(this.sessionUserFilesApiCleanup), this.sessionUserFilesApiCleanup = null);
1311
+ this.sessionUserFilesApiCleanup && (as(this.sessionUserFilesApiCleanup), this.sessionUserFilesApiCleanup = null);
1312
1312
  }
1313
1313
  async executeRuntimeHelper() {
1314
1314
  if (!this.runtimeHelperJavascript?.trim())
1315
1315
  return null;
1316
- const t = await Et({
1316
+ const t = await Rt({
1317
1317
  javascript: this.runtimeHelperJavascript
1318
1318
  });
1319
- return t.ok === !1 ? ms(t) : null;
1319
+ return t.ok === !1 ? ks(t) : null;
1320
1320
  }
1321
1321
  enableNetworkCapture() {
1322
1322
  this.networkCaptureCleanup || (this.networkCaptureCleanup = Xe((t) => {
1323
- ln(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
1323
+ mn(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
1324
1324
  }));
1325
1325
  }
1326
1326
  enqueueNetworkEvent(t) {
1327
- this.queuedNetworkEvents.length >= Oe || (this.queuedNetworkEvents.push(cn(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
1327
+ this.queuedNetworkEvents.length >= Le || (this.queuedNetworkEvents.push(gn(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
1328
1328
  this.networkBatchTimer = null;
1329
1329
  const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
1330
1330
  s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
@@ -1333,7 +1333,7 @@ class Bt {
1333
1333
  page: A(),
1334
1334
  events: s
1335
1335
  });
1336
- }, ve)));
1336
+ }, Oe)));
1337
1337
  }
1338
1338
  scheduleReconnect() {
1339
1339
  if (this.reconnectTimer !== null || this.state.status === "closed")
@@ -1354,8 +1354,8 @@ class Bt {
1354
1354
  const t = this.socket;
1355
1355
  !t || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
1356
1356
  this.socket === t && (y("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(t));
1357
- }, Ce));
1358
- }, Re);
1357
+ }, _e));
1358
+ }, Ce);
1359
1359
  }
1360
1360
  stopHeartbeat() {
1361
1361
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -1380,13 +1380,13 @@ class Bt {
1380
1380
  ...this.state,
1381
1381
  ...t,
1382
1382
  ...t.lastError === null && t.lastErrorCode === void 0 ? { lastErrorCode: null } : {}
1383
- }, js(this.options.clientId, this.state), this.emit("state", this.getState());
1383
+ }, Ys(this.options.clientId, this.state), this.emit("state", this.getState());
1384
1384
  }
1385
1385
  emit(t, s) {
1386
1386
  this.listeners[t]?.forEach((r) => r(s));
1387
1387
  }
1388
1388
  }
1389
- const V = /* @__PURE__ */ new WeakMap();
1389
+ const Y = /* @__PURE__ */ new WeakMap();
1390
1390
  function Xe(e) {
1391
1391
  const t = window.__plunoProductAgentNetworkCapture ?? Ke();
1392
1392
  return t.subscribers.add(e), () => {
@@ -1410,20 +1410,20 @@ function Ke() {
1410
1410
  throw m;
1411
1411
  }
1412
1412
  try {
1413
- const m = p instanceof Request ? p : null, g = nn(p, m), I = Gt(d?.headers ?? m?.headers);
1413
+ const m = p instanceof Request ? p : null, g = dn(p, m), I = Kt(d?.headers ?? m?.headers);
1414
1414
  if (!b(g, I, d?.body)) {
1415
1415
  const z = {
1416
1416
  requestId: Z("fetch"),
1417
1417
  url: E(g, J),
1418
1418
  method: (d?.method ?? m?.method ?? "GET").toUpperCase(),
1419
1419
  requestHeaders: I,
1420
- requestBody: Mt(d?.body),
1420
+ requestBody: Pt(d?.body),
1421
1421
  resourceType: "fetch",
1422
1422
  startedAt: new Date(f).toISOString()
1423
1423
  };
1424
1424
  w.then(
1425
1425
  (C) => {
1426
- rn(C, z, f, t).catch(() => {
1426
+ hn(C, z, f, t).catch(() => {
1427
1427
  t({
1428
1428
  ...z,
1429
1429
  responseStatus: C.status,
@@ -1443,9 +1443,9 @@ function Ke() {
1443
1443
  } catch {
1444
1444
  }
1445
1445
  return w;
1446
- }, c = function(p, d, f, w, m) {
1446
+ }, a = function(p, d, f, w, m) {
1447
1447
  const g = n.call(this, p, d, f ?? !0, w ?? void 0, m ?? void 0), I = typeof d == "string" ? d : d.toString();
1448
- return V.set(this, {
1448
+ return Y.set(this, {
1449
1449
  requestId: Z("xhr"),
1450
1450
  method: String(p ?? "GET").toUpperCase(),
1451
1451
  url: E(I, J),
@@ -1455,17 +1455,17 @@ function Ke() {
1455
1455
  excluded: b(I)
1456
1456
  }), g;
1457
1457
  }, u = function(p, d) {
1458
- const f = r.call(this, p, d), w = V.get(this);
1459
- return w && Object.keys(w.requestHeaders).length < dt && (w.requestHeaders[p] = gt(p, d), w.excluded = w.excluded || b(w.url, w.requestHeaders)), f;
1458
+ const f = r.call(this, p, d), w = Y.get(this);
1459
+ return w && Object.keys(w.requestHeaders).length < ht && (w.requestHeaders[p] = yt(p, d), w.excluded = w.excluded || b(w.url, w.requestHeaders)), f;
1460
1460
  }, l = function(p) {
1461
1461
  try {
1462
- const d = V.get(this);
1463
- d && (d.excluded = d.excluded || b(d.url, d.requestHeaders, p), d.requestBody = Mt(p), d.excluded || this.addEventListener(
1462
+ const d = Y.get(this);
1463
+ d && (d.excluded = d.excluded || b(d.url, d.requestHeaders, p), d.requestBody = Pt(p), d.excluded || this.addEventListener(
1464
1464
  "loadend",
1465
1465
  () => {
1466
1466
  queueMicrotask(() => {
1467
1467
  try {
1468
- const f = dn(this.getAllResponseHeaders());
1468
+ const f = Tn(this.getAllResponseHeaders());
1469
1469
  t({
1470
1470
  requestId: d.requestId,
1471
1471
  url: d.url,
@@ -1475,7 +1475,7 @@ function Ke() {
1475
1475
  resourceType: "xhr",
1476
1476
  responseStatus: this.status,
1477
1477
  responseHeaders: f,
1478
- responseBody: an(this, f),
1478
+ responseBody: fn(this, f),
1479
1479
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
1480
1480
  startedAt: d.startedAt,
1481
1481
  durationMs: Date.now() - d.startedAtMs
@@ -1496,7 +1496,7 @@ function Ke() {
1496
1496
  } catch {
1497
1497
  }
1498
1498
  try {
1499
- XMLHttpRequest.prototype.open = c;
1499
+ XMLHttpRequest.prototype.open = a;
1500
1500
  } catch {
1501
1501
  }
1502
1502
  try {
@@ -1507,9 +1507,9 @@ function Ke() {
1507
1507
  XMLHttpRequest.prototype.send = l;
1508
1508
  } catch {
1509
1509
  }
1510
- let a = null;
1510
+ let c = null;
1511
1511
  if (typeof PerformanceObserver < "u") {
1512
- a = new PerformanceObserver((T) => {
1512
+ c = new PerformanceObserver((T) => {
1513
1513
  for (const p of T.getEntries()) {
1514
1514
  const d = p;
1515
1515
  if (d.initiatorType === "fetch" || d.initiatorType === "xmlhttprequest" || b(d.name))
@@ -1527,21 +1527,21 @@ function Ke() {
1527
1527
  }
1528
1528
  });
1529
1529
  try {
1530
- a.observe({ type: "resource", buffered: !0 });
1530
+ c.observe({ type: "resource", buffered: !0 });
1531
1531
  } catch {
1532
- a.disconnect(), a = null;
1532
+ c.disconnect(), c = null;
1533
1533
  }
1534
1534
  }
1535
1535
  const h = {
1536
1536
  subscribers: e,
1537
1537
  destroy: () => {
1538
- a?.disconnect();
1538
+ c?.disconnect();
1539
1539
  try {
1540
1540
  window.fetch === o && (window.fetch = s);
1541
1541
  } catch {
1542
1542
  }
1543
1543
  try {
1544
- XMLHttpRequest.prototype.open === c && (XMLHttpRequest.prototype.open = n);
1544
+ XMLHttpRequest.prototype.open === a && (XMLHttpRequest.prototype.open = n);
1545
1545
  } catch {
1546
1546
  }
1547
1547
  try {
@@ -1567,14 +1567,14 @@ function y(e, t, s) {
1567
1567
  }, i = n.__plunoProductAgentDiagnostics__ ?? [];
1568
1568
  i.push(r), i.length > 120 && i.splice(0, i.length - 120), n.__plunoProductAgentDiagnostics__ = i, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent("product-agent:preview-diagnostic", { detail: r }));
1569
1569
  }
1570
- function St(e) {
1570
+ function Et(e) {
1571
1571
  const t = typeof e == "function" ? e() : e;
1572
1572
  return t && Object.keys(t).length > 0 ? t : void 0;
1573
1573
  }
1574
1574
  function Je(e) {
1575
1575
  return e.type === "conversation.state" || e.type === "session.updated" || e.type === "session.item" || e.type === "chat.assistant_delta" || e.type === "chat.assistant_done" || e.type === "tool.call";
1576
1576
  }
1577
- const Ve = 5e3, Ye = 12e4;
1577
+ const Ye = 5e3, Ve = 12e4;
1578
1578
  function Ze(e) {
1579
1579
  const t = [];
1580
1580
  for (const s of e)
@@ -1587,6 +1587,16 @@ function Ze(e) {
1587
1587
  return t;
1588
1588
  }
1589
1589
  function Qe(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1590
+ const n = [
1591
+ ts(e, t, s),
1592
+ es()
1593
+ ].filter((r) => typeof r == "function");
1594
+ return () => {
1595
+ for (const r of n.reverse())
1596
+ r();
1597
+ };
1598
+ }
1599
+ function ts(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1590
1600
  const n = new Map(e.map((l) => [l.id, l])), r = (l) => ({
1591
1601
  id: l.id,
1592
1602
  name: l.name,
@@ -1595,96 +1605,155 @@ function Qe(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1595
1605
  type: l.mimeType,
1596
1606
  size: l.sizeBytes
1597
1607
  }), i = (l) => {
1598
- const a = n.get(l);
1599
- if (!a)
1608
+ const c = n.get(l);
1609
+ if (!c)
1600
1610
  throw new Error(`Unknown Pluno user file: ${l}`);
1601
- return a;
1611
+ return c;
1602
1612
  }, o = async (l) => {
1603
- const a = i(l), h = t.get(a.id);
1613
+ const c = i(l), h = t.get(c.id);
1604
1614
  if (h)
1605
1615
  return h;
1606
- const T = s.get(a.id);
1616
+ const T = s.get(c.id);
1607
1617
  if (T)
1608
1618
  return T;
1609
- const p = await ee(a.id).then((m) => m?.blob ?? null).catch((m) => (y("web-sdk.attachments", "Failed to load Product Agent attachment from IndexedDB", {
1610
- attachmentId: a.id,
1611
- name: a.name,
1619
+ const p = await ne(c.id).then((m) => m?.blob ?? null).catch((m) => (y("web-sdk.attachments", "Failed to load Product Agent attachment from IndexedDB", {
1620
+ attachmentId: c.id,
1621
+ name: c.name,
1612
1622
  message: m instanceof Error ? m.message : String(m)
1613
1623
  }), null));
1614
1624
  if (p)
1615
- return s.set(a.id, p), p;
1616
- if (!a.fileUrl)
1625
+ return s.set(c.id, p), p;
1626
+ if (!c.fileUrl)
1617
1627
  throw new Error(`Pluno user file is missing content: ${l}`);
1618
- const d = await fetch(a.fileUrl, Ys(a.fileUrl));
1628
+ const d = await fetch(c.fileUrl, rn(c.fileUrl));
1619
1629
  if (!d.ok)
1620
1630
  throw new Error(`Failed to load Pluno user file: ${l}`);
1621
1631
  const f = await d.blob();
1622
- s.set(a.id, f);
1632
+ s.set(c.id, f);
1623
1633
  const w = Date.now();
1624
- return Ut({
1625
- attachmentId: a.id,
1626
- name: a.name,
1627
- mimeType: a.mimeType,
1628
- sizeBytes: a.sizeBytes,
1634
+ return Dt({
1635
+ attachmentId: c.id,
1636
+ name: c.name,
1637
+ mimeType: c.mimeType,
1638
+ sizeBytes: c.sizeBytes,
1629
1639
  blob: f,
1630
- fileUrl: a.fileUrl,
1631
- gcsPath: a.gcsPath,
1640
+ fileUrl: c.fileUrl,
1641
+ gcsPath: c.gcsPath,
1632
1642
  createdAt: w,
1633
1643
  lastUsedAt: w
1634
1644
  }).catch((m) => {
1635
1645
  y("web-sdk.attachments", "Failed to cache Product Agent attachment from fileUrl", {
1636
- attachmentId: a.id,
1637
- name: a.name,
1646
+ attachmentId: c.id,
1647
+ name: c.name,
1638
1648
  message: m instanceof Error ? m.message : String(m)
1639
1649
  });
1640
1650
  }), f;
1641
1651
  };
1642
- return re(globalThis, "userFiles", {
1652
+ return Ot(globalThis, "userFiles", {
1643
1653
  list: () => e.map(r),
1644
1654
  get: (l) => {
1645
- const a = n.get(l);
1646
- return a ? r(a) : null;
1655
+ const c = n.get(l);
1656
+ return c ? r(c) : null;
1647
1657
  },
1648
1658
  inspectImage: async (l) => {
1649
- const a = i(l), h = await o(l), T = a.mimeType.startsWith("image/") ? a.mimeType : h.type || a.mimeType;
1659
+ const c = i(l), h = await o(l), T = c.mimeType.startsWith("image/") ? c.mimeType : h.type || c.mimeType;
1650
1660
  if (!T.startsWith("image/"))
1651
1661
  throw new Error(`Pluno user file is not an image: ${l}`);
1652
1662
  const p = h.type === T ? h : new Blob([h], { type: T });
1653
- return es(T, p.size) > Fe ? {
1663
+ return cs(T, p.size) > We ? {
1654
1664
  type: "pluno.userFiles.inspectImage",
1655
- id: a.id,
1656
- name: a.name,
1665
+ id: c.id,
1666
+ name: c.name,
1657
1667
  mimeType: T,
1658
- sizeBytes: a.sizeBytes,
1668
+ sizeBytes: c.sizeBytes,
1659
1669
  imageAttached: !1,
1660
- imageAttachmentError: We
1670
+ imageAttachmentError: pt
1661
1671
  } : {
1662
1672
  type: "pluno.userFiles.inspectImage",
1663
- id: a.id,
1664
- name: a.name,
1673
+ id: c.id,
1674
+ name: c.name,
1665
1675
  mimeType: T,
1666
- sizeBytes: a.sizeBytes,
1676
+ sizeBytes: c.sizeBytes,
1667
1677
  imageAttached: !0,
1668
- dataUrl: await kt(p)
1678
+ dataUrl: await rt(p)
1669
1679
  };
1670
1680
  },
1671
- getDataUrl: async (l) => (i(l), await kt(await o(l))),
1681
+ getDataUrl: async (l) => (i(l), await rt(await o(l))),
1672
1682
  getBlob: o,
1673
1683
  getArrayBuffer: async (l) => await (await o(l)).arrayBuffer(),
1674
1684
  getFile: async (l) => {
1675
- const a = i(l);
1676
- return new File([await o(l)], a.name, { type: a.mimeType });
1685
+ const c = i(l);
1686
+ return new File([await o(l)], c.name, { type: c.mimeType });
1677
1687
  }
1678
- }) ?? (() => {
1679
1688
  });
1680
1689
  }
1681
- function ts(e) {
1690
+ function es() {
1691
+ return Ot(globalThis, "pageImages", {
1692
+ inspectImage: async (t, s) => await ss(t, s)
1693
+ });
1694
+ }
1695
+ async function ss(e, t = {}) {
1696
+ const s = os(t.name), n = await ns(e);
1697
+ return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
1698
+ type: "pluno.pageImages.inspectImage",
1699
+ imageAttached: !1,
1700
+ imageAttachmentError: pt
1701
+ } : {
1702
+ type: "pluno.pageImages.inspectImage",
1703
+ imageAttached: !0,
1704
+ name: s,
1705
+ mimeType: n.mimeType,
1706
+ sizeBytes: n.sizeBytes,
1707
+ dataUrl: n.dataUrl
1708
+ } : {
1709
+ type: "pluno.pageImages.inspectImage",
1710
+ imageAttached: !1,
1711
+ imageAttachmentError: n.error
1712
+ };
1713
+ }
1714
+ async function ns(e) {
1715
+ return e instanceof Blob ? e.type.startsWith("image/") ? e.size === 0 ? { ok: !1, error: "Page image is empty." } : e.size > 8 * 1024 * 1024 ? { ok: !1, error: pt } : {
1716
+ ok: !0,
1717
+ mimeType: e.type,
1718
+ sizeBytes: e.size,
1719
+ dataUrl: await rt(e)
1720
+ } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof e != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : rs(e);
1721
+ }
1722
+ function rs(e) {
1723
+ if (!e.startsWith("data:") || !e.includes(","))
1724
+ return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
1725
+ const [t, s] = e.slice(5).split(",", 2), n = t.split(";").map((a) => a.trim()).filter(Boolean), r = n[0] ?? "";
1726
+ if (!r.startsWith("image/"))
1727
+ return { ok: !1, error: "Page image MIME type must be image/*." };
1728
+ if (!n.slice(1).some((a) => a.toLowerCase() === "base64"))
1729
+ return { ok: !1, error: "Page image data URL must be base64 encoded." };
1730
+ const i = s.replace(/[ \t\r\n\f]+/g, "");
1731
+ if (!/^[A-Za-z0-9+/]*={0,2}$/.test(i))
1732
+ return { ok: !1, error: "Page image data URL has invalid base64." };
1733
+ const o = is(i);
1734
+ return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
1735
+ ok: !0,
1736
+ mimeType: r,
1737
+ sizeBytes: o,
1738
+ dataUrl: `data:${r};base64,${i}`
1739
+ };
1740
+ }
1741
+ function is(e) {
1742
+ if (e.length === 0 || e.length % 4 !== 0)
1743
+ return null;
1744
+ const t = e.length - e.replace(/=+$/, "").length;
1745
+ return t > 2 ? null : e.length / 4 * 3 - t;
1746
+ }
1747
+ function os(e) {
1748
+ return (typeof e == "string" ? e.trim() : "") || "Page image";
1749
+ }
1750
+ function as(e) {
1682
1751
  try {
1683
1752
  e();
1684
1753
  } catch {
1685
1754
  }
1686
1755
  }
1687
- function kt(e) {
1756
+ function rt(e) {
1688
1757
  return new Promise((t, s) => {
1689
1758
  const n = new FileReader();
1690
1759
  n.onload = () => {
@@ -1696,30 +1765,30 @@ function kt(e) {
1696
1765
  }, n.onerror = () => s(n.error ?? new Error("Failed to read Pluno user file")), n.readAsDataURL(e);
1697
1766
  });
1698
1767
  }
1699
- function es(e, t) {
1768
+ function cs(e, t) {
1700
1769
  return `data:${e};base64,`.length + Math.ceil(t / 3) * 4;
1701
1770
  }
1702
- async function Et(e) {
1771
+ async function Rt(e) {
1703
1772
  const t = Object.getPrototypeOf(async function() {
1704
- }).constructor, s = e.timeoutMs ?? Ve, n = Date.now(), r = [];
1773
+ }).constructor, s = e.timeoutMs ?? Ye, n = Date.now(), r = [];
1705
1774
  let i;
1706
1775
  const o = {
1707
1776
  log: console.log,
1708
1777
  info: console.info,
1709
1778
  warn: console.warn,
1710
1779
  error: console.error
1711
- }, c = (u) => (...l) => {
1780
+ }, a = (u) => (...l) => {
1712
1781
  r.push({ level: u, args: l }), o[u](...l);
1713
1782
  };
1714
- console.log = c("log"), console.info = c("info"), console.warn = c("warn"), console.error = c("error");
1783
+ console.log = a("log"), console.info = a("info"), console.warn = a("warn"), console.error = a("error");
1715
1784
  try {
1716
1785
  const u = /* @__PURE__ */ Symbol("execute_code_timeout"), l = await Promise.race([
1717
1786
  new t(e.javascript)(),
1718
- new Promise((a) => {
1719
- i = window.setTimeout(() => a(u), s);
1787
+ new Promise((c) => {
1788
+ i = window.setTimeout(() => c(u), s);
1720
1789
  })
1721
1790
  ]);
1722
- return l === u ? ss(s) : {
1791
+ return l === u ? ls(s) : {
1723
1792
  ok: !0,
1724
1793
  result: l,
1725
1794
  console: r,
@@ -1748,7 +1817,7 @@ async function Et(e) {
1748
1817
  i !== void 0 && window.clearTimeout(i), console.log = o.log, console.info = o.info, console.warn = o.warn, console.error = o.error;
1749
1818
  }
1750
1819
  }
1751
- function ss(e) {
1820
+ function ls(e) {
1752
1821
  return {
1753
1822
  ok: !1,
1754
1823
  exception: {
@@ -1762,18 +1831,18 @@ function ss(e) {
1762
1831
  }
1763
1832
  };
1764
1833
  }
1765
- function ns(e) {
1834
+ function us(e) {
1766
1835
  return e.replace(/\/+$/, "");
1767
1836
  }
1768
- function rs(e, t = location.origin) {
1837
+ function ds(e, t = location.origin) {
1769
1838
  return /origin (?:is not allowed|does not match browser origin)/i.test(e) ? `Pluno widget blocked on ${t}: this domain is not allowed. Add ${t} in Pluno under Integration > Domains.` : null;
1770
1839
  }
1771
- function is(e) {
1840
+ function hs(e) {
1772
1841
  const t = new URL("/api/product-agent/embed/ws", e);
1773
1842
  return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.toString();
1774
1843
  }
1775
1844
  function A() {
1776
- const e = xt();
1845
+ const e = Ht();
1777
1846
  return {
1778
1847
  url: location.href,
1779
1848
  title: document.title,
@@ -1781,19 +1850,19 @@ function A() {
1781
1850
  ...e ? { plunoProductAgentUi: e } : {}
1782
1851
  };
1783
1852
  }
1784
- function os() {
1853
+ function ps() {
1785
1854
  return {
1786
1855
  pageUrl: location.href,
1787
1856
  pageTitle: document.title,
1788
- htmlContent: us()
1857
+ htmlContent: ys()
1789
1858
  };
1790
1859
  }
1791
- function as(e) {
1792
- return B.add(e), v || (v = cs()), () => {
1860
+ function fs(e) {
1861
+ return B.add(e), v || (v = gs()), () => {
1793
1862
  B.delete(e), B.size === 0 && (v?.(), v = null);
1794
1863
  };
1795
1864
  }
1796
- function cs() {
1865
+ function gs() {
1797
1866
  const e = () => {
1798
1867
  for (const i of Array.from(B))
1799
1868
  i();
@@ -1808,10 +1877,10 @@ function cs() {
1808
1877
  window.history.pushState === n && (window.history.pushState = t), window.history.replaceState === r && (window.history.replaceState = s), window.removeEventListener("popstate", e), window.removeEventListener("hashchange", e);
1809
1878
  };
1810
1879
  }
1811
- function ls() {
1812
- return xt()?.surface === "browser_extension_sdk_preview";
1880
+ function ms() {
1881
+ return Ht()?.surface === "browser_extension_sdk_preview";
1813
1882
  }
1814
- function us() {
1883
+ function ys() {
1815
1884
  const e = document.body?.cloneNode(!0);
1816
1885
  return e instanceof HTMLElement ? (e.querySelectorAll(
1817
1886
  [
@@ -1835,8 +1904,8 @@ function us() {
1835
1904
  s.name === "href" || s.name === "aria-label" || s.name === "role" || t.removeAttribute(s.name);
1836
1905
  }), e.textContent?.replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "[email]").replace(/\b(?:\d[ -]*?){13,19}\b/g, "[number]").replace(/\b(?:sk|pk|tok|key|secret|token)_[A-Za-z0-9_-]{8,}\b/gi, "[secret]").replace(/\s+/g, " ").trim().slice(0, 12e3) ?? "") : "";
1837
1906
  }
1838
- function xt() {
1839
- const e = document.querySelector(yt);
1907
+ function Ht() {
1908
+ const e = document.querySelector(wt);
1840
1909
  if (!(e ?? document.querySelector(st)))
1841
1910
  return;
1842
1911
  const s = e ? "browser_extension_sdk_preview" : "embedded_widget";
@@ -1846,28 +1915,28 @@ function xt() {
1846
1915
  selectors: [
1847
1916
  {
1848
1917
  name: "widget_host",
1849
- selector: s === "browser_extension_sdk_preview" ? yt : st,
1918
+ selector: s === "browser_extension_sdk_preview" ? wt : st,
1850
1919
  description: "Finds Pluno's shadow-host element in the host page DOM."
1851
1920
  },
1852
1921
  {
1853
1922
  name: "widget_root",
1854
- selector: Ie,
1923
+ selector: Ae,
1855
1924
  description: "Finds Pluno's widget root inside the widget host shadow root."
1856
1925
  },
1857
1926
  {
1858
1927
  name: "widget_panel",
1859
- selector: Ae,
1928
+ selector: Se,
1860
1929
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
1861
1930
  },
1862
1931
  {
1863
1932
  name: "widget_timeline",
1864
- selector: Se,
1933
+ selector: ke,
1865
1934
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
1866
1935
  }
1867
1936
  ]
1868
1937
  };
1869
1938
  }
1870
- function ds(e) {
1939
+ function Ts(e) {
1871
1940
  try {
1872
1941
  const t = JSON.parse(e);
1873
1942
  return t && typeof t == "object" ? t : { type: "error", message: "Invalid server event" };
@@ -1875,33 +1944,33 @@ function ds(e) {
1875
1944
  return { type: "error", message: "Invalid server event" };
1876
1945
  }
1877
1946
  }
1878
- function Rt(e, t) {
1947
+ function Ct(e, t) {
1879
1948
  if (!e || typeof e != "object")
1880
1949
  return [];
1881
1950
  const s = e[t];
1882
1951
  return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
1883
1952
  }
1884
- function hs(e) {
1953
+ function ws(e) {
1885
1954
  return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.trim().length > 0) : [];
1886
1955
  }
1887
- function ps(e) {
1956
+ function Is(e) {
1888
1957
  if (!e || typeof e != "object")
1889
1958
  return null;
1890
- const t = e, s = t.appearance, n = s && typeof s == "object" ? s : t, r = typeof n.accentColor == "string" ? n.accentColor : null, i = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, o = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, c = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
1891
- return !r && !i && !o && c === null ? null : {
1959
+ const t = e, s = t.appearance, n = s && typeof s == "object" ? s : t, r = typeof n.accentColor == "string" ? n.accentColor : null, i = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, o = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, a = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
1960
+ return !r && !i && !o && a === null ? null : {
1892
1961
  ...r ? { accentColor: r } : {},
1893
1962
  ...i ? { colorScheme: i } : {},
1894
1963
  ...o ? { fontFamily: o } : {},
1895
- ...c !== null ? { scribbleStyle: c } : {}
1964
+ ...a !== null ? { scribbleStyle: a } : {}
1896
1965
  };
1897
1966
  }
1898
- function fs(e) {
1967
+ function As(e) {
1899
1968
  if (!e || typeof e != "object")
1900
1969
  return null;
1901
1970
  const t = e.javascript;
1902
1971
  return typeof t != "string" || !t.trim() ? null : { javascript: t };
1903
1972
  }
1904
- function gs(e, t) {
1973
+ function Ss(e, t) {
1905
1974
  return t ? e && typeof e == "object" ? {
1906
1975
  ...e,
1907
1976
  helperError: t
@@ -1911,13 +1980,13 @@ function gs(e, t) {
1911
1980
  helperError: t
1912
1981
  } : e;
1913
1982
  }
1914
- function ms(e) {
1983
+ function ks(e) {
1915
1984
  if (!e || typeof e != "object")
1916
1985
  return e;
1917
1986
  const t = e;
1918
1987
  return typeof t.exception?.message == "string" ? t.exception.message : typeof t.error == "string" ? t.error : e;
1919
1988
  }
1920
- function ys() {
1989
+ function Es() {
1921
1990
  const e = "pluno.productAgent.clientId", t = window.localStorage.getItem(e);
1922
1991
  if (t)
1923
1992
  return t;
@@ -1927,7 +1996,7 @@ function ys() {
1927
1996
  function O() {
1928
1997
  return crypto.randomUUID();
1929
1998
  }
1930
- function Ts(e) {
1999
+ function Rs(e) {
1931
2000
  if (!e || typeof e != "object")
1932
2001
  return null;
1933
2002
  const t = e, s = typeof t.id == "string" ? t.id : null;
@@ -1938,14 +2007,14 @@ function Ts(e) {
1938
2007
  avatarUrl: typeof t.avatarUrl == "string" ? t.avatarUrl : null
1939
2008
  } : null;
1940
2009
  }
1941
- function ws(e, t) {
1942
- return Array.isArray(e) ? it(
1943
- ot(
1944
- e.map((s) => qt(s, t)).filter((s) => s !== null)
2010
+ function Cs(e, t) {
2011
+ return Array.isArray(e) ? ot(
2012
+ at(
2013
+ e.map((s) => Ft(s, t)).filter((s) => s !== null)
1945
2014
  )
1946
2015
  ) : [];
1947
2016
  }
1948
- function Is(e) {
2017
+ function _s(e) {
1949
2018
  return Array.isArray(e) ? e.flatMap((t) => {
1950
2019
  if (!t || typeof t != "object")
1951
2020
  return [];
@@ -1963,7 +2032,7 @@ function Is(e) {
1963
2032
  ];
1964
2033
  }) : [];
1965
2034
  }
1966
- function qt(e, t) {
2035
+ function Ft(e, t) {
1967
2036
  if (!e || typeof e != "object")
1968
2037
  return null;
1969
2038
  const s = e, n = s.data;
@@ -1975,39 +2044,39 @@ function qt(e, t) {
1975
2044
  return {
1976
2045
  id: String(s.id ?? crypto.randomUUID()),
1977
2046
  role: i,
1978
- content: Rs(r.content),
2047
+ content: Ds(r.content),
1979
2048
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
1980
- respondsToUserMessageId: Y(r) ?? void 0,
2049
+ respondsToUserMessageId: V(r) ?? void 0,
1981
2050
  ..._(r) ? { runId: _(r) } : {},
1982
- attachments: $t(r.attachments, t)
2051
+ attachments: Gt(r.attachments, t)
1983
2052
  };
1984
2053
  }
1985
2054
  return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" ? {
1986
2055
  id: String(s.id ?? crypto.randomUUID()),
1987
2056
  role: "tool",
1988
- content: Ss(r),
2057
+ content: Ms(r),
1989
2058
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
1990
- respondsToUserMessageId: Y(r) ?? void 0,
2059
+ respondsToUserMessageId: V(r) ?? void 0,
1991
2060
  ..._(r) ? { runId: _(r) } : {},
1992
2061
  dataType: String(r.type),
1993
2062
  toolName: typeof r.name == "string" ? r.name : void 0,
1994
- callId: Es(r) ?? void 0,
2063
+ callId: Us(r) ?? void 0,
1995
2064
  loading: r.localExecutionStatus === "running"
1996
2065
  } : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
1997
2066
  id: String(s.id ?? crypto.randomUUID()),
1998
2067
  role: "system",
1999
- content: As(r),
2068
+ content: bs(r),
2000
2069
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2001
- respondsToUserMessageId: Y(r) ?? void 0,
2070
+ respondsToUserMessageId: V(r) ?? void 0,
2002
2071
  ..._(r) ? { runId: _(r) } : {},
2003
2072
  dataType: String(r.type),
2004
2073
  loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying")
2005
2074
  } : null;
2006
2075
  }
2007
- function As(e) {
2076
+ function bs(e) {
2008
2077
  return typeof e.message == "string" && e.message.trim().length > 0 ? e.message.replace(/Product Agent/g, "Pluno") : e.type === "run_status" && e.status === "interrupted" ? "Pluno was interrupted before it could finish this message." : e.type === "run_status" && e.status === "stopped" ? "Pluno stopped." : "Pluno run status changed.";
2009
2078
  }
2010
- function Ss(e) {
2079
+ function Ms(e) {
2011
2080
  if (e.type === "web_search_call") {
2012
2081
  const t = e.action;
2013
2082
  if (t && typeof t == "object") {
@@ -2019,9 +2088,9 @@ function Ss(e) {
2019
2088
  }
2020
2089
  return "Searching the web";
2021
2090
  }
2022
- return ks(e);
2091
+ return Ps(e);
2023
2092
  }
2024
- function ks(e) {
2093
+ function Ps(e) {
2025
2094
  if (typeof e.summary == "string" && e.summary.trim().length > 0)
2026
2095
  return e.summary;
2027
2096
  if (typeof e.arguments == "string")
@@ -2034,11 +2103,11 @@ function ks(e) {
2034
2103
  }
2035
2104
  return typeof e.name == "string" && e.name.trim().length > 0 ? e.name : "Run tool";
2036
2105
  }
2037
- function Es(e) {
2106
+ function Us(e) {
2038
2107
  const t = e.callId ?? e.call_id;
2039
2108
  return typeof t == "string" && t ? t : null;
2040
2109
  }
2041
- function Rs(e) {
2110
+ function Ds(e) {
2042
2111
  return typeof e == "string" ? e : Array.isArray(e) ? e.map((t) => {
2043
2112
  if (!t || typeof t != "object")
2044
2113
  return "";
@@ -2046,24 +2115,24 @@ function Rs(e) {
2046
2115
  return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
2047
2116
  }).filter(Boolean).join("") : "";
2048
2117
  }
2049
- function Cs(e, t) {
2050
- const s = Ht(e, t), n = Ps(e, t), r = n.findIndex((o) => o.id === s.id);
2118
+ function Ns(e, t) {
2119
+ const s = Wt(e, t), n = Bs(e, t), r = n.findIndex((o) => o.id === s.id);
2051
2120
  if (r === -1)
2052
- return it(
2053
- ot([...n, s])
2121
+ return ot(
2122
+ at([...n, s])
2054
2123
  );
2055
2124
  const i = [...n];
2056
- return i[r] = s, it(ot(i));
2125
+ return i[r] = s, ot(at(i));
2057
2126
  }
2058
- function _s(e, t) {
2127
+ function vs(e, t) {
2059
2128
  const s = t.map(
2060
- (n) => Ht(e, n)
2129
+ (n) => Wt(e, n)
2061
2130
  );
2062
2131
  return t.length > 0 ? s : e.filter(
2063
2132
  (n) => n.role === "user" && n.id.startsWith("local-")
2064
2133
  );
2065
2134
  }
2066
- function Ht(e, t) {
2135
+ function Wt(e, t) {
2067
2136
  if (t.role !== "user" || !t.attachments?.length)
2068
2137
  return t;
2069
2138
  const s = e.find(
@@ -2072,19 +2141,19 @@ function Ht(e, t) {
2072
2141
  if (!s?.attachments?.length)
2073
2142
  return t;
2074
2143
  const n = t.attachments.map((r) => {
2075
- const i = bs(s.attachments ?? [], r);
2076
- return i ? Ms(r, i) : r;
2144
+ const i = Os(s.attachments ?? [], r);
2145
+ return i ? Ls(r, i) : r;
2077
2146
  });
2078
2147
  return { ...t, attachments: n };
2079
2148
  }
2080
- function bs(e, t) {
2149
+ function Os(e, t) {
2081
2150
  return t.id ? e.find((s) => s.id === t.id) ?? null : null;
2082
2151
  }
2083
- function Ms(e, t) {
2152
+ function Ls(e, t) {
2084
2153
  const { previewUrl: s } = t;
2085
2154
  return s ? { ...e, previewUrl: s } : e;
2086
2155
  }
2087
- function Ps(e, t) {
2156
+ function Bs(e, t) {
2088
2157
  if (t.role !== "user")
2089
2158
  return e;
2090
2159
  const s = e.findIndex(
@@ -2095,8 +2164,8 @@ function Ps(e, t) {
2095
2164
  const n = [...e];
2096
2165
  return n.splice(s, 1), n;
2097
2166
  }
2098
- function Ct(e) {
2099
- const t = Ft(e);
2167
+ function _t(e) {
2168
+ const t = jt(e);
2100
2169
  if (t === null)
2101
2170
  return !1;
2102
2171
  for (let s = e.length - 1; s > t; s -= 1) {
@@ -2112,20 +2181,20 @@ function Ct(e) {
2112
2181
  }
2113
2182
  return !1;
2114
2183
  }
2115
- function Us(e) {
2116
- const t = Ft(e);
2184
+ function xs(e) {
2185
+ const t = jt(e);
2117
2186
  return t === null ? e.some((s) => s.role === "assistant") : e.slice(t + 1).some((s) => s.role === "assistant");
2118
2187
  }
2119
- function Ft(e) {
2188
+ function jt(e) {
2120
2189
  for (let t = e.length - 1; t >= 0; t -= 1)
2121
2190
  if (e[t].role === "user")
2122
2191
  return t;
2123
2192
  return null;
2124
2193
  }
2125
- function Ds(e) {
2194
+ function qs(e) {
2126
2195
  return e.role === "assistant" ? !0 : e.role !== "system" ? !1 : e.dataType === "run_error" ? !0 : e.dataType === "run_status" && e.loading !== !0;
2127
2196
  }
2128
- function ht(e) {
2197
+ function ft(e) {
2129
2198
  for (let t = e.length - 1; t >= 0; t -= 1) {
2130
2199
  const s = e[t];
2131
2200
  if (!s || typeof s != "object")
@@ -2139,18 +2208,18 @@ function ht(e) {
2139
2208
  }
2140
2209
  return null;
2141
2210
  }
2142
- function Ns(e, t) {
2143
- const s = ht(t);
2211
+ function Hs(e, t) {
2212
+ const s = ft(t);
2144
2213
  if (s === null)
2145
2214
  return !1;
2146
2215
  const n = t[s], r = n && typeof n == "object" ? n.id : null;
2147
2216
  if (typeof r != "string" || !r)
2148
2217
  return !1;
2149
2218
  const i = e.findIndex((o) => o.role === "user" && o.id === r);
2150
- return i === -1 ? !1 : e.slice(i + 1).some(Ds);
2219
+ return i === -1 ? !1 : e.slice(i + 1).some(qs);
2151
2220
  }
2152
- function rt(e) {
2153
- const t = ht(e);
2221
+ function it(e) {
2222
+ const t = ft(e);
2154
2223
  if (t === null)
2155
2224
  return null;
2156
2225
  const s = e[t];
@@ -2162,8 +2231,8 @@ function rt(e) {
2162
2231
  const r = n.clientMessageId;
2163
2232
  return typeof r == "string" ? r : null;
2164
2233
  }
2165
- function vs(e) {
2166
- const t = ht(e);
2234
+ function Fs(e) {
2235
+ const t = ft(e);
2167
2236
  if (t === null)
2168
2237
  return null;
2169
2238
  for (let s = e.length - 1; s > t; s -= 1) {
@@ -2177,13 +2246,13 @@ function vs(e) {
2177
2246
  if (i.type === "message" && i.role === "assistant")
2178
2247
  return null;
2179
2248
  if (i.type === "run_error")
2180
- return i.retryable !== !0 ? null : typeof i.clientMessageId == "string" ? i.clientMessageId : rt(e);
2249
+ return i.retryable !== !0 ? null : typeof i.clientMessageId == "string" ? i.clientMessageId : it(e);
2181
2250
  if (i.type === "run_status")
2182
- return i.status === "interrupted" && i.retryable === !0 ? rt(e) : null;
2251
+ return i.status === "interrupted" && i.retryable === !0 ? it(e) : null;
2183
2252
  }
2184
2253
  return null;
2185
2254
  }
2186
- function Os(e, t) {
2255
+ function Ws(e, t) {
2187
2256
  let s = 0;
2188
2257
  for (const n of e) {
2189
2258
  if (!n || typeof n != "object")
@@ -2196,22 +2265,22 @@ function Os(e, t) {
2196
2265
  }
2197
2266
  return s;
2198
2267
  }
2199
- function Ls(e) {
2268
+ function js(e) {
2200
2269
  if (!e || typeof e != "object")
2201
2270
  return !1;
2202
2271
  const t = e;
2203
2272
  return t.type === "message" && t.role === "user" ? !1 : t.type === "message" || t.type === "function_call" || t.type === "function_call_output" || t.type === "run_error" || t.type === "run_status";
2204
2273
  }
2205
- function it(e) {
2206
- return e.filter((t, s) => Wt(t) ? !Fs(e, s) && !qs(e, s) && !Hs(e, s) : Bs(t) ? !xs(e, s) : !0);
2274
+ function ot(e) {
2275
+ return e.filter((t, s) => $t(t) ? !Ks(e, s) && !Gs(e, s) && !Xs(e, s) : $s(t) ? !zs(e, s) : !0);
2207
2276
  }
2208
- function Bs(e) {
2277
+ function $s(e) {
2209
2278
  return e.role === "system" && (e.dataType === "run_status" || e.dataType === "run_error");
2210
2279
  }
2211
- function Wt(e) {
2280
+ function $t(e) {
2212
2281
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2213
2282
  }
2214
- function ot(e) {
2283
+ function at(e) {
2215
2284
  const t = new Set(e.filter((i) => i.role === "user").map((i) => i.id)), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
2216
2285
  for (const i of e) {
2217
2286
  if (i.role === "user" || !i.respondsToUserMessageId || !t.has(i.respondsToUserMessageId))
@@ -2227,7 +2296,7 @@ function ot(e) {
2227
2296
  n.has(i.id) || (r.push(i), i.role === "user" && r.push(...s.get(i.id) ?? []));
2228
2297
  return r;
2229
2298
  }
2230
- function xs(e, t) {
2299
+ function zs(e, t) {
2231
2300
  const s = e[t];
2232
2301
  for (let n = t + 1; n < e.length; n += 1) {
2233
2302
  const r = e[n];
@@ -2238,24 +2307,24 @@ function xs(e, t) {
2238
2307
  }
2239
2308
  return !1;
2240
2309
  }
2241
- function qs(e, t) {
2310
+ function Gs(e, t) {
2242
2311
  const s = e[t];
2243
2312
  for (let n = t + 1; n < e.length; n += 1)
2244
2313
  if (e[n].role === "assistant" && j(s, e[n]))
2245
2314
  return !0;
2246
2315
  return !1;
2247
2316
  }
2248
- function Hs(e, t) {
2317
+ function Xs(e, t) {
2249
2318
  const s = e[t];
2250
2319
  for (let n = t + 1; n < e.length; n += 1)
2251
2320
  if (e[n].role === "tool" && j(s, e[n]))
2252
2321
  return !0;
2253
2322
  return !1;
2254
2323
  }
2255
- function Fs(e, t) {
2324
+ function Ks(e, t) {
2256
2325
  const s = e[t];
2257
2326
  for (let n = t + 1; n < e.length; n += 1)
2258
- if (Wt(e[n]) && j(s, e[n]))
2327
+ if ($t(e[n]) && j(s, e[n]))
2259
2328
  return !0;
2260
2329
  return !1;
2261
2330
  }
@@ -2265,15 +2334,15 @@ function j(e, t) {
2265
2334
  function k(e, t) {
2266
2335
  return e && typeof e == "object" && typeof e[t] == "string" ? e[t] : null;
2267
2336
  }
2268
- function Ws(e, t) {
2337
+ function Js(e, t) {
2269
2338
  try {
2270
- const s = window.localStorage.getItem(`${Lt}${e}`);
2339
+ const s = window.localStorage.getItem(`${xt}${e}`);
2271
2340
  if (!s)
2272
2341
  return null;
2273
2342
  const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
2274
2343
  if (t !== void 0 && r !== t)
2275
2344
  return null;
2276
- const i = Array.isArray(n.messages) ? n.messages.map(tn).filter((o) => !!o) : [];
2345
+ const i = Array.isArray(n.messages) ? n.messages.map(cn).filter((o) => !!o) : [];
2277
2346
  return {
2278
2347
  sessionId: r,
2279
2348
  messages: i
@@ -2282,33 +2351,33 @@ function Ws(e, t) {
2282
2351
  return null;
2283
2352
  }
2284
2353
  }
2285
- function js(e, t) {
2354
+ function Ys(e, t) {
2286
2355
  try {
2287
2356
  window.localStorage.setItem(
2288
- `${Lt}${e}`,
2357
+ `${xt}${e}`,
2289
2358
  JSON.stringify({
2290
2359
  sessionId: t.sessionId,
2291
- messages: t.messages.slice(-je).map(en)
2360
+ messages: t.messages.slice(-je).map(ln)
2292
2361
  })
2293
2362
  );
2294
2363
  } catch {
2295
2364
  return;
2296
2365
  }
2297
2366
  }
2298
- function $s(e) {
2367
+ function Vs(e) {
2299
2368
  try {
2300
2369
  const t = window.localStorage.getItem(`${nt}${e}`);
2301
2370
  if (!t)
2302
2371
  return [];
2303
2372
  const s = JSON.parse(t);
2304
- return Array.isArray(s) ? s.filter(pt) : [];
2373
+ return Array.isArray(s) ? s.filter(gt) : [];
2305
2374
  } catch {
2306
2375
  return [];
2307
2376
  }
2308
2377
  }
2309
2378
  function P(e, t) {
2310
2379
  try {
2311
- const s = t.filter(pt);
2380
+ const s = t.filter(gt);
2312
2381
  if (s.length === 0) {
2313
2382
  window.localStorage.removeItem(`${nt}${e}`);
2314
2383
  return;
@@ -2321,7 +2390,7 @@ function P(e, t) {
2321
2390
  return;
2322
2391
  }
2323
2392
  }
2324
- function jt(e, t) {
2393
+ function zt(e, t) {
2325
2394
  try {
2326
2395
  const s = `${W}${e}`, n = location.href, r = location.origin, i = Array.from(t, (o) => ({
2327
2396
  ...o,
@@ -2337,28 +2406,28 @@ function jt(e, t) {
2337
2406
  } catch {
2338
2407
  }
2339
2408
  }
2340
- function zs(e, t) {
2409
+ function Zs(e, t) {
2341
2410
  try {
2342
2411
  if (window.sessionStorage.getItem(`${W}${e}`) === null)
2343
2412
  return;
2344
2413
  } catch {
2345
2414
  return;
2346
2415
  }
2347
- jt(e, t);
2416
+ zt(e, t);
2348
2417
  }
2349
- function Gs(e) {
2418
+ function Qs(e) {
2350
2419
  try {
2351
2420
  const t = `${W}${e}`, s = window.sessionStorage.getItem(t);
2352
2421
  if (window.sessionStorage.removeItem(t), !s)
2353
2422
  return [];
2354
2423
  const n = JSON.parse(s);
2355
- return Array.isArray(n) ? n.flatMap((r) => Ks(r) ? [{
2424
+ return Array.isArray(n) ? n.flatMap((r) => en(r) ? [{
2356
2425
  ...r.event,
2357
2426
  page: A(),
2358
2427
  rawOutput: {
2359
2428
  pageContextRestarted: !0,
2360
2429
  outcome: "unknown",
2361
- message: Xs(location.href),
2430
+ message: tn(location.href),
2362
2431
  currentUrl: location.href,
2363
2432
  console: [],
2364
2433
  metadata: {
@@ -2375,17 +2444,17 @@ function Gs(e) {
2375
2444
  return [];
2376
2445
  }
2377
2446
  }
2378
- function Xs(e) {
2447
+ function tn(e) {
2379
2448
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
2380
2449
  Current URL: ${e}`;
2381
2450
  }
2382
- function Ks(e) {
2451
+ function en(e) {
2383
2452
  if (!e || typeof e != "object")
2384
2453
  return !1;
2385
2454
  const t = e, s = t.event;
2386
- return typeof t.startedAtMs == "number" && typeof t.startedAtUrl == "string" && t.startedAtOrigin === location.origin && t.unloadOrigin === location.origin && typeof t.unloadUrl == "string" && pt(s) && s.type === "tool.result";
2455
+ return typeof t.startedAtMs == "number" && typeof t.startedAtUrl == "string" && t.startedAtOrigin === location.origin && t.unloadOrigin === location.origin && typeof t.unloadUrl == "string" && gt(s) && s.type === "tool.result";
2387
2456
  }
2388
- function Js(e, t) {
2457
+ function sn(e, t) {
2389
2458
  const s = new Set(
2390
2459
  e.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
2391
2460
  );
@@ -2394,26 +2463,26 @@ function Js(e, t) {
2394
2463
  ...t.filter((n) => !s.has(n.callId))
2395
2464
  ];
2396
2465
  }
2397
- function Vs(e) {
2466
+ function nn(e) {
2398
2467
  try {
2399
2468
  window.sessionStorage.removeItem(`${W}${e}`);
2400
2469
  } catch {
2401
2470
  return;
2402
2471
  }
2403
2472
  }
2404
- function pt(e) {
2473
+ function gt(e) {
2405
2474
  if (!e || typeof e != "object")
2406
2475
  return !1;
2407
2476
  const t = e;
2408
- return t.type === "chat.user_message" ? typeof t.content == "string" && _t(t.page) : t.type === "page.upsert" || t.type === "session.reset" || t.type === "network.batch" ? _t(t.page) : t.type === "tool.result" ? typeof t.sessionId == "string" && typeof t.callId == "string" && t.toolName === "execute_code" : t.type === "chat.retry_last_user_message" ? typeof t.sessionId == "string" && typeof t.clientMessageId == "string" : t.type === "run.stop" ? typeof t.sessionId == "string" : !1;
2477
+ return t.type === "chat.user_message" ? typeof t.content == "string" && bt(t.page) : t.type === "page.upsert" || t.type === "session.reset" || t.type === "network.batch" ? bt(t.page) : t.type === "tool.result" ? typeof t.sessionId == "string" && typeof t.callId == "string" && t.toolName === "execute_code" : t.type === "chat.retry_last_user_message" ? typeof t.sessionId == "string" && typeof t.clientMessageId == "string" : t.type === "run.stop" ? typeof t.sessionId == "string" : !1;
2409
2478
  }
2410
- function _t(e) {
2479
+ function bt(e) {
2411
2480
  if (!e || typeof e != "object")
2412
2481
  return !1;
2413
2482
  const t = e;
2414
2483
  return typeof t.url == "string" && typeof t.title == "string" && typeof t.origin == "string";
2415
2484
  }
2416
- function $t(e, t) {
2485
+ function Gt(e, t) {
2417
2486
  if (!Array.isArray(e))
2418
2487
  return;
2419
2488
  const s = e.filter((r) => {
@@ -2421,24 +2490,24 @@ function $t(e, t) {
2421
2490
  return !1;
2422
2491
  const i = r;
2423
2492
  return typeof i.name == "string" && typeof i.mimeType == "string" && typeof i.sizeBytes == "number";
2424
- }), n = t ? s.map((r) => zt(r, t)) : s;
2493
+ }), n = t ? s.map((r) => Xt(r, t)) : s;
2425
2494
  return n.length > 0 ? n : void 0;
2426
2495
  }
2427
- function zt(e, t) {
2496
+ function Xt(e, t) {
2428
2497
  return e.fileUrl?.startsWith("/") ? {
2429
2498
  ...e,
2430
2499
  fileUrl: new URL(e.fileUrl, t).toString()
2431
2500
  } : e;
2432
2501
  }
2433
- function Ys(e) {
2434
- if (Zs(e))
2502
+ function rn(e) {
2503
+ if (on(e))
2435
2504
  return {
2436
2505
  headers: {
2437
2506
  "ngrok-skip-browser-warning": "true"
2438
2507
  }
2439
2508
  };
2440
2509
  }
2441
- function Zs(e) {
2510
+ function on(e) {
2442
2511
  try {
2443
2512
  const t = new URL(e).hostname;
2444
2513
  return t.endsWith(".ngrok-free.dev") || t.endsWith(".ngrok-free.app") || t.endsWith(".ngrok.app") || t.endsWith(".ngrok.io");
@@ -2446,14 +2515,14 @@ function Zs(e) {
2446
2515
  return !1;
2447
2516
  }
2448
2517
  }
2449
- function bt(e) {
2450
- return e.type || Qs(e.name) || "application/octet-stream";
2518
+ function Mt(e) {
2519
+ return e.type || an(e.name) || "application/octet-stream";
2451
2520
  }
2452
- function Qs(e) {
2521
+ function an(e) {
2453
2522
  const t = e.toLowerCase();
2454
2523
  return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
2455
2524
  }
2456
- function tn(e) {
2525
+ function cn(e) {
2457
2526
  if (!e || typeof e != "object")
2458
2527
  return null;
2459
2528
  const t = e;
@@ -2465,17 +2534,17 @@ function tn(e) {
2465
2534
  respondsToUserMessageId: typeof t.respondsToUserMessageId == "string" ? t.respondsToUserMessageId : void 0,
2466
2535
  ...typeof t.runId == "string" ? { runId: t.runId } : {},
2467
2536
  dataType: typeof t.dataType == "string" ? t.dataType : void 0,
2468
- attachments: $t(t.attachments)?.map(ft),
2537
+ attachments: Gt(t.attachments)?.map(mt),
2469
2538
  loading: typeof t.loading == "boolean" ? t.loading : void 0
2470
2539
  };
2471
2540
  }
2472
- function en(e) {
2541
+ function ln(e) {
2473
2542
  return e.attachments?.length ? {
2474
2543
  ...e,
2475
- attachments: e.attachments.map(ft)
2544
+ attachments: e.attachments.map(mt)
2476
2545
  } : e;
2477
2546
  }
2478
- function ft(e) {
2547
+ function mt(e) {
2479
2548
  const {
2480
2549
  dataUrl: t,
2481
2550
  objectUrl: s,
@@ -2484,7 +2553,7 @@ function ft(e) {
2484
2553
  } = e;
2485
2554
  return r;
2486
2555
  }
2487
- function Y(e) {
2556
+ function V(e) {
2488
2557
  const t = e.respondsToUserMessageId;
2489
2558
  return typeof t == "string" && t ? t : null;
2490
2559
  }
@@ -2492,60 +2561,60 @@ function _(e) {
2492
2561
  const t = e.runId;
2493
2562
  return typeof t == "string" && t ? t : null;
2494
2563
  }
2495
- function sn(e) {
2564
+ function un(e) {
2496
2565
  const t = e?.timeoutMs;
2497
- return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string" && (t === void 0 || typeof t == "number" && Number.isInteger(t) && t > 0 && t <= Ye);
2566
+ return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string" && (t === void 0 || typeof t == "number" && Number.isInteger(t) && t > 0 && t <= Ve);
2498
2567
  }
2499
- function Gt(e) {
2568
+ function Kt(e) {
2500
2569
  const t = {};
2501
2570
  try {
2502
2571
  new Headers(e).forEach((s, n) => {
2503
- Object.keys(t).length < dt && (t[n] = gt(n, s));
2572
+ Object.keys(t).length < ht && (t[n] = yt(n, s));
2504
2573
  });
2505
2574
  } catch {
2506
2575
  return {};
2507
2576
  }
2508
2577
  return t;
2509
2578
  }
2510
- function gt(e, t) {
2511
- return Zt(e) ? $ : E(H(t), qe);
2579
+ function yt(e, t) {
2580
+ return te(e) ? $ : E(H(t), He);
2512
2581
  }
2513
- function nn(e, t) {
2582
+ function dn(e, t) {
2514
2583
  return typeof e == "string" ? e : e instanceof URL ? e.toString() : t?.url ?? "";
2515
2584
  }
2516
- async function rn(e, t, s, n) {
2517
- const r = Gt(e.headers);
2585
+ async function hn(e, t, s, n) {
2586
+ const r = Kt(e.headers);
2518
2587
  n({
2519
2588
  ...t,
2520
2589
  responseStatus: e.status,
2521
2590
  responseHeaders: r,
2522
- responseBody: await on(e),
2591
+ responseBody: await pn(e),
2523
2592
  durationMs: Date.now() - s
2524
2593
  });
2525
2594
  }
2526
- async function on(e) {
2527
- if (!Xt(e.headers))
2595
+ async function pn(e) {
2596
+ if (!Jt(e.headers))
2528
2597
  return;
2529
2598
  let t = null, s = null;
2530
2599
  try {
2531
2600
  if (t = e.clone().body?.getReader() ?? null, !t)
2532
2601
  return;
2533
- const n = new Promise((c) => {
2602
+ const n = new Promise((a) => {
2534
2603
  s = window.setTimeout(() => {
2535
- t?.cancel(), c("timeout");
2536
- }, He);
2604
+ t?.cancel(), a("timeout");
2605
+ }, Fe);
2537
2606
  }), r = new TextDecoder();
2538
2607
  let i = "", o = 0;
2539
2608
  for (; ; ) {
2540
- const c = await Promise.race([t.read(), n]);
2541
- if (c === "timeout")
2609
+ const a = await Promise.race([t.read(), n]);
2610
+ if (a === "timeout")
2542
2611
  return;
2543
- const { done: u, value: l } = c;
2612
+ const { done: u, value: l } = a;
2544
2613
  if (u)
2545
2614
  return E(i + r.decode());
2546
- const a = ut - o;
2547
- if (l.byteLength > a)
2548
- return i += r.decode(l.subarray(0, Math.max(a, 0)), { stream: !0 }), t.cancel(), `${E(i)}... [truncated]`;
2615
+ const c = dt - o;
2616
+ if (l.byteLength > c)
2617
+ return i += r.decode(l.subarray(0, Math.max(c, 0)), { stream: !0 }), t.cancel(), `${E(i)}... [truncated]`;
2549
2618
  o += l.byteLength, i += r.decode(l, { stream: !0 });
2550
2619
  }
2551
2620
  } catch {
@@ -2555,26 +2624,26 @@ async function on(e) {
2555
2624
  s !== null && window.clearTimeout(s);
2556
2625
  }
2557
2626
  }
2558
- function an(e, t) {
2559
- if (Xt(new Headers(t)))
2627
+ function fn(e, t) {
2628
+ if (Jt(new Headers(t)))
2560
2629
  try {
2561
2630
  return e.responseType === "" || e.responseType === "text" ? E(e.responseText ?? "") : void 0;
2562
2631
  } catch {
2563
2632
  return;
2564
2633
  }
2565
2634
  }
2566
- function Mt(e) {
2635
+ function Pt(e) {
2567
2636
  if (typeof e == "string")
2568
2637
  return E(e);
2569
2638
  }
2570
- function cn(e) {
2639
+ function gn(e) {
2571
2640
  return S({
2572
2641
  ...e,
2573
- requestBody: Pt(e.requestBody),
2574
- responseBody: Pt(e.responseBody)
2642
+ requestBody: Ut(e.requestBody),
2643
+ responseBody: Ut(e.responseBody)
2575
2644
  });
2576
2645
  }
2577
- function Pt(e) {
2646
+ function Ut(e) {
2578
2647
  if (typeof e != "string")
2579
2648
  return e;
2580
2649
  const t = e.trim();
@@ -2586,14 +2655,14 @@ function Pt(e) {
2586
2655
  return H(e);
2587
2656
  }
2588
2657
  }
2589
- function Xt(e) {
2658
+ function Jt(e) {
2590
2659
  if (!e)
2591
2660
  return !1;
2592
2661
  const t = e.get("content-type")?.toLowerCase() ?? "", s = e.get("content-length"), n = Number(s);
2593
- return s !== null && Number.isInteger(n) && n >= 0 && n <= ut && (t.startsWith("text/") || t.includes("json") || t.includes("javascript"));
2662
+ return s !== null && Number.isInteger(n) && n >= 0 && n <= dt && (t.startsWith("text/") || t.includes("json") || t.includes("javascript"));
2594
2663
  }
2595
2664
  function b(e, t = {}, s) {
2596
- if (un(s))
2665
+ if (yn(s))
2597
2666
  return !0;
2598
2667
  const n = Object.entries(t).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
2599
2668
  if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
@@ -2603,12 +2672,12 @@ function b(e, t = {}, s) {
2603
2672
  if (r.protocol !== "http:" && r.protocol !== "https:")
2604
2673
  return !0;
2605
2674
  const i = r.hostname.toLowerCase(), o = r.pathname.toLowerCase();
2606
- return i === "pluno.ai" || i.endsWith(".pluno.ai") || o === "/api/product-agent" || o.startsWith("/api/product-agent/") || /(^|\/)(auth|oauth|login|logout)(\/|$)/.test(o) || /(^|\/)[^/]*token[^/]*(\/|$)/.test(o) || /(^|\/)(upload|uploads|attachments)(\/|$)/.test(o) || [...r.searchParams.keys()].some((c) => /^(x-amz-signature|x-goog-signature|signature|sig)$/i.test(c));
2675
+ return i === "pluno.ai" || i.endsWith(".pluno.ai") || o === "/api/product-agent" || o.startsWith("/api/product-agent/") || /(^|\/)(auth|oauth|login|logout)(\/|$)/.test(o) || /(^|\/)[^/]*token[^/]*(\/|$)/.test(o) || /(^|\/)(upload|uploads|attachments)(\/|$)/.test(o) || [...r.searchParams.keys()].some((a) => /^(x-amz-signature|x-goog-signature|signature|sig)$/i.test(a));
2607
2676
  } catch {
2608
2677
  return !0;
2609
2678
  }
2610
2679
  }
2611
- function ln(e, t) {
2680
+ function mn(e, t) {
2612
2681
  if (b(e))
2613
2682
  return !0;
2614
2683
  try {
@@ -2618,23 +2687,23 @@ function ln(e, t) {
2618
2687
  return !0;
2619
2688
  }
2620
2689
  }
2621
- function un(e) {
2690
+ function yn(e) {
2622
2691
  return e instanceof FormData || e instanceof Blob || e instanceof ArrayBuffer || ArrayBuffer.isView(e) || typeof ReadableStream < "u" && e instanceof ReadableStream;
2623
2692
  }
2624
- function dn(e) {
2693
+ function Tn(e) {
2625
2694
  const t = {};
2626
2695
  for (const s of e.trim().split(/[\r\n]+/)) {
2627
2696
  const n = s.indexOf(":");
2628
2697
  if (n <= 0)
2629
2698
  continue;
2630
- if (Object.keys(t).length >= dt)
2699
+ if (Object.keys(t).length >= ht)
2631
2700
  break;
2632
2701
  const r = s.slice(0, n).trim();
2633
- t[r] = gt(r, s.slice(n + 1).trim());
2702
+ t[r] = yt(r, s.slice(n + 1).trim());
2634
2703
  }
2635
2704
  return t;
2636
2705
  }
2637
- function E(e, t = ut) {
2706
+ function E(e, t = dt) {
2638
2707
  return e.length <= t ? e : `${e.slice(0, t)}... [truncated ${e.length - t} chars]`;
2639
2708
  }
2640
2709
  function Z(e) {
@@ -2648,31 +2717,31 @@ class x extends Error {
2648
2717
  }
2649
2718
  async function Q(e, t) {
2650
2719
  let s = null;
2651
- for (let n = 0; n < At; n += 1)
2720
+ for (let n = 0; n < kt; n += 1)
2652
2721
  try {
2653
2722
  return await e();
2654
2723
  } catch (r) {
2655
- if (s = r, n >= At - 1 || !pn(r))
2724
+ if (s = r, n >= kt - 1 || !In(r))
2656
2725
  throw r;
2657
- await hn(n);
2726
+ await wn(n);
2658
2727
  }
2659
2728
  throw s instanceof Error ? s : new Error(t);
2660
2729
  }
2661
- function hn(e) {
2730
+ function wn(e) {
2662
2731
  return new Promise((t) => {
2663
- window.setTimeout(t, xe[e] ?? 0);
2732
+ window.setTimeout(t, qe[e] ?? 0);
2664
2733
  });
2665
2734
  }
2666
- function pn(e) {
2667
- return e instanceof x ? fn(e.status) : e instanceof TypeError;
2735
+ function In(e) {
2736
+ return e instanceof x ? An(e.status) : e instanceof TypeError;
2668
2737
  }
2669
- function fn(e) {
2738
+ function An(e) {
2670
2739
  return e === 408 || e === 409 || e === 429 || e >= 500;
2671
2740
  }
2672
- function gn(e) {
2741
+ function Sn(e) {
2673
2742
  return e === 401 || e === 403;
2674
2743
  }
2675
- const $ = "[REDACTED_SECRET]", R = "[REDACTED_TOKEN]", mn = "[REDACTED_SIGNED_URL]", yn = 20, Tn = /^(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, Kt = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Jt = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Vt = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Yt = /\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, wn = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, In = /\bhttps?:\/\/[^\s"'<>]+/gi, An = /[),.;\]]+$/;
2744
+ const $ = "[REDACTED_SECRET]", R = "[REDACTED_TOKEN]", kn = "[REDACTED_SIGNED_URL]", En = 20, Rn = /^(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, Yt = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Vt = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Zt = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Qt = /\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, Cn = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, _n = /\bhttps?:\/\/[^\s"'<>]+/gi, bn = /[),.;\]]+$/;
2676
2745
  function S(e) {
2677
2746
  return q(e, 0, /* @__PURE__ */ new WeakSet());
2678
2747
  }
@@ -2681,7 +2750,7 @@ function q(e, t, s) {
2681
2750
  return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : H(e);
2682
2751
  if (e === null || typeof e != "object")
2683
2752
  return e;
2684
- if (t >= yn)
2753
+ if (t >= En)
2685
2754
  return "[REDACTED_MAX_DEPTH]";
2686
2755
  if (s.has(e))
2687
2756
  return "[REDACTED_CIRCULAR]";
@@ -2689,44 +2758,44 @@ function q(e, t, s) {
2689
2758
  return e.map((r) => q(r, t + 1, s));
2690
2759
  const n = {};
2691
2760
  for (const [r, i] of Object.entries(e))
2692
- Zt(r) ? n[r] = $ : n[r] = r.toLowerCase() === "url" ? Sn(i) : q(i, t + 1, s);
2761
+ te(r) ? n[r] = $ : n[r] = r.toLowerCase() === "url" ? Mn(i) : q(i, t + 1, s);
2693
2762
  return n;
2694
2763
  }
2695
- function Zt(e) {
2764
+ function te(e) {
2696
2765
  const t = e.replace(/[^a-z0-9]/gi, "").toLowerCase();
2697
2766
  return t.includes("authorization") || t.includes("cookie") || t.includes("password") || t.includes("passwd") || t === "pwd" || t.includes("secret") || t === "token" || t.endsWith("token") || t.includes("apikey") || t.includes("csrf") || t.includes("xsrf") || t === "jwt" || t === "session" || t === "signature" || t.includes("privatekey");
2698
2767
  }
2699
- function Sn(e) {
2700
- return typeof e == "string" ? Qt(e) : q(e, 0, /* @__PURE__ */ new WeakSet());
2768
+ function Mn(e) {
2769
+ return typeof e == "string" ? ee(e) : q(e, 0, /* @__PURE__ */ new WeakSet());
2701
2770
  }
2702
- function Qt(e) {
2771
+ function ee(e) {
2703
2772
  try {
2704
2773
  const t = new URL(e, location.href);
2705
2774
  for (const s of Array.from(t.searchParams.keys()))
2706
- Tn.test(s) && t.searchParams.set(s, R);
2775
+ Rn.test(s) && t.searchParams.set(s, R);
2707
2776
  return t.username && (t.username = R), t.password && (t.password = R), t.toString();
2708
2777
  } catch {
2709
- return kn(e);
2778
+ return Pn(e);
2710
2779
  }
2711
2780
  }
2712
2781
  function H(e) {
2713
- return e.replace(wn, mn).replace(In, En).replace(Kt, `Bearer ${R}`).replace(Jt, `Basic ${R}`).replace(Vt, R).replace(Yt, (t, s) => `${s}: ${$}`);
2782
+ return e.replace(Cn, kn).replace(_n, Un).replace(Yt, `Bearer ${R}`).replace(Vt, `Basic ${R}`).replace(Zt, R).replace(Qt, (t, s) => `${s}: ${$}`);
2714
2783
  }
2715
- function kn(e) {
2716
- return e.replace(Kt, `Bearer ${R}`).replace(Jt, `Basic ${R}`).replace(Vt, R).replace(Yt, (t, s) => `${s}: ${$}`);
2784
+ function Pn(e) {
2785
+ return e.replace(Yt, `Bearer ${R}`).replace(Vt, `Basic ${R}`).replace(Zt, R).replace(Qt, (t, s) => `${s}: ${$}`);
2717
2786
  }
2718
- function En(e) {
2719
- const t = e.match(An)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
2720
- return `${Qt(s)}${t}`;
2787
+ function Un(e) {
2788
+ const t = e.match(bn)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
2789
+ return `${ee(s)}${t}`;
2721
2790
  }
2722
2791
  export {
2723
- yt as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
2792
+ wt as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
2724
2793
  st as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
2725
- Ae as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
2726
- Ie as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
2727
- Se as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
2728
- Bt as PlunoProductAgent,
2794
+ Se as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
2795
+ Ae as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
2796
+ ke as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
2797
+ qt as PlunoProductAgent,
2729
2798
  ze as calculateReconnectDelay,
2730
- Bt as default,
2731
- rs as getProductAgentOriginAccessErrorMessage
2799
+ qt as default,
2800
+ ds as getProductAgentOriginAccessErrorMessage
2732
2801
  };