@gengage/assistant-fe 0.6.11 → 0.6.13

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 (50) hide show
  1. package/dist/agentic/adaptor/mount.d.ts +1 -0
  2. package/dist/agentic/context/context-store.d.ts +2 -1
  3. package/dist/agentic/context/persistence.d.ts +2 -1
  4. package/dist/agentic/index.d.ts +3 -1
  5. package/dist/agentic/index.js +244 -240
  6. package/dist/agentic/types.d.ts +39 -21
  7. package/dist/agentic/util/browser-memory.d.ts +2 -2
  8. package/dist/agentic/util/cache-key.d.ts +15 -0
  9. package/dist/agentic/worker/be-client.d.ts +3 -1
  10. package/dist/agentic/worker.d.ts +3 -1
  11. package/dist/agentic/worker.js +92 -86
  12. package/dist/agentic.iife.js +5 -5
  13. package/dist/{api-paths-D65Uavfh.js → api-paths-ChCMvKkx.js} +1 -1
  14. package/dist/{chat-CrEa2W-e.js → chat-BP-yXukW.js} +1 -1
  15. package/dist/chat-runtime.js +1 -1
  16. package/dist/chat.iife.js +17 -17
  17. package/dist/chat.js +2 -2
  18. package/dist/common/request-response-cache.d.ts +9 -0
  19. package/dist/{common-D9p39tcK.js → common-BD_DSsqY.js} +3 -3
  20. package/dist/common.js +7 -7
  21. package/dist/{connection-warning-B4WXvW_P.js → connection-warning-CPeEsQ35.js} +1 -1
  22. package/dist/{fastIntent-CtaxOsQe.js → fastIntent-C1WeEqW8.js} +1 -1
  23. package/dist/index.js +12 -12
  24. package/dist/{native-webview-BlHM7cLs.js → native-webview-DbKq9lN8.js} +1 -1
  25. package/dist/native.iife.js +14 -14
  26. package/dist/native.js +1 -1
  27. package/dist/overlay.js +1 -1
  28. package/dist/{qna-BNvttR6s.js → qna-B3lMzHvS.js} +1 -1
  29. package/dist/qna-runtime.js +1 -1
  30. package/dist/qna.iife.js +13 -13
  31. package/dist/qna.js +2 -2
  32. package/dist/request-response-cache-zsgz3Awp.js +154 -0
  33. package/dist/request-text-su3Vlhrs.js +1318 -0
  34. package/dist/{runtime-BozDJELC.js → runtime-Dbwwd8yF.js} +38 -37
  35. package/dist/{runtime-CDjc7MP2.js → runtime-DclobJaN.js} +365 -364
  36. package/dist/{runtime-Brx9ReJA.js → runtime-Duvrignh.js} +69 -68
  37. package/dist/{simbut-DFRlkncH.js → simbut-5C5EAfoM.js} +1 -1
  38. package/dist/simbut.iife.js +1 -1
  39. package/dist/simbut.js +1 -1
  40. package/dist/{simrel-Cizk0RY8.js → simrel-DCcSBFez.js} +3 -3
  41. package/dist/simrel-runtime.js +1 -1
  42. package/dist/simrel.iife.js +12 -12
  43. package/dist/simrel.js +2 -2
  44. package/dist/{widget-base-Bux39ZWf.js → widget-base-BolzGV28.js} +1 -1
  45. package/package.json +1 -1
  46. package/dist/agentic/flow/beauty-consulting-turn.d.ts +0 -1
  47. package/dist/similarity-CqRK9i75.js +0 -1251
  48. /package/dist/{overlay-fgrzmFTR.js → overlay-CyoB1K0w.js} +0 -0
  49. /package/dist/{price-formatter-xI3g9Cd4.js → price-formatter-CFsWT0lP.js} +0 -0
  50. /package/dist/{schemas-CLo8wCjs.js → schemas-Cq2blsO_.js} +0 -0
