@fencyai/react 0.1.176 → 0.1.177
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/AgentTaskEventDataSchemas.d.ts +258 -0
- package/dist/agent-task/AgentTaskEventDataSchemas.d.ts.map +1 -0
- package/dist/agent-task/AgentTaskProgressVerbose.d.ts.map +1 -1
- package/dist/agent-task/ProgressItemErrorBoundary.d.ts +19 -0
- package/dist/agent-task/ProgressItemErrorBoundary.d.ts.map +1 -0
- package/dist/agent-task/data-types/MemoryChatGoogleSearch.d.ts +6 -4
- package/dist/agent-task/data-types/MemoryChatGoogleSearch.d.ts.map +1 -1
- package/dist/agent-task/data-types/MemoryChatScrapeWebsites.d.ts +16 -0
- package/dist/agent-task/data-types/MemoryChatScrapeWebsites.d.ts.map +1 -0
- package/dist/agent-task/data-types/{MemoryChatScrape.d.ts → MemoryChatThinking.d.ts} +4 -4
- package/dist/agent-task/data-types/MemoryChatThinking.d.ts.map +1 -0
- package/dist/agent-task/data-types/StructuredChatCompletionJson.d.ts.map +1 -1
- package/dist/agent-task/translations.d.ts +5 -0
- package/dist/agent-task/translations.d.ts.map +1 -1
- package/dist/hooks/useStream/toStreamData.d.ts.map +1 -1
- package/dist/index.js +1682 -1233
- package/package.json +4 -4
- package/dist/agent-task/data-types/MemoryChatGoogleSearchResult.d.ts +0 -14
- package/dist/agent-task/data-types/MemoryChatGoogleSearchResult.d.ts.map +0 -1
- package/dist/agent-task/data-types/MemoryChatScrape.d.ts.map +0 -1
- package/dist/agent-task/data-types/MemoryChatScrapeResult.d.ts +0 -16
- package/dist/agent-task/data-types/MemoryChatScrapeResult.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,78 +1,79 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createStream as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { jsxs as g, jsx as o, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { createStream as xe, isStreamTimeoutEvent as be, isStreamNotFoundEvent as ke, isAgentTaskProgressItemUpdatedEvent as ve, createAgentTask as Ce } from "@fencyai/js";
|
|
3
|
+
import we, { createContext as Ie, useState as E, useRef as D, useEffect as P, useCallback as O, useContext as Ee, useMemo as z } from "react";
|
|
4
|
+
import { z as a } from "zod";
|
|
5
|
+
import { motion as I, useInView as Me, AnimatePresence as Re } from "motion/react";
|
|
6
|
+
import Fe from "react-markdown";
|
|
7
|
+
import { Prism as ue } from "react-syntax-highlighter";
|
|
8
|
+
import Ae from "remark-gfm";
|
|
9
|
+
import './assets/index.css';const me = Ie(
|
|
9
10
|
void 0
|
|
10
11
|
);
|
|
11
|
-
async function
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
for (; !(
|
|
15
|
-
r(
|
|
12
|
+
async function Pe(e, r) {
|
|
13
|
+
const n = e.getReader();
|
|
14
|
+
let t;
|
|
15
|
+
for (; !(t = await n.read()).done; )
|
|
16
|
+
r(t.value);
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
let r,
|
|
19
|
-
return function(
|
|
20
|
-
r === void 0 ? (r =
|
|
21
|
-
const
|
|
18
|
+
function De(e) {
|
|
19
|
+
let r, n, t, i = !1;
|
|
20
|
+
return function(s) {
|
|
21
|
+
r === void 0 ? (r = s, n = 0, t = -1) : r = ze(r, s);
|
|
22
|
+
const c = r.length;
|
|
22
23
|
let m = 0;
|
|
23
|
-
for (;
|
|
24
|
-
i && (r[
|
|
25
|
-
let
|
|
26
|
-
for (;
|
|
27
|
-
switch (r[
|
|
24
|
+
for (; n < c; ) {
|
|
25
|
+
i && (r[n] === 10 && (m = ++n), i = !1);
|
|
26
|
+
let y = -1;
|
|
27
|
+
for (; n < c && y === -1; ++n)
|
|
28
|
+
switch (r[n]) {
|
|
28
29
|
case 58:
|
|
29
|
-
|
|
30
|
+
t === -1 && (t = n - m);
|
|
30
31
|
break;
|
|
31
32
|
case 13:
|
|
32
33
|
i = !0;
|
|
33
34
|
case 10:
|
|
34
|
-
|
|
35
|
+
y = n;
|
|
35
36
|
break;
|
|
36
37
|
}
|
|
37
|
-
if (
|
|
38
|
+
if (y === -1)
|
|
38
39
|
break;
|
|
39
|
-
e(r.subarray(m,
|
|
40
|
+
e(r.subarray(m, y), t), m = n, t = -1;
|
|
40
41
|
}
|
|
41
|
-
m ===
|
|
42
|
+
m === c ? r = void 0 : m !== 0 && (r = r.subarray(m), n -= m);
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
let
|
|
45
|
+
function Le(e, r, n) {
|
|
46
|
+
let t = re();
|
|
46
47
|
const i = new TextDecoder();
|
|
47
|
-
return function(
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
else if (
|
|
51
|
-
const m = i.decode(
|
|
48
|
+
return function(s, c) {
|
|
49
|
+
if (s.length === 0)
|
|
50
|
+
n == null || n(t), t = re();
|
|
51
|
+
else if (c > 0) {
|
|
52
|
+
const m = i.decode(s.subarray(0, c)), y = c + (s[c + 1] === 32 ? 2 : 1), d = i.decode(s.subarray(y));
|
|
52
53
|
switch (m) {
|
|
53
54
|
case "data":
|
|
54
|
-
|
|
55
|
-
` +
|
|
55
|
+
t.data = t.data ? t.data + `
|
|
56
|
+
` + d : d;
|
|
56
57
|
break;
|
|
57
58
|
case "event":
|
|
58
|
-
|
|
59
|
+
t.event = d;
|
|
59
60
|
break;
|
|
60
61
|
case "id":
|
|
61
|
-
e(
|
|
62
|
+
e(t.id = d);
|
|
62
63
|
break;
|
|
63
64
|
case "retry":
|
|
64
|
-
const
|
|
65
|
-
isNaN(
|
|
65
|
+
const u = parseInt(d, 10);
|
|
66
|
+
isNaN(u) || r(t.retry = u);
|
|
66
67
|
break;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
73
|
-
return
|
|
72
|
+
function ze(e, r) {
|
|
73
|
+
const n = new Uint8Array(e.length + r.length);
|
|
74
|
+
return n.set(e), n.set(r, e.length), n;
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function re() {
|
|
76
77
|
return {
|
|
77
78
|
data: "",
|
|
78
79
|
event: "",
|
|
@@ -80,68 +81,68 @@ function Z() {
|
|
|
80
81
|
retry: void 0
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
for (var
|
|
84
|
+
var We = function(e, r) {
|
|
85
|
+
var n = {};
|
|
86
|
+
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && r.indexOf(t) < 0 && (n[t] = e[t]);
|
|
86
87
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
87
|
-
for (var i = 0,
|
|
88
|
-
r.indexOf(
|
|
89
|
-
return
|
|
88
|
+
for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
|
|
89
|
+
r.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (n[t[i]] = e[t[i]]);
|
|
90
|
+
return n;
|
|
90
91
|
};
|
|
91
|
-
const
|
|
92
|
-
function
|
|
93
|
-
var { signal:
|
|
94
|
-
return new Promise((
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
let
|
|
98
|
-
function
|
|
99
|
-
|
|
92
|
+
const $ = "text/event-stream", Ne = 1e3, te = "last-event-id";
|
|
93
|
+
function Oe(e, r) {
|
|
94
|
+
var { signal: n, headers: t, onopen: i, onmessage: l, onclose: s, onerror: c, openWhenHidden: m, fetch: y } = r, d = We(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
95
|
+
return new Promise((u, p) => {
|
|
96
|
+
const h = Object.assign({}, t);
|
|
97
|
+
h.accept || (h.accept = $);
|
|
98
|
+
let f;
|
|
99
|
+
function S() {
|
|
100
|
+
f.abort(), document.hidden || w();
|
|
100
101
|
}
|
|
101
|
-
m || document.addEventListener("visibilitychange",
|
|
102
|
-
let
|
|
102
|
+
m || document.addEventListener("visibilitychange", S);
|
|
103
|
+
let x = Ne, b = 0;
|
|
103
104
|
function v() {
|
|
104
|
-
document.removeEventListener("visibilitychange",
|
|
105
|
+
document.removeEventListener("visibilitychange", S), window.clearTimeout(b), f.abort();
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
-
v(),
|
|
107
|
+
n == null || n.addEventListener("abort", () => {
|
|
108
|
+
v(), u();
|
|
108
109
|
});
|
|
109
|
-
const
|
|
110
|
-
async function
|
|
111
|
-
var
|
|
112
|
-
|
|
110
|
+
const C = y ?? window.fetch, M = i ?? Be;
|
|
111
|
+
async function w() {
|
|
112
|
+
var k;
|
|
113
|
+
f = new AbortController();
|
|
113
114
|
try {
|
|
114
|
-
const W = await
|
|
115
|
-
await
|
|
116
|
-
|
|
117
|
-
}, (
|
|
118
|
-
|
|
119
|
-
}, l))),
|
|
115
|
+
const W = await C(e, Object.assign(Object.assign({}, d), { headers: h, signal: f.signal }));
|
|
116
|
+
await M(W), await Pe(W.body, De(Le((A) => {
|
|
117
|
+
A ? h[te] = A : delete h[te];
|
|
118
|
+
}, (A) => {
|
|
119
|
+
x = A;
|
|
120
|
+
}, l))), s == null || s(), v(), u();
|
|
120
121
|
} catch (W) {
|
|
121
|
-
if (!
|
|
122
|
+
if (!f.signal.aborted)
|
|
122
123
|
try {
|
|
123
|
-
const
|
|
124
|
-
window.clearTimeout(b), b = window.setTimeout(
|
|
125
|
-
} catch (
|
|
126
|
-
v(),
|
|
124
|
+
const A = (k = c == null ? void 0 : c(W)) !== null && k !== void 0 ? k : x;
|
|
125
|
+
window.clearTimeout(b), b = window.setTimeout(w, A);
|
|
126
|
+
} catch (A) {
|
|
127
|
+
v(), p(A);
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
+
w();
|
|
131
132
|
});
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
+
function Be(e) {
|
|
134
135
|
const r = e.headers.get("content-type");
|
|
135
|
-
if (!(r != null && r.startsWith(
|
|
136
|
-
throw new Error(`Expected content-type to be ${
|
|
136
|
+
if (!(r != null && r.startsWith($)))
|
|
137
|
+
throw new Error(`Expected content-type to be ${$}, Actual: ${r}`);
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
-
const r = atob(e),
|
|
140
|
-
for (let
|
|
141
|
-
t
|
|
142
|
-
return new TextDecoder("utf-8").decode(
|
|
139
|
+
function ne(e) {
|
|
140
|
+
const r = atob(e), n = new Uint8Array(r.length);
|
|
141
|
+
for (let t = 0; t < r.length; t++)
|
|
142
|
+
n[t] = r.charCodeAt(t);
|
|
143
|
+
return new TextDecoder("utf-8").decode(n);
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
+
function je() {
|
|
145
146
|
return `
|
|
146
147
|
var connections = new Map();
|
|
147
148
|
|
|
@@ -287,10 +288,10 @@ self.onmessage = function (e) {
|
|
|
287
288
|
};
|
|
288
289
|
`.trim();
|
|
289
290
|
}
|
|
290
|
-
function
|
|
291
|
+
function oe(e) {
|
|
291
292
|
return e instanceof Error ? e.message : typeof e == "string" ? e : "Unknown stream error";
|
|
292
293
|
}
|
|
293
|
-
class
|
|
294
|
+
class $e {
|
|
294
295
|
constructor(r) {
|
|
295
296
|
this.activeConnections = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.worker = null, this.workerBlobUrl = null, this.workerSupported = !1, this.fency = r, this.tryInitWorker();
|
|
296
297
|
}
|
|
@@ -298,28 +299,28 @@ class We {
|
|
|
298
299
|
try {
|
|
299
300
|
if (typeof Worker > "u" || typeof Blob > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function" || typeof ReadableStream > "u")
|
|
300
301
|
return;
|
|
301
|
-
const r =
|
|
302
|
+
const r = je(), n = new Blob([r], { type: "application/javascript" }), t = URL.createObjectURL(n), i = new Worker(t);
|
|
302
303
|
i.onmessage = (l) => {
|
|
303
304
|
this.handleWorkerMessage(l.data);
|
|
304
305
|
}, i.onerror = (l) => {
|
|
305
306
|
console.error("Fency stream worker error:", l.message);
|
|
306
|
-
}, this.worker = i, this.workerBlobUrl =
|
|
307
|
+
}, this.worker = i, this.workerBlobUrl = t, this.workerSupported = !0;
|
|
307
308
|
} catch {
|
|
308
309
|
this.workerSupported = !1, this.worker = null, this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null);
|
|
309
310
|
}
|
|
310
311
|
}
|
|
311
312
|
handleWorkerMessage(r) {
|
|
312
313
|
if (!r || typeof r != "object") return;
|
|
313
|
-
const
|
|
314
|
-
switch (
|
|
314
|
+
const n = r;
|
|
315
|
+
switch (n.type) {
|
|
315
316
|
case "message":
|
|
316
|
-
if (
|
|
317
|
-
const
|
|
318
|
-
this.broadcast(
|
|
317
|
+
if (n.data && n.streamId) {
|
|
318
|
+
const t = ne(n.data);
|
|
319
|
+
this.broadcast(t, n.streamId);
|
|
319
320
|
}
|
|
320
321
|
break;
|
|
321
322
|
case "error":
|
|
322
|
-
|
|
323
|
+
n.streamId && (this.activeConnections.delete(n.streamId), this.broadcastError(n.streamId, n.error));
|
|
323
324
|
break;
|
|
324
325
|
}
|
|
325
326
|
}
|
|
@@ -328,50 +329,50 @@ class We {
|
|
|
328
329
|
* Creates new connections and removes old ones.
|
|
329
330
|
*/
|
|
330
331
|
updateStreams(r) {
|
|
331
|
-
r.forEach((
|
|
332
|
-
const i =
|
|
333
|
-
this.activeConnections.has(i) || this.connectStream(
|
|
332
|
+
r.forEach((t) => {
|
|
333
|
+
const i = t.stream.id;
|
|
334
|
+
this.activeConnections.has(i) || this.connectStream(t);
|
|
334
335
|
});
|
|
335
|
-
const
|
|
336
|
-
this.activeConnections.forEach((
|
|
337
|
-
|
|
336
|
+
const n = new Set(r.map((t) => t.stream.id));
|
|
337
|
+
this.activeConnections.forEach((t, i) => {
|
|
338
|
+
n.has(i) || (t.abort(), this.activeConnections.delete(i));
|
|
338
339
|
});
|
|
339
340
|
}
|
|
340
341
|
connectStream(r) {
|
|
341
342
|
this.workerSupported && this.worker ? this.connectStreamInWorker(r) : this.connectStreamOnMainThread(r);
|
|
342
343
|
}
|
|
343
344
|
connectStreamInWorker(r) {
|
|
344
|
-
const
|
|
345
|
-
accept:
|
|
345
|
+
const n = r.stream.id, t = `${this.fency.baseUrl}/sse/streams/${n}`, i = new AbortController(), l = {
|
|
346
|
+
accept: $,
|
|
346
347
|
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
347
348
|
"X-Fency-Stream-Token": r.stream.token
|
|
348
349
|
};
|
|
349
|
-
this.activeConnections.set(
|
|
350
|
+
this.activeConnections.set(n, {
|
|
350
351
|
abort: () => {
|
|
351
|
-
var
|
|
352
|
-
i.abort(), (
|
|
352
|
+
var s;
|
|
353
|
+
i.abort(), (s = this.worker) == null || s.postMessage({ command: "disconnect", streamId: n });
|
|
353
354
|
}
|
|
354
|
-
}), this.startWorkerStream(
|
|
355
|
+
}), this.startWorkerStream(n, t, l, i);
|
|
355
356
|
}
|
|
356
|
-
async startWorkerStream(r,
|
|
357
|
+
async startWorkerStream(r, n, t, i) {
|
|
357
358
|
const l = this.worker;
|
|
358
359
|
if (!l) return;
|
|
359
|
-
const
|
|
360
|
-
i.signal.aborted || (this.activeConnections.delete(r), this.broadcastError(r,
|
|
360
|
+
const s = (c) => {
|
|
361
|
+
i.signal.aborted || (this.activeConnections.delete(r), this.broadcastError(r, c));
|
|
361
362
|
};
|
|
362
363
|
try {
|
|
363
|
-
const
|
|
364
|
+
const c = await fetch(n, {
|
|
364
365
|
method: "GET",
|
|
365
|
-
headers:
|
|
366
|
+
headers: t,
|
|
366
367
|
signal: i.signal
|
|
367
368
|
});
|
|
368
|
-
if (!
|
|
369
|
-
|
|
369
|
+
if (!c.ok) {
|
|
370
|
+
c.status >= 400 && c.status < 500 && c.status !== 429 ? s(`Client error ${c.status}`) : s(`HTTP ${c.status}`);
|
|
370
371
|
return;
|
|
371
372
|
}
|
|
372
|
-
const m =
|
|
373
|
+
const m = c.body;
|
|
373
374
|
if (!m) {
|
|
374
|
-
|
|
375
|
+
s("No response body");
|
|
375
376
|
return;
|
|
376
377
|
}
|
|
377
378
|
if (!this.activeConnections.has(r)) {
|
|
@@ -383,36 +384,36 @@ class We {
|
|
|
383
384
|
{ command: "start", streamId: r, readableStream: m },
|
|
384
385
|
[m]
|
|
385
386
|
);
|
|
386
|
-
} catch (
|
|
387
|
+
} catch (c) {
|
|
387
388
|
if (i.signal.aborted) return;
|
|
388
|
-
|
|
389
|
+
s(oe(c));
|
|
389
390
|
}
|
|
390
391
|
}
|
|
391
392
|
connectStreamOnMainThread(r) {
|
|
392
|
-
const
|
|
393
|
-
this.activeConnections.set(
|
|
394
|
-
abort: () =>
|
|
393
|
+
const n = r.stream.id, t = new AbortController();
|
|
394
|
+
this.activeConnections.set(n, {
|
|
395
|
+
abort: () => t.abort()
|
|
395
396
|
});
|
|
396
|
-
const i = `${this.fency.baseUrl}/sse/streams/${
|
|
397
|
+
const i = `${this.fency.baseUrl}/sse/streams/${n}`, l = {
|
|
397
398
|
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
398
399
|
"X-Fency-Stream-Token": r.stream.token
|
|
399
400
|
};
|
|
400
|
-
|
|
401
|
+
Oe(i, {
|
|
401
402
|
headers: l,
|
|
402
|
-
signal:
|
|
403
|
+
signal: t.signal,
|
|
403
404
|
openWhenHidden: !0,
|
|
404
|
-
onopen: async (
|
|
405
|
-
if (!
|
|
406
|
-
throw this.activeConnections.delete(
|
|
405
|
+
onopen: async (s) => {
|
|
406
|
+
if (!s.ok && s.status >= 400 && s.status < 500 && s.status !== 429)
|
|
407
|
+
throw this.activeConnections.delete(n), new Error(`Client error ${s.status}`);
|
|
407
408
|
},
|
|
408
|
-
onmessage: (
|
|
409
|
-
if (
|
|
410
|
-
const
|
|
411
|
-
this.broadcast(
|
|
409
|
+
onmessage: (s) => {
|
|
410
|
+
if (s.data) {
|
|
411
|
+
const c = ne(s.data);
|
|
412
|
+
this.broadcast(c, n);
|
|
412
413
|
}
|
|
413
414
|
},
|
|
414
|
-
onerror: (
|
|
415
|
-
throw console.error("EventSource error for stream",
|
|
415
|
+
onerror: (s) => {
|
|
416
|
+
throw console.error("EventSource error for stream", n, ":", s), this.activeConnections.delete(n), this.broadcastError(n, oe(s)), s;
|
|
416
417
|
},
|
|
417
418
|
onclose() {
|
|
418
419
|
}
|
|
@@ -422,19 +423,19 @@ class We {
|
|
|
422
423
|
* Subscribe to events from all active streams.
|
|
423
424
|
* Returns an unsubscribe function.
|
|
424
425
|
*/
|
|
425
|
-
subscribe(r,
|
|
426
|
-
return this.subscribers.set(r,
|
|
426
|
+
subscribe(r, n) {
|
|
427
|
+
return this.subscribers.set(r, n), () => {
|
|
427
428
|
this.subscribers.delete(r);
|
|
428
429
|
};
|
|
429
430
|
}
|
|
430
|
-
broadcast(r,
|
|
431
|
-
this.subscribers.forEach((
|
|
432
|
-
|
|
431
|
+
broadcast(r, n) {
|
|
432
|
+
this.subscribers.forEach((t) => {
|
|
433
|
+
t.onMessage(r, n);
|
|
433
434
|
});
|
|
434
435
|
}
|
|
435
|
-
broadcastError(r,
|
|
436
|
-
this.subscribers.forEach((
|
|
437
|
-
|
|
436
|
+
broadcastError(r, n) {
|
|
437
|
+
this.subscribers.forEach((t) => {
|
|
438
|
+
t.onError(r, n);
|
|
438
439
|
});
|
|
439
440
|
}
|
|
440
441
|
/**
|
|
@@ -451,457 +452,714 @@ class We {
|
|
|
451
452
|
this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null), this.workerSupported = !1, this.subscribers.clear();
|
|
452
453
|
}
|
|
453
454
|
}
|
|
454
|
-
const
|
|
455
|
+
const He = 48e4, Ue = 3e5, ae = (e) => {
|
|
455
456
|
const r = Date.now();
|
|
456
|
-
return e.filter((
|
|
457
|
+
return e.filter((n) => r - n.createdAt < He);
|
|
457
458
|
};
|
|
458
|
-
function
|
|
459
|
-
const [
|
|
459
|
+
function Lt({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
|
|
460
|
+
const [t, i] = E(
|
|
460
461
|
null
|
|
461
|
-
), [l,
|
|
462
|
-
|
|
463
|
-
e.then((
|
|
464
|
-
i(
|
|
465
|
-
}).catch((
|
|
466
|
-
m(
|
|
462
|
+
), [l, s] = E(!0), [c, m] = E(null), [y, d] = E([]), u = D(null), p = D(null);
|
|
463
|
+
P(() => {
|
|
464
|
+
e.then((x) => {
|
|
465
|
+
i(x), s(!1);
|
|
466
|
+
}).catch((x) => {
|
|
467
|
+
m(x), s(!1);
|
|
467
468
|
});
|
|
468
|
-
}, [e]),
|
|
469
|
-
|
|
470
|
-
}, [
|
|
471
|
-
|
|
472
|
-
}, [
|
|
473
|
-
var
|
|
474
|
-
(
|
|
475
|
-
}, []),
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
-
const v =
|
|
469
|
+
}, [e]), P(() => {
|
|
470
|
+
t && !p.current && (p.current = new $e(t));
|
|
471
|
+
}, [t]), P(() => {
|
|
472
|
+
p.current && p.current.updateStreams(y);
|
|
473
|
+
}, [y]), P(() => () => {
|
|
474
|
+
var x;
|
|
475
|
+
(x = p.current) == null || x.cleanup();
|
|
476
|
+
}, []), P(() => {
|
|
477
|
+
const x = setInterval(() => {
|
|
478
|
+
d((b) => {
|
|
479
|
+
const v = ae(b);
|
|
479
480
|
return v.length !== b.length ? v : b;
|
|
480
481
|
});
|
|
481
482
|
}, 6e4);
|
|
482
|
-
return () => clearInterval(
|
|
483
|
+
return () => clearInterval(x);
|
|
483
484
|
}, []);
|
|
484
|
-
const
|
|
485
|
-
async (
|
|
486
|
-
if (
|
|
487
|
-
return
|
|
488
|
-
const b = Date.now(), v =
|
|
489
|
-
if (v && b - v.createdAt <
|
|
485
|
+
const h = O(
|
|
486
|
+
async (x = Ue) => {
|
|
487
|
+
if (u.current)
|
|
488
|
+
return u.current;
|
|
489
|
+
const b = Date.now(), v = y.length > 0 ? y[y.length - 1] : null;
|
|
490
|
+
if (v && b - v.createdAt < x)
|
|
490
491
|
return v.stream;
|
|
491
|
-
const
|
|
492
|
-
if (!
|
|
492
|
+
const C = (async () => {
|
|
493
|
+
if (!t)
|
|
493
494
|
throw new Error("Fency instance not initialized");
|
|
494
|
-
const
|
|
495
|
-
pk:
|
|
496
|
-
baseUrl:
|
|
497
|
-
clientToken: (
|
|
495
|
+
const M = await r(), w = await xe({
|
|
496
|
+
pk: t.publishableKey,
|
|
497
|
+
baseUrl: t.baseUrl,
|
|
498
|
+
clientToken: (M == null ? void 0 : M.clientToken) ?? ""
|
|
498
499
|
});
|
|
499
|
-
if (
|
|
500
|
-
const
|
|
501
|
-
stream:
|
|
500
|
+
if (w.type === "success") {
|
|
501
|
+
const k = {
|
|
502
|
+
stream: w.stream,
|
|
502
503
|
createdAt: Date.now()
|
|
503
504
|
};
|
|
504
|
-
return
|
|
505
|
-
const
|
|
506
|
-
return
|
|
507
|
-
}),
|
|
505
|
+
return d((W) => {
|
|
506
|
+
const A = [...W, k];
|
|
507
|
+
return ae(A);
|
|
508
|
+
}), u.current = null, w.stream;
|
|
508
509
|
} else
|
|
509
|
-
throw
|
|
510
|
+
throw u.current = null, new Error("Failed to create stream");
|
|
510
511
|
})();
|
|
511
|
-
return
|
|
512
|
+
return u.current = C, C;
|
|
512
513
|
},
|
|
513
|
-
[
|
|
514
|
+
[t, y]
|
|
514
515
|
);
|
|
515
|
-
if (
|
|
516
|
-
return /* @__PURE__ */
|
|
516
|
+
if (c)
|
|
517
|
+
return /* @__PURE__ */ g("div", { children: [
|
|
517
518
|
"Fency error: ",
|
|
518
|
-
|
|
519
|
+
c.message
|
|
519
520
|
] });
|
|
520
|
-
if (!
|
|
521
|
+
if (!t)
|
|
521
522
|
return null;
|
|
522
|
-
const
|
|
523
|
-
fency:
|
|
523
|
+
const f = y.length > 0 ? y[y.length - 1] : null, S = {
|
|
524
|
+
fency: t,
|
|
524
525
|
loading: l,
|
|
525
|
-
error:
|
|
526
|
-
activeStreams:
|
|
527
|
-
latestStream:
|
|
528
|
-
eventManager:
|
|
529
|
-
getOrCreateStream:
|
|
526
|
+
error: c,
|
|
527
|
+
activeStreams: y,
|
|
528
|
+
latestStream: f,
|
|
529
|
+
eventManager: p.current,
|
|
530
|
+
getOrCreateStream: h
|
|
530
531
|
};
|
|
531
|
-
return /* @__PURE__ */ o(
|
|
532
|
+
return /* @__PURE__ */ o(me.Provider, { value: S, children: n });
|
|
532
533
|
}
|
|
533
|
-
function
|
|
534
|
-
const e =
|
|
534
|
+
function pe() {
|
|
535
|
+
const e = Ee(me);
|
|
535
536
|
if (e === void 0)
|
|
536
537
|
throw new Error("useFencyContext must be used within a FencyProvider");
|
|
537
538
|
return e;
|
|
538
539
|
}
|
|
539
|
-
const
|
|
540
|
+
const ye = a.object({
|
|
541
|
+
role: a.enum(["SYSTEM", "USER", "ASSISTANT"]),
|
|
542
|
+
content: a.string()
|
|
543
|
+
}).passthrough(), Q = a.object({
|
|
544
|
+
memoryId: a.string(),
|
|
545
|
+
memoryTitle: a.string(),
|
|
546
|
+
memoryTypeId: a.string(),
|
|
547
|
+
memoryTypeName: a.string(),
|
|
548
|
+
matchingChunkScore: a.number(),
|
|
549
|
+
matchingChunk: a.object({
|
|
550
|
+
chunkNumber: a.number(),
|
|
551
|
+
pageNumbers: a.array(a.number()),
|
|
552
|
+
content: a.string()
|
|
553
|
+
}).passthrough(),
|
|
554
|
+
chunks: a.array(
|
|
555
|
+
a.object({
|
|
556
|
+
chunkNumber: a.number(),
|
|
557
|
+
pageNumbers: a.array(a.number()),
|
|
558
|
+
content: a.string(),
|
|
559
|
+
relation: a.enum([
|
|
560
|
+
"MATCH",
|
|
561
|
+
"CONTEXT_BEFORE",
|
|
562
|
+
"CONTEXT_AFTER"
|
|
563
|
+
])
|
|
564
|
+
}).passthrough()
|
|
565
|
+
)
|
|
566
|
+
}).passthrough(), he = a.object({
|
|
567
|
+
memoryId: a.string(),
|
|
568
|
+
memoryTitle: a.string()
|
|
569
|
+
}).passthrough(), _e = a.object({
|
|
570
|
+
taskType: a.literal("StreamingChatCompletion"),
|
|
571
|
+
eventType: a.literal("Text"),
|
|
572
|
+
text: a.string()
|
|
573
|
+
}).passthrough(), Ge = a.object({
|
|
574
|
+
taskType: a.literal("StreamingChatCompletion"),
|
|
575
|
+
eventType: a.literal("Completed"),
|
|
576
|
+
response: a.object({
|
|
577
|
+
textResponse: a.string(),
|
|
578
|
+
messages: a.array(ye)
|
|
579
|
+
}).passthrough()
|
|
580
|
+
}).passthrough(), qe = a.object({
|
|
581
|
+
taskType: a.literal("StreamingChatCompletion"),
|
|
582
|
+
eventType: a.literal("Error"),
|
|
583
|
+
message: a.string()
|
|
584
|
+
}).passthrough(), Qe = a.object({
|
|
585
|
+
taskType: a.literal("StructuredChatCompletion"),
|
|
586
|
+
eventType: a.literal("Completed"),
|
|
587
|
+
response: a.object({
|
|
588
|
+
jsonResponse: a.string(),
|
|
589
|
+
messages: a.array(ye)
|
|
590
|
+
}).passthrough()
|
|
591
|
+
}).passthrough(), Ke = a.object({
|
|
592
|
+
taskType: a.literal("StructuredChatCompletion"),
|
|
593
|
+
eventType: a.literal("Error"),
|
|
594
|
+
message: a.string()
|
|
595
|
+
}).passthrough(), Xe = a.object({
|
|
596
|
+
taskType: a.literal("MemoryChat"),
|
|
597
|
+
eventType: a.literal("Text"),
|
|
598
|
+
text: a.string()
|
|
599
|
+
}).passthrough(), Ve = a.object({
|
|
600
|
+
taskType: a.literal("MemoryChat"),
|
|
601
|
+
eventType: a.literal("Thinking")
|
|
602
|
+
}).passthrough(), Ye = a.object({
|
|
603
|
+
taskType: a.literal("MemoryChat"),
|
|
604
|
+
eventType: a.literal("Search"),
|
|
605
|
+
queryDescription: a.string(),
|
|
606
|
+
memories: a.array(he).optional()
|
|
607
|
+
}).passthrough(), Je = a.object({
|
|
608
|
+
taskType: a.literal("MemoryChat"),
|
|
609
|
+
eventType: a.literal("FindMemories"),
|
|
610
|
+
titles: a.array(a.string())
|
|
611
|
+
}).passthrough(), Ze = a.object({
|
|
612
|
+
taskType: a.literal("MemoryChat"),
|
|
613
|
+
eventType: a.literal("FindMemoriesResult"),
|
|
614
|
+
memories: a.array(he)
|
|
615
|
+
}).passthrough(), er = a.enum([
|
|
616
|
+
"downloading",
|
|
617
|
+
"downloaded",
|
|
618
|
+
"analyzing",
|
|
619
|
+
"summarizing"
|
|
620
|
+
]), rr = a.object({
|
|
621
|
+
taskType: a.literal("MemoryChat"),
|
|
622
|
+
eventType: a.literal("ScrapeWebsites"),
|
|
623
|
+
input: a.object({
|
|
624
|
+
query: a.string(),
|
|
625
|
+
urls: a.array(a.string())
|
|
626
|
+
}).passthrough(),
|
|
627
|
+
results: a.array(
|
|
628
|
+
a.object({
|
|
629
|
+
url: a.string(),
|
|
630
|
+
status: er.optional(),
|
|
631
|
+
summary: a.string().optional(),
|
|
632
|
+
error: a.string().optional()
|
|
633
|
+
}).passthrough()
|
|
634
|
+
).optional()
|
|
635
|
+
}).passthrough(), tr = a.object({
|
|
636
|
+
taskType: a.literal("MemoryChat"),
|
|
637
|
+
eventType: a.literal("GoogleSearch"),
|
|
638
|
+
input: a.object({
|
|
639
|
+
query: a.string(),
|
|
640
|
+
countryCode: a.string().optional()
|
|
641
|
+
}).passthrough(),
|
|
642
|
+
results: a.array(
|
|
643
|
+
a.object({
|
|
644
|
+
rank: a.number(),
|
|
645
|
+
title: a.string(),
|
|
646
|
+
link: a.string(),
|
|
647
|
+
description: a.string()
|
|
648
|
+
}).passthrough()
|
|
649
|
+
).optional()
|
|
650
|
+
}).passthrough(), nr = a.object({
|
|
651
|
+
taskType: a.literal("MemoryChat"),
|
|
652
|
+
eventType: a.literal("FindSources")
|
|
653
|
+
}).passthrough(), or = a.object({
|
|
654
|
+
taskType: a.literal("MemoryChat"),
|
|
655
|
+
eventType: a.literal("ExploreMemories"),
|
|
656
|
+
memories: a.array(
|
|
657
|
+
a.object({
|
|
658
|
+
memoryId: a.string(),
|
|
659
|
+
memoryTitle: a.string(),
|
|
660
|
+
result: a.string().optional(),
|
|
661
|
+
error: a.string().optional()
|
|
662
|
+
}).passthrough()
|
|
663
|
+
)
|
|
664
|
+
}).passthrough(), ar = a.object({
|
|
665
|
+
taskType: a.literal("MemoryChat"),
|
|
666
|
+
eventType: a.literal("ChunkResults"),
|
|
667
|
+
items: a.array(Q)
|
|
668
|
+
}).passthrough(), ir = a.object({
|
|
669
|
+
taskType: a.literal("MemoryChat"),
|
|
670
|
+
eventType: a.literal("SourcesResult"),
|
|
671
|
+
sources: a.array(
|
|
672
|
+
a.object({
|
|
673
|
+
memoryId: a.string(),
|
|
674
|
+
memoryTitle: a.string(),
|
|
675
|
+
memoryTypeId: a.string(),
|
|
676
|
+
memoryTypeName: a.string(),
|
|
677
|
+
pageNumbers: a.array(a.number())
|
|
678
|
+
}).passthrough()
|
|
679
|
+
)
|
|
680
|
+
}).passthrough(), sr = a.object({
|
|
681
|
+
taskType: a.literal("MemoryChat"),
|
|
682
|
+
eventType: a.literal("Completed"),
|
|
683
|
+
response: a.object({
|
|
684
|
+
textResponse: a.string(),
|
|
685
|
+
sources: a.array(
|
|
686
|
+
a.object({
|
|
687
|
+
memoryId: a.string(),
|
|
688
|
+
memoryTitle: a.string(),
|
|
689
|
+
memoryTypeId: a.string(),
|
|
690
|
+
memoryTypeName: a.string(),
|
|
691
|
+
pageNumbers: a.array(a.number())
|
|
692
|
+
}).passthrough()
|
|
693
|
+
)
|
|
694
|
+
}).passthrough()
|
|
695
|
+
}).passthrough(), lr = a.object({
|
|
696
|
+
taskType: a.literal("MemoryChat"),
|
|
697
|
+
eventType: a.literal("Error"),
|
|
698
|
+
message: a.string()
|
|
699
|
+
}).passthrough(), cr = a.object({
|
|
700
|
+
taskType: a.literal("MemorySearch"),
|
|
701
|
+
eventType: a.literal("GeneratingQueries"),
|
|
702
|
+
memoryTypes: a.array(
|
|
703
|
+
a.object({
|
|
704
|
+
memoryTypeId: a.string(),
|
|
705
|
+
memoryTypeName: a.string(),
|
|
706
|
+
reasoning: a.string().optional(),
|
|
707
|
+
reasoningCompleted: a.boolean().optional(),
|
|
708
|
+
queries: a.array(a.object({ query: a.string() }).passthrough()).optional()
|
|
709
|
+
}).passthrough()
|
|
710
|
+
)
|
|
711
|
+
}).passthrough(), dr = a.object({
|
|
712
|
+
taskType: a.literal("MemorySearch"),
|
|
713
|
+
eventType: a.literal("ExploreQueries"),
|
|
714
|
+
queries: a.array(
|
|
715
|
+
a.object({
|
|
716
|
+
query: a.string(),
|
|
717
|
+
memoryTypeId: a.string(),
|
|
718
|
+
memoryTypeName: a.string(),
|
|
719
|
+
result: a.object({
|
|
720
|
+
numberOfChunks: a.number(),
|
|
721
|
+
highestChunkScore: a.number(),
|
|
722
|
+
items: a.array(Q)
|
|
723
|
+
}).passthrough().optional(),
|
|
724
|
+
error: a.string().optional()
|
|
725
|
+
}).passthrough()
|
|
726
|
+
)
|
|
727
|
+
}).passthrough(), ur = a.object({
|
|
728
|
+
taskType: a.literal("MemorySearch"),
|
|
729
|
+
eventType: a.literal("SearchMemoryTypes"),
|
|
730
|
+
memoryTypes: a.array(
|
|
731
|
+
a.object({
|
|
732
|
+
memoryTypeId: a.string(),
|
|
733
|
+
memoryTypeName: a.string(),
|
|
734
|
+
result: a.object({
|
|
735
|
+
numberOfChunks: a.number(),
|
|
736
|
+
highestChunkScore: a.number()
|
|
737
|
+
}).passthrough().optional(),
|
|
738
|
+
error: a.string().optional()
|
|
739
|
+
}).passthrough()
|
|
740
|
+
)
|
|
741
|
+
}).passthrough(), mr = a.object({
|
|
742
|
+
taskType: a.literal("MemorySearch"),
|
|
743
|
+
eventType: a.literal("Completed"),
|
|
744
|
+
response: a.object({
|
|
745
|
+
query: a.string(),
|
|
746
|
+
items: a.array(Q)
|
|
747
|
+
}).passthrough()
|
|
748
|
+
}).passthrough(), pr = a.object({
|
|
749
|
+
taskType: a.literal("MemorySearch"),
|
|
750
|
+
eventType: a.literal("Error"),
|
|
751
|
+
message: a.string()
|
|
752
|
+
}).passthrough(), yr = a.union([
|
|
753
|
+
_e,
|
|
754
|
+
Ge,
|
|
755
|
+
qe,
|
|
756
|
+
Qe,
|
|
757
|
+
Ke,
|
|
758
|
+
Xe,
|
|
759
|
+
Ve,
|
|
760
|
+
Ye,
|
|
761
|
+
Je,
|
|
762
|
+
Ze,
|
|
763
|
+
rr,
|
|
764
|
+
tr,
|
|
765
|
+
nr,
|
|
766
|
+
or,
|
|
767
|
+
ar,
|
|
768
|
+
ir,
|
|
769
|
+
sr,
|
|
770
|
+
lr,
|
|
771
|
+
cr,
|
|
772
|
+
dr,
|
|
773
|
+
ur,
|
|
774
|
+
mr,
|
|
775
|
+
pr
|
|
776
|
+
]);
|
|
777
|
+
function hr(e) {
|
|
778
|
+
const r = yr.safeParse(e);
|
|
779
|
+
return r.success ? r.data : (console.warn(
|
|
780
|
+
"[fency] Dropping unrecognized or malformed agent task event:",
|
|
781
|
+
r.error.format(),
|
|
782
|
+
e
|
|
783
|
+
), null);
|
|
784
|
+
}
|
|
785
|
+
const gr = (e) => {
|
|
540
786
|
try {
|
|
541
787
|
const r = JSON.parse(e);
|
|
542
|
-
return
|
|
788
|
+
return fr(r);
|
|
543
789
|
} catch (r) {
|
|
544
790
|
return console.error("Error parsing message:", r), null;
|
|
545
791
|
}
|
|
546
|
-
},
|
|
792
|
+
}, fr = (e) => be(e) ? Sr(e) : ke(e) ? Tr(e) : ve(e) ? xr(e) : null, Sr = (e) => ({
|
|
547
793
|
type: "STREAM_TIMEOUT",
|
|
548
794
|
streamId: e.streamId,
|
|
549
795
|
timestamp: e.timestamp
|
|
550
|
-
}),
|
|
796
|
+
}), Tr = (e) => ({
|
|
551
797
|
type: "STREAM_NOT_FOUND",
|
|
552
798
|
streamId: e.streamId,
|
|
553
799
|
timestamp: e.timestamp
|
|
554
|
-
}),
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
800
|
+
}), xr = (e) => {
|
|
801
|
+
let r;
|
|
802
|
+
try {
|
|
803
|
+
r = JSON.parse(e.data);
|
|
804
|
+
} catch (t) {
|
|
805
|
+
return console.warn(
|
|
806
|
+
"[fency] Invalid JSON in AGENT_TASK_PROGRESS_ITEM_UPDATED data payload:",
|
|
807
|
+
t
|
|
808
|
+
), null;
|
|
809
|
+
}
|
|
810
|
+
const n = hr(r);
|
|
811
|
+
return n === null ? null : {
|
|
812
|
+
type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
|
|
813
|
+
streamId: e.streamId,
|
|
814
|
+
agentTaskId: e.agentTaskId,
|
|
815
|
+
progressItemId: e.progressItemId,
|
|
816
|
+
timestamp: e.timestamp,
|
|
817
|
+
createdAt: e.createdAt,
|
|
818
|
+
data: n
|
|
819
|
+
};
|
|
820
|
+
}, br = (e) => {
|
|
821
|
+
const r = pe(), [n, t] = E(null), i = D(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
|
|
822
|
+
return P(() => {
|
|
565
823
|
if (!r.eventManager) return;
|
|
566
|
-
const
|
|
567
|
-
onMessage: (m,
|
|
568
|
-
var
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
571
|
-
switch (
|
|
824
|
+
const s = {
|
|
825
|
+
onMessage: (m, y) => {
|
|
826
|
+
var u, p, h;
|
|
827
|
+
const d = gr(m);
|
|
828
|
+
if (d)
|
|
829
|
+
switch (d.type) {
|
|
572
830
|
case "STREAM_TIMEOUT":
|
|
573
|
-
(
|
|
831
|
+
(u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, d);
|
|
574
832
|
break;
|
|
575
833
|
case "STREAM_NOT_FOUND":
|
|
576
|
-
(
|
|
834
|
+
(p = e == null ? void 0 : e.onStreamNotFound) == null || p.call(e, d);
|
|
577
835
|
break;
|
|
578
836
|
case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
|
|
579
|
-
(
|
|
837
|
+
(h = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || h.call(e, d);
|
|
580
838
|
break;
|
|
581
839
|
}
|
|
582
840
|
},
|
|
583
|
-
onError: (m,
|
|
584
|
-
var
|
|
585
|
-
(
|
|
841
|
+
onError: (m, y) => {
|
|
842
|
+
var d;
|
|
843
|
+
(d = e == null ? void 0 : e.onStreamError) == null || d.call(e, {
|
|
586
844
|
streamId: m,
|
|
587
845
|
error: {
|
|
588
846
|
code: "UnknownError",
|
|
589
|
-
message:
|
|
847
|
+
message: y ?? "Unknown error in useStream"
|
|
590
848
|
}
|
|
591
849
|
});
|
|
592
850
|
}
|
|
593
851
|
};
|
|
594
852
|
return r.eventManager.subscribe(
|
|
595
853
|
i.current,
|
|
596
|
-
|
|
854
|
+
s
|
|
597
855
|
);
|
|
598
856
|
}, [r.eventManager, e]), {
|
|
599
857
|
createStream: async () => {
|
|
600
858
|
try {
|
|
601
|
-
const
|
|
602
|
-
return
|
|
859
|
+
const s = await r.getOrCreateStream();
|
|
860
|
+
return t(s), {
|
|
603
861
|
type: "success",
|
|
604
|
-
stream:
|
|
862
|
+
stream: s
|
|
605
863
|
};
|
|
606
|
-
} catch (
|
|
864
|
+
} catch (s) {
|
|
607
865
|
return {
|
|
608
866
|
type: "error",
|
|
609
867
|
error: {
|
|
610
868
|
code: "UnknownError",
|
|
611
|
-
message:
|
|
869
|
+
message: s instanceof Error ? s.message : "Failed to create stream"
|
|
612
870
|
}
|
|
613
871
|
};
|
|
614
872
|
}
|
|
615
873
|
},
|
|
616
|
-
stream:
|
|
874
|
+
stream: n
|
|
617
875
|
};
|
|
618
|
-
},
|
|
619
|
-
const r =
|
|
620
|
-
(
|
|
621
|
-
|
|
622
|
-
const
|
|
876
|
+
}, zt = (e) => {
|
|
877
|
+
const r = pe(), [n, t] = E([]), i = D(/* @__PURE__ */ new Set()), l = D(/* @__PURE__ */ new Map()), s = O(
|
|
878
|
+
(d, u) => {
|
|
879
|
+
t((p) => {
|
|
880
|
+
const h = [], f = p.map((S) => {
|
|
623
881
|
var b;
|
|
624
|
-
if (
|
|
625
|
-
const
|
|
626
|
-
return
|
|
882
|
+
if (S.streamId !== d || !S.loading) return S;
|
|
883
|
+
const x = (b = S.confirmedData) == null ? void 0 : b.taskId;
|
|
884
|
+
return x && h.push(x), { ...S, loading: !1, error: u };
|
|
627
885
|
});
|
|
628
|
-
for (const
|
|
629
|
-
i.current.delete(
|
|
630
|
-
const
|
|
631
|
-
|
|
886
|
+
for (const S of h) {
|
|
887
|
+
i.current.delete(S);
|
|
888
|
+
const x = l.current.get(S);
|
|
889
|
+
x && (l.current.delete(S), x({ type: "error", error: u }));
|
|
632
890
|
}
|
|
633
|
-
return
|
|
891
|
+
return f;
|
|
634
892
|
});
|
|
635
893
|
},
|
|
636
894
|
[]
|
|
637
|
-
), { createStream:
|
|
638
|
-
onAgentTaskProgressItemUpdated: (
|
|
639
|
-
var
|
|
640
|
-
if (!i.current.has(
|
|
641
|
-
const
|
|
642
|
-
if (
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
var
|
|
647
|
-
if (((
|
|
895
|
+
), { createStream: c } = br({
|
|
896
|
+
onAgentTaskProgressItemUpdated: (d) => {
|
|
897
|
+
var h;
|
|
898
|
+
if (!i.current.has(d.agentTaskId)) return;
|
|
899
|
+
const u = d.data;
|
|
900
|
+
if (u.taskType === "StreamingChatCompletion" && u.eventType === "Completed" || u.taskType === "StructuredChatCompletion" && u.eventType === "Completed" || u.taskType === "MemoryChat" && u.eventType === "Completed" || u.taskType === "MemorySearch" && u.eventType === "Completed") {
|
|
901
|
+
const f = u.taskType === "MemorySearch" && u.eventType === "Completed" || u.taskType === "StructuredChatCompletion" && u.eventType === "Completed";
|
|
902
|
+
t(
|
|
903
|
+
f ? (x) => x.map((b) => {
|
|
904
|
+
var M;
|
|
905
|
+
if (((M = b.confirmedData) == null ? void 0 : M.taskId) !== d.agentTaskId)
|
|
648
906
|
return b;
|
|
649
|
-
const
|
|
650
|
-
(
|
|
907
|
+
const C = b.progressItems.some(
|
|
908
|
+
(w) => w.progressItemId === d.progressItemId
|
|
651
909
|
) ? b.progressItems.map(
|
|
652
|
-
(
|
|
653
|
-
) : [...b.progressItems,
|
|
910
|
+
(w) => w.progressItemId === d.progressItemId ? d : w
|
|
911
|
+
) : [...b.progressItems, d];
|
|
654
912
|
return {
|
|
655
913
|
...b,
|
|
656
|
-
progressItems:
|
|
914
|
+
progressItems: C,
|
|
657
915
|
loading: !1
|
|
658
916
|
};
|
|
659
|
-
}) : (
|
|
917
|
+
}) : (x) => x.map(
|
|
660
918
|
(b) => {
|
|
661
919
|
var v;
|
|
662
|
-
return ((v = b.confirmedData) == null ? void 0 : v.taskId) ===
|
|
920
|
+
return ((v = b.confirmedData) == null ? void 0 : v.taskId) === d.agentTaskId ? { ...b, loading: !1 } : b;
|
|
663
921
|
}
|
|
664
922
|
)
|
|
665
923
|
);
|
|
666
|
-
const
|
|
667
|
-
|
|
924
|
+
const S = l.current.get(
|
|
925
|
+
d.agentTaskId
|
|
668
926
|
);
|
|
669
|
-
|
|
927
|
+
S && (l.current.delete(d.agentTaskId), S({
|
|
670
928
|
type: "success",
|
|
671
|
-
streamId:
|
|
672
|
-
agentTaskId:
|
|
673
|
-
response:
|
|
929
|
+
streamId: d.streamId,
|
|
930
|
+
agentTaskId: d.agentTaskId,
|
|
931
|
+
response: u
|
|
674
932
|
}));
|
|
675
933
|
return;
|
|
676
934
|
}
|
|
677
|
-
(
|
|
678
|
-
(
|
|
935
|
+
(h = e.onAgentTaskProgressItemUpdated) == null || h.call(e, d), t(
|
|
936
|
+
(f) => f.map((S) => {
|
|
679
937
|
var v;
|
|
680
|
-
if (((v =
|
|
681
|
-
return
|
|
682
|
-
const b =
|
|
683
|
-
(
|
|
684
|
-
) ?
|
|
685
|
-
(
|
|
686
|
-
) : [...
|
|
687
|
-
return { ...
|
|
938
|
+
if (((v = S.confirmedData) == null ? void 0 : v.taskId) !== d.agentTaskId)
|
|
939
|
+
return S;
|
|
940
|
+
const b = S.progressItems.some(
|
|
941
|
+
(C) => C.progressItemId === d.progressItemId
|
|
942
|
+
) ? S.progressItems.map(
|
|
943
|
+
(C) => C.progressItemId === d.progressItemId ? d : C
|
|
944
|
+
) : [...S.progressItems, d];
|
|
945
|
+
return { ...S, progressItems: b };
|
|
688
946
|
})
|
|
689
947
|
);
|
|
690
948
|
},
|
|
691
|
-
onStreamError: (
|
|
692
|
-
var
|
|
693
|
-
(
|
|
949
|
+
onStreamError: (d) => {
|
|
950
|
+
var u;
|
|
951
|
+
(u = e == null ? void 0 : e.onStreamError) == null || u.call(e, d), s(d.streamId, d.error);
|
|
694
952
|
},
|
|
695
|
-
onStreamNotFound: (
|
|
696
|
-
var
|
|
697
|
-
(
|
|
953
|
+
onStreamNotFound: (d) => {
|
|
954
|
+
var u;
|
|
955
|
+
(u = e == null ? void 0 : e.onStreamNotFound) == null || u.call(e, d), s(d.streamId, {
|
|
698
956
|
code: "StreamNotFound",
|
|
699
957
|
message: "Stream not found"
|
|
700
958
|
});
|
|
701
959
|
},
|
|
702
|
-
onStreamTimeout: (
|
|
703
|
-
var
|
|
704
|
-
(
|
|
960
|
+
onStreamTimeout: (d) => {
|
|
961
|
+
var u;
|
|
962
|
+
(u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, d), s(d.streamId, {
|
|
705
963
|
code: "StreamTimeout",
|
|
706
964
|
message: "Stream timed out"
|
|
707
965
|
});
|
|
708
966
|
}
|
|
709
|
-
}), m =
|
|
710
|
-
async (
|
|
711
|
-
var
|
|
712
|
-
const
|
|
713
|
-
if (
|
|
967
|
+
}), m = O(
|
|
968
|
+
async (d, u) => {
|
|
969
|
+
var S;
|
|
970
|
+
const p = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, h = (u == null ? void 0 : u.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
|
|
971
|
+
if (h === void 0)
|
|
714
972
|
throw new Error(
|
|
715
973
|
"fetchCreateAgentTaskClientToken must be provided either in useAgentTasks props or in createAgentTask options"
|
|
716
974
|
);
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
719
|
-
const
|
|
720
|
-
taskKey:
|
|
721
|
-
streamId:
|
|
722
|
-
triggeredAt:
|
|
975
|
+
const f = await c();
|
|
976
|
+
if (f.type === "success") {
|
|
977
|
+
const x = (/* @__PURE__ */ new Date()).toISOString(), b = {
|
|
978
|
+
taskKey: p,
|
|
979
|
+
streamId: f.stream.id,
|
|
980
|
+
triggeredAt: x,
|
|
723
981
|
confirmedData: null,
|
|
724
982
|
error: null,
|
|
725
|
-
params:
|
|
983
|
+
params: d,
|
|
726
984
|
progressItems: [],
|
|
727
985
|
loading: !0,
|
|
728
|
-
loadingText:
|
|
986
|
+
loadingText: u == null ? void 0 : u.loadingText
|
|
729
987
|
};
|
|
730
|
-
|
|
988
|
+
t((v) => [...v, b]), (S = u == null ? void 0 : u.onTaskRegistered) == null || S.call(u, b);
|
|
731
989
|
try {
|
|
732
|
-
const { clientToken: v } = await
|
|
990
|
+
const { clientToken: v } = await h(), C = await Ce({
|
|
733
991
|
pk: r.fency.publishableKey,
|
|
734
992
|
baseUrl: r.fency.baseUrl,
|
|
735
993
|
clientToken: v,
|
|
736
|
-
streamToken:
|
|
994
|
+
streamToken: f.stream.token,
|
|
737
995
|
request: {
|
|
738
|
-
streamingChatCompletionTask:
|
|
739
|
-
messages:
|
|
740
|
-
model:
|
|
741
|
-
...
|
|
742
|
-
temperature:
|
|
996
|
+
streamingChatCompletionTask: d.type === "StreamingChatCompletion" ? {
|
|
997
|
+
messages: d.messages,
|
|
998
|
+
model: d.model,
|
|
999
|
+
...d.temperature !== void 0 ? {
|
|
1000
|
+
temperature: d.temperature
|
|
743
1001
|
} : {},
|
|
744
|
-
...
|
|
1002
|
+
...d.topP !== void 0 ? { topP: d.topP } : {}
|
|
745
1003
|
} : void 0,
|
|
746
|
-
structuredChatCompletionTask:
|
|
747
|
-
messages:
|
|
748
|
-
jsonSchema:
|
|
749
|
-
model:
|
|
750
|
-
...
|
|
751
|
-
temperature:
|
|
1004
|
+
structuredChatCompletionTask: d.type === "StructuredChatCompletion" ? {
|
|
1005
|
+
messages: d.messages,
|
|
1006
|
+
jsonSchema: d.jsonSchema,
|
|
1007
|
+
model: d.model,
|
|
1008
|
+
...d.temperature !== void 0 ? {
|
|
1009
|
+
temperature: d.temperature
|
|
752
1010
|
} : {},
|
|
753
|
-
...
|
|
1011
|
+
...d.topP !== void 0 ? { topP: d.topP } : {}
|
|
754
1012
|
} : void 0,
|
|
755
|
-
memoryChatTask:
|
|
756
|
-
messages:
|
|
757
|
-
model:
|
|
758
|
-
language:
|
|
759
|
-
chunkLimit:
|
|
760
|
-
memoryScanLimit:
|
|
1013
|
+
memoryChatTask: d.type === "MemoryChat" ? {
|
|
1014
|
+
messages: d.messages,
|
|
1015
|
+
model: d.model,
|
|
1016
|
+
language: d.language ?? "en",
|
|
1017
|
+
chunkLimit: d.chunkLimit ?? 10,
|
|
1018
|
+
memoryScanLimit: d.memoryScanLimit ?? 3
|
|
761
1019
|
} : void 0,
|
|
762
|
-
memorySearchTask:
|
|
763
|
-
query:
|
|
764
|
-
model:
|
|
765
|
-
language:
|
|
766
|
-
chunkLimit:
|
|
767
|
-
contextExpansion:
|
|
768
|
-
...
|
|
769
|
-
queryExpansion:
|
|
1020
|
+
memorySearchTask: d.type === "MemorySearch" ? {
|
|
1021
|
+
query: d.query,
|
|
1022
|
+
model: d.model,
|
|
1023
|
+
language: d.language ?? "en",
|
|
1024
|
+
chunkLimit: d.chunkLimit ?? 10,
|
|
1025
|
+
contextExpansion: d.contextExpansion,
|
|
1026
|
+
...d.queryExpansion != null ? {
|
|
1027
|
+
queryExpansion: d.queryExpansion
|
|
770
1028
|
} : {}
|
|
771
1029
|
} : void 0
|
|
772
1030
|
}
|
|
773
1031
|
});
|
|
774
|
-
if (
|
|
1032
|
+
if (C.type === "success" && C.agentTask)
|
|
775
1033
|
return i.current.add(
|
|
776
|
-
|
|
777
|
-
),
|
|
778
|
-
...
|
|
1034
|
+
C.agentTask.id
|
|
1035
|
+
), t((M) => [
|
|
1036
|
+
...M.filter((w) => w.taskKey !== p),
|
|
779
1037
|
{
|
|
780
|
-
taskKey:
|
|
781
|
-
streamId:
|
|
1038
|
+
taskKey: p,
|
|
1039
|
+
streamId: f.stream.id,
|
|
782
1040
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
783
|
-
taskId:
|
|
784
|
-
createdAt:
|
|
1041
|
+
taskId: C.agentTask.id,
|
|
1042
|
+
createdAt: C.agentTask.createdAt,
|
|
785
1043
|
error: null,
|
|
786
|
-
params:
|
|
1044
|
+
params: d,
|
|
787
1045
|
progressItems: [],
|
|
788
1046
|
loading: !0,
|
|
789
|
-
loadingText:
|
|
1047
|
+
loadingText: u == null ? void 0 : u.loadingText,
|
|
790
1048
|
confirmedData: {
|
|
791
|
-
taskId:
|
|
792
|
-
createdAt:
|
|
1049
|
+
taskId: C.agentTask.id,
|
|
1050
|
+
createdAt: C.agentTask.createdAt
|
|
793
1051
|
}
|
|
794
1052
|
}
|
|
795
1053
|
]), await new Promise(
|
|
796
|
-
(
|
|
1054
|
+
(M) => {
|
|
797
1055
|
l.current.set(
|
|
798
|
-
|
|
799
|
-
|
|
1056
|
+
C.agentTask.id,
|
|
1057
|
+
M
|
|
800
1058
|
);
|
|
801
1059
|
}
|
|
802
1060
|
);
|
|
803
|
-
if (
|
|
804
|
-
return
|
|
805
|
-
...
|
|
1061
|
+
if (C.type === "error")
|
|
1062
|
+
return t((M) => [
|
|
1063
|
+
...M.filter((w) => w.taskKey !== p),
|
|
806
1064
|
{
|
|
807
|
-
taskKey:
|
|
1065
|
+
taskKey: p,
|
|
808
1066
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
809
|
-
streamId:
|
|
810
|
-
params:
|
|
811
|
-
error:
|
|
1067
|
+
streamId: f.stream.id,
|
|
1068
|
+
params: d,
|
|
1069
|
+
error: C.error,
|
|
812
1070
|
progressItems: [],
|
|
813
1071
|
loading: !1,
|
|
814
|
-
loadingText:
|
|
1072
|
+
loadingText: u == null ? void 0 : u.loadingText,
|
|
815
1073
|
confirmedData: null
|
|
816
1074
|
}
|
|
817
1075
|
]), {
|
|
818
1076
|
type: "error",
|
|
819
|
-
error:
|
|
1077
|
+
error: C.error
|
|
820
1078
|
};
|
|
821
1079
|
{
|
|
822
|
-
const
|
|
1080
|
+
const M = {
|
|
823
1081
|
message: "No response received",
|
|
824
1082
|
code: "UnknownError"
|
|
825
1083
|
};
|
|
826
|
-
return
|
|
827
|
-
...
|
|
1084
|
+
return t((w) => [
|
|
1085
|
+
...w.filter((k) => k.taskKey !== p),
|
|
828
1086
|
{
|
|
829
|
-
taskKey:
|
|
1087
|
+
taskKey: p,
|
|
830
1088
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
831
|
-
streamId:
|
|
832
|
-
error:
|
|
833
|
-
params:
|
|
1089
|
+
streamId: f.stream.id,
|
|
1090
|
+
error: M,
|
|
1091
|
+
params: d,
|
|
834
1092
|
progressItems: [],
|
|
835
1093
|
loading: !1,
|
|
836
|
-
loadingText:
|
|
1094
|
+
loadingText: u == null ? void 0 : u.loadingText,
|
|
837
1095
|
confirmedData: null
|
|
838
1096
|
}
|
|
839
1097
|
]), {
|
|
840
1098
|
type: "error",
|
|
841
|
-
error:
|
|
1099
|
+
error: M
|
|
842
1100
|
};
|
|
843
1101
|
}
|
|
844
1102
|
} catch (v) {
|
|
845
|
-
const
|
|
1103
|
+
const C = {
|
|
846
1104
|
code: "UnknownError",
|
|
847
1105
|
message: v instanceof Error ? v.message : "Unknown error during agent task creation"
|
|
848
1106
|
};
|
|
849
|
-
return
|
|
850
|
-
...
|
|
1107
|
+
return t((M) => [
|
|
1108
|
+
...M.filter((w) => w.taskKey !== p),
|
|
851
1109
|
{
|
|
852
|
-
taskKey:
|
|
1110
|
+
taskKey: p,
|
|
853
1111
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
854
|
-
streamId:
|
|
855
|
-
params:
|
|
856
|
-
error:
|
|
1112
|
+
streamId: f.stream.id,
|
|
1113
|
+
params: d,
|
|
1114
|
+
error: C,
|
|
857
1115
|
progressItems: [],
|
|
858
1116
|
loading: !1,
|
|
859
|
-
loadingText:
|
|
1117
|
+
loadingText: u == null ? void 0 : u.loadingText,
|
|
860
1118
|
confirmedData: null
|
|
861
1119
|
}
|
|
862
1120
|
]), {
|
|
863
1121
|
type: "error",
|
|
864
|
-
error:
|
|
1122
|
+
error: C
|
|
865
1123
|
};
|
|
866
1124
|
}
|
|
867
1125
|
} else
|
|
868
|
-
return console.error(
|
|
1126
|
+
return console.error(f.error), f;
|
|
869
1127
|
},
|
|
870
1128
|
[
|
|
871
1129
|
r,
|
|
872
|
-
|
|
1130
|
+
c,
|
|
873
1131
|
e.fetchCreateAgentTaskClientToken,
|
|
874
|
-
|
|
1132
|
+
s
|
|
875
1133
|
]
|
|
876
|
-
),
|
|
877
|
-
if (
|
|
878
|
-
return [...
|
|
879
|
-
}, [
|
|
880
|
-
return
|
|
1134
|
+
), y = z(() => {
|
|
1135
|
+
if (n.length !== 0)
|
|
1136
|
+
return [...n].sort((d, u) => new Date(u.triggeredAt).getTime() - new Date(d.triggeredAt).getTime())[0];
|
|
1137
|
+
}, [n]);
|
|
1138
|
+
return P(() => () => {
|
|
881
1139
|
i.current.clear(), l.current.clear();
|
|
882
1140
|
}, []), {
|
|
883
|
-
agentTasks:
|
|
1141
|
+
agentTasks: n,
|
|
884
1142
|
createAgentTask: m,
|
|
885
|
-
latest:
|
|
1143
|
+
latest: y
|
|
886
1144
|
};
|
|
887
1145
|
};
|
|
888
|
-
function
|
|
889
|
-
return e.progressItems.map((r,
|
|
890
|
-
const
|
|
1146
|
+
function kr(e) {
|
|
1147
|
+
return e.progressItems.map((r, n) => {
|
|
1148
|
+
const t = e.progressItems[n + 1], i = t != null;
|
|
891
1149
|
let l;
|
|
892
|
-
if (
|
|
893
|
-
const
|
|
894
|
-
l = Math.round((
|
|
1150
|
+
if (t != null && t.createdAt) {
|
|
1151
|
+
const s = new Date(r.createdAt).getTime(), c = new Date(t.createdAt).getTime();
|
|
1152
|
+
l = Math.round((c - s) / 1e3);
|
|
895
1153
|
}
|
|
896
1154
|
return {
|
|
897
1155
|
item: r,
|
|
898
1156
|
completed: i,
|
|
899
|
-
isLatest:
|
|
1157
|
+
isLatest: n === e.progressItems.length - 1,
|
|
900
1158
|
durationSeconds: l
|
|
901
1159
|
};
|
|
902
1160
|
});
|
|
903
1161
|
}
|
|
904
|
-
const
|
|
1162
|
+
const ge = {
|
|
905
1163
|
'code[class*="language-"]': {
|
|
906
1164
|
color: "#f8f8f2",
|
|
907
1165
|
background: "none",
|
|
@@ -1052,57 +1310,61 @@ const me = {
|
|
|
1052
1310
|
italic: {
|
|
1053
1311
|
fontStyle: "italic"
|
|
1054
1312
|
}
|
|
1055
|
-
},
|
|
1313
|
+
}, ie = ({
|
|
1056
1314
|
text: e
|
|
1057
1315
|
}) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
|
|
1058
|
-
|
|
1316
|
+
I.div,
|
|
1059
1317
|
{
|
|
1060
1318
|
className: "fency-markdown-body-raw",
|
|
1061
1319
|
initial: { opacity: 0, y: -10 },
|
|
1062
1320
|
animate: { opacity: 1, y: 0 },
|
|
1063
1321
|
transition: { duration: 0.3, delay: 0 },
|
|
1064
1322
|
children: /* @__PURE__ */ o(
|
|
1065
|
-
|
|
1323
|
+
Fe,
|
|
1066
1324
|
{
|
|
1067
|
-
remarkPlugins: [
|
|
1325
|
+
remarkPlugins: [Ae],
|
|
1068
1326
|
components: {
|
|
1069
1327
|
code(r) {
|
|
1070
|
-
const { children:
|
|
1071
|
-
return
|
|
1328
|
+
const { children: n, className: t, node: i, ref: l, ...s } = r, c = /language-(\w+)/.exec(t || "");
|
|
1329
|
+
return c ? (
|
|
1072
1330
|
// @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
|
|
1073
1331
|
/* @__PURE__ */ o(
|
|
1074
|
-
|
|
1332
|
+
ue,
|
|
1075
1333
|
{
|
|
1076
|
-
...
|
|
1334
|
+
...s,
|
|
1077
1335
|
PreTag: "div",
|
|
1078
|
-
children: String(
|
|
1079
|
-
language:
|
|
1080
|
-
style:
|
|
1336
|
+
children: String(n).replace(/\n$/, ""),
|
|
1337
|
+
language: c[1],
|
|
1338
|
+
style: ge
|
|
1081
1339
|
}
|
|
1082
1340
|
)
|
|
1083
|
-
) : /* @__PURE__ */ o("code", { ...
|
|
1341
|
+
) : /* @__PURE__ */ o("code", { ...s, className: t, children: String(n) });
|
|
1084
1342
|
}
|
|
1085
1343
|
},
|
|
1086
1344
|
children: e
|
|
1087
1345
|
}
|
|
1088
1346
|
)
|
|
1089
1347
|
}
|
|
1090
|
-
) }),
|
|
1091
|
-
const r =
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
2
|
|
1095
|
-
|
|
1348
|
+
) }), vr = ({ data: e }) => {
|
|
1349
|
+
const r = e.response.jsonResponse;
|
|
1350
|
+
let n;
|
|
1351
|
+
try {
|
|
1352
|
+
n = JSON.stringify(JSON.parse(r), null, 2);
|
|
1353
|
+
} catch {
|
|
1354
|
+
console.warn(
|
|
1355
|
+
"[fency] StructuredChatCompletion jsonResponse is not valid JSON; showing raw string"
|
|
1356
|
+
), n = r;
|
|
1357
|
+
}
|
|
1096
1358
|
return /* @__PURE__ */ o("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ o(
|
|
1097
|
-
|
|
1359
|
+
I.div,
|
|
1098
1360
|
{
|
|
1099
1361
|
initial: { opacity: 0, y: -10 },
|
|
1100
1362
|
animate: { opacity: 1, y: 0 },
|
|
1101
1363
|
transition: { duration: 0.3, delay: 0 },
|
|
1102
|
-
children: /* @__PURE__ */ o(
|
|
1364
|
+
children: /* @__PURE__ */ o(ue, { language: "json", style: ge, PreTag: "div", children: n })
|
|
1103
1365
|
}
|
|
1104
1366
|
) });
|
|
1105
|
-
},
|
|
1367
|
+
}, Cr = {
|
|
1106
1368
|
en: {
|
|
1107
1369
|
error: "Error",
|
|
1108
1370
|
streaming: "Streaming...",
|
|
@@ -1173,7 +1435,12 @@ const me = {
|
|
|
1173
1435
|
scrapedPage: "Scraped 1 page",
|
|
1174
1436
|
scrapeFailedSuffix: " — {n} failed",
|
|
1175
1437
|
scrapeOkCount: "{n} ok",
|
|
1176
|
-
scrapeFailedCount: "{n} failed"
|
|
1438
|
+
scrapeFailedCount: "{n} failed",
|
|
1439
|
+
memoryChatThinking: "Thinking...",
|
|
1440
|
+
scrapeStatusDownloading: "Downloading…",
|
|
1441
|
+
scrapeStatusDownloaded: "Downloaded",
|
|
1442
|
+
scrapeStatusAnalyzing: "Analyzing document…",
|
|
1443
|
+
scrapeStatusSummarizing: "Summarizing…"
|
|
1177
1444
|
},
|
|
1178
1445
|
no: {
|
|
1179
1446
|
error: "Feil",
|
|
@@ -1245,46 +1512,51 @@ const me = {
|
|
|
1245
1512
|
scrapedPage: "Skrapet 1 side",
|
|
1246
1513
|
scrapeFailedSuffix: " — {n} feilet",
|
|
1247
1514
|
scrapeOkCount: "{n} ok",
|
|
1248
|
-
scrapeFailedCount: "{n} feilet"
|
|
1515
|
+
scrapeFailedCount: "{n} feilet",
|
|
1516
|
+
memoryChatThinking: "Tenker…",
|
|
1517
|
+
scrapeStatusDownloading: "Laster ned…",
|
|
1518
|
+
scrapeStatusDownloaded: "Nedlastet",
|
|
1519
|
+
scrapeStatusAnalyzing: "Analyserer dokumentet…",
|
|
1520
|
+
scrapeStatusSummarizing: "Oppsummerer…"
|
|
1249
1521
|
}
|
|
1250
1522
|
};
|
|
1251
|
-
function
|
|
1252
|
-
return
|
|
1523
|
+
function wr(e) {
|
|
1524
|
+
return Cr[e];
|
|
1253
1525
|
}
|
|
1254
|
-
function
|
|
1526
|
+
function T(e, r) {
|
|
1255
1527
|
return Object.entries(r).reduce(
|
|
1256
|
-
(
|
|
1528
|
+
(n, [t, i]) => n.replace(`{${t}}`, String(i)),
|
|
1257
1529
|
e
|
|
1258
1530
|
);
|
|
1259
1531
|
}
|
|
1260
|
-
function
|
|
1261
|
-
const
|
|
1262
|
-
if (r != null &&
|
|
1263
|
-
const
|
|
1264
|
-
return
|
|
1532
|
+
function K(e, r) {
|
|
1533
|
+
const n = e.map((t) => `'${t}'`);
|
|
1534
|
+
if (r != null && n.length >= 2) {
|
|
1535
|
+
const t = n.pop();
|
|
1536
|
+
return n.length > 0 ? `${n.join(", ")} ${r} ${t}` : t;
|
|
1265
1537
|
}
|
|
1266
|
-
return
|
|
1538
|
+
return n.join(", ");
|
|
1267
1539
|
}
|
|
1268
|
-
function
|
|
1540
|
+
function R({
|
|
1269
1541
|
text: e,
|
|
1270
1542
|
duration: r = 2,
|
|
1271
|
-
delay:
|
|
1272
|
-
repeat:
|
|
1543
|
+
delay: n = 0,
|
|
1544
|
+
repeat: t = !0,
|
|
1273
1545
|
repeatDelay: i = 0.5,
|
|
1274
1546
|
className: l,
|
|
1275
|
-
startOnView:
|
|
1276
|
-
once:
|
|
1547
|
+
startOnView: s = !1,
|
|
1548
|
+
once: c = !1,
|
|
1277
1549
|
inViewMargin: m,
|
|
1278
|
-
spread:
|
|
1279
|
-
color:
|
|
1280
|
-
shimmerColor:
|
|
1281
|
-
direction:
|
|
1550
|
+
spread: y = 2,
|
|
1551
|
+
color: d = "#999",
|
|
1552
|
+
shimmerColor: u = "#000",
|
|
1553
|
+
direction: p = "fromBottom"
|
|
1282
1554
|
}) {
|
|
1283
|
-
const
|
|
1555
|
+
const h = D(null), f = Me(h, { once: c, margin: m }), S = z(() => e.length * y, [e, y]), x = !s || f, b = p === "fromBottom" ? "100% center" : "-100% center", v = p === "fromBottom" ? "0% center" : "200% center";
|
|
1284
1556
|
return /* @__PURE__ */ o(
|
|
1285
|
-
|
|
1557
|
+
I.span,
|
|
1286
1558
|
{
|
|
1287
|
-
ref:
|
|
1559
|
+
ref: h,
|
|
1288
1560
|
className: l,
|
|
1289
1561
|
style: {
|
|
1290
1562
|
position: "relative",
|
|
@@ -1295,9 +1567,9 @@ function M({
|
|
|
1295
1567
|
color: "transparent",
|
|
1296
1568
|
WebkitTextFillColor: "transparent",
|
|
1297
1569
|
backgroundRepeat: "no-repeat, padding-box",
|
|
1298
|
-
"--spread": `${
|
|
1299
|
-
"--base-color":
|
|
1300
|
-
"--shimmer-color":
|
|
1570
|
+
"--spread": `${S}px`,
|
|
1571
|
+
"--base-color": d,
|
|
1572
|
+
"--shimmer-color": u,
|
|
1301
1573
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
1302
1574
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
1303
1575
|
},
|
|
@@ -1305,60 +1577,60 @@ function M({
|
|
|
1305
1577
|
backgroundPosition: b,
|
|
1306
1578
|
opacity: 0
|
|
1307
1579
|
},
|
|
1308
|
-
animate:
|
|
1580
|
+
animate: x ? {
|
|
1309
1581
|
backgroundPosition: v,
|
|
1310
1582
|
opacity: 1
|
|
1311
1583
|
} : {},
|
|
1312
1584
|
transition: {
|
|
1313
1585
|
backgroundPosition: {
|
|
1314
|
-
repeat:
|
|
1586
|
+
repeat: t ? 1 / 0 : 0,
|
|
1315
1587
|
duration: r,
|
|
1316
|
-
delay:
|
|
1588
|
+
delay: n,
|
|
1317
1589
|
repeatDelay: i,
|
|
1318
1590
|
ease: "linear"
|
|
1319
1591
|
},
|
|
1320
1592
|
opacity: {
|
|
1321
1593
|
duration: 0.3,
|
|
1322
|
-
delay:
|
|
1594
|
+
delay: n
|
|
1323
1595
|
}
|
|
1324
1596
|
},
|
|
1325
1597
|
children: e
|
|
1326
1598
|
}
|
|
1327
1599
|
);
|
|
1328
1600
|
}
|
|
1329
|
-
const
|
|
1330
|
-
const [i, l] =
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
)}` : "",
|
|
1334
|
-
return /* @__PURE__ */
|
|
1601
|
+
const _ = 5, Ir = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
1602
|
+
const [i, l] = E(!1), c = (e.memories ?? []).map((x) => x.memoryTitle), m = c.length > 0, y = m && c.length > _, d = y && !i ? c.slice(0, _) : c, u = c.length - _, p = !y || i, h = `${t.searchingFor}'${e.queryDescription}'`, f = m ? `${t.searchingIn}${K(
|
|
1603
|
+
d,
|
|
1604
|
+
p ? t.and : void 0
|
|
1605
|
+
)}` : "", S = m ? `${h}${f}` : `${t.searchingPrefix}${e.queryDescription}`;
|
|
1606
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
1335
1607
|
/* @__PURE__ */ o(
|
|
1336
|
-
|
|
1608
|
+
I.div,
|
|
1337
1609
|
{
|
|
1338
1610
|
style: { color: "#666" },
|
|
1339
1611
|
initial: { opacity: 0, y: -10 },
|
|
1340
1612
|
animate: { opacity: 1, y: 0 },
|
|
1341
1613
|
transition: { duration: 0.3, delay: 0 },
|
|
1342
|
-
children: r && !
|
|
1343
|
-
|
|
1614
|
+
children: r && !n && !y ? /* @__PURE__ */ o(
|
|
1615
|
+
R,
|
|
1344
1616
|
{
|
|
1345
|
-
text:
|
|
1617
|
+
text: S,
|
|
1346
1618
|
duration: 2.5,
|
|
1347
1619
|
repeat: !0,
|
|
1348
1620
|
color: "#999",
|
|
1349
1621
|
shimmerColor: "#000"
|
|
1350
1622
|
}
|
|
1351
|
-
) : /* @__PURE__ */
|
|
1352
|
-
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */
|
|
1353
|
-
|
|
1354
|
-
/* @__PURE__ */
|
|
1623
|
+
) : /* @__PURE__ */ g(F, { children: [
|
|
1624
|
+
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ g(F, { children: [
|
|
1625
|
+
t.searchingFor,
|
|
1626
|
+
/* @__PURE__ */ g("span", { style: { fontWeight: 600 }, children: [
|
|
1355
1627
|
"'",
|
|
1356
1628
|
e.queryDescription,
|
|
1357
1629
|
"'"
|
|
1358
1630
|
] }),
|
|
1359
|
-
|
|
1360
|
-
] }) : `${
|
|
1361
|
-
|
|
1631
|
+
f
|
|
1632
|
+
] }) : `${t.searchingPrefix}${e.queryDescription}` }),
|
|
1633
|
+
y && !i && /* @__PURE__ */ g(F, { children: [
|
|
1362
1634
|
" ",
|
|
1363
1635
|
/* @__PURE__ */ o(
|
|
1364
1636
|
"button",
|
|
@@ -1376,13 +1648,13 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1376
1648
|
textDecoration: "underline",
|
|
1377
1649
|
fontFamily: "inherit"
|
|
1378
1650
|
},
|
|
1379
|
-
children:
|
|
1380
|
-
n:
|
|
1651
|
+
children: T(t.moreMemories, {
|
|
1652
|
+
n: u
|
|
1381
1653
|
})
|
|
1382
1654
|
}
|
|
1383
1655
|
)
|
|
1384
1656
|
] }),
|
|
1385
|
-
|
|
1657
|
+
y && i && /* @__PURE__ */ g(F, { children: [
|
|
1386
1658
|
" ",
|
|
1387
1659
|
/* @__PURE__ */ o(
|
|
1388
1660
|
"button",
|
|
@@ -1400,14 +1672,14 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1400
1672
|
textDecoration: "underline",
|
|
1401
1673
|
fontFamily: "inherit"
|
|
1402
1674
|
},
|
|
1403
|
-
children:
|
|
1675
|
+
children: t.clickToCollapse
|
|
1404
1676
|
}
|
|
1405
1677
|
)
|
|
1406
1678
|
] })
|
|
1407
1679
|
] })
|
|
1408
1680
|
}
|
|
1409
1681
|
),
|
|
1410
|
-
|
|
1682
|
+
n !== void 0 && /* @__PURE__ */ o(
|
|
1411
1683
|
"div",
|
|
1412
1684
|
{
|
|
1413
1685
|
style: {
|
|
@@ -1416,18 +1688,18 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1416
1688
|
marginTop: "4px",
|
|
1417
1689
|
fontStyle: "italic"
|
|
1418
1690
|
},
|
|
1419
|
-
children:
|
|
1691
|
+
children: T(t.tookSeconds, { n })
|
|
1420
1692
|
}
|
|
1421
1693
|
)
|
|
1422
1694
|
] });
|
|
1423
|
-
},
|
|
1424
|
-
const [i, l] =
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
)}` :
|
|
1428
|
-
return /* @__PURE__ */
|
|
1695
|
+
}, G = 5, Er = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
1696
|
+
const [i, l] = E(!1), s = e.titles, c = s.length > 0, m = c && s.length > G, y = m && !i ? s.slice(0, G) : s, d = s.length - G, u = !m || i, p = c ? `${t.findingMemoriesIn}${K(
|
|
1697
|
+
y,
|
|
1698
|
+
u ? t.and : void 0
|
|
1699
|
+
)}` : t.findingMemories;
|
|
1700
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
1429
1701
|
/* @__PURE__ */ o(
|
|
1430
|
-
|
|
1702
|
+
I.div,
|
|
1431
1703
|
{
|
|
1432
1704
|
style: {
|
|
1433
1705
|
color: "#666"
|
|
@@ -1435,18 +1707,18 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1435
1707
|
initial: { opacity: 0, y: -10 },
|
|
1436
1708
|
animate: { opacity: 1, y: 0 },
|
|
1437
1709
|
transition: { duration: 0.3, delay: 0 },
|
|
1438
|
-
children: r && !
|
|
1439
|
-
|
|
1710
|
+
children: r && !n && !m ? /* @__PURE__ */ o(
|
|
1711
|
+
R,
|
|
1440
1712
|
{
|
|
1441
|
-
text:
|
|
1713
|
+
text: p,
|
|
1442
1714
|
duration: 2.5,
|
|
1443
1715
|
repeat: !0,
|
|
1444
1716
|
color: "#999",
|
|
1445
1717
|
shimmerColor: "#000"
|
|
1446
1718
|
}
|
|
1447
|
-
) : /* @__PURE__ */
|
|
1448
|
-
/* @__PURE__ */ o("span", { style: { color: "#666" }, children:
|
|
1449
|
-
m && !i && /* @__PURE__ */
|
|
1719
|
+
) : /* @__PURE__ */ g(F, { children: [
|
|
1720
|
+
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: p }),
|
|
1721
|
+
m && !i && /* @__PURE__ */ g(F, { children: [
|
|
1450
1722
|
" ",
|
|
1451
1723
|
/* @__PURE__ */ o(
|
|
1452
1724
|
"button",
|
|
@@ -1464,13 +1736,13 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1464
1736
|
textDecoration: "underline",
|
|
1465
1737
|
fontFamily: "inherit"
|
|
1466
1738
|
},
|
|
1467
|
-
children:
|
|
1468
|
-
n:
|
|
1739
|
+
children: T(t.moreMemories, {
|
|
1740
|
+
n: d
|
|
1469
1741
|
})
|
|
1470
1742
|
}
|
|
1471
1743
|
)
|
|
1472
1744
|
] }),
|
|
1473
|
-
m && i && /* @__PURE__ */
|
|
1745
|
+
m && i && /* @__PURE__ */ g(F, { children: [
|
|
1474
1746
|
" ",
|
|
1475
1747
|
/* @__PURE__ */ o(
|
|
1476
1748
|
"button",
|
|
@@ -1488,14 +1760,14 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1488
1760
|
textDecoration: "underline",
|
|
1489
1761
|
fontFamily: "inherit"
|
|
1490
1762
|
},
|
|
1491
|
-
children:
|
|
1763
|
+
children: t.clickToCollapse
|
|
1492
1764
|
}
|
|
1493
1765
|
)
|
|
1494
1766
|
] })
|
|
1495
1767
|
] })
|
|
1496
1768
|
}
|
|
1497
1769
|
),
|
|
1498
|
-
|
|
1770
|
+
n !== void 0 && /* @__PURE__ */ o(
|
|
1499
1771
|
"div",
|
|
1500
1772
|
{
|
|
1501
1773
|
style: {
|
|
@@ -1504,31 +1776,31 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1504
1776
|
marginTop: "4px",
|
|
1505
1777
|
fontStyle: "italic"
|
|
1506
1778
|
},
|
|
1507
|
-
children:
|
|
1779
|
+
children: T(t.tookSeconds, { n })
|
|
1508
1780
|
}
|
|
1509
1781
|
)
|
|
1510
1782
|
] });
|
|
1511
|
-
},
|
|
1512
|
-
const [
|
|
1783
|
+
}, q = 5, Mr = ({ data: e, t: r }) => {
|
|
1784
|
+
const [n, t] = E(!1), l = e.memories.map((h) => h.memoryTitle), s = l.length > 0, c = s && l.length > q, m = c && !n ? l.slice(0, q) : l, y = l.length - q, d = !c || n, u = l.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, p = s ? `${u}${K(
|
|
1513
1785
|
m,
|
|
1514
|
-
|
|
1786
|
+
d ? r.and : void 0
|
|
1515
1787
|
)}` : r.memoriesFound;
|
|
1516
1788
|
return /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
|
|
1517
|
-
|
|
1789
|
+
I.div,
|
|
1518
1790
|
{
|
|
1519
1791
|
style: { color: "#666" },
|
|
1520
1792
|
initial: { opacity: 0, y: -10 },
|
|
1521
1793
|
animate: { opacity: 1, y: 0 },
|
|
1522
1794
|
transition: { duration: 0.3, delay: 0 },
|
|
1523
|
-
children: /* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */ o("span", { style: { color: "#666" }, children:
|
|
1525
|
-
|
|
1795
|
+
children: /* @__PURE__ */ g(F, { children: [
|
|
1796
|
+
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: p }),
|
|
1797
|
+
c && !n && /* @__PURE__ */ g(F, { children: [
|
|
1526
1798
|
" ",
|
|
1527
1799
|
/* @__PURE__ */ o(
|
|
1528
1800
|
"button",
|
|
1529
1801
|
{
|
|
1530
1802
|
type: "button",
|
|
1531
|
-
onClick: () =>
|
|
1803
|
+
onClick: () => t(!0),
|
|
1532
1804
|
style: {
|
|
1533
1805
|
background: "none",
|
|
1534
1806
|
border: "none",
|
|
@@ -1540,19 +1812,19 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1540
1812
|
textDecoration: "underline",
|
|
1541
1813
|
fontFamily: "inherit"
|
|
1542
1814
|
},
|
|
1543
|
-
children:
|
|
1544
|
-
n:
|
|
1815
|
+
children: T(r.moreMemories, {
|
|
1816
|
+
n: y
|
|
1545
1817
|
})
|
|
1546
1818
|
}
|
|
1547
1819
|
)
|
|
1548
1820
|
] }),
|
|
1549
|
-
|
|
1821
|
+
c && n && /* @__PURE__ */ g(F, { children: [
|
|
1550
1822
|
" ",
|
|
1551
1823
|
/* @__PURE__ */ o(
|
|
1552
1824
|
"button",
|
|
1553
1825
|
{
|
|
1554
1826
|
type: "button",
|
|
1555
|
-
onClick: () =>
|
|
1827
|
+
onClick: () => t(!1),
|
|
1556
1828
|
style: {
|
|
1557
1829
|
background: "none",
|
|
1558
1830
|
border: "none",
|
|
@@ -1571,11 +1843,11 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1571
1843
|
] })
|
|
1572
1844
|
}
|
|
1573
1845
|
) });
|
|
1574
|
-
},
|
|
1575
|
-
const
|
|
1576
|
-
return /* @__PURE__ */
|
|
1846
|
+
}, Rr = ({ isLatest: e = !1, durationSeconds: r, t: n }) => {
|
|
1847
|
+
const t = n.addingSources;
|
|
1848
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
1577
1849
|
/* @__PURE__ */ o(
|
|
1578
|
-
|
|
1850
|
+
I.div,
|
|
1579
1851
|
{
|
|
1580
1852
|
style: {
|
|
1581
1853
|
display: "flex",
|
|
@@ -1587,15 +1859,15 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1587
1859
|
animate: { opacity: 1, y: 0 },
|
|
1588
1860
|
transition: { duration: 0.3, delay: 0 },
|
|
1589
1861
|
children: e && !r ? /* @__PURE__ */ o(
|
|
1590
|
-
|
|
1862
|
+
R,
|
|
1591
1863
|
{
|
|
1592
|
-
text:
|
|
1864
|
+
text: t,
|
|
1593
1865
|
duration: 2.5,
|
|
1594
1866
|
repeat: !0,
|
|
1595
1867
|
color: "#999",
|
|
1596
1868
|
shimmerColor: "#000"
|
|
1597
1869
|
}
|
|
1598
|
-
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children:
|
|
1870
|
+
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: t })
|
|
1599
1871
|
}
|
|
1600
1872
|
),
|
|
1601
1873
|
r !== void 0 && /* @__PURE__ */ o(
|
|
@@ -1607,28 +1879,28 @@ const U = 5, Ke = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
1607
1879
|
marginTop: "4px",
|
|
1608
1880
|
fontStyle: "italic"
|
|
1609
1881
|
},
|
|
1610
|
-
children:
|
|
1882
|
+
children: T(n.tookSeconds, { n: r })
|
|
1611
1883
|
}
|
|
1612
1884
|
)
|
|
1613
1885
|
] });
|
|
1614
1886
|
};
|
|
1615
|
-
function
|
|
1887
|
+
function Fr(e, r) {
|
|
1616
1888
|
if (e.length === 0) return "";
|
|
1617
1889
|
if (e.length === 1)
|
|
1618
|
-
return
|
|
1890
|
+
return T(r.pageSingle, { n: e[0] });
|
|
1619
1891
|
if (e.length === 2)
|
|
1620
|
-
return
|
|
1892
|
+
return T(r.pageTwo, {
|
|
1621
1893
|
a: e[0],
|
|
1622
1894
|
b: e[1]
|
|
1623
1895
|
});
|
|
1624
|
-
const
|
|
1625
|
-
return
|
|
1896
|
+
const n = e[e.length - 1], t = e.slice(0, -1).join(", ");
|
|
1897
|
+
return T(r.pageMultiple, { list: t, n });
|
|
1626
1898
|
}
|
|
1627
|
-
const
|
|
1628
|
-
const [
|
|
1629
|
-
return /* @__PURE__ */
|
|
1899
|
+
const Ar = ({ data: e, onSourceClick: r, t: n }) => {
|
|
1900
|
+
const [t, i] = E(null);
|
|
1901
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
1630
1902
|
/* @__PURE__ */ o(
|
|
1631
|
-
|
|
1903
|
+
I.div,
|
|
1632
1904
|
{
|
|
1633
1905
|
style: {
|
|
1634
1906
|
marginBottom: "10px",
|
|
@@ -1641,54 +1913,54 @@ const Ze = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1641
1913
|
initial: { opacity: 0, y: -10 },
|
|
1642
1914
|
animate: { opacity: 1, y: 0 },
|
|
1643
1915
|
transition: { duration: 0.3, delay: 0 },
|
|
1644
|
-
children:
|
|
1916
|
+
children: n.sources
|
|
1645
1917
|
}
|
|
1646
1918
|
),
|
|
1647
|
-
/* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children:
|
|
1648
|
-
|
|
1919
|
+
/* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: n.noSources }) : e.sources.map((l, s) => /* @__PURE__ */ o(
|
|
1920
|
+
Pr,
|
|
1649
1921
|
{
|
|
1650
1922
|
source: l,
|
|
1651
|
-
index:
|
|
1652
|
-
loadingMemoryId:
|
|
1923
|
+
index: s,
|
|
1924
|
+
loadingMemoryId: t,
|
|
1653
1925
|
setLoadingMemoryId: i,
|
|
1654
1926
|
onSourceClick: r,
|
|
1655
|
-
t
|
|
1927
|
+
t: n
|
|
1656
1928
|
},
|
|
1657
1929
|
l.memoryId
|
|
1658
1930
|
)) })
|
|
1659
1931
|
] });
|
|
1660
|
-
},
|
|
1932
|
+
}, Pr = ({
|
|
1661
1933
|
source: e,
|
|
1662
1934
|
index: r,
|
|
1663
|
-
loadingMemoryId:
|
|
1664
|
-
setLoadingMemoryId:
|
|
1935
|
+
loadingMemoryId: n,
|
|
1936
|
+
setLoadingMemoryId: t,
|
|
1665
1937
|
onSourceClick: i,
|
|
1666
1938
|
t: l
|
|
1667
1939
|
}) => {
|
|
1668
|
-
const [
|
|
1669
|
-
return /* @__PURE__ */
|
|
1670
|
-
|
|
1940
|
+
const [s, c] = E(!1), m = !!i, y = n === e.memoryId, d = e.pageNumbers ?? [], u = Fr(d, l);
|
|
1941
|
+
return /* @__PURE__ */ g(
|
|
1942
|
+
I.div,
|
|
1671
1943
|
{
|
|
1672
|
-
"aria-busy":
|
|
1944
|
+
"aria-busy": y,
|
|
1673
1945
|
initial: { opacity: 0, scale: 0.9 },
|
|
1674
1946
|
animate: { opacity: 1, scale: 1 },
|
|
1675
1947
|
transition: { duration: 0.25, delay: r * 0.05 },
|
|
1676
|
-
onClick: m && !
|
|
1677
|
-
|
|
1948
|
+
onClick: m && !y ? async () => {
|
|
1949
|
+
t(e.memoryId);
|
|
1678
1950
|
try {
|
|
1679
1951
|
await i({
|
|
1680
1952
|
memoryId: e.memoryId,
|
|
1681
1953
|
memoryTitle: e.memoryTitle,
|
|
1682
1954
|
memoryTypeId: e.memoryTypeId,
|
|
1683
1955
|
memoryTypeName: e.memoryTypeName,
|
|
1684
|
-
pageNumbers: [...
|
|
1956
|
+
pageNumbers: [...d]
|
|
1685
1957
|
});
|
|
1686
1958
|
} finally {
|
|
1687
|
-
|
|
1959
|
+
t(null);
|
|
1688
1960
|
}
|
|
1689
1961
|
} : void 0,
|
|
1690
|
-
onMouseEnter: m && !
|
|
1691
|
-
onMouseLeave: m && !
|
|
1962
|
+
onMouseEnter: m && !y ? () => c(!0) : void 0,
|
|
1963
|
+
onMouseLeave: m && !y ? () => c(!1) : void 0,
|
|
1692
1964
|
style: {
|
|
1693
1965
|
display: "inline-flex",
|
|
1694
1966
|
flexDirection: "column",
|
|
@@ -1696,14 +1968,14 @@ const Ze = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1696
1968
|
padding: "8px 12px",
|
|
1697
1969
|
borderRadius: "6px",
|
|
1698
1970
|
border: "1px solid #e0e0e0",
|
|
1699
|
-
backgroundColor:
|
|
1700
|
-
cursor: m && !
|
|
1971
|
+
backgroundColor: s ? "#f5f5f5" : "transparent",
|
|
1972
|
+
cursor: m && !y ? "pointer" : y ? "wait" : "default",
|
|
1701
1973
|
transition: "background-color 0.15s ease",
|
|
1702
1974
|
userSelect: "none",
|
|
1703
|
-
pointerEvents:
|
|
1975
|
+
pointerEvents: y ? "none" : void 0
|
|
1704
1976
|
},
|
|
1705
1977
|
children: [
|
|
1706
|
-
/* @__PURE__ */
|
|
1978
|
+
/* @__PURE__ */ g(
|
|
1707
1979
|
"span",
|
|
1708
1980
|
{
|
|
1709
1981
|
style: {
|
|
@@ -1715,7 +1987,7 @@ const Ze = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1715
1987
|
gap: 8
|
|
1716
1988
|
},
|
|
1717
1989
|
children: [
|
|
1718
|
-
|
|
1990
|
+
y && /* @__PURE__ */ o(
|
|
1719
1991
|
"span",
|
|
1720
1992
|
{
|
|
1721
1993
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
@@ -1726,16 +1998,16 @@ const Ze = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1726
1998
|
]
|
|
1727
1999
|
}
|
|
1728
2000
|
),
|
|
1729
|
-
|
|
2001
|
+
u && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: u })
|
|
1730
2002
|
]
|
|
1731
2003
|
}
|
|
1732
2004
|
);
|
|
1733
2005
|
}, L = ({
|
|
1734
2006
|
color: e = "#78b13f",
|
|
1735
2007
|
size: r = 24,
|
|
1736
|
-
borderWidth:
|
|
2008
|
+
borderWidth: n = 7
|
|
1737
2009
|
}) => {
|
|
1738
|
-
const
|
|
2010
|
+
const t = r * 0.5;
|
|
1739
2011
|
return /* @__PURE__ */ o(
|
|
1740
2012
|
"span",
|
|
1741
2013
|
{
|
|
@@ -1743,26 +2015,26 @@ const Ze = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1743
2015
|
display: "inline-block",
|
|
1744
2016
|
transform: "rotate(45deg)",
|
|
1745
2017
|
height: r,
|
|
1746
|
-
width:
|
|
1747
|
-
borderBottom: `${
|
|
1748
|
-
borderRight: `${
|
|
2018
|
+
width: t,
|
|
2019
|
+
borderBottom: `${n}px solid ${e}`,
|
|
2020
|
+
borderRight: `${n}px solid ${e}`
|
|
1749
2021
|
}
|
|
1750
2022
|
}
|
|
1751
2023
|
);
|
|
1752
|
-
},
|
|
2024
|
+
}, j = ({
|
|
1753
2025
|
color: e = "#333",
|
|
1754
2026
|
size: r = 32,
|
|
1755
|
-
lineWidth:
|
|
2027
|
+
lineWidth: n = 2
|
|
1756
2028
|
}) => {
|
|
1757
|
-
const
|
|
2029
|
+
const t = r + 1, i = (r - n) / 2, l = (r - t) / 2, s = {
|
|
1758
2030
|
position: "absolute",
|
|
1759
2031
|
left: i,
|
|
1760
2032
|
top: l,
|
|
1761
|
-
width:
|
|
1762
|
-
height:
|
|
2033
|
+
width: n,
|
|
2034
|
+
height: t,
|
|
1763
2035
|
backgroundColor: e
|
|
1764
2036
|
};
|
|
1765
|
-
return /* @__PURE__ */
|
|
2037
|
+
return /* @__PURE__ */ g(
|
|
1766
2038
|
"span",
|
|
1767
2039
|
{
|
|
1768
2040
|
style: {
|
|
@@ -1776,7 +2048,7 @@ const Ze = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1776
2048
|
"span",
|
|
1777
2049
|
{
|
|
1778
2050
|
style: {
|
|
1779
|
-
...
|
|
2051
|
+
...s,
|
|
1780
2052
|
transform: "rotate(45deg)"
|
|
1781
2053
|
}
|
|
1782
2054
|
}
|
|
@@ -1785,7 +2057,7 @@ const Ze = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1785
2057
|
"span",
|
|
1786
2058
|
{
|
|
1787
2059
|
style: {
|
|
1788
|
-
...
|
|
2060
|
+
...s,
|
|
1789
2061
|
transform: "rotate(-45deg)"
|
|
1790
2062
|
}
|
|
1791
2063
|
}
|
|
@@ -1794,26 +2066,26 @@ const Ze = ({ data: e, onSourceClick: r, t }) => {
|
|
|
1794
2066
|
}
|
|
1795
2067
|
);
|
|
1796
2068
|
};
|
|
1797
|
-
function
|
|
2069
|
+
function Dr({
|
|
1798
2070
|
memory: e,
|
|
1799
2071
|
completed: r
|
|
1800
2072
|
}) {
|
|
1801
|
-
return e.error != null ? /* @__PURE__ */ o(
|
|
2073
|
+
return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
1802
2074
|
}
|
|
1803
|
-
const
|
|
1804
|
-
function
|
|
2075
|
+
const se = 80;
|
|
2076
|
+
function Lr({
|
|
1805
2077
|
memory: e,
|
|
1806
2078
|
completed: r,
|
|
1807
|
-
t
|
|
2079
|
+
t: n
|
|
1808
2080
|
}) {
|
|
1809
|
-
const [
|
|
1810
|
-
return /* @__PURE__ */
|
|
1811
|
-
|
|
2081
|
+
const [t, i] = E(!1), l = e.result ?? e.error, s = l != null && l.length > se, c = l != null ? t || !s ? l : `${l.slice(0, se)}...` : void 0, m = s, y = e.error != null;
|
|
2082
|
+
return /* @__PURE__ */ g(
|
|
2083
|
+
I.div,
|
|
1812
2084
|
{
|
|
1813
2085
|
initial: { opacity: 0 },
|
|
1814
2086
|
animate: { opacity: 1 },
|
|
1815
2087
|
transition: { duration: 0.25 },
|
|
1816
|
-
onClick: m ? () => i((
|
|
2088
|
+
onClick: m ? () => i((d) => !d) : void 0,
|
|
1817
2089
|
style: {
|
|
1818
2090
|
paddingTop: "12px",
|
|
1819
2091
|
paddingBottom: "12px",
|
|
@@ -1836,10 +2108,10 @@ function nr({
|
|
|
1836
2108
|
flexShrink: 0,
|
|
1837
2109
|
width: 32
|
|
1838
2110
|
},
|
|
1839
|
-
children: /* @__PURE__ */ o(
|
|
2111
|
+
children: /* @__PURE__ */ o(Dr, { memory: e, completed: r })
|
|
1840
2112
|
}
|
|
1841
2113
|
),
|
|
1842
|
-
/* @__PURE__ */
|
|
2114
|
+
/* @__PURE__ */ g(
|
|
1843
2115
|
"div",
|
|
1844
2116
|
{
|
|
1845
2117
|
style: {
|
|
@@ -1856,16 +2128,16 @@ function nr({
|
|
|
1856
2128
|
children: e.memoryTitle
|
|
1857
2129
|
}
|
|
1858
2130
|
),
|
|
1859
|
-
|
|
2131
|
+
c != null && /* @__PURE__ */ o(
|
|
1860
2132
|
"span",
|
|
1861
2133
|
{
|
|
1862
2134
|
style: {
|
|
1863
2135
|
fontSize: 12,
|
|
1864
|
-
color:
|
|
2136
|
+
color: y ? "#c62828" : "#666",
|
|
1865
2137
|
lineHeight: 1.4,
|
|
1866
|
-
whiteSpace:
|
|
2138
|
+
whiteSpace: t ? "pre-wrap" : void 0
|
|
1867
2139
|
},
|
|
1868
|
-
children:
|
|
2140
|
+
children: c
|
|
1869
2141
|
}
|
|
1870
2142
|
),
|
|
1871
2143
|
m && /* @__PURE__ */ o(
|
|
@@ -1876,7 +2148,7 @@ function nr({
|
|
|
1876
2148
|
color: "#999",
|
|
1877
2149
|
marginTop: 2
|
|
1878
2150
|
},
|
|
1879
|
-
children:
|
|
2151
|
+
children: t ? n.clickToCollapse : n.clickToExpand
|
|
1880
2152
|
}
|
|
1881
2153
|
)
|
|
1882
2154
|
]
|
|
@@ -1886,102 +2158,102 @@ function nr({
|
|
|
1886
2158
|
}
|
|
1887
2159
|
);
|
|
1888
2160
|
}
|
|
1889
|
-
const
|
|
1890
|
-
|
|
2161
|
+
const zr = ({ data: e, completed: r, t: n }) => /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: e.memories.map((t) => /* @__PURE__ */ o(
|
|
2162
|
+
Lr,
|
|
1891
2163
|
{
|
|
1892
|
-
memory:
|
|
2164
|
+
memory: t,
|
|
1893
2165
|
completed: r,
|
|
1894
|
-
t
|
|
2166
|
+
t: n
|
|
1895
2167
|
},
|
|
1896
|
-
|
|
2168
|
+
t.memoryId
|
|
1897
2169
|
)) });
|
|
1898
|
-
function
|
|
1899
|
-
const
|
|
1900
|
-
for (let
|
|
1901
|
-
if (e.slice(-
|
|
2170
|
+
function Wr(e, r) {
|
|
2171
|
+
const n = Math.min(e.length, r.length);
|
|
2172
|
+
for (let t = n; t >= 0; t--)
|
|
2173
|
+
if (e.slice(-t) === r.slice(0, t)) return t;
|
|
1902
2174
|
return 0;
|
|
1903
2175
|
}
|
|
1904
|
-
const
|
|
2176
|
+
const Nr = `
|
|
1905
2177
|
|
|
1906
2178
|
`;
|
|
1907
|
-
function
|
|
1908
|
-
var
|
|
2179
|
+
function X(e) {
|
|
2180
|
+
var n, t;
|
|
1909
2181
|
if (e.length === 0) return "";
|
|
1910
|
-
let r = ((
|
|
2182
|
+
let r = ((n = e[0]) == null ? void 0 : n.content) ?? "";
|
|
1911
2183
|
for (let i = 1; i < e.length; i++) {
|
|
1912
|
-
const l = ((
|
|
2184
|
+
const l = ((t = e[i]) == null ? void 0 : t.content) ?? "";
|
|
1913
2185
|
if (l === "") continue;
|
|
1914
2186
|
if (r === "") {
|
|
1915
2187
|
r = l;
|
|
1916
2188
|
continue;
|
|
1917
2189
|
}
|
|
1918
|
-
const
|
|
1919
|
-
|
|
2190
|
+
const s = Wr(r, l);
|
|
2191
|
+
s === 0 ? r += Nr + l : r += l.slice(s);
|
|
1920
2192
|
}
|
|
1921
2193
|
return r;
|
|
1922
2194
|
}
|
|
1923
|
-
function
|
|
2195
|
+
function V(e, r) {
|
|
1924
2196
|
if (e.length === 0) return "";
|
|
1925
2197
|
if (e.length === 1)
|
|
1926
|
-
return
|
|
2198
|
+
return T(r.memorySearchPagesSingle, {
|
|
1927
2199
|
n: e[0]
|
|
1928
2200
|
});
|
|
1929
2201
|
if (e.length === 2)
|
|
1930
|
-
return
|
|
2202
|
+
return T(r.memorySearchPagesTwo, {
|
|
1931
2203
|
a: e[0],
|
|
1932
2204
|
b: e[1]
|
|
1933
2205
|
});
|
|
1934
|
-
const
|
|
1935
|
-
return
|
|
1936
|
-
list:
|
|
1937
|
-
n
|
|
2206
|
+
const n = e[e.length - 1], t = e.slice(0, -1).join(", ");
|
|
2207
|
+
return T(r.memorySearchPagesMultiple, {
|
|
2208
|
+
list: t,
|
|
2209
|
+
n
|
|
1938
2210
|
});
|
|
1939
2211
|
}
|
|
1940
|
-
function
|
|
2212
|
+
function Y(e) {
|
|
1941
2213
|
const r = /* @__PURE__ */ new Set();
|
|
1942
|
-
for (const
|
|
1943
|
-
for (const
|
|
1944
|
-
return [...r].sort((
|
|
2214
|
+
for (const n of e)
|
|
2215
|
+
for (const t of n.pageNumbers) r.add(t);
|
|
2216
|
+
return [...r].sort((n, t) => n - t);
|
|
1945
2217
|
}
|
|
1946
|
-
function
|
|
2218
|
+
function J(e) {
|
|
1947
2219
|
const r = e.memoryTypeName.trim();
|
|
1948
2220
|
if (r !== "") return r;
|
|
1949
2221
|
if (e.memoryTypeId !== "") return e.memoryTypeId;
|
|
1950
2222
|
}
|
|
1951
|
-
function
|
|
2223
|
+
function fe(e) {
|
|
1952
2224
|
return e.chunks.filter((r) => r.relation === "MATCH").length;
|
|
1953
2225
|
}
|
|
1954
|
-
function
|
|
1955
|
-
let
|
|
1956
|
-
for (const
|
|
1957
|
-
|
|
1958
|
-
const i =
|
|
1959
|
-
n:
|
|
2226
|
+
function Or(e, r) {
|
|
2227
|
+
let n = 0, t = 0;
|
|
2228
|
+
for (const s of e)
|
|
2229
|
+
n += fe(s), s.matchingChunkScore > t && (t = s.matchingChunkScore);
|
|
2230
|
+
const i = n === 1 ? r.chunkFound : T(r.chunksFound, { n }), l = T(r.scoreLabel, {
|
|
2231
|
+
n: t.toFixed(2)
|
|
1960
2232
|
});
|
|
1961
2233
|
return `${i} - ${l}`;
|
|
1962
2234
|
}
|
|
1963
|
-
function
|
|
1964
|
-
const r = [],
|
|
1965
|
-
return e.forEach((
|
|
1966
|
-
let l =
|
|
2235
|
+
function Br(e) {
|
|
2236
|
+
const r = [], n = /* @__PURE__ */ new Map();
|
|
2237
|
+
return e.forEach((t, i) => {
|
|
2238
|
+
let l = n.get(t.memoryId);
|
|
1967
2239
|
if (l == null) {
|
|
1968
|
-
r.push(
|
|
1969
|
-
const
|
|
2240
|
+
r.push(t.memoryId);
|
|
2241
|
+
const s = t.memoryTitle !== "" ? t.memoryTitle : t.memoryId;
|
|
1970
2242
|
l = {
|
|
1971
|
-
memoryId:
|
|
1972
|
-
memoryTitle:
|
|
2243
|
+
memoryId: t.memoryId,
|
|
2244
|
+
memoryTitle: s,
|
|
1973
2245
|
items: []
|
|
1974
|
-
},
|
|
2246
|
+
}, n.set(t.memoryId, l);
|
|
1975
2247
|
}
|
|
1976
|
-
l.items.push({ item:
|
|
1977
|
-
}), r.map((
|
|
2248
|
+
l.items.push({ item: t, flatIndex: i });
|
|
2249
|
+
}), r.map((t) => n.get(t));
|
|
1978
2250
|
}
|
|
1979
|
-
function
|
|
2251
|
+
function jr({
|
|
1980
2252
|
items: e,
|
|
1981
2253
|
onSearchResultClick: r,
|
|
1982
|
-
t
|
|
2254
|
+
t: n
|
|
1983
2255
|
}) {
|
|
1984
|
-
const [
|
|
2256
|
+
const [t, i] = E(null), l = !!r;
|
|
1985
2257
|
return /* @__PURE__ */ o(
|
|
1986
2258
|
"div",
|
|
1987
2259
|
{
|
|
@@ -1993,25 +2265,25 @@ function lr({
|
|
|
1993
2265
|
paddingTop: 8,
|
|
1994
2266
|
borderTop: "1px solid #f0f0f0"
|
|
1995
2267
|
},
|
|
1996
|
-
children: e.map((
|
|
1997
|
-
const m =
|
|
1998
|
-
|
|
1999
|
-
),
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
n:
|
|
2268
|
+
children: e.map((s, c) => {
|
|
2269
|
+
const m = Y(
|
|
2270
|
+
s.chunks
|
|
2271
|
+
), y = [
|
|
2272
|
+
J(s),
|
|
2273
|
+
T(n.scoreLabel, {
|
|
2274
|
+
n: s.matchingChunkScore.toFixed(2)
|
|
2003
2275
|
}),
|
|
2004
|
-
m.length > 0 ?
|
|
2276
|
+
m.length > 0 ? V(m, n) : n.pagesNotAvailable
|
|
2005
2277
|
].filter(
|
|
2006
|
-
(
|
|
2007
|
-
),
|
|
2008
|
-
memoryId:
|
|
2009
|
-
memoryTitle:
|
|
2010
|
-
memoryTypeId:
|
|
2011
|
-
memoryTypeName:
|
|
2278
|
+
(h) => h != null && h !== ""
|
|
2279
|
+
), d = {
|
|
2280
|
+
memoryId: s.memoryId,
|
|
2281
|
+
memoryTitle: s.memoryTitle,
|
|
2282
|
+
memoryTypeId: s.memoryTypeId,
|
|
2283
|
+
memoryTypeName: s.memoryTypeName,
|
|
2012
2284
|
pageNumbers: m
|
|
2013
|
-
},
|
|
2014
|
-
return /* @__PURE__ */
|
|
2285
|
+
}, u = `${s.memoryId}-${c}`, p = t === u;
|
|
2286
|
+
return /* @__PURE__ */ g(
|
|
2015
2287
|
"div",
|
|
2016
2288
|
{
|
|
2017
2289
|
style: {
|
|
@@ -2019,13 +2291,13 @@ function lr({
|
|
|
2019
2291
|
flexDirection: "row",
|
|
2020
2292
|
alignItems: "flex-start",
|
|
2021
2293
|
gap: "12px",
|
|
2022
|
-
paddingTop:
|
|
2023
|
-
paddingBottom:
|
|
2024
|
-
borderBottom:
|
|
2294
|
+
paddingTop: c > 0 ? 12 : 0,
|
|
2295
|
+
paddingBottom: c < e.length - 1 ? 12 : 0,
|
|
2296
|
+
borderBottom: c < e.length - 1 ? "1px solid #eee" : void 0,
|
|
2025
2297
|
minWidth: 0
|
|
2026
2298
|
},
|
|
2027
2299
|
children: [
|
|
2028
|
-
/* @__PURE__ */
|
|
2300
|
+
/* @__PURE__ */ g(
|
|
2029
2301
|
"div",
|
|
2030
2302
|
{
|
|
2031
2303
|
style: {
|
|
@@ -2046,7 +2318,7 @@ function lr({
|
|
|
2046
2318
|
whiteSpace: "pre-wrap",
|
|
2047
2319
|
wordBreak: "break-word"
|
|
2048
2320
|
},
|
|
2049
|
-
children:
|
|
2321
|
+
children: X(s.chunks)
|
|
2050
2322
|
}
|
|
2051
2323
|
),
|
|
2052
2324
|
/* @__PURE__ */ o(
|
|
@@ -2058,23 +2330,23 @@ function lr({
|
|
|
2058
2330
|
color: "#94a3b8",
|
|
2059
2331
|
lineHeight: 1.35
|
|
2060
2332
|
},
|
|
2061
|
-
children:
|
|
2333
|
+
children: y.join(" · ")
|
|
2062
2334
|
}
|
|
2063
2335
|
)
|
|
2064
2336
|
]
|
|
2065
2337
|
}
|
|
2066
2338
|
),
|
|
2067
|
-
l && /* @__PURE__ */
|
|
2339
|
+
l && /* @__PURE__ */ g(
|
|
2068
2340
|
"button",
|
|
2069
2341
|
{
|
|
2070
2342
|
type: "button",
|
|
2071
|
-
"aria-busy":
|
|
2072
|
-
disabled:
|
|
2343
|
+
"aria-busy": p,
|
|
2344
|
+
disabled: p,
|
|
2073
2345
|
onClick: async () => {
|
|
2074
|
-
i(
|
|
2346
|
+
i(u);
|
|
2075
2347
|
try {
|
|
2076
2348
|
await r(
|
|
2077
|
-
|
|
2349
|
+
d
|
|
2078
2350
|
);
|
|
2079
2351
|
} finally {
|
|
2080
2352
|
i(null);
|
|
@@ -2090,42 +2362,42 @@ function lr({
|
|
|
2090
2362
|
background: "#eff6ff",
|
|
2091
2363
|
border: "1px solid #bfdbfe",
|
|
2092
2364
|
borderRadius: 6,
|
|
2093
|
-
cursor:
|
|
2365
|
+
cursor: p ? "wait" : "pointer",
|
|
2094
2366
|
fontFamily: "inherit",
|
|
2095
2367
|
display: "inline-flex",
|
|
2096
2368
|
alignItems: "center",
|
|
2097
2369
|
gap: 8
|
|
2098
2370
|
},
|
|
2099
2371
|
children: [
|
|
2100
|
-
|
|
2372
|
+
p && /* @__PURE__ */ o(
|
|
2101
2373
|
"span",
|
|
2102
2374
|
{
|
|
2103
2375
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
2104
2376
|
"aria-hidden": !0
|
|
2105
2377
|
}
|
|
2106
2378
|
),
|
|
2107
|
-
|
|
2379
|
+
n.viewButton
|
|
2108
2380
|
]
|
|
2109
2381
|
}
|
|
2110
2382
|
)
|
|
2111
2383
|
]
|
|
2112
2384
|
},
|
|
2113
|
-
|
|
2385
|
+
u
|
|
2114
2386
|
);
|
|
2115
2387
|
})
|
|
2116
2388
|
}
|
|
2117
2389
|
);
|
|
2118
2390
|
}
|
|
2119
|
-
function
|
|
2391
|
+
function $r({
|
|
2120
2392
|
group: e,
|
|
2121
2393
|
t: r,
|
|
2122
|
-
expanded:
|
|
2123
|
-
onToggle:
|
|
2394
|
+
expanded: n,
|
|
2395
|
+
onToggle: t,
|
|
2124
2396
|
onSearchResultClick: i
|
|
2125
2397
|
}) {
|
|
2126
|
-
const l = e.items.map((
|
|
2127
|
-
return /* @__PURE__ */
|
|
2128
|
-
|
|
2398
|
+
const l = e.items.map((c) => c.item), s = l.some((c) => c.chunks.length > 0);
|
|
2399
|
+
return /* @__PURE__ */ g(
|
|
2400
|
+
I.div,
|
|
2129
2401
|
{
|
|
2130
2402
|
initial: { opacity: 0 },
|
|
2131
2403
|
animate: { opacity: 1 },
|
|
@@ -2155,7 +2427,7 @@ function cr({
|
|
|
2155
2427
|
children: /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 })
|
|
2156
2428
|
}
|
|
2157
2429
|
),
|
|
2158
|
-
/* @__PURE__ */
|
|
2430
|
+
/* @__PURE__ */ g(
|
|
2159
2431
|
"div",
|
|
2160
2432
|
{
|
|
2161
2433
|
style: {
|
|
@@ -2178,7 +2450,7 @@ function cr({
|
|
|
2178
2450
|
children: e.memoryTitle
|
|
2179
2451
|
}
|
|
2180
2452
|
),
|
|
2181
|
-
/* @__PURE__ */
|
|
2453
|
+
/* @__PURE__ */ g(
|
|
2182
2454
|
"div",
|
|
2183
2455
|
{
|
|
2184
2456
|
style: {
|
|
@@ -2198,14 +2470,14 @@ function cr({
|
|
|
2198
2470
|
color: "#666",
|
|
2199
2471
|
whiteSpace: "nowrap"
|
|
2200
2472
|
},
|
|
2201
|
-
children:
|
|
2473
|
+
children: Or(l, r)
|
|
2202
2474
|
}
|
|
2203
2475
|
),
|
|
2204
|
-
|
|
2476
|
+
s && /* @__PURE__ */ o(
|
|
2205
2477
|
"button",
|
|
2206
2478
|
{
|
|
2207
2479
|
type: "button",
|
|
2208
|
-
onClick:
|
|
2480
|
+
onClick: t,
|
|
2209
2481
|
style: {
|
|
2210
2482
|
border: "none",
|
|
2211
2483
|
background: "none",
|
|
@@ -2216,14 +2488,14 @@ function cr({
|
|
|
2216
2488
|
textDecoration: "underline",
|
|
2217
2489
|
fontFamily: "inherit"
|
|
2218
2490
|
},
|
|
2219
|
-
children:
|
|
2491
|
+
children: n ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
2220
2492
|
}
|
|
2221
2493
|
)
|
|
2222
2494
|
]
|
|
2223
2495
|
}
|
|
2224
2496
|
),
|
|
2225
|
-
|
|
2226
|
-
|
|
2497
|
+
n && s && /* @__PURE__ */ o(
|
|
2498
|
+
jr,
|
|
2227
2499
|
{
|
|
2228
2500
|
items: l,
|
|
2229
2501
|
onSearchResultClick: i,
|
|
@@ -2237,26 +2509,26 @@ function cr({
|
|
|
2237
2509
|
}
|
|
2238
2510
|
);
|
|
2239
2511
|
}
|
|
2240
|
-
function
|
|
2241
|
-
return e === 1 ? r.chunkFound :
|
|
2512
|
+
function Hr(e, r) {
|
|
2513
|
+
return e === 1 ? r.chunkFound : T(r.chunksFound, { n: e });
|
|
2242
2514
|
}
|
|
2243
|
-
const
|
|
2515
|
+
const Ur = ({
|
|
2244
2516
|
data: e,
|
|
2245
2517
|
onSearchResultClick: r,
|
|
2246
|
-
t
|
|
2518
|
+
t: n
|
|
2247
2519
|
}) => {
|
|
2248
|
-
const
|
|
2249
|
-
(
|
|
2520
|
+
const t = e.items, i = t.reduce(
|
|
2521
|
+
(p, h) => p + fe(h),
|
|
2250
2522
|
0
|
|
2251
|
-
), l = new Set(
|
|
2252
|
-
|
|
2253
|
-
...
|
|
2254
|
-
[
|
|
2523
|
+
), l = new Set(t.map((p) => p.memoryId)).size, [s, c] = E({}), m = O((p) => {
|
|
2524
|
+
c((h) => ({
|
|
2525
|
+
...h,
|
|
2526
|
+
[p]: !h[p]
|
|
2255
2527
|
}));
|
|
2256
|
-
}, []),
|
|
2528
|
+
}, []), y = z(() => Br(t), [t]), d = l === 1 ? n.memoryChatChunkResultsInOneMemory : T(n.memoryChatChunkResultsInMemories, {
|
|
2257
2529
|
n: l
|
|
2258
|
-
}),
|
|
2259
|
-
return
|
|
2530
|
+
}), u = `${Hr(i, n)} ${d}`;
|
|
2531
|
+
return t.length === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
|
|
2260
2532
|
"div",
|
|
2261
2533
|
{
|
|
2262
2534
|
style: {
|
|
@@ -2264,19 +2536,19 @@ const ur = ({
|
|
|
2264
2536
|
color: "#94a3b8",
|
|
2265
2537
|
paddingTop: 4
|
|
2266
2538
|
},
|
|
2267
|
-
children:
|
|
2539
|
+
children: n.memorySearchExploreNoResults
|
|
2268
2540
|
}
|
|
2269
|
-
) }) : /* @__PURE__ */
|
|
2270
|
-
|
|
2271
|
-
|
|
2541
|
+
) }) : /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
2542
|
+
y.map((p) => /* @__PURE__ */ o(
|
|
2543
|
+
$r,
|
|
2272
2544
|
{
|
|
2273
|
-
group:
|
|
2274
|
-
t,
|
|
2275
|
-
expanded:
|
|
2276
|
-
onToggle: () => m(
|
|
2545
|
+
group: p,
|
|
2546
|
+
t: n,
|
|
2547
|
+
expanded: s[p.memoryId] === !0,
|
|
2548
|
+
onToggle: () => m(p.memoryId),
|
|
2277
2549
|
onSearchResultClick: r
|
|
2278
2550
|
},
|
|
2279
|
-
|
|
2551
|
+
p.memoryId
|
|
2280
2552
|
)),
|
|
2281
2553
|
/* @__PURE__ */ o(
|
|
2282
2554
|
"div",
|
|
@@ -2287,69 +2559,24 @@ const ur = ({
|
|
|
2287
2559
|
marginTop: "4px",
|
|
2288
2560
|
fontStyle: "italic"
|
|
2289
2561
|
},
|
|
2290
|
-
children:
|
|
2291
|
-
}
|
|
2292
|
-
)
|
|
2293
|
-
] });
|
|
2294
|
-
}, mr = ({
|
|
2295
|
-
data: e,
|
|
2296
|
-
isLatest: r = !1,
|
|
2297
|
-
durationSeconds: t,
|
|
2298
|
-
t: n
|
|
2299
|
-
}) => {
|
|
2300
|
-
const i = e.countryCode != null && e.countryCode !== "" ? S(n.googleSearchingForWithCountry, {
|
|
2301
|
-
query: e.query,
|
|
2302
|
-
country: e.countryCode
|
|
2303
|
-
}) : S(n.googleSearchingFor, {
|
|
2304
|
-
query: e.query
|
|
2305
|
-
});
|
|
2306
|
-
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
2307
|
-
/* @__PURE__ */ o(
|
|
2308
|
-
C.div,
|
|
2309
|
-
{
|
|
2310
|
-
style: { color: "#666" },
|
|
2311
|
-
initial: { opacity: 0, y: -10 },
|
|
2312
|
-
animate: { opacity: 1, y: 0 },
|
|
2313
|
-
transition: { duration: 0.3, delay: 0 },
|
|
2314
|
-
children: r && !t ? /* @__PURE__ */ o(
|
|
2315
|
-
M,
|
|
2316
|
-
{
|
|
2317
|
-
text: i,
|
|
2318
|
-
duration: 2.5,
|
|
2319
|
-
repeat: !0,
|
|
2320
|
-
color: "#999",
|
|
2321
|
-
shimmerColor: "#000"
|
|
2322
|
-
}
|
|
2323
|
-
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: i })
|
|
2324
|
-
}
|
|
2325
|
-
),
|
|
2326
|
-
t !== void 0 && /* @__PURE__ */ o(
|
|
2327
|
-
"div",
|
|
2328
|
-
{
|
|
2329
|
-
style: {
|
|
2330
|
-
fontSize: "12px",
|
|
2331
|
-
color: "#999",
|
|
2332
|
-
marginTop: "4px",
|
|
2333
|
-
fontStyle: "italic"
|
|
2334
|
-
},
|
|
2335
|
-
children: S(n.tookSeconds, { n: t })
|
|
2562
|
+
children: u
|
|
2336
2563
|
}
|
|
2337
2564
|
)
|
|
2338
2565
|
] });
|
|
2339
|
-
},
|
|
2340
|
-
function
|
|
2566
|
+
}, le = 80;
|
|
2567
|
+
function _r(e) {
|
|
2341
2568
|
try {
|
|
2342
2569
|
return new URL(e).hostname;
|
|
2343
2570
|
} catch {
|
|
2344
2571
|
return e;
|
|
2345
2572
|
}
|
|
2346
2573
|
}
|
|
2347
|
-
function
|
|
2574
|
+
function Gr({
|
|
2348
2575
|
item: e,
|
|
2349
2576
|
t: r
|
|
2350
2577
|
}) {
|
|
2351
|
-
const [
|
|
2352
|
-
return /* @__PURE__ */
|
|
2578
|
+
const [n, t] = E(!1), i = e.description ?? "", l = i.length > le, s = i.length === 0 ? void 0 : n || !l ? i : `${i.slice(0, le)}...`;
|
|
2579
|
+
return /* @__PURE__ */ g(
|
|
2353
2580
|
"div",
|
|
2354
2581
|
{
|
|
2355
2582
|
style: {
|
|
@@ -2372,16 +2599,16 @@ function yr({
|
|
|
2372
2599
|
textDecoration: "none",
|
|
2373
2600
|
wordBreak: "break-word"
|
|
2374
2601
|
},
|
|
2375
|
-
onMouseEnter: (
|
|
2376
|
-
|
|
2602
|
+
onMouseEnter: (c) => {
|
|
2603
|
+
c.currentTarget.style.color = "#2563eb";
|
|
2377
2604
|
},
|
|
2378
|
-
onMouseLeave: (
|
|
2379
|
-
|
|
2605
|
+
onMouseLeave: (c) => {
|
|
2606
|
+
c.currentTarget.style.color = "#1f2937";
|
|
2380
2607
|
},
|
|
2381
2608
|
children: e.title
|
|
2382
2609
|
}
|
|
2383
2610
|
),
|
|
2384
|
-
/* @__PURE__ */
|
|
2611
|
+
/* @__PURE__ */ g(
|
|
2385
2612
|
"span",
|
|
2386
2613
|
{
|
|
2387
2614
|
style: {
|
|
@@ -2392,24 +2619,24 @@ function yr({
|
|
|
2392
2619
|
children: [
|
|
2393
2620
|
e.rank,
|
|
2394
2621
|
". ",
|
|
2395
|
-
|
|
2622
|
+
_r(e.link)
|
|
2396
2623
|
]
|
|
2397
2624
|
}
|
|
2398
2625
|
),
|
|
2399
|
-
|
|
2626
|
+
s != null && /* @__PURE__ */ g(F, { children: [
|
|
2400
2627
|
/* @__PURE__ */ o(
|
|
2401
2628
|
"span",
|
|
2402
2629
|
{
|
|
2403
|
-
onClick: l ? () =>
|
|
2630
|
+
onClick: l ? () => t((c) => !c) : void 0,
|
|
2404
2631
|
style: {
|
|
2405
2632
|
fontSize: 13,
|
|
2406
2633
|
color: "#666",
|
|
2407
2634
|
lineHeight: 1.5,
|
|
2408
|
-
whiteSpace:
|
|
2635
|
+
whiteSpace: n ? "pre-wrap" : void 0,
|
|
2409
2636
|
wordBreak: "break-word",
|
|
2410
2637
|
cursor: l ? "pointer" : "default"
|
|
2411
2638
|
},
|
|
2412
|
-
children:
|
|
2639
|
+
children: s
|
|
2413
2640
|
}
|
|
2414
2641
|
),
|
|
2415
2642
|
l && /* @__PURE__ */ o(
|
|
@@ -2420,7 +2647,7 @@ function yr({
|
|
|
2420
2647
|
color: "#999",
|
|
2421
2648
|
marginTop: 2
|
|
2422
2649
|
},
|
|
2423
|
-
children:
|
|
2650
|
+
children: n ? r.clickToCollapse : r.clickToExpand
|
|
2424
2651
|
}
|
|
2425
2652
|
)
|
|
2426
2653
|
] })
|
|
@@ -2428,11 +2655,57 @@ function yr({
|
|
|
2428
2655
|
}
|
|
2429
2656
|
);
|
|
2430
2657
|
}
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2658
|
+
function qr({
|
|
2659
|
+
data: e,
|
|
2660
|
+
isLatest: r,
|
|
2661
|
+
durationSeconds: n,
|
|
2662
|
+
t
|
|
2663
|
+
}) {
|
|
2664
|
+
const i = e.input.countryCode, l = e.input.query, s = i != null && i !== "" ? T(t.googleSearchingForWithCountry, {
|
|
2665
|
+
query: l,
|
|
2666
|
+
country: i
|
|
2667
|
+
}) : T(t.googleSearchingFor, {
|
|
2668
|
+
query: l
|
|
2669
|
+
});
|
|
2670
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
2671
|
+
/* @__PURE__ */ o(
|
|
2672
|
+
I.div,
|
|
2673
|
+
{
|
|
2674
|
+
style: { color: "#666" },
|
|
2675
|
+
initial: { opacity: 0, y: -10 },
|
|
2676
|
+
animate: { opacity: 1, y: 0 },
|
|
2677
|
+
transition: { duration: 0.3, delay: 0 },
|
|
2678
|
+
children: r && !n ? /* @__PURE__ */ o(
|
|
2679
|
+
R,
|
|
2680
|
+
{
|
|
2681
|
+
text: s,
|
|
2682
|
+
duration: 2.5,
|
|
2683
|
+
repeat: !0,
|
|
2684
|
+
color: "#999",
|
|
2685
|
+
shimmerColor: "#000"
|
|
2686
|
+
}
|
|
2687
|
+
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: s })
|
|
2688
|
+
}
|
|
2689
|
+
),
|
|
2690
|
+
n !== void 0 && /* @__PURE__ */ o(
|
|
2691
|
+
"div",
|
|
2692
|
+
{
|
|
2693
|
+
style: {
|
|
2694
|
+
fontSize: "12px",
|
|
2695
|
+
color: "#999",
|
|
2696
|
+
marginTop: "4px",
|
|
2697
|
+
fontStyle: "italic"
|
|
2698
|
+
},
|
|
2699
|
+
children: T(t.tookSeconds, { n })
|
|
2700
|
+
}
|
|
2701
|
+
)
|
|
2702
|
+
] });
|
|
2703
|
+
}
|
|
2704
|
+
function Qr({
|
|
2705
|
+
data: e,
|
|
2706
|
+
t: r
|
|
2707
|
+
}) {
|
|
2708
|
+
const [n, t] = E(!1), i = z(() => [...e.results ?? []].sort((m, y) => m.rank - y.rank), [e.results]), l = i.length, s = l === 1 ? r.googleResultFound : T(r.googleResultsFound, { n: l });
|
|
2436
2709
|
return l === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
|
|
2437
2710
|
"div",
|
|
2438
2711
|
{
|
|
@@ -2443,9 +2716,9 @@ const gr = ({ data: e, t: r }) => {
|
|
|
2443
2716
|
},
|
|
2444
2717
|
children: r.memorySearchExploreNoResults
|
|
2445
2718
|
}
|
|
2446
|
-
) }) : /* @__PURE__ */
|
|
2447
|
-
/* @__PURE__ */
|
|
2448
|
-
|
|
2719
|
+
) }) : /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
2720
|
+
/* @__PURE__ */ g(
|
|
2721
|
+
I.div,
|
|
2449
2722
|
{
|
|
2450
2723
|
initial: { opacity: 0 },
|
|
2451
2724
|
animate: { opacity: 1 },
|
|
@@ -2467,14 +2740,14 @@ const gr = ({ data: e, t: r }) => {
|
|
|
2467
2740
|
color: "#666",
|
|
2468
2741
|
whiteSpace: "nowrap"
|
|
2469
2742
|
},
|
|
2470
|
-
children:
|
|
2743
|
+
children: s
|
|
2471
2744
|
}
|
|
2472
2745
|
),
|
|
2473
2746
|
/* @__PURE__ */ o(
|
|
2474
2747
|
"button",
|
|
2475
2748
|
{
|
|
2476
2749
|
type: "button",
|
|
2477
|
-
onClick: () =>
|
|
2750
|
+
onClick: () => t((c) => !c),
|
|
2478
2751
|
style: {
|
|
2479
2752
|
border: "none",
|
|
2480
2753
|
background: "none",
|
|
@@ -2485,13 +2758,13 @@ const gr = ({ data: e, t: r }) => {
|
|
|
2485
2758
|
textDecoration: "underline",
|
|
2486
2759
|
fontFamily: "inherit"
|
|
2487
2760
|
},
|
|
2488
|
-
children:
|
|
2761
|
+
children: n ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
2489
2762
|
}
|
|
2490
2763
|
)
|
|
2491
2764
|
]
|
|
2492
2765
|
}
|
|
2493
2766
|
),
|
|
2494
|
-
|
|
2767
|
+
n && /* @__PURE__ */ o(
|
|
2495
2768
|
"div",
|
|
2496
2769
|
{
|
|
2497
2770
|
style: {
|
|
@@ -2502,7 +2775,7 @@ const gr = ({ data: e, t: r }) => {
|
|
|
2502
2775
|
paddingTop: 8,
|
|
2503
2776
|
borderTop: "1px solid #f0f0f0"
|
|
2504
2777
|
},
|
|
2505
|
-
children: i.map((
|
|
2778
|
+
children: i.map((c, m) => /* @__PURE__ */ o(
|
|
2506
2779
|
"div",
|
|
2507
2780
|
{
|
|
2508
2781
|
style: {
|
|
@@ -2511,79 +2784,78 @@ const gr = ({ data: e, t: r }) => {
|
|
|
2511
2784
|
borderBottom: m < i.length - 1 ? "1px solid #eee" : void 0,
|
|
2512
2785
|
minWidth: 0
|
|
2513
2786
|
},
|
|
2514
|
-
children: /* @__PURE__ */ o(
|
|
2787
|
+
children: /* @__PURE__ */ o(Gr, { item: c, t: r })
|
|
2515
2788
|
},
|
|
2516
|
-
`${
|
|
2789
|
+
`${c.link}-${c.rank}-${m}`
|
|
2517
2790
|
))
|
|
2518
2791
|
}
|
|
2519
2792
|
)
|
|
2520
2793
|
] });
|
|
2521
|
-
}
|
|
2794
|
+
}
|
|
2795
|
+
const Kr = ({
|
|
2522
2796
|
data: e,
|
|
2523
2797
|
isLatest: r = !1,
|
|
2524
|
-
durationSeconds:
|
|
2525
|
-
t
|
|
2526
|
-
}) =>
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
)
|
|
2560
|
-
] });
|
|
2561
|
-
}, se = 80, Y = 12, J = 1.4, fr = Math.ceil(
|
|
2562
|
-
Y * J
|
|
2563
|
-
), Sr = Math.ceil(
|
|
2564
|
-
5 * Y * J
|
|
2798
|
+
durationSeconds: n,
|
|
2799
|
+
t
|
|
2800
|
+
}) => e.results === void 0 ? /* @__PURE__ */ o(
|
|
2801
|
+
qr,
|
|
2802
|
+
{
|
|
2803
|
+
data: e,
|
|
2804
|
+
isLatest: r,
|
|
2805
|
+
durationSeconds: n,
|
|
2806
|
+
t
|
|
2807
|
+
}
|
|
2808
|
+
) : /* @__PURE__ */ o(Qr, { data: e, t });
|
|
2809
|
+
function Se(e, r) {
|
|
2810
|
+
if (e.error != null)
|
|
2811
|
+
return null;
|
|
2812
|
+
switch (e.status) {
|
|
2813
|
+
case "downloading":
|
|
2814
|
+
return r.scrapeStatusDownloading;
|
|
2815
|
+
case "downloaded":
|
|
2816
|
+
return r.scrapeStatusDownloaded;
|
|
2817
|
+
case "analyzing":
|
|
2818
|
+
return r.scrapeStatusAnalyzing;
|
|
2819
|
+
case "summarizing":
|
|
2820
|
+
return r.scrapeStatusSummarizing;
|
|
2821
|
+
default:
|
|
2822
|
+
return null;
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
function Xr(e) {
|
|
2826
|
+
var r;
|
|
2827
|
+
return e.error != null ? !0 : e.status != null ? !1 : (((r = e.summary) == null ? void 0 : r.length) ?? 0) > 0;
|
|
2828
|
+
}
|
|
2829
|
+
const ce = 80, Z = 12, ee = 1.4, Vr = Math.ceil(
|
|
2830
|
+
Z * ee
|
|
2831
|
+
), Yr = Math.ceil(
|
|
2832
|
+
5 * Z * ee
|
|
2565
2833
|
);
|
|
2566
|
-
function
|
|
2834
|
+
function Te(e, r = 48) {
|
|
2567
2835
|
try {
|
|
2568
|
-
const
|
|
2569
|
-
return `${
|
|
2836
|
+
const n = new URL(e), t = n.pathname.length > r ? `${n.pathname.slice(0, r)}…` : n.pathname, i = t === "/" ? "" : t;
|
|
2837
|
+
return `${n.hostname}${i}${n.search ? "…" : ""}`;
|
|
2570
2838
|
} catch {
|
|
2571
2839
|
return e.length > 64 ? `${e.slice(0, 64)}…` : e;
|
|
2572
2840
|
}
|
|
2573
2841
|
}
|
|
2574
|
-
function
|
|
2575
|
-
return e.error != null ? /* @__PURE__ */ o(
|
|
2842
|
+
function Jr({ item: e }) {
|
|
2843
|
+
return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.summary != null && e.summary !== "" ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : e.status != null ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 });
|
|
2576
2844
|
}
|
|
2577
|
-
function
|
|
2578
|
-
return e.error != null ? /* @__PURE__ */ o(
|
|
2845
|
+
function Zr({ item: e }) {
|
|
2846
|
+
return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.summary != null && e.summary !== "" ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : e.status != null ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
2579
2847
|
}
|
|
2580
|
-
function
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2848
|
+
function et({
|
|
2849
|
+
item: e,
|
|
2850
|
+
t: r,
|
|
2851
|
+
isLatest: n = !1
|
|
2852
|
+
}) {
|
|
2853
|
+
const t = e.error ?? e.summary ?? "", i = t.length > 0, l = e.error != null, s = D(null), c = e.summary != null && e.summary !== "", m = Se(e, r), y = l || c || !i && m != null, d = e.error == null && (e.summary == null || e.summary === "");
|
|
2854
|
+
return P(() => {
|
|
2855
|
+
const u = s.current;
|
|
2856
|
+
u != null && i && (u.scrollTop = u.scrollHeight);
|
|
2857
|
+
}, [t, i]), /* @__PURE__ */ g(
|
|
2858
|
+
I.div,
|
|
2587
2859
|
{
|
|
2588
2860
|
initial: { opacity: 0 },
|
|
2589
2861
|
animate: { opacity: 1 },
|
|
@@ -2591,7 +2863,7 @@ function br({ item: e }) {
|
|
|
2591
2863
|
style: {
|
|
2592
2864
|
display: "flex",
|
|
2593
2865
|
flexDirection: "row",
|
|
2594
|
-
alignItems:
|
|
2866
|
+
alignItems: d ? "center" : y ? "flex-start" : "center",
|
|
2595
2867
|
gap: "10px",
|
|
2596
2868
|
minWidth: 0
|
|
2597
2869
|
},
|
|
@@ -2605,12 +2877,12 @@ function br({ item: e }) {
|
|
|
2605
2877
|
justifyContent: "center",
|
|
2606
2878
|
flexShrink: 0,
|
|
2607
2879
|
width: 32,
|
|
2608
|
-
...
|
|
2880
|
+
...d || !y ? {} : { paddingTop: 2 }
|
|
2609
2881
|
},
|
|
2610
|
-
children: /* @__PURE__ */ o(
|
|
2882
|
+
children: /* @__PURE__ */ o(Zr, { item: e })
|
|
2611
2883
|
}
|
|
2612
2884
|
),
|
|
2613
|
-
/* @__PURE__ */
|
|
2885
|
+
/* @__PURE__ */ g(
|
|
2614
2886
|
"div",
|
|
2615
2887
|
{
|
|
2616
2888
|
style: {
|
|
@@ -2634,16 +2906,26 @@ function br({ item: e }) {
|
|
|
2634
2906
|
textDecoration: "none",
|
|
2635
2907
|
wordBreak: "break-all"
|
|
2636
2908
|
},
|
|
2637
|
-
onMouseEnter: (
|
|
2638
|
-
|
|
2909
|
+
onMouseEnter: (u) => {
|
|
2910
|
+
u.currentTarget.style.textDecoration = "underline";
|
|
2639
2911
|
},
|
|
2640
|
-
onMouseLeave: (
|
|
2641
|
-
|
|
2912
|
+
onMouseLeave: (u) => {
|
|
2913
|
+
u.currentTarget.style.textDecoration = "none";
|
|
2642
2914
|
},
|
|
2643
|
-
children:
|
|
2915
|
+
children: Te(e.url)
|
|
2644
2916
|
}
|
|
2645
2917
|
),
|
|
2646
|
-
|
|
2918
|
+
!i && m != null && /* @__PURE__ */ o("div", { style: { fontSize: 12, color: "#888", minHeight: 18 }, children: n ? /* @__PURE__ */ o(
|
|
2919
|
+
R,
|
|
2920
|
+
{
|
|
2921
|
+
text: m,
|
|
2922
|
+
duration: 2.5,
|
|
2923
|
+
repeat: !0,
|
|
2924
|
+
color: "#999",
|
|
2925
|
+
shimmerColor: "#000"
|
|
2926
|
+
}
|
|
2927
|
+
) : /* @__PURE__ */ o("span", { style: { color: "#888" }, children: m }) }),
|
|
2928
|
+
i && /* @__PURE__ */ o(
|
|
2647
2929
|
"div",
|
|
2648
2930
|
{
|
|
2649
2931
|
style: {
|
|
@@ -2655,20 +2937,20 @@ function br({ item: e }) {
|
|
|
2655
2937
|
children: /* @__PURE__ */ o(
|
|
2656
2938
|
"div",
|
|
2657
2939
|
{
|
|
2658
|
-
ref:
|
|
2940
|
+
ref: s,
|
|
2659
2941
|
style: {
|
|
2660
|
-
minHeight:
|
|
2661
|
-
maxHeight:
|
|
2942
|
+
minHeight: Vr,
|
|
2943
|
+
maxHeight: Yr,
|
|
2662
2944
|
height: "auto",
|
|
2663
2945
|
overflowY: "auto",
|
|
2664
2946
|
overflowX: "hidden",
|
|
2665
|
-
fontSize:
|
|
2666
|
-
lineHeight:
|
|
2947
|
+
fontSize: Z,
|
|
2948
|
+
lineHeight: ee,
|
|
2667
2949
|
whiteSpace: "pre-wrap",
|
|
2668
2950
|
wordBreak: "break-word",
|
|
2669
|
-
color:
|
|
2951
|
+
color: l ? "#c62828" : "#888"
|
|
2670
2952
|
},
|
|
2671
|
-
children:
|
|
2953
|
+
children: t
|
|
2672
2954
|
}
|
|
2673
2955
|
)
|
|
2674
2956
|
}
|
|
@@ -2680,13 +2962,13 @@ function br({ item: e }) {
|
|
|
2680
2962
|
}
|
|
2681
2963
|
);
|
|
2682
2964
|
}
|
|
2683
|
-
function
|
|
2965
|
+
function rt({
|
|
2684
2966
|
item: e,
|
|
2685
2967
|
t: r
|
|
2686
2968
|
}) {
|
|
2687
|
-
const [
|
|
2688
|
-
return /* @__PURE__ */
|
|
2689
|
-
|
|
2969
|
+
const [n, t] = E(!1), i = e.error ?? e.summary ?? "", l = e.error != null, s = i.length > ce, c = i.length === 0 ? void 0 : n || !s ? i : `${i.slice(0, ce)}...`, m = Se(e, r), y = e.error == null && (e.summary == null || e.summary === "") && e.status != null;
|
|
2970
|
+
return /* @__PURE__ */ g(
|
|
2971
|
+
I.div,
|
|
2690
2972
|
{
|
|
2691
2973
|
initial: { opacity: 0 },
|
|
2692
2974
|
animate: { opacity: 1 },
|
|
@@ -2694,7 +2976,7 @@ function vr({
|
|
|
2694
2976
|
style: {
|
|
2695
2977
|
display: "flex",
|
|
2696
2978
|
flexDirection: "row",
|
|
2697
|
-
alignItems: "flex-start",
|
|
2979
|
+
alignItems: y ? "center" : "flex-start",
|
|
2698
2980
|
gap: "10px",
|
|
2699
2981
|
minWidth: 0
|
|
2700
2982
|
},
|
|
@@ -2708,12 +2990,12 @@ function vr({
|
|
|
2708
2990
|
justifyContent: "center",
|
|
2709
2991
|
flexShrink: 0,
|
|
2710
2992
|
width: 32,
|
|
2711
|
-
paddingTop: 2
|
|
2993
|
+
...y ? {} : { paddingTop: 2 }
|
|
2712
2994
|
},
|
|
2713
|
-
children: /* @__PURE__ */ o(
|
|
2995
|
+
children: /* @__PURE__ */ o(Jr, { item: e })
|
|
2714
2996
|
}
|
|
2715
2997
|
),
|
|
2716
|
-
/* @__PURE__ */
|
|
2998
|
+
/* @__PURE__ */ g(
|
|
2717
2999
|
"div",
|
|
2718
3000
|
{
|
|
2719
3001
|
style: {
|
|
@@ -2737,32 +3019,43 @@ function vr({
|
|
|
2737
3019
|
textDecoration: "none",
|
|
2738
3020
|
wordBreak: "break-all"
|
|
2739
3021
|
},
|
|
2740
|
-
onMouseEnter: (
|
|
2741
|
-
|
|
3022
|
+
onMouseEnter: (d) => {
|
|
3023
|
+
d.currentTarget.style.textDecoration = "underline";
|
|
2742
3024
|
},
|
|
2743
|
-
onMouseLeave: (
|
|
2744
|
-
|
|
3025
|
+
onMouseLeave: (d) => {
|
|
3026
|
+
d.currentTarget.style.textDecoration = "none";
|
|
2745
3027
|
},
|
|
2746
|
-
children:
|
|
3028
|
+
children: Te(e.url)
|
|
2747
3029
|
}
|
|
2748
3030
|
),
|
|
2749
|
-
|
|
3031
|
+
c == null && m != null && /* @__PURE__ */ o(
|
|
3032
|
+
"span",
|
|
3033
|
+
{
|
|
3034
|
+
style: {
|
|
3035
|
+
fontSize: 12,
|
|
3036
|
+
color: "#888",
|
|
3037
|
+
lineHeight: 1.4
|
|
3038
|
+
},
|
|
3039
|
+
children: m
|
|
3040
|
+
}
|
|
3041
|
+
),
|
|
3042
|
+
c != null && /* @__PURE__ */ g(F, { children: [
|
|
2750
3043
|
/* @__PURE__ */ o(
|
|
2751
3044
|
"span",
|
|
2752
3045
|
{
|
|
2753
|
-
onClick:
|
|
3046
|
+
onClick: s ? () => t((d) => !d) : void 0,
|
|
2754
3047
|
style: {
|
|
2755
3048
|
fontSize: 12,
|
|
2756
3049
|
color: l ? "#c62828" : "#666",
|
|
2757
3050
|
lineHeight: 1.4,
|
|
2758
|
-
whiteSpace:
|
|
3051
|
+
whiteSpace: n ? "pre-wrap" : void 0,
|
|
2759
3052
|
wordBreak: "break-word",
|
|
2760
|
-
cursor:
|
|
3053
|
+
cursor: s ? "pointer" : "default"
|
|
2761
3054
|
},
|
|
2762
|
-
children:
|
|
3055
|
+
children: c
|
|
2763
3056
|
}
|
|
2764
3057
|
),
|
|
2765
|
-
|
|
3058
|
+
s && /* @__PURE__ */ o(
|
|
2766
3059
|
"span",
|
|
2767
3060
|
{
|
|
2768
3061
|
style: {
|
|
@@ -2770,7 +3063,7 @@ function vr({
|
|
|
2770
3063
|
color: "#999",
|
|
2771
3064
|
marginTop: 2
|
|
2772
3065
|
},
|
|
2773
|
-
children:
|
|
3066
|
+
children: n ? r.clickToCollapse : r.clickToExpand
|
|
2774
3067
|
}
|
|
2775
3068
|
)
|
|
2776
3069
|
] })
|
|
@@ -2781,7 +3074,7 @@ function vr({
|
|
|
2781
3074
|
}
|
|
2782
3075
|
);
|
|
2783
3076
|
}
|
|
2784
|
-
function
|
|
3077
|
+
function de(e, r) {
|
|
2785
3078
|
return /* @__PURE__ */ o(
|
|
2786
3079
|
"div",
|
|
2787
3080
|
{
|
|
@@ -2793,33 +3086,74 @@ function le(e, r) {
|
|
|
2793
3086
|
paddingTop: 8,
|
|
2794
3087
|
borderTop: "1px solid #f0f0f0"
|
|
2795
3088
|
},
|
|
2796
|
-
children: e.map((
|
|
3089
|
+
children: e.map((n, t) => /* @__PURE__ */ o(
|
|
2797
3090
|
"div",
|
|
2798
3091
|
{
|
|
2799
3092
|
style: {
|
|
2800
|
-
paddingTop:
|
|
2801
|
-
paddingBottom:
|
|
2802
|
-
borderBottom:
|
|
3093
|
+
paddingTop: t > 0 ? 12 : 0,
|
|
3094
|
+
paddingBottom: t < e.length - 1 ? 12 : 0,
|
|
3095
|
+
borderBottom: t < e.length - 1 ? "1px solid #eee" : void 0,
|
|
2803
3096
|
minWidth: 0
|
|
2804
3097
|
},
|
|
2805
|
-
children: r(
|
|
3098
|
+
children: r(n, t)
|
|
2806
3099
|
},
|
|
2807
|
-
`${
|
|
3100
|
+
`${n.url}-${t}`
|
|
2808
3101
|
))
|
|
2809
3102
|
}
|
|
2810
3103
|
);
|
|
2811
3104
|
}
|
|
2812
|
-
|
|
3105
|
+
function tt({
|
|
2813
3106
|
data: e,
|
|
2814
|
-
isLatest: r
|
|
3107
|
+
isLatest: r,
|
|
3108
|
+
durationSeconds: n,
|
|
2815
3109
|
t
|
|
2816
|
-
})
|
|
2817
|
-
const
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
3110
|
+
}) {
|
|
3111
|
+
const i = e.input.urls, l = e.input.query, s = i.length, c = s === 1 ? T(t.scrapingPage, { query: l }) : T(t.scrapingPages, { n: s, query: l });
|
|
3112
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
3113
|
+
/* @__PURE__ */ o(
|
|
3114
|
+
I.div,
|
|
3115
|
+
{
|
|
3116
|
+
style: { color: "#666" },
|
|
3117
|
+
initial: { opacity: 0, y: -10 },
|
|
3118
|
+
animate: { opacity: 1, y: 0 },
|
|
3119
|
+
transition: { duration: 0.3, delay: 0 },
|
|
3120
|
+
children: r && !n ? /* @__PURE__ */ o(
|
|
3121
|
+
R,
|
|
3122
|
+
{
|
|
3123
|
+
text: c,
|
|
3124
|
+
duration: 2.5,
|
|
3125
|
+
repeat: !0,
|
|
3126
|
+
color: "#999",
|
|
3127
|
+
shimmerColor: "#000"
|
|
3128
|
+
}
|
|
3129
|
+
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: c })
|
|
3130
|
+
}
|
|
3131
|
+
),
|
|
3132
|
+
n !== void 0 && /* @__PURE__ */ o(
|
|
3133
|
+
"div",
|
|
3134
|
+
{
|
|
3135
|
+
style: {
|
|
3136
|
+
fontSize: "12px",
|
|
3137
|
+
color: "#999",
|
|
3138
|
+
marginTop: "4px",
|
|
3139
|
+
fontStyle: "italic"
|
|
3140
|
+
},
|
|
3141
|
+
children: T(t.tookSeconds, { n })
|
|
3142
|
+
}
|
|
3143
|
+
)
|
|
3144
|
+
] });
|
|
3145
|
+
}
|
|
3146
|
+
function nt({
|
|
3147
|
+
data: e,
|
|
3148
|
+
isLatest: r = !1,
|
|
3149
|
+
t: n
|
|
3150
|
+
}) {
|
|
3151
|
+
const [t, i] = E(!1), l = e.results ?? [], { successCount: s, errorCount: c } = z(() => {
|
|
3152
|
+
let f = 0, S = 0;
|
|
3153
|
+
for (const x of l)
|
|
3154
|
+
x.error != null ? S += 1 : f += 1;
|
|
3155
|
+
return { successCount: f, errorCount: S };
|
|
3156
|
+
}, [l]), m = l.length, y = e.input.query, d = l.length > 0 && l.every((f) => Xr(f)), u = r && !d ? m === 1 ? T(n.scrapingPage, { query: y }) : T(n.scrapingPages, { n: m, query: y }) : m === 1 ? n.scrapedPage : T(n.scrapedPages, { n: m }), p = T(n.scrapeOkCount, { n: s }), h = c > 0 ? `${u} - ${p}, ${T(n.scrapeFailedCount, { n: c })}` : `${u} - ${p}`;
|
|
2823
3157
|
return m === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
|
|
2824
3158
|
"div",
|
|
2825
3159
|
{
|
|
@@ -2828,11 +3162,11 @@ const Tr = ({
|
|
|
2828
3162
|
color: "#94a3b8",
|
|
2829
3163
|
paddingTop: 4
|
|
2830
3164
|
},
|
|
2831
|
-
children:
|
|
3165
|
+
children: n.memorySearchExploreNoResults
|
|
2832
3166
|
}
|
|
2833
|
-
) }) : r ? /* @__PURE__ */
|
|
3167
|
+
) }) : r ? /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
2834
3168
|
/* @__PURE__ */ o(
|
|
2835
|
-
|
|
3169
|
+
I.div,
|
|
2836
3170
|
{
|
|
2837
3171
|
initial: { opacity: 0 },
|
|
2838
3172
|
animate: { opacity: 1 },
|
|
@@ -2845,22 +3179,38 @@ const Tr = ({
|
|
|
2845
3179
|
gap: "6px 12px",
|
|
2846
3180
|
minWidth: 0
|
|
2847
3181
|
},
|
|
2848
|
-
children: /* @__PURE__ */ o(
|
|
3182
|
+
children: r && !d ? /* @__PURE__ */ o(
|
|
3183
|
+
R,
|
|
3184
|
+
{
|
|
3185
|
+
text: h,
|
|
3186
|
+
duration: 2.5,
|
|
3187
|
+
repeat: !0,
|
|
3188
|
+
color: "#999",
|
|
3189
|
+
shimmerColor: "#000"
|
|
3190
|
+
}
|
|
3191
|
+
) : /* @__PURE__ */ o(
|
|
2849
3192
|
"span",
|
|
2850
3193
|
{
|
|
2851
3194
|
style: {
|
|
2852
3195
|
fontSize: 12,
|
|
2853
3196
|
color: "#666"
|
|
2854
3197
|
},
|
|
2855
|
-
children:
|
|
3198
|
+
children: h
|
|
2856
3199
|
}
|
|
2857
3200
|
)
|
|
2858
3201
|
}
|
|
2859
3202
|
),
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
3203
|
+
de(l, (f) => /* @__PURE__ */ o(
|
|
3204
|
+
et,
|
|
3205
|
+
{
|
|
3206
|
+
item: f,
|
|
3207
|
+
t: n,
|
|
3208
|
+
isLatest: r
|
|
3209
|
+
}
|
|
3210
|
+
))
|
|
3211
|
+
] }) : /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
3212
|
+
/* @__PURE__ */ g(
|
|
3213
|
+
I.div,
|
|
2864
3214
|
{
|
|
2865
3215
|
initial: { opacity: 0 },
|
|
2866
3216
|
animate: { opacity: 1 },
|
|
@@ -2881,14 +3231,14 @@ const Tr = ({
|
|
|
2881
3231
|
fontSize: 12,
|
|
2882
3232
|
color: "#666"
|
|
2883
3233
|
},
|
|
2884
|
-
children:
|
|
3234
|
+
children: h
|
|
2885
3235
|
}
|
|
2886
3236
|
),
|
|
2887
3237
|
/* @__PURE__ */ o(
|
|
2888
3238
|
"button",
|
|
2889
3239
|
{
|
|
2890
3240
|
type: "button",
|
|
2891
|
-
onClick: () => i((
|
|
3241
|
+
onClick: () => i((f) => !f),
|
|
2892
3242
|
style: {
|
|
2893
3243
|
border: "none",
|
|
2894
3244
|
background: "none",
|
|
@@ -2899,31 +3249,87 @@ const Tr = ({
|
|
|
2899
3249
|
textDecoration: "underline",
|
|
2900
3250
|
fontFamily: "inherit"
|
|
2901
3251
|
},
|
|
2902
|
-
children:
|
|
3252
|
+
children: t ? n.memorySearchHideExploreResults : n.memorySearchViewExploreResults
|
|
2903
3253
|
}
|
|
2904
3254
|
)
|
|
2905
3255
|
]
|
|
2906
3256
|
}
|
|
2907
3257
|
),
|
|
2908
|
-
|
|
3258
|
+
t && de(l, (f) => /* @__PURE__ */ o(rt, { item: f, t: n }))
|
|
3259
|
+
] });
|
|
3260
|
+
}
|
|
3261
|
+
const ot = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => e.results === void 0 ? /* @__PURE__ */ o(
|
|
3262
|
+
tt,
|
|
3263
|
+
{
|
|
3264
|
+
data: e,
|
|
3265
|
+
isLatest: r,
|
|
3266
|
+
durationSeconds: n,
|
|
3267
|
+
t
|
|
3268
|
+
}
|
|
3269
|
+
) : /* @__PURE__ */ o(
|
|
3270
|
+
nt,
|
|
3271
|
+
{
|
|
3272
|
+
data: e,
|
|
3273
|
+
isLatest: r,
|
|
3274
|
+
t
|
|
3275
|
+
}
|
|
3276
|
+
), at = (e) => {
|
|
3277
|
+
const { isLatest: r = !1, durationSeconds: n, t } = e, i = t.memoryChatThinking;
|
|
3278
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
3279
|
+
/* @__PURE__ */ o(
|
|
3280
|
+
I.div,
|
|
3281
|
+
{
|
|
3282
|
+
style: {
|
|
3283
|
+
display: "flex",
|
|
3284
|
+
alignItems: "center",
|
|
3285
|
+
gap: "10px",
|
|
3286
|
+
color: "#666"
|
|
3287
|
+
},
|
|
3288
|
+
initial: { opacity: 0, y: -10 },
|
|
3289
|
+
animate: { opacity: 1, y: 0 },
|
|
3290
|
+
transition: { duration: 0.3, delay: 0 },
|
|
3291
|
+
children: r && !n ? /* @__PURE__ */ o(
|
|
3292
|
+
R,
|
|
3293
|
+
{
|
|
3294
|
+
text: i,
|
|
3295
|
+
duration: 2.5,
|
|
3296
|
+
repeat: !0,
|
|
3297
|
+
color: "#999",
|
|
3298
|
+
shimmerColor: "#000"
|
|
3299
|
+
}
|
|
3300
|
+
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: i })
|
|
3301
|
+
}
|
|
3302
|
+
),
|
|
3303
|
+
n !== void 0 && /* @__PURE__ */ o(
|
|
3304
|
+
"div",
|
|
3305
|
+
{
|
|
3306
|
+
style: {
|
|
3307
|
+
fontSize: "12px",
|
|
3308
|
+
color: "#999",
|
|
3309
|
+
marginTop: "4px",
|
|
3310
|
+
fontStyle: "italic"
|
|
3311
|
+
},
|
|
3312
|
+
children: T(t.tookSeconds, { n })
|
|
3313
|
+
}
|
|
3314
|
+
)
|
|
2909
3315
|
] });
|
|
2910
3316
|
};
|
|
2911
|
-
function
|
|
2912
|
-
return e.error != null ? /* @__PURE__ */ o(
|
|
3317
|
+
function it({ item: e }) {
|
|
3318
|
+
return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
2913
3319
|
}
|
|
2914
|
-
function
|
|
2915
|
-
return
|
|
3320
|
+
function st(e, r) {
|
|
3321
|
+
return T(r.searchingInMemoriesOfType, {
|
|
2916
3322
|
name: e.memoryTypeName
|
|
2917
3323
|
});
|
|
2918
3324
|
}
|
|
2919
|
-
function
|
|
3325
|
+
function lt({
|
|
2920
3326
|
item: e,
|
|
2921
3327
|
t: r,
|
|
2922
|
-
showShimmerForPrimary:
|
|
3328
|
+
showShimmerForPrimary: n
|
|
2923
3329
|
}) {
|
|
2924
|
-
const
|
|
2925
|
-
return /* @__PURE__ */
|
|
2926
|
-
|
|
3330
|
+
const t = e.result != null, i = e.error != null, l = st(e, r);
|
|
3331
|
+
return /* @__PURE__ */ g(
|
|
3332
|
+
I.div,
|
|
2927
3333
|
{
|
|
2928
3334
|
initial: { opacity: 0 },
|
|
2929
3335
|
animate: { opacity: 1 },
|
|
@@ -2949,10 +3355,10 @@ function Ir({
|
|
|
2949
3355
|
flexShrink: 0,
|
|
2950
3356
|
width: 32
|
|
2951
3357
|
},
|
|
2952
|
-
children: /* @__PURE__ */ o(
|
|
3358
|
+
children: /* @__PURE__ */ o(it, { item: e })
|
|
2953
3359
|
}
|
|
2954
3360
|
),
|
|
2955
|
-
/* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ g(
|
|
2956
3362
|
"div",
|
|
2957
3363
|
{
|
|
2958
3364
|
style: {
|
|
@@ -2963,8 +3369,8 @@ function Ir({
|
|
|
2963
3369
|
flex: 1
|
|
2964
3370
|
},
|
|
2965
3371
|
children: [
|
|
2966
|
-
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !
|
|
2967
|
-
|
|
3372
|
+
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !t && !i && n ? /* @__PURE__ */ o(
|
|
3373
|
+
R,
|
|
2968
3374
|
{
|
|
2969
3375
|
text: l,
|
|
2970
3376
|
duration: 2.5,
|
|
@@ -2973,14 +3379,14 @@ function Ir({
|
|
|
2973
3379
|
shimmerColor: "#000"
|
|
2974
3380
|
}
|
|
2975
3381
|
) : l }),
|
|
2976
|
-
|
|
3382
|
+
t && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? T(
|
|
2977
3383
|
r.memorySearchTypeResultSummaryOne,
|
|
2978
3384
|
{
|
|
2979
3385
|
score: e.result.highestChunkScore.toFixed(
|
|
2980
3386
|
2
|
|
2981
3387
|
)
|
|
2982
3388
|
}
|
|
2983
|
-
) :
|
|
3389
|
+
) : T(
|
|
2984
3390
|
r.memorySearchTypeResultSummary,
|
|
2985
3391
|
{
|
|
2986
3392
|
count: e.result.numberOfChunks,
|
|
@@ -2997,33 +3403,33 @@ function Ir({
|
|
|
2997
3403
|
}
|
|
2998
3404
|
);
|
|
2999
3405
|
}
|
|
3000
|
-
const
|
|
3001
|
-
const i =
|
|
3406
|
+
const ct = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
3407
|
+
const i = z(() => {
|
|
3002
3408
|
let l = -1;
|
|
3003
|
-
return e.memoryTypes.forEach((
|
|
3004
|
-
|
|
3409
|
+
return e.memoryTypes.forEach((s, c) => {
|
|
3410
|
+
s.result == null && s.error == null && (l = c);
|
|
3005
3411
|
}), l;
|
|
3006
3412
|
}, [e.memoryTypes]);
|
|
3007
|
-
return /* @__PURE__ */
|
|
3008
|
-
r && !
|
|
3009
|
-
|
|
3413
|
+
return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
3414
|
+
r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
|
|
3415
|
+
R,
|
|
3010
3416
|
{
|
|
3011
|
-
text:
|
|
3417
|
+
text: t.searchingMemoryTypes,
|
|
3012
3418
|
duration: 2.5,
|
|
3013
3419
|
repeat: !0,
|
|
3014
3420
|
color: "#999",
|
|
3015
3421
|
shimmerColor: "#000"
|
|
3016
3422
|
}
|
|
3017
|
-
) : e.memoryTypes.map((l,
|
|
3018
|
-
|
|
3423
|
+
) : e.memoryTypes.map((l, s) => /* @__PURE__ */ o(
|
|
3424
|
+
lt,
|
|
3019
3425
|
{
|
|
3020
3426
|
item: l,
|
|
3021
|
-
t
|
|
3022
|
-
showShimmerForPrimary:
|
|
3427
|
+
t,
|
|
3428
|
+
showShimmerForPrimary: s === i && r
|
|
3023
3429
|
},
|
|
3024
3430
|
l.memoryTypeId
|
|
3025
3431
|
)),
|
|
3026
|
-
|
|
3432
|
+
n !== void 0 && /* @__PURE__ */ o(
|
|
3027
3433
|
"div",
|
|
3028
3434
|
{
|
|
3029
3435
|
style: {
|
|
@@ -3032,45 +3438,45 @@ const Er = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
3032
3438
|
marginTop: "4px",
|
|
3033
3439
|
fontStyle: "italic"
|
|
3034
3440
|
},
|
|
3035
|
-
children:
|
|
3441
|
+
children: T(t.tookSeconds, { n })
|
|
3036
3442
|
}
|
|
3037
3443
|
)
|
|
3038
3444
|
] });
|
|
3039
|
-
},
|
|
3040
|
-
|
|
3041
|
-
),
|
|
3042
|
-
5 *
|
|
3445
|
+
}, H = 12, U = 1.45, dt = Math.ceil(
|
|
3446
|
+
H * U
|
|
3447
|
+
), ut = Math.ceil(
|
|
3448
|
+
5 * H * U
|
|
3043
3449
|
);
|
|
3044
3450
|
function B(e) {
|
|
3045
3451
|
return e.queries != null && e.queries.length > 0;
|
|
3046
3452
|
}
|
|
3047
|
-
function
|
|
3453
|
+
function mt(e) {
|
|
3048
3454
|
const r = e.reasoning;
|
|
3049
3455
|
return (r == null || r === "") && !B(e);
|
|
3050
3456
|
}
|
|
3051
|
-
function
|
|
3457
|
+
function pt(e) {
|
|
3052
3458
|
if (B(e)) return 3;
|
|
3053
3459
|
const r = e.reasoning;
|
|
3054
3460
|
return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
|
|
3055
3461
|
}
|
|
3056
|
-
function
|
|
3462
|
+
function yt({ phase: e }) {
|
|
3057
3463
|
return e === 3 ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
3058
3464
|
}
|
|
3059
|
-
function
|
|
3465
|
+
function ht({
|
|
3060
3466
|
item: e,
|
|
3061
3467
|
t: r,
|
|
3062
|
-
isActiveRow:
|
|
3468
|
+
isActiveRow: n
|
|
3063
3469
|
}) {
|
|
3064
|
-
const
|
|
3065
|
-
|
|
3066
|
-
const
|
|
3067
|
-
|
|
3068
|
-
}, [l, i,
|
|
3069
|
-
const
|
|
3470
|
+
const t = mt(e), i = pt(e), l = e.reasoning, s = l != null && l.length > 0, c = D(null), [m, y] = E(!1), d = t && n, u = i === 2 && n && !B(e);
|
|
3471
|
+
P(() => {
|
|
3472
|
+
const f = c.current;
|
|
3473
|
+
f != null && i === 1 && s && (f.scrollTop = f.scrollHeight);
|
|
3474
|
+
}, [l, i, s]);
|
|
3475
|
+
const p = T(r.searchingInMemoriesOfType, {
|
|
3070
3476
|
name: e.memoryTypeName
|
|
3071
|
-
}),
|
|
3072
|
-
return /* @__PURE__ */
|
|
3073
|
-
|
|
3477
|
+
}), h = !t && i === 3;
|
|
3478
|
+
return /* @__PURE__ */ g(
|
|
3479
|
+
I.div,
|
|
3074
3480
|
{
|
|
3075
3481
|
initial: { opacity: 0 },
|
|
3076
3482
|
animate: { opacity: 1 },
|
|
@@ -3081,7 +3487,7 @@ function Pr({
|
|
|
3081
3487
|
borderBottom: "1px solid #eee",
|
|
3082
3488
|
display: "flex",
|
|
3083
3489
|
flexDirection: "row",
|
|
3084
|
-
alignItems:
|
|
3490
|
+
alignItems: h ? "flex-start" : "center",
|
|
3085
3491
|
gap: "10px",
|
|
3086
3492
|
minWidth: 0
|
|
3087
3493
|
},
|
|
@@ -3095,12 +3501,12 @@ function Pr({
|
|
|
3095
3501
|
justifyContent: "center",
|
|
3096
3502
|
flexShrink: 0,
|
|
3097
3503
|
width: 32,
|
|
3098
|
-
...
|
|
3504
|
+
...h ? { paddingTop: 2 } : {}
|
|
3099
3505
|
},
|
|
3100
|
-
children: /* @__PURE__ */ o(
|
|
3506
|
+
children: /* @__PURE__ */ o(yt, { phase: t ? 1 : i })
|
|
3101
3507
|
}
|
|
3102
3508
|
),
|
|
3103
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ g(
|
|
3104
3510
|
"div",
|
|
3105
3511
|
{
|
|
3106
3512
|
style: {
|
|
@@ -3111,17 +3517,17 @@ function Pr({
|
|
|
3111
3517
|
flex: 1
|
|
3112
3518
|
},
|
|
3113
3519
|
children: [
|
|
3114
|
-
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children:
|
|
3115
|
-
|
|
3520
|
+
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: d ? /* @__PURE__ */ o(
|
|
3521
|
+
R,
|
|
3116
3522
|
{
|
|
3117
|
-
text:
|
|
3523
|
+
text: p,
|
|
3118
3524
|
duration: 2.5,
|
|
3119
3525
|
repeat: !0,
|
|
3120
3526
|
color: "#999",
|
|
3121
3527
|
shimmerColor: "#000"
|
|
3122
3528
|
}
|
|
3123
3529
|
) : e.memoryTypeName }),
|
|
3124
|
-
i === 1 &&
|
|
3530
|
+
i === 1 && s && !B(e) && /* @__PURE__ */ g("div", { style: { minWidth: 0 }, children: [
|
|
3125
3531
|
/* @__PURE__ */ o(
|
|
3126
3532
|
"span",
|
|
3127
3533
|
{
|
|
@@ -3147,16 +3553,16 @@ function Pr({
|
|
|
3147
3553
|
children: /* @__PURE__ */ o(
|
|
3148
3554
|
"div",
|
|
3149
3555
|
{
|
|
3150
|
-
ref:
|
|
3556
|
+
ref: c,
|
|
3151
3557
|
className: "memory-search-generating-reasoning-viewport",
|
|
3152
3558
|
style: {
|
|
3153
|
-
minHeight:
|
|
3154
|
-
maxHeight:
|
|
3559
|
+
minHeight: dt,
|
|
3560
|
+
maxHeight: ut,
|
|
3155
3561
|
height: "auto",
|
|
3156
3562
|
overflowY: "auto",
|
|
3157
3563
|
overflowX: "hidden",
|
|
3158
|
-
fontSize:
|
|
3159
|
-
lineHeight:
|
|
3564
|
+
fontSize: H,
|
|
3565
|
+
lineHeight: U,
|
|
3160
3566
|
whiteSpace: "pre-wrap",
|
|
3161
3567
|
wordBreak: "break-word",
|
|
3162
3568
|
color: "#888"
|
|
@@ -3167,8 +3573,8 @@ function Pr({
|
|
|
3167
3573
|
}
|
|
3168
3574
|
)
|
|
3169
3575
|
] }),
|
|
3170
|
-
i === 2 &&
|
|
3171
|
-
|
|
3576
|
+
i === 2 && u && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
|
|
3577
|
+
R,
|
|
3172
3578
|
{
|
|
3173
3579
|
text: r.memorySearchGeneratingQueriesPending,
|
|
3174
3580
|
duration: 2.5,
|
|
@@ -3177,8 +3583,8 @@ function Pr({
|
|
|
3177
3583
|
shimmerColor: "#000"
|
|
3178
3584
|
}
|
|
3179
3585
|
) }),
|
|
3180
|
-
i === 3 && /* @__PURE__ */
|
|
3181
|
-
/* @__PURE__ */
|
|
3586
|
+
i === 3 && /* @__PURE__ */ g(F, { children: [
|
|
3587
|
+
/* @__PURE__ */ g("div", { style: { minWidth: 0 }, children: [
|
|
3182
3588
|
/* @__PURE__ */ o(
|
|
3183
3589
|
"span",
|
|
3184
3590
|
{
|
|
@@ -3200,7 +3606,7 @@ function Pr({
|
|
|
3200
3606
|
flexDirection: "column",
|
|
3201
3607
|
gap: 6
|
|
3202
3608
|
},
|
|
3203
|
-
children: e.queries.map((
|
|
3609
|
+
children: e.queries.map((f, S) => /* @__PURE__ */ o(
|
|
3204
3610
|
"div",
|
|
3205
3611
|
{
|
|
3206
3612
|
style: {
|
|
@@ -3209,19 +3615,19 @@ function Pr({
|
|
|
3209
3615
|
lineHeight: 1.5,
|
|
3210
3616
|
wordBreak: "break-word"
|
|
3211
3617
|
},
|
|
3212
|
-
children:
|
|
3618
|
+
children: f.query
|
|
3213
3619
|
},
|
|
3214
|
-
|
|
3620
|
+
S
|
|
3215
3621
|
))
|
|
3216
3622
|
}
|
|
3217
3623
|
)
|
|
3218
3624
|
] }),
|
|
3219
|
-
|
|
3625
|
+
s && /* @__PURE__ */ g(F, { children: [
|
|
3220
3626
|
/* @__PURE__ */ o(
|
|
3221
3627
|
"button",
|
|
3222
3628
|
{
|
|
3223
3629
|
type: "button",
|
|
3224
|
-
onClick: () =>
|
|
3630
|
+
onClick: () => y((f) => !f),
|
|
3225
3631
|
style: {
|
|
3226
3632
|
alignSelf: "flex-start",
|
|
3227
3633
|
border: "none",
|
|
@@ -3239,8 +3645,8 @@ function Pr({
|
|
|
3239
3645
|
"div",
|
|
3240
3646
|
{
|
|
3241
3647
|
style: {
|
|
3242
|
-
fontSize:
|
|
3243
|
-
lineHeight:
|
|
3648
|
+
fontSize: H,
|
|
3649
|
+
lineHeight: U,
|
|
3244
3650
|
whiteSpace: "pre-wrap",
|
|
3245
3651
|
wordBreak: "break-word",
|
|
3246
3652
|
color: "#888",
|
|
@@ -3260,33 +3666,33 @@ function Pr({
|
|
|
3260
3666
|
}
|
|
3261
3667
|
);
|
|
3262
3668
|
}
|
|
3263
|
-
const
|
|
3264
|
-
const i =
|
|
3669
|
+
const gt = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
3670
|
+
const i = z(() => {
|
|
3265
3671
|
let l = -1;
|
|
3266
|
-
return e.memoryTypes.forEach((
|
|
3267
|
-
B(
|
|
3672
|
+
return e.memoryTypes.forEach((s, c) => {
|
|
3673
|
+
B(s) || (l = c);
|
|
3268
3674
|
}), l;
|
|
3269
3675
|
}, [e.memoryTypes]);
|
|
3270
|
-
return /* @__PURE__ */
|
|
3271
|
-
r && !
|
|
3272
|
-
|
|
3676
|
+
return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
3677
|
+
r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
|
|
3678
|
+
R,
|
|
3273
3679
|
{
|
|
3274
|
-
text:
|
|
3680
|
+
text: t.memorySearchGeneratingQueries,
|
|
3275
3681
|
duration: 2.5,
|
|
3276
3682
|
repeat: !0,
|
|
3277
3683
|
color: "#999",
|
|
3278
3684
|
shimmerColor: "#000"
|
|
3279
3685
|
}
|
|
3280
|
-
) : e.memoryTypes.map((l,
|
|
3281
|
-
|
|
3686
|
+
) : e.memoryTypes.map((l, s) => /* @__PURE__ */ o(
|
|
3687
|
+
ht,
|
|
3282
3688
|
{
|
|
3283
3689
|
item: l,
|
|
3284
|
-
t
|
|
3285
|
-
isActiveRow:
|
|
3690
|
+
t,
|
|
3691
|
+
isActiveRow: s === i && r
|
|
3286
3692
|
},
|
|
3287
3693
|
l.memoryTypeId
|
|
3288
3694
|
)),
|
|
3289
|
-
|
|
3695
|
+
n !== void 0 && /* @__PURE__ */ o(
|
|
3290
3696
|
"div",
|
|
3291
3697
|
{
|
|
3292
3698
|
style: {
|
|
@@ -3295,20 +3701,20 @@ const Dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
|
3295
3701
|
marginTop: "4px",
|
|
3296
3702
|
fontStyle: "italic"
|
|
3297
3703
|
},
|
|
3298
|
-
children:
|
|
3704
|
+
children: T(t.tookSeconds, { n })
|
|
3299
3705
|
}
|
|
3300
3706
|
)
|
|
3301
3707
|
] });
|
|
3302
3708
|
};
|
|
3303
|
-
function
|
|
3304
|
-
return e.some((
|
|
3709
|
+
function ft(e) {
|
|
3710
|
+
return e.some((t) => t.result == null && t.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((t) => t.error != null) ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 });
|
|
3305
3711
|
}
|
|
3306
|
-
function
|
|
3712
|
+
function St(e, r) {
|
|
3307
3713
|
if (e.error != null)
|
|
3308
3714
|
return /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
|
|
3309
3715
|
if (e.result == null)
|
|
3310
3716
|
return /* @__PURE__ */ o("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ o(
|
|
3311
|
-
|
|
3717
|
+
R,
|
|
3312
3718
|
{
|
|
3313
3719
|
text: r.searching,
|
|
3314
3720
|
duration: 2.5,
|
|
@@ -3317,22 +3723,22 @@ function zr(e, r) {
|
|
|
3317
3723
|
shimmerColor: "#000"
|
|
3318
3724
|
}
|
|
3319
3725
|
) });
|
|
3320
|
-
const
|
|
3321
|
-
n:
|
|
3726
|
+
const n = e.result, t = n.numberOfChunks === 1 ? r.chunkFound : T(r.chunksFound, { n: n.numberOfChunks }), i = T(r.scoreLabel, {
|
|
3727
|
+
n: n.highestChunkScore.toFixed(2)
|
|
3322
3728
|
});
|
|
3323
|
-
return /* @__PURE__ */
|
|
3324
|
-
|
|
3729
|
+
return /* @__PURE__ */ g("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
|
|
3730
|
+
t,
|
|
3325
3731
|
" · ",
|
|
3326
3732
|
i
|
|
3327
3733
|
] });
|
|
3328
3734
|
}
|
|
3329
|
-
function
|
|
3735
|
+
function Tt({
|
|
3330
3736
|
items: e,
|
|
3331
3737
|
queryRow: r,
|
|
3332
|
-
onExploreQueryResultClick:
|
|
3333
|
-
t
|
|
3738
|
+
onExploreQueryResultClick: n,
|
|
3739
|
+
t
|
|
3334
3740
|
}) {
|
|
3335
|
-
const [i, l] =
|
|
3741
|
+
const [i, l] = E(null);
|
|
3336
3742
|
if (e.length === 0)
|
|
3337
3743
|
return /* @__PURE__ */ o(
|
|
3338
3744
|
"div",
|
|
@@ -3342,10 +3748,10 @@ function Br({
|
|
|
3342
3748
|
color: "#94a3b8",
|
|
3343
3749
|
paddingTop: 4
|
|
3344
3750
|
},
|
|
3345
|
-
children:
|
|
3751
|
+
children: t.memorySearchExploreNoResults
|
|
3346
3752
|
}
|
|
3347
3753
|
);
|
|
3348
|
-
const
|
|
3754
|
+
const s = !!n;
|
|
3349
3755
|
return /* @__PURE__ */ o(
|
|
3350
3756
|
"div",
|
|
3351
3757
|
{
|
|
@@ -3357,26 +3763,26 @@ function Br({
|
|
|
3357
3763
|
paddingTop: 8,
|
|
3358
3764
|
borderTop: "1px solid #f0f0f0"
|
|
3359
3765
|
},
|
|
3360
|
-
children: e.map((
|
|
3361
|
-
const
|
|
3362
|
-
|
|
3363
|
-
),
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
n:
|
|
3766
|
+
children: e.map((c, m) => {
|
|
3767
|
+
const y = c.memoryTitle !== "" ? c.memoryTitle : c.memoryId, d = Y(
|
|
3768
|
+
c.chunks
|
|
3769
|
+
), u = [
|
|
3770
|
+
J(c),
|
|
3771
|
+
T(t.scoreLabel, {
|
|
3772
|
+
n: c.matchingChunkScore.toFixed(2)
|
|
3367
3773
|
}),
|
|
3368
|
-
|
|
3774
|
+
d.length > 0 ? V(d, t) : t.pagesNotAvailable
|
|
3369
3775
|
].filter(
|
|
3370
|
-
(
|
|
3371
|
-
),
|
|
3372
|
-
memoryId:
|
|
3373
|
-
memoryTitle:
|
|
3374
|
-
pageNumbers:
|
|
3776
|
+
(S) => S != null && S !== ""
|
|
3777
|
+
), p = {
|
|
3778
|
+
memoryId: c.memoryId,
|
|
3779
|
+
memoryTitle: c.memoryTitle,
|
|
3780
|
+
pageNumbers: d,
|
|
3375
3781
|
memoryTypeId: r.memoryTypeId,
|
|
3376
3782
|
memoryTypeName: r.memoryTypeName,
|
|
3377
3783
|
query: r.query
|
|
3378
|
-
},
|
|
3379
|
-
return /* @__PURE__ */
|
|
3784
|
+
}, h = `${r.query}::${c.memoryId}::${m}`, f = i === h;
|
|
3785
|
+
return /* @__PURE__ */ g(
|
|
3380
3786
|
"div",
|
|
3381
3787
|
{
|
|
3382
3788
|
style: {
|
|
@@ -3390,7 +3796,7 @@ function Br({
|
|
|
3390
3796
|
minWidth: 0
|
|
3391
3797
|
},
|
|
3392
3798
|
children: [
|
|
3393
|
-
/* @__PURE__ */
|
|
3799
|
+
/* @__PURE__ */ g(
|
|
3394
3800
|
"div",
|
|
3395
3801
|
{
|
|
3396
3802
|
style: {
|
|
@@ -3409,7 +3815,7 @@ function Br({
|
|
|
3409
3815
|
fontWeight: 600,
|
|
3410
3816
|
color: "#333"
|
|
3411
3817
|
},
|
|
3412
|
-
children:
|
|
3818
|
+
children: y
|
|
3413
3819
|
}
|
|
3414
3820
|
),
|
|
3415
3821
|
/* @__PURE__ */ o(
|
|
@@ -3422,8 +3828,8 @@ function Br({
|
|
|
3422
3828
|
whiteSpace: "pre-wrap",
|
|
3423
3829
|
wordBreak: "break-word"
|
|
3424
3830
|
},
|
|
3425
|
-
children:
|
|
3426
|
-
|
|
3831
|
+
children: X(
|
|
3832
|
+
c.chunks
|
|
3427
3833
|
)
|
|
3428
3834
|
}
|
|
3429
3835
|
),
|
|
@@ -3436,23 +3842,23 @@ function Br({
|
|
|
3436
3842
|
color: "#94a3b8",
|
|
3437
3843
|
lineHeight: 1.35
|
|
3438
3844
|
},
|
|
3439
|
-
children:
|
|
3845
|
+
children: u.join(" · ")
|
|
3440
3846
|
}
|
|
3441
3847
|
)
|
|
3442
3848
|
]
|
|
3443
3849
|
}
|
|
3444
3850
|
),
|
|
3445
|
-
|
|
3851
|
+
s && /* @__PURE__ */ g(
|
|
3446
3852
|
"button",
|
|
3447
3853
|
{
|
|
3448
3854
|
type: "button",
|
|
3449
|
-
"aria-busy":
|
|
3450
|
-
disabled:
|
|
3855
|
+
"aria-busy": f,
|
|
3856
|
+
disabled: f,
|
|
3451
3857
|
onClick: async () => {
|
|
3452
|
-
l(
|
|
3858
|
+
l(h);
|
|
3453
3859
|
try {
|
|
3454
|
-
await
|
|
3455
|
-
|
|
3860
|
+
await n(
|
|
3861
|
+
p
|
|
3456
3862
|
);
|
|
3457
3863
|
} finally {
|
|
3458
3864
|
l(null);
|
|
@@ -3468,56 +3874,56 @@ function Br({
|
|
|
3468
3874
|
background: "#eff6ff",
|
|
3469
3875
|
border: "1px solid #bfdbfe",
|
|
3470
3876
|
borderRadius: 6,
|
|
3471
|
-
cursor:
|
|
3877
|
+
cursor: f ? "wait" : "pointer",
|
|
3472
3878
|
fontFamily: "inherit",
|
|
3473
3879
|
display: "inline-flex",
|
|
3474
3880
|
alignItems: "center",
|
|
3475
3881
|
gap: 8
|
|
3476
3882
|
},
|
|
3477
3883
|
children: [
|
|
3478
|
-
|
|
3884
|
+
f && /* @__PURE__ */ o(
|
|
3479
3885
|
"span",
|
|
3480
3886
|
{
|
|
3481
3887
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
3482
3888
|
"aria-hidden": !0
|
|
3483
3889
|
}
|
|
3484
3890
|
),
|
|
3485
|
-
|
|
3891
|
+
t.viewButton
|
|
3486
3892
|
]
|
|
3487
3893
|
}
|
|
3488
3894
|
)
|
|
3489
3895
|
]
|
|
3490
3896
|
},
|
|
3491
|
-
`${
|
|
3897
|
+
`${c.memoryId}-${m}`
|
|
3492
3898
|
);
|
|
3493
3899
|
})
|
|
3494
3900
|
}
|
|
3495
3901
|
);
|
|
3496
3902
|
}
|
|
3497
|
-
function
|
|
3498
|
-
const r = [],
|
|
3499
|
-
return e.forEach((
|
|
3500
|
-
let l =
|
|
3501
|
-
l == null && (r.push(
|
|
3502
|
-
memoryTypeId:
|
|
3503
|
-
memoryTypeName:
|
|
3903
|
+
function xt(e) {
|
|
3904
|
+
const r = [], n = /* @__PURE__ */ new Map();
|
|
3905
|
+
return e.forEach((t, i) => {
|
|
3906
|
+
let l = n.get(t.memoryTypeId);
|
|
3907
|
+
l == null && (r.push(t.memoryTypeId), l = {
|
|
3908
|
+
memoryTypeId: t.memoryTypeId,
|
|
3909
|
+
memoryTypeName: t.memoryTypeName,
|
|
3504
3910
|
items: []
|
|
3505
|
-
},
|
|
3506
|
-
}), r.map((
|
|
3911
|
+
}, n.set(t.memoryTypeId, l)), l.items.push({ item: t, flatIndex: i });
|
|
3912
|
+
}), r.map((t) => n.get(t));
|
|
3507
3913
|
}
|
|
3508
|
-
function
|
|
3914
|
+
function bt({
|
|
3509
3915
|
group: e,
|
|
3510
3916
|
t: r,
|
|
3511
|
-
isLatest:
|
|
3512
|
-
expandedRows:
|
|
3917
|
+
isLatest: n,
|
|
3918
|
+
expandedRows: t,
|
|
3513
3919
|
toggleExpanded: i,
|
|
3514
3920
|
onExploreQueryResultClick: l
|
|
3515
3921
|
}) {
|
|
3516
|
-
const
|
|
3922
|
+
const s = e.items.map((m) => m.item), c = s.some(
|
|
3517
3923
|
(m) => m.result == null && m.error == null
|
|
3518
3924
|
);
|
|
3519
|
-
return /* @__PURE__ */
|
|
3520
|
-
|
|
3925
|
+
return /* @__PURE__ */ g(
|
|
3926
|
+
I.div,
|
|
3521
3927
|
{
|
|
3522
3928
|
initial: { opacity: 0 },
|
|
3523
3929
|
animate: { opacity: 1 },
|
|
@@ -3528,7 +3934,7 @@ function Nr({
|
|
|
3528
3934
|
borderBottom: "1px solid #eee",
|
|
3529
3935
|
display: "flex",
|
|
3530
3936
|
flexDirection: "row",
|
|
3531
|
-
alignItems:
|
|
3937
|
+
alignItems: c ? "center" : "flex-start",
|
|
3532
3938
|
gap: "10px",
|
|
3533
3939
|
minWidth: 0
|
|
3534
3940
|
},
|
|
@@ -3542,12 +3948,12 @@ function Nr({
|
|
|
3542
3948
|
justifyContent: "center",
|
|
3543
3949
|
flexShrink: 0,
|
|
3544
3950
|
width: 32,
|
|
3545
|
-
...
|
|
3951
|
+
...c ? {} : { paddingTop: 2 }
|
|
3546
3952
|
},
|
|
3547
|
-
children:
|
|
3953
|
+
children: ft(s)
|
|
3548
3954
|
}
|
|
3549
3955
|
),
|
|
3550
|
-
/* @__PURE__ */
|
|
3956
|
+
/* @__PURE__ */ g(
|
|
3551
3957
|
"div",
|
|
3552
3958
|
{
|
|
3553
3959
|
style: {
|
|
@@ -3565,15 +3971,15 @@ function Nr({
|
|
|
3565
3971
|
fontSize: 12,
|
|
3566
3972
|
color: "#888"
|
|
3567
3973
|
},
|
|
3568
|
-
children:
|
|
3974
|
+
children: T(r.memorySearchExploreQueryTypeLabel, {
|
|
3569
3975
|
name: e.memoryTypeName
|
|
3570
3976
|
})
|
|
3571
3977
|
}
|
|
3572
3978
|
),
|
|
3573
|
-
e.items.map(({ item: m, flatIndex:
|
|
3574
|
-
var
|
|
3575
|
-
const
|
|
3576
|
-
return /* @__PURE__ */
|
|
3979
|
+
e.items.map(({ item: m, flatIndex: y }) => {
|
|
3980
|
+
var S;
|
|
3981
|
+
const d = m.result != null, u = m.error != null, p = n && !d && !u, h = t[y] === !0, f = ((S = m.result) == null ? void 0 : S.items) ?? [];
|
|
3982
|
+
return /* @__PURE__ */ g(
|
|
3577
3983
|
"div",
|
|
3578
3984
|
{
|
|
3579
3985
|
style: {
|
|
@@ -3583,7 +3989,7 @@ function Nr({
|
|
|
3583
3989
|
minWidth: 0
|
|
3584
3990
|
},
|
|
3585
3991
|
children: [
|
|
3586
|
-
/* @__PURE__ */
|
|
3992
|
+
/* @__PURE__ */ g(
|
|
3587
3993
|
"div",
|
|
3588
3994
|
{
|
|
3589
3995
|
style: {
|
|
@@ -3606,8 +4012,8 @@ function Nr({
|
|
|
3606
4012
|
flex: "1 1 12rem",
|
|
3607
4013
|
minWidth: 0
|
|
3608
4014
|
},
|
|
3609
|
-
children:
|
|
3610
|
-
|
|
4015
|
+
children: p ? /* @__PURE__ */ o(
|
|
4016
|
+
R,
|
|
3611
4017
|
{
|
|
3612
4018
|
text: m.query,
|
|
3613
4019
|
duration: 2.5,
|
|
@@ -3618,7 +4024,7 @@ function Nr({
|
|
|
3618
4024
|
) : m.query
|
|
3619
4025
|
}
|
|
3620
4026
|
),
|
|
3621
|
-
/* @__PURE__ */
|
|
4027
|
+
/* @__PURE__ */ g(
|
|
3622
4028
|
"div",
|
|
3623
4029
|
{
|
|
3624
4030
|
style: {
|
|
@@ -3629,12 +4035,12 @@ function Nr({
|
|
|
3629
4035
|
flexShrink: 0
|
|
3630
4036
|
},
|
|
3631
4037
|
children: [
|
|
3632
|
-
|
|
3633
|
-
|
|
4038
|
+
St(m, r),
|
|
4039
|
+
d && /* @__PURE__ */ o(
|
|
3634
4040
|
"button",
|
|
3635
4041
|
{
|
|
3636
4042
|
type: "button",
|
|
3637
|
-
onClick: () => i(
|
|
4043
|
+
onClick: () => i(y),
|
|
3638
4044
|
style: {
|
|
3639
4045
|
border: "none",
|
|
3640
4046
|
background: "none",
|
|
@@ -3645,7 +4051,7 @@ function Nr({
|
|
|
3645
4051
|
textDecoration: "underline",
|
|
3646
4052
|
fontFamily: "inherit"
|
|
3647
4053
|
},
|
|
3648
|
-
children:
|
|
4054
|
+
children: h ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
3649
4055
|
}
|
|
3650
4056
|
)
|
|
3651
4057
|
]
|
|
@@ -3654,10 +4060,10 @@ function Nr({
|
|
|
3654
4060
|
]
|
|
3655
4061
|
}
|
|
3656
4062
|
),
|
|
3657
|
-
|
|
3658
|
-
|
|
4063
|
+
d && h && /* @__PURE__ */ o(
|
|
4064
|
+
Tt,
|
|
3659
4065
|
{
|
|
3660
|
-
items:
|
|
4066
|
+
items: f,
|
|
3661
4067
|
queryRow: m,
|
|
3662
4068
|
onExploreQueryResultClick: l,
|
|
3663
4069
|
t: r
|
|
@@ -3665,7 +4071,7 @@ function Nr({
|
|
|
3665
4071
|
)
|
|
3666
4072
|
]
|
|
3667
4073
|
},
|
|
3668
|
-
`${e.memoryTypeId}-${
|
|
4074
|
+
`${e.memoryTypeId}-${y}-${m.query}`
|
|
3669
4075
|
);
|
|
3670
4076
|
})
|
|
3671
4077
|
]
|
|
@@ -3675,27 +4081,27 @@ function Nr({
|
|
|
3675
4081
|
}
|
|
3676
4082
|
);
|
|
3677
4083
|
}
|
|
3678
|
-
const
|
|
4084
|
+
const kt = ({
|
|
3679
4085
|
data: e,
|
|
3680
4086
|
isLatest: r = !1,
|
|
3681
|
-
durationSeconds:
|
|
3682
|
-
onExploreQueryResultClick:
|
|
4087
|
+
durationSeconds: n,
|
|
4088
|
+
onExploreQueryResultClick: t,
|
|
3683
4089
|
t: i
|
|
3684
4090
|
}) => {
|
|
3685
|
-
const [l,
|
|
4091
|
+
const [l, s] = E(
|
|
3686
4092
|
{}
|
|
3687
|
-
),
|
|
3688
|
-
|
|
3689
|
-
...
|
|
3690
|
-
[
|
|
4093
|
+
), c = O((y) => {
|
|
4094
|
+
s((d) => ({
|
|
4095
|
+
...d,
|
|
4096
|
+
[y]: !d[y]
|
|
3691
4097
|
}));
|
|
3692
|
-
}, []), m =
|
|
3693
|
-
() =>
|
|
4098
|
+
}, []), m = z(
|
|
4099
|
+
() => xt(e.queries),
|
|
3694
4100
|
[e.queries]
|
|
3695
4101
|
);
|
|
3696
|
-
return /* @__PURE__ */
|
|
3697
|
-
r && !
|
|
3698
|
-
|
|
4102
|
+
return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
4103
|
+
r && !n && e.queries.length === 0 ? /* @__PURE__ */ o(
|
|
4104
|
+
R,
|
|
3699
4105
|
{
|
|
3700
4106
|
text: i.memorySearchExploringQueries,
|
|
3701
4107
|
duration: 2.5,
|
|
@@ -3703,19 +4109,19 @@ const $r = ({
|
|
|
3703
4109
|
color: "#999",
|
|
3704
4110
|
shimmerColor: "#000"
|
|
3705
4111
|
}
|
|
3706
|
-
) : m.map((
|
|
3707
|
-
|
|
4112
|
+
) : m.map((y) => /* @__PURE__ */ o(
|
|
4113
|
+
bt,
|
|
3708
4114
|
{
|
|
3709
|
-
group:
|
|
4115
|
+
group: y,
|
|
3710
4116
|
t: i,
|
|
3711
4117
|
isLatest: r,
|
|
3712
4118
|
expandedRows: l,
|
|
3713
|
-
toggleExpanded:
|
|
3714
|
-
onExploreQueryResultClick:
|
|
4119
|
+
toggleExpanded: c,
|
|
4120
|
+
onExploreQueryResultClick: t
|
|
3715
4121
|
},
|
|
3716
|
-
|
|
4122
|
+
y.memoryTypeId
|
|
3717
4123
|
)),
|
|
3718
|
-
|
|
4124
|
+
n !== void 0 && /* @__PURE__ */ o(
|
|
3719
4125
|
"div",
|
|
3720
4126
|
{
|
|
3721
4127
|
style: {
|
|
@@ -3724,15 +4130,15 @@ const $r = ({
|
|
|
3724
4130
|
marginTop: "4px",
|
|
3725
4131
|
fontStyle: "italic"
|
|
3726
4132
|
},
|
|
3727
|
-
children:
|
|
4133
|
+
children: T(i.tookSeconds, { n })
|
|
3728
4134
|
}
|
|
3729
4135
|
)
|
|
3730
4136
|
] });
|
|
3731
|
-
},
|
|
3732
|
-
const
|
|
3733
|
-
return /* @__PURE__ */
|
|
4137
|
+
}, vt = ({ data: e, onSearchResultClick: r, t: n }) => {
|
|
4138
|
+
const t = e.response.items, i = !!r, [l, s] = E(null);
|
|
4139
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
3734
4140
|
/* @__PURE__ */ o(
|
|
3735
|
-
|
|
4141
|
+
I.div,
|
|
3736
4142
|
{
|
|
3737
4143
|
style: {
|
|
3738
4144
|
marginBottom: "12px",
|
|
@@ -3743,7 +4149,7 @@ const $r = ({
|
|
|
3743
4149
|
initial: { opacity: 0, y: -6 },
|
|
3744
4150
|
animate: { opacity: 1, y: 0 },
|
|
3745
4151
|
transition: { duration: 0.25 },
|
|
3746
|
-
children:
|
|
4152
|
+
children: n.resultsHeading
|
|
3747
4153
|
}
|
|
3748
4154
|
),
|
|
3749
4155
|
/* @__PURE__ */ o(
|
|
@@ -3754,26 +4160,26 @@ const $r = ({
|
|
|
3754
4160
|
flexDirection: "column",
|
|
3755
4161
|
gap: 0
|
|
3756
4162
|
},
|
|
3757
|
-
children:
|
|
3758
|
-
const
|
|
3759
|
-
|
|
3760
|
-
),
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
n:
|
|
4163
|
+
children: t.map((c, m) => {
|
|
4164
|
+
const y = c.memoryTitle !== "" ? c.memoryTitle : c.memoryId, d = Y(
|
|
4165
|
+
c.chunks
|
|
4166
|
+
), u = [
|
|
4167
|
+
J(c),
|
|
4168
|
+
T(n.scoreLabel, {
|
|
4169
|
+
n: c.matchingChunkScore.toFixed(2)
|
|
3764
4170
|
}),
|
|
3765
|
-
|
|
4171
|
+
d.length > 0 ? V(d, n) : n.pagesNotAvailable
|
|
3766
4172
|
].filter(
|
|
3767
|
-
(
|
|
3768
|
-
),
|
|
3769
|
-
memoryId:
|
|
3770
|
-
memoryTitle:
|
|
3771
|
-
memoryTypeId:
|
|
3772
|
-
memoryTypeName:
|
|
3773
|
-
pageNumbers:
|
|
3774
|
-
},
|
|
3775
|
-
return /* @__PURE__ */
|
|
3776
|
-
|
|
4173
|
+
(S) => S != null && S !== ""
|
|
4174
|
+
), p = {
|
|
4175
|
+
memoryId: c.memoryId,
|
|
4176
|
+
memoryTitle: c.memoryTitle,
|
|
4177
|
+
memoryTypeId: c.memoryTypeId,
|
|
4178
|
+
memoryTypeName: c.memoryTypeName,
|
|
4179
|
+
pageNumbers: d
|
|
4180
|
+
}, h = `${c.memoryId}-${m}`, f = l === h;
|
|
4181
|
+
return /* @__PURE__ */ g(
|
|
4182
|
+
I.div,
|
|
3777
4183
|
{
|
|
3778
4184
|
initial: { opacity: 0 },
|
|
3779
4185
|
animate: { opacity: 1 },
|
|
@@ -3785,11 +4191,11 @@ const $r = ({
|
|
|
3785
4191
|
gap: "12px",
|
|
3786
4192
|
paddingTop: "12px",
|
|
3787
4193
|
paddingBottom: "12px",
|
|
3788
|
-
borderBottom: m <
|
|
4194
|
+
borderBottom: m < t.length - 1 ? "1px solid #eee" : void 0,
|
|
3789
4195
|
minWidth: 0
|
|
3790
4196
|
},
|
|
3791
4197
|
children: [
|
|
3792
|
-
/* @__PURE__ */
|
|
4198
|
+
/* @__PURE__ */ g(
|
|
3793
4199
|
"div",
|
|
3794
4200
|
{
|
|
3795
4201
|
style: {
|
|
@@ -3808,7 +4214,7 @@ const $r = ({
|
|
|
3808
4214
|
fontWeight: 600,
|
|
3809
4215
|
color: "#333"
|
|
3810
4216
|
},
|
|
3811
|
-
children:
|
|
4217
|
+
children: y
|
|
3812
4218
|
}
|
|
3813
4219
|
),
|
|
3814
4220
|
/* @__PURE__ */ o(
|
|
@@ -3821,7 +4227,7 @@ const $r = ({
|
|
|
3821
4227
|
whiteSpace: "pre-wrap",
|
|
3822
4228
|
wordBreak: "break-word"
|
|
3823
4229
|
},
|
|
3824
|
-
children:
|
|
4230
|
+
children: X(c.chunks)
|
|
3825
4231
|
}
|
|
3826
4232
|
),
|
|
3827
4233
|
/* @__PURE__ */ o(
|
|
@@ -3833,24 +4239,24 @@ const $r = ({
|
|
|
3833
4239
|
color: "#94a3b8",
|
|
3834
4240
|
lineHeight: 1.35
|
|
3835
4241
|
},
|
|
3836
|
-
children:
|
|
4242
|
+
children: u.join(" · ")
|
|
3837
4243
|
}
|
|
3838
4244
|
)
|
|
3839
4245
|
]
|
|
3840
4246
|
}
|
|
3841
4247
|
),
|
|
3842
|
-
i && /* @__PURE__ */
|
|
4248
|
+
i && /* @__PURE__ */ g(
|
|
3843
4249
|
"button",
|
|
3844
4250
|
{
|
|
3845
4251
|
type: "button",
|
|
3846
|
-
"aria-busy":
|
|
3847
|
-
disabled:
|
|
4252
|
+
"aria-busy": f,
|
|
4253
|
+
disabled: f,
|
|
3848
4254
|
onClick: async () => {
|
|
3849
|
-
|
|
4255
|
+
s(h);
|
|
3850
4256
|
try {
|
|
3851
|
-
await r(
|
|
4257
|
+
await r(p);
|
|
3852
4258
|
} finally {
|
|
3853
|
-
|
|
4259
|
+
s(null);
|
|
3854
4260
|
}
|
|
3855
4261
|
},
|
|
3856
4262
|
style: {
|
|
@@ -3863,34 +4269,34 @@ const $r = ({
|
|
|
3863
4269
|
background: "#eff6ff",
|
|
3864
4270
|
border: "1px solid #bfdbfe",
|
|
3865
4271
|
borderRadius: 6,
|
|
3866
|
-
cursor:
|
|
4272
|
+
cursor: f ? "wait" : "pointer",
|
|
3867
4273
|
fontFamily: "inherit",
|
|
3868
4274
|
display: "inline-flex",
|
|
3869
4275
|
alignItems: "center",
|
|
3870
4276
|
gap: 8
|
|
3871
4277
|
},
|
|
3872
4278
|
children: [
|
|
3873
|
-
|
|
4279
|
+
f && /* @__PURE__ */ o(
|
|
3874
4280
|
"span",
|
|
3875
4281
|
{
|
|
3876
4282
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
3877
4283
|
"aria-hidden": !0
|
|
3878
4284
|
}
|
|
3879
4285
|
),
|
|
3880
|
-
|
|
4286
|
+
n.viewButton
|
|
3881
4287
|
]
|
|
3882
4288
|
}
|
|
3883
4289
|
)
|
|
3884
4290
|
]
|
|
3885
4291
|
},
|
|
3886
|
-
`${
|
|
4292
|
+
`${c.memoryId}-${m}`
|
|
3887
4293
|
);
|
|
3888
4294
|
})
|
|
3889
4295
|
}
|
|
3890
4296
|
)
|
|
3891
4297
|
] });
|
|
3892
|
-
},
|
|
3893
|
-
|
|
4298
|
+
}, N = ({ message: e }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
|
|
4299
|
+
I.div,
|
|
3894
4300
|
{
|
|
3895
4301
|
initial: { opacity: 0, y: -10 },
|
|
3896
4302
|
animate: { opacity: 1, y: 0 },
|
|
@@ -3912,180 +4318,215 @@ const $r = ({
|
|
|
3912
4318
|
}
|
|
3913
4319
|
)
|
|
3914
4320
|
}
|
|
3915
|
-
) })
|
|
4321
|
+
) });
|
|
4322
|
+
class Ct extends we.Component {
|
|
4323
|
+
constructor(r) {
|
|
4324
|
+
super(r), this.state = { hasError: !1 };
|
|
4325
|
+
}
|
|
4326
|
+
static getDerivedStateFromError() {
|
|
4327
|
+
return { hasError: !0 };
|
|
4328
|
+
}
|
|
4329
|
+
componentDidCatch(r, n) {
|
|
4330
|
+
console.error(
|
|
4331
|
+
"[fency] Progress item render failed:",
|
|
4332
|
+
this.props.progressItemId,
|
|
4333
|
+
r,
|
|
4334
|
+
n.componentStack
|
|
4335
|
+
);
|
|
4336
|
+
}
|
|
4337
|
+
render() {
|
|
4338
|
+
return this.state.hasError ? null : this.props.children;
|
|
4339
|
+
}
|
|
4340
|
+
}
|
|
4341
|
+
const wt = ({
|
|
3916
4342
|
progressViewItems: e,
|
|
3917
4343
|
loading: r,
|
|
3918
|
-
error:
|
|
3919
|
-
loadingText:
|
|
4344
|
+
error: n,
|
|
4345
|
+
loadingText: t,
|
|
3920
4346
|
t: i,
|
|
3921
4347
|
onSourceClick: l,
|
|
3922
|
-
onSearchResultClick:
|
|
3923
|
-
onExploreQueryResultClick:
|
|
4348
|
+
onSearchResultClick: s,
|
|
4349
|
+
onExploreQueryResultClick: c
|
|
3924
4350
|
}) => {
|
|
3925
|
-
const m =
|
|
3926
|
-
|
|
4351
|
+
const m = D(null);
|
|
4352
|
+
P(() => {
|
|
3927
4353
|
m.current && (m.current.scrollTop = m.current.scrollHeight);
|
|
3928
4354
|
}, [e.length]);
|
|
3929
|
-
const
|
|
3930
|
-
const
|
|
3931
|
-
if (
|
|
3932
|
-
return /* @__PURE__ */ o(
|
|
3933
|
-
if (
|
|
3934
|
-
return /* @__PURE__ */ o(
|
|
3935
|
-
if (
|
|
3936
|
-
switch (
|
|
4355
|
+
const y = (u) => {
|
|
4356
|
+
const p = u.item.data;
|
|
4357
|
+
if (p.taskType === "StreamingChatCompletion" && p.eventType === "Text")
|
|
4358
|
+
return /* @__PURE__ */ o(ie, { text: p.text });
|
|
4359
|
+
if (p.taskType === "StructuredChatCompletion" && p.eventType === "Completed")
|
|
4360
|
+
return /* @__PURE__ */ o(vr, { data: p });
|
|
4361
|
+
if (p.taskType === "MemoryChat")
|
|
4362
|
+
switch (p.eventType) {
|
|
3937
4363
|
case "Text":
|
|
3938
|
-
return /* @__PURE__ */ o(
|
|
4364
|
+
return /* @__PURE__ */ o(ie, { text: p.text });
|
|
4365
|
+
case "Thinking":
|
|
4366
|
+
return /* @__PURE__ */ o(
|
|
4367
|
+
at,
|
|
4368
|
+
{
|
|
4369
|
+
data: p,
|
|
4370
|
+
isLatest: u.isLatest,
|
|
4371
|
+
durationSeconds: u.durationSeconds,
|
|
4372
|
+
t: i
|
|
4373
|
+
}
|
|
4374
|
+
);
|
|
3939
4375
|
case "FindMemories":
|
|
3940
4376
|
return /* @__PURE__ */ o(
|
|
3941
|
-
|
|
4377
|
+
Er,
|
|
3942
4378
|
{
|
|
3943
|
-
data:
|
|
3944
|
-
isLatest:
|
|
3945
|
-
durationSeconds:
|
|
4379
|
+
data: p,
|
|
4380
|
+
isLatest: u.isLatest,
|
|
4381
|
+
durationSeconds: u.durationSeconds,
|
|
3946
4382
|
t: i
|
|
3947
4383
|
}
|
|
3948
4384
|
);
|
|
3949
4385
|
case "FindMemoriesResult":
|
|
3950
4386
|
return /* @__PURE__ */ o(
|
|
3951
|
-
|
|
4387
|
+
Mr,
|
|
3952
4388
|
{
|
|
3953
|
-
data:
|
|
4389
|
+
data: p,
|
|
3954
4390
|
t: i
|
|
3955
4391
|
}
|
|
3956
4392
|
);
|
|
3957
4393
|
case "Search":
|
|
3958
4394
|
return /* @__PURE__ */ o(
|
|
3959
|
-
|
|
4395
|
+
Ir,
|
|
3960
4396
|
{
|
|
3961
|
-
data:
|
|
3962
|
-
isLatest:
|
|
3963
|
-
durationSeconds:
|
|
4397
|
+
data: p,
|
|
4398
|
+
isLatest: u.isLatest,
|
|
4399
|
+
durationSeconds: u.durationSeconds,
|
|
3964
4400
|
t: i
|
|
3965
4401
|
}
|
|
3966
4402
|
);
|
|
3967
4403
|
case "FindSources":
|
|
3968
4404
|
return /* @__PURE__ */ o(
|
|
3969
|
-
|
|
4405
|
+
Rr,
|
|
3970
4406
|
{
|
|
3971
|
-
data:
|
|
3972
|
-
isLatest:
|
|
3973
|
-
durationSeconds:
|
|
4407
|
+
data: p,
|
|
4408
|
+
isLatest: u.isLatest,
|
|
4409
|
+
durationSeconds: u.durationSeconds,
|
|
3974
4410
|
t: i
|
|
3975
4411
|
}
|
|
3976
4412
|
);
|
|
3977
4413
|
case "SourcesResult":
|
|
3978
4414
|
return /* @__PURE__ */ o(
|
|
3979
|
-
|
|
4415
|
+
Ar,
|
|
3980
4416
|
{
|
|
3981
|
-
data:
|
|
4417
|
+
data: p,
|
|
3982
4418
|
onSourceClick: l,
|
|
3983
4419
|
t: i
|
|
3984
4420
|
}
|
|
3985
4421
|
);
|
|
3986
4422
|
case "ExploreMemories":
|
|
3987
4423
|
return /* @__PURE__ */ o(
|
|
3988
|
-
|
|
4424
|
+
zr,
|
|
3989
4425
|
{
|
|
3990
|
-
data:
|
|
3991
|
-
completed:
|
|
3992
|
-
isLatest:
|
|
4426
|
+
data: p,
|
|
4427
|
+
completed: u.completed,
|
|
4428
|
+
isLatest: u.isLatest,
|
|
3993
4429
|
t: i
|
|
3994
4430
|
}
|
|
3995
4431
|
);
|
|
3996
4432
|
case "ChunkResults":
|
|
3997
4433
|
return /* @__PURE__ */ o(
|
|
3998
|
-
|
|
4434
|
+
Ur,
|
|
3999
4435
|
{
|
|
4000
|
-
data:
|
|
4001
|
-
onSearchResultClick:
|
|
4436
|
+
data: p,
|
|
4437
|
+
onSearchResultClick: s,
|
|
4002
4438
|
t: i
|
|
4003
4439
|
}
|
|
4004
4440
|
);
|
|
4005
4441
|
case "GoogleSearch":
|
|
4006
4442
|
return /* @__PURE__ */ o(
|
|
4007
|
-
|
|
4008
|
-
{
|
|
4009
|
-
data: u,
|
|
4010
|
-
isLatest: d.isLatest,
|
|
4011
|
-
durationSeconds: d.durationSeconds,
|
|
4012
|
-
t: i
|
|
4013
|
-
}
|
|
4014
|
-
);
|
|
4015
|
-
case "GoogleSearchResult":
|
|
4016
|
-
return /* @__PURE__ */ o(gr, { data: u, t: i });
|
|
4017
|
-
case "Scrape":
|
|
4018
|
-
return /* @__PURE__ */ o(
|
|
4019
|
-
hr,
|
|
4443
|
+
Kr,
|
|
4020
4444
|
{
|
|
4021
|
-
data:
|
|
4022
|
-
isLatest:
|
|
4023
|
-
durationSeconds:
|
|
4445
|
+
data: p,
|
|
4446
|
+
isLatest: u.isLatest,
|
|
4447
|
+
durationSeconds: u.durationSeconds,
|
|
4024
4448
|
t: i
|
|
4025
4449
|
}
|
|
4026
4450
|
);
|
|
4027
|
-
case "
|
|
4451
|
+
case "ScrapeWebsites":
|
|
4028
4452
|
return /* @__PURE__ */ o(
|
|
4029
|
-
|
|
4453
|
+
ot,
|
|
4030
4454
|
{
|
|
4031
|
-
data:
|
|
4032
|
-
isLatest:
|
|
4455
|
+
data: p,
|
|
4456
|
+
isLatest: u.isLatest,
|
|
4457
|
+
durationSeconds: u.durationSeconds,
|
|
4033
4458
|
t: i
|
|
4034
4459
|
}
|
|
4035
4460
|
);
|
|
4036
4461
|
case "Completed":
|
|
4037
4462
|
return null;
|
|
4463
|
+
default: {
|
|
4464
|
+
const h = p;
|
|
4465
|
+
return h.eventType === "Error" && "message" in h ? /* @__PURE__ */ o(N, { message: h.message }) : (console.warn(
|
|
4466
|
+
"[fency] Unknown MemoryChat eventType (no UI):",
|
|
4467
|
+
h.eventType,
|
|
4468
|
+
h
|
|
4469
|
+
), null);
|
|
4470
|
+
}
|
|
4038
4471
|
}
|
|
4039
|
-
if (
|
|
4040
|
-
switch (
|
|
4472
|
+
if (p.taskType === "MemorySearch")
|
|
4473
|
+
switch (p.eventType) {
|
|
4041
4474
|
case "GeneratingQueries":
|
|
4042
4475
|
return /* @__PURE__ */ o(
|
|
4043
|
-
|
|
4476
|
+
gt,
|
|
4044
4477
|
{
|
|
4045
|
-
data:
|
|
4046
|
-
isLatest:
|
|
4047
|
-
durationSeconds:
|
|
4478
|
+
data: p,
|
|
4479
|
+
isLatest: u.isLatest,
|
|
4480
|
+
durationSeconds: u.durationSeconds,
|
|
4048
4481
|
t: i
|
|
4049
4482
|
}
|
|
4050
4483
|
);
|
|
4051
4484
|
case "ExploreQueries":
|
|
4052
4485
|
return /* @__PURE__ */ o(
|
|
4053
|
-
|
|
4486
|
+
kt,
|
|
4054
4487
|
{
|
|
4055
|
-
data:
|
|
4056
|
-
isLatest:
|
|
4057
|
-
durationSeconds:
|
|
4058
|
-
onExploreQueryResultClick:
|
|
4488
|
+
data: p,
|
|
4489
|
+
isLatest: u.isLatest,
|
|
4490
|
+
durationSeconds: u.durationSeconds,
|
|
4491
|
+
onExploreQueryResultClick: c,
|
|
4059
4492
|
t: i
|
|
4060
4493
|
}
|
|
4061
4494
|
);
|
|
4062
4495
|
case "SearchMemoryTypes":
|
|
4063
4496
|
return /* @__PURE__ */ o(
|
|
4064
|
-
|
|
4497
|
+
ct,
|
|
4065
4498
|
{
|
|
4066
|
-
data:
|
|
4067
|
-
isLatest:
|
|
4068
|
-
durationSeconds:
|
|
4499
|
+
data: p,
|
|
4500
|
+
isLatest: u.isLatest,
|
|
4501
|
+
durationSeconds: u.durationSeconds,
|
|
4069
4502
|
t: i
|
|
4070
4503
|
}
|
|
4071
4504
|
);
|
|
4072
4505
|
case "Completed":
|
|
4073
4506
|
return /* @__PURE__ */ o(
|
|
4074
|
-
|
|
4507
|
+
vt,
|
|
4075
4508
|
{
|
|
4076
|
-
data:
|
|
4077
|
-
onSearchResultClick:
|
|
4509
|
+
data: p,
|
|
4510
|
+
onSearchResultClick: s,
|
|
4078
4511
|
t: i
|
|
4079
4512
|
}
|
|
4080
4513
|
);
|
|
4514
|
+
default: {
|
|
4515
|
+
const h = p;
|
|
4516
|
+
return h.eventType === "Error" && "message" in h ? /* @__PURE__ */ o(N, { message: h.message }) : (console.warn(
|
|
4517
|
+
"[fency] Unknown MemorySearch eventType (no UI):",
|
|
4518
|
+
h.eventType,
|
|
4519
|
+
h
|
|
4520
|
+
), null);
|
|
4521
|
+
}
|
|
4081
4522
|
}
|
|
4082
|
-
return
|
|
4523
|
+
return p.taskType === "StreamingChatCompletion" && p.eventType === "Completed" ? null : p.eventType === "Error" && "message" in p ? /* @__PURE__ */ o(N, { message: p.message }) : null;
|
|
4083
4524
|
};
|
|
4084
4525
|
if (e.length === 0)
|
|
4085
|
-
return
|
|
4086
|
-
|
|
4526
|
+
return n ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(N, { message: n.message }) }) : r ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
|
|
4527
|
+
R,
|
|
4087
4528
|
{
|
|
4088
|
-
text:
|
|
4529
|
+
text: t ?? i.processingYourTask,
|
|
4089
4530
|
duration: 1.5,
|
|
4090
4531
|
repeat: !0,
|
|
4091
4532
|
repeatDelay: 0,
|
|
@@ -4093,68 +4534,76 @@ const $r = ({
|
|
|
4093
4534
|
shimmerColor: "#000"
|
|
4094
4535
|
}
|
|
4095
4536
|
) }) : null;
|
|
4096
|
-
const
|
|
4097
|
-
const
|
|
4098
|
-
return
|
|
4099
|
-
(
|
|
4100
|
-
) :
|
|
4101
|
-
(
|
|
4102
|
-
) :
|
|
4103
|
-
(
|
|
4104
|
-
) :
|
|
4105
|
-
(
|
|
4106
|
-
) :
|
|
4107
|
-
(
|
|
4108
|
-
) :
|
|
4109
|
-
(
|
|
4537
|
+
const d = e.filter((u, p) => {
|
|
4538
|
+
const h = u.item.data;
|
|
4539
|
+
return h.taskType === "MemoryChat" && h.eventType === "ExploreMemories" ? !e.slice(p + 1).some(
|
|
4540
|
+
(k) => k.item.data.taskType === "MemoryChat" && k.item.data.eventType === "ExploreMemories"
|
|
4541
|
+
) : h.taskType === "MemorySearch" && h.eventType === "GeneratingQueries" ? !e.slice(p + 1).some(
|
|
4542
|
+
(k) => k.item.data.taskType === "MemorySearch" && k.item.data.eventType === "GeneratingQueries"
|
|
4543
|
+
) : h.taskType === "MemorySearch" && h.eventType === "ExploreQueries" ? !e.slice(p + 1).some(
|
|
4544
|
+
(k) => k.item.data.taskType === "MemorySearch" && k.item.data.eventType === "ExploreQueries"
|
|
4545
|
+
) : h.taskType === "MemoryChat" && h.eventType === "ChunkResults" ? !e.slice(p + 1).some(
|
|
4546
|
+
(k) => k.item.data.taskType === "MemoryChat" && k.item.data.eventType === "ChunkResults"
|
|
4547
|
+
) : h.taskType === "MemoryChat" && h.eventType === "GoogleSearch" ? !e.slice(p + 1).some(
|
|
4548
|
+
(k) => k.item.data.taskType === "MemoryChat" && k.item.data.eventType === "GoogleSearch"
|
|
4549
|
+
) : h.taskType === "MemoryChat" && h.eventType === "Thinking" ? !e.slice(p + 1).some(
|
|
4550
|
+
(k) => k.item.data.taskType === "MemoryChat" && k.item.data.eventType === "Thinking"
|
|
4551
|
+
) : h.taskType === "MemoryChat" && h.eventType === "ScrapeWebsites" ? !e.slice(p + 1).some(
|
|
4552
|
+
(k) => k.item.data.taskType === "MemoryChat" && k.item.data.eventType === "ScrapeWebsites"
|
|
4110
4553
|
) : !0;
|
|
4111
4554
|
});
|
|
4112
|
-
return /* @__PURE__ */
|
|
4113
|
-
/* @__PURE__ */ o(
|
|
4114
|
-
|
|
4555
|
+
return /* @__PURE__ */ g("div", { id: "agent-task-progress-verbose", ref: m, children: [
|
|
4556
|
+
/* @__PURE__ */ o(Re, { children: d.map((u, p) => /* @__PURE__ */ o(
|
|
4557
|
+
I.div,
|
|
4115
4558
|
{
|
|
4116
|
-
id: `agent-task-progress-item-${
|
|
4559
|
+
id: `agent-task-progress-item-${u.item.progressItemId}`,
|
|
4117
4560
|
initial: { opacity: 0, y: -20 },
|
|
4118
4561
|
animate: { opacity: 1, y: 0 },
|
|
4119
4562
|
transition: {
|
|
4120
4563
|
duration: 0.4,
|
|
4121
|
-
delay:
|
|
4564
|
+
delay: p * 0.1,
|
|
4122
4565
|
ease: "easeOut"
|
|
4123
4566
|
},
|
|
4124
|
-
children:
|
|
4567
|
+
children: /* @__PURE__ */ o(
|
|
4568
|
+
Ct,
|
|
4569
|
+
{
|
|
4570
|
+
progressItemId: u.item.progressItemId,
|
|
4571
|
+
children: y(u)
|
|
4572
|
+
}
|
|
4573
|
+
)
|
|
4125
4574
|
},
|
|
4126
|
-
|
|
4575
|
+
u.item.progressItemId
|
|
4127
4576
|
)) }),
|
|
4128
|
-
|
|
4577
|
+
n ? /* @__PURE__ */ o("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ o(N, { message: n.message }) }) : null
|
|
4129
4578
|
] });
|
|
4130
|
-
},
|
|
4579
|
+
}, Wt = ({
|
|
4131
4580
|
agentTask: e,
|
|
4132
4581
|
language: r,
|
|
4133
|
-
onSourceClick:
|
|
4134
|
-
onSearchResultClick:
|
|
4582
|
+
onSourceClick: n,
|
|
4583
|
+
onSearchResultClick: t,
|
|
4135
4584
|
onExploreQueryResultClick: i
|
|
4136
4585
|
}) => {
|
|
4137
|
-
const l =
|
|
4586
|
+
const l = kr(e), s = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : r ?? "en", c = wr(s);
|
|
4138
4587
|
return /* @__PURE__ */ o(
|
|
4139
|
-
|
|
4588
|
+
wt,
|
|
4140
4589
|
{
|
|
4141
4590
|
progressViewItems: l,
|
|
4142
4591
|
loading: e.loading,
|
|
4143
4592
|
error: e.error,
|
|
4144
4593
|
loadingText: e.loadingText,
|
|
4145
|
-
t:
|
|
4146
|
-
onSourceClick:
|
|
4147
|
-
onSearchResultClick:
|
|
4594
|
+
t: c,
|
|
4595
|
+
onSourceClick: n,
|
|
4596
|
+
onSearchResultClick: t,
|
|
4148
4597
|
onExploreQueryResultClick: i
|
|
4149
4598
|
}
|
|
4150
4599
|
);
|
|
4151
4600
|
};
|
|
4152
4601
|
export {
|
|
4153
|
-
|
|
4602
|
+
Wt as AgentTaskProgress,
|
|
4154
4603
|
L as Checkmark,
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4604
|
+
Lt as FencyProvider,
|
|
4605
|
+
vt as MemorySearchCompletedResults,
|
|
4606
|
+
$e as StreamEventManager,
|
|
4607
|
+
j as XMark,
|
|
4608
|
+
zt as useAgentTasks
|
|
4160
4609
|
};
|