@arcteninc/core 0.0.36 → 0.0.37

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,6 +1,6 @@
1
1
  import { jsx as f, jsxs as C, Fragment as ee } from "react/jsx-runtime";
2
2
  import * as gt from "react";
3
- import { useImperativeHandle as ka, createContext as Zt, useRef as it, useLayoutEffect as Ea, useEffect as j, useId as ss, useContext as et, useInsertionEffect as yo, useMemo as q, useCallback as vo, Children as Ra, isValidElement as Na, useState as I, Fragment as xo, createElement as Ia, forwardRef as La, Component as Oa, memo as Le, Suspense as Fa, lazy as ja } from "react";
3
+ import { useImperativeHandle as Ea, createContext as Zt, useRef as it, useLayoutEffect as ka, useEffect as j, useId as ss, useContext as et, useInsertionEffect as yo, useMemo as q, useCallback as vo, Children as Ra, isValidElement as Na, useState as I, Fragment as xo, createElement as Ia, forwardRef as La, Component as Oa, memo as Le, Suspense as Fa, lazy as ja } from "react";
4
4
  import { Check as bo, X as en, ChevronDown as Ba, ChevronRight as $a, Zap as za, BrainIcon as Ua, ChevronDownIcon as Wa, Plus as _a, Dock as Ka, PictureInPicture2 as Ha, Maximize2 as Xa, Minimize2 as Ya, Square as Ga, ArrowRight as qa, BotMessageSquare as Za } from "lucide-react";
5
5
  import { useChat as wo } from "@ai-sdk/react";
6
6
  import { lastAssistantMessageIsCompleteWithToolCalls as To, DefaultChatTransport as So } from "ai";
