@8wave/ai-elements 0.126.0-beta.20 → 0.126.0-beta.22

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.
Files changed (118) hide show
  1. package/dist/_chunks/{PkChatbotFilePreview-DHcHcy4x.js → PkChatbotFilePreview-jN3SAlut.js} +2 -2
  2. package/dist/_chunks/{PkChatbotFilePreview-DHcHcy4x.js.map → PkChatbotFilePreview-jN3SAlut.js.map} +1 -1
  3. package/dist/_chunks/{PkStreamingMarkdown-0lzE-l9f.js → PkStreamingMarkdown-qoTgaVHP.js} +2 -2
  4. package/dist/_chunks/{PkStreamingMarkdown-0lzE-l9f.js.map → PkStreamingMarkdown-qoTgaVHP.js.map} +1 -1
  5. package/dist/_chunks/{PkToolChatFile-x50rORrq.js → PkToolChatFile-uAyCds1k.js} +2 -2
  6. package/dist/_chunks/{PkToolChatFile-x50rORrq.js.map → PkToolChatFile-uAyCds1k.js.map} +1 -1
  7. package/dist/_chunks/{PkToolShareDocument-Cv7uBr5Z.js → PkToolShareDocument-NUMXFQ2e.js} +2 -2
  8. package/dist/_chunks/{PkToolShareDocument-Cv7uBr5Z.js.map → PkToolShareDocument-NUMXFQ2e.js.map} +1 -1
  9. package/dist/_chunks/{PkToolShowArtifact-DMIADTQ6.js → PkToolShowArtifact-D1p76r2a.js} +2 -2
  10. package/dist/_chunks/{PkToolShowArtifact-DMIADTQ6.js.map → PkToolShowArtifact-D1p76r2a.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowContactForm-B5DCcFqt.js → PkToolShowContactForm-B4S4qtxp.js} +2 -2
  12. package/dist/_chunks/{PkToolShowContactForm-B5DCcFqt.js.map → PkToolShowContactForm-B4S4qtxp.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowDiagram-DEFJr7zY.js → PkToolShowDiagram-CauQT97Z.js} +2 -2
  14. package/dist/_chunks/{PkToolShowDiagram-DEFJr7zY.js.map → PkToolShowDiagram-CauQT97Z.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowForm-BBxcDLyR.js → PkToolShowForm-1sJBr8KY.js} +2 -2
  16. package/dist/_chunks/{PkToolShowForm-BBxcDLyR.js.map → PkToolShowForm-1sJBr8KY.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowImageGallery-BYvCAUFX.js → PkToolShowImageGallery-DFhYCp-v.js} +2 -2
  18. package/dist/_chunks/{PkToolShowImageGallery-BYvCAUFX.js.map → PkToolShowImageGallery-DFhYCp-v.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowSources-DxZoqWZd.js → PkToolShowSources-DFHejVc0.js} +2 -2
  20. package/dist/_chunks/{PkToolShowSources-DxZoqWZd.js.map → PkToolShowSources-DFHejVc0.js.map} +1 -1
  21. package/dist/_chunks/{useLightbox-BlHExsUm.js → useLightbox-CUT_xmuZ.js} +100 -95
  22. package/dist/_chunks/useLightbox-CUT_xmuZ.js.map +1 -0
  23. package/dist/ai-elements.es.js +2316 -2153
  24. package/dist/ai-elements.es.js.map +1 -1
  25. package/dist-vue/PkChatbot.js +1 -1
  26. package/dist-vue/PkChatbotEmptyState.js +1 -1
  27. package/dist-vue/PkChatbotFilePreview.js +1 -1
  28. package/dist-vue/PkChatbotInput.js +1 -1
  29. package/dist-vue/PkChatbotMessages.js +1 -1
  30. package/dist-vue/PkChatbotSteps.js +1 -1
  31. package/dist-vue/PkChatbotViewChat.js +1 -1
  32. package/dist-vue/PkChatbotViewConversations.js +1 -1
  33. package/dist-vue/PkChatbotViewFiles.js +1 -1
  34. package/dist-vue/PkChatbotViewProfile.js +1 -1
  35. package/dist-vue/_chunks/{PkChatbot-CxphD_YU.js → PkChatbot-VJorpNbU.js} +7 -7
  36. package/dist-vue/_chunks/{PkChatbot-CxphD_YU.js.map → PkChatbot-VJorpNbU.js.map} +1 -1
  37. package/dist-vue/_chunks/{PkChatbotEmptyState-Jxc1HNJ5.js → PkChatbotEmptyState-B9dYpXZm.js} +2 -2
  38. package/dist-vue/_chunks/{PkChatbotEmptyState-Jxc1HNJ5.js.map → PkChatbotEmptyState-B9dYpXZm.js.map} +1 -1
  39. package/dist-vue/_chunks/{PkChatbotFilePreview-BDU2vY0F.js → PkChatbotFilePreview-5_bih_vc.js} +2 -2
  40. package/dist-vue/_chunks/{PkChatbotFilePreview-BDU2vY0F.js.map → PkChatbotFilePreview-5_bih_vc.js.map} +1 -1
  41. package/dist-vue/_chunks/{PkChatbotInput-DSdGtBTs.js → PkChatbotInput-BLKhf3WD.js} +3 -3
  42. package/dist-vue/_chunks/{PkChatbotInput-DSdGtBTs.js.map → PkChatbotInput-BLKhf3WD.js.map} +1 -1
  43. package/dist-vue/_chunks/{PkChatbotMessages-C7WSS6sd.js → PkChatbotMessages-Dx_IIX0J.js} +17 -17
  44. package/dist-vue/_chunks/{PkChatbotMessages-C7WSS6sd.js.map → PkChatbotMessages-Dx_IIX0J.js.map} +1 -1
  45. package/dist-vue/_chunks/{PkChatbotSteps-BMWrHfC9.js → PkChatbotSteps-BAQ1LriG.js} +2 -2
  46. package/dist-vue/_chunks/{PkChatbotSteps-BMWrHfC9.js.map → PkChatbotSteps-BAQ1LriG.js.map} +1 -1
  47. package/dist-vue/_chunks/PkChatbotViewChat-1RqLcPl4.js +1336 -0
  48. package/dist-vue/_chunks/PkChatbotViewChat-1RqLcPl4.js.map +1 -0
  49. package/dist-vue/_chunks/{PkChatbotViewConversations-BbCnRdv4.js → PkChatbotViewConversations-D0vDYTyo.js} +2 -2
  50. package/dist-vue/_chunks/{PkChatbotViewConversations-BbCnRdv4.js.map → PkChatbotViewConversations-D0vDYTyo.js.map} +1 -1
  51. package/dist-vue/_chunks/{PkChatbotViewFiles-gwoZqmza.js → PkChatbotViewFiles-Bj5Nkzst.js} +2 -2
  52. package/dist-vue/_chunks/{PkChatbotViewFiles-gwoZqmza.js.map → PkChatbotViewFiles-Bj5Nkzst.js.map} +1 -1
  53. package/dist-vue/_chunks/{PkChatbotViewProfile-B7DroVld.js → PkChatbotViewProfile-GW0WuMOy.js} +2 -2
  54. package/dist-vue/_chunks/{PkChatbotViewProfile-B7DroVld.js.map → PkChatbotViewProfile-GW0WuMOy.js.map} +1 -1
  55. package/dist-vue/_chunks/{PkFilePreview-N0kWPuFh.js → PkFilePreview-Dkm34tMI.js} +2 -2
  56. package/dist-vue/_chunks/{PkFilePreview-N0kWPuFh.js.map → PkFilePreview-Dkm34tMI.js.map} +1 -1
  57. package/dist-vue/_chunks/{PkFilePreviewDialog-DqBESOIS.js → PkFilePreviewDialog-CZg7uqHL.js} +2 -2
  58. package/dist-vue/_chunks/{PkFilePreviewDialog-DqBESOIS.js.map → PkFilePreviewDialog-CZg7uqHL.js.map} +1 -1
  59. package/dist-vue/_chunks/{PkStreamingMarkdown-BFBv_HdF.js → PkStreamingMarkdown-D6Qxwf47.js} +2 -2
  60. package/dist-vue/_chunks/{PkStreamingMarkdown-BFBv_HdF.js.map → PkStreamingMarkdown-D6Qxwf47.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkSvgViewer-CRNwb6Yn.js → PkSvgViewer-jCi13HSd.js} +2 -2
  62. package/dist-vue/_chunks/{PkSvgViewer-CRNwb6Yn.js.map → PkSvgViewer-jCi13HSd.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkToolChatFile-BntAINfN.js → PkToolChatFile-uO6r1l6t.js} +2 -2
  64. package/dist-vue/_chunks/{PkToolChatFile-BntAINfN.js.map → PkToolChatFile-uO6r1l6t.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkToolShareDocument-Bf7OE8XA.js → PkToolShareDocument-B7mMJJfn.js} +2 -2
  66. package/dist-vue/_chunks/{PkToolShareDocument-Bf7OE8XA.js.map → PkToolShareDocument-B7mMJJfn.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkToolShowArtifact-PTyAPKlR.js → PkToolShowArtifact-VOfSN9nc.js} +2 -2
  68. package/dist-vue/_chunks/{PkToolShowArtifact-PTyAPKlR.js.map → PkToolShowArtifact-VOfSN9nc.js.map} +1 -1
  69. package/dist-vue/_chunks/{PkToolShowContactForm-CGIA743D.js → PkToolShowContactForm-D9J0B3C-.js} +2 -2
  70. package/dist-vue/_chunks/{PkToolShowContactForm-CGIA743D.js.map → PkToolShowContactForm-D9J0B3C-.js.map} +1 -1
  71. package/dist-vue/_chunks/{PkToolShowDiagram-CppjE7Vr.js → PkToolShowDiagram-BlV7ktLW.js} +2 -2
  72. package/dist-vue/_chunks/{PkToolShowDiagram-CppjE7Vr.js.map → PkToolShowDiagram-BlV7ktLW.js.map} +1 -1
  73. package/dist-vue/_chunks/{PkToolShowForm-DLlcs1c4.js → PkToolShowForm-BCvqIlt_.js} +2 -2
  74. package/dist-vue/_chunks/{PkToolShowForm-DLlcs1c4.js.map → PkToolShowForm-BCvqIlt_.js.map} +1 -1
  75. package/dist-vue/_chunks/{PkToolShowImageGallery-KP_ptp0w.js → PkToolShowImageGallery-D2DrAB9v.js} +3 -3
  76. package/dist-vue/_chunks/{PkToolShowImageGallery-KP_ptp0w.js.map → PkToolShowImageGallery-D2DrAB9v.js.map} +1 -1
  77. package/dist-vue/_chunks/{PkToolShowLocation-Nhh_LwmN.js → PkToolShowLocation-BhVcLnkV.js} +2 -2
  78. package/dist-vue/_chunks/{PkToolShowLocation-Nhh_LwmN.js.map → PkToolShowLocation-BhVcLnkV.js.map} +1 -1
  79. package/dist-vue/_chunks/{PkToolShowProductList-CbI-ncWs.js → PkToolShowProductList--MBQ_ztM.js} +2 -2
  80. package/dist-vue/_chunks/{PkToolShowProductList-CbI-ncWs.js.map → PkToolShowProductList--MBQ_ztM.js.map} +1 -1
  81. package/dist-vue/_chunks/{PkToolShowSources-E02Gy3vC.js → PkToolShowSources-D_KfNZ_Q.js} +2 -2
  82. package/dist-vue/_chunks/{PkToolShowSources-E02Gy3vC.js.map → PkToolShowSources-D_KfNZ_Q.js.map} +1 -1
  83. package/dist-vue/_chunks/{PkToolShowVideo-DBqMV0U7.js → PkToolShowVideo-CS6iDwjn.js} +2 -2
  84. package/dist-vue/_chunks/{PkToolShowVideo-DBqMV0U7.js.map → PkToolShowVideo-CS6iDwjn.js.map} +1 -1
  85. package/dist-vue/_chunks/{PkToolShowWebPages-2023cqa1.js → PkToolShowWebPages-y3sajjCP.js} +2 -2
  86. package/dist-vue/_chunks/{PkToolShowWebPages-2023cqa1.js.map → PkToolShowWebPages-y3sajjCP.js.map} +1 -1
  87. package/dist-vue/_chunks/{createChatbotApiClient-BACnmIzY.js → createChatbotApiClient-Pb7_cU2s.js} +105 -75
  88. package/dist-vue/_chunks/createChatbotApiClient-Pb7_cU2s.js.map +1 -0
  89. package/dist-vue/_chunks/{useChatbotStore-B-WenuyB.js → useChatbotStore-ChrZVIDt.js} +1172 -1141
  90. package/dist-vue/_chunks/useChatbotStore-ChrZVIDt.js.map +1 -0
  91. package/dist-vue/_chunks/{useLightbox-DmtNa8bJ.js → useLightbox-BZN3tRGu.js} +100 -95
  92. package/dist-vue/_chunks/useLightbox-BZN3tRGu.js.map +1 -0
  93. package/dist-vue/api.js +1 -1
  94. package/dist-vue/composables.js +76 -2
  95. package/dist-vue/composables.js.map +1 -1
  96. package/dist-vue/index.js +4304 -3590
  97. package/dist-vue/index.js.map +1 -1
  98. package/dist-vue/locales.js +78 -2
  99. package/dist-vue/packages/components/src/PkSchemaField.d.ts +2 -2
  100. package/dist-vue/packages/components/src/chat/PkChatProjectDialog.d.ts +50 -0
  101. package/dist-vue/packages/components/src/chat/PkChatProjectMoveDialog.d.ts +23 -0
  102. package/dist-vue/packages/components/src/chat/PkChatSidebar.d.ts +5 -2
  103. package/dist-vue/packages/components/src/chat/PkChatSidebarConversationItem.d.ts +12 -0
  104. package/dist-vue/packages/components/src/chat/PkChatbot.d.ts +9 -3
  105. package/dist-vue/packages/components/src/chat/PkChatbotFeedbackForm.d.ts +2 -2
  106. package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +20 -1
  107. package/dist-vue/packages/composable/src/chatbot/index.d.ts +1 -0
  108. package/dist-vue/packages/composable/src/chatbot/useChatProjectsStore.d.ts +4005 -0
  109. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +36 -6
  110. package/dist-vue/packages/models/src/schema/ChatProject.d.ts +10 -0
  111. package/dist-vue/style.css +1 -1
  112. package/package.json +1 -1
  113. package/dist/_chunks/useLightbox-BlHExsUm.js.map +0 -1
  114. package/dist-vue/_chunks/PkChatbotViewChat-2J6g9Etg.js +0 -1307
  115. package/dist-vue/_chunks/PkChatbotViewChat-2J6g9Etg.js.map +0 -1
  116. package/dist-vue/_chunks/createChatbotApiClient-BACnmIzY.js.map +0 -1
  117. package/dist-vue/_chunks/useChatbotStore-B-WenuyB.js.map +0 -1
  118. package/dist-vue/_chunks/useLightbox-DmtNa8bJ.js.map +0 -1
@@ -1,15 +1,15 @@
1
1
  import { $ as e, A as t, B as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, P as m, Q as h, R as g, S as _, T as v, U as y, W as b, X as ee, Y as te, Z as ne, _t as re, a as ie, at as ae, b as oe, bt as x, ct as se, dt as ce, et as le, g as ue, gt as de, h as fe, ht as pe, i as me, it as he, k as ge, l as _e, lt as ve, m as ye, mt as S, nt as C, o as be, ot as xe, p as w, q as Se, rt as Ce, s as we, st as Te, tt as Ee, u as De, ut as Oe, vt as ke, x as Ae, xt as je, y as Me, yt as Ne, z as Pe } from "./schemas-CwcNxjnD.js";
2
2
  import { n as Fe, t as Ie } from "./useSafeLocalStorage-Bn4SsL8C.js";
3
- import { Q as Le, V as Re, Z as ze, at as Be, et as Ve, nt as He, ot as Ue, st as We } from "./Agent-CRwhrv5Z.js";
4
- import { r as Ge, t as Ke } from "./createChatbotApiClient-BACnmIzY.js";
5
- import { d as qe, r as Je } from "./message-DuibQyHy.js";
6
- import { n as Ye } from "./src-nb8MU1sh.js";
7
- import { computed as T, getCurrentScope as E, isReadonly as Xe, nextTick as Ze, onScopeDispose as Qe, reactive as $e, ref as D, shallowRef as O, toRefs as et, toValue as tt, watch as k, watchEffect as nt } from "vue";
8
- import { useI18n as rt } from "vue-i18n";
9
- import { useDocumentVisibility as it, usePreferredDark as at } from "@vueuse/core";
3
+ import { i as Le, r as Re, t as ze } from "./createChatbotApiClient-Pb7_cU2s.js";
4
+ import { Q as Be, V as Ve, Z as He, at as Ue, et as We, nt as Ge, ot as Ke, st as qe } from "./Agent-CRwhrv5Z.js";
5
+ import { d as Je, r as Ye } from "./message-DuibQyHy.js";
6
+ import { n as Xe } from "./src-nb8MU1sh.js";
7
+ import { computed as T, getCurrentScope as E, isReadonly as Ze, nextTick as Qe, onScopeDispose as $e, reactive as et, ref as D, shallowRef as O, toRefs as tt, toValue as nt, watch as k, watchEffect as rt } from "vue";
8
+ import { useI18n as it } from "vue-i18n";
9
+ import { useDocumentVisibility as at, usePreferredDark as ot } from "@vueuse/core";
10
10
  import { defineStore as A } from "pinia";
11
11
  // ../../packages/utils/src/device-context.ts
