@gengage/assistant-fe 0.6.24 → 0.6.26

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.
Files changed (33) hide show
  1. package/dist/agentic/index.d.ts +1 -1
  2. package/dist/agentic/index.js +684 -639
  3. package/dist/agentic/types.d.ts +17 -2
  4. package/dist/agentic/worker.d.ts +1 -1
  5. package/dist/agentic/worker.js +294 -237
  6. package/dist/agentic.iife.js +8 -8
  7. package/dist/api-paths-CmFRzaMd.js +1274 -0
  8. package/dist/chat-runtime.js +1 -1
  9. package/dist/chat.iife.js +13 -13
  10. package/dist/chat.js +1 -1
  11. package/dist/{common-CzYj5Rg3.js → common-uHKZ-s5H.js} +1 -1
  12. package/dist/common.js +5 -5
  13. package/dist/{connection-warning-B1BbjAAP.js → connection-warning-xRmq7uJ3.js} +1 -1
  14. package/dist/{fastIntent-DtvKVSIo.js → fastIntent-B3qZhCis.js} +1 -1
  15. package/dist/index.js +10 -10
  16. package/dist/native.iife.js +11 -11
  17. package/dist/qna-runtime.js +1 -1
  18. package/dist/qna.iife.js +25 -25
  19. package/dist/qna.js +1 -1
  20. package/dist/{route-params-5KSvTyeb.js → route-params-UDemctx_.js} +330 -313
  21. package/dist/{runtime-C2RFDcMJ.js → runtime-C1mVW5y1.js} +4 -4
  22. package/dist/{runtime-BwKxrcVs.js → runtime-Cpi9hXiL.js} +3 -3
  23. package/dist/{runtime-DLqO5X8q.js → runtime-DhhnaNUQ.js} +3 -3
  24. package/dist/{simbut-C5AbbA4L.js → simbut-csGdfd9_.js} +1 -1
  25. package/dist/simbut.iife.js +1 -1
  26. package/dist/simbut.js +1 -1
  27. package/dist/{simrel-mH70kmF9.js → simrel-B1VHfhBf.js} +1 -1
  28. package/dist/simrel-runtime.js +1 -1
  29. package/dist/simrel.iife.js +38 -38
  30. package/dist/simrel.js +2 -2
  31. package/dist/{widget-base-Cfjsry5x.js → widget-base-DNT8SYtf.js} +1 -1
  32. package/package.json +1 -1
  33. package/dist/api-paths-Bgg7-gUO.js +0 -1235
