@copilotkit/vue 1.60.0 → 1.60.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { defineComponent as se, useAttrs as Ge, shallowRef as it, onMounted as Je, onUnmounted as dn, openBlock as R, createBlock as he, resolveDynamicComponent as mt, mergeProps as ge, unref as G, createCommentVNode as Q, inject as Ct, ref as I, watch as L, computed as c, onBeforeUnmount as Me, h as w, nextTick as ft, getCurrentInstance as lt, createElementBlock as j, normalizeStyle as rt, createElementVNode as M, toDisplayString as ke, triggerRef as ot, provide as It, Fragment as Re, renderSlot as T, toValue as _e, renderList as Ke, createVNode as oe, withMemo as pa, createSlots as qe, withCtx as W, normalizeProps as q, guardReactiveProps as J, normalizeClass as ye, createTextVNode as qt, readonly as Ut, withModifiers as Ht, Teleport as fa, useSlots as pn, onScopeDispose as Kt } from "vue";
1
+ import { defineComponent as se, useAttrs as Ge, shallowRef as it, onMounted as Je, onUnmounted as dn, openBlock as R, createBlock as he, resolveDynamicComponent as mt, mergeProps as ge, unref as G, createCommentVNode as Q, inject as Ct, ref as I, watch as L, computed as c, onBeforeUnmount as Me, h as w, nextTick as ft, getCurrentInstance as lt, createElementBlock as B, normalizeStyle as rt, createElementVNode as M, toDisplayString as ke, triggerRef as ot, provide as It, Fragment as Re, renderSlot as T, toValue as _e, renderList as Ke, createVNode as oe, withMemo as pa, createSlots as qe, withCtx as W, normalizeProps as q, guardReactiveProps as J, normalizeClass as ye, createTextVNode as qt, readonly as Ut, withModifiers as Ht, Teleport as fa, useSlots as pn, onScopeDispose as Kt } from "vue";
2
2
  import { z as ce } from "zod";
3
3
  import { randomUUID as pt, A2UI_DEFAULT_GENERATION_GUIDELINES as ga, A2UI_DEFAULT_DESIGN_GUIDELINES as va, createLicenseContextValue as qn, schemaToJsonSchema as ma, DEFAULT_AGENT_ID as ct, partialJSONParse as In, matchesAcceptFilter as en, exceedsMaxSize as ha, formatFileSize as on, getModalityFromMimeType as ba, readFileAsBase64 as ka, generateVideoThumbnail as ya, TranscriptionErrorCode as Xe, getSourceUrl as wt, getDocumentIcon as sn } from "@copilotkit/shared";
4
4
  import { zodToJsonSchema as fn } from "zod-to-json-schema";
