teodor-new-chat-ui 2.0.25 → 2.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as c, jsxs as R, Fragment as De } from "react/jsx-runtime";
2
2
  import * as l from "react";
3
- import Qe, { useState as ce, useRef as rt, useCallback as Ce, useEffect as we, useReducer as Du, useMemo as nt, createContext as ca, useContext as la, useLayoutEffect as Lu } from "react";
3
+ import Je, { useState as ce, useRef as rt, useCallback as Ce, useEffect as we, useReducer as Du, useMemo as nt, createContext as ca, useContext as la, useLayoutEffect as Lu } from "react";
4
4
  import { ChevronUp as Wt, ChevronDown as Tt, Copy as ns, Edit as rs, RotateCcw as Wr, GitBranch as ua, ChevronLeft as Fu, ChevronRight as da, Bot as os, Wrench as $u, User as Bu, Image as Uu, Check as mo, Circle as zu, X as Kt, Edit3 as fa, Paperclip as ss, Plus as Hu, Square as Wu, Send as Vu, MessageSquarePlus as ju, MessageSquare as Ku, Calendar as Gu, Trash2 as qu, PanelLeft as Xu, Settings as Yu, Server as Ju, EyeOff as Zu, Eye as Qu, Layout as ed, MessageCircle as td, Save as nd } from "lucide-react";
5
5
  import { Slot as Dt, createSlot as _t, createSlottable as rd } from "@radix-ui/react-slot";
6
6
  import { cva as rn } from "class-variance-authority";
