inline-chat-kit 0.56.0 → 0.58.0

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.
@@ -2,7 +2,7 @@
2
2
  import e, { createContext as t, createElement as n, forwardRef as r, isValidElement as i, memo as a, useCallback as o, useContext as s, useEffect as c, useId as l, useImperativeHandle as u, useLayoutEffect as d, useMemo as f, useRef as p, useState as m, useSyncExternalStore as h } from "react";
3
3
  import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
4
4
  import { AnimatePresence as y, LayoutGroup as b, MotionConfig as x, animate as S, motion as C, useAnimationControls as w, useMotionValue as T, useReducedMotion as E } from "motion/react";
5
- import { ArrowDown as D, ArrowLeft as O, Bookmark as k, Brain as A, Check as j, ChevronDown as M, ChevronLeft as ee, ChevronRight as N, Copy as P, CornerDownLeft as F, File as te, FileText as I, Film as L, Highlighter as ne, Image as re, Link2 as R, Maximize2 as ie, MessageCircle as ae, Mic as oe, Minimize2 as se, Moon as ce, MoreHorizontal as le, Music as ue, Palette as de, Paperclip as fe, Pencil as z, Plus as pe, RotateCcw as me, Save as he, Share as ge, Square as _e, Sun as ve, TextCursor as ye, ThumbsDown as be, ThumbsUp as xe, Trash2 as Se, TriangleAlert as Ce, X as we } from "lucide-react";
5
+ import { ArrowDown as D, ArrowLeft as O, Bookmark as k, Brain as A, Check as j, ChevronDown as M, ChevronLeft as N, ChevronRight as ee, Copy as P, CornerDownLeft as F, File as I, FileText as te, Film as L, Highlighter as ne, Image as re, Link2 as ie, Maximize2 as R, MessageCircle as ae, Mic as oe, Minimize2 as se, Moon as ce, MoreHorizontal as le, Music as ue, Palette as z, Paperclip as de, Pencil as fe, Plus as pe, RotateCcw as me, Save as he, Share as ge, Square as _e, Sun as ve, TextCursor as ye, ThumbsDown as be, ThumbsUp as xe, Trash2 as Se, TriangleAlert as Ce, X as we } from "lucide-react";
6
6
  var B = {
7
7
  btn: "ick-btn-ZW5E",
8
8
  xs: "ick-xs-rDs4",
@@ -67,7 +67,7 @@ var B = {
67
67
  })
68
68
  ]
69
69
  });
