teodor-new-chat-ui 4.3.159 → 4.3.160

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
@@ -2,8 +2,8 @@ var ag = Object.defineProperty;
2
2
  var lg = (e, t, n) => t in e ? ag(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var sc = (e, t, n) => lg(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as v from "react";
5
- import V, { createContext as zo, useContext as ei, useReducer as cg, useRef as Re, useCallback as de, useEffect as St, useMemo as ct, useState as we, startTransition as es, useLayoutEffect as ug, createElement as ms, useImperativeHandle as dg } from "react";
6
- import { Square as fg, Send as hg, ChevronRight as Xu, Check as Qa, Circle as pg, X as Yr, ExternalLink as mg, Download as gg, Image as xg, FileText as ic, Loader as el, Bot as zi, Wrench as yg, User as vg, Paperclip as xa, ChevronUp as tl, ChevronDown as ti, ChevronLeft as wg, Copy as ac, Edit as lc, RotateCcw as ya, Info as bg, Loader2 as gs, Edit3 as Ju, Plus as Sg, FileSpreadsheet as Cg, MessageSquarePlus as Tg, MessageSquare as kg, Calendar as Eg, Trash2 as Rg, Settings as Ig, Server as Ng, EyeOff as Ag, Eye as _g, Layout as jg, MessageCircle as Pg, Save as Og } from "lucide-react";
5
+ import V, { createContext as zo, useContext as ei, useReducer as cg, useRef as Ee, useCallback as de, useEffect as St, useMemo as ct, useState as we, startTransition as es, useLayoutEffect as ug, createElement as ms, useImperativeHandle as dg } from "react";
6
+ import { Square as fg, Send as hg, ChevronRight as Xu, Check as Qa, Circle as pg, X as Yr, ExternalLink as mg, Download as gg, Image as xg, FileText as ic, Loader as el, Bot as zi, Wrench as yg, User as vg, Paperclip as xa, ChevronUp as tl, ChevronDown as ti, ChevronLeft as wg, Copy as ac, Edit as lc, RotateCcw as ya, Info as bg, Loader2 as gs, Edit3 as Ju, Plus as Sg, FileSpreadsheet as Cg, MessageSquarePlus as Tg, MessageSquare as kg, Calendar as Rg, Trash2 as Eg, Settings as Ig, Server as Ng, EyeOff as Ag, Eye as _g, Layout as jg, MessageCircle as Pg, Save as Og } from "lucide-react";
7
7
  import { Slot as Mg, createSlot as to } from "@radix-ui/react-slot";
8
8
  import { cva as ni } from "class-variance-authority";
9
9
  import { clsx as Dg } from "clsx";
@@ -48,57 +48,57 @@ var uc;
48
48
  function $g() {
49
49
  return uc || (uc = 1, process.env.NODE_ENV !== "production" && function() {
50
50
  var e = V, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), a = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), p = Symbol.for("react.offscreen"), m = Symbol.iterator, g = "@@iterator";
51
- function x(R) {
52
- if (R === null || typeof R != "object")
51
+ function x(E) {
52
+ if (E === null || typeof E != "object")
53
53
  return null;
54
- var Y = m && R[m] || R[g];
54
+ var Y = m && E[m] || E[g];
55
55
  return typeof Y == "function" ? Y : null;
56
56
  }
57
57
  var y = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
- function w(R) {
58
+ function w(E) {
59
59
  {
60
60
  for (var Y = arguments.length, ae = new Array(Y > 1 ? Y - 1 : 0), Te = 1; Te < Y; Te++)
61
61
  ae[Te - 1] = arguments[Te];
62
- S("error", R, ae);
62
+ S("error", E, ae);
63
63
  }
64
64
  }
65
- function S(R, Y, ae) {
65
+ function S(E, Y, ae) {
66
66
  {
67
67
  var Te = y.ReactDebugCurrentFrame, Ye = Te.getStackAddendum();
68
68
  Ye !== "" && (Y += "%s", ae = ae.concat([Ye]));
69
69
  var Ge = ae.map(function(Ue) {
70
70
  return String(Ue);
71
71
  });
72
- Ge.unshift("Warning: " + Y), Function.prototype.apply.call(console[R], console, Ge);
72
+ Ge.unshift("Warning: " + Y), Function.prototype.apply.call(console[E], console, Ge);
73
73
  }
74
74
  }
75
75
  var T = !1, C = !1, b = !1, k = !1, A = !1, N;
76
76
  N = Symbol.for("react.module.reference");
77
- function _(R) {
78
- return !!(typeof R == "string" || typeof R == "function" || R === r || R === s || A || R === o || R === c || R === d || k || R === p || T || C || b || typeof R == "object" && R !== null && (R.$$typeof === h || R.$$typeof === f || R.$$typeof === i || R.$$typeof === a || R.$$typeof === l || // This needs to include all possible module reference object
77
+ function _(E) {
78
+ return !!(typeof E == "string" || typeof E == "function" || E === r || E === s || A || E === o || E === c || E === d || k || E === p || T || C || b || typeof E == "object" && E !== null && (E.$$typeof === h || E.$$typeof === f || E.$$typeof === i || E.$$typeof === a || E.$$typeof === l || // 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.
82
- R.$$typeof === N || R.getModuleId !== void 0));
82
+ E.$$typeof === N || E.getModuleId !== void 0));
83
83
  }
84
- function M(R, Y, ae) {
85
- var Te = R.displayName;
84
+ function M(E, Y, ae) {
85
+ var Te = E.displayName;
86
86
  if (Te)
87
87
  return Te;
88
88
  var Ye = Y.displayName || Y.name || "";
89
89
  return Ye !== "" ? ae + "(" + Ye + ")" : ae;
90
90
  }
91
- function $(R) {
92
- return R.displayName || "Context";
91
+ function $(E) {
92
+ return E.displayName || "Context";
93
93
  }
94
- function z(R) {
95
- if (R == null)
94
+ function z(E) {
95
+ if (E == null)
96
96
  return null;
97
- if (typeof R.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof R == "function")
98
- return R.displayName || R.name || null;
99
- if (typeof R == "string")
100
- return R;
101
- switch (R) {
97
+ if (typeof E.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof E == "function")
98
+ return E.displayName || E.name || null;
99
+ if (typeof E == "string")
100
+ return E;
101
+ switch (E) {
102
102
  case r:
103
103
  return "Fragment";
104
104
  case n:
@@ -112,21 +112,21 @@ function $g() {
112
112
  case d:
113
113
  return "SuspenseList";
114
114
  }
115
- if (typeof R == "object")
116
- switch (R.$$typeof) {
115
+ if (typeof E == "object")
116
+ switch (E.$$typeof) {
117
117
  case a:
118
- var Y = R;
118
+ var Y = E;
119
119
  return $(Y) + ".Consumer";
120
120
  case i:
121
- var ae = R;
121
+ var ae = E;
122
122
  return $(ae._context) + ".Provider";
123
123
  case l:
124
- return M(R, R.render, "ForwardRef");
124
+ return M(E, E.render, "ForwardRef");
125
125
  case f:
126
- var Te = R.displayName || null;
127
- return Te !== null ? Te : z(R.type) || "Memo";
126
+ var Te = E.displayName || null;
127
+ return Te !== null ? Te : z(E.type) || "Memo";
128
128
  case h: {
129
- var Ye = R, Ge = Ye._payload, Ue = Ye._init;
129
+ var Ye = E, Ge = Ye._payload, Ue = Ye._init;
130
130
  try {
131
131
  return z(Ue(Ge));
132
132
  } catch {
@@ -144,20 +144,20 @@ function $g() {
144
144
  {
145
145
  if (B === 0) {
146
146
  j = console.log, W = console.info, F = console.warn, L = console.error, ne = console.group, Q = console.groupCollapsed, ge = console.groupEnd;
147
- var R = {
147
+ var E = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
150
150
  value: _e,
151
151
  writable: !0
152
152
  };
153
153
  Object.defineProperties(console, {
154
- info: R,
155
- log: R,
156
- warn: R,
157
- error: R,
158
- group: R,
159
- groupCollapsed: R,
160
- groupEnd: R
154
+ info: E,
155
+ log: E,
156
+ warn: E,
157
+ error: E,
158
+ group: E,
159
+ groupCollapsed: E,
160
+ groupEnd: E
161
161
  });
162
162
  }
163
163
  B++;
@@ -166,31 +166,31 @@ function $g() {
166
166
  function ue() {
167
167
  {
168
168
  if (B--, B === 0) {
169
- var R = {
169
+ var E = {
170
170
  configurable: !0,
171
171
  enumerable: !0,
172
172
  writable: !0
173
173
  };
174
174
  Object.defineProperties(console, {
175
- log: P({}, R, {
175
+ log: P({}, E, {
176
176
  value: j
177
177
  }),
178
- info: P({}, R, {
178
+ info: P({}, E, {
179
179
  value: W
180
180
  }),
181
- warn: P({}, R, {
181
+ warn: P({}, E, {
182
182
  value: F
183
183
  }),
184
- error: P({}, R, {
184
+ error: P({}, E, {
185
185
  value: L
186
186
  }),
187
- group: P({}, R, {
187
+ group: P({}, E, {
188
188
  value: ne
189
189
  }),
190
- groupCollapsed: P({}, R, {
190
+ groupCollapsed: P({}, E, {
191
191
  value: Q
192
192
  }),
193
- groupEnd: P({}, R, {
193
+ groupEnd: P({}, E, {
194
194
  value: ge
195
195
  })
196
196
  });
@@ -199,7 +199,7 @@ function $g() {
199
199
  }
200
200
  }
201
201
  var ke = y.ReactCurrentDispatcher, ee;
202
- function D(R, Y, ae) {
202
+ function D(E, Y, ae) {
203
203
  {
204
204
  if (ee === void 0)
205
205
  try {
@@ -209,7 +209,7 @@ function $g() {
209
209
  ee = Te && Te[1] || "";
210
210
  }
211
211
  return `
212
- ` + ee + R;
212
+ ` + ee + E;
213
213
  }
214
214
  }
215
215
  var q = !1, ie;
@@ -217,11 +217,11 @@ function $g() {
217
217
  var ce = typeof WeakMap == "function" ? WeakMap : Map;
218
218
  ie = new ce();
219
219
  }
220
- function H(R, Y) {
221
- if (!R || q)
220
+ function H(E, Y) {
221
+ if (!E || q)
222
222
  return "";
223
223
  {
224
- var ae = ie.get(R);
224
+ var ae = ie.get(E);
225
225
  if (ae !== void 0)
226
226
  return ae;
227
227
  }
@@ -246,14 +246,14 @@ function $g() {
246
246
  } catch (Ht) {
247
247
  Te = Ht;
248
248
  }
249
- Reflect.construct(R, [], Ue);
249
+ Reflect.construct(E, [], Ue);
250
250
  } else {
251
251
  try {
252
252
  Ue.call();
253
253
  } catch (Ht) {
254
254
  Te = Ht;
255
255
  }
256
- R.call(Ue.prototype);
256
+ E.call(Ue.prototype);
257
257
  }
258
258
  } else {
259
259
  try {
@@ -261,61 +261,61 @@ function $g() {
261
261
  } catch (Ht) {
262
262
  Te = Ht;
263
263
  }
264
- R();
264
+ E();
265
265
  }
266
266
  } catch (Ht) {
267
267
  if (Ht && Te && typeof Ht.stack == "string") {
268
268
  for (var Oe = Ht.stack.split(`
269
269
  `), _t = Te.stack.split(`
270
- `), yt = Oe.length - 1, Et = _t.length - 1; yt >= 1 && Et >= 0 && Oe[yt] !== _t[Et]; )
271
- Et--;
272
- for (; yt >= 1 && Et >= 0; yt--, Et--)
273
- if (Oe[yt] !== _t[Et]) {
274
- if (yt !== 1 || Et !== 1)
270
+ `), yt = Oe.length - 1, Rt = _t.length - 1; yt >= 1 && Rt >= 0 && Oe[yt] !== _t[Rt]; )
271
+ Rt--;
272
+ for (; yt >= 1 && Rt >= 0; yt--, Rt--)
273
+ if (Oe[yt] !== _t[Rt]) {
274
+ if (yt !== 1 || Rt !== 1)
275
275
  do
276
- if (yt--, Et--, Et < 0 || Oe[yt] !== _t[Et]) {
276
+ if (yt--, Rt--, Rt < 0 || Oe[yt] !== _t[Rt]) {
277
277
  var Qt = `
278
278
  ` + Oe[yt].replace(" at new ", " at ");
279
- return R.displayName && Qt.includes("<anonymous>") && (Qt = Qt.replace("<anonymous>", R.displayName)), typeof R == "function" && ie.set(R, Qt), Qt;
279
+ return E.displayName && Qt.includes("<anonymous>") && (Qt = Qt.replace("<anonymous>", E.displayName)), typeof E == "function" && ie.set(E, Qt), Qt;
280
280
  }
281
- while (yt >= 1 && Et >= 0);
281
+ while (yt >= 1 && Rt >= 0);
282
282
  break;
283
283
  }
284
284
  }
285
285
  } finally {
286
286
  q = !1, ke.current = Ge, ue(), Error.prepareStackTrace = Ye;
287
287
  }
288
- var Pn = R ? R.displayName || R.name : "", dn = Pn ? D(Pn) : "";
289
- return typeof R == "function" && ie.set(R, dn), dn;
288
+ var Pn = E ? E.displayName || E.name : "", dn = Pn ? D(Pn) : "";
289
+ return typeof E == "function" && ie.set(E, dn), dn;
290
290
  }
291
- function We(R, Y, ae) {
292
- return H(R, !1);
291
+ function We(E, Y, ae) {
292
+ return H(E, !1);
293
293
  }
294
- function re(R) {
295
- var Y = R.prototype;
294
+ function re(E) {
295
+ var Y = E.prototype;
296
296
  return !!(Y && Y.isReactComponent);
297
297
  }
298
- function ye(R, Y, ae) {
299
- if (R == null)
298
+ function ye(E, Y, ae) {
299
+ if (E == null)
300
300
  return "";
301
- if (typeof R == "function")
302
- return H(R, re(R));
303
- if (typeof R == "string")
304
- return D(R);
305
- switch (R) {
301
+ if (typeof E == "function")
302
+ return H(E, re(E));
303
+ if (typeof E == "string")
304
+ return D(E);
305
+ switch (E) {
306
306
  case c:
307
307
  return D("Suspense");
308
308
  case d:
309
309
  return D("SuspenseList");
310
310
  }
311
- if (typeof R == "object")
312
- switch (R.$$typeof) {
311
+ if (typeof E == "object")
312
+ switch (E.$$typeof) {
313
313
  case l:
314
- return We(R.render);
314
+ return We(E.render);
315
315
  case f:
316
- return ye(R.type, Y, ae);
316
+ return ye(E.type, Y, ae);
317
317
  case h: {
318
- var Te = R, Ye = Te._payload, Ge = Te._init;
318
+ var Te = E, Ye = Te._payload, Ge = Te._init;
319
319
  try {
320
320
  return ye(Ge(Ye), Y, ae);
321
321
  } catch {
@@ -325,25 +325,25 @@ function $g() {
325
325
  return "";
326
326
  }
327
327
  var Pe = Object.prototype.hasOwnProperty, $e = {}, ot = y.ReactDebugCurrentFrame;
328
- function Ce(R) {
329
- if (R) {
330
- var Y = R._owner, ae = ye(R.type, R._source, Y ? Y.type : null);
328
+ function Ce(E) {
329
+ if (E) {
330
+ var Y = E._owner, ae = ye(E.type, E._source, Y ? Y.type : null);
331
331
  ot.setExtraStackFrame(ae);
332
332
  } else
333
333
  ot.setExtraStackFrame(null);
334
334
  }
335
- function Xe(R, Y, ae, Te, Ye) {
335
+ function Xe(E, Y, ae, Te, Ye) {
336
336
  {
337
337
  var Ge = Function.call.bind(Pe);
338
- for (var Ue in R)
339
- if (Ge(R, Ue)) {
338
+ for (var Ue in E)
339
+ if (Ge(E, Ue)) {
340
340
  var Oe = void 0;
341
341
  try {
342
- if (typeof R[Ue] != "function") {
343
- var _t = Error((Te || "React class") + ": " + ae + " type `" + Ue + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Ue] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
342
+ if (typeof E[Ue] != "function") {
343
+ var _t = Error((Te || "React class") + ": " + ae + " type `" + Ue + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof E[Ue] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw _t.name = "Invariant Violation", _t;
345
345
  }
346
- Oe = R[Ue](Y, Ue, Te, ae, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
346
+ Oe = E[Ue](Y, Ue, Te, ae, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
347
  } catch (yt) {
348
348
  Oe = yt;
349
349
  }
@@ -352,28 +352,28 @@ function $g() {
352
352
  }
353
353
  }
354
354
  var st = Array.isArray;
355
- function Qe(R) {
356
- return st(R);
355
+ function Qe(E) {
356
+ return st(E);
357
357
  }
358
- function Je(R) {
358
+ function Je(E) {
359
359
  {
360
- var Y = typeof Symbol == "function" && Symbol.toStringTag, ae = Y && R[Symbol.toStringTag] || R.constructor.name || "Object";
360
+ var Y = typeof Symbol == "function" && Symbol.toStringTag, ae = Y && E[Symbol.toStringTag] || E.constructor.name || "Object";
361
361
  return ae;
362
362
  }
363
363
  }
364
- function qe(R) {
364
+ function qe(E) {
365
365
  try {
366
- return et(R), !1;
366
+ return et(E), !1;
367
367
  } catch {
368
368
  return !0;
369
369
  }
370
370
  }
371
- function et(R) {
372
- return "" + R;
371
+ function et(E) {
372
+ return "" + E;
373
373
  }
374
- function Mt(R) {
375
- if (qe(R))
376
- return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Je(R)), et(R);
374
+ function Mt(E) {
375
+ if (qe(E))
376
+ return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Je(E)), et(E);
377
377
  }
378
378
  var kt = y.ReactCurrentOwner, tt = {
379
379
  key: !0,
@@ -381,53 +381,53 @@ function $g() {
381
381
  __self: !0,
382
382
  __source: !0
383
383
  }, vt, At;
384
- function it(R) {
385
- if (Pe.call(R, "ref")) {
386
- var Y = Object.getOwnPropertyDescriptor(R, "ref").get;
384
+ function it(E) {
385
+ if (Pe.call(E, "ref")) {
386
+ var Y = Object.getOwnPropertyDescriptor(E, "ref").get;
387
387
  if (Y && Y.isReactWarning)
388
388
  return !1;
389
389
  }
390
- return R.ref !== void 0;
390
+ return E.ref !== void 0;
391
391
  }
392
- function Yt(R) {
393
- if (Pe.call(R, "key")) {
394
- var Y = Object.getOwnPropertyDescriptor(R, "key").get;
392
+ function Yt(E) {
393
+ if (Pe.call(E, "key")) {
394
+ var Y = Object.getOwnPropertyDescriptor(E, "key").get;
395
395
  if (Y && Y.isReactWarning)
396
396
  return !1;
397
397
  }
398
- return R.key !== void 0;
398
+ return E.key !== void 0;
399
399
  }
400
- function Xt(R, Y) {
401
- typeof R.ref == "string" && kt.current;
400
+ function Xt(E, Y) {
401
+ typeof E.ref == "string" && kt.current;
402
402
  }
403
- function Jt(R, Y) {
403
+ function Jt(E, Y) {
404
404
  {
405
405
  var ae = function() {
406
406
  vt || (vt = !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)", Y));
407
407
  };
408
- ae.isReactWarning = !0, Object.defineProperty(R, "key", {
408
+ ae.isReactWarning = !0, Object.defineProperty(E, "key", {
409
409
  get: ae,
410
410
  configurable: !0
411
411
  });
412
412
  }
413
413
  }
414
- function Zt(R, Y) {
414
+ function Zt(E, Y) {
415
415
  {
416
416
  var ae = function() {
417
417
  At || (At = !0, w("%s: `ref` 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)", Y));
418
418
  };
419
- ae.isReactWarning = !0, Object.defineProperty(R, "ref", {
419
+ ae.isReactWarning = !0, Object.defineProperty(E, "ref", {
420
420
  get: ae,
421
421
  configurable: !0
422
422
  });
423
423
  }
424
424
  }
425
- var ft = function(R, Y, ae, Te, Ye, Ge, Ue) {
425
+ var ft = function(E, Y, ae, Te, Ye, Ge, Ue) {
426
426
  var Oe = {
427
427
  // This tag allows us to uniquely identify this as a React Element
428
428
  $$typeof: t,
429
429
  // Built-in properties that belong on the element
430
- type: R,
430
+ type: E,
431
431
  key: Y,
432
432
  ref: ae,
433
433
  props: Ue,
@@ -451,58 +451,58 @@ function $g() {
451
451
  value: Ye
452
452
  }), Object.freeze && (Object.freeze(Oe.props), Object.freeze(Oe)), Oe;
453
453
  };
454
- function Ve(R, Y, ae, Te, Ye) {
454
+ function Ve(E, Y, ae, Te, Ye) {
455
455
  {
456
456
  var Ge, Ue = {}, Oe = null, _t = null;
457
457
  ae !== void 0 && (Mt(ae), Oe = "" + ae), Yt(Y) && (Mt(Y.key), Oe = "" + Y.key), it(Y) && (_t = Y.ref, Xt(Y, Ye));
458
458
  for (Ge in Y)
459
459
  Pe.call(Y, Ge) && !tt.hasOwnProperty(Ge) && (Ue[Ge] = Y[Ge]);
460
- if (R && R.defaultProps) {
461
- var yt = R.defaultProps;
460
+ if (E && E.defaultProps) {
461
+ var yt = E.defaultProps;
462
462
  for (Ge in yt)
463
463
  Ue[Ge] === void 0 && (Ue[Ge] = yt[Ge]);
464
464
  }
465
465
  if (Oe || _t) {
466
- var Et = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
- Oe && Jt(Ue, Et), _t && Zt(Ue, Et);
466
+ var Rt = typeof E == "function" ? E.displayName || E.name || "Unknown" : E;
467
+ Oe && Jt(Ue, Rt), _t && Zt(Ue, Rt);
468
468
  }
469
- return ft(R, Oe, _t, Ye, Te, kt.current, Ue);
469
+ return ft(E, Oe, _t, Ye, Te, kt.current, Ue);
470
470
  }
471
471
  }
472
472
  var Dt = y.ReactCurrentOwner, Pt = y.ReactDebugCurrentFrame;
473
- function G(R) {
474
- if (R) {
475
- var Y = R._owner, ae = ye(R.type, R._source, Y ? Y.type : null);
473
+ function G(E) {
474
+ if (E) {
475
+ var Y = E._owner, ae = ye(E.type, E._source, Y ? Y.type : null);
476
476
  Pt.setExtraStackFrame(ae);
477
477
  } else
478
478
  Pt.setExtraStackFrame(null);
479
479
  }
480
- var Ee;
481
- Ee = !1;
482
- function ve(R) {
483
- return typeof R == "object" && R !== null && R.$$typeof === t;
480
+ var Re;
481
+ Re = !1;
482
+ function ve(E) {
483
+ return typeof E == "object" && E !== null && E.$$typeof === t;
484
484
  }
485
485
  function gt() {
486
486
  {
487
487
  if (Dt.current) {
488
- var R = z(Dt.current.type);
489
- if (R)
488
+ var E = z(Dt.current.type);
489
+ if (E)
490
490
  return `
491
491
 
492
- Check the render method of \`` + R + "`.";
492
+ Check the render method of \`` + E + "`.";
493
493
  }
494
494
  return "";
495
495
  }
496
496
  }
497
- function xt(R) {
497
+ function xt(E) {
498
498
  return "";
499
499
  }
500
500
  var dt = {};
501
- function Me(R) {
501
+ function Me(E) {
502
502
  {
503
503
  var Y = gt();
504
504
  if (!Y) {
505
- var ae = typeof R == "string" ? R : R.displayName || R.name;
505
+ var ae = typeof E == "string" ? E : E.displayName || E.name;
506
506
  ae && (Y = `
507
507
 
508
508
  Check the top-level render call using <` + ae + ">.");
@@ -510,41 +510,41 @@ Check the top-level render call using <` + ae + ">.");
510
510
  return Y;
511
511
  }
512
512
  }
513
- function Kt(R, Y) {
513
+ function Kt(E, Y) {
514
514
  {
515
- if (!R._store || R._store.validated || R.key != null)
515
+ if (!E._store || E._store.validated || E.key != null)
516
516
  return;
517
- R._store.validated = !0;
517
+ E._store.validated = !0;
518
518
  var ae = Me(Y);
519
519
  if (dt[ae])
520
520
  return;
521
521
  dt[ae] = !0;
522
522
  var Te = "";
523
- R && R._owner && R._owner !== Dt.current && (Te = " It was passed a child from " + z(R._owner.type) + "."), G(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ae, Te), G(null);
523
+ E && E._owner && E._owner !== Dt.current && (Te = " It was passed a child from " + z(E._owner.type) + "."), G(E), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ae, Te), G(null);
524
524
  }
525
525
  }
526
- function Le(R, Y) {
526
+ function Le(E, Y) {
527
527
  {
528
- if (typeof R != "object")
528
+ if (typeof E != "object")
529
529
  return;
530
- if (Qe(R))
531
- for (var ae = 0; ae < R.length; ae++) {
532
- var Te = R[ae];
530
+ if (Qe(E))
531
+ for (var ae = 0; ae < E.length; ae++) {
532
+ var Te = E[ae];
533
533
  ve(Te) && Kt(Te, Y);
534
534
  }
535
- else if (ve(R))
536
- R._store && (R._store.validated = !0);
537
- else if (R) {
538
- var Ye = x(R);
539
- if (typeof Ye == "function" && Ye !== R.entries)
540
- for (var Ge = Ye.call(R), Ue; !(Ue = Ge.next()).done; )
535
+ else if (ve(E))
536
+ E._store && (E._store.validated = !0);
537
+ else if (E) {
538
+ var Ye = x(E);
539
+ if (typeof Ye == "function" && Ye !== E.entries)
540
+ for (var Ge = Ye.call(E), Ue; !(Ue = Ge.next()).done; )
541
541
  ve(Ue.value) && Kt(Ue.value, Y);
542
542
  }
543
543
  }
544
544
  }
545
- function wt(R) {
545
+ function wt(E) {
546
546
  {
547
- var Y = R.type;
547
+ var Y = E.type;
548
548
  if (Y == null || typeof Y == "string")
549
549
  return;
550
550
  var ae;
@@ -558,57 +558,57 @@ Check the top-level render call using <` + ae + ">.");
558
558
  return;
559
559
  if (ae) {
560
560
  var Te = z(Y);
561
- Xe(ae, R.props, "prop", Te, R);
562
- } else if (Y.PropTypes !== void 0 && !Ee) {
563
- Ee = !0;
561
+ Xe(ae, E.props, "prop", Te, E);
562
+ } else if (Y.PropTypes !== void 0 && !Re) {
563
+ Re = !0;
564
564
  var Ye = z(Y);
565
565
  w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Ye || "Unknown");
566
566
  }
567
567
  typeof Y.getDefaultProps == "function" && !Y.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
568
568
  }
569
569
  }
570
- function jn(R) {
570
+ function jn(E) {
571
571
  {
572
- for (var Y = Object.keys(R.props), ae = 0; ae < Y.length; ae++) {
572
+ for (var Y = Object.keys(E.props), ae = 0; ae < Y.length; ae++) {
573
573
  var Te = Y[ae];
574
574
  if (Te !== "children" && Te !== "key") {
575
- G(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Te), G(null);
575
+ G(E), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Te), G(null);
576
576
  break;
577
577
  }
578
578
  }
579
- R.ref !== null && (G(R), w("Invalid attribute `ref` supplied to `React.Fragment`."), G(null));
579
+ E.ref !== null && (G(E), w("Invalid attribute `ref` supplied to `React.Fragment`."), G(null));
580
580
  }
581
581
  }
582
582
  var Lt = {};
583
- function un(R, Y, ae, Te, Ye, Ge) {
583
+ function un(E, Y, ae, Te, Ye, Ge) {
584
584
  {
585
- var Ue = _(R);
585
+ var Ue = _(E);
586
586
  if (!Ue) {
587
587
  var Oe = "";
588
- (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && (Oe += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
588
+ (E === void 0 || typeof E == "object" && E !== null && Object.keys(E).length === 0) && (Oe += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
589
589
  var _t = xt();
590
590
  _t ? Oe += _t : Oe += gt();
591
591
  var yt;
592
- R === null ? yt = "null" : Qe(R) ? yt = "array" : R !== void 0 && R.$$typeof === t ? (yt = "<" + (z(R.type) || "Unknown") + " />", Oe = " Did you accidentally export a JSX literal instead of a component?") : yt = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", yt, Oe);
592
+ E === null ? yt = "null" : Qe(E) ? yt = "array" : E !== void 0 && E.$$typeof === t ? (yt = "<" + (z(E.type) || "Unknown") + " />", Oe = " Did you accidentally export a JSX literal instead of a component?") : yt = typeof E, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", yt, Oe);
593
593
  }
594
- var Et = Ve(R, Y, ae, Ye, Ge);
595
- if (Et == null)
596
- return Et;
594
+ var Rt = Ve(E, Y, ae, Ye, Ge);
595
+ if (Rt == null)
596
+ return Rt;
597
597
  if (Ue) {
598
598
  var Qt = Y.children;
599
599
  if (Qt !== void 0)
600
600
  if (Te)
601
601
  if (Qe(Qt)) {
602
602
  for (var Pn = 0; Pn < Qt.length; Pn++)
603
- Le(Qt[Pn], R);
603
+ Le(Qt[Pn], E);
604
604
  Object.freeze && Object.freeze(Qt);
605
605
  } else
606
606
  w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
607
607
  else
608
- Le(Qt, R);
608
+ Le(Qt, E);
609
609
  }
610
610
  if (Pe.call(Y, "key")) {
611
- var dn = z(R), Ht = Object.keys(Y).filter(function(se) {
611
+ var dn = z(E), Ht = Object.keys(Y).filter(function(se) {
612
612
  return se !== "key";
613
613
  }), On = Ht.length > 0 ? "{key: someKey, " + Ht.join(": ..., ") + ": ...}" : "{key: someKey}";
614
614
  if (!Lt[dn + On]) {
@@ -621,14 +621,14 @@ React keys must be passed directly to JSX without using spread:
621
621
  <%s key={someKey} {...props} />`, On, dn, Z, dn), Lt[dn + On] = !0;
622
622
  }
623
623
  }
624
- return R === r ? jn(Et) : wt(Et), Et;
624
+ return E === r ? jn(Rt) : wt(Rt), Rt;
625
625
  }
626
626
  }
627
- function Ur(R, Y, ae) {
628
- return un(R, Y, ae, !0);
627
+ function Ur(E, Y, ae) {
628
+ return un(E, Y, ae, !0);
629
629
  }
630
- function Wr(R, Y, ae) {
631
- return un(R, Y, ae, !1);
630
+ function Wr(E, Y, ae) {
631
+ return un(E, Y, ae, !1);
632
632
  }
633
633
  var br = Wr, Sr = Ur;
634
634
  xo.Fragment = r, xo.jsx = br, xo.jsxs = Sr;
@@ -698,7 +698,7 @@ function rd(e, t) {
698
698
  return o;
699
699
  return null;
700
700
  }
701
- const Er = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, od = (e) => !no(e) && e !== Er;
701
+ const Rr = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, od = (e) => !no(e) && e !== Rr;
702
702
  function wa() {
703
703
  const { caseless: e, skipUndefined: t } = od(this) && this || {}, n = {}, r = (o, s) => {
704
704
  const i = e && rd(n, s) || s;
@@ -807,14 +807,14 @@ const wx = (e) => {
807
807
  return r;
808
808
  };
809
809
  return n(e, 0);
810
- }, bx = Bn("AsyncFunction"), Sx = (e) => e && (Ho(e) || mn(e)) && mn(e.then) && mn(e.catch), id = ((e, t) => e ? setImmediate : t ? ((n, r) => (Er.addEventListener("message", ({ source: o, data: s }) => {
811
- o === Er && s === n && r.length && r.shift()();
810
+ }, bx = Bn("AsyncFunction"), Sx = (e) => e && (Ho(e) || mn(e)) && mn(e.then) && mn(e.catch), id = ((e, t) => e ? setImmediate : t ? ((n, r) => (Rr.addEventListener("message", ({ source: o, data: s }) => {
811
+ o === Rr && s === n && r.length && r.shift()();
812
812
  }, !1), (o) => {
813
- r.push(o), Er.postMessage(n, "*");
813
+ r.push(o), Rr.postMessage(n, "*");
814
814
  }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
815
815
  typeof setImmediate == "function",
816
- mn(Er.postMessage)
817
- ), Cx = typeof queueMicrotask < "u" ? queueMicrotask.bind(Er) : typeof process < "u" && process.nextTick || id, Tx = (e) => e != null && mn(e[oi]), O = {
816
+ mn(Rr.postMessage)
817
+ ), Cx = typeof queueMicrotask < "u" ? queueMicrotask.bind(Rr) : typeof process < "u" && process.nextTick || id, Tx = (e) => e != null && mn(e[oi]), O = {
818
818
  isArray: io,
819
819
  isArrayBuffer: td,
820
820
  isBuffer: Bo,
@@ -864,7 +864,7 @@ const wx = (e) => {
864
864
  noop: xx,
865
865
  toFiniteNumber: yx,
866
866
  findKey: rd,
867
- global: Er,
867
+ global: Rr,
868
868
  isContextDefined: od,
869
869
  isSpecCompliantForm: vx,
870
870
  toJSONObject: wx,
@@ -938,10 +938,10 @@ function fc(e, t, n) {
938
938
  return o = cd(o), !n && s ? "[" + o + "]" : o;
939
939
  }).join(n ? "." : "") : t;
940
940
  }
941
- function Ex(e) {
941
+ function Rx(e) {
942
942
  return O.isArray(e) && !e.some(ba);
943
943
  }
944
- const Rx = O.toFlatObject(O, {}, null, function(t) {
944
+ const Ex = O.toFlatObject(O, {}, null, function(t) {
945
945
  return /^is[A-Z]/.test(t);
946
946
  });
947
947
  function ai(e, t, n) {
@@ -972,7 +972,7 @@ function ai(e, t, n) {
972
972
  if (m && !x && typeof m == "object") {
973
973
  if (O.endsWith(g, "{}"))
974
974
  g = r ? g : g.slice(0, -2), m = JSON.stringify(m);
975
- else if (O.isArray(m) && Ex(m) || (O.isFileList(m) || O.endsWith(g, "[]")) && (y = O.toArray(m)))
975
+ else if (O.isArray(m) && Rx(m) || (O.isFileList(m) || O.endsWith(g, "[]")) && (y = O.toArray(m)))
976
976
  return g = cd(g), y.forEach(function(S, T) {
977
977
  !(O.isUndefined(S) || S === null) && t.append(
978
978
  // eslint-disable-next-line no-nested-ternary
@@ -983,7 +983,7 @@ function ai(e, t, n) {
983
983
  }
984
984
  return ba(m) ? !0 : (t.append(fc(x, g, s), c(m)), !1);
985
985
  }
986
- const f = [], h = Object.assign(Rx, {
986
+ const f = [], h = Object.assign(Ex, {
987
987
  defaultVisitor: d,
988
988
  convertValue: c,
989
989
  isVisitable: ba
@@ -2027,7 +2027,7 @@ const wd = "1.12.2", li = {};
2027
2027
  return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
2028
2028
  };
2029
2029
  });
2030
- const Ec = {};
2030
+ const Rc = {};
2031
2031
  li.transitional = function(t, n, r) {
2032
2032
  function o(s, i) {
2033
2033
  return "[Axios v" + wd + "] Transitional option '" + s + "'" + i + (r ? ". " + r : "");
@@ -2038,7 +2038,7 @@ li.transitional = function(t, n, r) {
2038
2038
  o(i, " has been removed" + (n ? " in " + n : "")),
2039
2039
  ze.ERR_DEPRECATED
2040
2040
  );
2041
- return n && !Ec[i] && (Ec[i] = !0, console.warn(
2041
+ return n && !Rc[i] && (Rc[i] = !0, console.warn(
2042
2042
  o(
2043
2043
  i,
2044
2044
  " has been deprecated since v" + n + " and will be removed in the near future"
@@ -2370,23 +2370,23 @@ $t.getAdapter = vd.getAdapter;
2370
2370
  $t.HttpStatusCode = Ta;
2371
2371
  $t.default = $t;
2372
2372
  const {
2373
- Axios: SE,
2374
- AxiosError: CE,
2375
- CanceledError: TE,
2376
- isCancel: kE,
2377
- CancelToken: EE,
2378
- VERSION: RE,
2379
- all: IE,
2380
- Cancel: NE,
2381
- isAxiosError: AE,
2382
- spread: _E,
2383
- toFormData: jE,
2384
- AxiosHeaders: PE,
2385
- HttpStatusCode: OE,
2386
- formToJSON: ME,
2387
- getAdapter: DE,
2388
- mergeConfig: LE
2389
- } = $t, Rc = typeof window < "u" ? window.__API_BASE_URL__ : void 0, Ic = Rc ? or(Rc) : void 0;
2373
+ Axios: SR,
2374
+ AxiosError: CR,
2375
+ CanceledError: TR,
2376
+ isCancel: kR,
2377
+ CancelToken: RR,
2378
+ VERSION: ER,
2379
+ all: IR,
2380
+ Cancel: NR,
2381
+ isAxiosError: AR,
2382
+ spread: _R,
2383
+ toFormData: jR,
2384
+ AxiosHeaders: PR,
2385
+ HttpStatusCode: OR,
2386
+ formToJSON: MR,
2387
+ getAdapter: DR,
2388
+ mergeConfig: LR
2389
+ } = $t, Ec = typeof window < "u" ? window.__API_BASE_URL__ : void 0, Ic = Ec ? or(Ec) : void 0;
2390
2390
  function or(e) {
2391
2391
  const n = (e != null && e.trim() ? e.trim() : "/api/chat").replace(/\/+$/, "");
2392
2392
  return n ? n.endsWith("/chat") ? n : `${n}/chat` : "/api/chat";
@@ -2396,7 +2396,7 @@ const ka = /* @__PURE__ */ new Set();
2396
2396
  function py() {
2397
2397
  return Ps;
2398
2398
  }
2399
- function Ea(e) {
2399
+ function Ra(e) {
2400
2400
  Ps = e, ka.forEach((t) => t(e));
2401
2401
  }
2402
2402
  function my(e) {
@@ -2412,17 +2412,16 @@ const gy = 3e4, xy = 9e4, Nn = $t.create({
2412
2412
  Nn.interceptors.request.use((e) => (Ps && (e.headers.Authorization = `Bearer ${Ps}`), e));
2413
2413
  Nn.interceptors.response.use(
2414
2414
  (e) => {
2415
- var t, n;
2416
2415
  if (typeof window < "u" && (e != null && e.data))
2417
2416
  try {
2418
- const r = (t = e.data) == null ? void 0 : t.token, o = (n = e.data) == null ? void 0 : n.expires_at;
2419
- r && typeof r == "string" && (localStorage.setItem("authToken", r), Ea(r)), o && typeof o == "number" && localStorage.setItem("authTokenExpiresAt", o.toString()), window.dispatchEvent(
2417
+ const t = e.data, n = t.data || {}, r = typeof t.token == "string" && t.token || typeof n.token == "string" && n.token || null, o = typeof t.expires_at == "number" && t.expires_at || typeof n.expires_at == "number" && n.expires_at || typeof t.expiresAt == "number" && t.expiresAt || typeof n.expiresAt == "number" && n.expiresAt || null;
2418
+ r && (localStorage.setItem("authToken", r), Ra(r)), o && localStorage.setItem("authTokenExpiresAt", o.toString()), (r || o) && window.dispatchEvent(
2420
2419
  new CustomEvent("smartorg:chat-token-updated", {
2421
2420
  detail: { token: r, expiresAt: o }
2422
2421
  })
2423
2422
  );
2424
- } catch (r) {
2425
- console.warn("[chat-api] Error storing token:", r);
2423
+ } catch (t) {
2424
+ console.warn("[chat-api] Error storing token:", t);
2426
2425
  }
2427
2426
  return e;
2428
2427
  },
@@ -2450,14 +2449,14 @@ class wy {
2450
2449
  return t ? or(String(t)) : "";
2451
2450
  }
2452
2451
  updateConfig(t) {
2453
- t.baseUrl && (Nn.defaults.baseURL = or(String(t.baseUrl))), t.authToken !== void 0 && Ea(t.authToken);
2452
+ t.baseUrl && (Nn.defaults.baseURL = or(String(t.baseUrl))), t.authToken !== void 0 && Ra(t.authToken);
2454
2453
  }
2455
2454
  // ---- Token Management ----
2456
2455
  getAuthToken() {
2457
2456
  return py();
2458
2457
  }
2459
2458
  setAuthToken(t) {
2460
- Ea(t);
2459
+ Ra(t);
2461
2460
  }
2462
2461
  onTokenChange(t) {
2463
2462
  return my(t);
@@ -2608,7 +2607,7 @@ function Os(e) {
2608
2607
  interrupt: null,
2609
2608
  snapshots: {}
2610
2609
  };
2611
- const { orderedSnapshots: o, snapshotMap: s } = Ey(t), i = kd(r, 0);
2610
+ const { orderedSnapshots: o, snapshotMap: s } = Ry(t), i = kd(r, 0);
2612
2611
  return {
2613
2612
  threadId: n,
2614
2613
  latest: i,
@@ -2645,7 +2644,7 @@ function ky(e, t, n) {
2645
2644
  const r = _y(e, n);
2646
2645
  return r || Ay(t, n);
2647
2646
  }
2648
- function Ey(e) {
2647
+ function Ry(e) {
2649
2648
  const t = /* @__PURE__ */ new Map();
2650
2649
  e.forEach((o, s) => {
2651
2650
  if (!sl(o)) return;
@@ -2656,7 +2655,7 @@ function Ey(e) {
2656
2655
  t.set(a, i);
2657
2656
  return;
2658
2657
  }
2659
- t.set(a, Ry(l, i));
2658
+ t.set(a, Ey(l, i));
2660
2659
  });
2661
2660
  const n = Array.from(t.values());
2662
2661
  n.sort((o, s) => Ac(s.createdAt ?? "") - Ac(o.createdAt ?? ""));
@@ -2665,7 +2664,7 @@ function Ey(e) {
2665
2664
  r[o] = s;
2666
2665
  return { orderedSnapshots: n, snapshotMap: r };
2667
2666
  }
2668
- function Ry(e, t) {
2667
+ function Ey(e, t) {
2669
2668
  return {
2670
2669
  ...e,
2671
2670
  metadata: ns(e.metadata, t.metadata) ?? null,
@@ -2746,7 +2745,7 @@ function bo(e, t, n = 0, r = /* @__PURE__ */ new Set()) {
2746
2745
  return null;
2747
2746
  r.add(e);
2748
2747
  }
2749
- const o = Ed(e, t);
2748
+ const o = Rd(e, t);
2750
2749
  if (o)
2751
2750
  return o;
2752
2751
  if (Array.isArray(e)) {
@@ -2784,7 +2783,7 @@ function bo(e, t, n = 0, r = /* @__PURE__ */ new Set()) {
2784
2783
  }
2785
2784
  return null;
2786
2785
  }
2787
- function Ed(e, t) {
2786
+ function Rd(e, t) {
2788
2787
  if (!e)
2789
2788
  return null;
2790
2789
  if (typeof e == "object" && !Array.isArray(e)) {
@@ -2796,7 +2795,7 @@ function Ed(e, t) {
2796
2795
  }
2797
2796
  if (Array.isArray(e)) {
2798
2797
  for (let n = e.length - 1; n >= 0; n--) {
2799
- const r = Ed(e[n], t);
2798
+ const r = Rd(e[n], t);
2800
2799
  if (r)
2801
2800
  return r;
2802
2801
  }
@@ -2876,7 +2875,7 @@ function _c(e) {
2876
2875
  return typeof t.mimeType == "string" && (s.mimeType = t.mimeType), typeof t.name == "string" && (s.name = t.name), typeof t.size == "number" && (s.size = t.size), typeof t.sourceType == "string" && (s.sourceType = t.sourceType), s;
2877
2876
  }
2878
2877
  if (n === "tool_call")
2879
- return Rd(t) ?? null;
2878
+ return Ed(t) ?? null;
2880
2879
  if (n === "tool_end") {
2881
2880
  const o = "output" in t ? t.output : t.content;
2882
2881
  return o ? { type: "text", text: typeof o == "string" ? o : JSON.stringify(o) } : null;
@@ -2895,7 +2894,7 @@ function _c(e) {
2895
2894
  const r = typeof t.content == "string" ? t.content : typeof t.value == "string" ? t.value : JSON.stringify(t);
2896
2895
  return r ? { type: "text", text: r } : null;
2897
2896
  }
2898
- function Rd(e, t) {
2897
+ function Ed(e, t) {
2899
2898
  var s;
2900
2899
  const n = zt(e, ["id", "call_id"]) ?? t, r = zt(e, ["name"]) ?? zt(pn(e.function), ["name"]);
2901
2900
  if (!n || !r) return null;
@@ -2903,7 +2902,7 @@ function Rd(e, t) {
2903
2902
  return { type: "tool_call", id: n, name: r, args: o };
2904
2903
  }
2905
2904
  function My(e) {
2906
- return Array.isArray(e) ? e.map((t, n) => Rd(t, `tool_call_${n}`)).filter((t) => !!t) : [];
2905
+ return Array.isArray(e) ? e.map((t, n) => Ed(t, `tool_call_${n}`)).filter((t) => !!t) : [];
2907
2906
  }
2908
2907
  function Dy(e, t) {
2909
2908
  const n = e.content ?? e.output;
@@ -3012,7 +3011,7 @@ function By(e, t) {
3012
3011
  }
3013
3012
  }
3014
3013
  function Hy(e = []) {
3015
- const [t, n] = cg(By, { ...zy, messages: e }), r = Re([]), o = Re(null), s = Re(null), i = de(() => {
3014
+ const [t, n] = cg(By, { ...zy, messages: e }), r = Ee([]), o = Ee(null), s = Ee(null), i = de(() => {
3016
3015
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), o.current = null, s.current = null;
3017
3016
  const d = r.current;
3018
3017
  d.length && (r.current = [], n({ type: "batch", payload: { events: d } }));
@@ -3358,7 +3357,7 @@ function Ky(e) {
3358
3357
  return t[t.length - 1] || null;
3359
3358
  }
3360
3359
  function qy(e = {}) {
3361
- const t = ct(() => or(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = we(e.token ?? null), s = Re(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = we(!1), [c, d] = we(null), [f, h] = we(""), [p, m] = we(null), [g, x] = we(0), [y, w] = we(!1), S = Re(null), T = Re(!0), C = Re(0), b = Re(null), k = Re(null), A = Re(null), N = Re(null), _ = de((P) => {
3360
+ const t = ct(() => or(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = we(e.token ?? null), s = Ee(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = we(!1), [c, d] = we(null), [f, h] = we(""), [p, m] = we(null), [g, x] = we(0), [y, w] = we(!1), S = Ee(null), T = Ee(!0), C = Ee(0), b = Ee(null), k = Ee(null), A = Ee(null), N = Ee(null), _ = de((P) => {
3362
3361
  o(P);
3363
3362
  }, []), M = de(() => {
3364
3363
  h(""), m(null), d(null), k.current = null, A.current = null, N.current = null;
@@ -3397,8 +3396,8 @@ function qy(e = {}) {
3397
3396
  const Ve = window.__AUTH_TOKEN__, Dt = ((ge = window.localStorage) == null ? void 0 : ge.getItem("authToken")) || null;
3398
3397
  let Pt = null;
3399
3398
  try {
3400
- const Ee = (_e = window.localStorage) == null ? void 0 : _e.getItem("chat-settings");
3401
- Ee && (Pt = ((J = JSON.parse(Ee)) == null ? void 0 : J.apiKey) || null);
3399
+ const Re = (_e = window.localStorage) == null ? void 0 : _e.getItem("chat-settings");
3400
+ Re && (Pt = ((J = JSON.parse(Re)) == null ? void 0 : J.apiKey) || null);
3402
3401
  } catch {
3403
3402
  }
3404
3403
  const G = Ve || Dt || Pt || null;
@@ -3471,8 +3470,8 @@ function qy(e = {}) {
3471
3470
  ...b.current,
3472
3471
  threadId: Dt
3473
3472
  }), (ee = j == null ? void 0 : j.onOpen) == null || ee.call(j, { threadId: Dt, created: Pt }); ; ) {
3474
- const { value: G, done: Ee } = await et.read();
3475
- if (Ee) break;
3473
+ const { value: G, done: Re } = await et.read();
3474
+ if (Re) break;
3476
3475
  kt += Mt.decode(G, { stream: !0 }), kt.length > Zt && (kt = "", console.warn("Stream buffer reset: exceeded 1MB"));
3477
3476
  let ve;
3478
3477
  for (; (ve = kt.indexOf(`
@@ -3639,7 +3638,7 @@ function Xy({
3639
3638
  onAuthError: a,
3640
3639
  onHeartbeat: l
3641
3640
  }) {
3642
- const c = Re(null), d = Re(null), f = Re(/* @__PURE__ */ new Map()), h = Re(null), p = de((N) => {
3641
+ const c = Ee(null), d = Ee(null), f = Ee(/* @__PURE__ */ new Map()), h = Ee(null), p = de((N) => {
3643
3642
  try {
3644
3643
  const _ = globalThis.structuredClone;
3645
3644
  if (typeof _ == "function")
@@ -3822,8 +3821,8 @@ function Xy({
3822
3821
  [k, A, T, C, b, x]
3823
3822
  );
3824
3823
  }
3825
- const Fc = 50, Jy = 750, qi = "chat-history@1", Zy = 5, Qy = 1e3, ev = 15e3, bs = 300;
3826
- function $c(e, t = bs) {
3824
+ const bs = 300;
3825
+ function Fc(e, t = bs) {
3827
3826
  if (typeof window < "u" && "requestIdleCallback" in window)
3828
3827
  try {
3829
3828
  window.requestIdleCallback(e, { timeout: t });
@@ -3843,7 +3842,7 @@ function al(e) {
3843
3842
  return null;
3844
3843
  }
3845
3844
  }
3846
- function Ra(e, t) {
3845
+ function Ea(e, t) {
3847
3846
  if (!jr()) return !1;
3848
3847
  try {
3849
3848
  return window.localStorage.setItem(e, t), !0;
@@ -3858,26 +3857,26 @@ function Ia(e) {
3858
3857
  } catch {
3859
3858
  }
3860
3859
  }
3861
- function Gi(e) {
3860
+ function qi(e) {
3862
3861
  return e == null ? e : { ...e };
3863
3862
  }
3864
- function tv(e) {
3863
+ function Jy(e) {
3865
3864
  return e == null ? e : { ...e };
3866
3865
  }
3867
- function nv(e) {
3866
+ function Zy(e) {
3868
3867
  if (Array.isArray(e))
3869
3868
  return e.slice();
3870
3869
  if (e == null)
3871
3870
  return e;
3872
3871
  }
3873
- function rv(e) {
3872
+ function Qy(e) {
3874
3873
  if (Array.isArray(e))
3875
3874
  return e.map((t) => ({ ...t }));
3876
3875
  if (e == null)
3877
3876
  return e;
3878
3877
  }
3879
3878
  function hn(e, t = {}) {
3880
- const n = t.cloneMessages ?? !1, r = Array.isArray(e == null ? void 0 : e.messages) ? e.messages : [], o = Gi(e == null ? void 0 : e.metadata), s = Gi(e == null ? void 0 : e.config), i = Gi(e == null ? void 0 : e.parentConfig), a = nv(e == null ? void 0 : e.next), l = rv(e == null ? void 0 : e.tasks), c = tv(e == null ? void 0 : e.values), d = {
3879
+ const n = t.cloneMessages ?? !1, r = Array.isArray(e == null ? void 0 : e.messages) ? e.messages : [], o = qi(e == null ? void 0 : e.metadata), s = qi(e == null ? void 0 : e.config), i = qi(e == null ? void 0 : e.parentConfig), a = Zy(e == null ? void 0 : e.next), l = Qy(e == null ? void 0 : e.tasks), c = Jy(e == null ? void 0 : e.values), d = {
3881
3880
  checkpointId: (e == null ? void 0 : e.checkpointId) ?? null,
3882
3881
  checkpointNs: (e == null ? void 0 : e.checkpointNs) ?? null,
3883
3882
  createdAt: (e == null ? void 0 : e.createdAt) ?? null,
@@ -3893,7 +3892,7 @@ function hn(e, t = {}) {
3893
3892
  };
3894
3893
  return o !== void 0 && (d.metadata = o), s !== void 0 && (d.config = s), i !== void 0 && (d.parentConfig = i), a !== void 0 && (d.next = a), l !== void 0 && (d.tasks = l), c !== void 0 && (d.values = c), d;
3895
3894
  }
3896
- function ov(e) {
3895
+ function ev(e) {
3897
3896
  var t;
3898
3897
  for (let n = e.length - 1; n >= 0; n--) {
3899
3898
  const r = ((t = e[n]) == null ? void 0 : t.content) ?? [];
@@ -3910,7 +3909,7 @@ function ov(e) {
3910
3909
  }
3911
3910
  return null;
3912
3911
  }
3913
- function zc(e, t) {
3912
+ function $c(e, t) {
3914
3913
  if (!e && !t) return !0;
3915
3914
  if (!e || !t || e.id !== t.id) return !1;
3916
3915
  try {
@@ -3922,7 +3921,7 @@ function zc(e, t) {
3922
3921
  function ll(e, t) {
3923
3922
  return `${e}${t}`;
3924
3923
  }
3925
- function sv(e, t) {
3924
+ function tv(e, t) {
3926
3925
  const n = al(ll(e, t));
3927
3926
  if (!n) return null;
3928
3927
  try {
@@ -3936,7 +3935,7 @@ function sv(e, t) {
3936
3935
  return null;
3937
3936
  }
3938
3937
  }
3939
- function iv(e, t, n = 100) {
3938
+ function nv(e, t, n = 100) {
3940
3939
  if (!jr()) return;
3941
3940
  const r = hn(t.snapshot, { cloneMessages: !0 }), o = {
3942
3941
  threadId: t.threadId,
@@ -3946,7 +3945,7 @@ function iv(e, t, n = 100) {
3946
3945
  },
3947
3946
  updatedAt: Date.now()
3948
3947
  }, s = ll(e, t.threadId), i = JSON.stringify(o);
3949
- if (!Ra(s, i))
3948
+ if (!Ea(s, i))
3950
3949
  try {
3951
3950
  const a = [];
3952
3951
  for (let l = 0; l < window.localStorage.length; l++) {
@@ -3967,15 +3966,15 @@ function iv(e, t, n = 100) {
3967
3966
  }
3968
3967
  a.sort((l, c) => l.updatedAt - c.updatedAt);
3969
3968
  for (const l of a)
3970
- if (window.localStorage.removeItem(l.key), Ra(s, i))
3969
+ if (window.localStorage.removeItem(l.key), Ea(s, i))
3971
3970
  break;
3972
3971
  } catch {
3973
3972
  }
3974
3973
  }
3975
- function av(e, t) {
3974
+ function rv(e, t) {
3976
3975
  Ia(ll(e, t));
3977
3976
  }
3978
- function lv(e) {
3977
+ function ov(e) {
3979
3978
  if (jr())
3980
3979
  try {
3981
3980
  for (let t = 0; t < window.localStorage.length; t++) {
@@ -3985,26 +3984,26 @@ function lv(e) {
3985
3984
  } catch {
3986
3985
  }
3987
3986
  }
3988
- function Bc(e, t, n) {
3987
+ function zc(e, t, n) {
3989
3988
  return `${e}__${t ?? ""}__${n ?? ""}`;
3990
3989
  }
3991
3990
  function Ss(e, t) {
3992
3991
  return t && typeof t == "object" ? { ...e && typeof e == "object" ? { ...e } : {}, ...t } : t === null ? e && typeof e == "object" ? { ...e } : e ?? null : e && typeof e == "object" ? { ...e } : e ?? void 0;
3993
3992
  }
3994
- function cv(e, t) {
3993
+ function sv(e, t) {
3995
3994
  return Ss(
3996
3995
  e,
3997
3996
  t
3998
3997
  );
3999
3998
  }
4000
- function uv(e, t) {
3999
+ function iv(e, t) {
4001
4000
  return Array.isArray(t) ? t.slice() : t === null ? Array.isArray(e) ? e.slice() : e ?? null : Array.isArray(e) ? e.slice() : e ?? void 0;
4002
4001
  }
4003
- function dv(e, t) {
4002
+ function av(e, t) {
4004
4003
  return Array.isArray(t) ? t.map((n) => ({ ...n })) : t === null ? Array.isArray(e) ? e.map((n) => ({ ...n })) : e ?? null : Array.isArray(e) ? e.map((n) => ({ ...n })) : e ?? void 0;
4005
4004
  }
4006
4005
  function Ad(e, t) {
4007
- const n = Ss(e.metadata, t.metadata), r = Ss(e.config, t.config), o = Ss(e.parentConfig, t.parentConfig), s = uv(e.next, t.next), i = dv(e.tasks, t.tasks), a = cv(e.values, t.values), l = {};
4006
+ const n = Ss(e.metadata, t.metadata), r = Ss(e.config, t.config), o = Ss(e.parentConfig, t.parentConfig), s = iv(e.next, t.next), i = av(e.tasks, t.tasks), a = sv(e.values, t.values), l = {};
4008
4007
  return n !== void 0 && (l.metadata = n ?? null), r !== void 0 && (l.config = r ?? null), o !== void 0 && (l.parentConfig = o ?? null), s !== void 0 && (l.next = s ?? null), i !== void 0 && (l.tasks = i ?? null), a !== void 0 && (l.values = a ?? null), l;
4009
4008
  }
4010
4009
  function _d(e) {
@@ -4017,69 +4016,8 @@ function _d(e) {
4017
4016
  };
4018
4017
  }) : [];
4019
4018
  }
4020
- const fv = "cachedThreads", hv = "v1", Na = 200;
4021
- function pv(e) {
4022
- let t = 5381;
4023
- for (let n = 0; n < e.length; n++)
4024
- t = (t << 5) + t ^ e.charCodeAt(n);
4025
- return (t >>> 0).toString(36);
4026
- }
4027
- function Yi(e, t) {
4028
- return `cachedThreads:v1:${e}:${pv(t || "anon")}`;
4029
- }
4030
- function mv() {
4031
- const e = al(fv);
4032
- if (!e) return [];
4033
- try {
4034
- const t = JSON.parse(e);
4035
- return Array.isArray(t) ? t.filter((n) => {
4036
- if (!n || typeof n != "object") return !1;
4037
- const r = n;
4038
- return typeof r.threadId == "string" && typeof r.title == "string";
4039
- }) : [];
4040
- } catch {
4041
- return [];
4042
- }
4043
- }
4044
- function gv(e) {
4045
- const t = al(e);
4046
- if (!t) return [];
4047
- try {
4048
- const n = JSON.parse(t);
4049
- return Array.isArray(n) ? n.filter((r) => {
4050
- if (!r || typeof r != "object") return !1;
4051
- const o = r;
4052
- return typeof o.threadId == "string" && typeof o.title == "string";
4053
- }) : [];
4054
- } catch {
4055
- return [];
4056
- }
4057
- }
4058
- function Aa(e, t) {
4059
- Ra(e, JSON.stringify(t));
4060
- }
4061
- function Xi(e) {
4062
- const t = gv(e);
4063
- if (t.length > 0) return t;
4064
- const n = mv();
4065
- if (n.length > 0)
4066
- try {
4067
- Aa(e, n.slice(0, Na));
4068
- } catch {
4069
- }
4070
- return n;
4071
- }
4072
- function os(e) {
4073
- const t = {}, n = [];
4074
- for (const r of e)
4075
- !r || typeof r.threadId != "string" || t[r.threadId] || (t[r.threadId] = r, n.push(r.threadId));
4076
- return { byId: t, order: n };
4077
- }
4078
- function Ji(e) {
4079
- return e.order.map((t) => e.byId[t]).filter(Boolean);
4080
- }
4081
- function xv({ currentThreadId: e, currentThreadIdRef: t }) {
4082
- const [n, r] = we([]), o = Re(/* @__PURE__ */ new Map()), s = Re(/* @__PURE__ */ new Map()), i = de((m) => {
4019
+ function lv({ currentThreadId: e, currentThreadIdRef: t }) {
4020
+ const [n, r] = we([]), o = Ee(/* @__PURE__ */ new Map()), s = Ee(/* @__PURE__ */ new Map()), i = de((m) => {
4083
4021
  if (!m) {
4084
4022
  r([]);
4085
4023
  return;
@@ -4188,7 +4126,68 @@ function xv({ currentThreadId: e, currentThreadIdRef: t }) {
4188
4126
  getSnapshotFromCache: p
4189
4127
  };
4190
4128
  }
4191
- const jd = zo(null), Pd = zo(null), Od = zo(null), yv = zo(!1);
4129
+ const cv = "cachedThreads", uv = "v1", Na = 200;
4130
+ function dv(e) {
4131
+ let t = 5381;
4132
+ for (let n = 0; n < e.length; n++)
4133
+ t = (t << 5) + t ^ e.charCodeAt(n);
4134
+ return (t >>> 0).toString(36);
4135
+ }
4136
+ function Gi(e, t) {
4137
+ return `cachedThreads:v1:${e}:${dv(t || "anon")}`;
4138
+ }
4139
+ function fv() {
4140
+ const e = al(cv);
4141
+ if (!e) return [];
4142
+ try {
4143
+ const t = JSON.parse(e);
4144
+ return Array.isArray(t) ? t.filter((n) => {
4145
+ if (!n || typeof n != "object") return !1;
4146
+ const r = n;
4147
+ return typeof r.threadId == "string" && typeof r.title == "string";
4148
+ }) : [];
4149
+ } catch {
4150
+ return [];
4151
+ }
4152
+ }
4153
+ function hv(e) {
4154
+ const t = al(e);
4155
+ if (!t) return [];
4156
+ try {
4157
+ const n = JSON.parse(t);
4158
+ return Array.isArray(n) ? n.filter((r) => {
4159
+ if (!r || typeof r != "object") return !1;
4160
+ const o = r;
4161
+ return typeof o.threadId == "string" && typeof o.title == "string";
4162
+ }) : [];
4163
+ } catch {
4164
+ return [];
4165
+ }
4166
+ }
4167
+ function Aa(e, t) {
4168
+ Ea(e, JSON.stringify(t));
4169
+ }
4170
+ function Yi(e) {
4171
+ const t = hv(e);
4172
+ if (t.length > 0) return t;
4173
+ const n = fv();
4174
+ if (n.length > 0)
4175
+ try {
4176
+ Aa(e, n.slice(0, Na));
4177
+ } catch {
4178
+ }
4179
+ return n;
4180
+ }
4181
+ function os(e) {
4182
+ const t = {}, n = [];
4183
+ for (const r of e)
4184
+ !r || typeof r.threadId != "string" || t[r.threadId] || (t[r.threadId] = r, n.push(r.threadId));
4185
+ return { byId: t, order: n };
4186
+ }
4187
+ function Xi(e) {
4188
+ return e.order.map((t) => e.byId[t]).filter(Boolean);
4189
+ }
4190
+ const Bc = 50, pv = 750, Ji = "chat-history@1", mv = 5, gv = 1e3, xv = 15e3, jd = zo(null), Pd = zo(null), Od = zo(null), yv = zo(!1);
4192
4191
  function vv({
4193
4192
  children: e,
4194
4193
  initialThreadId: t = null,
@@ -4207,38 +4206,38 @@ function vv({
4207
4206
  return "unknown";
4208
4207
  }
4209
4208
  }, [d]), p = ct(
4210
- () => `threadPayload:${hv}:${h}:`,
4209
+ () => `threadPayload:${uv}:${h}:`,
4211
4210
  [h]
4212
4211
  ), m = de(
4213
- (E) => sv(p, E),
4212
+ (R) => tv(p, R),
4214
4213
  [p]
4215
4214
  ), g = de(
4216
- (E, I = 100) => {
4217
- iv(p, E, I);
4215
+ (R, I = 100) => {
4216
+ nv(p, R, I);
4218
4217
  },
4219
4218
  [p]
4220
4219
  ), x = de(
4221
- (E) => {
4222
- av(p, E);
4220
+ (R) => {
4221
+ rv(p, R);
4223
4222
  },
4224
4223
  [p]
4225
4224
  ), y = de(() => {
4226
- lv(p);
4225
+ ov(p);
4227
4226
  }, [p]), [w, S] = we(
4228
4227
  () => {
4229
- var E;
4230
- return Yi(h, (E = c.getAuthToken) == null ? void 0 : E.call(c));
4228
+ var R;
4229
+ return Gi(h, (R = c.getAuthToken) == null ? void 0 : R.call(c));
4231
4230
  }
4232
4231
  ), [T, C] = we(() => {
4233
4232
  var I;
4234
- const E = Xi(
4235
- Yi(h, (I = c.getAuthToken) == null ? void 0 : I.call(c))
4233
+ const R = Yi(
4234
+ Gi(h, (I = c.getAuthToken) == null ? void 0 : I.call(c))
4236
4235
  );
4237
- return os(E);
4238
- }), b = ct(() => Ji(T), [T]), [k, A] = we(t), [N, _] = we(!1), [M, $] = we(!1), [z, P] = we(null), [B, j] = we(null), [W, F] = we(null), L = de(() => {
4239
- const E = Xi(w);
4236
+ return os(R);
4237
+ }), b = ct(() => Xi(T), [T]), [k, A] = we(t), [N, _] = we(!1), [M, $] = we(!1), [z, P] = we(null), [B, j] = we(null), [W, F] = we(null), L = de(() => {
4238
+ const R = Yi(w);
4240
4239
  es(() => {
4241
- C(os(E));
4240
+ C(os(R));
4242
4241
  });
4243
4242
  }, [w]), [ne, Q] = we(!1), [ge, _e] = we(!1), [J, ue] = we(null), [ke, ee] = we(void 0), [D, q] = we(void 0), [ie, ce] = we(void 0), {
4244
4243
  state: H,
@@ -4248,11 +4247,11 @@ function vv({
4248
4247
  pushUser: Pe,
4249
4248
  onEvent: $e,
4250
4249
  reset: ot
4251
- } = Hy(), Ce = Re(k);
4250
+ } = Hy(), Ce = Ee(k);
4252
4251
  St(() => {
4253
4252
  Ce.current = k;
4254
4253
  }, [k]);
4255
- const Xe = Re(!1), st = Re([]), Qe = Re(null), Je = Re(null), qe = Re(/* @__PURE__ */ new Map()), et = Re(k), Mt = Re(!1), kt = Re(null), tt = Re(/* @__PURE__ */ new Map()), vt = Re(/* @__PURE__ */ new Map()), {
4254
+ const Xe = Ee(!1), st = Ee([]), Qe = Ee(null), Je = Ee(null), qe = Ee(/* @__PURE__ */ new Map()), et = Ee(k), Mt = Ee(!1), kt = Ee(null), tt = Ee(/* @__PURE__ */ new Map()), vt = Ee(/* @__PURE__ */ new Map()), {
4256
4255
  threadCheckpoints: At,
4257
4256
  syncActiveThreadCheckpoints: it,
4258
4257
  updateCheckpointCache: Yt,
@@ -4262,37 +4261,37 @@ function vv({
4262
4261
  resetThreadCheckpoints: ft,
4263
4262
  getSnapshotCache: Ve,
4264
4263
  getSnapshotFromCache: Dt
4265
- } = xv({ currentThreadId: k, currentThreadIdRef: Ce }), Pt = de(() => {
4264
+ } = lv({ currentThreadId: k, currentThreadIdRef: Ce }), Pt = de(() => {
4266
4265
  var K;
4267
- const E = vt.current;
4268
- if (E.size <= Fc) return;
4269
- const I = Array.from(E.entries()).sort((he, le) => he[1].timestamp - le[1].timestamp), U = E.size - Fc;
4266
+ const R = vt.current;
4267
+ if (R.size <= Bc) return;
4268
+ const I = Array.from(R.entries()).sort((he, le) => he[1].timestamp - le[1].timestamp), U = R.size - Bc;
4270
4269
  for (let he = 0; he < U; he++) {
4271
4270
  const le = (K = I[he]) == null ? void 0 : K[0];
4272
- le && E.delete(le);
4271
+ le && R.delete(le);
4273
4272
  }
4274
4273
  }, []), G = de(
4275
- (E, I) => {
4276
- if (!E)
4274
+ (R, I) => {
4275
+ if (!R)
4277
4276
  return null;
4278
- const U = Array.isArray(E.checkpoints) ? E.checkpoints : [];
4277
+ const U = Array.isArray(R.checkpoints) ? R.checkpoints : [];
4279
4278
  return U.length === 0 ? null : {
4280
- version: E.version === qi ? E.version : qi,
4281
- threadId: E.threadId ?? I,
4279
+ version: R.version === Ji ? R.version : Ji,
4280
+ threadId: R.threadId ?? I,
4282
4281
  checkpoints: U
4283
4282
  };
4284
4283
  },
4285
4284
  []
4286
- ), Ee = de(
4287
- (E, I) => {
4288
- const { threadId: U, checkpointId: K = null, checkpointNs: he = null } = E, le = Bc(U, K, he);
4285
+ ), Re = de(
4286
+ (R, I) => {
4287
+ const { threadId: U, checkpointId: K = null, checkpointNs: he = null } = R, le = zc(U, K, he);
4289
4288
  if (I != null && I.force)
4290
4289
  tt.current.delete(le), vt.current.delete(le);
4291
4290
  else {
4292
4291
  if (I != null && I.preferCache) {
4293
- const Rt = vt.current.get(le);
4294
- if (Rt)
4295
- return Promise.resolve(Rt.result);
4292
+ const Et = vt.current.get(le);
4293
+ if (Et)
4294
+ return Promise.resolve(Et.result);
4296
4295
  }
4297
4296
  const Be = tt.current.get(le);
4298
4297
  if (Be)
@@ -4304,22 +4303,22 @@ function vv({
4304
4303
  threadId: U,
4305
4304
  checkpointId: K ?? void 0,
4306
4305
  checkpointNs: he ?? void 0
4307
- }), Rt = G(Be, U);
4308
- if (Rt)
4309
- return { payload: Rt, usedHistoryApi: !0 };
4306
+ }), Et = G(Be, U);
4307
+ if (Et)
4308
+ return { payload: Et, usedHistoryApi: !0 };
4310
4309
  throw new Error("History response missing checkpoints");
4311
4310
  } catch (Be) {
4312
4311
  console.warn("[ChatSessionProvider] getStateHistory failed, falling back to getState:", Be);
4313
- const Rt = await c.getState({
4312
+ const Et = await c.getState({
4314
4313
  threadId: U,
4315
4314
  checkpointId: K ?? void 0,
4316
4315
  checkpointNs: he ?? void 0
4317
4316
  });
4318
4317
  return {
4319
4318
  payload: {
4320
- version: qi,
4319
+ version: Ji,
4321
4320
  threadId: U,
4322
- checkpoints: [Rt]
4321
+ checkpoints: [Et]
4323
4322
  },
4324
4323
  usedHistoryApi: !1
4325
4324
  };
@@ -4330,11 +4329,11 @@ function vv({
4330
4329
  return tt.current.set(le, bt), bt;
4331
4330
  },
4332
4331
  [c, G, Pt]
4333
- ), ve = de((E, I) => new Promise((U, K) => {
4332
+ ), ve = de((R, I) => new Promise((U, K) => {
4334
4333
  const he = async () => {
4335
4334
  Xe.current = !0;
4336
4335
  try {
4337
- await E(), U();
4336
+ await R(), U();
4338
4337
  } catch (le) {
4339
4338
  K(le);
4340
4339
  } finally {
@@ -4347,52 +4346,52 @@ function vv({
4347
4346
  Xe.current ? st.current.push(he) : he().catch((le) => {
4348
4347
  K(le);
4349
4348
  });
4350
- }), []), gt = Re(b.length), xt = Re(!1);
4349
+ }), []), gt = Ee(b.length), xt = Ee(!1);
4351
4350
  St(() => {
4352
4351
  gt.current = b.length;
4353
4352
  }, [b.length]), St(() => {
4354
- const E = H.pendingInterrupt ?? ov(H.messages);
4355
- zc(W, E) || F(E ?? null);
4353
+ const R = H.pendingInterrupt ?? ev(H.messages);
4354
+ $c(W, R) || F(R ?? null);
4356
4355
  }, [W, H.messages, H.pendingInterrupt]);
4357
4356
  const dt = de(async () => {
4358
- const E = gt.current > 0;
4359
- E || _(!0);
4357
+ const R = gt.current > 0;
4358
+ R || _(!0);
4360
4359
  try {
4361
4360
  const I = await c.listThreads();
4362
4361
  es(() => {
4363
4362
  C((U) => {
4364
- const K = (ht) => ht.map((bt) => `${bt.threadId}:${bt.updatedAt ?? ""}:${bt.messageCount ?? ""}`).join("|"), he = Ji(U);
4363
+ const K = (ht) => ht.map((bt) => `${bt.threadId}:${bt.updatedAt ?? ""}:${bt.messageCount ?? ""}`).join("|"), he = Xi(U);
4365
4364
  return K(he) === K(I) || I.length === 0 && he.length > 0 && !xt.current ? U : os(I);
4366
4365
  });
4367
4366
  }), P(null), xt.current || (xt.current = !0);
4368
4367
  } catch (I) {
4369
4368
  i == null || i(String(I)), console.error("[ChatSessionProvider] Failed to refresh threads:", I), P(String(I));
4370
4369
  } finally {
4371
- E || _(!1);
4370
+ R || _(!1);
4372
4371
  }
4373
- }, [c, i]), Me = Re(!1), Kt = Re(null), Le = Re(null), wt = Re(""), [jn, Lt] = we("idle"), un = Re({
4372
+ }, [c, i]), Me = Ee(!1), Kt = Ee(null), Le = Ee(null), wt = Ee(""), [jn, Lt] = we("idle"), un = Ee({
4374
4373
  attempts: 0,
4375
4374
  timer: null,
4376
4375
  reason: null
4377
- }), Ur = Re(null), Wr = Re(0), br = Re(() => {
4378
- }), Sr = Re(() => {
4379
- }), R = Re(() => {
4380
- }), Y = (E) => {
4381
- if (!E || typeof E != "object") return !1;
4382
- const I = E;
4376
+ }), Ur = Ee(null), Wr = Ee(0), br = Ee(() => {
4377
+ }), Sr = Ee(() => {
4378
+ }), E = Ee(() => {
4379
+ }), Y = (R) => {
4380
+ if (!R || typeof R != "object") return !1;
4381
+ const I = R;
4383
4382
  return I.code === "ECONNABORTED" ? !0 : (typeof I.message == "string" ? I.message.toLowerCase() : "").includes("timeout");
4384
4383
  }, ae = de(
4385
- async (E) => {
4386
- const I = await c.listCheckpointSummaries(E);
4384
+ async (R) => {
4385
+ const I = await c.listCheckpointSummaries(R);
4387
4386
  return _d(I ?? []);
4388
4387
  },
4389
4388
  [c]
4390
4389
  ), Te = de(
4391
- (E, I) => {
4390
+ (R, I) => {
4392
4391
  if (!jr()) return;
4393
4392
  Le.current !== null && (window.clearTimeout(Le.current), Le.current = null);
4394
- const U = E.map((he) => `${he.threadId}:${he.updatedAt ?? ""}:${he.messageCount ?? ""}`).join("|");
4395
- if (E.length === 0) {
4393
+ const U = R.map((he) => `${he.threadId}:${he.updatedAt ?? ""}:${he.messageCount ?? ""}`).join("|");
4394
+ if (R.length === 0) {
4396
4395
  try {
4397
4396
  Ia(w);
4398
4397
  } catch {
@@ -4404,7 +4403,7 @@ function vv({
4404
4403
  return;
4405
4404
  const K = () => {
4406
4405
  try {
4407
- const he = E.slice(0, Na);
4406
+ const he = R.slice(0, Na);
4408
4407
  Aa(w, he), wt.current = U;
4409
4408
  } catch {
4410
4409
  } finally {
@@ -4416,24 +4415,24 @@ function vv({
4416
4415
  return;
4417
4416
  }
4418
4417
  Le.current = window.setTimeout(() => {
4419
- $c(K);
4418
+ Fc(K);
4420
4419
  }, bs);
4421
4420
  },
4422
4421
  [w]
4423
4422
  ), Ye = de(() => {
4424
4423
  Te(b, { immediate: !0 });
4425
4424
  }, [Te, b]), Ge = de(
4426
- (E, I, U, K) => {
4425
+ (R, I, U, K) => {
4427
4426
  var Fi;
4428
4427
  const he = U ?? Ce.current;
4429
4428
  if (!he)
4430
4429
  return;
4431
- const le = hn(E), ht = he === Ce.current, bt = (K == null ? void 0 : K.persist) !== !1;
4430
+ const le = hn(R), ht = he === Ce.current, bt = (K == null ? void 0 : K.persist) !== !1;
4432
4431
  if (I === "replace") {
4433
4432
  if (bt) {
4434
4433
  const Gt = {
4435
4434
  threadId: he,
4436
- snapshot: hn(E, { cloneMessages: !0 })
4435
+ snapshot: hn(R, { cloneMessages: !0 })
4437
4436
  };
4438
4437
  qe.current.set(he, Gt), et.current = he;
4439
4438
  }
@@ -4446,7 +4445,7 @@ function vv({
4446
4445
  }), F(le.interrupt ?? null), ue(le.nextCursor ?? null), Q(!!le.nextCursor), ee(le.checkpointId ?? void 0), q(le.checkpointNs ?? void 0), ce(le.nextCursorNs ?? void 0);
4447
4446
  return;
4448
4447
  }
4449
- const Be = qe.current.get(he), Rt = (Be == null ? void 0 : Be.snapshot) ?? null, Wt = Array.isArray(Rt == null ? void 0 : Rt.messages) ? Rt.messages : [], fn = hn(Rt), Wn = Array.isArray(E == null ? void 0 : E.messages) ? E.messages : [], qt = /* @__PURE__ */ new Set(), Ot = [...Wn, ...Wt].filter((Gt) => {
4448
+ const Be = qe.current.get(he), Et = (Be == null ? void 0 : Be.snapshot) ?? null, Wt = Array.isArray(Et == null ? void 0 : Et.messages) ? Et.messages : [], fn = hn(Et), Wn = Array.isArray(R == null ? void 0 : R.messages) ? R.messages : [], qt = /* @__PURE__ */ new Set(), Ot = [...Wn, ...Wt].filter((Gt) => {
4450
4449
  const $i = Gt == null ? void 0 : Gt.id;
4451
4450
  return $i ? qt.has($i) ? !1 : (qt.add($i), !0) : !0;
4452
4451
  }), tr = Ad(fn, le), Cr = {
@@ -4470,7 +4469,7 @@ function vv({
4470
4469
  }), !ht)
4471
4470
  return;
4472
4471
  Wn.length && ye(Wn);
4473
- const Vr = E && Object.prototype.hasOwnProperty.call(E, "checkpointId") ? E.checkpointId : void 0, Cn = E && Object.prototype.hasOwnProperty.call(E, "checkpointNs") ? E.checkpointNs : void 0, Tr = E && Object.prototype.hasOwnProperty.call(E, "nextCursor") ? E.nextCursor : void 0, lr = E && Object.prototype.hasOwnProperty.call(E, "nextCursorNs") ? E.nextCursorNs : void 0;
4472
+ const Vr = R && Object.prototype.hasOwnProperty.call(R, "checkpointId") ? R.checkpointId : void 0, Cn = R && Object.prototype.hasOwnProperty.call(R, "checkpointNs") ? R.checkpointNs : void 0, Tr = R && Object.prototype.hasOwnProperty.call(R, "nextCursor") ? R.nextCursor : void 0, lr = R && Object.prototype.hasOwnProperty.call(R, "nextCursorNs") ? R.nextCursorNs : void 0;
4474
4473
  ue(
4475
4474
  (Gt) => Tr !== void 0 ? Tr ?? Gt ?? null : Gt ?? null
4476
4475
  ), Q(
@@ -4485,49 +4484,49 @@ function vv({
4485
4484
  },
4486
4485
  [ye, re, F]
4487
4486
  ), Ue = de(
4488
- (E) => {
4489
- if (E.threadId != null && E.threadId !== Ce.current)
4487
+ (R) => {
4488
+ if (R.threadId != null && R.threadId !== Ce.current)
4490
4489
  return;
4491
- const I = hn(E.snapshot, { cloneMessages: !0 });
4490
+ const I = hn(R.snapshot, { cloneMessages: !0 });
4492
4491
  re(I.messages, {
4493
4492
  checkpointId: I.checkpointId ?? null,
4494
4493
  checkpointNs: I.checkpointNs ?? null,
4495
4494
  pendingInterrupt: I.interrupt ?? null
4496
- }), F(I.interrupt ?? null), ue(I.nextCursor ?? null), Q(!!I.nextCursor), ee(I.checkpointId ?? void 0), q(I.checkpointNs ?? void 0), ce(I.nextCursorNs ?? void 0), et.current = E.threadId, it(E.threadId ?? Ce.current ?? null);
4495
+ }), F(I.interrupt ?? null), ue(I.nextCursor ?? null), Q(!!I.nextCursor), ee(I.checkpointId ?? void 0), q(I.checkpointNs ?? void 0), ce(I.nextCursorNs ?? void 0), et.current = R.threadId, it(R.threadId ?? Ce.current ?? null);
4497
4496
  },
4498
4497
  [re, F, it]
4499
- ), Oe = de((E) => {
4500
- if (!E) return;
4501
- qe.current.delete(E), x(E), Zt(E);
4502
- const I = `${E}__`;
4498
+ ), Oe = de((R) => {
4499
+ if (!R) return;
4500
+ qe.current.delete(R), x(R), Zt(R);
4501
+ const I = `${R}__`;
4503
4502
  for (const U of tt.current.keys())
4504
4503
  U.startsWith(I) && tt.current.delete(U);
4505
4504
  for (const U of vt.current.keys())
4506
4505
  U.startsWith(I) && vt.current.delete(U);
4507
- et.current === E && (et.current = null);
4506
+ et.current === R && (et.current = null);
4508
4507
  }, [Zt, x]), _t = de(() => {
4509
- const E = Ce.current;
4510
- E && Oe(E), ot([]), Q(!1), _e(!1), ue(null), ee(void 0), q(void 0), ce(void 0);
4511
- }, [Oe, ot]), yt = de(({ from: E, to: I }) => {
4508
+ const R = Ce.current;
4509
+ R && Oe(R), ot([]), Q(!1), _e(!1), ue(null), ee(void 0), q(void 0), ce(void 0);
4510
+ }, [Oe, ot]), yt = de(({ from: R, to: I }) => {
4512
4511
  const U = Ce.current;
4513
4512
  U && console.warn(
4514
- `[ChatSessionProvider] Stream sequence gap detected (${E} -> ${I}) for thread ${U}`
4513
+ `[ChatSessionProvider] Stream sequence gap detected (${R} -> ${I}) for thread ${U}`
4515
4514
  );
4516
- }, []), Et = de(
4517
- (E) => {
4518
- const I = E.threadId;
4515
+ }, []), Rt = de(
4516
+ (R) => {
4517
+ const I = R.threadId;
4519
4518
  console.log("[ChatSessionProvider] 📥 Handling thread_info event:", {
4520
4519
  threadId: I,
4521
- title: E.title,
4522
- created: E.created,
4520
+ title: R.title,
4521
+ created: R.created,
4523
4522
  currentThreads: b.length
4524
4523
  });
4525
4524
  const U = {
4526
4525
  threadId: I,
4527
- title: E.title || `Thread ${I.slice(0, 8)}`,
4528
- createdAt: E.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
4529
- updatedAt: E.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
4530
- messageCount: E.messageCount || 0
4526
+ title: R.title || `Thread ${I.slice(0, 8)}`,
4527
+ createdAt: R.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
4528
+ updatedAt: R.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
4529
+ messageCount: R.messageCount || 0
4531
4530
  };
4532
4531
  Ce.current !== I && (!Ce.current && H.messages.length <= 1 && (Je.current = I), A(I)), es(() => {
4533
4532
  C((K) => {
@@ -4545,28 +4544,28 @@ function vv({
4545
4544
  [H.messages.length]
4546
4545
  ), { startStream: Qt, stop: Pn, isStreaming: dn, error: Ht, setAuthToken: On, replayBufferedEvents: Z } = Xy({
4547
4546
  baseUrl: f,
4548
- onThreadInfo: Et,
4547
+ onThreadInfo: Rt,
4549
4548
  onMessageEvent: $e,
4550
- onUnhandledEvent: (E) => {
4551
- console.warn(`[ChatSessionProvider] Unhandled stream event: ${E.type}`, E);
4549
+ onUnhandledEvent: (R) => {
4550
+ console.warn(`[ChatSessionProvider] Unhandled stream event: ${R.type}`, R);
4552
4551
  },
4553
4552
  onSequenceGap: yt,
4554
- onStreamClosed: (E) => {
4555
- br.current(E);
4553
+ onStreamClosed: (R) => {
4554
+ br.current(R);
4556
4555
  },
4557
- onConnectionError: (E) => {
4558
- Sr.current(E);
4556
+ onConnectionError: (R) => {
4557
+ Sr.current(R);
4559
4558
  },
4560
4559
  onAuthError: a,
4561
- onHeartbeat: (E) => {
4562
- R.current(E);
4560
+ onHeartbeat: (R) => {
4561
+ E.current(R);
4563
4562
  }
4564
4563
  }), se = de(() => {
4565
- const E = un.current;
4566
- E.timer !== null && (window.clearTimeout(E.timer), E.timer = null), E.reason = null;
4564
+ const R = un.current;
4565
+ R.timer !== null && (window.clearTimeout(R.timer), R.timer = null), R.reason = null;
4567
4566
  }, []), fe = de(
4568
- (E, I) => {
4569
- Lt("connecting"), Qt(E, {
4567
+ (R, I) => {
4568
+ Lt("connecting"), Qt(R, {
4570
4569
  onOpen: (U) => {
4571
4570
  var K;
4572
4571
  se(), un.current.attempts = 0, Lt("connected"), (K = I == null ? void 0 : I.onOpen) == null || K.call(I, U);
@@ -4582,7 +4581,7 @@ function vv({
4582
4581
  },
4583
4582
  onHeartbeat: (U) => {
4584
4583
  var K;
4585
- R.current(U), (K = I == null ? void 0 : I.onHeartbeat) == null || K.call(I, U);
4584
+ E.current(U), (K = I == null ? void 0 : I.onHeartbeat) == null || K.call(I, U);
4586
4585
  },
4587
4586
  onClosed: (U) => {
4588
4587
  var K;
@@ -4592,29 +4591,29 @@ function vv({
4592
4591
  },
4593
4592
  [se, yt, Lt, Qt]
4594
4593
  ), Ie = de(() => {
4595
- const E = Ce.current;
4596
- if (!E)
4594
+ const R = Ce.current;
4595
+ if (!R)
4597
4596
  return null;
4598
4597
  const I = Ur.current, U = H.lastCheckpointId ?? (I == null ? void 0 : I.lastCheckpointId) ?? null, K = H.lastCheckpointNs ?? (I == null ? void 0 : I.lastCheckpointNs) ?? null, he = {};
4599
4598
  return U && (he.checkpointId = U), K && (he.checkpointNs = K), {
4600
- threadId: E,
4599
+ threadId: R,
4601
4600
  checkpointId: U,
4602
4601
  checkpointNs: K,
4603
4602
  command: { kind: "resume", value: he }
4604
4603
  };
4605
4604
  }, [H.lastCheckpointId, H.lastCheckpointNs]), lt = de(
4606
- (E) => {
4605
+ (R) => {
4607
4606
  const I = un.current;
4608
4607
  if (I.timer !== null)
4609
4608
  return;
4610
- if (I.attempts >= Zy) {
4609
+ if (I.attempts >= mv) {
4611
4610
  Lt("error");
4612
4611
  return;
4613
4612
  }
4614
- I.attempts += 1, I.reason = E;
4613
+ I.attempts += 1, I.reason = R;
4615
4614
  const U = Math.min(
4616
- Qy * Math.pow(2, I.attempts - 1),
4617
- ev
4615
+ gv * Math.pow(2, I.attempts - 1),
4616
+ xv
4618
4617
  );
4619
4618
  Lt("reconnecting"), I.timer = window.setTimeout(() => {
4620
4619
  I.timer = null, I.reason = null;
@@ -4628,39 +4627,39 @@ function vv({
4628
4627
  },
4629
4628
  [Ie, Z, Lt, fe]
4630
4629
  ), Ze = de(
4631
- (E) => {
4630
+ (R) => {
4632
4631
  var I;
4633
- if (Ur.current = E, E.manualStop || E.reason === "complete") {
4632
+ if (Ur.current = R, R.manualStop || R.reason === "complete") {
4634
4633
  se(), un.current.attempts = 0, Lt("idle");
4635
4634
  return;
4636
4635
  }
4637
- if (E.error && (E.error.includes("token") || E.error.includes("401") || E.error.includes("unauthorized") || E.error.includes("Unauthorized") || E.error.includes("TOKEN_EXPIRED") || E.error.includes("auth_error"))) {
4638
- console.error("[ChatSessionProvider] Auth error detected:", E.error);
4636
+ if (R.error && (R.error.includes("token") || R.error.includes("401") || R.error.includes("unauthorized") || R.error.includes("Unauthorized") || R.error.includes("TOKEN_EXPIRED") || R.error.includes("auth_error"))) {
4637
+ console.error("[ChatSessionProvider] Auth error detected:", R.error);
4639
4638
  try {
4640
- a == null || a(E.error);
4639
+ a == null || a(R.error);
4641
4640
  } catch (K) {
4642
4641
  console.error("[ChatSessionProvider] Error in onAuthError handler:", K);
4643
4642
  }
4644
4643
  return;
4645
4644
  }
4646
- if (E.reason === "error" || E.reason === "aborted") {
4647
- if ((I = E.error) != null && I.includes("Stream idle timeout")) {
4645
+ if (R.reason === "error" || R.reason === "aborted") {
4646
+ if ((I = R.error) != null && I.includes("Stream idle timeout")) {
4648
4647
  console.warn("[ChatSessionProvider] Idle timeout - not scheduling resume (watchdog is generous)");
4649
4648
  return;
4650
4649
  }
4651
- lt(`closed:${E.reason}`);
4650
+ lt(`closed:${R.reason}`);
4652
4651
  }
4653
4652
  },
4654
4653
  [se, lt, Lt, a]
4655
4654
  ), at = de(
4656
- (E) => {
4657
- console.warn("[ChatSessionProvider] Stream connection error:", E), lt("connection-error");
4655
+ (R) => {
4656
+ console.warn("[ChatSessionProvider] Stream connection error:", R), lt("connection-error");
4658
4657
  },
4659
4658
  [lt]
4660
- ), Ut = de((E) => {
4659
+ ), Ut = de((R) => {
4661
4660
  Wr.current = Date.now(), Lt((I) => I === "reconnecting" ? "connected" : I);
4662
4661
  }, [Lt]);
4663
- br.current = Ze, Sr.current = at, R.current = Ut, St(() => () => {
4662
+ br.current = Ze, Sr.current = at, E.current = Ut, St(() => () => {
4664
4663
  se();
4665
4664
  }, [se]);
4666
4665
  const an = de(() => {
@@ -4671,7 +4670,7 @@ function vv({
4671
4670
  }, [dn]), St(() => {
4672
4671
  if (!jr()) return;
4673
4672
  Le.current !== null && (window.clearTimeout(Le.current), Le.current = null);
4674
- const E = b.map((U) => `${U.threadId}:${U.updatedAt ?? ""}:${U.messageCount ?? ""}`).join("|");
4673
+ const R = b.map((U) => `${U.threadId}:${U.updatedAt ?? ""}:${U.messageCount ?? ""}`).join("|");
4675
4674
  if (b.length === 0) {
4676
4675
  try {
4677
4676
  Ia(w);
@@ -4680,48 +4679,48 @@ function vv({
4680
4679
  wt.current = "";
4681
4680
  return;
4682
4681
  }
4683
- if (E === wt.current)
4682
+ if (R === wt.current)
4684
4683
  return;
4685
4684
  const I = () => {
4686
4685
  try {
4687
4686
  const U = b.slice(0, Na);
4688
- Aa(w, U), wt.current = E;
4687
+ Aa(w, U), wt.current = R;
4689
4688
  } catch {
4690
4689
  } finally {
4691
4690
  Le.current = null;
4692
4691
  }
4693
4692
  };
4694
4693
  return Le.current = window.setTimeout(() => {
4695
- $c(I), Le.current = null;
4694
+ Fc(I), Le.current = null;
4696
4695
  }, bs), () => {
4697
4696
  Le.current !== null && (window.clearTimeout(Le.current), Le.current = null);
4698
4697
  };
4699
4698
  }, [b, Te]), St(() => {
4700
4699
  var K;
4701
- const E = c.getAuthToken();
4702
- On(E);
4700
+ const R = c.getAuthToken();
4701
+ On(R);
4703
4702
  const I = (he) => {
4704
- const le = Yi(h, he);
4703
+ const le = Gi(h, he);
4705
4704
  kt.current !== le && (kt.current = le, Mt.current = !1), S(le);
4706
- const ht = Xi(le);
4705
+ const ht = Yi(le);
4707
4706
  es(() => {
4708
4707
  C(os(ht));
4709
4708
  }), he && !Mt.current && (Mt.current = !0);
4710
4709
  };
4711
- I(E);
4710
+ I(R);
4712
4711
  const U = (K = c.onTokenChange) == null ? void 0 : K.call(c, (he) => {
4713
- he !== E && (On(he), y(), tt.current.clear(), vt.current.clear(), I(he));
4712
+ he !== R && (On(he), y(), tt.current.clear(), vt.current.clear(), I(he));
4714
4713
  });
4715
4714
  return () => {
4716
4715
  U == null || U();
4717
4716
  };
4718
4717
  }, [c, h, On, y]);
4719
4718
  const Un = de(
4720
- async (E) => {
4719
+ async (R) => {
4721
4720
  var K;
4722
4721
  const I = `Thread ${(K = crypto.randomUUID) == null ? void 0 : K.call(crypto)}`, U = {
4723
4722
  threadId: I,
4724
- title: E || "New Chat",
4723
+ title: R || "New Chat",
4725
4724
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
4726
4725
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
4727
4726
  messageCount: 0
@@ -4731,14 +4730,14 @@ function vv({
4731
4730
  order: [I, ...he.order]
4732
4731
  })), A(I);
4733
4732
  try {
4734
- const he = await c.createThread(E), le = typeof he == "string" ? he : he.threadId;
4733
+ const he = await c.createThread(R), le = typeof he == "string" ? he : he.threadId;
4735
4734
  return C((ht) => {
4736
4735
  const bt = ht.byId[I];
4737
4736
  if (!bt) return ht;
4738
4737
  const Be = { ...ht.byId };
4739
4738
  delete Be[I], Be[le] = { ...bt, threadId: le };
4740
- const Rt = ht.order.map((Wt) => Wt === I ? le : Wt);
4741
- return { byId: Be, order: Rt };
4739
+ const Et = ht.order.map((Wt) => Wt === I ? le : Wt);
4740
+ return { byId: Be, order: Et };
4742
4741
  }), A(le), setTimeout(() => dt(), 10), P(null), le;
4743
4742
  } catch (he) {
4744
4743
  throw C((le) => {
@@ -4752,29 +4751,29 @@ function vv({
4752
4751
  },
4753
4752
  [c, dt]
4754
4753
  ), po = de(
4755
- async (E) => {
4754
+ async (R) => {
4756
4755
  try {
4757
- await c.deleteThread(E);
4756
+ await c.deleteThread(R);
4758
4757
  let I = null;
4759
4758
  C((U) => {
4760
- if (!U.byId[E]) return U;
4759
+ if (!U.byId[R]) return U;
4761
4760
  const K = { ...U.byId };
4762
- delete K[E];
4763
- const he = U.order.filter((ht) => ht !== E), le = { byId: K, order: he };
4764
- return I = Ji(le), le;
4765
- }), I && Te(I, { immediate: !0 }), Oe(E), Ce.current === E && (Je.current = E, A(null), Ce.current = null, et.current = null, _t()), await dt(), P(null);
4761
+ delete K[R];
4762
+ const he = U.order.filter((ht) => ht !== R), le = { byId: K, order: he };
4763
+ return I = Xi(le), le;
4764
+ }), I && Te(I, { immediate: !0 }), Oe(R), Ce.current === R && (Je.current = R, A(null), Ce.current = null, et.current = null, _t()), await dt(), P(null);
4766
4765
  } catch (I) {
4767
4766
  throw P(String(I)), I;
4768
4767
  }
4769
4768
  },
4770
4769
  [c, _t, Oe, dt, Te]
4771
4770
  ), Zo = de(
4772
- async (E, I) => {
4771
+ async (R, I) => {
4773
4772
  try {
4774
- await c.updateThread(E, I), C((U) => {
4775
- const K = U.byId[E];
4773
+ await c.updateThread(R, I), C((U) => {
4774
+ const K = U.byId[R];
4776
4775
  return K ? {
4777
- byId: { ...U.byId, [E]: { ...K, title: I } },
4776
+ byId: { ...U.byId, [R]: { ...K, title: I } },
4778
4777
  order: U.order
4779
4778
  } : U;
4780
4779
  }), P(null);
@@ -4784,46 +4783,46 @@ function vv({
4784
4783
  },
4785
4784
  [c, dt]
4786
4785
  ), Sn = de(
4787
- async (E, I, U, K = !1) => {
4786
+ async (R, I, U, K = !1) => {
4788
4787
  await ve(async () => {
4789
- if (Je.current === E && !K) {
4788
+ if (Je.current === R && !K) {
4790
4789
  Je.current = null;
4791
4790
  return;
4792
4791
  }
4793
- if (Qe.current === E && !K)
4792
+ if (Qe.current === R && !K)
4794
4793
  return;
4795
- A((qt) => qt === E ? qt : E), Ce.current = E;
4796
- const ht = Bc(
4797
- E,
4794
+ A((qt) => qt === R ? qt : R), Ce.current = R;
4795
+ const ht = zc(
4796
+ R,
4798
4797
  I ?? null,
4799
4798
  U ?? null
4800
- ), bt = vt.current.get(ht), Be = !K && !I && !U && bt && Date.now() - bt.timestamp < Jy, Rt = !K && !I && !U;
4799
+ ), bt = vt.current.get(ht), Be = !K && !I && !U && bt && Date.now() - bt.timestamp < pv, Et = !K && !I && !U;
4801
4800
  let Wt = !1;
4802
- if (Rt) {
4803
- const qt = qe.current.get(E);
4801
+ if (Et) {
4802
+ const qt = qe.current.get(R);
4804
4803
  if (qt)
4805
4804
  Ue(qt), Wt = !0;
4806
4805
  else {
4807
- const Ot = m(E);
4808
- Ot && (qe.current.set(E, Ot), Ue(Ot), Wt = !0);
4806
+ const Ot = m(R);
4807
+ Ot && (qe.current.set(R, Ot), Ue(Ot), Wt = !0);
4809
4808
  }
4810
4809
  }
4811
4810
  const fn = K || !Wt || !!I || !!U, Wn = async (qt) => {
4812
- qt && $(!0), Qe.current = E;
4811
+ qt && $(!0), Qe.current = R;
4813
4812
  try {
4814
- const Ot = await Ee(
4815
- { threadId: E, checkpointId: I, checkpointNs: U },
4813
+ const Ot = await Re(
4814
+ { threadId: R, checkpointId: I, checkpointNs: U },
4816
4815
  { force: K }
4817
4816
  ), { latest: tr, checkpoints: Cr, snapshots: Vr } = Os(Ot.payload);
4818
- Ge(tr, "replace", E), Yt(E, Cr, "replace"), Xt(E, Vr, "replace"), j(null), Ot.usedHistoryApi || ae(E).then((Cn) => {
4819
- Jt(E, Cn);
4817
+ Ge(tr, "replace", R), Yt(R, Cr, "replace"), Xt(R, Vr, "replace"), j(null), Ot.usedHistoryApi || ae(R).then((Cn) => {
4818
+ Jt(R, Cn);
4820
4819
  }).catch((Cn) => {
4821
4820
  console.warn("[ChatSessionProvider] Failed to refresh checkpoint summaries:", Cn);
4822
4821
  });
4823
4822
  } catch (Ot) {
4824
4823
  if (Y(Ot))
4825
4824
  try {
4826
- const tr = await ae(E), Cr = Jt(E, tr);
4825
+ const tr = await ae(R), Cr = Jt(R, tr);
4827
4826
  if (Q(!1), ue(null), ce(void 0), ee(void 0), q(void 0), Cr) {
4828
4827
  j("History request timed out. Select a checkpoint to load manually.");
4829
4828
  return;
@@ -4836,10 +4835,10 @@ function vv({
4836
4835
  Qe.current = null, qt && $(!1);
4837
4836
  }
4838
4837
  };
4839
- fn ? await Wn(!0) : Rt && Wt && !Be && Wn(!1).catch((qt) => {
4838
+ fn ? await Wn(!0) : Et && Wt && !Be && Wn(!1).catch((qt) => {
4840
4839
  console.warn("[ChatSessionProvider] Background refresh failed:", qt);
4841
4840
  });
4842
- }, `loadThread-${E}`);
4841
+ }, `loadThread-${R}`);
4843
4842
  },
4844
4843
  [
4845
4844
  Ue,
@@ -4847,7 +4846,7 @@ function vv({
4847
4846
  Ge,
4848
4847
  ve,
4849
4848
  ae,
4850
- Ee,
4849
+ Re,
4851
4850
  Y,
4852
4851
  i,
4853
4852
  Yt,
@@ -4855,8 +4854,8 @@ function vv({
4855
4854
  ]
4856
4855
  ), Qo = de(async () => {
4857
4856
  await ve(async () => {
4858
- const E = Ce.current;
4859
- E && Oe(E), Je.current = null, A(null), Ce.current = null, et.current = null, _t(), ee(void 0), q(void 0), ce(void 0), ft();
4857
+ const R = Ce.current;
4858
+ R && Oe(R), Je.current = null, A(null), Ce.current = null, et.current = null, _t(), ee(void 0), q(void 0), ce(void 0), ft();
4860
4859
  try {
4861
4860
  localStorage.removeItem("lastThreadId");
4862
4861
  } catch (I) {
@@ -4864,17 +4863,17 @@ function vv({
4864
4863
  }
4865
4864
  }, "clearCurrentThread");
4866
4865
  }, [_t, Oe, ve, ft]), ec = de(
4867
- async (E, I) => {
4866
+ async (R, I) => {
4868
4867
  const U = Ce.current;
4869
4868
  if (!U) throw new Error("No active thread");
4870
- const K = Xr(E, I ?? null), he = Dt(U, K);
4869
+ const K = Xr(R, I ?? null), he = Dt(U, K);
4871
4870
  if (he) {
4872
4871
  await ve(async () => {
4873
4872
  Ge(he, "replace", U, { persist: !1 });
4874
4873
  }, `navigateToCheckpoint-${U}-${K}`);
4875
4874
  return;
4876
4875
  }
4877
- await Sn(U, E, I ?? void 0, !0);
4876
+ await Sn(U, R, I ?? void 0, !0);
4878
4877
  },
4879
4878
  [Ge, ve, Dt, Sn]
4880
4879
  ), tc = de(async () => {
@@ -4884,21 +4883,21 @@ function vv({
4884
4883
  async () => {
4885
4884
  if (!Ce.current) throw new Error("No active thread");
4886
4885
  if (ge || !ne) return;
4887
- const E = J;
4888
- if (E) {
4886
+ const R = J;
4887
+ if (R) {
4889
4888
  _e(!0);
4890
4889
  try {
4891
- const I = Ce.current, U = await Ee({
4890
+ const I = Ce.current, U = await Re({
4892
4891
  threadId: I,
4893
- checkpointId: E ?? ke ?? null,
4892
+ checkpointId: R ?? ke ?? null,
4894
4893
  checkpointNs: ie ?? D ?? null
4895
4894
  }), { latest: K, checkpoints: he, snapshots: le } = Os(U.payload), ht = Ve(I);
4896
4895
  let bt = he.length > 0;
4897
4896
  if (bt && ht && ht.size > 0 && (bt = he.some((Be) => {
4898
4897
  if (!(Be != null && Be.checkpointId))
4899
4898
  return !1;
4900
- const Rt = Xr(Be.checkpointId, Be.checkpointNs ?? null);
4901
- return !ht.has(Rt);
4899
+ const Et = Xr(Be.checkpointId, Be.checkpointNs ?? null);
4900
+ return !ht.has(Et);
4902
4901
  })), !bt) {
4903
4902
  ue(null), ce(void 0), Q(!1), j(null);
4904
4903
  return;
@@ -4920,7 +4919,7 @@ function vv({
4920
4919
  },
4921
4920
  [
4922
4921
  Ge,
4923
- Ee,
4922
+ Re,
4924
4923
  Ve,
4925
4924
  ne,
4926
4925
  ke,
@@ -4934,35 +4933,35 @@ function vv({
4934
4933
  Xt
4935
4934
  ]
4936
4935
  ), rc = de(
4937
- (E) => {
4938
- if (E != null && E.threadId) {
4939
- if (E.checkpointId) {
4940
- const I = Xr(E.checkpointId, E.checkpointNs ?? null), U = hn(
4936
+ (R) => {
4937
+ if (R != null && R.threadId) {
4938
+ if (R.checkpointId) {
4939
+ const I = Xr(R.checkpointId, R.checkpointNs ?? null), U = hn(
4941
4940
  {
4942
- ...E,
4943
- interrupt: E.interrupt ?? null
4941
+ ...R,
4942
+ interrupt: R.interrupt ?? null
4944
4943
  },
4945
4944
  { cloneMessages: !0 }
4946
4945
  );
4947
- Xt(E.threadId, { [I]: U }, "prepend");
4946
+ Xt(R.threadId, { [I]: U }, "prepend");
4948
4947
  }
4949
- Ge(E, "replace", E.threadId);
4948
+ Ge(R, "replace", R.threadId);
4950
4949
  }
4951
4950
  },
4952
4951
  [Ge, Xt]
4953
4952
  ), mo = de(
4954
- async (E, I) => {
4953
+ async (R, I) => {
4955
4954
  var Tr;
4956
- const U = Ce.current, K = (E == null ? void 0 : E.text) ?? "", he = (E == null ? void 0 : E.attachments) ?? [], le = he.length ? he : (I == null ? void 0 : I.attachments) ?? [], ht = E == null ? void 0 : E.messageAdditionalKwargs, bt = {
4955
+ const U = Ce.current, K = (R == null ? void 0 : R.text) ?? "", he = (R == null ? void 0 : R.attachments) ?? [], le = he.length ? he : (I == null ? void 0 : I.attachments) ?? [], ht = R == null ? void 0 : R.messageAdditionalKwargs, bt = {
4957
4956
  ...(I == null ? void 0 : I.payloadExtras) ?? {},
4958
- ...(E == null ? void 0 : E.payload) ?? {}
4957
+ ...(R == null ? void 0 : R.payload) ?? {}
4959
4958
  };
4960
4959
  if (!U && !Object.keys(bt).length && le.length === 0 && !K.trim()) {
4961
4960
  console.warn("[ChatSessionProvider] Nothing to submit - skipping");
4962
4961
  return;
4963
4962
  }
4964
4963
  !U && !bt.messages && console.warn("[ChatSessionProvider] No thread ID - message will create new thread");
4965
- const { contentParts: Be, filesInfo: Rt } = await Cy(
4964
+ const { contentParts: Be, filesInfo: Et } = await Cy(
4966
4965
  c,
4967
4966
  le
4968
4967
  ), Wt = [...Be];
@@ -4981,7 +4980,7 @@ function vv({
4981
4980
  }), Wt.length > 0 && Pe(Ot);
4982
4981
  const tr = { ...Ot, content: Wt }, Cr = le.length > 0, Vr = {
4983
4982
  messages: Wt.length > 0 ? [tr] : [],
4984
- files_info: Rt,
4983
+ files_info: Et,
4985
4984
  ...o && Cr && s ? { active_agent: s } : {},
4986
4985
  ...bt
4987
4986
  }, Cn = {
@@ -5018,13 +5017,13 @@ function vv({
5018
5017
  fe
5019
5018
  ]
5020
5019
  ), oc = de(
5021
- async (E, I, U) => {
5020
+ async (R, I, U) => {
5022
5021
  if (!Ce.current)
5023
5022
  throw new Error("No active thread to handle interrupt");
5024
5023
  const he = I ? U ?? !0 : !1;
5025
5024
  try {
5026
5025
  try {
5027
- We({ type: "interrupt_response", payload: { interruptId: E } });
5026
+ We({ type: "interrupt_response", payload: { interruptId: R } });
5028
5027
  } catch (le) {
5029
5028
  console.warn("[ChatSessionProvider] optimistic interrupt_response dispatch failed:", le);
5030
5029
  }
@@ -5037,7 +5036,7 @@ function vv({
5037
5036
  }
5038
5037
  ), F(null);
5039
5038
  } catch (le) {
5040
- throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${E}:`, le), le;
5039
+ throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${R}:`, le), le;
5041
5040
  }
5042
5041
  },
5043
5042
  [We, H.lastCheckpointId, H.lastCheckpointNs, mo]
@@ -5046,33 +5045,28 @@ function vv({
5046
5045
  if (l == null || l(k), k)
5047
5046
  try {
5048
5047
  localStorage.setItem("lastThreadId", k);
5049
- } catch (E) {
5050
- console.warn("[ChatSessionProvider] Failed to persist lastThreadId:", E);
5048
+ } catch (R) {
5049
+ console.warn("[ChatSessionProvider] Failed to persist lastThreadId:", R);
5051
5050
  }
5052
5051
  }, [k, l]), St(() => ((async () => {
5053
5052
  try {
5054
- if (!r && !t)
5053
+ if (dt().catch((I) => {
5054
+ console.error("[ChatSessionProvider] Failed to refresh threads (background):", I), i == null || i(String(I));
5055
+ }), !r && !t)
5055
5056
  try {
5056
5057
  const I = localStorage.getItem("lastThreadId");
5057
5058
  I && (A(I), n && await Sn(I));
5058
5059
  } catch (I) {
5059
5060
  console.warn("[ChatSessionProvider] Failed to restore last thread:", I);
5060
5061
  }
5061
- else if (t && n)
5062
- await Sn(t);
5063
- else
5064
- try {
5065
- await dt();
5066
- } catch (I) {
5067
- console.error("[ChatSessionProvider] Failed to refresh threads (background):", I);
5068
- }
5062
+ else t && n && await Sn(t);
5069
5063
  } catch (I) {
5070
5064
  console.error("[ChatSessionProvider] Initialization failed:", I), i == null || i(String(I));
5071
5065
  }
5072
5066
  })(), () => {
5073
5067
  }), []), St(() => {
5074
- const E = Ce.current;
5075
- if (!E || et.current !== E) return;
5068
+ const R = Ce.current;
5069
+ if (!R || et.current !== R) return;
5076
5070
  H.messages.length && H.messages[H.messages.length - 1];
5077
5071
  const I = hn({
5078
5072
  checkpointId: H.lastCheckpointId ?? null,
@@ -5081,23 +5075,23 @@ function vv({
5081
5075
  nextCursor: J ?? null,
5082
5076
  nextCursorNs: ie ?? null,
5083
5077
  interrupt: H.pendingInterrupt ?? W ?? null
5084
- }), U = qe.current.get(E), K = U == null ? void 0 : U.snapshot, he = !K || K.messages.length !== I.messages.length || K.messages.some((Be, Rt) => {
5078
+ }), U = qe.current.get(R), K = U == null ? void 0 : U.snapshot, he = !K || K.messages.length !== I.messages.length || K.messages.some((Be, Et) => {
5085
5079
  var Wt;
5086
- return (Be == null ? void 0 : Be.id) !== ((Wt = I.messages[Rt]) == null ? void 0 : Wt.id);
5087
- }), le = ((K == null ? void 0 : K.checkpointId) ?? null) !== I.checkpointId || ((K == null ? void 0 : K.checkpointNs) ?? null) !== I.checkpointNs, ht = ((K == null ? void 0 : K.nextCursor) ?? null) !== I.nextCursor || ((K == null ? void 0 : K.nextCursorNs) ?? null) !== I.nextCursorNs, bt = !zc(
5080
+ return (Be == null ? void 0 : Be.id) !== ((Wt = I.messages[Et]) == null ? void 0 : Wt.id);
5081
+ }), le = ((K == null ? void 0 : K.checkpointId) ?? null) !== I.checkpointId || ((K == null ? void 0 : K.checkpointNs) ?? null) !== I.checkpointNs, ht = ((K == null ? void 0 : K.nextCursor) ?? null) !== I.nextCursor || ((K == null ? void 0 : K.nextCursorNs) ?? null) !== I.nextCursorNs, bt = !$c(
5088
5082
  (K == null ? void 0 : K.interrupt) ?? null,
5089
5083
  I.interrupt ?? null
5090
5084
  );
5091
5085
  if (he || le || ht || bt) {
5092
5086
  const Be = {
5093
- threadId: E,
5087
+ threadId: R,
5094
5088
  snapshot: I
5095
5089
  };
5096
- qe.current.set(E, Be), Kt.current && window.clearTimeout(Kt.current), Kt.current = window.setTimeout(() => {
5090
+ qe.current.set(R, Be), Kt.current && window.clearTimeout(Kt.current), Kt.current = window.setTimeout(() => {
5097
5091
  try {
5098
5092
  g(Be, 100);
5099
- } catch (Rt) {
5100
- console.warn("[ChatSessionProvider] Failed to persist thread payload:", Rt);
5093
+ } catch (Et) {
5094
+ console.warn("[ChatSessionProvider] Failed to persist thread payload:", Et);
5101
5095
  }
5102
5096
  }, bs);
5103
5097
  }
@@ -5141,9 +5135,9 @@ function vv({
5141
5135
  A
5142
5136
  ]
5143
5137
  ), sg = ct(() => {
5144
- const E = H.lastBranch ?? null, I = H.assemblingId ?? null, U = E || I ? {
5145
- branchLabel: (E == null ? void 0 : E.branchLabel) ?? null,
5146
- lastBranch: E,
5138
+ const R = H.lastBranch ?? null, I = H.assemblingId ?? null, U = R || I ? {
5139
+ branchLabel: (R == null ? void 0 : R.branchLabel) ?? null,
5140
+ lastBranch: R,
5147
5141
  assemblingMessageId: I
5148
5142
  } : null;
5149
5143
  return {
@@ -5512,7 +5506,7 @@ function kv(...e) {
5512
5506
  return n.scopeName = t.scopeName, n;
5513
5507
  }
5514
5508
  var tn = globalThis != null && globalThis.document ? v.useLayoutEffect : () => {
5515
- }, Ev = v[" useInsertionEffect ".trim().toString()] || tn;
5509
+ }, Rv = v[" useInsertionEffect ".trim().toString()] || tn;
5516
5510
  function ro({
5517
5511
  prop: e,
5518
5512
  defaultProp: t,
@@ -5520,7 +5514,7 @@ function ro({
5520
5514
  },
5521
5515
  caller: r
5522
5516
  }) {
5523
- const [o, s, i] = Rv({
5517
+ const [o, s, i] = Ev({
5524
5518
  defaultProp: t,
5525
5519
  onChange: n
5526
5520
  }), a = e !== void 0, l = a ? e : o;
@@ -5546,12 +5540,12 @@ function ro({
5546
5540
  );
5547
5541
  return [l, c];
5548
5542
  }
5549
- function Rv({
5543
+ function Ev({
5550
5544
  defaultProp: e,
5551
5545
  onChange: t
5552
5546
  }) {
5553
5547
  const [n, r] = v.useState(e), o = v.useRef(n), s = v.useRef(t);
5554
- return Ev(() => {
5548
+ return Rv(() => {
5555
5549
  s.current = t;
5556
5550
  }, [t]), v.useEffect(() => {
5557
5551
  var i;
@@ -6751,10 +6745,10 @@ function kw(e) {
6751
6745
  y: n.y * c.y - l.scrollTop * c.y + d.y + h.y
6752
6746
  };
6753
6747
  }
6754
- function Ew(e) {
6748
+ function Rw(e) {
6755
6749
  return Array.from(e.getClientRects());
6756
6750
  }
6757
- function Rw(e) {
6751
+ function Ew(e) {
6758
6752
  const t = Zn(e), n = pi(e), r = e.ownerDocument.body, o = yn(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), s = yn(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
6759
6753
  let i = -n.scrollLeft + mi(e);
6760
6754
  const a = -n.scrollTop;
@@ -6801,7 +6795,7 @@ function ru(e, t, n) {
6801
6795
  if (t === "viewport")
6802
6796
  r = Iw(e, n);
6803
6797
  else if (t === "document")
6804
- r = Rw(Zn(e));
6798
+ r = Ew(Zn(e));
6805
6799
  else if (Fn(t))
6806
6800
  r = Aw(t, n);
6807
6801
  else {
@@ -6934,7 +6928,7 @@ const Lw = {
6934
6928
  getClippingRect: jw,
6935
6929
  getOffsetParent: Gd,
6936
6930
  getElementRects: Mw,
6937
- getClientRects: Ew,
6931
+ getClientRects: Rw,
6938
6932
  getDimensions: Pw,
6939
6933
  getScale: Jr,
6940
6934
  isElement: Fn,
@@ -7702,7 +7696,7 @@ function yf(e, t = !1) {
7702
7696
  function kb(e, t) {
7703
7697
  return e.map((n, r) => e[(t + r) % e.length]);
7704
7698
  }
7705
- var Eb = mf, Rb = xf, Ib = function(e) {
7699
+ var Rb = mf, Eb = xf, Ib = function(e) {
7706
7700
  if (typeof document > "u")
7707
7701
  return null;
7708
7702
  var t = Array.isArray(e) ? e[0] : e;
@@ -8074,7 +8068,7 @@ var qr = Da ? { passive: !1 } : !1, e0 = function(e) {
8074
8068
  typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host);
8075
8069
  var o = kf(e, r);
8076
8070
  if (o) {
8077
- var s = Ef(e, r), i = s[1], a = s[2];
8071
+ var s = Rf(e, r), i = s[1], a = s[2];
8078
8072
  if (i > a)
8079
8073
  return !0;
8080
8074
  }
@@ -8097,7 +8091,7 @@ var qr = Da ? { passive: !1 } : !1, e0 = function(e) {
8097
8091
  ];
8098
8092
  }, kf = function(e, t) {
8099
8093
  return e === "v" ? t0(t) : n0(t);
8100
- }, Ef = function(e, t) {
8094
+ }, Rf = function(e, t) {
8101
8095
  return e === "v" ? r0(t) : o0(t);
8102
8096
  }, s0 = function(e, t) {
8103
8097
  return e === "h" && t === "rtl" ? -1 : 1;
@@ -8106,7 +8100,7 @@ var qr = Da ? { passive: !1 } : !1, e0 = function(e) {
8106
8100
  do {
8107
8101
  if (!a)
8108
8102
  break;
8109
- var p = Ef(e, a), m = p[0], g = p[1], x = p[2], y = g - x - s * m;
8103
+ var p = Rf(e, a), m = p[0], g = p[1], x = p[2], y = g - x - s * m;
8110
8104
  (m || y) && kf(e, a) && (f += y, h += m);
8111
8105
  var w = a.parentNode;
8112
8106
  a = w && w.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? w.host : w;
@@ -8222,7 +8216,7 @@ var vi = v.forwardRef(function(e, t) {
8222
8216
  return v.createElement(yi, qn({}, e, { ref: t, sideCar: f0 }));
8223
8217
  });
8224
8218
  vi.classNames = yi.classNames;
8225
- var La = ["Enter", " "], h0 = ["ArrowDown", "PageUp", "Home"], Rf = ["ArrowUp", "PageDown", "End"], p0 = [...h0, ...Rf], m0 = {
8219
+ var La = ["Enter", " "], h0 = ["ArrowDown", "PageUp", "Home"], Ef = ["ArrowUp", "PageDown", "End"], p0 = [...h0, ...Ef], m0 = {
8226
8220
  ltr: [...La, "ArrowRight"],
8227
8221
  rtl: [...La, "ArrowLeft"]
8228
8222
  }, g0 = {
@@ -8290,7 +8284,7 @@ var In = "MenuContent", [C0, kl] = Fr(In), Pf = v.forwardRef(
8290
8284
  const s = r.current;
8291
8285
  if (s) return Sl(s);
8292
8286
  }, []), /* @__PURE__ */ u.jsx(
8293
- El,
8287
+ Rl,
8294
8288
  {
8295
8289
  ...e,
8296
8290
  ref: o,
@@ -8309,7 +8303,7 @@ var In = "MenuContent", [C0, kl] = Fr(In), Pf = v.forwardRef(
8309
8303
  ), k0 = v.forwardRef((e, t) => {
8310
8304
  const n = $r(In, e.__scopeMenu);
8311
8305
  return /* @__PURE__ */ u.jsx(
8312
- El,
8306
+ Rl,
8313
8307
  {
8314
8308
  ...e,
8315
8309
  ref: t,
@@ -8319,7 +8313,7 @@ var In = "MenuContent", [C0, kl] = Fr(In), Pf = v.forwardRef(
8319
8313
  onDismiss: () => n.onOpenChange(!1)
8320
8314
  }
8321
8315
  );
8322
- }), E0 = to("MenuContent.ScrollLock"), El = v.forwardRef(
8316
+ }), R0 = to("MenuContent.ScrollLock"), Rl = v.forwardRef(
8323
8317
  (e, t) => {
8324
8318
  const {
8325
8319
  __scopeMenu: n,
@@ -8336,7 +8330,7 @@ var In = "MenuContent", [C0, kl] = Fr(In), Pf = v.forwardRef(
8336
8330
  onDismiss: p,
8337
8331
  disableOutsideScroll: m,
8338
8332
  ...g
8339
- } = e, x = $r(In, n), y = Go(In, n), w = wi(n), S = Nf(n), T = x0(n), [C, b] = v.useState(null), k = v.useRef(null), A = rt(t, k, x.onContentChange), N = v.useRef(0), _ = v.useRef(""), M = v.useRef(0), $ = v.useRef(null), z = v.useRef("right"), P = v.useRef(0), B = m ? vi : v.Fragment, j = m ? { as: E0, allowPinchZoom: !0 } : void 0, W = (L) => {
8333
+ } = e, x = $r(In, n), y = Go(In, n), w = wi(n), S = Nf(n), T = x0(n), [C, b] = v.useState(null), k = v.useRef(null), A = rt(t, k, x.onContentChange), N = v.useRef(0), _ = v.useRef(""), M = v.useRef(0), $ = v.useRef(null), z = v.useRef("right"), P = v.useRef(0), B = m ? vi : v.Fragment, j = m ? { as: R0, allowPinchZoom: !0 } : void 0, W = (L) => {
8340
8334
  var ee, D;
8341
8335
  const ne = _.current + L, Q = T().filter((q) => !q.disabled), ge = document.activeElement, _e = (ee = Q.find((q) => q.ref.current === ge)) == null ? void 0 : ee.textValue, J = Q.map((q) => q.textValue), ue = F0(J, ne, _e), ke = (D = Q.find((q) => q.textValue === ue)) == null ? void 0 : D.ref.current;
8342
8336
  (function q(ie) {
@@ -8397,7 +8391,7 @@ var In = "MenuContent", [C0, kl] = Fr(In), Pf = v.forwardRef(
8397
8391
  onInteractOutside: h,
8398
8392
  onDismiss: p,
8399
8393
  children: /* @__PURE__ */ u.jsx(
8400
- Eb,
8394
+ Rb,
8401
8395
  {
8402
8396
  asChild: !0,
8403
8397
  ...S,
@@ -8429,7 +8423,7 @@ var In = "MenuContent", [C0, kl] = Fr(In), Pf = v.forwardRef(
8429
8423
  if (L.target !== J || !p0.includes(L.key)) return;
8430
8424
  L.preventDefault();
8431
8425
  const ke = T().filter((ee) => !ee.disabled).map((ee) => ee.ref.current);
8432
- Rf.includes(L.key) && ke.reverse(), D0(ke);
8426
+ Ef.includes(L.key) && ke.reverse(), D0(ke);
8433
8427
  }),
8434
8428
  onBlur: xe(e.onBlur, (L) => {
8435
8429
  L.currentTarget.contains(L.target) || (window.clearTimeout(N.current), _.current = "");
@@ -8457,13 +8451,13 @@ var In = "MenuContent", [C0, kl] = Fr(In), Pf = v.forwardRef(
8457
8451
  }
8458
8452
  );
8459
8453
  Pf.displayName = In;
8460
- var R0 = "MenuGroup", Rl = v.forwardRef(
8454
+ var E0 = "MenuGroup", El = v.forwardRef(
8461
8455
  (e, t) => {
8462
8456
  const { __scopeMenu: n, ...r } = e;
8463
8457
  return /* @__PURE__ */ u.jsx(Fe.div, { role: "group", ...r, ref: t });
8464
8458
  }
8465
8459
  );
8466
- Rl.displayName = R0;
8460
+ El.displayName = E0;
8467
8461
  var I0 = "MenuLabel", Of = v.forwardRef(
8468
8462
  (e, t) => {
8469
8463
  const { __scopeMenu: n, ...r } = e;
@@ -8516,7 +8510,7 @@ var Mf = v.forwardRef(
8516
8510
  scope: n,
8517
8511
  disabled: r,
8518
8512
  textValue: o ?? h,
8519
- children: /* @__PURE__ */ u.jsx(Rb, { asChild: !0, ...a, focusable: !r, children: /* @__PURE__ */ u.jsx(
8513
+ children: /* @__PURE__ */ u.jsx(Eb, { asChild: !0, ...a, focusable: !r, children: /* @__PURE__ */ u.jsx(
8520
8514
  Fe.div,
8521
8515
  {
8522
8516
  role: "menuitem",
@@ -8570,7 +8564,7 @@ var Lf = "MenuRadioGroup", [A0, _0] = Fr(
8570
8564
  ), Ff = v.forwardRef(
8571
8565
  (e, t) => {
8572
8566
  const { value: n, onValueChange: r, ...o } = e, s = en(r);
8573
- return /* @__PURE__ */ u.jsx(A0, { scope: e.__scopeMenu, value: n, onValueChange: s, children: /* @__PURE__ */ u.jsx(Rl, { ...o, ref: t }) });
8567
+ return /* @__PURE__ */ u.jsx(A0, { scope: e.__scopeMenu, value: n, onValueChange: s, children: /* @__PURE__ */ u.jsx(El, { ...o, ref: t }) });
8574
8568
  }
8575
8569
  );
8576
8570
  Ff.displayName = Lf;
@@ -8643,7 +8637,7 @@ var O0 = "MenuArrow", Wf = v.forwardRef(
8643
8637
  }
8644
8638
  );
8645
8639
  Wf.displayName = O0;
8646
- var M0 = "MenuSub", [FE, Vf] = Fr(M0), vo = "MenuSubTrigger", Kf = v.forwardRef(
8640
+ var M0 = "MenuSub", [FR, Vf] = Fr(M0), vo = "MenuSubTrigger", Kf = v.forwardRef(
8647
8641
  (e, t) => {
8648
8642
  const n = $r(vo, e.__scopeMenu), r = Go(vo, e.__scopeMenu), o = Vf(vo, e.__scopeMenu), s = kl(vo, e.__scopeMenu), i = v.useRef(null), { pointerGraceTimerRef: a, onPointerGraceIntentChange: l } = s, c = { __scopeMenu: e.__scopeMenu }, d = v.useCallback(() => {
8649
8643
  i.current && window.clearTimeout(i.current), i.current = null;
@@ -8718,7 +8712,7 @@ var qf = "MenuSubContent", Gf = v.forwardRef(
8718
8712
  (e, t) => {
8719
8713
  const n = _f(In, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = $r(In, e.__scopeMenu), i = Go(In, e.__scopeMenu), a = Vf(qf, e.__scopeMenu), l = v.useRef(null), c = rt(t, l);
8720
8714
  return /* @__PURE__ */ u.jsx(_o.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ u.jsx(An, { present: r || s.open, children: /* @__PURE__ */ u.jsx(_o.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ u.jsx(
8721
- El,
8715
+ Rl,
8722
8716
  {
8723
8717
  id: a.contentId,
8724
8718
  "aria-labelledby": a.triggerId,
@@ -8793,7 +8787,7 @@ function z0(e, t) {
8793
8787
  function jo(e) {
8794
8788
  return (t) => t.pointerType === "mouse" ? e(t) : void 0;
8795
8789
  }
8796
- var B0 = Af, H0 = Cl, U0 = jf, W0 = Pf, V0 = Rl, K0 = Of, q0 = bi, G0 = Df, Y0 = Ff, X0 = zf, J0 = Hf, Z0 = Uf, Q0 = Wf, eS = Kf, tS = Gf, Si = "DropdownMenu", [nS, $E] = ar(
8790
+ var B0 = Af, H0 = Cl, U0 = jf, W0 = Pf, V0 = El, K0 = Of, q0 = bi, G0 = Df, Y0 = Ff, X0 = zf, J0 = Hf, Z0 = Uf, Q0 = Wf, eS = Kf, tS = Gf, Si = "DropdownMenu", [nS, $R] = ar(
8797
8791
  Si,
8798
8792
  [If]
8799
8793
  ), ln = If(), [rS, Xf] = nS(Si), Jf = (e) => {
@@ -9025,7 +9019,7 @@ const Fa = v.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */
9025
9019
  }
9026
9020
  ));
9027
9021
  Fa.displayName = hh.displayName;
9028
- const ES = v.forwardRef(({ className: e, children: t, checked: n, ...r }, o) => /* @__PURE__ */ u.jsxs(
9022
+ const RS = v.forwardRef(({ className: e, children: t, checked: n, ...r }, o) => /* @__PURE__ */ u.jsxs(
9029
9023
  ph,
9030
9024
  {
9031
9025
  ref: o,
@@ -9041,8 +9035,8 @@ const ES = v.forwardRef(({ className: e, children: t, checked: n, ...r }, o) =>
9041
9035
  ]
9042
9036
  }
9043
9037
  ));
9044
- ES.displayName = ph.displayName;
9045
- const RS = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ u.jsxs(
9038
+ RS.displayName = ph.displayName;
9039
+ const ES = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ u.jsxs(
9046
9040
  mh,
9047
9041
  {
9048
9042
  ref: r,
@@ -9057,7 +9051,7 @@ const RS = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
9057
9051
  ]
9058
9052
  }
9059
9053
  ));
9060
- RS.displayName = mh.displayName;
9054
+ ES.displayName = mh.displayName;
9061
9055
  const IS = v.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */ u.jsx(
9062
9056
  fh,
9063
9057
  {
@@ -9080,7 +9074,7 @@ const NS = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
9080
9074
  }
9081
9075
  ));
9082
9076
  NS.displayName = xh.displayName;
9083
- const Es = 1e4;
9077
+ const Rs = 1e4;
9084
9078
  function AS(e) {
9085
9079
  if (typeof e != "string")
9086
9080
  return String(e);
@@ -9108,7 +9102,7 @@ function AS(e) {
9108
9102
  `).replace(/<li>(.*?)<\/li>/gi, `- $1
9109
9103
  `).trim() : n.replace(/</g, "&lt;").replace(/>/g, "&gt;").trim();
9110
9104
  }
9111
- function _S(e, t = Es) {
9105
+ function _S(e, t = Rs) {
9112
9106
  if (!e || typeof e != "string")
9113
9107
  throw new Error("Invalid content: must be a non-empty string");
9114
9108
  if (e.length > t)
@@ -9588,13 +9582,13 @@ function za(e, t) {
9588
9582
  if (Ct(o))
9589
9583
  return r;
9590
9584
  {
9591
- const [s, i] = Rh(r);
9592
- return Rs(Vt(e, { k: s, l: Eh(r), v: i }));
9585
+ const [s, i] = Eh(r);
9586
+ return Es(Vt(e, { k: s, l: Rh(r), v: i }));
9593
9587
  }
9594
- } else return t < n ? Rs(Vt(e, { l: za(r, t) })) : Rs(Vt(e, { r: za(o, t) }));
9588
+ } else return t < n ? Es(Vt(e, { l: za(r, t) })) : Es(Vt(e, { r: za(o, t) }));
9595
9589
  }
9596
- function Rr(e) {
9597
- return Ct(e) ? [] : [...Rr(e.l), { k: e.k, v: e.v }, ...Rr(e.r)];
9590
+ function Er(e) {
9591
+ return Ct(e) ? [] : [...Er(e.l), { k: e.k, v: e.v }, ...Er(e.r)];
9598
9592
  }
9599
9593
  function Ba(e, t, n) {
9600
9594
  if (Ct(e))
@@ -9603,7 +9597,7 @@ function Ba(e, t, n) {
9603
9597
  let a = [];
9604
9598
  return r > t && (a = a.concat(Ba(o, t, n))), r >= t && r <= n && a.push({ k: r, v: i }), r <= n && (a = a.concat(Ba(s, t, n))), a;
9605
9599
  }
9606
- function Rs(e) {
9600
+ function Es(e) {
9607
9601
  const { l: t, lvl: n, r } = e;
9608
9602
  if (r.lvl >= n - 1 && t.lvl >= n - 1)
9609
9603
  return e;
@@ -9646,14 +9640,14 @@ function Vt(e, t) {
9646
9640
  t.r !== void 0 ? t.r : e.r
9647
9641
  );
9648
9642
  }
9649
- function Eh(e) {
9650
- return Ct(e.r) ? e.l : Rs(Vt(e, { r: Eh(e.r) }));
9643
+ function Rh(e) {
9644
+ return Ct(e.r) ? e.l : Es(Vt(e, { r: Rh(e.r) }));
9651
9645
  }
9652
9646
  function ca(e) {
9653
9647
  return Ct(e) || e.lvl > e.r.lvl;
9654
9648
  }
9655
- function Rh(e) {
9656
- return Ct(e.r) ? [e.k, e.v] : Rh(e.r);
9649
+ function Eh(e) {
9650
+ return Ct(e.r) ? [e.k, e.v] : Eh(e.r);
9657
9651
  }
9658
9652
  function Ih(e, t, n, r = Po, o = Po) {
9659
9653
  return { k: e, l: r, lvl: n, r: o, v: t };
@@ -9711,7 +9705,7 @@ function KS(e, t, n, r) {
9711
9705
  function hr(e, t) {
9712
9706
  return Math.round(e.getBoundingClientRect()[t]);
9713
9707
  }
9714
- function Ei(e) {
9708
+ function Ri(e) {
9715
9709
  return !Ct(e.groupOffsetTree);
9716
9710
  }
9717
9711
  function Ol({ index: e }, t) {
@@ -9759,7 +9753,7 @@ function Do(e, t, n) {
9759
9753
  return a > 0 ? a + n : a;
9760
9754
  }
9761
9755
  function jh(e, t) {
9762
- if (!Ei(t))
9756
+ if (!Ri(t))
9763
9757
  return e;
9764
9758
  let n = 0;
9765
9759
  for (; t.groupIndices[n] <= e + n; )
@@ -9801,7 +9795,7 @@ function ZS(e, [t, n, r, o]) {
9801
9795
  };
9802
9796
  }
9803
9797
  function QS(e) {
9804
- return Rr(e).map(({ k: t, v: n }, r, o) => {
9798
+ return Er(e).map(({ k: t, v: n }, r, o) => {
9805
9799
  const s = o[r + 1];
9806
9800
  return { endIndex: s ? s.k - 1 : 1 / 0, size: n, startIndex: t };
9807
9801
  });
@@ -9968,7 +9962,7 @@ const nC = {
9968
9962
  startIndex: P + 1
9969
9963
  }), $++, M += B + 1;
9970
9964
  }
9971
- const z = Rr(b.sizeTree);
9965
+ const z = Er(b.sizeTree);
9972
9966
  return M !== C && z.shift(), z.reduce(
9973
9967
  (P, { k: B, v: j }) => {
9974
9968
  let W = P.ranges;
@@ -9992,7 +9986,7 @@ const nC = {
9992
9986
  }
9993
9987
  ).ranges;
9994
9988
  }
9995
- return Rr(b.sizeTree).reduce(
9989
+ return Er(b.sizeTree).reduce(
9996
9990
  (_, { k: M, v: $ }) => ({
9997
9991
  prevIndex: M + C,
9998
9992
  prevSize: $,
@@ -10034,7 +10028,7 @@ const nC = {
10034
10028
  const z = N[M + 1] - $ - 1;
10035
10029
  M++, _ += z + 1;
10036
10030
  }
10037
- if (A = Rr(b.sizeTree).reduce((z, { k: P, v: B }) => vn(z, Math.max(0, P + C), B), A), _ !== -C) {
10031
+ if (A = Er(b.sizeTree).reduce((z, { k: P, v: B }) => vn(z, Math.max(0, P + C), B), A), _ !== -C) {
10038
10032
  const z = Oo(b.sizeTree, $);
10039
10033
  A = vn(A, 0, z);
10040
10034
  const P = zn(b.sizeTree, -C + 1)[1];
@@ -10046,7 +10040,7 @@ const nC = {
10046
10040
  ...Ua(b.offsetTree, 0, A, k)
10047
10041
  };
10048
10042
  } else {
10049
- const A = Rr(b.sizeTree).reduce((N, { k: _, v: M }) => vn(N, Math.max(0, _ + C), M), Qr());
10043
+ const A = Er(b.sizeTree).reduce((N, { k: _, v: M }) => vn(N, Math.max(0, _ + C), M), Qr());
10050
10044
  return {
10051
10045
  ...b,
10052
10046
  sizeTree: A,
@@ -10108,7 +10102,7 @@ const Oh = ut(
10108
10102
  ), be(
10109
10103
  X(
10110
10104
  Bt(o, t, r),
10111
- je(([l, c]) => Ei(c)),
10105
+ je(([l, c]) => Ri(c)),
10112
10106
  pe(([l, c, d]) => zn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
10113
10107
  It(),
10114
10108
  pe((l) => [l])
@@ -10470,7 +10464,7 @@ const Ll = ut(
10470
10464
  { singleton: !0 }
10471
10465
  );
10472
10466
  function cC(e, t, n) {
10473
- if (Ei(t)) {
10467
+ if (Ri(t)) {
10474
10468
  const r = jh(e, t);
10475
10469
  return [
10476
10470
  { index: zn(t.groupOffsetTree, r)[0], offset: 0, size: 0 },
@@ -10530,7 +10524,7 @@ function Lh(e, t, n, r, o, s) {
10530
10524
  function Su(e, t, n) {
10531
10525
  if (e.length === 0)
10532
10526
  return [];
10533
- if (!Ei(t))
10527
+ if (!Ri(t))
10534
10528
  return e.map((c) => ({ ...c, index: c.index + n, originalIndex: c.index }));
10535
10529
  const r = e[0].index, o = e[e.length - 1].index, s = [], i = ki(t.groupOffsetTree, r, o);
10536
10530
  let a, l = 0;
@@ -11448,8 +11442,8 @@ const TC = /* @__PURE__ */ ut(() => {
11448
11442
  }), kC = /* @__PURE__ */ ut(
11449
11443
  ([e, t]) => ({ ...e, ...t }),
11450
11444
  Nt(Uh, TC)
11451
- ), EC = ({ height: e }) => /* @__PURE__ */ u.jsx("div", { style: { height: e } }), RC = { overflowAnchor: "none", position: $l(), zIndex: 1 }, Yh = { overflowAnchor: "none" }, IC = { ...Yh, display: "inline-block", height: "100%" }, ku = /* @__PURE__ */ V.memo(function({ showTopList: e = !1 }) {
11452
- const t = De("listState"), n = En("sizeRanges"), r = De("useWindowScroll"), o = De("customScrollParent"), s = En("windowScrollContainerState"), i = En("scrollContainerState"), a = o || r ? s : i, l = De("itemContent"), c = De("context"), d = De("groupContent"), f = De("trackItemSizes"), h = De("itemSize"), p = De("log"), m = En("gap"), g = De("horizontalDirection"), { callbackRef: x } = US(
11445
+ ), RC = ({ height: e }) => /* @__PURE__ */ u.jsx("div", { style: { height: e } }), EC = { overflowAnchor: "none", position: $l(), zIndex: 1 }, Yh = { overflowAnchor: "none" }, IC = { ...Yh, display: "inline-block", height: "100%" }, ku = /* @__PURE__ */ V.memo(function({ showTopList: e = !1 }) {
11446
+ const t = De("listState"), n = Rn("sizeRanges"), r = De("useWindowScroll"), o = De("customScrollParent"), s = Rn("windowScrollContainerState"), i = Rn("scrollContainerState"), a = o || r ? s : i, l = De("itemContent"), c = De("context"), d = De("groupContent"), f = De("trackItemSizes"), h = De("itemSize"), p = De("log"), m = Rn("gap"), g = De("horizontalDirection"), { callbackRef: x } = US(
11453
11447
  n,
11454
11448
  h,
11455
11449
  f,
@@ -11463,7 +11457,7 @@ const TC = /* @__PURE__ */ ut(() => {
11463
11457
  Bl("deviation", (P) => {
11464
11458
  y !== P && w(P);
11465
11459
  });
11466
- const S = De("EmptyPlaceholder"), T = De("ScrollSeekPlaceholder") || EC, C = De("ListComponent"), b = De("ItemComponent"), k = De("GroupComponent"), A = De("computeItemKey"), N = De("isSeeking"), _ = De("groupIndices").length > 0, M = De("alignToBottom"), $ = De("initialItemFinalLocationReached"), z = e ? {} : {
11460
+ const S = De("EmptyPlaceholder"), T = De("ScrollSeekPlaceholder") || RC, C = De("ListComponent"), b = De("ItemComponent"), k = De("GroupComponent"), A = De("computeItemKey"), N = De("isSeeking"), _ = De("groupIndices").length > 0, M = De("alignToBottom"), $ = De("initialItemFinalLocationReached"), z = e ? {} : {
11467
11461
  boxSizing: "border-box",
11468
11462
  ...g ? {
11469
11463
  display: "inline-block",
@@ -11506,7 +11500,7 @@ const TC = /* @__PURE__ */ ut(() => {
11506
11500
  "data-item-index": P.index,
11507
11501
  "data-known-size": P.size,
11508
11502
  key: j,
11509
- style: RC
11503
+ style: EC
11510
11504
  },
11511
11505
  d(P.index, c)
11512
11506
  ) : /* @__PURE__ */ ms(
@@ -11536,7 +11530,7 @@ const TC = /* @__PURE__ */ ut(() => {
11536
11530
  outline: "none",
11537
11531
  overflowX: "auto",
11538
11532
  position: "relative"
11539
- }, Ri = (e) => ({
11533
+ }, Ei = (e) => ({
11540
11534
  height: "100%",
11541
11535
  position: "absolute",
11542
11536
  top: 0,
@@ -11556,7 +11550,7 @@ function jC(e, t) {
11556
11550
  return { item: typeof e == "string" ? void 0 : t };
11557
11551
  }
11558
11552
  const PC = /* @__PURE__ */ V.memo(function() {
11559
- const e = De("HeaderComponent"), t = En("headerHeight"), n = De("HeaderFooterTag"), r = zr(
11553
+ const e = De("HeaderComponent"), t = Rn("headerHeight"), n = De("HeaderFooterTag"), r = zr(
11560
11554
  V.useMemo(
11561
11555
  () => (s) => {
11562
11556
  t(hr(s, "height"));
@@ -11568,7 +11562,7 @@ const PC = /* @__PURE__ */ V.memo(function() {
11568
11562
  ), o = De("context");
11569
11563
  return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...on(e, o) }) }) : null;
11570
11564
  }), OC = /* @__PURE__ */ V.memo(function() {
11571
- const e = De("FooterComponent"), t = En("footerHeight"), n = De("HeaderFooterTag"), r = zr(
11565
+ const e = De("FooterComponent"), t = Rn("footerHeight"), n = De("HeaderFooterTag"), r = zr(
11572
11566
  V.useMemo(
11573
11567
  () => (s) => {
11574
11568
  t(hr(s, "height"));
@@ -11633,22 +11627,22 @@ function Jh({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
11633
11627
  });
11634
11628
  }
11635
11629
  const MC = ({ children: e }) => {
11636
- const t = V.useContext(Vh), n = En("viewportHeight"), r = En("fixedItemHeight"), o = De("alignToBottom"), s = De("horizontalDirection"), i = V.useMemo(
11630
+ const t = V.useContext(Vh), n = Rn("viewportHeight"), r = Rn("fixedItemHeight"), o = De("alignToBottom"), s = De("horizontalDirection"), i = V.useMemo(
11637
11631
  () => Sh(n, (l) => hr(l, s ? "width" : "height")),
11638
11632
  [n, s]
11639
11633
  ), a = zr(i, !0, De("skipAnimationFrameInResizeObserver"));
11640
11634
  return V.useEffect(() => {
11641
11635
  t && (n(t.viewportHeight), r(t.itemHeight));
11642
- }, [t, n, r]), /* @__PURE__ */ u.jsx("div", { "data-viewport-type": "element", ref: a, style: Ri(o), children: e });
11636
+ }, [t, n, r]), /* @__PURE__ */ u.jsx("div", { "data-viewport-type": "element", ref: a, style: Ei(o), children: e });
11643
11637
  }, DC = ({ children: e }) => {
11644
- const t = V.useContext(Vh), n = En("windowViewportRect"), r = En("fixedItemHeight"), o = De("customScrollParent"), s = Th(
11638
+ const t = V.useContext(Vh), n = Rn("windowViewportRect"), r = Rn("fixedItemHeight"), o = De("customScrollParent"), s = Th(
11645
11639
  n,
11646
11640
  o,
11647
11641
  De("skipAnimationFrameInResizeObserver")
11648
11642
  ), i = De("alignToBottom");
11649
11643
  return V.useEffect(() => {
11650
11644
  t && (r(t.itemHeight), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
11651
- }, [t, n, r]), /* @__PURE__ */ u.jsx("div", { "data-viewport-type": "window", ref: s, style: Ri(i), children: e });
11645
+ }, [t, n, r]), /* @__PURE__ */ u.jsx("div", { "data-viewport-type": "window", ref: s, style: Ei(i), children: e });
11652
11646
  }, LC = ({ children: e }) => {
11653
11647
  const t = De("TopItemListComponent") || "div", n = De("headerHeight"), r = { ..._C, marginTop: `${n}px` }, o = De("context");
11654
11648
  return /* @__PURE__ */ u.jsx(t, { style: r, ...on(t, o), children: e });
@@ -11666,7 +11660,7 @@ const MC = ({ children: e }) => {
11666
11660
  Component: $C,
11667
11661
  useEmitter: Bl,
11668
11662
  useEmitterValue: De,
11669
- usePublisher: En
11663
+ usePublisher: Rn
11670
11664
  } = /* @__PURE__ */ Wh(
11671
11665
  kC,
11672
11666
  {
@@ -11726,7 +11720,7 @@ const MC = ({ children: e }) => {
11726
11720
  }
11727
11721
  },
11728
11722
  FC
11729
- ), zC = /* @__PURE__ */ Xh({ useEmitter: Bl, useEmitterValue: De, usePublisher: En }), BC = /* @__PURE__ */ Jh({ useEmitter: Bl, useEmitterValue: De, usePublisher: En }), HC = $C, UC = /* @__PURE__ */ ut(() => {
11723
+ ), zC = /* @__PURE__ */ Xh({ useEmitter: Bl, useEmitterValue: De, usePublisher: Rn }), BC = /* @__PURE__ */ Jh({ useEmitter: Bl, useEmitterValue: De, usePublisher: Rn }), HC = $C, UC = /* @__PURE__ */ ut(() => {
11730
11724
  const e = te((c) => /* @__PURE__ */ u.jsxs("td", { children: [
11731
11725
  "Item $",
11732
11726
  c
@@ -11764,7 +11758,7 @@ const MC = ({ children: e }) => {
11764
11758
  });
11765
11759
  Nt(Uh, UC);
11766
11760
  $l();
11767
- const Eu = {
11761
+ const Ru = {
11768
11762
  bottom: 0,
11769
11763
  itemHeight: 0,
11770
11764
  items: [],
@@ -11780,7 +11774,7 @@ const Eu = {
11780
11774
  offsetBottom: 0,
11781
11775
  offsetTop: 0,
11782
11776
  top: 0
11783
- }, { ceil: Ru, floor: Ws, max: Co, min: ha, round: Iu } = Math;
11777
+ }, { ceil: Eu, floor: Ws, max: Co, min: ha, round: Iu } = Math;
11784
11778
  function Nu(e, t, n) {
11785
11779
  return Array.from({ length: t - e + 1 }).map((r, o) => ({ data: n === null ? null : n[o + e], index: o + e }));
11786
11780
  }
@@ -11806,7 +11800,7 @@ const qC = /* @__PURE__ */ ut(
11806
11800
  { customScrollParent: x, useWindowScroll: y, windowScrollContainerState: w, windowScrollTo: S, windowViewportRect: T },
11807
11801
  C
11808
11802
  ]) => {
11809
- const b = te(0), k = te(0), A = te(Eu), N = te({ height: 0, width: 0 }), _ = te({ height: 0, width: 0 }), M = nt(), $ = nt(), z = te(0), P = te(null), B = te({ column: 0, row: 0 }), j = nt(), W = nt(), F = te(!1), L = te(0), ne = te(!0), Q = te(!1), ge = te(!1);
11803
+ const b = te(0), k = te(0), A = te(Ru), N = te({ height: 0, width: 0 }), _ = te({ height: 0, width: 0 }), M = nt(), $ = nt(), z = te(0), P = te(null), B = te({ column: 0, row: 0 }), j = nt(), W = nt(), F = te(!1), L = te(0), ne = te(!0), Q = te(!1), ge = te(!1);
11810
11804
  mt(
11811
11805
  X(
11812
11806
  m,
@@ -11898,15 +11892,15 @@ const qC = /* @__PURE__ */ ut(
11898
11892
  ]) => {
11899
11893
  const { column: ot, row: Ce } = ce, { height: Xe, width: st } = H, { width: Qe } = We;
11900
11894
  if (ye === 0 && (D === 0 || Qe === 0))
11901
- return Eu;
11895
+ return Ru;
11902
11896
  if (st === 0) {
11903
11897
  const it = Dl($e, D), Yt = it + Math.max(ye - 1, 0);
11904
11898
  return VC(Nu(it, Yt, re));
11905
11899
  }
11906
11900
  const Je = Zh(Qe, st, ot);
11907
11901
  let qe, et;
11908
- Pe ? q === 0 && ie === 0 && ye > 0 ? (qe = 0, et = ye - 1) : (qe = Je * Ws((q + Ce) / (Xe + Ce)), et = Je * Ru((ie + Ce) / (Xe + Ce)) - 1, et = ha(D - 1, Co(et, Je - 1)), qe = ha(et, Co(0, qe))) : (qe = 0, et = -1);
11909
- const Mt = Nu(qe, et, re), { bottom: kt, top: tt } = Au(We, ce, H, Mt), vt = Ru(D / Je), At = vt * Xe + (vt - 1) * Ce - kt;
11902
+ Pe ? q === 0 && ie === 0 && ye > 0 ? (qe = 0, et = ye - 1) : (qe = Je * Ws((q + Ce) / (Xe + Ce)), et = Je * Eu((ie + Ce) / (Xe + Ce)) - 1, et = ha(D - 1, Co(et, Je - 1)), qe = ha(et, Co(0, qe))) : (qe = 0, et = -1);
11903
+ const Mt = Nu(qe, et, re), { bottom: kt, top: tt } = Au(We, ce, H, Mt), vt = Eu(D / Je), At = vt * Xe + (vt - 1) * Ce - kt;
11910
11904
  return { bottom: kt, itemHeight: Xe, items: Mt, itemWidth: st, offsetBottom: At, offsetTop: tt, top: tt };
11911
11905
  }
11912
11906
  )
@@ -12088,7 +12082,7 @@ const GC = /* @__PURE__ */ ut(() => {
12088
12082
  ([e, t]) => ({ ...e, ...t }),
12089
12083
  Nt(qC, GC)
12090
12084
  ), XC = /* @__PURE__ */ V.memo(function() {
12091
- const e = jt("gridState"), t = jt("listClassName"), n = jt("itemClassName"), r = jt("itemContent"), o = jt("computeItemKey"), s = jt("isSeeking"), i = Rn("scrollHeight"), a = jt("ItemComponent"), l = jt("ListComponent"), c = jt("ScrollSeekPlaceholder"), d = jt("context"), f = Rn("itemDimensions"), h = Rn("gap"), p = jt("log"), m = jt("stateRestoreInProgress"), g = Rn("reportReadyState"), x = zr(
12085
+ const e = jt("gridState"), t = jt("listClassName"), n = jt("itemClassName"), r = jt("itemContent"), o = jt("computeItemKey"), s = jt("isSeeking"), i = En("scrollHeight"), a = jt("ItemComponent"), l = jt("ListComponent"), c = jt("ScrollSeekPlaceholder"), d = jt("context"), f = En("itemDimensions"), h = En("gap"), p = jt("log"), m = jt("stateRestoreInProgress"), g = En("reportReadyState"), x = zr(
12092
12086
  V.useMemo(
12093
12087
  () => (y) => {
12094
12088
  const w = y.parentElement.parentElement.scrollHeight;
@@ -12143,7 +12137,7 @@ const GC = /* @__PURE__ */ ut(() => {
12143
12137
  }
12144
12138
  );
12145
12139
  }), JC = V.memo(function() {
12146
- const e = jt("HeaderComponent"), t = Rn("headerHeight"), n = jt("headerFooterTag"), r = zr(
12140
+ const e = jt("HeaderComponent"), t = En("headerHeight"), n = jt("headerFooterTag"), r = zr(
12147
12141
  V.useMemo(
12148
12142
  () => (s) => {
12149
12143
  t(hr(s, "height"));
@@ -12155,7 +12149,7 @@ const GC = /* @__PURE__ */ ut(() => {
12155
12149
  ), o = jt("context");
12156
12150
  return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...on(e, o) }) }) : null;
12157
12151
  }), ZC = V.memo(function() {
12158
- const e = jt("FooterComponent"), t = Rn("footerHeight"), n = jt("headerFooterTag"), r = zr(
12152
+ const e = jt("FooterComponent"), t = En("footerHeight"), n = jt("headerFooterTag"), r = zr(
12159
12153
  V.useMemo(
12160
12154
  () => (s) => {
12161
12155
  t(hr(s, "height"));
@@ -12167,7 +12161,7 @@ const GC = /* @__PURE__ */ ut(() => {
12167
12161
  ), o = jt("context");
12168
12162
  return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...on(e, o) }) }) : null;
12169
12163
  }), QC = ({ children: e }) => {
12170
- const t = V.useContext(Kh), n = Rn("itemDimensions"), r = Rn("viewportDimensions"), o = zr(
12164
+ const t = V.useContext(Kh), n = En("itemDimensions"), r = En("viewportDimensions"), o = zr(
12171
12165
  V.useMemo(
12172
12166
  () => (s) => {
12173
12167
  r(s.getBoundingClientRect());
@@ -12179,12 +12173,12 @@ const GC = /* @__PURE__ */ ut(() => {
12179
12173
  );
12180
12174
  return V.useEffect(() => {
12181
12175
  t && (r({ height: t.viewportHeight, width: t.viewportWidth }), n({ height: t.itemHeight, width: t.itemWidth }));
12182
- }, [t, r, n]), /* @__PURE__ */ u.jsx("div", { ref: o, style: Ri(!1), children: e });
12176
+ }, [t, r, n]), /* @__PURE__ */ u.jsx("div", { ref: o, style: Ei(!1), children: e });
12183
12177
  }, eT = ({ children: e }) => {
12184
- const t = V.useContext(Kh), n = Rn("windowViewportRect"), r = Rn("itemDimensions"), o = jt("customScrollParent"), s = Th(n, o, !1);
12178
+ const t = V.useContext(Kh), n = En("windowViewportRect"), r = En("itemDimensions"), o = jt("customScrollParent"), s = Th(n, o, !1);
12185
12179
  return V.useEffect(() => {
12186
12180
  t && (r({ height: t.itemHeight, width: t.itemWidth }), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
12187
- }, [t, n, r]), /* @__PURE__ */ u.jsx("div", { ref: s, style: Ri(!1), children: e });
12181
+ }, [t, n, r]), /* @__PURE__ */ u.jsx("div", { ref: s, style: Ei(!1), children: e });
12188
12182
  }, tT = /* @__PURE__ */ V.memo(function({ ...e }) {
12189
12183
  const t = jt("useWindowScroll"), n = jt("customScrollParent"), r = n || t ? rT : nT, o = n || t ? eT : QC, s = jt("context");
12190
12184
  return /* @__PURE__ */ u.jsx(r, { ...e, ...on(r, s), children: /* @__PURE__ */ u.jsxs(o, { children: [
@@ -12195,7 +12189,7 @@ const GC = /* @__PURE__ */ ut(() => {
12195
12189
  }), {
12196
12190
  useEmitter: Qh,
12197
12191
  useEmitterValue: jt,
12198
- usePublisher: Rn
12192
+ usePublisher: En
12199
12193
  } = /* @__PURE__ */ Wh(
12200
12194
  YC,
12201
12195
  {
@@ -12237,7 +12231,7 @@ const GC = /* @__PURE__ */ ut(() => {
12237
12231
  }
12238
12232
  },
12239
12233
  tT
12240
- ), nT = /* @__PURE__ */ Xh({ useEmitter: Qh, useEmitterValue: jt, usePublisher: Rn }), rT = /* @__PURE__ */ Jh({ useEmitter: Qh, useEmitterValue: jt, usePublisher: Rn });
12234
+ ), nT = /* @__PURE__ */ Xh({ useEmitter: Qh, useEmitterValue: jt, usePublisher: En }), rT = /* @__PURE__ */ Jh({ useEmitter: Qh, useEmitterValue: jt, usePublisher: En });
12241
12235
  function _u(e, t, n) {
12242
12236
  return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t, xn.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
12243
12237
  }
@@ -12281,7 +12275,7 @@ const ko = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12281
12275
  }
12282
12276
  ));
12283
12277
  ko.displayName = "CardHeader";
12284
- const Eo = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12278
+ const Ro = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12285
12279
  "h3",
12286
12280
  {
12287
12281
  ref: n,
@@ -12292,7 +12286,7 @@ const Eo = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12292
12286
  ...t
12293
12287
  }
12294
12288
  ));
12295
- Eo.displayName = "CardTitle";
12289
+ Ro.displayName = "CardTitle";
12296
12290
  const tp = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12297
12291
  "p",
12298
12292
  {
@@ -12302,8 +12296,8 @@ const tp = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12302
12296
  }
12303
12297
  ));
12304
12298
  tp.displayName = "CardDescription";
12305
- const Ro = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx("div", { ref: n, className: oe("p-6 pt-0", e), ...t }));
12306
- Ro.displayName = "CardContent";
12299
+ const Eo = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx("div", { ref: n, className: oe("p-6 pt-0", e), ...t }));
12300
+ Eo.displayName = "CardContent";
12307
12301
  const np = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12308
12302
  "div",
12309
12303
  {
@@ -12521,7 +12515,7 @@ function Vs(e) {
12521
12515
  }
12522
12516
  return typeof e == "object" && !Array.isArray(e) && e.content !== void 0 ? Vs(e.content) : e;
12523
12517
  }
12524
- var Ii = "Dialog", [sp, zE] = ar(Ii), [pT, Hn] = sp(Ii), ip = (e) => {
12518
+ var Ii = "Dialog", [sp, zR] = ar(Ii), [pT, Hn] = sp(Ii), ip = (e) => {
12525
12519
  const {
12526
12520
  __scopeDialog: t,
12527
12521
  children: n,
@@ -12726,7 +12720,7 @@ yp.displayName = xp;
12726
12720
  function Kl(e) {
12727
12721
  return e ? "open" : "closed";
12728
12722
  }
12729
- var vp = "DialogTitleWarning", [BE, wp] = Tv(vp, {
12723
+ var vp = "DialogTitleWarning", [BR, wp] = Tv(vp, {
12730
12724
  contentName: Mr,
12731
12725
  titleName: Vl,
12732
12726
  docsSlug: "dialog"
@@ -12799,7 +12793,7 @@ const kp = v.forwardRef(({ className: e, children: t, ...n }, r) => {
12799
12793
  ] });
12800
12794
  });
12801
12795
  kp.displayName = Ai.displayName;
12802
- const Ep = ({
12796
+ const Rp = ({
12803
12797
  className: e,
12804
12798
  ...t
12805
12799
  }) => /* @__PURE__ */ u.jsx(
@@ -12812,8 +12806,8 @@ const Ep = ({
12812
12806
  ...t
12813
12807
  }
12814
12808
  );
12815
- Ep.displayName = "DialogHeader";
12816
- const Rp = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12809
+ Rp.displayName = "DialogHeader";
12810
+ const Ep = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12817
12811
  Nr,
12818
12812
  {
12819
12813
  ref: n,
@@ -12824,8 +12818,8 @@ const Rp = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12824
12818
  ...t
12825
12819
  }
12826
12820
  ));
12827
- Rp.displayName = Nr.displayName;
12828
- const ET = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12821
+ Ep.displayName = Nr.displayName;
12822
+ const RT = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12829
12823
  _i,
12830
12824
  {
12831
12825
  ref: n,
@@ -12833,8 +12827,8 @@ const ET = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
12833
12827
  ...t
12834
12828
  }
12835
12829
  ));
12836
- ET.displayName = _i.displayName;
12837
- function RT({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
12830
+ RT.displayName = _i.displayName;
12831
+ function ET({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
12838
12832
  const [s, i] = we(!1), [a, l] = we(null), [c, d] = we(null), { toast: f } = Hl(), h = V.useCallback(async () => {
12839
12833
  if (n) {
12840
12834
  i(!0), d(null), l(null);
@@ -12899,11 +12893,11 @@ function RT({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
12899
12893
  /* @__PURE__ */ u.jsx("p", { className: "text-sm text-muted-foreground", children: "This file type cannot be previewed. Use download or external view." })
12900
12894
  ] }) : /* @__PURE__ */ u.jsx("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ u.jsx("p", { className: "text-muted-foreground", children: "No content to display" }) }), x = () => o.startsWith("image/") ? /* @__PURE__ */ u.jsx(xg, { className: "h-5 w-5" }) : /* @__PURE__ */ u.jsx(ic, { className: "h-5 w-5" });
12901
12895
  return /* @__PURE__ */ u.jsx(TT, { open: e, onOpenChange: t, children: /* @__PURE__ */ u.jsxs(kp, { className: "max-w-4xl max-h-[90vh] overflow-hidden", children: [
12902
- /* @__PURE__ */ u.jsx(Ep, { children: /* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between", children: [
12896
+ /* @__PURE__ */ u.jsx(Rp, { children: /* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between", children: [
12903
12897
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-3", children: [
12904
12898
  x(),
12905
12899
  /* @__PURE__ */ u.jsxs("div", { children: [
12906
- /* @__PURE__ */ u.jsx(Rp, { className: "text-left", children: r }),
12900
+ /* @__PURE__ */ u.jsx(Ep, { className: "text-left", children: r }),
12907
12901
  /* @__PURE__ */ u.jsxs("p", { className: "text-sm text-muted-foreground mt-1", children: [
12908
12902
  o,
12909
12903
  " • Click download or external view for full access"
@@ -14682,7 +14676,7 @@ const Bu = V.memo(function({
14682
14676
  [Q, t]
14683
14677
  ), ye = (y == null ? void 0 : y.id) ?? (y == null ? void 0 : y.interrupt_id), Pe = ps(ye), $e = y == null ? void 0 : y.value, ot = ct(() => Q ? "" : qT(t.content), [Q, t]), Ce = V.useCallback(async () => {
14684
14678
  const G = ne ? ot : ie;
14685
- async function Ee(ve) {
14679
+ async function Re(ve) {
14686
14680
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
14687
14681
  await navigator.clipboard.writeText(ve);
14688
14682
  return;
@@ -14699,30 +14693,30 @@ const Bu = V.memo(function({
14699
14693
  throw new Error("Clipboard API not supported in this context.");
14700
14694
  }
14701
14695
  try {
14702
- await Ee(G), M(!0), setTimeout(() => M(!1), 2e3), x == null || x(G);
14696
+ await Re(G), M(!0), setTimeout(() => M(!1), 2e3), x == null || x(G);
14703
14697
  } catch (ve) {
14704
14698
  console.error("Failed to copy:", ve);
14705
14699
  }
14706
14700
  }, [ne, ot, ie, x]), Xe = V.useCallback(() => {
14707
14701
  if (!p) return;
14708
- const G = ne ? ot : ie, Ee = "type" in t && t.type === "default_message" ? void 0 : {
14702
+ const G = ne ? ot : ie, Re = "type" in t && t.type === "default_message" ? void 0 : {
14709
14703
  checkpointId: t.checkpointId ?? null,
14710
14704
  checkpointNs: t.checkpointNs ?? null
14711
14705
  };
14712
- p(t.id, G, Ee);
14706
+ p(t.id, G, Re);
14713
14707
  }, [p, t.id, ne, ot, ie, t]), st = V.useCallback(() => {
14714
14708
  m == null || m(n);
14715
14709
  }, [m, n]), Qe = V.useCallback(() => {
14716
- const Ee = oe(F ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", q);
14710
+ const Re = oe(F ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", q);
14717
14711
  switch (L) {
14718
14712
  case "user":
14719
- return /* @__PURE__ */ u.jsx(vg, { className: Ee });
14713
+ return /* @__PURE__ */ u.jsx(vg, { className: Re });
14720
14714
  case "assistant":
14721
- return /* @__PURE__ */ u.jsx(zi, { className: Ee });
14715
+ return /* @__PURE__ */ u.jsx(zi, { className: Re });
14722
14716
  case "tool":
14723
- return /* @__PURE__ */ u.jsx(yg, { className: Ee });
14717
+ return /* @__PURE__ */ u.jsx(yg, { className: Re });
14724
14718
  default:
14725
- return /* @__PURE__ */ u.jsx(zi, { className: Ee });
14719
+ return /* @__PURE__ */ u.jsx(zi, { className: Re });
14726
14720
  }
14727
14721
  }, [F, q, L]), Je = V.useCallback(() => {
14728
14722
  const G = "group relative mb-4 flex w-full";
@@ -14793,15 +14787,15 @@ const Bu = V.memo(function({
14793
14787
  const et = V.useCallback(async (G) => {
14794
14788
  if (w)
14795
14789
  return;
14796
- const Ee = ps(
14790
+ const Re = ps(
14797
14791
  (G == null ? void 0 : G.id) ?? (G == null ? void 0 : G.interrupt_id)
14798
14792
  );
14799
- if (!Ee) {
14793
+ if (!Re) {
14800
14794
  console.warn("Interrupt part missing id", G);
14801
14795
  return;
14802
14796
  }
14803
14797
  try {
14804
- S == null || S(), await W(Ee, !0);
14798
+ S == null || S(), await W(Re, !0);
14805
14799
  } catch (ve) {
14806
14800
  console.error("Failed to approve interrupt:", ve);
14807
14801
  } finally {
@@ -14810,24 +14804,24 @@ const Bu = V.memo(function({
14810
14804
  }, [w, T, S, W]), Mt = V.useCallback(async (G) => {
14811
14805
  if (w)
14812
14806
  return;
14813
- const Ee = ps(
14807
+ const Re = ps(
14814
14808
  (G == null ? void 0 : G.id) ?? (G == null ? void 0 : G.interrupt_id)
14815
14809
  );
14816
- if (!Ee) {
14810
+ if (!Re) {
14817
14811
  console.warn("Interrupt part missing id", G);
14818
14812
  return;
14819
14813
  }
14820
14814
  try {
14821
- S == null || S(), await W(Ee, !1);
14815
+ S == null || S(), await W(Re, !1);
14822
14816
  } catch (ve) {
14823
14817
  console.error("Failed to reject interrupt:", ve);
14824
14818
  } finally {
14825
14819
  T == null || T();
14826
14820
  }
14827
- }, [w, T, S, W]), kt = V.useCallback(({ part: G, i: Ee }) => {
14821
+ }, [w, T, S, W]), kt = V.useCallback(({ part: G, i: Re }) => {
14828
14822
  if (G.type === "text") {
14829
14823
  const ve = G.text ?? "", gt = ve.trim(), xt = Ul(gt);
14830
- return xt && L !== "tool" ? /* @__PURE__ */ u.jsx(Dp, { data: xt }, Ee) : L === "user" && c && gt.length > d ? /* @__PURE__ */ u.jsx(
14824
+ return xt && L !== "tool" ? /* @__PURE__ */ u.jsx(Dp, { data: xt }, Re) : L === "user" && c && gt.length > d ? /* @__PURE__ */ u.jsx(
14831
14825
  ZT,
14832
14826
  {
14833
14827
  text: gt,
@@ -14836,8 +14830,8 @@ const Bu = V.memo(function({
14836
14830
  previewLength: d,
14837
14831
  isCompact: F
14838
14832
  },
14839
- Ee
14840
- ) : /* @__PURE__ */ u.jsx(Ys, { content: ve, allowHtml: !1 }, Ee);
14833
+ Re
14834
+ ) : /* @__PURE__ */ u.jsx(Ys, { content: ve, allowHtml: !1 }, Re);
14841
14835
  }
14842
14836
  if (G.type === "image_url") {
14843
14837
  const ve = G;
@@ -14849,7 +14843,7 @@ const Bu = V.memo(function({
14849
14843
  loading: "lazy",
14850
14844
  className: "border rounded max-h-[420px] w-auto object-contain"
14851
14845
  }
14852
- ) }, Ee);
14846
+ ) }, Re);
14853
14847
  }
14854
14848
  if (G.type === "file") {
14855
14849
  const ve = G, gt = ve.name || "file";
@@ -14857,18 +14851,18 @@ const Bu = V.memo(function({
14857
14851
  "a",
14858
14852
  {
14859
14853
  href: ve.url,
14860
- onClick: (xt) => ue(xt, ve, Ee),
14854
+ onClick: (xt) => ue(xt, ve, Re),
14861
14855
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
14862
14856
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
14863
14857
  children: [
14864
- J[Ee] ? /* @__PURE__ */ u.jsx(el, { className: "h-4 w-4 animate-spin" }) : null,
14858
+ J[Re] ? /* @__PURE__ */ u.jsx(el, { className: "h-4 w-4 animate-spin" }) : null,
14865
14859
  /* @__PURE__ */ u.jsxs("span", { className: "truncate max-w-[180px]", children: [
14866
14860
  gt,
14867
- J[Ee] ? " (processing)" : ""
14861
+ J[Re] ? " (processing)" : ""
14868
14862
  ] })
14869
14863
  ]
14870
14864
  },
14871
- Ee
14865
+ Re
14872
14866
  );
14873
14867
  }
14874
14868
  if (G.type === "interrupt") {
@@ -14885,7 +14879,7 @@ const Bu = V.memo(function({
14885
14879
  isActive: xt,
14886
14880
  payload: dt
14887
14881
  },
14888
- Ee
14882
+ Re
14889
14883
  );
14890
14884
  }
14891
14885
  return null;
@@ -14923,7 +14917,7 @@ const Bu = V.memo(function({
14923
14917
  t.id
14924
14918
  );
14925
14919
  if (!ne && !Q) {
14926
- const Ee = t, ve = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: Ee.content.map((gt, xt) => /* @__PURE__ */ u.jsx(kt, { part: gt, i: xt }, xt)) });
14920
+ const Re = t, ve = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: Re.content.map((gt, xt) => /* @__PURE__ */ u.jsx(kt, { part: gt, i: xt }, xt)) });
14927
14921
  return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
14928
14922
  ve,
14929
14923
  /* @__PURE__ */ u.jsx(YT, { className: q })
@@ -14941,18 +14935,18 @@ const Bu = V.memo(function({
14941
14935
  q
14942
14936
  ]), At = ct(() => Q ? "Assistant" : GT(t), [Q, t]), it = V.useMemo(() => Q ? [] : Array.isArray(C) ? C : [], [C, Q]), Yt = V.useMemo(() => {
14943
14937
  var G;
14944
- return it.length ? A && it.some((Ee) => Ee.id === A) ? A : ((G = it[0]) == null ? void 0 : G.id) ?? null : null;
14938
+ return it.length ? A && it.some((Re) => Re.id === A) ? A : ((G = it[0]) == null ? void 0 : G.id) ?? null : null;
14945
14939
  }, [A, it]), Jt = V.useMemo(() => !it.length || !b ? null : it.some((G) => G.id === b) ? b : null, [b, it]) ?? Yt, Zt = L === "user" && it.length > 0 && typeof k == "function", ft = V.useCallback(
14946
14940
  (G) => {
14947
14941
  if (!k) return;
14948
- const Ee = (G == null ? void 0 : G.id) ?? null, ve = (G == null ? void 0 : G.parentId) ?? N ?? null;
14949
- k(Ee, ve);
14942
+ const Re = (G == null ? void 0 : G.id) ?? null, ve = (G == null ? void 0 : G.parentId) ?? N ?? null;
14943
+ k(Re, ve);
14950
14944
  },
14951
14945
  [N, k]
14952
14946
  ), Ve = V.useMemo(() => Jt ? it.findIndex((G) => G.id === Jt) : -1, [Jt, it]), Dt = V.useMemo(() => Ve < 0 ? null : it[Ve] ?? null, [Ve, it]), Pt = V.useCallback((G) => {
14953
- const Ee = [];
14954
- if (G.step !== null && Ee.push(`Step ${G.step}`), G.source && Ee.push(G.source), !G.createdAt)
14955
- return Ee.length ? Ee.join(" • ") : G.id.slice(0, 8);
14947
+ const Re = [];
14948
+ if (G.step !== null && Re.push(`Step ${G.step}`), G.source && Re.push(G.source), !G.createdAt)
14949
+ return Re.length ? Re.join(" • ") : G.id.slice(0, 8);
14956
14950
  let ve = "";
14957
14951
  try {
14958
14952
  const gt = new Date(G.createdAt);
@@ -14995,7 +14989,7 @@ const Bu = V.memo(function({
14995
14989
  "aria-expanded": $ === "expanded",
14996
14990
  onClick: () => z((G) => G === "expanded" ? "preview" : "expanded"),
14997
14991
  onKeyDown: (G) => {
14998
- (G.key === "Enter" || G.key === " ") && (G.preventDefault(), z((Ee) => Ee === "expanded" ? "preview" : "expanded"));
14992
+ (G.key === "Enter" || G.key === " ") && (G.preventDefault(), z((Re) => Re === "expanded" ? "preview" : "expanded"));
14999
14993
  },
15000
14994
  children: [
15001
14995
  /* @__PURE__ */ u.jsx("span", { children: ce.name ?? "Tool Output" }),
@@ -15166,7 +15160,7 @@ const Bu = V.memo(function({
15166
15160
  )
15167
15161
  ] }) }),
15168
15162
  ee && /* @__PURE__ */ u.jsx(
15169
- RT,
15163
+ ET,
15170
15164
  {
15171
15165
  isOpen: ke,
15172
15166
  onClose: D,
@@ -15221,10 +15215,10 @@ function XT({
15221
15215
  ),
15222
15216
  children: [
15223
15217
  /* @__PURE__ */ u.jsxs(ko, { className: "pb-3", children: [
15224
- /* @__PURE__ */ u.jsx(Eo, { className: "text-blue-900 dark:text-blue-100 text-base", children: i }),
15218
+ /* @__PURE__ */ u.jsx(Ro, { className: "text-blue-900 dark:text-blue-100 text-base", children: i }),
15225
15219
  /* @__PURE__ */ u.jsx(tp, { className: "text-blue-700 dark:text-blue-300 text-sm", children: l })
15226
15220
  ] }),
15227
- a && /* @__PURE__ */ u.jsx(Ro, { className: "pt-0 pb-3", children: a }),
15221
+ a && /* @__PURE__ */ u.jsx(Eo, { className: "pt-0 pb-3", children: a }),
15228
15222
  /* @__PURE__ */ u.jsx(np, { className: "pt-0", children: /* @__PURE__ */ u.jsxs("div", { className: "flex gap-2 ml-auto", children: [
15229
15223
  /* @__PURE__ */ u.jsx(
15230
15224
  pt,
@@ -15441,7 +15435,7 @@ const Hu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ek = (e) =>
15441
15435
  onSelectCheckpoint: _,
15442
15436
  timelineCheckpoints: M
15443
15437
  }, $) => {
15444
- const z = Re(null), P = Re(null), B = Re(!1), [j, W] = we(!0), F = ct(() => w ? e.some((re) => "type" in re && re.type === "default_message" ? !1 : Array.isArray(re == null ? void 0 : re.content) && re.content.some(
15438
+ const z = Ee(null), P = Ee(null), B = Ee(!1), [j, W] = we(!0), F = ct(() => w ? e.some((re) => "type" in re && re.type === "default_message" ? !1 : Array.isArray(re == null ? void 0 : re.content) && re.content.some(
15445
15439
  (ye) => ye && ye.type === "interrupt" && (ye.id ?? ye.interrupt_id) === w.id
15446
15440
  )) : !1, [w, e]), L = ct(() => {
15447
15441
  if (!w || F)
@@ -15723,9 +15717,9 @@ function ga({
15723
15717
  J(!0);
15724
15718
  }, []), ke = de(() => {
15725
15719
  J(!1);
15726
- }, []), ee = !!ge || _e, [D, q] = we(null), [ie, ce] = we(""), [H, We] = we(null), [re, ye] = we(null), [Pe, $e] = we([]), [ot, Ce] = we(0), [Xe, st] = we(0), [Qe, Je] = we(!1), [qe, et] = we(null), [Mt, kt] = we(null), [tt, vt] = we(!1), [At, it] = we(null), [Yt, Xt] = we(!1), Jt = Re(!1), [Zt, ft] = we(() => Uu.value), Ve = Re(Zt), Dt = Re(null), Pt = de((Z) => {
15720
+ }, []), ee = !!ge || _e, [D, q] = we(null), [ie, ce] = we(""), [H, We] = we(null), [re, ye] = we(null), [Pe, $e] = we([]), [ot, Ce] = we(0), [Xe, st] = we(0), [Qe, Je] = we(!1), [qe, et] = we(null), [Mt, kt] = we(null), [tt, vt] = we(!1), [At, it] = we(null), [Yt, Xt] = we(!1), Jt = Ee(!1), [Zt, ft] = we(() => Uu.value), Ve = Ee(Zt), Dt = Ee(null), Pt = de((Z) => {
15727
15721
  Uu.value = Z, ft(Z);
15728
- }, []), [G, Ee] = we(!1), ve = Re(null), gt = de((Z) => {
15722
+ }, []), [G, Re] = we(!1), ve = Ee(null), gt = de((Z) => {
15729
15723
  if (!Array.isArray(Z))
15730
15724
  return { text: null, messageId: null };
15731
15725
  for (let se = Z.length - 1; se >= 0; se--) {
@@ -15847,14 +15841,14 @@ function ga({
15847
15841
  at && !Ie.has(at.id) && (fe.push(at), Ie.add(at.id));
15848
15842
  }
15849
15843
  return fe;
15850
- }, [Me, gt, xt, dt]), jn = Re(null), Lt = Re(null), un = de(() => {
15844
+ }, [Me, gt, xt, dt]), jn = Ee(null), Lt = Ee(null), un = de(() => {
15851
15845
  jn.current && (jn.current.value = ""), Lt.current && (Lt.current.value = ""), Ce((Z) => Z + 1), st((Z) => Z + 1);
15852
15846
  }, []), Ur = de(
15853
15847
  (Z) => {
15854
15848
  Pt(Z);
15855
15849
  },
15856
15850
  [Pt]
15857
- ), Wr = Re(!1);
15851
+ ), Wr = Ee(!1);
15858
15852
  St(() => {
15859
15853
  Wr.current && !z && ($e([]), un()), Wr.current = z;
15860
15854
  }, [z, un]);
@@ -15876,7 +15870,7 @@ function ga({
15876
15870
  }
15877
15871
  Dt.current === null && (Dt.current = Ve.current), Pt(ie ?? "");
15878
15872
  }, [ie, D, Pt]);
15879
- const R = de(async () => {
15873
+ const E = de(async () => {
15880
15874
  if (!(!S || T || !Yt))
15881
15875
  try {
15882
15876
  await b();
@@ -15901,8 +15895,8 @@ function ga({
15901
15895
  P && !tt && (m == null || m(P));
15902
15896
  }, [P, tt, m]);
15903
15897
  const Y = (Z) => {
15904
- if (Z.length > Es)
15905
- return `Message too long (${Z.length}/${Es} characters)`;
15898
+ if (Z.length > Rs)
15899
+ return `Message too long (${Z.length}/${Rs} characters)`;
15906
15900
  try {
15907
15901
  return jS(Z), null;
15908
15902
  } catch (se) {
@@ -16004,9 +15998,9 @@ function ga({
16004
15998
  Je(!1), Z.target.value = "", un();
16005
15999
  }
16006
16000
  }
16007
- }, Et = async (Z) => {
16001
+ }, Rt = async (Z) => {
16008
16002
  if (x) {
16009
- Ee(!0);
16003
+ Re(!0);
16010
16004
  try {
16011
16005
  if (!Z) {
16012
16006
  await A(), Xt(!1), requestAnimationFrame(() => {
@@ -16021,14 +16015,14 @@ function ga({
16021
16015
  (Ie = ve.current) == null || Ie.scrollToTop();
16022
16016
  });
16023
16017
  } finally {
16024
- Ee(!1);
16018
+ Re(!1);
16025
16019
  }
16026
16020
  }
16027
16021
  }, Qt = de(
16028
16022
  async (Z) => {
16029
- await Et(Z);
16023
+ await Rt(Z);
16030
16024
  },
16031
- [Et]
16025
+ [Rt]
16032
16026
  ), Pn = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${f.container || ""}`, dn = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 bg-transparent ${f.messagesArea || ""}`, Ht = `flex-shrink-0 w-full border-t p-4 bg-transparent ${f.inputArea || ""}`, On = de(
16033
16027
  (Z) => {
16034
16028
  if (!Z)
@@ -16064,7 +16058,7 @@ function ga({
16064
16058
  value: L ?? "",
16065
16059
  onChange: (Z) => {
16066
16060
  const se = Z.target.value || null;
16067
- Et(se);
16061
+ Rt(se);
16068
16062
  },
16069
16063
  children: [
16070
16064
  /* @__PURE__ */ u.jsx("option", { value: "", children: "Latest" }),
@@ -16097,7 +16091,7 @@ function ga({
16097
16091
  enableMessageEditing: c,
16098
16092
  editingMessageId: D,
16099
16093
  onStartReached: () => {
16100
- Yt && R();
16094
+ Yt && E();
16101
16095
  },
16102
16096
  onScrollAway: (Z) => {
16103
16097
  if (!Jt.current) {
@@ -16250,7 +16244,7 @@ function ga({
16250
16244
  placeholder: D ? "Edit your message..." : t,
16251
16245
  isStreaming: z,
16252
16246
  disabled: ee,
16253
- maxLength: Es,
16247
+ maxLength: Rs,
16254
16248
  onSend: ae,
16255
16249
  onCancelEdit: Ye,
16256
16250
  onStop: W,
@@ -16283,7 +16277,7 @@ function Va(e, [t, n]) {
16283
16277
  function tk(e, t) {
16284
16278
  return v.useReducer((n, r) => t[n][r] ?? n, e);
16285
16279
  }
16286
- var Yl = "ScrollArea", [Fp, HE] = ar(Yl), [nk, _n] = Fp(Yl), $p = v.forwardRef(
16280
+ var Yl = "ScrollArea", [Fp, HR] = ar(Yl), [nk, _n] = Fp(Yl), $p = v.forwardRef(
16287
16281
  (e, t) => {
16288
16282
  const {
16289
16283
  __scopeScrollArea: n,
@@ -16840,7 +16834,7 @@ function Ku({
16840
16834
  currentThreadId: h,
16841
16835
  isLoading: p,
16842
16836
  actions: m
16843
- } = cl(), { loadThread: g } = ul(), { createThread: x, deleteThread: y, renameThread: w } = m, [S, T] = we(Array.isArray(f) ? f : []), C = Re(S.length > 0), b = Re(null), k = Re(0), [A, N] = we(null), [_, M] = we(""), [$, z] = we(!1);
16837
+ } = cl(), { loadThread: g } = ul(), { createThread: x, deleteThread: y, renameThread: w } = m, [S, T] = we(Array.isArray(f) ? f : []), C = Ee(S.length > 0), b = Ee(null), k = Ee(0), [A, N] = we(null), [_, M] = we(""), [$, z] = we(!1);
16844
16838
  St(() => {
16845
16839
  const J = Array.isArray(f) ? f : [];
16846
16840
  if (J.length > 0) {
@@ -16955,7 +16949,7 @@ function Ku({
16955
16949
  ] }) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
16956
16950
  /* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: _e(J) }),
16957
16951
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
16958
- /* @__PURE__ */ u.jsx(Eg, { size: 10 }),
16952
+ /* @__PURE__ */ u.jsx(Rg, { size: 10 }),
16959
16953
  /* @__PURE__ */ u.jsx("span", { children: Q(J.updatedAt || J.createdAt) })
16960
16954
  ] })
16961
16955
  ] }) }),
@@ -16969,7 +16963,7 @@ function Ku({
16969
16963
  onClick: (ue) => j(J.threadId, ue),
16970
16964
  className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
16971
16965
  title: "Delete thread",
16972
- children: /* @__PURE__ */ u.jsx(Rg, { size: 12 })
16966
+ children: /* @__PURE__ */ u.jsx(Eg, { size: 12 })
16973
16967
  }
16974
16968
  )
16975
16969
  ] })
@@ -17064,7 +17058,7 @@ function yk(e) {
17064
17058
  console.error("Failed to save settings:", t);
17065
17059
  }
17066
17060
  }
17067
- function UE() {
17061
+ function UR() {
17068
17062
  const e = gk(), t = xk(), n = _r.getAuthToken(), r = typeof t.apiBaseUrl == "string" ? t.apiBaseUrl : void 0;
17069
17063
  return {
17070
17064
  ...e,
@@ -17079,7 +17073,7 @@ function UE() {
17079
17073
  )
17080
17074
  };
17081
17075
  }
17082
- function WE(e) {
17076
+ function WR(e) {
17083
17077
  _r.updateConfig({
17084
17078
  baseUrl: e.apiBaseUrl,
17085
17079
  authToken: e.apiKey ?? void 0
@@ -17113,7 +17107,7 @@ function sm(e) {
17113
17107
  const t = v.useRef({ value: e, previous: e });
17114
17108
  return v.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
17115
17109
  }
17116
- var Oi = "Switch", [bk, VE] = ar(Oi), [Sk, Ck] = bk(Oi), im = v.forwardRef(
17110
+ var Oi = "Switch", [bk, VR] = ar(Oi), [Sk, Ck] = bk(Oi), im = v.forwardRef(
17117
17111
  (e, t) => {
17118
17112
  const {
17119
17113
  __scopeSwitch: n,
@@ -17262,7 +17256,7 @@ var fm = Object.freeze({
17262
17256
  clip: "rect(0, 0, 0, 0)",
17263
17257
  whiteSpace: "nowrap",
17264
17258
  wordWrap: "normal"
17265
- }), Ek = "VisuallyHidden", Rk = v.forwardRef(
17259
+ }), Rk = "VisuallyHidden", Ek = v.forwardRef(
17266
17260
  (e, t) => /* @__PURE__ */ u.jsx(
17267
17261
  Fe.span,
17268
17262
  {
@@ -17272,8 +17266,8 @@ var fm = Object.freeze({
17272
17266
  }
17273
17267
  )
17274
17268
  );
17275
- Rk.displayName = Ek;
17276
- var Ik = [" ", "Enter", "ArrowUp", "ArrowDown"], Nk = [" ", "Enter"], Dr = "Select", [Mi, Di, Ak] = fl(Dr), [ho, KE] = ar(Dr, [
17269
+ Ek.displayName = Rk;
17270
+ var Ik = [" ", "Enter", "ArrowUp", "ArrowDown"], Nk = [" ", "Enter"], Dr = "Select", [Mi, Di, Ak] = fl(Dr), [ho, KR] = ar(Dr, [
17277
17271
  Ak,
17278
17272
  gi
17279
17273
  ]), Li = gi(), [_k, vr] = ho(Dr), [jk, Pk] = ho(Dr), hm = (e) => {
@@ -17814,13 +17808,13 @@ var km = "SelectGroup", [Bk, Hk] = ho(km), Uk = v.forwardRef(
17814
17808
  }
17815
17809
  );
17816
17810
  Uk.displayName = km;
17817
- var Em = "SelectLabel", Rm = v.forwardRef(
17811
+ var Rm = "SelectLabel", Em = v.forwardRef(
17818
17812
  (e, t) => {
17819
- const { __scopeSelect: n, ...r } = e, o = Hk(Em, n);
17813
+ const { __scopeSelect: n, ...r } = e, o = Hk(Rm, n);
17820
17814
  return /* @__PURE__ */ u.jsx(Fe.div, { id: o.id, ...r, ref: t });
17821
17815
  }
17822
17816
  );
17823
- Rm.displayName = Em;
17817
+ Em.displayName = Rm;
17824
17818
  var Qs = "SelectItem", [Wk, Im] = ho(Qs), Nm = v.forwardRef(
17825
17819
  (e, t) => {
17826
17820
  const {
@@ -18077,7 +18071,7 @@ function zm(e, t, n) {
18077
18071
  function Gk(e, t) {
18078
18072
  return e.map((n, r) => e[(t + r) % e.length]);
18079
18073
  }
18080
- var Yk = hm, Bm = mm, Xk = xm, Jk = ym, Zk = vm, Hm = wm, Qk = Tm, Um = Rm, Wm = Nm, eE = Am, tE = jm, Vm = Pm, Km = Om, qm = Dm;
18074
+ var Yk = hm, Bm = mm, Xk = xm, Jk = ym, Zk = vm, Hm = wm, Qk = Tm, Um = Em, Wm = Nm, eR = Am, tR = jm, Vm = Pm, Km = Om, qm = Dm;
18081
18075
  const qu = Yk, Gu = Xk, Ja = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ u.jsxs(
18082
18076
  Bm,
18083
18077
  {
@@ -18148,7 +18142,7 @@ const Za = v.forwardRef(({ className: e, children: t, position: n = "popper", ..
18148
18142
  }
18149
18143
  ) }));
18150
18144
  Za.displayName = Hm.displayName;
18151
- const nE = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
18145
+ const nR = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
18152
18146
  Um,
18153
18147
  {
18154
18148
  ref: n,
@@ -18156,7 +18150,7 @@ const nE = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
18156
18150
  ...t
18157
18151
  }
18158
18152
  ));
18159
- nE.displayName = Um.displayName;
18153
+ nR.displayName = Um.displayName;
18160
18154
  const kr = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ u.jsxs(
18161
18155
  Wm,
18162
18156
  {
@@ -18167,13 +18161,13 @@ const kr = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
18167
18161
  ),
18168
18162
  ...n,
18169
18163
  children: [
18170
- /* @__PURE__ */ u.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ u.jsx(tE, { children: /* @__PURE__ */ u.jsx(Qa, { className: "h-4 w-4" }) }) }),
18171
- /* @__PURE__ */ u.jsx(eE, { children: t })
18164
+ /* @__PURE__ */ u.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ u.jsx(tR, { children: /* @__PURE__ */ u.jsx(Qa, { className: "h-4 w-4" }) }) }),
18165
+ /* @__PURE__ */ u.jsx(eR, { children: t })
18172
18166
  ]
18173
18167
  }
18174
18168
  ));
18175
18169
  kr.displayName = Wm.displayName;
18176
- const rE = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
18170
+ const rR = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
18177
18171
  qm,
18178
18172
  {
18179
18173
  ref: n,
@@ -18181,9 +18175,9 @@ const rE = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
18181
18175
  ...t
18182
18176
  }
18183
18177
  ));
18184
- rE.displayName = qm.displayName;
18185
- var oE = "Separator", Yu = "horizontal", sE = ["horizontal", "vertical"], Xm = v.forwardRef((e, t) => {
18186
- const { decorative: n, orientation: r = Yu, ...o } = e, s = iE(r) ? r : Yu, a = n ? { role: "none" } : { "aria-orientation": s === "vertical" ? s : void 0, role: "separator" };
18178
+ rR.displayName = qm.displayName;
18179
+ var oR = "Separator", Yu = "horizontal", sR = ["horizontal", "vertical"], Xm = v.forwardRef((e, t) => {
18180
+ const { decorative: n, orientation: r = Yu, ...o } = e, s = iR(r) ? r : Yu, a = n ? { role: "none" } : { "aria-orientation": s === "vertical" ? s : void 0, role: "separator" };
18187
18181
  return /* @__PURE__ */ u.jsx(
18188
18182
  Fe.div,
18189
18183
  {
@@ -18194,9 +18188,9 @@ var oE = "Separator", Yu = "horizontal", sE = ["horizontal", "vertical"], Xm = v
18194
18188
  }
18195
18189
  );
18196
18190
  });
18197
- Xm.displayName = oE;
18198
- function iE(e) {
18199
- return sE.includes(e);
18191
+ Xm.displayName = oR;
18192
+ function iR(e) {
18193
+ return sR.includes(e);
18200
18194
  }
18201
18195
  var Jm = Xm;
18202
18196
  const Zm = v.forwardRef(
@@ -18216,7 +18210,7 @@ const Zm = v.forwardRef(
18216
18210
  )
18217
18211
  );
18218
18212
  Zm.displayName = Jm.displayName;
18219
- const aE = bp, lE = CT, cE = Sp, Qm = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
18213
+ const aR = bp, lR = CT, cR = Sp, Qm = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
18220
18214
  Ni,
18221
18215
  {
18222
18216
  className: oe(
@@ -18228,7 +18222,7 @@ const aE = bp, lE = CT, cE = Sp, Qm = v.forwardRef(({ className: e, ...t }, n) =
18228
18222
  }
18229
18223
  ));
18230
18224
  Qm.displayName = Ni.displayName;
18231
- const uE = ni(
18225
+ const uR = ni(
18232
18226
  "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
18233
18227
  {
18234
18228
  variants: {
@@ -18243,13 +18237,13 @@ const uE = ni(
18243
18237
  side: "right"
18244
18238
  }
18245
18239
  }
18246
- ), eg = v.forwardRef(({ side: e = "right", className: t, children: n, ...r }, o) => /* @__PURE__ */ u.jsxs(cE, { children: [
18240
+ ), eg = v.forwardRef(({ side: e = "right", className: t, children: n, ...r }, o) => /* @__PURE__ */ u.jsxs(cR, { children: [
18247
18241
  /* @__PURE__ */ u.jsx(Qm, {}),
18248
18242
  /* @__PURE__ */ u.jsxs(
18249
18243
  Ai,
18250
18244
  {
18251
18245
  ref: o,
18252
- className: oe(uE({ side: e }), t),
18246
+ className: oe(uR({ side: e }), t),
18253
18247
  ...r,
18254
18248
  children: [
18255
18249
  n,
@@ -18294,7 +18288,7 @@ const rg = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
18294
18288
  }
18295
18289
  ));
18296
18290
  rg.displayName = _i.displayName;
18297
- const dE = {
18291
+ const dR = {
18298
18292
  api: {
18299
18293
  baseUrl: "http://localhost:8000/api",
18300
18294
  authToken: "",
@@ -18313,7 +18307,7 @@ const dE = {
18313
18307
  showTypingIndicator: !0
18314
18308
  }
18315
18309
  };
18316
- function qE({ settings: e, onSettingsChange: t, className: n = "" }) {
18310
+ function qR({ settings: e, onSettingsChange: t, className: n = "" }) {
18317
18311
  const [r, o] = we(!1), [s, i] = we(!1), [a, l] = we(e), [c, d] = we(!1), { toast: f } = Hl();
18318
18312
  St(() => {
18319
18313
  const x = JSON.stringify(a) !== JSON.stringify(e);
@@ -18327,7 +18321,7 @@ function qE({ settings: e, onSettingsChange: t, className: n = "" }) {
18327
18321
  description: "Your chat configuration has been updated successfully."
18328
18322
  });
18329
18323
  }, p = () => {
18330
- l(dE), d(!0), f({
18324
+ l(dR), d(!0), f({
18331
18325
  title: "Settings reset",
18332
18326
  description: "Configuration has been reset to defaults."
18333
18327
  });
@@ -18348,8 +18342,8 @@ function qE({ settings: e, onSettingsChange: t, className: n = "" }) {
18348
18342
  });
18349
18343
  }
18350
18344
  };
18351
- return /* @__PURE__ */ u.jsxs(aE, { open: r, onOpenChange: o, children: [
18352
- /* @__PURE__ */ u.jsx(lE, { asChild: !0, children: /* @__PURE__ */ u.jsxs(pt, { variant: "outline", size: "sm", className: n, children: [
18345
+ return /* @__PURE__ */ u.jsxs(aR, { open: r, onOpenChange: o, children: [
18346
+ /* @__PURE__ */ u.jsx(lR, { asChild: !0, children: /* @__PURE__ */ u.jsxs(pt, { variant: "outline", size: "sm", className: n, children: [
18353
18347
  /* @__PURE__ */ u.jsx(Ig, { className: "h-4 w-4 mr-2" }),
18354
18348
  "Settings",
18355
18349
  c && /* @__PURE__ */ u.jsx(ep, { variant: "destructive", className: "ml-2 h-4 w-4 p-0" })
@@ -18361,11 +18355,11 @@ function qE({ settings: e, onSettingsChange: t, className: n = "" }) {
18361
18355
  ] }),
18362
18356
  /* @__PURE__ */ u.jsxs("div", { className: "space-y-6 py-6", children: [
18363
18357
  /* @__PURE__ */ u.jsxs(To, { children: [
18364
- /* @__PURE__ */ u.jsx(ko, { className: "pb-3", children: /* @__PURE__ */ u.jsxs(Eo, { className: "text-lg flex items-center gap-2", children: [
18358
+ /* @__PURE__ */ u.jsx(ko, { className: "pb-3", children: /* @__PURE__ */ u.jsxs(Ro, { className: "text-lg flex items-center gap-2", children: [
18365
18359
  /* @__PURE__ */ u.jsx(Ng, { className: "h-5 w-5" }),
18366
18360
  "API Configuration"
18367
18361
  ] }) }),
18368
- /* @__PURE__ */ u.jsxs(Ro, { className: "space-y-4", children: [
18362
+ /* @__PURE__ */ u.jsxs(Eo, { className: "space-y-4", children: [
18369
18363
  /* @__PURE__ */ u.jsxs("div", { className: "space-y-2", children: [
18370
18364
  /* @__PURE__ */ u.jsx(kn, { htmlFor: "api-url", children: "API Base URL" }),
18371
18365
  /* @__PURE__ */ u.jsxs("div", { className: "flex gap-2", children: [
@@ -18428,11 +18422,11 @@ function qE({ settings: e, onSettingsChange: t, className: n = "" }) {
18428
18422
  ] })
18429
18423
  ] }),
18430
18424
  /* @__PURE__ */ u.jsxs(To, { children: [
18431
- /* @__PURE__ */ u.jsx(ko, { className: "pb-3", children: /* @__PURE__ */ u.jsxs(Eo, { className: "text-lg flex items-center gap-2", children: [
18425
+ /* @__PURE__ */ u.jsx(ko, { className: "pb-3", children: /* @__PURE__ */ u.jsxs(Ro, { className: "text-lg flex items-center gap-2", children: [
18432
18426
  /* @__PURE__ */ u.jsx(jg, { className: "h-5 w-5" }),
18433
18427
  "Interface Settings"
18434
18428
  ] }) }),
18435
- /* @__PURE__ */ u.jsxs(Ro, { className: "space-y-4", children: [
18429
+ /* @__PURE__ */ u.jsxs(Eo, { className: "space-y-4", children: [
18436
18430
  /* @__PURE__ */ u.jsxs("div", { className: "space-y-2", children: [
18437
18431
  /* @__PURE__ */ u.jsx(kn, { htmlFor: "layout", children: "Layout Style" }),
18438
18432
  /* @__PURE__ */ u.jsxs(
@@ -18523,11 +18517,11 @@ function qE({ settings: e, onSettingsChange: t, className: n = "" }) {
18523
18517
  ] })
18524
18518
  ] }),
18525
18519
  /* @__PURE__ */ u.jsxs(To, { children: [
18526
- /* @__PURE__ */ u.jsx(ko, { className: "pb-3", children: /* @__PURE__ */ u.jsxs(Eo, { className: "text-lg flex items-center gap-2", children: [
18520
+ /* @__PURE__ */ u.jsx(ko, { className: "pb-3", children: /* @__PURE__ */ u.jsxs(Ro, { className: "text-lg flex items-center gap-2", children: [
18527
18521
  /* @__PURE__ */ u.jsx(Pg, { className: "h-5 w-5" }),
18528
18522
  "Behavior Settings"
18529
18523
  ] }) }),
18530
- /* @__PURE__ */ u.jsxs(Ro, { className: "space-y-4", children: [
18524
+ /* @__PURE__ */ u.jsxs(Eo, { className: "space-y-4", children: [
18531
18525
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between", children: [
18532
18526
  /* @__PURE__ */ u.jsxs("div", { children: [
18533
18527
  /* @__PURE__ */ u.jsx(kn, { htmlFor: "auto-save", children: "Auto-save Conversations" }),
@@ -18598,7 +18592,7 @@ function qE({ settings: e, onSettingsChange: t, className: n = "" }) {
18598
18592
  ] })
18599
18593
  ] });
18600
18594
  }
18601
- function GE({
18595
+ function GR({
18602
18596
  layout: e = "sidebar",
18603
18597
  layoutSize: t = "desktop",
18604
18598
  showThreads: n = !0,
@@ -18677,24 +18671,24 @@ export {
18677
18671
  Sv as ChatInput,
18678
18672
  ga as ChatInterface,
18679
18673
  Zi as ChatProviders,
18680
- qE as ChatSettings,
18674
+ qR as ChatSettings,
18681
18675
  Ys as MarkdownContent,
18682
18676
  Bu as MessageComponent,
18683
18677
  Lp as MessageList,
18684
18678
  Ku as ThreadManager,
18685
- WE as applySettings,
18679
+ WR as applySettings,
18686
18680
  _r as chatApiClient,
18687
- GE as default,
18681
+ GR as default,
18688
18682
  vy as del,
18689
18683
  Dn as get,
18690
18684
  py as getChatToken,
18691
- UE as getCurrentSettings,
18685
+ UR as getCurrentSettings,
18692
18686
  mk as getDefaultApiConfig,
18693
18687
  gk as getDefaultChatSettings,
18694
18688
  my as onChatTokenChanged,
18695
18689
  Nc as post,
18696
18690
  yy as put,
18697
- Ea as setChatToken,
18691
+ Ra as setChatToken,
18698
18692
  Td as useApi,
18699
18693
  qy as useChatStream,
18700
18694
  Hy as useMessagesReducer,