@@ -111,14 +111,14 @@ const Nd = (e, t, n, { allOwnKeys: r } = {}) => (an(t, (o, s) => {
111
111
  for (; t-- > 0; )
112
112
  n[t] = e[t];
113
113
  return n;
114
- }, Od = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && go(Uint8Array)), kd = (e, t) => {
114
+ }, Od = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && go(Uint8Array)), Md = (e, t) => {
115
115
  const r = (e && e[Xn]).call(e);
116
116
  let o;
117
117
  for (; (o = r.next()) && !o.done; ) {
118
118
  const s = o.value;
119
119
  t.call(e, s[0], s[1]);
120
120
  }
121
- }, Md = (e, t) => {
121
+ }, kd = (e, t) => {
122
122
  let n;
123
123
  const r = [];
124
124
  for (; (n = e.exec(t)) !== null; )
@@ -225,8 +225,8 @@ const Wd = (e) => {
225
225
  kindOfTest: Be,
226
226
  endsWith: _d,
227
227
  toArray: Id,
228
- forEachEntry: kd,
229
- matchAll: Md,
228
+ forEachEntry: Md,
229
+ matchAll: kd,
230
230
  isHTMLForm: Dd,
231
231
  hasOwnProperty: as,
232
232
  hasOwnProp: as,
@@ -1238,9 +1238,9 @@ const Ia = (e) => {
1238
1238
  onDownloadProgress: C,
1239
1239
  onUploadProgress: I,
1240
1240
  responseType: N,
1241
- headers: L,
1242
- withCredentials: k = "same-origin",
1243
- fetchOptions: D
1241
+ headers: F,
1242
+ withCredentials: D = "same-origin",
1243
+ fetchOptions: L
1244
1244
  } = Ia(m), j = t || fetch;
1245
1245
  N = N ? (N + "").toLowerCase() : "text";
1246
1246
  let K = Nf([y, x && x.toAbortSignal()], E), W = null;
@@ -1249,44 +1249,44 @@ const Ia = (e) => {
1249
1249
  });
1250
1250
  let q;
1251
1251
  try {
1252
- if (I && f && b !== "get" && b !== "head" && (q = await v(L, w)) !== 0) {
1252
+ if (I && f && b !== "get" && b !== "head" && (q = await v(F, w)) !== 0) {
1253
1253
  let O = new n(h, {
1254
1254
  method: "POST",
1255
1255
  body: w,
1256
1256
  duplex: "half"
1257
- }), X;
1258
- if (S.isFormData(w) && (X = O.headers.get("content-type")) && L.setContentType(X), O.body) {
1259
- const [$, z] = ds(
1257
+ }), Y;
1258
+ if (S.isFormData(w) && (Y = O.headers.get("content-type")) && F.setContentType(Y), O.body) {
1259
+ const [M, z] = ds(
1260
1260
  q,
1261
1261
  Ln(fs(I))
1262
1262
  );
1263
- w = hs(O.body, ms, $, z);
1263
+ w = hs(O.body, ms, M, z);
1264
1264
  }
1265
1265
  }
1266
- S.isString(k) || (k = k ? "include" : "omit");
1267
- const F = s && "credentials" in n.prototype, G = {
1268
- ...D,
1266
+ S.isString(D) || (D = D ? "include" : "omit");
1267
+ const $ = s && "credentials" in n.prototype, G = {
1268
+ ...L,
1269
1269
  signal: K,
1270
1270
  method: b.toUpperCase(),
1271
- headers: L.normalize().toJSON(),
1271
+ headers: F.normalize().toJSON(),
1272
1272
  body: w,
1273
1273
  duplex: "half",
1274
- credentials: F ? k : void 0
1274
+ credentials: $ ? D : void 0
1275
1275
  };
1276
1276
  W = s && new n(h, G);
1277
- let T = await (s ? j(W, D) : j(h, G));
1277
+ let T = await (s ? j(W, L) : j(h, G));
1278
1278
  const P = d && (N === "stream" || N === "response");
1279
1279
  if (d && (C || P && B)) {
1280
1280
  const O = {};
1281
1281
  ["status", "statusText", "headers"].forEach((le) => {
1282
1282
  O[le] = T[le];
1283
1283
  });
1284
- const X = S.toFiniteNumber(T.headers.get("content-length")), [$, z] = C && ds(
1285
- X,
1284
+ const Y = S.toFiniteNumber(T.headers.get("content-length")), [M, z] = C && ds(
1285
+ Y,
1286
1286
  Ln(fs(C), !0)
1287
1287
  ) || [];
1288
1288
  T = new r(
1289
- hs(T.body, ms, $, () => {
1289
+ hs(T.body, ms, M, () => {
1290
1290
  z && z(), B && B();
1291
1291
  }),
1292
1292
  O
@@ -1294,8 +1294,8 @@ const Ia = (e) => {
1294
1294
  }
1295
1295
  N = N || "text";
1296
1296
  let _ = await p[S.findKey(p, N) || "text"](T, m);
1297
- return !P && B && B(), await new Promise((O, X) => {
1298
- Pa(O, X, {
1297
+ return !P && B && B(), await new Promise((O, Y) => {
1298
+ Pa(O, Y, {
1299
1299
  data: _,
1300
1300
  headers: Te.from(T.headers),
1301
1301
  status: T.status,
@@ -1304,13 +1304,13 @@ const Ia = (e) => {
1304
1304
  request: W
1305
1305
  });
1306
1306
  });
1307
- } catch (F) {
1308
- throw B && B(), F && F.name === "TypeError" && /Load failed|fetch/i.test(F.message) ? Object.assign(
1307
+ } catch ($) {
1308
+ throw B && B(), $ && $.name === "TypeError" && /Load failed|fetch/i.test($.message) ? Object.assign(
1309
1309
  new ee("Network Error", ee.ERR_NETWORK, m, W),
1310
1310
  {
1311
- cause: F.cause || F
1311
+ cause: $.cause || $
1312
1312
  }
1313
- ) : ee.from(F, F && F.code, m, W);
1313
+ ) : ee.from($, $ && $.code, m, W);
1314
1314
  }
1315
1315
  };
1316
1316
  }, Of = /* @__PURE__ */ new Map(), Oa = (e) => {
@@ -1342,7 +1342,7 @@ S.forEach(Gr, (e, t) => {
1342
1342
  Object.defineProperty(e, "adapterName", { value: t });
1343
1343
  }
1344
1344
  });
1345
- const ws = (e) => `- ${e}`, kf = (e) => S.isFunction(e) || e === null || e === !1, ka = {
1345
+ const ws = (e) => `- ${e}`, Mf = (e) => S.isFunction(e) || e === null || e === !1, Ma = {
1346
1346
  getAdapter: (e, t) => {
1347
1347
  e = S.isArray(e) ? e : [e];
1348
1348
  const { length: n } = e;
@@ -1351,7 +1351,7 @@ const ws = (e) => `- ${e}`, kf = (e) => S.isFunction(e) || e === null || e === !
1351
1351
  for (let a = 0; a < n; a++) {
1352
1352
  r = e[a];
1353
1353
  let i;
1354
- if (o = r, !kf(r) && (o = Gr[(i = String(r)).toLowerCase()], o === void 0))
1354
+ if (o = r, !Mf(r) && (o = Gr[(i = String(r)).toLowerCase()], o === void 0))
1355
1355
  throw new ee(`Unknown adapter '${i}'`);
1356
1356
  if (o && (S.isFunction(o) || (o = o.get(t))))
1357
1357
  break;
@@ -1381,7 +1381,7 @@ function ys(e) {
1381
1381
  return Nr(e), e.headers = Te.from(e.headers), e.data = Rr.call(
1382
1382
  e,
1383
1383
  e.transformRequest
1384
- ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), ka.getAdapter(e.adapter || cn.adapter, e)(e).then(function(r) {
1384
+ ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Ma.getAdapter(e.adapter || cn.adapter, e)(e).then(function(r) {
1385
1385
  return Nr(e), r.data = Rr.call(
1386
1386
  e,
1387
1387
  e.transformResponse,
@@ -1395,7 +1395,7 @@ function ys(e) {
1395
1395
  ), r.response.headers = Te.from(r.response.headers))), Promise.reject(r);
1396
1396
  });
1397
1397
  }
1398
- const Ma = "1.12.2", Qn = {};
1398
+ const ka = "1.12.2", Qn = {};
1399
1399
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1400
1400
  Qn[e] = function(r) {
1401
1401
  return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
@@ -1404,7 +1404,7 @@ const Ma = "1.12.2", Qn = {};
1404
1404
  const xs = {};
1405
1405
  Qn.transitional = function(t, n, r) {
1406
1406
  function o(s, a) {
1407
- return "[Axios v" + Ma + "] Transitional option '" + s + "'" + a + (r ? ". " + r : "");
1407
+ return "[Axios v" + ka + "] Transitional option '" + s + "'" + a + (r ? ". " + r : "");
1408
1408
  }
1409
1409
  return (s, a, i) => {
1410
1410
  if (t === !1)
@@ -1423,7 +1423,7 @@ Qn.transitional = function(t, n, r) {
1423
1423
  Qn.spelling = function(t) {
1424
1424
  return (n, r) => (console.warn(`${r} is likely a misspelling of ${t}`), !0);
1425
1425
  };
1426
- function Mf(e, t, n) {
1426
+ function kf(e, t, n) {
1427
1427
  if (typeof e != "object")
1428
1428
  throw new ee("options must be an object", ee.ERR_BAD_OPTION_VALUE);
1429
1429
  const r = Object.keys(e);
@@ -1441,7 +1441,7 @@ function Mf(e, t, n) {
1441
1441
  }
1442
1442
  }
1443
1443
  const En = {
1444
- assertOptions: Mf,
1444
+ assertOptions: kf,
1445
1445
  validators: Qn
1446
1446
  }, He = En.validators;
1447
1447
  let dt = class {
@@ -1723,26 +1723,26 @@ function La(e) {
1723
1723
  return La(ft(e, o));
1724
1724
  }, n;
1725
1725
  }
1726
- const me = La(cn);
1727
- me.Axios = dt;
1728
- me.CanceledError = Ft;
1729
- me.CancelToken = Df;
1730
- me.isCancel = Aa;
1731
- me.VERSION = Ma;
1732
- me.toFormData = Zn;
1733
- me.AxiosError = ee;
1734
- me.Cancel = me.CanceledError;
1735
- me.all = function(t) {
1726
+ const ge = La(cn);
1727
+ ge.Axios = dt;
1728
+ ge.CanceledError = Ft;
1729
+ ge.CancelToken = Df;
1730
+ ge.isCancel = Aa;
1731
+ ge.VERSION = ka;
1732
+ ge.toFormData = Zn;
1733
+ ge.AxiosError = ee;
1734
+ ge.Cancel = ge.CanceledError;
1735
+ ge.all = function(t) {
1736
1736
  return Promise.all(t);
1737
1737
  };
1738
- me.spread = Lf;
1739
- me.isAxiosError = Ff;
1740
- me.mergeConfig = ft;
1741
- me.AxiosHeaders = Te;
1742
- me.formToJSON = (e) => Ta(S.isHTMLForm(e) ? new FormData(e) : e);
1743
- me.getAdapter = ka.getAdapter;
1744
- me.HttpStatusCode = qr;
1745
- me.default = me;
1738
+ ge.spread = Lf;
1739
+ ge.isAxiosError = Ff;
1740
+ ge.mergeConfig = ft;
1741
+ ge.AxiosHeaders = Te;
1742
+ ge.formToJSON = (e) => Ta(S.isHTMLForm(e) ? new FormData(e) : e);
1743
+ ge.getAdapter = Ma.getAdapter;
1744
+ ge.HttpStatusCode = qr;
1745
+ ge.default = ge;
1746
1746
  const {
1747
1747
  Axios: oy,
1748
1748
  AxiosError: sy,
@@ -1760,7 +1760,7 @@ const {
1760
1760
  formToJSON: by,
1761
1761
  getAdapter: vy,
1762
1762
  mergeConfig: wy
1763
- } = me, Tr = {};
1763
+ } = ge, Tr = {};
1764
1764
  function Gt() {
1765
1765
  var e;
1766
1766
  try {
@@ -1782,7 +1782,7 @@ function Cs(e) {
1782
1782
  function $f(e) {
1783
1783
  return Xr.add(e), () => Xr.delete(e);
1784
1784
  }
1785
- const Ge = me.create({
1785
+ const Ge = ge.create({
1786
1786
  baseURL: Fa || "http://localhost:8000",
1787
1787
  // Fallback base URL
1788
1788
  timeout: 3e4,
@@ -1952,7 +1952,7 @@ function Hf(e = {}) {
1952
1952
  m.current && (m.current.abort(), m.current = null), i(!0), f(null), e.autoAppendAssistant !== !1 && p("");
1953
1953
  const I = new AbortController();
1954
1954
  return m.current = I, (async () => {
1955
- var k, D, j, K;
1955
+ var D, L, j, K;
1956
1956
  const N = (() => {
1957
1957
  var W;
1958
1958
  try {
@@ -1960,13 +1960,13 @@ function Hf(e = {}) {
1960
1960
  } catch {
1961
1961
  return !1;
1962
1962
  }
1963
- })(), L = (W) => {
1963
+ })(), F = (W) => {
1964
1964
  var B;
1965
1965
  try {
1966
1966
  const q = JSON.parse(JSON.stringify(W));
1967
- return (B = q == null ? void 0 : q.payload) != null && B.files_info && Array.isArray(q.payload.files_info) && (q.payload.files_info = q.payload.files_info.map((F) => ({
1968
- ...F,
1969
- data: F != null && F.data ? `<base64 ${String(F.data).length} chars>` : F == null ? void 0 : F.data
1967
+ return (B = q == null ? void 0 : q.payload) != null && B.files_info && Array.isArray(q.payload.files_info) && (q.payload.files_info = q.payload.files_info.map(($) => ({
1968
+ ...$,
1969
+ data: $ != null && $.data ? `<base64 ${String($.data).length} chars>` : $ == null ? void 0 : $.data
1970
1970
  }))), q;
1971
1971
  } catch {
1972
1972
  return W;
@@ -1978,19 +1978,19 @@ function Hf(e = {}) {
1978
1978
  if (r)
1979
1979
  W = { Authorization: `Bearer ${r}` };
1980
1980
  else if (typeof window < "u") {
1981
- const P = window.__AUTH_TOKEN__, _ = ((k = window.localStorage) == null ? void 0 : k.getItem("authToken")) || null;
1981
+ const P = window.__AUTH_TOKEN__, _ = ((D = window.localStorage) == null ? void 0 : D.getItem("authToken")) || null;
1982
1982
  let O = null;
1983
1983
  try {
1984
- const $ = (D = window.localStorage) == null ? void 0 : D.getItem("chat-settings");
1985
- $ && (O = ((j = JSON.parse($)) == null ? void 0 : j.apiKey) || null);
1984
+ const M = (L = window.localStorage) == null ? void 0 : L.getItem("chat-settings");
1985
+ M && (O = ((j = JSON.parse(M)) == null ? void 0 : j.apiKey) || null);
1986
1986
  } catch {
1987
1987
  }
1988
- const X = P || _ || O || null;
1989
- X && (W = { Authorization: `Bearer ${X}` });
1988
+ const Y = P || _ || O || null;
1989
+ Y && (W = { Authorization: `Bearer ${Y}` });
1990
1990
  }
1991
1991
  } catch {
1992
1992
  }
1993
- N && console.debug("[use-chat] POST", t + n, L(x));
1993
+ N && console.debug("[use-chat] POST", t + n, F(x));
1994
1994
  const B = await fetch(t + n, {
1995
1995
  method: "POST",
1996
1996
  headers: {
@@ -2006,33 +2006,33 @@ function Hf(e = {}) {
2006
2006
  const T = await B.text().catch(() => "");
2007
2007
  throw N && console.debug("[use-chat] non-OK response", B.status, T == null ? void 0 : T.slice(0, 500)), new Error(`stream ${B.status}${T ? ": " + T : ""}`);
2008
2008
  }
2009
- const q = B.body.getReader(), F = new TextDecoder();
2009
+ const q = B.body.getReader(), $ = new TextDecoder();
2010
2010
  let G = "";
2011
2011
  for (; ; ) {
2012
2012
  const { value: T, done: P } = await q.read();
2013
2013
  if (P) break;
2014
- G += F.decode(T, { stream: !0 });
2014
+ G += $.decode(T, { stream: !0 });
2015
2015
  let _;
2016
2016
  for (; (_ = G.indexOf(`
2017
2017
 
2018
2018
  `)) >= 0; ) {
2019
2019
  const O = G.slice(0, _);
2020
2020
  G = G.slice(_ + 2);
2021
- const X = Vf(O);
2022
- if (!X) continue;
2023
- let $;
2021
+ const Y = Vf(O);
2022
+ if (!Y) continue;
2023
+ let M;
2024
2024
  try {
2025
- $ = JSON.parse(X);
2025
+ M = JSON.parse(Y);
2026
2026
  } catch {
2027
- N && console.debug("[use-chat] skip malformed SSE data:", X == null ? void 0 : X.slice(0, 200));
2027
+ N && console.debug("[use-chat] skip malformed SSE data:", Y == null ? void 0 : Y.slice(0, 200));
2028
2028
  continue;
2029
2029
  }
2030
- const z = Wf($) ? $.data : $;
2030
+ const z = Wf(M) ? M.data : M;
2031
2031
  if (N && console.debug("[use-chat] event:", z == null ? void 0 : z.type, z), E == null || E(z), z.type === "token")
2032
2032
  e.autoAppendAssistant !== !1 && p((le) => le + z.content);
2033
2033
  else if (z.type === "message_delta") {
2034
- const le = z.delta.filter((ae) => ae.type === "text").map((ae) => ae.text).join("");
2035
- le && e.autoAppendAssistant !== !1 && p((ae) => ae + le);
2034
+ const le = z.delta.filter((se) => se.type === "text").map((se) => se.text).join("");
2035
+ le && e.autoAppendAssistant !== !1 && p((se) => se + le);
2036
2036
  } else z.type === "checkpoint" ? v(z.checkpointId) : z.type === "error" && f(z.message);
2037
2037
  }
2038
2038
  }
@@ -2274,21 +2274,21 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2274
2274
  }, [N]), we(() => {
2275
2275
  r == null || r(C);
2276
2276
  }, [C, r]);
2277
- const L = rt(null);
2277
+ const F = rt(null);
2278
2278
  we(() => {
2279
- o && L.current !== o && (L.current = o, D(o).catch(() => {
2279
+ o && F.current !== o && (F.current = o, L(o).catch(() => {
2280
2280
  }));
2281
2281
  }, [o]);
2282
- const k = rt(null), D = Ce(
2283
- async (_, O, X) => {
2284
- var $;
2285
- if (k.current !== _) {
2286
- k.current = _;
2282
+ const D = rt(null), L = Ce(
2283
+ async (_, O, Y) => {
2284
+ var M;
2285
+ if (D.current !== _) {
2286
+ D.current = _;
2287
2287
  try {
2288
- const z = O ?? (($ = (await s.listCheckpoints(_)).checkpoints.slice().sort((ae, V) => new Date(V.createdAt).getTime() - new Date(ae.createdAt).getTime())[0]) == null ? void 0 : $.checkpointId), le = await s.getMessages({ threadId: _, checkpointId: z, checkpointNs: X });
2288
+ const z = O ?? ((M = (await s.listCheckpoints(_)).checkpoints.slice().sort((se, V) => new Date(V.createdAt).getTime() - new Date(se.createdAt).getTime())[0]) == null ? void 0 : M.checkpointId), le = await s.getMessages({ threadId: _, checkpointId: z, checkpointNs: Y });
2289
2289
  I(_), h(le.messages);
2290
2290
  } finally {
2291
- k.current = null;
2291
+ D.current = null;
2292
2292
  }
2293
2293
  }
2294
2294
  },
@@ -2299,16 +2299,16 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2299
2299
  h(O.messages);
2300
2300
  }, [s, C, h]), W = Ce(async () => {
2301
2301
  if (!C) throw new Error("No active thread");
2302
- await D(C);
2303
- }, [C, D]), B = rt(!1);
2302
+ await L(C);
2303
+ }, [C, L]), B = rt(!1);
2304
2304
  we(() => {
2305
2305
  const _ = B.current;
2306
2306
  if (B.current = a, _ && !a && C) {
2307
2307
  const O = m.lastCheckpointId ?? void 0;
2308
2308
  (async () => {
2309
2309
  try {
2310
- const X = await s.getMessages({ threadId: C, checkpointId: O });
2311
- h(X.messages);
2310
+ const Y = await s.getMessages({ threadId: C, checkpointId: O });
2311
+ h(Y.messages);
2312
2312
  } catch {
2313
2313
  }
2314
2314
  try {
@@ -2320,40 +2320,40 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2320
2320
  }, [a, C, m.lastCheckpointId, s, h, N]);
2321
2321
  const q = Ce(async (_) => {
2322
2322
  const O = await s.createThread(_);
2323
- return await N(), await D(O.threadId), O.threadId;
2324
- }, [s, N, D]), F = Ce(async (_) => {
2323
+ return await N(), await L(O.threadId), O.threadId;
2324
+ }, [s, N, L]), $ = Ce(async (_) => {
2325
2325
  await s.deleteThread(_), await N(), C === _ && (I(null), y([]));
2326
2326
  }, [s, N, C, y]), G = Ce(async (_, O) => {
2327
2327
  await s.updateThread(_, O), await N();
2328
2328
  }, [s, N]), T = Ce(async (_, O) => {
2329
- var se;
2329
+ var oe;
2330
2330
  if (!C) throw new Error("No active thread");
2331
- async function X(H) {
2331
+ async function Y(H) {
2332
2332
  return await new Promise((Z, de) => {
2333
- const pe = new FileReader();
2334
- pe.onload = () => Z(String(pe.result)), pe.onerror = (Y) => de(Y), pe.readAsDataURL(H);
2333
+ const he = new FileReader();
2334
+ he.onload = () => Z(String(he.result)), he.onerror = (me) => de(me), he.readAsDataURL(H);
2335
2335
  });
2336
2336
  }
2337
- async function $(H) {
2337
+ async function M(H) {
2338
2338
  return await new Promise((Z, de) => {
2339
- const pe = new FileReader();
2340
- pe.onload = () => {
2339
+ const he = new FileReader();
2340
+ he.onload = () => {
2341
2341
  try {
2342
- const Y = pe.result;
2343
- let ge = "";
2344
- const te = new Uint8Array(Y), he = te.byteLength;
2345
- for (let ve = 0; ve < he; ve++) ge += String.fromCharCode(te[ve]);
2346
- Z(btoa(ge));
2347
- } catch (Y) {
2348
- de(Y);
2342
+ const me = he.result;
2343
+ let Q = "";
2344
+ const ve = new Uint8Array(me), ae = ve.byteLength;
2345
+ for (let fe = 0; fe < ae; fe++) Q += String.fromCharCode(ve[fe]);
2346
+ Z(btoa(Q));
2347
+ } catch (me) {
2348
+ de(me);
2349
2349
  }
2350
- }, pe.onerror = (Y) => de(Y), pe.readAsArrayBuffer(H);
2350
+ }, he.onerror = (me) => de(me), he.readAsArrayBuffer(H);
2351
2351
  });
2352
2352
  }
2353
2353
  const z = [];
2354
2354
  _ && z.push({ type: "text", text: _ });
2355
2355
  const le = (O == null ? void 0 : O.attachments) || [];
2356
- let ae = [];
2356
+ let se = [];
2357
2357
  if (le.length > 0)
2358
2358
  for (const H of le)
2359
2359
  if (H.type && H.type.startsWith("image/")) {
@@ -2365,7 +2365,7 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2365
2365
  }
2366
2366
  if (!Z)
2367
2367
  try {
2368
- Z = await X(H);
2368
+ Z = await Y(H);
2369
2369
  } catch {
2370
2370
  Z = null;
2371
2371
  }
@@ -2374,34 +2374,34 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2374
2374
  z.push(de);
2375
2375
  }
2376
2376
  try {
2377
- ae.push({ filename: H.name, data: await $(H), mime_type: H.type || "application/octet-stream" });
2377
+ se.push({ filename: H.name, data: await M(H), mime_type: H.type || "application/octet-stream" });
2378
2378
  } catch {
2379
2379
  }
2380
2380
  } else {
2381
- const Z = await X(H).catch(() => null), de = { type: "file", url: String(Z), mimeType: H.type || void 0, name: H.name, size: H.size };
2381
+ const Z = await Y(H).catch(() => null), de = { type: "file", url: String(Z), mimeType: H.type || void 0, name: H.name, size: H.size };
2382
2382
  z.push(de);
2383
2383
  try {
2384
- ae.push({ filename: H.name, data: await $(H), mime_type: H.type || "application/octet-stream" });
2384
+ se.push({ filename: H.name, data: await M(H), mime_type: H.type || "application/octet-stream" });
2385
2385
  } catch {
2386
2386
  }
2387
2387
  }
2388
2388
  const V = {
2389
- id: ((se = crypto.randomUUID) == null ? void 0 : se.call(crypto)) || `user-${Date.now()}`,
2389
+ id: ((oe = crypto.randomUUID) == null ? void 0 : oe.call(crypto)) || `user-${Date.now()}`,
2390
2390
  role: "user",
2391
2391
  content: z,
2392
2392
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2393
2393
  checkpointId: (O == null ? void 0 : O.checkpointId) ?? m.lastCheckpointId ?? void 0
2394
2394
  };
2395
2395
  b(V);
2396
- const oe = {
2396
+ const re = {
2397
2397
  ...V,
2398
2398
  content: V.content.filter((H) => H.type === "text" || H.type === "image_url")
2399
2399
  }, ie = {
2400
2400
  threadId: C,
2401
2401
  payload: {
2402
- messages: [oe],
2402
+ messages: [re],
2403
2403
  attachments: V.content.filter((H) => H.type === "file").map((H) => ({ type: "file", url: H.url, mimeType: H.mimeType, name: H.name, size: H.size })),
2404
- files_info: ae,
2404
+ files_info: se,
2405
2405
  ...(O == null ? void 0 : O.payloadExtras) ?? {}
2406
2406
  },
2407
2407
  checkpointId: (O == null ? void 0 : O.checkpointId) ?? m.lastCheckpointId ?? void 0,
@@ -2425,9 +2425,9 @@ function Rn({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2425
2425
  streamingAssistantId: m.assemblingId,
2426
2426
  refreshThreads: N,
2427
2427
  createThread: q,
2428
- deleteThread: F,
2428
+ deleteThread: $,
2429
2429
  renameThread: G,
2430
- loadThread: D,
2430
+ loadThread: L,
2431
2431
  listCheckpoints: j,
2432
2432
  navigateToCheckpoint: K,
2433
2433
  returnToLatest: W,
@@ -2468,7 +2468,7 @@ const Zf = rn(
2468
2468
  size: "default"
2469
2469
  }
2470
2470
  }
2471
- ), fe = l.forwardRef(
2471
+ ), pe = l.forwardRef(
2472
2472
  ({ className: e, variant: t, size: n, asChild: r = !1, ...o }, s) => /* @__PURE__ */ c(
2473
2473
  r ? Dt : "button",
2474
2474
  {
@@ -2478,7 +2478,7 @@ const Zf = rn(
2478
2478
  }
2479
2479
  )
2480
2480
  );
2481
- fe.displayName = "Button";
2481
+ pe.displayName = "Button";
2482
2482
  const za = l.forwardRef(
2483
2483
  ({ className: e, ...t }, n) => /* @__PURE__ */ c(
2484
2484
  "textarea",
@@ -2653,7 +2653,7 @@ function wo(...e) {
2653
2653
  };
2654
2654
  };
2655
2655
  }
2656
- function ne(...e) {
2656
+ function te(...e) {
2657
2657
  return l.useCallback(wo(...e), e);
2658
2658
  }
2659
2659
  var sp = [
@@ -2688,7 +2688,7 @@ function ap(e, t) {
2688
2688
  return l.useReducer((n, r) => t[n][r] ?? n, e);
2689
2689
  }
2690
2690
  var Ae = (e) => {
2691
- const { present: t, children: n } = e, r = ip(t), o = typeof n == "function" ? n({ present: r.isPresent }) : l.Children.only(n), s = ne(r.ref, cp(o));
2691
+ const { present: t, children: n } = e, r = ip(t), o = typeof n == "function" ? n({ present: r.isPresent }) : l.Children.only(n), s = te(r.ref, cp(o));
2692
2692
  return typeof n == "function" || r.isPresent ? l.cloneElement(o, { ref: s }) : null;
2693
2693
  };
2694
2694
  Ae.displayName = "Presence";
@@ -2822,7 +2822,7 @@ var xo = "CollapsibleContent", pp = l.forwardRef(
2822
2822
  );
2823
2823
  pp.displayName = xo;
2824
2824
  var hp = l.forwardRef((e, t) => {
2825
- const { __scopeCollapsible: n, present: r, children: o, ...s } = e, a = yo(xo, n), [i, u] = l.useState(r), f = l.useRef(null), d = ne(t, f), p = l.useRef(0), g = p.current, v = l.useRef(0), m = v.current, h = a.open || i, b = l.useRef(h), w = l.useRef(void 0);
2825
+ const { __scopeCollapsible: n, present: r, children: o, ...s } = e, a = yo(xo, n), [i, u] = l.useState(r), f = l.useRef(null), d = te(t, f), p = l.useRef(0), g = p.current, v = l.useRef(0), m = v.current, h = a.open || i, b = l.useRef(h), w = l.useRef(void 0);
2826
2826
  return l.useEffect(() => {
2827
2827
  const y = requestAnimationFrame(() => b.current = !1);
2828
2828
  return () => cancelAnimationFrame(y);
@@ -2887,217 +2887,247 @@ function gp({
2887
2887
  onEdit: C,
2888
2888
  onRegenerate: I,
2889
2889
  onEditFromCheckpoint: N,
2890
- onCancelEdit: L,
2891
- onCopy: k
2890
+ onCancelEdit: F,
2891
+ onCopy: D
2892
2892
  }) {
2893
- const [D, j] = ce(!1), [K, W] = ce(!1), [B, q] = ce(!1), [F, G] = ce(!1), T = u === "phone" || u === "half-screen", P = e.role, _ = P === "tool", O = nt(() => bp(e.content), [e.content]), X = nt(() => Cp(e.content), [e.content]), $ = nt(() => e.content.filter((Y) => Y.type === "image_url"), [e.content]), z = nt(() => e.content.filter((Y) => Y.type === "file"), [e.content]), le = Np(O, n ? r : 0), ae = async () => {
2893
+ const [L, j] = ce(!1), [K, W] = ce(!1), [B, q] = ce(!1), [$, G] = ce(!1), T = u === "phone" || u === "half-screen", P = e.role, _ = P === "tool", O = Je.useMemo(() => {
2894
+ switch (P) {
2895
+ case "user":
2896
+ return "text-[hsl(var(--chat-bubble-user-text))]";
2897
+ case "assistant":
2898
+ return "text-[hsl(var(--chat-bubble-ai-text))]";
2899
+ case "tool":
2900
+ return "text-secondary-foreground";
2901
+ case "system":
2902
+ return "text-muted-foreground";
2903
+ default:
2904
+ return "text-foreground";
2905
+ }
2906
+ }, [P]), Y = nt(() => bp(e.content), [e.content]), M = nt(() => Cp(e.content), [e.content]), z = nt(() => e.content.filter((Q) => Q.type === "image_url"), [e.content]), le = nt(() => e.content.filter((Q) => Q.type === "file"), [e.content]), se = Np(Y, n ? r : 0), V = async () => {
2894
2907
  try {
2895
- const Y = _ ? St(e.content) : O;
2896
- await navigator.clipboard.writeText(Y), j(!0), setTimeout(() => j(!1), 2e3), k == null || k(Y);
2897
- } catch (Y) {
2898
- console.error("Failed to copy:", Y);
2908
+ const Q = _ ? St(e.content) : Y;
2909
+ await navigator.clipboard.writeText(Q), j(!0), setTimeout(() => j(!1), 2e3), D == null || D(Q);
2910
+ } catch (Q) {
2911
+ console.error("Failed to copy:", Q);
2899
2912
  }
2900
- }, V = () => {
2913
+ }, re = () => {
2901
2914
  if (!C) return;
2902
- const Y = _ ? St(e.content) : O;
2903
- C(e.id, Y);
2904
- }, oe = () => I == null ? void 0 : I(t), ie = () => {
2905
- const ge = A(T ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0 text-current dark:text-primary-foreground");
2915
+ const Q = _ ? St(e.content) : Y;
2916
+ C(e.id, Q);
2917
+ }, ie = () => I == null ? void 0 : I(t), oe = () => {
2918
+ const ve = A(T ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", O);
2906
2919
  switch (P) {
2907
2920
  case "user":
2908
- return /* @__PURE__ */ c(Bu, { className: ge });
2921
+ return /* @__PURE__ */ c(Bu, { className: ve });
2909
2922
  case "assistant":
2910
- return /* @__PURE__ */ c(os, { className: ge });
2923
+ return /* @__PURE__ */ c(os, { className: ve });
2911
2924
  case "tool":
2912
- return /* @__PURE__ */ c($u, { className: ge });
2925
+ return /* @__PURE__ */ c($u, { className: ve });
2913
2926
  default:
2914
- return /* @__PURE__ */ c(os, { className: ge });
2927
+ return /* @__PURE__ */ c(os, { className: ve });
2915
2928
  }
2916
- }, se = () => {
2917
- const Y = "group relative mb-4 max-w-full";
2929
+ }, H = () => {
2930
+ const Q = "group relative mb-4 max-w-full";
2918
2931
  switch (P) {
2919
2932
  case "user":
2920
- return A(Y, "flex justify-end");
2933
+ return A(Q, "flex justify-end");
2921
2934
  case "assistant":
2922
2935
  case "tool":
2923
2936
  case "system":
2924
- return A(Y, "flex justify-start");
2937
+ return A(Q, "flex justify-start");
2925
2938
  default:
2926
- return Y;
2939
+ return Q;
2927
2940
  }
2928
- }, H = () => {
2929
- const Y = A(
2941
+ }, Z = () => {
2942
+ const Q = A(
2930
2943
  "rounded-lg px-4 py-3 relative transition-all duration-200 min-w-0 break-words",
2931
2944
  T && "px-3 py-2 text-sm"
2932
2945
  );
2933
2946
  switch (P) {
2934
2947
  case "user":
2935
2948
  return A(
2936
- Y,
2937
- // Ensure width constraints
2949
+ Q,
2938
2950
  "max-w-[95%]",
2939
2951
  u === "phone" && "max-w-[98%]",
2940
- // Light mode: very light blue background with dark text for good contrast.
2941
- // Dark mode: keep the existing primary background + foreground (white text).
2942
- // Use Tailwind's `dark:` variants so the bubble adapts when the document root toggles the `dark` class.
2943
- "bg-blue-50 text-gray-900 dark:bg-primary dark:text-primary-foreground",
2944
- // Subtle blue border in light mode to separate from page background; remove in dark mode to keep the primary look.
2945
- "border border-blue-100 dark:border-transparent"
2952
+ "bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
2953
+ "border border-transparent"
2946
2954
  );
2947
2955
  case "assistant":
2948
2956
  return A(
2949
- Y,
2957
+ Q,
2950
2958
  "max-w-[95%]",
2951
2959
  u === "phone" && "max-w-[98%]",
2952
- // Assistant (AI) messages: white background with dark text in light mode for readability,
2953
- // and a muted/darker background with light text in dark mode.
2954
- "bg-white text-gray-900 border border-gray-200 dark:bg-muted dark:text-muted-foreground dark:border-transparent"
2960
+ "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
2961
+ "border border-border/60 dark:border-border/40"
2955
2962
  );
2956
2963
  case "tool":
2957
- return A(Y, "bg-secondary/50 text-secondary-foreground border border-dashed max-w-[95%]", u === "phone" && "max-w-[98%]");
2964
+ return A(Q, "bg-secondary/50 text-secondary-foreground border border-dashed max-w-[95%]", u === "phone" && "max-w-[98%]");
2958
2965
  case "system":
2959
- return A(Y, "bg-accent/40 text-muted-foreground max-w-[85%] border");
2966
+ return A(Q, "bg-accent/40 text-muted-foreground max-w-[85%] border");
2960
2967
  default:
2961
- return Y;
2968
+ return Q;
2962
2969
  }
2963
- }, Z = (Y) => {
2964
- if (!Y) return "";
2970
+ }, de = (Q) => {
2971
+ if (!Q) return "";
2965
2972
  try {
2966
- return new Date(Y).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2973
+ return new Date(Q).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2967
2974
  } catch {
2968
2975
  return "";
2969
2976
  }
2970
- }, de = () => {
2977
+ }, he = () => {
2971
2978
  if (e.model === "reflection") {
2972
- const te = O.trim(), he = Pr(te);
2973
- if (he && typeof he == "object")
2974
- return /* @__PURE__ */ c(Tp, { data: he });
2979
+ const ae = Y.trim(), fe = Pr(ae);
2980
+ if (fe && typeof fe == "object")
2981
+ return /* @__PURE__ */ c(Tp, { data: fe });
2975
2982
  }
2976
- if (_ && X.name === "get_issues") {
2977
- const te = e.content.find((M) => M.type === "tool_result"), he = (te == null ? void 0 : te.output) ?? St(e.content), ve = Ga(he);
2978
- if (ve) return /* @__PURE__ */ c(Ap, { issues: ve });
2983
+ if (_ && M.name === "get_issues") {
2984
+ const ae = e.content.find((X) => X.type === "tool_result"), fe = (ae == null ? void 0 : ae.output) ?? St(e.content), k = Ga(fe);
2985
+ if (k) return /* @__PURE__ */ c(Ap, { issues: k });
2979
2986
  }
2980
2987
  if (_ && !B) {
2981
- const te = St(e.content).slice(0, 80).replace(/\s+/g, " ");
2988
+ const ae = St(e.content).slice(0, 80).replace(/\s+/g, " ");
2982
2989
  return /* @__PURE__ */ c("div", { className: A("text-xs font-mono opacity-70 flex items-center justify-between gap-2 text-current", T && "text-[10px]"), children: /* @__PURE__ */ R("span", { className: "truncate max-w-full text-current", children: [
2983
- te,
2984
- te.length >= 80 ? "…" : ""
2990
+ ae,
2991
+ ae.length >= 80 ? "…" : ""
2985
2992
  ] }) });
2986
2993
  }
2987
2994
  if (_ && f) {
2988
- const te = St(e.content), he = te.length > d;
2995
+ const ae = St(e.content), fe = ae.length > d;
2989
2996
  return /* @__PURE__ */ c(As, { open: K, onOpenChange: W, children: /* @__PURE__ */ R("div", { className: "font-mono text-sm text-current", children: [
2990
- /* @__PURE__ */ c("pre", { className: A("whitespace-pre-wrap break-words text-current", T && "text-xs"), children: he && !K ? te.substring(0, d) + "..." : te }),
2991
- he && /* @__PURE__ */ c(Ps, { asChild: !0, children: /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", className: "h-6 text-xs text-current", children: K ? /* @__PURE__ */ R(De, { children: [
2997
+ /* @__PURE__ */ c("pre", { className: A("whitespace-pre-wrap break-words text-current", T && "text-xs"), children: fe && !K ? ae.substring(0, d) + "..." : ae }),
2998
+ fe && /* @__PURE__ */ c(Ps, { asChild: !0, children: /* @__PURE__ */ c(pe, { variant: "ghost", size: "sm", className: "h-6 text-xs text-current", children: K ? /* @__PURE__ */ R(De, { children: [
2992
2999
  /* @__PURE__ */ c(Wt, { className: "h-3 w-3 mr-1" }),
2993
3000
  "Show less"
2994
3001
  ] }) : /* @__PURE__ */ R(De, { children: [
2995
3002
  /* @__PURE__ */ c(Tt, { className: "h-3 w-3 mr-1" }),
2996
3003
  "Show more (",
2997
- te.length - d,
3004
+ ae.length - d,
2998
3005
  " chars)"
2999
3006
  ] }) }) })
3000
3007
  ] }) });
3001
3008
  }
3002
3009
  if (_ && B && !f) {
3003
- const te = Sp(e.content);
3004
- if (te && vp(te))
3005
- return /* @__PURE__ */ c(gn, { content: te.trim() });
3006
- const he = St(e.content);
3007
- return /* @__PURE__ */ c("div", { className: "font-mono text-sm text-current", children: /* @__PURE__ */ c("pre", { className: A("whitespace-pre-wrap break-words text-current", T && "text-xs"), children: he }) });
3010
+ const ae = Sp(e.content);
3011
+ if (ae && vp(ae))
3012
+ return /* @__PURE__ */ c(gn, { content: ae.trim() });
3013
+ const fe = St(e.content);
3014
+ return /* @__PURE__ */ c("div", { className: "font-mono text-sm text-current", children: /* @__PURE__ */ c("pre", { className: A("whitespace-pre-wrap break-words text-current", T && "text-xs"), children: fe }) });
3008
3015
  }
3009
- const Y = $.length > 0 && P !== "tool", ge = z.length > 0 && P !== "tool";
3016
+ const Q = z.length > 0 && P !== "tool", ve = le.length > 0 && P !== "tool";
3010
3017
  return /* @__PURE__ */ R("div", { children: [
3011
3018
  n ? /* @__PURE__ */ R("div", { className: "relative", children: [
3012
3019
  (() => {
3013
- const te = Pr(le);
3014
- return te !== null ? /* @__PURE__ */ c(_s, { data: te }) : /* @__PURE__ */ c(gn, { content: yp(wp(le)) });
3020
+ const ae = Pr(se);
3021
+ return ae !== null ? /* @__PURE__ */ c(_s, { data: ae }) : /* @__PURE__ */ c(gn, { content: yp(wp(se)) });
3015
3022
  })(),
3016
3023
  /* @__PURE__ */ c("span", { className: "inline-block w-[6px] h-[14px] align-baseline ml-0.5 bg-foreground/40 animate-pulse", style: { verticalAlign: "text-bottom" } })
3017
3024
  ] }) : (() => {
3018
- const te = Pr(O.trim());
3019
- if (te !== null) return /* @__PURE__ */ c(_s, { data: te });
3025
+ const ae = Pr(Y.trim());
3026
+ if (ae !== null) return /* @__PURE__ */ c(_s, { data: ae });
3020
3027
  if (P === "user" && p) {
3021
- const he = O.trim();
3022
- if (he.length > g)
3023
- return /* @__PURE__ */ R(As, { open: F, onOpenChange: G, children: [
3024
- /* @__PURE__ */ c("div", { className: A("text-sm text-gray-900 dark:text-primary-foreground", T && "text-xs"), children: F ? /* @__PURE__ */ c(gn, { content: he }) : /* @__PURE__ */ R("pre", { className: A("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-gray-900 dark:text-primary-foreground", T && "text-xs"), children: [
3025
- he.substring(0, g),
3028
+ const fe = Y.trim();
3029
+ if (fe.length > g)
3030
+ return /* @__PURE__ */ R(As, { open: $, onOpenChange: G, children: [
3031
+ /* @__PURE__ */ c("div", { className: A("text-sm text-[hsl(var(--chat-bubble-user-text))]", T && "text-xs"), children: $ ? /* @__PURE__ */ c(gn, { content: fe }) : /* @__PURE__ */ R("pre", { className: A("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", T && "text-xs"), children: [
3032
+ fe.substring(0, g),
3026
3033
  "..."
3027
3034
  ] }) }),
3028
- /* @__PURE__ */ c(Ps, { asChild: !0, children: /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", className: "h-6 text-xs !text-gray-900 dark:!text-primary-foreground", children: F ? /* @__PURE__ */ R(De, { children: [
3029
- /* @__PURE__ */ c(Wt, { className: "h-3 w-3 mr-1" }),
3030
- " Show less"
3031
- ] }) : /* @__PURE__ */ R(De, { children: [
3032
- /* @__PURE__ */ c(Tt, { className: "h-3 w-3 mr-1" }),
3033
- " Show more (",
3034
- he.length - g,
3035
- " chars)"
3036
- ] }) }) })
3035
+ /* @__PURE__ */ c(Ps, { asChild: !0, children: /* @__PURE__ */ c(
3036
+ pe,
3037
+ {
3038
+ variant: "ghost",
3039
+ size: "sm",
3040
+ className: "h-6 text-xs !text-[hsl(var(--chat-bubble-user-text))]",
3041
+ children: $ ? /* @__PURE__ */ R(De, { children: [
3042
+ /* @__PURE__ */ c(Wt, { className: "h-3 w-3 mr-1" }),
3043
+ " Show less"
3044
+ ] }) : /* @__PURE__ */ R(De, { children: [
3045
+ /* @__PURE__ */ c(Tt, { className: "h-3 w-3 mr-1" }),
3046
+ " Show more (",
3047
+ fe.length - g,
3048
+ " chars)"
3049
+ ] })
3050
+ }
3051
+ ) })
3037
3052
  ] });
3038
3053
  }
3039
- return /* @__PURE__ */ c(gn, { content: O.trim() });
3054
+ return /* @__PURE__ */ c(gn, { content: Y.trim() });
3040
3055
  })(),
3041
- Y && /* @__PURE__ */ c("div", { className: "mt-2 grid grid-cols-2 gap-2", children: $.map((te, he) => /* @__PURE__ */ R("div", { className: "relative border rounded overflow-hidden", children: [
3042
- /* @__PURE__ */ c("img", { src: te.url, alt: te.alt ?? "image", className: "w-full h-auto" }),
3056
+ Q && /* @__PURE__ */ c("div", { className: "mt-2 grid grid-cols-2 gap-2", children: z.map((ae, fe) => /* @__PURE__ */ R("div", { className: "relative border rounded overflow-hidden", children: [
3057
+ /* @__PURE__ */ c("img", { src: ae.url, alt: ae.alt ?? "image", className: "w-full h-auto" }),
3043
3058
  /* @__PURE__ */ R("div", { className: "absolute top-1 right-1 bg-background/70 rounded px-1 py-0.5 text-[10px] flex items-center gap-1", children: [
3044
3059
  /* @__PURE__ */ c(Uu, { className: "h-3 w-3" }),
3045
3060
  /* @__PURE__ */ c("span", { children: "image" })
3046
3061
  ] })
3047
- ] }, he)) }),
3048
- ge && /* @__PURE__ */ c("div", { className: "mt-2 flex flex-wrap gap-2", children: z.map((te, he) => {
3049
- const ve = te, M = ve.name || "file";
3062
+ ] }, fe)) }),
3063
+ ve && /* @__PURE__ */ c("div", { className: "mt-2 flex flex-wrap gap-2", children: le.map((ae, fe) => {
3064
+ const k = ae, X = k.name || "file";
3050
3065
  return /* @__PURE__ */ R(
3051
3066
  "a",
3052
3067
  {
3053
- href: ve.url,
3054
- download: M,
3068
+ href: k.url,
3069
+ download: X,
3055
3070
  target: "_blank",
3056
3071
  rel: "noreferrer",
3057
3072
  className: "inline-flex items-center gap-2 bg-gray-100 border border-gray-200 rounded px-2 py-1 text-xs hover:bg-gray-200",
3058
- title: M,
3073
+ title: X,
3059
3074
  children: [
3060
3075
  /* @__PURE__ */ c("span", { className: "inline-block w-1.5 h-1.5 rounded-full bg-gray-400" }),
3061
- /* @__PURE__ */ c("span", { className: "truncate max-w-[180px]", children: M })
3076
+ /* @__PURE__ */ c("span", { className: "truncate max-w-[180px]", children: X })
3062
3077
  ]
3063
3078
  },
3064
- he
3079
+ fe
3065
3080
  );
3066
3081
  }) })
3067
3082
  ] });
3068
- }, pe = nt(() => Ep(e), [e]);
3069
- return nt(() => Rp(e, h), [e, h]), /* @__PURE__ */ c("div", { className: A(se(), v.container), children: /* @__PURE__ */ R("div", { className: A(H(), v.content), children: [
3083
+ }, me = nt(() => Ep(e), [e]);
3084
+ return nt(() => Rp(e, h), [e, h]), /* @__PURE__ */ c("div", { className: A(H(), v.container), children: /* @__PURE__ */ R("div", { className: A(Z(), v.content), children: [
3070
3085
  (a || i || _) && /* @__PURE__ */ R(
3071
3086
  "div",
3072
3087
  {
3073
3088
  className: A(
3074
3089
  "flex items-center justify-between mb-2 pb-2 border-b border-current/10",
3075
3090
  T && "mb-1 pb-1",
3091
+ O,
3076
3092
  v.header
3077
3093
  ),
3078
3094
  children: [
3079
3095
  /* @__PURE__ */ R("div", { className: "flex items-center gap-2", children: [
3080
- ie(),
3081
- i && pe && /* @__PURE__ */ c("span", { className: A("font-medium", T ? "text-xs" : "text-sm"), children: pe }),
3082
- _ && X.name && /* @__PURE__ */ R(
3096
+ oe(),
3097
+ i && me && /* @__PURE__ */ c("span", { className: A("font-medium", T ? "text-xs" : "text-sm"), children: me }),
3098
+ _ && M.name && /* @__PURE__ */ R(
3083
3099
  Ha,
3084
3100
  {
3085
3101
  variant: "outline",
3086
- className: A("text-xs flex items-center gap-1 cursor-pointer text-current", T && "text-xs h-4"),
3087
- onClick: () => q((Y) => !Y),
3102
+ className: A(
3103
+ "text-xs flex items-center gap-1 cursor-pointer",
3104
+ O,
3105
+ "border border-current/40",
3106
+ T && "text-xs h-4"
3107
+ ),
3108
+ onClick: () => q((Q) => !Q),
3088
3109
  children: [
3089
- /* @__PURE__ */ c("span", { children: X.name }),
3110
+ /* @__PURE__ */ c("span", { children: M.name }),
3090
3111
  /* @__PURE__ */ c("span", { className: "inline-flex items-center", children: B ? /* @__PURE__ */ c(Wt, { className: "h-3 w-3" }) : /* @__PURE__ */ c(Tt, { className: "h-3 w-3" }) })
3091
3112
  ]
3092
3113
  }
3093
3114
  ),
3094
- _ && !X.name && /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", className: "h-6 px-1 text-current", onClick: () => q((Y) => !Y), children: /* @__PURE__ */ R("span", { className: "text-xs flex items-center gap-1", children: [
3095
- "Tool Output ",
3096
- B ? /* @__PURE__ */ c(Wt, { className: "h-3 w-3" }) : /* @__PURE__ */ c(Tt, { className: "h-3 w-3" })
3097
- ] }) })
3115
+ _ && !M.name && /* @__PURE__ */ c(
3116
+ pe,
3117
+ {
3118
+ variant: "ghost",
3119
+ size: "sm",
3120
+ className: A("h-6 px-1", O, "hover:bg-foreground/10"),
3121
+ onClick: () => q((Q) => !Q),
3122
+ children: /* @__PURE__ */ R("span", { className: "text-xs flex items-center gap-1", children: [
3123
+ "Tool Output ",
3124
+ B ? /* @__PURE__ */ c(Wt, { className: "h-3 w-3" }) : /* @__PURE__ */ c(Tt, { className: "h-3 w-3" })
3125
+ ] })
3126
+ }
3127
+ )
3098
3128
  ] }),
3099
3129
  /* @__PURE__ */ R("div", { className: "flex items-center gap-2", children: [
3100
- a && /* @__PURE__ */ c("span", { className: A("text-xs opacity-60", T && "text-xs"), children: Z(e.createdAt) }),
3130
+ a && /* @__PURE__ */ c("span", { className: A("text-xs opacity-60", O, T && "text-xs"), children: de(e.createdAt) }),
3101
3131
  s && !o && /* @__PURE__ */ R(
3102
3132
  "div",
3103
3133
  {
@@ -3108,33 +3138,41 @@ function gp({
3108
3138
  ),
3109
3139
  children: [
3110
3140
  /* @__PURE__ */ c(
3111
- fe,
3141
+ pe,
3112
3142
  {
3113
3143
  variant: "ghost",
3114
3144
  size: "sm",
3115
- onClick: ae,
3116
- className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3117
- children: /* @__PURE__ */ c(ns, { className: A(D ? "text-success" : "text-current", T ? "h-3 w-3" : "h-4 w-4") })
3145
+ onClick: V,
3146
+ className: A("h-6 w-6 p-0 hover:bg-foreground/10", O, T && "h-5 w-5"),
3147
+ children: /* @__PURE__ */ c(
3148
+ ns,
3149
+ {
3150
+ className: A(
3151
+ L ? "text-success" : O,
3152
+ T ? "h-3 w-3" : "h-4 w-4"
3153
+ )
3154
+ }
3155
+ )
3118
3156
  }
3119
3157
  ),
3120
3158
  P === "user" && C && /* @__PURE__ */ c(
3121
- fe,
3159
+ pe,
3122
3160
  {
3123
3161
  variant: "ghost",
3124
3162
  size: "sm",
3125
- onClick: V,
3126
- className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3127
- children: /* @__PURE__ */ c(rs, { className: A("text-current", T ? "h-3 w-3" : "h-4 w-4") })
3163
+ onClick: re,
3164
+ className: A("h-6 w-6 p-0 hover:bg-foreground/10", O, T && "h-5 w-5"),
3165
+ children: /* @__PURE__ */ c(rs, { className: A(O, T ? "h-3 w-3" : "h-4 w-4") })
3128
3166
  }
3129
3167
  ),
3130
3168
  P === "assistant" && I && /* @__PURE__ */ c(
3131
- fe,
3169
+ pe,
3132
3170
  {
3133
3171
  variant: "ghost",
3134
3172
  size: "sm",
3135
- onClick: oe,
3136
- className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3137
- children: /* @__PURE__ */ c(Wr, { className: A("text-current", T ? "h-3 w-3" : "h-4 w-4") })
3173
+ onClick: ie,
3174
+ className: A("h-6 w-6 p-0 hover:bg-foreground/10", O, T && "h-5 w-5"),
3175
+ children: /* @__PURE__ */ c(Wr, { className: A(O, T ? "h-3 w-3" : "h-4 w-4") })
3138
3176
  }
3139
3177
  )
3140
3178
  ]
@@ -3144,15 +3182,15 @@ function gp({
3144
3182
  ]
3145
3183
  }
3146
3184
  ),
3147
- /* @__PURE__ */ c("div", { className: "relative", children: de() }),
3148
- _ && B && (X.toolCallId || X.name) && /* @__PURE__ */ R("div", { className: A("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", T && "text-xs"), children: [
3149
- X.name && /* @__PURE__ */ R("div", { children: [
3185
+ /* @__PURE__ */ c("div", { className: "relative", children: he() }),
3186
+ _ && B && (M.toolCallId || M.name) && /* @__PURE__ */ R("div", { className: A("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", T && "text-xs"), children: [
3187
+ M.name && /* @__PURE__ */ R("div", { children: [
3150
3188
  "Function: ",
3151
- X.name
3189
+ M.name
3152
3190
  ] }),
3153
- X.toolCallId && /* @__PURE__ */ R("div", { children: [
3191
+ M.toolCallId && /* @__PURE__ */ R("div", { children: [
3154
3192
  "Call ID: ",
3155
- X.toolCallId
3193
+ M.toolCallId
3156
3194
  ] })
3157
3195
  ] }),
3158
3196
  s && P === "user" && y && y.totalBranches > 1 && /* @__PURE__ */ R("div", { className: "flex items-center gap-2 mt-2 p-2 bg-muted/30 rounded border", children: [
@@ -3165,27 +3203,27 @@ function gp({
3165
3203
  ] }),
3166
3204
  /* @__PURE__ */ R("div", { className: "flex items-center gap-1", children: [
3167
3205
  /* @__PURE__ */ c(
3168
- fe,
3206
+ pe,
3169
3207
  {
3170
3208
  variant: "ghost",
3171
3209
  size: "sm",
3172
- className: "h-6 w-6 p-0 text-current",
3210
+ className: A("h-6 w-6 p-0", O),
3173
3211
  disabled: !y.canGoBack,
3174
3212
  onClick: () => x == null ? void 0 : x(),
3175
3213
  title: "Go back to previous branch",
3176
- children: /* @__PURE__ */ c(Fu, { className: "h-3 w-3 text-current" })
3214
+ children: /* @__PURE__ */ c(Fu, { className: A("h-3 w-3", O) })
3177
3215
  }
3178
3216
  ),
3179
3217
  /* @__PURE__ */ c(
3180
- fe,
3218
+ pe,
3181
3219
  {
3182
3220
  variant: "ghost",
3183
3221
  size: "sm",
3184
- className: "h-6 w-6 p-0 text-current",
3222
+ className: A("h-6 w-6 p-0", O),
3185
3223
  disabled: !y.canGoForward,
3186
3224
  onClick: () => E == null ? void 0 : E(),
3187
3225
  title: "Go forward to next branch",
3188
- children: /* @__PURE__ */ c(da, { className: "h-3 w-3 text-current" })
3226
+ children: /* @__PURE__ */ c(da, { className: A("h-3 w-3", O) })
3189
3227
  }
3190
3228
  )
3191
3229
  ] })
@@ -3200,31 +3238,31 @@ function gp({
3200
3238
  ),
3201
3239
  children: [
3202
3240
  /* @__PURE__ */ c(
3203
- fe,
3241
+ pe,
3204
3242
  {
3205
3243
  variant: "ghost",
3206
3244
  size: "sm",
3207
- onClick: ae,
3245
+ onClick: V,
3208
3246
  className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3209
- children: /* @__PURE__ */ c(ns, { className: A(D ? "text-success" : "text-current", T ? "h-3 w-3" : "h-4 w-4") })
3247
+ children: /* @__PURE__ */ c(ns, { className: A(L ? "text-success" : "text-current", T ? "h-3 w-3" : "h-4 w-4") })
3210
3248
  }
3211
3249
  ),
3212
3250
  P === "user" && C && /* @__PURE__ */ c(
3213
- fe,
3251
+ pe,
3214
3252
  {
3215
3253
  variant: "ghost",
3216
3254
  size: "sm",
3217
- onClick: V,
3255
+ onClick: re,
3218
3256
  className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3219
3257
  children: /* @__PURE__ */ c(rs, { className: A("text-current", T ? "h-3 w-3" : "h-4 w-4") })
3220
3258
  }
3221
3259
  ),
3222
3260
  P === "assistant" && I && /* @__PURE__ */ c(
3223
- fe,
3261
+ pe,
3224
3262
  {
3225
3263
  variant: "ghost",
3226
3264
  size: "sm",
3227
- onClick: oe,
3265
+ onClick: ie,
3228
3266
  className: A("h-6 w-6 p-0 hover:bg-background/50 text-current", T && "h-5 w-5"),
3229
3267
  children: /* @__PURE__ */ c(Wr, { className: A("text-current", T ? "h-3 w-3" : "h-4 w-4") })
3230
3268
  }
@@ -3479,27 +3517,27 @@ function Co(e) {
3479
3517
  t,
3480
3518
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
3481
3519
  ), a = (h) => {
3482
- const { scope: b, children: w } = h, y = Qe.useRef(null), x = Qe.useRef(/* @__PURE__ */ new Map()).current;
3520
+ const { scope: b, children: w } = h, y = Je.useRef(null), x = Je.useRef(/* @__PURE__ */ new Map()).current;
3483
3521
  return /* @__PURE__ */ c(o, { scope: b, itemMap: x, collectionRef: y, children: w });
3484
3522
  };
3485
3523
  a.displayName = t;
3486
- const i = e + "CollectionSlot", u = _t(i), f = Qe.forwardRef(
3524
+ const i = e + "CollectionSlot", u = _t(i), f = Je.forwardRef(
3487
3525
  (h, b) => {
3488
- const { scope: w, children: y } = h, x = s(i, w), E = ne(b, x.collectionRef);
3526
+ const { scope: w, children: y } = h, x = s(i, w), E = te(b, x.collectionRef);
3489
3527
  return /* @__PURE__ */ c(u, { ref: E, children: y });
3490
3528
  }
3491
3529
  );
3492
3530
  f.displayName = i;
3493
- const d = e + "CollectionItemSlot", p = "data-radix-collection-item", g = _t(d), v = Qe.forwardRef(
3531
+ const d = e + "CollectionItemSlot", p = "data-radix-collection-item", g = _t(d), v = Je.forwardRef(
3494
3532
  (h, b) => {
3495
- const { scope: w, children: y, ...x } = h, E = Qe.useRef(null), C = ne(b, E), I = s(d, w);
3496
- return Qe.useEffect(() => (I.itemMap.set(E, { ref: E, ...x }), () => void I.itemMap.delete(E))), /* @__PURE__ */ c(g, { [p]: "", ref: C, children: y });
3533
+ const { scope: w, children: y, ...x } = h, E = Je.useRef(null), C = te(b, E), I = s(d, w);
3534
+ return Je.useEffect(() => (I.itemMap.set(E, { ref: E, ...x }), () => void I.itemMap.delete(E))), /* @__PURE__ */ c(g, { [p]: "", ref: C, children: y });
3497
3535
  }
3498
3536
  );
3499
3537
  v.displayName = d;
3500
3538
  function m(h) {
3501
3539
  const b = s(e + "CollectionConsumer", h);
3502
- return Qe.useCallback(() => {
3540
+ return Je.useCallback(() => {
3503
3541
  const y = b.collectionRef.current;
3504
3542
  if (!y) return [];
3505
3543
  const x = Array.from(y.querySelectorAll(`[${p}]`));
@@ -3528,7 +3566,7 @@ function ye(e) {
3528
3566
  return (r = t.current) == null ? void 0 : r.call(t, ...n);
3529
3567
  }, []);
3530
3568
  }
3531
- function kp(e, t = globalThis == null ? void 0 : globalThis.document) {
3569
+ function Mp(e, t = globalThis == null ? void 0 : globalThis.document) {
3532
3570
  const n = ye(e);
3533
3571
  l.useEffect(() => {
3534
3572
  const r = (o) => {
@@ -3537,7 +3575,7 @@ function kp(e, t = globalThis == null ? void 0 : globalThis.document) {
3537
3575
  return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
3538
3576
  }, [n, t]);
3539
3577
  }
3540
- var Mp = "DismissableLayer", Yr = "dismissableLayer.update", Dp = "dismissableLayer.pointerDownOutside", Lp = "dismissableLayer.focusOutside", Is, qa = l.createContext({
3578
+ var kp = "DismissableLayer", Yr = "dismissableLayer.update", Dp = "dismissableLayer.pointerDownOutside", Lp = "dismissableLayer.focusOutside", Is, qa = l.createContext({
3541
3579
  layers: /* @__PURE__ */ new Set(),
3542
3580
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
3543
3581
  branches: /* @__PURE__ */ new Set()
@@ -3551,14 +3589,14 @@ var Mp = "DismissableLayer", Yr = "dismissableLayer.update", Dp = "dismissableLa
3551
3589
  onInteractOutside: a,
3552
3590
  onDismiss: i,
3553
3591
  ...u
3554
- } = e, f = l.useContext(qa), [d, p] = l.useState(null), g = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, v] = l.useState({}), m = ne(t, (N) => p(N)), h = Array.from(f.layers), [b] = [...f.layersWithOutsidePointerEventsDisabled].slice(-1), w = h.indexOf(b), y = d ? h.indexOf(d) : -1, x = f.layersWithOutsidePointerEventsDisabled.size > 0, E = y >= w, C = Bp((N) => {
3555
- const L = N.target, k = [...f.branches].some((D) => D.contains(L));
3556
- !E || k || (o == null || o(N), a == null || a(N), N.defaultPrevented || i == null || i());
3592
+ } = e, f = l.useContext(qa), [d, p] = l.useState(null), g = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, v] = l.useState({}), m = te(t, (N) => p(N)), h = Array.from(f.layers), [b] = [...f.layersWithOutsidePointerEventsDisabled].slice(-1), w = h.indexOf(b), y = d ? h.indexOf(d) : -1, x = f.layersWithOutsidePointerEventsDisabled.size > 0, E = y >= w, C = Bp((N) => {
3593
+ const F = N.target, D = [...f.branches].some((L) => L.contains(F));
3594
+ !E || D || (o == null || o(N), a == null || a(N), N.defaultPrevented || i == null || i());
3557
3595
  }, g), I = Up((N) => {
3558
- const L = N.target;
3559
- [...f.branches].some((D) => D.contains(L)) || (s == null || s(N), a == null || a(N), N.defaultPrevented || i == null || i());
3596
+ const F = N.target;
3597
+ [...f.branches].some((L) => L.contains(F)) || (s == null || s(N), a == null || a(N), N.defaultPrevented || i == null || i());
3560
3598
  }, g);
3561
- return kp((N) => {
3599
+ return Mp((N) => {
3562
3600
  y === f.layers.size - 1 && (r == null || r(N), !N.defaultPrevented && i && (N.preventDefault(), i()));
3563
3601
  }, g), l.useEffect(() => {
3564
3602
  if (d)
@@ -3589,9 +3627,9 @@ var Mp = "DismissableLayer", Yr = "dismissableLayer.update", Dp = "dismissableLa
3589
3627
  );
3590
3628
  }
3591
3629
  );
3592
- ln.displayName = Mp;
3630
+ ln.displayName = kp;
3593
3631
  var Fp = "DismissableLayerBranch", $p = l.forwardRef((e, t) => {
3594
- const n = l.useContext(qa), r = l.useRef(null), o = ne(t, r);
3632
+ const n = l.useContext(qa), r = l.useRef(null), o = te(t, r);
3595
3633
  return l.useEffect(() => {
3596
3634
  const s = r.current;
3597
3635
  if (s)
@@ -3657,23 +3695,23 @@ var _r = 0;
3657
3695
  function Eo() {
3658
3696
  l.useEffect(() => {
3659
3697
  const e = document.querySelectorAll("[data-radix-focus-guard]");
3660
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? ks()), document.body.insertAdjacentElement("beforeend", e[1] ?? ks()), _r++, () => {
3698
+ return document.body.insertAdjacentElement("afterbegin", e[0] ?? Ms()), document.body.insertAdjacentElement("beforeend", e[1] ?? Ms()), _r++, () => {
3661
3699
  _r === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), _r--;
3662
3700
  };
3663
3701
  }, []);
3664
3702
  }
3665
- function ks() {
3703
+ function Ms() {
3666
3704
  const e = document.createElement("span");
3667
3705
  return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
3668
3706
  }
3669
- var Ir = "focusScope.autoFocusOnMount", Or = "focusScope.autoFocusOnUnmount", Ms = { bubbles: !1, cancelable: !0 }, zp = "FocusScope", nr = l.forwardRef((e, t) => {
3707
+ var Ir = "focusScope.autoFocusOnMount", Or = "focusScope.autoFocusOnUnmount", ks = { bubbles: !1, cancelable: !0 }, zp = "FocusScope", nr = l.forwardRef((e, t) => {
3670
3708
  const {
3671
3709
  loop: n = !1,
3672
3710
  trapped: r = !1,
3673
3711
  onMountAutoFocus: o,
3674
3712
  onUnmountAutoFocus: s,
3675
3713
  ...a
3676
- } = e, [i, u] = l.useState(null), f = ye(o), d = ye(s), p = l.useRef(null), g = ne(t, (h) => u(h)), v = l.useRef({
3714
+ } = e, [i, u] = l.useState(null), f = ye(o), d = ye(s), p = l.useRef(null), g = te(t, (h) => u(h)), v = l.useRef({
3677
3715
  paused: !1,
3678
3716
  pause() {
3679
3717
  this.paused = !0;
@@ -3708,12 +3746,12 @@ var Ir = "focusScope.autoFocusOnMount", Or = "focusScope.autoFocusOnUnmount", Ms
3708
3746
  Ls.add(v);
3709
3747
  const h = document.activeElement;
3710
3748
  if (!i.contains(h)) {
3711
- const w = new CustomEvent(Ir, Ms);
3749
+ const w = new CustomEvent(Ir, ks);
3712
3750
  i.addEventListener(Ir, f), i.dispatchEvent(w), w.defaultPrevented || (Hp(Gp(Ya(i)), { select: !0 }), document.activeElement === h && et(i));
3713
3751
  }
3714
3752
  return () => {
3715
3753
  i.removeEventListener(Ir, f), setTimeout(() => {
3716
- const w = new CustomEvent(Or, Ms);
3754
+ const w = new CustomEvent(Or, ks);
3717
3755
  i.addEventListener(Or, d), i.dispatchEvent(w), w.defaultPrevented || et(h ?? document.body, { select: !0 }), i.removeEventListener(Or, d), Ls.remove(v);
3718
3756
  }, 0);
3719
3757
  };
@@ -3810,10 +3848,10 @@ const qp = ["top", "right", "bottom", "left"], st = Math.min, Pe = Math.max, $n
3810
3848
  function Jr(e, t, n) {
3811
3849
  return Pe(e, st(t, n));
3812
3850
  }
3813
- function Je(e, t) {
3851
+ function Ze(e, t) {
3814
3852
  return typeof e == "function" ? e(t) : e;
3815
3853
  }
3816
- function Ze(e) {
3854
+ function Qe(e) {
3817
3855
  return e.split("-")[0];
3818
3856
  }
3819
3857
  function $t(e) {
@@ -3827,7 +3865,7 @@ function No(e) {
3827
3865
  }
3828
3866
  const Jp = /* @__PURE__ */ new Set(["top", "bottom"]);
3829
3867
  function je(e) {
3830
- return Jp.has(Ze(e)) ? "y" : "x";
3868
+ return Jp.has(Qe(e)) ? "y" : "x";
3831
3869
  }
3832
3870
  function To(e) {
3833
3871
  return Ro(je(e));
@@ -3860,7 +3898,7 @@ function nh(e, t, n) {
3860
3898
  }
3861
3899
  function rh(e, t, n, r) {
3862
3900
  const o = $t(e);
3863
- let s = nh(Ze(e), n === "start", r);
3901
+ let s = nh(Qe(e), n === "start", r);
3864
3902
  return o && (s = s.map((a) => a + "-" + o), t && (s = s.concat(s.map(Zr)))), s;
3865
3903
  }
3866
3904
  function Bn(e) {
@@ -3906,7 +3944,7 @@ function Us(e, t, n) {
3906
3944
  reference: r,
3907
3945
  floating: o
3908
3946
  } = e;
3909
- const s = je(t), a = To(t), i = No(a), u = Ze(t), f = s === "y", d = r.x + r.width / 2 - o.width / 2, p = r.y + r.height / 2 - o.height / 2, g = r[i] / 2 - o[i] / 2;
3947
+ const s = je(t), a = To(t), i = No(a), u = Qe(t), f = s === "y", d = r.x + r.width / 2 - o.width / 2, p = r.y + r.height / 2 - o.height / 2, g = r[i] / 2 - o[i] / 2;
3910
3948
  let v;
3911
3949
  switch (u) {
3912
3950
  case "top":
@@ -4026,7 +4064,7 @@ async function Jt(e, t) {
4026
4064
  elementContext: p = "floating",
4027
4065
  altBoundary: g = !1,
4028
4066
  padding: v = 0
4029
- } = Je(t, e), m = Ja(v), b = i[g ? p === "floating" ? "reference" : "floating" : p], w = Un(await s.getClippingRect({
4067
+ } = Ze(t, e), m = Ja(v), b = i[g ? p === "floating" ? "reference" : "floating" : p], w = Un(await s.getClippingRect({
4030
4068
  element: (n = await (s.isElement == null ? void 0 : s.isElement(b))) == null || n ? b : b.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(i.floating)),
4031
4069
  boundary: f,
4032
4070
  rootBoundary: d,
@@ -4070,7 +4108,7 @@ const ah = (e) => ({
4070
4108
  } = t, {
4071
4109
  element: f,
4072
4110
  padding: d = 0
4073
- } = Je(e, t) || {};
4111
+ } = Ze(e, t) || {};
4074
4112
  if (f == null)
4075
4113
  return {};
4076
4114
  const p = Ja(d), g = {
@@ -4079,17 +4117,17 @@ const ah = (e) => ({
4079
4117
  }, v = To(o), m = No(v), h = await a.getDimensions(f), b = v === "y", w = b ? "top" : "left", y = b ? "bottom" : "right", x = b ? "clientHeight" : "clientWidth", E = s.reference[m] + s.reference[v] - g[v] - s.floating[m], C = g[v] - s.reference[v], I = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(f));
4080
4118
  let N = I ? I[x] : 0;
4081
4119
  (!N || !await (a.isElement == null ? void 0 : a.isElement(I))) && (N = i.floating[x] || s.floating[m]);
4082
- const L = E / 2 - C / 2, k = N / 2 - h[m] / 2 - 1, D = st(p[w], k), j = st(p[y], k), K = D, W = N - h[m] - j, B = N / 2 - h[m] / 2 + L, q = Jr(K, B, W), F = !u.arrow && $t(o) != null && B !== q && s.reference[m] / 2 - (B < K ? D : j) - h[m] / 2 < 0, G = F ? B < K ? B - K : B - W : 0;
4120
+ const F = E / 2 - C / 2, D = N / 2 - h[m] / 2 - 1, L = st(p[w], D), j = st(p[y], D), K = L, W = N - h[m] - j, B = N / 2 - h[m] / 2 + F, q = Jr(K, B, W), $ = !u.arrow && $t(o) != null && B !== q && s.reference[m] / 2 - (B < K ? L : j) - h[m] / 2 < 0, G = $ ? B < K ? B - K : B - W : 0;
4083
4121
  return {
4084
4122
  [v]: g[v] + G,
4085
4123
  data: {
4086
4124
  [v]: q,
4087
4125
  centerOffset: B - q - G,
4088
- ...F && {
4126
+ ...$ && {
4089
4127
  alignmentOffset: G
4090
4128
  }
4091
4129
  },
4092
- reset: F
4130
+ reset: $
4093
4131
  };
4094
4132
  }
4095
4133
  }), ih = function(e) {
@@ -4113,41 +4151,41 @@ const ah = (e) => ({
4113
4151
  fallbackAxisSideDirection: m = "none",
4114
4152
  flipAlignment: h = !0,
4115
4153
  ...b
4116
- } = Je(e, t);
4154
+ } = Ze(e, t);
4117
4155
  if ((n = s.arrow) != null && n.alignmentOffset)
4118
4156
  return {};
4119
- const w = Ze(o), y = je(i), x = Ze(i) === i, E = await (u.isRTL == null ? void 0 : u.isRTL(f.floating)), C = g || (x || !h ? [Bn(i)] : Qp(i)), I = m !== "none";
4157
+ const w = Qe(o), y = je(i), x = Qe(i) === i, E = await (u.isRTL == null ? void 0 : u.isRTL(f.floating)), C = g || (x || !h ? [Bn(i)] : Qp(i)), I = m !== "none";
4120
4158
  !g && I && C.push(...rh(i, h, m, E));
4121
- const N = [i, ...C], L = await Jt(t, b), k = [];
4122
- let D = ((r = s.flip) == null ? void 0 : r.overflows) || [];
4123
- if (d && k.push(L[w]), p) {
4159
+ const N = [i, ...C], F = await Jt(t, b), D = [];
4160
+ let L = ((r = s.flip) == null ? void 0 : r.overflows) || [];
4161
+ if (d && D.push(F[w]), p) {
4124
4162
  const B = Zp(o, a, E);
4125
- k.push(L[B[0]], L[B[1]]);
4163
+ D.push(F[B[0]], F[B[1]]);
4126
4164
  }
4127
- if (D = [...D, {
4165
+ if (L = [...L, {
4128
4166
  placement: o,
4129
- overflows: k
4130
- }], !k.every((B) => B <= 0)) {
4167
+ overflows: D
4168
+ }], !D.every((B) => B <= 0)) {
4131
4169
  var j, K;
4132
4170
  const B = (((j = s.flip) == null ? void 0 : j.index) || 0) + 1, q = N[B];
4133
4171
  if (q && (!(p === "alignment" ? y !== je(q) : !1) || // We leave the current main axis only if every placement on that axis
4134
4172
  // overflows the main axis.
4135
- D.every((T) => je(T.placement) === y ? T.overflows[0] > 0 : !0)))
4173
+ L.every((T) => je(T.placement) === y ? T.overflows[0] > 0 : !0)))
4136
4174
  return {
4137
4175
  data: {
4138
4176
  index: B,
4139
- overflows: D
4177
+ overflows: L
4140
4178
  },
4141
4179
  reset: {
4142
4180
  placement: q
4143
4181
  }
4144
4182
  };
4145
- let F = (K = D.filter((G) => G.overflows[0] <= 0).sort((G, T) => G.overflows[1] - T.overflows[1])[0]) == null ? void 0 : K.placement;
4146
- if (!F)
4183
+ let $ = (K = L.filter((G) => G.overflows[0] <= 0).sort((G, T) => G.overflows[1] - T.overflows[1])[0]) == null ? void 0 : K.placement;
4184
+ if (!$)
4147
4185
  switch (v) {
4148
4186
  case "bestFit": {
4149
4187
  var W;
4150
- const G = (W = D.filter((T) => {
4188
+ const G = (W = L.filter((T) => {
4151
4189
  if (I) {
4152
4190
  const P = je(T.placement);
4153
4191
  return P === y || // Create a bias to the `y` side axis due to horizontal
@@ -4156,17 +4194,17 @@ const ah = (e) => ({
4156
4194
  }
4157
4195
  return !0;
4158
4196
  }).map((T) => [T.placement, T.overflows.filter((P) => P > 0).reduce((P, _) => P + _, 0)]).sort((T, P) => T[1] - P[1])[0]) == null ? void 0 : W[0];
4159
- G && (F = G);
4197
+ G && ($ = G);
4160
4198
  break;
4161
4199
  }
4162
4200
  case "initialPlacement":
4163
- F = i;
4201
+ $ = i;
4164
4202
  break;
4165
4203
  }
4166
- if (o !== F)
4204
+ if (o !== $)
4167
4205
  return {
4168
4206
  reset: {
4169
- placement: F
4207
+ placement: $
4170
4208
  }
4171
4209
  };
4172
4210
  }
@@ -4195,7 +4233,7 @@ const ch = function(e) {
4195
4233
  } = t, {
4196
4234
  strategy: r = "referenceHidden",
4197
4235
  ...o
4198
- } = Je(e, t);
4236
+ } = Ze(e, t);
4199
4237
  switch (r) {
4200
4238
  case "referenceHidden": {
4201
4239
  const s = await Jt(t, {
@@ -4232,7 +4270,7 @@ async function lh(e, t) {
4232
4270
  placement: n,
4233
4271
  platform: r,
4234
4272
  elements: o
4235
- } = e, s = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), a = Ze(n), i = $t(n), u = je(n) === "y", f = Za.has(a) ? -1 : 1, d = s && u ? -1 : 1, p = Je(t, e);
4273
+ } = e, s = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), a = Qe(n), i = $t(n), u = je(n) === "y", f = Za.has(a) ? -1 : 1, d = s && u ? -1 : 1, p = Ze(t, e);
4236
4274
  let {
4237
4275
  mainAxis: g,
4238
4276
  crossAxis: v,
@@ -4301,10 +4339,10 @@ const uh = function(e) {
4301
4339
  }
4302
4340
  },
4303
4341
  ...u
4304
- } = Je(e, t), f = {
4342
+ } = Ze(e, t), f = {
4305
4343
  x: n,
4306
4344
  y: r
4307
- }, d = await Jt(t, u), p = je(Ze(o)), g = Ro(p);
4345
+ }, d = await Jt(t, u), p = je(Qe(o)), g = Ro(p);
4308
4346
  let v = f[g], m = f[p];
4309
4347
  if (s) {
4310
4348
  const b = g === "y" ? "top" : "left", w = g === "y" ? "bottom" : "right", y = v + d[b], x = v - d[w];
@@ -4346,12 +4384,12 @@ const uh = function(e) {
4346
4384
  offset: i = 0,
4347
4385
  mainAxis: u = !0,
4348
4386
  crossAxis: f = !0
4349
- } = Je(e, t), d = {
4387
+ } = Ze(e, t), d = {
4350
4388
  x: n,
4351
4389
  y: r
4352
4390
  }, p = je(o), g = Ro(p);
4353
4391
  let v = d[g], m = d[p];
4354
- const h = Je(i, t), b = typeof h == "number" ? {
4392
+ const h = Ze(i, t), b = typeof h == "number" ? {
4355
4393
  mainAxis: h,
4356
4394
  crossAxis: 0
4357
4395
  } : {
@@ -4365,7 +4403,7 @@ const uh = function(e) {
4365
4403
  }
4366
4404
  if (f) {
4367
4405
  var w, y;
4368
- const x = g === "y" ? "width" : "height", E = Za.has(Ze(o)), C = s.reference[p] - s.floating[x] + (E && ((w = a.offset) == null ? void 0 : w[p]) || 0) + (E ? 0 : b.crossAxis), I = s.reference[p] + s.reference[x] + (E ? 0 : ((y = a.offset) == null ? void 0 : y[p]) || 0) - (E ? b.crossAxis : 0);
4406
+ const x = g === "y" ? "width" : "height", E = Za.has(Qe(o)), C = s.reference[p] - s.floating[x] + (E && ((w = a.offset) == null ? void 0 : w[p]) || 0) + (E ? 0 : b.crossAxis), I = s.reference[p] + s.reference[x] + (E ? 0 : ((y = a.offset) == null ? void 0 : y[p]) || 0) - (E ? b.crossAxis : 0);
4369
4407
  m < C ? m = C : m > I && (m = I);
4370
4408
  }
4371
4409
  return {
@@ -4389,25 +4427,25 @@ const uh = function(e) {
4389
4427
  apply: u = () => {
4390
4428
  },
4391
4429
  ...f
4392
- } = Je(e, t), d = await Jt(t, f), p = Ze(o), g = $t(o), v = je(o) === "y", {
4430
+ } = Ze(e, t), d = await Jt(t, f), p = Qe(o), g = $t(o), v = je(o) === "y", {
4393
4431
  width: m,
4394
4432
  height: h
4395
4433
  } = s.floating;
4396
4434
  let b, w;
4397
4435
  p === "top" || p === "bottom" ? (b = p, w = g === (await (a.isRTL == null ? void 0 : a.isRTL(i.floating)) ? "start" : "end") ? "left" : "right") : (w = p, b = g === "end" ? "top" : "bottom");
4398
4436
  const y = h - d.top - d.bottom, x = m - d.left - d.right, E = st(h - d[b], y), C = st(m - d[w], x), I = !t.middlewareData.shift;
4399
- let N = E, L = C;
4400
- if ((n = t.middlewareData.shift) != null && n.enabled.x && (L = x), (r = t.middlewareData.shift) != null && r.enabled.y && (N = y), I && !g) {
4401
- const D = Pe(d.left, 0), j = Pe(d.right, 0), K = Pe(d.top, 0), W = Pe(d.bottom, 0);
4402
- v ? L = m - 2 * (D !== 0 || j !== 0 ? D + j : Pe(d.left, d.right)) : N = h - 2 * (K !== 0 || W !== 0 ? K + W : Pe(d.top, d.bottom));
4437
+ let N = E, F = C;
4438
+ if ((n = t.middlewareData.shift) != null && n.enabled.x && (F = x), (r = t.middlewareData.shift) != null && r.enabled.y && (N = y), I && !g) {
4439
+ const L = Pe(d.left, 0), j = Pe(d.right, 0), K = Pe(d.top, 0), W = Pe(d.bottom, 0);
4440
+ v ? F = m - 2 * (L !== 0 || j !== 0 ? L + j : Pe(d.left, d.right)) : N = h - 2 * (K !== 0 || W !== 0 ? K + W : Pe(d.top, d.bottom));
4403
4441
  }
4404
4442
  await u({
4405
4443
  ...t,
4406
- availableWidth: L,
4444
+ availableWidth: F,
4407
4445
  availableHeight: N
4408
4446
  });
4409
- const k = await a.getDimensions(i.floating);
4410
- return m !== k.width || h !== k.height ? {
4447
+ const D = await a.getDimensions(i.floating);
4448
+ return m !== D.width || h !== D.height ? {
4411
4449
  reset: {
4412
4450
  rects: !0
4413
4451
  }
@@ -4727,7 +4765,7 @@ function Oh(e) {
4727
4765
  y: u.top
4728
4766
  };
4729
4767
  }
4730
- function kh(e) {
4768
+ function Mh(e) {
4731
4769
  const {
4732
4770
  width: t,
4733
4771
  height: n
@@ -4737,7 +4775,7 @@ function kh(e) {
4737
4775
  height: n
4738
4776
  };
4739
4777
  }
4740
- function Mh(e, t, n) {
4778
+ function kh(e, t, n) {
4741
4779
  const r = qe(t), o = Xe(t), s = n === "fixed", a = ht(e, !0, s, t);
4742
4780
  let i = {
4743
4781
  scrollLeft: 0,
@@ -4761,7 +4799,7 @@ function Mh(e, t, n) {
4761
4799
  height: a.height
4762
4800
  };
4763
4801
  }
4764
- function kr(e) {
4802
+ function Mr(e) {
4765
4803
  return $e(e).position === "static";
4766
4804
  }
4767
4805
  function Ks(e, t) {
@@ -4779,21 +4817,21 @@ function si(e, t) {
4779
4817
  if (!qe(e)) {
4780
4818
  let o = at(e);
4781
4819
  for (; o && !Ot(o); ) {
4782
- if (Fe(o) && !kr(o))
4820
+ if (Fe(o) && !Mr(o))
4783
4821
  return o;
4784
4822
  o = at(o);
4785
4823
  }
4786
4824
  return n;
4787
4825
  }
4788
4826
  let r = Ks(e, t);
4789
- for (; r && gh(r) && kr(r); )
4827
+ for (; r && gh(r) && Mr(r); )
4790
4828
  r = Ks(r, t);
4791
- return r && Ot(r) && kr(r) && !Ao(r) ? n : r || xh(e) || n;
4829
+ return r && Ot(r) && Mr(r) && !Ao(r) ? n : r || xh(e) || n;
4792
4830
  }
4793
4831
  const Dh = async function(e) {
4794
4832
  const t = this.getOffsetParent || si, n = this.getDimensions, r = await n(e.floating);
4795
4833
  return {
4796
- reference: Mh(e.reference, await t(e.floating), e.strategy),
4834
+ reference: kh(e.reference, await t(e.floating), e.strategy),
4797
4835
  floating: {
4798
4836
  x: 0,
4799
4837
  y: 0,
@@ -4812,7 +4850,7 @@ const Fh = {
4812
4850
  getOffsetParent: si,
4813
4851
  getElementRects: Dh,
4814
4852
  getClientRects: Nh,
4815
- getDimensions: kh,
4853
+ getDimensions: Mh,
4816
4854
  getScale: At,
4817
4855
  isElement: Fe,
4818
4856
  isRTL: Lh
@@ -4954,7 +4992,7 @@ function qs(e, t) {
4954
4992
  const n = ii(e);
4955
4993
  return Math.round(t * n) / n;
4956
4994
  }
4957
- function Mr(e) {
4995
+ function kr(e) {
4958
4996
  const t = l.useRef(e);
4959
4997
  return Nn(() => {
4960
4998
  t.current = e;
@@ -4987,7 +5025,7 @@ function Xh(e) {
4987
5025
  T !== I.current && (I.current = T, h(T));
4988
5026
  }, []), x = l.useCallback((T) => {
4989
5027
  T !== N.current && (N.current = T, w(T));
4990
- }, []), E = s || m, C = a || b, I = l.useRef(null), N = l.useRef(null), L = l.useRef(d), k = u != null, D = Mr(u), j = Mr(o), K = Mr(f), W = l.useCallback(() => {
5028
+ }, []), E = s || m, C = a || b, I = l.useRef(null), N = l.useRef(null), F = l.useRef(d), D = u != null, L = kr(u), j = kr(o), K = kr(f), W = l.useCallback(() => {
4991
5029
  if (!I.current || !N.current)
4992
5030
  return;
4993
5031
  const T = {
@@ -5004,13 +5042,13 @@ function Xh(e) {
5004
5042
  // setting it to `true` when `open === false` (must be specified).
5005
5043
  isPositioned: K.current !== !1
5006
5044
  };
5007
- B.current && !zn(L.current, _) && (L.current = _, qn.flushSync(() => {
5045
+ B.current && !zn(F.current, _) && (F.current = _, qn.flushSync(() => {
5008
5046
  p(_);
5009
5047
  }));
5010
5048
  });
5011
5049
  }, [g, t, n, j, K]);
5012
5050
  Nn(() => {
5013
- f === !1 && L.current.isPositioned && (L.current.isPositioned = !1, p((T) => ({
5051
+ f === !1 && F.current.isPositioned && (F.current.isPositioned = !1, p((T) => ({
5014
5052
  ...T,
5015
5053
  isPositioned: !1
5016
5054
  })));
@@ -5020,17 +5058,17 @@ function Xh(e) {
5020
5058
  B.current = !1;
5021
5059
  }), []), Nn(() => {
5022
5060
  if (E && (I.current = E), C && (N.current = C), E && C) {
5023
- if (D.current)
5024
- return D.current(E, C, W);
5061
+ if (L.current)
5062
+ return L.current(E, C, W);
5025
5063
  W();
5026
5064
  }
5027
- }, [E, C, W, D, k]);
5065
+ }, [E, C, W, L, D]);
5028
5066
  const q = l.useMemo(() => ({
5029
5067
  reference: I,
5030
5068
  floating: N,
5031
5069
  setReference: y,
5032
5070
  setFloating: x
5033
- }), [y, x]), F = l.useMemo(() => ({
5071
+ }), [y, x]), $ = l.useMemo(() => ({
5034
5072
  reference: E,
5035
5073
  floating: C
5036
5074
  }), [E, C]), G = l.useMemo(() => {
@@ -5039,13 +5077,13 @@ function Xh(e) {
5039
5077
  left: 0,
5040
5078
  top: 0
5041
5079
  };
5042
- if (!F.floating)
5080
+ if (!$.floating)
5043
5081
  return T;
5044
- const P = qs(F.floating, d.x), _ = qs(F.floating, d.y);
5082
+ const P = qs($.floating, d.x), _ = qs($.floating, d.y);
5045
5083
  return i ? {
5046
5084
  ...T,
5047
5085
  transform: "translate(" + P + "px, " + _ + "px)",
5048
- ...ii(F.floating) >= 1.5 && {
5086
+ ...ii($.floating) >= 1.5 && {
5049
5087
  willChange: "transform"
5050
5088
  }
5051
5089
  } : {
@@ -5053,14 +5091,14 @@ function Xh(e) {
5053
5091
  left: P,
5054
5092
  top: _
5055
5093
  };
5056
- }, [n, i, F.floating, d.x, d.y]);
5094
+ }, [n, i, $.floating, d.x, d.y]);
5057
5095
  return l.useMemo(() => ({
5058
5096
  ...d,
5059
5097
  update: W,
5060
5098
  refs: q,
5061
- elements: F,
5099
+ elements: $,
5062
5100
  floatingStyles: G
5063
- }), [d, W, q, F, G]);
5101
+ }), [d, W, q, $, G]);
5064
5102
  }
5065
5103
  const Yh = (e) => {
5066
5104
  function t(n) {
@@ -5151,7 +5189,7 @@ var Io = "Popper", [ui, Ut] = Ue(Io), [am, di] = ui(Io), fi = (e) => {
5151
5189
  fi.displayName = Io;
5152
5190
  var pi = "PopperAnchor", hi = l.forwardRef(
5153
5191
  (e, t) => {
5154
- const { __scopePopper: n, virtualRef: r, ...o } = e, s = di(pi, n), a = l.useRef(null), i = ne(t, a), u = l.useRef(null);
5192
+ const { __scopePopper: n, virtualRef: r, ...o } = e, s = di(pi, n), a = l.useRef(null), i = te(t, a), u = l.useRef(null);
5155
5193
  return l.useEffect(() => {
5156
5194
  const f = u.current;
5157
5195
  u.current = (r == null ? void 0 : r.current) || a.current, f !== u.current && s.onAnchorChange(u.current);
@@ -5161,7 +5199,7 @@ var pi = "PopperAnchor", hi = l.forwardRef(
5161
5199
  hi.displayName = pi;
5162
5200
  var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5163
5201
  (e, t) => {
5164
- var V, oe, ie, se, H, Z;
5202
+ var V, re, ie, oe, H, Z;
5165
5203
  const {
5166
5204
  __scopePopper: n,
5167
5205
  side: r = "bottom",
@@ -5177,15 +5215,15 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5177
5215
  updatePositionStrategy: v = "optimized",
5178
5216
  onPlaced: m,
5179
5217
  ...h
5180
- } = e, b = di(Oo, n), [w, y] = l.useState(null), x = ne(t, (de) => y(de)), [E, C] = l.useState(null), I = li(E), N = (I == null ? void 0 : I.width) ?? 0, L = (I == null ? void 0 : I.height) ?? 0, k = r + (s !== "center" ? "-" + s : ""), D = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, j = Array.isArray(f) ? f : [f], K = j.length > 0, W = {
5181
- padding: D,
5218
+ } = e, b = di(Oo, n), [w, y] = l.useState(null), x = te(t, (de) => y(de)), [E, C] = l.useState(null), I = li(E), N = (I == null ? void 0 : I.width) ?? 0, F = (I == null ? void 0 : I.height) ?? 0, D = r + (s !== "center" ? "-" + s : ""), L = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, j = Array.isArray(f) ? f : [f], K = j.length > 0, W = {
5219
+ padding: L,
5182
5220
  boundary: j.filter(um),
5183
5221
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
5184
5222
  altBoundary: K
5185
- }, { refs: B, floatingStyles: q, placement: F, isPositioned: G, middlewareData: T } = Xh({
5223
+ }, { refs: B, floatingStyles: q, placement: $, isPositioned: G, middlewareData: T } = Xh({
5186
5224
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
5187
5225
  strategy: "fixed",
5188
- placement: k,
5226
+ placement: D,
5189
5227
  whileElementsMounted: (...de) => Bh(...de, {
5190
5228
  animationFrame: v === "always"
5191
5229
  }),
@@ -5193,7 +5231,7 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5193
5231
  reference: b.anchor
5194
5232
  },
5195
5233
  middleware: [
5196
- Jh({ mainAxis: o + L, alignmentAxis: a }),
5234
+ Jh({ mainAxis: o + F, alignmentAxis: a }),
5197
5235
  u && Zh({
5198
5236
  mainAxis: !0,
5199
5237
  crossAxis: !1,
@@ -5203,22 +5241,22 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5203
5241
  u && em({ ...W }),
5204
5242
  tm({
5205
5243
  ...W,
5206
- apply: ({ elements: de, rects: pe, availableWidth: Y, availableHeight: ge }) => {
5207
- const { width: te, height: he } = pe.reference, ve = de.floating.style;
5208
- ve.setProperty("--radix-popper-available-width", `${Y}px`), ve.setProperty("--radix-popper-available-height", `${ge}px`), ve.setProperty("--radix-popper-anchor-width", `${te}px`), ve.setProperty("--radix-popper-anchor-height", `${he}px`);
5244
+ apply: ({ elements: de, rects: he, availableWidth: me, availableHeight: Q }) => {
5245
+ const { width: ve, height: ae } = he.reference, fe = de.floating.style;
5246
+ fe.setProperty("--radix-popper-available-width", `${me}px`), fe.setProperty("--radix-popper-available-height", `${Q}px`), fe.setProperty("--radix-popper-anchor-width", `${ve}px`), fe.setProperty("--radix-popper-anchor-height", `${ae}px`);
5209
5247
  }
5210
5248
  }),
5211
5249
  E && rm({ element: E, padding: i }),
5212
- dm({ arrowWidth: N, arrowHeight: L }),
5250
+ dm({ arrowWidth: N, arrowHeight: F }),
5213
5251
  g && nm({ strategy: "referenceHidden", ...W })
5214
5252
  ]
5215
- }), [P, _] = vi(F), O = ye(m);
5253
+ }), [P, _] = vi($), O = ye(m);
5216
5254
  be(() => {
5217
5255
  G && (O == null || O());
5218
5256
  }, [G, O]);
5219
- const X = (V = T.arrow) == null ? void 0 : V.x, $ = (oe = T.arrow) == null ? void 0 : oe.y, z = ((ie = T.arrow) == null ? void 0 : ie.centerOffset) !== 0, [le, ae] = l.useState();
5257
+ const Y = (V = T.arrow) == null ? void 0 : V.x, M = (re = T.arrow) == null ? void 0 : re.y, z = ((ie = T.arrow) == null ? void 0 : ie.centerOffset) !== 0, [le, se] = l.useState();
5220
5258
  return be(() => {
5221
- w && ae(window.getComputedStyle(w).zIndex);
5259
+ w && se(window.getComputedStyle(w).zIndex);
5222
5260
  }, [w]), /* @__PURE__ */ c(
5223
5261
  "div",
5224
5262
  {
@@ -5231,7 +5269,7 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5231
5269
  minWidth: "max-content",
5232
5270
  zIndex: le,
5233
5271
  "--radix-popper-transform-origin": [
5234
- (se = T.transformOrigin) == null ? void 0 : se.x,
5272
+ (oe = T.transformOrigin) == null ? void 0 : oe.x,
5235
5273
  (H = T.transformOrigin) == null ? void 0 : H.y
5236
5274
  ].join(" "),
5237
5275
  // hide the content if using the hide middleware and should be hidden
@@ -5249,8 +5287,8 @@ var Oo = "PopperContent", [im, cm] = ui(Oo), mi = l.forwardRef(
5249
5287
  scope: n,
5250
5288
  placedSide: P,
5251
5289
  onArrowChange: C,
5252
- arrowX: X,
5253
- arrowY: $,
5290
+ arrowX: Y,
5291
+ arrowY: M,
5254
5292
  shouldHideArrow: z,
5255
5293
  children: /* @__PURE__ */ c(
5256
5294
  J.div,
@@ -5342,7 +5380,7 @@ function vi(e) {
5342
5380
  const [t, n = "center"] = e.split("-");
5343
5381
  return [t, n];
5344
5382
  }
5345
- var ko = fi, Mo = hi, Do = mi, Lo = bi, fm = "Portal", ir = l.forwardRef((e, t) => {
5383
+ var Mo = fi, ko = hi, Do = mi, Lo = bi, fm = "Portal", ir = l.forwardRef((e, t) => {
5346
5384
  var i;
5347
5385
  const { container: n, ...r } = e, [o, s] = l.useState(!1);
5348
5386
  be(() => s(!0), []);
@@ -5369,16 +5407,16 @@ var vm = l.forwardRef((e, t) => {
5369
5407
  onEntryFocus: f,
5370
5408
  preventScrollOnEntryFocus: d = !1,
5371
5409
  ...p
5372
- } = e, g = l.useRef(null), v = ne(t, g), m = tr(s), [h, b] = ot({
5410
+ } = e, g = l.useRef(null), v = te(t, g), m = tr(s), [h, b] = ot({
5373
5411
  prop: a,
5374
5412
  defaultProp: i ?? null,
5375
5413
  onChange: u,
5376
5414
  caller: dn
5377
5415
  }), [w, y] = l.useState(!1), x = ye(f), E = wi(n), C = l.useRef(!1), [I, N] = l.useState(0);
5378
5416
  return l.useEffect(() => {
5379
- const L = g.current;
5380
- if (L)
5381
- return L.addEventListener(Dr, x), () => L.removeEventListener(Dr, x);
5417
+ const F = g.current;
5418
+ if (F)
5419
+ return F.addEventListener(Dr, x), () => F.removeEventListener(Dr, x);
5382
5420
  }, [x]), /* @__PURE__ */ c(
5383
5421
  gm,
5384
5422
  {
@@ -5388,16 +5426,16 @@ var vm = l.forwardRef((e, t) => {
5388
5426
  loop: o,
5389
5427
  currentTabStopId: h,
5390
5428
  onItemFocus: l.useCallback(
5391
- (L) => b(L),
5429
+ (F) => b(F),
5392
5430
  [b]
5393
5431
  ),
5394
5432
  onItemShiftTab: l.useCallback(() => y(!0), []),
5395
5433
  onFocusableItemAdd: l.useCallback(
5396
- () => N((L) => L + 1),
5434
+ () => N((F) => F + 1),
5397
5435
  []
5398
5436
  ),
5399
5437
  onFocusableItemRemove: l.useCallback(
5400
- () => N((L) => L - 1),
5438
+ () => N((F) => F - 1),
5401
5439
  []
5402
5440
  ),
5403
5441
  children: /* @__PURE__ */ c(
@@ -5411,14 +5449,14 @@ var vm = l.forwardRef((e, t) => {
5411
5449
  onMouseDown: U(e.onMouseDown, () => {
5412
5450
  C.current = !0;
5413
5451
  }),
5414
- onFocus: U(e.onFocus, (L) => {
5415
- const k = !C.current;
5416
- if (L.target === L.currentTarget && k && !w) {
5417
- const D = new CustomEvent(Dr, pm);
5418
- if (L.currentTarget.dispatchEvent(D), !D.defaultPrevented) {
5419
- const j = E().filter((F) => F.focusable), K = j.find((F) => F.active), W = j.find((F) => F.id === h), q = [K, W, ...j].filter(
5452
+ onFocus: U(e.onFocus, (F) => {
5453
+ const D = !C.current;
5454
+ if (F.target === F.currentTarget && D && !w) {
5455
+ const L = new CustomEvent(Dr, pm);
5456
+ if (F.currentTarget.dispatchEvent(L), !L.defaultPrevented) {
5457
+ const j = E().filter(($) => $.focusable), K = j.find(($) => $.active), W = j.find(($) => $.id === h), q = [K, W, ...j].filter(
5420
5458
  Boolean
5421
- ).map((F) => F.ref.current);
5459
+ ).map(($) => $.ref.current);
5422
5460
  Ei(q, d);
5423
5461
  }
5424
5462
  }
@@ -5610,7 +5648,7 @@ function Im(e, t) {
5610
5648
  return n.callback = t, n.facade;
5611
5649
  }
5612
5650
  var Om = typeof window < "u" ? l.useLayoutEffect : l.useEffect, Xs = /* @__PURE__ */ new WeakMap();
5613
- function km(e, t) {
5651
+ function Mm(e, t) {
5614
5652
  var n = Im(null, function(r) {
5615
5653
  return e.forEach(function(o) {
5616
5654
  return Fr(o, r);
@@ -5629,11 +5667,11 @@ function km(e, t) {
5629
5667
  Xs.set(n, e);
5630
5668
  }, [e]), n;
5631
5669
  }
5632
- function Mm(e) {
5670
+ function km(e) {
5633
5671
  return e;
5634
5672
  }
5635
5673
  function Dm(e, t) {
5636
- t === void 0 && (t = Mm);
5674
+ t === void 0 && (t = km);
5637
5675
  var n = [], r = !1, o = {
5638
5676
  read: function() {
5639
5677
  if (r)
@@ -5711,7 +5749,7 @@ var Ai = Lm(), $r = function() {
5711
5749
  onScrollCapture: $r,
5712
5750
  onWheelCapture: $r,
5713
5751
  onTouchMoveCapture: $r
5714
- }), o = r[0], s = r[1], a = e.forwardProps, i = e.children, u = e.className, f = e.removeScrollBar, d = e.enabled, p = e.shards, g = e.sideCar, v = e.noRelative, m = e.noIsolation, h = e.inert, b = e.allowPinchZoom, w = e.as, y = w === void 0 ? "div" : w, x = e.gapMode, E = Ni(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), C = g, I = km([n, t]), N = Ve(Ve({}, E), o);
5752
+ }), o = r[0], s = r[1], a = e.forwardProps, i = e.children, u = e.className, f = e.removeScrollBar, d = e.enabled, p = e.shards, g = e.sideCar, v = e.noRelative, m = e.noIsolation, h = e.inert, b = e.allowPinchZoom, w = e.as, y = w === void 0 ? "div" : w, x = e.gapMode, E = Ni(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), C = g, I = Mm([n, t]), N = Ve(Ve({}, E), o);
5715
5753
  return l.createElement(
5716
5754
  l.Fragment,
5717
5755
  null,
@@ -5965,15 +6003,15 @@ function ig(e) {
5965
6003
  var w = xn(h), y = n.current, x = "deltaX" in h ? h.deltaX : y[0] - w[0], E = "deltaY" in h ? h.deltaY : y[1] - w[1], C, I = h.target, N = Math.abs(x) > Math.abs(E) ? "h" : "v";
5966
6004
  if ("touches" in h && N === "h" && I.type === "range")
5967
6005
  return !1;
5968
- var L = Js(N, I);
5969
- if (!L)
6006
+ var F = Js(N, I);
6007
+ if (!F)
5970
6008
  return !0;
5971
- if (L ? C = N : (C = N === "v" ? "h" : "v", L = Js(N, I)), !L)
6009
+ if (F ? C = N : (C = N === "v" ? "h" : "v", F = Js(N, I)), !F)
5972
6010
  return !1;
5973
6011
  if (!r.current && "changedTouches" in h && (x || E) && (r.current = C), !C)
5974
6012
  return !0;
5975
- var k = r.current || C;
5976
- return rg(k, b, h, k === "h" ? x : E);
6013
+ var D = r.current || C;
6014
+ return rg(D, b, h, D === "h" ? x : E);
5977
6015
  }, []), u = l.useCallback(function(h) {
5978
6016
  var b = h;
5979
6017
  if (!(!Rt.length || Rt[Rt.length - 1] !== s)) {
@@ -6034,13 +6072,13 @@ var lr = l.forwardRef(function(e, t) {
6034
6072
  return l.createElement(cr, Ve({}, e, { ref: t, sideCar: lg }));
6035
6073
  });
6036
6074
  lr.classNames = cr.classNames;
6037
- var no = ["Enter", " "], ug = ["ArrowDown", "PageUp", "Home"], ki = ["ArrowUp", "PageDown", "End"], dg = [...ug, ...ki], fg = {
6075
+ var no = ["Enter", " "], ug = ["ArrowDown", "PageUp", "Home"], Mi = ["ArrowUp", "PageDown", "End"], dg = [...ug, ...Mi], fg = {
6038
6076
  ltr: [...no, "ArrowRight"],
6039
6077
  rtl: [...no, "ArrowLeft"]
6040
6078
  }, pg = {
6041
6079
  ltr: ["ArrowLeft"],
6042
6080
  rtl: ["ArrowRight"]
6043
- }, fn = "Menu", [Qt, hg, mg] = Co(fn), [vt, Mi] = Ue(fn, [
6081
+ }, fn = "Menu", [Qt, hg, mg] = Co(fn), [vt, ki] = Ue(fn, [
6044
6082
  mg,
6045
6083
  Ut,
6046
6084
  yi
@@ -6053,7 +6091,7 @@ var no = ["Enter", " "], ug = ["ArrowDown", "PageUp", "Home"], ki = ["ArrowUp",
6053
6091
  return document.addEventListener("keydown", v, { capture: !0 }), () => {
6054
6092
  document.removeEventListener("keydown", v, { capture: !0 }), document.removeEventListener("pointerdown", m, { capture: !0 }), document.removeEventListener("pointermove", m, { capture: !0 });
6055
6093
  };
6056
- }, []), /* @__PURE__ */ c(ko, { ...i, children: /* @__PURE__ */ c(
6094
+ }, []), /* @__PURE__ */ c(Mo, { ...i, children: /* @__PURE__ */ c(
6057
6095
  gg,
6058
6096
  {
6059
6097
  scope: t,
@@ -6079,7 +6117,7 @@ Li.displayName = fn;
6079
6117
  var vg = "MenuAnchor", $o = l.forwardRef(
6080
6118
  (e, t) => {
6081
6119
  const { __scopeMenu: n, ...r } = e, o = ur(n);
6082
- return /* @__PURE__ */ c(Mo, { ...o, ...r, ref: t });
6120
+ return /* @__PURE__ */ c(ko, { ...o, ...r, ref: t });
6083
6121
  }
6084
6122
  );
6085
6123
  $o.displayName = vg;
@@ -6097,7 +6135,7 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
6097
6135
  }
6098
6136
  ), xg = l.forwardRef(
6099
6137
  (e, t) => {
6100
- const n = wt(Oe, e.__scopeMenu), r = l.useRef(null), o = ne(t, r);
6138
+ const n = wt(Oe, e.__scopeMenu), r = l.useRef(null), o = te(t, r);
6101
6139
  return l.useEffect(() => {
6102
6140
  const s = r.current;
6103
6141
  if (s) return Fo(s);
@@ -6148,23 +6186,23 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
6148
6186
  onDismiss: v,
6149
6187
  disableOutsideScroll: m,
6150
6188
  ...h
6151
- } = e, b = wt(Oe, n), w = pn(Oe, n), y = ur(n), x = Di(n), E = hg(n), [C, I] = l.useState(null), N = l.useRef(null), L = ne(t, N, b.onContentChange), k = l.useRef(0), D = l.useRef(""), j = l.useRef(0), K = l.useRef(null), W = l.useRef("right"), B = l.useRef(0), q = m ? lr : l.Fragment, F = m ? { as: Cg, allowPinchZoom: !0 } : void 0, G = (P) => {
6152
- var V, oe;
6153
- const _ = D.current + P, O = E().filter((ie) => !ie.disabled), X = document.activeElement, $ = (V = O.find((ie) => ie.ref.current === X)) == null ? void 0 : V.textValue, z = O.map((ie) => ie.textValue), le = Dg(z, _, $), ae = (oe = O.find((ie) => ie.textValue === le)) == null ? void 0 : oe.ref.current;
6154
- (function ie(se) {
6155
- D.current = se, window.clearTimeout(k.current), se !== "" && (k.current = window.setTimeout(() => ie(""), 1e3));
6156
- })(_), ae && setTimeout(() => ae.focus());
6189
+ } = e, b = wt(Oe, n), w = pn(Oe, n), y = ur(n), x = Di(n), E = hg(n), [C, I] = l.useState(null), N = l.useRef(null), F = te(t, N, b.onContentChange), D = l.useRef(0), L = l.useRef(""), j = l.useRef(0), K = l.useRef(null), W = l.useRef("right"), B = l.useRef(0), q = m ? lr : l.Fragment, $ = m ? { as: Cg, allowPinchZoom: !0 } : void 0, G = (P) => {
6190
+ var V, re;
6191
+ const _ = L.current + P, O = E().filter((ie) => !ie.disabled), Y = document.activeElement, M = (V = O.find((ie) => ie.ref.current === Y)) == null ? void 0 : V.textValue, z = O.map((ie) => ie.textValue), le = Dg(z, _, M), se = (re = O.find((ie) => ie.textValue === le)) == null ? void 0 : re.ref.current;
6192
+ (function ie(oe) {
6193
+ L.current = oe, window.clearTimeout(D.current), oe !== "" && (D.current = window.setTimeout(() => ie(""), 1e3));
6194
+ })(_), se && setTimeout(() => se.focus());
6157
6195
  };
6158
- l.useEffect(() => () => window.clearTimeout(k.current), []), Eo();
6196
+ l.useEffect(() => () => window.clearTimeout(D.current), []), Eo();
6159
6197
  const T = l.useCallback((P) => {
6160
- var O, X;
6161
- return W.current === ((O = K.current) == null ? void 0 : O.side) && Fg(P, (X = K.current) == null ? void 0 : X.area);
6198
+ var O, Y;
6199
+ return W.current === ((O = K.current) == null ? void 0 : O.side) && Fg(P, (Y = K.current) == null ? void 0 : Y.area);
6162
6200
  }, []);
6163
6201
  return /* @__PURE__ */ c(
6164
6202
  yg,
6165
6203
  {
6166
6204
  scope: n,
6167
- searchRef: D,
6205
+ searchRef: L,
6168
6206
  onItemEnter: l.useCallback(
6169
6207
  (P) => {
6170
6208
  T(P) && P.preventDefault();
@@ -6188,7 +6226,7 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
6188
6226
  onPointerGraceIntentChange: l.useCallback((P) => {
6189
6227
  K.current = P;
6190
6228
  }, []),
6191
- children: /* @__PURE__ */ c(q, { ...F, children: /* @__PURE__ */ c(
6229
+ children: /* @__PURE__ */ c(q, { ...$, children: /* @__PURE__ */ c(
6192
6230
  nr,
6193
6231
  {
6194
6232
  asChild: !0,
@@ -6232,27 +6270,27 @@ var Oe = "MenuContent", [yg, Uo] = vt(Oe), Bi = l.forwardRef(
6232
6270
  dir: w.dir,
6233
6271
  ...y,
6234
6272
  ...h,
6235
- ref: L,
6273
+ ref: F,
6236
6274
  style: { outline: "none", ...h.style },
6237
6275
  onKeyDown: U(h.onKeyDown, (P) => {
6238
- const O = P.target.closest("[data-radix-menu-content]") === P.currentTarget, X = P.ctrlKey || P.altKey || P.metaKey, $ = P.key.length === 1;
6239
- O && (P.key === "Tab" && P.preventDefault(), !X && $ && G(P.key));
6276
+ const O = P.target.closest("[data-radix-menu-content]") === P.currentTarget, Y = P.ctrlKey || P.altKey || P.metaKey, M = P.key.length === 1;
6277
+ O && (P.key === "Tab" && P.preventDefault(), !Y && M && G(P.key));
6240
6278
  const z = N.current;
6241
6279
  if (P.target !== z || !dg.includes(P.key)) return;
6242
6280
  P.preventDefault();
6243
- const ae = E().filter((V) => !V.disabled).map((V) => V.ref.current);
6244
- ki.includes(P.key) && ae.reverse(), kg(ae);
6281
+ const se = E().filter((V) => !V.disabled).map((V) => V.ref.current);
6282
+ Mi.includes(P.key) && se.reverse(), Mg(se);
6245
6283
  }),
6246
6284
  onBlur: U(e.onBlur, (P) => {
6247
- P.currentTarget.contains(P.target) || (window.clearTimeout(k.current), D.current = "");
6285
+ P.currentTarget.contains(P.target) || (window.clearTimeout(D.current), L.current = "");
6248
6286
  }),
6249
6287
  onPointerMove: U(
6250
6288
  e.onPointerMove,
6251
6289
  en((P) => {
6252
6290
  const _ = P.target, O = B.current !== P.clientX;
6253
6291
  if (P.currentTarget.contains(_) && O) {
6254
- const X = P.clientX > B.current ? "right" : "left";
6255
- W.current = X, B.current = P.clientX;
6292
+ const Y = P.clientX > B.current ? "right" : "left";
6293
+ W.current = Y, B.current = P.clientX;
6256
6294
  }
6257
6295
  })
6258
6296
  )
@@ -6285,7 +6323,7 @@ var Rg = "MenuLabel", Ui = l.forwardRef(
6285
6323
  Ui.displayName = Rg;
6286
6324
  var Hn = "MenuItem", ea = "menu.itemSelect", dr = l.forwardRef(
6287
6325
  (e, t) => {
6288
- const { disabled: n = !1, onSelect: r, ...o } = e, s = l.useRef(null), a = pn(Hn, e.__scopeMenu), i = Uo(Hn, e.__scopeMenu), u = ne(t, s), f = l.useRef(!1), d = () => {
6326
+ const { disabled: n = !1, onSelect: r, ...o } = e, s = l.useRef(null), a = pn(Hn, e.__scopeMenu), i = Uo(Hn, e.__scopeMenu), u = te(t, s), f = l.useRef(!1), d = () => {
6289
6327
  const p = s.current;
6290
6328
  if (!n && p) {
6291
6329
  const g = new CustomEvent(ea, { bubbles: !0, cancelable: !0 });
@@ -6318,7 +6356,7 @@ var Hn = "MenuItem", ea = "menu.itemSelect", dr = l.forwardRef(
6318
6356
  dr.displayName = Hn;
6319
6357
  var zi = l.forwardRef(
6320
6358
  (e, t) => {
6321
- const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, a = Uo(Hn, n), i = Di(n), u = l.useRef(null), f = ne(t, u), [d, p] = l.useState(!1), [g, v] = l.useState("");
6359
+ const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, a = Uo(Hn, n), i = Di(n), u = l.useRef(null), f = te(t, u), [d, p] = l.useState(!1), [g, v] = l.useState("");
6322
6360
  return l.useEffect(() => {
6323
6361
  const m = u.current;
6324
6362
  m && v((m.textContent ?? "").trim());
@@ -6528,7 +6566,7 @@ var Og = "MenuSub", [Sy, Ji] = vt(Og), Vt = "MenuSubTrigger", Zi = l.forwardRef(
6528
6566
  Zi.displayName = Vt;
6529
6567
  var Qi = "MenuSubContent", ec = l.forwardRef(
6530
6568
  (e, t) => {
6531
- const n = Fi(Oe, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = wt(Oe, e.__scopeMenu), a = pn(Oe, e.__scopeMenu), i = Ji(Qi, e.__scopeMenu), u = l.useRef(null), f = ne(t, u);
6569
+ const n = Fi(Oe, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = wt(Oe, e.__scopeMenu), a = pn(Oe, e.__scopeMenu), i = Ji(Qi, e.__scopeMenu), u = l.useRef(null), f = te(t, u);
6532
6570
  return /* @__PURE__ */ c(Qt.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ c(Ae, { present: r || s.open, children: /* @__PURE__ */ c(Qt.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ c(
6533
6571
  zo,
6534
6572
  {
@@ -6571,17 +6609,17 @@ function Wn(e) {
6571
6609
  function Vo(e) {
6572
6610
  return Wn(e) ? "indeterminate" : e ? "checked" : "unchecked";
6573
6611
  }
6574
- function kg(e) {
6612
+ function Mg(e) {
6575
6613
  const t = document.activeElement;
6576
6614
  for (const n of e)
6577
6615
  if (n === t || (n.focus(), document.activeElement !== t)) return;
6578
6616
  }
6579
- function Mg(e, t) {
6617
+ function kg(e, t) {
6580
6618
  return e.map((n, r) => e[(t + r) % e.length]);
6581
6619
  }
6582
6620
  function Dg(e, t, n) {
6583
6621
  const o = t.length > 1 && Array.from(t).every((f) => f === t[0]) ? t[0] : t, s = n ? e.indexOf(n) : -1;
6584
- let a = Mg(e, Math.max(s, 0));
6622
+ let a = kg(e, Math.max(s, 0));
6585
6623
  o.length === 1 && (a = a.filter((f) => f !== n));
6586
6624
  const u = a.find(
6587
6625
  (f) => f.toLowerCase().startsWith(o.toLowerCase())
@@ -6607,8 +6645,8 @@ function en(e) {
6607
6645
  }
6608
6646
  var $g = Li, Bg = $o, Ug = $i, zg = Bi, Hg = Ho, Wg = Ui, Vg = dr, jg = Hi, Kg = Vi, Gg = Ki, qg = qi, Xg = Xi, Yg = Yi, Jg = Zi, Zg = ec, fr = "DropdownMenu", [Qg, Cy] = Ue(
6609
6647
  fr,
6610
- [Mi]
6611
- ), Ee = Mi(), [eb, nc] = Qg(fr), rc = (e) => {
6648
+ [ki]
6649
+ ), Ee = ki(), [eb, nc] = Qg(fr), rc = (e) => {
6612
6650
  const {
6613
6651
  __scopeDropdownMenu: t,
6614
6652
  children: n,
@@ -6916,127 +6954,127 @@ function Pn({
6916
6954
  listCheckpoints: y,
6917
6955
  navigateToCheckpoint: x,
6918
6956
  returnToLatest: E
6919
- } = Ua(), [C, I] = ce(""), [N, L] = ce(null), [k, D] = ce(null), [j, K] = ce([]), [W, B] = ce(!1), [q, F] = ce([]), [G, T] = ce(null), P = rt(null), _ = rt(null), O = rt(null), [X, $] = ce("desktop");
6957
+ } = Ua(), [C, I] = ce(""), [N, F] = ce(null), [D, L] = ce(null), [j, K] = ce([]), [W, B] = ce(!1), [q, $] = ce([]), [G, T] = ce(null), P = rt(null), _ = rt(null), O = rt(null), [Y, M] = ce("desktop");
6920
6958
  we(() => {
6921
- const M = () => {
6922
- const Q = window.innerWidth;
6923
- $(Q < 640 ? "phone" : Q < 1024 ? "tablet" : "desktop");
6959
+ const k = () => {
6960
+ const X = window.innerWidth;
6961
+ M(X < 640 ? "phone" : X < 1024 ? "tablet" : "desktop");
6924
6962
  };
6925
- return M(), window.addEventListener("resize", M), () => window.removeEventListener("resize", M);
6963
+ return k(), window.addEventListener("resize", k), () => window.removeEventListener("resize", k);
6926
6964
  }, []), we(() => {
6927
- var M;
6928
- (M = P.current) == null || M.scrollIntoView({ behavior: "smooth" });
6965
+ var k;
6966
+ (k = P.current) == null || k.scrollIntoView({ behavior: "smooth" });
6929
6967
  }, [p]), we(() => {
6930
- var M;
6931
- n && ((M = _.current) == null || M.focus());
6968
+ var k;
6969
+ n && ((k = _.current) == null || k.focus());
6932
6970
  }, [n]), we(() => {
6933
6971
  m && !W && (f == null || f(m));
6934
6972
  }, [m, W, f]), we(() => {
6935
- let M = !0;
6973
+ let k = !0;
6936
6974
  if (!d) {
6937
- F([]), T(null);
6975
+ $([]), T(null);
6938
6976
  return;
6939
6977
  }
6940
- return y(d).then((Q) => {
6978
+ return y(d).then((X) => {
6941
6979
  var Re;
6942
- if (!M) return;
6943
- const re = Q.checkpoints || [];
6944
- F(re);
6945
- const ue = ((Re = re.slice().sort(
6980
+ if (!k) return;
6981
+ const ne = X.checkpoints || [];
6982
+ $(ne);
6983
+ const ue = ((Re = ne.slice().sort(
6946
6984
  (yt, Se) => new Date(Se.createdAt).getTime() - new Date(yt.createdAt).getTime()
6947
6985
  )[0]) == null ? void 0 : Re.checkpointId) || null;
6948
6986
  T((yt) => yt ?? ue);
6949
6987
  }).catch(() => {
6950
6988
  }), () => {
6951
- M = !1;
6989
+ k = !1;
6952
6990
  };
6953
6991
  }, [d, y]), we(() => {
6954
6992
  w && T(w);
6955
6993
  }, [w]);
6956
- const z = (M) => {
6957
- if (M.length > Nt)
6958
- return `Message too long (${M.length}/${Nt} characters)`;
6994
+ const z = (k) => {
6995
+ if (k.length > Nt)
6996
+ return `Message too long (${k.length}/${Nt} characters)`;
6959
6997
  try {
6960
- return Ip(M), null;
6961
- } catch (Q) {
6962
- return (Q == null ? void 0 : Q.message) || "Invalid message";
6998
+ return Ip(k), null;
6999
+ } catch (X) {
7000
+ return (X == null ? void 0 : X.message) || "Invalid message";
6963
7001
  }
6964
- }, le = (M) => {
6965
- const Q = M.content || [], re = Q.filter((ue) => ue.type === "text").map((ue) => ue.text).join("");
6966
- if (re) return re;
7002
+ }, le = (k) => {
7003
+ const X = k.content || [], ne = X.filter((ue) => ue.type === "text").map((ue) => ue.text).join("");
7004
+ if (ne) return ne;
6967
7005
  try {
6968
- return JSON.stringify(Q, null, 2);
7006
+ return JSON.stringify(X, null, 2);
6969
7007
  } catch {
6970
- return String(Q);
7008
+ return String(X);
6971
7009
  }
6972
- }, ae = (M) => {
7010
+ }, se = (k) => {
6973
7011
  var yt;
6974
7012
  if (!q.length)
6975
7013
  return [];
6976
- const re = (((yt = p[M]) == null ? void 0 : yt.role) ?? "user") === "user", ue = re ? M + 2 : M + 1;
6977
- return q.filter((Se) => (Se.messagesLen ?? -1) >= (re ? ue : 0)).filter((Se) => re ? (Se.messagesLen ?? 0) >= ue : (Se.messagesLen ?? 0) === ue).map((Se) => ({
7014
+ const ne = (((yt = p[k]) == null ? void 0 : yt.role) ?? "user") === "user", ue = ne ? k + 2 : k + 1;
7015
+ return q.filter((Se) => (Se.messagesLen ?? -1) >= (ne ? ue : 0)).filter((Se) => ne ? (Se.messagesLen ?? 0) >= ue : (Se.messagesLen ?? 0) === ue).map((Se) => ({
6978
7016
  checkpoint_id: Se.checkpointId,
6979
7017
  checkpoint_ns: Se.checkpointNs,
6980
7018
  message_count: Se.messagesLen ?? 0,
6981
7019
  last_message_preview: Se.preview ?? void 0,
6982
7020
  ts: new Date(Se.createdAt).getTime(),
6983
7021
  isCurrent: Se.checkpointId === G
6984
- })).sort((Se, Mu) => (Se.ts || 0) - (Mu.ts || 0));
6985
- }, V = (M) => {
6986
- if (M === void 0)
7022
+ })).sort((Se, ku) => (Se.ts || 0) - (ku.ts || 0));
7023
+ }, V = (k) => {
7024
+ if (k === void 0)
6987
7025
  return { canGoBack: !1, canGoForward: !1, currentIndex: 0, totalBranches: 0 };
6988
- const Q = ae(M);
6989
- if (Q.length <= 1)
6990
- return { canGoBack: !1, canGoForward: !1, currentIndex: 0, totalBranches: Q.length };
6991
- const re = Math.max(0, Q.findIndex((ue) => ue.isCurrent));
6992
- return { canGoBack: re > 0, canGoForward: re < Q.length - 1, currentIndex: re, totalBranches: Q.length };
6993
- }, oe = async () => {
6994
- const M = C.trim();
6995
- if (!M && j.length === 0) return;
6996
- const Q = z(M);
6997
- if (Q) {
6998
- D(Q);
7026
+ const X = se(k);
7027
+ if (X.length <= 1)
7028
+ return { canGoBack: !1, canGoForward: !1, currentIndex: 0, totalBranches: X.length };
7029
+ const ne = Math.max(0, X.findIndex((ue) => ue.isCurrent));
7030
+ return { canGoBack: ne > 0, canGoForward: ne < X.length - 1, currentIndex: ne, totalBranches: X.length };
7031
+ }, re = async () => {
7032
+ const k = C.trim();
7033
+ if (!k && j.length === 0) return;
7034
+ const X = z(k);
7035
+ if (X) {
7036
+ L(X);
6999
7037
  return;
7000
7038
  }
7001
7039
  try {
7002
- const re = window.__editingCheckpointId || G || void 0;
7003
- await h(M, { checkpointId: re, payloadExtras: N ? { edit: !0, originalMessageId: N } : void 0, attachments: j }), u == null || u(M), I(""), D(null), K([]), delete window.__editingCheckpointId, L(null), _.current && (_.current.style.height = "auto");
7004
- } catch (re) {
7005
- const ue = (re == null ? void 0 : re.message) || "Failed to send message";
7006
- D(ue), f == null || f(ue);
7007
- }
7008
- }, ie = (M, Q) => {
7009
- a && (L(M), I(Q), D(null), setTimeout(() => {
7040
+ const ne = window.__editingCheckpointId || G || void 0;
7041
+ await h(k, { checkpointId: ne, payloadExtras: N ? { edit: !0, originalMessageId: N } : void 0, attachments: j }), u == null || u(k), I(""), L(null), K([]), delete window.__editingCheckpointId, F(null), _.current && (_.current.style.height = "auto");
7042
+ } catch (ne) {
7043
+ const ue = (ne == null ? void 0 : ne.message) || "Failed to send message";
7044
+ L(ue), f == null || f(ue);
7045
+ }
7046
+ }, ie = (k, X) => {
7047
+ a && (F(k), I(X), L(null), setTimeout(() => {
7010
7048
  _.current && (_.current.focus(), _.current.style.height = "auto", _.current.style.height = _.current.scrollHeight + "px");
7011
7049
  }, 0));
7012
- }, se = async (M, Q) => {
7013
- const re = p.find((Re) => Re.id === M);
7014
- if (!re) {
7015
- D("Message not found");
7050
+ }, oe = async (k, X) => {
7051
+ const ne = p.find((Re) => Re.id === k);
7052
+ if (!ne) {
7053
+ L("Message not found");
7016
7054
  return;
7017
7055
  }
7018
- const ue = le(re);
7019
- L(M), I(ue), window.__editingCheckpointId = Q, setTimeout(() => {
7056
+ const ue = le(ne);
7057
+ F(k), I(ue), window.__editingCheckpointId = X, setTimeout(() => {
7020
7058
  var Re;
7021
7059
  return (Re = _.current) == null ? void 0 : Re.focus();
7022
7060
  }, 0);
7023
7061
  }, H = () => {
7024
- L(null), I(""), D(null), delete window.__editingCheckpointId, _.current && (_.current.style.height = "auto");
7025
- }, Z = (M) => {
7026
- M.key === "Enter" && !M.shiftKey ? (M.preventDefault(), oe()) : M.key === "Escape" && N && (M.preventDefault(), H());
7027
- }, de = (M) => {
7028
- const Q = Array.from(M.target.files || []);
7029
- K((re) => [...re, ...Q]);
7030
- }, pe = (M) => K((Q) => Q.filter((re, ue) => M !== ue)), Y = async (M) => {
7031
- d && (await x(M), T(M));
7032
- }, ge = async () => {
7062
+ F(null), I(""), L(null), delete window.__editingCheckpointId, _.current && (_.current.style.height = "auto");
7063
+ }, Z = (k) => {
7064
+ k.key === "Enter" && !k.shiftKey ? (k.preventDefault(), re()) : k.key === "Escape" && N && (k.preventDefault(), H());
7065
+ }, de = (k) => {
7066
+ const X = Array.from(k.target.files || []);
7067
+ K((ne) => [...ne, ...X]);
7068
+ }, he = (k) => K((X) => X.filter((ne, ue) => k !== ue)), me = async (k) => {
7069
+ d && (await x(k), T(k));
7070
+ }, Q = async () => {
7033
7071
  await E(), T(null);
7034
- }, te = `flex flex-col h-full min-w-0 bg-transparent ${e} ${i.container || ""}`, he = `flex-1 min-h-0 min-w-0 overflow-y-auto p-4 space-y-4 bg-transparent ${i.messagesArea || ""}`, ve = `flex-shrink-0 border-t p-4 bg-transparent ${i.inputArea || ""}`;
7035
- return /* @__PURE__ */ R("div", { className: te, children: [
7072
+ }, ve = `flex flex-col h-full min-w-0 bg-transparent ${e} ${i.container || ""}`, ae = `flex-1 min-h-0 min-w-0 overflow-y-auto p-4 space-y-4 bg-transparent ${i.messagesArea || ""}`, fe = `flex-shrink-0 border-t p-4 bg-transparent ${i.inputArea || ""}`;
7073
+ return /* @__PURE__ */ R("div", { className: ve, children: [
7036
7074
  !!m && !W && /* @__PURE__ */ R("div", { className: "bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
7037
7075
  /* @__PURE__ */ c("span", { children: m }),
7038
7076
  /* @__PURE__ */ c(
7039
- fe,
7077
+ pe,
7040
7078
  {
7041
7079
  variant: "ghost",
7042
7080
  size: "sm",
@@ -7055,68 +7093,68 @@ function Pn({
7055
7093
  {
7056
7094
  className: "border rounded px-2 py-1 text-xs",
7057
7095
  value: G ?? "",
7058
- onChange: (M) => {
7059
- const Q = M.target.value || null;
7060
- Q ? Y(Q) : ge();
7096
+ onChange: (k) => {
7097
+ const X = k.target.value || null;
7098
+ X ? me(X) : Q();
7061
7099
  },
7062
7100
  children: [
7063
7101
  /* @__PURE__ */ c("option", { value: "", children: "Latest" }),
7064
- q.slice().sort((M, Q) => new Date(Q.createdAt).getTime() - new Date(M.createdAt).getTime()).map((M) => /* @__PURE__ */ R("option", { value: M.checkpointId, children: [
7065
- new Date(M.createdAt).toLocaleString(),
7066
- M.preview ? ` — ${M.preview.slice(0, 30)}` : ""
7067
- ] }, M.checkpointId))
7102
+ q.slice().sort((k, X) => new Date(X.createdAt).getTime() - new Date(k.createdAt).getTime()).map((k) => /* @__PURE__ */ R("option", { value: k.checkpointId, children: [
7103
+ new Date(k.createdAt).toLocaleString(),
7104
+ k.preview ? ` — ${k.preview.slice(0, 30)}` : ""
7105
+ ] }, k.checkpointId))
7068
7106
  ]
7069
7107
  }
7070
7108
  )
7071
7109
  ] }),
7072
- /* @__PURE__ */ R("div", { className: he, style: r ? { maxHeight: r } : void 0, children: [
7073
- p.length === 0 ? /* @__PURE__ */ c("div", { className: "flex items-center justify-center py-8 text-muted-foreground", children: "No messages yet. Start a conversation!" }) : p.map((M, Q) => /* @__PURE__ */ c(
7110
+ /* @__PURE__ */ R("div", { className: ae, style: r ? { maxHeight: r } : void 0, children: [
7111
+ p.length === 0 ? /* @__PURE__ */ c("div", { className: "flex items-center justify-center py-8 text-muted-foreground", children: "No messages yet. Start a conversation!" }) : p.map((k, X) => /* @__PURE__ */ c(
7074
7112
  gp,
7075
7113
  {
7076
- message: M,
7077
- messageIndex: Q,
7078
- isStreamingMessage: g && v === M.id,
7114
+ message: k,
7115
+ messageIndex: X,
7116
+ isStreamingMessage: g && v === k.id,
7079
7117
  streamingDebounceMs: o,
7080
- isEditing: N === M.id,
7118
+ isEditing: N === k.id,
7081
7119
  showActions: a,
7082
7120
  showTimestamp: !1,
7083
7121
  showAgentName: !0,
7084
- layoutSize: X,
7122
+ layoutSize: Y,
7085
7123
  truncateToolMessages: !1,
7086
7124
  toolMessagePreviewLength: 200,
7087
- checkpointBranches: ae(Q),
7125
+ checkpointBranches: se(X),
7088
7126
  currentCheckpointId: G ?? void 0,
7089
- temporalNavigation: V(Q),
7090
- onSwitchToCheckpoint: Y,
7091
- onReturnToMainThread: ge,
7127
+ temporalNavigation: V(X),
7128
+ onSwitchToCheckpoint: me,
7129
+ onReturnToMainThread: Q,
7092
7130
  onNavigateToPreviousBranch: () => {
7093
- const re = ae(Q), ue = Math.max(0, re.findIndex((Re) => Re.isCurrent));
7094
- ue > 0 && Y(re[ue - 1].checkpoint_id);
7131
+ const ne = se(X), ue = Math.max(0, ne.findIndex((Re) => Re.isCurrent));
7132
+ ue > 0 && me(ne[ue - 1].checkpoint_id);
7095
7133
  },
7096
7134
  onNavigateToNextBranch: () => {
7097
- const re = ae(Q), ue = Math.max(0, re.findIndex((Re) => Re.isCurrent));
7098
- ue >= 0 && ue < re.length - 1 && Y(re[ue + 1].checkpoint_id);
7135
+ const ne = se(X), ue = Math.max(0, ne.findIndex((Re) => Re.isCurrent));
7136
+ ue >= 0 && ue < ne.length - 1 && me(ne[ue + 1].checkpoint_id);
7099
7137
  },
7100
- onEdit: (re, ue) => ie(re, ue),
7101
- onEditFromCheckpoint: se,
7138
+ onEdit: (ne, ue) => ie(ne, ue),
7139
+ onEditFromCheckpoint: oe,
7102
7140
  onRegenerate: () => {
7103
- const re = [...p].reverse().find((Re) => Re.role === "user"), ue = re ? le(re) : "";
7141
+ const ne = [...p].reverse().find((Re) => Re.role === "user"), ue = ne ? le(ne) : "";
7104
7142
  ue && h(ue, { checkpointId: G ?? void 0 });
7105
7143
  },
7106
7144
  onCancelEdit: H
7107
7145
  },
7108
- M.id || Q
7146
+ k.id || X
7109
7147
  )),
7110
7148
  /* @__PURE__ */ c("div", { ref: P })
7111
7149
  ] }),
7112
- /* @__PURE__ */ R("div", { className: ve, children: [
7150
+ /* @__PURE__ */ R("div", { className: fe, children: [
7113
7151
  N && /* @__PURE__ */ c("div", { className: "mb-3 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: /* @__PURE__ */ R("div", { className: "flex items-center justify-between", children: [
7114
7152
  /* @__PURE__ */ R("div", { className: "flex items-center gap-2", children: [
7115
7153
  /* @__PURE__ */ c(fa, { size: 16, className: "text-blue-600" }),
7116
7154
  /* @__PURE__ */ c("span", { className: "text-sm font-medium text-blue-800", children: "Editing message" })
7117
7155
  ] }),
7118
7156
  /* @__PURE__ */ c(
7119
- fe,
7157
+ pe,
7120
7158
  {
7121
7159
  variant: "ghost",
7122
7160
  size: "sm",
@@ -7133,31 +7171,31 @@ function Pn({
7133
7171
  ref: O,
7134
7172
  type: "file",
7135
7173
  multiple: !0,
7136
- onChange: (M) => de(M),
7174
+ onChange: (k) => de(k),
7137
7175
  className: "hidden"
7138
7176
  }
7139
7177
  ),
7140
- j.length > 0 && /* @__PURE__ */ c("div", { className: "mb-3 flex flex-wrap gap-2", children: j.map((M, Q) => /* @__PURE__ */ R("div", { className: "flex items-center gap-2 bg-gray-100 rounded-lg px-3 py-2 text-sm", children: [
7178
+ j.length > 0 && /* @__PURE__ */ c("div", { className: "mb-3 flex flex-wrap gap-2", children: j.map((k, X) => /* @__PURE__ */ R("div", { className: "flex items-center gap-2 bg-gray-100 rounded-lg px-3 py-2 text-sm", children: [
7141
7179
  /* @__PURE__ */ c(ss, { size: 14 }),
7142
- /* @__PURE__ */ c("span", { className: "truncate max-w-[150px]", children: M.name }),
7180
+ /* @__PURE__ */ c("span", { className: "truncate max-w-[150px]", children: k.name }),
7143
7181
  /* @__PURE__ */ c(
7144
- fe,
7182
+ pe,
7145
7183
  {
7146
7184
  variant: "ghost",
7147
7185
  size: "sm",
7148
- onClick: () => pe(Q),
7186
+ onClick: () => he(X),
7149
7187
  className: "h-4 w-4 p-0 text-gray-500 hover:text-red-500",
7150
- "aria-label": `Remove ${M.name}`,
7188
+ "aria-label": `Remove ${k.name}`,
7151
7189
  children: /* @__PURE__ */ c(Kt, { size: 12 })
7152
7190
  }
7153
7191
  )
7154
- ] }, Q)) })
7192
+ ] }, X)) })
7155
7193
  ] }),
7156
- k && /* @__PURE__ */ c("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: k }),
7194
+ D && /* @__PURE__ */ c("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: D }),
7157
7195
  /* @__PURE__ */ R("div", { className: "flex items-end gap-2", children: [
7158
7196
  s && /* @__PURE__ */ R(wb, { children: [
7159
7197
  /* @__PURE__ */ c(yb, { asChild: !0, children: /* @__PURE__ */ c(
7160
- fe,
7198
+ pe,
7161
7199
  {
7162
7200
  type: "button",
7163
7201
  size: "icon",
@@ -7169,8 +7207,8 @@ function Pn({
7169
7207
  }
7170
7208
  ) }),
7171
7209
  /* @__PURE__ */ c(Nc, { align: "start", sideOffset: 6, className: "w-52", children: /* @__PURE__ */ R(Tc, { onClick: () => {
7172
- var M;
7173
- return (M = O.current) == null ? void 0 : M.click();
7210
+ var k;
7211
+ return (k = O.current) == null ? void 0 : k.click();
7174
7212
  }, className: "cursor-pointer", children: [
7175
7213
  /* @__PURE__ */ c(ss, { className: "h-4 w-4 mr-2" }),
7176
7214
  " Attach files or images"
@@ -7181,19 +7219,19 @@ function Pn({
7181
7219
  {
7182
7220
  ref: _,
7183
7221
  value: C,
7184
- onChange: (M) => {
7185
- I(M.target.value), D(null), _.current && (_.current.style.height = "auto", _.current.style.height = `${_.current.scrollHeight}px`);
7222
+ onChange: (k) => {
7223
+ I(k.target.value), L(null), _.current && (_.current.style.height = "auto", _.current.style.height = `${_.current.scrollHeight}px`);
7186
7224
  },
7187
7225
  onKeyDown: Z,
7188
7226
  placeholder: N ? "Edit your message..." : t,
7189
- className: `resize-none min-h-[44px] max-h-[20rem] w-full ${N ? "border-blue-400 bg-blue-50" : ""} ${k ? "border-red-400" : ""} ${i.textarea || ""}`,
7227
+ className: `resize-none min-h-[44px] max-h-[20rem] w-full ${N ? "border-blue-400 bg-blue-50" : ""} ${D ? "border-red-400" : ""} ${i.textarea || ""}`,
7190
7228
  disabled: !1,
7191
7229
  maxLength: Nt,
7192
7230
  rows: 1
7193
7231
  }
7194
7232
  ) }),
7195
7233
  /* @__PURE__ */ c("div", { children: g ? /* @__PURE__ */ c(
7196
- fe,
7234
+ pe,
7197
7235
  {
7198
7236
  type: "button",
7199
7237
  onClick: b,
@@ -7204,10 +7242,10 @@ function Pn({
7204
7242
  children: /* @__PURE__ */ c(Wu, { size: 16 })
7205
7243
  }
7206
7244
  ) : /* @__PURE__ */ c(
7207
- fe,
7245
+ pe,
7208
7246
  {
7209
7247
  type: "button",
7210
- onClick: oe,
7248
+ onClick: re,
7211
7249
  size: "icon",
7212
7250
  disabled: !C.trim() && j.length === 0,
7213
7251
  className: `shrink-0 ${i.sendButton || ""}`,
@@ -7245,7 +7283,7 @@ function ro(e, [t, n]) {
7245
7283
  function Tb(e, t) {
7246
7284
  return l.useReducer((n, r) => t[n][r] ?? n, e);
7247
7285
  }
7248
- var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, ke] = Ac(jo), Pc = l.forwardRef(
7286
+ var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, Me] = Ac(jo), Pc = l.forwardRef(
7249
7287
  (e, t) => {
7250
7288
  const {
7251
7289
  __scopeScrollArea: n,
@@ -7253,13 +7291,13 @@ var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, ke] = Ac(jo), Pc = l.forwardRef(
7253
7291
  dir: o,
7254
7292
  scrollHideDelay: s = 600,
7255
7293
  ...a
7256
- } = e, [i, u] = l.useState(null), [f, d] = l.useState(null), [p, g] = l.useState(null), [v, m] = l.useState(null), [h, b] = l.useState(null), [w, y] = l.useState(0), [x, E] = l.useState(0), [C, I] = l.useState(!1), [N, L] = l.useState(!1), k = ne(t, (j) => u(j)), D = tr(o);
7294
+ } = e, [i, u] = l.useState(null), [f, d] = l.useState(null), [p, g] = l.useState(null), [v, m] = l.useState(null), [h, b] = l.useState(null), [w, y] = l.useState(0), [x, E] = l.useState(0), [C, I] = l.useState(!1), [N, F] = l.useState(!1), D = te(t, (j) => u(j)), L = tr(o);
7257
7295
  return /* @__PURE__ */ c(
7258
7296
  Ab,
7259
7297
  {
7260
7298
  scope: n,
7261
7299
  type: r,
7262
- dir: D,
7300
+ dir: L,
7263
7301
  scrollHideDelay: s,
7264
7302
  scrollArea: i,
7265
7303
  viewport: f,
@@ -7273,15 +7311,15 @@ var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, ke] = Ac(jo), Pc = l.forwardRef(
7273
7311
  scrollbarY: h,
7274
7312
  onScrollbarYChange: b,
7275
7313
  scrollbarYEnabled: N,
7276
- onScrollbarYEnabledChange: L,
7314
+ onScrollbarYEnabledChange: F,
7277
7315
  onCornerWidthChange: y,
7278
7316
  onCornerHeightChange: E,
7279
7317
  children: /* @__PURE__ */ c(
7280
7318
  J.div,
7281
7319
  {
7282
- dir: D,
7320
+ dir: L,
7283
7321
  ...a,
7284
- ref: k,
7322
+ ref: D,
7285
7323
  style: {
7286
7324
  position: "relative",
7287
7325
  // Pass corner sizes as CSS vars to reduce re-renders of context consumers
@@ -7298,7 +7336,7 @@ var jo = "ScrollArea", [Ac, Ey] = Ue(jo), [Ab, ke] = Ac(jo), Pc = l.forwardRef(
7298
7336
  Pc.displayName = jo;
7299
7337
  var _c = "ScrollAreaViewport", Ic = l.forwardRef(
7300
7338
  (e, t) => {
7301
- const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, a = ke(_c, n), i = l.useRef(null), u = ne(t, i, a.onViewportChange);
7339
+ const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, a = Me(_c, n), i = l.useRef(null), u = te(t, i, a.onViewportChange);
7302
7340
  return /* @__PURE__ */ R(De, { children: [
7303
7341
  /* @__PURE__ */ c(
7304
7342
  "style",
@@ -7340,7 +7378,7 @@ var _c = "ScrollAreaViewport", Ic = l.forwardRef(
7340
7378
  Ic.displayName = _c;
7341
7379
  var Ye = "ScrollAreaScrollbar", Ko = l.forwardRef(
7342
7380
  (e, t) => {
7343
- const { forceMount: n, ...r } = e, o = ke(Ye, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: a } = o, i = e.orientation === "horizontal";
7381
+ const { forceMount: n, ...r } = e, o = Me(Ye, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: a } = o, i = e.orientation === "horizontal";
7344
7382
  return l.useEffect(() => (i ? s(!0) : a(!0), () => {
7345
7383
  i ? s(!1) : a(!1);
7346
7384
  }), [i, s, a]), o.type === "hover" ? /* @__PURE__ */ c(Pb, { ...r, ref: t, forceMount: n }) : o.type === "scroll" ? /* @__PURE__ */ c(_b, { ...r, ref: t, forceMount: n }) : o.type === "auto" ? /* @__PURE__ */ c(Oc, { ...r, ref: t, forceMount: n }) : o.type === "always" ? /* @__PURE__ */ c(Go, { ...r, ref: t }) : null;
@@ -7348,7 +7386,7 @@ var Ye = "ScrollAreaScrollbar", Ko = l.forwardRef(
7348
7386
  );
7349
7387
  Ko.displayName = Ye;
7350
7388
  var Pb = l.forwardRef((e, t) => {
7351
- const { forceMount: n, ...r } = e, o = ke(Ye, e.__scopeScrollArea), [s, a] = l.useState(!1);
7389
+ const { forceMount: n, ...r } = e, o = Me(Ye, e.__scopeScrollArea), [s, a] = l.useState(!1);
7352
7390
  return l.useEffect(() => {
7353
7391
  const i = o.scrollArea;
7354
7392
  let u = 0;
@@ -7371,7 +7409,7 @@ var Pb = l.forwardRef((e, t) => {
7371
7409
  }
7372
7410
  ) });
7373
7411
  }), _b = l.forwardRef((e, t) => {
7374
- const { forceMount: n, ...r } = e, o = ke(Ye, e.__scopeScrollArea), s = e.orientation === "horizontal", a = hr(() => u("SCROLL_END"), 100), [i, u] = Tb("hidden", {
7412
+ const { forceMount: n, ...r } = e, o = Me(Ye, e.__scopeScrollArea), s = e.orientation === "horizontal", a = hr(() => u("SCROLL_END"), 100), [i, u] = Tb("hidden", {
7375
7413
  hidden: {
7376
7414
  SCROLL: "scrolling"
7377
7415
  },
@@ -7415,13 +7453,13 @@ var Pb = l.forwardRef((e, t) => {
7415
7453
  }
7416
7454
  ) });
7417
7455
  }), Oc = l.forwardRef((e, t) => {
7418
- const n = ke(Ye, e.__scopeScrollArea), { forceMount: r, ...o } = e, [s, a] = l.useState(!1), i = e.orientation === "horizontal", u = hr(() => {
7456
+ const n = Me(Ye, e.__scopeScrollArea), { forceMount: r, ...o } = e, [s, a] = l.useState(!1), i = e.orientation === "horizontal", u = hr(() => {
7419
7457
  if (n.viewport) {
7420
7458
  const f = n.viewport.offsetWidth < n.viewport.scrollWidth, d = n.viewport.offsetHeight < n.viewport.scrollHeight;
7421
7459
  a(i ? f : d);
7422
7460
  }
7423
7461
  }, 10);
7424
- return kt(n.viewport, u), kt(n.content, u), /* @__PURE__ */ c(Ae, { present: r || s, children: /* @__PURE__ */ c(
7462
+ return Mt(n.viewport, u), Mt(n.content, u), /* @__PURE__ */ c(Ae, { present: r || s, children: /* @__PURE__ */ c(
7425
7463
  Go,
7426
7464
  {
7427
7465
  "data-state": s ? "visible" : "hidden",
@@ -7430,7 +7468,7 @@ var Pb = l.forwardRef((e, t) => {
7430
7468
  }
7431
7469
  ) });
7432
7470
  }), Go = l.forwardRef((e, t) => {
7433
- const { orientation: n = "vertical", ...r } = e, o = ke(Ye, e.__scopeScrollArea), s = l.useRef(null), a = l.useRef(0), [i, u] = l.useState({
7471
+ const { orientation: n = "vertical", ...r } = e, o = Me(Ye, e.__scopeScrollArea), s = l.useRef(null), a = l.useRef(0), [i, u] = l.useState({
7434
7472
  content: 0,
7435
7473
  viewport: 0,
7436
7474
  scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
@@ -7484,11 +7522,11 @@ var Pb = l.forwardRef((e, t) => {
7484
7522
  }
7485
7523
  ) : null;
7486
7524
  }), Ib = l.forwardRef((e, t) => {
7487
- const { sizes: n, onSizesChange: r, ...o } = e, s = ke(Ye, e.__scopeScrollArea), [a, i] = l.useState(), u = l.useRef(null), f = ne(t, u, s.onScrollbarXChange);
7525
+ const { sizes: n, onSizesChange: r, ...o } = e, s = Me(Ye, e.__scopeScrollArea), [a, i] = l.useState(), u = l.useRef(null), f = te(t, u, s.onScrollbarXChange);
7488
7526
  return l.useEffect(() => {
7489
7527
  u.current && i(getComputedStyle(u.current));
7490
7528
  }, [u]), /* @__PURE__ */ c(
7491
- Mc,
7529
+ kc,
7492
7530
  {
7493
7531
  "data-orientation": "horizontal",
7494
7532
  ...o,
@@ -7523,11 +7561,11 @@ var Pb = l.forwardRef((e, t) => {
7523
7561
  }
7524
7562
  );
7525
7563
  }), Ob = l.forwardRef((e, t) => {
7526
- const { sizes: n, onSizesChange: r, ...o } = e, s = ke(Ye, e.__scopeScrollArea), [a, i] = l.useState(), u = l.useRef(null), f = ne(t, u, s.onScrollbarYChange);
7564
+ const { sizes: n, onSizesChange: r, ...o } = e, s = Me(Ye, e.__scopeScrollArea), [a, i] = l.useState(), u = l.useRef(null), f = te(t, u, s.onScrollbarYChange);
7527
7565
  return l.useEffect(() => {
7528
7566
  u.current && i(getComputedStyle(u.current));
7529
7567
  }, [u]), /* @__PURE__ */ c(
7530
- Mc,
7568
+ kc,
7531
7569
  {
7532
7570
  "data-orientation": "vertical",
7533
7571
  ...o,
@@ -7562,7 +7600,7 @@ var Pb = l.forwardRef((e, t) => {
7562
7600
  }
7563
7601
  }
7564
7602
  );
7565
- }), [kb, kc] = Ac(Ye), Mc = l.forwardRef((e, t) => {
7603
+ }), [Mb, Mc] = Ac(Ye), kc = l.forwardRef((e, t) => {
7566
7604
  const {
7567
7605
  __scopeScrollArea: n,
7568
7606
  sizes: r,
@@ -7575,21 +7613,21 @@ var Pb = l.forwardRef((e, t) => {
7575
7613
  onWheelScroll: d,
7576
7614
  onResize: p,
7577
7615
  ...g
7578
- } = e, v = ke(Ye, n), [m, h] = l.useState(null), b = ne(t, (k) => h(k)), w = l.useRef(null), y = l.useRef(""), x = v.viewport, E = r.content - r.viewport, C = ye(d), I = ye(u), N = hr(p, 10);
7579
- function L(k) {
7616
+ } = e, v = Me(Ye, n), [m, h] = l.useState(null), b = te(t, (D) => h(D)), w = l.useRef(null), y = l.useRef(""), x = v.viewport, E = r.content - r.viewport, C = ye(d), I = ye(u), N = hr(p, 10);
7617
+ function F(D) {
7580
7618
  if (w.current) {
7581
- const D = k.clientX - w.current.left, j = k.clientY - w.current.top;
7582
- f({ x: D, y: j });
7619
+ const L = D.clientX - w.current.left, j = D.clientY - w.current.top;
7620
+ f({ x: L, y: j });
7583
7621
  }
7584
7622
  }
7585
7623
  return l.useEffect(() => {
7586
- const k = (D) => {
7587
- const j = D.target;
7588
- (m == null ? void 0 : m.contains(j)) && C(D, E);
7624
+ const D = (L) => {
7625
+ const j = L.target;
7626
+ (m == null ? void 0 : m.contains(j)) && C(L, E);
7589
7627
  };
7590
- return document.addEventListener("wheel", k, { passive: !1 }), () => document.removeEventListener("wheel", k, { passive: !1 });
7591
- }, [x, m, E, C]), l.useEffect(I, [r, I]), kt(m, N), kt(v.content, N), /* @__PURE__ */ c(
7592
- kb,
7628
+ return document.addEventListener("wheel", D, { passive: !1 }), () => document.removeEventListener("wheel", D, { passive: !1 });
7629
+ }, [x, m, E, C]), l.useEffect(I, [r, I]), Mt(m, N), Mt(v.content, N), /* @__PURE__ */ c(
7630
+ Mb,
7593
7631
  {
7594
7632
  scope: n,
7595
7633
  scrollbar: m,
@@ -7604,13 +7642,13 @@ var Pb = l.forwardRef((e, t) => {
7604
7642
  ...g,
7605
7643
  ref: b,
7606
7644
  style: { position: "absolute", ...g.style },
7607
- onPointerDown: U(e.onPointerDown, (k) => {
7608
- k.button === 0 && (k.target.setPointerCapture(k.pointerId), w.current = m.getBoundingClientRect(), y.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", v.viewport && (v.viewport.style.scrollBehavior = "auto"), L(k));
7645
+ onPointerDown: U(e.onPointerDown, (D) => {
7646
+ D.button === 0 && (D.target.setPointerCapture(D.pointerId), w.current = m.getBoundingClientRect(), y.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", v.viewport && (v.viewport.style.scrollBehavior = "auto"), F(D));
7609
7647
  }),
7610
- onPointerMove: U(e.onPointerMove, L),
7611
- onPointerUp: U(e.onPointerUp, (k) => {
7612
- const D = k.target;
7613
- D.hasPointerCapture(k.pointerId) && D.releasePointerCapture(k.pointerId), document.body.style.webkitUserSelect = y.current, v.viewport && (v.viewport.style.scrollBehavior = ""), w.current = null;
7648
+ onPointerMove: U(e.onPointerMove, F),
7649
+ onPointerUp: U(e.onPointerUp, (D) => {
7650
+ const L = D.target;
7651
+ L.hasPointerCapture(D.pointerId) && L.releasePointerCapture(D.pointerId), document.body.style.webkitUserSelect = y.current, v.viewport && (v.viewport.style.scrollBehavior = ""), w.current = null;
7614
7652
  })
7615
7653
  }
7616
7654
  )
@@ -7618,12 +7656,12 @@ var Pb = l.forwardRef((e, t) => {
7618
7656
  );
7619
7657
  }), Vn = "ScrollAreaThumb", Dc = l.forwardRef(
7620
7658
  (e, t) => {
7621
- const { forceMount: n, ...r } = e, o = kc(Vn, e.__scopeScrollArea);
7622
- return /* @__PURE__ */ c(Ae, { present: n || o.hasThumb, children: /* @__PURE__ */ c(Mb, { ref: t, ...r }) });
7659
+ const { forceMount: n, ...r } = e, o = Mc(Vn, e.__scopeScrollArea);
7660
+ return /* @__PURE__ */ c(Ae, { present: n || o.hasThumb, children: /* @__PURE__ */ c(kb, { ref: t, ...r }) });
7623
7661
  }
7624
- ), Mb = l.forwardRef(
7662
+ ), kb = l.forwardRef(
7625
7663
  (e, t) => {
7626
- const { __scopeScrollArea: n, style: r, ...o } = e, s = ke(Vn, n), a = kc(Vn, n), { onThumbPositionChange: i } = a, u = ne(
7664
+ const { __scopeScrollArea: n, style: r, ...o } = e, s = Me(Vn, n), a = Mc(Vn, n), { onThumbPositionChange: i } = a, u = te(
7627
7665
  t,
7628
7666
  (p) => a.onThumbChange(p)
7629
7667
  ), f = l.useRef(void 0), d = hr(() => {
@@ -7663,18 +7701,18 @@ var Pb = l.forwardRef((e, t) => {
7663
7701
  Dc.displayName = Vn;
7664
7702
  var qo = "ScrollAreaCorner", Lc = l.forwardRef(
7665
7703
  (e, t) => {
7666
- const n = ke(qo, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
7704
+ const n = Me(qo, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
7667
7705
  return n.type !== "scroll" && r ? /* @__PURE__ */ c(Db, { ...e, ref: t }) : null;
7668
7706
  }
7669
7707
  );
7670
7708
  Lc.displayName = qo;
7671
7709
  var Db = l.forwardRef((e, t) => {
7672
- const { __scopeScrollArea: n, ...r } = e, o = ke(qo, n), [s, a] = l.useState(0), [i, u] = l.useState(0), f = !!(s && i);
7673
- return kt(o.scrollbarX, () => {
7710
+ const { __scopeScrollArea: n, ...r } = e, o = Me(qo, n), [s, a] = l.useState(0), [i, u] = l.useState(0), f = !!(s && i);
7711
+ return Mt(o.scrollbarX, () => {
7674
7712
  var p;
7675
7713
  const d = ((p = o.scrollbarX) == null ? void 0 : p.offsetHeight) || 0;
7676
7714
  o.onCornerHeightChange(d), u(d);
7677
- }), kt(o.scrollbarY, () => {
7715
+ }), Mt(o.scrollbarY, () => {
7678
7716
  var p;
7679
7717
  const d = ((p = o.scrollbarY) == null ? void 0 : p.offsetWidth) || 0;
7680
7718
  o.onCornerWidthChange(d), a(d);
@@ -7738,7 +7776,7 @@ function hr(e, t) {
7738
7776
  window.clearTimeout(r.current), r.current = window.setTimeout(n, t);
7739
7777
  }, [n, t]);
7740
7778
  }
7741
- function kt(e, t) {
7779
+ function Mt(e, t) {
7742
7780
  const n = ye(t);
7743
7781
  be(() => {
7744
7782
  let r = 0;
@@ -7804,58 +7842,58 @@ function oo({
7804
7842
  createThread: h,
7805
7843
  deleteThread: b,
7806
7844
  renameThread: w
7807
- } = Ua(), [y, x] = ce(g ?? []), [E, C] = ce(!1), [I, N] = ce(null), [L, k] = ce(null), [D, j] = ce(""), [K, W] = ce(!1);
7845
+ } = Ua(), [y, x] = ce(g ?? []), [E, C] = ce(!1), [I, N] = ce(null), [F, D] = ce(null), [L, j] = ce(""), [K, W] = ce(!1);
7808
7846
  we(() => {
7809
7847
  x(g ?? []);
7810
7848
  }, [g]);
7811
- const B = async ($) => {
7849
+ const B = async (M) => {
7812
7850
  try {
7813
- await p($), i == null || i($), u == null || u($);
7851
+ await p(M), i == null || i(M), u == null || u(M);
7814
7852
  } catch (z) {
7815
7853
  console.error("Failed to select thread:", z);
7816
7854
  }
7817
7855
  }, q = async () => {
7818
7856
  try {
7819
7857
  W(!0);
7820
- const $ = await h();
7821
- f == null || f($), i == null || i($);
7822
- } catch ($) {
7823
- console.error("Failed to create thread:", $);
7858
+ const M = await h();
7859
+ f == null || f(M), i == null || i(M);
7860
+ } catch (M) {
7861
+ console.error("Failed to create thread:", M);
7824
7862
  } finally {
7825
7863
  W(!1);
7826
7864
  }
7827
- }, F = async ($, z) => {
7865
+ }, $ = async (M, z) => {
7828
7866
  if (z.stopPropagation(), !!confirm("Delete this thread?"))
7829
7867
  try {
7830
- await b($), d == null || d($);
7868
+ await b(M), d == null || d(M);
7831
7869
  } catch (le) {
7832
7870
  console.error("Failed to delete thread:", le);
7833
7871
  }
7834
- }, G = ($, z) => {
7835
- z.stopPropagation(), k($.threadId), j($.title || `Thread ${$.threadId.slice(0, 8)}`);
7836
- }, T = async ($) => {
7837
- if (D.trim())
7872
+ }, G = (M, z) => {
7873
+ z.stopPropagation(), D(M.threadId), j(M.title || `Thread ${M.threadId.slice(0, 8)}`);
7874
+ }, T = async (M) => {
7875
+ if (L.trim())
7838
7876
  try {
7839
- await w($, D.trim()), k(null), j("");
7877
+ await w(M, L.trim()), D(null), j("");
7840
7878
  } catch (z) {
7841
7879
  console.error("Failed to update title:", z);
7842
7880
  }
7843
7881
  }, P = () => {
7844
- k(null), j("");
7845
- }, _ = ($, z) => {
7846
- $.key === "Enter" ? T(z) : $.key === "Escape" && P();
7847
- }, O = ($) => {
7848
- if (!$) return "";
7882
+ D(null), j("");
7883
+ }, _ = (M, z) => {
7884
+ M.key === "Enter" ? T(z) : M.key === "Escape" && P();
7885
+ }, O = (M) => {
7886
+ if (!M) return "";
7849
7887
  try {
7850
- const z = new Date($), ae = (/* @__PURE__ */ new Date()).getTime() - z.getTime(), V = Math.floor(ae / (1e3 * 60 * 60 * 24));
7888
+ const z = new Date(M), se = (/* @__PURE__ */ new Date()).getTime() - z.getTime(), V = Math.floor(se / (1e3 * 60 * 60 * 24));
7851
7889
  return V === 0 ? z.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : V === 1 ? "Yesterday" : V < 7 ? `${V} days ago` : z.toLocaleDateString();
7852
7890
  } catch {
7853
7891
  return "";
7854
7892
  }
7855
- }, X = ($) => $.title || `Thread ${$.threadId.slice(0, 8)}`;
7893
+ }, Y = (M) => M.title || `Thread ${M.threadId.slice(0, 8)}`;
7856
7894
  return /* @__PURE__ */ R("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
7857
7895
  t && /* @__PURE__ */ c("div", { className: s.header || "flex-shrink-0 p-2 border-b bg-slate-800 border-slate-700 text-slate-100 flex justify-end", children: /* @__PURE__ */ c(
7858
- fe,
7896
+ pe,
7859
7897
  {
7860
7898
  onClick: q,
7861
7899
  disabled: K || E,
@@ -7869,32 +7907,32 @@ function oo({
7869
7907
  /* @__PURE__ */ c(zc, { className: `flex-1 ${s.threadList || ""}`, style: { maxHeight: o }, children: /* @__PURE__ */ c("div", { className: "p-2 space-y-1 pb-4", children: E ? /* @__PURE__ */ c("div", { className: "text-center py-8 text-slate-400", children: "Loading…" }) : y.length === 0 ? /* @__PURE__ */ R("div", { className: "text-center py-8 text-slate-400", children: [
7870
7908
  /* @__PURE__ */ c(Ku, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
7871
7909
  /* @__PURE__ */ c("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
7872
- ] }) : y.slice().sort(($, z) => new Date(z.updatedAt || z.createdAt || "").getTime() - new Date($.updatedAt || $.createdAt || "").getTime()).map(($) => /* @__PURE__ */ R(
7910
+ ] }) : y.slice().sort((M, z) => new Date(z.updatedAt || z.createdAt || "").getTime() - new Date(M.updatedAt || M.createdAt || "").getTime()).map((M) => /* @__PURE__ */ R(
7873
7911
  "div",
7874
7912
  {
7875
- onClick: () => B($.threadId),
7876
- className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(a ?? m) === $.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
7913
+ onClick: () => B(M.threadId),
7914
+ className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(a ?? m) === M.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
7877
7915
  children: [
7878
7916
  /* @__PURE__ */ R("div", { className: "flex items-center justify-between", children: [
7879
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: L === $.threadId ? /* @__PURE__ */ R("div", { className: "flex items-center gap-2", onClick: (z) => z.stopPropagation(), children: [
7880
- /* @__PURE__ */ c(tn, { value: D, onChange: (z) => j(z.target.value), onKeyDown: (z) => _(z, $.threadId), className: "h-6 text-sm", autoFocus: !0 }),
7881
- /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", onClick: () => T($.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c(mo, { size: 12 }) }),
7882
- /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", onClick: P, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c(Kt, { size: 12 }) })
7917
+ /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: F === M.threadId ? /* @__PURE__ */ R("div", { className: "flex items-center gap-2", onClick: (z) => z.stopPropagation(), children: [
7918
+ /* @__PURE__ */ c(tn, { value: L, onChange: (z) => j(z.target.value), onKeyDown: (z) => _(z, M.threadId), className: "h-6 text-sm", autoFocus: !0 }),
7919
+ /* @__PURE__ */ c(pe, { variant: "ghost", size: "sm", onClick: () => T(M.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c(mo, { size: 12 }) }),
7920
+ /* @__PURE__ */ c(pe, { variant: "ghost", size: "sm", onClick: P, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c(Kt, { size: 12 }) })
7883
7921
  ] }) : /* @__PURE__ */ R(De, { children: [
7884
- /* @__PURE__ */ c("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: X($) }),
7922
+ /* @__PURE__ */ c("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Y(M) }),
7885
7923
  /* @__PURE__ */ R("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
7886
7924
  /* @__PURE__ */ c(Gu, { size: 10 }),
7887
- /* @__PURE__ */ c("span", { children: O($.updatedAt || $.createdAt) })
7925
+ /* @__PURE__ */ c("span", { children: O(M.updatedAt || M.createdAt) })
7888
7926
  ] })
7889
7927
  ] }) }),
7890
7928
  /* @__PURE__ */ R("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
7891
- r && L !== $.threadId && /* @__PURE__ */ c(fe, { variant: "ghost", size: "sm", onClick: (z) => G($, z), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c(fa, { size: 12 }) }),
7929
+ r && F !== M.threadId && /* @__PURE__ */ c(pe, { variant: "ghost", size: "sm", onClick: (z) => G(M, z), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c(fa, { size: 12 }) }),
7892
7930
  n && /* @__PURE__ */ c(
7893
- fe,
7931
+ pe,
7894
7932
  {
7895
7933
  variant: "ghost",
7896
7934
  size: "sm",
7897
- onClick: (z) => F($.threadId, z),
7935
+ onClick: (z) => $(M.threadId, z),
7898
7936
  className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
7899
7937
  title: "Delete thread",
7900
7938
  children: /* @__PURE__ */ c(qu, { size: 12 })
@@ -7902,10 +7940,10 @@ function oo({
7902
7940
  )
7903
7941
  ] })
7904
7942
  ] }),
7905
- a === $.threadId && /* @__PURE__ */ c("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
7943
+ a === M.threadId && /* @__PURE__ */ c("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
7906
7944
  ]
7907
7945
  },
7908
- $.threadId
7946
+ M.threadId
7909
7947
  )) }) })
7910
7948
  ] });
7911
7949
  }
@@ -8068,7 +8106,7 @@ var mr = "Dialog", [Gc, Py] = Ue(mr), [Yb, ze] = Gc(mr), qc = (e) => {
8068
8106
  qc.displayName = mr;
8069
8107
  var Xc = "DialogTrigger", Yc = l.forwardRef(
8070
8108
  (e, t) => {
8071
- const { __scopeDialog: n, ...r } = e, o = ze(Xc, n), s = ne(t, o.triggerRef);
8109
+ const { __scopeDialog: n, ...r } = e, o = ze(Xc, n), s = te(t, o.triggerRef);
8072
8110
  return /* @__PURE__ */ c(
8073
8111
  J.button,
8074
8112
  {
@@ -8125,7 +8163,7 @@ var Zb = _t("DialogOverlay.RemoveScroll"), Qb = l.forwardRef(
8125
8163
  el.displayName = mt;
8126
8164
  var ev = l.forwardRef(
8127
8165
  (e, t) => {
8128
- const n = ze(mt, e.__scopeDialog), r = l.useRef(null), o = ne(t, n.contentRef, r);
8166
+ const n = ze(mt, e.__scopeDialog), r = l.useRef(null), o = te(t, n.contentRef, r);
8129
8167
  return l.useEffect(() => {
8130
8168
  const s = r.current;
8131
8169
  if (s) return Fo(s);
@@ -8176,7 +8214,7 @@ var ev = l.forwardRef(
8176
8214
  }
8177
8215
  ), tl = l.forwardRef(
8178
8216
  (e, t) => {
8179
- const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...a } = e, i = ze(mt, n), u = l.useRef(null), f = ne(t, u);
8217
+ const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...a } = e, i = ze(mt, n), u = l.useRef(null), f = te(t, u);
8180
8218
  return Eo(), /* @__PURE__ */ R(De, { children: [
8181
8219
  /* @__PURE__ */ c(
8182
8220
  nr,
@@ -8438,7 +8476,7 @@ var nn = "Tooltip", [gv, vr] = gr(nn), Sl = (e) => {
8438
8476
  }, [h, y]);
8439
8477
  return l.useEffect(() => () => {
8440
8478
  v.current && (window.clearTimeout(v.current), v.current = 0);
8441
- }, []), /* @__PURE__ */ c(ko, { ...f, children: /* @__PURE__ */ c(
8479
+ }, []), /* @__PURE__ */ c(Mo, { ...f, children: /* @__PURE__ */ c(
8442
8480
  gv,
8443
8481
  {
8444
8482
  scope: t,
@@ -8463,8 +8501,8 @@ var nn = "Tooltip", [gv, vr] = gr(nn), Sl = (e) => {
8463
8501
  Sl.displayName = nn;
8464
8502
  var ao = "TooltipTrigger", Cl = l.forwardRef(
8465
8503
  (e, t) => {
8466
- const { __scopeTooltip: n, ...r } = e, o = vr(ao, n), s = es(ao, n), a = br(n), i = l.useRef(null), u = ne(t, i, o.onTriggerChange), f = l.useRef(!1), d = l.useRef(!1), p = l.useCallback(() => f.current = !1, []);
8467
- return l.useEffect(() => () => document.removeEventListener("pointerup", p), [p]), /* @__PURE__ */ c(Mo, { asChild: !0, ...a, children: /* @__PURE__ */ c(
8504
+ const { __scopeTooltip: n, ...r } = e, o = vr(ao, n), s = es(ao, n), a = br(n), i = l.useRef(null), u = te(t, i, o.onTriggerChange), f = l.useRef(!1), d = l.useRef(!1), p = l.useCallback(() => f.current = !1, []);
8505
+ return l.useEffect(() => () => document.removeEventListener("pointerup", p), [p]), /* @__PURE__ */ c(ko, { asChild: !0, ...a, children: /* @__PURE__ */ c(
8468
8506
  J.button,
8469
8507
  {
8470
8508
  "aria-describedby": o.open ? o.contentId : void 0,
@@ -8492,13 +8530,13 @@ var ao = "TooltipTrigger", Cl = l.forwardRef(
8492
8530
  Cl.displayName = ao;
8493
8531
  var bv = "TooltipPortal", [Oy, vv] = gr(bv, {
8494
8532
  forceMount: void 0
8495
- }), Mt = "TooltipContent", El = l.forwardRef(
8533
+ }), kt = "TooltipContent", El = l.forwardRef(
8496
8534
  (e, t) => {
8497
- const n = vv(Mt, e.__scopeTooltip), { forceMount: r = n.forceMount, side: o = "top", ...s } = e, a = vr(Mt, e.__scopeTooltip);
8535
+ const n = vv(kt, e.__scopeTooltip), { forceMount: r = n.forceMount, side: o = "top", ...s } = e, a = vr(kt, e.__scopeTooltip);
8498
8536
  return /* @__PURE__ */ c(Ae, { present: r || a.open, children: a.disableHoverableContent ? /* @__PURE__ */ c(Rl, { side: o, ...s, ref: t }) : /* @__PURE__ */ c(wv, { side: o, ...s, ref: t }) });
8499
8537
  }
8500
8538
  ), wv = l.forwardRef((e, t) => {
8501
- const n = vr(Mt, e.__scopeTooltip), r = es(Mt, e.__scopeTooltip), o = l.useRef(null), s = ne(t, o), [a, i] = l.useState(null), { trigger: u, onClose: f } = n, d = o.current, { onPointerInTransitChange: p } = r, g = l.useCallback(() => {
8539
+ const n = vr(kt, e.__scopeTooltip), r = es(kt, e.__scopeTooltip), o = l.useRef(null), s = te(t, o), [a, i] = l.useState(null), { trigger: u, onClose: f } = n, d = o.current, { onPointerInTransitChange: p } = r, g = l.useCallback(() => {
8502
8540
  i(null), p(!1);
8503
8541
  }, [p]), v = l.useCallback(
8504
8542
  (m, h) => {
@@ -8532,7 +8570,7 @@ var bv = "TooltipPortal", [Oy, vv] = gr(bv, {
8532
8570
  onEscapeKeyDown: s,
8533
8571
  onPointerDownOutside: a,
8534
8572
  ...i
8535
- } = e, u = vr(Mt, n), f = br(n), { onClose: d } = u;
8573
+ } = e, u = vr(kt, n), f = br(n), { onClose: d } = u;
8536
8574
  return l.useEffect(() => (document.addEventListener(so, d), () => document.removeEventListener(so, d)), [d]), l.useEffect(() => {
8537
8575
  if (u.trigger) {
8538
8576
  const p = (g) => {
@@ -8575,7 +8613,7 @@ var bv = "TooltipPortal", [Oy, vv] = gr(bv, {
8575
8613
  );
8576
8614
  }
8577
8615
  );
8578
- El.displayName = Mt;
8616
+ El.displayName = kt;
8579
8617
  var Nl = "TooltipArrow", Cv = l.forwardRef(
8580
8618
  (e, t) => {
8581
8619
  const { __scopeTooltip: n, ...r } = e, o = br(n);
@@ -8679,7 +8717,7 @@ function Pv(e) {
8679
8717
  return n.pop(), t.length === 1 && n.length === 1 && t[0].x === n[0].x && t[0].y === n[0].y ? t : t.concat(n);
8680
8718
  }
8681
8719
  var _v = xl, Iv = Sl, Ov = Cl, Tl = El;
8682
- const kv = _v, Mv = Iv, Dv = Ov, Al = l.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__PURE__ */ c(
8720
+ const Mv = _v, kv = Iv, Dv = Ov, Al = l.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__PURE__ */ c(
8683
8721
  Tl,
8684
8722
  {
8685
8723
  ref: r,
@@ -8734,7 +8772,7 @@ const _l = l.forwardRef(
8734
8772
  }),
8735
8773
  [b, v, m, u, f, d, h]
8736
8774
  );
8737
- return /* @__PURE__ */ c(Pl.Provider, { value: w, children: /* @__PURE__ */ c(kv, { delayDuration: 0, children: /* @__PURE__ */ c(
8775
+ return /* @__PURE__ */ c(Pl.Provider, { value: w, children: /* @__PURE__ */ c(Mv, { delayDuration: 0, children: /* @__PURE__ */ c(
8738
8776
  "div",
8739
8777
  {
8740
8778
  style: {
@@ -8838,7 +8876,7 @@ Il.displayName = "Sidebar";
8838
8876
  const Ol = l.forwardRef(({ className: e, onClick: t, ...n }, r) => {
8839
8877
  const { toggleSidebar: o } = wr();
8840
8878
  return /* @__PURE__ */ R(
8841
- fe,
8879
+ pe,
8842
8880
  {
8843
8881
  ref: r,
8844
8882
  "data-sidebar": "trigger",
@@ -8882,7 +8920,7 @@ const Hv = l.forwardRef(({ className: e, ...t }, n) => {
8882
8920
  );
8883
8921
  });
8884
8922
  Hv.displayName = "SidebarRail";
8885
- const kl = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
8923
+ const Ml = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
8886
8924
  "main",
8887
8925
  {
8888
8926
  ref: n,
@@ -8894,7 +8932,7 @@ const kl = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
8894
8932
  ...t
8895
8933
  }
8896
8934
  ));
8897
- kl.displayName = "SidebarInset";
8935
+ Ml.displayName = "SidebarInset";
8898
8936
  const Wv = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
8899
8937
  tn,
8900
8938
  {
@@ -8908,7 +8946,7 @@ const Wv = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
8908
8946
  }
8909
8947
  ));
8910
8948
  Wv.displayName = "SidebarInput";
8911
- const Ml = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
8949
+ const kl = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
8912
8950
  "div",
8913
8951
  {
8914
8952
  ref: n,
@@ -8917,7 +8955,7 @@ const Ml = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
8917
8955
  ...t
8918
8956
  }
8919
8957
  ));
8920
- Ml.displayName = "SidebarHeader";
8958
+ kl.displayName = "SidebarHeader";
8921
8959
  const Vv = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
8922
8960
  "div",
8923
8961
  {
@@ -9063,7 +9101,7 @@ const Gv = rn(
9063
9101
  );
9064
9102
  return o ? (typeof o == "string" && (o = {
9065
9103
  children: o
9066
- }), /* @__PURE__ */ R(Mv, { children: [
9104
+ }), /* @__PURE__ */ R(kv, { children: [
9067
9105
  /* @__PURE__ */ c(Dv, { asChild: !0, children: p }),
9068
9106
  /* @__PURE__ */ c(
9069
9107
  Al,
@@ -9183,7 +9221,7 @@ const Qv = l.forwardRef(({ asChild: e = !1, size: t = "md", isActive: n, classNa
9183
9221
  }
9184
9222
  ));
9185
9223
  Qv.displayName = "SidebarMenuSubButton";
9186
- function ky({
9224
+ function My({
9187
9225
  header: e,
9188
9226
  sidebarTitle: t = "Threads",
9189
9227
  showThreads: n = !0,
@@ -9194,7 +9232,7 @@ function ky({
9194
9232
  }) {
9195
9233
  return /* @__PURE__ */ c(Rn, { ...a, children: /* @__PURE__ */ R(_l, { className: `w-full ${r}`, children: [
9196
9234
  /* @__PURE__ */ R(Il, { className: `border-r ${o}`, children: [
9197
- /* @__PURE__ */ c(Ml, { children: /* @__PURE__ */ c(Bl, { children: /* @__PURE__ */ c(Ul, { children: /* @__PURE__ */ c(zl, { size: "lg", children: /* @__PURE__ */ c("span", { className: "font-semibold", children: t }) }) }) }) }),
9235
+ /* @__PURE__ */ c(kl, { children: /* @__PURE__ */ c(Bl, { children: /* @__PURE__ */ c(Ul, { children: /* @__PURE__ */ c(zl, { size: "lg", children: /* @__PURE__ */ c("span", { className: "font-semibold", children: t }) }) }) }) }),
9198
9236
  /* @__PURE__ */ c(Dl, { children: n && /* @__PURE__ */ R(Ll, { children: [
9199
9237
  /* @__PURE__ */ c(Fl, { children: "Conversations" }),
9200
9238
  /* @__PURE__ */ c($l, { children: /* @__PURE__ */ c("div", { className: "px-2 py-1", children: /* @__PURE__ */ c(
@@ -9208,7 +9246,7 @@ function ky({
9208
9246
  ) }) })
9209
9247
  ] }) })
9210
9248
  ] }),
9211
- /* @__PURE__ */ R(kl, { children: [
9249
+ /* @__PURE__ */ R(Ml, { children: [
9212
9250
  /* @__PURE__ */ R("header", { className: "h-14 border-b bg-background/60 backdrop-blur flex items-center gap-2 px-4", children: [
9213
9251
  /* @__PURE__ */ c(Ol, {}),
9214
9252
  /* @__PURE__ */ c("div", { className: "flex-1" }),
@@ -9246,7 +9284,7 @@ function Vl(e) {
9246
9284
  const t = l.useRef({ value: e, previous: e });
9247
9285
  return l.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
9248
9286
  }
9249
- var yr = "Switch", [nw, My] = Ue(yr), [rw, ow] = nw(yr), jl = l.forwardRef(
9287
+ var yr = "Switch", [nw, ky] = Ue(yr), [rw, ow] = nw(yr), jl = l.forwardRef(
9250
9288
  (e, t) => {
9251
9289
  const {
9252
9290
  __scopeSwitch: n,
@@ -9259,7 +9297,7 @@ var yr = "Switch", [nw, My] = Ue(yr), [rw, ow] = nw(yr), jl = l.forwardRef(
9259
9297
  onCheckedChange: f,
9260
9298
  form: d,
9261
9299
  ...p
9262
- } = e, [g, v] = l.useState(null), m = ne(t, (x) => v(x)), h = l.useRef(!1), b = g ? d || !!g.closest("form") : !0, [w, y] = ot({
9300
+ } = e, [g, v] = l.useState(null), m = te(t, (x) => v(x)), h = l.useRef(!1), b = g ? d || !!g.closest("form") : !0, [w, y] = ot({
9263
9301
  prop: o,
9264
9302
  defaultProp: s ?? !1,
9265
9303
  onChange: f,
@@ -9325,7 +9363,7 @@ var sw = "SwitchBubbleInput", ql = l.forwardRef(
9325
9363
  bubbles: r = !0,
9326
9364
  ...o
9327
9365
  }, s) => {
9328
- const a = l.useRef(null), i = ne(a, s), u = Vl(n), f = li(t);
9366
+ const a = l.useRef(null), i = te(a, s), u = Vl(n), f = li(t);
9329
9367
  return l.useEffect(() => {
9330
9368
  const d = a.current;
9331
9369
  if (!d) return;
@@ -9402,18 +9440,18 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
9402
9440
  disabled: g,
9403
9441
  required: v,
9404
9442
  form: m
9405
- } = e, h = Cr(t), [b, w] = l.useState(null), [y, x] = l.useState(null), [E, C] = l.useState(!1), I = tr(f), [N, L] = ot({
9443
+ } = e, h = Cr(t), [b, w] = l.useState(null), [y, x] = l.useState(null), [E, C] = l.useState(!1), I = tr(f), [N, F] = ot({
9406
9444
  prop: r,
9407
9445
  defaultProp: o ?? !1,
9408
9446
  onChange: s,
9409
9447
  caller: gt
9410
- }), [k, D] = ot({
9448
+ }), [D, L] = ot({
9411
9449
  prop: a,
9412
9450
  defaultProp: i,
9413
9451
  onChange: u,
9414
9452
  caller: gt
9415
- }), j = l.useRef(null), K = b ? m || !!b.closest("form") : !0, [W, B] = l.useState(/* @__PURE__ */ new Set()), q = Array.from(W).map((F) => F.props.value).join(";");
9416
- return /* @__PURE__ */ c(ko, { ...h, children: /* @__PURE__ */ R(
9453
+ }), j = l.useRef(null), K = b ? m || !!b.closest("form") : !0, [W, B] = l.useState(/* @__PURE__ */ new Set()), q = Array.from(W).map(($) => $.props.value).join(";");
9454
+ return /* @__PURE__ */ c(Mo, { ...h, children: /* @__PURE__ */ R(
9417
9455
  uw,
9418
9456
  {
9419
9457
  required: v,
@@ -9425,10 +9463,10 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
9425
9463
  valueNodeHasChildren: E,
9426
9464
  onValueNodeHasChildrenChange: C,
9427
9465
  contentId: Le(),
9428
- value: k,
9429
- onValueChange: D,
9466
+ value: D,
9467
+ onValueChange: L,
9430
9468
  open: N,
9431
- onOpenChange: L,
9469
+ onOpenChange: F,
9432
9470
  dir: I,
9433
9471
  triggerPointerDownPosRef: j,
9434
9472
  disabled: g,
@@ -9437,13 +9475,13 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
9437
9475
  dw,
9438
9476
  {
9439
9477
  scope: e.__scopeSelect,
9440
- onNativeOptionAdd: l.useCallback((F) => {
9441
- B((G) => new Set(G).add(F));
9478
+ onNativeOptionAdd: l.useCallback(($) => {
9479
+ B((G) => new Set(G).add($));
9442
9480
  }, []),
9443
- onNativeOptionRemove: l.useCallback((F) => {
9481
+ onNativeOptionRemove: l.useCallback(($) => {
9444
9482
  B((G) => {
9445
9483
  const T = new Set(G);
9446
- return T.delete(F), T;
9484
+ return T.delete($), T;
9447
9485
  });
9448
9486
  }, []),
9449
9487
  children: n
@@ -9457,12 +9495,12 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
9457
9495
  tabIndex: -1,
9458
9496
  name: d,
9459
9497
  autoComplete: p,
9460
- value: k,
9461
- onChange: (F) => D(F.target.value),
9498
+ value: D,
9499
+ onChange: ($) => L($.target.value),
9462
9500
  disabled: g,
9463
9501
  form: m,
9464
9502
  children: [
9465
- k === void 0 ? /* @__PURE__ */ c("option", { value: "" }) : null,
9503
+ D === void 0 ? /* @__PURE__ */ c("option", { value: "" }) : null,
9466
9504
  Array.from(W)
9467
9505
  ]
9468
9506
  },
@@ -9475,7 +9513,7 @@ var iw = [" ", "Enter", "ArrowUp", "ArrowDown"], cw = [" ", "Enter"], gt = "Sele
9475
9513
  Jl.displayName = gt;
9476
9514
  var Zl = "SelectTrigger", Ql = l.forwardRef(
9477
9515
  (e, t) => {
9478
- const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = Cr(n), a = it(Zl, n), i = a.disabled || r, u = ne(t, a.onTriggerChange), f = Sr(n), d = l.useRef("touch"), [p, g, v] = Cu((h) => {
9516
+ const { __scopeSelect: n, disabled: r = !1, ...o } = e, s = Cr(n), a = it(Zl, n), i = a.disabled || r, u = te(t, a.onTriggerChange), f = Sr(n), d = l.useRef("touch"), [p, g, v] = Cu((h) => {
9479
9517
  const b = f().filter((x) => !x.disabled), w = b.find((x) => x.value === a.value), y = Eu(b, h, w);
9480
9518
  y !== void 0 && a.onValueChange(y.value);
9481
9519
  }), m = (h) => {
@@ -9484,7 +9522,7 @@ var Zl = "SelectTrigger", Ql = l.forwardRef(
9484
9522
  y: Math.round(h.pageY)
9485
9523
  });
9486
9524
  };
9487
- return /* @__PURE__ */ c(Mo, { asChild: !0, ...s, children: /* @__PURE__ */ c(
9525
+ return /* @__PURE__ */ c(ko, { asChild: !0, ...s, children: /* @__PURE__ */ c(
9488
9526
  J.button,
9489
9527
  {
9490
9528
  type: "button",
@@ -9519,7 +9557,7 @@ var Zl = "SelectTrigger", Ql = l.forwardRef(
9519
9557
  Ql.displayName = Zl;
9520
9558
  var eu = "SelectValue", tu = l.forwardRef(
9521
9559
  (e, t) => {
9522
- const { __scopeSelect: n, className: r, style: o, children: s, placeholder: a = "", ...i } = e, u = it(eu, n), { onValueNodeHasChildrenChange: f } = u, d = s !== void 0, p = ne(t, u.onValueNodeChange);
9560
+ const { __scopeSelect: n, className: r, style: o, children: s, placeholder: a = "", ...i } = e, u = it(eu, n), { onValueNodeHasChildrenChange: f } = u, d = s !== void 0, p = te(t, u.onValueNodeChange);
9523
9561
  return be(() => {
9524
9562
  f(d);
9525
9563
  }, [f, d]), /* @__PURE__ */ c(
@@ -9559,7 +9597,7 @@ var bt = "SelectContent", ou = l.forwardRef(
9559
9597
  }
9560
9598
  );
9561
9599
  ou.displayName = bt;
9562
- var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent.RemoveScroll"), au = l.forwardRef(
9600
+ var ke = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent.RemoveScroll"), au = l.forwardRef(
9563
9601
  (e, t) => {
9564
9602
  const {
9565
9603
  __scopeSelect: n,
@@ -9581,22 +9619,22 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9581
9619
  avoidCollisions: b,
9582
9620
  //
9583
9621
  ...w
9584
- } = e, y = it(bt, n), [x, E] = l.useState(null), [C, I] = l.useState(null), N = ne(t, (V) => E(V)), [L, k] = l.useState(null), [D, j] = l.useState(
9622
+ } = e, y = it(bt, n), [x, E] = l.useState(null), [C, I] = l.useState(null), N = te(t, (V) => E(V)), [F, D] = l.useState(null), [L, j] = l.useState(
9585
9623
  null
9586
9624
  ), K = Sr(n), [W, B] = l.useState(!1), q = l.useRef(!1);
9587
9625
  l.useEffect(() => {
9588
9626
  if (x) return Fo(x);
9589
9627
  }, [x]), Eo();
9590
- const F = l.useCallback(
9628
+ const $ = l.useCallback(
9591
9629
  (V) => {
9592
- const [oe, ...ie] = K().map((Z) => Z.ref.current), [se] = ie.slice(-1), H = document.activeElement;
9630
+ const [re, ...ie] = K().map((Z) => Z.ref.current), [oe] = ie.slice(-1), H = document.activeElement;
9593
9631
  for (const Z of V)
9594
- if (Z === H || (Z == null || Z.scrollIntoView({ block: "nearest" }), Z === oe && C && (C.scrollTop = 0), Z === se && C && (C.scrollTop = C.scrollHeight), Z == null || Z.focus(), document.activeElement !== H)) return;
9632
+ if (Z === H || (Z == null || Z.scrollIntoView({ block: "nearest" }), Z === re && C && (C.scrollTop = 0), Z === oe && C && (C.scrollTop = C.scrollHeight), Z == null || Z.focus(), document.activeElement !== H)) return;
9595
9633
  },
9596
9634
  [K, C]
9597
9635
  ), G = l.useCallback(
9598
- () => F([L, x]),
9599
- [F, L, x]
9636
+ () => $([F, x]),
9637
+ [$, F, x]
9600
9638
  );
9601
9639
  l.useEffect(() => {
9602
9640
  W && G();
@@ -9605,17 +9643,17 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9605
9643
  l.useEffect(() => {
9606
9644
  if (x) {
9607
9645
  let V = { x: 0, y: 0 };
9608
- const oe = (se) => {
9646
+ const re = (oe) => {
9609
9647
  var H, Z;
9610
9648
  V = {
9611
- x: Math.abs(Math.round(se.pageX) - (((H = P.current) == null ? void 0 : H.x) ?? 0)),
9612
- y: Math.abs(Math.round(se.pageY) - (((Z = P.current) == null ? void 0 : Z.y) ?? 0))
9649
+ x: Math.abs(Math.round(oe.pageX) - (((H = P.current) == null ? void 0 : H.x) ?? 0)),
9650
+ y: Math.abs(Math.round(oe.pageY) - (((Z = P.current) == null ? void 0 : Z.y) ?? 0))
9613
9651
  };
9614
- }, ie = (se) => {
9615
- V.x <= 10 && V.y <= 10 ? se.preventDefault() : x.contains(se.target) || T(!1), document.removeEventListener("pointermove", oe), P.current = null;
9652
+ }, ie = (oe) => {
9653
+ V.x <= 10 && V.y <= 10 ? oe.preventDefault() : x.contains(oe.target) || T(!1), document.removeEventListener("pointermove", re), P.current = null;
9616
9654
  };
9617
- return P.current !== null && (document.addEventListener("pointermove", oe), document.addEventListener("pointerup", ie, { capture: !0, once: !0 })), () => {
9618
- document.removeEventListener("pointermove", oe), document.removeEventListener("pointerup", ie, { capture: !0 });
9655
+ return P.current !== null && (document.addEventListener("pointermove", re), document.addEventListener("pointerup", ie, { capture: !0, once: !0 })), () => {
9656
+ document.removeEventListener("pointermove", re), document.removeEventListener("pointerup", ie, { capture: !0 });
9619
9657
  };
9620
9658
  }
9621
9659
  }, [x, T, P]), l.useEffect(() => {
@@ -9625,21 +9663,21 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9625
9663
  };
9626
9664
  }, [T]);
9627
9665
  const [_, O] = Cu((V) => {
9628
- const oe = K().filter((H) => !H.disabled), ie = oe.find((H) => H.ref.current === document.activeElement), se = Eu(oe, V, ie);
9629
- se && setTimeout(() => se.ref.current.focus());
9630
- }), X = l.useCallback(
9631
- (V, oe, ie) => {
9632
- const se = !q.current && !ie;
9633
- (y.value !== void 0 && y.value === oe || se) && (k(V), se && (q.current = !0));
9666
+ const re = K().filter((H) => !H.disabled), ie = re.find((H) => H.ref.current === document.activeElement), oe = Eu(re, V, ie);
9667
+ oe && setTimeout(() => oe.ref.current.focus());
9668
+ }), Y = l.useCallback(
9669
+ (V, re, ie) => {
9670
+ const oe = !q.current && !ie;
9671
+ (y.value !== void 0 && y.value === re || oe) && (D(V), oe && (q.current = !0));
9634
9672
  },
9635
9673
  [y.value]
9636
- ), $ = l.useCallback(() => x == null ? void 0 : x.focus(), [x]), z = l.useCallback(
9637
- (V, oe, ie) => {
9638
- const se = !q.current && !ie;
9639
- (y.value !== void 0 && y.value === oe || se) && j(V);
9674
+ ), M = l.useCallback(() => x == null ? void 0 : x.focus(), [x]), z = l.useCallback(
9675
+ (V, re, ie) => {
9676
+ const oe = !q.current && !ie;
9677
+ (y.value !== void 0 && y.value === re || oe) && j(V);
9640
9678
  },
9641
9679
  [y.value]
9642
- ), le = r === "popper" ? io : iu, ae = le === io ? {
9680
+ ), le = r === "popper" ? io : iu, se = le === io ? {
9643
9681
  side: i,
9644
9682
  sideOffset: u,
9645
9683
  align: f,
@@ -9658,12 +9696,12 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9658
9696
  content: x,
9659
9697
  viewport: C,
9660
9698
  onViewportChange: I,
9661
- itemRefCallback: X,
9662
- selectedItem: L,
9663
- onItemLeave: $,
9699
+ itemRefCallback: Y,
9700
+ selectedItem: F,
9701
+ onItemLeave: M,
9664
9702
  itemTextRefCallback: z,
9665
9703
  focusSelectedItem: G,
9666
- selectedItemText: D,
9704
+ selectedItemText: L,
9667
9705
  position: r,
9668
9706
  isPositioned: W,
9669
9707
  searchRef: _,
@@ -9676,8 +9714,8 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9676
9714
  V.preventDefault();
9677
9715
  },
9678
9716
  onUnmountAutoFocus: U(o, (V) => {
9679
- var oe;
9680
- (oe = y.trigger) == null || oe.focus({ preventScroll: !0 }), V.preventDefault();
9717
+ var re;
9718
+ (re = y.trigger) == null || re.focus({ preventScroll: !0 }), V.preventDefault();
9681
9719
  }),
9682
9720
  children: /* @__PURE__ */ c(
9683
9721
  ln,
@@ -9697,7 +9735,7 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9697
9735
  dir: y.dir,
9698
9736
  onContextMenu: (V) => V.preventDefault(),
9699
9737
  ...w,
9700
- ...ae,
9738
+ ...se,
9701
9739
  onPlaced: () => B(!0),
9702
9740
  ref: N,
9703
9741
  style: {
@@ -9709,14 +9747,14 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9709
9747
  ...w.style
9710
9748
  },
9711
9749
  onKeyDown: U(w.onKeyDown, (V) => {
9712
- const oe = V.ctrlKey || V.altKey || V.metaKey;
9713
- if (V.key === "Tab" && V.preventDefault(), !oe && V.key.length === 1 && O(V.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(V.key)) {
9714
- let se = K().filter((H) => !H.disabled).map((H) => H.ref.current);
9715
- if (["ArrowUp", "End"].includes(V.key) && (se = se.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(V.key)) {
9716
- const H = V.target, Z = se.indexOf(H);
9717
- se = se.slice(Z + 1);
9750
+ const re = V.ctrlKey || V.altKey || V.metaKey;
9751
+ if (V.key === "Tab" && V.preventDefault(), !re && V.key.length === 1 && O(V.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(V.key)) {
9752
+ let oe = K().filter((H) => !H.disabled).map((H) => H.ref.current);
9753
+ if (["ArrowUp", "End"].includes(V.key) && (oe = oe.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(V.key)) {
9754
+ const H = V.target, Z = oe.indexOf(H);
9755
+ oe = oe.slice(Z + 1);
9718
9756
  }
9719
- setTimeout(() => F(se)), V.preventDefault();
9757
+ setTimeout(() => $(oe)), V.preventDefault();
9720
9758
  }
9721
9759
  })
9722
9760
  }
@@ -9731,48 +9769,48 @@ var Me = 10, [su, ct] = zt(bt), mw = "SelectContentImpl", gw = _t("SelectContent
9731
9769
  );
9732
9770
  au.displayName = mw;
9733
9771
  var bw = "SelectItemAlignedPosition", iu = l.forwardRef((e, t) => {
9734
- const { __scopeSelect: n, onPlaced: r, ...o } = e, s = it(bt, n), a = ct(bt, n), [i, u] = l.useState(null), [f, d] = l.useState(null), p = ne(t, (N) => d(N)), g = Sr(n), v = l.useRef(!1), m = l.useRef(!0), { viewport: h, selectedItem: b, selectedItemText: w, focusSelectedItem: y } = a, x = l.useCallback(() => {
9772
+ const { __scopeSelect: n, onPlaced: r, ...o } = e, s = it(bt, n), a = ct(bt, n), [i, u] = l.useState(null), [f, d] = l.useState(null), p = te(t, (N) => d(N)), g = Sr(n), v = l.useRef(!1), m = l.useRef(!0), { viewport: h, selectedItem: b, selectedItemText: w, focusSelectedItem: y } = a, x = l.useCallback(() => {
9735
9773
  if (s.trigger && s.valueNode && i && f && h && b && w) {
9736
- const N = s.trigger.getBoundingClientRect(), L = f.getBoundingClientRect(), k = s.valueNode.getBoundingClientRect(), D = w.getBoundingClientRect();
9774
+ const N = s.trigger.getBoundingClientRect(), F = f.getBoundingClientRect(), D = s.valueNode.getBoundingClientRect(), L = w.getBoundingClientRect();
9737
9775
  if (s.dir !== "rtl") {
9738
- const H = D.left - L.left, Z = k.left - H, de = N.left - Z, pe = N.width + de, Y = Math.max(pe, L.width), ge = window.innerWidth - Me, te = ro(Z, [
9739
- Me,
9776
+ const H = L.left - F.left, Z = D.left - H, de = N.left - Z, he = N.width + de, me = Math.max(he, F.width), Q = window.innerWidth - ke, ve = ro(Z, [
9777
+ ke,
9740
9778
  // Prevents the content from going off the starting edge of the
9741
9779
  // viewport. It may still go off the ending edge, but this can be
9742
9780
  // controlled by the user since they may want to manage overflow in a
9743
9781
  // specific way.
9744
9782
  // https://github.com/radix-ui/primitives/issues/2049
9745
- Math.max(Me, ge - Y)
9783
+ Math.max(ke, Q - me)
9746
9784
  ]);
9747
- i.style.minWidth = pe + "px", i.style.left = te + "px";
9785
+ i.style.minWidth = he + "px", i.style.left = ve + "px";
9748
9786
  } else {
9749
- const H = L.right - D.right, Z = window.innerWidth - k.right - H, de = window.innerWidth - N.right - Z, pe = N.width + de, Y = Math.max(pe, L.width), ge = window.innerWidth - Me, te = ro(Z, [
9750
- Me,
9751
- Math.max(Me, ge - Y)
9787
+ const H = F.right - L.right, Z = window.innerWidth - D.right - H, de = window.innerWidth - N.right - Z, he = N.width + de, me = Math.max(he, F.width), Q = window.innerWidth - ke, ve = ro(Z, [
9788
+ ke,
9789
+ Math.max(ke, Q - me)
9752
9790
  ]);
9753
- i.style.minWidth = pe + "px", i.style.right = te + "px";
9791
+ i.style.minWidth = he + "px", i.style.right = ve + "px";
9754
9792
  }
9755
- const j = g(), K = window.innerHeight - Me * 2, W = h.scrollHeight, B = window.getComputedStyle(f), q = parseInt(B.borderTopWidth, 10), F = parseInt(B.paddingTop, 10), G = parseInt(B.borderBottomWidth, 10), T = parseInt(B.paddingBottom, 10), P = q + F + W + T + G, _ = Math.min(b.offsetHeight * 5, P), O = window.getComputedStyle(h), X = parseInt(O.paddingTop, 10), $ = parseInt(O.paddingBottom, 10), z = N.top + N.height / 2 - Me, le = K - z, ae = b.offsetHeight / 2, V = b.offsetTop + ae, oe = q + F + V, ie = P - oe;
9756
- if (oe <= z) {
9793
+ const j = g(), K = window.innerHeight - ke * 2, W = h.scrollHeight, B = window.getComputedStyle(f), q = parseInt(B.borderTopWidth, 10), $ = parseInt(B.paddingTop, 10), G = parseInt(B.borderBottomWidth, 10), T = parseInt(B.paddingBottom, 10), P = q + $ + W + T + G, _ = Math.min(b.offsetHeight * 5, P), O = window.getComputedStyle(h), Y = parseInt(O.paddingTop, 10), M = parseInt(O.paddingBottom, 10), z = N.top + N.height / 2 - ke, le = K - z, se = b.offsetHeight / 2, V = b.offsetTop + se, re = q + $ + V, ie = P - re;
9794
+ if (re <= z) {
9757
9795
  const H = j.length > 0 && b === j[j.length - 1].ref.current;
9758
9796
  i.style.bottom = "0px";
9759
9797
  const Z = f.clientHeight - h.offsetTop - h.offsetHeight, de = Math.max(
9760
9798
  le,
9761
- ae + // viewport might have padding bottom, include it to avoid a scrollable viewport
9762
- (H ? $ : 0) + Z + G
9763
- ), pe = oe + de;
9764
- i.style.height = pe + "px";
9799
+ se + // viewport might have padding bottom, include it to avoid a scrollable viewport
9800
+ (H ? M : 0) + Z + G
9801
+ ), he = re + de;
9802
+ i.style.height = he + "px";
9765
9803
  } else {
9766
9804
  const H = j.length > 0 && b === j[0].ref.current;
9767
9805
  i.style.top = "0px";
9768
9806
  const de = Math.max(
9769
9807
  z,
9770
9808
  q + h.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
9771
- (H ? X : 0) + ae
9809
+ (H ? Y : 0) + se
9772
9810
  ) + ie;
9773
- i.style.height = de + "px", h.scrollTop = oe - z + h.offsetTop;
9811
+ i.style.height = de + "px", h.scrollTop = re - z + h.offsetTop;
9774
9812
  }
9775
- i.style.margin = `${Me}px 0`, i.style.minHeight = _ + "px", i.style.maxHeight = K + "px", r == null || r(), requestAnimationFrame(() => v.current = !0);
9813
+ i.style.margin = `${ke}px 0`, i.style.minHeight = _ + "px", i.style.maxHeight = K + "px", r == null || r(), requestAnimationFrame(() => v.current = !0);
9776
9814
  }
9777
9815
  }, [
9778
9816
  g,
@@ -9839,7 +9877,7 @@ var vw = "SelectPopperPosition", io = l.forwardRef((e, t) => {
9839
9877
  const {
9840
9878
  __scopeSelect: n,
9841
9879
  align: r = "start",
9842
- collisionPadding: o = Me,
9880
+ collisionPadding: o = ke,
9843
9881
  ...s
9844
9882
  } = e, a = Cr(n);
9845
9883
  return /* @__PURE__ */ c(
@@ -9866,7 +9904,7 @@ var vw = "SelectPopperPosition", io = l.forwardRef((e, t) => {
9866
9904
  io.displayName = vw;
9867
9905
  var [ww, ts] = zt(bt, {}), co = "SelectViewport", cu = l.forwardRef(
9868
9906
  (e, t) => {
9869
- const { __scopeSelect: n, nonce: r, ...o } = e, s = ct(co, n), a = ts(co, n), i = ne(t, s.onViewportChange), u = l.useRef(0);
9907
+ const { __scopeSelect: n, nonce: r, ...o } = e, s = ct(co, n), a = ts(co, n), i = te(t, s.onViewportChange), u = l.useRef(0);
9870
9908
  return /* @__PURE__ */ R(De, { children: [
9871
9909
  /* @__PURE__ */ c(
9872
9910
  "style",
@@ -9902,7 +9940,7 @@ var [ww, ts] = zt(bt, {}), co = "SelectViewport", cu = l.forwardRef(
9902
9940
  if (g != null && g.current && p) {
9903
9941
  const v = Math.abs(u.current - d.scrollTop);
9904
9942
  if (v > 0) {
9905
- const m = window.innerHeight - Me * 2, h = parseFloat(p.style.minHeight), b = parseFloat(p.style.height), w = Math.max(h, b);
9943
+ const m = window.innerHeight - ke * 2, h = parseFloat(p.style.minHeight), b = parseFloat(p.style.height), w = Math.max(h, b);
9906
9944
  if (w < m) {
9907
9945
  const y = w + v, x = Math.min(m, y), E = y - x;
9908
9946
  p.style.height = x + "px", p.style.bottom === "0px" && (d.scrollTop = E > 0 ? E : 0, p.style.justifyContent = "flex-end");
@@ -9939,7 +9977,7 @@ var Gn = "SelectItem", [Cw, fu] = zt(Gn), pu = l.forwardRef(
9939
9977
  disabled: o = !1,
9940
9978
  textValue: s,
9941
9979
  ...a
9942
- } = e, i = it(Gn, n), u = ct(Gn, n), f = i.value === r, [d, p] = l.useState(s ?? ""), [g, v] = l.useState(!1), m = ne(
9980
+ } = e, i = it(Gn, n), u = ct(Gn, n), f = i.value === r, [d, p] = l.useState(s ?? ""), [g, v] = l.useState(!1), m = te(
9943
9981
  t,
9944
9982
  (y) => {
9945
9983
  var x;
@@ -10017,7 +10055,7 @@ var Gn = "SelectItem", [Cw, fu] = zt(Gn), pu = l.forwardRef(
10017
10055
  pu.displayName = Gn;
10018
10056
  var jt = "SelectItemText", hu = l.forwardRef(
10019
10057
  (e, t) => {
10020
- const { __scopeSelect: n, className: r, style: o, ...s } = e, a = it(jt, n), i = ct(jt, n), u = fu(jt, n), f = fw(jt, n), [d, p] = l.useState(null), g = ne(
10058
+ const { __scopeSelect: n, className: r, style: o, ...s } = e, a = it(jt, n), i = ct(jt, n), u = fu(jt, n), f = fw(jt, n), [d, p] = l.useState(null), g = te(
10021
10059
  t,
10022
10060
  (w) => p(w),
10023
10061
  u.onItemTextChange,
@@ -10044,7 +10082,7 @@ var mu = "SelectItemIndicator", gu = l.forwardRef(
10044
10082
  );
10045
10083
  gu.displayName = mu;
10046
10084
  var lo = "SelectScrollUpButton", bu = l.forwardRef((e, t) => {
10047
- const n = ct(lo, e.__scopeSelect), r = ts(lo, e.__scopeSelect), [o, s] = l.useState(!1), a = ne(t, r.onScrollButtonChange);
10085
+ const n = ct(lo, e.__scopeSelect), r = ts(lo, e.__scopeSelect), [o, s] = l.useState(!1), a = te(t, r.onScrollButtonChange);
10048
10086
  return be(() => {
10049
10087
  if (n.viewport && n.isPositioned) {
10050
10088
  let i = function() {
@@ -10068,7 +10106,7 @@ var lo = "SelectScrollUpButton", bu = l.forwardRef((e, t) => {
10068
10106
  });
10069
10107
  bu.displayName = lo;
10070
10108
  var uo = "SelectScrollDownButton", vu = l.forwardRef((e, t) => {
10071
- const n = ct(uo, e.__scopeSelect), r = ts(uo, e.__scopeSelect), [o, s] = l.useState(!1), a = ne(t, r.onScrollButtonChange);
10109
+ const n = ct(uo, e.__scopeSelect), r = ts(uo, e.__scopeSelect), [o, s] = l.useState(!1), a = te(t, r.onScrollButtonChange);
10072
10110
  return be(() => {
10073
10111
  if (n.viewport && n.isPositioned) {
10074
10112
  let i = function() {
@@ -10134,7 +10172,7 @@ var fo = "SelectArrow", Rw = l.forwardRef(
10134
10172
  Rw.displayName = fo;
10135
10173
  var Nw = "SelectBubbleInput", xu = l.forwardRef(
10136
10174
  ({ __scopeSelect: e, value: t, ...n }, r) => {
10137
- const o = l.useRef(null), s = ne(r, o), a = Vl(t);
10175
+ const o = l.useRef(null), s = te(r, o), a = Vl(t);
10138
10176
  return l.useEffect(() => {
10139
10177
  const i = o.current;
10140
10178
  if (!i) return;
@@ -10187,7 +10225,7 @@ function Eu(e, t, n) {
10187
10225
  function Tw(e, t) {
10188
10226
  return e.map((n, r) => e[(t + r) % e.length]);
10189
10227
  }
10190
- var Aw = Jl, Ru = Ql, Pw = tu, _w = nu, Iw = ru, Nu = ou, Ow = cu, Tu = du, Au = pu, kw = hu, Mw = gu, Pu = bu, _u = vu, Iu = yu;
10228
+ var Aw = Jl, Ru = Ql, Pw = tu, _w = nu, Iw = ru, Nu = ou, Ow = cu, Tu = du, Au = pu, Mw = hu, kw = gu, Pu = bu, _u = vu, Iu = yu;
10191
10229
  const sa = Aw, aa = Pw, po = l.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ R(
10192
10230
  Ru,
10193
10231
  {
@@ -10217,7 +10255,7 @@ const Ou = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
10217
10255
  }
10218
10256
  ));
10219
10257
  Ou.displayName = Pu.displayName;
10220
- const ku = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
10258
+ const Mu = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
10221
10259
  _u,
10222
10260
  {
10223
10261
  ref: n,
@@ -10229,7 +10267,7 @@ const ku = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
10229
10267
  children: /* @__PURE__ */ c(Tt, { className: "h-4 w-4" })
10230
10268
  }
10231
10269
  ));
10232
- ku.displayName = _u.displayName;
10270
+ Mu.displayName = _u.displayName;
10233
10271
  const ho = l.forwardRef(({ className: e, children: t, position: n = "popper", ...r }, o) => /* @__PURE__ */ c(Iw, { children: /* @__PURE__ */ R(
10234
10272
  Nu,
10235
10273
  {
@@ -10253,7 +10291,7 @@ const ho = l.forwardRef(({ className: e, children: t, position: n = "popper", ..
10253
10291
  children: t
10254
10292
  }
10255
10293
  ),
10256
- /* @__PURE__ */ c(ku, {})
10294
+ /* @__PURE__ */ c(Mu, {})
10257
10295
  ]
10258
10296
  }
10259
10297
  ) }));
@@ -10277,8 +10315,8 @@ const lt = l.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
10277
10315
  ),
10278
10316
  ...n,
10279
10317
  children: [
10280
- /* @__PURE__ */ c("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ c(Mw, { children: /* @__PURE__ */ c(mo, { className: "h-4 w-4" }) }) }),
10281
- /* @__PURE__ */ c(kw, { children: t })
10318
+ /* @__PURE__ */ c("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ c(kw, { children: /* @__PURE__ */ c(mo, { className: "h-4 w-4" }) }) }),
10319
+ /* @__PURE__ */ c(Mw, { children: t })
10282
10320
  ]
10283
10321
  }
10284
10322
  ));
@@ -10334,8 +10372,8 @@ const Fw = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
10334
10372
  }
10335
10373
  ));
10336
10374
  Fw.displayName = "CardDescription";
10337
- const kn = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c("div", { ref: n, className: A("p-6 pt-0", e), ...t }));
10338
- kn.displayName = "CardContent";
10375
+ const Mn = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c("div", { ref: n, className: A("p-6 pt-0", e), ...t }));
10376
+ Mn.displayName = "CardContent";
10339
10377
  const $w = l.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c(
10340
10378
  "div",
10341
10379
  {
@@ -10397,10 +10435,10 @@ const Hr = /* @__PURE__ */ new Map(), ia = (e) => {
10397
10435
  toasts: e.toasts.filter((n) => n.id !== t.toastId)
10398
10436
  };
10399
10437
  }
10400
- }, Mn = [];
10438
+ }, kn = [];
10401
10439
  let Dn = { toasts: [] };
10402
10440
  function Yt(e) {
10403
- Dn = Hw(Dn, e), Mn.forEach((t) => {
10441
+ Dn = Hw(Dn, e), kn.forEach((t) => {
10404
10442
  t(Dn);
10405
10443
  });
10406
10444
  }
@@ -10427,9 +10465,9 @@ function Ww({ ...e }) {
10427
10465
  }
10428
10466
  function Vw() {
10429
10467
  const [e, t] = l.useState(Dn);
10430
- return l.useEffect(() => (Mn.push(t), () => {
10431
- const n = Mn.indexOf(t);
10432
- n > -1 && Mn.splice(n, 1);
10468
+ return l.useEffect(() => (kn.push(t), () => {
10469
+ const n = kn.indexOf(t);
10470
+ n > -1 && kn.splice(n, 1);
10433
10471
  }), [e]), {
10434
10472
  ...e,
10435
10473
  toast: Ww,
@@ -10491,7 +10529,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10491
10529
  }
10492
10530
  };
10493
10531
  return /* @__PURE__ */ R(pl, { open: r, onOpenChange: o, children: [
10494
- /* @__PURE__ */ c(lv, { asChild: !0, children: /* @__PURE__ */ R(fe, { variant: "outline", size: "sm", className: n, children: [
10532
+ /* @__PURE__ */ c(lv, { asChild: !0, children: /* @__PURE__ */ R(pe, { variant: "outline", size: "sm", className: n, children: [
10495
10533
  /* @__PURE__ */ c(Yu, { className: "h-4 w-4 mr-2" }),
10496
10534
  "Settings",
10497
10535
  f && /* @__PURE__ */ c(Ha, { variant: "destructive", className: "ml-2 h-4 w-4 p-0" })
@@ -10507,7 +10545,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10507
10545
  /* @__PURE__ */ c(Ju, { className: "h-5 w-5" }),
10508
10546
  "API Configuration"
10509
10547
  ] }) }),
10510
- /* @__PURE__ */ R(kn, { className: "space-y-4", children: [
10548
+ /* @__PURE__ */ R(Mn, { className: "space-y-4", children: [
10511
10549
  /* @__PURE__ */ R("div", { className: "space-y-2", children: [
10512
10550
  /* @__PURE__ */ c(Ie, { htmlFor: "api-url", children: "API Base URL" }),
10513
10551
  /* @__PURE__ */ R("div", { className: "flex gap-2", children: [
@@ -10523,7 +10561,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10523
10561
  placeholder: "http://localhost:8000/api"
10524
10562
  }
10525
10563
  ),
10526
- /* @__PURE__ */ c(fe, { variant: "outline", onClick: h, children: "Test" })
10564
+ /* @__PURE__ */ c(pe, { variant: "outline", onClick: h, children: "Test" })
10527
10565
  ] })
10528
10566
  ] }),
10529
10567
  /* @__PURE__ */ R("div", { className: "flex items-center justify-between", children: [
@@ -10557,7 +10595,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10557
10595
  }
10558
10596
  ),
10559
10597
  /* @__PURE__ */ c(
10560
- fe,
10598
+ pe,
10561
10599
  {
10562
10600
  variant: "outline",
10563
10601
  size: "icon",
@@ -10574,7 +10612,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10574
10612
  /* @__PURE__ */ c(ed, { className: "h-5 w-5" }),
10575
10613
  "Interface Settings"
10576
10614
  ] }) }),
10577
- /* @__PURE__ */ R(kn, { className: "space-y-4", children: [
10615
+ /* @__PURE__ */ R(Mn, { className: "space-y-4", children: [
10578
10616
  /* @__PURE__ */ R("div", { className: "space-y-2", children: [
10579
10617
  /* @__PURE__ */ c(Ie, { htmlFor: "layout", children: "Layout Style" }),
10580
10618
  /* @__PURE__ */ R(
@@ -10669,7 +10707,7 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10669
10707
  /* @__PURE__ */ c(td, { className: "h-5 w-5" }),
10670
10708
  "Behavior Settings"
10671
10709
  ] }) }),
10672
- /* @__PURE__ */ R(kn, { className: "space-y-4", children: [
10710
+ /* @__PURE__ */ R(Mn, { className: "space-y-4", children: [
10673
10711
  /* @__PURE__ */ R("div", { className: "flex items-center justify-between", children: [
10674
10712
  /* @__PURE__ */ R("div", { children: [
10675
10713
  /* @__PURE__ */ c(Ie, { htmlFor: "auto-save", children: "Auto-save Conversations" }),
@@ -10725,13 +10763,13 @@ function Ly({ settings: e, onSettingsChange: t, className: n = "" }) {
10725
10763
  ] })
10726
10764
  ] }),
10727
10765
  /* @__PURE__ */ R("div", { className: "flex items-center justify-between pt-6 border-t", children: [
10728
- /* @__PURE__ */ R(fe, { variant: "outline", onClick: v, children: [
10766
+ /* @__PURE__ */ R(pe, { variant: "outline", onClick: v, children: [
10729
10767
  /* @__PURE__ */ c(Wr, { className: "h-4 w-4 mr-2" }),
10730
10768
  "Reset"
10731
10769
  ] }),
10732
10770
  /* @__PURE__ */ R("div", { className: "flex gap-2", children: [
10733
- /* @__PURE__ */ c(fe, { variant: "outline", onClick: m, children: "Cancel" }),
10734
- /* @__PURE__ */ R(fe, { onClick: g, disabled: !f, children: [
10771
+ /* @__PURE__ */ c(pe, { variant: "outline", onClick: m, children: "Cancel" }),
10772
+ /* @__PURE__ */ R(pe, { onClick: g, disabled: !f, children: [
10735
10773
  /* @__PURE__ */ c(nd, { className: "h-4 w-4 mr-2" }),
10736
10774
  "Save Changes"
10737
10775
  ] })
@@ -10765,7 +10803,7 @@ function Fy({
10765
10803
  "--chat-sidebar-width": f === "phone" ? "100%" : f === "tablet" ? "280px" : f === "half-screen" ? "240px" : "320px",
10766
10804
  "--chat-message-max-width": f === "phone" ? "95%" : f === "tablet" ? "90%" : f === "half-screen" ? "85%" : "80%",
10767
10805
  "--chat-input-height": f === "phone" ? "120px" : "100px"
10768
- }), u = Qe.useCallback((f) => {
10806
+ }), u = Je.useCallback((f) => {
10769
10807
  var d;
10770
10808
  (d = s.onThreadChange) == null || d.call(s, f);
10771
10809
  }, [s.onThreadChange]);
@@ -10819,7 +10857,7 @@ export {
10819
10857
  zf as ApiClient,
10820
10858
  zf as ChatApi,
10821
10859
  Pn as ChatInterface,
10822
- ky as ChatMainLayout,
10860
+ My as ChatMainLayout,
10823
10861
  Rn as ChatProvider,
10824
10862
  Ry as ChatRoutingProvider,
10825
10863
  Ly as ChatSettings,