@@ -179,22 +179,22 @@ const wo = se({
179
179
  inProgress: !1,
180
180
  promise: null,
181
181
  resourceUri: null
182
- }), k = (C) => {
182
+ }), y = (C) => {
183
183
  a.value?.contentWindow && a.value.contentWindow.postMessage(C, "*");
184
184
  }, u = (C, m) => {
185
- k({
185
+ y({
186
186
  jsonrpc: "2.0",
187
187
  id: C,
188
188
  result: m
189
189
  });
190
190
  }, d = (C, m, x) => {
191
- k({
191
+ y({
192
192
  jsonrpc: "2.0",
193
193
  id: C,
194
194
  error: { code: m, message: x }
195
195
  });
196
196
  }, g = (C, m) => {
197
- k({
197
+ y({
198
198
  jsonrpc: "2.0",
199
199
  method: C,
200
200
  params: m || {}
@@ -204,12 +204,12 @@ const wo = se({
204
204
  [() => e.agent, () => e.content],
205
205
  ([C, m]) => {
206
206
  s.value = !0, o.value = null, i.value = !1, r.value = {}, l.value = null;
207
- const { resourceUri: x, serverHash: f, serverId: y } = m;
207
+ const { resourceUri: x, serverHash: f, serverId: b } = m;
208
208
  if (p.value.inProgress && p.value.resourceUri === x) {
209
- p.value.promise?.then((b) => {
210
- b && (l.value = b, s.value = !1);
211
- }).catch((b) => {
212
- o.value = b instanceof Error ? b : new Error(String(b)), s.value = !1;
209
+ p.value.promise?.then((k) => {
210
+ k && (l.value = k, s.value = !1);
211
+ }).catch((k) => {
212
+ o.value = k instanceof Error ? k : new Error(String(k)), s.value = !1;
213
213
  });
214
214
  return;
215
215
  }
@@ -226,7 +226,7 @@ const wo = se({
226
226
  forwardedProps: {
227
227
  __proxiedMCPRequest: {
228
228
  serverHash: f,
229
- serverId: y,
229
+ serverId: b,
230
230
  method: "resources/read",
231
231
  params: { uri: x }
232
232
  }
@@ -240,10 +240,10 @@ const wo = se({
240
240
  p.value.inProgress = !1;
241
241
  }
242
242
  })();
243
- p.value.promise = v, v.then((b) => {
244
- b && (l.value = b, s.value = !1);
245
- }).catch((b) => {
246
- o.value = b instanceof Error ? b : new Error(String(b)), s.value = !1;
243
+ p.value.promise = v, v.then((k) => {
244
+ k && (l.value = k, s.value = !1);
245
+ }).catch((k) => {
246
+ o.value = k instanceof Error ? k : new Error(String(k)), s.value = !1;
247
247
  });
248
248
  },
249
249
  { immediate: !0 }
@@ -252,10 +252,10 @@ const wo = se({
252
252
  ([C, m], x, f) => {
253
253
  if (C || !m)
254
254
  return;
255
- const y = t.value;
256
- if (!y)
255
+ const b = t.value;
256
+ if (!b)
257
257
  return;
258
- let v = !0, b = null, S = null, O = null;
258
+ let v = !0, k = null, S = null, O = null;
259
259
  (async () => {
260
260
  try {
261
261
  const $ = document.createElement("iframe");
@@ -272,9 +272,9 @@ const wo = se({
272
272
  S && (window.removeEventListener("message", S), S = null);
273
273
  return;
274
274
  }
275
- const Y = l.value?._meta?.ui?.csp?.resourceDomains;
276
- if ($.srcdoc = vo(Y), a.value = $, y.appendChild($), await P, !v) return;
277
- b = async (te) => {
275
+ const ee = l.value?._meta?.ui?.csp?.resourceDomains;
276
+ if ($.srcdoc = vo(ee), a.value = $, b.appendChild($), await P, !v) return;
277
+ k = async (te) => {
278
278
  if (te.source !== $.contentWindow) return;
279
279
  const K = te.data;
280
280
  if (!(!K || typeof K != "object" || K.jsonrpc !== "2.0")) {
@@ -401,7 +401,7 @@ const wo = se({
401
401
  }
402
402
  }
403
403
  }
404
- }, window.addEventListener("message", b);
404
+ }, window.addEventListener("message", k);
405
405
  const ve = m.text ? m.text : m.blob ? atob(m.blob) : null;
406
406
  if (!ve)
407
407
  throw new Error("Resource has no text or blob content");
@@ -412,7 +412,7 @@ const wo = se({
412
412
  v && (o.value = $ instanceof Error ? $ : new Error(String($)));
413
413
  }
414
414
  })(), f(() => {
415
- v = !1, S && (window.removeEventListener("message", S), S = null), b && window.removeEventListener("message", b), O && (O.remove(), O = null), a.value = null;
415
+ v = !1, S && (window.removeEventListener("message", S), S = null), k && window.removeEventListener("message", k), O && (O.remove(), O = null), a.value = null;
416
416
  });
417
417
  },
418
418
  { flush: "post" }
@@ -671,9 +671,9 @@ function So(e, n) {
671
671
  args: p
672
672
  }) => {
673
673
  if (l === "complete") return null;
674
- const k = p, u = k?.items;
674
+ const y = p, u = y?.items;
675
675
  if (Array.isArray(u) && u.length > 0) return null;
676
- const d = k?.components;
676
+ const d = y?.components;
677
677
  return Array.isArray(d) && d.length > 2 ? null : Io(p);
678
678
  }
679
679
  }), r = t.propRenderToolCalls;
@@ -721,7 +721,7 @@ function Io(e) {
721
721
  ...C !== void 0 ? { opacity: C } : {},
722
722
  ...m ? { transition: m } : {}
723
723
  }
724
- }), k = (u, d, g) => w(
724
+ }), y = (u, d, g) => w(
725
725
  "div",
726
726
  {
727
727
  style: {
@@ -778,37 +778,37 @@ function Io(e) {
778
778
  ),
779
779
  // Skeleton lines
780
780
  w("div", { style: { display: "grid", gap: "7px" } }, [
781
- k(s >= 0, 0, [
781
+ y(s >= 0, 0, [
782
782
  p(36, 7, "rgba(147,197,253,0.7)", 0),
783
783
  p(80, 7, "rgba(219,234,254,0.8)", 0.2)
784
784
  ]),
785
- k(s >= 0, 0.1, [
785
+ y(s >= 0, 0.1, [
786
786
  l(),
787
787
  r(),
788
788
  p(100, 7, "rgba(24,24,27,0.2)", 0.3)
789
789
  ]),
790
- k(s >= 1, 0.15, [
790
+ y(s >= 1, 0.15, [
791
791
  l(),
792
792
  p(48, 7, "rgba(24,24,27,0.15)", 0.1),
793
793
  p(40, 7, "rgba(153,246,228,0.6)", 0.5),
794
794
  p(56, 7, "rgba(147,197,253,0.6)", 0.3)
795
795
  ]),
796
- k(s >= 1, 0.2, [
796
+ y(s >= 1, 0.2, [
797
797
  l(),
798
798
  r(),
799
799
  p(60, 7, "rgba(24,24,27,0.15)", 0.4)
800
800
  ]),
801
- k(s >= 2, 0.25, [
801
+ y(s >= 2, 0.25, [
802
802
  p(40, 7, "rgba(153,246,228,0.5)", 0.2),
803
803
  r(),
804
804
  p(48, 7, "rgba(24,24,27,0.15)", 0.6),
805
805
  p(64, 7, "rgba(147,197,253,0.5)", 0.1)
806
806
  ]),
807
- k(s >= 2, 0.3, [
807
+ y(s >= 2, 0.3, [
808
808
  p(36, 7, "rgba(147,197,253,0.6)", 0.5),
809
809
  p(36, 7, "rgba(24,24,27,0.12)", 0.7)
810
810
  ]),
811
- k(s >= 3, 0.35, [
811
+ y(s >= 3, 0.35, [
812
812
  r(),
813
813
  p(44, 7, "rgba(24,24,27,0.18)", 0.3),
814
814
  r(),
@@ -902,8 +902,8 @@ function Ee(e, n, t) {
902
902
  let s = null;
903
903
  const r = t ? t() : void 0;
904
904
  function l(p) {
905
- s && s.dispose(), s = new $a(p, e.schema), o.value = s.snapshot, s.subscribe((k) => {
906
- o.value = k;
905
+ s && s.dispose(), s = new $a(p, e.schema), o.value = s.snapshot, s.subscribe((y) => {
906
+ o.value = y;
907
907
  });
908
908
  }
909
909
  return l(i.context), L(
@@ -1417,7 +1417,7 @@ const Mo = Ee(La, ({ props: e }) => {
1417
1417
  }
1418
1418
  },
1419
1419
  s.map((r, l) => {
1420
- const p = a.includes(r.value), k = typeof r.label == "string" ? r.label : String(r.label ?? r.value);
1420
+ const p = a.includes(r.value), y = typeof r.label == "string" ? r.label : String(r.label ?? r.value);
1421
1421
  return e.displayStyle === "chips" ? w(
1422
1422
  "button",
1423
1423
  {
@@ -1433,7 +1433,7 @@ const Mo = Ee(La, ({ props: e }) => {
1433
1433
  fontSize: "12px"
1434
1434
  }
1435
1435
  },
1436
- k
1436
+ y
1437
1437
  ) : w(
1438
1438
  "label",
1439
1439
  {
@@ -1452,7 +1452,7 @@ const Mo = Ee(La, ({ props: e }) => {
1452
1452
  onChange: () => o(r.value),
1453
1453
  name: i ? `choice-${n.componentModel.id}` : void 0
1454
1454
  }),
1455
- w("span", { style: { fontSize: "14px" } }, k)
1455
+ w("span", { style: { fontSize: "14px" } }, y)
1456
1456
  ]
1457
1457
  );
1458
1458
  })
@@ -1638,12 +1638,12 @@ function Yo(e, n) {
1638
1638
  [() => e.value, n.enabled, t],
1639
1639
  ([i, o, s], r, l) => {
1640
1640
  if (!o) return;
1641
- const p = i.a2uiAgents, k = i.addContext({
1641
+ const p = i.a2uiAgents, y = i.addContext({
1642
1642
  description: "A2UI catalog capabilities: available catalog IDs and custom component definitions the client can render.",
1643
1643
  value: s,
1644
1644
  ...p ? { agentIds: p } : {}
1645
1645
  });
1646
- l(() => i.removeContext(k));
1646
+ l(() => i.removeContext(y));
1647
1647
  },
1648
1648
  { immediate: !0 }
1649
1649
  );
@@ -1652,24 +1652,24 @@ function Yo(e, n) {
1652
1652
  [() => e.value, n.enabled, a],
1653
1653
  ([i, o, s], r, l) => {
1654
1654
  if (!o || !s) return;
1655
- const p = i.a2uiAgents, k = p ? { agentIds: p } : {}, u = [];
1655
+ const p = i.a2uiAgents, y = p ? { agentIds: p } : {}, u = [];
1656
1656
  u.push(
1657
1657
  i.addContext({
1658
1658
  description: Jo,
1659
1659
  value: s,
1660
- ...k
1660
+ ...y
1661
1661
  })
1662
1662
  ), u.push(
1663
1663
  i.addContext({
1664
1664
  description: "A2UI generation guidelines — protocol rules, tool arguments, path rules, data model format, and form/two-way-binding instructions.",
1665
1665
  value: ga,
1666
- ...k
1666
+ ...y
1667
1667
  })
1668
1668
  ), u.push(
1669
1669
  i.addContext({
1670
1670
  description: "A2UI design guidelines — visual design rules, component hierarchy tips, and action handler patterns.",
1671
1671
  value: va,
1672
- ...k
1672
+ ...y
1673
1673
  })
1674
1674
  ), l(() => {
1675
1675
  for (const d of u) i.removeContext(d);
@@ -1737,7 +1737,7 @@ const ls = se({
1737
1737
  }
1738
1738
  },
1739
1739
  setup(e) {
1740
- const n = ts(), t = I(null), a = I(e.content), i = I(e.content), o = I(null), s = I(null), r = I(null), l = I(!1), p = I(!1), k = I(0), u = I(!1), d = I([]), g = c(() => {
1740
+ const n = ts(), t = I(null), a = I(e.content), i = I(e.content), o = I(null), s = I(null), r = I(null), l = I(!1), p = I(!1), y = I(0), u = I(!1), d = I([]), g = c(() => {
1741
1741
  const $ = {};
1742
1742
  for (const P of n.value)
1743
1743
  $[P.name] = P.handler;
@@ -1769,27 +1769,27 @@ const ls = se({
1769
1769
  () => a.value.htmlComplete && a.value.html?.length ? a.value.html.join("") : void 0
1770
1770
  ), f = c(
1771
1771
  () => a.value.cssComplete ? a.value.css : void 0
1772
- ), y = c(
1772
+ ), b = c(
1773
1773
  () => !!a.value.cssComplete && !!C.value && C.value.trim().length > 0
1774
1774
  ), v = c(
1775
- () => !!x.value || y.value
1776
- ), b = c(
1775
+ () => !!x.value || b.value
1776
+ ), k = c(
1777
1777
  () => `${a.value.initialHeight ?? 200}px`
1778
1778
  ), S = () => {
1779
1779
  r.value && (r.value.destroy(), r.value = null), p.value = !1;
1780
1780
  }, O = () => {
1781
- s.value && (s.value.destroy(), s.value = null), l.value = !1, d.value = [], k.value = 0, u.value = !1;
1781
+ s.value && (s.value.destroy(), s.value = null), l.value = !1, d.value = [], y.value = 0, u.value = !1;
1782
1782
  };
1783
1783
  L(
1784
1784
  [
1785
- y,
1785
+ b,
1786
1786
  x,
1787
1787
  f,
1788
1788
  C,
1789
1789
  m,
1790
1790
  () => t.value
1791
1791
  ],
1792
- async ([$, P], Y, ve) => {
1792
+ async ([$, P], ee, ve) => {
1793
1793
  if (!$ || P || !t.value || r.value) return;
1794
1794
  let te = !1;
1795
1795
  try {
@@ -1824,10 +1824,10 @@ const ls = se({
1824
1824
  { immediate: !0 }
1825
1825
  ), L(
1826
1826
  [C, m, f, p],
1827
- ([$, P, Y, ve]) => {
1827
+ ([$, P, ee, ve]) => {
1828
1828
  if (!r.value || !ve) return;
1829
1829
  const te = [];
1830
- Y && te.push(`<style>${Y}</style>`), P && te.push(P), te.length && r.value.run(
1830
+ ee && te.push(`<style>${ee}</style>`), P && te.push(P), te.length && r.value.run(
1831
1831
  `document.head.innerHTML = ${JSON.stringify(te.join(""))}`
1832
1832
  ), $ && r.value.run(
1833
1833
  `document.body.innerHTML = ${JSON.stringify($)}`
@@ -1836,14 +1836,14 @@ const ls = se({
1836
1836
  { immediate: !0 }
1837
1837
  ), L(
1838
1838
  [x, f, g, () => t.value],
1839
- async ([$, P, Y], ve, te) => {
1839
+ async ([$, P, ee], ve, te) => {
1840
1840
  if (O(), !$ || !t.value) return;
1841
1841
  S();
1842
1842
  let K = !1;
1843
1843
  try {
1844
1844
  const E = await $n();
1845
1845
  if (K || !t.value) return;
1846
- const ne = is($), re = P ? rs(ne, P) : ne, F = E.create(Y, {
1846
+ const ne = is($), re = P ? rs(ne, P) : ne, F = E.create(ee, {
1847
1847
  frameContainer: t.value,
1848
1848
  frameContent: re,
1849
1849
  allowAdditionalAttributes: ""
@@ -1856,12 +1856,12 @@ const ls = se({
1856
1856
  l.value = !0, F.run(
1857
1857
  "var s=document.createElement('style');s.textContent='html, body { overflow: hidden !important; }';document.head.appendChild(s);"
1858
1858
  );
1859
- const U = a.value.jsFunctions;
1860
- U && !u.value && (u.value = !0, d.value.unshift(U));
1859
+ const D = a.value.jsFunctions;
1860
+ D && !u.value && (u.value = !0, d.value.unshift(D));
1861
1861
  const H = a.value.jsExpressions;
1862
1862
  if (H?.length) {
1863
- const we = k.value;
1864
- we < H.length && (d.value.push(...H.slice(we)), k.value = H.length);
1863
+ const we = y.value;
1864
+ we < H.length && (d.value.push(...H.slice(we)), y.value = H.length);
1865
1865
  }
1866
1866
  const ae = [...d.value];
1867
1867
  d.value = [];
@@ -1888,22 +1888,22 @@ const ls = se({
1888
1888
  () => a.value.jsExpressions,
1889
1889
  ($) => {
1890
1890
  if (!$?.length) return;
1891
- const P = k.value;
1891
+ const P = y.value;
1892
1892
  if (P >= $.length) return;
1893
- const Y = $.slice(P);
1894
- if (k.value = $.length, l.value && s.value)
1895
- for (const ve of Y)
1893
+ const ee = $.slice(P);
1894
+ if (y.value = $.length, l.value && s.value)
1895
+ for (const ve of ee)
1896
1896
  s.value.run(ve);
1897
1897
  else
1898
- d.value.push(...Y);
1898
+ d.value.push(...ee);
1899
1899
  },
1900
1900
  { deep: !0 }
1901
1901
  );
1902
- const D = c(
1902
+ const j = c(
1903
1903
  () => a.value.generating !== !1
1904
1904
  );
1905
1905
  return L(
1906
- [y, x],
1906
+ [b, x],
1907
1907
  ([$, P]) => {
1908
1908
  P && S(), $ || S();
1909
1909
  },
@@ -1918,7 +1918,7 @@ const ls = se({
1918
1918
  style: {
1919
1919
  position: "relative",
1920
1920
  width: "100%",
1921
- height: b.value,
1921
+ height: k.value,
1922
1922
  borderRadius: "8px",
1923
1923
  backgroundColor: v.value ? "transparent" : "#f5f5f5",
1924
1924
  border: v.value ? "none" : "1px solid #e0e0e0",
@@ -1960,7 +1960,7 @@ const ls = se({
1960
1960
  "@keyframes ck-spin { to { transform: rotate(360deg) } }"
1961
1961
  )
1962
1962
  ]),
1963
- D.value ? w("div", {
1963
+ j.value ? w("div", {
1964
1964
  "data-testid": "open-generative-ui-progress-overlay",
1965
1965
  style: {
1966
1966
  position: "absolute",
@@ -2129,7 +2129,7 @@ const ps = { style: {
2129
2129
  ...o,
2130
2130
  ...s.value
2131
2131
  })), l = lt(), p = c(() => typeof (l?.vnode.props ?? {}).onDismiss == "function");
2132
- function k() {
2132
+ function y() {
2133
2133
  a("dismiss");
2134
2134
  }
2135
2135
  return Je(() => {
@@ -2139,7 +2139,7 @@ const ps = { style: {
2139
2139
  );
2140
2140
  }), Me(() => {
2141
2141
  typeof document > "u" || document.documentElement.style.removeProperty(Mn);
2142
- }), (u, d) => i.value ? (R(), j("div", {
2142
+ }), (u, d) => i.value ? (R(), B("div", {
2143
2143
  key: 0,
2144
2144
  style: rt(r.value),
2145
2145
  "data-testid": "copilot-license-banner"
@@ -2156,7 +2156,7 @@ const ps = { style: {
2156
2156
  color: "inherit"
2157
2157
  }
2158
2158
  }, ke(i.value.actionLabel), 9, fs),
2159
- p.value ? (R(), j("button", {
2159
+ p.value ? (R(), B("button", {
2160
2160
  key: 0,
2161
2161
  style: {
2162
2162
  background: "none",
@@ -2165,7 +2165,7 @@ const ps = { style: {
2165
2165
  color: "inherit",
2166
2166
  fontSize: "16px"
2167
2167
  },
2168
- onClick: k
2168
+ onClick: y
2169
2169
  }, " × ")) : Q("", !0)
2170
2170
  ])
2171
2171
  ], 4)) : Q("", !0);
@@ -2226,8 +2226,8 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2226
2226
  a.value = !1;
2227
2227
  return;
2228
2228
  }
2229
- const B = /* @__PURE__ */ new Set(["localhost", "127.0.0.1"]);
2230
- a.value = B.has(window.location.hostname);
2229
+ const U = /* @__PURE__ */ new Set(["localhost", "127.0.0.1"]);
2230
+ a.value = U.has(window.location.hostname);
2231
2231
  return;
2232
2232
  }
2233
2233
  a.value = !1;
@@ -2237,31 +2237,31 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2237
2237
  const o = t.frontendTools, s = t.humanInTheLoop, r = t.renderCustomMessages, l = t.renderActivityMessages, p = t.openGenerativeUI?.sandboxFunctions;
2238
2238
  L(
2239
2239
  () => t.frontendTools,
2240
- (B) => {
2241
- B !== o && console.error(ms);
2240
+ (U) => {
2241
+ U !== o && console.error(ms);
2242
2242
  }
2243
2243
  ), L(
2244
2244
  () => t.humanInTheLoop,
2245
- (B) => {
2246
- B !== s && console.error(hs);
2245
+ (U) => {
2246
+ U !== s && console.error(hs);
2247
2247
  }
2248
2248
  ), L(
2249
2249
  () => t.renderCustomMessages,
2250
- (B) => {
2251
- B !== r && console.error(bs);
2250
+ (U) => {
2251
+ U !== r && console.error(bs);
2252
2252
  }
2253
2253
  ), L(
2254
2254
  () => t.renderActivityMessages,
2255
- (B) => {
2256
- B !== l && console.error(ks);
2255
+ (U) => {
2256
+ U !== l && console.error(ks);
2257
2257
  }
2258
2258
  ), L(
2259
2259
  () => t.openGenerativeUI?.sandboxFunctions,
2260
- (B) => {
2261
- B !== p && console.error(ys);
2260
+ (U) => {
2261
+ U !== p && console.error(ys);
2262
2262
  }
2263
2263
  );
2264
- const k = c(
2264
+ const y = c(
2265
2265
  () => t.publicApiKey ?? t.publicLicenseKey
2266
2266
  ), u = c(() => ({
2267
2267
  ...t.agents__unsafe_dev_only,
@@ -2271,15 +2271,15 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2271
2271
  ), g = c(
2272
2272
  () => typeof t.headers == "function" ? t.headers() : t.headers
2273
2273
  ), h = c(() => {
2274
- const B = g.value;
2275
- return !k.value || B[Fn] ? B : { ...B, [Fn]: k.value };
2274
+ const U = g.value;
2275
+ return !y.value || U[Fn] ? U : { ...U, [Fn]: y.value };
2276
2276
  }), C = c(
2277
- () => t.runtimeUrl ?? (k.value ? vs : void 0)
2277
+ () => t.runtimeUrl ?? (y.value ? vs : void 0)
2278
2278
  );
2279
2279
  L(
2280
- [C, k, d],
2281
- ([B, ue, pe]) => {
2282
- if (B || ue || pe) return;
2280
+ [C, y, d],
2281
+ ([U, ue, pe]) => {
2282
+ if (U || ue || pe) return;
2283
2283
  const $e = "Missing required prop: 'runtimeUrl' or 'publicApiKey' or 'publicLicenseKey'";
2284
2284
  if (process.env.NODE_ENV === "production")
2285
2285
  throw new Error($e);
@@ -2288,9 +2288,9 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2288
2288
  { immediate: !0 }
2289
2289
  );
2290
2290
  const m = c(() => {
2291
- const B = [], ue = [];
2291
+ const U = [], ue = [];
2292
2292
  for (const pe of t.humanInTheLoop)
2293
- B.push({
2293
+ U.push({
2294
2294
  name: pe.name,
2295
2295
  description: pe.description,
2296
2296
  parameters: pe.parameters,
@@ -2307,36 +2307,36 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2307
2307
  render: pe.render,
2308
2308
  ...pe.agentId && { agentId: pe.agentId }
2309
2309
  });
2310
- return { tools: B, renderToolCalls: ue };
2310
+ return { tools: U, renderToolCalls: ue };
2311
2311
  }), x = c(() => {
2312
- const B = [];
2312
+ const U = [];
2313
2313
  for (const ue of t.frontendTools)
2314
- B.push(ue);
2314
+ U.push(ue);
2315
2315
  for (const ue of P.value)
2316
- B.push(ue);
2317
- return B.push(...m.value.tools), B;
2316
+ U.push(ue);
2317
+ return U.push(...m.value.tools), U;
2318
2318
  }), f = c(() => {
2319
- const B = [
2319
+ const U = [
2320
2320
  ...t.renderToolCalls ?? []
2321
2321
  ];
2322
2322
  for (const ue of [...t.frontendTools, ...P.value])
2323
2323
  if (ue.render) {
2324
2324
  const pe = ue.parameters ?? (ue.name === "*" ? ce.any() : void 0);
2325
- pe && B.push({
2325
+ pe && U.push({
2326
2326
  name: ue.name,
2327
2327
  args: pe,
2328
2328
  render: ue.render
2329
2329
  });
2330
2330
  }
2331
- return B.push(...m.value.renderToolCalls), B;
2332
- }), y = c(
2331
+ return U.push(...m.value.renderToolCalls), U;
2332
+ }), b = c(
2333
2333
  () => t.renderCustomMessages ?? []
2334
- ), v = I(!1), b = I(!1), S = I(void 0), O = c(
2335
- () => b.value || !!t.openGenerativeUI
2336
- ), D = c(
2334
+ ), v = I(!1), k = I(!1), S = I(void 0), O = c(
2335
+ () => k.value || !!t.openGenerativeUI
2336
+ ), j = c(
2337
2337
  () => t.openGenerativeUI?.sandboxFunctions ?? []
2338
- ), $ = (B, ue) => fn(
2339
- B,
2338
+ ), $ = (U, ue) => fn(
2339
+ U,
2340
2340
  ue
2341
2341
  ), P = c(() => O.value ? [
2342
2342
  {
@@ -2347,34 +2347,34 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2347
2347
  followUp: !0,
2348
2348
  render: us
2349
2349
  }
2350
- ] : []), Y = c(() => {
2351
- const B = [
2350
+ ] : []), ee = c(() => {
2351
+ const U = [
2352
2352
  {
2353
2353
  activityType: ho,
2354
2354
  content: bo,
2355
2355
  render: wo
2356
2356
  }
2357
2357
  ];
2358
- return O.value && B.push({
2358
+ return O.value && U.push({
2359
2359
  activityType: ns,
2360
2360
  content: as,
2361
2361
  render: cs
2362
- }), v.value && B.unshift(
2362
+ }), v.value && U.unshift(
2363
2363
  To({
2364
2364
  theme: t.a2ui?.theme ?? n,
2365
2365
  catalog: t.a2ui?.catalog,
2366
2366
  loadingComponent: t.a2ui?.loadingComponent
2367
2367
  })
2368
- ), B;
2368
+ ), U;
2369
2369
  }), ve = c(() => [
2370
2370
  ...t.renderActivityMessages ?? [],
2371
- ...Y.value
2372
- ]), te = (B) => {
2371
+ ...ee.value
2372
+ ]), te = (U) => {
2373
2373
  t.defaultThrottleMs !== void 0 && (!Number.isFinite(t.defaultThrottleMs) || t.defaultThrottleMs < 0) && console.error(
2374
2374
  `CopilotKitProvider: defaultThrottleMs must be a non-negative finite number, got ${t.defaultThrottleMs}. useAgent hooks without an explicit throttleMs will fall back to unthrottled.`
2375
- ), B.setDefaultThrottleMs(t.defaultThrottleMs);
2375
+ ), U.setDefaultThrottleMs(t.defaultThrottleMs);
2376
2376
  }, E = it((() => {
2377
- const B = new xo({
2377
+ const U = new xo({
2378
2378
  runtimeUrl: C.value,
2379
2379
  runtimeTransport: t.useSingleEndpoint === !0 ? "single" : t.useSingleEndpoint === !1 ? "rest" : "auto",
2380
2380
  headers: h.value,
@@ -2384,15 +2384,15 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2384
2384
  tools: x.value,
2385
2385
  renderToolCalls: f.value,
2386
2386
  renderActivityMessages: ve.value,
2387
- renderCustomMessages: y.value,
2387
+ renderCustomMessages: b.value,
2388
2388
  debug: t.debug
2389
2389
  });
2390
- return te(B), B;
2390
+ return te(U), U;
2391
2391
  })()), ne = I(!1), re = I(/* @__PURE__ */ new Set());
2392
2392
  L(
2393
2393
  E,
2394
- (B, ue, pe) => {
2395
- const $e = B.subscribe({
2394
+ (U, ue, pe) => {
2395
+ const $e = U.subscribe({
2396
2396
  onToolExecutionStart: ({
2397
2397
  toolCallId: Se
2398
2398
  }) => {
@@ -2408,19 +2408,19 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2408
2408
  xe.delete(Se), re.value = xe, ot(E);
2409
2409
  }, 0);
2410
2410
  }
2411
- }), Le = B.subscribe({
2411
+ }), Le = U.subscribe({
2412
2412
  onRenderToolCallsChanged: () => {
2413
2413
  ot(E);
2414
2414
  }
2415
- }), Ae = B.subscribe({
2415
+ }), Ae = U.subscribe({
2416
2416
  onRenderCustomMessagesChanged: () => {
2417
2417
  ot(E);
2418
2418
  }
2419
- }), ze = B.subscribe({
2419
+ }), ze = U.subscribe({
2420
2420
  onRuntimeConnectionStatusChanged: () => {
2421
- v.value = B.a2uiEnabled, b.value = B.openGenerativeUIEnabled, S.value = B.licenseStatus, ot(E);
2421
+ v.value = U.a2uiEnabled, k.value = U.openGenerativeUIEnabled, S.value = U.licenseStatus, ot(E);
2422
2422
  }
2423
- }), je = B.subscribe({
2423
+ }), je = U.subscribe({
2424
2424
  onError: (Se) => {
2425
2425
  t.onError?.({
2426
2426
  error: Se.error,
@@ -2434,14 +2434,14 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2434
2434
  });
2435
2435
  },
2436
2436
  { immediate: !0 }
2437
- ), L([x], ([B]) => {
2438
- ne.value && E.value.setTools(B);
2439
- }), L([f], ([B]) => {
2440
- ne.value && E.value.setRenderToolCalls(B);
2441
- }), L([y], ([B]) => {
2442
- ne.value && (E.value.setRenderCustomMessages(B), ot(E));
2443
- }), L([ve], ([B]) => {
2444
- ne.value && (E.value.setRenderActivityMessages(B), ot(E));
2437
+ ), L([x], ([U]) => {
2438
+ ne.value && E.value.setTools(U);
2439
+ }), L([f], ([U]) => {
2440
+ ne.value && E.value.setRenderToolCalls(U);
2441
+ }), L([b], ([U]) => {
2442
+ ne.value && (E.value.setRenderCustomMessages(U), ot(E));
2443
+ }), L([ve], ([U]) => {
2444
+ ne.value && (E.value.setRenderActivityMessages(U), ot(E));
2445
2445
  });
2446
2446
  function F() {
2447
2447
  E.value.setRuntimeUrl(C.value), E.value.setRuntimeTransport(
@@ -2467,9 +2467,9 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2467
2467
  ne.value && (te(E.value), ot(E));
2468
2468
  }
2469
2469
  ), Je(() => {
2470
- F(), v.value = E.value.a2uiEnabled, b.value = E.value.openGenerativeUIEnabled, S.value = E.value.licenseStatus, ne.value = !0;
2470
+ F(), v.value = E.value.a2uiEnabled, k.value = E.value.openGenerativeUIEnabled, S.value = E.value.licenseStatus, ne.value = !0;
2471
2471
  });
2472
- const U = c(() => t.a2ui?.theme), H = c(() => t.a2ui?.catalog), ae = c(() => t.a2ui?.loadingComponent), we = c(() => t.a2ui?.includeSchema ?? !0);
2472
+ const D = c(() => t.a2ui?.theme), H = c(() => t.a2ui?.catalog), ae = c(() => t.a2ui?.loadingComponent), we = c(() => t.a2ui?.includeSchema ?? !0);
2473
2473
  So(E, () => v.value), Yo(E, {
2474
2474
  enabled: () => v.value,
2475
2475
  catalog: () => t.a2ui?.catalog,
@@ -2479,11 +2479,11 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2479
2479
  L(
2480
2480
  [
2481
2481
  O,
2482
- D,
2482
+ j,
2483
2483
  () => t.openGenerativeUI?.designSkill
2484
2484
  ],
2485
- ([B, ue, pe], $e, Le) => {
2486
- if (!B) return;
2485
+ ([U, ue, pe], $e, Le) => {
2486
+ if (!U) return;
2487
2487
  const Ae = [];
2488
2488
  if (Ae.push(
2489
2489
  E.value.addContext({
@@ -2516,36 +2516,36 @@ PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:
2516
2516
  ), It(Jn, {
2517
2517
  copilotkit: E,
2518
2518
  executingToolCallIds: re,
2519
- a2uiTheme: U,
2519
+ a2uiTheme: D,
2520
2520
  a2uiCatalog: H,
2521
2521
  a2uiLoadingComponent: ae,
2522
2522
  a2uiIncludeSchema: we
2523
- }), It(Qn, D);
2523
+ }), It(Qn, j);
2524
2524
  const X = c(
2525
2525
  () => qn(null)
2526
2526
  );
2527
2527
  It(Yn, X);
2528
- const Z = c(
2529
- () => S.value === "none" && !k.value
2530
- ), ee = c(
2528
+ const Y = c(
2529
+ () => S.value === "none" && !y.value
2530
+ ), Z = c(
2531
2531
  () => S.value === "expired"
2532
2532
  ), be = c(
2533
2533
  () => S.value === "invalid"
2534
2534
  ), Te = c(
2535
2535
  () => S.value === "expiring"
2536
2536
  );
2537
- return (B, ue) => (R(), j(Re, null, [
2538
- T(B.$slots, "default"),
2537
+ return (U, ue) => (R(), B(Re, null, [
2538
+ T(U.$slots, "default"),
2539
2539
  a.value ? (R(), he(fo, {
2540
2540
  key: 0,
2541
2541
  core: E.value,
2542
2542
  "default-anchor": t.inspectorDefaultAnchor
2543
2543
  }, null, 8, ["core", "default-anchor"])) : Q("", !0),
2544
- Z.value ? (R(), he(jt, {
2544
+ Y.value ? (R(), he(jt, {
2545
2545
  key: 1,
2546
2546
  type: "no_license"
2547
2547
  })) : Q("", !0),
2548
- ee.value ? (R(), he(jt, {
2548
+ Z.value ? (R(), he(jt, {
2549
2549
  key: 2,
2550
2550
  type: "expired"
2551
2551
  })) : Q("", !0),
@@ -2621,7 +2621,7 @@ const bn = /* @__PURE__ */ se({
2621
2621
  ...i.value
2622
2622
  })), s = c(
2623
2623
  () => n.agentId ?? a.value?.agentId ?? ct
2624
- ), r = pt(), l = c(() => n.threadId ? n.threadId : a.value?.threadId ? a.value.threadId : r), p = c(() => (n.hasExplicitThreadId !== void 0 ? n.hasExplicitThreadId : !!n.threadId) || !!a.value?.hasExplicitThreadId), k = c(
2624
+ ), r = pt(), l = c(() => n.threadId ? n.threadId : a.value?.threadId ? a.value.threadId : r), p = c(() => (n.hasExplicitThreadId !== void 0 ? n.hasExplicitThreadId : !!n.threadId) || !!a.value?.hasExplicitThreadId), y = c(
2625
2625
  () => n.isModalDefaultOpen !== void 0
2626
2626
  ), u = c(() => n.isModalDefaultOpen ?? !0), d = I(
2627
2627
  a.value?.isModalOpen ?? u.value
@@ -2630,9 +2630,9 @@ const bn = /* @__PURE__ */ se({
2630
2630
  d.value = x;
2631
2631
  }
2632
2632
  const h = c(
2633
- () => k.value ? d.value : a.value?.isModalOpen
2633
+ () => y.value ? d.value : a.value?.isModalOpen
2634
2634
  ), C = c(
2635
- () => k.value ? g : a.value?.setModalOpen
2635
+ () => y.value ? g : a.value?.setModalOpen
2636
2636
  ), m = c(() => ({
2637
2637
  labels: o.value,
2638
2638
  agentId: s.value,
@@ -2791,8 +2791,8 @@ const ea = se({
2791
2791
  C.has(x) || C.set(x, []), C.get(x).push(m);
2792
2792
  }
2793
2793
  for (const [m, x] of C) {
2794
- const y = h.model.getSurface(m) ? x.filter((v) => !v?.createSurface) : x;
2795
- h.processMessages(y);
2794
+ const b = h.model.getSurface(m) ? x.filter((v) => !v?.createSurface) : x;
2795
+ h.processMessages(b);
2796
2796
  }
2797
2797
  o.value = null;
2798
2798
  } catch (C) {
@@ -2809,7 +2809,7 @@ const ea = se({
2809
2809
  ), Me(() => {
2810
2810
  a.value = null, s = "";
2811
2811
  });
2812
- const k = c(
2812
+ const y = c(
2813
2813
  () => (n.content.operations ?? []).length > 0
2814
2814
  ), u = c(() => {
2815
2815
  if (i.value, !a.value) return [];
@@ -2824,14 +2824,14 @@ const ea = se({
2824
2824
  }
2825
2825
  return d;
2826
2826
  });
2827
- return (d, g) => k.value ? (R(), j("div", {
2827
+ return (d, g) => y.value ? (R(), B("div", {
2828
2828
  key: 0,
2829
2829
  "data-copilotkit": "",
2830
2830
  "data-activity-type": e.activityType,
2831
2831
  "data-message-id": e.message.id
2832
2832
  }, [
2833
- o.value ? (R(), j("div", Is, " A2UI render error: " + ke(o.value), 1)) : (R(), j("div", As, [
2834
- (R(!0), j(Re, null, Ke(u.value, (h) => (R(), j("div", {
2833
+ o.value ? (R(), B("div", Is, " A2UI render error: " + ke(o.value), 1)) : (R(), B("div", As, [
2834
+ (R(!0), B(Re, null, Ke(u.value, (h) => (R(), B("div", {
2835
2835
  key: h.surfaceId,
2836
2836
  class: "cpk:flex cpk:w-full cpk:flex-none cpk:flex-col cpk:gap-4",
2837
2837
  "data-surface-id": h.surfaceId
@@ -2888,7 +2888,7 @@ const ea = se({
2888
2888
  toolMessage: void 0
2889
2889
  };
2890
2890
  }
2891
- function k(d) {
2891
+ function y(d) {
2892
2892
  const g = o(d.id), h = In(d.function.arguments);
2893
2893
  return g ? {
2894
2894
  name: d.function.name,
@@ -2916,7 +2916,7 @@ const ea = se({
2916
2916
  );
2917
2917
  return C.find((m) => m.agentId === h) ?? C.find((m) => !m.agentId) ?? C[0] ?? g.find((m) => m.name === "*");
2918
2918
  }
2919
- return (d, g) => (R(!0), j(Re, null, Ke(e.message.toolCalls ?? [], (h) => T(d.$slots, s(h.function.name), ge({
2919
+ return (d, g) => (R(!0), B(Re, null, Ke(e.message.toolCalls ?? [], (h) => T(d.$slots, s(h.function.name), ge({
2920
2920
  key: h.id,
2921
2921
  ref_for: !0
2922
2922
  }, p(h)), () => [
@@ -2930,7 +2930,7 @@ const ea = se({
2930
2930
  ], () => (R(), he(mt(u(h)?.render), ge({
2931
2931
  key: 0,
2932
2932
  ref_for: !0
2933
- }, k(h)), null, 16)), g, 0) : Q("", !0)
2933
+ }, y(h)), null, 16)), g, 0) : Q("", !0)
2934
2934
  ])
2935
2935
  ])), 128));
2936
2936
  }
@@ -2961,7 +2961,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
2961
2961
  let l = null;
2962
2962
  const p = c(
2963
2963
  () => s?.vnode.props ?? {}
2964
- ), k = [
2964
+ ), y = [
2965
2965
  "cpk:inline-flex cpk:h-8 cpk:w-8 cpk:items-center cpk:justify-center cpk:rounded-md cpk:p-0",
2966
2966
  "cpk:cursor-pointer cpk:text-[rgb(93,93,93)] cpk:transition-colors cpk:hover:bg-[#E8E8E8]",
2967
2967
  "cpk:hover:text-[rgb(93,93,93)] cpk:dark:text-[rgb(243,243,243)] cpk:dark:hover:bg-[#303030]",
@@ -2969,9 +2969,9 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
2969
2969
  ].join(" ");
2970
2970
  function u(V, X) {
2971
2971
  try {
2972
- const ee = new URL(V, "https://copilotkit.local").pathname.split("/").filter(Boolean).pop();
2973
- if (ee)
2974
- return decodeURIComponent(ee);
2972
+ const Z = new URL(V, "https://copilotkit.local").pathname.split("/").filter(Boolean).pop();
2973
+ if (Z)
2974
+ return decodeURIComponent(Z);
2975
2975
  } catch {
2976
2976
  return X;
2977
2977
  }
@@ -2980,43 +2980,43 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
2980
2980
  function d(V, X) {
2981
2981
  if (typeof document > "u")
2982
2982
  return;
2983
- const Z = document.createElement("a");
2984
- Z.href = V, Z.download = X, Z.rel = "noopener noreferrer", document.body.appendChild(Z), Z.click(), document.body.removeChild(Z);
2983
+ const Y = document.createElement("a");
2984
+ Y.href = V, Y.download = X, Y.rel = "noopener noreferrer", document.body.appendChild(Y), Y.click(), document.body.removeChild(Y);
2985
2985
  }
2986
2986
  function g(V) {
2987
2987
  const X = Array.from(V.querySelectorAll("thead th")).map(
2988
- (ee) => (ee.textContent ?? "").trim()
2989
- ), Z = Array.from(V.querySelectorAll("tbody tr")).map(
2990
- (ee) => Array.from(ee.querySelectorAll("td")).map(
2988
+ (Z) => (Z.textContent ?? "").trim()
2989
+ ), Y = Array.from(V.querySelectorAll("tbody tr")).map(
2990
+ (Z) => Array.from(Z.querySelectorAll("td")).map(
2991
2991
  (be) => (be.textContent ?? "").trim()
2992
2992
  )
2993
2993
  );
2994
- return { headers: X, rows: Z };
2994
+ return { headers: X, rows: Y };
2995
2995
  }
2996
2996
  function h(V, X) {
2997
- const Z = (be) => {
2997
+ const Y = (be) => {
2998
2998
  const Te = be.includes(X) || be.includes('"') || be.includes(`
2999
- `), B = be.replace(/"/g, '""');
3000
- return Te ? `"${B}"` : B;
3001
- }, ee = [];
3002
- V.headers.length > 0 && ee.push(V.headers.map(Z).join(X));
2999
+ `), U = be.replace(/"/g, '""');
3000
+ return Te ? `"${U}"` : U;
3001
+ }, Z = [];
3002
+ V.headers.length > 0 && Z.push(V.headers.map(Y).join(X));
3003
3003
  for (const be of V.rows)
3004
- ee.push(be.map(Z).join(X));
3005
- return ee.join(`
3004
+ Z.push(be.map(Y).join(X));
3005
+ return Z.join(`
3006
3006
  `);
3007
3007
  }
3008
3008
  function C(V) {
3009
3009
  if (V.headers.length === 0)
3010
- return V.rows.map((ee) => `| ${ee.join(" | ")} |`).join(`
3010
+ return V.rows.map((Z) => `| ${Z.join(" | ")} |`).join(`
3011
3011
  `);
3012
- const X = `| ${V.headers.map(() => "---").join(" | ")} |`, Z = V.rows.map((ee) => `| ${ee.join(" | ")} |`);
3013
- return [`| ${V.headers.join(" | ")} |`, X, ...Z].join(`
3012
+ const X = `| ${V.headers.map(() => "---").join(" | ")} |`, Y = V.rows.map((Z) => `| ${Z.join(" | ")} |`);
3013
+ return [`| ${V.headers.join(" | ")} |`, X, ...Y].join(`
3014
3014
  `);
3015
3015
  }
3016
- function m(V, X, Z) {
3016
+ function m(V, X, Y) {
3017
3017
  if (typeof document > "u")
3018
3018
  return;
3019
- const ee = new Blob([V], { type: Z }), be = URL.createObjectURL(ee);
3019
+ const Z = new Blob([V], { type: Y }), be = URL.createObjectURL(Z);
3020
3020
  d(be, X), URL.revokeObjectURL(be);
3021
3021
  }
3022
3022
  const x = se({
@@ -3033,36 +3033,36 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3033
3033
  }
3034
3034
  },
3035
3035
  setup(V, { attrs: X }) {
3036
- async function Z() {
3036
+ async function Y() {
3037
3037
  if (!V.src)
3038
3038
  return;
3039
- const ee = u(V.src, "image");
3039
+ const Z = u(V.src, "image");
3040
3040
  try {
3041
3041
  const be = await fetch(V.src);
3042
3042
  if (!be.ok)
3043
3043
  throw new Error("Failed to fetch image");
3044
- const Te = await be.blob(), B = URL.createObjectURL(Te);
3045
- d(B, ee), URL.revokeObjectURL(B);
3044
+ const Te = await be.blob(), U = URL.createObjectURL(Te);
3045
+ d(U, Z), URL.revokeObjectURL(U);
3046
3046
  } catch {
3047
- d(V.src, ee);
3047
+ d(V.src, Z);
3048
3048
  }
3049
3049
  }
3050
3050
  return () => {
3051
- const ee = {
3051
+ const Z = {
3052
3052
  ...X,
3053
3053
  src: V.src,
3054
3054
  alt: V.alt,
3055
3055
  class: ["cpk:max-w-full cpk:rounded-lg", X.class].filter(Boolean).join(" "),
3056
3056
  "data-streamdown": "image"
3057
3057
  };
3058
- return delete ee.className, w(
3058
+ return delete Z.className, w(
3059
3059
  "div",
3060
3060
  {
3061
3061
  class: "cpk:group cpk:relative cpk:my-4 cpk:inline-block",
3062
3062
  "data-streamdown": "image-wrapper"
3063
3063
  },
3064
3064
  [
3065
- w("img", ee),
3065
+ w("img", Z),
3066
3066
  w("div", {
3067
3067
  class: "cpk:pointer-events-none cpk:absolute cpk:inset-0 cpk:hidden cpk:rounded-lg cpk:bg-black/10 cpk:group-hover:block"
3068
3068
  }),
@@ -3072,7 +3072,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3072
3072
  type: "button",
3073
3073
  class: "cpk:absolute cpk:right-2 cpk:bottom-2 cpk:flex cpk:h-8 cpk:w-8 cpk:cursor-pointer cpk:items-center cpk:justify-center cpk:rounded-md cpk:border cpk:border-border cpk:bg-background/90 cpk:shadow-sm cpk:backdrop-blur-sm cpk:transition-all cpk:duration-200 cpk:hover:bg-background cpk:opacity-0 cpk:group-hover:opacity-100",
3074
3074
  title: "Download image",
3075
- onClick: Z
3075
+ onClick: Y
3076
3076
  },
3077
3077
  [w(tn, { class: "cpk:size-[14px]" })]
3078
3078
  )
@@ -3083,16 +3083,16 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3083
3083
  }), f = se({
3084
3084
  name: "CopilotMarkdownTable",
3085
3085
  inheritAttrs: !1,
3086
- setup(V, { attrs: X, slots: Z }) {
3087
- const ee = I(null), be = I(!1), Te = I(!1), B = I(!1);
3086
+ setup(V, { attrs: X, slots: Y }) {
3087
+ const Z = I(null), be = I(!1), Te = I(!1), U = I(!1);
3088
3088
  let ue = null;
3089
3089
  const pe = () => {
3090
3090
  be.value = !1, Te.value = !1;
3091
3091
  }, $e = () => {
3092
- ue && clearTimeout(ue), B.value = !0, ue = setTimeout(() => {
3093
- B.value = !1, ue = null;
3092
+ ue && clearTimeout(ue), U.value = !0, ue = setTimeout(() => {
3093
+ U.value = !1, ue = null;
3094
3094
  }, 2e3);
3095
- }, Le = () => ee.value ? ee.value.querySelector("table") : null, Ae = () => {
3095
+ }, Le = () => Z.value ? Z.value.querySelector("table") : null, Ae = () => {
3096
3096
  const xe = Le();
3097
3097
  return xe ? g(xe) : null;
3098
3098
  }, ze = async (xe) => {
@@ -3114,9 +3114,9 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3114
3114
  "text/csv"
3115
3115
  ) : m(C(Fe), "table.md", "text/markdown"), pe());
3116
3116
  }, Se = (xe) => {
3117
- if (!ee.value) return;
3117
+ if (!Z.value) return;
3118
3118
  const Fe = xe.target;
3119
- Fe && !ee.value.contains(Fe) && pe();
3119
+ Fe && !Z.value.contains(Fe) && pe();
3120
3120
  };
3121
3121
  return Je(() => {
3122
3122
  typeof document < "u" && document.addEventListener("mousedown", Se);
@@ -3134,7 +3134,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3134
3134
  return delete xe.className, w(
3135
3135
  "div",
3136
3136
  {
3137
- ref: ee,
3137
+ ref: Z,
3138
3138
  class: "cpk:my-4 cpk:flex cpk:flex-col cpk:space-y-2",
3139
3139
  "data-streamdown": "table-wrapper"
3140
3140
  },
@@ -3155,7 +3155,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3155
3155
  }
3156
3156
  },
3157
3157
  [
3158
- B.value ? w(At, { class: "cpk:size-[14px]" }) : w(zt, { class: "cpk:size-[14px]" })
3158
+ U.value ? w(At, { class: "cpk:size-[14px]" }) : w(zt, { class: "cpk:size-[14px]" })
3159
3159
  ]
3160
3160
  ),
3161
3161
  be.value ? w("div", { class: Un }, [
@@ -3220,13 +3220,13 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3220
3220
  ]
3221
3221
  ),
3222
3222
  w("div", { class: "cpk:overflow-x-auto" }, [
3223
- w("table", xe, Z.default ? Z.default() : [])
3223
+ w("table", xe, Y.default ? Y.default() : [])
3224
3224
  ])
3225
3225
  ]
3226
3226
  );
3227
3227
  };
3228
3228
  }
3229
- }), y = {
3229
+ }), b = {
3230
3230
  javascript: "js",
3231
3231
  js: "js",
3232
3232
  typescript: "ts",
@@ -3254,8 +3254,8 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3254
3254
  },
3255
3255
  setup(V) {
3256
3256
  const X = I(!1);
3257
- let Z = null;
3258
- const ee = async () => {
3257
+ let Y = null;
3258
+ const Z = async () => {
3259
3259
  if (V.code) {
3260
3260
  if (typeof navigator < "u" && navigator.clipboard?.writeText)
3261
3261
  try {
@@ -3263,13 +3263,13 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3263
3263
  } catch {
3264
3264
  return;
3265
3265
  }
3266
- Z && clearTimeout(Z), X.value = !0, Z = setTimeout(() => {
3267
- X.value = !1, Z = null;
3266
+ Y && clearTimeout(Y), X.value = !0, Y = setTimeout(() => {
3267
+ X.value = !1, Y = null;
3268
3268
  }, 2e3);
3269
3269
  }
3270
3270
  };
3271
3271
  return Me(() => {
3272
- Z && clearTimeout(Z);
3272
+ Y && clearTimeout(Y);
3273
3273
  }), () => w(
3274
3274
  "button",
3275
3275
  {
@@ -3277,14 +3277,14 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3277
3277
  class: Bn,
3278
3278
  title: "Copy Code",
3279
3279
  "data-streamdown": "code-block-copy-button",
3280
- onClick: ee
3280
+ onClick: Z
3281
3281
  },
3282
3282
  [
3283
3283
  X.value ? w(At, { class: "cpk:size-[14px]" }) : w(zt, { class: "cpk:size-[14px]" })
3284
3284
  ]
3285
3285
  );
3286
3286
  }
3287
- }), b = se({
3287
+ }), k = se({
3288
3288
  name: "CopilotCodeBlockDownloadAction",
3289
3289
  props: {
3290
3290
  code: {
@@ -3299,8 +3299,8 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3299
3299
  setup(V) {
3300
3300
  const X = () => {
3301
3301
  if (!V.code) return;
3302
- const Z = y[V.language.toLowerCase()] ?? "txt";
3303
- m(V.code, `file.${Z}`, "text/plain");
3302
+ const Y = b[V.language.toLowerCase()] ?? "txt";
3303
+ m(V.code, `file.${Y}`, "text/plain");
3304
3304
  };
3305
3305
  return () => w(
3306
3306
  "button",
@@ -3319,17 +3319,17 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3319
3319
  table: f
3320
3320
  };
3321
3321
  function O(V) {
3322
- return V ? typeof V == "string" ? V : Array.isArray(V) ? V.map((Z) => Z && typeof Z == "object" && "type" in Z && Z.type === "text" && typeof Z.text == "string" ? Z.text : "").filter((Z) => Z.length > 0).join(`
3322
+ return V ? typeof V == "string" ? V : Array.isArray(V) ? V.map((Y) => Y && typeof Y == "object" && "type" in Y && Y.type === "text" && typeof Y.text == "string" ? Y.text : "").filter((Y) => Y.length > 0).join(`
3323
3323
  `) : "" : "";
3324
3324
  }
3325
- const D = c(
3325
+ const j = c(
3326
3326
  () => O(t.message.content)
3327
- ), $ = c(() => D.value.trim().length > 0);
3327
+ ), $ = c(() => j.value.trim().length > 0);
3328
3328
  function P(V) {
3329
3329
  const X = p.value[V];
3330
3330
  return Array.isArray(X) ? X.length > 0 : !!X;
3331
3331
  }
3332
- const Y = c(() => P("onThumbsUp")), ve = c(() => P("onThumbsDown")), te = c(() => P("onReadAloud")), K = c(() => P("onRegenerate")), E = c(
3332
+ const ee = c(() => P("onThumbsUp")), ve = c(() => P("onThumbsDown")), te = c(() => P("onReadAloud")), K = c(() => P("onRegenerate")), E = c(
3333
3333
  () => t.messages[t.messages.length - 1]?.id === t.message.id
3334
3334
  ), ne = c(
3335
3335
  () => t.toolbarVisible && $.value && !(t.isRunning && E.value)
@@ -3340,7 +3340,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3340
3340
  }, 2e3);
3341
3341
  }
3342
3342
  async function F() {
3343
- const V = D.value;
3343
+ const V = j.value;
3344
3344
  if (V && !(typeof navigator > "u" || typeof navigator.clipboard?.writeText != "function"))
3345
3345
  try {
3346
3346
  await navigator.clipboard.writeText(V), re();
@@ -3348,7 +3348,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3348
3348
  console.error("Failed to copy to clipboard:", X);
3349
3349
  }
3350
3350
  }
3351
- function U() {
3351
+ function D() {
3352
3352
  a("thumbs-up", t.message);
3353
3353
  }
3354
3354
  function H() {
@@ -3364,7 +3364,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3364
3364
  l && clearTimeout(l);
3365
3365
  }), (V, X) => T(V.$slots, "layout", {
3366
3366
  message: e.message,
3367
- content: D.value,
3367
+ content: j.value,
3368
3368
  isRunning: e.isRunning,
3369
3369
  toolbarVisible: e.toolbarVisible,
3370
3370
  shouldShowToolbar: ne.value,
@@ -3377,7 +3377,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3377
3377
  regenerateButton: V.$slots["regenerate-button"] ?? (() => null),
3378
3378
  toolCallsView: V.$slots["tool-calls-view"] ?? (() => null),
3379
3379
  onCopy: F,
3380
- onThumbsUp: U,
3380
+ onThumbsUp: D,
3381
3381
  onThumbsDown: H,
3382
3382
  onReadAloud: ae,
3383
3383
  onRegenerate: we
@@ -3390,14 +3390,14 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3390
3390
  }, V.$attrs), [
3391
3391
  T(V.$slots, "message-renderer", {
3392
3392
  message: e.message,
3393
- content: D.value
3393
+ content: j.value
3394
3394
  }, () => [
3395
3395
  $.value ? (R(), he(G(Gn), {
3396
3396
  key: 0,
3397
3397
  class: "copilot-chat-assistant-markdown",
3398
- content: D.value,
3398
+ content: j.value,
3399
3399
  components: S,
3400
- "code-block-actions": [G(b), G(v)],
3400
+ "code-block-actions": [G(k), G(v)],
3401
3401
  "code-block-show-line-numbers": !1,
3402
3402
  "code-block-hide-copy": !0,
3403
3403
  "code-block-hide-download": !0,
@@ -3420,10 +3420,10 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3420
3420
  message: e.message,
3421
3421
  messages: e.messages
3422
3422
  }, qe({ _: 2 }, [
3423
- Ke(V.$slots, (Z, ee) => ({
3424
- name: ee,
3423
+ Ke(V.$slots, (Y, Z) => ({
3424
+ name: Z,
3425
3425
  fn: W((be) => [
3426
- T(V.$slots, ee, q(J(be)))
3426
+ T(V.$slots, Z, q(J(be)))
3427
3427
  ])
3428
3428
  }))
3429
3429
  ]), 1032, ["message", "messages"])
@@ -3443,7 +3443,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3443
3443
  M("button", {
3444
3444
  "data-testid": "copilot-copy-button",
3445
3445
  type: "button",
3446
- class: ye(G(k)),
3446
+ class: ye(G(y)),
3447
3447
  "aria-label": o.value.assistantMessageToolbarCopyMessageLabel,
3448
3448
  title: o.value.assistantMessageToolbarCopyMessageLabel,
3449
3449
  onClick: F
@@ -3457,17 +3457,17 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3457
3457
  }))
3458
3458
  ], 10, Us)
3459
3459
  ]),
3460
- Y.value ? T(V.$slots, "thumbs-up-button", {
3460
+ ee.value ? T(V.$slots, "thumbs-up-button", {
3461
3461
  key: 0,
3462
- onThumbsUp: U,
3462
+ onThumbsUp: D,
3463
3463
  label: o.value.assistantMessageToolbarThumbsUpLabel
3464
3464
  }, () => [
3465
3465
  M("button", {
3466
3466
  type: "button",
3467
- class: ye(G(k)),
3467
+ class: ye(G(y)),
3468
3468
  "aria-label": o.value.assistantMessageToolbarThumbsUpLabel,
3469
3469
  title: o.value.assistantMessageToolbarThumbsUpLabel,
3470
- onClick: U
3470
+ onClick: D
3471
3471
  }, [
3472
3472
  oe(G(eo), { class: "cpk:size-[18px]" })
3473
3473
  ], 10, Bs)
@@ -3479,7 +3479,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3479
3479
  }, () => [
3480
3480
  M("button", {
3481
3481
  type: "button",
3482
- class: ye(G(k)),
3482
+ class: ye(G(y)),
3483
3483
  "aria-label": o.value.assistantMessageToolbarThumbsDownLabel,
3484
3484
  title: o.value.assistantMessageToolbarThumbsDownLabel,
3485
3485
  onClick: H
@@ -3494,7 +3494,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3494
3494
  }, () => [
3495
3495
  M("button", {
3496
3496
  type: "button",
3497
- class: ye(G(k)),
3497
+ class: ye(G(y)),
3498
3498
  "aria-label": o.value.assistantMessageToolbarReadAloudLabel,
3499
3499
  title: o.value.assistantMessageToolbarReadAloudLabel,
3500
3500
  onClick: ae
@@ -3509,7 +3509,7 @@ const Os = ["data-message-id"], Ls = { class: "cpk:w-full cpk:bg-transparent cpk
3509
3509
  }, () => [
3510
3510
  M("button", {
3511
3511
  type: "button",
3512
- class: ye(G(k)),
3512
+ class: ye(G(y)),
3513
3513
  "aria-label": o.value.assistantMessageToolbarRegenerateLabel,
3514
3514
  title: o.value.assistantMessageToolbarRegenerateLabel,
3515
3515
  onClick: we
@@ -3534,7 +3534,7 @@ const zs = /* @__PURE__ */ se({
3534
3534
  inheritAttrs: !1,
3535
3535
  __name: "CopilotChatAudioRecorder",
3536
3536
  setup(e, { expose: n }) {
3537
- const t = Ge(), a = I(null), i = I("idle"), o = I(null), s = I(null), r = I(null), l = I(null), p = I(null), k = I([]), u = I([]), d = I(0), g = I(0), h = I(0);
3537
+ const t = Ge(), a = I(null), i = I("idle"), o = I(null), s = I(null), r = I(null), l = I(null), p = I(null), y = I([]), u = I([]), d = I(0), g = I(0), h = I(0);
3538
3538
  function C() {
3539
3539
  p.value !== null && (cancelAnimationFrame(p.value), p.value = null);
3540
3540
  const v = o.value;
@@ -3544,9 +3544,9 @@ const zs = /* @__PURE__ */ se({
3544
3544
  } catch {
3545
3545
  }
3546
3546
  s.value && (s.value.getTracks().forEach((S) => S.stop()), s.value = null);
3547
- const b = l.value;
3548
- b && b.state !== "closed" && b.close().catch(() => {
3549
- }), o.value = null, r.value = null, l.value = null, k.value = [], u.value = [], d.value = 0, g.value = 0, h.value = 0;
3547
+ const k = l.value;
3548
+ k && k.state !== "closed" && k.close().catch(() => {
3549
+ }), o.value = null, r.value = null, l.value = null, y.value = [], u.value = [], d.value = 0, g.value = 0, h.value = 0;
3550
3550
  }
3551
3551
  async function m() {
3552
3552
  if (i.value !== "idle")
@@ -3554,13 +3554,13 @@ const zs = /* @__PURE__ */ se({
3554
3554
  try {
3555
3555
  const v = await navigator.mediaDevices.getUserMedia({ audio: !0 });
3556
3556
  s.value = v;
3557
- const b = new AudioContext();
3558
- l.value = b;
3559
- const S = b.createMediaStreamSource(v), O = b.createAnalyser();
3557
+ const k = new AudioContext();
3558
+ l.value = k;
3559
+ const S = k.createMediaStreamSource(v), O = k.createAnalyser();
3560
3560
  O.fftSize = 2048, S.connect(O), r.value = O;
3561
- const D = MediaRecorder.isTypeSupported("audio/webm;codecs=opus") ? "audio/webm;codecs=opus" : MediaRecorder.isTypeSupported("audio/webm") ? "audio/webm" : MediaRecorder.isTypeSupported("audio/mp4") ? "audio/mp4" : "", $ = D ? { mimeType: D } : {}, P = new MediaRecorder(v, $);
3562
- o.value = P, k.value = [], P.ondataavailable = (Y) => {
3563
- Y.data.size > 0 && k.value.push(Y.data);
3561
+ const j = MediaRecorder.isTypeSupported("audio/webm;codecs=opus") ? "audio/webm;codecs=opus" : MediaRecorder.isTypeSupported("audio/webm") ? "audio/webm" : MediaRecorder.isTypeSupported("audio/mp4") ? "audio/mp4" : "", $ = j ? { mimeType: j } : {}, P = new MediaRecorder(v, $);
3562
+ o.value = P, y.value = [], P.ondataavailable = (ee) => {
3563
+ ee.data.size > 0 && y.value.push(ee.data);
3564
3564
  }, P.start(100), i.value = "recording";
3565
3565
  } catch (v) {
3566
3566
  throw C(), v instanceof Error && v.name === "NotAllowedError" ? new yt("Microphone permission denied") : v instanceof Error && v.name === "NotFoundError" ? new yt("No microphone found") : new yt(
@@ -3569,64 +3569,64 @@ const zs = /* @__PURE__ */ se({
3569
3569
  }
3570
3570
  }
3571
3571
  function x() {
3572
- return new Promise((v, b) => {
3572
+ return new Promise((v, k) => {
3573
3573
  const S = o.value;
3574
3574
  if (!S || i.value !== "recording") {
3575
- b(new yt("No active recording"));
3575
+ k(new yt("No active recording"));
3576
3576
  return;
3577
3577
  }
3578
3578
  i.value = "processing", S.onstop = () => {
3579
- const O = new Blob(k.value, {
3579
+ const O = new Blob(y.value, {
3580
3580
  type: S.mimeType || "audio/webm"
3581
3581
  });
3582
3582
  C(), i.value = "idle", v(O);
3583
3583
  }, S.onerror = () => {
3584
- C(), i.value = "idle", b(new yt("Recording failed"));
3584
+ C(), i.value = "idle", k(new yt("Recording failed"));
3585
3585
  }, S.stop();
3586
3586
  });
3587
3587
  }
3588
3588
  function f(v) {
3589
- let b = 0;
3589
+ let k = 0;
3590
3590
  for (let S = 0; S < v.length; S += 1) {
3591
3591
  const O = (v[S] ?? 128) / 128 - 1;
3592
- b += O * O;
3592
+ k += O * O;
3593
3593
  }
3594
- return Math.sqrt(b / v.length);
3594
+ return Math.sqrt(k / v.length);
3595
3595
  }
3596
- function y() {
3596
+ function b() {
3597
3597
  const v = a.value;
3598
3598
  if (!v)
3599
3599
  return;
3600
- const b = v.getContext("2d");
3601
- if (!b)
3600
+ const k = v.getContext("2d");
3601
+ if (!k)
3602
3602
  return;
3603
3603
  const S = v.getBoundingClientRect(), O = window.devicePixelRatio || 1;
3604
- (v.width !== S.width * O || v.height !== S.height * O) && (v.width = S.width * O, v.height = S.height * O, b.scale(O, O));
3605
- const D = 2, P = D + 1, Y = Math.floor(S.width / P) + 2;
3604
+ (v.width !== S.width * O || v.height !== S.height * O) && (v.width = S.width * O, v.height = S.height * O, k.scale(O, O));
3605
+ const j = 2, P = j + 1, ee = Math.floor(S.width / P) + 2;
3606
3606
  if (r.value && i.value === "recording") {
3607
- u.value.length === 0 && (u.value = Array.from({ length: Y }, () => 0)), h.value < 1 && (h.value = Math.min(1, h.value + 0.03)), d.value += 1 / 3;
3607
+ u.value.length === 0 && (u.value = Array.from({ length: ee }, () => 0)), h.value < 1 && (h.value = Math.min(1, h.value + 0.03)), d.value += 1 / 3;
3608
3608
  const ne = r.value.fftSize, re = new Uint8Array(ne);
3609
3609
  r.value.getByteTimeDomainData(re);
3610
3610
  const F = f(re), ae = F > g.value ? 0.12 : 0.08;
3611
- g.value += (F - g.value) * ae, d.value >= P && (d.value -= P, u.value.push(g.value), u.value.length > Y && (u.value = u.value.slice(-Y)));
3611
+ g.value += (F - g.value) * ae, d.value >= P && (d.value -= P, u.value.push(g.value), u.value.length > ee && (u.value = u.value.slice(-ee)));
3612
3612
  }
3613
- b.clearRect(0, 0, S.width, S.height);
3613
+ k.clearRect(0, 0, S.width, S.height);
3614
3614
  const ve = window.getComputedStyle(v);
3615
- b.fillStyle = ve.color, b.globalAlpha = h.value;
3615
+ k.fillStyle = ve.color, k.globalAlpha = h.value;
3616
3616
  const te = S.height / 2, K = S.height / 2 - 2, E = 12;
3617
3617
  for (let ne = 0; ne < u.value.length; ne += 1) {
3618
- const re = u.value[ne] ?? 0, F = Math.min(re * 4, 1), U = Math.max(2, F * K * 2), H = S.width - (u.value.length - ne) * P - d.value, ae = te - U / 2;
3619
- if (H + D <= 0 || H >= S.width)
3618
+ const re = u.value[ne] ?? 0, F = Math.min(re * 4, 1), D = Math.max(2, F * K * 2), H = S.width - (u.value.length - ne) * P - d.value, ae = te - D / 2;
3619
+ if (H + j <= 0 || H >= S.width)
3620
3620
  continue;
3621
3621
  let we = 1;
3622
- H < E ? we = Math.max(0, H / E) : H > S.width - E && (we = Math.max(0, (S.width - H) / E)), b.globalAlpha = h.value * we, b.fillRect(H, ae, D, U);
3622
+ H < E ? we = Math.max(0, H / E) : H > S.width - E && (we = Math.max(0, (S.width - H) / E)), k.globalAlpha = h.value * we, k.fillRect(H, ae, j, D);
3623
3623
  }
3624
- p.value = requestAnimationFrame(y);
3624
+ p.value = requestAnimationFrame(b);
3625
3625
  }
3626
3626
  return L(
3627
3627
  i,
3628
3628
  () => {
3629
- p.value !== null && (cancelAnimationFrame(p.value), p.value = null), p.value = requestAnimationFrame(y);
3629
+ p.value !== null && (cancelAnimationFrame(p.value), p.value = null), p.value = requestAnimationFrame(b);
3630
3630
  },
3631
3631
  { immediate: !0 }
3632
3632
  ), Me(() => {
@@ -3638,7 +3638,7 @@ const zs = /* @__PURE__ */ se({
3638
3638
  start: m,
3639
3639
  stop: x,
3640
3640
  dispose: C
3641
- }), (v, b) => (R(), j("div", ge({
3641
+ }), (v, k) => (R(), B("div", ge({
3642
3642
  "data-copilotkit": "",
3643
3643
  class: "cpk:w-full cpk:px-5 cpk:py-3"
3644
3644
  }, G(t)), [
@@ -3667,7 +3667,7 @@ const zs = /* @__PURE__ */ se({
3667
3667
  color: "#b45309",
3668
3668
  textDecoration: "underline"
3669
3669
  };
3670
- return (a, i) => (R(), j("div", {
3670
+ return (a, i) => (R(), B("div", {
3671
3671
  style: n,
3672
3672
  "data-testid": "copilot-inline-feature-warning"
3673
3673
  }, [
@@ -3713,7 +3713,7 @@ function qs(e, n, t) {
3713
3713
  function wn(e = {}) {
3714
3714
  const n = c(() => _e(e.agentId) ?? ct), t = Oe(), a = c(
3715
3715
  () => _e(e.threadId) ?? t.value?.threadId
3716
- ), { copilotkit: i } = Be(), o = c(() => e.updates ?? _s), s = c(() => i.value.defaultThrottleMs), r = c(() => _e(e.throttleMs)), l = it(null), p = it(null), k = /* @__PURE__ */ new Map(), u = (g, h, C, m) => {
3716
+ ), { copilotkit: i } = Be(), o = c(() => e.updates ?? _s), s = c(() => i.value.defaultThrottleMs), r = c(() => _e(e.throttleMs)), l = it(null), p = it(null), y = /* @__PURE__ */ new Map(), u = (g, h, C, m) => {
3717
3717
  const x = new xa({
3718
3718
  runtimeUrl: h,
3719
3719
  agentId: g,
@@ -3739,14 +3739,14 @@ function wn(e = {}) {
3739
3739
  () => {
3740
3740
  const g = n.value, h = a.value, C = h ? `${g}:${h}` : g, m = i.value, x = m.getAgent(g);
3741
3741
  if (x) {
3742
- k.delete(C), k.delete(g);
3742
+ y.delete(C), y.delete(g);
3743
3743
  const S = h ? qs(x, h, m.headers) : x, O = l.value === S;
3744
3744
  l.value = S, p.value = S, O && ot(l);
3745
3745
  return;
3746
3746
  }
3747
- const f = m.runtimeUrl !== void 0, y = m.runtimeConnectionStatus;
3748
- if (f && (y === Pt.Disconnected || y === Pt.Connecting || y === Pt.Error)) {
3749
- const S = k.get(C);
3747
+ const f = m.runtimeUrl !== void 0, b = m.runtimeConnectionStatus;
3748
+ if (f && (b === Pt.Disconnected || b === Pt.Connecting || b === Pt.Error)) {
3749
+ const S = y.get(C);
3750
3750
  if (S) {
3751
3751
  S.headers = { ...m.headers }, h && (S.threadId = h), l.value = S, p.value = S;
3752
3752
  return;
@@ -3757,12 +3757,12 @@ function wn(e = {}) {
3757
3757
  m.runtimeTransport,
3758
3758
  m.headers
3759
3759
  );
3760
- h && (O.threadId = h), k.set(C, O), l.value = O, p.value = O;
3760
+ h && (O.threadId = h), y.set(C, O), l.value = O, p.value = O;
3761
3761
  return;
3762
3762
  }
3763
- const v = Object.keys(m.agents ?? {}), b = f ? `runtimeUrl=${m.runtimeUrl}` : "no runtimeUrl";
3763
+ const v = Object.keys(m.agents ?? {}), k = f ? `runtimeUrl=${m.runtimeUrl}` : "no runtimeUrl";
3764
3764
  throw new Error(
3765
- `useAgent: Agent '${g}' not found after runtime sync (${b}). ` + (v.length ? `Known agents: [${v.join(", ")}]` : "No agents registered.") + " Verify your runtime /info and/or agents__unsafe_dev_only."
3765
+ `useAgent: Agent '${g}' not found after runtime sync (${k}). ` + (v.length ? `Known agents: [${v.join(", ")}]` : "No agents registered.") + " Verify your runtime /info and/or agents__unsafe_dev_only."
3766
3766
  );
3767
3767
  },
3768
3768
  { immediate: !0 }
@@ -3784,27 +3784,27 @@ function wn(e = {}) {
3784
3784
  ([g, h], C, m) => {
3785
3785
  const x = h;
3786
3786
  if (!g || x.length === 0) return;
3787
- let f = !0, y = !1;
3787
+ let f = !0, b = !1;
3788
3788
  const v = () => {
3789
- f && (y || (y = !0, queueMicrotask(() => {
3790
- y = !1, f && ot(l);
3789
+ f && (b || (b = !0, queueMicrotask(() => {
3790
+ b = !1, f && ot(l);
3791
3791
  })));
3792
- }, b = {};
3792
+ }, k = {};
3793
3793
  x.includes(
3794
3794
  "OnMessagesChanged"
3795
3795
  /* OnMessagesChanged */
3796
- ) && (b.onMessagesChanged = () => {
3796
+ ) && (k.onMessagesChanged = () => {
3797
3797
  f && ot(l);
3798
3798
  }), x.includes(
3799
3799
  "OnStateChanged"
3800
3800
  /* OnStateChanged */
3801
- ) && (b.onStateChanged = v), x.includes(
3801
+ ) && (k.onStateChanged = v), x.includes(
3802
3802
  "OnRunStatusChanged"
3803
3803
  /* OnRunStatusChanged */
3804
- ) && (b.onRunInitialized = v, b.onRunFinalized = v, b.onRunFailed = v, b.onRunErrorEvent = v);
3804
+ ) && (k.onRunInitialized = v, k.onRunFinalized = v, k.onRunFailed = v, k.onRunErrorEvent = v);
3805
3805
  const S = i.value.subscribeToAgentWithOptions(
3806
3806
  g,
3807
- b,
3807
+ k,
3808
3808
  { throttleMs: _e(e.throttleMs) }
3809
3809
  );
3810
3810
  m(() => {
@@ -3825,7 +3825,7 @@ function Ks(e = {}) {
3825
3825
  immediate: !0
3826
3826
  }), L(
3827
3827
  [() => n.value, a],
3828
- (p, k, u) => {
3828
+ (p, y, u) => {
3829
3829
  const d = n.value, g = a.value, h = d.subscribe({
3830
3830
  onSuggestionsChanged: ({ agentId: C, suggestions: m }) => {
3831
3831
  if (C !== g) return;
@@ -3872,73 +3872,73 @@ function Gs(e) {
3872
3872
  }, p = (f) => {
3873
3873
  l(f(s.value));
3874
3874
  };
3875
- async function k(f) {
3876
- const y = o.value, v = y?.accept ?? "*/*", b = y?.maxSize ?? 20 * 1024 * 1024, S = f.filter(
3877
- (D) => !en(D, v)
3875
+ async function y(f) {
3876
+ const b = o.value, v = b?.accept ?? "*/*", k = b?.maxSize ?? 20 * 1024 * 1024, S = f.filter(
3877
+ (j) => !en(j, v)
3878
3878
  );
3879
- for (const D of S)
3880
- y?.onUploadFailed?.({
3879
+ for (const j of S)
3880
+ b?.onUploadFailed?.({
3881
3881
  reason: "invalid-type",
3882
- file: D,
3883
- message: `File "${D.name}" is not accepted. Supported types: ${v}`
3882
+ file: j,
3883
+ message: `File "${j.name}" is not accepted. Supported types: ${v}`
3884
3884
  });
3885
3885
  const O = f.filter(
3886
- (D) => en(D, v)
3886
+ (j) => en(j, v)
3887
3887
  );
3888
- for (const D of O) {
3889
- if (ha(D, b)) {
3890
- y?.onUploadFailed?.({
3888
+ for (const j of O) {
3889
+ if (ha(j, k)) {
3890
+ b?.onUploadFailed?.({
3891
3891
  reason: "file-too-large",
3892
- file: D,
3893
- message: `File "${D.name}" exceeds the maximum size of ${on(b)}`
3892
+ file: j,
3893
+ message: `File "${j.name}" exceeds the maximum size of ${on(k)}`
3894
3894
  });
3895
3895
  continue;
3896
3896
  }
3897
- const $ = ba(D.type), P = pt();
3898
- p((Y) => [
3899
- ...Y,
3897
+ const $ = ba(j.type), P = pt();
3898
+ p((ee) => [
3899
+ ...ee,
3900
3900
  {
3901
3901
  id: P,
3902
3902
  type: $,
3903
- source: { type: "data", value: "", mimeType: D.type },
3904
- filename: D.name,
3905
- size: D.size,
3903
+ source: { type: "data", value: "", mimeType: j.type },
3904
+ filename: j.name,
3905
+ size: j.size,
3906
3906
  status: "uploading"
3907
3907
  }
3908
3908
  ]);
3909
3909
  try {
3910
- let Y, ve;
3911
- if (y?.onUpload) {
3912
- const K = await y.onUpload(D), { metadata: E, ...ne } = K;
3913
- Y = ne, ve = E;
3910
+ let ee, ve;
3911
+ if (b?.onUpload) {
3912
+ const K = await b.onUpload(j), { metadata: E, ...ne } = K;
3913
+ ee = ne, ve = E;
3914
3914
  } else
3915
- Y = { type: "data", value: await ka(D), mimeType: D.type };
3915
+ ee = { type: "data", value: await ka(j), mimeType: j.type };
3916
3916
  let te;
3917
- $ === "video" && (te = await ya(D)), p(
3917
+ $ === "video" && (te = await ya(j)), p(
3918
3918
  (K) => K.map(
3919
3919
  (E) => E.id === P ? {
3920
3920
  ...E,
3921
- source: Y,
3921
+ source: ee,
3922
3922
  status: "ready",
3923
3923
  thumbnail: te,
3924
3924
  metadata: ve
3925
3925
  } : E
3926
3926
  )
3927
3927
  );
3928
- } catch (Y) {
3928
+ } catch (ee) {
3929
3929
  p(
3930
3930
  (ve) => ve.filter((te) => te.id !== P)
3931
- ), console.error(`[CopilotKit] Failed to upload "${D.name}":`, Y), y?.onUploadFailed?.({
3931
+ ), console.error(`[CopilotKit] Failed to upload "${j.name}":`, ee), b?.onUploadFailed?.({
3932
3932
  reason: "upload-failed",
3933
- file: D,
3934
- message: Y instanceof Error ? Y.message : `Failed to upload "${D.name}"`
3933
+ file: j,
3934
+ message: ee instanceof Error ? ee.message : `Failed to upload "${j.name}"`
3935
3935
  });
3936
3936
  }
3937
3937
  }
3938
3938
  }
3939
3939
  async function u(f) {
3940
- const y = f.target;
3941
- y?.files?.length && (await k(Array.from(y.files)), y && (y.value = ""));
3940
+ const b = f.target;
3941
+ b?.files?.length && (await y(Array.from(b.files)), b && (b.value = ""));
3942
3942
  }
3943
3943
  function d(f) {
3944
3944
  r.value && (f.preventDefault(), f.stopPropagation(), t.value = !0);
@@ -3948,35 +3948,35 @@ function Gs(e) {
3948
3948
  }
3949
3949
  async function h(f) {
3950
3950
  if (f.preventDefault(), f.stopPropagation(), t.value = !1, !r.value) return;
3951
- const y = Array.from(f.dataTransfer?.files ?? []);
3952
- y.length > 0 && await k(y);
3951
+ const b = Array.from(f.dataTransfer?.files ?? []);
3952
+ b.length > 0 && await y(b);
3953
3953
  }
3954
3954
  function C(f) {
3955
3955
  p(
3956
- (y) => y.filter((v) => v.id !== f)
3956
+ (b) => b.filter((v) => v.id !== f)
3957
3957
  );
3958
3958
  }
3959
3959
  function m() {
3960
3960
  const f = s.value.filter(
3961
- (y) => y.status === "ready"
3961
+ (b) => b.status === "ready"
3962
3962
  );
3963
3963
  return f.length === 0 || (p(
3964
- (y) => y.filter((v) => v.status !== "ready")
3964
+ (b) => b.filter((v) => v.status !== "ready")
3965
3965
  ), a.value && (a.value.value = "")), f;
3966
3966
  }
3967
3967
  async function x(f) {
3968
3968
  if (!r.value) return;
3969
- const y = f.target;
3970
- if (!y || !i.value?.contains(y)) return;
3971
- const v = o.value?.accept ?? "*/*", S = Array.from(f.clipboardData?.items ?? []).filter((D) => {
3972
- if (D.kind !== "file") return !1;
3973
- const $ = D.getAsFile();
3969
+ const b = f.target;
3970
+ if (!b || !i.value?.contains(b)) return;
3971
+ const v = o.value?.accept ?? "*/*", S = Array.from(f.clipboardData?.items ?? []).filter((j) => {
3972
+ if (j.kind !== "file") return !1;
3973
+ const $ = j.getAsFile();
3974
3974
  return $ !== null && en($, v);
3975
3975
  });
3976
3976
  if (S.length === 0) return;
3977
3977
  f.preventDefault();
3978
- const O = S.map((D) => D.getAsFile()).filter((D) => D !== null);
3979
- await k(O);
3978
+ const O = S.map((j) => j.getAsFile()).filter((j) => j !== null);
3979
+ await y(O);
3980
3980
  }
3981
3981
  return Je(() => {
3982
3982
  typeof document < "u" && document.addEventListener("paste", x);
@@ -3988,7 +3988,7 @@ function Gs(e) {
3988
3988
  dragOver: t,
3989
3989
  fileInputRef: a,
3990
3990
  containerRef: i,
3991
- processFiles: k,
3991
+ processFiles: y,
3992
3992
  handleFileUpload: u,
3993
3993
  handleDragOver: d,
3994
3994
  handleDragLeave: g,
@@ -4090,8 +4090,8 @@ function Zs() {
4090
4090
  if (typeof window > "u") return;
4091
4091
  const r = window.visualViewport;
4092
4092
  if (!r) return;
4093
- const l = window.innerHeight, p = r.height, k = Math.max(0, l - p), u = k > 150;
4094
- t.value = k, n.value = u, a.value = p, i.value = l;
4093
+ const l = window.innerHeight, p = r.height, y = Math.max(0, l - p), u = y > 150;
4094
+ t.value = y, n.value = u, a.value = p, i.value = l;
4095
4095
  };
4096
4096
  let s = null;
4097
4097
  return Je(() => {
@@ -4123,9 +4123,9 @@ function ni({
4123
4123
  ti(),
4124
4124
  !0
4125
4125
  );
4126
- let o = -1, s = 0, r = null, l = null;
4127
- function p() {
4128
- r !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(r), r = null, l?.disconnect(), l = null;
4126
+ let o = -1, s = null, r = null;
4127
+ function l() {
4128
+ s !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(s), s = null, r?.disconnect(), r = null;
4129
4129
  }
4130
4130
  L(
4131
4131
  [
@@ -4136,30 +4136,30 @@ function ni({
4136
4136
  t,
4137
4137
  () => a
4138
4138
  ],
4139
- ([k, u, d, g, h], C, m) => {
4140
- if (m(p), u === o || (o = u, !k) || !d || !g || !h) return;
4141
- const x = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(k) : k.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&"), f = g.querySelector(
4142
- `[data-message-id="${x}"]`
4139
+ ([p, y, u, d, g], h, C) => {
4140
+ if (C(l), y === o || (o = y, !p) || !u || !d || !g) return;
4141
+ const m = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(p) : p.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&"), x = d.querySelector(
4142
+ `[data-message-id="${m}"]`
4143
4143
  );
4144
- if (!f) return;
4145
- const y = d.clientHeight, v = f.getBoundingClientRect().height, b = parseFloat(getComputedStyle(f).paddingTop) || 0, S = Math.max(0, v - b), O = Math.max(
4144
+ if (!x) return;
4145
+ const f = u.clientHeight, b = x.getBoundingClientRect().height, v = parseFloat(getComputedStyle(x).paddingTop) || 0, k = Math.max(0, b - v), S = Math.max(
4146
4146
  0,
4147
- y - S - a
4147
+ f - k - a
4148
4148
  );
4149
- h.style.height = `${O}px`, s = O, typeof requestAnimationFrame == "function" && (r = requestAnimationFrame(() => {
4150
- const D = Nn(f, d) + b - a;
4151
- d.scrollTo({
4152
- top: Math.max(0, D),
4149
+ g.style.height = `${S}px`, typeof requestAnimationFrame == "function" && (s = requestAnimationFrame(() => {
4150
+ const O = Nn(x, u) + v - a;
4151
+ u.scrollTo({
4152
+ top: Math.max(0, O),
4153
4153
  behavior: "smooth"
4154
4154
  });
4155
- })), typeof ResizeObserver < "u" && (l = new ResizeObserver(() => {
4156
- if (!g || !h || !d) return;
4157
- const D = g.getBoundingClientRect().height, $ = Nn(
4158
- f,
4159
- g
4160
- ), P = D - $ - v, Y = Math.max(0, O - P);
4161
- Y < s && (h.style.height = `${Y}px`, s = Y);
4162
- }), l.observe(g));
4155
+ })), typeof ResizeObserver < "u" && (r = new ResizeObserver(() => {
4156
+ if (!d || !g || !u) return;
4157
+ const O = d.getBoundingClientRect().height, j = Nn(
4158
+ x,
4159
+ d
4160
+ ), $ = O - j - b, P = Math.max(0, S - $);
4161
+ g.style.height = `${P}px`;
4162
+ }), r.observe(d));
4163
4163
  },
4164
4164
  { immediate: !0, flush: "post" }
4165
4165
  );
@@ -4200,18 +4200,18 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4200
4200
  },
4201
4201
  emits: ["update:modelValue", "submit-message", "stop", "add-file", "start-transcribe", "cancel-transcribe", "finish-transcribe", "finish-transcribe-with-audio"],
4202
4202
  setup(e, { emit: n }) {
4203
- const t = e, a = n, i = Ge(), o = Oe(), s = lt(), r = I(null), l = I(null), p = I(null), k = I(null), u = I(null), d = I(null), g = I(null), h = I(null), C = I(t.modelValue ?? ""), m = I(!1), x = I("compact"), f = I(null), y = I(0), v = I(null), b = I(!1), S = I({
4203
+ const t = e, a = n, i = Ge(), o = Oe(), s = lt(), r = I(null), l = I(null), p = I(null), y = I(null), u = I(null), d = I(null), g = I(null), h = I(null), C = I(t.modelValue ?? ""), m = I(!1), x = I("compact"), f = I(null), b = I(0), v = I(null), k = I(!1), S = I({
4204
4204
  singleLineHeight: 0,
4205
4205
  maxHeight: 0,
4206
4206
  paddingLeft: 0,
4207
4207
  paddingRight: 0
4208
- }), O = I(null), D = I(!1), $ = I(null), P = I(null), Y = I(!1), ve = I(!1);
4208
+ }), O = I(null), j = I(!1), $ = I(null), P = I(null), ee = I(!1), ve = I(!1);
4209
4209
  let te = null, K = null;
4210
4210
  const E = c(
4211
4211
  () => s?.vnode.props ?? {}
4212
4212
  ), ne = c(() => t.modelValue !== void 0), re = c(
4213
4213
  () => ne.value ? t.modelValue ?? "" : C.value
4214
- ), F = c(() => o.value?.labels ?? Ze), U = c(
4214
+ ), F = c(() => o.value?.labels ?? Ze), D = c(
4215
4215
  () => t.placeholder ?? F.value.chatInputPlaceholder
4216
4216
  ), H = c(
4217
4217
  () => t.mode === "input" && x.value === "expanded"
@@ -4219,16 +4219,16 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4219
4219
  () => t.mode !== "transcribe" && t.isRunning
4220
4220
  ), we = c(
4221
4221
  () => t.showDisclaimer ?? t.positioning === "absolute"
4222
- ), V = c(() => Ae("onSubmitMessage")), X = c(() => Ae("onStop")), Z = c(() => Ae("onAddFile")), ee = c(
4222
+ ), V = c(() => Ae("onSubmitMessage")), X = c(() => Ae("onStop")), Y = c(() => Ae("onAddFile")), Z = c(
4223
4223
  () => Ae("onStartTranscribe")
4224
4224
  ), be = c(
4225
4225
  () => Ae("onCancelTranscribe")
4226
4226
  ), Te = c(
4227
4227
  () => Ae("onFinishTranscribe")
4228
- ), B = c(
4228
+ ), U = c(
4229
4229
  () => t.mode === "input" && !t.disabled && V.value && re.value.trim().length > 0
4230
4230
  ), ue = c(
4231
- () => ae.value ? !X.value : !B.value
4231
+ () => ae.value ? !X.value : !U.value
4232
4232
  ), pe = c(() => [
4233
4233
  t.positioning === "absolute" && "cpk:absolute cpk:bottom-0 cpk:left-0 cpk:right-0 cpk:z-20 cpk:pointer-events-none",
4234
4234
  i.class
@@ -4244,7 +4244,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4244
4244
  return Array.isArray(N) ? N.length > 0 : !!N;
4245
4245
  }
4246
4246
  function ze() {
4247
- return Z.value ? {
4247
+ return Y.value ? {
4248
4248
  label: F.value.chatInputToolbarAddButtonLabel,
4249
4249
  action: () => a("add-file")
4250
4250
  } : null;
@@ -4347,7 +4347,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4347
4347
  f.value = null;
4348
4348
  }
4349
4349
  function Et(A) {
4350
- Ft(), A.action?.(), f.value = null, y.value = 0, requestAnimationFrame(() => {
4350
+ Ft(), A.action?.(), f.value = null, b.value = 0, requestAnimationFrame(() => {
4351
4351
  l.value?.focus();
4352
4352
  });
4353
4353
  }
@@ -4372,15 +4372,15 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4372
4372
  if (!t.disabled && !(m.value || A.isComposing || A.keyCode === 229)) {
4373
4373
  if (f.value !== null && t.mode === "input") {
4374
4374
  if (A.key === "ArrowDown") {
4375
- le.value.length > 0 && (A.preventDefault(), y.value = y.value < 0 ? 0 : (y.value + 1) % le.value.length);
4375
+ le.value.length > 0 && (A.preventDefault(), b.value = b.value < 0 ? 0 : (b.value + 1) % le.value.length);
4376
4376
  return;
4377
4377
  }
4378
4378
  if (A.key === "ArrowUp") {
4379
- le.value.length > 0 && (A.preventDefault(), y.value < 0 ? y.value = le.value.length - 1 : y.value = y.value <= 0 ? le.value.length - 1 : y.value - 1);
4379
+ le.value.length > 0 && (A.preventDefault(), b.value < 0 ? b.value = le.value.length - 1 : b.value = b.value <= 0 ? le.value.length - 1 : b.value - 1);
4380
4380
  return;
4381
4381
  }
4382
4382
  if (A.key === "Enter") {
4383
- const N = y.value >= 0 ? le.value[y.value] : void 0;
4383
+ const N = b.value >= 0 ? le.value[b.value] : void 0;
4384
4384
  if (N) {
4385
4385
  A.preventDefault(), Et(N);
4386
4386
  return;
@@ -4401,10 +4401,10 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4401
4401
  }
4402
4402
  }
4403
4403
  function Ve() {
4404
- !xe.value || t.mode === "transcribe" || t.disabled || (b.value = !b.value);
4404
+ !xe.value || t.mode === "transcribe" || t.disabled || (k.value = !k.value);
4405
4405
  }
4406
4406
  function gt() {
4407
- b.value = !1;
4407
+ k.value = !1;
4408
4408
  }
4409
4409
  function tt(A) {
4410
4410
  A(), gt(), ft(() => {
@@ -4455,7 +4455,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4455
4455
  return A.style.height = `${N ? Math.min(ie, N) : ie}px`, ie;
4456
4456
  }
4457
4457
  function nt(A) {
4458
- x.value !== A && (D.value = !0, x.value = A);
4458
+ x.value !== A && (j.value = !0, x.value = A);
4459
4459
  }
4460
4460
  function Yt(A) {
4461
4461
  const N = window.getComputedStyle(A);
@@ -4466,12 +4466,12 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4466
4466
  if (ie.trim())
4467
4467
  return ie;
4468
4468
  }
4469
- return process.env.NODE_ENV !== "production" && !Y.value && (Y.value = !0, console.warn(
4469
+ return process.env.NODE_ENV !== "production" && !ee.value && (ee.value = !0, console.warn(
4470
4470
  "[CopilotChatInput] Could not resolve textarea font for layout measurement. Text-width-based expansion will be skipped until the next container resize."
4471
4471
  )), null;
4472
4472
  }
4473
4473
  function at() {
4474
- const A = p.value, N = k.value, ie = u.value;
4474
+ const A = p.value, N = y.value, ie = u.value;
4475
4475
  if (!A || !N || !ie)
4476
4476
  return P.value = null, null;
4477
4477
  const me = window.getComputedStyle(A), He = parseFloat(me.paddingLeft) || 0, Ce = parseFloat(me.paddingRight) || 0, We = parseFloat(me.columnGap) || 0, ut = A.clientWidth - He - Ce;
@@ -4496,7 +4496,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4496
4496
  return;
4497
4497
  }
4498
4498
  const A = l.value;
4499
- if (!A || !p.value || !k.value || !u.value)
4499
+ if (!A || !p.value || !y.value || !u.value)
4500
4500
  return;
4501
4501
  S.value.singleLineHeight === 0 && Tt();
4502
4502
  const N = Lt(), ie = S.value.singleLineHeight, me = re.value.includes(`
@@ -4535,11 +4535,11 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4535
4535
  nt(Ce ? "expanded" : "compact");
4536
4536
  }
4537
4537
  function bt(A) {
4538
- if (D.value) {
4539
- D.value = !1;
4538
+ if (j.value) {
4539
+ j.value = !1;
4540
4540
  return;
4541
4541
  }
4542
- A && (P.value = null, Y.value = !1, ve.value = !1), O.value !== null && cancelAnimationFrame(O.value), O.value = requestAnimationFrame(() => {
4542
+ A && (P.value = null, ee.value = !1, ve.value = !1), O.value !== null && cancelAnimationFrame(O.value), O.value = requestAnimationFrame(() => {
4543
4543
  O.value = null, Pe();
4544
4544
  });
4545
4545
  }
@@ -4555,21 +4555,21 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4555
4555
  }), L(
4556
4556
  [f, () => le.value.length],
4557
4557
  ([A, N]) => {
4558
- A !== null && A !== v.value && N > 0 && (y.value = 0), v.value = A;
4558
+ A !== null && A !== v.value && N > 0 && (b.value = 0), v.value = A;
4559
4559
  },
4560
4560
  { immediate: !0 }
4561
4561
  ), L(
4562
4562
  [f, le],
4563
4563
  () => {
4564
4564
  if (f.value === null) {
4565
- y.value = 0;
4565
+ b.value = 0;
4566
4566
  return;
4567
4567
  }
4568
4568
  if (le.value.length === 0) {
4569
- y.value = -1;
4569
+ b.value = -1;
4570
4570
  return;
4571
4571
  }
4572
- (y.value < 0 || y.value >= le.value.length) && (y.value = 0);
4572
+ (b.value < 0 || b.value >= le.value.length) && (b.value = 0);
4573
4573
  },
4574
4574
  { immediate: !0 }
4575
4575
  ), L(
@@ -4605,7 +4605,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4605
4605
  }
4606
4606
  },
4607
4607
  { immediate: !0 }
4608
- ), L(y, async (A) => {
4608
+ ), L(b, async (A) => {
4609
4609
  if (!Ne.value || A < 0)
4610
4610
  return;
4611
4611
  await ft(), d.value?.querySelector(
@@ -4619,22 +4619,22 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4619
4619
  ), Je(() => {
4620
4620
  if (t.autoFocus && t.mode === "input" && l.value?.focus(), Pe(), typeof ResizeObserver < "u") {
4621
4621
  const A = /* @__PURE__ */ new Set();
4622
- p.value && A.add(p.value), k.value && A.add(k.value), u.value && A.add(u.value), te = new ResizeObserver((N) => {
4622
+ p.value && A.add(p.value), y.value && A.add(y.value), u.value && A.add(u.value), te = new ResizeObserver((N) => {
4623
4623
  const ie = N.some(
4624
4624
  (me) => A.has(me.target)
4625
4625
  );
4626
4626
  bt(ie);
4627
- }), p.value && te.observe(p.value), k.value && te.observe(k.value), u.value && te.observe(u.value), l.value && te.observe(l.value);
4627
+ }), p.value && te.observe(p.value), y.value && te.observe(y.value), u.value && te.observe(u.value), l.value && te.observe(l.value);
4628
4628
  }
4629
4629
  K = (A) => {
4630
- if (!b.value)
4630
+ if (!k.value)
4631
4631
  return;
4632
4632
  const N = A.target;
4633
- N && (g.value?.contains(N) || k.value?.contains(N) || gt());
4633
+ N && (g.value?.contains(N) || y.value?.contains(N) || gt());
4634
4634
  }, document.addEventListener("mousedown", K);
4635
4635
  }), Me(() => {
4636
4636
  K && (document.removeEventListener("mousedown", K), K = null), te?.disconnect(), te = null, O.value !== null && (cancelAnimationFrame(O.value), O.value = null);
4637
- }), (A, N) => (R(), j("div", ge({
4637
+ }), (A, N) => (R(), B("div", ge({
4638
4638
  "data-copilotkit": "",
4639
4639
  "data-testid": "copilot-chat-input-container",
4640
4640
  class: pe.value,
@@ -4650,10 +4650,10 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4650
4650
  isMultiline: H.value,
4651
4651
  value: re.value,
4652
4652
  disabled: e.disabled,
4653
- placeholder: U.value,
4653
+ placeholder: D.value,
4654
4654
  isProcessing: ae.value,
4655
4655
  sendDisabled: ue.value,
4656
- menuOpen: b.value,
4656
+ menuOpen: k.value,
4657
4657
  menuItems: z.value,
4658
4658
  onToggleMenu: Ve,
4659
4659
  onMenuAction: tt,
@@ -4684,7 +4684,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4684
4684
  }, [
4685
4685
  M("div", {
4686
4686
  ref_key: "addButtonContainerRef",
4687
- ref: k,
4687
+ ref: y,
4688
4688
  class: ye([
4689
4689
  "cpk:relative cpk:flex cpk:items-center cpk:col-start-1",
4690
4690
  H.value ? "cpk:row-start-2" : "cpk:row-start-1"
@@ -4692,7 +4692,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4692
4692
  }, [
4693
4693
  T(A.$slots, "add-menu-button", {
4694
4694
  disabled: e.disabled || e.mode === "transcribe" || !xe.value,
4695
- menuOpen: b.value,
4695
+ menuOpen: k.value,
4696
4696
  toggleMenu: Ve,
4697
4697
  labels: F.value
4698
4698
  }, () => [
@@ -4707,24 +4707,24 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4707
4707
  oe(G(oo), { class: "cpk:size-[20px]" })
4708
4708
  ], 8, ii)
4709
4709
  ]),
4710
- b.value && xe.value ? (R(), j("div", {
4710
+ k.value && xe.value ? (R(), B("div", {
4711
4711
  key: 0,
4712
4712
  ref_key: "addMenuRef",
4713
4713
  ref: g,
4714
4714
  class: "cpk:absolute cpk:bottom-full cpk:left-0 cpk:z-30 cpk:mb-2 cpk:min-w-[220px] cpk:overflow-hidden cpk:rounded-lg cpk:border cpk:border-border cpk:bg-white cpk:shadow-lg cpk:dark:border-[#3a3a3a] cpk:dark:bg-[#1f1f1f]",
4715
4715
  "data-testid": "copilot-chat-input-add-menu"
4716
4716
  }, [
4717
- (R(!0), j(Re, null, Ke(z.value, (ie) => (R(), j(Re, {
4717
+ (R(!0), B(Re, null, Ke(z.value, (ie) => (R(), B(Re, {
4718
4718
  key: ie.key
4719
4719
  }, [
4720
- ie.type === "separator" ? (R(), j("div", ri)) : ie.type === "label" ? (R(), j("div", {
4720
+ ie.type === "separator" ? (R(), B("div", ri)) : ie.type === "label" ? (R(), B("div", {
4721
4721
  key: 1,
4722
4722
  class: "cpk:flex cpk:items-center cpk:gap-1 cpk:px-3 cpk:py-1.5 cpk:text-xs cpk:font-semibold cpk:text-muted-foreground",
4723
4723
  style: rt({ paddingLeft: `${12 + ie.depth * 12}px` })
4724
4724
  }, [
4725
4725
  M("span", null, ke(ie.label), 1),
4726
4726
  oe(G(gn), { class: "cpk:size-3" })
4727
- ], 4)) : (R(), j("button", {
4727
+ ], 4)) : (R(), B("button", {
4728
4728
  key: 2,
4729
4729
  type: "button",
4730
4730
  role: "menuitem",
@@ -4746,13 +4746,13 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4746
4746
  ref_key: "audioRecorderRef",
4747
4747
  ref: h
4748
4748
  }, null, 512)
4749
- ]) : e.mode === "processing" ? (R(), j("div", ci, [
4749
+ ]) : e.mode === "processing" ? (R(), B("div", ci, [
4750
4750
  oe(G(Kn), { class: "cpk:size-[26px] cpk:animate-spin cpk:text-muted-foreground" })
4751
- ])) : (R(), j(Re, { key: 2 }, [
4751
+ ])) : (R(), B(Re, { key: 2 }, [
4752
4752
  T(A.$slots, "text-area", {
4753
4753
  value: re.value,
4754
4754
  disabled: e.disabled,
4755
- placeholder: U.value,
4755
+ placeholder: D.value,
4756
4756
  onInput: de,
4757
4757
  onKeydown: Ie,
4758
4758
  autoFocus: e.autoFocus,
@@ -4765,7 +4765,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4765
4765
  ref: l,
4766
4766
  "data-testid": "copilot-chat-input-textarea",
4767
4767
  value: re.value,
4768
- placeholder: U.value,
4768
+ placeholder: D.value,
4769
4769
  disabled: e.disabled,
4770
4770
  rows: "1",
4771
4771
  class: ye([
@@ -4779,7 +4779,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4779
4779
  onCompositionend: N[1] || (N[1] = (ie) => m.value = !1)
4780
4780
  }, null, 42, ui)
4781
4781
  ]),
4782
- Ne.value ? (R(), j("div", {
4782
+ Ne.value ? (R(), B("div", {
4783
4783
  key: 0,
4784
4784
  ref_key: "slashMenuRef",
4785
4785
  ref: d,
@@ -4789,18 +4789,18 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4789
4789
  class: "cpk:absolute cpk:bottom-full cpk:left-0 cpk:right-0 cpk:z-30 cpk:mb-2 cpk:max-h-64 cpk:overflow-y-auto cpk:rounded-lg cpk:border cpk:border-border cpk:bg-white cpk:shadow-lg cpk:dark:border-[#3a3a3a] cpk:dark:bg-[#1f1f1f]",
4790
4790
  style: { maxHeight: "200px" }
4791
4791
  }, [
4792
- le.value.length === 0 ? (R(), j("div", di, " No commands found ")) : (R(!0), j(Re, { key: 1 }, Ke(le.value, (ie, me) => (R(), j("button", {
4792
+ le.value.length === 0 ? (R(), B("div", di, " No commands found ")) : (R(!0), B(Re, { key: 1 }, Ke(le.value, (ie, me) => (R(), B("button", {
4793
4793
  key: `${ie.label}-${me}`,
4794
4794
  type: "button",
4795
4795
  role: "option",
4796
4796
  "data-slash-index": me,
4797
- "aria-selected": me === y.value,
4798
- "data-active": me === y.value ? "true" : void 0,
4797
+ "aria-selected": me === b.value,
4798
+ "data-active": me === b.value ? "true" : void 0,
4799
4799
  class: ye([
4800
4800
  "cpk:w-full cpk:px-3 cpk:py-2 cpk:text-left cpk:text-sm cpk:transition-colors cpk:hover:bg-muted cpk:dark:hover:bg-[#2f2f2f]",
4801
- me === y.value ? "cpk:bg-muted cpk:dark:bg-[#2f2f2f]" : "cpk:bg-transparent"
4801
+ me === b.value ? "cpk:bg-muted cpk:dark:bg-[#2f2f2f]" : "cpk:bg-transparent"
4802
4802
  ]),
4803
- onMouseenter: (He) => y.value = me,
4803
+ onMouseenter: (He) => b.value = me,
4804
4804
  onMousedown: Ht((He) => Et(ie), ["prevent"])
4805
4805
  }, ke(ie.label), 43, pi))), 128))
4806
4806
  ], 512)) : Q("", !0)
@@ -4814,7 +4814,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4814
4814
  H.value ? "cpk:col-start-3 cpk:row-start-2" : "cpk:col-start-3 cpk:row-start-1"
4815
4815
  ])
4816
4816
  }, [
4817
- e.mode === "transcribe" ? (R(), j(Re, { key: 0 }, [
4817
+ e.mode === "transcribe" ? (R(), B(Re, { key: 0 }, [
4818
4818
  be.value ? T(A.$slots, "cancel-transcribe-button", {
4819
4819
  key: 0,
4820
4820
  disabled: e.disabled,
@@ -4849,8 +4849,8 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4849
4849
  oe(G(At), { class: "cpk:size-[18px]" })
4850
4850
  ], 8, gi)
4851
4851
  ]) : Q("", !0)
4852
- ], 64)) : (R(), j(Re, { key: 1 }, [
4853
- ee.value ? T(A.$slots, "start-transcribe-button", {
4852
+ ], 64)) : (R(), B(Re, { key: 1 }, [
4853
+ Z.value ? T(A.$slots, "start-transcribe-button", {
4854
4854
  key: 0,
4855
4855
  disabled: e.disabled,
4856
4856
  onClick: () => a("start-transcribe"),
@@ -4974,22 +4974,22 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
4974
4974
  const f = m.source.mimeType;
4975
4975
  if (!g(f) && !h(f))
4976
4976
  return;
4977
- const y = C(m.source.value, f);
4978
- o.value = y;
4977
+ const b = C(m.source.value, f);
4978
+ o.value = b;
4979
4979
  },
4980
4980
  { immediate: !0 }
4981
4981
  ), L(s, (m, x, f) => {
4982
4982
  if (!m || typeof document > "u") return;
4983
- const y = (v) => {
4983
+ const b = (v) => {
4984
4984
  v.key === "Escape" && u();
4985
4985
  };
4986
- document.addEventListener("keydown", y), f(() => {
4987
- document.removeEventListener("keydown", y);
4986
+ document.addEventListener("keydown", b), f(() => {
4987
+ document.removeEventListener("keydown", b);
4988
4988
  });
4989
4989
  }), Me(() => {
4990
4990
  o.value && (URL.revokeObjectURL(o.value), o.value = null);
4991
4991
  });
4992
- function k(m) {
4992
+ function y(m) {
4993
4993
  if (typeof document < "u") {
4994
4994
  const x = document;
4995
4995
  if (typeof x.startViewTransition == "function") {
@@ -5015,10 +5015,10 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5015
5015
  }
5016
5016
  function C(m, x) {
5017
5017
  try {
5018
- const f = atob(m), y = new Uint8Array(f.length);
5019
- for (let b = 0; b < f.length; b += 1)
5020
- y[b] = f.charCodeAt(b);
5021
- const v = new Blob([y], {
5018
+ const f = atob(m), b = new Uint8Array(f.length);
5019
+ for (let k = 0; k < f.length; k += 1)
5020
+ b[k] = f.charCodeAt(k);
5021
+ const v = new Blob([b], {
5022
5022
  type: x || "application/octet-stream"
5023
5023
  });
5024
5024
  return URL.createObjectURL(v);
@@ -5026,28 +5026,28 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5026
5026
  return console.error("[CopilotKit] Failed to decode attachment data:", f), null;
5027
5027
  }
5028
5028
  }
5029
- return (m, x) => (R(), j(Re, null, [
5030
- t.attachments.length > 0 ? (R(), j("div", {
5029
+ return (m, x) => (R(), B(Re, null, [
5030
+ t.attachments.length > 0 ? (R(), B("div", {
5031
5031
  key: 0,
5032
5032
  class: ye(["cpk:flex cpk:flex-wrap cpk:gap-2 cpk:p-2", t.className]),
5033
5033
  "data-testid": "copilot-chat-attachment-queue"
5034
5034
  }, [
5035
- (R(!0), j(Re, null, Ke(t.attachments, (f) => (R(), j("div", {
5035
+ (R(!0), B(Re, null, Ke(t.attachments, (f) => (R(), B("div", {
5036
5036
  key: f.id,
5037
5037
  class: ye(["cpk:relative cpk:inline-flex cpk:rounded-lg cpk:overflow-hidden cpk:border cpk:border-border", d(f)]),
5038
5038
  "data-testid": "copilot-chat-attachment-item",
5039
5039
  "data-card-type": f.type
5040
5040
  }, [
5041
- f.status === "uploading" ? (R(), j("div", yi, [...x[1] || (x[1] = [
5041
+ f.status === "uploading" ? (R(), B("div", yi, [...x[1] || (x[1] = [
5042
5042
  M("div", { class: "cpk:w-5 cpk:h-5 cpk:border-2 cpk:border-white cpk:border-t-transparent cpk:rounded-full cpk:animate-spin" }, null, -1)
5043
5043
  ])])) : Q("", !0),
5044
- f.status === "ready" ? (R(), j(Re, { key: 1 }, [
5045
- f.type === "image" ? (R(), j("button", {
5044
+ f.status === "ready" ? (R(), B(Re, { key: 1 }, [
5045
+ f.type === "image" ? (R(), B("button", {
5046
5046
  key: 0,
5047
5047
  type: "button",
5048
5048
  class: "cpk:w-full cpk:h-full cpk:border-none cpk:bg-transparent cpk:p-0 cpk:cursor-pointer",
5049
5049
  "data-testid": "copilot-chat-attachment-image-button",
5050
- onClick: (y) => k(f)
5050
+ onClick: (b) => y(f)
5051
5051
  }, [
5052
5052
  M("img", {
5053
5053
  src: G(wt)(f.source),
@@ -5055,14 +5055,14 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5055
5055
  class: "cpk:w-full cpk:h-full cpk:object-cover",
5056
5056
  "data-testid": "copilot-chat-attachment-image-thumbnail"
5057
5057
  }, null, 8, xi)
5058
- ], 8, wi)) : f.type === "video" ? (R(), j("div", Ci, [
5059
- f.thumbnail ? (R(), j("img", {
5058
+ ], 8, wi)) : f.type === "video" ? (R(), B("div", Ci, [
5059
+ f.thumbnail ? (R(), B("img", {
5060
5060
  key: 0,
5061
5061
  src: f.thumbnail,
5062
5062
  alt: f.filename || "Video thumbnail",
5063
5063
  class: "cpk:w-full cpk:h-full cpk:object-cover",
5064
5064
  "data-testid": "copilot-chat-attachment-video-thumbnail"
5065
- }, null, 8, Ti)) : (R(), j("video", {
5065
+ }, null, 8, Ti)) : (R(), B("video", {
5066
5066
  key: 1,
5067
5067
  src: G(wt)(f.source),
5068
5068
  preload: "metadata",
@@ -5075,11 +5075,11 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5075
5075
  class: "cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:z-10 cpk:cursor-pointer cpk:bg-black/20 cpk:border-none cpk:p-0",
5076
5076
  "aria-label": "Play video",
5077
5077
  "data-testid": "copilot-chat-attachment-video-play",
5078
- onClick: (y) => k(f)
5078
+ onClick: (b) => y(f)
5079
5079
  }, [...x[2] || (x[2] = [
5080
5080
  M("div", { class: "cpk:w-8 cpk:h-8 cpk:rounded-full cpk:bg-black/60 cpk:flex cpk:items-center cpk:justify-center cpk:text-white cpk:text-xs cpk:font-semibold" }, " ▶ ", -1)
5081
5081
  ])], 8, Ii)
5082
- ])) : f.type === "audio" ? (R(), j("div", Ai, [
5082
+ ])) : f.type === "audio" ? (R(), B("div", Ai, [
5083
5083
  M("audio", {
5084
5084
  src: G(wt)(f.source),
5085
5085
  controls: "",
@@ -5087,8 +5087,8 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5087
5087
  class: "cpk:w-full cpk:h-8",
5088
5088
  "data-testid": "copilot-chat-attachment-audio-player"
5089
5089
  }, null, 8, Ri),
5090
- f.filename ? (R(), j("span", $i, ke(f.filename), 1)) : Q("", !0)
5091
- ])) : (R(), j("button", {
5090
+ f.filename ? (R(), B("span", $i, ke(f.filename), 1)) : Q("", !0)
5091
+ ])) : (R(), B("button", {
5092
5092
  key: 3,
5093
5093
  type: "button",
5094
5094
  class: ye([
@@ -5096,25 +5096,25 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5096
5096
  g(f.source.mimeType) || h(f.source.mimeType) ? "cpk:cursor-pointer" : "cpk:cursor-default"
5097
5097
  ]),
5098
5098
  "data-testid": "copilot-chat-attachment-document-button",
5099
- onClick: (y) => (g(f.source.mimeType) || h(f.source.mimeType)) && k(f)
5099
+ onClick: (b) => (g(f.source.mimeType) || h(f.source.mimeType)) && y(f)
5100
5100
  }, [
5101
5101
  M("div", Fi, ke(G(sn)(f.source.mimeType ?? "")), 1),
5102
5102
  M("div", Ei, [
5103
5103
  M("span", Oi, ke(f.filename || "Document"), 1),
5104
- f.size != null ? (R(), j("span", Li, ke(G(on)(f.size)), 1)) : Q("", !0)
5104
+ f.size != null ? (R(), B("span", Li, ke(G(on)(f.size)), 1)) : Q("", !0)
5105
5105
  ])
5106
5106
  ], 10, Mi))
5107
- ], 64)) : (R(), j("div", Di)),
5107
+ ], 64)) : (R(), B("div", Di)),
5108
5108
  M("button", {
5109
5109
  type: "button",
5110
5110
  class: "cpk:absolute cpk:bg-black/60 cpk:text-white cpk:border-none cpk:rounded-full cpk:w-5 cpk:h-5 cpk:flex cpk:items-center cpk:justify-center cpk:cursor-pointer cpk:text-[10px] cpk:z-20 cpk:top-1 cpk:right-1",
5111
5111
  "aria-label": "Remove attachment",
5112
- onClick: (y) => a("remove-attachment", f.id)
5112
+ onClick: (b) => a("remove-attachment", f.id)
5113
5113
  }, " ✕ ", 8, Ui)
5114
5114
  ], 10, ki))), 128))
5115
5115
  ], 2)) : Q("", !0),
5116
5116
  (R(), he(fa, { to: "body" }, [
5117
- i.value ? (R(), j("div", {
5117
+ i.value ? (R(), B("div", {
5118
5118
  key: 0,
5119
5119
  class: "cpk:fixed cpk:inset-0 cpk:z-[9999] cpk:flex cpk:items-center cpk:justify-center cpk:bg-black/80",
5120
5120
  "data-testid": "copilot-chat-attachment-lightbox",
@@ -5131,35 +5131,35 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5131
5131
  onClick: x[0] || (x[0] = Ht(() => {
5132
5132
  }, ["stop"]))
5133
5133
  }, [
5134
- i.value.type === "image" ? (R(), j("img", {
5134
+ i.value.type === "image" ? (R(), B("img", {
5135
5135
  key: 0,
5136
5136
  src: G(wt)(i.value.source),
5137
5137
  alt: i.value.filename || "Image attachment",
5138
5138
  class: "cpk:max-w-[90vw] cpk:max-h-[90vh] cpk:object-contain cpk:rounded-lg",
5139
5139
  "data-testid": "copilot-chat-attachment-lightbox-image"
5140
- }, null, 8, Bi)) : i.value.type === "video" ? (R(), j("video", {
5140
+ }, null, 8, Bi)) : i.value.type === "video" ? (R(), B("video", {
5141
5141
  key: 1,
5142
5142
  src: G(wt)(i.value.source),
5143
5143
  controls: "",
5144
5144
  autoplay: "",
5145
5145
  class: "cpk:max-w-[90vw] cpk:max-h-[90vh] cpk:rounded-lg",
5146
5146
  "data-testid": "copilot-chat-attachment-lightbox-video"
5147
- }, null, 8, ji)) : i.value.type === "document" ? (R(), j(Re, { key: 2 }, [
5148
- r.value && g(i.value.source.mimeType) && p.value ? (R(), j("iframe", {
5147
+ }, null, 8, ji)) : i.value.type === "document" ? (R(), B(Re, { key: 2 }, [
5148
+ r.value && g(i.value.source.mimeType) && p.value ? (R(), B("iframe", {
5149
5149
  key: 0,
5150
5150
  src: p.value,
5151
5151
  title: i.value.filename || "PDF preview",
5152
5152
  class: "cpk:w-[90vw] cpk:h-[90vh] cpk:max-w-[1000px] cpk:rounded-lg cpk:bg-white",
5153
5153
  "data-testid": "copilot-chat-attachment-lightbox-document-iframe"
5154
- }, null, 8, Ni)) : r.value && h(i.value.source.mimeType) ? (R(), j("div", Vi, [
5155
- l.value !== null ? (R(), j("pre", Pi, ke(l.value), 1)) : p.value ? (R(), j("iframe", {
5154
+ }, null, 8, Ni)) : r.value && h(i.value.source.mimeType) ? (R(), B("div", Vi, [
5155
+ l.value !== null ? (R(), B("pre", Pi, ke(l.value), 1)) : p.value ? (R(), B("iframe", {
5156
5156
  key: 1,
5157
5157
  src: p.value,
5158
5158
  title: i.value.filename || "Text preview",
5159
5159
  class: "cpk:w-full cpk:h-[80vh] cpk:border-none",
5160
5160
  "data-testid": "copilot-chat-attachment-lightbox-document-iframe"
5161
5161
  }, null, 8, zi)) : Q("", !0)
5162
- ])) : (R(), j("div", Hi, [
5162
+ ])) : (R(), B("div", Hi, [
5163
5163
  M("div", _i, ke(G(sn)(i.value.source.mimeType ?? "")), 1),
5164
5164
  M("div", Wi, [
5165
5165
  M("div", qi, ke(i.value.filename || "Document"), 1),
@@ -5202,18 +5202,18 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5202
5202
  ), i = c(() => a.value.length > 0), o = c(
5203
5203
  () => n.messages[n.messages.length - 1]?.id === n.message.id
5204
5204
  ), s = c(() => !!(n.isRunning && o.value)), r = I(0), l = I(s.value), p = I(!1);
5205
- let k = null, u = null;
5205
+ let y = null, u = null;
5206
5206
  function d() {
5207
5207
  u && (clearInterval(u), u = null);
5208
5208
  }
5209
5209
  function g() {
5210
- k !== null && (r.value = (Date.now() - k) / 1e3);
5210
+ y !== null && (r.value = (Date.now() - y) / 1e3);
5211
5211
  }
5212
5212
  L(
5213
5213
  s,
5214
5214
  (m) => {
5215
5215
  if (m) {
5216
- k === null && (k = Date.now()), d(), u = setInterval(g, 1e3), p.value = !1, l.value = !0;
5216
+ y === null && (y = Date.now()), d(), u = setInterval(g, 1e3), p.value = !1, l.value = !0;
5217
5217
  return;
5218
5218
  }
5219
5219
  d(), g(), p.value || (l.value = !1);
@@ -5228,7 +5228,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5228
5228
  function C() {
5229
5229
  i.value && (p.value = !0, l.value = !l.value);
5230
5230
  }
5231
- return (m, x) => (R(), j("div", {
5231
+ return (m, x) => (R(), B("div", {
5232
5232
  "data-copilotkit": "",
5233
5233
  class: "cpk:my-1",
5234
5234
  "data-message-id": e.message.id
@@ -5275,7 +5275,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5275
5275
  onClick: x[0] || (x[0] = (f) => i.value ? C() : void 0)
5276
5276
  }, [
5277
5277
  M("span", Qi, ke(h.value), 1),
5278
- s.value && !i.value ? (R(), j("span", Xi, [...x[1] || (x[1] = [
5278
+ s.value && !i.value ? (R(), B("span", Xi, [...x[1] || (x[1] = [
5279
5279
  M("span", { class: "cpk:w-1.5 cpk:h-1.5 cpk:rounded-full cpk:bg-muted-foreground cpk:animate-pulse" }, null, -1)
5280
5280
  ])])) : Q("", !0),
5281
5281
  i.value ? (R(), he(G(gn), {
@@ -5302,10 +5302,10 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5302
5302
  hasContent: i.value,
5303
5303
  content: a.value
5304
5304
  }, () => [
5305
- i.value || s.value ? (R(), j("div", Zi, [
5305
+ i.value || s.value ? (R(), B("div", Zi, [
5306
5306
  M("div", er, [
5307
5307
  oe(G(Gn), { content: a.value }, null, 8, ["content"]),
5308
- s.value && i.value ? (R(), j("span", tr, [...x[2] || (x[2] = [
5308
+ s.value && i.value ? (R(), B("span", tr, [...x[2] || (x[2] = [
5309
5309
  M("span", { class: "cpk:w-2 cpk:h-2 cpk:rounded-full cpk:bg-muted-foreground cpk:animate-pulse-cursor" }, null, -1)
5310
5310
  ])])) : Q("", !0)
5311
5311
  ])
@@ -5330,7 +5330,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5330
5330
  let l = null;
5331
5331
  const p = c(
5332
5332
  () => s?.vnode.props ?? {}
5333
- ), k = [
5333
+ ), y = [
5334
5334
  "cpk:inline-flex cpk:h-8 cpk:w-8 cpk:items-center cpk:justify-center cpk:rounded-md cpk:p-0",
5335
5335
  "cpk:cursor-pointer cpk:text-[rgb(93,93,93)] cpk:transition-colors cpk:hover:bg-[#E8E8E8]",
5336
5336
  "cpk:hover:text-[rgb(93,93,93)] cpk:dark:text-[rgb(243,243,243)] cpk:dark:hover:bg-[#303030]",
@@ -5353,7 +5353,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5353
5353
  ), x = c(() => t.branchIndex > 0), f = c(
5354
5354
  () => t.branchIndex < t.numberOfBranches - 1
5355
5355
  );
5356
- function y() {
5356
+ function b() {
5357
5357
  l && clearTimeout(l), r.value = !0, l = setTimeout(() => {
5358
5358
  r.value = !1, l = null;
5359
5359
  }, 2e3);
@@ -5361,12 +5361,12 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5361
5361
  async function v() {
5362
5362
  if (d.value && !(typeof navigator > "u" || typeof navigator.clipboard?.writeText != "function"))
5363
5363
  try {
5364
- await navigator.clipboard.writeText(d.value), y();
5364
+ await navigator.clipboard.writeText(d.value), b();
5365
5365
  } catch ($) {
5366
5366
  console.error("Failed to copy to clipboard:", $);
5367
5367
  }
5368
5368
  }
5369
- function b() {
5369
+ function k() {
5370
5370
  if (!C.value)
5371
5371
  return;
5372
5372
  const $ = { message: t.message };
@@ -5385,7 +5385,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5385
5385
  function O() {
5386
5386
  x.value && S(t.branchIndex - 1);
5387
5387
  }
5388
- function D() {
5388
+ function j() {
5389
5389
  f.value && S(t.branchIndex + 1);
5390
5390
  }
5391
5391
  return Me(() => {
@@ -5401,9 +5401,9 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5401
5401
  canGoPrev: x.value,
5402
5402
  canGoNext: f.value,
5403
5403
  onCopy: v,
5404
- onEdit: b,
5404
+ onEdit: k,
5405
5405
  goPrev: O,
5406
- goNext: D,
5406
+ goNext: j,
5407
5407
  copied: r.value
5408
5408
  }, () => [
5409
5409
  M("div", ge({
@@ -5438,7 +5438,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5438
5438
  M("button", {
5439
5439
  "data-testid": "copilot-user-copy-button",
5440
5440
  type: "button",
5441
- class: ye(G(k)),
5441
+ class: ye(G(y)),
5442
5442
  "aria-label": o.value.userMessageToolbarCopyMessageLabel,
5443
5443
  title: o.value.userMessageToolbarCopyMessageLabel,
5444
5444
  onClick: v
@@ -5454,15 +5454,15 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5454
5454
  ]),
5455
5455
  C.value ? T($.$slots, "edit-button", {
5456
5456
  key: 0,
5457
- onEdit: b,
5457
+ onEdit: k,
5458
5458
  label: o.value.userMessageToolbarEditMessageLabel
5459
5459
  }, () => [
5460
5460
  M("button", {
5461
5461
  type: "button",
5462
- class: ye(G(k)),
5462
+ class: ye(G(y)),
5463
5463
  "aria-label": o.value.userMessageToolbarEditMessageLabel,
5464
5464
  title: o.value.userMessageToolbarEditMessageLabel,
5465
- onClick: b
5465
+ onClick: k
5466
5466
  }, [
5467
5467
  oe(G(lo), { class: "cpk:size-[18px]" })
5468
5468
  ], 10, lr)
@@ -5474,12 +5474,12 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5474
5474
  canGoPrev: x.value,
5475
5475
  canGoNext: f.value,
5476
5476
  goPrev: O,
5477
- goNext: D
5477
+ goNext: j
5478
5478
  }, () => [
5479
5479
  M("div", cr, [
5480
5480
  M("button", {
5481
5481
  type: "button",
5482
- class: ye([G(k), "cpk:h-6 cpk:w-6 cpk:p-0"]),
5482
+ class: ye([G(y), "cpk:h-6 cpk:w-6 cpk:p-0"]),
5483
5483
  disabled: !x.value,
5484
5484
  "aria-label": "Previous branch",
5485
5485
  title: "Previous branch",
@@ -5490,11 +5490,11 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5490
5490
  M("span", dr, ke(e.branchIndex + 1) + "/" + ke(e.numberOfBranches), 1),
5491
5491
  M("button", {
5492
5492
  type: "button",
5493
- class: ye([G(k), "cpk:h-6 cpk:w-6 cpk:p-0"]),
5493
+ class: ye([G(y), "cpk:h-6 cpk:w-6 cpk:p-0"]),
5494
5494
  disabled: !f.value,
5495
5495
  "aria-label": "Next branch",
5496
5496
  title: "Next branch",
5497
- onClick: D
5497
+ onClick: j
5498
5498
  }, [
5499
5499
  oe(G(gn), { class: "cpk:size-[20px]" })
5500
5500
  ], 10, pr)
@@ -5516,8 +5516,8 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5516
5516
  const n = e, { copilotkit: t } = Be(), a = Oe(), i = I(0), o = I(null), s = pn(), r = c(() => Object.keys(s)), l = c(
5517
5517
  () => a.value?.agentId ?? ct
5518
5518
  ), p = c(() => {
5519
- const f = l.value, y = t.value.getAgent(f);
5520
- return jn(y, a.value?.threadId) ?? y;
5519
+ const f = l.value, b = t.value.getAgent(f);
5520
+ return jn(b, a.value?.threadId) ?? b;
5521
5521
  });
5522
5522
  L(
5523
5523
  [
@@ -5526,10 +5526,10 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5526
5526
  () => t.value,
5527
5527
  () => t.value.runtimeConnectionStatus
5528
5528
  ],
5529
- ([f, y], v, b) => {
5530
- const S = t.value.getAgent(l.value), O = jn(S, y) ?? S;
5529
+ ([f, b], v, k) => {
5530
+ const S = t.value.getAgent(l.value), O = jn(S, b) ?? S;
5531
5531
  if (!O) return;
5532
- const D = O.subscribe({
5532
+ const j = O.subscribe({
5533
5533
  onStateChanged: () => {
5534
5534
  i.value += 1;
5535
5535
  },
@@ -5543,14 +5543,14 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5543
5543
  i.value += 1;
5544
5544
  }
5545
5545
  });
5546
- b(() => D.unsubscribe());
5546
+ k(() => j.unsubscribe());
5547
5547
  },
5548
5548
  { immediate: !0 }
5549
5549
  ), L(
5550
5550
  () => t.value,
5551
- (f, y, v) => {
5551
+ (f, b, v) => {
5552
5552
  o.value = f.interruptState;
5553
- const b = f.subscribe({
5553
+ const k = f.subscribe({
5554
5554
  onInterruptStateChanged: ({ interruptState: S }) => {
5555
5555
  o.value = S;
5556
5556
  },
@@ -5558,101 +5558,101 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5558
5558
  i.value += 1;
5559
5559
  }
5560
5560
  });
5561
- v(() => b.unsubscribe());
5561
+ v(() => k.unsubscribe());
5562
5562
  },
5563
5563
  { immediate: !0 }
5564
5564
  );
5565
- function k(f) {
5566
- const y = /* @__PURE__ */ new Map();
5565
+ function y(f) {
5566
+ const b = /* @__PURE__ */ new Map();
5567
5567
  for (const v of f) {
5568
- const b = y.get(v.id);
5569
- if (b && v.role === "assistant" && b.role === "assistant") {
5570
- const S = v.content || b.content, O = v.toolCalls ?? b.toolCalls;
5571
- y.set(v.id, {
5572
- ...b,
5568
+ const k = b.get(v.id);
5569
+ if (k && v.role === "assistant" && k.role === "assistant") {
5570
+ const S = v.content || k.content, O = v.toolCalls ?? k.toolCalls;
5571
+ b.set(v.id, {
5572
+ ...k,
5573
5573
  ...v,
5574
5574
  content: S,
5575
5575
  toolCalls: O
5576
5576
  });
5577
5577
  } else
5578
- y.set(v.id, v);
5578
+ b.set(v.id, v);
5579
5579
  }
5580
- return [...y.values()];
5580
+ return [...b.values()];
5581
5581
  }
5582
5582
  const u = c(
5583
- () => k(n.messages)
5583
+ () => y(n.messages)
5584
5584
  ), d = c(() => n.messages[n.messages.length - 1]), g = c(
5585
5585
  () => n.isRunning && d.value?.role !== "reasoning"
5586
5586
  );
5587
5587
  L(
5588
5588
  [() => n.messages.length, () => u.value.length],
5589
- ([f, y]) => {
5590
- process.env.NODE_ENV === "development" && y < f && console.warn(
5591
- `CopilotChatMessageView: Deduplicated ${f - y} message(s) with duplicate IDs.`
5589
+ ([f, b]) => {
5590
+ process.env.NODE_ENV === "development" && b < f && console.warn(
5591
+ `CopilotChatMessageView: Deduplicated ${f - b} message(s) with duplicate IDs.`
5592
5592
  );
5593
5593
  },
5594
5594
  { immediate: !0 }
5595
5595
  );
5596
5596
  function h(f) {
5597
5597
  i.value += 0;
5598
- const y = l.value, v = a.value?.threadId ?? "", b = t.value, S = b.getRunIdForMessage(y, v, f.id) ?? b.getRunIdsForThread(y, v).slice(-1)[0], O = S ?? `missing-run-id:${f.id}`, D = p.value ?? b.getAgent(y), $ = S && D ? D.messages.filter(
5599
- (E) => b.getRunIdForMessage(y, v, E.id) === S
5600
- ).map((E) => E.id) : [f.id], P = D ? D.messages.findIndex((E) => E.id === f.id) : -1, Y = P >= 0 ? P : 0, ve = S ? Math.max($.indexOf(f.id), 0) : 0, te = S ? $.length : 1, K = S ? b.getStateByRun(y, v, S) : void 0;
5598
+ const b = l.value, v = a.value?.threadId ?? "", k = t.value, S = k.getRunIdForMessage(b, v, f.id) ?? k.getRunIdsForThread(b, v).slice(-1)[0], O = S ?? `missing-run-id:${f.id}`, j = p.value ?? k.getAgent(b), $ = S && j ? j.messages.filter(
5599
+ (E) => k.getRunIdForMessage(b, v, E.id) === S
5600
+ ).map((E) => E.id) : [f.id], P = j ? j.messages.findIndex((E) => E.id === f.id) : -1, ee = P >= 0 ? P : 0, ve = S ? Math.max($.indexOf(f.id), 0) : 0, te = S ? $.length : 1, K = S ? k.getStateByRun(b, v, S) : void 0;
5601
5601
  return {
5602
5602
  runId: O,
5603
- messageIndex: Y,
5603
+ messageIndex: ee,
5604
5604
  messageIndexInRun: ve,
5605
5605
  numberOfMessagesInRun: te,
5606
- agentId: y,
5606
+ agentId: b,
5607
5607
  stateSnapshot: K
5608
5608
  };
5609
5609
  }
5610
5610
  function C(f) {
5611
5611
  return `activity-${f}`;
5612
5612
  }
5613
- function m(f, y) {
5614
- if (i.value += 0, s[y === "before" ? "message-before" : "message-after"])
5613
+ function m(f, b) {
5614
+ if (i.value += 0, s[b === "before" ? "message-before" : "message-after"])
5615
5615
  return null;
5616
- const b = l.value, O = [...t.value.renderCustomMessages].filter(
5617
- (D) => D.agentId === void 0 || D.agentId === b
5618
- ).sort((D, $) => {
5619
- const P = D.agentId !== void 0, Y = $.agentId !== void 0;
5620
- return P === Y ? 0 : P ? -1 : 1;
5616
+ const k = l.value, O = [...t.value.renderCustomMessages].filter(
5617
+ (j) => j.agentId === void 0 || j.agentId === k
5618
+ ).sort((j, $) => {
5619
+ const P = j.agentId !== void 0, ee = $.agentId !== void 0;
5620
+ return P === ee ? 0 : P ? -1 : 1;
5621
5621
  })[0];
5622
5622
  return O?.render ? {
5623
5623
  renderer: O.render,
5624
5624
  props: {
5625
5625
  ...h(f),
5626
5626
  message: f,
5627
- position: y
5627
+ position: b
5628
5628
  }
5629
5629
  } : null;
5630
5630
  }
5631
5631
  function x(f) {
5632
5632
  i.value += 0;
5633
- const y = l.value, v = [...t.value.renderActivityMessages].filter(
5634
- (S) => S.activityType === f.activityType && (S.agentId === void 0 || S.agentId === y)
5633
+ const b = l.value, v = [...t.value.renderActivityMessages].filter(
5634
+ (S) => S.activityType === f.activityType && (S.agentId === void 0 || S.agentId === b)
5635
5635
  ).sort((S, O) => {
5636
- const D = S.agentId !== void 0, $ = O.agentId !== void 0;
5637
- return D === $ ? 0 : D ? -1 : 1;
5636
+ const j = S.agentId !== void 0, $ = O.agentId !== void 0;
5637
+ return j === $ ? 0 : j ? -1 : 1;
5638
5638
  })[0];
5639
5639
  if (!v) return null;
5640
- const b = v.content.safeParse(f.content);
5641
- return b.success ? {
5640
+ const k = v.content.safeParse(f.content);
5641
+ return k.success ? {
5642
5642
  renderer: v.render,
5643
5643
  props: {
5644
5644
  activityType: f.activityType,
5645
- content: b.data,
5645
+ content: k.data,
5646
5646
  message: f,
5647
5647
  agent: p.value
5648
5648
  }
5649
5649
  } : null;
5650
5650
  }
5651
- return (f, y) => (R(), j("div", ge({
5651
+ return (f, b) => (R(), B("div", ge({
5652
5652
  "data-copilotkit": "",
5653
5653
  class: "cpk:flex cpk:flex-col"
5654
5654
  }, f.$attrs), [
5655
- (R(!0), j(Re, null, Ke(u.value, (v) => (R(), j(Re, {
5655
+ (R(!0), B(Re, null, Ke(u.value, (v) => (R(), B(Re, {
5656
5656
  key: v.id
5657
5657
  }, [
5658
5658
  G(s)["message-before"] ? T(f.$slots, "message-before", {
@@ -5680,10 +5680,10 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5680
5680
  messages: e.messages,
5681
5681
  "is-running": e.isRunning
5682
5682
  }, qe({ _: 2 }, [
5683
- Ke(r.value, (b) => ({
5684
- name: b,
5683
+ Ke(r.value, (k) => ({
5684
+ name: k,
5685
5685
  fn: W((S) => [
5686
- T(f.$slots, b, ge({ ref_for: !0 }, S))
5686
+ T(f.$slots, k, ge({ ref_for: !0 }, S))
5687
5687
  ])
5688
5688
  }))
5689
5689
  ]), 1032, ["message", "messages", "is-running"])
@@ -5692,10 +5692,10 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5692
5692
  message: v
5693
5693
  }, () => [
5694
5694
  oe(fr, { message: v }, qe({ _: 2 }, [
5695
- Ke(r.value, (b) => ({
5696
- name: b,
5695
+ Ke(r.value, (k) => ({
5696
+ name: k,
5697
5697
  fn: W((S) => [
5698
- T(f.$slots, b, ge({ ref_for: !0 }, S))
5698
+ T(f.$slots, k, ge({ ref_for: !0 }, S))
5699
5699
  ])
5700
5700
  }))
5701
5701
  ]), 1032, ["message"])
@@ -5751,7 +5751,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5751
5751
  resolve: o.value.resolve
5752
5752
  }) : Q("", !0),
5753
5753
  g.value ? T(f.$slots, "cursor", { key: 1 }, () => [
5754
- y[0] || (y[0] = M("div", {
5754
+ b[0] || (b[0] = M("div", {
5755
5755
  class: "cpk:w-[11px] cpk:h-[11px] cpk:rounded-full cpk:bg-foreground cpk:animate-pulse cpk:ml-1",
5756
5756
  "data-testid": "copilot-loading-cursor"
5757
5757
  }, null, -1))
@@ -5774,7 +5774,7 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5774
5774
  },
5775
5775
  setup(e) {
5776
5776
  const n = e, t = c(() => n.isLoading || n.disabled);
5777
- return (a, i) => (R(), j("button", ge({
5777
+ return (a, i) => (R(), B("button", ge({
5778
5778
  "data-copilotkit": "",
5779
5779
  "data-slot": "suggestion-pill",
5780
5780
  "data-testid": "copilot-chat-suggestion-pill",
@@ -5783,12 +5783,12 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5783
5783
  disabled: t.value,
5784
5784
  class: "cpk:group cpk:inline-flex cpk:h-7 cpk:w-fit cpk:items-center cpk:gap-1 cpk:rounded-full cpk:border cpk:border-border/60 cpk:bg-background cpk:px-2.5 cpk:text-[11px] cpk:leading-none cpk:text-foreground cpk:transition-colors cpk:cursor-pointer cpk:hover:bg-accent/60 cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background cpk:disabled:cursor-not-allowed cpk:disabled:text-muted-foreground cpk:disabled:hover:bg-background cpk:disabled:hover:text-muted-foreground cpk:pointer-events-auto cpk:sm:h-8 cpk:sm:gap-1.5 cpk:sm:px-3 cpk:sm:text-xs"
5785
5785
  }, a.$attrs), [
5786
- e.isLoading ? (R(), j("span", mr, [
5786
+ e.isLoading ? (R(), B("span", mr, [
5787
5787
  oe(G(Kn), {
5788
5788
  class: "cpk:h-3.5 cpk:w-3.5 cpk:animate-spin cpk:sm:h-4 cpk:sm:w-4",
5789
5789
  "aria-hidden": "true"
5790
5790
  })
5791
- ])) : a.$slots.icon || e.icon ? (R(), j("span", hr, [
5791
+ ])) : a.$slots.icon || e.icon ? (R(), B("span", hr, [
5792
5792
  T(a.$slots, "icon", {}, () => [
5793
5793
  (R(), he(mt(e.icon)))
5794
5794
  ])
@@ -5820,21 +5820,21 @@ const ai = { class: "cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4
5820
5820
  function p(u, d) {
5821
5821
  a("select-suggestion", u, d);
5822
5822
  }
5823
- const k = c(() => ({
5823
+ const y = c(() => ({
5824
5824
  suggestions: t.suggestions,
5825
5825
  loadingIndexes: t.loadingIndexes,
5826
5826
  onSelectSuggestion: p,
5827
5827
  containerClass: s.value,
5828
5828
  containerAttrs: r.value
5829
5829
  }));
5830
- return (u, d) => T(u.$slots, "layout", q(J(k.value)), () => [
5831
- T(u.$slots, "container", q(J(k.value)), () => [
5830
+ return (u, d) => T(u.$slots, "layout", q(J(y.value)), () => [
5831
+ T(u.$slots, "container", q(J(y.value)), () => [
5832
5832
  M("div", ge({
5833
5833
  "data-copilotkit": "",
5834
5834
  "data-testid": "copilot-chat-suggestion-view",
5835
5835
  class: s.value
5836
5836
  }, r.value), [
5837
- (R(!0), j(Re, null, Ke(e.suggestions, (g, h) => T(u.$slots, "suggestion", {
5837
+ (R(!0), B(Re, null, Ke(e.suggestions, (g, h) => T(u.$slots, "suggestion", {
5838
5838
  key: `${g.title}-${h}`,
5839
5839
  suggestion: g,
5840
5840
  index: h,
@@ -5905,22 +5905,22 @@ const xr = {
5905
5905
  },
5906
5906
  emits: ["submit-message", "stop", "input-change", "select-suggestion", "add-file", "start-transcribe", "cancel-transcribe", "finish-transcribe"],
5907
5907
  setup(e, { emit: n }) {
5908
- const t = e, a = n, i = Oe(), o = c(() => i.value?.labels ?? Ze), s = lt(), r = pn(), l = I(null), p = I(null), k = I(null), u = I(null), d = I(0), g = I(!0), h = c(() => t.inputValue !== void 0), C = I(t.inputValue ?? ""), m = c(() => wr(t.autoScroll)), x = c(
5908
+ const t = e, a = n, i = Oe(), o = c(() => i.value?.labels ?? Ze), s = lt(), r = pn(), l = I(null), p = I(null), y = I(null), u = I(null), d = I(0), g = I(!0), h = c(() => t.inputValue !== void 0), C = I(t.inputValue ?? ""), m = c(() => wr(t.autoScroll)), x = c(
5909
5909
  () => m.value === "pin-to-bottom"
5910
5910
  ), f = c(() => m.value === "pin-to-send");
5911
5911
  ni({
5912
5912
  scrollRef: l,
5913
5913
  contentRef: p,
5914
- spacerRef: k,
5914
+ spacerRef: y,
5915
5915
  topOffset: 16
5916
5916
  });
5917
- const { isKeyboardOpen: y, keyboardHeight: v } = Zs(), b = c(
5918
- () => y.value ? v.value : 0
5917
+ const { isKeyboardOpen: b, keyboardHeight: v } = Zs(), k = c(
5918
+ () => b.value ? v.value : 0
5919
5919
  ), S = c(
5920
5920
  () => h.value ? t.inputValue ?? "" : C.value
5921
5921
  ), O = c(
5922
5922
  () => !t.isConnecting && !t.isRunning && Array.isArray(t.suggestions) && t.suggestions.length > 0
5923
- ), D = c(
5923
+ ), j = c(
5924
5924
  () => Array.isArray(t.attachments) && t.attachments.length > 0
5925
5925
  ), $ = c(
5926
5926
  () => s?.vnode.props ?? {}
@@ -5928,7 +5928,7 @@ const xr = {
5928
5928
  () => Object.keys(r).filter(
5929
5929
  (z) => z !== "message-view" && z !== "scroll-view" && z !== "feather" && z !== "scroll-to-bottom-button" && z !== "input" && z !== "suggestion-view" && z !== "welcome-screen" && z !== "welcome-message"
5930
5930
  )
5931
- ), Y = c(
5931
+ ), ee = c(
5932
5932
  () => t.messages.length === 0 && t.welcomeScreen !== !1 && !t.isConnecting && !t.hasExplicitThreadId
5933
5933
  ), ve = c(() => Te("onAddFile")), te = c(() => Te("onStop")), K = c(
5934
5934
  () => Te("onStartTranscribe")
@@ -5940,8 +5940,8 @@ const xr = {
5940
5940
  () => typeof t.onFinishTranscribeWithAudio == "function"
5941
5941
  ), F = c(
5942
5942
  () => `${d.value + (O.value ? 4 : 32)}px`
5943
- ), U = c(
5944
- () => !Y.value && !g.value
5943
+ ), D = c(
5944
+ () => !ee.value && !g.value
5945
5945
  );
5946
5946
  let H = null, ae = null;
5947
5947
  function we() {
@@ -5950,7 +5950,7 @@ const xr = {
5950
5950
  const z = u.value;
5951
5951
  z && (H = new ResizeObserver((le) => {
5952
5952
  const Ne = g.value, Qe = le[0]?.contentRect?.height;
5953
- typeof Qe == "number" ? d.value = Qe : Z(), X(), x.value && Ne && ee("auto");
5953
+ typeof Qe == "number" ? d.value = Qe : Y(), X(), x.value && Ne && Z("auto");
5954
5954
  }), H.observe(z));
5955
5955
  }
5956
5956
  function V() {
@@ -5959,11 +5959,11 @@ const xr = {
5959
5959
  const z = p.value;
5960
5960
  z && (ae = new ResizeObserver(() => {
5961
5961
  const le = g.value;
5962
- X(), x.value && le && ee("auto");
5962
+ X(), x.value && le && Z("auto");
5963
5963
  }), ae.observe(z));
5964
5964
  }
5965
- L(Y, async (z) => {
5966
- z || (await ft(), Z(), we(), V());
5965
+ L(ee, async (z) => {
5966
+ z || (await ft(), Y(), we(), V());
5967
5967
  }), L(
5968
5968
  () => t.inputValue,
5969
5969
  (z) => {
@@ -5973,8 +5973,8 @@ const xr = {
5973
5973
  [() => t.messages, () => t.suggestions, () => t.isRunning],
5974
5974
  async () => {
5975
5975
  const z = g.value;
5976
- await ft(), !(!x.value || !z) && (ee("auto"), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
5977
- ee("auto");
5976
+ await ft(), !(!x.value || !z) && (Z("auto"), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
5977
+ Z("auto");
5978
5978
  }));
5979
5979
  },
5980
5980
  { deep: !0 }
@@ -5988,11 +5988,11 @@ const xr = {
5988
5988
  const le = z.scrollHeight - z.scrollTop - z.clientHeight;
5989
5989
  g.value = le <= Lr;
5990
5990
  }
5991
- function Z() {
5991
+ function Y() {
5992
5992
  const z = u.value;
5993
5993
  d.value = z?.offsetHeight ?? 0;
5994
5994
  }
5995
- function ee(z = "smooth") {
5995
+ function Z(z = "smooth") {
5996
5996
  const le = l.value;
5997
5997
  le && (typeof le.scrollTo == "function" ? le.scrollTo({
5998
5998
  top: le.scrollHeight,
@@ -6006,7 +6006,7 @@ const xr = {
6006
6006
  const le = $.value[z];
6007
6007
  return Array.isArray(le) ? le.length > 0 : !!le;
6008
6008
  }
6009
- function B(z) {
6009
+ function U(z) {
6010
6010
  h.value || (C.value = z), a("input-change", z);
6011
6011
  }
6012
6012
  function ue(z) {
@@ -6044,18 +6044,18 @@ const xr = {
6044
6044
  }
6045
6045
  const et = c(() => {
6046
6046
  const z = {
6047
- "onUpdate:modelValue": B,
6047
+ "onUpdate:modelValue": U,
6048
6048
  onSubmitMessage: ue
6049
6049
  };
6050
6050
  return te.value && (z.onStop = pe), ve.value && (z.onAddFile = Le), K.value && (z.onStartTranscribe = Se), E.value && (z.onCancelTranscribe = xe), ne.value && (z.onFinishTranscribe = Fe), re.value && (z.onFinishTranscribeWithAudio = De), z;
6051
6051
  });
6052
6052
  return Je(async () => {
6053
- await ft(), Z(), X(), x.value && (ee("auto"), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
6054
- ee("auto");
6053
+ await ft(), Y(), X(), x.value && (Z("auto"), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
6054
+ Z("auto");
6055
6055
  })), we(), V();
6056
6056
  }), Me(() => {
6057
6057
  H?.disconnect(), ae?.disconnect(), H = null, ae = null;
6058
- }), (z, le) => (R(), j("div", ge({
6058
+ }), (z, le) => (R(), B("div", ge({
6059
6059
  "data-copilotkit": "",
6060
6060
  class: "cpk:relative cpk:h-full",
6061
6061
  "data-testid": "copilot-chat-view"
@@ -6064,10 +6064,10 @@ const xr = {
6064
6064
  onDragleave: ze,
6065
6065
  onDrop: je
6066
6066
  }), [
6067
- e.dragOver ? (R(), j("div", xr, [...le[3] || (le[3] = [
6067
+ e.dragOver ? (R(), B("div", xr, [...le[3] || (le[3] = [
6068
6068
  M("span", { class: "cpk:text-sm cpk:font-medium cpk:text-primary/70" }, " Drop files here ", -1)
6069
6069
  ])])) : Q("", !0),
6070
- Y.value ? T(z.$slots, "welcome-screen", {
6070
+ ee.value ? T(z.$slots, "welcome-screen", {
6071
6071
  key: 1,
6072
6072
  suggestions: e.suggestions,
6073
6073
  loadingIndexes: e.suggestionLoadingIndexes,
@@ -6076,7 +6076,7 @@ const xr = {
6076
6076
  isRunning: e.isRunning,
6077
6077
  inputMode: e.inputMode,
6078
6078
  inputToolsMenu: e.inputToolsMenu,
6079
- onUpdateModelValue: B,
6079
+ onUpdateModelValue: U,
6080
6080
  onSubmitMessage: ue,
6081
6081
  onStop: te.value ? pe : void 0,
6082
6082
  onAddFile: Le,
@@ -6094,7 +6094,7 @@ const xr = {
6094
6094
  ])
6095
6095
  ]),
6096
6096
  M("div", Ar, [
6097
- D.value ? (R(), he(Vn, {
6097
+ j.value ? (R(), he(Vn, {
6098
6098
  key: 0,
6099
6099
  attachments: e.attachments ?? [],
6100
6100
  "class-name": "cpk:mb-2",
@@ -6106,7 +6106,7 @@ const xr = {
6106
6106
  inputMode: e.inputMode,
6107
6107
  inputToolsMenu: e.inputToolsMenu,
6108
6108
  attachments: e.attachments ?? [],
6109
- onUpdateModelValue: B,
6109
+ onUpdateModelValue: U,
6110
6110
  onSubmitMessage: ue,
6111
6111
  onStop: te.value ? pe : void 0,
6112
6112
  onAddFile: Le,
@@ -6122,11 +6122,11 @@ const xr = {
6122
6122
  "tools-menu": e.inputToolsMenu,
6123
6123
  positioning: "static",
6124
6124
  "show-disclaimer": !0,
6125
- "keyboard-height": b.value
6125
+ "keyboard-height": k.value
6126
6126
  }, et.value), null, 16, ["model-value", "is-running", "mode", "tools-menu", "keyboard-height"])
6127
6127
  ])
6128
6128
  ]),
6129
- O.value ? (R(), j("div", Rr, [
6129
+ O.value ? (R(), B("div", Rr, [
6130
6130
  T(z.$slots, "suggestion-view", {
6131
6131
  suggestions: e.suggestions,
6132
6132
  loadingIndexes: e.suggestionLoadingIndexes,
@@ -6141,17 +6141,17 @@ const xr = {
6141
6141
  ])) : Q("", !0)
6142
6142
  ])
6143
6143
  ])
6144
- ]) : (R(), j(Re, { key: 2 }, [
6144
+ ]) : (R(), B(Re, { key: 2 }, [
6145
6145
  T(z.$slots, "scroll-view", {
6146
6146
  messages: e.messages,
6147
6147
  isRunning: e.isRunning,
6148
6148
  suggestions: e.suggestions,
6149
6149
  loadingIndexes: e.suggestionLoadingIndexes,
6150
6150
  messagePaddingBottom: F.value,
6151
- showScrollToBottomButton: U.value,
6151
+ showScrollToBottomButton: D.value,
6152
6152
  onSelectSuggestion: $e,
6153
6153
  onScroll: be,
6154
- scrollToBottom: ee
6154
+ scrollToBottom: Z
6155
6155
  }, () => [
6156
6156
  M("div", {
6157
6157
  ref_key: "scrollContainerRef",
@@ -6184,7 +6184,7 @@ const xr = {
6184
6184
  }))
6185
6185
  ]), 1032, ["messages", "is-running"])
6186
6186
  ]),
6187
- O.value ? (R(), j("div", Fr, [
6187
+ O.value ? (R(), B("div", Fr, [
6188
6188
  T(z.$slots, "suggestion-view", {
6189
6189
  suggestions: e.suggestions,
6190
6190
  loadingIndexes: e.suggestionLoadingIndexes,
@@ -6200,10 +6200,10 @@ const xr = {
6200
6200
  ])) : Q("", !0)
6201
6201
  ])
6202
6202
  ], 4),
6203
- f.value ? (R(), j("div", {
6203
+ f.value ? (R(), B("div", {
6204
6204
  key: 0,
6205
6205
  ref_key: "spacerRef",
6206
- ref: k,
6206
+ ref: y,
6207
6207
  "data-pin-to-send-spacer": "",
6208
6208
  "aria-hidden": "true",
6209
6209
  style: { height: "0px", flex: "0 0 auto" }
@@ -6214,19 +6214,19 @@ const xr = {
6214
6214
  T(z.$slots, "feather", {}, () => [
6215
6215
  le[4] || (le[4] = M("div", { "data-testid": "copilot-chat-view-feather" }, null, -1))
6216
6216
  ]),
6217
- U.value ? (R(), j("div", {
6217
+ D.value ? (R(), B("div", {
6218
6218
  key: 0,
6219
6219
  class: "cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30 cpk:pointer-events-none",
6220
6220
  style: rt({ bottom: `${d.value + Or}px` })
6221
6221
  }, [
6222
6222
  T(z.$slots, "scroll-to-bottom-button", {
6223
- onClick: () => ee()
6223
+ onClick: () => Z()
6224
6224
  }, () => [
6225
6225
  M("button", {
6226
6226
  type: "button",
6227
6227
  "data-testid": "copilot-chat-view-scroll-to-bottom",
6228
6228
  class: "cpk:rounded-full cpk:w-10 cpk:h-10 cpk:p-0 cpk:pointer-events-auto cpk:bg-white cpk:dark:bg-gray-900 cpk:shadow-lg cpk:border cpk:border-gray-200 cpk:dark:border-gray-700 cpk:hover:bg-gray-50 cpk:dark:hover:bg-gray-800 cpk:flex cpk:items-center cpk:justify-center cpk:cursor-pointer",
6229
- onClick: le[1] || (le[1] = (Ne) => ee())
6229
+ onClick: le[1] || (le[1] = (Ne) => Z())
6230
6230
  }, [
6231
6231
  oe(G(uo), { class: "cpk:w-4 cpk:h-4 cpk:text-gray-600 cpk:dark:text-white" })
6232
6232
  ])
@@ -6238,7 +6238,7 @@ const xr = {
6238
6238
  class: "cpk:absolute cpk:bottom-0 cpk:left-0 cpk:right-0 cpk:z-20 cpk:pointer-events-none",
6239
6239
  "data-testid": "copilot-input-overlay"
6240
6240
  }, [
6241
- D.value ? (R(), j("div", Er, [
6241
+ j.value ? (R(), B("div", Er, [
6242
6242
  oe(Vn, {
6243
6243
  attachments: e.attachments ?? [],
6244
6244
  "class-name": "cpk:px-4",
@@ -6251,7 +6251,7 @@ const xr = {
6251
6251
  inputMode: e.inputMode,
6252
6252
  inputToolsMenu: e.inputToolsMenu,
6253
6253
  attachments: e.attachments ?? [],
6254
- onUpdateModelValue: B,
6254
+ onUpdateModelValue: U,
6255
6255
  onSubmitMessage: ue,
6256
6256
  onStop: te.value ? pe : void 0,
6257
6257
  onAddFile: Le,
@@ -6267,7 +6267,7 @@ const xr = {
6267
6267
  "tools-menu": e.inputToolsMenu,
6268
6268
  positioning: "static",
6269
6269
  "show-disclaimer": !0,
6270
- "keyboard-height": b.value,
6270
+ "keyboard-height": k.value,
6271
6271
  "bottom-anchored": !0
6272
6272
  }, et.value), null, 16, ["model-value", "is-running", "mode", "tools-menu", "keyboard-height"])
6273
6273
  ])
@@ -6301,23 +6301,23 @@ const xr = {
6301
6301
  setup(e, { emit: n }) {
6302
6302
  const t = e, a = n, i = Ge(), o = pn(), s = Oe(), { copilotkit: r } = Be(), l = c(
6303
6303
  () => Object.keys(o).filter((_) => _ !== "chat-view")
6304
- ), p = I(pt()), k = I("input"), u = I(t.inputValue ?? ""), d = I(null), g = I(!1), h = I(!1), C = I(!1), m = it(null), x = c(
6304
+ ), p = I(pt()), y = I("input"), u = I(t.inputValue ?? ""), d = I(null), g = I(!1), h = I(!1), C = I(!1), m = it(null), x = c(
6305
6305
  () => t.agentId ?? s.value?.agentId ?? ct
6306
6306
  ), f = c(
6307
6307
  () => t.threadId ?? s.value?.threadId
6308
- ), y = c(
6308
+ ), b = c(
6309
6309
  () => f.value ?? p.value
6310
6310
  ), v = c(
6311
6311
  () => !!t.threadId || !!s.value?.hasExplicitThreadId
6312
- ), b = I(null), S = c(
6313
- () => v.value && b.value !== y.value
6314
- ), O = Zn(c(() => t.labels)), D = c(() => O.value), { agent: $ } = wn({
6312
+ ), k = I(null), S = c(
6313
+ () => v.value && k.value !== b.value
6314
+ ), O = Zn(c(() => t.labels)), j = c(() => O.value), { agent: $ } = wn({
6315
6315
  agentId: x,
6316
- threadId: y,
6316
+ threadId: b,
6317
6317
  throttleMs: c(() => t.throttleMs)
6318
6318
  }), { suggestions: P } = Ks({
6319
6319
  agentId: x
6320
- }), Y = kn(), ve = c(() => Y.value.checkFeature("chat"));
6320
+ }), ee = kn(), ve = c(() => ee.value.checkFeature("chat"));
6321
6321
  L(
6322
6322
  ve,
6323
6323
  (_) => {
@@ -6337,23 +6337,23 @@ const xr = {
6337
6337
  attachments: ne,
6338
6338
  enabled: re,
6339
6339
  dragOver: F,
6340
- fileInputRef: U,
6340
+ fileInputRef: D,
6341
6341
  containerRef: H,
6342
6342
  handleFileUpload: ae,
6343
6343
  handleDragOver: we,
6344
6344
  handleDragLeave: V,
6345
6345
  handleDrop: X,
6346
- removeAttachment: Z,
6347
- consumeAttachments: ee
6346
+ removeAttachment: Y,
6347
+ consumeAttachments: Z
6348
6348
  } = Gs({
6349
6349
  config: c(() => t.attachments)
6350
6350
  }), be = c(
6351
- () => g.value ? "processing" : k.value
6352
- ), Te = I(0), B = c(() => [...$.value?.messages ?? []]), ue = c(() => (Te.value, $.value?.isRunning ?? !1)), pe = c(
6353
- () => ue.value && B.value.length > 0
6351
+ () => g.value ? "processing" : y.value
6352
+ ), Te = I(0), U = c(() => [...$.value?.messages ?? []]), ue = c(() => (Te.value, $.value?.isRunning ?? !1)), pe = c(
6353
+ () => ue.value && U.value.length > 0
6354
6354
  ), $e = c(() => {
6355
- for (let _ = B.value.length - 1; _ >= 0; _--) {
6356
- const de = B.value[_];
6355
+ for (let _ = U.value.length - 1; _ >= 0; _--) {
6356
+ const de = U.value[_];
6357
6357
  if (de?.role === "user") return de.id;
6358
6358
  }
6359
6359
  return null;
@@ -6416,7 +6416,7 @@ const xr = {
6416
6416
  h,
6417
6417
  () => r.value,
6418
6418
  () => $.value,
6419
- y,
6419
+ b,
6420
6420
  v
6421
6421
  ],
6422
6422
  ([_, de, fe, Ie, Ve], gt, tt) => {
@@ -6424,7 +6424,7 @@ const xr = {
6424
6424
  return;
6425
6425
  const ht = Ya.prototype, Ot = fe, Tt = Ot.connect !== ht.connect, Lt = Ot.connectAgent !== ht.connectAgent;
6426
6426
  if (!Tt && !Lt) {
6427
- b.value = Ie;
6427
+ k.value = Ie;
6428
6428
  return;
6429
6429
  }
6430
6430
  const nt = m.value, Yt = nt && nt.core === de && nt.agent === fe && nt.threadId === Ie;
@@ -6445,13 +6445,13 @@ const xr = {
6445
6445
  if (at.detached)
6446
6446
  return;
6447
6447
  (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (A) => setTimeout(A, 16))(() => {
6448
- at.detached || (b.value = at.threadId);
6448
+ at.detached || (k.value = at.threadId);
6449
6449
  });
6450
6450
  });
6451
6451
  }
6452
6452
  tt(() => {
6453
6453
  const Pe = m.value;
6454
- !Pe || Pe !== at || !(C.value || r.value !== Pe.core || $.value !== Pe.agent || y.value !== Pe.threadId) || (Pe.detached = !0, Pe.abortController.abort(), Pe.agent.detachActiveRun?.(), m.value = null);
6454
+ !Pe || Pe !== at || !(C.value || r.value !== Pe.core || $.value !== Pe.agent || b.value !== Pe.threadId) || (Pe.detached = !0, Pe.abortController.abort(), Pe.agent.detachActiveRun?.(), m.value = null);
6455
6455
  });
6456
6456
  },
6457
6457
  { immediate: !0 }
@@ -6472,7 +6472,7 @@ const xr = {
6472
6472
  if (_)
6473
6473
  try {
6474
6474
  const de = m.value;
6475
- de && de.agent === _ && de.threadId === y.value && (de.detached = !0, de.abortController.abort(), m.value = null, await de.agent.detachActiveRun?.()), await r.value.runAgent({ agent: _ });
6475
+ de && de.agent === _ && de.threadId === b.value && (de.detached = !0, de.abortController.abort(), m.value = null, await de.agent.detachActiveRun?.()), await r.value.runAgent({ agent: _ });
6476
6476
  } catch (de) {
6477
6477
  console.error("CopilotChat: runAgent failed", de);
6478
6478
  }
@@ -6488,7 +6488,7 @@ const xr = {
6488
6488
  console.error("[CopilotKit] Cannot send message: no agent available");
6489
6489
  return;
6490
6490
  }
6491
- const fe = ee();
6491
+ const fe = Z();
6492
6492
  if (fe.length > 0) {
6493
6493
  const Ie = [];
6494
6494
  _.trim() && Ie.push({ type: "text", text: _ });
@@ -6543,17 +6543,17 @@ const xr = {
6543
6543
  }
6544
6544
  function z() {
6545
6545
  a("add-file"), re.value && setTimeout(() => {
6546
- U.value?.click();
6546
+ D.value?.click();
6547
6547
  }, 100);
6548
6548
  }
6549
6549
  function le() {
6550
- d.value = null, k.value = "transcribe", a("start-transcribe");
6550
+ d.value = null, y.value = "transcribe", a("start-transcribe");
6551
6551
  }
6552
6552
  function Ne() {
6553
- d.value = null, k.value = "input", a("cancel-transcribe");
6553
+ d.value = null, y.value = "input", a("cancel-transcribe");
6554
6554
  }
6555
6555
  function Qe() {
6556
- k.value = "input", a("finish-transcribe");
6556
+ y.value = "input", a("finish-transcribe");
6557
6557
  }
6558
6558
  async function Ft(_) {
6559
6559
  if (t.onFinishTranscribeWithAudio) {
@@ -6600,7 +6600,7 @@ const xr = {
6600
6600
  }
6601
6601
  }
6602
6602
  const Ue = c(() => ({
6603
- messages: B.value,
6603
+ messages: U.value,
6604
6604
  autoScroll: t.autoScroll,
6605
6605
  isRunning: ue.value,
6606
6606
  suggestions: P.value,
@@ -6617,7 +6617,7 @@ const xr = {
6617
6617
  onStop: pe.value ? De : void 0,
6618
6618
  onInputChange: et,
6619
6619
  onSelectSuggestion: xe,
6620
- onRemoveAttachment: Z,
6620
+ onRemoveAttachment: Y,
6621
6621
  onAddFile: re.value ? z : void 0,
6622
6622
  onDragOver: re.value ? we : void 0,
6623
6623
  onDragLeave: re.value ? V : void 0,
@@ -6633,13 +6633,13 @@ const xr = {
6633
6633
  onInputChange: et,
6634
6634
  onSelectSuggestion: xe
6635
6635
  };
6636
- return pe.value && (_.onStop = De), re.value && (_.onAddFile = z, _.attachments = ne.value, _.onRemoveAttachment = Z, _.dragOver = F.value, _.onDragOver = we, _.onDragLeave = V, _.onDrop = X), E.value && (_.onStartTranscribe = le, _.onCancelTranscribe = Ne, _.onFinishTranscribe = Qe), _;
6636
+ return pe.value && (_.onStop = De), re.value && (_.onAddFile = z, _.attachments = ne.value, _.onRemoveAttachment = Y, _.dragOver = F.value, _.onDragOver = we, _.onDragLeave = V, _.onDrop = X), E.value && (_.onStartTranscribe = le, _.onCancelTranscribe = Ne, _.onFinishTranscribe = Qe), _;
6637
6637
  });
6638
6638
  return (_, de) => (R(), he(bn, {
6639
6639
  "agent-id": x.value,
6640
- "thread-id": y.value,
6640
+ "thread-id": b.value,
6641
6641
  "has-explicit-thread-id": v.value,
6642
- labels: D.value
6642
+ labels: j.value
6643
6643
  }, {
6644
6644
  default: W(() => [
6645
6645
  M("div", {
@@ -6647,10 +6647,10 @@ const xr = {
6647
6647
  ref: H,
6648
6648
  style: { display: "contents" }
6649
6649
  }, [
6650
- G(re) ? (R(), j("input", {
6650
+ G(re) ? (R(), B("input", {
6651
6651
  key: 0,
6652
6652
  ref_key: "fileInputRef",
6653
- ref: U,
6653
+ ref: D,
6654
6654
  type: "file",
6655
6655
  multiple: "",
6656
6656
  accept: t.attachments?.accept ?? "*/*",
@@ -6663,7 +6663,7 @@ const xr = {
6663
6663
  key: 1,
6664
6664
  "feature-name": "Chat"
6665
6665
  })),
6666
- d.value ? (R(), j("div", Ur, ke(d.value), 1)) : Q("", !0),
6666
+ d.value ? (R(), B("div", Ur, ke(d.value), 1)) : Q("", !0),
6667
6667
  T(_.$slots, "chat-view", q(J(Ue.value)), () => [
6668
6668
  oe(Xt, ge(Et.value, {
6669
6669
  messages: Ue.value.messages,
@@ -6714,20 +6714,20 @@ const xr = {
6714
6714
  const n = e, t = I(!1), a = c(() => wt(n.source)), i = c(
6715
6715
  () => n.filename || n.source.mimeType || "Unknown type"
6716
6716
  );
6717
- return (o, s) => n.type === "image" && !t.value ? (R(), j("img", {
6717
+ return (o, s) => n.type === "image" && !t.value ? (R(), B("img", {
6718
6718
  key: 0,
6719
6719
  src: a.value,
6720
6720
  alt: "Image attachment",
6721
6721
  class: ye(["cpk:max-w-full cpk:h-auto cpk:rounded-lg", n.className]),
6722
6722
  "data-testid": "copilot-chat-attachment-renderer-image",
6723
6723
  onError: s[0] || (s[0] = (r) => t.value = !0)
6724
- }, null, 42, Br)) : n.type === "image" ? (R(), j("div", {
6724
+ }, null, 42, Br)) : n.type === "image" ? (R(), B("div", {
6725
6725
  key: 1,
6726
6726
  class: ye(["cpk:flex cpk:flex-col cpk:items-center cpk:justify-center cpk:rounded-lg cpk:bg-muted cpk:p-4 cpk:text-sm cpk:text-muted-foreground", n.className]),
6727
6727
  "data-testid": "copilot-chat-attachment-renderer-image-fallback"
6728
6728
  }, [...s[1] || (s[1] = [
6729
6729
  M("span", null, "Failed to load image", -1)
6730
- ])], 2)) : n.type === "audio" ? (R(), j("div", {
6730
+ ])], 2)) : n.type === "audio" ? (R(), B("div", {
6731
6731
  key: 2,
6732
6732
  class: ye(["cpk:flex cpk:flex-col cpk:gap-1", n.className]),
6733
6733
  "data-testid": "copilot-chat-attachment-renderer-audio"
@@ -6738,15 +6738,15 @@ const xr = {
6738
6738
  preload: "metadata",
6739
6739
  class: "cpk:max-w-[300px] cpk:w-full cpk:h-10"
6740
6740
  }, null, 8, jr),
6741
- n.filename ? (R(), j("span", Nr, ke(n.filename), 1)) : Q("", !0)
6742
- ], 2)) : n.type === "video" ? (R(), j("video", {
6741
+ n.filename ? (R(), B("span", Nr, ke(n.filename), 1)) : Q("", !0)
6742
+ ], 2)) : n.type === "video" ? (R(), B("video", {
6743
6743
  key: 3,
6744
6744
  src: a.value,
6745
6745
  controls: "",
6746
6746
  preload: "metadata",
6747
6747
  class: ye(["cpk:max-w-[400px] cpk:w-full cpk:rounded-lg", n.className]),
6748
6748
  "data-testid": "copilot-chat-attachment-renderer-video"
6749
- }, null, 10, Vr)) : (R(), j("div", {
6749
+ }, null, 10, Vr)) : (R(), B("div", {
6750
6750
  key: 4,
6751
6751
  class: ye(["cpk:inline-flex cpk:items-center cpk:gap-2 cpk:px-3 cpk:py-2 cpk:border cpk:border-border cpk:rounded-lg cpk:bg-muted", n.className]),
6752
6752
  "data-testid": "copilot-chat-attachment-renderer-document"
@@ -6803,7 +6803,7 @@ const xr = {
6803
6803
  ]), p = c(() => {
6804
6804
  const { class: h, onClick: C, ...m } = t;
6805
6805
  return m;
6806
- }), k = Object.freeze({
6806
+ }), y = Object.freeze({
6807
6807
  transition: "opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)"
6808
6808
  });
6809
6809
  function u(h) {
@@ -6826,7 +6826,7 @@ const xr = {
6826
6826
  h.defaultPrevented || u(!s.value);
6827
6827
  }
6828
6828
  }
6829
- return (h, C) => (R(), j("button", ge({
6829
+ return (h, C) => (R(), B("button", ge({
6830
6830
  "data-copilotkit": "",
6831
6831
  type: e.type,
6832
6832
  "data-slot": "chat-toggle-button",
@@ -6841,7 +6841,7 @@ const xr = {
6841
6841
  "data-slot": "chat-toggle-button-open-icon",
6842
6842
  class: ye(Pn),
6843
6843
  style: rt({
6844
- ...G(k),
6844
+ ...G(y),
6845
6845
  opacity: s.value ? 0 : 1,
6846
6846
  transform: `scale(${s.value ? 0.75 : 1}) rotate(${s.value ? 90 : 0}deg)`
6847
6847
  })
@@ -6862,7 +6862,7 @@ const xr = {
6862
6862
  "data-slot": "chat-toggle-button-close-icon",
6863
6863
  class: ye(Pn),
6864
6864
  style: rt({
6865
- ...G(k),
6865
+ ...G(y),
6866
6866
  opacity: s.value ? 1 : 0,
6867
6867
  transform: `scale(${s.value ? 1 : 0.75}) rotate(${s.value ? 0 : -90}deg)`
6868
6868
  })
@@ -6948,7 +6948,7 @@ const xr = {
6948
6948
  function r() {
6949
6949
  a.value?.setModalOpen?.(!1);
6950
6950
  }
6951
- return (l, p) => (R(), j("header", ge({
6951
+ return (l, p) => (R(), B("header", ge({
6952
6952
  "data-copilotkit": "",
6953
6953
  "data-slot": "copilot-modal-header",
6954
6954
  class: o.value
@@ -7019,14 +7019,14 @@ const xr = {
7019
7019
  setup(e, { emit: n }) {
7020
7020
  const t = e, a = n, i = Ge(), o = Oe(), s = lt(), r = c(
7021
7021
  () => s?.vnode.props ?? {}
7022
- ), l = I(null), p = I(o.value?.isModalOpen ?? !1), k = I(!1);
7022
+ ), l = I(null), p = I(o.value?.isModalOpen ?? !1), y = I(!1);
7023
7023
  let u, d;
7024
7024
  const g = c(() => o.value?.isModalOpen ?? !1), h = c(() => o.value?.labels ?? Ze), C = c(() => h.value.modalHeaderTitle), m = c(() => v("onStop")), x = c(
7025
- () => g.value && !k.value ? "cpk:pointer-events-auto cpk:translate-y-0 cpk:opacity-100 cpk:md:scale-100" : "cpk:pointer-events-none cpk:translate-y-4 cpk:opacity-0 cpk:md:translate-y-5 cpk:md:scale-[0.95]"
7025
+ () => g.value && !y.value ? "cpk:pointer-events-auto cpk:translate-y-0 cpk:opacity-100 cpk:md:scale-100" : "cpk:pointer-events-none cpk:translate-y-4 cpk:opacity-0 cpk:md:translate-y-5 cpk:md:scale-[0.95]"
7026
7026
  ), f = c(
7027
7027
  () => ({
7028
- "--copilot-popup-width": y(t.width, Qr),
7029
- "--copilot-popup-height": y(
7028
+ "--copilot-popup-width": b(t.width, Qr),
7029
+ "--copilot-popup-height": b(
7030
7030
  t.height,
7031
7031
  Xr
7032
7032
  ),
@@ -7042,14 +7042,14 @@ const xr = {
7042
7042
  paddingRight: "env(safe-area-inset-right)"
7043
7043
  })
7044
7044
  );
7045
- function y(F, U) {
7046
- return typeof F == "number" && Number.isFinite(F) ? `${F}px` : typeof F == "string" && F.trim().length > 0 ? F : `${U}px`;
7045
+ function b(F, D) {
7046
+ return typeof F == "number" && Number.isFinite(F) ? `${F}px` : typeof F == "string" && F.trim().length > 0 ? F : `${D}px`;
7047
7047
  }
7048
7048
  function v(F) {
7049
- const U = r.value[F];
7050
- return Array.isArray(U) ? U.length > 0 : !!U;
7049
+ const D = r.value[F];
7050
+ return Array.isArray(D) ? D.length > 0 : !!D;
7051
7051
  }
7052
- function b() {
7052
+ function k() {
7053
7053
  o.value?.setModalOpen?.(!1);
7054
7054
  }
7055
7055
  function S() {
@@ -7058,7 +7058,7 @@ const xr = {
7058
7058
  function O() {
7059
7059
  o.value?.setModalOpen?.(!g.value);
7060
7060
  }
7061
- function D(F) {
7061
+ function j(F) {
7062
7062
  a("submit-message", F);
7063
7063
  }
7064
7064
  function $() {
@@ -7067,8 +7067,8 @@ const xr = {
7067
7067
  function P(F) {
7068
7068
  a("input-change", F);
7069
7069
  }
7070
- function Y(F, U) {
7071
- a("select-suggestion", F, U);
7070
+ function ee(F, D) {
7071
+ a("select-suggestion", F, D);
7072
7072
  }
7073
7073
  function ve() {
7074
7074
  a("add-file");
@@ -7084,9 +7084,9 @@ const xr = {
7084
7084
  }
7085
7085
  const ne = c(() => {
7086
7086
  const F = {
7087
- onSubmitMessage: D,
7087
+ onSubmitMessage: j,
7088
7088
  onInputChange: P,
7089
- onSelectSuggestion: Y
7089
+ onSelectSuggestion: ee
7090
7090
  };
7091
7091
  return m.value && (F.onStop = $), v("onAddFile") && (F.onAddFile = ve), v("onStartTranscribe") && (F.onStartTranscribe = te), v("onCancelTranscribe") && (F.onCancelTranscribe = K), v("onFinishTranscribe") && (F.onFinishTranscribe = E), F;
7092
7092
  }), re = c(() => ({
@@ -7097,21 +7097,21 @@ const xr = {
7097
7097
  g,
7098
7098
  (F) => {
7099
7099
  if (u && (clearTimeout(u), u = void 0), F) {
7100
- p.value = !0, k.value = !1;
7100
+ p.value = !0, y.value = !1;
7101
7101
  return;
7102
7102
  }
7103
- p.value && (k.value = !0, u = setTimeout(() => {
7104
- p.value = !1, k.value = !1, u = void 0;
7103
+ p.value && (y.value = !0, u = setTimeout(() => {
7104
+ p.value = !1, y.value = !1, u = void 0;
7105
7105
  }, zn));
7106
7106
  },
7107
7107
  { immediate: !0 }
7108
7108
  ), L(
7109
7109
  g,
7110
- (F, U, H) => {
7110
+ (F, D, H) => {
7111
7111
  if (!F || typeof window > "u")
7112
7112
  return;
7113
7113
  const ae = (we) => {
7114
- we.key === "Escape" && (we.preventDefault(), b());
7114
+ we.key === "Escape" && (we.preventDefault(), k());
7115
7115
  };
7116
7116
  window.addEventListener("keydown", ae), H(() => {
7117
7117
  window.removeEventListener("keydown", ae);
@@ -7120,7 +7120,7 @@ const xr = {
7120
7120
  { immediate: !0 }
7121
7121
  ), L(
7122
7122
  g,
7123
- (F, U, H) => {
7123
+ (F, D, H) => {
7124
7124
  F && (d = setTimeout(() => {
7125
7125
  if (typeof document > "u")
7126
7126
  return;
@@ -7133,14 +7133,14 @@ const xr = {
7133
7133
  { immediate: !0 }
7134
7134
  ), L(
7135
7135
  [g, () => t.clickOutsideToClose],
7136
- ([F, U], H, ae) => {
7137
- if (!F || !U || typeof document > "u")
7136
+ ([F, D], H, ae) => {
7137
+ if (!F || !D || typeof document > "u")
7138
7138
  return;
7139
7139
  const we = (V) => {
7140
7140
  const X = V.target;
7141
7141
  !X || l.value?.contains(X) || document.querySelector(
7142
7142
  "[data-slot='chat-toggle-button']"
7143
- )?.contains(X) || b();
7143
+ )?.contains(X) || k();
7144
7144
  };
7145
7145
  document.addEventListener("pointerdown", we), ae(() => {
7146
7146
  document.removeEventListener("pointerdown", we);
@@ -7151,16 +7151,16 @@ const xr = {
7151
7151
  await ft();
7152
7152
  }), Me(() => {
7153
7153
  u && clearTimeout(u), d && clearTimeout(d);
7154
- }), (F, U) => (R(), j(Re, null, [
7154
+ }), (F, D) => (R(), B(Re, null, [
7155
7155
  T(F.$slots, "toggle-button", {
7156
7156
  isOpen: g.value,
7157
7157
  toggle: O,
7158
7158
  open: S,
7159
- close: b
7159
+ close: k
7160
7160
  }, () => [
7161
7161
  oe(Cn)
7162
7162
  ]),
7163
- p.value ? (R(), j("div", Kr, [
7163
+ p.value ? (R(), B("div", Kr, [
7164
7164
  M("div", {
7165
7165
  ref_key: "containerRef",
7166
7166
  ref: l,
@@ -7182,7 +7182,7 @@ const xr = {
7182
7182
  }, [
7183
7183
  T(F.$slots, "header", {
7184
7184
  title: C.value,
7185
- onClose: b,
7185
+ onClose: k,
7186
7186
  isOpen: g.value
7187
7187
  }, () => [
7188
7188
  oe(Tn, { title: C.value }, null, 8, ["title"])
@@ -7310,14 +7310,14 @@ const xr = {
7310
7310
  onSelectSuggestion: (d, g) => a("select-suggestion", d, g)
7311
7311
  };
7312
7312
  return r("onAddFile") && (u.onAddFile = () => a("add-file")), r("onStartTranscribe") && (u.onStartTranscribe = () => a("start-transcribe")), r("onCancelTranscribe") && (u.onCancelTranscribe = () => a("cancel-transcribe")), r("onFinishTranscribe") && (u.onFinishTranscribe = () => a("finish-transcribe")), u;
7313
- }), k = c(() => ({
7313
+ }), y = c(() => ({
7314
7314
  ...i,
7315
7315
  ...l.value,
7316
7316
  ...p.value
7317
7317
  }));
7318
7318
  return (u, d) => (R(), he(bn, { "is-modal-default-open": e.defaultOpen }, {
7319
7319
  default: W(() => [
7320
- oe(Yr, q(J(k.value)), qe({ _: 2 }, [
7320
+ oe(Yr, q(J(y.value)), qe({ _: 2 }, [
7321
7321
  u.$slots.header ? {
7322
7322
  name: "header",
7323
7323
  fn: W((g) => [
@@ -7515,7 +7515,7 @@ const xr = {
7515
7515
  ), l = I(null), p = I(
7516
7516
  t.width ?? il
7517
7517
  );
7518
- let k = null;
7518
+ let y = null;
7519
7519
  const u = c(() => o.value?.isModalOpen ?? !1), d = c(
7520
7520
  () => t.width ?? p.value
7521
7521
  ), g = c(
@@ -7527,9 +7527,9 @@ const xr = {
7527
7527
  u.value ? "cpk:translate-x-0" : "cpk:translate-x-full cpk:pointer-events-none",
7528
7528
  i.class
7529
7529
  ]), C = c(() => {
7530
- const { class: U, ...H } = i;
7530
+ const { class: D, ...H } = i;
7531
7531
  return H;
7532
- }), m = c(() => y("onStop")), x = c(
7532
+ }), m = c(() => b("onStop")), x = c(
7533
7533
  () => ({
7534
7534
  "--sidebar-width": v(d.value),
7535
7535
  paddingTop: "env(safe-area-inset-top)",
@@ -7539,48 +7539,48 @@ const xr = {
7539
7539
  () => `
7540
7540
  @media (min-width: 768px) {
7541
7541
  body {
7542
- margin-inline-end: ${b(d.value)};
7542
+ margin-inline-end: ${k(d.value)};
7543
7543
  transition: margin-inline-end ${rl}ms ease;
7544
7544
  }
7545
7545
  }
7546
7546
  `
7547
7547
  );
7548
- function y(U) {
7549
- const H = r.value[U];
7548
+ function b(D) {
7549
+ const H = r.value[D];
7550
7550
  return Array.isArray(H) ? H.length > 0 : !!H;
7551
7551
  }
7552
- function v(U) {
7553
- return typeof U == "number" ? `${U}px` : U;
7552
+ function v(D) {
7553
+ return typeof D == "number" ? `${D}px` : D;
7554
7554
  }
7555
- function b(U) {
7556
- return typeof U == "number" ? `${U}px` : U;
7555
+ function k(D) {
7556
+ return typeof D == "number" ? `${D}px` : D;
7557
7557
  }
7558
7558
  function S() {
7559
7559
  if (t.width !== void 0 || !l.value)
7560
7560
  return;
7561
- const U = l.value.getBoundingClientRect().width;
7562
- U > 0 && (p.value = U);
7561
+ const D = l.value.getBoundingClientRect().width;
7562
+ D > 0 && (p.value = D);
7563
7563
  }
7564
7564
  function O() {
7565
7565
  o.value?.setModalOpen?.(!1);
7566
7566
  }
7567
- function D() {
7567
+ function j() {
7568
7568
  o.value?.setModalOpen?.(!0);
7569
7569
  }
7570
7570
  function $() {
7571
7571
  o.value?.setModalOpen?.(!u.value);
7572
7572
  }
7573
- function P(U) {
7574
- a("submit-message", U);
7573
+ function P(D) {
7574
+ a("submit-message", D);
7575
7575
  }
7576
- function Y() {
7576
+ function ee() {
7577
7577
  a("stop");
7578
7578
  }
7579
- function ve(U) {
7580
- a("input-change", U);
7579
+ function ve(D) {
7580
+ a("input-change", D);
7581
7581
  }
7582
- function te(U, H) {
7583
- a("select-suggestion", U, H);
7582
+ function te(D, H) {
7583
+ a("select-suggestion", D, H);
7584
7584
  }
7585
7585
  function K() {
7586
7586
  a("add-file");
@@ -7595,39 +7595,39 @@ const xr = {
7595
7595
  a("finish-transcribe");
7596
7596
  }
7597
7597
  const F = c(() => {
7598
- const U = {
7598
+ const D = {
7599
7599
  onSubmitMessage: P,
7600
7600
  onInputChange: ve,
7601
7601
  onSelectSuggestion: te
7602
7602
  };
7603
- return m.value && (U.onStop = Y), y("onAddFile") && (U.onAddFile = K), y("onStartTranscribe") && (U.onStartTranscribe = E), y("onCancelTranscribe") && (U.onCancelTranscribe = ne), y("onFinishTranscribe") && (U.onFinishTranscribe = re), U;
7603
+ return m.value && (D.onStop = ee), b("onAddFile") && (D.onAddFile = K), b("onStartTranscribe") && (D.onStartTranscribe = E), b("onCancelTranscribe") && (D.onCancelTranscribe = ne), b("onFinishTranscribe") && (D.onFinishTranscribe = re), D;
7604
7604
  });
7605
7605
  return L(
7606
7606
  () => t.width,
7607
- (U) => {
7608
- if (U !== void 0) {
7609
- p.value = U;
7607
+ (D) => {
7608
+ if (D !== void 0) {
7609
+ p.value = D;
7610
7610
  return;
7611
7611
  }
7612
7612
  S();
7613
7613
  }
7614
7614
  ), Je(async () => {
7615
- await ft(), S(), !(t.width !== void 0 || !l.value || typeof ResizeObserver > "u") && (k = new ResizeObserver(() => {
7615
+ await ft(), S(), !(t.width !== void 0 || !l.value || typeof ResizeObserver > "u") && (y = new ResizeObserver(() => {
7616
7616
  S();
7617
- }), k.observe(l.value));
7617
+ }), y.observe(l.value));
7618
7618
  }), Me(() => {
7619
- k?.disconnect(), k = null;
7620
- }), (U, H) => (R(), j(Re, null, [
7619
+ y?.disconnect(), y = null;
7620
+ }), (D, H) => (R(), B(Re, null, [
7621
7621
  u.value ? (R(), he(mt("style"), { key: 0 }, {
7622
7622
  default: W(() => [
7623
7623
  qt(ke(f.value), 1)
7624
7624
  ]),
7625
7625
  _: 1
7626
7626
  })) : Q("", !0),
7627
- T(U.$slots, "toggle-button", {
7627
+ T(D.$slots, "toggle-button", {
7628
7628
  isOpen: u.value,
7629
7629
  toggle: $,
7630
- open: D,
7630
+ open: j,
7631
7631
  close: O
7632
7632
  }, () => [
7633
7633
  oe(Cn)
@@ -7644,7 +7644,7 @@ const xr = {
7644
7644
  role: "complementary"
7645
7645
  }, C.value), [
7646
7646
  M("div", ol, [
7647
- T(U.$slots, "header", {
7647
+ T(D.$slots, "header", {
7648
7648
  title: g.value,
7649
7649
  onClose: O,
7650
7650
  isOpen: u.value
@@ -7664,59 +7664,59 @@ const xr = {
7664
7664
  "input-tools-menu": e.inputToolsMenu,
7665
7665
  "on-finish-transcribe-with-audio": e.onFinishTranscribeWithAudio
7666
7666
  }, F.value), qe({ _: 2 }, [
7667
- U.$slots["message-view"] ? {
7667
+ D.$slots["message-view"] ? {
7668
7668
  name: "message-view",
7669
7669
  fn: W((ae) => [
7670
- T(U.$slots, "message-view", q(J(ae)))
7670
+ T(D.$slots, "message-view", q(J(ae)))
7671
7671
  ]),
7672
7672
  key: "0"
7673
7673
  } : void 0,
7674
- U.$slots["scroll-view"] ? {
7674
+ D.$slots["scroll-view"] ? {
7675
7675
  name: "scroll-view",
7676
7676
  fn: W((ae) => [
7677
- T(U.$slots, "scroll-view", q(J(ae)))
7677
+ T(D.$slots, "scroll-view", q(J(ae)))
7678
7678
  ]),
7679
7679
  key: "1"
7680
7680
  } : void 0,
7681
- U.$slots.feather ? {
7681
+ D.$slots.feather ? {
7682
7682
  name: "feather",
7683
7683
  fn: W(() => [
7684
- T(U.$slots, "feather")
7684
+ T(D.$slots, "feather")
7685
7685
  ]),
7686
7686
  key: "2"
7687
7687
  } : void 0,
7688
- U.$slots["scroll-to-bottom-button"] ? {
7688
+ D.$slots["scroll-to-bottom-button"] ? {
7689
7689
  name: "scroll-to-bottom-button",
7690
7690
  fn: W((ae) => [
7691
- T(U.$slots, "scroll-to-bottom-button", q(J(ae)))
7691
+ T(D.$slots, "scroll-to-bottom-button", q(J(ae)))
7692
7692
  ]),
7693
7693
  key: "3"
7694
7694
  } : void 0,
7695
- U.$slots.input ? {
7695
+ D.$slots.input ? {
7696
7696
  name: "input",
7697
7697
  fn: W((ae) => [
7698
- T(U.$slots, "input", q(J(ae)))
7698
+ T(D.$slots, "input", q(J(ae)))
7699
7699
  ]),
7700
7700
  key: "4"
7701
7701
  } : void 0,
7702
- U.$slots["suggestion-view"] ? {
7702
+ D.$slots["suggestion-view"] ? {
7703
7703
  name: "suggestion-view",
7704
7704
  fn: W((ae) => [
7705
- T(U.$slots, "suggestion-view", q(J(ae)))
7705
+ T(D.$slots, "suggestion-view", q(J(ae)))
7706
7706
  ]),
7707
7707
  key: "5"
7708
7708
  } : void 0,
7709
- U.$slots["welcome-screen"] ? {
7709
+ D.$slots["welcome-screen"] ? {
7710
7710
  name: "welcome-screen",
7711
7711
  fn: W((ae) => [
7712
- T(U.$slots, "welcome-screen", q(J(ae)))
7712
+ T(D.$slots, "welcome-screen", q(J(ae)))
7713
7713
  ]),
7714
7714
  key: "6"
7715
7715
  } : void 0,
7716
- U.$slots["welcome-message"] ? {
7716
+ D.$slots["welcome-message"] ? {
7717
7717
  name: "welcome-message",
7718
7718
  fn: W(() => [
7719
- T(U.$slots, "welcome-message")
7719
+ T(D.$slots, "welcome-message")
7720
7720
  ]),
7721
7721
  key: "7"
7722
7722
  } : void 0
@@ -7762,13 +7762,13 @@ const xr = {
7762
7762
  }), l = c(() => ({
7763
7763
  ...i,
7764
7764
  ...r.value,
7765
- ...k.value
7765
+ ...y.value
7766
7766
  }));
7767
7767
  function p(u) {
7768
7768
  const d = s.value[u];
7769
7769
  return Array.isArray(d) ? d.length > 0 : !!d;
7770
7770
  }
7771
- const k = c(() => {
7771
+ const y = c(() => {
7772
7772
  const u = {
7773
7773
  onSubmitMessage: (d) => a("submit-message", d),
7774
7774
  onStop: () => a("stop"),
@@ -7989,7 +7989,7 @@ const xr = {
7989
7989
  );
7990
7990
  },
7991
7991
  { immediate: !0 }
7992
- ), (o, s) => (R(), j(Re, null, [
7992
+ ), (o, s) => (R(), B(Re, null, [
7993
7993
  i.value ? Q("", !0) : (R(), he(yn, {
7994
7994
  key: 0,
7995
7995
  "feature-name": "Popup"
@@ -8133,7 +8133,7 @@ const xr = {
8133
8133
  );
8134
8134
  },
8135
8135
  { immediate: !0 }
8136
- ), (o, s) => (R(), j(Re, null, [
8136
+ ), (o, s) => (R(), B(Re, null, [
8137
8137
  i.value ? Q("", !0) : (R(), he(yn, {
8138
8138
  key: 0,
8139
8139
  "feature-name": "Sidebar"
@@ -8623,10 +8623,10 @@ function Ql(e, n) {
8623
8623
  if (!r.value) return o.value;
8624
8624
  const m = r.value.consumerAgentId;
8625
8625
  return !m || m === "*" ? o.value : m;
8626
- }), k = c(
8626
+ }), y = c(
8627
8627
  () => s.value === void 0 || s.value === "*"
8628
8628
  ), u = I(!1), d = I(null), g = I(null), h = () => {
8629
- if (!u.value || !k.value)
8629
+ if (!u.value || !y.value)
8630
8630
  return;
8631
8631
  if (Object.values(t.value.agents ?? {}).some(
8632
8632
  (x) => !!x.agentId && x.isRunning
@@ -8639,12 +8639,12 @@ function Ql(e, n) {
8639
8639
  u.value = !1, C();
8640
8640
  }, C = () => {
8641
8641
  if (r.value) {
8642
- if (k.value) {
8642
+ if (y.value) {
8643
8643
  let m = !1;
8644
8644
  const x = Object.values(t.value.agents ?? {});
8645
8645
  for (const f of x) {
8646
- const y = f.agentId;
8647
- y && (f.isRunning ? m = !0 : t.value.reloadSuggestions(y));
8646
+ const b = f.agentId;
8647
+ b && (f.isRunning ? m = !0 : t.value.reloadSuggestions(b));
8648
8648
  }
8649
8649
  u.value = m, m && d.value === null && (d.value = setTimeout(() => {
8650
8650
  d.value = null, h();
@@ -8656,11 +8656,11 @@ function Ql(e, n) {
8656
8656
  };
8657
8657
  L(
8658
8658
  [() => t.value, l],
8659
- ([m, x], f, y) => {
8659
+ ([m, x], f, b) => {
8660
8660
  if (!x || !r.value)
8661
8661
  return;
8662
- const v = t.value, b = r.value, S = v.addSuggestionsConfig(b);
8663
- C(), y(() => v.removeSuggestionsConfig(S));
8662
+ const v = t.value, k = r.value, S = v.addSuggestionsConfig(k);
8663
+ C(), b(() => v.removeSuggestionsConfig(S));
8664
8664
  },
8665
8665
  { immediate: !0 }
8666
8666
  ), L(
@@ -8688,12 +8688,12 @@ function Ql(e, n) {
8688
8688
  },
8689
8689
  { immediate: !0 }
8690
8690
  ), L(
8691
- [() => t.value, k],
8692
- ([m, x], f, y) => {
8691
+ [() => t.value, y],
8692
+ ([m, x], f, b) => {
8693
8693
  if (!x)
8694
8694
  return;
8695
- const v = Object.values(m.agents ?? {}).filter((b) => !!b).map(
8696
- (b) => b.subscribe({
8695
+ const v = Object.values(m.agents ?? {}).filter((k) => !!k).map(
8696
+ (k) => k.subscribe({
8697
8697
  onRunStartedEvent: h,
8698
8698
  onRunFinishedEvent: h,
8699
8699
  onRunFinalized: h,
@@ -8701,9 +8701,9 @@ function Ql(e, n) {
8701
8701
  onRunErrorEvent: h
8702
8702
  })
8703
8703
  );
8704
- y(() => {
8705
- for (const b of v)
8706
- b.unsubscribe();
8704
+ b(() => {
8705
+ for (const k of v)
8706
+ k.unsubscribe();
8707
8707
  });
8708
8708
  },
8709
8709
  { immediate: !0 }
@@ -8731,22 +8731,22 @@ function Xl(e = {}) {
8731
8731
  a.value = null, i.value = null;
8732
8732
  return;
8733
8733
  }
8734
- let k = null;
8734
+ let y = null;
8735
8735
  const u = r.subscribe({
8736
8736
  onCustomEvent: ({ event: d }) => {
8737
- d.name === xl && (k = {
8737
+ d.name === xl && (y = {
8738
8738
  name: d.name,
8739
8739
  value: d.value
8740
8740
  });
8741
8741
  },
8742
8742
  onRunStartedEvent: () => {
8743
- k = null, a.value = null;
8743
+ y = null, a.value = null;
8744
8744
  },
8745
8745
  onRunFinalized: () => {
8746
- k && (a.value = k, k = null);
8746
+ y && (a.value = y, y = null);
8747
8747
  },
8748
8748
  onRunFailed: () => {
8749
- k = null;
8749
+ y = null;
8750
8750
  }
8751
8751
  });
8752
8752
  p(() => u.unsubscribe());
@@ -8765,10 +8765,10 @@ function Xl(e = {}) {
8765
8765
  interruptEvent: p
8766
8766
  }
8767
8767
  }
8768
- }).catch((k) => {
8768
+ }).catch((y) => {
8769
8769
  console.error(
8770
8770
  "[CopilotKit] useInterrupt: failed to resume agent:",
8771
- k
8771
+ y
8772
8772
  );
8773
8773
  });
8774
8774
  };
@@ -8783,13 +8783,13 @@ function Xl(e = {}) {
8783
8783
  i.value = null;
8784
8784
  return;
8785
8785
  }
8786
- const k = e.handler;
8787
- if (!k) {
8786
+ const y = e.handler;
8787
+ if (!y) {
8788
8788
  i.value = null;
8789
8789
  return;
8790
8790
  }
8791
8791
  let u = !1;
8792
- const d = k({
8792
+ const d = y({
8793
8793
  event: r,
8794
8794
  resolve: o
8795
8795
  });
@@ -8810,7 +8810,7 @@ function Xl(e = {}) {
8810
8810
  });
8811
8811
  return L(
8812
8812
  [() => n.value, s, () => e.renderInChat !== !1],
8813
- ([r, l, p], k, u) => {
8813
+ ([r, l, p], y, u) => {
8814
8814
  if (!p)
8815
8815
  return;
8816
8816
  r.setInterruptState(
@@ -8851,8 +8851,8 @@ function Yl(e) {
8851
8851
  ([x], [f]) => x.localeCompare(f)
8852
8852
  )
8853
8853
  )
8854
- ), r = I([]), l = I(!1), p = I(null), k = I(!1), u = I(!1);
8855
- St(t, Ta, r), St(t, Sa, l), St(t, Ia, p), St(t, Aa, k), St(
8854
+ ), r = I([]), l = I(!1), p = I(null), y = I(!1), u = I(!1);
8855
+ St(t, Ta, r), St(t, Sa, l), St(t, Ia, p), St(t, Aa, y), St(
8856
8856
  t,
8857
8857
  Ra,
8858
8858
  u
@@ -8870,7 +8870,7 @@ function Yl(e) {
8870
8870
  i,
8871
8871
  o
8872
8872
  ],
8873
- ([x, f, , y, v, b, S]) => {
8873
+ ([x, f, , b, v, k, S]) => {
8874
8874
  if (!x) {
8875
8875
  t.setContext(null);
8876
8876
  return;
@@ -8880,9 +8880,9 @@ function Yl(e) {
8880
8880
  const O = {
8881
8881
  runtimeUrl: x,
8882
8882
  headers: { ...n.value.headers },
8883
- wsUrl: y,
8883
+ wsUrl: b,
8884
8884
  agentId: v,
8885
- includeArchived: b,
8885
+ includeArchived: k,
8886
8886
  limit: S
8887
8887
  };
8888
8888
  t.setContext(O), d.value = !0;
@@ -8901,12 +8901,12 @@ function Yl(e) {
8901
8901
  return {
8902
8902
  threads: c(
8903
8903
  () => r.value.map(
8904
- ({ id: x, agentId: f, name: y, archived: v, createdAt: b, updatedAt: S, lastRunAt: O }) => ({
8904
+ ({ id: x, agentId: f, name: b, archived: v, createdAt: k, updatedAt: S, lastRunAt: O }) => ({
8905
8905
  id: x,
8906
8906
  agentId: f,
8907
- name: y,
8907
+ name: b,
8908
8908
  archived: v,
8909
- createdAt: b,
8909
+ createdAt: k,
8910
8910
  updatedAt: S,
8911
8911
  ...O !== void 0 ? { lastRunAt: O } : {}
8912
8912
  })
@@ -8914,7 +8914,7 @@ function Yl(e) {
8914
8914
  ),
8915
8915
  isLoading: C,
8916
8916
  error: m,
8917
- hasMoreThreads: k,
8917
+ hasMoreThreads: y,
8918
8918
  isFetchingMoreThreads: u,
8919
8919
  fetchMoreThreads: () => t.fetchNextPage(),
8920
8920
  renameThread: (x, f) => t.renameThread(x, f),
@@ -8936,38 +8936,38 @@ function ec() {
8936
8936
  const i = n.value;
8937
8937
  if (!i) return null;
8938
8938
  const o = i.agentId || ct, { threadId: s } = i, r = e.value, l = [...r.renderCustomMessages].filter(
8939
- (b) => b.agentId === void 0 || b.agentId === o
8940
- ).sort((b, S) => {
8941
- const O = b.agentId !== void 0, D = S.agentId !== void 0;
8942
- return O === D ? 0 : O ? -1 : 1;
8939
+ (k) => k.agentId === void 0 || k.agentId === o
8940
+ ).sort((k, S) => {
8941
+ const O = k.agentId !== void 0, j = S.agentId !== void 0;
8942
+ return O === j ? 0 : O ? -1 : 1;
8943
8943
  });
8944
8944
  if (!l.length)
8945
8945
  return null;
8946
- const { message: p, position: k } = a, u = r.getRunIdForMessage(o, s, p.id) ?? r.getRunIdsForThread(o, s).slice(-1)[0], d = u ?? `missing-run-id:${p.id}`, g = r.getAgent(o);
8946
+ const { message: p, position: y } = a, u = r.getRunIdForMessage(o, s, p.id) ?? r.getRunIdsForThread(o, s).slice(-1)[0], d = u ?? `missing-run-id:${p.id}`, g = r.getAgent(o);
8947
8947
  if (!g)
8948
8948
  return null;
8949
8949
  const h = u ? g.messages.filter(
8950
- (b) => r.getRunIdForMessage(o, s, b.id) === u
8951
- ).map((b) => b.id) : [p.id], C = g.messages.findIndex(
8952
- (b) => b.id === p.id
8950
+ (k) => r.getRunIdForMessage(o, s, k.id) === u
8951
+ ).map((k) => k.id) : [p.id], C = g.messages.findIndex(
8952
+ (k) => k.id === p.id
8953
8953
  );
8954
8954
  C < 0 && console.warn(
8955
8955
  `[CopilotKit] useRenderCustomMessages: message "${p.id}" not found in agent "${o}" messages`
8956
8956
  );
8957
- const m = Math.max(0, C), x = u ? Math.max(h.indexOf(p.id), 0) : 0, f = u ? h.length : 1, y = u ? r.getStateByRun(o, s, u) : void 0, v = {
8957
+ const m = Math.max(0, C), x = u ? Math.max(h.indexOf(p.id), 0) : 0, f = u ? h.length : 1, b = u ? r.getStateByRun(o, s, u) : void 0, v = {
8958
8958
  message: p,
8959
- position: k,
8959
+ position: y,
8960
8960
  runId: d,
8961
8961
  messageIndex: m,
8962
8962
  messageIndexInRun: x,
8963
8963
  numberOfMessagesInRun: f,
8964
8964
  agentId: o,
8965
- stateSnapshot: y
8965
+ stateSnapshot: b
8966
8966
  };
8967
- for (const b of l)
8968
- if (b.render)
8967
+ for (const k of l)
8968
+ if (k.render)
8969
8969
  return {
8970
- renderer: b.render,
8970
+ renderer: k.render,
8971
8971
  props: v
8972
8972
  };
8973
8973
  return null;
@@ -9080,4 +9080,4 @@ export {
9080
9080
  Vl as y,
9081
9081
  Wl as z
9082
9082
  };
9083
- //# sourceMappingURL=use-render-activity-message-Dw44JCPl.js.map
9083
+ //# sourceMappingURL=use-render-activity-message-BB43N8wJ.js.map