12
- function ot() {
12
+ function st() {
13
13
  let e = navigator.connection, t = navigator.userAgentData;
14
14
  return {
15
15
  dateTime: (/* @__PURE__ */ new Date()).toISOString(),
@@ -39,7 +39,7 @@ function ot() {
39
39
  historyLength: window.history.length
40
40
  };
41
41
  }
42
- async function st(e) {
42
+ async function ct(e) {
43
43
  if (!navigator.geolocation || !navigator.permissions) return null;
44
44
  try {
45
45
  if ((await navigator.permissions.query({ name: "geolocation" })).state !== "granted") return null;
@@ -57,16 +57,16 @@ async function st(e) {
57
57
  }
58
58
  }
59
59
  // ../../packages/composable/src/chatbot/hostTools.ts
60
- var ct = "agentstudio:page-navigation", lt = (e) => typeof e?.afterOutput == "function", ut = (e) => e.toolMetadata?.source === Be, dt = (e, t) => {
60
+ var lt = "agentstudio:page-navigation", ut = (e) => typeof e?.afterOutput == "function", dt = (e) => e.toolMetadata?.source === Ue, ft = (e, t) => {
61
61
  if (!t || !e?.length) return;
62
- let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !Ve(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
62
+ let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !We(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
63
63
  return r.length > 0 ? r : void 0;
64
64
  };
65
- function ft(e) {
65
+ function pt(e) {
66
66
  let t = 0, n = 0, r = (t) => {
67
67
  n = t, e.onPendingChange?.(n);
68
68
  }, i = Promise.resolve(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (e) => {
69
- lt(e) && e.abandon?.();
69
+ ut(e) && e.abandon?.();
70
70
  }, c = (e, t) => t.requireConfirmation.includes(e.name) || t.confirmDestructive && e.annotations?.destructiveHint === !0, l = (t, n) => e.addToolOutput({
71
71
  tool: t.toolName,
72
72
  toolCallId: t.toolCallId,
@@ -80,7 +80,7 @@ function ft(e) {
80
80
  async function d(n, r) {
81
81
  let i = () => r === t, d = e.capability(), f = e.registry()?.find((e) => e.name === n.toolName), p = f?.policy?.timeoutMs ?? d?.timeoutMs;
82
82
  if (!f || p === void 0) {
83
- u(n, Ue(n.readOnly));
83
+ u(n, Ke(n.readOnly));
84
84
  return;
85
85
  }
86
86
  let m;
@@ -118,7 +118,7 @@ function ft(e) {
118
118
  s(r);
119
119
  return;
120
120
  }
121
- if (lt(r)) {
121
+ if (ut(r)) {
122
122
  l(n, r.result ?? null);
123
123
  let t = !1, a = () => {
124
124
  t || (t = !0, o.delete(a), r.abandon?.());
@@ -130,7 +130,7 @@ function ft(e) {
130
130
  } catch (e) {
131
131
  if (b?.then(s, () => void 0), !i()) return;
132
132
  let t = v.signal.aborted;
133
- u(n, t ? Ue(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
133
+ u(n, t ? Ke(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
134
134
  } finally {
135
135
  clearTimeout(y), a.delete(n.toolCallId), e.onActivity?.(void 0);
136
136
  }
@@ -151,65 +151,65 @@ function ft(e) {
151
151
  };
152
152
  }
153
153
  // ../../node_modules/.pnpm/@ai-sdk+provider@4.0.38/node_modules/@ai-sdk/provider/dist/index.js
154
- var pt = "vercel.ai.error", mt = Symbol.for(pt), j = class e extends Error {
154
+ var mt = "vercel.ai.error", ht = Symbol.for(mt), j = class e extends Error {
155
155
  constructor({ name: e, message: t, cause: n }) {
156
- super(t), this[mt] = !0, this.name = e, this.cause = n;
156
+ super(t), this[ht] = !0, this.name = e, this.cause = n;
157
157
  }
158
158
  static isInstance(t) {
159
- return e.hasMarker(t, pt);
159
+ return e.hasMarker(t, mt);
160
160
  }
161
161
  static hasMarker(e, t) {
162
162
  let n = Symbol.for(t);
163
163
  return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
164
164
  }
165
- }, ht = "AI_APICallError", gt = `vercel.ai.error.${ht}`, _t = Symbol.for(gt), vt = class extends j {
165
+ }, gt = "AI_APICallError", _t = `vercel.ai.error.${gt}`, vt = Symbol.for(_t), yt = class extends j {
166
166
  constructor({ message: e, url: t, requestBodyValues: n, statusCode: r, responseHeaders: i, responseBody: a, cause: o, isRetryable: s = r != null && (r === 408 || r === 409 || r === 429 || r >= 500), data: c }) {
167
167
  super({
168
- name: ht,
168
+ name: gt,
169
169
  message: e,
170
170
  cause: o
171
- }), this[_t] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
171
+ }), this[vt] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
172
172
  }
173
173
  static isInstance(e) {
174
- return j.hasMarker(e, gt);
174
+ return j.hasMarker(e, _t);
175
175
  }
176
- }, yt = "AI_EmptyResponseBodyError", bt = `vercel.ai.error.${yt}`, xt = Symbol.for(bt), St = class extends j {
176
+ }, bt = "AI_EmptyResponseBodyError", xt = `vercel.ai.error.${bt}`, St = Symbol.for(xt), Ct = class extends j {
177
177
  constructor({ message: e = "Empty response body" } = {}) {
178
178
  super({
179
- name: yt,
179
+ name: bt,
180
180
  message: e
181
- }), this[xt] = !0;
181
+ }), this[St] = !0;
182
182
  }
183
183
  static isInstance(e) {
184
- return j.hasMarker(e, bt);
184
+ return j.hasMarker(e, xt);
185
185
  }
186
186
  };
187
- function Ct(e) {
187
+ function wt(e) {
188
188
  return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
189
189
  }
190
- var wt = "AI_InvalidArgumentError", Tt = `vercel.ai.error.${wt}`, Et = Symbol.for(Tt), Dt = class extends j {
190
+ var Tt = "AI_InvalidArgumentError", Et = `vercel.ai.error.${Tt}`, Dt = Symbol.for(Et), Ot = class extends j {
191
191
  constructor({ message: e, cause: t, argument: n }) {
192
192
  super({
193
- name: wt,
193
+ name: Tt,
194
194
  message: e,
195
195
  cause: t
196
- }), this[Et] = !0, this.argument = n;
196
+ }), this[Dt] = !0, this.argument = n;
197
197
  }
198
198
  static isInstance(e) {
199
- return j.hasMarker(e, Tt);
199
+ return j.hasMarker(e, Et);
200
200
  }
201
- }, M = "AI_JSONParseError", Ot = `vercel.ai.error.${M}`, kt = Symbol.for(Ot), At = class extends j {
201
+ }, M = "AI_JSONParseError", kt = `vercel.ai.error.${M}`, At = Symbol.for(kt), jt = class extends j {
202
202
  constructor({ text: e, cause: t }) {
203
203
  super({
204
204
  name: M,
205
- message: `JSON parsing failed: Text: ${e}.\nError message: ${Ct(t)}`,
205
+ message: `JSON parsing failed: Text: ${e}.\nError message: ${wt(t)}`,
206
206
  cause: t
207
- }), this[kt] = !0, this.text = e;
207
+ }), this[At] = !0, this.text = e;
208
208
  }
209
209
  static isInstance(e) {
210
- return j.hasMarker(e, Ot);
210
+ return j.hasMarker(e, kt);
211
211
  }
212
- }, N = "AI_TypeValidationError", P = `vercel.ai.error.${N}`, F = Symbol.for(P), jt = class e extends j {
212
+ }, N = "AI_TypeValidationError", P = `vercel.ai.error.${N}`, Mt = Symbol.for(P), Nt = class e extends j {
213
213
  constructor({ value: e, cause: t, context: n }) {
214
214
  let r = "Type validation failed";
215
215
  if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
@@ -219,9 +219,9 @@ var wt = "AI_InvalidArgumentError", Tt = `vercel.ai.error.${wt}`, Et = Symbol.fo
219
219
  }
220
220
  super({
221
221
  name: N,
222
- message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${Ct(t)}`,
222
+ message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${wt(t)}`,
223
223
  cause: t
224
- }), this[F] = !0, this.value = e, this.context = n;
224
+ }), this[Mt] = !0, this.value = e, this.context = n;
225
225
  }
226
226
  static isInstance(e) {
227
227
  return j.hasMarker(e, P);
@@ -233,25 +233,25 @@ var wt = "AI_InvalidArgumentError", Tt = `vercel.ai.error.${wt}`, Et = Symbol.fo
233
233
  context: r
234
234
  });
235
235
  }
236
- }, Mt = "AI_UnsupportedFunctionalityError", Nt = `vercel.ai.error.${Mt}`, Pt = Symbol.for(Nt), Ft = class extends j {
236
+ }, Pt = "AI_UnsupportedFunctionalityError", Ft = `vercel.ai.error.${Pt}`, It = Symbol.for(Ft), Lt = class extends j {
237
237
  constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
238
238
  super({
239
- name: Mt,
239
+ name: Pt,
240
240
  message: t
241
- }), this[Pt] = !0, this.functionality = e;
241
+ }), this[It] = !0, this.functionality = e;
242
242
  }
243
243
  static isInstance(e) {
244
- return j.hasMarker(e, Nt);
244
+ return j.hasMarker(e, Ft);
245
245
  }
246
- }, It = class extends Error {
246
+ }, Rt = class extends Error {
247
247
  constructor(e, t) {
248
248
  super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
249
249
  }
250
- }, I = 10, Lt = 13, Rt = 32;
251
- function zt(e) {}
252
- function Bt(e) {
250
+ }, F = 10, zt = 13, Bt = 32;
251
+ function Vt(e) {}
252
+ function Ht(e) {
253
253
  if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
254
- let { onEvent: t = zt, onError: n = zt, onRetry: r = zt, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
254
+ let { onEvent: t = Vt, onError: n = Vt, onRetry: r = Vt, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
255
255
  function m(e) {
256
256
  if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
257
257
  if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
@@ -270,7 +270,7 @@ function Bt(e) {
270
270
  n !== "" && (o.push(n), s = n.length), h();
271
271
  }
272
272
  function h() {
273
- a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new It(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
273
+ a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new Rt(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
274
274
  }
275
275
  function g(e) {
276
276
  let n = 0;
@@ -286,9 +286,9 @@ function Bt(e) {
286
286
  continue;
287
287
  }
288
288
  let i = e.charCodeAt(n);
289
- if (Vt(e, n, i)) {
290
- let i = e.charCodeAt(n + 5) === Rt ? n + 6 : n + 5, a = e.slice(i, r);
291
- if (d === 0 && e.charCodeAt(r + 1) === I) {
289
+ if (Ut(e, n, i)) {
290
+ let i = e.charCodeAt(n + 5) === Bt ? n + 6 : n + 5, a = e.slice(i, r);
291
+ if (d === 0 && e.charCodeAt(r + 1) === F) {
292
292
  t({
293
293
  id: l,
294
294
  event: f,
@@ -298,7 +298,7 @@ function Bt(e) {
298
298
  }
299
299
  u = d === 0 ? a : `${u}
300
300
  ${a}`, d++;
301
- } else Ht(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === Rt ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
301
+ } else Wt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === Bt ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
302
302
  n = r + 1, r = e.indexOf("\n", n);
303
303
  }
304
304
  return e.slice(n);
@@ -306,7 +306,7 @@ ${a}`, d++;
306
306
  for (; n < e.length;) {
307
307
  let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
308
308
  if (t !== -1 && r !== -1 ? i = t < r ? t : r : t === -1 ? r !== -1 && (i = r) : i = t === e.length - 1 ? -1 : t, i === -1) break;
309
- _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === Lt && e.charCodeAt(n) === I && n++;
309
+ _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === zt && e.charCodeAt(n) === F && n++;
310
310
  }
311
311
  return e.slice(n);
312
312
  }
@@ -316,25 +316,25 @@ ${a}`, d++;
316
316
  return;
317
317
  }
318
318
  let r = e.charCodeAt(t);
319
- if (Vt(e, t, r)) {
320
- let r = e.charCodeAt(t + 5) === Rt ? t + 6 : t + 5, i = e.slice(r, n);
319
+ if (Ut(e, t, r)) {
320
+ let r = e.charCodeAt(t + 5) === Bt ? t + 6 : t + 5, i = e.slice(r, n);
321
321
  u = d === 0 ? i : `${u}
322
322
  ${i}`, d++;
323
323
  return;
324
324
  }
325
- if (Ht(e, t, r)) {
326
- f = e.slice(e.charCodeAt(t + 6) === Rt ? t + 7 : t + 6, n) || void 0;
325
+ if (Wt(e, t, r)) {
326
+ f = e.slice(e.charCodeAt(t + 6) === Bt ? t + 7 : t + 6, n) || void 0;
327
327
  return;
328
328
  }
329
329
  if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
330
- let r = e.slice(e.charCodeAt(t + 3) === Rt ? t + 4 : t + 3, n);
330
+ let r = e.slice(e.charCodeAt(t + 3) === Bt ? t + 4 : t + 3, n);
331
331
  l = r.includes("\0") ? void 0 : r;
332
332
  return;
333
333
  }
334
334
  if (r === 58) {
335
335
  if (i) {
336
336
  let r = e.slice(t, n);
337
- i(r.slice(e.charCodeAt(t + 1) === Rt ? 2 : 1));
337
+ i(r.slice(e.charCodeAt(t + 1) === Bt ? 2 : 1));
338
338
  }
339
339
  return;
340
340
  }
@@ -343,7 +343,7 @@ ${i}`, d++;
343
343
  v(a, "", a);
344
344
  return;
345
345
  }
346
- let s = a.slice(0, o), c = a.charCodeAt(o + 1) === Rt ? 2 : 1;
346
+ let s = a.slice(0, o), c = a.charCodeAt(o + 1) === Bt ? 2 : 1;
347
347
  v(s, a.slice(o + c), a);
348
348
  }
349
349
  function v(e, t, i) {
@@ -359,13 +359,13 @@ ${t}`, d++;
359
359
  l = t.includes("\0") ? void 0 : t;
360
360
  break;
361
361
  case "retry":
362
- /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new It(`Invalid \`retry\` value: "${t}"`, {
362
+ /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Rt(`Invalid \`retry\` value: "${t}"`, {
363
363
  type: "invalid-retry",
364
364
  value: t,
365
365
  line: i
366
366
  }));
367
367
  break;
368
- default: n(new It(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
368
+ default: n(new Rt(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
369
369
  type: "unknown-field",
370
370
  field: e,
371
371
  value: t,
@@ -392,19 +392,19 @@ ${t}`, d++;
392
392
  reset: b
393
393
  };
394
394
  }
395
- function Vt(e, t, n) {
395
+ function Ut(e, t, n) {
396
396
  return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
397
397
  }
398
- function Ht(e, t, n) {
398
+ function Wt(e, t, n) {
399
399
  return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
400
400
  }
401
401
  // ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
402
- var L = class extends TransformStream {
402
+ var Gt = class extends TransformStream {
403
403
  constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
404
404
  let i;
405
405
  super({
406
406
  start(a) {
407
- i = Bt({
407
+ i = Ht({
408
408
  onEvent: (e) => {
409
409
  a.enqueue(e);
410
410
  },
@@ -423,19 +423,19 @@ var L = class extends TransformStream {
423
423
  }
424
424
  };
425
425
  new TextDecoder();
426
- var { btoa: Ut, atob: Wt } = globalThis, Gt = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get, Kt = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
427
- function qt(e) {
428
- return ArrayBuffer.isView(e) && Gt.call(e) === "Uint8Array";
426
+ var { btoa: Kt, atob: qt } = globalThis, Jt = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get, Yt = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
427
+ function Xt(e) {
428
+ return ArrayBuffer.isView(e) && Jt.call(e) === "Uint8Array";
429
429
  }
430
- function Jt(e) {
430
+ function I(e) {
431
431
  if (typeof e != "object" || !e || !("byteLength" in e)) return !1;
432
432
  try {
433
- return Kt.call(e), !0;
433
+ return Yt.call(e), !0;
434
434
  } catch {
435
435
  return !1;
436
436
  }
437
437
  }
438
- function Yt(e) {
438
+ function Zt(e) {
439
439
  if (e == null) return {};
440
440
  let t = {};
441
441
  if (e instanceof Headers) e.forEach((e, n) => {
@@ -447,28 +447,28 @@ function Yt(e) {
447
447
  }
448
448
  return t;
449
449
  }
450
- var R = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
450
+ var L = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
451
451
  let i = () => {
452
452
  let e = n.length, r = Array(t);
453
453
  for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
454
454
  return r.join("");
455
455
  };
456
456
  if (e == null) return i;
457
- if (n.includes(r)) throw new Dt({
457
+ if (n.includes(r)) throw new Ot({
458
458
  argument: "separator",
459
459
  message: `The separator "${r}" must not be part of the alphabet "${n}".`
460
460
  });
461
461
  return () => `${e}${r}${i()}`;
462
- }, Xt = R();
463
- function Zt(e) {
462
+ }, Qt = L();
463
+ function R(e) {
464
464
  return globalThis.Buffer?.isBuffer(e) ?? !1;
465
465
  }
466
- var Qt = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, $t = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
467
- function en(e) {
466
+ var $t = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, en = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
467
+ function tn(e) {
468
468
  let t = JSON.parse(e);
469
- return typeof t != "object" || !t || Qt.test(e) === !1 && $t.test(e) === !1 ? t : tn(t);
469
+ return typeof t != "object" || !t || $t.test(e) === !1 && en.test(e) === !1 ? t : nn(t);
470
470
  }
471
- function tn(e) {
471
+ function nn(e) {
472
472
  let t = [e];
473
473
  for (; t.length;) {
474
474
  let e = t;
@@ -483,35 +483,35 @@ function tn(e) {
483
483
  }
484
484
  return e;
485
485
  }
486
- function nn(e) {
486
+ function rn(e) {
487
487
  let { stackTraceLimit: t } = Error;
488
488
  try {
489
489
  Error.stackTraceLimit = 0;
490
490
  } catch {
491
- return en(e);
491
+ return tn(e);
492
492
  }
493
493
  try {
494
- return en(e);
494
+ return tn(e);
495
495
  } finally {
496
496
  Error.stackTraceLimit = t;
497
497
  }
498
498
  }
499
- function rn(e) {
499
+ function z(e) {
500
500
  if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
501
501
  let { additionalProperties: t } = e;
502
- e.additionalProperties = t != null && typeof t != "boolean" && z(t);
502
+ e.additionalProperties = t != null && typeof t != "boolean" && B(t);
503
503
  let { properties: n } = e;
504
- if (n != null) for (let e of Object.keys(n)) n[e] = z(n[e]);
504
+ if (n != null) for (let e of Object.keys(n)) n[e] = B(n[e]);
505
505
  }
506
- e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(z) : z(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(z)), e.allOf != null && (e.allOf = e.allOf.map(z)), e.oneOf != null && (e.oneOf = e.oneOf.map(z));
506
+ e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(B) : B(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(B)), e.allOf != null && (e.allOf = e.allOf.map(B)), e.oneOf != null && (e.oneOf = e.oneOf.map(B));
507
507
  let { definitions: t } = e;
508
- if (t != null) for (let e of Object.keys(t)) t[e] = z(t[e]);
508
+ if (t != null) for (let e of Object.keys(t)) t[e] = B(t[e]);
509
509
  return e;
510
510
  }
511
- function z(e) {
512
- return typeof e == "boolean" ? e : rn(e);
511
+ function B(e) {
512
+ return typeof e == "boolean" ? e : z(e);
513
513
  }
514
- var an = Symbol("Let zodToJsonSchema decide on which parser to use"), B = {
514
+ var an = Symbol("Let zodToJsonSchema decide on which parser to use"), on = {
515
515
  name: void 0,
516
516
  $refStrategy: "root",
517
517
  basePath: ["#"],
@@ -531,24 +531,24 @@ var an = Symbol("Let zodToJsonSchema decide on which parser to use"), B = {
531
531
  emailStrategy: "format:email",
532
532
  base64Strategy: "contentEncoding:base64",
533
533
  nameStrategy: "ref"
534
- }, V = (e) => typeof e == "string" ? {
535
- ...B,
534
+ }, sn = (e) => typeof e == "string" ? {
535
+ ...on,
536
536
  name: e
537
537
  } : {
538
- ...B,
538
+ ...on,
539
539
  ...e
540
540
  };
541
- function H() {
541
+ function V() {
542
542
  return {};
543
543
  }
544
- function on(e, t) {
544
+ function cn(e, t) {
545
545
  let n = { type: "array" };
546
- return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = q(e.type._def, {
546
+ return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = J(e.type._def, {
547
547
  ...t,
548
548
  currentPath: [...t.currentPath, "items"]
549
549
  })), e.minLength && (n.minItems = e.minLength.value), e.maxLength && (n.maxItems = e.maxLength.value), e.exactLength && (n.minItems = e.exactLength.value, n.maxItems = e.exactLength.value), n;
550
550
  }
551
- function sn(e) {
551
+ function ln(e) {
552
552
  let t = {
553
553
  type: "integer",
554
554
  format: "int64"
@@ -565,16 +565,16 @@ function sn(e) {
565
565
  }
566
566
  return t;
567
567
  }
568
- function cn() {
568
+ function un() {
569
569
  return { type: "boolean" };
570
570
  }
571
- function ln(e, t) {
572
- return q(e.type._def, t);
571
+ function dn(e, t) {
572
+ return J(e.type._def, t);
573
573
  }
574
- var un = (e, t) => q(e.innerType._def, t);
575
- function dn(e, t, n) {
574
+ var fn = (e, t) => J(e.innerType._def, t);
575
+ function pn(e, t, n) {
576
576
  let r = n ?? t.dateStrategy;
577
- if (Array.isArray(r)) return { anyOf: r.map((n) => dn(e, t, n)) };
577
+ if (Array.isArray(r)) return { anyOf: r.map((n) => pn(e, t, n)) };
578
578
  switch (r) {
579
579
  case "string":
580
580
  case "format:date-time": return {
@@ -585,10 +585,10 @@ function dn(e, t, n) {
585
585
  type: "string",
586
586
  format: "date"
587
587
  };
588
- case "integer": return fn(e);
588
+ case "integer": return H(e);
589
589
  }
590
590
  }
591
- var fn = (e) => {
591
+ var H = (e) => {
592
592
  let t = {
593
593
  type: "integer",
594
594
  format: "unix-time"
@@ -601,31 +601,31 @@ var fn = (e) => {
601
601
  }
602
602
  return t;
603
603
  };
604
- function pn(e, t) {
604
+ function U(e, t) {
605
605
  return {
606
- ...q(e.innerType._def, t),
606
+ ...J(e.innerType._def, t),
607
607
  default: e.defaultValue()
608
608
  };
609
609
  }
610
- function mn(e, t) {
611
- return t.effectStrategy === "input" ? q(e.schema._def, t) : H();
610
+ function W(e, t) {
611
+ return t.effectStrategy === "input" ? J(e.schema._def, t) : V();
612
612
  }
613
- function hn(e) {
613
+ function mn(e) {
614
614
  return {
615
615
  type: "string",
616
616
  enum: Array.from(e.values)
617
617
  };
618
618
  }
619
- var gn = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
620
- function _n(e, t) {
621
- let n = [q(e.left._def, {
619
+ var hn = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
620
+ function gn(e, t) {
621
+ let n = [J(e.left._def, {
622
622
  ...t,
623
623
  currentPath: [
624
624
  ...t.currentPath,
625
625
  "allOf",
626
626
  "0"
627
627
  ]
628
- }), q(e.right._def, {
628
+ }), J(e.right._def, {
629
629
  ...t,
630
630
  currentPath: [
631
631
  ...t.currentPath,
@@ -634,7 +634,7 @@ function _n(e, t) {
634
634
  ]
635
635
  })].filter((e) => !!e), r = [];
636
636
  return n.forEach((e) => {
637
- if (gn(e)) r.push(...e.allOf);
637
+ if (hn(e)) r.push(...e.allOf);
638
638
  else {
639
639
  let t = e;
640
640
  if ("additionalProperties" in e && e.additionalProperties === !1) {
@@ -645,19 +645,19 @@ function _n(e, t) {
645
645
  }
646
646
  }), r.length ? { allOf: r } : void 0;
647
647
  }
648
- function vn(e) {
648
+ function _n(e) {
649
649
  let t = typeof e.value;
650
650
  return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
651
651
  type: t === "bigint" ? "integer" : t,
652
652
  const: e.value
653
653
  };
654
654
  }
655
- var yn = void 0, U = {
655
+ var vn = void 0, G = {
656
656
  cuid: /^[cC][^\s-]{8,}$/,
657
657
  cuid2: /^[0-9a-z]+$/,
658
658
  ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
659
659
  email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
660
- emoji: () => (yn === void 0 && (yn = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), yn),
660
+ emoji: () => (vn === void 0 && (vn = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), vn),
661
661
  uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
662
662
  ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
663
663
  ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
@@ -668,7 +668,7 @@ var yn = void 0, U = {
668
668
  nanoid: /^[a-zA-Z0-9_-]{21}$/,
669
669
  jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
670
670
  };
671
- function bn(e, t) {
671
+ function yn(e, t) {
672
672
  let n = { type: "string" };
673
673
  if (e.checks) for (let r of e.checks) switch (r.kind) {
674
674
  case "min":
@@ -680,108 +680,108 @@ function bn(e, t) {
680
680
  case "email":
681
681
  switch (t.emailStrategy) {
682
682
  case "format:email":
683
- W(n, "email", r.message, t);
683
+ K(n, "email", r.message, t);
684
684
  break;
685
685
  case "format:idn-email":
686
- W(n, "idn-email", r.message, t);
686
+ K(n, "idn-email", r.message, t);
687
687
  break;
688
- case "pattern:zod": G(n, U.email, r.message, t);
688
+ case "pattern:zod": q(n, G.email, r.message, t);
689
689
  }
690
690
  break;
691
691
  case "url":
692
- W(n, "uri", r.message, t);
692
+ K(n, "uri", r.message, t);
693
693
  break;
694
694
  case "uuid":
695
- W(n, "uuid", r.message, t);
695
+ K(n, "uuid", r.message, t);
696
696
  break;
697
697
  case "regex":
698
- G(n, r.regex, r.message, t);
698
+ q(n, r.regex, r.message, t);
699
699
  break;
700
700
  case "cuid":
701
- G(n, U.cuid, r.message, t);
701
+ q(n, G.cuid, r.message, t);
702
702
  break;
703
703
  case "cuid2":
704
- G(n, U.cuid2, r.message, t);
704
+ q(n, G.cuid2, r.message, t);
705
705
  break;
706
706
  case "startsWith":
707
- G(n, RegExp(`^${xn(r.value, t)}`), r.message, t);
707
+ q(n, RegExp(`^${bn(r.value, t)}`), r.message, t);
708
708
  break;
709
709
  case "endsWith":
710
- G(n, RegExp(`${xn(r.value, t)}$`), r.message, t);
710
+ q(n, RegExp(`${bn(r.value, t)}$`), r.message, t);
711
711
  break;
712
712
  case "datetime":
713
- W(n, "date-time", r.message, t);
713
+ K(n, "date-time", r.message, t);
714
714
  break;
715
715
  case "date":
716
- W(n, "date", r.message, t);
716
+ K(n, "date", r.message, t);
717
717
  break;
718
718
  case "time":
719
- W(n, "time", r.message, t);
719
+ K(n, "time", r.message, t);
720
720
  break;
721
721
  case "duration":
722
- W(n, "duration", r.message, t);
722
+ K(n, "duration", r.message, t);
723
723
  break;
724
724
  case "length":
725
725
  n.minLength = typeof n.minLength == "number" ? Math.max(n.minLength, r.value) : r.value, n.maxLength = typeof n.maxLength == "number" ? Math.min(n.maxLength, r.value) : r.value;
726
726
  break;
727
727
  case "includes":
728
- G(n, RegExp(xn(r.value, t)), r.message, t);
728
+ q(n, RegExp(bn(r.value, t)), r.message, t);
729
729
  break;
730
730
  case "ip":
731
- r.version !== "v6" && W(n, "ipv4", r.message, t), r.version !== "v4" && W(n, "ipv6", r.message, t);
731
+ r.version !== "v6" && K(n, "ipv4", r.message, t), r.version !== "v4" && K(n, "ipv6", r.message, t);
732
732
  break;
733
733
  case "base64url":
734
- G(n, U.base64url, r.message, t);
734
+ q(n, G.base64url, r.message, t);
735
735
  break;
736
736
  case "jwt":
737
- G(n, U.jwt, r.message, t);
737
+ q(n, G.jwt, r.message, t);
738
738
  break;
739
739
  case "cidr":
740
- r.version !== "v6" && G(n, U.ipv4Cidr, r.message, t), r.version !== "v4" && G(n, U.ipv6Cidr, r.message, t);
740
+ r.version !== "v6" && q(n, G.ipv4Cidr, r.message, t), r.version !== "v4" && q(n, G.ipv6Cidr, r.message, t);
741
741
  break;
742
742
  case "emoji":
743
- G(n, U.emoji(), r.message, t);
743
+ q(n, G.emoji(), r.message, t);
744
744
  break;
745
745
  case "ulid":
746
- G(n, U.ulid, r.message, t);
746
+ q(n, G.ulid, r.message, t);
747
747
  break;
748
748
  case "base64":
749
749
  switch (t.base64Strategy) {
750
750
  case "format:binary":
751
- W(n, "binary", r.message, t);
751
+ K(n, "binary", r.message, t);
752
752
  break;
753
753
  case "contentEncoding:base64":
754
754
  n.contentEncoding = "base64";
755
755
  break;
756
- case "pattern:zod": G(n, U.base64, r.message, t);
756
+ case "pattern:zod": q(n, G.base64, r.message, t);
757
757
  }
758
758
  break;
759
- case "nanoid": G(n, U.nanoid, r.message, t);
759
+ case "nanoid": q(n, G.nanoid, r.message, t);
760
760
  }
761
761
  return n;
762
762
  }
763
- function xn(e, t) {
764
- return t.patternStrategy === "escape" ? Cn(e) : e;
763
+ function bn(e, t) {
764
+ return t.patternStrategy === "escape" ? Sn(e) : e;
765
765
  }
766
- var Sn = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
767
- function Cn(e) {
766
+ var xn = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
767
+ function Sn(e) {
768
768
  let t = "";
769
- for (let n = 0; n < e.length; n++) Sn.has(e[n]) || (t += "\\"), t += e[n];
769
+ for (let n = 0; n < e.length; n++) xn.has(e[n]) || (t += "\\"), t += e[n];
770
770
  return t;
771
771
  }
772
- function W(e, t, n, r) {
772
+ function K(e, t, n, r) {
773
773
  e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
774
774
  format: t,
775
775
  ...n && r.errorMessages && { errorMessage: { format: n } }
776
776
  })) : e.format = t;
777
777
  }
778
- function G(e, t, n, r) {
778
+ function q(e, t, n, r) {
779
779
  e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
780
- pattern: wn(t, r),
780
+ pattern: Cn(t, r),
781
781
  ...n && r.errorMessages && { errorMessage: { pattern: n } }
782
- })) : e.pattern = wn(t, r);
782
+ })) : e.pattern = Cn(t, r);
783
783
  }
784
- function wn(e, t) {
784
+ function Cn(e, t) {
785
785
  if (!t.applyRegexFlags || !e.flags) return e.source;
786
786
  let n = {
787
787
  i: e.flags.includes("i"),
@@ -820,16 +820,16 @@ function wn(e, t) {
820
820
  }
821
821
  return i;
822
822
  }
823
- function K(e, t) {
823
+ function wn(e, t) {
824
824
  let n = {
825
825
  type: "object",
826
- additionalProperties: q(e.valueType._def, {
826
+ additionalProperties: J(e.valueType._def, {
827
827
  ...t,
828
828
  currentPath: [...t.currentPath, "additionalProperties"]
829
829
  }) ?? t.allowedAdditionalProperties
830
830
  };
831
831
  if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
832
- let { type: r, ...i } = bn(e.keyType._def, t);
832
+ let { type: r, ...i } = yn(e.keyType._def, t);
833
833
  return {
834
834
  ...n,
835
835
  propertyNames: i
@@ -840,7 +840,7 @@ function K(e, t) {
840
840
  propertyNames: { enum: e.keyType._def.values }
841
841
  };
842
842
  if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
843
- let { type: r, ...i } = ln(e.keyType._def, t);
843
+ let { type: r, ...i } = dn(e.keyType._def, t);
844
844
  return {
845
845
  ...n,
846
846
  propertyNames: i
@@ -849,12 +849,12 @@ function K(e, t) {
849
849
  return n;
850
850
  }
851
851
  function Tn(e, t) {
852
- return t.mapStrategy === "record" ? K(e, t) : {
852
+ return t.mapStrategy === "record" ? wn(e, t) : {
853
853
  type: "array",
854
854
  maxItems: 125,
855
855
  items: {
856
856
  type: "array",
857
- items: [q(e.keyType._def, {
857
+ items: [J(e.keyType._def, {
858
858
  ...t,
859
859
  currentPath: [
860
860
  ...t.currentPath,
@@ -862,7 +862,7 @@ function Tn(e, t) {
862
862
  "items",
863
863
  "0"
864
864
  ]
865
- }) || H(), q(e.valueType._def, {
865
+ }) || V(), J(e.valueType._def, {
866
866
  ...t,
867
867
  currentPath: [
868
868
  ...t.currentPath,
@@ -870,7 +870,7 @@ function Tn(e, t) {
870
870
  "items",
871
871
  "1"
872
872
  ]
873
- }) || H()],
873
+ }) || V()],
874
874
  minItems: 2,
875
875
  maxItems: 2
876
876
  }
@@ -884,7 +884,7 @@ function En(e) {
884
884
  };
885
885
  }
886
886
  function Dn() {
887
- return { not: H() };
887
+ return { not: V() };
888
888
  }
889
889
  function On() {
890
890
  return { type: "null" };
@@ -931,7 +931,7 @@ function An(e, t) {
931
931
  return jn(e, t);
932
932
  }
933
933
  var jn = (e, t) => {
934
- let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => q(e._def, {
934
+ let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => J(e._def, {
935
935
  ...t,
936
936
  currentPath: [
937
937
  ...t.currentPath,
@@ -949,7 +949,7 @@ function Mn(e, t) {
949
949
  "ZodBoolean",
950
950
  "ZodNull"
951
951
  ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [kn[e.innerType._def.typeName], "null"] };
952
- let n = q(e.innerType._def, {
952
+ let n = J(e.innerType._def, {
953
953
  ...t,
954
954
  currentPath: [
955
955
  ...t.currentPath,
@@ -984,7 +984,7 @@ function Pn(e, t) {
984
984
  for (let e in i) {
985
985
  let a = i[e];
986
986
  if (a === void 0 || a._def === void 0) continue;
987
- let o = In(a), s = q(a._def, {
987
+ let o = In(a), s = J(a._def, {
988
988
  ...t,
989
989
  currentPath: [
990
990
  ...t.currentPath,
@@ -1004,7 +1004,7 @@ function Pn(e, t) {
1004
1004
  return a !== void 0 && (n.additionalProperties = a), n;
1005
1005
  }
1006
1006
  function Fn(e, t) {
1007
- if (e.catchall._def.typeName !== "ZodNever") return q(e.catchall._def, {
1007
+ if (e.catchall._def.typeName !== "ZodNever") return J(e.catchall._def, {
1008
1008
  ...t,
1009
1009
  currentPath: [...t.currentPath, "additionalProperties"]
1010
1010
  });
@@ -1022,8 +1022,8 @@ function In(e) {
1022
1022
  }
1023
1023
  }
1024
1024
  var Ln = (e, t) => {
1025
- if (t.currentPath.toString() === t.propertyPath?.toString()) return q(e.innerType._def, t);
1026
- let n = q(e.innerType._def, {
1025
+ if (t.currentPath.toString() === t.propertyPath?.toString()) return J(e.innerType._def, t);
1026
+ let n = J(e.innerType._def, {
1027
1027
  ...t,
1028
1028
  currentPath: [
1029
1029
  ...t.currentPath,
@@ -1031,11 +1031,11 @@ var Ln = (e, t) => {
1031
1031
  "1"
1032
1032
  ]
1033
1033
  });
1034
- return n ? { anyOf: [{ not: H() }, n] } : H();
1034
+ return n ? { anyOf: [{ not: V() }, n] } : V();
1035
1035
  }, Rn = (e, t) => {
1036
- if (t.pipeStrategy === "input") return q(e.in._def, t);
1037
- if (t.pipeStrategy === "output") return q(e.out._def, t);
1038
- let n = q(e.in._def, {
1036
+ if (t.pipeStrategy === "input") return J(e.in._def, t);
1037
+ if (t.pipeStrategy === "output") return J(e.out._def, t);
1038
+ let n = J(e.in._def, {
1039
1039
  ...t,
1040
1040
  currentPath: [
1041
1041
  ...t.currentPath,
@@ -1043,7 +1043,7 @@ var Ln = (e, t) => {
1043
1043
  "0"
1044
1044
  ]
1045
1045
  });
1046
- return { allOf: [n, q(e.out._def, {
1046
+ return { allOf: [n, J(e.out._def, {
1047
1047
  ...t,
1048
1048
  currentPath: [
1049
1049
  ...t.currentPath,
@@ -1053,13 +1053,13 @@ var Ln = (e, t) => {
1053
1053
  })].filter((e) => e !== void 0) };
1054
1054
  };
1055
1055
  function zn(e, t) {
1056
- return q(e.type._def, t);
1056
+ return J(e.type._def, t);
1057
1057
  }
1058
1058
  function Bn(e, t) {
1059
1059
  let n = {
1060
1060
  type: "array",
1061
1061
  uniqueItems: !0,
1062
- items: q(e.valueType._def, {
1062
+ items: J(e.valueType._def, {
1063
1063
  ...t,
1064
1064
  currentPath: [...t.currentPath, "items"]
1065
1065
  })
@@ -1070,7 +1070,7 @@ function Vn(e, t) {
1070
1070
  return e.rest ? {
1071
1071
  type: "array",
1072
1072
  minItems: e.items.length,
1073
- items: e.items.map((e, n) => q(e._def, {
1073
+ items: e.items.map((e, n) => J(e._def, {
1074
1074
  ...t,
1075
1075
  currentPath: [
1076
1076
  ...t.currentPath,
@@ -1078,7 +1078,7 @@ function Vn(e, t) {
1078
1078
  `${n}`
1079
1079
  ]
1080
1080
  })).reduce((e, t) => t === void 0 ? e : [...e, t], []),
1081
- additionalItems: q(e.rest._def, {
1081
+ additionalItems: J(e.rest._def, {
1082
1082
  ...t,
1083
1083
  currentPath: [...t.currentPath, "additionalItems"]
1084
1084
  })
@@ -1086,7 +1086,7 @@ function Vn(e, t) {
1086
1086
  type: "array",
1087
1087
  minItems: e.items.length,
1088
1088
  maxItems: e.items.length,
1089
- items: e.items.map((e, n) => q(e._def, {
1089
+ items: e.items.map((e, n) => J(e._def, {
1090
1090
  ...t,
1091
1091
  currentPath: [
1092
1092
  ...t.currentPath,
@@ -1097,29 +1097,29 @@ function Vn(e, t) {
1097
1097
  };
1098
1098
  }
1099
1099
  function Hn() {
1100
- return { not: H() };
1100
+ return { not: V() };
1101
1101
  }
1102
1102
  function Un() {
1103
- return H();
1103
+ return V();
1104
1104
  }
1105
- var Wn = (e, t) => q(e.innerType._def, t), Gn = (e, t, n) => {
1105
+ var Wn = (e, t) => J(e.innerType._def, t), Gn = (e, t, n) => {
1106
1106
  switch (t) {
1107
- case "ZodString": return bn(e, n);
1107
+ case "ZodString": return yn(e, n);
1108
1108
  case "ZodNumber": return Nn(e);
1109
1109
  case "ZodObject": return Pn(e, n);
1110
- case "ZodBigInt": return sn(e);
1111
- case "ZodBoolean": return cn();
1112
- case "ZodDate": return dn(e, n);
1110
+ case "ZodBigInt": return ln(e);
1111
+ case "ZodBoolean": return un();
1112
+ case "ZodDate": return pn(e, n);
1113
1113
  case "ZodUndefined": return Hn();
1114
1114
  case "ZodNull": return On();
1115
- case "ZodArray": return on(e, n);
1115
+ case "ZodArray": return cn(e, n);
1116
1116
  case "ZodUnion":
1117
1117
  case "ZodDiscriminatedUnion": return An(e, n);
1118
- case "ZodIntersection": return _n(e, n);
1118
+ case "ZodIntersection": return gn(e, n);
1119
1119
  case "ZodTuple": return Vn(e, n);
1120
- case "ZodRecord": return K(e, n);
1121
- case "ZodLiteral": return vn(e);
1122
- case "ZodEnum": return hn(e);
1120
+ case "ZodRecord": return wn(e, n);
1121
+ case "ZodLiteral": return _n(e);
1122
+ case "ZodEnum": return mn(e);
1123
1123
  case "ZodNativeEnum": return En(e);
1124
1124
  case "ZodNullable": return Mn(e, n);
1125
1125
  case "ZodOptional": return Ln(e, n);
@@ -1129,13 +1129,13 @@ var Wn = (e, t) => q(e.innerType._def, t), Gn = (e, t, n) => {
1129
1129
  case "ZodPromise": return zn(e, n);
1130
1130
  case "ZodNaN":
1131
1131
  case "ZodNever": return Dn();
1132
- case "ZodEffects": return mn(e, n);
1133
- case "ZodAny": return H();
1132
+ case "ZodEffects": return W(e, n);
1133
+ case "ZodAny": return V();
1134
1134
  case "ZodUnknown": return Un();
1135
- case "ZodDefault": return pn(e, n);
1136
- case "ZodBranded": return ln(e, n);
1135
+ case "ZodDefault": return U(e, n);
1136
+ case "ZodBranded": return dn(e, n);
1137
1137
  case "ZodReadonly": return Wn(e, n);
1138
- case "ZodCatch": return un(e, n);
1138
+ case "ZodCatch": return fn(e, n);
1139
1139
  case "ZodPipeline": return Rn(e, n);
1140
1140
  case "ZodFunction":
1141
1141
  case "ZodVoid":
@@ -1149,7 +1149,7 @@ var Wn = (e, t) => q(e.innerType._def, t), Gn = (e, t, n) => {
1149
1149
  for (; n < e.length && n < t.length && e[n] === t[n]; n++);
1150
1150
  return [(e.length - n).toString(), ...t.slice(n)].join("/");
1151
1151
  };
1152
- function q(e, t, n = !1) {
1152
+ function J(e, t, n = !1) {
1153
1153
  let r = t.seen.get(e);
1154
1154
  if (t.override) {
1155
1155
  let i = t.override?.(e, t, r, n);
@@ -1165,7 +1165,7 @@ function q(e, t, n = !1) {
1165
1165
  jsonSchema: void 0
1166
1166
  };
1167
1167
  t.seen.set(e, i);
1168
- let a = Gn(e, e.typeName, t), o = typeof a == "function" ? q(a(), t) : a;
1168
+ let a = Gn(e, e.typeName, t), o = typeof a == "function" ? J(a(), t) : a;
1169
1169
  if (o && Jn(e, t, o), t.postProcess) {
1170
1170
  let n = t.postProcess(o, e, t);
1171
1171
  return i.jsonSchema = o, n;
@@ -1177,10 +1177,10 @@ var qn = (e, t) => {
1177
1177
  case "root": return { $ref: e.path.join("/") };
1178
1178
  case "relative": return { $ref: Kn(t.currentPath, e.path) };
1179
1179
  case "none":
1180
- case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), H()) : t.$refStrategy === "seen" ? H() : void 0;
1180
+ case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), V()) : t.$refStrategy === "seen" ? V() : void 0;
1181
1181
  }
1182
1182
  }, Jn = (e, t, n) => (e.description && (n.description = e.description), n), Yn = (e) => {
1183
- let t = V(e), n = t.name === void 0 ? t.basePath : [
1183
+ let t = sn(e), n = t.name === void 0 ? t.basePath : [
1184
1184
  ...t.basePath,
1185
1185
  t.definitionPath,
1186
1186
  t.name
@@ -1202,22 +1202,22 @@ var qn = (e, t) => {
1202
1202
  }, Xn = (e, t) => {
1203
1203
  let n = Yn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1204
1204
  ...e,
1205
- [t]: q(r._def, {
1205
+ [t]: J(r._def, {
1206
1206
  ...n,
1207
1207
  currentPath: [
1208
1208
  ...n.basePath,
1209
1209
  n.definitionPath,
1210
1210
  t
1211
1211
  ]
1212
- }, !0) ?? H()
1213
- }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = q(e._def, i === void 0 ? n : {
1212
+ }, !0) ?? V()
1213
+ }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = J(e._def, i === void 0 ? n : {
1214
1214
  ...n,
1215
1215
  currentPath: [
1216
1216
  ...n.basePath,
1217
1217
  n.definitionPath,
1218
1218
  i
1219
1219
  ]
1220
- }, !1) ?? H(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1220
+ }, !1) ?? V(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1221
1221
  o !== void 0 && (a.title = o);
1222
1222
  let s = i === void 0 ? r ? {
1223
1223
  ...a,
@@ -1262,7 +1262,7 @@ function tr(e) {
1262
1262
  function nr(e) {
1263
1263
  return $n(() => {
1264
1264
  if (!rr(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1265
- return rn(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1265
+ return z(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1266
1266
  }, { validate: async (t) => {
1267
1267
  let n = await e["~standard"].validate(t);
1268
1268
  return "value" in n ? {
@@ -1270,7 +1270,7 @@ function nr(e) {
1270
1270
  value: n.value
1271
1271
  } : {
1272
1272
  success: !1,
1273
- error: new jt({
1273
+ error: new Nt({
1274
1274
  value: t,
1275
1275
  cause: n.issues
1276
1276
  })
@@ -1296,7 +1296,7 @@ function ir(e, t) {
1296
1296
  function ar(e, t) {
1297
1297
  de().localeError || de(y());
1298
1298
  let n = t?.useReferences ?? !1;
1299
- return $n(() => rn(i(e, {
1299
+ return $n(() => z(i(e, {
1300
1300
  target: "draft-7",
1301
1301
  io: "input",
1302
1302
  reused: n ? "ref" : "inline"
@@ -1323,7 +1323,7 @@ async function cr({ value: e, schema: t, context: n }) {
1323
1323
  schema: t,
1324
1324
  context: n
1325
1325
  });
1326
- if (!r.success) throw jt.wrap({
1326
+ if (!r.success) throw Nt.wrap({
1327
1327
  value: e,
1328
1328
  cause: r.error,
1329
1329
  context: n
@@ -1345,7 +1345,7 @@ async function lr({ value: e, schema: t, context: n }) {
1345
1345
  rawValue: e
1346
1346
  } : {
1347
1347
  success: !1,
1348
- error: jt.wrap({
1348
+ error: Nt.wrap({
1349
1349
  value: e,
1350
1350
  cause: t.error,
1351
1351
  context: n
@@ -1355,7 +1355,7 @@ async function lr({ value: e, schema: t, context: n }) {
1355
1355
  } catch (t) {
1356
1356
  return {
1357
1357
  success: !1,
1358
- error: jt.wrap({
1358
+ error: Nt.wrap({
1359
1359
  value: e,
1360
1360
  cause: t,
1361
1361
  context: n
@@ -1366,7 +1366,7 @@ async function lr({ value: e, schema: t, context: n }) {
1366
1366
  }
1367
1367
  async function ur({ text: e, schema: t }) {
1368
1368
  try {
1369
- let n = nn(e);
1369
+ let n = rn(e);
1370
1370
  return t == null ? {
1371
1371
  success: !0,
1372
1372
  value: n,
@@ -1378,7 +1378,7 @@ async function ur({ text: e, schema: t }) {
1378
1378
  } catch (t) {
1379
1379
  return {
1380
1380
  success: !1,
1381
- error: At.isInstance(t) ? t : new At({
1381
+ error: jt.isInstance(t) ? t : new jt({
1382
1382
  text: e,
1383
1383
  cause: t
1384
1384
  }),
@@ -1387,7 +1387,7 @@ async function ur({ text: e, schema: t }) {
1387
1387
  }
1388
1388
  }
1389
1389
  function dr({ stream: e, schema: t }) {
1390
- return e.pipeThrough(new TextDecoderStream()).pipeThrough(new L()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1390
+ return e.pipeThrough(new TextDecoderStream()).pipeThrough(new Gt()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1391
1391
  e !== "[DONE]" && n.enqueue(await ur({
1392
1392
  text: e,
1393
1393
  schema: t
@@ -1399,7 +1399,7 @@ async function fr(e) {
1399
1399
  }
1400
1400
  new TextDecoder();
1401
1401
  // ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/mini/schemas.js
1402
- var J = /*@__PURE__*/ S("ZodMiniType", (e, t) => {
1402
+ var Y = /*@__PURE__*/ S("ZodMiniType", (e, t) => {
1403
1403
  if (!e._zod) throw Error("Uninitialized schema in ZodMiniType.");
1404
1404
  ae.init(e, t), e.def = t, e.type = t.type;
1405
1405
  }, {
@@ -1445,14 +1445,14 @@ var J = /*@__PURE__*/ S("ZodMiniType", (e, t) => {
1445
1445
  return t.length === 0 ? e(this) : e(this, ...t);
1446
1446
  }
1447
1447
  }), pr = /*@__PURE__*/ S("ZodMiniString", (e, t) => {
1448
- Ce.init(e, t), J.init(e, t);
1448
+ Ce.init(e, t), Y.init(e, t);
1449
1449
  });
1450
1450
  // @__NO_SIDE_EFFECTS__
1451
1451
  function mr(e) {
1452
1452
  return n(pr, e);
1453
1453
  }
1454
1454
  var hr = /*@__PURE__*/ S("ZodMiniNumber", (e, t) => {
1455
- ne.init(e, t), J.init(e, t);
1455
+ ne.init(e, t), Y.init(e, t);
1456
1456
  });
1457
1457
  // @__NO_SIDE_EFFECTS__
1458
1458
  function gr(e) {
@@ -1465,28 +1465,28 @@ function vr(e) {
1465
1465
  return t(_r, e);
1466
1466
  }
1467
1467
  var yr = /*@__PURE__*/ S("ZodMiniBoolean", (e, t) => {
1468
- o.init(e, t), J.init(e, t);
1468
+ o.init(e, t), Y.init(e, t);
1469
1469
  });
1470
1470
  // @__NO_SIDE_EFFECTS__
1471
1471
  function br(e) {
1472
1472
  return r(yr, e);
1473
1473
  }
1474
1474
  var xr = /*@__PURE__*/ S("ZodMiniUnknown", (e, t) => {
1475
- Te.init(e, t), J.init(e, t);
1475
+ Te.init(e, t), Y.init(e, t);
1476
1476
  });
1477
1477
  // @__NO_SIDE_EFFECTS__
1478
1478
  function Sr() {
1479
1479
  return s(xr);
1480
1480
  }
1481
1481
  var Cr = /*@__PURE__*/ S("ZodMiniNever", (e, t) => {
1482
- ee.init(e, t), J.init(e, t);
1482
+ ee.init(e, t), Y.init(e, t);
1483
1483
  });
1484
1484
  // @__NO_SIDE_EFFECTS__
1485
1485
  function wr(e) {
1486
1486
  return m(Cr, e);
1487
1487
  }
1488
1488
  var Tr = /*@__PURE__*/ S("ZodMiniArray", (e, t) => {
1489
- b.init(e, t), J.init(e, t);
1489
+ b.init(e, t), Y.init(e, t);
1490
1490
  });
1491
1491
  // @__NO_SIDE_EFFECTS__
1492
1492
  function Er(e, t) {
@@ -1497,7 +1497,7 @@ function Er(e, t) {
1497
1497
  });
1498
1498
  }
1499
1499
  var Dr = /*@__PURE__*/ S("ZodMiniObject", (t, n) => {
1500
- e.init(t, n), J.init(t, n), Ne(t, "shape", (e) => e._zod.def.shape, !1);
1500
+ e.init(t, n), Y.init(t, n), Ne(t, "shape", (e) => e._zod.def.shape, !1);
1501
1501
  });
1502
1502
  // @__NO_SIDE_EFFECTS__
1503
1503
  function Or(e, t) {
@@ -1521,7 +1521,7 @@ function Ar(e, t) {
1521
1521
  return ke(e, t);
1522
1522
  }
1523
1523
  var jr = /*@__PURE__*/ S("ZodMiniUnion", (e, t) => {
1524
- xe.init(e, t), J.init(e, t);
1524
+ xe.init(e, t), Y.init(e, t);
1525
1525
  });
1526
1526
  // @__NO_SIDE_EFFECTS__
1527
1527
  function Mr(e, t) {
@@ -1532,7 +1532,7 @@ function Mr(e, t) {
1532
1532
  });
1533
1533
  }
1534
1534
  var Nr = /*@__PURE__*/ S("ZodMiniDiscriminatedUnion", (e, t) => {
1535
- Se.init(e, t), J.init(e, t);
1535
+ Se.init(e, t), Y.init(e, t);
1536
1536
  });
1537
1537
  // @__NO_SIDE_EFFECTS__
1538
1538
  function Pr(e, t, n) {
@@ -1544,7 +1544,7 @@ function Pr(e, t, n) {
1544
1544
  });
1545
1545
  }
1546
1546
  var Fr = /*@__PURE__*/ S("ZodMiniRecord", (e, t) => {
1547
- C.init(e, t), J.init(e, t);
1547
+ C.init(e, t), Y.init(e, t);
1548
1548
  });
1549
1549
  // @__NO_SIDE_EFFECTS__
1550
1550
  function Ir(e, t, n) {
@@ -1561,7 +1561,7 @@ function Ir(e, t, n) {
1561
1561
  });
1562
1562
  }
1563
1563
  var Lr = /*@__PURE__*/ S("ZodMiniEnum", (e, t) => {
1564
- l.init(e, t), J.init(e, t), e.options = [...e._zod.values];
1564
+ l.init(e, t), Y.init(e, t), e.options = [...e._zod.values];
1565
1565
  });
1566
1566
  // @__NO_SIDE_EFFECTS__
1567
1567
  function Rr(e, t) {
@@ -1572,7 +1572,7 @@ function Rr(e, t) {
1572
1572
  });
1573
1573
  }
1574
1574
  var zr = /*@__PURE__*/ S("ZodMiniLiteral", (e, t) => {
1575
- te.init(e, t), J.init(e, t);
1575
+ te.init(e, t), Y.init(e, t);
1576
1576
  });
1577
1577
  // @__NO_SIDE_EFFECTS__
1578
1578
  function Br(e, t) {
@@ -1583,7 +1583,7 @@ function Br(e, t) {
1583
1583
  });
1584
1584
  }
1585
1585
  var Vr = /*@__PURE__*/ S("ZodMiniTransform", (e, t) => {
1586
- he.init(e, t), J.init(e, t);
1586
+ he.init(e, t), Y.init(e, t);
1587
1587
  });
1588
1588
  // @__NO_SIDE_EFFECTS__
1589
1589
  function Hr(e) {
@@ -1593,7 +1593,7 @@ function Hr(e) {
1593
1593
  });
1594
1594
  }
1595
1595
  var Ur = /*@__PURE__*/ S("ZodMiniOptional", (e, t) => {
1596
- le.init(e, t), J.init(e, t);
1596
+ le.init(e, t), Y.init(e, t);
1597
1597
  });
1598
1598
  // @__NO_SIDE_EFFECTS__
1599
1599
  function Wr(e) {
@@ -1603,7 +1603,7 @@ function Wr(e) {
1603
1603
  });
1604
1604
  }
1605
1605
  var Gr = /*@__PURE__*/ S("ZodMiniPipe", (e, t) => {
1606
- Ee.init(e, t), J.init(e, t);
1606
+ Ee.init(e, t), Y.init(e, t);
1607
1607
  });
1608
1608
  // @__NO_SIDE_EFFECTS__
1609
1609
  function Kr(e, t) {
@@ -1614,7 +1614,7 @@ function Kr(e, t) {
1614
1614
  });
1615
1615
  }
1616
1616
  var qr = /*@__PURE__*/ S("ZodMiniCustom", (e, t) => {
1617
- u.init(e, t), J.init(e, t);
1617
+ u.init(e, t), Y.init(e, t);
1618
1618
  });
1619
1619
  // @__NO_SIDE_EFFECTS__
1620
1620
  function Jr(e, t) {
@@ -1858,17 +1858,17 @@ async function oi(e) {
1858
1858
  state: "failed-parse"
1859
1859
  });
1860
1860
  }
1861
- R({
1861
+ L({
1862
1862
  prefix: "steer",
1863
1863
  size: 24
1864
- }), new TextEncoder(), new TextEncoder(), R({
1864
+ }), new TextEncoder(), new TextEncoder(), L({
1865
1865
  prefix: "aitxt",
1866
1866
  size: 24
1867
- }), R({
1867
+ }), L({
1868
1868
  prefix: "call",
1869
1869
  size: 24
1870
1870
  }), TransformStream;
1871
- var Y = {
1871
+ var X = {
1872
1872
  NEVER: pe,
1873
1873
  array: Er,
1874
1874
  boolean: br,
@@ -1896,7 +1896,7 @@ var Y = {
1896
1896
  transform: Hr,
1897
1897
  union: Mr,
1898
1898
  unknown: Sr
1899
- }, X = {
1899
+ }, Z = {
1900
1900
  array: be,
1901
1901
  boolean: we,
1902
1902
  custom: _e,
@@ -1911,216 +1911,216 @@ var Y = {
1911
1911
  string: oe,
1912
1912
  union: Ae,
1913
1913
  unknown: _
1914
- }, si = X.lazy(() => X.union([
1915
- X.null(),
1916
- X.string(),
1917
- X.number(),
1918
- X.boolean(),
1919
- X.record(X.string(), si.optional()),
1920
- X.array(si)
1921
- ])), Z = X.record(X.string(), X.record(X.string(), si.optional())), ci = Y.object({
1922
- source: Y.discriminatedUnion("sourceType", [Y.object({
1923
- type: Y.literal("source"),
1924
- sourceType: Y.literal("url"),
1925
- id: Y.string(),
1926
- url: Y.string(),
1927
- title: Y.optional(Y.string()),
1928
- providerMetadata: Y.optional(Z)
1929
- }), Y.object({
1930
- type: Y.literal("source"),
1931
- sourceType: Y.literal("document"),
1932
- id: Y.string(),
1933
- mediaType: Y.string(),
1934
- title: Y.string(),
1935
- filename: Y.optional(Y.string()),
1936
- providerMetadata: Y.optional(Z)
1914
+ }, si = Z.lazy(() => Z.union([
1915
+ Z.null(),
1916
+ Z.string(),
1917
+ Z.number(),
1918
+ Z.boolean(),
1919
+ Z.record(Z.string(), si.optional()),
1920
+ Z.array(si)
1921
+ ])), Q = Z.record(Z.string(), Z.record(Z.string(), si.optional())), ci = X.object({
1922
+ source: X.discriminatedUnion("sourceType", [X.object({
1923
+ type: X.literal("source"),
1924
+ sourceType: X.literal("url"),
1925
+ id: X.string(),
1926
+ url: X.string(),
1927
+ title: X.optional(X.string()),
1928
+ providerMetadata: X.optional(Q)
1929
+ }), X.object({
1930
+ type: X.literal("source"),
1931
+ sourceType: X.literal("document"),
1932
+ id: X.string(),
1933
+ mediaType: X.string(),
1934
+ title: X.string(),
1935
+ filename: X.optional(X.string()),
1936
+ providerMetadata: X.optional(Q)
1937
1937
  })]),
1938
- startIndex: Y.optional(Y.number().check(Y.int()).check(Y.nonnegative())),
1939
- endIndex: Y.optional(Y.number().check(Y.int()).check(Y.nonnegative())),
1940
- citedText: Y.optional(Y.string())
1941
- }), li = Y.record(Y.string(), Y.optional(si)), ui = Qn(() => sr(Y.union([
1942
- Y.looseObject({
1943
- type: Y.literal("text-start"),
1944
- id: Y.string(),
1945
- providerMetadata: Y.optional(Z)
1938
+ startIndex: X.optional(X.number().check(X.int()).check(X.nonnegative())),
1939
+ endIndex: X.optional(X.number().check(X.int()).check(X.nonnegative())),
1940
+ citedText: X.optional(X.string())
1941
+ }), li = X.record(X.string(), X.optional(si)), ui = Qn(() => sr(X.union([
1942
+ X.looseObject({
1943
+ type: X.literal("text-start"),
1944
+ id: X.string(),
1945
+ providerMetadata: X.optional(Q)
1946
1946
  }),
1947
- Y.looseObject({
1948
- type: Y.literal("text-delta"),
1949
- id: Y.string(),
1950
- delta: Y.string(),
1951
- providerMetadata: Y.optional(Z)
1947
+ X.looseObject({
1948
+ type: X.literal("text-delta"),
1949
+ id: X.string(),
1950
+ delta: X.string(),
1951
+ providerMetadata: X.optional(Q)
1952
1952
  }),
1953
- Y.looseObject({
1954
- type: Y.literal("text-end"),
1955
- id: Y.string(),
1956
- citations: Y.optional(Y.array(ci)),
1957
- providerMetadata: Y.optional(Z)
1953
+ X.looseObject({
1954
+ type: X.literal("text-end"),
1955
+ id: X.string(),
1956
+ citations: X.optional(X.array(ci)),
1957
+ providerMetadata: X.optional(Q)
1958
1958
  }),
1959
- Y.looseObject({
1960
- type: Y.literal("error"),
1961
- errorText: Y.string()
1959
+ X.looseObject({
1960
+ type: X.literal("error"),
1961
+ errorText: X.string()
1962
1962
  }),
1963
- Y.looseObject({
1964
- type: Y.literal("tool-input-start"),
1965
- toolCallId: Y.string(),
1966
- toolName: Y.string(),
1967
- inputEncoding: Y.optional(Y.enum(["json", "text"])),
1968
- providerExecuted: Y.optional(Y.boolean()),
1969
- providerMetadata: Y.optional(Z),
1970
- toolMetadata: Y.optional(li),
1971
- dynamic: Y.optional(Y.boolean()),
1972
- title: Y.optional(Y.string())
1963
+ X.looseObject({
1964
+ type: X.literal("tool-input-start"),
1965
+ toolCallId: X.string(),
1966
+ toolName: X.string(),
1967
+ inputEncoding: X.optional(X.enum(["json", "text"])),
1968
+ providerExecuted: X.optional(X.boolean()),
1969
+ providerMetadata: X.optional(Q),
1970
+ toolMetadata: X.optional(li),
1971
+ dynamic: X.optional(X.boolean()),
1972
+ title: X.optional(X.string())
1973
1973
  }),
1974
- Y.looseObject({
1975
- type: Y.literal("tool-input-delta"),
1976
- toolCallId: Y.string(),
1977
- inputTextDelta: Y.string()
1974
+ X.looseObject({
1975
+ type: X.literal("tool-input-delta"),
1976
+ toolCallId: X.string(),
1977
+ inputTextDelta: X.string()
1978
1978
  }),
1979
- Y.looseObject({
1980
- type: Y.literal("tool-input-available"),
1981
- toolCallId: Y.string(),
1982
- toolName: Y.string(),
1983
- input: Y.unknown(),
1984
- providerExecuted: Y.optional(Y.boolean()),
1985
- providerMetadata: Y.optional(Z),
1986
- toolMetadata: Y.optional(li),
1987
- dynamic: Y.optional(Y.boolean()),
1988
- title: Y.optional(Y.string())
1979
+ X.looseObject({
1980
+ type: X.literal("tool-input-available"),
1981
+ toolCallId: X.string(),
1982
+ toolName: X.string(),
1983
+ input: X.unknown(),
1984
+ providerExecuted: X.optional(X.boolean()),
1985
+ providerMetadata: X.optional(Q),
1986
+ toolMetadata: X.optional(li),
1987
+ dynamic: X.optional(X.boolean()),
1988
+ title: X.optional(X.string())
1989
1989
  }),
1990
- Y.looseObject({
1991
- type: Y.literal("tool-input-error"),
1992
- toolCallId: Y.string(),
1993
- toolName: Y.string(),
1994
- input: Y.unknown(),
1995
- providerExecuted: Y.optional(Y.boolean()),
1996
- providerMetadata: Y.optional(Z),
1997
- toolMetadata: Y.optional(li),
1998
- dynamic: Y.optional(Y.boolean()),
1999
- errorText: Y.string(),
2000
- title: Y.optional(Y.string())
1990
+ X.looseObject({
1991
+ type: X.literal("tool-input-error"),
1992
+ toolCallId: X.string(),
1993
+ toolName: X.string(),
1994
+ input: X.unknown(),
1995
+ providerExecuted: X.optional(X.boolean()),
1996
+ providerMetadata: X.optional(Q),
1997
+ toolMetadata: X.optional(li),
1998
+ dynamic: X.optional(X.boolean()),
1999
+ errorText: X.string(),
2000
+ title: X.optional(X.string())
2001
2001
  }),
2002
- Y.looseObject({
2003
- type: Y.literal("tool-approval-request"),
2004
- approvalId: Y.string(),
2005
- toolCallId: Y.string(),
2006
- approvalDescriptor: Y.optional(Y.unknown()),
2007
- inputSchemaInput: Y.optional(Y.unknown()),
2008
- reason: Y.optional(Y.string()),
2009
- isAutomatic: Y.optional(Y.boolean()),
2010
- signature: Y.optional(Y.string())
2002
+ X.looseObject({
2003
+ type: X.literal("tool-approval-request"),
2004
+ approvalId: X.string(),
2005
+ toolCallId: X.string(),
2006
+ approvalDescriptor: X.optional(X.unknown()),
2007
+ inputSchemaInput: X.optional(X.unknown()),
2008
+ reason: X.optional(X.string()),
2009
+ isAutomatic: X.optional(X.boolean()),
2010
+ signature: X.optional(X.string())
2011
2011
  }),
2012
- Y.looseObject({
2013
- type: Y.literal("tool-approval-response"),
2014
- approvalId: Y.string(),
2015
- approved: Y.boolean(),
2016
- reason: Y.optional(Y.string()),
2017
- providerExecuted: Y.optional(Y.boolean()),
2018
- providerMetadata: Y.optional(Z)
2012
+ X.looseObject({
2013
+ type: X.literal("tool-approval-response"),
2014
+ approvalId: X.string(),
2015
+ approved: X.boolean(),
2016
+ reason: X.optional(X.string()),
2017
+ providerExecuted: X.optional(X.boolean()),
2018
+ providerMetadata: X.optional(Q)
2019
2019
  }),
2020
- Y.looseObject({
2021
- type: Y.literal("tool-output-available"),
2022
- toolCallId: Y.string(),
2023
- output: Y.unknown(),
2024
- providerExecuted: Y.optional(Y.boolean()),
2025
- providerMetadata: Y.optional(Z),
2026
- toolMetadata: Y.optional(li),
2027
- dynamic: Y.optional(Y.boolean()),
2028
- preliminary: Y.optional(Y.boolean())
2020
+ X.looseObject({
2021
+ type: X.literal("tool-output-available"),
2022
+ toolCallId: X.string(),
2023
+ output: X.unknown(),
2024
+ providerExecuted: X.optional(X.boolean()),
2025
+ providerMetadata: X.optional(Q),
2026
+ toolMetadata: X.optional(li),
2027
+ dynamic: X.optional(X.boolean()),
2028
+ preliminary: X.optional(X.boolean())
2029
2029
  }),
2030
- Y.looseObject({
2031
- type: Y.literal("tool-output-error"),
2032
- toolCallId: Y.string(),
2033
- errorText: Y.string(),
2034
- providerExecuted: Y.optional(Y.boolean()),
2035
- providerMetadata: Y.optional(Z),
2036
- toolMetadata: Y.optional(li),
2037
- dynamic: Y.optional(Y.boolean())
2030
+ X.looseObject({
2031
+ type: X.literal("tool-output-error"),
2032
+ toolCallId: X.string(),
2033
+ errorText: X.string(),
2034
+ providerExecuted: X.optional(X.boolean()),
2035
+ providerMetadata: X.optional(Q),
2036
+ toolMetadata: X.optional(li),
2037
+ dynamic: X.optional(X.boolean())
2038
2038
  }),
2039
- Y.looseObject({
2040
- type: Y.literal("tool-output-denied"),
2041
- toolCallId: Y.string()
2039
+ X.looseObject({
2040
+ type: X.literal("tool-output-denied"),
2041
+ toolCallId: X.string()
2042
2042
  }),
2043
- Y.looseObject({
2044
- type: Y.literal("reasoning-start"),
2045
- id: Y.string(),
2046
- providerMetadata: Y.optional(Z)
2043
+ X.looseObject({
2044
+ type: X.literal("reasoning-start"),
2045
+ id: X.string(),
2046
+ providerMetadata: X.optional(Q)
2047
2047
  }),
2048
- Y.looseObject({
2049
- type: Y.literal("reasoning-delta"),
2050
- id: Y.string(),
2051
- delta: Y.string(),
2052
- providerMetadata: Y.optional(Z)
2048
+ X.looseObject({
2049
+ type: X.literal("reasoning-delta"),
2050
+ id: X.string(),
2051
+ delta: X.string(),
2052
+ providerMetadata: X.optional(Q)
2053
2053
  }),
2054
- Y.looseObject({
2055
- type: Y.literal("reasoning-end"),
2056
- id: Y.string(),
2057
- providerMetadata: Y.optional(Z)
2054
+ X.looseObject({
2055
+ type: X.literal("reasoning-end"),
2056
+ id: X.string(),
2057
+ providerMetadata: X.optional(Q)
2058
2058
  }),
2059
- Y.looseObject({
2060
- type: Y.literal("custom"),
2061
- kind: Y.pipe(Y.string(), Y.transform((e) => e)),
2062
- providerMetadata: Y.optional(Z)
2059
+ X.looseObject({
2060
+ type: X.literal("custom"),
2061
+ kind: X.pipe(X.string(), X.transform((e) => e)),
2062
+ providerMetadata: X.optional(Q)
2063
2063
  }),
2064
- Y.looseObject({
2065
- type: Y.literal("source-url"),
2066
- sourceId: Y.string(),
2067
- url: Y.string(),
2068
- title: Y.optional(Y.string()),
2069
- providerMetadata: Y.optional(Z)
2064
+ X.looseObject({
2065
+ type: X.literal("source-url"),
2066
+ sourceId: X.string(),
2067
+ url: X.string(),
2068
+ title: X.optional(X.string()),
2069
+ providerMetadata: X.optional(Q)
2070
2070
  }),
2071
- Y.looseObject({
2072
- type: Y.literal("source-document"),
2073
- sourceId: Y.string(),
2074
- mediaType: Y.string(),
2075
- title: Y.string(),
2076
- filename: Y.optional(Y.string()),
2077
- providerMetadata: Y.optional(Z)
2071
+ X.looseObject({
2072
+ type: X.literal("source-document"),
2073
+ sourceId: X.string(),
2074
+ mediaType: X.string(),
2075
+ title: X.string(),
2076
+ filename: X.optional(X.string()),
2077
+ providerMetadata: X.optional(Q)
2078
2078
  }),
2079
- Y.looseObject({
2080
- type: Y.literal("file"),
2081
- url: Y.string(),
2082
- mediaType: Y.string(),
2083
- providerMetadata: Y.optional(Z)
2079
+ X.looseObject({
2080
+ type: X.literal("file"),
2081
+ url: X.string(),
2082
+ mediaType: X.string(),
2083
+ providerMetadata: X.optional(Q)
2084
2084
  }),
2085
- Y.looseObject({
2086
- type: Y.literal("reasoning-file"),
2087
- url: Y.string(),
2088
- mediaType: Y.string(),
2089
- providerMetadata: Y.optional(Z)
2085
+ X.looseObject({
2086
+ type: X.literal("reasoning-file"),
2087
+ url: X.string(),
2088
+ mediaType: X.string(),
2089
+ providerMetadata: X.optional(Q)
2090
2090
  }),
2091
- Y.looseObject({
2092
- type: Y.literal("steering-message"),
2093
- id: Y.string(),
2094
- parts: Y.array(Y.union([Y.looseObject({
2095
- type: Y.literal("text"),
2096
- text: Y.string(),
2097
- providerMetadata: Y.optional(Z)
2098
- }), Y.looseObject({
2099
- type: Y.literal("file"),
2100
- mediaType: Y.string(),
2101
- url: Y.string(),
2102
- filename: Y.optional(Y.string()),
2103
- providerReference: Y.optional(Y.record(Y.string(), Y.string())),
2104
- providerMetadata: Y.optional(Z)
2091
+ X.looseObject({
2092
+ type: X.literal("steering-message"),
2093
+ id: X.string(),
2094
+ parts: X.array(X.union([X.looseObject({
2095
+ type: X.literal("text"),
2096
+ text: X.string(),
2097
+ providerMetadata: X.optional(Q)
2098
+ }), X.looseObject({
2099
+ type: X.literal("file"),
2100
+ mediaType: X.string(),
2101
+ url: X.string(),
2102
+ filename: X.optional(X.string()),
2103
+ providerReference: X.optional(X.record(X.string(), X.string())),
2104
+ providerMetadata: X.optional(Q)
2105
2105
  })]))
2106
2106
  }),
2107
- Y.looseObject({
2108
- type: Y.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2109
- id: Y.optional(Y.string()),
2110
- data: Y.unknown(),
2111
- transient: Y.optional(Y.boolean())
2107
+ X.looseObject({
2108
+ type: X.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2109
+ id: X.optional(X.string()),
2110
+ data: X.unknown(),
2111
+ transient: X.optional(X.boolean())
2112
2112
  }),
2113
- Y.looseObject({ type: Y.literal("start-step") }),
2114
- Y.looseObject({ type: Y.literal("finish-step") }),
2115
- Y.looseObject({ type: Y.literal("reset-step") }),
2116
- Y.looseObject({
2117
- type: Y.literal("start"),
2118
- messageId: Y.optional(Y.string()),
2119
- messageMetadata: Y.optional(Y.unknown())
2113
+ X.looseObject({ type: X.literal("start-step") }),
2114
+ X.looseObject({ type: X.literal("finish-step") }),
2115
+ X.looseObject({ type: X.literal("reset-step") }),
2116
+ X.looseObject({
2117
+ type: X.literal("start"),
2118
+ messageId: X.optional(X.string()),
2119
+ messageMetadata: X.optional(X.unknown())
2120
2120
  }),
2121
- Y.looseObject({
2122
- type: Y.literal("finish"),
2123
- finishReason: Y.optional(Y.enum([
2121
+ X.looseObject({
2122
+ type: X.literal("finish"),
2123
+ finishReason: X.optional(X.enum([
2124
2124
  "stop",
2125
2125
  "length",
2126
2126
  "content-filter",
@@ -2129,15 +2129,15 @@ var Y = {
2129
2129
  "interrupted",
2130
2130
  "other"
2131
2131
  ])),
2132
- messageMetadata: Y.optional(Y.unknown())
2132
+ messageMetadata: X.optional(X.unknown())
2133
2133
  }),
2134
- Y.looseObject({
2135
- type: Y.literal("abort"),
2136
- reason: Y.optional(Y.string())
2134
+ X.looseObject({
2135
+ type: X.literal("abort"),
2136
+ reason: X.optional(X.string())
2137
2137
  }),
2138
- Y.looseObject({
2139
- type: Y.literal("message-metadata"),
2140
- messageMetadata: Y.unknown()
2138
+ X.looseObject({
2139
+ type: X.literal("message-metadata"),
2140
+ messageMetadata: X.unknown()
2141
2141
  })
2142
2142
  ])));
2143
2143
  function di(e) {
@@ -2152,7 +2152,7 @@ function pi(e) {
2152
2152
  function mi(e) {
2153
2153
  return e.type === "dynamic-tool";
2154
2154
  }
2155
- function Q(e) {
2155
+ function $(e) {
2156
2156
  return pi(e) || mi(e);
2157
2157
  }
2158
2158
  function hi(e) {
@@ -2166,7 +2166,7 @@ function gi({ lastMessage: e, messageId: t }) {
2166
2166
  parts: []
2167
2167
  }, r = fi(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
2168
2168
  for (let e of n.parts.slice(i + 1)) {
2169
- if (!Q(e)) continue;
2169
+ if (!$(e)) continue;
2170
2170
  let t = a;
2171
2171
  pi(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
2172
2172
  text: e.rawInput ?? "",
@@ -2195,7 +2195,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2195
2195
  return e.slice(t + 1);
2196
2196
  }
2197
2197
  function p() {
2198
- return f().filter(Q);
2198
+ return f().filter($);
2199
2199
  }
2200
2200
  function m(e) {
2201
2201
  let t = p().find((t) => t.toolCallId === e);
@@ -2203,7 +2203,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2203
2203
  let n = r.message.parts;
2204
2204
  for (let r = n.length - 1; r >= 0; r--) {
2205
2205
  let i = n[r];
2206
- if (Q(i) && i.toolCallId === e) {
2206
+ if ($(i) && i.toolCallId === e) {
2207
2207
  t = i;
2208
2208
  break;
2209
2209
  }
@@ -2217,7 +2217,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2217
2217
  return t;
2218
2218
  }
2219
2219
  function h(e) {
2220
- let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
2220
+ let t = r.message.parts.filter($).find((t) => t.approval?.id === e);
2221
2221
  if (t == null) throw new ri({
2222
2222
  chunkType: "tool-approval-response",
2223
2223
  chunkId: e,
@@ -2478,7 +2478,7 @@ function _i({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2478
2478
  }), d(), a && !e.providerExecuted && await a({ toolCall: e });
2479
2479
  break;
2480
2480
  case "tool-input-error": {
2481
- let t = f().filter(Q).find((t) => t.toolCallId === e.toolCallId);
2481
+ let t = f().filter($).find((t) => t.toolCallId === e.toolCallId);
2482
2482
  (t == null ? e.dynamic : t.type === "dynamic-tool") ? _({
2483
2483
  toolCallId: e.toolCallId,
2484
2484
  toolName: e.toolName,
@@ -2666,16 +2666,16 @@ function yi() {
2666
2666
  reject: t
2667
2667
  };
2668
2668
  }
2669
- R({
2669
+ L({
2670
2670
  prefix: "aitxt",
2671
2671
  size: 24
2672
- }), R({
2672
+ }), L({
2673
2673
  prefix: "call",
2674
2674
  size: 24
2675
- }), R({
2675
+ }), L({
2676
2676
  prefix: "aitxt",
2677
2677
  size: 24
2678
- }), R({
2678
+ }), L({
2679
2679
  prefix: "call",
2680
2680
  size: 24
2681
2681
  });
@@ -2702,7 +2702,7 @@ function bi(e, t = [], n = /* @__PURE__ */ new WeakSet()) {
2702
2702
  }
2703
2703
  }
2704
2704
  function xi(e, t = []) {
2705
- return Y.pipe(Y.unknown().check((e) => {
2705
+ return X.pipe(X.unknown().check((e) => {
2706
2706
  let n = e.value;
2707
2707
  for (let e of t) n = typeof n == "object" && n ? n[e] : void 0;
2708
2708
  let r = bi(n);
@@ -2714,16 +2714,16 @@ function xi(e, t = []) {
2714
2714
  });
2715
2715
  }), e);
2716
2716
  }
2717
- xi(Y.record(Y.string(), Y.optional(si))), xi(Z), Y.record(Y.string(), Y.string()), xi(ci, ["source", "providerMetadata"]), R({
2717
+ xi(X.record(X.string(), X.optional(si))), xi(Q), X.record(X.string(), X.string()), xi(ci, ["source", "providerMetadata"]), L({
2718
2718
  prefix: "call",
2719
2719
  size: 24
2720
- }), R({
2720
+ }), L({
2721
2721
  prefix: "call",
2722
2722
  size: 24
2723
- }), new TextEncoder(), R({
2723
+ }), new TextEncoder(), L({
2724
2724
  prefix: "call",
2725
2725
  size: 24
2726
- }), R({
2726
+ }), L({
2727
2727
  prefix: "aiobj",
2728
2728
  size: 24
2729
2729
  });
@@ -2759,214 +2759,214 @@ var { atob: Si } = globalThis, Ci = class {
2759
2759
  });
2760
2760
  }
2761
2761
  };
2762
- R({
2762
+ L({
2763
2763
  prefix: "aiobj",
2764
2764
  size: 24
2765
- }), R({
2765
+ }), L({
2766
2766
  prefix: "call",
2767
2767
  size: 24
2768
2768
  });
2769
- var wi = X.union([
2770
- X.string(),
2771
- X.custom(qt, { message: "Must be a Uint8Array" }),
2772
- X.custom(Jt, { message: "Must be an ArrayBuffer" }),
2773
- X.custom(Zt, { message: "Must be a Buffer" })
2774
- ]), Ti = X.record(X.string(), X.string()), Ei = X.object({
2775
- type: X.literal("text"),
2776
- text: X.string(),
2777
- providerOptions: Z.optional()
2778
- }), Di = X.object({
2779
- type: X.literal("image"),
2780
- image: X.union([
2769
+ var wi = Z.union([
2770
+ Z.string(),
2771
+ Z.custom(Xt, { message: "Must be a Uint8Array" }),
2772
+ Z.custom(I, { message: "Must be an ArrayBuffer" }),
2773
+ Z.custom(R, { message: "Must be a Buffer" })
2774
+ ]), Ti = Z.record(Z.string(), Z.string()), Ei = Z.object({
2775
+ type: Z.literal("text"),
2776
+ text: Z.string(),
2777
+ providerOptions: Q.optional()
2778
+ }), Di = Z.object({
2779
+ type: Z.literal("image"),
2780
+ image: Z.union([
2781
2781
  wi,
2782
- X.instanceof(URL),
2782
+ Z.instanceof(URL),
2783
2783
  Ti
2784
2784
  ]),
2785
- mediaType: X.string().optional(),
2786
- providerOptions: Z.optional()
2787
- }), Oi = X.discriminatedUnion("type", [
2788
- X.object({
2789
- type: X.literal("data"),
2785
+ mediaType: Z.string().optional(),
2786
+ providerOptions: Q.optional()
2787
+ }), Oi = Z.discriminatedUnion("type", [
2788
+ Z.object({
2789
+ type: Z.literal("data"),
2790
2790
  data: wi
2791
2791
  }),
2792
- X.object({
2793
- type: X.literal("url"),
2794
- url: X.instanceof(URL)
2792
+ Z.object({
2793
+ type: Z.literal("url"),
2794
+ url: Z.instanceof(URL)
2795
2795
  }),
2796
- X.object({
2797
- type: X.literal("reference"),
2796
+ Z.object({
2797
+ type: Z.literal("reference"),
2798
2798
  reference: Ti
2799
2799
  }),
2800
- X.object({
2801
- type: X.literal("text"),
2802
- text: X.string()
2800
+ Z.object({
2801
+ type: Z.literal("text"),
2802
+ text: Z.string()
2803
2803
  })
2804
- ]), ki = X.discriminatedUnion("type", [X.object({
2805
- type: X.literal("data"),
2804
+ ]), ki = Z.discriminatedUnion("type", [Z.object({
2805
+ type: Z.literal("data"),
2806
2806
  data: wi
2807
- }), X.object({
2808
- type: X.literal("url"),
2809
- url: X.instanceof(URL)
2810
- })]), Ai = X.object({
2811
- type: X.literal("file"),
2812
- data: X.union([
2807
+ }), Z.object({
2808
+ type: Z.literal("url"),
2809
+ url: Z.instanceof(URL)
2810
+ })]), Ai = Z.object({
2811
+ type: Z.literal("file"),
2812
+ data: Z.union([
2813
2813
  Oi,
2814
2814
  wi,
2815
- X.instanceof(URL),
2815
+ Z.instanceof(URL),
2816
2816
  Ti
2817
2817
  ]),
2818
- filename: X.string().optional(),
2819
- mediaType: X.string(),
2820
- providerOptions: Z.optional()
2821
- }), ji = X.object({
2822
- type: X.literal("reasoning"),
2823
- text: X.string(),
2824
- providerOptions: Z.optional()
2825
- }), Mi = X.object({
2826
- type: X.literal("custom"),
2827
- kind: X.string().transform((e) => e),
2828
- providerOptions: Z.optional()
2829
- }), Ni = X.object({
2830
- type: X.literal("reasoning-file"),
2831
- data: X.union([
2818
+ filename: Z.string().optional(),
2819
+ mediaType: Z.string(),
2820
+ providerOptions: Q.optional()
2821
+ }), ji = Z.object({
2822
+ type: Z.literal("reasoning"),
2823
+ text: Z.string(),
2824
+ providerOptions: Q.optional()
2825
+ }), Mi = Z.object({
2826
+ type: Z.literal("custom"),
2827
+ kind: Z.string().transform((e) => e),
2828
+ providerOptions: Q.optional()
2829
+ }), Ni = Z.object({
2830
+ type: Z.literal("reasoning-file"),
2831
+ data: Z.union([
2832
2832
  ki,
2833
2833
  wi,
2834
- X.instanceof(URL)
2834
+ Z.instanceof(URL)
2835
2835
  ]),
2836
- mediaType: X.string(),
2837
- providerOptions: Z.optional()
2838
- }), Pi = X.object({
2839
- type: X.literal("tool-call"),
2840
- toolCallId: X.string(),
2841
- toolName: X.string(),
2842
- input: X.unknown(),
2843
- providerOptions: Z.optional(),
2844
- providerExecuted: X.boolean().optional()
2845
- }), Fi = X.discriminatedUnion("type", [
2846
- X.object({
2847
- type: X.literal("text"),
2848
- value: X.string(),
2849
- providerOptions: Z.optional()
2836
+ mediaType: Z.string(),
2837
+ providerOptions: Q.optional()
2838
+ }), Pi = Z.object({
2839
+ type: Z.literal("tool-call"),
2840
+ toolCallId: Z.string(),
2841
+ toolName: Z.string(),
2842
+ input: Z.unknown(),
2843
+ providerOptions: Q.optional(),
2844
+ providerExecuted: Z.boolean().optional()
2845
+ }), Fi = Z.discriminatedUnion("type", [
2846
+ Z.object({
2847
+ type: Z.literal("text"),
2848
+ value: Z.string(),
2849
+ providerOptions: Q.optional()
2850
2850
  }),
2851
- X.object({
2852
- type: X.literal("json"),
2851
+ Z.object({
2852
+ type: Z.literal("json"),
2853
2853
  value: si,
2854
- providerOptions: Z.optional()
2854
+ providerOptions: Q.optional()
2855
2855
  }),
2856
- X.object({
2857
- type: X.literal("execution-denied"),
2858
- reason: X.string().optional(),
2859
- providerOptions: Z.optional()
2856
+ Z.object({
2857
+ type: Z.literal("execution-denied"),
2858
+ reason: Z.string().optional(),
2859
+ providerOptions: Q.optional()
2860
2860
  }),
2861
- X.object({
2862
- type: X.literal("error-text"),
2863
- value: X.string(),
2864
- providerOptions: Z.optional()
2861
+ Z.object({
2862
+ type: Z.literal("error-text"),
2863
+ value: Z.string(),
2864
+ providerOptions: Q.optional()
2865
2865
  }),
2866
- X.object({
2867
- type: X.literal("error-json"),
2866
+ Z.object({
2867
+ type: Z.literal("error-json"),
2868
2868
  value: si,
2869
- providerOptions: Z.optional()
2869
+ providerOptions: Q.optional()
2870
2870
  }),
2871
- X.object({
2872
- type: X.literal("content"),
2873
- value: X.array(X.union([
2874
- X.object({
2875
- type: X.literal("text"),
2876
- text: X.string(),
2877
- providerOptions: Z.optional()
2871
+ Z.object({
2872
+ type: Z.literal("content"),
2873
+ value: Z.array(Z.union([
2874
+ Z.object({
2875
+ type: Z.literal("text"),
2876
+ text: Z.string(),
2877
+ providerOptions: Q.optional()
2878
2878
  }),
2879
- X.object({
2880
- type: X.literal("file"),
2879
+ Z.object({
2880
+ type: Z.literal("file"),
2881
2881
  data: Oi,
2882
- mediaType: X.string(),
2883
- filename: X.string().optional(),
2884
- providerOptions: Z.optional()
2882
+ mediaType: Z.string(),
2883
+ filename: Z.string().optional(),
2884
+ providerOptions: Q.optional()
2885
2885
  }),
2886
- X.object({
2887
- type: X.literal("file-data"),
2888
- data: X.string(),
2889
- mediaType: X.string(),
2890
- filename: X.string().optional(),
2891
- providerOptions: Z.optional()
2886
+ Z.object({
2887
+ type: Z.literal("file-data"),
2888
+ data: Z.string(),
2889
+ mediaType: Z.string(),
2890
+ filename: Z.string().optional(),
2891
+ providerOptions: Q.optional()
2892
2892
  }),
2893
- X.object({
2894
- type: X.literal("file-url"),
2895
- url: X.string(),
2896
- mediaType: X.string().optional(),
2897
- providerOptions: Z.optional()
2893
+ Z.object({
2894
+ type: Z.literal("file-url"),
2895
+ url: Z.string(),
2896
+ mediaType: Z.string().optional(),
2897
+ providerOptions: Q.optional()
2898
2898
  }),
2899
- X.object({
2900
- type: X.literal("file-id"),
2901
- fileId: X.union([X.string(), X.record(X.string(), X.string())]),
2902
- providerOptions: Z.optional()
2899
+ Z.object({
2900
+ type: Z.literal("file-id"),
2901
+ fileId: Z.union([Z.string(), Z.record(Z.string(), Z.string())]),
2902
+ providerOptions: Q.optional()
2903
2903
  }),
2904
- X.object({
2905
- type: X.literal("file-reference"),
2906
- providerReference: X.record(X.string(), X.string()),
2907
- providerOptions: Z.optional()
2904
+ Z.object({
2905
+ type: Z.literal("file-reference"),
2906
+ providerReference: Z.record(Z.string(), Z.string()),
2907
+ providerOptions: Q.optional()
2908
2908
  }),
2909
- X.object({
2910
- type: X.literal("image-data"),
2911
- data: X.string(),
2912
- mediaType: X.string(),
2913
- providerOptions: Z.optional()
2909
+ Z.object({
2910
+ type: Z.literal("image-data"),
2911
+ data: Z.string(),
2912
+ mediaType: Z.string(),
2913
+ providerOptions: Q.optional()
2914
2914
  }),
2915
- X.object({
2916
- type: X.literal("image-url"),
2917
- url: X.string(),
2918
- providerOptions: Z.optional()
2915
+ Z.object({
2916
+ type: Z.literal("image-url"),
2917
+ url: Z.string(),
2918
+ providerOptions: Q.optional()
2919
2919
  }),
2920
- X.object({
2921
- type: X.literal("image-file-id"),
2922
- fileId: X.union([X.string(), X.record(X.string(), X.string())]),
2923
- providerOptions: Z.optional()
2920
+ Z.object({
2921
+ type: Z.literal("image-file-id"),
2922
+ fileId: Z.union([Z.string(), Z.record(Z.string(), Z.string())]),
2923
+ providerOptions: Q.optional()
2924
2924
  }),
2925
- X.object({
2926
- type: X.literal("image-file-reference"),
2927
- providerReference: X.record(X.string(), X.string()),
2928
- providerOptions: Z.optional()
2925
+ Z.object({
2926
+ type: Z.literal("image-file-reference"),
2927
+ providerReference: Z.record(Z.string(), Z.string()),
2928
+ providerOptions: Q.optional()
2929
2929
  }),
2930
- X.object({
2931
- type: X.literal("custom"),
2932
- providerOptions: Z.optional()
2930
+ Z.object({
2931
+ type: Z.literal("custom"),
2932
+ providerOptions: Q.optional()
2933
2933
  })
2934
2934
  ]))
2935
2935
  })
2936
- ]), Ii = X.object({
2937
- type: X.literal("tool-result"),
2938
- toolCallId: X.string(),
2939
- toolName: X.string(),
2936
+ ]), Ii = Z.object({
2937
+ type: Z.literal("tool-result"),
2938
+ toolCallId: Z.string(),
2939
+ toolName: Z.string(),
2940
2940
  output: Fi,
2941
- providerOptions: Z.optional()
2942
- }), Li = X.object({
2943
- type: X.literal("tool-approval-request"),
2944
- approvalId: X.string(),
2945
- toolCallId: X.string(),
2946
- reason: X.string().optional(),
2947
- isAutomatic: X.boolean().optional(),
2948
- signature: X.string().optional(),
2949
- inputSchemaInput: X.unknown().optional()
2950
- }), Ri = X.object({
2951
- type: X.literal("tool-approval-response"),
2952
- approvalId: X.string(),
2953
- approved: X.boolean(),
2954
- reason: X.string().optional()
2955
- }), zi = X.object({
2956
- role: X.literal("system"),
2957
- content: X.string(),
2958
- providerOptions: Z.optional()
2959
- }), Bi = X.object({
2960
- role: X.literal("user"),
2961
- content: X.union([X.string(), X.array(X.union([
2941
+ providerOptions: Q.optional()
2942
+ }), Li = Z.object({
2943
+ type: Z.literal("tool-approval-request"),
2944
+ approvalId: Z.string(),
2945
+ toolCallId: Z.string(),
2946
+ reason: Z.string().optional(),
2947
+ isAutomatic: Z.boolean().optional(),
2948
+ signature: Z.string().optional(),
2949
+ inputSchemaInput: Z.unknown().optional()
2950
+ }), Ri = Z.object({
2951
+ type: Z.literal("tool-approval-response"),
2952
+ approvalId: Z.string(),
2953
+ approved: Z.boolean(),
2954
+ reason: Z.string().optional()
2955
+ }), zi = Z.object({
2956
+ role: Z.literal("system"),
2957
+ content: Z.string(),
2958
+ providerOptions: Q.optional()
2959
+ }), Bi = Z.object({
2960
+ role: Z.literal("user"),
2961
+ content: Z.union([Z.string(), Z.array(Z.union([
2962
2962
  Ei,
2963
2963
  Di,
2964
2964
  Ai
2965
2965
  ]))]),
2966
- providerOptions: Z.optional()
2967
- }), Vi = X.object({
2968
- role: X.literal("assistant"),
2969
- content: X.union([X.string(), X.array(X.union([
2966
+ providerOptions: Q.optional()
2967
+ }), Vi = Z.object({
2968
+ role: Z.literal("assistant"),
2969
+ content: Z.union([Z.string(), Z.array(Z.union([
2970
2970
  Ei,
2971
2971
  Mi,
2972
2972
  Ai,
@@ -2976,20 +2976,20 @@ var wi = X.union([
2976
2976
  Ii,
2977
2977
  Li
2978
2978
  ]))]),
2979
- providerOptions: Z.optional()
2980
- }), Hi = X.object({
2981
- role: X.literal("tool"),
2982
- content: X.array(X.union([Ii, Ri])),
2983
- providerOptions: Z.optional()
2979
+ providerOptions: Q.optional()
2980
+ }), Hi = Z.object({
2981
+ role: Z.literal("tool"),
2982
+ content: Z.array(Z.union([Ii, Ri])),
2983
+ providerOptions: Q.optional()
2984
2984
  });
2985
- X.union([
2985
+ Z.union([
2986
2986
  zi,
2987
2987
  Bi,
2988
2988
  Vi,
2989
2989
  Hi
2990
- ]), Y.object({
2991
- token: Y.string().check(Y.refine((e) => e.trim().length > 0)),
2992
- url: Y.string().check(Y.refine((e) => {
2990
+ ]), X.object({
2991
+ token: X.string().check(X.refine((e) => e.trim().length > 0)),
2992
+ url: X.string().check(X.refine((e) => {
2993
2993
  try {
2994
2994
  let t = new URL(e);
2995
2995
  return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
@@ -2997,26 +2997,26 @@ X.union([
2997
2997
  return !1;
2998
2998
  }
2999
2999
  })),
3000
- expiresAt: Y.optional(Y.number().check(Y.positive()).check(Y.maximum(2 ** 53 - 1))),
3001
- tools: Y.optional(Y.array(Y.object({
3002
- type: Y.literal("function"),
3003
- name: Y.string().check(Y.minLength(1)),
3004
- description: Y.optional(Y.string()),
3005
- parameters: Y.record(Y.string(), Y.unknown())
3000
+ expiresAt: X.optional(X.number().check(X.positive()).check(X.maximum(2 ** 53 - 1))),
3001
+ tools: X.optional(X.array(X.object({
3002
+ type: X.literal("function"),
3003
+ name: X.string().check(X.minLength(1)),
3004
+ description: X.optional(X.string()),
3005
+ parameters: X.record(X.string(), X.unknown())
3006
3006
  })))
3007
- }), R({
3007
+ }), L({
3008
3008
  prefix: "call",
3009
3009
  size: 24
3010
- }), R({
3010
+ }), L({
3011
3011
  prefix: "call",
3012
3012
  size: 24
3013
- }), R({
3013
+ }), L({
3014
3014
  prefix: "call",
3015
3015
  size: 24
3016
3016
  });
3017
3017
  async function Ui({ response: e, url: t, fallbackMessage: n }) {
3018
3018
  let r = await e.text();
3019
- return new vt({
3019
+ return new yt({
3020
3020
  message: r || n,
3021
3021
  url: t,
3022
3022
  requestBodyValues: void 0,
@@ -3026,7 +3026,7 @@ async function Ui({ response: e, url: t, fallbackMessage: n }) {
3026
3026
  }
3027
3027
  async function Wi(e) {
3028
3028
  if (e == null) return [];
3029
- if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Ft({
3029
+ if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Lt({
3030
3030
  functionality: "FileList",
3031
3031
  message: "FileList is not supported in the current environment"
3032
3032
  });
@@ -3055,8 +3055,8 @@ var Ki = class {
3055
3055
  }
3056
3056
  async sendMessages({ abortSignal: e, ...t }) {
3057
3057
  let n = await fr(this.body), r = await fr(this.headers), i = await fr(this.credentials), a = {
3058
- ...Yt(r),
3059
- ...Yt(t.headers)
3058
+ ...Zt(r),
3059
+ ...Zt(t.headers)
3060
3060
  }, o = await this.prepareSendMessagesRequest?.({
3061
3061
  api: this.api,
3062
3062
  id: t.chatId,
@@ -3070,7 +3070,7 @@ var Ki = class {
3070
3070
  requestMetadata: t.metadata,
3071
3071
  trigger: t.trigger,
3072
3072
  messageId: t.messageId
3073
- }), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : Yt(o.headers), l = o?.body === void 0 ? {
3073
+ }), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : Zt(o.headers), l = o?.body === void 0 ? {
3074
3074
  ...n,
3075
3075
  ...t.body,
3076
3076
  id: t.chatId,
@@ -3092,13 +3092,13 @@ var Ki = class {
3092
3092
  url: s,
3093
3093
  fallbackMessage: "Failed to fetch the chat response."
3094
3094
  });
3095
- if (!d.body) throw new St({ message: "The response body is empty." });
3095
+ if (!d.body) throw new Ct({ message: "The response body is empty." });
3096
3096
  return this.processResponseStream(d.body);
3097
3097
  }
3098
3098
  async reconnectToStream(e) {
3099
3099
  let t = await fr(this.body), n = await fr(this.headers), r = await fr(this.credentials), i = {
3100
- ...Yt(n),
3101
- ...Yt(e.headers)
3100
+ ...Zt(n),
3101
+ ...Zt(e.headers)
3102
3102
  }, a = await this.prepareReconnectToStreamRequest?.({
3103
3103
  api: this.api,
3104
3104
  id: e.chatId,
@@ -3118,7 +3118,7 @@ var Ki = class {
3118
3118
  });
3119
3119
  o = Gi(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
3120
3120
  }
3121
- let s = a?.headers === void 0 ? i : Yt(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
3121
+ let s = a?.headers === void 0 ? i : Zt(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
3122
3122
  method: "GET",
3123
3123
  headers: s,
3124
3124
  credentials: c,
@@ -3130,7 +3130,7 @@ var Ki = class {
3130
3130
  url: o,
3131
3131
  fallbackMessage: "Failed to fetch the chat response."
3132
3132
  });
3133
- if (!l.body) throw new St({ message: "The response body is empty." });
3133
+ if (!l.body) throw new Ct({ message: "The response body is empty." });
3134
3134
  return this.processResponseStream(l.body);
3135
3135
  }
3136
3136
  }, qi = class extends Ki {
@@ -3150,7 +3150,7 @@ var Ki = class {
3150
3150
  get id() {
3151
3151
  return this._id ??= this.generateId();
3152
3152
  }
3153
- constructor({ generateId: e = Xt, id: t, transport: n = new qi(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u, experimental_queue: d = !1 }) {
3153
+ constructor({ generateId: e = Qt, id: t, transport: n = new qi(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u, experimental_queue: d = !1 }) {
3154
3154
  this.queuedMessagesFallback = [], this.queuedMessageOptions = /* @__PURE__ */ new Map(), this.isQueuePaused = !1, this.pendingAutomaticDecisions = [], this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.interruptedMessageIds = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new Ci(), this.activeStopCount = 0, this.stopGeneration = 0, this.experimental_removeQueuedMessage = (e) => {
3155
3155
  this.queuedMessageOptions.delete(e), this.setQueuedMessages(this.experimental_queuedMessages.filter((t) => t.id !== e));
3156
3156
  }, this.experimental_sendQueuedMessageNow = async (e) => {
@@ -3169,7 +3169,7 @@ var Ki = class {
3169
3169
  e = this.lastMessage?.id;
3170
3170
  for (let t = this.state.messages.length - 1; t >= 0; t--) {
3171
3171
  let n = this.state.messages[t];
3172
- if (n.role === "assistant" && n.parts.some((e) => Q(e) && e.state === "approval-responded")) {
3172
+ if (n.role === "assistant" && n.parts.some((e) => $(e) && e.state === "approval-responded")) {
3173
3173
  e = n.id;
3174
3174
  break;
3175
3175
  }
@@ -3266,7 +3266,7 @@ var Ki = class {
3266
3266
  }, this.clearError = () => {
3267
3267
  this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
3268
3268
  }, this.addToolApprovalResponse = async ({ id: e, approved: t, reason: n, options: r }) => this.jobExecutor.run(async () => {
3269
- let i = this.stopGeneration, a = this.state.messages, o = (r) => Q(r) && r.state === "approval-requested" && r.approval.id === e ? {
3269
+ let i = this.stopGeneration, a = this.state.messages, o = (r) => $(r) && r.state === "approval-requested" && r.approval.id === e ? {
3270
3270
  ...r,
3271
3271
  state: "approval-responded",
3272
3272
  approval: {
@@ -3275,7 +3275,7 @@ var Ki = class {
3275
3275
  approved: t,
3276
3276
  reason: n
3277
3277
  }
3278
- } : r, s = a.findIndex((t) => t.parts.some((t) => Q(t) && t.state === "approval-requested" && t.approval.id === e));
3278
+ } : r, s = a.findIndex((t) => t.parts.some((t) => $(t) && t.state === "approval-requested" && t.approval.id === e));
3279
3279
  if (s !== -1) {
3280
3280
  let e = a[s];
3281
3281
  this.state.replaceMessage(s, {
@@ -3300,7 +3300,7 @@ var Ki = class {
3300
3300
  this.settleQueue({ stopGeneration: i });
3301
3301
  }), this.addToolOutput = async ({ state: e, toolCallId: t, output: n, errorText: r, options: i }) => this.jobExecutor.run(async () => {
3302
3302
  let a = this.stopGeneration, o = this.state.messages, s = (i) => {
3303
- if (!Q(i) || i.toolCallId !== t) return i;
3303
+ if (!$(i) || i.toolCallId !== t) return i;
3304
3304
  let { approval: a, ...o } = i, s = a?.approved === !0 ? { approval: {
3305
3305
  ...a,
3306
3306
  approved: a.approved
@@ -3320,7 +3320,7 @@ var Ki = class {
3320
3320
  output: n,
3321
3321
  errorText: void 0
3322
3322
  };
3323
- }, c = o.findIndex((e) => e.parts.some((e) => Q(e) && e.toolCallId === t));
3323
+ }, c = o.findIndex((e) => e.parts.some((e) => $(e) && e.toolCallId === t));
3324
3324
  if (c !== -1) {
3325
3325
  let e = o[c];
3326
3326
  this.state.replaceMessage(c, {
@@ -3392,11 +3392,11 @@ var Ki = class {
3392
3392
  }
3393
3393
  isWaitingForUser() {
3394
3394
  let e = this.lastMessage;
3395
- return e?.role === "assistant" && e.parts.some((e) => Q(e) && (e.state === "approval-requested" || e.state === "approval-responded" || !e.providerExecuted && (e.state === "input-streaming" || e.state === "input-available")));
3395
+ return e?.role === "assistant" && e.parts.some((e) => $(e) && (e.state === "approval-requested" || e.state === "approval-responded" || !e.providerExecuted && (e.state === "input-streaming" || e.state === "input-available")));
3396
3396
  }
3397
3397
  hasUnsentApprovalResponse() {
3398
3398
  let e = this.lastMessage;
3399
- return e?.role === "assistant" && e.parts.some((e) => Q(e) && e.state === "approval-responded") && !e.parts.some((e) => Q(e) && (e.state === "approval-requested" || !e.providerExecuted && (e.state === "input-streaming" || e.state === "input-available")));
3399
+ return e?.role === "assistant" && e.parts.some((e) => $(e) && e.state === "approval-responded") && !e.parts.some((e) => $(e) && (e.state === "approval-requested" || !e.providerExecuted && (e.state === "input-streaming" || e.state === "input-available")));
3400
3400
  }
3401
3401
  async settleQueue({ stopGeneration: e = this.stopGeneration, skipWaitForUser: t = !1 } = {}) {
3402
3402
  if (this.isQueuePaused || this.isRequestInProgress() || this.activeStopCount > 0 || e !== this.stopGeneration) return;
@@ -3496,7 +3496,7 @@ var Ki = class {
3496
3496
  status: "submitted",
3497
3497
  error: void 0
3498
3498
  });
3499
- let d = this.lastMessage, f = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, p = f === -1 ? d : this.state.messages[f], m = p?.id, h = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) => Q(e) && (e.state === "input-streaming" || e.state === "input-available" && e.providerExecuted || e.state === "approval-responded")) ? this.state.snapshot(p) : void 0, g = f !== -1 && f < this.state.messages.length - 1 && p?.role === "assistant", _ = !1, v = !1, y = !1, b;
3499
+ let d = this.lastMessage, f = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, p = f === -1 ? d : this.state.messages[f], m = p?.id, h = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) => $(e) && (e.state === "input-streaming" || e.state === "input-available" && e.providerExecuted || e.state === "approval-responded")) ? this.state.snapshot(p) : void 0, g = f !== -1 && f < this.state.messages.length - 1 && p?.role === "assistant", _ = !1, v = !1, y = !1, b;
3500
3500
  try {
3501
3501
  let s = {
3502
3502
  state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : gi({
@@ -3594,7 +3594,7 @@ var Ki = class {
3594
3594
  function Yi({ messages: e }) {
3595
3595
  let t = e[e.length - 1];
3596
3596
  if (!t || t.role !== "assistant") return !1;
3597
- let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
3597
+ let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter($);
3598
3598
  return r.filter((e) => e.state === "approval-responded").length > 0 && r.every((e) => e.state === "output-available" && e.preliminary !== !0 || e.state === "output-error" || e.state === "output-denied" || e.state === "approval-responded");
3599
3599
  }
3600
3600
  // ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.45_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
@@ -3656,12 +3656,12 @@ var ra = {
3656
3656
  return e.json();
3657
3657
  });
3658
3658
  }
3659
- }, $ = function() {
3660
- return $ = Object.assign || function(e) {
3659
+ }, ia = function() {
3660
+ return ia = Object.assign || function(e) {
3661
3661
  for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
3662
3662
  return e;
3663
- }, $.apply(this, arguments);
3664
- }, ia = function(e, t, n, r) {
3663
+ }, ia.apply(this, arguments);
3664
+ }, aa = function(e, t, n, r) {
3665
3665
  function i(e) {
3666
3666
  return e instanceof n ? e : new n(function(t) {
3667
3667
  t(e);
@@ -3687,7 +3687,7 @@ var ra = {
3687
3687
  }
3688
3688
  c((r = r.apply(e, t || [])).next());
3689
3689
  });
3690
- }, aa = function(e, t) {
3690
+ }, oa = function(e, t) {
3691
3691
  var n = {
3692
3692
  label: 0,
3693
3693
  sent: function() {
@@ -3760,7 +3760,7 @@ var ra = {
3760
3760
  done: !0
3761
3761
  };
3762
3762
  }
3763
- }, oa = function(e, t) {
3763
+ }, sa = function(e, t) {
3764
3764
  var n = typeof Symbol == "function" && e[Symbol.iterator];
3765
3765
  if (!n) return e;
3766
3766
  var r = n.call(e), i, a = [], o;
@@ -3776,11 +3776,11 @@ var ra = {
3776
3776
  }
3777
3777
  }
3778
3778
  return a;
3779
- }, sa = function(e, t, n) {
3779
+ }, ca = function(e, t, n) {
3780
3780
  if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
3781
3781
  return e.concat(a || Array.prototype.slice.call(t));
3782
- }, ca = new ea(), la = new ea(), ua = new ea(), da = {
3783
- cache: ca,
3782
+ }, la = new ea(), ua = new ea(), da = new ea(), fa = {
3783
+ cache: la,
3784
3784
  refreshInterval: 0,
3785
3785
  ttl: 0,
3786
3786
  serverTTL: 1e3,
@@ -3794,11 +3794,11 @@ var ra = {
3794
3794
  isOnline: ra.isOnline,
3795
3795
  isDocumentVisible: ra.isDocumentVisible
3796
3796
  };
3797
- function fa(e, t, n) {
3798
- var r = la.get(e);
3799
- r ? r.data.push(t) : la.set(e, [t], n > 0 ? n + 5e3 : n);
3800
- }
3801
3797
  function pa(e, t, n) {
3798
+ var r = ua.get(e);
3799
+ r ? r.data.push(t) : ua.set(e, [t], n > 0 ? n + 5e3 : n);
3800
+ }
3801
+ function ma(e, t, n) {
3802
3802
  if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
3803
3803
  var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
3804
3804
  setTimeout(function() {
@@ -3809,17 +3809,17 @@ function pa(e, t, n) {
3809
3809
  }, i);
3810
3810
  }
3811
3811
  }
3812
- function ma(e) {
3812
+ function ha(e) {
3813
3813
  var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
3814
- return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : da.shouldRetryOnError;
3814
+ return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : fa.shouldRetryOnError;
3815
3815
  }
3816
- var ha = function(e, t, n, r) {
3817
- return n === void 0 && (n = ca), r === void 0 && (r = da.ttl), ia(void 0, void 0, void 0, function() {
3816
+ var ga = function(e, t, n, r) {
3817
+ return n === void 0 && (n = la), r === void 0 && (r = fa.ttl), aa(void 0, void 0, void 0, function() {
3818
3818
  var i, a, o, s, c, l, u;
3819
- return aa(this, function(d) {
3819
+ return oa(this, function(d) {
3820
3820
  switch (d.label) {
3821
3821
  case 0:
3822
- if (!_a(t)) return [3, 5];
3822
+ if (!va(t)) return [3, 5];
3823
3823
  d.label = 1;
3824
3824
  case 1: return d.trys.push([
3825
3825
  1,
@@ -3841,7 +3841,7 @@ var ha = function(e, t, n, r) {
3841
3841
  } catch (e) {
3842
3842
  console.error("swrv(mutate): failed to set cache", e);
3843
3843
  }
3844
- return l = la.get(e), l && l.data.length && (u = l.data.filter(function(t) {
3844
+ return l = ua.get(e), l && l.data.length && (u = l.data.filter(function(t) {
3845
3845
  return t.key === e;
3846
3846
  }), u.forEach(function(e, t) {
3847
3847
  c.data !== void 0 && (e.data = c.data), e.error = c.error, e.isValidating = c.isValidating, e.isLoading = c.isValidating, t !== u.length - 1 && delete u[t];
@@ -3850,16 +3850,16 @@ var ha = function(e, t, n, r) {
3850
3850
  });
3851
3851
  });
3852
3852
  };
3853
- function ga() {
3853
+ function _a() {
3854
3854
  for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
3855
- var r, i, a = $({}, da), o = !1, s = !1;
3855
+ var r, i, a = ia({}, fa), o = !1, s = !1;
3856
3856
  if (!E()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
3857
3857
  var c = typeof window > "u" || typeof document > "u";
3858
- t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
3858
+ t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = ia(ia({}, a), t[2]));
3859
3859
  var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : D(r);
3860
3860
  i === void 0 && (i = a.fetcher);
3861
3861
  var d = null;
3862
- d ||= $e({
3862
+ d ||= et({
3863
3863
  data: void 0,
3864
3864
  error: void 0,
3865
3865
  isValidating: !0,
@@ -3867,32 +3867,32 @@ function ga() {
3867
3867
  key: null
3868
3868
  });
3869
3869
  var f = function(t, n) {
3870
- return ia(e, void 0, void 0, function() {
3870
+ return aa(e, void 0, void 0, function() {
3871
3871
  var e, r, s, c, p, m, h, g = this;
3872
- return aa(this, function(_) {
3872
+ return oa(this, function(_) {
3873
3873
  switch (_.label) {
3874
3874
  case 0: return e = d.data === void 0, r = u.value, r ? (s = a.cache.get(r), c = s && s.data, d.isValidating = !0, d.isLoading = !c, c && (d.data = c.data, d.error = c.error), p = t || i, !p || !a.isDocumentVisible() && !e || n?.forceRevalidate !== void 0 && !n?.forceRevalidate || s && (m = !!(Date.now() - s.createdAt >= a.dedupingInterval || n?.forceRevalidate), !m) ? (d.isValidating = !1, d.isLoading = !1, [2]) : (h = function() {
3875
- return ia(g, void 0, void 0, function() {
3875
+ return aa(g, void 0, void 0, function() {
3876
3876
  var e, t, i, s, c, u;
3877
- return aa(this, function(m) {
3877
+ return oa(this, function(m) {
3878
3878
  switch (m.label) {
3879
- case 0: return e = ua.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, sa([], oa(t), !1)), ua.set(r, i, a.dedupingInterval), [4, ha(r, i, a.cache, l)]);
3879
+ case 0: return e = da.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, ca([], sa(t), !1)), da.set(r, i, a.dedupingInterval), [4, ga(r, i, a.cache, l)]);
3880
3880
  case 1: return m.sent(), [3, 4];
3881
- case 2: return [4, ha(r, e.data, a.cache, l)];
3881
+ case 2: return [4, ga(r, e.data, a.cache, l)];
3882
3882
  case 3: m.sent(), m.label = 4;
3883
- case 4: return d.isValidating = !1, d.isLoading = !1, ua.delete(r), d.error !== void 0 && (s = ma({
3883
+ case 4: return d.isValidating = !1, d.isLoading = !1, da.delete(r), d.error !== void 0 && (s = ha({
3884
3884
  shouldRetry: a.shouldRetryOnError,
3885
3885
  error: d.error
3886
- }), c = ma({
3886
+ }), c = ha({
3887
3887
  shouldRetry: !n || n.shouldRetryOnError,
3888
3888
  error: d.error
3889
- }), u = !o && s && c, u && pa(f, n ? n.errorRetryCount : 1, a)), [2];
3889
+ }), u = !o && s && c, u && ma(f, n ? n.errorRetryCount : 1, a)), [2];
3890
3890
  }
3891
3891
  });
3892
3892
  });
3893
3893
  }, c && a.revalidateDebounce ? (setTimeout(function() {
3894
- return ia(g, void 0, void 0, function() {
3895
- return aa(this, function(e) {
3894
+ return aa(g, void 0, void 0, function() {
3895
+ return oa(this, function(e) {
3896
3896
  switch (e.label) {
3897
3897
  case 0: return o ? [3, 2] : [4, h()];
3898
3898
  case 1: e.sent(), e.label = 2;
@@ -3908,16 +3908,16 @@ function ga() {
3908
3908
  });
3909
3909
  });
3910
3910
  }, p = function() {
3911
- return ia(e, void 0, void 0, function() {
3912
- return aa(this, function(e) {
3911
+ return aa(e, void 0, void 0, function() {
3912
+ return oa(this, function(e) {
3913
3913
  return [2, f(null, { shouldRetryOnError: !1 })];
3914
3914
  });
3915
3915
  });
3916
3916
  }, m = null;
3917
3917
  if (!c) {
3918
3918
  var h = function() {
3919
- return ia(e, void 0, void 0, function() {
3920
- return aa(this, function(e) {
3919
+ return aa(e, void 0, void 0, function() {
3920
+ return oa(this, function(e) {
3921
3921
  switch (e.label) {
3922
3922
  case 0: return d.error || !a.isOnline() ? [3, 2] : [4, f()];
3923
3923
  case 1: return e.sent(), [3, 3];
@@ -3929,40 +3929,40 @@ function ga() {
3929
3929
  };
3930
3930
  a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
3931
3931
  }
3932
- Qe(function() {
3932
+ $e(function() {
3933
3933
  o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
3934
- var e = la.get(u.value);
3934
+ var e = ua.get(u.value);
3935
3935
  e && (e.data = e.data.filter(function(e) {
3936
3936
  return e !== d;
3937
3937
  }));
3938
3938
  });
3939
3939
  try {
3940
3940
  k(u, function(e) {
3941
- Xe(u) || (u.value = e), d.key = e, d.isValidating = !!e, fa(u.value, d, l), !c && !s && u.value && f(), s = !1;
3941
+ Ze(u) || (u.value = e), d.key = e, d.isValidating = !!e, pa(u.value, d, l), !c && !s && u.value && f(), s = !1;
3942
3942
  }, { immediate: !0 });
3943
3943
  } catch {}
3944
- return $($({}, et(d)), { mutate: function(e, t) {
3945
- return f(e, $($({}, t), { forceRevalidate: !0 }));
3944
+ return ia(ia({}, tt(d)), { mutate: function(e, t) {
3945
+ return f(e, ia(ia({}, t), { forceRevalidate: !0 }));
3946
3946
  } });
3947
3947
  }
3948
- function _a(e) {
3948
+ function va(e) {
3949
3949
  return typeof e == "object" && !!e && typeof e.then == "function";
3950
3950
  }
3951
3951
  // ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.45_typescript@6.0.3_/node_modules/swrv/esm/index.js
3952
- var va = ga;
3953
- va.default, va.default;
3954
- function ya(e) {
3952
+ var ya = _a;
3953
+ ya.default, ya.default;
3954
+ function ba(e) {
3955
3955
  return Array.isArray(e) ? [...e] : typeof e == "object" && e && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
3956
3956
  }
3957
- function ba(e) {
3957
+ function xa(e) {
3958
3958
  if (typeof e != "object" || !e || !("parts" in e) || !Array.isArray(e.parts)) return e;
3959
3959
  let t = e, n = {
3960
3960
  ...t,
3961
3961
  parts: t.parts.map((e) => ({ ...e }))
3962
3962
  };
3963
- return "metadata" in t && (n.metadata = ya(t.metadata)), n;
3963
+ return "metadata" in t && (n.metadata = ba(t.metadata)), n;
3964
3964
  }
3965
- var xa = class {
3965
+ var Sa = class {
3966
3966
  constructor({ initialMessages: e, messagesRef: t, statusRef: n, errorRef: r, queuedMessagesRef: i, throttleWaitMs: a }) {
3967
3967
  this.publishedMessages = [], this.publishedMessageSources = [], this.dirtyMessageIndices = /* @__PURE__ */ new Set(), this.statusValue = "ready", this.queuedMessagesValue = [], this.hasPendingPublication = !1, this.isActive = !0, this.isPublishing = !1, this.pushMessage = (e) => {
3968
3968
  this.messagesValue.push(e), this.dirtyMessageIndices.add(this.messagesValue.length - 1), this.schedulePublication();
@@ -3970,7 +3970,7 @@ var xa = class {
3970
3970
  this.messagesValue.pop(), this.schedulePublication();
3971
3971
  }, this.replaceMessage = (e, t) => {
3972
3972
  this.messagesValue[e] = t, this.dirtyMessageIndices.add(e), this.schedulePublication();
3973
- }, this.snapshot = ba, this.handleIntervalEnd = () => {
3973
+ }, this.snapshot = xa, this.handleIntervalEnd = () => {
3974
3974
  this.timeout = void 0, this.isActive && this.hasPendingPublication && (this.hasPendingPublication = !1, this.publishMessages(), this.timeout = setTimeout(this.handleIntervalEnd, this.throttleWaitMs));
3975
3975
  }, this.messagesValue = e, this.messagesRef = t, this.statusRef = n, this.errorRef = r, this.queuedMessagesRef = i, this.throttleWaitMs = a != null && Number.isFinite(a) && a > 0 ? a : void 0;
3976
3976
  }
@@ -4018,7 +4018,7 @@ var xa = class {
4018
4018
  }
4019
4019
  publishMessages() {
4020
4020
  if (!this.isActive) return;
4021
- let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ? ba(e) : this.publishedMessages[t]);
4021
+ let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ? xa(e) : this.publishedMessages[t]);
4022
4022
  this.publishedMessages = e, this.publishedMessageSources = [...this.messagesValue], this.dirtyMessageIndices.clear(), this.isPublishing = !0;
4023
4023
  try {
4024
4024
  this.messagesRef.value = e;
@@ -4026,7 +4026,7 @@ var xa = class {
4026
4026
  this.isPublishing = !1;
4027
4027
  }
4028
4028
  }
4029
- }, Sa = class extends Ji {
4029
+ }, Ca = class extends Ji {
4030
4030
  constructor({ state: e, ...t }) {
4031
4031
  super({
4032
4032
  ...t,
@@ -4034,13 +4034,13 @@ var xa = class {
4034
4034
  });
4035
4035
  }
4036
4036
  };
4037
- function Ca(e) {
4037
+ function wa(e) {
4038
4038
  let t = O([]), n = O("ready"), r = O(), i = O([]), a = O(), o;
4039
4039
  return k(t, (e) => {
4040
4040
  o != null && !o.isPublishing && o.setMessagesFromConsumer(e);
4041
- }, { flush: "sync" }), k(() => tt(e), (e) => {
4041
+ }, { flush: "sync" }), k(() => nt(e), (e) => {
4042
4042
  o?.dispose();
4043
- let { throttle: s, ...c } = e ?? {}, l = new xa({
4043
+ let { throttle: s, ...c } = e ?? {}, l = new Sa({
4044
4044
  initialMessages: c.messages ?? [],
4045
4045
  messagesRef: t,
4046
4046
  statusRef: n,
@@ -4048,11 +4048,11 @@ function Ca(e) {
4048
4048
  queuedMessagesRef: i,
4049
4049
  throttleWaitMs: s
4050
4050
  });
4051
- o = l, l.publishInitialState(), a.value = new Sa({
4051
+ o = l, l.publishInitialState(), a.value = new Ca({
4052
4052
  ...c,
4053
4053
  state: l
4054
4054
  });
4055
- }, { immediate: !0 }), E() != null && Qe(() => {
4055
+ }, { immediate: !0 }), E() != null && $e(() => {
4056
4056
  o?.dispose();
4057
4057
  }), {
4058
4058
  id: T(() => a.value.id),
@@ -4072,28 +4072,28 @@ function Ca(e) {
4072
4072
  };
4073
4073
  }
4074
4074
  // ../../packages/composable/src/chatbot/useChatbotStore.ts
4075
- var wa = "voice-", Ta = 300, Ea = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), Da = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Oa = (e) => Da(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), ka = 8, Aa = (e, t) => {
4075
+ var Ta = "voice-", Ea = 300, Da = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), Oa = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), ka = (e) => Oa(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Aa = 8, ja = (e, t) => {
4076
4076
  let n = new Set(t.map((e) => e.id)), r = e.filter((e) => e.role === "user" && !n.has(e.id)).map((e) => ({
4077
- text: Oa(e),
4077
+ text: ka(e),
4078
4078
  taken: !1
4079
4079
  }));
4080
4080
  return t.filter((e) => {
4081
4081
  if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
4082
- let t = Oa(e), n = r.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= ka && t.endsWith(e.text)));
4082
+ let t = ka(e), n = r.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Aa && t.endsWith(e.text)));
4083
4083
  return !n || (n.taken = !0, !1);
4084
4084
  });
4085
- }, ja = 12e4, Ma = 1e3, Na = 5e3, Pa = 100, Fa = 3e4, Ia = 5e3, La = 250, Ra = 1e3, za = "\n\n", Ba = (e) => {
4085
+ }, Ma = 12e4, Na = 1e3, Pa = 5e3, Fa = 100, Ia = 3e4, La = 5e3, Ra = 250, za = 1e3, Ba = "\n\n", Va = (e) => {
4086
4086
  let t = e.type ?? "";
4087
4087
  return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
4088
- }, Va = (e) => e?.role === "assistant" && e.parts.some((e) => Re(Ba(e)) && !e.providerExecuted && !Ge.has(e.state ?? "")), Ha = ({ messages: e }) => {
4088
+ }, Ha = (e) => e?.role === "assistant" && e.parts.some((e) => Ve(Va(e)) && !e.providerExecuted && !Le.has(e.state ?? "")), Ua = ({ messages: e }) => {
4089
4089
  let t = e[e.length - 1];
4090
4090
  if (!t || t.role !== "assistant") return !1;
4091
- let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && (Re(Ba(e)) || We(e)));
4092
- return r.length > 0 && r.every((e) => Ge.has(e.state ?? ""));
4091
+ let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && (Ve(Va(e)) || qe(e)));
4092
+ return r.length > 0 && r.every((e) => Le.has(e.state ?? ""));
4093
4093
  };
4094
- function Ua(e) {
4094
+ function Wa(e) {
4095
4095
  return A(`chatbot-${e}`, () => {
4096
- let { t, te: n, locale: r } = rt({ useScope: "global" }), i = D(""), a = D(), o = D(e), s = D(), c = D(), l = D(), u = D(), d = D(), f = D(), p = D(), m = D(), h = D(), g = D(), _ = D(), v = D(), y = D(), b = D(), ee = D(), te = D(), ne = O(), re = D(0), ie = D(0), ae = D(), oe = D(), x = D(), se = O(), ce = O(), le = D(), ue = D(), de = O(), fe = D(!1), pe = D({}), me = D({}), he = D(!1), ge = D(0), _e = D(), ve = D(!1), ye = at(), S = T(() => {
4096
+ let { t, te: n, locale: r } = it({ useScope: "global" }), i = D(""), a = D(), o = D(e), s = D(), c = D(), l = D(), u = D(), d = D(), f = D(), p = D(), m = D(), h = D(), g = D(), _ = D(), v = D(), y = D(), b = D(), ee = D(), te = D(), ne = O(), re = D(0), ie = D(0), ae = D(), oe = D(), x = D(), se = O(), ce = O(), le = D(), ue = D(), de = O(), fe = D(!1), pe = D({}), me = D({}), he = D(!1), ge = D(0), _e = D(), ve = D(!1), ye = ot(), S = T(() => {
4097
4097
  let e = u.value?.theme;
4098
4098
  return e && e !== "auto" || (e = _e.value), e ? e === "dark" : ye.value;
4099
4099
  }), C = T(() => c.value === "reasoning"), be = T(() => C.value ? g.value?.filter((e) => ![
@@ -4101,8 +4101,8 @@ function Ua(e) {
4101
4101
  "downvote",
4102
4102
  "feedback"
4103
4103
  ].includes(e)) : g.value), xe = Ie(T(() => `${o.value}-chatId`), null);
4104
- nt(() => {
4105
- xe.value ||= Xt();
4104
+ rt(() => {
4105
+ xe.value ||= Qt();
4106
4106
  });
4107
4107
  let w = T({
4108
4108
  get: () => xe.value,
@@ -4119,12 +4119,12 @@ function Ua(e) {
4119
4119
  });
4120
4120
  let je = Ie(T(() => `${o.value}-pageNotice`), null), Me = T(() => {
4121
4121
  let e = ae.value?.level;
4122
- return e && e !== Le.Off && Ce.value.length && !He(je.value ?? void 0, e) ? e : void 0;
4122
+ return e && e !== Be.Off && Ce.value.length && !Ge(je.value ?? void 0, e) ? e : void 0;
4123
4123
  });
4124
4124
  function Ne() {
4125
4125
  je.value = ae.value?.level ?? null;
4126
4126
  }
4127
- let Pe = D(), Re = D(!1), Be = T(() => Pe.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
4127
+ let Pe = D(), Le = D(!1), Ve = T(() => Pe.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
4128
4128
  function Ue(e) {
4129
4129
  try {
4130
4130
  let t = JSON.parse(e.message);
@@ -4133,31 +4133,31 @@ function Ua(e) {
4133
4133
  return !1;
4134
4134
  }
4135
4135
  }
4136
- function Ge(e) {
4137
- if (Ue(e)) {
4138
- let e = I.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? Je(t) : void 0;
4139
- w.value = Xt(), Pe.value = void 0, Ze(() => {
4140
- I.value.clearError(), n && I.value.sendMessage({ text: n });
4136
+ function Ke(e) {
4137
+ if (Ue(e) && !I.value) {
4138
+ let e = F.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? Ye(t) : void 0;
4139
+ w.value = Qt(), Pe.value = void 0, Qe(() => {
4140
+ F.value.clearError(), n && F.value.sendMessage({ text: n });
4141
4141
  });
4142
- } else Ye.error(e), Pe.value = e, Be.value && (Re.value = !0);
4142
+ } else Xe.error(e), Pe.value = e, Ve.value && (Le.value = !0);
4143
4143
  }
4144
- let E = T(() => Ke({
4144
+ let E = T(() => ze({
4145
4145
  baseUrl: i.value,
4146
4146
  basePath: a.value,
4147
4147
  headers: () => p.value
4148
- })), Xe = D(null), et = () => ({
4149
- ...ot(),
4150
- ...Xe.value ?? {}
4151
- }), tt = () => {
4148
+ })), Ze = D(null), tt = () => ({
4149
+ ...st(),
4150
+ ...Ze.value ?? {}
4151
+ }), nt = () => {
4152
4152
  let e = ge.value;
4153
4153
  return new Promise((t) => {
4154
4154
  let n = setTimeout(() => {
4155
4155
  r(), t(!1);
4156
- }, 3e4), r = k(() => [ge.value, I.value.status], ([i, a]) => {
4156
+ }, 3e4), r = k(() => [ge.value, F.value.status], ([i, a]) => {
4157
4157
  i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
4158
4158
  });
4159
4159
  });
4160
- }, A = O(), lt = (e, t) => new Promise((n) => {
4160
+ }, A = O(), ut = (e, t) => new Promise((n) => {
4161
4161
  A.value?.answer(!1), A.value = {
4162
4162
  toolCallId: e.toolCallId,
4163
4163
  question: t?.question,
@@ -4168,10 +4168,10 @@ function Ua(e) {
4168
4168
  }
4169
4169
  };
4170
4170
  });
4171
- function pt(e) {
4171
+ function mt(e) {
4172
4172
  A.value?.answer(e);
4173
4173
  }
4174
- let mt = (e, t) => {
4174
+ let ht = (e, t) => {
4175
4175
  t.details?.some((e) => e.before !== void 0) && (me.value = {
4176
4176
  ...me.value,
4177
4177
  [e.toolCallId]: {
@@ -4181,14 +4181,14 @@ function Ua(e) {
4181
4181
  });
4182
4182
  }, j = ({ forms: e }) => ae.value && Ce.value.length ? {
4183
4183
  version: 1,
4184
- features: [...ze],
4184
+ features: [...He],
4185
4185
  forms: e ? we().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
4186
4186
  name: e,
4187
4187
  description: t,
4188
4188
  inputSchema: n,
4189
4189
  annotations: r
4190
4190
  })) : []
4191
- } : void 0, ht = (e) => {
4191
+ } : void 0, gt = (e) => {
4192
4192
  if (e?.provider !== "page") {
4193
4193
  le.value = void 0;
4194
4194
  return;
@@ -4203,29 +4203,29 @@ function Ua(e) {
4203
4203
  ...pe.value,
4204
4204
  [e.toolCallId]: n
4205
4205
  }), e.readOnly ? le.value = void 0 : (le.value = { title: n ?? t?.annotations?.title ?? e.toolName }, he.value = !0);
4206
- }, gt = ft({
4206
+ }, _t = pt({
4207
4207
  registry: () => [
4208
- ...(ne.value ?? []).filter((e) => !Ve(e.name)),
4208
+ ...(ne.value ?? []).filter((e) => !We(e.name)),
4209
4209
  ...Ce.value,
4210
4210
  ...we()
4211
4211
  ],
4212
4212
  capability: () => te.value,
4213
- addToolOutput: (e) => void I.value.addToolOutput(e),
4214
- confirm: lt,
4215
- waitForResume: tt,
4213
+ addToolOutput: (e) => void F.value.addToolOutput(e),
4214
+ confirm: ut,
4215
+ waitForResume: nt,
4216
4216
  onPendingChange: (e) => {
4217
4217
  re.value = e;
4218
4218
  },
4219
- onActivity: ht,
4219
+ onActivity: gt,
4220
4220
  mode: () => Oe.value,
4221
- onSkip: mt
4222
- }), _t = /* @__PURE__ */ new Map(), vt = 0, yt = (e, t) => {
4223
- let n = _t.get(e);
4224
- _t.delete(e), n?.(JSON.stringify(t));
4225
- }, bt = ft({
4221
+ onSkip: ht
4222
+ }), vt = /* @__PURE__ */ new Map(), yt = 0, bt = (e, t) => {
4223
+ let n = vt.get(e);
4224
+ vt.delete(e), n?.(JSON.stringify(t));
4225
+ }, xt = pt({
4226
4226
  registry: () => Ce.value,
4227
4227
  capability: () => te.value,
4228
- addToolOutput: (e) => yt(e.toolCallId, "output" in e ? e.output : {
4228
+ addToolOutput: (e) => bt(e.toolCallId, "output" in e ? e.output : {
4229
4229
  content: [{
4230
4230
  type: "text",
4231
4231
  text: e.errorText
@@ -4238,37 +4238,37 @@ function Ua(e) {
4238
4238
  n || (t(), e());
4239
4239
  });
4240
4240
  });
4241
- return _t.has(e.toolCallId) ? lt(e, t) : !1;
4241
+ return vt.has(e.toolCallId) ? ut(e, t) : !1;
4242
4242
  },
4243
- waitForResume: () => new Promise((e) => setTimeout(() => e(!0), Ta)),
4243
+ waitForResume: () => new Promise((e) => setTimeout(() => e(!0), Ea)),
4244
4244
  onPendingChange: (e) => {
4245
4245
  ie.value = e;
4246
4246
  },
4247
- onActivity: ht,
4248
- mode: () => xt
4249
- }), xt = "manual";
4250
- function St() {
4251
- xt = Oe.value;
4247
+ onActivity: gt,
4248
+ mode: () => St
4249
+ }), St = "manual";
4250
+ function Ct() {
4251
+ St = Oe.value;
4252
4252
  let e = j({ forms: !1 });
4253
4253
  if (e) return {
4254
4254
  declaration: e,
4255
4255
  clientTools: Object.fromEntries(Ce.value.map((e) => [e.name, (t) => new Promise((n) => {
4256
- vt += 1;
4257
- let r = `page-call-${vt}`;
4258
- _t.set(r, n), bt.enqueue({
4256
+ yt += 1;
4257
+ let r = `page-call-${yt}`;
4258
+ vt.set(r, n), xt.enqueue({
4259
4259
  toolCallId: r,
4260
4260
  toolName: e.name,
4261
4261
  input: t ?? {},
4262
- messageId: Lt()?.id ?? "",
4262
+ messageId: zt()?.id ?? "",
4263
4263
  readOnly: e.annotations?.readOnlyHint === !0,
4264
4264
  provider: "page"
4265
4265
  });
4266
4266
  })]))
4267
4267
  };
4268
4268
  }
4269
- function Ct() {
4270
- bt.cancelAll(), A.value && _t.has(A.value.toolCallId) && A.value.answer(!1);
4271
- for (let e of [..._t.keys()]) yt(e, {
4269
+ function wt() {
4270
+ xt.cancelAll(), A.value && vt.has(A.value.toolCallId) && A.value.answer(!1);
4271
+ for (let e of [...vt.keys()]) bt(e, {
4272
4272
  content: [{
4273
4273
  type: "text",
4274
4274
  text: "Stopped by the user."
@@ -4276,30 +4276,30 @@ function Ua(e) {
4276
4276
  isError: !0
4277
4277
  });
4278
4278
  }
4279
- async function wt() {
4280
- Tt(), Ct(), le.value = void 0, he.value = !1, H.value = "", await I.value.stop();
4279
+ async function Tt() {
4280
+ Et(), wt(), le.value = void 0, he.value = !1, W.value = "", await F.value.stop();
4281
4281
  }
4282
- function Tt() {
4283
- gt.cancelAll(), A.value && !_t.has(A.value.toolCallId) && A.value.answer(!1);
4282
+ function Et() {
4283
+ _t.cancelAll(), A.value && !vt.has(A.value.toolCallId) && A.value.answer(!1);
4284
4284
  }
4285
- async function Et(e) {
4286
- Se.value = e, e && await wt();
4285
+ async function Dt(e) {
4286
+ Se.value = e, e && await Tt();
4287
4287
  }
4288
- k(w, () => Tt(), { flush: "sync" });
4289
- let Dt = !1, M, Ot = D(), kt, At = D([]), N = D([]), P = D([]), F = D({}), jt = /* @__PURE__ */ new Map(), Mt = /* @__PURE__ */ new Set();
4290
- function Nt(e, t, n) {
4291
- N.value.includes(e) || (N.value = [...N.value, e]), jt.set(e, Date.now()), n ? Mt.add(e) : Mt.delete(e), t && (F.value = {
4292
- ...F.value,
4288
+ k(w, () => Et(), { flush: "sync" });
4289
+ let Ot = !1, M, kt = D(), At, jt = D([]), N = D([]), P = D([]), Mt = D({}), Nt = /* @__PURE__ */ new Map(), Pt = /* @__PURE__ */ new Set();
4290
+ function Ft(e, t, n) {
4291
+ N.value.includes(e) || (N.value = [...N.value, e]), Nt.set(e, Date.now()), n ? Pt.add(e) : Pt.delete(e), t && (Mt.value = {
4292
+ ...Mt.value,
4293
4293
  [e]: t
4294
- }), qn || Xn();
4294
+ }), nr || ar();
4295
4295
  }
4296
- function Pt(e) {
4297
- F.value = Object.fromEntries(Object.entries(F.value).filter(([t]) => t !== e));
4296
+ function It(e) {
4297
+ Mt.value = Object.fromEntries(Object.entries(Mt.value).filter(([t]) => t !== e));
4298
4298
  }
4299
- function Ft(e) {
4300
- jt.delete(e), N.value = N.value.filter((t) => t !== e), P.value = P.value.filter((t) => t !== e), Pt(e);
4299
+ function Lt(e) {
4300
+ Nt.delete(e), N.value = N.value.filter((t) => t !== e), P.value = P.value.filter((t) => t !== e), It(e);
4301
4301
  }
4302
- let It = Ca(() => ({
4302
+ let Rt = wa(() => ({
4303
4303
  id: w.value,
4304
4304
  transport: new qi({
4305
4305
  api: E.value.getChatEndpoint(o.value, C.value ? "reasoning" : "chat"),
@@ -4318,60 +4318,61 @@ function Ua(e) {
4318
4318
  reasoning: d.value?.reasoning,
4319
4319
  webSearch: f.value?.webSearch,
4320
4320
  smoothStream: u.value?.smoothStream,
4321
- deviceContext: et(),
4321
+ deviceContext: tt(),
4322
4322
  externalContext: ee.value,
4323
4323
  disabledTools: f.value?.disabled,
4324
4324
  fallbackModels: y.value,
4325
4325
  gatewayOptions: b.value,
4326
- hostTools: dt(ne.value, te.value),
4326
+ hostTools: ft(ne.value, te.value),
4327
4327
  pageTools: j({ forms: !0 }),
4328
+ ...Zt(t) && { projectId: Zt(t) },
4328
4329
  ...Oe.value === "automatic" && { confirmations: "automatic" }
4329
4330
  } }),
4330
4331
  credentials: "include",
4331
4332
  headers: () => p.value ?? {}
4332
4333
  }),
4333
- sendAutomaticallyWhen: (e) => Ha(e) || Yi(e),
4334
+ sendAutomaticallyWhen: (e) => !I.value && (Ua(e) || Yi(e)),
4334
4335
  onError: (e) => {
4335
- Dt ? Ye.warn(e) : Ge(e);
4336
+ Ot ? Xe.warn(e) : Ke(e);
4336
4337
  },
4337
4338
  onToolCall: ({ toolCall: e }) => {
4338
- if (!ut(e) || Dt) return;
4339
+ if (!dt(e) || Ot || I.value) return;
4339
4340
  let t = e;
4340
- gt.enqueue({
4341
+ _t.enqueue({
4341
4342
  toolCallId: t.toolCallId,
4342
4343
  toolName: t.toolName,
4343
4344
  input: t.input,
4344
- messageId: Lt()?.id ?? "",
4345
+ messageId: zt()?.id ?? "",
4345
4346
  readOnly: t.toolMetadata?.readOnly === !0,
4346
4347
  provider: t.toolMetadata?.provider === "page" ? "page" : "app"
4347
4348
  });
4348
4349
  },
4349
4350
  onData: (e) => {
4350
- e.type === "data-turnStream" ? kt = e.data.streamId : e.type === "data-audioTranscripts" && (I.value.messages = qe(I.value.messages, e.data));
4351
+ e.type === "data-turnStream" ? At = e.data.streamId : e.type === "data-audioTranscripts" && (F.value.messages = Je(F.value.messages, e.data));
4351
4352
  },
4352
4353
  onFinish: () => {
4353
4354
  let e = w.value;
4354
- !C.value && !L.value.some((t) => t.id === e) && _n(o.value);
4355
+ !C.value && !R.value.some((t) => t.id === e) && q(o.value);
4355
4356
  }
4356
- })), I = T(() => $e(It)), Lt = () => I.value.messages[I.value.messages.length - 1];
4357
+ })), F = T(() => et(Rt)), zt = () => F.value.messages[F.value.messages.length - 1];
4357
4358
  k(w, (e, t) => {
4358
- if (t && !C.value && (K() || M?.chatId === t)) {
4359
- let e = I.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
4360
- Nt(t, n ? Je(n) ?? "" : "", I.value.status === "streaming" || M?.chatId === t);
4359
+ if (t && !C.value && (Nn() || M?.chatId === t)) {
4360
+ let e = F.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
4361
+ Ft(t, n ? Ye(n) ?? "" : "", F.value.status === "streaming" || M?.chatId === t);
4361
4362
  }
4362
- Ft(e), kt = void 0, clearTimeout(Wn), Un.value = !1, I.value.stop();
4363
+ Lt(e), At = void 0, clearTimeout(Qn), Zn.value = !1, F.value.stop();
4363
4364
  }, { flush: "sync" });
4364
- let Rt = T(() => {
4365
+ let Bt = T(() => {
4365
4366
  let e = u.value?.initialMessage;
4366
4367
  return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
4367
- }), zt = Xt(), Bt = T(() => ({
4368
- id: zt,
4368
+ }), Vt = Qt(), Ht = T(() => ({
4369
+ id: Vt,
4369
4370
  role: "assistant",
4370
4371
  parts: [{
4371
4372
  type: "text",
4372
- text: Rt.value
4373
+ text: Bt.value
4373
4374
  }]
4374
- })), Vt = T(() => {
4375
+ })), Ut = T(() => {
4375
4376
  let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
4376
4377
  ...e,
4377
4378
  parts: e.parts.map((e) => {
@@ -4389,152 +4390,169 @@ function Ua(e) {
4389
4390
  url: E.value.appendAuthToken(t.url)
4390
4391
  };
4391
4392
  })
4392
- }), t = I.value.id === w.value ? I.value.messages : [];
4393
- return C.value ? e(t) : !ve.value && t[0]?.role !== "assistant" ? [Bt.value, ...e(t)] : e(t);
4394
- }), Ht = T(() => {
4393
+ }), t = F.value.id === w.value ? F.value.messages : [];
4394
+ return C.value ? e(t) : !ve.value && t[0]?.role !== "assistant" ? [Ht.value, ...e(t)] : e(t);
4395
+ }), Wt = T(() => {
4395
4396
  let e = u.value?.messagePlaceholder;
4396
4397
  return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
4397
- }), L = D([]), Ut = D(!1), Wt = D(1), Gt = D(!1), Kt = D(!1), qt, Jt = D([]), Yt = D(!1), R = D("chat"), Zt = D(0), Qt = D([]), $t = D(), en = D(!1), tn = D(!1), nn = D(), rn = D(!1), z = D(!1), an = D(), B = D(""), V = D([]), H = D(""), on = D(!0), sn = O(), cn = D(0), ln = Fe(T(() => `${o.value}-queue`), {}), un = T(() => ln.value[w.value] ?? []), dn = T(() => !C.value);
4398
- function fn(e, t) {
4399
- let n = Object.fromEntries(Object.entries(ln.value).filter(([t]) => t !== e));
4400
- ln.value = t.length > 0 ? {
4398
+ }), Gt = D(!1), Kt = D();
4399
+ function qt(e, t) {
4400
+ Kt.value = {
4401
+ chatId: e,
4402
+ authorId: t.authorId,
4403
+ projectId: t.projectId ?? void 0
4404
+ };
4405
+ }
4406
+ let Jt = (e) => Kt.value?.chatId === e ? Kt.value : void 0, Yt = T(() => Jt(w.value)?.authorId), Xt = T(() => Jt(w.value)?.projectId), I = T(() => Yt.value !== void 0 && l.value !== void 0 && Yt.value !== l.value), Zt = (e) => {
4407
+ let t = Jt(e);
4408
+ return t && t.authorId === void 0 ? t.projectId : void 0;
4409
+ }, L = () => Gt.value ? { projectId: Re } : void 0, R = D([]), $t = D(!1), en = D(1), tn = D(!1), nn = D(!1), rn, z = D([]), B = D(!1), an = D("chat"), on = D(0), sn = D([]), V = D(), cn = D(!1), ln = D(!1), un = D(), dn = D(!1), fn = D(!1), pn = D(), H = D(""), U = D([]), W = D(""), mn = D(!0), hn = O(), gn = D(0), _n = Fe(T(() => `${o.value}-queue`), {}), vn = T(() => _n.value[w.value] ?? []), G = T(() => !C.value);
4410
+ function yn(e, t) {
4411
+ let n = Object.fromEntries(Object.entries(_n.value).filter(([t]) => t !== e));
4412
+ _n.value = t.length > 0 ? {
4401
4413
  ...n,
4402
4414
  [e]: t
4403
4415
  } : n;
4404
4416
  }
4405
- function pn(e) {
4406
- let t = (ln.value[e] ?? []).join(za);
4407
- return fn(e, []), t;
4417
+ function bn(e) {
4418
+ let t = (_n.value[e] ?? []).join(Ba);
4419
+ return yn(e, []), t;
4408
4420
  }
4409
- function mn(e) {
4410
- e && (B.value = B.value ? `${B.value}${za}${e}` : e);
4421
+ function xn(e) {
4422
+ e && (H.value = H.value ? `${H.value}${Ba}${e}` : e);
4411
4423
  }
4412
- function hn(e) {
4413
- fn(w.value, un.value.filter((t, n) => n !== e));
4424
+ function Sn(e) {
4425
+ yn(w.value, vn.value.filter((t, n) => n !== e));
4414
4426
  }
4415
- function gn(e) {
4416
- let t = un.value[e];
4417
- hn(e), mn(t ?? "");
4427
+ function K(e) {
4428
+ let t = vn.value[e];
4429
+ Sn(e), xn(t ?? "");
4418
4430
  }
4419
- async function _n(e) {
4420
- if (C.value) L.value = [];
4431
+ async function q(e) {
4432
+ if (C.value) R.value = [];
4421
4433
  else {
4422
- Ut.value = !0;
4434
+ $t.value = !0;
4423
4435
  try {
4424
- let t = await E.value.getConversations(e, l.value), n = new Set(t.map((e) => e.id)), r = N.value.filter((e) => !n.has(e) && F.value[e]).map((t) => ({
4436
+ let t = await E.value.getConversations(e, l.value, L()), n = new Set(t.map((e) => e.id)), r = N.value.filter((e) => !n.has(e) && Mt.value[e]).map((t) => ({
4425
4437
  id: t,
4426
4438
  agentId: e,
4427
- title: F.value[t],
4439
+ title: Mt.value[t],
4428
4440
  summary: null,
4429
4441
  messages: [],
4430
4442
  lastMessageAt: /* @__PURE__ */ new Date()
4431
4443
  })), i = `${e}:${l.value ?? ""}`;
4432
- i !== qt && (Wt.value = 1);
4433
- let a = new Set(r.map((e) => e.id)), o = Wt.value > 1 ? L.value.filter((e) => !n.has(e.id) && !a.has(e.id)) : [];
4434
- L.value = [
4444
+ i !== rn && (en.value = 1);
4445
+ let a = new Set(r.map((e) => e.id)), o = en.value > 1 ? R.value.filter((e) => !n.has(e.id) && !a.has(e.id)) : [];
4446
+ R.value = [
4435
4447
  ...r,
4436
4448
  ...t,
4437
4449
  ...o
4438
- ], qt = i, Wt.value === 1 && (Gt.value = t.length >= 100);
4450
+ ], rn = i, en.value === 1 && (tn.value = t.length >= 100);
4439
4451
  } catch {
4440
- L.value = [], Wt.value = 1, qt = void 0, Gt.value = !1;
4452
+ R.value = [], en.value = 1, rn = void 0, tn.value = !1;
4441
4453
  return;
4442
4454
  } finally {
4443
- Ut.value = !1;
4455
+ $t.value = !1;
4444
4456
  }
4445
- Zn([.../* @__PURE__ */ new Set([...Kn(), ...L.value.map((e) => e.id)])]);
4457
+ or([.../* @__PURE__ */ new Set([...er(), ...R.value.map((e) => e.id)])]);
4446
4458
  }
4447
4459
  }
4448
- async function vn() {
4449
- if (!Gt.value || Kt.value || C.value) return;
4450
- Kt.value = !0;
4451
- let e = qt;
4460
+ async function Cn() {
4461
+ if (!tn.value || nn.value || C.value) return;
4462
+ nn.value = !0;
4463
+ let e = rn;
4452
4464
  try {
4453
- let t = Wt.value + 1, n = await E.value.getConversations(o.value, l.value, { page: t });
4454
- if (e !== qt) return;
4455
- let r = new Set(L.value.map((e) => e.id));
4456
- L.value = [...L.value, ...n.filter((e) => !r.has(e.id))], Wt.value = t, Gt.value = n.length >= 100;
4465
+ let t = en.value + 1, n = await E.value.getConversations(o.value, l.value, {
4466
+ ...L(),
4467
+ page: t
4468
+ });
4469
+ if (e !== rn) return;
4470
+ let r = new Set(R.value.map((e) => e.id));
4471
+ R.value = [...R.value, ...n.filter((e) => !r.has(e.id))], en.value = t, tn.value = n.length >= 100;
4457
4472
  } catch {} finally {
4458
- Kt.value = !1;
4473
+ nn.value = !1;
4459
4474
  }
4460
4475
  }
4461
- async function yn(e) {
4476
+ async function wn(e) {
4462
4477
  return C.value ? [] : E.value.getConversations(o.value, l.value, { search: e });
4463
4478
  }
4464
- async function U() {
4479
+ async function Tn() {
4465
4480
  let e = w.value;
4466
- if (!e) Jt.value = [];
4481
+ if (!e) z.value = [];
4467
4482
  else {
4468
- Yt.value = !0;
4483
+ B.value = !0;
4469
4484
  try {
4470
- Jt.value = await E.value.getChatFiles(e);
4485
+ z.value = await E.value.getChatFiles(e);
4471
4486
  } catch {
4472
- Jt.value = [];
4487
+ z.value = [];
4473
4488
  } finally {
4474
- Yt.value = !1;
4489
+ B.value = !1;
4475
4490
  }
4476
4491
  }
4477
4492
  }
4478
- function bn(e, t = !1) {
4493
+ function En(e, t = !1) {
4479
4494
  return E.value.getChatFileDownloadUrl(e, t);
4480
4495
  }
4481
- function xn(e) {
4496
+ function Dn(e) {
4482
4497
  return E.value.getChatFilePreviewUrl(e);
4483
4498
  }
4484
- async function Sn(e) {
4499
+ async function On(e) {
4485
4500
  await E.value.deleteChatFile(e);
4486
- let t = Jt.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
4487
- Jt.value = Jt.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
4501
+ let t = z.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
4502
+ z.value = z.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
4488
4503
  }
4489
- async function Cn(e, t) {
4504
+ async function kn(e, t) {
4490
4505
  if (!C.value) try {
4491
4506
  let n = await E.value.getChat(e, t);
4492
- if (t !== w.value || I.value.status !== "ready" || I.value.messages.length > 0) return;
4493
- n && (I.value.messages = n.messages, Re.value = n.blocked ?? !1, W(e, t, n.turnInProgress === !0));
4507
+ if (t !== w.value || (n && qt(t, {
4508
+ authorId: n.userId,
4509
+ projectId: n.projectId
4510
+ }), F.value.status !== "ready" || F.value.messages.length > 0)) return;
4511
+ n && (F.value.messages = n.messages, Le.value = n.blocked ?? !1, An(e, t, n.turnInProgress === !0));
4494
4512
  } catch {}
4495
4513
  }
4496
- async function W(e, t, n) {
4497
- n && (await G(t), t !== w.value || K()) || (await wn(e, t), t === w.value && await On());
4514
+ async function An(e, t, n) {
4515
+ n && (await jn(t), t !== w.value || Nn()) || (await Mn(e, t), t === w.value && await Ln());
4498
4516
  }
4499
- async function G(e) {
4517
+ async function jn(e) {
4500
4518
  let t = { chatId: e };
4501
- M = t, Ot.value = e;
4502
- let n = () => M === t && e === w.value, r = Date.now() + ja;
4519
+ M = t, kt.value = e;
4520
+ let n = () => M === t && e === w.value, r = Date.now() + Ma;
4503
4521
  try {
4504
- for (; n() && !K() && Date.now() < r;) {
4505
- Dt = !0;
4522
+ for (; n() && !Nn() && Date.now() < r;) {
4523
+ Ot = !0;
4506
4524
  try {
4507
- await I.value.resumeStream();
4525
+ await F.value.resumeStream();
4508
4526
  } finally {
4509
- Dt = !1;
4527
+ Ot = !1;
4510
4528
  }
4511
4529
  if (!n()) return;
4512
- I.value.clearError();
4530
+ F.value.clearError();
4513
4531
  let t = await E.value.getChat(o.value, e).catch(() => null);
4514
- if (!t || !n() || K()) return;
4532
+ if (!t || !n() || Nn()) return;
4515
4533
  if (!t.turnInProgress) {
4516
- I.value.messages = t.messages;
4534
+ F.value.messages = t.messages;
4517
4535
  return;
4518
4536
  }
4519
- await new Promise((e) => setTimeout(e, Ma));
4537
+ await new Promise((e) => setTimeout(e, Na));
4520
4538
  }
4521
4539
  } finally {
4522
- M === t && (M = void 0, Ot.value = void 0);
4540
+ M === t && (M = void 0, kt.value = void 0);
4523
4541
  }
4524
4542
  }
4525
- async function wn(e, t) {
4543
+ async function Mn(e, t) {
4526
4544
  let n;
4527
4545
  try {
4528
- n = Number(sessionStorage.getItem(ct)), sessionStorage.removeItem(ct);
4546
+ n = Number(sessionStorage.getItem(lt)), sessionStorage.removeItem(lt);
4529
4547
  } catch {
4530
4548
  return;
4531
4549
  }
4532
4550
  if (!(!n || Date.now() - n > 6e4 || Se.value)) for (let n = 0; n < 12; n++) {
4533
- let n = I.value.messages[I.value.messages.length - 1];
4551
+ let n = F.value.messages[F.value.messages.length - 1];
4534
4552
  if (n?.role === "assistant") {
4535
- let e = n.parts.filter((e) => We(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
4553
+ let e = n.parts.filter((e) => qe(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
4536
4554
  if (e.length > 0) {
4537
- if (t.length === e.length && !Se.value) for (let e of t) gt.enqueue({
4555
+ if (t.length === e.length && !Se.value) for (let e of t) _t.enqueue({
4538
4556
  toolCallId: e.toolCallId,
4539
4557
  toolName: e.toolName,
4540
4558
  input: e.input,
@@ -4546,319 +4564,324 @@ function Ua(e) {
4546
4564
  }
4547
4565
  if (n.parts[n.parts.length - 1]?.type === "text") return;
4548
4566
  }
4549
- if (await new Promise((e) => setTimeout(e, 1500)), t !== w.value || I.value.status !== "ready") return;
4567
+ if (await new Promise((e) => setTimeout(e, 1500)), t !== w.value || F.value.status !== "ready") return;
4550
4568
  try {
4551
4569
  let n = await E.value.getChat(e, t);
4552
- n && t === w.value && (I.value.messages = n.messages);
4570
+ n && t === w.value && (F.value.messages = n.messages);
4553
4571
  } catch {
4554
4572
  return;
4555
4573
  }
4556
4574
  }
4557
4575
  }
4558
- let K = () => {
4559
- let e = I.value.status;
4576
+ let Nn = () => {
4577
+ let e = F.value.status;
4560
4578
  return e === "submitted" || e === "streaming";
4561
- }, Tn = () => K() || M?.chatId === w.value || re.value > 0, En = () => {
4562
- let e = Lt();
4563
- return A.value !== void 0 || Ea(e) || Va(e);
4564
- }, Dn = /* @__PURE__ */ new Set();
4565
- async function On() {
4579
+ }, Pn = () => Nn() || M?.chatId === w.value || re.value > 0, Fn = () => {
4580
+ let e = zt();
4581
+ return A.value !== void 0 || Da(e) || Ha(e);
4582
+ }, In = /* @__PURE__ */ new Set();
4583
+ async function Ln() {
4566
4584
  let e = w.value;
4567
- if (!(Dn.has(e) || un.value.length === 0 || Tn() || Pe.value)) {
4568
- if (En()) mn(pn(e));
4585
+ if (!(In.has(e) || vn.value.length === 0 || Pn() || Pe.value)) {
4586
+ if (Fn()) xn(bn(e));
4569
4587
  else {
4570
- Dn.add(e);
4588
+ In.add(e);
4571
4589
  try {
4572
- let t = Date.now() + Ia;
4573
- for (; Date.now() < t && (await Promise.race([E.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), Ra))])).includes(e);) await new Promise((e) => setTimeout(e, La));
4574
- if (e !== w.value || Tn()) return;
4575
- let n = pn(e);
4576
- n && zn(n);
4590
+ let t = Date.now() + La;
4591
+ for (; Date.now() < t && (await Promise.race([E.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), za))])).includes(e);) await new Promise((e) => setTimeout(e, Ra));
4592
+ if (e !== w.value || Pn()) return;
4593
+ let n = bn(e);
4594
+ n && qn(n);
4577
4595
  } finally {
4578
- Dn.delete(e);
4596
+ In.delete(e);
4579
4597
  }
4580
4598
  }
4581
4599
  }
4582
4600
  }
4583
- let kn = 0, An = 0;
4584
- async function jn() {
4585
- if (C.value || K()) return "indeterminate";
4586
- let e = w.value, t = kn += 1;
4601
+ let Rn = 0, zn = 0;
4602
+ async function Bn() {
4603
+ if (C.value || Nn()) return "indeterminate";
4604
+ let e = w.value, t = Rn += 1;
4587
4605
  try {
4588
4606
  let n = await E.value.getChat(o.value, e);
4589
- if (!n || e !== w.value || K() || t <= An) return "indeterminate";
4590
- An = t;
4591
- let r = n.messages, i = Aa(r, I.value.messages);
4592
- return I.value.messages = [...r, ...i], Re.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
4607
+ if (!n || e !== w.value || Nn() || t <= zn) return "indeterminate";
4608
+ zn = t;
4609
+ let r = n.messages, i = ja(r, F.value.messages);
4610
+ return F.value.messages = [...r, ...i], Le.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
4593
4611
  } catch {}
4594
4612
  return "indeterminate";
4595
4613
  }
4596
- function Mn(e) {
4597
- I.value.messages = [...I.value.messages, e];
4614
+ function Vn(e) {
4615
+ F.value.messages = [...F.value.messages, e];
4598
4616
  }
4599
- async function Nn(e) {
4617
+ async function Hn(e) {
4600
4618
  try {
4601
- Qt.value = await E.value.getMessageFeedbacks(e);
4619
+ sn.value = await E.value.getMessageFeedbacks(e);
4602
4620
  } catch {
4603
- Qt.value = [];
4621
+ sn.value = [];
4604
4622
  }
4605
4623
  }
4606
- function Pn(e) {
4607
- let t = Qt.value.findIndex((t) => t.messageId === e.messageId);
4608
- t >= 0 ? Qt.value[t] = e : Qt.value.push(e);
4624
+ function Un(e) {
4625
+ let t = sn.value.findIndex((t) => t.messageId === e.messageId);
4626
+ t >= 0 ? sn.value[t] = e : sn.value.push(e);
4609
4627
  }
4610
- function Fn(e) {
4611
- let t = Vt.value, n = t.findIndex((t) => t.id === e.id), r = Je(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
4628
+ function Wn(e) {
4629
+ let t = Ut.value, n = t.findIndex((t) => t.id === e.id), r = Ye(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
4612
4630
  return {
4613
- userQuestion: Je(i ?? e) ?? "",
4631
+ userQuestion: Ye(i ?? e) ?? "",
4614
4632
  assistantMessage: r
4615
4633
  };
4616
4634
  }
4617
- async function In(e, t) {
4635
+ async function Gn(e, t) {
4618
4636
  await Promise.all([
4619
- Cn(e, t),
4620
- _n(e),
4621
- Nn(t)
4622
- ]), Xe.value || st((e, t) => E.value.reverseGeocode(e, t, r.value)).then((e) => {
4623
- e && (Xe.value = e);
4637
+ kn(e, t),
4638
+ q(e),
4639
+ Hn(t)
4640
+ ]), Ze.value || ct((e, t) => E.value.reverseGeocode(e, t, r.value)).then((e) => {
4641
+ e && (Ze.value = e);
4624
4642
  });
4625
4643
  }
4626
- async function Ln() {
4627
- if (V.value.some((e) => e.state !== "done")) return;
4628
- let e = B.value.trim(), t = V.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
4644
+ async function Kn() {
4645
+ if (I.value || U.value.some((e) => e.state !== "done")) return;
4646
+ let e = H.value.trim(), t = U.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
4629
4647
  type: "file",
4630
4648
  mediaType: e.mediaSource.mimeType,
4631
4649
  url: e.localUrl,
4632
4650
  filename: e.mediaSource.name,
4633
4651
  providerMetadata: { "8bot": { media: e.mediaSource } }
4634
4652
  })), n = Ae.value ? ue.value : void 0;
4635
- !C.value && Tn() ? e && t.length === 0 && !n && (fn(w.value, [...un.value, e]), B.value = "") : (C.value && Vt.value.length > 0 && await nr(), zn(e, t, n && { pagePointer: n }), B.value = "", ue.value = void 0, tr());
4653
+ !C.value && Pn() ? e && t.length === 0 && !n && (yn(w.value, [...vn.value, e]), H.value = "") : (C.value && Ut.value.length > 0 && await dr(), qn(e, t, n && { pagePointer: n }), H.value = "", ue.value = void 0, ur());
4636
4654
  }
4637
- function Rn(e, t) {
4655
+ function J(e, t) {
4638
4656
  let n = e.trim();
4639
- return !n || Re.value || Tn() || I.value.status !== "ready" ? !1 : (zn(n, [], t, { toInput: !1 }), !0);
4657
+ return !n || Le.value || I.value || Pn() || F.value.status !== "ready" ? !1 : (qn(n, [], t, { toInput: !1 }), !0);
4640
4658
  }
4641
- function zn(e, t = [], n, { toInput: r = !0 } = {}) {
4642
- Tt(), H.value = e, on.value = r, sn.value = r && n && "pagePointer" in n ? n.pagePointer : void 0, cn.value = I.value.messages.length;
4643
- let i = I.value.sendMessage;
4659
+ function qn(e, t = [], n, { toInput: r = !0 } = {}) {
4660
+ if (I.value) return;
4661
+ Et(), W.value = e, mn.value = r, hn.value = r && n && "pagePointer" in n ? n.pagePointer : void 0, gn.value = F.value.messages.length;
4662
+ let i = F.value.sendMessage;
4644
4663
  i({
4645
4664
  text: e,
4646
4665
  files: t.length > 0 ? t : void 0,
4647
4666
  ...n && { metadata: n }
4648
4667
  });
4649
4668
  }
4650
- function Bn(e) {
4669
+ function Jn(e) {
4651
4670
  let t = e.trim();
4652
- if (!t) return;
4653
- if (I.value.status !== "ready") {
4654
- Ye.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
4671
+ if (!t || I.value) return;
4672
+ if (F.value.status !== "ready") {
4673
+ Xe.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
4655
4674
  return;
4656
4675
  }
4657
- let n = I.value.sendMessage;
4658
- Tt(), n({ text: t });
4676
+ let n = F.value.sendMessage;
4677
+ Et(), n({ text: t });
4659
4678
  }
4660
- async function Vn() {
4661
- let e = I.value.messages.slice(cn.value).some((e) => e.parts.some(We)), t = H.value, n = on.value, r = sn.value, i = t.length > 0 && !e, a = w.value, s = cn.value, c = M?.chatId === a, l = kt, u = pn(a), d = (e = "") => {
4662
- B.value = [
4679
+ async function Yn() {
4680
+ let e = F.value.messages.slice(gn.value).some((e) => e.parts.some(qe)), t = W.value, n = mn.value, r = hn.value, i = t.length > 0 && !e, a = w.value, s = gn.value, c = M?.chatId === a, l = At, u = bn(a), d = (e = "") => {
4681
+ H.value = [
4663
4682
  e,
4664
4683
  u,
4665
- B.value
4666
- ].filter(Boolean).join(za);
4667
- }, f = () => a === w.value && !K() && cn.value === s ? !1 : (u && fn(a, [u, ...ln.value[a] ?? []]), !0);
4668
- M = void 0, Ot.value = void 0, Tt(), await I.value.stop();
4684
+ H.value
4685
+ ].filter(Boolean).join(Ba);
4686
+ }, f = () => a === w.value && !Nn() && gn.value === s ? !1 : (u && yn(a, [u, ..._n.value[a] ?? []]), !0);
4687
+ M = void 0, kt.value = void 0, Et(), await F.value.stop();
4669
4688
  let p = C.value || e && !c || await E.value.stopChatTurn(o.value, a, l).catch(() => !0);
4670
4689
  if (!f()) {
4671
4690
  if (c || !p) {
4672
- if (await jn(), f()) return;
4673
- if (c || I.value.messages.length > cn.value) {
4674
- H.value = "", d();
4691
+ if (await Bn(), f()) return;
4692
+ if (c || F.value.messages.length > gn.value) {
4693
+ W.value = "", d();
4675
4694
  return;
4676
4695
  }
4677
4696
  }
4678
- i ? (d(n ? t : ""), ue.value ??= r, I.value.messages = I.value.messages.slice(0, cn.value), H.value = "") : d();
4697
+ i ? (d(n ? t : ""), ue.value ??= r, F.value.messages = F.value.messages.slice(0, gn.value), W.value = "") : d();
4679
4698
  }
4680
4699
  }
4681
- k(() => I.value.messages, (e) => {
4700
+ k(() => F.value.messages, (e) => {
4682
4701
  let t = A.value?.toolCallId;
4683
- t && !_t.has(t) && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && Tt();
4684
- }), k(() => I.value.status, (e) => {
4685
- e === "submitted" && (ge.value++, kt = void 0);
4702
+ t && !vt.has(t) && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && Et();
4703
+ }), k(() => F.value.status, (e) => {
4704
+ e === "submitted" && (ge.value++, At = void 0);
4686
4705
  });
4687
- let Hn;
4706
+ let Xn;
4688
4707
  k(() => [
4689
- I.value.status,
4708
+ F.value.status,
4690
4709
  re.value,
4691
4710
  ie.value
4692
4711
  ], ([e, t, n]) => {
4693
- clearTimeout(Hn), e === "ready" && t === 0 && n === 0 && (Hn = setTimeout(() => {
4712
+ clearTimeout(Xn), e === "ready" && t === 0 && n === 0 && (Xn = setTimeout(() => {
4694
4713
  he.value = !1;
4695
4714
  }, 1500));
4696
4715
  });
4697
- let Un = D(!1), Wn;
4698
- k(() => !A.value && !Ea(Lt()) && (K() || re.value > 0), (e) => {
4699
- clearTimeout(Wn), e ? Un.value = !0 : Wn = setTimeout(() => {
4700
- Un.value = !1;
4716
+ let Zn = D(!1), Qn;
4717
+ k(() => !A.value && !Da(zt()) && (Nn() || re.value > 0), (e) => {
4718
+ clearTimeout(Qn), e ? Zn.value = !0 : Qn = setTimeout(() => {
4719
+ Zn.value = !1;
4701
4720
  }, 400);
4702
4721
  }, { immediate: !0 });
4703
- let Gn = T(() => {
4704
- let e = At.value.filter((e) => e !== w.value);
4705
- return Un.value || Ot.value === w.value ? [...e, w.value] : e;
4706
- }), Kn = () => [.../* @__PURE__ */ new Set([...At.value, ...N.value])], q = it(), qn, Jn = 0, Yn = 0;
4707
- function Xn() {
4708
- clearTimeout(qn), qn = void 0, Kn().length !== 0 && q.value === "visible" && (qn = setTimeout(() => {
4709
- qn = void 0, Zn(Kn());
4710
- }, Na));
4722
+ let $n = T(() => {
4723
+ let e = jt.value.filter((e) => e !== w.value);
4724
+ return Zn.value || kt.value === w.value ? [...e, w.value] : e;
4725
+ }), er = () => [.../* @__PURE__ */ new Set([...jt.value, ...N.value])], tr = at(), nr, rr = 0, ir = 0;
4726
+ function ar() {
4727
+ clearTimeout(nr), nr = void 0, er().length !== 0 && tr.value === "visible" && (nr = setTimeout(() => {
4728
+ nr = void 0, or(er());
4729
+ }, Pa));
4711
4730
  }
4712
- async function Zn(e) {
4713
- let t = e.slice(0, Pa);
4731
+ async function or(e) {
4732
+ let t = e.slice(0, Fa);
4714
4733
  if (C.value || t.length === 0) {
4715
- Xn();
4734
+ ar();
4716
4735
  return;
4717
4736
  }
4718
- let n = Jn += 1, r;
4737
+ let n = rr += 1, r;
4719
4738
  try {
4720
4739
  r = await E.value.getRunningTurns(o.value, t);
4721
4740
  } catch {
4722
- Xn();
4741
+ ar();
4723
4742
  return;
4724
4743
  }
4725
- if (n <= Yn) return;
4726
- Yn = n;
4727
- for (let e of r) Mt.add(e);
4728
- let i = new Set(t), a = Kn().filter((e) => i.has(e) && !r.includes(e)), s = (e) => N.value.includes(e) && !Mt.has(e), c = a.filter((e) => s(e) && Date.now() - (jt.get(e) ?? 0) > Fa), l = a.filter((e) => !s(e));
4729
- At.value = [...At.value.filter((e) => !i.has(e)), ...r];
4744
+ if (n <= ir) return;
4745
+ ir = n;
4746
+ for (let e of r) Pt.add(e);
4747
+ let i = new Set(t), a = er().filter((e) => i.has(e) && !r.includes(e)), s = (e) => N.value.includes(e) && !Pt.has(e), c = a.filter((e) => s(e) && Date.now() - (Nt.get(e) ?? 0) > Ia), l = a.filter((e) => !s(e));
4748
+ jt.value = [...jt.value.filter((e) => !i.has(e)), ...r];
4730
4749
  let u = l.filter((e) => N.value.includes(e));
4731
- (u.length > 0 || c.length > 0) && (N.value = N.value.filter((e) => !u.includes(e) && !c.includes(e)), P.value = [...P.value, ...u.filter((e) => e !== w.value && !P.value.includes(e))]), l.length > 0 && _n(o.value), Xn();
4750
+ (u.length > 0 || c.length > 0) && (N.value = N.value.filter((e) => !u.includes(e) && !c.includes(e)), P.value = [...P.value, ...u.filter((e) => e !== w.value && !P.value.includes(e))]), l.length > 0 && q(o.value), ar();
4732
4751
  }
4733
- k(q, (e) => {
4734
- e === "visible" ? Zn(Kn()) : (clearTimeout(qn), qn = void 0);
4735
- }), Qe(() => clearTimeout(qn));
4736
- let Qn = T(() => P.value.map((e) => ({
4752
+ k(tr, (e) => {
4753
+ e === "visible" ? or(er()) : (clearTimeout(nr), nr = void 0);
4754
+ }), $e(() => clearTimeout(nr));
4755
+ let sr = T(() => P.value.map((e) => ({
4737
4756
  chatId: e,
4738
- title: L.value.find((t) => t.id === e)?.title || F.value[e] || void 0
4757
+ title: R.value.find((t) => t.id === e)?.title || Mt.value[e] || void 0
4739
4758
  })));
4740
- function $n(e) {
4741
- Ft(e), w.value = e, Dr("chat");
4759
+ function cr(e) {
4760
+ Lt(e), w.value = e, Ir("chat");
4742
4761
  }
4743
- function er(e) {
4744
- P.value = P.value.filter((t) => t !== e), Pt(e);
4762
+ function lr(e) {
4763
+ P.value = P.value.filter((t) => t !== e), It(e);
4745
4764
  }
4746
- k(() => [I.value.status, I.value.id], ([e, t], [n, r]) => {
4765
+ k(() => [F.value.status, F.value.id], ([e, t], [n, r]) => {
4747
4766
  if (t === r) {
4748
- if (e === "error") M?.chatId !== w.value && mn(pn(w.value));
4767
+ if (e === "error") M?.chatId !== w.value && xn(bn(w.value));
4749
4768
  else if (e === "ready" && (n === "streaming" || n === "submitted")) {
4750
- if (En()) {
4751
- mn(pn(w.value));
4769
+ if (Fn()) {
4770
+ xn(bn(w.value));
4752
4771
  return;
4753
4772
  }
4754
- On();
4773
+ Ln();
4755
4774
  }
4756
4775
  }
4757
4776
  }), k(re, (e) => {
4758
- e === 0 && I.value.status === "ready" && On();
4759
- }), k(() => I.value.status, (e) => {
4760
- e === "ready" && H.value.length > 0 && (H.value = "");
4777
+ e === 0 && F.value.status === "ready" && Ln();
4778
+ }), k(() => F.value.status, (e) => {
4779
+ e === "ready" && W.value.length > 0 && (W.value = "");
4761
4780
  });
4762
- function tr(e = !1) {
4763
- for (let t of V.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4764
- V.value = [], dr.value = null;
4781
+ function ur(e = !1) {
4782
+ for (let t of U.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4783
+ U.value = [], yr.value = null;
4765
4784
  }
4766
- async function nr() {
4767
- return H.value = "", pe.value = {}, me.value = {}, w.value = Xt(), await Ze(), I.value.clearError(), Pe.value = void 0, Re.value = !1, tr(!0), Dr("chat"), w.value;
4785
+ async function dr(e) {
4786
+ let t = typeof e?.projectId == "string" ? e.projectId : void 0;
4787
+ return W.value = "", pe.value = {}, me.value = {}, w.value = Qt(), qt(w.value, { projectId: t }), await Qe(), F.value.clearError(), Pe.value = void 0, Le.value = !1, ur(!0), Ir("chat"), w.value;
4768
4788
  }
4769
- async function rr(e) {
4770
- I.value.status !== "ready" && (H.value = "", await Vn()), Tt(), await I.value.regenerate(e);
4789
+ async function fr(e) {
4790
+ I.value || (F.value.status !== "ready" && (W.value = "", await Yn()), Et(), await F.value.regenerate(e));
4771
4791
  }
4772
- function ir(e) {
4773
- if (e.tool === "requestGeolocation") {
4774
- let t = e.output;
4775
- "latitude" in t && (Xe.value = {
4776
- geolocationLatitude: t.latitude,
4777
- geolocationLongitude: t.longitude,
4778
- geolocationAccuracy: t.accuracy,
4779
- geolocationCity: t.city
4780
- });
4792
+ function Y(e) {
4793
+ if (!I.value) {
4794
+ if (e.tool === "requestGeolocation") {
4795
+ let t = e.output;
4796
+ "latitude" in t && (Ze.value = {
4797
+ geolocationLatitude: t.latitude,
4798
+ geolocationLongitude: t.longitude,
4799
+ geolocationAccuracy: t.accuracy,
4800
+ geolocationCity: t.city
4801
+ });
4802
+ }
4803
+ F.value.addToolOutput(e);
4781
4804
  }
4782
- I.value.addToolOutput(e);
4783
4805
  }
4784
- function ar(e) {
4785
- I.value.addToolApprovalResponse(e);
4806
+ function pr(e) {
4807
+ I.value || F.value.addToolApprovalResponse(e);
4786
4808
  }
4787
- let or = T(() => I.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), sr = T(() => _.value?.maxFilesPerMessage ?? 5), cr = T(() => _.value?.maxFilesPerChat ?? 20), lr = T(() => Math.max(0, Math.min(sr.value - V.value.length, cr.value - or.value - V.value.length))), ur = T(() => lr.value <= 0), dr = D(null), fr = () => {
4788
- dr.value = null;
4809
+ let mr = T(() => F.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), hr = T(() => _.value?.maxFilesPerMessage ?? 5), gr = T(() => _.value?.maxFilesPerChat ?? 20), _r = T(() => Math.max(0, Math.min(hr.value - U.value.length, gr.value - mr.value - U.value.length))), vr = T(() => _r.value <= 0), yr = D(null), br = () => {
4810
+ yr.value = null;
4789
4811
  };
4790
- k(ur, (e) => {
4791
- e || (dr.value = null);
4812
+ k(vr, (e) => {
4813
+ e || (yr.value = null);
4792
4814
  });
4793
- async function J(e) {
4794
- if (ur.value) {
4795
- dr.value = cr.value - or.value - V.value.length <= sr.value - V.value.length ? {
4815
+ async function xr(e) {
4816
+ if (I.value) return;
4817
+ if (vr.value) {
4818
+ yr.value = gr.value - mr.value - U.value.length <= hr.value - U.value.length ? {
4796
4819
  reason: "per-chat",
4797
- max: cr.value
4820
+ max: gr.value
4798
4821
  } : {
4799
4822
  reason: "per-message",
4800
- max: sr.value
4823
+ max: hr.value
4801
4824
  };
4802
4825
  return;
4803
4826
  }
4804
- let t = hr(e);
4805
- V.value = [...V.value, t], await gr(t);
4827
+ let t = wr(e);
4828
+ U.value = [...U.value, t], await Tr(t);
4806
4829
  }
4807
- async function pr(e, t) {
4808
- let n = V.value.find((t) => t.id === e.id);
4830
+ async function Sr(e, t) {
4831
+ let n = U.value.find((t) => t.id === e.id);
4809
4832
  if (!n) return;
4810
4833
  URL.revokeObjectURL(n.localUrl);
4811
- let r = hr(t);
4812
- V.value = V.value.map((e) => e.id === n.id ? r : e), await Promise.all([_r(n), gr(r)]);
4834
+ let r = wr(t);
4835
+ U.value = U.value.map((e) => e.id === n.id ? r : e), await Promise.all([Er(n), Tr(r)]);
4813
4836
  }
4814
- async function mr(e) {
4815
- let t = V.value.find((t) => t.id === e.id && t.state === "error");
4816
- t && (V.value = V.value.map((e) => e.id === t.id ? {
4837
+ async function Cr(e) {
4838
+ let t = U.value.find((t) => t.id === e.id && t.state === "error");
4839
+ t && (U.value = U.value.map((e) => e.id === t.id ? {
4817
4840
  ...e,
4818
4841
  state: "uploading",
4819
4842
  error: void 0
4820
- } : e), await gr(t));
4843
+ } : e), await Tr(t));
4821
4844
  }
4822
- function hr(e) {
4845
+ function wr(e) {
4823
4846
  return {
4824
- id: Xt(),
4847
+ id: Qt(),
4825
4848
  file: e,
4826
4849
  localUrl: URL.createObjectURL(e),
4827
4850
  state: "uploading"
4828
4851
  };
4829
4852
  }
4830
- async function gr({ id: e, file: t }) {
4853
+ async function Tr({ id: e, file: t }) {
4831
4854
  try {
4832
4855
  let n = await E.value.uploadMedia(o.value, w.value, t);
4833
- if (!V.value.some((t) => t.id === e)) {
4834
- await vr(n);
4856
+ if (!U.value.some((t) => t.id === e)) {
4857
+ await Dr(n);
4835
4858
  return;
4836
4859
  }
4837
- V.value = V.value.map((t) => t.id === e ? {
4860
+ U.value = U.value.map((t) => t.id === e ? {
4838
4861
  ...t,
4839
4862
  state: "done",
4840
4863
  mediaSource: n
4841
4864
  } : t);
4842
4865
  } catch (t) {
4843
4866
  let n = t instanceof Error ? t.message : "Upload failed";
4844
- V.value = V.value.map((t) => t.id === e ? {
4867
+ U.value = U.value.map((t) => t.id === e ? {
4845
4868
  ...t,
4846
4869
  state: "error",
4847
4870
  error: n
4848
4871
  } : t);
4849
4872
  }
4850
4873
  }
4851
- async function _r(e) {
4852
- e.mediaSource && await vr(e.mediaSource);
4874
+ async function Er(e) {
4875
+ e.mediaSource && await Dr(e.mediaSource);
4853
4876
  }
4854
- async function vr(e) {
4877
+ async function Dr(e) {
4855
4878
  try {
4856
4879
  await E.value.discardMedia(e);
4857
4880
  } catch {}
4858
4881
  }
4859
- async function yr(e, t) {
4860
- let { userQuestion: n, assistantMessage: r } = Fn(e);
4861
- Pn(await E.value.submitMessageFeedback({
4882
+ async function Or(e, t) {
4883
+ let { userQuestion: n, assistantMessage: r } = Wn(e);
4884
+ Un(await E.value.submitMessageFeedback({
4862
4885
  messageId: e.id,
4863
4886
  chatId: w.value,
4864
4887
  agentId: o.value,
@@ -4867,73 +4890,76 @@ function Ua(e) {
4867
4890
  assistantMessage: r
4868
4891
  }));
4869
4892
  }
4870
- async function br(e) {
4871
- await yr(e, "upvote");
4893
+ async function kr(e) {
4894
+ await Or(e, "upvote");
4872
4895
  }
4873
- async function xr(e) {
4874
- await yr(e, "downvote");
4896
+ async function Ar(e) {
4897
+ await Or(e, "downvote");
4875
4898
  }
4876
- function Sr(e) {
4877
- tn.value = !1, nn.value = void 0, $t.value = e;
4899
+ function jr(e) {
4900
+ ln.value = !1, un.value = void 0, V.value = e;
4878
4901
  }
4879
- async function Cr(e) {
4880
- if ($t.value) try {
4881
- en.value = !0, tn.value = !1, nn.value = void 0;
4882
- let { userQuestion: t, assistantMessage: n } = Fn($t.value);
4883
- Pn(await E.value.submitMessageFeedback({
4884
- messageId: $t.value.id,
4902
+ async function Mr(e) {
4903
+ if (V.value) try {
4904
+ cn.value = !0, ln.value = !1, un.value = void 0;
4905
+ let { userQuestion: t, assistantMessage: n } = Wn(V.value);
4906
+ Un(await E.value.submitMessageFeedback({
4907
+ messageId: V.value.id,
4885
4908
  chatId: w.value,
4886
4909
  agentId: o.value,
4887
4910
  userQuestion: t,
4888
4911
  assistantMessage: n,
4889
4912
  comment: e
4890
- })), tn.value = !0, await Nn(w.value);
4913
+ })), ln.value = !0, await Hn(w.value);
4891
4914
  } catch {
4892
- nn.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4915
+ un.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4893
4916
  } finally {
4894
- en.value = !1;
4917
+ cn.value = !1;
4895
4918
  }
4896
4919
  }
4897
- async function wr(e) {
4920
+ async function Nr(e) {
4898
4921
  try {
4899
- z.value = !0, rn.value = !1, an.value = void 0, await E.value.submitLead({
4922
+ fn.value = !0, dn.value = !1, pn.value = void 0, await E.value.submitLead({
4900
4923
  agentId: o.value,
4901
4924
  chatId: w.value,
4902
4925
  ...e
4903
- }), rn.value = !0;
4926
+ }), dn.value = !0;
4904
4927
  } catch {
4905
- an.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4928
+ pn.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4906
4929
  } finally {
4907
- z.value = !1;
4930
+ fn.value = !1;
4908
4931
  }
4909
4932
  }
4910
- async function Tr(e, t) {
4933
+ async function Pr(e, t) {
4911
4934
  let n = await E.value.updateChatTitle(o.value, e, t);
4912
- L.value = L.value.map((t) => t.id === e ? {
4935
+ R.value = R.value.map((t) => t.id === e ? {
4913
4936
  ...t,
4914
4937
  title: n.title
4915
4938
  } : t);
4916
4939
  }
4917
- async function Er(e) {
4918
- await E.value.deleteChat(o.value, e), L.value = L.value.filter((t) => t.id !== e), w.value === e && await nr();
4940
+ async function Fr(e) {
4941
+ await E.value.deleteChat(o.value, e), R.value = R.value.filter((t) => t.id !== e), w.value === e && await dr();
4919
4942
  }
4920
- function Dr(e) {
4921
- R.value = e;
4943
+ function Ir(e) {
4944
+ an.value = e;
4922
4945
  }
4923
- function Or() {
4924
- Dr("chat"), Zt.value++;
4946
+ function Lr() {
4947
+ Ir("chat"), on.value++;
4925
4948
  }
4926
- let kr;
4927
- function Ar(e) {
4928
- let t = () => E.value.getChat(o.value, e).then((e) => e !== null);
4929
- return t().catch(() => t().catch(() => !1));
4949
+ let Rr;
4950
+ function zr(e) {
4951
+ let t = () => E.value.getChat(o.value, e);
4952
+ return t().catch(() => t().catch(() => null));
4930
4953
  }
4931
4954
  return k(l, async (e) => {
4932
- if (!e || e === kr) return;
4933
- let t = kr;
4934
- if (kr = e, t === void 0) return;
4935
- let n = w.value, r = !C.value && await Ar(n);
4936
- l.value === e && w.value === n && (r ? _n(o.value) : (L.value = [], Qt.value = [], Jt.value = [], At.value = [], N.value = [], P.value = [], F.value = {}, await nr(), B.value = ""));
4955
+ if (!e || e === Rr) return;
4956
+ let t = Rr;
4957
+ if (Rr = e, t === void 0) return;
4958
+ let n = w.value, r = C.value ? null : await zr(n);
4959
+ l.value === e && w.value === n && (r ? (qt(n, {
4960
+ authorId: r.userId,
4961
+ projectId: r.projectId
4962
+ }), q(o.value)) : (R.value = [], sn.value = [], z.value = [], jt.value = [], N.value = [], P.value = [], Mt.value = {}, await dr(), H.value = ""));
4937
4963
  }), {
4938
4964
  apiClient: E,
4939
4965
  baseUrl: i,
@@ -4965,20 +4991,20 @@ function Ua(e) {
4965
4991
  hostStepTitles: pe,
4966
4992
  hostStepChanges: me,
4967
4993
  pageControlActive: he,
4968
- isWorking: Un,
4969
- stopHostActions: wt,
4970
- voicePageTools: St,
4971
- cancelVoicePageCalls: Ct,
4994
+ isWorking: Zn,
4995
+ stopHostActions: Tt,
4996
+ voicePageTools: Ct,
4997
+ cancelVoicePageCalls: wt,
4972
4998
  pageNoticeLevel: Me,
4973
4999
  closePageNotice: Ne,
4974
5000
  hostConfirmation: A,
4975
- respondHostConfirmation: pt,
5001
+ respondHostConfirmation: mt,
4976
5002
  pageAccessAvailable: Te,
4977
5003
  pageAccessOff: Se,
4978
- setPageAccessOff: Et,
5004
+ setPageAccessOff: Dt,
4979
5005
  agentConfirmations: oe,
4980
5006
  agentSelectionActions: x,
4981
- sendSelection: Rn,
5007
+ sendSelection: J,
4982
5008
  confirmationsAvailable: De,
4983
5009
  confirmationMode: Oe,
4984
5010
  setConfirmationMode: ke,
@@ -4989,76 +5015,81 @@ function Ua(e) {
4989
5015
  systemTheme: _e,
4990
5016
  hideWelcomeMessage: ve,
4991
5017
  isDark: S,
4992
- chat: I,
4993
- messages: Vt,
4994
- conversations: L,
4995
- isLoadingConversations: Ut,
4996
- hasMoreConversations: Gt,
4997
- isLoadingMoreConversations: Kt,
4998
- chatFiles: Jt,
4999
- isLoadingChatFiles: Yt,
5000
- input: B,
5001
- pendingAttachments: V,
5002
- isAttachmentLimitReached: ur,
5003
- fileLimitError: dr,
5018
+ chat: F,
5019
+ messages: Ut,
5020
+ conversations: R,
5021
+ isLoadingConversations: $t,
5022
+ hasMoreConversations: tn,
5023
+ isLoadingMoreConversations: nn,
5024
+ chatFiles: z,
5025
+ isLoadingChatFiles: B,
5026
+ input: H,
5027
+ pendingAttachments: U,
5028
+ isAttachmentLimitReached: vr,
5029
+ fileLimitError: yr,
5004
5030
  localChatId: w,
5005
- isConversationBlocked: Re,
5006
- inputMessagePlaceholder: Ht,
5031
+ isConversationBlocked: Le,
5032
+ inputMessagePlaceholder: Wt,
5007
5033
  chatError: Pe,
5008
- runningChatIds: Gn,
5009
- backgroundAnswers: Qn,
5010
- openBackgroundAnswer: $n,
5011
- dismissBackgroundAnswer: er,
5012
- canQueue: dn,
5013
- queuedMessages: un,
5014
- removeQueuedMessage: hn,
5015
- editQueuedMessage: gn,
5016
- activeView: R,
5017
- inputFocusRequest: Zt,
5018
- messageFeedbacks: Qt,
5019
- feedbackDialogMessage: $t,
5020
- isFeedbackSubmitting: en,
5021
- isFeedbackSubmitted: tn,
5022
- feedbackSubmitError: nn,
5023
- isLeadSubmitted: rn,
5024
- isLoadingSubmitLead: z,
5025
- submitLeadError: an,
5026
- buildDeviceContext: et,
5027
- initialize: In,
5028
- loadConversations: _n,
5029
- loadMoreConversations: vn,
5030
- searchConversations: yn,
5031
- loadChatFiles: U,
5032
- refreshMessages: jn,
5033
- appendMessage: Mn,
5034
- getChatFileUrl: bn,
5035
- getChatFilePreviewUrl: xn,
5036
- deleteChatFile: Sn,
5037
- handleSubmit: Ln,
5038
- sendMessage: Bn,
5039
- stopGeneration: Vn,
5040
- startNewChat: nr,
5041
- regenerate: rr,
5042
- addToolOutput: ir,
5043
- addToolApprovalResponse: ar,
5044
- handleFileSelect: J,
5045
- discardPendingAttachment: _r,
5046
- replacePendingAttachment: pr,
5047
- retryPendingAttachment: mr,
5048
- clearFileLimitError: fr,
5049
- clearPendingAttachments: tr,
5050
- onUpvote: br,
5051
- onDownvote: xr,
5052
- onFeedback: Sr,
5053
- onFeedbackSubmit: Cr,
5054
- onLeadSubmit: wr,
5055
- navigate: Dr,
5056
- focusInput: Or,
5057
- renameChatTitle: Tr,
5058
- deleteChat: Er
5034
+ runningChatIds: $n,
5035
+ backgroundAnswers: sr,
5036
+ openBackgroundAnswer: cr,
5037
+ dismissBackgroundAnswer: lr,
5038
+ canQueue: G,
5039
+ queuedMessages: vn,
5040
+ removeQueuedMessage: Sn,
5041
+ editQueuedMessage: K,
5042
+ activeView: an,
5043
+ inputFocusRequest: on,
5044
+ messageFeedbacks: sn,
5045
+ feedbackDialogMessage: V,
5046
+ isFeedbackSubmitting: cn,
5047
+ isFeedbackSubmitted: ln,
5048
+ feedbackSubmitError: un,
5049
+ isLeadSubmitted: dn,
5050
+ isLoadingSubmitLead: fn,
5051
+ submitLeadError: pn,
5052
+ buildDeviceContext: tt,
5053
+ initialize: Gn,
5054
+ loadConversations: q,
5055
+ loadMoreConversations: Cn,
5056
+ projectsEnabled: Gt,
5057
+ chatAuthorId: Yt,
5058
+ chatProjectId: Xt,
5059
+ isReadOnlyChat: I,
5060
+ describeChat: qt,
5061
+ searchConversations: wn,
5062
+ loadChatFiles: Tn,
5063
+ refreshMessages: Bn,
5064
+ appendMessage: Vn,
5065
+ getChatFileUrl: En,
5066
+ getChatFilePreviewUrl: Dn,
5067
+ deleteChatFile: On,
5068
+ handleSubmit: Kn,
5069
+ sendMessage: Jn,
5070
+ stopGeneration: Yn,
5071
+ startNewChat: dr,
5072
+ regenerate: fr,
5073
+ addToolOutput: Y,
5074
+ addToolApprovalResponse: pr,
5075
+ handleFileSelect: xr,
5076
+ discardPendingAttachment: Er,
5077
+ replacePendingAttachment: Sr,
5078
+ retryPendingAttachment: Cr,
5079
+ clearFileLimitError: br,
5080
+ clearPendingAttachments: ur,
5081
+ onUpvote: kr,
5082
+ onDownvote: Ar,
5083
+ onFeedback: jr,
5084
+ onFeedbackSubmit: Mr,
5085
+ onLeadSubmit: Nr,
5086
+ navigate: Ir,
5087
+ focusInput: Lr,
5088
+ renameChatTitle: Pr,
5089
+ deleteChat: Fr
5059
5090
  };
5060
5091
  })();
5061
5092
  }
5062
- export { Xt as a, qi as i, Ua as n, Ca as r, wa as t };
5093
+ export { Qt as a, qi as i, Wa as n, wa as r, Ta as t };
5063
5094
 
5064
- //# sourceMappingURL=useChatbotStore-B-WenuyB.js.map
5095
+ //# sourceMappingURL=useChatbotStore-ChrZVIDt.js.map