@arcteninc/core 0.0.77 → 0.0.78

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as f, jsxs as k, Fragment as Pe } from "react/jsx-runtime";
1
+ import { jsx as f, jsxs as M, Fragment as Pe } from "react/jsx-runtime";
2
2
  import * as Et from "react";
3
3
  import { useImperativeHandle as tc, createContext as pe, useRef as st, useLayoutEffect as ec, useEffect as _, useId as Ls, useContext as ct, useInsertionEffect as Wr, useMemo as G, useCallback as nn, Children as nc, isValidElement as sc, useState as F, Fragment as _r, createElement as ic, forwardRef as rc, Component as oc, memo as un, Suspense as ac, lazy as cc } from "react";
4
4
  import { Check as Kr, X as Nn, ChevronDown as lc, ChevronRight as uc, Zap as dc, BrainIcon as hc, ChevronDownIcon as fc, Plus as mc, Dock as pc, PictureInPicture2 as gc, Maximize2 as yc, Minimize2 as vc, Square as xc, ArrowRight as bc, BotMessageSquare as wc } from "lucide-react";
@@ -167,7 +167,7 @@ function Yt({
167
167
  children: n,
168
168
  ...s
169
169
  }) {
170
- return /* @__PURE__ */ f(Ne.Portal, { children: /* @__PURE__ */ k(
170
+ return /* @__PURE__ */ f(Ne.Portal, { children: /* @__PURE__ */ M(
171
171
  Ne.Content,
172
172
  {
173
173
  "data-slot": "tooltip-content",
@@ -369,18 +369,18 @@ function mo(t, e) {
369
369
  delta: 0,
370
370
  timestamp: 0,
371
371
  isProcessing: !1
372
- }, o = () => n = !0, r = Tn.reduce((w, D) => (w[D] = Oc(o), w), {}), { setup: a, read: c, resolveKeyframes: u, preUpdate: l, update: d, preRender: h, render: p, postRender: y } = r, v = () => {
373
- const w = Ut.useManualTiming ? i.timestamp : performance.now();
374
- n = !1, Ut.useManualTiming || (i.delta = s ? 1e3 / 60 : Math.max(Math.min(w - i.timestamp, jc), 1)), i.timestamp = w, i.isProcessing = !0, a.process(i), c.process(i), u.process(i), l.process(i), d.process(i), h.process(i), p.process(i), y.process(i), i.isProcessing = !1, n && e && (s = !1, t(v));
372
+ }, o = () => n = !0, r = Tn.reduce((x, D) => (x[D] = Oc(o), x), {}), { setup: a, read: c, resolveKeyframes: u, preUpdate: l, update: d, preRender: h, render: p, postRender: y } = r, v = () => {
373
+ const x = Ut.useManualTiming ? i.timestamp : performance.now();
374
+ n = !1, Ut.useManualTiming || (i.delta = s ? 1e3 / 60 : Math.max(Math.min(x - i.timestamp, jc), 1)), i.timestamp = x, i.isProcessing = !0, a.process(i), c.process(i), u.process(i), l.process(i), d.process(i), h.process(i), p.process(i), y.process(i), i.isProcessing = !1, n && e && (s = !1, t(v));
375
375
  }, S = () => {
376
376
  n = !0, s = !0, i.isProcessing || t(v);
377
377
  };
378
- return { schedule: Tn.reduce((w, D) => {
379
- const M = r[D];
380
- return w[D] = (A, L = !1, N = !1) => (n || S(), M.schedule(A, L, N)), w;
381
- }, {}), cancel: (w) => {
378
+ return { schedule: Tn.reduce((x, D) => {
379
+ const k = r[D];
380
+ return x[D] = (C, O = !1, N = !1) => (n || S(), k.schedule(C, O, N)), x;
381
+ }, {}), cancel: (x) => {
382
382
  for (let D = 0; D < Tn.length; D++)
383
- r[Tn[D]].cancel(w);
383
+ r[Tn[D]].cancel(x);
384
384
  }, state: i, steps: r };
385
385
  }
386
386
  const { schedule: Y, cancel: Jt, state: at, steps: qn } = /* @__PURE__ */ mo(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Pt, !0);
@@ -442,7 +442,7 @@ const fs = {
442
442
  test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1,
443
443
  parse: parseFloat,
444
444
  transform: (e) => `${e}${t}`
445
- }), qt = /* @__PURE__ */ fn("deg"), It = /* @__PURE__ */ fn("%"), O = /* @__PURE__ */ fn("px"), Kc = /* @__PURE__ */ fn("vh"), Hc = /* @__PURE__ */ fn("vw"), Di = {
445
+ }), qt = /* @__PURE__ */ fn("deg"), It = /* @__PURE__ */ fn("%"), L = /* @__PURE__ */ fn("px"), Kc = /* @__PURE__ */ fn("vh"), Hc = /* @__PURE__ */ fn("vw"), Di = {
446
446
  ...It,
447
447
  parse: (t) => It.parse(t) / 100,
448
448
  transform: (t) => It.transform(t * 100)
@@ -736,39 +736,39 @@ function On(t = q.visualDuration, e = q.bounce) {
736
736
  velocity: -/* @__PURE__ */ At(n.velocity || 0)
737
737
  }), y = h || 0, v = u / (2 * Math.sqrt(c * l)), S = r - o, g = /* @__PURE__ */ At(Math.sqrt(c / l)), b = Math.abs(S) < 5;
738
738
  s || (s = b ? q.restSpeed.granular : q.restSpeed.default), i || (i = b ? q.restDelta.granular : q.restDelta.default);
739
- let w;
739
+ let x;
740
740
  if (v < 1) {
741
- const M = ps(g, v);
742
- w = (A) => {
743
- const L = Math.exp(-v * g * A);
744
- return r - L * ((y + v * g * S) / M * Math.sin(M * A) + S * Math.cos(M * A));
741
+ const k = ps(g, v);
742
+ x = (C) => {
743
+ const O = Math.exp(-v * g * C);
744
+ return r - O * ((y + v * g * S) / k * Math.sin(k * C) + S * Math.cos(k * C));
745
745
  };
746
746
  } else if (v === 1)
747
- w = (M) => r - Math.exp(-g * M) * (S + (y + g * S) * M);
747
+ x = (k) => r - Math.exp(-g * k) * (S + (y + g * S) * k);
748
748
  else {
749
- const M = g * Math.sqrt(v * v - 1);
750
- w = (A) => {
751
- const L = Math.exp(-v * g * A), N = Math.min(M * A, 300);
752
- return r - L * ((y + v * g * S) * Math.sinh(N) + M * S * Math.cosh(N)) / M;
749
+ const k = g * Math.sqrt(v * v - 1);
750
+ x = (C) => {
751
+ const O = Math.exp(-v * g * C), N = Math.min(k * C, 300);
752
+ return r - O * ((y + v * g * S) * Math.sinh(N) + k * S * Math.cosh(N)) / k;
753
753
  };
754
754
  }
755
755
  const D = {
756
756
  calculatedDuration: p && d || null,
757
- next: (M) => {
758
- const A = w(M);
757
+ next: (k) => {
758
+ const C = x(k);
759
759
  if (p)
760
- a.done = M >= d;
760
+ a.done = k >= d;
761
761
  else {
762
- let L = M === 0 ? y : 0;
763
- v < 1 && (L = M === 0 ? /* @__PURE__ */ Dt(y) : Ao(w, M, A));
764
- const N = Math.abs(L) <= s, B = Math.abs(r - A) <= i;
765
- a.done = N && B;
762
+ let O = k === 0 ? y : 0;
763
+ v < 1 && (O = k === 0 ? /* @__PURE__ */ Dt(y) : Ao(x, k, C));
764
+ const N = Math.abs(O) <= s, z = Math.abs(r - C) <= i;
765
+ a.done = N && z;
766
766
  }
767
- return a.value = a.done ? r : A, a;
767
+ return a.value = a.done ? r : C, a;
768
768
  },
769
769
  toString: () => {
770
- const M = Math.min(Zs(D), Ln), A = So((L) => D.next(M * L).value, M, 30);
771
- return M + "ms " + A;
770
+ const k = Math.min(Zs(D), Ln), C = So((O) => D.next(k * O).value, k, 30);
771
+ return k + "ms " + C;
772
772
  },
773
773
  toTransition: () => {
774
774
  }
@@ -787,15 +787,15 @@ function gs({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 3
787
787
  let v = n * e;
788
788
  const S = d + v, g = r === void 0 ? S : r(S);
789
789
  g !== S && (v = g - d);
790
- const b = (N) => -v * Math.exp(-N / s), w = (N) => g + b(N), D = (N) => {
791
- const B = b(N), Z = w(N);
792
- h.done = Math.abs(B) <= u, h.value = h.done ? g : Z;
790
+ const b = (N) => -v * Math.exp(-N / s), x = (N) => g + b(N), D = (N) => {
791
+ const z = b(N), Z = x(N);
792
+ h.done = Math.abs(z) <= u, h.value = h.done ? g : Z;
793
793
  };
794
- let M, A;
795
- const L = (N) => {
796
- p(h.value) && (M = N, A = On({
794
+ let k, C;
795
+ const O = (N) => {
796
+ p(h.value) && (k = N, C = On({
797
797
  keyframes: [h.value, y(h.value)],
798
- velocity: Ao(w, N, h.value),
798
+ velocity: Ao(x, N, h.value),
799
799
  // TODO: This should be passing * 1000
800
800
  damping: i,
801
801
  stiffness: o,
@@ -803,11 +803,11 @@ function gs({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 3
803
803
  restSpeed: l
804
804
  }));
805
805
  };
806
- return L(0), {
806
+ return O(0), {
807
807
  calculatedDuration: null,
808
808
  next: (N) => {
809
- let B = !1;
810
- return !A && M === void 0 && (B = !0, D(N), L(N)), M !== void 0 && N >= M ? A.next(N - M) : (!B && D(N), h);
809
+ let z = !1;
810
+ return !C && k === void 0 && (z = !0, D(N), O(N)), k !== void 0 && N >= k ? C.next(N - k) : (!z && D(N), h);
811
811
  }
812
812
  };
813
813
  }
@@ -952,18 +952,18 @@ class ei extends ti {
952
952
  this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - i / this.speed, this.startTime)), n ? this.currentTime = e : this.updateTime(e);
953
953
  const g = this.currentTime - u * (this.playbackSpeed >= 0 ? 1 : -1), b = this.playbackSpeed >= 0 ? g < 0 : g > i;
954
954
  this.currentTime = Math.max(g, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = i);
955
- let w = this.currentTime, D = s;
955
+ let x = this.currentTime, D = s;
956
956
  if (d) {
957
957
  const N = Math.min(this.currentTime, i) / a;
958
- let B = Math.floor(N), Z = N % 1;
959
- !Z && N >= 1 && (Z = 1), Z === 1 && B--, B = Math.min(B, d + 1), !!(B % 2) && (h === "reverse" ? (Z = 1 - Z, p && (Z -= p / a)) : h === "mirror" && (D = r)), w = $t(0, 1, Z) * a;
958
+ let z = Math.floor(N), Z = N % 1;
959
+ !Z && N >= 1 && (Z = 1), Z === 1 && z--, z = Math.min(z, d + 1), !!(z % 2) && (h === "reverse" ? (Z = 1 - Z, p && (Z -= p / a)) : h === "mirror" && (D = r)), x = $t(0, 1, Z) * a;
960
960
  }
961
- const M = b ? { done: !1, value: l[0] } : D.next(w);
962
- o && (M.value = o(M.value));
963
- let { done: A } = M;
964
- !b && c !== null && (A = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0);
965
- const L = this.holdTime === null && (this.state === "finished" || this.state === "running" && A);
966
- return L && y !== gs && (M.value = Qs(l, this.options, S, this.speed)), v && v(M.value), L && this.finish(), M;
961
+ const k = b ? { done: !1, value: l[0] } : D.next(x);
962
+ o && (k.value = o(k.value));
963
+ let { done: C } = k;
964
+ !b && c !== null && (C = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0);
965
+ const O = this.holdTime === null && (this.state === "finished" || this.state === "running" && C);
966
+ return O && y !== gs && (k.value = Qs(l, this.options, S, this.speed)), v && v(k.value), O && this.finish(), k;
967
967
  }
968
968
  /**
969
969
  * Allows the returned animation to be awaited or promise-chained. Currently
@@ -1109,7 +1109,7 @@ const Fe = [
1109
1109
  "skew",
1110
1110
  "skewX",
1111
1111
  "skewY"
1112
- ], Be = new Set(Fe), Fi = (t) => t === je || t === O, Vl = /* @__PURE__ */ new Set(["x", "y", "z"]), Nl = Fe.filter((t) => !Vl.has(t));
1112
+ ], Be = new Set(Fe), Fi = (t) => t === je || t === L, Vl = /* @__PURE__ */ new Set(["x", "y", "z"]), Nl = Fe.filter((t) => !Vl.has(t));
1113
1113
  function Rl(t) {
1114
1114
  const e = [];
1115
1115
  return Nl.forEach((n) => {
@@ -1548,7 +1548,7 @@ const Ro = /* @__PURE__ */ new Set([
1548
1548
  ]), nu = {
1549
1549
  test: (t) => t === "auto",
1550
1550
  parse: (t) => t
1551
- }, Io = (t) => (e) => e.test(t), Lo = [je, O, It, qt, Hc, Kc, nu], Ui = (t) => Lo.find(Io(t));
1551
+ }, Io = (t) => (e) => e.test(t), Lo = [je, L, It, qt, Hc, Kc, nu], Ui = (t) => Lo.find(Io(t));
1552
1552
  function su(t) {
1553
1553
  return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || eo(t) : !0;
1554
1554
  }
@@ -1585,55 +1585,55 @@ const ou = /\b([a-z-]*)\(.*?\)/gu, Ps = {
1585
1585
  skew: qt,
1586
1586
  skewX: qt,
1587
1587
  skewY: qt,
1588
- distance: O,
1589
- translateX: O,
1590
- translateY: O,
1591
- translateZ: O,
1592
- x: O,
1593
- y: O,
1594
- z: O,
1595
- perspective: O,
1596
- transformPerspective: O,
1588
+ distance: L,
1589
+ translateX: L,
1590
+ translateY: L,
1591
+ translateZ: L,
1592
+ x: L,
1593
+ y: L,
1594
+ z: L,
1595
+ perspective: L,
1596
+ transformPerspective: L,
1597
1597
  opacity: rn,
1598
1598
  originX: Di,
1599
1599
  originY: Di,
1600
- originZ: O
1600
+ originZ: L
1601
1601
  }, ii = {
1602
1602
  // Border props
1603
- borderWidth: O,
1604
- borderTopWidth: O,
1605
- borderRightWidth: O,
1606
- borderBottomWidth: O,
1607
- borderLeftWidth: O,
1608
- borderRadius: O,
1609
- radius: O,
1610
- borderTopLeftRadius: O,
1611
- borderTopRightRadius: O,
1612
- borderBottomRightRadius: O,
1613
- borderBottomLeftRadius: O,
1603
+ borderWidth: L,
1604
+ borderTopWidth: L,
1605
+ borderRightWidth: L,
1606
+ borderBottomWidth: L,
1607
+ borderLeftWidth: L,
1608
+ borderRadius: L,
1609
+ radius: L,
1610
+ borderTopLeftRadius: L,
1611
+ borderTopRightRadius: L,
1612
+ borderBottomRightRadius: L,
1613
+ borderBottomLeftRadius: L,
1614
1614
  // Positioning props
1615
- width: O,
1616
- maxWidth: O,
1617
- height: O,
1618
- maxHeight: O,
1619
- top: O,
1620
- right: O,
1621
- bottom: O,
1622
- left: O,
1615
+ width: L,
1616
+ maxWidth: L,
1617
+ height: L,
1618
+ maxHeight: L,
1619
+ top: L,
1620
+ right: L,
1621
+ bottom: L,
1622
+ left: L,
1623
1623
  // Spacing props
1624
- padding: O,
1625
- paddingTop: O,
1626
- paddingRight: O,
1627
- paddingBottom: O,
1628
- paddingLeft: O,
1629
- margin: O,
1630
- marginTop: O,
1631
- marginRight: O,
1632
- marginBottom: O,
1633
- marginLeft: O,
1624
+ padding: L,
1625
+ paddingTop: L,
1626
+ paddingRight: L,
1627
+ paddingBottom: L,
1628
+ paddingLeft: L,
1629
+ margin: L,
1630
+ marginTop: L,
1631
+ marginRight: L,
1632
+ marginBottom: L,
1633
+ marginLeft: L,
1634
1634
  // Misc
1635
- backgroundPositionX: O,
1636
- backgroundPositionY: O,
1635
+ backgroundPositionX: L,
1636
+ backgroundPositionY: L,
1637
1637
  ...au,
1638
1638
  zIndex: Wi,
1639
1639
  // SVG
@@ -2167,37 +2167,37 @@ function Yi(t) {
2167
2167
  }), e;
2168
2168
  }
2169
2169
  const Du = ({ children: t, custom: e, initial: n = !0, onExitComplete: s, presenceAffectsLayout: i = !0, mode: o = "sync", propagate: r = !1, anchorX: a = "left", root: c }) => {
2170
- const [u, l] = _o(r), d = G(() => Yi(t), [t]), h = r && !u ? [] : d.map(An), p = st(!0), y = st(d), v = Fs(() => /* @__PURE__ */ new Map()), [S, g] = F(d), [b, w] = F(d);
2170
+ const [u, l] = _o(r), d = G(() => Yi(t), [t]), h = r && !u ? [] : d.map(An), p = st(!0), y = st(d), v = Fs(() => /* @__PURE__ */ new Map()), [S, g] = F(d), [b, x] = F(d);
2171
2171
  Zr(() => {
2172
2172
  p.current = !1, y.current = d;
2173
- for (let A = 0; A < b.length; A++) {
2174
- const L = An(b[A]);
2175
- h.includes(L) ? v.delete(L) : v.get(L) !== !0 && v.set(L, !1);
2173
+ for (let C = 0; C < b.length; C++) {
2174
+ const O = An(b[C]);
2175
+ h.includes(O) ? v.delete(O) : v.get(O) !== !0 && v.set(O, !1);
2176
2176
  }
2177
2177
  }, [b, h.length, h.join("-")]);
2178
2178
  const D = [];
2179
2179
  if (d !== S) {
2180
- let A = [...d];
2181
- for (let L = 0; L < b.length; L++) {
2182
- const N = b[L], B = An(N);
2183
- h.includes(B) || (A.splice(L, 0, N), D.push(N));
2180
+ let C = [...d];
2181
+ for (let O = 0; O < b.length; O++) {
2182
+ const N = b[O], z = An(N);
2183
+ h.includes(z) || (C.splice(O, 0, N), D.push(N));
2184
2184
  }
2185
- return o === "wait" && D.length && (A = D), w(Yi(A)), g(d), null;
2185
+ return o === "wait" && D.length && (C = D), x(Yi(C)), g(d), null;
2186
2186
  }
2187
2187
  process.env.NODE_ENV !== "production" && o === "wait" && b.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
2188
- const { forceRender: M } = ct(js);
2189
- return f(Pe, { children: b.map((A) => {
2190
- const L = An(A), N = r && !u ? !1 : d === b || h.includes(L), B = () => {
2191
- if (v.has(L))
2192
- v.set(L, !0);
2188
+ const { forceRender: k } = ct(js);
2189
+ return f(Pe, { children: b.map((C) => {
2190
+ const O = An(C), N = r && !u ? !1 : d === b || h.includes(O), z = () => {
2191
+ if (v.has(O))
2192
+ v.set(O, !0);
2193
2193
  else
2194
2194
  return;
2195
2195
  let Z = !0;
2196
2196
  v.forEach((rt) => {
2197
2197
  rt || (Z = !1);
2198
- }), Z && (M?.(), w(y.current), r && l?.(), s && s());
2198
+ }), Z && (k?.(), x(y.current), r && l?.(), s && s());
2199
2199
  };
2200
- return f(ku, { isPresent: N, initial: !p.current || n ? void 0 : !1, custom: e, presenceAffectsLayout: i, mode: o, root: c, onExitComplete: N ? void 0 : B, anchorX: a, children: A }, L);
2200
+ return f(ku, { isPresent: N, initial: !p.current || n ? void 0 : !1, custom: e, presenceAffectsLayout: i, mode: o, root: c, onExitComplete: N ? void 0 : z, anchorX: a, children: C }, O);
2201
2201
  }) });
2202
2202
  }, ci = pe({ strict: !1 }), qi = {
2203
2203
  animation: [
@@ -2422,8 +2422,8 @@ const _u = {
2422
2422
  function Hu(t, e, n = 1, s = 0, i = !0) {
2423
2423
  t.pathLength = 1;
2424
2424
  const o = i ? _u : Ku;
2425
- t[o.offset] = O.transform(-s);
2426
- const r = O.transform(e), a = O.transform(n);
2425
+ t[o.offset] = L.transform(-s);
2426
+ const r = L.transform(e), a = L.transform(n);
2427
2427
  t[o.array] = `${r} ${a}`;
2428
2428
  }
2429
2429
  function Yo(t, {
@@ -2559,12 +2559,12 @@ function Ju(t, e, n, s) {
2559
2559
  if (y) {
2560
2560
  const { transitionEnd: v, transition: S, ...g } = y;
2561
2561
  for (const b in g) {
2562
- let w = g[b];
2563
- if (Array.isArray(w)) {
2564
- const D = l ? w.length - 1 : 0;
2565
- w = w[D];
2562
+ let x = g[b];
2563
+ if (Array.isArray(x)) {
2564
+ const D = l ? x.length - 1 : 0;
2565
+ x = x[D];
2566
2566
  }
2567
- w !== null && (i[b] = w);
2567
+ x !== null && (i[b] = x);
2568
2568
  }
2569
2569
  for (const b in v)
2570
2570
  i[b] = v[b];
@@ -2681,7 +2681,7 @@ function Dn(t, { forwardMotionProps: e = !1 } = {}, n, s) {
2681
2681
  const y = ad(l);
2682
2682
  u = y.MeasureLayout, h.visualElement = sd(t, p, l, s, y.ProjectionNode);
2683
2683
  }
2684
- return k($n.Provider, { value: h, children: [u && h.visualElement ? f(u, { visualElement: h.visualElement, ...l }) : null, Yu(t, a, ed(p, h.visualElement, c), p, d, e)] });
2684
+ return M($n.Provider, { value: h, children: [u && h.visualElement ? f(u, { visualElement: h.visualElement, ...l }) : null, Yu(t, a, ed(p, h.visualElement, c), p, d, e)] });
2685
2685
  }
2686
2686
  o.displayName = `motion.${typeof t == "string" ? t : `create(${t.displayName ?? t.name ?? ""})`}`;
2687
2687
  const r = rc(o);
@@ -3390,49 +3390,49 @@ function $d(t) {
3390
3390
  const { props: u } = t, l = ga(t.parent) || {}, d = [], h = /* @__PURE__ */ new Set();
3391
3391
  let p = {}, y = 1 / 0;
3392
3392
  for (let S = 0; S < Fd; S++) {
3393
- const g = jd[S], b = n[g], w = u[g] !== void 0 ? u[g] : l[g], D = an(w), M = g === c ? b.isActive : null;
3394
- M === !1 && (y = S);
3395
- let A = w === l[g] && w !== u[g] && D;
3396
- if (A && s && t.manuallyAnimateOnMount && (A = !1), b.protectedKeys = { ...p }, // If it isn't active and hasn't *just* been set as inactive
3397
- !b.isActive && M === null || // If we didn't and don't have any defined prop for this animation type
3398
- !w && !b.prevProp || // Or if the prop doesn't define an animation
3399
- zn(w) || typeof w == "boolean")
3393
+ const g = jd[S], b = n[g], x = u[g] !== void 0 ? u[g] : l[g], D = an(x), k = g === c ? b.isActive : null;
3394
+ k === !1 && (y = S);
3395
+ let C = x === l[g] && x !== u[g] && D;
3396
+ if (C && s && t.manuallyAnimateOnMount && (C = !1), b.protectedKeys = { ...p }, // If it isn't active and hasn't *just* been set as inactive
3397
+ !b.isActive && k === null || // If we didn't and don't have any defined prop for this animation type
3398
+ !x && !b.prevProp || // Or if the prop doesn't define an animation
3399
+ zn(x) || typeof x == "boolean")
3400
3400
  continue;
3401
- const L = zd(b.prevProp, w);
3402
- let N = L || // If we're making this variant active, we want to always make it active
3403
- g === c && b.isActive && !A && D || // If we removed a higher-priority variant (i is in reverse order)
3404
- S > y && D, B = !1;
3405
- const Z = Array.isArray(w) ? w : [w];
3401
+ const O = zd(b.prevProp, x);
3402
+ let N = O || // If we're making this variant active, we want to always make it active
3403
+ g === c && b.isActive && !C && D || // If we removed a higher-priority variant (i is in reverse order)
3404
+ S > y && D, z = !1;
3405
+ const Z = Array.isArray(x) ? x : [x];
3406
3406
  let rt = Z.reduce(i(g), {});
3407
- M === !1 && (rt = {});
3407
+ k === !1 && (rt = {});
3408
3408
  const { prevResolvedValues: W = {} } = b, ge = {
3409
3409
  ...W,
3410
3410
  ...rt
3411
- }, Ct = (z) => {
3412
- N = !0, h.has(z) && (B = !0, h.delete(z)), b.needsAnimating[z] = !0;
3413
- const ht = t.getValue(z);
3411
+ }, Ct = ($) => {
3412
+ N = !0, h.has($) && (z = !0, h.delete($)), b.needsAnimating[$] = !0;
3413
+ const ht = t.getValue($);
3414
3414
  ht && (ht.liveStyle = !1);
3415
3415
  };
3416
- for (const z in ge) {
3417
- const ht = rt[z], ft = W[z];
3418
- if (p.hasOwnProperty(z))
3416
+ for (const $ in ge) {
3417
+ const ht = rt[$], ft = W[$];
3418
+ if (p.hasOwnProperty($))
3419
3419
  continue;
3420
3420
  let mt = !1;
3421
- Ds(ht) && Ds(ft) ? mt = !pa(ht, ft) : mt = ht !== ft, mt ? ht != null ? Ct(z) : h.add(z) : ht !== void 0 && h.has(z) ? Ct(z) : b.protectedKeys[z] = !0;
3421
+ Ds(ht) && Ds(ft) ? mt = !pa(ht, ft) : mt = ht !== ft, mt ? ht != null ? Ct($) : h.add($) : ht !== void 0 && h.has($) ? Ct($) : b.protectedKeys[$] = !0;
3422
3422
  }
3423
- b.prevProp = w, b.prevResolvedValues = rt, b.isActive && (p = { ...p, ...rt }), s && t.blockInitialAnimation && (N = !1);
3424
- const lt = A && L;
3425
- N && (!lt || B) && d.push(...Z.map((z) => {
3423
+ b.prevProp = x, b.prevResolvedValues = rt, b.isActive && (p = { ...p, ...rt }), s && t.blockInitialAnimation && (N = !1);
3424
+ const lt = C && O;
3425
+ N && (!lt || z) && d.push(...Z.map(($) => {
3426
3426
  const ht = { type: g };
3427
- if (typeof z == "string" && s && !lt && t.manuallyAnimateOnMount && t.parent) {
3428
- const { parent: ft } = t, mt = Re(ft, z);
3427
+ if (typeof $ == "string" && s && !lt && t.manuallyAnimateOnMount && t.parent) {
3428
+ const { parent: ft } = t, mt = Re(ft, $);
3429
3429
  if (ft.enteringChildren && mt) {
3430
3430
  const { delayChildren: pt } = mt.transition || {};
3431
3431
  ht.delay = ma(ft.enteringChildren, t, pt);
3432
3432
  }
3433
3433
  }
3434
3434
  return {
3435
- animation: z,
3435
+ animation: $,
3436
3436
  options: ht
3437
3437
  };
3438
3438
  }));
@@ -3444,8 +3444,8 @@ function $d(t) {
3444
3444
  g && g.transition && (S.transition = g.transition);
3445
3445
  }
3446
3446
  h.forEach((g) => {
3447
- const b = t.getBaseTarget(g), w = t.getValue(g);
3448
- w && (w.liveStyle = !0), S[g] = b ?? null;
3447
+ const b = t.getBaseTarget(g), x = t.getValue(g);
3448
+ x && (x.liveStyle = !0), S[g] = b ?? null;
3449
3449
  }), d.push({ animation: S });
3450
3450
  }
3451
3451
  let v = !!d.length;
@@ -3748,9 +3748,9 @@ class ch {
3748
3748
  this.latestPointerEvent = d, this.latestPanInfo = h, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), St((g) => {
3749
3749
  let b = this.getAxisMotionValue(g).get() || 0;
3750
3750
  if (It.test(b)) {
3751
- const { projection: w } = this.visualElement;
3752
- if (w && w.layout) {
3753
- const D = w.layout.layoutBox[g];
3751
+ const { projection: x } = this.visualElement;
3752
+ if (x && x.layout) {
3753
+ const D = x.layout.layoutBox[g];
3754
3754
  D && (b = yt(D) * (parseFloat(b) / 100));
3755
3755
  }
3756
3756
  }
@@ -4030,7 +4030,7 @@ const Xe = {
4030
4030
  if (!e.target)
4031
4031
  return t;
4032
4032
  if (typeof t == "string")
4033
- if (O.test(t))
4033
+ if (L.test(t))
4034
4034
  t = parseFloat(t);
4035
4035
  else
4036
4036
  return t;
@@ -4135,7 +4135,7 @@ function vh(t, e) {
4135
4135
  };
4136
4136
  return Y.setup(s, !0), () => Jt(s);
4137
4137
  }
4138
- const Aa = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], xh = Aa.length, xr = (t) => typeof t == "string" ? parseFloat(t) : t, br = (t) => typeof t == "number" || O.test(t);
4138
+ const Aa = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], xh = Aa.length, xr = (t) => typeof t == "string" ? parseFloat(t) : t, br = (t) => typeof t == "number" || L.test(t);
4139
4139
  function bh(t, e, n, s, i, o) {
4140
4140
  i ? (t.opacity = J(0, n.opacity ?? 1, wh(s)), t.opacityExit = J(e.opacity ?? 1, 0, Th(s))) : o && (t.opacity = J(e.opacity ?? 1, n.opacity ?? 1, s));
4141
4141
  for (let r = 0; r < xh; r++) {
@@ -4335,12 +4335,12 @@ function Ea({ attachResizeListener: t, defaultParent: e, measureScroll: n, check
4335
4335
  const y = this.options.transition || u.getDefaultTransition() || Wh, { onLayoutAnimationStart: v, onLayoutAnimationComplete: S } = u.getProps(), g = !this.targetLayout || !Ma(this.targetLayout, p), b = !d && h;
4336
4336
  if (this.options.layoutRoot || this.resumeFrom || b || d && (g || !this.currentAnimation)) {
4337
4337
  this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
4338
- const w = {
4338
+ const x = {
4339
4339
  ...si(y, "layout"),
4340
4340
  onPlay: v,
4341
4341
  onComplete: S
4342
4342
  };
4343
- (u.shouldReduceMotion || this.options.layoutRoot) && (w.delay = 0, w.type = !1), this.startAnimation(w), this.setAnimationOrigin(l, b);
4343
+ (u.shouldReduceMotion || this.options.layoutRoot) && (x.delay = 0, x.type = !1), this.startAnimation(x), this.setAnimationOrigin(l, b);
4344
4344
  } else
4345
4345
  d || Ir(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
4346
4346
  this.targetLayout = p;
@@ -4591,10 +4591,10 @@ function Ea({ attachResizeListener: t, defaultParent: e, measureScroll: n, check
4591
4591
  (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a;
4592
4592
  const h = Q(), p = c ? c.source : void 0, y = this.layout ? this.layout.source : void 0, v = p !== y, S = this.getStack(), g = !S || S.members.length <= 1, b = !!(v && !g && this.options.crossfade === !0 && !this.path.some(Uh));
4593
4593
  this.animationProgress = 0;
4594
- let w;
4594
+ let x;
4595
4595
  this.mixTargetDelta = (D) => {
4596
- const M = D / 1e3;
4597
- Lr(d.x, r.x, M), Lr(d.y, r.y, M), this.setTargetDelta(d), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Qe(h, this.layout.layoutBox, this.relativeParent.layout.layoutBox), zh(this.relativeTarget, this.relativeTargetOrigin, h, M), w && Ch(this.relativeTarget, w) && (this.isProjectionDirty = !1), w || (w = Q()), Tt(w, this.relativeTarget)), v && (this.animationValues = l, bh(l, u, this.latestValues, M, b, g)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = M;
4596
+ const k = D / 1e3;
4597
+ Lr(d.x, r.x, k), Lr(d.y, r.y, k), this.setTargetDelta(d), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Qe(h, this.layout.layoutBox, this.relativeParent.layout.layoutBox), zh(this.relativeTarget, this.relativeTargetOrigin, h, k), x && Ch(this.relativeTarget, x) && (this.isProjectionDirty = !1), x || (x = Q()), Tt(x, this.relativeTarget)), v && (this.animationValues = l, bh(l, u, this.latestValues, k, b, g)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = k;
4598
4598
  }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
4599
4599
  }
4600
4600
  startAnimation(r) {
@@ -4715,8 +4715,8 @@ function Ea({ attachResizeListener: t, defaultParent: e, measureScroll: n, check
4715
4715
  continue;
4716
4716
  const { correct: v, applyTo: S, isCSSVariable: g } = cn[y], b = d === "none" ? l[y] : v(l[y], u);
4717
4717
  if (S) {
4718
- const w = S.length;
4719
- for (let D = 0; D < w; D++)
4718
+ const x = S.length;
4719
+ for (let D = 0; D < x; D++)
4720
4720
  r[S[D]] = b;
4721
4721
  } else
4722
4722
  g ? this.options.visualElement.renderState.vars[y] = b : r[y] = b;
@@ -5085,19 +5085,19 @@ function df({
5085
5085
  onDeny: i
5086
5086
  }) {
5087
5087
  const o = Object.keys(n).length > 0;
5088
- return /* @__PURE__ */ f("div", { className: "bg-stone-100 dark:bg-stone-800 border border-border rounded-lg px-3 py-2.5 my-1.5", children: /* @__PURE__ */ k("div", { className: "flex items-start gap-2", children: [
5089
- /* @__PURE__ */ k("div", { className: "flex-1 min-w-0", children: [
5088
+ return /* @__PURE__ */ f("div", { className: "bg-stone-100 dark:bg-stone-800 border border-border rounded-lg px-3 py-2.5 my-1.5", children: /* @__PURE__ */ M("div", { className: "flex items-start gap-2", children: [
5089
+ /* @__PURE__ */ M("div", { className: "flex-1 min-w-0", children: [
5090
5090
  /* @__PURE__ */ f("div", { className: "flex items-center gap-1.5 mb-1", children: /* @__PURE__ */ f("span", { className: "text-sm font-medium text-foreground", children: t }) }),
5091
- o && /* @__PURE__ */ f("div", { className: "space-y-0.5 mb-1.5", children: Object.entries(n).map(([r, a]) => /* @__PURE__ */ k("div", { className: "flex items-start gap-1.5 text-xs", children: [
5092
- /* @__PURE__ */ k("span", { className: "text-muted-foreground min-w-[60px]", children: [
5091
+ o && /* @__PURE__ */ f("div", { className: "space-y-0.5 mb-1.5", children: Object.entries(n).map(([r, a]) => /* @__PURE__ */ M("div", { className: "flex items-start gap-1.5 text-xs", children: [
5092
+ /* @__PURE__ */ M("span", { className: "text-muted-foreground min-w-[60px]", children: [
5093
5093
  r,
5094
5094
  ":"
5095
5095
  ] }),
5096
5096
  /* @__PURE__ */ f("span", { className: "font-mono text-foreground", children: typeof a == "string" ? a : JSON.stringify(a) })
5097
5097
  ] }, r)) })
5098
5098
  ] }),
5099
- /* @__PURE__ */ k("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
5100
- /* @__PURE__ */ k(
5099
+ /* @__PURE__ */ M("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
5100
+ /* @__PURE__ */ M(
5101
5101
  Rn,
5102
5102
  {
5103
5103
  size: "sm",
@@ -5137,8 +5137,8 @@ function hf({
5137
5137
  const a = Object.fromEntries(
5138
5138
  Object.entries(e).filter(([u]) => !r.includes(u))
5139
5139
  ), c = Object.keys(a).length > 0;
5140
- return /* @__PURE__ */ k("div", { className: "my-1", children: [
5141
- /* @__PURE__ */ k(
5140
+ return /* @__PURE__ */ M("div", { className: "my-1", children: [
5141
+ /* @__PURE__ */ M(
5142
5142
  "button",
5143
5143
  {
5144
5144
  onClick: () => c && o(!i),
@@ -5146,7 +5146,7 @@ function hf({
5146
5146
  children: [
5147
5147
  c && /* @__PURE__ */ f("span", { className: "transition-transform duration-200", children: i ? /* @__PURE__ */ f(lc, { className: "h-3 w-3" }) : /* @__PURE__ */ f(uc, { className: "h-3 w-3" }) }),
5148
5148
  n ? /* @__PURE__ */ f(Nn, { className: "h-3 w-3" }) : s ? /* @__PURE__ */ f(dc, { className: "h-3 w-3" }) : /* @__PURE__ */ f(Kr, { className: "h-3 w-3" }),
5149
- /* @__PURE__ */ k("span", { className: "font-medium", children: [
5149
+ /* @__PURE__ */ M("span", { className: "font-medium", children: [
5150
5150
  n ? "Denied" : s ? "Auto-executed" : "Executed",
5151
5151
  " ",
5152
5152
  t
@@ -5154,8 +5154,8 @@ function hf({
5154
5154
  ]
5155
5155
  }
5156
5156
  ),
5157
- i && c && /* @__PURE__ */ f("div", { className: "mt-1 ml-6 p-2 bg-stone-50 dark:bg-stone-900 rounded-md border border-border", children: /* @__PURE__ */ f("div", { className: "space-y-0.5", children: Object.entries(a).map(([u, l]) => /* @__PURE__ */ k("div", { className: "flex items-start gap-1.5 text-xs", children: [
5158
- /* @__PURE__ */ k("span", { className: "text-muted-foreground min-w-[60px]", children: [
5157
+ i && c && /* @__PURE__ */ f("div", { className: "mt-1 ml-6 p-2 bg-stone-50 dark:bg-stone-900 rounded-md border border-border", children: /* @__PURE__ */ f("div", { className: "space-y-0.5", children: Object.entries(a).map(([u, l]) => /* @__PURE__ */ M("div", { className: "flex items-start gap-1.5 text-xs", children: [
5158
+ /* @__PURE__ */ M("span", { className: "text-muted-foreground min-w-[60px]", children: [
5159
5159
  u,
5160
5160
  ":"
5161
5161
  ] }),
@@ -5298,7 +5298,7 @@ const yf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5298
5298
  }
5299
5299
  );
5300
5300
  }
5301
- ), Sf = (t, e) => t || e === 0 ? /* @__PURE__ */ f(xf, { duration: 1, children: "Thinking..." }) : e === void 0 ? /* @__PURE__ */ f("p", { children: "Thought for a few seconds" }) : /* @__PURE__ */ k("p", { children: [
5301
+ ), Sf = (t, e) => t || e === 0 ? /* @__PURE__ */ f(xf, { duration: 1, children: "Thinking..." }) : e === void 0 ? /* @__PURE__ */ f("p", { children: "Thought for a few seconds" }) : /* @__PURE__ */ M("p", { children: [
5302
5302
  "Thought for ",
5303
5303
  e,
5304
5304
  " seconds"
@@ -5313,7 +5313,7 @@ const yf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5313
5313
  t
5314
5314
  ),
5315
5315
  ...n,
5316
- children: e ?? /* @__PURE__ */ k(Pe, { children: [
5316
+ children: e ?? /* @__PURE__ */ M(Pe, { children: [
5317
5317
  /* @__PURE__ */ f(hc, { className: "size-4" }),
5318
5318
  Sf(s, o),
5319
5319
  /* @__PURE__ */ f(
@@ -5357,8 +5357,8 @@ function Af({ sources: t, citationNumber: e, className: n }) {
5357
5357
  ...r,
5358
5358
  iconInfo: Ur(r.domain)
5359
5359
  }));
5360
- return /* @__PURE__ */ k(Gt, { children: [
5361
- /* @__PURE__ */ f(Xt, { asChild: !0, children: /* @__PURE__ */ k(
5360
+ return /* @__PURE__ */ M(Gt, { children: [
5361
+ /* @__PURE__ */ f(Xt, { asChild: !0, children: /* @__PURE__ */ M(
5362
5362
  "button",
5363
5363
  {
5364
5364
  className: it(
@@ -5385,12 +5385,12 @@ function Af({ sources: t, citationNumber: e, className: n }) {
5385
5385
  {
5386
5386
  side: "top",
5387
5387
  className: "bg-stone-800 dark:bg-stone-900 border border-stone-700 dark:border-stone-600 p-3 max-w-sm z-50 rounded-lg shadow-lg",
5388
- children: /* @__PURE__ */ k("div", { className: "space-y-1.5", children: [
5389
- /* @__PURE__ */ k("div", { className: "text-xs font-semibold text-stone-300 dark:text-stone-200 mb-2 pb-2 border-b border-stone-700 dark:border-stone-600", children: [
5388
+ children: /* @__PURE__ */ M("div", { className: "space-y-1.5", children: [
5389
+ /* @__PURE__ */ M("div", { className: "text-xs font-semibold text-stone-300 dark:text-stone-200 mb-2 pb-2 border-b border-stone-700 dark:border-stone-600", children: [
5390
5390
  "Sources • ",
5391
5391
  o.length
5392
5392
  ] }),
5393
- o.map((r) => /* @__PURE__ */ k(
5393
+ o.map((r) => /* @__PURE__ */ M(
5394
5394
  "a",
5395
5395
  {
5396
5396
  href: r.url,
@@ -5430,14 +5430,14 @@ function Pf({
5430
5430
  }) {
5431
5431
  const r = st(null), [a, c] = F([]);
5432
5432
  _(() => {
5433
- if (!r.current || e.length === 0) {
5433
+ if (!r.current || e.length === 0 || n.size === 0) {
5434
5434
  c([]);
5435
5435
  return;
5436
5436
  }
5437
5437
  const l = setTimeout(() => {
5438
5438
  const d = r.current;
5439
5439
  if (!d) return;
5440
- const h = /\[CITE:(\d+)\]/g, p = document.createTreeWalker(
5440
+ const h = /\[(\d+)\]/g, p = document.createTreeWalker(
5441
5441
  d,
5442
5442
  NodeFilter.SHOW_TEXT,
5443
5443
  null
@@ -5445,30 +5445,44 @@ function Pf({
5445
5445
  let v;
5446
5446
  for (; v = p.nextNode(); )
5447
5447
  if (v.nodeType === Node.TEXT_NODE) {
5448
- const g = v, b = g.textContent || "", w = Array.from(b.matchAll(h));
5449
- w.length > 0 && y.push({ node: g, matches: w });
5448
+ const g = v, b = g.textContent || "";
5449
+ let x = g.parentElement, D = !1;
5450
+ for (; x && x !== d; ) {
5451
+ if (x.tagName === "A" || x.tagName === "CODE" || x.tagName === "PRE") {
5452
+ D = !0;
5453
+ break;
5454
+ }
5455
+ x = x.parentElement;
5456
+ }
5457
+ if (!D) {
5458
+ const C = Array.from(b.matchAll(h)).filter((O) => {
5459
+ const N = parseInt(O[1], 10);
5460
+ return n.has(N);
5461
+ });
5462
+ C.length > 0 && y.push({ node: g, matches: C });
5463
+ }
5450
5464
  }
5451
5465
  const S = [];
5452
5466
  y.forEach(({ node: g, matches: b }) => {
5453
- const w = g.textContent || "", D = document.createDocumentFragment();
5454
- let M = 0;
5455
- b.forEach((A) => {
5456
- A.index !== void 0 && A.index > M && D.appendChild(document.createTextNode(w.slice(M, A.index)));
5457
- const L = document.createElement("span");
5458
- L.className = "inline-flex items-center citation-button-container";
5459
- const N = parseInt(A[1], 10);
5460
- L.setAttribute("data-citation", A[1]), D.appendChild(L), S.push({ element: L, citationNum: N }), M = (A.index || 0) + A[0].length;
5461
- }), M < w.length && D.appendChild(document.createTextNode(w.slice(M))), g.parentNode && g.parentNode.replaceChild(D, g);
5467
+ const x = g.textContent || "", D = document.createDocumentFragment();
5468
+ let k = 0;
5469
+ b.forEach((C) => {
5470
+ C.index !== void 0 && C.index > k && D.appendChild(document.createTextNode(x.slice(k, C.index)));
5471
+ const O = document.createElement("span");
5472
+ O.className = "inline-flex items-center citation-button-container";
5473
+ const N = parseInt(C[1], 10);
5474
+ O.setAttribute("data-citation", C[1]), D.appendChild(O), S.push({ element: O, citationNum: N }), k = (C.index || 0) + C[0].length;
5475
+ }), k < x.length && D.appendChild(document.createTextNode(x.slice(k))), g.parentNode && g.parentNode.replaceChild(D, g);
5462
5476
  }), c(S);
5463
- }, 200);
5477
+ }, 300);
5464
5478
  return () => {
5465
5479
  clearTimeout(l);
5466
5480
  };
5467
- }, [t, e]);
5468
- const u = s ? /* @__PURE__ */ k("div", { className: "mt-4 pt-4 border-t border-stone-200 dark:border-stone-700", children: [
5481
+ }, [t, e, n]);
5482
+ const u = s ? /* @__PURE__ */ M("div", { className: "mt-4 pt-4 border-t border-stone-200 dark:border-stone-700", children: [
5469
5483
  /* @__PURE__ */ f("div", { className: "text-xs font-semibold text-stone-600 dark:text-stone-400 mb-2", children: "References" }),
5470
- /* @__PURE__ */ f("div", { className: "text-xs text-stone-600 dark:text-stone-400 space-y-1", children: Array.from(n.entries()).sort(([l], [d]) => l - d).map(([l, d]) => /* @__PURE__ */ k("div", { className: "flex items-start gap-2", children: [
5471
- /* @__PURE__ */ k("span", { className: "font-medium", children: [
5484
+ /* @__PURE__ */ f("div", { className: "text-xs text-stone-600 dark:text-stone-400 space-y-1", children: Array.from(n.entries()).sort(([l], [d]) => l - d).map(([l, d]) => /* @__PURE__ */ M("div", { className: "flex items-start gap-2", children: [
5485
+ /* @__PURE__ */ M("span", { className: "font-medium", children: [
5472
5486
  "[",
5473
5487
  l,
5474
5488
  "]"
@@ -5485,7 +5499,7 @@ function Pf({
5485
5499
  )
5486
5500
  ] }, l)) })
5487
5501
  ] }) : null;
5488
- return /* @__PURE__ */ k("div", { className: o, children: [
5502
+ return /* @__PURE__ */ M("div", { className: o, children: [
5489
5503
  /* @__PURE__ */ f("div", { ref: r, children: /* @__PURE__ */ f(i, { children: t }) }),
5490
5504
  a.map(({ element: l, citationNum: d }, h) => e.find((y) => y.number === d) ? Ac(
5491
5505
  /* @__PURE__ */ f(
@@ -5538,20 +5552,10 @@ function Mf(t) {
5538
5552
  if (p.type === "code")
5539
5553
  return p.content;
5540
5554
  let y = p.content;
5541
- y = y.replace(/\[(\d+)\]\((https?:\/\/[^\)]+)\)/g, (w, D, M) => {
5542
- const A = parseInt(D, 10);
5543
- return i.has(A) || (i.set(A, M), o.push({ number: A, url: M })), `[CITE:${A}]`;
5544
- });
5545
- const v = /\[([^\]]+)\]\([^\)]+\)/g, S = [];
5546
- let g;
5547
- for (; (g = v.exec(y)) !== null; )
5548
- S.push({ start: g.index, end: g.index + g[0].length });
5549
- return y.replace(/\[(\d+)\]/g, (w, D, M) => {
5550
- if (S.some((B) => M >= B.start && M < B.end))
5551
- return w;
5552
- const L = parseInt(D, 10);
5553
- return i.get(L) ? `[CITE:${L}]` : w;
5554
- });
5555
+ return y = y.replace(/\[(\d+)\]\((https?:\/\/[^\)]+)\)/g, (S, g, b) => {
5556
+ const x = parseInt(g, 10);
5557
+ return i.has(x) || (i.set(x, b), o.push({ number: x, url: b })), `[${x}]`;
5558
+ }), y;
5555
5559
  }).join(""),
5556
5560
  citations: o.sort((p, y) => p.number - y.number),
5557
5561
  citationMap: i,
@@ -5608,19 +5612,19 @@ function _f({
5608
5612
  user: S,
5609
5613
  state: g,
5610
5614
  onStateChange: b,
5611
- allowStateEdits: w = !0
5615
+ allowStateEdits: x = !0
5612
5616
  }) {
5613
- const [D, M] = F(null), A = st(null), [L, N] = F(null), [B, Z] = F(null), rt = st(null), W = g !== void 0, [ge, Ct] = F({}), lt = st({});
5617
+ const [D, k] = F(null), C = st(null), [O, N] = F(null), [z, Z] = F(null), rt = st(null), W = g !== void 0, [ge, Ct] = F({}), lt = st({});
5614
5618
  W && g ? lt.current = g : W || (lt.current = ge);
5615
- const [Wt, z] = F(!1), [ht, ft] = F(null), mt = st(!1), [pt, Lt] = F(u), [wt, ye] = F(r), [te, ee] = F(600), [Vt, Ot] = F(!1), [H, ve] = F(!1), [xt, ne] = F(!1), [bt, xe] = F({ x: 100, y: 100 }), [Mt, $e] = F(!1), [se, be] = F({ x: 0, y: 0 }), [Wn, we] = F(!1), ie = st(null), Te = st(null), [Se, ze] = F(""), [Ue, _n] = F(null), [Kn, Hn] = F("Thinking..."), [We, P] = F(/* @__PURE__ */ new Set()), [C, R] = F(""), [j, K] = F([]), [U, ot] = F(!1), [jt, re] = F([]), [Nt, _e] = F(() => typeof window < "u" ? crypto.randomUUID() : null), [Ae, pn] = F(!1), [Ef, gn] = F(!1), [Df, yn] = F([]), xi = nn(async (m, x = 3) => {
5616
- if (!Nt || !A.current)
5619
+ const [Wt, $] = F(!1), [ht, ft] = F(null), mt = st(!1), [pt, Lt] = F(u), [wt, ye] = F(r), [te, ee] = F(600), [Vt, Ot] = F(!1), [H, ve] = F(!1), [xt, ne] = F(!1), [bt, xe] = F({ x: 100, y: 100 }), [Mt, $e] = F(!1), [se, be] = F({ x: 0, y: 0 }), [Wn, we] = F(!1), ie = st(null), Te = st(null), [Se, ze] = F(""), [Ue, _n] = F(null), [Kn, Hn] = F("Thinking..."), [We, A] = F(/* @__PURE__ */ new Set()), [P, R] = F(""), [j, K] = F([]), [U, ot] = F(!1), [jt, re] = F([]), [Nt, _e] = F(() => typeof window < "u" ? crypto.randomUUID() : null), [Ae, pn] = F(!1), [Ef, gn] = F(!1), [Df, yn] = F([]), xi = nn(async (m, w = 3) => {
5620
+ if (!Nt || !C.current)
5617
5621
  return;
5618
5622
  const E = async () => {
5619
5623
  const V = `${v.replace("/chat", "").replace(/\/$/, "")}/convex/api/mutation`, I = await fetch(V, {
5620
5624
  method: "POST",
5621
5625
  headers: {
5622
5626
  "Content-Type": "application/json",
5623
- Authorization: `Bearer ${A.current}`
5627
+ Authorization: `Bearer ${C.current}`
5624
5628
  },
5625
5629
  body: JSON.stringify({
5626
5630
  path: "conversations:mergeStateByChatId",
@@ -5637,24 +5641,24 @@ function _f({
5637
5641
  throw new Error(`Failed to sync conversation state: ${I.status} ${tt}`);
5638
5642
  }
5639
5643
  };
5640
- for (let T = 0; T < x; T++)
5644
+ for (let T = 0; T < w; T++)
5641
5645
  try {
5642
5646
  await E(), ft(null);
5643
5647
  return;
5644
5648
  } catch (V) {
5645
- if (T === x - 1) {
5649
+ if (T === w - 1) {
5646
5650
  const tt = V instanceof Error ? V : new Error(String(V));
5647
5651
  throw ft(tt), console.error("Failed to sync state to Convex after retries:", V), tt;
5648
5652
  }
5649
5653
  await new Promise((tt) => setTimeout(tt, Math.pow(2, T) * 100));
5650
5654
  }
5651
- }, [Nt, v, A]), Ke = G(() => function() {
5655
+ }, [Nt, v, C]), Ke = G(() => function() {
5652
5656
  return lt.current;
5653
- }, []), He = G(() => async function(x) {
5654
- const E = { ...lt.current, ...x };
5657
+ }, []), He = G(() => async function(w) {
5658
+ const E = { ...lt.current, ...w };
5655
5659
  lt.current = E, W || Ct(E), b && b(E);
5656
5660
  try {
5657
- await xi(x);
5661
+ await xi(w);
5658
5662
  } catch (T) {
5659
5663
  throw T;
5660
5664
  }
@@ -5668,8 +5672,8 @@ function _f({
5668
5672
  ...d,
5669
5673
  Ke
5670
5674
  ];
5671
- return (!W || w) && m.push(He), m;
5672
- }, [l, d, Ke, He, W, w]), Gn = G(() => Ia(oe, h), [oe, h]), Ft = G(() => {
5675
+ return (!W || x) && m.push(He), m;
5676
+ }, [l, d, Ke, He, W, x]), Gn = G(() => Ia(oe, h), [oe, h]), Ft = G(() => {
5673
5677
  const m = [
5674
5678
  {
5675
5679
  name: "getState",
@@ -5681,7 +5685,7 @@ function _f({
5681
5685
  }
5682
5686
  }
5683
5687
  ];
5684
- return (!W || w) && m.push({
5688
+ return (!W || x) && m.push({
5685
5689
  name: "setState",
5686
5690
  description: "Update the agent state. Store IDs, workflow state, checklists, context, and other data that must persist across conversations. Merges with existing state.",
5687
5691
  jsonSchema: {
@@ -5695,14 +5699,14 @@ function _f({
5695
5699
  required: ["updates"]
5696
5700
  }
5697
5701
  }), [...Gn, ...m];
5698
- }, [Gn, W, w]), bi = G(() => new Set(Ft.map((m) => m.name)), [Ft]), vn = G(() => Ft.filter((m) => m.name === "getState" ? !0 : m.name === "setState" ? !W || w : bi.has(m.name)), [Ft, bi, W, w]), xn = G(() => {
5699
- const m = /* @__PURE__ */ new Map(), x = new Map(Gn.map((E) => [E.name, E]));
5700
- return m.set("getState", Ke), (!W || w) && m.set("setState", He), oe.forEach((E) => {
5702
+ }, [Gn, W, x]), bi = G(() => new Set(Ft.map((m) => m.name)), [Ft]), vn = G(() => Ft.filter((m) => m.name === "getState" ? !0 : m.name === "setState" ? !W || x : bi.has(m.name)), [Ft, bi, W, x]), xn = G(() => {
5703
+ const m = /* @__PURE__ */ new Map(), w = new Map(Gn.map((E) => [E.name, E]));
5704
+ return m.set("getState", Ke), (!W || x) && m.set("setState", He), oe.forEach((E) => {
5701
5705
  if (E === Ke || E === He)
5702
5706
  return;
5703
5707
  const T = E[Bt];
5704
5708
  if (T) {
5705
- const I = x.get(T);
5709
+ const I = w.get(T);
5706
5710
  if (I) {
5707
5711
  m.set(I.name, E);
5708
5712
  return;
@@ -5711,13 +5715,13 @@ function _f({
5711
5715
  const V = Ft.find((I) => I.name === E.name);
5712
5716
  V && m.set(V.name, E);
5713
5717
  }), m;
5714
- }, [oe, Ft, Ke, He, W, w]), Ge = G(() => {
5718
+ }, [oe, Ft, Ke, He, W, x]), Ge = G(() => {
5715
5719
  const m = /* @__PURE__ */ new Set();
5716
5720
  m.add("getState"), m.add("setState");
5717
- const x = new Map(Ft.map((E) => [E.name, E]));
5721
+ const w = new Map(Ft.map((E) => [E.name, E]));
5718
5722
  return d.forEach((E) => {
5719
5723
  const T = E[Bt];
5720
- if (T && x.has(T))
5724
+ if (T && w.has(T))
5721
5725
  m.add(T);
5722
5726
  else {
5723
5727
  const V = Ft.find((I) => I.name === E.name);
@@ -5792,20 +5796,20 @@ function _f({
5792
5796
  if (typeof window < "u") {
5793
5797
  const m = localStorage.getItem("arcten-sidebar-expanded");
5794
5798
  m && Lt(JSON.parse(m));
5795
- const x = localStorage.getItem("arcten-sidebar-width");
5796
- x && ye(parseInt(x));
5799
+ const w = localStorage.getItem("arcten-sidebar-width");
5800
+ w && ye(parseInt(w));
5797
5801
  const E = localStorage.getItem("arcten-sidebar-height");
5798
5802
  E && ee(parseInt(E));
5799
5803
  const T = localStorage.getItem("arcten-sidebar-detached");
5800
5804
  T && ve(JSON.parse(T));
5801
5805
  const V = localStorage.getItem("arcten-sidebar-position");
5802
5806
  if (V) {
5803
- const tt = JSON.parse(V), $ = 50, et = Math.max(
5804
- $ - r,
5805
- Math.min(tt.x, window.innerWidth - $)
5807
+ const tt = JSON.parse(V), B = 50, et = Math.max(
5808
+ B - r,
5809
+ Math.min(tt.x, window.innerWidth - B)
5806
5810
  ), X = Math.max(
5807
5811
  0,
5808
- Math.min(tt.y, window.innerHeight - $)
5812
+ Math.min(tt.y, window.innerHeight - B)
5809
5813
  );
5810
5814
  xe({ x: et, y: X });
5811
5815
  }
@@ -5816,7 +5820,7 @@ function _f({
5816
5820
  const _t = G(() => S, [S?.id]);
5817
5821
  _(() => ((async () => {
5818
5822
  try {
5819
- const x = await fetch(y, {
5823
+ const w = await fetch(y, {
5820
5824
  method: "POST",
5821
5825
  headers: {
5822
5826
  "Content-Type": "application/json"
@@ -5826,19 +5830,19 @@ function _f({
5826
5830
  // Pass full user object
5827
5831
  })
5828
5832
  });
5829
- if (!x.ok)
5833
+ if (!w.ok)
5830
5834
  throw new Error("Failed to fetch token");
5831
- const E = await x.json();
5832
- M(E.clientToken), A.current = E.clientToken, Z(E.expiresAt), N(null);
5833
- } catch (x) {
5834
- N(x instanceof Error ? x.message : "Failed to fetch token");
5835
+ const E = await w.json();
5836
+ k(E.clientToken), C.current = E.clientToken, Z(E.expiresAt), N(null);
5837
+ } catch (w) {
5838
+ N(w instanceof Error ? w.message : "Failed to fetch token");
5835
5839
  }
5836
5840
  })(), () => {
5837
5841
  rt.current && clearTimeout(rt.current);
5838
5842
  }), [y, _t]), _(() => {
5839
- if (!B) return;
5843
+ if (!z) return;
5840
5844
  rt.current && clearTimeout(rt.current);
5841
- const m = Math.floor(Date.now() / 1e3), x = B - m, T = Math.max(0, x - 5);
5845
+ const m = Math.floor(Date.now() / 1e3), w = z - m, T = Math.max(0, w - 5);
5842
5846
  return rt.current = setTimeout(async () => {
5843
5847
  try {
5844
5848
  const V = await fetch(y, {
@@ -5853,31 +5857,31 @@ function _f({
5853
5857
  if (!V.ok)
5854
5858
  throw new Error("Failed to refresh token");
5855
5859
  const I = await V.json();
5856
- M(I.clientToken), A.current = I.clientToken, Z(I.expiresAt), N(null);
5860
+ k(I.clientToken), C.current = I.clientToken, Z(I.expiresAt), N(null);
5857
5861
  } catch (V) {
5858
5862
  console.error("Token refresh failed:", V), N(V instanceof Error ? V.message : "Failed to refresh token");
5859
5863
  }
5860
5864
  }, T * 1e3), () => {
5861
5865
  rt.current && clearTimeout(rt.current);
5862
5866
  };
5863
- }, [B, y, _t]), _(() => {
5867
+ }, [z, y, _t]), _(() => {
5864
5868
  (async () => {
5865
5869
  if (oe.length !== 0)
5866
5870
  try {
5867
- const x = oe.map((T) => ({
5871
+ const w = oe.map((T) => ({
5868
5872
  name: T.name,
5869
5873
  code: T.toString()
5870
5874
  })), E = await fetch(`${v}/tools/describe`, {
5871
5875
  method: "POST",
5872
5876
  headers: { "Content-Type": "application/json" },
5873
- body: JSON.stringify({ tools: x })
5877
+ body: JSON.stringify({ tools: w })
5874
5878
  });
5875
5879
  if (E.ok) {
5876
5880
  const T = await E.json();
5877
5881
  K(T.tools);
5878
5882
  }
5879
- } catch (x) {
5880
- console.error("Failed to fetch tool descriptions:", x);
5883
+ } catch (w) {
5884
+ console.error("Failed to fetch tool descriptions:", w);
5881
5885
  }
5882
5886
  })();
5883
5887
  }, [oe]), _(() => {
@@ -5889,21 +5893,21 @@ function _f({
5889
5893
  R(window.location.pathname);
5890
5894
  };
5891
5895
  m(), window.addEventListener("popstate", m);
5892
- const x = setInterval(m, 500);
5896
+ const w = setInterval(m, 500);
5893
5897
  return () => {
5894
- window.removeEventListener("popstate", m), clearInterval(x);
5898
+ window.removeEventListener("popstate", m), clearInterval(w);
5895
5899
  };
5896
5900
  }, []);
5897
5901
  const Xn = nn(async () => {
5898
5902
  if (!(!_t?.id || !D)) {
5899
5903
  gn(!0);
5900
5904
  try {
5901
- const x = await (await fetch(`${v}/conversations`, {
5905
+ const w = await (await fetch(`${v}/conversations`, {
5902
5906
  headers: {
5903
5907
  Authorization: `Bearer ${D}`
5904
5908
  }
5905
5909
  })).json();
5906
- re(x.conversations || []);
5910
+ re(w.conversations || []);
5907
5911
  } catch (m) {
5908
5912
  console.error("Failed to fetch conversations:", m);
5909
5913
  } finally {
@@ -5915,14 +5919,14 @@ function _f({
5915
5919
  _t?.id && D && Xn();
5916
5920
  }, [_t?.id, D, Xn]);
5917
5921
  function Ba(m) {
5918
- const x = Math.floor((Date.now() - m) / 1e3);
5919
- return x < 60 ? "now" : x < 3600 ? `${Math.floor(x / 60)}m` : x < 86400 ? `${Math.floor(x / 3600)}h` : `${Math.floor(x / 86400)}d`;
5922
+ const w = Math.floor((Date.now() - m) / 1e3);
5923
+ return w < 60 ? "now" : w < 3600 ? `${Math.floor(w / 60)}m` : w < 86400 ? `${Math.floor(w / 3600)}h` : `${Math.floor(w / 86400)}d`;
5920
5924
  }
5921
5925
  function $a() {
5922
5926
  const m = crypto.randomUUID();
5923
5927
  _e(m), wn([]), yn([]), pn(!1);
5924
- const x = W ? g || {} : {};
5925
- lt.current = x, W || Ct(x), b && b(x), mt.current = !1;
5928
+ const w = W ? g || {} : {};
5929
+ lt.current = w, W || Ct(w), b && b(w), mt.current = !1;
5926
5930
  }
5927
5931
  async function za(m) {
5928
5932
  if (D)
@@ -5932,35 +5936,35 @@ function _f({
5932
5936
  headers: {
5933
5937
  Authorization: `Bearer ${D}`
5934
5938
  }
5935
- }), re(jt.filter((x) => x._id !== m)), m === Nt && $a();
5936
- } catch (x) {
5937
- console.error("Failed to delete conversation:", x);
5939
+ }), re(jt.filter((w) => w._id !== m)), m === Nt && $a();
5940
+ } catch (w) {
5941
+ console.error("Failed to delete conversation:", w);
5938
5942
  }
5939
5943
  }
5940
5944
  async function Ua(m) {
5941
5945
  _e(m.chatId), pn(!1), gn(!0);
5942
5946
  try {
5943
- const x = await fetch(`${v}/conversations/${m.chatId}/messages`, {
5947
+ const w = await fetch(`${v}/conversations/${m.chatId}/messages`, {
5944
5948
  headers: {
5945
- Authorization: `Bearer ${A.current}`
5949
+ Authorization: `Bearer ${C.current}`
5946
5950
  }
5947
5951
  });
5948
- if (!x.ok)
5949
- throw new Error(`Failed to fetch messages: ${x.statusText}`);
5950
- const T = (await x.json()).messages || [];
5952
+ if (!w.ok)
5953
+ throw new Error(`Failed to fetch messages: ${w.statusText}`);
5954
+ const T = (await w.json()).messages || [];
5951
5955
  wn(T), yn(T);
5952
- } catch (x) {
5953
- console.error("Failed to load conversation messages:", x);
5956
+ } catch (w) {
5957
+ console.error("Failed to load conversation messages:", w);
5954
5958
  const E = m.messages || [];
5955
5959
  wn(E), yn(E);
5956
5960
  } finally {
5957
5961
  gn(!1);
5958
5962
  }
5959
5963
  }
5960
- const Wa = async (m, x = {}) => {
5961
- const E = x.headers ? new Headers(x.headers) : new Headers();
5964
+ const Wa = async (m, w = {}) => {
5965
+ const E = w.headers ? new Headers(w.headers) : new Headers();
5962
5966
  return E.delete("user-agent"), E.delete("User-Agent"), fetch(m, {
5963
- ...x,
5967
+ ...w,
5964
5968
  headers: E
5965
5969
  });
5966
5970
  }, { messages: Kt, sendMessage: _a, status: Rt, error: Ti, stop: bn, addToolResult: ae, setMessages: wn } = Hr({
@@ -5971,18 +5975,18 @@ function _f({
5971
5975
  fetch: Wa,
5972
5976
  headers: () => {
5973
5977
  const m = {};
5974
- return A.current && (m.Authorization = `Bearer ${A.current}`), m;
5978
+ return C.current && (m.Authorization = `Bearer ${C.current}`), m;
5975
5979
  },
5976
5980
  body: () => ({
5977
- tools: vn.map((x) => ({
5978
- name: x.name,
5979
- description: x.description,
5980
- inputSchema: x.jsonSchema
5981
+ tools: vn.map((w) => ({
5982
+ name: w.name,
5983
+ description: w.description,
5984
+ inputSchema: w.jsonSchema
5981
5985
  // JSON Schema format from build-time
5982
5986
  })),
5983
5987
  systemPrompt: p,
5984
5988
  // Send custom system prompt
5985
- currentRoute: C,
5989
+ currentRoute: P,
5986
5990
  // Send current route for context
5987
5991
  state: lt.current
5988
5992
  // Always include current state
@@ -5995,21 +5999,21 @@ function _f({
5995
5999
  _(() => {
5996
6000
  const m = Kt[Kt.length - 1];
5997
6001
  if (!m || m.role !== "assistant") return;
5998
- const x = m.parts?.filter((E) => E.type?.startsWith("tool-") && E.state === "input-available" && typeof E.toolCallId == "string" && E.input !== void 0) || [];
5999
- for (const E of x) {
6002
+ const w = m.parts?.filter((E) => E.type?.startsWith("tool-") && E.state === "input-available" && typeof E.toolCallId == "string" && E.input !== void 0) || [];
6003
+ for (const E of w) {
6000
6004
  const T = E, V = T.type?.replace("tool-", "") || "", I = T.toolCallId;
6001
6005
  if (Ge.has(V)) {
6002
6006
  if (We.has(I))
6003
6007
  continue;
6004
- P(($) => $.has(I) ? $ : new Set($).add(I)), (async () => {
6008
+ A((B) => B.has(I) ? B : new Set(B).add(I)), (async () => {
6005
6009
  try {
6006
- const $ = xn.get(V);
6007
- if (!$) {
6010
+ const B = xn.get(V);
6011
+ if (!B) {
6008
6012
  console.warn(`[ArctenAgent] Tool ${V} not found in toolsMap. Available tools:`, Array.from(xn.keys())), ae({
6009
6013
  toolCallId: I,
6010
6014
  tool: V,
6011
6015
  output: `Error: Tool ${V} not found`
6012
- }), P((ut) => {
6016
+ }), A((ut) => {
6013
6017
  const Ht = new Set(ut);
6014
6018
  return Ht.delete(I), Ht;
6015
6019
  });
@@ -6019,28 +6023,28 @@ function _f({
6019
6023
  let gt;
6020
6024
  if (X && X.jsonSchema?.properties) {
6021
6025
  const Ht = Object.keys(X.jsonSchema.properties).map((Qa) => et[Qa]);
6022
- console.log(`[ArctenAgent] Executing safe tool ${V} with args:`, Ht), gt = await $(...Ht);
6026
+ console.log(`[ArctenAgent] Executing safe tool ${V} with args:`, Ht), gt = await B(...Ht);
6023
6027
  } else if (V === "getState")
6024
- gt = $();
6028
+ gt = B();
6025
6029
  else if (V === "setState") {
6026
6030
  const ut = et.updates || et;
6027
- gt = await $(ut);
6031
+ gt = await B(ut);
6028
6032
  } else
6029
- gt = await $(...Object.values(et));
6033
+ gt = await B(...Object.values(et));
6030
6034
  console.log(`[ArctenAgent] Tool ${V} completed, result:`, gt), ae({
6031
6035
  toolCallId: I,
6032
6036
  tool: V,
6033
6037
  output: gt
6034
- }), P((ut) => {
6038
+ }), A((ut) => {
6035
6039
  const Ht = new Set(ut);
6036
6040
  return Ht.delete(I), Ht;
6037
6041
  });
6038
- } catch ($) {
6039
- console.error(`[ArctenAgent] Error executing safe tool ${V}:`, $), ae({
6042
+ } catch (B) {
6043
+ console.error(`[ArctenAgent] Error executing safe tool ${V}:`, B), ae({
6040
6044
  toolCallId: I,
6041
6045
  tool: V,
6042
- output: `Error: ${$ instanceof Error ? $.message : String($)}`
6043
- }), P((et) => {
6046
+ output: `Error: ${B instanceof Error ? B.message : String(B)}`
6047
+ }), A((et) => {
6044
6048
  const X = new Set(et);
6045
6049
  return X.delete(I), X;
6046
6050
  });
@@ -6049,15 +6053,15 @@ function _f({
6049
6053
  }
6050
6054
  }
6051
6055
  }, [Kt, Ge, xn, vn, ae]), _(() => {
6052
- if (!Nt || !A.current) return;
6056
+ if (!Nt || !C.current) return;
6053
6057
  (async () => {
6054
- z(!0), ft(null);
6058
+ $(!0), ft(null);
6055
6059
  try {
6056
6060
  const E = `${v.replace("/chat", "").replace(/\/$/, "")}/convex/api/query`, T = await fetch(E, {
6057
6061
  method: "POST",
6058
6062
  headers: {
6059
6063
  "Content-Type": "application/json",
6060
- Authorization: `Bearer ${A.current}`
6064
+ Authorization: `Bearer ${C.current}`
6061
6065
  },
6062
6066
  body: JSON.stringify({
6063
6067
  path: "conversations:getStateByChatId",
@@ -6069,24 +6073,24 @@ function _f({
6069
6073
  if (T.status === 404 || T.status >= 500) {
6070
6074
  console.warn(`[ArctenAgent] Convex API endpoint not available (${T.status}), using empty state`);
6071
6075
  const X = W ? g || {} : {};
6072
- lt.current = X, W || Ct(X), b && b(X), mt.current = !0, z(!1);
6076
+ lt.current = X, W || Ct(X), b && b(X), mt.current = !0, $(!1);
6073
6077
  return;
6074
6078
  }
6075
6079
  const et = await T.text().catch(() => "Unknown error");
6076
6080
  throw new Error(`Failed to fetch conversation state: ${T.status} ${et}`);
6077
6081
  }
6078
6082
  const I = (await T.json())?.value || {}, tt = !mt.current;
6079
- let $;
6080
- tt ? ($ = { ...W ? g || {} : {}, ...I }, mt.current = !0) : $ = I, lt.current = $, W || Ct($), b && b($);
6081
- } catch (x) {
6082
- x instanceof TypeError && x.message.includes("fetch") ? console.warn("[ArctenAgent] Network error fetching state (likely Convex endpoint not available), using fallback state:", x) : console.error("[ArctenAgent] Failed to fetch state:", x);
6083
- const T = x instanceof Error ? x : new Error(String(x));
6083
+ let B;
6084
+ tt ? (B = { ...W ? g || {} : {}, ...I }, mt.current = !0) : B = I, lt.current = B, W || Ct(B), b && b(B);
6085
+ } catch (w) {
6086
+ w instanceof TypeError && w.message.includes("fetch") ? console.warn("[ArctenAgent] Network error fetching state (likely Convex endpoint not available), using fallback state:", w) : console.error("[ArctenAgent] Failed to fetch state:", w);
6087
+ const T = w instanceof Error ? w : new Error(String(w));
6084
6088
  if (ft(T), !mt.current) {
6085
6089
  const V = W ? g || {} : {};
6086
6090
  lt.current = V, W || Ct(V), b && b(V), mt.current = !0;
6087
6091
  }
6088
6092
  } finally {
6089
- z(!1);
6093
+ $(!1);
6090
6094
  }
6091
6095
  })();
6092
6096
  }, [Nt, v, W, g, b]), _(() => {
@@ -6102,8 +6106,8 @@ function _f({
6102
6106
  }, [pt]), _(() => {
6103
6107
  ie.current && ie.current.scrollIntoView({ behavior: "smooth" });
6104
6108
  }, [Kt]), _(() => {
6105
- function m(x) {
6106
- x.key === "Escape" && (Rt === "streaming" || Rt === "submitted") && (x.preventDefault(), bn());
6109
+ function m(w) {
6110
+ w.key === "Escape" && (Rt === "streaming" || Rt === "submitted") && (w.preventDefault(), bn());
6107
6111
  }
6108
6112
  return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
6109
6113
  }, [Rt, bn]);
@@ -6114,12 +6118,12 @@ function _f({
6114
6118
  function Si(m) {
6115
6119
  if (m.preventDefault(), !Se.trim()) return;
6116
6120
  (Rt === "streaming" || Rt === "submitted") && bn();
6117
- const x = wi[Math.floor(Math.random() * wi.length)] || "Thinking...";
6118
- Hn(x), _a({ text: Se }), ze("");
6121
+ const w = wi[Math.floor(Math.random() * wi.length)] || "Thinking...";
6122
+ Hn(w), _a({ text: Se }), ze("");
6119
6123
  }
6120
6124
  function Xa(m) {
6121
- const x = m.target.value;
6122
- ze(x);
6125
+ const w = m.target.value;
6126
+ ze(w);
6123
6127
  }
6124
6128
  _(() => {
6125
6129
  if (!Vt) return;
@@ -6132,11 +6136,11 @@ function _f({
6132
6136
  T >= a && T <= c && ye(T);
6133
6137
  }
6134
6138
  }
6135
- function x() {
6139
+ function w() {
6136
6140
  Ot(!1), localStorage.setItem("arcten-sidebar-width", wt.toString()), localStorage.setItem("arcten-sidebar-height", te.toString());
6137
6141
  }
6138
- return window.addEventListener("mousemove", m), window.addEventListener("mouseup", x), () => {
6139
- window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", x);
6142
+ return window.addEventListener("mousemove", m), window.addEventListener("mouseup", w), () => {
6143
+ window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", w);
6140
6144
  };
6141
6145
  }, [Vt, wt, te, H, bt, a, c]);
6142
6146
  function Ya(m) {
@@ -6160,31 +6164,31 @@ function _f({
6160
6164
  return _(() => {
6161
6165
  if (!H) return;
6162
6166
  function m() {
6163
- xe((x) => {
6164
- const T = window.innerWidth - 50, V = window.innerHeight - 50, I = 50 - wt, tt = 0, $ = Math.max(I, Math.min(x.x, T)), et = Math.max(tt, Math.min(x.y, V));
6165
- if ($ !== x.x || et !== x.y) {
6166
- const X = { x: $, y: et };
6167
+ xe((w) => {
6168
+ const T = window.innerWidth - 50, V = window.innerHeight - 50, I = 50 - wt, tt = 0, B = Math.max(I, Math.min(w.x, T)), et = Math.max(tt, Math.min(w.y, V));
6169
+ if (B !== w.x || et !== w.y) {
6170
+ const X = { x: B, y: et };
6167
6171
  return localStorage.setItem("arcten-sidebar-position", JSON.stringify(X)), X;
6168
6172
  }
6169
- return x;
6173
+ return w;
6170
6174
  });
6171
6175
  }
6172
6176
  return window.addEventListener("resize", m), () => window.removeEventListener("resize", m);
6173
6177
  }, [H, wt]), _(() => {
6174
6178
  if (!Mt) return;
6175
6179
  function m(E) {
6176
- const T = E.clientX - se.x, V = E.clientY - se.y, I = 50, tt = window.innerWidth - I, $ = window.innerHeight - I, et = I - wt, X = 0, gt = Math.max(et, Math.min(T, tt)), ut = Math.max(X, Math.min(V, $));
6180
+ const T = E.clientX - se.x, V = E.clientY - se.y, I = 50, tt = window.innerWidth - I, B = window.innerHeight - I, et = I - wt, X = 0, gt = Math.max(et, Math.min(T, tt)), ut = Math.max(X, Math.min(V, B));
6177
6181
  xe({ x: gt, y: ut });
6178
6182
  }
6179
- function x() {
6183
+ function w() {
6180
6184
  $e(!1), localStorage.setItem("arcten-sidebar-position", JSON.stringify(bt));
6181
6185
  }
6182
- return window.addEventListener("mousemove", m), window.addEventListener("mouseup", x), () => {
6183
- window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", x);
6186
+ return window.addEventListener("mousemove", m), window.addEventListener("mouseup", w), () => {
6187
+ window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", w);
6184
6188
  };
6185
- }, [Mt, se, bt, wt]), Wn ? L ? /* @__PURE__ */ f("div", { className: "fixed right-0 top-0 h-screen w-96 flex items-center justify-center p-4 bg-stone-50 dark:bg-stone-900 border-l border-border", children: /* @__PURE__ */ k("div", { className: "p-4 bg-destructive/10 text-destructive text-sm rounded-lg", children: [
6189
+ }, [Mt, se, bt, wt]), Wn ? O ? /* @__PURE__ */ f("div", { className: "fixed right-0 top-0 h-screen w-96 flex items-center justify-center p-4 bg-stone-50 dark:bg-stone-900 border-l border-border", children: /* @__PURE__ */ M("div", { className: "p-4 bg-destructive/10 text-destructive text-sm rounded-lg", children: [
6186
6190
  "Authentication error: ",
6187
- L
6191
+ O
6188
6192
  ] }) }) : D ? /* @__PURE__ */ f(Vu, { features: cf, children: /* @__PURE__ */ f(
6189
6193
  Cn,
6190
6194
  {
@@ -6208,7 +6212,7 @@ function _f({
6208
6212
  top: `${bt.y}px`
6209
6213
  } : { width: `${wt}px` } : void 0,
6210
6214
  onClick: pt ? void 0 : Ka,
6211
- children: pt ? /* @__PURE__ */ k(Pe, { children: [
6215
+ children: pt ? /* @__PURE__ */ M(Pe, { children: [
6212
6216
  !H && /* @__PURE__ */ f(
6213
6217
  "div",
6214
6218
  {
@@ -6217,7 +6221,7 @@ function _f({
6217
6221
  children: /* @__PURE__ */ f("div", { className: "absolute left-0 top-0 bottom-0 w-3 -translate-x-1" })
6218
6222
  }
6219
6223
  ),
6220
- H && /* @__PURE__ */ k(Pe, { children: [
6224
+ H && /* @__PURE__ */ M(Pe, { children: [
6221
6225
  /* @__PURE__ */ f(
6222
6226
  "div",
6223
6227
  {
@@ -6250,8 +6254,8 @@ function _f({
6250
6254
  }
6251
6255
  )
6252
6256
  ] }),
6253
- /* @__PURE__ */ k("div", { className: "flex flex-col h-full", children: [
6254
- /* @__PURE__ */ k(
6257
+ /* @__PURE__ */ M("div", { className: "flex flex-col h-full", children: [
6258
+ /* @__PURE__ */ M(
6255
6259
  "div",
6256
6260
  {
6257
6261
  className: `flex items-center justify-between p-3 border-b border-border ${H ? "cursor-move" : ""}`,
@@ -6267,8 +6271,8 @@ function _f({
6267
6271
  children: i
6268
6272
  }
6269
6273
  ),
6270
- /* @__PURE__ */ k("div", { className: "flex items-center gap-1", onClick: (m) => m.stopPropagation(), children: [
6271
- /* @__PURE__ */ k(Gt, { children: [
6274
+ /* @__PURE__ */ M("div", { className: "flex items-center gap-1", onClick: (m) => m.stopPropagation(), children: [
6275
+ /* @__PURE__ */ M(Gt, { children: [
6272
6276
  /* @__PURE__ */ f(Xt, { asChild: !0, children: /* @__PURE__ */ f(
6273
6277
  "button",
6274
6278
  {
@@ -6281,7 +6285,7 @@ function _f({
6281
6285
  ) }),
6282
6286
  /* @__PURE__ */ f(Yt, { children: "Start a new conversation" })
6283
6287
  ] }),
6284
- /* @__PURE__ */ k(Gt, { children: [
6288
+ /* @__PURE__ */ M(Gt, { children: [
6285
6289
  /* @__PURE__ */ f(Xt, { asChild: !0, children: /* @__PURE__ */ f(
6286
6290
  "button",
6287
6291
  {
@@ -6294,7 +6298,7 @@ function _f({
6294
6298
  ) }),
6295
6299
  /* @__PURE__ */ f(Yt, { children: H ? "Dock to sidebar" : "Undock to floating window" })
6296
6300
  ] }),
6297
- /* @__PURE__ */ k(Gt, { children: [
6301
+ /* @__PURE__ */ M(Gt, { children: [
6298
6302
  /* @__PURE__ */ f(Xt, { asChild: !0, children: /* @__PURE__ */ f(
6299
6303
  "button",
6300
6304
  {
@@ -6311,9 +6315,9 @@ function _f({
6311
6315
  ]
6312
6316
  }
6313
6317
  ),
6314
- !xt && /* @__PURE__ */ k(Pe, { children: [
6315
- S && jt.length > 0 && /* @__PURE__ */ k("div", { className: `border-b border-border ${Ae ? "flex flex-col flex-1" : ""}`, children: [
6316
- /* @__PURE__ */ k("div", { className: "flex items-center justify-between px-3 py-1", children: [
6318
+ !xt && /* @__PURE__ */ M(Pe, { children: [
6319
+ S && jt.length > 0 && /* @__PURE__ */ M("div", { className: `border-b border-border ${Ae ? "flex flex-col flex-1" : ""}`, children: [
6320
+ /* @__PURE__ */ M("div", { className: "flex items-center justify-between px-3 py-1", children: [
6317
6321
  /* @__PURE__ */ f("h3", { className: "text-xs font-semibold text-muted-foreground", children: "Recent chats" }),
6318
6322
  /* @__PURE__ */ f(
6319
6323
  Rn,
@@ -6327,8 +6331,8 @@ function _f({
6327
6331
  }
6328
6332
  )
6329
6333
  ] }),
6330
- /* @__PURE__ */ f("div", { className: `px-2 pb-2 space-y-0.5 ${Ae ? "flex-1 overflow-y-auto" : ""}`, children: jt.slice(0, Ae ? void 0 : 3).map((m) => /* @__PURE__ */ k("div", { className: "group relative", children: [
6331
- /* @__PURE__ */ k(
6334
+ /* @__PURE__ */ f("div", { className: `px-2 pb-2 space-y-0.5 ${Ae ? "flex-1 overflow-y-auto" : ""}`, children: jt.slice(0, Ae ? void 0 : 3).map((m) => /* @__PURE__ */ M("div", { className: "group relative", children: [
6335
+ /* @__PURE__ */ M(
6332
6336
  "button",
6333
6337
  {
6334
6338
  type: "button",
@@ -6345,8 +6349,8 @@ function _f({
6345
6349
  {
6346
6350
  type: "button",
6347
6351
  className: "absolute right-2 top-1/2 -translate-y-1/2 h-6 w-6 p-0 hidden group-hover:flex items-center justify-center text-muted-foreground hover:text-foreground rounded-md hover:bg-accent transition-colors",
6348
- onClick: (x) => {
6349
- x.stopPropagation(), za(m._id);
6352
+ onClick: (w) => {
6353
+ w.stopPropagation(), za(m._id);
6350
6354
  },
6351
6355
  "aria-label": "Delete conversation",
6352
6356
  children: /* @__PURE__ */ f(Nn, { className: "h-3 w-3" })
@@ -6354,12 +6358,12 @@ function _f({
6354
6358
  )
6355
6359
  ] }, m._id)) })
6356
6360
  ] }),
6357
- /* @__PURE__ */ k("div", { className: "flex-1 flex flex-col overflow-hidden relative", children: [
6358
- /* @__PURE__ */ f("div", { className: "flex-1 overflow-y-auto p-4 space-y-4 scroll-smooth", children: Kt.length === 0 ? /* @__PURE__ */ k("div", { className: "flex flex-col items-center justify-center h-full", children: [
6361
+ /* @__PURE__ */ M("div", { className: "flex-1 flex flex-col overflow-hidden relative", children: [
6362
+ /* @__PURE__ */ f("div", { className: "flex-1 overflow-y-auto p-4 space-y-4 scroll-smooth", children: Kt.length === 0 ? /* @__PURE__ */ M("div", { className: "flex flex-col items-center justify-center h-full", children: [
6359
6363
  o && /* @__PURE__ */ f("div", { className: "mb-6", children: o }),
6360
6364
  /* @__PURE__ */ f("h3", { className: "text-lg font-semibold text-center mb-2", children: "How can I help you?" }),
6361
- j.length > 0 && /* @__PURE__ */ f("div", { className: "mt-4 px-4 max-w-md mx-auto", children: /* @__PURE__ */ k("div", { className: "flex flex-wrap gap-2 justify-center", children: [
6362
- (U ? j : j.slice(0, 10)).map((m) => /* @__PURE__ */ k(Gt, { children: [
6365
+ j.length > 0 && /* @__PURE__ */ f("div", { className: "mt-4 px-4 max-w-md mx-auto", children: /* @__PURE__ */ M("div", { className: "flex flex-wrap gap-2 justify-center", children: [
6366
+ (U ? j : j.slice(0, 10)).map((m) => /* @__PURE__ */ M(Gt, { children: [
6363
6367
  /* @__PURE__ */ f(Xt, { asChild: !0, children: /* @__PURE__ */ f(
6364
6368
  Yn,
6365
6369
  {
@@ -6371,23 +6375,23 @@ function _f({
6371
6375
  children: m.friendlyName
6372
6376
  }
6373
6377
  ) }),
6374
- /* @__PURE__ */ f(Yt, { children: /* @__PURE__ */ k("div", { className: "max-w-xs", children: [
6378
+ /* @__PURE__ */ f(Yt, { children: /* @__PURE__ */ M("div", { className: "max-w-xs", children: [
6375
6379
  /* @__PURE__ */ f("p", { className: "font-medium", children: m.description }),
6376
- /* @__PURE__ */ k("p", { className: "text-xs text-muted-foreground mt-2", children: [
6380
+ /* @__PURE__ */ M("p", { className: "text-xs text-muted-foreground mt-2", children: [
6377
6381
  /* @__PURE__ */ f("span", { className: "font-medium", children: "Example:" }),
6378
6382
  ' "',
6379
6383
  m.sampleUsage,
6380
6384
  '"'
6381
6385
  ] }),
6382
- m.paramCount > 0 && /* @__PURE__ */ k("p", { className: "text-xs text-muted-foreground mt-1", children: [
6386
+ m.paramCount > 0 && /* @__PURE__ */ M("p", { className: "text-xs text-muted-foreground mt-1", children: [
6383
6387
  /* @__PURE__ */ f("span", { className: "font-medium", children: "Parameters:" }),
6384
6388
  " ",
6385
6389
  m.params.join(", ")
6386
6390
  ] })
6387
6391
  ] }) })
6388
6392
  ] }, m.name)),
6389
- j.length > 10 && !U && /* @__PURE__ */ k(Gt, { children: [
6390
- /* @__PURE__ */ f(Xt, { asChild: !0, children: /* @__PURE__ */ k(
6393
+ j.length > 10 && !U && /* @__PURE__ */ M(Gt, { children: [
6394
+ /* @__PURE__ */ f(Xt, { asChild: !0, children: /* @__PURE__ */ M(
6391
6395
  Yn,
6392
6396
  {
6393
6397
  variant: "secondary",
@@ -6400,10 +6404,10 @@ function _f({
6400
6404
  ]
6401
6405
  }
6402
6406
  ) }),
6403
- /* @__PURE__ */ f(Yt, { children: /* @__PURE__ */ k("div", { className: "max-w-xs", children: [
6407
+ /* @__PURE__ */ f(Yt, { children: /* @__PURE__ */ M("div", { className: "max-w-xs", children: [
6404
6408
  /* @__PURE__ */ f("p", { className: "font-medium mb-2", children: "Additional tools:" }),
6405
- /* @__PURE__ */ f("div", { className: "space-y-1 max-h-64 overflow-y-auto pr-2", children: j.slice(10).map((m) => /* @__PURE__ */ k("div", { children: [
6406
- /* @__PURE__ */ k("span", { className: "font-medium text-xs", children: [
6409
+ /* @__PURE__ */ f("div", { className: "space-y-1 max-h-64 overflow-y-auto pr-2", children: j.slice(10).map((m) => /* @__PURE__ */ M("div", { children: [
6410
+ /* @__PURE__ */ M("span", { className: "font-medium text-xs", children: [
6407
6411
  m.friendlyName,
6408
6412
  ":"
6409
6413
  ] }),
@@ -6422,7 +6426,7 @@ function _f({
6422
6426
  }
6423
6427
  )
6424
6428
  ] }) })
6425
- ] }) : /* @__PURE__ */ k(Pe, { children: [
6429
+ ] }) : /* @__PURE__ */ M(Pe, { children: [
6426
6430
  Kt.map((m) => {
6427
6431
  const E = m.parts.filter((T) => T.type === "text").map((T) => T.text).join("");
6428
6432
  return /* @__PURE__ */ f(
@@ -6444,8 +6448,8 @@ function _f({
6444
6448
  }
6445
6449
  ) : /* @__PURE__ */ f("div", { className: "space-y-2", children: m.parts.map((T, V) => {
6446
6450
  if (T.type?.startsWith("tool-")) {
6447
- const I = T.type?.replace("tool-", "") || "", tt = vn.find((X) => X.name === I), $ = T.state === "input-available", et = T.state === "output-available";
6448
- if ($ && Ge.has(I), $) {
6451
+ const I = T.type?.replace("tool-", "") || "", tt = vn.find((X) => X.name === I), B = T.state === "input-available", et = T.state === "output-available";
6452
+ if (B && Ge.has(I), B) {
6449
6453
  if (Ge.has(I))
6450
6454
  return null;
6451
6455
  const X = ds(T.input);
@@ -6464,7 +6468,7 @@ function _f({
6464
6468
  onApprove: async () => {
6465
6469
  if (We.has(T.toolCallId))
6466
6470
  return;
6467
- P((ut) => new Set(ut).add(T.toolCallId));
6471
+ A((ut) => new Set(ut).add(T.toolCallId));
6468
6472
  const gt = xn.get(I);
6469
6473
  if (gt)
6470
6474
  try {
@@ -6483,7 +6487,7 @@ function _f({
6483
6487
  }
6484
6488
  },
6485
6489
  onDeny: async () => {
6486
- We.has(T.toolCallId) || (P((gt) => new Set(gt).add(T.toolCallId)), ae({
6490
+ We.has(T.toolCallId) || (A((gt) => new Set(gt).add(T.toolCallId)), ae({
6487
6491
  toolCallId: T.toolCallId,
6488
6492
  tool: I,
6489
6493
  output: "User denied tool execution"
@@ -6510,13 +6514,13 @@ function _f({
6510
6514
  return null;
6511
6515
  }
6512
6516
  if (T.type === "text" && T.text && Ue) {
6513
- const { processedText: I, citations: tt, citationMap: $, referencesText: et } = Mf(T.text);
6517
+ const { processedText: I, citations: tt, citationMap: B, referencesText: et } = Mf(T.text);
6514
6518
  return /* @__PURE__ */ f(
6515
6519
  Pf,
6516
6520
  {
6517
6521
  text: I,
6518
6522
  citations: tt,
6519
- citationMap: $,
6523
+ citationMap: B,
6520
6524
  referencesText: et,
6521
6525
  ResponseComponent: Ue,
6522
6526
  className: "text-sm prose prose-sm dark:prose-invert max-w-none"
@@ -6524,7 +6528,7 @@ function _f({
6524
6528
  `${m.id}-${V}`
6525
6529
  );
6526
6530
  }
6527
- return T.type === "reasoning" && T.text ? /* @__PURE__ */ k(
6531
+ return T.type === "reasoning" && T.text ? /* @__PURE__ */ M(
6528
6532
  Oa,
6529
6533
  {
6530
6534
  className: "w-full",
@@ -6545,12 +6549,12 @@ function _f({
6545
6549
  }),
6546
6550
  /* @__PURE__ */ f("div", { ref: ie })
6547
6551
  ] }) }),
6548
- Ti && /* @__PURE__ */ k("div", { className: "px-4 py-2 bg-destructive/10 text-destructive text-xs", children: [
6552
+ Ti && /* @__PURE__ */ M("div", { className: "px-4 py-2 bg-destructive/10 text-destructive text-xs", children: [
6549
6553
  "Error: ",
6550
6554
  Ti.message
6551
6555
  ] }),
6552
- /* @__PURE__ */ k("div", { className: "p-4 border-t border-border relative overflow-visible", children: [
6553
- /* @__PURE__ */ f(Du, { mode: "wait", children: (Rt === "streaming" || Rt === "submitted") && /* @__PURE__ */ k(
6556
+ /* @__PURE__ */ M("div", { className: "p-4 border-t border-border relative overflow-visible", children: [
6557
+ /* @__PURE__ */ f(Du, { mode: "wait", children: (Rt === "streaming" || Rt === "submitted") && /* @__PURE__ */ M(
6554
6558
  Cn,
6555
6559
  {
6556
6560
  initial: { opacity: 0, filter: "blur(4px)", y: 5 },
@@ -6583,7 +6587,7 @@ function _f({
6583
6587
  ]
6584
6588
  }
6585
6589
  ) }),
6586
- /* @__PURE__ */ k("form", { onSubmit: Si, className: "relative", children: [
6590
+ /* @__PURE__ */ M("form", { onSubmit: Si, className: "relative", children: [
6587
6591
  /* @__PURE__ */ f(
6588
6592
  Jr,
6589
6593
  {
@@ -6599,7 +6603,7 @@ function _f({
6599
6603
  }
6600
6604
  }
6601
6605
  ),
6602
- Rt === "streaming" || Rt === "submitted" ? /* @__PURE__ */ k(Gt, { children: [
6606
+ Rt === "streaming" || Rt === "submitted" ? /* @__PURE__ */ M(Gt, { children: [
6603
6607
  /* @__PURE__ */ f(Xt, { asChild: !0, children: /* @__PURE__ */ f(
6604
6608
  "button",
6605
6609
  {
@@ -6609,11 +6613,11 @@ function _f({
6609
6613
  children: /* @__PURE__ */ f(xc, { className: "h-4 w-4" })
6610
6614
  }
6611
6615
  ) }),
6612
- /* @__PURE__ */ k(Yt, { children: [
6616
+ /* @__PURE__ */ M(Yt, { children: [
6613
6617
  /* @__PURE__ */ f(Ci, { children: "Escape" }),
6614
6618
  " to stop"
6615
6619
  ] })
6616
- ] }) : /* @__PURE__ */ k(Gt, { children: [
6620
+ ] }) : /* @__PURE__ */ M(Gt, { children: [
6617
6621
  /* @__PURE__ */ f(Xt, { asChild: !0, children: /* @__PURE__ */ f(
6618
6622
  "button",
6619
6623
  {
@@ -6623,7 +6627,7 @@ function _f({
6623
6627
  children: /* @__PURE__ */ f(bc, { className: "h-4 w-4" })
6624
6628
  }
6625
6629
  ) }),
6626
- /* @__PURE__ */ k(Yt, { children: [
6630
+ /* @__PURE__ */ M(Yt, { children: [
6627
6631
  /* @__PURE__ */ f(Ci, { children: "Enter" }),
6628
6632
  " to send"
6629
6633
  ] })
@@ -6631,7 +6635,7 @@ function _f({
6631
6635
  ] })
6632
6636
  ] })
6633
6637
  ] }),
6634
- /* @__PURE__ */ k(
6638
+ /* @__PURE__ */ M(
6635
6639
  "a",
6636
6640
  {
6637
6641
  href: "https://arcten.com",
@@ -6647,7 +6651,7 @@ function _f({
6647
6651
  )
6648
6652
  ] })
6649
6653
  ] })
6650
- ] }) : /* @__PURE__ */ k("div", { className: "flex flex-col items-center justify-center gap-3 h-full cursor-pointer", children: [
6654
+ ] }) : /* @__PURE__ */ M("div", { className: "flex flex-col items-center justify-center gap-3 h-full cursor-pointer", children: [
6651
6655
  /* @__PURE__ */ f(wc, { className: "h-5 w-5 text-stone-600 dark:text-stone-400" }),
6652
6656
  /* @__PURE__ */ f("span", { className: "text-xs font-medium text-stone-600 dark:text-stone-400 [writing-mode:vertical-lr]", children: "AI agent" })
6653
6657
  ] })
@@ -6701,10 +6705,10 @@ function Kf({
6701
6705
  onFinish: p,
6702
6706
  ragFilters: y
6703
6707
  } = {}) {
6704
- const [v, S] = F(n || null), g = st(n || null), [b, w] = F(null), [D, M] = F(null), A = st(null), [L, N] = F([]), [B, Z] = F(
6708
+ const [v, S] = F(n || null), g = st(n || null), [b, x] = F(null), [D, k] = F(null), C = st(null), [O, N] = F([]), [z, Z] = F(
6705
6709
  l || (typeof window < "u" ? crypto.randomUUID() : null)
6706
- ), [rt, W] = F(!1), [ge, Ct] = F(/* @__PURE__ */ new Set()), [lt, Wt] = F(d), z = st(d), [ht, ft] = F(!1), [mt, pt] = F(null), Lt = st(!1), wt = nn(async (P, C = 3) => {
6707
- if (!B || !g.current)
6710
+ ), [rt, W] = F(!1), [ge, Ct] = F(/* @__PURE__ */ new Set()), [lt, Wt] = F(d), $ = st(d), [ht, ft] = F(!1), [mt, pt] = F(null), Lt = st(!1), wt = nn(async (A, P = 3) => {
6711
+ if (!z || !g.current)
6708
6712
  return;
6709
6713
  const R = async () => {
6710
6714
  const K = `${t.replace("/chat", "").replace(/\/$/, "")}/convex/api/mutation`, U = await fetch(K, {
@@ -6715,7 +6719,7 @@ function Kf({
6715
6719
  },
6716
6720
  body: JSON.stringify({
6717
6721
  path: "conversations:mergeStateByChatId",
6718
- args: { chatId: B, updates: P },
6722
+ args: { chatId: z, updates: A },
6719
6723
  format: "json"
6720
6724
  })
6721
6725
  });
@@ -6728,24 +6732,24 @@ function Kf({
6728
6732
  throw new Error(`Failed to sync conversation state: ${U.status} ${ot}`);
6729
6733
  }
6730
6734
  };
6731
- for (let j = 0; j < C; j++)
6735
+ for (let j = 0; j < P; j++)
6732
6736
  try {
6733
6737
  await R(), pt(null);
6734
6738
  return;
6735
6739
  } catch (K) {
6736
- if (j === C - 1) {
6740
+ if (j === P - 1) {
6737
6741
  const ot = K instanceof Error ? K : new Error(String(K));
6738
6742
  throw pt(ot), console.error("Failed to sync state to Convex after retries:", K), ot;
6739
6743
  }
6740
6744
  await new Promise((ot) => setTimeout(ot, Math.pow(2, j) * 100));
6741
6745
  }
6742
- }, [B, t, g]), ye = G(() => function() {
6743
- return z.current;
6744
- }, []), te = G(() => async function(C) {
6745
- const R = { ...z.current, ...C };
6746
- z.current = R, Wt(R);
6746
+ }, [z, t, g]), ye = G(() => function() {
6747
+ return $.current;
6748
+ }, []), te = G(() => async function(P) {
6749
+ const R = { ...$.current, ...P };
6750
+ $.current = R, Wt(R);
6747
6751
  try {
6748
- await wt(C);
6752
+ await wt(P);
6749
6753
  } catch (j) {
6750
6754
  throw j;
6751
6755
  }
@@ -6755,21 +6759,21 @@ function Kf({
6755
6759
  ye,
6756
6760
  te
6757
6761
  ], [o, r, ye, te]), Vt = G(() => Ia(ee, a), [ee, a]), Ot = G(() => {
6758
- const P = /* @__PURE__ */ new Map(), C = new Map(Vt.map((R) => [R.name, R]));
6762
+ const A = /* @__PURE__ */ new Map(), P = new Map(Vt.map((R) => [R.name, R]));
6759
6763
  return ee.forEach((R) => {
6760
6764
  const j = R[Bt];
6761
6765
  if (j) {
6762
- const U = C.get(j);
6766
+ const U = P.get(j);
6763
6767
  if (U) {
6764
- P.set(U.name, R);
6768
+ A.set(U.name, R);
6765
6769
  return;
6766
6770
  }
6767
6771
  }
6768
6772
  const K = Vt.find((U) => U.name === R.name);
6769
- K && P.set(K.name, R);
6770
- }), P;
6771
- }, [ee, Vt]), H = G(() => new Set(Vt.map((P) => P.name)), [Vt]), ve = G(() => {
6772
- const P = [
6773
+ K && A.set(K.name, R);
6774
+ }), A;
6775
+ }, [ee, Vt]), H = G(() => new Set(Vt.map((A) => A.name)), [Vt]), ve = G(() => {
6776
+ const A = [
6773
6777
  {
6774
6778
  name: "getState",
6775
6779
  description: "Get the current agent state. Returns IDs, workflow state, checklists, and other persistent data.",
@@ -6794,20 +6798,20 @@ function Kf({
6794
6798
  }
6795
6799
  }
6796
6800
  ];
6797
- return [...Vt, ...P];
6798
- }, [Vt]), xt = G(() => ve.filter((P) => P.name === "getState" || P.name === "setState" ? !0 : H.has(P.name)), [ve, H]), ne = G(() => {
6799
- const P = /* @__PURE__ */ new Set();
6800
- return P.add("getState"), P.add("setState"), r.forEach((C) => {
6801
+ return [...Vt, ...A];
6802
+ }, [Vt]), xt = G(() => ve.filter((A) => A.name === "getState" || A.name === "setState" ? !0 : H.has(A.name)), [ve, H]), ne = G(() => {
6803
+ const A = /* @__PURE__ */ new Set();
6804
+ return A.add("getState"), A.add("setState"), r.forEach((P) => {
6801
6805
  for (const [R, j] of Ot.entries())
6802
- if (j === C) {
6803
- P.add(R);
6806
+ if (j === P) {
6807
+ A.add(R);
6804
6808
  break;
6805
6809
  }
6806
- }), P;
6810
+ }), A;
6807
6811
  }, [r, Ot]);
6808
6812
  _(() => s || n ? void 0 : ((async () => {
6809
6813
  try {
6810
- const C = await fetch(e, {
6814
+ const P = await fetch(e, {
6811
6815
  method: "POST",
6812
6816
  headers: {
6813
6817
  "Content-Type": "application/json"
@@ -6816,21 +6820,21 @@ function Kf({
6816
6820
  user: i
6817
6821
  })
6818
6822
  });
6819
- if (!C.ok)
6823
+ if (!P.ok)
6820
6824
  throw new Error("Failed to fetch token");
6821
- const R = await C.json();
6822
- S(R.clientToken), g.current = R.clientToken, M(R.expiresAt), w(null);
6823
- } catch (C) {
6824
- console.error("[useAgent] Token fetch failed:", C), w(C instanceof Error ? C.message : "Failed to fetch token");
6825
+ const R = await P.json();
6826
+ S(R.clientToken), g.current = R.clientToken, k(R.expiresAt), x(null);
6827
+ } catch (P) {
6828
+ console.error("[useAgent] Token fetch failed:", P), x(P instanceof Error ? P.message : "Failed to fetch token");
6825
6829
  }
6826
6830
  })(), () => {
6827
- A.current && clearTimeout(A.current);
6831
+ C.current && clearTimeout(C.current);
6828
6832
  }), [e, JSON.stringify(i), s, n]), _(() => {
6829
6833
  if (!D || s || n)
6830
6834
  return;
6831
- A.current && clearTimeout(A.current);
6832
- const P = Math.floor(Date.now() / 1e3), C = D - P, j = Math.max(0, C - 5);
6833
- return A.current = setTimeout(async () => {
6835
+ C.current && clearTimeout(C.current);
6836
+ const A = Math.floor(Date.now() / 1e3), P = D - A, j = Math.max(0, P - 5);
6837
+ return C.current = setTimeout(async () => {
6834
6838
  try {
6835
6839
  const K = await fetch(e, {
6836
6840
  method: "POST",
@@ -6844,20 +6848,20 @@ function Kf({
6844
6848
  if (!K.ok)
6845
6849
  throw new Error("Failed to refresh token");
6846
6850
  const U = await K.json();
6847
- S(U.clientToken), g.current = U.clientToken, M(U.expiresAt), w(null);
6851
+ S(U.clientToken), g.current = U.clientToken, k(U.expiresAt), x(null);
6848
6852
  } catch (K) {
6849
- console.error("[useAgent] Token refresh failed:", K), w(K instanceof Error ? K.message : "Failed to refresh token");
6853
+ console.error("[useAgent] Token refresh failed:", K), x(K instanceof Error ? K.message : "Failed to refresh token");
6850
6854
  }
6851
6855
  }, j * 1e3), () => {
6852
- A.current && clearTimeout(A.current);
6856
+ C.current && clearTimeout(C.current);
6853
6857
  };
6854
6858
  }, [D, e, JSON.stringify(i), s, n]);
6855
- const bt = async (P, C = {}) => {
6856
- const R = C.headers ? new Headers(C.headers) : new Headers();
6857
- R.delete("user-agent"), R.delete("User-Agent"), console.log("[useAgent] Making request to:", P), console.log("[useAgent] Method:", C.method || "GET"), console.log("[useAgent] Has Authorization header:", R.has("Authorization")), console.log("[useAgent] Client token available:", !!g.current);
6859
+ const bt = async (A, P = {}) => {
6860
+ const R = P.headers ? new Headers(P.headers) : new Headers();
6861
+ R.delete("user-agent"), R.delete("User-Agent"), console.log("[useAgent] Making request to:", A), console.log("[useAgent] Method:", P.method || "GET"), console.log("[useAgent] Has Authorization header:", R.has("Authorization")), console.log("[useAgent] Client token available:", !!g.current);
6858
6862
  try {
6859
- const j = await fetch(P, {
6860
- ...C,
6863
+ const j = await fetch(A, {
6864
+ ...P,
6861
6865
  headers: R
6862
6866
  });
6863
6867
  if (!j.ok) {
@@ -6872,26 +6876,26 @@ function Kf({
6872
6876
  }, xe = `${t}/chat`;
6873
6877
  console.log("[useAgent] Chat API URL:", xe);
6874
6878
  const { messages: Mt, sendMessage: $e, status: se, error: be, stop: Wn, addToolResult: we, setMessages: ie } = Hr({
6875
- id: B || void 0,
6879
+ id: z || void 0,
6876
6880
  messages: u,
6877
6881
  transport: new Xr({
6878
6882
  api: xe,
6879
6883
  fetch: bt,
6880
6884
  headers: () => {
6881
- const P = {};
6882
- return g.current ? (P.Authorization = `Bearer ${g.current}`, console.log("[useAgent] Adding Authorization header with token")) : console.warn("[useAgent] No client token available - request may fail"), P;
6885
+ const A = {};
6886
+ return g.current ? (A.Authorization = `Bearer ${g.current}`, console.log("[useAgent] Adding Authorization header with token")) : console.warn("[useAgent] No client token available - request may fail"), A;
6883
6887
  },
6884
6888
  body: () => {
6885
- const P = xt.map((R) => ({
6889
+ const A = xt.map((R) => ({
6886
6890
  name: R.name,
6887
6891
  description: R.description,
6888
6892
  inputSchema: R.jsonSchema
6889
6893
  // JSON Schema format from build-time
6890
- })), C = P.filter((R) => R.name === "getState" || R.name === "setState").map((R) => R.name);
6891
- return C.length > 0 && console.log("[useAgent] State tools included in tools list sent to AI SDK:", C), {
6892
- tools: P,
6894
+ })), P = A.filter((R) => R.name === "getState" || R.name === "setState").map((R) => R.name);
6895
+ return P.length > 0 && console.log("[useAgent] State tools included in tools list sent to AI SDK:", P), {
6896
+ tools: A,
6893
6897
  systemPrompt: c,
6894
- state: z.current,
6898
+ state: $.current,
6895
6899
  // Always include current state
6896
6900
  ...y && { ragFilters: y }
6897
6901
  };
@@ -6900,13 +6904,13 @@ function Kf({
6900
6904
  sendAutomaticallyWhen: Gr
6901
6905
  });
6902
6906
  _(() => {
6903
- Mt.forEach((P) => {
6904
- P.role === "assistant" && P.parts.forEach((C) => {
6905
- if (!C.type?.startsWith("tool-") || C.state !== "input-available") return;
6906
- const R = C.type.replace("tool-", ""), j = C.toolCallId;
6907
+ Mt.forEach((A) => {
6908
+ A.role === "assistant" && A.parts.forEach((P) => {
6909
+ if (!P.type?.startsWith("tool-") || P.state !== "input-available") return;
6910
+ const R = P.type.replace("tool-", ""), j = P.toolCallId;
6907
6911
  if (ge.has(j)) return;
6908
6912
  Ct((U) => new Set(U).add(j));
6909
- const K = kf(C.input);
6913
+ const K = kf(P.input);
6910
6914
  if (ne.has(R)) {
6911
6915
  const U = Ot.get(R);
6912
6916
  U ? (async () => {
@@ -6945,9 +6949,9 @@ function Kf({
6945
6949
  });
6946
6950
  }, [Mt, ne, Ot, h, we, ge, te, xt]), _(() => {
6947
6951
  if (se === "ready" && Mt.length > 0 && p) {
6948
- const P = Mt[Mt.length - 1];
6949
- P && P.role === "assistant" && p({
6950
- message: P,
6952
+ const A = Mt[Mt.length - 1];
6953
+ A && A.role === "assistant" && p({
6954
+ message: A,
6951
6955
  messages: Mt,
6952
6956
  isAbort: !1,
6953
6957
  isDisconnect: !1,
@@ -6959,14 +6963,14 @@ function Kf({
6959
6963
  if (!(!i?.id || !v)) {
6960
6964
  W(!0);
6961
6965
  try {
6962
- const C = await (await fetch(`${t}/conversations`, {
6966
+ const P = await (await fetch(`${t}/conversations`, {
6963
6967
  headers: {
6964
6968
  Authorization: `Bearer ${v}`
6965
6969
  }
6966
6970
  })).json();
6967
- N(C.conversations || []);
6968
- } catch (P) {
6969
- console.error("Failed to fetch conversations:", P);
6971
+ N(P.conversations || []);
6972
+ } catch (A) {
6973
+ console.error("Failed to fetch conversations:", A);
6970
6974
  } finally {
6971
6975
  W(!1);
6972
6976
  }
@@ -6975,11 +6979,11 @@ function Kf({
6975
6979
  _(() => {
6976
6980
  i?.id && v && Te();
6977
6981
  }, [JSON.stringify(i), v, t]), _(() => {
6978
- if (!B || !g.current) return;
6982
+ if (!z || !g.current) return;
6979
6983
  (async () => {
6980
6984
  ft(!0), pt(null);
6981
6985
  try {
6982
- const C = await fetch(`${t.replace("/chat", "")}/convex/api/query`, {
6986
+ const P = await fetch(`${t.replace("/chat", "")}/convex/api/query`, {
6983
6987
  method: "POST",
6984
6988
  headers: {
6985
6989
  "Content-Type": "application/json",
@@ -6987,69 +6991,69 @@ function Kf({
6987
6991
  },
6988
6992
  body: JSON.stringify({
6989
6993
  path: "conversations:getStateByChatId",
6990
- args: { chatId: B },
6994
+ args: { chatId: z },
6991
6995
  format: "json"
6992
6996
  })
6993
6997
  });
6994
- if (!C.ok) {
6995
- const ot = await C.text().catch(() => "Unknown error");
6996
- throw new Error(`Failed to fetch conversation state: ${C.status} ${ot}`);
6998
+ if (!P.ok) {
6999
+ const ot = await P.text().catch(() => "Unknown error");
7000
+ throw new Error(`Failed to fetch conversation state: ${P.status} ${ot}`);
6997
7001
  }
6998
- const j = (await C.json())?.value || {}, K = !Lt.current;
7002
+ const j = (await P.json())?.value || {}, K = !Lt.current;
6999
7003
  let U;
7000
- K ? (U = { ...d, ...j }, Lt.current = !0) : U = j, z.current = U, Wt(U);
7001
- } catch (C) {
7002
- console.error("Failed to fetch state:", C);
7003
- const R = C instanceof Error ? C : new Error(String(C));
7004
- pt(R), Lt.current || (z.current = d, Wt(d), Lt.current = !0);
7004
+ K ? (U = { ...d, ...j }, Lt.current = !0) : U = j, $.current = U, Wt(U);
7005
+ } catch (P) {
7006
+ console.error("Failed to fetch state:", P);
7007
+ const R = P instanceof Error ? P : new Error(String(P));
7008
+ pt(R), Lt.current || ($.current = d, Wt(d), Lt.current = !0);
7005
7009
  } finally {
7006
7010
  ft(!1);
7007
7011
  }
7008
7012
  })();
7009
- }, [B, t]);
7010
- async function Se(P) {
7011
- Z(P), W(!0);
7013
+ }, [z, t]);
7014
+ async function Se(A) {
7015
+ Z(A), W(!0);
7012
7016
  try {
7013
- const C = await fetch(`${t}/conversations/${P}/messages`, {
7017
+ const P = await fetch(`${t}/conversations/${A}/messages`, {
7014
7018
  headers: {
7015
7019
  Authorization: `Bearer ${g.current}`
7016
7020
  }
7017
7021
  });
7018
- if (!C.ok)
7019
- throw new Error(`Failed to fetch messages: ${C.statusText}`);
7020
- const j = (await C.json()).messages || [];
7022
+ if (!P.ok)
7023
+ throw new Error(`Failed to fetch messages: ${P.statusText}`);
7024
+ const j = (await P.json()).messages || [];
7021
7025
  ie(j);
7022
- } catch (C) {
7023
- console.error("Failed to load conversation messages:", C);
7026
+ } catch (P) {
7027
+ console.error("Failed to load conversation messages:", P);
7024
7028
  } finally {
7025
7029
  W(!1);
7026
7030
  }
7027
7031
  }
7028
- async function ze(P) {
7032
+ async function ze(A) {
7029
7033
  if (v)
7030
7034
  try {
7031
- await fetch(`${t}/conversations/${P}`, {
7035
+ await fetch(`${t}/conversations/${A}`, {
7032
7036
  method: "DELETE",
7033
7037
  headers: {
7034
7038
  Authorization: `Bearer ${v}`
7035
7039
  }
7036
- }), N(L.filter((C) => C._id !== P)), P === B && Ue();
7037
- } catch (C) {
7038
- console.error("Failed to delete conversation:", C);
7040
+ }), N(O.filter((P) => P._id !== A)), A === z && Ue();
7041
+ } catch (P) {
7042
+ console.error("Failed to delete conversation:", P);
7039
7043
  }
7040
7044
  }
7041
7045
  function Ue() {
7042
- const P = crypto.randomUUID();
7043
- Z(P), ie([]), Ct(/* @__PURE__ */ new Set()), z.current = d, Wt(d), Lt.current = !1;
7046
+ const A = crypto.randomUUID();
7047
+ Z(A), ie([]), Ct(/* @__PURE__ */ new Set()), $.current = d, Wt(d), Lt.current = !1;
7044
7048
  }
7045
- function _n(P) {
7046
- we(P);
7049
+ function _n(A) {
7050
+ we(A);
7047
7051
  }
7048
- async function Kn(P) {
7049
- const C = { ...z.current, ...P };
7050
- z.current = C, Wt(C);
7052
+ async function Kn(A) {
7053
+ const P = { ...$.current, ...A };
7054
+ $.current = P, Wt(P);
7051
7055
  try {
7052
- await wt(P);
7056
+ await wt(A);
7053
7057
  } catch (R) {
7054
7058
  throw R;
7055
7059
  }
@@ -7057,7 +7061,7 @@ function Kf({
7057
7061
  async function Hn() {
7058
7062
  if (!i?.id || !g.current)
7059
7063
  throw new Error("User authentication required to share state");
7060
- const P = `shared_${crypto.randomUUID()}`;
7064
+ const A = `shared_${crypto.randomUUID()}`;
7061
7065
  try {
7062
7066
  return await fetch(`${t.replace("/chat", "")}/convex/api/mutation`, {
7063
7067
  method: "POST",
@@ -7068,24 +7072,24 @@ function Kf({
7068
7072
  body: JSON.stringify({
7069
7073
  path: "sharedStates:create",
7070
7074
  args: {
7071
- stateId: P,
7072
- state: z.current,
7075
+ stateId: A,
7076
+ state: $.current,
7073
7077
  projectId: "default",
7074
7078
  // TODO: Get from token
7075
7079
  createdBy: i.id
7076
7080
  },
7077
7081
  format: "json"
7078
7082
  })
7079
- }), P;
7080
- } catch (C) {
7081
- throw console.error("Failed to share state:", C), C;
7083
+ }), A;
7084
+ } catch (P) {
7085
+ throw console.error("Failed to share state:", P), P;
7082
7086
  }
7083
7087
  }
7084
- async function We(P) {
7088
+ async function We(A) {
7085
7089
  if (!g.current)
7086
7090
  throw new Error("Authentication required to import state");
7087
7091
  try {
7088
- const C = await fetch(`${t.replace("/chat", "")}/convex/api/query`, {
7092
+ const P = await fetch(`${t.replace("/chat", "")}/convex/api/query`, {
7089
7093
  method: "POST",
7090
7094
  headers: {
7091
7095
  "Content-Type": "application/json",
@@ -7093,20 +7097,20 @@ function Kf({
7093
7097
  },
7094
7098
  body: JSON.stringify({
7095
7099
  path: "sharedStates:getByStateId",
7096
- args: { stateId: P },
7100
+ args: { stateId: A },
7097
7101
  format: "json"
7098
7102
  })
7099
7103
  });
7100
- if (!C.ok)
7104
+ if (!P.ok)
7101
7105
  throw new Error("Failed to fetch shared state");
7102
- const j = (await C.json())?.value || {};
7103
- z.current = j, Wt(j);
7104
- } catch (C) {
7105
- throw console.error("Failed to import state:", C), C;
7106
+ const j = (await P.json())?.value || {};
7107
+ $.current = j, Wt(j);
7108
+ } catch (P) {
7109
+ throw console.error("Failed to import state:", P), P;
7106
7110
  }
7107
7111
  }
7108
7112
  return {
7109
- id: B,
7113
+ id: z,
7110
7114
  messages: Mt,
7111
7115
  status: se,
7112
7116
  error: be,
@@ -7114,7 +7118,7 @@ function Kf({
7114
7118
  stop: Wn,
7115
7119
  addToolOutput: _n,
7116
7120
  setMessages: ie,
7117
- conversations: L,
7121
+ conversations: O,
7118
7122
  loadConversation: Se,
7119
7123
  deleteConversation: ze,
7120
7124
  startNewConversation: Ue,