@fencyai/react 0.1.163 → 0.1.165
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/agent-task/data-types/MemoryChatChunkResult.d.ts.map +1 -1
- package/dist/hooks/useAgentTasks/index.d.ts.map +1 -1
- package/dist/index.js +459 -399
- package/dist/provider/FencyProvider.d.ts.map +1 -1
- package/dist/provider/StreamEventManager.d.ts +1 -1
- package/dist/provider/StreamEventManager.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createStream as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { useInView as
|
|
5
|
-
import
|
|
6
|
-
import { Prism as
|
|
1
|
+
import { jsxs as p, jsx as i, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { createStream as ae, isStreamTimeoutEvent as se, isStreamNotFoundEvent as le, isAgentTaskProgressItemUpdatedEvent as ce, createAgentTask as de } from "@fencyai/js";
|
|
3
|
+
import { createContext as me, useState as v, useRef as F, useEffect as A, useCallback as G, useContext as ue, useMemo as D } from "react";
|
|
4
|
+
import { useInView as ye, motion as b, AnimatePresence as J } from "motion/react";
|
|
5
|
+
import pe from "react-markdown";
|
|
6
|
+
import { Prism as Y } from "react-syntax-highlighter";
|
|
7
7
|
import ge from "remark-gfm";
|
|
8
|
-
import './assets/index.css';const
|
|
8
|
+
import './assets/index.css';const Z = me(
|
|
9
9
|
void 0
|
|
10
10
|
);
|
|
11
|
-
async function
|
|
11
|
+
async function he(e, r) {
|
|
12
12
|
const t = e.getReader();
|
|
13
13
|
let n;
|
|
14
14
|
for (; !(n = await t.read()).done; )
|
|
15
15
|
r(n.value);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function fe(e) {
|
|
18
18
|
let r, t, n, l = !1;
|
|
19
19
|
return function(s) {
|
|
20
|
-
r === void 0 ? (r = s, t = 0, n = -1) : r =
|
|
20
|
+
r === void 0 ? (r = s, t = 0, n = -1) : r = xe(r, s);
|
|
21
21
|
const d = r.length;
|
|
22
22
|
let m = 0;
|
|
23
23
|
for (; t < d; ) {
|
|
@@ -41,12 +41,12 @@ function he(e) {
|
|
|
41
41
|
m === d ? r = void 0 : m !== 0 && (r = r.subarray(m), t -= m);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
let n =
|
|
44
|
+
function Se(e, r, t) {
|
|
45
|
+
let n = j();
|
|
46
46
|
const l = new TextDecoder();
|
|
47
47
|
return function(s, d) {
|
|
48
48
|
if (s.length === 0)
|
|
49
|
-
t == null || t(n), n =
|
|
49
|
+
t == null || t(n), n = j();
|
|
50
50
|
else if (d > 0) {
|
|
51
51
|
const m = l.decode(s.subarray(0, d)), o = d + (s[d + 1] === 32 ? 2 : 1), a = l.decode(s.subarray(o));
|
|
52
52
|
switch (m) {
|
|
@@ -68,11 +68,11 @@ function fe(e, r, t) {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function xe(e, r) {
|
|
72
72
|
const t = new Uint8Array(e.length + r.length);
|
|
73
73
|
return t.set(e), t.set(r, e.length), t;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function j() {
|
|
76
76
|
return {
|
|
77
77
|
data: "",
|
|
78
78
|
event: "",
|
|
@@ -80,7 +80,7 @@ function q() {
|
|
|
80
80
|
retry: void 0
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
var
|
|
83
|
+
var Te = function(e, r) {
|
|
84
84
|
var t = {};
|
|
85
85
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
|
|
86
86
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -88,60 +88,63 @@ var xe = function(e, r) {
|
|
|
88
88
|
r.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[l]) && (t[n[l]] = e[n[l]]);
|
|
89
89
|
return t;
|
|
90
90
|
};
|
|
91
|
-
const _ = "text/event-stream",
|
|
92
|
-
function
|
|
93
|
-
var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: o } = r, a =
|
|
94
|
-
return new Promise((u,
|
|
91
|
+
const _ = "text/event-stream", ke = 1e3, q = "last-event-id";
|
|
92
|
+
function be(e, r) {
|
|
93
|
+
var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: o } = r, a = Te(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
94
|
+
return new Promise((u, y) => {
|
|
95
95
|
const f = Object.assign({}, n);
|
|
96
96
|
f.accept || (f.accept = _);
|
|
97
|
-
let
|
|
98
|
-
function
|
|
99
|
-
|
|
97
|
+
let g;
|
|
98
|
+
function x() {
|
|
99
|
+
g.abort(), document.hidden || R();
|
|
100
100
|
}
|
|
101
|
-
m || document.addEventListener("visibilitychange",
|
|
102
|
-
let h =
|
|
101
|
+
m || document.addEventListener("visibilitychange", x);
|
|
102
|
+
let h = ke, S = 0;
|
|
103
103
|
function k() {
|
|
104
|
-
document.removeEventListener("visibilitychange",
|
|
104
|
+
document.removeEventListener("visibilitychange", x), window.clearTimeout(S), g.abort();
|
|
105
105
|
}
|
|
106
106
|
t == null || t.addEventListener("abort", () => {
|
|
107
107
|
k(), u();
|
|
108
108
|
});
|
|
109
|
-
const
|
|
109
|
+
const w = o ?? window.fetch, C = l ?? ve;
|
|
110
110
|
async function R() {
|
|
111
111
|
var L;
|
|
112
|
-
|
|
112
|
+
g = new AbortController();
|
|
113
113
|
try {
|
|
114
|
-
const P = await
|
|
115
|
-
await
|
|
116
|
-
M ? f[
|
|
114
|
+
const P = await w(e, Object.assign(Object.assign({}, a), { headers: f, signal: g.signal }));
|
|
115
|
+
await C(P), await he(P.body, fe(Se((M) => {
|
|
116
|
+
M ? f[q] = M : delete f[q];
|
|
117
117
|
}, (M) => {
|
|
118
118
|
h = M;
|
|
119
119
|
}, c))), s == null || s(), k(), u();
|
|
120
120
|
} catch (P) {
|
|
121
|
-
if (!
|
|
121
|
+
if (!g.signal.aborted)
|
|
122
122
|
try {
|
|
123
123
|
const M = (L = d == null ? void 0 : d(P)) !== null && L !== void 0 ? L : h;
|
|
124
|
-
window.clearTimeout(
|
|
124
|
+
window.clearTimeout(S), S = window.setTimeout(R, M);
|
|
125
125
|
} catch (M) {
|
|
126
|
-
k(),
|
|
126
|
+
k(), y(M);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
R();
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function ve(e) {
|
|
134
134
|
const r = e.headers.get("content-type");
|
|
135
135
|
if (!(r != null && r.startsWith(_)))
|
|
136
136
|
throw new Error(`Expected content-type to be ${_}, Actual: ${r}`);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function we(e) {
|
|
139
139
|
const r = atob(e), t = new Uint8Array(r.length);
|
|
140
140
|
for (let n = 0; n < r.length; n++)
|
|
141
141
|
t[n] = r.charCodeAt(n);
|
|
142
142
|
return new TextDecoder("utf-8").decode(t);
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
function Ce(e) {
|
|
145
|
+
return e instanceof Error ? e.message : typeof e == "string" ? e : "Unknown stream error";
|
|
146
|
+
}
|
|
147
|
+
class Ee {
|
|
145
148
|
constructor(r) {
|
|
146
149
|
this.eventSources = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.fency = r;
|
|
147
150
|
}
|
|
@@ -166,21 +169,21 @@ class Ce {
|
|
|
166
169
|
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
167
170
|
"X-Fency-Stream-Token": r.stream.token
|
|
168
171
|
};
|
|
169
|
-
|
|
172
|
+
be(l, {
|
|
170
173
|
headers: c,
|
|
171
174
|
signal: n.signal,
|
|
172
|
-
async
|
|
175
|
+
onopen: async (s) => {
|
|
173
176
|
if (!s.ok && s.status >= 400 && s.status < 500 && s.status !== 429)
|
|
174
|
-
throw new Error(`Client error ${s.status}`);
|
|
177
|
+
throw this.eventSources.delete(t), new Error(`Client error ${s.status}`);
|
|
175
178
|
},
|
|
176
179
|
onmessage: (s) => {
|
|
177
180
|
if (s.data) {
|
|
178
|
-
const d =
|
|
181
|
+
const d = we(s.data);
|
|
179
182
|
this.broadcast(d, t);
|
|
180
183
|
}
|
|
181
184
|
},
|
|
182
185
|
onerror: (s) => {
|
|
183
|
-
throw console.error("EventSource error for stream", t, ":", s), this.broadcastError(t), s;
|
|
186
|
+
throw console.error("EventSource error for stream", t, ":", s), this.eventSources.delete(t), this.broadcastError(t, Ce(s)), s;
|
|
184
187
|
},
|
|
185
188
|
onclose() {
|
|
186
189
|
}
|
|
@@ -200,9 +203,9 @@ class Ce {
|
|
|
200
203
|
n.onMessage(r, t);
|
|
201
204
|
});
|
|
202
205
|
}
|
|
203
|
-
broadcastError(r) {
|
|
204
|
-
this.subscribers.forEach((
|
|
205
|
-
|
|
206
|
+
broadcastError(r, t) {
|
|
207
|
+
this.subscribers.forEach((n) => {
|
|
208
|
+
n.onError(r, t);
|
|
206
209
|
});
|
|
207
210
|
}
|
|
208
211
|
/**
|
|
@@ -212,14 +215,14 @@ class Ce {
|
|
|
212
215
|
this.eventSources.forEach((r) => r.abort()), this.eventSources.clear(), this.subscribers.clear();
|
|
213
216
|
}
|
|
214
217
|
}
|
|
215
|
-
const
|
|
218
|
+
const Ie = 48e4, Me = 3e5, K = (e) => {
|
|
216
219
|
const r = Date.now();
|
|
217
|
-
return e.filter((t) => r - t.createdAt <
|
|
220
|
+
return e.filter((t) => r - t.createdAt < Ie);
|
|
218
221
|
};
|
|
219
|
-
function
|
|
222
|
+
function Ar({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
|
|
220
223
|
const [n, l] = v(
|
|
221
224
|
null
|
|
222
|
-
), [c, s] = v(!0), [d, m] = v(null), [o, a] = v([]), u = F(null),
|
|
225
|
+
), [c, s] = v(!0), [d, m] = v(null), [o, a] = v([]), u = F(null), y = F(null);
|
|
223
226
|
A(() => {
|
|
224
227
|
e.then((h) => {
|
|
225
228
|
l(h), s(!1);
|
|
@@ -227,27 +230,35 @@ function Ir({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
|
|
|
227
230
|
m(h), s(!1);
|
|
228
231
|
});
|
|
229
232
|
}, [e]), A(() => {
|
|
230
|
-
n && !
|
|
233
|
+
n && !y.current && (y.current = new Ee(n));
|
|
231
234
|
}, [n]), A(() => {
|
|
232
|
-
|
|
235
|
+
y.current && y.current.updateStreams(o);
|
|
233
236
|
}, [o]), A(() => () => {
|
|
234
237
|
var h;
|
|
235
|
-
(h =
|
|
238
|
+
(h = y.current) == null || h.cleanup();
|
|
239
|
+
}, []), A(() => {
|
|
240
|
+
const h = setInterval(() => {
|
|
241
|
+
a((S) => {
|
|
242
|
+
const k = K(S);
|
|
243
|
+
return k.length !== S.length ? k : S;
|
|
244
|
+
});
|
|
245
|
+
}, 6e4);
|
|
246
|
+
return () => clearInterval(h);
|
|
236
247
|
}, []);
|
|
237
248
|
const f = G(
|
|
238
|
-
async (h =
|
|
249
|
+
async (h = Me) => {
|
|
239
250
|
if (u.current)
|
|
240
251
|
return u.current;
|
|
241
|
-
const
|
|
242
|
-
if (k &&
|
|
252
|
+
const S = Date.now(), k = o.length > 0 ? o[o.length - 1] : null;
|
|
253
|
+
if (k && S - k.createdAt < h)
|
|
243
254
|
return k.stream;
|
|
244
|
-
const
|
|
255
|
+
const w = (async () => {
|
|
245
256
|
if (!n)
|
|
246
257
|
throw new Error("Fency instance not initialized");
|
|
247
|
-
const
|
|
258
|
+
const C = await r(), R = await ae({
|
|
248
259
|
pk: n.publishableKey,
|
|
249
260
|
baseUrl: n.baseUrl,
|
|
250
|
-
clientToken: (
|
|
261
|
+
clientToken: (C == null ? void 0 : C.clientToken) ?? ""
|
|
251
262
|
});
|
|
252
263
|
if (R.type === "success") {
|
|
253
264
|
const L = {
|
|
@@ -256,55 +267,55 @@ function Ir({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
|
|
|
256
267
|
};
|
|
257
268
|
return a((P) => {
|
|
258
269
|
const M = [...P, L];
|
|
259
|
-
return
|
|
270
|
+
return K(M);
|
|
260
271
|
}), u.current = null, R.stream;
|
|
261
272
|
} else
|
|
262
273
|
throw u.current = null, new Error("Failed to create stream");
|
|
263
274
|
})();
|
|
264
|
-
return u.current =
|
|
275
|
+
return u.current = w, w;
|
|
265
276
|
},
|
|
266
277
|
[n, o]
|
|
267
278
|
);
|
|
268
279
|
if (d)
|
|
269
|
-
return /* @__PURE__ */
|
|
280
|
+
return /* @__PURE__ */ p("div", { children: [
|
|
270
281
|
"Fency error: ",
|
|
271
282
|
d.message
|
|
272
283
|
] });
|
|
273
284
|
if (!n)
|
|
274
285
|
return null;
|
|
275
|
-
const
|
|
286
|
+
const g = o.length > 0 ? o[o.length - 1] : null, x = {
|
|
276
287
|
fency: n,
|
|
277
288
|
loading: c,
|
|
278
289
|
error: d,
|
|
279
290
|
activeStreams: o,
|
|
280
|
-
latestStream:
|
|
281
|
-
eventManager:
|
|
291
|
+
latestStream: g,
|
|
292
|
+
eventManager: y.current,
|
|
282
293
|
getOrCreateStream: f
|
|
283
294
|
};
|
|
284
|
-
return /* @__PURE__ */ i(
|
|
295
|
+
return /* @__PURE__ */ i(Z.Provider, { value: x, children: t });
|
|
285
296
|
}
|
|
286
|
-
function
|
|
287
|
-
const e =
|
|
297
|
+
function ee() {
|
|
298
|
+
const e = ue(Z);
|
|
288
299
|
if (e === void 0)
|
|
289
300
|
throw new Error("useFencyContext must be used within a FencyProvider");
|
|
290
301
|
return e;
|
|
291
302
|
}
|
|
292
|
-
const
|
|
303
|
+
const Ae = (e) => {
|
|
293
304
|
try {
|
|
294
305
|
const r = JSON.parse(e);
|
|
295
|
-
return
|
|
306
|
+
return Fe(r);
|
|
296
307
|
} catch (r) {
|
|
297
308
|
return console.error("Error parsing message:", r), null;
|
|
298
309
|
}
|
|
299
|
-
},
|
|
310
|
+
}, Fe = (e) => se(e) ? Re(e) : le(e) ? Pe(e) : ce(e) ? De(e) : null, Re = (e) => ({
|
|
300
311
|
type: "STREAM_TIMEOUT",
|
|
301
312
|
streamId: e.streamId,
|
|
302
313
|
timestamp: e.timestamp
|
|
303
|
-
}),
|
|
314
|
+
}), Pe = (e) => ({
|
|
304
315
|
type: "STREAM_NOT_FOUND",
|
|
305
316
|
streamId: e.streamId,
|
|
306
317
|
timestamp: e.timestamp
|
|
307
|
-
}),
|
|
318
|
+
}), De = (e) => ({
|
|
308
319
|
type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
|
|
309
320
|
streamId: e.streamId,
|
|
310
321
|
agentTaskId: e.agentTaskId,
|
|
@@ -312,34 +323,34 @@ const Ie = (e) => {
|
|
|
312
323
|
timestamp: e.timestamp,
|
|
313
324
|
createdAt: e.createdAt,
|
|
314
325
|
data: JSON.parse(e.data)
|
|
315
|
-
}),
|
|
316
|
-
const r =
|
|
326
|
+
}), Le = (e) => {
|
|
327
|
+
const r = ee(), [t, n] = v(null), l = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
|
|
317
328
|
return A(() => {
|
|
318
329
|
if (!r.eventManager) return;
|
|
319
330
|
const s = {
|
|
320
331
|
onMessage: (m, o) => {
|
|
321
|
-
var u,
|
|
322
|
-
const a =
|
|
332
|
+
var u, y, f;
|
|
333
|
+
const a = Ae(m);
|
|
323
334
|
if (a)
|
|
324
335
|
switch (a.type) {
|
|
325
336
|
case "STREAM_TIMEOUT":
|
|
326
337
|
(u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, a);
|
|
327
338
|
break;
|
|
328
339
|
case "STREAM_NOT_FOUND":
|
|
329
|
-
(
|
|
340
|
+
(y = e == null ? void 0 : e.onStreamNotFound) == null || y.call(e, a);
|
|
330
341
|
break;
|
|
331
342
|
case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
|
|
332
343
|
(f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, a);
|
|
333
344
|
break;
|
|
334
345
|
}
|
|
335
346
|
},
|
|
336
|
-
onError: (m) => {
|
|
337
|
-
var
|
|
338
|
-
(
|
|
347
|
+
onError: (m, o) => {
|
|
348
|
+
var a;
|
|
349
|
+
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, {
|
|
339
350
|
streamId: m,
|
|
340
351
|
error: {
|
|
341
352
|
code: "UnknownError",
|
|
342
|
-
message: "Unknown error in useStream"
|
|
353
|
+
message: o ?? "Unknown error in useStream"
|
|
343
354
|
}
|
|
344
355
|
});
|
|
345
356
|
}
|
|
@@ -351,7 +362,7 @@ const Ie = (e) => {
|
|
|
351
362
|
}, [r.eventManager, e]), {
|
|
352
363
|
createStream: async () => {
|
|
353
364
|
try {
|
|
354
|
-
const s = await r.getOrCreateStream(
|
|
365
|
+
const s = await r.getOrCreateStream();
|
|
355
366
|
return n(s), {
|
|
356
367
|
type: "success",
|
|
357
368
|
stream: s
|
|
@@ -368,69 +379,61 @@ const Ie = (e) => {
|
|
|
368
379
|
},
|
|
369
380
|
stream: t
|
|
370
381
|
};
|
|
371
|
-
},
|
|
372
|
-
const r =
|
|
382
|
+
}, Fr = (e) => {
|
|
383
|
+
const r = ee(), [t, n] = v([]), l = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), { createStream: s } = Le({
|
|
373
384
|
onAgentTaskProgressItemUpdated: (o) => {
|
|
374
|
-
var
|
|
385
|
+
var y;
|
|
375
386
|
if (!l.current.has(o.agentTaskId)) return;
|
|
376
387
|
const a = o.data;
|
|
377
388
|
if (a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed" || a.taskType === "MemoryChat" && a.eventType === "Completed" || a.taskType === "MemorySearch" && a.eventType === "Completed") {
|
|
378
389
|
const f = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
|
|
379
390
|
n(
|
|
380
|
-
f ? (
|
|
381
|
-
var
|
|
382
|
-
if (((
|
|
391
|
+
f ? (x) => x.map((h) => {
|
|
392
|
+
var w;
|
|
393
|
+
if (((w = h.confirmedData) == null ? void 0 : w.taskId) !== o.agentTaskId)
|
|
383
394
|
return h;
|
|
384
395
|
const k = h.progressItems.some(
|
|
385
|
-
(
|
|
396
|
+
(C) => C.progressItemId === o.progressItemId
|
|
386
397
|
) ? h.progressItems.map(
|
|
387
|
-
(
|
|
398
|
+
(C) => C.progressItemId === o.progressItemId ? o : C
|
|
388
399
|
) : [...h.progressItems, o];
|
|
389
400
|
return {
|
|
390
401
|
...h,
|
|
391
402
|
progressItems: k,
|
|
392
403
|
loading: !1
|
|
393
404
|
};
|
|
394
|
-
}) : (
|
|
405
|
+
}) : (x) => x.map(
|
|
395
406
|
(h) => {
|
|
396
|
-
var
|
|
397
|
-
return ((
|
|
407
|
+
var S;
|
|
408
|
+
return ((S = h.confirmedData) == null ? void 0 : S.taskId) === o.agentTaskId ? { ...h, loading: !1 } : h;
|
|
398
409
|
}
|
|
399
410
|
)
|
|
400
411
|
);
|
|
401
|
-
const
|
|
412
|
+
const g = c.current.get(
|
|
402
413
|
o.agentTaskId
|
|
403
414
|
);
|
|
404
|
-
|
|
415
|
+
g && (c.current.delete(o.agentTaskId), g(a));
|
|
405
416
|
return;
|
|
406
417
|
}
|
|
407
|
-
(
|
|
408
|
-
(f) => f.map((
|
|
409
|
-
var
|
|
410
|
-
if (((
|
|
411
|
-
return
|
|
412
|
-
const h =
|
|
418
|
+
(y = e.onAgentTaskProgressItemUpdated) == null || y.call(e, o), n(
|
|
419
|
+
(f) => f.map((g) => {
|
|
420
|
+
var S;
|
|
421
|
+
if (((S = g.confirmedData) == null ? void 0 : S.taskId) !== o.agentTaskId)
|
|
422
|
+
return g;
|
|
423
|
+
const h = g.progressItems.some(
|
|
413
424
|
(k) => k.progressItemId === o.progressItemId
|
|
414
|
-
) ?
|
|
425
|
+
) ? g.progressItems.map(
|
|
415
426
|
(k) => k.progressItemId === o.progressItemId ? o : k
|
|
416
|
-
) : [...
|
|
417
|
-
return { ...
|
|
427
|
+
) : [...g.progressItems, o];
|
|
428
|
+
return { ...g, progressItems: h };
|
|
418
429
|
})
|
|
419
430
|
);
|
|
420
431
|
},
|
|
421
432
|
onStreamError: (o) => {
|
|
422
433
|
var a;
|
|
423
|
-
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), n(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
...u.filter((f) => f.streamId !== o.streamId),
|
|
427
|
-
{
|
|
428
|
-
...g,
|
|
429
|
-
loading: !1,
|
|
430
|
-
error: o.error
|
|
431
|
-
}
|
|
432
|
-
] : u;
|
|
433
|
-
});
|
|
434
|
+
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), n(
|
|
435
|
+
(u) => u.map((y) => y.streamId !== o.streamId || !y.loading ? y : { ...y, loading: !1, error: o.error })
|
|
436
|
+
);
|
|
434
437
|
},
|
|
435
438
|
onStreamNotFound: (o) => {
|
|
436
439
|
var a;
|
|
@@ -443,12 +446,12 @@ const Ie = (e) => {
|
|
|
443
446
|
}), d = G(
|
|
444
447
|
async (o, a) => {
|
|
445
448
|
var f;
|
|
446
|
-
const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
447
|
-
if (
|
|
448
|
-
const
|
|
449
|
+
const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, y = await s();
|
|
450
|
+
if (y.type === "success") {
|
|
451
|
+
const g = (/* @__PURE__ */ new Date()).toISOString(), x = {
|
|
449
452
|
taskKey: u,
|
|
450
|
-
streamId:
|
|
451
|
-
triggeredAt:
|
|
453
|
+
streamId: y.stream.id,
|
|
454
|
+
triggeredAt: g,
|
|
452
455
|
confirmedData: null,
|
|
453
456
|
error: null,
|
|
454
457
|
params: o,
|
|
@@ -456,12 +459,12 @@ const Ie = (e) => {
|
|
|
456
459
|
loading: !0,
|
|
457
460
|
loadingText: a == null ? void 0 : a.loadingText
|
|
458
461
|
};
|
|
459
|
-
n((k) => [...k,
|
|
460
|
-
const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(o.type),
|
|
462
|
+
n((k) => [...k, x]), (f = a == null ? void 0 : a.onTaskRegistered) == null || f.call(a, x);
|
|
463
|
+
const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(o.type), S = await de({
|
|
461
464
|
pk: r.fency.publishableKey,
|
|
462
465
|
baseUrl: r.fency.baseUrl,
|
|
463
466
|
clientToken: h,
|
|
464
|
-
streamToken:
|
|
467
|
+
streamToken: y.stream.token,
|
|
465
468
|
request: {
|
|
466
469
|
streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
|
|
467
470
|
messages: o.messages,
|
|
@@ -491,50 +494,50 @@ const Ie = (e) => {
|
|
|
491
494
|
} : void 0
|
|
492
495
|
}
|
|
493
496
|
});
|
|
494
|
-
if (
|
|
497
|
+
if (S.type === "success" && S.agentTask) {
|
|
495
498
|
l.current.add(
|
|
496
|
-
|
|
497
|
-
), n((
|
|
498
|
-
...
|
|
499
|
+
S.agentTask.id
|
|
500
|
+
), n((w) => [
|
|
501
|
+
...w.filter((C) => C.taskKey !== u),
|
|
499
502
|
{
|
|
500
503
|
taskKey: u,
|
|
501
|
-
streamId:
|
|
504
|
+
streamId: y.stream.id,
|
|
502
505
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
503
|
-
taskId:
|
|
504
|
-
createdAt:
|
|
506
|
+
taskId: S.agentTask.id,
|
|
507
|
+
createdAt: S.agentTask.createdAt,
|
|
505
508
|
error: null,
|
|
506
509
|
params: o,
|
|
507
510
|
progressItems: [],
|
|
508
511
|
loading: !0,
|
|
509
512
|
loadingText: a == null ? void 0 : a.loadingText,
|
|
510
513
|
confirmedData: {
|
|
511
|
-
taskId:
|
|
512
|
-
createdAt:
|
|
514
|
+
taskId: S.agentTask.id,
|
|
515
|
+
createdAt: S.agentTask.createdAt
|
|
513
516
|
}
|
|
514
517
|
}
|
|
515
518
|
]);
|
|
516
|
-
const k = await new Promise((
|
|
519
|
+
const k = await new Promise((w) => {
|
|
517
520
|
c.current.set(
|
|
518
|
-
|
|
519
|
-
|
|
521
|
+
S.agentTask.id,
|
|
522
|
+
w
|
|
520
523
|
);
|
|
521
524
|
});
|
|
522
525
|
return {
|
|
523
526
|
type: "success",
|
|
524
|
-
streamId:
|
|
525
|
-
agentTaskId:
|
|
527
|
+
streamId: y.stream.id,
|
|
528
|
+
agentTaskId: S.agentTask.id,
|
|
526
529
|
response: k
|
|
527
530
|
};
|
|
528
531
|
} else {
|
|
529
|
-
if (
|
|
532
|
+
if (S.type === "error")
|
|
530
533
|
return n((k) => [
|
|
531
|
-
...k.filter((
|
|
534
|
+
...k.filter((w) => w.taskKey !== u),
|
|
532
535
|
{
|
|
533
536
|
taskKey: u,
|
|
534
537
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
535
|
-
streamId:
|
|
538
|
+
streamId: y.stream.id,
|
|
536
539
|
params: o,
|
|
537
|
-
error:
|
|
540
|
+
error: S.error,
|
|
538
541
|
progressItems: [],
|
|
539
542
|
loading: !1,
|
|
540
543
|
loadingText: a == null ? void 0 : a.loadingText,
|
|
@@ -542,19 +545,19 @@ const Ie = (e) => {
|
|
|
542
545
|
}
|
|
543
546
|
]), {
|
|
544
547
|
type: "error",
|
|
545
|
-
error:
|
|
548
|
+
error: S.error
|
|
546
549
|
};
|
|
547
550
|
{
|
|
548
551
|
const k = {
|
|
549
552
|
message: "No response received",
|
|
550
553
|
code: "UnknownError"
|
|
551
554
|
};
|
|
552
|
-
return n((
|
|
553
|
-
...
|
|
555
|
+
return n((w) => [
|
|
556
|
+
...w.filter((C) => C.taskKey !== u),
|
|
554
557
|
{
|
|
555
558
|
taskKey: u,
|
|
556
559
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
557
|
-
streamId:
|
|
560
|
+
streamId: y.stream.id,
|
|
558
561
|
error: k,
|
|
559
562
|
params: o,
|
|
560
563
|
progressItems: [],
|
|
@@ -569,7 +572,7 @@ const Ie = (e) => {
|
|
|
569
572
|
}
|
|
570
573
|
}
|
|
571
574
|
} else
|
|
572
|
-
return console.error(
|
|
575
|
+
return console.error(y.error), y;
|
|
573
576
|
},
|
|
574
577
|
[r, s, e.fetchCreateAgentTaskClientToken]
|
|
575
578
|
), m = D(() => {
|
|
@@ -584,7 +587,7 @@ const Ie = (e) => {
|
|
|
584
587
|
latest: m
|
|
585
588
|
};
|
|
586
589
|
};
|
|
587
|
-
function
|
|
590
|
+
function ze(e) {
|
|
588
591
|
return e.progressItems.map((r, t) => {
|
|
589
592
|
const n = e.progressItems[t + 1], l = n != null;
|
|
590
593
|
let c;
|
|
@@ -600,7 +603,7 @@ function De(e) {
|
|
|
600
603
|
};
|
|
601
604
|
});
|
|
602
605
|
}
|
|
603
|
-
function
|
|
606
|
+
function E({
|
|
604
607
|
text: e,
|
|
605
608
|
duration: r = 2,
|
|
606
609
|
delay: t = 0,
|
|
@@ -613,9 +616,9 @@ function w({
|
|
|
613
616
|
spread: o = 2,
|
|
614
617
|
color: a = "#999",
|
|
615
618
|
shimmerColor: u = "#000",
|
|
616
|
-
direction:
|
|
619
|
+
direction: y = "fromBottom"
|
|
617
620
|
}) {
|
|
618
|
-
const f = F(null),
|
|
621
|
+
const f = F(null), g = ye(f, { once: d, margin: m }), x = D(() => e.length * o, [e, o]), h = !s || g, S = y === "fromBottom" ? "100% center" : "-100% center", k = y === "fromBottom" ? "0% center" : "200% center";
|
|
619
622
|
return /* @__PURE__ */ i(
|
|
620
623
|
b.span,
|
|
621
624
|
{
|
|
@@ -630,14 +633,14 @@ function w({
|
|
|
630
633
|
color: "transparent",
|
|
631
634
|
WebkitTextFillColor: "transparent",
|
|
632
635
|
backgroundRepeat: "no-repeat, padding-box",
|
|
633
|
-
"--spread": `${
|
|
636
|
+
"--spread": `${x}px`,
|
|
634
637
|
"--base-color": a,
|
|
635
638
|
"--shimmer-color": u,
|
|
636
639
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
637
640
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
638
641
|
},
|
|
639
642
|
initial: {
|
|
640
|
-
backgroundPosition:
|
|
643
|
+
backgroundPosition: S,
|
|
641
644
|
opacity: 0
|
|
642
645
|
},
|
|
643
646
|
animate: h ? {
|
|
@@ -661,7 +664,7 @@ function w({
|
|
|
661
664
|
}
|
|
662
665
|
);
|
|
663
666
|
}
|
|
664
|
-
function
|
|
667
|
+
function Oe(e, r) {
|
|
665
668
|
const t = e.item.data;
|
|
666
669
|
if (t.eventType === "Error" && "message" in t)
|
|
667
670
|
return r.error;
|
|
@@ -705,11 +708,11 @@ function Le(e, r) {
|
|
|
705
708
|
}
|
|
706
709
|
return r.processing;
|
|
707
710
|
}
|
|
708
|
-
const
|
|
711
|
+
const Ne = ({ progressViewItems: e, t: r }) => {
|
|
709
712
|
const t = e[e.length - 1];
|
|
710
713
|
if (!t) return null;
|
|
711
|
-
const n =
|
|
712
|
-
return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(
|
|
714
|
+
const n = Oe(t, r);
|
|
715
|
+
return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(J, { mode: "wait", children: /* @__PURE__ */ i(
|
|
713
716
|
b.div,
|
|
714
717
|
{
|
|
715
718
|
initial: { opacity: 0, y: 10 },
|
|
@@ -724,7 +727,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
724
727
|
children: n
|
|
725
728
|
}
|
|
726
729
|
) : /* @__PURE__ */ i(
|
|
727
|
-
|
|
730
|
+
E,
|
|
728
731
|
{
|
|
729
732
|
text: n,
|
|
730
733
|
className: "simple-mode-title",
|
|
@@ -737,7 +740,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
737
740
|
},
|
|
738
741
|
t.item.progressItemId
|
|
739
742
|
) }) });
|
|
740
|
-
},
|
|
743
|
+
}, re = {
|
|
741
744
|
'code[class*="language-"]': {
|
|
742
745
|
color: "#f8f8f2",
|
|
743
746
|
background: "none",
|
|
@@ -888,7 +891,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
888
891
|
italic: {
|
|
889
892
|
fontStyle: "italic"
|
|
890
893
|
}
|
|
891
|
-
},
|
|
894
|
+
}, V = ({
|
|
892
895
|
text: e
|
|
893
896
|
}) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
894
897
|
b.div,
|
|
@@ -898,7 +901,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
898
901
|
animate: { opacity: 1, y: 0 },
|
|
899
902
|
transition: { duration: 0.3, delay: 0 },
|
|
900
903
|
children: /* @__PURE__ */ i(
|
|
901
|
-
|
|
904
|
+
pe,
|
|
902
905
|
{
|
|
903
906
|
remarkPlugins: [ge],
|
|
904
907
|
components: {
|
|
@@ -907,13 +910,13 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
907
910
|
return d ? (
|
|
908
911
|
// @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
|
|
909
912
|
/* @__PURE__ */ i(
|
|
910
|
-
|
|
913
|
+
Y,
|
|
911
914
|
{
|
|
912
915
|
...s,
|
|
913
916
|
PreTag: "div",
|
|
914
917
|
children: String(t).replace(/\n$/, ""),
|
|
915
918
|
language: d[1],
|
|
916
|
-
style:
|
|
919
|
+
style: re
|
|
917
920
|
}
|
|
918
921
|
)
|
|
919
922
|
) : /* @__PURE__ */ i("code", { ...s, className: n, children: String(t) });
|
|
@@ -923,7 +926,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
923
926
|
}
|
|
924
927
|
)
|
|
925
928
|
}
|
|
926
|
-
) }),
|
|
929
|
+
) }), Be = ({ data: e }) => {
|
|
927
930
|
const r = JSON.stringify(
|
|
928
931
|
JSON.parse(e.response.jsonResponse),
|
|
929
932
|
null,
|
|
@@ -935,10 +938,10 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
935
938
|
initial: { opacity: 0, y: -10 },
|
|
936
939
|
animate: { opacity: 1, y: 0 },
|
|
937
940
|
transition: { duration: 0.3, delay: 0 },
|
|
938
|
-
children: /* @__PURE__ */ i(
|
|
941
|
+
children: /* @__PURE__ */ i(Y, { language: "json", style: re, PreTag: "div", children: r })
|
|
939
942
|
}
|
|
940
943
|
) });
|
|
941
|
-
},
|
|
944
|
+
}, We = {
|
|
942
945
|
en: {
|
|
943
946
|
error: "Error",
|
|
944
947
|
streaming: "Streaming...",
|
|
@@ -1058,10 +1061,10 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
1058
1061
|
memorySearchExploreNoResults: "Ingen resultater funnet"
|
|
1059
1062
|
}
|
|
1060
1063
|
};
|
|
1061
|
-
function
|
|
1062
|
-
return
|
|
1064
|
+
function $e(e) {
|
|
1065
|
+
return We[e];
|
|
1063
1066
|
}
|
|
1064
|
-
function
|
|
1067
|
+
function T(e, r) {
|
|
1065
1068
|
return Object.entries(r).reduce(
|
|
1066
1069
|
(t, [n, l]) => t.replace(`{${n}}`, String(l)),
|
|
1067
1070
|
e
|
|
@@ -1075,12 +1078,12 @@ function Q(e, r) {
|
|
|
1075
1078
|
}
|
|
1076
1079
|
return t.join(", ");
|
|
1077
1080
|
}
|
|
1078
|
-
const W = 5,
|
|
1079
|
-
const [l, c] = v(!1), d = (e.memories ?? []).map((h) => h.memoryTitle), m = d.length > 0, o = m && d.length > W, a = o && !l ? d.slice(0, W) : d, u = d.length - W,
|
|
1081
|
+
const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1082
|
+
const [l, c] = v(!1), d = (e.memories ?? []).map((h) => h.memoryTitle), m = d.length > 0, o = m && d.length > W, a = o && !l ? d.slice(0, W) : d, u = d.length - W, y = !o || l, f = `${n.searchingFor}'${e.queryDescription}'`, g = m ? `${n.searchingIn}${Q(
|
|
1080
1083
|
a,
|
|
1081
|
-
|
|
1082
|
-
)}` : "",
|
|
1083
|
-
return /* @__PURE__ */
|
|
1084
|
+
y ? n.and : void 0
|
|
1085
|
+
)}` : "", x = m ? `${f}${g}` : `${n.searchingPrefix}${e.queryDescription}`;
|
|
1086
|
+
return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
|
|
1084
1087
|
/* @__PURE__ */ i(
|
|
1085
1088
|
b.div,
|
|
1086
1089
|
{
|
|
@@ -1089,25 +1092,25 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1089
1092
|
animate: { opacity: 1, y: 0 },
|
|
1090
1093
|
transition: { duration: 0.3, delay: 0 },
|
|
1091
1094
|
children: r && !t && !o ? /* @__PURE__ */ i(
|
|
1092
|
-
|
|
1095
|
+
E,
|
|
1093
1096
|
{
|
|
1094
|
-
text:
|
|
1097
|
+
text: x,
|
|
1095
1098
|
duration: 2.5,
|
|
1096
1099
|
repeat: !0,
|
|
1097
1100
|
color: "#999",
|
|
1098
1101
|
shimmerColor: "#000"
|
|
1099
1102
|
}
|
|
1100
|
-
) : /* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */
|
|
1103
|
+
) : /* @__PURE__ */ p(I, { children: [
|
|
1104
|
+
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ p(I, { children: [
|
|
1102
1105
|
n.searchingFor,
|
|
1103
|
-
/* @__PURE__ */
|
|
1106
|
+
/* @__PURE__ */ p("span", { style: { fontWeight: 600 }, children: [
|
|
1104
1107
|
"'",
|
|
1105
1108
|
e.queryDescription,
|
|
1106
1109
|
"'"
|
|
1107
1110
|
] }),
|
|
1108
|
-
|
|
1111
|
+
g
|
|
1109
1112
|
] }) : `${n.searchingPrefix}${e.queryDescription}` }),
|
|
1110
|
-
o && !l && /* @__PURE__ */
|
|
1113
|
+
o && !l && /* @__PURE__ */ p(I, { children: [
|
|
1111
1114
|
" ",
|
|
1112
1115
|
/* @__PURE__ */ i(
|
|
1113
1116
|
"button",
|
|
@@ -1125,13 +1128,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1125
1128
|
textDecoration: "underline",
|
|
1126
1129
|
fontFamily: "inherit"
|
|
1127
1130
|
},
|
|
1128
|
-
children:
|
|
1131
|
+
children: T(n.moreMemories, {
|
|
1129
1132
|
n: u
|
|
1130
1133
|
})
|
|
1131
1134
|
}
|
|
1132
1135
|
)
|
|
1133
1136
|
] }),
|
|
1134
|
-
o && l && /* @__PURE__ */
|
|
1137
|
+
o && l && /* @__PURE__ */ p(I, { children: [
|
|
1135
1138
|
" ",
|
|
1136
1139
|
/* @__PURE__ */ i(
|
|
1137
1140
|
"button",
|
|
@@ -1165,16 +1168,16 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1165
1168
|
marginTop: "4px",
|
|
1166
1169
|
fontStyle: "italic"
|
|
1167
1170
|
},
|
|
1168
|
-
children:
|
|
1171
|
+
children: T(n.tookSeconds, { n: t })
|
|
1169
1172
|
}
|
|
1170
1173
|
)
|
|
1171
1174
|
] });
|
|
1172
|
-
}, $ = 5,
|
|
1173
|
-
const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > $, o = m && !l ? s.slice(0, $) : s, a = s.length - $, u = !m || l,
|
|
1175
|
+
}, $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1176
|
+
const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > $, o = m && !l ? s.slice(0, $) : s, a = s.length - $, u = !m || l, y = d ? `${n.findingMemoriesIn}${Q(
|
|
1174
1177
|
o,
|
|
1175
1178
|
u ? n.and : void 0
|
|
1176
1179
|
)}` : n.findingMemories;
|
|
1177
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
|
|
1178
1181
|
/* @__PURE__ */ i(
|
|
1179
1182
|
b.div,
|
|
1180
1183
|
{
|
|
@@ -1185,17 +1188,17 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1185
1188
|
animate: { opacity: 1, y: 0 },
|
|
1186
1189
|
transition: { duration: 0.3, delay: 0 },
|
|
1187
1190
|
children: r && !t && !m ? /* @__PURE__ */ i(
|
|
1188
|
-
|
|
1191
|
+
E,
|
|
1189
1192
|
{
|
|
1190
|
-
text:
|
|
1193
|
+
text: y,
|
|
1191
1194
|
duration: 2.5,
|
|
1192
1195
|
repeat: !0,
|
|
1193
1196
|
color: "#999",
|
|
1194
1197
|
shimmerColor: "#000"
|
|
1195
1198
|
}
|
|
1196
|
-
) : /* @__PURE__ */
|
|
1197
|
-
/* @__PURE__ */ i("span", { style: { color: "#666" }, children:
|
|
1198
|
-
m && !l && /* @__PURE__ */
|
|
1199
|
+
) : /* @__PURE__ */ p(I, { children: [
|
|
1200
|
+
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: y }),
|
|
1201
|
+
m && !l && /* @__PURE__ */ p(I, { children: [
|
|
1199
1202
|
" ",
|
|
1200
1203
|
/* @__PURE__ */ i(
|
|
1201
1204
|
"button",
|
|
@@ -1213,13 +1216,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1213
1216
|
textDecoration: "underline",
|
|
1214
1217
|
fontFamily: "inherit"
|
|
1215
1218
|
},
|
|
1216
|
-
children:
|
|
1219
|
+
children: T(n.moreMemories, {
|
|
1217
1220
|
n: a
|
|
1218
1221
|
})
|
|
1219
1222
|
}
|
|
1220
1223
|
)
|
|
1221
1224
|
] }),
|
|
1222
|
-
m && l && /* @__PURE__ */
|
|
1225
|
+
m && l && /* @__PURE__ */ p(I, { children: [
|
|
1223
1226
|
" ",
|
|
1224
1227
|
/* @__PURE__ */ i(
|
|
1225
1228
|
"button",
|
|
@@ -1253,12 +1256,12 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1253
1256
|
marginTop: "4px",
|
|
1254
1257
|
fontStyle: "italic"
|
|
1255
1258
|
},
|
|
1256
|
-
children:
|
|
1259
|
+
children: T(n.tookSeconds, { n: t })
|
|
1257
1260
|
}
|
|
1258
1261
|
)
|
|
1259
1262
|
] });
|
|
1260
|
-
}, H = 5,
|
|
1261
|
-
const [t, n] = v(!1), c = e.memories.map((f) => f.memoryTitle), s = c.length > 0, d = s && c.length > H, m = d && !t ? c.slice(0, H) : c, o = c.length - H, a = !d || t, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix,
|
|
1263
|
+
}, H = 5, Ge = ({ data: e, t: r }) => {
|
|
1264
|
+
const [t, n] = v(!1), c = e.memories.map((f) => f.memoryTitle), s = c.length > 0, d = s && c.length > H, m = d && !t ? c.slice(0, H) : c, o = c.length - H, a = !d || t, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, y = s ? `${u}${Q(
|
|
1262
1265
|
m,
|
|
1263
1266
|
a ? r.and : void 0
|
|
1264
1267
|
)}` : r.memoriesFound;
|
|
@@ -1269,9 +1272,9 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1269
1272
|
initial: { opacity: 0, y: -10 },
|
|
1270
1273
|
animate: { opacity: 1, y: 0 },
|
|
1271
1274
|
transition: { duration: 0.3, delay: 0 },
|
|
1272
|
-
children: /* @__PURE__ */
|
|
1273
|
-
/* @__PURE__ */ i("span", { style: { color: "#666" }, children:
|
|
1274
|
-
d && !t && /* @__PURE__ */
|
|
1275
|
+
children: /* @__PURE__ */ p(I, { children: [
|
|
1276
|
+
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: y }),
|
|
1277
|
+
d && !t && /* @__PURE__ */ p(I, { children: [
|
|
1275
1278
|
" ",
|
|
1276
1279
|
/* @__PURE__ */ i(
|
|
1277
1280
|
"button",
|
|
@@ -1289,13 +1292,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1289
1292
|
textDecoration: "underline",
|
|
1290
1293
|
fontFamily: "inherit"
|
|
1291
1294
|
},
|
|
1292
|
-
children:
|
|
1295
|
+
children: T(r.moreMemories, {
|
|
1293
1296
|
n: o
|
|
1294
1297
|
})
|
|
1295
1298
|
}
|
|
1296
1299
|
)
|
|
1297
1300
|
] }),
|
|
1298
|
-
d && t && /* @__PURE__ */
|
|
1301
|
+
d && t && /* @__PURE__ */ p(I, { children: [
|
|
1299
1302
|
" ",
|
|
1300
1303
|
/* @__PURE__ */ i(
|
|
1301
1304
|
"button",
|
|
@@ -1320,9 +1323,9 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1320
1323
|
] })
|
|
1321
1324
|
}
|
|
1322
1325
|
) });
|
|
1323
|
-
},
|
|
1326
|
+
}, Qe = ({ isLatest: e = !1, durationSeconds: r, t }) => {
|
|
1324
1327
|
const n = t.addingSources;
|
|
1325
|
-
return /* @__PURE__ */
|
|
1328
|
+
return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
|
|
1326
1329
|
/* @__PURE__ */ i(
|
|
1327
1330
|
b.div,
|
|
1328
1331
|
{
|
|
@@ -1336,7 +1339,7 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1336
1339
|
animate: { opacity: 1, y: 0 },
|
|
1337
1340
|
transition: { duration: 0.3, delay: 0 },
|
|
1338
1341
|
children: e && !r ? /* @__PURE__ */ i(
|
|
1339
|
-
|
|
1342
|
+
E,
|
|
1340
1343
|
{
|
|
1341
1344
|
text: n,
|
|
1342
1345
|
duration: 2.5,
|
|
@@ -1356,26 +1359,26 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1356
1359
|
marginTop: "4px",
|
|
1357
1360
|
fontStyle: "italic"
|
|
1358
1361
|
},
|
|
1359
|
-
children:
|
|
1362
|
+
children: T(t.tookSeconds, { n: r })
|
|
1360
1363
|
}
|
|
1361
1364
|
)
|
|
1362
1365
|
] });
|
|
1363
1366
|
};
|
|
1364
|
-
function
|
|
1367
|
+
function Ue(e, r) {
|
|
1365
1368
|
if (e.length === 0) return "";
|
|
1366
1369
|
if (e.length === 1)
|
|
1367
|
-
return
|
|
1370
|
+
return T(r.pageSingle, { n: e[0] });
|
|
1368
1371
|
if (e.length === 2)
|
|
1369
|
-
return
|
|
1372
|
+
return T(r.pageTwo, {
|
|
1370
1373
|
a: e[0],
|
|
1371
1374
|
b: e[1]
|
|
1372
1375
|
});
|
|
1373
1376
|
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1374
|
-
return
|
|
1377
|
+
return T(r.pageMultiple, { list: n, n: t });
|
|
1375
1378
|
}
|
|
1376
|
-
const
|
|
1379
|
+
const je = ({ data: e, onSourceClick: r, t }) => {
|
|
1377
1380
|
const [n, l] = v(null);
|
|
1378
|
-
return /* @__PURE__ */
|
|
1381
|
+
return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
|
|
1379
1382
|
/* @__PURE__ */ i(
|
|
1380
1383
|
b.div,
|
|
1381
1384
|
{
|
|
@@ -1394,7 +1397,7 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1394
1397
|
}
|
|
1395
1398
|
),
|
|
1396
1399
|
/* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ i(
|
|
1397
|
-
|
|
1400
|
+
qe,
|
|
1398
1401
|
{
|
|
1399
1402
|
source: c,
|
|
1400
1403
|
index: s,
|
|
@@ -1406,7 +1409,7 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1406
1409
|
c.memoryId
|
|
1407
1410
|
)) })
|
|
1408
1411
|
] });
|
|
1409
|
-
},
|
|
1412
|
+
}, qe = ({
|
|
1410
1413
|
source: e,
|
|
1411
1414
|
index: r,
|
|
1412
1415
|
loadingMemoryId: t,
|
|
@@ -1414,8 +1417,8 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1414
1417
|
onSourceClick: l,
|
|
1415
1418
|
t: c
|
|
1416
1419
|
}) => {
|
|
1417
|
-
const [s, d] = v(!1), m = !!l, o = t === e.memoryId, a = e.pageNumbers ?? [], u =
|
|
1418
|
-
return /* @__PURE__ */
|
|
1420
|
+
const [s, d] = v(!1), m = !!l, o = t === e.memoryId, a = e.pageNumbers ?? [], u = Ue(a, c);
|
|
1421
|
+
return /* @__PURE__ */ p(
|
|
1419
1422
|
b.div,
|
|
1420
1423
|
{
|
|
1421
1424
|
"aria-busy": o,
|
|
@@ -1452,7 +1455,7 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1452
1455
|
pointerEvents: o ? "none" : void 0
|
|
1453
1456
|
},
|
|
1454
1457
|
children: [
|
|
1455
|
-
/* @__PURE__ */
|
|
1458
|
+
/* @__PURE__ */ p(
|
|
1456
1459
|
"span",
|
|
1457
1460
|
{
|
|
1458
1461
|
style: {
|
|
@@ -1498,7 +1501,7 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1498
1501
|
}
|
|
1499
1502
|
}
|
|
1500
1503
|
);
|
|
1501
|
-
},
|
|
1504
|
+
}, U = ({
|
|
1502
1505
|
color: e = "#333",
|
|
1503
1506
|
size: r = 32,
|
|
1504
1507
|
lineWidth: t = 2
|
|
@@ -1511,7 +1514,7 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1511
1514
|
height: n,
|
|
1512
1515
|
backgroundColor: e
|
|
1513
1516
|
};
|
|
1514
|
-
return /* @__PURE__ */
|
|
1517
|
+
return /* @__PURE__ */ p(
|
|
1515
1518
|
"span",
|
|
1516
1519
|
{
|
|
1517
1520
|
style: {
|
|
@@ -1543,20 +1546,20 @@ const Qe = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1543
1546
|
}
|
|
1544
1547
|
);
|
|
1545
1548
|
};
|
|
1546
|
-
function
|
|
1549
|
+
function Ke({
|
|
1547
1550
|
memory: e,
|
|
1548
1551
|
completed: r
|
|
1549
1552
|
}) {
|
|
1550
|
-
return e.error != null ? /* @__PURE__ */ i(
|
|
1553
|
+
return e.error != null ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
|
|
1551
1554
|
}
|
|
1552
|
-
const
|
|
1553
|
-
function
|
|
1555
|
+
const X = 80;
|
|
1556
|
+
function Ve({
|
|
1554
1557
|
memory: e,
|
|
1555
1558
|
completed: r,
|
|
1556
1559
|
t
|
|
1557
1560
|
}) {
|
|
1558
|
-
const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length >
|
|
1559
|
-
return /* @__PURE__ */
|
|
1561
|
+
const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length > X, d = c != null ? n || !s ? c : `${c.slice(0, X)}...` : void 0, m = s, o = e.error != null;
|
|
1562
|
+
return /* @__PURE__ */ p(
|
|
1560
1563
|
b.div,
|
|
1561
1564
|
{
|
|
1562
1565
|
initial: { opacity: 0 },
|
|
@@ -1585,10 +1588,10 @@ function Ue({
|
|
|
1585
1588
|
flexShrink: 0,
|
|
1586
1589
|
width: 32
|
|
1587
1590
|
},
|
|
1588
|
-
children: /* @__PURE__ */ i(
|
|
1591
|
+
children: /* @__PURE__ */ i(Ke, { memory: e, completed: r })
|
|
1589
1592
|
}
|
|
1590
1593
|
),
|
|
1591
|
-
/* @__PURE__ */
|
|
1594
|
+
/* @__PURE__ */ p(
|
|
1592
1595
|
"div",
|
|
1593
1596
|
{
|
|
1594
1597
|
style: {
|
|
@@ -1635,8 +1638,8 @@ function Ue({
|
|
|
1635
1638
|
}
|
|
1636
1639
|
);
|
|
1637
1640
|
}
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1641
|
+
const Xe = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ i(
|
|
1642
|
+
Ve,
|
|
1640
1643
|
{
|
|
1641
1644
|
memory: n,
|
|
1642
1645
|
completed: r,
|
|
@@ -1644,50 +1647,107 @@ const Ke = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: {
|
|
|
1644
1647
|
},
|
|
1645
1648
|
n.memoryId
|
|
1646
1649
|
)) });
|
|
1647
|
-
function
|
|
1650
|
+
function Je(e, r) {
|
|
1648
1651
|
if (e.length === 0) return "";
|
|
1649
1652
|
if (e.length === 1)
|
|
1650
|
-
return
|
|
1653
|
+
return T(r.pageSingle, { n: e[0] });
|
|
1651
1654
|
if (e.length === 2)
|
|
1652
|
-
return
|
|
1655
|
+
return T(r.pageTwo, {
|
|
1653
1656
|
a: e[0],
|
|
1654
1657
|
b: e[1]
|
|
1655
1658
|
});
|
|
1656
1659
|
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1657
|
-
return
|
|
1660
|
+
return T(r.pageMultiple, { list: n, n: t });
|
|
1658
1661
|
}
|
|
1659
|
-
function
|
|
1660
|
-
return e === 1 ? r.chunkFound :
|
|
1662
|
+
function Ye(e, r) {
|
|
1663
|
+
return e === 1 ? r.chunkFound : T(r.chunksFound, { n: e });
|
|
1661
1664
|
}
|
|
1662
|
-
const
|
|
1665
|
+
const Ze = ({ data: e, t: r }) => {
|
|
1663
1666
|
const [t, n] = v(!1), l = e.chunks.length, c = l > 0;
|
|
1664
|
-
return /* @__PURE__ */
|
|
1665
|
-
/* @__PURE__ */
|
|
1667
|
+
return /* @__PURE__ */ p("div", { style: { padding: "8px 10px" }, children: [
|
|
1668
|
+
/* @__PURE__ */ p(
|
|
1666
1669
|
b.div,
|
|
1667
1670
|
{
|
|
1668
1671
|
initial: { opacity: 0 },
|
|
1669
1672
|
animate: { opacity: 1 },
|
|
1670
1673
|
transition: { duration: 0.25 },
|
|
1671
1674
|
onClick: c ? () => n((s) => !s) : void 0,
|
|
1675
|
+
role: c ? "button" : void 0,
|
|
1676
|
+
tabIndex: c ? 0 : void 0,
|
|
1677
|
+
onKeyDown: c ? (s) => {
|
|
1678
|
+
(s.key === "Enter" || s.key === " ") && (s.preventDefault(), n((d) => !d));
|
|
1679
|
+
} : void 0,
|
|
1672
1680
|
style: {
|
|
1673
|
-
paddingBottom: t ? "
|
|
1681
|
+
paddingBottom: t ? "10px" : 0,
|
|
1674
1682
|
borderBottom: t ? "1px solid #eee" : void 0,
|
|
1675
1683
|
display: "flex",
|
|
1676
|
-
flexDirection: "
|
|
1677
|
-
|
|
1684
|
+
flexDirection: "row",
|
|
1685
|
+
alignItems: "center",
|
|
1686
|
+
justifyContent: "space-between",
|
|
1687
|
+
gap: 8,
|
|
1678
1688
|
minWidth: 0,
|
|
1679
1689
|
cursor: c ? "pointer" : "default"
|
|
1680
1690
|
},
|
|
1681
1691
|
children: [
|
|
1682
|
-
/* @__PURE__ */
|
|
1683
|
-
|
|
1692
|
+
/* @__PURE__ */ p(
|
|
1693
|
+
"div",
|
|
1694
|
+
{
|
|
1695
|
+
style: {
|
|
1696
|
+
display: "flex",
|
|
1697
|
+
flexDirection: "row",
|
|
1698
|
+
alignItems: "center",
|
|
1699
|
+
flexWrap: "wrap",
|
|
1700
|
+
gap: "0 8px",
|
|
1701
|
+
flex: "1 1 auto",
|
|
1702
|
+
minWidth: 0
|
|
1703
|
+
},
|
|
1704
|
+
children: [
|
|
1705
|
+
/* @__PURE__ */ i(
|
|
1706
|
+
"span",
|
|
1707
|
+
{
|
|
1708
|
+
style: {
|
|
1709
|
+
fontSize: 13,
|
|
1710
|
+
fontWeight: 600,
|
|
1711
|
+
color: "#333",
|
|
1712
|
+
wordBreak: "break-word"
|
|
1713
|
+
},
|
|
1714
|
+
children: e.memoryTitle
|
|
1715
|
+
}
|
|
1716
|
+
),
|
|
1717
|
+
/* @__PURE__ */ i(
|
|
1718
|
+
"span",
|
|
1719
|
+
{
|
|
1720
|
+
style: {
|
|
1721
|
+
fontSize: 13,
|
|
1722
|
+
color: "#9ca3af",
|
|
1723
|
+
flexShrink: 0
|
|
1724
|
+
},
|
|
1725
|
+
"aria-hidden": !0,
|
|
1726
|
+
children: "·"
|
|
1727
|
+
}
|
|
1728
|
+
),
|
|
1729
|
+
/* @__PURE__ */ i(
|
|
1730
|
+
"span",
|
|
1731
|
+
{
|
|
1732
|
+
style: {
|
|
1733
|
+
fontSize: 12,
|
|
1734
|
+
color: "#666",
|
|
1735
|
+
flexShrink: 0
|
|
1736
|
+
},
|
|
1737
|
+
children: Ye(l, r)
|
|
1738
|
+
}
|
|
1739
|
+
)
|
|
1740
|
+
]
|
|
1741
|
+
}
|
|
1742
|
+
),
|
|
1684
1743
|
c && /* @__PURE__ */ i(
|
|
1685
1744
|
"span",
|
|
1686
1745
|
{
|
|
1687
1746
|
style: {
|
|
1688
1747
|
fontSize: 11,
|
|
1689
1748
|
color: "#999",
|
|
1690
|
-
|
|
1749
|
+
flexShrink: 0,
|
|
1750
|
+
whiteSpace: "nowrap"
|
|
1691
1751
|
},
|
|
1692
1752
|
children: t ? r.clickToCollapse : r.clickToExpand
|
|
1693
1753
|
}
|
|
@@ -1710,8 +1770,8 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1710
1770
|
gap: 8
|
|
1711
1771
|
},
|
|
1712
1772
|
children: e.chunks.map((s, d) => {
|
|
1713
|
-
const m = s.pageNumbers ?? [], o =
|
|
1714
|
-
return /* @__PURE__ */
|
|
1773
|
+
const m = s.pageNumbers ?? [], o = Je(m, r);
|
|
1774
|
+
return /* @__PURE__ */ p(
|
|
1715
1775
|
"div",
|
|
1716
1776
|
{
|
|
1717
1777
|
style: {
|
|
@@ -1734,7 +1794,7 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1734
1794
|
children: s.content
|
|
1735
1795
|
}
|
|
1736
1796
|
),
|
|
1737
|
-
/* @__PURE__ */
|
|
1797
|
+
/* @__PURE__ */ p(
|
|
1738
1798
|
"div",
|
|
1739
1799
|
{
|
|
1740
1800
|
style: {
|
|
@@ -1745,7 +1805,7 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1745
1805
|
},
|
|
1746
1806
|
children: [
|
|
1747
1807
|
o && /* @__PURE__ */ i("span", { children: o }),
|
|
1748
|
-
/* @__PURE__ */ i("span", { children:
|
|
1808
|
+
/* @__PURE__ */ i("span", { children: T(r.scoreLabel, {
|
|
1749
1809
|
n: s.score
|
|
1750
1810
|
}) })
|
|
1751
1811
|
]
|
|
@@ -1760,21 +1820,21 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1760
1820
|
)
|
|
1761
1821
|
] });
|
|
1762
1822
|
};
|
|
1763
|
-
function
|
|
1764
|
-
return e.error != null ? /* @__PURE__ */ i(
|
|
1823
|
+
function er({ item: e }) {
|
|
1824
|
+
return e.error != null ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
|
|
1765
1825
|
}
|
|
1766
|
-
function
|
|
1767
|
-
return
|
|
1826
|
+
function rr(e, r) {
|
|
1827
|
+
return T(r.searchingInMemoriesOfType, {
|
|
1768
1828
|
name: e.memoryTypeName
|
|
1769
1829
|
});
|
|
1770
1830
|
}
|
|
1771
|
-
function
|
|
1831
|
+
function nr({
|
|
1772
1832
|
item: e,
|
|
1773
1833
|
t: r,
|
|
1774
1834
|
showShimmerForPrimary: t
|
|
1775
1835
|
}) {
|
|
1776
|
-
const n = e.result != null, l = e.error != null, c =
|
|
1777
|
-
return /* @__PURE__ */
|
|
1836
|
+
const n = e.result != null, l = e.error != null, c = rr(e, r);
|
|
1837
|
+
return /* @__PURE__ */ p(
|
|
1778
1838
|
b.div,
|
|
1779
1839
|
{
|
|
1780
1840
|
initial: { opacity: 0 },
|
|
@@ -1801,10 +1861,10 @@ function er({
|
|
|
1801
1861
|
flexShrink: 0,
|
|
1802
1862
|
width: 32
|
|
1803
1863
|
},
|
|
1804
|
-
children: /* @__PURE__ */ i(
|
|
1864
|
+
children: /* @__PURE__ */ i(er, { item: e })
|
|
1805
1865
|
}
|
|
1806
1866
|
),
|
|
1807
|
-
/* @__PURE__ */
|
|
1867
|
+
/* @__PURE__ */ p(
|
|
1808
1868
|
"div",
|
|
1809
1869
|
{
|
|
1810
1870
|
style: {
|
|
@@ -1816,7 +1876,7 @@ function er({
|
|
|
1816
1876
|
},
|
|
1817
1877
|
children: [
|
|
1818
1878
|
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !n && !l && t ? /* @__PURE__ */ i(
|
|
1819
|
-
|
|
1879
|
+
E,
|
|
1820
1880
|
{
|
|
1821
1881
|
text: c,
|
|
1822
1882
|
duration: 2.5,
|
|
@@ -1825,14 +1885,14 @@ function er({
|
|
|
1825
1885
|
shimmerColor: "#000"
|
|
1826
1886
|
}
|
|
1827
1887
|
) : c }),
|
|
1828
|
-
n && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ?
|
|
1888
|
+
n && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? T(
|
|
1829
1889
|
r.memorySearchTypeResultSummaryOne,
|
|
1830
1890
|
{
|
|
1831
1891
|
score: e.result.highestChunkScore.toFixed(
|
|
1832
1892
|
2
|
|
1833
1893
|
)
|
|
1834
1894
|
}
|
|
1835
|
-
) :
|
|
1895
|
+
) : T(
|
|
1836
1896
|
r.memorySearchTypeResultSummary,
|
|
1837
1897
|
{
|
|
1838
1898
|
count: e.result.numberOfChunks,
|
|
@@ -1849,16 +1909,16 @@ function er({
|
|
|
1849
1909
|
}
|
|
1850
1910
|
);
|
|
1851
1911
|
}
|
|
1852
|
-
const
|
|
1912
|
+
const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1853
1913
|
const l = D(() => {
|
|
1854
1914
|
let c = -1;
|
|
1855
1915
|
return e.memoryTypes.forEach((s, d) => {
|
|
1856
1916
|
s.result == null && s.error == null && (c = d);
|
|
1857
1917
|
}), c;
|
|
1858
1918
|
}, [e.memoryTypes]);
|
|
1859
|
-
return /* @__PURE__ */
|
|
1919
|
+
return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
|
|
1860
1920
|
r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
|
|
1861
|
-
|
|
1921
|
+
E,
|
|
1862
1922
|
{
|
|
1863
1923
|
text: n.searchingMemoryTypes,
|
|
1864
1924
|
duration: 2.5,
|
|
@@ -1867,7 +1927,7 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1867
1927
|
shimmerColor: "#000"
|
|
1868
1928
|
}
|
|
1869
1929
|
) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
|
|
1870
|
-
|
|
1930
|
+
nr,
|
|
1871
1931
|
{
|
|
1872
1932
|
item: c,
|
|
1873
1933
|
t: n,
|
|
@@ -1884,44 +1944,44 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1884
1944
|
marginTop: "4px",
|
|
1885
1945
|
fontStyle: "italic"
|
|
1886
1946
|
},
|
|
1887
|
-
children:
|
|
1947
|
+
children: T(n.tookSeconds, { n: t })
|
|
1888
1948
|
}
|
|
1889
1949
|
)
|
|
1890
1950
|
] });
|
|
1891
|
-
}, N = 12, B = 1.45,
|
|
1951
|
+
}, N = 12, B = 1.45, or = Math.ceil(
|
|
1892
1952
|
N * B
|
|
1893
|
-
),
|
|
1953
|
+
), ir = Math.ceil(
|
|
1894
1954
|
5 * N * B
|
|
1895
1955
|
);
|
|
1896
1956
|
function O(e) {
|
|
1897
1957
|
return e.queries != null && e.queries.length > 0;
|
|
1898
1958
|
}
|
|
1899
|
-
function
|
|
1959
|
+
function ar(e) {
|
|
1900
1960
|
const r = e.reasoning;
|
|
1901
1961
|
return (r == null || r === "") && !O(e);
|
|
1902
1962
|
}
|
|
1903
|
-
function
|
|
1963
|
+
function sr(e) {
|
|
1904
1964
|
if (O(e)) return 3;
|
|
1905
1965
|
const r = e.reasoning;
|
|
1906
1966
|
return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
|
|
1907
1967
|
}
|
|
1908
|
-
function
|
|
1968
|
+
function lr({ phase: e }) {
|
|
1909
1969
|
return e === 3 ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
|
|
1910
1970
|
}
|
|
1911
|
-
function
|
|
1971
|
+
function cr({
|
|
1912
1972
|
item: e,
|
|
1913
1973
|
t: r,
|
|
1914
1974
|
isActiveRow: t
|
|
1915
1975
|
}) {
|
|
1916
|
-
const n =
|
|
1976
|
+
const n = ar(e), l = sr(e), c = e.reasoning, s = c != null && c.length > 0, d = F(null), [m, o] = v(!1), a = n && t, u = l === 2 && t && !O(e);
|
|
1917
1977
|
A(() => {
|
|
1918
|
-
const
|
|
1919
|
-
|
|
1978
|
+
const g = d.current;
|
|
1979
|
+
g != null && l === 1 && s && (g.scrollTop = g.scrollHeight);
|
|
1920
1980
|
}, [c, l, s]);
|
|
1921
|
-
const
|
|
1981
|
+
const y = T(r.searchingInMemoriesOfType, {
|
|
1922
1982
|
name: e.memoryTypeName
|
|
1923
1983
|
}), f = !n && l === 3;
|
|
1924
|
-
return /* @__PURE__ */
|
|
1984
|
+
return /* @__PURE__ */ p(
|
|
1925
1985
|
b.div,
|
|
1926
1986
|
{
|
|
1927
1987
|
initial: { opacity: 0 },
|
|
@@ -1949,10 +2009,10 @@ function sr({
|
|
|
1949
2009
|
width: 32,
|
|
1950
2010
|
...f ? { paddingTop: 2 } : {}
|
|
1951
2011
|
},
|
|
1952
|
-
children: /* @__PURE__ */ i(
|
|
2012
|
+
children: /* @__PURE__ */ i(lr, { phase: n ? 1 : l })
|
|
1953
2013
|
}
|
|
1954
2014
|
),
|
|
1955
|
-
/* @__PURE__ */
|
|
2015
|
+
/* @__PURE__ */ p(
|
|
1956
2016
|
"div",
|
|
1957
2017
|
{
|
|
1958
2018
|
style: {
|
|
@@ -1964,16 +2024,16 @@ function sr({
|
|
|
1964
2024
|
},
|
|
1965
2025
|
children: [
|
|
1966
2026
|
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ i(
|
|
1967
|
-
|
|
2027
|
+
E,
|
|
1968
2028
|
{
|
|
1969
|
-
text:
|
|
2029
|
+
text: y,
|
|
1970
2030
|
duration: 2.5,
|
|
1971
2031
|
repeat: !0,
|
|
1972
2032
|
color: "#999",
|
|
1973
2033
|
shimmerColor: "#000"
|
|
1974
2034
|
}
|
|
1975
2035
|
) : e.memoryTypeName }),
|
|
1976
|
-
l === 1 && s && !O(e) && /* @__PURE__ */
|
|
2036
|
+
l === 1 && s && !O(e) && /* @__PURE__ */ p("div", { style: { minWidth: 0 }, children: [
|
|
1977
2037
|
/* @__PURE__ */ i(
|
|
1978
2038
|
"span",
|
|
1979
2039
|
{
|
|
@@ -2002,8 +2062,8 @@ function sr({
|
|
|
2002
2062
|
ref: d,
|
|
2003
2063
|
className: "memory-search-generating-reasoning-viewport",
|
|
2004
2064
|
style: {
|
|
2005
|
-
minHeight:
|
|
2006
|
-
maxHeight:
|
|
2065
|
+
minHeight: or,
|
|
2066
|
+
maxHeight: ir,
|
|
2007
2067
|
height: "auto",
|
|
2008
2068
|
overflowY: "auto",
|
|
2009
2069
|
overflowX: "hidden",
|
|
@@ -2020,7 +2080,7 @@ function sr({
|
|
|
2020
2080
|
)
|
|
2021
2081
|
] }),
|
|
2022
2082
|
l === 2 && u && /* @__PURE__ */ i("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ i(
|
|
2023
|
-
|
|
2083
|
+
E,
|
|
2024
2084
|
{
|
|
2025
2085
|
text: r.memorySearchGeneratingQueriesPending,
|
|
2026
2086
|
duration: 2.5,
|
|
@@ -2029,8 +2089,8 @@ function sr({
|
|
|
2029
2089
|
shimmerColor: "#000"
|
|
2030
2090
|
}
|
|
2031
2091
|
) }),
|
|
2032
|
-
l === 3 && /* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2092
|
+
l === 3 && /* @__PURE__ */ p(I, { children: [
|
|
2093
|
+
/* @__PURE__ */ p("div", { style: { minWidth: 0 }, children: [
|
|
2034
2094
|
/* @__PURE__ */ i(
|
|
2035
2095
|
"span",
|
|
2036
2096
|
{
|
|
@@ -2052,7 +2112,7 @@ function sr({
|
|
|
2052
2112
|
flexDirection: "column",
|
|
2053
2113
|
gap: 6
|
|
2054
2114
|
},
|
|
2055
|
-
children: e.queries.map((
|
|
2115
|
+
children: e.queries.map((g, x) => /* @__PURE__ */ i(
|
|
2056
2116
|
"div",
|
|
2057
2117
|
{
|
|
2058
2118
|
style: {
|
|
@@ -2061,19 +2121,19 @@ function sr({
|
|
|
2061
2121
|
lineHeight: 1.5,
|
|
2062
2122
|
wordBreak: "break-word"
|
|
2063
2123
|
},
|
|
2064
|
-
children:
|
|
2124
|
+
children: g.query
|
|
2065
2125
|
},
|
|
2066
|
-
|
|
2126
|
+
x
|
|
2067
2127
|
))
|
|
2068
2128
|
}
|
|
2069
2129
|
)
|
|
2070
2130
|
] }),
|
|
2071
|
-
s && /* @__PURE__ */
|
|
2131
|
+
s && /* @__PURE__ */ p(I, { children: [
|
|
2072
2132
|
/* @__PURE__ */ i(
|
|
2073
2133
|
"button",
|
|
2074
2134
|
{
|
|
2075
2135
|
type: "button",
|
|
2076
|
-
onClick: () => o((
|
|
2136
|
+
onClick: () => o((g) => !g),
|
|
2077
2137
|
style: {
|
|
2078
2138
|
alignSelf: "flex-start",
|
|
2079
2139
|
border: "none",
|
|
@@ -2112,16 +2172,16 @@ function sr({
|
|
|
2112
2172
|
}
|
|
2113
2173
|
);
|
|
2114
2174
|
}
|
|
2115
|
-
const
|
|
2175
|
+
const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
2116
2176
|
const l = D(() => {
|
|
2117
2177
|
let c = -1;
|
|
2118
2178
|
return e.memoryTypes.forEach((s, d) => {
|
|
2119
2179
|
O(s) || (c = d);
|
|
2120
2180
|
}), c;
|
|
2121
2181
|
}, [e.memoryTypes]);
|
|
2122
|
-
return /* @__PURE__ */
|
|
2182
|
+
return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
|
|
2123
2183
|
r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
|
|
2124
|
-
|
|
2184
|
+
E,
|
|
2125
2185
|
{
|
|
2126
2186
|
text: n.memorySearchGeneratingQueries,
|
|
2127
2187
|
duration: 2.5,
|
|
@@ -2130,7 +2190,7 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
2130
2190
|
shimmerColor: "#000"
|
|
2131
2191
|
}
|
|
2132
2192
|
) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
|
|
2133
|
-
|
|
2193
|
+
cr,
|
|
2134
2194
|
{
|
|
2135
2195
|
item: c,
|
|
2136
2196
|
t: n,
|
|
@@ -2147,21 +2207,21 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
2147
2207
|
marginTop: "4px",
|
|
2148
2208
|
fontStyle: "italic"
|
|
2149
2209
|
},
|
|
2150
|
-
children:
|
|
2210
|
+
children: T(n.tookSeconds, { n: t })
|
|
2151
2211
|
}
|
|
2152
2212
|
)
|
|
2153
2213
|
] });
|
|
2154
2214
|
};
|
|
2155
|
-
function
|
|
2215
|
+
function mr(e, r) {
|
|
2156
2216
|
const t = Math.min(e.length, r.length);
|
|
2157
2217
|
for (let n = t; n >= 0; n--)
|
|
2158
2218
|
if (e.slice(-n) === r.slice(0, n)) return n;
|
|
2159
2219
|
return 0;
|
|
2160
2220
|
}
|
|
2161
|
-
const
|
|
2221
|
+
const ur = `
|
|
2162
2222
|
|
|
2163
2223
|
`;
|
|
2164
|
-
function
|
|
2224
|
+
function ne(e) {
|
|
2165
2225
|
var t, n;
|
|
2166
2226
|
if (e.length === 0) return "";
|
|
2167
2227
|
let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
|
|
@@ -2172,48 +2232,48 @@ function re(e) {
|
|
|
2172
2232
|
r = c;
|
|
2173
2233
|
continue;
|
|
2174
2234
|
}
|
|
2175
|
-
const s =
|
|
2176
|
-
s === 0 ? r +=
|
|
2235
|
+
const s = mr(r, c);
|
|
2236
|
+
s === 0 ? r += ur + c : r += c.slice(s);
|
|
2177
2237
|
}
|
|
2178
2238
|
return r;
|
|
2179
2239
|
}
|
|
2180
|
-
function
|
|
2240
|
+
function te(e, r) {
|
|
2181
2241
|
if (e.length === 0) return "";
|
|
2182
2242
|
if (e.length === 1)
|
|
2183
|
-
return
|
|
2243
|
+
return T(r.memorySearchPagesSingle, {
|
|
2184
2244
|
n: e[0]
|
|
2185
2245
|
});
|
|
2186
2246
|
if (e.length === 2)
|
|
2187
|
-
return
|
|
2247
|
+
return T(r.memorySearchPagesTwo, {
|
|
2188
2248
|
a: e[0],
|
|
2189
2249
|
b: e[1]
|
|
2190
2250
|
});
|
|
2191
2251
|
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
2192
|
-
return
|
|
2252
|
+
return T(r.memorySearchPagesMultiple, {
|
|
2193
2253
|
list: n,
|
|
2194
2254
|
n: t
|
|
2195
2255
|
});
|
|
2196
2256
|
}
|
|
2197
|
-
function
|
|
2257
|
+
function oe(e) {
|
|
2198
2258
|
const r = /* @__PURE__ */ new Set();
|
|
2199
2259
|
for (const t of e)
|
|
2200
2260
|
for (const n of t.pageNumbers) r.add(n);
|
|
2201
2261
|
return [...r].sort((t, n) => t - n);
|
|
2202
2262
|
}
|
|
2203
|
-
function
|
|
2263
|
+
function ie(e) {
|
|
2204
2264
|
const r = e.memoryTypeName.trim();
|
|
2205
2265
|
if (r !== "") return r;
|
|
2206
2266
|
if (e.memoryTypeId !== "") return e.memoryTypeId;
|
|
2207
2267
|
}
|
|
2208
|
-
function
|
|
2209
|
-
return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ i(
|
|
2268
|
+
function yr(e) {
|
|
2269
|
+
return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 });
|
|
2210
2270
|
}
|
|
2211
|
-
function
|
|
2271
|
+
function pr(e, r) {
|
|
2212
2272
|
if (e.error != null)
|
|
2213
2273
|
return /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
|
|
2214
2274
|
if (e.result == null)
|
|
2215
2275
|
return /* @__PURE__ */ i("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ i(
|
|
2216
|
-
|
|
2276
|
+
E,
|
|
2217
2277
|
{
|
|
2218
2278
|
text: r.searching,
|
|
2219
2279
|
duration: 2.5,
|
|
@@ -2222,16 +2282,16 @@ function ur(e, r) {
|
|
|
2222
2282
|
shimmerColor: "#000"
|
|
2223
2283
|
}
|
|
2224
2284
|
) });
|
|
2225
|
-
const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound :
|
|
2285
|
+
const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : T(r.chunksFound, { n: t.numberOfChunks }), l = T(r.scoreLabel, {
|
|
2226
2286
|
n: t.highestChunkScore.toFixed(2)
|
|
2227
2287
|
});
|
|
2228
|
-
return /* @__PURE__ */
|
|
2288
|
+
return /* @__PURE__ */ p("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
|
|
2229
2289
|
n,
|
|
2230
2290
|
" · ",
|
|
2231
2291
|
l
|
|
2232
2292
|
] });
|
|
2233
2293
|
}
|
|
2234
|
-
function
|
|
2294
|
+
function gr({
|
|
2235
2295
|
items: e,
|
|
2236
2296
|
queryRow: r,
|
|
2237
2297
|
onExploreQueryResultClick: t,
|
|
@@ -2263,25 +2323,25 @@ function yr({
|
|
|
2263
2323
|
borderTop: "1px solid #f0f0f0"
|
|
2264
2324
|
},
|
|
2265
2325
|
children: e.map((d, m) => {
|
|
2266
|
-
const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a =
|
|
2326
|
+
const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = oe(
|
|
2267
2327
|
d.chunks
|
|
2268
2328
|
), u = [
|
|
2269
|
-
|
|
2270
|
-
|
|
2329
|
+
ie(d),
|
|
2330
|
+
T(n.scoreLabel, {
|
|
2271
2331
|
n: d.matchingChunkScore.toFixed(2)
|
|
2272
2332
|
}),
|
|
2273
|
-
a.length > 0 ?
|
|
2333
|
+
a.length > 0 ? te(a, n) : n.pagesNotAvailable
|
|
2274
2334
|
].filter(
|
|
2275
|
-
(
|
|
2276
|
-
),
|
|
2335
|
+
(x) => x != null && x !== ""
|
|
2336
|
+
), y = {
|
|
2277
2337
|
memoryId: d.memoryId,
|
|
2278
2338
|
memoryTitle: d.memoryTitle,
|
|
2279
2339
|
pageNumbers: a,
|
|
2280
2340
|
memoryTypeId: r.memoryTypeId,
|
|
2281
2341
|
memoryTypeName: r.memoryTypeName,
|
|
2282
2342
|
query: r.query
|
|
2283
|
-
}, f = `${r.query}::${d.memoryId}::${m}`,
|
|
2284
|
-
return /* @__PURE__ */
|
|
2343
|
+
}, f = `${r.query}::${d.memoryId}::${m}`, g = l === f;
|
|
2344
|
+
return /* @__PURE__ */ p(
|
|
2285
2345
|
"div",
|
|
2286
2346
|
{
|
|
2287
2347
|
style: {
|
|
@@ -2295,7 +2355,7 @@ function yr({
|
|
|
2295
2355
|
minWidth: 0
|
|
2296
2356
|
},
|
|
2297
2357
|
children: [
|
|
2298
|
-
/* @__PURE__ */
|
|
2358
|
+
/* @__PURE__ */ p(
|
|
2299
2359
|
"div",
|
|
2300
2360
|
{
|
|
2301
2361
|
style: {
|
|
@@ -2327,7 +2387,7 @@ function yr({
|
|
|
2327
2387
|
whiteSpace: "pre-wrap",
|
|
2328
2388
|
wordBreak: "break-word"
|
|
2329
2389
|
},
|
|
2330
|
-
children:
|
|
2390
|
+
children: ne(
|
|
2331
2391
|
d.chunks
|
|
2332
2392
|
)
|
|
2333
2393
|
}
|
|
@@ -2347,17 +2407,17 @@ function yr({
|
|
|
2347
2407
|
]
|
|
2348
2408
|
}
|
|
2349
2409
|
),
|
|
2350
|
-
s && /* @__PURE__ */
|
|
2410
|
+
s && /* @__PURE__ */ p(
|
|
2351
2411
|
"button",
|
|
2352
2412
|
{
|
|
2353
2413
|
type: "button",
|
|
2354
|
-
"aria-busy":
|
|
2355
|
-
disabled:
|
|
2414
|
+
"aria-busy": g,
|
|
2415
|
+
disabled: g,
|
|
2356
2416
|
onClick: async () => {
|
|
2357
2417
|
c(f);
|
|
2358
2418
|
try {
|
|
2359
2419
|
await t(
|
|
2360
|
-
|
|
2420
|
+
y
|
|
2361
2421
|
);
|
|
2362
2422
|
} finally {
|
|
2363
2423
|
c(null);
|
|
@@ -2373,14 +2433,14 @@ function yr({
|
|
|
2373
2433
|
background: "#eff6ff",
|
|
2374
2434
|
border: "1px solid #bfdbfe",
|
|
2375
2435
|
borderRadius: 6,
|
|
2376
|
-
cursor:
|
|
2436
|
+
cursor: g ? "wait" : "pointer",
|
|
2377
2437
|
fontFamily: "inherit",
|
|
2378
2438
|
display: "inline-flex",
|
|
2379
2439
|
alignItems: "center",
|
|
2380
2440
|
gap: 8
|
|
2381
2441
|
},
|
|
2382
2442
|
children: [
|
|
2383
|
-
|
|
2443
|
+
g && /* @__PURE__ */ i(
|
|
2384
2444
|
"span",
|
|
2385
2445
|
{
|
|
2386
2446
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
@@ -2399,7 +2459,7 @@ function yr({
|
|
|
2399
2459
|
}
|
|
2400
2460
|
);
|
|
2401
2461
|
}
|
|
2402
|
-
function
|
|
2462
|
+
function hr(e) {
|
|
2403
2463
|
const r = [], t = /* @__PURE__ */ new Map();
|
|
2404
2464
|
return e.forEach((n, l) => {
|
|
2405
2465
|
let c = t.get(n.memoryTypeId);
|
|
@@ -2410,7 +2470,7 @@ function gr(e) {
|
|
|
2410
2470
|
}, t.set(n.memoryTypeId, c)), c.items.push({ item: n, flatIndex: l });
|
|
2411
2471
|
}), r.map((n) => t.get(n));
|
|
2412
2472
|
}
|
|
2413
|
-
function
|
|
2473
|
+
function fr({
|
|
2414
2474
|
group: e,
|
|
2415
2475
|
t: r,
|
|
2416
2476
|
lastInFlightIndex: t,
|
|
@@ -2422,7 +2482,7 @@ function pr({
|
|
|
2422
2482
|
const d = e.items.map((o) => o.item), m = d.some(
|
|
2423
2483
|
(o) => o.result == null && o.error == null
|
|
2424
2484
|
);
|
|
2425
|
-
return /* @__PURE__ */
|
|
2485
|
+
return /* @__PURE__ */ p(
|
|
2426
2486
|
b.div,
|
|
2427
2487
|
{
|
|
2428
2488
|
initial: { opacity: 0 },
|
|
@@ -2450,10 +2510,10 @@ function pr({
|
|
|
2450
2510
|
width: 32,
|
|
2451
2511
|
...m ? {} : { paddingTop: 2 }
|
|
2452
2512
|
},
|
|
2453
|
-
children:
|
|
2513
|
+
children: yr(d)
|
|
2454
2514
|
}
|
|
2455
2515
|
),
|
|
2456
|
-
/* @__PURE__ */
|
|
2516
|
+
/* @__PURE__ */ p(
|
|
2457
2517
|
"div",
|
|
2458
2518
|
{
|
|
2459
2519
|
style: {
|
|
@@ -2471,15 +2531,15 @@ function pr({
|
|
|
2471
2531
|
fontSize: 12,
|
|
2472
2532
|
color: "#888"
|
|
2473
2533
|
},
|
|
2474
|
-
children:
|
|
2534
|
+
children: T(r.memorySearchExploreQueryTypeLabel, {
|
|
2475
2535
|
name: e.memoryTypeName
|
|
2476
2536
|
})
|
|
2477
2537
|
}
|
|
2478
2538
|
),
|
|
2479
2539
|
e.items.map(({ item: o, flatIndex: a }) => {
|
|
2480
2540
|
var h;
|
|
2481
|
-
const u = o.result != null,
|
|
2482
|
-
return /* @__PURE__ */
|
|
2541
|
+
const u = o.result != null, y = o.error != null, f = a === t && n && !u && !y, g = l[a] === !0, x = ((h = o.result) == null ? void 0 : h.items) ?? [];
|
|
2542
|
+
return /* @__PURE__ */ p(
|
|
2483
2543
|
"div",
|
|
2484
2544
|
{
|
|
2485
2545
|
style: {
|
|
@@ -2489,7 +2549,7 @@ function pr({
|
|
|
2489
2549
|
minWidth: 0
|
|
2490
2550
|
},
|
|
2491
2551
|
children: [
|
|
2492
|
-
/* @__PURE__ */
|
|
2552
|
+
/* @__PURE__ */ p(
|
|
2493
2553
|
"div",
|
|
2494
2554
|
{
|
|
2495
2555
|
style: {
|
|
@@ -2513,7 +2573,7 @@ function pr({
|
|
|
2513
2573
|
minWidth: 0
|
|
2514
2574
|
},
|
|
2515
2575
|
children: f ? /* @__PURE__ */ i(
|
|
2516
|
-
|
|
2576
|
+
E,
|
|
2517
2577
|
{
|
|
2518
2578
|
text: o.query,
|
|
2519
2579
|
duration: 2.5,
|
|
@@ -2524,7 +2584,7 @@ function pr({
|
|
|
2524
2584
|
) : o.query
|
|
2525
2585
|
}
|
|
2526
2586
|
),
|
|
2527
|
-
/* @__PURE__ */
|
|
2587
|
+
/* @__PURE__ */ p(
|
|
2528
2588
|
"div",
|
|
2529
2589
|
{
|
|
2530
2590
|
style: {
|
|
@@ -2535,7 +2595,7 @@ function pr({
|
|
|
2535
2595
|
flexShrink: 0
|
|
2536
2596
|
},
|
|
2537
2597
|
children: [
|
|
2538
|
-
|
|
2598
|
+
pr(o, r),
|
|
2539
2599
|
u && /* @__PURE__ */ i(
|
|
2540
2600
|
"button",
|
|
2541
2601
|
{
|
|
@@ -2551,7 +2611,7 @@ function pr({
|
|
|
2551
2611
|
textDecoration: "underline",
|
|
2552
2612
|
fontFamily: "inherit"
|
|
2553
2613
|
},
|
|
2554
|
-
children:
|
|
2614
|
+
children: g ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
2555
2615
|
}
|
|
2556
2616
|
)
|
|
2557
2617
|
]
|
|
@@ -2560,10 +2620,10 @@ function pr({
|
|
|
2560
2620
|
]
|
|
2561
2621
|
}
|
|
2562
2622
|
),
|
|
2563
|
-
u &&
|
|
2564
|
-
|
|
2623
|
+
u && g && /* @__PURE__ */ i(
|
|
2624
|
+
gr,
|
|
2565
2625
|
{
|
|
2566
|
-
items:
|
|
2626
|
+
items: x,
|
|
2567
2627
|
queryRow: o,
|
|
2568
2628
|
onExploreQueryResultClick: s,
|
|
2569
2629
|
t: r
|
|
@@ -2581,7 +2641,7 @@ function pr({
|
|
|
2581
2641
|
}
|
|
2582
2642
|
);
|
|
2583
2643
|
}
|
|
2584
|
-
const
|
|
2644
|
+
const Sr = ({
|
|
2585
2645
|
data: e,
|
|
2586
2646
|
isLatest: r = !1,
|
|
2587
2647
|
durationSeconds: t,
|
|
@@ -2597,16 +2657,16 @@ const hr = ({
|
|
|
2597
2657
|
}));
|
|
2598
2658
|
}, []), m = D(() => {
|
|
2599
2659
|
let a = -1;
|
|
2600
|
-
return e.queries.forEach((u,
|
|
2601
|
-
u.result == null && u.error == null && (a =
|
|
2660
|
+
return e.queries.forEach((u, y) => {
|
|
2661
|
+
u.result == null && u.error == null && (a = y);
|
|
2602
2662
|
}), a;
|
|
2603
2663
|
}, [e.queries]), o = D(
|
|
2604
|
-
() =>
|
|
2664
|
+
() => hr(e.queries),
|
|
2605
2665
|
[e.queries]
|
|
2606
2666
|
);
|
|
2607
|
-
return /* @__PURE__ */
|
|
2667
|
+
return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
|
|
2608
2668
|
r && !t && e.queries.length === 0 ? /* @__PURE__ */ i(
|
|
2609
|
-
|
|
2669
|
+
E,
|
|
2610
2670
|
{
|
|
2611
2671
|
text: l.memorySearchExploringQueries,
|
|
2612
2672
|
duration: 2.5,
|
|
@@ -2615,7 +2675,7 @@ const hr = ({
|
|
|
2615
2675
|
shimmerColor: "#000"
|
|
2616
2676
|
}
|
|
2617
2677
|
) : o.map((a) => /* @__PURE__ */ i(
|
|
2618
|
-
|
|
2678
|
+
fr,
|
|
2619
2679
|
{
|
|
2620
2680
|
group: a,
|
|
2621
2681
|
t: l,
|
|
@@ -2636,13 +2696,13 @@ const hr = ({
|
|
|
2636
2696
|
marginTop: "4px",
|
|
2637
2697
|
fontStyle: "italic"
|
|
2638
2698
|
},
|
|
2639
|
-
children:
|
|
2699
|
+
children: T(l.tookSeconds, { n: t })
|
|
2640
2700
|
}
|
|
2641
2701
|
)
|
|
2642
2702
|
] });
|
|
2643
|
-
},
|
|
2703
|
+
}, xr = ({ data: e, onSearchResultClick: r, t }) => {
|
|
2644
2704
|
const n = e.response.items, l = !!r, [c, s] = v(null);
|
|
2645
|
-
return /* @__PURE__ */
|
|
2705
|
+
return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
|
|
2646
2706
|
/* @__PURE__ */ i(
|
|
2647
2707
|
b.div,
|
|
2648
2708
|
{
|
|
@@ -2667,24 +2727,24 @@ const hr = ({
|
|
|
2667
2727
|
gap: 0
|
|
2668
2728
|
},
|
|
2669
2729
|
children: n.map((d, m) => {
|
|
2670
|
-
const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a =
|
|
2730
|
+
const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = oe(
|
|
2671
2731
|
d.chunks
|
|
2672
2732
|
), u = [
|
|
2673
|
-
|
|
2674
|
-
|
|
2733
|
+
ie(d),
|
|
2734
|
+
T(t.scoreLabel, {
|
|
2675
2735
|
n: d.matchingChunkScore.toFixed(2)
|
|
2676
2736
|
}),
|
|
2677
|
-
a.length > 0 ?
|
|
2737
|
+
a.length > 0 ? te(a, t) : t.pagesNotAvailable
|
|
2678
2738
|
].filter(
|
|
2679
|
-
(
|
|
2680
|
-
),
|
|
2739
|
+
(x) => x != null && x !== ""
|
|
2740
|
+
), y = {
|
|
2681
2741
|
memoryId: d.memoryId,
|
|
2682
2742
|
memoryTitle: d.memoryTitle,
|
|
2683
2743
|
memoryTypeId: d.memoryTypeId,
|
|
2684
2744
|
memoryTypeName: d.memoryTypeName,
|
|
2685
2745
|
pageNumbers: a
|
|
2686
|
-
}, f = `${d.memoryId}-${m}`,
|
|
2687
|
-
return /* @__PURE__ */
|
|
2746
|
+
}, f = `${d.memoryId}-${m}`, g = c === f;
|
|
2747
|
+
return /* @__PURE__ */ p(
|
|
2688
2748
|
b.div,
|
|
2689
2749
|
{
|
|
2690
2750
|
initial: { opacity: 0 },
|
|
@@ -2701,7 +2761,7 @@ const hr = ({
|
|
|
2701
2761
|
minWidth: 0
|
|
2702
2762
|
},
|
|
2703
2763
|
children: [
|
|
2704
|
-
/* @__PURE__ */
|
|
2764
|
+
/* @__PURE__ */ p(
|
|
2705
2765
|
"div",
|
|
2706
2766
|
{
|
|
2707
2767
|
style: {
|
|
@@ -2733,7 +2793,7 @@ const hr = ({
|
|
|
2733
2793
|
whiteSpace: "pre-wrap",
|
|
2734
2794
|
wordBreak: "break-word"
|
|
2735
2795
|
},
|
|
2736
|
-
children:
|
|
2796
|
+
children: ne(d.chunks)
|
|
2737
2797
|
}
|
|
2738
2798
|
),
|
|
2739
2799
|
/* @__PURE__ */ i(
|
|
@@ -2751,16 +2811,16 @@ const hr = ({
|
|
|
2751
2811
|
]
|
|
2752
2812
|
}
|
|
2753
2813
|
),
|
|
2754
|
-
l && /* @__PURE__ */
|
|
2814
|
+
l && /* @__PURE__ */ p(
|
|
2755
2815
|
"button",
|
|
2756
2816
|
{
|
|
2757
2817
|
type: "button",
|
|
2758
|
-
"aria-busy":
|
|
2759
|
-
disabled:
|
|
2818
|
+
"aria-busy": g,
|
|
2819
|
+
disabled: g,
|
|
2760
2820
|
onClick: async () => {
|
|
2761
2821
|
s(f);
|
|
2762
2822
|
try {
|
|
2763
|
-
await r(
|
|
2823
|
+
await r(y);
|
|
2764
2824
|
} finally {
|
|
2765
2825
|
s(null);
|
|
2766
2826
|
}
|
|
@@ -2775,14 +2835,14 @@ const hr = ({
|
|
|
2775
2835
|
background: "#eff6ff",
|
|
2776
2836
|
border: "1px solid #bfdbfe",
|
|
2777
2837
|
borderRadius: 6,
|
|
2778
|
-
cursor:
|
|
2838
|
+
cursor: g ? "wait" : "pointer",
|
|
2779
2839
|
fontFamily: "inherit",
|
|
2780
2840
|
display: "inline-flex",
|
|
2781
2841
|
alignItems: "center",
|
|
2782
2842
|
gap: 8
|
|
2783
2843
|
},
|
|
2784
2844
|
children: [
|
|
2785
|
-
|
|
2845
|
+
g && /* @__PURE__ */ i(
|
|
2786
2846
|
"span",
|
|
2787
2847
|
{
|
|
2788
2848
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
@@ -2801,7 +2861,7 @@ const hr = ({
|
|
|
2801
2861
|
}
|
|
2802
2862
|
)
|
|
2803
2863
|
] });
|
|
2804
|
-
},
|
|
2864
|
+
}, Tr = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
2805
2865
|
b.div,
|
|
2806
2866
|
{
|
|
2807
2867
|
initial: { opacity: 0, y: -10 },
|
|
@@ -2824,7 +2884,7 @@ const hr = ({
|
|
|
2824
2884
|
}
|
|
2825
2885
|
)
|
|
2826
2886
|
}
|
|
2827
|
-
) }),
|
|
2887
|
+
) }), kr = ({
|
|
2828
2888
|
progressViewItems: e,
|
|
2829
2889
|
loadingText: r,
|
|
2830
2890
|
t,
|
|
@@ -2839,16 +2899,16 @@ const hr = ({
|
|
|
2839
2899
|
const d = (o) => {
|
|
2840
2900
|
const a = o.item.data;
|
|
2841
2901
|
if (a.taskType === "StreamingChatCompletion" && a.eventType === "Text")
|
|
2842
|
-
return /* @__PURE__ */ i(
|
|
2902
|
+
return /* @__PURE__ */ i(V, { text: a.text });
|
|
2843
2903
|
if (a.taskType === "StructuredChatCompletion" && a.eventType === "Completed")
|
|
2844
|
-
return /* @__PURE__ */ i(
|
|
2904
|
+
return /* @__PURE__ */ i(Be, { data: a });
|
|
2845
2905
|
if (a.taskType === "MemoryChat")
|
|
2846
2906
|
switch (a.eventType) {
|
|
2847
2907
|
case "Text":
|
|
2848
|
-
return /* @__PURE__ */ i(
|
|
2908
|
+
return /* @__PURE__ */ i(V, { text: a.text });
|
|
2849
2909
|
case "FindMemories":
|
|
2850
2910
|
return /* @__PURE__ */ i(
|
|
2851
|
-
|
|
2911
|
+
_e,
|
|
2852
2912
|
{
|
|
2853
2913
|
data: a,
|
|
2854
2914
|
isLatest: o.isLatest,
|
|
@@ -2858,7 +2918,7 @@ const hr = ({
|
|
|
2858
2918
|
);
|
|
2859
2919
|
case "FindMemoriesResult":
|
|
2860
2920
|
return /* @__PURE__ */ i(
|
|
2861
|
-
|
|
2921
|
+
Ge,
|
|
2862
2922
|
{
|
|
2863
2923
|
data: a,
|
|
2864
2924
|
t
|
|
@@ -2866,7 +2926,7 @@ const hr = ({
|
|
|
2866
2926
|
);
|
|
2867
2927
|
case "Search":
|
|
2868
2928
|
return /* @__PURE__ */ i(
|
|
2869
|
-
|
|
2929
|
+
He,
|
|
2870
2930
|
{
|
|
2871
2931
|
data: a,
|
|
2872
2932
|
isLatest: o.isLatest,
|
|
@@ -2876,7 +2936,7 @@ const hr = ({
|
|
|
2876
2936
|
);
|
|
2877
2937
|
case "FindSources":
|
|
2878
2938
|
return /* @__PURE__ */ i(
|
|
2879
|
-
|
|
2939
|
+
Qe,
|
|
2880
2940
|
{
|
|
2881
2941
|
data: a,
|
|
2882
2942
|
isLatest: o.isLatest,
|
|
@@ -2886,7 +2946,7 @@ const hr = ({
|
|
|
2886
2946
|
);
|
|
2887
2947
|
case "SourcesResult":
|
|
2888
2948
|
return /* @__PURE__ */ i(
|
|
2889
|
-
|
|
2949
|
+
je,
|
|
2890
2950
|
{
|
|
2891
2951
|
data: a,
|
|
2892
2952
|
onSourceClick: n,
|
|
@@ -2895,7 +2955,7 @@ const hr = ({
|
|
|
2895
2955
|
);
|
|
2896
2956
|
case "ExploreMemories":
|
|
2897
2957
|
return /* @__PURE__ */ i(
|
|
2898
|
-
|
|
2958
|
+
Xe,
|
|
2899
2959
|
{
|
|
2900
2960
|
data: a,
|
|
2901
2961
|
completed: o.completed,
|
|
@@ -2904,7 +2964,7 @@ const hr = ({
|
|
|
2904
2964
|
}
|
|
2905
2965
|
);
|
|
2906
2966
|
case "ChunkResult":
|
|
2907
|
-
return /* @__PURE__ */ i(
|
|
2967
|
+
return /* @__PURE__ */ i(Ze, { data: a, t });
|
|
2908
2968
|
case "Completed":
|
|
2909
2969
|
return null;
|
|
2910
2970
|
}
|
|
@@ -2912,7 +2972,7 @@ const hr = ({
|
|
|
2912
2972
|
switch (a.eventType) {
|
|
2913
2973
|
case "GeneratingQueries":
|
|
2914
2974
|
return /* @__PURE__ */ i(
|
|
2915
|
-
|
|
2975
|
+
dr,
|
|
2916
2976
|
{
|
|
2917
2977
|
data: a,
|
|
2918
2978
|
isLatest: o.isLatest,
|
|
@@ -2922,7 +2982,7 @@ const hr = ({
|
|
|
2922
2982
|
);
|
|
2923
2983
|
case "ExploreQueries":
|
|
2924
2984
|
return /* @__PURE__ */ i(
|
|
2925
|
-
|
|
2985
|
+
Sr,
|
|
2926
2986
|
{
|
|
2927
2987
|
data: a,
|
|
2928
2988
|
isLatest: o.isLatest,
|
|
@@ -2933,7 +2993,7 @@ const hr = ({
|
|
|
2933
2993
|
);
|
|
2934
2994
|
case "SearchMemoryTypes":
|
|
2935
2995
|
return /* @__PURE__ */ i(
|
|
2936
|
-
|
|
2996
|
+
tr,
|
|
2937
2997
|
{
|
|
2938
2998
|
data: a,
|
|
2939
2999
|
isLatest: o.isLatest,
|
|
@@ -2943,7 +3003,7 @@ const hr = ({
|
|
|
2943
3003
|
);
|
|
2944
3004
|
case "Completed":
|
|
2945
3005
|
return /* @__PURE__ */ i(
|
|
2946
|
-
|
|
3006
|
+
xr,
|
|
2947
3007
|
{
|
|
2948
3008
|
data: a,
|
|
2949
3009
|
onSearchResultClick: l,
|
|
@@ -2951,11 +3011,11 @@ const hr = ({
|
|
|
2951
3011
|
}
|
|
2952
3012
|
);
|
|
2953
3013
|
}
|
|
2954
|
-
return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ i(
|
|
3014
|
+
return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ i(Tr, { message: a.message }) : null;
|
|
2955
3015
|
};
|
|
2956
3016
|
if (e.length === 0)
|
|
2957
3017
|
return /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
|
|
2958
|
-
|
|
3018
|
+
E,
|
|
2959
3019
|
{
|
|
2960
3020
|
text: r ?? t.processingYourTask,
|
|
2961
3021
|
duration: 1.5,
|
|
@@ -2975,7 +3035,7 @@ const hr = ({
|
|
|
2975
3035
|
(h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "ExploreQueries"
|
|
2976
3036
|
) : !0;
|
|
2977
3037
|
});
|
|
2978
|
-
return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(
|
|
3038
|
+
return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(J, { children: m.map((o, a) => /* @__PURE__ */ i(
|
|
2979
3039
|
b.div,
|
|
2980
3040
|
{
|
|
2981
3041
|
id: `agent-task-progress-item-${o.item.progressItemId}`,
|
|
@@ -2990,7 +3050,7 @@ const hr = ({
|
|
|
2990
3050
|
},
|
|
2991
3051
|
o.item.progressItemId
|
|
2992
3052
|
)) }) });
|
|
2993
|
-
},
|
|
3053
|
+
}, Rr = ({
|
|
2994
3054
|
agentTask: e,
|
|
2995
3055
|
mode: r = "verbose",
|
|
2996
3056
|
language: t,
|
|
@@ -2998,15 +3058,15 @@ const hr = ({
|
|
|
2998
3058
|
onSearchResultClick: l,
|
|
2999
3059
|
onExploreQueryResultClick: c
|
|
3000
3060
|
}) => {
|
|
3001
|
-
const s =
|
|
3061
|
+
const s = ze(e), d = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : t ?? "en", m = $e(d);
|
|
3002
3062
|
return r === "simple" ? /* @__PURE__ */ i(
|
|
3003
|
-
|
|
3063
|
+
Ne,
|
|
3004
3064
|
{
|
|
3005
3065
|
progressViewItems: s,
|
|
3006
3066
|
t: m
|
|
3007
3067
|
}
|
|
3008
3068
|
) : /* @__PURE__ */ i(
|
|
3009
|
-
|
|
3069
|
+
kr,
|
|
3010
3070
|
{
|
|
3011
3071
|
progressViewItems: s,
|
|
3012
3072
|
loadingText: e.loadingText,
|
|
@@ -3018,10 +3078,10 @@ const hr = ({
|
|
|
3018
3078
|
);
|
|
3019
3079
|
};
|
|
3020
3080
|
export {
|
|
3021
|
-
|
|
3081
|
+
Rr as AgentTaskProgress,
|
|
3022
3082
|
z as Checkmark,
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3083
|
+
Ar as FencyProvider,
|
|
3084
|
+
xr as MemorySearchCompletedResults,
|
|
3085
|
+
U as XMark,
|
|
3086
|
+
Fr as useAgentTasks
|
|
3027
3087
|
};
|