@fencyai/react 0.1.156 → 0.1.158

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,55 +1,55 @@
1
- import { jsxs as y, jsx as o, Fragment as E } from "react/jsx-runtime";
1
+ import { jsxs as y, jsx as i, Fragment as E } from "react/jsx-runtime";
2
2
  import { createStream as ie, isStreamTimeoutEvent as ae, isStreamNotFoundEvent as se, isAgentTaskProgressItemUpdatedEvent as le, createAgentTask as ce } from "@fencyai/js";
3
- import { createContext as de, useState as v, useRef as A, useEffect as I, useCallback as G, useContext as ue, useMemo as D } from "react";
4
- import { useInView as me, motion as T, AnimatePresence as X } from "motion/react";
3
+ import { createContext as de, useState as b, useRef as A, useEffect as M, useCallback as G, useContext as me, useMemo as D } from "react";
4
+ import { useInView as ue, motion as T, AnimatePresence as X } from "motion/react";
5
5
  import pe from "react-markdown";
6
6
  import { Prism as J } from "react-syntax-highlighter";
7
- import ge from "remark-gfm";
7
+ import ye from "remark-gfm";
8
8
  import './assets/index.css';const Y = de(
9
9
  void 0
10
10
  );
11
- async function ye(e, r) {
11
+ async function ge(e, r) {
12
12
  const n = e.getReader();
13
13
  let t;
14
14
  for (; !(t = await n.read()).done; )
15
15
  r(t.value);
16
16
  }
17
17
  function he(e) {
18
- let r, n, t, c = !1;
19
- return function(l) {
20
- r === void 0 ? (r = l, n = 0, t = -1) : r = Se(r, l);
18
+ let r, n, t, l = !1;
19
+ return function(s) {
20
+ r === void 0 ? (r = s, n = 0, t = -1) : r = Se(r, s);
21
21
  const d = r.length;
22
- let u = 0;
22
+ let m = 0;
23
23
  for (; n < d; ) {
24
- c && (r[n] === 10 && (u = ++n), c = !1);
25
- let i = -1;
26
- for (; n < d && i === -1; ++n)
24
+ l && (r[n] === 10 && (m = ++n), l = !1);
25
+ let o = -1;
26
+ for (; n < d && o === -1; ++n)
27
27
  switch (r[n]) {
28
28
  case 58:
29
- t === -1 && (t = n - u);
29
+ t === -1 && (t = n - m);
30
30
  break;
31
31
  case 13:
32
- c = !0;
32
+ l = !0;
33
33
  case 10:
34
- i = n;
34
+ o = n;
35
35
  break;
36
36
  }
37
- if (i === -1)
37
+ if (o === -1)
38
38
  break;
39
- e(r.subarray(u, i), t), u = n, t = -1;
39
+ e(r.subarray(m, o), t), m = n, t = -1;
40
40
  }
41
- u === d ? r = void 0 : u !== 0 && (r = r.subarray(u), n -= u);
41
+ m === d ? r = void 0 : m !== 0 && (r = r.subarray(m), n -= m);
42
42
  };
43
43
  }
44
44
  function fe(e, r, n) {
45
45
  let t = q();
46
- const c = new TextDecoder();
47
- return function(l, d) {
48
- if (l.length === 0)
46
+ const l = new TextDecoder();
47
+ return function(s, d) {
48
+ if (s.length === 0)
49
49
  n == null || n(t), t = q();
50
50
  else if (d > 0) {
51
- const u = c.decode(l.subarray(0, d)), i = d + (l[d + 1] === 32 ? 2 : 1), a = c.decode(l.subarray(i));
52
- switch (u) {
51
+ const m = l.decode(s.subarray(0, d)), o = d + (s[d + 1] === 32 ? 2 : 1), a = l.decode(s.subarray(o));
52
+ switch (m) {
53
53
  case "data":
54
54
  t.data = t.data ? t.data + `
55
55
  ` + a : a;
@@ -61,8 +61,8 @@ function fe(e, r, n) {
61
61
  e(t.id = a);
62
62
  break;
63
63
  case "retry":
64
- const m = parseInt(a, 10);
65
- isNaN(m) || r(t.retry = m);
64
+ const u = parseInt(a, 10);
65
+ isNaN(u) || r(t.retry = u);
66
66
  break;
67
67
  }
68
68
  }
@@ -84,46 +84,46 @@ var xe = function(e, r) {
84
84
  var n = {};
85
85
  for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && r.indexOf(t) < 0 && (n[t] = e[t]);
86
86
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
87
- for (var c = 0, t = Object.getOwnPropertySymbols(e); c < t.length; c++)
88
- r.indexOf(t[c]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[c]) && (n[t[c]] = e[t[c]]);
87
+ for (var l = 0, t = Object.getOwnPropertySymbols(e); l < t.length; l++)
88
+ r.indexOf(t[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[l]) && (n[t[l]] = e[t[l]]);
89
89
  return n;
90
90
  };
91
91
  const _ = "text/event-stream", Te = 1e3, U = "last-event-id";
92
92
  function ke(e, r) {
93
- var { signal: n, headers: t, onopen: c, onmessage: s, onclose: l, onerror: d, openWhenHidden: u, fetch: i } = r, a = xe(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
- return new Promise((m, h) => {
93
+ var { signal: n, headers: t, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: o } = r, a = xe(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
+ return new Promise((u, g) => {
95
95
  const f = Object.assign({}, t);
96
96
  f.accept || (f.accept = _);
97
- let g;
98
- function x() {
99
- g.abort(), document.hidden || R();
97
+ let p;
98
+ function S() {
99
+ p.abort(), document.hidden || R();
100
100
  }
101
- u || document.addEventListener("visibilitychange", x);
102
- let p = Te, k = 0;
103
- function b() {
104
- document.removeEventListener("visibilitychange", x), window.clearTimeout(k), g.abort();
101
+ m || document.addEventListener("visibilitychange", S);
102
+ let h = Te, k = 0;
103
+ function v() {
104
+ document.removeEventListener("visibilitychange", S), window.clearTimeout(k), p.abort();
105
105
  }
106
106
  n == null || n.addEventListener("abort", () => {
107
- b(), m();
107
+ v(), u();
108
108
  });
109
- const F = i ?? window.fetch, w = c ?? be;
109
+ const F = o ?? window.fetch, w = l ?? be;
110
110
  async function R() {
111
111
  var L;
112
- g = new AbortController();
112
+ p = new AbortController();
113
113
  try {
114
- const P = await F(e, Object.assign(Object.assign({}, a), { headers: f, signal: g.signal }));
115
- await w(P), await ye(P.body, he(fe((M) => {
116
- M ? f[U] = M : delete f[U];
117
- }, (M) => {
118
- p = M;
119
- }, s))), l == null || l(), b(), m();
114
+ const P = await F(e, Object.assign(Object.assign({}, a), { headers: f, signal: p.signal }));
115
+ await w(P), await ge(P.body, he(fe((I) => {
116
+ I ? f[U] = I : delete f[U];
117
+ }, (I) => {
118
+ h = I;
119
+ }, c))), s == null || s(), v(), u();
120
120
  } catch (P) {
121
- if (!g.signal.aborted)
121
+ if (!p.signal.aborted)
122
122
  try {
123
- const M = (L = d == null ? void 0 : d(P)) !== null && L !== void 0 ? L : p;
124
- window.clearTimeout(k), k = window.setTimeout(R, M);
125
- } catch (M) {
126
- b(), h(M);
123
+ const I = (L = d == null ? void 0 : d(P)) !== null && L !== void 0 ? L : h;
124
+ window.clearTimeout(k), k = window.setTimeout(R, I);
125
+ } catch (I) {
126
+ v(), g(I);
127
127
  }
128
128
  }
129
129
  }
@@ -151,36 +151,36 @@ class Ce {
151
151
  */
152
152
  updateStreams(r) {
153
153
  r.forEach((t) => {
154
- const c = t.stream.id;
155
- this.eventSources.has(c) || this.connectStream(t);
154
+ const l = t.stream.id;
155
+ this.eventSources.has(l) || this.connectStream(t);
156
156
  });
157
157
  const n = new Set(r.map((t) => t.stream.id));
158
- this.eventSources.forEach((t, c) => {
159
- n.has(c) || (t.abort(), this.eventSources.delete(c));
158
+ this.eventSources.forEach((t, l) => {
159
+ n.has(l) || (t.abort(), this.eventSources.delete(l));
160
160
  });
161
161
  }
162
162
  connectStream(r) {
163
163
  const n = r.stream.id, t = new AbortController();
164
164
  this.eventSources.set(n, t);
165
- const c = `${this.fency.baseUrl}/sse/streams/${n}`, s = {
165
+ const l = `${this.fency.baseUrl}/sse/streams/${n}`, c = {
166
166
  "X-Fency-Publishable-Key": this.fency.publishableKey,
167
167
  "X-Fency-Stream-Token": r.stream.token
168
168
  };
169
- ke(c, {
170
- headers: s,
169
+ ke(l, {
170
+ headers: c,
171
171
  signal: t.signal,
172
- async onopen(l) {
173
- if (!l.ok && l.status >= 400 && l.status < 500 && l.status !== 429)
174
- throw new Error(`Client error ${l.status}`);
172
+ async onopen(s) {
173
+ if (!s.ok && s.status >= 400 && s.status < 500 && s.status !== 429)
174
+ throw new Error(`Client error ${s.status}`);
175
175
  },
176
- onmessage: (l) => {
177
- if (l.data) {
178
- const d = ve(l.data);
176
+ onmessage: (s) => {
177
+ if (s.data) {
178
+ const d = ve(s.data);
179
179
  this.broadcast(d, n);
180
180
  }
181
181
  },
182
- onerror: (l) => {
183
- throw console.error("EventSource error for stream", n, ":", l), this.broadcastError(n), l;
182
+ onerror: (s) => {
183
+ throw console.error("EventSource error for stream", n, ":", s), this.broadcastError(n), s;
184
184
  },
185
185
  onclose() {
186
186
  }
@@ -216,31 +216,31 @@ const Ee = 12e4, we = (e) => {
216
216
  const r = Date.now();
217
217
  return e.filter((n) => r - n.createdAt < Ee);
218
218
  };
219
- function Mr({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
220
- const [t, c] = v(
219
+ function Ir({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
220
+ const [t, l] = b(
221
221
  null
222
- ), [s, l] = v(!0), [d, u] = v(null), [i, a] = v([]), m = A(null), h = A(null);
223
- I(() => {
224
- e.then((p) => {
225
- c(p), l(!1);
226
- }).catch((p) => {
227
- u(p), l(!1);
222
+ ), [c, s] = b(!0), [d, m] = b(null), [o, a] = b([]), u = A(null), g = A(null);
223
+ M(() => {
224
+ e.then((h) => {
225
+ l(h), s(!1);
226
+ }).catch((h) => {
227
+ m(h), s(!1);
228
228
  });
229
- }, [e]), I(() => {
230
- t && !h.current && (h.current = new Ce(t));
231
- }, [t]), I(() => {
232
- h.current && h.current.updateStreams(i);
233
- }, [i]), I(() => () => {
234
- var p;
235
- (p = h.current) == null || p.cleanup();
229
+ }, [e]), M(() => {
230
+ t && !g.current && (g.current = new Ce(t));
231
+ }, [t]), M(() => {
232
+ g.current && g.current.updateStreams(o);
233
+ }, [o]), M(() => () => {
234
+ var h;
235
+ (h = g.current) == null || h.cleanup();
236
236
  }, []);
237
237
  const f = G(
238
- async (p = 3e4) => {
239
- if (m.current)
240
- return m.current;
241
- const k = Date.now(), b = i.length > 0 ? i[i.length - 1] : null;
242
- if (b && k - b.createdAt < p)
243
- return b.stream;
238
+ async (h = 3e4) => {
239
+ if (u.current)
240
+ return u.current;
241
+ const k = Date.now(), v = o.length > 0 ? o[o.length - 1] : null;
242
+ if (v && k - v.createdAt < h)
243
+ return v.stream;
244
244
  const F = (async () => {
245
245
  if (!t)
246
246
  throw new Error("Fency instance not initialized");
@@ -255,15 +255,15 @@ function Mr({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
255
255
  createdAt: Date.now()
256
256
  };
257
257
  return a((P) => {
258
- const M = [...P, L];
259
- return we(M);
260
- }), m.current = null, R.stream;
258
+ const I = [...P, L];
259
+ return we(I);
260
+ }), u.current = null, R.stream;
261
261
  } else
262
- throw m.current = null, new Error("Failed to create stream");
262
+ throw u.current = null, new Error("Failed to create stream");
263
263
  })();
264
- return m.current = F, F;
264
+ return u.current = F, F;
265
265
  },
266
- [t, i]
266
+ [t, o]
267
267
  );
268
268
  if (d)
269
269
  return /* @__PURE__ */ y("div", { children: [
@@ -272,31 +272,31 @@ function Mr({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
272
272
  ] });
273
273
  if (!t)
274
274
  return null;
275
- const g = i.length > 0 ? i[i.length - 1] : null, x = {
275
+ const p = o.length > 0 ? o[o.length - 1] : null, S = {
276
276
  fency: t,
277
- loading: s,
277
+ loading: c,
278
278
  error: d,
279
- activeStreams: i,
280
- latestStream: g,
281
- eventManager: h.current,
279
+ activeStreams: o,
280
+ latestStream: p,
281
+ eventManager: g.current,
282
282
  getOrCreateStream: f
283
283
  };
284
- return /* @__PURE__ */ o(Y.Provider, { value: x, children: n });
284
+ return /* @__PURE__ */ i(Y.Provider, { value: S, children: n });
285
285
  }
286
286
  function Z() {
287
- const e = ue(Y);
287
+ const e = me(Y);
288
288
  if (e === void 0)
289
289
  throw new Error("useFencyContext must be used within a FencyProvider");
290
290
  return e;
291
291
  }
292
- const Me = (e) => {
292
+ const Ie = (e) => {
293
293
  try {
294
294
  const r = JSON.parse(e);
295
- return Ie(r);
295
+ return Me(r);
296
296
  } catch (r) {
297
297
  return console.error("Error parsing message:", r), null;
298
298
  }
299
- }, Ie = (e) => ae(e) ? Ae(e) : se(e) ? Fe(e) : le(e) ? Re(e) : null, Ae = (e) => ({
299
+ }, Me = (e) => ae(e) ? Ae(e) : se(e) ? Fe(e) : le(e) ? Re(e) : null, Ae = (e) => ({
300
300
  type: "STREAM_TIMEOUT",
301
301
  streamId: e.streamId,
302
302
  timestamp: e.timestamp
@@ -313,30 +313,30 @@ const Me = (e) => {
313
313
  createdAt: e.createdAt,
314
314
  data: JSON.parse(e.data)
315
315
  }), Pe = (e) => {
316
- const r = Z(), [n, t] = v(null), c = A(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
317
- return I(() => {
316
+ const r = Z(), [n, t] = b(null), l = A(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
317
+ return M(() => {
318
318
  if (!r.eventManager) return;
319
- const l = {
320
- onMessage: (u, i) => {
321
- var m, h, f;
322
- const a = Me(u);
319
+ const s = {
320
+ onMessage: (m, o) => {
321
+ var u, g, f;
322
+ const a = Ie(m);
323
323
  if (a)
324
324
  switch (a.type) {
325
325
  case "STREAM_TIMEOUT":
326
- (m = e == null ? void 0 : e.onStreamTimeout) == null || m.call(e, a);
326
+ (u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, a);
327
327
  break;
328
328
  case "STREAM_NOT_FOUND":
329
- (h = e == null ? void 0 : e.onStreamNotFound) == null || h.call(e, a);
329
+ (g = e == null ? void 0 : e.onStreamNotFound) == null || g.call(e, a);
330
330
  break;
331
331
  case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
332
332
  (f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, a);
333
333
  break;
334
334
  }
335
335
  },
336
- onError: (u) => {
337
- var i;
338
- (i = e == null ? void 0 : e.onStreamError) == null || i.call(e, {
339
- streamId: u,
336
+ onError: (m) => {
337
+ var o;
338
+ (o = e == null ? void 0 : e.onStreamError) == null || o.call(e, {
339
+ streamId: m,
340
340
  error: {
341
341
  code: "UnknownError",
342
342
  message: "Unknown error in useStream"
@@ -345,197 +345,197 @@ const Me = (e) => {
345
345
  }
346
346
  };
347
347
  return r.eventManager.subscribe(
348
- c.current,
349
- l
348
+ l.current,
349
+ s
350
350
  );
351
351
  }, [r.eventManager, e]), {
352
352
  createStream: async () => {
353
353
  try {
354
- const l = await r.getOrCreateStream(3e4);
355
- return t(l), {
354
+ const s = await r.getOrCreateStream(3e4);
355
+ return t(s), {
356
356
  type: "success",
357
- stream: l
357
+ stream: s
358
358
  };
359
- } catch (l) {
359
+ } catch (s) {
360
360
  return {
361
361
  type: "error",
362
362
  error: {
363
363
  code: "UnknownError",
364
- message: l instanceof Error ? l.message : "Failed to create stream"
364
+ message: s instanceof Error ? s.message : "Failed to create stream"
365
365
  }
366
366
  };
367
367
  }
368
368
  },
369
369
  stream: n
370
370
  };
371
- }, Ir = (e) => {
372
- const r = Z(), [n, t] = v([]), c = A(/* @__PURE__ */ new Set()), s = A(/* @__PURE__ */ new Map()), { createStream: l } = Pe({
373
- onAgentTaskProgressItemUpdated: (i) => {
374
- var h;
375
- if (!c.current.has(i.agentTaskId)) return;
376
- const a = i.data;
371
+ }, Mr = (e) => {
372
+ const r = Z(), [n, t] = b([]), l = A(/* @__PURE__ */ new Set()), c = A(/* @__PURE__ */ new Map()), { createStream: s } = Pe({
373
+ onAgentTaskProgressItemUpdated: (o) => {
374
+ var g;
375
+ if (!l.current.has(o.agentTaskId)) return;
376
+ const a = o.data;
377
377
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed" || a.taskType === "MemoryChatCompletion" && a.eventType === "Completed" || a.taskType === "MemorySearch" && a.eventType === "Completed") {
378
378
  const f = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
379
379
  t(
380
- f ? (x) => x.map((p) => {
380
+ f ? (S) => S.map((h) => {
381
381
  var F;
382
- if (((F = p.confirmedData) == null ? void 0 : F.taskId) !== i.agentTaskId)
383
- return p;
384
- const b = p.progressItems.some(
385
- (w) => w.progressItemId === i.progressItemId
386
- ) ? p.progressItems.map(
387
- (w) => w.progressItemId === i.progressItemId ? i : w
388
- ) : [...p.progressItems, i];
382
+ if (((F = h.confirmedData) == null ? void 0 : F.taskId) !== o.agentTaskId)
383
+ return h;
384
+ const v = h.progressItems.some(
385
+ (w) => w.progressItemId === o.progressItemId
386
+ ) ? h.progressItems.map(
387
+ (w) => w.progressItemId === o.progressItemId ? o : w
388
+ ) : [...h.progressItems, o];
389
389
  return {
390
- ...p,
391
- progressItems: b,
390
+ ...h,
391
+ progressItems: v,
392
392
  loading: !1
393
393
  };
394
- }) : (x) => x.map(
395
- (p) => {
394
+ }) : (S) => S.map(
395
+ (h) => {
396
396
  var k;
397
- return ((k = p.confirmedData) == null ? void 0 : k.taskId) === i.agentTaskId ? { ...p, loading: !1 } : p;
397
+ return ((k = h.confirmedData) == null ? void 0 : k.taskId) === o.agentTaskId ? { ...h, loading: !1 } : h;
398
398
  }
399
399
  )
400
400
  );
401
- const g = s.current.get(
402
- i.agentTaskId
401
+ const p = c.current.get(
402
+ o.agentTaskId
403
403
  );
404
- g && (s.current.delete(i.agentTaskId), g(a));
404
+ p && (c.current.delete(o.agentTaskId), p(a));
405
405
  return;
406
406
  }
407
- (h = e.onAgentTaskProgressItemUpdated) == null || h.call(e, i), t(
408
- (f) => f.map((g) => {
407
+ (g = e.onAgentTaskProgressItemUpdated) == null || g.call(e, o), t(
408
+ (f) => f.map((p) => {
409
409
  var k;
410
- if (((k = g.confirmedData) == null ? void 0 : k.taskId) !== i.agentTaskId)
411
- return g;
412
- const p = g.progressItems.some(
413
- (b) => b.progressItemId === i.progressItemId
414
- ) ? g.progressItems.map(
415
- (b) => b.progressItemId === i.progressItemId ? i : b
416
- ) : [...g.progressItems, i];
417
- return { ...g, progressItems: p };
410
+ if (((k = p.confirmedData) == null ? void 0 : k.taskId) !== o.agentTaskId)
411
+ return p;
412
+ const h = p.progressItems.some(
413
+ (v) => v.progressItemId === o.progressItemId
414
+ ) ? p.progressItems.map(
415
+ (v) => v.progressItemId === o.progressItemId ? o : v
416
+ ) : [...p.progressItems, o];
417
+ return { ...p, progressItems: h };
418
418
  })
419
419
  );
420
420
  },
421
- onStreamError: (i) => {
421
+ onStreamError: (o) => {
422
422
  var a;
423
- (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, i), t((m) => {
424
- const h = m.find((f) => f.streamId === i.streamId);
425
- return h ? [
426
- ...m.filter((f) => f.streamId !== i.streamId),
423
+ (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), t((u) => {
424
+ const g = u.find((f) => f.streamId === o.streamId);
425
+ return g ? [
426
+ ...u.filter((f) => f.streamId !== o.streamId),
427
427
  {
428
- ...h,
428
+ ...g,
429
429
  loading: !1,
430
- error: i.error
430
+ error: o.error
431
431
  }
432
- ] : m;
432
+ ] : u;
433
433
  });
434
434
  },
435
- onStreamNotFound: (i) => {
435
+ onStreamNotFound: (o) => {
436
436
  var a;
437
- (a = e == null ? void 0 : e.onStreamNotFound) == null || a.call(e, i);
437
+ (a = e == null ? void 0 : e.onStreamNotFound) == null || a.call(e, o);
438
438
  },
439
- onStreamTimeout: (i) => {
439
+ onStreamTimeout: (o) => {
440
440
  var a;
441
- (a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, i);
441
+ (a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, o);
442
442
  }
443
443
  }), d = G(
444
- async (i, a) => {
445
- const m = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, h = await l();
446
- if (h.type === "success") {
444
+ async (o, a) => {
445
+ const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = await s();
446
+ if (g.type === "success") {
447
447
  t([
448
448
  ...n,
449
449
  {
450
- taskKey: m,
451
- streamId: h.stream.id,
450
+ taskKey: u,
451
+ streamId: g.stream.id,
452
452
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
453
453
  confirmedData: null,
454
454
  error: null,
455
- params: i,
455
+ params: o,
456
456
  progressItems: [],
457
457
  loading: !0,
458
458
  loadingText: a == null ? void 0 : a.loadingText
459
459
  }
460
460
  ]);
461
- const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(i.type), g = await ce({
461
+ const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(o.type), p = await ce({
462
462
  pk: r.fency.publishableKey,
463
463
  baseUrl: r.fency.baseUrl,
464
464
  clientToken: f,
465
- streamToken: h.stream.token,
465
+ streamToken: g.stream.token,
466
466
  request: {
467
- streamingChatCompletionTask: i.type === "StreamingChatCompletion" ? {
468
- messages: i.messages,
469
- model: i.model
467
+ streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
468
+ messages: o.messages,
469
+ model: o.model
470
470
  } : void 0,
471
- structuredChatCompletionTask: i.type === "StructuredChatCompletion" ? {
472
- messages: i.messages,
473
- jsonSchema: i.jsonSchema,
474
- model: i.model
471
+ structuredChatCompletionTask: o.type === "StructuredChatCompletion" ? {
472
+ messages: o.messages,
473
+ jsonSchema: o.jsonSchema,
474
+ model: o.model
475
475
  } : void 0,
476
- memoryChatCompletionTask: i.type === "MemoryChatCompletion" ? {
477
- messages: i.messages,
478
- model: i.model,
479
- language: i.language ?? "en",
480
- chunkLimit: i.chunkLimit ?? 10,
481
- memoryScanLimit: i.memoryScanLimit ?? 3
476
+ memoryChatCompletionTask: o.type === "MemoryChatCompletion" ? {
477
+ messages: o.messages,
478
+ model: o.model,
479
+ language: o.language ?? "en",
480
+ chunkLimit: o.chunkLimit ?? 10,
481
+ memoryScanLimit: o.memoryScanLimit ?? 3
482
482
  } : void 0,
483
- memorySearchTask: i.type === "MemorySearch" ? {
484
- query: i.query,
485
- model: i.model,
486
- language: i.language ?? "en",
487
- chunkLimit: i.chunkLimit ?? 10,
488
- contextExpansion: i.contextExpansion,
489
- ...i.queryExpansion != null ? {
490
- queryExpansion: i.queryExpansion
483
+ memorySearchTask: o.type === "MemorySearch" ? {
484
+ query: o.query,
485
+ model: o.model,
486
+ language: o.language ?? "en",
487
+ chunkLimit: o.chunkLimit ?? 10,
488
+ contextExpansion: o.contextExpansion,
489
+ ...o.queryExpansion != null ? {
490
+ queryExpansion: o.queryExpansion
491
491
  } : {}
492
492
  } : void 0
493
493
  }
494
494
  });
495
- if (g.type === "success" && g.agentTask) {
496
- c.current.add(
497
- g.agentTask.id
498
- ), t((p) => [
499
- ...p.filter((k) => k.taskKey !== m),
495
+ if (p.type === "success" && p.agentTask) {
496
+ l.current.add(
497
+ p.agentTask.id
498
+ ), t((h) => [
499
+ ...h.filter((k) => k.taskKey !== u),
500
500
  {
501
- taskKey: m,
502
- streamId: h.stream.id,
501
+ taskKey: u,
502
+ streamId: g.stream.id,
503
503
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
504
- taskId: g.agentTask.id,
505
- createdAt: g.agentTask.createdAt,
504
+ taskId: p.agentTask.id,
505
+ createdAt: p.agentTask.createdAt,
506
506
  error: null,
507
- params: i,
507
+ params: o,
508
508
  progressItems: [],
509
509
  loading: !0,
510
510
  loadingText: a == null ? void 0 : a.loadingText,
511
511
  confirmedData: {
512
- taskId: g.agentTask.id,
513
- createdAt: g.agentTask.createdAt
512
+ taskId: p.agentTask.id,
513
+ createdAt: p.agentTask.createdAt
514
514
  }
515
515
  }
516
516
  ]);
517
- const x = await new Promise((p) => {
518
- s.current.set(
519
- g.agentTask.id,
520
- p
517
+ const S = await new Promise((h) => {
518
+ c.current.set(
519
+ p.agentTask.id,
520
+ h
521
521
  );
522
522
  });
523
523
  return {
524
524
  type: "success",
525
- streamId: h.stream.id,
526
- agentTaskId: g.agentTask.id,
527
- response: x
525
+ streamId: g.stream.id,
526
+ agentTaskId: p.agentTask.id,
527
+ response: S
528
528
  };
529
529
  } else {
530
- if (g.type === "error")
531
- return t((x) => [
532
- ...x.filter((p) => p.taskKey !== m),
530
+ if (p.type === "error")
531
+ return t((S) => [
532
+ ...S.filter((h) => h.taskKey !== u),
533
533
  {
534
- taskKey: m,
534
+ taskKey: u,
535
535
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
536
- streamId: h.stream.id,
537
- params: i,
538
- error: g.error,
536
+ streamId: g.stream.id,
537
+ params: o,
538
+ error: p.error,
539
539
  progressItems: [],
540
540
  loading: !1,
541
541
  loadingText: a == null ? void 0 : a.loadingText,
@@ -543,21 +543,21 @@ const Me = (e) => {
543
543
  }
544
544
  ]), {
545
545
  type: "error",
546
- error: g.error
546
+ error: p.error
547
547
  };
548
548
  {
549
- const x = {
549
+ const S = {
550
550
  message: "No response received",
551
551
  code: "UnknownError"
552
552
  };
553
- return t((p) => [
554
- ...p.filter((k) => k.taskKey !== m),
553
+ return t((h) => [
554
+ ...h.filter((k) => k.taskKey !== u),
555
555
  {
556
- taskKey: m,
556
+ taskKey: u,
557
557
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
558
- streamId: h.stream.id,
559
- error: x,
560
- params: i,
558
+ streamId: g.stream.id,
559
+ error: S,
560
+ params: o,
561
561
  progressItems: [],
562
562
  loading: !1,
563
563
  loadingText: a == null ? void 0 : a.loadingText,
@@ -565,39 +565,39 @@ const Me = (e) => {
565
565
  }
566
566
  ]), {
567
567
  type: "error",
568
- error: x
568
+ error: S
569
569
  };
570
570
  }
571
571
  }
572
572
  } else
573
- return console.error(h.error), h;
573
+ return console.error(g.error), g;
574
574
  },
575
- [r, n, l]
576
- ), u = D(() => {
575
+ [r, n, s]
576
+ ), m = D(() => {
577
577
  if (n.length !== 0)
578
- return [...n].sort((i, a) => new Date(a.triggeredAt).getTime() - new Date(i.triggeredAt).getTime())[0];
578
+ return [...n].sort((o, a) => new Date(a.triggeredAt).getTime() - new Date(o.triggeredAt).getTime())[0];
579
579
  }, [n]);
580
- return I(() => () => {
581
- c.current.clear(), s.current.clear();
580
+ return M(() => () => {
581
+ l.current.clear(), c.current.clear();
582
582
  }, []), {
583
583
  agentTasks: n,
584
584
  createAgentTask: d,
585
- latest: u
585
+ latest: m
586
586
  };
587
587
  };
588
588
  function De(e) {
589
589
  return e.progressItems.map((r, n) => {
590
- const t = e.progressItems[n + 1], c = t != null;
591
- let s;
590
+ const t = e.progressItems[n + 1], l = t != null;
591
+ let c;
592
592
  if (t != null && t.createdAt) {
593
- const l = new Date(r.createdAt).getTime(), d = new Date(t.createdAt).getTime();
594
- s = Math.round((d - l) / 1e3);
593
+ const s = new Date(r.createdAt).getTime(), d = new Date(t.createdAt).getTime();
594
+ c = Math.round((d - s) / 1e3);
595
595
  }
596
596
  return {
597
597
  item: r,
598
- completed: c,
598
+ completed: l,
599
599
  isLatest: n === e.progressItems.length - 1,
600
- durationSeconds: s
600
+ durationSeconds: c
601
601
  };
602
602
  });
603
603
  }
@@ -606,22 +606,22 @@ function C({
606
606
  duration: r = 2,
607
607
  delay: n = 0,
608
608
  repeat: t = !0,
609
- repeatDelay: c = 0.5,
610
- className: s,
611
- startOnView: l = !1,
609
+ repeatDelay: l = 0.5,
610
+ className: c,
611
+ startOnView: s = !1,
612
612
  once: d = !1,
613
- inViewMargin: u,
614
- spread: i = 2,
613
+ inViewMargin: m,
614
+ spread: o = 2,
615
615
  color: a = "#999",
616
- shimmerColor: m = "#000",
617
- direction: h = "fromBottom"
616
+ shimmerColor: u = "#000",
617
+ direction: g = "fromBottom"
618
618
  }) {
619
- const f = A(null), g = me(f, { once: d, margin: u }), x = D(() => e.length * i, [e, i]), p = !l || g, k = h === "fromBottom" ? "100% center" : "-100% center", b = h === "fromBottom" ? "0% center" : "200% center";
620
- return /* @__PURE__ */ o(
619
+ const f = A(null), p = ue(f, { once: d, margin: m }), S = D(() => e.length * o, [e, o]), h = !s || p, k = g === "fromBottom" ? "100% center" : "-100% center", v = g === "fromBottom" ? "0% center" : "200% center";
620
+ return /* @__PURE__ */ i(
621
621
  T.span,
622
622
  {
623
623
  ref: f,
624
- className: s,
624
+ className: c,
625
625
  style: {
626
626
  position: "relative",
627
627
  display: "inline-block",
@@ -631,9 +631,9 @@ function C({
631
631
  color: "transparent",
632
632
  WebkitTextFillColor: "transparent",
633
633
  backgroundRepeat: "no-repeat, padding-box",
634
- "--spread": `${x}px`,
634
+ "--spread": `${S}px`,
635
635
  "--base-color": a,
636
- "--shimmer-color": m,
636
+ "--shimmer-color": u,
637
637
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
638
638
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
639
639
  },
@@ -641,8 +641,8 @@ function C({
641
641
  backgroundPosition: k,
642
642
  opacity: 0
643
643
  },
644
- animate: p ? {
645
- backgroundPosition: b,
644
+ animate: h ? {
645
+ backgroundPosition: v,
646
646
  opacity: 1
647
647
  } : {},
648
648
  transition: {
@@ -650,7 +650,7 @@ function C({
650
650
  repeat: t ? 1 / 0 : 0,
651
651
  duration: r,
652
652
  delay: n,
653
- repeatDelay: c,
653
+ repeatDelay: l,
654
654
  ease: "linear"
655
655
  },
656
656
  opacity: {
@@ -710,21 +710,21 @@ const ze = ({ progressViewItems: e, t: r }) => {
710
710
  const n = e[e.length - 1];
711
711
  if (!n) return null;
712
712
  const t = Le(n, r);
713
- return /* @__PURE__ */ o("div", { className: "simple-mode-container", children: /* @__PURE__ */ o(X, { mode: "wait", children: /* @__PURE__ */ o(
713
+ return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(X, { mode: "wait", children: /* @__PURE__ */ i(
714
714
  T.div,
715
715
  {
716
716
  initial: { opacity: 0, y: 10 },
717
717
  animate: { opacity: 1, y: 0 },
718
718
  exit: { opacity: 0, y: -10 },
719
719
  transition: { duration: 0.3 },
720
- children: n.completed ? /* @__PURE__ */ o(
720
+ children: n.completed ? /* @__PURE__ */ i(
721
721
  "div",
722
722
  {
723
723
  className: "simple-mode-title",
724
724
  style: { color: "#666" },
725
725
  children: t
726
726
  }
727
- ) : /* @__PURE__ */ o(
727
+ ) : /* @__PURE__ */ i(
728
728
  C,
729
729
  {
730
730
  text: t,
@@ -889,35 +889,35 @@ const ze = ({ progressViewItems: e, t: r }) => {
889
889
  italic: {
890
890
  fontStyle: "italic"
891
891
  }
892
- }, V = ({
892
+ }, K = ({
893
893
  text: e
894
- }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
894
+ }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
895
895
  T.div,
896
896
  {
897
897
  className: "fency-markdown-body-raw",
898
898
  initial: { opacity: 0, y: -10 },
899
899
  animate: { opacity: 1, y: 0 },
900
900
  transition: { duration: 0.3, delay: 0 },
901
- children: /* @__PURE__ */ o(
901
+ children: /* @__PURE__ */ i(
902
902
  pe,
903
903
  {
904
- remarkPlugins: [ge],
904
+ remarkPlugins: [ye],
905
905
  components: {
906
906
  code(r) {
907
- const { children: n, className: t, node: c, ref: s, ...l } = r, d = /language-(\w+)/.exec(t || "");
907
+ const { children: n, className: t, node: l, ref: c, ...s } = r, d = /language-(\w+)/.exec(t || "");
908
908
  return d ? (
909
909
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
910
- /* @__PURE__ */ o(
910
+ /* @__PURE__ */ i(
911
911
  J,
912
912
  {
913
- ...l,
913
+ ...s,
914
914
  PreTag: "div",
915
915
  children: String(n).replace(/\n$/, ""),
916
916
  language: d[1],
917
917
  style: ee
918
918
  }
919
919
  )
920
- ) : /* @__PURE__ */ o("code", { ...l, className: t, children: String(n) });
920
+ ) : /* @__PURE__ */ i("code", { ...s, className: t, children: String(n) });
921
921
  }
922
922
  },
923
923
  children: e
@@ -930,13 +930,13 @@ const ze = ({ progressViewItems: e, t: r }) => {
930
930
  null,
931
931
  2
932
932
  );
933
- return /* @__PURE__ */ o("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ o(
933
+ return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
934
934
  T.div,
935
935
  {
936
936
  initial: { opacity: 0, y: -10 },
937
937
  animate: { opacity: 1, y: 0 },
938
938
  transition: { duration: 0.3, delay: 0 },
939
- children: /* @__PURE__ */ o(J, { language: "json", style: ee, PreTag: "div", children: r })
939
+ children: /* @__PURE__ */ i(J, { language: "json", style: ee, PreTag: "div", children: r })
940
940
  }
941
941
  ) });
942
942
  }, Be = {
@@ -1059,12 +1059,12 @@ const ze = ({ progressViewItems: e, t: r }) => {
1059
1059
  memorySearchExploreNoResults: "Ingen resultater funnet"
1060
1060
  }
1061
1061
  };
1062
- function We(e) {
1062
+ function Ne(e) {
1063
1063
  return Be[e];
1064
1064
  }
1065
- function S(e, r) {
1065
+ function x(e, r) {
1066
1066
  return Object.entries(r).reduce(
1067
- (n, [t, c]) => n.replace(`{${t}}`, String(c)),
1067
+ (n, [t, l]) => n.replace(`{${t}}`, String(l)),
1068
1068
  e
1069
1069
  );
1070
1070
  }
@@ -1076,45 +1076,45 @@ function Q(e, r) {
1076
1076
  }
1077
1077
  return n.join(", ");
1078
1078
  }
1079
- const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1080
- const [c, s] = v(!1), d = (e.memories ?? []).map((p) => p.memoryTitle), u = d.length > 0, i = u && d.length > N, a = i && !c ? d.slice(0, N) : d, m = d.length - N, h = !i || c, f = `${t.searchingFor}'${e.queryDescription}'`, g = u ? `${t.searchingIn}${Q(
1079
+ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1080
+ const [l, c] = b(!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, g = !o || l, f = `${t.searchingFor}'${e.queryDescription}'`, p = m ? `${t.searchingIn}${Q(
1081
1081
  a,
1082
- h ? t.and : void 0
1083
- )}` : "", x = u ? `${f}${g}` : `${t.searchingPrefix}${e.queryDescription}`;
1082
+ g ? t.and : void 0
1083
+ )}` : "", S = m ? `${f}${p}` : `${t.searchingPrefix}${e.queryDescription}`;
1084
1084
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1085
- /* @__PURE__ */ o(
1085
+ /* @__PURE__ */ i(
1086
1086
  T.div,
1087
1087
  {
1088
1088
  style: { color: "#666" },
1089
1089
  initial: { opacity: 0, y: -10 },
1090
1090
  animate: { opacity: 1, y: 0 },
1091
1091
  transition: { duration: 0.3, delay: 0 },
1092
- children: r && !n && !i ? /* @__PURE__ */ o(
1092
+ children: r && !n && !o ? /* @__PURE__ */ i(
1093
1093
  C,
1094
1094
  {
1095
- text: x,
1095
+ text: S,
1096
1096
  duration: 2.5,
1097
1097
  repeat: !0,
1098
1098
  color: "#999",
1099
1099
  shimmerColor: "#000"
1100
1100
  }
1101
1101
  ) : /* @__PURE__ */ y(E, { children: [
1102
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u ? /* @__PURE__ */ y(E, { children: [
1102
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ y(E, { children: [
1103
1103
  t.searchingFor,
1104
1104
  /* @__PURE__ */ y("span", { style: { fontWeight: 600 }, children: [
1105
1105
  "'",
1106
1106
  e.queryDescription,
1107
1107
  "'"
1108
1108
  ] }),
1109
- g
1109
+ p
1110
1110
  ] }) : `${t.searchingPrefix}${e.queryDescription}` }),
1111
- i && !c && /* @__PURE__ */ y(E, { children: [
1111
+ o && !l && /* @__PURE__ */ y(E, { children: [
1112
1112
  " ",
1113
- /* @__PURE__ */ o(
1113
+ /* @__PURE__ */ i(
1114
1114
  "button",
1115
1115
  {
1116
1116
  type: "button",
1117
- onClick: () => s(!0),
1117
+ onClick: () => c(!0),
1118
1118
  style: {
1119
1119
  background: "none",
1120
1120
  border: "none",
@@ -1126,19 +1126,19 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1126
1126
  textDecoration: "underline",
1127
1127
  fontFamily: "inherit"
1128
1128
  },
1129
- children: S(t.moreMemories, {
1130
- n: m
1129
+ children: x(t.moreMemories, {
1130
+ n: u
1131
1131
  })
1132
1132
  }
1133
1133
  )
1134
1134
  ] }),
1135
- i && c && /* @__PURE__ */ y(E, { children: [
1135
+ o && l && /* @__PURE__ */ y(E, { children: [
1136
1136
  " ",
1137
- /* @__PURE__ */ o(
1137
+ /* @__PURE__ */ i(
1138
1138
  "button",
1139
1139
  {
1140
1140
  type: "button",
1141
- onClick: () => s(!1),
1141
+ onClick: () => c(!1),
1142
1142
  style: {
1143
1143
  background: "none",
1144
1144
  border: "none",
@@ -1157,7 +1157,7 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1157
1157
  ] })
1158
1158
  }
1159
1159
  ),
1160
- n !== void 0 && /* @__PURE__ */ o(
1160
+ n !== void 0 && /* @__PURE__ */ i(
1161
1161
  "div",
1162
1162
  {
1163
1163
  style: {
@@ -1166,17 +1166,17 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1166
1166
  marginTop: "4px",
1167
1167
  fontStyle: "italic"
1168
1168
  },
1169
- children: S(t.tookSeconds, { n })
1169
+ children: x(t.tookSeconds, { n })
1170
1170
  }
1171
1171
  )
1172
1172
  ] });
1173
- }, H = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1174
- const [c, s] = v(!1), l = e.titles, d = l.length > 0, u = d && l.length > H, i = u && !c ? l.slice(0, H) : l, a = l.length - H, m = !u || c, h = d ? `${t.findingMemoriesIn}${Q(
1175
- i,
1176
- m ? t.and : void 0
1173
+ }, $ = 5, $e = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1174
+ const [l, c] = b(!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, g = d ? `${t.findingMemoriesIn}${Q(
1175
+ o,
1176
+ u ? t.and : void 0
1177
1177
  )}` : t.findingMemories;
1178
1178
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1179
- /* @__PURE__ */ o(
1179
+ /* @__PURE__ */ i(
1180
1180
  T.div,
1181
1181
  {
1182
1182
  style: {
@@ -1185,24 +1185,24 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1185
1185
  initial: { opacity: 0, y: -10 },
1186
1186
  animate: { opacity: 1, y: 0 },
1187
1187
  transition: { duration: 0.3, delay: 0 },
1188
- children: r && !n && !u ? /* @__PURE__ */ o(
1188
+ children: r && !n && !m ? /* @__PURE__ */ i(
1189
1189
  C,
1190
1190
  {
1191
- text: h,
1191
+ text: g,
1192
1192
  duration: 2.5,
1193
1193
  repeat: !0,
1194
1194
  color: "#999",
1195
1195
  shimmerColor: "#000"
1196
1196
  }
1197
1197
  ) : /* @__PURE__ */ y(E, { children: [
1198
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: h }),
1199
- u && !c && /* @__PURE__ */ y(E, { children: [
1198
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: g }),
1199
+ m && !l && /* @__PURE__ */ y(E, { children: [
1200
1200
  " ",
1201
- /* @__PURE__ */ o(
1201
+ /* @__PURE__ */ i(
1202
1202
  "button",
1203
1203
  {
1204
1204
  type: "button",
1205
- onClick: () => s(!0),
1205
+ onClick: () => c(!0),
1206
1206
  style: {
1207
1207
  background: "none",
1208
1208
  border: "none",
@@ -1214,19 +1214,19 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1214
1214
  textDecoration: "underline",
1215
1215
  fontFamily: "inherit"
1216
1216
  },
1217
- children: S(t.moreMemories, {
1217
+ children: x(t.moreMemories, {
1218
1218
  n: a
1219
1219
  })
1220
1220
  }
1221
1221
  )
1222
1222
  ] }),
1223
- u && c && /* @__PURE__ */ y(E, { children: [
1223
+ m && l && /* @__PURE__ */ y(E, { children: [
1224
1224
  " ",
1225
- /* @__PURE__ */ o(
1225
+ /* @__PURE__ */ i(
1226
1226
  "button",
1227
1227
  {
1228
1228
  type: "button",
1229
- onClick: () => s(!1),
1229
+ onClick: () => c(!1),
1230
1230
  style: {
1231
1231
  background: "none",
1232
1232
  border: "none",
@@ -1245,7 +1245,7 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1245
1245
  ] })
1246
1246
  }
1247
1247
  ),
1248
- n !== void 0 && /* @__PURE__ */ o(
1248
+ n !== void 0 && /* @__PURE__ */ i(
1249
1249
  "div",
1250
1250
  {
1251
1251
  style: {
@@ -1254,16 +1254,16 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1254
1254
  marginTop: "4px",
1255
1255
  fontStyle: "italic"
1256
1256
  },
1257
- children: S(t.tookSeconds, { n })
1257
+ children: x(t.tookSeconds, { n })
1258
1258
  }
1259
1259
  )
1260
1260
  ] });
1261
- }, $ = 5, $e = ({ data: e, t: r }) => {
1262
- const [n, t] = v(!1), s = e.memories.map((f) => f.memoryTitle), l = s.length > 0, d = l && s.length > $, u = d && !n ? s.slice(0, $) : s, i = s.length - $, a = !d || n, m = s.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, h = l ? `${m}${Q(
1263
- u,
1261
+ }, H = 5, He = ({ data: e, t: r }) => {
1262
+ const [n, t] = b(!1), c = e.memories.map((f) => f.memoryTitle), s = c.length > 0, d = s && c.length > H, m = d && !n ? c.slice(0, H) : c, o = c.length - H, a = !d || n, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, g = s ? `${u}${Q(
1263
+ m,
1264
1264
  a ? r.and : void 0
1265
1265
  )}` : r.memoriesFound;
1266
- return /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
1266
+ return /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
1267
1267
  T.div,
1268
1268
  {
1269
1269
  style: { color: "#666" },
@@ -1271,10 +1271,10 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1271
1271
  animate: { opacity: 1, y: 0 },
1272
1272
  transition: { duration: 0.3, delay: 0 },
1273
1273
  children: /* @__PURE__ */ y(E, { children: [
1274
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: h }),
1274
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: g }),
1275
1275
  d && !n && /* @__PURE__ */ y(E, { children: [
1276
1276
  " ",
1277
- /* @__PURE__ */ o(
1277
+ /* @__PURE__ */ i(
1278
1278
  "button",
1279
1279
  {
1280
1280
  type: "button",
@@ -1290,15 +1290,15 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1290
1290
  textDecoration: "underline",
1291
1291
  fontFamily: "inherit"
1292
1292
  },
1293
- children: S(r.moreMemories, {
1294
- n: i
1293
+ children: x(r.moreMemories, {
1294
+ n: o
1295
1295
  })
1296
1296
  }
1297
1297
  )
1298
1298
  ] }),
1299
1299
  d && n && /* @__PURE__ */ y(E, { children: [
1300
1300
  " ",
1301
- /* @__PURE__ */ o(
1301
+ /* @__PURE__ */ i(
1302
1302
  "button",
1303
1303
  {
1304
1304
  type: "button",
@@ -1324,7 +1324,7 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1324
1324
  }, _e = ({ isLatest: e = !1, durationSeconds: r, t: n }) => {
1325
1325
  const t = n.addingSources;
1326
1326
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1327
- /* @__PURE__ */ o(
1327
+ /* @__PURE__ */ i(
1328
1328
  T.div,
1329
1329
  {
1330
1330
  style: {
@@ -1336,7 +1336,7 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1336
1336
  initial: { opacity: 0, y: -10 },
1337
1337
  animate: { opacity: 1, y: 0 },
1338
1338
  transition: { duration: 0.3, delay: 0 },
1339
- children: e && !r ? /* @__PURE__ */ o(
1339
+ children: e && !r ? /* @__PURE__ */ i(
1340
1340
  C,
1341
1341
  {
1342
1342
  text: t,
@@ -1345,10 +1345,10 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1345
1345
  color: "#999",
1346
1346
  shimmerColor: "#000"
1347
1347
  }
1348
- ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: t })
1348
+ ) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: t })
1349
1349
  }
1350
1350
  ),
1351
- r !== void 0 && /* @__PURE__ */ o(
1351
+ r !== void 0 && /* @__PURE__ */ i(
1352
1352
  "div",
1353
1353
  {
1354
1354
  style: {
@@ -1357,7 +1357,7 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1357
1357
  marginTop: "4px",
1358
1358
  fontStyle: "italic"
1359
1359
  },
1360
- children: S(n.tookSeconds, { n: r })
1360
+ children: x(n.tookSeconds, { n: r })
1361
1361
  }
1362
1362
  )
1363
1363
  ] });
@@ -1365,62 +1365,77 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1365
1365
  function Ge(e, r) {
1366
1366
  if (e.length === 0) return "";
1367
1367
  if (e.length === 1)
1368
- return S(r.pageSingle, { n: e[0] });
1368
+ return x(r.pageSingle, { n: e[0] });
1369
1369
  if (e.length === 2)
1370
- return S(r.pageTwo, {
1370
+ return x(r.pageTwo, {
1371
1371
  a: e[0],
1372
1372
  b: e[1]
1373
1373
  });
1374
1374
  const n = e[e.length - 1], t = e.slice(0, -1).join(", ");
1375
- return S(r.pageMultiple, { list: t, n });
1375
+ return x(r.pageMultiple, { list: t, n });
1376
1376
  }
1377
- const Qe = ({ data: e, onSourceClick: r, t: n }) => /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1378
- /* @__PURE__ */ o(
1379
- T.div,
1380
- {
1381
- style: {
1382
- marginBottom: "10px",
1383
- fontSize: "11px",
1384
- fontWeight: 500,
1385
- letterSpacing: "0.05em",
1386
- textTransform: "uppercase",
1387
- color: "#999"
1377
+ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
1378
+ const [t, l] = b(null);
1379
+ return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1380
+ /* @__PURE__ */ i(
1381
+ T.div,
1382
+ {
1383
+ style: {
1384
+ marginBottom: "10px",
1385
+ fontSize: "11px",
1386
+ fontWeight: 500,
1387
+ letterSpacing: "0.05em",
1388
+ textTransform: "uppercase",
1389
+ color: "#999"
1390
+ },
1391
+ initial: { opacity: 0, y: -10 },
1392
+ animate: { opacity: 1, y: 0 },
1393
+ transition: { duration: 0.3, delay: 0 },
1394
+ children: n.sources
1395
+ }
1396
+ ),
1397
+ /* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: n.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ i(
1398
+ je,
1399
+ {
1400
+ source: c,
1401
+ index: s,
1402
+ loadingMemoryId: t,
1403
+ setLoadingMemoryId: l,
1404
+ onSourceClick: r,
1405
+ t: n
1388
1406
  },
1389
- initial: { opacity: 0, y: -10 },
1390
- animate: { opacity: 1, y: 0 },
1391
- transition: { duration: 0.3, delay: 0 },
1392
- children: n.sources
1393
- }
1394
- ),
1395
- /* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: n.noSources }) : e.sources.map((t, c) => /* @__PURE__ */ o(
1396
- je,
1397
- {
1398
- source: t,
1399
- index: c,
1400
- onSourceClick: r,
1401
- t: n
1402
- },
1403
- t.memoryId
1404
- )) })
1405
- ] }), je = ({
1407
+ c.memoryId
1408
+ )) })
1409
+ ] });
1410
+ }, je = ({
1406
1411
  source: e,
1407
1412
  index: r,
1408
- onSourceClick: n,
1409
- t
1413
+ loadingMemoryId: n,
1414
+ setLoadingMemoryId: t,
1415
+ onSourceClick: l,
1416
+ t: c
1410
1417
  }) => {
1411
- const [c, s] = v(!1), l = !!n, d = e.pageNumbers ?? [], u = Ge(d, t);
1418
+ const [s, d] = b(!1), m = !!l, o = n === e.memoryId, a = e.pageNumbers ?? [], u = Ge(a, c);
1412
1419
  return /* @__PURE__ */ y(
1413
1420
  T.div,
1414
1421
  {
1422
+ "aria-busy": o,
1415
1423
  initial: { opacity: 0, scale: 0.9 },
1416
1424
  animate: { opacity: 1, scale: 1 },
1417
1425
  transition: { duration: 0.25, delay: r * 0.05 },
1418
- onClick: l ? () => n({
1419
- memoryId: e.memoryId,
1420
- pageNumbers: [...d]
1421
- }) : void 0,
1422
- onMouseEnter: l ? () => s(!0) : void 0,
1423
- onMouseLeave: l ? () => s(!1) : void 0,
1426
+ onClick: m && !o ? async () => {
1427
+ t(e.memoryId);
1428
+ try {
1429
+ await l({
1430
+ memoryId: e.memoryId,
1431
+ pageNumbers: [...a]
1432
+ });
1433
+ } finally {
1434
+ t(null);
1435
+ }
1436
+ } : void 0,
1437
+ onMouseEnter: m && !o ? () => d(!0) : void 0,
1438
+ onMouseLeave: m && !o ? () => d(!1) : void 0,
1424
1439
  style: {
1425
1440
  display: "inline-flex",
1426
1441
  flexDirection: "column",
@@ -1428,14 +1443,31 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => /* @__PURE__ */ y("div", { s
1428
1443
  padding: "8px 12px",
1429
1444
  borderRadius: "6px",
1430
1445
  border: "1px solid #e0e0e0",
1431
- backgroundColor: c ? "#f5f5f5" : "transparent",
1432
- cursor: l ? "pointer" : "default",
1446
+ backgroundColor: s ? "#f5f5f5" : "transparent",
1447
+ cursor: m && !o ? "pointer" : o ? "wait" : "default",
1433
1448
  transition: "background-color 0.15s ease",
1434
- userSelect: "none"
1449
+ userSelect: "none",
1450
+ pointerEvents: o ? "none" : void 0
1435
1451
  },
1436
1452
  children: [
1437
- /* @__PURE__ */ o("span", { style: { fontSize: "13px", fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1438
- u && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: u })
1453
+ /* @__PURE__ */ y(
1454
+ "span",
1455
+ {
1456
+ style: {
1457
+ fontSize: "13px",
1458
+ fontWeight: 500,
1459
+ color: "#333",
1460
+ display: "inline-flex",
1461
+ alignItems: "center",
1462
+ gap: 8
1463
+ },
1464
+ children: [
1465
+ o && /* @__PURE__ */ i("span", { className: "explore-memory-loader", "aria-hidden": !0 }),
1466
+ e.memoryTitle
1467
+ ]
1468
+ }
1469
+ ),
1470
+ u && /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "#666" }, children: u })
1439
1471
  ]
1440
1472
  }
1441
1473
  );
@@ -1445,7 +1477,7 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => /* @__PURE__ */ y("div", { s
1445
1477
  borderWidth: n = 7
1446
1478
  }) => {
1447
1479
  const t = r * 0.5;
1448
- return /* @__PURE__ */ o(
1480
+ return /* @__PURE__ */ i(
1449
1481
  "span",
1450
1482
  {
1451
1483
  style: {
@@ -1463,10 +1495,10 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => /* @__PURE__ */ y("div", { s
1463
1495
  size: r = 32,
1464
1496
  lineWidth: n = 2
1465
1497
  }) => {
1466
- const t = r + 1, c = (r - n) / 2, s = (r - t) / 2, l = {
1498
+ const t = r + 1, l = (r - n) / 2, c = (r - t) / 2, s = {
1467
1499
  position: "absolute",
1468
- left: c,
1469
- top: s,
1500
+ left: l,
1501
+ top: c,
1470
1502
  width: n,
1471
1503
  height: t,
1472
1504
  backgroundColor: e
@@ -1481,20 +1513,20 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => /* @__PURE__ */ y("div", { s
1481
1513
  height: r
1482
1514
  },
1483
1515
  children: [
1484
- /* @__PURE__ */ o(
1516
+ /* @__PURE__ */ i(
1485
1517
  "span",
1486
1518
  {
1487
1519
  style: {
1488
- ...l,
1520
+ ...s,
1489
1521
  transform: "rotate(45deg)"
1490
1522
  }
1491
1523
  }
1492
1524
  ),
1493
- /* @__PURE__ */ o(
1525
+ /* @__PURE__ */ i(
1494
1526
  "span",
1495
1527
  {
1496
1528
  style: {
1497
- ...l,
1529
+ ...s,
1498
1530
  transform: "rotate(-45deg)"
1499
1531
  }
1500
1532
  }
@@ -1507,22 +1539,22 @@ function qe({
1507
1539
  memory: e,
1508
1540
  completed: r
1509
1541
  }) {
1510
- return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1542
+ return e.error != null ? /* @__PURE__ */ i(j, { 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" });
1511
1543
  }
1512
- const K = 80;
1544
+ const V = 80;
1513
1545
  function Ue({
1514
1546
  memory: e,
1515
1547
  completed: r,
1516
1548
  t: n
1517
1549
  }) {
1518
- const [t, c] = v(!1), s = e.result ?? e.error, l = s != null && s.length > K, d = s != null ? t || !l ? s : `${s.slice(0, K)}...` : void 0, u = l, i = e.error != null;
1550
+ const [t, l] = b(!1), c = e.result ?? e.error, s = c != null && c.length > V, d = c != null ? t || !s ? c : `${c.slice(0, V)}...` : void 0, m = s, o = e.error != null;
1519
1551
  return /* @__PURE__ */ y(
1520
1552
  T.div,
1521
1553
  {
1522
1554
  initial: { opacity: 0 },
1523
1555
  animate: { opacity: 1 },
1524
1556
  transition: { duration: 0.25 },
1525
- onClick: u ? () => c((a) => !a) : void 0,
1557
+ onClick: m ? () => l((a) => !a) : void 0,
1526
1558
  style: {
1527
1559
  paddingTop: "12px",
1528
1560
  paddingBottom: "12px",
@@ -1532,10 +1564,10 @@ function Ue({
1532
1564
  alignItems: "center",
1533
1565
  gap: "10px",
1534
1566
  minWidth: 0,
1535
- cursor: u ? "pointer" : "default"
1567
+ cursor: m ? "pointer" : "default"
1536
1568
  },
1537
1569
  children: [
1538
- /* @__PURE__ */ o(
1570
+ /* @__PURE__ */ i(
1539
1571
  "div",
1540
1572
  {
1541
1573
  style: {
@@ -1545,7 +1577,7 @@ function Ue({
1545
1577
  flexShrink: 0,
1546
1578
  width: 32
1547
1579
  },
1548
- children: /* @__PURE__ */ o(qe, { memory: e, completed: r })
1580
+ children: /* @__PURE__ */ i(qe, { memory: e, completed: r })
1549
1581
  }
1550
1582
  ),
1551
1583
  /* @__PURE__ */ y(
@@ -1558,26 +1590,26 @@ function Ue({
1558
1590
  minWidth: 0
1559
1591
  },
1560
1592
  children: [
1561
- /* @__PURE__ */ o(
1593
+ /* @__PURE__ */ i(
1562
1594
  "span",
1563
1595
  {
1564
1596
  style: { fontSize: 13, fontWeight: 500, color: "#333" },
1565
1597
  children: e.memoryTitle
1566
1598
  }
1567
1599
  ),
1568
- d != null && /* @__PURE__ */ o(
1600
+ d != null && /* @__PURE__ */ i(
1569
1601
  "span",
1570
1602
  {
1571
1603
  style: {
1572
1604
  fontSize: 12,
1573
- color: i ? "#c62828" : "#666",
1605
+ color: o ? "#c62828" : "#666",
1574
1606
  lineHeight: 1.4,
1575
1607
  whiteSpace: t ? "pre-wrap" : void 0
1576
1608
  },
1577
1609
  children: d
1578
1610
  }
1579
1611
  ),
1580
- u && /* @__PURE__ */ o(
1612
+ m && /* @__PURE__ */ i(
1581
1613
  "span",
1582
1614
  {
1583
1615
  style: {
@@ -1595,7 +1627,7 @@ function Ue({
1595
1627
  }
1596
1628
  );
1597
1629
  }
1598
- const Ve = ({ data: e, completed: r, t: n }) => /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: e.memories.map((t) => /* @__PURE__ */ o(
1630
+ const Ke = ({ data: e, completed: r, t: n }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((t) => /* @__PURE__ */ i(
1599
1631
  Ue,
1600
1632
  {
1601
1633
  memory: t,
@@ -1604,23 +1636,23 @@ const Ve = ({ data: e, completed: r, t: n }) => /* @__PURE__ */ o("div", { style
1604
1636
  },
1605
1637
  t.memoryId
1606
1638
  )) });
1607
- function Ke(e, r) {
1639
+ function Ve(e, r) {
1608
1640
  if (e.length === 0) return "";
1609
1641
  if (e.length === 1)
1610
- return S(r.pageSingle, { n: e[0] });
1642
+ return x(r.pageSingle, { n: e[0] });
1611
1643
  if (e.length === 2)
1612
- return S(r.pageTwo, {
1644
+ return x(r.pageTwo, {
1613
1645
  a: e[0],
1614
1646
  b: e[1]
1615
1647
  });
1616
1648
  const n = e[e.length - 1], t = e.slice(0, -1).join(", ");
1617
- return S(r.pageMultiple, { list: t, n });
1649
+ return x(r.pageMultiple, { list: t, n });
1618
1650
  }
1619
1651
  function Xe(e, r) {
1620
- return e === 1 ? r.chunkFound : S(r.chunksFound, { n: e });
1652
+ return e === 1 ? r.chunkFound : x(r.chunksFound, { n: e });
1621
1653
  }
1622
1654
  const Je = ({ data: e, t: r }) => {
1623
- const [n, t] = v(!1), c = e.chunks.length, s = c > 0;
1655
+ const [n, t] = b(!1), l = e.chunks.length, c = l > 0;
1624
1656
  return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
1625
1657
  /* @__PURE__ */ y(
1626
1658
  T.div,
@@ -1628,7 +1660,7 @@ const Je = ({ data: e, t: r }) => {
1628
1660
  initial: { opacity: 0 },
1629
1661
  animate: { opacity: 1 },
1630
1662
  transition: { duration: 0.25 },
1631
- onClick: s ? () => t((l) => !l) : void 0,
1663
+ onClick: c ? () => t((s) => !s) : void 0,
1632
1664
  style: {
1633
1665
  paddingBottom: n ? "12px" : 0,
1634
1666
  borderBottom: n ? "1px solid #eee" : void 0,
@@ -1636,12 +1668,12 @@ const Je = ({ data: e, t: r }) => {
1636
1668
  flexDirection: "column",
1637
1669
  gap: "4px",
1638
1670
  minWidth: 0,
1639
- cursor: s ? "pointer" : "default"
1671
+ cursor: c ? "pointer" : "default"
1640
1672
  },
1641
1673
  children: [
1642
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1643
- /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: Xe(c, r) }),
1644
- s && /* @__PURE__ */ o(
1674
+ /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1675
+ /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: Xe(l, r) }),
1676
+ c && /* @__PURE__ */ i(
1645
1677
  "span",
1646
1678
  {
1647
1679
  style: {
@@ -1655,7 +1687,7 @@ const Je = ({ data: e, t: r }) => {
1655
1687
  ]
1656
1688
  }
1657
1689
  ),
1658
- n && s && /* @__PURE__ */ o(
1690
+ n && c && /* @__PURE__ */ i(
1659
1691
  T.div,
1660
1692
  {
1661
1693
  initial: { opacity: 0, height: 0 },
@@ -1669,8 +1701,8 @@ const Je = ({ data: e, t: r }) => {
1669
1701
  flexDirection: "column",
1670
1702
  gap: 8
1671
1703
  },
1672
- children: e.chunks.map((l, d) => {
1673
- const u = l.pageNumbers ?? [], i = Ke(u, r);
1704
+ children: e.chunks.map((s, d) => {
1705
+ const m = s.pageNumbers ?? [], o = Ve(m, r);
1674
1706
  return /* @__PURE__ */ y(
1675
1707
  "div",
1676
1708
  {
@@ -1681,7 +1713,7 @@ const Je = ({ data: e, t: r }) => {
1681
1713
  backgroundColor: "#fafafa"
1682
1714
  },
1683
1715
  children: [
1684
- /* @__PURE__ */ o(
1716
+ /* @__PURE__ */ i(
1685
1717
  "span",
1686
1718
  {
1687
1719
  style: {
@@ -1691,7 +1723,7 @@ const Je = ({ data: e, t: r }) => {
1691
1723
  display: "block",
1692
1724
  marginBottom: 4
1693
1725
  },
1694
- children: l.content
1726
+ children: s.content
1695
1727
  }
1696
1728
  ),
1697
1729
  /* @__PURE__ */ y(
@@ -1704,9 +1736,9 @@ const Je = ({ data: e, t: r }) => {
1704
1736
  color: "#666"
1705
1737
  },
1706
1738
  children: [
1707
- i && /* @__PURE__ */ o("span", { children: i }),
1708
- /* @__PURE__ */ o("span", { children: S(r.scoreLabel, {
1709
- n: l.score
1739
+ o && /* @__PURE__ */ i("span", { children: o }),
1740
+ /* @__PURE__ */ i("span", { children: x(r.scoreLabel, {
1741
+ n: s.score
1710
1742
  }) })
1711
1743
  ]
1712
1744
  }
@@ -1721,10 +1753,10 @@ const Je = ({ data: e, t: r }) => {
1721
1753
  ] });
1722
1754
  };
1723
1755
  function Ye({ item: e }) {
1724
- return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1756
+ return e.error != null ? /* @__PURE__ */ i(j, { 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" });
1725
1757
  }
1726
1758
  function Ze(e, r) {
1727
- return S(r.searchingInMemoriesOfType, {
1759
+ return x(r.searchingInMemoriesOfType, {
1728
1760
  name: e.memoryTypeName
1729
1761
  });
1730
1762
  }
@@ -1733,7 +1765,7 @@ function er({
1733
1765
  t: r,
1734
1766
  showShimmerForPrimary: n
1735
1767
  }) {
1736
- const t = e.result != null, c = e.error != null, s = Ze(e, r);
1768
+ const t = e.result != null, l = e.error != null, c = Ze(e, r);
1737
1769
  return /* @__PURE__ */ y(
1738
1770
  T.div,
1739
1771
  {
@@ -1751,7 +1783,7 @@ function er({
1751
1783
  minWidth: 0
1752
1784
  },
1753
1785
  children: [
1754
- /* @__PURE__ */ o(
1786
+ /* @__PURE__ */ i(
1755
1787
  "div",
1756
1788
  {
1757
1789
  style: {
@@ -1761,7 +1793,7 @@ function er({
1761
1793
  flexShrink: 0,
1762
1794
  width: 32
1763
1795
  },
1764
- children: /* @__PURE__ */ o(Ye, { item: e })
1796
+ children: /* @__PURE__ */ i(Ye, { item: e })
1765
1797
  }
1766
1798
  ),
1767
1799
  /* @__PURE__ */ y(
@@ -1775,24 +1807,24 @@ function er({
1775
1807
  flex: 1
1776
1808
  },
1777
1809
  children: [
1778
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !t && !c && n ? /* @__PURE__ */ o(
1810
+ /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !t && !l && n ? /* @__PURE__ */ i(
1779
1811
  C,
1780
1812
  {
1781
- text: s,
1813
+ text: c,
1782
1814
  duration: 2.5,
1783
1815
  repeat: !0,
1784
1816
  color: "#999",
1785
1817
  shimmerColor: "#000"
1786
1818
  }
1787
- ) : s }),
1788
- t && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? S(
1819
+ ) : c }),
1820
+ t && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? x(
1789
1821
  r.memorySearchTypeResultSummaryOne,
1790
1822
  {
1791
1823
  score: e.result.highestChunkScore.toFixed(
1792
1824
  2
1793
1825
  )
1794
1826
  }
1795
- ) : S(
1827
+ ) : x(
1796
1828
  r.memorySearchTypeResultSummary,
1797
1829
  {
1798
1830
  count: e.result.numberOfChunks,
@@ -1801,7 +1833,7 @@ function er({
1801
1833
  )
1802
1834
  }
1803
1835
  ) }),
1804
- c && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
1836
+ l && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
1805
1837
  ]
1806
1838
  }
1807
1839
  )
@@ -1810,14 +1842,14 @@ function er({
1810
1842
  );
1811
1843
  }
1812
1844
  const rr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1813
- const c = D(() => {
1814
- let s = -1;
1815
- return e.memoryTypes.forEach((l, d) => {
1816
- l.result == null && l.error == null && (s = d);
1817
- }), s;
1845
+ const l = D(() => {
1846
+ let c = -1;
1847
+ return e.memoryTypes.forEach((s, d) => {
1848
+ s.result == null && s.error == null && (c = d);
1849
+ }), c;
1818
1850
  }, [e.memoryTypes]);
1819
1851
  return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
1820
- r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
1852
+ r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
1821
1853
  C,
1822
1854
  {
1823
1855
  text: t.searchingMemoryTypes,
@@ -1826,16 +1858,16 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1826
1858
  color: "#999",
1827
1859
  shimmerColor: "#000"
1828
1860
  }
1829
- ) : e.memoryTypes.map((s, l) => /* @__PURE__ */ o(
1861
+ ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
1830
1862
  er,
1831
1863
  {
1832
- item: s,
1864
+ item: c,
1833
1865
  t,
1834
- showShimmerForPrimary: l === c && r
1866
+ showShimmerForPrimary: s === l && r
1835
1867
  },
1836
- s.memoryTypeId
1868
+ c.memoryTypeId
1837
1869
  )),
1838
- n !== void 0 && /* @__PURE__ */ o(
1870
+ n !== void 0 && /* @__PURE__ */ i(
1839
1871
  "div",
1840
1872
  {
1841
1873
  style: {
@@ -1844,14 +1876,14 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1844
1876
  marginTop: "4px",
1845
1877
  fontStyle: "italic"
1846
1878
  },
1847
- children: S(t.tookSeconds, { n })
1879
+ children: x(t.tookSeconds, { n })
1848
1880
  }
1849
1881
  )
1850
1882
  ] });
1851
- }, B = 12, W = 1.45, nr = Math.ceil(
1852
- B * W
1883
+ }, B = 12, N = 1.45, nr = Math.ceil(
1884
+ B * N
1853
1885
  ), tr = Math.ceil(
1854
- 5 * B * W
1886
+ 5 * B * N
1855
1887
  );
1856
1888
  function O(e) {
1857
1889
  return e.queries != null && e.queries.length > 0;
@@ -1866,21 +1898,21 @@ function ir(e) {
1866
1898
  return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
1867
1899
  }
1868
1900
  function ar({ phase: e }) {
1869
- return e === 3 ? /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1901
+ return e === 3 ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1870
1902
  }
1871
1903
  function sr({
1872
1904
  item: e,
1873
1905
  t: r,
1874
1906
  isActiveRow: n
1875
1907
  }) {
1876
- const t = or(e), c = ir(e), s = e.reasoning, l = s != null && s.length > 0, d = A(null), [u, i] = v(!1), a = t && n, m = c === 2 && n && !O(e);
1877
- I(() => {
1878
- const g = d.current;
1879
- g != null && c === 1 && l && (g.scrollTop = g.scrollHeight);
1880
- }, [s, c, l]);
1881
- const h = S(r.searchingInMemoriesOfType, {
1908
+ const t = or(e), l = ir(e), c = e.reasoning, s = c != null && c.length > 0, d = A(null), [m, o] = b(!1), a = t && n, u = l === 2 && n && !O(e);
1909
+ M(() => {
1910
+ const p = d.current;
1911
+ p != null && l === 1 && s && (p.scrollTop = p.scrollHeight);
1912
+ }, [c, l, s]);
1913
+ const g = x(r.searchingInMemoriesOfType, {
1882
1914
  name: e.memoryTypeName
1883
- }), f = !t && c === 3;
1915
+ }), f = !t && l === 3;
1884
1916
  return /* @__PURE__ */ y(
1885
1917
  T.div,
1886
1918
  {
@@ -1898,7 +1930,7 @@ function sr({
1898
1930
  minWidth: 0
1899
1931
  },
1900
1932
  children: [
1901
- /* @__PURE__ */ o(
1933
+ /* @__PURE__ */ i(
1902
1934
  "div",
1903
1935
  {
1904
1936
  style: {
@@ -1909,7 +1941,7 @@ function sr({
1909
1941
  width: 32,
1910
1942
  ...f ? { paddingTop: 2 } : {}
1911
1943
  },
1912
- children: /* @__PURE__ */ o(ar, { phase: t ? 1 : c })
1944
+ children: /* @__PURE__ */ i(ar, { phase: t ? 1 : l })
1913
1945
  }
1914
1946
  ),
1915
1947
  /* @__PURE__ */ y(
@@ -1923,18 +1955,18 @@ function sr({
1923
1955
  flex: 1
1924
1956
  },
1925
1957
  children: [
1926
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ o(
1958
+ /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ i(
1927
1959
  C,
1928
1960
  {
1929
- text: h,
1961
+ text: g,
1930
1962
  duration: 2.5,
1931
1963
  repeat: !0,
1932
1964
  color: "#999",
1933
1965
  shimmerColor: "#000"
1934
1966
  }
1935
1967
  ) : e.memoryTypeName }),
1936
- c === 1 && l && !O(e) && /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
1937
- /* @__PURE__ */ o(
1968
+ l === 1 && s && !O(e) && /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
1969
+ /* @__PURE__ */ i(
1938
1970
  "span",
1939
1971
  {
1940
1972
  style: {
@@ -1947,7 +1979,7 @@ function sr({
1947
1979
  children: r.memorySearchQueryReasoningLabel
1948
1980
  }
1949
1981
  ),
1950
- /* @__PURE__ */ o(
1982
+ /* @__PURE__ */ i(
1951
1983
  "div",
1952
1984
  {
1953
1985
  style: {
@@ -1956,7 +1988,7 @@ function sr({
1956
1988
  padding: "8px 10px",
1957
1989
  boxSizing: "border-box"
1958
1990
  },
1959
- children: /* @__PURE__ */ o(
1991
+ children: /* @__PURE__ */ i(
1960
1992
  "div",
1961
1993
  {
1962
1994
  ref: d,
@@ -1968,18 +2000,18 @@ function sr({
1968
2000
  overflowY: "auto",
1969
2001
  overflowX: "hidden",
1970
2002
  fontSize: B,
1971
- lineHeight: W,
2003
+ lineHeight: N,
1972
2004
  whiteSpace: "pre-wrap",
1973
2005
  wordBreak: "break-word",
1974
2006
  color: "#888"
1975
2007
  },
1976
- children: s
2008
+ children: c
1977
2009
  }
1978
2010
  )
1979
2011
  }
1980
2012
  )
1981
2013
  ] }),
1982
- c === 2 && m && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
2014
+ l === 2 && u && /* @__PURE__ */ i("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ i(
1983
2015
  C,
1984
2016
  {
1985
2017
  text: r.memorySearchGeneratingQueriesPending,
@@ -1989,9 +2021,9 @@ function sr({
1989
2021
  shimmerColor: "#000"
1990
2022
  }
1991
2023
  ) }),
1992
- c === 3 && /* @__PURE__ */ y(E, { children: [
2024
+ l === 3 && /* @__PURE__ */ y(E, { children: [
1993
2025
  /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
1994
- /* @__PURE__ */ o(
2026
+ /* @__PURE__ */ i(
1995
2027
  "span",
1996
2028
  {
1997
2029
  style: {
@@ -2004,7 +2036,7 @@ function sr({
2004
2036
  children: r.memorySearchGeneratedQueriesHeading
2005
2037
  }
2006
2038
  ),
2007
- /* @__PURE__ */ o(
2039
+ /* @__PURE__ */ i(
2008
2040
  "div",
2009
2041
  {
2010
2042
  style: {
@@ -2012,7 +2044,7 @@ function sr({
2012
2044
  flexDirection: "column",
2013
2045
  gap: 6
2014
2046
  },
2015
- children: e.queries.map((g, x) => /* @__PURE__ */ o(
2047
+ children: e.queries.map((p, S) => /* @__PURE__ */ i(
2016
2048
  "div",
2017
2049
  {
2018
2050
  style: {
@@ -2021,19 +2053,19 @@ function sr({
2021
2053
  lineHeight: 1.5,
2022
2054
  wordBreak: "break-word"
2023
2055
  },
2024
- children: g.query
2056
+ children: p.query
2025
2057
  },
2026
- x
2058
+ S
2027
2059
  ))
2028
2060
  }
2029
2061
  )
2030
2062
  ] }),
2031
- l && /* @__PURE__ */ y(E, { children: [
2032
- /* @__PURE__ */ o(
2063
+ s && /* @__PURE__ */ y(E, { children: [
2064
+ /* @__PURE__ */ i(
2033
2065
  "button",
2034
2066
  {
2035
2067
  type: "button",
2036
- onClick: () => i((g) => !g),
2068
+ onClick: () => o((p) => !p),
2037
2069
  style: {
2038
2070
  alignSelf: "flex-start",
2039
2071
  border: "none",
@@ -2044,15 +2076,15 @@ function sr({
2044
2076
  color: "#666",
2045
2077
  textDecoration: "underline"
2046
2078
  },
2047
- children: u ? r.memorySearchHideReasoning : r.memorySearchViewReasoning
2079
+ children: m ? r.memorySearchHideReasoning : r.memorySearchViewReasoning
2048
2080
  }
2049
2081
  ),
2050
- u && /* @__PURE__ */ o(
2082
+ m && /* @__PURE__ */ i(
2051
2083
  "div",
2052
2084
  {
2053
2085
  style: {
2054
2086
  fontSize: B,
2055
- lineHeight: W,
2087
+ lineHeight: N,
2056
2088
  whiteSpace: "pre-wrap",
2057
2089
  wordBreak: "break-word",
2058
2090
  color: "#888",
@@ -2060,7 +2092,7 @@ function sr({
2060
2092
  borderRadius: 6,
2061
2093
  padding: "8px 10px"
2062
2094
  },
2063
- children: s
2095
+ children: c
2064
2096
  }
2065
2097
  )
2066
2098
  ] })
@@ -2073,14 +2105,14 @@ function sr({
2073
2105
  );
2074
2106
  }
2075
2107
  const lr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
2076
- const c = D(() => {
2077
- let s = -1;
2078
- return e.memoryTypes.forEach((l, d) => {
2079
- O(l) || (s = d);
2080
- }), s;
2108
+ const l = D(() => {
2109
+ let c = -1;
2110
+ return e.memoryTypes.forEach((s, d) => {
2111
+ O(s) || (c = d);
2112
+ }), c;
2081
2113
  }, [e.memoryTypes]);
2082
2114
  return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
2083
- r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
2115
+ r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
2084
2116
  C,
2085
2117
  {
2086
2118
  text: t.memorySearchGeneratingQueries,
@@ -2089,16 +2121,16 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
2089
2121
  color: "#999",
2090
2122
  shimmerColor: "#000"
2091
2123
  }
2092
- ) : e.memoryTypes.map((s, l) => /* @__PURE__ */ o(
2124
+ ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
2093
2125
  sr,
2094
2126
  {
2095
- item: s,
2127
+ item: c,
2096
2128
  t,
2097
- isActiveRow: l === c && r
2129
+ isActiveRow: s === l && r
2098
2130
  },
2099
- s.memoryTypeId
2131
+ c.memoryTypeId
2100
2132
  )),
2101
- n !== void 0 && /* @__PURE__ */ o(
2133
+ n !== void 0 && /* @__PURE__ */ i(
2102
2134
  "div",
2103
2135
  {
2104
2136
  style: {
@@ -2107,7 +2139,7 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
2107
2139
  marginTop: "4px",
2108
2140
  fontStyle: "italic"
2109
2141
  },
2110
- children: S(t.tookSeconds, { n })
2142
+ children: x(t.tookSeconds, { n })
2111
2143
  }
2112
2144
  )
2113
2145
  ] });
@@ -2125,31 +2157,31 @@ function re(e) {
2125
2157
  var n, t;
2126
2158
  if (e.length === 0) return "";
2127
2159
  let r = ((n = e[0]) == null ? void 0 : n.content) ?? "";
2128
- for (let c = 1; c < e.length; c++) {
2129
- const s = ((t = e[c]) == null ? void 0 : t.content) ?? "";
2130
- if (s === "") continue;
2160
+ for (let l = 1; l < e.length; l++) {
2161
+ const c = ((t = e[l]) == null ? void 0 : t.content) ?? "";
2162
+ if (c === "") continue;
2131
2163
  if (r === "") {
2132
- r = s;
2164
+ r = c;
2133
2165
  continue;
2134
2166
  }
2135
- const l = cr(r, s);
2136
- l === 0 ? r += dr + s : r += s.slice(l);
2167
+ const s = cr(r, c);
2168
+ s === 0 ? r += dr + c : r += c.slice(s);
2137
2169
  }
2138
2170
  return r;
2139
2171
  }
2140
2172
  function ne(e, r) {
2141
2173
  if (e.length === 0) return "";
2142
2174
  if (e.length === 1)
2143
- return S(r.memorySearchPagesSingle, {
2175
+ return x(r.memorySearchPagesSingle, {
2144
2176
  n: e[0]
2145
2177
  });
2146
2178
  if (e.length === 2)
2147
- return S(r.memorySearchPagesTwo, {
2179
+ return x(r.memorySearchPagesTwo, {
2148
2180
  a: e[0],
2149
2181
  b: e[1]
2150
2182
  });
2151
2183
  const n = e[e.length - 1], t = e.slice(0, -1).join(", ");
2152
- return S(r.memorySearchPagesMultiple, {
2184
+ return x(r.memorySearchPagesMultiple, {
2153
2185
  list: t,
2154
2186
  n
2155
2187
  });
@@ -2165,14 +2197,14 @@ function oe(e) {
2165
2197
  if (r !== "") return r;
2166
2198
  if (e.memoryTypeId !== "") return e.memoryTypeId;
2167
2199
  }
2168
- function ur(e) {
2169
- return e.some((t) => t.result == null && t.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((t) => t.error != null) ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 });
2200
+ function mr(e) {
2201
+ return e.some((t) => t.result == null && t.error == null) ? /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : e.some((t) => t.error != null) ? /* @__PURE__ */ i(j, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 });
2170
2202
  }
2171
- function mr(e, r) {
2203
+ function ur(e, r) {
2172
2204
  if (e.error != null)
2173
- return /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
2205
+ return /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
2174
2206
  if (e.result == null)
2175
- return /* @__PURE__ */ o("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ o(
2207
+ return /* @__PURE__ */ i("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ i(
2176
2208
  C,
2177
2209
  {
2178
2210
  text: r.searching,
@@ -2182,13 +2214,13 @@ function mr(e, r) {
2182
2214
  shimmerColor: "#000"
2183
2215
  }
2184
2216
  ) });
2185
- const n = e.result, t = n.numberOfChunks === 1 ? r.chunkFound : S(r.chunksFound, { n: n.numberOfChunks }), c = S(r.scoreLabel, {
2217
+ const n = e.result, t = n.numberOfChunks === 1 ? r.chunkFound : x(r.chunksFound, { n: n.numberOfChunks }), l = x(r.scoreLabel, {
2186
2218
  n: n.highestChunkScore.toFixed(2)
2187
2219
  });
2188
2220
  return /* @__PURE__ */ y("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
2189
2221
  t,
2190
2222
  " · ",
2191
- c
2223
+ l
2192
2224
  ] });
2193
2225
  }
2194
2226
  function pr({
@@ -2197,8 +2229,9 @@ function pr({
2197
2229
  onExploreQueryResultClick: n,
2198
2230
  t
2199
2231
  }) {
2232
+ const [l, c] = b(null);
2200
2233
  if (e.length === 0)
2201
- return /* @__PURE__ */ o(
2234
+ return /* @__PURE__ */ i(
2202
2235
  "div",
2203
2236
  {
2204
2237
  style: {
@@ -2209,8 +2242,8 @@ function pr({
2209
2242
  children: t.memorySearchExploreNoResults
2210
2243
  }
2211
2244
  );
2212
- const c = !!n;
2213
- return /* @__PURE__ */ o(
2245
+ const s = !!n;
2246
+ return /* @__PURE__ */ i(
2214
2247
  "div",
2215
2248
  {
2216
2249
  style: {
@@ -2221,24 +2254,24 @@ function pr({
2221
2254
  paddingTop: 8,
2222
2255
  borderTop: "1px solid #f0f0f0"
2223
2256
  },
2224
- children: e.map((s, l) => {
2225
- const d = s.memory.title != null && s.memory.title !== "" ? s.memory.title : s.memory.id, u = te(
2226
- s.chunks
2227
- ), i = [
2228
- oe(s.memory),
2229
- S(t.scoreLabel, {
2230
- n: s.score.toFixed(2)
2257
+ children: e.map((d, m) => {
2258
+ const o = d.memory.title != null && d.memory.title !== "" ? d.memory.title : d.memory.id, a = te(
2259
+ d.chunks
2260
+ ), u = [
2261
+ oe(d.memory),
2262
+ x(t.scoreLabel, {
2263
+ n: d.score.toFixed(2)
2231
2264
  }),
2232
- u.length > 0 ? ne(u, t) : t.pagesNotAvailable
2265
+ a.length > 0 ? ne(a, t) : t.pagesNotAvailable
2233
2266
  ].filter(
2234
- (m) => m != null && m !== ""
2235
- ), a = {
2236
- memoryId: s.memory.id,
2237
- pageNumbers: u,
2267
+ (S) => S != null && S !== ""
2268
+ ), g = {
2269
+ memoryId: d.memory.id,
2270
+ pageNumbers: a,
2238
2271
  memoryTypeId: r.memoryTypeId,
2239
2272
  memoryTypeName: r.memoryTypeName,
2240
2273
  query: r.query
2241
- };
2274
+ }, f = `${r.query}::${d.memory.id}::${m}`, p = l === f;
2242
2275
  return /* @__PURE__ */ y(
2243
2276
  "div",
2244
2277
  {
@@ -2247,9 +2280,9 @@ function pr({
2247
2280
  flexDirection: "row",
2248
2281
  alignItems: "flex-start",
2249
2282
  gap: "12px",
2250
- paddingTop: l > 0 ? 12 : 0,
2251
- paddingBottom: l < e.length - 1 ? 12 : 0,
2252
- borderBottom: l < e.length - 1 ? "1px solid #eee" : void 0,
2283
+ paddingTop: m > 0 ? 12 : 0,
2284
+ paddingBottom: m < e.length - 1 ? 12 : 0,
2285
+ borderBottom: m < e.length - 1 ? "1px solid #eee" : void 0,
2253
2286
  minWidth: 0
2254
2287
  },
2255
2288
  children: [
@@ -2264,7 +2297,7 @@ function pr({
2264
2297
  gap: "6px"
2265
2298
  },
2266
2299
  children: [
2267
- /* @__PURE__ */ o(
2300
+ /* @__PURE__ */ i(
2268
2301
  "span",
2269
2302
  {
2270
2303
  style: {
@@ -2272,10 +2305,10 @@ function pr({
2272
2305
  fontWeight: 600,
2273
2306
  color: "#333"
2274
2307
  },
2275
- children: d
2308
+ children: o
2276
2309
  }
2277
2310
  ),
2278
- /* @__PURE__ */ o(
2311
+ /* @__PURE__ */ i(
2279
2312
  "span",
2280
2313
  {
2281
2314
  style: {
@@ -2286,11 +2319,11 @@ function pr({
2286
2319
  wordBreak: "break-word"
2287
2320
  },
2288
2321
  children: re(
2289
- s.chunks
2322
+ d.chunks
2290
2323
  )
2291
2324
  }
2292
2325
  ),
2293
- /* @__PURE__ */ o(
2326
+ /* @__PURE__ */ i(
2294
2327
  "div",
2295
2328
  {
2296
2329
  style: {
@@ -2299,17 +2332,28 @@ function pr({
2299
2332
  color: "#94a3b8",
2300
2333
  lineHeight: 1.35
2301
2334
  },
2302
- children: i.join(" · ")
2335
+ children: u.join(" · ")
2303
2336
  }
2304
2337
  )
2305
2338
  ]
2306
2339
  }
2307
2340
  ),
2308
- c && /* @__PURE__ */ o(
2341
+ s && /* @__PURE__ */ y(
2309
2342
  "button",
2310
2343
  {
2311
2344
  type: "button",
2312
- onClick: () => n(a),
2345
+ "aria-busy": p,
2346
+ disabled: p,
2347
+ onClick: async () => {
2348
+ c(f);
2349
+ try {
2350
+ await n(
2351
+ g
2352
+ );
2353
+ } finally {
2354
+ c(null);
2355
+ }
2356
+ },
2313
2357
  style: {
2314
2358
  flexShrink: 0,
2315
2359
  alignSelf: "center",
@@ -2320,42 +2364,54 @@ function pr({
2320
2364
  background: "#eff6ff",
2321
2365
  border: "1px solid #bfdbfe",
2322
2366
  borderRadius: 6,
2323
- cursor: "pointer",
2324
- fontFamily: "inherit"
2367
+ cursor: p ? "wait" : "pointer",
2368
+ fontFamily: "inherit",
2369
+ display: "inline-flex",
2370
+ alignItems: "center",
2371
+ gap: 8
2325
2372
  },
2326
- children: t.viewButton
2373
+ children: [
2374
+ p && /* @__PURE__ */ i(
2375
+ "span",
2376
+ {
2377
+ className: "explore-memory-loader",
2378
+ "aria-hidden": !0
2379
+ }
2380
+ ),
2381
+ t.viewButton
2382
+ ]
2327
2383
  }
2328
2384
  )
2329
2385
  ]
2330
2386
  },
2331
- `${s.memory.id}-${l}`
2387
+ `${d.memory.id}-${m}`
2332
2388
  );
2333
2389
  })
2334
2390
  }
2335
2391
  );
2336
2392
  }
2337
- function gr(e) {
2393
+ function yr(e) {
2338
2394
  const r = [], n = /* @__PURE__ */ new Map();
2339
- return e.forEach((t, c) => {
2340
- let s = n.get(t.memoryTypeId);
2341
- s == null && (r.push(t.memoryTypeId), s = {
2395
+ return e.forEach((t, l) => {
2396
+ let c = n.get(t.memoryTypeId);
2397
+ c == null && (r.push(t.memoryTypeId), c = {
2342
2398
  memoryTypeId: t.memoryTypeId,
2343
2399
  memoryTypeName: t.memoryTypeName,
2344
2400
  items: []
2345
- }, n.set(t.memoryTypeId, s)), s.items.push({ item: t, flatIndex: c });
2401
+ }, n.set(t.memoryTypeId, c)), c.items.push({ item: t, flatIndex: l });
2346
2402
  }), r.map((t) => n.get(t));
2347
2403
  }
2348
- function yr({
2404
+ function gr({
2349
2405
  group: e,
2350
2406
  t: r,
2351
2407
  lastInFlightIndex: n,
2352
2408
  isLatest: t,
2353
- expandedRows: c,
2354
- toggleExpanded: s,
2355
- onExploreQueryResultClick: l
2409
+ expandedRows: l,
2410
+ toggleExpanded: c,
2411
+ onExploreQueryResultClick: s
2356
2412
  }) {
2357
- const d = e.items.map((i) => i.item), u = d.some(
2358
- (i) => i.result == null && i.error == null
2413
+ const d = e.items.map((o) => o.item), m = d.some(
2414
+ (o) => o.result == null && o.error == null
2359
2415
  );
2360
2416
  return /* @__PURE__ */ y(
2361
2417
  T.div,
@@ -2369,12 +2425,12 @@ function yr({
2369
2425
  borderBottom: "1px solid #eee",
2370
2426
  display: "flex",
2371
2427
  flexDirection: "row",
2372
- alignItems: u ? "center" : "flex-start",
2428
+ alignItems: m ? "center" : "flex-start",
2373
2429
  gap: "10px",
2374
2430
  minWidth: 0
2375
2431
  },
2376
2432
  children: [
2377
- /* @__PURE__ */ o(
2433
+ /* @__PURE__ */ i(
2378
2434
  "div",
2379
2435
  {
2380
2436
  style: {
@@ -2383,9 +2439,9 @@ function yr({
2383
2439
  justifyContent: "center",
2384
2440
  flexShrink: 0,
2385
2441
  width: 32,
2386
- ...u ? {} : { paddingTop: 2 }
2442
+ ...m ? {} : { paddingTop: 2 }
2387
2443
  },
2388
- children: ur(d)
2444
+ children: mr(d)
2389
2445
  }
2390
2446
  ),
2391
2447
  /* @__PURE__ */ y(
@@ -2399,21 +2455,21 @@ function yr({
2399
2455
  flex: 1
2400
2456
  },
2401
2457
  children: [
2402
- /* @__PURE__ */ o(
2458
+ /* @__PURE__ */ i(
2403
2459
  "span",
2404
2460
  {
2405
2461
  style: {
2406
2462
  fontSize: 12,
2407
2463
  color: "#888"
2408
2464
  },
2409
- children: S(r.memorySearchExploreQueryTypeLabel, {
2465
+ children: x(r.memorySearchExploreQueryTypeLabel, {
2410
2466
  name: e.memoryTypeName
2411
2467
  })
2412
2468
  }
2413
2469
  ),
2414
- e.items.map(({ item: i, flatIndex: a }) => {
2415
- var p;
2416
- const m = i.result != null, h = i.error != null, f = a === n && t && !m && !h, g = c[a] === !0, x = ((p = i.result) == null ? void 0 : p.items) ?? [];
2470
+ e.items.map(({ item: o, flatIndex: a }) => {
2471
+ var h;
2472
+ const u = o.result != null, g = o.error != null, f = a === n && t && !u && !g, p = l[a] === !0, S = ((h = o.result) == null ? void 0 : h.items) ?? [];
2417
2473
  return /* @__PURE__ */ y(
2418
2474
  "div",
2419
2475
  {
@@ -2436,7 +2492,7 @@ function yr({
2436
2492
  minWidth: 0
2437
2493
  },
2438
2494
  children: [
2439
- /* @__PURE__ */ o(
2495
+ /* @__PURE__ */ i(
2440
2496
  "span",
2441
2497
  {
2442
2498
  style: {
@@ -2447,16 +2503,16 @@ function yr({
2447
2503
  flex: "1 1 12rem",
2448
2504
  minWidth: 0
2449
2505
  },
2450
- children: f ? /* @__PURE__ */ o(
2506
+ children: f ? /* @__PURE__ */ i(
2451
2507
  C,
2452
2508
  {
2453
- text: i.query,
2509
+ text: o.query,
2454
2510
  duration: 2.5,
2455
2511
  repeat: !0,
2456
2512
  color: "#999",
2457
2513
  shimmerColor: "#000"
2458
2514
  }
2459
- ) : i.query
2515
+ ) : o.query
2460
2516
  }
2461
2517
  ),
2462
2518
  /* @__PURE__ */ y(
@@ -2470,12 +2526,12 @@ function yr({
2470
2526
  flexShrink: 0
2471
2527
  },
2472
2528
  children: [
2473
- mr(i, r),
2474
- m && /* @__PURE__ */ o(
2529
+ ur(o, r),
2530
+ u && /* @__PURE__ */ i(
2475
2531
  "button",
2476
2532
  {
2477
2533
  type: "button",
2478
- onClick: () => s(a),
2534
+ onClick: () => c(a),
2479
2535
  style: {
2480
2536
  border: "none",
2481
2537
  background: "none",
@@ -2486,7 +2542,7 @@ function yr({
2486
2542
  textDecoration: "underline",
2487
2543
  fontFamily: "inherit"
2488
2544
  },
2489
- children: g ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2545
+ children: p ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2490
2546
  }
2491
2547
  )
2492
2548
  ]
@@ -2495,18 +2551,18 @@ function yr({
2495
2551
  ]
2496
2552
  }
2497
2553
  ),
2498
- m && g && /* @__PURE__ */ o(
2554
+ u && p && /* @__PURE__ */ i(
2499
2555
  pr,
2500
2556
  {
2501
- items: x,
2502
- queryRow: i,
2503
- onExploreQueryResultClick: l,
2557
+ items: S,
2558
+ queryRow: o,
2559
+ onExploreQueryResultClick: s,
2504
2560
  t: r
2505
2561
  }
2506
2562
  )
2507
2563
  ]
2508
2564
  },
2509
- `${e.memoryTypeId}-${a}-${i.query}`
2565
+ `${e.memoryTypeId}-${a}-${o.query}`
2510
2566
  );
2511
2567
  })
2512
2568
  ]
@@ -2521,48 +2577,48 @@ const hr = ({
2521
2577
  isLatest: r = !1,
2522
2578
  durationSeconds: n,
2523
2579
  onExploreQueryResultClick: t,
2524
- t: c
2580
+ t: l
2525
2581
  }) => {
2526
- const [s, l] = v(
2582
+ const [c, s] = b(
2527
2583
  {}
2528
2584
  ), d = G((a) => {
2529
- l((m) => ({
2530
- ...m,
2531
- [a]: !m[a]
2585
+ s((u) => ({
2586
+ ...u,
2587
+ [a]: !u[a]
2532
2588
  }));
2533
- }, []), u = D(() => {
2589
+ }, []), m = D(() => {
2534
2590
  let a = -1;
2535
- return e.queries.forEach((m, h) => {
2536
- m.result == null && m.error == null && (a = h);
2591
+ return e.queries.forEach((u, g) => {
2592
+ u.result == null && u.error == null && (a = g);
2537
2593
  }), a;
2538
- }, [e.queries]), i = D(
2539
- () => gr(e.queries),
2594
+ }, [e.queries]), o = D(
2595
+ () => yr(e.queries),
2540
2596
  [e.queries]
2541
2597
  );
2542
2598
  return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
2543
- r && !n && e.queries.length === 0 ? /* @__PURE__ */ o(
2599
+ r && !n && e.queries.length === 0 ? /* @__PURE__ */ i(
2544
2600
  C,
2545
2601
  {
2546
- text: c.memorySearchExploringQueries,
2602
+ text: l.memorySearchExploringQueries,
2547
2603
  duration: 2.5,
2548
2604
  repeat: !0,
2549
2605
  color: "#999",
2550
2606
  shimmerColor: "#000"
2551
2607
  }
2552
- ) : i.map((a) => /* @__PURE__ */ o(
2553
- yr,
2608
+ ) : o.map((a) => /* @__PURE__ */ i(
2609
+ gr,
2554
2610
  {
2555
2611
  group: a,
2556
- t: c,
2557
- lastInFlightIndex: u,
2612
+ t: l,
2613
+ lastInFlightIndex: m,
2558
2614
  isLatest: r,
2559
- expandedRows: s,
2615
+ expandedRows: c,
2560
2616
  toggleExpanded: d,
2561
2617
  onExploreQueryResultClick: t
2562
2618
  },
2563
2619
  a.memoryTypeId
2564
2620
  )),
2565
- n !== void 0 && /* @__PURE__ */ o(
2621
+ n !== void 0 && /* @__PURE__ */ i(
2566
2622
  "div",
2567
2623
  {
2568
2624
  style: {
@@ -2571,14 +2627,14 @@ const hr = ({
2571
2627
  marginTop: "4px",
2572
2628
  fontStyle: "italic"
2573
2629
  },
2574
- children: S(c.tookSeconds, { n })
2630
+ children: x(l.tookSeconds, { n })
2575
2631
  }
2576
2632
  )
2577
2633
  ] });
2578
2634
  }, fr = ({ data: e, onSearchResultClick: r, t: n }) => {
2579
- const t = e.response.items, c = !!r;
2635
+ const t = e.response.items, l = !!r, [c, s] = b(null);
2580
2636
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
2581
- /* @__PURE__ */ o(
2637
+ /* @__PURE__ */ i(
2582
2638
  T.div,
2583
2639
  {
2584
2640
  style: {
@@ -2593,7 +2649,7 @@ const hr = ({
2593
2649
  children: n.resultsHeading
2594
2650
  }
2595
2651
  ),
2596
- /* @__PURE__ */ o(
2652
+ /* @__PURE__ */ i(
2597
2653
  "div",
2598
2654
  {
2599
2655
  style: {
@@ -2601,27 +2657,27 @@ const hr = ({
2601
2657
  flexDirection: "column",
2602
2658
  gap: 0
2603
2659
  },
2604
- children: t.map((s, l) => {
2605
- const d = s.memory.title != null && s.memory.title !== "" ? s.memory.title : s.memory.id, u = te(
2606
- s.chunks
2607
- ), i = [
2608
- oe(s.memory),
2609
- S(n.scoreLabel, {
2610
- n: s.score.toFixed(2)
2660
+ children: t.map((d, m) => {
2661
+ const o = d.memory.title != null && d.memory.title !== "" ? d.memory.title : d.memory.id, a = te(
2662
+ d.chunks
2663
+ ), u = [
2664
+ oe(d.memory),
2665
+ x(n.scoreLabel, {
2666
+ n: d.score.toFixed(2)
2611
2667
  }),
2612
- u.length > 0 ? ne(u, n) : n.pagesNotAvailable
2668
+ a.length > 0 ? ne(a, n) : n.pagesNotAvailable
2613
2669
  ].filter(
2614
- (m) => m != null && m !== ""
2615
- ), a = {
2616
- memoryId: s.memory.id,
2617
- pageNumbers: u
2618
- };
2670
+ (S) => S != null && S !== ""
2671
+ ), g = {
2672
+ memoryId: d.memory.id,
2673
+ pageNumbers: a
2674
+ }, f = `${d.memory.id}-${m}`, p = c === f;
2619
2675
  return /* @__PURE__ */ y(
2620
2676
  T.div,
2621
2677
  {
2622
2678
  initial: { opacity: 0 },
2623
2679
  animate: { opacity: 1 },
2624
- transition: { duration: 0.2, delay: l * 0.04 },
2680
+ transition: { duration: 0.2, delay: m * 0.04 },
2625
2681
  style: {
2626
2682
  display: "flex",
2627
2683
  flexDirection: "row",
@@ -2629,7 +2685,7 @@ const hr = ({
2629
2685
  gap: "12px",
2630
2686
  paddingTop: "12px",
2631
2687
  paddingBottom: "12px",
2632
- borderBottom: l < t.length - 1 ? "1px solid #eee" : void 0,
2688
+ borderBottom: m < t.length - 1 ? "1px solid #eee" : void 0,
2633
2689
  minWidth: 0
2634
2690
  },
2635
2691
  children: [
@@ -2644,7 +2700,7 @@ const hr = ({
2644
2700
  gap: "6px"
2645
2701
  },
2646
2702
  children: [
2647
- /* @__PURE__ */ o(
2703
+ /* @__PURE__ */ i(
2648
2704
  "span",
2649
2705
  {
2650
2706
  style: {
@@ -2652,10 +2708,10 @@ const hr = ({
2652
2708
  fontWeight: 600,
2653
2709
  color: "#333"
2654
2710
  },
2655
- children: d
2711
+ children: o
2656
2712
  }
2657
2713
  ),
2658
- /* @__PURE__ */ o(
2714
+ /* @__PURE__ */ i(
2659
2715
  "span",
2660
2716
  {
2661
2717
  style: {
@@ -2665,10 +2721,10 @@ const hr = ({
2665
2721
  whiteSpace: "pre-wrap",
2666
2722
  wordBreak: "break-word"
2667
2723
  },
2668
- children: re(s.chunks)
2724
+ children: re(d.chunks)
2669
2725
  }
2670
2726
  ),
2671
- /* @__PURE__ */ o(
2727
+ /* @__PURE__ */ i(
2672
2728
  "div",
2673
2729
  {
2674
2730
  style: {
@@ -2677,17 +2733,26 @@ const hr = ({
2677
2733
  color: "#94a3b8",
2678
2734
  lineHeight: 1.35
2679
2735
  },
2680
- children: i.join(" · ")
2736
+ children: u.join(" · ")
2681
2737
  }
2682
2738
  )
2683
2739
  ]
2684
2740
  }
2685
2741
  ),
2686
- c && /* @__PURE__ */ o(
2742
+ l && /* @__PURE__ */ y(
2687
2743
  "button",
2688
2744
  {
2689
2745
  type: "button",
2690
- onClick: () => r(a),
2746
+ "aria-busy": p,
2747
+ disabled: p,
2748
+ onClick: async () => {
2749
+ s(f);
2750
+ try {
2751
+ await r(g);
2752
+ } finally {
2753
+ s(null);
2754
+ }
2755
+ },
2691
2756
  style: {
2692
2757
  flexShrink: 0,
2693
2758
  alignSelf: "center",
@@ -2698,21 +2763,33 @@ const hr = ({
2698
2763
  background: "#eff6ff",
2699
2764
  border: "1px solid #bfdbfe",
2700
2765
  borderRadius: 6,
2701
- cursor: "pointer",
2702
- fontFamily: "inherit"
2766
+ cursor: p ? "wait" : "pointer",
2767
+ fontFamily: "inherit",
2768
+ display: "inline-flex",
2769
+ alignItems: "center",
2770
+ gap: 8
2703
2771
  },
2704
- children: n.viewButton
2772
+ children: [
2773
+ p && /* @__PURE__ */ i(
2774
+ "span",
2775
+ {
2776
+ className: "explore-memory-loader",
2777
+ "aria-hidden": !0
2778
+ }
2779
+ ),
2780
+ n.viewButton
2781
+ ]
2705
2782
  }
2706
2783
  )
2707
2784
  ]
2708
2785
  },
2709
- `${s.memory.id}-${l}`
2786
+ `${d.memory.id}-${m}`
2710
2787
  );
2711
2788
  })
2712
2789
  }
2713
2790
  )
2714
2791
  ] });
2715
- }, Sr = ({ message: e }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
2792
+ }, Sr = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
2716
2793
  T.div,
2717
2794
  {
2718
2795
  initial: { opacity: 0, y: -10 },
@@ -2723,7 +2800,7 @@ const hr = ({
2723
2800
  alignItems: "flex-start",
2724
2801
  gap: "10px"
2725
2802
  },
2726
- children: /* @__PURE__ */ o(
2803
+ children: /* @__PURE__ */ i(
2727
2804
  "span",
2728
2805
  {
2729
2806
  style: {
@@ -2740,63 +2817,63 @@ const hr = ({
2740
2817
  loadingText: r,
2741
2818
  t: n,
2742
2819
  onSourceClick: t,
2743
- onSearchResultClick: c,
2744
- onExploreQueryResultClick: s
2820
+ onSearchResultClick: l,
2821
+ onExploreQueryResultClick: c
2745
2822
  }) => {
2746
- const l = A(null);
2747
- I(() => {
2748
- l.current && (l.current.scrollTop = l.current.scrollHeight);
2823
+ const s = A(null);
2824
+ M(() => {
2825
+ s.current && (s.current.scrollTop = s.current.scrollHeight);
2749
2826
  }, [e.length]);
2750
- const d = (i) => {
2751
- const a = i.item.data;
2827
+ const d = (o) => {
2828
+ const a = o.item.data;
2752
2829
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Text")
2753
- return /* @__PURE__ */ o(V, { text: a.text });
2830
+ return /* @__PURE__ */ i(K, { text: a.text });
2754
2831
  if (a.taskType === "StructuredChatCompletion" && a.eventType === "Completed")
2755
- return /* @__PURE__ */ o(Oe, { data: a });
2832
+ return /* @__PURE__ */ i(Oe, { data: a });
2756
2833
  if (a.taskType === "MemoryChatCompletion")
2757
2834
  switch (a.eventType) {
2758
2835
  case "Text":
2759
- return /* @__PURE__ */ o(V, { text: a.text });
2836
+ return /* @__PURE__ */ i(K, { text: a.text });
2760
2837
  case "FindMemories":
2761
- return /* @__PURE__ */ o(
2762
- He,
2838
+ return /* @__PURE__ */ i(
2839
+ $e,
2763
2840
  {
2764
2841
  data: a,
2765
- isLatest: i.isLatest,
2766
- durationSeconds: i.durationSeconds,
2842
+ isLatest: o.isLatest,
2843
+ durationSeconds: o.durationSeconds,
2767
2844
  t: n
2768
2845
  }
2769
2846
  );
2770
2847
  case "FindMemoriesResult":
2771
- return /* @__PURE__ */ o(
2772
- $e,
2848
+ return /* @__PURE__ */ i(
2849
+ He,
2773
2850
  {
2774
2851
  data: a,
2775
2852
  t: n
2776
2853
  }
2777
2854
  );
2778
2855
  case "Search":
2779
- return /* @__PURE__ */ o(
2780
- Ne,
2856
+ return /* @__PURE__ */ i(
2857
+ We,
2781
2858
  {
2782
2859
  data: a,
2783
- isLatest: i.isLatest,
2784
- durationSeconds: i.durationSeconds,
2860
+ isLatest: o.isLatest,
2861
+ durationSeconds: o.durationSeconds,
2785
2862
  t: n
2786
2863
  }
2787
2864
  );
2788
2865
  case "FindSources":
2789
- return /* @__PURE__ */ o(
2866
+ return /* @__PURE__ */ i(
2790
2867
  _e,
2791
2868
  {
2792
2869
  data: a,
2793
- isLatest: i.isLatest,
2794
- durationSeconds: i.durationSeconds,
2870
+ isLatest: o.isLatest,
2871
+ durationSeconds: o.durationSeconds,
2795
2872
  t: n
2796
2873
  }
2797
2874
  );
2798
2875
  case "SourcesResult":
2799
- return /* @__PURE__ */ o(
2876
+ return /* @__PURE__ */ i(
2800
2877
  Qe,
2801
2878
  {
2802
2879
  data: a,
@@ -2805,67 +2882,67 @@ const hr = ({
2805
2882
  }
2806
2883
  );
2807
2884
  case "ExploreMemories":
2808
- return /* @__PURE__ */ o(
2809
- Ve,
2885
+ return /* @__PURE__ */ i(
2886
+ Ke,
2810
2887
  {
2811
2888
  data: a,
2812
- completed: i.completed,
2813
- isLatest: i.isLatest,
2889
+ completed: o.completed,
2890
+ isLatest: o.isLatest,
2814
2891
  t: n
2815
2892
  }
2816
2893
  );
2817
2894
  case "ChunkResult":
2818
- return /* @__PURE__ */ o(Je, { data: a, t: n });
2895
+ return /* @__PURE__ */ i(Je, { data: a, t: n });
2819
2896
  case "Completed":
2820
2897
  return null;
2821
2898
  }
2822
2899
  if (a.taskType === "MemorySearch")
2823
2900
  switch (a.eventType) {
2824
2901
  case "GeneratingQueries":
2825
- return /* @__PURE__ */ o(
2902
+ return /* @__PURE__ */ i(
2826
2903
  lr,
2827
2904
  {
2828
2905
  data: a,
2829
- isLatest: i.isLatest,
2830
- durationSeconds: i.durationSeconds,
2906
+ isLatest: o.isLatest,
2907
+ durationSeconds: o.durationSeconds,
2831
2908
  t: n
2832
2909
  }
2833
2910
  );
2834
2911
  case "ExploreQueries":
2835
- return /* @__PURE__ */ o(
2912
+ return /* @__PURE__ */ i(
2836
2913
  hr,
2837
2914
  {
2838
2915
  data: a,
2839
- isLatest: i.isLatest,
2840
- durationSeconds: i.durationSeconds,
2841
- onExploreQueryResultClick: s,
2916
+ isLatest: o.isLatest,
2917
+ durationSeconds: o.durationSeconds,
2918
+ onExploreQueryResultClick: c,
2842
2919
  t: n
2843
2920
  }
2844
2921
  );
2845
2922
  case "SearchMemoryTypes":
2846
- return /* @__PURE__ */ o(
2923
+ return /* @__PURE__ */ i(
2847
2924
  rr,
2848
2925
  {
2849
2926
  data: a,
2850
- isLatest: i.isLatest,
2851
- durationSeconds: i.durationSeconds,
2927
+ isLatest: o.isLatest,
2928
+ durationSeconds: o.durationSeconds,
2852
2929
  t: n
2853
2930
  }
2854
2931
  );
2855
2932
  case "Completed":
2856
- return /* @__PURE__ */ o(
2933
+ return /* @__PURE__ */ i(
2857
2934
  fr,
2858
2935
  {
2859
2936
  data: a,
2860
- onSearchResultClick: c,
2937
+ onSearchResultClick: l,
2861
2938
  t: n
2862
2939
  }
2863
2940
  );
2864
2941
  }
2865
- return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ o(Sr, { message: a.message }) : null;
2942
+ return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ i(Sr, { message: a.message }) : null;
2866
2943
  };
2867
2944
  if (e.length === 0)
2868
- return /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
2945
+ return /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
2869
2946
  C,
2870
2947
  {
2871
2948
  text: r ?? n.processingYourTask,
@@ -2876,20 +2953,20 @@ const hr = ({
2876
2953
  shimmerColor: "#000"
2877
2954
  }
2878
2955
  ) });
2879
- const u = e.filter((i, a) => {
2880
- const m = i.item.data;
2881
- return m.taskType === "MemoryChatCompletion" && m.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
2882
- (p) => p.item.data.taskType === "MemoryChatCompletion" && p.item.data.eventType === "ExploreMemories"
2883
- ) : m.taskType === "MemorySearch" && m.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
2884
- (p) => p.item.data.taskType === "MemorySearch" && p.item.data.eventType === "GeneratingQueries"
2885
- ) : m.taskType === "MemorySearch" && m.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
2886
- (p) => p.item.data.taskType === "MemorySearch" && p.item.data.eventType === "ExploreQueries"
2956
+ const m = e.filter((o, a) => {
2957
+ const u = o.item.data;
2958
+ return u.taskType === "MemoryChatCompletion" && u.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
2959
+ (h) => h.item.data.taskType === "MemoryChatCompletion" && h.item.data.eventType === "ExploreMemories"
2960
+ ) : u.taskType === "MemorySearch" && u.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
2961
+ (h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "GeneratingQueries"
2962
+ ) : u.taskType === "MemorySearch" && u.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
2963
+ (h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "ExploreQueries"
2887
2964
  ) : !0;
2888
2965
  });
2889
- return /* @__PURE__ */ o("div", { id: "agent-task-progress-verbose", ref: l, children: /* @__PURE__ */ o(X, { children: u.map((i, a) => /* @__PURE__ */ o(
2966
+ return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(X, { children: m.map((o, a) => /* @__PURE__ */ i(
2890
2967
  T.div,
2891
2968
  {
2892
- id: `agent-task-progress-item-${i.item.progressItemId}`,
2969
+ id: `agent-task-progress-item-${o.item.progressItemId}`,
2893
2970
  initial: { opacity: 0, y: -20 },
2894
2971
  animate: { opacity: 1, y: 0 },
2895
2972
  transition: {
@@ -2897,42 +2974,42 @@ const hr = ({
2897
2974
  delay: a * 0.1,
2898
2975
  ease: "easeOut"
2899
2976
  },
2900
- children: d(i)
2977
+ children: d(o)
2901
2978
  },
2902
- i.item.progressItemId
2979
+ o.item.progressItemId
2903
2980
  )) }) });
2904
2981
  }, Ar = ({
2905
2982
  agentTask: e,
2906
2983
  mode: r = "verbose",
2907
2984
  language: n,
2908
2985
  onSourceClick: t,
2909
- onSearchResultClick: c,
2910
- onExploreQueryResultClick: s
2986
+ onSearchResultClick: l,
2987
+ onExploreQueryResultClick: c
2911
2988
  }) => {
2912
- const l = De(e), d = (e.params.type === "MemoryChatCompletion" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : n ?? "en", u = We(d);
2913
- return r === "simple" ? /* @__PURE__ */ o(
2989
+ const s = De(e), d = (e.params.type === "MemoryChatCompletion" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : n ?? "en", m = Ne(d);
2990
+ return r === "simple" ? /* @__PURE__ */ i(
2914
2991
  ze,
2915
2992
  {
2916
- progressViewItems: l,
2917
- t: u
2993
+ progressViewItems: s,
2994
+ t: m
2918
2995
  }
2919
- ) : /* @__PURE__ */ o(
2996
+ ) : /* @__PURE__ */ i(
2920
2997
  xr,
2921
2998
  {
2922
- progressViewItems: l,
2999
+ progressViewItems: s,
2923
3000
  loadingText: e.loadingText,
2924
- t: u,
3001
+ t: m,
2925
3002
  onSourceClick: t,
2926
- onSearchResultClick: c,
2927
- onExploreQueryResultClick: s
3003
+ onSearchResultClick: l,
3004
+ onExploreQueryResultClick: c
2928
3005
  }
2929
3006
  );
2930
3007
  };
2931
3008
  export {
2932
3009
  Ar as AgentTaskProgress,
2933
3010
  z as Checkmark,
2934
- Mr as FencyProvider,
3011
+ Ir as FencyProvider,
2935
3012
  fr as MemorySearchCompletedResults,
2936
3013
  j as XMark,
2937
- Ir as useAgentTasks
3014
+ Mr as useAgentTasks
2938
3015
  };