@fencyai/react 0.1.164 → 0.1.166

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,29 +1,29 @@
1
- import { jsxs as g, jsx as i, Fragment as I } from "react/jsx-runtime";
2
- import { createStream as ae, isStreamTimeoutEvent as se, isStreamNotFoundEvent as le, isAgentTaskProgressItemUpdatedEvent as ce, createAgentTask as de } from "@fencyai/js";
3
- import { createContext as me, useState as v, useRef as F, useEffect as A, useCallback as G, useContext as ue, useMemo as D } from "react";
4
- import { useInView as ye, motion as b, AnimatePresence as J } from "motion/react";
1
+ import { jsxs as p, jsx as o, Fragment as E } from "react/jsx-runtime";
2
+ import { createStream as se, isStreamTimeoutEvent as le, isStreamNotFoundEvent as ce, isAgentTaskProgressItemUpdatedEvent as de, createAgentTask as me } from "@fencyai/js";
3
+ import { createContext as ue, useState as v, useRef as R, useEffect as A, useCallback as W, useContext as ye, useMemo as P } from "react";
4
+ import { useInView as pe, motion as b, AnimatePresence as re } from "motion/react";
5
5
  import ge from "react-markdown";
6
- import { Prism as Y } from "react-syntax-highlighter";
7
- import pe from "remark-gfm";
8
- import './assets/index.css';const Z = me(
6
+ import { Prism as ne } from "react-syntax-highlighter";
7
+ import he from "remark-gfm";
8
+ import './assets/index.css';const te = ue(
9
9
  void 0
10
10
  );
11
- async function he(e, r) {
11
+ async function fe(e, r) {
12
12
  const t = e.getReader();
13
13
  let n;
14
14
  for (; !(n = await t.read()).done; )
15
15
  r(n.value);
16
16
  }
17
- function fe(e) {
17
+ function xe(e) {
18
18
  let r, t, n, l = !1;
19
19
  return function(s) {
20
- r === void 0 ? (r = s, t = 0, n = -1) : r = xe(r, s);
20
+ r === void 0 ? (r = s, t = 0, n = -1) : r = Te(r, s);
21
21
  const d = r.length;
22
22
  let m = 0;
23
23
  for (; t < d; ) {
24
24
  l && (r[t] === 10 && (m = ++t), l = !1);
25
- let o = -1;
26
- for (; t < d && o === -1; ++t)
25
+ let i = -1;
26
+ for (; t < d && i === -1; ++t)
27
27
  switch (r[t]) {
28
28
  case 58:
29
29
  n === -1 && (n = t - m);
@@ -31,24 +31,24 @@ function fe(e) {
31
31
  case 13:
32
32
  l = !0;
33
33
  case 10:
34
- o = t;
34
+ i = t;
35
35
  break;
36
36
  }
37
- if (o === -1)
37
+ if (i === -1)
38
38
  break;
39
- e(r.subarray(m, o), n), m = t, n = -1;
39
+ e(r.subarray(m, i), n), m = t, n = -1;
40
40
  }
41
41
  m === d ? r = void 0 : m !== 0 && (r = r.subarray(m), t -= m);
42
42
  };
43
43
  }
44
44
  function Se(e, r, t) {
45
- let n = j();
45
+ let n = X();
46
46
  const l = new TextDecoder();
47
47
  return function(s, d) {
48
48
  if (s.length === 0)
49
- t == null || t(n), n = j();
49
+ t == null || t(n), n = X();
50
50
  else if (d > 0) {
51
- const m = l.decode(s.subarray(0, d)), o = d + (s[d + 1] === 32 ? 2 : 1), a = l.decode(s.subarray(o));
51
+ const m = l.decode(s.subarray(0, d)), i = d + (s[d + 1] === 32 ? 2 : 1), a = l.decode(s.subarray(i));
52
52
  switch (m) {
53
53
  case "data":
54
54
  n.data = n.data ? n.data + `
@@ -61,18 +61,18 @@ function Se(e, r, t) {
61
61
  e(n.id = a);
62
62
  break;
63
63
  case "retry":
64
- const u = parseInt(a, 10);
65
- isNaN(u) || r(n.retry = u);
64
+ const y = parseInt(a, 10);
65
+ isNaN(y) || r(n.retry = y);
66
66
  break;
67
67
  }
68
68
  }
69
69
  };
70
70
  }
71
- function xe(e, r) {
71
+ function Te(e, r) {
72
72
  const t = new Uint8Array(e.length + r.length);
73
73
  return t.set(e), t.set(r, e.length), t;
74
74
  }
75
- function j() {
75
+ function X() {
76
76
  return {
77
77
  data: "",
78
78
  event: "",
@@ -80,7 +80,7 @@ function j() {
80
80
  retry: void 0
81
81
  };
82
82
  }
83
- var Te = function(e, r) {
83
+ var ke = function(e, r) {
84
84
  var t = {};
85
85
  for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
86
86
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
@@ -88,63 +88,63 @@ var Te = function(e, r) {
88
88
  r.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[l]) && (t[n[l]] = e[n[l]]);
89
89
  return t;
90
90
  };
91
- const _ = "text/event-stream", ke = 1e3, q = "last-event-id";
92
- function be(e, r) {
93
- var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: o } = r, a = Te(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
- return new Promise((u, y) => {
95
- const f = Object.assign({}, n);
96
- f.accept || (f.accept = _);
97
- let p;
98
- function x() {
99
- p.abort(), document.hidden || R();
100
- }
101
- m || document.addEventListener("visibilitychange", x);
102
- let h = ke, S = 0;
91
+ const G = "text/event-stream", be = 1e3, J = "last-event-id";
92
+ function ve(e, r) {
93
+ var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: i } = r, a = ke(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
+ return new Promise((y, u) => {
95
+ const h = Object.assign({}, n);
96
+ h.accept || (h.accept = G);
97
+ let g;
103
98
  function k() {
104
- document.removeEventListener("visibilitychange", x), window.clearTimeout(S), p.abort();
99
+ g.abort(), document.hidden || F();
100
+ }
101
+ m || document.addEventListener("visibilitychange", k);
102
+ let x = be, f = 0;
103
+ function T() {
104
+ document.removeEventListener("visibilitychange", k), window.clearTimeout(f), g.abort();
105
105
  }
106
106
  t == null || t.addEventListener("abort", () => {
107
- k(), u();
107
+ T(), y();
108
108
  });
109
- const C = o ?? window.fetch, E = l ?? ve;
110
- async function R() {
111
- var L;
112
- p = new AbortController();
109
+ const C = i ?? window.fetch, w = l ?? Ce;
110
+ async function F() {
111
+ var z;
112
+ g = new AbortController();
113
113
  try {
114
- const P = await C(e, Object.assign(Object.assign({}, a), { headers: f, signal: p.signal }));
115
- await E(P), await he(P.body, fe(Se((M) => {
116
- M ? f[q] = M : delete f[q];
114
+ const D = await C(e, Object.assign(Object.assign({}, a), { headers: h, signal: g.signal }));
115
+ await w(D), await fe(D.body, xe(Se((M) => {
116
+ M ? h[J] = M : delete h[J];
117
117
  }, (M) => {
118
- h = M;
119
- }, c))), s == null || s(), k(), u();
120
- } catch (P) {
121
- if (!p.signal.aborted)
118
+ x = M;
119
+ }, c))), s == null || s(), T(), y();
120
+ } catch (D) {
121
+ if (!g.signal.aborted)
122
122
  try {
123
- const M = (L = d == null ? void 0 : d(P)) !== null && L !== void 0 ? L : h;
124
- window.clearTimeout(S), S = window.setTimeout(R, M);
123
+ const M = (z = d == null ? void 0 : d(D)) !== null && z !== void 0 ? z : x;
124
+ window.clearTimeout(f), f = window.setTimeout(F, M);
125
125
  } catch (M) {
126
- k(), y(M);
126
+ T(), u(M);
127
127
  }
128
128
  }
129
129
  }
130
- R();
130
+ F();
131
131
  });
132
132
  }
133
- function ve(e) {
133
+ function Ce(e) {
134
134
  const r = e.headers.get("content-type");
135
- if (!(r != null && r.startsWith(_)))
136
- throw new Error(`Expected content-type to be ${_}, Actual: ${r}`);
135
+ if (!(r != null && r.startsWith(G)))
136
+ throw new Error(`Expected content-type to be ${G}, Actual: ${r}`);
137
137
  }
138
- function Ce(e) {
138
+ function we(e) {
139
139
  const r = atob(e), t = new Uint8Array(r.length);
140
140
  for (let n = 0; n < r.length; n++)
141
141
  t[n] = r.charCodeAt(n);
142
142
  return new TextDecoder("utf-8").decode(t);
143
143
  }
144
- function Ee(e) {
144
+ function Ie(e) {
145
145
  return e instanceof Error ? e.message : typeof e == "string" ? e : "Unknown stream error";
146
146
  }
147
- class we {
147
+ class Ee {
148
148
  constructor(r) {
149
149
  this.eventSources = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.fency = r;
150
150
  }
@@ -169,7 +169,7 @@ class we {
169
169
  "X-Fency-Publishable-Key": this.fency.publishableKey,
170
170
  "X-Fency-Stream-Token": r.stream.token
171
171
  };
172
- be(l, {
172
+ ve(l, {
173
173
  headers: c,
174
174
  signal: n.signal,
175
175
  onopen: async (s) => {
@@ -178,12 +178,12 @@ class we {
178
178
  },
179
179
  onmessage: (s) => {
180
180
  if (s.data) {
181
- const d = Ce(s.data);
181
+ const d = we(s.data);
182
182
  this.broadcast(d, t);
183
183
  }
184
184
  },
185
185
  onerror: (s) => {
186
- throw console.error("EventSource error for stream", t, ":", s), this.eventSources.delete(t), this.broadcastError(t, Ee(s)), s;
186
+ throw console.error("EventSource error for stream", t, ":", s), this.eventSources.delete(t), this.broadcastError(t, Ie(s)), s;
187
187
  },
188
188
  onclose() {
189
189
  }
@@ -215,107 +215,107 @@ class we {
215
215
  this.eventSources.forEach((r) => r.abort()), this.eventSources.clear(), this.subscribers.clear();
216
216
  }
217
217
  }
218
- const Ie = 48e4, Me = 3e5, K = (e) => {
218
+ const Me = 48e4, Ae = 3e5, Y = (e) => {
219
219
  const r = Date.now();
220
- return e.filter((t) => r - t.createdAt < Ie);
220
+ return e.filter((t) => r - t.createdAt < Me);
221
221
  };
222
- function Ar({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
222
+ function Dr({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
223
223
  const [n, l] = v(
224
224
  null
225
- ), [c, s] = v(!0), [d, m] = v(null), [o, a] = v([]), u = F(null), y = F(null);
225
+ ), [c, s] = v(!0), [d, m] = v(null), [i, a] = v([]), y = R(null), u = R(null);
226
226
  A(() => {
227
- e.then((h) => {
228
- l(h), s(!1);
229
- }).catch((h) => {
230
- m(h), s(!1);
227
+ e.then((x) => {
228
+ l(x), s(!1);
229
+ }).catch((x) => {
230
+ m(x), s(!1);
231
231
  });
232
232
  }, [e]), A(() => {
233
- n && !y.current && (y.current = new we(n));
233
+ n && !u.current && (u.current = new Ee(n));
234
234
  }, [n]), A(() => {
235
- y.current && y.current.updateStreams(o);
236
- }, [o]), A(() => () => {
237
- var h;
238
- (h = y.current) == null || h.cleanup();
235
+ u.current && u.current.updateStreams(i);
236
+ }, [i]), A(() => () => {
237
+ var x;
238
+ (x = u.current) == null || x.cleanup();
239
239
  }, []), A(() => {
240
- const h = setInterval(() => {
241
- a((S) => {
242
- const k = K(S);
243
- return k.length !== S.length ? k : S;
240
+ const x = setInterval(() => {
241
+ a((f) => {
242
+ const T = Y(f);
243
+ return T.length !== f.length ? T : f;
244
244
  });
245
245
  }, 6e4);
246
- return () => clearInterval(h);
246
+ return () => clearInterval(x);
247
247
  }, []);
248
- const f = G(
249
- async (h = Me) => {
250
- if (u.current)
251
- return u.current;
252
- const S = Date.now(), k = o.length > 0 ? o[o.length - 1] : null;
253
- if (k && S - k.createdAt < h)
254
- return k.stream;
248
+ const h = W(
249
+ async (x = Ae) => {
250
+ if (y.current)
251
+ return y.current;
252
+ const f = Date.now(), T = i.length > 0 ? i[i.length - 1] : null;
253
+ if (T && f - T.createdAt < x)
254
+ return T.stream;
255
255
  const C = (async () => {
256
256
  if (!n)
257
257
  throw new Error("Fency instance not initialized");
258
- const E = await r(), R = await ae({
258
+ const w = await r(), F = await se({
259
259
  pk: n.publishableKey,
260
260
  baseUrl: n.baseUrl,
261
- clientToken: (E == null ? void 0 : E.clientToken) ?? ""
261
+ clientToken: (w == null ? void 0 : w.clientToken) ?? ""
262
262
  });
263
- if (R.type === "success") {
264
- const L = {
265
- stream: R.stream,
263
+ if (F.type === "success") {
264
+ const z = {
265
+ stream: F.stream,
266
266
  createdAt: Date.now()
267
267
  };
268
- return a((P) => {
269
- const M = [...P, L];
270
- return K(M);
271
- }), u.current = null, R.stream;
268
+ return a((D) => {
269
+ const M = [...D, z];
270
+ return Y(M);
271
+ }), y.current = null, F.stream;
272
272
  } else
273
- throw u.current = null, new Error("Failed to create stream");
273
+ throw y.current = null, new Error("Failed to create stream");
274
274
  })();
275
- return u.current = C, C;
275
+ return y.current = C, C;
276
276
  },
277
- [n, o]
277
+ [n, i]
278
278
  );
279
279
  if (d)
280
- return /* @__PURE__ */ g("div", { children: [
280
+ return /* @__PURE__ */ p("div", { children: [
281
281
  "Fency error: ",
282
282
  d.message
283
283
  ] });
284
284
  if (!n)
285
285
  return null;
286
- const p = o.length > 0 ? o[o.length - 1] : null, x = {
286
+ const g = i.length > 0 ? i[i.length - 1] : null, k = {
287
287
  fency: n,
288
288
  loading: c,
289
289
  error: d,
290
- activeStreams: o,
291
- latestStream: p,
292
- eventManager: y.current,
293
- getOrCreateStream: f
290
+ activeStreams: i,
291
+ latestStream: g,
292
+ eventManager: u.current,
293
+ getOrCreateStream: h
294
294
  };
295
- return /* @__PURE__ */ i(Z.Provider, { value: x, children: t });
295
+ return /* @__PURE__ */ o(te.Provider, { value: k, children: t });
296
296
  }
297
- function ee() {
298
- const e = ue(Z);
297
+ function oe() {
298
+ const e = ye(te);
299
299
  if (e === void 0)
300
300
  throw new Error("useFencyContext must be used within a FencyProvider");
301
301
  return e;
302
302
  }
303
- const Ae = (e) => {
303
+ const Re = (e) => {
304
304
  try {
305
305
  const r = JSON.parse(e);
306
306
  return Fe(r);
307
307
  } catch (r) {
308
308
  return console.error("Error parsing message:", r), null;
309
309
  }
310
- }, Fe = (e) => se(e) ? Re(e) : le(e) ? Pe(e) : ce(e) ? De(e) : null, Re = (e) => ({
310
+ }, Fe = (e) => le(e) ? Pe(e) : ce(e) ? De(e) : de(e) ? Le(e) : null, Pe = (e) => ({
311
311
  type: "STREAM_TIMEOUT",
312
312
  streamId: e.streamId,
313
313
  timestamp: e.timestamp
314
- }), Pe = (e) => ({
314
+ }), De = (e) => ({
315
315
  type: "STREAM_NOT_FOUND",
316
316
  streamId: e.streamId,
317
317
  timestamp: e.timestamp
318
- }), De = (e) => ({
318
+ }), Le = (e) => ({
319
319
  type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
320
320
  streamId: e.streamId,
321
321
  agentTaskId: e.agentTaskId,
@@ -323,34 +323,34 @@ const Ae = (e) => {
323
323
  timestamp: e.timestamp,
324
324
  createdAt: e.createdAt,
325
325
  data: JSON.parse(e.data)
326
- }), Le = (e) => {
327
- const r = ee(), [t, n] = v(null), l = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
326
+ }), ze = (e) => {
327
+ const r = oe(), [t, n] = v(null), l = R(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
328
328
  return A(() => {
329
329
  if (!r.eventManager) return;
330
330
  const s = {
331
- onMessage: (m, o) => {
332
- var u, y, f;
333
- const a = Ae(m);
331
+ onMessage: (m, i) => {
332
+ var y, u, h;
333
+ const a = Re(m);
334
334
  if (a)
335
335
  switch (a.type) {
336
336
  case "STREAM_TIMEOUT":
337
- (u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, a);
337
+ (y = e == null ? void 0 : e.onStreamTimeout) == null || y.call(e, a);
338
338
  break;
339
339
  case "STREAM_NOT_FOUND":
340
- (y = e == null ? void 0 : e.onStreamNotFound) == null || y.call(e, a);
340
+ (u = e == null ? void 0 : e.onStreamNotFound) == null || u.call(e, a);
341
341
  break;
342
342
  case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
343
- (f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, a);
343
+ (h = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || h.call(e, a);
344
344
  break;
345
345
  }
346
346
  },
347
- onError: (m, o) => {
347
+ onError: (m, i) => {
348
348
  var a;
349
349
  (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, {
350
350
  streamId: m,
351
351
  error: {
352
352
  code: "UnknownError",
353
- message: o ?? "Unknown error in useStream"
353
+ message: i ?? "Unknown error in useStream"
354
354
  }
355
355
  });
356
356
  }
@@ -379,165 +379,165 @@ const Ae = (e) => {
379
379
  },
380
380
  stream: t
381
381
  };
382
- }, Fr = (e) => {
383
- const r = ee(), [t, n] = v([]), l = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), { createStream: s } = Le({
384
- onAgentTaskProgressItemUpdated: (o) => {
385
- var y;
386
- if (!l.current.has(o.agentTaskId)) return;
387
- const a = o.data;
382
+ }, Lr = (e) => {
383
+ const r = oe(), [t, n] = v([]), l = R(/* @__PURE__ */ new Set()), c = R(/* @__PURE__ */ new Map()), { createStream: s } = ze({
384
+ onAgentTaskProgressItemUpdated: (i) => {
385
+ var u;
386
+ if (!l.current.has(i.agentTaskId)) return;
387
+ const a = i.data;
388
388
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed" || a.taskType === "MemoryChat" && a.eventType === "Completed" || a.taskType === "MemorySearch" && a.eventType === "Completed") {
389
- const f = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
389
+ const h = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
390
390
  n(
391
- f ? (x) => x.map((h) => {
391
+ h ? (k) => k.map((x) => {
392
392
  var C;
393
- if (((C = h.confirmedData) == null ? void 0 : C.taskId) !== o.agentTaskId)
394
- return h;
395
- const k = h.progressItems.some(
396
- (E) => E.progressItemId === o.progressItemId
397
- ) ? h.progressItems.map(
398
- (E) => E.progressItemId === o.progressItemId ? o : E
399
- ) : [...h.progressItems, o];
393
+ if (((C = x.confirmedData) == null ? void 0 : C.taskId) !== i.agentTaskId)
394
+ return x;
395
+ const T = x.progressItems.some(
396
+ (w) => w.progressItemId === i.progressItemId
397
+ ) ? x.progressItems.map(
398
+ (w) => w.progressItemId === i.progressItemId ? i : w
399
+ ) : [...x.progressItems, i];
400
400
  return {
401
- ...h,
402
- progressItems: k,
401
+ ...x,
402
+ progressItems: T,
403
403
  loading: !1
404
404
  };
405
- }) : (x) => x.map(
406
- (h) => {
407
- var S;
408
- return ((S = h.confirmedData) == null ? void 0 : S.taskId) === o.agentTaskId ? { ...h, loading: !1 } : h;
405
+ }) : (k) => k.map(
406
+ (x) => {
407
+ var f;
408
+ return ((f = x.confirmedData) == null ? void 0 : f.taskId) === i.agentTaskId ? { ...x, loading: !1 } : x;
409
409
  }
410
410
  )
411
411
  );
412
- const p = c.current.get(
413
- o.agentTaskId
412
+ const g = c.current.get(
413
+ i.agentTaskId
414
414
  );
415
- p && (c.current.delete(o.agentTaskId), p(a));
415
+ g && (c.current.delete(i.agentTaskId), g(a));
416
416
  return;
417
417
  }
418
- (y = e.onAgentTaskProgressItemUpdated) == null || y.call(e, o), n(
419
- (f) => f.map((p) => {
420
- var S;
421
- if (((S = p.confirmedData) == null ? void 0 : S.taskId) !== o.agentTaskId)
422
- return p;
423
- const h = p.progressItems.some(
424
- (k) => k.progressItemId === o.progressItemId
425
- ) ? p.progressItems.map(
426
- (k) => k.progressItemId === o.progressItemId ? o : k
427
- ) : [...p.progressItems, o];
428
- return { ...p, progressItems: h };
418
+ (u = e.onAgentTaskProgressItemUpdated) == null || u.call(e, i), n(
419
+ (h) => h.map((g) => {
420
+ var f;
421
+ if (((f = g.confirmedData) == null ? void 0 : f.taskId) !== i.agentTaskId)
422
+ return g;
423
+ const x = g.progressItems.some(
424
+ (T) => T.progressItemId === i.progressItemId
425
+ ) ? g.progressItems.map(
426
+ (T) => T.progressItemId === i.progressItemId ? i : T
427
+ ) : [...g.progressItems, i];
428
+ return { ...g, progressItems: x };
429
429
  })
430
430
  );
431
431
  },
432
- onStreamError: (o) => {
432
+ onStreamError: (i) => {
433
433
  var a;
434
- (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), n(
435
- (u) => u.map((y) => y.streamId !== o.streamId || !y.loading ? y : { ...y, loading: !1, error: o.error })
434
+ (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, i), n(
435
+ (y) => y.map((u) => u.streamId !== i.streamId || !u.loading ? u : { ...u, loading: !1, error: i.error })
436
436
  );
437
437
  },
438
- onStreamNotFound: (o) => {
438
+ onStreamNotFound: (i) => {
439
439
  var a;
440
- (a = e == null ? void 0 : e.onStreamNotFound) == null || a.call(e, o);
440
+ (a = e == null ? void 0 : e.onStreamNotFound) == null || a.call(e, i);
441
441
  },
442
- onStreamTimeout: (o) => {
442
+ onStreamTimeout: (i) => {
443
443
  var a;
444
- (a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, o);
444
+ (a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, i);
445
445
  }
446
- }), d = G(
447
- async (o, a) => {
448
- var f;
449
- const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, y = await s();
450
- if (y.type === "success") {
451
- const p = (/* @__PURE__ */ new Date()).toISOString(), x = {
452
- taskKey: u,
453
- streamId: y.stream.id,
454
- triggeredAt: p,
446
+ }), d = W(
447
+ async (i, a) => {
448
+ var h;
449
+ const y = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, u = await s();
450
+ if (u.type === "success") {
451
+ const g = (/* @__PURE__ */ new Date()).toISOString(), k = {
452
+ taskKey: y,
453
+ streamId: u.stream.id,
454
+ triggeredAt: g,
455
455
  confirmedData: null,
456
456
  error: null,
457
- params: o,
457
+ params: i,
458
458
  progressItems: [],
459
459
  loading: !0,
460
460
  loadingText: a == null ? void 0 : a.loadingText
461
461
  };
462
- n((k) => [...k, x]), (f = a == null ? void 0 : a.onTaskRegistered) == null || f.call(a, x);
463
- const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(o.type), S = await de({
462
+ n((T) => [...T, k]), (h = a == null ? void 0 : a.onTaskRegistered) == null || h.call(a, k);
463
+ const { clientToken: x } = await e.fetchCreateAgentTaskClientToken(i.type), f = await me({
464
464
  pk: r.fency.publishableKey,
465
465
  baseUrl: r.fency.baseUrl,
466
- clientToken: h,
467
- streamToken: y.stream.token,
466
+ clientToken: x,
467
+ streamToken: u.stream.token,
468
468
  request: {
469
- streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
470
- messages: o.messages,
471
- model: o.model
469
+ streamingChatCompletionTask: i.type === "StreamingChatCompletion" ? {
470
+ messages: i.messages,
471
+ model: i.model
472
472
  } : void 0,
473
- structuredChatCompletionTask: o.type === "StructuredChatCompletion" ? {
474
- messages: o.messages,
475
- jsonSchema: o.jsonSchema,
476
- model: o.model
473
+ structuredChatCompletionTask: i.type === "StructuredChatCompletion" ? {
474
+ messages: i.messages,
475
+ jsonSchema: i.jsonSchema,
476
+ model: i.model
477
477
  } : void 0,
478
- memoryChatTask: o.type === "MemoryChat" ? {
479
- messages: o.messages,
480
- model: o.model,
481
- language: o.language ?? "en",
482
- chunkLimit: o.chunkLimit ?? 10,
483
- memoryScanLimit: o.memoryScanLimit ?? 3
478
+ memoryChatTask: i.type === "MemoryChat" ? {
479
+ messages: i.messages,
480
+ model: i.model,
481
+ language: i.language ?? "en",
482
+ chunkLimit: i.chunkLimit ?? 10,
483
+ memoryScanLimit: i.memoryScanLimit ?? 3
484
484
  } : void 0,
485
- memorySearchTask: o.type === "MemorySearch" ? {
486
- query: o.query,
487
- model: o.model,
488
- language: o.language ?? "en",
489
- chunkLimit: o.chunkLimit ?? 10,
490
- contextExpansion: o.contextExpansion,
491
- ...o.queryExpansion != null ? {
492
- queryExpansion: o.queryExpansion
485
+ memorySearchTask: i.type === "MemorySearch" ? {
486
+ query: i.query,
487
+ model: i.model,
488
+ language: i.language ?? "en",
489
+ chunkLimit: i.chunkLimit ?? 10,
490
+ contextExpansion: i.contextExpansion,
491
+ ...i.queryExpansion != null ? {
492
+ queryExpansion: i.queryExpansion
493
493
  } : {}
494
494
  } : void 0
495
495
  }
496
496
  });
497
- if (S.type === "success" && S.agentTask) {
497
+ if (f.type === "success" && f.agentTask) {
498
498
  l.current.add(
499
- S.agentTask.id
499
+ f.agentTask.id
500
500
  ), n((C) => [
501
- ...C.filter((E) => E.taskKey !== u),
501
+ ...C.filter((w) => w.taskKey !== y),
502
502
  {
503
- taskKey: u,
504
- streamId: y.stream.id,
503
+ taskKey: y,
504
+ streamId: u.stream.id,
505
505
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
506
- taskId: S.agentTask.id,
507
- createdAt: S.agentTask.createdAt,
506
+ taskId: f.agentTask.id,
507
+ createdAt: f.agentTask.createdAt,
508
508
  error: null,
509
- params: o,
509
+ params: i,
510
510
  progressItems: [],
511
511
  loading: !0,
512
512
  loadingText: a == null ? void 0 : a.loadingText,
513
513
  confirmedData: {
514
- taskId: S.agentTask.id,
515
- createdAt: S.agentTask.createdAt
514
+ taskId: f.agentTask.id,
515
+ createdAt: f.agentTask.createdAt
516
516
  }
517
517
  }
518
518
  ]);
519
- const k = await new Promise((C) => {
519
+ const T = await new Promise((C) => {
520
520
  c.current.set(
521
- S.agentTask.id,
521
+ f.agentTask.id,
522
522
  C
523
523
  );
524
524
  });
525
525
  return {
526
526
  type: "success",
527
- streamId: y.stream.id,
528
- agentTaskId: S.agentTask.id,
529
- response: k
527
+ streamId: u.stream.id,
528
+ agentTaskId: f.agentTask.id,
529
+ response: T
530
530
  };
531
531
  } else {
532
- if (S.type === "error")
533
- return n((k) => [
534
- ...k.filter((C) => C.taskKey !== u),
532
+ if (f.type === "error")
533
+ return n((T) => [
534
+ ...T.filter((C) => C.taskKey !== y),
535
535
  {
536
- taskKey: u,
536
+ taskKey: y,
537
537
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
538
- streamId: y.stream.id,
539
- params: o,
540
- error: S.error,
538
+ streamId: u.stream.id,
539
+ params: i,
540
+ error: f.error,
541
541
  progressItems: [],
542
542
  loading: !1,
543
543
  loadingText: a == null ? void 0 : a.loadingText,
@@ -545,21 +545,21 @@ const Ae = (e) => {
545
545
  }
546
546
  ]), {
547
547
  type: "error",
548
- error: S.error
548
+ error: f.error
549
549
  };
550
550
  {
551
- const k = {
551
+ const T = {
552
552
  message: "No response received",
553
553
  code: "UnknownError"
554
554
  };
555
555
  return n((C) => [
556
- ...C.filter((E) => E.taskKey !== u),
556
+ ...C.filter((w) => w.taskKey !== y),
557
557
  {
558
- taskKey: u,
558
+ taskKey: y,
559
559
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
560
- streamId: y.stream.id,
561
- error: k,
562
- params: o,
560
+ streamId: u.stream.id,
561
+ error: T,
562
+ params: i,
563
563
  progressItems: [],
564
564
  loading: !1,
565
565
  loadingText: a == null ? void 0 : a.loadingText,
@@ -567,17 +567,17 @@ const Ae = (e) => {
567
567
  }
568
568
  ]), {
569
569
  type: "error",
570
- error: k
570
+ error: T
571
571
  };
572
572
  }
573
573
  }
574
574
  } else
575
- return console.error(y.error), y;
575
+ return console.error(u.error), u;
576
576
  },
577
577
  [r, s, e.fetchCreateAgentTaskClientToken]
578
- ), m = D(() => {
578
+ ), m = P(() => {
579
579
  if (t.length !== 0)
580
- return [...t].sort((o, a) => new Date(a.triggeredAt).getTime() - new Date(o.triggeredAt).getTime())[0];
580
+ return [...t].sort((i, a) => new Date(a.triggeredAt).getTime() - new Date(i.triggeredAt).getTime())[0];
581
581
  }, [t]);
582
582
  return A(() => () => {
583
583
  l.current.clear(), c.current.clear();
@@ -587,7 +587,7 @@ const Ae = (e) => {
587
587
  latest: m
588
588
  };
589
589
  };
590
- function ze(e) {
590
+ function Ne(e) {
591
591
  return e.progressItems.map((r, t) => {
592
592
  const n = e.progressItems[t + 1], l = n != null;
593
593
  let c;
@@ -603,7 +603,7 @@ function ze(e) {
603
603
  };
604
604
  });
605
605
  }
606
- function w({
606
+ function I({
607
607
  text: e,
608
608
  duration: r = 2,
609
609
  delay: t = 0,
@@ -613,16 +613,16 @@ function w({
613
613
  startOnView: s = !1,
614
614
  once: d = !1,
615
615
  inViewMargin: m,
616
- spread: o = 2,
616
+ spread: i = 2,
617
617
  color: a = "#999",
618
- shimmerColor: u = "#000",
619
- direction: y = "fromBottom"
618
+ shimmerColor: y = "#000",
619
+ direction: u = "fromBottom"
620
620
  }) {
621
- const f = F(null), p = ye(f, { once: d, margin: m }), x = D(() => e.length * o, [e, o]), h = !s || p, S = y === "fromBottom" ? "100% center" : "-100% center", k = y === "fromBottom" ? "0% center" : "200% center";
622
- return /* @__PURE__ */ i(
621
+ const h = R(null), g = pe(h, { once: d, margin: m }), k = P(() => e.length * i, [e, i]), x = !s || g, f = u === "fromBottom" ? "100% center" : "-100% center", T = u === "fromBottom" ? "0% center" : "200% center";
622
+ return /* @__PURE__ */ o(
623
623
  b.span,
624
624
  {
625
- ref: f,
625
+ ref: h,
626
626
  className: c,
627
627
  style: {
628
628
  position: "relative",
@@ -633,18 +633,18 @@ function w({
633
633
  color: "transparent",
634
634
  WebkitTextFillColor: "transparent",
635
635
  backgroundRepeat: "no-repeat, padding-box",
636
- "--spread": `${x}px`,
636
+ "--spread": `${k}px`,
637
637
  "--base-color": a,
638
- "--shimmer-color": u,
638
+ "--shimmer-color": y,
639
639
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
640
640
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
641
641
  },
642
642
  initial: {
643
- backgroundPosition: S,
643
+ backgroundPosition: f,
644
644
  opacity: 0
645
645
  },
646
- animate: h ? {
647
- backgroundPosition: k,
646
+ animate: x ? {
647
+ backgroundPosition: T,
648
648
  opacity: 1
649
649
  } : {},
650
650
  transition: {
@@ -701,33 +701,33 @@ function Oe(e, r) {
701
701
  return r.sourcesAdded;
702
702
  case "ExploreMemories":
703
703
  return e.completed ? r.memoriesExplored : r.exploringMemories;
704
- case "ChunkResult":
704
+ case "ChunkResults":
705
705
  return r.chunksRetrieved;
706
706
  case "Completed":
707
707
  return r.completed;
708
708
  }
709
709
  return r.processing;
710
710
  }
711
- const Ne = ({ progressViewItems: e, t: r }) => {
711
+ const Be = ({ progressViewItems: e, t: r }) => {
712
712
  const t = e[e.length - 1];
713
713
  if (!t) return null;
714
714
  const n = Oe(t, r);
715
- return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(J, { mode: "wait", children: /* @__PURE__ */ i(
715
+ return /* @__PURE__ */ o("div", { className: "simple-mode-container", children: /* @__PURE__ */ o(re, { mode: "wait", children: /* @__PURE__ */ o(
716
716
  b.div,
717
717
  {
718
718
  initial: { opacity: 0, y: 10 },
719
719
  animate: { opacity: 1, y: 0 },
720
720
  exit: { opacity: 0, y: -10 },
721
721
  transition: { duration: 0.3 },
722
- children: t.completed ? /* @__PURE__ */ i(
722
+ children: t.completed ? /* @__PURE__ */ o(
723
723
  "div",
724
724
  {
725
725
  className: "simple-mode-title",
726
726
  style: { color: "#666" },
727
727
  children: n
728
728
  }
729
- ) : /* @__PURE__ */ i(
730
- w,
729
+ ) : /* @__PURE__ */ o(
730
+ I,
731
731
  {
732
732
  text: n,
733
733
  className: "simple-mode-title",
@@ -740,7 +740,7 @@ const Ne = ({ progressViewItems: e, t: r }) => {
740
740
  },
741
741
  t.item.progressItemId
742
742
  ) }) });
743
- }, re = {
743
+ }, ie = {
744
744
  'code[class*="language-"]': {
745
745
  color: "#f8f8f2",
746
746
  background: "none",
@@ -891,57 +891,57 @@ const Ne = ({ progressViewItems: e, t: r }) => {
891
891
  italic: {
892
892
  fontStyle: "italic"
893
893
  }
894
- }, V = ({
894
+ }, Z = ({
895
895
  text: e
896
- }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
896
+ }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
897
897
  b.div,
898
898
  {
899
899
  className: "fency-markdown-body-raw",
900
900
  initial: { opacity: 0, y: -10 },
901
901
  animate: { opacity: 1, y: 0 },
902
902
  transition: { duration: 0.3, delay: 0 },
903
- children: /* @__PURE__ */ i(
903
+ children: /* @__PURE__ */ o(
904
904
  ge,
905
905
  {
906
- remarkPlugins: [pe],
906
+ remarkPlugins: [he],
907
907
  components: {
908
908
  code(r) {
909
909
  const { children: t, className: n, node: l, ref: c, ...s } = r, d = /language-(\w+)/.exec(n || "");
910
910
  return d ? (
911
911
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
912
- /* @__PURE__ */ i(
913
- Y,
912
+ /* @__PURE__ */ o(
913
+ ne,
914
914
  {
915
915
  ...s,
916
916
  PreTag: "div",
917
917
  children: String(t).replace(/\n$/, ""),
918
918
  language: d[1],
919
- style: re
919
+ style: ie
920
920
  }
921
921
  )
922
- ) : /* @__PURE__ */ i("code", { ...s, className: n, children: String(t) });
922
+ ) : /* @__PURE__ */ o("code", { ...s, className: n, children: String(t) });
923
923
  }
924
924
  },
925
925
  children: e
926
926
  }
927
927
  )
928
928
  }
929
- ) }), Be = ({ data: e }) => {
929
+ ) }), We = ({ data: e }) => {
930
930
  const r = JSON.stringify(
931
931
  JSON.parse(e.response.jsonResponse),
932
932
  null,
933
933
  2
934
934
  );
935
- return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
935
+ return /* @__PURE__ */ o("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ o(
936
936
  b.div,
937
937
  {
938
938
  initial: { opacity: 0, y: -10 },
939
939
  animate: { opacity: 1, y: 0 },
940
940
  transition: { duration: 0.3, delay: 0 },
941
- children: /* @__PURE__ */ i(Y, { language: "json", style: re, PreTag: "div", children: r })
941
+ children: /* @__PURE__ */ o(ne, { language: "json", style: ie, PreTag: "div", children: r })
942
942
  }
943
943
  ) });
944
- }, We = {
944
+ }, $e = {
945
945
  en: {
946
946
  error: "Error",
947
947
  streaming: "Streaming...",
@@ -999,7 +999,9 @@ const Ne = ({ progressViewItems: e, t: r }) => {
999
999
  memorySearchGeneratedQueriesHeading: "Generated queries",
1000
1000
  memorySearchViewExploreResults: "View results",
1001
1001
  memorySearchHideExploreResults: "Hide results",
1002
- memorySearchExploreNoResults: "No results found"
1002
+ memorySearchExploreNoResults: "No results found",
1003
+ memoryChatChunkResultsInMemories: "in {n} memories",
1004
+ memoryChatChunkResultsInOneMemory: "in 1 memory"
1003
1005
  },
1004
1006
  no: {
1005
1007
  error: "Feil",
@@ -1058,13 +1060,15 @@ const Ne = ({ progressViewItems: e, t: r }) => {
1058
1060
  memorySearchGeneratedQueriesHeading: "Genererte spørringer",
1059
1061
  memorySearchViewExploreResults: "Vis resultater",
1060
1062
  memorySearchHideExploreResults: "Skjul resultater",
1061
- memorySearchExploreNoResults: "Ingen resultater funnet"
1063
+ memorySearchExploreNoResults: "Ingen resultater funnet",
1064
+ memoryChatChunkResultsInMemories: "i {n} minner",
1065
+ memoryChatChunkResultsInOneMemory: "i 1 minne"
1062
1066
  }
1063
1067
  };
1064
- function $e(e) {
1065
- return We[e];
1068
+ function He(e) {
1069
+ return $e[e];
1066
1070
  }
1067
- function T(e, r) {
1071
+ function S(e, r) {
1068
1072
  return Object.entries(r).reduce(
1069
1073
  (t, [n, l]) => t.replace(`{${n}}`, String(l)),
1070
1074
  e
@@ -1078,41 +1082,41 @@ function Q(e, r) {
1078
1082
  }
1079
1083
  return t.join(", ");
1080
1084
  }
1081
- const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1082
- const [l, c] = v(!1), d = (e.memories ?? []).map((h) => h.memoryTitle), m = d.length > 0, o = m && d.length > W, a = o && !l ? d.slice(0, W) : d, u = d.length - W, y = !o || l, f = `${n.searchingFor}'${e.queryDescription}'`, p = m ? `${n.searchingIn}${Q(
1085
+ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1086
+ const [l, c] = v(!1), d = (e.memories ?? []).map((x) => x.memoryTitle), m = d.length > 0, i = m && d.length > $, a = i && !l ? d.slice(0, $) : d, y = d.length - $, u = !i || l, h = `${n.searchingFor}'${e.queryDescription}'`, g = m ? `${n.searchingIn}${Q(
1083
1087
  a,
1084
- y ? n.and : void 0
1085
- )}` : "", x = m ? `${f}${p}` : `${n.searchingPrefix}${e.queryDescription}`;
1086
- return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1087
- /* @__PURE__ */ i(
1088
+ u ? n.and : void 0
1089
+ )}` : "", k = m ? `${h}${g}` : `${n.searchingPrefix}${e.queryDescription}`;
1090
+ return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1091
+ /* @__PURE__ */ o(
1088
1092
  b.div,
1089
1093
  {
1090
1094
  style: { color: "#666" },
1091
1095
  initial: { opacity: 0, y: -10 },
1092
1096
  animate: { opacity: 1, y: 0 },
1093
1097
  transition: { duration: 0.3, delay: 0 },
1094
- children: r && !t && !o ? /* @__PURE__ */ i(
1095
- w,
1098
+ children: r && !t && !i ? /* @__PURE__ */ o(
1099
+ I,
1096
1100
  {
1097
- text: x,
1101
+ text: k,
1098
1102
  duration: 2.5,
1099
1103
  repeat: !0,
1100
1104
  color: "#999",
1101
1105
  shimmerColor: "#000"
1102
1106
  }
1103
- ) : /* @__PURE__ */ g(I, { children: [
1104
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ g(I, { children: [
1107
+ ) : /* @__PURE__ */ p(E, { children: [
1108
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ p(E, { children: [
1105
1109
  n.searchingFor,
1106
- /* @__PURE__ */ g("span", { style: { fontWeight: 600 }, children: [
1110
+ /* @__PURE__ */ p("span", { style: { fontWeight: 600 }, children: [
1107
1111
  "'",
1108
1112
  e.queryDescription,
1109
1113
  "'"
1110
1114
  ] }),
1111
- p
1115
+ g
1112
1116
  ] }) : `${n.searchingPrefix}${e.queryDescription}` }),
1113
- o && !l && /* @__PURE__ */ g(I, { children: [
1117
+ i && !l && /* @__PURE__ */ p(E, { children: [
1114
1118
  " ",
1115
- /* @__PURE__ */ i(
1119
+ /* @__PURE__ */ o(
1116
1120
  "button",
1117
1121
  {
1118
1122
  type: "button",
@@ -1128,15 +1132,15 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1128
1132
  textDecoration: "underline",
1129
1133
  fontFamily: "inherit"
1130
1134
  },
1131
- children: T(n.moreMemories, {
1132
- n: u
1135
+ children: S(n.moreMemories, {
1136
+ n: y
1133
1137
  })
1134
1138
  }
1135
1139
  )
1136
1140
  ] }),
1137
- o && l && /* @__PURE__ */ g(I, { children: [
1141
+ i && l && /* @__PURE__ */ p(E, { children: [
1138
1142
  " ",
1139
- /* @__PURE__ */ i(
1143
+ /* @__PURE__ */ o(
1140
1144
  "button",
1141
1145
  {
1142
1146
  type: "button",
@@ -1159,7 +1163,7 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1159
1163
  ] })
1160
1164
  }
1161
1165
  ),
1162
- t !== void 0 && /* @__PURE__ */ i(
1166
+ t !== void 0 && /* @__PURE__ */ o(
1163
1167
  "div",
1164
1168
  {
1165
1169
  style: {
@@ -1168,17 +1172,17 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1168
1172
  marginTop: "4px",
1169
1173
  fontStyle: "italic"
1170
1174
  },
1171
- children: T(n.tookSeconds, { n: t })
1175
+ children: S(n.tookSeconds, { n: t })
1172
1176
  }
1173
1177
  )
1174
1178
  ] });
1175
- }, $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1176
- const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > $, o = m && !l ? s.slice(0, $) : s, a = s.length - $, u = !m || l, y = d ? `${n.findingMemoriesIn}${Q(
1177
- o,
1178
- u ? n.and : void 0
1179
+ }, H = 5, Ge = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1180
+ const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > H, i = m && !l ? s.slice(0, H) : s, a = s.length - H, y = !m || l, u = d ? `${n.findingMemoriesIn}${Q(
1181
+ i,
1182
+ y ? n.and : void 0
1179
1183
  )}` : n.findingMemories;
1180
- return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1181
- /* @__PURE__ */ i(
1184
+ return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1185
+ /* @__PURE__ */ o(
1182
1186
  b.div,
1183
1187
  {
1184
1188
  style: {
@@ -1187,20 +1191,20 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1187
1191
  initial: { opacity: 0, y: -10 },
1188
1192
  animate: { opacity: 1, y: 0 },
1189
1193
  transition: { duration: 0.3, delay: 0 },
1190
- children: r && !t && !m ? /* @__PURE__ */ i(
1191
- w,
1194
+ children: r && !t && !m ? /* @__PURE__ */ o(
1195
+ I,
1192
1196
  {
1193
- text: y,
1197
+ text: u,
1194
1198
  duration: 2.5,
1195
1199
  repeat: !0,
1196
1200
  color: "#999",
1197
1201
  shimmerColor: "#000"
1198
1202
  }
1199
- ) : /* @__PURE__ */ g(I, { children: [
1200
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: y }),
1201
- m && !l && /* @__PURE__ */ g(I, { children: [
1203
+ ) : /* @__PURE__ */ p(E, { children: [
1204
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u }),
1205
+ m && !l && /* @__PURE__ */ p(E, { children: [
1202
1206
  " ",
1203
- /* @__PURE__ */ i(
1207
+ /* @__PURE__ */ o(
1204
1208
  "button",
1205
1209
  {
1206
1210
  type: "button",
@@ -1216,15 +1220,15 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1216
1220
  textDecoration: "underline",
1217
1221
  fontFamily: "inherit"
1218
1222
  },
1219
- children: T(n.moreMemories, {
1223
+ children: S(n.moreMemories, {
1220
1224
  n: a
1221
1225
  })
1222
1226
  }
1223
1227
  )
1224
1228
  ] }),
1225
- m && l && /* @__PURE__ */ g(I, { children: [
1229
+ m && l && /* @__PURE__ */ p(E, { children: [
1226
1230
  " ",
1227
- /* @__PURE__ */ i(
1231
+ /* @__PURE__ */ o(
1228
1232
  "button",
1229
1233
  {
1230
1234
  type: "button",
@@ -1247,7 +1251,7 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1247
1251
  ] })
1248
1252
  }
1249
1253
  ),
1250
- t !== void 0 && /* @__PURE__ */ i(
1254
+ t !== void 0 && /* @__PURE__ */ o(
1251
1255
  "div",
1252
1256
  {
1253
1257
  style: {
@@ -1256,27 +1260,27 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1256
1260
  marginTop: "4px",
1257
1261
  fontStyle: "italic"
1258
1262
  },
1259
- children: T(n.tookSeconds, { n: t })
1263
+ children: S(n.tookSeconds, { n: t })
1260
1264
  }
1261
1265
  )
1262
1266
  ] });
1263
- }, H = 5, Ge = ({ data: e, t: r }) => {
1264
- const [t, n] = v(!1), c = e.memories.map((f) => f.memoryTitle), s = c.length > 0, d = s && c.length > H, m = d && !t ? c.slice(0, H) : c, o = c.length - H, a = !d || t, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, y = s ? `${u}${Q(
1267
+ }, _ = 5, Qe = ({ data: e, t: r }) => {
1268
+ const [t, n] = v(!1), c = e.memories.map((h) => h.memoryTitle), s = c.length > 0, d = s && c.length > _, m = d && !t ? c.slice(0, _) : c, i = c.length - _, a = !d || t, y = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, u = s ? `${y}${Q(
1265
1269
  m,
1266
1270
  a ? r.and : void 0
1267
1271
  )}` : r.memoriesFound;
1268
- return /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
1272
+ return /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
1269
1273
  b.div,
1270
1274
  {
1271
1275
  style: { color: "#666" },
1272
1276
  initial: { opacity: 0, y: -10 },
1273
1277
  animate: { opacity: 1, y: 0 },
1274
1278
  transition: { duration: 0.3, delay: 0 },
1275
- children: /* @__PURE__ */ g(I, { children: [
1276
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: y }),
1277
- d && !t && /* @__PURE__ */ g(I, { children: [
1279
+ children: /* @__PURE__ */ p(E, { children: [
1280
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u }),
1281
+ d && !t && /* @__PURE__ */ p(E, { children: [
1278
1282
  " ",
1279
- /* @__PURE__ */ i(
1283
+ /* @__PURE__ */ o(
1280
1284
  "button",
1281
1285
  {
1282
1286
  type: "button",
@@ -1292,15 +1296,15 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1292
1296
  textDecoration: "underline",
1293
1297
  fontFamily: "inherit"
1294
1298
  },
1295
- children: T(r.moreMemories, {
1296
- n: o
1299
+ children: S(r.moreMemories, {
1300
+ n: i
1297
1301
  })
1298
1302
  }
1299
1303
  )
1300
1304
  ] }),
1301
- d && t && /* @__PURE__ */ g(I, { children: [
1305
+ d && t && /* @__PURE__ */ p(E, { children: [
1302
1306
  " ",
1303
- /* @__PURE__ */ i(
1307
+ /* @__PURE__ */ o(
1304
1308
  "button",
1305
1309
  {
1306
1310
  type: "button",
@@ -1323,10 +1327,10 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1323
1327
  ] })
1324
1328
  }
1325
1329
  ) });
1326
- }, Qe = ({ isLatest: e = !1, durationSeconds: r, t }) => {
1330
+ }, Ue = ({ isLatest: e = !1, durationSeconds: r, t }) => {
1327
1331
  const n = t.addingSources;
1328
- return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1329
- /* @__PURE__ */ i(
1332
+ return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1333
+ /* @__PURE__ */ o(
1330
1334
  b.div,
1331
1335
  {
1332
1336
  style: {
@@ -1338,8 +1342,8 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1338
1342
  initial: { opacity: 0, y: -10 },
1339
1343
  animate: { opacity: 1, y: 0 },
1340
1344
  transition: { duration: 0.3, delay: 0 },
1341
- children: e && !r ? /* @__PURE__ */ i(
1342
- w,
1345
+ children: e && !r ? /* @__PURE__ */ o(
1346
+ I,
1343
1347
  {
1344
1348
  text: n,
1345
1349
  duration: 2.5,
@@ -1347,10 +1351,10 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1347
1351
  color: "#999",
1348
1352
  shimmerColor: "#000"
1349
1353
  }
1350
- ) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: n })
1354
+ ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: n })
1351
1355
  }
1352
1356
  ),
1353
- r !== void 0 && /* @__PURE__ */ i(
1357
+ r !== void 0 && /* @__PURE__ */ o(
1354
1358
  "div",
1355
1359
  {
1356
1360
  style: {
@@ -1359,27 +1363,27 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1359
1363
  marginTop: "4px",
1360
1364
  fontStyle: "italic"
1361
1365
  },
1362
- children: T(t.tookSeconds, { n: r })
1366
+ children: S(t.tookSeconds, { n: r })
1363
1367
  }
1364
1368
  )
1365
1369
  ] });
1366
1370
  };
1367
- function Ue(e, r) {
1371
+ function je(e, r) {
1368
1372
  if (e.length === 0) return "";
1369
1373
  if (e.length === 1)
1370
- return T(r.pageSingle, { n: e[0] });
1374
+ return S(r.pageSingle, { n: e[0] });
1371
1375
  if (e.length === 2)
1372
- return T(r.pageTwo, {
1376
+ return S(r.pageTwo, {
1373
1377
  a: e[0],
1374
1378
  b: e[1]
1375
1379
  });
1376
1380
  const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
1377
- return T(r.pageMultiple, { list: n, n: t });
1381
+ return S(r.pageMultiple, { list: n, n: t });
1378
1382
  }
1379
- const je = ({ data: e, onSourceClick: r, t }) => {
1383
+ const qe = ({ data: e, onSourceClick: r, t }) => {
1380
1384
  const [n, l] = v(null);
1381
- return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1382
- /* @__PURE__ */ i(
1385
+ return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1386
+ /* @__PURE__ */ o(
1383
1387
  b.div,
1384
1388
  {
1385
1389
  style: {
@@ -1396,8 +1400,8 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1396
1400
  children: t.sources
1397
1401
  }
1398
1402
  ),
1399
- /* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ i(
1400
- qe,
1403
+ /* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ o(
1404
+ Ke,
1401
1405
  {
1402
1406
  source: c,
1403
1407
  index: s,
@@ -1409,7 +1413,7 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1409
1413
  c.memoryId
1410
1414
  )) })
1411
1415
  ] });
1412
- }, qe = ({
1416
+ }, Ke = ({
1413
1417
  source: e,
1414
1418
  index: r,
1415
1419
  loadingMemoryId: t,
@@ -1417,15 +1421,15 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1417
1421
  onSourceClick: l,
1418
1422
  t: c
1419
1423
  }) => {
1420
- const [s, d] = v(!1), m = !!l, o = t === e.memoryId, a = e.pageNumbers ?? [], u = Ue(a, c);
1421
- return /* @__PURE__ */ g(
1424
+ const [s, d] = v(!1), m = !!l, i = t === e.memoryId, a = e.pageNumbers ?? [], y = je(a, c);
1425
+ return /* @__PURE__ */ p(
1422
1426
  b.div,
1423
1427
  {
1424
- "aria-busy": o,
1428
+ "aria-busy": i,
1425
1429
  initial: { opacity: 0, scale: 0.9 },
1426
1430
  animate: { opacity: 1, scale: 1 },
1427
1431
  transition: { duration: 0.25, delay: r * 0.05 },
1428
- onClick: m && !o ? async () => {
1432
+ onClick: m && !i ? async () => {
1429
1433
  n(e.memoryId);
1430
1434
  try {
1431
1435
  await l({
@@ -1439,8 +1443,8 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1439
1443
  n(null);
1440
1444
  }
1441
1445
  } : void 0,
1442
- onMouseEnter: m && !o ? () => d(!0) : void 0,
1443
- onMouseLeave: m && !o ? () => d(!1) : void 0,
1446
+ onMouseEnter: m && !i ? () => d(!0) : void 0,
1447
+ onMouseLeave: m && !i ? () => d(!1) : void 0,
1444
1448
  style: {
1445
1449
  display: "inline-flex",
1446
1450
  flexDirection: "column",
@@ -1449,13 +1453,13 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1449
1453
  borderRadius: "6px",
1450
1454
  border: "1px solid #e0e0e0",
1451
1455
  backgroundColor: s ? "#f5f5f5" : "transparent",
1452
- cursor: m && !o ? "pointer" : o ? "wait" : "default",
1456
+ cursor: m && !i ? "pointer" : i ? "wait" : "default",
1453
1457
  transition: "background-color 0.15s ease",
1454
1458
  userSelect: "none",
1455
- pointerEvents: o ? "none" : void 0
1459
+ pointerEvents: i ? "none" : void 0
1456
1460
  },
1457
1461
  children: [
1458
- /* @__PURE__ */ g(
1462
+ /* @__PURE__ */ p(
1459
1463
  "span",
1460
1464
  {
1461
1465
  style: {
@@ -1467,7 +1471,7 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1467
1471
  gap: 8
1468
1472
  },
1469
1473
  children: [
1470
- o && /* @__PURE__ */ i(
1474
+ i && /* @__PURE__ */ o(
1471
1475
  "span",
1472
1476
  {
1473
1477
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -1478,17 +1482,17 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1478
1482
  ]
1479
1483
  }
1480
1484
  ),
1481
- u && /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "#666" }, children: u })
1485
+ y && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: y })
1482
1486
  ]
1483
1487
  }
1484
1488
  );
1485
- }, z = ({
1489
+ }, L = ({
1486
1490
  color: e = "#78b13f",
1487
1491
  size: r = 24,
1488
1492
  borderWidth: t = 7
1489
1493
  }) => {
1490
1494
  const n = r * 0.5;
1491
- return /* @__PURE__ */ i(
1495
+ return /* @__PURE__ */ o(
1492
1496
  "span",
1493
1497
  {
1494
1498
  style: {
@@ -1514,7 +1518,7 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1514
1518
  height: n,
1515
1519
  backgroundColor: e
1516
1520
  };
1517
- return /* @__PURE__ */ g(
1521
+ return /* @__PURE__ */ p(
1518
1522
  "span",
1519
1523
  {
1520
1524
  style: {
@@ -1524,7 +1528,7 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1524
1528
  height: r
1525
1529
  },
1526
1530
  children: [
1527
- /* @__PURE__ */ i(
1531
+ /* @__PURE__ */ o(
1528
1532
  "span",
1529
1533
  {
1530
1534
  style: {
@@ -1533,7 +1537,7 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1533
1537
  }
1534
1538
  }
1535
1539
  ),
1536
- /* @__PURE__ */ i(
1540
+ /* @__PURE__ */ o(
1537
1541
  "span",
1538
1542
  {
1539
1543
  style: {
@@ -1546,20 +1550,20 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1546
1550
  }
1547
1551
  );
1548
1552
  };
1549
- function Ke({
1553
+ function Ve({
1550
1554
  memory: e,
1551
1555
  completed: r
1552
1556
  }) {
1553
- return e.error != null ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1557
+ return e.error != null ? /* @__PURE__ */ o(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1554
1558
  }
1555
- const X = 80;
1556
- function Ve({
1559
+ const ee = 80;
1560
+ function Xe({
1557
1561
  memory: e,
1558
1562
  completed: r,
1559
1563
  t
1560
1564
  }) {
1561
- const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length > X, d = c != null ? n || !s ? c : `${c.slice(0, X)}...` : void 0, m = s, o = e.error != null;
1562
- return /* @__PURE__ */ g(
1565
+ const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length > ee, d = c != null ? n || !s ? c : `${c.slice(0, ee)}...` : void 0, m = s, i = e.error != null;
1566
+ return /* @__PURE__ */ p(
1563
1567
  b.div,
1564
1568
  {
1565
1569
  initial: { opacity: 0 },
@@ -1578,7 +1582,7 @@ function Ve({
1578
1582
  cursor: m ? "pointer" : "default"
1579
1583
  },
1580
1584
  children: [
1581
- /* @__PURE__ */ i(
1585
+ /* @__PURE__ */ o(
1582
1586
  "div",
1583
1587
  {
1584
1588
  style: {
@@ -1588,10 +1592,10 @@ function Ve({
1588
1592
  flexShrink: 0,
1589
1593
  width: 32
1590
1594
  },
1591
- children: /* @__PURE__ */ i(Ke, { memory: e, completed: r })
1595
+ children: /* @__PURE__ */ o(Ve, { memory: e, completed: r })
1592
1596
  }
1593
1597
  ),
1594
- /* @__PURE__ */ g(
1598
+ /* @__PURE__ */ p(
1595
1599
  "div",
1596
1600
  {
1597
1601
  style: {
@@ -1601,26 +1605,26 @@ function Ve({
1601
1605
  minWidth: 0
1602
1606
  },
1603
1607
  children: [
1604
- /* @__PURE__ */ i(
1608
+ /* @__PURE__ */ o(
1605
1609
  "span",
1606
1610
  {
1607
1611
  style: { fontSize: 13, fontWeight: 500, color: "#333" },
1608
1612
  children: e.memoryTitle
1609
1613
  }
1610
1614
  ),
1611
- d != null && /* @__PURE__ */ i(
1615
+ d != null && /* @__PURE__ */ o(
1612
1616
  "span",
1613
1617
  {
1614
1618
  style: {
1615
1619
  fontSize: 12,
1616
- color: o ? "#c62828" : "#666",
1620
+ color: i ? "#c62828" : "#666",
1617
1621
  lineHeight: 1.4,
1618
1622
  whiteSpace: n ? "pre-wrap" : void 0
1619
1623
  },
1620
1624
  children: d
1621
1625
  }
1622
1626
  ),
1623
- m && /* @__PURE__ */ i(
1627
+ m && /* @__PURE__ */ o(
1624
1628
  "span",
1625
1629
  {
1626
1630
  style: {
@@ -1638,8 +1642,8 @@ function Ve({
1638
1642
  }
1639
1643
  );
1640
1644
  }
1641
- const Xe = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ i(
1642
- Ve,
1645
+ const Je = ({ data: e, completed: r, t }) => /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ o(
1646
+ Xe,
1643
1647
  {
1644
1648
  memory: n,
1645
1649
  completed: r,
@@ -1647,137 +1651,418 @@ const Xe = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: {
1647
1651
  },
1648
1652
  n.memoryId
1649
1653
  )) });
1650
- function Je(e, r) {
1654
+ function Ye(e, r) {
1655
+ const t = Math.min(e.length, r.length);
1656
+ for (let n = t; n >= 0; n--)
1657
+ if (e.slice(-n) === r.slice(0, n)) return n;
1658
+ return 0;
1659
+ }
1660
+ const Ze = `
1661
+
1662
+ `;
1663
+ function j(e) {
1664
+ var t, n;
1665
+ if (e.length === 0) return "";
1666
+ let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
1667
+ for (let l = 1; l < e.length; l++) {
1668
+ const c = ((n = e[l]) == null ? void 0 : n.content) ?? "";
1669
+ if (c === "") continue;
1670
+ if (r === "") {
1671
+ r = c;
1672
+ continue;
1673
+ }
1674
+ const s = Ye(r, c);
1675
+ s === 0 ? r += Ze + c : r += c.slice(s);
1676
+ }
1677
+ return r;
1678
+ }
1679
+ function q(e, r) {
1651
1680
  if (e.length === 0) return "";
1652
1681
  if (e.length === 1)
1653
- return T(r.pageSingle, { n: e[0] });
1682
+ return S(r.memorySearchPagesSingle, {
1683
+ n: e[0]
1684
+ });
1654
1685
  if (e.length === 2)
1655
- return T(r.pageTwo, {
1686
+ return S(r.memorySearchPagesTwo, {
1656
1687
  a: e[0],
1657
1688
  b: e[1]
1658
1689
  });
1659
1690
  const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
1660
- return T(r.pageMultiple, { list: n, n: t });
1691
+ return S(r.memorySearchPagesMultiple, {
1692
+ list: n,
1693
+ n: t
1694
+ });
1661
1695
  }
1662
- function Ye(e, r) {
1663
- return e === 1 ? r.chunkFound : T(r.chunksFound, { n: e });
1696
+ function K(e) {
1697
+ const r = /* @__PURE__ */ new Set();
1698
+ for (const t of e)
1699
+ for (const n of t.pageNumbers) r.add(n);
1700
+ return [...r].sort((t, n) => t - n);
1664
1701
  }
1665
- const Ze = ({ data: e, t: r }) => {
1666
- const [t, n] = v(!1), l = e.chunks.length, c = l > 0;
1667
- return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
1668
- /* @__PURE__ */ g(
1669
- b.div,
1702
+ function V(e) {
1703
+ const r = e.memoryTypeName.trim();
1704
+ if (r !== "") return r;
1705
+ if (e.memoryTypeId !== "") return e.memoryTypeId;
1706
+ }
1707
+ function ae(e) {
1708
+ return e.chunks.filter((r) => r.relation === "MATCH").length;
1709
+ }
1710
+ function er(e, r) {
1711
+ let t = 0, n = 0;
1712
+ for (const s of e)
1713
+ t += ae(s), s.matchingChunkScore > n && (n = s.matchingChunkScore);
1714
+ const l = t === 1 ? r.chunkFound : S(r.chunksFound, { n: t }), c = S(r.scoreLabel, {
1715
+ n: n.toFixed(2)
1716
+ });
1717
+ return `${l} - ${c}`;
1718
+ }
1719
+ function rr(e) {
1720
+ const r = [], t = /* @__PURE__ */ new Map();
1721
+ return e.forEach((n, l) => {
1722
+ let c = t.get(n.memoryId);
1723
+ if (c == null) {
1724
+ r.push(n.memoryId);
1725
+ const s = n.memoryTitle !== "" ? n.memoryTitle : n.memoryId;
1726
+ c = {
1727
+ memoryId: n.memoryId,
1728
+ memoryTitle: s,
1729
+ items: []
1730
+ }, t.set(n.memoryId, c);
1731
+ }
1732
+ c.items.push({ item: n, flatIndex: l });
1733
+ }), r.map((n) => t.get(n));
1734
+ }
1735
+ function nr({
1736
+ items: e,
1737
+ onSearchResultClick: r,
1738
+ t
1739
+ }) {
1740
+ const [n, l] = v(null), c = !!r;
1741
+ return /* @__PURE__ */ o(
1742
+ "div",
1743
+ {
1744
+ style: {
1745
+ display: "flex",
1746
+ flexDirection: "column",
1747
+ gap: 0,
1748
+ marginTop: 8,
1749
+ paddingTop: 8,
1750
+ borderTop: "1px solid #f0f0f0"
1751
+ },
1752
+ children: e.map((s, d) => {
1753
+ const m = K(
1754
+ s.chunks
1755
+ ), i = [
1756
+ V(s),
1757
+ S(t.scoreLabel, {
1758
+ n: s.matchingChunkScore.toFixed(2)
1759
+ }),
1760
+ m.length > 0 ? q(m, t) : t.pagesNotAvailable
1761
+ ].filter(
1762
+ (h) => h != null && h !== ""
1763
+ ), a = {
1764
+ memoryId: s.memoryId,
1765
+ memoryTitle: s.memoryTitle,
1766
+ memoryTypeId: s.memoryTypeId,
1767
+ memoryTypeName: s.memoryTypeName,
1768
+ pageNumbers: m
1769
+ }, y = `${s.memoryId}-${d}`, u = n === y;
1770
+ return /* @__PURE__ */ p(
1771
+ "div",
1772
+ {
1773
+ style: {
1774
+ display: "flex",
1775
+ flexDirection: "row",
1776
+ alignItems: "flex-start",
1777
+ gap: "12px",
1778
+ paddingTop: d > 0 ? 12 : 0,
1779
+ paddingBottom: d < e.length - 1 ? 12 : 0,
1780
+ borderBottom: d < e.length - 1 ? "1px solid #eee" : void 0,
1781
+ minWidth: 0
1782
+ },
1783
+ children: [
1784
+ /* @__PURE__ */ p(
1785
+ "div",
1786
+ {
1787
+ style: {
1788
+ flex: 1,
1789
+ minWidth: 0,
1790
+ display: "flex",
1791
+ flexDirection: "column",
1792
+ gap: "6px"
1793
+ },
1794
+ children: [
1795
+ /* @__PURE__ */ o(
1796
+ "span",
1797
+ {
1798
+ style: {
1799
+ fontSize: 13,
1800
+ color: "#1f2937",
1801
+ lineHeight: 1.5,
1802
+ whiteSpace: "pre-wrap",
1803
+ wordBreak: "break-word"
1804
+ },
1805
+ children: j(s.chunks)
1806
+ }
1807
+ ),
1808
+ /* @__PURE__ */ o(
1809
+ "div",
1810
+ {
1811
+ style: {
1812
+ fontSize: 11,
1813
+ fontWeight: 400,
1814
+ color: "#94a3b8",
1815
+ lineHeight: 1.35
1816
+ },
1817
+ children: i.join(" · ")
1818
+ }
1819
+ )
1820
+ ]
1821
+ }
1822
+ ),
1823
+ c && /* @__PURE__ */ p(
1824
+ "button",
1825
+ {
1826
+ type: "button",
1827
+ "aria-busy": u,
1828
+ disabled: u,
1829
+ onClick: async () => {
1830
+ l(y);
1831
+ try {
1832
+ await r(
1833
+ a
1834
+ );
1835
+ } finally {
1836
+ l(null);
1837
+ }
1838
+ },
1839
+ style: {
1840
+ flexShrink: 0,
1841
+ alignSelf: "center",
1842
+ padding: "6px 12px",
1843
+ fontSize: 12,
1844
+ fontWeight: 600,
1845
+ color: "#2563eb",
1846
+ background: "#eff6ff",
1847
+ border: "1px solid #bfdbfe",
1848
+ borderRadius: 6,
1849
+ cursor: u ? "wait" : "pointer",
1850
+ fontFamily: "inherit",
1851
+ display: "inline-flex",
1852
+ alignItems: "center",
1853
+ gap: 8
1854
+ },
1855
+ children: [
1856
+ u && /* @__PURE__ */ o(
1857
+ "span",
1858
+ {
1859
+ className: "explore-memory-loader explore-memory-loader--callback",
1860
+ "aria-hidden": !0
1861
+ }
1862
+ ),
1863
+ t.viewButton
1864
+ ]
1865
+ }
1866
+ )
1867
+ ]
1868
+ },
1869
+ y
1870
+ );
1871
+ })
1872
+ }
1873
+ );
1874
+ }
1875
+ function tr({
1876
+ group: e,
1877
+ t: r,
1878
+ expanded: t,
1879
+ onToggle: n,
1880
+ onSearchResultClick: l
1881
+ }) {
1882
+ const c = e.items.map((d) => d.item), s = c.some((d) => d.chunks.length > 0);
1883
+ return /* @__PURE__ */ p(
1884
+ b.div,
1885
+ {
1886
+ initial: { opacity: 0 },
1887
+ animate: { opacity: 1 },
1888
+ transition: { duration: 0.25 },
1889
+ style: {
1890
+ paddingTop: "12px",
1891
+ paddingBottom: "12px",
1892
+ borderBottom: "1px solid #eee",
1893
+ display: "flex",
1894
+ flexDirection: "row",
1895
+ alignItems: "flex-start",
1896
+ gap: "10px",
1897
+ minWidth: 0
1898
+ },
1899
+ children: [
1900
+ /* @__PURE__ */ o(
1901
+ "div",
1902
+ {
1903
+ style: {
1904
+ display: "flex",
1905
+ alignItems: "center",
1906
+ justifyContent: "center",
1907
+ flexShrink: 0,
1908
+ width: 32,
1909
+ paddingTop: 2
1910
+ },
1911
+ children: /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 })
1912
+ }
1913
+ ),
1914
+ /* @__PURE__ */ p(
1915
+ "div",
1916
+ {
1917
+ style: {
1918
+ display: "flex",
1919
+ flexDirection: "column",
1920
+ gap: "4px",
1921
+ minWidth: 0,
1922
+ flex: 1
1923
+ },
1924
+ children: [
1925
+ /* @__PURE__ */ o(
1926
+ "span",
1927
+ {
1928
+ style: {
1929
+ fontSize: 13,
1930
+ fontWeight: 600,
1931
+ color: "#333",
1932
+ wordBreak: "break-word"
1933
+ },
1934
+ children: e.memoryTitle
1935
+ }
1936
+ ),
1937
+ /* @__PURE__ */ p(
1938
+ "div",
1939
+ {
1940
+ style: {
1941
+ display: "flex",
1942
+ flexDirection: "row",
1943
+ flexWrap: "wrap",
1944
+ alignItems: "baseline",
1945
+ gap: "6px 12px",
1946
+ minWidth: 0
1947
+ },
1948
+ children: [
1949
+ /* @__PURE__ */ o(
1950
+ "span",
1951
+ {
1952
+ style: {
1953
+ fontSize: 12,
1954
+ color: "#666",
1955
+ whiteSpace: "nowrap"
1956
+ },
1957
+ children: er(c, r)
1958
+ }
1959
+ ),
1960
+ s && /* @__PURE__ */ o(
1961
+ "button",
1962
+ {
1963
+ type: "button",
1964
+ onClick: n,
1965
+ style: {
1966
+ border: "none",
1967
+ background: "none",
1968
+ padding: 0,
1969
+ cursor: "pointer",
1970
+ fontSize: 12,
1971
+ color: "#666",
1972
+ textDecoration: "underline",
1973
+ fontFamily: "inherit"
1974
+ },
1975
+ children: t ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
1976
+ }
1977
+ )
1978
+ ]
1979
+ }
1980
+ ),
1981
+ t && s && /* @__PURE__ */ o(
1982
+ nr,
1983
+ {
1984
+ items: c,
1985
+ onSearchResultClick: l,
1986
+ t: r
1987
+ }
1988
+ )
1989
+ ]
1990
+ }
1991
+ )
1992
+ ]
1993
+ }
1994
+ );
1995
+ }
1996
+ function or(e, r) {
1997
+ return e === 1 ? r.chunkFound : S(r.chunksFound, { n: e });
1998
+ }
1999
+ const ir = ({
2000
+ data: e,
2001
+ onSearchResultClick: r,
2002
+ t
2003
+ }) => {
2004
+ const n = e.items, l = n.reduce(
2005
+ (u, h) => u + ae(h),
2006
+ 0
2007
+ ), c = new Set(n.map((u) => u.memoryId)).size, [s, d] = v({}), m = W((u) => {
2008
+ d((h) => ({
2009
+ ...h,
2010
+ [u]: !h[u]
2011
+ }));
2012
+ }, []), i = P(() => rr(n), [n]), a = c === 1 ? t.memoryChatChunkResultsInOneMemory : S(t.memoryChatChunkResultsInMemories, {
2013
+ n: c
2014
+ }), y = `${or(l, t)} ${a}`;
2015
+ return n.length === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
2016
+ "div",
2017
+ {
2018
+ style: {
2019
+ fontSize: 12,
2020
+ color: "#94a3b8",
2021
+ paddingTop: 4
2022
+ },
2023
+ children: t.memorySearchExploreNoResults
2024
+ }
2025
+ ) }) : /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
2026
+ i.map((u) => /* @__PURE__ */ o(
2027
+ tr,
1670
2028
  {
1671
- initial: { opacity: 0 },
1672
- animate: { opacity: 1 },
1673
- transition: { duration: 0.25 },
1674
- onClick: c ? () => n((s) => !s) : void 0,
1675
- style: {
1676
- paddingBottom: t ? "12px" : 0,
1677
- borderBottom: t ? "1px solid #eee" : void 0,
1678
- display: "flex",
1679
- flexDirection: "column",
1680
- gap: "4px",
1681
- minWidth: 0,
1682
- cursor: c ? "pointer" : "default"
1683
- },
1684
- children: [
1685
- /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1686
- /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: Ye(l, r) }),
1687
- c && /* @__PURE__ */ i(
1688
- "span",
1689
- {
1690
- style: {
1691
- fontSize: 11,
1692
- color: "#999",
1693
- marginTop: 2
1694
- },
1695
- children: t ? r.clickToCollapse : r.clickToExpand
1696
- }
1697
- )
1698
- ]
1699
- }
1700
- ),
1701
- t && c && /* @__PURE__ */ i(
1702
- b.div,
2029
+ group: u,
2030
+ t,
2031
+ expanded: s[u.memoryId] === !0,
2032
+ onToggle: () => m(u.memoryId),
2033
+ onSearchResultClick: r
2034
+ },
2035
+ u.memoryId
2036
+ )),
2037
+ /* @__PURE__ */ o(
2038
+ "div",
1703
2039
  {
1704
- initial: { opacity: 0, height: 0 },
1705
- animate: { opacity: 1, height: "auto" },
1706
- transition: { duration: 0.2 },
1707
2040
  style: {
1708
- maxHeight: 220,
1709
- overflowY: "auto",
1710
- marginTop: 12,
1711
- display: "flex",
1712
- flexDirection: "column",
1713
- gap: 8
2041
+ fontSize: "12px",
2042
+ color: "#999",
2043
+ marginTop: "4px",
2044
+ fontStyle: "italic"
1714
2045
  },
1715
- children: e.chunks.map((s, d) => {
1716
- const m = s.pageNumbers ?? [], o = Je(m, r);
1717
- return /* @__PURE__ */ g(
1718
- "div",
1719
- {
1720
- style: {
1721
- padding: "8px 12px",
1722
- borderRadius: 6,
1723
- border: "1px solid #e0e0e0",
1724
- backgroundColor: "#fafafa"
1725
- },
1726
- children: [
1727
- /* @__PURE__ */ i(
1728
- "span",
1729
- {
1730
- style: {
1731
- fontSize: 12,
1732
- color: "#333",
1733
- lineHeight: 1.4,
1734
- display: "block",
1735
- marginBottom: 4
1736
- },
1737
- children: s.content
1738
- }
1739
- ),
1740
- /* @__PURE__ */ g(
1741
- "div",
1742
- {
1743
- style: {
1744
- display: "flex",
1745
- gap: 8,
1746
- fontSize: 11,
1747
- color: "#666"
1748
- },
1749
- children: [
1750
- o && /* @__PURE__ */ i("span", { children: o }),
1751
- /* @__PURE__ */ i("span", { children: T(r.scoreLabel, {
1752
- n: s.score
1753
- }) })
1754
- ]
1755
- }
1756
- )
1757
- ]
1758
- },
1759
- d
1760
- );
1761
- })
2046
+ children: y
1762
2047
  }
1763
2048
  )
1764
2049
  ] });
1765
2050
  };
1766
- function er({ item: e }) {
1767
- return e.error != null ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
2051
+ function ar({ item: e }) {
2052
+ return e.error != null ? /* @__PURE__ */ o(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1768
2053
  }
1769
- function rr(e, r) {
1770
- return T(r.searchingInMemoriesOfType, {
2054
+ function sr(e, r) {
2055
+ return S(r.searchingInMemoriesOfType, {
1771
2056
  name: e.memoryTypeName
1772
2057
  });
1773
2058
  }
1774
- function nr({
2059
+ function lr({
1775
2060
  item: e,
1776
2061
  t: r,
1777
2062
  showShimmerForPrimary: t
1778
2063
  }) {
1779
- const n = e.result != null, l = e.error != null, c = rr(e, r);
1780
- return /* @__PURE__ */ g(
2064
+ const n = e.result != null, l = e.error != null, c = sr(e, r);
2065
+ return /* @__PURE__ */ p(
1781
2066
  b.div,
1782
2067
  {
1783
2068
  initial: { opacity: 0 },
@@ -1794,7 +2079,7 @@ function nr({
1794
2079
  minWidth: 0
1795
2080
  },
1796
2081
  children: [
1797
- /* @__PURE__ */ i(
2082
+ /* @__PURE__ */ o(
1798
2083
  "div",
1799
2084
  {
1800
2085
  style: {
@@ -1804,10 +2089,10 @@ function nr({
1804
2089
  flexShrink: 0,
1805
2090
  width: 32
1806
2091
  },
1807
- children: /* @__PURE__ */ i(er, { item: e })
2092
+ children: /* @__PURE__ */ o(ar, { item: e })
1808
2093
  }
1809
2094
  ),
1810
- /* @__PURE__ */ g(
2095
+ /* @__PURE__ */ p(
1811
2096
  "div",
1812
2097
  {
1813
2098
  style: {
@@ -1818,8 +2103,8 @@ function nr({
1818
2103
  flex: 1
1819
2104
  },
1820
2105
  children: [
1821
- /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !n && !l && t ? /* @__PURE__ */ i(
1822
- w,
2106
+ /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !n && !l && t ? /* @__PURE__ */ o(
2107
+ I,
1823
2108
  {
1824
2109
  text: c,
1825
2110
  duration: 2.5,
@@ -1828,14 +2113,14 @@ function nr({
1828
2113
  shimmerColor: "#000"
1829
2114
  }
1830
2115
  ) : c }),
1831
- n && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? T(
2116
+ n && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? S(
1832
2117
  r.memorySearchTypeResultSummaryOne,
1833
2118
  {
1834
2119
  score: e.result.highestChunkScore.toFixed(
1835
2120
  2
1836
2121
  )
1837
2122
  }
1838
- ) : T(
2123
+ ) : S(
1839
2124
  r.memorySearchTypeResultSummary,
1840
2125
  {
1841
2126
  count: e.result.numberOfChunks,
@@ -1844,7 +2129,7 @@ function nr({
1844
2129
  )
1845
2130
  }
1846
2131
  ) }),
1847
- l && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
2132
+ l && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
1848
2133
  ]
1849
2134
  }
1850
2135
  )
@@ -1852,16 +2137,16 @@ function nr({
1852
2137
  }
1853
2138
  );
1854
2139
  }
1855
- const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1856
- const l = D(() => {
2140
+ const cr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2141
+ const l = P(() => {
1857
2142
  let c = -1;
1858
2143
  return e.memoryTypes.forEach((s, d) => {
1859
2144
  s.result == null && s.error == null && (c = d);
1860
2145
  }), c;
1861
2146
  }, [e.memoryTypes]);
1862
- return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
1863
- r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
1864
- w,
2147
+ return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
2148
+ r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
2149
+ I,
1865
2150
  {
1866
2151
  text: n.searchingMemoryTypes,
1867
2152
  duration: 2.5,
@@ -1869,8 +2154,8 @@ const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1869
2154
  color: "#999",
1870
2155
  shimmerColor: "#000"
1871
2156
  }
1872
- ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
1873
- nr,
2157
+ ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ o(
2158
+ lr,
1874
2159
  {
1875
2160
  item: c,
1876
2161
  t: n,
@@ -1878,7 +2163,7 @@ const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1878
2163
  },
1879
2164
  c.memoryTypeId
1880
2165
  )),
1881
- t !== void 0 && /* @__PURE__ */ i(
2166
+ t !== void 0 && /* @__PURE__ */ o(
1882
2167
  "div",
1883
2168
  {
1884
2169
  style: {
@@ -1887,44 +2172,44 @@ const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1887
2172
  marginTop: "4px",
1888
2173
  fontStyle: "italic"
1889
2174
  },
1890
- children: T(n.tookSeconds, { n: t })
2175
+ children: S(n.tookSeconds, { n: t })
1891
2176
  }
1892
2177
  )
1893
2178
  ] });
1894
- }, N = 12, B = 1.45, or = Math.ceil(
1895
- N * B
1896
- ), ir = Math.ceil(
1897
- 5 * N * B
2179
+ }, O = 12, B = 1.45, dr = Math.ceil(
2180
+ O * B
2181
+ ), mr = Math.ceil(
2182
+ 5 * O * B
1898
2183
  );
1899
- function O(e) {
2184
+ function N(e) {
1900
2185
  return e.queries != null && e.queries.length > 0;
1901
2186
  }
1902
- function ar(e) {
2187
+ function ur(e) {
1903
2188
  const r = e.reasoning;
1904
- return (r == null || r === "") && !O(e);
2189
+ return (r == null || r === "") && !N(e);
1905
2190
  }
1906
- function sr(e) {
1907
- if (O(e)) return 3;
2191
+ function yr(e) {
2192
+ if (N(e)) return 3;
1908
2193
  const r = e.reasoning;
1909
2194
  return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
1910
2195
  }
1911
- function lr({ phase: e }) {
1912
- return e === 3 ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
2196
+ function pr({ phase: e }) {
2197
+ return e === 3 ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1913
2198
  }
1914
- function cr({
2199
+ function gr({
1915
2200
  item: e,
1916
2201
  t: r,
1917
2202
  isActiveRow: t
1918
2203
  }) {
1919
- const n = ar(e), l = sr(e), c = e.reasoning, s = c != null && c.length > 0, d = F(null), [m, o] = v(!1), a = n && t, u = l === 2 && t && !O(e);
2204
+ const n = ur(e), l = yr(e), c = e.reasoning, s = c != null && c.length > 0, d = R(null), [m, i] = v(!1), a = n && t, y = l === 2 && t && !N(e);
1920
2205
  A(() => {
1921
- const p = d.current;
1922
- p != null && l === 1 && s && (p.scrollTop = p.scrollHeight);
2206
+ const g = d.current;
2207
+ g != null && l === 1 && s && (g.scrollTop = g.scrollHeight);
1923
2208
  }, [c, l, s]);
1924
- const y = T(r.searchingInMemoriesOfType, {
2209
+ const u = S(r.searchingInMemoriesOfType, {
1925
2210
  name: e.memoryTypeName
1926
- }), f = !n && l === 3;
1927
- return /* @__PURE__ */ g(
2211
+ }), h = !n && l === 3;
2212
+ return /* @__PURE__ */ p(
1928
2213
  b.div,
1929
2214
  {
1930
2215
  initial: { opacity: 0 },
@@ -1936,12 +2221,12 @@ function cr({
1936
2221
  borderBottom: "1px solid #eee",
1937
2222
  display: "flex",
1938
2223
  flexDirection: "row",
1939
- alignItems: f ? "flex-start" : "center",
2224
+ alignItems: h ? "flex-start" : "center",
1940
2225
  gap: "10px",
1941
2226
  minWidth: 0
1942
2227
  },
1943
2228
  children: [
1944
- /* @__PURE__ */ i(
2229
+ /* @__PURE__ */ o(
1945
2230
  "div",
1946
2231
  {
1947
2232
  style: {
@@ -1950,12 +2235,12 @@ function cr({
1950
2235
  justifyContent: "center",
1951
2236
  flexShrink: 0,
1952
2237
  width: 32,
1953
- ...f ? { paddingTop: 2 } : {}
2238
+ ...h ? { paddingTop: 2 } : {}
1954
2239
  },
1955
- children: /* @__PURE__ */ i(lr, { phase: n ? 1 : l })
2240
+ children: /* @__PURE__ */ o(pr, { phase: n ? 1 : l })
1956
2241
  }
1957
2242
  ),
1958
- /* @__PURE__ */ g(
2243
+ /* @__PURE__ */ p(
1959
2244
  "div",
1960
2245
  {
1961
2246
  style: {
@@ -1966,18 +2251,18 @@ function cr({
1966
2251
  flex: 1
1967
2252
  },
1968
2253
  children: [
1969
- /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ i(
1970
- w,
2254
+ /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ o(
2255
+ I,
1971
2256
  {
1972
- text: y,
2257
+ text: u,
1973
2258
  duration: 2.5,
1974
2259
  repeat: !0,
1975
2260
  color: "#999",
1976
2261
  shimmerColor: "#000"
1977
2262
  }
1978
2263
  ) : e.memoryTypeName }),
1979
- l === 1 && s && !O(e) && /* @__PURE__ */ g("div", { style: { minWidth: 0 }, children: [
1980
- /* @__PURE__ */ i(
2264
+ l === 1 && s && !N(e) && /* @__PURE__ */ p("div", { style: { minWidth: 0 }, children: [
2265
+ /* @__PURE__ */ o(
1981
2266
  "span",
1982
2267
  {
1983
2268
  style: {
@@ -1990,7 +2275,7 @@ function cr({
1990
2275
  children: r.memorySearchQueryReasoningLabel
1991
2276
  }
1992
2277
  ),
1993
- /* @__PURE__ */ i(
2278
+ /* @__PURE__ */ o(
1994
2279
  "div",
1995
2280
  {
1996
2281
  style: {
@@ -1999,18 +2284,18 @@ function cr({
1999
2284
  padding: "8px 10px",
2000
2285
  boxSizing: "border-box"
2001
2286
  },
2002
- children: /* @__PURE__ */ i(
2287
+ children: /* @__PURE__ */ o(
2003
2288
  "div",
2004
2289
  {
2005
2290
  ref: d,
2006
2291
  className: "memory-search-generating-reasoning-viewport",
2007
2292
  style: {
2008
- minHeight: or,
2009
- maxHeight: ir,
2293
+ minHeight: dr,
2294
+ maxHeight: mr,
2010
2295
  height: "auto",
2011
2296
  overflowY: "auto",
2012
2297
  overflowX: "hidden",
2013
- fontSize: N,
2298
+ fontSize: O,
2014
2299
  lineHeight: B,
2015
2300
  whiteSpace: "pre-wrap",
2016
2301
  wordBreak: "break-word",
@@ -2022,8 +2307,8 @@ function cr({
2022
2307
  }
2023
2308
  )
2024
2309
  ] }),
2025
- l === 2 && u && /* @__PURE__ */ i("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ i(
2026
- w,
2310
+ l === 2 && y && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
2311
+ I,
2027
2312
  {
2028
2313
  text: r.memorySearchGeneratingQueriesPending,
2029
2314
  duration: 2.5,
@@ -2032,9 +2317,9 @@ function cr({
2032
2317
  shimmerColor: "#000"
2033
2318
  }
2034
2319
  ) }),
2035
- l === 3 && /* @__PURE__ */ g(I, { children: [
2036
- /* @__PURE__ */ g("div", { style: { minWidth: 0 }, children: [
2037
- /* @__PURE__ */ i(
2320
+ l === 3 && /* @__PURE__ */ p(E, { children: [
2321
+ /* @__PURE__ */ p("div", { style: { minWidth: 0 }, children: [
2322
+ /* @__PURE__ */ o(
2038
2323
  "span",
2039
2324
  {
2040
2325
  style: {
@@ -2047,7 +2332,7 @@ function cr({
2047
2332
  children: r.memorySearchGeneratedQueriesHeading
2048
2333
  }
2049
2334
  ),
2050
- /* @__PURE__ */ i(
2335
+ /* @__PURE__ */ o(
2051
2336
  "div",
2052
2337
  {
2053
2338
  style: {
@@ -2055,7 +2340,7 @@ function cr({
2055
2340
  flexDirection: "column",
2056
2341
  gap: 6
2057
2342
  },
2058
- children: e.queries.map((p, x) => /* @__PURE__ */ i(
2343
+ children: e.queries.map((g, k) => /* @__PURE__ */ o(
2059
2344
  "div",
2060
2345
  {
2061
2346
  style: {
@@ -2064,19 +2349,19 @@ function cr({
2064
2349
  lineHeight: 1.5,
2065
2350
  wordBreak: "break-word"
2066
2351
  },
2067
- children: p.query
2352
+ children: g.query
2068
2353
  },
2069
- x
2354
+ k
2070
2355
  ))
2071
2356
  }
2072
2357
  )
2073
2358
  ] }),
2074
- s && /* @__PURE__ */ g(I, { children: [
2075
- /* @__PURE__ */ i(
2359
+ s && /* @__PURE__ */ p(E, { children: [
2360
+ /* @__PURE__ */ o(
2076
2361
  "button",
2077
2362
  {
2078
2363
  type: "button",
2079
- onClick: () => o((p) => !p),
2364
+ onClick: () => i((g) => !g),
2080
2365
  style: {
2081
2366
  alignSelf: "flex-start",
2082
2367
  border: "none",
@@ -2090,11 +2375,11 @@ function cr({
2090
2375
  children: m ? r.memorySearchHideReasoning : r.memorySearchViewReasoning
2091
2376
  }
2092
2377
  ),
2093
- m && /* @__PURE__ */ i(
2378
+ m && /* @__PURE__ */ o(
2094
2379
  "div",
2095
2380
  {
2096
2381
  style: {
2097
- fontSize: N,
2382
+ fontSize: O,
2098
2383
  lineHeight: B,
2099
2384
  whiteSpace: "pre-wrap",
2100
2385
  wordBreak: "break-word",
@@ -2115,16 +2400,16 @@ function cr({
2115
2400
  }
2116
2401
  );
2117
2402
  }
2118
- const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2119
- const l = D(() => {
2403
+ const hr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2404
+ const l = P(() => {
2120
2405
  let c = -1;
2121
2406
  return e.memoryTypes.forEach((s, d) => {
2122
- O(s) || (c = d);
2407
+ N(s) || (c = d);
2123
2408
  }), c;
2124
2409
  }, [e.memoryTypes]);
2125
- return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
2126
- r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
2127
- w,
2410
+ return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
2411
+ r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
2412
+ I,
2128
2413
  {
2129
2414
  text: n.memorySearchGeneratingQueries,
2130
2415
  duration: 2.5,
@@ -2132,8 +2417,8 @@ const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2132
2417
  color: "#999",
2133
2418
  shimmerColor: "#000"
2134
2419
  }
2135
- ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
2136
- cr,
2420
+ ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ o(
2421
+ gr,
2137
2422
  {
2138
2423
  item: c,
2139
2424
  t: n,
@@ -2141,7 +2426,7 @@ const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2141
2426
  },
2142
2427
  c.memoryTypeId
2143
2428
  )),
2144
- t !== void 0 && /* @__PURE__ */ i(
2429
+ t !== void 0 && /* @__PURE__ */ o(
2145
2430
  "div",
2146
2431
  {
2147
2432
  style: {
@@ -2150,73 +2435,20 @@ const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2150
2435
  marginTop: "4px",
2151
2436
  fontStyle: "italic"
2152
2437
  },
2153
- children: T(n.tookSeconds, { n: t })
2438
+ children: S(n.tookSeconds, { n: t })
2154
2439
  }
2155
2440
  )
2156
2441
  ] });
2157
2442
  };
2158
- function mr(e, r) {
2159
- const t = Math.min(e.length, r.length);
2160
- for (let n = t; n >= 0; n--)
2161
- if (e.slice(-n) === r.slice(0, n)) return n;
2162
- return 0;
2443
+ function fr(e) {
2444
+ return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ o(U, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 });
2163
2445
  }
2164
- const ur = `
2165
-
2166
- `;
2167
- function ne(e) {
2168
- var t, n;
2169
- if (e.length === 0) return "";
2170
- let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
2171
- for (let l = 1; l < e.length; l++) {
2172
- const c = ((n = e[l]) == null ? void 0 : n.content) ?? "";
2173
- if (c === "") continue;
2174
- if (r === "") {
2175
- r = c;
2176
- continue;
2177
- }
2178
- const s = mr(r, c);
2179
- s === 0 ? r += ur + c : r += c.slice(s);
2180
- }
2181
- return r;
2182
- }
2183
- function te(e, r) {
2184
- if (e.length === 0) return "";
2185
- if (e.length === 1)
2186
- return T(r.memorySearchPagesSingle, {
2187
- n: e[0]
2188
- });
2189
- if (e.length === 2)
2190
- return T(r.memorySearchPagesTwo, {
2191
- a: e[0],
2192
- b: e[1]
2193
- });
2194
- const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
2195
- return T(r.memorySearchPagesMultiple, {
2196
- list: n,
2197
- n: t
2198
- });
2199
- }
2200
- function oe(e) {
2201
- const r = /* @__PURE__ */ new Set();
2202
- for (const t of e)
2203
- for (const n of t.pageNumbers) r.add(n);
2204
- return [...r].sort((t, n) => t - n);
2205
- }
2206
- function ie(e) {
2207
- const r = e.memoryTypeName.trim();
2208
- if (r !== "") return r;
2209
- if (e.memoryTypeId !== "") return e.memoryTypeId;
2210
- }
2211
- function yr(e) {
2212
- return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 });
2213
- }
2214
- function gr(e, r) {
2446
+ function xr(e, r) {
2215
2447
  if (e.error != null)
2216
- return /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
2448
+ return /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
2217
2449
  if (e.result == null)
2218
- return /* @__PURE__ */ i("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ i(
2219
- w,
2450
+ return /* @__PURE__ */ o("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ o(
2451
+ I,
2220
2452
  {
2221
2453
  text: r.searching,
2222
2454
  duration: 2.5,
@@ -2225,16 +2457,16 @@ function gr(e, r) {
2225
2457
  shimmerColor: "#000"
2226
2458
  }
2227
2459
  ) });
2228
- const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : T(r.chunksFound, { n: t.numberOfChunks }), l = T(r.scoreLabel, {
2460
+ const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : S(r.chunksFound, { n: t.numberOfChunks }), l = S(r.scoreLabel, {
2229
2461
  n: t.highestChunkScore.toFixed(2)
2230
2462
  });
2231
- return /* @__PURE__ */ g("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
2463
+ return /* @__PURE__ */ p("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
2232
2464
  n,
2233
2465
  " · ",
2234
2466
  l
2235
2467
  ] });
2236
2468
  }
2237
- function pr({
2469
+ function Sr({
2238
2470
  items: e,
2239
2471
  queryRow: r,
2240
2472
  onExploreQueryResultClick: t,
@@ -2242,7 +2474,7 @@ function pr({
2242
2474
  }) {
2243
2475
  const [l, c] = v(null);
2244
2476
  if (e.length === 0)
2245
- return /* @__PURE__ */ i(
2477
+ return /* @__PURE__ */ o(
2246
2478
  "div",
2247
2479
  {
2248
2480
  style: {
@@ -2254,7 +2486,7 @@ function pr({
2254
2486
  }
2255
2487
  );
2256
2488
  const s = !!t;
2257
- return /* @__PURE__ */ i(
2489
+ return /* @__PURE__ */ o(
2258
2490
  "div",
2259
2491
  {
2260
2492
  style: {
@@ -2266,25 +2498,25 @@ function pr({
2266
2498
  borderTop: "1px solid #f0f0f0"
2267
2499
  },
2268
2500
  children: e.map((d, m) => {
2269
- const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = oe(
2501
+ const i = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = K(
2270
2502
  d.chunks
2271
- ), u = [
2272
- ie(d),
2273
- T(n.scoreLabel, {
2503
+ ), y = [
2504
+ V(d),
2505
+ S(n.scoreLabel, {
2274
2506
  n: d.matchingChunkScore.toFixed(2)
2275
2507
  }),
2276
- a.length > 0 ? te(a, n) : n.pagesNotAvailable
2508
+ a.length > 0 ? q(a, n) : n.pagesNotAvailable
2277
2509
  ].filter(
2278
- (x) => x != null && x !== ""
2279
- ), y = {
2510
+ (k) => k != null && k !== ""
2511
+ ), u = {
2280
2512
  memoryId: d.memoryId,
2281
2513
  memoryTitle: d.memoryTitle,
2282
2514
  pageNumbers: a,
2283
2515
  memoryTypeId: r.memoryTypeId,
2284
2516
  memoryTypeName: r.memoryTypeName,
2285
2517
  query: r.query
2286
- }, f = `${r.query}::${d.memoryId}::${m}`, p = l === f;
2287
- return /* @__PURE__ */ g(
2518
+ }, h = `${r.query}::${d.memoryId}::${m}`, g = l === h;
2519
+ return /* @__PURE__ */ p(
2288
2520
  "div",
2289
2521
  {
2290
2522
  style: {
@@ -2298,7 +2530,7 @@ function pr({
2298
2530
  minWidth: 0
2299
2531
  },
2300
2532
  children: [
2301
- /* @__PURE__ */ g(
2533
+ /* @__PURE__ */ p(
2302
2534
  "div",
2303
2535
  {
2304
2536
  style: {
@@ -2309,7 +2541,7 @@ function pr({
2309
2541
  gap: "6px"
2310
2542
  },
2311
2543
  children: [
2312
- /* @__PURE__ */ i(
2544
+ /* @__PURE__ */ o(
2313
2545
  "span",
2314
2546
  {
2315
2547
  style: {
@@ -2317,10 +2549,10 @@ function pr({
2317
2549
  fontWeight: 600,
2318
2550
  color: "#333"
2319
2551
  },
2320
- children: o
2552
+ children: i
2321
2553
  }
2322
2554
  ),
2323
- /* @__PURE__ */ i(
2555
+ /* @__PURE__ */ o(
2324
2556
  "span",
2325
2557
  {
2326
2558
  style: {
@@ -2330,12 +2562,12 @@ function pr({
2330
2562
  whiteSpace: "pre-wrap",
2331
2563
  wordBreak: "break-word"
2332
2564
  },
2333
- children: ne(
2565
+ children: j(
2334
2566
  d.chunks
2335
2567
  )
2336
2568
  }
2337
2569
  ),
2338
- /* @__PURE__ */ i(
2570
+ /* @__PURE__ */ o(
2339
2571
  "div",
2340
2572
  {
2341
2573
  style: {
@@ -2344,23 +2576,23 @@ function pr({
2344
2576
  color: "#94a3b8",
2345
2577
  lineHeight: 1.35
2346
2578
  },
2347
- children: u.join(" · ")
2579
+ children: y.join(" · ")
2348
2580
  }
2349
2581
  )
2350
2582
  ]
2351
2583
  }
2352
2584
  ),
2353
- s && /* @__PURE__ */ g(
2585
+ s && /* @__PURE__ */ p(
2354
2586
  "button",
2355
2587
  {
2356
2588
  type: "button",
2357
- "aria-busy": p,
2358
- disabled: p,
2589
+ "aria-busy": g,
2590
+ disabled: g,
2359
2591
  onClick: async () => {
2360
- c(f);
2592
+ c(h);
2361
2593
  try {
2362
2594
  await t(
2363
- y
2595
+ u
2364
2596
  );
2365
2597
  } finally {
2366
2598
  c(null);
@@ -2376,14 +2608,14 @@ function pr({
2376
2608
  background: "#eff6ff",
2377
2609
  border: "1px solid #bfdbfe",
2378
2610
  borderRadius: 6,
2379
- cursor: p ? "wait" : "pointer",
2611
+ cursor: g ? "wait" : "pointer",
2380
2612
  fontFamily: "inherit",
2381
2613
  display: "inline-flex",
2382
2614
  alignItems: "center",
2383
2615
  gap: 8
2384
2616
  },
2385
2617
  children: [
2386
- p && /* @__PURE__ */ i(
2618
+ g && /* @__PURE__ */ o(
2387
2619
  "span",
2388
2620
  {
2389
2621
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -2402,7 +2634,7 @@ function pr({
2402
2634
  }
2403
2635
  );
2404
2636
  }
2405
- function hr(e) {
2637
+ function Tr(e) {
2406
2638
  const r = [], t = /* @__PURE__ */ new Map();
2407
2639
  return e.forEach((n, l) => {
2408
2640
  let c = t.get(n.memoryTypeId);
@@ -2413,7 +2645,7 @@ function hr(e) {
2413
2645
  }, t.set(n.memoryTypeId, c)), c.items.push({ item: n, flatIndex: l });
2414
2646
  }), r.map((n) => t.get(n));
2415
2647
  }
2416
- function fr({
2648
+ function kr({
2417
2649
  group: e,
2418
2650
  t: r,
2419
2651
  lastInFlightIndex: t,
@@ -2422,10 +2654,10 @@ function fr({
2422
2654
  toggleExpanded: c,
2423
2655
  onExploreQueryResultClick: s
2424
2656
  }) {
2425
- const d = e.items.map((o) => o.item), m = d.some(
2426
- (o) => o.result == null && o.error == null
2657
+ const d = e.items.map((i) => i.item), m = d.some(
2658
+ (i) => i.result == null && i.error == null
2427
2659
  );
2428
- return /* @__PURE__ */ g(
2660
+ return /* @__PURE__ */ p(
2429
2661
  b.div,
2430
2662
  {
2431
2663
  initial: { opacity: 0 },
@@ -2442,7 +2674,7 @@ function fr({
2442
2674
  minWidth: 0
2443
2675
  },
2444
2676
  children: [
2445
- /* @__PURE__ */ i(
2677
+ /* @__PURE__ */ o(
2446
2678
  "div",
2447
2679
  {
2448
2680
  style: {
@@ -2453,10 +2685,10 @@ function fr({
2453
2685
  width: 32,
2454
2686
  ...m ? {} : { paddingTop: 2 }
2455
2687
  },
2456
- children: yr(d)
2688
+ children: fr(d)
2457
2689
  }
2458
2690
  ),
2459
- /* @__PURE__ */ g(
2691
+ /* @__PURE__ */ p(
2460
2692
  "div",
2461
2693
  {
2462
2694
  style: {
@@ -2467,22 +2699,22 @@ function fr({
2467
2699
  flex: 1
2468
2700
  },
2469
2701
  children: [
2470
- /* @__PURE__ */ i(
2702
+ /* @__PURE__ */ o(
2471
2703
  "span",
2472
2704
  {
2473
2705
  style: {
2474
2706
  fontSize: 12,
2475
2707
  color: "#888"
2476
2708
  },
2477
- children: T(r.memorySearchExploreQueryTypeLabel, {
2709
+ children: S(r.memorySearchExploreQueryTypeLabel, {
2478
2710
  name: e.memoryTypeName
2479
2711
  })
2480
2712
  }
2481
2713
  ),
2482
- e.items.map(({ item: o, flatIndex: a }) => {
2483
- var h;
2484
- const u = o.result != null, y = o.error != null, f = a === t && n && !u && !y, p = l[a] === !0, x = ((h = o.result) == null ? void 0 : h.items) ?? [];
2485
- return /* @__PURE__ */ g(
2714
+ e.items.map(({ item: i, flatIndex: a }) => {
2715
+ var x;
2716
+ const y = i.result != null, u = i.error != null, h = a === t && n && !y && !u, g = l[a] === !0, k = ((x = i.result) == null ? void 0 : x.items) ?? [];
2717
+ return /* @__PURE__ */ p(
2486
2718
  "div",
2487
2719
  {
2488
2720
  style: {
@@ -2492,7 +2724,7 @@ function fr({
2492
2724
  minWidth: 0
2493
2725
  },
2494
2726
  children: [
2495
- /* @__PURE__ */ g(
2727
+ /* @__PURE__ */ p(
2496
2728
  "div",
2497
2729
  {
2498
2730
  style: {
@@ -2504,7 +2736,7 @@ function fr({
2504
2736
  minWidth: 0
2505
2737
  },
2506
2738
  children: [
2507
- /* @__PURE__ */ i(
2739
+ /* @__PURE__ */ o(
2508
2740
  "span",
2509
2741
  {
2510
2742
  style: {
@@ -2515,19 +2747,19 @@ function fr({
2515
2747
  flex: "1 1 12rem",
2516
2748
  minWidth: 0
2517
2749
  },
2518
- children: f ? /* @__PURE__ */ i(
2519
- w,
2750
+ children: h ? /* @__PURE__ */ o(
2751
+ I,
2520
2752
  {
2521
- text: o.query,
2753
+ text: i.query,
2522
2754
  duration: 2.5,
2523
2755
  repeat: !0,
2524
2756
  color: "#999",
2525
2757
  shimmerColor: "#000"
2526
2758
  }
2527
- ) : o.query
2759
+ ) : i.query
2528
2760
  }
2529
2761
  ),
2530
- /* @__PURE__ */ g(
2762
+ /* @__PURE__ */ p(
2531
2763
  "div",
2532
2764
  {
2533
2765
  style: {
@@ -2538,8 +2770,8 @@ function fr({
2538
2770
  flexShrink: 0
2539
2771
  },
2540
2772
  children: [
2541
- gr(o, r),
2542
- u && /* @__PURE__ */ i(
2773
+ xr(i, r),
2774
+ y && /* @__PURE__ */ o(
2543
2775
  "button",
2544
2776
  {
2545
2777
  type: "button",
@@ -2554,7 +2786,7 @@ function fr({
2554
2786
  textDecoration: "underline",
2555
2787
  fontFamily: "inherit"
2556
2788
  },
2557
- children: p ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2789
+ children: g ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2558
2790
  }
2559
2791
  )
2560
2792
  ]
@@ -2563,18 +2795,18 @@ function fr({
2563
2795
  ]
2564
2796
  }
2565
2797
  ),
2566
- u && p && /* @__PURE__ */ i(
2567
- pr,
2798
+ y && g && /* @__PURE__ */ o(
2799
+ Sr,
2568
2800
  {
2569
- items: x,
2570
- queryRow: o,
2801
+ items: k,
2802
+ queryRow: i,
2571
2803
  onExploreQueryResultClick: s,
2572
2804
  t: r
2573
2805
  }
2574
2806
  )
2575
2807
  ]
2576
2808
  },
2577
- `${e.memoryTypeId}-${a}-${o.query}`
2809
+ `${e.memoryTypeId}-${a}-${i.query}`
2578
2810
  );
2579
2811
  })
2580
2812
  ]
@@ -2584,7 +2816,7 @@ function fr({
2584
2816
  }
2585
2817
  );
2586
2818
  }
2587
- const Sr = ({
2819
+ const br = ({
2588
2820
  data: e,
2589
2821
  isLatest: r = !1,
2590
2822
  durationSeconds: t,
@@ -2593,23 +2825,23 @@ const Sr = ({
2593
2825
  }) => {
2594
2826
  const [c, s] = v(
2595
2827
  {}
2596
- ), d = G((a) => {
2597
- s((u) => ({
2598
- ...u,
2599
- [a]: !u[a]
2828
+ ), d = W((a) => {
2829
+ s((y) => ({
2830
+ ...y,
2831
+ [a]: !y[a]
2600
2832
  }));
2601
- }, []), m = D(() => {
2833
+ }, []), m = P(() => {
2602
2834
  let a = -1;
2603
- return e.queries.forEach((u, y) => {
2604
- u.result == null && u.error == null && (a = y);
2835
+ return e.queries.forEach((y, u) => {
2836
+ y.result == null && y.error == null && (a = u);
2605
2837
  }), a;
2606
- }, [e.queries]), o = D(
2607
- () => hr(e.queries),
2838
+ }, [e.queries]), i = P(
2839
+ () => Tr(e.queries),
2608
2840
  [e.queries]
2609
2841
  );
2610
- return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
2611
- r && !t && e.queries.length === 0 ? /* @__PURE__ */ i(
2612
- w,
2842
+ return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
2843
+ r && !t && e.queries.length === 0 ? /* @__PURE__ */ o(
2844
+ I,
2613
2845
  {
2614
2846
  text: l.memorySearchExploringQueries,
2615
2847
  duration: 2.5,
@@ -2617,8 +2849,8 @@ const Sr = ({
2617
2849
  color: "#999",
2618
2850
  shimmerColor: "#000"
2619
2851
  }
2620
- ) : o.map((a) => /* @__PURE__ */ i(
2621
- fr,
2852
+ ) : i.map((a) => /* @__PURE__ */ o(
2853
+ kr,
2622
2854
  {
2623
2855
  group: a,
2624
2856
  t: l,
@@ -2630,7 +2862,7 @@ const Sr = ({
2630
2862
  },
2631
2863
  a.memoryTypeId
2632
2864
  )),
2633
- t !== void 0 && /* @__PURE__ */ i(
2865
+ t !== void 0 && /* @__PURE__ */ o(
2634
2866
  "div",
2635
2867
  {
2636
2868
  style: {
@@ -2639,14 +2871,14 @@ const Sr = ({
2639
2871
  marginTop: "4px",
2640
2872
  fontStyle: "italic"
2641
2873
  },
2642
- children: T(l.tookSeconds, { n: t })
2874
+ children: S(l.tookSeconds, { n: t })
2643
2875
  }
2644
2876
  )
2645
2877
  ] });
2646
- }, xr = ({ data: e, onSearchResultClick: r, t }) => {
2878
+ }, vr = ({ data: e, onSearchResultClick: r, t }) => {
2647
2879
  const n = e.response.items, l = !!r, [c, s] = v(null);
2648
- return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
2649
- /* @__PURE__ */ i(
2880
+ return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
2881
+ /* @__PURE__ */ o(
2650
2882
  b.div,
2651
2883
  {
2652
2884
  style: {
@@ -2661,7 +2893,7 @@ const Sr = ({
2661
2893
  children: t.resultsHeading
2662
2894
  }
2663
2895
  ),
2664
- /* @__PURE__ */ i(
2896
+ /* @__PURE__ */ o(
2665
2897
  "div",
2666
2898
  {
2667
2899
  style: {
@@ -2670,24 +2902,24 @@ const Sr = ({
2670
2902
  gap: 0
2671
2903
  },
2672
2904
  children: n.map((d, m) => {
2673
- const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = oe(
2905
+ const i = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = K(
2674
2906
  d.chunks
2675
- ), u = [
2676
- ie(d),
2677
- T(t.scoreLabel, {
2907
+ ), y = [
2908
+ V(d),
2909
+ S(t.scoreLabel, {
2678
2910
  n: d.matchingChunkScore.toFixed(2)
2679
2911
  }),
2680
- a.length > 0 ? te(a, t) : t.pagesNotAvailable
2912
+ a.length > 0 ? q(a, t) : t.pagesNotAvailable
2681
2913
  ].filter(
2682
- (x) => x != null && x !== ""
2683
- ), y = {
2914
+ (k) => k != null && k !== ""
2915
+ ), u = {
2684
2916
  memoryId: d.memoryId,
2685
2917
  memoryTitle: d.memoryTitle,
2686
2918
  memoryTypeId: d.memoryTypeId,
2687
2919
  memoryTypeName: d.memoryTypeName,
2688
2920
  pageNumbers: a
2689
- }, f = `${d.memoryId}-${m}`, p = c === f;
2690
- return /* @__PURE__ */ g(
2921
+ }, h = `${d.memoryId}-${m}`, g = c === h;
2922
+ return /* @__PURE__ */ p(
2691
2923
  b.div,
2692
2924
  {
2693
2925
  initial: { opacity: 0 },
@@ -2704,7 +2936,7 @@ const Sr = ({
2704
2936
  minWidth: 0
2705
2937
  },
2706
2938
  children: [
2707
- /* @__PURE__ */ g(
2939
+ /* @__PURE__ */ p(
2708
2940
  "div",
2709
2941
  {
2710
2942
  style: {
@@ -2715,7 +2947,7 @@ const Sr = ({
2715
2947
  gap: "6px"
2716
2948
  },
2717
2949
  children: [
2718
- /* @__PURE__ */ i(
2950
+ /* @__PURE__ */ o(
2719
2951
  "span",
2720
2952
  {
2721
2953
  style: {
@@ -2723,10 +2955,10 @@ const Sr = ({
2723
2955
  fontWeight: 600,
2724
2956
  color: "#333"
2725
2957
  },
2726
- children: o
2958
+ children: i
2727
2959
  }
2728
2960
  ),
2729
- /* @__PURE__ */ i(
2961
+ /* @__PURE__ */ o(
2730
2962
  "span",
2731
2963
  {
2732
2964
  style: {
@@ -2736,10 +2968,10 @@ const Sr = ({
2736
2968
  whiteSpace: "pre-wrap",
2737
2969
  wordBreak: "break-word"
2738
2970
  },
2739
- children: ne(d.chunks)
2971
+ children: j(d.chunks)
2740
2972
  }
2741
2973
  ),
2742
- /* @__PURE__ */ i(
2974
+ /* @__PURE__ */ o(
2743
2975
  "div",
2744
2976
  {
2745
2977
  style: {
@@ -2748,22 +2980,22 @@ const Sr = ({
2748
2980
  color: "#94a3b8",
2749
2981
  lineHeight: 1.35
2750
2982
  },
2751
- children: u.join(" · ")
2983
+ children: y.join(" · ")
2752
2984
  }
2753
2985
  )
2754
2986
  ]
2755
2987
  }
2756
2988
  ),
2757
- l && /* @__PURE__ */ g(
2989
+ l && /* @__PURE__ */ p(
2758
2990
  "button",
2759
2991
  {
2760
2992
  type: "button",
2761
- "aria-busy": p,
2762
- disabled: p,
2993
+ "aria-busy": g,
2994
+ disabled: g,
2763
2995
  onClick: async () => {
2764
- s(f);
2996
+ s(h);
2765
2997
  try {
2766
- await r(y);
2998
+ await r(u);
2767
2999
  } finally {
2768
3000
  s(null);
2769
3001
  }
@@ -2778,14 +3010,14 @@ const Sr = ({
2778
3010
  background: "#eff6ff",
2779
3011
  border: "1px solid #bfdbfe",
2780
3012
  borderRadius: 6,
2781
- cursor: p ? "wait" : "pointer",
3013
+ cursor: g ? "wait" : "pointer",
2782
3014
  fontFamily: "inherit",
2783
3015
  display: "inline-flex",
2784
3016
  alignItems: "center",
2785
3017
  gap: 8
2786
3018
  },
2787
3019
  children: [
2788
- p && /* @__PURE__ */ i(
3020
+ g && /* @__PURE__ */ o(
2789
3021
  "span",
2790
3022
  {
2791
3023
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -2804,7 +3036,7 @@ const Sr = ({
2804
3036
  }
2805
3037
  )
2806
3038
  ] });
2807
- }, Tr = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
3039
+ }, Cr = ({ message: e }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
2808
3040
  b.div,
2809
3041
  {
2810
3042
  initial: { opacity: 0, y: -10 },
@@ -2815,7 +3047,7 @@ const Sr = ({
2815
3047
  alignItems: "flex-start",
2816
3048
  gap: "10px"
2817
3049
  },
2818
- children: /* @__PURE__ */ i(
3050
+ children: /* @__PURE__ */ o(
2819
3051
  "span",
2820
3052
  {
2821
3053
  style: {
@@ -2827,7 +3059,7 @@ const Sr = ({
2827
3059
  }
2828
3060
  )
2829
3061
  }
2830
- ) }), kr = ({
3062
+ ) }), wr = ({
2831
3063
  progressViewItems: e,
2832
3064
  loadingText: r,
2833
3065
  t,
@@ -2835,61 +3067,61 @@ const Sr = ({
2835
3067
  onSearchResultClick: l,
2836
3068
  onExploreQueryResultClick: c
2837
3069
  }) => {
2838
- const s = F(null);
3070
+ const s = R(null);
2839
3071
  A(() => {
2840
3072
  s.current && (s.current.scrollTop = s.current.scrollHeight);
2841
3073
  }, [e.length]);
2842
- const d = (o) => {
2843
- const a = o.item.data;
3074
+ const d = (i) => {
3075
+ const a = i.item.data;
2844
3076
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Text")
2845
- return /* @__PURE__ */ i(V, { text: a.text });
3077
+ return /* @__PURE__ */ o(Z, { text: a.text });
2846
3078
  if (a.taskType === "StructuredChatCompletion" && a.eventType === "Completed")
2847
- return /* @__PURE__ */ i(Be, { data: a });
3079
+ return /* @__PURE__ */ o(We, { data: a });
2848
3080
  if (a.taskType === "MemoryChat")
2849
3081
  switch (a.eventType) {
2850
3082
  case "Text":
2851
- return /* @__PURE__ */ i(V, { text: a.text });
3083
+ return /* @__PURE__ */ o(Z, { text: a.text });
2852
3084
  case "FindMemories":
2853
- return /* @__PURE__ */ i(
2854
- _e,
3085
+ return /* @__PURE__ */ o(
3086
+ Ge,
2855
3087
  {
2856
3088
  data: a,
2857
- isLatest: o.isLatest,
2858
- durationSeconds: o.durationSeconds,
3089
+ isLatest: i.isLatest,
3090
+ durationSeconds: i.durationSeconds,
2859
3091
  t
2860
3092
  }
2861
3093
  );
2862
3094
  case "FindMemoriesResult":
2863
- return /* @__PURE__ */ i(
2864
- Ge,
3095
+ return /* @__PURE__ */ o(
3096
+ Qe,
2865
3097
  {
2866
3098
  data: a,
2867
3099
  t
2868
3100
  }
2869
3101
  );
2870
3102
  case "Search":
2871
- return /* @__PURE__ */ i(
2872
- He,
3103
+ return /* @__PURE__ */ o(
3104
+ _e,
2873
3105
  {
2874
3106
  data: a,
2875
- isLatest: o.isLatest,
2876
- durationSeconds: o.durationSeconds,
3107
+ isLatest: i.isLatest,
3108
+ durationSeconds: i.durationSeconds,
2877
3109
  t
2878
3110
  }
2879
3111
  );
2880
3112
  case "FindSources":
2881
- return /* @__PURE__ */ i(
2882
- Qe,
3113
+ return /* @__PURE__ */ o(
3114
+ Ue,
2883
3115
  {
2884
3116
  data: a,
2885
- isLatest: o.isLatest,
2886
- durationSeconds: o.durationSeconds,
3117
+ isLatest: i.isLatest,
3118
+ durationSeconds: i.durationSeconds,
2887
3119
  t
2888
3120
  }
2889
3121
  );
2890
3122
  case "SourcesResult":
2891
- return /* @__PURE__ */ i(
2892
- je,
3123
+ return /* @__PURE__ */ o(
3124
+ qe,
2893
3125
  {
2894
3126
  data: a,
2895
3127
  onSourceClick: n,
@@ -2897,56 +3129,63 @@ const Sr = ({
2897
3129
  }
2898
3130
  );
2899
3131
  case "ExploreMemories":
2900
- return /* @__PURE__ */ i(
2901
- Xe,
3132
+ return /* @__PURE__ */ o(
3133
+ Je,
3134
+ {
3135
+ data: a,
3136
+ completed: i.completed,
3137
+ isLatest: i.isLatest,
3138
+ t
3139
+ }
3140
+ );
3141
+ case "ChunkResults":
3142
+ return /* @__PURE__ */ o(
3143
+ ir,
2902
3144
  {
2903
3145
  data: a,
2904
- completed: o.completed,
2905
- isLatest: o.isLatest,
3146
+ onSearchResultClick: l,
2906
3147
  t
2907
3148
  }
2908
3149
  );
2909
- case "ChunkResult":
2910
- return /* @__PURE__ */ i(Ze, { data: a, t });
2911
3150
  case "Completed":
2912
3151
  return null;
2913
3152
  }
2914
3153
  if (a.taskType === "MemorySearch")
2915
3154
  switch (a.eventType) {
2916
3155
  case "GeneratingQueries":
2917
- return /* @__PURE__ */ i(
2918
- dr,
3156
+ return /* @__PURE__ */ o(
3157
+ hr,
2919
3158
  {
2920
3159
  data: a,
2921
- isLatest: o.isLatest,
2922
- durationSeconds: o.durationSeconds,
3160
+ isLatest: i.isLatest,
3161
+ durationSeconds: i.durationSeconds,
2923
3162
  t
2924
3163
  }
2925
3164
  );
2926
3165
  case "ExploreQueries":
2927
- return /* @__PURE__ */ i(
2928
- Sr,
3166
+ return /* @__PURE__ */ o(
3167
+ br,
2929
3168
  {
2930
3169
  data: a,
2931
- isLatest: o.isLatest,
2932
- durationSeconds: o.durationSeconds,
3170
+ isLatest: i.isLatest,
3171
+ durationSeconds: i.durationSeconds,
2933
3172
  onExploreQueryResultClick: c,
2934
3173
  t
2935
3174
  }
2936
3175
  );
2937
3176
  case "SearchMemoryTypes":
2938
- return /* @__PURE__ */ i(
2939
- tr,
3177
+ return /* @__PURE__ */ o(
3178
+ cr,
2940
3179
  {
2941
3180
  data: a,
2942
- isLatest: o.isLatest,
2943
- durationSeconds: o.durationSeconds,
3181
+ isLatest: i.isLatest,
3182
+ durationSeconds: i.durationSeconds,
2944
3183
  t
2945
3184
  }
2946
3185
  );
2947
3186
  case "Completed":
2948
- return /* @__PURE__ */ i(
2949
- xr,
3187
+ return /* @__PURE__ */ o(
3188
+ vr,
2950
3189
  {
2951
3190
  data: a,
2952
3191
  onSearchResultClick: l,
@@ -2954,11 +3193,11 @@ const Sr = ({
2954
3193
  }
2955
3194
  );
2956
3195
  }
2957
- return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ i(Tr, { message: a.message }) : null;
3196
+ return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ o(Cr, { message: a.message }) : null;
2958
3197
  };
2959
3198
  if (e.length === 0)
2960
- return /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
2961
- w,
3199
+ return /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
3200
+ I,
2962
3201
  {
2963
3202
  text: r ?? t.processingYourTask,
2964
3203
  duration: 1.5,
@@ -2968,20 +3207,22 @@ const Sr = ({
2968
3207
  shimmerColor: "#000"
2969
3208
  }
2970
3209
  ) });
2971
- const m = e.filter((o, a) => {
2972
- const u = o.item.data;
2973
- return u.taskType === "MemoryChat" && u.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
2974
- (h) => h.item.data.taskType === "MemoryChat" && h.item.data.eventType === "ExploreMemories"
2975
- ) : u.taskType === "MemorySearch" && u.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
2976
- (h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "GeneratingQueries"
2977
- ) : u.taskType === "MemorySearch" && u.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
2978
- (h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "ExploreQueries"
3210
+ const m = e.filter((i, a) => {
3211
+ const y = i.item.data;
3212
+ return y.taskType === "MemoryChat" && y.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
3213
+ (f) => f.item.data.taskType === "MemoryChat" && f.item.data.eventType === "ExploreMemories"
3214
+ ) : y.taskType === "MemorySearch" && y.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
3215
+ (f) => f.item.data.taskType === "MemorySearch" && f.item.data.eventType === "GeneratingQueries"
3216
+ ) : y.taskType === "MemorySearch" && y.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
3217
+ (f) => f.item.data.taskType === "MemorySearch" && f.item.data.eventType === "ExploreQueries"
3218
+ ) : y.taskType === "MemoryChat" && y.eventType === "ChunkResults" ? !e.slice(a + 1).some(
3219
+ (f) => f.item.data.taskType === "MemoryChat" && f.item.data.eventType === "ChunkResults"
2979
3220
  ) : !0;
2980
3221
  });
2981
- return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(J, { children: m.map((o, a) => /* @__PURE__ */ i(
3222
+ return /* @__PURE__ */ o("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ o(re, { children: m.map((i, a) => /* @__PURE__ */ o(
2982
3223
  b.div,
2983
3224
  {
2984
- id: `agent-task-progress-item-${o.item.progressItemId}`,
3225
+ id: `agent-task-progress-item-${i.item.progressItemId}`,
2985
3226
  initial: { opacity: 0, y: -20 },
2986
3227
  animate: { opacity: 1, y: 0 },
2987
3228
  transition: {
@@ -2989,11 +3230,11 @@ const Sr = ({
2989
3230
  delay: a * 0.1,
2990
3231
  ease: "easeOut"
2991
3232
  },
2992
- children: d(o)
3233
+ children: d(i)
2993
3234
  },
2994
- o.item.progressItemId
3235
+ i.item.progressItemId
2995
3236
  )) }) });
2996
- }, Rr = ({
3237
+ }, zr = ({
2997
3238
  agentTask: e,
2998
3239
  mode: r = "verbose",
2999
3240
  language: t,
@@ -3001,15 +3242,15 @@ const Sr = ({
3001
3242
  onSearchResultClick: l,
3002
3243
  onExploreQueryResultClick: c
3003
3244
  }) => {
3004
- const s = ze(e), d = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : t ?? "en", m = $e(d);
3005
- return r === "simple" ? /* @__PURE__ */ i(
3006
- Ne,
3245
+ const s = Ne(e), d = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : t ?? "en", m = He(d);
3246
+ return r === "simple" ? /* @__PURE__ */ o(
3247
+ Be,
3007
3248
  {
3008
3249
  progressViewItems: s,
3009
3250
  t: m
3010
3251
  }
3011
- ) : /* @__PURE__ */ i(
3012
- kr,
3252
+ ) : /* @__PURE__ */ o(
3253
+ wr,
3013
3254
  {
3014
3255
  progressViewItems: s,
3015
3256
  loadingText: e.loadingText,
@@ -3021,10 +3262,10 @@ const Sr = ({
3021
3262
  );
3022
3263
  };
3023
3264
  export {
3024
- Rr as AgentTaskProgress,
3025
- z as Checkmark,
3026
- Ar as FencyProvider,
3027
- xr as MemorySearchCompletedResults,
3265
+ zr as AgentTaskProgress,
3266
+ L as Checkmark,
3267
+ Dr as FencyProvider,
3268
+ vr as MemorySearchCompletedResults,
3028
3269
  U as XMark,
3029
- Fr as useAgentTasks
3270
+ Lr as useAgentTasks
3030
3271
  };