@@ -112,7 +112,7 @@ const el = ({
112
112
  triggerAutoSize: l,
113
113
  maxHeight: t,
114
114
  minHeight: e
115
- }), ka(o, () => ({
115
+ }), Ea(o, () => ({
116
116
  textArea: a.current,
117
117
  focus: () => a?.current?.focus(),
118
118
  maxHeight: t,
@@ -203,7 +203,7 @@ function rs(t) {
203
203
  const e = it(null);
204
204
  return e.current === null && (e.current = t()), e.current;
205
205
  }
206
- const as = typeof window < "u", Mo = as ? Ea : j, cn = /* @__PURE__ */ Zt(null);
206
+ const as = typeof window < "u", Mo = as ? ka : j, cn = /* @__PURE__ */ Zt(null);
207
207
  function ls(t, e) {
208
208
  t.indexOf(e) === -1 && t.push(e);
209
209
  }
@@ -228,7 +228,7 @@ const Ct = {}, Vo = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);
228
228
  function Do(t) {
229
229
  return typeof t == "object" && t !== null;
230
230
  }
231
- const ko = (t) => /^0[^.\s]+$/u.test(t);
231
+ const Eo = (t) => /^0[^.\s]+$/u.test(t);
232
232
  // @__NO_SIDE_EFFECTS__
233
233
  function us(t) {
234
234
  let e;
@@ -264,7 +264,7 @@ class ds {
264
264
  }
265
265
  }
266
266
  const yt = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, ft = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3;
267
- function Eo(t, e) {
267
+ function ko(t, e) {
268
268
  return e ? t * (1e3 / e) : 0;
269
269
  }
270
270
  const ei = /* @__PURE__ */ new Set();
@@ -376,7 +376,7 @@ function Uo(t, e) {
376
376
  };
377
377
  return { schedule: Ke.reduce((x, R) => {
378
378
  const A = o[R];
379
- return x[R] = (k, N = !1, P = !1) => (n || b(), A.schedule(k, N, P)), x;
379
+ return x[R] = (E, N = !1, P = !1) => (n || b(), A.schedule(E, N, P)), x;
380
380
  }, {}), cancel: (x) => {
381
381
  for (let R = 0; R < Ke.length; R++)
382
382
  o[Ke[R]].cancel(x);
@@ -396,7 +396,7 @@ const rt = {
396
396
  test: (t) => typeof t == "number",
397
397
  parse: parseFloat,
398
398
  transform: (t) => t
399
- }, ke = {
399
+ }, Ee = {
400
400
  ...fe,
401
401
  transform: (t) => At(0, 1, t)
402
402
  }, He = {
@@ -422,7 +422,7 @@ const yl = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s
422
422
  }, Xt = {
423
423
  test: /* @__PURE__ */ vs("rgb", "red"),
424
424
  parse: /* @__PURE__ */ _o("red", "green", "blue"),
425
- transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + bn.transform(t) + ", " + bn.transform(e) + ", " + bn.transform(n) + ", " + Pe(ke.transform(s)) + ")"
425
+ transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + bn.transform(t) + ", " + bn.transform(e) + ", " + bn.transform(n) + ", " + Pe(Ee.transform(s)) + ")"
426
426
  };
427
427
  function xl(t) {
428
428
  let e = "", n = "", s = "", i = "";
@@ -448,7 +448,7 @@ const Ln = {
448
448
  }, ne = {
449
449
  test: /* @__PURE__ */ vs("hsl", "hue"),
450
450
  parse: /* @__PURE__ */ _o("hue", "saturation", "lightness"),
451
- transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + Tt.transform(Pe(e)) + ", " + Tt.transform(Pe(n)) + ", " + Pe(ke.transform(s)) + ")"
451
+ transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + Tt.transform(Pe(e)) + ", " + Tt.transform(Pe(n)) + ", " + Pe(Ee.transform(s)) + ")"
452
452
  }, G = {
453
453
  test: (t) => Xt.test(t) || Ln.test(t) || ne.test(t),
454
454
  parse: (t) => Xt.test(t) ? Xt.parse(t) : ne.test(t) ? ne.parse(t) : Ln.parse(t),
@@ -462,7 +462,7 @@ function Sl(t) {
462
462
  return isNaN(t) && typeof t == "string" && (t.match(ys)?.length || 0) + (t.match(Tl)?.length || 0) > 0;
463
463
  }
464
464
  const Ko = "number", Ho = "color", Al = "var", Pl = "var(", oi = "${}", Cl = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
465
- function Ee(t) {
465
+ function ke(t) {
466
466
  const e = t.toString(), n = [], s = {
467
467
  color: [],
468
468
  number: [],
@@ -473,10 +473,10 @@ function Ee(t) {
473
473
  return { values: n, split: a, indexes: s, types: i };
474
474
  }
475
475
  function Xo(t) {
476
- return Ee(t).values;
476
+ return ke(t).values;
477
477
  }
478
478
  function Yo(t) {
479
- const { split: e, types: n } = Ee(t), s = e.length;
479
+ const { split: e, types: n } = ke(t), s = e.length;
480
480
  return (i) => {
481
481
  let r = "";
482
482
  for (let o = 0; o < s; o++)
@@ -523,9 +523,9 @@ function sn(t, e) {
523
523
  const U = (t, e, n) => t + (e - t) * n, Tn = (t, e, n) => {
524
524
  const s = t * t, i = n * (e * e - s) + s;
525
525
  return i < 0 ? 0 : Math.sqrt(i);
526
- }, kl = [Ln, Xt, ne], El = (t) => kl.find((e) => e.test(t));
526
+ }, El = [Ln, Xt, ne], kl = (t) => El.find((e) => e.test(t));
527
527
  function ri(t) {
528
- const e = El(t);
528
+ const e = kl(t);
529
529
  if (he(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !e)
530
530
  return !1;
531
531
  let n = e.parse(t);
@@ -574,7 +574,7 @@ function Ll(t, e) {
574
574
  return n;
575
575
  }
576
576
  const Ol = (t, e) => {
577
- const n = It.createTransformer(e), s = Ee(t), i = Ee(e);
577
+ const n = It.createTransformer(e), s = ke(t), i = ke(e);
578
578
  return s.indexes.var.length === i.indexes.var.length && s.indexes.color.length === i.indexes.color.length && s.indexes.number.length >= i.indexes.number.length ? On.has(t) && !i.values.length || On.has(e) && !s.values.length ? Rl(t, e) : Oe(Go(Ll(s, i), i.values), n) : (he(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different"), sn(t, e));
579
579
  };
580
580
  function qo(t, e, n) {
@@ -617,7 +617,7 @@ function jl(t, e = 100, n) {
617
617
  const Bl = 5;
618
618
  function Jo(t, e, n) {
619
619
  const s = Math.max(e - Bl, 0);
620
- return Eo(n - t(s), e - s);
620
+ return ko(n - t(s), e - s);
621
621
  }
622
622
  const z = {
623
623
  // Default spring physics
@@ -738,36 +738,36 @@ function rn(t = z.visualDuration, e = z.bounce) {
738
738
  let x;
739
739
  if (v < 1) {
740
740
  const A = Fn(y, v);
741
- x = (k) => {
742
- const N = Math.exp(-v * y * k);
743
- return o - N * ((g + v * y * b) / A * Math.sin(A * k) + b * Math.cos(A * k));
741
+ x = (E) => {
742
+ const N = Math.exp(-v * y * E);
743
+ return o - N * ((g + v * y * b) / A * Math.sin(A * E) + b * Math.cos(A * E));
744
744
  };
745
745
  } else if (v === 1)
746
746
  x = (A) => o - Math.exp(-y * A) * (b + (g + y * b) * A);
747
747
  else {
748
748
  const A = y * Math.sqrt(v * v - 1);
749
- x = (k) => {
750
- const N = Math.exp(-v * y * k), P = Math.min(A * k, 300);
749
+ x = (E) => {
750
+ const N = Math.exp(-v * y * E), P = Math.min(A * E, 300);
751
751
  return o - N * ((g + v * y * b) * Math.sinh(P) + A * b * Math.cosh(P)) / A;
752
752
  };
753
753
  }
754
754
  const R = {
755
755
  calculatedDuration: p && d || null,
756
756
  next: (A) => {
757
- const k = x(A);
757
+ const E = x(A);
758
758
  if (p)
759
759
  a.done = A >= d;
760
760
  else {
761
761
  let N = A === 0 ? g : 0;
762
- v < 1 && (N = A === 0 ? /* @__PURE__ */ yt(g) : Jo(x, A, k));
763
- const P = Math.abs(N) <= s, L = Math.abs(o - k) <= i;
762
+ v < 1 && (N = A === 0 ? /* @__PURE__ */ yt(g) : Jo(x, A, E));
763
+ const P = Math.abs(N) <= s, L = Math.abs(o - E) <= i;
764
764
  a.done = P && L;
765
765
  }
766
- return a.value = a.done ? o : k, a;
766
+ return a.value = a.done ? o : E, a;
767
767
  },
768
768
  toString: () => {
769
- const A = Math.min(bs(R), on), k = Zo((N) => R.next(A * N).value, A, 30);
770
- return A + "ms " + k;
769
+ const A = Math.min(bs(R), on), E = Zo((N) => R.next(A * N).value, A, 30);
770
+ return A + "ms " + E;
771
771
  },
772
772
  toTransition: () => {
773
773
  }
@@ -790,9 +790,9 @@ function jn({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 3
790
790
  const L = T(P), K = x(P);
791
791
  h.done = Math.abs(L) <= u, h.value = h.done ? y : K;
792
792
  };
793
- let A, k;
793
+ let A, E;
794
794
  const N = (P) => {
795
- p(h.value) && (A = P, k = rn({
795
+ p(h.value) && (A = P, E = rn({
796
796
  keyframes: [h.value, g(h.value)],
797
797
  velocity: Jo(x, P, h.value),
798
798
  // TODO: This should be passing * 1000
@@ -806,7 +806,7 @@ function jn({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 3
806
806
  calculatedDuration: null,
807
807
  next: (P) => {
808
808
  let L = !1;
809
- return !k && A === void 0 && (L = !0, R(P), N(P)), A !== void 0 && P >= A ? k.next(P - A) : (!L && R(P), h);
809
+ return !E && A === void 0 && (L = !0, R(P), N(P)), A !== void 0 && P >= A ? E.next(P - A) : (!L && R(P), h);
810
810
  }
811
811
  };
812
812
  }
@@ -959,9 +959,9 @@ class Ss extends Ts {
959
959
  }
960
960
  const A = T ? { done: !1, value: c[0] } : R.next(x);
961
961
  r && (A.value = r(A.value));
962
- let { done: k } = A;
963
- !T && l !== null && (k = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0);
964
- const N = this.holdTime === null && (this.state === "finished" || this.state === "running" && k);
962
+ let { done: E } = A;
963
+ !T && l !== null && (E = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0);
964
+ const N = this.holdTime === null && (this.state === "finished" || this.state === "running" && E);
965
965
  return N && g !== jn && (A.value = ws(c, this.options, b, this.speed)), v && v(A.value), N && this.finish(), A;
966
966
  }
967
967
  /**
@@ -1520,9 +1520,9 @@ function Dc(t) {
1520
1520
  const [, n, s, i] = e;
1521
1521
  return [`--${n ?? s}`, i];
1522
1522
  }
1523
- const kc = 4;
1523
+ const Ec = 4;
1524
1524
  function rr(t, e, n = 1) {
1525
- Pt(n <= kc, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
1525
+ Pt(n <= Ec, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
1526
1526
  const [s, i] = Dc(t);
1527
1527
  if (!s)
1528
1528
  return;
@@ -1544,12 +1544,12 @@ const ar = /* @__PURE__ */ new Set([
1544
1544
  "right",
1545
1545
  "bottom",
1546
1546
  ...me
1547
- ]), Ec = {
1547
+ ]), kc = {
1548
1548
  test: (t) => t === "auto",
1549
1549
  parse: (t) => t
1550
- }, lr = (t) => (e) => e.test(t), cr = [fe, M, Tt, Rt, wl, bl, Ec], gi = (t) => cr.find(lr(t));
1550
+ }, lr = (t) => (e) => e.test(t), cr = [fe, M, Tt, Rt, wl, bl, kc], gi = (t) => cr.find(lr(t));
1551
1551
  function Rc(t) {
1552
- return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || ko(t) : !0;
1552
+ return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || Eo(t) : !0;
1553
1553
  }
1554
1554
  const Nc = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
1555
1555
  function Ic(t) {
@@ -1593,7 +1593,7 @@ const Lc = /\b([a-z-]*)\(.*?\)/gu, Xn = {
1593
1593
  z: M,
1594
1594
  perspective: M,
1595
1595
  transformPerspective: M,
1596
- opacity: ke,
1596
+ opacity: Ee,
1597
1597
  originX: ii,
1598
1598
  originY: ii,
1599
1599
  originZ: M
@@ -1636,8 +1636,8 @@ const Lc = /\b([a-z-]*)\(.*?\)/gu, Xn = {
1636
1636
  ...Oc,
1637
1637
  zIndex: yi,
1638
1638
  // SVG
1639
- fillOpacity: ke,
1640
- strokeOpacity: ke,
1639
+ fillOpacity: Ee,
1640
+ strokeOpacity: Ee,
1641
1641
  numOctaves: yi
1642
1642
  }, Fc = {
1643
1643
  ...Cs,
@@ -1665,7 +1665,7 @@ function Bc(t, e, n) {
1665
1665
  let s = 0, i;
1666
1666
  for (; s < t.length && !i; ) {
1667
1667
  const r = t[s];
1668
- typeof r == "string" && !jc.has(r) && Ee(r).values.length && (i = t[s]), s++;
1668
+ typeof r == "string" && !jc.has(r) && ke(r).values.length && (i = t[s]), s++;
1669
1669
  }
1670
1670
  if (i && n)
1671
1671
  for (const r of e)
@@ -1887,7 +1887,7 @@ class Wc {
1887
1887
  if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > vi)
1888
1888
  return 0;
1889
1889
  const n = Math.min(this.updatedAt - this.prevUpdatedAt, vi);
1890
- return Eo(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1890
+ return ko(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1891
1891
  }
1892
1892
  /**
1893
1893
  * Registers a new animation to control this `MotionValue`. Only one
@@ -2169,24 +2169,24 @@ const ou = ({ children: t, custom: e, initial: n = !0, onExitComplete: s, presen
2169
2169
  const [u, c] = vr(o), d = q(() => Si(t), [t]), h = o && !u ? [] : d.map(Xe), p = it(!0), g = it(d), v = rs(() => /* @__PURE__ */ new Map()), [b, y] = I(d), [T, x] = I(d);
2170
2170
  Mo(() => {
2171
2171
  p.current = !1, g.current = d;
2172
- for (let k = 0; k < T.length; k++) {
2173
- const N = Xe(T[k]);
2172
+ for (let E = 0; E < T.length; E++) {
2173
+ const N = Xe(T[E]);
2174
2174
  h.includes(N) ? v.delete(N) : v.get(N) !== !0 && v.set(N, !1);
2175
2175
  }
2176
2176
  }, [T, h.length, h.join("-")]);
2177
2177
  const R = [];
2178
2178
  if (d !== b) {
2179
- let k = [...d];
2179
+ let E = [...d];
2180
2180
  for (let N = 0; N < T.length; N++) {
2181
2181
  const P = T[N], L = Xe(P);
2182
- h.includes(L) || (k.splice(N, 0, P), R.push(P));
2182
+ h.includes(L) || (E.splice(N, 0, P), R.push(P));
2183
2183
  }
2184
- return r === "wait" && R.length && (k = R), x(Si(k)), y(d), null;
2184
+ return r === "wait" && R.length && (E = R), x(Si(E)), y(d), null;
2185
2185
  }
2186
2186
  process.env.NODE_ENV !== "production" && r === "wait" && T.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.`);
2187
2187
  const { forceRender: A } = et(os);
2188
- return f(ee, { children: T.map((k) => {
2189
- const N = Xe(k), P = o && !u ? !1 : d === T || h.includes(N), L = () => {
2188
+ return f(ee, { children: T.map((E) => {
2189
+ const N = Xe(E), P = o && !u ? !1 : d === T || h.includes(N), L = () => {
2190
2190
  if (v.has(N))
2191
2191
  v.set(N, !0);
2192
2192
  else
@@ -2196,9 +2196,9 @@ const ou = ({ children: t, custom: e, initial: n = !0, onExitComplete: s, presen
2196
2196
  W || (K = !1);
2197
2197
  }), K && (A?.(), x(g.current), o && c?.(), s && s());
2198
2198
  };
2199
- return f(su, { isPresent: P, initial: !p.current || n ? void 0 : !1, custom: e, presenceAffectsLayout: i, mode: r, root: l, onExitComplete: P ? void 0 : L, anchorX: a, children: k }, N);
2199
+ return f(su, { isPresent: P, initial: !p.current || n ? void 0 : !1, custom: e, presenceAffectsLayout: i, mode: r, root: l, onExitComplete: P ? void 0 : L, anchorX: a, children: E }, N);
2200
2200
  }) });
2201
- }, ks = Zt({ strict: !1 }), Ai = {
2201
+ }, Es = Zt({ strict: !1 }), Ai = {
2202
2202
  animation: [
2203
2203
  "animate",
2204
2204
  "variants",
@@ -2239,7 +2239,7 @@ function ru({ children: t, features: e, strict: n = !1 }) {
2239
2239
  Pn(e) && e().then(({ renderer: r, ...o }) => {
2240
2240
  Yn(o), i.current = r, s(!0);
2241
2241
  });
2242
- }, []), f(ks.Provider, { value: { renderer: i.current, strict: n }, children: t });
2242
+ }, []), f(Es.Provider, { value: { renderer: i.current, strict: n }, children: t });
2243
2243
  }
2244
2244
  function Pn(t) {
2245
2245
  return typeof t == "function";
@@ -2301,7 +2301,7 @@ function dn(t) {
2301
2301
  function Re(t) {
2302
2302
  return typeof t == "string" || Array.isArray(t);
2303
2303
  }
2304
- const Es = [
2304
+ const ks = [
2305
2305
  "animate",
2306
2306
  "whileInView",
2307
2307
  "whileFocus",
@@ -2309,7 +2309,7 @@ const Es = [
2309
2309
  "whileTap",
2310
2310
  "whileDrag",
2311
2311
  "exit"
2312
- ], Rs = ["initial", ...Es];
2312
+ ], Rs = ["initial", ...ks];
2313
2313
  function hn(t) {
2314
2314
  return dn(t.animate) || Rs.some((e) => Re(t[e]));
2315
2315
  }
@@ -2602,7 +2602,7 @@ const Vu = /* @__PURE__ */ Cr({
2602
2602
  function ie(t) {
2603
2603
  return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
2604
2604
  }
2605
- function ku(t, e, n) {
2605
+ function Eu(t, e, n) {
2606
2606
  return vo(
2607
2607
  (s) => {
2608
2608
  s && t.onMount && t.onMount(s), e && (s ? e.mount(s) : e.unmount()), n && (typeof n == "function" ? n(s) : ie(n) && (n.current = s));
@@ -2614,9 +2614,9 @@ function ku(t, e, n) {
2614
2614
  [e]
2615
2615
  );
2616
2616
  }
2617
- const js = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), Eu = "framerAppearId", Vr = "data-" + js(Eu), Dr = Zt({});
2617
+ const js = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), ku = "framerAppearId", Vr = "data-" + js(ku), Dr = Zt({});
2618
2618
  function Ru(t, e, n, s, i) {
2619
- const { visualElement: r } = et(un), o = et(ks), a = et(cn), l = et(Ds).reducedMotion, u = it(null);
2619
+ const { visualElement: r } = et(un), o = et(Es), a = et(cn), l = et(Ds).reducedMotion, u = it(null);
2620
2620
  s = s || o.renderer, !u.current && s && (u.current = s(t, {
2621
2621
  visualState: e,
2622
2622
  parent: r,
@@ -2642,7 +2642,7 @@ function Ru(t, e, n, s, i) {
2642
2642
  }
2643
2643
  function Nu(t, e, n, s) {
2644
2644
  const { layoutId: i, layout: r, drag: o, dragConstraints: a, layoutScroll: l, layoutRoot: u, layoutCrossfade: c } = e;
2645
- t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : kr(t.parent)), t.projection.setOptions({
2645
+ t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : Er(t.parent)), t.projection.setOptions({
2646
2646
  layoutId: i,
2647
2647
  layout: r,
2648
2648
  alwaysMeasureLayout: !!o || a && ie(a),
@@ -2661,9 +2661,9 @@ function Nu(t, e, n, s) {
2661
2661
  layoutRoot: u
2662
2662
  });
2663
2663
  }
2664
- function kr(t) {
2664
+ function Er(t) {
2665
2665
  if (t)
2666
- return t.options.allowProjection !== !1 ? t.projection : kr(t.parent);
2666
+ return t.options.allowProjection !== !1 ? t.projection : Er(t.parent);
2667
2667
  }
2668
2668
  function Qe(t, { forwardMotionProps: e = !1 } = {}, n, s) {
2669
2669
  n && Yn(n);
@@ -2680,7 +2680,7 @@ function Qe(t, { forwardMotionProps: e = !1 } = {}, n, s) {
2680
2680
  const g = Ou(c);
2681
2681
  u = g.MeasureLayout, h.visualElement = Ru(t, p, c, s, g.ProjectionNode);
2682
2682
  }
2683
- return C(un.Provider, { value: h, children: [u && h.visualElement ? f(u, { visualElement: h.visualElement, ...c }) : null, Au(t, a, ku(p, h.visualElement, l), p, d, e)] });
2683
+ return C(un.Provider, { value: h, children: [u && h.visualElement ? f(u, { visualElement: h.visualElement, ...c }) : null, Au(t, a, Eu(p, h.visualElement, l), p, d, e)] });
2684
2684
  }
2685
2685
  r.displayName = `motion.${typeof t == "string" ? t : `create(${t.displayName ?? t.name ?? ""})`}`;
2686
2686
  const o = La(r);
@@ -2691,7 +2691,7 @@ function Iu({ layoutId: t }) {
2691
2691
  return e && t !== void 0 ? e + "-" + t : t;
2692
2692
  }
2693
2693
  function Lu(t, e) {
2694
- const n = et(ks).strict;
2694
+ const n = et(Es).strict;
2695
2695
  if (process.env.NODE_ENV !== "production" && e && n) {
2696
2696
  const s = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
2697
2697
  t.ignoreStrict ? he(!1, s, "lazy-strict-mode") : Pt(!1, s, "lazy-strict-mode");
@@ -2720,7 +2720,7 @@ function Fu(t, e) {
2720
2720
  get: (r, o) => o === "create" ? s : (n.has(o) || n.set(o, Qe(o, void 0, t, e)), n.get(o))
2721
2721
  });
2722
2722
  }
2723
- function Er({ top: t, left: e, right: n, bottom: s }) {
2723
+ function kr({ top: t, left: e, right: n, bottom: s }) {
2724
2724
  return {
2725
2725
  x: { min: e, max: n },
2726
2726
  y: { min: t, max: s }
@@ -2768,7 +2768,7 @@ function qn(t, e = 0, n = 1, s, i) {
2768
2768
  function Nr(t, { x: e, y: n }) {
2769
2769
  qn(t.x, e.translate, e.scale, e.originPoint), qn(t.y, n.translate, n.scale, n.originPoint);
2770
2770
  }
2771
- const Di = 0.999999999999, ki = 1.0000000000001;
2771
+ const Di = 0.999999999999, Ei = 1.0000000000001;
2772
2772
  function $u(t, e, n, s = !1) {
2773
2773
  const i = n.length;
2774
2774
  if (!i)
@@ -2783,20 +2783,20 @@ function $u(t, e, n, s = !1) {
2783
2783
  y: -r.scroll.offset.y
2784
2784
  }), o && (e.x *= o.x.scale, e.y *= o.y.scale, Nr(t, o)), s && Ht(r.latestValues) && re(t, r.latestValues));
2785
2785
  }
2786
- e.x < ki && e.x > Di && (e.x = 1), e.y < ki && e.y > Di && (e.y = 1);
2786
+ e.x < Ei && e.x > Di && (e.x = 1), e.y < Ei && e.y > Di && (e.y = 1);
2787
2787
  }
2788
2788
  function oe(t, e) {
2789
2789
  t.min = t.min + e, t.max = t.max + e;
2790
2790
  }
2791
- function Ei(t, e, n, s, i = 0.5) {
2791
+ function ki(t, e, n, s, i = 0.5) {
2792
2792
  const r = U(t.min, t.max, i);
2793
2793
  qn(t, e, n, r, s);
2794
2794
  }
2795
2795
  function re(t, e) {
2796
- Ei(t.x, e.x, e.scaleX, e.scale, e.originX), Ei(t.y, e.y, e.scaleY, e.scale, e.originY);
2796
+ ki(t.x, e.x, e.scaleX, e.scale, e.originX), ki(t.y, e.y, e.scaleY, e.scale, e.originY);
2797
2797
  }
2798
2798
  function Ir(t, e) {
2799
- return Er(Bu(t.getBoundingClientRect(), e));
2799
+ return kr(Bu(t.getBoundingClientRect(), e));
2800
2800
  }
2801
2801
  function zu(t, e, n) {
2802
2802
  const s = Ir(t, n), { scroll: i } = e;
@@ -3019,7 +3019,7 @@ class Ku {
3019
3019
  */
3020
3020
  readValue(e, n) {
3021
3021
  let s = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
3022
- return s != null && (typeof s == "string" && (Vo(s) || ko(s)) ? s = parseFloat(s) : !Jc(s) && It.test(n) && (s = dr(e, n)), this.setBaseTarget(e, st(s) ? s.get() : s)), st(s) ? s.get() : s;
3022
+ return s != null && (typeof s == "string" && (Vo(s) || Eo(s)) ? s = parseFloat(s) : !Jc(s) && It.test(n) && (s = dr(e, n)), this.setBaseTarget(e, st(s) ? s.get() : s)), st(s) ? s.get() : s;
3023
3023
  }
3024
3024
  /**
3025
3025
  * Set the base target to later animate back to. This is currently
@@ -3368,7 +3368,7 @@ function _r(t) {
3368
3368
  }
3369
3369
  return e;
3370
3370
  }
3371
- const hd = [...Es].reverse(), fd = Es.length;
3371
+ const hd = [...ks].reverse(), fd = ks.length;
3372
3372
  function md(t) {
3373
3373
  return (e) => Promise.all(e.map(({ animation: n, options: s }) => ud(t, n, s)));
3374
3374
  }
@@ -3391,15 +3391,15 @@ function pd(t) {
3391
3391
  for (let b = 0; b < fd; b++) {
3392
3392
  const y = hd[b], T = n[y], x = u[y] !== void 0 ? u[y] : c[y], R = Re(x), A = y === l ? T.isActive : null;
3393
3393
  A === !1 && (g = b);
3394
- let k = x === c[y] && x !== u[y] && R;
3395
- if (k && s && t.manuallyAnimateOnMount && (k = !1), T.protectedKeys = { ...p }, // If it isn't active and hasn't *just* been set as inactive
3394
+ let E = x === c[y] && x !== u[y] && R;
3395
+ if (E && s && t.manuallyAnimateOnMount && (E = !1), T.protectedKeys = { ...p }, // If it isn't active and hasn't *just* been set as inactive
3396
3396
  !T.isActive && A === null || // If we didn't and don't have any defined prop for this animation type
3397
3397
  !x && !T.prevProp || // Or if the prop doesn't define an animation
3398
3398
  dn(x) || typeof x == "boolean")
3399
3399
  continue;
3400
3400
  const N = gd(T.prevProp, x);
3401
3401
  let P = N || // If we're making this variant active, we want to always make it active
3402
- y === l && T.isActive && !k && R || // If we removed a higher-priority variant (i is in reverse order)
3402
+ y === l && T.isActive && !E && R || // If we removed a higher-priority variant (i is in reverse order)
3403
3403
  b > g && R, L = !1;
3404
3404
  const K = Array.isArray(x) ? x : [x];
3405
3405
  let W = K.reduce(i(y), {});
@@ -3407,31 +3407,31 @@ function pd(t) {
3407
3407
  const { prevResolvedValues: St = {} } = T, Mt = {
3408
3408
  ...St,
3409
3409
  ...W
3410
- }, at = (E) => {
3411
- P = !0, h.has(E) && (L = !0, h.delete(E)), T.needsAnimating[E] = !0;
3412
- const Z = t.getValue(E);
3410
+ }, at = (k) => {
3411
+ P = !0, h.has(k) && (L = !0, h.delete(k)), T.needsAnimating[k] = !0;
3412
+ const Z = t.getValue(k);
3413
3413
  Z && (Z.liveStyle = !1);
3414
3414
  };
3415
- for (const E in Mt) {
3416
- const Z = W[E], X = St[E];
3417
- if (p.hasOwnProperty(E))
3415
+ for (const k in Mt) {
3416
+ const Z = W[k], X = St[k];
3417
+ if (p.hasOwnProperty(k))
3418
3418
  continue;
3419
3419
  let lt = !1;
3420
- Jn(Z) && Jn(X) ? lt = !Wr(Z, X) : lt = Z !== X, lt ? Z != null ? at(E) : h.add(E) : Z !== void 0 && h.has(E) ? at(E) : T.protectedKeys[E] = !0;
3420
+ Jn(Z) && Jn(X) ? lt = !Wr(Z, X) : lt = Z !== X, lt ? Z != null ? at(k) : h.add(k) : Z !== void 0 && h.has(k) ? at(k) : T.protectedKeys[k] = !0;
3421
3421
  }
3422
3422
  T.prevProp = x, T.prevResolvedValues = W, T.isActive && (p = { ...p, ...W }), s && t.blockInitialAnimation && (P = !1);
3423
- const Vt = k && N;
3424
- P && (!Vt || L) && d.push(...K.map((E) => {
3423
+ const Vt = E && N;
3424
+ P && (!Vt || L) && d.push(...K.map((k) => {
3425
3425
  const Z = { type: y };
3426
- if (typeof E == "string" && s && !Vt && t.manuallyAnimateOnMount && t.parent) {
3427
- const { parent: X } = t, lt = ce(X, E);
3426
+ if (typeof k == "string" && s && !Vt && t.manuallyAnimateOnMount && t.parent) {
3427
+ const { parent: X } = t, lt = ce(X, k);
3428
3428
  if (X.enteringChildren && lt) {
3429
3429
  const { delayChildren: _ } = lt.transition || {};
3430
3430
  Z.delay = Ur(X.enteringChildren, t, _);
3431
3431
  }
3432
3432
  }
3433
3433
  return {
3434
- animation: E,
3434
+ animation: k,
3435
3435
  options: Z
3436
3436
  };
3437
3437
  }));
@@ -3678,7 +3678,7 @@ function Dd(t, e) {
3678
3678
  };
3679
3679
  return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o;
3680
3680
  }
3681
- function kd(t, { min: e, max: n }, s) {
3681
+ function Ed(t, { min: e, max: n }, s) {
3682
3682
  return e !== void 0 && t < e ? t = s ? U(e, t, s.min) : Math.max(t, e) : n !== void 0 && t > n && (t = s ? U(n, t, s.max) : Math.min(t, n)), t;
3683
3683
  }
3684
3684
  function zi(t, e, n) {
@@ -3687,7 +3687,7 @@ function zi(t, e, n) {
3687
3687
  max: n !== void 0 ? t.max + n - (t.max - t.min) : void 0
3688
3688
  };
3689
3689
  }
3690
- function Ed(t, { top: e, left: n, bottom: s, right: i }) {
3690
+ function kd(t, { top: e, left: n, bottom: s, right: i }) {
3691
3691
  return {
3692
3692
  x: zi(t.x, n, i),
3693
3693
  y: zi(t.y, e, s)
@@ -3812,11 +3812,11 @@ class Fd {
3812
3812
  return;
3813
3813
  const r = this.getAxisMotionValue(e);
3814
3814
  let o = this.originPoint[e] + s[e];
3815
- this.constraints && this.constraints[e] && (o = kd(o, this.constraints[e], this.elastic[e])), r.set(o);
3815
+ this.constraints && this.constraints[e] && (o = Ed(o, this.constraints[e], this.elastic[e])), r.set(o);
3816
3816
  }
3817
3817
  resolveConstraints() {
3818
3818
  const { dragConstraints: e, dragElastic: n } = this.getProps(), s = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, i = this.constraints;
3819
- e && ie(e) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : e && s ? this.constraints = Ed(s.layoutBox, e) : this.constraints = !1, this.elastic = Ld(n), i !== this.constraints && s && this.constraints && !this.hasMutatedConstraints && ht((r) => {
3819
+ e && ie(e) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : e && s ? this.constraints = kd(s.layoutBox, e) : this.constraints = !1, this.elastic = Ld(n), i !== this.constraints && s && this.constraints && !this.hasMutatedConstraints && ht((r) => {
3820
3820
  this.constraints !== !1 && this.getAxisMotionValue(r) && (this.constraints[r] = Id(s.layoutBox[r], this.constraints[r]));
3821
3821
  });
3822
3822
  }
@@ -3833,7 +3833,7 @@ class Fd {
3833
3833
  let o = Rd(i.layout.layoutBox, r);
3834
3834
  if (n) {
3835
3835
  const a = n(ju(o));
3836
- this.hasMutatedConstraints = !!a, a && (o = Er(a));
3836
+ this.hasMutatedConstraints = !!a, a && (o = kr(a));
3837
3837
  }
3838
3838
  return o;
3839
3839
  }
@@ -4266,9 +4266,9 @@ function sh(t, e, n) {
4266
4266
  const a = t.x.scale * e.x, l = t.y.scale * e.y;
4267
4267
  return (a !== 1 || l !== 1) && (s += `scale(${a}, ${l})`), s || "none";
4268
4268
  }
4269
- const kn = ["", "X", "Y", "Z"], ih = 1e3;
4269
+ const En = ["", "X", "Y", "Z"], ih = 1e3;
4270
4270
  let oh = 0;
4271
- function En(t, e, n, s) {
4271
+ function kn(t, e, n, s) {
4272
4272
  const { latestValues: i } = e;
4273
4273
  i[t] && (n[t] = i[t], e.setStaticValue(t, 0), s && (s[t] = 0));
4274
4274
  }
@@ -4677,9 +4677,9 @@ function sa({ attachResizeListener: t, defaultParent: e, measureScroll: n, check
4677
4677
  if ((l.z || l.rotate || l.rotateX || l.rotateY || l.rotateZ || l.skewX || l.skewY) && (a = !0), !a)
4678
4678
  return;
4679
4679
  const u = {};
4680
- l.z && En("z", o, u, this.animationValues);
4681
- for (let c = 0; c < kn.length; c++)
4682
- En(`rotate${kn[c]}`, o, u, this.animationValues), En(`skew${kn[c]}`, o, u, this.animationValues);
4680
+ l.z && kn("z", o, u, this.animationValues);
4681
+ for (let c = 0; c < En.length; c++)
4682
+ kn(`rotate${En[c]}`, o, u, this.animationValues), kn(`skew${En[c]}`, o, u, this.animationValues);
4683
4683
  o.render();
4684
4684
  for (const c in u)
4685
4685
  o.setStaticValue(c, u[c]), this.animationValues && (this.animationValues[c] = u[c]);
@@ -4944,11 +4944,11 @@ function Dh(t, e, n) {
4944
4944
  ns.delete(t), s.unobserve(t);
4945
4945
  };
4946
4946
  }
4947
- const kh = {
4947
+ const Eh = {
4948
4948
  some: 0,
4949
4949
  all: 1
4950
4950
  };
4951
- class Eh extends Lt {
4951
+ class kh extends Lt {
4952
4952
  constructor() {
4953
4953
  super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
4954
4954
  }
@@ -4957,7 +4957,7 @@ class Eh extends Lt {
4957
4957
  const { viewport: e = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = e, o = {
4958
4958
  root: n ? n.current : void 0,
4959
4959
  rootMargin: s,
4960
- threshold: typeof i == "number" ? i : kh[i]
4960
+ threshold: typeof i == "number" ? i : Eh[i]
4961
4961
  }, a = (l) => {
4962
4962
  const { isIntersecting: u } = l;
4963
4963
  if (this.isInView === u || (this.isInView = u, r && !u && this.hasEnteredView))
@@ -4985,7 +4985,7 @@ function Rh({ viewport: t = {} }, { viewport: e = {} } = {}) {
4985
4985
  }
4986
4986
  const ra = {
4987
4987
  inView: {
4988
- Feature: Eh
4988
+ Feature: kh
4989
4989
  },
4990
4990
  tap: {
4991
4991
  Feature: Ph
@@ -5029,44 +5029,18 @@ Please:
5029
5029
  `
5030
5030
  );
5031
5031
  return t.map((n) => {
5032
- const s = n.name || "unnamed";
5033
- if (!e[s]) {
5034
- const i = n.length > 0, r = i ? `function ${s}(param1: string, param2?: number) { ... }` : `function ${s}() { ... }`, o = i ? `function ${s}(param1, param2) { ... }` : `function ${s}() { ... }`;
5035
- throw new Error(
5036
- `❌ No metadata found for tool "${s}".
5037
-
5038
- This usually means the tool wasn't discovered by the type extraction script.
5039
-
5040
- To fix this:
5041
- ` + (i ? `1. Add TypeScript type annotations to your function parameters:
5042
- ${r}
5043
- // NOT: ${o} ❌
5044
-
5045
- ` : `1. Functions with no parameters are fine! Just make sure:
5046
- - The function is properly defined: ${r}
5047
- - It's used in ArctenAgent or useAgent (see step 2)
5048
-
5049
- `) + `2. Make sure the tool is used in an ArctenAgent or useAgent component:
5050
- <ArctenAgent tools={[${s}]} />
5051
- // or
5052
- useAgent({ tools: [${s}] })
5053
-
5054
- 3. Run the extraction script to generate metadata:
5055
- npx arcten-extract-types .
5056
-
5057
- 4. Import and pass the metadata to your component:
5058
- import { toolMetadata } from './.arcten/tool-metadata';
5059
- useAgent({ tools: [${s}], toolMetadata: toolMetadata.functions })
5060
-
5061
- 💡 Tip: ${i ? "The script can only extract types from functions with explicit TypeScript type annotations on parameters." : "Functions with no parameters work fine - just make sure they're used in ArctenAgent or useAgent."}`
5062
- );
5063
- }
5064
- return {
5032
+ if (typeof n != "function")
5033
+ return null;
5034
+ const s = n.name;
5035
+ return !s || s.trim() === "" ? null : e[s] ? {
5065
5036
  name: s,
5066
5037
  description: e[s].description,
5067
5038
  jsonSchema: e[s].parameters
5068
- };
5069
- });
5039
+ } : (typeof process < "u" && (process.env.NODE_ENV === "development" || process.env.NODE_ENV !== "production") && typeof console < "u" && console.warn && console.warn(
5040
+ `⚠️ [@arcteninc/core] No metadata found for tool "${s}". This tool will be excluded.
5041
+ To fix: Run "arcten-extract-types ." and ensure "${s}" is used in ArctenAgent/useAgent.`
5042
+ ), null);
5043
+ }).filter((n) => n !== null);
5070
5044
  }
5071
5045
  function jh({
5072
5046
  toolName: t,
@@ -5356,7 +5330,7 @@ function df({
5356
5330
  apiBaseUrl: v = "https://api.arcten.com",
5357
5331
  user: b
5358
5332
  }) {
5359
- const [y, T] = I(null), x = it(null), [R, A] = I(null), [k, N] = I(null), P = it(null), [L, K] = I(u), [W, St] = I(o), [Mt, at] = I(600), [Vt, Dt] = I(!1), [E, Z] = I(!1), [X, lt] = I(!1), [_, ge] = I({ x: 100, y: 100 }), [Jt, Ot] = I(!1), [ye, Ft] = I({ x: 0, y: 0 }), [ve, fn] = I(!1), xe = it(null), Qt = it(null), [jt, be] = I(""), [D, V] = I(null), [Y, ct] = I("Thinking..."), [J, ut] = I(/* @__PURE__ */ new Set()), [fa, ma] = I(""), [Bt, pa] = I([]), [mn, zs] = I(!1), [pn, Us] = I([]), [Ws, gn] = I(() => typeof window < "u" ? crypto.randomUUID() : null), [te, $e] = I(!1), [Zh, ze] = I(!1), [Jh, Ue] = I([]), vt = q(() => [...c, ...d], [c, d]), _s = q(() => la(vt, h), [vt, h]), Ks = q(() => new Set(vt.map((m) => m.name)), [vt]), yn = q(() => _s.filter((m) => Ks.has(m.name)), [_s, Ks]), Hs = q(() => {
5333
+ const [y, T] = I(null), x = it(null), [R, A] = I(null), [E, N] = I(null), P = it(null), [L, K] = I(u), [W, St] = I(o), [Mt, at] = I(600), [Vt, Dt] = I(!1), [k, Z] = I(!1), [X, lt] = I(!1), [_, ge] = I({ x: 100, y: 100 }), [Jt, Ot] = I(!1), [ye, Ft] = I({ x: 0, y: 0 }), [ve, fn] = I(!1), xe = it(null), Qt = it(null), [jt, be] = I(""), [D, V] = I(null), [Y, ct] = I("Thinking..."), [J, ut] = I(/* @__PURE__ */ new Set()), [fa, ma] = I(""), [Bt, pa] = I([]), [mn, zs] = I(!1), [pn, Us] = I([]), [Ws, gn] = I(() => typeof window < "u" ? crypto.randomUUID() : null), [te, $e] = I(!1), [Zh, ze] = I(!1), [Jh, Ue] = I([]), vt = q(() => [...c, ...d], [c, d]), _s = q(() => la(vt, h), [vt, h]), Ks = q(() => new Set(vt.map((m) => m.name)), [vt]), yn = q(() => _s.filter((m) => Ks.has(m.name)), [_s, Ks]), Hs = q(() => {
5360
5334
  const m = /* @__PURE__ */ new Map();
5361
5335
  return vt.forEach((w) => m.set(w.name, w)), m;
5362
5336
  }, [vt]), Xs = q(() => new Set(d.map((m) => m.name)), [d]), Ys = [
@@ -5435,14 +5409,14 @@ function df({
5435
5409
  S && Z(JSON.parse(S));
5436
5410
  const $ = localStorage.getItem("arcten-sidebar-position");
5437
5411
  if ($) {
5438
- const kt = JSON.parse($), bt = 50, Et = Math.max(
5412
+ const Et = JSON.parse($), bt = 50, kt = Math.max(
5439
5413
  bt - o,
5440
- Math.min(kt.x, window.innerWidth - bt)
5414
+ Math.min(Et.x, window.innerWidth - bt)
5441
5415
  ), nt = Math.max(
5442
5416
  0,
5443
- Math.min(kt.y, window.innerHeight - bt)
5417
+ Math.min(Et.y, window.innerHeight - bt)
5444
5418
  );
5445
- ge({ x: Et, y: nt });
5419
+ ge({ x: kt, y: nt });
5446
5420
  }
5447
5421
  const F = localStorage.getItem("arcten-sidebar-minimized");
5448
5422
  F && lt(JSON.parse(F)), fn(!0);
@@ -5469,10 +5443,10 @@ function df({
5469
5443
  })(), () => {
5470
5444
  P.current && clearTimeout(P.current);
5471
5445
  }), [g, b]), j(() => {
5472
- if (!k) return;
5446
+ if (!E) return;
5473
5447
  P.current && clearTimeout(P.current);
5474
- const m = Math.floor(Date.now() / 1e3), w = k - m, S = Math.max(0, w - 5);
5475
- return console.log(`Token expires at ${new Date(k * 1e3).toISOString()}`), console.log(`Scheduling token refresh in ${S} seconds`), P.current = setTimeout(async () => {
5448
+ const m = Math.floor(Date.now() / 1e3), w = E - m, S = Math.max(0, w - 5);
5449
+ return console.log(`Token expires at ${new Date(E * 1e3).toISOString()}`), console.log(`Scheduling token refresh in ${S} seconds`), P.current = setTimeout(async () => {
5476
5450
  console.log("Refreshing token...");
5477
5451
  try {
5478
5452
  const $ = await fetch(g, {
@@ -5494,7 +5468,7 @@ function df({
5494
5468
  }, S * 1e3), () => {
5495
5469
  P.current && clearTimeout(P.current);
5496
5470
  };
5497
- }, [k, g, b]), j(() => {
5471
+ }, [E, g, b]), j(() => {
5498
5472
  (async () => {
5499
5473
  if (vt.length !== 0)
5500
5474
  try {
@@ -5665,7 +5639,7 @@ function df({
5665
5639
  j(() => {
5666
5640
  if (!Vt) return;
5667
5641
  function m(O) {
5668
- if (E) {
5642
+ if (k) {
5669
5643
  const S = O.clientX - _.x, $ = O.clientY - _.y;
5670
5644
  S >= a && S <= l && St(S), $ >= 400 && $ <= 1e3 && at($);
5671
5645
  } else {
@@ -5679,7 +5653,7 @@ function df({
5679
5653
  return window.addEventListener("mousemove", m), window.addEventListener("mouseup", w), () => {
5680
5654
  window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", w);
5681
5655
  };
5682
- }, [Vt, W, Mt, E, _, a, l]);
5656
+ }, [Vt, W, Mt, k, _, a, l]);
5683
5657
  function Ca(m) {
5684
5658
  m.preventDefault(), Dt(!0);
5685
5659
  }
@@ -5693,28 +5667,28 @@ function df({
5693
5667
  lt(!X), localStorage.setItem("arcten-sidebar-minimized", JSON.stringify(!X));
5694
5668
  }
5695
5669
  function Da(m) {
5696
- E && (Ot(!0), Ft({
5670
+ k && (Ot(!0), Ft({
5697
5671
  x: m.clientX - _.x,
5698
5672
  y: m.clientY - _.y
5699
5673
  }));
5700
5674
  }
5701
5675
  return j(() => {
5702
- if (!E) return;
5676
+ if (!k) return;
5703
5677
  function m() {
5704
5678
  ge((w) => {
5705
- const S = window.innerWidth - 50, $ = window.innerHeight - 50, F = 50 - W, kt = 0, bt = Math.max(F, Math.min(w.x, S)), Et = Math.max(kt, Math.min(w.y, $));
5706
- if (bt !== w.x || Et !== w.y) {
5707
- const nt = { x: bt, y: Et };
5679
+ const S = window.innerWidth - 50, $ = window.innerHeight - 50, F = 50 - W, Et = 0, bt = Math.max(F, Math.min(w.x, S)), kt = Math.max(Et, Math.min(w.y, $));
5680
+ if (bt !== w.x || kt !== w.y) {
5681
+ const nt = { x: bt, y: kt };
5708
5682
  return localStorage.setItem("arcten-sidebar-position", JSON.stringify(nt)), nt;
5709
5683
  }
5710
5684
  return w;
5711
5685
  });
5712
5686
  }
5713
5687
  return window.addEventListener("resize", m), () => window.removeEventListener("resize", m);
5714
- }, [E, W]), j(() => {
5688
+ }, [k, W]), j(() => {
5715
5689
  if (!Jt) return;
5716
5690
  function m(O) {
5717
- const S = O.clientX - ye.x, $ = O.clientY - ye.y, F = 50, kt = window.innerWidth - F, bt = window.innerHeight - F, Et = F - W, nt = 0, wt = Math.max(Et, Math.min(S, kt)), $t = Math.max(nt, Math.min($, bt));
5691
+ const S = O.clientX - ye.x, $ = O.clientY - ye.y, F = 50, Et = window.innerWidth - F, bt = window.innerHeight - F, kt = F - W, nt = 0, wt = Math.max(kt, Math.min(S, Et)), $t = Math.max(nt, Math.min($, bt));
5718
5692
  ge({ x: wt, y: $t });
5719
5693
  }
5720
5694
  function w() {
@@ -5733,16 +5707,16 @@ function df({
5733
5707
  "data-theme": t,
5734
5708
  "data-layout": e,
5735
5709
  "data-model": n,
5736
- initial: E ? { opacity: 0, scale: 0.95, filter: "blur(4px)" } : !1,
5737
- animate: E ? { opacity: 1, scale: 1, filter: "blur(0px)" } : {},
5710
+ initial: k ? { opacity: 0, scale: 0.95, filter: "blur(4px)" } : !1,
5711
+ animate: k ? { opacity: 1, scale: 1, filter: "blur(0px)" } : {},
5738
5712
  transition: { duration: 0.2, ease: "easeOut" },
5739
5713
  className: `
5740
- ${E ? "fixed z-50 shadow-xl rounded-xl" : "h-screen flex-shrink-0 relative rounded-l-2xl"}
5714
+ ${k ? "fixed z-50 shadow-xl rounded-xl" : "h-screen flex-shrink-0 relative rounded-l-2xl"}
5741
5715
  ${L ? "bg-stone-50 dark:bg-stone-900" : "bg-stone-100 dark:bg-stone-800 hover:bg-stone-200 dark:hover:bg-stone-700 transition-colors duration-200"}
5742
- ${E ? "border border-border" : "border-l border-border"}
5716
+ ${k ? "border border-border" : "border-l border-border"}
5743
5717
  ${L ? "" : "w-[30px]"}
5744
5718
  `,
5745
- style: L ? E ? {
5719
+ style: L ? k ? {
5746
5720
  width: `${W}px`,
5747
5721
  height: X ? "auto" : `${Mt}px`,
5748
5722
  left: `${_.x}px`,
@@ -5750,7 +5724,7 @@ function df({
5750
5724
  } : { width: `${W}px` } : void 0,
5751
5725
  onClick: L ? void 0 : Ta,
5752
5726
  children: L ? /* @__PURE__ */ C(ee, { children: [
5753
- !E && /* @__PURE__ */ f(
5727
+ !k && /* @__PURE__ */ f(
5754
5728
  "div",
5755
5729
  {
5756
5730
  className: "absolute left-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500/40 hover:w-1 transition-all group",
@@ -5758,7 +5732,7 @@ function df({
5758
5732
  children: /* @__PURE__ */ f("div", { className: "absolute left-0 top-0 bottom-0 w-3 -translate-x-1" })
5759
5733
  }
5760
5734
  ),
5761
- E && /* @__PURE__ */ C(ee, { children: [
5735
+ k && /* @__PURE__ */ C(ee, { children: [
5762
5736
  /* @__PURE__ */ f(
5763
5737
  "div",
5764
5738
  {
@@ -5795,14 +5769,14 @@ function df({
5795
5769
  /* @__PURE__ */ C(
5796
5770
  "div",
5797
5771
  {
5798
- className: `flex items-center justify-between p-3 border-b border-border ${E ? "cursor-move" : ""}`,
5799
- onMouseDown: E ? Da : void 0,
5772
+ className: `flex items-center justify-between p-3 border-b border-border ${k ? "cursor-move" : ""}`,
5773
+ onMouseDown: k ? Da : void 0,
5800
5774
  children: [
5801
5775
  /* @__PURE__ */ f(
5802
5776
  "h2",
5803
5777
  {
5804
- className: `text-base font-semibold ${E && X ? "cursor-pointer" : ""}`,
5805
- onClick: E && X ? (m) => {
5778
+ className: `text-base font-semibold ${k && X ? "cursor-pointer" : ""}`,
5779
+ onClick: k && X ? (m) => {
5806
5780
  m.stopPropagation(), Js();
5807
5781
  } : void 0,
5808
5782
  children: i
@@ -5828,12 +5802,12 @@ function df({
5828
5802
  {
5829
5803
  type: "button",
5830
5804
  className: tt(Kt({ variant: "ghost", size: "icon" }), "h-8 w-8"),
5831
- onClick: E ? Va : Ma,
5832
- "aria-label": E ? "Dock sidebar" : "Float sidebar",
5833
- children: E ? /* @__PURE__ */ f(Ka, { className: "h-4 w-4" }) : /* @__PURE__ */ f(Ha, { className: "h-4 w-4" })
5805
+ onClick: k ? Va : Ma,
5806
+ "aria-label": k ? "Dock sidebar" : "Float sidebar",
5807
+ children: k ? /* @__PURE__ */ f(Ka, { className: "h-4 w-4" }) : /* @__PURE__ */ f(Ha, { className: "h-4 w-4" })
5834
5808
  }
5835
5809
  ) }),
5836
- /* @__PURE__ */ f(Wt, { children: E ? "Dock to sidebar" : "Undock to floating window" })
5810
+ /* @__PURE__ */ f(Wt, { children: k ? "Dock to sidebar" : "Undock to floating window" })
5837
5811
  ] }),
5838
5812
  /* @__PURE__ */ C(zt, { children: [
5839
5813
  /* @__PURE__ */ f(Ut, { asChild: !0, children: /* @__PURE__ */ f(
@@ -5841,12 +5815,12 @@ function df({
5841
5815
  {
5842
5816
  type: "button",
5843
5817
  className: tt(Kt({ variant: "ghost", size: "icon" }), "h-8 w-8"),
5844
- onClick: E ? Js : Sa,
5845
- "aria-label": E ? X ? "Maximize" : "Minimize" : "Close sidebar",
5846
- children: E ? X ? /* @__PURE__ */ f(Xa, { className: "h-4 w-4" }) : /* @__PURE__ */ f(Ya, { className: "h-4 w-4" }) : /* @__PURE__ */ f(en, { className: "h-4 w-4" })
5818
+ onClick: k ? Js : Sa,
5819
+ "aria-label": k ? X ? "Maximize" : "Minimize" : "Close sidebar",
5820
+ children: k ? X ? /* @__PURE__ */ f(Xa, { className: "h-4 w-4" }) : /* @__PURE__ */ f(Ya, { className: "h-4 w-4" }) : /* @__PURE__ */ f(en, { className: "h-4 w-4" })
5847
5821
  }
5848
5822
  ) }),
5849
- /* @__PURE__ */ f(Wt, { children: E ? X ? "Maximize window" : "Minimize to header" : "Close the chat" })
5823
+ /* @__PURE__ */ f(Wt, { children: k ? X ? "Maximize window" : "Minimize to header" : "Close the chat" })
5850
5824
  ] })
5851
5825
  ] })
5852
5826
  ]
@@ -5985,7 +5959,7 @@ function df({
5985
5959
  }
5986
5960
  ) : /* @__PURE__ */ f("div", { className: "space-y-2", children: m.parts.map((S, $) => {
5987
5961
  if (S.type?.startsWith("tool-")) {
5988
- const F = S.type?.replace("tool-", "") || "", kt = yn.find((nt) => nt.name === F), bt = S.state === "input-available", Et = S.state === "output-available";
5962
+ const F = S.type?.replace("tool-", "") || "", Et = yn.find((nt) => nt.name === F), bt = S.state === "input-available", kt = S.state === "output-available";
5989
5963
  if (bt)
5990
5964
  return Xs.has(F) ? ((async () => {
5991
5965
  if (J.has(S.toolCallId))
@@ -6018,7 +5992,7 @@ function df({
6018
5992
  jh,
6019
5993
  {
6020
5994
  toolName: F,
6021
- description: kt?.description || "",
5995
+ description: Et?.description || "",
6022
5996
  args: S.input || {},
6023
5997
  onApprove: async () => {
6024
5998
  if (J.has(S.toolCallId)) {
@@ -6059,7 +6033,7 @@ function df({
6059
6033
  },
6060
6034
  `${S.toolCallId}-${$}`
6061
6035
  );
6062
- if (Et) {
6036
+ if (kt) {
6063
6037
  const nt = S.output === "User denied tool execution";
6064
6038
  return /* @__PURE__ */ f(
6065
6039
  Bh,
@@ -6236,9 +6210,9 @@ function hf({
6236
6210
  toolsCount: r.length,
6237
6211
  safeToolsCount: o.length
6238
6212
  });
6239
- const [g, v] = I(n || null), b = it(n || null), [y, T] = I(null), [x, R] = I(null), A = it(null), [k, N] = I([]), [P, L] = I(
6213
+ const [g, v] = I(n || null), b = it(n || null), [y, T] = I(null), [x, R] = I(null), A = it(null), [E, N] = I([]), [P, L] = I(
6240
6214
  c || (typeof window < "u" ? crypto.randomUUID() : null)
6241
- ), [K, W] = I(!1), [St, Mt] = I(/* @__PURE__ */ new Set()), at = q(() => [...r, ...o], [r, o]), Vt = q(() => la(at, a), [at, a]), Dt = q(() => new Set(at.map((D) => D.name)), [at]), E = q(() => Vt.filter((D) => Dt.has(D.name)), [Vt, Dt]), Z = q(() => {
6215
+ ), [K, W] = I(!1), [St, Mt] = I(/* @__PURE__ */ new Set()), at = q(() => [...r, ...o], [r, o]), Vt = q(() => la(at, a), [at, a]), Dt = q(() => new Set(at.map((D) => D.name)), [at]), k = q(() => Vt.filter((D) => Dt.has(D.name)), [Vt, Dt]), Z = q(() => {
6242
6216
  const D = /* @__PURE__ */ new Map();
6243
6217
  return at.forEach((V) => D.set(V.name, V)), D;
6244
6218
  }, [at]), X = q(() => new Set(o.map((D) => D.name)), [o]);
@@ -6342,7 +6316,7 @@ function hf({
6342
6316
  return b.current && (D.Authorization = `Bearer ${b.current}`), D;
6343
6317
  },
6344
6318
  body: () => {
6345
- const D = E.map((V) => ({
6319
+ const D = k.map((V) => ({
6346
6320
  name: V.name,
6347
6321
  description: V.description,
6348
6322
  inputSchema: V.jsonSchema
@@ -6352,7 +6326,7 @@ function hf({
6352
6326
  totalTools: D.length,
6353
6327
  toolNames: D.map((V) => V.name),
6354
6328
  allToolNames: at.map((V) => V.name),
6355
- filteredToolNames: E.map((V) => V.name)
6329
+ filteredToolNames: k.map((V) => V.name)
6356
6330
  }), {
6357
6331
  tools: D,
6358
6332
  systemPrompt: l,
@@ -6455,7 +6429,7 @@ function hf({
6455
6429
  headers: {
6456
6430
  Authorization: `Bearer ${g}`
6457
6431
  }
6458
- }), N(k.filter((V) => V._id !== D)), D === P && jt();
6432
+ }), N(E.filter((V) => V._id !== D)), D === P && jt();
6459
6433
  } catch (V) {
6460
6434
  console.error("Failed to delete conversation:", V);
6461
6435
  }
@@ -6476,7 +6450,7 @@ function hf({
6476
6450
  stop: ye,
6477
6451
  addToolOutput: be,
6478
6452
  setMessages: ve,
6479
- conversations: k,
6453
+ conversations: E,
6480
6454
  loadConversation: xe,
6481
6455
  deleteConversation: Qt,
6482
6456
  startNewConversation: jt,