@fencyai/react 0.1.155 → 0.1.156

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