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