70
- }), H = {
70
+ }), De = {
71
71
  list: "ick-list-4-Xw",
72
72
  item: "ick-item-5jP3",
73
73
  picture: "ick-picture-JacB",
@@ -76,7 +76,7 @@ var B = {
76
76
  name: "ick-name-6t7S",
77
77
  size: "ick-size-sR5p",
78
78
  remove: "ick-remove-6I5y"
79
- }, De = {
79
+ }, Oe = {
80
80
  approval: {
81
81
  once: "Allow once",
82
82
  always: "Always allow",
@@ -226,9 +226,9 @@ var B = {
226
226
  paragraph: "Paragraph {index}",
227
227
  responding: "Generating response"
228
228
  }
229
- }, Oe = t({});
230
- function ke({ labels: e, children: t }) {
231
- let n = s(Oe), r = e ? JSON.stringify(e) : "", i = f(() => {
229
+ }, ke = t({});
230
+ function Ae({ labels: e, children: t }) {
231
+ let n = s(ke), r = e ? JSON.stringify(e) : "", i = f(() => {
232
232
  if (!r) return n;
233
233
  let e = JSON.parse(r), t = { ...n };
234
234
  for (let r of Object.keys(e)) t[r] = {
@@ -237,25 +237,25 @@ function ke({ labels: e, children: t }) {
237
237
  };
238
238
  return t;
239
239
  }, [n, r]);
240
- return /* @__PURE__ */ _(Oe.Provider, {
240
+ return /* @__PURE__ */ _(ke.Provider, {
241
241
  value: i,
242
242
  children: t
243
243
  });
244
244
  }
245
- function U(e, t) {
246
- let n = s(Oe)[e];
245
+ function H(e, t) {
246
+ let n = s(ke)[e];
247
247
  return {
248
- ...De[e],
248
+ ...Oe[e],
249
249
  ...n,
250
250
  ...t
251
251
  };
252
252
  }
253
- function Ae(e, t) {
253
+ function je(e, t) {
254
254
  return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e);
255
255
  }
256
256
  //#endregion
257
257
  //#region src/Attachments/Attachments.tsx
258
- function je(e) {
258
+ function U(e) {
259
259
  if (e === void 0 || !Number.isFinite(e) || e < 0) return "";
260
260
  if (e < 1024) return `${e} B`;
261
261
  let t = [
@@ -269,40 +269,40 @@ function je(e) {
269
269
  var Me = (e) => !!e.url && (e.type ?? "").startsWith("image/"), Ne = (e) => e.replace(/["\\]/g, encodeURIComponent);
270
270
  function Pe({ type: e }) {
271
271
  let t = (e ?? "").split("/")[0];
272
- return _(t === "image" ? re : t === "video" ? L : t === "audio" ? ue : e === "application/pdf" || t === "text" ? I : te, {
272
+ return _(t === "image" ? re : t === "video" ? L : t === "audio" ? ue : e === "application/pdf" || t === "text" ? te : I, {
273
273
  size: 16,
274
274
  "aria-hidden": !0
275
275
  });
276
276
  }
277
277
  function Fe({ attachments: e, onRemove: t, labels: n, className: r, ...i }) {
278
- let a = U("attachments", n);
278
+ let a = H("attachments", n);
279
279
  return e.length === 0 ? null : /* @__PURE__ */ _("ul", {
280
- className: [H.list, r ?? ""].filter(Boolean).join(" "),
280
+ className: [De.list, r ?? ""].filter(Boolean).join(" "),
281
281
  ...i,
282
282
  children: e.map((e) => {
283
- let n = je(e.size);
283
+ let n = U(e.size);
284
284
  return /* @__PURE__ */ v("li", {
285
- className: H.item,
285
+ className: De.item,
286
286
  "data-picture": Me(e) || void 0,
287
287
  children: [Me(e) ? /* @__PURE__ */ _("span", {
288
- className: H.picture,
288
+ className: De.picture,
289
289
  style: { backgroundImage: `url("${Ne(e.url)}")` },
290
290
  role: "img",
291
291
  "aria-label": e.name
292
292
  }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
293
- className: H.glyph,
293
+ className: De.glyph,
294
294
  children: /* @__PURE__ */ _(Pe, { type: e.type })
295
295
  }), /* @__PURE__ */ v("span", {
296
- className: H.body,
296
+ className: De.body,
297
297
  children: [/* @__PURE__ */ _("span", {
298
- className: H.name,
298
+ className: De.name,
299
299
  children: e.name
300
300
  }), n && /* @__PURE__ */ _("span", {
301
- className: H.size,
301
+ className: De.size,
302
302
  children: n
303
303
  })]
304
304
  })] }), t && /* @__PURE__ */ _("span", {
305
- className: H.remove,
305
+ className: De.remove,
306
306
  children: /* @__PURE__ */ _(V, {
307
307
  variant: "glass",
308
308
  size: "s",
@@ -421,7 +421,7 @@ var W = {
421
421
  //#endregion
422
422
  //#region src/ChatInput/HoverActionsRow.tsx
423
423
  function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r, onCopy: i, onEdit: a, value: o, ac: s }) {
424
- let c = U("input");
424
+ let c = H("input");
425
425
  return /* @__PURE__ */ _(y, {
426
426
  initial: !1,
427
427
  children: e && /* @__PURE__ */ v(C.div, {
@@ -491,7 +491,7 @@ function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r,
491
491
  label: c.copy
492
492
  }, {
493
493
  id: "edit",
494
- icon: /* @__PURE__ */ _(z, {
494
+ icon: /* @__PURE__ */ _(fe, {
495
495
  size: 14,
496
496
  "aria-hidden": !0
497
497
  }),
@@ -528,12 +528,12 @@ function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r,
528
528
  //#endregion
529
529
  //#region src/ChatInput/AddCardsOverlay.tsx
530
530
  function ze() {
531
- let e = U("input");
531
+ let e = H("input");
532
532
  return [
533
533
  {
534
534
  id: "attach",
535
535
  label: e.attach,
536
- icon: /* @__PURE__ */ _(fe, {
536
+ icon: /* @__PURE__ */ _(de, {
537
537
  size: 16,
538
538
  "aria-hidden": !0
539
539
  })
@@ -541,7 +541,7 @@ function ze() {
541
541
  {
542
542
  id: "design",
543
543
  label: e.design,
544
- icon: /* @__PURE__ */ _(de, {
544
+ icon: /* @__PURE__ */ _(z, {
545
545
  size: 16,
546
546
  "aria-hidden": !0
547
547
  })
@@ -549,7 +549,7 @@ function ze() {
549
549
  {
550
550
  id: "connectors",
551
551
  label: e.connectors,
552
- icon: /* @__PURE__ */ _(R, {
552
+ icon: /* @__PURE__ */ _(ie, {
553
553
  size: 16,
554
554
  "aria-hidden": !0
555
555
  })
@@ -557,7 +557,7 @@ function ze() {
557
557
  ];
558
558
  }
559
559
  function Be({ isAddOpen: e, setIsAddOpen: t, onAdd: n, items: r, showInlineGlyph: i, showButtons: a, ac: o }) {
560
- let s = ze(), c = r ?? s, { closeMenu: l } = U("input");
560
+ let s = ze(), c = r ?? s, { closeMenu: l } = H("input");
561
561
  return /* @__PURE__ */ _(y, { children: e && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(C.div, {
562
562
  className: W.addBackdrop,
563
563
  initial: { opacity: 0 },
@@ -698,7 +698,7 @@ function Ge(e) {
698
698
  let n = document.createElement("div");
699
699
  return n.setAttribute("role", e === "assertive" ? "alert" : "status"), n.setAttribute("aria-live", e), n.setAttribute("aria-atomic", "true"), n.dataset.inlineChatKit = "live-region", Object.assign(n.style, We), document.body.appendChild(n), He.set(e, n), n;
700
700
  }
701
- function G(e, t = "polite") {
701
+ function Ke(e, t = "polite") {
702
702
  if (!e) return;
703
703
  let n = Ge(t);
704
704
  if (!n) return;
@@ -709,9 +709,9 @@ function G(e, t = "polite") {
709
709
  }
710
710
  //#endregion
711
711
  //#region src/reducedMotion/reducedMotion.ts
712
- var K = "(prefers-reduced-motion: reduce)", Ke;
712
+ var G = "(prefers-reduced-motion: reduce)", K;
713
713
  function q() {
714
- return Ke === void 0 && (Ke = typeof window < "u" && window.matchMedia ? window.matchMedia(K) : null), Ke?.matches ?? !1;
714
+ return K === void 0 && (K = typeof window < "u" && window.matchMedia ? window.matchMedia(G) : null), K?.matches ?? !1;
715
715
  }
716
716
  //#endregion
717
717
  //#region src/voice/useVoiceInput.ts
@@ -730,7 +730,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
730
730
  onTranscript: t,
731
731
  onDone: n
732
732
  }), w = p({
733
- ...De.voice,
733
+ ...Oe.voice,
734
734
  ...i
735
735
  });
736
736
  c(() => {
@@ -739,7 +739,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
739
739
  onTranscript: t,
740
740
  onDone: n
741
741
  }, w.current = {
742
- ...De.voice,
742
+ ...Oe.voice,
743
743
  ...i
744
744
  };
745
745
  });
@@ -777,7 +777,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
777
777
  return;
778
778
  }
779
779
  let r = new AbortController();
780
- x.current = r, l("transcribing"), G(w.current.transcribing);
780
+ x.current = r, l("transcribing"), Ke(w.current.transcribing);
781
781
  try {
782
782
  let i = await D(n(e, {
783
783
  signal: r.signal,
@@ -785,13 +785,13 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
785
785
  }));
786
786
  if (r.signal.aborted) return;
787
787
  if (!i) {
788
- G(w.current.nothingHeard), l("idle");
788
+ Ke(w.current.nothingHeard), l("idle");
789
789
  return;
790
790
  }
791
- C.current.onTranscript?.(i), C.current.onDone?.(i), G(w.current.transcriptAdded), l("idle");
791
+ C.current.onTranscript?.(i), C.current.onDone?.(i), Ke(w.current.transcriptAdded), l("idle");
792
792
  } catch (e) {
793
793
  if (r.signal.aborted) return;
794
- d(e instanceof Error ? e.message : w.current.transcriptFailed), l("failed"), G(w.current.transcriptFailed, "assertive");
794
+ d(e instanceof Error ? e.message : w.current.transcriptFailed), l("failed"), Ke(w.current.transcriptFailed, "assertive");
795
795
  } finally {
796
796
  x.current = null;
797
797
  }
@@ -803,7 +803,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
803
803
  e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
804
804
  } catch (e) {
805
805
  let t = e?.name;
806
- t === "NotAllowedError" || t === "SecurityError" ? (l("denied"), G(w.current.refused, "assertive")) : (d(t === "NotFoundError" ? w.current.notFound : w.current.couldNotOpen), l("failed"), G(w.current.couldNotOpen, "assertive"));
806
+ t === "NotAllowedError" || t === "SecurityError" ? (l("denied"), Ke(w.current.refused, "assertive")) : (d(t === "NotFoundError" ? w.current.notFound : w.current.couldNotOpen), l("failed"), Ke(w.current.couldNotOpen, "assertive"));
807
807
  return;
808
808
  }
809
809
  _.current = e, b.current = [];
@@ -823,7 +823,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
823
823
  return;
824
824
  }
825
825
  O(r, e);
826
- }, n.start(), l("listening"), G(w.current.listening);
826
+ }, n.start(), l("listening"), Ke(w.current.listening);
827
827
  }, [
828
828
  E,
829
829
  T,
@@ -831,7 +831,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
831
831
  ]), A = o(() => {
832
832
  let e = g.current;
833
833
  if (e && e.state !== "inactive") {
834
- G(w.current.stoppedListening), e.stop();
834
+ Ke(w.current.stoppedListening), e.stop();
835
835
  return;
836
836
  }
837
837
  x.current?.abort(), x.current = null, T(), l("idle");
@@ -944,24 +944,24 @@ var nt = .9, rt = {
944
944
  n.deleteContents();
945
945
  let r = document.createTextNode(e);
946
946
  return n.insertNode(r), n.setStartAfter(r), n.collapse(!0), t.removeAllRanges(), t.addRange(n), !1;
947
- }, ot = r(function({ state: e, value: t, onChange: n, onSubmit: r, onStop: i, onAdd: a, attachments: s, onAttach: d, onRemoveAttachment: f, accept: h = "image/*", multiple: T = !1, onTranscribe: E, onCopy: D, onEdit: O, onCancelEdit: k, isEditing: A = !1, placeholder: j, menu: M, labels: ee, animationConfig: N, style: P }, F) {
948
- let te = l(), I = U("input", ee), L = U("voice"), ne = j ?? I.placeholder, re = M !== !1, R = p(null), ie = p(null), ae = p(null), oe = p(0), se = p(!1), ce = p(null), [le, ue] = m(!1), [de, fe] = m(!1), [z, me] = m(!1), [he, ge] = m(!0), [_e, ve] = m(!1), [ye, be] = m(!1), [xe, Se] = m(!1), Ce = p(0), B = p(!1), Te = p(0), Ee = p(!1), H = p(null);
947
+ }, ot = r(function({ state: e, value: t, onChange: n, onSubmit: r, onStop: i, onAdd: a, attachments: s, onAttach: d, onRemoveAttachment: f, accept: h = "image/*", multiple: T = !1, onTranscribe: E, onCopy: D, onEdit: O, onCancelEdit: k, isEditing: A = !1, busy: j = !1, placeholder: M, menu: N, labels: ee, animationConfig: P, style: F }, I) {
948
+ let te = l(), L = H("input", ee), ne = H("voice"), re = M ?? L.placeholder, ie = N !== !1, R = p(null), ae = p(null), oe = p(null), se = p(0), ce = p(!1), le = p(null), [ue, z] = m(!1), [de, fe] = m(!1), [me, he] = m(!1), [ge, _e] = m(!0), [ve, ye] = m(!1), [be, xe] = m(!1), [Se, Ce] = m(!1), B = p(0), Te = p(!1), Ee = p(0), De = p(!1), Oe = p(null);
949
949
  c(() => () => {
950
- H.current && clearTimeout(H.current);
950
+ Oe.current && clearTimeout(Oe.current);
951
951
  }, []);
952
- let De = w(), Oe = p(e), ke = p(N);
953
- ke.current = N;
954
- let Ae = p(null), [je, Me] = m([]), Ne = s ?? je, Pe = p(Ne);
955
- Pe.current = Ne;
956
- let Ie = p([]);
952
+ let ke = w(), Ae = p(e), je = p(P);
953
+ je.current = P;
954
+ let U = p(null), [Me, Ne] = m([]), Pe = s ?? Me, Ie = p(Pe);
955
+ Ie.current = Pe;
956
+ let ze = p([]);
957
957
  c(() => () => {
958
- Ie.current.forEach((e) => URL.revokeObjectURL(e)), Ie.current = [];
958
+ ze.current.forEach((e) => URL.revokeObjectURL(e)), ze.current = [];
959
959
  }, []);
960
- let ze = o((e) => {
960
+ let Ve = o((e) => {
961
961
  if (!e) return;
962
- let t = Ie.current.indexOf(e);
963
- t !== -1 && (URL.revokeObjectURL(e), Ie.current.splice(t, 1));
964
- }, []), Ve = (e) => {
962
+ let t = ze.current.indexOf(e);
963
+ t !== -1 && (URL.revokeObjectURL(e), ze.current.splice(t, 1));
964
+ }, []), He = (e) => {
965
965
  let t = Array.from(e.target.files ?? []);
966
966
  if (e.target.value = "", t.length === 0) return;
967
967
  if (d) {
@@ -970,7 +970,7 @@ var nt = .9, rt = {
970
970
  }
971
971
  let n = t.map((e) => {
972
972
  let t = URL.createObjectURL(e);
973
- return Ie.current.push(t), {
973
+ return ze.current.push(t), {
974
974
  id: `${e.name}-${e.size}-${e.lastModified}`,
975
975
  name: e.name,
976
976
  type: e.type,
@@ -978,19 +978,19 @@ var nt = .9, rt = {
978
978
  url: t
979
979
  };
980
980
  });
981
- Me((e) => {
981
+ Ne((e) => {
982
982
  if (T) return [...e, ...n];
983
983
  let t = n.slice(-1);
984
- return e.forEach((e) => ze(e.url)), n.slice(0, -1).forEach((e) => ze(e.url)), t;
984
+ return e.forEach((e) => Ve(e.url)), n.slice(0, -1).forEach((e) => Ve(e.url)), t;
985
985
  });
986
- }, He = o((e) => {
986
+ }, Ue = o((e) => {
987
987
  if (f) {
988
988
  f(e);
989
989
  return;
990
990
  }
991
- Me((t) => (ze(t.find((t) => t.id === e)?.url), t.filter((t) => t.id !== e)));
992
- }, [f, ze]);
993
- u(F, () => ({
991
+ Ne((t) => (Ve(t.find((t) => t.id === e)?.url), t.filter((t) => t.id !== e)));
992
+ }, [f, Ve]);
993
+ u(I, () => ({
994
994
  focus: (e) => R.current?.focus(e),
995
995
  setValue: (e) => {
996
996
  let t = R.current;
@@ -998,37 +998,37 @@ var nt = .9, rt = {
998
998
  },
999
999
  getValue: () => t
1000
1000
  }), [n, t]);
1001
- let Ue = p(null), We = p(null), Ge = p(null);
1001
+ let We = p(null), Ge = p(null), Ke = p(null);
1002
1002
  c(() => {
1003
1003
  if (!E) return;
1004
1004
  let e = R.current;
1005
1005
  if (!e) return;
1006
1006
  let t = () => {
1007
1007
  let t = window.getSelection();
1008
- !t || t.rangeCount === 0 || e.contains(t.getRangeAt(0).endContainer) && (Ge.current = et(e));
1008
+ !t || t.rangeCount === 0 || e.contains(t.getRangeAt(0).endContainer) && (Ke.current = et(e));
1009
1009
  };
1010
1010
  return document.addEventListener("selectionchange", t), () => document.removeEventListener("selectionchange", t);
1011
1011
  }, [E]);
1012
1012
  let G = Qe({
1013
1013
  onTranscribe: E,
1014
1014
  onTranscript: o((e) => {
1015
- let t = We.current, r = R.current;
1015
+ let t = Ge.current, r = R.current;
1016
1016
  if (!t || !r) return;
1017
1017
  let i = t.base.slice(0, t.at) + e + t.base.slice(t.at);
1018
1018
  r.textContent = i, tt(r, t.at + e.length), n(i);
1019
1019
  }, [n]),
1020
1020
  onDone: () => {
1021
- We.current = null, R.current?.focus();
1021
+ Ge.current = null, R.current?.focus();
1022
1022
  },
1023
- meterRef: Ue,
1024
- labels: L
1025
- }), K = e === "responding" || e === "resting", Ke = K, q = t.trim().length > 0 || Ne.length > 0, qe = (e === "typing" || e === "idle") && q, Je = e === "responding", Ye = e === "resting" && le, Xe = Ye, Ze = e === "resting" && ye, rt = G.state === "listening" || G.state === "requesting" || G.state === "transcribing", ot = !!E && G.supported && !A, st = qe || Je, J = N, ct = J ? {
1023
+ meterRef: We,
1024
+ labels: ne
1025
+ }), K = e === "responding" || e === "resting", q = K, qe = t.trim().length > 0 || Pe.length > 0, Je = e === "typing" || e === "idle", Ye = Je && qe && !j, Xe = !!i && (e === "responding" || j && Je), Ze = j && Je && qe && !i, rt = e === "resting" && ue, ot = rt, st = e === "resting" && be, ct = G.state === "listening" || G.state === "requesting" || G.state === "transcribing", lt = !!E && G.supported && !A, ut = Ye || Xe || Ze, J = P, dt = J ? {
1026
1026
  type: "spring",
1027
1027
  stiffness: J.bubble.stiffness,
1028
1028
  damping: J.bubble.damping,
1029
1029
  mass: J.bubble.mass
1030
- } : it, lt = o(() => {
1031
- let e = ie.current, t = ae.current;
1030
+ } : it, ft = o(() => {
1031
+ let e = ae.current, t = oe.current;
1032
1032
  if (!e || !t) return;
1033
1033
  if (!(e.scrollHeight > e.clientHeight)) {
1034
1034
  t.removeAttribute("data-fade");
@@ -1038,32 +1038,32 @@ var nt = .9, rt = {
1038
1038
  !n && !r ? t.dataset.fade = "both" : n ? r ? t.removeAttribute("data-fade") : t.dataset.fade = "bottom" : t.dataset.fade = "top";
1039
1039
  }, []);
1040
1040
  c(() => {
1041
- let e = ie.current;
1042
- if (e) return e.addEventListener("scroll", lt, { passive: !0 }), () => e.removeEventListener("scroll", lt);
1043
- }, [lt]), c(() => {
1041
+ let e = ae.current;
1042
+ if (e) return e.addEventListener("scroll", ft, { passive: !0 }), () => e.removeEventListener("scroll", ft);
1043
+ }, [ft]), c(() => {
1044
1044
  let e = requestAnimationFrame(() => {
1045
- let e = ie.current;
1046
- e && !Ke && (e.scrollTop = e.scrollHeight), lt();
1045
+ let e = ae.current;
1046
+ e && !q && (e.scrollTop = e.scrollHeight), ft();
1047
1047
  });
1048
1048
  return () => cancelAnimationFrame(e);
1049
1049
  }, [
1050
1050
  t,
1051
- Ke,
1052
- lt
1051
+ q,
1052
+ ft
1053
1053
  ]), c(() => {
1054
1054
  (e === "idle" || e === "typing") && R.current?.focus({ preventScroll: !0 });
1055
1055
  }, [e]), c(() => {
1056
1056
  let e = R.current;
1057
- e && (Ce.current = e.scrollHeight || 17);
1057
+ e && (B.current = e.scrollHeight || 17);
1058
1058
  }, []), c(() => {
1059
- let e = R.current, t = ce.current;
1060
- !e || !Ce.current || requestAnimationFrame(() => {
1061
- let n = t ? t.offsetWidth : 0, r = e.clientWidth - 16, i = (ie.current?.scrollHeight ?? 0) > Ce.current + 2, a = ke.current;
1062
- B.current ? !(i || n >= r - 2) && n < Te.current * (a?.wrap?.exitThreshold ?? .75) && (B.current = !1, Ee.current = !1, me(!1), ge(!0), H.current &&= (clearTimeout(H.current), null)) : (Te.current = r, (i || n >= Te.current * (a?.wrap?.nearThreshold ?? .92)) && (B.current = !0, Ee.current = !0, ge(!1)));
1059
+ let e = R.current, t = le.current;
1060
+ !e || !B.current || requestAnimationFrame(() => {
1061
+ let n = t ? t.offsetWidth : 0, r = e.clientWidth - 16, i = (ae.current?.scrollHeight ?? 0) > B.current + 2, a = je.current;
1062
+ Te.current ? !(i || n >= r - 2) && n < Ee.current * (a?.wrap?.exitThreshold ?? .75) && (Te.current = !1, De.current = !1, he(!1), _e(!0), Oe.current &&= (clearTimeout(Oe.current), null)) : (Ee.current = r, (i || n >= Ee.current * (a?.wrap?.nearThreshold ?? .92)) && (Te.current = !0, De.current = !0, _e(!1)));
1063
1063
  });
1064
1064
  }, [t]), c(() => {
1065
1065
  if (!K) return;
1066
- let e = ie.current;
1066
+ let e = ae.current;
1067
1067
  if (!e || e.scrollTop === 0) return;
1068
1068
  let t = e.scrollTop;
1069
1069
  S(t, 0, {
@@ -1076,24 +1076,24 @@ var nt = .9, rt = {
1076
1076
  }
1077
1077
  });
1078
1078
  }, [K]), c(() => {
1079
- K ? Se(!1) : (ve(!1), be(!1));
1079
+ K ? Ce(!1) : (ye(!1), xe(!1));
1080
1080
  }, [K]), c(() => {
1081
1081
  if (!K) return;
1082
- let e = ae.current;
1083
- e && (ye && !_e ? e.dataset.fade = "bottom" : e.removeAttribute("data-fade"));
1082
+ let e = oe.current;
1083
+ e && (be && !ve ? e.dataset.fade = "bottom" : e.removeAttribute("data-fade"));
1084
1084
  }, [
1085
1085
  K,
1086
- ye,
1087
- _e
1086
+ be,
1087
+ ve
1088
1088
  ]), c(() => {
1089
- let t = Oe.current;
1090
- if (Oe.current = e, t !== "responding" || e !== "resting") return;
1089
+ let t = Ae.current;
1090
+ if (Ae.current = e, t !== "responding" || e !== "resting") return;
1091
1091
  requestAnimationFrame(() => {
1092
- let e = ie.current;
1093
- e && (oe.current = e.scrollHeight, be(e.scrollHeight > 241), lt());
1092
+ let e = ae.current;
1093
+ e && (se.current = e.scrollHeight, xe(e.scrollHeight > 241), ft());
1094
1094
  }), fe(!0);
1095
- let n = ke.current;
1096
- De.start({
1095
+ let n = je.current;
1096
+ ke.start({
1097
1097
  scaleX: [
1098
1098
  1,
1099
1099
  n?.ripple?.scaleX ?? 1.018,
@@ -1118,26 +1118,31 @@ var nt = .9, rt = {
1118
1118
  return () => clearTimeout(r);
1119
1119
  }, [
1120
1120
  e,
1121
- De,
1122
- lt
1121
+ ke,
1122
+ ft
1123
1123
  ]);
1124
- let ut = o(() => {
1124
+ let pt = o(() => {
1125
1125
  let e = R.current;
1126
- e && (se.current = !0, n(e.textContent ?? ""));
1127
- }, [n]), dt = o((e) => {
1128
- e.preventDefault(), at(e.clipboardData.getData("text/plain")) || ut();
1129
- }, [ut]), ft = o((e) => {
1130
- e.key === "Enter" && (e.preventDefault(), !e.shiftKey && (t.trim().length > 0 || Pe.current.length > 0) ? r(t, Pe.current) : e.shiftKey && !at("\n") && ut());
1126
+ e && (ce.current = !0, n(e.textContent ?? ""));
1127
+ }, [n]), mt = o((e) => {
1128
+ e.preventDefault(), at(e.clipboardData.getData("text/plain")) || pt();
1129
+ }, [pt]), ht = o((e) => {
1130
+ if (e.key === "Enter") {
1131
+ if (e.preventDefault(), e.shiftKey) at("\n") || pt();
1132
+ else if (j) return;
1133
+ else (t.trim().length > 0 || Ie.current.length > 0) && r(t, Ie.current);
1134
+ }
1131
1135
  }, [
1132
1136
  t,
1133
1137
  r,
1134
- ut
1138
+ pt,
1139
+ j
1135
1140
  ]);
1136
1141
  return c(() => {
1137
1142
  let e = R.current;
1138
1143
  if (e) {
1139
- if (se.current) {
1140
- se.current = !1;
1144
+ if (ce.current) {
1145
+ ce.current = !1;
1141
1146
  return;
1142
1147
  }
1143
1148
  e.textContent !== t && (e.textContent = t, document.activeElement === e && $e(e));
@@ -1148,21 +1153,21 @@ var nt = .9, rt = {
1148
1153
  id: te,
1149
1154
  children: /* @__PURE__ */ v("div", {
1150
1155
  className: W.wrap,
1151
- onMouseEnter: () => ue(!0),
1152
- onMouseLeave: () => ue(!1),
1153
- style: P,
1156
+ onMouseEnter: () => z(!0),
1157
+ onMouseLeave: () => z(!1),
1158
+ style: F,
1154
1159
  children: [
1155
1160
  /* @__PURE__ */ _(C.div, {
1156
1161
  className: `${W.root} ${K ? W.isGlassRoot : ""}`,
1157
1162
  layout: !0,
1158
- animate: { filter: xe ? `blur(${J?.addCards?.inputBlur ?? 2}px)` : "blur(0px)" },
1163
+ animate: { filter: Se ? `blur(${J?.addCards?.inputBlur ?? 2}px)` : "blur(0px)" },
1159
1164
  style: {
1160
- pointerEvents: xe ? "none" : "auto",
1161
- width: P?.width === "100%" ? "100%" : void 0,
1162
- maxWidth: P?.maxWidth
1165
+ pointerEvents: Se ? "none" : "auto",
1166
+ width: F?.width === "100%" ? "100%" : void 0,
1167
+ maxWidth: F?.maxWidth
1163
1168
  },
1164
1169
  transition: {
1165
- ...ct,
1170
+ ...dt,
1166
1171
  filter: {
1167
1172
  type: "tween",
1168
1173
  duration: .2,
@@ -1170,25 +1175,25 @@ var nt = .9, rt = {
1170
1175
  }
1171
1176
  },
1172
1177
  children: /* @__PURE__ */ v(C.div, {
1173
- className: `${W.surface} ${K ? W.glass : ""} ${Ye ? W.hovered : ""} ${de ? W.pulsed : ""}`,
1178
+ className: `${W.surface} ${K ? W.glass : ""} ${rt ? W.hovered : ""} ${de ? W.pulsed : ""}`,
1174
1179
  style: {
1175
1180
  alignItems: "stretch",
1176
1181
  flexDirection: "column",
1177
1182
  justifyContent: "center"
1178
1183
  },
1179
- transition: ct,
1180
- animate: De,
1184
+ transition: dt,
1185
+ animate: ke,
1181
1186
  onClick: () => R.current?.focus(),
1182
1187
  children: [
1183
1188
  /* @__PURE__ */ _("input", {
1184
1189
  type: "file",
1185
- ref: Ae,
1190
+ ref: U,
1186
1191
  accept: h,
1187
1192
  multiple: T,
1188
1193
  style: { display: "none" },
1189
- onChange: Ve
1194
+ onChange: He
1190
1195
  }),
1191
- /* @__PURE__ */ _(y, { children: Ne.length > 0 && /* @__PURE__ */ _(C.div, {
1196
+ /* @__PURE__ */ _(y, { children: Pe.length > 0 && /* @__PURE__ */ _(C.div, {
1192
1197
  initial: {
1193
1198
  opacity: 0,
1194
1199
  height: 0
@@ -1215,8 +1220,8 @@ var nt = .9, rt = {
1215
1220
  className: W.attachedTray,
1216
1221
  "data-glass": K || void 0,
1217
1222
  children: /* @__PURE__ */ _(Fe, {
1218
- attachments: Ne,
1219
- onRemove: K ? void 0 : He
1223
+ attachments: Pe,
1224
+ onRemove: K ? void 0 : Ue
1220
1225
  })
1221
1226
  })
1222
1227
  }) }),
@@ -1225,15 +1230,15 @@ var nt = .9, rt = {
1225
1230
  display: "flex",
1226
1231
  flexDirection: "row",
1227
1232
  alignItems: "center",
1228
- flexWrap: z ? "wrap" : "nowrap",
1229
- justifyContent: z ? "flex-end" : "flex-start",
1233
+ flexWrap: me ? "wrap" : "nowrap",
1234
+ justifyContent: me ? "flex-end" : "flex-start",
1230
1235
  width: "100%",
1231
1236
  minWidth: 0,
1232
1237
  flex: 1
1233
1238
  },
1234
1239
  children: [
1235
1240
  /* @__PURE__ */ _("span", {
1236
- ref: ce,
1241
+ ref: le,
1237
1242
  "aria-hidden": "true",
1238
1243
  style: {
1239
1244
  position: "absolute",
@@ -1246,16 +1251,16 @@ var nt = .9, rt = {
1246
1251
  children: t
1247
1252
  }),
1248
1253
  /* @__PURE__ */ _("div", {
1249
- ref: ae,
1254
+ ref: oe,
1250
1255
  className: W.editorClip,
1251
- style: { flexBasis: z ? "100%" : void 0 },
1256
+ style: { flexBasis: me ? "100%" : void 0 },
1252
1257
  children: /* @__PURE__ */ _(C.div, {
1253
- ref: ie,
1258
+ ref: ae,
1254
1259
  className: `${W.editorWrap} ${K ? W.editorWrapGlass : ""}`,
1255
1260
  layout: "position",
1256
- animate: K && ye ? { maxHeight: _e ? oe.current : 240 } : void 0,
1261
+ animate: K && be ? { maxHeight: ve ? se.current : 240 } : void 0,
1257
1262
  transition: {
1258
- ...ct,
1263
+ ...dt,
1259
1264
  maxHeight: {
1260
1265
  type: "spring",
1261
1266
  stiffness: 300,
@@ -1266,22 +1271,22 @@ var nt = .9, rt = {
1266
1271
  children: /* @__PURE__ */ _("div", {
1267
1272
  ref: R,
1268
1273
  className: W.editor,
1269
- contentEditable: Ke ? "false" : "plaintext-only",
1274
+ contentEditable: q ? "false" : "plaintext-only",
1270
1275
  suppressContentEditableWarning: !0,
1271
- onInput: ut,
1272
- onKeyDown: ft,
1273
- onPaste: dt,
1276
+ onInput: pt,
1277
+ onKeyDown: ht,
1278
+ onPaste: mt,
1274
1279
  spellCheck: !1,
1275
1280
  role: "textbox",
1276
1281
  "aria-multiline": "true",
1277
- "aria-label": ne,
1278
- "data-placeholder": Ke ? "" : ne
1282
+ "aria-label": re,
1283
+ "data-placeholder": q ? "" : re
1279
1284
  })
1280
1285
  })
1281
1286
  }),
1282
1287
  /* @__PURE__ */ v("div", {
1283
1288
  className: W.buttonGroup,
1284
- children: [!K && he && ot && /* @__PURE__ */ _(C.div, {
1289
+ children: [!K && ge && lt && /* @__PURE__ */ _(C.div, {
1285
1290
  initial: {
1286
1291
  opacity: 0,
1287
1292
  scale: nt,
@@ -1299,7 +1304,7 @@ var nt = .9, rt = {
1299
1304
  scale: nt,
1300
1305
  width: 0,
1301
1306
  marginLeft: 0,
1302
- transition: Ee.current ? {
1307
+ transition: De.current ? {
1303
1308
  type: "tween",
1304
1309
  duration: J?.wrap?.exitDuration ?? .15,
1305
1310
  ease: "easeOut",
@@ -1328,7 +1333,7 @@ var nt = .9, rt = {
1328
1333
  variant: "ghost",
1329
1334
  "data-voice": G.state,
1330
1335
  icon: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
1331
- ref: Ue,
1336
+ ref: We,
1332
1337
  className: W.voiceMeter,
1333
1338
  "data-live": G.state === "listening" || void 0,
1334
1339
  "aria-hidden": !0
@@ -1338,9 +1343,9 @@ var nt = .9, rt = {
1338
1343
  })] }),
1339
1344
  onClick: (e) => {
1340
1345
  if (e.stopPropagation(), G.state !== "denied") {
1341
- if (!rt) {
1342
- let e = Math.min(Ge.current ?? t.length, t.length);
1343
- We.current = {
1346
+ if (!ct) {
1347
+ let e = Math.min(Ke.current ?? t.length, t.length);
1348
+ Ge.current = {
1344
1349
  base: t,
1345
1350
  at: e
1346
1351
  };
@@ -1351,7 +1356,7 @@ var nt = .9, rt = {
1351
1356
  "aria-busy": G.state === "requesting" || G.state === "transcribing",
1352
1357
  "aria-pressed": G.state === "listening",
1353
1358
  disabled: G.state === "denied",
1354
- "aria-label": G.state === "listening" ? I.stopListening : G.state === "requesting" ? I.waitingForMicrophone : G.state === "transcribing" ? I.cancelTranscription : G.state === "denied" ? I.microphoneBlocked : I.dictate,
1359
+ "aria-label": G.state === "listening" ? L.stopListening : G.state === "requesting" ? L.waitingForMicrophone : G.state === "transcribing" ? L.cancelTranscription : G.state === "denied" ? L.microphoneBlocked : L.dictate,
1355
1360
  style: {
1356
1361
  width: "100%",
1357
1362
  height: "100%",
@@ -1361,11 +1366,11 @@ var nt = .9, rt = {
1361
1366
  }, "mic"), /* @__PURE__ */ v(y, {
1362
1367
  initial: !1,
1363
1368
  onExitComplete: () => {
1364
- Ee.current && (Ee.current = !1, me(!0), H.current && clearTimeout(H.current), H.current = window.setTimeout(() => {
1365
- ge(!0), H.current = null;
1366
- }, ke.current?.wrap?.slideInDelay ?? 120));
1369
+ De.current && (De.current = !1, he(!0), Oe.current && clearTimeout(Oe.current), Oe.current = window.setTimeout(() => {
1370
+ _e(!0), Oe.current = null;
1371
+ }, je.current?.wrap?.slideInDelay ?? 120));
1367
1372
  },
1368
- children: [!K && he && (re || A) && /* @__PURE__ */ _(C.div, {
1373
+ children: [!K && ge && (ie || A) && /* @__PURE__ */ _(C.div, {
1369
1374
  initial: {
1370
1375
  opacity: 0,
1371
1376
  scale: nt,
@@ -1380,7 +1385,7 @@ var nt = .9, rt = {
1380
1385
  opacity: 0,
1381
1386
  scale: nt,
1382
1387
  width: 0,
1383
- transition: Ee.current ? {
1388
+ transition: De.current ? {
1384
1389
  type: "tween",
1385
1390
  duration: J?.wrap?.exitDuration ?? .15,
1386
1391
  ease: "easeOut",
@@ -1441,14 +1446,14 @@ var nt = .9, rt = {
1441
1446
  onClick: (e) => {
1442
1447
  e.stopPropagation(), k?.();
1443
1448
  },
1444
- "aria-label": I.cancelEdit,
1445
- title: I.cancelEdit,
1449
+ "aria-label": L.cancelEdit,
1450
+ title: L.cancelEdit,
1446
1451
  style: {
1447
1452
  width: "100%",
1448
1453
  height: "100%"
1449
1454
  }
1450
1455
  })
1451
- }, "cancel-btn") : re && !xe ? /* @__PURE__ */ _(C.div, {
1456
+ }, "cancel-btn") : ie && !Se ? /* @__PURE__ */ _(C.div, {
1452
1457
  initial: {
1453
1458
  opacity: 0,
1454
1459
  scale: .5
@@ -1476,10 +1481,10 @@ var nt = .9, rt = {
1476
1481
  "aria-hidden": !0
1477
1482
  }),
1478
1483
  onClick: (e) => {
1479
- e.stopPropagation(), Se(!0);
1484
+ e.stopPropagation(), Ce(!0);
1480
1485
  },
1481
- "aria-label": I.add,
1482
- title: I.add,
1486
+ "aria-label": L.add,
1487
+ title: L.add,
1483
1488
  style: {
1484
1489
  width: "100%",
1485
1490
  height: "100%"
@@ -1487,7 +1492,7 @@ var nt = .9, rt = {
1487
1492
  })
1488
1493
  }, "plus-btn") : null
1489
1494
  })
1490
- }, "lead"), st && he && /* @__PURE__ */ _(C.div, {
1495
+ }, "lead"), ut && ge && /* @__PURE__ */ _(C.div, {
1491
1496
  initial: {
1492
1497
  opacity: 0,
1493
1498
  scale: nt,
@@ -1505,7 +1510,7 @@ var nt = .9, rt = {
1505
1510
  scale: nt,
1506
1511
  width: 0,
1507
1512
  marginLeft: 0,
1508
- transition: Ee.current ? {
1513
+ transition: De.current ? {
1509
1514
  type: "tween",
1510
1515
  duration: J?.wrap?.exitDuration ?? .15,
1511
1516
  ease: "easeOut"
@@ -1517,8 +1522,8 @@ var nt = .9, rt = {
1517
1522
  type: "tween",
1518
1523
  duration: .15
1519
1524
  },
1520
- width: ct,
1521
- marginLeft: ct
1525
+ width: dt,
1526
+ marginLeft: dt
1522
1527
  }
1523
1528
  },
1524
1529
  transition: {
@@ -1541,11 +1546,12 @@ var nt = .9, rt = {
1541
1546
  },
1542
1547
  children: /* @__PURE__ */ _(V, {
1543
1548
  variant: "primary",
1544
- icon: /* @__PURE__ */ _(Le, { mode: Je ? "stop" : A ? "check" : "send" }),
1549
+ icon: /* @__PURE__ */ _(Le, { mode: Xe ? "stop" : A ? "check" : "send" }),
1545
1550
  onClick: (e) => {
1546
- e.stopPropagation(), Je ? i?.() : r(t, Ne);
1551
+ e.stopPropagation(), Xe ? i?.() : j || r(t, Pe);
1547
1552
  },
1548
- "aria-label": Je ? I.stop : A ? I.save : I.send,
1553
+ disabled: Ze,
1554
+ "aria-label": Xe ? L.stop : A ? L.save : L.send,
1549
1555
  style: {
1550
1556
  flexShrink: 0,
1551
1557
  width: 28
@@ -1560,31 +1566,31 @@ var nt = .9, rt = {
1560
1566
  })
1561
1567
  }),
1562
1568
  /* @__PURE__ */ _(Be, {
1563
- isAddOpen: xe,
1564
- setIsAddOpen: Se,
1565
- items: M || void 0,
1569
+ isAddOpen: Se,
1570
+ setIsAddOpen: Ce,
1571
+ items: N || void 0,
1566
1572
  onAdd: (e, t) => {
1567
- let n = M ? M.find((e) => e.id === t) : void 0;
1568
- t === "attach" && !n?.onSelect && Ae.current?.click(), a?.();
1573
+ let n = N ? N.find((e) => e.id === t) : void 0;
1574
+ t === "attach" && !n?.onSelect && U.current?.click(), a?.();
1569
1575
  },
1570
- showInlineGlyph: st,
1571
- showButtons: he,
1576
+ showInlineGlyph: ut,
1577
+ showButtons: ge,
1572
1578
  ac: J
1573
1579
  }),
1574
1580
  /* @__PURE__ */ _(Re, {
1575
- showActions: Xe,
1576
- showReadMore: Ze,
1577
- isExpanded: _e,
1578
- setIsExpanded: ve,
1581
+ showActions: ot,
1582
+ showReadMore: st,
1583
+ isExpanded: ve,
1584
+ setIsExpanded: ye,
1579
1585
  onCopy: D,
1580
1586
  onEdit: O,
1581
1587
  value: t,
1582
1588
  ac: J
1583
1589
  }),
1584
- ot && (G.state === "denied" || G.state === "failed") && /* @__PURE__ */ _("p", {
1590
+ lt && (G.state === "denied" || G.state === "failed") && /* @__PURE__ */ _("p", {
1585
1591
  className: W.voiceNote,
1586
1592
  "data-tone": G.state,
1587
- children: G.state === "denied" ? I.microphoneBlockedHelp : G.error ?? L.couldNotOpen
1593
+ children: G.state === "denied" ? L.microphoneBlockedHelp : G.error ?? ne.couldNotOpen
1588
1594
  })
1589
1595
  ]
1590
1596
  })
@@ -1604,8 +1610,8 @@ function st(e, t) {
1604
1610
  }
1605
1611
  //#endregion
1606
1612
  //#region src/useChatTurns/useChatTurns.ts
1607
- var J = 260, ct = 220, lt = "Generating response", ut = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2, 11), dt = () => ({
1608
- id: ut(),
1613
+ var ct = 260, lt = 220, ut = "Generating response", J = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2, 11), dt = () => ({
1614
+ id: J(),
1609
1615
  user: "",
1610
1616
  ai: "",
1611
1617
  parts: [],
@@ -1633,13 +1639,13 @@ var J = 260, ct = 220, lt = "Generating response", ut = () => typeof crypto < "u
1633
1639
  }
1634
1640
  return i;
1635
1641
  };
1636
- function ht({ onSend: e, revealSpeed: t = J, sentencePause: n = ct, announcements: r }) {
1637
- let [i, a] = m(() => [dt()]), [s, l] = m(!1), u = p(null), d = p(null), f = p(/* @__PURE__ */ new Map()), h = p(/* @__PURE__ */ new Map()), g = p(null), _ = p(e), v = p(r), y = p(i);
1642
+ function ht({ onSend: e, revealSpeed: t = ct, sentencePause: n = lt, announcements: r, nextTurn: i = "after-answer" }) {
1643
+ let [a, s] = m(() => [dt()]), [l, u] = m(!1), d = p(null), f = p(null), h = p(/* @__PURE__ */ new Map()), g = p(/* @__PURE__ */ new Map()), _ = p(null), v = p(e), y = p(r), b = p(a);
1638
1644
  c(() => {
1639
- _.current = e, y.current = i, v.current = r;
1645
+ v.current = e, b.current = a, y.current = r;
1640
1646
  });
1641
- let b = o((e, t) => {
1642
- a((n) => {
1647
+ let x = o((e, t) => {
1648
+ s((n) => {
1643
1649
  let r = !1, i = n.map((n) => {
1644
1650
  if (n.id !== e) return n;
1645
1651
  r = !0;
@@ -1649,14 +1655,14 @@ function ht({ onSend: e, revealSpeed: t = J, sentencePause: n = ct, announcement
1649
1655
  };
1650
1656
  return "versionIndex" in t || "versions" in t ? i : ft(i);
1651
1657
  });
1652
- return r ? (y.current = i, i) : n;
1658
+ return r ? (b.current = i, i) : n;
1653
1659
  });
1654
- }, []), x = o(() => {
1655
- d.current = null;
1656
- let e = f.current, t = h.current;
1660
+ }, []), S = o(() => {
1661
+ f.current = null;
1662
+ let e = h.current, t = g.current;
1657
1663
  if (e.size === 0 && t.size === 0) return;
1658
1664
  let n = [...e], r = [...t];
1659
- e.clear(), t.clear(), a((e) => {
1665
+ e.clear(), t.clear(), s((e) => {
1660
1666
  let t = e.map((e) => {
1661
1667
  let t = n.find(([t]) => t === e.id)?.[1], i = r.find(([t]) => t === e.id)?.[1];
1662
1668
  return t === void 0 && !i ? e : ft({
@@ -1665,40 +1671,42 @@ function ht({ onSend: e, revealSpeed: t = J, sentencePause: n = ct, announcement
1665
1671
  ...i ? { parts: i.reduce(st, e.parts) } : null
1666
1672
  });
1667
1673
  });
1668
- return y.current = t, t;
1674
+ return b.current = t, t;
1669
1675
  });
1670
- }, []), S = o(() => {
1671
- d.current === null && (d.current = requestAnimationFrame(x));
1672
- }, [x]), C = o((e, t) => {
1673
- f.current.set(e, t), S();
1676
+ }, []), C = o(() => {
1677
+ f.current === null && (f.current = requestAnimationFrame(S));
1674
1678
  }, [S]), w = o((e, t) => {
1675
- let n = h.current.get(e);
1676
- n ? n.push(t) : h.current.set(e, [t]), S();
1677
- }, [S]), T = o((e, t) => {
1678
- w(e, t);
1679
- }, [w]);
1679
+ h.current.set(e, t), C();
1680
+ }, [C]), T = o((e, t) => {
1681
+ let n = g.current.get(e);
1682
+ n ? n.push(t) : g.current.set(e, [t]), C();
1683
+ }, [C]), E = o((e, t) => {
1684
+ T(e, t);
1685
+ }, [T]);
1680
1686
  c(() => () => {
1681
- d.current !== null && cancelAnimationFrame(d.current), u.current?.abort();
1687
+ f.current !== null && cancelAnimationFrame(f.current), d.current?.abort();
1682
1688
  }, []);
1683
- let E = o((e, t) => {
1684
- l(!1), u.current = null, b(e, { state: "resting" }), t || a((e) => {
1685
- if (e.some((e) => e.state === "idle" && e.ai === "" && e.user === "")) return e;
1689
+ let D = o(() => {
1690
+ s((e) => {
1691
+ if (e.some((e) => (e.state === "idle" || e.state === "typing") && e.ai === "")) return e;
1686
1692
  let t = [...e, dt()];
1687
- return y.current = t, t;
1693
+ return b.current = t, t;
1688
1694
  });
1689
- }, [b]), D = o((e, r, i) => new Promise((a) => {
1695
+ }, []), O = o((e, t) => {
1696
+ u(!1), d.current = null, x(e, { state: "resting" }), t || D();
1697
+ }, [x, D]), k = o((e, r, i) => new Promise((a) => {
1690
1698
  if (q()) {
1691
- C(e, r), a();
1699
+ w(e, r), a();
1692
1700
  return;
1693
1701
  }
1694
1702
  let o = mt(r, t, n), s = performance.now(), c = 0, l = () => {
1695
1703
  if (i.aborted) {
1696
- C(e, r), a();
1704
+ w(e, r), a();
1697
1705
  return;
1698
1706
  }
1699
1707
  let t = performance.now() - s;
1700
1708
  for (; c < r.length && o[c] <= t;) c++;
1701
- if (C(e, r.slice(0, c)), c >= r.length) {
1709
+ if (w(e, r.slice(0, c)), c >= r.length) {
1702
1710
  a();
1703
1711
  return;
1704
1712
  }
@@ -1706,105 +1714,108 @@ function ht({ onSend: e, revealSpeed: t = J, sentencePause: n = ct, announcement
1706
1714
  };
1707
1715
  requestAnimationFrame(l);
1708
1716
  }), [
1709
- C,
1717
+ w,
1710
1718
  t,
1711
1719
  n
1712
- ]), O = o((e, t = "") => {
1713
- let n = v.current;
1720
+ ]), A = o((e, t = "") => {
1721
+ let n = y.current;
1714
1722
  if (n === !1) return;
1715
1723
  if (e === "responding") {
1716
- let e = n && "responding" in n ? n.responding : lt;
1717
- e && G(e);
1724
+ let e = n && "responding" in n ? n.responding : ut;
1725
+ e && Ke(e);
1718
1726
  return;
1719
1727
  }
1720
1728
  let r = n?.answer ? n.answer(t) : t;
1721
- r && G(r);
1722
- }, []), k = o(async (e, t, n, r = []) => {
1723
- let i = new AbortController();
1724
- u.current = i, l(!0);
1725
- let a = y.current.find((t) => t.id === e), o = [...a?.versions ?? [], {
1726
- id: `${e}-v${(a?.versions?.length ?? 0) + 1}`,
1729
+ r && Ke(r);
1730
+ }, []), j = o(async (e, t, n, r = []) => {
1731
+ let a = new AbortController();
1732
+ d.current = a, u(!0);
1733
+ let o = b.current.find((t) => t.id === e), s = [...o?.versions ?? [], {
1734
+ id: `${e}-v${(o?.versions?.length ?? 0) + 1}`,
1727
1735
  ai: "",
1728
1736
  parts: []
1729
1737
  }];
1730
- b(e, {
1738
+ x(e, {
1731
1739
  user: t,
1732
1740
  state: "responding",
1733
1741
  ai: "",
1734
1742
  parts: [],
1735
- versions: o,
1736
- versionIndex: o.length - 1
1737
- }), O("responding");
1738
- let s = "";
1743
+ versions: s,
1744
+ versionIndex: s.length - 1
1745
+ }), A("responding"), i === "at-send" && !n && D();
1746
+ let c = "";
1739
1747
  try {
1740
- let n = _.current(t, {
1741
- signal: i.signal,
1748
+ let n = v.current(t, {
1749
+ signal: a.signal,
1742
1750
  turnId: e,
1743
1751
  attachments: r
1744
1752
  });
1745
1753
  if (pt(n)) for await (let t of n) {
1746
- if (i.signal.aborted) break;
1747
- typeof t == "string" ? (s += t, C(e, s)) : w(e, t);
1754
+ if (a.signal.aborted) break;
1755
+ typeof t == "string" ? (c += t, w(e, c)) : T(e, t);
1748
1756
  }
1749
- else s = await n ?? "", await D(e, s, i.signal);
1757
+ else c = await n ?? "", await k(e, c, a.signal);
1750
1758
  } catch (e) {
1751
- if (!i.signal.aborted) throw e;
1759
+ if (!a.signal.aborted) throw e;
1752
1760
  } finally {
1753
- x(), E(e, n), O("answer", s);
1761
+ S(), O(e, n), A("answer", c);
1754
1762
  }
1755
1763
  }, [
1764
+ S,
1765
+ i,
1766
+ D,
1756
1767
  x,
1757
- b,
1758
- C,
1759
1768
  w,
1760
- D,
1761
- E,
1762
- O
1769
+ T,
1770
+ k,
1771
+ O,
1772
+ A
1763
1773
  ]);
1764
1774
  return {
1765
- turns: i,
1775
+ turns: a,
1766
1776
  setDraft: o((e, t) => {
1767
- b(e, {
1777
+ x(e, {
1768
1778
  user: t,
1769
1779
  state: t.length > 0 ? "typing" : "idle"
1770
1780
  });
1771
- }, [b]),
1781
+ }, [x]),
1772
1782
  submit: o((e, t, n) => {
1773
- let r = y.current.find((t) => t.id === e);
1783
+ if (d.current) return;
1784
+ let r = b.current.find((t) => t.id === e);
1774
1785
  if (!r) return;
1775
1786
  let i = (t ?? r.user).trim(), a = n ?? r.attachments ?? [];
1776
1787
  if (!i && a.length === 0) return;
1777
- (a.length > 0 || r.attachments) && b(e, { attachments: a });
1788
+ (a.length > 0 || r.attachments) && x(e, { attachments: a });
1778
1789
  let o = r.ai.length > 0;
1779
- g.current = null, k(e, i, o, a);
1780
- }, [k, b]),
1790
+ _.current = null, j(e, i, o, a);
1791
+ }, [j, x]),
1781
1792
  showVersion: o((e, t) => {
1782
- let n = y.current.find((t) => t.id === e)?.versions?.[t];
1783
- n && b(e, {
1793
+ let n = b.current.find((t) => t.id === e)?.versions?.[t];
1794
+ n && x(e, {
1784
1795
  versionIndex: t,
1785
1796
  ai: n.ai,
1786
1797
  parts: n.parts
1787
1798
  });
1788
- }, [b]),
1799
+ }, [x]),
1789
1800
  stop: o(() => {
1790
- u.current?.abort();
1801
+ d.current?.abort();
1791
1802
  }, []),
1792
1803
  beginEdit: o((e) => {
1793
- let t = y.current.find((t) => t.id === e);
1794
- t && (g.current = {
1804
+ let t = b.current.find((t) => t.id === e);
1805
+ t && (_.current = {
1795
1806
  id: e,
1796
1807
  user: t.user
1797
- }), b(e, { state: "typing" });
1798
- }, [b]),
1808
+ }), x(e, { state: "typing" });
1809
+ }, [x]),
1799
1810
  cancelEdit: o((e) => {
1800
- let t = g.current;
1801
- g.current = null, b(e, {
1811
+ let t = _.current;
1812
+ _.current = null, x(e, {
1802
1813
  state: "resting",
1803
1814
  ...t && t.id === e ? { user: t.user } : {}
1804
1815
  });
1805
- }, [b]),
1806
- isStreaming: s,
1807
- updatePart: T
1816
+ }, [x]),
1817
+ isStreaming: l,
1818
+ updatePart: E
1808
1819
  };
1809
1820
  }
1810
1821
  var Y = {
@@ -1857,7 +1868,7 @@ var Y = {
1857
1868
  }
1858
1869
  return window;
1859
1870
  }, Ct = r(function({ title: e, subtitle: t, avatar: n, headingLevel: r = 2, truncate: i = !0, onBack: a, backHref: s, backLabel: l, actions: u = [], overflowLabel: d, variant: f = "plain", size: h = "m", align: g = "start", sticky: y = !1, elevateOnScroll: b = y, collapseActionsAt: x = 520, landmark: S = !0, children: C, className: w, ...T }, E) {
1860
- let D = U("header"), k = l ?? D.back, A = d ?? D.more, j = p(null), [M, ee] = m(!1), [N, P] = m(!1), F = o((e) => {
1871
+ let D = H("header"), k = l ?? D.back, A = d ?? D.more, j = p(null), [M, N] = m(!1), [ee, P] = m(!1), F = o((e) => {
1861
1872
  j.current = e, typeof E == "function" ? E(e) : E && (E.current = e);
1862
1873
  }, [E]);
1863
1874
  c(() => {
@@ -1865,7 +1876,7 @@ var Y = {
1865
1876
  if (!e || x === !1 || typeof ResizeObserver > "u") return;
1866
1877
  let t = new ResizeObserver(([e]) => {
1867
1878
  let t = e.contentRect.width;
1868
- ee(t > 0 && t < x);
1879
+ N(t > 0 && t < x);
1869
1880
  });
1870
1881
  return t.observe(e), () => t.disconnect();
1871
1882
  }, [x]), c(() => {
@@ -1876,7 +1887,7 @@ var Y = {
1876
1887
  };
1877
1888
  return t(), e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
1878
1889
  }, [b]);
1879
- let te = x !== !1 && M, I = te ? u.filter((e) => e.pinned) : u, L = te ? u.filter((e) => !e.pinned) : [], ne = r ? `h${r}` : "span";
1890
+ let I = x !== !1 && M, te = I ? u.filter((e) => e.pinned) : u, L = I ? u.filter((e) => !e.pinned) : [], ne = r ? `h${r}` : "span";
1880
1891
  return /* @__PURE__ */ v(S ? "header" : "div", {
1881
1892
  ref: F,
1882
1893
  className: [
@@ -1887,7 +1898,7 @@ var Y = {
1887
1898
  y ? Y.sticky : "",
1888
1899
  w ?? ""
1889
1900
  ].filter(Boolean).join(" "),
1890
- "data-scrolled": b && N || void 0,
1901
+ "data-scrolled": b && ee || void 0,
1891
1902
  ...T,
1892
1903
  children: [/* @__PURE__ */ v("div", {
1893
1904
  className: Y.start,
@@ -1930,7 +1941,7 @@ var Y = {
1930
1941
  className: Y.end,
1931
1942
  children: [
1932
1943
  C,
1933
- I.map((e) => /* @__PURE__ */ _(wt, {
1944
+ te.map((e) => /* @__PURE__ */ _(wt, {
1934
1945
  action: e,
1935
1946
  size: h
1936
1947
  }, e.id)),
@@ -2056,12 +2067,12 @@ var Et = {
2056
2067
  reveal: "ick-reveal-z3mw"
2057
2068
  }, Dt = 1600;
2058
2069
  function Ot({ text: e, onCopy: t, onRegenerate: n, onFeedback: r, feedback: i = null, children: a, reveal: s = !1, busy: l = !1, labels: u, className: d, ...f }) {
2059
- let [h, y] = m(!1), b = p(null), x = U("answerActions", u);
2070
+ let [h, y] = m(!1), b = p(null), x = H("answerActions", u);
2060
2071
  c(() => () => {
2061
2072
  b.current && clearTimeout(b.current);
2062
2073
  }, []);
2063
2074
  let S = o(() => {
2064
- t ? t(e) : navigator.clipboard?.writeText(e), y(!0), G(x.copied), b.current && clearTimeout(b.current), b.current = setTimeout(() => y(!1), Dt);
2075
+ t ? t(e) : navigator.clipboard?.writeText(e), y(!0), Ke(x.copied), b.current && clearTimeout(b.current), b.current = setTimeout(() => y(!1), Dt);
2065
2076
  }, [
2066
2077
  x.copied,
2067
2078
  t,
@@ -2131,7 +2142,7 @@ var kt = {
2131
2142
  //#endregion
2132
2143
  //#region src/Branch/Branch.tsx
2133
2144
  function At({ total: e, index: t, onSelect: n, labels: r, className: i, ...a }) {
2134
- let o = U("branch", r);
2145
+ let o = H("branch", r);
2135
2146
  if (e < 2) return null;
2136
2147
  let s = Math.min(Math.max(t, 0), e - 1), c = o.position.replace("{index}", String(s + 1)).replace("{total}", String(e));
2137
2148
  return /* @__PURE__ */ v("div", {
@@ -2147,7 +2158,7 @@ function At({ total: e, index: t, onSelect: n, labels: r, className: i, ...a })
2147
2158
  onPointerDown: (e) => e.stopPropagation(),
2148
2159
  disabled: s === 0,
2149
2160
  "aria-label": o.previous,
2150
- children: /* @__PURE__ */ _(ee, {
2161
+ children: /* @__PURE__ */ _(N, {
2151
2162
  size: 14,
2152
2163
  "aria-hidden": !0
2153
2164
  })
@@ -2170,7 +2181,7 @@ function At({ total: e, index: t, onSelect: n, labels: r, className: i, ...a })
2170
2181
  onPointerDown: (e) => e.stopPropagation(),
2171
2182
  disabled: s === e - 1,
2172
2183
  "aria-label": o.next,
2173
- children: /* @__PURE__ */ _(N, {
2184
+ children: /* @__PURE__ */ _(ee, {
2174
2185
  size: 14,
2175
2186
  "aria-hidden": !0
2176
2187
  })
@@ -2336,7 +2347,7 @@ var Bt = {
2336
2347
  //#endregion
2337
2348
  //#region src/Reasoning/Reasoning.tsx
2338
2349
  function Vt({ children: e, state: t = "done", duration: n, open: r, defaultOpen: i, onOpenChange: a, labels: o, className: s, ...c }) {
2339
- let u = U("reasoning", o), d = l(), f = t === "thinking", { isOpen: p, toggle: h } = Nt({
2350
+ let u = H("reasoning", o), d = l(), f = t === "thinking", { isOpen: p, toggle: h } = Nt({
2340
2351
  open: r,
2341
2352
  defaultOpen: i,
2342
2353
  onOpenChange: a,
@@ -2464,7 +2475,7 @@ var $t = {
2464
2475
  pre: "ick-pre-qaBX"
2465
2476
  }, en = 1600;
2466
2477
  function tn({ code: e, lang: t, label: n, copyable: r = !0, onCopy: i, copiedFor: a = en, labels: s, className: l, ...u }) {
2467
- let d = U("codeBlock", s), [h, g] = m(!1), y = p(null), [b, x] = m(Zt);
2478
+ let d = H("codeBlock", s), [h, g] = m(!1), y = p(null), [b, x] = m(Zt);
2468
2479
  c(() => {
2469
2480
  if (b || !qt(t)) return;
2470
2481
  let e = !0;
@@ -2483,7 +2494,7 @@ function tn({ code: e, lang: t, label: n, copyable: r = !0, onCopy: i, copiedFor
2483
2494
  y.current && clearTimeout(y.current);
2484
2495
  }, []);
2485
2496
  let C = o(() => {
2486
- i ? i(e) : navigator.clipboard?.writeText(e), g(!0), G(d.copiedAnnouncement), y.current && clearTimeout(y.current), y.current = setTimeout(() => g(!1), a);
2497
+ i ? i(e) : navigator.clipboard?.writeText(e), g(!0), Ke(d.copiedAnnouncement), y.current && clearTimeout(y.current), y.current = setTimeout(() => g(!1), a);
2487
2498
  }, [
2488
2499
  e,
2489
2500
  a,
@@ -2597,7 +2608,7 @@ function sn({ label: e, value: t, tone: n }) {
2597
2608
  });
2598
2609
  }
2599
2610
  function cn({ name: e, state: t = "done", summary: n, input: r, output: i, error: a, duration: o, open: s, defaultOpen: c, onOpenChange: u, labels: d, className: f, ...p }) {
2600
- let m = U("tool", d), h = l(), g = t === "error", { isOpen: y, toggle: b } = Nt({
2611
+ let m = H("tool", d), h = l(), g = t === "error", { isOpen: y, toggle: b } = Nt({
2601
2612
  open: s,
2602
2613
  defaultOpen: c,
2603
2614
  onOpenChange: u,
@@ -2673,7 +2684,7 @@ var ln = {
2673
2684
  denied: "wasDenied"
2674
2685
  };
2675
2686
  function fn({ title: e, description: t, children: n, decision: r = null, onDecide: i, readOnly: a = !1, choices: o = un, labels: s, className: c, ...u }) {
2676
- let d = U("approval", s), f = (e) => o.includes(e), p = l(), m = r !== null;
2687
+ let d = H("approval", s), f = (e) => o.includes(e), p = l(), m = r !== null;
2677
2688
  return /* @__PURE__ */ v("section", {
2678
2689
  className: [ln.approval, c ?? ""].filter(Boolean).join(" "),
2679
2690
  "data-decision": r ?? void 0,
@@ -2741,7 +2752,7 @@ var pn = {
2741
2752
  //#endregion
2742
2753
  //#region src/TaskList/TaskList.tsx
2743
2754
  function mn({ tasks: e, title: t, collapsible: n = !1, open: r, defaultOpen: i, onOpenChange: a, labels: o, className: s, ...c }) {
2744
- let u = U("tasks", o), d = l(), f = q(), p = e.filter((e) => (e.state ?? "pending") === "done").length, m = Nt({
2755
+ let u = H("tasks", o), d = l(), f = q(), p = e.filter((e) => (e.state ?? "pending") === "done").length, m = Nt({
2745
2756
  open: r,
2746
2757
  defaultOpen: i,
2747
2758
  onOpenChange: a,
@@ -2818,7 +2829,7 @@ var hn = {
2818
2829
  //#endregion
2819
2830
  //#region src/ChainOfThought/ChainOfThought.tsx
2820
2831
  function gn({ steps: e, state: t = "done", duration: n, open: r, defaultOpen: i, onOpenChange: a, labels: o, className: s, ...c }) {
2821
- let u = U("chain", o), d = l(), f = q(), p = t === "thinking", { isOpen: m, toggle: h } = Nt({
2832
+ let u = H("chain", o), d = l(), f = q(), p = t === "thinking", { isOpen: m, toggle: h } = Nt({
2822
2833
  open: r,
2823
2834
  defaultOpen: i,
2824
2835
  onOpenChange: a,
@@ -2898,7 +2909,7 @@ var _n = {
2898
2909
  //#endregion
2899
2910
  //#region src/Sources/Sources.tsx
2900
2911
  function vn({ sources: e, title: t, collapsible: n = !1, activeId: r = null, onSelect: i, open: a, defaultOpen: o, onOpenChange: s, labels: c, className: u, ...d }) {
2901
- let f = U("sources", c), p = l(), m = Nt({
2912
+ let f = H("sources", c), p = l(), m = Nt({
2902
2913
  open: a,
2903
2914
  defaultOpen: o,
2904
2915
  onOpenChange: s,
@@ -3264,7 +3275,7 @@ function Mn({ question: e, number: t, answer: n, onCommit: r, labels: i }) {
3264
3275
  });
3265
3276
  }
3266
3277
  function Nn({ question: e, number: t, state: n, answer: r, onCommit: i, onEdit: a, readOnly: o = !1, labels: s }) {
3267
- let c = U("question", s), l = n !== "upcoming", u = q(), d = p(null), f = En(d), m;
3278
+ let c = H("question", s), l = n !== "upcoming", u = q(), d = p(null), f = En(d), m;
3268
3279
  if (n === "active") m = /* @__PURE__ */ _(Mn, {
3269
3280
  question: e,
3270
3281
  number: t,
@@ -3284,7 +3295,7 @@ function Nn({ question: e, number: t, state: n, answer: r, onCommit: i, onEdit:
3284
3295
  })]
3285
3296
  }), /* @__PURE__ */ v("span", {
3286
3297
  className: X.collapsedAnswer,
3287
- children: [n.map((e, t) => /* @__PURE__ */ _(bn, { children: e }, `${e}-${t}`)), !o && /* @__PURE__ */ _(z, {
3298
+ children: [n.map((e, t) => /* @__PURE__ */ _(bn, { children: e }, `${e}-${t}`)), !o && /* @__PURE__ */ _(fe, {
3288
3299
  className: X.pencil,
3289
3300
  size: 14,
3290
3301
  "aria-hidden": !0
@@ -3357,17 +3368,17 @@ var Pn = {
3357
3368
  fadeInDelay: .08
3358
3369
  };
3359
3370
  function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null, collapsible: a = !1, onCommit: o, onEdit: s, readOnly: c = !1, labels: u, foldMotion: d, className: f }) {
3360
- let [h, g] = m(!1), [x, S] = m(!1), w = l(), T = p(null), E = En(T), D = U("questionGroup", u), O = q(), k = a && !h, A = n.map((e) => e.shortTitle).join(" · "), j = {
3371
+ let [h, g] = m(!1), [x, S] = m(!1), w = l(), T = p(null), E = En(T), D = H("questionGroup", u), O = q(), k = a && !h, A = n.map((e) => e.shortTitle).join(" · "), j = {
3361
3372
  ...In,
3362
3373
  ...d
3363
3374
  }, M = O ? { duration: 0 } : {
3364
3375
  type: "spring",
3365
3376
  visualDuration: j.visualDuration,
3366
3377
  bounce: j.bounce
3367
- }, ee = {
3378
+ }, N = {
3368
3379
  hidden: { transition: { staggerChildren: O ? 0 : j.stagger } },
3369
3380
  shown: { transition: { staggerChildren: O ? 0 : j.stagger } }
3370
- }, N = (e, t = 0) => O ? { duration: 0 } : {
3381
+ }, ee = (e, t = 0) => O ? { duration: 0 } : {
3371
3382
  type: "spring",
3372
3383
  visualDuration: j.rowDuration,
3373
3384
  bounce: j.rowBounce,
@@ -3380,15 +3391,15 @@ function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
3380
3391
  hidden: {
3381
3392
  opacity: 0,
3382
3393
  y: O ? 0 : j.rowOffset,
3383
- transition: N(j.fadeOut)
3394
+ transition: ee(j.fadeOut)
3384
3395
  },
3385
3396
  shown: {
3386
3397
  opacity: 1,
3387
3398
  y: 0,
3388
- transition: N(j.fadeIn, O ? 0 : j.fadeInDelay)
3399
+ transition: ee(j.fadeIn, O ? 0 : j.fadeInDelay)
3389
3400
  }
3390
3401
  }, F = {
3391
- variants: ee,
3402
+ variants: N,
3392
3403
  initial: "hidden",
3393
3404
  animate: "shown",
3394
3405
  exit: "hidden",
@@ -3993,7 +4004,7 @@ var yr = {
3993
4004
  //#endregion
3994
4005
  //#region src/InlineCitation/InlineCitation.tsx
3995
4006
  function br({ index: e, source: t, children: n, onSelect: r, labels: i, className: a, ...o }) {
3996
- let { cite: s } = U("citation", i), c = t ? `${s} ${e}: ${t.title}` : `${s} ${e}`, l = r ? /* @__PURE__ */ _("button", {
4007
+ let { cite: s } = H("citation", i), c = t ? `${s} ${e}: ${t.title}` : `${s} ${e}`, l = r ? /* @__PURE__ */ _("button", {
3997
4008
  type: "button",
3998
4009
  className: yr.marker,
3999
4010
  onClick: () => r(e, t),
@@ -4069,55 +4080,55 @@ var xr = {
4069
4080
  t += `M ${r} ${n} L ${i} ${n} `;
4070
4081
  }), t.trim();
4071
4082
  };
4072
- function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onReplyInThread: a, sources: s, onSelectSource: u }) {
4073
- let d = U("highlighter"), h = p(null), [g, b] = m([]), [S, w] = m([]), [T, E] = m(null), [D, O] = m(!1), [k, A] = m(null), [j, M] = m(0), ee = p(null), N = p(null), [P, F] = m(null), [te, I] = m(null), L = o((e) => {
4074
- e.viaKeyboard && (N.current = document.activeElement), M(0), A(e);
4075
- }, []), ne = o((e = "none") => {
4076
- let t = N.current;
4077
- N.current = null, A(null), e !== "none" && (e === "restore" && t?.isConnected ? t.focus() : h.current?.focus());
4083
+ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlightComplete: a, onReplyInThread: s, sources: u, onSelectSource: d }) {
4084
+ let h = H("highlighter"), g = p(null), [b, S] = m([]), [w, T] = m([]), [E, D] = m(null), [O, k] = m(!1), [A, j] = m(null), [M, N] = m(0), ee = p(null), P = p(null), [F, I] = m(null), [te, L] = m(null), ne = o((e) => {
4085
+ e.viaKeyboard && (P.current = document.activeElement), N(0), j(e);
4086
+ }, []), re = o((e = "none") => {
4087
+ let t = P.current;
4088
+ P.current = null, j(null), e !== "none" && (e === "restore" && t?.isConnected ? t.focus() : g.current?.focus());
4078
4089
  }, []);
4079
4090
  c(() => {
4080
4091
  let e = (e) => {
4081
- k && h.current && !h.current.contains(e.target) && ne();
4092
+ A && g.current && !g.current.contains(e.target) && re();
4082
4093
  };
4083
4094
  return window.addEventListener("pointerdown", e), () => window.removeEventListener("pointerdown", e);
4084
- }, [k, ne]);
4085
- let re = f(() => vr(t), [t]), R = re.tokens, ie = p(S), oe = p(i), se = p(k);
4095
+ }, [A, re]);
4096
+ let ie = f(() => vr(t), [t]), R = ie.tokens, oe = p(w), se = p(a), ce = p(A);
4086
4097
  c(() => {
4087
- ie.current = S, oe.current = i, se.current = k;
4098
+ oe.current = w, se.current = a, ce.current = A;
4088
4099
  });
4089
- let ce = f(() => [...g.map((e) => ({
4100
+ let le = f(() => [...b.map((e) => ({
4090
4101
  id: e.id,
4091
4102
  d: wr(e.points),
4092
4103
  kind: "path",
4093
4104
  item: e,
4094
4105
  text: Dr(e.highlightedIndices, R)
4095
- })), ...S.map((e) => ({
4106
+ })), ...w.map((e) => ({
4096
4107
  id: e.id,
4097
4108
  d: kr(e.rects),
4098
4109
  kind: "selection",
4099
4110
  item: e,
4100
4111
  text: e.text
4101
4112
  }))], [
4102
- g,
4103
- S,
4113
+ b,
4114
+ w,
4104
4115
  R
4105
- ]), le = (e, t = !1) => {
4116
+ ]), ue = (e, t = !1) => {
4106
4117
  let n = e.kind === "path" ? Tr(e.item.points) : Er(e.item.rects);
4107
- L({
4118
+ ne({
4108
4119
  x: n.x,
4109
4120
  y: n.y,
4110
4121
  pathId: e.id,
4111
4122
  kind: e.kind,
4112
4123
  viaKeyboard: t
4113
4124
  });
4114
- }, ue = o((e, t, n = !1) => {
4115
- let r = h.current, i = t.trim();
4125
+ }, z = o((e, t, n = !1) => {
4126
+ let r = g.current, i = t.trim();
4116
4127
  if (!r || !i) return;
4117
4128
  let a = /* @__PURE__ */ new Set();
4118
4129
  r.querySelectorAll("span[data-index]").forEach((t) => {
4119
4130
  e.intersectsNode(t) && a.add(parseInt(t.getAttribute("data-index"), 10));
4120
- }), oe.current?.(i);
4131
+ }), se.current?.(i);
4121
4132
  let o = r.getBoundingClientRect(), s = Array.from(e.getClientRects()).map((e) => ({
4122
4133
  x: e.left - o.left,
4123
4134
  y: e.top - o.top,
@@ -4139,30 +4150,30 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4139
4150
  h: i
4140
4151
  };
4141
4152
  }), u = Date.now().toString();
4142
- w((e) => [...e, {
4153
+ T((e) => [...e, {
4143
4154
  id: u,
4144
4155
  rects: l,
4145
4156
  text: i,
4146
4157
  highlightedIndices: a
4147
4158
  }]);
4148
4159
  let d = Er(l);
4149
- L({
4160
+ ne({
4150
4161
  x: d.x,
4151
4162
  y: d.y,
4152
4163
  pathId: u,
4153
4164
  kind: "selection",
4154
4165
  viaKeyboard: n
4155
4166
  });
4156
- }, [L]);
4167
+ }, [ne]);
4157
4168
  c(() => {
4158
4169
  let e = (e) => {
4159
- if (se.current) return;
4160
- let t = h.current;
4170
+ if (ce.current) return;
4171
+ let t = g.current;
4161
4172
  if (!t) return;
4162
4173
  let n = window.getSelection();
4163
4174
  if (!n || n.isCollapsed || n.rangeCount === 0 || !n.toString().trim()) return;
4164
4175
  let r = n.getRangeAt(0);
4165
- t.contains(r.commonAncestorContainer) && (ue(r, n.toString(), e), requestAnimationFrame(() => window.getSelection()?.removeAllRanges()));
4176
+ t.contains(r.commonAncestorContainer) && (z(r, n.toString(), e), requestAnimationFrame(() => window.getSelection()?.removeAllRanges()));
4166
4177
  }, t = () => e(!1), n = (t) => {
4167
4178
  let n = (t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "a";
4168
4179
  !t.shiftKey && !n || e(!0);
@@ -4170,82 +4181,82 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4170
4181
  return document.addEventListener("mouseup", t), document.addEventListener("keyup", n), () => {
4171
4182
  document.removeEventListener("mouseup", t), document.removeEventListener("keyup", n);
4172
4183
  };
4173
- }, [ue]);
4174
- let [de, fe] = m(r);
4175
- de !== r && (fe(r), A(null));
4176
- let z = f(() => R.map((e, t) => e.trim() ? t : -1).filter((e) => e >= 0), [R]), [pe, me] = m(null), [he, ge] = m(null), _e = l(), ve = f(() => pe === null || he === null ? null : {
4177
- from: Math.min(he, pe),
4178
- to: Math.max(he, pe)
4179
- }, [pe, he]), ye = () => {
4180
- me(null), ge(null);
4181
- }, be = () => {
4182
- let e = h.current;
4183
- if (!e || !ve) return;
4184
- let t = e.querySelector(`span[data-index="${ve.from}"]`), n = e.querySelector(`span[data-index="${ve.to}"]`);
4184
+ }, [z]);
4185
+ let [de, fe] = m(i);
4186
+ de !== i && (fe(i), j(null));
4187
+ let pe = f(() => R.map((e, t) => e.trim() ? t : -1).filter((e) => e >= 0), [R]), [me, he] = m(null), [ge, _e] = m(null), ve = l(), ye = f(() => me === null || ge === null ? null : {
4188
+ from: Math.min(ge, me),
4189
+ to: Math.max(ge, me)
4190
+ }, [me, ge]), be = () => {
4191
+ he(null), _e(null);
4192
+ }, xe = () => {
4193
+ let e = g.current;
4194
+ if (!e || !ye) return;
4195
+ let t = e.querySelector(`span[data-index="${ye.from}"]`), n = e.querySelector(`span[data-index="${ye.to}"]`);
4185
4196
  if (!t || !n) return;
4186
4197
  let r = document.createRange();
4187
4198
  r.setStartBefore(t), r.setEndAfter(n);
4188
4199
  let i = "";
4189
- for (let e = ve.from; e <= ve.to; e++) i += R[e];
4190
- ue(r, i, !0), ye();
4191
- }, xe = () => [...ee.current?.querySelectorAll("[role=\"menuitem\"]") ?? []];
4200
+ for (let e = ye.from; e <= ye.to; e++) i += R[e];
4201
+ z(r, i, !0), be();
4202
+ }, Ce = () => [...ee.current?.querySelectorAll("[role=\"menuitem\"]") ?? []];
4192
4203
  c(() => {
4193
- if (!k) return;
4194
- let e = xe();
4204
+ if (!A) return;
4205
+ let e = Ce();
4195
4206
  if (e.length === 0) return;
4196
4207
  let t = ee.current?.contains(document.activeElement);
4197
- (k.viaKeyboard || t) && e[Math.min(j, e.length - 1)]?.focus();
4198
- }, [k, j]);
4199
- let Ce = (e) => {
4200
- let t = xe().length;
4208
+ (A.viaKeyboard || t) && e[Math.min(M, e.length - 1)]?.focus();
4209
+ }, [A, M]);
4210
+ let we = (e) => {
4211
+ let t = Ce().length;
4201
4212
  if (t === 0) return;
4202
4213
  let n = (n) => {
4203
- e.preventDefault(), e.stopPropagation(), M((e) => (e + n + t) % t);
4214
+ e.preventDefault(), e.stopPropagation(), N((e) => (e + n + t) % t);
4204
4215
  };
4205
4216
  switch (e.key) {
4206
4217
  case "ArrowRight":
4207
4218
  case "ArrowDown": return n(1);
4208
4219
  case "ArrowLeft":
4209
4220
  case "ArrowUp": return n(-1);
4210
- case "Home": return e.preventDefault(), M(0);
4211
- case "End": return e.preventDefault(), M(t - 1);
4221
+ case "Home": return e.preventDefault(), N(0);
4222
+ case "End": return e.preventDefault(), N(t - 1);
4212
4223
  default: return;
4213
4224
  }
4214
- }, we = (e) => {
4215
- if (e.target !== e.currentTarget && e.key !== "Escape" || z.length === 0) return;
4225
+ }, B = (e) => {
4226
+ if (e.target !== e.currentTarget && e.key !== "Escape" || pe.length === 0) return;
4216
4227
  let t = (t, n) => {
4217
4228
  e.preventDefault();
4218
- let r = pe === null ? -1 : z.indexOf(pe), i = r === -1 ? z[t === 1 ? 0 : z.length - 1] : z[Math.min(z.length - 1, Math.max(0, r + t))];
4219
- me(i), (!n || he === null) && ge(i);
4229
+ let r = me === null ? -1 : pe.indexOf(me), i = r === -1 ? pe[t === 1 ? 0 : pe.length - 1] : pe[Math.min(pe.length - 1, Math.max(0, r + t))];
4230
+ he(i), (!n || ge === null) && _e(i);
4220
4231
  }, n = (t) => {
4221
- e.preventDefault(), me(t), (!e.shiftKey || he === null) && ge(t);
4232
+ e.preventDefault(), he(t), (!e.shiftKey || ge === null) && _e(t);
4222
4233
  };
4223
4234
  switch (e.key) {
4224
4235
  case "ArrowRight": return t(1, e.shiftKey);
4225
4236
  case "ArrowLeft": return t(-1, e.shiftKey);
4226
- case "Home": return n(z[0]);
4227
- case "End": return n(z[z.length - 1]);
4237
+ case "Home": return n(pe[0]);
4238
+ case "End": return n(pe[pe.length - 1]);
4228
4239
  case "Enter":
4229
- case " ": return ve ? (e.preventDefault(), be()) : void 0;
4230
- case "Escape": return !k && pe === null ? void 0 : (e.preventDefault(), ne("restore"), ye());
4240
+ case " ": return ye ? (e.preventDefault(), xe()) : void 0;
4241
+ case "Escape": return !A && me === null ? void 0 : (e.preventDefault(), re("restore"), be());
4231
4242
  default: return;
4232
4243
  }
4233
- }, B = (e, t, n) => {
4244
+ }, Te = (e, t, n) => {
4234
4245
  let r = document.elementFromPoint(e, t);
4235
4246
  if (r && r.hasAttribute("data-index")) {
4236
4247
  let e = parseInt(r.getAttribute("data-index"), 10);
4237
4248
  n.add(e);
4238
4249
  }
4239
- }, Te = (e) => {
4240
- if (k) {
4241
- ne();
4250
+ }, Ee = (e) => {
4251
+ if (A) {
4252
+ re();
4242
4253
  return;
4243
4254
  }
4244
- if (r === "precise" || e.button !== 0 && e.pointerType === "mouse") return;
4245
- e.preventDefault(), O(!0);
4255
+ if (i === "precise" || e.button !== 0 && e.pointerType === "mouse") return;
4256
+ e.preventDefault(), k(!0);
4246
4257
  let t = e.currentTarget;
4247
4258
  t.setPointerCapture(e.pointerId);
4248
- let n = t.getBoundingClientRect(), i = e.clientX - n.left, a = e.clientY - n.top, o = i - a * Cr, s = {
4259
+ let n = t.getBoundingClientRect(), r = e.clientX - n.left, a = e.clientY - n.top, o = r - a * Cr, s = {
4249
4260
  id: Date.now().toString(),
4250
4261
  points: [{
4251
4262
  x: o,
@@ -4253,78 +4264,78 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4253
4264
  }],
4254
4265
  highlightedIndices: /* @__PURE__ */ new Set()
4255
4266
  };
4256
- E(s), ne(), B(e.clientX, e.clientY, s.highlightedIndices);
4257
- }, Ee = (e) => {
4258
- if (r === "precise" || !T) return;
4259
- let t = h.current.getBoundingClientRect(), n = e.clientX - t.left, i = e.clientY - t.top, a = n - i * Cr;
4260
- E((t) => {
4267
+ D(s), re(), Te(e.clientX, e.clientY, s.highlightedIndices);
4268
+ }, De = (e) => {
4269
+ if (i === "precise" || !E) return;
4270
+ let t = g.current.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, a = n - r * Cr;
4271
+ D((t) => {
4261
4272
  if (!t) return t;
4262
4273
  let n = new Set(t.highlightedIndices);
4263
- return B(e.clientX, e.clientY, n), {
4274
+ return Te(e.clientX, e.clientY, n), {
4264
4275
  ...t,
4265
4276
  points: [...t.points, {
4266
4277
  x: a,
4267
- y: i
4278
+ y: r
4268
4279
  }],
4269
4280
  highlightedIndices: n
4270
4281
  };
4271
4282
  });
4272
- }, H = (e) => {
4273
- if (r !== "precise" && (O(!1), T)) {
4274
- if (e.currentTarget.releasePointerCapture(e.pointerId), b((e) => [...e, T]), T.highlightedIndices.size > 0) {
4275
- let e = Tr(T.points);
4276
- L({
4283
+ }, Oe = (e) => {
4284
+ if (i !== "precise" && (k(!1), E)) {
4285
+ if (e.currentTarget.releasePointerCapture(e.pointerId), S((e) => [...e, E]), E.highlightedIndices.size > 0) {
4286
+ let e = Tr(E.points);
4287
+ ne({
4277
4288
  x: e.x,
4278
4289
  y: e.y,
4279
- pathId: T.id,
4290
+ pathId: E.id,
4280
4291
  kind: "path"
4281
4292
  });
4282
4293
  }
4283
- i && T.highlightedIndices.size > 0 && i(Dr(T.highlightedIndices, R)), E(null);
4294
+ a && E.highlightedIndices.size > 0 && a(Dr(E.highlightedIndices, R)), D(null);
4284
4295
  }
4285
- }, De = (e) => {
4286
- r !== "precise" && (O(!1), T && (e.currentTarget.releasePointerCapture(e.pointerId), E(null)));
4287
- }, Oe = (e) => {
4288
- let t = g.find((t) => t.id === e);
4289
- return t ? Dr(t.highlightedIndices, R) : "";
4290
4296
  }, ke = (e) => {
4291
- let t = k?.viaKeyboard;
4292
- k?.kind === "selection" ? w((t) => t.filter((t) => t.id !== e)) : b((t) => t.filter((t) => t.id !== e)), ne(t ? "container" : "none");
4293
- }, je = () => {
4294
- let e = k?.viaKeyboard;
4295
- if (k && a) {
4296
- if (k.kind === "selection") {
4297
- let e = S.find((e) => e.id === k.pathId), t = h.current;
4297
+ i !== "precise" && (k(!1), E && (e.currentTarget.releasePointerCapture(e.pointerId), D(null)));
4298
+ }, Ae = (e) => {
4299
+ let t = b.find((t) => t.id === e);
4300
+ return t ? Dr(t.highlightedIndices, R) : "";
4301
+ }, U = (e) => {
4302
+ let t = A?.viaKeyboard;
4303
+ A?.kind === "selection" ? T((t) => t.filter((t) => t.id !== e)) : S((t) => t.filter((t) => t.id !== e)), re(t ? "container" : "none");
4304
+ }, Me = () => {
4305
+ let e = A?.viaKeyboard;
4306
+ if (A && s) {
4307
+ if (A.kind === "selection") {
4308
+ let e = w.find((e) => e.id === A.pathId), t = g.current;
4298
4309
  if (e && t) {
4299
- let n = t.getBoundingClientRect(), r = Infinity, i = Infinity, o = -Infinity, s = -Infinity;
4310
+ let n = t.getBoundingClientRect(), r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
4300
4311
  e.rects.forEach((e) => {
4301
- r = Math.min(r, e.x), i = Math.min(i, e.y), o = Math.max(o, e.x + e.w), s = Math.max(s, e.y + e.h);
4312
+ r = Math.min(r, e.x), i = Math.min(i, e.y), a = Math.max(a, e.x + e.w), o = Math.max(o, e.y + e.h);
4302
4313
  });
4303
- let c = new DOMRect(n.left + r, n.top + i, o - r, s - i);
4304
- a(e.text, c);
4314
+ let c = new DOMRect(n.left + r, n.top + i, a - r, o - i);
4315
+ s(e.text, c);
4305
4316
  }
4306
4317
  } else {
4307
- let e = Oe(k.pathId), t = document.getElementById(`highlight-path-${k.pathId}`);
4308
- t && a(e, t.getBoundingClientRect());
4318
+ let e = Ae(A.pathId), t = document.getElementById(`highlight-path-${A.pathId}`);
4319
+ t && s(e, t.getBoundingClientRect());
4309
4320
  }
4310
4321
  }
4311
- ne(e ? "restore" : "none");
4312
- }, Me = (e) => {
4322
+ re(e ? "restore" : "none");
4323
+ }, Ne = (e) => {
4313
4324
  let t = R[e], n = !1;
4314
- k && (n = (k.kind === "path" ? g.find((e) => e.id === k.pathId) : S.find((e) => e.id === k.pathId))?.highlightedIndices?.has(e) ?? !1);
4325
+ A && (n = (A.kind === "path" ? b.find((e) => e.id === A.pathId) : w.find((e) => e.id === A.pathId))?.highlightedIndices?.has(e) ?? !1);
4315
4326
  let r = !1;
4316
- return P && (r = (g.find((e) => e.id === P) ?? S.find((e) => e.id === P))?.highlightedIndices?.has(e) ?? !1), /* @__PURE__ */ _("span", {
4327
+ return F && (r = (b.find((e) => e.id === F) ?? w.find((e) => e.id === F))?.highlightedIndices?.has(e) ?? !1), /* @__PURE__ */ _("span", {
4317
4328
  "data-index": e,
4318
4329
  className: xr.token,
4319
4330
  "data-space": !t.trim() || void 0,
4320
4331
  "data-active": n || void 0,
4321
4332
  "data-pressed": r || void 0,
4322
- "data-kbd-cursor": pe === e || void 0,
4323
- "data-kbd-selected": ve && e >= ve.from && e <= ve.to || void 0,
4333
+ "data-kbd-cursor": me === e || void 0,
4334
+ "data-kbd-selected": ye && e >= ye.from && e <= ye.to || void 0,
4324
4335
  children: t
4325
4336
  }, e);
4326
- }, Ne = (e) => e.map((e, t) => {
4327
- if (e.type === "token") return Me(e.index);
4337
+ }, Pe = (e) => e.map((e, t) => {
4338
+ if (e.type === "token") return Ne(e.index);
4328
4339
  if (e.type === "code") return /* @__PURE__ */ _(tn, {
4329
4340
  code: e.value,
4330
4341
  lang: e.lang
@@ -4333,21 +4344,21 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4333
4344
  let n = Number(e.props?.index ?? 0);
4334
4345
  return /* @__PURE__ */ _(br, {
4335
4346
  index: n,
4336
- source: s?.[n - 1],
4337
- onSelect: u ? (e, t) => u(e, t) : void 0
4347
+ source: u?.[n - 1],
4348
+ onSelect: d ? (e, t) => d(e, t) : void 0
4338
4349
  }, `q${t}`);
4339
4350
  }
4340
4351
  return n(e.tag, {
4341
4352
  key: `e${t}`,
4342
4353
  ...e.props
4343
- }, e.children.length > 0 ? Ne(e.children) : void 0);
4354
+ }, e.children.length > 0 ? Pe(e.children) : void 0);
4344
4355
  });
4345
4356
  return /* @__PURE__ */ _(x, {
4346
4357
  reducedMotion: "user",
4347
4358
  children: /* @__PURE__ */ v(C.div, {
4348
- ref: h,
4349
- "data-cursor": r === "precise" ? "text" : "marker",
4350
- "data-cursor-active": D ? "true" : "false",
4359
+ ref: g,
4360
+ "data-cursor": r ? i === "precise" ? "text" : "marker" : void 0,
4361
+ "data-cursor-active": r ? O ? "true" : "false" : void 0,
4351
4362
  animate: {
4352
4363
  scale: 1,
4353
4364
  y: 0
@@ -4357,84 +4368,86 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4357
4368
  stiffness: 400,
4358
4369
  damping: 30
4359
4370
  },
4360
- "data-drawing": D || void 0,
4361
- "data-menu": !!k || void 0,
4362
- onPointerDown: Te,
4363
- onPointerMove: Ee,
4364
- onPointerUp: H,
4365
- onPointerCancel: De,
4371
+ "data-drawing": O || void 0,
4372
+ "data-menu": !!A || void 0,
4366
4373
  className: xr.surface,
4367
- tabIndex: 0,
4368
- onKeyDown: we,
4369
- onBlur: ye,
4370
- "aria-describedby": _e,
4374
+ ...r ? {
4375
+ onPointerDown: Ee,
4376
+ onPointerMove: De,
4377
+ onPointerUp: Oe,
4378
+ onPointerCancel: ke,
4379
+ tabIndex: 0,
4380
+ onKeyDown: B,
4381
+ onBlur: be,
4382
+ "aria-describedby": ve
4383
+ } : null,
4371
4384
  children: [
4372
- /* @__PURE__ */ _("span", {
4373
- id: _e,
4385
+ r && /* @__PURE__ */ _("span", {
4386
+ id: ve,
4374
4387
  className: xr.srOnly,
4375
4388
  "aria-hidden": "true",
4376
- children: d.keyboardHint
4389
+ children: h.keyboardHint
4377
4390
  }),
4378
- /* @__PURE__ */ _("div", { className: xr.hitbox }),
4391
+ r && /* @__PURE__ */ _("div", { className: xr.hitbox }),
4379
4392
  /* @__PURE__ */ _("div", {
4380
4393
  className: xr.tokens,
4381
- "data-focus": !!k || void 0,
4382
- children: Ne(re.nodes)
4394
+ "data-focus": !!A || void 0,
4395
+ children: Pe(ie.nodes)
4383
4396
  }),
4384
- /* @__PURE__ */ _("svg", {
4397
+ r && /* @__PURE__ */ _("svg", {
4385
4398
  className: xr.canvas,
4386
4399
  children: /* @__PURE__ */ v("g", {
4387
4400
  transform: `skewX(${Sr})`,
4388
- children: [ce.map((t) => /* @__PURE__ */ v(e.Fragment, { children: [/* @__PURE__ */ _("path", {
4401
+ children: [le.map((t) => /* @__PURE__ */ v(e.Fragment, { children: [/* @__PURE__ */ _("path", {
4389
4402
  id: `highlight-${t.kind}-${t.id}`,
4390
4403
  className: xr.marker,
4391
4404
  d: t.d,
4392
4405
  "data-cursor": "pointer",
4393
- "data-pressed": P === t.id || void 0,
4394
- "data-active": k?.pathId === t.id || te === t.id || void 0,
4395
- "data-dimmed": k && k.pathId !== t.id || void 0,
4396
- style: { pointerEvents: D ? "none" : "stroke" },
4406
+ "data-pressed": F === t.id || void 0,
4407
+ "data-active": A?.pathId === t.id || te === t.id || void 0,
4408
+ "data-dimmed": A && A.pathId !== t.id || void 0,
4409
+ style: { pointerEvents: O ? "none" : "stroke" },
4397
4410
  onPointerDown: (e) => {
4398
- D || (e.stopPropagation(), F(t.id));
4411
+ O || (e.stopPropagation(), I(t.id));
4399
4412
  },
4400
4413
  onPointerUp: (e) => {
4401
- P === t.id && (e.stopPropagation(), le(t), F(null));
4414
+ F === t.id && (e.stopPropagation(), ue(t), I(null));
4402
4415
  },
4403
- onPointerLeave: () => F(null),
4404
- onPointerCancel: () => F(null)
4416
+ onPointerLeave: () => I(null),
4417
+ onPointerCancel: () => I(null)
4405
4418
  }), /* @__PURE__ */ _("path", {
4406
4419
  className: xr.shimmer,
4407
4420
  d: t.d,
4408
4421
  pathLength: 1,
4409
- "data-active": k?.pathId === t.id || te === t.id || void 0
4410
- })] }, t.id)), T && /* @__PURE__ */ _("path", {
4422
+ "data-active": A?.pathId === t.id || te === t.id || void 0
4423
+ })] }, t.id)), E && /* @__PURE__ */ _("path", {
4411
4424
  className: xr.marker,
4412
- d: wr(T.points)
4425
+ d: wr(E.points)
4413
4426
  })]
4414
4427
  })
4415
4428
  }),
4416
- ce.length > 0 && /* @__PURE__ */ _("div", {
4429
+ r && le.length > 0 && /* @__PURE__ */ _("div", {
4417
4430
  role: "group",
4418
- "aria-label": Ae(ce.length === 1 ? d.countOne : d.countMany, { count: ce.length }),
4419
- children: ce.map((e) => /* @__PURE__ */ _("button", {
4431
+ "aria-label": je(le.length === 1 ? h.countOne : h.countMany, { count: le.length }),
4432
+ children: le.map((e) => /* @__PURE__ */ _("button", {
4420
4433
  type: "button",
4421
4434
  className: xr.srOnly,
4422
4435
  onPointerDown: (e) => e.stopPropagation(),
4423
- onFocus: () => I(e.id),
4424
- onBlur: () => I(null),
4436
+ onFocus: () => L(e.id),
4437
+ onBlur: () => L(null),
4425
4438
  onClick: (t) => {
4426
- t.stopPropagation(), le(e, !0);
4439
+ t.stopPropagation(), ue(e, !0);
4427
4440
  },
4428
- children: `${d.highlight} ${Or(e.text)}`
4441
+ children: `${h.highlight} ${Or(e.text)}`
4429
4442
  }, e.id))
4430
4443
  }),
4431
- /* @__PURE__ */ _(y, { children: k && /* @__PURE__ */ v(C.div, {
4444
+ /* @__PURE__ */ _(y, { children: r && A && /* @__PURE__ */ v(C.div, {
4432
4445
  ref: ee,
4433
4446
  role: "menu",
4434
- "aria-label": d.menu,
4435
- onKeyDown: Ce,
4447
+ "aria-label": h.menu,
4448
+ onKeyDown: we,
4436
4449
  onBlur: (e) => {
4437
- e.currentTarget.contains(e.relatedTarget) || ne();
4450
+ e.currentTarget.contains(e.relatedTarget) || re();
4438
4451
  },
4439
4452
  initial: { opacity: 0 },
4440
4453
  animate: {
@@ -4450,8 +4463,8 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4450
4463
  },
4451
4464
  className: xr.menu,
4452
4465
  style: {
4453
- left: k.x,
4454
- top: k.y
4466
+ left: A.x,
4467
+ top: A.y
4455
4468
  },
4456
4469
  onPointerDown: (e) => e.stopPropagation(),
4457
4470
  children: [/* @__PURE__ */ _(C.div, {
@@ -4478,13 +4491,13 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4478
4491
  children: /* @__PURE__ */ _(V, {
4479
4492
  variant: "primary",
4480
4493
  role: "menuitem",
4481
- tabIndex: j === 0 ? 0 : -1,
4494
+ tabIndex: M === 0 ? 0 : -1,
4482
4495
  icon: /* @__PURE__ */ _(ae, { size: 14 }),
4483
4496
  onClick: (e) => {
4484
- e.stopPropagation(), je();
4497
+ e.stopPropagation(), Me();
4485
4498
  },
4486
- title: d.reply,
4487
- children: d.reply
4499
+ title: h.reply,
4500
+ children: h.reply
4488
4501
  })
4489
4502
  }), /* @__PURE__ */ _(C.div, {
4490
4503
  initial: {
@@ -4510,13 +4523,13 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4510
4523
  children: /* @__PURE__ */ _(V, {
4511
4524
  variant: "primary",
4512
4525
  role: "menuitem",
4513
- tabIndex: j === 1 ? 0 : -1,
4526
+ tabIndex: M === 1 ? 0 : -1,
4514
4527
  icon: /* @__PURE__ */ _(Se, { size: 14 }),
4515
4528
  onClick: (e) => {
4516
- e.stopPropagation(), ke(k.pathId);
4529
+ e.stopPropagation(), U(A.pathId);
4517
4530
  },
4518
- title: d.remove,
4519
- "aria-label": d.remove
4531
+ title: h.remove,
4532
+ "aria-label": h.remove
4520
4533
  })
4521
4534
  })]
4522
4535
  }) })
@@ -4533,15 +4546,15 @@ var jr = {
4533
4546
  actions: "ick-actions-CWq8"
4534
4547
  }, Mr = (e) => {
4535
4548
  navigator.clipboard?.writeText(e);
4536
- }, Nr = a(function({ turn: e, isActiveInput: t = !1, inputRef: n = null, placeholder: r, animationConfig: i, foldMotion: a, openArtifactId: o = null, onOpenArtifact: s, entranceDelay: c = 0, selectionMode: l = "marker", questionAlign: u = "end", onDraft: d, onSubmit: f, onStop: p, onEdit: m, onCancelEdit: h, onCopy: g = Mr, onHighlight: y, onReplyInThread: b, onRegenerate: x, onShowVersion: S, onFeedback: w, feedback: T = null, answerActions: E = !0, onAnswerQuestion: D, onEditQuestion: O, onDecideApproval: k, renderPart: A, composerMenu: j, labels: M, className: ee, onTranscribe: N }) {
4537
- let P = q(), F = P ? 0 : -16, te = e.parts ?? [], I = te.find((e) => e.kind === "sources")?.sources, L = /* @__PURE__ */ v(C.article, {
4549
+ }, Nr = a(function({ turn: e, isActiveInput: t = !1, inputRef: n = null, placeholder: r, animationConfig: i, foldMotion: a, openArtifactId: o = null, onOpenArtifact: s, onArtifactChange: c, entranceDelay: l = 0, selectionMode: u = "marker", highlights: d = !0, questionAlign: f = "end", onDraft: p, onSubmit: m, onStop: h, busy: g, onEdit: y, onCancelEdit: b, onCopy: x = Mr, onHighlight: S, onReplyInThread: w, onRegenerate: T, onShowVersion: E, onFeedback: D, feedback: O = null, answerActions: k = !0, onAnswerQuestion: A, onEditQuestion: j, onDecideApproval: M, renderPart: N, composerMenu: ee, labels: P, className: F, onTranscribe: I }) {
4550
+ let te = q(), L = te ? 0 : -16, ne = e.parts ?? [], re = ne.find((e) => e.kind === "sources")?.sources, ie = /* @__PURE__ */ v(C.article, {
4538
4551
  id: `turn-${e.id}`,
4539
- className: [jr.turn, ee ?? ""].filter(Boolean).join(" "),
4552
+ className: [jr.turn, F ?? ""].filter(Boolean).join(" "),
4540
4553
  "data-active-input": t || void 0,
4541
4554
  "aria-busy": e.state === "responding" || void 0,
4542
4555
  initial: {
4543
4556
  opacity: 0,
4544
- y: F
4557
+ y: L
4545
4558
  },
4546
4559
  animate: {
4547
4560
  opacity: 1,
@@ -4549,43 +4562,44 @@ var jr = {
4549
4562
  },
4550
4563
  exit: {
4551
4564
  opacity: 0,
4552
- y: F
4565
+ y: L
4553
4566
  },
4554
4567
  transition: {
4555
- duration: P ? .15 : .4,
4568
+ duration: te ? .15 : .4,
4556
4569
  ease: [
4557
4570
  .22,
4558
4571
  1,
4559
4572
  .36,
4560
4573
  1
4561
4574
  ],
4562
- delay: c
4575
+ delay: l
4563
4576
  },
4564
4577
  children: [/* @__PURE__ */ _("div", {
4565
4578
  className: jr.question,
4566
- "data-align": u,
4579
+ "data-align": f,
4567
4580
  children: /* @__PURE__ */ _(ot, {
4568
4581
  ref: n,
4569
- style: u === "stretch" ? { width: "100%" } : void 0,
4582
+ style: f === "stretch" ? { width: "100%" } : void 0,
4570
4583
  state: e.state,
4571
4584
  value: e.user,
4572
- onChange: (t) => d?.(e.id, t),
4573
- onSubmit: (t, n) => f?.(e.id, t, n),
4585
+ onChange: (t) => p?.(e.id, t),
4586
+ onSubmit: (t, n) => m?.(e.id, t, n),
4574
4587
  attachments: e.attachments,
4575
- onStop: p,
4576
- onTranscribe: N,
4577
- onCopy: g,
4578
- onEdit: () => m?.(e.id),
4579
- onCancelEdit: () => h?.(e.id),
4588
+ onStop: h,
4589
+ busy: g,
4590
+ onTranscribe: I,
4591
+ onCopy: x,
4592
+ onEdit: () => y?.(e.id),
4593
+ onCancelEdit: () => b?.(e.id),
4580
4594
  isEditing: e.ai.length > 0 && e.state === "typing",
4581
4595
  animationConfig: i,
4582
4596
  placeholder: r,
4583
- menu: j
4597
+ menu: ee
4584
4598
  })
4585
4599
  }), /* @__PURE__ */ v("div", {
4586
4600
  className: jr.body,
4587
4601
  children: [
4588
- te.map((t) => {
4602
+ ne.map((t) => {
4589
4603
  switch (t.kind) {
4590
4604
  case "reasoning": return /* @__PURE__ */ _(Vt, {
4591
4605
  state: t.state,
@@ -4621,7 +4635,7 @@ var jr = {
4621
4635
  description: t.description,
4622
4636
  decision: t.decision ?? null,
4623
4637
  choices: t.choices,
4624
- onDecide: (n) => k?.(e.id, t.id, n),
4638
+ onDecide: (n) => M?.(e.id, t.id, n),
4625
4639
  children: t.tool && /* @__PURE__ */ _(cn, {
4626
4640
  name: t.tool.name,
4627
4641
  state: "pending",
@@ -4653,11 +4667,15 @@ var jr = {
4653
4667
  collapsible: t.collapsible,
4654
4668
  readOnly: t.readOnly,
4655
4669
  foldMotion: a,
4656
- onCommit: (n, r) => D?.(e.id, t.id, n, r),
4657
- onEdit: (n) => O?.(e.id, t.id, n)
4670
+ onCommit: (n, r) => A?.(e.id, t.id, n, r),
4671
+ onEdit: (n) => j?.(e.id, t.id, n)
4658
4672
  }, t.id);
4659
4673
  case "custom": {
4660
- let n = A?.(t, { turnId: e.id });
4674
+ let n = N?.(t, {
4675
+ turnId: e.id,
4676
+ openArtifact: (t) => c ? c(t) : s?.(e.id, t),
4677
+ closeArtifact: () => c?.(null)
4678
+ });
4661
4679
  return n == null || n === !1 ? null : /* @__PURE__ */ _("div", {
4662
4680
  className: jr.custom,
4663
4681
  "data-part": "custom",
@@ -4667,7 +4685,7 @@ var jr = {
4667
4685
  }
4668
4686
  }
4669
4687
  }),
4670
- e.state === "responding" && !e.ai && te.length === 0 && /* @__PURE__ */ _("div", {
4688
+ e.state === "responding" && !e.ai && ne.length === 0 && /* @__PURE__ */ _("div", {
4671
4689
  className: jr.answer,
4672
4690
  children: /* @__PURE__ */ _(Mt, {})
4673
4691
  }),
@@ -4675,32 +4693,33 @@ var jr = {
4675
4693
  className: jr.answer,
4676
4694
  children: [/* @__PURE__ */ _(Ar, {
4677
4695
  text: e.ai,
4678
- selectionMode: l,
4679
- sources: I,
4680
- onHighlightComplete: (t) => y?.(e.id, t),
4681
- onReplyInThread: b
4682
- }), E && e.state === "resting" && /* @__PURE__ */ v("div", {
4696
+ marking: d,
4697
+ selectionMode: u,
4698
+ sources: re,
4699
+ onHighlightComplete: d ? (t) => S?.(e.id, t) : void 0,
4700
+ onReplyInThread: d ? w : void 0
4701
+ }), k && e.state === "resting" && /* @__PURE__ */ v("div", {
4683
4702
  className: jr.actions,
4684
4703
  children: [/* @__PURE__ */ _(At, {
4685
4704
  total: e.versions?.length ?? 0,
4686
4705
  index: e.versionIndex ?? 0,
4687
- onSelect: (t) => S?.(e.id, t)
4706
+ onSelect: (t) => E?.(e.id, t)
4688
4707
  }), /* @__PURE__ */ _(Ot, {
4689
4708
  text: e.ai,
4690
- onCopy: g,
4691
- onRegenerate: x ? () => x(e.id) : void 0,
4692
- onFeedback: w ? (t) => w(e.id, t) : void 0,
4693
- feedback: T
4709
+ onCopy: x,
4710
+ onRegenerate: T ? () => T(e.id) : void 0,
4711
+ onFeedback: D ? (t) => D(e.id, t) : void 0,
4712
+ feedback: O
4694
4713
  })]
4695
4714
  })]
4696
4715
  })
4697
4716
  ]
4698
4717
  })]
4699
4718
  });
4700
- return M ? /* @__PURE__ */ _(ke, {
4701
- labels: M,
4702
- children: L
4703
- }) : L;
4719
+ return P ? /* @__PURE__ */ _(Ae, {
4720
+ labels: P,
4721
+ children: ie
4722
+ }) : ie;
4704
4723
  }, (e, t) => {
4705
4724
  let n = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
4706
4725
  for (let r of n) {
@@ -4735,7 +4754,7 @@ function Fr(e) {
4735
4754
  }
4736
4755
  var Ir = 6, Lr = 2 * Math.PI * Ir;
4737
4756
  function Rr({ used: e, total: t, warnAt: n = .8, label: r, labels: i, className: a, ...o }) {
4738
- let s = U("context", i), c = t > 0 ? Math.min(1, Math.max(0, e / t)) : 0, l = Math.round(c * 100), u = c >= n, d = r === !1 ? null : r ?? `${l}%`, f = `${s.name}: ${l}%, ${Fr(e)} ${s.of} ${Fr(t)} ${s.tokens}${u ? `. ${s.nearlyFull}` : ""}`;
4757
+ let s = H("context", i), c = t > 0 ? Math.min(1, Math.max(0, e / t)) : 0, l = Math.round(c * 100), u = c >= n, d = r === !1 ? null : r ?? `${l}%`, f = `${s.name}: ${l}%, ${Fr(e)} ${s.of} ${Fr(t)} ${s.tokens}${u ? `. ${s.nearlyFull}` : ""}`;
4739
4758
  return /* @__PURE__ */ v("div", {
4740
4759
  className: [Pr.context, a ?? ""].filter(Boolean).join(" "),
4741
4760
  "data-warn": u || void 0,
@@ -4786,7 +4805,7 @@ var zr = {
4786
4805
  //#endregion
4787
4806
  //#region src/Artifact/ArtifactPane.tsx
4788
4807
  function Br({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expanded: a = !1, onToggleExpanded: o, closeLabel: s, expandLabel: u, collapseLabel: d, className: f, ...m }) {
4789
- let h = U("pane"), g = s ?? h.close, y = u ?? h.expand, b = d ?? h.collapse, x = l(), S = p(null), C = p(null);
4808
+ let h = H("pane"), g = s ?? h.close, y = u ?? h.expand, b = d ?? h.collapse, x = l(), S = p(null), C = p(null);
4790
4809
  return c(() => {
4791
4810
  C.current?.focus({ preventScroll: !0 });
4792
4811
  }, []), c(() => {
@@ -4833,7 +4852,7 @@ function Br({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expande
4833
4852
  o && !i && /* @__PURE__ */ _(V, {
4834
4853
  variant: "ghost",
4835
4854
  size: "s",
4836
- icon: _(a ? se : ie, {
4855
+ icon: _(a ? se : R, {
4837
4856
  size: 15,
4838
4857
  "aria-hidden": !0
4839
4858
  }),
@@ -4881,8 +4900,8 @@ function Vr() {
4881
4900
  var Hr = {
4882
4901
  layout: "ick-layout-nC6G",
4883
4902
  chat: "ick-chat-OTXm",
4884
- slot: "ick-slot-O--R",
4885
4903
  card: "ick-card-Iddg",
4904
+ slot: "ick-slot-O--R",
4886
4905
  scrim: "ick-scrim-11Pp"
4887
4906
  }, Ur = 760, Wr = {
4888
4907
  closed: {
@@ -4957,10 +4976,10 @@ var Hr = {
4957
4976
  ...Jr
4958
4977
  }
4959
4978
  });
4960
- function Xr({ children: e, pane: t, onDismiss: n, className: r, ...i }) {
4961
- let a = p(null), [s, l] = m(!1), [u, d] = m(!1), h = o(() => d((e) => !e), []), g = E(), [b, x, S] = f(() => {
4962
- let e = s ? Kr : Wr, t = s ? void 0 : Gr;
4963
- return g ? [
4979
+ function Xr({ children: e, pane: t, onDismiss: n, surface: r = "flush", className: i, ...a }) {
4980
+ let s = p(null), [l, u] = m(!1), [d, h] = m(!1), g = o(() => h((e) => !e), []), b = E(), [x, S, w] = f(() => {
4981
+ let e = l ? Kr : Wr, t = l ? void 0 : Gr;
4982
+ return b ? [
4964
4983
  Yr(e),
4965
4984
  t && Yr(t),
4966
4985
  Yr(qr)
@@ -4969,49 +4988,50 @@ function Xr({ children: e, pane: t, onDismiss: n, className: r, ...i }) {
4969
4988
  t,
4970
4989
  qr
4971
4990
  ];
4972
- }, [g, s]);
4991
+ }, [b, l]);
4973
4992
  c(() => {
4974
- let e = a.current;
4993
+ let e = s.current;
4975
4994
  if (!e || typeof ResizeObserver > "u") return;
4976
4995
  let t = new ResizeObserver(([e]) => {
4977
- l(e.contentRect.width <= Ur);
4996
+ u(e.contentRect.width <= Ur);
4978
4997
  });
4979
4998
  return t.observe(e), () => t.disconnect();
4980
4999
  }, []);
4981
- let w = t?.({
4982
- narrow: s,
4983
- expanded: u,
4984
- toggleExpanded: h
5000
+ let T = t?.({
5001
+ narrow: l,
5002
+ expanded: d,
5003
+ toggleExpanded: g
4985
5004
  });
4986
5005
  return /* @__PURE__ */ v("div", {
4987
- ref: a,
4988
- className: [Hr.layout, r ?? ""].filter(Boolean).join(" "),
4989
- "data-pane": w ? "" : void 0,
4990
- ...i,
5006
+ ref: s,
5007
+ className: [Hr.layout, i ?? ""].filter(Boolean).join(" "),
5008
+ "data-pane": T ? "" : void 0,
5009
+ "data-surface": r === "panes" ? "panes" : void 0,
5010
+ ...a,
4991
5011
  children: [/* @__PURE__ */ _("div", {
4992
5012
  className: Hr.chat,
4993
5013
  children: e
4994
5014
  }), /* @__PURE__ */ v(y, {
4995
5015
  initial: !1,
4996
- children: [w && s && n && /* @__PURE__ */ _(C.div, {
5016
+ children: [T && l && n && /* @__PURE__ */ _(C.div, {
4997
5017
  className: Hr.scrim,
4998
- variants: S,
5018
+ variants: w,
4999
5019
  initial: "closed",
5000
5020
  animate: "open",
5001
5021
  exit: "closed",
5002
5022
  "aria-hidden": !0,
5003
5023
  onClick: n
5004
- }, "scrim"), w && /* @__PURE__ */ _(C.div, {
5024
+ }, "scrim"), T && /* @__PURE__ */ _(C.div, {
5005
5025
  className: Hr.slot,
5006
- variants: b,
5026
+ variants: x,
5007
5027
  initial: "closed",
5008
5028
  animate: "open",
5009
5029
  exit: "closed",
5010
5030
  children: /* @__PURE__ */ _(C.div, {
5011
5031
  className: Hr.card,
5012
- "data-expanded": u && !s || void 0,
5013
- variants: x,
5014
- ...s && n ? {
5032
+ "data-expanded": d && !l || void 0,
5033
+ variants: S,
5034
+ ...l && n ? {
5015
5035
  drag: "y",
5016
5036
  dragConstraints: {
5017
5037
  top: 0,
@@ -5026,9 +5046,9 @@ function Xr({ children: e, pane: t, onDismiss: n, className: r, ...i }) {
5026
5046
  (t.offset.y > 120 || t.velocity.y > 600) && n();
5027
5047
  }
5028
5048
  } : {},
5029
- children: w
5049
+ children: T
5030
5050
  })
5031
- }, s ? "sheet" : "beside")]
5051
+ }, l ? "sheet" : "beside")]
5032
5052
  })]
5033
5053
  });
5034
5054
  }
@@ -5050,30 +5070,48 @@ var Qr = {
5050
5070
  jump: "ick-jump-nd6O"
5051
5071
  }, $r = 64, ei = 500, ti = 4, ni = (e, t) => e.offsetTop - t.offsetTop, ri = (e, t) => t ? e.querySelector(`[id="${CSS.escape(t)}"]`) : null, ii = (e, t, n) => {
5052
5072
  n !== t.current && (t.current = n, e.style.setProperty("--ick-conversation-tail", `${Math.round(n)}px`));
5053
- }, ai = r(function({ children: e, anchorId: t, anchorOffset: n = 0, endOffset: r = 0, tail: i = "auto", threshold: a = $r, scrollButton: s = !0, scrollButtonLabel: l, follow: f = !0, className: h, viewportClassName: g, onScroll: y, ...b }, x) {
5054
- let S = U("conversation").jump, C = l ?? S, w = p(null);
5055
- u(x, () => w.current, []);
5056
- let T = p(null), [E, O] = m(!0), k = p(-1), A = p(null), j = p(!1), M = o(() => {
5057
- let e = w.current, t = T.current;
5073
+ }, ai = r(function({ children: e, anchorId: t, anchorOffset: n = 0, endOffset: r = 0, tail: i = "auto", threshold: a = $r, scrollButton: s = !0, scrollButtonLabel: l, follow: f = !0, dock: h = !1, className: g, viewportClassName: y, onScroll: b, ...x }, S) {
5074
+ let C = H("conversation").jump, w = l ?? C, T = p(null);
5075
+ u(S, () => T.current, []);
5076
+ let E = p(null), O = p(null), [k, A] = m(!0);
5077
+ c(() => {
5078
+ if (!h) return;
5079
+ let e = E.current, t = O.current;
5080
+ if (!e || !t || typeof ResizeObserver > "u") return;
5081
+ let n = () => {
5082
+ let n = e.lastElementChild;
5083
+ t.style.setProperty("--ick-dock-height", `${n?.offsetHeight ?? 0}px`);
5084
+ }, r = new ResizeObserver(n);
5085
+ return r.observe(e), n(), () => {
5086
+ r.disconnect(), t.style.removeProperty("--ick-dock-height");
5087
+ };
5088
+ }, [h]);
5089
+ let j = p(-1), M = p(null), N = p(!1), ee = o(() => {
5090
+ let e = T.current, t = E.current;
5058
5091
  if (!e || !t) return 0;
5059
- if (i === "auto" && j.current) return Math.max(0, e.scrollHeight - e.clientHeight);
5060
- let n = t.lastElementChild, a = n ? ni(n, e) + n.offsetHeight : ni(t, e) + t.offsetHeight - k.current;
5092
+ if (i === "auto" && N.current) return Math.max(0, e.scrollHeight - e.clientHeight);
5093
+ let n = h ? null : t.lastElementChild, a = n ? ni(n, e) + n.offsetHeight : ni(t, e) + t.offsetHeight - (h ? 0 : j.current);
5061
5094
  return Math.max(0, a + r - e.clientHeight);
5062
- }, [r, i]), ee = o(() => {
5063
- let e = w.current, a = T.current;
5095
+ }, [
5096
+ h,
5097
+ r,
5098
+ i
5099
+ ]), P = o(() => {
5100
+ let e = T.current, a = E.current;
5064
5101
  if (!e || !a) return;
5065
- if (i !== "auto") return ii(a, k, Math.max(0, i));
5066
- let o = parseFloat(getComputedStyle(e).paddingBottom) || 0, s = Math.max(0, r - o), c = a.lastElementChild, l = ri(e, A.current);
5067
- if (j.current = !!c && !!l, !j.current || !c || !l) return ii(a, k, s);
5068
- let u = ni(c, e) + c.offsetHeight - ni(l, e), d = Math.max(s, e.clientHeight - n - u - o);
5069
- ii(a, k, t ? Math.max(d, k.current) : d);
5102
+ if (i !== "auto") return ii(a, j, Math.max(0, i));
5103
+ let o = parseFloat(getComputedStyle(e).paddingBottom) || 0, s = Math.max(0, r - o), c = a.lastElementChild, l = ri(e, M.current);
5104
+ if (N.current = !!c && !!l, !N.current || !c || !l) return ii(a, j, s);
5105
+ let u = ni(c, e) + c.offsetHeight - ni(l, e), d = h ? Math.max(s, j.current + (ni(l, e) - n - (e.scrollHeight - e.clientHeight))) : Math.max(s, e.clientHeight - n - u - o);
5106
+ ii(a, j, t ? Math.max(d, j.current) : d);
5070
5107
  }, [
5071
5108
  i,
5072
5109
  n,
5073
5110
  r,
5074
- t
5075
- ]), N = o(() => {
5076
- let e = w.current;
5111
+ t,
5112
+ h
5113
+ ]), F = o(() => {
5114
+ let e = T.current;
5077
5115
  if (!e) return 0;
5078
5116
  if (t) {
5079
5117
  let r = e.querySelector(`[id="${CSS.escape(t)}"]`);
@@ -5082,66 +5120,66 @@ var Qr = {
5082
5120
  return Math.max(0, Math.min(Math.max(a, o), t));
5083
5121
  }
5084
5122
  }
5085
- return M();
5123
+ return ee();
5086
5124
  }, [
5087
5125
  t,
5088
5126
  n,
5089
- M
5090
- ]), P = p(0), F = p(null), te = o((e) => {
5091
- let t = w.current;
5127
+ ee
5128
+ ]), I = p(0), te = p(null), L = o((e) => {
5129
+ let t = T.current;
5092
5130
  if (!t) return;
5093
5131
  let n = e && !q();
5094
- P.current = n ? performance.now() + ei : 0, t.scrollTo({
5095
- top: N(),
5132
+ I.current = n ? performance.now() + ei : 0, t.scrollTo({
5133
+ top: F(),
5096
5134
  behavior: n ? "smooth" : "auto"
5097
- }), O(!0);
5098
- }, [N]);
5135
+ }), A(!0);
5136
+ }, [F]);
5099
5137
  d(() => {
5100
- t && (A.current = t);
5101
- let e = w.current, n = T.current;
5102
- if (ee(), !e || !n || typeof ResizeObserver > "u") return;
5103
- let r = new ResizeObserver(ee);
5138
+ t && (M.current = t);
5139
+ let e = T.current, n = E.current;
5140
+ if (P(), !e || !n || typeof ResizeObserver > "u") return;
5141
+ let r = new ResizeObserver(P);
5104
5142
  return r.observe(n), r.observe(e), () => r.disconnect();
5105
- }, [t, ee]), d(() => {
5106
- if (!f || !E && !t) return;
5107
- let e = w.current, n = T.current;
5143
+ }, [t, P]), d(() => {
5144
+ if (!f || !k && !t) return;
5145
+ let e = T.current, n = E.current;
5108
5146
  if (!e || !n || typeof ResizeObserver > "u") return;
5109
5147
  let r = () => {
5110
- let n = N();
5111
- if (P.current) {
5112
- if (performance.now() < P.current && Math.abs(e.scrollTop - n) > 1) return;
5113
- P.current = 0;
5148
+ let n = F();
5149
+ if (I.current) {
5150
+ if (performance.now() < I.current && Math.abs(e.scrollTop - n) > 1) return;
5151
+ I.current = 0;
5114
5152
  }
5115
5153
  let r = n - e.scrollTop;
5116
- if (A.current && !t && Math.abs(r) > a && !q()) {
5117
- P.current = performance.now() + ei, e.scrollTo({
5154
+ if (M.current && !t && Math.abs(r) > a && !q()) {
5155
+ I.current = performance.now() + ei, e.scrollTo({
5118
5156
  top: n,
5119
5157
  behavior: "smooth"
5120
5158
  });
5121
5159
  return;
5122
5160
  }
5123
5161
  e.scrollTop = n;
5124
- }, i = t != null && t !== F.current;
5125
- t && (F.current = t), i && !q() && Math.abs(e.scrollTop - N()) > a ? (P.current = performance.now() + ei, e.scrollTo({
5126
- top: N(),
5162
+ }, i = t != null && t !== te.current;
5163
+ t && (te.current = t), i && !q() && Math.abs(e.scrollTop - F()) > a ? (I.current = performance.now() + ei, e.scrollTo({
5164
+ top: F(),
5127
5165
  behavior: "smooth"
5128
5166
  })) : r();
5129
5167
  let o = new ResizeObserver(r);
5130
5168
  return o.observe(n), () => o.disconnect();
5131
5169
  }, [
5132
5170
  f,
5133
- E,
5134
- N,
5171
+ k,
5172
+ F,
5135
5173
  t,
5136
5174
  a
5137
5175
  ]), c(() => {
5138
5176
  if (!f) return;
5139
- let e = w.current;
5177
+ let e = T.current;
5140
5178
  if (!e) return;
5141
5179
  let n = () => {
5142
- P.current = 0, Math.abs(e.scrollTop - N()) > a && O(!1);
5180
+ I.current = 0, Math.abs(e.scrollTop - F()) > a && A(!1);
5143
5181
  }, r = (e) => {
5144
- t ? n() : e.deltaY < 0 && O(!1);
5182
+ t ? n() : e.deltaY < 0 && A(!1);
5145
5183
  }, i = (e) => {
5146
5184
  [
5147
5185
  "ArrowUp",
@@ -5154,10 +5192,10 @@ var Qr = {
5154
5192
  "ArrowUp",
5155
5193
  "PageUp",
5156
5194
  "Home"
5157
- ].includes(e.key) && O(!1));
5195
+ ].includes(e.key) && A(!1));
5158
5196
  }, o = (e) => {
5159
5197
  let t = e.target;
5160
- t instanceof Element && t.closest("[aria-expanded]") && O(!1);
5198
+ t instanceof Element && t.closest("[aria-expanded]") && A(!1);
5161
5199
  };
5162
5200
  return e.addEventListener("wheel", r, { passive: !0 }), e.addEventListener("touchmove", n, { passive: !0 }), e.addEventListener("keydown", i), e.addEventListener("pointerdown", o, { passive: !0 }), () => {
5163
5201
  e.removeEventListener("wheel", r), e.removeEventListener("touchmove", n), e.removeEventListener("keydown", i), e.removeEventListener("pointerdown", o);
@@ -5165,38 +5203,41 @@ var Qr = {
5165
5203
  }, [
5166
5204
  f,
5167
5205
  a,
5168
- N,
5206
+ F,
5169
5207
  t
5170
5208
  ]);
5171
- let I = o((e) => {
5172
- if (y?.(e), !f) return;
5173
- let t = w.current;
5174
- t && Math.abs(t.scrollTop - N()) <= ti && (P.current = 0, O(!0));
5209
+ let ne = o((e) => {
5210
+ if (b?.(e), !f) return;
5211
+ let t = T.current;
5212
+ t && Math.abs(t.scrollTop - F()) <= ti && (I.current = 0, A(!0));
5175
5213
  }, [
5176
5214
  f,
5177
- y,
5178
- N
5179
- ]), L = f && !E;
5215
+ b,
5216
+ F
5217
+ ]), re = f && !k;
5180
5218
  return /* @__PURE__ */ v("div", {
5181
- className: [Qr.root, h ?? ""].filter(Boolean).join(" "),
5219
+ ref: O,
5220
+ className: [Qr.root, g ?? ""].filter(Boolean).join(" "),
5221
+ "data-dock": h || void 0,
5182
5222
  children: [/* @__PURE__ */ _("div", {
5183
- ref: w,
5184
- className: [Qr.viewport, g ?? ""].filter(Boolean).join(" "),
5185
- onScroll: I,
5186
- ...b,
5223
+ ref: T,
5224
+ className: [Qr.viewport, y ?? ""].filter(Boolean).join(" "),
5225
+ onScroll: ne,
5226
+ ...x,
5187
5227
  children: /* @__PURE__ */ _("div", {
5188
- ref: T,
5228
+ ref: E,
5189
5229
  className: Qr.content,
5230
+ "data-dock": h || void 0,
5190
5231
  children: e
5191
5232
  })
5192
5233
  }), s && /* @__PURE__ */ _("button", {
5193
5234
  type: "button",
5194
5235
  className: Qr.jump,
5195
- "data-shown": L || void 0,
5196
- tabIndex: L ? 0 : -1,
5197
- "aria-hidden": !L || void 0,
5198
- onClick: () => te(!0),
5199
- "aria-label": C,
5236
+ "data-shown": re || void 0,
5237
+ tabIndex: re ? 0 : -1,
5238
+ "aria-hidden": !re || void 0,
5239
+ onClick: () => L(!0),
5240
+ "aria-label": w,
5200
5241
  children: /* @__PURE__ */ _(D, {
5201
5242
  size: 15,
5202
5243
  "aria-hidden": !0
@@ -5213,7 +5254,7 @@ var Qr = {
5213
5254
  //#endregion
5214
5255
  //#region src/EmptyState/EmptyState.tsx
5215
5256
  function si({ icon: e, title: t, description: n, suggestions: r, onSuggestion: i, suggestionsLabel: a, children: o, className: s, ...c }) {
5216
- let l = U("emptyState").suggestions, u = a ?? l, d = i ? r ?? [] : [];
5257
+ let l = H("emptyState").suggestions, u = a ?? l, d = i ? r ?? [] : [];
5217
5258
  return /* @__PURE__ */ v("div", {
5218
5259
  className: [oi.empty, s ?? ""].filter(Boolean).join(" "),
5219
5260
  ...c,
@@ -5299,7 +5340,7 @@ var Q = {
5299
5340
  }
5300
5341
  }, hi = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [contenteditable]:not([contenteditable=\"false\"]), [tabindex]:not([tabindex=\"-1\"])";
5301
5342
  function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5302
- let i = U("thread"), { responding: a } = U("experience"), [o, s] = m("none"), u = p(null), d = p(null), f = p(null), [h] = m(() => typeof document > "u" ? null : document.activeElement), g = l(), y = l(), b = rt, [S, w] = m(() => typeof window > "u" ? !1 : window.matchMedia?.(`(max-width: ${pi}px)`)?.matches ?? !1);
5343
+ let i = H("thread"), { responding: a } = H("experience"), [o, s] = m("none"), u = p(null), d = p(null), f = p(null), [h] = m(() => typeof document > "u" ? null : document.activeElement), g = l(), y = l(), b = rt, [S, w] = m(() => typeof window > "u" ? !1 : window.matchMedia?.(`(max-width: ${pi}px)`)?.matches ?? !1);
5303
5344
  c(() => {
5304
5345
  let e = window.matchMedia?.(`(max-width: ${pi}px)`);
5305
5346
  if (!e?.addEventListener) return;
@@ -5352,7 +5393,7 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5352
5393
  behavior: "smooth"
5353
5394
  });
5354
5395
  }, [E]);
5355
- let { x: ee, y: N, width: P, maxHeight: F } = typeof window > "u" ? {
5396
+ let { x: N, y: ee, width: P, maxHeight: F } = typeof window > "u" ? {
5356
5397
  x: 0,
5357
5398
  y: 0,
5358
5399
  width: 480,
@@ -5380,8 +5421,8 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5380
5421
  opacity: 0
5381
5422
  },
5382
5423
  animate: S ? "open" : {
5383
- left: ee,
5384
- top: N,
5424
+ left: N,
5425
+ top: ee,
5385
5426
  width: P,
5386
5427
  borderRadius: 28,
5387
5428
  opacity: 1
@@ -5701,6 +5742,9 @@ function vi(e) {
5701
5742
  var $ = {
5702
5743
  page: "ick-page-NK01",
5703
5744
  feed: "ick-feed-XqZl",
5745
+ dock: "ick-dock-tvIC",
5746
+ centred: "ick-centred-5tu8",
5747
+ paned: "ick-paned-MM8c",
5704
5748
  topBlur: "ick-topBlur-69Dl",
5705
5749
  bottomBlur: "ick-bottomBlur-MXmb",
5706
5750
  header: "ick-header-pQ7Z",
@@ -5717,100 +5761,134 @@ var $ = {
5717
5761
  groupTitle: "ick-groupTitle-jiBB",
5718
5762
  marks: "ick-marks-gwsN",
5719
5763
  mark: "ick-mark-QkpW"
5720
- }, yi = () => "";
5721
- function bi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !0, composerMenu: a, onTranscribe: s, onThreadReply: l, title: u, backHref: d, backLabel: h, actions: b, placeholder: x, empty: S, contextTotal: w, contextBase: T = 0, artifact: E, theme: D, onThemeChange: O, cursor: A = !1, selectionToggle: j = !1, anchorOffset: M = 100, endOffset: ee = 120, animationConfig: N, foldMotion: P, feedDelay: F = 0, onAnswerQuestion: te, onEditQuestion: I, onDecideApproval: L, className: re }) {
5722
- let R = U("experience", r?.experience), ie = u ?? R.title, [ae, oe] = m([]), [se, le] = m(!1), [ue, de] = m(null), [fe, z] = m("marker"), pe = p(null), me = D !== void 0, [he, _e] = m(null), be = me ? D : he, [xe, Se] = m(() => typeof window < "u" && !!window.matchMedia?.("(prefers-color-scheme: dark)").matches);
5764
+ }, yi = () => "", bi = {
5765
+ stiffness: 170,
5766
+ damping: 24,
5767
+ mass: 1
5768
+ };
5769
+ function xi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !0, composerMenu: a, onTranscribe: s, onThreadReply: l, title: u, backHref: d, backLabel: h, actions: b, placeholder: x, empty: S, contextTotal: w, contextBase: T = 0, artifact: E, openArtifactId: D, onOpenArtifactChange: O, pane: A = "inline", surface: j = "flush", composer: M = "inline", theme: N, onThemeChange: ee, cursor: P = !1, selectionToggle: F = !1, highlights: I = !0, bookmarks: te = !0, anchorOffset: L = 100, endOffset: re = 120, animationConfig: ie, foldMotion: R, feedDelay: ae = 0, onAnswerQuestion: oe, onEditQuestion: se, onDecideApproval: le, className: ue }) {
5770
+ let z = H("experience", r?.experience), de = u ?? z.title, [fe, pe] = m([]), [me, he] = m(!1), [_e, be] = m(null), [xe, Se] = m("marker"), Ce = p(null), we = N !== void 0, [B, Te] = m(null), Ee = we ? N : B, [V, De] = m(() => typeof window < "u" && !!window.matchMedia?.("(prefers-color-scheme: dark)").matches);
5723
5771
  c(() => {
5724
- let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => Se(e.matches);
5772
+ let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => De(e.matches);
5725
5773
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
5726
5774
  }, []);
5727
- let Ce = be ?? (xe ? "dark" : "light");
5728
- vi(be);
5729
- let we = o((e) => {
5730
- me || _e(e), O?.(e);
5731
- }, [me, O]), B = ht({
5775
+ let Oe = Ee ?? (V ? "dark" : "light");
5776
+ vi(Ee);
5777
+ let ke = o((e) => {
5778
+ we || Te(e), ee?.(e);
5779
+ }, [we, ee]), U = M === "docked", Me = f(() => U ? {
5780
+ ...rt,
5781
+ ...ie,
5782
+ bubble: ie?.bubble ?? bi
5783
+ } : ie, [U, ie]), Ne = ht({
5732
5784
  onSend: e ?? yi,
5733
- announcements: { responding: R.responding }
5734
- }), { turns: Te, setDraft: Ee, submit: V, showVersion: H, stop: De, beginEdit: Oe, cancelEdit: je, updatePart: Me } = t ?? B, [Ne, Pe] = m(null), Fe = o((e, t, n) => {
5735
- Pe(e), V(e, t, n);
5736
- }, [V]), Ie = Ne ? Te.find((e) => e.id === Ne) ?? null : null, Le = Ie && Ie.state !== "resting" ? Ne : null, W = o((e) => {
5737
- Pe(e), V(e);
5738
- }, [V]), Re = Te.length === 1 && !Te[0].user && !Te[0].ai, ze = T + Math.round(Te.reduce((e, t) => e + t.user.length + t.ai.length + JSON.stringify(t.parts ?? []).length, 0) / 4), Be = w !== void 0 && ze >= w, Ve = p(!1);
5785
+ announcements: { responding: z.responding },
5786
+ nextTurn: U ? "at-send" : "after-answer"
5787
+ }), { turns: Pe, setDraft: Fe, submit: Ie, showVersion: Le, stop: W, beginEdit: Re, cancelEdit: ze, updatePart: Be, isStreaming: Ve } = t ?? Ne, [He, Ue] = m(null), We = o((e, t, n) => {
5788
+ Ue(e), Ie(e, t, n);
5789
+ }, [Ie]), Ge = He ? Pe.find((e) => e.id === He) ?? null : null, G = Ge && Ge.state !== "resting" ? He : null, [K, q] = m(0);
5739
5790
  c(() => {
5740
- if (!Be) {
5741
- Ve.current = !1;
5791
+ if (!U) return;
5792
+ let e = window.visualViewport;
5793
+ if (!e) return;
5794
+ let t = () => q(Math.max(0, Math.round(window.innerHeight - e.height)));
5795
+ return t(), e.addEventListener("resize", t), () => e.removeEventListener("resize", t);
5796
+ }, [U]);
5797
+ let qe = o((e) => {
5798
+ Ue(e), Ie(e);
5799
+ }, [Ie]), Je = Pe.length === 1 && !Pe[0].user && !Pe[0].ai, Ye = T + Math.round(Pe.reduce((e, t) => e + t.user.length + t.ai.length + JSON.stringify(t.parts ?? []).length, 0) / 4), Xe = w !== void 0 && Ye >= w, Ze = p(!1);
5800
+ c(() => {
5801
+ if (!Xe) {
5802
+ Ze.current = !1;
5742
5803
  return;
5743
5804
  }
5744
- Ve.current || (Ve.current = !0, G(R.windowFull));
5745
- }, [Be, R.windowFull]);
5746
- let He = Zr(), [Ue, We] = m({}), Ge = o((e, t) => {
5747
- We((n) => ({
5805
+ Ze.current || (Ze.current = !0, Ke(z.windowFull));
5806
+ }, [Xe, z.windowFull]);
5807
+ let Qe = Zr(), $e = D !== void 0, et = $e ? D : Qe.openId, tt = p({
5808
+ openArtifactId: et,
5809
+ artifactHeld: $e,
5810
+ onOpenArtifactChange: O
5811
+ });
5812
+ c(() => {
5813
+ tt.current = {
5814
+ openArtifactId: et,
5815
+ artifactHeld: $e,
5816
+ onOpenArtifactChange: O
5817
+ };
5818
+ });
5819
+ let nt = Qe.open, it = Qe.close, at = o((e) => {
5820
+ let { artifactHeld: t, onOpenArtifactChange: n } = tt.current;
5821
+ t || (e === null ? it() : nt(e)), n?.(e);
5822
+ }, [nt, it]), ot = o(() => at(null), [at]), [st, ct] = m({}), lt = o((e, t) => {
5823
+ ct((n) => ({
5748
5824
  ...n,
5749
5825
  [e]: t
5750
5826
  }));
5751
- }, []), K = Te.find((e) => e.state !== "idle" && e.state !== "typing" && e.user.trim())?.user.trim() ?? ie, Ke = o((e, t) => {
5752
- t.trim().length > 0 && oe((n) => [...n, {
5827
+ }, []), ut = Pe.find((e) => e.state !== "idle" && e.state !== "typing" && e.user.trim())?.user.trim() ?? de, J = o((e, t) => {
5828
+ te && t.trim().length > 0 && pe((n) => [...n, {
5753
5829
  turnId: e,
5754
5830
  text: t.trim()
5755
5831
  }]);
5756
- }, []), q = He.toggle, qe = o((e, t) => q(t), [q]), Je = o((e, t) => {
5757
- de({
5832
+ }, [te]), dt = o((e, t) => at(tt.current.openArtifactId === t ? null : t), [at]), ft = o((e, t) => {
5833
+ be({
5758
5834
  text: e,
5759
5835
  rect: t
5760
5836
  });
5761
- }, []), Ye = f(() => te ? (e, t, n, r) => te(Me, e, t, n, r) : void 0, [te, Me]), Xe = f(() => I ? (e, t, n) => I(Me, e, t, n) : void 0, [I, Me]), Ze = f(() => L ? (e, t, n) => L(Me, e, t, n) : void 0, [L, Me]), [Qe, $e] = m(() => typeof window > "u" || !window.matchMedia || window.matchMedia("(pointer: fine)").matches);
5837
+ }, []), pt = f(() => oe ? (e, t, n, r) => oe(Be, e, t, n, r) : void 0, [oe, Be]), mt = f(() => se ? (e, t, n) => se(Be, e, t, n) : void 0, [se, Be]), Y = f(() => le ? (e, t, n) => le(Be, e, t, n) : void 0, [le, Be]), [gt, _t] = m(() => typeof window > "u" || !window.matchMedia || window.matchMedia("(pointer: fine)").matches);
5762
5838
  c(() => {
5763
- if (!A) return;
5764
- let e = window.matchMedia("(pointer: fine)"), t = () => $e(e.matches);
5839
+ if (!P) return;
5840
+ let e = window.matchMedia("(pointer: fine)"), t = () => _t(e.matches);
5765
5841
  return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
5766
- }, [A]);
5767
- let et = (e) => i === !0 || Array.isArray(i) && i.includes(e), tt = [
5768
- ...ae.length > 0 ? [{
5842
+ }, [P]);
5843
+ let vt = (e) => i === !0 || Array.isArray(i) && i.includes(e), yt = [
5844
+ ...I && te && fe.length > 0 ? [{
5769
5845
  id: "bookmarks",
5770
- label: R.savedHighlights,
5846
+ label: z.savedHighlights,
5771
5847
  icon: /* @__PURE__ */ _(k, {
5772
5848
  size: 16,
5773
5849
  "aria-hidden": !0
5774
5850
  }),
5775
- count: ae.length,
5851
+ count: fe.length,
5776
5852
  pinned: !0,
5777
- onClick: () => le(!0)
5853
+ onClick: () => he(!0)
5778
5854
  }] : [],
5779
- ...et("theme") ? [{
5855
+ ...vt("theme") ? [{
5780
5856
  id: "theme",
5781
- label: Ce === "dark" ? R.themeToLight : R.themeToDark,
5782
- icon: _(Ce === "dark" ? ve : ce, {
5857
+ label: Oe === "dark" ? z.themeToLight : z.themeToDark,
5858
+ icon: _(Oe === "dark" ? ve : ce, {
5783
5859
  size: 16,
5784
5860
  "aria-hidden": !0
5785
5861
  }),
5786
- active: Ce === "dark",
5787
- onClick: () => we(Ce === "dark" ? "light" : "dark")
5862
+ active: Oe === "dark",
5863
+ onClick: () => ke(Oe === "dark" ? "light" : "dark")
5788
5864
  }] : [],
5789
- ...et("share") ? [{
5865
+ ...vt("share") ? [{
5790
5866
  id: "share",
5791
- label: R.share,
5867
+ label: z.share,
5792
5868
  icon: /* @__PURE__ */ _(ge, {
5793
5869
  size: 16,
5794
5870
  "aria-hidden": !0
5795
5871
  }),
5796
5872
  onClick: () => navigator.share?.({
5797
- title: K,
5873
+ title: ut,
5798
5874
  url: window.location.href
5799
5875
  })
5800
5876
  }] : [],
5801
5877
  ...b ?? []
5802
- ], nt = He.openId ? E?.(He.openId) : null, rt = /* @__PURE__ */ v(C.div, {
5878
+ ], bt = A === "inline" && et ? E?.(et) : null, xt = /* @__PURE__ */ v(C.div, {
5803
5879
  className: [
5804
5880
  $.page,
5881
+ j === "panes" ? $.paned : "",
5805
5882
  "ick-chat-page",
5806
- re
5883
+ ue
5807
5884
  ].filter(Boolean).join(" "),
5808
- style: { "--ick-experience-anchor": `${M}px` },
5885
+ style: { "--ick-experience-anchor": `${L}px` },
5886
+ "data-composer": U ? "docked" : void 0,
5809
5887
  initial: { opacity: 0 },
5810
5888
  animate: {
5811
- opacity: ue || se ? .4 : 1,
5812
- filter: ue || se ? "blur(3px)" : "blur(0px)",
5813
- scale: ue || se ? .9 : 1
5889
+ opacity: _e || me ? .4 : 1,
5890
+ filter: _e || me ? "blur(3px)" : "blur(0px)",
5891
+ scale: _e || me ? .9 : 1
5814
5892
  },
5815
5893
  transition: {
5816
5894
  type: "spring",
@@ -5819,124 +5897,130 @@ function bi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
5819
5897
  mass: .9
5820
5898
  },
5821
5899
  onAnimationComplete: () => {
5822
- document.activeElement && document.activeElement !== document.body || pe.current?.focus();
5900
+ document.activeElement && document.activeElement !== document.body || Ce.current?.focus();
5823
5901
  },
5824
5902
  children: [
5825
5903
  /* @__PURE__ */ _("div", { className: $.topBlur }),
5826
5904
  /* @__PURE__ */ v(Ct, {
5827
5905
  className: `${$.header} ick-chat-header`,
5828
- title: K,
5906
+ title: ut,
5829
5907
  backHref: d,
5830
5908
  backLabel: h,
5831
5909
  elevateOnScroll: !1,
5832
5910
  collapseActionsAt: 480,
5833
- actions: tt,
5911
+ actions: yt,
5834
5912
  children: [w !== void 0 && /* @__PURE__ */ _(Rr, {
5835
5913
  className: $.context,
5836
- used: ze,
5914
+ used: Ye,
5837
5915
  total: w
5838
- }), j && /* @__PURE__ */ v("div", {
5916
+ }), F && I && /* @__PURE__ */ v("div", {
5839
5917
  className: $.selectMode,
5840
5918
  role: "group",
5841
- "aria-label": R.selectionMode,
5919
+ "aria-label": z.selectionMode,
5842
5920
  children: [/* @__PURE__ */ _("button", {
5843
5921
  type: "button",
5844
- "data-active": fe === "marker",
5845
- onClick: () => z("marker"),
5846
- "aria-label": R.marker,
5847
- title: R.marker,
5922
+ "data-active": xe === "marker",
5923
+ onClick: () => Se("marker"),
5924
+ "aria-label": z.marker,
5925
+ title: z.marker,
5848
5926
  children: /* @__PURE__ */ _(ne, { size: 16 })
5849
5927
  }), /* @__PURE__ */ _("button", {
5850
5928
  type: "button",
5851
- "data-active": fe === "precise",
5852
- onClick: () => z("precise"),
5853
- "aria-label": R.precise,
5854
- title: R.precise,
5929
+ "data-active": xe === "precise",
5930
+ onClick: () => Se("precise"),
5931
+ "aria-label": z.precise,
5932
+ title: z.precise,
5855
5933
  children: /* @__PURE__ */ _(ye, { size: 16 })
5856
5934
  })]
5857
5935
  })]
5858
5936
  }),
5859
5937
  /* @__PURE__ */ v(ai, {
5860
5938
  viewportClassName: `${$.feed} ick-chat-feed`,
5861
- anchorId: Le ? `turn-${Le}` : void 0,
5862
- anchorOffset: M,
5863
- endOffset: ee,
5939
+ anchorId: G ? `turn-${G}` : void 0,
5940
+ dock: U,
5941
+ anchorOffset: L,
5942
+ endOffset: U ? 0 : re,
5864
5943
  children: [
5865
- Re && S && /* @__PURE__ */ _(si, {
5866
- className: $.opening,
5944
+ Je && S && /* @__PURE__ */ _(si, {
5945
+ className: U ? `${$.opening} ${$.centred}` : $.opening,
5867
5946
  title: S.title,
5868
5947
  description: S.description,
5869
5948
  suggestions: S.suggestions,
5870
- onSuggestion: (e) => Fe(Te[0].id, e)
5949
+ onSuggestion: (e) => We(Pe[0].id, e)
5871
5950
  }),
5872
- /* @__PURE__ */ _(y, { children: Te.map((e, t) => {
5873
- let r = t === Te.length - 1 && (e.state === "idle" || e.state === "typing");
5951
+ /* @__PURE__ */ _(y, { children: Pe.map((e, t) => {
5952
+ let r = t === Pe.length - 1 && (e.state === "idle" || e.state === "typing");
5874
5953
  return /* @__PURE__ */ _(Nr, {
5875
5954
  turn: e,
5876
- questionAlign: Re && t === 0 ? "stretch" : "end",
5877
- className: Re && t === 0 ? $.opening : void 0,
5955
+ questionAlign: U && r || Je && t === 0 ? "stretch" : "end",
5956
+ className: U && r ? $.dock : Je && t === 0 ? $.opening : void 0,
5878
5957
  onTranscribe: s,
5879
5958
  isActiveInput: r,
5880
- inputRef: r ? pe : null,
5881
- entranceDelay: t === 0 ? F : 0,
5882
- selectionMode: fe,
5883
- animationConfig: N,
5884
- foldMotion: P,
5885
- openArtifactId: He.openId,
5886
- onOpenArtifact: qe,
5959
+ inputRef: r ? Ce : null,
5960
+ entranceDelay: t === 0 ? ae : 0,
5961
+ selectionMode: xe,
5962
+ highlights: I,
5963
+ animationConfig: Me,
5964
+ foldMotion: R,
5965
+ openArtifactId: et,
5966
+ onOpenArtifact: dt,
5967
+ onArtifactChange: at,
5887
5968
  placeholder: x,
5888
- onDraft: Ee,
5889
- onSubmit: Fe,
5890
- onRegenerate: W,
5891
- onShowVersion: H,
5892
- onFeedback: Ge,
5893
- feedback: Ue[e.id] ?? null,
5894
- onStop: De,
5895
- onEdit: Oe,
5896
- onCancelEdit: je,
5897
- onHighlight: Ke,
5898
- onReplyInThread: l ? Je : void 0,
5899
- onAnswerQuestion: Ye,
5900
- onEditQuestion: Xe,
5901
- onDecideApproval: Ze,
5969
+ onDraft: Fe,
5970
+ onSubmit: We,
5971
+ onRegenerate: qe,
5972
+ onShowVersion: Le,
5973
+ onFeedback: lt,
5974
+ feedback: st[e.id] ?? null,
5975
+ onStop: !U || r ? W : void 0,
5976
+ busy: U && r ? Ve : void 0,
5977
+ onEdit: Re,
5978
+ onCancelEdit: ze,
5979
+ onHighlight: J,
5980
+ onReplyInThread: l ? ft : void 0,
5981
+ onAnswerQuestion: pt,
5982
+ onEditQuestion: mt,
5983
+ onDecideApproval: Y,
5902
5984
  renderPart: n,
5903
5985
  composerMenu: a
5904
5986
  }, e.id);
5905
5987
  }) }),
5906
- Be && /* @__PURE__ */ _(zn, { children: R.windowFull })
5988
+ Xe && /* @__PURE__ */ _(zn, { children: z.windowFull })
5907
5989
  ]
5908
5990
  }),
5909
5991
  /* @__PURE__ */ _("div", { className: $.bottomBlur })
5910
5992
  ]
5911
5993
  });
5912
- return /* @__PURE__ */ v(ke, {
5994
+ return /* @__PURE__ */ v(Ae, {
5913
5995
  labels: r,
5914
5996
  children: [
5915
- A && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("style", { dangerouslySetInnerHTML: { __html: "@media (pointer: fine) { * { cursor: none !important; } }" } }), Qe && /* @__PURE__ */ _(_i, {})] }),
5997
+ P && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("style", { dangerouslySetInnerHTML: { __html: "@media (pointer: fine) { * { cursor: none !important; } }" } }), gt && /* @__PURE__ */ _(_i, {})] }),
5916
5998
  /* @__PURE__ */ _(Xr, {
5917
5999
  className: $.workspace,
5918
- onDismiss: He.close,
5919
- pane: ({ narrow: e, expanded: t, toggleExpanded: n }) => nt ? /* @__PURE__ */ _(Br, {
5920
- title: nt.title,
5921
- meta: nt.meta,
6000
+ surface: j,
6001
+ style: K > 0 ? { "--ick-keyboard": `${K}px` } : void 0,
6002
+ onDismiss: ot,
6003
+ pane: ({ narrow: e, expanded: t, toggleExpanded: n }) => bt ? /* @__PURE__ */ _(Br, {
6004
+ title: bt.title,
6005
+ meta: bt.meta,
5922
6006
  modal: e,
5923
6007
  expanded: t,
5924
6008
  onToggleExpanded: n,
5925
- onClose: He.close,
5926
- children: nt.children
6009
+ onClose: ot,
6010
+ children: bt.children
5927
6011
  }) : null,
5928
- children: rt
6012
+ children: xt
5929
6013
  }),
5930
- /* @__PURE__ */ _(y, { children: se && /* @__PURE__ */ _(C.div, {
6014
+ /* @__PURE__ */ _(y, { children: me && /* @__PURE__ */ _(C.div, {
5931
6015
  className: $.scrim,
5932
6016
  initial: { opacity: 0 },
5933
6017
  animate: { opacity: 1 },
5934
6018
  exit: { opacity: 0 },
5935
- onClick: () => le(!1),
6019
+ onClick: () => he(!1),
5936
6020
  children: /* @__PURE__ */ v(C.div, {
5937
6021
  className: $.sheet,
5938
6022
  role: "dialog",
5939
- "aria-label": R.savedHighlights,
6023
+ "aria-label": z.savedHighlights,
5940
6024
  initial: {
5941
6025
  y: 20,
5942
6026
  scale: .95
@@ -5954,24 +6038,24 @@ function bi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
5954
6038
  className: $.sheetHead,
5955
6039
  children: [/* @__PURE__ */ _("h2", {
5956
6040
  className: $.sheetTitle,
5957
- children: R.highlights
6041
+ children: z.highlights
5958
6042
  }), /* @__PURE__ */ _("button", {
5959
6043
  className: $.close,
5960
- onClick: () => le(!1),
5961
- children: R.close
6044
+ onClick: () => he(!1),
6045
+ children: z.close
5962
6046
  })]
5963
- }), Array.from(new Set(ae.map((e) => e.turnId))).map((e, t) => /* @__PURE__ */ v("div", {
6047
+ }), Array.from(new Set(fe.map((e) => e.turnId))).map((e, t) => /* @__PURE__ */ v("div", {
5964
6048
  className: $.group,
5965
6049
  children: [/* @__PURE__ */ _("h3", {
5966
6050
  className: $.groupTitle,
5967
- children: Ae(R.paragraph, { index: t + 1 })
6051
+ children: je(z.paragraph, { index: t + 1 })
5968
6052
  }), /* @__PURE__ */ _("div", {
5969
6053
  className: $.marks,
5970
- children: ae.filter((t) => t.turnId === e).map((t, n) => /* @__PURE__ */ _("button", {
6054
+ children: fe.filter((t) => t.turnId === e).map((t, n) => /* @__PURE__ */ _("button", {
5971
6055
  type: "button",
5972
6056
  className: $.mark,
5973
6057
  onClick: () => {
5974
- le(!1), setTimeout(() => {
6058
+ he(!1), setTimeout(() => {
5975
6059
  let t = document.getElementById(`turn-${e}`), n = document.querySelector(".ick-chat-feed"), r = document.querySelector(".ick-chat-header");
5976
6060
  if (t && n) {
5977
6061
  let e = r ? r.offsetHeight : 80;
@@ -5991,15 +6075,15 @@ function bi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
5991
6075
  }, e))]
5992
6076
  })
5993
6077
  }) }),
5994
- /* @__PURE__ */ _(y, { children: ue && l && /* @__PURE__ */ _(gi, {
5995
- activeReply: ue,
5996
- onClose: () => de(null),
6078
+ /* @__PURE__ */ _(y, { children: _e && l && /* @__PURE__ */ _(gi, {
6079
+ activeReply: _e,
6080
+ onClose: () => be(null),
5997
6081
  onSendMessage: l
5998
6082
  }, "thread-popup") })
5999
6083
  ]
6000
6084
  });
6001
6085
  }
6002
6086
  //#endregion
6003
- export { De as $, fn as A, _t as B, Sn as C, vn as D, bn as E, Vt as F, Qe as G, st as H, Mt as I, Re as J, G as K, At as L, tn as M, qt as N, gn as O, Qt as P, ke as Q, Ot as R, Cn as S, Tn as T, ot as U, ht as V, rt as W, Fe as X, Le as Y, je as Z, Ln as _, si as a, jn as b, Xr as c, Nr as d, V as et, Ar as f, Fn as g, zn as h, gi as i, cn as j, mn as k, Br as l, Un as m, vi as n, ai as o, br as p, Be as q, _i as r, Zr as s, bi as t, Rr as u, In as v, wn as w, xn as x, Nn as y, Ct as z };
6087
+ export { Oe as $, fn as A, _t as B, Sn as C, vn as D, bn as E, Vt as F, Qe as G, st as H, Mt as I, Re as J, Ke as K, At as L, tn as M, qt as N, gn as O, Qt as P, Ae as Q, Ot as R, Cn as S, Tn as T, ot as U, ht as V, rt as W, Fe as X, Le as Y, U as Z, Ln as _, si as a, jn as b, Xr as c, Nr as d, V as et, Ar as f, Fn as g, zn as h, gi as i, cn as j, mn as k, Br as l, Un as m, vi as n, ai as o, br as p, Be as q, _i as r, Zr as s, xi as t, Rr as u, In as v, wn as w, xn as x, Nn as y, Ct as z };
6004
6088
 
6005
- //# sourceMappingURL=ChatExperience-DCta8bv3.js.map
6089
+ //# sourceMappingURL=ChatExperience-CrWU56fi.js.map