@@ -1,10 +1,10 @@
1
- import { buildPhotoSimilarityProfile as lo, buildProductSimilarityProfile as uo, buildSimilarityQueries as fo, normalizeSimilarityText as po, rankSimilarProducts as mo, rankSimilarProductsAsync as go, scoreSimilarityCandidate as ho, tokenizeSimilarityText as bo } from "./algos/similarity.js";
2
- import { $ as wo, A as vo, B as ut, C as xo, D as ko, E as So, F as _o, G as To, H as Eo, I as Co, J as Ao, K as Lo, L as Ro, M as Po, N as jo, O as Io, P as Uo, Q as qo, R as No, S as Mo, T as Fo, U as Oo, V as Bo, W as ue, X as $o, Y as Do, Z as zo, _ as Go, _t as Ho, a as Wo, at as dt, b as Vo, c as ft, d as Ko, dt as Jo, et as Yo, f as Zo, ft as Qo, g as Xo, gt as pt, h as ei, ht as mt, i as ti, it as ri, j as ni, k as oi, l as ii, lt as gt, m as ai, mt as Me, n as si, nt as ht, o as ci, ot as li, p as ui, q as di, r as fi, rt as pi, s as mi, st as Fe, t as gi, tt as hi, u as bi, ut as yi, v as wi, vt as vi, w as xi, x as ki, y as Si, z as bt } from "../route-params-5KSvTyeb.js";
3
- var yt = 512, wt = 0.74;
4
- function vt({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: i, defaultLocale: a, tools: s = {}, beacon: c, confirmation: d, memory: f = Me() }) {
1
+ import { buildPhotoSimilarityProfile as bo, buildProductSimilarityProfile as yo, buildSimilarityQueries as wo, normalizeSimilarityText as vo, rankSimilarProducts as xo, rankSimilarProductsAsync as ko, scoreSimilarityCandidate as _o, tokenizeSimilarityText as Eo } from "./algos/similarity.js";
2
+ import { $ as To, A as Co, B as ft, C as Ao, D as Ro, E as Po, F as Lo, G as jo, H as No, I as Io, J as Uo, K as qo, L as Bo, M as Oo, N as $o, O as Mo, P as Fo, Q as Do, R as Go, S as zo, T as Ho, U as Wo, V as Vo, W as ue, X as Ko, Y as Jo, Z as Yo, _ as Zo, _t as Qo, a as Xo, at as pt, b as ei, c as mt, d as ti, dt as ri, et as ni, f as oi, ft as ii, g as ai, gt, h as si, ht, i as ci, it as li, j as ui, k as di, l as fi, lt as bt, m as pi, mt as Oe, n as mi, nt as yt, o as gi, ot as hi, p as bi, q as yi, r as wi, rt as vi, s as xi, st as $e, t as ki, tt as _i, u as Ei, ut as Si, v as Ti, vt as Ci, w as Ai, x as Ri, y as Pi, z as wt } from "../route-params-UDemctx_.js";
3
+ var vt = 512, xt = 0.74;
4
+ function kt({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: i, defaultLocale: a, tools: s = {}, beacon: c, confirmation: d, memory: f = Oe() }) {
5
5
  let b = 1;
6
6
  const m = /* @__PURE__ */ new Map();
7
- return mt({
7
+ return ht({
8
8
  worker: t,
9
9
  tools: s,
10
10
  beacon: (l) => c?.({
@@ -14,7 +14,12 @@ function vt({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl
14
14
  ...d ? { confirmation: d } : {},
15
15
  memory: f
16
16
  }), t.addEventListener("message", (l) => {
17
- const p = l.data || {}, g = typeof p.id == "number" ? p.id : null;
17
+ const p = l.data || {};
18
+ if (p.type === "activity" && p.entry) {
19
+ Me(p.entry);
20
+ return;
21
+ }
22
+ const g = typeof p.id == "number" ? p.id : null;
18
23
  if (g == null) return;
19
24
  const u = m.get(g);
20
25
  if (u) {
@@ -51,7 +56,8 @@ function vt({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl
51
56
  tokenBrokerAudience: i,
52
57
  defaultLocale: a,
53
58
  request: v,
54
- parentUrl: window.location.href
59
+ parentUrl: window.location.href,
60
+ debugActivity: _t()
55
61
  });
56
62
  };
57
63
  if (g.aborted) {
@@ -59,7 +65,7 @@ function vt({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl
59
65
  return;
60
66
  }
61
67
  if (g.addEventListener("abort", w, { once: !0 }), u) {
62
- Oe(l, u).then(k).catch((v) => {
68
+ Fe(l, u).then(k).catch((v) => {
63
69
  m.delete(h), p.onError(v instanceof Error ? v : /* @__PURE__ */ new Error("Failed to read image attachment"));
64
70
  });
65
71
  return;
@@ -67,23 +73,31 @@ function vt({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl
67
73
  k(l);
68
74
  };
69
75
  }
70
- function xt({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: i, defaultLocale: a, tools: s = {}, beacon: c, confirmation: d, memory: f }) {
76
+ function Me(e) {
77
+ const t = window;
78
+ (t.__GENGAGE_AGENTIC_DEBUG_RECORD__ || t.__GENGAGE_AGENTIC_DEBUG_RECORD_BE__)?.(e);
79
+ }
80
+ function _t() {
81
+ const e = window;
82
+ return typeof (e.__GENGAGE_AGENTIC_DEBUG_RECORD__ || e.__GENGAGE_AGENTIC_DEBUG_RECORD_BE__) == "function";
83
+ }
84
+ function Et({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: i, defaultLocale: a, tools: s = {}, beacon: c, confirmation: d, memory: f }) {
71
85
  let b = null;
72
- const m = kt({
86
+ const m = St({
73
87
  accountId: e,
74
88
  tools: s,
75
89
  beacon: c,
76
90
  confirmation: d,
77
- memory: f ?? Me()
78
- }), l = bt(m), p = Fe({
91
+ memory: f ?? Oe()
92
+ }), l = wt(m), p = $e({
79
93
  accountId: e,
80
94
  ...n ? { devJwtSecret: n } : {},
81
95
  ...o ? { tokenBrokerUrl: o } : {},
82
96
  ...i ? { tokenBrokerAudience: i } : {}
83
97
  });
84
98
  return async (g, u, h, w) => {
85
- const k = await Oe(g || {}, w);
86
- b ||= new gt({
99
+ const k = await Fe(g || {}, w);
100
+ b ||= new bt({
87
101
  accountId: e,
88
102
  locale: k?.locale || a,
89
103
  parentUrl: window.location.href,
@@ -95,23 +109,29 @@ function xt({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBr
95
109
  threadTtlMs: t.contextPersistence?.threadTtlMs
96
110
  });
97
111
  try {
98
- await ut({
112
+ await ft({
99
113
  request: k,
100
114
  accountModule: {
101
115
  ...t,
102
- accountId: e
116
+ accountId: e,
117
+ trace: async (v) => {
118
+ Me({
119
+ kind: "flow/trace",
120
+ event: v
121
+ }), await t.trace?.(v);
122
+ }
103
123
  },
104
124
  contextStore: b,
105
- beClient: { invoke({ op: v, input: E, signal: x, cacheTtlS: C, cacheKey: O, browserCache: z }) {
106
- return ht({
125
+ beClient: { invoke({ op: v, input: T, signal: x, cacheTtlS: C, cacheKey: M, browserCache: z }) {
126
+ return yt({
107
127
  beUrl: r,
108
128
  accountId: e,
109
129
  jwtProvider: p,
110
130
  parentUrl: window.location.href,
111
131
  op: v,
112
- input: E,
132
+ input: T,
113
133
  cacheTtlS: C,
114
- cacheKey: O,
134
+ cacheKey: M,
115
135
  browserCache: z,
116
136
  ...x ? { signal: x } : {}
117
137
  });
@@ -122,26 +142,26 @@ function xt({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBr
122
142
  signal: h
123
143
  });
124
144
  } catch (v) {
125
- h?.aborted || (oe(u, dt(v)), u.onDone());
145
+ h?.aborted || (oe(u, pt(v)), u.onDone());
126
146
  }
127
147
  };
128
148
  }
129
- function kt({ accountId: e, tools: t, beacon: r, confirmation: n, memory: o }) {
149
+ function St({ accountId: e, tools: t, beacon: r, confirmation: n, memory: o }) {
130
150
  const i = (a) => r?.({
131
151
  ...a,
132
152
  accountId: a.accountId || e
133
153
  });
134
- return ((a, s) => pt(a, s, {
154
+ return ((a, s) => gt(a, s, {
135
155
  tools: t,
136
156
  beacon: i,
137
157
  confirmation: n,
138
158
  memory: o
139
159
  }));
140
160
  }
141
- async function Oe(e, t) {
161
+ async function Fe(e, t) {
142
162
  if (!t || !t.type?.startsWith("image/")) return e;
143
- const r = await Tt(t), n = {
144
- ...St(e.payload ?? e.action?.payload),
163
+ const r = await At(t), n = {
164
+ ...Tt(e.payload ?? e.action?.payload),
145
165
  image_data_url: r.dataUrl,
146
166
  image_mime: r.mime
147
167
  };
@@ -154,32 +174,32 @@ async function Oe(e, t) {
154
174
  } } : {}
155
175
  };
156
176
  }
157
- function St(e) {
158
- return _t(e) ? { ...e } : typeof e == "string" ? { text: e } : {};
177
+ function Tt(e) {
178
+ return Ct(e) ? { ...e } : typeof e == "string" ? { text: e } : {};
159
179
  }
160
- function _t(e) {
180
+ function Ct(e) {
161
181
  return typeof e == "object" && e !== null && !Array.isArray(e);
162
182
  }
163
- async function Tt(e) {
164
- const t = await Et(e);
183
+ async function At(e) {
184
+ const t = await Rt(e);
165
185
  return t || {
166
- dataUrl: await Be(e),
186
+ dataUrl: await De(e),
167
187
  mime: e.type
168
188
  };
169
189
  }
170
- async function Et(e) {
190
+ async function Rt(e) {
171
191
  if (typeof createImageBitmap != "function" || typeof document > "u") return null;
172
192
  let t = null;
173
193
  try {
174
194
  t = await createImageBitmap(e);
175
- const r = Math.min(1, yt / Math.max(t.width, t.height)), n = Math.max(1, Math.round(t.width * r)), o = Math.max(1, Math.round(t.height * r)), i = document.createElement("canvas");
195
+ const r = Math.min(1, vt / Math.max(t.width, t.height)), n = Math.max(1, Math.round(t.width * r)), o = Math.max(1, Math.round(t.height * r)), i = document.createElement("canvas");
176
196
  i.width = n, i.height = o;
177
197
  const a = i.getContext("2d");
178
198
  if (!a) return null;
179
199
  a.drawImage(t, 0, 0, n, o);
180
- const s = await new Promise((c) => i.toBlob(c, "image/jpeg", wt));
200
+ const s = await new Promise((c) => i.toBlob(c, "image/jpeg", xt));
181
201
  return s ? {
182
- dataUrl: await Be(s),
202
+ dataUrl: await De(s),
183
203
  mime: s.type || "image/jpeg"
184
204
  } : null;
185
205
  } catch {
@@ -188,7 +208,7 @@ async function Et(e) {
188
208
  t?.close();
189
209
  }
190
210
  }
191
- async function Be(e) {
211
+ async function De(e) {
192
212
  const t = new Uint8Array(await e.arrayBuffer());
193
213
  let r = "";
194
214
  const n = 32768;
@@ -214,7 +234,7 @@ function oe(e, t) {
214
234
  e.onMetadata(t);
215
235
  break;
216
236
  case "error":
217
- e.onError(Ct(t));
237
+ e.onError(Pt(t));
218
238
  break;
219
239
  case "done":
220
240
  e.onDone();
@@ -223,16 +243,16 @@ function oe(e, t) {
223
243
  break;
224
244
  }
225
245
  }
226
- function Ct(e) {
246
+ function Pt(e) {
227
247
  const t = new Error(e.message || e.code || "Agent error");
228
248
  return e.code && (t.code = e.code), t;
229
249
  }
230
- var At = "entries", Lt = 1, Rt = {
250
+ var Lt = "entries", jt = 1, Nt = {
231
251
  volatile: "Hot per-page state and sensitive request context.",
232
252
  session: "Current-visit tool context without raw tokens or PII-heavy payloads.",
233
253
  local: "Small, non-sensitive capability facts or user preferences.",
234
254
  indexedDb: "Larger product/search payload caches with short TTLs."
235
- }, Se = /* @__PURE__ */ new Map();
255
+ }, _e = /* @__PURE__ */ new Map();
236
256
  function ie() {
237
257
  return Date.now();
238
258
  }
@@ -246,7 +266,7 @@ function de(e, t) {
246
266
  expiresAt: t ? ie() + t : null
247
267
  };
248
268
  }
249
- function Pt(e, t, r) {
269
+ function It(e, t, r) {
250
270
  try {
251
271
  const n = e.getItem(`${t}${r}`);
252
272
  if (!n) return null;
@@ -256,20 +276,20 @@ function Pt(e, t, r) {
256
276
  return null;
257
277
  }
258
278
  }
259
- function jt(e, t, r, n, o) {
279
+ function Ut(e, t, r, n, o) {
260
280
  try {
261
281
  return e.setItem(`${t}${r}`, JSON.stringify(de(n, o))), !0;
262
282
  } catch {
263
283
  return !1;
264
284
  }
265
285
  }
266
- function It(e, t, r) {
286
+ function qt(e, t, r) {
267
287
  try {
268
288
  e.removeItem(`${t}${r}`);
269
289
  } catch {
270
290
  }
271
291
  }
272
- function _e(e, t) {
292
+ function Ee(e, t) {
273
293
  if (!e) return 0;
274
294
  let r = 0;
275
295
  try {
@@ -289,18 +309,18 @@ function _e(e, t) {
289
309
  }
290
310
  return r;
291
311
  }
292
- function Te(e) {
312
+ function Se(e) {
293
313
  try {
294
314
  return window[e];
295
315
  } catch {
296
316
  return null;
297
317
  }
298
318
  }
299
- function Ee(e, t) {
319
+ function Te(e, t) {
300
320
  return e ? {
301
- get: (r) => Pt(e, t, r),
302
- set: (r, n, o = {}) => jt(e, t, r, n, o.ttlMs),
303
- remove: (r) => It(e, t, r)
321
+ get: (r) => It(e, t, r),
322
+ set: (r, n, o = {}) => Ut(e, t, r, n, o.ttlMs),
323
+ remove: (r) => qt(e, t, r)
304
324
  } : {
305
325
  get: () => null,
306
326
  set: () => !1,
@@ -308,8 +328,8 @@ function Ee(e, t) {
308
328
  }
309
329
  };
310
330
  }
311
- function Ut(e, t) {
312
- const r = t.dbName || `gengage-${e}`, n = t.dbStore || At, o = t.dbVersion || Lt, i = /* @__PURE__ */ new Map();
331
+ function Bt(e, t) {
332
+ const r = t.dbName || `gengage-${e}`, n = t.dbStore || Lt, o = t.dbVersion || jt, i = /* @__PURE__ */ new Map();
313
333
  let a = null;
314
334
  const s = () => "indexedDB" in window ? a || (a = new Promise((m) => {
315
335
  const l = indexedDB.open(r, o);
@@ -362,12 +382,12 @@ function Ut(e, t) {
362
382
  }
363
383
  };
364
384
  }
365
- function $e(e, t = {}) {
385
+ function Ge(e, t = {}) {
366
386
  const r = window, n = r.gengage || (r.gengage = {}), o = n.memory || (n.memory = {}), i = o[e];
367
387
  if (i) return i;
368
- const a = Se.get(e) || Ut(e, t);
369
- Se.set(e, a);
370
- const s = t.sessionPrefix || `gengage:${e}:session:`, c = t.localPrefix || `gengage:${e}:local:`, d = Te("sessionStorage"), f = Te("localStorage"), m = {
388
+ const a = _e.get(e) || Bt(e, t);
389
+ _e.set(e, a);
390
+ const s = t.sessionPrefix || `gengage:${e}:session:`, c = t.localPrefix || `gengage:${e}:local:`, d = Se("sessionStorage"), f = Se("localStorage"), m = {
371
391
  get: (u) => {
372
392
  const h = a.volatileEntries.get(u);
373
393
  return h ? U(h) ? (a.volatileEntries.delete(u), null) : h.value : null;
@@ -383,9 +403,9 @@ function $e(e, t = {}) {
383
403
  remove: a.idbRemove
384
404
  }, p = async () => {
385
405
  let u = 0;
386
- for (const [v, E] of a.volatileEntries)
387
- U(E) && (a.volatileEntries.delete(v), u += 1);
388
- const h = _e(d, s), w = _e(f, c), k = await a.idbGc();
406
+ for (const [v, T] of a.volatileEntries)
407
+ U(T) && (a.volatileEntries.delete(v), u += 1);
408
+ const h = Ee(d, s), w = Ee(f, c), k = await a.idbGc();
389
409
  return {
390
410
  volatile: u,
391
411
  session: h,
@@ -395,21 +415,21 @@ function $e(e, t = {}) {
395
415
  }, g = {
396
416
  accountId: e,
397
417
  volatile: m,
398
- session: Ee(d, s),
399
- local: Ee(f, c),
418
+ session: Te(d, s),
419
+ local: Te(f, c),
400
420
  indexedDb: l,
401
421
  gc: p,
402
422
  stableKey: ue,
403
423
  policy: {
404
- ...Rt,
424
+ ...Nt,
405
425
  ...t.policy || {}
406
426
  }
407
427
  };
408
428
  o[e] = g;
409
429
  for (const u of t.aliases || []) o[u] = g;
410
- return qt(g), g;
430
+ return Ot(g), g;
411
431
  }
412
- function qt(e) {
432
+ function Ot(e) {
413
433
  const t = window, r = () => {
414
434
  e.gc().catch(() => {
415
435
  });
@@ -420,11 +440,11 @@ function qt(e) {
420
440
  }
421
441
  setTimeout(r, 5e3);
422
442
  }
423
- var W = "__gengageAgentFetchBridge", Nt = 1e3 * 60 * 60 * 24 * 14;
424
- function _i({ accountId: e, streamTransport: t, endpoints: r = {}, endpointCache: n }) {
443
+ var V = "__gengageAgentFetchBridge", $t = 1e3 * 60 * 60 * 24 * 14;
444
+ function Li({ accountId: e, streamTransport: t, endpoints: r = {}, endpointCache: n }) {
425
445
  if (!e) throw new Error("accountId is required.");
426
446
  if (typeof t != "function") throw new Error("streamTransport is required.");
427
- const o = Mt(), i = `https://gengage-injector.invalid/${encodeURIComponent(e)}`, a = /* @__PURE__ */ new Set(), s = n ? zt({
447
+ const o = Mt(), i = `https://gengage-injector.invalid/${encodeURIComponent(e)}`, a = /* @__PURE__ */ new Set(), s = n ? Wt({
428
448
  accountId: e,
429
449
  endpointCache: n,
430
450
  fetchImpl: o.originalFetch
@@ -448,7 +468,7 @@ function _i({ accountId: e, streamTransport: t, endpoints: r = {}, endpointCache
448
468
  };
449
469
  }
450
470
  function Mt() {
451
- const e = window, t = e[W];
471
+ const e = window, t = e[V];
452
472
  if (t) return t;
453
473
  const r = e.fetch.bind(e), n = {
454
474
  routes: /* @__PURE__ */ new Map(),
@@ -456,27 +476,27 @@ function Mt() {
456
476
  installedFetch: r
457
477
  };
458
478
  return n.installedFetch = (o, i) => {
459
- const a = De(o), s = n.routes.get(a);
460
- return s ? Bt(s, o, i) : r(o, i);
461
- }, e.fetch = n.installedFetch, e[W] = n, n;
479
+ const a = ze(o), s = n.routes.get(a);
480
+ return s ? Gt(s, o, i) : r(o, i);
481
+ }, e.fetch = n.installedFetch, e[V] = n, n;
462
482
  }
463
483
  function Ft(e) {
464
484
  if (e.routes.size > 0) return;
465
485
  const t = window;
466
- t.fetch === e.installedFetch && (t.fetch = e.originalFetch), t[W] === e && delete t[W];
486
+ t.fetch === e.installedFetch && (t.fetch = e.originalFetch), t[V] === e && delete t[V];
467
487
  }
468
- function De(e) {
488
+ function ze(e) {
469
489
  return typeof e == "string" ? e : e instanceof URL ? e.href : e?.url || "";
470
490
  }
471
491
  function Ce(e, t) {
472
492
  if (t?.signal) return t.signal;
473
493
  if (typeof Request < "u" && e instanceof Request) return e.signal;
474
494
  }
475
- function ze(e, t) {
495
+ function He(e, t) {
476
496
  return t?.body !== void 0 && t?.body !== null ? t.body : typeof Request < "u" && e instanceof Request ? e.clone().text() : null;
477
497
  }
478
- async function Ot(e, t) {
479
- const r = ze(e, t);
498
+ async function Dt(e, t) {
499
+ const r = He(e, t);
480
500
  if (r instanceof FormData) {
481
501
  const o = r.get("request"), i = r.get("attachment");
482
502
  return {
@@ -487,7 +507,7 @@ async function Ot(e, t) {
487
507
  const n = await Promise.resolve(r);
488
508
  return typeof n == "string" ? { request: JSON.parse(n || "{}") } : { request: {} };
489
509
  }
490
- async function Bt(e, t, r) {
510
+ async function Gt(e, t, r) {
491
511
  if (e.endpoint && e.endpoint !== "process_action" && e.endpointHandler) {
492
512
  const d = new AbortController(), f = Ce(t, r);
493
513
  let b = null;
@@ -496,17 +516,17 @@ async function Bt(e, t, r) {
496
516
  f.aborted && m(), f.addEventListener("abort", m, { once: !0 }), b = () => f.removeEventListener("abort", m);
497
517
  }
498
518
  try {
499
- const m = await $t(t, r), l = {
500
- accountId: Dt(t),
519
+ const m = await zt(t, r), l = {
520
+ accountId: Ht(t),
501
521
  endpoint: e.endpoint,
502
522
  signal: d.signal
503
- }, p = Gt(e.endpointCache, e.endpoint, m, l.accountId);
523
+ }, p = Vt(e.endpointCache, e.endpoint, m, l.accountId);
504
524
  if (p) {
505
- const u = await Ht(e.endpointCache, p, d.signal);
506
- if (u) return Zt(u);
525
+ const u = await Kt(e.endpointCache, p, d.signal);
526
+ if (u) return er(u);
507
527
  }
508
528
  const g = await e.endpointHandler(m, l);
509
- return p && g.ok && await Wt(e.endpointCache, p, g.clone(), d.signal), g;
529
+ return p && g.ok && await Jt(e.endpointCache, p, g.clone(), d.signal), g;
510
530
  } finally {
511
531
  b?.();
512
532
  }
@@ -538,7 +558,7 @@ async function Bt(e, t, r) {
538
558
  i.addEventListener("abort", l, { once: !0 }), s = () => i.removeEventListener("abort", l);
539
559
  }
540
560
  try {
541
- const { request: l, attachment: p } = await Ot(t, r), g = e.streamTransport(l, {
561
+ const { request: l, attachment: p } = await Dt(t, r), g = e.streamTransport(l, {
542
562
  onTextChunk: (u, h, w = {}) => f({
543
563
  type: "text_chunk",
544
564
  content: u,
@@ -569,7 +589,7 @@ async function Bt(e, t, r) {
569
589
  f({ type: "done" }), b();
570
590
  }
571
591
  }, o.signal, p);
572
- tr(g) && (await g, o.signal.aborted || (f({ type: "done" }), b()));
592
+ or(g) && (await g, o.signal.aborted || (f({ type: "done" }), b()));
573
593
  } catch (l) {
574
594
  o.signal.aborted || m(l);
575
595
  }
@@ -583,27 +603,27 @@ async function Bt(e, t, r) {
583
603
  headers: { "Content-Type": "application/x-ndjson" }
584
604
  });
585
605
  }
586
- async function $t(e, t) {
587
- const r = await Promise.resolve(ze(e, t));
606
+ async function zt(e, t) {
607
+ const r = await Promise.resolve(He(e, t));
588
608
  return typeof r != "string" || r.trim() === "" ? {} : JSON.parse(r);
589
609
  }
590
- function Dt(e) {
610
+ function Ht(e) {
591
611
  try {
592
- const [t] = new URL(De(e)).pathname.split("/").filter(Boolean);
612
+ const [t] = new URL(ze(e)).pathname.split("/").filter(Boolean);
593
613
  return decodeURIComponent(t || "");
594
614
  } catch {
595
615
  return "";
596
616
  }
597
617
  }
598
- function zt({ accountId: e, endpointCache: t, fetchImpl: r }) {
618
+ function Wt({ accountId: e, endpointCache: t, fetchImpl: r }) {
599
619
  return {
600
620
  accountId: e,
601
621
  beUrl: t.beUrl,
602
622
  ...t.parentUrl ? { parentUrl: t.parentUrl } : {},
603
- ttlMs: t.ttlMs ?? Nt,
623
+ ttlMs: t.ttlMs ?? $t,
604
624
  policies: t.policies,
605
625
  fetchImpl: r,
606
- jwtProvider: Fe({
626
+ jwtProvider: $e({
607
627
  accountId: e,
608
628
  ...t.devJwtSecret ? { devJwtSecret: t.devJwtSecret } : {},
609
629
  ...t.tokenBrokerUrl ? { tokenBrokerUrl: t.tokenBrokerUrl } : {},
@@ -612,7 +632,7 @@ function zt({ accountId: e, endpointCache: t, fetchImpl: r }) {
612
632
  })
613
633
  };
614
634
  }
615
- function Gt(e, t, r, n) {
635
+ function Vt(e, t, r, n) {
616
636
  if (!e) return null;
617
637
  const o = e.policies[t];
618
638
  if (!o) return null;
@@ -626,26 +646,26 @@ function Gt(e, t, r, n) {
626
646
  ttlMs: i.ttlMs ?? e.ttlMs
627
647
  };
628
648
  }
629
- async function Ht(e, t, r) {
630
- const n = Ve(e.accountId, t), o = await Qt(e.accountId, n);
631
- if (We(o)) return o;
632
- const i = await Vt(e, t, r);
633
- return i ? (await Ke(e.accountId, n, i, t.ttlMs), i) : null;
649
+ async function Kt(e, t, r) {
650
+ const n = Je(e.accountId, t), o = await tr(e.accountId, n);
651
+ if (Ke(o)) return o;
652
+ const i = await Yt(e, t, r);
653
+ return i ? (await Ye(e.accountId, n, i, t.ttlMs), i) : null;
634
654
  }
635
- async function Wt(e, t, r, n) {
655
+ async function Jt(e, t, r, n) {
636
656
  try {
637
- const o = await Yt(r);
638
- if (er(o.body)) return;
639
- const i = Ve(e.accountId, t);
640
- await Ke(e.accountId, i, o, t.ttlMs), Kt(e, t, o, n);
657
+ const o = await Xt(r);
658
+ if (nr(o.body)) return;
659
+ const i = Je(e.accountId, t);
660
+ await Ye(e.accountId, i, o, t.ttlMs), Zt(e, t, o, n);
641
661
  } catch {
642
662
  }
643
663
  }
644
- async function Vt(e, t, r) {
664
+ async function Yt(e, t, r) {
645
665
  try {
646
- const n = await e.fetchImpl(He(e.beUrl), {
666
+ const n = await e.fetchImpl(Ve(e.beUrl), {
647
667
  method: "POST",
648
- headers: await Ge(e, r),
668
+ headers: await We(e, r),
649
669
  body: JSON.stringify({
650
670
  partition: t.partition,
651
671
  key: t.key
@@ -654,16 +674,16 @@ async function Vt(e, t, r) {
654
674
  });
655
675
  if (!n.ok) return null;
656
676
  const o = await n.json();
657
- return o.hit === !0 && We(o.payload) ? o.payload : null;
677
+ return o.hit === !0 && Ke(o.payload) ? o.payload : null;
658
678
  } catch {
659
679
  return null;
660
680
  }
661
681
  }
662
- async function Kt(e, t, r, n) {
682
+ async function Zt(e, t, r, n) {
663
683
  try {
664
- await e.fetchImpl(He(e.beUrl), {
684
+ await e.fetchImpl(Ve(e.beUrl), {
665
685
  method: "POST",
666
- headers: await Ge(e, n),
686
+ headers: await We(e, n),
667
687
  body: JSON.stringify({
668
688
  partition: t.partition,
669
689
  key: t.key,
@@ -675,84 +695,84 @@ async function Kt(e, t, r, n) {
675
695
  } catch {
676
696
  }
677
697
  }
678
- async function Ge(e, t) {
698
+ async function We(e, t) {
679
699
  return {
680
700
  authorization: `Bearer ${await e.jwtProvider({
681
701
  signal: t,
682
- parentUrl: e.parentUrl || Jt()
702
+ parentUrl: e.parentUrl || Qt()
683
703
  })}`,
684
704
  "content-type": "application/json",
685
705
  accept: "application/json"
686
706
  };
687
707
  }
688
- function Jt() {
708
+ function Qt() {
689
709
  try {
690
710
  return window.location?.href || "";
691
711
  } catch {
692
712
  return "";
693
713
  }
694
714
  }
695
- function He(e) {
715
+ function Ve(e) {
696
716
  return `${String(e).replace(/\/+$/u, "")}/v1/cache`;
697
717
  }
698
- async function Yt(e) {
718
+ async function Xt(e) {
699
719
  return {
700
720
  status: e.status,
701
721
  statusText: e.statusText,
702
- headers: [...e.headers.entries()].filter(([t]) => Xt(t)),
722
+ headers: [...e.headers.entries()].filter(([t]) => rr(t)),
703
723
  body: await e.text()
704
724
  };
705
725
  }
706
- function Zt(e) {
726
+ function er(e) {
707
727
  return new Response(e.body, {
708
728
  status: e.status,
709
729
  statusText: e.statusText,
710
730
  headers: new Headers(e.headers)
711
731
  });
712
732
  }
713
- function We(e) {
733
+ function Ke(e) {
714
734
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
715
735
  const t = e;
716
736
  return typeof t.status == "number" && typeof t.statusText == "string" && typeof t.body == "string" && Array.isArray(t.headers);
717
737
  }
718
- function Ve(e, t) {
738
+ function Je(e, t) {
719
739
  return `endpoint-response:${ue({
720
740
  accountId: e,
721
741
  partition: t.partition,
722
742
  key: t.key
723
743
  })}`;
724
744
  }
725
- async function Qt(e, t) {
726
- const r = $e(e);
745
+ async function tr(e, t) {
746
+ const r = Ge(e);
727
747
  return r.volatile.get(t) || await r.indexedDb.get(t) || r.local.get(t);
728
748
  }
729
- async function Ke(e, t, r, n) {
730
- const o = $e(e);
749
+ async function Ye(e, t, r, n) {
750
+ const o = Ge(e);
731
751
  o.volatile.set(t, r, { ttlMs: n }), await o.indexedDb.set(t, r, { ttlMs: n }) || o.local.set(t, r, { ttlMs: n });
732
752
  }
733
- function Xt(e) {
753
+ function rr(e) {
734
754
  return ["content-type", "cache-control"].includes(e.toLowerCase());
735
755
  }
736
- function er(e) {
756
+ function nr(e) {
737
757
  return /"_error"\s*:/u.test(e) || /"type"\s*:\s*"error"/u.test(e);
738
758
  }
739
- function tr(e) {
759
+ function or(e) {
740
760
  return e !== null && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
741
761
  }
742
- function Ti({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenBrokerAudience: o, workerUrl: i, defaultLocale: a = "en-GB", accountModule: s, tools: c = {}, beacon: d, confirmation: f, memory: b, allowBlobWorker: m = !1, signal: l }) {
762
+ function ji({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenBrokerAudience: o, workerUrl: i, defaultLocale: a = "en-GB", accountModule: s, tools: c = {}, beacon: d, confirmation: f, memory: b, allowBlobWorker: m = !1, signal: l }) {
743
763
  if (!e) throw new Error("accountId is required.");
744
764
  if (!t) throw new Error("beUrl is required. The injector owns backend URLs; the SDK has no default.");
745
765
  if (!i) throw new Error("workerUrl is required.");
746
766
  const p = window, g = p.GengageAssistantInjector || (p.GengageAssistantInjector = {}), u = g[e] || (g[e] = {});
747
767
  if (u.agentController) return u.agentController;
748
- const h = Je(i) || m ? rr(i, `gengage-${e}-agent`, { allowBlobWorker: m }) : null;
768
+ const h = Ze(i) || m ? ir(i, `gengage-${e}-agent`, { allowBlobWorker: m }) : null;
749
769
  h || d?.({
750
770
  type: "agentRuntime",
751
771
  accountId: e,
752
772
  transport: "main-thread",
753
773
  reason: "cross-origin-worker-url",
754
774
  workerUrl: i
755
- }), u.streamTransport = h ? vt({
775
+ }), u.streamTransport = h ? kt({
756
776
  accountId: e,
757
777
  worker: h.worker,
758
778
  beUrl: t,
@@ -764,7 +784,7 @@ function Ti({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
764
784
  ...d ? { beacon: d } : {},
765
785
  ...f ? { confirmation: f } : {},
766
786
  ...b ? { memory: b } : {}
767
- }) : xt({
787
+ }) : Et({
768
788
  accountId: e,
769
789
  accountModule: s,
770
790
  beUrl: t,
@@ -785,10 +805,10 @@ function Ti({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
785
805
  } catch {
786
806
  }
787
807
  }
788
- }, E = () => {
789
- w.signal.aborted || (w.abort(), l?.removeEventListener("abort", E), delete u.streamTransport, h?.worker.terminate(), h?.cleanup(), v(), delete u.agentController);
808
+ }, T = () => {
809
+ w.signal.aborted || (w.abort(), l?.removeEventListener("abort", T), delete u.streamTransport, h?.worker.terminate(), h?.cleanup(), v(), delete u.agentController);
790
810
  };
791
- l?.addEventListener("abort", E, { once: !0 });
811
+ l?.addEventListener("abort", T, { once: !0 });
792
812
  const x = {
793
813
  type: "agent",
794
814
  signal: w.signal,
@@ -801,7 +821,7 @@ function Ti({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
801
821
  k.push(C);
802
822
  }
803
823
  },
804
- stop: E,
824
+ stop: T,
805
825
  diagnostics() {
806
826
  return {
807
827
  accountId: e,
@@ -816,13 +836,13 @@ function Ti({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
816
836
  };
817
837
  return u.agentController = x, x;
818
838
  }
819
- function Je(e) {
839
+ function Ze(e) {
820
840
  const t = new URL(e, window.location.href);
821
841
  return t.origin === window.location.origin || t.protocol === "blob:";
822
842
  }
823
- function rr(e, t, r = {}) {
843
+ function ir(e, t, r = {}) {
824
844
  const n = new URL(e, window.location.href);
825
- if (Je(e)) return {
845
+ if (Ze(e)) return {
826
846
  worker: new Worker(n.href, {
827
847
  type: "module",
828
848
  name: t
@@ -847,16 +867,16 @@ function rr(e, t, r = {}) {
847
867
  throw URL.revokeObjectURL(i), a;
848
868
  }
849
869
  }
850
- function nr(e, t, r = "v1") {
870
+ function ar(e, t, r = "v1") {
851
871
  return `endpoint:${r}:${ue({
852
872
  endpoint: e,
853
873
  request: t
854
874
  })}`;
855
875
  }
856
- function Ei(e) {
876
+ function Ni(e) {
857
877
  const t = e.version || "v1", r = (n) => (o) => ({
858
878
  partition: `${e.partitionPrefix}/${n}`,
859
- key: nr(n, o, t),
879
+ key: ar(n, o, t),
860
880
  ...e.ttlMs ? { ttlMs: e.ttlMs } : {}
861
881
  });
862
882
  return {
@@ -865,10 +885,10 @@ function Ei(e) {
865
885
  product_groupings: r("product_groupings")
866
886
  };
867
887
  }
868
- function Ci(e) {
888
+ function Ii(e) {
869
889
  return { ...e };
870
890
  }
871
- function Ai(e, t = {}) {
891
+ function Ui(e, t = {}) {
872
892
  return new Response(e.map((r) => JSON.stringify(r)).join(`
873
893
  `) + `
874
894
  `, {
@@ -879,7 +899,7 @@ function Ai(e, t = {}) {
879
899
  }
880
900
  });
881
901
  }
882
- function Li(e, t = {}) {
902
+ function qi(e, t = {}) {
883
903
  return new Response(JSON.stringify(e), {
884
904
  ...t,
885
905
  headers: {
@@ -888,23 +908,23 @@ function Li(e, t = {}) {
888
908
  }
889
909
  });
890
910
  }
891
- function or(e) {
911
+ function sr(e) {
892
912
  const t = (e?.chat || e?._chat)?.root || e?._chat?.root;
893
913
  return t ? t.getRootNode?.()?.host || t : Array.from(document.querySelectorAll("*")).find((r) => r.shadowRoot?.querySelector?.(".gengage-chat-root, .gengage-chat-launcher-container"));
894
914
  }
895
- function Ri(e, t) {
896
- const r = or(e);
915
+ function Bi(e, t) {
916
+ const r = sr(e);
897
917
  r?.style && (t ? r.style.removeProperty("display") : r.style.setProperty("display", "none", "important")), t || (e?.chat || e?._chat)?.close?.();
898
918
  }
899
- var ir = "nd_be_url";
900
- function Pi(e, t) {
901
- const r = ar() || e.beUrl || t;
919
+ var cr = "nd_be_url";
920
+ function Oi(e, t) {
921
+ const r = lr() || e.beUrl || t;
902
922
  if (!r) throw new Error("resolveBeUrl: backend URL is required. The injector must supply a fallback URL; the SDK has no default.");
903
923
  return r;
904
924
  }
905
- function ar() {
925
+ function lr() {
906
926
  try {
907
- const e = new URLSearchParams(window.location.search).get(ir)?.trim();
927
+ const e = new URLSearchParams(window.location.search).get(cr)?.trim();
908
928
  if (!e) return null;
909
929
  const t = new URL(e);
910
930
  return t.protocol !== "https:" && t.protocol !== "http:" ? null : t.toString().replace(/\/+$/u, "");
@@ -912,7 +932,7 @@ function ar() {
912
932
  return null;
913
933
  }
914
934
  }
915
- var sr = [
935
+ var ur = [
916
936
  "addToCart",
917
937
  "search",
918
938
  "searchKeyword",
@@ -920,17 +940,17 @@ var sr = [
920
940
  "searchGiftOptions",
921
941
  "similaritySearch"
922
942
  ];
923
- function ji(e, t, r = {}) {
943
+ function $i(e, t, r = {}) {
924
944
  const n = window, o = n.gengage || (n.gengage = {}), i = o.tools || (o.tools = {});
925
945
  i[e] = t;
926
946
  for (const a of r.accountAliases || []) i[a] = t;
927
- if (r.exposeStandardAliases !== !1) for (const a of r.standardAliases || sr) {
947
+ if (r.exposeStandardAliases !== !1) for (const a of r.standardAliases || ur) {
928
948
  const s = t[a];
929
949
  typeof s == "function" && (i[a] = i[a] || s);
930
950
  }
931
951
  return t;
932
952
  }
933
- function Ii({ getPageType: e, getProduct: t }) {
953
+ function Mi({ getPageType: e, getProduct: t }) {
934
954
  return () => ({
935
955
  url: window.location.href,
936
956
  title: document.title,
@@ -938,7 +958,7 @@ function Ii({ getPageType: e, getProduct: t }) {
938
958
  product: t()
939
959
  });
940
960
  }
941
- function Ui({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getSearchCapabilities: o, getMemory: i }) {
961
+ function Fi({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getSearchCapabilities: o, getMemory: i }) {
942
962
  return async () => ({
943
963
  accountId: e,
944
964
  url: window.location.href,
@@ -950,7 +970,7 @@ function Ui({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getS
950
970
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
951
971
  });
952
972
  }
953
- function qi({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "start", globalBaseUrlKey: n, errorLabel: o, trustedRuntimeOrigins: i } = {}) {
973
+ function Di({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "start", globalBaseUrlKey: n, errorLabel: o, trustedRuntimeOrigins: i } = {}) {
954
974
  if (!e) throw new Error("accountId is required.");
955
975
  const a = o || e, s = window, c = () => {
956
976
  const l = s.GengageInjectorConfig || {}, p = l[e] || {};
@@ -967,8 +987,8 @@ function qi({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "sta
967
987
  }, f = (l) => {
968
988
  if (i === !0) return l;
969
989
  const p = new URL(l, window.location.href).origin, g = /* @__PURE__ */ new Set([window.location.origin]), u = c();
970
- B(g, document.currentScript?.getAttribute("src")), B(g, u.assetBaseUrl), B(g, u.baseUrl), B(g, n ? s[n] : void 0);
971
- for (const h of i || []) B(g, h);
990
+ F(g, document.currentScript?.getAttribute("src")), F(g, u.assetBaseUrl), F(g, u.baseUrl), F(g, n ? s[n] : void 0);
991
+ for (const h of i || []) F(g, h);
972
992
  if (!g.has(p)) throw new Error(`${a} runtime origin ${p} is not trusted.`);
973
993
  return l;
974
994
  }, b = s.GengageAssistantInjector || (s.GengageAssistantInjector = {}), m = b[e] || (b[e] = {});
@@ -983,7 +1003,7 @@ function qi({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "sta
983
1003
  throw delete m.loaderPromise, console.error(`[Gengage][${e}] runtime load failed`, l), l;
984
1004
  })), m.loaderPromise;
985
1005
  }
986
- function B(e, t) {
1006
+ function F(e, t) {
987
1007
  if (t)
988
1008
  try {
989
1009
  const r = new URL(t, window.location.href);
@@ -992,8 +1012,8 @@ function B(e, t) {
992
1012
  e.add(t);
993
1013
  }
994
1014
  }
995
- var cr = 500, Ae = "__GENGAGE_AGENTIC_ACTIVITY__";
996
- function lr({ accountId: e, clock: t = () => Date.now() } = {}) {
1015
+ var dr = 500, Ae = "__GENGAGE_AGENTIC_ACTIVITY__";
1016
+ function fr({ accountId: e, clock: t = () => Date.now() } = {}) {
997
1017
  const r = /* @__PURE__ */ new Set();
998
1018
  let n = 1;
999
1019
  const o = {
@@ -1001,13 +1021,13 @@ function lr({ accountId: e, clock: t = () => Date.now() } = {}) {
1001
1021
  entries: []
1002
1022
  };
1003
1023
  function i(a) {
1004
- const s = dr({
1024
+ const s = mr({
1005
1025
  id: n++,
1006
1026
  at: t(),
1007
1027
  accountId: e,
1008
1028
  ...a
1009
1029
  });
1010
- o.entries.push(s), o.entries.length > cr && (o.entries = o.entries.slice(-500));
1030
+ o.entries.push(s), o.entries.length > dr && (o.entries = o.entries.slice(-500));
1011
1031
  for (const c of r) c(s, o.entries);
1012
1032
  return s;
1013
1033
  }
@@ -1027,37 +1047,37 @@ function lr({ accountId: e, clock: t = () => Date.now() } = {}) {
1027
1047
  }
1028
1048
  };
1029
1049
  }
1030
- function ur(e) {
1050
+ function pr(e) {
1031
1051
  const t = window[Ae];
1032
1052
  if (t?.accountId === e && typeof t.record == "function") return t;
1033
- const r = lr({ accountId: e });
1053
+ const r = fr({ accountId: e });
1034
1054
  return window[Ae] = r, r;
1035
1055
  }
1036
- function dr(e) {
1037
- const t = String(e.kind || e.type || "activity"), r = fr(t);
1056
+ function mr(e) {
1057
+ const t = String(e.kind || e.type || "activity"), r = gr(t);
1038
1058
  return {
1039
1059
  ...e,
1040
1060
  kind: t,
1041
1061
  section: r,
1042
- severity: e.severity || pr({
1062
+ severity: e.severity || hr({
1043
1063
  ...e,
1044
1064
  kind: t
1045
1065
  }),
1046
- group: e.group || mr({
1066
+ group: e.group || br({
1047
1067
  ...e,
1048
1068
  kind: t,
1049
1069
  section: r
1050
1070
  })
1051
1071
  };
1052
1072
  }
1053
- function fr(e) {
1073
+ function gr(e) {
1054
1074
  return e.startsWith("flow/") ? "Flow" : e.startsWith("intent/") ? "Intent" : e.startsWith("be/") ? "Backend" : e.startsWith("tool/") ? "Tools" : e === "beacon" ? "Telemetry" : "Runtime";
1055
1075
  }
1056
- function pr(e) {
1076
+ function hr(e) {
1057
1077
  const t = String(e?.kind || "");
1058
1078
  return /\/(?:error|rejected|thrown)$/u.test(t) || e?.error || t === "be/response" && Number(e?.status) >= 400 ? "error" : t === "flow/metadata" && /fallback|retry|missing|empty/iu.test(String(e?.event?.phase || e?.event?.type || "")) || t === "be/response" && Number(e?.status) >= 300 ? "warn" : "info";
1059
1079
  }
1060
- function mr(e) {
1080
+ function br(e) {
1061
1081
  const t = String(e?.kind || "");
1062
1082
  if (t.startsWith("tool/")) return e?.tool ? `Tool: ${e.tool}` : "Tools";
1063
1083
  if (t.startsWith("be/")) return e?.op ? `BE: ${e.op}` : "Backend";
@@ -1071,8 +1091,8 @@ function mr(e) {
1071
1091
  }
1072
1092
  return t === "flow/ui" ? e?.widget ? `UI: ${e.widget}` : "UI" : t.startsWith("flow/") ? "Flow lifecycle" : t.startsWith("intent/") ? e?.intent?.kind ? `Intent: ${e.intent.kind}` : "Intent" : t === "beacon" ? e?.payload?.type ? `Beacon: ${e.payload.type}` : "Beacon" : e?.section || "Runtime";
1073
1093
  }
1074
- var gr = 8, fe = 120;
1075
- function hr(e = []) {
1094
+ var yr = 8, fe = 120;
1095
+ function wr(e = []) {
1076
1096
  const t = Array.isArray(e) ? e : [], r = {
1077
1097
  status: "idle",
1078
1098
  sessionId: "",
@@ -1098,7 +1118,7 @@ function hr(e = []) {
1098
1118
  ui: null,
1099
1119
  lastText: ""
1100
1120
  };
1101
- for (const o of t) br(r, n, o);
1121
+ for (const o of t) vr(r, n, o);
1102
1122
  return r.tools = te(r.tools).slice(-8), r.beOps = te(r.beOps).slice(-8), r.uiSurfaces = te(r.uiSurfaces).slice(-8), r.timeline = r.timeline.slice(-36), !r.lastAt && t.length && (r.lastAt = t.at(-1)?.at || null), {
1103
1123
  flow: r,
1104
1124
  context: n
@@ -1106,13 +1126,13 @@ function hr(e = []) {
1106
1126
  }
1107
1127
  function Y(e, t = "") {
1108
1128
  if (!e || typeof e != "object") return null;
1109
- const r = T({
1129
+ const r = S({
1110
1130
  source: t,
1111
1131
  panel: ae(e.panel || e.panel_state),
1112
- threadExtensions: Tr(e.thread?.extensions || e.threadExtensions || e.extensions),
1113
- pageProduct: Cr(e.product || e.page?.product),
1114
- products: V(e.products || e.last_search_products || e.items),
1115
- ui: Ye(e.spec),
1132
+ threadExtensions: Rr(e.thread?.extensions || e.threadExtensions || e.extensions),
1133
+ pageProduct: Ir(e.product || e.page?.product),
1134
+ products: I(e.products || e.last_search_products || e.items),
1135
+ ui: Qe(e.spec),
1116
1136
  intent: pe(e.intent),
1117
1137
  route: Q({
1118
1138
  searchParams: e.searchParams || e.search_params,
@@ -1123,24 +1143,24 @@ function Y(e, t = "") {
1123
1143
  }
1124
1144
  function ae(e) {
1125
1145
  if (!e || typeof e != "object") return null;
1126
- const t = V(e.last_search_products || e.current_panel_products), r = q(e.screen_sku_list || e.search_suggestions_skus);
1127
- return T({
1146
+ const t = I(e.last_search_products || e.current_panel_products), r = q(e.screen_sku_list || e.search_suggestions_skus);
1147
+ return S({
1128
1148
  source: e.list_source || e.source,
1129
1149
  screenType: y(e.screen_type || e.screen),
1130
1150
  screenSummary: y(e.screen_summary || e.ai_plist_summary),
1131
1151
  screenSkus: r,
1132
1152
  chatMentionedSkus: q(e.chat_mentioned_skus),
1133
- lastSearch: Er(e.last_search),
1153
+ lastSearch: Pr(e.last_search),
1134
1154
  productCount: t?.count ?? me(e.current_panel_product_count),
1135
1155
  productSkus: t?.skus
1136
1156
  });
1137
1157
  }
1138
- function Ye(e, t = "", r = "") {
1158
+ function Qe(e, t = "", r = "") {
1139
1159
  if (!e || typeof e != "object") return null;
1140
- const n = Ar(e);
1160
+ const n = Ur(e);
1141
1161
  if (!n) return null;
1142
- const o = n.props || {}, i = n.type === "ProductDetailsPanel" ? V([o.product || o.item].filter(Boolean)) : V(o.products || o.items || o.cards), a = Array.isArray(o.buttons) ? o.buttons : Array.isArray(o.actions) ? o.actions : [], s = Array.isArray(o.rows) ? o.rows.length : Array.isArray(o.comparison_table) ? o.comparison_table.length : void 0;
1143
- return T({
1162
+ const o = n.props || {}, i = Lr(e, n, o), a = Array.isArray(o.buttons) ? o.buttons : Array.isArray(o.actions) ? o.actions : [], s = Array.isArray(o.rows) ? o.rows.length : Array.isArray(o.comparison_table) ? o.comparison_table.length : void 0;
1163
+ return S({
1144
1164
  widget: t,
1145
1165
  panelHint: r,
1146
1166
  rootType: n.type,
@@ -1151,80 +1171,87 @@ function Ye(e, t = "", r = "") {
1151
1171
  comparisonRows: s
1152
1172
  });
1153
1173
  }
1154
- function br(e, t, r = {}) {
1174
+ function vr(e, t, r = {}) {
1155
1175
  if (!(!r || typeof r != "object"))
1156
1176
  switch (e.lastAt = r.at || e.lastAt, r.severity === "error" && (e.errors += 1), r.severity === "warn" && (e.warnings += 1), r.state && Z(t, r.state), r.kind) {
1157
1177
  case "flow/request":
1158
- yr(e, t, r);
1178
+ xr(e, t, r);
1159
1179
  break;
1160
1180
  case "flow/metadata":
1161
- wr(e, t, r);
1181
+ kr(e, t, r);
1182
+ break;
1183
+ case "flow/trace":
1184
+ Er(e, r);
1162
1185
  break;
1163
1186
  case "flow/ui":
1164
- vr(e, t, r);
1187
+ _r(e, t, r);
1165
1188
  break;
1166
1189
  case "flow/text-final":
1167
- t.lastText = y(r.content, fe), _(e, r, "Text", t.lastText, "done");
1190
+ t.lastText = y(r.content, fe), E(e, r, "Text", t.lastText, "done");
1168
1191
  break;
1169
1192
  case "flow/done":
1170
- e.status = e.status === "error" ? "error" : "done", e.current = "Done", _(e, r, "Done", "Flow completed", "done");
1193
+ e.status = e.status === "error" ? "error" : "done", e.current = "Done", E(e, r, "Done", "Flow completed", "done");
1171
1194
  break;
1172
1195
  case "flow/error":
1173
1196
  case "flow/rejected":
1174
1197
  case "flow/thrown":
1175
- e.status = "error", e.current = "Flow error", _(e, r, "Error", y(r.error || r.kind), "error");
1198
+ e.status = "error", e.current = "Flow error", E(e, r, "Error", y(r.error || r.kind), "error");
1176
1199
  break;
1177
1200
  case "tool/start":
1178
- e.status = e.status === "idle" ? "running" : e.status, e.current = `Tool: ${r.tool || "tool"}`, e.tools.push(r.tool || "tool"), _(e, r, "Tool", r.tool || "tool", "running");
1201
+ e.status = e.status === "idle" ? "running" : e.status, e.current = `Tool: ${r.tool || "tool"}`, e.tools.push(r.tool || "tool"), E(e, r, "Tool", r.tool || "tool", "running");
1179
1202
  break;
1180
1203
  case "tool/done":
1181
- e.tools.push(r.tool || "tool"), _(e, r, "Tool", r.tool || "tool", "done");
1204
+ e.tools.push(r.tool || "tool"), E(e, r, "Tool", r.tool || "tool", "done");
1182
1205
  break;
1183
1206
  case "tool/error":
1184
- e.status = "error", e.current = `Tool error: ${r.tool || "tool"}`, e.tools.push(r.tool || "tool"), _(e, r, "Tool", r.tool || "tool", "error");
1207
+ e.status = "error", e.current = `Tool error: ${r.tool || "tool"}`, e.tools.push(r.tool || "tool"), E(e, r, "Tool", r.tool || "tool", "error");
1185
1208
  break;
1186
1209
  case "be/request":
1187
- e.status = e.status === "idle" ? "running" : e.status, e.current = `BE: ${r.op || "request"}`, e.beOps.push(r.op || "unknown"), xr(t, r), _(e, r, "BE", r.op || "request", "running");
1210
+ e.status = e.status === "idle" ? "running" : e.status, e.current = `BE: ${r.op || "request"}`, e.beOps.push(r.op || "unknown"), Sr(t, r), E(e, r, "BE", r.op || "request", "running");
1188
1211
  break;
1189
1212
  case "be/response":
1190
- e.beOps.push(r.op || r.result?.op || "unknown"), kr(t, r.result), _(e, r, "BE", r.op || r.result?.intent?.kind || "response", r.severity || "done");
1213
+ e.beOps.push(r.op || r.result?.op || "unknown"), Tr(t, r.result), E(e, r, "BE", r.op || r.result?.intent?.kind || "response", r.severity || "done");
1191
1214
  break;
1192
1215
  case "intent/selected":
1193
1216
  t.intent = pe(r.intent), t.route = Q({
1194
1217
  searchParams: r.searchParams,
1195
1218
  flowParams: r.flowParams
1196
- }), e.current = `Intent: ${t.intent?.kind || "selected"}`, _(e, r, "Intent", t.intent?.kind || "selected", "done");
1219
+ }), e.current = `Intent: ${t.intent?.kind || "selected"}`, E(e, r, "Intent", t.intent?.kind || "selected", "done");
1197
1220
  break;
1198
1221
  default:
1199
- r.kind?.startsWith?.("runtime/") && _(e, r, "Runtime", r.title || r.kind, "done");
1222
+ r.kind?.startsWith?.("runtime/") && E(e, r, "Runtime", r.title || r.kind, "done");
1200
1223
  break;
1201
1224
  }
1202
1225
  }
1203
- function yr(e, t, r) {
1226
+ function xr(e, t, r) {
1204
1227
  const n = r.request || {};
1205
- e.status = "running", e.startedAt = r.at || e.startedAt, e.sessionId = y(n.session_id || n.sessionId || e.sessionId), e.requestType = y(n.type || e.requestType), e.actionType = y(n.action?.type || n.payload?.type || e.actionType), e.current = e.actionType || e.requestType || "Flow request", Z(t, Y(n.context || {}, "request.context")), _(e, r, "Request", [e.requestType, e.actionType].filter(Boolean).join(" / ") || "request", "running");
1228
+ e.status = "running", e.startedAt = r.at || e.startedAt, e.sessionId = y(n.session_id || n.sessionId || e.sessionId), e.requestType = y(n.type || e.requestType), e.actionType = y(n.action?.type || n.payload?.type || e.actionType), e.current = e.actionType || e.requestType || "Flow request", Z(t, Y(n.context || {}, "request.context")), E(e, r, "Request", [e.requestType, e.actionType].filter(Boolean).join(" / ") || "request", "running");
1206
1229
  }
1207
- function wr(e, t, r) {
1230
+ function kr(e, t, r) {
1208
1231
  const n = r.event || {};
1209
- e.sessionId = y(n.sessionId || n.session_id || e.sessionId), e.model = y(n.model || e.model), n.panelLoading === !0 && (e.current = "Panel loading"), Z(t, Y(n, "flow.metadata")), _(e, r, "Metadata", y(n.name || n.phase || n.type || "metadata"), r.severity);
1232
+ e.sessionId = y(n.sessionId || n.session_id || e.sessionId), e.model = y(n.model || e.model), n.panelLoading === !0 && (e.current = "Panel loading"), Z(t, Y(n, "flow.metadata")), E(e, r, "Metadata", y(n.name || n.phase || n.type || "metadata"), r.severity);
1210
1233
  }
1211
- function vr(e, t, r) {
1212
- const n = Ye(r.spec, r.widget, r.panelHint);
1213
- n && (t.ui = n, t.products = n.productCount ? {
1234
+ function _r(e, t, r) {
1235
+ const n = Qe(r.spec, r.widget, r.panelHint);
1236
+ n && (t.ui = n, typeof n.productCount == "number" && (t.products = {
1214
1237
  count: n.productCount,
1215
1238
  skus: n.productSkus || []
1216
- } : t.products, e.uiSurfaces.push(n.rootType), e.current = `UI: ${n.rootType}`, _(e, r, "UI", n.rootType || "ui", "done"));
1239
+ }), e.uiSurfaces.push(n.rootType), e.current = `UI: ${n.rootType}`, E(e, r, "UI", n.rootType || "ui", "done"));
1217
1240
  }
1218
- function xr(e, t) {
1241
+ function Er(e, t) {
1242
+ const r = t.event || {}, n = y(r.type || "trace"), o = y(r.stepName || r.stepKind || "");
1243
+ e.sessionId = y(r.sessionId || e.sessionId), e.current = o ? `${n}: ${o}` : n, E(e, t, "Trace", [n, o].filter(Boolean).join(" / ") || "trace", qr(n));
1244
+ }
1245
+ function Sr(e, t) {
1219
1246
  const r = t.params || {};
1220
- Z(e, Y(r, "be.params")), r.panel_state && (e.panel = ae(r.panel_state)), r.structured_context && (e.panel = Ze(e.panel, ae(r.structured_context)));
1247
+ Z(e, Y(r, "be.params")), r.panel_state && (e.panel = ae(r.panel_state)), r.structured_context && (e.panel = Xe(e.panel, ae(r.structured_context)));
1221
1248
  const n = Q({
1222
1249
  searchParams: r.search_params,
1223
1250
  flowParams: r.flow_params
1224
1251
  });
1225
1252
  n && (e.route = n);
1226
1253
  }
1227
- function kr(e, t) {
1254
+ function Tr(e, t) {
1228
1255
  if (!t || typeof t != "object") return;
1229
1256
  t.intent && (e.intent = pe(t.intent));
1230
1257
  const r = Q({
@@ -1234,19 +1261,19 @@ function kr(e, t) {
1234
1261
  r && (e.route = r);
1235
1262
  }
1236
1263
  function Z(e, t) {
1237
- !t || typeof t != "object" || (t.panel && (e.panel = Ze(e.panel, t.panel)), t.threadExtensions && (e.threadExtensions = {
1264
+ !t || typeof t != "object" || (t.panel && (e.panel = Xe(e.panel, t.panel)), t.threadExtensions && (e.threadExtensions = {
1238
1265
  ...e.threadExtensions,
1239
1266
  ...t.threadExtensions
1240
1267
  }), t.pageProduct && (e.pageProduct = t.pageProduct), t.products && (e.products = t.products), t.ui && (e.ui = t.ui), t.intent && (e.intent = t.intent), t.route && (e.route = t.route));
1241
1268
  }
1242
- function Ze(e, t) {
1243
- return e ? t ? T({
1269
+ function Xe(e, t) {
1270
+ return e ? t ? S({
1244
1271
  ...e,
1245
1272
  ...t
1246
1273
  }) : e : t || null;
1247
1274
  }
1248
- function _(e, t, r, n, o = "done") {
1249
- e.timeline.push(T({
1275
+ function E(e, t, r, n, o = "done") {
1276
+ e.timeline.push(S({
1250
1277
  id: t.id,
1251
1278
  at: t.at,
1252
1279
  label: r,
@@ -1256,21 +1283,21 @@ function _(e, t, r, n, o = "done") {
1256
1283
  }));
1257
1284
  }
1258
1285
  function pe(e) {
1259
- return !e || typeof e != "object" ? null : T({
1286
+ return !e || typeof e != "object" ? null : S({
1260
1287
  kind: y(e.kind || e.intent || e.type),
1261
1288
  target: y(e.target),
1262
1289
  confidence: typeof e.confidence == "number" ? Math.round(e.confidence * 100) / 100 : void 0
1263
1290
  });
1264
1291
  }
1265
1292
  function Q({ searchParams: e, flowParams: t } = {}) {
1266
- const r = T({
1267
- search: Sr(e),
1268
- flow: _r(t)
1293
+ const r = S({
1294
+ search: Cr(e),
1295
+ flow: Ar(t)
1269
1296
  });
1270
1297
  return Object.keys(r).length ? r : null;
1271
1298
  }
1272
- function Sr(e) {
1273
- return !e || typeof e != "object" ? null : T({
1299
+ function Cr(e) {
1300
+ return !e || typeof e != "object" ? null : S({
1274
1301
  query: y(e.query || e.search_query),
1275
1302
  category: y(e.category || e.category_name || e.categoryName),
1276
1303
  categoryId: y(e.categoryId || e.category_id),
@@ -1278,54 +1305,69 @@ function Sr(e) {
1278
1305
  facets: Array.isArray(e.facets) ? e.facets.length : void 0
1279
1306
  });
1280
1307
  }
1281
- function _r(e) {
1282
- return !e || typeof e != "object" ? null : T({
1308
+ function Ar(e) {
1309
+ return !e || typeof e != "object" ? null : S({
1283
1310
  target: y(e.target),
1284
1311
  sku: y(e.sku || e.product_sku),
1285
1312
  skus: q(e.skus || e.sku_list),
1286
1313
  action: y(e.action || e.action_type)
1287
1314
  });
1288
1315
  }
1289
- function Tr(e) {
1316
+ function Rr(e) {
1290
1317
  if (!e || typeof e != "object") return {};
1291
1318
  const t = {};
1292
1319
  for (const [r, n] of Object.entries(e))
1293
- n != null && (t[r] = n && typeof n == "object" ? T({
1320
+ n != null && (t[r] = n && typeof n == "object" ? S({
1294
1321
  keys: Object.keys(n).slice(0, 8),
1295
1322
  summary: y(n.summary || n.occasion || n.target_date_iso || n.type)
1296
1323
  }) : y(n));
1297
1324
  return t;
1298
1325
  }
1299
- function Er(e) {
1300
- return !e || typeof e != "object" ? null : T({
1326
+ function Pr(e) {
1327
+ return !e || typeof e != "object" ? null : S({
1301
1328
  query: y(e.query),
1302
1329
  source: y(e.source),
1303
1330
  category: y(e.category || e.category_name),
1304
1331
  count: me(e.count)
1305
1332
  });
1306
1333
  }
1307
- function V(e) {
1334
+ function I(e) {
1308
1335
  if (!Array.isArray(e)) return null;
1309
1336
  const t = e.filter(Boolean);
1310
- return T({
1337
+ return S({
1311
1338
  count: t.length,
1312
1339
  skus: q(t.map((r) => r?.sku || r?.code || r?.id)),
1313
1340
  names: q(t.map((r) => r?.name || r?.title), 4)
1314
1341
  });
1315
1342
  }
1316
- function Cr(e) {
1317
- return !e || typeof e != "object" ? null : T({
1343
+ function Lr(e, t, r) {
1344
+ if (t.type === "ProductDetailsPanel") return I([r.product || r.item].filter(Boolean));
1345
+ if (t.type === "ProductGrid") {
1346
+ const n = jr(r.products, r.items, r.cards);
1347
+ return I(n || Nr(e, t));
1348
+ }
1349
+ return I(r.products || r.items || r.cards);
1350
+ }
1351
+ function jr(...e) {
1352
+ return e.find((t) => Array.isArray(t)) || null;
1353
+ }
1354
+ function Nr(e, t) {
1355
+ const r = e.elements || {};
1356
+ return (Array.isArray(t.children) ? t.children : []).map((n) => r[n]).filter((n) => n?.type === "ProductCard").map((n) => n.props?.product || n.props?.item || n.props).filter(Boolean);
1357
+ }
1358
+ function Ir(e) {
1359
+ return !e || typeof e != "object" ? null : S({
1318
1360
  sku: y(e.sku || e.code || e.id),
1319
1361
  name: y(e.name || e.title),
1320
1362
  category: y(e.category),
1321
1363
  url: y(e.url)
1322
1364
  });
1323
1365
  }
1324
- function Ar(e) {
1366
+ function Ur(e) {
1325
1367
  const t = e.elements || {};
1326
1368
  return t[e.root || "root"] || t.root || e.rootElement || null;
1327
1369
  }
1328
- function q(e, t = gr) {
1370
+ function q(e, t = yr) {
1329
1371
  if (!Array.isArray(e)) return;
1330
1372
  const r = e.map((n) => y(n)).filter(Boolean);
1331
1373
  return r.length ? r.slice(0, t) : void 0;
@@ -1336,14 +1378,17 @@ function te(e) {
1336
1378
  function me(e) {
1337
1379
  return Number.isFinite(Number(e)) ? Number(e) : void 0;
1338
1380
  }
1381
+ function qr(e) {
1382
+ return /error$/u.test(e) ? "error" : /start$/u.test(e) ? "running" : "done";
1383
+ }
1339
1384
  function y(e, t = fe) {
1340
1385
  const r = String(e ?? "").replace(/\s+/gu, " ").trim();
1341
1386
  return r.length > t ? `${r.slice(0, t - 1)}...` : r;
1342
1387
  }
1343
- function T(e) {
1388
+ function S(e) {
1344
1389
  return Object.fromEntries(Object.entries(e || {}).filter(([, t]) => t == null || t === "" ? !1 : Array.isArray(t) ? t.length > 0 : typeof t == "object" ? Object.keys(t).length > 0 : !0));
1345
1390
  }
1346
- function Lr(e, t) {
1391
+ function Br(e, t) {
1347
1392
  if (!e || typeof e != "object" || !t) return e;
1348
1393
  const r = { ...e };
1349
1394
  for (const [n, o] of Object.entries(e))
@@ -1359,7 +1404,7 @@ function Lr(e, t) {
1359
1404
  kind: "tool/done",
1360
1405
  tool: n,
1361
1406
  params: a,
1362
- result: zr(c),
1407
+ result: Yr(c),
1363
1408
  state: Y(c, `tool:${n}`)
1364
1409
  }), c;
1365
1410
  } catch (c) {
@@ -1367,19 +1412,19 @@ function Lr(e, t) {
1367
1412
  kind: "tool/error",
1368
1413
  tool: n,
1369
1414
  params: a,
1370
- error: N(c)
1415
+ error: B(c)
1371
1416
  }), c;
1372
1417
  }
1373
1418
  }, Object.defineProperty(r[n], "__gengageActivityWrapped", { value: !0 }));
1374
1419
  return r;
1375
1420
  }
1376
- function Rr(e, t) {
1421
+ function Or(e, t) {
1377
1422
  return t ? (r) => (t.record({
1378
1423
  kind: "beacon",
1379
1424
  payload: r
1380
1425
  }), e?.(r)) : e;
1381
1426
  }
1382
- function Pr(e, t) {
1427
+ function $r(e, t) {
1383
1428
  if (!t) return !1;
1384
1429
  const r = window.GengageAssistantInjector?.[e], n = r?.streamTransport;
1385
1430
  if (typeof n != "function" || n.__gengageActivityWrapped) return !1;
@@ -1389,19 +1434,19 @@ function Pr(e, t) {
1389
1434
  request: a
1390
1435
  });
1391
1436
  try {
1392
- const f = n.call(this, a, Ir(s, t), c, d);
1437
+ const f = n.call(this, a, Fr(s, t), c, d);
1393
1438
  return f && typeof f.then == "function" ? f.catch((b) => {
1394
1439
  throw t.record({
1395
1440
  kind: "flow/rejected",
1396
1441
  requestType: a?.type,
1397
- error: N(b)
1442
+ error: B(b)
1398
1443
  }), b;
1399
1444
  }) : f;
1400
1445
  } catch (f) {
1401
1446
  throw t.record({
1402
1447
  kind: "flow/thrown",
1403
1448
  requestType: a?.type,
1404
- error: N(f)
1449
+ error: B(f)
1405
1450
  }), f;
1406
1451
  }
1407
1452
  };
@@ -1410,12 +1455,12 @@ function Pr(e, t) {
1410
1455
  title: "streamTransport wrapped"
1411
1456
  }), !0;
1412
1457
  }
1413
- function jr({ accountId: e, collector: t, promptBaseUrl: r } = {}) {
1458
+ function Mr({ accountId: e, collector: t, promptBaseUrl: r } = {}) {
1414
1459
  if (!t || window.__GENGAGE_ACTIVITY_FETCH_PATCHED__) return;
1415
1460
  window.__GENGAGE_ACTIVITY_FETCH_PATCHED__ = !0;
1416
1461
  const n = window.fetch?.bind(window);
1417
1462
  typeof n == "function" && (window.fetch = async (o, i) => {
1418
- const a = Or(o, i), s = $r(a.url);
1463
+ const a = Wr(o, i), s = Kr(a.url);
1419
1464
  let c = "";
1420
1465
  s && (c = a.body?.op_name || a.body?.op || "unknown", t.record({
1421
1466
  kind: "be/request",
@@ -1423,7 +1468,7 @@ function jr({ accountId: e, collector: t, promptBaseUrl: r } = {}) {
1423
1468
  url: a.url,
1424
1469
  op: c,
1425
1470
  opDomain: a.body?.op_domain || "",
1426
- prompt: await qr({
1471
+ prompt: await Dr({
1427
1472
  accountId: e,
1428
1473
  opName: c,
1429
1474
  promptBaseUrl: r
@@ -1433,7 +1478,7 @@ function jr({ accountId: e, collector: t, promptBaseUrl: r } = {}) {
1433
1478
  }));
1434
1479
  const d = await n(o, i);
1435
1480
  return s && d.clone().text().then((f) => {
1436
- const b = Dr(f);
1481
+ const b = Jr(f);
1437
1482
  t.record({
1438
1483
  kind: "be/response",
1439
1484
  source: "main-thread-fetch",
@@ -1442,7 +1487,7 @@ function jr({ accountId: e, collector: t, promptBaseUrl: r } = {}) {
1442
1487
  op: c,
1443
1488
  result: b,
1444
1489
  rawText: f
1445
- }), Qe(t, b);
1490
+ }), et(t, b);
1446
1491
  }).catch((f) => {
1447
1492
  t.record({
1448
1493
  kind: "be/response",
@@ -1450,12 +1495,12 @@ function jr({ accountId: e, collector: t, promptBaseUrl: r } = {}) {
1450
1495
  url: a.url,
1451
1496
  status: d.status,
1452
1497
  op: c,
1453
- error: N(f)
1498
+ error: B(f)
1454
1499
  });
1455
1500
  }), d;
1456
1501
  });
1457
1502
  }
1458
- function Ir(e, t) {
1503
+ function Fr(e, t) {
1459
1504
  if (!e || e.__gengageActivityWrapped) return e;
1460
1505
  const r = { ...e };
1461
1506
  Object.defineProperty(r, "__gengageActivityWrapped", { value: !0 });
@@ -1485,16 +1530,16 @@ function Ir(e, t) {
1485
1530
  extra: o[2]
1486
1531
  }) : n === "onError" ? t.record({
1487
1532
  kind: "flow/error",
1488
- error: N(o[0])
1533
+ error: B(o[0])
1489
1534
  }) : n === "onDone" && t.record({ kind: "flow/done" }), e[n](...o)));
1490
1535
  return r;
1491
1536
  }
1492
- function Ur(e, t) {
1493
- !e || !t || (e.record(t), t.kind === "be/response" && Qe(e, t.result));
1537
+ function Re(e, t) {
1538
+ !e || !t || (e.record(t), t.kind === "be/response" && et(e, t.result));
1494
1539
  }
1495
- async function qr({ accountId: e, opName: t, promptBaseUrl: r }) {
1540
+ async function Dr({ accountId: e, opName: t, promptBaseUrl: r }) {
1496
1541
  if (!e || !t) return null;
1497
- const n = Nr({
1542
+ const n = Gr({
1498
1543
  accountId: e,
1499
1544
  baseId: String(e).replace(/-agentic$/u, ""),
1500
1545
  promptBaseUrl: r
@@ -1510,15 +1555,15 @@ async function qr({ accountId: e, opName: t, promptBaseUrl: r }) {
1510
1555
  error: `HTTP ${i.status}`
1511
1556
  };
1512
1557
  } catch (o) {
1513
- return { error: N(o) };
1558
+ return { error: B(o) };
1514
1559
  }
1515
1560
  }
1516
- function Nr({ accountId: e, baseId: t, promptBaseUrl: r }) {
1561
+ function Gr({ accountId: e, baseId: t, promptBaseUrl: r }) {
1517
1562
  if (typeof r == "string" && r.trim()) return r;
1518
- const n = Mr(e, t);
1519
- return n || Fr(t);
1563
+ const n = zr(e, t);
1564
+ return n || Hr(t);
1520
1565
  }
1521
- function Mr(e, t) {
1566
+ function zr(e, t) {
1522
1567
  const r = window.__GENGAGE_AGENTIC_PROMPT_BASE_URL__;
1523
1568
  if (typeof r == "string" && r.trim()) return r;
1524
1569
  if (r && typeof r == "object") {
@@ -1528,7 +1573,7 @@ function Mr(e, t) {
1528
1573
  const n = (window.GengageInjectorConfig?.[e] || window.GengageInjectorConfig?.[t])?.agenticActivityPromptBaseUrl;
1529
1574
  return typeof n == "string" && n.trim() ? n : null;
1530
1575
  }
1531
- function Fr(e) {
1576
+ function Hr(e) {
1532
1577
  const t = Array.from(document.scripts || []);
1533
1578
  for (const r of t) {
1534
1579
  const n = r?.src || "";
@@ -1537,7 +1582,7 @@ function Fr(e) {
1537
1582
  }
1538
1583
  return null;
1539
1584
  }
1540
- function Qe(e, t) {
1585
+ function et(e, t) {
1541
1586
  const r = t?.intent;
1542
1587
  r && e.record({
1543
1588
  kind: "intent/selected",
@@ -1546,14 +1591,14 @@ function Qe(e, t) {
1546
1591
  flowParams: t?.flow_params
1547
1592
  });
1548
1593
  }
1549
- function Or(e, t) {
1594
+ function Wr(e, t) {
1550
1595
  const r = typeof e == "string" ? e : e?.url || "", n = t?.body || (typeof e != "string" ? e?.body : null);
1551
1596
  return {
1552
1597
  url: String(r || ""),
1553
- body: Br(n)
1598
+ body: Vr(n)
1554
1599
  };
1555
1600
  }
1556
- function Br(e) {
1601
+ function Vr(e) {
1557
1602
  if (!e || typeof e != "string") return {};
1558
1603
  try {
1559
1604
  return JSON.parse(e);
@@ -1561,7 +1606,7 @@ function Br(e) {
1561
1606
  return { raw: e };
1562
1607
  }
1563
1608
  }
1564
- function $r(e) {
1609
+ function Kr(e) {
1565
1610
  try {
1566
1611
  const t = new URL(e, window.location.href);
1567
1612
  return t.pathname === "/v1/execute" && /agentic\.gengage\.ai$/u.test(t.hostname);
@@ -1569,7 +1614,7 @@ function $r(e) {
1569
1614
  return !1;
1570
1615
  }
1571
1616
  }
1572
- function Dr(e) {
1617
+ function Jr(e) {
1573
1618
  const t = {};
1574
1619
  for (const r of String(e || "").split(/\r?\n/u)) {
1575
1620
  const n = r.trim();
@@ -1583,7 +1628,7 @@ function Dr(e) {
1583
1628
  }
1584
1629
  return t;
1585
1630
  }
1586
- function zr(e) {
1631
+ function Yr(e) {
1587
1632
  if (Array.isArray(e)) return {
1588
1633
  type: "array",
1589
1634
  length: e.length,
@@ -1601,32 +1646,32 @@ function zr(e) {
1601
1646
  } : t[r] = n;
1602
1647
  return t;
1603
1648
  }
1604
- function N(e) {
1649
+ function B(e) {
1605
1650
  return e?.message || String(e);
1606
1651
  }
1607
- var Le = "gengage-agentic-activity-overlay", D = "all", se = "all", Re = [
1652
+ var Pe = "gengage-agentic-activity-overlay", G = "all", se = "all", Le = [
1608
1653
  "Flow",
1609
1654
  "Tools",
1610
1655
  "Backend",
1611
1656
  "Intent",
1612
1657
  "Telemetry",
1613
1658
  "Runtime"
1614
- ], Pe = [
1659
+ ], je = [
1615
1660
  "info",
1616
1661
  "warn",
1617
1662
  "error"
1618
1663
  ];
1619
- function Gr(e) {
1664
+ function Zr(e) {
1620
1665
  if (!e || typeof e.subscribe != "function") return null;
1621
- const t = document.getElementById(Le);
1666
+ const t = document.getElementById(Pe);
1622
1667
  if (t?.shadowRoot) return t;
1623
1668
  const r = document.createElement("div");
1624
- r.id = Le, r.style.cssText = "position:fixed;left:10px;top:10px;z-index:2147483647;";
1669
+ r.id = Pe, r.style.cssText = "position:fixed;left:10px;top:10px;z-index:2147483647;";
1625
1670
  const n = r.attachShadow({ mode: "open" });
1626
- n.innerHTML = hn(e.accountId), document.documentElement.appendChild(r);
1671
+ n.innerHTML = _n(e.accountId), document.documentElement.appendChild(r);
1627
1672
  const o = {
1628
1673
  entries: [],
1629
- section: D,
1674
+ section: G,
1630
1675
  severity: se,
1631
1676
  search: "",
1632
1677
  grouped: !0,
@@ -1645,8 +1690,8 @@ function Gr(e) {
1645
1690
  followToggle: n.querySelector('[data-action="follow"]'),
1646
1691
  stateToggle: n.querySelector('[data-action="state"]')
1647
1692
  };
1648
- Hr(r, i.list);
1649
- const a = () => Vr(i, o);
1693
+ Qr(r, i.list);
1694
+ const a = () => en(i, o);
1650
1695
  return n.querySelector('[data-action="clear"]')?.addEventListener("click", () => e.clear()), n.querySelector('[data-action="toggle"]')?.addEventListener("click", (s) => {
1651
1696
  i.panel.classList.toggle("is-minimized"), s.currentTarget.textContent = i.panel.classList.contains("is-minimized") ? "Open" : "Min";
1652
1697
  }), i.search?.addEventListener("input", () => {
@@ -1675,56 +1720,56 @@ function Gr(e) {
1675
1720
  const c = s.target?.closest?.('[data-action="copy-json"]');
1676
1721
  if (!c) return;
1677
1722
  const d = Number(c.dataset.entryId || 0);
1678
- pn(o.entries.find((f) => f.id === d), c);
1723
+ vn(o.entries.find((f) => f.id === d), c);
1679
1724
  }), e.subscribe((s, c) => {
1680
1725
  o.entries = c.slice(), a();
1681
1726
  }), r;
1682
1727
  }
1683
- function Hr(e, t) {
1728
+ function Qr(e, t) {
1684
1729
  e.addEventListener("wheel", (r) => {
1685
- const n = Wr(r.composedPath?.() || [], t);
1730
+ const n = Xr(r.composedPath?.() || [], t);
1686
1731
  n && (n.scrollTop += r.deltaY, n.scrollLeft += r.deltaX, r.preventDefault(), r.stopPropagation());
1687
1732
  }, {
1688
1733
  passive: !1,
1689
1734
  capture: !0
1690
1735
  });
1691
1736
  }
1692
- function Wr(e, t) {
1737
+ function Xr(e, t) {
1693
1738
  for (const r of e)
1694
- if (!(!r || r.nodeType !== 1) && je(r))
1739
+ if (!(!r || r.nodeType !== 1) && Ne(r))
1695
1740
  return r;
1696
- return je(t) ? t : null;
1741
+ return Ne(t) ? t : null;
1697
1742
  }
1698
- function je(e) {
1743
+ function Ne(e) {
1699
1744
  return !!(e && (e.scrollHeight > e.clientHeight + 1 || e.scrollWidth > e.clientWidth + 1) && getComputedStyle(e).overflow !== "hidden");
1700
1745
  }
1701
- function Vr(e, t) {
1702
- const r = Kr(t.entries, t), n = r.slice(-260);
1703
- Ie(e.sections, t.entries, t.section, "section"), Ie(e.severities, t.entries, t.severity, "severity"), e.count && (e.count.textContent = String(t.entries.length)), e.visibleCount && (e.visibleCount.textContent = String(r.length)), Qr(e.stateView, hr(t.entries), t.stateVisible), Zr(e.list, n, t);
1746
+ function en(e, t) {
1747
+ const r = tn(t.entries, t), n = r.slice(-260);
1748
+ Ie(e.sections, t.entries, t.section, "section"), Ie(e.severities, t.entries, t.severity, "severity"), e.count && (e.count.textContent = String(t.entries.length)), e.visibleCount && (e.visibleCount.textContent = String(r.length)), an(e.stateView, wr(t.entries), t.stateVisible), on(e.list, n, t);
1704
1749
  }
1705
- function Kr(e, t = {}) {
1706
- const r = t.section || D, n = t.severity || se, o = tt(t.search);
1707
- return (Array.isArray(e) ? e : []).filter((i) => r !== D && i.section !== r || n !== se && i.severity !== n ? !1 : o ? gn(i).includes(o) : !0);
1750
+ function tn(e, t = {}) {
1751
+ const r = t.section || G, n = t.severity || se, o = nt(t.search);
1752
+ return (Array.isArray(e) ? e : []).filter((i) => r !== G && i.section !== r || n !== se && i.severity !== n ? !1 : o ? kn(i).includes(o) : !0);
1708
1753
  }
1709
1754
  function Ie(e, t, r, n) {
1710
1755
  if (!e) return;
1711
1756
  e.textContent = "";
1712
- const o = n === "section" ? Jr(t) : Yr(t), i = document.createElement("button");
1713
- i.type = "button", i.dataset[`${n}Filter`] = D, i.className = r === D ? "chip is-active" : "chip", i.textContent = `All ${t.length}`, e.appendChild(i);
1757
+ const o = n === "section" ? rn(t) : nn(t), i = document.createElement("button");
1758
+ i.type = "button", i.dataset[`${n}Filter`] = G, i.className = r === G ? "chip is-active" : "chip", i.textContent = `All ${t.length}`, e.appendChild(i);
1714
1759
  for (const a of o) {
1715
1760
  const s = t.filter((d) => d[n] === a).length, c = document.createElement("button");
1716
- c.type = "button", c.dataset[`${n}Filter`] = a, c.className = r === a ? `chip is-active ${n}-${M(a)}` : `chip ${n}-${M(a)}`, c.textContent = `${ot(a)} ${s}`, e.appendChild(c);
1761
+ c.type = "button", c.dataset[`${n}Filter`] = a, c.className = r === a ? `chip is-active ${n}-${O(a)}` : `chip ${n}-${O(a)}`, c.textContent = `${at(a)} ${s}`, e.appendChild(c);
1717
1762
  }
1718
1763
  }
1719
- function Jr(e) {
1764
+ function rn(e) {
1720
1765
  const t = new Set(e.map((r) => r.section).filter(Boolean));
1721
- return Re.filter((r) => t.has(r)).concat([...t].filter((r) => !Re.includes(r)).sort());
1766
+ return Le.filter((r) => t.has(r)).concat([...t].filter((r) => !Le.includes(r)).sort());
1722
1767
  }
1723
- function Yr(e) {
1768
+ function nn(e) {
1724
1769
  const t = new Set(e.map((r) => r.severity).filter(Boolean));
1725
- return Pe.filter((r) => t.has(r)).concat([...t].filter((r) => !Pe.includes(r)).sort());
1770
+ return je.filter((r) => t.has(r)).concat([...t].filter((r) => !je.includes(r)).sort());
1726
1771
  }
1727
- function Zr(e, t, r) {
1772
+ function on(e, t, r) {
1728
1773
  if (!e) return;
1729
1774
  if (e.textContent = "", !t.length) {
1730
1775
  const o = document.createElement("div");
@@ -1732,18 +1777,18 @@ function Zr(e, t, r) {
1732
1777
  return;
1733
1778
  }
1734
1779
  const n = document.createDocumentFragment();
1735
- if (r.grouped) for (const o of un(t)) n.appendChild(dn(o));
1736
- else for (const o of t) n.appendChild(et(o));
1780
+ if (r.grouped) for (const o of bn(t)) n.appendChild(yn(o));
1781
+ else for (const o of t) n.appendChild(rt(o));
1737
1782
  e.appendChild(n), r.follow && requestAnimationFrame(() => e.scrollTop = e.scrollHeight);
1738
1783
  }
1739
- function Qr(e, t, r) {
1784
+ function an(e, t, r) {
1740
1785
  if (!e || (e.textContent = "", e.classList.toggle("is-hidden", !r), !r)) return;
1741
1786
  const { flow: n, context: o } = t, i = document.createDocumentFragment();
1742
- i.appendChild(Xr(n)), i.appendChild(en(o)), i.appendChild(tn(n.timeline)), e.appendChild(i);
1787
+ i.appendChild(sn(n)), i.appendChild(cn(o)), i.appendChild(ln(n.timeline)), e.appendChild(i);
1743
1788
  }
1744
- function Xr(e) {
1789
+ function sn(e) {
1745
1790
  const t = document.createElement("section");
1746
- return t.className = `viz-card flow-card status-${M(e.status)}`, t.appendChild(ge("Flow State", e.status)), Xe(t, [
1791
+ return t.className = `viz-card flow-card status-${O(e.status)}`, t.appendChild(ge("Flow State", e.status)), tt(t, [
1747
1792
  ["Current", e.current],
1748
1793
  ["Session", e.sessionId],
1749
1794
  ["Request", [e.requestType, e.actionType].filter(Boolean).join(" / ")],
@@ -1751,32 +1796,32 @@ function Xr(e) {
1751
1796
  ["Tools", e.tools?.join(", ")],
1752
1797
  ["BE ops", e.beOps?.join(", ")],
1753
1798
  ["UI", e.uiSurfaces?.join(", ")],
1754
- ["Health", rn(e)]
1799
+ ["Health", un(e)]
1755
1800
  ]), t;
1756
1801
  }
1757
- function en(e) {
1802
+ function cn(e) {
1758
1803
  const t = document.createElement("section");
1759
- return t.className = "viz-card context-card", t.appendChild(ge("Context State", e.panel?.screenType || e.ui?.rootType || "empty")), Xe(t, [
1760
- ["Intent", nn(e.intent)],
1761
- ["Route", on(e.route)],
1762
- ["Screen", an(e)],
1763
- ["Last search", sn(e.panel?.lastSearch)],
1764
- ["Products", cn(e.panel, e.products)],
1765
- ["Page product", ln(e.pageProduct)],
1804
+ return t.className = "viz-card context-card", t.appendChild(ge("Context State", e.panel?.screenType || e.ui?.rootType || "empty")), tt(t, [
1805
+ ["Intent", dn(e.intent)],
1806
+ ["Route", fn(e.route)],
1807
+ ["Screen", pn(e)],
1808
+ ["Last search", mn(e.panel?.lastSearch)],
1809
+ ["Products", gn(e.panel, e.products)],
1810
+ ["Page product", hn(e.pageProduct)],
1766
1811
  ["Extensions", Object.keys(e.threadExtensions || {}).join(", ")],
1767
1812
  ["Last text", e.lastText]
1768
1813
  ]), t;
1769
1814
  }
1770
- function tn(e) {
1815
+ function ln(e) {
1771
1816
  const t = document.createElement("section");
1772
1817
  t.className = "viz-card timeline-card", t.appendChild(ge("Flow Timeline", `${e.length} steps`));
1773
1818
  const r = document.createElement("ol");
1774
1819
  if (r.className = "timeline", e.length)
1775
1820
  for (const n of e) {
1776
1821
  const o = document.createElement("li");
1777
- o.className = `timeline-step step-${M(n.status || "done")}`;
1822
+ o.className = `timeline-step step-${O(n.status || "done")}`;
1778
1823
  const i = document.createElement("span");
1779
- i.className = "timeline-time", i.textContent = nt(n.at);
1824
+ i.className = "timeline-time", i.textContent = it(n.at);
1780
1825
  const a = document.createElement("span");
1781
1826
  a.className = "timeline-label", a.textContent = n.label || n.kind || "Step";
1782
1827
  const s = document.createElement("span");
@@ -1796,7 +1841,7 @@ function ge(e, t) {
1796
1841
  const o = document.createElement("span");
1797
1842
  return o.className = "viz-badge", o.textContent = t || "idle", r.append(n, o), r;
1798
1843
  }
1799
- function Xe(e, t) {
1844
+ function tt(e, t) {
1800
1845
  for (const [r, n] of t) {
1801
1846
  if (n == null || n === "") continue;
1802
1847
  const o = document.createElement("div");
@@ -1807,17 +1852,17 @@ function Xe(e, t) {
1807
1852
  a.className = "viz-value", a.textContent = String(n), o.append(i, a), e.appendChild(o);
1808
1853
  }
1809
1854
  }
1810
- function rn(e) {
1855
+ function un(e) {
1811
1856
  return !e.errors && !e.warnings ? "clean" : `${e.errors || 0} errors, ${e.warnings || 0} warnings`;
1812
1857
  }
1813
- function nn(e) {
1858
+ function dn(e) {
1814
1859
  return e ? [
1815
1860
  e.kind,
1816
1861
  e.target,
1817
1862
  e.confidence != null ? `conf ${e.confidence}` : ""
1818
1863
  ].filter(Boolean).join(" / ") : "";
1819
1864
  }
1820
- function on(e) {
1865
+ function fn(e) {
1821
1866
  return e ? [e.search ? [
1822
1867
  e.search.query,
1823
1868
  e.search.category,
@@ -1830,7 +1875,7 @@ function on(e) {
1830
1875
  e.flow.action
1831
1876
  ].filter(Boolean).join(" / ") : ""].filter(Boolean).join(" -> ") : "";
1832
1877
  }
1833
- function an(e) {
1878
+ function pn(e) {
1834
1879
  const t = e.panel || {}, r = e.ui || {};
1835
1880
  return [
1836
1881
  t.screenType,
@@ -1839,7 +1884,7 @@ function an(e) {
1839
1884
  r.panelHint
1840
1885
  ].filter(Boolean).join(" / ");
1841
1886
  }
1842
- function sn(e) {
1887
+ function mn(e) {
1843
1888
  return e ? [
1844
1889
  e.query,
1845
1890
  e.source,
@@ -1847,18 +1892,18 @@ function sn(e) {
1847
1892
  e.count != null ? `${e.count} results` : ""
1848
1893
  ].filter(Boolean).join(" / ") : "";
1849
1894
  }
1850
- function cn(e, t) {
1895
+ function gn(e, t) {
1851
1896
  const r = e?.productSkus || e?.screenSkus || t?.skus || [], n = e?.productCount ?? t?.count;
1852
1897
  return n == null && !r.length ? "" : [`${n ?? r.length} products`, r.join(", ")].filter(Boolean).join(" / ");
1853
1898
  }
1854
- function ln(e) {
1899
+ function hn(e) {
1855
1900
  return e ? [
1856
1901
  e.sku,
1857
1902
  e.name,
1858
1903
  e.category
1859
1904
  ].filter(Boolean).join(" / ") : "";
1860
1905
  }
1861
- function un(e) {
1906
+ function bn(e) {
1862
1907
  const t = /* @__PURE__ */ new Map();
1863
1908
  for (const r of e) {
1864
1909
  const n = `${r.section || "Runtime"}:${r.group || r.kind}`, o = t.get(n) || {
@@ -1868,13 +1913,13 @@ function un(e) {
1868
1913
  title: r.group || r.kind,
1869
1914
  entries: []
1870
1915
  };
1871
- o.entries.push(r), o.severity = mn(o.severity, r.severity), t.set(n, o);
1916
+ o.entries.push(r), o.severity = xn(o.severity, r.severity), t.set(n, o);
1872
1917
  }
1873
1918
  return [...t.values()];
1874
1919
  }
1875
- function dn(e) {
1920
+ function yn(e) {
1876
1921
  const t = document.createElement("section");
1877
- t.className = `group group-${M(e.severity)}`, t.dataset.section = e.section;
1922
+ t.className = `group group-${O(e.severity)}`, t.dataset.section = e.section;
1878
1923
  const r = document.createElement("div");
1879
1924
  r.className = "group-head";
1880
1925
  const n = document.createElement("span");
@@ -1883,20 +1928,20 @@ function dn(e) {
1883
1928
  o.className = "group-title", o.textContent = e.title;
1884
1929
  const i = document.createElement("span");
1885
1930
  i.className = "group-count", i.textContent = String(e.entries.length), r.append(n, o, i), t.appendChild(r);
1886
- for (const a of e.entries) t.appendChild(et(a));
1931
+ for (const a of e.entries) t.appendChild(rt(a));
1887
1932
  return t;
1888
1933
  }
1889
- function et(e) {
1934
+ function rt(e) {
1890
1935
  const t = document.createElement("details");
1891
- t.dataset.entryId = String(e.id || ""), t.dataset.section = e.section || "Runtime", t.dataset.severity = e.severity || "info", t.className = `entry entry-${M(e.severity || "info")}`, t.open = e.severity === "error";
1936
+ t.dataset.entryId = String(e.id || ""), t.dataset.section = e.section || "Runtime", t.dataset.severity = e.severity || "info", t.className = `entry entry-${O(e.severity || "info")}`, t.open = e.severity === "error";
1892
1937
  const r = document.createElement("summary"), n = document.createElement("span");
1893
- n.className = "time", n.textContent = nt(e.at);
1938
+ n.className = "time", n.textContent = it(e.at);
1894
1939
  const o = document.createElement("span");
1895
1940
  o.className = "section", o.textContent = e.section || "Runtime";
1896
1941
  const i = document.createElement("span");
1897
- i.className = "severity", i.textContent = ot(e.severity || "info");
1942
+ i.className = "severity", i.textContent = at(e.severity || "info");
1898
1943
  const a = document.createElement("span");
1899
- a.className = "title", a.textContent = rt(e), r.append(n, o, i, a);
1944
+ a.className = "title", a.textContent = ot(e), r.append(n, o, i, a);
1900
1945
  const s = document.createElement("div");
1901
1946
  s.className = "entry-body";
1902
1947
  const c = document.createElement("div");
@@ -1908,20 +1953,20 @@ function et(e) {
1908
1953
  const b = document.createElement("button");
1909
1954
  b.type = "button", b.dataset.action = "copy-json", b.dataset.entryId = String(e.id || ""), b.textContent = "Copy JSON", c.append(d, f, b);
1910
1955
  const m = document.createElement("pre"), l = document.createElement("code");
1911
- return l.innerHTML = fn(e), m.appendChild(l), s.append(c, m), t.append(r, s), t;
1956
+ return l.innerHTML = wn(e), m.appendChild(l), s.append(c, m), t.append(r, s), t;
1912
1957
  }
1913
- function fn(e) {
1958
+ function wn(e) {
1914
1959
  const t = he(e), r = /("(?:\\u[\da-fA-F]{4}|\\[^u]|[^\\"])*"(?:\s*:)?|\btrue\b|\bfalse\b|\bnull\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/gu;
1915
1960
  let n = "", o = 0;
1916
1961
  for (const i of t.matchAll(r)) {
1917
1962
  const a = i[0];
1918
- n += G(t.slice(o, i.index));
1963
+ n += H(t.slice(o, i.index));
1919
1964
  let s = "json-number";
1920
- a.startsWith('"') ? s = a.endsWith(":") ? "json-key" : "json-string" : a === "true" || a === "false" ? s = "json-boolean" : a === "null" && (s = "json-null"), n += `<span class="${s}">${G(a)}</span>`, o = i.index + a.length;
1965
+ a.startsWith('"') ? s = a.endsWith(":") ? "json-key" : "json-string" : a === "true" || a === "false" ? s = "json-boolean" : a === "null" && (s = "json-null"), n += `<span class="${s}">${H(a)}</span>`, o = i.index + a.length;
1921
1966
  }
1922
- return n + G(t.slice(o));
1967
+ return n + H(t.slice(o));
1923
1968
  }
1924
- function pn(e, t) {
1969
+ function vn(e, t) {
1925
1970
  if (!e) return;
1926
1971
  const r = he(e), n = () => {
1927
1972
  const o = t.textContent;
@@ -1944,7 +1989,7 @@ function Ue(e, t) {
1944
1989
  r.remove();
1945
1990
  }
1946
1991
  }
1947
- function mn(e, t) {
1992
+ function xn(e, t) {
1948
1993
  const r = {
1949
1994
  info: 0,
1950
1995
  warn: 1,
@@ -1952,13 +1997,13 @@ function mn(e, t) {
1952
1997
  };
1953
1998
  return (r[t] || 0) > (r[e] || 0) ? t : e;
1954
1999
  }
1955
- function gn(e) {
1956
- return tt([
2000
+ function kn(e) {
2001
+ return nt([
1957
2002
  e.kind,
1958
2003
  e.section,
1959
2004
  e.severity,
1960
2005
  e.group,
1961
- rt(e),
2006
+ ot(e),
1962
2007
  e.tool,
1963
2008
  e.op,
1964
2009
  e.request?.type,
@@ -1969,15 +2014,15 @@ function gn(e) {
1969
2014
  he(e)
1970
2015
  ].join(" "));
1971
2016
  }
1972
- function tt(e) {
2017
+ function nt(e) {
1973
2018
  return String(e || "").toLocaleLowerCase("tr-TR").trim();
1974
2019
  }
1975
- function rt(e) {
2020
+ function ot(e) {
1976
2021
  if (e.kind === "flow/request") return e.request?.type || e.request?.action?.type || "request";
1977
2022
  if (e.kind === "flow/action") return e.event?.name || e.event?.action || e.event?.type || "action";
1978
2023
  if (e.kind === "flow/metadata") return e.event?.name || e.event?.phase || e.event?.type || "metadata";
1979
2024
  if (e.kind === "flow/ui") return e.widget || e.panelHint || "ui";
1980
- if (e.kind === "flow/text-final") return bn(e.content || "final text", 90);
2025
+ if (e.kind === "flow/text-final") return En(e.content || "final text", 90);
1981
2026
  if (e.kind === "be/request") return e.op || "BE request";
1982
2027
  if (e.kind === "be/response") {
1983
2028
  const t = e.result?.intent?.kind || e.result?.intent_kind || e.result?.kind;
@@ -1985,7 +2030,7 @@ function rt(e) {
1985
2030
  }
1986
2031
  return e.kind === "intent/selected" ? e.intent?.kind || e.kind : e.kind.startsWith("tool/") ? e.tool || "tool" : e.kind === "beacon" ? e.payload?.type || "beacon" : e.title || e.kind;
1987
2032
  }
1988
- function hn(e) {
2033
+ function _n(e) {
1989
2034
  return `
1990
2035
  <style>
1991
2036
  :host { all: initial; }
@@ -2308,7 +2353,7 @@ function hn(e) {
2308
2353
  <div class="panel" data-role="panel">
2309
2354
  <div class="head">
2310
2355
  <div class="meta">
2311
- <span class="name">Agentic Activity - ${G(e)}</span>
2356
+ <span class="name">Agentic Activity - ${H(e)}</span>
2312
2357
  <span class="count"><span data-role="visible-count">0</span>/<span data-role="count">0</span></span>
2313
2358
  </div>
2314
2359
  <div class="actions">
@@ -2340,29 +2385,29 @@ function he(e) {
2340
2385
  return String(e);
2341
2386
  }
2342
2387
  }
2343
- function nt(e) {
2388
+ function it(e) {
2344
2389
  try {
2345
2390
  return new Date(e || Date.now()).toLocaleTimeString();
2346
2391
  } catch {
2347
2392
  return "";
2348
2393
  }
2349
2394
  }
2350
- function bn(e, t) {
2395
+ function En(e, t) {
2351
2396
  const r = String(e || "");
2352
2397
  return r.length > t ? `${r.slice(0, t - 1)}...` : r;
2353
2398
  }
2354
- function ot(e) {
2399
+ function at(e) {
2355
2400
  const t = String(e || "");
2356
2401
  return t ? `${t.slice(0, 1).toLocaleUpperCase("en-US")}${t.slice(1)}` : "";
2357
2402
  }
2358
- function M(e) {
2403
+ function O(e) {
2359
2404
  return String(e || "").toLocaleLowerCase("en-US").replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
2360
2405
  }
2361
- function G(e) {
2406
+ function H(e) {
2362
2407
  return String(e).replace(/[&<>"']/gu, (t) => t === "&" ? "&amp;" : t === "<" ? "&lt;" : t === ">" ? "&gt;" : t === '"' ? "&quot;" : "&#39;");
2363
2408
  }
2364
- function Ni({ accountId: e, config: t = {}, tools: r, beacon: n } = {}) {
2365
- if (!yn(e, t)) return {
2409
+ function Gi({ accountId: e, config: t = {}, tools: r, beacon: n } = {}) {
2410
+ if (!Sn(e, t)) return {
2366
2411
  enabled: !1,
2367
2412
  tools: r,
2368
2413
  beacon: n,
@@ -2371,8 +2416,8 @@ function Ni({ accountId: e, config: t = {}, tools: r, beacon: n } = {}) {
2371
2416
  wrapTransport() {
2372
2417
  }
2373
2418
  };
2374
- const o = ur(e);
2375
- return window.__GENGAGE_AGENTIC_DEBUG_RECORD_BE__ = (i) => Ur(o, i), Gr(o), jr({
2419
+ const o = pr(e);
2420
+ return window.__GENGAGE_AGENTIC_DEBUG_RECORD__ = (i) => Re(o, i), window.__GENGAGE_AGENTIC_DEBUG_RECORD_BE__ = (i) => Re(o, i), Zr(o), Mr({
2376
2421
  accountId: e,
2377
2422
  collector: o,
2378
2423
  promptBaseUrl: t.agenticActivityPromptBaseUrl
@@ -2382,22 +2427,22 @@ function Ni({ accountId: e, config: t = {}, tools: r, beacon: n } = {}) {
2382
2427
  }), {
2383
2428
  enabled: !0,
2384
2429
  collector: o,
2385
- tools: Lr(r, o),
2386
- beacon: Rr(n, o),
2430
+ tools: Br(r, o),
2431
+ beacon: Or(n, o),
2387
2432
  record: (i) => o.record(i),
2388
- wrapTransport: () => Pr(e, o)
2433
+ wrapTransport: () => $r(e, o)
2389
2434
  };
2390
2435
  }
2391
- function yn(e, t = {}) {
2392
- return t.agenticActivityDebug === !1 ? !1 : t.agenticActivityDebug === !0 || window.__GENGAGE_PWTEST_ACCOUNT__ === e || window.__GENGAGE_AGENTIC_ACTIVITY_DEBUG__ === !0 ? !0 : !!(t.debug === !0 && wn(e));
2436
+ function Sn(e, t = {}) {
2437
+ return t.agenticActivityDebug === !1 ? !1 : t.agenticActivityDebug === !0 || window.__GENGAGE_PWTEST_ACCOUNT__ === e || window.__GENGAGE_AGENTIC_ACTIVITY_DEBUG__ === !0 ? !0 : !!(t.debug === !0 && Tn(e));
2393
2438
  }
2394
- function wn(e) {
2439
+ function Tn(e) {
2395
2440
  return Array.from(document.scripts || []).some((t) => {
2396
2441
  const r = t?.src || "";
2397
2442
  return r.includes(`/${e}/glov.js`) && /[?&]pwtest=/u.test(r);
2398
2443
  });
2399
2444
  }
2400
- var vn = [
2445
+ var Cn = [
2401
2446
  "sku",
2402
2447
  "group_id",
2403
2448
  "name",
@@ -2417,7 +2462,7 @@ var vn = [
2417
2462
  "in_stock",
2418
2463
  "promotions",
2419
2464
  "variants"
2420
- ], xn = [
2465
+ ], An = [
2421
2466
  "description",
2422
2467
  "description_html",
2423
2468
  "features",
@@ -2428,7 +2473,7 @@ var vn = [
2428
2473
  "documents",
2429
2474
  "delivery",
2430
2475
  "payment"
2431
- ], kn = [
2476
+ ], Rn = [
2432
2477
  "accountId",
2433
2478
  "query",
2434
2479
  "products",
@@ -2439,14 +2484,14 @@ var vn = [
2439
2484
  "available_facets",
2440
2485
  "logs",
2441
2486
  "meta"
2442
- ], Sn = [
2487
+ ], Pn = [
2443
2488
  "source",
2444
2489
  "sourceType",
2445
2490
  "sourceProfile",
2446
2491
  "products",
2447
2492
  "queries",
2448
2493
  "logs"
2449
- ], _n = [
2494
+ ], Ln = [
2450
2495
  "items",
2451
2496
  "kind",
2452
2497
  "label",
@@ -2454,11 +2499,11 @@ var vn = [
2454
2499
  "count",
2455
2500
  "privacy"
2456
2501
  ];
2457
- function Mi({ accountId: e, search: t, facetedSearch: r, similaritySearch: n, searchGiftOptions: o, filters: i = {}, resultContract: a = {}, limitations: s = [], extraTools: c = [] } = {}) {
2502
+ function zi({ accountId: e, search: t, facetedSearch: r, similaritySearch: n, searchGiftOptions: o, filters: i = {}, resultContract: a = {}, limitations: s = [], extraTools: c = [] } = {}) {
2458
2503
  return {
2459
- searchKeyword: async (f = {}, b = {}) => t(En(f, b)),
2504
+ searchKeyword: async (f = {}, b = {}) => t(Nn(f, b)),
2460
2505
  facetedSearch: typeof r == "function" ? (f = {}, b = {}) => r(qe(f, b)) : async (f = {}, b = {}) => t(qe(f, b)),
2461
- getSearchCapabilities: () => Tn({
2506
+ getSearchCapabilities: () => jn({
2462
2507
  accountId: e,
2463
2508
  hasSimilarity: typeof n == "function",
2464
2509
  hasGiftSearch: typeof o == "function",
@@ -2469,10 +2514,10 @@ function Mi({ accountId: e, search: t, facetedSearch: r, similaritySearch: n, se
2469
2514
  })
2470
2515
  };
2471
2516
  }
2472
- function Tn({ accountId: e, hasSimilarity: t = !0, hasGiftSearch: r = !1, filters: n = {}, resultContract: o = {}, limitations: i = [], extraTools: a = [] } = {}) {
2517
+ function jn({ accountId: e, hasSimilarity: t = !0, hasGiftSearch: r = !1, filters: n = {}, resultContract: o = {}, limitations: i = [], extraTools: a = [] } = {}) {
2473
2518
  return {
2474
2519
  accountId: e,
2475
- tools: Cn([
2520
+ tools: In([
2476
2521
  "search",
2477
2522
  "searchKeyword",
2478
2523
  "facetedSearch",
@@ -2501,11 +2546,11 @@ function Tn({ accountId: e, hasSimilarity: t = !0, hasGiftSearch: r = !1, filter
2501
2546
  ...n
2502
2547
  },
2503
2548
  resultContract: {
2504
- productItemFields: vn,
2505
- productDetailFields: xn,
2506
- searchResultFields: kn,
2507
- similarityResultFields: Sn,
2508
- siteContentFields: _n,
2549
+ productItemFields: Cn,
2550
+ productDetailFields: An,
2551
+ searchResultFields: Rn,
2552
+ similarityResultFields: Pn,
2553
+ siteContentFields: Ln,
2509
2554
  ...o
2510
2555
  },
2511
2556
  privacy: [
@@ -2517,7 +2562,7 @@ function Tn({ accountId: e, hasSimilarity: t = !0, hasGiftSearch: r = !1, filter
2517
2562
  limitations: i
2518
2563
  };
2519
2564
  }
2520
- function En(e, t) {
2565
+ function Nn(e, t) {
2521
2566
  return ce(typeof e == "string" ? {
2522
2567
  ...t,
2523
2568
  query: e
@@ -2541,7 +2586,7 @@ function qe(e, t) {
2541
2586
  });
2542
2587
  return n === "" && (o.query = ""), o;
2543
2588
  }
2544
- function Cn(e) {
2589
+ function In(e) {
2545
2590
  const t = /* @__PURE__ */ new Set();
2546
2591
  return e.filter((r) => {
2547
2592
  const n = String(r || "");
@@ -2551,8 +2596,8 @@ function Cn(e) {
2551
2596
  function ce(e) {
2552
2597
  return Object.fromEntries(Object.entries(e || {}).filter(([, t]) => t != null && t !== "" && (!Array.isArray(t) || t.length)));
2553
2598
  }
2554
- var An = 15e3, Ln = "glov_agentic_iframe", Rn = "position:absolute;width:1px;height:1px;left:-9999px;top:-9999px;opacity:0;pointer-events:none;";
2555
- function Fi({ markerParam: e = Ln, markerValue: t = "agentic-scraper", frameName: r = t, sandbox: n = "allow-same-origin", timeoutMs: o = An, hiddenStyle: i = Rn, messageType: a, parser: s, isBlockedDocument: c } = {}) {
2599
+ var Un = 15e3, qn = "glov_agentic_iframe", Bn = "position:absolute;width:1px;height:1px;left:-9999px;top:-9999px;opacity:0;pointer-events:none;";
2600
+ function Hi({ markerParam: e = qn, markerValue: t = "agentic-scraper", frameName: r = t, sandbox: n = "allow-same-origin", timeoutMs: o = Un, hiddenStyle: i = Bn, messageType: a, parser: s, isBlockedDocument: c } = {}) {
2556
2601
  const d = a || `gengage:agentic-iframe-scraper:${t}`;
2557
2602
  function f(p, g = {}) {
2558
2603
  const u = new URL(String(p), re());
@@ -2577,15 +2622,15 @@ function Fi({ markerParam: e = Ln, markerValue: t = "agentic-scraper", frameName
2577
2622
  timedOut: !1,
2578
2623
  via: "unavailable"
2579
2624
  };
2580
- const E = f(p), x = k.createElement("iframe");
2625
+ const T = f(p), x = k.createElement("iframe");
2581
2626
  x.name = r;
2582
2627
  try {
2583
2628
  x.sandbox = n;
2584
2629
  } catch {
2585
2630
  }
2586
2631
  return x.style && (x.style.cssText = i), new Promise((C) => {
2587
- let O = !1;
2588
- const z = typeof v?.addEventListener == "function" && typeof v?.removeEventListener == "function", ct = v.setTimeout(() => {
2632
+ let M = !1;
2633
+ const z = typeof v?.addEventListener == "function" && typeof v?.removeEventListener == "function", ut = v.setTimeout(() => {
2589
2634
  ee({
2590
2635
  attempted: !0,
2591
2636
  doc: null,
@@ -2595,20 +2640,20 @@ function Fi({ markerParam: e = Ln, markerValue: t = "agentic-scraper", frameName
2595
2640
  via: "timeout"
2596
2641
  });
2597
2642
  }, o);
2598
- function lt() {
2599
- v.clearTimeout(ct), z && v.removeEventListener("message", ke), typeof x.remove == "function" && x.remove();
2643
+ function dt() {
2644
+ v.clearTimeout(ut), z && v.removeEventListener("message", ke), typeof x.remove == "function" && x.remove();
2600
2645
  }
2601
2646
  function ee(A) {
2602
- O || (O = !0, lt(), C(A));
2647
+ M || (M = !0, dt(), C(A));
2603
2648
  }
2604
2649
  function ke(A) {
2605
2650
  if (A.source && x.contentWindow && A.source !== x.contentWindow) return;
2606
- const P = A.data;
2607
- !P || P.type !== d || P.marker !== t || ee({
2651
+ const L = A.data;
2652
+ !L || L.type !== d || L.marker !== t || ee({
2608
2653
  attempted: !0,
2609
2654
  doc: null,
2610
- result: P.payload || null,
2611
- blocked: !!P.blocked,
2655
+ result: L.payload || null,
2656
+ blocked: !!L.blocked,
2612
2657
  timedOut: !1,
2613
2658
  via: "postMessage"
2614
2659
  });
@@ -2616,21 +2661,21 @@ function Fi({ markerParam: e = Ln, markerValue: t = "agentic-scraper", frameName
2616
2661
  x.addEventListener("load", () => {
2617
2662
  if (x.contentWindow?.location?.href !== "about:blank")
2618
2663
  try {
2619
- const A = x.contentDocument || x.contentWindow?.document || null, P = !!w?.(A);
2664
+ const A = x.contentDocument || x.contentWindow?.document || null, L = !!w?.(A);
2620
2665
  ee({
2621
2666
  attempted: !0,
2622
2667
  doc: A,
2623
2668
  result: typeof h == "function" ? h(A, {
2624
- url: E,
2669
+ url: T,
2625
2670
  input: g
2626
2671
  }) : null,
2627
- blocked: P,
2672
+ blocked: L,
2628
2673
  timedOut: !1,
2629
2674
  via: "contentDocument"
2630
2675
  });
2631
2676
  } catch {
2632
2677
  }
2633
- }), z && v.addEventListener("message", ke), k.body.appendChild(x), x.src = E;
2678
+ }), z && v.addEventListener("message", ke), k.body.appendChild(x), x.src = T;
2634
2679
  });
2635
2680
  }
2636
2681
  function l(p = s, { targetOrigin: g = re() } = {}) {
@@ -2657,24 +2702,24 @@ function Fi({ markerParam: e = Ln, markerValue: t = "agentic-scraper", frameName
2657
2702
  postCurrentDocument: l
2658
2703
  };
2659
2704
  }
2660
- function Oi(e, { accountId: t, type: r = "agenticSearchFrame" } = {}) {
2705
+ function Wi(e, { accountId: t, type: r = "agenticSearchFrame" } = {}) {
2661
2706
  return e?.isScraperFrame?.() ? (t && globalThis.window && (globalThis.window.GengageAssistantInjector ||= {}, globalThis.window.GengageAssistantInjector[t] ||= { type: r }), !0) : !1;
2662
2707
  }
2663
2708
  function re() {
2664
2709
  return globalThis.window?.location?.origin || globalThis.location?.origin || "https://example.invalid";
2665
2710
  }
2666
- function Bi({ rootUrl: e, successMessage: t, alreadyCurrentPageMessage: r = t, missingUrlMessage: n = "Ürün sayfasını açmak için ürün bağlantısı gerekiyor." } = {}) {
2711
+ function Vi({ rootUrl: e, successMessage: t, alreadyCurrentPageMessage: r = t, missingUrlMessage: n = "Ürün sayfasını açmak için ürün bağlantısı gerekiyor." } = {}) {
2667
2712
  const o = new URL(e).origin;
2668
2713
  return async function(a = {}) {
2669
- const s = a.product || {}, c = Pn(a.url || a.productUrl || s.url, e, o), d = a.sku || s.sku || null;
2670
- return c ? In(c) ? {
2714
+ const s = a.product || {}, c = On(a.url || a.productUrl || s.url, e, o), d = a.sku || s.sku || null;
2715
+ return c ? Mn(c) ? {
2671
2716
  ok: !0,
2672
2717
  sku: d,
2673
2718
  url: c,
2674
2719
  method: "already-current-page",
2675
2720
  alreadyCurrentPage: !0,
2676
2721
  message: r || t
2677
- } : (jn(c), {
2722
+ } : ($n(c), {
2678
2723
  ok: !0,
2679
2724
  sku: d,
2680
2725
  url: c,
@@ -2688,7 +2733,7 @@ function Bi({ rootUrl: e, successMessage: t, alreadyCurrentPageMessage: r = t, m
2688
2733
  };
2689
2734
  };
2690
2735
  }
2691
- function Pn(e, t, r = new URL(t).origin) {
2736
+ function On(e, t, r = new URL(t).origin) {
2692
2737
  if (!e) return "";
2693
2738
  try {
2694
2739
  const n = new URL(e, t);
@@ -2697,7 +2742,7 @@ function Pn(e, t, r = new URL(t).origin) {
2697
2742
  return "";
2698
2743
  }
2699
2744
  }
2700
- function jn(e) {
2745
+ function $n(e) {
2701
2746
  if (typeof document > "u") {
2702
2747
  window.location.href = e;
2703
2748
  return;
@@ -2707,7 +2752,7 @@ function jn(e) {
2707
2752
  window.location.href !== e && window.location.assign(e);
2708
2753
  }, 0);
2709
2754
  }
2710
- function In(e) {
2755
+ function Mn(e) {
2711
2756
  try {
2712
2757
  const t = new URL(globalThis.window?.location?.href || "", e), r = new URL(e, t.href);
2713
2758
  return t.hash = "", r.hash = "", t.href === r.href;
@@ -2715,12 +2760,12 @@ function In(e) {
2715
2760
  return !1;
2716
2761
  }
2717
2762
  }
2718
- function Un({ accountId: e, supplied: t = [], pageProduct: r = null, listingProducts: n = [], skus: o = [], limit: i = 4, storedProducts: a = [], getStoredPanelProducts: s } = {}) {
2719
- const c = it(o), d = Array.isArray(n) ? n : [], f = typeof s == "function" ? s({
2763
+ function Fn({ accountId: e, supplied: t = [], pageProduct: r = null, listingProducts: n = [], skus: o = [], limit: i = 4, storedProducts: a = [], getStoredPanelProducts: s } = {}) {
2764
+ const c = st(o), d = Array.isArray(n) ? n : [], f = typeof s == "function" ? s({
2720
2765
  accountId: e,
2721
2766
  visibleProducts: d
2722
2767
  }) : a;
2723
- return qn([
2768
+ return Dn([
2724
2769
  ...K(t),
2725
2770
  ...K(f),
2726
2771
  r,
@@ -2730,11 +2775,11 @@ function Un({ accountId: e, supplied: t = [], pageProduct: r = null, listingProd
2730
2775
  limit: i
2731
2776
  });
2732
2777
  }
2733
- function $i({ accountId: e, rootUrl: t, getProduct: r, getProducts: n, getStoredPanelProducts: o, limit: i = 4 } = {}) {
2778
+ function Ki({ accountId: e, rootUrl: t, getProduct: r, getProducts: n, getStoredPanelProducts: o, limit: i = 4 } = {}) {
2734
2779
  return async function(s = {}) {
2735
2780
  return {
2736
2781
  accountId: e,
2737
- products: Un({
2782
+ products: Fn({
2738
2783
  accountId: e,
2739
2784
  supplied: Array.isArray(s.products) ? s.products : [],
2740
2785
  pageProduct: r?.(),
@@ -2747,41 +2792,41 @@ function $i({ accountId: e, rootUrl: t, getProduct: r, getProducts: n, getStored
2747
2792
  };
2748
2793
  };
2749
2794
  }
2750
- function qn(e, { skus: t = [], limit: r = 4 } = {}) {
2751
- const n = new Set(it(t)), o = /* @__PURE__ */ new Set(), i = [];
2795
+ function Dn(e, { skus: t = [], limit: r = 4 } = {}) {
2796
+ const n = new Set(st(t)), o = /* @__PURE__ */ new Set(), i = [];
2752
2797
  for (const a of K(e)) {
2753
2798
  if (!a) continue;
2754
- const s = H(a?.sku);
2799
+ const s = W(a?.sku);
2755
2800
  if (n.size && !n.has(s)) continue;
2756
- const c = s || H(a?.url) || H(a?.name || a?.title);
2801
+ const c = s || W(a?.url) || W(a?.name || a?.title);
2757
2802
  if (!(c && o.has(c)) && (c && o.add(c), i.push(a), i.length >= r))
2758
2803
  break;
2759
2804
  }
2760
2805
  return i;
2761
2806
  }
2762
- function it(e) {
2763
- return K(e).map(H).filter(Boolean);
2807
+ function st(e) {
2808
+ return K(e).map(W).filter(Boolean);
2764
2809
  }
2765
- function H(e) {
2810
+ function W(e) {
2766
2811
  return String(e || "").trim();
2767
2812
  }
2768
2813
  function K(e) {
2769
2814
  return Array.isArray(e) ? e.filter(Boolean) : e ? [e] : [];
2770
2815
  }
2771
- var I = {
2816
+ var N = {
2772
2817
  headings: 8,
2773
2818
  products: 8,
2774
2819
  controls: 12,
2775
2820
  textMatches: 8,
2776
2821
  snippetChars: 180
2777
- }, J = /\b(?:checkout|payment|pay now|place order|delete|remove|confirm|submit|ödeme|odeme|siparişi tamamla|siparisi tamamla|satın al|satin al|sil|kaldır|kaldir|onayla|gönder|gonder)\b/iu, Nn = /(?:token|session|sid|auth|code|csrf|secret|key|password|passwd|phone|email|address|postcode|zip|jwt|bearer)/iu, Mn = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\+?\d[\d\s().-]{8,}\d|[A-Z]{1,2}\d[A-Z\d]?\s*\d[A-Z]{2}|[A-Za-z0-9_-]{24,}/iu, Fn = {
2822
+ }, J = /\b(?:checkout|payment|pay now|place order|delete|remove|confirm|submit|ödeme|odeme|siparişi tamamla|siparisi tamamla|satın al|satin al|sil|kaldır|kaldir|onayla|gönder|gonder)\b/iu, Gn = /(?:token|session|sid|auth|code|csrf|secret|key|password|passwd|phone|email|address|postcode|zip|jwt|bearer)/iu, zn = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\+?\d[\d\s().-]{8,}\d|[A-Z]{1,2}\d[A-Z\d]?\s*\d[A-Z]{2}|[A-Za-z0-9_-]{24,}/iu, Hn = {
2778
2823
  campaign: /\b(?:campaign|promotion|discount|deal|coupon|kampanya|indirim|firsat|fırsat|kupon)\b/iu,
2779
2824
  blog: /\b(?:blog|journal|guide|article|editorial|inspiration|rehber|makale|ilham|icerik|içerik)\b/iu,
2780
2825
  category: /\b(?:category|collection|department|kategori|koleksiyon|reyon)\b/iu
2781
2826
  };
2782
- function Di({ accountId: e, getPageType: t, getProduct: r, getProducts: n, normalizeProduct: o = (i) => i }) {
2827
+ function Ji({ accountId: e, getPageType: t, getProduct: r, getProducts: n, normalizeProduct: o = (i) => i }) {
2783
2828
  return {
2784
- scanSite: (i = {}) => On({
2829
+ scanSite: (i = {}) => Wn({
2785
2830
  accountId: e,
2786
2831
  getPageType: t,
2787
2832
  getProduct: r,
@@ -2789,33 +2834,33 @@ function Di({ accountId: e, getPageType: t, getProduct: r, getProducts: n, norma
2789
2834
  normalizeProduct: o,
2790
2835
  input: i
2791
2836
  }),
2792
- siteGrep: (i = {}) => Bn(i),
2793
- discoverSiteContent: (i = {}) => at(i, e),
2794
- runSiteCommand: (i = {}) => $n(i),
2795
- describeVisualContext: (i = {}) => Dn(i, e),
2796
- inspectProductSurface: ft({
2837
+ siteGrep: (i = {}) => Vn(i),
2838
+ discoverSiteContent: (i = {}) => ct(i, e),
2839
+ runSiteCommand: (i = {}) => Kn(i),
2840
+ describeVisualContext: (i = {}) => Jn(i, e),
2841
+ inspectProductSurface: mt({
2797
2842
  accountId: e,
2798
2843
  getPageType: t,
2799
2844
  getProduct: r,
2800
2845
  getProducts: n,
2801
2846
  normalizeProduct: o
2802
2847
  }),
2803
- getSiteCapabilities: () => Hn(e)
2848
+ getSiteCapabilities: () => Qn(e)
2804
2849
  };
2805
2850
  }
2806
- function On({ accountId: e, getPageType: t, getProduct: r, getProducts: n, normalizeProduct: o, input: i }) {
2807
- const a = S(i.query || i.text || ""), s = ve(i), c = ne(r), d = ne(n) || [];
2851
+ function Wn({ accountId: e, getPageType: t, getProduct: r, getProducts: n, normalizeProduct: o, input: i }) {
2852
+ const a = _(i.query || i.text || ""), s = ve(i), c = ne(r), d = ne(n) || [];
2808
2853
  return xe({
2809
2854
  accountId: e,
2810
- url: io(),
2811
- title: R(document.title || ""),
2855
+ url: po(),
2856
+ title: P(document.title || ""),
2812
2857
  pageType: ne(t) || "other",
2813
- viewport: ao(),
2814
- product: Ne(o(c)),
2815
- products: d.map(o).map(Ne).filter(Boolean).slice(0, s.products),
2816
- content: i.includeContent === !1 ? void 0 : at(i, e).items,
2817
- headings: Wn(s.headings),
2818
- controls: i.includeControls === !1 ? void 0 : Vn(s.controls),
2858
+ viewport: mo(),
2859
+ product: Be(o(c)),
2860
+ products: d.map(o).map(Be).filter(Boolean).slice(0, s.products),
2861
+ content: i.includeContent === !1 ? void 0 : ct(i, e).items,
2862
+ headings: Xn(s.headings),
2863
+ controls: i.includeControls === !1 ? void 0 : eo(s.controls),
2819
2864
  textMatches: a ? be(a, s) : [],
2820
2865
  privacy: {
2821
2866
  rawHtml: !1,
@@ -2825,22 +2870,22 @@ function On({ accountId: e, getPageType: t, getProduct: r, getProducts: n, norma
2825
2870
  }
2826
2871
  });
2827
2872
  }
2828
- function at(e = {}, t = "") {
2829
- const r = ve(e), n = new Set(Yn(e.kinds || e.kind)), o = Kn(r.controls).filter((i) => !n.size || n.has(i.kind)).slice(0, r.controls);
2873
+ function ct(e = {}, t = "") {
2874
+ const r = ve(e), n = new Set(no(e.kinds || e.kind)), o = to(r.controls).filter((i) => !n.size || n.has(i.kind)).slice(0, r.controls);
2830
2875
  return {
2831
2876
  accountId: t,
2832
2877
  items: o,
2833
2878
  count: o.length,
2834
- privacy: L()
2879
+ privacy: R()
2835
2880
  };
2836
2881
  }
2837
- function Bn(e = {}) {
2838
- const t = S(e.query || e.text || e.pattern || "");
2882
+ function Vn(e = {}) {
2883
+ const t = _(e.query || e.text || e.pattern || "");
2839
2884
  if (!t) return {
2840
2885
  ok: !1,
2841
2886
  matches: [],
2842
2887
  message: "Provide a query to scan visible page text.",
2843
- privacy: L()
2888
+ privacy: R()
2844
2889
  };
2845
2890
  const r = be(t, ve(e));
2846
2891
  return {
@@ -2848,34 +2893,34 @@ function Bn(e = {}) {
2848
2893
  query: t,
2849
2894
  matches: r,
2850
2895
  count: r.length,
2851
- privacy: L()
2896
+ privacy: R()
2852
2897
  };
2853
2898
  }
2854
- function $n(e = {}) {
2855
- const t = S(e.command || e.action || "").toLowerCase();
2856
- return t === "scroll_to_text" || t === "scrolltotext" ? zn(e) : t === "click_visible_text" || t === "clickvisibletext" ? Gn(e) : t === "scroll_top" || t === "scrolltotop" ? (window.scrollTo({
2899
+ function Kn(e = {}) {
2900
+ const t = _(e.command || e.action || "").toLowerCase();
2901
+ return t === "scroll_to_text" || t === "scrolltotext" ? Yn(e) : t === "click_visible_text" || t === "clickvisibletext" ? Zn(e) : t === "scroll_top" || t === "scrolltotop" ? (window.scrollTo({
2857
2902
  top: 0,
2858
2903
  behavior: "smooth"
2859
2904
  }), {
2860
2905
  ok: !0,
2861
2906
  command: "scroll_top",
2862
2907
  message: "Scrolled to the top of the page.",
2863
- privacy: L()
2908
+ privacy: R()
2864
2909
  }) : {
2865
2910
  ok: !1,
2866
2911
  command: t,
2867
2912
  message: "Supported commands are scroll_to_text, click_visible_text, and scroll_top.",
2868
- privacy: L()
2913
+ privacy: R()
2869
2914
  };
2870
2915
  }
2871
- function Dn(e = {}, t) {
2872
- const r = e.visual_consent === !0 || e.visualConsent === !0 || e.consent === !0, n = r ? Qn(e.visual_observations || e.visualObservations) : [], o = Zn(Number(e.maxImages || 8));
2916
+ function Jn(e = {}, t) {
2917
+ const r = e.visual_consent === !0 || e.visualConsent === !0 || e.consent === !0, n = r ? io(e.visual_observations || e.visualObservations) : [], o = oo(Number(e.maxImages || 8));
2873
2918
  return {
2874
2919
  accountId: t,
2875
2920
  ok: r || o.length > 0,
2876
2921
  consentedObservations: n,
2877
2922
  visibleImages: o,
2878
- message: Xn({
2923
+ message: ao({
2879
2924
  consented: r,
2880
2925
  observations: n,
2881
2926
  visibleImages: o
@@ -2890,8 +2935,8 @@ function Dn(e = {}, t) {
2890
2935
  }
2891
2936
  };
2892
2937
  }
2893
- function zn(e) {
2894
- const t = S(e.query || e.text || e.label || ""), r = t ? ro(t) : null;
2938
+ function Yn(e) {
2939
+ const t = _(e.query || e.text || e.label || ""), r = t ? lo(t) : null;
2895
2940
  return r ? (r.scrollIntoView({
2896
2941
  block: "center",
2897
2942
  inline: "nearest",
@@ -2899,17 +2944,17 @@ function zn(e) {
2899
2944
  }), {
2900
2945
  ok: !0,
2901
2946
  command: "scroll_to_text",
2902
- label: F(r),
2947
+ label: $(r),
2903
2948
  message: "Scrolled to the matching page area.",
2904
- privacy: L()
2949
+ privacy: R()
2905
2950
  }) : {
2906
2951
  ok: !1,
2907
2952
  command: "scroll_to_text",
2908
2953
  message: "No visible matching text found."
2909
2954
  };
2910
2955
  }
2911
- function Gn(e) {
2912
- const t = S(e.label || e.query || e.text || "");
2956
+ function Zn(e) {
2957
+ const t = _(e.label || e.query || e.text || "");
2913
2958
  if (!t) return {
2914
2959
  ok: !1,
2915
2960
  command: "click_visible_text",
@@ -2920,31 +2965,31 @@ function Gn(e) {
2920
2965
  blocked: !0,
2921
2966
  command: "click_visible_text",
2922
2967
  message: "This looks like a checkout, payment, destructive, or final confirmation action, so it was not clicked.",
2923
- privacy: L()
2968
+ privacy: R()
2924
2969
  };
2925
- const r = to(t);
2970
+ const r = co(t);
2926
2971
  if (!r) return {
2927
2972
  ok: !1,
2928
2973
  command: "click_visible_text",
2929
2974
  message: "No safe visible clickable control found."
2930
2975
  };
2931
- const n = F(r);
2976
+ const n = $(r);
2932
2977
  return J.test(n) ? {
2933
2978
  ok: !1,
2934
2979
  blocked: !0,
2935
2980
  command: "click_visible_text",
2936
2981
  label: n,
2937
2982
  message: "The matched control is blocked by the safe-click policy.",
2938
- privacy: L()
2983
+ privacy: R()
2939
2984
  } : (r.click(), {
2940
2985
  ok: !0,
2941
2986
  command: "click_visible_text",
2942
2987
  label: n,
2943
2988
  message: "Clicked the safe visible control.",
2944
- privacy: L()
2989
+ privacy: R()
2945
2990
  });
2946
2991
  }
2947
- function Hn(e) {
2992
+ function Qn(e) {
2948
2993
  return {
2949
2994
  accountId: e,
2950
2995
  tools: [
@@ -2972,21 +3017,21 @@ function Hn(e) {
2972
3017
  ]
2973
3018
  };
2974
3019
  }
2975
- function Wn(e) {
2976
- return [...document.querySelectorAll('h1,h2,h3,[role="heading"]')].filter(j).map((t) => R(S(t.textContent))).filter(Boolean).slice(0, e);
3020
+ function Xn(e) {
3021
+ return [...document.querySelectorAll('h1,h2,h3,[role="heading"]')].filter(j).map((t) => P(_(t.textContent))).filter(Boolean).slice(0, e);
2977
3022
  }
2978
- function Vn(e) {
3023
+ function eo(e) {
2979
3024
  return [...document.querySelectorAll('button,a,[role="button"],summary,input[type="button"],input[type="submit"]')].filter(j).map((t) => ({
2980
- label: F(t),
3025
+ label: $(t),
2981
3026
  tag: t.tagName?.toLowerCase(),
2982
3027
  role: t.getAttribute?.("role") || null,
2983
- href: st(t),
2984
- safeClick: !J.test(F(t))
3028
+ href: lt(t),
3029
+ safeClick: !J.test($(t))
2985
3030
  })).filter((t) => t.label).filter(X((t) => `${t.tag}:${t.label}:${t.href || ""}`)).slice(0, e);
2986
3031
  }
2987
- function Kn(e) {
3032
+ function to(e) {
2988
3033
  return [...document.querySelectorAll('a[href],button,[role="button"],summary')].filter(j).map((t) => {
2989
- const r = F(t), n = st(t), o = Jn([
3034
+ const r = $(t), n = lt(t), o = ro([
2990
3035
  r,
2991
3036
  n,
2992
3037
  le(t)
@@ -3000,37 +3045,37 @@ function Kn(e) {
3000
3045
  }) : null;
3001
3046
  }).filter(Boolean).filter(X((t) => `${t.kind}:${t.label}:${t.href || ""}`)).slice(0, Math.max(1, Math.min(e, 30)));
3002
3047
  }
3003
- function Jn(e) {
3004
- for (const [t, r] of Object.entries(Fn)) if (r.test(e)) return t;
3048
+ function ro(e) {
3049
+ for (const [t, r] of Object.entries(Hn)) if (r.test(e)) return t;
3005
3050
  return "";
3006
3051
  }
3007
- function Yn(e) {
3008
- return (Array.isArray(e) ? e : String(e || "").split(/[,|]/u)).map((t) => S(t).toLowerCase()).filter(Boolean);
3052
+ function no(e) {
3053
+ return (Array.isArray(e) ? e : String(e || "").split(/[,|]/u)).map((t) => _(t).toLowerCase()).filter(Boolean);
3009
3054
  }
3010
3055
  function be(e, t) {
3011
3056
  const r = e.toLocaleLowerCase("tr-TR");
3012
- return eo(document.body).map((n) => ({
3057
+ return so(document.body).map((n) => ({
3013
3058
  node: n,
3014
- text: S(n.nodeValue || "")
3059
+ text: _(n.nodeValue || "")
3015
3060
  })).filter(({ text: n }) => n && n.toLocaleLowerCase("tr-TR").includes(r)).map(({ node: n, text: o }) => ({
3016
- snippet: no(o, e, t.snippetChars),
3061
+ snippet: uo(o, e, t.snippetChars),
3017
3062
  tag: n.parentElement?.tagName?.toLowerCase() || "",
3018
3063
  heading: le(n.parentElement)
3019
3064
  })).filter((n) => n.snippet).filter(X((n) => n.snippet)).slice(0, t.textMatches);
3020
3065
  }
3021
- function Zn(e) {
3066
+ function oo(e) {
3022
3067
  return [...document.querySelectorAll("img")].filter(j).map((t) => ({
3023
- alt: R(S(t.getAttribute("alt") || t.getAttribute("aria-label") || "")),
3024
- title: R(S(t.getAttribute("title") || "")),
3068
+ alt: P(_(t.getAttribute("alt") || t.getAttribute("aria-label") || "")),
3069
+ title: P(_(t.getAttribute("title") || "")),
3025
3070
  src: ye(t.currentSrc || t.getAttribute("src")),
3026
3071
  width: Math.round(t.getBoundingClientRect().width),
3027
3072
  height: Math.round(t.getBoundingClientRect().height)
3028
3073
  })).filter((t) => t.alt || t.title || t.src).filter(X((t) => `${t.alt}:${t.title}:${t.src}`)).slice(0, Math.max(1, Math.min(Number.isFinite(e) && e > 0 ? Math.floor(e) : 8, 20)));
3029
3074
  }
3030
- function Qn(e) {
3031
- return (Array.isArray(e) ? e : String(e || "").split(/\n|;|\|/u)).map((t) => R(t).slice(0, 180)).filter(Boolean).slice(0, 8);
3075
+ function io(e) {
3076
+ return (Array.isArray(e) ? e : String(e || "").split(/\n|;|\|/u)).map((t) => P(t).slice(0, 180)).filter(Boolean).slice(0, 8);
3032
3077
  }
3033
- function Xn({ consented: e, observations: t, visibleImages: r }) {
3078
+ function ao({ consented: e, observations: t, visibleImages: r }) {
3034
3079
  const n = [];
3035
3080
  if (t.length && n.push(`Consented visual observations: ${t.slice(0, 3).join(" | ")}.`), r.length) {
3036
3081
  const o = r.map((i) => i.alt || i.title).filter(Boolean).slice(0, 3);
@@ -3038,11 +3083,11 @@ function Xn({ consented: e, observations: t, visibleImages: r }) {
3038
3083
  }
3039
3084
  return !n.length && !e && n.push("I can use visible image labels, but external visual observations need explicit shopper consent."), n.push("No screenshots or pixels were captured or sent."), n.join(" ");
3040
3085
  }
3041
- function eo(e) {
3086
+ function so(e) {
3042
3087
  if (!e) return [];
3043
3088
  const t = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, { acceptNode(n) {
3044
3089
  const o = n.parentElement;
3045
- return !o || !j(o) || /^(script|style|noscript|template|svg)$/iu.test(o.tagName || "") || oo(o) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
3090
+ return !o || !j(o) || /^(script|style|noscript|template|svg)$/iu.test(o.tagName || "") || fo(o) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
3046
3091
  } }), r = [];
3047
3092
  for (; r.length < 500; ) {
3048
3093
  const n = t.nextNode();
@@ -3051,42 +3096,42 @@ function eo(e) {
3051
3096
  }
3052
3097
  return r;
3053
3098
  }
3054
- function to(e) {
3055
- return [...document.querySelectorAll('button,a,[role="button"],summary,input[type="button"],input[type="submit"]')].filter(j).find((t) => F(t).toLocaleLowerCase("tr-TR").includes(e.toLocaleLowerCase("tr-TR")));
3099
+ function co(e) {
3100
+ return [...document.querySelectorAll('button,a,[role="button"],summary,input[type="button"],input[type="submit"]')].filter(j).find((t) => $(t).toLocaleLowerCase("tr-TR").includes(e.toLocaleLowerCase("tr-TR")));
3056
3101
  }
3057
- function ro(e) {
3102
+ function lo(e) {
3058
3103
  const t = be(e, {
3059
- ...I,
3104
+ ...N,
3060
3105
  textMatches: 1
3061
3106
  })[0];
3062
- return t ? [...document.querySelectorAll("body *")].filter(j).find((r) => S(r.textContent).includes(t.snippet.slice(0, 24))) : null;
3107
+ return t ? [...document.querySelectorAll("body *")].filter(j).find((r) => _(r.textContent).includes(t.snippet.slice(0, 24))) : null;
3063
3108
  }
3064
- function F(e) {
3065
- return e ? R(S(e.getAttribute?.("aria-label") || e.getAttribute?.("title") || e.getAttribute?.("alt") || e.value || e.textContent || "")).slice(0, 90) : "";
3109
+ function $(e) {
3110
+ return e ? P(_(e.getAttribute?.("aria-label") || e.getAttribute?.("title") || e.getAttribute?.("alt") || e.value || e.textContent || "")).slice(0, 90) : "";
3066
3111
  }
3067
3112
  function le(e) {
3068
3113
  let t = e;
3069
3114
  for (let r = 0; t && r < 5; r += 1) {
3070
- const n = S((t.matches?.('h1,h2,h3,[role="heading"]') ? t : t.querySelector?.('h1,h2,h3,[role="heading"]'))?.textContent || "");
3071
- if (n) return R(n).slice(0, 90);
3115
+ const n = _((t.matches?.('h1,h2,h3,[role="heading"]') ? t : t.querySelector?.('h1,h2,h3,[role="heading"]'))?.textContent || "");
3116
+ if (n) return P(n).slice(0, 90);
3072
3117
  t = t.parentElement;
3073
3118
  }
3074
3119
  return "";
3075
3120
  }
3076
- function Ne(e) {
3121
+ function Be(e) {
3077
3122
  return e ? xe({
3078
- sku: S(e.sku || e.id || ""),
3079
- name: S(e.name || e.title || ""),
3123
+ sku: _(e.sku || e.id || ""),
3124
+ name: _(e.name || e.title || ""),
3080
3125
  url: ye(e.url),
3081
- price_text: S(e.price_text || e.priceText || ""),
3126
+ price_text: _(e.price_text || e.priceText || ""),
3082
3127
  price: e.price,
3083
3128
  currency: e.price_currency || e.currency,
3084
3129
  in_stock: e.in_stock,
3085
- category: S(e.category || "")
3130
+ category: _(e.category || "")
3086
3131
  }) : null;
3087
3132
  }
3088
- function no(e, t, r) {
3089
- const n = R(e), o = n.toLocaleLowerCase("tr-TR").indexOf(t.toLocaleLowerCase("tr-TR")), i = Math.max(0, o - Math.floor(r / 3));
3133
+ function uo(e, t, r) {
3134
+ const n = P(e), o = n.toLocaleLowerCase("tr-TR").indexOf(t.toLocaleLowerCase("tr-TR")), i = Math.max(0, o - Math.floor(r / 3));
3090
3135
  return n.slice(i, i + r).trim();
3091
3136
  }
3092
3137
  function j(e) {
@@ -3096,10 +3141,10 @@ function j(e) {
3096
3141
  const r = window.getComputedStyle(e);
3097
3142
  return r.visibility !== "hidden" && r.display !== "none" && Number(r.opacity || 1) > 0;
3098
3143
  }
3099
- function oo(e) {
3144
+ function fo(e) {
3100
3145
  return !!e.closest?.('input,textarea,select,[contenteditable="true"]');
3101
3146
  }
3102
- function st(e) {
3147
+ function lt(e) {
3103
3148
  return e.tagName?.toLowerCase() !== "a" ? null : ye(e.getAttribute("href"));
3104
3149
  }
3105
3150
  function ye(e) {
@@ -3111,11 +3156,11 @@ function ye(e) {
3111
3156
  return "";
3112
3157
  }
3113
3158
  }
3114
- function io() {
3159
+ function po() {
3115
3160
  const e = new URL(window.location.href);
3116
3161
  return we(e), `${e.origin}${e.pathname}${e.search}`;
3117
3162
  }
3118
- function ao() {
3163
+ function mo() {
3119
3164
  return {
3120
3165
  width: window.innerWidth,
3121
3166
  height: window.innerHeight,
@@ -3123,10 +3168,10 @@ function ao() {
3123
3168
  documentHeight: Math.round(document.documentElement?.scrollHeight || 0)
3124
3169
  };
3125
3170
  }
3126
- function R(e) {
3127
- return S(e).replace(/https?:\/\/[^\s?#]+(?:\?[^#\s]*)?/giu, so).replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/giu, "<email>").replace(/\b(?:\+?\d[\d\s().-]{8,}\d)\b/gu, "<phone>").replace(/\b[A-Z]{1,2}\d[A-Z\d]?\s*\d[A-Z]{2}\b/giu, "<postcode>").replace(/\btoken\s*=\s*[\w.-]+/giu, "token=<redacted>").replace(/\b(?:api[_-]?key|session|csrf|secret)\s*[:=]\s*[\w.-]+/giu, "<secret>");
3171
+ function P(e) {
3172
+ return _(e).replace(/https?:\/\/[^\s?#]+(?:\?[^#\s]*)?/giu, go).replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/giu, "<email>").replace(/\b(?:\+?\d[\d\s().-]{8,}\d)\b/gu, "<phone>").replace(/\b[A-Z]{1,2}\d[A-Z\d]?\s*\d[A-Z]{2}\b/giu, "<postcode>").replace(/\btoken\s*=\s*[\w.-]+/giu, "token=<redacted>").replace(/\b(?:api[_-]?key|session|csrf|secret)\s*[:=]\s*[\w.-]+/giu, "<secret>");
3128
3173
  }
3129
- function so(e) {
3174
+ function go(e) {
3130
3175
  try {
3131
3176
  const t = new URL(e);
3132
3177
  return t.hash = "", we(t), t.href;
@@ -3137,27 +3182,27 @@ function so(e) {
3137
3182
  function we(e) {
3138
3183
  for (const [t, r] of [...e.searchParams.entries()]) {
3139
3184
  const n = String(r || "");
3140
- (Nn.test(t) || Mn.test(n)) && e.searchParams.set(t, "redacted");
3185
+ (Gn.test(t) || zn.test(n)) && e.searchParams.set(t, "redacted");
3141
3186
  }
3142
3187
  return e;
3143
3188
  }
3144
- function S(e) {
3189
+ function _(e) {
3145
3190
  return String(e || "").replace(/\s+/gu, " ").trim();
3146
3191
  }
3147
3192
  function ve(e) {
3148
3193
  return {
3149
- headings: $(e.maxHeadings, I.headings, 20),
3150
- products: $(e.maxProducts, I.products, 20),
3151
- controls: $(e.maxControls, I.controls, 30),
3152
- textMatches: $(e.maxMatches || e.limit, I.textMatches, 20),
3153
- snippetChars: $(e.snippetChars, I.snippetChars, 320)
3194
+ headings: D(e.maxHeadings, N.headings, 20),
3195
+ products: D(e.maxProducts, N.products, 20),
3196
+ controls: D(e.maxControls, N.controls, 30),
3197
+ textMatches: D(e.maxMatches || e.limit, N.textMatches, 20),
3198
+ snippetChars: D(e.snippetChars, N.snippetChars, 320)
3154
3199
  };
3155
3200
  }
3156
- function $(e, t, r) {
3201
+ function D(e, t, r) {
3157
3202
  const n = Number(e);
3158
3203
  return !Number.isFinite(n) || n <= 0 ? t : Math.min(Math.floor(n), r);
3159
3204
  }
3160
- function L() {
3205
+ function R() {
3161
3206
  return {
3162
3207
  rawHtml: !1,
3163
3208
  formValues: !1,
@@ -3183,124 +3228,124 @@ function X(e) {
3183
3228
  };
3184
3229
  }
3185
3230
  export {
3186
- pi as AgentError,
3187
- gt as ContextStore,
3188
- Go as FALLBACK_STATUS,
3189
- $o as action,
3190
- ni as actionButtonsUiSpec,
3191
- _o as alignProductsToTable,
3192
- Fo as anonymousRequestText,
3193
- ri as beErrorToAgentError,
3194
- hr as buildActivityVisualization,
3195
- lo as buildPhotoSimilarityProfile,
3196
- uo as buildProductSimilarityProfile,
3197
- fo as buildSimilarityQueries,
3198
- Je as canUseModuleWorker,
3199
- dt as caughtToStreamError,
3200
- xo as compactAccountConfig,
3201
- No as compactContextProducts,
3202
- ei as compactObject,
3203
- mi as compactProductSurfaceForLlm,
3204
- Co as comparisonResultForUi,
3205
- Po as comparisonUiSpec,
3206
- lr as createActivityCollector,
3207
- $e as createBrowserMemory,
3208
- Ui as createDiagnosticsTool,
3209
- Ei as createEndpointCachePolicies,
3210
- Ci as createEndpointHandlers,
3211
- vo as createFlow,
3212
- Mi as createGssToolAliases,
3213
- Fi as createIframeScraper,
3214
- vt as createInjectorAdapter,
3215
- Ho as createLocalRefStore,
3216
- xt as createMainThreadInjectorAdapter,
3217
- rr as createModuleWorker,
3218
- Bi as createOpenProductPageTool,
3219
- Zo as createPrivacyHelpers,
3220
- ft as createProductSurfaceInspector,
3221
- Xo as createReadPageStep,
3222
- Ii as createReadPageTool,
3223
- $i as createResolveProductsTool,
3224
- Di as createSiteAwarenessTools,
3225
- Vo as declarativeBeOpCache,
3226
- So as defaultPiiPatternPack,
3227
- ko as defaultPiiPatterns,
3228
- zo as done,
3229
- Jo as elapsedMs,
3230
- nr as endpointStableKey,
3231
- qo as error,
3232
- wi as fallbackStatus,
3233
- Kr as filterActivityEntries,
3234
- gi as firstArrayValue,
3235
- fn as formatJsonHtml,
3236
- ur as getOrCreateActivityCollector,
3237
- mr as groupForEntry,
3238
- Tn as gssSearchCapabilities,
3239
- ai as homePanelReset,
3240
- li as httpErrorToAgentError,
3241
- ki as inputHashCachePolicy,
3242
- ii as inspectProductSurface,
3243
- jr as installActivityFetchPatch,
3244
- ji as installBrowserTools,
3245
- _i as installFetchTransportBridge,
3246
- Oi as installIframeScraperBypass,
3247
- Ni as installLocalAgenticActivityDebug,
3248
- Si as isFallbackStatus,
3249
- vi as isRef,
3250
- Li as jsonResponse,
3251
- Bo as llmCacheKey,
3252
- bi as mergeProductSurfaceEvidence,
3253
- wo as metadata,
3254
- Ti as mountAccount,
3255
- Gr as mountActivityOverlay,
3256
- jn as navigateSameTab,
3257
- Ai as ndjsonResponse,
3258
- Ro as normalizeComparisonTable,
3259
- dr as normalizeEntry,
3260
- Lo as normalizeProduct,
3261
- Pn as normalizeSameOriginUrl,
3262
- po as normalizeSimilarityText,
3263
- Qo as nowIso,
3264
- ui as plainMessageContent,
3265
- jo as productDetailsUiSpec,
3266
- Eo as productFactsKey,
3267
- Oo as productSkuKey,
3268
- Ko as productSurfaceReviewText,
3269
- Uo as productsUiSpec,
3270
- mo as rankSimilarProducts,
3271
- go as rankSimilarProductsAsync,
3272
- Ur as recordBeDebugPayload,
3273
- Io as redactPii,
3274
- oi as requestText,
3275
- Pi as resolveBeUrl,
3276
- Do as resolveFlow,
3277
- Un as resolveProductCandidates,
3278
- ti as retailAnonymizeMessages,
3279
- Wo as retailAnonymousRequestText,
3280
- ci as retailRedactPii,
3281
- si as routeFlowParams,
3282
- fi as routeSkuList,
3283
- ho as scoreSimilarityCandidate,
3284
- fr as sectionForKind,
3285
- Ri as setAssistantHostVisible,
3286
- pr as severityForEntry,
3287
- yn as shouldInstallActivityDebug,
3231
+ vi as AgentError,
3232
+ bt as ContextStore,
3233
+ Zo as FALLBACK_STATUS,
3234
+ Ko as action,
3235
+ ui as actionButtonsUiSpec,
3236
+ Lo as alignProductsToTable,
3237
+ Ho as anonymousRequestText,
3238
+ li as beErrorToAgentError,
3239
+ wr as buildActivityVisualization,
3240
+ bo as buildPhotoSimilarityProfile,
3241
+ yo as buildProductSimilarityProfile,
3242
+ wo as buildSimilarityQueries,
3243
+ Ze as canUseModuleWorker,
3244
+ pt as caughtToStreamError,
3245
+ Ao as compactAccountConfig,
3246
+ Go as compactContextProducts,
3247
+ si as compactObject,
3248
+ xi as compactProductSurfaceForLlm,
3249
+ Io as comparisonResultForUi,
3250
+ Oo as comparisonUiSpec,
3251
+ fr as createActivityCollector,
3252
+ Ge as createBrowserMemory,
3253
+ Fi as createDiagnosticsTool,
3254
+ Ni as createEndpointCachePolicies,
3255
+ Ii as createEndpointHandlers,
3256
+ Co as createFlow,
3257
+ zi as createGssToolAliases,
3258
+ Hi as createIframeScraper,
3259
+ kt as createInjectorAdapter,
3260
+ Qo as createLocalRefStore,
3261
+ Et as createMainThreadInjectorAdapter,
3262
+ ir as createModuleWorker,
3263
+ Vi as createOpenProductPageTool,
3264
+ oi as createPrivacyHelpers,
3265
+ mt as createProductSurfaceInspector,
3266
+ ai as createReadPageStep,
3267
+ Mi as createReadPageTool,
3268
+ Ki as createResolveProductsTool,
3269
+ Ji as createSiteAwarenessTools,
3270
+ ei as declarativeBeOpCache,
3271
+ Po as defaultPiiPatternPack,
3272
+ Ro as defaultPiiPatterns,
3273
+ Yo as done,
3274
+ ri as elapsedMs,
3275
+ ar as endpointStableKey,
3276
+ Do as error,
3277
+ Ti as fallbackStatus,
3278
+ tn as filterActivityEntries,
3279
+ ki as firstArrayValue,
3280
+ wn as formatJsonHtml,
3281
+ pr as getOrCreateActivityCollector,
3282
+ br as groupForEntry,
3283
+ jn as gssSearchCapabilities,
3284
+ pi as homePanelReset,
3285
+ hi as httpErrorToAgentError,
3286
+ Ri as inputHashCachePolicy,
3287
+ fi as inspectProductSurface,
3288
+ Mr as installActivityFetchPatch,
3289
+ $i as installBrowserTools,
3290
+ Li as installFetchTransportBridge,
3291
+ Wi as installIframeScraperBypass,
3292
+ Gi as installLocalAgenticActivityDebug,
3293
+ Pi as isFallbackStatus,
3294
+ Ci as isRef,
3295
+ qi as jsonResponse,
3296
+ Vo as llmCacheKey,
3297
+ Ei as mergeProductSurfaceEvidence,
3298
+ To as metadata,
3299
+ ji as mountAccount,
3300
+ Zr as mountActivityOverlay,
3301
+ $n as navigateSameTab,
3302
+ Ui as ndjsonResponse,
3303
+ Bo as normalizeComparisonTable,
3304
+ mr as normalizeEntry,
3305
+ qo as normalizeProduct,
3306
+ On as normalizeSameOriginUrl,
3307
+ vo as normalizeSimilarityText,
3308
+ ii as nowIso,
3309
+ bi as plainMessageContent,
3310
+ $o as productDetailsUiSpec,
3311
+ No as productFactsKey,
3312
+ Wo as productSkuKey,
3313
+ ti as productSurfaceReviewText,
3314
+ Fo as productsUiSpec,
3315
+ xo as rankSimilarProducts,
3316
+ ko as rankSimilarProductsAsync,
3317
+ Re as recordBeDebugPayload,
3318
+ Mo as redactPii,
3319
+ di as requestText,
3320
+ Oi as resolveBeUrl,
3321
+ Jo as resolveFlow,
3322
+ Fn as resolveProductCandidates,
3323
+ ci as retailAnonymizeMessages,
3324
+ Xo as retailAnonymousRequestText,
3325
+ gi as retailRedactPii,
3326
+ mi as routeFlowParams,
3327
+ wi as routeSkuList,
3328
+ _o as scoreSimilarityCandidate,
3329
+ gr as sectionForKind,
3330
+ Bi as setAssistantHostVisible,
3331
+ hr as severityForEntry,
3332
+ Sn as shouldInstallActivityDebug,
3288
3333
  ue as stableKey,
3289
- qi as startLazyRuntimeLoader,
3290
- yi as stickyContextKey,
3334
+ Di as startLazyRuntimeLoader,
3335
+ Si as stickyContextKey,
3291
3336
  Y as summarizeDebugState,
3292
3337
  ae as summarizePanelState,
3293
- Ye as summarizeUiSpec,
3294
- Yo as textChunk,
3295
- To as textKey,
3296
- bo as tokenizeSimilarityText,
3297
- di as trimProductFactsCore,
3298
- Ao as trimProductFactsListCore,
3299
- hi as uiSpec,
3300
- qn as uniqueProductsBySku,
3301
- xi as withAccountConfig,
3302
- Mo as withDeclarativeBeOpCache,
3303
- Rr as wrapActivityBeacon,
3304
- Lr as wrapActivityTools,
3305
- Pr as wrapActivityTransport
3338
+ Qe as summarizeUiSpec,
3339
+ ni as textChunk,
3340
+ jo as textKey,
3341
+ Eo as tokenizeSimilarityText,
3342
+ yi as trimProductFactsCore,
3343
+ Uo as trimProductFactsListCore,
3344
+ _i as uiSpec,
3345
+ Dn as uniqueProductsBySku,
3346
+ Ai as withAccountConfig,
3347
+ zo as withDeclarativeBeOpCache,
3348
+ Or as wrapActivityBeacon,
3349
+ Br as wrapActivityTools,
3350
+ $r as wrapActivityTransport
3306
3351
  };