@gengage/assistant-fe 0.6.30 → 0.6.31

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.
@@ -21,7 +21,7 @@ function Ee({ namespace: t = Te, ttlMs: e = Ce, maxEntries: r = 100 } = {}) {
21
21
  const f = n.get(l) || await je(t, l);
22
22
  if (f) {
23
23
  if (f.expiresAt <= Date.now()) {
24
- n.delete(l), await Ft(t, l);
24
+ n.delete(l), await Lt(t, l);
25
25
  return;
26
26
  }
27
27
  return n.set(l, f), f.value;
@@ -29,7 +29,7 @@ function Ee({ namespace: t = Te, ttlMs: e = Ce, maxEntries: r = 100 } = {}) {
29
29
  }
30
30
  async function a(u) {
31
31
  const l = typeof u == "string" ? u : u?.id;
32
- l && (n.delete(l), await Ft(t, l));
32
+ l && (n.delete(l), await Lt(t, l));
33
33
  }
34
34
  async function s(u) {
35
35
  if (Pe(u)) return i(u);
@@ -57,31 +57,31 @@ function Ie() {
57
57
  return globalThis.crypto?.randomUUID ? globalThis.crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
58
58
  }
59
59
  async function Oe(t, e, r) {
60
- const n = await St(t);
61
- n && (await ot(n.transaction("refs", "readwrite").objectStore("refs").put(r, e)), n.close());
60
+ const n = await xt(t);
61
+ n && (await it(n.transaction("refs", "readwrite").objectStore("refs").put(r, e)), n.close());
62
62
  }
63
63
  async function je(t, e) {
64
- const r = await St(t);
64
+ const r = await xt(t);
65
65
  if (!r) return;
66
- const n = await ot(r.transaction("refs", "readonly").objectStore("refs").get(e));
66
+ const n = await it(r.transaction("refs", "readonly").objectStore("refs").get(e));
67
67
  return r.close(), n;
68
68
  }
69
- async function Ft(t, e) {
70
- const r = await St(t);
71
- r && (await ot(r.transaction("refs", "readwrite").objectStore("refs").delete(e)), r.close());
69
+ async function Lt(t, e) {
70
+ const r = await xt(t);
71
+ r && (await it(r.transaction("refs", "readwrite").objectStore("refs").delete(e)), r.close());
72
72
  }
73
- async function St(t) {
73
+ async function xt(t) {
74
74
  if (!globalThis.indexedDB) return null;
75
75
  try {
76
76
  const e = globalThis.indexedDB.open(t, 1);
77
77
  return e.onupgradeneeded = () => {
78
78
  e.result.createObjectStore("refs");
79
- }, await ot(e);
79
+ }, await it(e);
80
80
  } catch {
81
81
  return null;
82
82
  }
83
83
  }
84
- function ot(t) {
84
+ function it(t) {
85
85
  return new Promise((e, r) => {
86
86
  t.onsuccess = () => e(t.result), t.onerror = () => r(t.error);
87
87
  });
@@ -160,26 +160,26 @@ async function $e(t, e, r) {
160
160
  });
161
161
  }
162
162
  }
163
- var lt = /* @__PURE__ */ new Map(), qt = null;
163
+ var ft = /* @__PURE__ */ new Map(), qt = null;
164
164
  function Ne() {
165
165
  try {
166
166
  if (typeof sessionStorage < "u") return sessionStorage;
167
167
  } catch {
168
168
  }
169
169
  return {
170
- getItem: (t) => lt.get(t) ?? null,
170
+ getItem: (t) => ft.get(t) ?? null,
171
171
  setItem: (t, e) => {
172
- lt.set(t, e);
172
+ ft.set(t, e);
173
173
  },
174
174
  removeItem: (t) => {
175
- lt.delete(t);
175
+ ft.delete(t);
176
176
  }
177
177
  };
178
178
  }
179
- function Le() {
179
+ function Fe() {
180
180
  return qt ||= Ee(), qt;
181
181
  }
182
- function Fe(t) {
182
+ function Le(t) {
183
183
  if (t && typeof t == "object" && typeof t.name == "string") return t;
184
184
  throw new Error("tool.invoke requires { name, input }");
185
185
  }
@@ -205,7 +205,7 @@ function Ve(t) {
205
205
  ...r ? { ttlMs: r } : {}
206
206
  } : void 0;
207
207
  }
208
- function ft(t) {
208
+ function dt(t) {
209
209
  if (t == null) return "session";
210
210
  if (t === "volatile" || t === "session" || t === "local" || t === "indexedDb") return t;
211
211
  if (typeof t == "string") {
@@ -214,13 +214,13 @@ function ft(t) {
214
214
  }
215
215
  throw new Error(`Unsupported memory tier: ${String(t)}`);
216
216
  }
217
- function xt(t) {
217
+ function vt(t) {
218
218
  return typeof t.getItem == "function" && typeof t.setItem == "function";
219
219
  }
220
- function vt(t) {
220
+ function Ct(t) {
221
221
  return typeof t.get == "function" && typeof t.set == "function";
222
222
  }
223
- function Ct(t) {
223
+ function Tt(t) {
224
224
  return typeof t.accountId == "string" && !!t.session && !!t.indexedDb;
225
225
  }
226
226
  function Ke(t) {
@@ -228,7 +228,7 @@ function Ke(t) {
228
228
  return typeof e == "number" && Number.isFinite(e) && e > 0 ? { ttlMs: e } : void 0;
229
229
  }
230
230
  async function He(t, e, r) {
231
- if (xt(t)) {
231
+ if (vt(t)) {
232
232
  const n = t.getItem(r);
233
233
  if (!n) return null;
234
234
  try {
@@ -237,17 +237,17 @@ async function He(t, e, r) {
237
237
  return t.removeItem?.(r), null;
238
238
  }
239
239
  }
240
- return vt(t) && !Ct(t) ? await t.get(e, r) ?? null : await t[e].get(r) ?? null;
240
+ return Ct(t) && !Tt(t) ? await t.get(e, r) ?? null : await t[e].get(r) ?? null;
241
241
  }
242
242
  async function Je(t, e, r, n, o) {
243
- return xt(t) ? (t.setItem(r, JSON.stringify(n ?? null)), !0) : vt(t) && !Ct(t) ? await t.set(e, r, n ?? null, o) !== !1 : await t[e].set(r, n ?? null, o) !== !1;
243
+ return vt(t) ? (t.setItem(r, JSON.stringify(n ?? null)), !0) : Ct(t) && !Tt(t) ? await t.set(e, r, n ?? null, o) !== !1 : await t[e].set(r, n ?? null, o) !== !1;
244
244
  }
245
245
  async function Ze(t, e, r) {
246
- return xt(t) ? (t.removeItem?.(r), !0) : vt(t) && !Ct(t) ? t.remove ? (await t.remove(e, r), !0) : !1 : (await t[e].remove(r), !0);
246
+ return vt(t) ? (t.removeItem?.(r), !0) : Ct(t) && !Tt(t) ? t.remove ? (await t.remove(e, r), !0) : !1 : (await t[e].remove(r), !0);
247
247
  }
248
248
  async function We(t, e, { tools: r, beacon: n, confirmation: o, memory: i, refStore: a }) {
249
249
  if (t === "tool.invoke") {
250
- const { name: s, input: c } = Fe(e), u = r[s];
250
+ const { name: s, input: c } = Le(e), u = r[s];
251
251
  if (typeof u != "function") throw new Error(`Unknown tool: ${s}`);
252
252
  return u(c);
253
253
  }
@@ -260,18 +260,18 @@ async function We(t, e, { tools: r, beacon: n, confirmation: o, memory: i, refSt
260
260
  }
261
261
  if (t === "memory.get") {
262
262
  const { key: s, tier: c } = qe(e);
263
- return He(i, ft(c), String(s));
263
+ return He(i, dt(c), String(s));
264
264
  }
265
265
  if (t === "memory.set") {
266
266
  const s = De(e);
267
- return { ok: await Je(i, ft(s.tier), String(s.key), s.value, Ke(s)) };
267
+ return { ok: await Je(i, dt(s.tier), String(s.key), s.value, Ke(s)) };
268
268
  }
269
269
  if (t === "memory.remove") {
270
270
  const { key: s, tier: c } = Ue(e);
271
- return { ok: await Ze(i, ft(c), String(s)) };
271
+ return { ok: await Ze(i, dt(c), String(s)) };
272
272
  }
273
273
  if (t === "ref.put") {
274
- const s = tt({
274
+ const s = et({
275
275
  tools: r,
276
276
  beacon: n,
277
277
  confirmation: o,
@@ -280,14 +280,14 @@ async function We(t, e, { tools: r, beacon: n, confirmation: o, memory: i, refSt
280
280
  }), c = ze(e);
281
281
  return s.put(c.value, Ve(c));
282
282
  }
283
- if (t === "ref.get") return tt({
283
+ if (t === "ref.get") return et({
284
284
  tools: r,
285
285
  beacon: n,
286
286
  confirmation: o,
287
287
  memory: i,
288
288
  refStore: a
289
289
  }).get(e);
290
- if (t === "ref.materialize") return tt({
290
+ if (t === "ref.materialize") return et({
291
291
  tools: r,
292
292
  beacon: n,
293
293
  confirmation: o,
@@ -295,7 +295,7 @@ async function We(t, e, { tools: r, beacon: n, confirmation: o, memory: i, refSt
295
295
  refStore: a
296
296
  }).materialize(e);
297
297
  if (t === "ref.remove")
298
- return await tt({
298
+ return await et({
299
299
  tools: r,
300
300
  beacon: n,
301
301
  confirmation: o,
@@ -304,8 +304,8 @@ async function We(t, e, { tools: r, beacon: n, confirmation: o, memory: i, refSt
304
304
  }).delete(e), { ok: !0 };
305
305
  throw new Error(`Unknown RPC method: ${t}`);
306
306
  }
307
- function tt(t) {
308
- const e = t.refStore || Le();
307
+ function et(t) {
308
+ const e = t.refStore || Fe();
309
309
  if (!e || typeof e.put != "function" || typeof e.get != "function") throw new Error("No ref store is configured.");
310
310
  return e;
311
311
  }
@@ -339,15 +339,15 @@ function Dt(t, e, r) {
339
339
  const n = Qt([e], r)[0];
340
340
  return n ? {
341
341
  ...t,
342
- messages: it([...t.messages, n], r)
342
+ messages: at([...t.messages, n], r)
343
343
  } : t;
344
344
  }
345
- function it(t, e) {
345
+ function at(t, e) {
346
346
  const r = Qe(e);
347
347
  return r === 1 / 0 ? [...t] : t.slice(-r);
348
348
  }
349
349
  function Qt(t, e) {
350
- return Array.isArray(t) ? it(t.map((r) => {
350
+ return Array.isArray(t) ? at(t.map((r) => {
351
351
  const n = r?.role;
352
352
  return {
353
353
  role: n === "model" ? "assistant" : typeof n == "string" ? n : "",
@@ -385,7 +385,7 @@ function Xt(t, e) {
385
385
  function w(t) {
386
386
  return typeof t == "object" && t !== null && !Array.isArray(t);
387
387
  }
388
- var rr = "gengage_agentic_savepoints", et = "savepoints", Ut = 3600 * 1e3, nr = 1, ko = class {
388
+ var rr = "gengage_agentic_savepoints", rt = "savepoints", Ut = 3600 * 1e3, nr = 1, ko = class {
389
389
  #t = /* @__PURE__ */ new Map();
390
390
  #i = /* @__PURE__ */ new Map();
391
391
  #e;
@@ -399,7 +399,7 @@ var rr = "gengage_agentic_savepoints", et = "savepoints", Ut = 3600 * 1e3, nr =
399
399
  #c;
400
400
  #r = /* @__PURE__ */ new Map();
401
401
  constructor({ accountId: t, locale: e, parentUrl: r, rpc: n, persistentPanelKeys: o = [], panelKeyLimits: i = {}, messageLimit: a, maxThreads: s, threadTtlMs: c }) {
402
- this.#e = t, this.#u = e, this.#l = r, this.#a = n, this.#f = [...new Set(o.filter(Boolean))], this.#d = ar(i), this.#o = mt(a), this.#s = mt(s), this.#c = mt(c);
402
+ this.#e = t, this.#u = e, this.#l = r, this.#a = n, this.#f = [...new Set(o.filter(Boolean))], this.#d = ar(i), this.#o = yt(a), this.#s = yt(s), this.#c = yt(c);
403
403
  }
404
404
  get size() {
405
405
  return this.pruneExpired(), this.#t.size;
@@ -441,7 +441,7 @@ var rr = "gengage_agentic_savepoints", et = "savepoints", Ut = 3600 * 1e3, nr =
441
441
  this.pruneExpired();
442
442
  const r = String(t || "default"), n = this.#t.get(r);
443
443
  if (!n) return null;
444
- const o = Tt(n, typeof e == "function" ? e(n) : e, this.#o);
444
+ const o = Et(n, typeof e == "function" ? e(n) : e, this.#o);
445
445
  return this.#n(r, o), o;
446
446
  }
447
447
  appendUserMessage(t, e) {
@@ -525,8 +525,8 @@ var rr = "gengage_agentic_savepoints", et = "savepoints", Ut = 3600 * 1e3, nr =
525
525
  createdAt: Date.now()
526
526
  };
527
527
  try {
528
- await pt(this.#e, "readwrite", (o) => {
529
- o.put(n, dt(t, e));
528
+ await mt(this.#e, "readwrite", (o) => {
529
+ o.put(n, pt(t, e));
530
530
  });
531
531
  } catch {
532
532
  }
@@ -535,8 +535,8 @@ var rr = "gengage_agentic_savepoints", et = "savepoints", Ut = 3600 * 1e3, nr =
535
535
  if (!t) return null;
536
536
  try {
537
537
  let r = null;
538
- return await pt(this.#e, "readonly", (n) => {
539
- const o = typeof e == "number" ? dt(t, e) : null;
538
+ return await mt(this.#e, "readonly", (n) => {
539
+ const o = typeof e == "number" ? pt(t, e) : null;
540
540
  if (o !== null) {
541
541
  const i = n.get(o);
542
542
  i.onsuccess = () => {
@@ -564,9 +564,9 @@ var rr = "gengage_agentic_savepoints", et = "savepoints", Ut = 3600 * 1e3, nr =
564
564
  async clearSavepoint(t, e) {
565
565
  if (t)
566
566
  try {
567
- await pt(this.#e, "readwrite", (r) => {
567
+ await mt(this.#e, "readwrite", (r) => {
568
568
  if (typeof e == "number") {
569
- r.delete(dt(t, e));
569
+ r.delete(pt(t, e));
570
570
  return;
571
571
  }
572
572
  const n = r.openCursor();
@@ -597,13 +597,13 @@ var rr = "gengage_agentic_savepoints", et = "savepoints", Ut = 3600 * 1e3, nr =
597
597
  }
598
598
  }
599
599
  };
600
- function dt(t, e) {
600
+ function pt(t, e) {
601
601
  return `${t}|${e}`;
602
602
  }
603
603
  function or() {
604
604
  return (typeof self < "u" ? self : globalThis)?.indexedDB || null;
605
605
  }
606
- async function pt(t, e, r) {
606
+ async function mt(t, e, r) {
607
607
  const n = or();
608
608
  if (!n) return;
609
609
  const o = `${rr}_${t}`;
@@ -611,12 +611,12 @@ async function pt(t, e, r) {
611
611
  const s = n.open(o, nr);
612
612
  s.onupgradeneeded = () => {
613
613
  const c = s.result;
614
- c.objectStoreNames.contains(et) || c.createObjectStore(et);
614
+ c.objectStoreNames.contains(rt) || c.createObjectStore(rt);
615
615
  }, s.onerror = () => a(s.error || /* @__PURE__ */ new Error("savepoint:open_failed")), s.onsuccess = () => {
616
616
  const c = s.result;
617
617
  try {
618
- const u = c.transaction(et, e);
619
- r(u.objectStore(et)), u.oncomplete = () => {
618
+ const u = c.transaction(rt, e);
619
+ r(u.objectStore(rt)), u.oncomplete = () => {
620
620
  c.close(), i();
621
621
  }, u.onerror = () => {
622
622
  c.close(), a(u.error || /* @__PURE__ */ new Error("savepoint:tx_failed"));
@@ -643,7 +643,7 @@ function ar(t) {
643
643
  }
644
644
  return e;
645
645
  }
646
- function mt(t) {
646
+ function yt(t) {
647
647
  if (t === void 0) return;
648
648
  const e = Math.floor(Number(t));
649
649
  return Number.isFinite(e) && e > 0 ? e : void 0;
@@ -653,12 +653,12 @@ function sr(t, e) {
653
653
  }
654
654
  function cr(t, e) {
655
655
  if (!w(t) && !w(e)) return {};
656
- const r = w(t) ? t : {}, n = Tt(r, w(e) ? e : {});
656
+ const r = w(t) ? t : {}, n = Et(r, w(e) ? e : {});
657
657
  return w(r.panel) && (n.panel = r.panel), n;
658
658
  }
659
659
  function ur(t, e, r) {
660
660
  if (!w(e)) return t;
661
- const n = Tt(t, e, r);
661
+ const n = Et(t, e, r);
662
662
  return {
663
663
  ...n,
664
664
  panel: t.panel,
@@ -673,7 +673,7 @@ function ur(t, e, r) {
673
673
  }
674
674
  };
675
675
  }
676
- function Tt(t, e, r) {
676
+ function Et(t, e, r) {
677
677
  if (!w(e)) return t;
678
678
  const n = t, o = e, i = w(n.panel) ? n.panel : {}, a = w(o.panel) ? o.panel : {}, s = w(n.thread) ? n.thread : {}, c = w(o.thread) ? o.thread : {}, u = w(s.extensions) ? s.extensions : {}, l = w(c.extensions) ? c.extensions : {}, f = w(n.meta) ? n.meta : {}, d = w(o.meta) ? o.meta : {};
679
679
  return {
@@ -695,7 +695,7 @@ function Tt(t, e, r) {
695
695
  ...f,
696
696
  ...d
697
697
  },
698
- messages: Array.isArray(o.messages) ? it(o.messages, r) : t.messages ?? []
698
+ messages: Array.isArray(o.messages) ? at(o.messages, r) : t.messages ?? []
699
699
  };
700
700
  }
701
701
  function te(t) {
@@ -832,14 +832,14 @@ var Vt = {
832
832
  code: "invalid_request",
833
833
  message: "The assistant request was too large."
834
834
  }
835
- }, x = class extends Error {
835
+ }, v = class extends Error {
836
836
  constructor(t, e, r = {}) {
837
837
  super(e), this.name = "AgentError", this.code = t, this.source = r.source || "agent", r.sourceCode && (this.sourceCode = r.sourceCode), r.detail !== void 0 && (this.detail = r.detail);
838
838
  }
839
839
  };
840
840
  function ee(t) {
841
841
  const e = String(t?.code || "upstream_llm"), r = Vt[e] || Vt.upstream_llm;
842
- return new x(r.code, r.message, {
842
+ return new v(r.code, r.message, {
843
843
  source: "be",
844
844
  sourceCode: e,
845
845
  detail: t?.detail
@@ -853,7 +853,7 @@ function yr(t, e) {
853
853
  });
854
854
  }
855
855
  function _o(t) {
856
- return t instanceof x ? {
856
+ return t instanceof v ? {
857
857
  type: "error",
858
858
  code: t.code,
859
859
  message: t.message
@@ -867,48 +867,49 @@ function gr(t) {
867
867
  return t === 401 ? "unauthorized" : t === 403 ? "forbidden" : t === 413 ? "payload_too_large" : t === 429 ? "rate_limited" : "internal";
868
868
  }
869
869
  async function Ao(t) {
870
- const { beUrl: e, accountId: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: i, jwtProvider: a, parentUrl: s, op: c, input: u, cacheTtlS: l, cacheKey: f, browserCache: d, signal: p, interceptors: m } = t, h = await (a || fr({
870
+ const { beUrl: e, accountId: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: i, jwtProvider: a, parentUrl: s, op: c, input: u, cacheTtlS: l, cacheKey: f, cacheFreshness: d, browserCache: p, signal: m, interceptors: g } = t, S = await (a || fr({
871
871
  accountId: r,
872
872
  devJwtSecret: n,
873
873
  tokenBrokerUrl: o,
874
874
  tokenBrokerAudience: i
875
875
  }))({
876
- ...p ? { signal: p } : {},
876
+ ...m ? { signal: m } : {},
877
877
  ...s ? { parentUrl: s } : {}
878
- }), { opDomain: T, opName: $ } = hr(c, r);
878
+ }), { opDomain: $, opName: tt } = hr(c, r);
879
879
  let M = {
880
880
  method: "POST",
881
881
  headers: {
882
- authorization: `Bearer ${h}`,
882
+ authorization: `Bearer ${S}`,
883
883
  "content-type": "application/json",
884
884
  accept: "application/x-ndjson"
885
885
  },
886
886
  body: JSON.stringify({
887
- op_domain: T,
888
- op_name: $,
887
+ op_domain: $,
888
+ op_name: tt,
889
889
  op_payload: u,
890
890
  ...l !== void 0 ? { cache_ttl_s: l } : {},
891
- ...f !== void 0 ? { cache_key: f } : {}
891
+ ...f !== void 0 ? { cache_key: f } : {},
892
+ ...d !== void 0 ? { cache_freshness: d } : {}
892
893
  }),
893
- ...p ? { signal: p } : {}
894
+ ...m ? { signal: m } : {}
894
895
  };
895
896
  const N = `${String(e).replace(/\/+$/u, "")}/v1/execute`;
896
- if (m?.beforeRequest) {
897
- const k = await m.beforeRequest(t, {
897
+ if (g?.beforeRequest) {
898
+ const _ = await g.beforeRequest(t, {
898
899
  url: N,
899
900
  init: M
900
901
  });
901
- if (k && "cached" in k && k.cached !== void 0) return k.cached;
902
- k?.init && (M = k.init);
902
+ if (_ && "cached" in _ && _.cached !== void 0) return _.cached;
903
+ _?.init && (M = _.init);
903
904
  }
904
- const R = d === !1 ? await fetch(N, M) : await ve(N, M, typeof d == "object" ? d : {});
905
+ const R = p === !1 ? await fetch(N, M) : await ve(N, M, typeof p == "object" ? p : {});
905
906
  if (!R.ok) throw yr(R.status, await br(R));
906
- let L = await kr(R);
907
- if (m?.afterResponse) {
908
- const k = await m.afterResponse(t, L);
909
- k && "result" in k && k.result !== void 0 && (L = k.result);
907
+ let F = await kr(R);
908
+ if (g?.afterResponse) {
909
+ const _ = await g.afterResponse(t, F);
910
+ _ && "result" in _ && _.result !== void 0 && (F = _.result);
910
911
  }
911
- return L;
912
+ return F;
912
913
  }
913
914
  function hr(t, e) {
914
915
  if (!t || t.startsWith("-") || t.endsWith("-")) throw new Error(`Invalid BE op name: ${t}`);
@@ -952,7 +953,7 @@ function Kt(t, e) {
952
953
  if (t._error) throw ee(t._error);
953
954
  if (!t._end)
954
955
  for (const [r, n] of Object.entries(t)) {
955
- if (Object.prototype.hasOwnProperty.call(e, r)) throw new x("op_failed", `BE streamed duplicate field "${r}".`, {
956
+ if (Object.prototype.hasOwnProperty.call(e, r)) throw new v("op_failed", `BE streamed duplicate field "${r}".`, {
956
957
  source: "be",
957
958
  sourceCode: "schema_mismatch"
958
959
  });
@@ -1001,35 +1002,35 @@ function Sr(t, e) {
1001
1002
  function ne(t) {
1002
1003
  return t && typeof t == "object" && !Array.isArray(t) ? t : null;
1003
1004
  }
1004
- function Et(t, e = {}) {
1005
+ function Pt(t, e = {}) {
1005
1006
  const r = ne(t);
1006
1007
  if (!r) return null;
1007
1008
  const n = e.catalogMapper?.(r);
1008
1009
  if (n) return n;
1009
- const o = F(r.sku, r.SKU);
1010
+ const o = L(r.sku, r.SKU);
1010
1011
  if (!o) return null;
1011
1012
  const i = {
1012
1013
  sku: o,
1013
- name: F(r.name, r.title, r.short_name, o) || o,
1014
- url: F(r.url) || ""
1015
- }, a = Array.isArray(r.images) ? r.images : void 0, s = F(r.imageUrl, r.image_url, r.image, a?.[0]);
1014
+ name: L(r.name, r.title, r.short_name, o) || o,
1015
+ url: L(r.url) || ""
1016
+ }, a = Array.isArray(r.images) ? r.images : void 0, s = L(r.imageUrl, r.image_url, r.image, a?.[0]);
1016
1017
  s && (i.imageUrl = s), a && a.length > 1 && (i.images = a.filter(($) => !!$).map(String));
1017
1018
  const c = K(r.price_discounted), u = K(r.price), l = c || u;
1018
1019
  l > 0 && (i.price = String(l));
1019
1020
  const f = c > 0 ? u : 0;
1020
1021
  f > 0 && (i.originalPrice = String(f));
1021
- const d = F(r.brand);
1022
+ const d = L(r.brand);
1022
1023
  d && (i.brand = d);
1023
1024
  const p = K(r.rating);
1024
1025
  p > 0 && (i.rating = p);
1025
1026
  const m = K(r.review_count) || K(r.reviewCount);
1026
1027
  m > 0 && (i.reviewCount = m);
1027
- const h = F(r.cart_code, r.cartCode);
1028
- h && (i.cartCode = h), typeof r.in_stock == "boolean" && (i.inStock = r.in_stock), typeof r.inStock == "boolean" && (i.inStock = r.inStock);
1029
- const T = r.category_names;
1030
- return Array.isArray(T) && (i.categoryNames = T.map(String)), i;
1028
+ const g = L(r.cart_code, r.cartCode);
1029
+ g && (i.cartCode = g), typeof r.in_stock == "boolean" && (i.inStock = r.in_stock), typeof r.inStock == "boolean" && (i.inStock = r.inStock);
1030
+ const S = r.category_names;
1031
+ return Array.isArray(S) && (i.categoryNames = S.map(String)), i;
1031
1032
  }
1032
- function Pt(t) {
1033
+ function It(t) {
1033
1034
  const e = ne(t);
1034
1035
  if (!e) return t;
1035
1036
  const r = e.category_names, n = Array.isArray(r) ? r : void 0, o = e.images, i = Array.isArray(o) ? o : void 0, a = {
@@ -1049,9 +1050,9 @@ function Pt(t) {
1049
1050
  return a;
1050
1051
  }
1051
1052
  function Co(t) {
1052
- return Array.isArray(t) ? t.map(Pt).filter((e) => !!e) : [];
1053
+ return Array.isArray(t) ? t.map(It).filter((e) => !!e) : [];
1053
1054
  }
1054
- function F(...t) {
1055
+ function L(...t) {
1055
1056
  for (const e of t) if (typeof e == "string" && e.trim()) return e.trim();
1056
1057
  return "";
1057
1058
  }
@@ -1066,10 +1067,10 @@ function oe(t, e, r = {}) {
1066
1067
  return `${t}:${r.version || "v2"}:${ie(e)}`;
1067
1068
  }
1068
1069
  function To(t, e = {}) {
1069
- return ae(t).map((r) => se(typeof r == "string" ? r : r.sku, e.locale)).filter(Boolean).filter((r, n, o) => o.indexOf(r) === n).sort((r, n) => It(r, n, e.locale)).slice(0, e.limit || 16).join(",");
1070
+ return ae(t).map((r) => se(typeof r == "string" ? r : r.sku, e.locale)).filter(Boolean).filter((r, n, o) => o.indexOf(r) === n).sort((r, n) => Ot(r, n, e.locale)).slice(0, e.limit || 16).join(",");
1070
1071
  }
1071
1072
  function Eo(t, e = {}) {
1072
- return ie(ae(t).map((r) => xr(r, e)).filter((r) => !!r).sort((r, n) => It(String(r.sku || r.name || ""), String(n.sku || n.name || ""), e.locale)).slice(0, e.limit || 16));
1073
+ return ie(ae(t).map((r) => xr(r, e)).filter((r) => !!r).sort((r, n) => Ot(String(r.sku || r.name || ""), String(n.sku || n.name || ""), e.locale)).slice(0, e.limit || 16));
1073
1074
  }
1074
1075
  function Po(t, e) {
1075
1076
  return O(t, e);
@@ -1085,7 +1086,7 @@ function xr(t, e) {
1085
1086
  if (!t || typeof t != "object" || Array.isArray(t)) return null;
1086
1087
  const r = t, n = e.mapProduct?.(r);
1087
1088
  if (n) return J(n);
1088
- const o = Pt(r);
1089
+ const o = It(r);
1089
1090
  return o && typeof o == "object" && !Array.isArray(o) ? J(Cr(o, e)) : null;
1090
1091
  }
1091
1092
  function ae(t) {
@@ -1118,21 +1119,21 @@ function se(t, e) {
1118
1119
  function O(t, e) {
1119
1120
  return typeof t == "string" ? t.trim().replace(/\s+/gu, " ").toLocaleLowerCase(e || void 0) : "";
1120
1121
  }
1121
- function It(t, e, r) {
1122
+ function Ot(t, e, r) {
1122
1123
  return t.localeCompare(e, r, { numeric: !0 });
1123
1124
  }
1124
1125
  function Tr(t, e, r) {
1125
- return Array.isArray(t) ? t.map((n) => O(n, e)).filter(Boolean).sort((n, o) => It(n, o, e)).slice(0, r) : void 0;
1126
+ return Array.isArray(t) ? t.map((n) => O(n, e)).filter(Boolean).sort((n, o) => Ot(n, o, e)).slice(0, r) : void 0;
1126
1127
  }
1127
1128
  function Er(t, e) {
1128
1129
  if (!t) return { ok: !0 };
1129
1130
  const r = [];
1130
- return bt(t, e, "", r), r.length ? {
1131
+ return kt(t, e, "", r), r.length ? {
1131
1132
  ok: !1,
1132
1133
  error: r[0] || "invalid"
1133
1134
  } : { ok: !0 };
1134
1135
  }
1135
- function bt(t, e, r, n) {
1136
+ function kt(t, e, r, n) {
1136
1137
  if (t) {
1137
1138
  if (Array.isArray(t.enum) && !t.enum.includes(e)) {
1138
1139
  n.push(`${r || "value"} must be one of [${t.enum.join(", ")}]`);
@@ -1163,7 +1164,7 @@ function bt(t, e, r, n) {
1163
1164
  }
1164
1165
  if (t.minItems != null && e.length < t.minItems && n.push(`${r || "value"} must have >= ${t.minItems} items`), t.maxItems != null && e.length > t.maxItems && n.push(`${r || "value"} must have <= ${t.maxItems} items`), t.items) {
1165
1166
  for (let o = 0; o < e.length; o += 1)
1166
- if (bt(t.items, e[o], `${r}[${o}]`, n), n.length) return;
1167
+ if (kt(t.items, e[o], `${r}[${o}]`, n), n.length) return;
1167
1168
  }
1168
1169
  return;
1169
1170
  case "object":
@@ -1180,7 +1181,7 @@ function bt(t, e, r, n) {
1180
1181
  }
1181
1182
  if (t.properties) for (const [o, i] of Object.entries(t.properties)) {
1182
1183
  const a = e[o];
1183
- if (a !== void 0 && (bt(i, a, r ? `${r}.${o}` : o, n), n.length))
1184
+ if (a !== void 0 && (kt(i, a, r ? `${r}.${o}` : o, n), n.length))
1184
1185
  return;
1185
1186
  }
1186
1187
  return;
@@ -1222,15 +1223,15 @@ async function Io({ request: t, accountModule: e, contextStore: r, beClient: n,
1222
1223
  ...e.trace ? { trace: e.trace } : {},
1223
1224
  ...e.hooks ? { hooks: e.hooks } : {}
1224
1225
  };
1225
- await v(m, q("turn:start", p));
1226
+ await C(m, q("turn:start", p));
1226
1227
  try {
1227
- await U(d, p, m), p.committed || await Ot(p, m);
1228
- } catch (h) {
1229
- throw await v(m, {
1228
+ await U(d, p, m), p.committed || await jt(p, m);
1229
+ } catch (g) {
1230
+ throw await C(m, {
1230
1231
  ...q("turn:error", p),
1231
1232
  latencyMs: I(c),
1232
- errorCode: G(h)
1233
- }), h;
1233
+ errorCode: G(g)
1234
+ }), g;
1234
1235
  }
1235
1236
  return await a("beacon.send", {
1236
1237
  type: "turnSummary",
@@ -1240,7 +1241,7 @@ async function Io({ request: t, accountModule: e, contextStore: r, beClient: n,
1240
1241
  steps: p.steps,
1241
1242
  totalLatencyMs: I(c),
1242
1243
  productSkusEmitted: [...p.productSkusEmitted]
1243
- }), await v(m, {
1244
+ }), await C(m, {
1244
1245
  ...q("turn:end", p),
1245
1246
  latencyMs: I(c)
1246
1247
  }), {
@@ -1253,15 +1254,15 @@ async function U(t, e, r) {
1253
1254
  if (r.signal?.aborted || e.committed) return;
1254
1255
  e.steps += 1;
1255
1256
  const o = e.steps, i = performance.now();
1256
- await v(r, yt("step:start", e, n, o));
1257
+ await C(r, gt("step:start", e, n, o));
1257
1258
  try {
1258
- await Ir(n, e, r), await v(r, {
1259
- ...yt("step:end", e, n, o),
1259
+ await Ir(n, e, r), await C(r, {
1260
+ ...gt("step:end", e, n, o),
1260
1261
  latencyMs: I(i)
1261
1262
  });
1262
1263
  } catch (a) {
1263
- throw await v(r, {
1264
- ...yt("step:error", e, n, o),
1264
+ throw await C(r, {
1265
+ ...gt("step:error", e, n, o),
1265
1266
  latencyMs: I(i),
1266
1267
  errorCode: G(a)
1267
1268
  }), a;
@@ -1296,11 +1297,11 @@ async function Ir(t, e, r) {
1296
1297
  return;
1297
1298
  }
1298
1299
  if (t.kind === "branch") {
1299
- await Lr(t, e, r, n);
1300
+ await Fr(t, e, r, n);
1300
1301
  return;
1301
1302
  }
1302
1303
  if (t.kind === "agent_loop") {
1303
- await Fr(t, e, r, n);
1304
+ await Lr(t, e, r, n);
1304
1305
  return;
1305
1306
  }
1306
1307
  if (t.kind === "parallel") {
@@ -1317,26 +1318,27 @@ async function Or(t, e, r, n) {
1317
1318
  const o = performance.now();
1318
1319
  let i;
1319
1320
  try {
1320
- let s = await _(t.input, n);
1321
+ let s = await b(t.input, n);
1321
1322
  if (r.hooks?.beforeBeOp) {
1322
1323
  const c = await W(r, e, "beforeBeOp", () => r.hooks.beforeBeOp(t.op, s, n));
1323
1324
  c && "cached" in c && c.cached !== void 0 ? i = c.cached : c && "input" in c && c.input !== void 0 && (s = c.input);
1324
1325
  }
1325
1326
  if (i === void 0) {
1326
- const c = await _(t.cache, n), u = jr(t, e, s, c), l = await _(t.cacheTtlS, n) ?? u.cacheTtlS, f = await _(t.cacheKey, n) ?? u.cacheKey, d = await _(t.browserCache, n), p = Y(await _(t.timeoutMs, n));
1327
- await jt(t, e, r, n);
1328
- const m = p ? new AbortController() : null, h = ce(r.signal, m?.signal);
1327
+ const c = await b(t.cache, n), u = jr(t, e, s, c), l = await b(t.cacheTtlS, n) ?? u.cacheTtlS, f = await b(t.cacheKey, n) ?? u.cacheKey, d = await b(t.cacheFreshness, n), p = await b(t.browserCache, n), m = Y(await b(t.timeoutMs, n));
1328
+ await Mt(t, e, r, n);
1329
+ const g = m ? new AbortController() : null, S = ce(r.signal, g?.signal);
1329
1330
  i = await Q(r.beClient.invoke({
1330
1331
  op: t.op,
1331
1332
  input: s,
1332
1333
  ...l !== void 0 ? { cacheTtlS: l } : {},
1333
1334
  ...f !== void 0 ? { cacheKey: f } : {},
1334
- ...d !== void 0 ? { browserCache: d } : {},
1335
- ...h ? { signal: h } : {}
1336
- }), p, () => new x("op_timeout", "The assistant took too long to respond.", {
1335
+ ...d !== void 0 ? { cacheFreshness: d } : {},
1336
+ ...p !== void 0 ? { browserCache: p } : {},
1337
+ ...S ? { signal: S } : {}
1338
+ }), m, () => new v("op_timeout", "The assistant took too long to respond.", {
1337
1339
  source: "be",
1338
1340
  sourceCode: "timeout"
1339
- }), () => m?.abort());
1341
+ }), () => g?.abort());
1340
1342
  }
1341
1343
  if (r.hooks?.afterBeOp) {
1342
1344
  const c = await W(r, e, "afterBeOp", () => r.hooks.afterBeOp(t.op, i, n));
@@ -1359,7 +1361,7 @@ async function Or(t, e, r, n) {
1359
1361
  }
1360
1362
  throw s;
1361
1363
  }
1362
- t.out && (e.bag[t.out] = i), await at(t, i, e, r.contextStore);
1364
+ t.out && (e.bag[t.out] = i), await st(t, i, e, r.contextStore);
1363
1365
  const a = {
1364
1366
  type: "agentOp",
1365
1367
  threadId: e.threadId,
@@ -1394,12 +1396,12 @@ function Mr(t) {
1394
1396
  async function Rr(t, e, r, n) {
1395
1397
  const o = performance.now();
1396
1398
  try {
1397
- await jt(t, e, r, n);
1398
- const i = Y(await _(t.timeoutMs, n));
1399
- let a = await _(t.input, n);
1399
+ await Mt(t, e, r, n);
1400
+ const i = Y(await b(t.timeoutMs, n));
1401
+ let a = await b(t.input, n);
1400
1402
  if (r.hooks?.beforeToolCall) {
1401
1403
  const c = await W(r, e, "beforeToolCall", () => r.hooks.beforeToolCall(t.name, a, n));
1402
- if (c?.block) throw new x("tool_blocked", c.reason || `Tool '${t.name}' blocked by hook.`, {
1404
+ if (c?.block) throw new v("tool_blocked", c.reason || `Tool '${t.name}' blocked by hook.`, {
1403
1405
  source: "tool",
1404
1406
  sourceCode: "blocked"
1405
1407
  });
@@ -1407,12 +1409,12 @@ async function Rr(t, e, r, n) {
1407
1409
  }
1408
1410
  if (t.parameters) {
1409
1411
  const c = Er(t.parameters, a);
1410
- if (!c.ok) throw new x("tool_invalid_args", `Invalid args for tool '${t.name}': ${c.error}`, {
1412
+ if (!c.ok) throw new v("tool_invalid_args", `Invalid args for tool '${t.name}': ${c.error}`, {
1411
1413
  source: "tool",
1412
1414
  sourceCode: "invalid_args"
1413
1415
  });
1414
1416
  }
1415
- let s = await Q(r.toolBridge.invoke(t.name, a), i, () => new x("tool_timeout", "The assistant tool took too long to respond.", {
1417
+ let s = await Q(r.toolBridge.invoke(t.name, a), i, () => new v("tool_timeout", "The assistant tool took too long to respond.", {
1416
1418
  source: "tool",
1417
1419
  sourceCode: "timeout"
1418
1420
  }));
@@ -1420,7 +1422,7 @@ async function Rr(t, e, r, n) {
1420
1422
  const c = await W(r, e, "afterToolCall", () => r.hooks.afterToolCall(t.name, s, n));
1421
1423
  c && "result" in c && c.result !== void 0 && (s = c.result), c?.terminate && (e.committed = !0);
1422
1424
  }
1423
- t.out && (e.bag[t.out] = s), await at(t, s, e, r.contextStore), await r.rpc("beacon.send", {
1425
+ t.out && (e.bag[t.out] = s), await st(t, s, e, r.contextStore), await r.rpc("beacon.send", {
1424
1426
  type: "agentTool",
1425
1427
  threadId: e.threadId,
1426
1428
  sessionId: Z(e),
@@ -1450,25 +1452,25 @@ async function Rr(t, e, r, n) {
1450
1452
  async function Br(t, e, r, n) {
1451
1453
  const o = r.adapters?.[t.name];
1452
1454
  if (typeof o != "function") throw new Error(`Unknown flow adapter: ${t.name}`);
1453
- await jt(t, e, r, n);
1454
- const i = Y(await _(t.timeoutMs, n)), a = await Q(o(await _(t.input, n), n), i, () => new x("adapter_timeout", "The assistant adapter took too long to respond.", {
1455
+ await Mt(t, e, r, n);
1456
+ const i = Y(await b(t.timeoutMs, n)), a = await Q(o(await b(t.input, n), n), i, () => new v("adapter_timeout", "The assistant adapter took too long to respond.", {
1455
1457
  source: "adapter",
1456
1458
  sourceCode: "timeout"
1457
1459
  }));
1458
- t.out && (e.bag[t.out] = a), await at(t, a, e, r.contextStore);
1460
+ t.out && (e.bag[t.out] = a), await st(t, a, e, r.contextStore);
1459
1461
  }
1460
1462
  async function $r(t, e, r) {
1461
1463
  const n = await t.build(D(e, r));
1462
1464
  Xr(n, e.productSkusEmitted), r.emit(n);
1463
1465
  }
1464
1466
  async function Nr(t, e, r) {
1465
- await at(t, void 0, e, r.contextStore);
1467
+ await st(t, void 0, e, r.contextStore);
1466
1468
  }
1467
- async function Lr(t, e, r, n) {
1468
- const o = String(await _(t.on, n) || "default");
1469
+ async function Fr(t, e, r, n) {
1470
+ const o = String(await b(t.on, n) || "default");
1469
1471
  await U(t.cases[o] || t.cases.default || [], e, r);
1470
1472
  }
1471
- async function Fr(t, e, r, n) {
1473
+ async function Lr(t, e, r, n) {
1472
1474
  if (!await t.shouldContinue(e.bag, n)) return;
1473
1475
  const o = Math.max(0, Math.floor(Number(t.maxIterations) || 0));
1474
1476
  let i = 0;
@@ -1479,11 +1481,11 @@ async function Fr(t, e, r, n) {
1479
1481
  }
1480
1482
  }
1481
1483
  async function qr(t, e, r) {
1482
- const n = Y(await _(t.timeoutMs, D(e, r))), o = n ? new AbortController() : null, i = ce(r.signal, o?.signal), a = t.steps.map((u) => {
1484
+ const n = Y(await b(t.timeoutMs, D(e, r))), o = n ? new AbortController() : null, i = ce(r.signal, o?.signal), a = t.steps.map((u) => {
1483
1485
  const l = {
1484
1486
  ...e,
1485
1487
  context: Vr(e.context),
1486
- bag: kt(e.bag),
1488
+ bag: _t(e.bag),
1487
1489
  productSkusEmitted: new Set(e.productSkusEmitted),
1488
1490
  committed: !1
1489
1491
  }, f = [];
@@ -1498,7 +1500,7 @@ async function qr(t, e, r) {
1498
1500
  state: l,
1499
1501
  events: f
1500
1502
  }));
1501
- }), s = await Q(Promise.all(a), n, () => new x("parallel_timeout", "The assistant parallel step took too long to respond.", {
1503
+ }), s = await Q(Promise.all(a), n, () => new v("parallel_timeout", "The assistant parallel step took too long to respond.", {
1502
1504
  source: "agent",
1503
1505
  sourceCode: "timeout"
1504
1506
  }), () => o?.abort()), c = t.merge || {};
@@ -1520,15 +1522,15 @@ async function qr(t, e, r) {
1520
1522
  }
1521
1523
  }
1522
1524
  async function Dr(t, e, r, n) {
1523
- r.emit(_r(await _(t.message, n), !0)), await Ot(e, r);
1525
+ r.emit(_r(await b(t.message, n), !0)), await jt(e, r);
1524
1526
  }
1525
1527
  async function Ur(t, e, r) {
1526
- await Ot(e, r);
1528
+ await jt(e, r);
1527
1529
  }
1528
- async function Ot(t, { contextStore: e, emit: r }) {
1530
+ async function jt(t, { contextStore: e, emit: r }) {
1529
1531
  t.committed || (t.context = await e.commit(t.threadId) || t.context, t.committed = !0, r(re()));
1530
1532
  }
1531
- async function at(t, e, r, n) {
1533
+ async function st(t, e, r, n) {
1532
1534
  if (typeof t.patch != "function") return;
1533
1535
  const o = await t.patch(r.context, e, D(r));
1534
1536
  o && (r.context = n.patch(r.threadId, o) || r.context);
@@ -1564,10 +1566,10 @@ function Jt(t, e) {
1564
1566
  function Vr(t) {
1565
1567
  return {
1566
1568
  ...t,
1567
- panel: kt(t.panel || {}),
1569
+ panel: _t(t.panel || {}),
1568
1570
  thread: {
1569
1571
  ...t.thread,
1570
- extensions: kt(t.thread?.extensions || {})
1572
+ extensions: _t(t.thread?.extensions || {})
1571
1573
  },
1572
1574
  meta: t.meta,
1573
1575
  messages: t.messages
@@ -1605,7 +1607,7 @@ function Hr(t, e, r) {
1605
1607
  ...t.meta || {},
1606
1608
  ...e.meta || {}
1607
1609
  },
1608
- messages: Array.isArray(e.messages) ? it(e.messages, r) : t.messages
1610
+ messages: Array.isArray(e.messages) ? at(e.messages, r) : t.messages
1609
1611
  };
1610
1612
  }
1611
1613
  function Zt(t, e) {
@@ -1615,7 +1617,7 @@ function Zt(t, e) {
1615
1617
  for (const [n, o] of Object.entries(e)) r[n] = o;
1616
1618
  return r;
1617
1619
  }
1618
- function kt(t) {
1620
+ function _t(t) {
1619
1621
  return new Proxy({}, {
1620
1622
  get(e, r, n) {
1621
1623
  if (typeof r != "string") return Reflect.get(e, r, n);
@@ -1652,7 +1654,7 @@ function Zr(t) {
1652
1654
  return t;
1653
1655
  }
1654
1656
  }
1655
- async function _(t, e) {
1657
+ async function b(t, e) {
1656
1658
  return typeof t == "function" ? await t(e) : t;
1657
1659
  }
1658
1660
  function Y(t) {
@@ -1680,26 +1682,26 @@ function ce(t, e) {
1680
1682
  const r = new AbortController(), n = () => r.abort();
1681
1683
  return t.addEventListener("abort", n, { once: !0 }), e.addEventListener("abort", n, { once: !0 }), r.signal;
1682
1684
  }
1683
- async function jt(t, e, r, n) {
1685
+ async function Mt(t, e, r, n) {
1684
1686
  if (!t.confirm) return;
1685
- const o = await _(t.confirm, n);
1687
+ const o = await b(t.confirm, n);
1686
1688
  if (!o) return;
1687
1689
  const i = Wr(o, t, e);
1688
- await v(r, gt("confirmation:start", e, t));
1690
+ await C(r, ht("confirmation:start", e, t));
1689
1691
  try {
1690
- const a = await Q(r.rpc("confirmation.request", i), Pr, () => new x("confirmation_timeout", "The confirmation prompt timed out without a response.", {
1692
+ const a = await Q(r.rpc("confirmation.request", i), Pr, () => new v("confirmation_timeout", "The confirmation prompt timed out without a response.", {
1691
1693
  source: t.kind === "be_op" ? "be" : t.kind,
1692
1694
  sourceCode: "confirmation_timeout"
1693
1695
  })), s = typeof a == "boolean" ? a : a?.confirmed === !0;
1694
- if (await v(r, gt("confirmation:end", e, t)), s) return;
1695
- throw new x("confirmation_declined", "The requested action was not confirmed.", {
1696
+ if (await C(r, ht("confirmation:end", e, t)), s) return;
1697
+ throw new v("confirmation_declined", "The requested action was not confirmed.", {
1696
1698
  source: t.kind === "be_op" ? "be" : t.kind,
1697
1699
  sourceCode: "confirmation_declined",
1698
1700
  detail: a
1699
1701
  });
1700
1702
  } catch (a) {
1701
- throw await v(r, {
1702
- ...gt("confirmation:error", e, t),
1703
+ throw await C(r, {
1704
+ ...ht("confirmation:error", e, t),
1703
1705
  errorCode: G(a)
1704
1706
  }), a;
1705
1707
  }
@@ -1722,7 +1724,7 @@ function Gr(t) {
1722
1724
  ...Object.prototype.hasOwnProperty.call(t, "payload") ? { payload: t.payload } : {}
1723
1725
  } : {};
1724
1726
  }
1725
- async function v(t, e) {
1727
+ async function C(t, e) {
1726
1728
  try {
1727
1729
  await t.trace?.(e);
1728
1730
  } catch {
@@ -1732,7 +1734,7 @@ async function W(t, e, r, n) {
1732
1734
  try {
1733
1735
  return await n();
1734
1736
  } catch (o) {
1735
- await v(t, {
1737
+ await C(t, {
1736
1738
  ...q("step:error", e),
1737
1739
  stepName: `hook:${r}`,
1738
1740
  errorCode: G(o)
@@ -1760,7 +1762,7 @@ function q(t, e) {
1760
1762
  sessionId: Z(e)
1761
1763
  };
1762
1764
  }
1763
- function yt(t, e, r, n) {
1765
+ function gt(t, e, r, n) {
1764
1766
  const o = ue(r);
1765
1767
  return {
1766
1768
  ...q(t, e),
@@ -1769,7 +1771,7 @@ function yt(t, e, r, n) {
1769
1771
  ...o ? { stepName: o } : {}
1770
1772
  };
1771
1773
  }
1772
- function gt(t, e, r) {
1774
+ function ht(t, e, r) {
1773
1775
  const n = ue(r);
1774
1776
  return {
1775
1777
  ...q(t, e),
@@ -1826,7 +1828,7 @@ function jo(t, e = {}) {
1826
1828
  }
1827
1829
  function tn(t, e, r) {
1828
1830
  if (!t || typeof t != "object" || Array.isArray(t)) return null;
1829
- const n = t, o = Pt(n);
1831
+ const n = t, o = It(n);
1830
1832
  return o ? nn({
1831
1833
  sku: o.sku,
1832
1834
  name: o.name,
@@ -1880,7 +1882,7 @@ function an(t) {
1880
1882
  }
1881
1883
  function Ro(t = [], e = {}) {
1882
1884
  const r = {}, n = [];
1883
- return (Array.isArray(t) ? t.map((o) => Et(o, e)).filter((o) => !!o) : []).forEach((o, i) => {
1885
+ return (Array.isArray(t) ? t.map((o) => Pt(o, e)).filter((o) => !!o) : []).forEach((o, i) => {
1884
1886
  const a = `product-${i.toString()}`;
1885
1887
  n.push(a);
1886
1888
  const s = {
@@ -1920,13 +1922,13 @@ function Bo(t, e = {}) {
1920
1922
  root: "root",
1921
1923
  elements: { root: {
1922
1924
  type: "ProductDetailsPanel",
1923
- props: { product: Et(t, e) || t || {} }
1925
+ props: { product: Pt(t, e) || t || {} }
1924
1926
  } }
1925
1927
  }
1926
1928
  };
1927
1929
  }
1928
1930
  function $o(t = {}, e = {}) {
1929
- const r = (t.multiple_product_details || t.products || []).map((o) => Et(o, e)).filter((o) => !!o), n = t.table || sn(t.comparison_table);
1931
+ const r = (t.multiple_product_details || t.products || []).map((o) => Pt(o, e)).filter((o) => !!o), n = t.table || sn(t.comparison_table);
1930
1932
  return {
1931
1933
  widget: "chat",
1932
1934
  panelHint: "panel",
@@ -1986,7 +1988,7 @@ function No(t = []) {
1986
1988
  }
1987
1989
  };
1988
1990
  }
1989
- function Lo(t) {
1991
+ function Fo(t) {
1990
1992
  return Object.freeze([...t]);
1991
1993
  }
1992
1994
  function cn(t) {
@@ -2046,7 +2048,7 @@ var fn = [
2046
2048
  "categories",
2047
2049
  "policyTopics"
2048
2050
  ], dn = { intent: ["searchContract", "competitorBrands"] };
2049
- function Fo(t, e, r, n = {}) {
2051
+ function Lo(t, e, r, n = {}) {
2050
2052
  const o = pn(e, r, n);
2051
2053
  return Object.keys(o).length ? {
2052
2054
  ...t,
@@ -2088,10 +2090,10 @@ function hn({ accountId: t = "", op: e, ttlS: r, promptVersion: n = "current", i
2088
2090
  cacheTtlS: r,
2089
2091
  cacheKey: (s = {}) => oe(e, {
2090
2092
  account: t,
2091
- locale: ht(a, s) || s.context?.meta?.locale || s.locale || "",
2093
+ locale: wt(a, s) || s.context?.meta?.locale || s.locale || "",
2092
2094
  promptVersion: n,
2093
- payload: _t(ht(o, s)),
2094
- ...wn(ht(i, s))
2095
+ payload: At(wt(o, s)),
2096
+ ...wn(wt(i, s))
2095
2097
  })
2096
2098
  };
2097
2099
  }
@@ -2106,11 +2108,11 @@ function qo(t, e = {}) {
2106
2108
  })
2107
2109
  };
2108
2110
  }
2109
- function ht(t, e) {
2111
+ function wt(t, e) {
2110
2112
  return typeof t == "function" ? t(e) : t;
2111
2113
  }
2112
- function _t(t) {
2113
- return Array.isArray(t) ? t.map(_t) : !t || typeof t != "object" ? t : Object.fromEntries(Object.entries(t).filter(([, e]) => e !== void 0).sort(([e], [r]) => e.localeCompare(r)).map(([e, r]) => [e, _t(r)]));
2114
+ function At(t) {
2115
+ return Array.isArray(t) ? t.map(At) : !t || typeof t != "object" ? t : Object.fromEntries(Object.entries(t).filter(([, e]) => e !== void 0).sort(([e], [r]) => e.localeCompare(r)).map(([e, r]) => [e, At(r)]));
2114
2116
  }
2115
2117
  function wn(t) {
2116
2118
  return !t || typeof t != "object" || Array.isArray(t) ? {} : Object.fromEntries(Object.entries(t).filter(([, e]) => e != null));
@@ -2198,7 +2200,7 @@ var A = {
2198
2200
  textBlocks: 6,
2199
2201
  relatedProducts: 8,
2200
2202
  textChars: 220
2201
- }, Mt = {
2203
+ }, Rt = {
2202
2204
  description: /\b(?:description|details|product information|urun bilgisi|urun aciklamasi|açıklama|aciklama)\b/iu,
2203
2205
  seller: /\b(?:seller|merchant|store|satici|satıcı|magaza|mağaza)\b/iu,
2204
2206
  review: /\b(?:review|reviews|rating|ratings|yorum|degerlendirme|değerlendirme|puan)\b/iu,
@@ -2219,43 +2221,43 @@ function Zo({ accountId: t, getPageType: e, getProduct: r, getProducts: n, norma
2219
2221
  });
2220
2222
  }
2221
2223
  function Sn({ accountId: t, getPageType: e, getProduct: r, getProducts: n, normalizeProduct: o = (a) => a, input: i = {} }) {
2222
- const a = Wn(i), s = o(i.product || wt(r)), c = (wt(n) || []).map(o).filter(Boolean), u = b(i.sku || s?.sku || i.product?.sku), l = u ? c.find((ut) => b(ut?.sku) === u) || s : s || c[0] || null, f = Cn(u || l?.sku), d = Gt({
2224
+ const a = Wn(i), s = o(i.product || bt(r)), c = (bt(n) || []).map(o).filter(Boolean), u = k(i.sku || s?.sku || i.product?.sku), l = u ? c.find((lt) => k(lt?.sku) === u) || s : s || c[0] || null, f = Cn(u || l?.sku), d = Gt({
2223
2225
  ...f.product,
2224
2226
  ...l
2225
- }), p = Nt(nt(l?.features), nt(l?.specs), Ln(l?.facet_hits), nt(f.product?.features), En(), Pn(), In()).slice(0, a.features), m = ye(st(l?.reviews), f.reviews, On()).slice(0, a.reviews), h = ge(Rt(l?.qna), jn()).slice(0, a.qna), T = he(Bt(l?.sellers), Mn()).slice(0, a.sellers), $ = B([...l?.payment || [], ...rt("payment", a)]), M = B([...l?.delivery || [], ...rt("delivery", a)]), N = B([...l?.promotions || [], ...rt("promotion", a)]), R = we($t(l?.variants), Rn()).slice(0, a.variants), L = Bn(a.documents), k = ke(l?.description, f.product?.description, $n("description"), rt("description", {
2227
+ }), p = Ft(ot(l?.features), ot(l?.specs), Fn(l?.facet_hits), ot(f.product?.features), En(), Pn(), In()).slice(0, a.features), m = ye(ct(l?.reviews), f.reviews, On()).slice(0, a.reviews), g = ge(Bt(l?.qna), jn()).slice(0, a.qna), S = he($t(l?.sellers), Mn()).slice(0, a.sellers), $ = B([...l?.payment || [], ...nt("payment", a)]), tt = B([...l?.delivery || [], ...nt("delivery", a)]), M = B([...l?.promotions || [], ...nt("promotion", a)]), N = we(Nt(l?.variants), Rn()).slice(0, a.variants), R = Bn(a.documents), F = ke(l?.description, f.product?.description, $n("description"), nt("description", {
2226
2228
  ...a,
2227
2229
  textBlocks: 2
2228
- })[0]), Lt = c.filter((ut) => !u || b(ut?.sku) !== u).map(Gt).filter(Boolean).slice(0, a.relatedProducts);
2230
+ })[0]), _ = c.filter((lt) => !u || k(lt?.sku) !== u).map(Gt).filter(Boolean).slice(0, a.relatedProducts);
2229
2231
  return z({
2230
2232
  accountId: t,
2231
- pageType: wt(e) || "other",
2233
+ pageType: bt(e) || "other",
2232
2234
  url: Zn(),
2233
2235
  product: d,
2234
- description: k,
2236
+ description: F,
2235
2237
  features: p,
2236
- sellers: T,
2238
+ sellers: S,
2237
2239
  reviews: m,
2238
- qna: h,
2239
- rating: S(l?.rating ?? f.rating),
2240
- review_count: S(l?.review_count ?? f.review_count),
2240
+ qna: g,
2241
+ rating: x(l?.rating ?? f.rating),
2242
+ review_count: x(l?.review_count ?? f.review_count),
2241
2243
  payment: $,
2242
- delivery: M,
2243
- promotions: N,
2244
- variants: R,
2245
- documents: L,
2246
- related_products: Lt,
2244
+ delivery: tt,
2245
+ promotions: M,
2246
+ variants: N,
2247
+ documents: R,
2248
+ related_products: _,
2247
2249
  capabilities: Vn({
2248
- description: k,
2250
+ description: F,
2249
2251
  features: p,
2250
- sellers: T,
2252
+ sellers: S,
2251
2253
  reviews: m,
2252
- qna: h,
2254
+ qna: g,
2253
2255
  payment: $,
2254
- delivery: M,
2255
- promotions: N,
2256
- variants: R,
2257
- documents: L,
2258
- relatedProducts: Lt
2256
+ delivery: tt,
2257
+ promotions: M,
2258
+ variants: N,
2259
+ documents: R,
2260
+ relatedProducts: _
2259
2261
  }),
2260
2262
  privacy: {
2261
2263
  browserLocal: !0,
@@ -2270,17 +2272,17 @@ function Sn({ accountId: t, getPageType: e, getProduct: r, getProducts: n, norma
2270
2272
  function Wo(t, e) {
2271
2273
  const r = Array.isArray(t) ? t.filter(Boolean) : [];
2272
2274
  if (!e || typeof e != "object" || !r.length) return r;
2273
- const n = b(e.product?.sku);
2275
+ const n = k(e.product?.sku);
2274
2276
  return r.map((o, i) => {
2275
- const a = b(o?.sku);
2277
+ const a = k(o?.sku);
2276
2278
  return r.length === 1 || n && a && n === a || i === 0 ? vn(o, e) : o;
2277
2279
  });
2278
2280
  }
2279
2281
  function xn(t) {
2280
2282
  return !t || typeof t != "object" ? null : z({
2281
2283
  product: t.product,
2282
- description: g(t.description, 500),
2283
- features: Fn(t.features, 14),
2284
+ description: h(t.description, 500),
2285
+ features: Ln(t.features, 14),
2284
2286
  sellers: Un(t.sellers, 4),
2285
2287
  reviews: qn(t.reviews, 4),
2286
2288
  qna: Dn(t.qna, 4),
@@ -2304,48 +2306,48 @@ function vn(t, e) {
2304
2306
  return z({
2305
2307
  ...t,
2306
2308
  description: ke(t.description, e.description),
2307
- features: Nt(nt(t.features), e.features).slice(0, 24),
2309
+ features: Ft(ot(t.features), e.features).slice(0, 24),
2308
2310
  specs: t.specs || (e.features?.length ? Object.fromEntries(e.features.map(Kn)) : void 0),
2309
- sellers: he(Bt(t.sellers), e.sellers),
2310
- reviews: ye(st(t.reviews), e.reviews),
2311
- qna: ge(Rt(t.qna), e.qna),
2311
+ sellers: he($t(t.sellers), e.sellers),
2312
+ reviews: ye(ct(t.reviews), e.reviews),
2313
+ qna: ge(Bt(t.qna), e.qna),
2312
2314
  rating: t.rating ?? e.rating,
2313
2315
  review_count: t.review_count ?? e.review_count,
2314
2316
  payment: B([...t.payment || [], ...e.payment || []]),
2315
2317
  delivery: B([...t.delivery || [], ...e.delivery || []]),
2316
2318
  promotions: B([...t.promotions || [], ...e.promotions || []]),
2317
- variants: we($t(t.variants), e.variants),
2319
+ variants: we(Nt(t.variants), e.variants),
2318
2320
  documents: B([...t.documents || [], ...e.documents || []])
2319
2321
  });
2320
2322
  }
2321
2323
  function Cn(t) {
2322
2324
  const e = [];
2323
- for (const o of C('script[type="application/ld+json"]')) {
2325
+ for (const o of T('script[type="application/ld+json"]')) {
2324
2326
  const i = Tn(o.textContent);
2325
- for (const a of At(i))
2327
+ for (const a of St(i))
2326
2328
  String(a?.["@type"] || "").toLowerCase() === "product" && e.push(a);
2327
2329
  }
2328
- const r = e.find((o) => b(o.sku || o.productID || o.mpn) === b(t)) || e[0];
2330
+ const r = e.find((o) => k(o.sku || o.productID || o.mpn) === k(t)) || e[0];
2329
2331
  if (!r) return {};
2330
2332
  const n = r.aggregateRating || {};
2331
2333
  return {
2332
2334
  product: z({
2333
- sku: b(r.sku || r.productID || r.mpn),
2335
+ sku: k(r.sku || r.productID || r.mpn),
2334
2336
  name: y(r.name),
2335
2337
  brand: y(r.brand?.name || r.brand),
2336
2338
  description: y(r.description),
2337
2339
  images: j(r.image, 8, 280),
2338
2340
  url: X(r.url),
2339
- rating: S(n.ratingValue),
2340
- review_count: S(n.reviewCount || n.ratingCount)
2341
+ rating: x(n.ratingValue),
2342
+ review_count: x(n.reviewCount || n.ratingCount)
2341
2343
  }),
2342
- reviews: st(r.review),
2343
- rating: S(n.ratingValue),
2344
- review_count: S(n.reviewCount || n.ratingCount)
2344
+ reviews: ct(r.review),
2345
+ rating: x(n.ratingValue),
2346
+ review_count: x(n.reviewCount || n.ratingCount)
2345
2347
  };
2346
2348
  }
2347
- function At(t) {
2348
- return Array.isArray(t) ? t.flatMap(At) : !t || typeof t != "object" ? [] : [t, ...At(t["@graph"])];
2349
+ function St(t) {
2350
+ return Array.isArray(t) ? t.flatMap(St) : !t || typeof t != "object" ? [] : [t, ...St(t["@graph"])];
2349
2351
  }
2350
2352
  function Tn(t) {
2351
2353
  try {
@@ -2356,7 +2358,7 @@ function Tn(t) {
2356
2358
  }
2357
2359
  function En() {
2358
2360
  const t = [];
2359
- for (const e of C("table tr")) {
2361
+ for (const e of T("table tr")) {
2360
2362
  const r = [...e.querySelectorAll?.("th,td") || []].map((n) => y(n.textContent));
2361
2363
  r.length >= 2 && r[0] && r[1] && t.push({
2362
2364
  key: r[0],
@@ -2367,7 +2369,7 @@ function En() {
2367
2369
  }
2368
2370
  function Pn() {
2369
2371
  const t = [];
2370
- for (const e of C("dt")) {
2372
+ for (const e of T("dt")) {
2371
2373
  const r = y(e.textContent), n = y(e.nextElementSibling?.matches?.("dd") ? e.nextElementSibling.textContent : "");
2372
2374
  r && n && t.push({
2373
2375
  key: r,
@@ -2377,56 +2379,56 @@ function Pn() {
2377
2379
  return t;
2378
2380
  }
2379
2381
  function In() {
2380
- return C('[class*="spec" i], [class*="feature" i], [class*="attribute" i], li').map((t) => me(y(t.textContent))).filter(Boolean).slice(0, A.features);
2382
+ return T('[class*="spec" i], [class*="feature" i], [class*="attribute" i], li').map((t) => me(y(t.textContent))).filter(Boolean).slice(0, A.features);
2381
2383
  }
2382
2384
  function On() {
2383
- return C('[class*="review" i], [data-review], [itemprop="review"]').map((t) => {
2385
+ return T('[class*="review" i], [data-review], [itemprop="review"]').map((t) => {
2384
2386
  const e = y(t.textContent);
2385
- return !e || e.length < 8 || Mt.qna.test(e) ? null : {
2386
- content: g(e, 260),
2387
- star: S(t.getAttribute?.("data-rating"))
2387
+ return !e || e.length < 8 || Rt.qna.test(e) ? null : {
2388
+ content: h(e, 260),
2389
+ star: x(t.getAttribute?.("data-rating"))
2388
2390
  };
2389
2391
  }).filter(Boolean);
2390
2392
  }
2391
2393
  function jn() {
2392
- const t = C('[class*="question" i], [class*="answer" i], [data-question], [data-answer]'), e = [];
2394
+ const t = T('[class*="question" i], [class*="answer" i], [data-question], [data-answer]'), e = [];
2393
2395
  for (const r of t) {
2394
2396
  const n = y(r.textContent);
2395
- if (!n || !Mt.qna.test(n)) continue;
2397
+ if (!n || !Rt.qna.test(n)) continue;
2396
2398
  const o = y(r.getAttribute?.("data-question") || n), i = y(r.getAttribute?.("data-answer") || r.nextElementSibling?.textContent || "");
2397
2399
  e.push({
2398
- question: g(o, 220),
2399
- answer: g(i, 260)
2400
+ question: h(o, 220),
2401
+ answer: h(i, 260)
2400
2402
  });
2401
2403
  }
2402
2404
  return e;
2403
2405
  }
2404
2406
  function Mn() {
2405
- return C('[class*="seller" i], [class*="merchant" i], [data-seller], [data-merchant]').map((t) => y(t.getAttribute?.("data-seller") || t.getAttribute?.("data-merchant") || t.textContent)).filter(Boolean).map((t) => ({ merchant: g(t, 120) }));
2407
+ return T('[class*="seller" i], [class*="merchant" i], [data-seller], [data-merchant]').map((t) => y(t.getAttribute?.("data-seller") || t.getAttribute?.("data-merchant") || t.textContent)).filter(Boolean).map((t) => ({ merchant: h(t, 120) }));
2406
2408
  }
2407
2409
  function Rn() {
2408
- return C('[class*="variant" i] a,[class*="variant" i] button,[class*="size" i] button,[class*="color" i] button,[data-variant],[data-size],[data-color]').map((t) => z({
2409
- name: g(_e(t), 120),
2410
- value: g(t.getAttribute?.("data-value") || t.getAttribute?.("data-size") || t.getAttribute?.("data-color"), 120),
2411
- sku: b(t.getAttribute?.("data-sku") || t.getAttribute?.("data-product-id")),
2410
+ return T('[class*="variant" i] a,[class*="variant" i] button,[class*="size" i] button,[class*="color" i] button,[data-variant],[data-size],[data-color]').map((t) => z({
2411
+ name: h(_e(t), 120),
2412
+ value: h(t.getAttribute?.("data-value") || t.getAttribute?.("data-size") || t.getAttribute?.("data-color"), 120),
2413
+ sku: k(t.getAttribute?.("data-sku") || t.getAttribute?.("data-product-id")),
2412
2414
  url: X(t.getAttribute?.("href")),
2413
2415
  in_stock: t.getAttribute?.("disabled") == null && t.getAttribute?.("aria-disabled") !== "true"
2414
2416
  })).filter((t) => t.name || t.value || t.sku);
2415
2417
  }
2416
2418
  function Bn(t) {
2417
- return C("a[href]").filter((e) => /\.pdf(?:$|[?#])/iu.test(e.getAttribute?.("href") || "")).map((e) => {
2419
+ return T("a[href]").filter((e) => /\.pdf(?:$|[?#])/iu.test(e.getAttribute?.("href") || "")).map((e) => {
2418
2420
  const r = _e(e) || "PDF", n = X(e.getAttribute?.("href"));
2419
2421
  return n ? `${r}: ${n}` : "";
2420
2422
  }).filter(Boolean).slice(0, t);
2421
2423
  }
2422
- function rt(t, e) {
2423
- const r = Mt[t];
2424
- return r ? C("section,article,div,li,p,span,button,a").map((n) => y(n.textContent)).filter((n) => n && r.test(n) && n.length <= 900).map((n) => g(n, e.textChars || A.textChars)).filter(be()).slice(0, e.textBlocks || A.textBlocks) : [];
2424
+ function nt(t, e) {
2425
+ const r = Rt[t];
2426
+ return r ? T("section,article,div,li,p,span,button,a").map((n) => y(n.textContent)).filter((n) => n && r.test(n) && n.length <= 900).map((n) => h(n, e.textChars || A.textChars)).filter(be()).slice(0, e.textBlocks || A.textBlocks) : [];
2425
2427
  }
2426
2428
  function $n(t) {
2427
2429
  return y(document.querySelector?.(`meta[name="${t}"]`)?.getAttribute?.("content") || document.querySelector?.(`meta[property="og:${t}"]`)?.getAttribute?.("content"));
2428
2430
  }
2429
- function C(t) {
2431
+ function T(t) {
2430
2432
  try {
2431
2433
  return [...document.querySelectorAll?.(t) || []].filter(Nn);
2432
2434
  } catch {
@@ -2441,7 +2443,7 @@ function Nn(t) {
2441
2443
  const r = window.getComputedStyle?.(t);
2442
2444
  return !r || r.visibility !== "hidden" && r.display !== "none" && Number(r.opacity || 1) > 0;
2443
2445
  }
2444
- function nt(t) {
2446
+ function ot(t) {
2445
2447
  return t ? (Array.isArray(t) ? t : Object.entries(t).map(([e, r]) => ({
2446
2448
  key: e,
2447
2449
  value: r
@@ -2453,7 +2455,7 @@ function nt(t) {
2453
2455
  value: y(e.value || e.text || "")
2454
2456
  }).filter((e) => e.key || e.value) : [];
2455
2457
  }
2456
- function Ln(t) {
2458
+ function Fn(t) {
2457
2459
  return !t || typeof t != "object" ? [] : Object.entries(t).map(([e, r]) => ({
2458
2460
  key: y(e),
2459
2461
  value: y(r)
@@ -2466,59 +2468,59 @@ function me(t) {
2466
2468
  value: e[2]
2467
2469
  } : null;
2468
2470
  }
2469
- function st(t) {
2470
- return (Array.isArray(t) ? t : t ? [t] : []).map((e) => typeof e == "string" ? { content: g(e, 260) } : {
2471
- content: g(e.content || e.reviewBody || e.description || e.text, 260),
2472
- star: S(e.star || e.rating || e.reviewRating?.ratingValue)
2471
+ function ct(t) {
2472
+ return (Array.isArray(t) ? t : t ? [t] : []).map((e) => typeof e == "string" ? { content: h(e, 260) } : {
2473
+ content: h(e.content || e.reviewBody || e.description || e.text, 260),
2474
+ star: x(e.star || e.rating || e.reviewRating?.ratingValue)
2473
2475
  }).filter((e) => e.content || e.star);
2474
2476
  }
2475
- function Rt(t) {
2477
+ function Bt(t) {
2476
2478
  return (Array.isArray(t) ? t : t ? [t] : []).map((e) => ({
2477
- question: g(e.question || e.name || "", 220),
2478
- answer: g(e.answer || e.acceptedAnswer?.text || e.text || "", 260)
2479
+ question: h(e.question || e.name || "", 220),
2480
+ answer: h(e.answer || e.acceptedAnswer?.text || e.text || "", 260)
2479
2481
  })).filter((e) => e.question || e.answer);
2480
2482
  }
2481
- function Bt(t) {
2482
- return (Array.isArray(t) ? t : t ? [t] : []).map((e) => typeof e == "string" ? { merchant: g(e, 120) } : {
2483
- merchant: g(e.merchant || e.name || e.seller || "", 120),
2484
- merchant_id: b(e.merchant_id || e.id || ""),
2485
- merchant_rating: S(e.merchant_rating || e.rating),
2486
- price_offer: S(e.price_offer || e.price)
2483
+ function $t(t) {
2484
+ return (Array.isArray(t) ? t : t ? [t] : []).map((e) => typeof e == "string" ? { merchant: h(e, 120) } : {
2485
+ merchant: h(e.merchant || e.name || e.seller || "", 120),
2486
+ merchant_id: k(e.merchant_id || e.id || ""),
2487
+ merchant_rating: x(e.merchant_rating || e.rating),
2488
+ price_offer: x(e.price_offer || e.price)
2487
2489
  }).filter((e) => e.merchant || e.merchant_id);
2488
2490
  }
2489
- function $t(t) {
2491
+ function Nt(t) {
2490
2492
  return (Array.isArray(t) ? t : t ? [t] : []).map((e) => ({
2491
- name: g(e.name || e.label || e.title || "", 120),
2492
- value: g(e.value || e.size || e.color || "", 120),
2493
- sku: b(e.sku || e.code || ""),
2493
+ name: h(e.name || e.label || e.title || "", 120),
2494
+ value: h(e.value || e.size || e.color || "", 120),
2495
+ sku: k(e.sku || e.code || ""),
2494
2496
  url: X(e.url),
2495
2497
  in_stock: e.in_stock
2496
2498
  })).filter((e) => e.name || e.value || e.sku || e.url);
2497
2499
  }
2498
- function Nt(...t) {
2500
+ function Ft(...t) {
2499
2501
  const e = /* @__PURE__ */ new Set(), r = [];
2500
2502
  for (const n of t.flat().filter(Boolean)) {
2501
2503
  const o = {
2502
- key: g(n.key || n.name || "", 90),
2503
- value: g(n.value || n.text || "", 180)
2504
+ key: h(n.key || n.name || "", 90),
2505
+ value: h(n.value || n.text || "", 180)
2504
2506
  }, i = `${o.key}:${o.value}`.toLocaleLowerCase("tr-TR");
2505
2507
  !o.key && !o.value || e.has(i) || (e.add(i), r.push(o));
2506
2508
  }
2507
2509
  return r;
2508
2510
  }
2509
2511
  function ye(...t) {
2510
- return ct(t.flat().filter(Boolean), (e) => `${e.star || ""}:${e.content || ""}`);
2512
+ return ut(t.flat().filter(Boolean), (e) => `${e.star || ""}:${e.content || ""}`);
2511
2513
  }
2512
2514
  function ge(...t) {
2513
- return ct(t.flat().filter(Boolean), (e) => `${e.question || ""}:${e.answer || ""}`);
2515
+ return ut(t.flat().filter(Boolean), (e) => `${e.question || ""}:${e.answer || ""}`);
2514
2516
  }
2515
2517
  function he(...t) {
2516
- return ct(t.flat().filter(Boolean), (e) => `${e.merchant || ""}:${e.merchant_id || ""}`);
2518
+ return ut(t.flat().filter(Boolean), (e) => `${e.merchant || ""}:${e.merchant_id || ""}`);
2517
2519
  }
2518
2520
  function we(...t) {
2519
- return ct(t.flat().filter(Boolean), (e) => `${e.sku || ""}:${e.name || ""}:${e.value || ""}`);
2521
+ return ut(t.flat().filter(Boolean), (e) => `${e.sku || ""}:${e.name || ""}:${e.value || ""}`);
2520
2522
  }
2521
- function ct(t, e) {
2523
+ function ut(t, e) {
2522
2524
  const r = /* @__PURE__ */ new Set();
2523
2525
  return t.filter((n) => {
2524
2526
  const o = e(n).toLocaleLowerCase("tr-TR");
@@ -2529,7 +2531,7 @@ function B(t) {
2529
2531
  return j(t, 20, A.textChars);
2530
2532
  }
2531
2533
  function j(t, e, r) {
2532
- return (Array.isArray(t) ? t : t ? [t] : []).map((n) => g(n, r)).filter(Boolean).filter(be()).slice(0, e);
2534
+ return (Array.isArray(t) ? t : t ? [t] : []).map((n) => h(n, r)).filter(Boolean).filter(be()).slice(0, e);
2533
2535
  }
2534
2536
  function be() {
2535
2537
  const t = /* @__PURE__ */ new Set();
@@ -2538,31 +2540,31 @@ function be() {
2538
2540
  return !r || t.has(r) ? !1 : (t.add(r), !0);
2539
2541
  };
2540
2542
  }
2541
- function Fn(t, e) {
2542
- return Nt(t).slice(0, e);
2543
+ function Ln(t, e) {
2544
+ return Ft(t).slice(0, e);
2543
2545
  }
2544
2546
  function qn(t, e) {
2545
- return st(t).slice(0, e);
2547
+ return ct(t).slice(0, e);
2546
2548
  }
2547
2549
  function Dn(t, e) {
2548
- return Rt(t).slice(0, e);
2550
+ return Bt(t).slice(0, e);
2549
2551
  }
2550
2552
  function Un(t, e) {
2551
- return Bt(t).slice(0, e);
2553
+ return $t(t).slice(0, e);
2552
2554
  }
2553
2555
  function zn(t, e) {
2554
- return $t(t).slice(0, e);
2556
+ return Nt(t).slice(0, e);
2555
2557
  }
2556
2558
  function Gt(t) {
2557
2559
  return !t || typeof t != "object" ? null : z({
2558
- sku: b(t.sku || t.id || ""),
2559
- group_id: b(t.group_id || t.groupId || ""),
2560
+ sku: k(t.sku || t.id || ""),
2561
+ group_id: k(t.group_id || t.groupId || ""),
2560
2562
  name: y(t.name || t.title || ""),
2561
2563
  brand: y(t.brand || ""),
2562
2564
  url: X(t.url),
2563
2565
  images: j(t.images || t.image, 8, 280),
2564
- price: S(t.price),
2565
- price_discounted: S(t.price_discounted || t.discountedPrice),
2566
+ price: x(t.price),
2567
+ price_discounted: x(t.price_discounted || t.discountedPrice),
2566
2568
  price_text: y(t.price_text || t.priceText || ""),
2567
2569
  price_currency: y(t.price_currency || t.currency || ""),
2568
2570
  category_ids: Hn(t.category_ids || t.categoryIds, 8, 90),
@@ -2589,9 +2591,9 @@ function Kn(t) {
2589
2591
  return [y(t.key || t.name), y(t.value || t.text)];
2590
2592
  }
2591
2593
  function ke(...t) {
2592
- return t.map((e) => g(e, 700)).find(Boolean) || "";
2594
+ return t.map((e) => h(e, 700)).find(Boolean) || "";
2593
2595
  }
2594
- function g(t, e) {
2596
+ function h(t, e) {
2595
2597
  return y(t).slice(0, e);
2596
2598
  }
2597
2599
  function _e(t) {
@@ -2600,21 +2602,21 @@ function _e(t) {
2600
2602
  function y(t) {
2601
2603
  return String(t ?? "").replace(/<script\b[\s\S]*?<\/script>/giu, " ").replace(/<style\b[\s\S]*?<\/style>/giu, " ").replace(/<[^>]+>/gu, " ").replace(kn, "[redacted]").replace(/\s+/gu, " ").trim();
2602
2604
  }
2603
- function b(t) {
2605
+ function k(t) {
2604
2606
  const e = String(t ?? "").replace(/<script\b[\s\S]*?<\/script>/giu, " ").replace(/<style\b[\s\S]*?<\/style>/giu, " ").replace(/<[^>]+>/gu, " ").replace(/\s+/gu, " ").trim();
2605
2607
  return !e || /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/iu.test(e) || /\b(?:token|session|csrf|secret|password|passwd|jwt|bearer)\s*[:=]\s*[\w.-]+/iu.test(e) ? "" : e.slice(0, 120);
2606
2608
  }
2607
2609
  function Hn(t, e, r) {
2608
- return (Array.isArray(t) ? t : t ? [t] : []).map((n) => b(n).slice(0, r)).filter(Boolean).filter(Jn()).slice(0, e);
2610
+ return (Array.isArray(t) ? t : t ? [t] : []).map((n) => k(n).slice(0, r)).filter(Boolean).filter(Jn()).slice(0, e);
2609
2611
  }
2610
2612
  function Jn() {
2611
2613
  const t = /* @__PURE__ */ new Set();
2612
2614
  return (e) => {
2613
- const r = b(e).toLocaleLowerCase("tr-TR");
2615
+ const r = k(e).toLocaleLowerCase("tr-TR");
2614
2616
  return !r || t.has(r) ? !1 : (t.add(r), !0);
2615
2617
  };
2616
2618
  }
2617
- function S(t) {
2619
+ function x(t) {
2618
2620
  const e = Number(String(t ?? "").replace(",", "."));
2619
2621
  return Number.isFinite(e) && e > 0 ? e : void 0;
2620
2622
  }
@@ -2659,7 +2661,7 @@ function E(t, e, r) {
2659
2661
  const n = Number(t);
2660
2662
  return !Number.isFinite(n) || n <= 0 ? e : Math.min(Math.floor(n), r);
2661
2663
  }
2662
- function wt(t) {
2664
+ function bt(t) {
2663
2665
  try {
2664
2666
  return typeof t == "function" ? t() : null;
2665
2667
  } catch {
@@ -2765,12 +2767,12 @@ function oi(t, e) {
2765
2767
  }), f = async function(p = {}) {
2766
2768
  const m = await t(p || {});
2767
2769
  if (p?.hydrateFromPdp === !1) return m;
2768
- const h = Array.isArray(m?.products) ? m.products : [];
2769
- if (!h.length) return m;
2770
- const T = await lo(h, l, u, c, i, a);
2770
+ const g = Array.isArray(m?.products) ? m.products : [];
2771
+ if (!g.length) return m;
2772
+ const S = await lo(g, l, u, c, i, a);
2771
2773
  return {
2772
2774
  ...m,
2773
- products: T
2775
+ products: S
2774
2776
  };
2775
2777
  };
2776
2778
  return f.__resetCacheForTesting = () => u.clear(), f.__cacheSizeForTesting = () => u.size, xe.add(f), f;
@@ -2852,8 +2854,8 @@ async function lo(t, e, r, n, o, i) {
2852
2854
  if (!d || !i(d)) return d;
2853
2855
  const p = d?.sku == null ? "" : String(d.sku).trim();
2854
2856
  if (p && r.has(p)) {
2855
- const h = r.get(p);
2856
- return h ? o(d, h) : d;
2857
+ const g = r.get(p);
2858
+ return g ? o(d, g) : d;
2857
2859
  }
2858
2860
  const m = await e(d);
2859
2861
  return p && (r.set(p, m || null), fo(r)), m ? o(d, m) : d;
@@ -3124,7 +3126,7 @@ export {
3124
3126
  pn as I,
3125
3127
  on as J,
3126
3128
  Bo as K,
3127
- Fo as L,
3129
+ Lo as L,
3128
3130
  zo as M,
3129
3131
  Pe as Mt,
3130
3132
  hn as N,
@@ -3137,14 +3139,14 @@ export {
3137
3139
  lr as St,
3138
3140
  bn as T,
3139
3141
  I as Tt,
3140
- Lo as U,
3142
+ Fo as U,
3141
3143
  pe as V,
3142
3144
  No as W,
3143
3145
  le as X,
3144
3146
  Mo as Y,
3145
3147
  jo as Z,
3146
3148
  Xo as _,
3147
- x as _t,
3149
+ v as _t,
3148
3150
  si as a,
3149
3151
  Po as at,
3150
3152
  xn as b,
@@ -3173,14 +3175,14 @@ export {
3173
3175
  li as n,
3174
3176
  Eo as nt,
3175
3177
  Yt as o,
3176
- Et as ot,
3178
+ Pt as ot,
3177
3179
  Qn as p,
3178
3180
  So as pt,
3179
3181
  Ro as q,
3180
3182
  ui as r,
3181
3183
  To as rt,
3182
3184
  mo as s,
3183
- Pt as st,
3185
+ It as st,
3184
3186
  go as t,
3185
3187
  oe as tt,
3186
3188
  oi as u,