@gengage/assistant-fe 0.6.7 → 0.6.8
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.
- package/README.md +1 -1
- package/dist/agentic/index.js +117 -116
- package/dist/agentic/types.d.ts +2 -0
- package/dist/agentic/worker/be-client.d.ts +2 -1
- package/dist/agentic/worker.js +49 -48
- package/dist/agentic.iife.js +4 -4
- package/dist/{api-paths-Dkah8jhG.js → api-paths-DXlenbou.js} +1 -1
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +1 -1
- package/dist/chat.js +1 -1
- package/dist/{common-Buxw5G_i.js → common-BqxygI8c.js} +1 -1
- package/dist/common.js +5 -5
- package/dist/{connection-warning-CEm2TZpj.js → connection-warning-BX0ZcdJM.js} +1 -1
- package/dist/{fastIntent-HK3SqGgn.js → fastIntent-Dl9zgfsn.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/native.iife.js +1 -1
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/{runtime-DEOej3zn.js → runtime-CbSp96W2.js} +3 -3
- package/dist/{runtime-Dir14P0o.js → runtime-DKBxlh-F.js} +3 -3
- package/dist/{runtime-OdW89-j-.js → runtime-_HRuAyrh.js} +3 -3
- package/dist/{simbut-DWvSKXQ7.js → simbut-DotkjkIQ.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{similarity-CfOr8nPO.js → similarity-XEVfAN-6.js} +211 -200
- package/dist/{simrel-DWV_87jY.js → simrel-CBnnj4Mm.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +1 -1
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-Cafa292X.js → widget-base-BEXFI7CM.js} +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ function it(t) {
|
|
|
4
4
|
function at(t) {
|
|
5
5
|
return !!t && typeof t == "object" && t.type === "rpc.req";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function ae(t = self) {
|
|
8
8
|
let e = 1;
|
|
9
9
|
const n = /* @__PURE__ */ new Map();
|
|
10
10
|
return t.addEventListener("message", (r) => {
|
|
@@ -34,7 +34,7 @@ function ie(t = self) {
|
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function se({ worker: t, tools: e = {}, beacon: n, memory: r = sessionStorage }) {
|
|
38
38
|
t.addEventListener("message", (o) => {
|
|
39
39
|
const i = o.data;
|
|
40
40
|
at(i) && st(t, i, {
|
|
@@ -95,25 +95,25 @@ async function dt(t, e, { tools: n, beacon: r, memory: o }) {
|
|
|
95
95
|
function ft() {
|
|
96
96
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function R(t) {
|
|
99
99
|
return Math.max(0, Math.round(performance.now() - t));
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function E(t) {
|
|
102
102
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
103
103
|
}
|
|
104
104
|
function pt(t) {
|
|
105
|
-
const { accountId: e, locale: n = "en-GB", parentUrl: r = "", threadId: o, incomingContext: i } = t, a =
|
|
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
106
|
id: String(o || s.id || self.crypto.randomUUID()),
|
|
107
107
|
started_at: String(s.started_at || ft()),
|
|
108
|
-
extensions:
|
|
109
|
-
},
|
|
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
110
|
return {
|
|
111
111
|
panel: { ...c },
|
|
112
112
|
messages: l,
|
|
113
113
|
thread: d,
|
|
114
114
|
meta: {
|
|
115
|
-
locale:
|
|
116
|
-
parentUrl:
|
|
115
|
+
locale: m,
|
|
116
|
+
parentUrl: p,
|
|
117
117
|
accountId: e
|
|
118
118
|
}
|
|
119
119
|
};
|
|
@@ -152,10 +152,10 @@ async function ht({ accountId: t, threadId: e, extensions: n, rpc: r }) {
|
|
|
152
152
|
function Q(t, e) {
|
|
153
153
|
return `${yt}${t}:${e}`;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function h(t) {
|
|
156
156
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
157
157
|
}
|
|
158
|
-
var
|
|
158
|
+
var ce = class {
|
|
159
159
|
#t = /* @__PURE__ */ new Map();
|
|
160
160
|
#e;
|
|
161
161
|
#r;
|
|
@@ -208,11 +208,11 @@ var se = class {
|
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
210
|
function kt(t, e) {
|
|
211
|
-
return !
|
|
211
|
+
return !h(t) && !h(e) ? {} : Y(h(t) ? t : {}, h(e) ? e : {});
|
|
212
212
|
}
|
|
213
213
|
function Y(t, e) {
|
|
214
|
-
if (!
|
|
215
|
-
const n = t, r = e, o =
|
|
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
216
|
return {
|
|
217
217
|
...t,
|
|
218
218
|
...e,
|
|
@@ -389,7 +389,7 @@ function Tt(t, e) {
|
|
|
389
389
|
detail: n.detail
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function ue(t) {
|
|
393
393
|
return t instanceof Z ? {
|
|
394
394
|
type: "error",
|
|
395
395
|
code: t.code,
|
|
@@ -403,40 +403,50 @@ function ce(t) {
|
|
|
403
403
|
function At(t) {
|
|
404
404
|
return t === 401 ? "unauthorized" : t === 403 ? "forbidden" : t === 413 ? "payload_too_large" : t === 429 ? "rate_limited" : "internal";
|
|
405
405
|
}
|
|
406
|
-
async function
|
|
407
|
-
const
|
|
406
|
+
async function le({ 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), f = {
|
|
408
416
|
method: "POST",
|
|
409
417
|
headers: {
|
|
410
|
-
authorization: `Bearer ${
|
|
411
|
-
accountId: e,
|
|
412
|
-
devJwtSecret: n,
|
|
413
|
-
tokenBrokerUrl: r,
|
|
414
|
-
tokenBrokerAudience: o
|
|
415
|
-
}))({
|
|
416
|
-
...l ? { signal: l } : {},
|
|
417
|
-
...a ? { parentUrl: a } : {}
|
|
418
|
-
})}`,
|
|
418
|
+
authorization: `Bearer ${m}`,
|
|
419
419
|
"content-type": "application/json",
|
|
420
420
|
accept: "application/x-ndjson"
|
|
421
421
|
},
|
|
422
422
|
body: JSON.stringify({
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
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 } : {}
|
|
426
428
|
}),
|
|
427
|
-
...
|
|
428
|
-
},
|
|
429
|
-
if (!
|
|
430
|
-
return
|
|
429
|
+
...d ? { signal: d } : {}
|
|
430
|
+
}, _ = await fetch(`${String(t).replace(/\/+$/u, "")}/v1/execute`, f);
|
|
431
|
+
if (!_.ok) throw Tt(_.status, await Et(_));
|
|
432
|
+
return jt(_);
|
|
433
|
+
}
|
|
434
|
+
function It(t) {
|
|
435
|
+
const e = t.indexOf("-");
|
|
436
|
+
if (e <= 0 || e === t.length - 1) throw new Error(`Invalid BE op name: ${t}`);
|
|
437
|
+
return {
|
|
438
|
+
opDomain: t.slice(0, e),
|
|
439
|
+
opName: t.slice(e + 1)
|
|
440
|
+
};
|
|
431
441
|
}
|
|
432
|
-
async function
|
|
442
|
+
async function Et(t) {
|
|
433
443
|
try {
|
|
434
444
|
return await t.json();
|
|
435
445
|
} catch {
|
|
436
446
|
return { error: { code: t.statusText || "internal" } };
|
|
437
447
|
}
|
|
438
448
|
}
|
|
439
|
-
async function
|
|
449
|
+
async function jt(t) {
|
|
440
450
|
const e = t.body?.getReader();
|
|
441
451
|
if (!e) throw new Error("BE response body is not readable.");
|
|
442
452
|
const n = new TextDecoder();
|
|
@@ -461,13 +471,13 @@ function q(t, e) {
|
|
|
461
471
|
if (t._error) throw tt(t._error);
|
|
462
472
|
t._end || Object.assign(e, t);
|
|
463
473
|
}
|
|
464
|
-
function
|
|
474
|
+
function de(t = {}) {
|
|
465
475
|
return {
|
|
466
476
|
type: "metadata",
|
|
467
477
|
...t
|
|
468
478
|
};
|
|
469
479
|
}
|
|
470
|
-
function
|
|
480
|
+
function C(t, e = !1, n = {}) {
|
|
471
481
|
return {
|
|
472
482
|
type: "text_chunk",
|
|
473
483
|
content: t,
|
|
@@ -475,19 +485,19 @@ function P(t, e = !1, n = {}) {
|
|
|
475
485
|
...n
|
|
476
486
|
};
|
|
477
487
|
}
|
|
478
|
-
function
|
|
488
|
+
function Pt(t) {
|
|
479
489
|
return {
|
|
480
490
|
type: "ui_spec",
|
|
481
491
|
...t
|
|
482
492
|
};
|
|
483
493
|
}
|
|
484
|
-
function
|
|
494
|
+
function fe(t) {
|
|
485
495
|
return {
|
|
486
496
|
type: "action",
|
|
487
497
|
action: t
|
|
488
498
|
};
|
|
489
499
|
}
|
|
490
|
-
function
|
|
500
|
+
function Ct(t, e) {
|
|
491
501
|
return {
|
|
492
502
|
type: "error",
|
|
493
503
|
code: t,
|
|
@@ -497,19 +507,19 @@ function Pt(t, e) {
|
|
|
497
507
|
function et() {
|
|
498
508
|
return { type: "done" };
|
|
499
509
|
}
|
|
500
|
-
function
|
|
510
|
+
function Mt(t, e) {
|
|
501
511
|
return t[e?.type || e?.action?.type || "inputText"] || t.inputText;
|
|
502
512
|
}
|
|
503
|
-
async function
|
|
504
|
-
const c = performance.now(), u = await n.load(t), l = u.thread.id, d =
|
|
513
|
+
async function pe({ request: t, accountModule: e, contextStore: n, beClient: r, toolBridge: o, emit: i, rpc: a, signal: s }) {
|
|
514
|
+
const c = performance.now(), u = await n.load(t), l = u.thread.id, d = Dt(t);
|
|
505
515
|
n.appendUserMessage(l, d);
|
|
506
|
-
const
|
|
507
|
-
if (!
|
|
508
|
-
return i(
|
|
516
|
+
const m = Mt(e.flows, t);
|
|
517
|
+
if (!m)
|
|
518
|
+
return i(Ct("unknown_action", `No agent flow for request type ${t?.type || "inputText"}`)), i(et()), {
|
|
509
519
|
steps: 0,
|
|
510
520
|
productSkusEmitted: []
|
|
511
521
|
};
|
|
512
|
-
const
|
|
522
|
+
const p = {
|
|
513
523
|
request: t,
|
|
514
524
|
context: n.patch(l, {}) || u,
|
|
515
525
|
bag: {},
|
|
@@ -518,7 +528,7 @@ async function fe({ request: t, accountModule: e, contextStore: n, beClient: r,
|
|
|
518
528
|
steps: 0,
|
|
519
529
|
productSkusEmitted: /* @__PURE__ */ new Set(),
|
|
520
530
|
committed: !1
|
|
521
|
-
},
|
|
531
|
+
}, g = {
|
|
522
532
|
contextStore: n,
|
|
523
533
|
beClient: r,
|
|
524
534
|
toolBridge: o,
|
|
@@ -526,37 +536,37 @@ async function fe({ request: t, accountModule: e, contextStore: n, beClient: r,
|
|
|
526
536
|
rpc: a,
|
|
527
537
|
...s ? { signal: s } : {}
|
|
528
538
|
};
|
|
529
|
-
return await U(
|
|
539
|
+
return await U(m, p, g), p.committed || await $(p, g), await a("beacon.send", {
|
|
530
540
|
type: "turnSummary",
|
|
531
541
|
threadId: l,
|
|
532
542
|
sessionId: t?.session_id || t?.sessionId || l,
|
|
533
|
-
accountId: e.accountId ||
|
|
534
|
-
steps:
|
|
535
|
-
totalLatencyMs:
|
|
536
|
-
productSkusEmitted: [...
|
|
543
|
+
accountId: e.accountId || p.context.meta.accountId,
|
|
544
|
+
steps: p.steps,
|
|
545
|
+
totalLatencyMs: R(c),
|
|
546
|
+
productSkusEmitted: [...p.productSkusEmitted]
|
|
537
547
|
}), {
|
|
538
|
-
steps:
|
|
539
|
-
productSkusEmitted: [...
|
|
548
|
+
steps: p.steps,
|
|
549
|
+
productSkusEmitted: [...p.productSkusEmitted]
|
|
540
550
|
};
|
|
541
551
|
}
|
|
542
552
|
async function U(t, e, n) {
|
|
543
553
|
for (const r of t) {
|
|
544
554
|
if (n.signal?.aborted) return;
|
|
545
|
-
e.steps += 1, await
|
|
555
|
+
e.steps += 1, await vt(r, e, n), e.context = n.contextStore.patch(e.threadId, {}) || e.context;
|
|
546
556
|
}
|
|
547
557
|
}
|
|
548
|
-
async function
|
|
558
|
+
async function vt(t, e, n) {
|
|
549
559
|
const r = F(e);
|
|
550
560
|
if (t.kind === "be_op") {
|
|
551
|
-
await
|
|
561
|
+
await Nt(t, e, n, r);
|
|
552
562
|
return;
|
|
553
563
|
}
|
|
554
564
|
if (t.kind === "tool") {
|
|
555
|
-
await
|
|
565
|
+
await Ot(t, e, n, r);
|
|
556
566
|
return;
|
|
557
567
|
}
|
|
558
568
|
if (t.kind === "emit") {
|
|
559
|
-
|
|
569
|
+
Bt(t, e, n);
|
|
560
570
|
return;
|
|
561
571
|
}
|
|
562
572
|
if (t.kind === "branch") {
|
|
@@ -564,70 +574,71 @@ async function Mt(t, e, n) {
|
|
|
564
574
|
return;
|
|
565
575
|
}
|
|
566
576
|
if (t.kind === "parallel") {
|
|
567
|
-
await
|
|
577
|
+
await Ut(t, e, n);
|
|
568
578
|
return;
|
|
569
579
|
}
|
|
570
580
|
if (t.kind === "refusal") {
|
|
571
|
-
await
|
|
581
|
+
await $t(t, e, n, r);
|
|
572
582
|
return;
|
|
573
583
|
}
|
|
574
|
-
t.kind === "commit" && await
|
|
584
|
+
t.kind === "commit" && await Ft(t, e, n);
|
|
575
585
|
}
|
|
576
|
-
async function
|
|
586
|
+
async function Nt(t, e, n, r) {
|
|
577
587
|
const o = performance.now();
|
|
578
588
|
let i;
|
|
579
|
-
const a =
|
|
589
|
+
const a = I(t.cacheTtlS, r), s = I(t.cacheKey, r);
|
|
580
590
|
try {
|
|
581
591
|
i = await n.beClient.invoke({
|
|
582
592
|
op: t.op,
|
|
583
|
-
input:
|
|
593
|
+
input: I(t.input, r),
|
|
584
594
|
...a !== void 0 ? { cacheTtlS: a } : {},
|
|
595
|
+
...s !== void 0 ? { cacheKey: s } : {},
|
|
585
596
|
...n.signal ? { signal: n.signal } : {}
|
|
586
597
|
});
|
|
587
|
-
} catch (
|
|
588
|
-
const
|
|
598
|
+
} catch (u) {
|
|
599
|
+
const l = u, d = String(l?.sourceCode || l?.code || "unknown"), m = {
|
|
589
600
|
type: "agentOp",
|
|
590
601
|
threadId: e.threadId,
|
|
591
602
|
sessionId: e.request?.session_id || e.request?.sessionId || e.threadId,
|
|
592
603
|
accountId: e.context.meta.accountId,
|
|
593
604
|
op: t.op,
|
|
594
605
|
status: "error",
|
|
595
|
-
latencyMs:
|
|
596
|
-
errorCode:
|
|
606
|
+
latencyMs: R(o),
|
|
607
|
+
errorCode: d
|
|
597
608
|
};
|
|
598
|
-
throw await n.rpc("beacon.send",
|
|
609
|
+
throw await n.rpc("beacon.send", m), u;
|
|
599
610
|
}
|
|
600
611
|
t.out && (e.bag[t.out] = i), nt(t, i, e, n.contextStore);
|
|
601
|
-
const
|
|
612
|
+
const c = {
|
|
602
613
|
type: "agentOp",
|
|
603
614
|
threadId: e.threadId,
|
|
604
615
|
sessionId: e.request?.session_id || e.request?.sessionId || e.threadId,
|
|
605
616
|
accountId: e.context.meta.accountId,
|
|
606
617
|
op: t.op,
|
|
607
618
|
status: "ok",
|
|
608
|
-
latencyMs:
|
|
619
|
+
latencyMs: R(o)
|
|
609
620
|
};
|
|
610
|
-
await n.rpc("beacon.send",
|
|
621
|
+
await n.rpc("beacon.send", c);
|
|
611
622
|
}
|
|
612
|
-
async function
|
|
613
|
-
const o = await n.toolBridge.invoke(t.name,
|
|
623
|
+
async function Ot(t, e, n, r) {
|
|
624
|
+
const o = await n.toolBridge.invoke(t.name, I(t.input, r));
|
|
614
625
|
t.out && (e.bag[t.out] = o), nt(t, o, e, n.contextStore);
|
|
615
626
|
}
|
|
616
|
-
function
|
|
627
|
+
function Bt(t, e, n) {
|
|
617
628
|
const r = t.build(F(e));
|
|
618
|
-
|
|
629
|
+
zt(r, e.productSkusEmitted), n.emit(r);
|
|
619
630
|
}
|
|
620
631
|
async function Rt(t, e, n, r) {
|
|
621
|
-
const o = String(
|
|
632
|
+
const o = String(I(t.on, r) || "default");
|
|
622
633
|
await U(t.cases[o] || t.cases.default || [], e, n);
|
|
623
634
|
}
|
|
624
|
-
async function
|
|
635
|
+
async function Ut(t, e, n) {
|
|
625
636
|
await Promise.all(t.steps.map((r) => U(r, e, n)));
|
|
626
637
|
}
|
|
627
|
-
async function
|
|
628
|
-
n.emit(
|
|
638
|
+
async function $t(t, e, n, r) {
|
|
639
|
+
n.emit(C(I(t.message, r), !0)), await $(e, n);
|
|
629
640
|
}
|
|
630
|
-
async function
|
|
641
|
+
async function Ft(t, e, n) {
|
|
631
642
|
await $(e, n);
|
|
632
643
|
}
|
|
633
644
|
async function $(t, { contextStore: e, emit: n }) {
|
|
@@ -646,10 +657,10 @@ function F(t) {
|
|
|
646
657
|
accountConfig: t.accountConfig
|
|
647
658
|
};
|
|
648
659
|
}
|
|
649
|
-
function
|
|
660
|
+
function I(t, e) {
|
|
650
661
|
return typeof t == "function" ? t(e) : t;
|
|
651
662
|
}
|
|
652
|
-
function
|
|
663
|
+
function Dt(t) {
|
|
653
664
|
const e = t?.payload;
|
|
654
665
|
if (typeof e == "string") return e;
|
|
655
666
|
if (e && typeof e == "object" && "text" in e) {
|
|
@@ -658,7 +669,7 @@ function Ft(t) {
|
|
|
658
669
|
}
|
|
659
670
|
return typeof t?.action?.payload == "string" ? t.action.payload : typeof t?.action?.title == "string" ? t.action.title : "";
|
|
660
671
|
}
|
|
661
|
-
function
|
|
672
|
+
function zt(t, e) {
|
|
662
673
|
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;
|
|
663
674
|
if (Array.isArray(a)) {
|
|
664
675
|
for (const s of a) if (s && typeof s == "object") {
|
|
@@ -667,7 +678,7 @@ function Dt(t, e) {
|
|
|
667
678
|
}
|
|
668
679
|
}
|
|
669
680
|
}
|
|
670
|
-
function
|
|
681
|
+
function me(t) {
|
|
671
682
|
return { invoke(e, n) {
|
|
672
683
|
return t("tool.invoke", {
|
|
673
684
|
name: e,
|
|
@@ -681,30 +692,30 @@ function rt(t) {
|
|
|
681
692
|
function D(t) {
|
|
682
693
|
const e = rt(t);
|
|
683
694
|
if (!e) return null;
|
|
684
|
-
const n =
|
|
695
|
+
const n = T(e.sku, e.SKU);
|
|
685
696
|
if (!n) return null;
|
|
686
697
|
const r = {
|
|
687
698
|
sku: n,
|
|
688
|
-
name:
|
|
689
|
-
url:
|
|
690
|
-
}, o = Array.isArray(e.images) ? e.images : void 0, i =
|
|
699
|
+
name: T(e.name, e.title, e.short_name, n) || n,
|
|
700
|
+
url: T(e.url) || ""
|
|
701
|
+
}, o = Array.isArray(e.images) ? e.images : void 0, i = T(e.imageUrl, e.image_url, e.image, o?.[0]);
|
|
691
702
|
i && (r.imageUrl = i), o && o.length > 1 && (r.images = o.filter((f) => !!f).map(String));
|
|
692
|
-
const a =
|
|
703
|
+
const a = j(e.price_discounted), s = j(e.price), c = a || s;
|
|
693
704
|
c > 0 && (r.price = String(c));
|
|
694
705
|
const u = a > 0 ? s : 0;
|
|
695
706
|
u > 0 && (r.originalPrice = String(u));
|
|
696
|
-
const l =
|
|
707
|
+
const l = T(e.brand);
|
|
697
708
|
l && (r.brand = l);
|
|
698
|
-
const d =
|
|
709
|
+
const d = j(e.rating);
|
|
699
710
|
d > 0 && (r.rating = d);
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
const
|
|
703
|
-
|
|
704
|
-
const
|
|
705
|
-
return Array.isArray(
|
|
706
|
-
}
|
|
707
|
-
function
|
|
711
|
+
const m = j(e.review_count) || j(e.reviewCount);
|
|
712
|
+
m > 0 && (r.reviewCount = m);
|
|
713
|
+
const p = T(e.cart_code, e.cartCode);
|
|
714
|
+
p && (r.cartCode = p), typeof e.in_stock == "boolean" && (r.inStock = e.in_stock), typeof e.inStock == "boolean" && (r.inStock = e.inStock);
|
|
715
|
+
const g = e.category_names;
|
|
716
|
+
return Array.isArray(g) && (r.categoryNames = g.map(String)), r;
|
|
717
|
+
}
|
|
718
|
+
function Lt(t) {
|
|
708
719
|
const e = rt(t);
|
|
709
720
|
if (!e) return t;
|
|
710
721
|
const n = e.category_names, r = Array.isArray(n) ? n : void 0, o = e.images, i = Array.isArray(o) ? o : void 0, a = {
|
|
@@ -724,20 +735,20 @@ function zt(t) {
|
|
|
724
735
|
return a;
|
|
725
736
|
}
|
|
726
737
|
function ot(t) {
|
|
727
|
-
return Array.isArray(t) ? t.map(
|
|
738
|
+
return Array.isArray(t) ? t.map(Lt).filter((e) => !!e) : [];
|
|
728
739
|
}
|
|
729
|
-
function
|
|
740
|
+
function T(...t) {
|
|
730
741
|
for (const e of t) if (typeof e == "string" && e.trim()) return e.trim();
|
|
731
742
|
return "";
|
|
732
743
|
}
|
|
733
|
-
function
|
|
744
|
+
function j(t) {
|
|
734
745
|
const e = Number(t);
|
|
735
746
|
return Number.isFinite(e) ? e : 0;
|
|
736
747
|
}
|
|
737
748
|
function J(t) {
|
|
738
749
|
return Array.isArray(t) ? t.map(String).filter(Boolean) : typeof t == "string" && t ? [t] : [];
|
|
739
750
|
}
|
|
740
|
-
function
|
|
751
|
+
function qt(t = []) {
|
|
741
752
|
const e = {}, n = [];
|
|
742
753
|
return (Array.isArray(t) ? t.map(D).filter((r) => !!r) : []).forEach((r, o) => {
|
|
743
754
|
const i = `product-${o.toString()}`;
|
|
@@ -771,7 +782,7 @@ function Lt(t = []) {
|
|
|
771
782
|
}
|
|
772
783
|
};
|
|
773
784
|
}
|
|
774
|
-
function
|
|
785
|
+
function ye(t) {
|
|
775
786
|
return {
|
|
776
787
|
widget: "chat",
|
|
777
788
|
panelHint: "panel",
|
|
@@ -784,7 +795,7 @@ function me(t) {
|
|
|
784
795
|
}
|
|
785
796
|
};
|
|
786
797
|
}
|
|
787
|
-
function
|
|
798
|
+
function ge(t = {}) {
|
|
788
799
|
const e = (t.multiple_product_details || t.products || []).map(D).filter((r) => !!r), n = t.table || {};
|
|
789
800
|
return {
|
|
790
801
|
widget: "chat",
|
|
@@ -816,7 +827,7 @@ function ye(t = {}) {
|
|
|
816
827
|
}
|
|
817
828
|
};
|
|
818
829
|
}
|
|
819
|
-
function
|
|
830
|
+
function he(t = []) {
|
|
820
831
|
return {
|
|
821
832
|
widget: "chat",
|
|
822
833
|
panelHint: "inline",
|
|
@@ -849,10 +860,10 @@ function v(t) {
|
|
|
849
860
|
const n = t?.action;
|
|
850
861
|
return n && typeof n.payload == "string" ? n.payload : n && typeof n.title == "string" ? n.title : "";
|
|
851
862
|
}
|
|
852
|
-
function
|
|
863
|
+
function Jt(t) {
|
|
853
864
|
return Object.freeze([...t]);
|
|
854
865
|
}
|
|
855
|
-
function
|
|
866
|
+
function S(t) {
|
|
856
867
|
return t && typeof t == "object" ? t : {};
|
|
857
868
|
}
|
|
858
869
|
function N(t) {
|
|
@@ -861,39 +872,39 @@ function N(t) {
|
|
|
861
872
|
function K(t) {
|
|
862
873
|
return t.thread.extensions.beauty_profile;
|
|
863
874
|
}
|
|
864
|
-
var
|
|
875
|
+
var ke = Jt([{
|
|
865
876
|
kind: "be_op",
|
|
866
877
|
op: "beauty-consulting-turn",
|
|
867
878
|
input: ({ request: t, context: e }) => ({
|
|
868
879
|
utterance: v(t),
|
|
869
880
|
prior_messages: e.messages.slice(-10),
|
|
870
881
|
profile: K(e),
|
|
871
|
-
candidate_products:
|
|
882
|
+
candidate_products: Ht(t),
|
|
872
883
|
locale: e.meta.locale
|
|
873
884
|
}),
|
|
874
885
|
out: "consultation",
|
|
875
886
|
patch: H
|
|
876
887
|
}, {
|
|
877
888
|
kind: "branch",
|
|
878
|
-
on: ({ bag: t }) =>
|
|
889
|
+
on: ({ bag: t }) => S(t.consultation).consultation_state?.stage || "answer",
|
|
879
890
|
cases: {
|
|
880
891
|
refuse: [{
|
|
881
892
|
kind: "refusal",
|
|
882
893
|
message: ({ bag: t }) => {
|
|
883
|
-
const e =
|
|
894
|
+
const e = S(t.consultation);
|
|
884
895
|
return e.refusal?.message || e.plain_text || "I cannot help with that request.";
|
|
885
896
|
}
|
|
886
897
|
}],
|
|
887
898
|
needs_more_info: [{
|
|
888
899
|
kind: "emit",
|
|
889
|
-
build: ({ bag: t }) =>
|
|
900
|
+
build: ({ bag: t }) => C(B(S(t.consultation)), !0)
|
|
890
901
|
}, { kind: "commit" }],
|
|
891
902
|
search: [
|
|
892
903
|
{
|
|
893
904
|
kind: "tool",
|
|
894
905
|
name: "search",
|
|
895
906
|
input: ({ request: t, bag: e, context: n }) => {
|
|
896
|
-
const r =
|
|
907
|
+
const r = S(e.consultation);
|
|
897
908
|
return {
|
|
898
909
|
query: r.search_params?.query || v(t),
|
|
899
910
|
facets: r.search_params?.facets || {},
|
|
@@ -906,14 +917,14 @@ var he = qt([{
|
|
|
906
917
|
const n = N(e);
|
|
907
918
|
return { panel: {
|
|
908
919
|
...t.panel,
|
|
909
|
-
screen_sku_list: O(n).map((r) =>
|
|
920
|
+
screen_sku_list: O(n).map((r) => Kt(r)).filter((r) => !!r),
|
|
910
921
|
last_search: { query: n.query || "" }
|
|
911
922
|
} };
|
|
912
923
|
}
|
|
913
924
|
},
|
|
914
925
|
{
|
|
915
926
|
kind: "emit",
|
|
916
|
-
build: ({ bag: t }) =>
|
|
927
|
+
build: ({ bag: t }) => Pt(qt(O(N(t.products))))
|
|
917
928
|
},
|
|
918
929
|
{
|
|
919
930
|
kind: "be_op",
|
|
@@ -927,7 +938,7 @@ var he = qt([{
|
|
|
927
938
|
}),
|
|
928
939
|
out: "answer",
|
|
929
940
|
patch: (t, e) => {
|
|
930
|
-
const n = H(t, e), r = (
|
|
941
|
+
const n = H(t, e), r = (S(e).product_mentions || []).map((o) => o.sku).filter((o) => !!o);
|
|
931
942
|
return {
|
|
932
943
|
...n || {},
|
|
933
944
|
panel: {
|
|
@@ -940,8 +951,8 @@ var he = qt([{
|
|
|
940
951
|
{
|
|
941
952
|
kind: "emit",
|
|
942
953
|
build: ({ bag: t }) => {
|
|
943
|
-
const e =
|
|
944
|
-
return
|
|
954
|
+
const e = S(t.answer);
|
|
955
|
+
return C(B(e), !0, { productMentions: e.product_mentions || [] });
|
|
945
956
|
}
|
|
946
957
|
},
|
|
947
958
|
{ kind: "commit" }
|
|
@@ -949,14 +960,14 @@ var he = qt([{
|
|
|
949
960
|
default: [{
|
|
950
961
|
kind: "emit",
|
|
951
962
|
build: ({ bag: t }) => {
|
|
952
|
-
const e =
|
|
953
|
-
return
|
|
963
|
+
const e = S(t.consultation);
|
|
964
|
+
return C(B(e), !0, { productMentions: e.product_mentions || [] });
|
|
954
965
|
}
|
|
955
966
|
}, { kind: "commit" }]
|
|
956
967
|
}
|
|
957
968
|
}]);
|
|
958
969
|
function H(t, e) {
|
|
959
|
-
const n =
|
|
970
|
+
const n = S(e).consultation_state?.captured_profile;
|
|
960
971
|
if (!n) return null;
|
|
961
972
|
const r = t.thread.extensions.beauty_profile && typeof t.thread.extensions.beauty_profile == "object" ? t.thread.extensions.beauty_profile : {};
|
|
962
973
|
return { thread: {
|
|
@@ -973,17 +984,17 @@ function H(t, e) {
|
|
|
973
984
|
function O(t) {
|
|
974
985
|
return Array.isArray(t?.products) ? t.products : [];
|
|
975
986
|
}
|
|
976
|
-
function
|
|
987
|
+
function Kt(t) {
|
|
977
988
|
if (t && typeof t == "object" && "sku" in t) {
|
|
978
989
|
const e = t.sku;
|
|
979
990
|
if (typeof e == "string") return e;
|
|
980
991
|
}
|
|
981
992
|
}
|
|
982
|
-
function
|
|
993
|
+
function Ht(t) {
|
|
983
994
|
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;
|
|
984
995
|
return Array.isArray(r) ? ot(r.slice(0, 12)) : void 0;
|
|
985
996
|
}
|
|
986
|
-
function
|
|
997
|
+
function B(t) {
|
|
987
998
|
return t?.answer_html || t?.plain_text || t?.refusal?.message || "I can help with beauty shopping.";
|
|
988
999
|
}
|
|
989
1000
|
var W = /* @__PURE__ */ new Set([
|
|
@@ -996,7 +1007,7 @@ var W = /* @__PURE__ */ new Set([
|
|
|
996
1007
|
"gifts",
|
|
997
1008
|
"the",
|
|
998
1009
|
"with"
|
|
999
|
-
]),
|
|
1010
|
+
]), Wt = {
|
|
1000
1011
|
token: 0.26,
|
|
1001
1012
|
keyword: 0.22,
|
|
1002
1013
|
category: 0.18,
|
|
@@ -1005,7 +1016,7 @@ var W = /* @__PURE__ */ new Set([
|
|
|
1005
1016
|
attribute: 0.06,
|
|
1006
1017
|
price: 0.08,
|
|
1007
1018
|
retrieval: 0.08
|
|
1008
|
-
},
|
|
1019
|
+
}, Vt = [
|
|
1009
1020
|
"amber",
|
|
1010
1021
|
"beige",
|
|
1011
1022
|
"black",
|
|
@@ -1029,18 +1040,18 @@ var W = /* @__PURE__ */ new Set([
|
|
|
1029
1040
|
"white",
|
|
1030
1041
|
"yellow"
|
|
1031
1042
|
];
|
|
1032
|
-
function
|
|
1043
|
+
function x(t) {
|
|
1033
1044
|
return String(t ?? "").normalize("NFKD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1034
1045
|
}
|
|
1035
1046
|
function k(t, e = W) {
|
|
1036
1047
|
const n = e instanceof Set ? e : /* @__PURE__ */ new Set([...W, ...e]), r = /* @__PURE__ */ new Set(), o = [];
|
|
1037
|
-
for (const i of
|
|
1048
|
+
for (const i of x(t).split(/\s+/u))
|
|
1038
1049
|
i.length < 3 || n.has(i) || r.has(i) || (r.add(i), o.push(i));
|
|
1039
1050
|
return o;
|
|
1040
1051
|
}
|
|
1041
|
-
function
|
|
1042
|
-
if (
|
|
1043
|
-
const n = e.facetKeys, r = y(t.category_names ?? t.category), o = y(t.category_ids), i =
|
|
1052
|
+
function M(t, e = {}) {
|
|
1053
|
+
if (Qt(t)) return t;
|
|
1054
|
+
const n = e.facetKeys, r = y(t.category_names ?? t.category), o = y(t.category_ids), i = Yt(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 = [
|
|
1044
1055
|
s,
|
|
1045
1056
|
c,
|
|
1046
1057
|
...r,
|
|
@@ -1048,23 +1059,23 @@ function C(t, e = {}) {
|
|
|
1048
1059
|
...y(t.promotions),
|
|
1049
1060
|
w(t.description),
|
|
1050
1061
|
...u
|
|
1051
|
-
].join(" "), d = k(l, e.stopWords),
|
|
1062
|
+
].join(" "), d = k(l, e.stopWords), m = w(e.sourceProductType, te(r, s, d), d[0]), p = b([...Zt(l, Vt), ...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);
|
|
1052
1063
|
return {
|
|
1053
1064
|
sku: w(t.sku),
|
|
1054
1065
|
title: s,
|
|
1055
1066
|
brand: c,
|
|
1056
|
-
productType:
|
|
1067
|
+
productType: m,
|
|
1057
1068
|
categoryNames: r,
|
|
1058
1069
|
categoryIds: o,
|
|
1059
1070
|
facets: i,
|
|
1060
1071
|
keywords: b([...u.flatMap((f) => k(f, e.stopWords)), ...d]).slice(0, 12),
|
|
1061
1072
|
tokens: d,
|
|
1062
|
-
colors:
|
|
1063
|
-
attributes:
|
|
1064
|
-
price:
|
|
1073
|
+
colors: p,
|
|
1074
|
+
attributes: g,
|
|
1075
|
+
price: Xt(t)
|
|
1065
1076
|
};
|
|
1066
1077
|
}
|
|
1067
|
-
function
|
|
1078
|
+
function we(t, e = {}) {
|
|
1068
1079
|
const n = w(t.product_type, t.productType), r = w(t.title, n, y(t.keywords).join(" ")), o = b([
|
|
1069
1080
|
...y(t.keywords),
|
|
1070
1081
|
...y(t.colors),
|
|
@@ -1072,7 +1083,7 @@ function ke(t, e = {}) {
|
|
|
1072
1083
|
...y(t.styles),
|
|
1073
1084
|
...y(t.attributes)
|
|
1074
1085
|
]);
|
|
1075
|
-
return
|
|
1086
|
+
return M({
|
|
1076
1087
|
sku: "__photo__",
|
|
1077
1088
|
name: r,
|
|
1078
1089
|
category_names: n ? [n] : [],
|
|
@@ -1089,38 +1100,38 @@ function ke(t, e = {}) {
|
|
|
1089
1100
|
sourceKeywords: o
|
|
1090
1101
|
});
|
|
1091
1102
|
}
|
|
1092
|
-
function
|
|
1093
|
-
const n =
|
|
1103
|
+
function be(t, e = {}) {
|
|
1104
|
+
const n = M(t, e);
|
|
1094
1105
|
return b([
|
|
1095
1106
|
...e.sourceQueries ?? [],
|
|
1096
|
-
|
|
1107
|
+
P([
|
|
1097
1108
|
n.productType,
|
|
1098
1109
|
...n.colors.slice(0, 1),
|
|
1099
1110
|
...n.attributes.slice(0, 2)
|
|
1100
1111
|
]),
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1112
|
+
P([n.productType, ...n.keywords.slice(0, 3)]),
|
|
1113
|
+
P([n.categoryNames[n.categoryNames.length - 1], ...n.keywords.slice(0, 2)]),
|
|
1114
|
+
P(n.title.split(/\s+/u).slice(0, 6)),
|
|
1104
1115
|
n.productType
|
|
1105
1116
|
].map((r) => r.trim()).filter(Boolean)).slice(0, e.queryLimit ?? 6);
|
|
1106
1117
|
}
|
|
1107
|
-
function
|
|
1118
|
+
function Gt(t, e, n = {}) {
|
|
1108
1119
|
const r = {
|
|
1109
|
-
...
|
|
1120
|
+
...Wt,
|
|
1110
1121
|
...n.weights
|
|
1111
|
-
}, o =
|
|
1112
|
-
return
|
|
1113
|
-
score: Number(
|
|
1122
|
+
}, o = M(e, n), i = [], a = A(t.tokens, o.tokens), s = A(t.keywords, o.tokens), c = ee(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 = ne(t.price, o.price), p = re(o.sku, n.hitCounts) > 0 ? 1 : 0, g = oe(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, _ = ie(g ? f : f * 0.35);
|
|
1123
|
+
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"), {
|
|
1124
|
+
score: Number(_.toFixed(4)),
|
|
1114
1125
|
reasons: i
|
|
1115
1126
|
};
|
|
1116
1127
|
}
|
|
1117
|
-
function
|
|
1118
|
-
const r =
|
|
1128
|
+
function _e(t, e, n = {}) {
|
|
1129
|
+
const r = M(t, n), o = new Set([r.sku, ...n.ignoreSkus ?? []].filter(Boolean));
|
|
1119
1130
|
return e.filter((i) => {
|
|
1120
1131
|
const a = w(i.sku);
|
|
1121
1132
|
return a && !o.has(a);
|
|
1122
1133
|
}).map((i) => {
|
|
1123
|
-
const a =
|
|
1134
|
+
const a = Gt(r, i, n);
|
|
1124
1135
|
return {
|
|
1125
1136
|
...i,
|
|
1126
1137
|
similarity_score: a.score,
|
|
@@ -1128,7 +1139,7 @@ function be(t, e, n = {}) {
|
|
|
1128
1139
|
};
|
|
1129
1140
|
}).sort((i, a) => a.similarity_score - i.similarity_score).slice(0, Math.max(1, Math.min(n.limit ?? 12, 100)));
|
|
1130
1141
|
}
|
|
1131
|
-
function
|
|
1142
|
+
function Qt(t) {
|
|
1132
1143
|
return !!(t && typeof t == "object" && Array.isArray(t.tokens));
|
|
1133
1144
|
}
|
|
1134
1145
|
function w(...t) {
|
|
@@ -1138,10 +1149,10 @@ function w(...t) {
|
|
|
1138
1149
|
function y(t) {
|
|
1139
1150
|
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) : [];
|
|
1140
1151
|
}
|
|
1141
|
-
function
|
|
1152
|
+
function Yt(t) {
|
|
1142
1153
|
return !t || typeof t != "object" || Array.isArray(t) ? {} : Object.fromEntries(Object.entries(t).map(([e, n]) => [e, w(n)]).filter(([, e]) => e));
|
|
1143
1154
|
}
|
|
1144
|
-
function
|
|
1155
|
+
function Xt(t) {
|
|
1145
1156
|
const e = Number(t.price_discounted);
|
|
1146
1157
|
if (Number.isFinite(e) && e > 0) return e;
|
|
1147
1158
|
const n = Number(t.price);
|
|
@@ -1150,89 +1161,89 @@ function Yt(t) {
|
|
|
1150
1161
|
function b(t) {
|
|
1151
1162
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
1152
1163
|
for (const r of t) {
|
|
1153
|
-
const o =
|
|
1164
|
+
const o = x(r);
|
|
1154
1165
|
!o || e.has(o) || (e.add(o), n.push(o));
|
|
1155
1166
|
}
|
|
1156
1167
|
return n;
|
|
1157
1168
|
}
|
|
1158
|
-
function
|
|
1159
|
-
const n = ` ${
|
|
1160
|
-
return e.filter((r) => n.includes(` ${
|
|
1169
|
+
function Zt(t, e) {
|
|
1170
|
+
const n = ` ${x(t)} `;
|
|
1171
|
+
return e.filter((r) => n.includes(` ${x(r)} `));
|
|
1161
1172
|
}
|
|
1162
|
-
function
|
|
1163
|
-
const r =
|
|
1173
|
+
function te(t, e, n) {
|
|
1174
|
+
const r = x(t[t.length - 1] ?? t[0] ?? "");
|
|
1164
1175
|
if (r) {
|
|
1165
1176
|
const o = k(r), i = new Set(k(e));
|
|
1166
1177
|
return o.find((a) => i.has(a)) ?? o[0] ?? r;
|
|
1167
1178
|
}
|
|
1168
1179
|
return n[0] ?? "";
|
|
1169
1180
|
}
|
|
1170
|
-
function
|
|
1171
|
-
return t.map((e) =>
|
|
1181
|
+
function P(t) {
|
|
1182
|
+
return t.map((e) => x(e)).filter(Boolean).join(" ").replace(/\s+/gu, " ").trim().slice(0, 120);
|
|
1172
1183
|
}
|
|
1173
1184
|
function V(t) {
|
|
1174
1185
|
return t.flatMap((e) => k(e));
|
|
1175
1186
|
}
|
|
1176
|
-
function
|
|
1187
|
+
function A(t, e) {
|
|
1177
1188
|
const n = b(t), r = new Set(b(e));
|
|
1178
1189
|
return n.length === 0 || r.size === 0 ? 0 : n.filter((o) => r.has(o)).length / n.length;
|
|
1179
1190
|
}
|
|
1180
|
-
function
|
|
1191
|
+
function ee(t, e) {
|
|
1181
1192
|
const n = b(t), r = new Set(b(e));
|
|
1182
1193
|
return n.length === 0 || r.size === 0 ? 0 : n.filter((o) => r.has(o)).length / n.length;
|
|
1183
1194
|
}
|
|
1184
|
-
function
|
|
1195
|
+
function ne(t, e) {
|
|
1185
1196
|
return t <= 0 || e <= 0 ? 0 : Math.min(t, e) / Math.max(t, e);
|
|
1186
1197
|
}
|
|
1187
|
-
function
|
|
1198
|
+
function re(t, e) {
|
|
1188
1199
|
return !t || !e ? 0 : typeof e.get == "function" ? e.get(t) ?? 0 : e[t] ?? 0;
|
|
1189
1200
|
}
|
|
1190
|
-
function
|
|
1201
|
+
function oe(t, e) {
|
|
1191
1202
|
if (!t.productType || !e.productType || t.productType === e.productType) return !0;
|
|
1192
1203
|
const n = new Set(k(t.productType)), r = /* @__PURE__ */ new Set([...k(e.productType), ...e.tokens]);
|
|
1193
1204
|
return [...n].some((o) => r.has(o));
|
|
1194
1205
|
}
|
|
1195
|
-
function
|
|
1206
|
+
function ie(t) {
|
|
1196
1207
|
return Math.max(0, Math.min(1, t));
|
|
1197
1208
|
}
|
|
1198
1209
|
export {
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1210
|
+
ue as A,
|
|
1211
|
+
Ct as C,
|
|
1212
|
+
le as D,
|
|
1213
|
+
Pt as E,
|
|
1214
|
+
R as F,
|
|
1204
1215
|
ft as I,
|
|
1205
|
-
|
|
1216
|
+
ae as L,
|
|
1206
1217
|
bt as M,
|
|
1207
1218
|
wt as N,
|
|
1208
1219
|
Z as O,
|
|
1209
|
-
|
|
1210
|
-
|
|
1220
|
+
ce as P,
|
|
1221
|
+
se as R,
|
|
1211
1222
|
et as S,
|
|
1212
|
-
|
|
1223
|
+
C as T,
|
|
1213
1224
|
ot as _,
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1225
|
+
_e as a,
|
|
1226
|
+
Mt as b,
|
|
1227
|
+
ke as c,
|
|
1228
|
+
he as d,
|
|
1229
|
+
ge as f,
|
|
1230
|
+
Lt as g,
|
|
1220
1231
|
D as h,
|
|
1221
|
-
|
|
1232
|
+
x as i,
|
|
1222
1233
|
Tt as j,
|
|
1223
1234
|
tt as k,
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1235
|
+
Jt as l,
|
|
1236
|
+
qt as m,
|
|
1237
|
+
M as n,
|
|
1238
|
+
Gt as o,
|
|
1239
|
+
ye as p,
|
|
1240
|
+
be as r,
|
|
1230
1241
|
k as s,
|
|
1231
|
-
|
|
1242
|
+
we as t,
|
|
1232
1243
|
v as u,
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1244
|
+
me as v,
|
|
1245
|
+
de as w,
|
|
1246
|
+
fe as x,
|
|
1247
|
+
pe as y,
|
|
1237
1248
|
dt as z
|
|
1238
1249
|
};
|