@@ -1,1251 +0,0 @@
1
- function it(t) {
2
- return !!t && typeof t == "object" && t.type === "rpc.result";
3
- }
4
- function at(t) {
5
- return !!t && typeof t == "object" && t.type === "rpc.req";
6
- }
7
- function se(t = self) {
8
- let e = 1;
9
- const n = /* @__PURE__ */ new Map();
10
- return t.addEventListener("message", (r) => {
11
- const o = r.data;
12
- if (!it(o)) return;
13
- const i = n.get(o.rpcId);
14
- if (i) {
15
- if (n.delete(o.rpcId), o.ok === !1) {
16
- const a = typeof o.error == "object" ? o.error?.message : o.error;
17
- i.reject(new Error(a || "RPC failed"));
18
- return;
19
- }
20
- i.resolve(o.value);
21
- }
22
- }), function(o, i, a) {
23
- const s = e++;
24
- return t.postMessage({
25
- type: "rpc.req",
26
- rpcId: s,
27
- method: o,
28
- payload: i
29
- }, a || []), new Promise((c, u) => {
30
- n.set(s, {
31
- resolve: (l) => c(l),
32
- reject: u
33
- });
34
- });
35
- };
36
- }
37
- function ce({ worker: t, tools: e = {}, beacon: n, memory: r = sessionStorage }) {
38
- t.addEventListener("message", (o) => {
39
- const i = o.data;
40
- at(i) && st(t, i, {
41
- tools: e,
42
- beacon: n,
43
- memory: r
44
- });
45
- });
46
- }
47
- async function st(t, e, n) {
48
- try {
49
- const r = await dt(e.method, e.payload, n);
50
- t.postMessage({
51
- type: "rpc.result",
52
- rpcId: e.rpcId,
53
- ok: !0,
54
- value: r
55
- });
56
- } catch (r) {
57
- t.postMessage({
58
- type: "rpc.result",
59
- rpcId: e.rpcId,
60
- ok: !1,
61
- error: { message: r instanceof Error ? r.message : String(r) }
62
- });
63
- }
64
- }
65
- function ct(t) {
66
- if (t && typeof t == "object" && typeof t.name == "string") return t;
67
- throw new Error("tool.invoke requires { name, input }");
68
- }
69
- function ut(t) {
70
- if (t && typeof t == "object" && t.key !== void 0) return t;
71
- throw new Error("memory.get requires { key }");
72
- }
73
- function lt(t) {
74
- if (t && typeof t == "object" && t.key !== void 0) return t;
75
- throw new Error("memory.set requires { key }");
76
- }
77
- async function dt(t, e, { tools: n, beacon: r, memory: o }) {
78
- if (t === "tool.invoke") {
79
- const { name: i, input: a } = ct(e), s = n[i];
80
- if (typeof s != "function") throw new Error(`Unknown tool: ${i}`);
81
- return s(a);
82
- }
83
- if (t === "beacon.send")
84
- return r?.(e), { sent: !0 };
85
- if (t === "memory.get") {
86
- const { key: i } = ut(e), a = o.getItem(String(i));
87
- return a ? JSON.parse(a) : null;
88
- }
89
- if (t === "memory.set") {
90
- const { key: i, value: a } = lt(e);
91
- return o.setItem(String(i), JSON.stringify(a ?? null)), { ok: !0 };
92
- }
93
- throw new Error(`Unknown RPC method: ${t}`);
94
- }
95
- function ft() {
96
- return (/* @__PURE__ */ new Date()).toISOString();
97
- }
98
- function R(t) {
99
- return Math.max(0, Math.round(performance.now() - t));
100
- }
101
- function E(t) {
102
- return typeof t == "object" && t !== null && !Array.isArray(t);
103
- }
104
- function pt(t) {
105
- const { accountId: e, locale: n = "en-GB", parentUrl: r = "", threadId: o, incomingContext: i } = t, a = E(i) ? i : {}, s = E(a.thread) ? a.thread : {}, c = E(a.panel) ? a.panel : {}, u = E(a.meta) ? a.meta : {}, l = G(a.messages), d = {
106
- id: String(o || s.id || self.crypto.randomUUID()),
107
- started_at: String(s.started_at || ft()),
108
- extensions: E(s.extensions) ? { ...s.extensions } : {}
109
- }, m = String(u.locale || n), p = String(u.parentUrl || r || typeof self < "u" && self.location?.href || "");
110
- return {
111
- panel: { ...c },
112
- messages: l,
113
- thread: d,
114
- meta: {
115
- locale: m,
116
- parentUrl: p,
117
- accountId: e
118
- }
119
- };
120
- }
121
- function mt(t, e) {
122
- const n = G([e])[0];
123
- return n ? {
124
- ...t,
125
- messages: [...t.messages, n].slice(-50)
126
- } : t;
127
- }
128
- function G(t) {
129
- return Array.isArray(t) ? t.map((e) => {
130
- const n = e?.role;
131
- return {
132
- role: n === "model" ? "assistant" : typeof n == "string" ? n : "",
133
- content: String(e?.content || "")
134
- };
135
- }).filter((e) => (e.role === "user" || e.role === "assistant") && !!e.content).slice(-50) : [];
136
- }
137
- var yt = "gengage:agent:context:";
138
- async function gt({ accountId: t, threadId: e, rpc: n }) {
139
- const r = await n("memory.get", {
140
- tier: "session",
141
- key: Q(t, e)
142
- });
143
- return r && typeof r == "object" && !Array.isArray(r) ? r : {};
144
- }
145
- async function ht({ accountId: t, threadId: e, extensions: n, rpc: r }) {
146
- await r("memory.set", {
147
- tier: "session",
148
- key: Q(t, e),
149
- value: { thread: { extensions: n } }
150
- });
151
- }
152
- function Q(t, e) {
153
- return `${yt}${t}:${e}`;
154
- }
155
- function h(t) {
156
- return typeof t == "object" && t !== null && !Array.isArray(t);
157
- }
158
- var ue = class {
159
- #t = /* @__PURE__ */ new Map();
160
- #e;
161
- #r;
162
- #o;
163
- #n;
164
- constructor({ accountId: t, locale: e, parentUrl: n, rpc: r }) {
165
- this.#e = t, this.#r = e, this.#o = n, this.#n = r;
166
- }
167
- async load(t) {
168
- const e = t?.meta?.threadId || t?.session_id || t?.sessionId, n = String(e || "default"), r = this.#t.get(n);
169
- if (r) return r;
170
- const o = await gt({
171
- accountId: this.#e,
172
- threadId: n,
173
- rpc: this.#n
174
- }), i = pt({
175
- accountId: this.#e,
176
- locale: t?.locale || this.#r,
177
- parentUrl: this.#o,
178
- threadId: n,
179
- incomingContext: kt(o, t?.context)
180
- });
181
- return this.#t.set(n, i), i;
182
- }
183
- patch(t, e) {
184
- const n = String(t || "default"), r = this.#t.get(n);
185
- if (!r) return null;
186
- const o = Y(r, typeof e == "function" ? e(r) : e);
187
- return this.#t.set(n, o), o;
188
- }
189
- appendUserMessage(t, e) {
190
- const n = String(t || "default");
191
- if (!e) return this.#t.get(n) ?? null;
192
- const r = this.#t.get(n);
193
- if (!r) return null;
194
- const o = mt(r, {
195
- role: "user",
196
- content: e
197
- });
198
- return this.#t.set(n, o), o;
199
- }
200
- async commit(t) {
201
- const e = String(t || "default"), n = this.#t.get(e);
202
- return n ? (await ht({
203
- accountId: this.#e,
204
- threadId: e,
205
- extensions: n.thread.extensions,
206
- rpc: this.#n
207
- }), n) : null;
208
- }
209
- };
210
- function kt(t, e) {
211
- return !h(t) && !h(e) ? {} : Y(h(t) ? t : {}, h(e) ? e : {});
212
- }
213
- function Y(t, e) {
214
- if (!h(e)) return t;
215
- const n = t, r = e, o = h(n.panel) ? n.panel : {}, i = h(r.panel) ? r.panel : {}, a = h(n.thread) ? n.thread : {}, s = h(r.thread) ? r.thread : {}, c = h(a.extensions) ? a.extensions : {}, u = h(s.extensions) ? s.extensions : {}, l = h(n.meta) ? n.meta : {}, d = h(r.meta) ? r.meta : {};
216
- return {
217
- ...t,
218
- ...e,
219
- panel: {
220
- ...o,
221
- ...i
222
- },
223
- thread: {
224
- ...a,
225
- ...s,
226
- extensions: {
227
- ...c,
228
- ...u
229
- }
230
- },
231
- meta: {
232
- ...l,
233
- ...d
234
- },
235
- messages: Array.isArray(r.messages) ? r.messages.slice(-50) : t.messages ?? []
236
- };
237
- }
238
- function X(t) {
239
- const e = String.fromCharCode(...t);
240
- return btoa(e).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
241
- }
242
- function z(t) {
243
- return X(new TextEncoder().encode(JSON.stringify(t)));
244
- }
245
- async function wt({ accountId: t, devJwtSecret: e, ttlS: n = 300 }) {
246
- if (!e) throw new Error("devJwtSecret is required for local agent mode.");
247
- const r = Math.floor(Date.now() / 1e3), o = `${z({
248
- alg: "HS256",
249
- typ: "JWT"
250
- })}.${z({
251
- sub: t,
252
- iat: r,
253
- exp: r + n,
254
- scope: "invoke",
255
- jti: crypto.randomUUID?.() || `${r}-${Math.random()}`
256
- })}`, i = await crypto.subtle.importKey("raw", new TextEncoder().encode(e), {
257
- name: "HMAC",
258
- hash: "SHA-256"
259
- }, !1, ["sign"]), a = await crypto.subtle.sign("HMAC", i, new TextEncoder().encode(o));
260
- return `${o}.${X(new Uint8Array(a))}`;
261
- }
262
- function bt({ accountId: t, devJwtSecret: e, tokenBrokerUrl: n, tokenBrokerAudience: r, refreshSkewS: o = 30, fetchImpl: i = fetch }) {
263
- let a = null;
264
- return async ({ signal: s, parentUrl: c } = {}) => {
265
- if (e) return wt({
266
- accountId: t,
267
- devJwtSecret: e
268
- });
269
- if (!n) throw new Error("tokenBrokerUrl is required for production agent mode.");
270
- const u = Math.floor(Date.now() / 1e3);
271
- return a?.token && a.expiresAtS - o > u || (a = await _t({
272
- accountId: t,
273
- tokenBrokerUrl: n,
274
- tokenBrokerAudience: r,
275
- parentUrl: c,
276
- signal: s,
277
- fetchImpl: i
278
- })), a.token;
279
- };
280
- }
281
- async function _t({ accountId: t, tokenBrokerUrl: e, tokenBrokerAudience: n, parentUrl: r, signal: o, fetchImpl: i }) {
282
- const a = await i(e, {
283
- method: "POST",
284
- credentials: "include",
285
- headers: {
286
- accept: "application/json",
287
- "content-type": "application/json"
288
- },
289
- body: JSON.stringify({
290
- accountId: t,
291
- scope: "invoke",
292
- audience: n || void 0,
293
- parentUrl: r || void 0
294
- }),
295
- ...o ? { signal: o } : {}
296
- });
297
- if (!a.ok) throw new Error(`Token broker request failed (${a.status}).`);
298
- const s = await a.json(), c = s?.token || s?.jwt || s?.access_token;
299
- if (!c || typeof c != "string") throw new Error("Token broker response did not include a JWT.");
300
- return {
301
- token: c,
302
- expiresAtS: St(s) || xt(c) || Math.floor(Date.now() / 1e3) + 300
303
- };
304
- }
305
- function St(t) {
306
- const e = t?.expiresAtS ?? t?.expires_at_s ?? t?.expiresInS ?? t?.expires_in_s;
307
- if (Number.isFinite(e)) return Number(e);
308
- const n = t?.expiresIn ?? t?.expires_in;
309
- if (Number.isFinite(n)) return Math.floor(Date.now() / 1e3) + Number(n);
310
- const r = t?.expiresAt ?? t?.expires_at;
311
- if (typeof r == "string") {
312
- const o = Date.parse(r);
313
- if (Number.isFinite(o)) return Math.floor(o / 1e3);
314
- }
315
- return null;
316
- }
317
- function xt(t) {
318
- try {
319
- const [, e] = t.split(".");
320
- if (!e) return null;
321
- const n = e.replace(/-/gu, "+").replace(/_/gu, "/"), r = atob(n.padEnd(Math.ceil(n.length / 4) * 4, "=")), o = JSON.parse(r);
322
- return Number.isFinite(o?.exp) ? Number(o.exp) : null;
323
- } catch {
324
- return null;
325
- }
326
- }
327
- var L = {
328
- unauthorized: {
329
- code: "auth",
330
- message: "Assistant authentication failed. Please retry."
331
- },
332
- forbidden: {
333
- code: "auth",
334
- message: "Assistant authentication failed. Please retry."
335
- },
336
- unknown_op: {
337
- code: "op_unavailable",
338
- message: "This assistant action is not available yet."
339
- },
340
- invalid_input: {
341
- code: "invalid_request",
342
- message: "The assistant request was not valid."
343
- },
344
- account_config: {
345
- code: "account_config",
346
- message: "Assistant configuration is unavailable."
347
- },
348
- upstream_llm: {
349
- code: "op_failed",
350
- message: "The assistant could not complete that request."
351
- },
352
- upstream_timeout: {
353
- code: "op_timeout",
354
- message: "The assistant took too long to respond."
355
- },
356
- schema_mismatch: {
357
- code: "op_failed",
358
- message: "The assistant could not complete that request."
359
- },
360
- rate_limited: {
361
- code: "rate_limited",
362
- message: "The assistant is receiving too many requests. Please retry shortly."
363
- },
364
- internal: {
365
- code: "op_failed",
366
- message: "The assistant could not complete that request."
367
- },
368
- payload_too_large: {
369
- code: "invalid_request",
370
- message: "The assistant request was too large."
371
- }
372
- }, Z = class extends Error {
373
- constructor(t, e, n = {}) {
374
- super(e), this.name = "AgentError", this.code = t, this.source = n.source || "agent", n.sourceCode && (this.sourceCode = n.sourceCode), n.detail !== void 0 && (this.detail = n.detail);
375
- }
376
- };
377
- function tt(t) {
378
- const e = String(t?.code || "upstream_llm"), n = L[e] || L.upstream_llm;
379
- return new Z(n.code, n.message, {
380
- source: "be",
381
- sourceCode: e,
382
- detail: t?.detail
383
- });
384
- }
385
- function Tt(t, e) {
386
- const n = e?.error && typeof e.error == "object" ? e.error : {};
387
- return tt({
388
- code: String(n.code || At(t)),
389
- detail: n.detail
390
- });
391
- }
392
- function le(t) {
393
- return t instanceof Z ? {
394
- type: "error",
395
- code: t.code,
396
- message: t.message
397
- } : {
398
- type: "error",
399
- code: "agent_invoke_failed",
400
- message: "The assistant could not complete that request."
401
- };
402
- }
403
- function At(t) {
404
- return t === 401 ? "unauthorized" : t === 403 ? "forbidden" : t === 413 ? "payload_too_large" : t === 429 ? "rate_limited" : "internal";
405
- }
406
- async function de({ beUrl: t, accountId: e, devJwtSecret: n, tokenBrokerUrl: r, tokenBrokerAudience: o, jwtProvider: i, parentUrl: a, op: s, input: c, cacheTtlS: u, cacheKey: l, signal: d }) {
407
- const m = await (i || bt({
408
- accountId: e,
409
- devJwtSecret: n,
410
- tokenBrokerUrl: r,
411
- tokenBrokerAudience: o
412
- }))({
413
- ...d ? { signal: d } : {},
414
- ...a ? { parentUrl: a } : {}
415
- }), { opDomain: p, opName: g } = It(s, e), f = {
416
- method: "POST",
417
- headers: {
418
- authorization: `Bearer ${m}`,
419
- "content-type": "application/json",
420
- accept: "application/x-ndjson"
421
- },
422
- body: JSON.stringify({
423
- op_domain: p,
424
- op_name: g,
425
- op_payload: c,
426
- ...u !== void 0 ? { cache_ttl_s: u } : {},
427
- ...l !== void 0 ? { cache_key: l } : {}
428
- }),
429
- ...d ? { signal: d } : {}
430
- }, _ = await fetch(`${String(t).replace(/\/+$/u, "")}/v1/execute`, f);
431
- if (!_.ok) throw Tt(_.status, await jt(_));
432
- return Pt(_);
433
- }
434
- function It(t, e) {
435
- if (!t || t.startsWith("-") || t.endsWith("-")) throw new Error(`Invalid BE op name: ${t}`);
436
- return {
437
- opDomain: Et(e),
438
- opName: t
439
- };
440
- }
441
- function Et(t) {
442
- return t.replace(/-agentic$/u, "");
443
- }
444
- async function jt(t) {
445
- try {
446
- return await t.json();
447
- } catch {
448
- return { error: { code: t.statusText || "internal" } };
449
- }
450
- }
451
- async function Pt(t) {
452
- const e = t.body?.getReader();
453
- if (!e) throw new Error("BE response body is not readable.");
454
- const n = new TextDecoder();
455
- let r = "";
456
- const o = {};
457
- for (; ; ) {
458
- const { value: a, done: s } = await e.read();
459
- if (s) break;
460
- r += n.decode(a, { stream: !0 });
461
- let c = r.indexOf(`
462
- `);
463
- for (; c >= 0; ) {
464
- const u = r.slice(0, c).trim();
465
- r = r.slice(c + 1), u && q(JSON.parse(u), o), c = r.indexOf(`
466
- `);
467
- }
468
- }
469
- const i = r.trim();
470
- return i && q(JSON.parse(i), o), o;
471
- }
472
- function q(t, e) {
473
- if (t._error) throw tt(t._error);
474
- t._end || Object.assign(e, t);
475
- }
476
- function fe(t = {}) {
477
- return {
478
- type: "metadata",
479
- ...t
480
- };
481
- }
482
- function C(t, e = !1, n = {}) {
483
- return {
484
- type: "text_chunk",
485
- content: t,
486
- final: e,
487
- ...n
488
- };
489
- }
490
- function Ct(t) {
491
- return {
492
- type: "ui_spec",
493
- ...t
494
- };
495
- }
496
- function pe(t) {
497
- return {
498
- type: "action",
499
- action: t
500
- };
501
- }
502
- function Mt(t, e) {
503
- return {
504
- type: "error",
505
- code: t,
506
- message: e
507
- };
508
- }
509
- function et() {
510
- return { type: "done" };
511
- }
512
- function vt(t, e) {
513
- return t[e?.type || e?.action?.type || "inputText"] || t.inputText;
514
- }
515
- async function me({ request: t, accountModule: e, contextStore: n, beClient: r, toolBridge: o, emit: i, rpc: a, signal: s }) {
516
- const c = performance.now(), u = await n.load(t), l = u.thread.id, d = zt(t);
517
- n.appendUserMessage(l, d);
518
- const m = vt(e.flows, t);
519
- if (!m)
520
- return i(Mt("unknown_action", `No agent flow for request type ${t?.type || "inputText"}`)), i(et()), {
521
- steps: 0,
522
- productSkusEmitted: []
523
- };
524
- const p = {
525
- request: t,
526
- context: n.patch(l, {}) || u,
527
- bag: {},
528
- accountConfig: e.accountConfig || {},
529
- threadId: l,
530
- steps: 0,
531
- productSkusEmitted: /* @__PURE__ */ new Set(),
532
- committed: !1
533
- }, g = {
534
- contextStore: n,
535
- beClient: r,
536
- toolBridge: o,
537
- emit: i,
538
- rpc: a,
539
- ...s ? { signal: s } : {}
540
- };
541
- return await U(m, p, g), p.committed || await $(p, g), await a("beacon.send", {
542
- type: "turnSummary",
543
- threadId: l,
544
- sessionId: t?.session_id || t?.sessionId || l,
545
- accountId: e.accountId || p.context.meta.accountId,
546
- steps: p.steps,
547
- totalLatencyMs: R(c),
548
- productSkusEmitted: [...p.productSkusEmitted]
549
- }), {
550
- steps: p.steps,
551
- productSkusEmitted: [...p.productSkusEmitted]
552
- };
553
- }
554
- async function U(t, e, n) {
555
- for (const r of t) {
556
- if (n.signal?.aborted) return;
557
- e.steps += 1, await Nt(r, e, n), e.context = n.contextStore.patch(e.threadId, {}) || e.context;
558
- }
559
- }
560
- async function Nt(t, e, n) {
561
- const r = D(e);
562
- if (t.kind === "be_op") {
563
- await Ot(t, e, n, r);
564
- return;
565
- }
566
- if (t.kind === "tool") {
567
- await Bt(t, e, n, r);
568
- return;
569
- }
570
- if (t.kind === "emit") {
571
- Rt(t, e, n);
572
- return;
573
- }
574
- if (t.kind === "branch") {
575
- await Ut(t, e, n, r);
576
- return;
577
- }
578
- if (t.kind === "parallel") {
579
- await $t(t, e, n);
580
- return;
581
- }
582
- if (t.kind === "refusal") {
583
- await Dt(t, e, n, r);
584
- return;
585
- }
586
- t.kind === "commit" && await Ft(t, e, n);
587
- }
588
- async function Ot(t, e, n, r) {
589
- const o = performance.now();
590
- let i;
591
- const a = I(t.cacheTtlS, r), s = I(t.cacheKey, r);
592
- try {
593
- i = await n.beClient.invoke({
594
- op: t.op,
595
- input: I(t.input, r),
596
- ...a !== void 0 ? { cacheTtlS: a } : {},
597
- ...s !== void 0 ? { cacheKey: s } : {},
598
- ...n.signal ? { signal: n.signal } : {}
599
- });
600
- } catch (u) {
601
- const l = u, d = String(l?.sourceCode || l?.code || "unknown"), m = {
602
- type: "agentOp",
603
- threadId: e.threadId,
604
- sessionId: e.request?.session_id || e.request?.sessionId || e.threadId,
605
- accountId: e.context.meta.accountId,
606
- op: t.op,
607
- status: "error",
608
- latencyMs: R(o),
609
- errorCode: d
610
- };
611
- throw await n.rpc("beacon.send", m), u;
612
- }
613
- t.out && (e.bag[t.out] = i), nt(t, i, e, n.contextStore);
614
- const c = {
615
- type: "agentOp",
616
- threadId: e.threadId,
617
- sessionId: e.request?.session_id || e.request?.sessionId || e.threadId,
618
- accountId: e.context.meta.accountId,
619
- op: t.op,
620
- status: "ok",
621
- latencyMs: R(o)
622
- };
623
- await n.rpc("beacon.send", c);
624
- }
625
- async function Bt(t, e, n, r) {
626
- const o = await n.toolBridge.invoke(t.name, I(t.input, r));
627
- t.out && (e.bag[t.out] = o), nt(t, o, e, n.contextStore);
628
- }
629
- function Rt(t, e, n) {
630
- const r = t.build(D(e));
631
- Lt(r, e.productSkusEmitted), n.emit(r);
632
- }
633
- async function Ut(t, e, n, r) {
634
- const o = String(I(t.on, r) || "default");
635
- await U(t.cases[o] || t.cases.default || [], e, n);
636
- }
637
- async function $t(t, e, n) {
638
- await Promise.all(t.steps.map((r) => U(r, e, n)));
639
- }
640
- async function Dt(t, e, n, r) {
641
- n.emit(C(I(t.message, r), !0)), await $(e, n);
642
- }
643
- async function Ft(t, e, n) {
644
- await $(e, n);
645
- }
646
- async function $(t, { contextStore: e, emit: n }) {
647
- t.committed || (t.context = await e.commit(t.threadId) || t.context, t.committed = !0, n(et()));
648
- }
649
- function nt(t, e, n, r) {
650
- if (typeof t.patch != "function") return;
651
- const o = t.patch(n.context, e, D(n));
652
- o && (n.context = r.patch(n.threadId, o) || n.context);
653
- }
654
- function D(t) {
655
- return {
656
- request: t.request,
657
- context: t.context,
658
- bag: t.bag,
659
- accountConfig: t.accountConfig
660
- };
661
- }
662
- function I(t, e) {
663
- return typeof t == "function" ? t(e) : t;
664
- }
665
- function zt(t) {
666
- const e = t?.payload;
667
- if (typeof e == "string") return e;
668
- if (e && typeof e == "object" && "text" in e) {
669
- const n = e.text;
670
- if (typeof n == "string") return n;
671
- }
672
- return typeof t?.action?.payload == "string" ? t.action.payload : typeof t?.action?.title == "string" ? t.action.title : "";
673
- }
674
- function Lt(t, e) {
675
- const n = t, r = n.spec, o = Array.isArray(r?.items) ? r.items : void 0, i = Array.isArray(n.items) ? n.items : void 0, a = o || i;
676
- if (Array.isArray(a)) {
677
- for (const s of a) if (s && typeof s == "object") {
678
- const c = s.sku;
679
- typeof c == "string" && e.add(c);
680
- }
681
- }
682
- }
683
- function ye(t) {
684
- return { invoke(e, n) {
685
- return t("tool.invoke", {
686
- name: e,
687
- input: n
688
- });
689
- } };
690
- }
691
- function rt(t) {
692
- return t && typeof t == "object" && !Array.isArray(t) ? t : null;
693
- }
694
- function F(t) {
695
- const e = rt(t);
696
- if (!e) return null;
697
- const n = T(e.sku, e.SKU);
698
- if (!n) return null;
699
- const r = {
700
- sku: n,
701
- name: T(e.name, e.title, e.short_name, n) || n,
702
- url: T(e.url) || ""
703
- }, o = Array.isArray(e.images) ? e.images : void 0, i = T(e.imageUrl, e.image_url, e.image, o?.[0]);
704
- i && (r.imageUrl = i), o && o.length > 1 && (r.images = o.filter((f) => !!f).map(String));
705
- const a = j(e.price_discounted), s = j(e.price), c = a || s;
706
- c > 0 && (r.price = String(c));
707
- const u = a > 0 ? s : 0;
708
- u > 0 && (r.originalPrice = String(u));
709
- const l = T(e.brand);
710
- l && (r.brand = l);
711
- const d = j(e.rating);
712
- d > 0 && (r.rating = d);
713
- const m = j(e.review_count) || j(e.reviewCount);
714
- m > 0 && (r.reviewCount = m);
715
- const p = T(e.cart_code, e.cartCode);
716
- p && (r.cartCode = p), typeof e.in_stock == "boolean" && (r.inStock = e.in_stock), typeof e.inStock == "boolean" && (r.inStock = e.inStock);
717
- const g = e.category_names;
718
- return Array.isArray(g) && (r.categoryNames = g.map(String)), r;
719
- }
720
- function qt(t) {
721
- const e = rt(t);
722
- if (!e) return t;
723
- const n = e.category_names, r = Array.isArray(n) ? n : void 0, o = e.images, i = Array.isArray(o) ? o : void 0, a = {
724
- sku: e.sku,
725
- name: e.name || e.title,
726
- url: e.url,
727
- price: e.price,
728
- currency: e.price_currency || e.currency,
729
- category: r?.[r.length - 1] ?? void 0,
730
- category_names: r ? r.slice(0, 4) : void 0,
731
- image: i ? i[0] : e.image,
732
- in_stock: e.in_stock,
733
- rating: e.rating,
734
- review_count: e.review_count
735
- };
736
- for (const s of Object.keys(a)) a[s] === void 0 && delete a[s];
737
- return a;
738
- }
739
- function ot(t) {
740
- return Array.isArray(t) ? t.map(qt).filter((e) => !!e) : [];
741
- }
742
- function T(...t) {
743
- for (const e of t) if (typeof e == "string" && e.trim()) return e.trim();
744
- return "";
745
- }
746
- function j(t) {
747
- const e = Number(t);
748
- return Number.isFinite(e) ? e : 0;
749
- }
750
- function J(t) {
751
- return Array.isArray(t) ? t.map(String).filter(Boolean) : typeof t == "string" && t ? [t] : [];
752
- }
753
- function Jt(t = []) {
754
- const e = {}, n = [];
755
- return (Array.isArray(t) ? t.map(F).filter((r) => !!r) : []).forEach((r, o) => {
756
- const i = `product-${o.toString()}`;
757
- n.push(i);
758
- const a = {
759
- sku: r.sku,
760
- product: r
761
- };
762
- e[i] = {
763
- type: "ProductCard",
764
- props: {
765
- product: r,
766
- index: o,
767
- action: {
768
- title: r.name,
769
- type: "launchSingleProduct",
770
- payload: a
771
- }
772
- }
773
- };
774
- }), e.root = {
775
- type: "ProductGrid",
776
- props: { layout: "grid" },
777
- children: n
778
- }, {
779
- widget: "chat",
780
- panelHint: "panel",
781
- spec: {
782
- root: "root",
783
- elements: e
784
- }
785
- };
786
- }
787
- function ge(t) {
788
- return {
789
- widget: "chat",
790
- panelHint: "panel",
791
- spec: {
792
- root: "root",
793
- elements: { root: {
794
- type: "ProductDetailsPanel",
795
- props: { product: F(t) || t || {} }
796
- } }
797
- }
798
- };
799
- }
800
- function he(t = {}) {
801
- const e = (t.multiple_product_details || t.products || []).map(F).filter((r) => !!r), n = t.table || {};
802
- return {
803
- widget: "chat",
804
- panelHint: "panel",
805
- spec: {
806
- root: "root",
807
- elements: { root: {
808
- type: "ComparisonTable",
809
- props: {
810
- products: e,
811
- recommended: e.find((r) => r.sku === t.recommended_choice_sku) || e[0],
812
- attributes: Object.entries(n).map(([r, o]) => ({
813
- label: r,
814
- values: Array.isArray(o) ? o.map(String) : [String(o ?? "")]
815
- })),
816
- highlights: J(t.key_differences),
817
- specialCases: J(t.special_considerations),
818
- recommendedText: t.recommended_choice,
819
- productActions: Object.fromEntries(e.map((r) => [r.sku, {
820
- title: r.name,
821
- type: "launchSingleProduct",
822
- payload: {
823
- sku: r.sku,
824
- product: r
825
- }
826
- }]))
827
- }
828
- } }
829
- }
830
- };
831
- }
832
- function ke(t = []) {
833
- return {
834
- widget: "chat",
835
- panelHint: "inline",
836
- spec: {
837
- root: "root",
838
- elements: { root: {
839
- type: "ActionButtons",
840
- props: { buttons: (Array.isArray(t) ? t : []).map((e) => {
841
- const n = e.label || e.title || e.shortName || "", r = e.action || e.requestDetails || e.request_details;
842
- return !n || !r?.type ? null : {
843
- label: n,
844
- action: {
845
- title: n,
846
- type: r.type,
847
- ...r.payload !== void 0 ? { payload: r.payload } : {}
848
- }
849
- };
850
- }).filter((e) => !!e) }
851
- } }
852
- }
853
- };
854
- }
855
- function v(t) {
856
- const e = t?.payload;
857
- if (typeof e == "string") return e;
858
- if (e && typeof e == "object" && "text" in e) {
859
- const r = e.text;
860
- if (typeof r == "string") return r;
861
- }
862
- const n = t?.action;
863
- return n && typeof n.payload == "string" ? n.payload : n && typeof n.title == "string" ? n.title : "";
864
- }
865
- function Kt(t) {
866
- return Object.freeze([...t]);
867
- }
868
- function S(t) {
869
- return t && typeof t == "object" ? t : {};
870
- }
871
- function N(t) {
872
- return t && typeof t == "object" ? t : {};
873
- }
874
- function K(t) {
875
- return t.thread.extensions.beauty_profile;
876
- }
877
- var we = Kt([{
878
- kind: "be_op",
879
- op: "beauty-consulting-turn",
880
- input: ({ request: t, context: e }) => ({
881
- utterance: v(t),
882
- prior_messages: e.messages.slice(-10),
883
- profile: K(e),
884
- candidate_products: Ht(t),
885
- locale: e.meta.locale
886
- }),
887
- out: "consultation",
888
- patch: W
889
- }, {
890
- kind: "branch",
891
- on: ({ bag: t }) => S(t.consultation).consultation_state?.stage || "answer",
892
- cases: {
893
- refuse: [{
894
- kind: "refusal",
895
- message: ({ bag: t }) => {
896
- const e = S(t.consultation);
897
- return e.refusal?.message || e.plain_text || "I cannot help with that request.";
898
- }
899
- }],
900
- needs_more_info: [{
901
- kind: "emit",
902
- build: ({ bag: t }) => C(B(S(t.consultation)), !0)
903
- }, { kind: "commit" }],
904
- search: [
905
- {
906
- kind: "tool",
907
- name: "search",
908
- input: ({ request: t, bag: e, context: n }) => {
909
- const r = S(e.consultation);
910
- return {
911
- query: r.search_params?.query || v(t),
912
- facets: r.search_params?.facets || {},
913
- limit: 12,
914
- locale: n.meta.locale
915
- };
916
- },
917
- out: "products",
918
- patch: (t, e) => {
919
- const n = N(e);
920
- return { panel: {
921
- ...t.panel,
922
- screen_sku_list: O(n).map((r) => Wt(r)).filter((r) => !!r),
923
- last_search: { query: n.query || "" }
924
- } };
925
- }
926
- },
927
- {
928
- kind: "emit",
929
- build: ({ bag: t }) => Ct(Jt(O(N(t.products))))
930
- },
931
- {
932
- kind: "be_op",
933
- op: "beauty-consulting-turn",
934
- input: ({ request: t, context: e, bag: n }) => ({
935
- utterance: v(t),
936
- prior_messages: e.messages.slice(-10),
937
- profile: K(e),
938
- candidate_products: ot(O(N(n.products)).slice(0, 12)),
939
- locale: e.meta.locale
940
- }),
941
- out: "answer",
942
- patch: (t, e) => {
943
- const n = W(t, e), r = (S(e).product_mentions || []).map((o) => o.sku).filter((o) => !!o);
944
- return {
945
- ...n || {},
946
- panel: {
947
- ...t.panel,
948
- chat_mentioned_skus: r
949
- }
950
- };
951
- }
952
- },
953
- {
954
- kind: "emit",
955
- build: ({ bag: t }) => {
956
- const e = S(t.answer);
957
- return C(B(e), !0, { productMentions: e.product_mentions || [] });
958
- }
959
- },
960
- { kind: "commit" }
961
- ],
962
- default: [{
963
- kind: "emit",
964
- build: ({ bag: t }) => {
965
- const e = S(t.consultation);
966
- return C(B(e), !0, { productMentions: e.product_mentions || [] });
967
- }
968
- }, { kind: "commit" }]
969
- }
970
- }]);
971
- function W(t, e) {
972
- const n = S(e).consultation_state?.captured_profile;
973
- if (!n) return null;
974
- const r = t.thread.extensions.beauty_profile && typeof t.thread.extensions.beauty_profile == "object" ? t.thread.extensions.beauty_profile : {};
975
- return { thread: {
976
- ...t.thread,
977
- extensions: {
978
- ...t.thread.extensions,
979
- beauty_profile: {
980
- ...r,
981
- ...n
982
- }
983
- }
984
- } };
985
- }
986
- function O(t) {
987
- return Array.isArray(t?.products) ? t.products : [];
988
- }
989
- function Wt(t) {
990
- if (t && typeof t == "object" && "sku" in t) {
991
- const e = t.sku;
992
- if (typeof e == "string") return e;
993
- }
994
- }
995
- function Ht(t) {
996
- const e = t?.payload && typeof t.payload == "object" ? t.payload.products : void 0, n = t?.action?.payload && typeof t.action.payload == "object" ? t.action.payload.products : void 0, r = e || n;
997
- return Array.isArray(r) ? ot(r.slice(0, 12)) : void 0;
998
- }
999
- function B(t) {
1000
- return t?.answer_html || t?.plain_text || t?.refusal?.message || "I can help with beauty shopping.";
1001
- }
1002
- var H = /* @__PURE__ */ new Set([
1003
- "and",
1004
- "are",
1005
- "box",
1006
- "for",
1007
- "from",
1008
- "gift",
1009
- "gifts",
1010
- "the",
1011
- "with"
1012
- ]), Vt = {
1013
- token: 0.26,
1014
- keyword: 0.22,
1015
- category: 0.18,
1016
- facet: 0.16,
1017
- color: 0.08,
1018
- attribute: 0.06,
1019
- price: 0.08,
1020
- retrieval: 0.08
1021
- }, Gt = [
1022
- "amber",
1023
- "beige",
1024
- "black",
1025
- "blue",
1026
- "blush",
1027
- "bronze",
1028
- "brown",
1029
- "cream",
1030
- "gold",
1031
- "green",
1032
- "grey",
1033
- "ivory",
1034
- "lilac",
1035
- "mixed",
1036
- "orange",
1037
- "pastel",
1038
- "pink",
1039
- "purple",
1040
- "red",
1041
- "silver",
1042
- "white",
1043
- "yellow"
1044
- ];
1045
- function x(t) {
1046
- return String(t ?? "").normalize("NFKD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").replace(/\s+/gu, " ").trim();
1047
- }
1048
- function k(t, e = H) {
1049
- const n = e instanceof Set ? e : /* @__PURE__ */ new Set([...H, ...e]), r = /* @__PURE__ */ new Set(), o = [];
1050
- for (const i of x(t).split(/\s+/u))
1051
- i.length < 3 || n.has(i) || r.has(i) || (r.add(i), o.push(i));
1052
- return o;
1053
- }
1054
- function M(t, e = {}) {
1055
- if (Yt(t)) return t;
1056
- const n = e.facetKeys, r = y(t.category_names ?? t.category), o = y(t.category_ids), i = Xt(t.facet_hits), a = Object.entries(i).filter(([f]) => !n || n.some((_) => x(_) === x(f))).map(([, f]) => f), s = w(t.name, t.title), c = w(t.brand), u = e.sourceKeywords ?? [], l = [
1057
- s,
1058
- c,
1059
- ...r,
1060
- ...a,
1061
- ...y(t.promotions),
1062
- w(t.description),
1063
- ...u
1064
- ].join(" "), d = k(l, e.stopWords), m = w(e.sourceProductType, ee(r, s, d), d[0]), p = b([...te(l, Gt), ...Object.entries(i).filter(([f]) => /colou?r/iu.test(f)).flatMap(([, f]) => k(f, e.stopWords))]), g = b([...a.flatMap((f) => k(f, e.stopWords)), ...y(t.promotions).flatMap((f) => k(f, e.stopWords))]).slice(0, 24);
1065
- return {
1066
- sku: w(t.sku),
1067
- title: s,
1068
- brand: c,
1069
- productType: m,
1070
- categoryNames: r,
1071
- categoryIds: o,
1072
- facets: i,
1073
- keywords: b([...u.flatMap((f) => k(f, e.stopWords)), ...d]).slice(0, 12),
1074
- tokens: d,
1075
- colors: p,
1076
- attributes: g,
1077
- price: Zt(t)
1078
- };
1079
- }
1080
- function be(t, e = {}) {
1081
- const n = w(t.product_type, t.productType), r = w(t.title, n, y(t.keywords).join(" ")), o = b([
1082
- ...y(t.keywords),
1083
- ...y(t.colors),
1084
- ...y(t.materials),
1085
- ...y(t.styles),
1086
- ...y(t.attributes)
1087
- ]);
1088
- return M({
1089
- sku: "__photo__",
1090
- name: r,
1091
- category_names: n ? [n] : [],
1092
- facet_hits: {
1093
- colors: y(t.colors).join(", "),
1094
- materials: y(t.materials).join(", "),
1095
- styles: y(t.styles).join(", "),
1096
- attributes: y(t.attributes).join(", ")
1097
- },
1098
- promotions: o
1099
- }, {
1100
- ...e,
1101
- sourceProductType: n,
1102
- sourceKeywords: o
1103
- });
1104
- }
1105
- function _e(t, e = {}) {
1106
- const n = M(t, e);
1107
- return b([
1108
- ...e.sourceQueries ?? [],
1109
- P([
1110
- n.productType,
1111
- ...n.colors.slice(0, 1),
1112
- ...n.attributes.slice(0, 2)
1113
- ]),
1114
- P([n.productType, ...n.keywords.slice(0, 3)]),
1115
- P([n.categoryNames[n.categoryNames.length - 1], ...n.keywords.slice(0, 2)]),
1116
- P(n.title.split(/\s+/u).slice(0, 6)),
1117
- n.productType
1118
- ].map((r) => r.trim()).filter(Boolean)).slice(0, e.queryLimit ?? 6);
1119
- }
1120
- function Qt(t, e, n = {}) {
1121
- const r = {
1122
- ...Vt,
1123
- ...n.weights
1124
- }, o = M(e, n), i = [], a = A(t.tokens, o.tokens), s = A(t.keywords, o.tokens), c = ne(t.categoryNames, o.categoryNames) || A(V(t.categoryNames), V(o.categoryNames)), u = A(t.attributes, o.attributes), l = A(t.colors, o.colors), d = A(t.attributes, o.tokens), m = re(t.price, o.price), p = oe(o.sku, n.hitCounts) > 0 ? 1 : 0, g = ie(t, o), f = a * r.token + s * r.keyword + c * r.category + u * r.facet + l * r.color + d * r.attribute + m * r.price + p * r.retrieval, _ = ae(g ? f : f * 0.35);
1125
- return g && t.productType && t.productType === o.productType && i.push("same product type"), c > 0.4 && i.push("similar category"), u > 0.2 && i.push("matching product attributes"), l > 0 && i.push("matching colour"), m > 0.8 && i.push("similar price"), g || i.push("weaker product-type match"), {
1126
- score: Number(_.toFixed(4)),
1127
- reasons: i
1128
- };
1129
- }
1130
- function Se(t, e, n = {}) {
1131
- const r = M(t, n), o = new Set([r.sku, ...n.ignoreSkus ?? []].filter(Boolean));
1132
- return e.filter((i) => {
1133
- const a = w(i.sku);
1134
- return a && !o.has(a);
1135
- }).map((i) => {
1136
- const a = Qt(r, i, n);
1137
- return {
1138
- ...i,
1139
- similarity_score: a.score,
1140
- similarity_reasons: a.reasons
1141
- };
1142
- }).sort((i, a) => a.similarity_score - i.similarity_score).slice(0, Math.max(1, Math.min(n.limit ?? 12, 100)));
1143
- }
1144
- function Yt(t) {
1145
- return !!(t && typeof t == "object" && Array.isArray(t.tokens));
1146
- }
1147
- function w(...t) {
1148
- for (const e of t) if (typeof e == "string" && e.trim()) return e.trim();
1149
- return "";
1150
- }
1151
- function y(t) {
1152
- return Array.isArray(t) ? t.map((e) => w(e)).filter(Boolean) : typeof t == "string" && t.trim() ? t.split(/[,;/|]+/u).map((e) => e.trim()).filter(Boolean) : [];
1153
- }
1154
- function Xt(t) {
1155
- return !t || typeof t != "object" || Array.isArray(t) ? {} : Object.fromEntries(Object.entries(t).map(([e, n]) => [e, w(n)]).filter(([, e]) => e));
1156
- }
1157
- function Zt(t) {
1158
- const e = Number(t.price_discounted);
1159
- if (Number.isFinite(e) && e > 0) return e;
1160
- const n = Number(t.price);
1161
- return Number.isFinite(n) && n > 0 ? n : 0;
1162
- }
1163
- function b(t) {
1164
- const e = /* @__PURE__ */ new Set(), n = [];
1165
- for (const r of t) {
1166
- const o = x(r);
1167
- !o || e.has(o) || (e.add(o), n.push(o));
1168
- }
1169
- return n;
1170
- }
1171
- function te(t, e) {
1172
- const n = ` ${x(t)} `;
1173
- return e.filter((r) => n.includes(` ${x(r)} `));
1174
- }
1175
- function ee(t, e, n) {
1176
- const r = x(t[t.length - 1] ?? t[0] ?? "");
1177
- if (r) {
1178
- const o = k(r), i = new Set(k(e));
1179
- return o.find((a) => i.has(a)) ?? o[0] ?? r;
1180
- }
1181
- return n[0] ?? "";
1182
- }
1183
- function P(t) {
1184
- return t.map((e) => x(e)).filter(Boolean).join(" ").replace(/\s+/gu, " ").trim().slice(0, 120);
1185
- }
1186
- function V(t) {
1187
- return t.flatMap((e) => k(e));
1188
- }
1189
- function A(t, e) {
1190
- const n = b(t), r = new Set(b(e));
1191
- return n.length === 0 || r.size === 0 ? 0 : n.filter((o) => r.has(o)).length / n.length;
1192
- }
1193
- function ne(t, e) {
1194
- const n = b(t), r = new Set(b(e));
1195
- return n.length === 0 || r.size === 0 ? 0 : n.filter((o) => r.has(o)).length / n.length;
1196
- }
1197
- function re(t, e) {
1198
- return t <= 0 || e <= 0 ? 0 : Math.min(t, e) / Math.max(t, e);
1199
- }
1200
- function oe(t, e) {
1201
- return !t || !e ? 0 : typeof e.get == "function" ? e.get(t) ?? 0 : e[t] ?? 0;
1202
- }
1203
- function ie(t, e) {
1204
- if (!t.productType || !e.productType || t.productType === e.productType) return !0;
1205
- const n = new Set(k(t.productType)), r = /* @__PURE__ */ new Set([...k(e.productType), ...e.tokens]);
1206
- return [...n].some((o) => r.has(o));
1207
- }
1208
- function ae(t) {
1209
- return Math.max(0, Math.min(1, t));
1210
- }
1211
- export {
1212
- le as A,
1213
- Mt as C,
1214
- de as D,
1215
- Ct as E,
1216
- R as F,
1217
- ft as I,
1218
- se as L,
1219
- bt as M,
1220
- wt as N,
1221
- Z as O,
1222
- ue as P,
1223
- ce as R,
1224
- et as S,
1225
- C as T,
1226
- ot as _,
1227
- Se as a,
1228
- vt as b,
1229
- we as c,
1230
- ke as d,
1231
- he as f,
1232
- qt as g,
1233
- F as h,
1234
- x as i,
1235
- Tt as j,
1236
- tt as k,
1237
- Kt as l,
1238
- Jt as m,
1239
- M as n,
1240
- Qt as o,
1241
- ge as p,
1242
- _e as r,
1243
- k as s,
1244
- be as t,
1245
- v as u,
1246
- ye as v,
1247
- fe as w,
1248
- pe as x,
1249
- me as y,
1250
- dt as z
1251
- };