teodor-new-chat-ui 4.3.618 → 4.3.620

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.esm.js CHANGED
@@ -1241,8 +1241,8 @@ const Jc = (e) => {
1241
1241
  onDownloadProgress: C,
1242
1242
  onUploadProgress: y,
1243
1243
  responseType: T,
1244
- headers: A,
1245
- withCredentials: _ = "same-origin",
1244
+ headers: N,
1245
+ withCredentials: A = "same-origin",
1246
1246
  fetchOptions: M
1247
1247
  } = Jc(m), D = t || fetch;
1248
1248
  T = T ? (T + "").toLowerCase() : "text";
@@ -1252,13 +1252,13 @@ const Jc = (e) => {
1252
1252
  });
1253
1253
  let J;
1254
1254
  try {
1255
- if (y && l && x !== "get" && x !== "head" && (J = await p(A, w)) !== 0) {
1255
+ if (y && l && x !== "get" && x !== "head" && (J = await p(N, w)) !== 0) {
1256
1256
  let z = new n(g, {
1257
1257
  method: "POST",
1258
1258
  body: w,
1259
1259
  duplex: "half"
1260
1260
  }), I;
1261
- if (B.isFormData(w) && (I = z.headers.get("content-type")) && A.setContentType(I), z.body) {
1261
+ if (B.isFormData(w) && (I = z.headers.get("content-type")) && N.setContentType(I), z.body) {
1262
1262
  const [E, P] = Xa(
1263
1263
  J,
1264
1264
  Yo(Ja(y))
@@ -1266,15 +1266,15 @@ const Jc = (e) => {
1266
1266
  w = Qa(z.body, el, E, P);
1267
1267
  }
1268
1268
  }
1269
- B.isString(_) || (_ = _ ? "include" : "omit");
1269
+ B.isString(A) || (A = A ? "include" : "omit");
1270
1270
  const Y = s && "credentials" in n.prototype, ne = {
1271
1271
  ...M,
1272
1272
  signal: U,
1273
1273
  method: x.toUpperCase(),
1274
- headers: A.normalize().toJSON(),
1274
+ headers: N.normalize().toJSON(),
1275
1275
  body: w,
1276
1276
  duplex: "half",
1277
- credentials: Y ? _ : void 0
1277
+ credentials: Y ? A : void 0
1278
1278
  };
1279
1279
  W = s && new n(g, ne);
1280
1280
  let H = await (s ? D(W, M) : D(g, ne));
@@ -2055,14 +2055,14 @@ function gg() {
2055
2055
  ke.unshift("Warning: " + j), Function.prototype.apply.call(console[S], console, ke);
2056
2056
  }
2057
2057
  }
2058
- var R = !1, C = !1, y = !1, T = !1, A = !1, _;
2059
- _ = Symbol.for("react.module.reference");
2058
+ var R = !1, C = !1, y = !1, T = !1, N = !1, A;
2059
+ A = Symbol.for("react.module.reference");
2060
2060
  function M(S) {
2061
- return !!(typeof S == "string" || typeof S == "function" || S === r || S === s || A || S === o || S === l || S === u || T || S === p || R || C || y || typeof S == "object" && S !== null && (S.$$typeof === h || S.$$typeof === f || S.$$typeof === i || S.$$typeof === a || S.$$typeof === c || // This needs to include all possible module reference object
2061
+ return !!(typeof S == "string" || typeof S == "function" || S === r || S === s || N || S === o || S === l || S === u || T || S === p || R || C || y || typeof S == "object" && S !== null && (S.$$typeof === h || S.$$typeof === f || S.$$typeof === i || S.$$typeof === a || S.$$typeof === c || // This needs to include all possible module reference object
2062
2062
  // types supported by any Flight configuration anywhere since
2063
2063
  // we don't know which Flight build this will end up being used
2064
2064
  // with.
2065
- S.$$typeof === _ || S.getModuleId !== void 0));
2065
+ S.$$typeof === A || S.getModuleId !== void 0));
2066
2066
  }
2067
2067
  function D(S, j, F) {
2068
2068
  var se = S.displayName;
@@ -2182,7 +2182,7 @@ function gg() {
2182
2182
  }
2183
2183
  }
2184
2184
  var K = w.ReactCurrentDispatcher, X;
2185
- function N(S, j, F) {
2185
+ function _(S, j, F) {
2186
2186
  {
2187
2187
  if (X === void 0)
2188
2188
  try {
@@ -2268,7 +2268,7 @@ function gg() {
2268
2268
  } finally {
2269
2269
  V = !1, K.current = ke, O(), Error.prepareStackTrace = ie;
2270
2270
  }
2271
- var ir = S ? S.displayName || S.name : "", Bn = ir ? N(ir) : "";
2271
+ var ir = S ? S.displayName || S.name : "", Bn = ir ? _(ir) : "";
2272
2272
  return typeof S == "function" && te.set(S, Bn), Bn;
2273
2273
  }
2274
2274
  function ce(S, j, F) {
@@ -2284,12 +2284,12 @@ function gg() {
2284
2284
  if (typeof S == "function")
2285
2285
  return pe(S, me(S));
2286
2286
  if (typeof S == "string")
2287
- return N(S);
2287
+ return _(S);
2288
2288
  switch (S) {
2289
2289
  case l:
2290
- return N("Suspense");
2290
+ return _("Suspense");
2291
2291
  case u:
2292
- return N("SuspenseList");
2292
+ return _("SuspenseList");
2293
2293
  }
2294
2294
  if (typeof S == "object")
2295
2295
  switch (S.$$typeof) {
@@ -2767,33 +2767,33 @@ function hr(e) {
2767
2767
  };
2768
2768
  }
2769
2769
  function kg(e, t) {
2770
- var R, C, y, T;
2770
+ var C, y, T, N;
2771
2771
  if (!e) return null;
2772
- const n = ((R = e.values) == null ? void 0 : R.active_agent) ?? ((C = e.values) == null ? void 0 : C.activeAgent) ?? null, o = (Array.isArray((y = e.values) == null ? void 0 : y.messages) ? e.values.messages : []).map((A) => Tg(A, n)).filter((A) => !!A), s = qn(e.metadata) ?? {}, i = dl(e.config), a = qn(e.parent_config ?? e.parentConfig), c = dl(a), l = Dr(i, ["checkpoint_id", "checkpointId"]), u = Dr(i, ["checkpoint_ns", "checkpointNs"]), f = Dr(c, ["checkpoint_id", "checkpointId"]), h = qn(e.config), p = Array.isArray(e.tasks) ? e.tasks.map((A) => ({ ...A })) : e.tasks ?? null, m = Array.isArray(e.next) ? [...e.next] : e.next ?? null, g = typeof e.created_at == "string" && e.created_at.trim() ? e.created_at : typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), x = {
2773
- ...s,
2774
- step: Cg(s, ["step"]) ?? 0,
2775
- source: Dr(s, ["source"]) ?? null
2776
- }, w = o.map((A) => ({
2772
+ const n = ((C = e.values) == null ? void 0 : C.active_agent) ?? ((y = e.values) == null ? void 0 : y.activeAgent) ?? null, r = (T = e.values) == null ? void 0 : T.messages, s = (Array.isArray(r) ? r : []).map((A) => Tg(A, n)).filter((A) => !!A), i = qn(e.metadata) ?? {}, a = dl(e.config), c = qn(e.parent_config ?? e.parentConfig), l = dl(c), u = Dr(a, ["checkpoint_id", "checkpointId"]), f = Dr(a, ["checkpoint_ns", "checkpointNs"]), h = Dr(l, ["checkpoint_id", "checkpointId"]), p = qn(e.config), m = Array.isArray(e.tasks) ? e.tasks.map((A) => ({ ...A })) : e.tasks ?? null, g = Array.isArray(e.next) ? [...e.next] : e.next ?? null, x = typeof e.created_at == "string" && e.created_at.trim() ? e.created_at : typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), w = {
2773
+ ...i,
2774
+ step: Cg(i, ["step"]) ?? 0,
2775
+ source: Dr(i, ["source"]) ?? null
2776
+ }, v = s.map((A) => ({
2777
2777
  ...A,
2778
- checkpointId: l ?? null
2779
- })), v = (T = e.values) == null ? void 0 : T.interrupts, k = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(v) ? v : [];
2778
+ checkpointId: u ?? null
2779
+ })), k = (N = e.values) == null ? void 0 : N.interrupts, R = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(k) ? k : [];
2780
2780
  return {
2781
- checkpointId: l ?? null,
2782
- checkpointNs: u ?? null,
2783
- createdAt: g,
2784
- parentId: f ?? null,
2785
- messages: w,
2781
+ checkpointId: u ?? null,
2782
+ checkpointNs: f ?? null,
2783
+ createdAt: x,
2784
+ parentId: h ?? null,
2785
+ messages: v,
2786
2786
  interrupt: Ag(
2787
- o,
2788
- k,
2787
+ s,
2788
+ R,
2789
2789
  t,
2790
- l ?? null
2790
+ u ?? null
2791
2791
  ),
2792
- metadata: x,
2793
- config: h ?? null,
2794
- parentConfig: a ?? null,
2795
- next: m,
2796
- tasks: p,
2792
+ metadata: w,
2793
+ config: p ?? null,
2794
+ parentConfig: c ?? null,
2795
+ next: g,
2796
+ tasks: m,
2797
2797
  values: e.values ?? {}
2798
2798
  };
2799
2799
  }
@@ -2812,6 +2812,8 @@ function Tg(e, t) {
2812
2812
  model: a,
2813
2813
  createdAt: o,
2814
2814
  content: r,
2815
+ toolCallId: e.toolCallId ?? e.tool_call_id ?? void 0,
2816
+ tool_calls: e.tool_calls ?? e.toolCalls ?? void 0,
2815
2817
  additionalKwargs: e.additional_kwargs ?? void 0,
2816
2818
  responseMetadata: e.response_metadata ?? void 0,
2817
2819
  artifact: e.artifact ?? void 0,
@@ -2889,14 +2891,14 @@ function _g(e) {
2889
2891
  return !!e && typeof e == "object" && "data" in e;
2890
2892
  }
2891
2893
  function jg(e = {}) {
2892
- const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, o] = de(e.token ?? null), s = Se(e.headers ?? {}), i = e.credentials ?? "include", [a, c] = de(!1), [l, u] = de(null), [f, h] = de(""), [p, m] = de(null), [g, x] = de(0), [w, v] = de(!1), [k, R] = de({}), [C, y] = de(null), [T, A] = de({}), _ = Se(null), M = Se(!0), D = Se(0), U = Se(null), W = Se(null), L = Se(null), J = Se(null), Y = Se({
2894
+ const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, o] = de(e.token ?? null), s = Se(e.headers ?? {}), i = e.credentials ?? "include", [a, c] = de(!1), [l, u] = de(null), [f, h] = de(""), [p, m] = de(null), [g, x] = de(0), [w, v] = de(!1), [k, R] = de({}), [C, y] = de(null), [T, N] = de({}), A = Se(null), M = Se(!0), D = Se(0), U = Se(null), W = Se(null), L = Se(null), J = Se(null), Y = Se({
2893
2895
  messageId: null,
2894
2896
  lastSeq: null,
2895
2897
  lastText: ""
2896
2898
  }), ne = re((z) => {
2897
2899
  o(z);
2898
2900
  }, []), H = re(() => {
2899
- h(""), m(null), u(null), W.current = null, L.current = null, J.current = null, R({}), y(null), A({}), Y.current = {
2901
+ h(""), m(null), u(null), W.current = null, L.current = null, J.current = null, R({}), y(null), N({}), Y.current = {
2900
2902
  messageId: null,
2901
2903
  lastSeq: null,
2902
2904
  lastText: ""
@@ -2906,34 +2908,34 @@ function jg(e = {}) {
2906
2908
  console.debug("[use-chat] stop() invoked - aborting stream");
2907
2909
  const z = (P = U.current) == null ? void 0 : P.threadId, I = () => {
2908
2910
  var O;
2909
- (O = _.current) == null || O.abort(), _.current = null, U.current = null, c(!1), v(!1), D.current = 0, x(0);
2911
+ (O = A.current) == null || O.abort(), A.current = null, U.current = null, c(!1), v(!1), D.current = 0, x(0);
2910
2912
  };
2911
2913
  (z ? Xn.cancelRun(z).catch((O) => {
2912
2914
  console.warn("[use-chat] cancel run failed:", O);
2913
2915
  }) : Promise.resolve()).finally(I);
2914
2916
  }, []), q = re(
2915
2917
  (z, I, E) => {
2916
- _.current && (_.current.abort(), _.current = null), c(!0), u(null), e.autoAppendAssistant !== !1 && h(""), m(null), W.current = null, L.current = null, J.current = null, R({}), y(null), A({}), Y.current = {
2918
+ A.current && (A.current.abort(), A.current = null), c(!0), u(null), e.autoAppendAssistant !== !1 && h(""), m(null), W.current = null, L.current = null, J.current = null, R({}), y(null), N({}), Y.current = {
2917
2919
  messageId: null,
2918
2920
  lastSeq: null,
2919
2921
  lastText: ""
2920
2922
  };
2921
2923
  const P = new AbortController();
2922
- _.current = P;
2924
+ A.current = P;
2923
2925
  let O = null, K = null, X = !1;
2924
2926
  return U.current = {
2925
2927
  threadId: z.threadId ?? null,
2926
2928
  headers: {},
2927
2929
  isStreaming: !0
2928
2930
  }, (async () => {
2929
- var N, V, te, ae, pe, ce, me, be, We, Fe, je, He, nt, xt, at, Ue, Le, Qe;
2931
+ var _, V, te, ae, pe, ce, me, be, We, Fe, je, He, nt, xt, at, Ue, Le, Qe;
2930
2932
  try {
2931
2933
  let it = {};
2932
2934
  try {
2933
2935
  if (r)
2934
2936
  it = { Authorization: `Bearer ${r}` };
2935
2937
  else if (typeof window < "u") {
2936
- const Ie = window.__AUTH_TOKEN__, Ke = ((N = window.localStorage) == null ? void 0 : N.getItem(Vn.authToken)) || null;
2938
+ const Ie = window.__AUTH_TOKEN__, Ke = ((_ = window.localStorage) == null ? void 0 : _.getItem(Vn.authToken)) || null;
2937
2939
  let ft = null;
2938
2940
  try {
2939
2941
  const Ot = (V = window.localStorage) == null ? void 0 : V.getItem(Vn.chatSettings);
@@ -3066,7 +3068,7 @@ function jg(e = {}) {
3066
3068
  J.current = Z;
3067
3069
  try {
3068
3070
  const F = hr(Z).latest;
3069
- F && (W.current = F.checkpointId ?? null, L.current = F.checkpointNs ?? null, m(F.checkpointId ?? null), A(F.values ?? {}));
3071
+ F && (W.current = F.checkpointId ?? null, L.current = F.checkpointNs ?? null, m(F.checkpointId ?? null), N(F.values ?? {}));
3070
3072
  } catch (j) {
3071
3073
  console.warn("[use-chat] Failed to hydrate state_history payload", j);
3072
3074
  }
@@ -3218,7 +3220,7 @@ function jg(e = {}) {
3218
3220
  } catch (lt) {
3219
3221
  console.warn("[use-chat] onClosed callback failed", lt);
3220
3222
  }
3221
- c(!1), v(!1), _.current = null, D.current = 0, x(0), U.current = null;
3223
+ c(!1), v(!1), A.current = null, D.current = 0, x(0), U.current = null;
3222
3224
  }
3223
3225
  })(), { close: () => P.abort() };
3224
3226
  },
@@ -3226,7 +3228,7 @@ function jg(e = {}) {
3226
3228
  );
3227
3229
  return Pe(() => () => {
3228
3230
  var z;
3229
- M.current = !1, (z = _.current) == null || z.abort();
3231
+ M.current = !1, (z = A.current) == null || z.abort();
3230
3232
  }, []), {
3231
3233
  isStreaming: a,
3232
3234
  error: l,
@@ -3302,7 +3304,7 @@ function Mg({
3302
3304
  }, [a]), Pe(() => {
3303
3305
  t !== void 0 && t !== y.current && c(t);
3304
3306
  }, [t]);
3305
- const A = re(async () => {
3307
+ const N = re(async () => {
3306
3308
  u(!0), h(null);
3307
3309
  try {
3308
3310
  const H = await e.listThreads();
@@ -3313,7 +3315,7 @@ function Mg({
3313
3315
  } finally {
3314
3316
  u(!1);
3315
3317
  }
3316
- }, [e, n]), _ = re(async () => {
3318
+ }, [e, n]), A = re(async () => {
3317
3319
  x(!0), w(null);
3318
3320
  try {
3319
3321
  const H = await e.listSharedThreads();
@@ -3326,23 +3328,23 @@ function Mg({
3326
3328
  }
3327
3329
  }, [e, n]);
3328
3330
  Pe(() => {
3331
+ N();
3332
+ }, [N]), Pe(() => {
3329
3333
  A();
3330
3334
  }, [A]), Pe(() => {
3331
- _();
3332
- }, [_]), Pe(() => {
3333
3335
  r == null || r(a);
3334
3336
  }, [a, r]);
3335
3337
  const M = re(
3336
3338
  async (H, $) => {
3337
3339
  try {
3338
3340
  const q = $ && typeof $ == "object" ? { id: $.id, name: $.name ?? "" } : void 0, z = await e.createThread(H, q);
3339
- return c(z.threadId), await A(), z.threadId;
3341
+ return c(z.threadId), await N(), z.threadId;
3340
3342
  } catch (q) {
3341
3343
  const z = String(q);
3342
3344
  return n == null || n(z), null;
3343
3345
  }
3344
3346
  },
3345
- [e, n, A]
3347
+ [e, n, N]
3346
3348
  ), D = re(
3347
3349
  async (H) => {
3348
3350
  const $ = s;
@@ -3363,17 +3365,17 @@ function Mg({
3363
3365
  ), U = re(
3364
3366
  async (H, $) => {
3365
3367
  try {
3366
- await e.updateThread(H, $), await A();
3368
+ await e.updateThread(H, $), await N();
3367
3369
  } catch (q) {
3368
3370
  n == null || n(String(q));
3369
3371
  }
3370
3372
  },
3371
- [e, n, A]
3373
+ [e, n, N]
3372
3374
  ), W = re(
3373
3375
  async (H, $) => {
3374
3376
  C(!0), k("Sharing thread…");
3375
3377
  try {
3376
- await e.shareThread(H, $), await _(), k("Shared successfully");
3378
+ await e.shareThread(H, $), await A(), k("Shared successfully");
3377
3379
  } catch (q) {
3378
3380
  const z = Og(q);
3379
3381
  throw n == null || n(z), k(`Failed to share: ${z}`), new Error(z);
@@ -3381,28 +3383,28 @@ function Mg({
3381
3383
  C(!1);
3382
3384
  }
3383
3385
  },
3384
- [e, n, _]
3386
+ [e, n, A]
3385
3387
  ), L = re(
3386
3388
  async (H, $) => {
3387
3389
  try {
3388
- await e.unshareThread(H, $), await _();
3390
+ await e.unshareThread(H, $), await A();
3389
3391
  } catch (q) {
3390
3392
  const z = String(q);
3391
3393
  throw n == null || n(z), q;
3392
3394
  }
3393
3395
  },
3394
- [e, n, _]
3396
+ [e, n, A]
3395
3397
  ), J = De(
3396
3398
  () => ({
3397
3399
  createThread: M,
3398
3400
  deleteThread: D,
3399
3401
  renameThread: U,
3400
- refreshThreads: A,
3401
- refreshSharedThreads: _,
3402
+ refreshThreads: N,
3403
+ refreshSharedThreads: A,
3402
3404
  shareThread: W,
3403
3405
  unshareThread: L
3404
3406
  }),
3405
- [M, D, U, A, _, W, L]
3407
+ [M, D, U, N, A, W, L]
3406
3408
  ), Y = re((H) => {
3407
3409
  if (!(H != null && H.threadId)) return;
3408
3410
  const $ = {
@@ -3619,7 +3621,7 @@ function uu(e) {
3619
3621
  }
3620
3622
  function ws(e) {
3621
3623
  return {
3622
- toolCallId: e.toolCallId ?? void 0,
3624
+ toolCallId: (e.toolCallId || e.tool_call_id) ?? void 0,
3623
3625
  name: e.name ?? void 0
3624
3626
  };
3625
3627
  }
@@ -3709,12 +3711,7 @@ function Hg(e, t) {
3709
3711
  const l = e[c];
3710
3712
  if (l.role === "tool") {
3711
3713
  const f = ws(l).toolCallId;
3712
- if (console.log("[buildToolExecutionTimeline] Tool message at index", c, {
3713
- toolCallId: f,
3714
- name: l.name,
3715
- hasMatch: o.has(f || ""),
3716
- toolCallMapKeys: Array.from(o.keys())
3717
- }), f && o.has(f)) {
3714
+ if (f && o.has(f)) {
3718
3715
  const h = Array.isArray(l.content) ? l.content : Array.isArray(l.parts) ? l.parts : [], p = uu(h.filter((m) => m.type === "text"));
3719
3716
  i.set(f, {
3720
3717
  content: p || `Finished ${l.name || "tool"}`,
@@ -4275,7 +4272,7 @@ function cx({
4275
4272
  const [u, f] = de(null), p = De(
4276
4273
  () => hr(u),
4277
4274
  [u]
4278
- ).checkpoints, m = lx(p), g = m.timeline, [x, w] = de(!1), [v, k] = de(!1), [R, C] = de(null), y = Se(r), T = Se(null), A = Se(null), _ = Se(null), M = Se(null), D = Se(null), U = Se(/* @__PURE__ */ new Map()), W = Se(null);
4275
+ ).checkpoints, m = lx(p), g = m.timeline, [x, w] = de(!1), [v, k] = de(!1), [R, C] = de(null), y = Se(r), T = Se(null), N = Se(null), A = Se(null), M = Se(null), D = Se(null), U = Se(/* @__PURE__ */ new Map()), W = Se(null);
4279
4276
  Pe(() => {
4280
4277
  y.current = r;
4281
4278
  }, [r]);
@@ -4287,12 +4284,12 @@ function cx({
4287
4284
  (K = P.onStart) == null || K.call(P), P.setLoading(!0);
4288
4285
  try {
4289
4286
  await P.action(O);
4290
- } catch (N) {
4291
- if (!al(N) && y.current === O) {
4292
- const te = String(N);
4287
+ } catch (_) {
4288
+ if (!al(_) && y.current === O) {
4289
+ const te = String(_);
4293
4290
  (X = P.handleError) == null || X.call(P, te), n == null || n(te);
4294
4291
  }
4295
- throw N;
4292
+ throw _;
4296
4293
  } finally {
4297
4294
  P.setLoading(!1);
4298
4295
  }
@@ -4306,8 +4303,8 @@ function cx({
4306
4303
  if (X)
4307
4304
  return X;
4308
4305
  (te = W.current) == null || te.abort();
4309
- const N = new AbortController();
4310
- W.current = N;
4306
+ const _ = new AbortController();
4307
+ W.current = _;
4311
4308
  const V = L({
4312
4309
  threadId: P,
4313
4310
  setLoading: w,
@@ -4317,7 +4314,7 @@ function cx({
4317
4314
  const pe = await e.getStateHistory({
4318
4315
  threadId: ae,
4319
4316
  checkpointId: O ?? void 0,
4320
- signal: N.signal
4317
+ signal: _.signal
4321
4318
  });
4322
4319
  if (y.current !== ae) {
4323
4320
  console.log(
@@ -4337,7 +4334,7 @@ function cx({
4337
4334
  try {
4338
4335
  await V;
4339
4336
  } finally {
4340
- U.current.delete(K), W.current === N && (W.current = null);
4337
+ U.current.delete(K), W.current === _ && (W.current = null);
4341
4338
  }
4342
4339
  return y.current === P && (D.current = K), V;
4343
4340
  },
@@ -4356,9 +4353,9 @@ function cx({
4356
4353
  },
4357
4354
  [J]
4358
4355
  ), ne = re((P) => {
4359
- A.current = P;
4356
+ N.current = P;
4360
4357
  }, []), H = re((P) => {
4361
- _.current = P;
4358
+ A.current = P;
4362
4359
  }, []), $ = re(
4363
4360
  (P) => {
4364
4361
  const O = P.threadId ?? y.current;
@@ -4367,12 +4364,12 @@ function cx({
4367
4364
  const { checkpoints: K, latest: X } = hr(P);
4368
4365
  if (!K.length)
4369
4366
  return;
4370
- const N = X, V = _.current === O;
4371
- !c && !V && t((N == null ? void 0 : N.messages) ?? [], {
4372
- checkpointId: (N == null ? void 0 : N.checkpointId) ?? null,
4373
- checkpointNs: (N == null ? void 0 : N.checkpointNs) ?? null,
4374
- pendingInterrupt: (N == null ? void 0 : N.interrupt) ?? null
4375
- }), f(P), D.current = `${O}:latest`, A.current = null, _.current === O && (_.current = null);
4367
+ const _ = X, V = A.current === O;
4368
+ !c && !V && t((_ == null ? void 0 : _.messages) ?? [], {
4369
+ checkpointId: (_ == null ? void 0 : _.checkpointId) ?? null,
4370
+ checkpointNs: (_ == null ? void 0 : _.checkpointNs) ?? null,
4371
+ pendingInterrupt: (_ == null ? void 0 : _.interrupt) ?? null
4372
+ }), f(P), D.current = `${O}:latest`, N.current = null, A.current === O && (A.current = null);
4376
4373
  },
4377
4374
  [t, c]
4378
4375
  ), q = re(
@@ -4382,21 +4379,21 @@ function cx({
4382
4379
  threadId: K,
4383
4380
  setLoading: k,
4384
4381
  action: async (X) => {
4385
- const N = await e.getStateHistory({
4382
+ const _ = await e.getStateHistory({
4386
4383
  threadId: X,
4387
4384
  checkpointId: P,
4388
4385
  checkpointNs: O ?? void 0
4389
4386
  });
4390
4387
  if (y.current !== X)
4391
4388
  return;
4392
- const { checkpoints: V } = hr(N), te = V.find(
4389
+ const { checkpoints: V } = hr(_), te = V.find(
4393
4390
  (ae) => ae.checkpointId === P && (O ? ae.checkpointNs === O : !0)
4394
4391
  );
4395
4392
  if (!te) {
4396
4393
  console.warn("[useThreadHistoryState] Requested checkpoint not found:", { checkpointId: P, checkpointNs: O });
4397
4394
  return;
4398
4395
  }
4399
- f(N), t(te.messages ?? [], {
4396
+ f(_), t(te.messages ?? [], {
4400
4397
  checkpointId: te.checkpointId ?? null,
4401
4398
  checkpointNs: te.checkpointNs ?? null
4402
4399
  });
@@ -4419,11 +4416,11 @@ function cx({
4419
4416
  Pe(() => {
4420
4417
  if (!a || !r || x || c)
4421
4418
  return;
4422
- if (A.current === r) {
4423
- A.current = null, T.current = r;
4419
+ if (N.current === r) {
4420
+ N.current = null, T.current = r;
4424
4421
  return;
4425
4422
  }
4426
- if (_.current === r) {
4423
+ if (A.current === r) {
4427
4424
  T.current = r;
4428
4425
  return;
4429
4426
  }
@@ -4448,7 +4445,7 @@ function cx({
4448
4445
  Y
4449
4446
  ]);
4450
4447
  const E = re(() => {
4451
- f(null), w(!1), k(!1), C(null), A.current = null, _.current = null, T.current = null, D.current = null, M.current = null;
4448
+ f(null), w(!1), k(!1), C(null), N.current = null, A.current = null, T.current = null, D.current = null, M.current = null;
4452
4449
  }, []);
4453
4450
  return {
4454
4451
  threadCheckpoints: p,
@@ -4501,8 +4498,8 @@ function dx({
4501
4498
  setCurrentCheckpointId: C,
4502
4499
  returnToLatest: y,
4503
4500
  handleStateHistoryEvent: T,
4504
- markSkipNextLoad: A,
4505
- markStreamPendingThread: _,
4501
+ markSkipNextLoad: N,
4502
+ markStreamPendingThread: A,
4506
4503
  resetHistoryState: M
4507
4504
  } = cx({
4508
4505
  api: a,
@@ -4583,8 +4580,8 @@ function dx({
4583
4580
  },
4584
4581
  messagePreviews: g.messagePreviews,
4585
4582
  handleStateHistoryEvent: T,
4586
- markSkipNextLoad: A,
4587
- markStreamPendingThread: _,
4583
+ markSkipNextLoad: N,
4584
+ markStreamPendingThread: A,
4588
4585
  resetHistoryState: M,
4589
4586
  pushUser: Y,
4590
4587
  onEvent: f
@@ -4610,8 +4607,8 @@ function dx({
4610
4607
  y,
4611
4608
  k,
4612
4609
  T,
4610
+ N,
4613
4611
  A,
4614
- _,
4615
4612
  Y,
4616
4613
  f
4617
4614
  ]
@@ -4723,8 +4720,8 @@ function gx({
4723
4720
  markSkipNextLoad: C,
4724
4721
  markStreamPendingThread: y,
4725
4722
  resetHistoryState: T,
4726
- pushUser: A,
4727
- onEvent: _,
4723
+ pushUser: N,
4724
+ onEvent: A,
4728
4725
  messages: M
4729
4726
  } = ys(), { registerClearThread: D, registerRespondToInterrupt: U } = ux(), W = re(
4730
4727
  (z) => {
@@ -4733,9 +4730,9 @@ function gx({
4733
4730
  [g, C, y, p, m]
4734
4731
  ), L = re(
4735
4732
  (z) => {
4736
- z.type === "thread_info" ? W(z) : z.type === "state_history" ? R(z) : z.type === "tool.end" ? (_(z), i == null || i(z)) : _(z);
4733
+ z.type === "thread_info" ? W(z) : z.type === "state_history" ? R(z) : z.type === "tool.end" ? (A(z), i == null || i(z)) : A(z);
4737
4734
  },
4738
- [W, R, _, i]
4735
+ [W, R, A, i]
4739
4736
  ), J = re(
4740
4737
  (z, I) => {
4741
4738
  a(z, (E) => {
@@ -4786,9 +4783,9 @@ function gx({
4786
4783
  async (z, I) => {
4787
4784
  u && c();
4788
4785
  let E = m.current;
4789
- const P = (z == null ? void 0 : z.text) ?? "", O = (z == null ? void 0 : z.attachments) ?? [], K = (P == null ? void 0 : P.trim()) ?? "", X = { ...(z == null ? void 0 : z.payload) ?? {} }, N = Array.isArray(X.messages) ? X.messages : void 0;
4790
- N && delete X.messages;
4791
- const V = !!(N && N.length), te = !!(z.contentParts && z.contentParts.length > 0);
4786
+ const P = (z == null ? void 0 : z.text) ?? "", O = (z == null ? void 0 : z.attachments) ?? [], K = (P == null ? void 0 : P.trim()) ?? "", X = { ...(z == null ? void 0 : z.payload) ?? {} }, _ = Array.isArray(X.messages) ? X.messages : void 0;
4787
+ _ && delete X.messages;
4788
+ const V = !!(_ && _.length), te = !!(z.contentParts && z.contentParts.length > 0);
4792
4789
  if (!E && !K && O.length === 0 && !V && !te) return;
4793
4790
  if (!E) {
4794
4791
  const Le = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), Qe = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
@@ -4807,9 +4804,9 @@ function gx({
4807
4804
  role: "user",
4808
4805
  content: me,
4809
4806
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4810
- }, "user"), We ? A(je, { editingMessageId: be }) : A(je);
4807
+ }, "user"), We ? N(je, { editingMessageId: be }) : N(je);
4811
4808
  }
4812
- const He = V ? N : je ? [je] : [], nt = {
4809
+ const He = V ? _ : je ? [je] : [], nt = {
4813
4810
  ...X,
4814
4811
  ...ce.length ? { files_info: ce } : {}
4815
4812
  };
@@ -4829,7 +4826,7 @@ function gx({
4829
4826
  };
4830
4827
  J(Ue, I == null ? void 0 : I.onEvent);
4831
4828
  },
4832
- [v, m, u, C, A, J, c, k]
4829
+ [v, m, u, C, N, J, c, k]
4833
4830
  ), q = De(
4834
4831
  () => ({
4835
4832
  isStreaming: u,
@@ -5808,11 +5805,11 @@ const qx = {
5808
5805
  ye((C) => C.length > 0),
5809
5806
  _e(g, p),
5810
5807
  ue(([C, y, T]) => {
5811
- const A = C.reduce((_, M, D) => Kt(_, M, Gr(M, y.offsetTree, T) || D), mr());
5808
+ const N = C.reduce((A, M, D) => Kt(A, M, Gr(M, y.offsetTree, T) || D), mr());
5812
5809
  return {
5813
5810
  ...y,
5814
5811
  groupIndices: C,
5815
- groupOffsetTree: A
5812
+ groupOffsetTree: N
5816
5813
  };
5817
5814
  })
5818
5815
  ),
@@ -5892,19 +5889,19 @@ const qx = {
5892
5889
  s,
5893
5890
  _e(g),
5894
5891
  ue(([C, y]) => {
5895
- const T = y.groupIndices.length > 0, A = [], _ = y.lastSize;
5892
+ const T = y.groupIndices.length > 0, N = [], A = y.lastSize;
5896
5893
  if (T) {
5897
5894
  const M = Kr(y.sizeTree, 0);
5898
5895
  let D = 0, U = 0;
5899
5896
  for (; D < C; ) {
5900
5897
  const L = y.groupIndices[U], J = y.groupIndices.length === U + 1 ? 1 / 0 : y.groupIndices[U + 1] - L - 1;
5901
- A.push({
5898
+ N.push({
5902
5899
  endIndex: L,
5903
5900
  size: M,
5904
5901
  startIndex: L
5905
- }), A.push({
5902
+ }), N.push({
5906
5903
  endIndex: L + 1 + J - 1,
5907
- size: _,
5904
+ size: A,
5908
5905
  startIndex: L + 1
5909
5906
  }), U++, D += J + 1;
5910
5907
  }
@@ -5928,7 +5925,7 @@ const qx = {
5928
5925
  {
5929
5926
  prevIndex: C,
5930
5927
  prevSize: 0,
5931
- ranges: A
5928
+ ranges: N
5932
5929
  }
5933
5930
  ).ranges;
5934
5931
  }
@@ -5940,7 +5937,7 @@ const qx = {
5940
5937
  }),
5941
5938
  {
5942
5939
  prevIndex: 0,
5943
- prevSize: _,
5940
+ prevSize: A,
5944
5941
  ranges: []
5945
5942
  }
5946
5943
  ).ranges;
@@ -5953,8 +5950,8 @@ const qx = {
5953
5950
  i,
5954
5951
  _e(g, p),
5955
5952
  ue(([C, { offsetTree: y }, T]) => {
5956
- const A = -C;
5957
- return Gr(A, y, T);
5953
+ const N = -C;
5954
+ return Gr(N, y, T);
5958
5955
  })
5959
5956
  )
5960
5957
  );
@@ -5966,31 +5963,31 @@ const qx = {
5966
5963
  if (y.groupIndices.length > 0) {
5967
5964
  if (qe(y.sizeTree))
5968
5965
  return y;
5969
- let A = mr();
5970
- const _ = ht(x);
5966
+ let N = mr();
5967
+ const A = ht(x);
5971
5968
  let M = 0, D = 0, U = 0;
5972
5969
  for (; M < -C; ) {
5973
- U = _[D];
5974
- const W = _[D + 1] - U - 1;
5970
+ U = A[D];
5971
+ const W = A[D + 1] - U - 1;
5975
5972
  D++, M += W + 1;
5976
5973
  }
5977
- if (A = Un(y.sizeTree).reduce((W, { k: L, v: J }) => Kt(W, Math.max(0, L + C), J), A), M !== -C) {
5974
+ if (N = Un(y.sizeTree).reduce((W, { k: L, v: J }) => Kt(W, Math.max(0, L + C), J), N), M !== -C) {
5978
5975
  const W = Kr(y.sizeTree, U);
5979
- A = Kt(A, 0, W);
5976
+ N = Kt(N, 0, W);
5980
5977
  const L = sn(y.sizeTree, -C + 1)[1];
5981
- A = Kt(A, 1, L);
5978
+ N = Kt(N, 1, L);
5982
5979
  }
5983
5980
  return {
5984
5981
  ...y,
5985
- sizeTree: A,
5986
- ...Ei(y.offsetTree, 0, A, T)
5982
+ sizeTree: N,
5983
+ ...Ei(y.offsetTree, 0, N, T)
5987
5984
  };
5988
5985
  } else {
5989
- const A = Un(y.sizeTree).reduce((_, { k: M, v: D }) => Kt(_, Math.max(0, M + C), D), mr());
5986
+ const N = Un(y.sizeTree).reduce((A, { k: M, v: D }) => Kt(A, Math.max(0, M + C), D), mr());
5990
5987
  return {
5991
5988
  ...y,
5992
- sizeTree: A,
5993
- ...Ei(y.offsetTree, 0, A, T)
5989
+ sizeTree: N,
5990
+ ...Ei(y.offsetTree, 0, N, T)
5994
5991
  };
5995
5992
  }
5996
5993
  })
@@ -6104,14 +6101,14 @@ const lo = $e(
6104
6101
  _e(e, s, o),
6105
6102
  ue(
6106
6103
  ([
6107
- [R, C, y, T, A, _, M, D],
6104
+ [R, C, y, T, N, A, M, D],
6108
6105
  U,
6109
6106
  W,
6110
6107
  L
6111
6108
  ]) => {
6112
6109
  const J = $u(R), { align: Y, behavior: ne, offset: H } = J, $ = T - 1, q = Du(J, C, $);
6113
- let z = Gr(q, C.offsetTree, U) + _;
6114
- Y === "end" ? (z += W + sn(C.sizeTree, q)[1] - y + L, q === $ && (z += M)) : Y === "center" ? z += (W + sn(C.sizeTree, q)[1] - y + L) / 2 : z -= A, H && (z += H);
6110
+ let z = Gr(q, C.offsetTree, U) + A;
6111
+ Y === "end" ? (z += W + sn(C.sizeTree, q)[1] - y + L, q === $ && (z += M)) : Y === "center" ? z += (W + sn(C.sizeTree, q)[1] - y + L) / 2 : z -= N, H && (z += H);
6115
6112
  const I = (E) => {
6116
6113
  k(), E ? (D("retrying to scroll to", { location: R }, Bt.DEBUG), Ae(p, R)) : (Ae(m, !0), D("list did not change, scroll successful", {}, Bt.DEBUG));
6117
6114
  };
@@ -6237,13 +6234,13 @@ const Yr = "up", Fr = "down", Jx = "none", Zx = {
6237
6234
  const m = qt(
6238
6235
  Q(
6239
6236
  gt(r, ve(s), ve(t), ve(e), ve(u)),
6240
- mn((v, [{ scrollHeight: k, scrollTop: R }, C, y, T, A]) => {
6241
- const _ = R + C - k > -A, M = {
6237
+ mn((v, [{ scrollHeight: k, scrollTop: R }, C, y, T, N]) => {
6238
+ const A = R + C - k > -N, M = {
6242
6239
  scrollHeight: k,
6243
6240
  scrollTop: R,
6244
6241
  viewportHeight: C
6245
6242
  };
6246
- if (_) {
6243
+ if (A) {
6247
6244
  let U, W;
6248
6245
  return R > v.state.scrollTop ? (U = "SCROLLED_DOWN", W = v.state.scrollTop - R) : (U = "SIZE_DECREASED", W = v.state.scrollTop - R || v.scrollTopDelta), {
6249
6246
  atBottom: !0,
@@ -6384,10 +6381,10 @@ const ea = $e(
6384
6381
  ]) => {
6385
6382
  const R = u - v, C = x + w, y = Math.max(h - R, 0);
6386
6383
  let T = kl;
6387
- const A = Rl(k, es), _ = Rl(k, ts);
6388
- return p -= v, p += h + w, m += h + w, m -= v, p > u + C - A && (T = Yr), m < u - y + f + _ && (T = Fr), T !== kl ? [
6389
- Math.max(R - h - Tl(g, es, T) - A, 0),
6390
- R - y - w + f + Tl(g, ts, T) + _
6384
+ const N = Rl(k, es), A = Rl(k, ts);
6385
+ return p -= v, p += h + w, m += h + w, m -= v, p > u + C - N && (T = Yr), m < u - y + f + A && (T = Fr), T !== kl ? [
6386
+ Math.max(R - h - Tl(g, es, T) - N, 0),
6387
+ R - y - w + f + Tl(g, ts, T) + A
6391
6388
  ] : null;
6392
6389
  }
6393
6390
  ),
@@ -6521,8 +6518,8 @@ const nr = $e(
6521
6518
  ve(n),
6522
6519
  e
6523
6520
  ),
6524
- ye(([y, T, , A, , , , , , , _]) => {
6525
- const M = _ && _.length !== A;
6521
+ ye(([y, T, , N, , , , , , , A]) => {
6522
+ const M = A && A.length !== N;
6526
6523
  return y && !T && !M;
6527
6524
  }),
6528
6525
  ue(
@@ -6530,8 +6527,8 @@ const nr = $e(
6530
6527
  ,
6531
6528
  ,
6532
6529
  [y, T],
6530
+ N,
6533
6531
  A,
6534
- _,
6535
6532
  M,
6536
6533
  D,
6537
6534
  U,
@@ -6539,16 +6536,16 @@ const nr = $e(
6539
6536
  L,
6540
6537
  J
6541
6538
  ]) => {
6542
- const Y = _, { offsetTree: ne, sizeTree: H } = Y, $ = ht(x);
6543
- if (A === 0)
6544
- return { ...Xs, totalCount: A };
6539
+ const Y = A, { offsetTree: ne, sizeTree: H } = Y, $ = ht(x);
6540
+ if (N === 0)
6541
+ return { ...Xs, totalCount: N };
6545
6542
  if (y === 0 && T === 0)
6546
- return $ === 0 ? { ...Xs, totalCount: A } : zu($, M, _, W, L, J || []);
6543
+ return $ === 0 ? { ...Xs, totalCount: N } : zu($, M, A, W, L, J || []);
6547
6544
  if (qe(H))
6548
6545
  return $ > 0 ? null : Fo(
6549
- eb(Qi(M, A), Y, J),
6546
+ eb(Qi(M, N), Y, J),
6550
6547
  [],
6551
- A,
6548
+ N,
6552
6549
  L,
6553
6550
  Y,
6554
6551
  W
@@ -6557,34 +6554,34 @@ const nr = $e(
6557
6554
  if (U.length > 0) {
6558
6555
  const O = U[0], K = U[U.length - 1];
6559
6556
  let X = 0;
6560
- for (const N of ks(H, O, K)) {
6561
- const V = N.value, te = Math.max(N.start, O), ae = Math.min(N.end, K);
6557
+ for (const _ of ks(H, O, K)) {
6558
+ const V = _.value, te = Math.max(_.start, O), ae = Math.min(_.end, K);
6562
6559
  for (let pe = te; pe <= ae; pe++)
6563
6560
  q.push({ data: J == null ? void 0 : J[pe], index: pe, offset: X, size: V }), X += V;
6564
6561
  }
6565
6562
  }
6566
6563
  if (!D)
6567
- return Fo([], q, A, L, Y, W);
6564
+ return Fo([], q, N, L, Y, W);
6568
6565
  const z = U.length > 0 ? U[U.length - 1] + 1 : 0, I = Hx(ne, y, T, z);
6569
6566
  if (I.length === 0)
6570
6567
  return null;
6571
- const E = A - 1, P = Cs([], (O) => {
6568
+ const E = N - 1, P = Cs([], (O) => {
6572
6569
  for (const K of I) {
6573
6570
  const X = K.value;
6574
- let N = X.offset, V = K.start;
6571
+ let _ = X.offset, V = K.start;
6575
6572
  const te = X.size;
6576
6573
  if (X.offset < y) {
6577
6574
  V += Math.floor((y - X.offset + L) / (te + L));
6578
6575
  const pe = V - K.start;
6579
- N += pe * te + pe * L;
6576
+ _ += pe * te + pe * L;
6580
6577
  }
6581
- V < z && (N += (z - V) * te, V = z);
6578
+ V < z && (_ += (z - V) * te, V = z);
6582
6579
  const ae = Math.min(K.end, E);
6583
- for (let pe = V; pe <= ae && !(N >= T); pe++)
6584
- O.push({ data: J == null ? void 0 : J[pe], index: pe, offset: N, size: te }), N += te + L;
6580
+ for (let pe = V; pe <= ae && !(_ >= T); pe++)
6581
+ O.push({ data: J == null ? void 0 : J[pe], index: pe, offset: _, size: te }), _ += te + L;
6585
6582
  }
6586
6583
  });
6587
- return Fo(P, q, A, L, Y, W);
6584
+ return Fo(P, q, N, L, Y, W);
6588
6585
  }
6589
6586
  ),
6590
6587
  //@ts-expect-error filter needs to be fixed
@@ -6642,13 +6639,13 @@ const nr = $e(
6642
6639
  v,
6643
6640
  ye(({ items: y }) => y.length > 0),
6644
6641
  ue(({ items: y }) => {
6645
- let T = 0, A = y.length - 1;
6646
- for (; y[T].type === "group" && T < A; )
6642
+ let T = 0, N = y.length - 1;
6643
+ for (; y[T].type === "group" && T < N; )
6647
6644
  T++;
6648
- for (; y[A].type === "group" && A > T; )
6649
- A--;
6645
+ for (; y[N].type === "group" && N > T; )
6646
+ N--;
6650
6647
  return {
6651
- endIndex: y[A].index,
6648
+ endIndex: y[N].index,
6652
6649
  startIndex: y[T].index
6653
6650
  };
6654
6651
  }),
@@ -6718,10 +6715,10 @@ const nr = $e(
6718
6715
  _e(t, c, n, s, o, r, a),
6719
6716
  _e(e),
6720
6717
  ue(([[f, h, p, m, g, x, w, v], k]) => {
6721
- const { align: R, behavior: C, calculateViewLocation: y = nb, done: T, ...A } = f, _ = Du(f, h, m - 1), M = Gr(_, h.offsetTree, k) + g + x, D = M + sn(h.sizeTree, _)[1], U = v + x, W = v + p - w, L = y({
6718
+ const { align: R, behavior: C, calculateViewLocation: y = nb, done: T, ...N } = f, A = Du(f, h, m - 1), M = Gr(A, h.offsetTree, k) + g + x, D = M + sn(h.sizeTree, A)[1], U = v + x, W = v + p - w, L = y({
6722
6719
  itemBottom: D,
6723
6720
  itemTop: M,
6724
- locationParams: { align: R, behavior: C, ...A },
6721
+ locationParams: { align: R, behavior: C, ...N },
6725
6722
  viewportBottom: W,
6726
6723
  viewportTop: U
6727
6724
  });
@@ -6774,9 +6771,9 @@ const rb = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), ob = $e(
6774
6771
  Q(
6775
6772
  gt(Q(ve(t), Jn(1)), c),
6776
6773
  _e(ve(m), s, a, f),
6777
- ue(([[C, y], T, A, _, M]) => {
6778
- let D = y && _, U = "auto";
6779
- return D && (U = rb(T, A || M), D = D && !!U), { followOutputBehavior: U, shouldFollow: D, totalCount: C };
6774
+ ue(([[C, y], T, N, A, M]) => {
6775
+ let D = y && A, U = "auto";
6776
+ return D && (U = rb(T, N || M), D = D && !!U), { followOutputBehavior: U, shouldFollow: D, totalCount: C };
6780
6777
  }),
6781
6778
  ye(({ shouldFollow: C }) => C)
6782
6779
  ),
@@ -6830,7 +6827,7 @@ const rb = (e, t) => typeof e == "function" ? El(e(t)) : t && El(e), ob = $e(
6830
6827
  Q(
6831
6828
  gt(Q(R, Jn(1)), c),
6832
6829
  _e(ve(k), a, f, h),
6833
- ue(([[C, y], T, A, _, M]) => y && A && (T == null ? void 0 : T({ context: M, totalCount: C, scrollingInProgress: _ }))),
6830
+ ue(([[C, y], T, N, A, M]) => y && N && (T == null ? void 0 : T({ context: M, totalCount: C, scrollingInProgress: A }))),
6834
6831
  ye((C) => !!C),
6835
6832
  Tn(0)
6836
6833
  ),
@@ -7024,10 +7021,10 @@ const ub = Vu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
7024
7021
  c,
7025
7022
  _e(i),
7026
7023
  mn(
7027
- ([, w, v, k], [{ bottom: R, items: C, offsetBottom: y, totalCount: T }, A]) => {
7028
- const _ = R + y;
7024
+ ([, w, v, k], [{ bottom: R, items: C, offsetBottom: y, totalCount: T }, N]) => {
7025
+ const A = R + y;
7029
7026
  let M = 0;
7030
- return v === T && w.length > 0 && C.length > 0 && (C[0].originalIndex === 0 && w[0].originalIndex === 0 || (M = _ - k, M !== 0 && (M += A))), [M, C, T, _];
7027
+ return v === T && w.length > 0 && C.length > 0 && (C[0].originalIndex === 0 && w[0].originalIndex === 0 || (M = A - k, M !== 0 && (M += N))), [M, C, T, A];
7031
7028
  },
7032
7029
  [0, [], 0, 0]
7033
7030
  ),
@@ -7068,12 +7065,12 @@ const ub = Vu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
7068
7065
  return y(w);
7069
7066
  {
7070
7067
  let T = 0;
7071
- const A = Kr(R, 0);
7072
- let _ = 0, M = 0;
7073
- for (; _ < w; ) {
7074
- _++, T += A;
7068
+ const N = Kr(R, 0);
7069
+ let A = 0, M = 0;
7070
+ for (; A < w; ) {
7071
+ A++, T += N;
7075
7072
  let D = v.length === M + 1 ? 1 / 0 : v[M + 1] - v[M] - 1;
7076
- _ + D > w && (T -= A, D = w - _ + 1), _ += D, T += y(D), M++;
7073
+ A + D > w && (T -= N, D = w - A + 1), A += D, T += y(D), M++;
7077
7074
  }
7078
7075
  return T;
7079
7076
  }
@@ -7152,11 +7149,11 @@ const ub = Vu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
7152
7149
  { scrollToIndex: C },
7153
7150
  y,
7154
7151
  { topItemCount: T },
7155
- { groupCounts: A },
7156
- _
7157
- ]) => (ge(R.rangeChanged, _.scrollSeekRangeChanged), ge(
7152
+ { groupCounts: N },
7153
+ A
7154
+ ]) => (ge(R.rangeChanged, A.scrollSeekRangeChanged), ge(
7158
7155
  Q(
7159
- _.windowViewportRect,
7156
+ A.windowViewportRect,
7160
7157
  ue((M) => M.visibleHeight)
7161
7158
  ),
7162
7159
  g.viewportHeight
@@ -7166,7 +7163,7 @@ const ub = Vu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
7166
7163
  firstItemIndex: n,
7167
7164
  fixedItemHeight: r,
7168
7165
  gap: o,
7169
- groupCounts: A,
7166
+ groupCounts: N,
7170
7167
  initialItemFinalLocationReached: h,
7171
7168
  initialTopMostItemIndex: p,
7172
7169
  scrolledToInitialItem: m,
@@ -7186,7 +7183,7 @@ const ub = Vu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
7186
7183
  // exported from stateFlagsSystem
7187
7184
  ...R,
7188
7185
  // the bag of IO from featureGroup1System
7189
- ..._,
7186
+ ...A,
7190
7187
  ...g,
7191
7188
  sizes: c,
7192
7189
  ...x
@@ -7403,7 +7400,7 @@ const mb = /* @__PURE__ */ $e(() => {
7403
7400
  oa("deviation", (L) => {
7404
7401
  w !== L && v(L);
7405
7402
  });
7406
- const k = Re("EmptyPlaceholder"), R = Re("ScrollSeekPlaceholder") || xb, C = Re("ListComponent"), y = Re("ItemComponent"), T = Re("GroupComponent"), A = Re("computeItemKey"), _ = Re("isSeeking"), M = Re("groupIndices").length > 0, D = Re("alignToBottom"), U = Re("initialItemFinalLocationReached"), W = e ? {} : {
7403
+ const k = Re("EmptyPlaceholder"), R = Re("ScrollSeekPlaceholder") || xb, C = Re("ListComponent"), y = Re("ItemComponent"), T = Re("GroupComponent"), N = Re("computeItemKey"), A = Re("isSeeking"), M = Re("groupIndices").length > 0, D = Re("alignToBottom"), U = Re("initialItemFinalLocationReached"), W = e ? {} : {
7407
7404
  boxSizing: "border-box",
7408
7405
  ...g ? {
7409
7406
  display: "inline-block",
@@ -7427,8 +7424,8 @@ const mb = /* @__PURE__ */ $e(() => {
7427
7424
  ref: x,
7428
7425
  style: W,
7429
7426
  children: (e ? t.topItems : t.items).map((L) => {
7430
- const J = L.originalIndex, Y = A(J + t.firstItemIndex, L.data, l);
7431
- return _ ? /* @__PURE__ */ No(
7427
+ const J = L.originalIndex, Y = N(J + t.firstItemIndex, L.data, l);
7428
+ return A ? /* @__PURE__ */ No(
7432
7429
  R,
7433
7430
  {
7434
7431
  ...It(R, l),
@@ -7746,24 +7743,24 @@ const $b = /* @__PURE__ */ $e(
7746
7743
  { customScrollParent: x, useWindowScroll: w, windowScrollContainerState: v, windowScrollTo: k, windowViewportRect: R },
7747
7744
  C
7748
7745
  ]) => {
7749
- const y = oe(0), T = oe(0), A = oe(_l), _ = oe({ height: 0, width: 0 }), M = oe({ height: 0, width: 0 }), D = Me(), U = Me(), W = oe(0), L = oe(null), J = oe({ column: 0, row: 0 }), Y = Me(), ne = Me(), H = oe(!1), $ = oe(0), q = oe(!0), z = oe(!1), I = oe(!1);
7746
+ const y = oe(0), T = oe(0), N = oe(_l), A = oe({ height: 0, width: 0 }), M = oe({ height: 0, width: 0 }), D = Me(), U = Me(), W = oe(0), L = oe(null), J = oe({ column: 0, row: 0 }), Y = Me(), ne = Me(), H = oe(!1), $ = oe(0), q = oe(!0), z = oe(!1), I = oe(!1);
7750
7747
  Be(
7751
7748
  Q(
7752
7749
  m,
7753
7750
  _e($),
7754
- ye(([N, V]) => !!V)
7751
+ ye(([_, V]) => !!V)
7755
7752
  ),
7756
7753
  () => {
7757
7754
  Ae(q, !1);
7758
7755
  }
7759
7756
  ), Be(
7760
7757
  Q(
7761
- gt(m, q, M, _, $, z),
7762
- ye(([N, V, te, ae, , pe]) => N && !V && te.height !== 0 && ae.height !== 0 && !pe)
7758
+ gt(m, q, M, A, $, z),
7759
+ ye(([_, V, te, ae, , pe]) => _ && !V && te.height !== 0 && ae.height !== 0 && !pe)
7763
7760
  ),
7764
- ([, , , , N]) => {
7761
+ ([, , , , _]) => {
7765
7762
  Ae(z, !0), Zi(1, () => {
7766
- Ae(D, N);
7763
+ Ae(D, _);
7767
7764
  }), on(Q(l), () => {
7768
7765
  Ae(t, [0, 0]), Ae(q, !0);
7769
7766
  });
@@ -7771,7 +7768,7 @@ const $b = /* @__PURE__ */ $e(
7771
7768
  ), ge(
7772
7769
  Q(
7773
7770
  ne,
7774
- ye((N) => N != null && N.scrollTop > 0),
7771
+ ye((_) => _ != null && _.scrollTop > 0),
7775
7772
  hn(0)
7776
7773
  ),
7777
7774
  T
@@ -7779,32 +7776,32 @@ const $b = /* @__PURE__ */ $e(
7779
7776
  Q(
7780
7777
  m,
7781
7778
  _e(ne),
7782
- ye(([, N]) => N != null)
7779
+ ye(([, _]) => _ != null)
7783
7780
  ),
7784
- ([, N]) => {
7785
- N && (Ae(_, N.viewport), Ae(M, N.item), Ae(J, N.gap), N.scrollTop > 0 && (Ae(H, !0), on(Q(l, Jn(1)), (V) => {
7781
+ ([, _]) => {
7782
+ _ && (Ae(A, _.viewport), Ae(M, _.item), Ae(J, _.gap), _.scrollTop > 0 && (Ae(H, !0), on(Q(l, Jn(1)), (V) => {
7786
7783
  Ae(H, !1);
7787
- }), Ae(c, { top: N.scrollTop })));
7784
+ }), Ae(c, { top: _.scrollTop })));
7788
7785
  }
7789
7786
  ), ge(
7790
7787
  Q(
7791
- _,
7792
- ue(({ height: N }) => N)
7788
+ A,
7789
+ ue(({ height: _ }) => _)
7793
7790
  ),
7794
7791
  f
7795
7792
  ), ge(
7796
7793
  Q(
7797
7794
  gt(
7798
- ve(_, wo),
7795
+ ve(A, wo),
7799
7796
  ve(M, wo),
7800
- ve(J, (N, V) => N && N.column === V.column && N.row === V.row),
7797
+ ve(J, (_, V) => _ && _.column === V.column && _.row === V.row),
7801
7798
  ve(l)
7802
7799
  ),
7803
- ue(([N, V, te, ae]) => ({
7800
+ ue(([_, V, te, ae]) => ({
7804
7801
  gap: te,
7805
7802
  item: V,
7806
7803
  scrollTop: ae,
7807
- viewport: N
7804
+ viewport: _
7808
7805
  }))
7809
7806
  ),
7810
7807
  Y
@@ -7815,17 +7812,17 @@ const $b = /* @__PURE__ */ $e(
7815
7812
  r,
7816
7813
  ve(J, Lb),
7817
7814
  ve(M, wo),
7818
- ve(_, wo),
7815
+ ve(A, wo),
7819
7816
  ve(L),
7820
7817
  ve(T),
7821
7818
  ve(H),
7822
7819
  ve(q),
7823
7820
  ve($)
7824
7821
  ),
7825
- ye(([, , , , , , , N]) => !N),
7822
+ ye(([, , , , , , , _]) => !_),
7826
7823
  ue(
7827
7824
  ([
7828
- N,
7825
+ _,
7829
7826
  [V, te],
7830
7827
  ae,
7831
7828
  pe,
@@ -7837,34 +7834,34 @@ const $b = /* @__PURE__ */ $e(
7837
7834
  Fe
7838
7835
  ]) => {
7839
7836
  const { column: je, row: He } = ae, { height: nt, width: xt } = pe, { width: at } = ce;
7840
- if (be === 0 && (N === 0 || at === 0))
7837
+ if (be === 0 && (_ === 0 || at === 0))
7841
7838
  return _l;
7842
7839
  if (xt === 0) {
7843
- const lt = Qi(Fe, N), nn = lt + Math.max(be - 1, 0);
7840
+ const lt = Qi(Fe, _), nn = lt + Math.max(be - 1, 0);
7844
7841
  return Db(Ol(lt, nn, me));
7845
7842
  }
7846
7843
  const Ue = td(at, xt, je);
7847
7844
  let Le, Qe;
7848
- We ? V === 0 && te === 0 && be > 0 ? (Le = 0, Qe = be - 1) : (Le = Ue * ns((V + He) / (nt + He)), Qe = Ue * jl((te + He) / (nt + He)) - 1, Qe = Qs(N - 1, zr(Qe, Ue - 1)), Le = Qs(Qe, zr(0, Le))) : (Le = 0, Qe = -1);
7849
- const it = Ol(Le, Qe, me), { bottom: Ye, top: mt } = Ml(ce, ae, pe, it), vt = jl(N / Ue), Ve = vt * nt + (vt - 1) * He - Ye;
7845
+ We ? V === 0 && te === 0 && be > 0 ? (Le = 0, Qe = be - 1) : (Le = Ue * ns((V + He) / (nt + He)), Qe = Ue * jl((te + He) / (nt + He)) - 1, Qe = Qs(_ - 1, zr(Qe, Ue - 1)), Le = Qs(Qe, zr(0, Le))) : (Le = 0, Qe = -1);
7846
+ const it = Ol(Le, Qe, me), { bottom: Ye, top: mt } = Ml(ce, ae, pe, it), vt = jl(_ / Ue), Ve = vt * nt + (vt - 1) * He - Ye;
7850
7847
  return { bottom: Ye, itemHeight: nt, items: it, itemWidth: xt, offsetBottom: Ve, offsetTop: mt, top: mt };
7851
7848
  }
7852
7849
  )
7853
7850
  ),
7854
- A
7851
+ N
7855
7852
  ), ge(
7856
7853
  Q(
7857
7854
  L,
7858
- ye((N) => N !== null),
7859
- ue((N) => N.length)
7855
+ ye((_) => _ !== null),
7856
+ ue((_) => _.length)
7860
7857
  ),
7861
7858
  y
7862
7859
  ), ge(
7863
7860
  Q(
7864
- gt(_, M, A, J),
7865
- ye(([N, V, { items: te }]) => te.length > 0 && V.height !== 0 && N.height !== 0),
7866
- ue(([N, V, { items: te }, ae]) => {
7867
- const { bottom: pe, top: ce } = Ml(N, ae, V, te);
7861
+ gt(A, M, N, J),
7862
+ ye(([_, V, { items: te }]) => te.length > 0 && V.height !== 0 && _.height !== 0),
7863
+ ue(([_, V, { items: te }, ae]) => {
7864
+ const { bottom: pe, top: ce } = Ml(_, ae, V, te);
7868
7865
  return [ce, pe];
7869
7866
  }),
7870
7867
  et(qr)
@@ -7876,37 +7873,37 @@ const $b = /* @__PURE__ */ $e(
7876
7873
  Q(
7877
7874
  l,
7878
7875
  _e(E),
7879
- ue(([N, V]) => V || N !== 0)
7876
+ ue(([_, V]) => V || _ !== 0)
7880
7877
  ),
7881
7878
  E
7882
7879
  );
7883
7880
  const P = qt(
7884
7881
  Q(
7885
- gt(A, y),
7886
- ye(([{ items: N }]) => N.length > 0),
7882
+ gt(N, y),
7883
+ ye(([{ items: _ }]) => _.length > 0),
7887
7884
  _e(E),
7888
- ye(([[N, V], te]) => {
7889
- const ae = N.items[N.items.length - 1].index === V - 1;
7890
- return (te || N.bottom > 0 && N.itemHeight > 0 && N.offsetBottom === 0 && N.items.length === V) && ae;
7885
+ ye(([[_, V], te]) => {
7886
+ const ae = _.items[_.items.length - 1].index === V - 1;
7887
+ return (te || _.bottom > 0 && _.itemHeight > 0 && _.offsetBottom === 0 && _.items.length === V) && ae;
7891
7888
  }),
7892
- ue(([[, N]]) => N - 1),
7889
+ ue(([[, _]]) => _ - 1),
7893
7890
  et()
7894
7891
  )
7895
7892
  ), O = qt(
7896
7893
  Q(
7897
- ve(A),
7898
- ye(({ items: N }) => N.length > 0 && N[0].index === 0),
7894
+ ve(N),
7895
+ ye(({ items: _ }) => _.length > 0 && _[0].index === 0),
7899
7896
  hn(0),
7900
7897
  et()
7901
7898
  )
7902
7899
  ), K = qt(
7903
7900
  Q(
7904
- ve(A),
7901
+ ve(N),
7905
7902
  _e(H),
7906
- ye(([{ items: N }, V]) => N.length > 0 && !V),
7907
- ue(([{ items: N }]) => ({
7908
- endIndex: N[N.length - 1].index,
7909
- startIndex: N[0].index
7903
+ ye(([{ items: _ }, V]) => _.length > 0 && !V),
7904
+ ue(([{ items: _ }]) => ({
7905
+ endIndex: _[_.length - 1].index,
7906
+ startIndex: _[0].index
7910
7907
  })),
7911
7908
  et(Pu),
7912
7909
  Tn(0)
@@ -7915,9 +7912,9 @@ const $b = /* @__PURE__ */ $e(
7915
7912
  ge(K, p.scrollSeekRangeChanged), ge(
7916
7913
  Q(
7917
7914
  D,
7918
- _e(_, M, y, J),
7919
- ue(([N, V, te, ae, pe]) => {
7920
- const ce = $u(N), { align: me, behavior: be, offset: We } = ce;
7915
+ _e(A, M, y, J),
7916
+ ue(([_, V, te, ae, pe]) => {
7917
+ const ce = $u(_), { align: me, behavior: be, offset: We } = ce;
7921
7918
  let Fe = ce.index;
7922
7919
  Fe === "LAST" && (Fe = ae - 1), Fe = zr(0, Fe, Qs(ae - 1, Fe));
7923
7920
  let je = Ai(V, pe, te, Fe);
@@ -7928,17 +7925,17 @@ const $b = /* @__PURE__ */ $e(
7928
7925
  );
7929
7926
  const X = At(
7930
7927
  Q(
7931
- A,
7932
- ue((N) => N.offsetBottom + N.bottom)
7928
+ N,
7929
+ ue((_) => _.offsetBottom + _.bottom)
7933
7930
  ),
7934
7931
  0
7935
7932
  );
7936
7933
  return ge(
7937
7934
  Q(
7938
7935
  R,
7939
- ue((N) => ({ height: N.visibleHeight, width: N.visibleWidth }))
7936
+ ue((_) => ({ height: _.visibleHeight, width: _.visibleWidth }))
7940
7937
  ),
7941
- _
7938
+ A
7942
7939
  ), {
7943
7940
  customScrollParent: x,
7944
7941
  // input
@@ -7961,13 +7958,13 @@ const $b = /* @__PURE__ */ $e(
7961
7958
  smoothScrollTargetReached: u,
7962
7959
  totalCount: y,
7963
7960
  useWindowScroll: w,
7964
- viewportDimensions: _,
7961
+ viewportDimensions: A,
7965
7962
  windowScrollContainerState: v,
7966
7963
  windowScrollTo: k,
7967
7964
  windowViewportRect: R,
7968
7965
  ...p,
7969
7966
  // output
7970
- gridState: A,
7967
+ gridState: N,
7971
7968
  horizontalDirection: I,
7972
7969
  initialTopMostItemIndex: $,
7973
7970
  totalListHeight: X,
@@ -8394,11 +8391,11 @@ var ow = "DismissableLayer", Ni = "dismissableLayer.update", sw = "dismissableLa
8394
8391
  onDismiss: a,
8395
8392
  ...c
8396
8393
  } = e, l = b.useContext(od), [u, f] = b.useState(null), h = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, p] = b.useState({}), m = st(t, (T) => f(T)), g = Array.from(l.layers), [x] = [...l.layersWithOutsidePointerEventsDisabled].slice(-1), w = g.indexOf(x), v = u ? g.indexOf(u) : -1, k = l.layersWithOutsidePointerEventsDisabled.size > 0, R = v >= w, C = cw((T) => {
8397
- const A = T.target, _ = [...l.branches].some((M) => M.contains(A));
8398
- !R || _ || (o == null || o(T), i == null || i(T), T.defaultPrevented || a == null || a());
8394
+ const N = T.target, A = [...l.branches].some((M) => M.contains(N));
8395
+ !R || A || (o == null || o(T), i == null || i(T), T.defaultPrevented || a == null || a());
8399
8396
  }, h), y = uw((T) => {
8400
- const A = T.target;
8401
- [...l.branches].some((M) => M.contains(A)) || (s == null || s(T), i == null || i(T), T.defaultPrevented || a == null || a());
8397
+ const N = T.target;
8398
+ [...l.branches].some((M) => M.contains(N)) || (s == null || s(T), i == null || i(T), T.defaultPrevented || a == null || a());
8402
8399
  }, h);
8403
8400
  return rw((T) => {
8404
8401
  v === l.layers.size - 1 && (r == null || r(T), !T.defaultPrevented && a && (T.preventDefault(), a()));
@@ -9113,15 +9110,15 @@ function tv(e) {
9113
9110
  var w = So(g), v = n.current, k = "deltaX" in g ? g.deltaX : v[0] - w[0], R = "deltaY" in g ? g.deltaY : v[1] - w[1], C, y = g.target, T = Math.abs(k) > Math.abs(R) ? "h" : "v";
9114
9111
  if ("touches" in g && T === "h" && y.type === "range")
9115
9112
  return !1;
9116
- var A = ql(T, y);
9117
- if (!A)
9113
+ var N = ql(T, y);
9114
+ if (!N)
9118
9115
  return !0;
9119
- if (A ? C = T : (C = T === "v" ? "h" : "v", A = ql(T, y)), !A)
9116
+ if (N ? C = T : (C = T === "v" ? "h" : "v", N = ql(T, y)), !N)
9120
9117
  return !1;
9121
9118
  if (!r.current && "changedTouches" in g && (k || R) && (r.current = C), !C)
9122
9119
  return !0;
9123
- var _ = r.current || C;
9124
- return Jw(_, x, g, _ === "h" ? k : R);
9120
+ var A = r.current || C;
9121
+ return Jw(A, x, g, A === "h" ? k : R);
9125
9122
  }, []), c = b.useCallback(function(g) {
9126
9123
  var x = g;
9127
9124
  if (!(!lr.length || lr[lr.length - 1] !== s)) {
@@ -11107,12 +11104,12 @@ class Pn {
11107
11104
  continue;
11108
11105
  }
11109
11106
  default: {
11110
- const A = 'Token with "' + p.type + '" type was not found.';
11107
+ const N = 'Token with "' + p.type + '" type was not found.';
11111
11108
  if (this.options.silent) {
11112
- console.error(A);
11109
+ console.error(N);
11113
11110
  return;
11114
11111
  } else
11115
- throw new Error(A);
11112
+ throw new Error(N);
11116
11113
  }
11117
11114
  }
11118
11115
  }
@@ -11550,8 +11547,8 @@ function qv({
11550
11547
  isCompactLayout: C,
11551
11548
  iconForeground: y,
11552
11549
  toolConfig: T,
11553
- handleInterruptApprove: A,
11554
- handleInterruptReject: _,
11550
+ handleInterruptApprove: N,
11551
+ handleInterruptReject: A,
11555
11552
  handleInterruptAlternative: M,
11556
11553
  disableInterruptActions: D,
11557
11554
  renderArtifactsInline: U = !0
@@ -11564,45 +11561,45 @@ function qv({
11564
11561
  (h ?? !0) && u,
11565
11562
  f ?? 0
11566
11563
  ), Y = De(
11567
- () => J.filter((N) => N.type === "text"),
11564
+ () => J.filter((_) => _.type === "text"),
11568
11565
  [J]
11569
11566
  ), ne = De(
11570
- () => Y.map((N) => N.text ?? "").join(""),
11567
+ () => Y.map((_) => _.text ?? "").join(""),
11571
11568
  [Y]
11572
11569
  ), { artifacts: H } = Fd(e, t), $ = De(() => {
11573
11570
  if (!p)
11574
11571
  return null;
11575
- const N = Yv(ne);
11572
+ const _ = Yv(ne);
11576
11573
  return {
11577
- stablePart: ne.slice(0, N),
11578
- tailPart: ne.slice(N)
11574
+ stablePart: ne.slice(0, _),
11575
+ tailPart: ne.slice(_)
11579
11576
  };
11580
11577
  }, [ne, p]), q = De(() => {
11581
11578
  if (!$) return null;
11582
- const { stablePart: N, tailPart: V } = $;
11583
- return !N && !V ? null : /* @__PURE__ */ d.jsxs("div", { className: "space-y-2", children: [
11584
- N ? /* @__PURE__ */ d.jsx(Uo, { content: N, allowHtml: !1 }) : null,
11579
+ const { stablePart: _, tailPart: V } = $;
11580
+ return !_ && !V ? null : /* @__PURE__ */ d.jsxs("div", { className: "space-y-2", children: [
11581
+ _ ? /* @__PURE__ */ d.jsx(Uo, { content: _, allowHtml: !1 }) : null,
11585
11582
  V ? /* @__PURE__ */ d.jsx(Uo, { content: V, allowHtml: !1 }) : null
11586
11583
  ] });
11587
11584
  }, [$]), z = De(() => {
11588
11585
  if (!p)
11589
11586
  return J;
11590
- const N = [];
11587
+ const _ = [];
11591
11588
  let V = !1;
11592
11589
  for (const te of J) {
11593
11590
  if (te.type === "text") {
11594
- V || (N.push({
11591
+ V || (_.push({
11595
11592
  type: "text",
11596
11593
  text: "",
11597
11594
  __streamingMarkdownAggregate: !0
11598
11595
  }), V = !0);
11599
11596
  continue;
11600
11597
  }
11601
- N.push(te);
11598
+ _.push(te);
11602
11599
  }
11603
- return N;
11604
- }, [J, p]), E = (p ? z : J).filter((N) => N.type !== "interrupt" && N.type !== "image_url"), P = () => !a || a.length === 0 ? null : /* @__PURE__ */ d.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: a.map((N, V) => {
11605
- const te = N;
11600
+ return _;
11601
+ }, [J, p]), E = (p ? z : J).filter((_) => _.type !== "interrupt" && _.type !== "image_url"), P = () => !a || a.length === 0 ? null : /* @__PURE__ */ d.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: a.map((_, V) => {
11602
+ const te = _;
11606
11603
  return /* @__PURE__ */ d.jsx("div", { className: "relative group", children: /* @__PURE__ */ d.jsx(
11607
11604
  "img",
11608
11605
  {
@@ -11613,11 +11610,11 @@ function qv({
11613
11610
  className: "h-20 w-20 object-cover rounded-md border border-border/50 cursor-pointer hover:opacity-90 transition-opacity"
11614
11611
  }
11615
11612
  ) }, V);
11616
- }) }), O = re(({ part: N, i: V }) => {
11617
- if (N.type === "text") {
11613
+ }) }), O = re(({ part: _, i: V }) => {
11614
+ if (_.type === "text") {
11618
11615
  if (p)
11619
11616
  return null;
11620
- const te = N.text ?? "", ae = te.trim(), pe = io(ae);
11617
+ const te = _.text ?? "", ae = te.trim(), pe = io(ae);
11621
11618
  return pe && x !== "tool" ? /* @__PURE__ */ d.jsx(kv, { data: pe }, V) : x === "user" && w && ae.length > v ? /* @__PURE__ */ d.jsx(
11622
11619
  Vv,
11623
11620
  {
@@ -11630,10 +11627,10 @@ function qv({
11630
11627
  V
11631
11628
  ) : /* @__PURE__ */ d.jsx(Uo, { content: te, allowHtml: !1 }, V);
11632
11629
  }
11633
- if (N.type === "image_url")
11630
+ if (_.type === "image_url")
11634
11631
  return null;
11635
- if (N.type === "file") {
11636
- const te = N, ae = te.name || "file";
11632
+ if (_.type === "file") {
11633
+ const te = _, ae = te.name || "file";
11637
11634
  return /* @__PURE__ */ d.jsxs(
11638
11635
  "a",
11639
11636
  {
@@ -11669,14 +11666,14 @@ function qv({
11669
11666
  if (!n && !K && !u)
11670
11667
  return null;
11671
11668
  if (l) {
11672
- const N = l.value, V = !D, te = A ?? (() => {
11673
- }), ae = _ ?? (() => {
11669
+ const _ = l.value, V = !D, te = N ?? (() => {
11670
+ }), ae = A ?? (() => {
11674
11671
  });
11675
11672
  return /* @__PURE__ */ d.jsx(
11676
11673
  Vd,
11677
11674
  {
11678
11675
  interruptPart: l,
11679
- payload: N,
11676
+ payload: _,
11680
11677
  onApprove: te,
11681
11678
  onReject: ae,
11682
11679
  onSelectAlternative: M,
@@ -11695,7 +11692,7 @@ function qv({
11695
11692
  toolConfig: T
11696
11693
  }
11697
11694
  ),
11698
- E.map((N, V) => p && Xv(N) ? q ? /* @__PURE__ */ d.jsx("div", { className: "space-y-2", children: q }, `streaming-md-${V}`) : null : /* @__PURE__ */ d.jsx(O, { part: N, i: V }, V)),
11695
+ E.map((_, V) => p && Xv(_) ? q ? /* @__PURE__ */ d.jsx("div", { className: "space-y-2", children: q }, `streaming-md-${V}`) : null : /* @__PURE__ */ d.jsx(O, { part: _, i: V }, V)),
11699
11696
  P(),
11700
11697
  U && (H.length > 0 || !!e.artifact) && /* @__PURE__ */ d.jsxs("div", { className: "mt-4 pt-4 border-t border-border/40 space-y-4", children: [
11701
11698
  !!e.artifact && /* @__PURE__ */ d.jsx(
@@ -11706,10 +11703,10 @@ function qv({
11706
11703
  toolConfig: T
11707
11704
  }
11708
11705
  ),
11709
- H.map((N, V) => /* @__PURE__ */ d.jsx(
11706
+ H.map((_, V) => /* @__PURE__ */ d.jsx(
11710
11707
  Sc,
11711
11708
  {
11712
- message: { ...e, artifact: N },
11709
+ message: { ...e, artifact: _ },
11713
11710
  viewMode: "expanded",
11714
11711
  toolConfig: T
11715
11712
  },
@@ -11718,10 +11715,10 @@ function qv({
11718
11715
  ] })
11719
11716
  ] });
11720
11717
  if (u) {
11721
- const N = i.trim().length > 0 || a.length > 0;
11718
+ const _ = i.trim().length > 0 || a.length > 0;
11722
11719
  return /* @__PURE__ */ d.jsxs("div", { "aria-busy": "true", role: "status", children: [
11723
11720
  X,
11724
- N ? /* @__PURE__ */ d.jsx(
11721
+ _ ? /* @__PURE__ */ d.jsx(
11725
11722
  "span",
11726
11723
  {
11727
11724
  className: "inline-block w-2 h-4 ml-0.5 bg-current opacity-70 animate-pulse align-middle",
@@ -12044,7 +12041,7 @@ function iy(e) {
12044
12041
  const y = await r.listFiles(n ?? void 0);
12045
12042
  if (!y || !Array.isArray(y))
12046
12043
  throw new Error("Invalid file list response");
12047
- const T = y.find((A) => !A || typeof A != "object" || !((A.filename ?? "") === (g.name ?? "")) ? !1 : typeof g.size == "number" && typeof A.size == "number" ? A.size === g.size : !0);
12044
+ const T = y.find((N) => !N || typeof N != "object" || !((N.filename ?? "") === (g.name ?? "")) ? !1 : typeof g.size == "number" && typeof N.size == "number" ? N.size === g.size : !0);
12048
12045
  if (!(T != null && T.id))
12049
12046
  throw new Error(`File "${g.name}" is not yet available on the server`);
12050
12047
  if (!T.id || !T.filename)
@@ -12184,13 +12181,13 @@ const Qd = fp(function({
12184
12181
  getInterruptOptions: C,
12185
12182
  attemptCount: y = 1,
12186
12183
  attemptIndex: T = 0,
12187
- onSelectCheckpoint: A,
12188
- attemptMetas: _ = [],
12184
+ onSelectCheckpoint: N,
12185
+ attemptMetas: A = [],
12189
12186
  renderArtifactsInline: M = !0
12190
12187
  }) {
12191
12188
  const [D, U] = de(!1), [W, L] = de(!1), { currentThreadId: J } = so(), { respondToInterrupt: Y } = ys(), [ne, H] = de(!1), $ = l === "phone" || l === "half-screen", q = t.role, z = q === "interrupt", I = q === "tool" || z, { toolRenderers: E, toolArtifactRenderers: P, getToolExpandable: O } = p ?? {}, K = !(o && q !== "user"), {
12192
12189
  uploadingFiles: X,
12193
- handleFileClick: N,
12190
+ handleFileClick: _,
12194
12191
  fileViewerOpen: V,
12195
12192
  currentFileInfo: te,
12196
12193
  closeFileViewer: ae
@@ -12366,7 +12363,7 @@ const Qd = fp(function({
12366
12363
  enableStreamingMarkdownBuffer: xt,
12367
12364
  renderStreamingMarkdown: x,
12368
12365
  streamingDebounceMs: g,
12369
- handleFileClick: N,
12366
+ handleFileClick: _,
12370
12367
  uploadingFiles: X,
12371
12368
  messageRole: q,
12372
12369
  truncateUserMessages: u,
@@ -12382,11 +12379,11 @@ const Qd = fp(function({
12382
12379
  disableInterruptActions: ne,
12383
12380
  renderArtifactsInline: M
12384
12381
  }
12385
- ), St = De(() => zg(t), [t]), Ct = Ve(), yt = q === "user" && (y ?? 1) > 1 && typeof A == "function", Xe = (_ == null ? void 0 : _.length) ?? 0, bt = Xe > 0 && T < Xe - 1 ? _[T + 1] : void 0, dt = Xe > 0 && T > 0 ? _[T - 1] : void 0, Pt = re(() => {
12386
- !bt || !A || A(bt.id, void 0, !!bt.isLatestAttempt);
12387
- }, [bt, A]), ze = re(() => {
12388
- !dt || !A || A(dt.id, void 0, !!dt.isLatestAttempt);
12389
- }, [dt, A]);
12382
+ ), St = De(() => zg(t), [t]), Ct = Ve(), yt = q === "user" && (y ?? 1) > 1 && typeof N == "function", Xe = (A == null ? void 0 : A.length) ?? 0, bt = Xe > 0 && T < Xe - 1 ? A[T + 1] : void 0, dt = Xe > 0 && T > 0 ? A[T - 1] : void 0, Pt = re(() => {
12383
+ !bt || !N || N(bt.id, void 0, !!bt.isLatestAttempt);
12384
+ }, [bt, N]), ze = re(() => {
12385
+ !dt || !N || N(dt.id, void 0, !!dt.isLatestAttempt);
12386
+ }, [dt, N]);
12390
12387
  return I && !h ? null : /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
12391
12388
  /* @__PURE__ */ d.jsx("div", { className: le(lt(), m.container), children: /* @__PURE__ */ d.jsxs("div", { className: le(nn(), m.content), children: [
12392
12389
  /* @__PURE__ */ d.jsx(
@@ -12522,9 +12519,9 @@ const dy = {
12522
12519
  toolConfig: w,
12523
12520
  renderArtifactsInline: v = !0
12524
12521
  }) {
12525
- const k = ef(t, n), y = !!t.__syntheticStreaming || o === t.id && t.role === "assistant", T = p ?? dy, A = t.checkpointId ?? null, { attemptCount: _, attemptIndex: M, attempts: D } = De(
12526
- () => ax(t.id, A, T),
12527
- [t.id, A, T]
12522
+ const k = ef(t, n), y = !!t.__syntheticStreaming || o === t.id && t.role === "assistant", T = p ?? dy, N = t.checkpointId ?? null, { attemptCount: A, attemptIndex: M, attempts: D } = De(
12523
+ () => ax(t.id, N, T),
12524
+ [t.id, N, T]
12528
12525
  ), U = g == null ? void 0 : g(t);
12529
12526
  return /* @__PURE__ */ d.jsx(
12530
12527
  "div",
@@ -12554,7 +12551,7 @@ const dy = {
12554
12551
  onCancelEdit: f,
12555
12552
  getInterruptOptions: x,
12556
12553
  showToolMessages: h,
12557
- attemptCount: _,
12554
+ attemptCount: A,
12558
12555
  attemptIndex: M,
12559
12556
  attemptMetas: D,
12560
12557
  onSelectCheckpoint: m,
@@ -12592,8 +12589,8 @@ const fy = Object.freeze({}), nf = ee.forwardRef(({
12592
12589
  activeCheckpointId: C,
12593
12590
  onSelectCheckpoint: y,
12594
12591
  showThinkingIndicator: T = !0,
12595
- getMessageCustomStyles: A,
12596
- getInterruptOptions: _,
12592
+ getMessageCustomStyles: N,
12593
+ getInterruptOptions: A,
12597
12594
  pendingInterrupt: M,
12598
12595
  renderArtifactsInline: D = !0
12599
12596
  }, U) => {
@@ -12658,7 +12655,7 @@ const fy = Object.freeze({}), nf = ee.forwardRef(({
12658
12655
  }
12659
12656
  }
12660
12657
  };
12661
- }, [a]), X = De(() => !m || g ? !1 : "auto", [m, g]), N = E.length === 0 && p, V = ["flex h-full flex-col md:flex-row", f].filter(Boolean).join(" "), te = () => N ? /* @__PURE__ */ d.jsx("div", { className: "h-full w-full", children: p }) : /* @__PURE__ */ d.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: "No messages yet. Start a conversation!" }), ae = E.length, pe = ae > 0;
12658
+ }, [a]), X = De(() => !m || g ? !1 : "auto", [m, g]), _ = E.length === 0 && p, V = ["flex h-full flex-col md:flex-row", f].filter(Boolean).join(" "), te = () => _ ? /* @__PURE__ */ d.jsx("div", { className: "h-full w-full", children: p }) : /* @__PURE__ */ d.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: "No messages yet. Start a conversation!" }), ae = E.length, pe = ae > 0;
12662
12659
  return Pe(() => {
12663
12660
  var ce, me;
12664
12661
  if (ae === 0) {
@@ -12734,8 +12731,8 @@ const fy = Object.freeze({}), nf = ee.forwardRef(({
12734
12731
  checkpointIndex: R,
12735
12732
  activeCheckpointId: C,
12736
12733
  onSelectCheckpoint: y,
12737
- getMessageCustomStyles: A,
12738
- getInterruptOptions: _,
12734
+ getMessageCustomStyles: N,
12735
+ getInterruptOptions: A,
12739
12736
  renderArtifactsInline: D
12740
12737
  }
12741
12738
  )
@@ -13072,7 +13069,7 @@ const Ry = (e) => ({
13072
13069
  }, p = va(o), m = wa(p), g = await i.getDimensions(l), x = p === "y", w = x ? "top" : "left", v = x ? "bottom" : "right", k = x ? "clientHeight" : "clientWidth", R = s.reference[m] + s.reference[p] - h[p] - s.floating[m], C = h[p] - s.reference[p], y = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l));
13073
13070
  let T = y ? y[k] : 0;
13074
13071
  (!T || !await (i.isElement == null ? void 0 : i.isElement(y))) && (T = a.floating[k] || s.floating[m]);
13075
- const A = R / 2 - C / 2, _ = T / 2 - g[m] / 2 - 1, M = On(f[w], _), D = On(f[v], _), U = M, W = T - g[m] - D, L = T / 2 - g[m] / 2 + A, J = Pi(U, L, W), Y = !c.arrow && Er(o) != null && L !== J && s.reference[m] / 2 - (L < U ? M : D) - g[m] / 2 < 0, ne = Y ? L < U ? L - U : L - W : 0;
13072
+ const N = R / 2 - C / 2, A = T / 2 - g[m] / 2 - 1, M = On(f[w], A), D = On(f[v], A), U = M, W = T - g[m] - D, L = T / 2 - g[m] / 2 + N, J = Pi(U, L, W), Y = !c.arrow && Er(o) != null && L !== J && s.reference[m] / 2 - (L < U ? M : D) - g[m] / 2 < 0, ne = Y ? L < U ? L - U : L - W : 0;
13076
13073
  return {
13077
13074
  [p]: h[p] + ne,
13078
13075
  data: {
@@ -13111,16 +13108,16 @@ const Ry = (e) => ({
13111
13108
  return {};
13112
13109
  const w = In(o), v = gn(a), k = In(a) === a, R = await (c.isRTL == null ? void 0 : c.isRTL(l.floating)), C = h || (k || !g ? [as(a)] : wy(a)), y = m !== "none";
13113
13110
  !h && y && C.push(...Cy(a, g, m, R));
13114
- const T = [a, ...C], A = await Xr(t, x), _ = [];
13111
+ const T = [a, ...C], N = await Xr(t, x), A = [];
13115
13112
  let M = ((r = s.flip) == null ? void 0 : r.overflows) || [];
13116
- if (u && _.push(A[w]), f) {
13113
+ if (u && A.push(N[w]), f) {
13117
13114
  const L = by(o, i, R);
13118
- _.push(A[L[0]], A[L[1]]);
13115
+ A.push(N[L[0]], N[L[1]]);
13119
13116
  }
13120
13117
  if (M = [...M, {
13121
13118
  placement: o,
13122
- overflows: _
13123
- }], !_.every((L) => L <= 0)) {
13119
+ overflows: A
13120
+ }], !A.every((L) => L <= 0)) {
13124
13121
  var D, U;
13125
13122
  const L = (((D = s.flip) == null ? void 0 : D.index) || 0) + 1, J = T[L];
13126
13123
  if (J && (!(f === "alignment" ? v !== gn(J) : !1) || // We leave the current main axis only if every placement on that axis
@@ -13389,18 +13386,18 @@ const Ny = function(e) {
13389
13386
  let x, w;
13390
13387
  f === "top" || f === "bottom" ? (x = f, w = h === (await (i.isRTL == null ? void 0 : i.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (w = f, x = h === "end" ? "top" : "bottom");
13391
13388
  const v = g - u.top - u.bottom, k = m - u.left - u.right, R = On(g - u[x], v), C = On(m - u[w], k), y = !t.middlewareData.shift;
13392
- let T = R, A = C;
13393
- if ((n = t.middlewareData.shift) != null && n.enabled.x && (A = k), (r = t.middlewareData.shift) != null && r.enabled.y && (T = v), y && !h) {
13389
+ let T = R, N = C;
13390
+ if ((n = t.middlewareData.shift) != null && n.enabled.x && (N = k), (r = t.middlewareData.shift) != null && r.enabled.y && (T = v), y && !h) {
13394
13391
  const M = Vt(u.left, 0), D = Vt(u.right, 0), U = Vt(u.top, 0), W = Vt(u.bottom, 0);
13395
- p ? A = m - 2 * (M !== 0 || D !== 0 ? M + D : Vt(u.left, u.right)) : T = g - 2 * (U !== 0 || W !== 0 ? U + W : Vt(u.top, u.bottom));
13392
+ p ? N = m - 2 * (M !== 0 || D !== 0 ? M + D : Vt(u.left, u.right)) : T = g - 2 * (U !== 0 || W !== 0 ? U + W : Vt(u.top, u.bottom));
13396
13393
  }
13397
13394
  await c({
13398
13395
  ...t,
13399
- availableWidth: A,
13396
+ availableWidth: N,
13400
13397
  availableHeight: T
13401
13398
  });
13402
- const _ = await i.getDimensions(a.floating);
13403
- return m !== _.width || g !== _.height ? {
13399
+ const A = await i.getDimensions(a.floating);
13400
+ return m !== A.width || g !== A.height ? {
13404
13401
  reset: {
13405
13402
  rects: !0
13406
13403
  }
@@ -13980,7 +13977,7 @@ function m0(e) {
13980
13977
  H !== y.current && (y.current = H, g(H));
13981
13978
  }, []), k = b.useCallback((H) => {
13982
13979
  H !== T.current && (T.current = H, w(H));
13983
- }, []), R = s || m, C = i || x, y = b.useRef(null), T = b.useRef(null), A = b.useRef(u), _ = c != null, M = ui(c), D = ui(o), U = ui(l), W = b.useCallback(() => {
13980
+ }, []), R = s || m, C = i || x, y = b.useRef(null), T = b.useRef(null), N = b.useRef(u), A = c != null, M = ui(c), D = ui(o), U = ui(l), W = b.useCallback(() => {
13984
13981
  if (!y.current || !T.current)
13985
13982
  return;
13986
13983
  const H = {
@@ -13997,13 +13994,13 @@ function m0(e) {
13997
13994
  // setting it to `true` when `open === false` (must be specified).
13998
13995
  isPositioned: U.current !== !1
13999
13996
  };
14000
- L.current && !cs(A.current, q) && (A.current = q, Rc.flushSync(() => {
13997
+ L.current && !cs(N.current, q) && (N.current = q, Rc.flushSync(() => {
14001
13998
  f(q);
14002
13999
  }));
14003
14000
  });
14004
14001
  }, [h, t, n, D, U]);
14005
14002
  Ko(() => {
14006
- l === !1 && A.current.isPositioned && (A.current.isPositioned = !1, f((H) => ({
14003
+ l === !1 && N.current.isPositioned && (N.current.isPositioned = !1, f((H) => ({
14007
14004
  ...H,
14008
14005
  isPositioned: !1
14009
14006
  })));
@@ -14017,7 +14014,7 @@ function m0(e) {
14017
14014
  return M.current(R, C, W);
14018
14015
  W();
14019
14016
  }
14020
- }, [R, C, W, M, _]);
14017
+ }, [R, C, W, M, A]);
14021
14018
  const J = b.useMemo(() => ({
14022
14019
  reference: y,
14023
14020
  floating: T,
@@ -14154,7 +14151,7 @@ var yf = "PopperAnchor", Sf = b.forwardRef(
14154
14151
  Sf.displayName = yf;
14155
14152
  var Ta = "PopperContent", [E0, A0] = xf(Ta), Cf = b.forwardRef(
14156
14153
  (e, t) => {
14157
- var X, N, V, te, ae, pe;
14154
+ var X, _, V, te, ae, pe;
14158
14155
  const {
14159
14156
  __scopePopper: n,
14160
14157
  side: r = "bottom",
@@ -14170,7 +14167,7 @@ var Ta = "PopperContent", [E0, A0] = xf(Ta), Cf = b.forwardRef(
14170
14167
  updatePositionStrategy: p = "optimized",
14171
14168
  onPlaced: m,
14172
14169
  ...g
14173
- } = e, x = wf(Ta, n), [w, v] = b.useState(null), k = st(t, (ce) => v(ce)), [R, C] = b.useState(null), y = R0(R), T = (y == null ? void 0 : y.width) ?? 0, A = (y == null ? void 0 : y.height) ?? 0, _ = r + (s !== "center" ? "-" + s : ""), M = typeof u == "number" ? u : { top: 0, right: 0, bottom: 0, left: 0, ...u }, D = Array.isArray(l) ? l : [l], U = D.length > 0, W = {
14170
+ } = e, x = wf(Ta, n), [w, v] = b.useState(null), k = st(t, (ce) => v(ce)), [R, C] = b.useState(null), y = R0(R), T = (y == null ? void 0 : y.width) ?? 0, N = (y == null ? void 0 : y.height) ?? 0, A = r + (s !== "center" ? "-" + s : ""), M = typeof u == "number" ? u : { top: 0, right: 0, bottom: 0, left: 0, ...u }, D = Array.isArray(l) ? l : [l], U = D.length > 0, W = {
14174
14171
  padding: M,
14175
14172
  boundary: D.filter(_0),
14176
14173
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
@@ -14178,7 +14175,7 @@ var Ta = "PopperContent", [E0, A0] = xf(Ta), Cf = b.forwardRef(
14178
14175
  }, { refs: L, floatingStyles: J, placement: Y, isPositioned: ne, middlewareData: H } = m0({
14179
14176
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
14180
14177
  strategy: "fixed",
14181
- placement: _,
14178
+ placement: A,
14182
14179
  whileElementsMounted: (...ce) => s0(...ce, {
14183
14180
  animationFrame: p === "always"
14184
14181
  }),
@@ -14186,7 +14183,7 @@ var Ta = "PopperContent", [E0, A0] = xf(Ta), Cf = b.forwardRef(
14186
14183
  reference: x.anchor
14187
14184
  },
14188
14185
  middleware: [
14189
- x0({ mainAxis: o + A, alignmentAxis: i }),
14186
+ x0({ mainAxis: o + N, alignmentAxis: i }),
14190
14187
  c && b0({
14191
14188
  mainAxis: !0,
14192
14189
  crossAxis: !1,
@@ -14202,14 +14199,14 @@ var Ta = "PopperContent", [E0, A0] = xf(Ta), Cf = b.forwardRef(
14202
14199
  }
14203
14200
  }),
14204
14201
  R && C0({ element: R, padding: a }),
14205
- j0({ arrowWidth: T, arrowHeight: A }),
14202
+ j0({ arrowWidth: T, arrowHeight: N }),
14206
14203
  h && S0({ strategy: "referenceHidden", ...W })
14207
14204
  ]
14208
14205
  }), [$, q] = Rf(Y), z = Et(m);
14209
14206
  bn(() => {
14210
14207
  ne && (z == null || z());
14211
14208
  }, [ne, z]);
14212
- const I = (X = H.arrow) == null ? void 0 : X.x, E = (N = H.arrow) == null ? void 0 : N.y, P = ((V = H.arrow) == null ? void 0 : V.centerOffset) !== 0, [O, K] = b.useState();
14209
+ const I = (X = H.arrow) == null ? void 0 : X.x, E = (_ = H.arrow) == null ? void 0 : _.y, P = ((V = H.arrow) == null ? void 0 : V.centerOffset) !== 0, [O, K] = b.useState();
14213
14210
  return bn(() => {
14214
14211
  w && K(window.getComputedStyle(w).zIndex);
14215
14212
  }, [w]), /* @__PURE__ */ d.jsx(
@@ -14361,9 +14358,9 @@ var H0 = b.forwardRef((e, t) => {
14361
14358
  caller: ho
14362
14359
  }), [w, v] = b.useState(!1), k = Et(l), R = If(n), C = b.useRef(!1), [y, T] = b.useState(0);
14363
14360
  return b.useEffect(() => {
14364
- const A = h.current;
14365
- if (A)
14366
- return A.addEventListener(di, k), () => A.removeEventListener(di, k);
14361
+ const N = h.current;
14362
+ if (N)
14363
+ return N.addEventListener(di, k), () => N.removeEventListener(di, k);
14367
14364
  }, [k]), /* @__PURE__ */ d.jsx(
14368
14365
  z0,
14369
14366
  {
@@ -14373,16 +14370,16 @@ var H0 = b.forwardRef((e, t) => {
14373
14370
  loop: o,
14374
14371
  currentTabStopId: g,
14375
14372
  onItemFocus: b.useCallback(
14376
- (A) => x(A),
14373
+ (N) => x(N),
14377
14374
  [x]
14378
14375
  ),
14379
14376
  onItemShiftTab: b.useCallback(() => v(!0), []),
14380
14377
  onFocusableItemAdd: b.useCallback(
14381
- () => T((A) => A + 1),
14378
+ () => T((N) => N + 1),
14382
14379
  []
14383
14380
  ),
14384
14381
  onFocusableItemRemove: b.useCallback(
14385
- () => T((A) => A - 1),
14382
+ () => T((N) => N - 1),
14386
14383
  []
14387
14384
  ),
14388
14385
  children: /* @__PURE__ */ d.jsx(
@@ -14396,11 +14393,11 @@ var H0 = b.forwardRef((e, t) => {
14396
14393
  onMouseDown: Ce(e.onMouseDown, () => {
14397
14394
  C.current = !0;
14398
14395
  }),
14399
- onFocus: Ce(e.onFocus, (A) => {
14400
- const _ = !C.current;
14401
- if (A.target === A.currentTarget && _ && !w) {
14396
+ onFocus: Ce(e.onFocus, (N) => {
14397
+ const A = !C.current;
14398
+ if (N.target === N.currentTarget && A && !w) {
14402
14399
  const M = new CustomEvent(di, L0);
14403
- if (A.currentTarget.dispatchEvent(M), !M.defaultPrevented) {
14400
+ if (N.currentTarget.dispatchEvent(M), !M.defaultPrevented) {
14404
14401
  const D = R().filter((Y) => Y.focusable), U = D.find((Y) => Y.active), W = D.find((Y) => Y.id === g), J = [U, W, ...D].filter(
14405
14402
  Boolean
14406
14403
  ).map((Y) => Y.ref.current);
@@ -14613,14 +14610,14 @@ var en = "MenuContent", [sS, Ea] = or(en), Ff = b.forwardRef(
14613
14610
  onDismiss: p,
14614
14611
  disableOutsideScroll: m,
14615
14612
  ...g
14616
- } = e, x = sr(en, n), w = mo(en, n), v = Os(n), k = Mf(n), R = Q0(n), [C, y] = b.useState(null), T = b.useRef(null), A = st(t, T, x.onContentChange), _ = b.useRef(0), M = b.useRef(""), D = b.useRef(0), U = b.useRef(null), W = b.useRef("right"), L = b.useRef(0), J = m ? la : b.Fragment, Y = m ? { as: lS, allowPinchZoom: !0 } : void 0, ne = ($) => {
14617
- var X, N;
14618
- const q = M.current + $, z = R().filter((V) => !V.disabled), I = document.activeElement, E = (X = z.find((V) => V.ref.current === I)) == null ? void 0 : X.textValue, P = z.map((V) => V.textValue), O = vS(P, q, E), K = (N = z.find((V) => V.textValue === O)) == null ? void 0 : N.ref.current;
14613
+ } = e, x = sr(en, n), w = mo(en, n), v = Os(n), k = Mf(n), R = Q0(n), [C, y] = b.useState(null), T = b.useRef(null), N = st(t, T, x.onContentChange), A = b.useRef(0), M = b.useRef(""), D = b.useRef(0), U = b.useRef(null), W = b.useRef("right"), L = b.useRef(0), J = m ? la : b.Fragment, Y = m ? { as: lS, allowPinchZoom: !0 } : void 0, ne = ($) => {
14614
+ var X, _;
14615
+ const q = M.current + $, z = R().filter((V) => !V.disabled), I = document.activeElement, E = (X = z.find((V) => V.ref.current === I)) == null ? void 0 : X.textValue, P = z.map((V) => V.textValue), O = vS(P, q, E), K = (_ = z.find((V) => V.textValue === O)) == null ? void 0 : _.ref.current;
14619
14616
  (function V(te) {
14620
- M.current = te, window.clearTimeout(_.current), te !== "" && (_.current = window.setTimeout(() => V(""), 1e3));
14617
+ M.current = te, window.clearTimeout(A.current), te !== "" && (A.current = window.setTimeout(() => V(""), 1e3));
14621
14618
  })(q), K && setTimeout(() => K.focus());
14622
14619
  };
14623
- b.useEffect(() => () => window.clearTimeout(_.current), []), ad();
14620
+ b.useEffect(() => () => window.clearTimeout(A.current), []), ad();
14624
14621
  const H = b.useCallback(($) => {
14625
14622
  var z, I;
14626
14623
  return W.current === ((z = U.current) == null ? void 0 : z.side) && SS($, (I = U.current) == null ? void 0 : I.area);
@@ -14697,7 +14694,7 @@ var en = "MenuContent", [sS, Ea] = or(en), Ff = b.forwardRef(
14697
14694
  dir: w.dir,
14698
14695
  ...v,
14699
14696
  ...g,
14700
- ref: A,
14697
+ ref: N,
14701
14698
  style: { outline: "none", ...g.style },
14702
14699
  onKeyDown: Ce(g.onKeyDown, ($) => {
14703
14700
  const z = $.target.closest("[data-radix-menu-content]") === $.currentTarget, I = $.ctrlKey || $.altKey || $.metaKey, E = $.key.length === 1;
@@ -14709,7 +14706,7 @@ var en = "MenuContent", [sS, Ea] = or(en), Ff = b.forwardRef(
14709
14706
  Pf.includes($.key) && K.reverse(), bS(K);
14710
14707
  }),
14711
14708
  onBlur: Ce(e.onBlur, ($) => {
14712
- $.currentTarget.contains($.target) || (window.clearTimeout(_.current), M.current = "");
14709
+ $.currentTarget.contains($.target) || (window.clearTimeout(A.current), M.current = "");
14713
14710
  }),
14714
14711
  onPointerMove: Ce(
14715
14712
  e.onPointerMove,
@@ -15391,9 +15388,9 @@ function dC({
15391
15388
  validate: g,
15392
15389
  onValidationError: x
15393
15390
  }) {
15394
- const w = i !== void 0, [v, k] = ee.useState(e), R = (w ? i : v) ?? "", [C, y] = ee.useTransition(), T = ee.useRef(null), A = ee.useRef(0), _ = ee.useRef(null), M = ee.useRef("");
15391
+ const w = i !== void 0, [v, k] = ee.useState(e), R = (w ? i : v) ?? "", [C, y] = ee.useTransition(), T = ee.useRef(null), N = ee.useRef(0), A = ee.useRef(null), M = ee.useRef("");
15395
15392
  ee.useEffect(() => {
15396
- if (!w && (k(e ?? ""), _.current = null, T.current)) {
15393
+ if (!w && (k(e ?? ""), A.current = null, T.current)) {
15397
15394
  const P = !e || e.trim() === "", O = 44;
15398
15395
  P ? T.current.style.height = `${O}px` : (T.current.style.height = "auto", T.current.style.height = `${Math.max(T.current.scrollHeight, O)}px`);
15399
15396
  }
@@ -15438,30 +15435,30 @@ function dC({
15438
15435
  const O = (R ?? "").trim();
15439
15436
  if (!O && !p || J(O))
15440
15437
  return;
15441
- const K = ++A.current;
15442
- _.current = {
15438
+ const K = ++N.current;
15439
+ A.current = {
15443
15440
  id: K,
15444
15441
  shouldClear: !0
15445
15442
  }, y(() => {
15446
- var X, N, V;
15443
+ var X, _, V;
15447
15444
  try {
15448
15445
  const te = c(O);
15449
15446
  te && typeof te.then == "function" ? te.then(() => {
15450
15447
  var ae, pe;
15451
- ((ae = _.current) == null ? void 0 : ae.id) === K && _.current.shouldClear && (w || (k(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((pe = _.current) == null ? void 0 : pe.id) === K && (_.current = null);
15448
+ ((ae = A.current) == null ? void 0 : ae.id) === K && A.current.shouldClear && (w || (k(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((pe = A.current) == null ? void 0 : pe.id) === K && (A.current = null);
15452
15449
  }).catch(() => {
15453
15450
  var ae;
15454
- ((ae = _.current) == null ? void 0 : ae.id) === K && (_.current = null);
15455
- }) : (((X = _.current) == null ? void 0 : X.id) === K && _.current.shouldClear && (w || (k(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((N = _.current) == null ? void 0 : N.id) === K && (_.current = null));
15451
+ ((ae = A.current) == null ? void 0 : ae.id) === K && (A.current = null);
15452
+ }) : (((X = A.current) == null ? void 0 : X.id) === K && A.current.shouldClear && (w || (k(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((_ = A.current) == null ? void 0 : _.id) === K && (A.current = null));
15456
15453
  } catch {
15457
- ((V = _.current) == null ? void 0 : V.id) === K && (_.current = null);
15454
+ ((V = A.current) == null ? void 0 : V.id) === K && (A.current = null);
15458
15455
  }
15459
15456
  });
15460
15457
  },
15461
15458
  [R, c, p, w, a, J]
15462
15459
  ), $ = ee.useCallback((P) => {
15463
15460
  const O = P.target.value;
15464
- ne(O, { fromUser: !0 }), _.current && (_.current.shouldClear = !1), T.current && (T.current.style.height = "auto", T.current.style.height = `${T.current.scrollHeight}px`), D && J(O.trim());
15461
+ ne(O, { fromUser: !0 }), A.current && (A.current.shouldClear = !1), T.current && (T.current.style.height = "auto", T.current.style.height = `${T.current.scrollHeight}px`), D && J(O.trim());
15465
15462
  }, [ne, J, D]), q = ee.useCallback(
15466
15463
  (P) => {
15467
15464
  P.key === "Enter" && !P.shiftKey ? (P.preventDefault(), H()) : P.key === "Escape" && t && (P.preventDefault(), l == null || l());
@@ -15538,8 +15535,8 @@ function hC({
15538
15535
  allowEmptySend: w = !1,
15539
15536
  inputError: v = null
15540
15537
  }) {
15541
- const [k, R] = de([]), C = Se(null), y = Se(null), [T, A] = de(0), [_, M] = de(0), [D, U] = de(!1), [W, L] = de(null), [J, Y] = de(null), ne = re(() => {
15542
- C.current && (C.current.value = ""), y.current && (y.current.value = ""), A((O) => O + 1), M((O) => O + 1);
15538
+ const [k, R] = de([]), C = Se(null), y = Se(null), [T, N] = de(0), [A, M] = de(0), [D, U] = de(!1), [W, L] = de(null), [J, Y] = de(null), ne = re(() => {
15539
+ C.current && (C.current.value = ""), y.current && (y.current.value = ""), N((O) => O + 1), M((O) => O + 1);
15543
15540
  }, []), H = re((O) => {
15544
15541
  R((K) => {
15545
15542
  const X = [...K, ...O];
@@ -15553,7 +15550,7 @@ function hC({
15553
15550
  [H]
15554
15551
  ), q = re((O) => {
15555
15552
  R((K) => {
15556
- const X = K.filter((N, V) => V !== O);
15553
+ const X = K.filter((_, V) => V !== O);
15557
15554
  return X.length === 0 && ne(), g == null || g(X), X;
15558
15555
  });
15559
15556
  }, [g, ne]), z = re(
@@ -15564,8 +15561,8 @@ function hC({
15564
15561
  try {
15565
15562
  await m(K), L(`Uploaded ${K.name} - processing through chat stream`);
15566
15563
  } catch (X) {
15567
- const N = X instanceof Error ? X.message : "Failed to upload Excel file";
15568
- Y(N), x == null || x(N);
15564
+ const _ = X instanceof Error ? X.message : "Failed to upload Excel file";
15565
+ Y(_), x == null || x(_);
15569
15566
  } finally {
15570
15567
  U(!1), O.target.value = "", ne();
15571
15568
  }
@@ -15626,7 +15623,7 @@ function hC({
15626
15623
  onChange: z,
15627
15624
  className: "hidden"
15628
15625
  },
15629
- _
15626
+ A
15630
15627
  ),
15631
15628
  D && /* @__PURE__ */ d.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
15632
15629
  /* @__PURE__ */ d.jsx(An, { className: "h-4 w-4 animate-spin" }),
@@ -15731,8 +15728,8 @@ function qo({
15731
15728
  threadId: C,
15732
15729
  messages: y,
15733
15730
  isLoading: T,
15734
- navigateToCheckpoint: A,
15735
- returnToLatest: _,
15731
+ navigateToCheckpoint: N,
15732
+ returnToLatest: A,
15736
15733
  checkpoint: M,
15737
15734
  checkpoints: D,
15738
15735
  interrupt: U,
@@ -15743,7 +15740,7 @@ function qo({
15743
15740
  ee.useEffect(() => {
15744
15741
  console.log("[ChatInterface] streamingAssistantId changed:", { streamingAssistantId: O, isStreaming: Y, assemblingMessageId: W == null ? void 0 : W.assemblingMessageId });
15745
15742
  }, [O, Y, W == null ? void 0 : W.assemblingMessageId]);
15746
- const K = U, X = K ? du(K.id) : null, N = X !== null ? { type: "interrupt", id: X } : null, [V, te] = de(!1), [ae, pe] = de(!1);
15743
+ const K = U, X = K ? du(K.id) : null, _ = X !== null ? { type: "interrupt", id: X } : null, [V, te] = de(!1), [ae, pe] = de(!1);
15747
15744
  Pe(() => {
15748
15745
  K || te(!1);
15749
15746
  }, [K]);
@@ -15893,14 +15890,14 @@ function qo({
15893
15890
  dt(!0);
15894
15891
  try {
15895
15892
  if (!Z) {
15896
- await _(), requestAnimationFrame(() => {
15893
+ await A(), requestAnimationFrame(() => {
15897
15894
  var F;
15898
15895
  (F = Pt.current) == null || F.scrollToLatest();
15899
15896
  });
15900
15897
  return;
15901
15898
  }
15902
15899
  const S = D.find((F) => F.checkpointId === Z), j = (S == null ? void 0 : S.checkpointNs) ?? null;
15903
- await A(Z, j), requestAnimationFrame(() => {
15900
+ await N(Z, j), requestAnimationFrame(() => {
15904
15901
  var F;
15905
15902
  (F = Pt.current) == null || F.scrollToTop();
15906
15903
  });
@@ -15913,8 +15910,8 @@ function qo({
15913
15910
  D,
15914
15911
  R,
15915
15912
  Pt,
15916
- A,
15917
- _
15913
+ N,
15914
+ A
15918
15915
  ]
15919
15916
  ), dn = re(
15920
15917
  async (Z, S, j) => {
@@ -15986,10 +15983,10 @@ function qo({
15986
15983
  /* @__PURE__ */ d.jsx(An, { className: "h-6 w-6 animate-spin" }),
15987
15984
  /* @__PURE__ */ d.jsx("span", { className: "text-xs font-semibold uppercase tracking-wide", children: "Loading checkpoint…" })
15988
15985
  ] }),
15989
- K && N && /* @__PURE__ */ d.jsx("div", { className: "pointer-events-auto absolute inset-x-0 bottom-6 z-30 flex justify-center px-4", children: /* @__PURE__ */ d.jsx("div", { className: "w-full max-w-3xl", children: /* @__PURE__ */ d.jsx(
15986
+ K && _ && /* @__PURE__ */ d.jsx("div", { className: "pointer-events-auto absolute inset-x-0 bottom-6 z-30 flex justify-center px-4", children: /* @__PURE__ */ d.jsx("div", { className: "w-full max-w-3xl", children: /* @__PURE__ */ d.jsx(
15990
15987
  Vd,
15991
15988
  {
15992
- interruptPart: N,
15989
+ interruptPart: _,
15993
15990
  onApprove: He,
15994
15991
  onReject: nt,
15995
15992
  onSelectAlternative: xt,
@@ -16073,7 +16070,7 @@ var Mr = '[cmdk-group=""]', pi = '[cmdk-group-items=""]', kC = '[cmdk-group-head
16073
16070
  y(6, W);
16074
16071
  }, []);
16075
16072
  let T = b.useMemo(() => ({ subscribe: (I) => (i.current.add(I), () => i.current.delete(I)), snapshot: () => n.current, setState: (I, E, P) => {
16076
- var O, K, X, N;
16073
+ var O, K, X, _;
16077
16074
  if (!Object.is(n.current[I], E)) {
16078
16075
  if (n.current[I] = E, I === "search") U(), M(), y(1, D);
16079
16076
  else if (I === "value") {
@@ -16086,7 +16083,7 @@ var Mr = '[cmdk-group=""]', pi = '[cmdk-group-items=""]', kC = '[cmdk-group-head
16086
16083
  n.current.selectedItemId = (V = L()) == null ? void 0 : V.id, T.emit();
16087
16084
  }), P || y(5, W), ((K = a.current) == null ? void 0 : K.value) !== void 0) {
16088
16085
  let V = E ?? "";
16089
- (N = (X = a.current).onValueChange) == null || N.call(X, V);
16086
+ (_ = (X = a.current).onValueChange) == null || _.call(X, V);
16090
16087
  return;
16091
16088
  }
16092
16089
  }
@@ -16094,9 +16091,9 @@ var Mr = '[cmdk-group=""]', pi = '[cmdk-group-items=""]', kC = '[cmdk-group-head
16094
16091
  }
16095
16092
  }, emit: () => {
16096
16093
  i.current.forEach((I) => I());
16097
- } }), []), A = b.useMemo(() => ({ value: (I, E, P) => {
16094
+ } }), []), N = b.useMemo(() => ({ value: (I, E, P) => {
16098
16095
  var O;
16099
- E !== ((O = s.current.get(I)) == null ? void 0 : O.value) && (s.current.set(I, { value: E, keywords: P }), n.current.filtered.items.set(I, _(E, P)), y(2, () => {
16096
+ E !== ((O = s.current.get(I)) == null ? void 0 : O.value) && (s.current.set(I, { value: E, keywords: P }), n.current.filtered.items.set(I, A(E, P)), y(2, () => {
16100
16097
  M(), T.emit();
16101
16098
  }));
16102
16099
  }, item: (I, E) => (r.current.add(I), E && (o.current.has(E) ? o.current.get(E).add(I) : o.current.set(E, /* @__PURE__ */ new Set([I]))), y(3, () => {
@@ -16110,7 +16107,7 @@ var Mr = '[cmdk-group=""]', pi = '[cmdk-group-items=""]', kC = '[cmdk-group-head
16110
16107
  }), group: (I) => (o.current.has(I) || o.current.set(I, /* @__PURE__ */ new Set()), () => {
16111
16108
  s.current.delete(I), o.current.delete(I);
16112
16109
  }), filter: () => a.current.shouldFilter, label: c || e["aria-label"], getDisablePointerSelection: () => a.current.disablePointerSelection, listId: v, inputId: R, labelId: k, listInnerRef: C }), []);
16113
- function _(I, E) {
16110
+ function A(I, E) {
16114
16111
  var P, O;
16115
16112
  let K = (O = (P = a.current) == null ? void 0 : P.filter) != null ? O : TC;
16116
16113
  return I ? K(I, n.current.search, E) : 0;
@@ -16120,16 +16117,16 @@ var Mr = '[cmdk-group=""]', pi = '[cmdk-group-items=""]', kC = '[cmdk-group-head
16120
16117
  let I = n.current.filtered.items, E = [];
16121
16118
  n.current.filtered.groups.forEach((O) => {
16122
16119
  let K = o.current.get(O), X = 0;
16123
- K.forEach((N) => {
16124
- let V = I.get(N);
16120
+ K.forEach((_) => {
16121
+ let V = I.get(_);
16125
16122
  X = Math.max(V, X);
16126
16123
  }), E.push([O, X]);
16127
16124
  });
16128
16125
  let P = C.current;
16129
16126
  J().sort((O, K) => {
16130
- var X, N;
16127
+ var X, _;
16131
16128
  let V = O.getAttribute("id"), te = K.getAttribute("id");
16132
- return ((X = I.get(te)) != null ? X : 0) - ((N = I.get(V)) != null ? N : 0);
16129
+ return ((X = I.get(te)) != null ? X : 0) - ((_ = I.get(V)) != null ? _ : 0);
16133
16130
  }).forEach((O) => {
16134
16131
  let K = O.closest(pi);
16135
16132
  K ? K.appendChild(O.parentElement === K ? O : O.closest(`${pi} > *`)) : P.appendChild(O.parentElement === P ? O : O.closest(`${pi} > *`));
@@ -16152,10 +16149,10 @@ var Mr = '[cmdk-group=""]', pi = '[cmdk-group-items=""]', kC = '[cmdk-group-head
16152
16149
  n.current.filtered.groups = /* @__PURE__ */ new Set();
16153
16150
  let K = 0;
16154
16151
  for (let X of r.current) {
16155
- let N = (E = (I = s.current.get(X)) == null ? void 0 : I.value) != null ? E : "", V = (O = (P = s.current.get(X)) == null ? void 0 : P.keywords) != null ? O : [], te = _(N, V);
16152
+ let _ = (E = (I = s.current.get(X)) == null ? void 0 : I.value) != null ? E : "", V = (O = (P = s.current.get(X)) == null ? void 0 : P.keywords) != null ? O : [], te = A(_, V);
16156
16153
  n.current.filtered.items.set(X, te), te > 0 && K++;
16157
16154
  }
16158
- for (let [X, N] of o.current) for (let V of N) if (n.current.filtered.items.get(V) > 0) {
16155
+ for (let [X, _] of o.current) for (let V of _) if (n.current.filtered.items.get(V) > 0) {
16159
16156
  n.current.filtered.groups.add(X);
16160
16157
  break;
16161
16158
  }
@@ -16180,7 +16177,7 @@ var Mr = '[cmdk-group=""]', pi = '[cmdk-group-items=""]', kC = '[cmdk-group-head
16180
16177
  }
16181
16178
  function ne(I) {
16182
16179
  var E;
16183
- let P = L(), O = J(), K = O.findIndex((N) => N === P), X = O[K + I];
16180
+ let P = L(), O = J(), K = O.findIndex((_) => _ === P), X = O[K + I];
16184
16181
  (E = a.current) != null && E.loop && (X = K + I < 0 ? O[O.length - 1] : K + I === O.length ? O[0] : O[K + I]), X && T.setState("value", X.getAttribute(ur));
16185
16182
  }
16186
16183
  function H(I) {
@@ -16233,7 +16230,7 @@ var Mr = '[cmdk-group=""]', pi = '[cmdk-group-items=""]', kC = '[cmdk-group-head
16233
16230
  }
16234
16231
  }
16235
16232
  }
16236
- } }, b.createElement("label", { "cmdk-label": "", htmlFor: A.inputId, id: A.labelId, style: $C }, c), $s(e, (I) => b.createElement(Nh.Provider, { value: T }, b.createElement(Ah.Provider, { value: A }, I))));
16233
+ } }, b.createElement("label", { "cmdk-label": "", htmlFor: N.inputId, id: N.labelId, style: $C }, c), $s(e, (I) => b.createElement(Nh.Provider, { value: T }, b.createElement(Ah.Provider, { value: N }, I))));
16237
16234
  }), RC = b.forwardRef((e, t) => {
16238
16235
  var n, r;
16239
16236
  let o = Gt(), s = b.useRef(null), i = b.useContext(_h), a = go(), c = Ph(e), l = (r = (n = c.current) == null ? void 0 : n.forceMount) != null ? r : i == null ? void 0 : i.forceMount;
@@ -16443,7 +16440,7 @@ var Da = "ScrollArea", [Bh, Uk] = zn(Da), [HC, tn] = Bh(Da), Hh = b.forwardRef(
16443
16440
  dir: o,
16444
16441
  scrollHideDelay: s = 600,
16445
16442
  ...i
16446
- } = e, [a, c] = b.useState(null), [l, u] = b.useState(null), [f, h] = b.useState(null), [p, m] = b.useState(null), [g, x] = b.useState(null), [w, v] = b.useState(0), [k, R] = b.useState(0), [C, y] = b.useState(!1), [T, A] = b.useState(!1), _ = st(t, (D) => c(D)), M = xa(o);
16443
+ } = e, [a, c] = b.useState(null), [l, u] = b.useState(null), [f, h] = b.useState(null), [p, m] = b.useState(null), [g, x] = b.useState(null), [w, v] = b.useState(0), [k, R] = b.useState(0), [C, y] = b.useState(!1), [T, N] = b.useState(!1), A = st(t, (D) => c(D)), M = xa(o);
16447
16444
  return /* @__PURE__ */ d.jsx(
16448
16445
  HC,
16449
16446
  {
@@ -16463,7 +16460,7 @@ var Da = "ScrollArea", [Bh, Uk] = zn(Da), [HC, tn] = Bh(Da), Hh = b.forwardRef(
16463
16460
  scrollbarY: g,
16464
16461
  onScrollbarYChange: x,
16465
16462
  scrollbarYEnabled: T,
16466
- onScrollbarYEnabledChange: A,
16463
+ onScrollbarYEnabledChange: N,
16467
16464
  onCornerWidthChange: v,
16468
16465
  onCornerHeightChange: R,
16469
16466
  children: /* @__PURE__ */ d.jsx(
@@ -16471,7 +16468,7 @@ var Da = "ScrollArea", [Bh, Uk] = zn(Da), [HC, tn] = Bh(Da), Hh = b.forwardRef(
16471
16468
  {
16472
16469
  dir: M,
16473
16470
  ...i,
16474
- ref: _,
16471
+ ref: A,
16475
16472
  style: {
16476
16473
  position: "relative",
16477
16474
  // Pass corner sizes as CSS vars to reduce re-renders of context consumers
@@ -16765,19 +16762,19 @@ var UC = b.forwardRef((e, t) => {
16765
16762
  onWheelScroll: u,
16766
16763
  onResize: f,
16767
16764
  ...h
16768
- } = e, p = tn(Sn, n), [m, g] = b.useState(null), x = st(t, (_) => g(_)), w = b.useRef(null), v = b.useRef(""), k = p.viewport, R = r.content - r.viewport, C = Et(u), y = Et(c), T = zs(f, 10);
16769
- function A(_) {
16765
+ } = e, p = tn(Sn, n), [m, g] = b.useState(null), x = st(t, (A) => g(A)), w = b.useRef(null), v = b.useRef(""), k = p.viewport, R = r.content - r.viewport, C = Et(u), y = Et(c), T = zs(f, 10);
16766
+ function N(A) {
16770
16767
  if (w.current) {
16771
- const M = _.clientX - w.current.left, D = _.clientY - w.current.top;
16768
+ const M = A.clientX - w.current.left, D = A.clientY - w.current.top;
16772
16769
  l({ x: M, y: D });
16773
16770
  }
16774
16771
  }
16775
16772
  return b.useEffect(() => {
16776
- const _ = (M) => {
16773
+ const A = (M) => {
16777
16774
  const D = M.target;
16778
16775
  (m == null ? void 0 : m.contains(D)) && C(M, R);
16779
16776
  };
16780
- return document.addEventListener("wheel", _, { passive: !1 }), () => document.removeEventListener("wheel", _, { passive: !1 });
16777
+ return document.addEventListener("wheel", A, { passive: !1 }), () => document.removeEventListener("wheel", A, { passive: !1 });
16781
16778
  }, [k, m, R, C]), b.useEffect(y, [r, y]), vr(m, T), vr(p.content, T), /* @__PURE__ */ d.jsx(
16782
16779
  qC,
16783
16780
  {
@@ -16794,13 +16791,13 @@ var UC = b.forwardRef((e, t) => {
16794
16791
  ...h,
16795
16792
  ref: x,
16796
16793
  style: { position: "absolute", ...h.style },
16797
- onPointerDown: Ce(e.onPointerDown, (_) => {
16798
- _.button === 0 && (_.target.setPointerCapture(_.pointerId), w.current = m.getBoundingClientRect(), v.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", p.viewport && (p.viewport.style.scrollBehavior = "auto"), A(_));
16794
+ onPointerDown: Ce(e.onPointerDown, (A) => {
16795
+ A.button === 0 && (A.target.setPointerCapture(A.pointerId), w.current = m.getBoundingClientRect(), v.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", p.viewport && (p.viewport.style.scrollBehavior = "auto"), N(A));
16799
16796
  }),
16800
- onPointerMove: Ce(e.onPointerMove, A),
16801
- onPointerUp: Ce(e.onPointerUp, (_) => {
16802
- const M = _.target;
16803
- M.hasPointerCapture(_.pointerId) && M.releasePointerCapture(_.pointerId), document.body.style.webkitUserSelect = v.current, p.viewport && (p.viewport.style.scrollBehavior = ""), w.current = null;
16797
+ onPointerMove: Ce(e.onPointerMove, N),
16798
+ onPointerUp: Ce(e.onPointerUp, (A) => {
16799
+ const M = A.target;
16800
+ M.hasPointerCapture(A.pointerId) && M.releasePointerCapture(A.pointerId), document.body.style.webkitUserSelect = v.current, p.viewport && (p.viewport.style.scrollBehavior = ""), w.current = null;
16804
16801
  })
16805
16802
  }
16806
16803
  )
@@ -17229,8 +17226,8 @@ function zi({
17229
17226
  menuItem: C
17230
17227
  }) {
17231
17228
  const { chatApi: y, authApi: T } = Tr(), {
17232
- threads: A,
17233
- sharedThreads: _,
17229
+ threads: N,
17230
+ sharedThreads: A,
17234
17231
  currentThreadId: M,
17235
17232
  setCurrentThreadId: D,
17236
17233
  isLoading: U,
@@ -17239,7 +17236,7 @@ function zi({
17239
17236
  shareInFlight: J,
17240
17237
  shareStatus: Y,
17241
17238
  clearShareStatus: ne
17242
- } = so(), { createThread: H, deleteThread: $, renameThread: q, shareThread: z } = L, { loadThread: I } = ys(), E = i ?? M, [P, O] = de(Array.isArray(A) ? A : []), K = Se(P.length > 0), X = Se(null), N = Se(0), [V, te] = de(null), [ae, pe] = de(""), [ce, me] = de(!1), [be, We] = de(!1), [Fe, je] = de(null), [He, nt] = de(""), [xt, at] = de([]), [Ue, Le] = de(!1), Qe = re((G) => pe(G), []);
17239
+ } = so(), { createThread: H, deleteThread: $, renameThread: q, shareThread: z } = L, { loadThread: I } = ys(), E = i ?? M, [P, O] = de(Array.isArray(N) ? N : []), K = Se(P.length > 0), X = Se(null), _ = Se(0), [V, te] = de(null), [ae, pe] = de(""), [ce, me] = de(!1), [be, We] = de(!1), [Fe, je] = de(null), [He, nt] = de(""), [xt, at] = de([]), [Ue, Le] = de(!1), Qe = re((G) => pe(G), []);
17243
17240
  Pe(() => {
17244
17241
  be && !w && xt.length === 0 && !Ue && (async () => {
17245
17242
  Le(!0);
@@ -17281,7 +17278,7 @@ function zi({
17281
17278
  ), yt = De(() => {
17282
17279
  const G = it, he = He.trim().toLowerCase();
17283
17280
  return he ? k ? G.filter((Z) => k(Z, he)) : G.filter((Z) => `${Z.label} ${Z.secondaryLabel ?? ""}`.toLowerCase().includes(he)) : G;
17284
- }, [w, He, k]), Xe = lt === "shared", bt = Xe ? _ : P, dt = De(() => {
17281
+ }, [w, He, k]), Xe = lt === "shared", bt = Xe ? A : P, dt = De(() => {
17285
17282
  if (!R || Xe) return null;
17286
17283
  const G = "Default", he = (S) => {
17287
17284
  if (!S) return "Older";
@@ -17324,13 +17321,13 @@ function zi({
17324
17321
  return `Shared by ${G.sharedByUserId}${he}`;
17325
17322
  }, Ke = (G) => "sharedByUserId" in G;
17326
17323
  Pe(() => {
17327
- const G = Array.isArray(A) ? A : [];
17324
+ const G = Array.isArray(N) ? N : [];
17328
17325
  if (G.length > 0) {
17329
17326
  K.current = !0, O(G);
17330
17327
  return;
17331
17328
  }
17332
17329
  U || (K.current = !1, O(G));
17333
- }, [A, U]), Pe(() => {
17330
+ }, [N, U]), Pe(() => {
17334
17331
  if (!X.current) return;
17335
17332
  const G = X.current.querySelector(
17336
17333
  "[data-radix-scroll-area-viewport]"
@@ -17339,7 +17336,7 @@ function zi({
17339
17336
  let he = null, Z = null;
17340
17337
  return he = requestAnimationFrame(() => {
17341
17338
  Z = requestAnimationFrame(() => {
17342
- G.scrollTop = N.current;
17339
+ G.scrollTop = _.current;
17343
17340
  });
17344
17341
  }), () => {
17345
17342
  he !== null && cancelAnimationFrame(he), Z !== null && cancelAnimationFrame(Z);
@@ -17366,7 +17363,7 @@ function zi({
17366
17363
  if (confirm("Delete this thread?")) {
17367
17364
  if (X.current) {
17368
17365
  const S = X.current.querySelector("[data-radix-scroll-area-viewport]");
17369
- S && (N.current = S.scrollTop);
17366
+ S && (_.current = S.scrollTop);
17370
17367
  }
17371
17368
  try {
17372
17369
  await $(Z), u == null || u(Z);
@@ -17881,12 +17878,12 @@ function Sc({
17881
17878
  return U;
17882
17879
  }
17883
17880
  return i.default;
17884
- })(), A = T ? T({
17881
+ })(), N = T ? T({
17885
17882
  artifact: c,
17886
17883
  message: e,
17887
17884
  toolPayload: f,
17888
17885
  isStreaming: n
17889
- }) : null, _ = C ?? k, M = T ? A : null;
17886
+ }) : null, A = C ?? k, M = T ? N : null;
17890
17887
  return /* @__PURE__ */ d.jsxs("div", { className: "space-y-2", children: [
17891
17888
  n && /* @__PURE__ */ d.jsx(
17892
17889
  Sv,
@@ -17896,7 +17893,7 @@ function Sc({
17896
17893
  }
17897
17894
  ),
17898
17895
  c && M,
17899
- R ? _ : null
17896
+ R ? A : null
17900
17897
  ] });
17901
17898
  }
17902
17899
  function Gk({
@@ -17915,7 +17912,7 @@ function Gk({
17915
17912
  activeThreadId: h,
17916
17913
  ensureValidToken: p
17917
17914
  }) {
17918
- const { messages: m } = wu(), [g, x] = de(null), [w, v] = de(""), [k, R] = de(null), [C, y] = de(null), [T, A] = de(!1), [_, M] = de(""), D = Se(_), U = Se(null);
17915
+ const { messages: m } = wu(), [g, x] = de(null), [w, v] = de(""), [k, R] = de(null), [C, y] = de(null), [T, N] = de(!1), [A, M] = de(""), D = Se(A), U = Se(null);
17919
17916
  Pe(() => {
17920
17917
  if (!g)
17921
17918
  if (h) {
@@ -17928,8 +17925,8 @@ function Gk({
17928
17925
  M(I), !g && h && localStorage.setItem(Gs(h), I);
17929
17926
  }, [h, g]);
17930
17927
  Pe(() => {
17931
- D.current = _;
17932
- }, [_]), Pe(() => {
17928
+ D.current = A;
17929
+ }, [A]), Pe(() => {
17933
17930
  if (!g) {
17934
17931
  U.current = null;
17935
17932
  return;
@@ -17946,14 +17943,14 @@ function Gk({
17946
17943
  if (!(!X && O.length === 0 && K.length === 0))
17947
17944
  try {
17948
17945
  p && await p();
17949
- const N = O.map(async (me) => {
17946
+ const _ = O.map(async (me) => {
17950
17947
  try {
17951
17948
  const be = await su.uploadFile(me);
17952
17949
  return { file: me, record: be };
17953
17950
  } catch (be) {
17954
17951
  throw console.error("Failed to upload file", me.name, be), new Error(`Failed to upload ${me.name}`);
17955
17952
  }
17956
- }), te = (await Promise.all(N)).map(({ record: me }) => {
17953
+ }), te = (await Promise.all(_)).map(({ record: me }) => {
17957
17954
  const be = me.mime_type;
17958
17955
  return be.startsWith("image/") ? {
17959
17956
  type: "image_url",
@@ -17985,8 +17982,8 @@ function Gk({
17985
17982
  onEvent: f
17986
17983
  }
17987
17984
  ), o == null || o(X), l(!0), h && localStorage.removeItem(Gs(h)), W(""), y(null), x(null), v(""), R(null);
17988
- } catch (N) {
17989
- const V = (N == null ? void 0 : N.message) || "Failed to send message";
17985
+ } catch (_) {
17986
+ const V = (_ == null ? void 0 : _.message) || "Failed to send message";
17990
17987
  y(V), i == null || i(V), l(!1);
17991
17988
  }
17992
17989
  }, Y = (I, E) => {
@@ -18010,12 +18007,12 @@ function Gk({
18010
18007
  [n, r, t, s, e]
18011
18008
  ), H = re(
18012
18009
  (I, E, P) => {
18013
- a && (U.current = _, x(I), v(E), R({
18010
+ a && (U.current = A, x(I), v(E), R({
18014
18011
  checkpointId: (P == null ? void 0 : P.checkpointId) ?? null,
18015
18012
  checkpointNs: (P == null ? void 0 : P.checkpointNs) ?? null
18016
18013
  }), y(null));
18017
18014
  },
18018
- [_, a]
18015
+ [A, a]
18019
18016
  ), $ = re(() => {
18020
18017
  x(null), v(""), R(null), y(null);
18021
18018
  const I = U.current;
@@ -18053,8 +18050,8 @@ function Gk({
18053
18050
  inputError: C,
18054
18051
  setInputError: y,
18055
18052
  dismissError: T,
18056
- setDismissError: A,
18057
- composerValue: _,
18053
+ setDismissError: N,
18054
+ composerValue: A,
18058
18055
  handleComposerChange: L,
18059
18056
  handleSendMessage: J,
18060
18057
  handleQuickPrompt: Y,