@fencyai/react 0.1.188 → 0.1.189

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/index.js CHANGED
@@ -1,36 +1,36 @@
1
- import { jsxs as f, jsx as o, Fragment as A } from "react/jsx-runtime";
2
- import { createStream as we, isStreamTimeoutEvent as Me, isStreamNotFoundEvent as Ie, isAgentTaskProgressItemUpdatedEvent as Ee, createAgentTask as Re } from "@fencyai/js";
3
- import Fe, { createContext as me, useState as R, useRef as z, useEffect as B, useCallback as O, useContext as he, useMemo as L } from "react";
4
- import { z as i } from "zod";
5
- import { motion as M, useInView as Ae, AnimatePresence as Pe } from "motion/react";
6
- import Be from "react-markdown";
7
- import { Prism as pe } from "react-syntax-highlighter";
8
- import ze from "remark-gfm";
9
- import './assets/index.css';const ge = me(
1
+ import { jsxs as f, jsx as o, Fragment as B } from "react/jsx-runtime";
2
+ import { createStream as Ie, isStreamTimeoutEvent as Re, isStreamNotFoundEvent as Fe, isAgentTaskProgressItemUpdatedEvent as Ae, createAgentTask as Be } from "@fencyai/js";
3
+ import Pe, { createContext as pe, useState as I, useRef as D, useEffect as z, useCallback as O, useContext as ge, useMemo as W } from "react";
4
+ import { z as a } from "zod";
5
+ import { motion as M, useInView as ze, AnimatePresence as De } from "motion/react";
6
+ import Le from "react-markdown";
7
+ import { Prism as ye } from "react-syntax-highlighter";
8
+ import We from "remark-gfm";
9
+ import './assets/index.css';const fe = pe(
10
10
  void 0
11
11
  );
12
- async function De(e, t) {
12
+ async function Ne(e, t) {
13
13
  const n = e.getReader();
14
14
  let r;
15
15
  for (; !(r = await n.read()).done; )
16
16
  t(r.value);
17
17
  }
18
- function Le(e) {
19
- let t, n, r, a = !1;
18
+ function Oe(e) {
19
+ let t, n, r, i = !1;
20
20
  return function(s) {
21
- t === void 0 ? (t = s, n = 0, r = -1) : t = Ne(t, s);
22
- const m = t.length;
21
+ t === void 0 ? (t = s, n = 0, r = -1) : t = $e(t, s);
22
+ const h = t.length;
23
23
  let d = 0;
24
- for (; n < m; ) {
25
- a && (t[n] === 10 && (d = ++n), a = !1);
24
+ for (; n < h; ) {
25
+ i && (t[n] === 10 && (d = ++n), i = !1);
26
26
  let u = -1;
27
- for (; n < m && u === -1; ++n)
27
+ for (; n < h && u === -1; ++n)
28
28
  switch (t[n]) {
29
29
  case 58:
30
30
  r === -1 && (r = n - d);
31
31
  break;
32
32
  case 13:
33
- a = !0;
33
+ i = !0;
34
34
  case 10:
35
35
  u = n;
36
36
  break;
@@ -39,17 +39,17 @@ function Le(e) {
39
39
  break;
40
40
  e(t.subarray(d, u), r), d = n, r = -1;
41
41
  }
42
- d === m ? t = void 0 : d !== 0 && (t = t.subarray(d), n -= d);
42
+ d === h ? t = void 0 : d !== 0 && (t = t.subarray(d), n -= d);
43
43
  };
44
44
  }
45
- function We(e, t, n) {
46
- let r = te();
47
- const a = new TextDecoder();
48
- return function(s, m) {
45
+ function je(e, t, n) {
46
+ let r = oe();
47
+ const i = new TextDecoder();
48
+ return function(s, h) {
49
49
  if (s.length === 0)
50
- n == null || n(r), r = te();
51
- else if (m > 0) {
52
- const d = a.decode(s.subarray(0, m)), u = m + (s[m + 1] === 32 ? 2 : 1), l = a.decode(s.subarray(u));
50
+ n == null || n(r), r = oe();
51
+ else if (h > 0) {
52
+ const d = i.decode(s.subarray(0, h)), u = h + (s[h + 1] === 32 ? 2 : 1), l = i.decode(s.subarray(u));
53
53
  switch (d) {
54
54
  case "data":
55
55
  r.data = r.data ? r.data + `
@@ -62,18 +62,18 @@ function We(e, t, n) {
62
62
  e(r.id = l);
63
63
  break;
64
64
  case "retry":
65
- const h = parseInt(l, 10);
66
- isNaN(h) || t(r.retry = h);
65
+ const m = parseInt(l, 10);
66
+ isNaN(m) || t(r.retry = m);
67
67
  break;
68
68
  }
69
69
  }
70
70
  };
71
71
  }
72
- function Ne(e, t) {
72
+ function $e(e, t) {
73
73
  const n = new Uint8Array(e.length + t.length);
74
74
  return n.set(e), n.set(t, e.length), n;
75
75
  }
76
- function te() {
76
+ function oe() {
77
77
  return {
78
78
  data: "",
79
79
  event: "",
@@ -81,68 +81,68 @@ function te() {
81
81
  retry: void 0
82
82
  };
83
83
  }
84
- var Oe = function(e, t) {
84
+ var He = function(e, t) {
85
85
  var n = {};
86
86
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
87
87
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
88
- for (var a = 0, r = Object.getOwnPropertySymbols(e); a < r.length; a++)
89
- t.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[a]) && (n[r[a]] = e[r[a]]);
88
+ for (var i = 0, r = Object.getOwnPropertySymbols(e); i < r.length; i++)
89
+ t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
90
90
  return n;
91
91
  };
92
- const H = "text/event-stream", je = 1e3, ne = "last-event-id";
93
- function $e(e, t) {
94
- var { signal: n, headers: r, onopen: a, onmessage: c, onclose: s, onerror: m, openWhenHidden: d, fetch: u } = t, l = Oe(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
95
- return new Promise((h, k) => {
92
+ const H = "text/event-stream", Ue = 1e3, ae = "last-event-id";
93
+ function _e(e, t) {
94
+ var { signal: n, headers: r, onopen: i, onmessage: c, onclose: s, onerror: h, openWhenHidden: d, fetch: u } = t, l = He(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
95
+ return new Promise((m, k) => {
96
96
  const y = Object.assign({}, r);
97
97
  y.accept || (y.accept = H);
98
- let p;
99
- function g() {
100
- p.abort(), document.hidden || I();
98
+ let g;
99
+ function p() {
100
+ g.abort(), document.hidden || R();
101
101
  }
102
- d || document.addEventListener("visibilitychange", g);
103
- let b = je, x = 0;
104
- function w() {
105
- document.removeEventListener("visibilitychange", g), window.clearTimeout(x), p.abort();
102
+ d || document.addEventListener("visibilitychange", p);
103
+ let b = Ue, C = 0;
104
+ function v() {
105
+ document.removeEventListener("visibilitychange", p), window.clearTimeout(C), g.abort();
106
106
  }
107
107
  n == null || n.addEventListener("abort", () => {
108
- w(), h();
108
+ v(), m();
109
109
  });
110
- const C = u ?? window.fetch, E = a ?? He;
111
- async function I() {
112
- var W;
113
- p = new AbortController();
110
+ const x = u ?? window.fetch, E = i ?? Ge;
111
+ async function R() {
112
+ var A;
113
+ g = new AbortController();
114
114
  try {
115
- const P = await C(e, Object.assign(Object.assign({}, l), { headers: y, signal: p.signal }));
116
- await E(P), await De(P.body, Le(We((v) => {
117
- v ? y[ne] = v : delete y[ne];
118
- }, (v) => {
119
- b = v;
120
- }, c))), s == null || s(), w(), h();
121
- } catch (P) {
122
- if (!p.signal.aborted)
115
+ const w = await x(e, Object.assign(Object.assign({}, l), { headers: y, signal: g.signal }));
116
+ await E(w), await Ne(w.body, Oe(je((P) => {
117
+ P ? y[ae] = P : delete y[ae];
118
+ }, (P) => {
119
+ b = P;
120
+ }, c))), s == null || s(), v(), m();
121
+ } catch (w) {
122
+ if (!g.signal.aborted)
123
123
  try {
124
- const v = (W = m == null ? void 0 : m(P)) !== null && W !== void 0 ? W : b;
125
- window.clearTimeout(x), x = window.setTimeout(I, v);
126
- } catch (v) {
127
- w(), k(v);
124
+ const P = (A = h == null ? void 0 : h(w)) !== null && A !== void 0 ? A : b;
125
+ window.clearTimeout(C), C = window.setTimeout(R, P);
126
+ } catch (P) {
127
+ v(), k(P);
128
128
  }
129
129
  }
130
130
  }
131
- I();
131
+ R();
132
132
  });
133
133
  }
134
- function He(e) {
134
+ function Ge(e) {
135
135
  const t = e.headers.get("content-type");
136
136
  if (!(t != null && t.startsWith(H)))
137
137
  throw new Error(`Expected content-type to be ${H}, Actual: ${t}`);
138
138
  }
139
- function oe(e) {
139
+ function ie(e) {
140
140
  const t = atob(e), n = new Uint8Array(t.length);
141
141
  for (let r = 0; r < t.length; r++)
142
142
  n[r] = t.charCodeAt(r);
143
143
  return new TextDecoder("utf-8").decode(n);
144
144
  }
145
- function Ue() {
145
+ function qe() {
146
146
  return `
147
147
  var connections = new Map();
148
148
 
@@ -288,10 +288,10 @@ self.onmessage = function (e) {
288
288
  };
289
289
  `.trim();
290
290
  }
291
- function ae(e) {
291
+ function se(e) {
292
292
  return e instanceof Error ? e.message : typeof e == "string" ? e : "Unknown stream error";
293
293
  }
294
- class _e {
294
+ class Qe {
295
295
  constructor(t) {
296
296
  this.activeConnections = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.worker = null, this.workerBlobUrl = null, this.workerSupported = !1, this.fency = t, this.tryInitWorker();
297
297
  }
@@ -299,12 +299,12 @@ class _e {
299
299
  try {
300
300
  if (typeof Worker > "u" || typeof Blob > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function" || typeof ReadableStream > "u")
301
301
  return;
302
- const t = Ue(), n = new Blob([t], { type: "application/javascript" }), r = URL.createObjectURL(n), a = new Worker(r);
303
- a.onmessage = (c) => {
302
+ const t = qe(), n = new Blob([t], { type: "application/javascript" }), r = URL.createObjectURL(n), i = new Worker(r);
303
+ i.onmessage = (c) => {
304
304
  this.handleWorkerMessage(c.data);
305
- }, a.onerror = (c) => {
305
+ }, i.onerror = (c) => {
306
306
  console.error("Fency stream worker error:", c.message);
307
- }, this.worker = a, this.workerBlobUrl = r, this.workerSupported = !0;
307
+ }, this.worker = i, this.workerBlobUrl = r, this.workerSupported = !0;
308
308
  } catch {
309
309
  this.workerSupported = !1, this.worker = null, this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null);
310
310
  }
@@ -315,7 +315,7 @@ class _e {
315
315
  switch (n.type) {
316
316
  case "message":
317
317
  if (n.data && n.streamId) {
318
- const r = oe(n.data);
318
+ const r = ie(n.data);
319
319
  this.broadcast(r, n.streamId);
320
320
  }
321
321
  break;
@@ -330,19 +330,19 @@ class _e {
330
330
  */
331
331
  updateStreams(t) {
332
332
  t.forEach((r) => {
333
- const a = r.stream.id;
334
- this.activeConnections.has(a) || this.connectStream(r);
333
+ const i = r.stream.id;
334
+ this.activeConnections.has(i) || this.connectStream(r);
335
335
  });
336
336
  const n = new Set(t.map((r) => r.stream.id));
337
- this.activeConnections.forEach((r, a) => {
338
- n.has(a) || (r.abort(), this.activeConnections.delete(a));
337
+ this.activeConnections.forEach((r, i) => {
338
+ n.has(i) || (r.abort(), this.activeConnections.delete(i));
339
339
  });
340
340
  }
341
341
  connectStream(t) {
342
342
  this.workerSupported && this.worker ? this.connectStreamInWorker(t) : this.connectStreamOnMainThread(t);
343
343
  }
344
344
  connectStreamInWorker(t) {
345
- const n = t.stream.id, r = `${this.fency.baseUrl}/sse/streams/${n}`, a = new AbortController(), c = {
345
+ const n = t.stream.id, r = `${this.fency.baseUrl}/sse/streams/${n}`, i = new AbortController(), c = {
346
346
  accept: H,
347
347
  "X-Fency-Publishable-Key": this.fency.publishableKey,
348
348
  "X-Fency-Stream-Token": t.stream.token
@@ -350,29 +350,29 @@ class _e {
350
350
  this.activeConnections.set(n, {
351
351
  abort: () => {
352
352
  var s;
353
- a.abort(), (s = this.worker) == null || s.postMessage({ command: "disconnect", streamId: n });
353
+ i.abort(), (s = this.worker) == null || s.postMessage({ command: "disconnect", streamId: n });
354
354
  }
355
- }), this.startWorkerStream(n, r, c, a, t);
355
+ }), this.startWorkerStream(n, r, c, i, t);
356
356
  }
357
- async startWorkerStream(t, n, r, a, c) {
357
+ async startWorkerStream(t, n, r, i, c) {
358
358
  const s = this.worker;
359
359
  if (!s) return;
360
- const m = (d) => {
361
- a.signal.aborted || (this.activeConnections.delete(t), this.broadcastError(t, d));
360
+ const h = (d) => {
361
+ i.signal.aborted || (this.activeConnections.delete(t), this.broadcastError(t, d));
362
362
  };
363
363
  try {
364
364
  const d = await fetch(n, {
365
365
  method: "GET",
366
366
  headers: r,
367
- signal: a.signal
367
+ signal: i.signal
368
368
  });
369
369
  if (!d.ok) {
370
- d.status >= 400 && d.status < 500 && d.status !== 429 ? m(`Client error ${d.status}`) : m(`HTTP ${d.status}`);
370
+ d.status >= 400 && d.status < 500 && d.status !== 429 ? h(`Client error ${d.status}`) : h(`HTTP ${d.status}`);
371
371
  return;
372
372
  }
373
373
  const u = d.body;
374
374
  if (!u) {
375
- m("No response body");
375
+ h("No response body");
376
376
  return;
377
377
  }
378
378
  if (!this.activeConnections.has(t)) {
@@ -390,8 +390,8 @@ class _e {
390
390
  }), this.activeConnections.delete(t), this.connectStreamOnMainThread(c);
391
391
  }
392
392
  } catch (d) {
393
- if (a.signal.aborted) return;
394
- m(ae(d));
393
+ if (i.signal.aborted) return;
394
+ h(se(d));
395
395
  }
396
396
  }
397
397
  connectStreamOnMainThread(t) {
@@ -399,11 +399,11 @@ class _e {
399
399
  this.activeConnections.set(n, {
400
400
  abort: () => r.abort()
401
401
  });
402
- const a = `${this.fency.baseUrl}/sse/streams/${n}`, c = {
402
+ const i = `${this.fency.baseUrl}/sse/streams/${n}`, c = {
403
403
  "X-Fency-Publishable-Key": this.fency.publishableKey,
404
404
  "X-Fency-Stream-Token": t.stream.token
405
405
  };
406
- $e(a, {
406
+ _e(i, {
407
407
  headers: c,
408
408
  signal: r.signal,
409
409
  openWhenHidden: !0,
@@ -413,12 +413,12 @@ class _e {
413
413
  },
414
414
  onmessage: (s) => {
415
415
  if (s.data) {
416
- const m = oe(s.data);
417
- this.broadcast(m, n);
416
+ const h = ie(s.data);
417
+ this.broadcast(h, n);
418
418
  }
419
419
  },
420
420
  onerror: (s) => {
421
- throw console.error("EventSource error for stream", n, ":", s), this.activeConnections.delete(n), this.broadcastError(n, ae(s)), s;
421
+ throw console.error("EventSource error for stream", n, ":", s), this.activeConnections.delete(n), this.broadcastError(n, se(s)), s;
422
422
  },
423
423
  onclose() {
424
424
  }
@@ -457,317 +457,322 @@ class _e {
457
457
  this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null), this.workerSupported = !1, this.subscribers.clear();
458
458
  }
459
459
  }
460
- const Ge = 48e4, qe = 3e5, ie = (e) => {
460
+ const Ke = 48e4, Ve = 3e5, le = (e) => {
461
461
  const t = Date.now();
462
- return e.filter((n) => t - n.createdAt < Ge);
462
+ return e.filter((n) => t - n.createdAt < Ke);
463
463
  };
464
- function $t({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
465
- const [r, a] = R(
464
+ function Gt({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
465
+ const [r, i] = I(
466
466
  null
467
- ), [c, s] = R(!0), [m, d] = R(null), [u, l] = R([]), h = z(null), k = z(null);
468
- B(() => {
467
+ ), [c, s] = I(!0), [h, d] = I(null), [u, l] = I([]), m = D(null), k = D(null);
468
+ z(() => {
469
469
  e.then((b) => {
470
- a(b), s(!1);
470
+ i(b), s(!1);
471
471
  }).catch((b) => {
472
472
  d(b), s(!1);
473
473
  });
474
- }, [e]), B(() => {
475
- r && !k.current && (k.current = new _e(r));
476
- }, [r]), B(() => {
474
+ }, [e]), z(() => {
475
+ r && !k.current && (k.current = new Qe(r));
476
+ }, [r]), z(() => {
477
477
  k.current && k.current.updateStreams(u);
478
- }, [u]), B(() => () => {
478
+ }, [u]), z(() => () => {
479
479
  var b;
480
480
  (b = k.current) == null || b.cleanup();
481
- }, []), B(() => {
481
+ }, []), z(() => {
482
482
  const b = setInterval(() => {
483
- l((x) => {
484
- const w = ie(x);
485
- return w.length !== x.length ? w : x;
483
+ l((C) => {
484
+ const v = le(C);
485
+ return v.length !== C.length ? v : C;
486
486
  });
487
487
  }, 6e4);
488
488
  return () => clearInterval(b);
489
489
  }, []);
490
490
  const y = O(
491
- async (b = qe) => {
492
- if (h.current)
493
- return h.current;
494
- const x = Date.now(), w = u.length > 0 ? u[u.length - 1] : null;
495
- if (w && x - w.createdAt < b)
496
- return w.stream;
497
- const C = (async () => {
491
+ async (b = Ve) => {
492
+ if (m.current)
493
+ return m.current;
494
+ const C = Date.now(), v = u.length > 0 ? u[u.length - 1] : null;
495
+ if (v && C - v.createdAt < b)
496
+ return v.stream;
497
+ const x = (async () => {
498
498
  if (!r)
499
499
  throw new Error("Fency instance not initialized");
500
- const E = await t(), I = await we({
500
+ const E = await t(), R = await Ie({
501
501
  pk: r.publishableKey,
502
502
  baseUrl: r.baseUrl,
503
503
  clientToken: (E == null ? void 0 : E.clientToken) ?? ""
504
504
  });
505
- if (I.type === "success") {
506
- const W = {
507
- stream: I.stream,
505
+ if (R.type === "success") {
506
+ const A = {
507
+ stream: R.stream,
508
508
  createdAt: Date.now()
509
509
  };
510
- return l((P) => {
511
- const v = [...P, W];
512
- return ie(v);
513
- }), h.current = null, I.stream;
510
+ return l((w) => {
511
+ const P = [...w, A];
512
+ return le(P);
513
+ }), m.current = null, R.stream;
514
514
  } else
515
- throw h.current = null, new Error("Failed to create stream");
515
+ throw m.current = null, new Error("Failed to create stream");
516
516
  })();
517
- return h.current = C, C;
517
+ return m.current = x, x;
518
518
  },
519
519
  [r, u]
520
520
  );
521
- if (m)
521
+ if (h)
522
522
  return /* @__PURE__ */ f("div", { children: [
523
523
  "Fency error: ",
524
- m.message
524
+ h.message
525
525
  ] });
526
526
  if (!r)
527
527
  return null;
528
- const p = u.length > 0 ? u[u.length - 1] : null, g = {
528
+ const g = u.length > 0 ? u[u.length - 1] : null, p = {
529
529
  fency: r,
530
530
  loading: c,
531
- error: m,
531
+ error: h,
532
532
  activeStreams: u,
533
- latestStream: p,
533
+ latestStream: g,
534
534
  eventManager: k.current,
535
535
  getOrCreateStream: y
536
536
  };
537
- return /* @__PURE__ */ o(ge.Provider, { value: g, children: n });
537
+ return /* @__PURE__ */ o(fe.Provider, { value: p, children: n });
538
538
  }
539
- function ye() {
540
- const e = he(ge);
539
+ function ke() {
540
+ const e = ge(fe);
541
541
  if (e === void 0)
542
542
  throw new Error("useFencyContext must be used within a FencyProvider");
543
543
  return e;
544
544
  }
545
- const fe = i.object({
546
- role: i.enum(["SYSTEM", "USER", "ASSISTANT"]),
547
- content: i.string()
548
- }).passthrough(), K = i.object({
549
- memoryId: i.string(),
550
- memoryTitle: i.string(),
551
- memoryTypeId: i.string(),
552
- memoryTypeName: i.string(),
553
- matchingChunkScore: i.number(),
554
- matchingChunk: i.object({
555
- chunkNumber: i.number(),
556
- pageNumbers: i.array(i.number()),
557
- content: i.string()
545
+ const be = a.object({
546
+ role: a.enum(["SYSTEM", "USER", "ASSISTANT"]),
547
+ content: a.string()
548
+ }).passthrough(), G = a.object({
549
+ memoryId: a.string(),
550
+ memoryTitle: a.string(),
551
+ memoryTypeId: a.string(),
552
+ memoryTypeName: a.string(),
553
+ matchingChunkScore: a.number(),
554
+ matchingChunk: a.object({
555
+ chunkNumber: a.number(),
556
+ pageNumbers: a.array(a.number()),
557
+ content: a.string()
558
558
  }).passthrough(),
559
- chunks: i.array(
560
- i.object({
561
- chunkNumber: i.number(),
562
- pageNumbers: i.array(i.number()),
563
- content: i.string(),
564
- relation: i.enum([
559
+ chunks: a.array(
560
+ a.object({
561
+ chunkNumber: a.number(),
562
+ pageNumbers: a.array(a.number()),
563
+ content: a.string(),
564
+ relation: a.enum([
565
565
  "MATCH",
566
566
  "CONTEXT_BEFORE",
567
567
  "CONTEXT_AFTER"
568
568
  ])
569
569
  }).passthrough()
570
570
  )
571
- }).passthrough(), ke = i.object({
572
- memoryId: i.string(),
573
- memoryTitle: i.string()
574
- }).passthrough(), Qe = i.object({
575
- taskType: i.literal("StreamingChatCompletion"),
576
- eventType: i.literal("Text"),
577
- text: i.string()
578
- }).passthrough(), Ke = i.object({
579
- taskType: i.literal("StreamingChatCompletion"),
580
- eventType: i.literal("Completed"),
581
- response: i.object({
582
- textResponse: i.string(),
583
- messages: i.array(fe)
571
+ }).passthrough(), X = a.object({
572
+ memoryId: a.string(),
573
+ memoryTitle: a.string()
574
+ }).passthrough(), Xe = a.object({
575
+ taskType: a.literal("StreamingChatCompletion"),
576
+ eventType: a.literal("Text"),
577
+ text: a.string()
578
+ }).passthrough(), Ye = a.object({
579
+ taskType: a.literal("StreamingChatCompletion"),
580
+ eventType: a.literal("Completed"),
581
+ response: a.object({
582
+ textResponse: a.string(),
583
+ messages: a.array(be)
584
584
  }).passthrough()
585
- }).passthrough(), Xe = i.object({
586
- taskType: i.literal("StreamingChatCompletion"),
587
- eventType: i.literal("Error"),
588
- message: i.string()
589
- }).passthrough(), Ve = i.object({
590
- taskType: i.literal("StructuredChatCompletion"),
591
- eventType: i.literal("Completed"),
592
- response: i.object({
593
- jsonResponse: i.string(),
594
- messages: i.array(fe)
585
+ }).passthrough(), Je = a.object({
586
+ taskType: a.literal("StreamingChatCompletion"),
587
+ eventType: a.literal("Error"),
588
+ message: a.string()
589
+ }).passthrough(), Ze = a.object({
590
+ taskType: a.literal("StructuredChatCompletion"),
591
+ eventType: a.literal("Completed"),
592
+ response: a.object({
593
+ jsonResponse: a.string(),
594
+ messages: a.array(be)
595
595
  }).passthrough()
596
- }).passthrough(), Ye = i.object({
597
- taskType: i.literal("StructuredChatCompletion"),
598
- eventType: i.literal("Error"),
599
- message: i.string()
600
- }).passthrough(), Je = i.object({
601
- taskType: i.literal("MemoryChat"),
602
- eventType: i.literal("Text"),
603
- text: i.string()
604
- }).passthrough(), Ze = i.object({
605
- taskType: i.literal("MemoryChat"),
606
- eventType: i.literal("Thinking")
607
- }).passthrough(), er = i.object({
608
- taskType: i.literal("MemoryChat"),
609
- eventType: i.literal("Search"),
610
- queryDescription: i.string(),
611
- memories: i.array(ke).optional()
612
- }).passthrough(), rr = i.object({
613
- taskType: i.literal("MemoryChat"),
614
- eventType: i.literal("FindMemories"),
615
- titles: i.array(i.string())
616
- }).passthrough(), tr = i.object({
617
- taskType: i.literal("MemoryChat"),
618
- eventType: i.literal("FindMemoriesResult"),
619
- memories: i.array(ke)
620
- }).passthrough(), nr = i.enum([
596
+ }).passthrough(), er = a.object({
597
+ taskType: a.literal("StructuredChatCompletion"),
598
+ eventType: a.literal("Error"),
599
+ message: a.string()
600
+ }).passthrough(), rr = a.object({
601
+ taskType: a.literal("MemoryChat"),
602
+ eventType: a.literal("Text"),
603
+ text: a.string()
604
+ }).passthrough(), tr = a.object({
605
+ taskType: a.literal("MemoryChat"),
606
+ eventType: a.literal("Thinking")
607
+ }).passthrough(), nr = a.object({
608
+ taskType: a.literal("MemoryChat"),
609
+ eventType: a.literal("Search"),
610
+ queryDescription: a.string(),
611
+ memories: a.array(X).optional()
612
+ }).passthrough(), or = a.object({
613
+ taskType: a.literal("MemoryChat"),
614
+ eventType: a.literal("FindMemories"),
615
+ titles: a.array(a.string())
616
+ }).passthrough(), ar = a.object({
617
+ taskType: a.literal("MemoryChat"),
618
+ eventType: a.literal("FindMemoriesResult"),
619
+ memories: a.array(X)
620
+ }).passthrough(), ir = a.enum([
621
621
  "downloading",
622
622
  "downloaded",
623
623
  "analyzing",
624
624
  "summarizing"
625
- ]), or = i.object({
626
- taskType: i.literal("MemoryChat"),
627
- eventType: i.literal("ScrapeWebsites"),
628
- input: i.object({
629
- query: i.string(),
630
- urls: i.array(i.string())
625
+ ]), sr = a.object({
626
+ taskType: a.literal("MemoryChat"),
627
+ eventType: a.literal("ScrapeWebsites"),
628
+ input: a.object({
629
+ query: a.string(),
630
+ urls: a.array(a.string())
631
631
  }).passthrough(),
632
- results: i.array(
633
- i.object({
634
- url: i.string(),
635
- status: nr.optional(),
636
- summary: i.string().optional(),
637
- error: i.string().optional()
632
+ results: a.array(
633
+ a.object({
634
+ url: a.string(),
635
+ status: ir.optional(),
636
+ summary: a.string().optional(),
637
+ error: a.string().optional()
638
638
  }).passthrough()
639
639
  ).optional()
640
- }).passthrough(), ar = i.object({
641
- taskType: i.literal("MemoryChat"),
642
- eventType: i.literal("GoogleSearch"),
643
- input: i.object({
644
- query: i.string(),
645
- countryCode: i.string().optional()
640
+ }).passthrough(), lr = a.object({
641
+ taskType: a.literal("MemoryChat"),
642
+ eventType: a.literal("GoogleSearch"),
643
+ input: a.object({
644
+ query: a.string(),
645
+ countryCode: a.string().optional()
646
646
  }).passthrough(),
647
- results: i.array(
648
- i.object({
649
- rank: i.number(),
650
- title: i.string(),
651
- link: i.string(),
652
- description: i.string()
647
+ results: a.array(
648
+ a.object({
649
+ rank: a.number(),
650
+ title: a.string(),
651
+ link: a.string(),
652
+ description: a.string()
653
653
  }).passthrough()
654
654
  ).optional()
655
- }).passthrough(), ir = i.object({
656
- taskType: i.literal("MemoryChat"),
657
- eventType: i.literal("FindSources")
658
- }).passthrough(), sr = i.object({
659
- taskType: i.literal("MemoryChat"),
660
- eventType: i.literal("ExploreMemories"),
661
- memories: i.array(
662
- i.object({
663
- memoryId: i.string(),
664
- memoryTitle: i.string(),
665
- result: i.string().optional(),
666
- error: i.string().optional()
655
+ }).passthrough(), cr = a.object({
656
+ taskType: a.literal("MemoryChat"),
657
+ eventType: a.literal("SearchMemoryChunks"),
658
+ input: a.object({
659
+ queryDescription: a.string(),
660
+ memories: a.array(X).optional()
661
+ }).passthrough(),
662
+ items: a.array(G).optional()
663
+ }).passthrough(), dr = a.object({
664
+ taskType: a.literal("MemoryChat"),
665
+ eventType: a.literal("FindSources")
666
+ }).passthrough(), ur = a.object({
667
+ taskType: a.literal("MemoryChat"),
668
+ eventType: a.literal("ExploreMemories"),
669
+ memories: a.array(
670
+ a.object({
671
+ memoryId: a.string(),
672
+ memoryTitle: a.string(),
673
+ result: a.string().optional(),
674
+ error: a.string().optional()
667
675
  }).passthrough()
668
676
  )
669
- }).passthrough(), lr = i.object({
670
- taskType: i.literal("MemoryChat"),
671
- eventType: i.literal("ChunkResults"),
672
- items: i.array(K)
673
- }).passthrough(), cr = i.object({
674
- taskType: i.literal("MemoryChat"),
675
- eventType: i.literal("SourcesResult"),
676
- sources: i.array(
677
- i.object({
678
- memoryId: i.string(),
679
- memoryTitle: i.string(),
680
- memoryTypeId: i.string(),
681
- memoryTypeName: i.string(),
682
- pageNumbers: i.array(i.number())
677
+ }).passthrough(), mr = a.object({
678
+ taskType: a.literal("MemoryChat"),
679
+ eventType: a.literal("ChunkResults"),
680
+ items: a.array(G)
681
+ }).passthrough(), hr = a.object({
682
+ taskType: a.literal("MemoryChat"),
683
+ eventType: a.literal("SourcesResult"),
684
+ sources: a.array(
685
+ a.object({
686
+ memoryId: a.string(),
687
+ memoryTitle: a.string(),
688
+ memoryTypeId: a.string(),
689
+ memoryTypeName: a.string(),
690
+ pageNumbers: a.array(a.number())
683
691
  }).passthrough()
684
692
  )
685
- }).passthrough(), dr = i.object({
686
- taskType: i.literal("MemoryChat"),
687
- eventType: i.literal("Completed"),
688
- response: i.object({
689
- textResponse: i.string(),
690
- sources: i.array(
691
- i.object({
692
- memoryId: i.string(),
693
- memoryTitle: i.string(),
694
- memoryTypeId: i.string(),
695
- memoryTypeName: i.string(),
696
- pageNumbers: i.array(i.number())
693
+ }).passthrough(), pr = a.object({
694
+ taskType: a.literal("MemoryChat"),
695
+ eventType: a.literal("Completed"),
696
+ response: a.object({
697
+ textResponse: a.string(),
698
+ sources: a.array(
699
+ a.object({
700
+ memoryId: a.string(),
701
+ memoryTitle: a.string(),
702
+ memoryTypeId: a.string(),
703
+ memoryTypeName: a.string(),
704
+ pageNumbers: a.array(a.number())
697
705
  }).passthrough()
698
706
  )
699
707
  }).passthrough()
700
- }).passthrough(), ur = i.object({
701
- taskType: i.literal("MemoryChat"),
702
- eventType: i.literal("Error"),
703
- message: i.string()
704
- }).passthrough(), mr = i.object({
705
- taskType: i.literal("MemorySearch"),
706
- eventType: i.literal("GeneratingQueries"),
707
- memoryTypes: i.array(
708
- i.object({
709
- memoryTypeId: i.string(),
710
- memoryTypeName: i.string(),
711
- reasoning: i.string().optional(),
712
- reasoningCompleted: i.boolean().optional(),
713
- queries: i.array(i.object({ query: i.string() }).passthrough()).optional()
708
+ }).passthrough(), gr = a.object({
709
+ taskType: a.literal("MemoryChat"),
710
+ eventType: a.literal("Error"),
711
+ message: a.string()
712
+ }).passthrough(), yr = a.object({
713
+ taskType: a.literal("MemorySearch"),
714
+ eventType: a.literal("GeneratingQueries"),
715
+ memoryTypes: a.array(
716
+ a.object({
717
+ memoryTypeId: a.string(),
718
+ memoryTypeName: a.string(),
719
+ reasoning: a.string().optional(),
720
+ reasoningCompleted: a.boolean().optional(),
721
+ queries: a.array(a.object({ query: a.string() }).passthrough()).optional()
714
722
  }).passthrough()
715
723
  )
716
- }).passthrough(), hr = i.object({
717
- taskType: i.literal("MemorySearch"),
718
- eventType: i.literal("ExploreQueries"),
719
- queries: i.array(
720
- i.object({
721
- query: i.string(),
722
- memoryTypeId: i.string(),
723
- memoryTypeName: i.string(),
724
- result: i.object({
725
- numberOfChunks: i.number(),
726
- highestChunkScore: i.number(),
727
- items: i.array(K)
724
+ }).passthrough(), fr = a.object({
725
+ taskType: a.literal("MemorySearch"),
726
+ eventType: a.literal("ExploreQueries"),
727
+ queries: a.array(
728
+ a.object({
729
+ query: a.string(),
730
+ memoryTypeId: a.string(),
731
+ memoryTypeName: a.string(),
732
+ result: a.object({
733
+ numberOfChunks: a.number(),
734
+ highestChunkScore: a.number(),
735
+ items: a.array(G)
728
736
  }).passthrough().optional(),
729
- error: i.string().optional()
737
+ error: a.string().optional()
730
738
  }).passthrough()
731
739
  )
732
- }).passthrough(), pr = i.object({
733
- taskType: i.literal("MemorySearch"),
734
- eventType: i.literal("SearchMemoryTypes"),
735
- memoryTypes: i.array(
736
- i.object({
737
- memoryTypeId: i.string(),
738
- memoryTypeName: i.string(),
739
- result: i.object({
740
- numberOfChunks: i.number(),
741
- highestChunkScore: i.number()
740
+ }).passthrough(), kr = a.object({
741
+ taskType: a.literal("MemorySearch"),
742
+ eventType: a.literal("SearchMemoryTypes"),
743
+ memoryTypes: a.array(
744
+ a.object({
745
+ memoryTypeId: a.string(),
746
+ memoryTypeName: a.string(),
747
+ result: a.object({
748
+ numberOfChunks: a.number(),
749
+ highestChunkScore: a.number()
742
750
  }).passthrough().optional(),
743
- error: i.string().optional()
751
+ error: a.string().optional()
744
752
  }).passthrough()
745
753
  )
746
- }).passthrough(), gr = i.object({
747
- taskType: i.literal("MemorySearch"),
748
- eventType: i.literal("Completed"),
749
- response: i.object({
750
- query: i.string(),
751
- items: i.array(K)
754
+ }).passthrough(), br = a.object({
755
+ taskType: a.literal("MemorySearch"),
756
+ eventType: a.literal("Completed"),
757
+ response: a.object({
758
+ query: a.string(),
759
+ items: a.array(G)
752
760
  }).passthrough()
753
- }).passthrough(), yr = i.object({
754
- taskType: i.literal("MemorySearch"),
755
- eventType: i.literal("Error"),
756
- message: i.string()
757
- }).passthrough(), fr = i.union([
758
- Qe,
759
- Ke,
761
+ }).passthrough(), Sr = a.object({
762
+ taskType: a.literal("MemorySearch"),
763
+ eventType: a.literal("Error"),
764
+ message: a.string()
765
+ }).passthrough(), xr = a.union([
760
766
  Xe,
761
- Ve,
762
767
  Ye,
763
768
  Je,
764
769
  Ze,
765
770
  er,
766
771
  rr,
767
772
  tr,
773
+ nr,
768
774
  or,
769
775
  ar,
770
- ir,
771
776
  sr,
772
777
  lr,
773
778
  cr,
@@ -777,32 +782,36 @@ const fe = i.object({
777
782
  hr,
778
783
  pr,
779
784
  gr,
780
- yr
785
+ yr,
786
+ fr,
787
+ kr,
788
+ br,
789
+ Sr
781
790
  ]);
782
- function kr(e) {
783
- const t = fr.safeParse(e);
791
+ function Tr(e) {
792
+ const t = xr.safeParse(e);
784
793
  return t.success ? t.data : (console.warn(
785
794
  "[fency] Dropping unrecognized or malformed agent task event:",
786
795
  t.error.format(),
787
796
  e
788
797
  ), null);
789
798
  }
790
- const br = (e) => {
799
+ const vr = (e) => {
791
800
  try {
792
801
  const t = JSON.parse(e);
793
- return Sr(t);
802
+ return wr(t);
794
803
  } catch (t) {
795
804
  return console.error("Error parsing message:", t), null;
796
805
  }
797
- }, Sr = (e) => Me(e) ? xr(e) : Ie(e) ? Tr(e) : Ee(e) ? vr(e) : null, xr = (e) => ({
806
+ }, wr = (e) => Re(e) ? Cr(e) : Fe(e) ? Mr(e) : Ae(e) ? Er(e) : null, Cr = (e) => ({
798
807
  type: "STREAM_TIMEOUT",
799
808
  streamId: e.streamId,
800
809
  timestamp: e.timestamp
801
- }), Tr = (e) => ({
810
+ }), Mr = (e) => ({
802
811
  type: "STREAM_NOT_FOUND",
803
812
  streamId: e.streamId,
804
813
  timestamp: e.timestamp
805
- }), vr = (e) => {
814
+ }), Er = (e) => {
806
815
  let t;
807
816
  try {
808
817
  t = JSON.parse(e.data);
@@ -812,7 +821,7 @@ const br = (e) => {
812
821
  r
813
822
  ), null;
814
823
  }
815
- const n = kr(t);
824
+ const n = Tr(t);
816
825
  return n === null ? null : {
817
826
  type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
818
827
  streamId: e.streamId,
@@ -822,18 +831,18 @@ const br = (e) => {
822
831
  createdAt: e.createdAt,
823
832
  data: n
824
833
  };
825
- }, Cr = (e) => {
826
- const t = ye(), [n, r] = R(null), a = z(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
827
- return B(() => {
834
+ }, Ir = (e) => {
835
+ const t = ke(), [n, r] = I(null), i = D(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
836
+ return z(() => {
828
837
  if (!t.eventManager) return;
829
838
  const s = {
830
839
  onMessage: (d, u) => {
831
- var h, k, y;
832
- const l = br(d);
840
+ var m, k, y;
841
+ const l = vr(d);
833
842
  if (l)
834
843
  switch (l.type) {
835
844
  case "STREAM_TIMEOUT":
836
- (h = e == null ? void 0 : e.onStreamTimeout) == null || h.call(e, l);
845
+ (m = e == null ? void 0 : e.onStreamTimeout) == null || m.call(e, l);
837
846
  break;
838
847
  case "STREAM_NOT_FOUND":
839
848
  (k = e == null ? void 0 : e.onStreamNotFound) == null || k.call(e, l);
@@ -855,7 +864,7 @@ const br = (e) => {
855
864
  }
856
865
  };
857
866
  return t.eventManager.subscribe(
858
- a.current,
867
+ i.current,
859
868
  s
860
869
  );
861
870
  }, [t.eventManager, e]), {
@@ -878,125 +887,136 @@ const br = (e) => {
878
887
  },
879
888
  stream: n
880
889
  };
881
- }, Ht = (e) => {
882
- const t = ye(), [n, r] = R([]), a = z(/* @__PURE__ */ new Set()), c = z(/* @__PURE__ */ new Map()), s = O(
883
- (l, h) => {
890
+ }, qt = (e) => {
891
+ const t = ke(), [n, r] = I([]), i = D(/* @__PURE__ */ new Set()), c = D(/* @__PURE__ */ new Map()), s = O(
892
+ (l, m) => {
884
893
  r((k) => {
885
- const y = [], p = k.map((g) => {
886
- var x;
887
- if (g.streamId !== l || !g.loading) return g;
888
- const b = (x = g.confirmedData) == null ? void 0 : x.taskId;
889
- return b && y.push(b), { ...g, loading: !1, error: h };
894
+ const y = [], g = k.map((p) => {
895
+ var C;
896
+ if (p.streamId !== l || !p.loading) return p;
897
+ const b = (C = p.confirmedData) == null ? void 0 : C.taskId;
898
+ return b && y.push(b), { ...p, loading: !1, error: m };
890
899
  });
891
- for (const g of y) {
892
- a.current.delete(g);
893
- const b = c.current.get(g);
894
- b && (c.current.delete(g), b({ type: "error", error: h }));
900
+ for (const p of y) {
901
+ i.current.delete(p);
902
+ const b = c.current.get(p);
903
+ b && (c.current.delete(p), b({ type: "error", error: m }));
895
904
  }
896
- return p;
905
+ return g;
897
906
  });
898
907
  },
899
908
  []
900
- ), { createStream: m } = Cr({
909
+ ), { createStream: h } = Ir({
901
910
  onAgentTaskProgressItemUpdated: (l) => {
902
911
  var y;
903
- if (!a.current.has(l.agentTaskId)) return;
904
- const h = l.data;
905
- if (h.taskType === "StreamingChatCompletion" && h.eventType === "Completed" || h.taskType === "StructuredChatCompletion" && h.eventType === "Completed" || h.taskType === "MemoryChat" && h.eventType === "Completed" || h.taskType === "MemorySearch" && h.eventType === "Completed") {
906
- const p = h.taskType === "MemorySearch" && h.eventType === "Completed" || h.taskType === "StructuredChatCompletion" && h.eventType === "Completed";
912
+ if (!i.current.has(l.agentTaskId)) return;
913
+ const m = l.data;
914
+ if (m.eventType === "Completed" || m.eventType === "Error") {
915
+ const g = m.eventType === "Error", p = m.taskType === "MemorySearch" && m.eventType === "Completed" || m.taskType === "StructuredChatCompletion" && m.eventType === "Completed", b = g ? {
916
+ code: "AgentTaskError",
917
+ message: "message" in m && typeof m.message == "string" ? m.message : "Agent task failed"
918
+ } : null;
907
919
  r(
908
- p ? (b) => b.map((x) => {
909
- var E;
910
- if (((E = x.confirmedData) == null ? void 0 : E.taskId) !== l.agentTaskId)
920
+ p ? (v) => v.map((x) => {
921
+ var A;
922
+ if (((A = x.confirmedData) == null ? void 0 : A.taskId) !== l.agentTaskId)
911
923
  return x;
912
- const C = x.progressItems.some(
913
- (I) => I.progressItemId === l.progressItemId
924
+ const R = x.progressItems.some(
925
+ (w) => w.progressItemId === l.progressItemId
914
926
  ) ? x.progressItems.map(
915
- (I) => I.progressItemId === l.progressItemId ? l : I
927
+ (w) => w.progressItemId === l.progressItemId ? l : w
916
928
  ) : [...x.progressItems, l];
917
929
  return {
918
930
  ...x,
919
- progressItems: C,
920
- loading: !1
931
+ progressItems: R,
932
+ loading: !1,
933
+ ...b ? { error: b } : {}
921
934
  };
922
- }) : (b) => b.map(
935
+ }) : (v) => v.map(
923
936
  (x) => {
924
- var w;
925
- return ((w = x.confirmedData) == null ? void 0 : w.taskId) === l.agentTaskId ? { ...x, loading: !1 } : x;
937
+ var E;
938
+ return ((E = x.confirmedData) == null ? void 0 : E.taskId) === l.agentTaskId ? {
939
+ ...x,
940
+ loading: !1,
941
+ ...b ? { error: b } : {}
942
+ } : x;
926
943
  }
927
944
  )
928
945
  );
929
- const g = c.current.get(
946
+ const C = c.current.get(
930
947
  l.agentTaskId
931
948
  );
932
- g && (c.current.delete(l.agentTaskId), g({
949
+ C && (c.current.delete(l.agentTaskId), g && b ? C({
950
+ type: "error",
951
+ error: b
952
+ }) : m.eventType === "Completed" && C({
933
953
  type: "success",
934
954
  streamId: l.streamId,
935
955
  agentTaskId: l.agentTaskId,
936
- response: h
956
+ response: m
937
957
  }));
938
958
  return;
939
959
  }
940
960
  (y = e.onAgentTaskProgressItemUpdated) == null || y.call(e, l), r(
941
- (p) => p.map((g) => {
942
- var w;
943
- if (((w = g.confirmedData) == null ? void 0 : w.taskId) !== l.agentTaskId)
944
- return g;
945
- const x = g.progressItems.some(
946
- (C) => C.progressItemId === l.progressItemId
947
- ) ? g.progressItems.map(
948
- (C) => C.progressItemId === l.progressItemId ? l : C
949
- ) : [...g.progressItems, l];
950
- return { ...g, progressItems: x };
961
+ (g) => g.map((p) => {
962
+ var v;
963
+ if (((v = p.confirmedData) == null ? void 0 : v.taskId) !== l.agentTaskId)
964
+ return p;
965
+ const C = p.progressItems.some(
966
+ (x) => x.progressItemId === l.progressItemId
967
+ ) ? p.progressItems.map(
968
+ (x) => x.progressItemId === l.progressItemId ? l : x
969
+ ) : [...p.progressItems, l];
970
+ return { ...p, progressItems: C };
951
971
  })
952
972
  );
953
973
  },
954
974
  onStreamError: (l) => {
955
- var h;
956
- (h = e == null ? void 0 : e.onStreamError) == null || h.call(e, l), s(l.streamId, l.error);
975
+ var m;
976
+ (m = e == null ? void 0 : e.onStreamError) == null || m.call(e, l), s(l.streamId, l.error);
957
977
  },
958
978
  onStreamNotFound: (l) => {
959
- var h;
960
- (h = e == null ? void 0 : e.onStreamNotFound) == null || h.call(e, l), s(l.streamId, {
979
+ var m;
980
+ (m = e == null ? void 0 : e.onStreamNotFound) == null || m.call(e, l), s(l.streamId, {
961
981
  code: "StreamNotFound",
962
982
  message: "Stream not found"
963
983
  });
964
984
  },
965
985
  onStreamTimeout: (l) => {
966
- var h;
967
- (h = e == null ? void 0 : e.onStreamTimeout) == null || h.call(e, l), s(l.streamId, {
986
+ var m;
987
+ (m = e == null ? void 0 : e.onStreamTimeout) == null || m.call(e, l), s(l.streamId, {
968
988
  code: "StreamTimeout",
969
989
  message: "Stream timed out"
970
990
  });
971
991
  }
972
992
  }), d = O(
973
- async (l, h) => {
974
- var g;
975
- const k = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, y = (h == null ? void 0 : h.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
993
+ async (l, m) => {
994
+ var p;
995
+ const k = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, y = (m == null ? void 0 : m.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
976
996
  if (y === void 0)
977
997
  throw new Error(
978
998
  "fetchCreateAgentTaskClientToken must be provided either in useAgentTasks props or in createAgentTask options"
979
999
  );
980
- const p = await m();
981
- if (p.type === "success") {
982
- const b = (/* @__PURE__ */ new Date()).toISOString(), x = {
1000
+ const g = await h();
1001
+ if (g.type === "success") {
1002
+ const b = (/* @__PURE__ */ new Date()).toISOString(), C = {
983
1003
  taskKey: k,
984
- streamId: p.stream.id,
1004
+ streamId: g.stream.id,
985
1005
  triggeredAt: b,
986
1006
  confirmedData: null,
987
1007
  error: null,
988
1008
  params: l,
989
1009
  progressItems: [],
990
1010
  loading: !0,
991
- loadingText: h == null ? void 0 : h.loadingText
1011
+ loadingText: m == null ? void 0 : m.loadingText
992
1012
  };
993
- r((w) => [...w, x]), (g = h == null ? void 0 : h.onTaskRegistered) == null || g.call(h, x);
1013
+ r((v) => [...v, C]), (p = m == null ? void 0 : m.onTaskRegistered) == null || p.call(m, C);
994
1014
  try {
995
- const { clientToken: w } = await y(), C = await Re({
1015
+ const { clientToken: v } = await y(), x = await Be({
996
1016
  pk: t.fency.publishableKey,
997
1017
  baseUrl: t.fency.baseUrl,
998
- clientToken: w,
999
- streamToken: p.stream.token,
1018
+ clientToken: v,
1019
+ streamToken: g.stream.token,
1000
1020
  request: {
1001
1021
  streamingChatCompletionTask: l.type === "StreamingChatCompletion" ? {
1002
1022
  messages: l.messages,
@@ -1034,69 +1054,69 @@ const br = (e) => {
1034
1054
  } : void 0
1035
1055
  }
1036
1056
  });
1037
- if (C.type === "success" && C.agentTask)
1038
- return a.current.add(
1039
- C.agentTask.id
1057
+ if (x.type === "success" && x.agentTask)
1058
+ return i.current.add(
1059
+ x.agentTask.id
1040
1060
  ), r((E) => [
1041
- ...E.filter((I) => I.taskKey !== k),
1061
+ ...E.filter((R) => R.taskKey !== k),
1042
1062
  {
1043
1063
  taskKey: k,
1044
- streamId: p.stream.id,
1064
+ streamId: g.stream.id,
1045
1065
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
1046
- taskId: C.agentTask.id,
1047
- createdAt: C.agentTask.createdAt,
1066
+ taskId: x.agentTask.id,
1067
+ createdAt: x.agentTask.createdAt,
1048
1068
  error: null,
1049
1069
  params: l,
1050
1070
  progressItems: [],
1051
1071
  loading: !0,
1052
- loadingText: h == null ? void 0 : h.loadingText,
1072
+ loadingText: m == null ? void 0 : m.loadingText,
1053
1073
  confirmedData: {
1054
- taskId: C.agentTask.id,
1055
- createdAt: C.agentTask.createdAt
1074
+ taskId: x.agentTask.id,
1075
+ createdAt: x.agentTask.createdAt
1056
1076
  }
1057
1077
  }
1058
1078
  ]), await new Promise(
1059
1079
  (E) => {
1060
1080
  c.current.set(
1061
- C.agentTask.id,
1081
+ x.agentTask.id,
1062
1082
  E
1063
1083
  );
1064
1084
  }
1065
1085
  );
1066
- if (C.type === "error")
1086
+ if (x.type === "error")
1067
1087
  return r((E) => [
1068
- ...E.filter((I) => I.taskKey !== k),
1088
+ ...E.filter((R) => R.taskKey !== k),
1069
1089
  {
1070
1090
  taskKey: k,
1071
1091
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
1072
- streamId: p.stream.id,
1092
+ streamId: g.stream.id,
1073
1093
  params: l,
1074
- error: C.error,
1094
+ error: x.error,
1075
1095
  progressItems: [],
1076
1096
  loading: !1,
1077
- loadingText: h == null ? void 0 : h.loadingText,
1097
+ loadingText: m == null ? void 0 : m.loadingText,
1078
1098
  confirmedData: null
1079
1099
  }
1080
1100
  ]), {
1081
1101
  type: "error",
1082
- error: C.error
1102
+ error: x.error
1083
1103
  };
1084
1104
  {
1085
1105
  const E = {
1086
1106
  message: "No response received",
1087
1107
  code: "UnknownError"
1088
1108
  };
1089
- return r((I) => [
1090
- ...I.filter((W) => W.taskKey !== k),
1109
+ return r((R) => [
1110
+ ...R.filter((A) => A.taskKey !== k),
1091
1111
  {
1092
1112
  taskKey: k,
1093
1113
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
1094
- streamId: p.stream.id,
1114
+ streamId: g.stream.id,
1095
1115
  error: E,
1096
1116
  params: l,
1097
1117
  progressItems: [],
1098
1118
  loading: !1,
1099
- loadingText: h == null ? void 0 : h.loadingText,
1119
+ loadingText: m == null ? void 0 : m.loadingText,
1100
1120
  confirmedData: null
1101
1121
  }
1102
1122
  ]), {
@@ -1104,67 +1124,67 @@ const br = (e) => {
1104
1124
  error: E
1105
1125
  };
1106
1126
  }
1107
- } catch (w) {
1108
- const C = {
1127
+ } catch (v) {
1128
+ const x = {
1109
1129
  code: "UnknownError",
1110
- message: w instanceof Error ? w.message : "Unknown error during agent task creation"
1130
+ message: v instanceof Error ? v.message : "Unknown error during agent task creation"
1111
1131
  };
1112
1132
  return r((E) => [
1113
- ...E.filter((I) => I.taskKey !== k),
1133
+ ...E.filter((R) => R.taskKey !== k),
1114
1134
  {
1115
1135
  taskKey: k,
1116
1136
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
1117
- streamId: p.stream.id,
1137
+ streamId: g.stream.id,
1118
1138
  params: l,
1119
- error: C,
1139
+ error: x,
1120
1140
  progressItems: [],
1121
1141
  loading: !1,
1122
- loadingText: h == null ? void 0 : h.loadingText,
1142
+ loadingText: m == null ? void 0 : m.loadingText,
1123
1143
  confirmedData: null
1124
1144
  }
1125
1145
  ]), {
1126
1146
  type: "error",
1127
- error: C
1147
+ error: x
1128
1148
  };
1129
1149
  }
1130
1150
  } else
1131
- return console.error(p.error), p;
1151
+ return console.error(g.error), g;
1132
1152
  },
1133
1153
  [
1134
1154
  t,
1135
- m,
1155
+ h,
1136
1156
  e.fetchCreateAgentTaskClientToken,
1137
1157
  s
1138
1158
  ]
1139
- ), u = L(() => {
1159
+ ), u = W(() => {
1140
1160
  if (n.length !== 0)
1141
- return [...n].sort((l, h) => new Date(h.triggeredAt).getTime() - new Date(l.triggeredAt).getTime())[0];
1161
+ return [...n].sort((l, m) => new Date(m.triggeredAt).getTime() - new Date(l.triggeredAt).getTime())[0];
1142
1162
  }, [n]);
1143
- return B(() => () => {
1144
- a.current.clear(), c.current.clear();
1163
+ return z(() => () => {
1164
+ i.current.clear(), c.current.clear();
1145
1165
  }, []), {
1146
1166
  agentTasks: n,
1147
1167
  createAgentTask: d,
1148
1168
  latest: u
1149
1169
  };
1150
1170
  };
1151
- function wr(e) {
1171
+ function Rr(e) {
1152
1172
  return e.progressItems.map((t, n) => {
1153
- const r = e.progressItems[n + 1], a = r != null;
1173
+ const r = e.progressItems[n + 1], i = r != null;
1154
1174
  let c;
1155
1175
  if (r != null && r.createdAt) {
1156
- const s = new Date(t.createdAt).getTime(), m = new Date(r.createdAt).getTime();
1157
- c = Math.round((m - s) / 1e3);
1176
+ const s = new Date(t.createdAt).getTime(), h = new Date(r.createdAt).getTime();
1177
+ c = Math.round((h - s) / 1e3);
1158
1178
  }
1159
1179
  return {
1160
1180
  item: t,
1161
- completed: a,
1181
+ completed: i,
1162
1182
  isLatest: n === e.progressItems.length - 1,
1163
1183
  durationSeconds: c
1164
1184
  };
1165
1185
  });
1166
1186
  }
1167
- const Mr = {
1187
+ const Fr = {
1168
1188
  'code[class*="language-"]': {
1169
1189
  color: "#f8f8f2",
1170
1190
  background: "none",
@@ -1315,7 +1335,7 @@ const Mr = {
1315
1335
  italic: {
1316
1336
  fontStyle: "italic"
1317
1337
  }
1318
- }, Ir = {
1338
+ }, Ar = {
1319
1339
  'code[class*="language-"]': {
1320
1340
  background: "hsl(230, 1%, 98%)",
1321
1341
  color: "hsl(230, 8%, 24%)",
@@ -1803,7 +1823,7 @@ const Mr = {
1803
1823
  ".prism-previewer-easing.prism-previewer-easing line": {
1804
1824
  stroke: "hsl(230, 8%, 24%)"
1805
1825
  }
1806
- }, be = {
1826
+ }, Se = {
1807
1827
  textPrimary: "#1f2937",
1808
1828
  textSecondary: "#666",
1809
1829
  textMuted: "#94a3b8",
@@ -1827,7 +1847,7 @@ const Mr = {
1827
1847
  sourcesBadgeBg: "#f5f5f5",
1828
1848
  transparent: "transparent",
1829
1849
  reasoningLine: "#444"
1830
- }, Er = {
1850
+ }, Br = {
1831
1851
  textPrimary: "#f0f6fc",
1832
1852
  textSecondary: "#9198a1",
1833
1853
  textMuted: "#8b949e",
@@ -1851,33 +1871,33 @@ const Mr = {
1851
1871
  sourcesBadgeBg: "#21262d",
1852
1872
  transparent: "transparent",
1853
1873
  reasoningLine: "#a1a8b0"
1854
- }, Se = me({
1874
+ }, xe = pe({
1855
1875
  theme: "light",
1856
- colors: be
1876
+ colors: Se
1857
1877
  });
1858
- function Rr({
1878
+ function Pr({
1859
1879
  theme: e,
1860
1880
  children: t
1861
1881
  }) {
1862
- const n = L(
1882
+ const n = W(
1863
1883
  () => ({
1864
1884
  theme: e,
1865
- colors: e === "dark" ? Er : be
1885
+ colors: e === "dark" ? Br : Se
1866
1886
  }),
1867
1887
  [e]
1868
1888
  );
1869
- return /* @__PURE__ */ o(Se.Provider, { value: n, children: t });
1889
+ return /* @__PURE__ */ o(xe.Provider, { value: n, children: t });
1870
1890
  }
1871
1891
  function T() {
1872
- return he(Se);
1892
+ return ge(xe);
1873
1893
  }
1874
- function xe(e) {
1875
- return e === "dark" ? Mr : Ir;
1894
+ function Te(e) {
1895
+ return e === "dark" ? Fr : Ar;
1876
1896
  }
1877
- const se = ({
1897
+ const ce = ({
1878
1898
  text: e
1879
1899
  }) => {
1880
- const { theme: t } = T(), n = xe(t);
1900
+ const { theme: t } = T(), n = Te(t);
1881
1901
  return /* @__PURE__ */ o("div", { style: { paddingBlock: "16px" }, children: /* @__PURE__ */ o(
1882
1902
  M.div,
1883
1903
  {
@@ -1886,25 +1906,25 @@ const se = ({
1886
1906
  animate: { opacity: 1, y: 0 },
1887
1907
  transition: { duration: 0.3, delay: 0 },
1888
1908
  children: /* @__PURE__ */ o(
1889
- Be,
1909
+ Le,
1890
1910
  {
1891
- remarkPlugins: [ze],
1911
+ remarkPlugins: [We],
1892
1912
  components: {
1893
1913
  code(r) {
1894
- const { children: a, className: c, node: s, ref: m, ...d } = r, u = /language-(\w+)/.exec(c || "");
1914
+ const { children: i, className: c, node: s, ref: h, ...d } = r, u = /language-(\w+)/.exec(c || "");
1895
1915
  return u ? (
1896
1916
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
1897
1917
  /* @__PURE__ */ o(
1898
- pe,
1918
+ ye,
1899
1919
  {
1900
1920
  ...d,
1901
1921
  PreTag: "div",
1902
- children: String(a).replace(/\n$/, ""),
1922
+ children: String(i).replace(/\n$/, ""),
1903
1923
  language: u[1],
1904
1924
  style: n
1905
1925
  }
1906
1926
  )
1907
- ) : /* @__PURE__ */ o("code", { ...d, className: c, children: String(a) });
1927
+ ) : /* @__PURE__ */ o("code", { ...d, className: c, children: String(i) });
1908
1928
  }
1909
1929
  },
1910
1930
  children: e
@@ -1912,15 +1932,15 @@ const se = ({
1912
1932
  )
1913
1933
  }
1914
1934
  ) });
1915
- }, Fr = ({ data: e }) => {
1916
- const { theme: t } = T(), n = xe(t), r = e.response.jsonResponse;
1917
- let a;
1935
+ }, zr = ({ data: e }) => {
1936
+ const { theme: t } = T(), n = Te(t), r = e.response.jsonResponse;
1937
+ let i;
1918
1938
  try {
1919
- a = JSON.stringify(JSON.parse(r), null, 2);
1939
+ i = JSON.stringify(JSON.parse(r), null, 2);
1920
1940
  } catch {
1921
1941
  console.warn(
1922
1942
  "[fency] StructuredChatCompletion jsonResponse is not valid JSON; showing raw string"
1923
- ), a = r;
1943
+ ), i = r;
1924
1944
  }
1925
1945
  return /* @__PURE__ */ o("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ o(
1926
1946
  M.div,
@@ -1928,10 +1948,10 @@ const se = ({
1928
1948
  initial: { opacity: 0, y: -10 },
1929
1949
  animate: { opacity: 1, y: 0 },
1930
1950
  transition: { duration: 0.3, delay: 0 },
1931
- children: /* @__PURE__ */ o(pe, { language: "json", style: n, PreTag: "div", children: a })
1951
+ children: /* @__PURE__ */ o(ye, { language: "json", style: n, PreTag: "div", children: i })
1932
1952
  }
1933
1953
  ) });
1934
- }, Ar = {
1954
+ }, Dr = {
1935
1955
  en: {
1936
1956
  error: "Error",
1937
1957
  streaming: "Streaming...",
@@ -2087,16 +2107,16 @@ const se = ({
2087
2107
  scrapeStatusSummarizing: "Oppsummerer…"
2088
2108
  }
2089
2109
  };
2090
- function Pr(e) {
2091
- return Ar[e];
2110
+ function Lr(e) {
2111
+ return Dr[e];
2092
2112
  }
2093
2113
  function S(e, t) {
2094
2114
  return Object.entries(t).reduce(
2095
- (n, [r, a]) => n.replace(`{${r}}`, String(a)),
2115
+ (n, [r, i]) => n.replace(`{${r}}`, String(i)),
2096
2116
  e
2097
2117
  );
2098
2118
  }
2099
- function X(e, t) {
2119
+ function Y(e, t) {
2100
2120
  const n = e.map((r) => `'${r}'`);
2101
2121
  if (t != null && n.length >= 2) {
2102
2122
  const r = n.pop();
@@ -2109,17 +2129,17 @@ function F({
2109
2129
  duration: t = 2,
2110
2130
  delay: n = 0,
2111
2131
  repeat: r = !0,
2112
- repeatDelay: a = 0.5,
2132
+ repeatDelay: i = 0.5,
2113
2133
  className: c,
2114
2134
  startOnView: s = !1,
2115
- once: m = !1,
2135
+ once: h = !1,
2116
2136
  inViewMargin: d,
2117
2137
  spread: u = 2,
2118
2138
  color: l,
2119
- shimmerColor: h,
2139
+ shimmerColor: m,
2120
2140
  direction: k = "fromBottom"
2121
2141
  }) {
2122
- const { colors: y } = T(), p = l ?? y.shimmerBase, g = h ?? y.shimmerHighlight, b = z(null), x = Ae(b, { once: m, margin: d }), w = L(() => e.length * u, [e, u]), C = !s || x, E = k === "fromBottom" ? "100% center" : "-100% center", I = k === "fromBottom" ? "0% center" : "200% center";
2142
+ const { colors: y } = T(), g = l ?? y.shimmerBase, p = m ?? y.shimmerHighlight, b = D(null), C = ze(b, { once: h, margin: d }), v = W(() => e.length * u, [e, u]), x = !s || C, E = k === "fromBottom" ? "100% center" : "-100% center", R = k === "fromBottom" ? "0% center" : "200% center";
2123
2143
  return /* @__PURE__ */ o(
2124
2144
  M.span,
2125
2145
  {
@@ -2134,9 +2154,9 @@ function F({
2134
2154
  color: "transparent",
2135
2155
  WebkitTextFillColor: "transparent",
2136
2156
  backgroundRepeat: "no-repeat, padding-box",
2137
- "--spread": `${w}px`,
2138
- "--base-color": p,
2139
- "--shimmer-color": g,
2157
+ "--spread": `${v}px`,
2158
+ "--base-color": g,
2159
+ "--shimmer-color": p,
2140
2160
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
2141
2161
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
2142
2162
  },
@@ -2144,8 +2164,8 @@ function F({
2144
2164
  backgroundPosition: E,
2145
2165
  opacity: 0
2146
2166
  },
2147
- animate: C ? {
2148
- backgroundPosition: I,
2167
+ animate: x ? {
2168
+ backgroundPosition: R,
2149
2169
  opacity: 1
2150
2170
  } : {},
2151
2171
  transition: {
@@ -2153,7 +2173,7 @@ function F({
2153
2173
  repeat: r ? 1 / 0 : 0,
2154
2174
  duration: t,
2155
2175
  delay: n,
2156
- repeatDelay: a,
2176
+ repeatDelay: i,
2157
2177
  ease: "linear"
2158
2178
  },
2159
2179
  opacity: {
@@ -2165,389 +2185,103 @@ function F({
2165
2185
  }
2166
2186
  );
2167
2187
  }
2168
- const G = 5, Br = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
2169
- const { colors: a } = T(), [c, s] = R(!1), d = (e.memories ?? []).map((x) => x.memoryTitle), u = d.length > 0, l = u && d.length > G, h = l && !c ? d.slice(0, G) : d, k = d.length - G, y = !l || c, p = `${r.searchingFor}'${e.queryDescription}'`, g = u ? `${r.searchingIn}${X(
2170
- h,
2171
- y ? r.and : void 0
2172
- )}` : "", b = u ? `${p}${g}` : `${r.searchingPrefix}${e.queryDescription}`;
2173
- return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
2174
- /* @__PURE__ */ o(
2175
- M.div,
2176
- {
2177
- style: { color: a.textSecondary },
2178
- initial: { opacity: 0, y: -10 },
2179
- animate: { opacity: 1, y: 0 },
2180
- transition: { duration: 0.3, delay: 0 },
2181
- children: t && !n && !l ? /* @__PURE__ */ o(F, { text: b, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ f(A, { children: [
2182
- /* @__PURE__ */ o("span", { style: { color: a.textSecondary }, children: u ? /* @__PURE__ */ f(A, { children: [
2183
- r.searchingFor,
2184
- /* @__PURE__ */ f("span", { style: { fontWeight: 600 }, children: [
2185
- "'",
2186
- e.queryDescription,
2187
- "'"
2188
- ] }),
2189
- g
2190
- ] }) : `${r.searchingPrefix}${e.queryDescription}` }),
2191
- l && !c && /* @__PURE__ */ f(A, { children: [
2192
- " ",
2193
- /* @__PURE__ */ o(
2194
- "button",
2195
- {
2196
- type: "button",
2197
- onClick: () => s(!0),
2198
- style: {
2199
- background: "none",
2200
- border: "none",
2201
- padding: 0,
2202
- margin: 0,
2203
- fontSize: "inherit",
2204
- color: "inherit",
2205
- cursor: "pointer",
2206
- textDecoration: "underline",
2207
- fontFamily: "inherit"
2208
- },
2209
- children: S(r.moreMemories, {
2210
- n: k
2211
- })
2212
- }
2213
- )
2214
- ] }),
2215
- l && c && /* @__PURE__ */ f(A, { children: [
2216
- " ",
2217
- /* @__PURE__ */ o(
2218
- "button",
2219
- {
2220
- type: "button",
2221
- onClick: () => s(!1),
2222
- style: {
2223
- background: "none",
2224
- border: "none",
2225
- padding: 0,
2226
- margin: 0,
2227
- fontSize: "inherit",
2228
- color: "inherit",
2229
- cursor: "pointer",
2230
- textDecoration: "underline",
2231
- fontFamily: "inherit"
2232
- },
2233
- children: r.clickToCollapse
2234
- }
2235
- )
2236
- ] })
2237
- ] })
2238
- }
2239
- ),
2240
- n !== void 0 && /* @__PURE__ */ o(
2241
- "div",
2242
- {
2243
- style: {
2244
- fontSize: "12px",
2245
- color: a.textMuted,
2246
- marginTop: "4px",
2247
- fontStyle: "italic"
2248
- },
2249
- children: S(r.tookSeconds, { n })
2250
- }
2251
- )
2252
- ] });
2253
- }, q = 5, zr = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
2254
- const { colors: a } = T(), [c, s] = R(!1), m = e.titles, d = m.length > 0, u = d && m.length > q, l = u && !c ? m.slice(0, q) : m, h = m.length - q, k = !u || c, y = d ? `${r.findingMemoriesIn}${X(
2255
- l,
2256
- k ? r.and : void 0
2257
- )}` : r.findingMemories;
2258
- return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
2259
- /* @__PURE__ */ o(
2260
- M.div,
2261
- {
2262
- style: {
2263
- color: a.textSecondary
2264
- },
2265
- initial: { opacity: 0, y: -10 },
2266
- animate: { opacity: 1, y: 0 },
2267
- transition: { duration: 0.3, delay: 0 },
2268
- children: t && !n && !u ? /* @__PURE__ */ o(F, { text: y, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ f(A, { children: [
2269
- /* @__PURE__ */ o("span", { style: { color: a.textSecondary }, children: y }),
2270
- u && !c && /* @__PURE__ */ f(A, { children: [
2271
- " ",
2272
- /* @__PURE__ */ o(
2273
- "button",
2274
- {
2275
- type: "button",
2276
- onClick: () => s(!0),
2277
- style: {
2278
- background: "none",
2279
- border: "none",
2280
- padding: 0,
2281
- margin: 0,
2282
- fontSize: "inherit",
2283
- color: "inherit",
2284
- cursor: "pointer",
2285
- textDecoration: "underline",
2286
- fontFamily: "inherit"
2287
- },
2288
- children: S(r.moreMemories, {
2289
- n: h
2290
- })
2291
- }
2292
- )
2293
- ] }),
2294
- u && c && /* @__PURE__ */ f(A, { children: [
2295
- " ",
2296
- /* @__PURE__ */ o(
2297
- "button",
2298
- {
2299
- type: "button",
2300
- onClick: () => s(!1),
2301
- style: {
2302
- background: "none",
2303
- border: "none",
2304
- padding: 0,
2305
- margin: 0,
2306
- fontSize: "inherit",
2307
- color: "inherit",
2308
- cursor: "pointer",
2309
- textDecoration: "underline",
2310
- fontFamily: "inherit"
2311
- },
2312
- children: r.clickToCollapse
2313
- }
2314
- )
2315
- ] })
2316
- ] })
2317
- }
2318
- ),
2319
- n !== void 0 && /* @__PURE__ */ o(
2320
- "div",
2321
- {
2322
- style: {
2323
- fontSize: "12px",
2324
- color: a.textMuted,
2325
- marginTop: "4px",
2326
- fontStyle: "italic"
2327
- },
2328
- children: S(r.tookSeconds, { n })
2329
- }
2330
- )
2331
- ] });
2332
- }, Q = 5, Dr = ({ data: e, t }) => {
2333
- const { colors: n } = T(), [r, a] = R(!1), s = e.memories.map((p) => p.memoryTitle), m = s.length > 0, d = m && s.length > Q, u = d && !r ? s.slice(0, Q) : s, l = s.length - Q, h = !d || r, k = s.length === 1 ? t.memoryFound : t.memoriesFoundPrefix, y = m ? `${k}${X(
2334
- u,
2335
- h ? t.and : void 0
2336
- )}` : t.memoriesFound;
2337
- return /* @__PURE__ */ o("div", { style: { paddingBlock: "16px" }, children: /* @__PURE__ */ o(
2338
- M.div,
2188
+ const q = 5, V = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r, compactBelow: i = !1 }) => {
2189
+ const { colors: c } = T(), [s, h] = I(!1), u = (e.memories ?? []).map((v) => v.memoryTitle), l = u.length > 0, m = l && u.length > q, k = m && !s ? u.slice(0, q) : u, y = u.length - q, g = !m || s, p = `${r.searchingFor}'${e.queryDescription}'`, b = l ? `${r.searchingIn}${Y(
2190
+ k,
2191
+ g ? r.and : void 0
2192
+ )}` : "", C = l ? `${p}${b}` : `${r.searchingPrefix}${e.queryDescription}`;
2193
+ return /* @__PURE__ */ f(
2194
+ "div",
2339
2195
  {
2340
- style: { color: n.textSecondary },
2341
- initial: { opacity: 0, y: -10 },
2342
- animate: { opacity: 1, y: 0 },
2343
- transition: { duration: 0.3, delay: 0 },
2344
- children: /* @__PURE__ */ f(A, { children: [
2345
- /* @__PURE__ */ o("span", { style: { color: n.textSecondary }, children: y }),
2346
- d && !r && /* @__PURE__ */ f(A, { children: [
2347
- " ",
2348
- /* @__PURE__ */ o(
2349
- "button",
2350
- {
2351
- type: "button",
2352
- onClick: () => a(!0),
2353
- style: {
2354
- background: "none",
2355
- border: "none",
2356
- padding: 0,
2357
- margin: 0,
2358
- fontSize: "inherit",
2359
- color: "inherit",
2360
- cursor: "pointer",
2361
- textDecoration: "underline",
2362
- fontFamily: "inherit"
2363
- },
2364
- children: S(t.moreMemories, {
2365
- n: l
2366
- })
2367
- }
2368
- )
2369
- ] }),
2370
- d && r && /* @__PURE__ */ f(A, { children: [
2371
- " ",
2372
- /* @__PURE__ */ o(
2373
- "button",
2374
- {
2375
- type: "button",
2376
- onClick: () => a(!1),
2377
- style: {
2378
- background: "none",
2379
- border: "none",
2380
- padding: 0,
2381
- margin: 0,
2382
- fontSize: "inherit",
2383
- color: "inherit",
2384
- cursor: "pointer",
2385
- textDecoration: "underline",
2386
- fontFamily: "inherit"
2387
- },
2388
- children: t.clickToCollapse
2389
- }
2390
- )
2391
- ] })
2392
- ] })
2393
- }
2394
- ) });
2395
- }, Lr = ({ isLatest: e = !1, durationSeconds: t, t: n }) => {
2396
- const { colors: r } = T(), a = n.addingSources;
2397
- return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
2398
- /* @__PURE__ */ o(
2399
- M.div,
2400
- {
2401
- style: {
2402
- display: "flex",
2403
- alignItems: "center",
2404
- gap: "10px",
2405
- color: r.textSecondary
2406
- },
2407
- initial: { opacity: 0, y: -10 },
2408
- animate: { opacity: 1, y: 0 },
2409
- transition: { duration: 0.3, delay: 0 },
2410
- children: e && !t ? /* @__PURE__ */ o(F, { text: a, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ o("span", { style: { color: r.textSecondary }, children: a })
2411
- }
2412
- ),
2413
- t !== void 0 && /* @__PURE__ */ o(
2414
- "div",
2415
- {
2416
- style: {
2417
- fontSize: "12px",
2418
- color: r.textMuted,
2419
- marginTop: "4px",
2420
- fontStyle: "italic"
2421
- },
2422
- children: S(n.tookSeconds, { n: t })
2423
- }
2424
- )
2425
- ] });
2426
- };
2427
- function Wr(e, t) {
2428
- if (e.length === 0) return "";
2429
- if (e.length === 1)
2430
- return S(t.pageSingle, { n: e[0] });
2431
- if (e.length === 2)
2432
- return S(t.pageTwo, {
2433
- a: e[0],
2434
- b: e[1]
2435
- });
2436
- const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
2437
- return S(t.pageMultiple, { list: r, n });
2438
- }
2439
- const Nr = ({ data: e, onSourceClick: t, t: n }) => {
2440
- const { colors: r } = T(), [a, c] = R(null);
2441
- return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
2442
- /* @__PURE__ */ o(
2443
- M.div,
2444
- {
2445
- style: {
2446
- marginBottom: "10px",
2447
- fontSize: "11px",
2448
- fontWeight: 500,
2449
- letterSpacing: "0.05em",
2450
- textTransform: "uppercase",
2451
- color: r.textMuted
2452
- },
2453
- initial: { opacity: 0, y: -10 },
2454
- animate: { opacity: 1, y: 0 },
2455
- transition: { duration: 0.3, delay: 0 },
2456
- children: n.sources
2457
- }
2458
- ),
2459
- /* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: r.textTertiary }, children: n.noSources }) : e.sources.map((s, m) => /* @__PURE__ */ o(
2460
- Or,
2461
- {
2462
- source: s,
2463
- index: m,
2464
- loadingMemoryId: a,
2465
- setLoadingMemoryId: c,
2466
- onSourceClick: t,
2467
- t: n
2468
- },
2469
- s.memoryId
2470
- )) })
2471
- ] });
2472
- }, Or = ({
2473
- source: e,
2474
- index: t,
2475
- loadingMemoryId: n,
2476
- setLoadingMemoryId: r,
2477
- onSourceClick: a,
2478
- t: c
2479
- }) => {
2480
- const { colors: s } = T(), [m, d] = R(!1), u = !!a, l = n === e.memoryId, h = e.pageNumbers ?? [], k = Wr(h, c);
2481
- return /* @__PURE__ */ f(
2482
- M.div,
2483
- {
2484
- "aria-busy": l,
2485
- initial: { opacity: 0, scale: 0.9 },
2486
- animate: { opacity: 1, scale: 1 },
2487
- transition: { duration: 0.25, delay: t * 0.05 },
2488
- onClick: u && !l ? async () => {
2489
- r(e.memoryId);
2490
- try {
2491
- await a({
2492
- memoryId: e.memoryId,
2493
- memoryTitle: e.memoryTitle,
2494
- memoryTypeId: e.memoryTypeId,
2495
- memoryTypeName: e.memoryTypeName,
2496
- pageNumbers: [...h]
2497
- });
2498
- } finally {
2499
- r(null);
2500
- }
2501
- } : void 0,
2502
- onMouseEnter: u && !l ? () => d(!0) : void 0,
2503
- onMouseLeave: u && !l ? () => d(!1) : void 0,
2504
- style: {
2505
- display: "inline-flex",
2506
- flexDirection: "column",
2507
- gap: "4px",
2508
- padding: "8px 12px",
2509
- borderRadius: "6px",
2510
- border: `1px solid ${s.borderStrong}`,
2511
- backgroundColor: m ? s.sourcesBadgeBg : s.transparent,
2512
- cursor: u && !l ? "pointer" : l ? "wait" : "default",
2513
- transition: "background-color 0.15s ease",
2514
- userSelect: "none",
2515
- pointerEvents: l ? "none" : void 0
2516
- },
2517
- children: [
2518
- /* @__PURE__ */ f(
2519
- "span",
2520
- {
2521
- style: {
2522
- fontSize: "13px",
2523
- fontWeight: 500,
2524
- color: s.textPrimary,
2525
- display: "inline-flex",
2526
- alignItems: "center",
2527
- gap: 8
2528
- },
2529
- children: [
2530
- l && /* @__PURE__ */ o(
2531
- "span",
2532
- {
2533
- className: "explore-memory-loader explore-memory-loader--callback",
2534
- "aria-hidden": !0
2535
- }
2536
- ),
2537
- e.memoryTitle
2538
- ]
2539
- }
2540
- ),
2541
- k && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: s.textSecondary }, children: k })
2542
- ]
2196
+ style: i ? { paddingTop: "16px", paddingBottom: "2px" } : { paddingBlock: "16px" },
2197
+ children: [
2198
+ /* @__PURE__ */ o(
2199
+ M.div,
2200
+ {
2201
+ style: { color: c.textSecondary },
2202
+ initial: { opacity: 0, y: -10 },
2203
+ animate: { opacity: 1, y: 0 },
2204
+ transition: { duration: 0.3, delay: 0 },
2205
+ children: t && !n && !m ? /* @__PURE__ */ o(F, { text: C, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ f(B, { children: [
2206
+ /* @__PURE__ */ o("span", { style: { color: c.textSecondary }, children: l ? /* @__PURE__ */ f(B, { children: [
2207
+ r.searchingFor,
2208
+ /* @__PURE__ */ f("span", { style: { fontWeight: 600 }, children: [
2209
+ "'",
2210
+ e.queryDescription,
2211
+ "'"
2212
+ ] }),
2213
+ b
2214
+ ] }) : `${r.searchingPrefix}${e.queryDescription}` }),
2215
+ m && !s && /* @__PURE__ */ f(B, { children: [
2216
+ " ",
2217
+ /* @__PURE__ */ o(
2218
+ "button",
2219
+ {
2220
+ type: "button",
2221
+ onClick: () => h(!0),
2222
+ style: {
2223
+ background: "none",
2224
+ border: "none",
2225
+ padding: 0,
2226
+ margin: 0,
2227
+ fontSize: "inherit",
2228
+ color: "inherit",
2229
+ cursor: "pointer",
2230
+ textDecoration: "underline",
2231
+ fontFamily: "inherit"
2232
+ },
2233
+ children: S(r.moreMemories, {
2234
+ n: y
2235
+ })
2236
+ }
2237
+ )
2238
+ ] }),
2239
+ m && s && /* @__PURE__ */ f(B, { children: [
2240
+ " ",
2241
+ /* @__PURE__ */ o(
2242
+ "button",
2243
+ {
2244
+ type: "button",
2245
+ onClick: () => h(!1),
2246
+ style: {
2247
+ background: "none",
2248
+ border: "none",
2249
+ padding: 0,
2250
+ margin: 0,
2251
+ fontSize: "inherit",
2252
+ color: "inherit",
2253
+ cursor: "pointer",
2254
+ textDecoration: "underline",
2255
+ fontFamily: "inherit"
2256
+ },
2257
+ children: r.clickToCollapse
2258
+ }
2259
+ )
2260
+ ] })
2261
+ ] })
2262
+ }
2263
+ ),
2264
+ n !== void 0 && /* @__PURE__ */ o(
2265
+ "div",
2266
+ {
2267
+ style: {
2268
+ fontSize: "12px",
2269
+ color: c.textMuted,
2270
+ marginTop: "4px",
2271
+ fontStyle: "italic"
2272
+ },
2273
+ children: S(r.tookSeconds, { n })
2274
+ }
2275
+ )
2276
+ ]
2543
2277
  }
2544
2278
  );
2545
- }, D = ({
2279
+ }, L = ({
2546
2280
  color: e,
2547
2281
  size: t = 24,
2548
2282
  borderWidth: n = 7
2549
2283
  }) => {
2550
- const { colors: r } = T(), a = e ?? r.checkmarkColor, c = t * 0.5;
2284
+ const { colors: r } = T(), i = e ?? r.checkmarkColor, c = t * 0.5;
2551
2285
  return /* @__PURE__ */ o(
2552
2286
  "span",
2553
2287
  {
@@ -2556,183 +2290,38 @@ const Nr = ({ data: e, onSourceClick: t, t: n }) => {
2556
2290
  transform: "rotate(45deg)",
2557
2291
  height: t,
2558
2292
  width: c,
2559
- borderBottom: `${n}px solid ${a}`,
2560
- borderRight: `${n}px solid ${a}`
2293
+ borderBottom: `${n}px solid ${i}`,
2294
+ borderRight: `${n}px solid ${i}`
2561
2295
  }
2562
2296
  }
2563
2297
  );
2564
- }, $ = ({
2565
- color: e,
2566
- size: t = 32,
2567
- lineWidth: n = 2
2568
- }) => {
2569
- const { colors: r } = T(), a = e ?? r.xmarkColor, c = t + 1, s = (t - n) / 2, m = (t - c) / 2, d = {
2570
- position: "absolute",
2571
- left: s,
2572
- top: m,
2573
- width: n,
2574
- height: c,
2575
- backgroundColor: a
2576
- };
2577
- return /* @__PURE__ */ f(
2578
- "span",
2579
- {
2580
- style: {
2581
- position: "relative",
2582
- display: "inline-block",
2583
- width: t,
2584
- height: t
2585
- },
2586
- children: [
2587
- /* @__PURE__ */ o(
2588
- "span",
2589
- {
2590
- style: {
2591
- ...d,
2592
- transform: "rotate(45deg)"
2593
- }
2594
- }
2595
- ),
2596
- /* @__PURE__ */ o(
2597
- "span",
2598
- {
2599
- style: {
2600
- ...d,
2601
- transform: "rotate(-45deg)"
2602
- }
2603
- }
2604
- )
2605
- ]
2606
- }
2607
- );
2608
2298
  };
2609
- function jr({
2610
- memory: e,
2611
- completed: t
2612
- }) {
2613
- return e.error != null ? /* @__PURE__ */ o($, { size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(D, { size: 15, borderWidth: 2 }) : t ? /* @__PURE__ */ o(D, { size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
2614
- }
2615
- const le = 80;
2616
- function $r({
2617
- memory: e,
2618
- completed: t,
2619
- t: n
2620
- }) {
2621
- const { colors: r } = T(), [a, c] = R(!1), s = e.result ?? e.error, m = s != null && s.length > le, d = s != null ? a || !m ? s : `${s.slice(0, le)}...` : void 0, u = m, l = e.error != null;
2622
- return /* @__PURE__ */ f(
2623
- M.div,
2624
- {
2625
- initial: { opacity: 0 },
2626
- animate: { opacity: 1 },
2627
- transition: { duration: 0.25 },
2628
- onClick: u ? () => c((h) => !h) : void 0,
2629
- style: {
2630
- paddingTop: "12px",
2631
- paddingBottom: "12px",
2632
- borderBottom: `1px solid ${r.border}`,
2633
- display: "flex",
2634
- flexDirection: "row",
2635
- alignItems: "center",
2636
- gap: "10px",
2637
- minWidth: 0,
2638
- cursor: u ? "pointer" : "default"
2639
- },
2640
- children: [
2641
- /* @__PURE__ */ o(
2642
- "div",
2643
- {
2644
- style: {
2645
- display: "flex",
2646
- alignItems: "center",
2647
- justifyContent: "center",
2648
- flexShrink: 0,
2649
- width: 32
2650
- },
2651
- children: /* @__PURE__ */ o(jr, { memory: e, completed: t })
2652
- }
2653
- ),
2654
- /* @__PURE__ */ f(
2655
- "div",
2656
- {
2657
- style: {
2658
- display: "flex",
2659
- flexDirection: "column",
2660
- gap: "4px",
2661
- minWidth: 0
2662
- },
2663
- children: [
2664
- /* @__PURE__ */ o(
2665
- "span",
2666
- {
2667
- style: { fontSize: 13, fontWeight: 500, color: r.textPrimary },
2668
- children: e.memoryTitle
2669
- }
2670
- ),
2671
- d != null && /* @__PURE__ */ o(
2672
- "span",
2673
- {
2674
- style: {
2675
- fontSize: 12,
2676
- color: l ? r.textError : r.textSecondary,
2677
- lineHeight: 1.4,
2678
- whiteSpace: a ? "pre-wrap" : void 0
2679
- },
2680
- children: d
2681
- }
2682
- ),
2683
- u && /* @__PURE__ */ o(
2684
- "span",
2685
- {
2686
- style: {
2687
- fontSize: 11,
2688
- color: r.textMuted,
2689
- marginTop: 2
2690
- },
2691
- children: a ? n.clickToCollapse : n.clickToExpand
2692
- }
2693
- )
2694
- ]
2695
- }
2696
- )
2697
- ]
2698
- }
2699
- );
2700
- }
2701
- const Hr = ({ data: e, completed: t, t: n }) => /* @__PURE__ */ o("div", { style: { paddingBlock: "10px" }, children: e.memories.map((r) => /* @__PURE__ */ o(
2702
- $r,
2703
- {
2704
- memory: r,
2705
- completed: t,
2706
- t: n
2707
- },
2708
- r.memoryId
2709
- )) });
2710
- function Ur(e, t) {
2299
+ function Wr(e, t) {
2711
2300
  const n = Math.min(e.length, t.length);
2712
2301
  for (let r = n; r >= 0; r--)
2713
2302
  if (e.slice(-r) === t.slice(0, r)) return r;
2714
2303
  return 0;
2715
2304
  }
2716
- const _r = `
2305
+ const Nr = `
2717
2306
 
2718
2307
  `;
2719
- function V(e) {
2308
+ function J(e) {
2720
2309
  var n, r;
2721
2310
  if (e.length === 0) return "";
2722
2311
  let t = ((n = e[0]) == null ? void 0 : n.content) ?? "";
2723
- for (let a = 1; a < e.length; a++) {
2724
- const c = ((r = e[a]) == null ? void 0 : r.content) ?? "";
2312
+ for (let i = 1; i < e.length; i++) {
2313
+ const c = ((r = e[i]) == null ? void 0 : r.content) ?? "";
2725
2314
  if (c === "") continue;
2726
2315
  if (t === "") {
2727
2316
  t = c;
2728
2317
  continue;
2729
2318
  }
2730
- const s = Ur(t, c);
2731
- s === 0 ? t += _r + c : t += c.slice(s);
2319
+ const s = Wr(t, c);
2320
+ s === 0 ? t += Nr + c : t += c.slice(s);
2732
2321
  }
2733
2322
  return t;
2734
2323
  }
2735
- function Y(e, t) {
2324
+ function Z(e, t) {
2736
2325
  if (e.length === 0) return "";
2737
2326
  if (e.length === 1)
2738
2327
  return S(t.memorySearchPagesSingle, {
@@ -2749,32 +2338,32 @@ function Y(e, t) {
2749
2338
  n
2750
2339
  });
2751
2340
  }
2752
- function J(e) {
2341
+ function ee(e) {
2753
2342
  const t = /* @__PURE__ */ new Set();
2754
2343
  for (const n of e)
2755
2344
  for (const r of n.pageNumbers) t.add(r);
2756
2345
  return [...t].sort((n, r) => n - r);
2757
2346
  }
2758
- function Z(e) {
2347
+ function re(e) {
2759
2348
  const t = e.memoryTypeName.trim();
2760
2349
  if (t !== "") return t;
2761
2350
  if (e.memoryTypeId !== "") return e.memoryTypeId;
2762
2351
  }
2763
- function Te(e) {
2352
+ function ve(e) {
2764
2353
  return e.chunks.filter((t) => t.relation === "MATCH").length;
2765
2354
  }
2766
- function Gr(e, t) {
2355
+ function Or(e, t) {
2767
2356
  let n = 0, r = 0;
2768
2357
  for (const s of e)
2769
- n += Te(s), s.matchingChunkScore > r && (r = s.matchingChunkScore);
2770
- const a = n === 1 ? t.chunkFound : S(t.chunksFound, { n }), c = S(t.scoreLabel, {
2358
+ n += ve(s), s.matchingChunkScore > r && (r = s.matchingChunkScore);
2359
+ const i = n === 1 ? t.chunkFound : S(t.chunksFound, { n }), c = S(t.scoreLabel, {
2771
2360
  n: r.toFixed(2)
2772
2361
  });
2773
- return `${a} - ${c}`;
2362
+ return `${i} - ${c}`;
2774
2363
  }
2775
- function qr(e) {
2364
+ function jr(e) {
2776
2365
  const t = [], n = /* @__PURE__ */ new Map();
2777
- return e.forEach((r, a) => {
2366
+ return e.forEach((r, i) => {
2778
2367
  let c = n.get(r.memoryId);
2779
2368
  if (c == null) {
2780
2369
  t.push(r.memoryId);
@@ -2785,15 +2374,15 @@ function qr(e) {
2785
2374
  items: []
2786
2375
  }, n.set(r.memoryId, c);
2787
2376
  }
2788
- c.items.push({ item: r, flatIndex: a });
2377
+ c.items.push({ item: r, flatIndex: i });
2789
2378
  }), t.map((r) => n.get(r));
2790
2379
  }
2791
- function Qr({
2380
+ function $r({
2792
2381
  items: e,
2793
2382
  onSearchResultClick: t,
2794
2383
  t: n
2795
2384
  }) {
2796
- const { colors: r } = T(), [a, c] = R(null), s = !!t;
2385
+ const { colors: r } = T(), [i, c] = I(null), s = !!t;
2797
2386
  return /* @__PURE__ */ o(
2798
2387
  "div",
2799
2388
  {
@@ -2805,24 +2394,24 @@ function Qr({
2805
2394
  paddingTop: 8,
2806
2395
  borderTop: `1px solid ${r.borderDivider}`
2807
2396
  },
2808
- children: e.map((m, d) => {
2809
- const u = J(
2810
- m.chunks
2397
+ children: e.map((h, d) => {
2398
+ const u = ee(
2399
+ h.chunks
2811
2400
  ), l = [
2812
- Z(m),
2401
+ re(h),
2813
2402
  S(n.scoreLabel, {
2814
- n: m.matchingChunkScore.toFixed(2)
2403
+ n: h.matchingChunkScore.toFixed(2)
2815
2404
  }),
2816
- u.length > 0 ? Y(u, n) : n.pagesNotAvailable
2405
+ u.length > 0 ? Z(u, n) : n.pagesNotAvailable
2817
2406
  ].filter(
2818
- (p) => p != null && p !== ""
2819
- ), h = {
2820
- memoryId: m.memoryId,
2821
- memoryTitle: m.memoryTitle,
2822
- memoryTypeId: m.memoryTypeId,
2823
- memoryTypeName: m.memoryTypeName,
2407
+ (g) => g != null && g !== ""
2408
+ ), m = {
2409
+ memoryId: h.memoryId,
2410
+ memoryTitle: h.memoryTitle,
2411
+ memoryTypeId: h.memoryTypeId,
2412
+ memoryTypeName: h.memoryTypeName,
2824
2413
  pageNumbers: u
2825
- }, k = `${m.memoryId}-${d}`, y = a === k;
2414
+ }, k = `${h.memoryId}-${d}`, y = i === k;
2826
2415
  return /* @__PURE__ */ f(
2827
2416
  "div",
2828
2417
  {
@@ -2858,7 +2447,7 @@ function Qr({
2858
2447
  whiteSpace: "pre-wrap",
2859
2448
  wordBreak: "break-word"
2860
2449
  },
2861
- children: V(m.chunks)
2450
+ children: J(h.chunks)
2862
2451
  }
2863
2452
  ),
2864
2453
  /* @__PURE__ */ o(
@@ -2886,7 +2475,7 @@ function Qr({
2886
2475
  c(k);
2887
2476
  try {
2888
2477
  await t(
2889
- h
2478
+ m
2890
2479
  );
2891
2480
  } finally {
2892
2481
  c(null);
@@ -2919,38 +2508,608 @@ function Qr({
2919
2508
  n.viewButton
2920
2509
  ]
2921
2510
  }
2922
- )
2511
+ )
2512
+ ]
2513
+ },
2514
+ k
2515
+ );
2516
+ })
2517
+ }
2518
+ );
2519
+ }
2520
+ function Hr({
2521
+ group: e,
2522
+ t,
2523
+ expanded: n,
2524
+ onToggle: r,
2525
+ onSearchResultClick: i
2526
+ }) {
2527
+ const { colors: c } = T(), s = e.items.map((d) => d.item), h = s.some((d) => d.chunks.length > 0);
2528
+ return /* @__PURE__ */ f(
2529
+ M.div,
2530
+ {
2531
+ initial: { opacity: 0 },
2532
+ animate: { opacity: 1 },
2533
+ transition: { duration: 0.25 },
2534
+ style: {
2535
+ paddingTop: "12px",
2536
+ paddingBottom: "12px",
2537
+ borderBottom: `1px solid ${c.border}`,
2538
+ display: "flex",
2539
+ flexDirection: "row",
2540
+ alignItems: "flex-start",
2541
+ gap: "10px",
2542
+ minWidth: 0
2543
+ },
2544
+ children: [
2545
+ /* @__PURE__ */ o(
2546
+ "div",
2547
+ {
2548
+ style: {
2549
+ display: "flex",
2550
+ alignItems: "center",
2551
+ justifyContent: "center",
2552
+ flexShrink: 0,
2553
+ width: 32,
2554
+ paddingTop: 2
2555
+ },
2556
+ children: /* @__PURE__ */ o(L, { size: 15, borderWidth: 2 })
2557
+ }
2558
+ ),
2559
+ /* @__PURE__ */ f(
2560
+ "div",
2561
+ {
2562
+ style: {
2563
+ display: "flex",
2564
+ flexDirection: "column",
2565
+ gap: "4px",
2566
+ minWidth: 0,
2567
+ flex: 1
2568
+ },
2569
+ children: [
2570
+ /* @__PURE__ */ o(
2571
+ "span",
2572
+ {
2573
+ style: {
2574
+ fontSize: 13,
2575
+ fontWeight: 600,
2576
+ color: c.textPrimary,
2577
+ wordBreak: "break-word"
2578
+ },
2579
+ children: e.memoryTitle
2580
+ }
2581
+ ),
2582
+ /* @__PURE__ */ f(
2583
+ "div",
2584
+ {
2585
+ style: {
2586
+ display: "flex",
2587
+ flexDirection: "row",
2588
+ flexWrap: "wrap",
2589
+ alignItems: "baseline",
2590
+ gap: "6px 12px",
2591
+ minWidth: 0
2592
+ },
2593
+ children: [
2594
+ /* @__PURE__ */ o(
2595
+ "span",
2596
+ {
2597
+ style: {
2598
+ fontSize: 12,
2599
+ color: c.textSecondary,
2600
+ whiteSpace: "nowrap"
2601
+ },
2602
+ children: Or(s, t)
2603
+ }
2604
+ ),
2605
+ h && /* @__PURE__ */ o(
2606
+ "button",
2607
+ {
2608
+ type: "button",
2609
+ onClick: r,
2610
+ style: {
2611
+ border: "none",
2612
+ background: "none",
2613
+ padding: 0,
2614
+ cursor: "pointer",
2615
+ fontSize: 12,
2616
+ color: c.textSecondary,
2617
+ textDecoration: "underline",
2618
+ fontFamily: "inherit"
2619
+ },
2620
+ children: n ? t.memorySearchHideExploreResults : t.memorySearchViewExploreResults
2621
+ }
2622
+ )
2623
+ ]
2624
+ }
2625
+ ),
2626
+ n && h && /* @__PURE__ */ o(
2627
+ $r,
2628
+ {
2629
+ items: s,
2630
+ onSearchResultClick: i,
2631
+ t
2632
+ }
2633
+ )
2634
+ ]
2635
+ }
2636
+ )
2637
+ ]
2638
+ }
2639
+ );
2640
+ }
2641
+ function Ur(e, t) {
2642
+ return e === 1 ? t.chunkFound : S(t.chunksFound, { n: e });
2643
+ }
2644
+ const we = ({
2645
+ data: e,
2646
+ onSearchResultClick: t,
2647
+ t: n,
2648
+ compactTop: r = !1
2649
+ }) => {
2650
+ const { colors: i } = T(), c = e.items, s = c.reduce(
2651
+ (p, b) => p + ve(b),
2652
+ 0
2653
+ ), h = new Set(c.map((p) => p.memoryId)).size, [d, u] = I({}), l = O((p) => {
2654
+ u((b) => ({
2655
+ ...b,
2656
+ [p]: !b[p]
2657
+ }));
2658
+ }, []), m = W(() => jr(c), [c]), k = h === 1 ? n.memoryChatChunkResultsInOneMemory : S(n.memoryChatChunkResultsInMemories, {
2659
+ n: h
2660
+ }), y = `${Ur(s, n)} ${k}`, g = r ? { paddingBottom: "10px" } : { paddingBlock: "10px" };
2661
+ return c.length === 0 ? /* @__PURE__ */ o("div", { style: g, children: /* @__PURE__ */ o(
2662
+ "div",
2663
+ {
2664
+ style: {
2665
+ fontSize: 12,
2666
+ color: i.textMuted,
2667
+ paddingTop: 4
2668
+ },
2669
+ children: n.memorySearchExploreNoResults
2670
+ }
2671
+ ) }) : /* @__PURE__ */ f("div", { style: g, children: [
2672
+ m.map((p) => /* @__PURE__ */ o(
2673
+ Hr,
2674
+ {
2675
+ group: p,
2676
+ t: n,
2677
+ expanded: d[p.memoryId] === !0,
2678
+ onToggle: () => l(p.memoryId),
2679
+ onSearchResultClick: t
2680
+ },
2681
+ p.memoryId
2682
+ )),
2683
+ /* @__PURE__ */ o(
2684
+ "div",
2685
+ {
2686
+ style: {
2687
+ fontSize: "12px",
2688
+ color: i.textMuted,
2689
+ marginTop: "4px",
2690
+ fontStyle: "italic"
2691
+ },
2692
+ children: y
2693
+ }
2694
+ )
2695
+ ] });
2696
+ };
2697
+ function _r(e) {
2698
+ return {
2699
+ taskType: "MemoryChat",
2700
+ eventType: "Search",
2701
+ queryDescription: e.input.queryDescription,
2702
+ ...e.input.memories !== void 0 && e.input.memories.length > 0 ? { memories: e.input.memories } : {}
2703
+ };
2704
+ }
2705
+ const Gr = ({
2706
+ data: e,
2707
+ isLatest: t = !1,
2708
+ durationSeconds: n,
2709
+ t: r,
2710
+ onSearchResultClick: i
2711
+ }) => {
2712
+ const c = _r(e);
2713
+ return e.items === void 0 ? /* @__PURE__ */ o(
2714
+ V,
2715
+ {
2716
+ data: c,
2717
+ isLatest: t,
2718
+ durationSeconds: n,
2719
+ t: r
2720
+ }
2721
+ ) : /* @__PURE__ */ f(B, { children: [
2722
+ /* @__PURE__ */ o(
2723
+ V,
2724
+ {
2725
+ data: c,
2726
+ isLatest: !1,
2727
+ durationSeconds: n,
2728
+ t: r,
2729
+ compactBelow: !0
2730
+ }
2731
+ ),
2732
+ /* @__PURE__ */ o(
2733
+ we,
2734
+ {
2735
+ data: {
2736
+ taskType: "MemoryChat",
2737
+ eventType: "ChunkResults",
2738
+ items: e.items
2739
+ },
2740
+ onSearchResultClick: i,
2741
+ t: r,
2742
+ compactTop: !0
2743
+ }
2744
+ )
2745
+ ] });
2746
+ }, Q = 5, qr = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
2747
+ const { colors: i } = T(), [c, s] = I(!1), h = e.titles, d = h.length > 0, u = d && h.length > Q, l = u && !c ? h.slice(0, Q) : h, m = h.length - Q, k = !u || c, y = d ? `${r.findingMemoriesIn}${Y(
2748
+ l,
2749
+ k ? r.and : void 0
2750
+ )}` : r.findingMemories;
2751
+ return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
2752
+ /* @__PURE__ */ o(
2753
+ M.div,
2754
+ {
2755
+ style: {
2756
+ color: i.textSecondary
2757
+ },
2758
+ initial: { opacity: 0, y: -10 },
2759
+ animate: { opacity: 1, y: 0 },
2760
+ transition: { duration: 0.3, delay: 0 },
2761
+ children: t && !n && !u ? /* @__PURE__ */ o(F, { text: y, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ f(B, { children: [
2762
+ /* @__PURE__ */ o("span", { style: { color: i.textSecondary }, children: y }),
2763
+ u && !c && /* @__PURE__ */ f(B, { children: [
2764
+ " ",
2765
+ /* @__PURE__ */ o(
2766
+ "button",
2767
+ {
2768
+ type: "button",
2769
+ onClick: () => s(!0),
2770
+ style: {
2771
+ background: "none",
2772
+ border: "none",
2773
+ padding: 0,
2774
+ margin: 0,
2775
+ fontSize: "inherit",
2776
+ color: "inherit",
2777
+ cursor: "pointer",
2778
+ textDecoration: "underline",
2779
+ fontFamily: "inherit"
2780
+ },
2781
+ children: S(r.moreMemories, {
2782
+ n: m
2783
+ })
2784
+ }
2785
+ )
2786
+ ] }),
2787
+ u && c && /* @__PURE__ */ f(B, { children: [
2788
+ " ",
2789
+ /* @__PURE__ */ o(
2790
+ "button",
2791
+ {
2792
+ type: "button",
2793
+ onClick: () => s(!1),
2794
+ style: {
2795
+ background: "none",
2796
+ border: "none",
2797
+ padding: 0,
2798
+ margin: 0,
2799
+ fontSize: "inherit",
2800
+ color: "inherit",
2801
+ cursor: "pointer",
2802
+ textDecoration: "underline",
2803
+ fontFamily: "inherit"
2804
+ },
2805
+ children: r.clickToCollapse
2806
+ }
2807
+ )
2808
+ ] })
2809
+ ] })
2810
+ }
2811
+ ),
2812
+ n !== void 0 && /* @__PURE__ */ o(
2813
+ "div",
2814
+ {
2815
+ style: {
2816
+ fontSize: "12px",
2817
+ color: i.textMuted,
2818
+ marginTop: "4px",
2819
+ fontStyle: "italic"
2820
+ },
2821
+ children: S(r.tookSeconds, { n })
2822
+ }
2823
+ )
2824
+ ] });
2825
+ }, K = 5, Qr = ({ data: e, t }) => {
2826
+ const { colors: n } = T(), [r, i] = I(!1), s = e.memories.map((g) => g.memoryTitle), h = s.length > 0, d = h && s.length > K, u = d && !r ? s.slice(0, K) : s, l = s.length - K, m = !d || r, k = s.length === 1 ? t.memoryFound : t.memoriesFoundPrefix, y = h ? `${k}${Y(
2827
+ u,
2828
+ m ? t.and : void 0
2829
+ )}` : t.memoriesFound;
2830
+ return /* @__PURE__ */ o("div", { style: { paddingBlock: "16px" }, children: /* @__PURE__ */ o(
2831
+ M.div,
2832
+ {
2833
+ style: { color: n.textSecondary },
2834
+ initial: { opacity: 0, y: -10 },
2835
+ animate: { opacity: 1, y: 0 },
2836
+ transition: { duration: 0.3, delay: 0 },
2837
+ children: /* @__PURE__ */ f(B, { children: [
2838
+ /* @__PURE__ */ o("span", { style: { color: n.textSecondary }, children: y }),
2839
+ d && !r && /* @__PURE__ */ f(B, { children: [
2840
+ " ",
2841
+ /* @__PURE__ */ o(
2842
+ "button",
2843
+ {
2844
+ type: "button",
2845
+ onClick: () => i(!0),
2846
+ style: {
2847
+ background: "none",
2848
+ border: "none",
2849
+ padding: 0,
2850
+ margin: 0,
2851
+ fontSize: "inherit",
2852
+ color: "inherit",
2853
+ cursor: "pointer",
2854
+ textDecoration: "underline",
2855
+ fontFamily: "inherit"
2856
+ },
2857
+ children: S(t.moreMemories, {
2858
+ n: l
2859
+ })
2860
+ }
2861
+ )
2862
+ ] }),
2863
+ d && r && /* @__PURE__ */ f(B, { children: [
2864
+ " ",
2865
+ /* @__PURE__ */ o(
2866
+ "button",
2867
+ {
2868
+ type: "button",
2869
+ onClick: () => i(!1),
2870
+ style: {
2871
+ background: "none",
2872
+ border: "none",
2873
+ padding: 0,
2874
+ margin: 0,
2875
+ fontSize: "inherit",
2876
+ color: "inherit",
2877
+ cursor: "pointer",
2878
+ textDecoration: "underline",
2879
+ fontFamily: "inherit"
2880
+ },
2881
+ children: t.clickToCollapse
2882
+ }
2883
+ )
2884
+ ] })
2885
+ ] })
2886
+ }
2887
+ ) });
2888
+ }, Kr = ({ isLatest: e = !1, durationSeconds: t, t: n }) => {
2889
+ const { colors: r } = T(), i = n.addingSources;
2890
+ return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
2891
+ /* @__PURE__ */ o(
2892
+ M.div,
2893
+ {
2894
+ style: {
2895
+ display: "flex",
2896
+ alignItems: "center",
2897
+ gap: "10px",
2898
+ color: r.textSecondary
2899
+ },
2900
+ initial: { opacity: 0, y: -10 },
2901
+ animate: { opacity: 1, y: 0 },
2902
+ transition: { duration: 0.3, delay: 0 },
2903
+ children: e && !t ? /* @__PURE__ */ o(F, { text: i, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ o("span", { style: { color: r.textSecondary }, children: i })
2904
+ }
2905
+ ),
2906
+ t !== void 0 && /* @__PURE__ */ o(
2907
+ "div",
2908
+ {
2909
+ style: {
2910
+ fontSize: "12px",
2911
+ color: r.textMuted,
2912
+ marginTop: "4px",
2913
+ fontStyle: "italic"
2914
+ },
2915
+ children: S(n.tookSeconds, { n: t })
2916
+ }
2917
+ )
2918
+ ] });
2919
+ };
2920
+ function Vr(e, t) {
2921
+ if (e.length === 0) return "";
2922
+ if (e.length === 1)
2923
+ return S(t.pageSingle, { n: e[0] });
2924
+ if (e.length === 2)
2925
+ return S(t.pageTwo, {
2926
+ a: e[0],
2927
+ b: e[1]
2928
+ });
2929
+ const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
2930
+ return S(t.pageMultiple, { list: r, n });
2931
+ }
2932
+ const Xr = ({ data: e, onSourceClick: t, t: n }) => {
2933
+ const { colors: r } = T(), [i, c] = I(null);
2934
+ return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
2935
+ /* @__PURE__ */ o(
2936
+ M.div,
2937
+ {
2938
+ style: {
2939
+ marginBottom: "10px",
2940
+ fontSize: "11px",
2941
+ fontWeight: 500,
2942
+ letterSpacing: "0.05em",
2943
+ textTransform: "uppercase",
2944
+ color: r.textMuted
2945
+ },
2946
+ initial: { opacity: 0, y: -10 },
2947
+ animate: { opacity: 1, y: 0 },
2948
+ transition: { duration: 0.3, delay: 0 },
2949
+ children: n.sources
2950
+ }
2951
+ ),
2952
+ /* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: r.textTertiary }, children: n.noSources }) : e.sources.map((s, h) => /* @__PURE__ */ o(
2953
+ Yr,
2954
+ {
2955
+ source: s,
2956
+ index: h,
2957
+ loadingMemoryId: i,
2958
+ setLoadingMemoryId: c,
2959
+ onSourceClick: t,
2960
+ t: n
2961
+ },
2962
+ s.memoryId
2963
+ )) })
2964
+ ] });
2965
+ }, Yr = ({
2966
+ source: e,
2967
+ index: t,
2968
+ loadingMemoryId: n,
2969
+ setLoadingMemoryId: r,
2970
+ onSourceClick: i,
2971
+ t: c
2972
+ }) => {
2973
+ const { colors: s } = T(), [h, d] = I(!1), u = !!i, l = n === e.memoryId, m = e.pageNumbers ?? [], k = Vr(m, c);
2974
+ return /* @__PURE__ */ f(
2975
+ M.div,
2976
+ {
2977
+ "aria-busy": l,
2978
+ initial: { opacity: 0, scale: 0.9 },
2979
+ animate: { opacity: 1, scale: 1 },
2980
+ transition: { duration: 0.25, delay: t * 0.05 },
2981
+ onClick: u && !l ? async () => {
2982
+ r(e.memoryId);
2983
+ try {
2984
+ await i({
2985
+ memoryId: e.memoryId,
2986
+ memoryTitle: e.memoryTitle,
2987
+ memoryTypeId: e.memoryTypeId,
2988
+ memoryTypeName: e.memoryTypeName,
2989
+ pageNumbers: [...m]
2990
+ });
2991
+ } finally {
2992
+ r(null);
2993
+ }
2994
+ } : void 0,
2995
+ onMouseEnter: u && !l ? () => d(!0) : void 0,
2996
+ onMouseLeave: u && !l ? () => d(!1) : void 0,
2997
+ style: {
2998
+ display: "inline-flex",
2999
+ flexDirection: "column",
3000
+ gap: "4px",
3001
+ padding: "8px 12px",
3002
+ borderRadius: "6px",
3003
+ border: `1px solid ${s.borderStrong}`,
3004
+ backgroundColor: h ? s.sourcesBadgeBg : s.transparent,
3005
+ cursor: u && !l ? "pointer" : l ? "wait" : "default",
3006
+ transition: "background-color 0.15s ease",
3007
+ userSelect: "none",
3008
+ pointerEvents: l ? "none" : void 0
3009
+ },
3010
+ children: [
3011
+ /* @__PURE__ */ f(
3012
+ "span",
3013
+ {
3014
+ style: {
3015
+ fontSize: "13px",
3016
+ fontWeight: 500,
3017
+ color: s.textPrimary,
3018
+ display: "inline-flex",
3019
+ alignItems: "center",
3020
+ gap: 8
3021
+ },
3022
+ children: [
3023
+ l && /* @__PURE__ */ o(
3024
+ "span",
3025
+ {
3026
+ className: "explore-memory-loader explore-memory-loader--callback",
3027
+ "aria-hidden": !0
3028
+ }
3029
+ ),
3030
+ e.memoryTitle
2923
3031
  ]
2924
- },
2925
- k
2926
- );
2927
- })
3032
+ }
3033
+ ),
3034
+ k && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: s.textSecondary }, children: k })
3035
+ ]
3036
+ }
3037
+ );
3038
+ }, $ = ({
3039
+ color: e,
3040
+ size: t = 32,
3041
+ lineWidth: n = 2
3042
+ }) => {
3043
+ const { colors: r } = T(), i = e ?? r.xmarkColor, c = t + 1, s = (t - n) / 2, h = (t - c) / 2, d = {
3044
+ position: "absolute",
3045
+ left: s,
3046
+ top: h,
3047
+ width: n,
3048
+ height: c,
3049
+ backgroundColor: i
3050
+ };
3051
+ return /* @__PURE__ */ f(
3052
+ "span",
3053
+ {
3054
+ style: {
3055
+ position: "relative",
3056
+ display: "inline-block",
3057
+ width: t,
3058
+ height: t
3059
+ },
3060
+ children: [
3061
+ /* @__PURE__ */ o(
3062
+ "span",
3063
+ {
3064
+ style: {
3065
+ ...d,
3066
+ transform: "rotate(45deg)"
3067
+ }
3068
+ }
3069
+ ),
3070
+ /* @__PURE__ */ o(
3071
+ "span",
3072
+ {
3073
+ style: {
3074
+ ...d,
3075
+ transform: "rotate(-45deg)"
3076
+ }
3077
+ }
3078
+ )
3079
+ ]
2928
3080
  }
2929
3081
  );
3082
+ };
3083
+ function Jr({
3084
+ memory: e,
3085
+ completed: t
3086
+ }) {
3087
+ return e.error != null ? /* @__PURE__ */ o($, { size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { size: 15, borderWidth: 2 }) : t ? /* @__PURE__ */ o(L, { size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
2930
3088
  }
2931
- function Kr({
2932
- group: e,
2933
- t,
2934
- expanded: n,
2935
- onToggle: r,
2936
- onSearchResultClick: a
3089
+ const de = 80;
3090
+ function Zr({
3091
+ memory: e,
3092
+ completed: t,
3093
+ t: n
2937
3094
  }) {
2938
- const { colors: c } = T(), s = e.items.map((d) => d.item), m = s.some((d) => d.chunks.length > 0);
3095
+ const { colors: r } = T(), [i, c] = I(!1), s = e.result ?? e.error, h = s != null && s.length > de, d = s != null ? i || !h ? s : `${s.slice(0, de)}...` : void 0, u = h, l = e.error != null;
2939
3096
  return /* @__PURE__ */ f(
2940
3097
  M.div,
2941
3098
  {
2942
3099
  initial: { opacity: 0 },
2943
3100
  animate: { opacity: 1 },
2944
3101
  transition: { duration: 0.25 },
3102
+ onClick: u ? () => c((m) => !m) : void 0,
2945
3103
  style: {
2946
3104
  paddingTop: "12px",
2947
3105
  paddingBottom: "12px",
2948
- borderBottom: `1px solid ${c.border}`,
3106
+ borderBottom: `1px solid ${r.border}`,
2949
3107
  display: "flex",
2950
3108
  flexDirection: "row",
2951
- alignItems: "flex-start",
3109
+ alignItems: "center",
2952
3110
  gap: "10px",
2953
- minWidth: 0
3111
+ minWidth: 0,
3112
+ cursor: u ? "pointer" : "default"
2954
3113
  },
2955
3114
  children: [
2956
3115
  /* @__PURE__ */ o(
@@ -2961,10 +3120,9 @@ function Kr({
2961
3120
  alignItems: "center",
2962
3121
  justifyContent: "center",
2963
3122
  flexShrink: 0,
2964
- width: 32,
2965
- paddingTop: 2
3123
+ width: 32
2966
3124
  },
2967
- children: /* @__PURE__ */ o(D, { size: 15, borderWidth: 2 })
3125
+ children: /* @__PURE__ */ o(Jr, { memory: e, completed: t })
2968
3126
  }
2969
3127
  ),
2970
3128
  /* @__PURE__ */ f(
@@ -2974,72 +3132,37 @@ function Kr({
2974
3132
  display: "flex",
2975
3133
  flexDirection: "column",
2976
3134
  gap: "4px",
2977
- minWidth: 0,
2978
- flex: 1
3135
+ minWidth: 0
2979
3136
  },
2980
3137
  children: [
2981
3138
  /* @__PURE__ */ o(
2982
3139
  "span",
2983
3140
  {
2984
- style: {
2985
- fontSize: 13,
2986
- fontWeight: 600,
2987
- color: c.textPrimary,
2988
- wordBreak: "break-word"
2989
- },
3141
+ style: { fontSize: 13, fontWeight: 500, color: r.textPrimary },
2990
3142
  children: e.memoryTitle
2991
3143
  }
2992
3144
  ),
2993
- /* @__PURE__ */ f(
2994
- "div",
3145
+ d != null && /* @__PURE__ */ o(
3146
+ "span",
2995
3147
  {
2996
3148
  style: {
2997
- display: "flex",
2998
- flexDirection: "row",
2999
- flexWrap: "wrap",
3000
- alignItems: "baseline",
3001
- gap: "6px 12px",
3002
- minWidth: 0
3149
+ fontSize: 12,
3150
+ color: l ? r.textError : r.textSecondary,
3151
+ lineHeight: 1.4,
3152
+ whiteSpace: i ? "pre-wrap" : void 0
3003
3153
  },
3004
- children: [
3005
- /* @__PURE__ */ o(
3006
- "span",
3007
- {
3008
- style: {
3009
- fontSize: 12,
3010
- color: c.textSecondary,
3011
- whiteSpace: "nowrap"
3012
- },
3013
- children: Gr(s, t)
3014
- }
3015
- ),
3016
- m && /* @__PURE__ */ o(
3017
- "button",
3018
- {
3019
- type: "button",
3020
- onClick: r,
3021
- style: {
3022
- border: "none",
3023
- background: "none",
3024
- padding: 0,
3025
- cursor: "pointer",
3026
- fontSize: 12,
3027
- color: c.textSecondary,
3028
- textDecoration: "underline",
3029
- fontFamily: "inherit"
3030
- },
3031
- children: n ? t.memorySearchHideExploreResults : t.memorySearchViewExploreResults
3032
- }
3033
- )
3034
- ]
3154
+ children: d
3035
3155
  }
3036
3156
  ),
3037
- n && m && /* @__PURE__ */ o(
3038
- Qr,
3157
+ u && /* @__PURE__ */ o(
3158
+ "span",
3039
3159
  {
3040
- items: s,
3041
- onSearchResultClick: a,
3042
- t
3160
+ style: {
3161
+ fontSize: 11,
3162
+ color: r.textMuted,
3163
+ marginTop: 2
3164
+ },
3165
+ children: i ? n.clickToCollapse : n.clickToExpand
3043
3166
  }
3044
3167
  )
3045
3168
  ]
@@ -3049,73 +3172,27 @@ function Kr({
3049
3172
  }
3050
3173
  );
3051
3174
  }
3052
- function Xr(e, t) {
3053
- return e === 1 ? t.chunkFound : S(t.chunksFound, { n: e });
3054
- }
3055
- const Vr = ({
3056
- data: e,
3057
- onSearchResultClick: t,
3058
- t: n
3059
- }) => {
3060
- const { colors: r } = T(), a = e.items, c = a.reduce(
3061
- (y, p) => y + Te(p),
3062
- 0
3063
- ), s = new Set(a.map((y) => y.memoryId)).size, [m, d] = R({}), u = O((y) => {
3064
- d((p) => ({
3065
- ...p,
3066
- [y]: !p[y]
3067
- }));
3068
- }, []), l = L(() => qr(a), [a]), h = s === 1 ? n.memoryChatChunkResultsInOneMemory : S(n.memoryChatChunkResultsInMemories, {
3069
- n: s
3070
- }), k = `${Xr(c, n)} ${h}`;
3071
- return a.length === 0 ? /* @__PURE__ */ o("div", { style: { paddingBlock: "10px" }, children: /* @__PURE__ */ o(
3072
- "div",
3073
- {
3074
- style: {
3075
- fontSize: 12,
3076
- color: r.textMuted,
3077
- paddingTop: 4
3078
- },
3079
- children: n.memorySearchExploreNoResults
3080
- }
3081
- ) }) : /* @__PURE__ */ f("div", { style: { paddingBlock: "10px" }, children: [
3082
- l.map((y) => /* @__PURE__ */ o(
3083
- Kr,
3084
- {
3085
- group: y,
3086
- t: n,
3087
- expanded: m[y.memoryId] === !0,
3088
- onToggle: () => u(y.memoryId),
3089
- onSearchResultClick: t
3090
- },
3091
- y.memoryId
3092
- )),
3093
- /* @__PURE__ */ o(
3094
- "div",
3095
- {
3096
- style: {
3097
- fontSize: "12px",
3098
- color: r.textMuted,
3099
- marginTop: "4px",
3100
- fontStyle: "italic"
3101
- },
3102
- children: k
3103
- }
3104
- )
3105
- ] });
3106
- }, ce = 80;
3107
- function Yr(e) {
3175
+ const et = ({ data: e, completed: t, t: n }) => /* @__PURE__ */ o("div", { style: { paddingTop: "0px", paddingBottom: "10px" }, children: e.memories.map((r) => /* @__PURE__ */ o(
3176
+ Zr,
3177
+ {
3178
+ memory: r,
3179
+ completed: t,
3180
+ t: n
3181
+ },
3182
+ r.memoryId
3183
+ )) }), ue = 80;
3184
+ function rt(e) {
3108
3185
  try {
3109
3186
  return new URL(e).hostname;
3110
3187
  } catch {
3111
3188
  return e;
3112
3189
  }
3113
3190
  }
3114
- function Jr({
3191
+ function tt({
3115
3192
  item: e,
3116
3193
  t
3117
3194
  }) {
3118
- const { colors: n } = T(), [r, a] = R(!1), c = e.description ?? "", s = c.length > ce, m = c.length === 0 ? void 0 : r || !s ? c : `${c.slice(0, ce)}...`;
3195
+ const { colors: n } = T(), [r, i] = I(!1), c = e.description ?? "", s = c.length > ue, h = c.length === 0 ? void 0 : r || !s ? c : `${c.slice(0, ue)}...`;
3119
3196
  return /* @__PURE__ */ f(
3120
3197
  "div",
3121
3198
  {
@@ -3159,15 +3236,15 @@ function Jr({
3159
3236
  children: [
3160
3237
  e.rank,
3161
3238
  ". ",
3162
- Yr(e.link)
3239
+ rt(e.link)
3163
3240
  ]
3164
3241
  }
3165
3242
  ),
3166
- m != null && /* @__PURE__ */ f(A, { children: [
3243
+ h != null && /* @__PURE__ */ f(B, { children: [
3167
3244
  /* @__PURE__ */ o(
3168
3245
  "span",
3169
3246
  {
3170
- onClick: s ? () => a((d) => !d) : void 0,
3247
+ onClick: s ? () => i((d) => !d) : void 0,
3171
3248
  style: {
3172
3249
  fontSize: 13,
3173
3250
  color: n.textSecondary,
@@ -3176,7 +3253,7 @@ function Jr({
3176
3253
  wordBreak: "break-word",
3177
3254
  cursor: s ? "pointer" : "default"
3178
3255
  },
3179
- children: m
3256
+ children: h
3180
3257
  }
3181
3258
  ),
3182
3259
  s && /* @__PURE__ */ o(
@@ -3195,27 +3272,31 @@ function Jr({
3195
3272
  }
3196
3273
  );
3197
3274
  }
3198
- function Zr({
3275
+ function Ce(e, t) {
3276
+ const n = e.input.countryCode, r = e.input.query;
3277
+ return n != null && n !== "" ? S(t.googleSearchingForWithCountry, {
3278
+ query: r,
3279
+ country: n
3280
+ }) : S(t.googleSearchingFor, {
3281
+ query: r
3282
+ });
3283
+ }
3284
+ function nt({
3199
3285
  data: e,
3200
3286
  isLatest: t,
3201
3287
  durationSeconds: n,
3202
3288
  t: r
3203
3289
  }) {
3204
- const { colors: a } = T(), c = e.input.countryCode, s = e.input.query, m = c != null && c !== "" ? S(r.googleSearchingForWithCountry, {
3205
- query: s,
3206
- country: c
3207
- }) : S(r.googleSearchingFor, {
3208
- query: s
3209
- });
3290
+ const { colors: i } = T(), c = Ce(e, r);
3210
3291
  return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
3211
3292
  /* @__PURE__ */ o(
3212
3293
  M.div,
3213
3294
  {
3214
- style: { color: a.textSecondary },
3295
+ style: { color: i.textSecondary },
3215
3296
  initial: { opacity: 0, y: -10 },
3216
3297
  animate: { opacity: 1, y: 0 },
3217
3298
  transition: { duration: 0.3, delay: 0 },
3218
- children: t && !n ? /* @__PURE__ */ o(F, { text: m, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ o("span", { style: { color: a.textSecondary }, children: m })
3299
+ children: t && !n ? /* @__PURE__ */ o(F, { text: c, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ o("span", { style: { color: i.textSecondary }, children: c })
3219
3300
  }
3220
3301
  ),
3221
3302
  n !== void 0 && /* @__PURE__ */ o(
@@ -3223,7 +3304,7 @@ function Zr({
3223
3304
  {
3224
3305
  style: {
3225
3306
  fontSize: "12px",
3226
- color: a.textMuted,
3307
+ color: i.textMuted,
3227
3308
  marginTop: "4px",
3228
3309
  fontStyle: "italic"
3229
3310
  },
@@ -3232,22 +3313,26 @@ function Zr({
3232
3313
  )
3233
3314
  ] });
3234
3315
  }
3235
- function et({
3316
+ function ot({
3236
3317
  data: e,
3237
3318
  t
3238
3319
  }) {
3239
- const { colors: n } = T(), [r, a] = R(!1), c = L(() => [...e.results ?? []].sort((u, l) => u.rank - l.rank), [e.results]), s = c.length, m = s === 1 ? t.googleResultFound : S(t.googleResultsFound, { n: s });
3240
- return s === 0 ? /* @__PURE__ */ o("div", { style: { paddingBlock: "10px" }, children: /* @__PURE__ */ o(
3241
- "div",
3242
- {
3243
- style: {
3244
- fontSize: 12,
3245
- color: n.textMuted,
3246
- paddingTop: 4
3247
- },
3248
- children: t.memorySearchExploreNoResults
3249
- }
3250
- ) }) : /* @__PURE__ */ f("div", { style: { paddingBlock: "10px" }, children: [
3320
+ const { colors: n } = T(), [r, i] = I(!1), c = W(() => [...e.results ?? []].sort((l, m) => l.rank - m.rank), [e.results]), s = c.length, h = s === 1 ? t.googleResultFound : S(t.googleResultsFound, { n: s }), d = Ce(e, t);
3321
+ return s === 0 ? /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
3322
+ /* @__PURE__ */ o("span", { style: { color: n.textSecondary }, children: d }),
3323
+ /* @__PURE__ */ o(
3324
+ "div",
3325
+ {
3326
+ style: {
3327
+ fontSize: 12,
3328
+ color: n.textMuted,
3329
+ marginTop: 8
3330
+ },
3331
+ children: t.memorySearchExploreNoResults
3332
+ }
3333
+ )
3334
+ ] }) : /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
3335
+ /* @__PURE__ */ o("span", { style: { color: n.textSecondary }, children: d }),
3251
3336
  /* @__PURE__ */ f(
3252
3337
  M.div,
3253
3338
  {
@@ -3260,7 +3345,8 @@ function et({
3260
3345
  flexWrap: "wrap",
3261
3346
  alignItems: "baseline",
3262
3347
  gap: "6px 12px",
3263
- minWidth: 0
3348
+ minWidth: 0,
3349
+ marginTop: 8
3264
3350
  },
3265
3351
  children: [
3266
3352
  /* @__PURE__ */ o(
@@ -3271,14 +3357,14 @@ function et({
3271
3357
  color: n.textSecondary,
3272
3358
  whiteSpace: "nowrap"
3273
3359
  },
3274
- children: m
3360
+ children: h
3275
3361
  }
3276
3362
  ),
3277
3363
  /* @__PURE__ */ o(
3278
3364
  "button",
3279
3365
  {
3280
3366
  type: "button",
3281
- onClick: () => a((d) => !d),
3367
+ onClick: () => i((u) => !u),
3282
3368
  style: {
3283
3369
  border: "none",
3284
3370
  background: "none",
@@ -3306,38 +3392,38 @@ function et({
3306
3392
  paddingTop: 8,
3307
3393
  borderTop: `1px solid ${n.borderDivider}`
3308
3394
  },
3309
- children: c.map((d, u) => /* @__PURE__ */ o(
3395
+ children: c.map((u, l) => /* @__PURE__ */ o(
3310
3396
  "div",
3311
3397
  {
3312
3398
  style: {
3313
- paddingTop: u > 0 ? 12 : 0,
3314
- paddingBottom: u < c.length - 1 ? 12 : 0,
3315
- borderBottom: u < c.length - 1 ? `1px solid ${n.border}` : void 0,
3399
+ paddingTop: l > 0 ? 12 : 0,
3400
+ paddingBottom: l < c.length - 1 ? 12 : 0,
3401
+ borderBottom: l < c.length - 1 ? `1px solid ${n.border}` : void 0,
3316
3402
  minWidth: 0
3317
3403
  },
3318
- children: /* @__PURE__ */ o(Jr, { item: d, t })
3404
+ children: /* @__PURE__ */ o(tt, { item: u, t })
3319
3405
  },
3320
- `${d.link}-${d.rank}-${u}`
3406
+ `${u.link}-${u.rank}-${l}`
3321
3407
  ))
3322
3408
  }
3323
3409
  )
3324
3410
  ] });
3325
3411
  }
3326
- const rt = ({
3412
+ const at = ({
3327
3413
  data: e,
3328
3414
  isLatest: t = !1,
3329
3415
  durationSeconds: n,
3330
3416
  t: r
3331
3417
  }) => e.results === void 0 ? /* @__PURE__ */ o(
3332
- Zr,
3418
+ nt,
3333
3419
  {
3334
3420
  data: e,
3335
3421
  isLatest: t,
3336
3422
  durationSeconds: n,
3337
3423
  t: r
3338
3424
  }
3339
- ) : /* @__PURE__ */ o(et, { data: e, t: r });
3340
- function ve(e, t) {
3425
+ ) : /* @__PURE__ */ o(ot, { data: e, t: r });
3426
+ function Me(e, t) {
3341
3427
  if (e.error != null)
3342
3428
  return null;
3343
3429
  switch (e.status) {
@@ -3353,39 +3439,39 @@ function ve(e, t) {
3353
3439
  return null;
3354
3440
  }
3355
3441
  }
3356
- function tt(e) {
3442
+ function it(e) {
3357
3443
  var t;
3358
3444
  return e.error != null ? !0 : e.status != null ? !1 : (((t = e.summary) == null ? void 0 : t.length) ?? 0) > 0;
3359
3445
  }
3360
- const de = 80, ee = 12, re = 1.4, nt = Math.ceil(
3361
- ee * re
3362
- ), ot = Math.ceil(
3363
- 5 * ee * re
3446
+ const me = 80, te = 12, ne = 1.4, st = Math.ceil(
3447
+ te * ne
3448
+ ), lt = Math.ceil(
3449
+ 5 * te * ne
3364
3450
  );
3365
- function Ce(e, t = 48) {
3451
+ function Ee(e, t = 48) {
3366
3452
  try {
3367
- const n = new URL(e), r = n.pathname.length > t ? `${n.pathname.slice(0, t)}…` : n.pathname, a = r === "/" ? "" : r;
3368
- return `${n.hostname}${a}${n.search ? "…" : ""}`;
3453
+ const n = new URL(e), r = n.pathname.length > t ? `${n.pathname.slice(0, t)}…` : n.pathname, i = r === "/" ? "" : r;
3454
+ return `${n.hostname}${i}${n.search ? "…" : ""}`;
3369
3455
  } catch {
3370
3456
  return e.length > 64 ? `${e.slice(0, 64)}…` : e;
3371
3457
  }
3372
3458
  }
3373
- function at({ item: e }) {
3374
- return e.error != null ? /* @__PURE__ */ o($, { size: 15, lineWidth: 2 }) : e.summary != null && e.summary !== "" ? /* @__PURE__ */ o(D, { size: 15, borderWidth: 2 }) : e.status != null ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : /* @__PURE__ */ o(D, { size: 15, borderWidth: 2 });
3459
+ function ct({ item: e }) {
3460
+ return e.error != null ? /* @__PURE__ */ o($, { size: 15, lineWidth: 2 }) : e.summary != null && e.summary !== "" ? /* @__PURE__ */ o(L, { size: 15, borderWidth: 2 }) : e.status != null ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : /* @__PURE__ */ o(L, { size: 15, borderWidth: 2 });
3375
3461
  }
3376
- function it({ item: e }) {
3377
- return e.error != null ? /* @__PURE__ */ o($, { size: 15, lineWidth: 2 }) : e.summary != null && e.summary !== "" ? /* @__PURE__ */ o(D, { size: 15, borderWidth: 2 }) : e.status != null ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
3462
+ function dt({ item: e }) {
3463
+ return e.error != null ? /* @__PURE__ */ o($, { size: 15, lineWidth: 2 }) : e.summary != null && e.summary !== "" ? /* @__PURE__ */ o(L, { size: 15, borderWidth: 2 }) : e.status != null ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
3378
3464
  }
3379
- function st({
3465
+ function ut({
3380
3466
  item: e,
3381
3467
  t,
3382
3468
  isLatest: n = !1
3383
3469
  }) {
3384
- const { colors: r } = T(), a = e.error ?? e.summary ?? "", c = a.length > 0, s = e.error != null, m = z(null), d = e.summary != null && e.summary !== "", u = ve(e, t), l = s || d || !c && u != null, h = e.error == null && (e.summary == null || e.summary === "");
3385
- return B(() => {
3386
- const k = m.current;
3470
+ const { colors: r } = T(), i = e.error ?? e.summary ?? "", c = i.length > 0, s = e.error != null, h = D(null), d = e.summary != null && e.summary !== "", u = Me(e, t), l = s || d || !c && u != null, m = e.error == null && (e.summary == null || e.summary === "");
3471
+ return z(() => {
3472
+ const k = h.current;
3387
3473
  k != null && c && (k.scrollTop = k.scrollHeight);
3388
- }, [a, c]), /* @__PURE__ */ f(
3474
+ }, [i, c]), /* @__PURE__ */ f(
3389
3475
  M.div,
3390
3476
  {
3391
3477
  initial: { opacity: 0 },
@@ -3394,7 +3480,7 @@ function st({
3394
3480
  style: {
3395
3481
  display: "flex",
3396
3482
  flexDirection: "row",
3397
- alignItems: h ? "center" : l ? "flex-start" : "center",
3483
+ alignItems: m ? "center" : l ? "flex-start" : "center",
3398
3484
  gap: "10px",
3399
3485
  minWidth: 0
3400
3486
  },
@@ -3408,9 +3494,9 @@ function st({
3408
3494
  justifyContent: "center",
3409
3495
  flexShrink: 0,
3410
3496
  width: 32,
3411
- ...h || !l ? {} : { paddingTop: 2 }
3497
+ ...m || !l ? {} : { paddingTop: 2 }
3412
3498
  },
3413
- children: /* @__PURE__ */ o(it, { item: e })
3499
+ children: /* @__PURE__ */ o(dt, { item: e })
3414
3500
  }
3415
3501
  ),
3416
3502
  /* @__PURE__ */ f(
@@ -3443,7 +3529,7 @@ function st({
3443
3529
  onMouseLeave: (k) => {
3444
3530
  k.currentTarget.style.textDecoration = "none";
3445
3531
  },
3446
- children: Ce(e.url)
3532
+ children: Ee(e.url)
3447
3533
  }
3448
3534
  ),
3449
3535
  !c && u != null && /* @__PURE__ */ o("div", { style: { fontSize: 12, color: r.textTertiary, minHeight: 18 }, children: n ? /* @__PURE__ */ o(F, { text: u, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ o("span", { style: { color: r.textTertiary }, children: u }) }),
@@ -3459,20 +3545,20 @@ function st({
3459
3545
  children: /* @__PURE__ */ o(
3460
3546
  "div",
3461
3547
  {
3462
- ref: m,
3548
+ ref: h,
3463
3549
  style: {
3464
- minHeight: nt,
3465
- maxHeight: ot,
3550
+ minHeight: st,
3551
+ maxHeight: lt,
3466
3552
  height: "auto",
3467
3553
  overflowY: "auto",
3468
3554
  overflowX: "hidden",
3469
- fontSize: ee,
3470
- lineHeight: re,
3555
+ fontSize: te,
3556
+ lineHeight: ne,
3471
3557
  whiteSpace: "pre-wrap",
3472
3558
  wordBreak: "break-word",
3473
3559
  color: s ? r.textError : r.textTertiary
3474
3560
  },
3475
- children: a
3561
+ children: i
3476
3562
  }
3477
3563
  )
3478
3564
  }
@@ -3484,11 +3570,11 @@ function st({
3484
3570
  }
3485
3571
  );
3486
3572
  }
3487
- function lt({
3573
+ function mt({
3488
3574
  item: e,
3489
3575
  t
3490
3576
  }) {
3491
- const { colors: n } = T(), [r, a] = R(!1), c = e.error ?? e.summary ?? "", s = e.error != null, m = c.length > de, d = c.length === 0 ? void 0 : r || !m ? c : `${c.slice(0, de)}...`, u = ve(e, t), l = e.error == null && (e.summary == null || e.summary === "") && e.status != null;
3577
+ const { colors: n } = T(), [r, i] = I(!1), c = e.error ?? e.summary ?? "", s = e.error != null, h = c.length > me, d = c.length === 0 ? void 0 : r || !h ? c : `${c.slice(0, me)}...`, u = Me(e, t), l = e.error == null && (e.summary == null || e.summary === "") && e.status != null;
3492
3578
  return /* @__PURE__ */ f(
3493
3579
  M.div,
3494
3580
  {
@@ -3514,7 +3600,7 @@ function lt({
3514
3600
  width: 32,
3515
3601
  ...l ? {} : { paddingTop: 2 }
3516
3602
  },
3517
- children: /* @__PURE__ */ o(at, { item: e })
3603
+ children: /* @__PURE__ */ o(ct, { item: e })
3518
3604
  }
3519
3605
  ),
3520
3606
  /* @__PURE__ */ f(
@@ -3541,13 +3627,13 @@ function lt({
3541
3627
  textDecoration: "none",
3542
3628
  wordBreak: "break-all"
3543
3629
  },
3544
- onMouseEnter: (h) => {
3545
- h.currentTarget.style.textDecoration = "underline";
3630
+ onMouseEnter: (m) => {
3631
+ m.currentTarget.style.textDecoration = "underline";
3546
3632
  },
3547
- onMouseLeave: (h) => {
3548
- h.currentTarget.style.textDecoration = "none";
3633
+ onMouseLeave: (m) => {
3634
+ m.currentTarget.style.textDecoration = "none";
3549
3635
  },
3550
- children: Ce(e.url)
3636
+ children: Ee(e.url)
3551
3637
  }
3552
3638
  ),
3553
3639
  d == null && u != null && /* @__PURE__ */ o(
@@ -3561,23 +3647,23 @@ function lt({
3561
3647
  children: u
3562
3648
  }
3563
3649
  ),
3564
- d != null && /* @__PURE__ */ f(A, { children: [
3650
+ d != null && /* @__PURE__ */ f(B, { children: [
3565
3651
  /* @__PURE__ */ o(
3566
3652
  "span",
3567
3653
  {
3568
- onClick: m ? () => a((h) => !h) : void 0,
3654
+ onClick: h ? () => i((m) => !m) : void 0,
3569
3655
  style: {
3570
3656
  fontSize: 12,
3571
3657
  color: s ? n.textError : n.textSecondary,
3572
3658
  lineHeight: 1.4,
3573
3659
  whiteSpace: r ? "pre-wrap" : void 0,
3574
3660
  wordBreak: "break-word",
3575
- cursor: m ? "pointer" : "default"
3661
+ cursor: h ? "pointer" : "default"
3576
3662
  },
3577
3663
  children: d
3578
3664
  }
3579
3665
  ),
3580
- m && /* @__PURE__ */ o(
3666
+ h && /* @__PURE__ */ o(
3581
3667
  "span",
3582
3668
  {
3583
3669
  style: {
@@ -3596,7 +3682,7 @@ function lt({
3596
3682
  }
3597
3683
  );
3598
3684
  }
3599
- function ue(e, t, n) {
3685
+ function he(e, t, n) {
3600
3686
  return /* @__PURE__ */ o(
3601
3687
  "div",
3602
3688
  {
@@ -3608,38 +3694,38 @@ function ue(e, t, n) {
3608
3694
  paddingTop: 8,
3609
3695
  borderTop: `1px solid ${t.borderDivider}`
3610
3696
  },
3611
- children: e.map((r, a) => /* @__PURE__ */ o(
3697
+ children: e.map((r, i) => /* @__PURE__ */ o(
3612
3698
  "div",
3613
3699
  {
3614
3700
  style: {
3615
- paddingTop: a > 0 ? 12 : 0,
3616
- paddingBottom: a < e.length - 1 ? 12 : 0,
3617
- borderBottom: a < e.length - 1 ? `1px solid ${t.border}` : void 0,
3701
+ paddingTop: i > 0 ? 12 : 0,
3702
+ paddingBottom: i < e.length - 1 ? 12 : 0,
3703
+ borderBottom: i < e.length - 1 ? `1px solid ${t.border}` : void 0,
3618
3704
  minWidth: 0
3619
3705
  },
3620
- children: n(r, a)
3706
+ children: n(r, i)
3621
3707
  },
3622
- `${r.url}-${a}`
3708
+ `${r.url}-${i}`
3623
3709
  ))
3624
3710
  }
3625
3711
  );
3626
3712
  }
3627
- function ct({
3713
+ function ht({
3628
3714
  data: e,
3629
3715
  isLatest: t,
3630
3716
  durationSeconds: n,
3631
3717
  t: r
3632
3718
  }) {
3633
- const { colors: a } = T(), c = e.input.urls, s = e.input.query, m = c.length, d = m === 1 ? S(r.scrapingPage, { query: s }) : S(r.scrapingPages, { n: m, query: s });
3719
+ const { colors: i } = T(), c = e.input.urls, s = e.input.query, h = c.length, d = h === 1 ? S(r.scrapingPage, { query: s }) : S(r.scrapingPages, { n: h, query: s });
3634
3720
  return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
3635
3721
  /* @__PURE__ */ o(
3636
3722
  M.div,
3637
3723
  {
3638
- style: { color: a.textSecondary },
3724
+ style: { color: i.textSecondary },
3639
3725
  initial: { opacity: 0, y: -10 },
3640
3726
  animate: { opacity: 1, y: 0 },
3641
3727
  transition: { duration: 0.3, delay: 0 },
3642
- children: t && !n ? /* @__PURE__ */ o(F, { text: d, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ o("span", { style: { color: a.textSecondary }, children: d })
3728
+ children: t && !n ? /* @__PURE__ */ o(F, { text: d, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ o("span", { style: { color: i.textSecondary }, children: d })
3643
3729
  }
3644
3730
  ),
3645
3731
  n !== void 0 && /* @__PURE__ */ o(
@@ -3647,7 +3733,7 @@ function ct({
3647
3733
  {
3648
3734
  style: {
3649
3735
  fontSize: "12px",
3650
- color: a.textMuted,
3736
+ color: i.textMuted,
3651
3737
  marginTop: "4px",
3652
3738
  fontStyle: "italic"
3653
3739
  },
@@ -3656,17 +3742,17 @@ function ct({
3656
3742
  )
3657
3743
  ] });
3658
3744
  }
3659
- function dt({
3745
+ function pt({
3660
3746
  data: e,
3661
3747
  isLatest: t = !1,
3662
3748
  t: n
3663
3749
  }) {
3664
- const { colors: r } = T(), [a, c] = R(!1), s = e.results ?? [], { successCount: m, errorCount: d } = L(() => {
3665
- let g = 0, b = 0;
3666
- for (const x of s)
3667
- x.error != null ? b += 1 : g += 1;
3668
- return { successCount: g, errorCount: b };
3669
- }, [s]), u = s.length, l = e.input.query, h = s.length > 0 && s.every((g) => tt(g)), k = t && !h ? u === 1 ? S(n.scrapingPage, { query: l }) : S(n.scrapingPages, { n: u, query: l }) : u === 1 ? n.scrapedPage : S(n.scrapedPages, { n: u }), y = S(n.scrapeOkCount, { n: m }), p = d > 0 ? `${k} - ${y}, ${S(n.scrapeFailedCount, { n: d })}` : `${k} - ${y}`;
3750
+ const { colors: r } = T(), [i, c] = I(!1), s = e.results ?? [], { successCount: h, errorCount: d } = W(() => {
3751
+ let p = 0, b = 0;
3752
+ for (const C of s)
3753
+ C.error != null ? b += 1 : p += 1;
3754
+ return { successCount: p, errorCount: b };
3755
+ }, [s]), u = s.length, l = e.input.query, m = s.length > 0 && s.every((p) => it(p)), k = t && !m ? u === 1 ? S(n.scrapingPage, { query: l }) : S(n.scrapingPages, { n: u, query: l }) : u === 1 ? n.scrapedPage : S(n.scrapedPages, { n: u }), y = S(n.scrapeOkCount, { n: h }), g = d > 0 ? `${k} - ${y}, ${S(n.scrapeFailedCount, { n: d })}` : `${k} - ${y}`;
3670
3756
  return u === 0 ? /* @__PURE__ */ o("div", { style: { paddingBlock: "10px" }, children: /* @__PURE__ */ o(
3671
3757
  "div",
3672
3758
  {
@@ -3692,22 +3778,22 @@ function dt({
3692
3778
  gap: "6px 12px",
3693
3779
  minWidth: 0
3694
3780
  },
3695
- children: t && !h ? /* @__PURE__ */ o(F, { text: p, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ o(
3781
+ children: t && !m ? /* @__PURE__ */ o(F, { text: g, duration: 2.5, repeat: !0 }) : /* @__PURE__ */ o(
3696
3782
  "span",
3697
3783
  {
3698
3784
  style: {
3699
3785
  fontSize: 12,
3700
3786
  color: r.textSecondary
3701
3787
  },
3702
- children: p
3788
+ children: g
3703
3789
  }
3704
3790
  )
3705
3791
  }
3706
3792
  ),
3707
- ue(s, r, (g) => /* @__PURE__ */ o(
3708
- st,
3793
+ he(s, r, (p) => /* @__PURE__ */ o(
3794
+ ut,
3709
3795
  {
3710
- item: g,
3796
+ item: p,
3711
3797
  t: n,
3712
3798
  isLatest: t
3713
3799
  }
@@ -3735,14 +3821,14 @@ function dt({
3735
3821
  fontSize: 12,
3736
3822
  color: r.textSecondary
3737
3823
  },
3738
- children: p
3824
+ children: g
3739
3825
  }
3740
3826
  ),
3741
3827
  /* @__PURE__ */ o(
3742
3828
  "button",
3743
3829
  {
3744
3830
  type: "button",
3745
- onClick: () => c((g) => !g),
3831
+ onClick: () => c((p) => !p),
3746
3832
  style: {
3747
3833
  border: "none",
3748
3834
  background: "none",
@@ -3753,17 +3839,17 @@ function dt({
3753
3839
  textDecoration: "underline",
3754
3840
  fontFamily: "inherit"
3755
3841
  },
3756
- children: a ? n.memorySearchHideExploreResults : n.memorySearchViewExploreResults
3842
+ children: i ? n.memorySearchHideExploreResults : n.memorySearchViewExploreResults
3757
3843
  }
3758
3844
  )
3759
3845
  ]
3760
3846
  }
3761
3847
  ),
3762
- a && ue(s, r, (g) => /* @__PURE__ */ o(lt, { item: g, t: n }))
3848
+ i && he(s, r, (p) => /* @__PURE__ */ o(mt, { item: p, t: n }))
3763
3849
  ] });
3764
3850
  }
3765
- const ut = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => e.results === void 0 ? /* @__PURE__ */ o(
3766
- ct,
3851
+ const gt = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => e.results === void 0 ? /* @__PURE__ */ o(
3852
+ ht,
3767
3853
  {
3768
3854
  data: e,
3769
3855
  isLatest: t,
@@ -3771,14 +3857,14 @@ const ut = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => e.result
3771
3857
  t: r
3772
3858
  }
3773
3859
  ) : /* @__PURE__ */ o(
3774
- dt,
3860
+ pt,
3775
3861
  {
3776
3862
  data: e,
3777
3863
  isLatest: t,
3778
3864
  t: r
3779
3865
  }
3780
- ), mt = (e) => {
3781
- const { colors: t } = T(), { isLatest: n = !1, durationSeconds: r, t: a } = e, c = a.memoryChatThinking;
3866
+ ), yt = (e) => {
3867
+ const { colors: t } = T(), { isLatest: n = !1, durationSeconds: r, t: i } = e, c = i.memoryChatThinking;
3782
3868
  return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
3783
3869
  /* @__PURE__ */ o(
3784
3870
  M.div,
@@ -3804,25 +3890,25 @@ const ut = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => e.result
3804
3890
  marginTop: "4px",
3805
3891
  fontStyle: "italic"
3806
3892
  },
3807
- children: S(a.tookSeconds, { n: r })
3893
+ children: S(i.tookSeconds, { n: r })
3808
3894
  }
3809
3895
  )
3810
3896
  ] });
3811
3897
  };
3812
- function ht({ item: e }) {
3813
- return e.error != null ? /* @__PURE__ */ o($, { size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(D, { size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
3898
+ function ft({ item: e }) {
3899
+ return e.error != null ? /* @__PURE__ */ o($, { size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
3814
3900
  }
3815
- function pt(e, t) {
3901
+ function kt(e, t) {
3816
3902
  return S(t.searchingInMemoriesOfType, {
3817
3903
  name: e.memoryTypeName
3818
3904
  });
3819
3905
  }
3820
- function gt({
3906
+ function bt({
3821
3907
  item: e,
3822
3908
  t,
3823
3909
  showShimmerForPrimary: n
3824
3910
  }) {
3825
- const { colors: r } = T(), a = e.result != null, c = e.error != null, s = pt(e, t);
3911
+ const { colors: r } = T(), i = e.result != null, c = e.error != null, s = kt(e, t);
3826
3912
  return /* @__PURE__ */ f(
3827
3913
  M.div,
3828
3914
  {
@@ -3850,7 +3936,7 @@ function gt({
3850
3936
  flexShrink: 0,
3851
3937
  width: 32
3852
3938
  },
3853
- children: /* @__PURE__ */ o(ht, { item: e })
3939
+ children: /* @__PURE__ */ o(ft, { item: e })
3854
3940
  }
3855
3941
  ),
3856
3942
  /* @__PURE__ */ f(
@@ -3864,8 +3950,8 @@ function gt({
3864
3950
  flex: 1
3865
3951
  },
3866
3952
  children: [
3867
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: r.textPrimary }, children: !a && !c && n ? /* @__PURE__ */ o(F, { text: s, duration: 2.5, repeat: !0 }) : s }),
3868
- a && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: r.textSecondary }, children: e.result.numberOfChunks === 1 ? S(
3953
+ /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: r.textPrimary }, children: !i && !c && n ? /* @__PURE__ */ o(F, { text: s, duration: 2.5, repeat: !0 }) : s }),
3954
+ i && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: r.textSecondary }, children: e.result.numberOfChunks === 1 ? S(
3869
3955
  t.memorySearchTypeResultSummaryOne,
3870
3956
  {
3871
3957
  score: e.result.highestChunkScore.toFixed(
@@ -3889,20 +3975,20 @@ function gt({
3889
3975
  }
3890
3976
  );
3891
3977
  }
3892
- const yt = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
3893
- const { colors: a } = T(), c = L(() => {
3978
+ const St = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
3979
+ const { colors: i } = T(), c = W(() => {
3894
3980
  let s = -1;
3895
- return e.memoryTypes.forEach((m, d) => {
3896
- m.result == null && m.error == null && (s = d);
3981
+ return e.memoryTypes.forEach((h, d) => {
3982
+ h.result == null && h.error == null && (s = d);
3897
3983
  }), s;
3898
3984
  }, [e.memoryTypes]);
3899
3985
  return /* @__PURE__ */ f("div", { style: { paddingBlock: "10px" }, children: [
3900
- t && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(F, { text: r.searchingMemoryTypes, duration: 2.5, repeat: !0 }) : e.memoryTypes.map((s, m) => /* @__PURE__ */ o(
3901
- gt,
3986
+ t && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(F, { text: r.searchingMemoryTypes, duration: 2.5, repeat: !0 }) : e.memoryTypes.map((s, h) => /* @__PURE__ */ o(
3987
+ bt,
3902
3988
  {
3903
3989
  item: s,
3904
3990
  t: r,
3905
- showShimmerForPrimary: m === c && t
3991
+ showShimmerForPrimary: h === c && t
3906
3992
  },
3907
3993
  s.memoryTypeId
3908
3994
  )),
@@ -3911,7 +3997,7 @@ const yt = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
3911
3997
  {
3912
3998
  style: {
3913
3999
  fontSize: "12px",
3914
- color: a.textMuted,
4000
+ color: i.textMuted,
3915
4001
  marginTop: "4px",
3916
4002
  fontStyle: "italic"
3917
4003
  },
@@ -3919,39 +4005,39 @@ const yt = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
3919
4005
  }
3920
4006
  )
3921
4007
  ] });
3922
- }, U = 12, _ = 1.45, ft = Math.ceil(
4008
+ }, U = 12, _ = 1.45, xt = Math.ceil(
3923
4009
  U * _
3924
- ), kt = Math.ceil(
4010
+ ), Tt = Math.ceil(
3925
4011
  5 * U * _
3926
4012
  );
3927
4013
  function j(e) {
3928
4014
  return e.queries != null && e.queries.length > 0;
3929
4015
  }
3930
- function bt(e) {
4016
+ function vt(e) {
3931
4017
  const t = e.reasoning;
3932
4018
  return (t == null || t === "") && !j(e);
3933
4019
  }
3934
- function St(e) {
4020
+ function wt(e) {
3935
4021
  if (j(e)) return 3;
3936
4022
  const t = e.reasoning;
3937
4023
  return t == null || t === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
3938
4024
  }
3939
- function xt({ phase: e }) {
3940
- return e === 3 ? /* @__PURE__ */ o(D, { size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
4025
+ function Ct({ phase: e }) {
4026
+ return e === 3 ? /* @__PURE__ */ o(L, { size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
3941
4027
  }
3942
- function Tt({
4028
+ function Mt({
3943
4029
  item: e,
3944
4030
  t,
3945
4031
  isActiveRow: n
3946
4032
  }) {
3947
- const { colors: r } = T(), a = bt(e), c = St(e), s = e.reasoning, m = s != null && s.length > 0, d = z(null), [u, l] = R(!1), h = a && n, k = c === 2 && n && !j(e);
3948
- B(() => {
3949
- const g = d.current;
3950
- g != null && c === 1 && m && (g.scrollTop = g.scrollHeight);
3951
- }, [s, c, m]);
4033
+ const { colors: r } = T(), i = vt(e), c = wt(e), s = e.reasoning, h = s != null && s.length > 0, d = D(null), [u, l] = I(!1), m = i && n, k = c === 2 && n && !j(e);
4034
+ z(() => {
4035
+ const p = d.current;
4036
+ p != null && c === 1 && h && (p.scrollTop = p.scrollHeight);
4037
+ }, [s, c, h]);
3952
4038
  const y = S(t.searchingInMemoriesOfType, {
3953
4039
  name: e.memoryTypeName
3954
- }), p = !a && c === 3;
4040
+ }), g = !i && c === 3;
3955
4041
  return /* @__PURE__ */ f(
3956
4042
  M.div,
3957
4043
  {
@@ -3964,7 +4050,7 @@ function Tt({
3964
4050
  borderBottom: `1px solid ${r.border}`,
3965
4051
  display: "flex",
3966
4052
  flexDirection: "row",
3967
- alignItems: p ? "flex-start" : "center",
4053
+ alignItems: g ? "flex-start" : "center",
3968
4054
  gap: "10px",
3969
4055
  minWidth: 0
3970
4056
  },
@@ -3978,9 +4064,9 @@ function Tt({
3978
4064
  justifyContent: "center",
3979
4065
  flexShrink: 0,
3980
4066
  width: 32,
3981
- ...p ? { paddingTop: 2 } : {}
4067
+ ...g ? { paddingTop: 2 } : {}
3982
4068
  },
3983
- children: /* @__PURE__ */ o(xt, { phase: a ? 1 : c })
4069
+ children: /* @__PURE__ */ o(Ct, { phase: i ? 1 : c })
3984
4070
  }
3985
4071
  ),
3986
4072
  /* @__PURE__ */ f(
@@ -3994,8 +4080,8 @@ function Tt({
3994
4080
  flex: 1
3995
4081
  },
3996
4082
  children: [
3997
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: r.textPrimary }, children: h ? /* @__PURE__ */ o(F, { text: y, duration: 2.5, repeat: !0 }) : e.memoryTypeName }),
3998
- c === 1 && m && !j(e) && /* @__PURE__ */ f("div", { style: { minWidth: 0 }, children: [
4083
+ /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: r.textPrimary }, children: m ? /* @__PURE__ */ o(F, { text: y, duration: 2.5, repeat: !0 }) : e.memoryTypeName }),
4084
+ c === 1 && h && !j(e) && /* @__PURE__ */ f("div", { style: { minWidth: 0 }, children: [
3999
4085
  /* @__PURE__ */ o(
4000
4086
  "span",
4001
4087
  {
@@ -4024,8 +4110,8 @@ function Tt({
4024
4110
  ref: d,
4025
4111
  className: "memory-search-generating-reasoning-viewport",
4026
4112
  style: {
4027
- minHeight: ft,
4028
- maxHeight: kt,
4113
+ minHeight: xt,
4114
+ maxHeight: Tt,
4029
4115
  height: "auto",
4030
4116
  overflowY: "auto",
4031
4117
  overflowX: "hidden",
@@ -4049,7 +4135,7 @@ function Tt({
4049
4135
  repeat: !0
4050
4136
  }
4051
4137
  ) }),
4052
- c === 3 && /* @__PURE__ */ f(A, { children: [
4138
+ c === 3 && /* @__PURE__ */ f(B, { children: [
4053
4139
  /* @__PURE__ */ f("div", { style: { minWidth: 0 }, children: [
4054
4140
  /* @__PURE__ */ o(
4055
4141
  "span",
@@ -4072,7 +4158,7 @@ function Tt({
4072
4158
  flexDirection: "column",
4073
4159
  gap: 6
4074
4160
  },
4075
- children: e.queries.map((g, b) => /* @__PURE__ */ o(
4161
+ children: e.queries.map((p, b) => /* @__PURE__ */ o(
4076
4162
  "div",
4077
4163
  {
4078
4164
  style: {
@@ -4081,19 +4167,19 @@ function Tt({
4081
4167
  lineHeight: 1.5,
4082
4168
  wordBreak: "break-word"
4083
4169
  },
4084
- children: g.query
4170
+ children: p.query
4085
4171
  },
4086
4172
  b
4087
4173
  ))
4088
4174
  }
4089
4175
  )
4090
4176
  ] }),
4091
- m && /* @__PURE__ */ f(A, { children: [
4177
+ h && /* @__PURE__ */ f(B, { children: [
4092
4178
  /* @__PURE__ */ o(
4093
4179
  "button",
4094
4180
  {
4095
4181
  type: "button",
4096
- onClick: () => l((g) => !g),
4182
+ onClick: () => l((p) => !p),
4097
4183
  style: {
4098
4184
  alignSelf: "flex-start",
4099
4185
  border: "none",
@@ -4132,20 +4218,20 @@ function Tt({
4132
4218
  }
4133
4219
  );
4134
4220
  }
4135
- const vt = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
4136
- const { colors: a } = T(), c = L(() => {
4221
+ const Et = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
4222
+ const { colors: i } = T(), c = W(() => {
4137
4223
  let s = -1;
4138
- return e.memoryTypes.forEach((m, d) => {
4139
- j(m) || (s = d);
4224
+ return e.memoryTypes.forEach((h, d) => {
4225
+ j(h) || (s = d);
4140
4226
  }), s;
4141
4227
  }, [e.memoryTypes]);
4142
4228
  return /* @__PURE__ */ f("div", { style: { paddingBlock: "10px" }, children: [
4143
- t && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(F, { text: r.memorySearchGeneratingQueries, duration: 2.5, repeat: !0 }) : e.memoryTypes.map((s, m) => /* @__PURE__ */ o(
4144
- Tt,
4229
+ t && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(F, { text: r.memorySearchGeneratingQueries, duration: 2.5, repeat: !0 }) : e.memoryTypes.map((s, h) => /* @__PURE__ */ o(
4230
+ Mt,
4145
4231
  {
4146
4232
  item: s,
4147
4233
  t: r,
4148
- isActiveRow: m === c && t
4234
+ isActiveRow: h === c && t
4149
4235
  },
4150
4236
  s.memoryTypeId
4151
4237
  )),
@@ -4154,7 +4240,7 @@ const vt = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
4154
4240
  {
4155
4241
  style: {
4156
4242
  fontSize: "12px",
4157
- color: a.textMuted,
4243
+ color: i.textMuted,
4158
4244
  marginTop: "4px",
4159
4245
  fontStyle: "italic"
4160
4246
  },
@@ -4163,10 +4249,10 @@ const vt = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
4163
4249
  )
4164
4250
  ] });
4165
4251
  };
4166
- function Ct(e) {
4167
- return e.some((r) => r.result == null && r.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((r) => r.error != null) ? /* @__PURE__ */ o($, { size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(D, { size: 15, borderWidth: 2 });
4252
+ function It(e) {
4253
+ return e.some((r) => r.result == null && r.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((r) => r.error != null) ? /* @__PURE__ */ o($, { size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(L, { size: 15, borderWidth: 2 });
4168
4254
  }
4169
- function wt({
4255
+ function Rt({
4170
4256
  item: e,
4171
4257
  t
4172
4258
  }) {
@@ -4175,35 +4261,35 @@ function wt({
4175
4261
  return /* @__PURE__ */ o("span", { style: { fontSize: 12, color: n.textError, whiteSpace: "nowrap" }, children: e.error });
4176
4262
  if (e.result == null)
4177
4263
  return /* @__PURE__ */ o("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ o(F, { text: t.searching, duration: 2.5, repeat: !0 }) });
4178
- const r = e.result, a = r.numberOfChunks === 1 ? t.chunkFound : S(t.chunksFound, { n: r.numberOfChunks }), c = S(t.scoreLabel, {
4264
+ const r = e.result, i = r.numberOfChunks === 1 ? t.chunkFound : S(t.chunksFound, { n: r.numberOfChunks }), c = S(t.scoreLabel, {
4179
4265
  n: r.highestChunkScore.toFixed(2)
4180
4266
  });
4181
4267
  return /* @__PURE__ */ f("span", { style: { fontSize: 12, color: n.textSecondary, whiteSpace: "nowrap" }, children: [
4182
- a,
4268
+ i,
4183
4269
  " · ",
4184
4270
  c
4185
4271
  ] });
4186
4272
  }
4187
- function Mt({
4273
+ function Ft({
4188
4274
  items: e,
4189
4275
  queryRow: t,
4190
4276
  onExploreQueryResultClick: n,
4191
4277
  t: r
4192
4278
  }) {
4193
- const { colors: a } = T(), [c, s] = R(null);
4279
+ const { colors: i } = T(), [c, s] = I(null);
4194
4280
  if (e.length === 0)
4195
4281
  return /* @__PURE__ */ o(
4196
4282
  "div",
4197
4283
  {
4198
4284
  style: {
4199
4285
  fontSize: 12,
4200
- color: a.textMuted,
4286
+ color: i.textMuted,
4201
4287
  paddingTop: 4
4202
4288
  },
4203
4289
  children: r.memorySearchExploreNoResults
4204
4290
  }
4205
4291
  );
4206
- const m = !!n;
4292
+ const h = !!n;
4207
4293
  return /* @__PURE__ */ o(
4208
4294
  "div",
4209
4295
  {
@@ -4213,27 +4299,27 @@ function Mt({
4213
4299
  gap: 0,
4214
4300
  marginTop: 8,
4215
4301
  paddingTop: 8,
4216
- borderTop: `1px solid ${a.borderDivider}`
4302
+ borderTop: `1px solid ${i.borderDivider}`
4217
4303
  },
4218
4304
  children: e.map((d, u) => {
4219
- const l = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, h = J(
4305
+ const l = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, m = ee(
4220
4306
  d.chunks
4221
4307
  ), k = [
4222
- Z(d),
4308
+ re(d),
4223
4309
  S(r.scoreLabel, {
4224
4310
  n: d.matchingChunkScore.toFixed(2)
4225
4311
  }),
4226
- h.length > 0 ? Y(h, r) : r.pagesNotAvailable
4312
+ m.length > 0 ? Z(m, r) : r.pagesNotAvailable
4227
4313
  ].filter(
4228
4314
  (b) => b != null && b !== ""
4229
4315
  ), y = {
4230
4316
  memoryId: d.memoryId,
4231
4317
  memoryTitle: d.memoryTitle,
4232
- pageNumbers: h,
4318
+ pageNumbers: m,
4233
4319
  memoryTypeId: t.memoryTypeId,
4234
4320
  memoryTypeName: t.memoryTypeName,
4235
4321
  query: t.query
4236
- }, p = `${t.query}::${d.memoryId}::${u}`, g = c === p;
4322
+ }, g = `${t.query}::${d.memoryId}::${u}`, p = c === g;
4237
4323
  return /* @__PURE__ */ f(
4238
4324
  "div",
4239
4325
  {
@@ -4244,7 +4330,7 @@ function Mt({
4244
4330
  gap: "12px",
4245
4331
  paddingTop: u > 0 ? 12 : 0,
4246
4332
  paddingBottom: u < e.length - 1 ? 12 : 0,
4247
- borderBottom: u < e.length - 1 ? `1px solid ${a.border}` : void 0,
4333
+ borderBottom: u < e.length - 1 ? `1px solid ${i.border}` : void 0,
4248
4334
  minWidth: 0
4249
4335
  },
4250
4336
  children: [
@@ -4265,7 +4351,7 @@ function Mt({
4265
4351
  style: {
4266
4352
  fontSize: 13,
4267
4353
  fontWeight: 600,
4268
- color: a.textPrimary
4354
+ color: i.textPrimary
4269
4355
  },
4270
4356
  children: l
4271
4357
  }
@@ -4275,12 +4361,12 @@ function Mt({
4275
4361
  {
4276
4362
  style: {
4277
4363
  fontSize: 13,
4278
- color: a.textPrimary,
4364
+ color: i.textPrimary,
4279
4365
  lineHeight: 1.5,
4280
4366
  whiteSpace: "pre-wrap",
4281
4367
  wordBreak: "break-word"
4282
4368
  },
4283
- children: V(
4369
+ children: J(
4284
4370
  d.chunks
4285
4371
  )
4286
4372
  }
@@ -4291,7 +4377,7 @@ function Mt({
4291
4377
  style: {
4292
4378
  fontSize: 11,
4293
4379
  fontWeight: 400,
4294
- color: a.textMuted,
4380
+ color: i.textMuted,
4295
4381
  lineHeight: 1.35
4296
4382
  },
4297
4383
  children: k.join(" · ")
@@ -4300,14 +4386,14 @@ function Mt({
4300
4386
  ]
4301
4387
  }
4302
4388
  ),
4303
- m && /* @__PURE__ */ f(
4389
+ h && /* @__PURE__ */ f(
4304
4390
  "button",
4305
4391
  {
4306
4392
  type: "button",
4307
- "aria-busy": g,
4308
- disabled: g,
4393
+ "aria-busy": p,
4394
+ disabled: p,
4309
4395
  onClick: async () => {
4310
- s(p);
4396
+ s(g);
4311
4397
  try {
4312
4398
  await n(
4313
4399
  y
@@ -4322,18 +4408,18 @@ function Mt({
4322
4408
  padding: "6px 12px",
4323
4409
  fontSize: 12,
4324
4410
  fontWeight: 600,
4325
- color: a.link,
4326
- background: a.bgChip,
4327
- border: `1px solid ${a.bgChipBorder}`,
4411
+ color: i.link,
4412
+ background: i.bgChip,
4413
+ border: `1px solid ${i.bgChipBorder}`,
4328
4414
  borderRadius: 6,
4329
- cursor: g ? "wait" : "pointer",
4415
+ cursor: p ? "wait" : "pointer",
4330
4416
  fontFamily: "inherit",
4331
4417
  display: "inline-flex",
4332
4418
  alignItems: "center",
4333
4419
  gap: 8
4334
4420
  },
4335
4421
  children: [
4336
- g && /* @__PURE__ */ o(
4422
+ p && /* @__PURE__ */ o(
4337
4423
  "span",
4338
4424
  {
4339
4425
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -4352,26 +4438,26 @@ function Mt({
4352
4438
  }
4353
4439
  );
4354
4440
  }
4355
- function It(e) {
4441
+ function At(e) {
4356
4442
  const t = [], n = /* @__PURE__ */ new Map();
4357
- return e.forEach((r, a) => {
4443
+ return e.forEach((r, i) => {
4358
4444
  let c = n.get(r.memoryTypeId);
4359
4445
  c == null && (t.push(r.memoryTypeId), c = {
4360
4446
  memoryTypeId: r.memoryTypeId,
4361
4447
  memoryTypeName: r.memoryTypeName,
4362
4448
  items: []
4363
- }, n.set(r.memoryTypeId, c)), c.items.push({ item: r, flatIndex: a });
4449
+ }, n.set(r.memoryTypeId, c)), c.items.push({ item: r, flatIndex: i });
4364
4450
  }), t.map((r) => n.get(r));
4365
4451
  }
4366
- function Et({
4452
+ function Bt({
4367
4453
  group: e,
4368
4454
  t,
4369
4455
  isLatest: n,
4370
4456
  expandedRows: r,
4371
- toggleExpanded: a,
4457
+ toggleExpanded: i,
4372
4458
  onExploreQueryResultClick: c
4373
4459
  }) {
4374
- const { colors: s } = T(), m = e.items.map((u) => u.item), d = m.some(
4460
+ const { colors: s } = T(), h = e.items.map((u) => u.item), d = h.some(
4375
4461
  (u) => u.result == null && u.error == null
4376
4462
  );
4377
4463
  return /* @__PURE__ */ f(
@@ -4402,7 +4488,7 @@ function Et({
4402
4488
  width: 32,
4403
4489
  ...d ? {} : { paddingTop: 2 }
4404
4490
  },
4405
- children: Ct(m)
4491
+ children: It(h)
4406
4492
  }
4407
4493
  ),
4408
4494
  /* @__PURE__ */ f(
@@ -4430,7 +4516,7 @@ function Et({
4430
4516
  ),
4431
4517
  e.items.map(({ item: u, flatIndex: l }) => {
4432
4518
  var b;
4433
- const h = u.result != null, k = u.error != null, y = n && !h && !k, p = r[l] === !0, g = ((b = u.result) == null ? void 0 : b.items) ?? [];
4519
+ const m = u.result != null, k = u.error != null, y = n && !m && !k, g = r[l] === !0, p = ((b = u.result) == null ? void 0 : b.items) ?? [];
4434
4520
  return /* @__PURE__ */ f(
4435
4521
  "div",
4436
4522
  {
@@ -4485,12 +4571,12 @@ function Et({
4485
4571
  flexShrink: 0
4486
4572
  },
4487
4573
  children: [
4488
- /* @__PURE__ */ o(wt, { item: u, t }),
4489
- h && /* @__PURE__ */ o(
4574
+ /* @__PURE__ */ o(Rt, { item: u, t }),
4575
+ m && /* @__PURE__ */ o(
4490
4576
  "button",
4491
4577
  {
4492
4578
  type: "button",
4493
- onClick: () => a(l),
4579
+ onClick: () => i(l),
4494
4580
  style: {
4495
4581
  border: "none",
4496
4582
  background: "none",
@@ -4501,7 +4587,7 @@ function Et({
4501
4587
  textDecoration: "underline",
4502
4588
  fontFamily: "inherit"
4503
4589
  },
4504
- children: p ? t.memorySearchHideExploreResults : t.memorySearchViewExploreResults
4590
+ children: g ? t.memorySearchHideExploreResults : t.memorySearchViewExploreResults
4505
4591
  }
4506
4592
  )
4507
4593
  ]
@@ -4510,10 +4596,10 @@ function Et({
4510
4596
  ]
4511
4597
  }
4512
4598
  ),
4513
- h && p && /* @__PURE__ */ o(
4514
- Mt,
4599
+ m && g && /* @__PURE__ */ o(
4600
+ Ft,
4515
4601
  {
4516
- items: g,
4602
+ items: p,
4517
4603
  queryRow: u,
4518
4604
  onExploreQueryResultClick: c,
4519
4605
  t
@@ -4531,37 +4617,37 @@ function Et({
4531
4617
  }
4532
4618
  );
4533
4619
  }
4534
- const Rt = ({
4620
+ const Pt = ({
4535
4621
  data: e,
4536
4622
  isLatest: t = !1,
4537
4623
  durationSeconds: n,
4538
4624
  onExploreQueryResultClick: r,
4539
- t: a
4625
+ t: i
4540
4626
  }) => {
4541
- const { colors: c } = T(), [s, m] = R(
4627
+ const { colors: c } = T(), [s, h] = I(
4542
4628
  {}
4543
4629
  ), d = O((l) => {
4544
- m((h) => ({
4545
- ...h,
4546
- [l]: !h[l]
4630
+ h((m) => ({
4631
+ ...m,
4632
+ [l]: !m[l]
4547
4633
  }));
4548
- }, []), u = L(
4549
- () => It(e.queries),
4634
+ }, []), u = W(
4635
+ () => At(e.queries),
4550
4636
  [e.queries]
4551
4637
  );
4552
4638
  return /* @__PURE__ */ f("div", { style: { paddingBlock: "10px" }, children: [
4553
4639
  t && !n && e.queries.length === 0 ? /* @__PURE__ */ o(
4554
4640
  F,
4555
4641
  {
4556
- text: a.memorySearchExploringQueries,
4642
+ text: i.memorySearchExploringQueries,
4557
4643
  duration: 2.5,
4558
4644
  repeat: !0
4559
4645
  }
4560
4646
  ) : u.map((l) => /* @__PURE__ */ o(
4561
- Et,
4647
+ Bt,
4562
4648
  {
4563
4649
  group: l,
4564
- t: a,
4650
+ t: i,
4565
4651
  isLatest: t,
4566
4652
  expandedRows: s,
4567
4653
  toggleExpanded: d,
@@ -4578,12 +4664,12 @@ const Rt = ({
4578
4664
  marginTop: "4px",
4579
4665
  fontStyle: "italic"
4580
4666
  },
4581
- children: S(a.tookSeconds, { n })
4667
+ children: S(i.tookSeconds, { n })
4582
4668
  }
4583
4669
  )
4584
4670
  ] });
4585
- }, Ft = ({ data: e, onSearchResultClick: t, t: n }) => {
4586
- const { colors: r } = T(), a = e.response.items, c = !!t, [s, m] = R(null);
4671
+ }, zt = ({ data: e, onSearchResultClick: t, t: n }) => {
4672
+ const { colors: r } = T(), i = e.response.items, c = !!t, [s, h] = I(null);
4587
4673
  return /* @__PURE__ */ f("div", { style: { paddingBlock: "16px" }, children: [
4588
4674
  /* @__PURE__ */ o(
4589
4675
  M.div,
@@ -4608,15 +4694,15 @@ const Rt = ({
4608
4694
  flexDirection: "column",
4609
4695
  gap: 0
4610
4696
  },
4611
- children: a.map((d, u) => {
4612
- const l = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, h = J(
4697
+ children: i.map((d, u) => {
4698
+ const l = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, m = ee(
4613
4699
  d.chunks
4614
4700
  ), k = [
4615
- Z(d),
4701
+ re(d),
4616
4702
  S(n.scoreLabel, {
4617
4703
  n: d.matchingChunkScore.toFixed(2)
4618
4704
  }),
4619
- h.length > 0 ? Y(h, n) : n.pagesNotAvailable
4705
+ m.length > 0 ? Z(m, n) : n.pagesNotAvailable
4620
4706
  ].filter(
4621
4707
  (b) => b != null && b !== ""
4622
4708
  ), y = {
@@ -4624,8 +4710,8 @@ const Rt = ({
4624
4710
  memoryTitle: d.memoryTitle,
4625
4711
  memoryTypeId: d.memoryTypeId,
4626
4712
  memoryTypeName: d.memoryTypeName,
4627
- pageNumbers: h
4628
- }, p = `${d.memoryId}-${u}`, g = s === p;
4713
+ pageNumbers: m
4714
+ }, g = `${d.memoryId}-${u}`, p = s === g;
4629
4715
  return /* @__PURE__ */ f(
4630
4716
  M.div,
4631
4717
  {
@@ -4639,7 +4725,7 @@ const Rt = ({
4639
4725
  gap: "12px",
4640
4726
  paddingTop: "12px",
4641
4727
  paddingBottom: "12px",
4642
- borderBottom: u < a.length - 1 ? `1px solid ${r.border}` : void 0,
4728
+ borderBottom: u < i.length - 1 ? `1px solid ${r.border}` : void 0,
4643
4729
  minWidth: 0
4644
4730
  },
4645
4731
  children: [
@@ -4675,7 +4761,7 @@ const Rt = ({
4675
4761
  whiteSpace: "pre-wrap",
4676
4762
  wordBreak: "break-word"
4677
4763
  },
4678
- children: V(d.chunks)
4764
+ children: J(d.chunks)
4679
4765
  }
4680
4766
  ),
4681
4767
  /* @__PURE__ */ o(
@@ -4697,14 +4783,14 @@ const Rt = ({
4697
4783
  "button",
4698
4784
  {
4699
4785
  type: "button",
4700
- "aria-busy": g,
4701
- disabled: g,
4786
+ "aria-busy": p,
4787
+ disabled: p,
4702
4788
  onClick: async () => {
4703
- m(p);
4789
+ h(g);
4704
4790
  try {
4705
4791
  await t(y);
4706
4792
  } finally {
4707
- m(null);
4793
+ h(null);
4708
4794
  }
4709
4795
  },
4710
4796
  style: {
@@ -4717,14 +4803,14 @@ const Rt = ({
4717
4803
  background: r.bgChip,
4718
4804
  border: `1px solid ${r.bgChipBorder}`,
4719
4805
  borderRadius: 6,
4720
- cursor: g ? "wait" : "pointer",
4806
+ cursor: p ? "wait" : "pointer",
4721
4807
  fontFamily: "inherit",
4722
4808
  display: "inline-flex",
4723
4809
  alignItems: "center",
4724
4810
  gap: 8
4725
4811
  },
4726
4812
  children: [
4727
- g && /* @__PURE__ */ o(
4813
+ p && /* @__PURE__ */ o(
4728
4814
  "span",
4729
4815
  {
4730
4816
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -4770,7 +4856,7 @@ const Rt = ({
4770
4856
  }
4771
4857
  ) });
4772
4858
  };
4773
- class At extends Fe.Component {
4859
+ class Dt extends Pe.Component {
4774
4860
  constructor(t) {
4775
4861
  super(t), this.state = { hasError: !1 };
4776
4862
  }
@@ -4789,195 +4875,206 @@ class At extends Fe.Component {
4789
4875
  return this.state.hasError ? null : this.props.children;
4790
4876
  }
4791
4877
  }
4792
- const Pt = ({
4878
+ const Lt = ({
4793
4879
  progressViewItems: e,
4794
4880
  loading: t,
4795
4881
  error: n,
4796
4882
  loadingText: r,
4797
- t: a,
4883
+ t: i,
4798
4884
  onSourceClick: c,
4799
4885
  onSearchResultClick: s,
4800
- onExploreQueryResultClick: m
4886
+ onExploreQueryResultClick: h
4801
4887
  }) => {
4802
- const { theme: d, colors: u } = T(), l = z(null);
4803
- B(() => {
4888
+ const { theme: d, colors: u } = T(), l = D(null);
4889
+ z(() => {
4804
4890
  l.current && (l.current.scrollTop = l.current.scrollHeight);
4805
4891
  }, [e.length]);
4806
- const h = (y) => {
4807
- const p = y.item.data;
4808
- if (p.taskType === "StreamingChatCompletion" && p.eventType === "Text")
4809
- return /* @__PURE__ */ o(se, { text: p.text });
4810
- if (p.taskType === "StructuredChatCompletion" && p.eventType === "Completed")
4811
- return /* @__PURE__ */ o(Fr, { data: p });
4812
- if (p.taskType === "MemoryChat")
4813
- switch (p.eventType) {
4892
+ const m = (y) => {
4893
+ const g = y.item.data;
4894
+ if (g.taskType === "StreamingChatCompletion" && g.eventType === "Text")
4895
+ return /* @__PURE__ */ o(ce, { text: g.text });
4896
+ if (g.taskType === "StructuredChatCompletion" && g.eventType === "Completed")
4897
+ return /* @__PURE__ */ o(zr, { data: g });
4898
+ if (g.taskType === "MemoryChat")
4899
+ switch (g.eventType) {
4814
4900
  case "Text":
4815
- return /* @__PURE__ */ o(se, { text: p.text });
4901
+ return /* @__PURE__ */ o(ce, { text: g.text });
4816
4902
  case "Thinking":
4817
4903
  return /* @__PURE__ */ o(
4818
- mt,
4904
+ yt,
4819
4905
  {
4820
- data: p,
4906
+ data: g,
4821
4907
  isLatest: y.isLatest,
4822
4908
  durationSeconds: y.durationSeconds,
4823
- t: a
4909
+ t: i
4824
4910
  }
4825
4911
  );
4826
4912
  case "FindMemories":
4827
4913
  return /* @__PURE__ */ o(
4828
- zr,
4914
+ qr,
4829
4915
  {
4830
- data: p,
4916
+ data: g,
4831
4917
  isLatest: y.isLatest,
4832
4918
  durationSeconds: y.durationSeconds,
4833
- t: a
4919
+ t: i
4834
4920
  }
4835
4921
  );
4836
4922
  case "FindMemoriesResult":
4837
4923
  return /* @__PURE__ */ o(
4838
- Dr,
4924
+ Qr,
4839
4925
  {
4840
- data: p,
4841
- t: a
4926
+ data: g,
4927
+ t: i
4842
4928
  }
4843
4929
  );
4844
4930
  case "Search":
4845
4931
  return /* @__PURE__ */ o(
4846
- Br,
4932
+ V,
4933
+ {
4934
+ data: g,
4935
+ isLatest: y.isLatest,
4936
+ durationSeconds: y.durationSeconds,
4937
+ t: i
4938
+ }
4939
+ );
4940
+ case "SearchMemoryChunks":
4941
+ return /* @__PURE__ */ o(
4942
+ Gr,
4847
4943
  {
4848
- data: p,
4944
+ data: g,
4849
4945
  isLatest: y.isLatest,
4850
4946
  durationSeconds: y.durationSeconds,
4851
- t: a
4947
+ t: i,
4948
+ onSearchResultClick: s
4852
4949
  }
4853
4950
  );
4854
4951
  case "FindSources":
4855
4952
  return /* @__PURE__ */ o(
4856
- Lr,
4953
+ Kr,
4857
4954
  {
4858
- data: p,
4955
+ data: g,
4859
4956
  isLatest: y.isLatest,
4860
4957
  durationSeconds: y.durationSeconds,
4861
- t: a
4958
+ t: i
4862
4959
  }
4863
4960
  );
4864
4961
  case "SourcesResult":
4865
4962
  return /* @__PURE__ */ o(
4866
- Nr,
4963
+ Xr,
4867
4964
  {
4868
- data: p,
4965
+ data: g,
4869
4966
  onSourceClick: c,
4870
- t: a
4967
+ t: i
4871
4968
  }
4872
4969
  );
4873
4970
  case "ExploreMemories":
4874
4971
  return /* @__PURE__ */ o(
4875
- Hr,
4972
+ et,
4876
4973
  {
4877
- data: p,
4974
+ data: g,
4878
4975
  completed: y.completed,
4879
4976
  isLatest: y.isLatest,
4880
- t: a
4977
+ t: i
4881
4978
  }
4882
4979
  );
4883
4980
  case "ChunkResults":
4884
4981
  return /* @__PURE__ */ o(
4885
- Vr,
4982
+ we,
4886
4983
  {
4887
- data: p,
4984
+ data: g,
4888
4985
  onSearchResultClick: s,
4889
- t: a
4986
+ t: i
4890
4987
  }
4891
4988
  );
4892
4989
  case "GoogleSearch":
4893
4990
  return /* @__PURE__ */ o(
4894
- rt,
4991
+ at,
4895
4992
  {
4896
- data: p,
4993
+ data: g,
4897
4994
  isLatest: y.isLatest,
4898
4995
  durationSeconds: y.durationSeconds,
4899
- t: a
4996
+ t: i
4900
4997
  }
4901
4998
  );
4902
4999
  case "ScrapeWebsites":
4903
5000
  return /* @__PURE__ */ o(
4904
- ut,
5001
+ gt,
4905
5002
  {
4906
- data: p,
5003
+ data: g,
4907
5004
  isLatest: y.isLatest,
4908
5005
  durationSeconds: y.durationSeconds,
4909
- t: a
5006
+ t: i
4910
5007
  }
4911
5008
  );
4912
5009
  case "Completed":
4913
5010
  return null;
4914
5011
  default: {
4915
- const g = p;
4916
- return g.eventType === "Error" && "message" in g ? /* @__PURE__ */ o(N, { message: g.message }) : (console.warn(
5012
+ const p = g;
5013
+ return p.eventType === "Error" && "message" in p ? /* @__PURE__ */ o(N, { message: p.message }) : (console.warn(
4917
5014
  "[fency] Unknown MemoryChat eventType (no UI):",
4918
- g.eventType,
4919
- g
5015
+ p.eventType,
5016
+ p
4920
5017
  ), null);
4921
5018
  }
4922
5019
  }
4923
- if (p.taskType === "MemorySearch")
4924
- switch (p.eventType) {
5020
+ if (g.taskType === "MemorySearch")
5021
+ switch (g.eventType) {
4925
5022
  case "GeneratingQueries":
4926
5023
  return /* @__PURE__ */ o(
4927
- vt,
5024
+ Et,
4928
5025
  {
4929
- data: p,
5026
+ data: g,
4930
5027
  isLatest: y.isLatest,
4931
5028
  durationSeconds: y.durationSeconds,
4932
- t: a
5029
+ t: i
4933
5030
  }
4934
5031
  );
4935
5032
  case "ExploreQueries":
4936
5033
  return /* @__PURE__ */ o(
4937
- Rt,
5034
+ Pt,
4938
5035
  {
4939
- data: p,
5036
+ data: g,
4940
5037
  isLatest: y.isLatest,
4941
5038
  durationSeconds: y.durationSeconds,
4942
- onExploreQueryResultClick: m,
4943
- t: a
5039
+ onExploreQueryResultClick: h,
5040
+ t: i
4944
5041
  }
4945
5042
  );
4946
5043
  case "SearchMemoryTypes":
4947
5044
  return /* @__PURE__ */ o(
4948
- yt,
5045
+ St,
4949
5046
  {
4950
- data: p,
5047
+ data: g,
4951
5048
  isLatest: y.isLatest,
4952
5049
  durationSeconds: y.durationSeconds,
4953
- t: a
5050
+ t: i
4954
5051
  }
4955
5052
  );
4956
5053
  case "Completed":
4957
5054
  return /* @__PURE__ */ o(
4958
- Ft,
5055
+ zt,
4959
5056
  {
4960
- data: p,
5057
+ data: g,
4961
5058
  onSearchResultClick: s,
4962
- t: a
5059
+ t: i
4963
5060
  }
4964
5061
  );
4965
5062
  default: {
4966
- const g = p;
4967
- return g.eventType === "Error" && "message" in g ? /* @__PURE__ */ o(N, { message: g.message }) : (console.warn(
5063
+ const p = g;
5064
+ return p.eventType === "Error" && "message" in p ? /* @__PURE__ */ o(N, { message: p.message }) : (console.warn(
4968
5065
  "[fency] Unknown MemorySearch eventType (no UI):",
4969
- g.eventType,
4970
- g
5066
+ p.eventType,
5067
+ p
4971
5068
  ), null);
4972
5069
  }
4973
5070
  }
4974
- return p.taskType === "StreamingChatCompletion" && p.eventType === "Completed" ? null : p.eventType === "Error" && "message" in p ? /* @__PURE__ */ o(N, { message: p.message }) : null;
5071
+ return g.taskType === "StreamingChatCompletion" && g.eventType === "Completed" ? null : g.eventType === "Error" && "message" in g ? /* @__PURE__ */ o(N, { message: g.message }) : null;
4975
5072
  };
4976
5073
  if (e.length === 0)
4977
5074
  return n ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(N, { message: n.message }) }) : t ? /* @__PURE__ */ o("div", { style: { width: "fit-content", paddingBlock: "16px" }, children: /* @__PURE__ */ o(
4978
5075
  F,
4979
5076
  {
4980
- text: r ?? a.processingYourTask,
5077
+ text: r ?? i.processingYourTask,
4981
5078
  duration: 1.5,
4982
5079
  repeat: !0,
4983
5080
  repeatDelay: 0,
@@ -4985,22 +5082,20 @@ const Pt = ({
4985
5082
  shimmerColor: u.shimmerHighlight
4986
5083
  }
4987
5084
  ) }) : null;
4988
- const k = e.filter((y, p) => {
4989
- const g = y.item.data;
4990
- return g.taskType === "MemoryChat" && g.eventType === "ExploreMemories" ? !e.slice(p + 1).some(
4991
- (v) => v.item.data.taskType === "MemoryChat" && v.item.data.eventType === "ExploreMemories"
4992
- ) : g.taskType === "MemorySearch" && g.eventType === "GeneratingQueries" ? !e.slice(p + 1).some(
4993
- (v) => v.item.data.taskType === "MemorySearch" && v.item.data.eventType === "GeneratingQueries"
4994
- ) : g.taskType === "MemorySearch" && g.eventType === "ExploreQueries" ? !e.slice(p + 1).some(
4995
- (v) => v.item.data.taskType === "MemorySearch" && v.item.data.eventType === "ExploreQueries"
4996
- ) : g.taskType === "MemoryChat" && g.eventType === "ChunkResults" ? !e.slice(p + 1).some(
4997
- (v) => v.item.data.taskType === "MemoryChat" && v.item.data.eventType === "ChunkResults"
4998
- ) : g.taskType === "MemoryChat" && g.eventType === "GoogleSearch" ? !e.slice(p + 1).some(
4999
- (v) => v.item.data.taskType === "MemoryChat" && v.item.data.eventType === "GoogleSearch"
5000
- ) : g.taskType === "MemoryChat" && g.eventType === "Thinking" ? !e.slice(p + 1).some(
5001
- (v) => v.item.data.taskType === "MemoryChat" && v.item.data.eventType === "Thinking"
5002
- ) : g.taskType === "MemoryChat" && g.eventType === "ScrapeWebsites" ? !e.slice(p + 1).some(
5003
- (v) => v.item.data.taskType === "MemoryChat" && v.item.data.eventType === "ScrapeWebsites"
5085
+ const k = e.filter((y, g) => {
5086
+ const p = y.item.data;
5087
+ return p.taskType === "MemoryChat" && p.eventType === "ExploreMemories" ? !e.slice(g + 1).some(
5088
+ (w) => w.item.data.taskType === "MemoryChat" && w.item.data.eventType === "ExploreMemories"
5089
+ ) : p.taskType === "MemorySearch" && p.eventType === "GeneratingQueries" ? !e.slice(g + 1).some(
5090
+ (w) => w.item.data.taskType === "MemorySearch" && w.item.data.eventType === "GeneratingQueries"
5091
+ ) : p.taskType === "MemorySearch" && p.eventType === "ExploreQueries" ? !e.slice(g + 1).some(
5092
+ (w) => w.item.data.taskType === "MemorySearch" && w.item.data.eventType === "ExploreQueries"
5093
+ ) : p.taskType === "MemoryChat" && p.eventType === "GoogleSearch" ? !e.slice(g + 1).some(
5094
+ (w) => w.item.data.taskType === "MemoryChat" && w.item.data.eventType === "GoogleSearch"
5095
+ ) : p.taskType === "MemoryChat" && p.eventType === "Thinking" ? !e.slice(g + 1).some(
5096
+ (w) => w.item.data.taskType === "MemoryChat" && w.item.data.eventType === "Thinking"
5097
+ ) : p.taskType === "MemoryChat" && p.eventType === "ScrapeWebsites" ? !e.slice(g + 1).some(
5098
+ (w) => w.item.data.taskType === "MemoryChat" && w.item.data.eventType === "ScrapeWebsites"
5004
5099
  ) : !0;
5005
5100
  });
5006
5101
  return /* @__PURE__ */ f(
@@ -5010,7 +5105,7 @@ const Pt = ({
5010
5105
  ref: l,
5011
5106
  "data-theme": d,
5012
5107
  children: [
5013
- /* @__PURE__ */ o(Pe, { children: k.map((y, p) => /* @__PURE__ */ o(
5108
+ /* @__PURE__ */ o(De, { children: k.map((y, g) => /* @__PURE__ */ o(
5014
5109
  M.div,
5015
5110
  {
5016
5111
  id: `agent-task-progress-item-${y.item.progressItemId}`,
@@ -5018,14 +5113,14 @@ const Pt = ({
5018
5113
  animate: { opacity: 1, y: 0 },
5019
5114
  transition: {
5020
5115
  duration: 0.4,
5021
- delay: p * 0.1,
5116
+ delay: g * 0.1,
5022
5117
  ease: "easeOut"
5023
5118
  },
5024
5119
  children: /* @__PURE__ */ o(
5025
- At,
5120
+ Dt,
5026
5121
  {
5027
5122
  progressItemId: y.item.progressItemId,
5028
- children: h(y)
5123
+ children: m(y)
5029
5124
  }
5030
5125
  )
5031
5126
  },
@@ -5035,17 +5130,17 @@ const Pt = ({
5035
5130
  ]
5036
5131
  }
5037
5132
  );
5038
- }, Ut = ({
5133
+ }, Qt = ({
5039
5134
  agentTask: e,
5040
5135
  theme: t = "light",
5041
5136
  language: n,
5042
5137
  onSourceClick: r,
5043
- onSearchResultClick: a,
5138
+ onSearchResultClick: i,
5044
5139
  onExploreQueryResultClick: c
5045
5140
  }) => {
5046
- const s = wr(e), m = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : n ?? "en", d = Pr(m);
5047
- return /* @__PURE__ */ o(Rr, { theme: t, children: /* @__PURE__ */ o(
5048
- Pt,
5141
+ const s = Rr(e), h = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : n ?? "en", d = Lr(h);
5142
+ return /* @__PURE__ */ o(Pr, { theme: t, children: /* @__PURE__ */ o(
5143
+ Lt,
5049
5144
  {
5050
5145
  progressViewItems: s,
5051
5146
  loading: e.loading,
@@ -5053,22 +5148,22 @@ const Pt = ({
5053
5148
  loadingText: e.loadingText,
5054
5149
  t: d,
5055
5150
  onSourceClick: r,
5056
- onSearchResultClick: a,
5151
+ onSearchResultClick: i,
5057
5152
  onExploreQueryResultClick: c
5058
5153
  }
5059
5154
  ) });
5060
5155
  };
5061
5156
  export {
5062
- Ut as AgentTaskProgress,
5063
- Rr as AgentTaskThemeProvider,
5064
- D as Checkmark,
5065
- $t as FencyProvider,
5066
- Ft as MemorySearchCompletedResults,
5067
- _e as StreamEventManager,
5157
+ Qt as AgentTaskProgress,
5158
+ Pr as AgentTaskThemeProvider,
5159
+ L as Checkmark,
5160
+ Gt as FencyProvider,
5161
+ zt as MemorySearchCompletedResults,
5162
+ Qe as StreamEventManager,
5068
5163
  $ as XMark,
5069
- Er as darkAgentTaskThemeColors,
5070
- xe as getAgentTaskPrismStyle,
5071
- be as lightAgentTaskThemeColors,
5164
+ Br as darkAgentTaskThemeColors,
5165
+ Te as getAgentTaskPrismStyle,
5166
+ Se as lightAgentTaskThemeColors,
5072
5167
  T as useAgentTaskTheme,
5073
- Ht as useAgentTasks
5168
+ qt as useAgentTasks
5074
5169
  };