teodor-new-chat-ui 4.1.39 → 4.1.40

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
@@ -1,6 +1,6 @@
1
- var Fp = Object.defineProperty;
2
- var $p = (e, t, n) => t in e ? Fp(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var Ya = (e, t, n) => $p(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var $p = Object.defineProperty;
2
+ var Fp = (e, t, n) => t in e ? $p(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var Ya = (e, t, n) => Fp(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as m from "react";
5
5
  import V, { createContext as Jr, useContext as ts, useReducer as zp, useRef as Ge, useCallback as Me, useEffect as ct, useMemo as at, useState as xe, startTransition as zs, createElement as bo, useLayoutEffect as Bp } from "react";
6
6
  import { Square as Hp, Send as Up, X as fr, ExternalLink as Wp, Download as Vp, Image as Kp, FileText as Xa, Loader as Oc, Bot as Ja, Wrench as qp, User as Gp, ChevronUp as _r, ChevronDown as dr, Paperclip as gi, Copy as Za, Edit as Qa, RotateCcw as xi, ChevronRight as Yp, Check as Zi, Circle as Xp, Loader2 as vi, Edit3 as Mc, Plus as Jp, FileSpreadsheet as Zp, MessageSquarePlus as Qp, MessageSquare as em, Calendar as tm, Trash2 as nm, Settings as rm, Server as om, EyeOff as sm, Eye as im, Layout as am, MessageCircle as lm, Save as cm } from "lucide-react";
@@ -136,14 +136,14 @@ function pm() {
136
136
  }
137
137
  return null;
138
138
  }
139
- var P = Object.assign, Y = 0, K, J, z, F, $, B, pe;
139
+ var P = Object.assign, Y = 0, K, J, z, $, F, B, pe;
140
140
  function ue() {
141
141
  }
142
142
  ue.__reactDisabledLog = !0;
143
143
  function ee() {
144
144
  {
145
145
  if (Y === 0) {
146
- K = console.log, J = console.info, z = console.warn, F = console.error, $ = console.group, B = console.groupCollapsed, pe = console.groupEnd;
146
+ K = console.log, J = console.info, z = console.warn, $ = console.error, F = console.group, B = console.groupCollapsed, pe = console.groupEnd;
147
147
  var b = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
@@ -182,10 +182,10 @@ function pm() {
182
182
  value: z
183
183
  }),
184
184
  error: P({}, b, {
185
- value: F
185
+ value: $
186
186
  }),
187
187
  group: P({}, b, {
188
- value: $
188
+ value: F
189
189
  }),
190
190
  groupCollapsed: P({}, b, {
191
191
  value: B
@@ -285,10 +285,10 @@ function pm() {
285
285
  } finally {
286
286
  Q = !1, Ce.current = Se, Ie(), Error.prepareStackTrace = X;
287
287
  }
288
- var Lt = b ? b.displayName || b.name : "", $s = Lt ? O(Lt) : "";
289
- return typeof b == "function" && q.set(b, $s), $s;
288
+ var Lt = b ? b.displayName || b.name : "", Fs = Lt ? O(Lt) : "";
289
+ return typeof b == "function" && q.set(b, Fs), Fs;
290
290
  }
291
- function Fe(b, N, M) {
291
+ function $e(b, N, M) {
292
292
  return ie(b, !1);
293
293
  }
294
294
  function Ke(b) {
@@ -311,7 +311,7 @@ function pm() {
311
311
  if (typeof b == "object")
312
312
  switch (b.$$typeof) {
313
313
  case l:
314
- return Fe(b.render);
314
+ return $e(b.render);
315
315
  case f:
316
316
  return We(b.type, N, M);
317
317
  case h: {
@@ -325,7 +325,7 @@ function pm() {
325
325
  return "";
326
326
  }
327
327
  var Te = Object.prototype.hasOwnProperty, Pe = {}, et = x.ReactDebugCurrentFrame;
328
- function $e(b) {
328
+ function Fe(b) {
329
329
  if (b) {
330
330
  var N = b._owner, M = We(b.type, b._source, N ? N.type : null);
331
331
  et.setExtraStackFrame(M);
@@ -347,7 +347,7 @@ function pm() {
347
347
  } catch (Je) {
348
348
  ge = Je;
349
349
  }
350
- ge && !(ge instanceof Error) && ($e(X), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", H || "React class", M, we, typeof ge), $e(null)), ge instanceof Error && !(ge.message in Pe) && (Pe[ge.message] = !0, $e(X), y("Failed %s type: %s", M, ge.message), $e(null));
350
+ ge && !(ge instanceof Error) && (Fe(X), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", H || "React class", M, we, typeof ge), Fe(null)), ge instanceof Error && !(ge.message in Pe) && (Pe[ge.message] = !0, Fe(X), y("Failed %s type: %s", M, ge.message), Fe(null));
351
351
  }
352
352
  }
353
353
  }
@@ -612,10 +612,10 @@ Check the top-level render call using <` + M + ">.");
612
612
  function Vt(b, N, M) {
613
613
  return xt(b, N, M, !0);
614
614
  }
615
- function Fn(b, N, M) {
615
+ function $n(b, N, M) {
616
616
  return xt(b, N, M, !1);
617
617
  }
618
- var ar = Fn, E = Vt;
618
+ var ar = $n, E = Vt;
619
619
  Ar.Fragment = r, Ar.jsx = ar, Ar.jsxs = E;
620
620
  }()), Ar;
621
621
  }
@@ -626,23 +626,23 @@ function Lc(e, t) {
626
626
  return e.apply(t, arguments);
627
627
  };
628
628
  }
629
- const { toString: mm } = Object.prototype, { getPrototypeOf: Qi } = Object, { iterator: os, toStringTag: Fc } = Symbol, ss = /* @__PURE__ */ ((e) => (t) => {
629
+ const { toString: mm } = Object.prototype, { getPrototypeOf: Qi } = Object, { iterator: os, toStringTag: $c } = Symbol, ss = /* @__PURE__ */ ((e) => (t) => {
630
630
  const n = mm.call(t);
631
631
  return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
632
632
  })(/* @__PURE__ */ Object.create(null)), Jt = (e) => (e = e.toLowerCase(), (t) => ss(t) === e), is = (e) => (t) => typeof t === e, { isArray: Sr } = Array, wr = is("undefined");
633
633
  function Zr(e) {
634
634
  return e !== null && !wr(e) && e.constructor !== null && !wr(e.constructor) && Rt(e.constructor.isBuffer) && e.constructor.isBuffer(e);
635
635
  }
636
- const $c = Jt("ArrayBuffer");
636
+ const Fc = Jt("ArrayBuffer");
637
637
  function gm(e) {
638
638
  let t;
639
- return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && $c(e.buffer), t;
639
+ return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Fc(e.buffer), t;
640
640
  }
641
641
  const xm = is("string"), Rt = is("function"), zc = is("number"), Qr = (e) => e !== null && typeof e == "object", vm = (e) => e === !0 || e === !1, yo = (e) => {
642
642
  if (ss(e) !== "object")
643
643
  return !1;
644
644
  const t = Qi(e);
645
- return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Fc in e) && !(os in e);
645
+ return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !($c in e) && !(os in e);
646
646
  }, wm = (e) => {
647
647
  if (!Qr(e) || Zr(e))
648
648
  return !1;
@@ -722,7 +722,7 @@ const _m = (e, t, n, { allOwnKeys: r } = {}) => (eo(t, (o, s) => {
722
722
  for (; t-- > 0; )
723
723
  n[t] = e[t];
724
724
  return n;
725
- }, Fm = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && Qi(Uint8Array)), $m = (e, t) => {
725
+ }, $m = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && Qi(Uint8Array)), Fm = (e, t) => {
726
726
  const r = (e && e[os]).call(e);
727
727
  let o;
728
728
  for (; (o = r.next()) && !o.done; ) {
@@ -771,7 +771,7 @@ const _m = (e, t, n, { allOwnKeys: r } = {}) => (eo(t, (o, s) => {
771
771
  }, Km = () => {
772
772
  }, qm = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
773
773
  function Gm(e) {
774
- return !!(e && Rt(e.append) && e[Fc] === "FormData" && e[os]);
774
+ return !!(e && Rt(e.append) && e[$c] === "FormData" && e[os]);
775
775
  }
776
776
  const Ym = (e) => {
777
777
  const t = new Array(10), n = (r, o) => {
@@ -801,7 +801,7 @@ const Ym = (e) => {
801
801
  Rt(Bn.postMessage)
802
802
  ), Zm = typeof queueMicrotask < "u" ? queueMicrotask.bind(Bn) : typeof process < "u" && process.nextTick || Wc, Qm = (e) => e != null && Rt(e[os]), _ = {
803
803
  isArray: Sr,
804
- isArrayBuffer: $c,
804
+ isArrayBuffer: Fc,
805
805
  isBuffer: Zr,
806
806
  isFormData: Rm,
807
807
  isArrayBufferView: gm,
@@ -823,7 +823,7 @@ const Ym = (e) => {
823
823
  isFunction: Rt,
824
824
  isStream: Tm,
825
825
  isURLSearchParams: km,
826
- isTypedArray: Fm,
826
+ isTypedArray: $m,
827
827
  isFileList: Cm,
828
828
  forEach: eo,
829
829
  merge: bi,
@@ -836,7 +836,7 @@ const Ym = (e) => {
836
836
  kindOfTest: Jt,
837
837
  endsWith: Dm,
838
838
  toArray: Lm,
839
- forEachEntry: $m,
839
+ forEachEntry: Fm,
840
840
  matchAll: zm,
841
841
  isHTMLForm: Bm,
842
842
  hasOwnProperty: nl,
@@ -1886,8 +1886,8 @@ const tu = (e) => {
1886
1886
  };
1887
1887
  W = s && new n(v, J);
1888
1888
  let z = await (s ? D(W, j) : D(v, J));
1889
- const F = d && (k === "stream" || k === "response");
1890
- if (d && (C || F && P)) {
1889
+ const $ = d && (k === "stream" || k === "response");
1890
+ if (d && (C || $ && P)) {
1891
1891
  const B = {};
1892
1892
  ["status", "statusText", "headers"].forEach((Ie) => {
1893
1893
  B[Ie] = z[Ie];
@@ -1904,10 +1904,10 @@ const tu = (e) => {
1904
1904
  );
1905
1905
  }
1906
1906
  k = k || "text";
1907
- let $ = await f[_.findKey(f, k) || "text"](z, w);
1908
- return !F && P && P(), await new Promise((B, pe) => {
1907
+ let F = await f[_.findKey(f, k) || "text"](z, w);
1908
+ return !$ && P && P(), await new Promise((B, pe) => {
1909
1909
  Qc(B, pe, {
1910
- data: $,
1910
+ data: F,
1911
1911
  headers: kt.from(z.headers),
1912
1912
  status: z.status,
1913
1913
  statusText: z.statusText,
@@ -1953,7 +1953,7 @@ _.forEach(Ci, (e, t) => {
1953
1953
  Object.defineProperty(e, "adapterName", { value: t });
1954
1954
  }
1955
1955
  });
1956
- const ml = (e) => `- ${e}`, Fg = (e) => _.isFunction(e) || e === null || e === !1, ru = {
1956
+ const ml = (e) => `- ${e}`, $g = (e) => _.isFunction(e) || e === null || e === !1, ru = {
1957
1957
  getAdapter: (e, t) => {
1958
1958
  e = _.isArray(e) ? e : [e];
1959
1959
  const { length: n } = e;
@@ -1962,7 +1962,7 @@ const ml = (e) => `- ${e}`, Fg = (e) => _.isFunction(e) || e === null || e === !
1962
1962
  for (let i = 0; i < n; i++) {
1963
1963
  r = e[i];
1964
1964
  let a;
1965
- if (o = r, !Fg(r) && (o = Ci[(a = String(r)).toLowerCase()], o === void 0))
1965
+ if (o = r, !$g(r) && (o = Ci[(a = String(r)).toLowerCase()], o === void 0))
1966
1966
  throw new je(`Unknown adapter '${a}'`);
1967
1967
  if (o && (_.isFunction(o) || (o = o.get(t))))
1968
1968
  break;
@@ -2034,7 +2034,7 @@ ls.transitional = function(t, n, r) {
2034
2034
  ls.spelling = function(t) {
2035
2035
  return (n, r) => (console.warn(`${r} is likely a misspelling of ${t}`), !0);
2036
2036
  };
2037
- function $g(e, t, n) {
2037
+ function Fg(e, t, n) {
2038
2038
  if (typeof e != "object")
2039
2039
  throw new je("options must be an object", je.ERR_BAD_OPTION_VALUE);
2040
2040
  const r = Object.keys(e);
@@ -2052,7 +2052,7 @@ function $g(e, t, n) {
2052
2052
  }
2053
2053
  }
2054
2054
  const Co = {
2055
- assertOptions: $g,
2055
+ assertOptions: Fg,
2056
2056
  validators: ls
2057
2057
  }, nn = Co.validators;
2058
2058
  let Un = class {
@@ -2365,8 +2365,8 @@ const {
2365
2365
  Cancel: MT,
2366
2366
  isAxiosError: DT,
2367
2367
  spread: LT,
2368
- toFormData: FT,
2369
- AxiosHeaders: $T,
2368
+ toFormData: $T,
2369
+ AxiosHeaders: FT,
2370
2370
  HttpStatusCode: zT,
2371
2371
  formToJSON: BT,
2372
2372
  getAdapter: HT,
@@ -2399,7 +2399,7 @@ Ut.interceptors.response.use(
2399
2399
  (e) => e,
2400
2400
  (e) => Promise.reject(e)
2401
2401
  );
2402
- async function $t(e, t) {
2402
+ async function Ft(e, t) {
2403
2403
  return Ut.defaults.baseURL ? (await Ut.get(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
2404
2404
  }
2405
2405
  async function yl(e, t, n) {
@@ -2435,7 +2435,7 @@ class qg {
2435
2435
  }
2436
2436
  // ---- Thread Management ----
2437
2437
  async listThreads() {
2438
- const t = await $t("/threads"), n = Nt(t);
2438
+ const t = await Ft("/threads"), n = Nt(t);
2439
2439
  return (n == null ? void 0 : n.items) ?? (t == null ? void 0 : t.items) ?? [];
2440
2440
  }
2441
2441
  async createThread(t) {
@@ -2451,25 +2451,25 @@ class qg {
2451
2451
  return Nt(n);
2452
2452
  }
2453
2453
  async threadInfo(t) {
2454
- const n = await $t(`/threads/${t}/info`);
2454
+ const n = await Ft(`/threads/${t}/info`);
2455
2455
  return Nt(n);
2456
2456
  }
2457
2457
  // ---- Agents ----
2458
2458
  async listAgents() {
2459
- const t = await $t("/agents"), n = Nt(t);
2459
+ const t = await Ft("/agents"), n = Nt(t);
2460
2460
  return (n == null ? void 0 : n.items) ?? [];
2461
2461
  }
2462
2462
  async getAgent(t) {
2463
- const n = await $t(`/agents/${t}`);
2463
+ const n = await Ft(`/agents/${t}`);
2464
2464
  return Nt(n);
2465
2465
  }
2466
2466
  async getAgentSchema(t) {
2467
- const n = await $t(`/agents/${t}/schema`);
2467
+ const n = await Ft(`/agents/${t}/schema`);
2468
2468
  return Nt(n);
2469
2469
  }
2470
2470
  // ---- Messages & State ----
2471
2471
  async getMessages(t) {
2472
- const n = await $t(`/threads/${t.threadId}/messages`, {
2472
+ const n = await Ft(`/threads/${t.threadId}/messages`, {
2473
2473
  params: {
2474
2474
  thread_id: t.threadId,
2475
2475
  checkpoint_id: t.checkpointId,
@@ -2481,7 +2481,7 @@ class qg {
2481
2481
  return Nt(n);
2482
2482
  }
2483
2483
  async getState(t) {
2484
- const n = await $t(`/threads/${t.threadId}/state`, {
2484
+ const n = await Ft(`/threads/${t.threadId}/state`, {
2485
2485
  params: {
2486
2486
  thread_id: t.threadId,
2487
2487
  checkpoint_id: t.checkpointId,
@@ -2491,7 +2491,7 @@ class qg {
2491
2491
  return Nt(n);
2492
2492
  }
2493
2493
  async getStateHistory(t) {
2494
- const n = await $t(`/threads/${t.threadId}/state/history`, {
2494
+ const n = await Ft(`/threads/${t.threadId}/state/history`, {
2495
2495
  params: {
2496
2496
  thread_id: t.threadId,
2497
2497
  checkpoint_id: t.checkpointId,
@@ -2502,7 +2502,7 @@ class qg {
2502
2502
  }
2503
2503
  // ---- Checkpoints ----
2504
2504
  async listCheckpoints(t) {
2505
- const n = await $t(`/threads/${t}/checkpoints`, {
2505
+ const n = await Ft(`/threads/${t}/checkpoints`, {
2506
2506
  params: { thread_id: t }
2507
2507
  });
2508
2508
  return Nt(n);
@@ -2844,35 +2844,28 @@ function ox(e, t) {
2844
2844
  const o = n[n.length - 1], s = r.text ?? "";
2845
2845
  if (!s) continue;
2846
2846
  if ((o == null ? void 0 : o.type) === "text") {
2847
- let i = function(h) {
2848
- return h.replace(/\s+/g, " ").trim();
2849
- };
2850
- const a = o, l = a.text ?? "";
2851
- if (console.debug("[MessageReducer] mergeParts", { incomingLength: s.length, previousLength: l.length, incomingSnippet: s.slice(0, 100), previousSnippet: l.slice(-100) }), !l) {
2852
- a.text = s;
2853
- continue;
2854
- }
2855
- const u = i(s), d = i(l);
2856
- if (u.startsWith(d) || s.startsWith(l)) {
2857
- console.debug("[MessageReducer] incoming startsWith previous (norm/raw) - replacing", { incomingLength: s.length, previousLength: l.length }), a.text = s;
2847
+ const i = o, a = i.text ?? "";
2848
+ if (console.debug("[MessageReducer] mergeParts", { incomingLength: s.length, previousLength: a.length, incomingSnippet: s.slice(0, 100), previousSnippet: a.slice(-100) }), !a) {
2849
+ i.text = s;
2858
2850
  continue;
2859
2851
  }
2860
- if (u.includes(d)) {
2861
- console.debug("[MessageReducer] incoming includes previous (normalized) - replacing", { incomingLength: s.length, previousLength: l.length }), a.text = s;
2852
+ if (s.startsWith(a)) {
2853
+ const u = s.slice(a.length);
2854
+ u ? (console.debug("[MessageReducer] incoming startsWith previous - appending suffix", { suffixLength: u.length }), i.text = s) : console.debug("[MessageReducer] incoming === previous - skipping duplicate");
2862
2855
  continue;
2863
2856
  }
2864
- if (d.includes(u)) {
2865
- console.debug("[MessageReducer] previous includes incoming (normalized) - skipping duplicate", { incomingLength: s.length, previousLength: l.length });
2857
+ if (a.endsWith(s)) {
2858
+ console.debug("[MessageReducer] previous endsWith incoming - skipping duplicate", { incomingLength: s.length, previousLength: a.length });
2866
2859
  continue;
2867
2860
  }
2868
- const f = sx(l, s);
2869
- if (f === null)
2870
- console.debug("[MessageReducer] no overlap detected - appending incoming", { incomingLength: s.length }), a.text = l + s;
2871
- else if (f === "") {
2872
- console.debug("[MessageReducer] empty suffix - perfect overlap, no change needed");
2861
+ const l = sx(a, s);
2862
+ if (l === null)
2863
+ console.debug("[MessageReducer] no overlap detected - appending incoming", { incomingLength: s.length }), i.text = a + s;
2864
+ else if (l === "") {
2865
+ console.debug("[MessageReducer] perfect overlap - no change needed");
2873
2866
  continue;
2874
2867
  } else
2875
- console.debug("[MessageReducer] suffix computed", { suffixLength: f.length }), a.text = l + f;
2868
+ console.debug("[MessageReducer] suffix computed", { suffixLength: l.length }), i.text = a + l;
2876
2869
  } else
2877
2870
  n.push({ type: "text", text: s });
2878
2871
  } else
@@ -2915,7 +2908,7 @@ function lx(e = {}) {
2915
2908
  S.current && (S.current.abort(), S.current = null), l(!0), d(null), e.autoAppendAssistant !== !1 && h("");
2916
2909
  const W = new AbortController();
2917
2910
  return S.current = W, (async () => {
2918
- var Y, K, J, z, F, $, B, pe;
2911
+ var Y, K, J, z, $, F, B, pe;
2919
2912
  const P = (ue) => {
2920
2913
  var ee;
2921
2914
  try {
@@ -2935,13 +2928,13 @@ function lx(e = {}) {
2935
2928
  ue = { Authorization: `Bearer ${r}` };
2936
2929
  else if (typeof window < "u") {
2937
2930
  const Pe = window.__AUTH_TOKEN__, et = ((Y = window.localStorage) == null ? void 0 : Y.getItem("authToken")) || null;
2938
- let $e = null;
2931
+ let Fe = null;
2939
2932
  try {
2940
2933
  const ft = (K = window.localStorage) == null ? void 0 : K.getItem("chat-settings");
2941
- ft && ($e = ((J = JSON.parse(ft)) == null ? void 0 : J.apiKey) || null);
2934
+ ft && (Fe = ((J = JSON.parse(ft)) == null ? void 0 : J.apiKey) || null);
2942
2935
  } catch {
2943
2936
  }
2944
- const it = Pe || et || $e || null;
2937
+ const it = Pe || et || Fe || null;
2945
2938
  it && (ue = { Authorization: `Bearer ${it}` });
2946
2939
  }
2947
2940
  } catch {
@@ -2987,17 +2980,17 @@ function lx(e = {}) {
2987
2980
  }, ie = () => {
2988
2981
  typeof window < "u" && q == null && (q = requestAnimationFrame(ce));
2989
2982
  };
2990
- let Fe = Date.now();
2983
+ let $e = Date.now();
2991
2984
  const Ke = setInterval(() => {
2992
2985
  var Te;
2993
- if (Date.now() - Fe > 6e4) {
2986
+ if (Date.now() - $e > 6e4) {
2994
2987
  const Pe = "Stream idle timeout";
2995
2988
  d(Pe), W.abort(), (Te = L == null ? void 0 : L.onError) == null || Te.call(L, Pe);
2996
2989
  }
2997
2990
  }, 5e3), We = 1024 * 1024;
2998
2991
  try {
2999
- const Te = ee.headers.get("X-Thread-Id") || ee.headers.get("x-thread-id"), Pe = ee.headers.get("X-Thread-Created") || ee.headers.get("x-thread-created"), et = Te ?? null, $e = String(Pe ?? "").toLowerCase() === "true";
3000
- for ((z = L == null ? void 0 : L.onOpen) == null || z.call(L, { threadId: et, created: $e }); ; ) {
2992
+ const Te = ee.headers.get("X-Thread-Id") || ee.headers.get("x-thread-id"), Pe = ee.headers.get("X-Thread-Created") || ee.headers.get("x-thread-created"), et = Te ?? null, Fe = String(Pe ?? "").toLowerCase() === "true";
2993
+ for ((z = L == null ? void 0 : L.onOpen) == null || z.call(L, { threadId: et, created: Fe }); ; ) {
3001
2994
  const { value: it, done: ft } = await Ie.read();
3002
2995
  if (ft) break;
3003
2996
  G += Ce.decode(it, { stream: !0 }), G.length > We && (G = "", console.warn("Stream buffer reset: exceeded 1MB"));
@@ -3017,14 +3010,14 @@ function lx(e = {}) {
3017
3010
  continue;
3018
3011
  }
3019
3012
  const he = cx(Ne) ? Ne.data : Ne;
3020
- Fe = Date.now();
3013
+ $e = Date.now();
3021
3014
  const me = he.seq;
3022
3015
  if (me !== void 0) {
3023
3016
  if (me <= Q) {
3024
3017
  console.debug("[use-chat] drop duplicate/out-of-order event", { seq: me, lastProcessedSeq: Q, type: he.type });
3025
3018
  continue;
3026
3019
  }
3027
- Q > 0 && me > Q + 1 && ((F = L == null ? void 0 : L.onGap) == null || F.call(L, { from: Q, to: me })), Q = me, C.current = me, g(me);
3020
+ Q > 0 && me > Q + 1 && (($ = L == null ? void 0 : L.onGap) == null || $.call(L, { from: Q, to: me })), Q = me, C.current = me, g(me);
3028
3021
  }
3029
3022
  if (console.debug("[use-chat] received event", { seq: he.seq, type: he.type, preview: (() => {
3030
3023
  var He;
@@ -3045,7 +3038,7 @@ function lx(e = {}) {
3045
3038
  } catch (Te) {
3046
3039
  if (Te.name !== "AbortError") {
3047
3040
  const Pe = Te.message || String(Te);
3048
- d(Pe), ($ = L == null ? void 0 : L.onError) == null || $.call(L, Pe);
3041
+ d(Pe), (F = L == null ? void 0 : L.onError) == null || F.call(L, Pe);
3049
3042
  }
3050
3043
  } finally {
3051
3044
  try {
@@ -3324,7 +3317,7 @@ function wx({
3324
3317
  Gs(f, (b = l.getAuthToken) == null ? void 0 : b.call(l))
3325
3318
  );
3326
3319
  return Ys(E);
3327
- }), k = at(() => Xs(C), [C]), [I, A] = xe(t), [j, D] = xe(!1), [L, W] = xe(!1), [P, Y] = xe(!1), [K, J] = xe(!1), [z, F] = xe(null), [$, B] = xe(void 0), [pe, ue] = xe(void 0), {
3320
+ }), k = at(() => Xs(C), [C]), [I, A] = xe(t), [j, D] = xe(!1), [L, W] = xe(!1), [P, Y] = xe(!1), [K, J] = xe(!1), [z, $] = xe(null), [F, B] = xe(void 0), [pe, ue] = xe(void 0), {
3328
3321
  state: ee,
3329
3322
  seed: Ie,
3330
3323
  prepend: Ce,
@@ -3335,7 +3328,7 @@ function wx({
3335
3328
  ct(() => {
3336
3329
  q.current = I;
3337
3330
  }, [I]);
3338
- const ce = Ge(!1), ie = Ge([]), Fe = Ge(null), Ke = Ge(null), We = Ge(/* @__PURE__ */ new Map()), Te = Ge(I), Pe = Ge(!1), et = Ge(null), $e = Me((E, b) => new Promise((N, M) => {
3331
+ const ce = Ge(!1), ie = Ge([]), $e = Ge(null), Ke = Ge(null), We = Ge(/* @__PURE__ */ new Map()), Te = Ge(I), Pe = Ge(!1), et = Ge(null), Fe = Me((E, b) => new Promise((N, M) => {
3339
3332
  const H = async () => {
3340
3333
  ce.current = !0;
3341
3334
  try {
@@ -3438,7 +3431,7 @@ function wx({
3438
3431
  };
3439
3432
  We.current.set(H, qe), Ce(M);
3440
3433
  } else b === "prepend" && M.length && Ce(M);
3441
- b === "replace" ? (F((E == null ? void 0 : E.nextCursor) ?? null), Y(!!(E != null && E.hasMore)), B((E == null ? void 0 : E.checkpointId) ?? void 0), ue((E == null ? void 0 : E.checkpointNs) ?? void 0)) : (F((X) => (E == null ? void 0 : E.nextCursor) ?? X ?? null), Y((X) => (E == null ? void 0 : E.hasMore) !== void 0 ? !!(E != null && E.hasMore) : X), B((X) => (E == null ? void 0 : E.checkpointId) ?? X ?? void 0), ue((X) => (E == null ? void 0 : E.checkpointNs) ?? X ?? void 0));
3434
+ b === "replace" ? ($((E == null ? void 0 : E.nextCursor) ?? null), Y(!!(E != null && E.hasMore)), B((E == null ? void 0 : E.checkpointId) ?? void 0), ue((E == null ? void 0 : E.checkpointNs) ?? void 0)) : ($((X) => (E == null ? void 0 : E.nextCursor) ?? X ?? null), Y((X) => (E == null ? void 0 : E.hasMore) !== void 0 ? !!(E != null && E.hasMore) : X), B((X) => (E == null ? void 0 : E.checkpointId) ?? X ?? void 0), ue((X) => (E == null ? void 0 : E.checkpointNs) ?? X ?? void 0));
3442
3435
  },
3443
3436
  [Ce, Ie]
3444
3437
  ), gt = Me(
@@ -3446,14 +3439,14 @@ function wx({
3446
3439
  Ie(E.messages, {
3447
3440
  checkpointId: E.checkpointId,
3448
3441
  checkpointNs: E.checkpointNs
3449
- }), F(E.nextCursor), Y(E.hasMore), B(E.checkpointId ?? void 0), ue(E.checkpointNs ?? void 0), Te.current = E.threadId;
3442
+ }), $(E.nextCursor), Y(E.hasMore), B(E.checkpointId ?? void 0), ue(E.checkpointNs ?? void 0), Te.current = E.threadId;
3450
3443
  },
3451
3444
  [Ie]
3452
3445
  ), It = Me((E) => {
3453
3446
  E && (We.current.delete(E), x(E), Te.current === E && (Te.current = null));
3454
3447
  }, [x]), Qt = Me(() => {
3455
3448
  const E = q.current;
3456
- E && It(E), Q([]), Y(!1), J(!1), F(null), B(void 0), ue(void 0);
3449
+ E && It(E), Q([]), Y(!1), J(!1), $(null), B(void 0), ue(void 0);
3457
3450
  }, [It, Q]), On = Me(({ from: E, to: b }) => {
3458
3451
  const N = q.current;
3459
3452
  N && console.warn(
@@ -3613,12 +3606,12 @@ function wx({
3613
3606
  [l, de]
3614
3607
  ), Dt = Me(
3615
3608
  async (E, b, N, M = !1) => {
3616
- await $e(async () => {
3609
+ await Fe(async () => {
3617
3610
  if (Ke.current === E && !M) {
3618
3611
  Ke.current = null;
3619
3612
  return;
3620
3613
  }
3621
- if (Fe.current === E && !M)
3614
+ if ($e.current === E && !M)
3622
3615
  return;
3623
3616
  A((ge) => ge === E ? ge : E), q.current = E;
3624
3617
  const H = !M && !b && !N;
@@ -3633,7 +3626,7 @@ function wx({
3633
3626
  }
3634
3627
  }
3635
3628
  const Se = M || !X || !!b || !!N, we = async (ge) => {
3636
- ge && W(!0), Fe.current = E;
3629
+ ge && W(!0), $e.current = E;
3637
3630
  try {
3638
3631
  const qe = await l.getMessages({
3639
3632
  threadId: E,
@@ -3644,7 +3637,7 @@ function wx({
3644
3637
  } catch (qe) {
3645
3638
  throw (!X || M || ge) && (i == null || i(String(qe))), qe;
3646
3639
  } finally {
3647
- Fe.current = null, ge && W(!1);
3640
+ $e.current = null, ge && W(!1);
3648
3641
  }
3649
3642
  };
3650
3643
  Se ? await we(!0) : H && X && we(!1).catch((ge) => {
@@ -3652,9 +3645,9 @@ function wx({
3652
3645
  });
3653
3646
  }, `loadThread-${E}`);
3654
3647
  },
3655
- [l, gt, ot, $e, i]
3648
+ [l, gt, ot, Fe, i]
3656
3649
  ), Ln = Me(async () => {
3657
- await $e(async () => {
3650
+ await Fe(async () => {
3658
3651
  const E = q.current;
3659
3652
  E && It(E), Ke.current = null, A(null), q.current = null, Te.current = null, Qt(), B(void 0), ue(void 0);
3660
3653
  try {
@@ -3663,7 +3656,7 @@ function wx({
3663
3656
  console.warn("[ChatSessionProvider] Failed to clear lastThreadId:", b);
3664
3657
  }
3665
3658
  }, "clearCurrentThread");
3666
- }, [Qt, It, $e]), ir = Me(
3659
+ }, [Qt, It, Fe]), ir = Me(
3667
3660
  async (E) => {
3668
3661
  const b = await l.listCheckpoints(E);
3669
3662
  return Yg(b, E);
@@ -3688,7 +3681,7 @@ function wx({
3688
3681
  try {
3689
3682
  const N = q.current, M = await l.getMessages({
3690
3683
  threadId: N,
3691
- checkpointId: $,
3684
+ checkpointId: F,
3692
3685
  checkpointNs: pe,
3693
3686
  limit: (E == null ? void 0 : E.limit) ?? hx,
3694
3687
  beforeId: b
@@ -3703,7 +3696,7 @@ function wx({
3703
3696
  l,
3704
3697
  ot,
3705
3698
  P,
3706
- $,
3699
+ F,
3707
3700
  pe,
3708
3701
  z,
3709
3702
  K
@@ -3744,7 +3737,7 @@ function wx({
3744
3737
  onError: (Lt) => {
3745
3738
  console.warn("[ChatSessionProvider] Stream error:", Lt);
3746
3739
  },
3747
- onOpen: ({ threadId: Lt, created: $s }) => {
3740
+ onOpen: ({ threadId: Lt, created: Fs }) => {
3748
3741
  !q.current && Lt && (ee.messages.length <= 1 && (Ke.current = Lt), A(Lt));
3749
3742
  },
3750
3743
  onGap: On
@@ -3858,7 +3851,7 @@ function wx({
3858
3851
  ve,
3859
3852
  k
3860
3853
  ]
3861
- ), Fn = at(
3854
+ ), $n = at(
3862
3855
  () => ({
3863
3856
  messages: ee.messages,
3864
3857
  assemblingId: ee.assemblingId,
@@ -3898,7 +3891,7 @@ function wx({
3898
3891
  Mn
3899
3892
  ]
3900
3893
  );
3901
- return /* @__PURE__ */ c.jsx(fx.Provider, { value: !0, children: /* @__PURE__ */ c.jsx(du.Provider, { value: ar, children: /* @__PURE__ */ c.jsx(cu.Provider, { value: Vt, children: /* @__PURE__ */ c.jsx(uu.Provider, { value: Fn, children: e }) }) }) });
3894
+ return /* @__PURE__ */ c.jsx(fx.Provider, { value: !0, children: /* @__PURE__ */ c.jsx(du.Provider, { value: ar, children: /* @__PURE__ */ c.jsx(cu.Provider, { value: Vt, children: /* @__PURE__ */ c.jsx(uu.Provider, { value: $n, children: e }) }) }) });
3902
3895
  }
3903
3896
  function ra() {
3904
3897
  const e = ts(cu);
@@ -4656,9 +4649,9 @@ const aa = Ve(
4656
4649
  { singleton: !0 }
4657
4650
  );
4658
4651
  function Ru(e, t, n) {
4659
- return e[Fo(e, t, n)];
4652
+ return e[$o(e, t, n)];
4660
4653
  }
4661
- function Fo(e, t, n, r = 0) {
4654
+ function $o(e, t, n, r = 0) {
4662
4655
  let o = e.length - 1;
4663
4656
  for (; r <= o; ) {
4664
4657
  const s = Math.floor((r + o) / 2), i = e[s], a = n(i, t);
@@ -4677,7 +4670,7 @@ function Fo(e, t, n, r = 0) {
4677
4670
  throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`);
4678
4671
  }
4679
4672
  function Lx(e, t, n, r) {
4680
- const o = Fo(e, t, r), s = Fo(e, n, r, o);
4673
+ const o = $o(e, t, r), s = $o(e, n, r, o);
4681
4674
  return e.slice(o, s + 1);
4682
4675
  }
4683
4676
  function Tn(e, t) {
@@ -4689,7 +4682,7 @@ function fs(e) {
4689
4682
  function la({ index: e }, t) {
4690
4683
  return t === e ? 0 : t < e ? -1 : 1;
4691
4684
  }
4692
- function Fx() {
4685
+ function $x() {
4693
4686
  return {
4694
4687
  groupIndices: [],
4695
4688
  groupOffsetTree: pr(),
@@ -4700,7 +4693,7 @@ function Fx() {
4700
4693
  sizeTree: pr()
4701
4694
  };
4702
4695
  }
4703
- function $x(e, t) {
4696
+ function Fx(e, t) {
4704
4697
  let n = Ze(e) ? 0 : 1 / 0;
4705
4698
  for (const r of t) {
4706
4699
  const { endIndex: o, size: s, startIndex: i } = r;
@@ -4758,7 +4751,7 @@ function Ux(e, [t, n, r, o]) {
4758
4751
  const h = t[0].size, p = t[1].size;
4759
4752
  i = n.reduce((w, v) => jt(jt(w, v, h), v + 1, p), i);
4760
4753
  } else
4761
- [i, a] = $x(i, t);
4754
+ [i, a] = Fx(i, t);
4762
4755
  if (i === s)
4763
4756
  return e;
4764
4757
  const { lastIndex: l, lastOffset: u, lastSize: d, offsetTree: f } = _i(e.offsetTree, a, i, o);
@@ -4787,7 +4780,7 @@ function Al(e, t) {
4787
4780
  function _i(e, t, n, r) {
4788
4781
  let o = e, s = 0, i = 0, a = 0, l = 0;
4789
4782
  if (t !== 0) {
4790
- l = Fo(o, t - 1, la), a = o[l].offset;
4783
+ l = $o(o, t - 1, la), a = o[l].offset;
4791
4784
  const u = Gt(n, t - 1);
4792
4785
  s = u[0], i = u[1], o.length && o[l].size === Gt(n, t)[1] && (l -= 1), o = o.slice(0, l + 1);
4793
4786
  } else
@@ -4819,7 +4812,7 @@ const qx = {
4819
4812
  offsetWidth: "width"
4820
4813
  }, dn = Ve(
4821
4814
  ([{ log: e }, { recalcInProgress: t }]) => {
4822
- const n = Be(), r = Be(), o = yt(r, 0), s = Be(), i = Be(), a = Z(0), l = Z([]), u = Z(void 0), d = Z(void 0), f = Z((C, T) => Tn(C, qx[T])), h = Z(void 0), p = Z(0), w = Fx(), v = yt(
4815
+ const n = Be(), r = Be(), o = yt(r, 0), s = Be(), i = Be(), a = Z(0), l = Z([]), u = Z(void 0), d = Z(void 0), f = Z((C, T) => Tn(C, qx[T])), h = Z(void 0), p = Z(0), w = $x(), v = yt(
4823
4816
  U(n, De(l, e, p), sn(Ux, w), nt()),
4824
4817
  w
4825
4818
  ), g = yt(
@@ -5141,9 +5134,9 @@ const no = Ve(
5141
5134
  W,
5142
5135
  P
5143
5136
  ]) => {
5144
- const Y = Nu(R), { align: K, behavior: J, offset: z } = Y, F = k - 1, $ = Eu(Y, C, F);
5145
- let B = Wr($, C.offsetTree, L) + A;
5146
- K === "end" ? (B += W + Gt(C.sizeTree, $)[1] - T + P, $ === F && (B += j)) : K === "center" ? B += (W + Gt(C.sizeTree, $)[1] - T + P) / 2 : B -= I, z && (B += z);
5137
+ const Y = Nu(R), { align: K, behavior: J, offset: z } = Y, $ = k - 1, F = Eu(Y, C, $);
5138
+ let B = Wr(F, C.offsetTree, L) + A;
5139
+ K === "end" ? (B += W + Gt(C.sizeTree, F)[1] - T + P, F === $ && (B += j)) : K === "center" ? B += (W + Gt(C.sizeTree, F)[1] - T + P) / 2 : B -= I, z && (B += z);
5147
5140
  const pe = (ue) => {
5148
5141
  S(), ue ? (D("retrying to scroll to", { location: R }, Et.DEBUG), _e(p, R)) : (_e(w, !0), D("list did not change, scroll successful", {}, Et.DEBUG));
5149
5142
  };
@@ -5158,7 +5151,7 @@ const no = Ve(
5158
5151
  g = qt(U(t, Xx(150)), pe);
5159
5152
  return x = setTimeout(() => {
5160
5153
  S();
5161
- }, 1200), _e(l, !0), D("scrolling from index to", { behavior: J, index: $, top: B }, Et.DEBUG), { behavior: J, top: B };
5154
+ }, 1200), _e(l, !0), D("scrolling from index to", { behavior: J, index: F, top: B }, Et.DEBUG), { behavior: J, top: B };
5162
5155
  }
5163
5156
  )
5164
5157
  ),
@@ -5379,9 +5372,9 @@ const Vr = "up", Mr = "down", Jx = "none", Zx = {
5379
5372
  scrollDirection: g,
5380
5373
  scrollVelocity: x
5381
5374
  };
5382
- }, rt(Ct)), $o = "top", zo = "bottom", jl = "none";
5375
+ }, rt(Ct)), Fo = "top", zo = "bottom", jl = "none";
5383
5376
  function _l(e, t, n) {
5384
- return typeof e == "number" ? n === Vr && t === $o || n === Mr && t === zo ? e : 0 : n === Vr ? t === $o ? e.main : e.reverse : t === zo ? e.main : e.reverse;
5377
+ return typeof e == "number" ? n === Vr && t === Fo || n === Mr && t === zo ? e : 0 : n === Vr ? t === Fo ? e.main : e.reverse : t === zo ? e.main : e.reverse;
5385
5378
  }
5386
5379
  function Pl(e, t) {
5387
5380
  var n;
@@ -5416,9 +5409,9 @@ const da = Ve(
5416
5409
  ]) => {
5417
5410
  const R = d - y, C = g + x, T = Math.max(h - R, 0);
5418
5411
  let k = jl;
5419
- const I = Pl(S, $o), A = Pl(S, zo);
5412
+ const I = Pl(S, Fo), A = Pl(S, zo);
5420
5413
  return p -= y, p += h + x, w += h + x, w -= y, p > d + C - I && (k = Vr), w < d - T + f + A && (k = Mr), k !== jl ? [
5421
- Math.max(R - h - _l(v, $o, k) - I, 0),
5414
+ Math.max(R - h - _l(v, Fo, k) - I, 0),
5422
5415
  R - T - x + f + _l(v, zo, k) + A
5423
5416
  ] : null;
5424
5417
  }
@@ -5571,13 +5564,13 @@ const er = Ve(
5571
5564
  P,
5572
5565
  Y
5573
5566
  ]) => {
5574
- const K = A, { offsetTree: J, sizeTree: z } = K, F = lt(g);
5567
+ const K = A, { offsetTree: J, sizeTree: z } = K, $ = lt(g);
5575
5568
  if (I === 0)
5576
5569
  return { ...Qs, totalCount: I };
5577
5570
  if (T === 0 && k === 0)
5578
- return F === 0 ? { ...Qs, totalCount: I } : ju(F, j, A, W, P, Y || []);
5571
+ return $ === 0 ? { ...Qs, totalCount: I } : ju($, j, A, W, P, Y || []);
5579
5572
  if (Ze(z))
5580
- return F > 0 ? null : ko(
5573
+ return $ > 0 ? null : ko(
5581
5574
  ev(ua(j, I), K, Y),
5582
5575
  [],
5583
5576
  I,
@@ -5585,18 +5578,18 @@ const er = Ve(
5585
5578
  K,
5586
5579
  W
5587
5580
  );
5588
- const $ = [];
5581
+ const F = [];
5589
5582
  if (L.length > 0) {
5590
5583
  const Ie = L[0], Ce = L[L.length - 1];
5591
5584
  let G = 0;
5592
5585
  for (const O of ds(z, Ie, Ce)) {
5593
5586
  const Q = O.value, q = Math.max(O.start, Ie), ce = Math.min(O.end, Ce);
5594
5587
  for (let ie = q; ie <= ce; ie++)
5595
- $.push({ data: Y == null ? void 0 : Y[ie], index: ie, offset: G, size: Q }), G += Q;
5588
+ F.push({ data: Y == null ? void 0 : Y[ie], index: ie, offset: G, size: Q }), G += Q;
5596
5589
  }
5597
5590
  }
5598
5591
  if (!D)
5599
- return ko([], $, I, P, K, W);
5592
+ return ko([], F, I, P, K, W);
5600
5593
  const B = L.length > 0 ? L[L.length - 1] + 1 : 0, pe = Hx(J, T, k, B);
5601
5594
  if (pe.length === 0)
5602
5595
  return null;
@@ -5616,7 +5609,7 @@ const er = Ve(
5616
5609
  Ie.push({ data: Y == null ? void 0 : Y[ie], index: ie, offset: O, size: q }), O += q + P;
5617
5610
  }
5618
5611
  });
5619
- return ko(ee, $, I, P, K, W);
5612
+ return ko(ee, F, I, P, K, W);
5620
5613
  }
5621
5614
  ),
5622
5615
  //@ts-expect-error filter needs to be fixed
@@ -6248,7 +6241,7 @@ function hv(e, t) {
6248
6241
  return n;
6249
6242
  }
6250
6243
  const uo = typeof document < "u" ? V.useLayoutEffect : V.useEffect;
6251
- function Fu(e, t, n) {
6244
+ function $u(e, t, n) {
6252
6245
  const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a = V.createContext({});
6253
6246
  function l(g, x) {
6254
6247
  g.propsReady && _e(g.propsReady, !1);
@@ -6324,7 +6317,7 @@ function Fu(e, t, n) {
6324
6317
  usePublisher: h
6325
6318
  };
6326
6319
  }
6327
- const $u = V.createContext(void 0), zu = V.createContext(void 0), Bu = typeof document < "u" ? V.useLayoutEffect : V.useEffect;
6320
+ const Fu = V.createContext(void 0), zu = V.createContext(void 0), Bu = typeof document < "u" ? V.useLayoutEffect : V.useEffect;
6328
6321
  function ei(e) {
6329
6322
  return "self" in e;
6330
6323
  }
@@ -6605,7 +6598,7 @@ function Vu({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
6605
6598
  });
6606
6599
  }
6607
6600
  const kv = ({ children: e }) => {
6608
- const t = V.useContext($u), n = zt("viewportHeight"), r = zt("fixedItemHeight"), o = Ae("alignToBottom"), s = Ae("horizontalDirection"), i = V.useMemo(
6601
+ const t = V.useContext(Fu), n = zt("viewportHeight"), r = zt("fixedItemHeight"), o = Ae("alignToBottom"), s = Ae("horizontalDirection"), i = V.useMemo(
6609
6602
  () => gu(n, (l) => Tn(l, s ? "width" : "height")),
6610
6603
  [n, s]
6611
6604
  ), a = Qn(i, !0, Ae("skipAnimationFrameInResizeObserver"));
@@ -6613,7 +6606,7 @@ const kv = ({ children: e }) => {
6613
6606
  t && (n(t.viewportHeight), r(t.itemHeight));
6614
6607
  }, [t, n, r]), /* @__PURE__ */ c.jsx("div", { "data-viewport-type": "element", ref: a, style: hs(o), children: e });
6615
6608
  }, Ev = ({ children: e }) => {
6616
- const t = V.useContext($u), n = zt("windowViewportRect"), r = zt("fixedItemHeight"), o = Ae("customScrollParent"), s = vu(
6609
+ const t = V.useContext(Fu), n = zt("windowViewportRect"), r = zt("fixedItemHeight"), o = Ae("customScrollParent"), s = vu(
6617
6610
  n,
6618
6611
  o,
6619
6612
  Ae("skipAnimationFrameInResizeObserver")
@@ -6639,7 +6632,7 @@ const kv = ({ children: e }) => {
6639
6632
  useEmitter: ma,
6640
6633
  useEmitterValue: Ae,
6641
6634
  usePublisher: zt
6642
- } = /* @__PURE__ */ Fu(
6635
+ } = /* @__PURE__ */ $u(
6643
6636
  gv,
6644
6637
  {
6645
6638
  required: {},
@@ -6736,7 +6729,7 @@ const kv = ({ children: e }) => {
6736
6729
  });
6737
6730
  rt(Lu, Ov);
6738
6731
  ha();
6739
- const Fl = {
6732
+ const $l = {
6740
6733
  bottom: 0,
6741
6734
  itemHeight: 0,
6742
6735
  items: [],
@@ -6752,7 +6745,7 @@ const Fl = {
6752
6745
  offsetBottom: 0,
6753
6746
  offsetTop: 0,
6754
6747
  top: 0
6755
- }, { ceil: $l, floor: Bo, max: Dr, min: ni, round: zl } = Math;
6748
+ }, { ceil: Fl, floor: Bo, max: Dr, min: ni, round: zl } = Math;
6756
6749
  function Bl(e, t, n) {
6757
6750
  return Array.from({ length: t - e + 1 }).map((r, o) => ({ data: n === null ? null : n[o + e], index: o + e }));
6758
6751
  }
@@ -6768,7 +6761,7 @@ function fo(e, t) {
6768
6761
  function Lv(e, t) {
6769
6762
  return e && e.column === t.column && e.row === t.row;
6770
6763
  }
6771
- const Fv = /* @__PURE__ */ Ve(
6764
+ const $v = /* @__PURE__ */ Ve(
6772
6765
  ([
6773
6766
  { increaseViewportBy: e, listBoundary: t, overscan: n, visibleRange: r },
6774
6767
  { footerHeight: o, headerHeight: s, scrollBy: i, scrollContainerState: a, scrollTo: l, scrollTop: u, smoothScrollTargetReached: d, viewportHeight: f },
@@ -6778,26 +6771,26 @@ const Fv = /* @__PURE__ */ Ve(
6778
6771
  { customScrollParent: g, useWindowScroll: x, windowScrollContainerState: y, windowScrollTo: S, windowViewportRect: R },
6779
6772
  C
6780
6773
  ]) => {
6781
- const T = Z(0), k = Z(0), I = Z(Fl), A = Z({ height: 0, width: 0 }), j = Z({ height: 0, width: 0 }), D = Be(), L = Be(), W = Z(0), P = Z(null), Y = Z({ column: 0, row: 0 }), K = Be(), J = Be(), z = Z(!1), F = Z(0), $ = Z(!0), B = Z(!1), pe = Z(!1);
6774
+ const T = Z(0), k = Z(0), I = Z($l), A = Z({ height: 0, width: 0 }), j = Z({ height: 0, width: 0 }), D = Be(), L = Be(), W = Z(0), P = Z(null), Y = Z({ column: 0, row: 0 }), K = Be(), J = Be(), z = Z(!1), $ = Z(0), F = Z(!0), B = Z(!1), pe = Z(!1);
6782
6775
  Ye(
6783
6776
  U(
6784
6777
  w,
6785
- De(F),
6778
+ De($),
6786
6779
  ke(([O, Q]) => !!Q)
6787
6780
  ),
6788
6781
  () => {
6789
- _e($, !1);
6782
+ _e(F, !1);
6790
6783
  }
6791
6784
  ), Ye(
6792
6785
  U(
6793
- dt(w, $, j, A, F, B),
6786
+ dt(w, F, j, A, $, B),
6794
6787
  ke(([O, Q, q, ce, , ie]) => O && !Q && q.height !== 0 && ce.height !== 0 && !ie)
6795
6788
  ),
6796
6789
  ([, , , , O]) => {
6797
6790
  _e(B, !0), ca(1, () => {
6798
6791
  _e(D, O);
6799
6792
  }), qt(U(u), () => {
6800
- _e(t, [0, 0]), _e($, !0);
6793
+ _e(t, [0, 0]), _e(F, !0);
6801
6794
  });
6802
6795
  }
6803
6796
  ), fe(
@@ -6851,8 +6844,8 @@ const Fv = /* @__PURE__ */ Ve(
6851
6844
  Re(P),
6852
6845
  Re(k),
6853
6846
  Re(z),
6854
- Re($),
6855
- Re(F)
6847
+ Re(F),
6848
+ Re($)
6856
6849
  ),
6857
6850
  ke(([, , , , , , , O]) => !O),
6858
6851
  oe(
@@ -6861,24 +6854,24 @@ const Fv = /* @__PURE__ */ Ve(
6861
6854
  [Q, q],
6862
6855
  ce,
6863
6856
  ie,
6864
- Fe,
6857
+ $e,
6865
6858
  Ke,
6866
6859
  We,
6867
6860
  ,
6868
6861
  Te,
6869
6862
  Pe
6870
6863
  ]) => {
6871
- const { column: et, row: $e } = ce, { height: it, width: ft } = ie, { width: ne } = Fe;
6864
+ const { column: et, row: Fe } = ce, { height: it, width: ft } = ie, { width: ne } = $e;
6872
6865
  if (We === 0 && (O === 0 || ne === 0))
6873
- return Fl;
6866
+ return $l;
6874
6867
  if (ft === 0) {
6875
6868
  const gt = ua(Pe, O), It = gt + Math.max(We - 1, 0);
6876
6869
  return Dv(Bl(gt, It, Ke));
6877
6870
  }
6878
6871
  const ae = Ku(ne, ft, et);
6879
6872
  let de, Ne;
6880
- Te ? Q === 0 && q === 0 && We > 0 ? (de = 0, Ne = We - 1) : (de = ae * Bo((Q + $e) / (it + $e)), Ne = ae * $l((q + $e) / (it + $e)) - 1, Ne = ni(O - 1, Dr(Ne, ae - 1)), de = ni(Ne, Dr(0, de))) : (de = 0, Ne = -1);
6881
- const he = Bl(de, Ne, Ke), { bottom: me, top: He } = Hl(Fe, ce, ie, he), Oe = $l(O / ae), ot = Oe * it + (Oe - 1) * $e - me;
6873
+ Te ? Q === 0 && q === 0 && We > 0 ? (de = 0, Ne = We - 1) : (de = ae * Bo((Q + Fe) / (it + Fe)), Ne = ae * Fl((q + Fe) / (it + Fe)) - 1, Ne = ni(O - 1, Dr(Ne, ae - 1)), de = ni(Ne, Dr(0, de))) : (de = 0, Ne = -1);
6874
+ const he = Bl(de, Ne, Ke), { bottom: me, top: He } = Hl($e, ce, ie, he), Oe = Fl(O / ae), ot = Oe * it + (Oe - 1) * Fe - me;
6882
6875
  return { bottom: me, itemHeight: it, items: he, itemWidth: ft, offsetBottom: ot, offsetTop: He, top: He };
6883
6876
  }
6884
6877
  )
@@ -6896,8 +6889,8 @@ const Fv = /* @__PURE__ */ Ve(
6896
6889
  dt(A, j, I, Y),
6897
6890
  ke(([O, Q, { items: q }]) => q.length > 0 && Q.height !== 0 && O.height !== 0),
6898
6891
  oe(([O, Q, { items: q }, ce]) => {
6899
- const { bottom: ie, top: Fe } = Hl(O, ce, Q, q);
6900
- return [Fe, ie];
6892
+ const { bottom: ie, top: $e } = Hl(O, ce, Q, q);
6893
+ return [$e, ie];
6901
6894
  }),
6902
6895
  nt(Ur)
6903
6896
  ),
@@ -6949,8 +6942,8 @@ const Fv = /* @__PURE__ */ Ve(
6949
6942
  D,
6950
6943
  De(A, j, T, Y),
6951
6944
  oe(([O, Q, q, ce, ie]) => {
6952
- const Fe = Nu(O), { align: Ke, behavior: We, offset: Te } = Fe;
6953
- let Pe = Fe.index;
6945
+ const $e = Nu(O), { align: Ke, behavior: We, offset: Te } = $e;
6946
+ let Pe = $e.index;
6954
6947
  Pe === "LAST" && (Pe = ce - 1), Pe = Dr(0, Pe, ni(ce - 1, Pe));
6955
6948
  let et = Pi(Q, ie, q, Pe);
6956
6949
  return Ke === "end" ? et = zl(et - Q.height + q.height) : Ke === "center" && (et = zl(et - Q.height / 2 + q.height / 2)), Te && (et += Te), { behavior: We, top: et };
@@ -7001,7 +6994,7 @@ const Fv = /* @__PURE__ */ Ve(
7001
6994
  // output
7002
6995
  gridState: I,
7003
6996
  horizontalDirection: pe,
7004
- initialTopMostItemIndex: F,
6997
+ initialTopMostItemIndex: $,
7005
6998
  totalListHeight: G,
7006
6999
  ...h,
7007
7000
  endReached: ee,
@@ -7029,7 +7022,7 @@ function Pi(e, t, n, r) {
7029
7022
  const o = Ku(e.width, n.width, t.column), s = Bo(r / o), i = s * n.height + Dr(0, s - 1) * t.row;
7030
7023
  return i > 0 ? i + t.row : i;
7031
7024
  }
7032
- const $v = /* @__PURE__ */ Ve(() => {
7025
+ const Fv = /* @__PURE__ */ Ve(() => {
7033
7026
  const e = Z((f) => `Item ${f}`), t = Z({}), n = Z(null), r = Z("virtuoso-grid-item"), o = Z("virtuoso-grid-list"), s = Z(pa), i = Z("div"), a = Z(Rr), l = (f, h = null) => yt(
7034
7027
  U(
7035
7028
  t,
@@ -7058,7 +7051,7 @@ const $v = /* @__PURE__ */ Ve(() => {
7058
7051
  };
7059
7052
  }), zv = /* @__PURE__ */ Ve(
7060
7053
  ([e, t]) => ({ ...e, ...t }),
7061
- rt(Fv, $v)
7054
+ rt($v, Fv)
7062
7055
  ), Bv = /* @__PURE__ */ V.memo(function() {
7063
7056
  const e = st("gridState"), t = st("listClassName"), n = st("itemClassName"), r = st("itemContent"), o = st("computeItemKey"), s = st("isSeeking"), i = Bt("scrollHeight"), a = st("ItemComponent"), l = st("ListComponent"), u = st("ScrollSeekPlaceholder"), d = st("context"), f = Bt("itemDimensions"), h = Bt("gap"), p = st("log"), w = st("stateRestoreInProgress"), v = Bt("reportReadyState"), g = Qn(
7064
7057
  V.useMemo(
@@ -7168,7 +7161,7 @@ const $v = /* @__PURE__ */ Ve(() => {
7168
7161
  useEmitter: qu,
7169
7162
  useEmitterValue: st,
7170
7163
  usePublisher: Bt
7171
- } = /* @__PURE__ */ Fu(
7164
+ } = /* @__PURE__ */ $u(
7172
7165
  zv,
7173
7166
  {
7174
7167
  optional: {
@@ -7590,7 +7583,7 @@ const Vl = dw, Kl = Ju, Lr = m.forwardRef(({ className: e, ...t }, n) => /* @__P
7590
7583
  }
7591
7584
  ));
7592
7585
  Lr.displayName = "Card";
7593
- const Fr = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7586
+ const $r = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7594
7587
  "div",
7595
7588
  {
7596
7589
  ref: n,
@@ -7598,8 +7591,8 @@ const Fr = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7598
7591
  ...t
7599
7592
  }
7600
7593
  ));
7601
- Fr.displayName = "CardHeader";
7602
- const $r = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7594
+ $r.displayName = "CardHeader";
7595
+ const Fr = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7603
7596
  "h3",
7604
7597
  {
7605
7598
  ref: n,
@@ -7610,7 +7603,7 @@ const $r = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7610
7603
  ...t
7611
7604
  }
7612
7605
  ));
7613
- $r.displayName = "CardTitle";
7606
+ Fr.displayName = "CardTitle";
7614
7607
  const Zu = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7615
7608
  "p",
7616
7609
  {
@@ -9205,7 +9198,7 @@ function Ql({
9205
9198
  );
9206
9199
  }
9207
9200
  async function ad(e, t) {
9208
- return await $t(e, {
9201
+ return await Ft(e, {
9209
9202
  responseType: "blob",
9210
9203
  onDownloadProgress: (r) => {
9211
9204
  try {
@@ -9224,7 +9217,7 @@ async function Nw(e, t) {
9224
9217
  const n = await ad(`/files/${e}/download`, t), r = URL.createObjectURL(n);
9225
9218
  let o = `file_${e}`;
9226
9219
  try {
9227
- const i = await $t(`/files/${e}`);
9220
+ const i = await Ft(`/files/${e}`);
9228
9221
  o = (i == null ? void 0 : i.filename) ?? o;
9229
9222
  } catch {
9230
9223
  }
@@ -9233,7 +9226,7 @@ async function Nw(e, t) {
9233
9226
  }
9234
9227
  async function Aw(e, t = 50, n = 0) {
9235
9228
  const r = { limit: t, offset: n };
9236
- return e && (r.thread_id = e), await $t("/files", { params: r });
9229
+ return e && (r.thread_id = e), await Ft("/files", { params: r });
9237
9230
  }
9238
9231
  const jw = 1, _w = 1e6;
9239
9232
  let ri = 0;
@@ -9344,7 +9337,7 @@ function Dw(e, t = globalThis == null ? void 0 : globalThis.document) {
9344
9337
  return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
9345
9338
  }, [n, t]);
9346
9339
  }
9347
- var Lw = "DismissableLayer", Mi = "dismissableLayer.update", Fw = "dismissableLayer.pointerDownOutside", $w = "dismissableLayer.focusOutside", nc, ld = m.createContext({
9340
+ var Lw = "DismissableLayer", Mi = "dismissableLayer.update", $w = "dismissableLayer.pointerDownOutside", Fw = "dismissableLayer.focusOutside", nc, ld = m.createContext({
9348
9341
  layers: /* @__PURE__ */ new Set(),
9349
9342
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
9350
9343
  branches: /* @__PURE__ */ new Set()
@@ -9416,7 +9409,7 @@ function Hw(e, t = globalThis == null ? void 0 : globalThis.document) {
9416
9409
  if (a.target && !r.current) {
9417
9410
  let l = function() {
9418
9411
  cd(
9419
- Fw,
9412
+ $w,
9420
9413
  n,
9421
9414
  u,
9422
9415
  { discrete: !0 }
@@ -9442,7 +9435,7 @@ function Uw(e, t = globalThis == null ? void 0 : globalThis.document) {
9442
9435
  const n = mt(e), r = m.useRef(!1);
9443
9436
  return m.useEffect(() => {
9444
9437
  const o = (s) => {
9445
- s.target && !r.current && cd($w, n, { originalEvent: s }, {
9438
+ s.target && !r.current && cd(Fw, n, { originalEvent: s }, {
9446
9439
  discrete: !1
9447
9440
  });
9448
9441
  };
@@ -10181,11 +10174,11 @@ var yd = "DialogTrigger", Sd = m.forwardRef(
10181
10174
  }
10182
10175
  );
10183
10176
  Sd.displayName = yd;
10184
- var Ra = "DialogPortal", [Fb, Cd] = wd(Ra, {
10177
+ var Ra = "DialogPortal", [$b, Cd] = wd(Ra, {
10185
10178
  forceMount: void 0
10186
10179
  }), Td = (e) => {
10187
10180
  const { __scopeDialog: t, forceMount: n, children: r, container: o } = e, s = Zt(Ra, t);
10188
- return /* @__PURE__ */ c.jsx(Fb, { scope: t, forceMount: n, children: m.Children.map(r, (i) => /* @__PURE__ */ c.jsx(Ot, { present: n || s.open, children: /* @__PURE__ */ c.jsx(xs, { asChild: !0, container: o, children: i }) })) });
10181
+ return /* @__PURE__ */ c.jsx($b, { scope: t, forceMount: n, children: m.Children.map(r, (i) => /* @__PURE__ */ c.jsx(Ot, { present: n || s.open, children: /* @__PURE__ */ c.jsx(xs, { asChild: !0, container: o, children: i }) })) });
10189
10182
  };
10190
10183
  Td.displayName = Ra;
10191
10184
  var Wo = "DialogOverlay", Rd = m.forwardRef(
@@ -10195,13 +10188,13 @@ var Wo = "DialogOverlay", Rd = m.forwardRef(
10195
10188
  }
10196
10189
  );
10197
10190
  Rd.displayName = Wo;
10198
- var $b = vr("DialogOverlay.RemoveScroll"), zb = m.forwardRef(
10191
+ var Fb = vr("DialogOverlay.RemoveScroll"), zb = m.forwardRef(
10199
10192
  (e, t) => {
10200
10193
  const { __scopeDialog: n, ...r } = e, o = Zt(Wo, n);
10201
10194
  return (
10202
10195
  // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
10203
10196
  // ie. when `Overlay` and `Content` are siblings
10204
- /* @__PURE__ */ c.jsx(ws, { as: $b, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ c.jsx(
10197
+ /* @__PURE__ */ c.jsx(ws, { as: Fb, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ c.jsx(
10205
10198
  Ee.div,
10206
10199
  {
10207
10200
  "data-state": Ea(o.open),
@@ -10356,7 +10349,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
10356
10349
  t && o && (document.getElementById(t) || console.warn(r));
10357
10350
  }, [r, e, t]), null;
10358
10351
  }, Md = bd, Kb = Sd, Dd = Td, ys = Rd, Ss = kd, Wn = Id, Cs = Ad, Ld = _d;
10359
- const qb = Md, Gb = Dd, Fd = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
10352
+ const qb = Md, Gb = Dd, $d = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
10360
10353
  ys,
10361
10354
  {
10362
10355
  ref: n,
@@ -10367,8 +10360,8 @@ const qb = Md, Gb = Dd, Fd = m.forwardRef(({ className: e, ...t }, n) => /* @__P
10367
10360
  ...t
10368
10361
  }
10369
10362
  ));
10370
- Fd.displayName = ys.displayName;
10371
- const $d = m.forwardRef(({ className: e, children: t, ...n }, r) => {
10363
+ $d.displayName = ys.displayName;
10364
+ const Fd = m.forwardRef(({ className: e, children: t, ...n }, r) => {
10372
10365
  const o = m.useMemo(() => {
10373
10366
  let s = !1;
10374
10367
  function i(a) {
@@ -10385,7 +10378,7 @@ const $d = m.forwardRef(({ className: e, children: t, ...n }, r) => {
10385
10378
  return i(t), s;
10386
10379
  }, [t]);
10387
10380
  return /* @__PURE__ */ c.jsxs(Gb, { children: [
10388
- /* @__PURE__ */ c.jsx(Fd, {}),
10381
+ /* @__PURE__ */ c.jsx($d, {}),
10389
10382
  /* @__PURE__ */ c.jsxs(
10390
10383
  Ss,
10391
10384
  {
@@ -10407,7 +10400,7 @@ const $d = m.forwardRef(({ className: e, children: t, ...n }, r) => {
10407
10400
  )
10408
10401
  ] });
10409
10402
  });
10410
- $d.displayName = Ss.displayName;
10403
+ Fd.displayName = Ss.displayName;
10411
10404
  const zd = ({
10412
10405
  className: e,
10413
10406
  ...t
@@ -10507,7 +10500,7 @@ function Xb({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
10507
10500
  ] }),
10508
10501
  /* @__PURE__ */ c.jsx("p", { className: "text-sm text-muted-foreground", children: "This file type cannot be previewed. Use download or external view." })
10509
10502
  ] }) : /* @__PURE__ */ c.jsx("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ c.jsx("p", { className: "text-muted-foreground", children: "No content to display" }) }), g = () => o.startsWith("image/") ? /* @__PURE__ */ c.jsx(Kp, { className: "h-5 w-5" }) : /* @__PURE__ */ c.jsx(Xa, { className: "h-5 w-5" });
10510
- return /* @__PURE__ */ c.jsx(qb, { open: e, onOpenChange: t, children: /* @__PURE__ */ c.jsxs($d, { className: "max-w-4xl max-h-[90vh] overflow-hidden", children: [
10503
+ return /* @__PURE__ */ c.jsx(qb, { open: e, onOpenChange: t, children: /* @__PURE__ */ c.jsxs(Fd, { className: "max-w-4xl max-h-[90vh] overflow-hidden", children: [
10511
10504
  /* @__PURE__ */ c.jsx(zd, { children: /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
10512
10505
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-3", children: [
10513
10506
  g(),
@@ -10658,7 +10651,7 @@ function Ud(e) {
10658
10651
  }
10659
10652
  return Object.values(n).some((i) => i.length > 0) ? n : null;
10660
10653
  }
10661
- const Po = "prose prose-sm max-w-none break-words dark:prose-invert prose-headings:break-words prose-p:break-words prose-li:break-words prose-td:break-words prose-th:break-words prose-a:break-all prose-code:break-words prose-blockquote:break-words", $n = 1e5;
10654
+ const Po = "prose prose-sm max-w-none break-words dark:prose-invert prose-headings:break-words prose-p:break-words prose-li:break-words prose-td:break-words prose-th:break-words prose-a:break-all prose-code:break-words prose-blockquote:break-words", Fn = 1e5;
10662
10655
  function Jb(e) {
10663
10656
  return e.filter((t) => t.type === "text").map((t) => t.text).join("");
10664
10657
  }
@@ -10681,7 +10674,7 @@ function Qb(e) {
10681
10674
  });
10682
10675
  }
10683
10676
  function ey(e) {
10684
- const t = (r, o = $n) => {
10677
+ const t = (r, o = Fn) => {
10685
10678
  try {
10686
10679
  const s = Kr(r), i = typeof s == "string" ? s : JSON.stringify(s ?? "");
10687
10680
  return i.length <= o ? i : i.slice(0, o) + `
@@ -10761,7 +10754,7 @@ const oy = V.memo(function({
10761
10754
  onCancelEdit: g,
10762
10755
  onCopy: x
10763
10756
  }) {
10764
- const [y, S] = xe(!1), [R, C] = xe("collapsed"), [T, k] = xe(!1), { currentThreadId: I } = ra(), { handleInterrupt: A } = hu(), { toast: j } = Sa(), [D, L] = xe({}), [W, P] = xe(!1), [Y, K] = xe(null), J = l === "phone" || l === "half-screen", z = t.role, F = z === "tool", $ = !(r && z !== "user"), B = V.useMemo(() => {
10757
+ const [y, S] = xe(!1), [R, C] = xe("collapsed"), [T, k] = xe(!1), { currentThreadId: I } = ra(), { handleInterrupt: A } = hu(), { toast: j } = Sa(), [D, L] = xe({}), [W, P] = xe(!1), [Y, K] = xe(null), J = l === "phone" || l === "half-screen", z = t.role, $ = z === "tool", F = !(r && z !== "user"), B = V.useMemo(() => {
10765
10758
  switch (z) {
10766
10759
  case "user":
10767
10760
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -10785,9 +10778,9 @@ const oy = V.memo(function({
10785
10778
  [t.content]
10786
10779
  ), G = at(() => ey(t.content), [t.content]);
10787
10780
  at(() => ty(t.content), [t.content]);
10788
- const O = at(() => G.length <= $n ? G : `${G.slice(0, $n)}
10789
- … [truncated ${G.length - $n} chars]`, [G]), Q = V.useCallback(async (ne = "all") => {
10790
- const de = ne === "visible" && F ? O : F ? G : pe;
10781
+ const O = at(() => G.length <= Fn ? G : `${G.slice(0, Fn)}
10782
+ … [truncated ${G.length - Fn} chars]`, [G]), Q = V.useCallback(async (ne = "all") => {
10783
+ const de = ne === "visible" && $ ? O : $ ? G : pe;
10791
10784
  async function Ne(he) {
10792
10785
  try {
10793
10786
  await navigator.clipboard.writeText(he);
@@ -10805,14 +10798,14 @@ const oy = V.memo(function({
10805
10798
  } catch (he) {
10806
10799
  console.error("Failed to copy:", he);
10807
10800
  }
10808
- }, [F, G, pe, O, x]), q = V.useCallback(() => {
10801
+ }, [$, G, pe, O, x]), q = V.useCallback(() => {
10809
10802
  if (!w) return;
10810
- const ne = F ? G : pe;
10803
+ const ne = $ ? G : pe;
10811
10804
  w(t.id, ne);
10812
- }, [w, t.id, F, G, pe]), ce = V.useCallback(() => {
10805
+ }, [w, t.id, $, G, pe]), ce = V.useCallback(() => {
10813
10806
  v == null || v(n);
10814
10807
  }, [v, n]), ie = V.useCallback(async (ne, ae, de) => {
10815
- if (!$) {
10808
+ if (!F) {
10816
10809
  ne.preventDefault();
10817
10810
  return;
10818
10811
  }
@@ -10860,7 +10853,7 @@ const oy = V.memo(function({
10860
10853
  } catch (Ne) {
10861
10854
  console.error("File click error:", Ne), L((he) => ({ ...he, [de]: !1 }));
10862
10855
  }
10863
- }, [$, D, j, I]), Fe = V.useCallback(() => {
10856
+ }, [F, D, j, I]), $e = V.useCallback(() => {
10864
10857
  const ae = te(J ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", B);
10865
10858
  switch (z) {
10866
10859
  case "user":
@@ -11008,28 +11001,28 @@ const oy = V.memo(function({
11008
11001
  h,
11009
11002
  T,
11010
11003
  J
11011
- ]), $e = V.useCallback(() => /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
11004
+ ]), Fe = V.useCallback(() => /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
11012
11005
  /* @__PURE__ */ c.jsx(gi, { className: "h-4 w-4 text-muted-foreground" }),
11013
11006
  /* @__PURE__ */ c.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
11014
11007
  ] }), []), it = V.useCallback(() => {
11015
11008
  const ne = pe.trim().length > 0 || ee.length > 0 || Ie.length > 0 || Ce.length > 0;
11016
- if (!F && !ne && !r)
11017
- return $e();
11009
+ if (!$ && !ne && !r)
11010
+ return Fe();
11018
11011
  if (t.model === "reflection") {
11019
11012
  const ae = pe.trim(), de = pc(ae);
11020
11013
  if (de && typeof de == "object")
11021
11014
  return /* @__PURE__ */ c.jsx(ly, { data: de });
11022
11015
  }
11023
- if (F && ue.name === "get_issues") {
11016
+ if ($ && ue.name === "get_issues") {
11024
11017
  const ae = t.content.find((he) => he.type === "tool_end"), de = (ae == null ? void 0 : ae.output) ?? G, Ne = Ud(de);
11025
11018
  if (Ne) return /* @__PURE__ */ c.jsx(cy, { issues: Ne });
11026
11019
  }
11027
- if (F) {
11020
+ if ($) {
11028
11021
  const ae = Qb(t.content);
11029
11022
  if (ae.length > 0)
11030
11023
  return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: ae.map((de, Ne) => {
11031
- const he = typeof de.output == "string" ? de.output : Li(de.output), me = he.length > $n ? `${he.slice(0, $n)}
11032
- … [truncated ${he.length - $n} chars]` : he, He = R === "expanded";
11024
+ const he = typeof de.output == "string" ? de.output : Li(de.output), me = he.length > Fn ? `${he.slice(0, Fn)}
11025
+ … [truncated ${he.length - Fn} chars]` : he, He = R === "expanded";
11033
11026
  return /* @__PURE__ */ c.jsxs(Vl, { open: He, onOpenChange: (Oe) => C(Oe ? "expanded" : "preview"), children: [
11034
11027
  /* @__PURE__ */ c.jsx("div", { className: "flex items-center gap-2 text-xs", children: /* @__PURE__ */ c.jsx(Oi, { variant: "outline", children: (de.name ?? "tool") + (de.toolCallId ? ` • ${de.toolCallId.slice(0, 8)}` : "") }) }),
11035
11028
  /* @__PURE__ */ c.jsx("div", { className: "font-mono text-sm mt-1", children: /* @__PURE__ */ c.jsx("pre", { className: "whitespace-pre-wrap break-words", children: He ? me : me.slice(0, d) + (me.length > d ? "..." : "") }) }),
@@ -11044,7 +11037,7 @@ const oy = V.memo(function({
11044
11037
  ] }, de.toolCallId ?? Ne);
11045
11038
  }) });
11046
11039
  }
11047
- if (!F) {
11040
+ if (!$) {
11048
11041
  const ae = /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: t.content.map((de, Ne) => /* @__PURE__ */ c.jsx(et, { part: de, i: Ne }, Ne)) });
11049
11042
  return r ? /* @__PURE__ */ c.jsxs("div", { "aria-busy": "true", role: "status", children: [
11050
11043
  ae,
@@ -11058,17 +11051,17 @@ const oy = V.memo(function({
11058
11051
  Ce.length,
11059
11052
  r,
11060
11053
  t.model,
11061
- F,
11054
+ $,
11062
11055
  ue.name,
11063
11056
  G,
11064
11057
  R,
11065
11058
  u,
11066
- $e,
11059
+ Fe,
11067
11060
  B
11068
11061
  ]), ft = at(() => ny(t), [t]);
11069
11062
  return /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
11070
11063
  /* @__PURE__ */ c.jsx("div", { className: te(Ke(), p.container), children: /* @__PURE__ */ c.jsxs("div", { className: te(We(), p.content), children: [
11071
- (i || a || F) && /* @__PURE__ */ c.jsxs(
11064
+ (i || a || $) && /* @__PURE__ */ c.jsxs(
11072
11065
  "div",
11073
11066
  {
11074
11067
  className: te(
@@ -11079,9 +11072,9 @@ const oy = V.memo(function({
11079
11072
  ),
11080
11073
  children: [
11081
11074
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", children: [
11082
- Fe(),
11075
+ $e(),
11083
11076
  a && ft && /* @__PURE__ */ c.jsx("span", { className: te("font-medium", J ? "text-xs" : "text-sm"), children: ft }),
11084
- F && ue.name && /* @__PURE__ */ c.jsxs(
11077
+ $ && ue.name && /* @__PURE__ */ c.jsxs(
11085
11078
  Oi,
11086
11079
  {
11087
11080
  variant: "outline",
@@ -11104,7 +11097,7 @@ const oy = V.memo(function({
11104
11097
  ]
11105
11098
  }
11106
11099
  ),
11107
- F && !ue.name && /* @__PURE__ */ c.jsx(
11100
+ $ && !ue.name && /* @__PURE__ */ c.jsx(
11108
11101
  Ue,
11109
11102
  {
11110
11103
  variant: "ghost",
@@ -11143,14 +11136,14 @@ const oy = V.memo(function({
11143
11136
  {
11144
11137
  variant: "ghost",
11145
11138
  size: "sm",
11146
- onClick: () => Q(F ? "visible" : "all"),
11139
+ onClick: () => Q($ ? "visible" : "all"),
11147
11140
  className: te("h-6 w-6 p-0 hover:bg-foreground/10", B, J && "h-5 w-5"),
11148
- "aria-label": F ? "Copy visible" : "Copy message",
11149
- title: F ? "Copy visible portion" : "Copy message",
11141
+ "aria-label": $ ? "Copy visible" : "Copy message",
11142
+ title: $ ? "Copy visible portion" : "Copy message",
11150
11143
  children: /* @__PURE__ */ c.jsx(Za, { className: te(y ? "text-success" : B, J ? "h-3 w-3" : "h-4 w-4") })
11151
11144
  }
11152
11145
  ),
11153
- F && /* @__PURE__ */ c.jsx(
11146
+ $ && /* @__PURE__ */ c.jsx(
11154
11147
  Ue,
11155
11148
  {
11156
11149
  variant: "ghost",
@@ -11193,7 +11186,7 @@ const oy = V.memo(function({
11193
11186
  }
11194
11187
  ),
11195
11188
  /* @__PURE__ */ c.jsx("div", { className: "relative", children: it() }),
11196
- F && R === "expanded" && (ue.toolCallId || ue.name) && /* @__PURE__ */ c.jsxs("div", { className: te("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", J && "text-xs"), children: [
11189
+ $ && R === "expanded" && (ue.toolCallId || ue.name) && /* @__PURE__ */ c.jsxs("div", { className: te("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", J && "text-xs"), children: [
11197
11190
  ue.name && /* @__PURE__ */ c.jsxs("div", { children: [
11198
11191
  "Function: ",
11199
11192
  ue.name
@@ -11203,7 +11196,7 @@ const oy = V.memo(function({
11203
11196
  ue.toolCallId
11204
11197
  ] })
11205
11198
  ] }),
11206
- !(i || a || F) && s && !o && /* @__PURE__ */ c.jsxs(
11199
+ !(i || a || $) && s && !o && /* @__PURE__ */ c.jsxs(
11207
11200
  "div",
11208
11201
  {
11209
11202
  className: te(
@@ -11326,8 +11319,8 @@ function ay({
11326
11319
  }) {
11327
11320
  const r = e.title ?? "Approve the result?";
11328
11321
  return /* @__PURE__ */ c.jsxs(Lr, { className: "border-blue-200 dark:border-blue-800 bg-blue-50/50 dark:bg-blue-950/10", children: [
11329
- /* @__PURE__ */ c.jsxs(Fr, { className: "pb-3", children: [
11330
- /* @__PURE__ */ c.jsx($r, { className: "text-blue-900 dark:text-blue-100 text-base", children: r }),
11322
+ /* @__PURE__ */ c.jsxs($r, { className: "pb-3", children: [
11323
+ /* @__PURE__ */ c.jsx(Fr, { className: "text-blue-900 dark:text-blue-100 text-base", children: r }),
11331
11324
  /* @__PURE__ */ c.jsx(Zu, { className: "text-blue-700 dark:text-blue-300", children: "Please approve or reject this action to continue." })
11332
11325
  ] }),
11333
11326
  /* @__PURE__ */ c.jsx(Qu, { className: "pt-0", children: /* @__PURE__ */ c.jsxs("div", { className: "flex gap-2 ml-auto", children: [
@@ -11578,7 +11571,7 @@ const py = ["top", "right", "bottom", "left"], En = Math.min, At = Math.max, Vo
11578
11571
  start: "end",
11579
11572
  end: "start"
11580
11573
  };
11581
- function Fi(e, t, n) {
11574
+ function $i(e, t, n) {
11582
11575
  return At(e, En(t, n));
11583
11576
  }
11584
11577
  function xn(e, t) {
@@ -11611,9 +11604,9 @@ function vy(e, t, n) {
11611
11604
  }
11612
11605
  function wy(e) {
11613
11606
  const t = Ko(e);
11614
- return [$i(e), t, $i(t)];
11607
+ return [Fi(e), t, Fi(t)];
11615
11608
  }
11616
- function $i(e) {
11609
+ function Fi(e) {
11617
11610
  return e.replace(/start|end/g, (t) => gy[t]);
11618
11611
  }
11619
11612
  const xc = ["left", "right"], vc = ["right", "left"], by = ["top", "bottom"], yy = ["bottom", "top"];
@@ -11632,7 +11625,7 @@ function Sy(e, t, n) {
11632
11625
  function Cy(e, t, n, r) {
11633
11626
  const o = kr(e);
11634
11627
  let s = Sy(vn(e), n === "start", r);
11635
- return o && (s = s.map((i) => i + "-" + o), t && (s = s.concat(s.map($i)))), s;
11628
+ return o && (s = s.map((i) => i + "-" + o), t && (s = s.concat(s.map(Fi)))), s;
11636
11629
  }
11637
11630
  function Ko(e) {
11638
11631
  return e.replace(/left|right|bottom|top/g, (t) => my[t]);
@@ -11850,7 +11843,7 @@ const ky = (e) => ({
11850
11843
  }, p = ja(o), w = Aa(p), v = await i.getDimensions(u), g = p === "y", x = g ? "top" : "left", y = g ? "bottom" : "right", S = g ? "clientHeight" : "clientWidth", R = s.reference[w] + s.reference[p] - h[p] - s.floating[w], C = h[p] - s.reference[p], T = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
11851
11844
  let k = T ? T[S] : 0;
11852
11845
  (!k || !await (i.isElement == null ? void 0 : i.isElement(T))) && (k = a.floating[S] || s.floating[w]);
11853
- const I = R / 2 - C / 2, A = k / 2 - v[w] / 2 - 1, j = En(f[x], A), D = En(f[y], A), L = j, W = k - v[w] - D, P = k / 2 - v[w] / 2 + I, Y = Fi(L, P, W), K = !l.arrow && kr(o) != null && P !== Y && s.reference[w] / 2 - (P < L ? j : D) - v[w] / 2 < 0, J = K ? P < L ? P - L : P - W : 0;
11846
+ const I = R / 2 - C / 2, A = k / 2 - v[w] / 2 - 1, j = En(f[x], A), D = En(f[y], A), L = j, W = k - v[w] - D, P = k / 2 - v[w] / 2 + I, Y = $i(L, P, W), K = !l.arrow && kr(o) != null && P !== Y && s.reference[w] / 2 - (P < L ? j : D) - v[w] / 2 < 0, J = K ? P < L ? P - L : P - W : 0;
11854
11847
  return {
11855
11848
  [p]: h[p] + J,
11856
11849
  data: {
@@ -11920,13 +11913,13 @@ const ky = (e) => ({
11920
11913
  var W;
11921
11914
  const J = (W = j.filter((z) => {
11922
11915
  if (T) {
11923
- const F = an(z.placement);
11924
- return F === y || // Create a bias to the `y` side axis due to horizontal
11916
+ const $ = an(z.placement);
11917
+ return $ === y || // Create a bias to the `y` side axis due to horizontal
11925
11918
  // reading directions favoring greater width.
11926
- F === "y";
11919
+ $ === "y";
11927
11920
  }
11928
11921
  return !0;
11929
- }).map((z) => [z.placement, z.overflows.filter((F) => F > 0).reduce((F, $) => F + $, 0)]).sort((z, F) => z[1] - F[1])[0]) == null ? void 0 : W[0];
11922
+ }).map((z) => [z.placement, z.overflows.filter(($) => $ > 0).reduce(($, F) => $ + F, 0)]).sort((z, $) => z[1] - $[1])[0]) == null ? void 0 : W[0];
11930
11923
  J && (K = J);
11931
11924
  break;
11932
11925
  }
@@ -12079,11 +12072,11 @@ const Ay = function(e) {
12079
12072
  let p = u[h], w = u[f];
12080
12073
  if (s) {
12081
12074
  const g = h === "y" ? "top" : "left", x = h === "y" ? "bottom" : "right", y = p + d[g], S = p - d[x];
12082
- p = Fi(y, p, S);
12075
+ p = $i(y, p, S);
12083
12076
  }
12084
12077
  if (i) {
12085
12078
  const g = f === "y" ? "top" : "left", x = f === "y" ? "bottom" : "right", y = w + d[g], S = w - d[x];
12086
- w = Fi(y, w, S);
12079
+ w = $i(y, w, S);
12087
12080
  }
12088
12081
  const v = a.fn({
12089
12082
  ...t,
@@ -12236,10 +12229,10 @@ function ks(e) {
12236
12229
  }
12237
12230
  });
12238
12231
  }
12239
- const Fy = ["transform", "translate", "scale", "rotate", "perspective"], $y = ["transform", "translate", "scale", "rotate", "perspective", "filter"], zy = ["paint", "layout", "strict", "content"];
12232
+ const $y = ["transform", "translate", "scale", "rotate", "perspective"], Fy = ["transform", "translate", "scale", "rotate", "perspective", "filter"], zy = ["paint", "layout", "strict", "content"];
12240
12233
  function _a(e) {
12241
12234
  const t = Pa(), n = Yt(e) ? Xt(e) : e;
12242
- return Fy.some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || $y.some((r) => (n.willChange || "").includes(r)) || zy.some((r) => (n.contain || "").includes(r));
12235
+ return $y.some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || Fy.some((r) => (n.willChange || "").includes(r)) || zy.some((r) => (n.contain || "").includes(r));
12243
12236
  }
12244
12237
  function By(e) {
12245
12238
  let t = In(e);
@@ -12766,17 +12759,17 @@ function m0(e) {
12766
12759
  strategy: n,
12767
12760
  middleware: h
12768
12761
  };
12769
- D.current && (z.platform = D.current), f0(T.current, k.current, z).then((F) => {
12770
- const $ = {
12771
- ...F,
12762
+ D.current && (z.platform = D.current), f0(T.current, k.current, z).then(($) => {
12763
+ const F = {
12764
+ ...$,
12772
12765
  // The floating element's position may be recomputed while it's closed
12773
12766
  // but still mounted (such as when transitioning out). To ensure
12774
12767
  // `isPositioned` will be `false` initially on the next open, avoid
12775
12768
  // setting it to `true` when `open === false` (must be specified).
12776
12769
  isPositioned: L.current !== !1
12777
12770
  };
12778
- P.current && !Go(I.current, $) && (I.current = $, rs.flushSync(() => {
12779
- f($);
12771
+ P.current && !Go(I.current, F) && (I.current = F, rs.flushSync(() => {
12772
+ f(F);
12780
12773
  }));
12781
12774
  });
12782
12775
  }, [h, t, n, D, L]);
@@ -12812,17 +12805,17 @@ function m0(e) {
12812
12805
  };
12813
12806
  if (!K.floating)
12814
12807
  return z;
12815
- const F = Ec(K.floating, d.x), $ = Ec(K.floating, d.y);
12808
+ const $ = Ec(K.floating, d.x), F = Ec(K.floating, d.y);
12816
12809
  return a ? {
12817
12810
  ...z,
12818
- transform: "translate(" + F + "px, " + $ + "px)",
12811
+ transform: "translate(" + $ + "px, " + F + "px)",
12819
12812
  ...tf(K.floating) >= 1.5 && {
12820
12813
  willChange: "transform"
12821
12814
  }
12822
12815
  } : {
12823
12816
  position: n,
12824
- left: F,
12825
- top: $
12817
+ left: $,
12818
+ top: F
12826
12819
  };
12827
12820
  }, [n, a, K.floating, d.x, d.y]);
12828
12821
  return m.useMemo(() => ({
@@ -12948,7 +12941,7 @@ var Da = "PopperContent", [E0, I0] = of(Da), uf = m.forwardRef(
12948
12941
  updatePositionStrategy: p = "optimized",
12949
12942
  onPlaced: w,
12950
12943
  ...v
12951
- } = e, g = sf(Da, n), [x, y] = m.useState(null), S = ze(t, (Fe) => y(Fe)), [R, C] = m.useState(null), T = rf(R), k = (T == null ? void 0 : T.width) ?? 0, I = (T == null ? void 0 : T.height) ?? 0, A = r + (s !== "center" ? "-" + s : ""), j = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, D = Array.isArray(u) ? u : [u], L = D.length > 0, W = {
12944
+ } = e, g = sf(Da, n), [x, y] = m.useState(null), S = ze(t, ($e) => y($e)), [R, C] = m.useState(null), T = rf(R), k = (T == null ? void 0 : T.width) ?? 0, I = (T == null ? void 0 : T.height) ?? 0, A = r + (s !== "center" ? "-" + s : ""), j = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, D = Array.isArray(u) ? u : [u], L = D.length > 0, W = {
12952
12945
  padding: j,
12953
12946
  boundary: D.filter(A0),
12954
12947
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
@@ -12957,7 +12950,7 @@ var Da = "PopperContent", [E0, I0] = of(Da), uf = m.forwardRef(
12957
12950
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
12958
12951
  strategy: "fixed",
12959
12952
  placement: A,
12960
- whileElementsMounted: (...Fe) => s0(...Fe, {
12953
+ whileElementsMounted: (...$e) => s0(...$e, {
12961
12954
  animationFrame: p === "always"
12962
12955
  }),
12963
12956
  elements: {
@@ -12974,16 +12967,16 @@ var Da = "PopperContent", [E0, I0] = of(Da), uf = m.forwardRef(
12974
12967
  l && b0({ ...W }),
12975
12968
  y0({
12976
12969
  ...W,
12977
- apply: ({ elements: Fe, rects: Ke, availableWidth: We, availableHeight: Te }) => {
12978
- const { width: Pe, height: et } = Ke.reference, $e = Fe.floating.style;
12979
- $e.setProperty("--radix-popper-available-width", `${We}px`), $e.setProperty("--radix-popper-available-height", `${Te}px`), $e.setProperty("--radix-popper-anchor-width", `${Pe}px`), $e.setProperty("--radix-popper-anchor-height", `${et}px`);
12970
+ apply: ({ elements: $e, rects: Ke, availableWidth: We, availableHeight: Te }) => {
12971
+ const { width: Pe, height: et } = Ke.reference, Fe = $e.floating.style;
12972
+ Fe.setProperty("--radix-popper-available-width", `${We}px`), Fe.setProperty("--radix-popper-available-height", `${Te}px`), Fe.setProperty("--radix-popper-anchor-width", `${Pe}px`), Fe.setProperty("--radix-popper-anchor-height", `${et}px`);
12980
12973
  }
12981
12974
  }),
12982
12975
  R && C0({ element: R, padding: a }),
12983
12976
  j0({ arrowWidth: k, arrowHeight: I }),
12984
12977
  h && S0({ strategy: "referenceHidden", ...W })
12985
12978
  ]
12986
- }), [F, $] = hf(K), B = mt(w);
12979
+ }), [$, F] = hf(K), B = mt(w);
12987
12980
  pt(() => {
12988
12981
  J && (B == null || B());
12989
12982
  }, [J, B]);
@@ -13018,7 +13011,7 @@ var Da = "PopperContent", [E0, I0] = of(Da), uf = m.forwardRef(
13018
13011
  E0,
13019
13012
  {
13020
13013
  scope: n,
13021
- placedSide: F,
13014
+ placedSide: $,
13022
13015
  onArrowChange: C,
13023
13016
  arrowX: pe,
13024
13017
  arrowY: ue,
@@ -13026,8 +13019,8 @@ var Da = "PopperContent", [E0, I0] = of(Da), uf = m.forwardRef(
13026
13019
  children: /* @__PURE__ */ c.jsx(
13027
13020
  Ee.div,
13028
13021
  {
13029
- "data-side": F,
13030
- "data-align": $,
13022
+ "data-side": $,
13023
+ "data-align": F,
13031
13024
  ...v,
13032
13025
  ref: S,
13033
13026
  style: {
@@ -13251,7 +13244,7 @@ var L0 = m.forwardRef((e, t) => {
13251
13244
  }
13252
13245
  );
13253
13246
  Sf.displayName = yf;
13254
- var F0 = {
13247
+ var $0 = {
13255
13248
  ArrowLeft: "prev",
13256
13249
  ArrowUp: "prev",
13257
13250
  ArrowRight: "next",
@@ -13261,13 +13254,13 @@ var F0 = {
13261
13254
  PageDown: "last",
13262
13255
  End: "last"
13263
13256
  };
13264
- function $0(e, t) {
13257
+ function F0(e, t) {
13265
13258
  return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
13266
13259
  }
13267
13260
  function z0(e, t, n) {
13268
- const r = $0(e.key, n);
13261
+ const r = F0(e.key, n);
13269
13262
  if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
13270
- return F0[r];
13263
+ return $0[r];
13271
13264
  }
13272
13265
  function Cf(e, t = !1) {
13273
13266
  const n = document.activeElement;
@@ -13326,14 +13319,14 @@ var Z0 = "MenuAnchor", La = m.forwardRef(
13326
13319
  }
13327
13320
  );
13328
13321
  La.displayName = Z0;
13329
- var Fa = "MenuPortal", [Q0, If] = nr(Fa, {
13322
+ var $a = "MenuPortal", [Q0, If] = nr($a, {
13330
13323
  forceMount: void 0
13331
13324
  }), Nf = (e) => {
13332
- const { __scopeMenu: t, forceMount: n, children: r, container: o } = e, s = rr(Fa, t);
13325
+ const { __scopeMenu: t, forceMount: n, children: r, container: o } = e, s = rr($a, t);
13333
13326
  return /* @__PURE__ */ c.jsx(Q0, { scope: t, forceMount: n, children: /* @__PURE__ */ c.jsx(Ot, { present: n || s.open, children: /* @__PURE__ */ c.jsx(xs, { asChild: !0, container: o, children: r }) }) });
13334
13327
  };
13335
- Nf.displayName = Fa;
13336
- var Ht = "MenuContent", [eS, $a] = nr(Ht), Af = m.forwardRef(
13328
+ Nf.displayName = $a;
13329
+ var Ht = "MenuContent", [eS, Fa] = nr(Ht), Af = m.forwardRef(
13337
13330
  (e, t) => {
13338
13331
  const n = If(Ht, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = rr(Ht, e.__scopeMenu), i = lo(Ht, e.__scopeMenu);
13339
13332
  return /* @__PURE__ */ c.jsx(Yr.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ c.jsx(Ot, { present: r || s.open, children: /* @__PURE__ */ c.jsx(Yr.Slot, { scope: e.__scopeMenu, children: i.modal ? /* @__PURE__ */ c.jsx(tS, { ...o, ref: t }) : /* @__PURE__ */ c.jsx(nS, { ...o, ref: t }) }) }) });
@@ -13391,17 +13384,17 @@ var Ht = "MenuContent", [eS, $a] = nr(Ht), Af = m.forwardRef(
13391
13384
  onDismiss: p,
13392
13385
  disableOutsideScroll: w,
13393
13386
  ...v
13394
- } = e, g = rr(Ht, n), x = lo(Ht, n), y = As(n), S = kf(n), R = G0(n), [C, T] = m.useState(null), k = m.useRef(null), I = ze(t, k, g.onContentChange), A = m.useRef(0), j = m.useRef(""), D = m.useRef(0), L = m.useRef(null), W = m.useRef("right"), P = m.useRef(0), Y = w ? ws : m.Fragment, K = w ? { as: rS, allowPinchZoom: !0 } : void 0, J = (F) => {
13387
+ } = e, g = rr(Ht, n), x = lo(Ht, n), y = As(n), S = kf(n), R = G0(n), [C, T] = m.useState(null), k = m.useRef(null), I = ze(t, k, g.onContentChange), A = m.useRef(0), j = m.useRef(""), D = m.useRef(0), L = m.useRef(null), W = m.useRef("right"), P = m.useRef(0), Y = w ? ws : m.Fragment, K = w ? { as: rS, allowPinchZoom: !0 } : void 0, J = ($) => {
13395
13388
  var G, O;
13396
- const $ = j.current + F, B = R().filter((Q) => !Q.disabled), pe = document.activeElement, ue = (G = B.find((Q) => Q.ref.current === pe)) == null ? void 0 : G.textValue, ee = B.map((Q) => Q.textValue), Ie = mS(ee, $, ue), Ce = (O = B.find((Q) => Q.textValue === Ie)) == null ? void 0 : O.ref.current;
13389
+ const F = j.current + $, B = R().filter((Q) => !Q.disabled), pe = document.activeElement, ue = (G = B.find((Q) => Q.ref.current === pe)) == null ? void 0 : G.textValue, ee = B.map((Q) => Q.textValue), Ie = mS(ee, F, ue), Ce = (O = B.find((Q) => Q.textValue === Ie)) == null ? void 0 : O.ref.current;
13397
13390
  (function Q(q) {
13398
13391
  j.current = q, window.clearTimeout(A.current), q !== "" && (A.current = window.setTimeout(() => Q(""), 1e3));
13399
- })($), Ce && setTimeout(() => Ce.focus());
13392
+ })(F), Ce && setTimeout(() => Ce.focus());
13400
13393
  };
13401
13394
  m.useEffect(() => () => window.clearTimeout(A.current), []), Ca();
13402
- const z = m.useCallback((F) => {
13395
+ const z = m.useCallback(($) => {
13403
13396
  var B, pe;
13404
- return W.current === ((B = L.current) == null ? void 0 : B.side) && xS(F, (pe = L.current) == null ? void 0 : pe.area);
13397
+ return W.current === ((B = L.current) == null ? void 0 : B.side) && xS($, (pe = L.current) == null ? void 0 : pe.area);
13405
13398
  }, []);
13406
13399
  return /* @__PURE__ */ c.jsx(
13407
13400
  eS,
@@ -13409,36 +13402,36 @@ var Ht = "MenuContent", [eS, $a] = nr(Ht), Af = m.forwardRef(
13409
13402
  scope: n,
13410
13403
  searchRef: j,
13411
13404
  onItemEnter: m.useCallback(
13412
- (F) => {
13413
- z(F) && F.preventDefault();
13405
+ ($) => {
13406
+ z($) && $.preventDefault();
13414
13407
  },
13415
13408
  [z]
13416
13409
  ),
13417
13410
  onItemLeave: m.useCallback(
13418
- (F) => {
13419
- var $;
13420
- z(F) || (($ = k.current) == null || $.focus(), T(null));
13411
+ ($) => {
13412
+ var F;
13413
+ z($) || ((F = k.current) == null || F.focus(), T(null));
13421
13414
  },
13422
13415
  [z]
13423
13416
  ),
13424
13417
  onTriggerLeave: m.useCallback(
13425
- (F) => {
13426
- z(F) && F.preventDefault();
13418
+ ($) => {
13419
+ z($) && $.preventDefault();
13427
13420
  },
13428
13421
  [z]
13429
13422
  ),
13430
13423
  pointerGraceTimerRef: D,
13431
- onPointerGraceIntentChange: m.useCallback((F) => {
13432
- L.current = F;
13424
+ onPointerGraceIntentChange: m.useCallback(($) => {
13425
+ L.current = $;
13433
13426
  }, []),
13434
13427
  children: /* @__PURE__ */ c.jsx(Y, { ...K, children: /* @__PURE__ */ c.jsx(
13435
13428
  gs,
13436
13429
  {
13437
13430
  asChild: !0,
13438
13431
  trapped: o,
13439
- onMountAutoFocus: le(s, (F) => {
13440
- var $;
13441
- F.preventDefault(), ($ = k.current) == null || $.focus({ preventScroll: !0 });
13432
+ onMountAutoFocus: le(s, ($) => {
13433
+ var F;
13434
+ $.preventDefault(), (F = k.current) == null || F.focus({ preventScroll: !0 });
13442
13435
  }),
13443
13436
  onUnmountAutoFocus: i,
13444
13437
  children: /* @__PURE__ */ c.jsx(
@@ -13461,8 +13454,8 @@ var Ht = "MenuContent", [eS, $a] = nr(Ht), Af = m.forwardRef(
13461
13454
  loop: r,
13462
13455
  currentTabStopId: C,
13463
13456
  onCurrentTabStopIdChange: T,
13464
- onEntryFocus: le(l, (F) => {
13465
- x.isUsingKeyboardRef.current || F.preventDefault();
13457
+ onEntryFocus: le(l, ($) => {
13458
+ x.isUsingKeyboardRef.current || $.preventDefault();
13466
13459
  }),
13467
13460
  preventScrollOnEntryFocus: !0,
13468
13461
  children: /* @__PURE__ */ c.jsx(
@@ -13477,25 +13470,25 @@ var Ht = "MenuContent", [eS, $a] = nr(Ht), Af = m.forwardRef(
13477
13470
  ...v,
13478
13471
  ref: I,
13479
13472
  style: { outline: "none", ...v.style },
13480
- onKeyDown: le(v.onKeyDown, (F) => {
13481
- const B = F.target.closest("[data-radix-menu-content]") === F.currentTarget, pe = F.ctrlKey || F.altKey || F.metaKey, ue = F.key.length === 1;
13482
- B && (F.key === "Tab" && F.preventDefault(), !pe && ue && J(F.key));
13473
+ onKeyDown: le(v.onKeyDown, ($) => {
13474
+ const B = $.target.closest("[data-radix-menu-content]") === $.currentTarget, pe = $.ctrlKey || $.altKey || $.metaKey, ue = $.key.length === 1;
13475
+ B && ($.key === "Tab" && $.preventDefault(), !pe && ue && J($.key));
13483
13476
  const ee = k.current;
13484
- if (F.target !== ee || !V0.includes(F.key)) return;
13485
- F.preventDefault();
13477
+ if ($.target !== ee || !V0.includes($.key)) return;
13478
+ $.preventDefault();
13486
13479
  const Ce = R().filter((G) => !G.disabled).map((G) => G.ref.current);
13487
- Tf.includes(F.key) && Ce.reverse(), hS(Ce);
13480
+ Tf.includes($.key) && Ce.reverse(), hS(Ce);
13488
13481
  }),
13489
- onBlur: le(e.onBlur, (F) => {
13490
- F.currentTarget.contains(F.target) || (window.clearTimeout(A.current), j.current = "");
13482
+ onBlur: le(e.onBlur, ($) => {
13483
+ $.currentTarget.contains($.target) || (window.clearTimeout(A.current), j.current = "");
13491
13484
  }),
13492
13485
  onPointerMove: le(
13493
13486
  e.onPointerMove,
13494
- Xr((F) => {
13495
- const $ = F.target, B = P.current !== F.clientX;
13496
- if (F.currentTarget.contains($) && B) {
13497
- const pe = F.clientX > P.current ? "right" : "left";
13498
- W.current = pe, P.current = F.clientX;
13487
+ Xr(($) => {
13488
+ const F = $.target, B = P.current !== $.clientX;
13489
+ if ($.currentTarget.contains(F) && B) {
13490
+ const pe = $.clientX > P.current ? "right" : "left";
13491
+ W.current = pe, P.current = $.clientX;
13499
13492
  }
13500
13493
  })
13501
13494
  )
@@ -13528,7 +13521,7 @@ var sS = "MenuLabel", jf = m.forwardRef(
13528
13521
  jf.displayName = sS;
13529
13522
  var Yo = "MenuItem", Ic = "menu.itemSelect", js = m.forwardRef(
13530
13523
  (e, t) => {
13531
- const { disabled: n = !1, onSelect: r, ...o } = e, s = m.useRef(null), i = lo(Yo, e.__scopeMenu), a = $a(Yo, e.__scopeMenu), l = ze(t, s), u = m.useRef(!1), d = () => {
13524
+ const { disabled: n = !1, onSelect: r, ...o } = e, s = m.useRef(null), i = lo(Yo, e.__scopeMenu), a = Fa(Yo, e.__scopeMenu), l = ze(t, s), u = m.useRef(!1), d = () => {
13532
13525
  const f = s.current;
13533
13526
  if (!n && f) {
13534
13527
  const h = new CustomEvent(Ic, { bubbles: !0, cancelable: !0 });
@@ -13561,7 +13554,7 @@ var Yo = "MenuItem", Ic = "menu.itemSelect", js = m.forwardRef(
13561
13554
  js.displayName = Yo;
13562
13555
  var _f = m.forwardRef(
13563
13556
  (e, t) => {
13564
- const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, i = $a(Yo, n), a = kf(n), l = m.useRef(null), u = ze(t, l), [d, f] = m.useState(!1), [h, p] = m.useState("");
13557
+ const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, i = Fa(Yo, n), a = kf(n), l = m.useRef(null), u = ze(t, l), [d, f] = m.useState(!1), [h, p] = m.useState("");
13565
13558
  return m.useEffect(() => {
13566
13559
  const w = l.current;
13567
13560
  w && p((w.textContent ?? "").trim());
@@ -13600,7 +13593,7 @@ var _f = m.forwardRef(
13600
13593
  ), iS = "MenuCheckboxItem", Pf = m.forwardRef(
13601
13594
  (e, t) => {
13602
13595
  const { checked: n = !1, onCheckedChange: r, ...o } = e;
13603
- return /* @__PURE__ */ c.jsx(Ff, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ c.jsx(
13596
+ return /* @__PURE__ */ c.jsx($f, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ c.jsx(
13604
13597
  js,
13605
13598
  {
13606
13599
  role: "menuitemcheckbox",
@@ -13632,7 +13625,7 @@ Mf.displayName = Of;
13632
13625
  var Df = "MenuRadioItem", Lf = m.forwardRef(
13633
13626
  (e, t) => {
13634
13627
  const { value: n, ...r } = e, o = lS(Df, e.__scopeMenu), s = n === o.value;
13635
- return /* @__PURE__ */ c.jsx(Ff, { scope: e.__scopeMenu, checked: s, children: /* @__PURE__ */ c.jsx(
13628
+ return /* @__PURE__ */ c.jsx($f, { scope: e.__scopeMenu, checked: s, children: /* @__PURE__ */ c.jsx(
13636
13629
  js,
13637
13630
  {
13638
13631
  role: "menuitemradio",
@@ -13653,10 +13646,10 @@ var Df = "MenuRadioItem", Lf = m.forwardRef(
13653
13646
  }
13654
13647
  );
13655
13648
  Lf.displayName = Df;
13656
- var Ha = "MenuItemIndicator", [Ff, cS] = nr(
13649
+ var Ha = "MenuItemIndicator", [$f, cS] = nr(
13657
13650
  Ha,
13658
13651
  { checked: !1 }
13659
- ), $f = m.forwardRef(
13652
+ ), Ff = m.forwardRef(
13660
13653
  (e, t) => {
13661
13654
  const { __scopeMenu: n, forceMount: r, ...o } = e, s = cS(Ha, n);
13662
13655
  return /* @__PURE__ */ c.jsx(
@@ -13675,7 +13668,7 @@ var Ha = "MenuItemIndicator", [Ff, cS] = nr(
13675
13668
  );
13676
13669
  }
13677
13670
  );
13678
- $f.displayName = Ha;
13671
+ Ff.displayName = Ha;
13679
13672
  var uS = "MenuSeparator", zf = m.forwardRef(
13680
13673
  (e, t) => {
13681
13674
  const { __scopeMenu: n, ...r } = e;
@@ -13700,7 +13693,7 @@ var dS = "MenuArrow", Bf = m.forwardRef(
13700
13693
  Bf.displayName = dS;
13701
13694
  var fS = "MenuSub", [qT, Hf] = nr(fS), Pr = "MenuSubTrigger", Uf = m.forwardRef(
13702
13695
  (e, t) => {
13703
- const n = rr(Pr, e.__scopeMenu), r = lo(Pr, e.__scopeMenu), o = Hf(Pr, e.__scopeMenu), s = $a(Pr, e.__scopeMenu), i = m.useRef(null), { pointerGraceTimerRef: a, onPointerGraceIntentChange: l } = s, u = { __scopeMenu: e.__scopeMenu }, d = m.useCallback(() => {
13696
+ const n = rr(Pr, e.__scopeMenu), r = lo(Pr, e.__scopeMenu), o = Hf(Pr, e.__scopeMenu), s = Fa(Pr, e.__scopeMenu), i = m.useRef(null), { pointerGraceTimerRef: a, onPointerGraceIntentChange: l } = s, u = { __scopeMenu: e.__scopeMenu }, d = m.useCallback(() => {
13704
13697
  i.current && window.clearTimeout(i.current), i.current = null;
13705
13698
  }, []);
13706
13699
  return m.useEffect(() => d, [d]), m.useEffect(() => {
@@ -13848,7 +13841,7 @@ function xS(e, t) {
13848
13841
  function Xr(e) {
13849
13842
  return (t) => t.pointerType === "mouse" ? e(t) : void 0;
13850
13843
  }
13851
- var vS = Ef, wS = La, bS = Nf, yS = Af, SS = Ba, CS = jf, TS = js, RS = Pf, kS = Mf, ES = Lf, IS = $f, NS = zf, AS = Bf, jS = Uf, _S = Vf, _s = "DropdownMenu", [PS, GT] = fn(
13844
+ var vS = Ef, wS = La, bS = Nf, yS = Af, SS = Ba, CS = jf, TS = js, RS = Pf, kS = Mf, ES = Lf, IS = Ff, NS = zf, AS = Bf, jS = Uf, _S = Vf, _s = "DropdownMenu", [PS, GT] = fn(
13852
13845
  _s,
13853
13846
  [Rf]
13854
13847
  ), Tt = Rf(), [OS, qf] = PS(_s), Gf = (e) => {
@@ -13953,20 +13946,20 @@ var DS = "DropdownMenuGroup", LS = m.forwardRef(
13953
13946
  }
13954
13947
  );
13955
13948
  LS.displayName = DS;
13956
- var FS = "DropdownMenuLabel", eh = m.forwardRef(
13949
+ var $S = "DropdownMenuLabel", eh = m.forwardRef(
13957
13950
  (e, t) => {
13958
13951
  const { __scopeDropdownMenu: n, ...r } = e, o = Tt(n);
13959
13952
  return /* @__PURE__ */ c.jsx(CS, { ...o, ...r, ref: t });
13960
13953
  }
13961
13954
  );
13962
- eh.displayName = FS;
13963
- var $S = "DropdownMenuItem", th = m.forwardRef(
13955
+ eh.displayName = $S;
13956
+ var FS = "DropdownMenuItem", th = m.forwardRef(
13964
13957
  (e, t) => {
13965
13958
  const { __scopeDropdownMenu: n, ...r } = e, o = Tt(n);
13966
13959
  return /* @__PURE__ */ c.jsx(TS, { ...o, ...r, ref: t });
13967
13960
  }
13968
13961
  );
13969
- th.displayName = $S;
13962
+ th.displayName = FS;
13970
13963
  var zS = "DropdownMenuCheckboxItem", nh = m.forwardRef((e, t) => {
13971
13964
  const { __scopeDropdownMenu: n, ...r } = e, o = Tt(n);
13972
13965
  return /* @__PURE__ */ c.jsx(RS, { ...o, ...r, ref: t });
@@ -14170,7 +14163,7 @@ function mi({
14170
14163
  streamingAssistantId: L,
14171
14164
  lastCheckpointId: W,
14172
14165
  lastCheckpointNs: P
14173
- } = bx(), [Y, K] = xe(null), [J, z] = xe(""), [F, $] = xe(null), [B, pe] = xe([]), [ue, ee] = xe(0), [Ie, Ce] = xe(0), [G, O] = xe(!1), [Q, q] = xe(null), [ce, ie] = xe(null), [Fe, Ke] = xe(!1), [We, Te] = xe(null), [Pe, et] = xe([]), [$e, it] = xe(null), [ft, ne] = xe(null), [ae, de] = xe(!1), Ne = Ge(null), he = Ge(null), me = Ge(null), He = Me(() => {
14166
+ } = bx(), [Y, K] = xe(null), [J, z] = xe(""), [$, F] = xe(null), [B, pe] = xe([]), [ue, ee] = xe(0), [Ie, Ce] = xe(0), [G, O] = xe(!1), [Q, q] = xe(null), [ce, ie] = xe(null), [$e, Ke] = xe(!1), [We, Te] = xe(null), [Pe, et] = xe([]), [Fe, it] = xe(null), [ft, ne] = xe(null), [ae, de] = xe(!1), Ne = Ge(null), he = Ge(null), me = Ge(null), He = Me(() => {
14174
14167
  Ne.current && (Ne.current.value = ""), he.current && (he.current.value = ""), ee((re) => re + 1), Ce((re) => re + 1);
14175
14168
  }, []), Oe = Ge(!1);
14176
14169
  ct(() => {
@@ -14200,19 +14193,19 @@ function mi({
14200
14193
  if (re) return;
14201
14194
  const xt = ((Xe == null ? void 0 : Xe.checkpoints) ?? []).slice().sort((b, N) => new Date(N.createdAt).getTime() - new Date(b.createdAt).getTime());
14202
14195
  et(xt);
14203
- const Vt = $e, Fn = Vt && xt.some((b) => b.checkpointId === Vt) ? Vt : ((E = xt[0]) == null ? void 0 : E.checkpointId) ?? null;
14196
+ const Vt = Fe, $n = Vt && xt.some((b) => b.checkpointId === Vt) ? Vt : ((E = xt[0]) == null ? void 0 : E.checkpointId) ?? null;
14204
14197
  let ar = null;
14205
- if (Fn) {
14206
- const b = xt.find((N) => N.checkpointId === Fn);
14198
+ if ($n) {
14199
+ const b = xt.find((N) => N.checkpointId === $n);
14207
14200
  ar = (b == null ? void 0 : b.checkpointNs) ?? null;
14208
14201
  }
14209
- it(Fn), ne(ar), me.current = ve;
14202
+ it($n), ne(ar), me.current = ve;
14210
14203
  }).catch((Xe) => {
14211
14204
  console.error("ChatInterface - listCheckpoints error:", Xe), re || (et([]), me.current = null);
14212
14205
  }), () => {
14213
14206
  re = !0;
14214
14207
  };
14215
- }, [v, W, P, $e, x]), ct(() => {
14208
+ }, [v, W, P, Fe, x]), ct(() => {
14216
14209
  W && (it(W), ne(P ?? null));
14217
14210
  }, [W, P]);
14218
14211
  const It = Me(async () => {
@@ -14237,8 +14230,8 @@ function mi({
14237
14230
  }
14238
14231
  })();
14239
14232
  }, [w]), ct(() => {
14240
- D && !Fe && (p == null || p(D));
14241
- }, [D, Fe, p]);
14233
+ D && !$e && (p == null || p(D));
14234
+ }, [D, $e, p]);
14242
14235
  const Qt = (re) => {
14243
14236
  if (re.length > Oo)
14244
14237
  return `Message too long (${re.length}/${Oo} characters)`;
@@ -14253,26 +14246,26 @@ function mi({
14253
14246
  if (ve) {
14254
14247
  const Le = Qt(ve);
14255
14248
  if (Le) {
14256
- $(Le);
14249
+ F(Le);
14257
14250
  return;
14258
14251
  }
14259
14252
  }
14260
14253
  try {
14261
14254
  await k(ve || "", {
14262
- checkpointId: $e ?? W ?? void 0,
14255
+ checkpointId: Fe ?? W ?? void 0,
14263
14256
  checkpointNs: ft ?? P ?? void 0,
14264
14257
  payloadExtras: Y ? { edit: !0, originalMessageId: Y } : void 0,
14265
14258
  attachments: B
14266
- }), f == null || f(ve), $(null), pe([]), He(), K(null), z("");
14259
+ }), f == null || f(ve), F(null), pe([]), He(), K(null), z("");
14267
14260
  } catch (Le) {
14268
14261
  const Xe = (Le == null ? void 0 : Le.message) || "Failed to send message";
14269
- $(Xe), p == null || p(Xe);
14262
+ F(Xe), p == null || p(Xe);
14270
14263
  }
14271
14264
  }
14272
14265
  }, or = V.useCallback((re, ve) => {
14273
- u && (K(re), z(ve), $(null));
14266
+ u && (K(re), z(ve), F(null));
14274
14267
  }, [u]), wn = V.useCallback(() => {
14275
- K(null), z(""), $(null);
14268
+ K(null), z(""), F(null);
14276
14269
  }, []), sr = Me((re, ve) => {
14277
14270
  or(re, ve);
14278
14271
  }, [or]), en = Me((re) => {
@@ -14289,12 +14282,12 @@ function mi({
14289
14282
  if (R[Le].role === "user") {
14290
14283
  const Xe = ve(R[Le]);
14291
14284
  Xe && k(Xe, {
14292
- checkpointId: $e ?? W ?? void 0,
14285
+ checkpointId: Fe ?? W ?? void 0,
14293
14286
  checkpointNs: ft ?? P ?? void 0
14294
14287
  });
14295
14288
  break;
14296
14289
  }
14297
- }, [R, k, $e, ft, W, P]), Mn = (re) => {
14290
+ }, [R, k, Fe, ft, W, P]), Mn = (re) => {
14298
14291
  const ve = Array.from(re.target.files || []);
14299
14292
  pe((Le) => [...Le, ...ve]), re.target.value = "";
14300
14293
  }, Mt = (re) => {
@@ -14308,7 +14301,7 @@ function mi({
14308
14301
  q(null), ie(null), O(!0);
14309
14302
  try {
14310
14303
  await k("", {
14311
- checkpointId: $e ?? W ?? void 0,
14304
+ checkpointId: Fe ?? W ?? void 0,
14312
14305
  checkpointNs: ft ?? P ?? void 0,
14313
14306
  attachments: [ve]
14314
14307
  });
@@ -14341,7 +14334,7 @@ function mi({
14341
14334
  }
14342
14335
  }, Dt = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${d.container || ""}`, Ln = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 bg-transparent ${d.messagesArea || ""}`, ir = `flex-shrink-0 w-full border-t p-4 bg-transparent ${d.inputArea || ""}`;
14343
14336
  return /* @__PURE__ */ c.jsxs("div", { className: Dt, children: [
14344
- !!D && !Fe && /* @__PURE__ */ c.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
14337
+ !!D && !$e && /* @__PURE__ */ c.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
14345
14338
  /* @__PURE__ */ c.jsx("span", { children: D }),
14346
14339
  /* @__PURE__ */ c.jsx(
14347
14340
  Ue,
@@ -14361,7 +14354,7 @@ function mi({
14361
14354
  "select",
14362
14355
  {
14363
14356
  className: "border border-border rounded px-2 py-1 text-xs bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring dark:bg-secondary",
14364
- value: $e ?? "",
14357
+ value: Fe ?? "",
14365
14358
  onChange: (re) => {
14366
14359
  const ve = re.target.value || null;
14367
14360
  Dn(ve);
@@ -14478,7 +14471,7 @@ function mi({
14478
14471
  Q && !G && /* @__PURE__ */ c.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Q })
14479
14472
  ] })
14480
14473
  ] }),
14481
- F && /* @__PURE__ */ c.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: F }),
14474
+ $ && /* @__PURE__ */ c.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: $ }),
14482
14475
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-end gap-2", children: [
14483
14476
  (a || l) && /* @__PURE__ */ c.jsxs(QS, { children: [
14484
14477
  /* @__PURE__ */ c.jsx(eC, { asChild: !0, children: /* @__PURE__ */ c.jsx(
@@ -14530,7 +14523,7 @@ function mi({
14530
14523
  onCancelEdit: wn,
14531
14524
  onStop: I,
14532
14525
  allowEmptySend: B.length > 0,
14533
- textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${Y ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${F ? "border-red-400" : ""} ${d.textarea || ""}`
14526
+ textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${Y ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${$ ? "border-red-400" : ""} ${d.textarea || ""}`
14534
14527
  }
14535
14528
  ) })
14536
14529
  ] })
@@ -15119,58 +15112,58 @@ function Ac({
15119
15112
  isLoadingThreads: x
15120
15113
  } = ra(), [y, S] = xe(Array.isArray(h) ? h : []), R = Ge(y.length > 0), [C, T] = xe(null), [k, I] = xe(""), [A, j] = xe(!1);
15121
15114
  ct(() => {
15122
- const $ = Array.isArray(h) ? h : [];
15123
- if ($.length > 0) {
15124
- R.current = !0, S($);
15115
+ const F = Array.isArray(h) ? h : [];
15116
+ if (F.length > 0) {
15117
+ R.current = !0, S(F);
15125
15118
  return;
15126
15119
  }
15127
- x || (R.current = !1, S($));
15120
+ x || (R.current = !1, S(F));
15128
15121
  }, [h, x]);
15129
- const D = async ($) => {
15122
+ const D = async (F) => {
15130
15123
  try {
15131
- await f($), a == null || a($), l == null || l($);
15124
+ await f(F), a == null || a(F), l == null || l(F);
15132
15125
  } catch (B) {
15133
15126
  console.error("Failed to select thread:", B);
15134
15127
  }
15135
15128
  }, L = async () => {
15136
15129
  try {
15137
15130
  j(!0);
15138
- const $ = await w();
15139
- u == null || u($), a == null || a($);
15140
- } catch ($) {
15141
- console.error("Failed to create thread:", $);
15131
+ const F = await w();
15132
+ u == null || u(F), a == null || a(F);
15133
+ } catch (F) {
15134
+ console.error("Failed to create thread:", F);
15142
15135
  } finally {
15143
15136
  j(!1);
15144
15137
  }
15145
- }, W = async ($, B) => {
15138
+ }, W = async (F, B) => {
15146
15139
  if (B.stopPropagation(), !!confirm("Delete this thread?"))
15147
15140
  try {
15148
- await v($), d == null || d($);
15141
+ await v(F), d == null || d(F);
15149
15142
  } catch (pe) {
15150
15143
  console.error("Failed to delete thread:", pe);
15151
15144
  }
15152
- }, P = ($, B) => {
15153
- B.stopPropagation(), T($.threadId), I($.title || `Thread ${$.threadId.slice(0, 8)}`);
15154
- }, Y = async ($) => {
15145
+ }, P = (F, B) => {
15146
+ B.stopPropagation(), T(F.threadId), I(F.title || `Thread ${F.threadId.slice(0, 8)}`);
15147
+ }, Y = async (F) => {
15155
15148
  if (k.trim())
15156
15149
  try {
15157
- await g($, k.trim()), T(null), I("");
15150
+ await g(F, k.trim()), T(null), I("");
15158
15151
  } catch (B) {
15159
15152
  console.error("Failed to update title:", B);
15160
15153
  }
15161
15154
  }, K = () => {
15162
15155
  T(null), I("");
15163
- }, J = ($, B) => {
15164
- $.key === "Enter" ? Y(B) : $.key === "Escape" && K();
15165
- }, z = ($) => {
15166
- if (!$) return "";
15156
+ }, J = (F, B) => {
15157
+ F.key === "Enter" ? Y(B) : F.key === "Escape" && K();
15158
+ }, z = (F) => {
15159
+ if (!F) return "";
15167
15160
  try {
15168
- const B = new Date($), ue = (/* @__PURE__ */ new Date()).getTime() - B.getTime(), ee = Math.floor(ue / (1e3 * 60 * 60 * 24));
15161
+ const B = new Date(F), ue = (/* @__PURE__ */ new Date()).getTime() - B.getTime(), ee = Math.floor(ue / (1e3 * 60 * 60 * 24));
15169
15162
  return ee === 0 ? B.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : ee === 1 ? "Yesterday" : ee < 7 ? `${ee} days ago` : B.toLocaleDateString();
15170
15163
  } catch {
15171
15164
  return "";
15172
15165
  }
15173
- }, F = ($) => $.title || `Thread ${$.threadId.slice(0, 8)}`;
15166
+ }, $ = (F) => F.title || `Thread ${F.threadId.slice(0, 8)}`;
15174
15167
  return /* @__PURE__ */ c.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
15175
15168
  t && /* @__PURE__ */ c.jsx("div", { className: s.header || "flex-shrink-0 p-2 border-b bg-slate-800 border-slate-700 text-slate-100 flex justify-end", children: /* @__PURE__ */ c.jsx(
15176
15169
  Ue,
@@ -15195,32 +15188,32 @@ function Ac({
15195
15188
  ] }) : y.length === 0 ? /* @__PURE__ */ c.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
15196
15189
  /* @__PURE__ */ c.jsx(em, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
15197
15190
  /* @__PURE__ */ c.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
15198
- ] }) : y.slice().sort(($, B) => new Date(B.updatedAt || B.createdAt || "").getTime() - new Date($.updatedAt || $.createdAt || "").getTime()).map(($) => /* @__PURE__ */ c.jsxs(
15191
+ ] }) : y.slice().sort((F, B) => new Date(B.updatedAt || B.createdAt || "").getTime() - new Date(F.updatedAt || F.createdAt || "").getTime()).map((F) => /* @__PURE__ */ c.jsxs(
15199
15192
  "div",
15200
15193
  {
15201
- onClick: () => D($.threadId),
15202
- className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? p) === $.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
15194
+ onClick: () => D(F.threadId),
15195
+ className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? p) === F.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
15203
15196
  children: [
15204
15197
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
15205
- /* @__PURE__ */ c.jsx("div", { className: "flex-1 min-w-0", children: C === $.threadId ? /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", onClick: (B) => B.stopPropagation(), children: [
15206
- /* @__PURE__ */ c.jsx(Jo, { value: k, onChange: (B) => I(B.target.value), onKeyDown: (B) => J(B, $.threadId), className: "h-6 text-sm", autoFocus: !0 }),
15207
- /* @__PURE__ */ c.jsx(Ue, { variant: "ghost", size: "sm", onClick: () => Y($.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(Zi, { size: 12 }) }),
15198
+ /* @__PURE__ */ c.jsx("div", { className: "flex-1 min-w-0", children: C === F.threadId ? /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", onClick: (B) => B.stopPropagation(), children: [
15199
+ /* @__PURE__ */ c.jsx(Jo, { value: k, onChange: (B) => I(B.target.value), onKeyDown: (B) => J(B, F.threadId), className: "h-6 text-sm", autoFocus: !0 }),
15200
+ /* @__PURE__ */ c.jsx(Ue, { variant: "ghost", size: "sm", onClick: () => Y(F.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(Zi, { size: 12 }) }),
15208
15201
  /* @__PURE__ */ c.jsx(Ue, { variant: "ghost", size: "sm", onClick: K, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(fr, { size: 12 }) })
15209
15202
  ] }) : /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
15210
- /* @__PURE__ */ c.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: F($) }),
15203
+ /* @__PURE__ */ c.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: $(F) }),
15211
15204
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
15212
15205
  /* @__PURE__ */ c.jsx(tm, { size: 10 }),
15213
- /* @__PURE__ */ c.jsx("span", { children: z($.updatedAt || $.createdAt) })
15206
+ /* @__PURE__ */ c.jsx("span", { children: z(F.updatedAt || F.createdAt) })
15214
15207
  ] })
15215
15208
  ] }) }),
15216
15209
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
15217
- r && C !== $.threadId && /* @__PURE__ */ c.jsx(Ue, { variant: "ghost", size: "sm", onClick: (B) => P($, B), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c.jsx(Mc, { size: 12 }) }),
15210
+ r && C !== F.threadId && /* @__PURE__ */ c.jsx(Ue, { variant: "ghost", size: "sm", onClick: (B) => P(F, B), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c.jsx(Mc, { size: 12 }) }),
15218
15211
  n && /* @__PURE__ */ c.jsx(
15219
15212
  Ue,
15220
15213
  {
15221
15214
  variant: "ghost",
15222
15215
  size: "sm",
15223
- onClick: (B) => W($.threadId, B),
15216
+ onClick: (B) => W(F.threadId, B),
15224
15217
  className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
15225
15218
  title: "Delete thread",
15226
15219
  children: /* @__PURE__ */ c.jsx(nm, { size: 12 })
@@ -15228,10 +15221,10 @@ function Ac({
15228
15221
  )
15229
15222
  ] })
15230
15223
  ] }),
15231
- i === $.threadId && /* @__PURE__ */ c.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
15224
+ i === F.threadId && /* @__PURE__ */ c.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
15232
15225
  ]
15233
15226
  },
15234
- $.threadId
15227
+ F.threadId
15235
15228
  )) })
15236
15229
  }
15237
15230
  )
@@ -15353,19 +15346,19 @@ var RC = "Label", Lh = m.forwardRef((e, t) => /* @__PURE__ */ c.jsx(
15353
15346
  }
15354
15347
  ));
15355
15348
  Lh.displayName = RC;
15356
- var Fh = Lh;
15349
+ var $h = Lh;
15357
15350
  const kC = ns(
15358
15351
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
15359
- ), Ft = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
15360
- Fh,
15352
+ ), $t = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
15353
+ $h,
15361
15354
  {
15362
15355
  ref: n,
15363
15356
  className: te(kC(), e),
15364
15357
  ...t
15365
15358
  }
15366
15359
  ));
15367
- Ft.displayName = Fh.displayName;
15368
- function $h(e) {
15360
+ $t.displayName = $h.displayName;
15361
+ function Fh(e) {
15369
15362
  const t = m.useRef({ value: e, previous: e });
15370
15363
  return m.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
15371
15364
  }
@@ -15448,7 +15441,7 @@ var AC = "SwitchBubbleInput", Uh = m.forwardRef(
15448
15441
  bubbles: r = !0,
15449
15442
  ...o
15450
15443
  }, s) => {
15451
- const i = m.useRef(null), a = ze(i, s), l = $h(n), u = rf(t);
15444
+ const i = m.useRef(null), a = ze(i, s), l = Fh(n), u = rf(t);
15452
15445
  return m.useEffect(() => {
15453
15446
  const d = i.current;
15454
15447
  if (!d) return;
@@ -15532,7 +15525,7 @@ PC.displayName = _C;
15532
15525
  var OC = [" ", "Enter", "ArrowUp", "ArrowDown"], MC = [" ", "Enter"], Jn = "Select", [Ds, Ls, DC] = Ia(Jn), [Ir, QT] = fn(Jn, [
15533
15526
  DC,
15534
15527
  Ns
15535
- ]), Fs = Ns(), [LC, _n] = Ir(Jn), [FC, $C] = Ir(Jn), qh = (e) => {
15528
+ ]), $s = Ns(), [LC, _n] = Ir(Jn), [$C, FC] = Ir(Jn), qh = (e) => {
15536
15529
  const {
15537
15530
  __scopeSelect: t,
15538
15531
  children: n,
@@ -15548,7 +15541,7 @@ var OC = [" ", "Enter", "ArrowUp", "ArrowDown"], MC = [" ", "Enter"], Jn = "Sele
15548
15541
  disabled: h,
15549
15542
  required: p,
15550
15543
  form: w
15551
- } = e, v = Fs(t), [g, x] = m.useState(null), [y, S] = m.useState(null), [R, C] = m.useState(!1), T = Ts(u), [k, I] = Gn({
15544
+ } = e, v = $s(t), [g, x] = m.useState(null), [y, S] = m.useState(null), [R, C] = m.useState(!1), T = Ts(u), [k, I] = Gn({
15552
15545
  prop: r,
15553
15546
  defaultProp: o ?? !1,
15554
15547
  onChange: s,
@@ -15580,7 +15573,7 @@ var OC = [" ", "Enter", "ArrowUp", "ArrowDown"], MC = [" ", "Enter"], Jn = "Sele
15580
15573
  disabled: h,
15581
15574
  children: [
15582
15575
  /* @__PURE__ */ c.jsx(Ds.Provider, { scope: t, children: /* @__PURE__ */ c.jsx(
15583
- FC,
15576
+ $C,
15584
15577
  {
15585
15578
  scope: e.__scopeSelect,
15586
15579
  onNativeOptionAdd: m.useCallback((K) => {
@@ -15621,7 +15614,7 @@ var OC = [" ", "Enter", "ArrowUp", "ArrowDown"], MC = [" ", "Enter"], Jn = "Sele
15621
15614
  qh.displayName = Jn;
15622
15615
  var Gh = "SelectTrigger", Yh = m.forwardRef(
15623
15616
  (e, t) => {
15624
- const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = Fs(n), i = _n(Gh, n), a = i.disabled || r, l = ze(t, i.onTriggerChange), u = Ls(n), d = m.useRef("touch"), [f, h, p] = wp((v) => {
15617
+ const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = $s(n), i = _n(Gh, n), a = i.disabled || r, l = ze(t, i.onTriggerChange), u = Ls(n), d = m.useRef("touch"), [f, h, p] = wp((v) => {
15625
15618
  const g = u().filter((S) => !S.disabled), x = g.find((S) => S.value === i.value), y = bp(g, v, x);
15626
15619
  y !== void 0 && i.onValueChange(y.value);
15627
15620
  }), w = (v) => {
@@ -15747,30 +15740,30 @@ var Kt = 10, [tp, Pn] = Ir(Zn), HC = "SelectContentImpl", UC = vr("SelectContent
15747
15740
  m.useEffect(() => {
15748
15741
  W && J();
15749
15742
  }, [W, J]);
15750
- const { onOpenChange: z, triggerPointerDownPosRef: F } = y;
15743
+ const { onOpenChange: z, triggerPointerDownPosRef: $ } = y;
15751
15744
  m.useEffect(() => {
15752
15745
  if (S) {
15753
15746
  let G = { x: 0, y: 0 };
15754
15747
  const O = (q) => {
15755
15748
  var ce, ie;
15756
15749
  G = {
15757
- x: Math.abs(Math.round(q.pageX) - (((ce = F.current) == null ? void 0 : ce.x) ?? 0)),
15758
- y: Math.abs(Math.round(q.pageY) - (((ie = F.current) == null ? void 0 : ie.y) ?? 0))
15750
+ x: Math.abs(Math.round(q.pageX) - (((ce = $.current) == null ? void 0 : ce.x) ?? 0)),
15751
+ y: Math.abs(Math.round(q.pageY) - (((ie = $.current) == null ? void 0 : ie.y) ?? 0))
15759
15752
  };
15760
15753
  }, Q = (q) => {
15761
- G.x <= 10 && G.y <= 10 ? q.preventDefault() : S.contains(q.target) || z(!1), document.removeEventListener("pointermove", O), F.current = null;
15754
+ G.x <= 10 && G.y <= 10 ? q.preventDefault() : S.contains(q.target) || z(!1), document.removeEventListener("pointermove", O), $.current = null;
15762
15755
  };
15763
- return F.current !== null && (document.addEventListener("pointermove", O), document.addEventListener("pointerup", Q, { capture: !0, once: !0 })), () => {
15756
+ return $.current !== null && (document.addEventListener("pointermove", O), document.addEventListener("pointerup", Q, { capture: !0, once: !0 })), () => {
15764
15757
  document.removeEventListener("pointermove", O), document.removeEventListener("pointerup", Q, { capture: !0 });
15765
15758
  };
15766
15759
  }
15767
- }, [S, z, F]), m.useEffect(() => {
15760
+ }, [S, z, $]), m.useEffect(() => {
15768
15761
  const G = () => z(!1);
15769
15762
  return window.addEventListener("blur", G), window.addEventListener("resize", G), () => {
15770
15763
  window.removeEventListener("blur", G), window.removeEventListener("resize", G);
15771
15764
  };
15772
15765
  }, [z]);
15773
- const [$, B] = wp((G) => {
15766
+ const [F, B] = wp((G) => {
15774
15767
  const O = L().filter((ce) => !ce.disabled), Q = O.find((ce) => ce.ref.current === document.activeElement), q = bp(O, G, Q);
15775
15768
  q && setTimeout(() => q.ref.current.focus());
15776
15769
  }), pe = m.useCallback(
@@ -15812,7 +15805,7 @@ var Kt = 10, [tp, Pn] = Ir(Zn), HC = "SelectContentImpl", UC = vr("SelectContent
15812
15805
  selectedItemText: j,
15813
15806
  position: r,
15814
15807
  isPositioned: W,
15815
- searchRef: $,
15808
+ searchRef: F,
15816
15809
  children: /* @__PURE__ */ c.jsx(ws, { as: UC, allowPinchZoom: !0, children: /* @__PURE__ */ c.jsx(
15817
15810
  gs,
15818
15811
  {
@@ -15881,7 +15874,7 @@ var WC = "SelectItemAlignedPosition", rp = m.forwardRef((e, t) => {
15881
15874
  if (s.trigger && s.valueNode && a && u && v && g && x) {
15882
15875
  const k = s.trigger.getBoundingClientRect(), I = u.getBoundingClientRect(), A = s.valueNode.getBoundingClientRect(), j = x.getBoundingClientRect();
15883
15876
  if (s.dir !== "rtl") {
15884
- const ce = j.left - I.left, ie = A.left - ce, Fe = k.left - ie, Ke = k.width + Fe, We = Math.max(Ke, I.width), Te = window.innerWidth - Kt, Pe = Wi(ie, [
15877
+ const ce = j.left - I.left, ie = A.left - ce, $e = k.left - ie, Ke = k.width + $e, We = Math.max(Ke, I.width), Te = window.innerWidth - Kt, Pe = Wi(ie, [
15885
15878
  Kt,
15886
15879
  // Prevents the content from going off the starting edge of the
15887
15880
  // viewport. It may still go off the ending edge, but this can be
@@ -15892,33 +15885,33 @@ var WC = "SelectItemAlignedPosition", rp = m.forwardRef((e, t) => {
15892
15885
  ]);
15893
15886
  a.style.minWidth = Ke + "px", a.style.left = Pe + "px";
15894
15887
  } else {
15895
- const ce = I.right - j.right, ie = window.innerWidth - A.right - ce, Fe = window.innerWidth - k.right - ie, Ke = k.width + Fe, We = Math.max(Ke, I.width), Te = window.innerWidth - Kt, Pe = Wi(ie, [
15888
+ const ce = I.right - j.right, ie = window.innerWidth - A.right - ce, $e = window.innerWidth - k.right - ie, Ke = k.width + $e, We = Math.max(Ke, I.width), Te = window.innerWidth - Kt, Pe = Wi(ie, [
15896
15889
  Kt,
15897
15890
  Math.max(Kt, Te - We)
15898
15891
  ]);
15899
15892
  a.style.minWidth = Ke + "px", a.style.right = Pe + "px";
15900
15893
  }
15901
- const D = h(), L = window.innerHeight - Kt * 2, W = v.scrollHeight, P = window.getComputedStyle(u), Y = parseInt(P.borderTopWidth, 10), K = parseInt(P.paddingTop, 10), J = parseInt(P.borderBottomWidth, 10), z = parseInt(P.paddingBottom, 10), F = Y + K + W + z + J, $ = Math.min(g.offsetHeight * 5, F), B = window.getComputedStyle(v), pe = parseInt(B.paddingTop, 10), ue = parseInt(B.paddingBottom, 10), ee = k.top + k.height / 2 - Kt, Ie = L - ee, Ce = g.offsetHeight / 2, G = g.offsetTop + Ce, O = Y + K + G, Q = F - O;
15894
+ const D = h(), L = window.innerHeight - Kt * 2, W = v.scrollHeight, P = window.getComputedStyle(u), Y = parseInt(P.borderTopWidth, 10), K = parseInt(P.paddingTop, 10), J = parseInt(P.borderBottomWidth, 10), z = parseInt(P.paddingBottom, 10), $ = Y + K + W + z + J, F = Math.min(g.offsetHeight * 5, $), B = window.getComputedStyle(v), pe = parseInt(B.paddingTop, 10), ue = parseInt(B.paddingBottom, 10), ee = k.top + k.height / 2 - Kt, Ie = L - ee, Ce = g.offsetHeight / 2, G = g.offsetTop + Ce, O = Y + K + G, Q = $ - O;
15902
15895
  if (O <= ee) {
15903
15896
  const ce = D.length > 0 && g === D[D.length - 1].ref.current;
15904
15897
  a.style.bottom = "0px";
15905
- const ie = u.clientHeight - v.offsetTop - v.offsetHeight, Fe = Math.max(
15898
+ const ie = u.clientHeight - v.offsetTop - v.offsetHeight, $e = Math.max(
15906
15899
  Ie,
15907
15900
  Ce + // viewport might have padding bottom, include it to avoid a scrollable viewport
15908
15901
  (ce ? ue : 0) + ie + J
15909
- ), Ke = O + Fe;
15902
+ ), Ke = O + $e;
15910
15903
  a.style.height = Ke + "px";
15911
15904
  } else {
15912
15905
  const ce = D.length > 0 && g === D[0].ref.current;
15913
15906
  a.style.top = "0px";
15914
- const Fe = Math.max(
15907
+ const $e = Math.max(
15915
15908
  ee,
15916
15909
  Y + v.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
15917
15910
  (ce ? pe : 0) + Ce
15918
15911
  ) + Q;
15919
- a.style.height = Fe + "px", v.scrollTop = O - ee + v.offsetTop;
15912
+ a.style.height = $e + "px", v.scrollTop = O - ee + v.offsetTop;
15920
15913
  }
15921
- a.style.margin = `${Kt}px 0`, a.style.minHeight = $ + "px", a.style.maxHeight = L + "px", r == null || r(), requestAnimationFrame(() => p.current = !0);
15914
+ a.style.margin = `${Kt}px 0`, a.style.minHeight = F + "px", a.style.maxHeight = L + "px", r == null || r(), requestAnimationFrame(() => p.current = !0);
15922
15915
  }
15923
15916
  }, [
15924
15917
  h,
@@ -15987,7 +15980,7 @@ var VC = "SelectPopperPosition", Vi = m.forwardRef((e, t) => {
15987
15980
  align: r = "start",
15988
15981
  collisionPadding: o = Kt,
15989
15982
  ...s
15990
- } = e, i = Fs(n);
15983
+ } = e, i = $s(n);
15991
15984
  return /* @__PURE__ */ c.jsx(
15992
15985
  gf,
15993
15986
  {
@@ -16163,7 +16156,7 @@ var es = "SelectItem", [XC, lp] = Ir(es), cp = m.forwardRef(
16163
16156
  cp.displayName = es;
16164
16157
  var Or = "SelectItemText", up = m.forwardRef(
16165
16158
  (e, t) => {
16166
- const { __scopeSelect: n, className: r, style: o, ...s } = e, i = _n(Or, n), a = Pn(Or, n), l = lp(Or, n), u = $C(Or, n), [d, f] = m.useState(null), h = ze(
16159
+ const { __scopeSelect: n, className: r, style: o, ...s } = e, i = _n(Or, n), a = Pn(Or, n), l = lp(Or, n), u = FC(Or, n), [d, f] = m.useState(null), h = ze(
16167
16160
  t,
16168
16161
  (x) => f(x),
16169
16162
  l.onItemTextChange,
@@ -16273,14 +16266,14 @@ var mp = m.forwardRef((e, t) => {
16273
16266
  gp.displayName = JC;
16274
16267
  var Yi = "SelectArrow", ZC = m.forwardRef(
16275
16268
  (e, t) => {
16276
- const { __scopeSelect: n, ...r } = e, o = Fs(n), s = _n(Yi, n), i = Pn(Yi, n);
16269
+ const { __scopeSelect: n, ...r } = e, o = $s(n), s = _n(Yi, n), i = Pn(Yi, n);
16277
16270
  return s.open && i.position === "popper" ? /* @__PURE__ */ c.jsx(xf, { ...o, ...r, ref: t }) : null;
16278
16271
  }
16279
16272
  );
16280
16273
  ZC.displayName = Yi;
16281
16274
  var QC = "SelectBubbleInput", xp = m.forwardRef(
16282
16275
  ({ __scopeSelect: e, value: t, ...n }, r) => {
16283
- const o = m.useRef(null), s = ze(r, o), i = $h(t);
16276
+ const o = m.useRef(null), s = ze(r, o), i = Fh(t);
16284
16277
  return m.useEffect(() => {
16285
16278
  const a = o.current;
16286
16279
  if (!a) return;
@@ -16617,13 +16610,13 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16617
16610
  ] }),
16618
16611
  /* @__PURE__ */ c.jsxs("div", { className: "space-y-6 py-6", children: [
16619
16612
  /* @__PURE__ */ c.jsxs(Lr, { children: [
16620
- /* @__PURE__ */ c.jsx(Fr, { className: "pb-3", children: /* @__PURE__ */ c.jsxs($r, { className: "text-lg flex items-center gap-2", children: [
16613
+ /* @__PURE__ */ c.jsx($r, { className: "pb-3", children: /* @__PURE__ */ c.jsxs(Fr, { className: "text-lg flex items-center gap-2", children: [
16621
16614
  /* @__PURE__ */ c.jsx(om, { className: "h-5 w-5" }),
16622
16615
  "API Configuration"
16623
16616
  ] }) }),
16624
16617
  /* @__PURE__ */ c.jsxs(Eo, { className: "space-y-4", children: [
16625
16618
  /* @__PURE__ */ c.jsxs("div", { className: "space-y-2", children: [
16626
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "api-url", children: "API Base URL" }),
16619
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "api-url", children: "API Base URL" }),
16627
16620
  /* @__PURE__ */ c.jsxs("div", { className: "flex gap-2", children: [
16628
16621
  /* @__PURE__ */ c.jsx(
16629
16622
  Jo,
@@ -16641,7 +16634,7 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16641
16634
  ] })
16642
16635
  ] }),
16643
16636
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
16644
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "enable-auth", children: "Enable Authentication" }),
16637
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "enable-auth", children: "Enable Authentication" }),
16645
16638
  /* @__PURE__ */ c.jsx(
16646
16639
  Cn,
16647
16640
  {
@@ -16655,7 +16648,7 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16655
16648
  )
16656
16649
  ] }),
16657
16650
  a.api.enableAuth && /* @__PURE__ */ c.jsxs("div", { className: "space-y-2", children: [
16658
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "auth-token", children: "Authentication Token" }),
16651
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "auth-token", children: "Authentication Token" }),
16659
16652
  /* @__PURE__ */ c.jsxs("div", { className: "flex gap-2", children: [
16660
16653
  /* @__PURE__ */ c.jsx(
16661
16654
  Jo,
@@ -16684,13 +16677,13 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16684
16677
  ] })
16685
16678
  ] }),
16686
16679
  /* @__PURE__ */ c.jsxs(Lr, { children: [
16687
- /* @__PURE__ */ c.jsx(Fr, { className: "pb-3", children: /* @__PURE__ */ c.jsxs($r, { className: "text-lg flex items-center gap-2", children: [
16680
+ /* @__PURE__ */ c.jsx($r, { className: "pb-3", children: /* @__PURE__ */ c.jsxs(Fr, { className: "text-lg flex items-center gap-2", children: [
16688
16681
  /* @__PURE__ */ c.jsx(am, { className: "h-5 w-5" }),
16689
16682
  "Interface Settings"
16690
16683
  ] }) }),
16691
16684
  /* @__PURE__ */ c.jsxs(Eo, { className: "space-y-4", children: [
16692
16685
  /* @__PURE__ */ c.jsxs("div", { className: "space-y-2", children: [
16693
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "layout", children: "Layout Style" }),
16686
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "layout", children: "Layout Style" }),
16694
16687
  /* @__PURE__ */ c.jsxs(
16695
16688
  jc,
16696
16689
  {
@@ -16711,7 +16704,7 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16711
16704
  )
16712
16705
  ] }),
16713
16706
  /* @__PURE__ */ c.jsxs("div", { className: "space-y-2", children: [
16714
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "theme", children: "Theme" }),
16707
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "theme", children: "Theme" }),
16715
16708
  /* @__PURE__ */ c.jsxs(
16716
16709
  jc,
16717
16710
  {
@@ -16734,7 +16727,7 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16734
16727
  /* @__PURE__ */ c.jsx(_p, {}),
16735
16728
  /* @__PURE__ */ c.jsxs("div", { className: "space-y-3", children: [
16736
16729
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
16737
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "show-timestamps", children: "Show Timestamps" }),
16730
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "show-timestamps", children: "Show Timestamps" }),
16738
16731
  /* @__PURE__ */ c.jsx(
16739
16732
  Cn,
16740
16733
  {
@@ -16748,7 +16741,7 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16748
16741
  )
16749
16742
  ] }),
16750
16743
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
16751
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "show-agent-names", children: "Show Agent Names" }),
16744
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "show-agent-names", children: "Show Agent Names" }),
16752
16745
  /* @__PURE__ */ c.jsx(
16753
16746
  Cn,
16754
16747
  {
@@ -16762,7 +16755,7 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16762
16755
  )
16763
16756
  ] }),
16764
16757
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
16765
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "compact-messages", children: "Compact Messages" }),
16758
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "compact-messages", children: "Compact Messages" }),
16766
16759
  /* @__PURE__ */ c.jsx(
16767
16760
  Cn,
16768
16761
  {
@@ -16779,14 +16772,14 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16779
16772
  ] })
16780
16773
  ] }),
16781
16774
  /* @__PURE__ */ c.jsxs(Lr, { children: [
16782
- /* @__PURE__ */ c.jsx(Fr, { className: "pb-3", children: /* @__PURE__ */ c.jsxs($r, { className: "text-lg flex items-center gap-2", children: [
16775
+ /* @__PURE__ */ c.jsx($r, { className: "pb-3", children: /* @__PURE__ */ c.jsxs(Fr, { className: "text-lg flex items-center gap-2", children: [
16783
16776
  /* @__PURE__ */ c.jsx(lm, { className: "h-5 w-5" }),
16784
16777
  "Behavior Settings"
16785
16778
  ] }) }),
16786
16779
  /* @__PURE__ */ c.jsxs(Eo, { className: "space-y-4", children: [
16787
16780
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
16788
16781
  /* @__PURE__ */ c.jsxs("div", { children: [
16789
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "auto-save", children: "Auto-save Conversations" }),
16782
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "auto-save", children: "Auto-save Conversations" }),
16790
16783
  /* @__PURE__ */ c.jsx("p", { className: "text-sm text-muted-foreground", children: "Automatically save messages to threads" })
16791
16784
  ] }),
16792
16785
  /* @__PURE__ */ c.jsx(
@@ -16803,7 +16796,7 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16803
16796
  ] }),
16804
16797
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
16805
16798
  /* @__PURE__ */ c.jsxs("div", { children: [
16806
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "enable-streaming", children: "Enable Streaming" }),
16799
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "enable-streaming", children: "Enable Streaming" }),
16807
16800
  /* @__PURE__ */ c.jsx("p", { className: "text-sm text-muted-foreground", children: "Stream responses in real-time" })
16808
16801
  ] }),
16809
16802
  /* @__PURE__ */ c.jsx(
@@ -16820,7 +16813,7 @@ function eR({ settings: e, onSettingsChange: t, className: n = "" }) {
16820
16813
  ] }),
16821
16814
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
16822
16815
  /* @__PURE__ */ c.jsxs("div", { children: [
16823
- /* @__PURE__ */ c.jsx(Ft, { htmlFor: "typing-indicator", children: "Typing Indicator" }),
16816
+ /* @__PURE__ */ c.jsx($t, { htmlFor: "typing-indicator", children: "Typing Indicator" }),
16824
16817
  /* @__PURE__ */ c.jsx("p", { className: "text-sm text-muted-foreground", children: "Show typing indicator during responses" })
16825
16818
  ] }),
16826
16819
  /* @__PURE__ */ c.jsx(
@@ -16941,7 +16934,7 @@ export {
16941
16934
  Kn as chatApiClient,
16942
16935
  tR as default,
16943
16936
  Kg as del,
16944
- $t as get,
16937
+ Ft as get,
16945
16938
  Ug as getChatToken,
16946
16939
  XT as getCurrentSettings,
16947
16940
  yC as getDefaultApiConfig,