teodor-new-chat-ui 3.0.179 → 3.0.181

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
@@ -3,7 +3,7 @@ var wp = (e, t, n) => t in e ? vp(e, t, { enumerable: !0, configurable: !0, writ
3
3
  var Oa = (e, t, n) => wp(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as p from "react";
5
5
  import z, { useState as me, useRef as rt, useCallback as Ye, useEffect as ct, useReducer as bp, useMemo as Kt, createContext as yp, useContext as Sp, createElement as co, useLayoutEffect as Cp } from "react";
6
- import { Square as Tp, Send as kp, X as rr, ExternalLink as Rp, Download as Ep, Image as Ip, FileText as Ma, Loader as gc, Bot as Da, Wrench as Np, User as Ap, Paperclip as ni, ChevronUp as Rr, ChevronDown as nr, Copy as La, Edit as $a, RotateCcw as ri, ChevronRight as _p, Check as Mi, Circle as jp, Edit3 as xc, Loader2 as Pp, Plus as Op, FileSpreadsheet as Mp, MessageSquarePlus as Dp, MessageSquare as Lp, Calendar as $p, Trash2 as Fp, Settings as zp, Server as Bp, EyeOff as Hp, Eye as Up, Layout as Wp, MessageCircle as Vp, Save as Kp } from "lucide-react";
6
+ import { Square as Tp, Send as Rp, X as rr, ExternalLink as kp, Download as Ep, Image as Ip, FileText as Ma, Loader as gc, Bot as Da, Wrench as Np, User as Ap, Paperclip as ni, ChevronUp as kr, ChevronDown as nr, Copy as La, Edit as $a, RotateCcw as ri, ChevronRight as _p, Check as Mi, Circle as jp, Edit3 as xc, Loader2 as Pp, Plus as Op, FileSpreadsheet as Mp, MessageSquarePlus as Dp, MessageSquare as Lp, Calendar as $p, Trash2 as Fp, Settings as zp, Server as Bp, EyeOff as Hp, Eye as Up, Layout as Wp, MessageCircle as Vp, Save as Kp } from "lucide-react";
7
7
  import { Slot as qp, createSlot as lr } from "@radix-ui/react-slot";
8
8
  import { cva as qo } from "class-variance-authority";
9
9
  import { clsx as Gp } from "clsx";
@@ -72,10 +72,10 @@ function Jp() {
72
72
  Ge.unshift("Warning: " + B), Function.prototype.apply.call(console[T], console, Ge);
73
73
  }
74
74
  }
75
- var k = !1, S = !1, C = !1, R = !1, E = !1, N;
75
+ var R = !1, S = !1, C = !1, k = !1, E = !1, N;
76
76
  N = Symbol.for("react.module.reference");
77
77
  function j(T) {
78
- return !!(typeof T == "string" || typeof T == "function" || T === r || T === s || E || T === o || T === u || T === d || R || T === m || k || S || C || typeof T == "object" && T !== null && (T.$$typeof === h || T.$$typeof === f || T.$$typeof === i || T.$$typeof === a || T.$$typeof === c || // This needs to include all possible module reference object
78
+ return !!(typeof T == "string" || typeof T == "function" || T === r || T === s || E || T === o || T === u || T === d || k || T === m || R || S || C || typeof T == "object" && T !== null && (T.$$typeof === h || T.$$typeof === f || T.$$typeof === i || T.$$typeof === a || T.$$typeof === c || // This needs to include all possible module reference object
79
79
  // types supported by any Flight configuration anywhere since
80
80
  // we don't know which Flight build this will end up being used
81
81
  // with.
@@ -136,14 +136,14 @@ function Jp() {
136
136
  }
137
137
  return null;
138
138
  }
139
- var P = Object.assign, G = 0, H, W, D, O, ae, Y, ee;
139
+ var P = Object.assign, G = 0, H, W, D, O, ae, Y, Q;
140
140
  function L() {
141
141
  }
142
142
  L.__reactDisabledLog = !0;
143
- function Z() {
143
+ function ee() {
144
144
  {
145
145
  if (G === 0) {
146
- H = console.log, W = console.info, D = console.warn, O = console.error, ae = console.group, Y = console.groupCollapsed, ee = console.groupEnd;
146
+ H = console.log, W = console.info, D = console.warn, O = console.error, ae = console.group, Y = console.groupCollapsed, Q = console.groupEnd;
147
147
  var T = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
@@ -191,14 +191,14 @@ function Jp() {
191
191
  value: Y
192
192
  }),
193
193
  groupEnd: P({}, T, {
194
- value: ee
194
+ value: Q
195
195
  })
196
196
  });
197
197
  }
198
198
  G < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
199
199
  }
200
200
  }
201
- var Q = x.ReactCurrentDispatcher, V;
201
+ var Z = x.ReactCurrentDispatcher, V;
202
202
  function A(T, B, ne) {
203
203
  {
204
204
  if (V === void 0)
@@ -230,7 +230,7 @@ function Jp() {
230
230
  var We = Error.prepareStackTrace;
231
231
  Error.prepareStackTrace = void 0;
232
232
  var Ge;
233
- Ge = Q.current, Q.current = null, Z();
233
+ Ge = Z.current, Z.current = null, ee();
234
234
  try {
235
235
  if (B) {
236
236
  var Fe = function() {
@@ -243,29 +243,29 @@ function Jp() {
243
243
  }), typeof Reflect == "object" && Reflect.construct) {
244
244
  try {
245
245
  Reflect.construct(Fe, []);
246
- } catch (kt) {
247
- Ce = kt;
246
+ } catch (Rt) {
247
+ Ce = Rt;
248
248
  }
249
249
  Reflect.construct(T, [], Fe);
250
250
  } else {
251
251
  try {
252
252
  Fe.call();
253
- } catch (kt) {
254
- Ce = kt;
253
+ } catch (Rt) {
254
+ Ce = Rt;
255
255
  }
256
256
  T.call(Fe.prototype);
257
257
  }
258
258
  } else {
259
259
  try {
260
260
  throw Error();
261
- } catch (kt) {
262
- Ce = kt;
261
+ } catch (Rt) {
262
+ Ce = Rt;
263
263
  }
264
264
  T();
265
265
  }
266
- } catch (kt) {
267
- if (kt && Ce && typeof kt.stack == "string") {
268
- for (var Me = kt.stack.split(`
266
+ } catch (Rt) {
267
+ if (Rt && Ce && typeof Rt.stack == "string") {
268
+ for (var Me = Rt.stack.split(`
269
269
  `), St = Ce.stack.split(`
270
270
  `), ot = Me.length - 1, lt = St.length - 1; ot >= 1 && lt >= 0 && Me[ot] !== St[lt]; )
271
271
  lt--;
@@ -283,7 +283,7 @@ function Jp() {
283
283
  }
284
284
  }
285
285
  } finally {
286
- q = !1, Q.current = Ge, Ee(), Error.prepareStackTrace = We;
286
+ q = !1, Z.current = Ge, Ee(), Error.prepareStackTrace = We;
287
287
  }
288
288
  var Zn = T ? T.displayName || T.name : "", jn = Zn ? A(Zn) : "";
289
289
  return typeof T == "function" && te.set(T, jn), jn;
@@ -380,7 +380,7 @@ function Jp() {
380
380
  ref: !0,
381
381
  __self: !0,
382
382
  __source: !0
383
- }, ke, He;
383
+ }, Re, He;
384
384
  function Se(T) {
385
385
  if (je.call(T, "ref")) {
386
386
  var B = Object.getOwnPropertyDescriptor(T, "ref").get;
@@ -403,7 +403,7 @@ function Jp() {
403
403
  function _n(T, B) {
404
404
  {
405
405
  var ne = function() {
406
- ke || (ke = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", B));
406
+ Re || (Re = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", B));
407
407
  };
408
408
  ne.isReactWarning = !0, Object.defineProperty(T, "key", {
409
409
  get: ne,
@@ -608,11 +608,11 @@ Check the top-level render call using <` + ne + ">.");
608
608
  yr(Dt, T);
609
609
  }
610
610
  if (je.call(B, "key")) {
611
- var jn = U(T), kt = Object.keys(B).filter(function(xp) {
611
+ var jn = U(T), Rt = Object.keys(B).filter(function(xp) {
612
612
  return xp !== "key";
613
- }), Ns = kt.length > 0 ? "{key: someKey, " + kt.join(": ..., ") + ": ...}" : "{key: someKey}";
613
+ }), Ns = Rt.length > 0 ? "{key: someKey, " + Rt.join(": ..., ") + ": ...}" : "{key: someKey}";
614
614
  if (!ja[jn + Ns]) {
615
- var gp = kt.length > 0 ? "{" + kt.join(": ..., ") + ": ...}" : "{}";
615
+ var gp = Rt.length > 0 ? "{" + Rt.join(": ..., ") + ": ...}" : "{}";
616
616
  w(`A props object containing a "key" prop is being spread into JSX:
617
617
  let props = %s;
618
618
  <%s {...props} />
@@ -646,14 +646,14 @@ const { toString: Zp } = Object.prototype, { getPrototypeOf: Di } = Object, { it
646
646
  return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
647
647
  })(/* @__PURE__ */ Object.create(null)), Jt = (e) => (e = e.toLowerCase(), (t) => Xo(t) === e), Jo = (e) => (t) => typeof t === e, { isArray: fr } = Array, cr = Jo("undefined");
648
648
  function Hr(e) {
649
- return e !== null && !cr(e) && e.constructor !== null && !cr(e.constructor) && Rt(e.constructor.isBuffer) && e.constructor.isBuffer(e);
649
+ return e !== null && !cr(e) && e.constructor !== null && !cr(e.constructor) && kt(e.constructor.isBuffer) && e.constructor.isBuffer(e);
650
650
  }
651
651
  const yc = Jt("ArrayBuffer");
652
652
  function Qp(e) {
653
653
  let t;
654
654
  return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && yc(e.buffer), t;
655
655
  }
656
- const em = Jo("string"), Rt = Jo("function"), Sc = Jo("number"), Ur = (e) => e !== null && typeof e == "object", tm = (e) => e === !0 || e === !1, uo = (e) => {
656
+ const em = Jo("string"), kt = Jo("function"), Sc = Jo("number"), Ur = (e) => e !== null && typeof e == "object", tm = (e) => e === !0 || e === !1, uo = (e) => {
657
657
  if (Xo(e) !== "object")
658
658
  return !1;
659
659
  const t = Di(e);
@@ -666,10 +666,10 @@ const em = Jo("string"), Rt = Jo("function"), Sc = Jo("number"), Ur = (e) => e !
666
666
  } catch {
667
667
  return !1;
668
668
  }
669
- }, rm = Jt("Date"), om = Jt("File"), sm = Jt("Blob"), im = Jt("FileList"), am = (e) => Ur(e) && Rt(e.pipe), lm = (e) => {
669
+ }, rm = Jt("Date"), om = Jt("File"), sm = Jt("Blob"), im = Jt("FileList"), am = (e) => Ur(e) && kt(e.pipe), lm = (e) => {
670
670
  let t;
671
- return e && (typeof FormData == "function" && e instanceof FormData || Rt(e.append) && ((t = Xo(e)) === "formdata" || // detect form-data instance
672
- t === "object" && Rt(e.toString) && e.toString() === "[object FormData]"));
671
+ return e && (typeof FormData == "function" && e instanceof FormData || kt(e.append) && ((t = Xo(e)) === "formdata" || // detect form-data instance
672
+ t === "object" && kt(e.toString) && e.toString() === "[object FormData]"));
673
673
  }, cm = Jt("URLSearchParams"), [um, dm, fm, hm] = ["ReadableStream", "Request", "Response", "Headers"].map(Jt), pm = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
674
674
  function Wr(e, t, { allOwnKeys: n = !1 } = {}) {
675
675
  if (e === null || typeof e > "u")
@@ -709,7 +709,7 @@ function si() {
709
709
  return n;
710
710
  }
711
711
  const mm = (e, t, n, { allOwnKeys: r } = {}) => (Wr(t, (o, s) => {
712
- n && Rt(o) ? e[s] = wc(o, n) : e[s] = o;
712
+ n && kt(o) ? e[s] = wc(o, n) : e[s] = o;
713
713
  }, { allOwnKeys: r }), e), gm = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), xm = (e, t, n, r) => {
714
714
  e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
715
715
  value: t.prototype
@@ -750,23 +750,23 @@ const mm = (e, t, n, { allOwnKeys: r } = {}) => (Wr(t, (o, s) => {
750
750
  for (; (n = e.exec(t)) !== null; )
751
751
  r.push(n);
752
752
  return r;
753
- }, Tm = Jt("HTMLFormElement"), km = (e) => e.toLowerCase().replace(
753
+ }, Tm = Jt("HTMLFormElement"), Rm = (e) => e.toLowerCase().replace(
754
754
  /[-_\s]([a-z\d])(\w*)/g,
755
755
  function(n, r, o) {
756
756
  return r.toUpperCase() + o;
757
757
  }
758
- ), Ba = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Rm = Jt("RegExp"), kc = (e, t) => {
758
+ ), Ba = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), km = Jt("RegExp"), Rc = (e, t) => {
759
759
  const n = Object.getOwnPropertyDescriptors(e), r = {};
760
760
  Wr(n, (o, s) => {
761
761
  let i;
762
762
  (i = t(o, s, e)) !== !1 && (r[s] = i || o);
763
763
  }), Object.defineProperties(e, r);
764
764
  }, Em = (e) => {
765
- kc(e, (t, n) => {
766
- if (Rt(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
765
+ Rc(e, (t, n) => {
766
+ if (kt(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
767
767
  return !1;
768
768
  const r = e[n];
769
- if (Rt(r)) {
769
+ if (kt(r)) {
770
770
  if (t.enumerable = !1, "writable" in t) {
771
771
  t.writable = !1;
772
772
  return;
@@ -786,7 +786,7 @@ const mm = (e, t, n, { allOwnKeys: r } = {}) => (Wr(t, (o, s) => {
786
786
  }, Nm = () => {
787
787
  }, Am = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
788
788
  function _m(e) {
789
- return !!(e && Rt(e.append) && e[bc] === "FormData" && e[Yo]);
789
+ return !!(e && kt(e.append) && e[bc] === "FormData" && e[Yo]);
790
790
  }
791
791
  const jm = (e) => {
792
792
  const t = new Array(10), n = (r, o) => {
@@ -807,14 +807,14 @@ const jm = (e) => {
807
807
  return r;
808
808
  };
809
809
  return n(e, 0);
810
- }, Pm = Jt("AsyncFunction"), Om = (e) => e && (Ur(e) || Rt(e)) && Rt(e.then) && Rt(e.catch), Rc = ((e, t) => e ? setImmediate : t ? ((n, r) => (Mn.addEventListener("message", ({ source: o, data: s }) => {
810
+ }, Pm = Jt("AsyncFunction"), Om = (e) => e && (Ur(e) || kt(e)) && kt(e.then) && kt(e.catch), kc = ((e, t) => e ? setImmediate : t ? ((n, r) => (Mn.addEventListener("message", ({ source: o, data: s }) => {
811
811
  o === Mn && s === n && r.length && r.shift()();
812
812
  }, !1), (o) => {
813
813
  r.push(o), Mn.postMessage(n, "*");
814
814
  }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
815
815
  typeof setImmediate == "function",
816
- Rt(Mn.postMessage)
817
- ), Mm = typeof queueMicrotask < "u" ? queueMicrotask.bind(Mn) : typeof process < "u" && process.nextTick || Rc, Dm = (e) => e != null && Rt(e[Yo]), _ = {
816
+ kt(Mn.postMessage)
817
+ ), Mm = typeof queueMicrotask < "u" ? queueMicrotask.bind(Mn) : typeof process < "u" && process.nextTick || kc, Dm = (e) => e != null && kt(e[Yo]), _ = {
818
818
  isArray: fr,
819
819
  isArrayBuffer: yc,
820
820
  isBuffer: Hr,
@@ -834,8 +834,8 @@ const jm = (e) => {
834
834
  isDate: rm,
835
835
  isFile: om,
836
836
  isBlob: sm,
837
- isRegExp: Rm,
838
- isFunction: Rt,
837
+ isRegExp: km,
838
+ isFunction: kt,
839
839
  isStream: am,
840
840
  isURLSearchParams: cm,
841
841
  isTypedArray: ym,
@@ -857,10 +857,10 @@ const jm = (e) => {
857
857
  hasOwnProperty: Ba,
858
858
  hasOwnProp: Ba,
859
859
  // an alias to avoid ESLint no-prototype-builtins detection
860
- reduceDescriptors: kc,
860
+ reduceDescriptors: Rc,
861
861
  freezeMethods: Em,
862
862
  toObjectSet: Im,
863
- toCamelCase: km,
863
+ toCamelCase: Rm,
864
864
  noop: Nm,
865
865
  toFiniteNumber: Am,
866
866
  findKey: Cc,
@@ -870,7 +870,7 @@ const jm = (e) => {
870
870
  toJSONObject: jm,
871
871
  isAsyncFn: Pm,
872
872
  isThenable: Om,
873
- setImmediate: Rc,
873
+ setImmediate: kc,
874
874
  asap: Mm,
875
875
  isIterable: Dm
876
876
  };
@@ -973,10 +973,10 @@ function Zo(e, t, n) {
973
973
  if (_.endsWith(v, "{}"))
974
974
  v = r ? v : v.slice(0, -2), b = JSON.stringify(b);
975
975
  else if (_.isArray(b) && $m(b) || (_.isFileList(b) || _.endsWith(v, "[]")) && (x = _.toArray(b)))
976
- return v = Nc(v), x.forEach(function(y, k) {
976
+ return v = Nc(v), x.forEach(function(y, R) {
977
977
  !(_.isUndefined(y) || y === null) && t.append(
978
978
  // eslint-disable-next-line no-nested-ternary
979
- i === !0 ? Ha([v], k, s) : i === null ? v : v + "[]",
979
+ i === !0 ? Ha([v], R, s) : i === null ? v : v + "[]",
980
980
  u(y)
981
981
  );
982
982
  }), !1;
@@ -1272,7 +1272,7 @@ const Qm = _.toObjectSet([
1272
1272
  o = i.indexOf(":"), n = i.substring(0, o).trim().toLowerCase(), r = i.substring(o + 1).trim(), !(!n || t[n] && Qm[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
1273
1273
  }), t;
1274
1274
  }, Va = Symbol("internals");
1275
- function kr(e) {
1275
+ function Rr(e) {
1276
1276
  return e && String(e).trim().toLowerCase();
1277
1277
  }
1278
1278
  function fo(e) {
@@ -1317,7 +1317,7 @@ let Et = class {
1317
1317
  set(t, n, r) {
1318
1318
  const o = this;
1319
1319
  function s(a, c, u) {
1320
- const d = kr(c);
1320
+ const d = Rr(c);
1321
1321
  if (!d)
1322
1322
  throw new Error("header name must be a non-empty string");
1323
1323
  const f = _.findKey(o, d);
@@ -1341,7 +1341,7 @@ let Et = class {
1341
1341
  return this;
1342
1342
  }
1343
1343
  get(t, n) {
1344
- if (t = kr(t), t) {
1344
+ if (t = Rr(t), t) {
1345
1345
  const r = _.findKey(this, t);
1346
1346
  if (r) {
1347
1347
  const o = this[r];
@@ -1358,7 +1358,7 @@ let Et = class {
1358
1358
  }
1359
1359
  }
1360
1360
  has(t, n) {
1361
- if (t = kr(t), t) {
1361
+ if (t = Rr(t), t) {
1362
1362
  const r = _.findKey(this, t);
1363
1363
  return !!(r && this[r] !== void 0 && (!n || As(this, this[r], r, n)));
1364
1364
  }
@@ -1368,7 +1368,7 @@ let Et = class {
1368
1368
  const r = this;
1369
1369
  let o = !1;
1370
1370
  function s(i) {
1371
- if (i = kr(i), i) {
1371
+ if (i = Rr(i), i) {
1372
1372
  const a = _.findKey(r, i);
1373
1373
  a && (!n || As(r, r[a], a, n)) && (delete r[a], o = !0);
1374
1374
  }
@@ -1430,7 +1430,7 @@ let Et = class {
1430
1430
  accessors: {}
1431
1431
  }).accessors, o = this.prototype;
1432
1432
  function s(i) {
1433
- const a = kr(i);
1433
+ const a = Rr(i);
1434
1434
  r[a] || (og(o, i), r[a] = !0);
1435
1435
  }
1436
1436
  return _.isArray(t) ? t.forEach(s) : s(t), this;
@@ -1681,30 +1681,30 @@ const Lc = (e) => {
1681
1681
  config: e,
1682
1682
  request: g
1683
1683
  };
1684
- Mc(function(R) {
1685
- n(R), v();
1686
- }, function(R) {
1687
- r(R), v();
1684
+ Mc(function(k) {
1685
+ n(k), v();
1686
+ }, function(k) {
1687
+ r(k), v();
1688
1688
  }, S), g = null;
1689
1689
  }
1690
1690
  "onloadend" in g ? g.onloadend = x : g.onreadystatechange = function() {
1691
1691
  !g || g.readyState !== 4 || g.status === 0 && !(g.responseURL && g.responseURL.indexOf("file:") === 0) || setTimeout(x);
1692
1692
  }, g.onabort = function() {
1693
1693
  g && (r(new Ne("Request aborted", Ne.ECONNABORTED, e, g)), g = null);
1694
- }, g.onerror = function(k) {
1695
- const S = k && k.message ? k.message : "Network Error", C = new Ne(S, Ne.ERR_NETWORK, e, g);
1696
- C.event = k || null, r(C), g = null;
1694
+ }, g.onerror = function(R) {
1695
+ const S = R && R.message ? R.message : "Network Error", C = new Ne(S, Ne.ERR_NETWORK, e, g);
1696
+ C.event = R || null, r(C), g = null;
1697
1697
  }, g.ontimeout = function() {
1698
- let k = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1698
+ let R = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1699
1699
  const S = o.transitional || jc;
1700
- o.timeoutErrorMessage && (k = o.timeoutErrorMessage), r(new Ne(
1701
- k,
1700
+ o.timeoutErrorMessage && (R = o.timeoutErrorMessage), r(new Ne(
1701
+ R,
1702
1702
  S.clarifyTimeoutError ? Ne.ETIMEDOUT : Ne.ECONNABORTED,
1703
1703
  e,
1704
1704
  g
1705
1705
  )), g = null;
1706
- }, s === void 0 && i.setContentType(null), "setRequestHeader" in g && _.forEach(i.toJSON(), function(k, S) {
1707
- g.setRequestHeader(S, k);
1706
+ }, s === void 0 && i.setContentType(null), "setRequestHeader" in g && _.forEach(i.toJSON(), function(R, S) {
1707
+ g.setRequestHeader(S, R);
1708
1708
  }), _.isUndefined(o.withCredentials) || (g.withCredentials = !!o.withCredentials), a && a !== "json" && (g.responseType = o.responseType), u && ([h, b] = Io(u, !0), g.addEventListener("progress", h)), c && g.upload && ([f, m] = Io(c), g.upload.addEventListener("progress", f), g.upload.addEventListener("loadend", m)), (o.cancelToken || o.signal) && (d = (y) => {
1709
1709
  g && (r(!y || y.type ? new hr(null, e, g) : y), g.abort(), g = null);
1710
1710
  }, o.cancelToken && o.cancelToken.subscribe(d), o.signal && (o.signal.aborted ? d() : o.signal.addEventListener("abort", d)));
@@ -1860,16 +1860,16 @@ const Lc = (e) => {
1860
1860
  data: x,
1861
1861
  signal: w,
1862
1862
  cancelToken: y,
1863
- timeout: k,
1863
+ timeout: R,
1864
1864
  onDownloadProgress: S,
1865
1865
  onUploadProgress: C,
1866
- responseType: R,
1866
+ responseType: k,
1867
1867
  headers: E,
1868
1868
  withCredentials: N = "same-origin",
1869
1869
  fetchOptions: j
1870
1870
  } = Lc(b), I = t || fetch;
1871
- R = R ? (R + "").toLowerCase() : "text";
1872
- let $ = pg([w, y && y.toAbortSignal()], k), U = null;
1871
+ k = k ? (k + "").toLowerCase() : "text";
1872
+ let $ = pg([w, y && y.toAbortSignal()], R), U = null;
1873
1873
  const P = $ && $.unsubscribe && (() => {
1874
1874
  $.unsubscribe();
1875
1875
  });
@@ -1880,13 +1880,13 @@ const Lc = (e) => {
1880
1880
  method: "POST",
1881
1881
  body: x,
1882
1882
  duplex: "half"
1883
- }), ee;
1884
- if (_.isFormData(x) && (ee = Y.headers.get("content-type")) && E.setContentType(ee), Y.body) {
1885
- const [L, Z] = Ka(
1883
+ }), Q;
1884
+ if (_.isFormData(x) && (Q = Y.headers.get("content-type")) && E.setContentType(Q), Y.body) {
1885
+ const [L, ee] = Ka(
1886
1886
  G,
1887
1887
  Io(qa(C))
1888
1888
  );
1889
- x = Ya(Y.body, Xa, L, Z);
1889
+ x = Ya(Y.body, Xa, L, ee);
1890
1890
  }
1891
1891
  }
1892
1892
  _.isString(N) || (N = N ? "include" : "omit");
@@ -1901,27 +1901,27 @@ const Lc = (e) => {
1901
1901
  };
1902
1902
  U = s && new n(v, W);
1903
1903
  let D = await (s ? I(U, j) : I(v, W));
1904
- const O = d && (R === "stream" || R === "response");
1904
+ const O = d && (k === "stream" || k === "response");
1905
1905
  if (d && (S || O && P)) {
1906
1906
  const Y = {};
1907
1907
  ["status", "statusText", "headers"].forEach((Ee) => {
1908
1908
  Y[Ee] = D[Ee];
1909
1909
  });
1910
- const ee = _.toFiniteNumber(D.headers.get("content-length")), [L, Z] = S && Ka(
1911
- ee,
1910
+ const Q = _.toFiniteNumber(D.headers.get("content-length")), [L, ee] = S && Ka(
1911
+ Q,
1912
1912
  Io(qa(S), !0)
1913
1913
  ) || [];
1914
1914
  D = new r(
1915
1915
  Ya(D.body, Xa, L, () => {
1916
- Z && Z(), P && P();
1916
+ ee && ee(), P && P();
1917
1917
  }),
1918
1918
  Y
1919
1919
  );
1920
1920
  }
1921
- R = R || "text";
1922
- let ae = await f[_.findKey(f, R) || "text"](D, b);
1923
- return !O && P && P(), await new Promise((Y, ee) => {
1924
- Mc(Y, ee, {
1921
+ k = k || "text";
1922
+ let ae = await f[_.findKey(f, k) || "text"](D, b);
1923
+ return !O && P && P(), await new Promise((Y, Q) => {
1924
+ Mc(Y, Q, {
1925
1925
  data: ae,
1926
1926
  headers: Et.from(D.headers),
1927
1927
  status: D.status,
@@ -2272,7 +2272,7 @@ function Tg(e) {
2272
2272
  return e.apply(null, n);
2273
2273
  };
2274
2274
  }
2275
- function kg(e) {
2275
+ function Rg(e) {
2276
2276
  return _.isObject(e) && e.isAxiosError === !0;
2277
2277
  }
2278
2278
  const ci = {
@@ -2362,7 +2362,7 @@ it.all = function(t) {
2362
2362
  return Promise.all(t);
2363
2363
  };
2364
2364
  it.spread = Tg;
2365
- it.isAxiosError = kg;
2365
+ it.isAxiosError = Rg;
2366
2366
  it.mergeConfig = Fn;
2367
2367
  it.AxiosHeaders = Et;
2368
2368
  it.formToJSON = (e) => Pc(_.isHTMLForm(e) ? new FormData(e) : e);
@@ -2389,7 +2389,7 @@ const {
2389
2389
  } = it, rl = typeof window < "u" ? window.__API_BASE_URL__ : void 0, ol = rl ? rl.replace(/\/+$/, "") : void 0;
2390
2390
  let No = null;
2391
2391
  const ui = /* @__PURE__ */ new Set();
2392
- function Rg() {
2392
+ function kg() {
2393
2393
  return No;
2394
2394
  }
2395
2395
  function sl(e) {
@@ -2436,7 +2436,7 @@ class _g {
2436
2436
  }
2437
2437
  // ---- Token Management ----
2438
2438
  getAuthToken() {
2439
- return Rg();
2439
+ return kg();
2440
2440
  }
2441
2441
  setAuthToken(t) {
2442
2442
  sl(t);
@@ -2521,12 +2521,12 @@ class _g {
2521
2521
  }
2522
2522
  const zn = new _g();
2523
2523
  function jg(e = {}) {
2524
- const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] = me(e.token ?? null), s = rt(e.headers ?? {}), [i, a] = me(!1), [c, u] = me(null), [d, f] = me(""), [h, m] = me(null), [b, v] = me(0), [g, x] = me(!1), w = rt(null), y = rt(!0), k = rt(0), S = Ye((N) => {
2524
+ const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] = me(e.token ?? null), s = rt(e.headers ?? {}), [i, a] = me(!1), [c, u] = me(null), [d, f] = me(""), [h, m] = me(null), [b, v] = me(0), [g, x] = me(!1), w = rt(null), y = rt(!0), R = rt(0), S = Ye((N) => {
2525
2525
  o(N);
2526
2526
  }, []), C = Ye(() => {
2527
2527
  var N;
2528
2528
  (N = w.current) == null || N.abort(), w.current = null, a(!1), x(!1);
2529
- }, []), R = Ye(() => {
2529
+ }, []), k = Ye(() => {
2530
2530
  f(""), m(null), u(null);
2531
2531
  }, []), E = Ye(
2532
2532
  (N, j, I) => {
@@ -2534,23 +2534,23 @@ function jg(e = {}) {
2534
2534
  const $ = new AbortController();
2535
2535
  return w.current = $, (async () => {
2536
2536
  var P, G, H, W, D, O, ae, Y;
2537
- const U = (ee) => {
2537
+ const U = (Q) => {
2538
2538
  var L;
2539
2539
  try {
2540
- const Z = JSON.parse(JSON.stringify(ee));
2541
- return (L = Z == null ? void 0 : Z.payload) != null && L.files_info && Array.isArray(Z.payload.files_info) && (Z.payload.files_info = Z.payload.files_info.map((Ee) => ({
2540
+ const ee = JSON.parse(JSON.stringify(Q));
2541
+ return (L = ee == null ? void 0 : ee.payload) != null && L.files_info && Array.isArray(ee.payload.files_info) && (ee.payload.files_info = ee.payload.files_info.map((Ee) => ({
2542
2542
  ...Ee,
2543
2543
  data: Ee != null && Ee.data ? `<base64 ${String(Ee.data).length} chars>` : Ee == null ? void 0 : Ee.data
2544
- }))), Z;
2544
+ }))), ee;
2545
2545
  } catch {
2546
- return ee;
2546
+ return Q;
2547
2547
  }
2548
2548
  };
2549
2549
  try {
2550
- let ee = {};
2550
+ let Q = {};
2551
2551
  try {
2552
2552
  if (r)
2553
- ee = { Authorization: `Bearer ${r}` };
2553
+ Q = { Authorization: `Bearer ${r}` };
2554
2554
  else if (typeof window < "u") {
2555
2555
  const je = window.__AUTH_TOKEN__, ze = ((P = window.localStorage) == null ? void 0 : P.getItem("authToken")) || null;
2556
2556
  let Ze = null;
@@ -2560,7 +2560,7 @@ function jg(e = {}) {
2560
2560
  } catch {
2561
2561
  }
2562
2562
  const Ke = je || ze || Ze || null;
2563
- Ke && (ee = { Authorization: `Bearer ${Ke}` });
2563
+ Ke && (Q = { Authorization: `Bearer ${Ke}` });
2564
2564
  }
2565
2565
  } catch {
2566
2566
  }
@@ -2574,7 +2574,7 @@ function jg(e = {}) {
2574
2574
  headers: {
2575
2575
  "Content-Type": "application/json",
2576
2576
  Accept: "text/event-stream",
2577
- ...ee,
2577
+ ...Q,
2578
2578
  ...s.current
2579
2579
  },
2580
2580
  body: JSON.stringify(N),
@@ -2591,8 +2591,8 @@ function jg(e = {}) {
2591
2591
  );
2592
2592
  }
2593
2593
  x(!0);
2594
- const Z = L.body.getReader(), Ee = new TextDecoder();
2595
- let Q = "", V = [], A = k.current, q = null;
2594
+ const ee = L.body.getReader(), Ee = new TextDecoder();
2595
+ let Z = "", V = [], A = R.current, q = null;
2596
2596
  const te = () => {
2597
2597
  if (V.length) {
2598
2598
  const ve = V.join("");
@@ -2613,15 +2613,15 @@ function jg(e = {}) {
2613
2613
  try {
2614
2614
  const ve = L.headers.get("X-Thread-Id") || L.headers.get("x-thread-id"), je = L.headers.get("X-Thread-Created") || L.headers.get("x-thread-created"), ze = ve ?? null, Ze = String(je ?? "").toLowerCase() === "true";
2615
2615
  for ((W = I == null ? void 0 : I.onOpen) == null || W.call(I, { threadId: ze, created: Ze }); ; ) {
2616
- const { value: Ke, done: at } = await Z.read();
2616
+ const { value: Ke, done: at } = await ee.read();
2617
2617
  if (at) break;
2618
- Q += Ee.decode(Ke, { stream: !0 }), Q.length > Le && (Q = "", console.warn("Stream buffer reset: exceeded 1MB"));
2618
+ Z += Ee.decode(Ke, { stream: !0 }), Z.length > Le && (Z = "", console.warn("Stream buffer reset: exceeded 1MB"));
2619
2619
  let ht;
2620
- for (; (ht = Q.indexOf(`
2620
+ for (; (ht = Z.indexOf(`
2621
2621
 
2622
2622
  `)) >= 0; ) {
2623
- const ue = Q.slice(0, ht);
2624
- Q = Q.slice(ht + 2);
2623
+ const ue = Z.slice(0, ht);
2624
+ Z = Z.slice(ht + 2);
2625
2625
  const de = Og(ue);
2626
2626
  if (!de) continue;
2627
2627
  let he;
@@ -2636,7 +2636,7 @@ function jg(e = {}) {
2636
2636
  const Pe = ye.seq;
2637
2637
  if (Pe !== void 0) {
2638
2638
  if (Pe <= A) continue;
2639
- A > 0 && Pe > A + 1 && ((D = I == null ? void 0 : I.onGap) == null || D.call(I, { from: A, to: Pe })), A = Pe, k.current = Pe, v(Pe);
2639
+ A > 0 && Pe > A + 1 && ((D = I == null ? void 0 : I.onGap) == null || D.call(I, { from: A, to: Pe })), A = Pe, R.current = Pe, v(Pe);
2640
2640
  }
2641
2641
  if (ye.type === "token" && e.autoAppendAssistant !== !1)
2642
2642
  V.push(ye.content), ce();
@@ -2655,16 +2655,16 @@ function jg(e = {}) {
2655
2655
  }
2656
2656
  } finally {
2657
2657
  try {
2658
- await Z.cancel();
2658
+ await ee.cancel();
2659
2659
  } catch {
2660
2660
  } finally {
2661
- (ae = Z.releaseLock) == null || ae.call(Z);
2661
+ (ae = ee.releaseLock) == null || ae.call(ee);
2662
2662
  }
2663
2663
  q !== null && typeof window < "u" && window.cancelAnimationFrame(q), clearInterval(Oe), a(!1), x(!1), w.current = null;
2664
2664
  }
2665
- } catch (ee) {
2666
- if (ee.name !== "AbortError") {
2667
- const L = ee.message || String(ee);
2665
+ } catch (Q) {
2666
+ if (Q.name !== "AbortError") {
2667
+ const L = Q.message || String(Q);
2668
2668
  u(L), (Y = I == null ? void 0 : I.onError) == null || Y.call(I, L);
2669
2669
  }
2670
2670
  } finally {
@@ -2686,7 +2686,7 @@ function jg(e = {}) {
2686
2686
  connected: g,
2687
2687
  stream: E,
2688
2688
  stop: C,
2689
- clear: R,
2689
+ clear: k,
2690
2690
  setToken: S
2691
2691
  };
2692
2692
  }
@@ -2715,7 +2715,8 @@ function Dg(e, t) {
2715
2715
  var n;
2716
2716
  switch (t.type) {
2717
2717
  case "reset":
2718
- return {
2718
+ console.log("[MessageReducer] 🔄 RESET action received"), console.log("[MessageReducer] 📊 Before reset - messages count:", e.messages.length);
2719
+ const r = {
2719
2720
  messages: Ps(((n = t.payload) == null ? void 0 : n.messages) ?? []),
2720
2721
  assemblingId: null,
2721
2722
  lastCheckpointId: null,
@@ -2723,46 +2724,47 @@ function Dg(e, t) {
2723
2724
  toolIndex: {},
2724
2725
  lastBranch: null
2725
2726
  };
2727
+ return console.log("[MessageReducer] 📊 After reset - messages count:", r.messages.length), r;
2726
2728
  case "seed": {
2727
- const r = Ps(t.payload.messages), o = {
2729
+ const o = Ps(t.payload.messages), s = {
2728
2730
  ...e,
2729
- messages: r,
2731
+ messages: o,
2730
2732
  // REPLACE with incoming messages (don't merge with existing)
2731
2733
  assemblingId: null
2732
2734
  // Clear any streaming state on seed
2733
2735
  };
2734
- return Object.prototype.hasOwnProperty.call(t.payload, "checkpointId") && (o.lastCheckpointId = t.payload.checkpointId ?? null), Object.prototype.hasOwnProperty.call(t.payload, "checkpointNs") && (o.lastCheckpointNs = t.payload.checkpointNs ?? null), console.log("[MessageReducer] seed action (REPLACE mode):", {
2736
+ return Object.prototype.hasOwnProperty.call(t.payload, "checkpointId") && (s.lastCheckpointId = t.payload.checkpointId ?? null), Object.prototype.hasOwnProperty.call(t.payload, "checkpointNs") && (s.lastCheckpointNs = t.payload.checkpointNs ?? null), console.log("[MessageReducer] seed action (REPLACE mode):", {
2735
2737
  incomingCount: t.payload.messages.length,
2736
- sanitizedCount: r.length,
2738
+ sanitizedCount: o.length,
2737
2739
  previousCount: e.messages.length,
2738
- checkpointId: o.lastCheckpointId
2739
- }), o;
2740
+ checkpointId: s.lastCheckpointId
2741
+ }), s;
2740
2742
  }
2741
2743
  case "prepend": {
2742
- const r = Ps(t.payload.messages);
2743
- if (!r.length)
2744
+ const o = Ps(t.payload.messages);
2745
+ if (!o.length)
2744
2746
  return console.log("[MessageReducer] No incoming messages after sanitize - skipping"), e;
2745
- const o = new Set(e.messages.map((i) => i.id)), s = r.filter((i) => !o.has(i.id));
2747
+ const s = new Set(e.messages.map((a) => a.id)), i = o.filter((a) => !s.has(a.id));
2746
2748
  return console.log("[MessageReducer] After dedup:", {
2747
- uniqueCount: s.length,
2748
- duplicates: r.length - s.length,
2749
- finalTotal: s.length + e.messages.length
2750
- }), s.length ? { ...e, messages: [...s, ...e.messages] } : (console.log("[MessageReducer] All messages were duplicates - skipping"), e);
2749
+ uniqueCount: i.length,
2750
+ duplicates: o.length - i.length,
2751
+ finalTotal: i.length + e.messages.length
2752
+ }), i.length ? { ...e, messages: [...i, ...e.messages] } : (console.log("[MessageReducer] All messages were duplicates - skipping"), e);
2751
2753
  }
2752
2754
  case "user_message": {
2753
- const r = t.payload.message;
2755
+ const o = t.payload.message;
2754
2756
  if (e.assemblingId) {
2755
- const o = e.messages.findIndex((s) => s.id === e.assemblingId);
2756
- if (o !== -1)
2757
- return { ...e, messages: [...e.messages.slice(0, o), r, ...e.messages.slice(o)] };
2757
+ const s = e.messages.findIndex((i) => i.id === e.assemblingId);
2758
+ if (s !== -1)
2759
+ return { ...e, messages: [...e.messages.slice(0, s), o, ...e.messages.slice(s)] };
2758
2760
  }
2759
- return { ...e, messages: [...e.messages, r] };
2761
+ return { ...e, messages: [...e.messages, o] };
2760
2762
  }
2761
2763
  case "event":
2762
2764
  return il(e, t.payload.ev);
2763
2765
  case "batch": {
2764
- const { events: r } = t.payload;
2765
- return r.length ? r.reduce((o, s) => il(o, s), e) : e;
2766
+ const { events: o } = t.payload;
2767
+ return o.length ? o.reduce((s, i) => il(s, i), e) : e;
2766
2768
  }
2767
2769
  default:
2768
2770
  return e;
@@ -2999,9 +3001,9 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2999
3001
  }, [u, b]);
3000
3002
  const x = Ye((M) => {
3001
3003
  u.setAuthToken(M);
3002
- }, [u]), { state: w, seed: y, prepend: k, pushUser: S, onEvent: C, reset: R } = Lg(), E = 20, [N, j] = me(!1), [I, $] = me(!1), [U, P] = me(null), [G, H] = me(void 0), [W, D] = me(void 0), O = rt(!1), ae = rt([]), Y = Ye((M) => {
3004
+ }, [u]), { state: w, seed: y, prepend: R, pushUser: S, onEvent: C, reset: k } = Lg(), E = 20, [N, j] = me(!1), [I, $] = me(!1), [U, P] = me(null), [G, H] = me(void 0), [W, D] = me(void 0), O = rt(!1), ae = rt([]), Y = Ye((M) => {
3003
3005
  M.cursor !== void 0 && P(M.cursor), M.hasMore !== void 0 && j(M.hasMore), M.checkpointId !== void 0 && H(M.checkpointId), M.checkpointNs !== void 0 && D(M.checkpointNs);
3004
- }, []), ee = Ye((M, X) => new Promise((ke, He) => {
3006
+ }, []), Q = Ye((M, X) => new Promise((Re, He) => {
3005
3007
  const Se = async () => {
3006
3008
  if (O.current) {
3007
3009
  console.warn(`[ChatProvider] Operation "${X}" queued - another operation in progress`), ae.current.push(Se);
@@ -3009,7 +3011,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3009
3011
  }
3010
3012
  O.current = !0;
3011
3013
  try {
3012
- console.log(`[ChatProvider] Executing operation: ${X}`), await M(), ke();
3014
+ console.log(`[ChatProvider] Executing operation: ${X}`), await M(), Re();
3013
3015
  } catch (nt) {
3014
3016
  console.error(`[ChatProvider] Operation "${X}" failed:`, nt), He(nt);
3015
3017
  } finally {
@@ -3024,19 +3026,19 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3024
3026
  });
3025
3027
  }), []), L = Ye(
3026
3028
  (M, X) => {
3027
- const ke = Array.isArray(M == null ? void 0 : M.messages) ? M.messages : [];
3028
- X === "replace" ? (console.log("[ChatProvider] Replacing messages, count:", ke.length), y(ke, {
3029
+ const Re = Array.isArray(M == null ? void 0 : M.messages) ? M.messages : [];
3030
+ X === "replace" ? (console.log("[ChatProvider] Replacing messages, count:", Re.length), y(Re, {
3029
3031
  checkpointId: (M == null ? void 0 : M.checkpointId) ?? null,
3030
3032
  checkpointNs: (M == null ? void 0 : M.checkpointNs) ?? null
3031
- })) : X === "prepend" && ke.length ? (console.log("[ChatProvider] Calling prepend with", ke.length, "messages"), k(ke)) : console.log("[ChatProvider] Skipping prepend - empty list or wrong mode"), P((M == null ? void 0 : M.nextCursor) ?? null), j(!!(M != null && M.hasMore)), H((He) => (M == null ? void 0 : M.checkpointId) ?? He ?? void 0), D((He) => (M == null ? void 0 : M.checkpointNs) ?? He ?? void 0);
3033
+ })) : X === "prepend" && Re.length ? (console.log("[ChatProvider] Calling prepend with", Re.length, "messages"), R(Re)) : console.log("[ChatProvider] Skipping prepend - empty list or wrong mode"), P((M == null ? void 0 : M.nextCursor) ?? null), j(!!(M != null && M.hasMore)), H((He) => (M == null ? void 0 : M.checkpointId) ?? He ?? void 0), D((He) => (M == null ? void 0 : M.checkpointNs) ?? He ?? void 0);
3032
3034
  },
3033
- [y, k]
3034
- ), [Z, Ee] = me([]), [Q, V] = me(null), A = Ye(async () => {
3035
+ [y, R]
3036
+ ), [ee, Ee] = me([]), [Z, V] = me(null), A = Ye(async () => {
3035
3037
  const M = await u.listThreads();
3036
3038
  Ee(M);
3037
3039
  }, [u]), [q, te] = me(!1), ce = Ye(
3038
3040
  async (M) => {
3039
- const X = (M == null ? void 0 : M.maxAttempts) ?? 5, ke = (M == null ? void 0 : M.baseDelayMs) ?? 500, He = (M == null ? void 0 : M.timeoutMs) ?? 2e3;
3041
+ const X = (M == null ? void 0 : M.maxAttempts) ?? 5, Re = (M == null ? void 0 : M.baseDelayMs) ?? 500, He = (M == null ? void 0 : M.timeoutMs) ?? 2e3;
3040
3042
  if (!u.baseUrl) return !1;
3041
3043
  const Se = u.baseUrl.replace(/\/+$/, ""), nt = [
3042
3044
  "/health",
@@ -3069,7 +3071,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3069
3071
  if (console.debug(`[ChatProvider] checking ${pn}`), await Mt(pn) || pt === "/" && await _n(Se + "/"))
3070
3072
  return te(!0), !0;
3071
3073
  }
3072
- const Nt = ke * Math.pow(2, gt);
3074
+ const Nt = Re * Math.pow(2, gt);
3073
3075
  await new Promise((pt) => setTimeout(pt, Nt));
3074
3076
  }
3075
3077
  return te(!1), !1;
@@ -3094,8 +3096,8 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3094
3096
  M = !1;
3095
3097
  };
3096
3098
  }, [A, u.baseUrl, ce]), ct(() => {
3097
- r == null || r(Q);
3098
- }, [Q, r]);
3099
+ r == null || r(Z);
3100
+ }, [Z, r]);
3099
3101
  const oe = rt(null);
3100
3102
  ct(() => {
3101
3103
  if (o && s) {
@@ -3112,8 +3114,8 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3112
3114
  }
3113
3115
  }, [o, s, u.baseUrl, q]);
3114
3116
  const Oe = rt(null), Le = rt(null), ve = Ye(
3115
- async (M, X, ke) => {
3116
- await ee(async () => {
3117
+ async (M, X, Re) => {
3118
+ await Q(async () => {
3117
3119
  if (!u.baseUrl) {
3118
3120
  console.debug("[ChatProvider] skipping loadThread: api.baseUrl not configured");
3119
3121
  return;
@@ -3122,7 +3124,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3122
3124
  console.warn(`[ChatProvider] Thread load cancelled - another thread (${Oe.current}) is loading`);
3123
3125
  return;
3124
3126
  }
3125
- Le.current !== null && Le.current !== M && (console.log(`[ChatProvider] Thread switch detected: ${Le.current} -> ${M}`), R([])), Oe.current = M, Le.current = M;
3127
+ Le.current !== null && Le.current !== M && (console.log(`[ChatProvider] Thread switch detected: ${Le.current} -> ${M}`), k([])), Oe.current = M, Le.current = M;
3126
3128
  try {
3127
3129
  Y({
3128
3130
  cursor: null,
@@ -3133,7 +3135,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3133
3135
  const Se = await u.getMessages({
3134
3136
  threadId: M,
3135
3137
  checkpointId: X,
3136
- checkpointNs: ke,
3138
+ checkpointNs: Re,
3137
3139
  limit: E
3138
3140
  }), nt = Array.isArray(Se == null ? void 0 : Se.messages) ? Se.messages : [];
3139
3141
  console.log("[ChatProvider] Loading thread with", nt.length, "messages"), y(nt, {
@@ -3145,62 +3147,66 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3145
3147
  }
3146
3148
  }, `loadThread-${M}`);
3147
3149
  },
3148
- [u, ee, Y, y]
3150
+ [u, Q, Y, y]
3149
3151
  ), je = Ye(async (M) => {
3150
3152
  const X = await u.listCheckpoints(M);
3151
3153
  return Ug(X, M);
3152
3154
  }, [u]), ze = Ye(async (M, X) => {
3153
- await ee(async () => {
3154
- if (!Q) throw new Error("No active thread");
3155
+ await Q(async () => {
3156
+ if (!Z) throw new Error("No active thread");
3155
3157
  Y({
3156
3158
  cursor: null,
3157
3159
  hasMore: !1,
3158
3160
  checkpointId: void 0,
3159
3161
  checkpointNs: void 0
3160
3162
  });
3161
- const ke = await u.getMessages({
3162
- threadId: Q,
3163
+ const Re = await u.getMessages({
3164
+ threadId: Z,
3163
3165
  checkpointId: M,
3164
3166
  checkpointNs: X ?? void 0,
3165
3167
  limit: E
3166
3168
  });
3167
- L(ke, "replace");
3169
+ L(Re, "replace");
3168
3170
  }, `navigateToCheckpoint-${M}`);
3169
- }, [u, Q, L, ee, Y]), Ze = Ye(async () => {
3170
- if (!Q) throw new Error("No active thread");
3171
- await ve(Q);
3172
- }, [Q, ve]), Ke = rt(!1);
3171
+ }, [u, Z, L, Q, Y]), Ze = Ye(async () => {
3172
+ if (!Z) throw new Error("No active thread");
3173
+ await ve(Z);
3174
+ }, [Z, ve]), Ke = rt(!1);
3173
3175
  ct(() => {
3174
3176
  const M = Ke.current;
3175
- Ke.current = d, M && !d && Q && ee(async () => {
3177
+ Ke.current = d, M && !d && Z && Q(async () => {
3176
3178
  try {
3177
3179
  await A();
3178
3180
  } catch (X) {
3179
3181
  console.warn("[ChatProvider] Post-streaming thread refresh failed:", X);
3180
3182
  }
3181
3183
  }, "postStreamingRefresh");
3182
- }, [d, Q, u, L, A, ee]);
3184
+ }, [d, Z, u, L, A, Q]);
3183
3185
  const at = Ye(() => {
3184
- V(null), R([]), Y({
3186
+ console.log("[ChatProvider] 🔄 clearCurrentThread called"), console.log("[ChatProvider] 📊 Before clear - currentThreadId:", Z), console.log("[ChatProvider] 📊 Before clear - messages count:", w.messages.length), Q(() => (console.log("[ChatProvider] 🚀 Executing atomic clear operation"), V(null), k([]), Y({
3185
3187
  cursor: null,
3186
3188
  hasMore: !1,
3187
3189
  checkpointId: void 0,
3188
3190
  checkpointNs: void 0
3189
- }), typeof window < "u" && localStorage.removeItem("currentThreadId");
3190
- }, [R, Y]), ht = Ye(async (M) => {
3191
+ }), typeof window < "u" && localStorage.removeItem("currentThreadId"), console.log("[ChatProvider] ✅ Atomic clear operation completed"), Promise.resolve()), "clearCurrentThread").catch((M) => {
3192
+ console.error("[ChatProvider] Clear operation failed:", M);
3193
+ }), setTimeout(() => {
3194
+ console.log("[ChatProvider] 📊 After clear - currentThreadId:", Z), console.log("[ChatProvider] 📊 After clear - messages count:", w.messages.length);
3195
+ }, 50);
3196
+ }, [k, Y, Z, w.messages.length, Q]), ht = Ye(async (M) => {
3191
3197
  at();
3192
3198
  const X = await u.createThread(M);
3193
3199
  return await A(), await ve(X.threadId), X.threadId;
3194
3200
  }, [u, A, ve, at]), ue = Ye(async (M) => {
3195
- await u.deleteThread(M), await A(), Q === M && (V(null), R([]), j(!1), P(null), H(void 0), D(void 0));
3196
- }, [u, A, Q, R]), de = Ye(async (M, X) => {
3201
+ await u.deleteThread(M), await A(), Z === M && (V(null), k([]), j(!1), P(null), H(void 0), D(void 0));
3202
+ }, [u, A, Z, k]), de = Ye(async (M, X) => {
3197
3203
  await u.updateThread(M, X), await A();
3198
3204
  }, [u, A]), he = Ye(async (M, X) => {
3199
- await ee(async () => {
3205
+ await Q(async () => {
3200
3206
  var pe;
3201
- const ke = (X == null ? void 0 : X.attachments) || [], { contentParts: He, filesInfo: Se } = await Vg(
3207
+ const Re = (X == null ? void 0 : X.attachments) || [], { contentParts: He, filesInfo: Se } = await Vg(
3202
3208
  u,
3203
- ke,
3209
+ Re,
3204
3210
  t == null ? void 0 : t.uploadPath
3205
3211
  ), nt = [];
3206
3212
  M && M.trim() && nt.push({ type: "text", text: M.trim() });
@@ -3219,8 +3225,8 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3219
3225
  // No need to filter - messageContent already only contains text
3220
3226
  content: nt
3221
3227
  // ← Clean content without empty parts
3222
- }, gt = { ...(X == null ? void 0 : X.payloadExtras) ?? {} }, Nt = !!gt.edit, pt = gt.originalMessageId, yt = typeof pt == "string" ? pt : void 0, pn = ke && ke.length > 0, se = {
3223
- ...Q ? { threadId: Q } : {},
3228
+ }, gt = { ...(X == null ? void 0 : X.payloadExtras) ?? {} }, Nt = !!gt.edit, pt = gt.originalMessageId, yt = typeof pt == "string" ? pt : void 0, pn = Re && Re.length > 0, se = {
3229
+ ...Z ? { threadId: Z } : {},
3224
3230
  payload: {
3225
3231
  messages: [_n],
3226
3232
  // Remove attachments array since we're not including file parts in message content
@@ -3241,41 +3247,41 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3241
3247
  {
3242
3248
  onError: (Ie) => console.warn("stream error", Ie),
3243
3249
  onOpen: ({ threadId: Ie, created: qe }) => {
3244
- !Q && Ie && (V(Ie), qe && A().catch(() => {
3250
+ !Z && Ie && (V(Ie), qe && A().catch(() => {
3245
3251
  }));
3246
3252
  }
3247
3253
  }
3248
3254
  );
3249
3255
  }, "send");
3250
- }, [Q, S, h, C, w.lastCheckpointId, w.lastCheckpointNs, u, t == null ? void 0 : t.uploadPath, A, V, a, c, ee]), ye = Ye(
3256
+ }, [Z, S, h, C, w.lastCheckpointId, w.lastCheckpointNs, u, t == null ? void 0 : t.uploadPath, A, V, a, c, Q]), ye = Ye(
3251
3257
  async (M) => {
3252
- if (!Q) throw new Error("No active thread");
3258
+ if (!Z) throw new Error("No active thread");
3253
3259
  if (I || !N) return;
3254
3260
  const X = U;
3255
3261
  if (X) {
3256
3262
  $(!0);
3257
3263
  try {
3258
- const ke = await u.getMessages({
3259
- threadId: Q,
3264
+ const Re = await u.getMessages({
3265
+ threadId: Z,
3260
3266
  checkpointId: G,
3261
3267
  checkpointNs: W,
3262
3268
  limit: (M == null ? void 0 : M.limit) ?? E,
3263
3269
  beforeId: X
3264
3270
  });
3265
- L(ke, "prepend");
3271
+ L(Re, "prepend");
3266
3272
  } finally {
3267
3273
  $(!1);
3268
3274
  }
3269
3275
  }
3270
3276
  },
3271
- [u, Q, G, W, U, N, I, L, E]
3277
+ [u, Z, G, W, U, N, I, L, E]
3272
3278
  ), Pe = {
3273
3279
  baseUrl: u.baseUrl,
3274
3280
  token: v,
3275
3281
  setToken: x,
3276
3282
  api: u,
3277
- threads: Z,
3278
- currentThreadId: Q,
3283
+ threads: ee,
3284
+ currentThreadId: Z,
3279
3285
  setCurrentThreadId: V,
3280
3286
  messages: w.messages,
3281
3287
  isStreaming: d,
@@ -3404,12 +3410,12 @@ function qg({
3404
3410
  [h, i, f]
3405
3411
  ), y = z.useCallback((E) => {
3406
3412
  m(E.target.value), g.current && (g.current.style.height = "auto", g.current.style.height = `${g.current.scrollHeight}px`);
3407
- }, []), k = z.useCallback(
3413
+ }, []), R = z.useCallback(
3408
3414
  (E) => {
3409
3415
  E.key === "Enter" && !E.shiftKey ? (E.preventDefault(), w()) : E.key === "Escape" && t && (E.preventDefault(), a == null || a());
3410
3416
  },
3411
3417
  [w, t, a]
3412
- ), R = `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${t ? "border-[hsl(var(--ring))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] dark:bg-[hsl(var(--card))] dark:text-[hsl(var(--card-foreground))]" : ""} ${d}`;
3418
+ ), k = `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${t ? "border-[hsl(var(--ring))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] dark:bg-[hsl(var(--card))] dark:text-[hsl(var(--card-foreground))]" : ""} ${d}`;
3413
3419
  return /* @__PURE__ */ l.jsx("form", { onSubmit: (E) => void w(E), className: `w-full ${u}`, children: /* @__PURE__ */ l.jsxs("div", { className: "flex items-end gap-2", children: [
3414
3420
  /* @__PURE__ */ l.jsx("div", { className: "flex-1", children: /* @__PURE__ */ l.jsx(
3415
3421
  Vc,
@@ -3417,9 +3423,9 @@ function qg({
3417
3423
  ref: g,
3418
3424
  value: h,
3419
3425
  onChange: y,
3420
- onKeyDown: k,
3426
+ onKeyDown: R,
3421
3427
  placeholder: t ? "Edit your message..." : n,
3422
- className: R,
3428
+ className: k,
3423
3429
  disabled: o,
3424
3430
  maxLength: s,
3425
3431
  rows: 1,
@@ -3449,12 +3455,12 @@ function qg({
3449
3455
  className: "shrink-0",
3450
3456
  title: t ? "Save changes" : "Send message",
3451
3457
  disabled: o || !h.trim() && !f || b,
3452
- children: /* @__PURE__ */ l.jsx(kp, { size: 16 })
3458
+ children: /* @__PURE__ */ l.jsx(Rp, { size: 16 })
3453
3459
  }
3454
3460
  ) })
3455
3461
  ] }) });
3456
3462
  }
3457
- const Gg = z.memo(qg), es = 0, Rn = 1, pr = 2, Kc = 4;
3463
+ const Gg = z.memo(qg), es = 0, kn = 1, pr = 2, Kc = 4;
3458
3464
  function ll(e) {
3459
3465
  return () => e;
3460
3466
  }
@@ -3490,7 +3496,7 @@ function et(...e) {
3490
3496
  return e;
3491
3497
  }
3492
3498
  function Ve(e, t) {
3493
- return e(Rn, t);
3499
+ return e(kn, t);
3494
3500
  }
3495
3501
  function Ae(e, t) {
3496
3502
  e(es, t);
@@ -3505,7 +3511,7 @@ function fe(e, t) {
3505
3511
  return Ve(e, Xg(t, es));
3506
3512
  }
3507
3513
  function qt(e, t) {
3508
- const n = e(Rn, (r) => {
3514
+ const n = e(kn, (r) => {
3509
3515
  n(), t(r);
3510
3516
  });
3511
3517
  return n;
@@ -3547,7 +3553,7 @@ function F(e, ...t) {
3547
3553
  case pr:
3548
3554
  Bi(e);
3549
3555
  return;
3550
- case Rn:
3556
+ case kn:
3551
3557
  return Ve(e, n(o));
3552
3558
  }
3553
3559
  };
@@ -3595,7 +3601,7 @@ function ex(e) {
3595
3601
  const r = () => t == null ? void 0 : t();
3596
3602
  return function(o, s) {
3597
3603
  switch (o) {
3598
- case Rn:
3604
+ case kn:
3599
3605
  return s ? n === s ? void 0 : (r(), n = s, t = Ve(e, s), t) : (r(), mr);
3600
3606
  case pr:
3601
3607
  r(), n = null;
@@ -3611,7 +3617,7 @@ function K(e) {
3611
3617
  case es:
3612
3618
  t = o;
3613
3619
  break;
3614
- case Rn: {
3620
+ case kn: {
3615
3621
  o(t);
3616
3622
  break;
3617
3623
  }
@@ -3636,7 +3642,7 @@ function $e() {
3636
3642
  case pr:
3637
3643
  e.splice(0, e.length);
3638
3644
  return;
3639
- case Rn:
3645
+ case kn:
3640
3646
  return e.push(n), () => {
3641
3647
  const r = e.indexOf(n);
3642
3648
  r > -1 && e.splice(r, 1);
@@ -3680,7 +3686,7 @@ function ut(...e) {
3680
3686
  Bi(t);
3681
3687
  return;
3682
3688
  }
3683
- case Rn:
3689
+ case kn:
3684
3690
  return r === o && i(n), Ve(t, i);
3685
3691
  }
3686
3692
  };
@@ -3693,7 +3699,7 @@ function di(...e) {
3693
3699
  switch (t) {
3694
3700
  case pr:
3695
3701
  return;
3696
- case Rn:
3702
+ case kn:
3697
3703
  return Jg(...e.map((r) => Ve(r, n)));
3698
3704
  }
3699
3705
  };
@@ -4202,8 +4208,8 @@ const vx = {
4202
4208
  c,
4203
4209
  be((S) => S.length > 0),
4204
4210
  _e(v, m),
4205
- re(([S, C, R]) => {
4206
- const E = S.reduce((N, j, I) => _t(N, j, Mr(j, C.offsetTree, R) || I), or());
4211
+ re(([S, C, k]) => {
4212
+ const E = S.reduce((N, j, I) => _t(N, j, Mr(j, C.offsetTree, k) || I), or());
4207
4213
  return {
4208
4214
  ...C,
4209
4215
  groupIndices: S,
@@ -4217,10 +4223,10 @@ const vx = {
4217
4223
  r,
4218
4224
  _e(v),
4219
4225
  be(([S, { lastIndex: C }]) => S < C),
4220
- re(([S, { lastIndex: C, lastSize: R }]) => [
4226
+ re(([S, { lastIndex: C, lastSize: k }]) => [
4221
4227
  {
4222
4228
  endIndex: C,
4223
- size: R,
4229
+ size: k,
4224
4230
  startIndex: S
4225
4231
  }
4226
4232
  ])
@@ -4247,9 +4253,9 @@ const vx = {
4247
4253
  n,
4248
4254
  _e(v),
4249
4255
  on(
4250
- ({ sizes: S }, [C, R]) => ({
4251
- changed: R !== S,
4252
- sizes: R
4256
+ ({ sizes: S }, [C, k]) => ({
4257
+ changed: k !== S,
4258
+ sizes: k
4253
4259
  }),
4254
4260
  { changed: !1, sizes: b }
4255
4261
  ),
@@ -4270,8 +4276,8 @@ const vx = {
4270
4276
  if (S > 0)
4271
4277
  Ae(t, !0), Ae(s, S + hl(S, C));
4272
4278
  else if (S < 0) {
4273
- const R = st(g);
4274
- R.length > 0 && (S -= hl(-S, R)), Ae(i, S);
4279
+ const k = st(g);
4280
+ k.length > 0 && (S -= hl(-S, k)), Ae(i, S);
4275
4281
  }
4276
4282
  }
4277
4283
  ), Ve(F(a, _e(e)), ([S, C]) => {
@@ -4287,8 +4293,8 @@ const vx = {
4287
4293
  s,
4288
4294
  _e(v),
4289
4295
  re(([S, C]) => {
4290
- const R = C.groupIndices.length > 0, E = [], N = C.lastSize;
4291
- if (R) {
4296
+ const k = C.groupIndices.length > 0, E = [], N = C.lastSize;
4297
+ if (k) {
4292
4298
  const j = Pr(C.sizeTree, 0);
4293
4299
  let I = 0, $ = 0;
4294
4300
  for (; I < S; ) {
@@ -4343,13 +4349,13 @@ const vx = {
4343
4349
  ),
4344
4350
  n
4345
4351
  );
4346
- const k = jt(
4352
+ const R = jt(
4347
4353
  F(
4348
4354
  i,
4349
4355
  _e(v, m),
4350
- re(([S, { offsetTree: C }, R]) => {
4356
+ re(([S, { offsetTree: C }, k]) => {
4351
4357
  const E = -S;
4352
- return Mr(E, C, R);
4358
+ return Mr(E, C, k);
4353
4359
  })
4354
4360
  )
4355
4361
  );
@@ -4357,7 +4363,7 @@ const vx = {
4357
4363
  F(
4358
4364
  i,
4359
4365
  _e(v, m),
4360
- re(([S, C, R]) => {
4366
+ re(([S, C, k]) => {
4361
4367
  if (C.groupIndices.length > 0) {
4362
4368
  if (Xe(C.sizeTree))
4363
4369
  return C;
@@ -4378,14 +4384,14 @@ const vx = {
4378
4384
  return {
4379
4385
  ...C,
4380
4386
  sizeTree: E,
4381
- ...mi(C.offsetTree, 0, E, R)
4387
+ ...mi(C.offsetTree, 0, E, k)
4382
4388
  };
4383
4389
  } else {
4384
4390
  const E = Dn(C.sizeTree).reduce((N, { k: j, v: I }) => _t(N, Math.max(0, j + S), I), or());
4385
4391
  return {
4386
4392
  ...C,
4387
4393
  sizeTree: E,
4388
- ...mi(C.offsetTree, 0, E, R)
4394
+ ...mi(C.offsetTree, 0, E, k)
4389
4395
  };
4390
4396
  }
4391
4397
  })
@@ -4403,7 +4409,7 @@ const vx = {
4403
4409
  itemSize: f,
4404
4410
  listRefresh: w,
4405
4411
  shiftWith: i,
4406
- shiftWithOffset: k,
4412
+ shiftWithOffset: R,
4407
4413
  sizeRanges: n,
4408
4414
  // output
4409
4415
  sizes: v,
@@ -4499,26 +4505,26 @@ const Kr = Be(
4499
4505
  _e(e, s, o),
4500
4506
  re(
4501
4507
  ([
4502
- [k, S, C, R, E, N, j, I],
4508
+ [R, S, C, k, E, N, j, I],
4503
4509
  $,
4504
4510
  U,
4505
4511
  P
4506
4512
  ]) => {
4507
- const G = iu(k), { align: H, behavior: W, offset: D } = G, O = R - 1, ae = ou(G, S, O);
4513
+ const G = iu(R), { align: H, behavior: W, offset: D } = G, O = k - 1, ae = ou(G, S, O);
4508
4514
  let Y = Mr(ae, S.offsetTree, $) + N;
4509
4515
  H === "end" ? (Y += U + Gt(S.sizeTree, ae)[1] - C + P, ae === O && (Y += j)) : H === "center" ? Y += (U + Gt(S.sizeTree, ae)[1] - C + P) / 2 : Y -= E, D && (Y += D);
4510
- const ee = (L) => {
4511
- y(), L ? (I("retrying to scroll to", { location: k }, It.DEBUG), Ae(m, k)) : (Ae(b, !0), I("list did not change, scroll successful", {}, It.DEBUG));
4516
+ const Q = (L) => {
4517
+ y(), L ? (I("retrying to scroll to", { location: R }, It.DEBUG), Ae(m, R)) : (Ae(b, !0), I("list did not change, scroll successful", {}, It.DEBUG));
4512
4518
  };
4513
4519
  if (y(), W === "smooth") {
4514
4520
  let L = !1;
4515
- w = Ve(t, (Z) => {
4516
- L = L || Z;
4521
+ w = Ve(t, (ee) => {
4522
+ L = L || ee;
4517
4523
  }), g = qt(d, () => {
4518
- ee(L);
4524
+ Q(L);
4519
4525
  });
4520
4526
  } else
4521
- g = qt(F(t, yx(150)), ee);
4527
+ g = qt(F(t, yx(150)), Q);
4522
4528
  return x = setTimeout(() => {
4523
4529
  y();
4524
4530
  }, 1200), Ae(c, !0), I("scrolling from index to", { behavior: W, index: ae, top: Y }, It.DEBUG), { behavior: W, top: Y };
@@ -4632,15 +4638,15 @@ const Dr = "up", Nr = "down", Sx = "none", Cx = {
4632
4638
  const b = jt(
4633
4639
  F(
4634
4640
  ut(r, we(s), we(t), we(e), we(d)),
4635
- on((w, [{ scrollHeight: y, scrollTop: k }, S, C, R, E]) => {
4636
- const N = k + S - y > -E, j = {
4641
+ on((w, [{ scrollHeight: y, scrollTop: R }, S, C, k, E]) => {
4642
+ const N = R + S - y > -E, j = {
4637
4643
  scrollHeight: y,
4638
- scrollTop: k,
4644
+ scrollTop: R,
4639
4645
  viewportHeight: S
4640
4646
  };
4641
4647
  if (N) {
4642
4648
  let $, U;
4643
- return k > w.state.scrollTop ? ($ = "SCROLLED_DOWN", U = w.state.scrollTop - k) : ($ = "SIZE_DECREASED", U = w.state.scrollTop - k || w.scrollTopDelta), {
4649
+ return R > w.state.scrollTop ? ($ = "SCROLLED_DOWN", U = w.state.scrollTop - R) : ($ = "SIZE_DECREASED", U = w.state.scrollTop - R || w.scrollTopDelta), {
4644
4650
  atBottom: !0,
4645
4651
  atBottomBecause: $,
4646
4652
  scrollTopDelta: U,
@@ -4648,7 +4654,7 @@ const Dr = "up", Nr = "down", Sx = "none", Cx = {
4648
4654
  };
4649
4655
  }
4650
4656
  let I;
4651
- return j.scrollHeight > w.state.scrollHeight ? I = "SIZE_INCREASED" : S < w.state.viewportHeight ? I = "VIEWPORT_HEIGHT_DECREASING" : k < w.state.scrollTop ? I = "SCROLLING_UPWARDS" : I = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
4657
+ return j.scrollHeight > w.state.scrollHeight ? I = "SIZE_INCREASED" : S < w.state.viewportHeight ? I = "VIEWPORT_HEIGHT_DECREASING" : R < w.state.scrollTop ? I = "SCROLLING_UPWARDS" : I = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
4652
4658
  atBottom: !1,
4653
4659
  notAtBottomBecause: I,
4654
4660
  state: j
@@ -4660,26 +4666,26 @@ const Dr = "up", Nr = "down", Sx = "none", Cx = {
4660
4666
  F(
4661
4667
  r,
4662
4668
  on(
4663
- (w, { scrollHeight: y, scrollTop: k, viewportHeight: S }) => {
4669
+ (w, { scrollHeight: y, scrollTop: R, viewportHeight: S }) => {
4664
4670
  if (au(w.scrollHeight, y))
4665
4671
  return {
4666
4672
  changed: !1,
4667
4673
  jump: 0,
4668
4674
  scrollHeight: y,
4669
- scrollTop: k
4675
+ scrollTop: R
4670
4676
  };
4671
4677
  {
4672
- const C = y - (k + S) < 1;
4673
- return w.scrollTop !== k && C ? {
4678
+ const C = y - (R + S) < 1;
4679
+ return w.scrollTop !== R && C ? {
4674
4680
  changed: !0,
4675
- jump: w.scrollTop - k,
4681
+ jump: w.scrollTop - R,
4676
4682
  scrollHeight: y,
4677
- scrollTop: k
4683
+ scrollTop: R
4678
4684
  } : {
4679
4685
  changed: !0,
4680
4686
  jump: 0,
4681
4687
  scrollHeight: y,
4682
- scrollTop: k
4688
+ scrollTop: R
4683
4689
  };
4684
4690
  }
4685
4691
  },
@@ -4725,7 +4731,7 @@ const Dr = "up", Nr = "down", Sx = "none", Cx = {
4725
4731
  gn(100),
4726
4732
  _e(h),
4727
4733
  be(([w, y]) => !!y),
4728
- on(([w, y], [k]) => [y, k], [0, 0]),
4734
+ on(([w, y], [R]) => [y, R], [0, 0]),
4729
4735
  re(([w, y]) => y - w)
4730
4736
  ),
4731
4737
  x
@@ -4777,12 +4783,12 @@ const qi = Be(
4777
4783
  w,
4778
4784
  y
4779
4785
  ]) => {
4780
- const k = d - w, S = g + x, C = Math.max(h - k, 0);
4781
- let R = pl;
4786
+ const R = d - w, S = g + x, C = Math.max(h - R, 0);
4787
+ let k = pl;
4782
4788
  const E = gl(y, _o), N = gl(y, jo);
4783
- return m -= w, m += h + x, b += h + x, b -= w, m > d + S - E && (R = Dr), b < d - C + f + N && (R = Nr), R !== pl ? [
4784
- Math.max(k - h - ml(v, _o, R) - E, 0),
4785
- k - C - x + f + ml(v, jo, R) + N
4789
+ return m -= w, m += h + x, b += h + x, b -= w, m > d + S - E && (k = Dr), b < d - C + f + N && (k = Nr), k !== pl ? [
4790
+ Math.max(R - h - ml(v, _o, k) - E, 0),
4791
+ R - C - x + f + ml(v, jo, k) + N
4786
4792
  ] : null;
4787
4793
  }
4788
4794
  ),
@@ -4804,7 +4810,7 @@ const qi = Be(
4804
4810
  et(Ct),
4805
4811
  { singleton: !0 }
4806
4812
  );
4807
- function kx(e, t, n) {
4813
+ function Rx(e, t, n) {
4808
4814
  if (rs(t)) {
4809
4815
  const r = ru(e, t);
4810
4816
  return [
@@ -4916,15 +4922,15 @@ const Gn = Be(
4916
4922
  we(n),
4917
4923
  e
4918
4924
  ),
4919
- be(([C, R, , E, , , , , , , N]) => {
4925
+ be(([C, k, , E, , , , , , , N]) => {
4920
4926
  const j = N && N.length !== E;
4921
- return C && !R && !j;
4927
+ return C && !k && !j;
4922
4928
  }),
4923
4929
  re(
4924
4930
  ([
4925
4931
  ,
4926
4932
  ,
4927
- [C, R],
4933
+ [C, k],
4928
4934
  E,
4929
4935
  N,
4930
4936
  j,
@@ -4937,11 +4943,11 @@ const Gn = Be(
4937
4943
  const H = N, { offsetTree: W, sizeTree: D } = H, O = st(g);
4938
4944
  if (E === 0)
4939
4945
  return { ...Ls, totalCount: E };
4940
- if (C === 0 && R === 0)
4946
+ if (C === 0 && k === 0)
4941
4947
  return O === 0 ? { ...Ls, totalCount: E } : lu(O, j, N, U, P, G || []);
4942
4948
  if (Xe(D))
4943
4949
  return O > 0 ? null : mo(
4944
- kx(Ki(j, E), H, G),
4950
+ Rx(Ki(j, E), H, G),
4945
4951
  [],
4946
4952
  E,
4947
4953
  P,
@@ -4950,36 +4956,36 @@ const Gn = Be(
4950
4956
  );
4951
4957
  const ae = [];
4952
4958
  if ($.length > 0) {
4953
- const Ee = $[0], Q = $[$.length - 1];
4959
+ const Ee = $[0], Z = $[$.length - 1];
4954
4960
  let V = 0;
4955
- for (const A of ns(D, Ee, Q)) {
4956
- const q = A.value, te = Math.max(A.start, Ee), ce = Math.min(A.end, Q);
4961
+ for (const A of ns(D, Ee, Z)) {
4962
+ const q = A.value, te = Math.max(A.start, Ee), ce = Math.min(A.end, Z);
4957
4963
  for (let oe = te; oe <= ce; oe++)
4958
4964
  ae.push({ data: G == null ? void 0 : G[oe], index: oe, offset: V, size: q }), V += q;
4959
4965
  }
4960
4966
  }
4961
4967
  if (!I)
4962
4968
  return mo([], ae, E, P, H, U);
4963
- const Y = $.length > 0 ? $[$.length - 1] + 1 : 0, ee = hx(W, C, R, Y);
4964
- if (ee.length === 0)
4969
+ const Y = $.length > 0 ? $[$.length - 1] + 1 : 0, Q = hx(W, C, k, Y);
4970
+ if (Q.length === 0)
4965
4971
  return null;
4966
- const L = E - 1, Z = ts([], (Ee) => {
4967
- for (const Q of ee) {
4968
- const V = Q.value;
4969
- let A = V.offset, q = Q.start;
4972
+ const L = E - 1, ee = ts([], (Ee) => {
4973
+ for (const Z of Q) {
4974
+ const V = Z.value;
4975
+ let A = V.offset, q = Z.start;
4970
4976
  const te = V.size;
4971
4977
  if (V.offset < C) {
4972
4978
  q += Math.floor((C - V.offset + P) / (te + P));
4973
- const oe = q - Q.start;
4979
+ const oe = q - Z.start;
4974
4980
  A += oe * te + oe * P;
4975
4981
  }
4976
4982
  q < Y && (A += (Y - q) * te, q = Y);
4977
- const ce = Math.min(Q.end, L);
4978
- for (let oe = q; oe <= ce && !(A >= R); oe++)
4983
+ const ce = Math.min(Z.end, L);
4984
+ for (let oe = q; oe <= ce && !(A >= k); oe++)
4979
4985
  Ee.push({ data: G == null ? void 0 : G[oe], index: oe, offset: A, size: te }), A += te + P;
4980
4986
  }
4981
4987
  });
4982
- return mo(Z, ae, E, P, H, U);
4988
+ return mo(ee, ae, E, P, H, U);
4983
4989
  }
4984
4990
  ),
4985
4991
  //@ts-expect-error filter needs to be fixed
@@ -5019,16 +5025,16 @@ const Gn = Be(
5019
5025
  w,
5020
5026
  be(({ items: C }) => C.length > 0),
5021
5027
  _e(o, e),
5022
- be(([{ items: C }, R]) => C[C.length - 1].originalIndex === R - 1),
5023
- re(([, C, R]) => [C - 1, R]),
5028
+ be(([{ items: C }, k]) => C[C.length - 1].originalIndex === k - 1),
5029
+ re(([, C, k]) => [C - 1, k]),
5024
5030
  Qe(Or),
5025
5031
  re(([C]) => C)
5026
5032
  )
5027
- ), k = jt(
5033
+ ), R = jt(
5028
5034
  F(
5029
5035
  w,
5030
5036
  gn(200),
5031
- be(({ items: C, topItems: R }) => C.length > 0 && C[0].originalIndex === R.length),
5037
+ be(({ items: C, topItems: k }) => C.length > 0 && C[0].originalIndex === k.length),
5032
5038
  re(({ items: C }) => C[0].index),
5033
5039
  Qe()
5034
5040
  )
@@ -5037,20 +5043,20 @@ const Gn = Be(
5037
5043
  w,
5038
5044
  be(({ items: C }) => C.length > 0),
5039
5045
  re(({ items: C }) => {
5040
- let R = 0, E = C.length - 1;
5041
- for (; C[R].type === "group" && R < E; )
5042
- R++;
5043
- for (; C[E].type === "group" && E > R; )
5046
+ let k = 0, E = C.length - 1;
5047
+ for (; C[k].type === "group" && k < E; )
5048
+ k++;
5049
+ for (; C[E].type === "group" && E > k; )
5044
5050
  E--;
5045
5051
  return {
5046
5052
  endIndex: C[E].index,
5047
- startIndex: C[R].index
5053
+ startIndex: C[k].index
5048
5054
  };
5049
5055
  }),
5050
5056
  Qe(tu)
5051
5057
  )
5052
5058
  );
5053
- return { endReached: y, initialItemCount: g, itemsRendered: x, listState: w, rangeChanged: S, startReached: k, topItemsIndexes: v, ...h };
5059
+ return { endReached: y, initialItemCount: g, itemsRendered: x, listState: w, rangeChanged: S, startReached: R, topItemsIndexes: v, ...h };
5054
5060
  },
5055
5061
  et(
5056
5062
  un,
@@ -5076,7 +5082,7 @@ const Gn = Be(
5076
5082
  },
5077
5083
  et(Ct, Gn),
5078
5084
  { singleton: !0 }
5079
- ), Rx = Be(
5085
+ ), kx = Be(
5080
5086
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
5081
5087
  const n = K(!1), r = bt(
5082
5088
  F(
@@ -5113,14 +5119,14 @@ const Gn = Be(
5113
5119
  _e(t, c, n, s, o, r, a),
5114
5120
  _e(e),
5115
5121
  re(([[f, h, m, b, v, g, x, w], y]) => {
5116
- const { align: k, behavior: S, calculateViewLocation: C = Ex, done: R, ...E } = f, N = ou(f, h, b - 1), j = Mr(N, h.offsetTree, y) + v + g, I = j + Gt(h.sizeTree, N)[1], $ = w + g, U = w + m - x, P = C({
5122
+ const { align: R, behavior: S, calculateViewLocation: C = Ex, done: k, ...E } = f, N = ou(f, h, b - 1), j = Mr(N, h.offsetTree, y) + v + g, I = j + Gt(h.sizeTree, N)[1], $ = w + g, U = w + m - x, P = C({
5117
5123
  itemBottom: I,
5118
5124
  itemTop: j,
5119
- locationParams: { align: k, behavior: S, ...E },
5125
+ locationParams: { align: R, behavior: S, ...E },
5120
5126
  viewportBottom: U,
5121
5127
  viewportTop: $
5122
5128
  });
5123
- return P ? R && qt(
5129
+ return P ? k && qt(
5124
5130
  F(
5125
5131
  i,
5126
5132
  be((G) => !G),
@@ -5128,8 +5134,8 @@ const Gn = Be(
5128
5134
  // but if scrollingInProgress is true, we skip the initial publish.
5129
5135
  Bn(st(i) ? 1 : 2)
5130
5136
  ),
5131
- R
5132
- ) : R && R(), P;
5137
+ k
5138
+ ) : k && k(), P;
5133
5139
  }),
5134
5140
  be((f) => f !== null)
5135
5141
  ),
@@ -5169,9 +5175,9 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = Be(
5169
5175
  F(
5170
5176
  ut(F(we(t), Bn(1)), c),
5171
5177
  _e(we(b), s, a, f),
5172
- re(([[S, C], R, E, N, j]) => {
5178
+ re(([[S, C], k, E, N, j]) => {
5173
5179
  let I = C && N, $ = "auto";
5174
- return I && ($ = Ix(R, E || j), I = I && !!$), { followOutputBehavior: $, shouldFollow: I, totalCount: S };
5180
+ return I && ($ = Ix(k, E || j), I = I && !!$), { followOutputBehavior: $, shouldFollow: I, totalCount: S };
5175
5181
  }),
5176
5182
  be(({ shouldFollow: S }) => S)
5177
5183
  ),
@@ -5184,8 +5190,8 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = Be(
5184
5190
  }
5185
5191
  );
5186
5192
  function w(S) {
5187
- const C = qt(o, (R) => {
5188
- S && !R.atBottom && R.notAtBottomBecause === "SIZE_INCREASED" && !g && (st(d)("scrolling to bottom due to increased size", {}, It.DEBUG), x("auto"));
5193
+ const C = qt(o, (k) => {
5194
+ S && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !g && (st(d)("scrolling to bottom due to increased size", {}, It.DEBUG), x("auto"));
5189
5195
  });
5190
5196
  setTimeout(C, 100);
5191
5197
  }
@@ -5208,7 +5214,7 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = Be(
5208
5214
  }), Ve(ut(we(b), o), ([S, C]) => {
5209
5215
  S && !C.atBottom && C.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && x("auto");
5210
5216
  });
5211
- const y = K(null), k = $e();
5217
+ const y = K(null), R = $e();
5212
5218
  return fe(
5213
5219
  di(
5214
5220
  F(
@@ -5220,12 +5226,12 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = Be(
5220
5226
  ),
5221
5227
  F(we(t))
5222
5228
  ),
5223
- k
5229
+ R
5224
5230
  ), Ve(
5225
5231
  F(
5226
- ut(F(k, Bn(1)), c),
5232
+ ut(F(R, Bn(1)), c),
5227
5233
  _e(we(y), a, f, h),
5228
- re(([[S, C], R, E, N, j]) => C && E && (R == null ? void 0 : R({ context: j, totalCount: S, scrollingInProgress: N }))),
5234
+ re(([[S, C], k, E, N, j]) => C && E && (k == null ? void 0 : k({ context: j, totalCount: S, scrollingInProgress: N }))),
5229
5235
  be((S) => !!S),
5230
5236
  gn(0)
5231
5237
  ),
@@ -5368,8 +5374,8 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = Be(
5368
5374
  _e(t, r, i, f, h, n)
5369
5375
  ),
5370
5376
  ([m, b, v, g, x, w, y]) => {
5371
- const k = mx(b.sizeTree);
5372
- g && x !== null && w !== null && (v = x.scrollTop - w.offsetTop), v -= y, m({ ranges: k, scrollTop: v });
5377
+ const R = mx(b.sizeTree);
5378
+ g && x !== null && w !== null && (v = x.scrollTop - w.offsetTop), v -= y, m({ ranges: R, scrollTop: v });
5373
5379
  }
5374
5380
  ), fe(F(d, be(zi), re(Px)), o), fe(
5375
5381
  F(
@@ -5419,16 +5425,16 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5419
5425
  c,
5420
5426
  _e(i),
5421
5427
  on(
5422
- ([, x, w, y], [{ bottom: k, items: S, offsetBottom: C, totalCount: R }, E]) => {
5423
- const N = k + C;
5428
+ ([, x, w, y], [{ bottom: R, items: S, offsetBottom: C, totalCount: k }, E]) => {
5429
+ const N = R + C;
5424
5430
  let j = 0;
5425
- return w === R && x.length > 0 && S.length > 0 && (S[0].originalIndex === 0 && x[0].originalIndex === 0 || (j = N - y, j !== 0 && (j += E))), [j, S, R, N];
5431
+ return w === k && x.length > 0 && S.length > 0 && (S[0].originalIndex === 0 && x[0].originalIndex === 0 || (j = N - y, j !== 0 && (j += E))), [j, S, k, N];
5426
5432
  },
5427
5433
  [0, [], 0, 0]
5428
5434
  ),
5429
5435
  be(([x]) => x !== 0),
5430
5436
  _e(r, a, n, o, m, b),
5431
- be(([, x, w, y, , , k]) => !k && !y && x !== 0 && w === Dr),
5437
+ be(([, x, w, y, , , R]) => !R && !y && x !== 0 && w === Dr),
5432
5438
  re(([[x], , , , , w]) => (w("Upward scrolling compensation", { amount: x }, It.DEBUG), x))
5433
5439
  )
5434
5440
  );
@@ -5455,22 +5461,22 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5455
5461
  F(
5456
5462
  u,
5457
5463
  _e(h, d),
5458
- re(([x, { groupIndices: w, lastSize: y, sizeTree: k }, S]) => {
5459
- function C(R) {
5460
- return R * (y + S);
5464
+ re(([x, { groupIndices: w, lastSize: y, sizeTree: R }, S]) => {
5465
+ function C(k) {
5466
+ return k * (y + S);
5461
5467
  }
5462
5468
  if (w.length === 0)
5463
5469
  return C(x);
5464
5470
  {
5465
- let R = 0;
5466
- const E = Pr(k, 0);
5471
+ let k = 0;
5472
+ const E = Pr(R, 0);
5467
5473
  let N = 0, j = 0;
5468
5474
  for (; N < x; ) {
5469
- N++, R += E;
5475
+ N++, k += E;
5470
5476
  let I = w.length === j + 1 ? 1 / 0 : w[j + 1] - w[j] - 1;
5471
- N + I > x && (R -= E, I = x - N + 1), N += I, R += C(I), j++;
5477
+ N + I > x && (k -= E, I = x - N + 1), N += I, k += C(I), j++;
5472
5478
  }
5473
- return R;
5479
+ return k;
5474
5480
  }
5475
5481
  })
5476
5482
  ),
@@ -5517,7 +5523,7 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5517
5523
  fu,
5518
5524
  cu,
5519
5525
  _x,
5520
- Rx,
5526
+ kx,
5521
5527
  Gi,
5522
5528
  du,
5523
5529
  En,
@@ -5543,13 +5549,13 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5543
5549
  v,
5544
5550
  g,
5545
5551
  x,
5546
- { listState: w, topItemsIndexes: y, ...k },
5552
+ { listState: w, topItemsIndexes: y, ...R },
5547
5553
  { scrollToIndex: S },
5548
5554
  C,
5549
- { topItemCount: R },
5555
+ { topItemCount: k },
5550
5556
  { groupCounts: E },
5551
5557
  N
5552
- ]) => (fe(k.rangeChanged, N.scrollSeekRangeChanged), fe(
5558
+ ]) => (fe(R.rangeChanged, N.scrollSeekRangeChanged), fe(
5553
5559
  F(
5554
5560
  N.windowViewportRect,
5555
5561
  re((j) => j.visibleHeight)
@@ -5566,7 +5572,7 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5566
5572
  initialTopMostItemIndex: m,
5567
5573
  scrolledToInitialItem: b,
5568
5574
  sizeRanges: a,
5569
- topItemCount: R,
5575
+ topItemCount: k,
5570
5576
  topItemsIndexes: y,
5571
5577
  // input
5572
5578
  totalCount: d,
@@ -5579,7 +5585,7 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5579
5585
  statefulTotalCount: u,
5580
5586
  trackItemSizes: f,
5581
5587
  // exported from stateFlagsSystem
5582
- ...k,
5588
+ ...R,
5583
5589
  // the bag of IO from featureGroup1System
5584
5590
  ...N,
5585
5591
  ...v,
@@ -5628,28 +5634,28 @@ function mu(e, t, n) {
5628
5634
  }
5629
5635
  function u(g) {
5630
5636
  return s.reduce((x, w) => (x[w] = (y) => {
5631
- const k = g[t.methods[w]];
5632
- Ae(k, y);
5637
+ const R = g[t.methods[w]];
5638
+ Ae(R, y);
5633
5639
  }, x), {});
5634
5640
  }
5635
5641
  function d(g) {
5636
5642
  return i.reduce((x, w) => (x[w] = ex(g[t.events[w]]), x), {});
5637
5643
  }
5638
5644
  const f = z.forwardRef((g, x) => {
5639
- const { children: w, ...y } = g, [k] = z.useState(() => ts(nx(e), (R) => {
5640
- c(R, y);
5641
- })), [S] = z.useState(cl(d, k));
5645
+ const { children: w, ...y } = g, [R] = z.useState(() => ts(nx(e), (k) => {
5646
+ c(k, y);
5647
+ })), [S] = z.useState(cl(d, R));
5642
5648
  eo(() => {
5643
- for (const R of i)
5644
- R in y && Ve(S[R], y[R]);
5649
+ for (const k of i)
5650
+ k in y && Ve(S[k], y[k]);
5645
5651
  return () => {
5646
5652
  Object.values(S).map(Bi);
5647
5653
  };
5648
- }, [y, S, k]), eo(() => {
5649
- c(k, y);
5650
- }), z.useImperativeHandle(x, ll(u(k)));
5654
+ }, [y, S, R]), eo(() => {
5655
+ c(R, y);
5656
+ }), z.useImperativeHandle(x, ll(u(R)));
5651
5657
  const C = n;
5652
- return /* @__PURE__ */ l.jsx(a.Provider, { value: k, children: n ? /* @__PURE__ */ l.jsx(C, { ...$x([...r, ...o, ...i], y), children: w }) : w });
5658
+ return /* @__PURE__ */ l.jsx(a.Provider, { value: R, children: n ? /* @__PURE__ */ l.jsx(C, { ...$x([...r, ...o, ...i], y), children: w }) : w });
5653
5659
  }), h = (g) => {
5654
5660
  const x = z.useContext(a);
5655
5661
  return z.useCallback(
@@ -5671,8 +5677,8 @@ function mu(e, t, n) {
5671
5677
  }, b = (g) => {
5672
5678
  const x = z.useContext(a)[g], [w, y] = z.useState(cl(st, x));
5673
5679
  return eo(
5674
- () => Ve(x, (k) => {
5675
- k !== w && y(ll(k));
5680
+ () => Ve(x, (R) => {
5681
+ R !== w && y(ll(R));
5676
5682
  }),
5677
5683
  [x, w]
5678
5684
  ), w;
@@ -5784,7 +5790,7 @@ const zx = /* @__PURE__ */ Be(() => {
5784
5790
  ([e, t]) => ({ ...e, ...t }),
5785
5791
  et(pu, zx)
5786
5792
  ), Hx = ({ height: e }) => /* @__PURE__ */ l.jsx("div", { style: { height: e } }), Ux = { overflowAnchor: "none", position: Yi(), zIndex: 1 }, bu = { overflowAnchor: "none" }, Wx = { ...bu, display: "inline-block", height: "100%" }, bl = /* @__PURE__ */ z.memo(function({ showTopList: e = !1 }) {
5787
- const t = Re("listState"), n = zt("sizeRanges"), r = Re("useWindowScroll"), o = Re("customScrollParent"), s = zt("windowScrollContainerState"), i = zt("scrollContainerState"), a = o || r ? s : i, c = Re("itemContent"), u = Re("context"), d = Re("groupContent"), f = Re("trackItemSizes"), h = Re("itemSize"), m = Re("log"), b = zt("gap"), v = Re("horizontalDirection"), { callbackRef: g } = sx(
5793
+ const t = ke("listState"), n = zt("sizeRanges"), r = ke("useWindowScroll"), o = ke("customScrollParent"), s = zt("windowScrollContainerState"), i = zt("scrollContainerState"), a = o || r ? s : i, c = ke("itemContent"), u = ke("context"), d = ke("groupContent"), f = ke("trackItemSizes"), h = ke("itemSize"), m = ke("log"), b = zt("gap"), v = ke("horizontalDirection"), { callbackRef: g } = sx(
5788
5794
  n,
5789
5795
  h,
5790
5796
  f,
@@ -5793,12 +5799,12 @@ const zx = /* @__PURE__ */ Be(() => {
5793
5799
  b,
5794
5800
  o,
5795
5801
  v,
5796
- Re("skipAnimationFrameInResizeObserver")
5802
+ ke("skipAnimationFrameInResizeObserver")
5797
5803
  ), [x, w] = z.useState(0);
5798
5804
  Ji("deviation", (P) => {
5799
5805
  x !== P && w(P);
5800
5806
  });
5801
- const y = Re("EmptyPlaceholder"), k = Re("ScrollSeekPlaceholder") || Hx, S = Re("ListComponent"), C = Re("ItemComponent"), R = Re("GroupComponent"), E = Re("computeItemKey"), N = Re("isSeeking"), j = Re("groupIndices").length > 0, I = Re("alignToBottom"), $ = Re("initialItemFinalLocationReached"), U = e ? {} : {
5807
+ const y = ke("EmptyPlaceholder"), R = ke("ScrollSeekPlaceholder") || Hx, S = ke("ListComponent"), C = ke("ItemComponent"), k = ke("GroupComponent"), E = ke("computeItemKey"), N = ke("isSeeking"), j = ke("groupIndices").length > 0, I = ke("alignToBottom"), $ = ke("initialItemFinalLocationReached"), U = e ? {} : {
5802
5808
  boxSizing: "border-box",
5803
5809
  ...v ? {
5804
5810
  display: "inline-block",
@@ -5824,9 +5830,9 @@ const zx = /* @__PURE__ */ Be(() => {
5824
5830
  children: (e ? t.topItems : t.items).map((P) => {
5825
5831
  const G = P.originalIndex, H = E(G + t.firstItemIndex, P.data, u);
5826
5832
  return N ? /* @__PURE__ */ co(
5827
- k,
5833
+ R,
5828
5834
  {
5829
- ...wt(k, u),
5835
+ ...wt(R, u),
5830
5836
  height: P.size,
5831
5837
  index: P.index,
5832
5838
  key: H,
@@ -5834,9 +5840,9 @@ const zx = /* @__PURE__ */ Be(() => {
5834
5840
  ...P.type === "group" ? {} : { groupIndex: P.groupIndex }
5835
5841
  }
5836
5842
  ) : P.type === "group" ? /* @__PURE__ */ co(
5837
- R,
5843
+ k,
5838
5844
  {
5839
- ...wt(R, u),
5845
+ ...wt(k, u),
5840
5846
  "data-index": G,
5841
5847
  "data-item-index": P.index,
5842
5848
  "data-known-size": P.size,
@@ -5891,7 +5897,7 @@ function Gx(e, t) {
5891
5897
  return { item: typeof e == "string" ? void 0 : t };
5892
5898
  }
5893
5899
  const Yx = /* @__PURE__ */ z.memo(function() {
5894
- const e = Re("HeaderComponent"), t = zt("headerHeight"), n = Re("HeaderFooterTag"), r = qn(
5900
+ const e = ke("HeaderComponent"), t = zt("headerHeight"), n = ke("HeaderFooterTag"), r = qn(
5895
5901
  z.useMemo(
5896
5902
  () => (s) => {
5897
5903
  t(yn(s, "height"));
@@ -5899,11 +5905,11 @@ const Yx = /* @__PURE__ */ z.memo(function() {
5899
5905
  [t]
5900
5906
  ),
5901
5907
  !0,
5902
- Re("skipAnimationFrameInResizeObserver")
5903
- ), o = Re("context");
5908
+ ke("skipAnimationFrameInResizeObserver")
5909
+ ), o = ke("context");
5904
5910
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...wt(e, o) }) }) : null;
5905
5911
  }), Xx = /* @__PURE__ */ z.memo(function() {
5906
- const e = Re("FooterComponent"), t = zt("footerHeight"), n = Re("HeaderFooterTag"), r = qn(
5912
+ const e = ke("FooterComponent"), t = zt("footerHeight"), n = ke("HeaderFooterTag"), r = qn(
5907
5913
  z.useMemo(
5908
5914
  () => (s) => {
5909
5915
  t(yn(s, "height"));
@@ -5911,8 +5917,8 @@ const Yx = /* @__PURE__ */ z.memo(function() {
5911
5917
  [t]
5912
5918
  ),
5913
5919
  !0,
5914
- Re("skipAnimationFrameInResizeObserver")
5915
- ), o = Re("context");
5920
+ ke("skipAnimationFrameInResizeObserver")
5921
+ ), o = ke("context");
5916
5922
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...wt(e, o) }) }) : null;
5917
5923
  });
5918
5924
  function yu({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
@@ -5968,27 +5974,27 @@ function Su({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
5968
5974
  });
5969
5975
  }
5970
5976
  const Jx = ({ children: e }) => {
5971
- const t = z.useContext(gu), n = zt("viewportHeight"), r = zt("fixedItemHeight"), o = Re("alignToBottom"), s = Re("horizontalDirection"), i = z.useMemo(
5977
+ const t = z.useContext(gu), n = zt("viewportHeight"), r = zt("fixedItemHeight"), o = ke("alignToBottom"), s = ke("horizontalDirection"), i = z.useMemo(
5972
5978
  () => qc(n, (c) => yn(c, s ? "width" : "height")),
5973
5979
  [n, s]
5974
- ), a = qn(i, !0, Re("skipAnimationFrameInResizeObserver"));
5980
+ ), a = qn(i, !0, ke("skipAnimationFrameInResizeObserver"));
5975
5981
  return z.useEffect(() => {
5976
5982
  t && (n(t.viewportHeight), r(t.itemHeight));
5977
5983
  }, [t, n, r]), /* @__PURE__ */ l.jsx("div", { "data-viewport-type": "element", ref: a, style: os(o), children: e });
5978
5984
  }, Zx = ({ children: e }) => {
5979
- const t = z.useContext(gu), n = zt("windowViewportRect"), r = zt("fixedItemHeight"), o = Re("customScrollParent"), s = Yc(
5985
+ const t = z.useContext(gu), n = zt("windowViewportRect"), r = zt("fixedItemHeight"), o = ke("customScrollParent"), s = Yc(
5980
5986
  n,
5981
5987
  o,
5982
- Re("skipAnimationFrameInResizeObserver")
5983
- ), i = Re("alignToBottom");
5988
+ ke("skipAnimationFrameInResizeObserver")
5989
+ ), i = ke("alignToBottom");
5984
5990
  return z.useEffect(() => {
5985
5991
  t && (r(t.itemHeight), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
5986
5992
  }, [t, n, r]), /* @__PURE__ */ l.jsx("div", { "data-viewport-type": "window", ref: s, style: os(i), children: e });
5987
5993
  }, Qx = ({ children: e }) => {
5988
- const t = Re("TopItemListComponent") || "div", n = Re("headerHeight"), r = { ...qx, marginTop: `${n}px` }, o = Re("context");
5994
+ const t = ke("TopItemListComponent") || "div", n = ke("headerHeight"), r = { ...qx, marginTop: `${n}px` }, o = ke("context");
5989
5995
  return /* @__PURE__ */ l.jsx(t, { style: r, ...wt(t, o), children: e });
5990
5996
  }, ev = /* @__PURE__ */ z.memo(function(e) {
5991
- const t = Re("useWindowScroll"), n = Re("topItemsIndexes").length > 0, r = Re("customScrollParent"), o = Re("context");
5997
+ const t = ke("useWindowScroll"), n = ke("topItemsIndexes").length > 0, r = ke("customScrollParent"), o = ke("context");
5992
5998
  return /* @__PURE__ */ l.jsxs(r || t ? rv : nv, { ...e, context: o, children: [
5993
5999
  n && /* @__PURE__ */ l.jsx(Qx, { children: /* @__PURE__ */ l.jsx(bl, { showTopList: !0 }) }),
5994
6000
  /* @__PURE__ */ l.jsxs(r || t ? Zx : Jx, { children: [
@@ -6000,7 +6006,7 @@ const Jx = ({ children: e }) => {
6000
6006
  }), {
6001
6007
  Component: tv,
6002
6008
  useEmitter: Ji,
6003
- useEmitterValue: Re,
6009
+ useEmitterValue: ke,
6004
6010
  usePublisher: zt
6005
6011
  } = /* @__PURE__ */ mu(
6006
6012
  Bx,
@@ -6061,7 +6067,7 @@ const Jx = ({ children: e }) => {
6061
6067
  }
6062
6068
  },
6063
6069
  ev
6064
- ), nv = /* @__PURE__ */ yu({ useEmitter: Ji, useEmitterValue: Re, usePublisher: zt }), rv = /* @__PURE__ */ Su({ useEmitter: Ji, useEmitterValue: Re, usePublisher: zt }), ov = tv, sv = /* @__PURE__ */ Be(() => {
6070
+ ), nv = /* @__PURE__ */ yu({ useEmitter: Ji, useEmitterValue: ke, usePublisher: zt }), rv = /* @__PURE__ */ Su({ useEmitter: Ji, useEmitterValue: ke, usePublisher: zt }), ov = tv, sv = /* @__PURE__ */ Be(() => {
6065
6071
  const e = K((u) => /* @__PURE__ */ l.jsxs("td", { children: [
6066
6072
  "Item $",
6067
6073
  u
@@ -6138,10 +6144,10 @@ const cv = /* @__PURE__ */ Be(
6138
6144
  h,
6139
6145
  m,
6140
6146
  { didMount: b, propsReady: v },
6141
- { customScrollParent: g, useWindowScroll: x, windowScrollContainerState: w, windowScrollTo: y, windowViewportRect: k },
6147
+ { customScrollParent: g, useWindowScroll: x, windowScrollContainerState: w, windowScrollTo: y, windowViewportRect: R },
6142
6148
  S
6143
6149
  ]) => {
6144
- const C = K(0), R = K(0), E = K(yl), N = K({ height: 0, width: 0 }), j = K({ height: 0, width: 0 }), I = $e(), $ = $e(), U = K(0), P = K(null), G = K({ column: 0, row: 0 }), H = $e(), W = $e(), D = K(!1), O = K(0), ae = K(!0), Y = K(!1), ee = K(!1);
6150
+ const C = K(0), k = K(0), E = K(yl), N = K({ height: 0, width: 0 }), j = K({ height: 0, width: 0 }), I = $e(), $ = $e(), U = K(0), P = K(null), G = K({ column: 0, row: 0 }), H = $e(), W = $e(), D = K(!1), O = K(0), ae = K(!0), Y = K(!1), Q = K(!1);
6145
6151
  Ve(
6146
6152
  F(
6147
6153
  b,
@@ -6169,7 +6175,7 @@ const cv = /* @__PURE__ */ Be(
6169
6175
  be((A) => A != null && A.scrollTop > 0),
6170
6176
  nn(0)
6171
6177
  ),
6172
- R
6178
+ k
6173
6179
  ), Ve(
6174
6180
  F(
6175
6181
  b,
@@ -6212,7 +6218,7 @@ const cv = /* @__PURE__ */ Be(
6212
6218
  we(j, to),
6213
6219
  we(N, to),
6214
6220
  we(P),
6215
- we(R),
6221
+ we(k),
6216
6222
  we(D),
6217
6223
  we(ae),
6218
6224
  we(O)
@@ -6241,7 +6247,7 @@ const cv = /* @__PURE__ */ Be(
6241
6247
  const de = Cu(ue, ht, Ze);
6242
6248
  let he, ye;
6243
6249
  je ? q === 0 && te === 0 && ve > 0 ? (he = 0, ye = ve - 1) : (he = de * Po((q + Ke) / (at + Ke)), ye = de * Sl((te + Ke) / (at + Ke)) - 1, ye = zs(A - 1, Ar(ye, de - 1)), he = zs(ye, Ar(0, he))) : (he = 0, ye = -1);
6244
- const Pe = Tl(he, ye, Le), { bottom: M, top: X } = kl(Oe, ce, oe, Pe), ke = Sl(A / de), He = ke * at + (ke - 1) * Ke - M;
6250
+ const Pe = Tl(he, ye, Le), { bottom: M, top: X } = Rl(Oe, ce, oe, Pe), Re = Sl(A / de), He = Re * at + (Re - 1) * Ke - M;
6245
6251
  return { bottom: M, itemHeight: at, items: Pe, itemWidth: ht, offsetBottom: He, offsetTop: X, top: X };
6246
6252
  }
6247
6253
  )
@@ -6259,7 +6265,7 @@ const cv = /* @__PURE__ */ Be(
6259
6265
  ut(N, j, E, G),
6260
6266
  be(([A, q, { items: te }]) => te.length > 0 && q.height !== 0 && A.height !== 0),
6261
6267
  re(([A, q, { items: te }, ce]) => {
6262
- const { bottom: oe, top: Oe } = kl(A, ce, q, te);
6268
+ const { bottom: oe, top: Oe } = Rl(A, ce, q, te);
6263
6269
  return [Oe, oe];
6264
6270
  }),
6265
6271
  Qe(Or)
@@ -6275,7 +6281,7 @@ const cv = /* @__PURE__ */ Be(
6275
6281
  ),
6276
6282
  L
6277
6283
  );
6278
- const Z = jt(
6284
+ const ee = jt(
6279
6285
  F(
6280
6286
  ut(E, C),
6281
6287
  be(([{ items: A }]) => A.length > 0),
@@ -6294,7 +6300,7 @@ const cv = /* @__PURE__ */ Be(
6294
6300
  nn(0),
6295
6301
  Qe()
6296
6302
  )
6297
- ), Q = jt(
6303
+ ), Z = jt(
6298
6304
  F(
6299
6305
  we(E),
6300
6306
  _e(D),
@@ -6307,7 +6313,7 @@ const cv = /* @__PURE__ */ Be(
6307
6313
  gn(0)
6308
6314
  )
6309
6315
  );
6310
- fe(Q, m.scrollSeekRangeChanged), fe(
6316
+ fe(Z, m.scrollSeekRangeChanged), fe(
6311
6317
  F(
6312
6318
  I,
6313
6319
  _e(N, j, C, G),
@@ -6330,7 +6336,7 @@ const cv = /* @__PURE__ */ Be(
6330
6336
  );
6331
6337
  return fe(
6332
6338
  F(
6333
- k,
6339
+ R,
6334
6340
  re((A) => ({ height: A.visibleHeight, width: A.visibleWidth }))
6335
6341
  ),
6336
6342
  N
@@ -6343,7 +6349,7 @@ const cv = /* @__PURE__ */ Be(
6343
6349
  gap: G,
6344
6350
  headerHeight: s,
6345
6351
  increaseViewportBy: e,
6346
- initialItemCount: R,
6352
+ initialItemCount: k,
6347
6353
  itemDimensions: j,
6348
6354
  overscan: n,
6349
6355
  restoreStateFrom: W,
@@ -6359,17 +6365,17 @@ const cv = /* @__PURE__ */ Be(
6359
6365
  viewportDimensions: N,
6360
6366
  windowScrollContainerState: w,
6361
6367
  windowScrollTo: y,
6362
- windowViewportRect: k,
6368
+ windowViewportRect: R,
6363
6369
  ...m,
6364
6370
  // output
6365
6371
  gridState: E,
6366
- horizontalDirection: ee,
6372
+ horizontalDirection: Q,
6367
6373
  initialTopMostItemIndex: O,
6368
6374
  totalListHeight: V,
6369
6375
  ...h,
6370
- endReached: Z,
6376
+ endReached: ee,
6371
6377
  propsReady: v,
6372
- rangeChanged: Q,
6378
+ rangeChanged: Z,
6373
6379
  startReached: Ee,
6374
6380
  stateChanged: H,
6375
6381
  stateRestoreInProgress: D,
@@ -6381,7 +6387,7 @@ const cv = /* @__PURE__ */ Be(
6381
6387
  function Cu(e, t, n) {
6382
6388
  return Ar(1, Po((e + n) / (Po(t) + n)));
6383
6389
  }
6384
- function kl(e, t, n, r) {
6390
+ function Rl(e, t, n, r) {
6385
6391
  const { height: o } = n;
6386
6392
  if (o === void 0 || r.length === 0)
6387
6393
  return { bottom: 0, top: 0 };
@@ -6430,12 +6436,12 @@ const uv = /* @__PURE__ */ Be(() => {
6430
6436
  i(w);
6431
6437
  const y = x.firstChild;
6432
6438
  if (y) {
6433
- const { height: k, width: S } = y.getBoundingClientRect();
6434
- f({ height: k, width: S });
6439
+ const { height: R, width: S } = y.getBoundingClientRect();
6440
+ f({ height: R, width: S });
6435
6441
  }
6436
6442
  h({
6437
- column: Rl("column-gap", getComputedStyle(x).columnGap, m),
6438
- row: Rl("row-gap", getComputedStyle(x).rowGap, m)
6443
+ column: kl("column-gap", getComputedStyle(x).columnGap, m),
6444
+ row: kl("row-gap", getComputedStyle(x).rowGap, m)
6439
6445
  });
6440
6446
  },
6441
6447
  [i, f, h, m]
@@ -6573,7 +6579,7 @@ const uv = /* @__PURE__ */ Be(() => {
6573
6579
  },
6574
6580
  xv
6575
6581
  ), vv = /* @__PURE__ */ yu({ useEmitter: Tu, useEmitterValue: tt, usePublisher: Bt }), wv = /* @__PURE__ */ Su({ useEmitter: Tu, useEmitterValue: tt, usePublisher: Bt });
6576
- function Rl(e, t, n) {
6582
+ function kl(e, t, n) {
6577
6583
  return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t, It.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
6578
6584
  }
6579
6585
  const bv = qo(
@@ -6691,7 +6697,7 @@ function Hn({
6691
6697
  (d) => {
6692
6698
  var f;
6693
6699
  if (a) {
6694
- const h = kv(d) ? d(e) : d;
6700
+ const h = Rv(d) ? d(e) : d;
6695
6701
  h !== e && ((f = i.current) == null || f.call(i, h));
6696
6702
  } else
6697
6703
  s(d);
@@ -6712,7 +6718,7 @@ function Tv({
6712
6718
  o.current !== n && ((i = s.current) == null || i.call(s, n), o.current = n);
6713
6719
  }, [n, o]), [n, r, s];
6714
6720
  }
6715
- function kv(e) {
6721
+ function Rv(e) {
6716
6722
  return typeof e == "function";
6717
6723
  }
6718
6724
  function El(e, t) {
@@ -6739,7 +6745,7 @@ function Zi(...e) {
6739
6745
  function De(...e) {
6740
6746
  return p.useCallback(Zi(...e), e);
6741
6747
  }
6742
- var Rv = [
6748
+ var kv = [
6743
6749
  "a",
6744
6750
  "button",
6745
6751
  "div",
@@ -6757,14 +6763,14 @@ var Rv = [
6757
6763
  "span",
6758
6764
  "svg",
6759
6765
  "ul"
6760
- ], Te = Rv.reduce((e, t) => {
6766
+ ], Te = kv.reduce((e, t) => {
6761
6767
  const n = lr(`Primitive.${t}`), r = p.forwardRef((o, s) => {
6762
6768
  const { asChild: i, ...a } = o, c = i ? n : t;
6763
6769
  return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ l.jsx(c, { ...a, ref: s });
6764
6770
  });
6765
6771
  return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
6766
6772
  }, {});
6767
- function ku(e, t) {
6773
+ function Ru(e, t) {
6768
6774
  e && Go.flushSync(() => e.dispatchEvent(t));
6769
6775
  }
6770
6776
  function Ev(e, t) {
@@ -6840,7 +6846,7 @@ function an(e) {
6840
6846
  n((r) => r ?? String(_v++));
6841
6847
  }, [e]), e || (t ? `radix-${t}` : "");
6842
6848
  }
6843
- var ss = "Collapsible", [jv, vT] = dn(ss), [Pv, Qi] = jv(ss), Ru = p.forwardRef(
6849
+ var ss = "Collapsible", [jv, vT] = dn(ss), [Pv, Qi] = jv(ss), ku = p.forwardRef(
6844
6850
  (e, t) => {
6845
6851
  const {
6846
6852
  __scopeCollapsible: n,
@@ -6876,7 +6882,7 @@ var ss = "Collapsible", [jv, vT] = dn(ss), [Pv, Qi] = jv(ss), Ru = p.forwardRef(
6876
6882
  );
6877
6883
  }
6878
6884
  );
6879
- Ru.displayName = ss;
6885
+ ku.displayName = ss;
6880
6886
  var Eu = "CollapsibleTrigger", Iu = p.forwardRef(
6881
6887
  (e, t) => {
6882
6888
  const { __scopeCollapsible: n, ...r } = e, o = Qi(Eu, n);
@@ -6940,7 +6946,7 @@ var Mv = p.forwardRef((e, t) => {
6940
6946
  function ta(e) {
6941
6947
  return e ? "open" : "closed";
6942
6948
  }
6943
- var Dv = Ru;
6949
+ var Dv = ku;
6944
6950
  const Il = Dv, Nl = Iu;
6945
6951
  function Nu() {
6946
6952
  return {
@@ -7211,17 +7217,17 @@ class na {
7211
7217
  const w = new RegExp(`^( {0,3}${v})((?:[ ][^\\n]*)?(?:\\n|$))`);
7212
7218
  for (; t && (b = !1, !(!(n = w.exec(t)) || this.rules.block.hr.test(t))); ) {
7213
7219
  if (r = n[0], t = t.substring(r.length), d = n[2].split(`
7214
- `, 1)[0].replace(/^\t+/, (k) => " ".repeat(3 * k.length)), f = t.split(`
7220
+ `, 1)[0].replace(/^\t+/, (R) => " ".repeat(3 * R.length)), f = t.split(`
7215
7221
  `, 1)[0], this.options.pedantic ? (i = 2, m = d.trimLeft()) : (i = n[2].search(/[^ ]/), i = i > 4 ? 1 : i, m = d.slice(i), i += n[1].length), c = !1, !d && /^ *$/.test(f) && (r += f + `
7216
7222
  `, t = t.substring(f.length + 1), b = !0), !b) {
7217
- const k = new RegExp(`^ {0,${Math.min(3, i - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), S = new RegExp(`^ {0,${Math.min(3, i - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), C = new RegExp(`^ {0,${Math.min(3, i - 1)}}(?:\`\`\`|~~~)`), R = new RegExp(`^ {0,${Math.min(3, i - 1)}}#`);
7223
+ const R = new RegExp(`^ {0,${Math.min(3, i - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), S = new RegExp(`^ {0,${Math.min(3, i - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), C = new RegExp(`^ {0,${Math.min(3, i - 1)}}(?:\`\`\`|~~~)`), k = new RegExp(`^ {0,${Math.min(3, i - 1)}}#`);
7218
7224
  for (; t && (h = t.split(`
7219
- `, 1)[0], f = h, this.options.pedantic && (f = f.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), !(C.test(f) || R.test(f) || k.test(f) || S.test(t))); ) {
7225
+ `, 1)[0], f = h, this.options.pedantic && (f = f.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), !(C.test(f) || k.test(f) || R.test(f) || S.test(t))); ) {
7220
7226
  if (f.search(/[^ ]/) >= i || !f.trim())
7221
7227
  m += `
7222
7228
  ` + f.slice(i);
7223
7229
  else {
7224
- if (c || d.search(/[^ ]/) >= 4 || C.test(d) || R.test(d) || S.test(d))
7230
+ if (c || d.search(/[^ ]/) >= 4 || C.test(d) || k.test(d) || S.test(d))
7225
7231
  break;
7226
7232
  m += `
7227
7233
  ` + f;
@@ -7243,7 +7249,7 @@ class na {
7243
7249
  const y = x.items.length;
7244
7250
  for (a = 0; a < y; a++)
7245
7251
  if (this.lexer.state.top = !1, x.items[a].tokens = this.lexer.blockTokens(x.items[a].text, []), !x.loose) {
7246
- const k = x.items[a].tokens.filter((C) => C.type === "space"), S = k.length > 0 && k.some((C) => /\n.*\n/.test(C.raw));
7252
+ const R = x.items[a].tokens.filter((C) => C.type === "space"), S = R.length > 0 && R.some((C) => /\n.*\n/.test(C.raw));
7247
7253
  x.loose = S;
7248
7254
  }
7249
7255
  if (x.loose)
@@ -8123,9 +8129,9 @@ class Cn {
8123
8129
  * Parse Loop
8124
8130
  */
8125
8131
  parse(t, n = !0) {
8126
- let r = "", o, s, i, a, c, u, d, f, h, m, b, v, g, x, w, y, k, S, C;
8127
- const R = t.length;
8128
- for (o = 0; o < R; o++) {
8132
+ let r = "", o, s, i, a, c, u, d, f, h, m, b, v, g, x, w, y, R, S, C;
8133
+ const k = t.length;
8134
+ for (o = 0; o < k; o++) {
8129
8135
  if (m = t[o], this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[m.type] && (C = this.options.extensions.renderers[m.type].call({ parser: this }, m), C !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(m.type))) {
8130
8136
  r += C || "";
8131
8137
  continue;
@@ -8177,10 +8183,10 @@ class Cn {
8177
8183
  }
8178
8184
  case "list": {
8179
8185
  for (b = m.ordered, v = m.start, g = m.loose, a = m.items.length, h = "", s = 0; s < a; s++)
8180
- w = m.items[s], y = w.checked, k = w.task, x = "", w.task && (S = this.renderer.checkbox(y), g ? w.tokens.length > 0 && w.tokens[0].type === "paragraph" ? (w.tokens[0].text = S + " " + w.tokens[0].text, w.tokens[0].tokens && w.tokens[0].tokens.length > 0 && w.tokens[0].tokens[0].type === "text" && (w.tokens[0].tokens[0].text = S + " " + w.tokens[0].tokens[0].text)) : w.tokens.unshift({
8186
+ w = m.items[s], y = w.checked, R = w.task, x = "", w.task && (S = this.renderer.checkbox(y), g ? w.tokens.length > 0 && w.tokens[0].type === "paragraph" ? (w.tokens[0].text = S + " " + w.tokens[0].text, w.tokens[0].tokens && w.tokens[0].tokens.length > 0 && w.tokens[0].tokens[0].type === "text" && (w.tokens[0].tokens[0].text = S + " " + w.tokens[0].tokens[0].text)) : w.tokens.unshift({
8181
8187
  type: "text",
8182
8188
  text: S
8183
- }) : x += S), x += this.parse(w.tokens, g), h += this.renderer.listitem(x, k, y);
8189
+ }) : x += S), x += this.parse(w.tokens, g), h += this.renderer.listitem(x, R, y);
8184
8190
  r += this.renderer.list(h, b, v);
8185
8191
  continue;
8186
8192
  }
@@ -8193,7 +8199,7 @@ class Cn {
8193
8199
  continue;
8194
8200
  }
8195
8201
  case "text": {
8196
- for (h = m.tokens ? this.parseInline(m.tokens) : m.text; o + 1 < R && t[o + 1].type === "text"; )
8202
+ for (h = m.tokens ? this.parseInline(m.tokens) : m.text; o + 1 < k && t[o + 1].type === "text"; )
8197
8203
  m = t[++o], h += `
8198
8204
  ` + (m.tokens ? this.parseInline(m.tokens) : m.text);
8199
8205
  r += n ? this.renderer.paragraph(h) : h;
@@ -8669,15 +8675,15 @@ var lw = "DismissableLayer", vi = "dismissableLayer.update", cw = "dismissableLa
8669
8675
  onInteractOutside: i,
8670
8676
  onDismiss: a,
8671
8677
  ...c
8672
- } = e, u = p.useContext(Lu), [d, f] = p.useState(null), h = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, m] = p.useState({}), b = De(t, (R) => f(R)), v = Array.from(u.layers), [g] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), x = v.indexOf(g), w = d ? v.indexOf(d) : -1, y = u.layersWithOutsidePointerEventsDisabled.size > 0, k = w >= x, S = hw((R) => {
8673
- const E = R.target, N = [...u.branches].some((j) => j.contains(E));
8674
- !k || N || (o == null || o(R), i == null || i(R), R.defaultPrevented || a == null || a());
8675
- }, h), C = pw((R) => {
8676
- const E = R.target;
8677
- [...u.branches].some((j) => j.contains(E)) || (s == null || s(R), i == null || i(R), R.defaultPrevented || a == null || a());
8678
+ } = e, u = p.useContext(Lu), [d, f] = p.useState(null), h = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, m] = p.useState({}), b = De(t, (k) => f(k)), v = Array.from(u.layers), [g] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), x = v.indexOf(g), w = d ? v.indexOf(d) : -1, y = u.layersWithOutsidePointerEventsDisabled.size > 0, R = w >= x, S = hw((k) => {
8679
+ const E = k.target, N = [...u.branches].some((j) => j.contains(E));
8680
+ !R || N || (o == null || o(k), i == null || i(k), k.defaultPrevented || a == null || a());
8681
+ }, h), C = pw((k) => {
8682
+ const E = k.target;
8683
+ [...u.branches].some((j) => j.contains(E)) || (s == null || s(k), i == null || i(k), k.defaultPrevented || a == null || a());
8678
8684
  }, h);
8679
- return aw((R) => {
8680
- w === u.layers.size - 1 && (r == null || r(R), !R.defaultPrevented && a && (R.preventDefault(), a()));
8685
+ return aw((k) => {
8686
+ w === u.layers.size - 1 && (r == null || r(k), !k.defaultPrevented && a && (k.preventDefault(), a()));
8681
8687
  }, h), p.useEffect(() => {
8682
8688
  if (d)
8683
8689
  return n && (u.layersWithOutsidePointerEventsDisabled.size === 0 && ($l = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(d)), u.layers.add(d), Fl(), () => {
@@ -8686,15 +8692,15 @@ var lw = "DismissableLayer", vi = "dismissableLayer.update", cw = "dismissableLa
8686
8692
  }, [d, h, n, u]), p.useEffect(() => () => {
8687
8693
  d && (u.layers.delete(d), u.layersWithOutsidePointerEventsDisabled.delete(d), Fl());
8688
8694
  }, [d, u]), p.useEffect(() => {
8689
- const R = () => m({});
8690
- return document.addEventListener(vi, R), () => document.removeEventListener(vi, R);
8695
+ const k = () => m({});
8696
+ return document.addEventListener(vi, k), () => document.removeEventListener(vi, k);
8691
8697
  }, []), /* @__PURE__ */ l.jsx(
8692
8698
  Te.div,
8693
8699
  {
8694
8700
  ...c,
8695
8701
  ref: b,
8696
8702
  style: {
8697
- pointerEvents: y ? k ? "auto" : "none" : void 0,
8703
+ pointerEvents: y ? R ? "auto" : "none" : void 0,
8698
8704
  ...e.style
8699
8705
  },
8700
8706
  onFocusCapture: le(e.onFocusCapture, C.onFocusCapture),
@@ -8769,7 +8775,7 @@ function Fl() {
8769
8775
  }
8770
8776
  function $u(e, t, n, { discrete: r }) {
8771
8777
  const o = n.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
8772
- t && o.addEventListener(e, t, { once: !0 }), r ? ku(o, s) : o.dispatchEvent(s);
8778
+ t && o.addEventListener(e, t, { once: !0 }), r ? Ru(o, s) : o.dispatchEvent(s);
8773
8779
  }
8774
8780
  var Ws = "focusScope.autoFocusOnMount", Vs = "focusScope.autoFocusOnUnmount", zl = { bubbles: !1, cancelable: !0 }, mw = "FocusScope", as = p.forwardRef((e, t) => {
8775
8781
  const {
@@ -8791,12 +8797,12 @@ var Ws = "focusScope.autoFocusOnMount", Vs = "focusScope.autoFocusOnUnmount", zl
8791
8797
  if (r) {
8792
8798
  let v = function(y) {
8793
8799
  if (m.paused || !a) return;
8794
- const k = y.target;
8795
- a.contains(k) ? f.current = k : wn(f.current, { select: !0 });
8800
+ const R = y.target;
8801
+ a.contains(R) ? f.current = R : wn(f.current, { select: !0 });
8796
8802
  }, g = function(y) {
8797
8803
  if (m.paused || !a) return;
8798
- const k = y.relatedTarget;
8799
- k !== null && (a.contains(k) || wn(f.current, { select: !0 }));
8804
+ const R = y.relatedTarget;
8805
+ R !== null && (a.contains(R) || wn(f.current, { select: !0 }));
8800
8806
  }, x = function(y) {
8801
8807
  if (document.activeElement === document.body)
8802
8808
  for (const S of y)
@@ -8829,8 +8835,8 @@ var Ws = "focusScope.autoFocusOnMount", Vs = "focusScope.autoFocusOnUnmount", zl
8829
8835
  if (!n && !r || m.paused) return;
8830
8836
  const g = v.key === "Tab" && !v.altKey && !v.ctrlKey && !v.metaKey, x = document.activeElement;
8831
8837
  if (g && x) {
8832
- const w = v.currentTarget, [y, k] = xw(w);
8833
- y && k ? !v.shiftKey && x === k ? (v.preventDefault(), n && wn(y, { select: !0 })) : v.shiftKey && x === y && (v.preventDefault(), n && wn(k, { select: !0 })) : x === w && v.preventDefault();
8838
+ const w = v.currentTarget, [y, R] = xw(w);
8839
+ y && R ? !v.shiftKey && x === R ? (v.preventDefault(), n && wn(y, { select: !0 })) : v.shiftKey && x === y && (v.preventDefault(), n && wn(R, { select: !0 })) : x === w && v.preventDefault();
8834
8840
  }
8835
8841
  },
8836
8842
  [n, r, m.paused]
@@ -8943,11 +8949,11 @@ function Cw(e, t, n) {
8943
8949
  (s || !(r in t)) && (s || (s = Array.prototype.slice.call(t, 0, r)), s[r] = t[r]);
8944
8950
  return e.concat(s || Array.prototype.slice.call(t));
8945
8951
  }
8946
- var wo = "right-scroll-bar-position", bo = "width-before-scroll-bar", Tw = "with-scroll-bars-hidden", kw = "--removed-body-scroll-bar-size";
8952
+ var wo = "right-scroll-bar-position", bo = "width-before-scroll-bar", Tw = "with-scroll-bars-hidden", Rw = "--removed-body-scroll-bar-size";
8947
8953
  function qs(e, t) {
8948
8954
  return typeof e == "function" ? e(t) : e && (e.current = t), e;
8949
8955
  }
8950
- function Rw(e, t) {
8956
+ function kw(e, t) {
8951
8957
  var n = me(function() {
8952
8958
  return {
8953
8959
  // value
@@ -8970,7 +8976,7 @@ function Rw(e, t) {
8970
8976
  }
8971
8977
  var Ew = typeof window < "u" ? p.useLayoutEffect : p.useEffect, Vl = /* @__PURE__ */ new WeakMap();
8972
8978
  function Iw(e, t) {
8973
- var n = Rw(null, function(r) {
8979
+ var n = kw(null, function(r) {
8974
8980
  return e.forEach(function(o) {
8975
8981
  return qs(o, r);
8976
8982
  });
@@ -9070,12 +9076,12 @@ var Hu = _w(), Gs = function() {
9070
9076
  onScrollCapture: Gs,
9071
9077
  onWheelCapture: Gs,
9072
9078
  onTouchMoveCapture: Gs
9073
- }), o = r[0], s = r[1], i = e.forwardProps, a = e.children, c = e.className, u = e.removeScrollBar, d = e.enabled, f = e.shards, h = e.sideCar, m = e.noRelative, b = e.noIsolation, v = e.inert, g = e.allowPinchZoom, x = e.as, w = x === void 0 ? "div" : x, y = e.gapMode, k = zu(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), S = h, C = Iw([n, t]), R = rn(rn({}, k), o);
9079
+ }), o = r[0], s = r[1], i = e.forwardProps, a = e.children, c = e.className, u = e.removeScrollBar, d = e.enabled, f = e.shards, h = e.sideCar, m = e.noRelative, b = e.noIsolation, v = e.inert, g = e.allowPinchZoom, x = e.as, w = x === void 0 ? "div" : x, y = e.gapMode, R = zu(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), S = h, C = Iw([n, t]), k = rn(rn({}, R), o);
9074
9080
  return p.createElement(
9075
9081
  p.Fragment,
9076
9082
  null,
9077
9083
  d && p.createElement(S, { sideCar: Hu, removeScrollBar: u, shards: f, noRelative: m, noIsolation: b, inert: v, setCallbacks: s, allowPinchZoom: !!g, lockRef: n, gapMode: y }),
9078
- i ? p.cloneElement(p.Children.only(a), rn(rn({}, R), { ref: C })) : p.createElement(w, rn({}, R, { className: c, ref: C }), a)
9084
+ i ? p.cloneElement(p.Children.only(a), rn(rn({}, k), { ref: C })) : p.createElement(w, rn({}, k, { className: c, ref: C }), a)
9079
9085
  );
9080
9086
  });
9081
9087
  cs.defaultProps = {
@@ -9192,7 +9198,7 @@ var Lw = function() {
9192
9198
  }
9193
9199
 
9194
9200
  body[`).concat(sr, `] {
9195
- `).concat(kw, ": ").concat(a, `px;
9201
+ `).concat(Rw, ": ").concat(a, `px;
9196
9202
  }
9197
9203
  `);
9198
9204
  }, Kl = function() {
@@ -9321,18 +9327,18 @@ function nb(e) {
9321
9327
  var a = p.useCallback(function(v, g) {
9322
9328
  if ("touches" in v && v.touches.length === 2 || v.type === "wheel" && v.ctrlKey)
9323
9329
  return !i.current.allowPinchZoom;
9324
- var x = so(v), w = n.current, y = "deltaX" in v ? v.deltaX : w[0] - x[0], k = "deltaY" in v ? v.deltaY : w[1] - x[1], S, C = v.target, R = Math.abs(y) > Math.abs(k) ? "h" : "v";
9325
- if ("touches" in v && R === "h" && C.type === "range")
9330
+ var x = so(v), w = n.current, y = "deltaX" in v ? v.deltaX : w[0] - x[0], R = "deltaY" in v ? v.deltaY : w[1] - x[1], S, C = v.target, k = Math.abs(y) > Math.abs(R) ? "h" : "v";
9331
+ if ("touches" in v && k === "h" && C.type === "range")
9326
9332
  return !1;
9327
- var E = ql(R, C);
9333
+ var E = ql(k, C);
9328
9334
  if (!E)
9329
9335
  return !0;
9330
- if (E ? S = R : (S = R === "v" ? "h" : "v", E = ql(R, C)), !E)
9336
+ if (E ? S = k : (S = k === "v" ? "h" : "v", E = ql(k, C)), !E)
9331
9337
  return !1;
9332
- if (!r.current && "changedTouches" in v && (y || k) && (r.current = S), !S)
9338
+ if (!r.current && "changedTouches" in v && (y || R) && (r.current = S), !S)
9333
9339
  return !0;
9334
9340
  var N = r.current || S;
9335
- return Zw(N, g, v, N === "h" ? y : k);
9341
+ return Zw(N, g, v, N === "h" ? y : R);
9336
9342
  }, []), c = p.useCallback(function(v) {
9337
9343
  var g = v;
9338
9344
  if (!(!er.length || er[er.length - 1] !== s)) {
@@ -9346,15 +9352,15 @@ function nb(e) {
9346
9352
  if (!w) {
9347
9353
  var y = (i.current.shards || []).map(Yl).filter(Boolean).filter(function(S) {
9348
9354
  return S.contains(g.target);
9349
- }), k = y.length > 0 ? a(g, y[0]) : !i.current.noIsolation;
9350
- k && g.cancelable && g.preventDefault();
9355
+ }), R = y.length > 0 ? a(g, y[0]) : !i.current.noIsolation;
9356
+ R && g.cancelable && g.preventDefault();
9351
9357
  }
9352
9358
  }
9353
9359
  }, []), u = p.useCallback(function(v, g, x, w) {
9354
9360
  var y = { name: v, delta: g, target: x, should: w, shadowParent: rb(x) };
9355
9361
  t.current.push(y), setTimeout(function() {
9356
- t.current = t.current.filter(function(k) {
9357
- return k !== y;
9362
+ t.current = t.current.filter(function(R) {
9363
+ return R !== y;
9358
9364
  });
9359
9365
  }, 1);
9360
9366
  }, []), d = p.useCallback(function(v) {
@@ -9839,7 +9845,7 @@ function yb({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
9839
9845
  onClick: b,
9840
9846
  className: "flex items-center gap-2",
9841
9847
  children: [
9842
- /* @__PURE__ */ l.jsx(Rp, { className: "h-4 w-4" }),
9848
+ /* @__PURE__ */ l.jsx(kp, { className: "h-4 w-4" }),
9843
9849
  "External"
9844
9850
  ]
9845
9851
  }
@@ -9973,14 +9979,14 @@ const yo = "prose prose-sm max-w-none break-words dark:prose-invert prose-headin
9973
9979
  function Tb(e) {
9974
9980
  return e.filter((t) => t.type === "text").map((t) => t.text).join("");
9975
9981
  }
9976
- function kb(e) {
9982
+ function Rb(e) {
9977
9983
  const t = e.find((r) => r.type === "tool_call"), n = e.find((r) => r.type === "tool_result");
9978
9984
  return {
9979
9985
  name: t == null ? void 0 : t.name,
9980
9986
  toolCallId: (n == null ? void 0 : n.toolCallId) ?? (t == null ? void 0 : t.id)
9981
9987
  };
9982
9988
  }
9983
- function Rb(e) {
9989
+ function kb(e) {
9984
9990
  const t = e.filter((r) => r.type === "tool_call");
9985
9991
  return e.filter((r) => r.type === "tool_result").map((r) => {
9986
9992
  var o;
@@ -10088,7 +10094,7 @@ const jb = z.memo(function({
10088
10094
  onCancelEdit: x,
10089
10095
  onCopy: w
10090
10096
  }) {
10091
- const [y, k] = me(!1), [S, C] = me("collapsed"), [R, E] = me(!1), { currentThreadId: N } = Fi(), { toast: j } = oa(), [I, $] = me({}), [U, P] = me(!1), [G, H] = me(null), W = u === "phone" || u === "half-screen", D = t.role, O = D === "tool", ae = !(r && D !== "user"), Y = z.useMemo(() => {
10097
+ const [y, R] = me(!1), [S, C] = me("collapsed"), [k, E] = me(!1), { currentThreadId: N } = Fi(), { toast: j } = oa(), [I, $] = me({}), [U, P] = me(!1), [G, H] = me(null), W = u === "phone" || u === "half-screen", D = t.role, O = D === "tool", ae = !(r && D !== "user"), Y = z.useMemo(() => {
10092
10098
  switch (D) {
10093
10099
  case "user":
10094
10100
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -10101,17 +10107,17 @@ const jb = z.memo(function({
10101
10107
  default:
10102
10108
  return "text-[hsl(var(--chat-bubble-ai-text))]";
10103
10109
  }
10104
- }, [D]), ee = Kt(() => Tb(t.content), [t.content]), L = Kt(() => kb(t.content), [t.content]), Z = Kt(
10110
+ }, [D]), Q = Kt(() => Tb(t.content), [t.content]), L = Kt(() => Rb(t.content), [t.content]), ee = Kt(
10105
10111
  () => t.content.filter((ue) => ue.type === "image_url"),
10106
10112
  [t.content]
10107
10113
  ), Ee = Kt(
10108
10114
  () => t.content.filter((ue) => ue.type === "file"),
10109
10115
  [t.content]
10110
- ), Q = Kt(() => Eb(t.content), [t.content]);
10116
+ ), Z = Kt(() => Eb(t.content), [t.content]);
10111
10117
  Kt(() => Ib(t.content), [t.content]);
10112
- const V = Kt(() => Q.length <= Pn ? Q : `${Q.slice(0, Pn)}
10113
- … [truncated ${Q.length - Pn} chars]`, [Q]), A = Ab(ee, r, o), q = z.useCallback(async (ue = "all") => {
10114
- const he = ue === "visible" && O ? V : O ? Q : ee;
10118
+ const V = Kt(() => Z.length <= Pn ? Z : `${Z.slice(0, Pn)}
10119
+ … [truncated ${Z.length - Pn} chars]`, [Z]), A = Ab(Q, r, o), q = z.useCallback(async (ue = "all") => {
10120
+ const he = ue === "visible" && O ? V : O ? Z : Q;
10115
10121
  async function ye(Pe) {
10116
10122
  try {
10117
10123
  await navigator.clipboard.writeText(Pe);
@@ -10125,15 +10131,15 @@ const jb = z.memo(function({
10125
10131
  }
10126
10132
  }
10127
10133
  try {
10128
- await ye(he), k(!0), setTimeout(() => k(!1), 2e3), w == null || w(he);
10134
+ await ye(he), R(!0), setTimeout(() => R(!1), 2e3), w == null || w(he);
10129
10135
  } catch (Pe) {
10130
10136
  console.error("Failed to copy:", Pe);
10131
10137
  }
10132
- }, [O, Q, ee, V, w]), te = z.useCallback(() => {
10138
+ }, [O, Z, Q, V, w]), te = z.useCallback(() => {
10133
10139
  if (!v) return;
10134
- const ue = O ? Q : ee;
10140
+ const ue = O ? Z : Q;
10135
10141
  v(t.id, ue);
10136
- }, [v, t.id, O, Q, ee]), ce = z.useCallback(() => {
10142
+ }, [v, t.id, O, Z, Q]), ce = z.useCallback(() => {
10137
10143
  g == null || g(n);
10138
10144
  }, [g, n]), oe = z.useCallback(async (ue, de, he) => {
10139
10145
  if (!ae) {
@@ -10148,18 +10154,18 @@ const jb = z.memo(function({
10148
10154
  const ye = String(de.url ?? ""), Pe = ye.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
10149
10155
  if (Pe) {
10150
10156
  ue.preventDefault();
10151
- const M = Pe[1], X = de.name || `file_${M}`, ke = de.mimeType || "application/octet-stream";
10152
- H({ id: M, name: X, mimeType: ke }), P(!0);
10157
+ const M = Pe[1], X = de.name || `file_${M}`, Re = de.mimeType || "application/octet-stream";
10158
+ H({ id: M, name: X, mimeType: Re }), P(!0);
10153
10159
  return;
10154
10160
  }
10155
10161
  if (ye.startsWith("data:")) {
10156
- ue.preventDefault(), $((ke) => ({ ...ke, [he]: !0 }));
10162
+ ue.preventDefault(), $((Re) => ({ ...Re, [he]: !0 }));
10157
10163
  const M = `${de.name}_${de.size}_${Date.now()}`, X = j({ title: "Fetching file...", description: "", open: !0 });
10158
10164
  try {
10159
- const ke = await tw(N ?? void 0);
10160
- if (!ke || !Array.isArray(ke))
10165
+ const Re = await tw(N ?? void 0);
10166
+ if (!Re || !Array.isArray(Re))
10161
10167
  throw new Error("Invalid file list response");
10162
- const He = ke.find((Se) => !Se || typeof Se != "object" || !((Se.filename ?? "") === (de.name ?? "")) ? !1 : typeof de.size == "number" && typeof Se.size == "number" ? Se.size === de.size : !0);
10168
+ const He = Re.find((Se) => !Se || typeof Se != "object" || !((Se.filename ?? "") === (de.name ?? "")) ? !1 : typeof de.size == "number" && typeof Se.size == "number" ? Se.size === de.size : !0);
10163
10169
  if (!(He != null && He.id))
10164
10170
  throw new Error(`File "${de.name}" is not yet available on the server`);
10165
10171
  if (!He.id || !He.filename)
@@ -10169,16 +10175,16 @@ const jb = z.memo(function({
10169
10175
  name: de.name || He.filename || `file_${He.id}`,
10170
10176
  mimeType: de.mimeType || He.mime_type || "application/octet-stream"
10171
10177
  }), P(!0), X.update({ id: X.id, title: "Success", description: `Opened ${de.name}`, open: !0 });
10172
- } catch (ke) {
10173
- console.error("Failed to fetch server file:", ke);
10174
- const He = ke instanceof Error ? ke.message : "Unknown error occurred";
10178
+ } catch (Re) {
10179
+ console.error("Failed to fetch server file:", Re);
10180
+ const He = Re instanceof Error ? Re.message : "Unknown error occurred";
10175
10181
  X.update({ id: X.id, title: "Failed", description: He }), j({
10176
10182
  title: "Failed to fetch file",
10177
10183
  description: He,
10178
10184
  open: !0
10179
10185
  });
10180
10186
  } finally {
10181
- $((ke) => ({ ...ke, [he]: !1 }));
10187
+ $((Re) => ({ ...Re, [he]: !1 }));
10182
10188
  }
10183
10189
  }
10184
10190
  } catch (ye) {
@@ -10299,13 +10305,13 @@ const jb = z.memo(function({
10299
10305
  }
10300
10306
  ) });
10301
10307
  }, [D, A, W]), Ke = z.useCallback(() => {
10302
- const ue = ee.trim(), he = Xl(D, ue) ? Js(ue) : null;
10308
+ const ue = Q.trim(), he = Xl(D, ue) ? Js(ue) : null;
10303
10309
  if (he !== null) return /* @__PURE__ */ l.jsx(Zl, { data: he });
10304
10310
  if (D === "user" && h) {
10305
10311
  const ye = ue;
10306
10312
  if (ye.length > m)
10307
- return /* @__PURE__ */ l.jsxs(Il, { open: R, onOpenChange: E, children: [
10308
- /* @__PURE__ */ l.jsx("div", { className: J("text-sm text-[hsl(var(--chat-bubble-user-text))]", W && "text-xs"), children: R ? /* @__PURE__ */ l.jsx(Bs, { content: ye, allowHtml: !1 }) : /* @__PURE__ */ l.jsxs("pre", { className: J("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", W && "text-xs"), children: [
10313
+ return /* @__PURE__ */ l.jsxs(Il, { open: k, onOpenChange: E, children: [
10314
+ /* @__PURE__ */ l.jsx("div", { className: J("text-sm text-[hsl(var(--chat-bubble-user-text))]", W && "text-xs"), children: k ? /* @__PURE__ */ l.jsx(Bs, { content: ye, allowHtml: !1 }) : /* @__PURE__ */ l.jsxs("pre", { className: J("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", W && "text-xs"), children: [
10309
10315
  ye.substring(0, m),
10310
10316
  "..."
10311
10317
  ] }) }),
@@ -10315,8 +10321,8 @@ const jb = z.memo(function({
10315
10321
  variant: "ghost",
10316
10322
  size: "sm",
10317
10323
  className: "h-6 text-xs !text-[hsl(var(--chat-bubble-user-text))]",
10318
- children: R ? /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
10319
- /* @__PURE__ */ l.jsx(Rr, { className: "h-3 w-3 mr-1" }),
10324
+ children: k ? /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
10325
+ /* @__PURE__ */ l.jsx(kr, { className: "h-3 w-3 mr-1" }),
10320
10326
  " Show less"
10321
10327
  ] }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
10322
10328
  /* @__PURE__ */ l.jsx(nr, { className: "h-3 w-3 mr-1" }),
@@ -10328,31 +10334,31 @@ const jb = z.memo(function({
10328
10334
  ) })
10329
10335
  ] });
10330
10336
  }
10331
- return /* @__PURE__ */ l.jsx(Bs, { content: ee.trim(), allowHtml: !1 });
10332
- }, [ee, D, h, m, R, W]), at = z.useCallback(() => {
10333
- if (!(ee.trim().length > 0 || Z.length > 0 || Ee.length > 0) && !r)
10337
+ return /* @__PURE__ */ l.jsx(Bs, { content: Q.trim(), allowHtml: !1 });
10338
+ }, [Q, D, h, m, k, W]), at = z.useCallback(() => {
10339
+ if (!(Q.trim().length > 0 || ee.length > 0 || Ee.length > 0) && !r)
10334
10340
  return ze();
10335
10341
  if (t.model === "reflection") {
10336
- const de = ee.trim(), he = Js(de);
10342
+ const de = Q.trim(), he = Js(de);
10337
10343
  if (he && typeof he == "object")
10338
10344
  return /* @__PURE__ */ l.jsx(Ob, { data: he });
10339
10345
  }
10340
10346
  if (O && L.name === "get_issues") {
10341
- const de = t.content.find((Pe) => Pe.type === "tool_result"), he = (de == null ? void 0 : de.output) ?? Q, ye = vd(he);
10347
+ const de = t.content.find((Pe) => Pe.type === "tool_result"), he = (de == null ? void 0 : de.output) ?? Z, ye = vd(he);
10342
10348
  if (ye) return /* @__PURE__ */ l.jsx(Mb, { issues: ye });
10343
10349
  }
10344
10350
  if (O) {
10345
- const de = Rb(t.content);
10351
+ const de = kb(t.content);
10346
10352
  if (de.length > 0)
10347
10353
  return /* @__PURE__ */ l.jsx("div", { className: "space-y-2", children: de.map((he, ye) => {
10348
10354
  const Pe = typeof he.output == "string" ? he.output : bi(he.output), M = Pe.length > Pn ? `${Pe.slice(0, Pn)}
10349
10355
  … [truncated ${Pe.length - Pn} chars]` : Pe, X = S === "expanded";
10350
- return /* @__PURE__ */ l.jsxs(Il, { open: X, onOpenChange: (ke) => C(ke ? "expanded" : "preview"), children: [
10356
+ return /* @__PURE__ */ l.jsxs(Il, { open: X, onOpenChange: (Re) => C(Re ? "expanded" : "preview"), children: [
10351
10357
  /* @__PURE__ */ l.jsx("div", { className: "flex items-center gap-2 text-xs", children: /* @__PURE__ */ l.jsx(xi, { variant: "outline", children: (he.name ?? "tool") + (he.toolCallId ? ` • ${he.toolCallId.slice(0, 8)}` : "") }) }),
10352
10358
  /* @__PURE__ */ l.jsx("div", { className: "font-mono text-sm mt-1", children: /* @__PURE__ */ l.jsx("pre", { className: "whitespace-pre-wrap break-words", children: X ? M : M.slice(0, f) + (M.length > f ? "..." : "") }) }),
10353
10359
  /* @__PURE__ */ l.jsx(Nl, { asChild: !0, children: /* @__PURE__ */ l.jsx(Ue, { variant: "ghost", size: "sm", className: "h-6 text-xs", children: X ? /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
10354
10360
  " ",
10355
- /* @__PURE__ */ l.jsx(Rr, { className: "h-3 w-3 mr-1" }),
10361
+ /* @__PURE__ */ l.jsx(kr, { className: "h-3 w-3 mr-1" }),
10356
10362
  " Show less"
10357
10363
  ] }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
10358
10364
  /* @__PURE__ */ l.jsx(nr, { className: "h-3 w-3 mr-1" }),
@@ -10367,14 +10373,14 @@ const jb = z.memo(function({
10367
10373
  r && /* @__PURE__ */ l.jsx(_b, { className: Y })
10368
10374
  ] }) : /* @__PURE__ */ l.jsx("div", { className: "space-y-2", children: t.content.map((de, he) => /* @__PURE__ */ l.jsx(je, { part: de, i: he }, he)) });
10369
10375
  }, [
10370
- ee,
10371
- Z.length,
10376
+ Q,
10377
+ ee.length,
10372
10378
  Ee.length,
10373
10379
  r,
10374
10380
  t.model,
10375
10381
  O,
10376
10382
  L.name,
10377
- Q,
10383
+ Z,
10378
10384
  S,
10379
10385
  d,
10380
10386
  ze,
@@ -10416,7 +10422,7 @@ const jb = z.memo(function({
10416
10422
  onClick: () => C((ue) => ue === "collapsed" ? "preview" : "collapsed"),
10417
10423
  children: [
10418
10424
  /* @__PURE__ */ l.jsx("span", { children: L.name }),
10419
- /* @__PURE__ */ l.jsx("span", { className: "inline-flex items-center", children: S !== "collapsed" ? /* @__PURE__ */ l.jsx(Rr, { className: "h-3 w-3" }) : /* @__PURE__ */ l.jsx(nr, { className: "h-3 w-3" }) })
10425
+ /* @__PURE__ */ l.jsx("span", { className: "inline-flex items-center", children: S !== "collapsed" ? /* @__PURE__ */ l.jsx(kr, { className: "h-3 w-3" }) : /* @__PURE__ */ l.jsx(nr, { className: "h-3 w-3" }) })
10420
10426
  ]
10421
10427
  }
10422
10428
  ),
@@ -10429,7 +10435,7 @@ const jb = z.memo(function({
10429
10435
  onClick: () => C((ue) => ue === "collapsed" ? "preview" : "collapsed"),
10430
10436
  children: /* @__PURE__ */ l.jsxs("span", { className: "text-xs flex items-center gap-1", children: [
10431
10437
  "Tool Output ",
10432
- S !== "collapsed" ? /* @__PURE__ */ l.jsx(Rr, { className: "h-3 w-3" }) : /* @__PURE__ */ l.jsx(nr, { className: "h-3 w-3" })
10438
+ S !== "collapsed" ? /* @__PURE__ */ l.jsx(kr, { className: "h-3 w-3" }) : /* @__PURE__ */ l.jsx(nr, { className: "h-3 w-3" })
10433
10439
  ] })
10434
10440
  }
10435
10441
  )
@@ -10690,8 +10696,8 @@ const Ql = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, wd = z.forwa
10690
10696
  onScrollAway: g,
10691
10697
  onAtBottom: x
10692
10698
  }, w) => {
10693
- const y = rt(null), k = rt(null), S = rt(!1), [C, R] = me(!0), E = Ye((I) => {
10694
- R(I), g && g(!I), x && x(I);
10699
+ const y = rt(null), R = rt(null), S = rt(!1), [C, k] = me(!0), E = Ye((I) => {
10700
+ k(I), g && g(!I), x && x(I);
10695
10701
  }, [g, x]), N = Kt(() => {
10696
10702
  if (a)
10697
10703
  return async () => {
@@ -10719,7 +10725,7 @@ const Ql = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, wd = z.forwa
10719
10725
  y.current = I;
10720
10726
  },
10721
10727
  scrollerRef: (I) => {
10722
- k.current = I instanceof HTMLDivElement ? I : null;
10728
+ R.current = I instanceof HTMLDivElement ? I : null;
10723
10729
  },
10724
10730
  data: e,
10725
10731
  followOutput: j.current,
@@ -10821,15 +10827,15 @@ function ua(e) {
10821
10827
  i.displayName = t;
10822
10828
  const a = e + "CollectionSlot", c = lr(a), u = z.forwardRef(
10823
10829
  (v, g) => {
10824
- const { scope: x, children: w } = v, y = s(a, x), k = De(g, y.collectionRef);
10825
- return /* @__PURE__ */ l.jsx(c, { ref: k, children: w });
10830
+ const { scope: x, children: w } = v, y = s(a, x), R = De(g, y.collectionRef);
10831
+ return /* @__PURE__ */ l.jsx(c, { ref: R, children: w });
10826
10832
  }
10827
10833
  );
10828
10834
  u.displayName = a;
10829
10835
  const d = e + "CollectionItemSlot", f = "data-radix-collection-item", h = lr(d), m = z.forwardRef(
10830
10836
  (v, g) => {
10831
- const { scope: x, children: w, ...y } = v, k = z.useRef(null), S = De(g, k), C = s(d, x);
10832
- return z.useEffect(() => (C.itemMap.set(k, { ref: k, ...y }), () => void C.itemMap.delete(k))), /* @__PURE__ */ l.jsx(h, { [f]: "", ref: S, children: w });
10837
+ const { scope: x, children: w, ...y } = v, R = z.useRef(null), S = De(g, R), C = s(d, x);
10838
+ return z.useEffect(() => (C.itemMap.set(R, { ref: R, ...y }), () => void C.itemMap.delete(R))), /* @__PURE__ */ l.jsx(h, { [f]: "", ref: S, children: w });
10833
10839
  }
10834
10840
  );
10835
10841
  m.displayName = d;
@@ -10840,7 +10846,7 @@ function ua(e) {
10840
10846
  if (!w) return [];
10841
10847
  const y = Array.from(w.querySelectorAll(`[${f}]`));
10842
10848
  return Array.from(g.itemMap.values()).sort(
10843
- (C, R) => y.indexOf(C.ref.current) - y.indexOf(R.ref.current)
10849
+ (C, k) => y.indexOf(C.ref.current) - y.indexOf(k.ref.current)
10844
10850
  );
10845
10851
  }, [g.collectionRef, g.itemMap]);
10846
10852
  }
@@ -11031,7 +11037,7 @@ const Jb = async (e, t, n) => {
11031
11037
  } = a[v], {
11032
11038
  x: w,
11033
11039
  y,
11034
- data: k,
11040
+ data: R,
11035
11041
  reset: S
11036
11042
  } = await x({
11037
11043
  x: d,
@@ -11051,7 +11057,7 @@ const Jb = async (e, t, n) => {
11051
11057
  ...m,
11052
11058
  [g]: {
11053
11059
  ...m[g],
11054
- ...k
11060
+ ...R
11055
11061
  }
11056
11062
  }, S && b <= 50 && (b++, typeof S == "object" && (S.placement && (h = S.placement), S.rects && (u = S.rects === !0 ? await i.getElementRects({
11057
11063
  reference: e,
@@ -11096,7 +11102,7 @@ async function $r(e, t) {
11096
11102
  y: o,
11097
11103
  width: i.floating.width,
11098
11104
  height: i.floating.height
11099
- } : i.reference, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a.floating)), k = await (s.isElement == null ? void 0 : s.isElement(y)) ? await (s.getScale == null ? void 0 : s.getScale(y)) || {
11105
+ } : i.reference, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a.floating)), R = await (s.isElement == null ? void 0 : s.isElement(y)) ? await (s.getScale == null ? void 0 : s.getScale(y)) || {
11100
11106
  x: 1,
11101
11107
  y: 1
11102
11108
  } : {
@@ -11109,10 +11115,10 @@ async function $r(e, t) {
11109
11115
  strategy: c
11110
11116
  }) : w);
11111
11117
  return {
11112
- top: (x.top - S.top + b.top) / k.y,
11113
- bottom: (S.bottom - x.bottom + b.bottom) / k.y,
11114
- left: (x.left - S.left + b.left) / k.x,
11115
- right: (S.right - x.right + b.right) / k.x
11118
+ top: (x.top - S.top + b.top) / R.y,
11119
+ bottom: (S.bottom - x.bottom + b.bottom) / R.y,
11120
+ left: (x.left - S.left + b.left) / R.x,
11121
+ right: (S.right - x.right + b.right) / R.x
11116
11122
  };
11117
11123
  }
11118
11124
  const Zb = (e) => ({
@@ -11136,10 +11142,10 @@ const Zb = (e) => ({
11136
11142
  const f = bd(d), h = {
11137
11143
  x: n,
11138
11144
  y: r
11139
- }, m = ha(o), b = fa(m), v = await i.getDimensions(u), g = m === "y", x = g ? "top" : "left", w = g ? "bottom" : "right", y = g ? "clientHeight" : "clientWidth", k = s.reference[b] + s.reference[m] - h[m] - s.floating[b], S = h[m] - s.reference[m], C = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
11140
- let R = C ? C[y] : 0;
11141
- (!R || !await (i.isElement == null ? void 0 : i.isElement(C))) && (R = a.floating[y] || s.floating[b]);
11142
- const E = k / 2 - S / 2, N = R / 2 - v[b] / 2 - 1, j = Tn(f[x], N), I = Tn(f[w], N), $ = j, U = R - v[b] - I, P = R / 2 - v[b] / 2 + E, G = yi($, P, U), H = !c.arrow && gr(o) != null && P !== G && s.reference[b] / 2 - (P < $ ? j : I) - v[b] / 2 < 0, W = H ? P < $ ? P - $ : P - U : 0;
11145
+ }, m = ha(o), b = fa(m), v = await i.getDimensions(u), g = m === "y", x = g ? "top" : "left", w = g ? "bottom" : "right", y = g ? "clientHeight" : "clientWidth", R = s.reference[b] + s.reference[m] - h[m] - s.floating[b], S = h[m] - s.reference[m], C = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
11146
+ let k = C ? C[y] : 0;
11147
+ (!k || !await (i.isElement == null ? void 0 : i.isElement(C))) && (k = a.floating[y] || s.floating[b]);
11148
+ const E = R / 2 - S / 2, N = k / 2 - v[b] / 2 - 1, j = Tn(f[x], N), I = Tn(f[w], N), $ = j, U = k - v[b] - I, P = k / 2 - v[b] / 2 + E, G = yi($, P, U), H = !c.arrow && gr(o) != null && P !== G && s.reference[b] / 2 - (P < $ ? j : I) - v[b] / 2 < 0, W = H ? P < $ ? P - $ : P - U : 0;
11143
11149
  return {
11144
11150
  [m]: h[m] + W,
11145
11151
  data: {
@@ -11176,12 +11182,12 @@ const Zb = (e) => ({
11176
11182
  } = xn(e, t);
11177
11183
  if ((n = s.arrow) != null && n.alignmentOffset)
11178
11184
  return {};
11179
- const x = vn(o), w = sn(a), y = vn(a) === a, k = await (c.isRTL == null ? void 0 : c.isRTL(u.floating)), S = h || (y || !v ? [$o(a)] : Vb(a)), C = b !== "none";
11180
- !h && C && S.push(...Yb(a, v, b, k));
11181
- const R = [a, ...S], E = await $r(t, g), N = [];
11185
+ const x = vn(o), w = sn(a), y = vn(a) === a, R = await (c.isRTL == null ? void 0 : c.isRTL(u.floating)), S = h || (y || !v ? [$o(a)] : Vb(a)), C = b !== "none";
11186
+ !h && C && S.push(...Yb(a, v, b, R));
11187
+ const k = [a, ...S], E = await $r(t, g), N = [];
11182
11188
  let j = ((r = s.flip) == null ? void 0 : r.overflows) || [];
11183
11189
  if (d && N.push(E[x]), f) {
11184
- const P = Wb(o, i, k);
11190
+ const P = Wb(o, i, R);
11185
11191
  N.push(E[P[0]], E[P[1]]);
11186
11192
  }
11187
11193
  if (j = [...j, {
@@ -11189,7 +11195,7 @@ const Zb = (e) => ({
11189
11195
  overflows: N
11190
11196
  }], !N.every((P) => P <= 0)) {
11191
11197
  var I, $;
11192
- const P = (((I = s.flip) == null ? void 0 : I.index) || 0) + 1, G = R[P];
11198
+ const P = (((I = s.flip) == null ? void 0 : I.index) || 0) + 1, G = k[P];
11193
11199
  if (G && (!(f === "alignment" ? w !== sn(G) : !1) || // We leave the current main axis only if every placement on that axis
11194
11200
  // overflows the main axis.
11195
11201
  j.every((D) => sn(D.placement) === w ? D.overflows[0] > 0 : !0)))
@@ -11420,12 +11426,12 @@ const ny = function(e) {
11420
11426
  ...v
11421
11427
  };
11422
11428
  if (c) {
11423
- const y = h === "y" ? "height" : "width", k = s.reference[h] - s.floating[y] + g.mainAxis, S = s.reference[h] + s.reference[y] - g.mainAxis;
11424
- m < k ? m = k : m > S && (m = S);
11429
+ const y = h === "y" ? "height" : "width", R = s.reference[h] - s.floating[y] + g.mainAxis, S = s.reference[h] + s.reference[y] - g.mainAxis;
11430
+ m < R ? m = R : m > S && (m = S);
11425
11431
  }
11426
11432
  if (u) {
11427
11433
  var x, w;
11428
- const y = h === "y" ? "width" : "height", k = yd.has(vn(o)), S = s.reference[f] - s.floating[y] + (k && ((x = i.offset) == null ? void 0 : x[f]) || 0) + (k ? 0 : g.crossAxis), C = s.reference[f] + s.reference[y] + (k ? 0 : ((w = i.offset) == null ? void 0 : w[f]) || 0) - (k ? g.crossAxis : 0);
11434
+ const y = h === "y" ? "width" : "height", R = yd.has(vn(o)), S = s.reference[f] - s.floating[y] + (R && ((x = i.offset) == null ? void 0 : x[f]) || 0) + (R ? 0 : g.crossAxis), C = s.reference[f] + s.reference[y] + (R ? 0 : ((w = i.offset) == null ? void 0 : w[f]) || 0) - (R ? g.crossAxis : 0);
11429
11435
  b < S ? b = S : b > C && (b = C);
11430
11436
  }
11431
11437
  return {
@@ -11455,16 +11461,16 @@ const ny = function(e) {
11455
11461
  } = s.floating;
11456
11462
  let g, x;
11457
11463
  f === "top" || f === "bottom" ? (g = f, x = h === (await (i.isRTL == null ? void 0 : i.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (x = f, g = h === "end" ? "top" : "bottom");
11458
- const w = v - d.top - d.bottom, y = b - d.left - d.right, k = Tn(v - d[g], w), S = Tn(b - d[x], y), C = !t.middlewareData.shift;
11459
- let R = k, E = S;
11460
- if ((n = t.middlewareData.shift) != null && n.enabled.x && (E = y), (r = t.middlewareData.shift) != null && r.enabled.y && (R = w), C && !h) {
11464
+ const w = v - d.top - d.bottom, y = b - d.left - d.right, R = Tn(v - d[g], w), S = Tn(b - d[x], y), C = !t.middlewareData.shift;
11465
+ let k = R, E = S;
11466
+ if ((n = t.middlewareData.shift) != null && n.enabled.x && (E = y), (r = t.middlewareData.shift) != null && r.enabled.y && (k = w), C && !h) {
11461
11467
  const j = At(d.left, 0), I = At(d.right, 0), $ = At(d.top, 0), U = At(d.bottom, 0);
11462
- m ? E = b - 2 * (j !== 0 || I !== 0 ? j + I : At(d.left, d.right)) : R = v - 2 * ($ !== 0 || U !== 0 ? $ + U : At(d.top, d.bottom));
11468
+ m ? E = b - 2 * (j !== 0 || I !== 0 ? j + I : At(d.left, d.right)) : k = v - 2 * ($ !== 0 || U !== 0 ? $ + U : At(d.top, d.bottom));
11463
11469
  }
11464
11470
  await c({
11465
11471
  ...t,
11466
11472
  availableWidth: E,
11467
- availableHeight: R
11473
+ availableHeight: k
11468
11474
  });
11469
11475
  const N = await i.getDimensions(a.floating);
11470
11476
  return b !== N.width || v !== N.height ? {
@@ -11531,13 +11537,13 @@ function pa(e) {
11531
11537
  return uy.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) || dy.some((r) => (n.willChange || "").includes(r)) || fy.some((r) => (n.contain || "").includes(r));
11532
11538
  }
11533
11539
  function hy(e) {
11534
- let t = kn(e);
11540
+ let t = Rn(e);
11535
11541
  for (; cn(t) && !ur(t); ) {
11536
11542
  if (pa(t))
11537
11543
  return t;
11538
11544
  if (xs(t))
11539
11545
  return null;
11540
- t = kn(t);
11546
+ t = Rn(t);
11541
11547
  }
11542
11548
  return null;
11543
11549
  }
@@ -11560,7 +11566,7 @@ function vs(e) {
11560
11566
  scrollTop: e.scrollY
11561
11567
  };
11562
11568
  }
11563
- function kn(e) {
11569
+ function Rn(e) {
11564
11570
  if (xr(e) === "html")
11565
11571
  return e;
11566
11572
  const t = (
@@ -11573,7 +11579,7 @@ function kn(e) {
11573
11579
  return sc(t) ? t.host : t;
11574
11580
  }
11575
11581
  function Cd(e) {
11576
- const t = kn(e);
11582
+ const t = Rn(e);
11577
11583
  return ur(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : cn(t) && Yr(t) ? t : Cd(t);
11578
11584
  }
11579
11585
  function Fr(e, t, n) {
@@ -11618,7 +11624,7 @@ function ir(e) {
11618
11624
  };
11619
11625
  }
11620
11626
  const my = /* @__PURE__ */ ln(0);
11621
- function kd(e) {
11627
+ function Rd(e) {
11622
11628
  const t = Pt(e);
11623
11629
  return !ma() || !t.visualViewport ? my : {
11624
11630
  x: t.visualViewport.offsetLeft,
@@ -11633,14 +11639,14 @@ function Wn(e, t, n, r) {
11633
11639
  const o = e.getBoundingClientRect(), s = ga(e);
11634
11640
  let i = ln(1);
11635
11641
  t && (r ? Yt(r) && (i = ir(r)) : i = ir(e));
11636
- const a = gy(s, n, r) ? kd(s) : ln(0);
11642
+ const a = gy(s, n, r) ? Rd(s) : ln(0);
11637
11643
  let c = (o.left + a.x) / i.x, u = (o.top + a.y) / i.y, d = o.width / i.x, f = o.height / i.y;
11638
11644
  if (s) {
11639
11645
  const h = Pt(s), m = r && Yt(r) ? Pt(r) : r;
11640
11646
  let b = h, v = Ci(b);
11641
11647
  for (; v && r && m !== b; ) {
11642
- const g = ir(v), x = v.getBoundingClientRect(), w = Xt(v), y = x.left + (v.clientLeft + parseFloat(w.paddingLeft)) * g.x, k = x.top + (v.clientTop + parseFloat(w.paddingTop)) * g.y;
11643
- c *= g.x, u *= g.y, d *= g.x, f *= g.y, c += y, u += k, b = Pt(v), v = Ci(b);
11648
+ const g = ir(v), x = v.getBoundingClientRect(), w = Xt(v), y = x.left + (v.clientLeft + parseFloat(w.paddingLeft)) * g.x, R = x.top + (v.clientTop + parseFloat(w.paddingTop)) * g.y;
11649
+ c *= g.x, u *= g.y, d *= g.x, f *= g.y, c += y, u += R, b = Pt(v), v = Ci(b);
11644
11650
  }
11645
11651
  }
11646
11652
  return Fo({
@@ -11654,7 +11660,7 @@ function xa(e, t) {
11654
11660
  const n = vs(e).scrollLeft;
11655
11661
  return t ? t.left + n : Wn(fn(e)).left + n;
11656
11662
  }
11657
- function Rd(e, t, n) {
11663
+ function kd(e, t, n) {
11658
11664
  n === void 0 && (n = !1);
11659
11665
  const r = e.getBoundingClientRect(), o = r.left + t.scrollLeft - (n ? 0 : (
11660
11666
  // RTL <body> scrollbar.
@@ -11684,7 +11690,7 @@ function xy(e) {
11684
11690
  const m = Wn(r);
11685
11691
  u = ir(r), d.x = m.x + r.clientLeft, d.y = m.y + r.clientTop;
11686
11692
  }
11687
- const h = i && !f && !s ? Rd(i, c, !0) : ln(0);
11693
+ const h = i && !f && !s ? kd(i, c, !0) : ln(0);
11688
11694
  return {
11689
11695
  width: n.width * u.x,
11690
11696
  height: n.height * u.y,
@@ -11740,7 +11746,7 @@ function ic(e, t, n) {
11740
11746
  else if (Yt(t))
11741
11747
  r = Sy(t, n);
11742
11748
  else {
11743
- const o = kd(e);
11749
+ const o = Rd(e);
11744
11750
  r = {
11745
11751
  x: t.x - o.x,
11746
11752
  y: t.y - o.y,
@@ -11751,7 +11757,7 @@ function ic(e, t, n) {
11751
11757
  return Fo(r);
11752
11758
  }
11753
11759
  function Ed(e, t) {
11754
- const n = kn(e);
11760
+ const n = Rn(e);
11755
11761
  return n === t || !Yt(n) || ur(n) ? !1 : Xt(n).position === "fixed" || Ed(n, t);
11756
11762
  }
11757
11763
  function Cy(e, t) {
@@ -11760,10 +11766,10 @@ function Cy(e, t) {
11760
11766
  return n;
11761
11767
  let r = Fr(e, [], !1).filter((a) => Yt(a) && xr(a) !== "body"), o = null;
11762
11768
  const s = Xt(e).position === "fixed";
11763
- let i = s ? kn(e) : e;
11769
+ let i = s ? Rn(e) : e;
11764
11770
  for (; Yt(i) && !ur(i); ) {
11765
11771
  const a = Xt(i), c = pa(i);
11766
- !c && a.position === "fixed" && (o = null), (s ? !c && !o : !c && a.position === "static" && !!o && yy.has(o.position) || Yr(i) && !c && Ed(e, i)) ? r = r.filter((d) => d !== i) : o = a, i = kn(i);
11772
+ !c && a.position === "fixed" && (o = null), (s ? !c && !o : !c && a.position === "static" && !!o && yy.has(o.position) || Yr(i) && !c && Ed(e, i)) ? r = r.filter((d) => d !== i) : o = a, i = Rn(i);
11767
11773
  }
11768
11774
  return t.set(e, r), r;
11769
11775
  }
@@ -11785,7 +11791,7 @@ function Ty(e) {
11785
11791
  y: c.top
11786
11792
  };
11787
11793
  }
11788
- function ky(e) {
11794
+ function Ry(e) {
11789
11795
  const {
11790
11796
  width: t,
11791
11797
  height: n
@@ -11795,7 +11801,7 @@ function ky(e) {
11795
11801
  height: n
11796
11802
  };
11797
11803
  }
11798
- function Ry(e, t, n) {
11804
+ function ky(e, t, n) {
11799
11805
  const r = cn(t), o = fn(t), s = n === "fixed", i = Wn(e, !0, s, t);
11800
11806
  let a = {
11801
11807
  scrollLeft: 0,
@@ -11811,7 +11817,7 @@ function Ry(e, t, n) {
11811
11817
  c.x = m.x + t.clientLeft, c.y = m.y + t.clientTop;
11812
11818
  } else o && u();
11813
11819
  s && !r && o && u();
11814
- const d = o && !r && !s ? Rd(o, a) : ln(0), f = i.left + a.scrollLeft - c.x - d.x, h = i.top + a.scrollTop - c.y - d.y;
11820
+ const d = o && !r && !s ? kd(o, a) : ln(0), f = i.left + a.scrollLeft - c.x - d.x, h = i.top + a.scrollTop - c.y - d.y;
11815
11821
  return {
11816
11822
  x: f,
11817
11823
  y: h,
@@ -11835,11 +11841,11 @@ function Id(e, t) {
11835
11841
  if (xs(e))
11836
11842
  return n;
11837
11843
  if (!cn(e)) {
11838
- let o = kn(e);
11844
+ let o = Rn(e);
11839
11845
  for (; o && !ur(o); ) {
11840
11846
  if (Yt(o) && !Zs(o))
11841
11847
  return o;
11842
- o = kn(o);
11848
+ o = Rn(o);
11843
11849
  }
11844
11850
  return n;
11845
11851
  }
@@ -11851,7 +11857,7 @@ function Id(e, t) {
11851
11857
  const Ey = async function(e) {
11852
11858
  const t = this.getOffsetParent || Id, n = this.getDimensions, r = await n(e.floating);
11853
11859
  return {
11854
- reference: Ry(e.reference, await t(e.floating), e.strategy),
11860
+ reference: ky(e.reference, await t(e.floating), e.strategy),
11855
11861
  floating: {
11856
11862
  x: 0,
11857
11863
  y: 0,
@@ -11870,7 +11876,7 @@ const Ny = {
11870
11876
  getOffsetParent: Id,
11871
11877
  getElementRects: Ey,
11872
11878
  getClientRects: vy,
11873
- getDimensions: ky,
11879
+ getDimensions: Ry,
11874
11880
  getScale: ir,
11875
11881
  isElement: Yt,
11876
11882
  isRTL: Iy
@@ -11899,17 +11905,17 @@ function Ay(e, t) {
11899
11905
  rootMargin: -b + "px " + -v + "px " + -g + "px " + -x + "px",
11900
11906
  threshold: At(0, Tn(1, c)) || 1
11901
11907
  };
11902
- let k = !0;
11908
+ let R = !0;
11903
11909
  function S(C) {
11904
- const R = C[0].intersectionRatio;
11905
- if (R !== c) {
11906
- if (!k)
11910
+ const k = C[0].intersectionRatio;
11911
+ if (k !== c) {
11912
+ if (!R)
11907
11913
  return i();
11908
- R ? i(!1, R) : r = setTimeout(() => {
11914
+ k ? i(!1, k) : r = setTimeout(() => {
11909
11915
  i(!1, 1e-7);
11910
11916
  }, 1e3);
11911
11917
  }
11912
- R === 1 && !Nd(u, e.getBoundingClientRect()) && i(), k = !1;
11918
+ k === 1 && !Nd(u, e.getBoundingClientRect()) && i(), R = !1;
11913
11919
  }
11914
11920
  try {
11915
11921
  n = new IntersectionObserver(S, {
@@ -12044,16 +12050,16 @@ function By(e) {
12044
12050
  const [b, v] = p.useState(null), [g, x] = p.useState(null), w = p.useCallback((D) => {
12045
12051
  D !== C.current && (C.current = D, v(D));
12046
12052
  }, []), y = p.useCallback((D) => {
12047
- D !== R.current && (R.current = D, x(D));
12048
- }, []), k = s || b, S = i || g, C = p.useRef(null), R = p.useRef(null), E = p.useRef(d), N = c != null, j = Qs(c), I = Qs(o), $ = Qs(u), U = p.useCallback(() => {
12049
- if (!C.current || !R.current)
12053
+ D !== k.current && (k.current = D, x(D));
12054
+ }, []), R = s || b, S = i || g, C = p.useRef(null), k = p.useRef(null), E = p.useRef(d), N = c != null, j = Qs(c), I = Qs(o), $ = Qs(u), U = p.useCallback(() => {
12055
+ if (!C.current || !k.current)
12050
12056
  return;
12051
12057
  const D = {
12052
12058
  placement: t,
12053
12059
  strategy: n,
12054
12060
  middleware: h
12055
12061
  };
12056
- I.current && (D.platform = I.current), $y(C.current, R.current, D).then((O) => {
12062
+ I.current && (D.platform = I.current), $y(C.current, k.current, D).then((O) => {
12057
12063
  const ae = {
12058
12064
  ...O,
12059
12065
  // The floating element's position may be recomputed while it's closed
@@ -12077,21 +12083,21 @@ function By(e) {
12077
12083
  Co(() => (P.current = !0, () => {
12078
12084
  P.current = !1;
12079
12085
  }), []), Co(() => {
12080
- if (k && (C.current = k), S && (R.current = S), k && S) {
12086
+ if (R && (C.current = R), S && (k.current = S), R && S) {
12081
12087
  if (j.current)
12082
- return j.current(k, S, U);
12088
+ return j.current(R, S, U);
12083
12089
  U();
12084
12090
  }
12085
- }, [k, S, U, j, N]);
12091
+ }, [R, S, U, j, N]);
12086
12092
  const G = p.useMemo(() => ({
12087
12093
  reference: C,
12088
- floating: R,
12094
+ floating: k,
12089
12095
  setReference: w,
12090
12096
  setFloating: y
12091
12097
  }), [w, y]), H = p.useMemo(() => ({
12092
- reference: k,
12098
+ reference: R,
12093
12099
  floating: S
12094
- }), [k, S]), W = p.useMemo(() => {
12100
+ }), [R, S]), W = p.useMemo(() => {
12095
12101
  const D = {
12096
12102
  position: n,
12097
12103
  left: 0,
@@ -12235,7 +12241,7 @@ var wa = "PopperContent", [Qy, e0] = Pd(wa), $d = p.forwardRef(
12235
12241
  updatePositionStrategy: m = "optimized",
12236
12242
  onPlaced: b,
12237
12243
  ...v
12238
- } = e, g = Od(wa, n), [x, w] = p.useState(null), y = De(t, (Oe) => w(Oe)), [k, S] = p.useState(null), C = jd(k), R = (C == null ? void 0 : C.width) ?? 0, E = (C == null ? void 0 : C.height) ?? 0, N = r + (s !== "center" ? "-" + s : ""), j = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, I = Array.isArray(u) ? u : [u], $ = I.length > 0, U = {
12244
+ } = e, g = Od(wa, n), [x, w] = p.useState(null), y = De(t, (Oe) => w(Oe)), [R, S] = p.useState(null), C = jd(R), k = (C == null ? void 0 : C.width) ?? 0, E = (C == null ? void 0 : C.height) ?? 0, N = r + (s !== "center" ? "-" + s : ""), j = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, I = Array.isArray(u) ? u : [u], $ = I.length > 0, U = {
12239
12245
  padding: j,
12240
12246
  boundary: I.filter(n0),
12241
12247
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
@@ -12266,17 +12272,17 @@ var wa = "PopperContent", [Qy, e0] = Pd(wa), $d = p.forwardRef(
12266
12272
  Ke.setProperty("--radix-popper-available-width", `${ve}px`), Ke.setProperty("--radix-popper-available-height", `${je}px`), Ke.setProperty("--radix-popper-anchor-width", `${ze}px`), Ke.setProperty("--radix-popper-anchor-height", `${Ze}px`);
12267
12273
  }
12268
12274
  }),
12269
- k && Yy({ element: k, padding: a }),
12270
- r0({ arrowWidth: R, arrowHeight: E }),
12275
+ R && Yy({ element: R, padding: a }),
12276
+ r0({ arrowWidth: k, arrowHeight: E }),
12271
12277
  h && Gy({ strategy: "referenceHidden", ...U })
12272
12278
  ]
12273
12279
  }), [O, ae] = Bd(H), Y = mt(b);
12274
12280
  ft(() => {
12275
12281
  W && (Y == null || Y());
12276
12282
  }, [W, Y]);
12277
- const ee = (V = D.arrow) == null ? void 0 : V.x, L = (A = D.arrow) == null ? void 0 : A.y, Z = ((q = D.arrow) == null ? void 0 : q.centerOffset) !== 0, [Ee, Q] = p.useState();
12283
+ const Q = (V = D.arrow) == null ? void 0 : V.x, L = (A = D.arrow) == null ? void 0 : A.y, ee = ((q = D.arrow) == null ? void 0 : q.centerOffset) !== 0, [Ee, Z] = p.useState();
12278
12284
  return ft(() => {
12279
- x && Q(window.getComputedStyle(x).zIndex);
12285
+ x && Z(window.getComputedStyle(x).zIndex);
12280
12286
  }, [x]), /* @__PURE__ */ l.jsx(
12281
12287
  "div",
12282
12288
  {
@@ -12307,9 +12313,9 @@ var wa = "PopperContent", [Qy, e0] = Pd(wa), $d = p.forwardRef(
12307
12313
  scope: n,
12308
12314
  placedSide: O,
12309
12315
  onArrowChange: S,
12310
- arrowX: ee,
12316
+ arrowX: Q,
12311
12317
  arrowY: L,
12312
- shouldHideArrow: Z,
12318
+ shouldHideArrow: ee,
12313
12319
  children: /* @__PURE__ */ l.jsx(
12314
12320
  Te.div,
12315
12321
  {
@@ -12424,7 +12430,7 @@ var c0 = p.forwardRef((e, t) => {
12424
12430
  defaultProp: a ?? null,
12425
12431
  onChange: c,
12426
12432
  caller: Xr
12427
- }), [x, w] = p.useState(!1), y = mt(u), k = Kd(n), S = p.useRef(!1), [C, R] = p.useState(0);
12433
+ }), [x, w] = p.useState(!1), y = mt(u), R = Kd(n), S = p.useRef(!1), [C, k] = p.useState(0);
12428
12434
  return p.useEffect(() => {
12429
12435
  const E = h.current;
12430
12436
  if (E)
@@ -12443,11 +12449,11 @@ var c0 = p.forwardRef((e, t) => {
12443
12449
  ),
12444
12450
  onItemShiftTab: p.useCallback(() => w(!0), []),
12445
12451
  onFocusableItemAdd: p.useCallback(
12446
- () => R((E) => E + 1),
12452
+ () => k((E) => E + 1),
12447
12453
  []
12448
12454
  ),
12449
12455
  onFocusableItemRemove: p.useCallback(
12450
- () => R((E) => E - 1),
12456
+ () => k((E) => E - 1),
12451
12457
  []
12452
12458
  ),
12453
12459
  children: /* @__PURE__ */ l.jsx(
@@ -12466,7 +12472,7 @@ var c0 = p.forwardRef((e, t) => {
12466
12472
  if (E.target === E.currentTarget && N && !x) {
12467
12473
  const j = new CustomEvent(ei, o0);
12468
12474
  if (E.currentTarget.dispatchEvent(j), !j.defaultPrevented) {
12469
- const I = k().filter((H) => H.focusable), $ = I.find((H) => H.active), U = I.find((H) => H.id === v), G = [$, U, ...I].filter(
12475
+ const I = R().filter((H) => H.focusable), $ = I.find((H) => H.active), U = I.find((H) => H.id === v), G = [$, U, ...I].filter(
12470
12476
  Boolean
12471
12477
  ).map((H) => H.ref.current);
12472
12478
  Jd(G, d);
@@ -12520,12 +12526,12 @@ var c0 = p.forwardRef((e, t) => {
12520
12526
  if (x !== void 0) {
12521
12527
  if (g.metaKey || g.ctrlKey || g.altKey || g.shiftKey) return;
12522
12528
  g.preventDefault();
12523
- let y = h().filter((k) => k.focusable).map((k) => k.ref.current);
12529
+ let y = h().filter((R) => R.focusable).map((R) => R.ref.current);
12524
12530
  if (x === "last") y.reverse();
12525
12531
  else if (x === "prev" || x === "next") {
12526
12532
  x === "prev" && y.reverse();
12527
- const k = y.indexOf(g.currentTarget);
12528
- y = d.loop ? h0(y, k + 1) : y.slice(k + 1);
12533
+ const R = y.indexOf(g.currentTarget);
12534
+ y = d.loop ? h0(y, R + 1) : y.slice(R + 1);
12529
12535
  }
12530
12536
  setTimeout(() => Jd(y));
12531
12537
  }
@@ -12564,9 +12570,9 @@ function Jd(e, t = !1) {
12564
12570
  function h0(e, t) {
12565
12571
  return e.map((n, r) => e[(t + r) % e.length]);
12566
12572
  }
12567
- var p0 = Gd, m0 = Xd, ki = ["Enter", " "], g0 = ["ArrowDown", "PageUp", "Home"], Zd = ["ArrowUp", "PageDown", "End"], x0 = [...g0, ...Zd], v0 = {
12568
- ltr: [...ki, "ArrowRight"],
12569
- rtl: [...ki, "ArrowLeft"]
12573
+ var p0 = Gd, m0 = Xd, Ri = ["Enter", " "], g0 = ["ArrowDown", "PageUp", "Home"], Zd = ["ArrowUp", "PageDown", "End"], x0 = [...g0, ...Zd], v0 = {
12574
+ ltr: [...Ri, "ArrowRight"],
12575
+ rtl: [...Ri, "ArrowLeft"]
12570
12576
  }, w0 = {
12571
12577
  ltr: ["ArrowLeft"],
12572
12578
  rtl: ["ArrowRight"]
@@ -12613,14 +12619,14 @@ var T0 = "MenuAnchor", ba = p.forwardRef(
12613
12619
  }
12614
12620
  );
12615
12621
  ba.displayName = T0;
12616
- var ya = "MenuPortal", [k0, nf] = Xn(ya, {
12622
+ var ya = "MenuPortal", [R0, nf] = Xn(ya, {
12617
12623
  forceMount: void 0
12618
12624
  }), rf = (e) => {
12619
12625
  const { __scopeMenu: t, forceMount: n, children: r, container: o } = e, s = Jn(ya, t);
12620
- return /* @__PURE__ */ l.jsx(k0, { scope: t, forceMount: n, children: /* @__PURE__ */ l.jsx(Ot, { present: n || s.open, children: /* @__PURE__ */ l.jsx(ls, { asChild: !0, container: o, children: r }) }) });
12626
+ return /* @__PURE__ */ l.jsx(R0, { scope: t, forceMount: n, children: /* @__PURE__ */ l.jsx(Ot, { present: n || s.open, children: /* @__PURE__ */ l.jsx(ls, { asChild: !0, container: o, children: r }) }) });
12621
12627
  };
12622
12628
  rf.displayName = ya;
12623
- var Ht = "MenuContent", [R0, Sa] = Xn(Ht), of = p.forwardRef(
12629
+ var Ht = "MenuContent", [k0, Sa] = Xn(Ht), of = p.forwardRef(
12624
12630
  (e, t) => {
12625
12631
  const n = nf(Ht, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = Jn(Ht, e.__scopeMenu), i = Zr(Ht, e.__scopeMenu);
12626
12632
  return /* @__PURE__ */ l.jsx(zr.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(Ot, { present: r || s.open, children: /* @__PURE__ */ l.jsx(zr.Slot, { scope: e.__scopeMenu, children: i.modal ? /* @__PURE__ */ l.jsx(E0, { ...o, ref: t }) : /* @__PURE__ */ l.jsx(I0, { ...o, ref: t }) }) }) });
@@ -12678,20 +12684,20 @@ var Ht = "MenuContent", [R0, Sa] = Xn(Ht), of = p.forwardRef(
12678
12684
  onDismiss: m,
12679
12685
  disableOutsideScroll: b,
12680
12686
  ...v
12681
- } = e, g = Jn(Ht, n), x = Zr(Ht, n), w = bs(n), y = ef(n), k = b0(n), [S, C] = p.useState(null), R = p.useRef(null), E = De(t, R, g.onContentChange), N = p.useRef(0), j = p.useRef(""), I = p.useRef(0), $ = p.useRef(null), U = p.useRef("right"), P = p.useRef(0), G = b ? us : p.Fragment, H = b ? { as: N0, allowPinchZoom: !0 } : void 0, W = (O) => {
12687
+ } = e, g = Jn(Ht, n), x = Zr(Ht, n), w = bs(n), y = ef(n), R = b0(n), [S, C] = p.useState(null), k = p.useRef(null), E = De(t, k, g.onContentChange), N = p.useRef(0), j = p.useRef(""), I = p.useRef(0), $ = p.useRef(null), U = p.useRef("right"), P = p.useRef(0), G = b ? us : p.Fragment, H = b ? { as: N0, allowPinchZoom: !0 } : void 0, W = (O) => {
12682
12688
  var V, A;
12683
- const ae = j.current + O, Y = k().filter((q) => !q.disabled), ee = document.activeElement, L = (V = Y.find((q) => q.ref.current === ee)) == null ? void 0 : V.textValue, Z = Y.map((q) => q.textValue), Ee = B0(Z, ae, L), Q = (A = Y.find((q) => q.textValue === Ee)) == null ? void 0 : A.ref.current;
12689
+ const ae = j.current + O, Y = R().filter((q) => !q.disabled), Q = document.activeElement, L = (V = Y.find((q) => q.ref.current === Q)) == null ? void 0 : V.textValue, ee = Y.map((q) => q.textValue), Ee = B0(ee, ae, L), Z = (A = Y.find((q) => q.textValue === Ee)) == null ? void 0 : A.ref.current;
12684
12690
  (function q(te) {
12685
12691
  j.current = te, window.clearTimeout(N.current), te !== "" && (N.current = window.setTimeout(() => q(""), 1e3));
12686
- })(ae), Q && setTimeout(() => Q.focus());
12692
+ })(ae), Z && setTimeout(() => Z.focus());
12687
12693
  };
12688
12694
  p.useEffect(() => () => window.clearTimeout(N.current), []), sa();
12689
12695
  const D = p.useCallback((O) => {
12690
- var Y, ee;
12691
- return U.current === ((Y = $.current) == null ? void 0 : Y.side) && U0(O, (ee = $.current) == null ? void 0 : ee.area);
12696
+ var Y, Q;
12697
+ return U.current === ((Y = $.current) == null ? void 0 : Y.side) && U0(O, (Q = $.current) == null ? void 0 : Q.area);
12692
12698
  }, []);
12693
12699
  return /* @__PURE__ */ l.jsx(
12694
- R0,
12700
+ k0,
12695
12701
  {
12696
12702
  scope: n,
12697
12703
  searchRef: j,
@@ -12704,7 +12710,7 @@ var Ht = "MenuContent", [R0, Sa] = Xn(Ht), of = p.forwardRef(
12704
12710
  onItemLeave: p.useCallback(
12705
12711
  (O) => {
12706
12712
  var ae;
12707
- D(O) || ((ae = R.current) == null || ae.focus(), C(null));
12713
+ D(O) || ((ae = k.current) == null || ae.focus(), C(null));
12708
12714
  },
12709
12715
  [D]
12710
12716
  ),
@@ -12725,7 +12731,7 @@ var Ht = "MenuContent", [R0, Sa] = Xn(Ht), of = p.forwardRef(
12725
12731
  trapped: o,
12726
12732
  onMountAutoFocus: le(s, (O) => {
12727
12733
  var ae;
12728
- O.preventDefault(), (ae = R.current) == null || ae.focus({ preventScroll: !0 });
12734
+ O.preventDefault(), (ae = k.current) == null || ae.focus({ preventScroll: !0 });
12729
12735
  }),
12730
12736
  onUnmountAutoFocus: i,
12731
12737
  children: /* @__PURE__ */ l.jsx(
@@ -12765,13 +12771,13 @@ var Ht = "MenuContent", [R0, Sa] = Xn(Ht), of = p.forwardRef(
12765
12771
  ref: E,
12766
12772
  style: { outline: "none", ...v.style },
12767
12773
  onKeyDown: le(v.onKeyDown, (O) => {
12768
- const Y = O.target.closest("[data-radix-menu-content]") === O.currentTarget, ee = O.ctrlKey || O.altKey || O.metaKey, L = O.key.length === 1;
12769
- Y && (O.key === "Tab" && O.preventDefault(), !ee && L && W(O.key));
12770
- const Z = R.current;
12771
- if (O.target !== Z || !x0.includes(O.key)) return;
12774
+ const Y = O.target.closest("[data-radix-menu-content]") === O.currentTarget, Q = O.ctrlKey || O.altKey || O.metaKey, L = O.key.length === 1;
12775
+ Y && (O.key === "Tab" && O.preventDefault(), !Q && L && W(O.key));
12776
+ const ee = k.current;
12777
+ if (O.target !== ee || !x0.includes(O.key)) return;
12772
12778
  O.preventDefault();
12773
- const Q = k().filter((V) => !V.disabled).map((V) => V.ref.current);
12774
- Zd.includes(O.key) && Q.reverse(), F0(Q);
12779
+ const Z = R().filter((V) => !V.disabled).map((V) => V.ref.current);
12780
+ Zd.includes(O.key) && Z.reverse(), F0(Z);
12775
12781
  }),
12776
12782
  onBlur: le(e.onBlur, (O) => {
12777
12783
  O.currentTarget.contains(O.target) || (window.clearTimeout(N.current), j.current = "");
@@ -12781,8 +12787,8 @@ var Ht = "MenuContent", [R0, Sa] = Xn(Ht), of = p.forwardRef(
12781
12787
  Br((O) => {
12782
12788
  const ae = O.target, Y = P.current !== O.clientX;
12783
12789
  if (O.currentTarget.contains(ae) && Y) {
12784
- const ee = O.clientX > P.current ? "right" : "left";
12785
- U.current = ee, P.current = O.clientX;
12790
+ const Q = O.clientX > P.current ? "right" : "left";
12791
+ U.current = Q, P.current = O.clientX;
12786
12792
  }
12787
12793
  })
12788
12794
  )
@@ -12819,7 +12825,7 @@ var Bo = "MenuItem", uc = "menu.itemSelect", ys = p.forwardRef(
12819
12825
  const f = s.current;
12820
12826
  if (!n && f) {
12821
12827
  const h = new CustomEvent(uc, { bubbles: !0, cancelable: !0 });
12822
- f.addEventListener(uc, (m) => r == null ? void 0 : r(m), { once: !0 }), ku(f, h), h.defaultPrevented ? u.current = !1 : i.onClose();
12828
+ f.addEventListener(uc, (m) => r == null ? void 0 : r(m), { once: !0 }), Ru(f, h), h.defaultPrevented ? u.current = !1 : i.onClose();
12823
12829
  }
12824
12830
  };
12825
12831
  return /* @__PURE__ */ l.jsx(
@@ -12839,7 +12845,7 @@ var Bo = "MenuItem", uc = "menu.itemSelect", ys = p.forwardRef(
12839
12845
  }),
12840
12846
  onKeyDown: le(e.onKeyDown, (f) => {
12841
12847
  const h = a.searchRef.current !== "";
12842
- n || h && f.key === " " || ki.includes(f.key) && (f.currentTarget.click(), f.preventDefault());
12848
+ n || h && f.key === " " || Ri.includes(f.key) && (f.currentTarget.click(), f.preventDefault());
12843
12849
  })
12844
12850
  }
12845
12851
  );
@@ -12894,7 +12900,7 @@ var af = p.forwardRef(
12894
12900
  "aria-checked": Ho(n) ? "mixed" : n,
12895
12901
  ...o,
12896
12902
  ref: t,
12897
- "data-state": Ra(n),
12903
+ "data-state": ka(n),
12898
12904
  onSelect: le(
12899
12905
  o.onSelect,
12900
12906
  () => r == null ? void 0 : r(Ho(n) ? !0 : !n),
@@ -12926,7 +12932,7 @@ var df = "MenuRadioItem", ff = p.forwardRef(
12926
12932
  "aria-checked": s,
12927
12933
  ...r,
12928
12934
  ref: t,
12929
- "data-state": Ra(s),
12935
+ "data-state": ka(s),
12930
12936
  onSelect: le(
12931
12937
  r.onSelect,
12932
12938
  () => {
@@ -12940,12 +12946,12 @@ var df = "MenuRadioItem", ff = p.forwardRef(
12940
12946
  }
12941
12947
  );
12942
12948
  ff.displayName = df;
12943
- var ka = "MenuItemIndicator", [hf, M0] = Xn(
12944
- ka,
12949
+ var Ra = "MenuItemIndicator", [hf, M0] = Xn(
12950
+ Ra,
12945
12951
  { checked: !1 }
12946
12952
  ), pf = p.forwardRef(
12947
12953
  (e, t) => {
12948
- const { __scopeMenu: n, forceMount: r, ...o } = e, s = M0(ka, n);
12954
+ const { __scopeMenu: n, forceMount: r, ...o } = e, s = M0(Ra, n);
12949
12955
  return /* @__PURE__ */ l.jsx(
12950
12956
  Ot,
12951
12957
  {
@@ -12955,14 +12961,14 @@ var ka = "MenuItemIndicator", [hf, M0] = Xn(
12955
12961
  {
12956
12962
  ...o,
12957
12963
  ref: t,
12958
- "data-state": Ra(s.checked)
12964
+ "data-state": ka(s.checked)
12959
12965
  }
12960
12966
  )
12961
12967
  }
12962
12968
  );
12963
12969
  }
12964
12970
  );
12965
- pf.displayName = ka;
12971
+ pf.displayName = Ra;
12966
12972
  var D0 = "MenuSeparator", mf = p.forwardRef(
12967
12973
  (e, t) => {
12968
12974
  const { __scopeMenu: n, ...r } = e;
@@ -13098,7 +13104,7 @@ function yf(e) {
13098
13104
  function Ho(e) {
13099
13105
  return e === "indeterminate";
13100
13106
  }
13101
- function Ra(e) {
13107
+ function ka(e) {
13102
13108
  return Ho(e) ? "indeterminate" : e ? "checked" : "unchecked";
13103
13109
  }
13104
13110
  function F0(e) {
@@ -13169,7 +13175,7 @@ var W0 = tf, V0 = ba, K0 = rf, q0 = of, G0 = Ta, Y0 = sf, X0 = ys, J0 = lf, Z0 =
13169
13175
  );
13170
13176
  };
13171
13177
  Cf.displayName = Ss;
13172
- var Tf = "DropdownMenuTrigger", kf = p.forwardRef(
13178
+ var Tf = "DropdownMenuTrigger", Rf = p.forwardRef(
13173
13179
  (e, t) => {
13174
13180
  const { __scopeDropdownMenu: n, disabled: r = !1, ...o } = e, s = Sf(Tf, n), i = Tt(n);
13175
13181
  return /* @__PURE__ */ l.jsx(V0, { asChild: !0, ...i, children: /* @__PURE__ */ l.jsx(
@@ -13195,12 +13201,12 @@ var Tf = "DropdownMenuTrigger", kf = p.forwardRef(
13195
13201
  ) });
13196
13202
  }
13197
13203
  );
13198
- kf.displayName = Tf;
13199
- var aS = "DropdownMenuPortal", Rf = (e) => {
13204
+ Rf.displayName = Tf;
13205
+ var aS = "DropdownMenuPortal", kf = (e) => {
13200
13206
  const { __scopeDropdownMenu: t, ...n } = e, r = Tt(t);
13201
13207
  return /* @__PURE__ */ l.jsx(K0, { ...r, ...n });
13202
13208
  };
13203
- Rf.displayName = aS;
13209
+ kf.displayName = aS;
13204
13210
  var Ef = "DropdownMenuContent", If = p.forwardRef(
13205
13211
  (e, t) => {
13206
13212
  const { __scopeDropdownMenu: n, ...r } = e, o = Sf(Ef, n), s = Tt(n), i = p.useRef(!1);
@@ -13311,8 +13317,8 @@ var yS = "DropdownMenuSubContent", Df = p.forwardRef((e, t) => {
13311
13317
  );
13312
13318
  });
13313
13319
  Df.displayName = yS;
13314
- var SS = Cf, CS = kf, TS = Rf, Lf = If, $f = Nf, Ff = Af, zf = _f, Bf = jf, Hf = Pf, Uf = Of, Wf = Mf, Vf = Df;
13315
- const kS = SS, RS = CS, ES = p.forwardRef(({ className: e, inset: t, children: n, ...r }, o) => /* @__PURE__ */ l.jsxs(
13320
+ var SS = Cf, CS = Rf, TS = kf, Lf = If, $f = Nf, Ff = Af, zf = _f, Bf = jf, Hf = Pf, Uf = Of, Wf = Mf, Vf = Df;
13321
+ const RS = SS, kS = CS, ES = p.forwardRef(({ className: e, inset: t, children: n, ...r }, o) => /* @__PURE__ */ l.jsxs(
13316
13322
  Wf,
13317
13323
  {
13318
13324
  ref: o,
@@ -13354,7 +13360,7 @@ const Kf = p.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__
13354
13360
  }
13355
13361
  ) }));
13356
13362
  Kf.displayName = Lf.displayName;
13357
- const Ri = p.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */ l.jsx(
13363
+ const ki = p.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */ l.jsx(
13358
13364
  Ff,
13359
13365
  {
13360
13366
  ref: r,
@@ -13366,7 +13372,7 @@ const Ri = p.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */
13366
13372
  ...n
13367
13373
  }
13368
13374
  ));
13369
- Ri.displayName = Ff.displayName;
13375
+ ki.displayName = Ff.displayName;
13370
13376
  const NS = p.forwardRef(({ className: e, children: t, checked: n, ...r }, o) => /* @__PURE__ */ l.jsxs(
13371
13377
  zf,
13372
13378
  {
@@ -13445,17 +13451,17 @@ function ti({
13445
13451
  streamingAssistantId: x,
13446
13452
  error: w,
13447
13453
  send: y,
13448
- stop: k,
13454
+ stop: R,
13449
13455
  lastCheckpointId: S,
13450
13456
  lastCheckpointNs: C,
13451
- listCheckpoints: R,
13457
+ listCheckpoints: k,
13452
13458
  navigateToCheckpoint: E,
13453
13459
  returnToLatest: N,
13454
13460
  hasMoreHistory: j,
13455
13461
  isLoadingHistory: I,
13456
13462
  loadOlderMessages: $,
13457
13463
  api: U
13458
- } = Fi(), [P, G] = me(null), [H, W] = me(""), [D, O] = me(null), [ae, Y] = me([]), [ee, L] = me(!1), [Z, Ee] = me(null), [Q, V] = me(null), [A, q] = me(!1), [te, ce] = me(null), [oe, Oe] = me([]), [Le, ve] = me(null), [je, ze] = me(null), [Ze, Ke] = me(!1), at = rt(null), ht = rt(null), ue = rt(null), [de, he] = me("desktop");
13464
+ } = Fi(), [P, G] = me(null), [H, W] = me(""), [D, O] = me(null), [ae, Y] = me([]), [Q, L] = me(!1), [ee, Ee] = me(null), [Z, V] = me(null), [A, q] = me(!1), [te, ce] = me(null), [oe, Oe] = me([]), [Le, ve] = me(null), [je, ze] = me(null), [Ze, Ke] = me(!1), at = rt(null), ht = rt(null), ue = rt(null), [de, he] = me("desktop");
13459
13465
  ct(() => {
13460
13466
  const se = () => {
13461
13467
  const pe = window.innerWidth;
@@ -13474,7 +13480,7 @@ function ti({
13474
13480
  checkpointNs: C ?? null
13475
13481
  }, Ie = ue.current;
13476
13482
  if (!(Ie && Ie.threadId === pe.threadId && Ie.checkpointId === pe.checkpointId && Ie.checkpointNs === pe.checkpointNs))
13477
- return R(b).then((qe) => {
13483
+ return k(b).then((qe) => {
13478
13484
  var yr;
13479
13485
  if (se) return;
13480
13486
  const Qt = ((qe == null ? void 0 : qe.checkpoints) ?? []).slice().sort((mn, Sr) => new Date(Sr.createdAt).getTime() - new Date(mn.createdAt).getTime());
@@ -13491,7 +13497,7 @@ function ti({
13491
13497
  }), () => {
13492
13498
  se = !0;
13493
13499
  };
13494
- }, [b, S, C, Le, R]), ct(() => {
13500
+ }, [b, S, C, Le, k]), ct(() => {
13495
13501
  S && (ve(S), ze(C ?? null));
13496
13502
  }, [S, C]);
13497
13503
  const ye = Ye(async () => {
@@ -13550,7 +13556,7 @@ function ti({
13550
13556
  }
13551
13557
  }, X = z.useCallback((se, pe) => {
13552
13558
  u && (G(se), W(pe), O(null));
13553
- }, [u]), ke = z.useCallback(() => {
13559
+ }, [u]), Re = z.useCallback(() => {
13554
13560
  G(null), W(""), O(null);
13555
13561
  }, []), He = Ye((se, pe) => {
13556
13562
  X(se, pe);
@@ -13668,7 +13674,7 @@ function ti({
13668
13674
  },
13669
13675
  onEdit: He,
13670
13676
  onRegenerate: Se,
13671
- onCancelEdit: ke,
13677
+ onCancelEdit: Re,
13672
13678
  emptyMessage: te ?? void 0,
13673
13679
  isNavigatingCheckpoint: Ze
13674
13680
  }
@@ -13684,7 +13690,7 @@ function ti({
13684
13690
  {
13685
13691
  variant: "ghost",
13686
13692
  size: "sm",
13687
- onClick: ke,
13693
+ onClick: Re,
13688
13694
  className: "text-blue-600 hover:bg-blue-100",
13689
13695
  children: /* @__PURE__ */ l.jsx(rr, { size: 16 })
13690
13696
  }
@@ -13729,18 +13735,18 @@ function ti({
13729
13735
  className: "hidden"
13730
13736
  }
13731
13737
  ),
13732
- ee && /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
13738
+ Q && /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
13733
13739
  /* @__PURE__ */ l.jsx(Pp, { className: "h-4 w-4 animate-spin" }),
13734
13740
  " Uploading Excel file..."
13735
13741
  ] }),
13736
- Q && !ee && /* @__PURE__ */ l.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: Q }),
13737
- Z && !ee && /* @__PURE__ */ l.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Z })
13742
+ Z && !Q && /* @__PURE__ */ l.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: Z }),
13743
+ ee && !Q && /* @__PURE__ */ l.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: ee })
13738
13744
  ] })
13739
13745
  ] }),
13740
13746
  D && /* @__PURE__ */ l.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: D }),
13741
13747
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-end gap-2", children: [
13742
- (a || c) && /* @__PURE__ */ l.jsxs(kS, { children: [
13743
- /* @__PURE__ */ l.jsx(RS, { asChild: !0, children: /* @__PURE__ */ l.jsx(
13748
+ (a || c) && /* @__PURE__ */ l.jsxs(RS, { children: [
13749
+ /* @__PURE__ */ l.jsx(kS, { asChild: !0, children: /* @__PURE__ */ l.jsx(
13744
13750
  Ue,
13745
13751
  {
13746
13752
  type: "button",
@@ -13753,7 +13759,7 @@ function ti({
13753
13759
  }
13754
13760
  ) }),
13755
13761
  /* @__PURE__ */ l.jsxs(Kf, { align: "start", sideOffset: 6, className: "w-52", children: [
13756
- a && /* @__PURE__ */ l.jsxs(Ri, { onClick: () => {
13762
+ a && /* @__PURE__ */ l.jsxs(ki, { onClick: () => {
13757
13763
  var se;
13758
13764
  return (se = at.current) == null ? void 0 : se.click();
13759
13765
  }, className: "cursor-pointer", children: [
@@ -13761,13 +13767,13 @@ function ti({
13761
13767
  " Attach files or images"
13762
13768
  ] }),
13763
13769
  c && /* @__PURE__ */ l.jsxs(
13764
- Ri,
13770
+ ki,
13765
13771
  {
13766
13772
  onClick: () => {
13767
13773
  var se;
13768
- ee || (se = ht.current) == null || se.click();
13774
+ Q || (se = ht.current) == null || se.click();
13769
13775
  },
13770
- className: `cursor-pointer ${ee ? "opacity-60 pointer-events-none" : ""}`,
13776
+ className: `cursor-pointer ${Q ? "opacity-60 pointer-events-none" : ""}`,
13771
13777
  children: [
13772
13778
  /* @__PURE__ */ l.jsx(Mp, { className: "h-4 w-4 mr-2" }),
13773
13779
  " Upload Excel file"
@@ -13786,8 +13792,8 @@ function ti({
13786
13792
  disabled: !1,
13787
13793
  maxLength: So,
13788
13794
  onSend: M,
13789
- onCancelEdit: ke,
13790
- onStop: k,
13795
+ onCancelEdit: Re,
13796
+ onStop: R,
13791
13797
  allowEmptySend: ae.length > 0,
13792
13798
  textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${P ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${D ? "border-red-400" : ""} ${d.textarea || ""}`
13793
13799
  }
@@ -13825,7 +13831,7 @@ var Ea = "ScrollArea", [qf, CT] = dn(Ea), [OS, Wt] = qf(Ea), Gf = p.forwardRef(
13825
13831
  dir: o,
13826
13832
  scrollHideDelay: s = 600,
13827
13833
  ...i
13828
- } = e, [a, c] = p.useState(null), [u, d] = p.useState(null), [f, h] = p.useState(null), [m, b] = p.useState(null), [v, g] = p.useState(null), [x, w] = p.useState(0), [y, k] = p.useState(0), [S, C] = p.useState(!1), [R, E] = p.useState(!1), N = De(t, (I) => c(I)), j = ms(o);
13834
+ } = e, [a, c] = p.useState(null), [u, d] = p.useState(null), [f, h] = p.useState(null), [m, b] = p.useState(null), [v, g] = p.useState(null), [x, w] = p.useState(0), [y, R] = p.useState(0), [S, C] = p.useState(!1), [k, E] = p.useState(!1), N = De(t, (I) => c(I)), j = ms(o);
13829
13835
  return /* @__PURE__ */ l.jsx(
13830
13836
  OS,
13831
13837
  {
@@ -13844,10 +13850,10 @@ var Ea = "ScrollArea", [qf, CT] = dn(Ea), [OS, Wt] = qf(Ea), Gf = p.forwardRef(
13844
13850
  onScrollbarXEnabledChange: C,
13845
13851
  scrollbarY: v,
13846
13852
  onScrollbarYChange: g,
13847
- scrollbarYEnabled: R,
13853
+ scrollbarYEnabled: k,
13848
13854
  onScrollbarYEnabledChange: E,
13849
13855
  onCornerWidthChange: w,
13850
- onCornerHeightChange: k,
13856
+ onCornerHeightChange: R,
13851
13857
  children: /* @__PURE__ */ l.jsx(
13852
13858
  Te.div,
13853
13859
  {
@@ -14147,7 +14153,7 @@ var MS = p.forwardRef((e, t) => {
14147
14153
  onWheelScroll: d,
14148
14154
  onResize: f,
14149
14155
  ...h
14150
- } = e, m = Wt(hn, n), [b, v] = p.useState(null), g = De(t, (N) => v(N)), x = p.useRef(null), w = p.useRef(""), y = m.viewport, k = r.content - r.viewport, S = mt(d), C = mt(c), R = Ts(f, 10);
14156
+ } = e, m = Wt(hn, n), [b, v] = p.useState(null), g = De(t, (N) => v(N)), x = p.useRef(null), w = p.useRef(""), y = m.viewport, R = r.content - r.viewport, S = mt(d), C = mt(c), k = Ts(f, 10);
14151
14157
  function E(N) {
14152
14158
  if (x.current) {
14153
14159
  const j = N.clientX - x.current.left, I = N.clientY - x.current.top;
@@ -14157,10 +14163,10 @@ var MS = p.forwardRef((e, t) => {
14157
14163
  return p.useEffect(() => {
14158
14164
  const N = (j) => {
14159
14165
  const I = j.target;
14160
- (b == null ? void 0 : b.contains(I)) && S(j, k);
14166
+ (b == null ? void 0 : b.contains(I)) && S(j, R);
14161
14167
  };
14162
14168
  return document.addEventListener("wheel", N, { passive: !1 }), () => document.removeEventListener("wheel", N, { passive: !1 });
14163
- }, [y, b, k, S]), p.useEffect(C, [r, C]), dr(b, R), dr(m.content, R), /* @__PURE__ */ l.jsx(
14169
+ }, [y, b, R, S]), p.useEffect(C, [r, C]), dr(b, k), dr(m.content, k), /* @__PURE__ */ l.jsx(
14164
14170
  FS,
14165
14171
  {
14166
14172
  scope: n,
@@ -14376,15 +14382,15 @@ function fc({
14376
14382
  createThread: v,
14377
14383
  deleteThread: g,
14378
14384
  renameThread: x
14379
- } = Fi(), [w, y] = me(h ?? []), [k, S] = me(!1), [C, R] = me(null), [E, N] = me(null), [j, I] = me(""), [$, U] = me(!1);
14385
+ } = Fi(), [w, y] = me(h ?? []), [R, S] = me(!1), [C, k] = me(null), [E, N] = me(null), [j, I] = me(""), [$, U] = me(!1);
14380
14386
  ct(() => {
14381
14387
  y(h ?? []);
14382
14388
  }, [h]);
14383
14389
  const P = async (L) => {
14384
14390
  try {
14385
14391
  await f(L), a == null || a(L), c == null || c(L);
14386
- } catch (Z) {
14387
- console.error("Failed to select thread:", Z);
14392
+ } catch (ee) {
14393
+ console.error("Failed to select thread:", ee);
14388
14394
  }
14389
14395
  }, G = async () => {
14390
14396
  try {
@@ -14396,41 +14402,41 @@ function fc({
14396
14402
  } finally {
14397
14403
  U(!1);
14398
14404
  }
14399
- }, H = async (L, Z) => {
14400
- if (Z.stopPropagation(), !!confirm("Delete this thread?"))
14405
+ }, H = async (L, ee) => {
14406
+ if (ee.stopPropagation(), !!confirm("Delete this thread?"))
14401
14407
  try {
14402
14408
  await g(L), d == null || d(L);
14403
14409
  } catch (Ee) {
14404
14410
  console.error("Failed to delete thread:", Ee);
14405
14411
  }
14406
- }, W = (L, Z) => {
14407
- Z.stopPropagation(), N(L.threadId), I(L.title || `Thread ${L.threadId.slice(0, 8)}`);
14412
+ }, W = (L, ee) => {
14413
+ ee.stopPropagation(), N(L.threadId), I(L.title || `Thread ${L.threadId.slice(0, 8)}`);
14408
14414
  }, D = async (L) => {
14409
14415
  if (j.trim())
14410
14416
  try {
14411
14417
  await x(L, j.trim()), N(null), I("");
14412
- } catch (Z) {
14413
- console.error("Failed to update title:", Z);
14418
+ } catch (ee) {
14419
+ console.error("Failed to update title:", ee);
14414
14420
  }
14415
14421
  }, O = () => {
14416
14422
  N(null), I("");
14417
- }, ae = (L, Z) => {
14418
- L.key === "Enter" ? D(Z) : L.key === "Escape" && O();
14423
+ }, ae = (L, ee) => {
14424
+ L.key === "Enter" ? D(ee) : L.key === "Escape" && O();
14419
14425
  }, Y = (L) => {
14420
14426
  if (!L) return "";
14421
14427
  try {
14422
- const Z = new Date(L), Q = (/* @__PURE__ */ new Date()).getTime() - Z.getTime(), V = Math.floor(Q / (1e3 * 60 * 60 * 24));
14423
- return V === 0 ? Z.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : V === 1 ? "Yesterday" : V < 7 ? `${V} days ago` : Z.toLocaleDateString();
14428
+ const ee = new Date(L), Z = (/* @__PURE__ */ new Date()).getTime() - ee.getTime(), V = Math.floor(Z / (1e3 * 60 * 60 * 24));
14429
+ return V === 0 ? ee.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : V === 1 ? "Yesterday" : V < 7 ? `${V} days ago` : ee.toLocaleDateString();
14424
14430
  } catch {
14425
14431
  return "";
14426
14432
  }
14427
- }, ee = (L) => L.title || `Thread ${L.threadId.slice(0, 8)}`;
14433
+ }, Q = (L) => L.title || `Thread ${L.threadId.slice(0, 8)}`;
14428
14434
  return /* @__PURE__ */ l.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
14429
14435
  t && /* @__PURE__ */ l.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__ */ l.jsx(
14430
14436
  Ue,
14431
14437
  {
14432
14438
  onClick: G,
14433
- disabled: $ || k,
14439
+ disabled: $ || R,
14434
14440
  className: s.createButton || "p-2",
14435
14441
  size: "sm",
14436
14442
  variant: "ghost",
@@ -14443,35 +14449,35 @@ function fc({
14443
14449
  {
14444
14450
  className: `flex-1 min-h-0 ${s.threadList || ""}`,
14445
14451
  style: o ? { maxHeight: o } : void 0,
14446
- children: /* @__PURE__ */ l.jsx("div", { className: "p-2 space-y-1 pb-4", children: k ? /* @__PURE__ */ l.jsx("div", { className: "text-center py-8 text-slate-400", children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */ l.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
14452
+ children: /* @__PURE__ */ l.jsx("div", { className: "p-2 space-y-1 pb-4", children: R ? /* @__PURE__ */ l.jsx("div", { className: "text-center py-8 text-slate-400", children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */ l.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
14447
14453
  /* @__PURE__ */ l.jsx(Lp, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
14448
14454
  /* @__PURE__ */ l.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
14449
- ] }) : w.slice().sort((L, Z) => new Date(Z.updatedAt || Z.createdAt || "").getTime() - new Date(L.updatedAt || L.createdAt || "").getTime()).map((L) => /* @__PURE__ */ l.jsxs(
14455
+ ] }) : w.slice().sort((L, ee) => new Date(ee.updatedAt || ee.createdAt || "").getTime() - new Date(L.updatedAt || L.createdAt || "").getTime()).map((L) => /* @__PURE__ */ l.jsxs(
14450
14456
  "div",
14451
14457
  {
14452
14458
  onClick: () => P(L.threadId),
14453
14459
  className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? b) === L.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`,
14454
14460
  children: [
14455
14461
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
14456
- /* @__PURE__ */ l.jsx("div", { className: "flex-1 min-w-0", children: E === L.threadId ? /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2", onClick: (Z) => Z.stopPropagation(), children: [
14457
- /* @__PURE__ */ l.jsx(Uo, { value: j, onChange: (Z) => I(Z.target.value), onKeyDown: (Z) => ae(Z, L.threadId), className: "h-6 text-sm", autoFocus: !0 }),
14462
+ /* @__PURE__ */ l.jsx("div", { className: "flex-1 min-w-0", children: E === L.threadId ? /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2", onClick: (ee) => ee.stopPropagation(), children: [
14463
+ /* @__PURE__ */ l.jsx(Uo, { value: j, onChange: (ee) => I(ee.target.value), onKeyDown: (ee) => ae(ee, L.threadId), className: "h-6 text-sm", autoFocus: !0 }),
14458
14464
  /* @__PURE__ */ l.jsx(Ue, { variant: "ghost", size: "sm", onClick: () => D(L.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(Mi, { size: 12 }) }),
14459
14465
  /* @__PURE__ */ l.jsx(Ue, { variant: "ghost", size: "sm", onClick: O, className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(rr, { size: 12 }) })
14460
14466
  ] }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
14461
- /* @__PURE__ */ l.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: ee(L) }),
14467
+ /* @__PURE__ */ l.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Q(L) }),
14462
14468
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
14463
14469
  /* @__PURE__ */ l.jsx($p, { size: 10 }),
14464
14470
  /* @__PURE__ */ l.jsx("span", { children: Y(L.updatedAt || L.createdAt) })
14465
14471
  ] })
14466
14472
  ] }) }),
14467
14473
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
14468
- r && E !== L.threadId && /* @__PURE__ */ l.jsx(Ue, { variant: "ghost", size: "sm", onClick: (Z) => W(L, Z), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ l.jsx(xc, { size: 12 }) }),
14474
+ r && E !== L.threadId && /* @__PURE__ */ l.jsx(Ue, { variant: "ghost", size: "sm", onClick: (ee) => W(L, ee), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ l.jsx(xc, { size: 12 }) }),
14469
14475
  n && /* @__PURE__ */ l.jsx(
14470
14476
  Ue,
14471
14477
  {
14472
14478
  variant: "ghost",
14473
14479
  size: "sm",
14474
- onClick: (Z) => H(L.threadId, Z),
14480
+ onClick: (ee) => H(L.threadId, ee),
14475
14481
  className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
14476
14482
  title: "Delete thread",
14477
14483
  children: /* @__PURE__ */ l.jsx(Fp, { size: 12 })
@@ -14568,7 +14574,7 @@ function TT() {
14568
14574
  apiBaseUrl: zn.baseUrl || t.apiBaseUrl || e.apiBaseUrl
14569
14575
  };
14570
14576
  }
14571
- function kT(e) {
14577
+ function RT(e) {
14572
14578
  e.apiKey && zn.setAuthToken(e.apiKey), XS(e);
14573
14579
  }
14574
14580
  var JS = "Label", dh = p.forwardRef((e, t) => /* @__PURE__ */ l.jsx(
@@ -14599,7 +14605,7 @@ function hh(e) {
14599
14605
  const t = p.useRef({ value: e, previous: e });
14600
14606
  return p.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
14601
14607
  }
14602
- var ks = "Switch", [QS, RT] = dn(ks), [eC, tC] = QS(ks), ph = p.forwardRef(
14608
+ var Rs = "Switch", [QS, kT] = dn(Rs), [eC, tC] = QS(Rs), ph = p.forwardRef(
14603
14609
  (e, t) => {
14604
14610
  const {
14605
14611
  __scopeSwitch: n,
@@ -14616,7 +14622,7 @@ var ks = "Switch", [QS, RT] = dn(ks), [eC, tC] = QS(ks), ph = p.forwardRef(
14616
14622
  prop: o,
14617
14623
  defaultProp: s ?? !1,
14618
14624
  onChange: u,
14619
- caller: ks
14625
+ caller: Rs
14620
14626
  });
14621
14627
  return /* @__PURE__ */ l.jsxs(eC, { scope: n, checked: x, disabled: a, children: [
14622
14628
  /* @__PURE__ */ l.jsx(
@@ -14633,7 +14639,7 @@ var ks = "Switch", [QS, RT] = dn(ks), [eC, tC] = QS(ks), ph = p.forwardRef(
14633
14639
  ...f,
14634
14640
  ref: b,
14635
14641
  onClick: le(e.onClick, (y) => {
14636
- w((k) => !k), g && (v.current = y.isPropagationStopped(), v.current || y.stopPropagation());
14642
+ w((R) => !R), g && (v.current = y.isPropagationStopped(), v.current || y.stopPropagation());
14637
14643
  })
14638
14644
  }
14639
14645
  ),
@@ -14654,7 +14660,7 @@ var ks = "Switch", [QS, RT] = dn(ks), [eC, tC] = QS(ks), ph = p.forwardRef(
14654
14660
  ] });
14655
14661
  }
14656
14662
  );
14657
- ph.displayName = ks;
14663
+ ph.displayName = Rs;
14658
14664
  var mh = "SwitchThumb", gh = p.forwardRef(
14659
14665
  (e, t) => {
14660
14666
  const { __scopeSwitch: n, ...r } = e, o = tC(mh, n);
@@ -14759,7 +14765,7 @@ var bh = Object.freeze({
14759
14765
  )
14760
14766
  );
14761
14767
  sC.displayName = oC;
14762
- var iC = [" ", "Enter", "ArrowUp", "ArrowDown"], aC = [" ", "Enter"], Vn = "Select", [Rs, Es, lC] = ua(Vn), [vr, ET] = dn(Vn, [
14768
+ var iC = [" ", "Enter", "ArrowUp", "ArrowDown"], aC = [" ", "Enter"], Vn = "Select", [ks, Es, lC] = ua(Vn), [vr, ET] = dn(Vn, [
14763
14769
  lC,
14764
14770
  ws
14765
14771
  ]), Is = ws(), [cC, Nn] = vr(Vn), [uC, dC] = vr(Vn), yh = (e) => {
@@ -14778,7 +14784,7 @@ var iC = [" ", "Enter", "ArrowUp", "ArrowDown"], aC = [" ", "Enter"], Vn = "Sele
14778
14784
  disabled: h,
14779
14785
  required: m,
14780
14786
  form: b
14781
- } = e, v = Is(t), [g, x] = p.useState(null), [w, y] = p.useState(null), [k, S] = p.useState(!1), C = ms(u), [R, E] = Hn({
14787
+ } = e, v = Is(t), [g, x] = p.useState(null), [w, y] = p.useState(null), [R, S] = p.useState(!1), C = ms(u), [k, E] = Hn({
14782
14788
  prop: r,
14783
14789
  defaultProp: o ?? !1,
14784
14790
  onChange: s,
@@ -14798,18 +14804,18 @@ var iC = [" ", "Enter", "ArrowUp", "ArrowDown"], aC = [" ", "Enter"], Vn = "Sele
14798
14804
  onTriggerChange: x,
14799
14805
  valueNode: w,
14800
14806
  onValueNodeChange: y,
14801
- valueNodeHasChildren: k,
14807
+ valueNodeHasChildren: R,
14802
14808
  onValueNodeHasChildrenChange: S,
14803
14809
  contentId: an(),
14804
14810
  value: N,
14805
14811
  onValueChange: j,
14806
- open: R,
14812
+ open: k,
14807
14813
  onOpenChange: E,
14808
14814
  dir: C,
14809
14815
  triggerPointerDownPosRef: I,
14810
14816
  disabled: h,
14811
14817
  children: [
14812
- /* @__PURE__ */ l.jsx(Rs.Provider, { scope: t, children: /* @__PURE__ */ l.jsx(
14818
+ /* @__PURE__ */ l.jsx(ks.Provider, { scope: t, children: /* @__PURE__ */ l.jsx(
14813
14819
  uC,
14814
14820
  {
14815
14821
  scope: e.__scopeSelect,
@@ -14893,7 +14899,7 @@ var Sh = "SelectTrigger", Ch = p.forwardRef(
14893
14899
  }
14894
14900
  );
14895
14901
  Ch.displayName = Sh;
14896
- var Th = "SelectValue", kh = p.forwardRef(
14902
+ var Th = "SelectValue", Rh = p.forwardRef(
14897
14903
  (e, t) => {
14898
14904
  const { __scopeSelect: n, className: r, style: o, children: s, placeholder: i = "", ...a } = e, c = Nn(Th, n), { onValueNodeHasChildrenChange: u } = c, d = s !== void 0, f = De(t, c.onValueNodeChange);
14899
14905
  return ft(() => {
@@ -14909,14 +14915,14 @@ var Th = "SelectValue", kh = p.forwardRef(
14909
14915
  );
14910
14916
  }
14911
14917
  );
14912
- kh.displayName = Th;
14913
- var fC = "SelectIcon", Rh = p.forwardRef(
14918
+ Rh.displayName = Th;
14919
+ var fC = "SelectIcon", kh = p.forwardRef(
14914
14920
  (e, t) => {
14915
14921
  const { __scopeSelect: n, children: r, ...o } = e;
14916
14922
  return /* @__PURE__ */ l.jsx(Te.span, { "aria-hidden": !0, ...o, ref: t, children: r || "▼" });
14917
14923
  }
14918
14924
  );
14919
- Rh.displayName = fC;
14925
+ kh.displayName = fC;
14920
14926
  var hC = "SelectPortal", Eh = (e) => /* @__PURE__ */ l.jsx(ls, { asChild: !0, ...e });
14921
14927
  Eh.displayName = hC;
14922
14928
  var Kn = "SelectContent", Ih = p.forwardRef(
@@ -14927,7 +14933,7 @@ var Kn = "SelectContent", Ih = p.forwardRef(
14927
14933
  }, []), !n.open) {
14928
14934
  const s = r;
14929
14935
  return s ? Go.createPortal(
14930
- /* @__PURE__ */ l.jsx(Nh, { scope: e.__scopeSelect, children: /* @__PURE__ */ l.jsx(Rs.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ l.jsx("div", { children: e.children }) }) }),
14936
+ /* @__PURE__ */ l.jsx(Nh, { scope: e.__scopeSelect, children: /* @__PURE__ */ l.jsx(ks.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ l.jsx("div", { children: e.children }) }) }),
14931
14937
  s
14932
14938
  ) : null;
14933
14939
  }
@@ -14957,7 +14963,7 @@ var Vt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
14957
14963
  avoidCollisions: g,
14958
14964
  //
14959
14965
  ...x
14960
- } = e, w = Nn(Kn, n), [y, k] = p.useState(null), [S, C] = p.useState(null), R = De(t, (V) => k(V)), [E, N] = p.useState(null), [j, I] = p.useState(
14966
+ } = e, w = Nn(Kn, n), [y, R] = p.useState(null), [S, C] = p.useState(null), k = De(t, (V) => R(V)), [E, N] = p.useState(null), [j, I] = p.useState(
14961
14967
  null
14962
14968
  ), $ = Es(n), [U, P] = p.useState(!1), G = p.useRef(!1);
14963
14969
  p.useEffect(() => {
@@ -15003,19 +15009,19 @@ var Vt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
15003
15009
  const [ae, Y] = qh((V) => {
15004
15010
  const A = $().filter((ce) => !ce.disabled), q = A.find((ce) => ce.ref.current === document.activeElement), te = Gh(A, V, q);
15005
15011
  te && setTimeout(() => te.ref.current.focus());
15006
- }), ee = p.useCallback(
15012
+ }), Q = p.useCallback(
15007
15013
  (V, A, q) => {
15008
15014
  const te = !G.current && !q;
15009
15015
  (w.value !== void 0 && w.value === A || te) && (N(V), te && (G.current = !0));
15010
15016
  },
15011
15017
  [w.value]
15012
- ), L = p.useCallback(() => y == null ? void 0 : y.focus(), [y]), Z = p.useCallback(
15018
+ ), L = p.useCallback(() => y == null ? void 0 : y.focus(), [y]), ee = p.useCallback(
15013
15019
  (V, A, q) => {
15014
15020
  const te = !G.current && !q;
15015
15021
  (w.value !== void 0 && w.value === A || te) && I(V);
15016
15022
  },
15017
15023
  [w.value]
15018
- ), Ee = r === "popper" ? Ii : _h, Q = Ee === Ii ? {
15024
+ ), Ee = r === "popper" ? Ii : _h, Z = Ee === Ii ? {
15019
15025
  side: a,
15020
15026
  sideOffset: c,
15021
15027
  align: u,
@@ -15034,10 +15040,10 @@ var Vt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
15034
15040
  content: y,
15035
15041
  viewport: S,
15036
15042
  onViewportChange: C,
15037
- itemRefCallback: ee,
15043
+ itemRefCallback: Q,
15038
15044
  selectedItem: E,
15039
15045
  onItemLeave: L,
15040
- itemTextRefCallback: Z,
15046
+ itemTextRefCallback: ee,
15041
15047
  focusSelectedItem: W,
15042
15048
  selectedItemText: j,
15043
15049
  position: r,
@@ -15073,9 +15079,9 @@ var Vt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
15073
15079
  dir: w.dir,
15074
15080
  onContextMenu: (V) => V.preventDefault(),
15075
15081
  ...x,
15076
- ...Q,
15082
+ ...Z,
15077
15083
  onPlaced: () => P(!0),
15078
- ref: R,
15084
+ ref: k,
15079
15085
  style: {
15080
15086
  // flex layout so we can place the scroll buttons properly
15081
15087
  display: "flex",
@@ -15107,11 +15113,11 @@ var Vt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
15107
15113
  );
15108
15114
  Ah.displayName = pC;
15109
15115
  var gC = "SelectItemAlignedPosition", _h = p.forwardRef((e, t) => {
15110
- const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Nn(Kn, n), i = An(Kn, n), [a, c] = p.useState(null), [u, d] = p.useState(null), f = De(t, (R) => d(R)), h = Es(n), m = p.useRef(!1), b = p.useRef(!0), { viewport: v, selectedItem: g, selectedItemText: x, focusSelectedItem: w } = i, y = p.useCallback(() => {
15116
+ const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Nn(Kn, n), i = An(Kn, n), [a, c] = p.useState(null), [u, d] = p.useState(null), f = De(t, (k) => d(k)), h = Es(n), m = p.useRef(!1), b = p.useRef(!0), { viewport: v, selectedItem: g, selectedItemText: x, focusSelectedItem: w } = i, y = p.useCallback(() => {
15111
15117
  if (s.trigger && s.valueNode && a && u && v && g && x) {
15112
- const R = s.trigger.getBoundingClientRect(), E = u.getBoundingClientRect(), N = s.valueNode.getBoundingClientRect(), j = x.getBoundingClientRect();
15118
+ const k = s.trigger.getBoundingClientRect(), E = u.getBoundingClientRect(), N = s.valueNode.getBoundingClientRect(), j = x.getBoundingClientRect();
15113
15119
  if (s.dir !== "rtl") {
15114
- const ce = j.left - E.left, oe = N.left - ce, Oe = R.left - oe, Le = R.width + Oe, ve = Math.max(Le, E.width), je = window.innerWidth - Vt, ze = Ei(oe, [
15120
+ const ce = j.left - E.left, oe = N.left - ce, Oe = k.left - oe, Le = k.width + Oe, ve = Math.max(Le, E.width), je = window.innerWidth - Vt, ze = Ei(oe, [
15115
15121
  Vt,
15116
15122
  // Prevents the content from going off the starting edge of the
15117
15123
  // viewport. It may still go off the ending edge, but this can be
@@ -15122,19 +15128,19 @@ var gC = "SelectItemAlignedPosition", _h = p.forwardRef((e, t) => {
15122
15128
  ]);
15123
15129
  a.style.minWidth = Le + "px", a.style.left = ze + "px";
15124
15130
  } else {
15125
- const ce = E.right - j.right, oe = window.innerWidth - N.right - ce, Oe = window.innerWidth - R.right - oe, Le = R.width + Oe, ve = Math.max(Le, E.width), je = window.innerWidth - Vt, ze = Ei(oe, [
15131
+ const ce = E.right - j.right, oe = window.innerWidth - N.right - ce, Oe = window.innerWidth - k.right - oe, Le = k.width + Oe, ve = Math.max(Le, E.width), je = window.innerWidth - Vt, ze = Ei(oe, [
15126
15132
  Vt,
15127
15133
  Math.max(Vt, je - ve)
15128
15134
  ]);
15129
15135
  a.style.minWidth = Le + "px", a.style.right = ze + "px";
15130
15136
  }
15131
- const I = h(), $ = window.innerHeight - Vt * 2, U = v.scrollHeight, P = window.getComputedStyle(u), G = parseInt(P.borderTopWidth, 10), H = parseInt(P.paddingTop, 10), W = parseInt(P.borderBottomWidth, 10), D = parseInt(P.paddingBottom, 10), O = G + H + U + D + W, ae = Math.min(g.offsetHeight * 5, O), Y = window.getComputedStyle(v), ee = parseInt(Y.paddingTop, 10), L = parseInt(Y.paddingBottom, 10), Z = R.top + R.height / 2 - Vt, Ee = $ - Z, Q = g.offsetHeight / 2, V = g.offsetTop + Q, A = G + H + V, q = O - A;
15132
- if (A <= Z) {
15137
+ const I = h(), $ = window.innerHeight - Vt * 2, U = v.scrollHeight, P = window.getComputedStyle(u), G = parseInt(P.borderTopWidth, 10), H = parseInt(P.paddingTop, 10), W = parseInt(P.borderBottomWidth, 10), D = parseInt(P.paddingBottom, 10), O = G + H + U + D + W, ae = Math.min(g.offsetHeight * 5, O), Y = window.getComputedStyle(v), Q = parseInt(Y.paddingTop, 10), L = parseInt(Y.paddingBottom, 10), ee = k.top + k.height / 2 - Vt, Ee = $ - ee, Z = g.offsetHeight / 2, V = g.offsetTop + Z, A = G + H + V, q = O - A;
15138
+ if (A <= ee) {
15133
15139
  const ce = I.length > 0 && g === I[I.length - 1].ref.current;
15134
15140
  a.style.bottom = "0px";
15135
15141
  const oe = u.clientHeight - v.offsetTop - v.offsetHeight, Oe = Math.max(
15136
15142
  Ee,
15137
- Q + // viewport might have padding bottom, include it to avoid a scrollable viewport
15143
+ Z + // viewport might have padding bottom, include it to avoid a scrollable viewport
15138
15144
  (ce ? L : 0) + oe + W
15139
15145
  ), Le = A + Oe;
15140
15146
  a.style.height = Le + "px";
@@ -15142,11 +15148,11 @@ var gC = "SelectItemAlignedPosition", _h = p.forwardRef((e, t) => {
15142
15148
  const ce = I.length > 0 && g === I[0].ref.current;
15143
15149
  a.style.top = "0px";
15144
15150
  const Oe = Math.max(
15145
- Z,
15151
+ ee,
15146
15152
  G + v.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
15147
- (ce ? ee : 0) + Q
15153
+ (ce ? Q : 0) + Z
15148
15154
  ) + q;
15149
- a.style.height = Oe + "px", v.scrollTop = A - Z + v.offsetTop;
15155
+ a.style.height = Oe + "px", v.scrollTop = A - ee + v.offsetTop;
15150
15156
  }
15151
15157
  a.style.margin = `${Vt}px 0`, a.style.minHeight = ae + "px", a.style.maxHeight = $ + "px", r == null || r(), requestAnimationFrame(() => m.current = !0);
15152
15158
  }
@@ -15163,13 +15169,13 @@ var gC = "SelectItemAlignedPosition", _h = p.forwardRef((e, t) => {
15163
15169
  r
15164
15170
  ]);
15165
15171
  ft(() => y(), [y]);
15166
- const [k, S] = p.useState();
15172
+ const [R, S] = p.useState();
15167
15173
  ft(() => {
15168
15174
  u && S(window.getComputedStyle(u).zIndex);
15169
15175
  }, [u]);
15170
15176
  const C = p.useCallback(
15171
- (R) => {
15172
- R && b.current === !0 && (y(), w == null || w(), b.current = !1);
15177
+ (k) => {
15178
+ k && b.current === !0 && (y(), w == null || w(), b.current = !1);
15173
15179
  },
15174
15180
  [y, w]
15175
15181
  );
@@ -15188,7 +15194,7 @@ var gC = "SelectItemAlignedPosition", _h = p.forwardRef((e, t) => {
15188
15194
  display: "flex",
15189
15195
  flexDirection: "column",
15190
15196
  position: "fixed",
15191
- zIndex: k
15197
+ zIndex: R
15192
15198
  },
15193
15199
  children: /* @__PURE__ */ l.jsx(
15194
15200
  Te.div,
@@ -15253,7 +15259,7 @@ var [vC, _a] = vr(Kn, {}), Ni = "SelectViewport", jh = p.forwardRef(
15253
15259
  nonce: r
15254
15260
  }
15255
15261
  ),
15256
- /* @__PURE__ */ l.jsx(Rs.Slot, { scope: n, children: /* @__PURE__ */ l.jsx(
15262
+ /* @__PURE__ */ l.jsx(ks.Slot, { scope: n, children: /* @__PURE__ */ l.jsx(
15257
15263
  Te.div,
15258
15264
  {
15259
15265
  "data-radix-select-viewport": "",
@@ -15280,8 +15286,8 @@ var [vC, _a] = vr(Kn, {}), Ni = "SelectViewport", jh = p.forwardRef(
15280
15286
  if (m > 0) {
15281
15287
  const b = window.innerHeight - Vt * 2, v = parseFloat(f.style.minHeight), g = parseFloat(f.style.height), x = Math.max(v, g);
15282
15288
  if (x < b) {
15283
- const w = x + m, y = Math.min(b, w), k = w - y;
15284
- f.style.height = y + "px", f.style.bottom === "0px" && (d.scrollTop = k > 0 ? k : 0, f.style.justifyContent = "flex-end");
15289
+ const w = x + m, y = Math.min(b, w), R = w - y;
15290
+ f.style.height = y + "px", f.style.bottom === "0px" && (d.scrollTop = R > 0 ? R : 0, f.style.justifyContent = "flex-end");
15285
15291
  }
15286
15292
  }
15287
15293
  }
@@ -15340,7 +15346,7 @@ var Ko = "SelectItem", [SC, Dh] = vr(Ko), Lh = p.forwardRef(
15340
15346
  f((y) => y || ((w == null ? void 0 : w.textContent) ?? "").trim());
15341
15347
  }, []),
15342
15348
  children: /* @__PURE__ */ l.jsx(
15343
- Rs.ItemSlot,
15349
+ ks.ItemSlot,
15344
15350
  {
15345
15351
  scope: n,
15346
15352
  value: r,
@@ -15379,8 +15385,8 @@ var Ko = "SelectItem", [SC, Dh] = vr(Ko), Lh = p.forwardRef(
15379
15385
  w.currentTarget === document.activeElement && ((y = c.onItemLeave) == null || y.call(c));
15380
15386
  }),
15381
15387
  onKeyDown: le(i.onKeyDown, (w) => {
15382
- var k;
15383
- ((k = c.searchRef) == null ? void 0 : k.current) !== "" && w.key === " " || (aC.includes(w.key) && x(), w.key === " " && w.preventDefault());
15388
+ var R;
15389
+ ((R = c.searchRef) == null ? void 0 : R.current) !== "" && w.key === " " || (aC.includes(w.key) && x(), w.key === " " && w.preventDefault());
15384
15390
  })
15385
15391
  }
15386
15392
  )
@@ -15508,7 +15514,7 @@ var ji = "SelectArrow", TC = p.forwardRef(
15508
15514
  }
15509
15515
  );
15510
15516
  TC.displayName = ji;
15511
- var kC = "SelectBubbleInput", Vh = p.forwardRef(
15517
+ var RC = "SelectBubbleInput", Vh = p.forwardRef(
15512
15518
  ({ __scopeSelect: e, value: t, ...n }, r) => {
15513
15519
  const o = p.useRef(null), s = De(r, o), i = hh(t);
15514
15520
  return p.useEffect(() => {
@@ -15533,7 +15539,7 @@ var kC = "SelectBubbleInput", Vh = p.forwardRef(
15533
15539
  );
15534
15540
  }
15535
15541
  );
15536
- Vh.displayName = kC;
15542
+ Vh.displayName = RC;
15537
15543
  function Kh(e) {
15538
15544
  return e === "" || e === void 0;
15539
15545
  }
@@ -15553,17 +15559,17 @@ function qh(e) {
15553
15559
  }
15554
15560
  function Gh(e, t, n) {
15555
15561
  const o = t.length > 1 && Array.from(t).every((u) => u === t[0]) ? t[0] : t, s = n ? e.indexOf(n) : -1;
15556
- let i = RC(e, Math.max(s, 0));
15562
+ let i = kC(e, Math.max(s, 0));
15557
15563
  o.length === 1 && (i = i.filter((u) => u !== n));
15558
15564
  const c = i.find(
15559
15565
  (u) => u.textValue.toLowerCase().startsWith(o.toLowerCase())
15560
15566
  );
15561
15567
  return c !== n ? c : void 0;
15562
15568
  }
15563
- function RC(e, t) {
15569
+ function kC(e, t) {
15564
15570
  return e.map((n, r) => e[(t + r) % e.length]);
15565
15571
  }
15566
- var EC = yh, Yh = Ch, IC = kh, NC = Rh, AC = Eh, Xh = Ih, _C = jh, Jh = Mh, Zh = Lh, jC = $h, PC = zh, Qh = Bh, ep = Hh, tp = Wh;
15572
+ var EC = yh, Yh = Ch, IC = Rh, NC = kh, AC = Eh, Xh = Ih, _C = jh, Jh = Mh, Zh = Lh, jC = $h, PC = zh, Qh = Bh, ep = Hh, tp = Wh;
15567
15573
  const hc = EC, pc = IC, Pi = p.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ l.jsxs(
15568
15574
  Yh,
15569
15575
  {
@@ -15589,7 +15595,7 @@ const np = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
15589
15595
  e
15590
15596
  ),
15591
15597
  ...t,
15592
- children: /* @__PURE__ */ l.jsx(Rr, { className: "h-4 w-4" })
15598
+ children: /* @__PURE__ */ l.jsx(kr, { className: "h-4 w-4" })
15593
15599
  }
15594
15600
  ));
15595
15601
  np.displayName = Qh.displayName;
@@ -15680,7 +15686,7 @@ const To = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
15680
15686
  }
15681
15687
  ));
15682
15688
  To.displayName = "Card";
15683
- const ko = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
15689
+ const Ro = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
15684
15690
  "div",
15685
15691
  {
15686
15692
  ref: n,
@@ -15688,8 +15694,8 @@ const ko = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
15688
15694
  ...t
15689
15695
  }
15690
15696
  ));
15691
- ko.displayName = "CardHeader";
15692
- const Ro = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
15697
+ Ro.displayName = "CardHeader";
15698
+ const ko = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
15693
15699
  "h3",
15694
15700
  {
15695
15701
  ref: n,
@@ -15700,7 +15706,7 @@ const Ro = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
15700
15706
  ...t
15701
15707
  }
15702
15708
  ));
15703
- Ro.displayName = "CardTitle";
15709
+ ko.displayName = "CardTitle";
15704
15710
  const DC = p.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
15705
15711
  "p",
15706
15712
  {
@@ -15900,7 +15906,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
15900
15906
  ] }),
15901
15907
  /* @__PURE__ */ l.jsxs("div", { className: "space-y-6 py-6", children: [
15902
15908
  /* @__PURE__ */ l.jsxs(To, { children: [
15903
- /* @__PURE__ */ l.jsx(ko, { className: "pb-3", children: /* @__PURE__ */ l.jsxs(Ro, { className: "text-lg flex items-center gap-2", children: [
15909
+ /* @__PURE__ */ l.jsx(Ro, { className: "pb-3", children: /* @__PURE__ */ l.jsxs(ko, { className: "text-lg flex items-center gap-2", children: [
15904
15910
  /* @__PURE__ */ l.jsx(Bp, { className: "h-5 w-5" }),
15905
15911
  "API Configuration"
15906
15912
  ] }) }),
@@ -15967,7 +15973,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
15967
15973
  ] })
15968
15974
  ] }),
15969
15975
  /* @__PURE__ */ l.jsxs(To, { children: [
15970
- /* @__PURE__ */ l.jsx(ko, { className: "pb-3", children: /* @__PURE__ */ l.jsxs(Ro, { className: "text-lg flex items-center gap-2", children: [
15976
+ /* @__PURE__ */ l.jsx(Ro, { className: "pb-3", children: /* @__PURE__ */ l.jsxs(ko, { className: "text-lg flex items-center gap-2", children: [
15971
15977
  /* @__PURE__ */ l.jsx(Wp, { className: "h-5 w-5" }),
15972
15978
  "Interface Settings"
15973
15979
  ] }) }),
@@ -16062,7 +16068,7 @@ function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
16062
16068
  ] })
16063
16069
  ] }),
16064
16070
  /* @__PURE__ */ l.jsxs(To, { children: [
16065
- /* @__PURE__ */ l.jsx(ko, { className: "pb-3", children: /* @__PURE__ */ l.jsxs(Ro, { className: "text-lg flex items-center gap-2", children: [
16071
+ /* @__PURE__ */ l.jsx(Ro, { className: "pb-3", children: /* @__PURE__ */ l.jsxs(ko, { className: "text-lg flex items-center gap-2", children: [
16066
16072
  /* @__PURE__ */ l.jsx(Vp, { className: "h-5 w-5" }),
16067
16073
  "Behavior Settings"
16068
16074
  ] }) }),
@@ -16220,12 +16226,12 @@ export {
16220
16226
  jb as MessageComponent,
16221
16227
  wd as MessageList,
16222
16228
  fc as ThreadManager,
16223
- kT as applySettings,
16229
+ RT as applySettings,
16224
16230
  zn as chatApiClient,
16225
16231
  NT as default,
16226
16232
  Ag as del,
16227
16233
  Ft as get,
16228
- Rg as getChatToken,
16234
+ kg as getChatToken,
16229
16235
  TT as getCurrentSettings,
16230
16236
  qS as getDefaultApiConfig,
16231
16237
  GS as getDefaultChatSettings,