teodor-new-chat-ui 4.3.415 → 4.3.417

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.
@@ -1,6 +1,6 @@
1
1
  import * as ResizablePrimitive from "react-resizable-panels";
2
2
  declare const ResizablePanelGroup: ({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => import("react/jsx-runtime").JSX.Element;
3
- declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement | HTMLElement | HTMLButtonElement | HTMLSpanElement | HTMLParagraphElement | HTMLAnchorElement | HTMLObjectElement | HTMLDataElement | HTMLSourceElement | HTMLLinkElement | HTMLMapElement | HTMLTitleElement | HTMLHeadElement | HTMLBodyElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
3
+ declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement | HTMLElement | HTMLButtonElement | HTMLSpanElement | HTMLParagraphElement | HTMLAnchorElement | HTMLObjectElement | HTMLDataElement | HTMLSourceElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLTitleElement | HTMLHeadElement | HTMLBodyElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
4
4
  className?: string | undefined;
5
5
  collapsedSize?: number | undefined;
6
6
  collapsible?: boolean | undefined;
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ var Sg = Object.defineProperty;
2
2
  var Tg = (e, t, n) => t in e ? Sg(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Hl = (e, t, n) => Tg(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as h from "react";
5
- import O, { useMemo as et, createContext as Nr, useContext as Ar, useState as he, useRef as We, useCallback as xe, useEffect as at, useReducer as Cg, useLayoutEffect as Eg, createElement as Uo, memo as kg, useImperativeHandle as Rg, forwardRef as Ig, isValidElement as pa } from "react";
5
+ import O, { useMemo as Ze, createContext as Nr, useContext as Ar, useState as he, useRef as We, useCallback as xe, useEffect as at, useReducer as Cg, useLayoutEffect as Eg, createElement as Uo, memo as kg, useImperativeHandle as Rg, forwardRef as Ig, isValidElement as pa } from "react";
6
6
  import { Slot as Ng, createSlot as Tr, createSlottable as Ag } from "@radix-ui/react-slot";
7
7
  import { cva as lo } from "class-variance-authority";
8
8
  import { clsx as jg } from "clsx";
@@ -77,6 +77,19 @@ function Xg(e) {
77
77
  const d = s.get(c.userMessageId) ?? [];
78
78
  d.push(c), s.set(c.userMessageId, d);
79
79
  }
80
+ console.log("🔍 [CheckpointIndex] Built checkpoint metadata:"), console.log(` Total checkpoints: ${o.length}`), console.log(` User message groups: ${s.size}`);
81
+ for (const [c, d] of s.entries())
82
+ console.log(` 📌 User Message "${c}": ${d.length} checkpoint(s)`), d.forEach((p, m) => {
83
+ console.log(` [${m}] checkpoint="${p.id}", step=${p.step}, created=${p.createdAt}`);
84
+ });
85
+ console.log("🔍 [CheckpointIndex] AFTER computing checkpoint metadata:"), console.log(` checkpointMetaByCheckpointId size: ${t.size}`), console.log(" checkpointMetaByCheckpointId keys:", Array.from(t.keys()));
86
+ for (const [c, d] of t.entries())
87
+ console.log(` Checkpoint "${c}":`, {
88
+ userMessageId: d.userMessageId,
89
+ step: d.step,
90
+ source: d.source,
91
+ createdAt: d.createdAt
92
+ });
80
93
  for (const c of s.values()) {
81
94
  if (!c.length) continue;
82
95
  c.sort((p, m) => {
@@ -89,6 +102,11 @@ function Xg(e) {
89
102
  m.attemptCount = d, m.attemptIndex = p, m.isLatestAttempt = p === 0;
90
103
  }
91
104
  }
105
+ console.log("🔍 [CheckpointIndex] After attempt indexing:");
106
+ for (const [c, d] of s.entries())
107
+ console.log(` 📌 User Message "${c}": ${d.length} attempt(s)`), d.forEach((p) => {
108
+ console.log(` - checkpoint="${p.id}", attemptCount=${p.attemptCount}, attemptIndex=${p.attemptIndex}, isLatest=${p.isLatestAttempt}`);
109
+ });
92
110
  return {
93
111
  checkpoints: e,
94
112
  checkpointMetaByCheckpointId: t,
@@ -113,15 +131,15 @@ function Xg(e) {
113
131
  }
114
132
  function Jg(e, t) {
115
133
  if (!e)
116
- return { attemptCount: 1, attemptIndex: 0 };
134
+ return console.log("🔍 [getMessageAttemptInfo] No checkpointId provided, returning defaults"), { attemptCount: 1, attemptIndex: 0 };
117
135
  const n = t.getCheckpoint(e);
118
136
  if (!n || !n.userMessageId)
119
- return { attemptCount: 1, attemptIndex: 0 };
137
+ return console.log(`🔍 [getMessageAttemptInfo] No checkpoint meta or userMessageId for "${e}"`), { attemptCount: 1, attemptIndex: 0 };
120
138
  const r = t.getMessageAttempts(n.userMessageId);
121
139
  if (!r.length)
122
- return { attemptCount: 1, attemptIndex: 0 };
140
+ return console.log(`🔍 [getMessageAttemptInfo] No attempts found for userMessageId "${n.userMessageId}"`), { attemptCount: 1, attemptIndex: 0 };
123
141
  const o = r.findIndex((s) => s.id === e);
124
- return {
142
+ return console.log(`🔍 [getMessageAttemptInfo] checkpoint="${e}", userMsg="${n.userMessageId}", attemptCount=${r.length}, attemptIndex=${o}`), {
125
143
  attemptCount: r.length,
126
144
  attemptIndex: o >= 0 ? o : 0
127
145
  };
@@ -130,7 +148,7 @@ function SI(e, t) {
130
148
  return e ? t.getCheckpoint(e) ?? null : null;
131
149
  }
132
150
  function Zg(e) {
133
- return et(() => Xg(e), [e]);
151
+ return Ze(() => Xg(e), [e]);
134
152
  }
135
153
  function Kr(e) {
136
154
  if (!(!e || typeof e != "object" || Array.isArray(e)))
@@ -168,21 +186,27 @@ function Vn(e) {
168
186
  };
169
187
  }
170
188
  function ex(e, t) {
171
- var w;
189
+ var y;
172
190
  if (!e) return null;
173
- const r = (Array.isArray((w = e.values) == null ? void 0 : w.messages) ? e.values.messages : []).filter(
174
- (y) => !!(y && typeof y == "object" && typeof y.role == "string")
175
- ), o = Kr(e.metadata) ?? {}, s = Gl(e.config), a = Kr(e.parent_config ?? e.parentConfig), i = Gl(a), l = pr(s, ["checkpoint_id", "checkpointId"]), c = pr(s, ["checkpoint_ns", "checkpointNs"]), d = pr(i, ["checkpoint_id", "checkpointId"]), p = pr(i, ["checkpoint_id", "checkpointId"]) ?? null, m = pr(i, ["checkpoint_ns", "checkpointNs"]) ?? null, f = Kr(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((y) => ({ ...y })) : e.tasks ?? null, g = Array.isArray(e.next) ? [...e.next] : e.next ?? null, x = typeof e.created_at == "string" && e.created_at.trim() ? e.created_at : typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), b = {
191
+ const r = (Array.isArray((y = e.values) == null ? void 0 : y.messages) ? e.values.messages : []).filter(
192
+ (C) => !!(C && typeof C == "object" && typeof C.role == "string")
193
+ ), o = Kr(e.metadata) ?? {}, s = Gl(e.config), a = Kr(e.parent_config ?? e.parentConfig), i = Gl(a), l = pr(s, ["checkpoint_id", "checkpointId"]), c = pr(s, ["checkpoint_ns", "checkpointNs"]), d = pr(i, ["checkpoint_id", "checkpointId"]), p = pr(i, ["checkpoint_id", "checkpointId"]) ?? null, m = pr(i, ["checkpoint_ns", "checkpointNs"]) ?? null, f = Kr(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((C) => ({ ...C })) : e.tasks ?? null, g = Array.isArray(e.next) ? [...e.next] : e.next ?? null, x = typeof e.created_at == "string" && e.created_at.trim() ? e.created_at : typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), b = {
176
194
  ...o,
177
195
  step: Qg(o, ["step"]) ?? 0,
178
196
  source: pr(o, ["source"]) ?? null
179
- };
180
- return {
197
+ }, w = r.map((C) => ({
198
+ ...C,
199
+ checkpointId: l ?? null
200
+ }));
201
+ return console.log(`🔍 [normalizeSnapshot] Attaching checkpoint ID to ${w.length} messages:`, {
202
+ checkpointId: l,
203
+ messageIds: w.map((C) => C.id)
204
+ }), {
181
205
  checkpointId: l ?? null,
182
206
  checkpointNs: c ?? null,
183
207
  createdAt: x,
184
208
  parentId: d ?? null,
185
- messages: r,
209
+ messages: w,
186
210
  nextCursor: p,
187
211
  nextCursorNs: m,
188
212
  interrupt: tx(r, t),
@@ -583,7 +607,7 @@ function ox() {
583
607
  if (Ye(I))
584
608
  return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", He(I)), ot(I);
585
609
  }
586
- var Ze = b.ReactCurrentOwner, bt = {
610
+ var Qe = b.ReactCurrentOwner, bt = {
587
611
  key: !0,
588
612
  ref: !0,
589
613
  __self: !0,
@@ -606,7 +630,7 @@ function ox() {
606
630
  return I.key !== void 0;
607
631
  }
608
632
  function st(I, Q) {
609
- typeof I.ref == "string" && Ze.current;
633
+ typeof I.ref == "string" && Qe.current;
610
634
  }
611
635
  function Nt(I, Q) {
612
636
  {
@@ -674,7 +698,7 @@ function ox() {
674
698
  var Tt = typeof I == "function" ? I.displayName || I.name || "Unknown" : I;
675
699
  Ce && Nt(de, Tt), St && sn(de, Tt);
676
700
  }
677
- return Le(I, Ce, St, ie, Re, Ze.current, de);
701
+ return Le(I, Ce, St, ie, Re, Qe.current, de);
678
702
  }
679
703
  }
680
704
  var Dt = b.ReactCurrentOwner, At = b.ReactDebugCurrentFrame;
@@ -788,7 +812,7 @@ Check the top-level render call using <` + ue + ">.");
788
812
  }
789
813
  }
790
814
  var $e = {};
791
- function Qe(I, Q, ue, Re, ie, me) {
815
+ function et(I, Q, ue, Re, ie, me) {
792
816
  {
793
817
  var de = L(I);
794
818
  if (!de) {
@@ -833,10 +857,10 @@ React keys must be passed directly to JSX without using spread:
833
857
  }
834
858
  }
835
859
  function Ft(I, Q, ue) {
836
- return Qe(I, Q, ue, !0);
860
+ return et(I, Q, ue, !0);
837
861
  }
838
862
  function ua(I, Q, ue) {
839
- return Qe(I, Q, ue, !1);
863
+ return et(I, Q, ue, !1);
840
864
  }
841
865
  var da = ua, Ao = Ft;
842
866
  zr.Fragment = r, zr.jsx = da, zr.jsxs = Ao;
@@ -853,7 +877,7 @@ const TI = ({
853
877
  onHoverStart: s,
854
878
  onHoverEnd: a
855
879
  }) => {
856
- const i = e ?? [], l = i.length > 0, c = et(() => l ? [...i].reverse() : [], [i, l]), d = t ?? (i.length ? i[i.length - 1].id : null);
880
+ const i = e ?? [], l = i.length > 0, c = Ze(() => l ? [...i].reverse() : [], [i, l]), d = t ?? (i.length ? i[i.length - 1].id : null);
857
881
  if (!l)
858
882
  return null;
859
883
  const m = ["w-32 flex-shrink-0 flex-col border-r border-border/40 pr-2 flex bg-white text-gray-900 dark:bg-slate-900 dark:text-slate-100", o].filter(Boolean).join(" ");
@@ -2918,7 +2942,7 @@ function Uv(e) {
2918
2942
  return !!e && typeof e == "object" && e.protocolVersion === "v1" && "data" in e;
2919
2943
  }
2920
2944
  function Wv(e = {}) {
2921
- const t = et(() => Rn(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = he(e.token ?? null), s = We(e.headers ?? {}), a = e.credentials ?? "include", [i, l] = he(!1), [c, d] = he(null), [p, m] = he(""), [f, v] = he(null), [g, x] = he(0), [b, w] = he(!1), y = We(null), C = We(!0), S = We(0), T = We(null), E = We(null), N = We(null), M = We(null), L = xe((R) => {
2945
+ const t = Ze(() => Rn(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = he(e.token ?? null), s = We(e.headers ?? {}), a = e.credentials ?? "include", [i, l] = he(!1), [c, d] = he(null), [p, m] = he(""), [f, v] = he(null), [g, x] = he(0), [b, w] = he(!1), y = We(null), C = We(!0), S = We(0), T = We(null), E = We(null), N = We(null), M = We(null), L = xe((R) => {
2922
2946
  o(R);
2923
2947
  }, []), H = xe(() => {
2924
2948
  m(""), v(null), d(null), E.current = null, N.current = null, M.current = null;
@@ -3005,7 +3029,7 @@ function Wv(e = {}) {
3005
3029
  }
3006
3030
  w(!0);
3007
3031
  const ot = Ye.body.getReader(), nt = new TextDecoder();
3008
- let Ze = "", bt = [];
3032
+ let Qe = "", bt = [];
3009
3033
  S.current = 0, x(0);
3010
3034
  let gt = 0, pt = null;
3011
3035
  const be = () => {
@@ -3033,18 +3057,18 @@ function Wv(e = {}) {
3033
3057
  }), (B = k == null ? void 0 : k.onOpen) == null || B.call(k, { threadId: Dt, created: At }); ; ) {
3034
3058
  const { value: yt, done: It } = await ot.read();
3035
3059
  if (It) break;
3036
- Ze += nt.decode(yt, { stream: !0 }), Ze.length > sn && (Ze = "", console.warn("Stream buffer reset: exceeded 1MB"));
3060
+ Qe += nt.decode(yt, { stream: !0 }), Qe.length > sn && (Qe = "", console.warn("Stream buffer reset: exceeded 1MB"));
3037
3061
  let ee;
3038
- for (; (ee = Ze.indexOf(`
3062
+ for (; (ee = Qe.indexOf(`
3039
3063
 
3040
3064
  `)) >= 0; ) {
3041
- const Se = Ze.slice(0, ee);
3042
- Ze = Ze.slice(ee + 2);
3065
+ const Se = Qe.slice(0, ee);
3066
+ Qe = Qe.slice(ee + 2);
3043
3067
  const mt = Se.split(/\r?\n/), Te = [];
3044
3068
  for (const $e of mt)
3045
3069
  if (!(!$e || $e.startsWith(":")) && $e.startsWith("data:")) {
3046
- const Qe = $e.slice(5);
3047
- Te.push(Qe.startsWith(" ") ? Qe.slice(1) : Qe);
3070
+ const et = $e.slice(5);
3071
+ Te.push(et.startsWith(" ") ? et.slice(1) : et);
3048
3072
  }
3049
3073
  const Pe = Te.join(`
3050
3074
  `);
@@ -3076,8 +3100,8 @@ function Wv(e = {}) {
3076
3100
  else if (Be.type === "state_history") {
3077
3101
  M.current = Be;
3078
3102
  try {
3079
- const Qe = Vn(Be).latest;
3080
- Qe && (E.current = Qe.checkpointId ?? null, N.current = Qe.checkpointNs ?? null, v(Qe.checkpointId ?? null));
3103
+ const et = Vn(Be).latest;
3104
+ et && (E.current = et.checkpointId ?? null, N.current = et.checkpointNs ?? null, v(et.checkpointId ?? null));
3081
3105
  } catch ($e) {
3082
3106
  console.warn("[use-chat] Failed to hydrate state_history payload", $e);
3083
3107
  }
@@ -3088,7 +3112,7 @@ function Wv(e = {}) {
3088
3112
  console.error("[use-chat] Error in onEvent callback:", $e, "for event:", Be.type);
3089
3113
  }
3090
3114
  if (Be.type === "message.delta") {
3091
- const $e = Be.delta.filter((Qe) => Qe.type === "text").map((Qe) => Qe.text).join("");
3115
+ const $e = Be.delta.filter((et) => et.type === "text").map((et) => et.text).join("");
3092
3116
  $e && e.autoAppendAssistant !== !1 && (bt.push($e), rt());
3093
3117
  } else if (Be.type === "heartbeat") {
3094
3118
  console.debug("[use-chat] heartbeat received");
@@ -3317,7 +3341,7 @@ function qv({
3317
3341
  }
3318
3342
  },
3319
3343
  [e, n, M]
3320
- ), U = et(
3344
+ ), U = Ze(
3321
3345
  () => ({
3322
3346
  createThread: L,
3323
3347
  deleteThread: H,
@@ -3390,7 +3414,7 @@ function Gv({
3390
3414
  initialThreadId: t,
3391
3415
  onError: n,
3392
3416
  onThreadChange: r
3393
- }), w = et(
3417
+ }), w = Ze(
3394
3418
  () => ({
3395
3419
  threads: s,
3396
3420
  currentThreadId: a,
@@ -3770,7 +3794,7 @@ function dw(e = []) {
3770
3794
  at(() => () => {
3771
3795
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3772
3796
  }, []);
3773
- const c = et(() => ({
3797
+ const c = Ze(() => ({
3774
3798
  reset: (d) => n({ type: "reset", payload: { messages: d } }),
3775
3799
  seed: (d, p) => n({ type: "seed", payload: { messages: d, ...p ?? {} } }),
3776
3800
  prepend: (d) => n({ type: "prepend", payload: { messages: d } }),
@@ -4001,7 +4025,7 @@ function gw({
4001
4025
  isStreaming: c,
4002
4026
  getMessages: d
4003
4027
  }) {
4004
- const [p, m] = he(null), v = et(
4028
+ const [p, m] = he(null), v = Ze(
4005
4029
  () => Vn(p),
4006
4030
  [p]
4007
4031
  ).checkpoints, g = Zg(v), x = g.timeline, [b, w] = he(!1), [y, C] = he(null), [S, T] = he(!1), [E, N] = he(!1), [M, L] = he(!1), [H, V] = he(null), W = We(o), R = We(null), U = We(null), k = We(null), F = We(null), _ = We(!1), A = We(null), q = We(/* @__PURE__ */ new Map());
@@ -4288,10 +4312,10 @@ function vw({
4288
4312
  ), q = xe(
4289
4313
  (K) => _(() => K),
4290
4314
  []
4291
- ), X = et(() => {
4315
+ ), X = Ze(() => {
4292
4316
  const K = c.assemblingId ?? null;
4293
4317
  return K ? { assemblingMessageId: K } : null;
4294
- }, [c.assemblingId]), j = et(
4318
+ }, [c.assemblingId]), j = Ze(
4295
4319
  () => ({
4296
4320
  threadId: l,
4297
4321
  messages: c.messages,
@@ -4352,7 +4376,7 @@ function vw({
4352
4376
  m,
4353
4377
  f
4354
4378
  ]
4355
- ), P = et(
4379
+ ), P = Ze(
4356
4380
  () => ({
4357
4381
  registerClearThread: A,
4358
4382
  registerRespondToInterrupt: q
@@ -4374,7 +4398,7 @@ function ww({
4374
4398
  onConnectionError: l,
4375
4399
  onToolEnd: c
4376
4400
  }) {
4377
- const { api: d, baseUrl: p } = As(), m = et(() => Rn(p), [p]), { stream: f, stop: v, isStreaming: g, error: x, setToken: b } = Wv({ baseUrl: m }), [w, y] = he(!1);
4401
+ const { api: d, baseUrl: p } = As(), m = Ze(() => Rn(p), [p]), { stream: f, stop: v, isStreaming: g, error: x, setToken: b } = Wv({ baseUrl: m }), [w, y] = he(!1);
4378
4402
  return at(() => {
4379
4403
  y(g);
4380
4404
  }, [g]), /* @__PURE__ */ u.jsx(
@@ -4518,7 +4542,7 @@ function bw({
4518
4542
  H(ce);
4519
4543
  },
4520
4544
  [g, f, w, S, H, x]
4521
- ), U = et(
4545
+ ), U = Ze(
4522
4546
  () => ({
4523
4547
  isStreaming: c,
4524
4548
  error: d,
@@ -11308,8 +11332,8 @@ const XT = /* @__PURE__ */ Je(
11308
11332
  const He = jp(qe, Fe, Ke);
11309
11333
  let Ye, ot;
11310
11334
  ge ? Y === 0 && ne === 0 && le > 0 ? (Ye = 0, ot = le - 1) : (Ye = He * gs((Y + ze) / (ke + ze)), ot = He * lu((ne + ze) / (ke + ze)) - 1, ot = Oa(D - 1, Gr(ot, He - 1)), Ye = Oa(ot, Gr(0, Ye))) : (Ye = 0, ot = -1);
11311
- const nt = uu(Ye, ot, ce), { bottom: Ze, top: bt } = du(J, ae, $, nt), gt = lu(D / He), pt = gt * ke + (gt - 1) * ze - Ze;
11312
- return { bottom: Ze, itemHeight: ke, items: nt, itemWidth: Fe, offsetBottom: pt, offsetTop: bt, top: bt };
11335
+ const nt = uu(Ye, ot, ce), { bottom: Qe, top: bt } = du(J, ae, $, nt), gt = lu(D / He), pt = gt * ke + (gt - 1) * ze - Qe;
11336
+ return { bottom: Qe, itemHeight: ke, items: nt, itemWidth: Fe, offsetBottom: pt, offsetTop: bt, top: bt };
11313
11337
  }
11314
11338
  )
11315
11339
  ),
@@ -13729,7 +13753,7 @@ function Ro({
13729
13753
  allowHtml: n = !1,
13730
13754
  style: r
13731
13755
  }) {
13732
- const o = et(() => {
13756
+ const o = Ze(() => {
13733
13757
  try {
13734
13758
  if (!n) {
13735
13759
  const a = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
@@ -13739,7 +13763,7 @@ function Ro({
13739
13763
  } catch (a) {
13740
13764
  return console.error("[MarkdownContent] parse error", a), `<pre class="font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words">Error rendering markdown: ${String(a)}</pre>`;
13741
13765
  }
13742
- }, [e, n]), s = et(() => {
13766
+ }, [e, n]), s = Ze(() => {
13743
13767
  const a = {
13744
13768
  color: "currentColor",
13745
13769
  ...r
@@ -13883,7 +13907,7 @@ function VC({ artifact: e }) {
13883
13907
  ] });
13884
13908
  }
13885
13909
  function KC({ artifact: e, idx: t = 0 }) {
13886
- const n = et(() => e ? (Array.isArray(e.plots) ? e.plots : []).map((o) => rw(o)).filter((o) => o !== null) : [], [e]);
13910
+ const n = Ze(() => e ? (Array.isArray(e.plots) ? e.plots : []).map((o) => rw(o)).filter((o) => o !== null) : [], [e]);
13887
13911
  return (e == null ? void 0 : e.type) === "research_task_info" ? /* @__PURE__ */ u.jsx(
13888
13912
  VC,
13889
13913
  {
@@ -14017,7 +14041,7 @@ function dh({ data: e }) {
14017
14041
  return Array.isArray(e) ? e.every((n) => n === null || ["string", "number", "boolean"].includes(typeof n)) ? /* @__PURE__ */ u.jsx("div", { className: GC, children: /* @__PURE__ */ u.jsx("ul", { className: "list-disc pl-5", children: e.map((n, r) => /* @__PURE__ */ u.jsx("li", { children: String(n) }, r)) }) }) : /* @__PURE__ */ u.jsx("pre", { className: "font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words", children: Er(e) }) : /* @__PURE__ */ u.jsx("pre", { className: "font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words", children: Er(e) });
14018
14042
  }
14019
14043
  function YC({ message: e, isStreaming: t = !1 }) {
14020
- const n = e.name ?? "tool", r = et(() => {
14044
+ const n = e.name ?? "tool", r = Ze(() => {
14021
14045
  const i = e.additionalKwargs ?? {};
14022
14046
  return Array.isArray(i.toolProgress) ? [...i.toolProgress] : [];
14023
14047
  }, [e]), s = r.some(
@@ -14365,7 +14389,7 @@ function eE(e) {
14365
14389
  };
14366
14390
  }
14367
14391
  function tE(e, t) {
14368
- return et(() => {
14392
+ return Ze(() => {
14369
14393
  if (t)
14370
14394
  return {
14371
14395
  contentParts: [],
@@ -14415,13 +14439,13 @@ const jl = kg(function({
14415
14439
  attemptIndex: T = 0,
14416
14440
  onSelectCheckpoint: E
14417
14441
  }) {
14418
- const [N, M] = he(!1), [L, H] = he("preview"), [V, W] = he(!1), { currentThreadId: R } = mo(), { respondToInterrupt: U } = js(), k = l === "phone" || l === "half-screen", F = t.role, _ = F === "tool", A = et(() => "type" in t && t.type === "default_message" ? t : null, [t]), q = !!A, X = !(r && F !== "user"), {
14442
+ const [N, M] = he(!1), [L, H] = he("preview"), [V, W] = he(!1), { currentThreadId: R } = mo(), { respondToInterrupt: U } = js(), k = l === "phone" || l === "half-screen", F = t.role, _ = F === "tool", A = Ze(() => "type" in t && t.type === "default_message" ? t : null, [t]), q = !!A, X = !(r && F !== "user"), {
14419
14443
  uploadingFiles: j,
14420
14444
  handleFileClick: P,
14421
14445
  fileViewerOpen: K,
14422
14446
  currentFileInfo: G,
14423
14447
  closeFileViewer: oe
14424
- } = eE({ allowFileOpen: X, currentThreadId: R }), B = et(() => {
14448
+ } = eE({ allowFileOpen: X, currentThreadId: R }), B = Ze(() => {
14425
14449
  switch (F) {
14426
14450
  case "user":
14427
14451
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -14443,7 +14467,7 @@ const jl = kg(function({
14443
14467
  toolMeta: ce,
14444
14468
  toolRaw: le,
14445
14469
  isToolStreaming: ge
14446
- } = D, Ae = (b == null ? void 0 : b.id) ?? (b == null ? void 0 : b.interrupt_id), Ke = Go(Ae), ze = b == null ? void 0 : b.value, ke = et(() => A || !m ? null : t.artifact || null, [A, t, m]), Fe = xe(async () => {
14470
+ } = D, Ae = (b == null ? void 0 : b.id) ?? (b == null ? void 0 : b.interrupt_id), Ke = Go(Ae), ze = b == null ? void 0 : b.value, ke = Ze(() => A || !m ? null : t.artifact || null, [A, t, m]), Fe = xe(async () => {
14447
14471
  const be = _ ? le : J;
14448
14472
  async function rt(st) {
14449
14473
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
@@ -14538,7 +14562,7 @@ const jl = kg(function({
14538
14562
  "border border-border/60 dark:border-border/40"
14539
14563
  );
14540
14564
  }
14541
- }, [k, q, F]), Ze = xe(async (be) => {
14565
+ }, [k, q, F]), Qe = xe(async (be) => {
14542
14566
  if (w)
14543
14567
  return;
14544
14568
  const rt = Go(
@@ -14572,7 +14596,7 @@ const jl = kg(function({
14572
14596
  } finally {
14573
14597
  C == null || C();
14574
14598
  }
14575
- }, [w, C, y, U]), gt = et(() => A ? "Assistant" : Qv(t), [A, t]), pt = F === "user" && (S ?? 1) > 1 && typeof E == "function";
14599
+ }, [w, C, y, U]), gt = Ze(() => A ? "Assistant" : Qv(t), [A, t]), pt = F === "user" && (S ?? 1) > 1 && typeof E == "function";
14576
14600
  return _ && !p && !ke ? null : q && A ? /* @__PURE__ */ u.jsx("div", { className: te(ot(), f.container), children: /* @__PURE__ */ u.jsxs("div", { className: te(nt(), f.content), children: [
14577
14601
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
14578
14602
  /* @__PURE__ */ u.jsx(ma, { className: te("h-4 w-4", B) }),
@@ -14743,7 +14767,7 @@ const jl = kg(function({
14743
14767
  defaultMessage: A,
14744
14768
  handleFileClick: P,
14745
14769
  uploadingFiles: j,
14746
- handleInterruptApprove: Ze,
14770
+ handleInterruptApprove: Qe,
14747
14771
  handleInterruptReject: bt,
14748
14772
  disableInterruptActions: w,
14749
14773
  messageRole: F,
@@ -14873,9 +14897,9 @@ const nE = {
14873
14897
  checkpointIndex: w,
14874
14898
  onSelectCheckpoint: y
14875
14899
  }) {
14876
- const C = fh(t, n), S = "type" in t && t.type === "default_message", E = !!t.__syntheticStreaming, N = w ?? nE, M = !S && "checkpointId" in t ? t.checkpointId ?? null : null, { attemptCount: L, attemptIndex: H } = Jg(
14877
- M,
14878
- N
14900
+ const C = fh(t, n), S = "type" in t && t.type === "default_message", E = !!t.__syntheticStreaming, N = w ?? nE, M = !S && "checkpointId" in t ? t.checkpointId ?? null : null, { attemptCount: L, attemptIndex: H } = Ze(
14901
+ () => Jg(M, N),
14902
+ [M, N]
14879
14903
  );
14880
14904
  return /* @__PURE__ */ u.jsx(
14881
14905
  "div",
@@ -14946,9 +14970,9 @@ const hh = O.forwardRef(({
14946
14970
  onSelectCheckpoint: L,
14947
14971
  createSyntheticThinkingMessage: H = !0
14948
14972
  }, V) => {
14949
- const W = We(null), R = We(null), U = We(!1), k = We(!1), [F, _] = he(!0), A = et(() => w ? e.some(($) => "type" in $ && $.type === "default_message" ? !1 : Array.isArray($ == null ? void 0 : $.content) && $.content.some(
14973
+ const W = We(null), R = We(null), U = We(!1), k = We(!1), [F, _] = he(!0), A = Ze(() => w ? e.some(($) => "type" in $ && $.type === "default_message" ? !1 : Array.isArray($ == null ? void 0 : $.content) && $.content.some(
14950
14974
  (J) => J && J.type === "interrupt" && (J.id ?? J.interrupt_id) === w.id
14951
- )) : !1, [w, e]), q = et(() => {
14975
+ )) : !1, [w, e]), q = Ze(() => {
14952
14976
  if (!w || A)
14953
14977
  return null;
14954
14978
  const $ = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
@@ -14971,7 +14995,7 @@ const hh = O.forwardRef(({
14971
14995
  }
14972
14996
  ]
14973
14997
  };
14974
- }, [w, A]), X = et(() => q ? [...e, q] : e, [e, q]), j = et(() => !H || !t ? X : !X.some((J) => J.role === "assistant") && X.length > 0 ? [
14998
+ }, [w, A]), X = Ze(() => q ? [...e, q] : e, [e, q]), j = Ze(() => !H || !t ? X : !X.some((J) => J.role === "assistant") && X.length > 0 ? [
14975
14999
  ...X,
14976
15000
  {
14977
15001
  id: "thinking-assistant",
@@ -14980,9 +15004,9 @@ const hh = O.forwardRef(({
14980
15004
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
14981
15005
  __syntheticStreaming: !0
14982
15006
  }
14983
- ] : X, [X, t, H]), P = et(() => T ? j : j.filter(($) => ($ == null ? void 0 : $.role) !== "tool"), [j, T]), K = xe(($) => {
15007
+ ] : X, [X, t, H]), P = Ze(() => T ? j : j.filter(($) => ($ == null ? void 0 : $.role) !== "tool"), [j, T]), K = xe(($) => {
14984
15008
  _($), x && x(!$), b && b($);
14985
- }, [x, b]), G = et(() => {
15009
+ }, [x, b]), G = Ze(() => {
14986
15010
  if (i)
14987
15011
  return async () => {
14988
15012
  if (!U.current) {
@@ -14994,7 +15018,7 @@ const hh = O.forwardRef(({
14994
15018
  }
14995
15019
  }
14996
15020
  };
14997
- }, [i]), oe = et(() => !v || g ? !1 : F ? "auto" : !1, [F, v, g]), B = et(() => {
15021
+ }, [i]), oe = Ze(() => !v || g ? !1 : F ? "auto" : !1, [F, v, g]), B = Ze(() => {
14998
15022
  if (typeof f != "string") return null;
14999
15023
  const $ = f.trim();
15000
15024
  return $ ? {
@@ -15149,7 +15173,7 @@ function os({
15149
15173
  K(!0);
15150
15174
  }, []), oe = xe(() => {
15151
15175
  K(!1);
15152
- }, []), B = !!j || P, [D, Y] = he(null), [ne, ae] = he(""), [$, J] = he(null), [ce, le] = he(null), [ge, Ae] = he([]), [Ke, ze] = he(0), [ke, Fe] = he(0), [qe, He] = he(!1), [Ye, ot] = he(null), [nt, Ze] = he(null), [bt, gt] = he(!1), [pt, be] = he(null), rt = We(!1), [st, Nt] = he(() => bu.value), sn = We(st), Le = We(null), Ge = xe((ie) => {
15176
+ }, []), B = !!j || P, [D, Y] = he(null), [ne, ae] = he(""), [$, J] = he(null), [ce, le] = he(null), [ge, Ae] = he([]), [Ke, ze] = he(0), [ke, Fe] = he(0), [qe, He] = he(!1), [Ye, ot] = he(null), [nt, Qe] = he(null), [bt, gt] = he(!1), [pt, be] = he(null), rt = We(!1), [st, Nt] = he(() => bu.value), sn = We(st), Le = We(null), Ge = xe((ie) => {
15153
15177
  bu.value = ie, Nt(ie);
15154
15178
  }, []), [Dt, At] = he(!1), yt = We(null), It = We(null), ee = We(null), Se = xe(() => {
15155
15179
  It.current && (It.current.value = ""), ee.current && (ee.current.value = ""), ze((ie) => ie + 1), Fe((ie) => ie + 1);
@@ -15231,7 +15255,7 @@ function os({
15231
15255
  Be(ie, me, de);
15232
15256
  },
15233
15257
  [Be]
15234
- ), Qe = xe((ie) => {
15258
+ ), et = xe((ie) => {
15235
15259
  let me = null;
15236
15260
  for (let Xe = ie - 1; Xe >= 0; Xe--)
15237
15261
  if (y[Xe].role === "user") {
@@ -15266,7 +15290,7 @@ function os({
15266
15290
  }, da = async (ie) => {
15267
15291
  const me = (ie.target.files || [])[0];
15268
15292
  if (me) {
15269
- ot(null), Ze(null), He(!0);
15293
+ ot(null), Qe(null), He(!0);
15270
15294
  try {
15271
15295
  await k(
15272
15296
  { attachments: [me] },
@@ -15276,7 +15300,7 @@ function os({
15276
15300
  }
15277
15301
  );
15278
15302
  const de = `Uploaded ${me.name} - processing through chat stream`;
15279
- Ze(de);
15303
+ Qe(de);
15280
15304
  } catch (de) {
15281
15305
  const Ce = de instanceof Error ? de.message : "Failed to upload Excel file";
15282
15306
  console.error("Excel upload failed", de), ot(Ce), g == null || g(Ce);
@@ -15346,7 +15370,7 @@ function os({
15346
15370
  enableMessageEditing: c,
15347
15371
  editingMessageId: D,
15348
15372
  onEdit: $e,
15349
- onRegenerate: Qe,
15373
+ onRegenerate: et,
15350
15374
  onCancelEdit: ht,
15351
15375
  emptyMessage: pt ?? void 0,
15352
15376
  isNavigatingCheckpoint: Dt,
@@ -16641,10 +16665,10 @@ function ku({
16641
16665
  }
16642
16666
  },
16643
16667
  [Ye, H, J, F]
16644
- ), nt = et(() => {
16668
+ ), nt = Ze(() => {
16645
16669
  const ee = b ?? [], Se = le.trim().toLowerCase();
16646
16670
  return Se ? y ? ee.filter((mt) => y(mt, Se)) : ee.filter((mt) => `${mt.label} ${mt.secondaryLabel ?? ""}`.toLowerCase().includes(Se)) : ee;
16647
- }, [b, le, y]), Ze = ke === "shared", bt = Ze ? S : q, gt = Ze ? M : N, pt = Ze ? "No shared conversations yet" : "No conversations yet", be = (ee) => {
16671
+ }, [b, le, y]), Qe = ke === "shared", bt = Qe ? S : q, gt = Qe ? M : N, pt = Qe ? "No shared conversations yet" : "No conversations yet", be = (ee) => {
16648
16672
  const Se = ee.sharedAt ? ` • ${At(ee.sharedAt)}` : "";
16649
16673
  return `Shared by ${ee.sharedByUserId}${Se}`;
16650
16674
  }, rt = (ee) => "sharedByUserId" in ee;
@@ -16803,7 +16827,7 @@ function ku({
16803
16827
  showDeleteButton: n,
16804
16828
  formatDate: At,
16805
16829
  getDisplayThreadTitle: It,
16806
- secondaryLine: Ze && rt(ee) ? be(ee) : void 0,
16830
+ secondaryLine: Qe && rt(ee) ? be(ee) : void 0,
16807
16831
  itemClassName: s.threadItem,
16808
16832
  activeItemClassName: s.activeThread
16809
16833
  },
@@ -19082,7 +19106,7 @@ function cI(e) {
19082
19106
  }
19083
19107
  var uI = (e) => {
19084
19108
  var t, n, r, o, s, a, i, l, c, d, p;
19085
- let { invert: m, toast: f, unstyled: v, interacting: g, setHeights: x, visibleToasts: b, heights: w, index: y, toasts: C, expanded: S, removeToast: T, defaultRichColors: E, closeButton: N, style: M, cancelButtonStyle: L, actionButtonStyle: H, className: V = "", descriptionClassName: W = "", duration: R, position: U, gap: k, loadingIcon: F, expandByDefault: _, classNames: A, icons: q, closeButtonAriaLabel: X = "Close toast", pauseWhenPageIsHidden: j } = e, [P, K] = O.useState(null), [G, oe] = O.useState(null), [B, D] = O.useState(!1), [Y, ne] = O.useState(!1), [ae, $] = O.useState(!1), [J, ce] = O.useState(!1), [le, ge] = O.useState(!1), [Ae, Ke] = O.useState(0), [ze, ke] = O.useState(0), Fe = O.useRef(f.duration || R || Nu), qe = O.useRef(null), He = O.useRef(null), Ye = y === 0, ot = y + 1 <= b, nt = f.type, Ze = f.dismissible !== !1, bt = f.className || "", gt = f.descriptionClassName || "", pt = O.useMemo(() => w.findIndex((Te) => Te.toastId === f.id) || 0, [w, f.id]), be = O.useMemo(() => {
19109
+ let { invert: m, toast: f, unstyled: v, interacting: g, setHeights: x, visibleToasts: b, heights: w, index: y, toasts: C, expanded: S, removeToast: T, defaultRichColors: E, closeButton: N, style: M, cancelButtonStyle: L, actionButtonStyle: H, className: V = "", descriptionClassName: W = "", duration: R, position: U, gap: k, loadingIcon: F, expandByDefault: _, classNames: A, icons: q, closeButtonAriaLabel: X = "Close toast", pauseWhenPageIsHidden: j } = e, [P, K] = O.useState(null), [G, oe] = O.useState(null), [B, D] = O.useState(!1), [Y, ne] = O.useState(!1), [ae, $] = O.useState(!1), [J, ce] = O.useState(!1), [le, ge] = O.useState(!1), [Ae, Ke] = O.useState(0), [ze, ke] = O.useState(0), Fe = O.useRef(f.duration || R || Nu), qe = O.useRef(null), He = O.useRef(null), Ye = y === 0, ot = y + 1 <= b, nt = f.type, Qe = f.dismissible !== !1, bt = f.className || "", gt = f.descriptionClassName || "", pt = O.useMemo(() => w.findIndex((Te) => Te.toastId === f.id) || 0, [w, f.id]), be = O.useMemo(() => {
19086
19110
  var Te;
19087
19111
  return (Te = f.closeButton) != null ? Te : N;
19088
19112
  }, [f.closeButton, N]), rt = O.useMemo(() => f.duration || R || Nu, [f.duration, R]), st = O.useRef(0), Nt = O.useRef(0), sn = O.useRef(0), Le = O.useRef(null), [Ge, Dt] = U.split("-"), At = O.useMemo(() => w.reduce((Te, Pe, Ue) => Ue >= pt ? Te : Te + Pe.height, 0), [w, pt]), yt = GR(), It = f.invert || m, ee = nt === "loading";
@@ -19128,34 +19152,34 @@ var uI = (e) => {
19128
19152
  var Te, Pe, Ue;
19129
19153
  return q != null && q.loading ? O.createElement("div", { className: an(A == null ? void 0 : A.loader, (Te = f == null ? void 0 : f.classNames) == null ? void 0 : Te.loader, "sonner-loader"), "data-visible": nt === "loading" }, q.loading) : F ? O.createElement("div", { className: an(A == null ? void 0 : A.loader, (Pe = f == null ? void 0 : f.classNames) == null ? void 0 : Pe.loader, "sonner-loader"), "data-visible": nt === "loading" }, F) : O.createElement(HR, { className: an(A == null ? void 0 : A.loader, (Ue = f == null ? void 0 : f.classNames) == null ? void 0 : Ue.loader), visible: nt === "loading" });
19130
19154
  }
19131
- return O.createElement("li", { tabIndex: 0, ref: He, className: an(V, bt, A == null ? void 0 : A.toast, (t = f == null ? void 0 : f.classNames) == null ? void 0 : t.toast, A == null ? void 0 : A.default, A == null ? void 0 : A[nt], (n = f == null ? void 0 : f.classNames) == null ? void 0 : n[nt]), "data-sonner-toast": "", "data-rich-colors": (r = f.richColors) != null ? r : E, "data-styled": !(f.jsx || f.unstyled || v), "data-mounted": B, "data-promise": !!f.promise, "data-swiped": le, "data-removed": Y, "data-visible": ot, "data-y-position": Ge, "data-x-position": Dt, "data-index": y, "data-front": Ye, "data-swiping": ae, "data-dismissible": Ze, "data-type": nt, "data-invert": It, "data-swipe-out": J, "data-swipe-direction": G, "data-expanded": !!(S || _ && B), style: { "--index": y, "--toasts-before": y, "--z-index": C.length - y, "--offset": `${Y ? Ae : Nt.current}px`, "--initial-height": _ ? "auto" : `${ze}px`, ...M, ...f.style }, onDragEnd: () => {
19155
+ return O.createElement("li", { tabIndex: 0, ref: He, className: an(V, bt, A == null ? void 0 : A.toast, (t = f == null ? void 0 : f.classNames) == null ? void 0 : t.toast, A == null ? void 0 : A.default, A == null ? void 0 : A[nt], (n = f == null ? void 0 : f.classNames) == null ? void 0 : n[nt]), "data-sonner-toast": "", "data-rich-colors": (r = f.richColors) != null ? r : E, "data-styled": !(f.jsx || f.unstyled || v), "data-mounted": B, "data-promise": !!f.promise, "data-swiped": le, "data-removed": Y, "data-visible": ot, "data-y-position": Ge, "data-x-position": Dt, "data-index": y, "data-front": Ye, "data-swiping": ae, "data-dismissible": Qe, "data-type": nt, "data-invert": It, "data-swipe-out": J, "data-swipe-direction": G, "data-expanded": !!(S || _ && B), style: { "--index": y, "--toasts-before": y, "--z-index": C.length - y, "--offset": `${Y ? Ae : Nt.current}px`, "--initial-height": _ ? "auto" : `${ze}px`, ...M, ...f.style }, onDragEnd: () => {
19132
19156
  $(!1), K(null), Le.current = null;
19133
19157
  }, onPointerDown: (Te) => {
19134
- ee || !Ze || (qe.current = /* @__PURE__ */ new Date(), Ke(Nt.current), Te.target.setPointerCapture(Te.pointerId), Te.target.tagName !== "BUTTON" && ($(!0), Le.current = { x: Te.clientX, y: Te.clientY }));
19158
+ ee || !Qe || (qe.current = /* @__PURE__ */ new Date(), Ke(Nt.current), Te.target.setPointerCapture(Te.pointerId), Te.target.tagName !== "BUTTON" && ($(!0), Le.current = { x: Te.clientX, y: Te.clientY }));
19135
19159
  }, onPointerUp: () => {
19136
19160
  var Te, Pe, Ue, Et;
19137
- if (J || !Ze) return;
19161
+ if (J || !Qe) return;
19138
19162
  Le.current = null;
19139
- let Be = Number(((Te = He.current) == null ? void 0 : Te.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), ht = Number(((Pe = He.current) == null ? void 0 : Pe.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), $e = (/* @__PURE__ */ new Date()).getTime() - ((Ue = qe.current) == null ? void 0 : Ue.getTime()), Qe = P === "x" ? Be : ht, Ft = Math.abs(Qe) / $e;
19140
- if (Math.abs(Qe) >= iI || Ft > 0.11) {
19163
+ let Be = Number(((Te = He.current) == null ? void 0 : Te.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), ht = Number(((Pe = He.current) == null ? void 0 : Pe.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), $e = (/* @__PURE__ */ new Date()).getTime() - ((Ue = qe.current) == null ? void 0 : Ue.getTime()), et = P === "x" ? Be : ht, Ft = Math.abs(et) / $e;
19164
+ if (Math.abs(et) >= iI || Ft > 0.11) {
19141
19165
  Ke(Nt.current), (Et = f.onDismiss) == null || Et.call(f, f), oe(P === "x" ? Be > 0 ? "right" : "left" : ht > 0 ? "down" : "up"), Se(), ce(!0), ge(!1);
19142
19166
  return;
19143
19167
  }
19144
19168
  $(!1), K(null);
19145
19169
  }, onPointerMove: (Te) => {
19146
19170
  var Pe, Ue, Et, Be;
19147
- if (!Le.current || !Ze || ((Pe = window.getSelection()) == null ? void 0 : Pe.toString().length) > 0) return;
19148
- let ht = Te.clientY - Le.current.y, $e = Te.clientX - Le.current.x, Qe = (Ue = e.swipeDirections) != null ? Ue : cI(U);
19171
+ if (!Le.current || !Qe || ((Pe = window.getSelection()) == null ? void 0 : Pe.toString().length) > 0) return;
19172
+ let ht = Te.clientY - Le.current.y, $e = Te.clientX - Le.current.x, et = (Ue = e.swipeDirections) != null ? Ue : cI(U);
19149
19173
  !P && (Math.abs($e) > 1 || Math.abs(ht) > 1) && K(Math.abs($e) > Math.abs(ht) ? "x" : "y");
19150
19174
  let Ft = { x: 0, y: 0 };
19151
- P === "y" ? (Qe.includes("top") || Qe.includes("bottom")) && (Qe.includes("top") && ht < 0 || Qe.includes("bottom") && ht > 0) && (Ft.y = ht) : P === "x" && (Qe.includes("left") || Qe.includes("right")) && (Qe.includes("left") && $e < 0 || Qe.includes("right") && $e > 0) && (Ft.x = $e), (Math.abs(Ft.x) > 0 || Math.abs(Ft.y) > 0) && ge(!0), (Et = He.current) == null || Et.style.setProperty("--swipe-amount-x", `${Ft.x}px`), (Be = He.current) == null || Be.style.setProperty("--swipe-amount-y", `${Ft.y}px`);
19152
- } }, be && !f.jsx ? O.createElement("button", { "aria-label": X, "data-disabled": ee, "data-close-button": !0, onClick: ee || !Ze ? () => {
19175
+ P === "y" ? (et.includes("top") || et.includes("bottom")) && (et.includes("top") && ht < 0 || et.includes("bottom") && ht > 0) && (Ft.y = ht) : P === "x" && (et.includes("left") || et.includes("right")) && (et.includes("left") && $e < 0 || et.includes("right") && $e > 0) && (Ft.x = $e), (Math.abs(Ft.x) > 0 || Math.abs(Ft.y) > 0) && ge(!0), (Et = He.current) == null || Et.style.setProperty("--swipe-amount-x", `${Ft.x}px`), (Be = He.current) == null || Be.style.setProperty("--swipe-amount-y", `${Ft.y}px`);
19176
+ } }, be && !f.jsx ? O.createElement("button", { "aria-label": X, "data-disabled": ee, "data-close-button": !0, onClick: ee || !Qe ? () => {
19153
19177
  } : () => {
19154
19178
  var Te;
19155
19179
  Se(), (Te = f.onDismiss) == null || Te.call(f, f);
19156
19180
  }, className: an(A == null ? void 0 : A.closeButton, (o = f == null ? void 0 : f.classNames) == null ? void 0 : o.closeButton) }, (s = q == null ? void 0 : q.close) != null ? s : qR) : null, f.jsx || pa(f.title) ? f.jsx ? f.jsx : typeof f.title == "function" ? f.title() : f.title : O.createElement(O.Fragment, null, nt || f.icon || f.promise ? O.createElement("div", { "data-icon": "", className: an(A == null ? void 0 : A.icon, (a = f == null ? void 0 : f.classNames) == null ? void 0 : a.icon) }, f.promise || f.type === "loading" && !f.icon ? f.icon || mt() : null, f.type !== "loading" ? f.icon || (q == null ? void 0 : q[nt]) || BR(nt) : null) : null, O.createElement("div", { "data-content": "", className: an(A == null ? void 0 : A.content, (i = f == null ? void 0 : f.classNames) == null ? void 0 : i.content) }, O.createElement("div", { "data-title": "", className: an(A == null ? void 0 : A.title, (l = f == null ? void 0 : f.classNames) == null ? void 0 : l.title) }, typeof f.title == "function" ? f.title() : f.title), f.description ? O.createElement("div", { "data-description": "", className: an(W, gt, A == null ? void 0 : A.description, (c = f == null ? void 0 : f.classNames) == null ? void 0 : c.description) }, typeof f.description == "function" ? f.description() : f.description) : null), pa(f.cancel) ? f.cancel : f.cancel && Ho(f.cancel) ? O.createElement("button", { "data-button": !0, "data-cancel": !0, style: f.cancelButtonStyle || L, onClick: (Te) => {
19157
19181
  var Pe, Ue;
19158
- Ho(f.cancel) && Ze && ((Ue = (Pe = f.cancel).onClick) == null || Ue.call(Pe, Te), Se());
19182
+ Ho(f.cancel) && Qe && ((Ue = (Pe = f.cancel).onClick) == null || Ue.call(Pe, Te), Se());
19159
19183
  }, className: an(A == null ? void 0 : A.cancelButton, (d = f == null ? void 0 : f.classNames) == null ? void 0 : d.cancelButton) }, f.cancel.label) : null, pa(f.action) ? f.action : f.action && Ho(f.action) ? O.createElement("button", { "data-button": !0, "data-action": !0, style: f.actionButtonStyle || H, onClick: (Te) => {
19160
19184
  var Pe, Ue;
19161
19185
  Ho(f.action) && ((Ue = (Pe = f.action).onClick) == null || Ue.call(Pe, Te), !Te.defaultPrevented && Se());