@8wave/ai-elements 0.121.0-beta.41 → 0.121.0-beta.43

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 (120) hide show
  1. package/dist/_chunks/{PkChatbotFilePreview-CpFXWpU7.js → PkChatbotFilePreview-DxpEIFOG.js} +2 -2
  2. package/dist/_chunks/{PkChatbotFilePreview-CpFXWpU7.js.map → PkChatbotFilePreview-DxpEIFOG.js.map} +1 -1
  3. package/dist/_chunks/{PkHeldImage-DvHKY7Vh.js → PkHeldImage-CztNY8OZ.js} +2 -2
  4. package/dist/_chunks/{PkHeldImage-DvHKY7Vh.js.map → PkHeldImage-CztNY8OZ.js.map} +1 -1
  5. package/dist/_chunks/{PkLazyImg-BBFsS16D.js → PkLazyImg-BqbuNQgf.js} +2 -2
  6. package/dist/_chunks/{PkLazyImg-BBFsS16D.js.map → PkLazyImg-BqbuNQgf.js.map} +1 -1
  7. package/dist/_chunks/{PkStreamingMarkdown-D2aqCD0I.js → PkStreamingMarkdown-BlTH2AJX.js} +2 -2
  8. package/dist/_chunks/{PkStreamingMarkdown-D2aqCD0I.js.map → PkStreamingMarkdown-BlTH2AJX.js.map} +1 -1
  9. package/dist/_chunks/{PkToolEditSpreadsheet-83ZdmGeA.js → PkToolEditSpreadsheet-CDxglslA.js} +2 -2
  10. package/dist/_chunks/{PkToolEditSpreadsheet-83ZdmGeA.js.map → PkToolEditSpreadsheet-CDxglslA.js.map} +1 -1
  11. package/dist/_chunks/{PkToolRequestGeolocation-1cOmCG8P.js → PkToolRequestGeolocation-CxMAoAv6.js} +2 -2
  12. package/dist/_chunks/{PkToolRequestGeolocation-1cOmCG8P.js.map → PkToolRequestGeolocation-CxMAoAv6.js.map} +1 -1
  13. package/dist/_chunks/{PkToolRequestOAuthConnection-CCu3FCyo.js → PkToolRequestOAuthConnection-DU1Y2odZ.js} +3 -3
  14. package/dist/_chunks/{PkToolRequestOAuthConnection-CCu3FCyo.js.map → PkToolRequestOAuthConnection-DU1Y2odZ.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShareDocument-BhT59J9o.js → PkToolShareDocument-YrPrexhS.js} +5 -5
  16. package/dist/_chunks/{PkToolShareDocument-BhT59J9o.js.map → PkToolShareDocument-YrPrexhS.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowArtifact-CiYkZkpe.js → PkToolShowArtifact-jQeIv65U.js} +4 -4
  18. package/dist/_chunks/{PkToolShowArtifact-CiYkZkpe.js.map → PkToolShowArtifact-jQeIv65U.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowCalendarEvent-Dzh4JURs.js → PkToolShowCalendarEvent-CAN5-qnM.js} +4 -4
  20. package/dist/_chunks/{PkToolShowCalendarEvent-Dzh4JURs.js.map → PkToolShowCalendarEvent-CAN5-qnM.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowComparison-CFHrXnaB.js → PkToolShowComparison-DGxHYpl3.js} +4 -4
  22. package/dist/_chunks/{PkToolShowComparison-CFHrXnaB.js.map → PkToolShowComparison-DGxHYpl3.js.map} +1 -1
  23. package/dist/_chunks/{PkToolShowContactForm-D7TEzrYe.js → PkToolShowContactForm-D7wg3Jlu.js} +5 -5
  24. package/dist/_chunks/{PkToolShowContactForm-D7TEzrYe.js.map → PkToolShowContactForm-D7wg3Jlu.js.map} +1 -1
  25. package/dist/_chunks/{PkToolShowDiagram-DGnIuRst.js → PkToolShowDiagram-BBs1rh96.js} +4 -4
  26. package/dist/_chunks/{PkToolShowDiagram-DGnIuRst.js.map → PkToolShowDiagram-BBs1rh96.js.map} +1 -1
  27. package/dist/_chunks/{PkToolShowEmail-C3jped-R.js → PkToolShowEmail-CeiSo-zx.js} +4 -4
  28. package/dist/_chunks/{PkToolShowEmail-C3jped-R.js.map → PkToolShowEmail-CeiSo-zx.js.map} +1 -1
  29. package/dist/_chunks/{PkToolShowForm-CSh4Q6sl.js → PkToolShowForm-BMVgXxzl.js} +4 -4
  30. package/dist/_chunks/{PkToolShowForm-CSh4Q6sl.js.map → PkToolShowForm-BMVgXxzl.js.map} +1 -1
  31. package/dist/_chunks/{PkToolShowImageGallery-CQEaEfYE.js → PkToolShowImageGallery-Ba0CfKt6.js} +3 -3
  32. package/dist/_chunks/{PkToolShowImageGallery-CQEaEfYE.js.map → PkToolShowImageGallery-Ba0CfKt6.js.map} +1 -1
  33. package/dist/_chunks/{PkToolShowLocation-gyMiVjhi.js → PkToolShowLocation-Cp95-u2H.js} +4 -4
  34. package/dist/_chunks/{PkToolShowLocation-gyMiVjhi.js.map → PkToolShowLocation-Cp95-u2H.js.map} +1 -1
  35. package/dist/_chunks/{PkToolShowMessage-wGPPnOAM.js → PkToolShowMessage-Bn8O_W0D.js} +4 -4
  36. package/dist/_chunks/{PkToolShowMessage-wGPPnOAM.js.map → PkToolShowMessage-Bn8O_W0D.js.map} +1 -1
  37. package/dist/_chunks/{PkToolShowProductList-BCmULLct.js → PkToolShowProductList-DbZfUUWe.js} +4 -4
  38. package/dist/_chunks/{PkToolShowProductList-BCmULLct.js.map → PkToolShowProductList-DbZfUUWe.js.map} +1 -1
  39. package/dist/_chunks/{PkToolShowQrCode-CeZsvZvb.js → PkToolShowQrCode-D_9_c-Ws.js} +4 -4
  40. package/dist/_chunks/{PkToolShowQrCode-CeZsvZvb.js.map → PkToolShowQrCode-D_9_c-Ws.js.map} +1 -1
  41. package/dist/_chunks/{PkToolShowSources-R9KWsfTQ.js → PkToolShowSources-Dkt4IId2.js} +4 -4
  42. package/dist/_chunks/{PkToolShowSources-R9KWsfTQ.js.map → PkToolShowSources-Dkt4IId2.js.map} +1 -1
  43. package/dist/_chunks/{PkToolShowSuggestedReply-DYZz9aV2.js → PkToolShowSuggestedReply-BF2sT3B1.js} +2 -2
  44. package/dist/_chunks/{PkToolShowSuggestedReply-DYZz9aV2.js.map → PkToolShowSuggestedReply-BF2sT3B1.js.map} +1 -1
  45. package/dist/_chunks/{PkToolShowVideo-C_9SZtZM.js → PkToolShowVideo-l8JoSKCj.js} +3 -3
  46. package/dist/_chunks/{PkToolShowVideo-C_9SZtZM.js.map → PkToolShowVideo-l8JoSKCj.js.map} +1 -1
  47. package/dist/_chunks/{PkToolShowWeather-BgS4_SWb.js → PkToolShowWeather-DifqBB7o.js} +2 -2
  48. package/dist/_chunks/{PkToolShowWeather-BgS4_SWb.js.map → PkToolShowWeather-DifqBB7o.js.map} +1 -1
  49. package/dist/_chunks/{PkToolShowWebPages-DwRYfle9.js → PkToolShowWebPages-DtcEmrYt.js} +4 -4
  50. package/dist/_chunks/{PkToolShowWebPages-DwRYfle9.js.map → PkToolShowWebPages-DtcEmrYt.js.map} +1 -1
  51. package/dist/_chunks/{VvButtonLocalized-B6igS2e0.js → VvButtonLocalized-D7K9ZslZ.js} +2 -2
  52. package/dist/_chunks/{VvButtonLocalized-B6igS2e0.js.map → VvButtonLocalized-D7K9ZslZ.js.map} +1 -1
  53. package/dist/_chunks/{VvCheckboxGroup.es-OXhptnPU.js → VvCheckboxGroup.es-BebSMBKU.js} +2 -2
  54. package/dist/_chunks/{VvCheckboxGroup.es-OXhptnPU.js.map → VvCheckboxGroup.es-BebSMBKU.js.map} +1 -1
  55. package/dist/_chunks/{VvCombobox.es-SLzX9VnX.js → VvCombobox.es-BfiDcdcw.js} +481 -481
  56. package/dist/_chunks/{VvCombobox.es-SLzX9VnX.js.map → VvCombobox.es-BfiDcdcw.js.map} +1 -1
  57. package/dist/_chunks/{VvInputText.es-CETcNKlr.js → VvInputText.es-DllQ2Tue.js} +435 -435
  58. package/dist/_chunks/{VvInputText.es-CETcNKlr.js.map → VvInputText.es-DllQ2Tue.js.map} +1 -1
  59. package/dist/_chunks/{VvRadioGroup.es-UBZBB89A.js → VvRadioGroup.es-D6uqf6a1.js} +2 -2
  60. package/dist/_chunks/{VvRadioGroup.es-UBZBB89A.js.map → VvRadioGroup.es-D6uqf6a1.js.map} +1 -1
  61. package/dist/_chunks/{VvSelect.es-B_MShGnJ.js → VvSelect.es-BR5Ci5VC.js} +2 -2
  62. package/dist/_chunks/{VvSelect.es-B_MShGnJ.js.map → VvSelect.es-BR5Ci5VC.js.map} +1 -1
  63. package/dist/_chunks/{VvTextarea.es-Dm2Yq3WM.js → VvTextarea.es-Bwe5xjXl.js} +29 -29
  64. package/dist/_chunks/{VvTextarea.es-Dm2Yq3WM.js.map → VvTextarea.es-Bwe5xjXl.js.map} +1 -1
  65. package/dist/_chunks/{dist-Do_Ac5Yv.js → dist-CB7v_M5z.js} +52 -46
  66. package/dist/_chunks/dist-CB7v_M5z.js.map +1 -0
  67. package/dist/_chunks/{index.es-BTDKU45u.js → index.es-CKF2q-ww.js} +26 -26
  68. package/dist/_chunks/{index.es-BTDKU45u.js.map → index.es-CKF2q-ww.js.map} +1 -1
  69. package/dist/_chunks/{index.es-BZS9Cscn.js → index.es-CoWhnabo.js} +16 -16
  70. package/dist/_chunks/{index.es-BZS9Cscn.js.map → index.es-CoWhnabo.js.map} +1 -1
  71. package/dist/ai-elements.es.js +4171 -3913
  72. package/dist/ai-elements.es.js.map +1 -1
  73. package/dist-vue/PkChatbot.js +1 -1
  74. package/dist-vue/PkChatbotInput.js +1 -1
  75. package/dist-vue/PkChatbotQueuedMessages.d.ts +2 -0
  76. package/dist-vue/PkChatbotQueuedMessages.js +1 -0
  77. package/dist-vue/PkChatbotViewChat.js +1 -1
  78. package/dist-vue/PkChatbotViewConversations.js +1 -1
  79. package/dist-vue/PkChatbotViewFiles.js +1 -1
  80. package/dist-vue/PkChatbotViewProfile.js +1 -1
  81. package/dist-vue/_chunks/PkChatbot-CObEhs2T.js +279 -0
  82. package/dist-vue/_chunks/PkChatbot-CObEhs2T.js.map +1 -0
  83. package/dist-vue/_chunks/{PkChatbotInput-BJHtmPR-.js → PkChatbotInput-CuEoeb_M.js} +47 -22
  84. package/dist-vue/_chunks/PkChatbotInput-CuEoeb_M.js.map +1 -0
  85. package/dist-vue/_chunks/PkChatbotQueuedMessages-DlydYgwC.js +51 -0
  86. package/dist-vue/_chunks/PkChatbotQueuedMessages-DlydYgwC.js.map +1 -0
  87. package/dist-vue/_chunks/{PkChatbotViewChat-BI_PtT72.js → PkChatbotViewChat-BZb-U7Ju.js} +246 -224
  88. package/dist-vue/_chunks/PkChatbotViewChat-BZb-U7Ju.js.map +1 -0
  89. package/dist-vue/_chunks/PkChatbotViewConversations-CCPRWCKs.js +210 -0
  90. package/dist-vue/_chunks/PkChatbotViewConversations-CCPRWCKs.js.map +1 -0
  91. package/dist-vue/_chunks/{PkChatbotViewFiles-Cwm-JQMF.js → PkChatbotViewFiles-BgqksCn0.js} +2 -2
  92. package/dist-vue/_chunks/{PkChatbotViewFiles-Cwm-JQMF.js.map → PkChatbotViewFiles-BgqksCn0.js.map} +1 -1
  93. package/dist-vue/_chunks/{PkChatbotViewProfile-C_GElIM3.js → PkChatbotViewProfile-B6tHWrqn.js} +2 -2
  94. package/dist-vue/_chunks/{PkChatbotViewProfile-C_GElIM3.js.map → PkChatbotViewProfile-B6tHWrqn.js.map} +1 -1
  95. package/dist-vue/_chunks/{createChatbotApiClient-DUz4dwzY.js → createChatbotApiClient-hcFAulTq.js} +12 -3
  96. package/dist-vue/_chunks/createChatbotApiClient-hcFAulTq.js.map +1 -0
  97. package/dist-vue/_chunks/{useChatbotStore-D7LcpA-6.js → useChatbotStore-Ct7G-voO.js} +953 -800
  98. package/dist-vue/_chunks/useChatbotStore-Ct7G-voO.js.map +1 -0
  99. package/dist-vue/api.js +1 -1
  100. package/dist-vue/composables.js +10 -6
  101. package/dist-vue/composables.js.map +1 -1
  102. package/dist-vue/index.js +94 -80
  103. package/dist-vue/index.js.map +1 -1
  104. package/dist-vue/locales.js +16 -2
  105. package/dist-vue/packages/components/src/chat/PkChatSidebarConversationItem.d.ts +2 -0
  106. package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +17 -3
  107. package/dist-vue/packages/components/src/chat/PkChatbotQueuedMessages.d.ts +22 -0
  108. package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +5 -1
  109. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +37 -2
  110. package/dist-vue/style.css +1 -1
  111. package/package.json +1 -1
  112. package/dist/_chunks/dist-Do_Ac5Yv.js.map +0 -1
  113. package/dist-vue/_chunks/PkChatbot-DIqduIwr.js +0 -290
  114. package/dist-vue/_chunks/PkChatbot-DIqduIwr.js.map +0 -1
  115. package/dist-vue/_chunks/PkChatbotInput-BJHtmPR-.js.map +0 -1
  116. package/dist-vue/_chunks/PkChatbotViewChat-BI_PtT72.js.map +0 -1
  117. package/dist-vue/_chunks/PkChatbotViewConversations-Bg4jSO9a.js +0 -199
  118. package/dist-vue/_chunks/PkChatbotViewConversations-Bg4jSO9a.js.map +0 -1
  119. package/dist-vue/_chunks/createChatbotApiClient-DUz4dwzY.js.map +0 -1
  120. package/dist-vue/_chunks/useChatbotStore-D7LcpA-6.js.map +0 -1
@@ -1,15 +1,15 @@
1
1
  import { C as e, D as t, O as n, S as r, _ as i, a, g as o, h as s, i as c, l, m as u, o as d, p as f, r as p, s as m, u as h, v as g, w as _, x as v } from "./schemas-Bu1lick6.js";
2
2
  import { H as ee, K as y, L as te, V as ne, W as re, X as ie, Y as ae, Z as oe } from "./Agent-DZb775Ak.js";
3
- import { r as se, t as ce } from "./createChatbotApiClient-DUz4dwzY.js";
3
+ import { r as se, t as ce } from "./createChatbotApiClient-hcFAulTq.js";
4
4
  import { n as le } from "./src-BZRiAJsH.js";
5
5
  import { d as ue, r as de } from "./message-DZvfzt9j.js";
6
6
  import { n as fe, t as pe } from "./useSafeLocalStorage-C1BlCeKw.js";
7
- import { computed as b, getCurrentScope as me, isReadonly as he, nextTick as ge, onScopeDispose as _e, reactive as ve, ref as x, shallowRef as S, toRefs as ye, toValue as be, watch as C, watchEffect as xe } from "vue";
8
- import { useI18n as Se } from "vue-i18n";
9
- import { usePreferredDark as Ce } from "@vueuse/core";
10
- import { defineStore as we } from "pinia";
7
+ import { computed as b, getCurrentScope as me, isReadonly as he, nextTick as ge, onScopeDispose as _e, reactive as ve, ref as x, shallowRef as ye, toRefs as be, toValue as xe, watch as S, watchEffect as Se } from "vue";
8
+ import { useI18n as Ce } from "vue-i18n";
9
+ import { useDocumentVisibility as we, usePreferredDark as Te } from "@vueuse/core";
10
+ import { defineStore as Ee } from "pinia";
11
11
  //#region ../../packages/utils/src/device-context.ts
12
- function Te() {
12
+ function De() {
13
13
  let e = navigator.connection, t = navigator.userAgentData;
14
14
  return {
15
15
  dateTime: (/* @__PURE__ */ new Date()).toISOString(),
@@ -39,7 +39,7 @@ function Te() {
39
39
  historyLength: window.history.length
40
40
  };
41
41
  }
42
- async function Ee(e) {
42
+ async function Oe(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;
@@ -58,16 +58,16 @@ async function Ee(e) {
58
58
  }
59
59
  //#endregion
60
60
  //#region ../../packages/composable/src/chatbot/hostTools.ts
61
- var De = "agentstudio:page-navigation", Oe = (e) => typeof e?.afterOutput == "function", ke = (e) => e.toolMetadata?.source === ae, Ae = (e, t) => {
61
+ var ke = "agentstudio:page-navigation", Ae = (e) => typeof e?.afterOutput == "function", je = (e) => e.toolMetadata?.source === ae, Me = (e, t) => {
62
62
  if (!t || !e?.length) return;
63
63
  let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !re(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
64
64
  return r.length > 0 ? r : void 0;
65
65
  };
66
- function je(e) {
66
+ function Ne(e) {
67
67
  let t = 0, n = 0, r = (t) => {
68
68
  n = t, e.onPendingChange?.(n);
69
69
  }, i = Promise.resolve(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (e) => {
70
- Oe(e) && e.abandon?.();
70
+ Ae(e) && e.abandon?.();
71
71
  }, c = (e, t) => t.requireConfirmation.includes(e.name) || t.confirmDestructive && e.annotations?.destructiveHint === !0, l = (t, n) => e.addToolOutput({
72
72
  tool: t.toolName,
73
73
  toolCallId: t.toolCallId,
@@ -118,7 +118,7 @@ function je(e) {
118
118
  s(r);
119
119
  return;
120
120
  }
121
- if (Oe(r)) {
121
+ if (Ae(r)) {
122
122
  l(n, r.result ?? null);
123
123
  let t = !1, a = () => {
124
124
  t || (t = !0, o.delete(a), r.abandon?.());
@@ -152,65 +152,65 @@ function je(e) {
152
152
  }
153
153
  //#endregion
154
154
  //#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.27/node_modules/@ai-sdk/provider/dist/index.js
155
- var Me = "vercel.ai.error", Ne = Symbol.for(Me), w = class e extends Error {
155
+ var Pe = "vercel.ai.error", Fe = Symbol.for(Pe), C = class e extends Error {
156
156
  constructor({ name: e, message: t, cause: n }) {
157
- super(t), this[Ne] = !0, this.name = e, this.cause = n;
157
+ super(t), this[Fe] = !0, this.name = e, this.cause = n;
158
158
  }
159
159
  static isInstance(t) {
160
- return e.hasMarker(t, Me);
160
+ return e.hasMarker(t, Pe);
161
161
  }
162
162
  static hasMarker(e, t) {
163
163
  let n = Symbol.for(t);
164
164
  return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
165
165
  }
166
- }, Pe = "AI_APICallError", Fe = `vercel.ai.error.${Pe}`, Ie = Symbol.for(Fe), T = class extends w {
166
+ }, Ie = "AI_APICallError", Le = `vercel.ai.error.${Ie}`, Re = Symbol.for(Le), ze = class extends C {
167
167
  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 }) {
168
168
  super({
169
- name: Pe,
169
+ name: Ie,
170
170
  message: e,
171
171
  cause: o
172
- }), this[Ie] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
172
+ }), this[Re] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
173
173
  }
174
174
  static isInstance(e) {
175
- return w.hasMarker(e, Fe);
175
+ return C.hasMarker(e, Le);
176
176
  }
177
- }, Le = "AI_EmptyResponseBodyError", Re = `vercel.ai.error.${Le}`, E = Symbol.for(Re), D = class extends w {
177
+ }, w = "AI_EmptyResponseBodyError", Be = `vercel.ai.error.${w}`, Ve = Symbol.for(Be), T = class extends C {
178
178
  constructor({ message: e = "Empty response body" } = {}) {
179
179
  super({
180
- name: Le,
180
+ name: w,
181
181
  message: e
182
- }), this[E] = !0;
182
+ }), this[Ve] = !0;
183
183
  }
184
184
  static isInstance(e) {
185
- return w.hasMarker(e, Re);
185
+ return C.hasMarker(e, Be);
186
186
  }
187
187
  };
188
- function ze(e) {
188
+ function He(e) {
189
189
  return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
190
190
  }
191
- var Be = "AI_InvalidArgumentError", Ve = `vercel.ai.error.${Be}`, He = Symbol.for(Ve), Ue = class extends w {
191
+ var Ue = "AI_InvalidArgumentError", We = `vercel.ai.error.${Ue}`, Ge = Symbol.for(We), Ke = class extends C {
192
192
  constructor({ message: e, cause: t, argument: n }) {
193
193
  super({
194
- name: Be,
194
+ name: Ue,
195
195
  message: e,
196
196
  cause: t
197
- }), this[He] = !0, this.argument = n;
197
+ }), this[Ge] = !0, this.argument = n;
198
198
  }
199
199
  static isInstance(e) {
200
- return w.hasMarker(e, Ve);
200
+ return C.hasMarker(e, We);
201
201
  }
202
- }, We = "AI_JSONParseError", O = `vercel.ai.error.${We}`, Ge = Symbol.for(O), Ke = class extends w {
202
+ }, qe = "AI_JSONParseError", Je = `vercel.ai.error.${qe}`, Ye = Symbol.for(Je), Xe = class extends C {
203
203
  constructor({ text: e, cause: t }) {
204
204
  super({
205
- name: We,
206
- message: `JSON parsing failed: Text: ${e}.\nError message: ${ze(t)}`,
205
+ name: qe,
206
+ message: `JSON parsing failed: Text: ${e}.\nError message: ${He(t)}`,
207
207
  cause: t
208
- }), this[Ge] = !0, this.text = e;
208
+ }), this[Ye] = !0, this.text = e;
209
209
  }
210
210
  static isInstance(e) {
211
- return w.hasMarker(e, O);
211
+ return C.hasMarker(e, Je);
212
212
  }
213
- }, qe = "AI_TypeValidationError", Je = `vercel.ai.error.${qe}`, k = Symbol.for(Je), A = class e extends w {
213
+ }, Ze = "AI_TypeValidationError", Qe = `vercel.ai.error.${Ze}`, $e = Symbol.for(Qe), E = class e extends C {
214
214
  constructor({ value: e, cause: t, context: n }) {
215
215
  let r = "Type validation failed";
216
216
  if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
@@ -219,13 +219,13 @@ var Be = "AI_InvalidArgumentError", Ve = `vercel.ai.error.${Be}`, He = Symbol.fo
219
219
  n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
220
220
  }
221
221
  super({
222
- name: qe,
223
- message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${ze(t)}`,
222
+ name: Ze,
223
+ message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${He(t)}`,
224
224
  cause: t
225
- }), this[k] = !0, this.value = e, this.context = n;
225
+ }), this[$e] = !0, this.value = e, this.context = n;
226
226
  }
227
227
  static isInstance(e) {
228
- return w.hasMarker(e, Je);
228
+ return C.hasMarker(e, Qe);
229
229
  }
230
230
  static wrap({ value: t, cause: n, context: r }) {
231
231
  return e.isInstance(n) && n.value === t && n.context?.field === r?.field && n.context?.entityName === r?.entityName && n.context?.entityId === r?.entityId ? n : new e({
@@ -234,25 +234,25 @@ var Be = "AI_InvalidArgumentError", Ve = `vercel.ai.error.${Be}`, He = Symbol.fo
234
234
  context: r
235
235
  });
236
236
  }
237
- }, Ye = "AI_UnsupportedFunctionalityError", Xe = `vercel.ai.error.${Ye}`, j = Symbol.for(Xe), Ze = class extends w {
237
+ }, et = "AI_UnsupportedFunctionalityError", tt = `vercel.ai.error.${et}`, nt = Symbol.for(tt), D = class extends C {
238
238
  constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
239
239
  super({
240
- name: Ye,
240
+ name: et,
241
241
  message: t
242
- }), this[j] = !0, this.functionality = e;
242
+ }), this[nt] = !0, this.functionality = e;
243
243
  }
244
244
  static isInstance(e) {
245
- return w.hasMarker(e, Xe);
245
+ return C.hasMarker(e, tt);
246
246
  }
247
- }, Qe = class extends Error {
247
+ }, rt = class extends Error {
248
248
  constructor(e, t) {
249
249
  super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
250
250
  }
251
- }, $e = 10, et = 13, M = 32;
252
- function tt(e) {}
253
- function nt(e) {
251
+ }, it = 10, at = 13, O = 32;
252
+ function k(e) {}
253
+ function ot(e) {
254
254
  if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
255
- let { onEvent: t = tt, onError: n = tt, onRetry: r = tt, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
255
+ let { onEvent: t = k, onError: n = k, onRetry: r = k, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
256
256
  function m(e) {
257
257
  if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
258
258
  if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
@@ -271,7 +271,7 @@ function nt(e) {
271
271
  n !== "" && (o.push(n), s = n.length), h();
272
272
  }
273
273
  function h() {
274
- 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 Qe(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
274
+ 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" }))));
275
275
  }
276
276
  function g(e) {
277
277
  let n = 0;
@@ -287,9 +287,9 @@ function nt(e) {
287
287
  continue;
288
288
  }
289
289
  let i = e.charCodeAt(n);
290
- if (N(e, n, i)) {
291
- let i = e.charCodeAt(n + 5) === M ? n + 6 : n + 5, a = e.slice(i, r);
292
- if (d === 0 && e.charCodeAt(r + 1) === $e) {
290
+ if (st(e, n, i)) {
291
+ let i = e.charCodeAt(n + 5) === O ? n + 6 : n + 5, a = e.slice(i, r);
292
+ if (d === 0 && e.charCodeAt(r + 1) === it) {
293
293
  t({
294
294
  id: l,
295
295
  event: f,
@@ -299,7 +299,7 @@ function nt(e) {
299
299
  }
300
300
  u = d === 0 ? a : `${u}
301
301
  ${a}`, d++;
302
- } else rt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === M ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
302
+ } else A(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === O ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
303
303
  n = r + 1, r = e.indexOf("\n", n);
304
304
  }
305
305
  return e.slice(n);
@@ -307,7 +307,7 @@ ${a}`, d++;
307
307
  for (; n < e.length;) {
308
308
  let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
309
309
  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;
310
- _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === et && e.charCodeAt(n) === $e && n++;
310
+ _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === at && e.charCodeAt(n) === it && n++;
311
311
  }
312
312
  return e.slice(n);
313
313
  }
@@ -317,25 +317,25 @@ ${a}`, d++;
317
317
  return;
318
318
  }
319
319
  let r = e.charCodeAt(t);
320
- if (N(e, t, r)) {
321
- let r = e.charCodeAt(t + 5) === M ? t + 6 : t + 5, i = e.slice(r, n);
320
+ if (st(e, t, r)) {
321
+ let r = e.charCodeAt(t + 5) === O ? t + 6 : t + 5, i = e.slice(r, n);
322
322
  u = d === 0 ? i : `${u}
323
323
  ${i}`, d++;
324
324
  return;
325
325
  }
326
- if (rt(e, t, r)) {
327
- f = e.slice(e.charCodeAt(t + 6) === M ? t + 7 : t + 6, n) || void 0;
326
+ if (A(e, t, r)) {
327
+ f = e.slice(e.charCodeAt(t + 6) === O ? t + 7 : t + 6, n) || void 0;
328
328
  return;
329
329
  }
330
330
  if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
331
- let r = e.slice(e.charCodeAt(t + 3) === M ? t + 4 : t + 3, n);
331
+ let r = e.slice(e.charCodeAt(t + 3) === O ? t + 4 : t + 3, n);
332
332
  l = r.includes("\0") ? void 0 : r;
333
333
  return;
334
334
  }
335
335
  if (r === 58) {
336
336
  if (i) {
337
337
  let r = e.slice(t, n);
338
- i(r.slice(e.charCodeAt(t + 1) === M ? 2 : 1));
338
+ i(r.slice(e.charCodeAt(t + 1) === O ? 2 : 1));
339
339
  }
340
340
  return;
341
341
  }
@@ -344,7 +344,7 @@ ${i}`, d++;
344
344
  v(a, "", a);
345
345
  return;
346
346
  }
347
- let s = a.slice(0, o), c = a.charCodeAt(o + 1) === M ? 2 : 1;
347
+ let s = a.slice(0, o), c = a.charCodeAt(o + 1) === O ? 2 : 1;
348
348
  v(s, a.slice(o + c), a);
349
349
  }
350
350
  function v(e, t, i) {
@@ -360,13 +360,13 @@ ${t}`, d++;
360
360
  l = t.includes("\0") ? void 0 : t;
361
361
  break;
362
362
  case "retry":
363
- /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Qe(`Invalid \`retry\` value: "${t}"`, {
363
+ /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new rt(`Invalid \`retry\` value: "${t}"`, {
364
364
  type: "invalid-retry",
365
365
  value: t,
366
366
  line: i
367
367
  }));
368
368
  break;
369
- default: n(new Qe(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
369
+ default: n(new rt(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
370
370
  type: "unknown-field",
371
371
  field: e,
372
372
  value: t,
@@ -393,20 +393,20 @@ ${t}`, d++;
393
393
  reset: y
394
394
  };
395
395
  }
396
- function N(e, t, n) {
396
+ function st(e, t, n) {
397
397
  return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
398
398
  }
399
- function rt(e, t, n) {
399
+ function A(e, t, n) {
400
400
  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;
401
401
  }
402
402
  //#endregion
403
403
  //#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
404
- var P = class extends TransformStream {
404
+ var ct = class extends TransformStream {
405
405
  constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
406
406
  let i;
407
407
  super({
408
408
  start(a) {
409
- i = nt({
409
+ i = ot({
410
410
  onEvent: (e) => {
411
411
  a.enqueue(e);
412
412
  },
@@ -425,8 +425,8 @@ var P = class extends TransformStream {
425
425
  }
426
426
  };
427
427
  new TextDecoder();
428
- var { btoa: it, atob: at } = globalThis;
429
- function ot(e) {
428
+ var { btoa: lt, atob: ut } = globalThis;
429
+ function j(e) {
430
430
  if (e == null) return {};
431
431
  let t = {};
432
432
  if (e instanceof Headers) e.forEach((e, n) => {
@@ -438,28 +438,28 @@ function ot(e) {
438
438
  }
439
439
  return t;
440
440
  }
441
- var F = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
441
+ var M = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
442
442
  let i = () => {
443
443
  let e = n.length, r = Array(t);
444
444
  for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
445
445
  return r.join("");
446
446
  };
447
447
  if (e == null) return i;
448
- if (n.includes(r)) throw new Ue({
448
+ if (n.includes(r)) throw new Ke({
449
449
  argument: "separator",
450
450
  message: `The separator "${r}" must not be part of the alphabet "${n}".`
451
451
  });
452
452
  return () => `${e}${r}${i()}`;
453
- }, st = F();
454
- function ct(e) {
453
+ }, dt = M();
454
+ function N(e) {
455
455
  return globalThis.Buffer?.isBuffer(e) ?? !1;
456
456
  }
457
- var lt = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, I = /"(?: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*:/;
458
- function ut(e) {
457
+ var ft = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, pt = /"(?: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*:/;
458
+ function mt(e) {
459
459
  let t = JSON.parse(e);
460
- return typeof t != "object" || !t || lt.test(e) === !1 && I.test(e) === !1 ? t : L(t);
460
+ return typeof t != "object" || !t || ft.test(e) === !1 && pt.test(e) === !1 ? t : ht(t);
461
461
  }
462
- function L(e) {
462
+ function ht(e) {
463
463
  let t = [e];
464
464
  for (; t.length;) {
465
465
  let e = t;
@@ -474,35 +474,35 @@ function L(e) {
474
474
  }
475
475
  return e;
476
476
  }
477
- function dt(e) {
477
+ function gt(e) {
478
478
  let { stackTraceLimit: t } = Error;
479
479
  try {
480
480
  Error.stackTraceLimit = 0;
481
481
  } catch {
482
- return ut(e);
482
+ return mt(e);
483
483
  }
484
484
  try {
485
- return ut(e);
485
+ return mt(e);
486
486
  } finally {
487
487
  Error.stackTraceLimit = t;
488
488
  }
489
489
  }
490
- function ft(e) {
490
+ function _t(e) {
491
491
  if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
492
492
  let { additionalProperties: t } = e;
493
- e.additionalProperties = t != null && typeof t != "boolean" && R(t);
493
+ e.additionalProperties = t != null && typeof t != "boolean" && P(t);
494
494
  let { properties: n } = e;
495
- if (n != null) for (let e of Object.keys(n)) n[e] = R(n[e]);
495
+ if (n != null) for (let e of Object.keys(n)) n[e] = P(n[e]);
496
496
  }
497
- e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(R) : R(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(R)), e.allOf != null && (e.allOf = e.allOf.map(R)), e.oneOf != null && (e.oneOf = e.oneOf.map(R));
497
+ e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(P) : P(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(P)), e.allOf != null && (e.allOf = e.allOf.map(P)), e.oneOf != null && (e.oneOf = e.oneOf.map(P));
498
498
  let { definitions: t } = e;
499
- if (t != null) for (let e of Object.keys(t)) t[e] = R(t[e]);
499
+ if (t != null) for (let e of Object.keys(t)) t[e] = P(t[e]);
500
500
  return e;
501
501
  }
502
- function R(e) {
503
- return typeof e == "boolean" ? e : ft(e);
502
+ function P(e) {
503
+ return typeof e == "boolean" ? e : _t(e);
504
504
  }
505
- var pt = Symbol("Let zodToJsonSchema decide on which parser to use"), mt = {
505
+ var vt = Symbol("Let zodToJsonSchema decide on which parser to use"), yt = {
506
506
  name: void 0,
507
507
  $refStrategy: "root",
508
508
  basePath: ["#"],
@@ -522,24 +522,24 @@ var pt = Symbol("Let zodToJsonSchema decide on which parser to use"), mt = {
522
522
  emailStrategy: "format:email",
523
523
  base64Strategy: "contentEncoding:base64",
524
524
  nameStrategy: "ref"
525
- }, ht = (e) => typeof e == "string" ? {
526
- ...mt,
525
+ }, bt = (e) => typeof e == "string" ? {
526
+ ...yt,
527
527
  name: e
528
528
  } : {
529
- ...mt,
529
+ ...yt,
530
530
  ...e
531
531
  };
532
- function z() {
532
+ function F() {
533
533
  return {};
534
534
  }
535
- function gt(e, t) {
535
+ function xt(e, t) {
536
536
  let n = { type: "array" };
537
- return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = J(e.type._def, {
537
+ return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = K(e.type._def, {
538
538
  ...t,
539
539
  currentPath: [...t.currentPath, "items"]
540
540
  })), 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;
541
541
  }
542
- function _t(e) {
542
+ function St(e) {
543
543
  let t = {
544
544
  type: "integer",
545
545
  format: "int64"
@@ -556,16 +556,16 @@ function _t(e) {
556
556
  }
557
557
  return t;
558
558
  }
559
- function vt() {
559
+ function I() {
560
560
  return { type: "boolean" };
561
561
  }
562
- function B(e, t) {
563
- return J(e.type._def, t);
562
+ function Ct(e, t) {
563
+ return K(e.type._def, t);
564
564
  }
565
- var V = (e, t) => J(e.innerType._def, t);
566
- function H(e, t, n) {
565
+ var L = (e, t) => K(e.innerType._def, t);
566
+ function wt(e, t, n) {
567
567
  let r = n ?? t.dateStrategy;
568
- if (Array.isArray(r)) return { anyOf: r.map((n) => H(e, t, n)) };
568
+ if (Array.isArray(r)) return { anyOf: r.map((n) => wt(e, t, n)) };
569
569
  switch (r) {
570
570
  case "string":
571
571
  case "format:date-time": return {
@@ -576,10 +576,10 @@ function H(e, t, n) {
576
576
  type: "string",
577
577
  format: "date"
578
578
  };
579
- case "integer": return U(e);
579
+ case "integer": return Tt(e);
580
580
  }
581
581
  }
582
- var U = (e) => {
582
+ var Tt = (e) => {
583
583
  let t = {
584
584
  type: "integer",
585
585
  format: "unix-time"
@@ -592,31 +592,31 @@ var U = (e) => {
592
592
  }
593
593
  return t;
594
594
  };
595
- function yt(e, t) {
595
+ function R(e, t) {
596
596
  return {
597
- ...J(e.innerType._def, t),
597
+ ...K(e.innerType._def, t),
598
598
  default: e.defaultValue()
599
599
  };
600
600
  }
601
- function bt(e, t) {
602
- return t.effectStrategy === "input" ? J(e.schema._def, t) : z();
601
+ function Et(e, t) {
602
+ return t.effectStrategy === "input" ? K(e.schema._def, t) : F();
603
603
  }
604
- function xt(e) {
604
+ function Dt(e) {
605
605
  return {
606
606
  type: "string",
607
607
  enum: Array.from(e.values)
608
608
  };
609
609
  }
610
- var St = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
611
- function Ct(e, t) {
612
- let n = [J(e.left._def, {
610
+ var Ot = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
611
+ function kt(e, t) {
612
+ let n = [K(e.left._def, {
613
613
  ...t,
614
614
  currentPath: [
615
615
  ...t.currentPath,
616
616
  "allOf",
617
617
  "0"
618
618
  ]
619
- }), J(e.right._def, {
619
+ }), K(e.right._def, {
620
620
  ...t,
621
621
  currentPath: [
622
622
  ...t.currentPath,
@@ -625,7 +625,7 @@ function Ct(e, t) {
625
625
  ]
626
626
  })].filter((e) => !!e), r = [];
627
627
  return n.forEach((e) => {
628
- if (St(e)) r.push(...e.allOf);
628
+ if (Ot(e)) r.push(...e.allOf);
629
629
  else {
630
630
  let t = e;
631
631
  if ("additionalProperties" in e && e.additionalProperties === !1) {
@@ -636,19 +636,19 @@ function Ct(e, t) {
636
636
  }
637
637
  }), r.length ? { allOf: r } : void 0;
638
638
  }
639
- function wt(e) {
639
+ function At(e) {
640
640
  let t = typeof e.value;
641
641
  return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
642
642
  type: t === "bigint" ? "integer" : t,
643
643
  const: e.value
644
644
  };
645
645
  }
646
- var Tt = void 0, W = {
646
+ var jt = void 0, z = {
647
647
  cuid: /^[cC][^\s-]{8,}$/,
648
648
  cuid2: /^[0-9a-z]+$/,
649
649
  ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
650
650
  email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
651
- emoji: () => (Tt === void 0 && (Tt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), Tt),
651
+ emoji: () => (jt === void 0 && (jt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), jt),
652
652
  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}$/,
653
653
  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])$/,
654
654
  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])$/,
@@ -659,7 +659,7 @@ var Tt = void 0, W = {
659
659
  nanoid: /^[a-zA-Z0-9_-]{21}$/,
660
660
  jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
661
661
  };
662
- function Et(e, t) {
662
+ function B(e, t) {
663
663
  let n = { type: "string" };
664
664
  if (e.checks) for (let r of e.checks) switch (r.kind) {
665
665
  case "min":
@@ -671,108 +671,108 @@ function Et(e, t) {
671
671
  case "email":
672
672
  switch (t.emailStrategy) {
673
673
  case "format:email":
674
- K(n, "email", r.message, t);
674
+ U(n, "email", r.message, t);
675
675
  break;
676
676
  case "format:idn-email":
677
- K(n, "idn-email", r.message, t);
677
+ U(n, "idn-email", r.message, t);
678
678
  break;
679
- case "pattern:zod": q(n, W.email, r.message, t);
679
+ case "pattern:zod": W(n, z.email, r.message, t);
680
680
  }
681
681
  break;
682
682
  case "url":
683
- K(n, "uri", r.message, t);
683
+ U(n, "uri", r.message, t);
684
684
  break;
685
685
  case "uuid":
686
- K(n, "uuid", r.message, t);
686
+ U(n, "uuid", r.message, t);
687
687
  break;
688
688
  case "regex":
689
- q(n, r.regex, r.message, t);
689
+ W(n, r.regex, r.message, t);
690
690
  break;
691
691
  case "cuid":
692
- q(n, W.cuid, r.message, t);
692
+ W(n, z.cuid, r.message, t);
693
693
  break;
694
694
  case "cuid2":
695
- q(n, W.cuid2, r.message, t);
695
+ W(n, z.cuid2, r.message, t);
696
696
  break;
697
697
  case "startsWith":
698
- q(n, RegExp(`^${G(r.value, t)}`), r.message, t);
698
+ W(n, RegExp(`^${V(r.value, t)}`), r.message, t);
699
699
  break;
700
700
  case "endsWith":
701
- q(n, RegExp(`${G(r.value, t)}$`), r.message, t);
701
+ W(n, RegExp(`${V(r.value, t)}$`), r.message, t);
702
702
  break;
703
703
  case "datetime":
704
- K(n, "date-time", r.message, t);
704
+ U(n, "date-time", r.message, t);
705
705
  break;
706
706
  case "date":
707
- K(n, "date", r.message, t);
707
+ U(n, "date", r.message, t);
708
708
  break;
709
709
  case "time":
710
- K(n, "time", r.message, t);
710
+ U(n, "time", r.message, t);
711
711
  break;
712
712
  case "duration":
713
- K(n, "duration", r.message, t);
713
+ U(n, "duration", r.message, t);
714
714
  break;
715
715
  case "length":
716
716
  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;
717
717
  break;
718
718
  case "includes":
719
- q(n, RegExp(G(r.value, t)), r.message, t);
719
+ W(n, RegExp(V(r.value, t)), r.message, t);
720
720
  break;
721
721
  case "ip":
722
- r.version !== "v6" && K(n, "ipv4", r.message, t), r.version !== "v4" && K(n, "ipv6", r.message, t);
722
+ r.version !== "v6" && U(n, "ipv4", r.message, t), r.version !== "v4" && U(n, "ipv6", r.message, t);
723
723
  break;
724
724
  case "base64url":
725
- q(n, W.base64url, r.message, t);
725
+ W(n, z.base64url, r.message, t);
726
726
  break;
727
727
  case "jwt":
728
- q(n, W.jwt, r.message, t);
728
+ W(n, z.jwt, r.message, t);
729
729
  break;
730
730
  case "cidr":
731
- r.version !== "v6" && q(n, W.ipv4Cidr, r.message, t), r.version !== "v4" && q(n, W.ipv6Cidr, r.message, t);
731
+ r.version !== "v6" && W(n, z.ipv4Cidr, r.message, t), r.version !== "v4" && W(n, z.ipv6Cidr, r.message, t);
732
732
  break;
733
733
  case "emoji":
734
- q(n, W.emoji(), r.message, t);
734
+ W(n, z.emoji(), r.message, t);
735
735
  break;
736
736
  case "ulid":
737
- q(n, W.ulid, r.message, t);
737
+ W(n, z.ulid, r.message, t);
738
738
  break;
739
739
  case "base64":
740
740
  switch (t.base64Strategy) {
741
741
  case "format:binary":
742
- K(n, "binary", r.message, t);
742
+ U(n, "binary", r.message, t);
743
743
  break;
744
744
  case "contentEncoding:base64":
745
745
  n.contentEncoding = "base64";
746
746
  break;
747
- case "pattern:zod": q(n, W.base64, r.message, t);
747
+ case "pattern:zod": W(n, z.base64, r.message, t);
748
748
  }
749
749
  break;
750
- case "nanoid": q(n, W.nanoid, r.message, t);
750
+ case "nanoid": W(n, z.nanoid, r.message, t);
751
751
  }
752
752
  return n;
753
753
  }
754
- function G(e, t) {
755
- return t.patternStrategy === "escape" ? Ot(e) : e;
754
+ function V(e, t) {
755
+ return t.patternStrategy === "escape" ? Mt(e) : e;
756
756
  }
757
- var Dt = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
758
- function Ot(e) {
757
+ var H = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
758
+ function Mt(e) {
759
759
  let t = "";
760
- for (let n = 0; n < e.length; n++) Dt.has(e[n]) || (t += "\\"), t += e[n];
760
+ for (let n = 0; n < e.length; n++) H.has(e[n]) || (t += "\\"), t += e[n];
761
761
  return t;
762
762
  }
763
- function K(e, t, n, r) {
763
+ function U(e, t, n, r) {
764
764
  e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
765
765
  format: t,
766
766
  ...n && r.errorMessages && { errorMessage: { format: n } }
767
767
  })) : e.format = t;
768
768
  }
769
- function q(e, t, n, r) {
769
+ function W(e, t, n, r) {
770
770
  e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
771
- pattern: kt(t, r),
771
+ pattern: Nt(t, r),
772
772
  ...n && r.errorMessages && { errorMessage: { pattern: n } }
773
- })) : e.pattern = kt(t, r);
773
+ })) : e.pattern = Nt(t, r);
774
774
  }
775
- function kt(e, t) {
775
+ function Nt(e, t) {
776
776
  if (!t.applyRegexFlags || !e.flags) return e.source;
777
777
  let n = {
778
778
  i: e.flags.includes("i"),
@@ -811,16 +811,16 @@ function kt(e, t) {
811
811
  }
812
812
  return i;
813
813
  }
814
- function At(e, t) {
814
+ function Pt(e, t) {
815
815
  let n = {
816
816
  type: "object",
817
- additionalProperties: J(e.valueType._def, {
817
+ additionalProperties: K(e.valueType._def, {
818
818
  ...t,
819
819
  currentPath: [...t.currentPath, "additionalProperties"]
820
820
  }) ?? t.allowedAdditionalProperties
821
821
  };
822
822
  if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
823
- let { type: r, ...i } = Et(e.keyType._def, t);
823
+ let { type: r, ...i } = B(e.keyType._def, t);
824
824
  return {
825
825
  ...n,
826
826
  propertyNames: i
@@ -831,7 +831,7 @@ function At(e, t) {
831
831
  propertyNames: { enum: e.keyType._def.values }
832
832
  };
833
833
  if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
834
- let { type: r, ...i } = B(e.keyType._def, t);
834
+ let { type: r, ...i } = Ct(e.keyType._def, t);
835
835
  return {
836
836
  ...n,
837
837
  propertyNames: i
@@ -839,13 +839,13 @@ function At(e, t) {
839
839
  }
840
840
  return n;
841
841
  }
842
- function jt(e, t) {
843
- return t.mapStrategy === "record" ? At(e, t) : {
842
+ function Ft(e, t) {
843
+ return t.mapStrategy === "record" ? Pt(e, t) : {
844
844
  type: "array",
845
845
  maxItems: 125,
846
846
  items: {
847
847
  type: "array",
848
- items: [J(e.keyType._def, {
848
+ items: [K(e.keyType._def, {
849
849
  ...t,
850
850
  currentPath: [
851
851
  ...t.currentPath,
@@ -853,7 +853,7 @@ function jt(e, t) {
853
853
  "items",
854
854
  "0"
855
855
  ]
856
- }) || z(), J(e.valueType._def, {
856
+ }) || F(), K(e.valueType._def, {
857
857
  ...t,
858
858
  currentPath: [
859
859
  ...t.currentPath,
@@ -861,37 +861,37 @@ function jt(e, t) {
861
861
  "items",
862
862
  "1"
863
863
  ]
864
- }) || z()],
864
+ }) || F()],
865
865
  minItems: 2,
866
866
  maxItems: 2
867
867
  }
868
868
  };
869
869
  }
870
- function Mt(e) {
870
+ function It(e) {
871
871
  let t = e.values, n = Object.keys(e.values).filter((e) => typeof t[t[e]] != "number").map((e) => t[e]), r = Array.from(new Set(n.map((e) => typeof e)));
872
872
  return {
873
873
  type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
874
874
  enum: n
875
875
  };
876
876
  }
877
- function Nt() {
878
- return { not: z() };
877
+ function Lt() {
878
+ return { not: F() };
879
879
  }
880
- function Pt() {
880
+ function Rt() {
881
881
  return { type: "null" };
882
882
  }
883
- var Ft = {
883
+ var zt = {
884
884
  ZodString: "string",
885
885
  ZodNumber: "number",
886
886
  ZodBigInt: "integer",
887
887
  ZodBoolean: "boolean",
888
888
  ZodNull: "null"
889
889
  };
890
- function It(e, t) {
890
+ function Bt(e, t) {
891
891
  let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
892
- if (n.every((e) => e._def.typeName in Ft && (!e._def.checks || !e._def.checks.length))) {
892
+ if (n.every((e) => e._def.typeName in zt && (!e._def.checks || !e._def.checks.length))) {
893
893
  let e = n.reduce((e, t) => {
894
- let n = Ft[t._def.typeName];
894
+ let n = zt[t._def.typeName];
895
895
  return n && !e.includes(n) ? [...e, n] : e;
896
896
  }, []);
897
897
  return { type: e.length > 1 ? e : e[0] };
@@ -919,10 +919,10 @@ function It(e, t) {
919
919
  type: "string",
920
920
  enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
921
921
  };
922
- return Lt(e, t);
922
+ return Vt(e, t);
923
923
  }
924
- var Lt = (e, t) => {
925
- let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => J(e._def, {
924
+ var Vt = (e, t) => {
925
+ let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => K(e._def, {
926
926
  ...t,
927
927
  currentPath: [
928
928
  ...t.currentPath,
@@ -932,15 +932,15 @@ var Lt = (e, t) => {
932
932
  })).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
933
933
  return n.length ? { anyOf: n } : void 0;
934
934
  };
935
- function Rt(e, t) {
935
+ function Ht(e, t) {
936
936
  if ([
937
937
  "ZodString",
938
938
  "ZodNumber",
939
939
  "ZodBigInt",
940
940
  "ZodBoolean",
941
941
  "ZodNull"
942
- ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Ft[e.innerType._def.typeName], "null"] };
943
- let n = J(e.innerType._def, {
942
+ ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [zt[e.innerType._def.typeName], "null"] };
943
+ let n = K(e.innerType._def, {
944
944
  ...t,
945
945
  currentPath: [
946
946
  ...t.currentPath,
@@ -950,7 +950,7 @@ function Rt(e, t) {
950
950
  });
951
951
  return n && { anyOf: [n, { type: "null" }] };
952
952
  }
953
- function zt(e) {
953
+ function Ut(e) {
954
954
  let t = { type: "number" };
955
955
  if (!e.checks) return t;
956
956
  for (let n of e.checks) switch (n.kind) {
@@ -967,7 +967,7 @@ function zt(e) {
967
967
  }
968
968
  return t;
969
969
  }
970
- function Bt(e, t) {
970
+ function Wt(e, t) {
971
971
  let n = {
972
972
  type: "object",
973
973
  properties: {}
@@ -975,7 +975,7 @@ function Bt(e, t) {
975
975
  for (let e in i) {
976
976
  let a = i[e];
977
977
  if (a === void 0 || a._def === void 0) continue;
978
- let o = Ht(a), s = J(a._def, {
978
+ let o = Kt(a), s = K(a._def, {
979
979
  ...t,
980
980
  currentPath: [
981
981
  ...t.currentPath,
@@ -991,11 +991,11 @@ function Bt(e, t) {
991
991
  s !== void 0 && (n.properties[e] = s, o || r.push(e));
992
992
  }
993
993
  r.length && (n.required = r);
994
- let a = Vt(e, t);
994
+ let a = Gt(e, t);
995
995
  return a !== void 0 && (n.additionalProperties = a), n;
996
996
  }
997
- function Vt(e, t) {
998
- if (e.catchall._def.typeName !== "ZodNever") return J(e.catchall._def, {
997
+ function Gt(e, t) {
998
+ if (e.catchall._def.typeName !== "ZodNever") return K(e.catchall._def, {
999
999
  ...t,
1000
1000
  currentPath: [...t.currentPath, "additionalProperties"]
1001
1001
  });
@@ -1005,16 +1005,16 @@ function Vt(e, t) {
1005
1005
  case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
1006
1006
  }
1007
1007
  }
1008
- function Ht(e) {
1008
+ function Kt(e) {
1009
1009
  try {
1010
1010
  return e.isOptional();
1011
1011
  } catch {
1012
1012
  return !0;
1013
1013
  }
1014
1014
  }
1015
- var Ut = (e, t) => {
1016
- if (t.currentPath.toString() === t.propertyPath?.toString()) return J(e.innerType._def, t);
1017
- let n = J(e.innerType._def, {
1015
+ var qt = (e, t) => {
1016
+ if (t.currentPath.toString() === t.propertyPath?.toString()) return K(e.innerType._def, t);
1017
+ let n = K(e.innerType._def, {
1018
1018
  ...t,
1019
1019
  currentPath: [
1020
1020
  ...t.currentPath,
@@ -1022,11 +1022,11 @@ var Ut = (e, t) => {
1022
1022
  "1"
1023
1023
  ]
1024
1024
  });
1025
- return n ? { anyOf: [{ not: z() }, n] } : z();
1026
- }, Wt = (e, t) => {
1027
- if (t.pipeStrategy === "input") return J(e.in._def, t);
1028
- if (t.pipeStrategy === "output") return J(e.out._def, t);
1029
- let n = J(e.in._def, {
1025
+ return n ? { anyOf: [{ not: F() }, n] } : F();
1026
+ }, G = (e, t) => {
1027
+ if (t.pipeStrategy === "input") return K(e.in._def, t);
1028
+ if (t.pipeStrategy === "output") return K(e.out._def, t);
1029
+ let n = K(e.in._def, {
1030
1030
  ...t,
1031
1031
  currentPath: [
1032
1032
  ...t.currentPath,
@@ -1034,7 +1034,7 @@ var Ut = (e, t) => {
1034
1034
  "0"
1035
1035
  ]
1036
1036
  });
1037
- return { allOf: [n, J(e.out._def, {
1037
+ return { allOf: [n, K(e.out._def, {
1038
1038
  ...t,
1039
1039
  currentPath: [
1040
1040
  ...t.currentPath,
@@ -1043,25 +1043,25 @@ var Ut = (e, t) => {
1043
1043
  ]
1044
1044
  })].filter((e) => e !== void 0) };
1045
1045
  };
1046
- function Gt(e, t) {
1047
- return J(e.type._def, t);
1046
+ function Jt(e, t) {
1047
+ return K(e.type._def, t);
1048
1048
  }
1049
- function Kt(e, t) {
1049
+ function Yt(e, t) {
1050
1050
  let n = {
1051
1051
  type: "array",
1052
1052
  uniqueItems: !0,
1053
- items: J(e.valueType._def, {
1053
+ items: K(e.valueType._def, {
1054
1054
  ...t,
1055
1055
  currentPath: [...t.currentPath, "items"]
1056
1056
  })
1057
1057
  };
1058
1058
  return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
1059
1059
  }
1060
- function qt(e, t) {
1060
+ function Xt(e, t) {
1061
1061
  return e.rest ? {
1062
1062
  type: "array",
1063
1063
  minItems: e.items.length,
1064
- items: e.items.map((e, n) => J(e._def, {
1064
+ items: e.items.map((e, n) => K(e._def, {
1065
1065
  ...t,
1066
1066
  currentPath: [
1067
1067
  ...t.currentPath,
@@ -1069,7 +1069,7 @@ function qt(e, t) {
1069
1069
  `${n}`
1070
1070
  ]
1071
1071
  })).reduce((e, t) => t === void 0 ? e : [...e, t], []),
1072
- additionalItems: J(e.rest._def, {
1072
+ additionalItems: K(e.rest._def, {
1073
1073
  ...t,
1074
1074
  currentPath: [...t.currentPath, "additionalItems"]
1075
1075
  })
@@ -1077,7 +1077,7 @@ function qt(e, t) {
1077
1077
  type: "array",
1078
1078
  minItems: e.items.length,
1079
1079
  maxItems: e.items.length,
1080
- items: e.items.map((e, n) => J(e._def, {
1080
+ items: e.items.map((e, n) => K(e._def, {
1081
1081
  ...t,
1082
1082
  currentPath: [
1083
1083
  ...t.currentPath,
@@ -1087,47 +1087,47 @@ function qt(e, t) {
1087
1087
  })).reduce((e, t) => t === void 0 ? e : [...e, t], [])
1088
1088
  };
1089
1089
  }
1090
- function Jt() {
1091
- return { not: z() };
1090
+ function Zt() {
1091
+ return { not: F() };
1092
1092
  }
1093
- function Yt() {
1094
- return z();
1093
+ function Qt() {
1094
+ return F();
1095
1095
  }
1096
- var Xt = (e, t) => J(e.innerType._def, t), Zt = (e, t, n) => {
1096
+ var $t = (e, t) => K(e.innerType._def, t), en = (e, t, n) => {
1097
1097
  switch (t) {
1098
- case "ZodString": return Et(e, n);
1099
- case "ZodNumber": return zt(e);
1100
- case "ZodObject": return Bt(e, n);
1101
- case "ZodBigInt": return _t(e);
1102
- case "ZodBoolean": return vt();
1103
- case "ZodDate": return H(e, n);
1104
- case "ZodUndefined": return Jt();
1105
- case "ZodNull": return Pt();
1106
- case "ZodArray": return gt(e, n);
1098
+ case "ZodString": return B(e, n);
1099
+ case "ZodNumber": return Ut(e);
1100
+ case "ZodObject": return Wt(e, n);
1101
+ case "ZodBigInt": return St(e);
1102
+ case "ZodBoolean": return I();
1103
+ case "ZodDate": return wt(e, n);
1104
+ case "ZodUndefined": return Zt();
1105
+ case "ZodNull": return Rt();
1106
+ case "ZodArray": return xt(e, n);
1107
1107
  case "ZodUnion":
1108
- case "ZodDiscriminatedUnion": return It(e, n);
1109
- case "ZodIntersection": return Ct(e, n);
1110
- case "ZodTuple": return qt(e, n);
1111
- case "ZodRecord": return At(e, n);
1112
- case "ZodLiteral": return wt(e);
1113
- case "ZodEnum": return xt(e);
1114
- case "ZodNativeEnum": return Mt(e);
1115
- case "ZodNullable": return Rt(e, n);
1116
- case "ZodOptional": return Ut(e, n);
1117
- case "ZodMap": return jt(e, n);
1118
- case "ZodSet": return Kt(e, n);
1108
+ case "ZodDiscriminatedUnion": return Bt(e, n);
1109
+ case "ZodIntersection": return kt(e, n);
1110
+ case "ZodTuple": return Xt(e, n);
1111
+ case "ZodRecord": return Pt(e, n);
1112
+ case "ZodLiteral": return At(e);
1113
+ case "ZodEnum": return Dt(e);
1114
+ case "ZodNativeEnum": return It(e);
1115
+ case "ZodNullable": return Ht(e, n);
1116
+ case "ZodOptional": return qt(e, n);
1117
+ case "ZodMap": return Ft(e, n);
1118
+ case "ZodSet": return Yt(e, n);
1119
1119
  case "ZodLazy": return () => e.getter()._def;
1120
- case "ZodPromise": return Gt(e, n);
1120
+ case "ZodPromise": return Jt(e, n);
1121
1121
  case "ZodNaN":
1122
- case "ZodNever": return Nt();
1123
- case "ZodEffects": return bt(e, n);
1124
- case "ZodAny": return z();
1125
- case "ZodUnknown": return Yt();
1126
- case "ZodDefault": return yt(e, n);
1127
- case "ZodBranded": return B(e, n);
1128
- case "ZodReadonly": return Xt(e, n);
1129
- case "ZodCatch": return V(e, n);
1130
- case "ZodPipeline": return Wt(e, n);
1122
+ case "ZodNever": return Lt();
1123
+ case "ZodEffects": return Et(e, n);
1124
+ case "ZodAny": return F();
1125
+ case "ZodUnknown": return Qt();
1126
+ case "ZodDefault": return R(e, n);
1127
+ case "ZodBranded": return Ct(e, n);
1128
+ case "ZodReadonly": return $t(e, n);
1129
+ case "ZodCatch": return L(e, n);
1130
+ case "ZodPipeline": return G(e, n);
1131
1131
  case "ZodFunction":
1132
1132
  case "ZodVoid":
1133
1133
  case "ZodSymbol": return;
@@ -1135,19 +1135,19 @@ var Xt = (e, t) => J(e.innerType._def, t), Zt = (e, t, n) => {
1135
1135
  /* c8 ignore next */
1136
1136
  return ((e) => void 0)(t);
1137
1137
  }
1138
- }, Qt = (e, t) => {
1138
+ }, tn = (e, t) => {
1139
1139
  let n = 0;
1140
1140
  for (; n < e.length && n < t.length && e[n] === t[n]; n++);
1141
1141
  return [(e.length - n).toString(), ...t.slice(n)].join("/");
1142
1142
  };
1143
- function J(e, t, n = !1) {
1143
+ function K(e, t, n = !1) {
1144
1144
  let r = t.seen.get(e);
1145
1145
  if (t.override) {
1146
1146
  let i = t.override?.(e, t, r, n);
1147
- if (i !== pt) return i;
1147
+ if (i !== vt) return i;
1148
1148
  }
1149
1149
  if (r && !n) {
1150
- let e = $t(r, t);
1150
+ let e = nn(r, t);
1151
1151
  if (e !== void 0) return e;
1152
1152
  }
1153
1153
  let i = {
@@ -1156,22 +1156,22 @@ function J(e, t, n = !1) {
1156
1156
  jsonSchema: void 0
1157
1157
  };
1158
1158
  t.seen.set(e, i);
1159
- let a = Zt(e, e.typeName, t), o = typeof a == "function" ? J(a(), t) : a;
1160
- if (o && en(e, t, o), t.postProcess) {
1159
+ let a = en(e, e.typeName, t), o = typeof a == "function" ? K(a(), t) : a;
1160
+ if (o && rn(e, t, o), t.postProcess) {
1161
1161
  let n = t.postProcess(o, e, t);
1162
1162
  return i.jsonSchema = o, n;
1163
1163
  }
1164
1164
  return i.jsonSchema = o, o;
1165
1165
  }
1166
- var $t = (e, t) => {
1166
+ var nn = (e, t) => {
1167
1167
  switch (t.$refStrategy) {
1168
1168
  case "root": return { $ref: e.path.join("/") };
1169
- case "relative": return { $ref: Qt(t.currentPath, e.path) };
1169
+ case "relative": return { $ref: tn(t.currentPath, e.path) };
1170
1170
  case "none":
1171
- 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`), z()) : t.$refStrategy === "seen" ? z() : void 0;
1171
+ 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`), F()) : t.$refStrategy === "seen" ? F() : void 0;
1172
1172
  }
1173
- }, en = (e, t, n) => (e.description && (n.description = e.description), n), tn = (e) => {
1174
- let t = ht(e), n = t.name === void 0 ? t.basePath : [
1173
+ }, rn = (e, t, n) => (e.description && (n.description = e.description), n), an = (e) => {
1174
+ let t = bt(e), n = t.name === void 0 ? t.basePath : [
1175
1175
  ...t.basePath,
1176
1176
  t.definitionPath,
1177
1177
  t.name
@@ -1190,25 +1190,25 @@ var $t = (e, t) => {
1190
1190
  jsonSchema: void 0
1191
1191
  }]))
1192
1192
  };
1193
- }, nn = (e, t) => {
1194
- let n = tn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1193
+ }, on = (e, t) => {
1194
+ let n = an(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1195
1195
  ...e,
1196
- [t]: J(r._def, {
1196
+ [t]: K(r._def, {
1197
1197
  ...n,
1198
1198
  currentPath: [
1199
1199
  ...n.basePath,
1200
1200
  n.definitionPath,
1201
1201
  t
1202
1202
  ]
1203
- }, !0) ?? z()
1204
- }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = J(e._def, i === void 0 ? n : {
1203
+ }, !0) ?? F()
1204
+ }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = K(e._def, i === void 0 ? n : {
1205
1205
  ...n,
1206
1206
  currentPath: [
1207
1207
  ...n.basePath,
1208
1208
  n.definitionPath,
1209
1209
  i
1210
1210
  ]
1211
- }, !1) ?? z(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1211
+ }, !1) ?? F(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1212
1212
  o !== void 0 && (a.title = o);
1213
1213
  let s = i === void 0 ? r ? {
1214
1214
  ...a,
@@ -1225,14 +1225,14 @@ var $t = (e, t) => {
1225
1225
  }
1226
1226
  };
1227
1227
  return s.$schema = "http://json-schema.org/draft-07/schema#", s;
1228
- }, rn = Symbol.for("vercel.ai.schema");
1229
- function an(e) {
1228
+ }, sn = Symbol.for("vercel.ai.schema");
1229
+ function cn(e) {
1230
1230
  let t;
1231
1231
  return () => (t ??= e(), t);
1232
1232
  }
1233
- function on(e, { validate: t } = {}) {
1233
+ function ln(e, { validate: t } = {}) {
1234
1234
  return {
1235
- [rn]: !0,
1235
+ [sn]: !0,
1236
1236
  _type: void 0,
1237
1237
  get jsonSchema() {
1238
1238
  return typeof e == "function" && (e = e()), e;
@@ -1240,20 +1240,20 @@ function on(e, { validate: t } = {}) {
1240
1240
  validate: t
1241
1241
  };
1242
1242
  }
1243
- function sn(e) {
1244
- return typeof e == "object" && !!e && rn in e && e[rn] === !0 && "jsonSchema" in e && "validate" in e;
1243
+ function un(e) {
1244
+ return typeof e == "object" && !!e && sn in e && e[sn] === !0 && "jsonSchema" in e && "validate" in e;
1245
1245
  }
1246
- function cn(e) {
1247
- return e == null ? on({
1246
+ function dn(e) {
1247
+ return e == null ? ln({
1248
1248
  type: "object",
1249
1249
  properties: {},
1250
1250
  additionalProperties: !1
1251
- }) : sn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? mn(e) : ln(e) : e();
1251
+ }) : un(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? gn(e) : fn(e) : e();
1252
1252
  }
1253
- function ln(e) {
1254
- return on(() => {
1255
- if (!un(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1256
- return ft(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1253
+ function fn(e) {
1254
+ return ln(() => {
1255
+ if (!pn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1256
+ return _t(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1257
1257
  }, { validate: async (t) => {
1258
1258
  let n = await e["~standard"].validate(t);
1259
1259
  return "value" in n ? {
@@ -1261,19 +1261,19 @@ function ln(e) {
1261
1261
  value: n.value
1262
1262
  } : {
1263
1263
  success: !1,
1264
- error: new A({
1264
+ error: new E({
1265
1265
  value: t,
1266
1266
  cause: n.issues
1267
1267
  })
1268
1268
  };
1269
1269
  } });
1270
1270
  }
1271
- function un(e) {
1271
+ function pn(e) {
1272
1272
  return e["~standard"].jsonSchema != null;
1273
1273
  }
1274
- function dn(e, t) {
1274
+ function mn(e, t) {
1275
1275
  let n = t?.useReferences ?? !1;
1276
- return on(() => nn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1276
+ return ln(() => on(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1277
1277
  let n = await e.safeParseAsync(t);
1278
1278
  return n.success ? {
1279
1279
  success: !0,
@@ -1284,9 +1284,9 @@ function dn(e, t) {
1284
1284
  };
1285
1285
  } });
1286
1286
  }
1287
- function fn(e, r) {
1287
+ function hn(e, r) {
1288
1288
  let i = r?.useReferences ?? !1;
1289
- return on(() => ft(n(e, {
1289
+ return ln(() => _t(n(e, {
1290
1290
  target: "draft-7",
1291
1291
  io: "input",
1292
1292
  reused: i ? "ref" : "inline"
@@ -1301,27 +1301,27 @@ function fn(e, r) {
1301
1301
  };
1302
1302
  } });
1303
1303
  }
1304
- function pn(e) {
1304
+ function q(e) {
1305
1305
  return "_zod" in e;
1306
1306
  }
1307
- function mn(e, t) {
1308
- return pn(e) ? fn(e, t) : dn(e, t);
1307
+ function gn(e, t) {
1308
+ return q(e) ? hn(e, t) : mn(e, t);
1309
1309
  }
1310
- async function hn({ value: e, schema: t, context: n }) {
1311
- let r = await gn({
1310
+ async function _n({ value: e, schema: t, context: n }) {
1311
+ let r = await vn({
1312
1312
  value: e,
1313
1313
  schema: t,
1314
1314
  context: n
1315
1315
  });
1316
- if (!r.success) throw A.wrap({
1316
+ if (!r.success) throw E.wrap({
1317
1317
  value: e,
1318
1318
  cause: r.error,
1319
1319
  context: n
1320
1320
  });
1321
1321
  return r.value;
1322
1322
  }
1323
- async function gn({ value: e, schema: t, context: n }) {
1324
- let r = cn(t);
1323
+ async function vn({ value: e, schema: t, context: n }) {
1324
+ let r = dn(t);
1325
1325
  try {
1326
1326
  if (r.validate == null) return {
1327
1327
  success: !0,
@@ -1335,7 +1335,7 @@ async function gn({ value: e, schema: t, context: n }) {
1335
1335
  rawValue: e
1336
1336
  } : {
1337
1337
  success: !1,
1338
- error: A.wrap({
1338
+ error: E.wrap({
1339
1339
  value: e,
1340
1340
  cause: t.error,
1341
1341
  context: n
@@ -1345,7 +1345,7 @@ async function gn({ value: e, schema: t, context: n }) {
1345
1345
  } catch (t) {
1346
1346
  return {
1347
1347
  success: !1,
1348
- error: A.wrap({
1348
+ error: E.wrap({
1349
1349
  value: e,
1350
1350
  cause: t,
1351
1351
  context: n
@@ -1354,21 +1354,21 @@ async function gn({ value: e, schema: t, context: n }) {
1354
1354
  };
1355
1355
  }
1356
1356
  }
1357
- async function _n({ text: e, schema: t }) {
1357
+ async function yn({ text: e, schema: t }) {
1358
1358
  try {
1359
- let n = dt(e);
1359
+ let n = gt(e);
1360
1360
  return t == null ? {
1361
1361
  success: !0,
1362
1362
  value: n,
1363
1363
  rawValue: n
1364
- } : await gn({
1364
+ } : await vn({
1365
1365
  value: n,
1366
1366
  schema: t
1367
1367
  });
1368
1368
  } catch (t) {
1369
1369
  return {
1370
1370
  success: !1,
1371
- error: Ke.isInstance(t) ? t : new Ke({
1371
+ error: Xe.isInstance(t) ? t : new Xe({
1372
1372
  text: e,
1373
1373
  cause: t
1374
1374
  }),
@@ -1376,42 +1376,42 @@ async function _n({ text: e, schema: t }) {
1376
1376
  };
1377
1377
  }
1378
1378
  }
1379
- function vn({ stream: e, schema: t }) {
1380
- return e.pipeThrough(new TextDecoderStream()).pipeThrough(new P()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1381
- e !== "[DONE]" && n.enqueue(await _n({
1379
+ function bn({ stream: e, schema: t }) {
1380
+ return e.pipeThrough(new TextDecoderStream()).pipeThrough(new ct()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1381
+ e !== "[DONE]" && n.enqueue(await yn({
1382
1382
  text: e,
1383
1383
  schema: t
1384
1384
  }));
1385
1385
  } }));
1386
1386
  }
1387
- async function yn(e) {
1387
+ async function xn(e) {
1388
1388
  return typeof e == "function" && (e = e()), e;
1389
1389
  }
1390
1390
  new TextDecoder();
1391
1391
  //#endregion
1392
1392
  //#region ../../node_modules/.pnpm/ai@7.0.140_zod@4.6.7/node_modules/ai/dist/index.js
1393
- var bn = "AI_InvalidArgumentError", xn = `vercel.ai.error.${bn}`, Sn = Symbol.for(xn), Cn = class extends w {
1393
+ var Sn = "AI_InvalidArgumentError", Cn = `vercel.ai.error.${Sn}`, wn = Symbol.for(Cn), Tn = class extends C {
1394
1394
  constructor({ parameter: e, value: t, message: n }) {
1395
1395
  super({
1396
- name: bn,
1396
+ name: Sn,
1397
1397
  message: `Invalid argument for parameter ${e}: ${n}`
1398
- }), this[Sn] = !0, this.parameter = e, this.value = t;
1398
+ }), this[wn] = !0, this.parameter = e, this.value = t;
1399
1399
  }
1400
1400
  static isInstance(e) {
1401
- return w.hasMarker(e, xn);
1401
+ return C.hasMarker(e, Cn);
1402
1402
  }
1403
- }, wn = "AI_UIMessageStreamError", Tn = `vercel.ai.error.${wn}`, En = Symbol.for(Tn), Dn = class extends w {
1403
+ }, En = "AI_UIMessageStreamError", Dn = `vercel.ai.error.${En}`, On = Symbol.for(Dn), J = class extends C {
1404
1404
  constructor({ chunkType: e, chunkId: t, message: n }) {
1405
1405
  super({
1406
- name: wn,
1406
+ name: En,
1407
1407
  message: n
1408
- }), this[En] = !0, this.chunkType = e, this.chunkId = t;
1408
+ }), this[On] = !0, this.chunkType = e, this.chunkId = t;
1409
1409
  }
1410
1410
  static isInstance(e) {
1411
- return w.hasMarker(e, Tn);
1411
+ return C.hasMarker(e, Dn);
1412
1412
  }
1413
1413
  };
1414
- function On(e, t) {
1414
+ function kn(e, t) {
1415
1415
  if (e === void 0 && t === void 0) return;
1416
1416
  if (e === void 0) return t;
1417
1417
  if (t === void 0) return e;
@@ -1420,7 +1420,7 @@ function On(e, t) {
1420
1420
  let i = t[r];
1421
1421
  if (i === void 0) continue;
1422
1422
  let a = r in e ? e[r] : void 0, o = typeof i == "object" && !!i && !Array.isArray(i) && !(i instanceof Date) && !(i instanceof RegExp), s = typeof a == "object" && !!a && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof RegExp);
1423
- n[r] = o && s ? On(a, i) : i;
1423
+ n[r] = o && s ? kn(a, i) : i;
1424
1424
  }
1425
1425
  return n;
1426
1426
  }
@@ -1449,28 +1449,28 @@ var Y = {
1449
1449
  Y.boolean(),
1450
1450
  Y.record(Y.string(), X.optional()),
1451
1451
  Y.array(X)
1452
- ])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())), kn = Y.union([
1452
+ ])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())), An = Y.union([
1453
1453
  Y.string(),
1454
1454
  Y.instanceof(Uint8Array),
1455
1455
  Y.instanceof(ArrayBuffer),
1456
- Y.custom(ct, { message: "Must be a Buffer" })
1457
- ]), An = Y.record(Y.string(), Y.string()), jn = Y.object({
1456
+ Y.custom(N, { message: "Must be a Buffer" })
1457
+ ]), jn = Y.record(Y.string(), Y.string()), Mn = Y.object({
1458
1458
  type: Y.literal("text"),
1459
1459
  text: Y.string(),
1460
1460
  providerOptions: Z.optional()
1461
- }), Mn = Y.object({
1461
+ }), Nn = Y.object({
1462
1462
  type: Y.literal("image"),
1463
1463
  image: Y.union([
1464
- kn,
1464
+ An,
1465
1465
  Y.instanceof(URL),
1466
- An
1466
+ jn
1467
1467
  ]),
1468
1468
  mediaType: Y.string().optional(),
1469
1469
  providerOptions: Z.optional()
1470
- }), Nn = Y.discriminatedUnion("type", [
1470
+ }), Pn = Y.discriminatedUnion("type", [
1471
1471
  Y.object({
1472
1472
  type: Y.literal("data"),
1473
- data: kn
1473
+ data: An
1474
1474
  }),
1475
1475
  Y.object({
1476
1476
  type: Y.literal("url"),
@@ -1478,54 +1478,54 @@ var Y = {
1478
1478
  }),
1479
1479
  Y.object({
1480
1480
  type: Y.literal("reference"),
1481
- reference: An
1481
+ reference: jn
1482
1482
  }),
1483
1483
  Y.object({
1484
1484
  type: Y.literal("text"),
1485
1485
  text: Y.string()
1486
1486
  })
1487
- ]), Pn = Y.discriminatedUnion("type", [Y.object({
1487
+ ]), Fn = Y.discriminatedUnion("type", [Y.object({
1488
1488
  type: Y.literal("data"),
1489
- data: kn
1489
+ data: An
1490
1490
  }), Y.object({
1491
1491
  type: Y.literal("url"),
1492
1492
  url: Y.instanceof(URL)
1493
- })]), Fn = Y.object({
1493
+ })]), In = Y.object({
1494
1494
  type: Y.literal("file"),
1495
1495
  data: Y.union([
1496
- Nn,
1497
- kn,
1496
+ Pn,
1497
+ An,
1498
1498
  Y.instanceof(URL),
1499
- An
1499
+ jn
1500
1500
  ]),
1501
1501
  filename: Y.string().optional(),
1502
1502
  mediaType: Y.string(),
1503
1503
  providerOptions: Z.optional()
1504
- }), In = Y.object({
1504
+ }), Ln = Y.object({
1505
1505
  type: Y.literal("reasoning"),
1506
1506
  text: Y.string(),
1507
1507
  providerOptions: Z.optional()
1508
- }), Ln = Y.object({
1508
+ }), Rn = Y.object({
1509
1509
  type: Y.literal("custom"),
1510
1510
  kind: Y.string().transform((e) => e),
1511
1511
  providerOptions: Z.optional()
1512
- }), Rn = Y.object({
1512
+ }), zn = Y.object({
1513
1513
  type: Y.literal("reasoning-file"),
1514
1514
  data: Y.union([
1515
- Pn,
1516
- kn,
1515
+ Fn,
1516
+ An,
1517
1517
  Y.instanceof(URL)
1518
1518
  ]),
1519
1519
  mediaType: Y.string(),
1520
1520
  providerOptions: Z.optional()
1521
- }), zn = Y.object({
1521
+ }), Bn = Y.object({
1522
1522
  type: Y.literal("tool-call"),
1523
1523
  toolCallId: Y.string(),
1524
1524
  toolName: Y.string(),
1525
1525
  input: Y.unknown(),
1526
1526
  providerOptions: Z.optional(),
1527
1527
  providerExecuted: Y.boolean().optional()
1528
- }), Bn = Y.discriminatedUnion("type", [
1528
+ }), Vn = Y.discriminatedUnion("type", [
1529
1529
  Y.object({
1530
1530
  type: Y.literal("text"),
1531
1531
  value: Y.string(),
@@ -1561,7 +1561,7 @@ var Y = {
1561
1561
  }),
1562
1562
  Y.object({
1563
1563
  type: Y.literal("file"),
1564
- data: Nn,
1564
+ data: Pn,
1565
1565
  mediaType: Y.string(),
1566
1566
  filename: Y.string().optional(),
1567
1567
  providerOptions: Z.optional()
@@ -1616,13 +1616,13 @@ var Y = {
1616
1616
  })
1617
1617
  ]))
1618
1618
  })
1619
- ]), Vn = Y.object({
1619
+ ]), Hn = Y.object({
1620
1620
  type: Y.literal("tool-result"),
1621
1621
  toolCallId: Y.string(),
1622
1622
  toolName: Y.string(),
1623
- output: Bn,
1623
+ output: Vn,
1624
1624
  providerOptions: Z.optional()
1625
- }), Hn = Y.object({
1625
+ }), Un = Y.object({
1626
1626
  type: Y.literal("tool-approval-request"),
1627
1627
  approvalId: Y.string(),
1628
1628
  toolCallId: Y.string(),
@@ -1630,48 +1630,48 @@ var Y = {
1630
1630
  isAutomatic: Y.boolean().optional(),
1631
1631
  signature: Y.string().optional(),
1632
1632
  inputSchemaInput: Y.unknown().optional()
1633
- }), Un = Y.object({
1633
+ }), Wn = Y.object({
1634
1634
  type: Y.literal("tool-approval-response"),
1635
1635
  approvalId: Y.string(),
1636
1636
  approved: Y.boolean(),
1637
1637
  reason: Y.string().optional()
1638
- }), Wn = Y.object({
1638
+ }), Gn = Y.object({
1639
1639
  role: Y.literal("system"),
1640
1640
  content: Y.string(),
1641
1641
  providerOptions: Z.optional()
1642
- }), Gn = Y.object({
1642
+ }), Kn = Y.object({
1643
1643
  role: Y.literal("user"),
1644
1644
  content: Y.union([Y.string(), Y.array(Y.union([
1645
- jn,
1646
1645
  Mn,
1647
- Fn
1646
+ Nn,
1647
+ In
1648
1648
  ]))]),
1649
1649
  providerOptions: Z.optional()
1650
- }), Kn = Y.object({
1650
+ }), qn = Y.object({
1651
1651
  role: Y.literal("assistant"),
1652
1652
  content: Y.union([Y.string(), Y.array(Y.union([
1653
- jn,
1654
- Ln,
1655
- Fn,
1656
- In,
1653
+ Mn,
1657
1654
  Rn,
1655
+ In,
1656
+ Ln,
1658
1657
  zn,
1659
- Vn,
1660
- Hn
1658
+ Bn,
1659
+ Hn,
1660
+ Un
1661
1661
  ]))]),
1662
1662
  providerOptions: Z.optional()
1663
- }), qn = Y.object({
1663
+ }), Jn = Y.object({
1664
1664
  role: Y.literal("tool"),
1665
- content: Y.array(Y.union([Vn, Un])),
1665
+ content: Y.array(Y.union([Hn, Wn])),
1666
1666
  providerOptions: Z.optional()
1667
1667
  });
1668
1668
  Y.union([
1669
- Wn,
1670
1669
  Gn,
1671
1670
  Kn,
1672
- qn
1671
+ qn,
1672
+ Jn
1673
1673
  ]);
1674
- function Jn(e) {
1674
+ function Yn(e) {
1675
1675
  let t = ["ROOT"], n = -1, r = null, i = 0;
1676
1676
  function a(e) {
1677
1677
  return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
@@ -1853,16 +1853,16 @@ function Jn(e) {
1853
1853
  }
1854
1854
  return l;
1855
1855
  }
1856
- async function Yn(e) {
1856
+ async function Xn(e) {
1857
1857
  if (e === void 0) return {
1858
1858
  value: void 0,
1859
1859
  state: "undefined-input"
1860
1860
  };
1861
- let t = await _n({ text: e });
1861
+ let t = await yn({ text: e });
1862
1862
  return t.success ? {
1863
1863
  value: t.value,
1864
1864
  state: "successful-parse"
1865
- } : (t = await _n({ text: Jn(e) }), t.success ? {
1865
+ } : (t = await yn({ text: Yn(e) }), t.success ? {
1866
1866
  value: t.value,
1867
1867
  state: "repaired-parse"
1868
1868
  } : {
@@ -1870,14 +1870,14 @@ async function Yn(e) {
1870
1870
  state: "failed-parse"
1871
1871
  });
1872
1872
  }
1873
- new TextEncoder(), new TextEncoder(), F({
1873
+ new TextEncoder(), new TextEncoder(), M({
1874
1874
  prefix: "aitxt",
1875
1875
  size: 24
1876
- }), F({
1876
+ }), M({
1877
1877
  prefix: "call",
1878
1878
  size: 24
1879
1879
  }), TransformStream;
1880
- var Xn = Y.object({
1880
+ var Zn = Y.object({
1881
1881
  source: Y.discriminatedUnion("sourceType", [Y.object({
1882
1882
  type: Y.literal("source"),
1883
1883
  sourceType: Y.literal("url"),
@@ -1897,7 +1897,7 @@ var Xn = Y.object({
1897
1897
  startIndex: Y.number().int().nonnegative().optional(),
1898
1898
  endIndex: Y.number().int().nonnegative().optional(),
1899
1899
  citedText: Y.string().optional()
1900
- }), Zn = Y.record(Y.string(), X.optional()), Qn = an(() => mn(Y.union([
1900
+ }), Qn = Y.record(Y.string(), X.optional()), $n = cn(() => gn(Y.union([
1901
1901
  Y.looseObject({
1902
1902
  type: Y.literal("text-start"),
1903
1903
  id: Y.string(),
@@ -1912,7 +1912,7 @@ var Xn = Y.object({
1912
1912
  Y.looseObject({
1913
1913
  type: Y.literal("text-end"),
1914
1914
  id: Y.string(),
1915
- citations: Y.array(Xn).optional(),
1915
+ citations: Y.array(Zn).optional(),
1916
1916
  providerMetadata: Z.optional()
1917
1917
  }),
1918
1918
  Y.looseObject({
@@ -1925,7 +1925,7 @@ var Xn = Y.object({
1925
1925
  toolName: Y.string(),
1926
1926
  providerExecuted: Y.boolean().optional(),
1927
1927
  providerMetadata: Z.optional(),
1928
- toolMetadata: Zn.optional(),
1928
+ toolMetadata: Qn.optional(),
1929
1929
  dynamic: Y.boolean().optional(),
1930
1930
  title: Y.string().optional()
1931
1931
  }),
@@ -1941,7 +1941,7 @@ var Xn = Y.object({
1941
1941
  input: Y.unknown(),
1942
1942
  providerExecuted: Y.boolean().optional(),
1943
1943
  providerMetadata: Z.optional(),
1944
- toolMetadata: Zn.optional(),
1944
+ toolMetadata: Qn.optional(),
1945
1945
  dynamic: Y.boolean().optional(),
1946
1946
  title: Y.string().optional()
1947
1947
  }),
@@ -1952,7 +1952,7 @@ var Xn = Y.object({
1952
1952
  input: Y.unknown(),
1953
1953
  providerExecuted: Y.boolean().optional(),
1954
1954
  providerMetadata: Z.optional(),
1955
- toolMetadata: Zn.optional(),
1955
+ toolMetadata: Qn.optional(),
1956
1956
  dynamic: Y.boolean().optional(),
1957
1957
  errorText: Y.string(),
1958
1958
  title: Y.string().optional()
@@ -1981,7 +1981,7 @@ var Xn = Y.object({
1981
1981
  output: Y.unknown(),
1982
1982
  providerExecuted: Y.boolean().optional(),
1983
1983
  providerMetadata: Z.optional(),
1984
- toolMetadata: Zn.optional(),
1984
+ toolMetadata: Qn.optional(),
1985
1985
  dynamic: Y.boolean().optional(),
1986
1986
  preliminary: Y.boolean().optional()
1987
1987
  }),
@@ -1991,7 +1991,7 @@ var Xn = Y.object({
1991
1991
  errorText: Y.string(),
1992
1992
  providerExecuted: Y.boolean().optional(),
1993
1993
  providerMetadata: Z.optional(),
1994
- toolMetadata: Zn.optional(),
1994
+ toolMetadata: Qn.optional(),
1995
1995
  dynamic: Y.boolean().optional()
1996
1996
  }),
1997
1997
  Y.looseObject({
@@ -2081,38 +2081,38 @@ var Xn = Y.object({
2081
2081
  messageMetadata: Y.unknown()
2082
2082
  })
2083
2083
  ])));
2084
- function $n(e) {
2084
+ function er(e) {
2085
2085
  return e.type.startsWith("data-");
2086
2086
  }
2087
- function er() {
2087
+ function tr() {
2088
2088
  return Object.create(null);
2089
2089
  }
2090
- function tr(e) {
2090
+ function nr(e) {
2091
2091
  return e.type.startsWith("tool-");
2092
2092
  }
2093
- function nr(e) {
2093
+ function rr(e) {
2094
2094
  return e.type === "dynamic-tool";
2095
2095
  }
2096
2096
  function Q(e) {
2097
- return tr(e) || nr(e);
2097
+ return nr(e) || rr(e);
2098
2098
  }
2099
- function rr(e) {
2099
+ function ir(e) {
2100
2100
  return e.type.split("-").slice(1).join("-");
2101
2101
  }
2102
- function ir({ lastMessage: e, messageId: t }) {
2102
+ function ar({ lastMessage: e, messageId: t }) {
2103
2103
  let n = e?.role === "assistant" ? e : {
2104
2104
  id: t,
2105
2105
  metadata: void 0,
2106
2106
  role: "assistant",
2107
2107
  parts: []
2108
- }, r = er(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
2108
+ }, r = tr(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
2109
2109
  for (let e of n.parts.slice(i + 1)) {
2110
2110
  if (!Q(e)) continue;
2111
2111
  let t = a;
2112
- tr(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
2112
+ nr(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
2113
2113
  text: e.rawInput ?? "",
2114
2114
  index: t,
2115
- toolName: e.type === "dynamic-tool" ? e.toolName : rr(e),
2115
+ toolName: e.type === "dynamic-tool" ? e.toolName : ir(e),
2116
2116
  dynamic: e.type === "dynamic-tool",
2117
2117
  title: e.title,
2118
2118
  toolMetadata: e.toolMetadata
@@ -2120,12 +2120,12 @@ function ir({ lastMessage: e, messageId: t }) {
2120
2120
  }
2121
2121
  return {
2122
2122
  message: n,
2123
- activeTextParts: er(),
2124
- activeReasoningParts: er(),
2123
+ activeTextParts: tr(),
2124
+ activeReasoningParts: tr(),
2125
2125
  partialToolCalls: r
2126
2126
  };
2127
2127
  }
2128
- function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
2128
+ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
2129
2129
  let l = !0;
2130
2130
  return e.pipeThrough(new TransformStream({ async transform(e, u) {
2131
2131
  await r(async ({ state: r, write: d }) => {
@@ -2149,7 +2149,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2149
2149
  }
2150
2150
  }
2151
2151
  }
2152
- if (t == null) throw new Dn({
2152
+ if (t == null) throw new J({
2153
2153
  chunkType: "tool-invocation",
2154
2154
  chunkId: e,
2155
2155
  message: `No tool invocation found for tool call ID "${e}".`
@@ -2158,7 +2158,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2158
2158
  }
2159
2159
  function h(e) {
2160
2160
  let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
2161
- if (t == null) throw new Dn({
2161
+ if (t == null) throw new J({
2162
2162
  chunkType: "tool-approval-response",
2163
2163
  chunkId: e,
2164
2164
  message: `No tool invocation found for approval ID "${e}".`
@@ -2166,7 +2166,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2166
2166
  return t;
2167
2167
  }
2168
2168
  function g(e, t) {
2169
- let n = t ?? f().find((t) => tr(t) && t.toolCallId === e.toolCallId), i = e, a = n;
2169
+ let n = t ?? f().find((t) => nr(t) && t.toolCallId === e.toolCallId), i = e, a = n;
2170
2170
  if (n != null) {
2171
2171
  n.state = e.state, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput, a.preliminary = i.preliminary, e.title !== void 0 && (a.title = e.title), e.toolMetadata !== void 0 && (a.toolMetadata = e.toolMetadata), a.providerExecuted = i.providerExecuted ?? n.providerExecuted;
2172
2172
  let t = i.providerMetadata;
@@ -2221,8 +2221,8 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2221
2221
  }
2222
2222
  async function v(e) {
2223
2223
  if (e != null) {
2224
- let n = r.message.metadata == null ? e : On(r.message.metadata, e);
2225
- t != null && await hn({
2224
+ let n = r.message.metadata == null ? e : kn(r.message.metadata, e);
2225
+ t != null && await _n({
2226
2226
  value: n,
2227
2227
  schema: t,
2228
2228
  context: {
@@ -2245,7 +2245,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2245
2245
  }
2246
2246
  case "text-delta": {
2247
2247
  let t = r.activeTextParts[e.id];
2248
- if (t == null) throw new Dn({
2248
+ if (t == null) throw new J({
2249
2249
  chunkType: "text-delta",
2250
2250
  chunkId: e.id,
2251
2251
  message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
@@ -2255,7 +2255,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2255
2255
  }
2256
2256
  case "text-end": {
2257
2257
  let t = r.activeTextParts[e.id];
2258
- if (t == null) throw new Dn({
2258
+ if (t == null) throw new J({
2259
2259
  chunkType: "text-end",
2260
2260
  chunkId: e.id,
2261
2261
  message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
@@ -2285,7 +2285,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2285
2285
  }
2286
2286
  case "reasoning-delta": {
2287
2287
  let t = r.activeReasoningParts[e.id];
2288
- if (t == null) throw new Dn({
2288
+ if (t == null) throw new J({
2289
2289
  chunkType: "reasoning-delta",
2290
2290
  chunkId: e.id,
2291
2291
  message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
@@ -2295,7 +2295,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2295
2295
  }
2296
2296
  case "reasoning-end": {
2297
2297
  let t = r.activeReasoningParts[e.id];
2298
- if (t == null) throw new Dn({
2298
+ if (t == null) throw new J({
2299
2299
  chunkType: "reasoning-end",
2300
2300
  chunkId: e.id,
2301
2301
  message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
@@ -2332,7 +2332,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2332
2332
  }), d();
2333
2333
  break;
2334
2334
  case "tool-input-start": {
2335
- let t = f().filter(tr);
2335
+ let t = f().filter(nr);
2336
2336
  r.partialToolCalls[e.toolCallId] = {
2337
2337
  text: "",
2338
2338
  toolName: e.toolName,
@@ -2363,13 +2363,13 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2363
2363
  }
2364
2364
  case "tool-input-delta": {
2365
2365
  let t = r.partialToolCalls[e.toolCallId];
2366
- if (t == null) throw new Dn({
2366
+ if (t == null) throw new J({
2367
2367
  chunkType: "tool-input-delta",
2368
2368
  chunkId: e.toolCallId,
2369
2369
  message: `Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
2370
2370
  });
2371
2371
  t.text += e.inputTextDelta;
2372
- let { value: n } = await Yn(t.text);
2372
+ let { value: n } = await Xn(t.text);
2373
2373
  t.dynamic ? _({
2374
2374
  toolCallId: e.toolCallId,
2375
2375
  toolName: t.toolName,
@@ -2475,7 +2475,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2475
2475
  toolMetadata: e.toolMetadata ?? t.toolMetadata
2476
2476
  }, t) : g({
2477
2477
  toolCallId: e.toolCallId,
2478
- toolName: rr(t),
2478
+ toolName: ir(t),
2479
2479
  state: "output-available",
2480
2480
  input: t.input,
2481
2481
  output: e.output,
@@ -2501,7 +2501,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2501
2501
  toolMetadata: e.toolMetadata ?? t.toolMetadata
2502
2502
  }, t) : g({
2503
2503
  toolCallId: e.toolCallId,
2504
- toolName: rr(t),
2504
+ toolName: ir(t),
2505
2505
  state: "output-error",
2506
2506
  input: t.input,
2507
2507
  rawInput: t.rawInput,
@@ -2519,12 +2519,12 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2519
2519
  case "finish-step": break;
2520
2520
  case "reset-step": {
2521
2521
  let e = f();
2522
- r.activeTextParts = er(), r.activeReasoningParts = er(), r.partialToolCalls = er(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
2522
+ r.activeTextParts = tr(), r.activeReasoningParts = tr(), r.partialToolCalls = tr(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
2523
2523
  break;
2524
2524
  }
2525
2525
  case "start": {
2526
2526
  let t = c && l || s && e.messageId != null && e.messageId !== r.message.id;
2527
- l = !1, t && Object.assign(r, ir({
2527
+ l = !1, t && Object.assign(r, ar({
2528
2528
  lastMessage: void 0,
2529
2529
  messageId: e.messageId ?? r.message.id
2530
2530
  }), { finishReason: void 0 }), e.messageId != null && (r.message.id = e.messageId), await v(e.messageMetadata), (t || e.messageId != null || e.messageMetadata != null) && d({ updateStatus: !1 });
@@ -2539,10 +2539,10 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2539
2539
  case "error":
2540
2540
  i?.(Error(e.errorText));
2541
2541
  break;
2542
- default: if ($n(e)) {
2542
+ default: if (er(e)) {
2543
2543
  if (n?.[e.type] != null) {
2544
2544
  let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
2545
- await hn({
2545
+ await _n({
2546
2546
  value: e.data,
2547
2547
  schema: n[e.type],
2548
2548
  context: {
@@ -2565,7 +2565,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2565
2565
  });
2566
2566
  } }));
2567
2567
  }
2568
- async function or({ stream: e, onError: t, abortSignal: n }) {
2568
+ async function sr({ stream: e, onError: t, abortSignal: n }) {
2569
2569
  let r = e.getReader(), i = () => {
2570
2570
  r.cancel().catch(() => {});
2571
2571
  };
@@ -2581,7 +2581,7 @@ async function or({ stream: e, onError: t, abortSignal: n }) {
2581
2581
  n?.removeEventListener("abort", i), r.releaseLock();
2582
2582
  }
2583
2583
  }
2584
- function sr() {
2584
+ function cr() {
2585
2585
  let e, t;
2586
2586
  return {
2587
2587
  promise: new Promise((n, r) => {
@@ -2591,32 +2591,32 @@ function sr() {
2591
2591
  reject: t
2592
2592
  };
2593
2593
  }
2594
- F({
2594
+ M({
2595
2595
  prefix: "aitxt",
2596
2596
  size: 24
2597
- }), F({
2597
+ }), M({
2598
2598
  prefix: "call",
2599
2599
  size: 24
2600
- }), F({
2600
+ }), M({
2601
2601
  prefix: "aitxt",
2602
2602
  size: 24
2603
- }), F({
2603
+ }), M({
2604
2604
  prefix: "call",
2605
2605
  size: 24
2606
- }), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), F({
2606
+ }), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), M({
2607
2607
  prefix: "call",
2608
2608
  size: 24
2609
- }), F({
2609
+ }), M({
2610
2610
  prefix: "call",
2611
2611
  size: 24
2612
- }), new TextEncoder(), F({
2612
+ }), new TextEncoder(), M({
2613
2613
  prefix: "call",
2614
2614
  size: 24
2615
- }), F({
2615
+ }), M({
2616
2616
  prefix: "aiobj",
2617
2617
  size: 24
2618
2618
  });
2619
- var { atob: cr } = globalThis, lr = class {
2619
+ var { atob: lr } = globalThis, ur = class {
2620
2620
  constructor() {
2621
2621
  this.queue = [], this.isProcessing = !1, this.idleWaiters = [];
2622
2622
  }
@@ -2648,10 +2648,10 @@ var { atob: cr } = globalThis, lr = class {
2648
2648
  });
2649
2649
  }
2650
2650
  };
2651
- F({
2651
+ M({
2652
2652
  prefix: "aiobj",
2653
2653
  size: 24
2654
- }), F({
2654
+ }), M({
2655
2655
  prefix: "call",
2656
2656
  size: 24
2657
2657
  }), Y.object({
@@ -2671,19 +2671,19 @@ F({
2671
2671
  description: Y.string().optional(),
2672
2672
  parameters: Y.record(Y.string(), Y.unknown())
2673
2673
  })).optional()
2674
- }), F({
2674
+ }), M({
2675
2675
  prefix: "call",
2676
2676
  size: 24
2677
- }), F({
2677
+ }), M({
2678
2678
  prefix: "call",
2679
2679
  size: 24
2680
- }), F({
2680
+ }), M({
2681
2681
  prefix: "call",
2682
2682
  size: 24
2683
2683
  });
2684
- async function ur({ response: e, url: t, fallbackMessage: n }) {
2684
+ async function dr({ response: e, url: t, fallbackMessage: n }) {
2685
2685
  let r = await e.text();
2686
- return new T({
2686
+ return new ze({
2687
2687
  message: r || n,
2688
2688
  url: t,
2689
2689
  requestBodyValues: void 0,
@@ -2691,9 +2691,9 @@ async function ur({ response: e, url: t, fallbackMessage: n }) {
2691
2691
  responseBody: r
2692
2692
  });
2693
2693
  }
2694
- async function dr(e) {
2694
+ async function fr(e) {
2695
2695
  if (e == null) return [];
2696
- if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Ze({
2696
+ if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new D({
2697
2697
  functionality: "FileList",
2698
2698
  message: "FileList is not supported in the current environment"
2699
2699
  });
@@ -2712,18 +2712,18 @@ async function dr(e) {
2712
2712
  };
2713
2713
  }));
2714
2714
  }
2715
- function fr(e, t) {
2715
+ function pr(e, t) {
2716
2716
  let n = e.search(/[?#]/), r = n === -1 ? e : e.slice(0, n), i = n === -1 ? "" : e.slice(n);
2717
2717
  return `${r.endsWith("/") && t.startsWith("/") ? r.slice(0, -1) : r}${t}${i}`;
2718
2718
  }
2719
- var pr = class {
2719
+ var mr = class {
2720
2720
  constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
2721
2721
  this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
2722
2722
  }
2723
2723
  async sendMessages({ abortSignal: e, ...t }) {
2724
- let n = await yn(this.body), r = await yn(this.headers), i = await yn(this.credentials), a = {
2725
- ...ot(r),
2726
- ...ot(t.headers)
2724
+ let n = await xn(this.body), r = await xn(this.headers), i = await xn(this.credentials), a = {
2725
+ ...j(r),
2726
+ ...j(t.headers)
2727
2727
  }, o = await this.prepareSendMessagesRequest?.({
2728
2728
  api: this.api,
2729
2729
  id: t.chatId,
@@ -2737,7 +2737,7 @@ var pr = class {
2737
2737
  requestMetadata: t.metadata,
2738
2738
  trigger: t.trigger,
2739
2739
  messageId: t.messageId
2740
- }), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : ot(o.headers), l = o?.body === void 0 ? {
2740
+ }), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : j(o.headers), l = o?.body === void 0 ? {
2741
2741
  ...n,
2742
2742
  ...t.body,
2743
2743
  id: t.chatId,
@@ -2754,18 +2754,18 @@ var pr = class {
2754
2754
  credentials: u,
2755
2755
  signal: e
2756
2756
  });
2757
- if (!d.ok) throw await ur({
2757
+ if (!d.ok) throw await dr({
2758
2758
  response: d,
2759
2759
  url: s,
2760
2760
  fallbackMessage: "Failed to fetch the chat response."
2761
2761
  });
2762
- if (!d.body) throw new D({ message: "The response body is empty." });
2762
+ if (!d.body) throw new T({ message: "The response body is empty." });
2763
2763
  return this.processResponseStream(d.body);
2764
2764
  }
2765
2765
  async reconnectToStream(e) {
2766
- let t = await yn(this.body), n = await yn(this.headers), r = await yn(this.credentials), i = {
2767
- ...ot(n),
2768
- ...ot(e.headers)
2766
+ let t = await xn(this.body), n = await xn(this.headers), r = await xn(this.credentials), i = {
2767
+ ...j(n),
2768
+ ...j(e.headers)
2769
2769
  }, a = await this.prepareReconnectToStreamRequest?.({
2770
2770
  api: this.api,
2771
2771
  id: e.chatId,
@@ -2778,44 +2778,44 @@ var pr = class {
2778
2778
  requestMetadata: e.metadata
2779
2779
  }), o = a?.api;
2780
2780
  if (o == null) {
2781
- if (e.chatId === "." || e.chatId === "..") throw new Cn({
2781
+ if (e.chatId === "." || e.chatId === "..") throw new Tn({
2782
2782
  parameter: "chatId",
2783
2783
  value: e.chatId,
2784
2784
  message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
2785
2785
  });
2786
- o = fr(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
2786
+ o = pr(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
2787
2787
  }
2788
- let s = a?.headers === void 0 ? i : ot(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
2788
+ let s = a?.headers === void 0 ? i : j(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
2789
2789
  method: "GET",
2790
2790
  headers: s,
2791
2791
  credentials: c,
2792
2792
  signal: e.abortSignal
2793
2793
  });
2794
2794
  if (l.status === 204) return null;
2795
- if (!l.ok) throw await ur({
2795
+ if (!l.ok) throw await dr({
2796
2796
  response: l,
2797
2797
  url: o,
2798
2798
  fallbackMessage: "Failed to fetch the chat response."
2799
2799
  });
2800
- if (!l.body) throw new D({ message: "The response body is empty." });
2800
+ if (!l.body) throw new T({ message: "The response body is empty." });
2801
2801
  return this.processResponseStream(l.body);
2802
2802
  }
2803
- }, mr = class extends pr {
2803
+ }, hr = class extends mr {
2804
2804
  constructor({ resumeStreamIsReplay: e = !0, ...t } = {}) {
2805
2805
  super(t), this.resumeStreamIsReplay = e;
2806
2806
  }
2807
2807
  processResponseStream(e) {
2808
- return vn({
2808
+ return bn({
2809
2809
  stream: e,
2810
- schema: Qn
2810
+ schema: $n
2811
2811
  }).pipeThrough(new TransformStream({ async transform(e, t) {
2812
2812
  if (!e.success) throw e.error;
2813
2813
  t.enqueue(e.value);
2814
2814
  } }));
2815
2815
  }
2816
- }, hr = class {
2817
- constructor({ generateId: e = st, id: t = e(), transport: n = new mr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
2818
- this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new lr(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
2816
+ }, gr = class {
2817
+ constructor({ generateId: e = dt, id: t = e(), transport: n = new hr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
2818
+ this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new ur(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
2819
2819
  if (e == null) {
2820
2820
  let e = this.pendingApprovalMessageId;
2821
2821
  if (e == null) {
@@ -2842,7 +2842,7 @@ var pr = class {
2842
2842
  this.pendingMessagePreparations.add(t);
2843
2843
  let r;
2844
2844
  try {
2845
- r = Array.isArray(e.files) ? e.files : await dr(e.files);
2845
+ r = Array.isArray(e.files) ? e.files : await fr(e.files);
2846
2846
  } finally {
2847
2847
  this.pendingMessagePreparations.delete(t);
2848
2848
  }
@@ -2854,12 +2854,12 @@ var pr = class {
2854
2854
  } else n = e;
2855
2855
  if (e.messageId != null) {
2856
2856
  let t = this.state.messages.findIndex((t) => t.id === e.messageId);
2857
- if (t === -1) throw new Cn({
2857
+ if (t === -1) throw new Tn({
2858
2858
  parameter: "message.messageId",
2859
2859
  value: e.messageId,
2860
2860
  message: `message with id ${e.messageId} not found`
2861
2861
  });
2862
- if (this.state.messages[t].role !== "user") throw new Cn({
2862
+ if (this.state.messages[t].role !== "user") throw new Tn({
2863
2863
  parameter: "message.messageId",
2864
2864
  value: e.messageId,
2865
2865
  message: `message with id ${e.messageId} is not a user message`
@@ -2883,7 +2883,7 @@ var pr = class {
2883
2883
  });
2884
2884
  }, this.regenerate = async ({ messageId: e, ...t } = {}) => {
2885
2885
  let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
2886
- if (n === -1) throw new Cn({
2886
+ if (n === -1) throw new Tn({
2887
2887
  parameter: "messageId",
2888
2888
  value: e,
2889
2889
  message: `message ${e} not found`
@@ -3019,7 +3019,7 @@ var pr = class {
3019
3019
  }), r && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = this.state.messages[t]?.id ?? e);
3020
3020
  }
3021
3021
  async makeRequest(e) {
3022
- let t = sr();
3022
+ let t = cr();
3023
3023
  try {
3024
3024
  await this.makeRequestImpl({
3025
3025
  ...e,
@@ -3075,7 +3075,7 @@ var pr = class {
3075
3075
  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, ee = !1, y;
3076
3076
  try {
3077
3077
  let s = {
3078
- state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : ir({
3078
+ state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : ar({
3079
3079
  lastMessage: e === "resume-stream" ? h : e === "regenerate-message" ? void 0 : this.state.snapshot(p),
3080
3080
  messageId: this.generateId()
3081
3081
  }),
@@ -3095,8 +3095,8 @@ var pr = class {
3095
3095
  body: r,
3096
3096
  trigger: e,
3097
3097
  messageId: i
3098
- }), await or({
3099
- stream: ar({
3098
+ }), await sr({
3099
+ stream: or({
3100
3100
  stream: l,
3101
3101
  resetStateOnMessageIdChange: e === "resume-stream",
3102
3102
  resetStateOnFirstMessageStart: e === "resume-stream" && this.transport.resumeStreamIsReplay,
@@ -3161,7 +3161,7 @@ var pr = class {
3161
3161
  }));
3162
3162
  }
3163
3163
  };
3164
- function gr({ messages: e }) {
3164
+ function _r({ messages: e }) {
3165
3165
  let t = e[e.length - 1];
3166
3166
  if (!t || t.role !== "assistant") return !1;
3167
3167
  let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
@@ -3169,31 +3169,31 @@ function gr({ messages: e }) {
3169
3169
  }
3170
3170
  //#endregion
3171
3171
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
3172
- var _r = /* @__PURE__ */ new WeakMap(), vr = 0;
3173
- function yr(e) {
3172
+ var vr = /* @__PURE__ */ new WeakMap(), yr = 0;
3173
+ function br(e) {
3174
3174
  if (!e.length) return "";
3175
3175
  for (var t = "arg", n = 0; n < e.length; ++n) {
3176
3176
  var r = void 0;
3177
- e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : _r.has(e[n]) ? r = _r.get(e[n]) : (r = vr, _r.set(e[n], vr++)), t += "@" + r;
3177
+ e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : vr.has(e[n]) ? r = vr.get(e[n]) : (r = yr, vr.set(e[n], yr++)), t += "@" + r;
3178
3178
  }
3179
3179
  return t;
3180
3180
  }
3181
3181
  //#endregion
3182
3182
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
3183
- function br(e) {
3183
+ function xr(e) {
3184
3184
  if (typeof e == "function") try {
3185
3185
  e = e();
3186
3186
  } catch {
3187
3187
  e = "";
3188
3188
  }
3189
- return e = Array.isArray(e) ? yr(e) : String(e || ""), e;
3189
+ return e = Array.isArray(e) ? br(e) : String(e || ""), e;
3190
3190
  }
3191
- var xr = function() {
3191
+ var Sr = function() {
3192
3192
  function e(e) {
3193
3193
  e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
3194
3194
  }
3195
3195
  return e.prototype.serializeKey = function(e) {
3196
- return br(e);
3196
+ return xr(e);
3197
3197
  }, e.prototype.get = function(e) {
3198
3198
  var t = this.serializeKey(e);
3199
3199
  return this.items.get(t);
@@ -3215,15 +3215,15 @@ var xr = function() {
3215
3215
  }();
3216
3216
  //#endregion
3217
3217
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
3218
- function Sr() {
3218
+ function Cr() {
3219
3219
  return navigator.onLine === void 0 || navigator.onLine;
3220
3220
  }
3221
- function Cr() {
3221
+ function wr() {
3222
3222
  return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
3223
3223
  }
3224
- var wr = {
3225
- isOnline: Sr,
3226
- isDocumentVisible: Cr,
3224
+ var Tr = {
3225
+ isOnline: Cr,
3226
+ isDocumentVisible: wr,
3227
3227
  fetcher: function(e) {
3228
3228
  return fetch(e).then(function(e) {
3229
3229
  return e.json();
@@ -3234,7 +3234,7 @@ var wr = {
3234
3234
  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]);
3235
3235
  return e;
3236
3236
  }, $.apply(this, arguments);
3237
- }, Tr = function(e, t, n, r) {
3237
+ }, Er = function(e, t, n, r) {
3238
3238
  function i(e) {
3239
3239
  return e instanceof n ? e : new n(function(t) {
3240
3240
  t(e);
@@ -3260,7 +3260,7 @@ var wr = {
3260
3260
  }
3261
3261
  c((r = r.apply(e, t || [])).next());
3262
3262
  });
3263
- }, Er = function(e, t) {
3263
+ }, Dr = function(e, t) {
3264
3264
  var n = {
3265
3265
  label: 0,
3266
3266
  sent: function() {
@@ -3333,7 +3333,7 @@ var wr = {
3333
3333
  done: !0
3334
3334
  };
3335
3335
  }
3336
- }, Dr = function(e, t) {
3336
+ }, Or = function(e, t) {
3337
3337
  var n = typeof Symbol == "function" && e[Symbol.iterator];
3338
3338
  if (!n) return e;
3339
3339
  var r = n.call(e), i, a = [], o;
@@ -3349,11 +3349,11 @@ var wr = {
3349
3349
  }
3350
3350
  }
3351
3351
  return a;
3352
- }, Or = function(e, t, n) {
3352
+ }, kr = function(e, t, n) {
3353
3353
  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]);
3354
3354
  return e.concat(a || Array.prototype.slice.call(t));
3355
- }, kr = new xr(), Ar = new xr(), jr = new xr(), Mr = {
3356
- cache: kr,
3355
+ }, Ar = new Sr(), jr = new Sr(), Mr = new Sr(), Nr = {
3356
+ cache: Ar,
3357
3357
  refreshInterval: 0,
3358
3358
  ttl: 0,
3359
3359
  serverTTL: 1e3,
@@ -3363,15 +3363,15 @@ var wr = {
3363
3363
  shouldRetryOnError: !0,
3364
3364
  errorRetryInterval: 5e3,
3365
3365
  errorRetryCount: 5,
3366
- fetcher: wr.fetcher,
3367
- isOnline: wr.isOnline,
3368
- isDocumentVisible: wr.isDocumentVisible
3366
+ fetcher: Tr.fetcher,
3367
+ isOnline: Tr.isOnline,
3368
+ isDocumentVisible: Tr.isDocumentVisible
3369
3369
  };
3370
- function Nr(e, t, n) {
3371
- var r = Ar.get(e);
3372
- r ? r.data.push(t) : Ar.set(e, [t], n > 0 ? n + 5e3 : n);
3373
- }
3374
3370
  function Pr(e, t, n) {
3371
+ var r = jr.get(e);
3372
+ r ? r.data.push(t) : jr.set(e, [t], n > 0 ? n + 5e3 : n);
3373
+ }
3374
+ function Fr(e, t, n) {
3375
3375
  if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
3376
3376
  var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
3377
3377
  setTimeout(function() {
@@ -3382,17 +3382,17 @@ function Pr(e, t, n) {
3382
3382
  }, i);
3383
3383
  }
3384
3384
  }
3385
- function Fr(e) {
3385
+ function Ir(e) {
3386
3386
  var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
3387
- return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Mr.shouldRetryOnError;
3387
+ return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Nr.shouldRetryOnError;
3388
3388
  }
3389
- var Ir = function(e, t, n, r) {
3390
- return n === void 0 && (n = kr), r === void 0 && (r = Mr.ttl), Tr(void 0, void 0, void 0, function() {
3389
+ var Lr = function(e, t, n, r) {
3390
+ return n === void 0 && (n = Ar), r === void 0 && (r = Nr.ttl), Er(void 0, void 0, void 0, function() {
3391
3391
  var i, a, o, s, c, l, u;
3392
- return Er(this, function(d) {
3392
+ return Dr(this, function(d) {
3393
3393
  switch (d.label) {
3394
3394
  case 0:
3395
- if (!Rr(t)) return [3, 5];
3395
+ if (!zr(t)) return [3, 5];
3396
3396
  d.label = 1;
3397
3397
  case 1: return d.trys.push([
3398
3398
  1,
@@ -3414,7 +3414,7 @@ var Ir = function(e, t, n, r) {
3414
3414
  } catch (e) {
3415
3415
  console.error("swrv(mutate): failed to set cache", e);
3416
3416
  }
3417
- return l = Ar.get(e), l && l.data.length && (u = l.data.filter(function(t) {
3417
+ return l = jr.get(e), l && l.data.length && (u = l.data.filter(function(t) {
3418
3418
  return t.key === e;
3419
3419
  }), u.forEach(function(e, t) {
3420
3420
  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];
@@ -3423,9 +3423,9 @@ var Ir = function(e, t, n, r) {
3423
3423
  });
3424
3424
  });
3425
3425
  };
3426
- function Lr() {
3426
+ function Rr() {
3427
3427
  for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
3428
- var r, i, a = $({}, Mr), o = !1, s = !1;
3428
+ var r, i, a = $({}, Nr), o = !1, s = !1;
3429
3429
  if (!me()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
3430
3430
  var c = typeof window > "u" || typeof document > "u";
3431
3431
  t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
@@ -3440,32 +3440,32 @@ function Lr() {
3440
3440
  key: null
3441
3441
  });
3442
3442
  var f = function(t, n) {
3443
- return Tr(e, void 0, void 0, function() {
3443
+ return Er(e, void 0, void 0, function() {
3444
3444
  var e, r, s, c, p, m, h, g = this;
3445
- return Er(this, function(_) {
3445
+ return Dr(this, function(_) {
3446
3446
  switch (_.label) {
3447
3447
  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() {
3448
- return Tr(g, void 0, void 0, function() {
3448
+ return Er(g, void 0, void 0, function() {
3449
3449
  var e, t, i, s, c, u;
3450
- return Er(this, function(m) {
3450
+ return Dr(this, function(m) {
3451
3451
  switch (m.label) {
3452
- case 0: return e = jr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, Or([], Dr(t), !1)), jr.set(r, i, a.dedupingInterval), [4, Ir(r, i, a.cache, l)]);
3452
+ case 0: return e = Mr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, kr([], Or(t), !1)), Mr.set(r, i, a.dedupingInterval), [4, Lr(r, i, a.cache, l)]);
3453
3453
  case 1: return m.sent(), [3, 4];
3454
- case 2: return [4, Ir(r, e.data, a.cache, l)];
3454
+ case 2: return [4, Lr(r, e.data, a.cache, l)];
3455
3455
  case 3: m.sent(), m.label = 4;
3456
- case 4: return d.isValidating = !1, d.isLoading = !1, jr.delete(r), d.error !== void 0 && (s = Fr({
3456
+ case 4: return d.isValidating = !1, d.isLoading = !1, Mr.delete(r), d.error !== void 0 && (s = Ir({
3457
3457
  shouldRetry: a.shouldRetryOnError,
3458
3458
  error: d.error
3459
- }), c = Fr({
3459
+ }), c = Ir({
3460
3460
  shouldRetry: !n || n.shouldRetryOnError,
3461
3461
  error: d.error
3462
- }), u = !o && s && c, u && Pr(f, n ? n.errorRetryCount : 1, a)), [2];
3462
+ }), u = !o && s && c, u && Fr(f, n ? n.errorRetryCount : 1, a)), [2];
3463
3463
  }
3464
3464
  });
3465
3465
  });
3466
3466
  }, c && a.revalidateDebounce ? (setTimeout(function() {
3467
- return Tr(g, void 0, void 0, function() {
3468
- return Er(this, function(e) {
3467
+ return Er(g, void 0, void 0, function() {
3468
+ return Dr(this, function(e) {
3469
3469
  switch (e.label) {
3470
3470
  case 0: return o ? [3, 2] : [4, h()];
3471
3471
  case 1: e.sent(), e.label = 2;
@@ -3481,16 +3481,16 @@ function Lr() {
3481
3481
  });
3482
3482
  });
3483
3483
  }, p = function() {
3484
- return Tr(e, void 0, void 0, function() {
3485
- return Er(this, function(e) {
3484
+ return Er(e, void 0, void 0, function() {
3485
+ return Dr(this, function(e) {
3486
3486
  return [2, f(null, { shouldRetryOnError: !1 })];
3487
3487
  });
3488
3488
  });
3489
3489
  }, m = null;
3490
3490
  if (!c) {
3491
3491
  var h = function() {
3492
- return Tr(e, void 0, void 0, function() {
3493
- return Er(this, function(e) {
3492
+ return Er(e, void 0, void 0, function() {
3493
+ return Dr(this, function(e) {
3494
3494
  switch (e.label) {
3495
3495
  case 0: return d.error || !a.isOnline() ? [3, 2] : [4, f()];
3496
3496
  case 1: return e.sent(), [3, 3];
@@ -3504,39 +3504,39 @@ function Lr() {
3504
3504
  }
3505
3505
  _e(function() {
3506
3506
  o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
3507
- var e = Ar.get(u.value);
3507
+ var e = jr.get(u.value);
3508
3508
  e && (e.data = e.data.filter(function(e) {
3509
3509
  return e !== d;
3510
3510
  }));
3511
3511
  });
3512
3512
  try {
3513
- C(u, function(e) {
3514
- he(u) || (u.value = e), d.key = e, d.isValidating = !!e, Nr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3513
+ S(u, function(e) {
3514
+ he(u) || (u.value = e), d.key = e, d.isValidating = !!e, Pr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3515
3515
  }, { immediate: !0 });
3516
3516
  } catch {}
3517
- return $($({}, ye(d)), { mutate: function(e, t) {
3517
+ return $($({}, be(d)), { mutate: function(e, t) {
3518
3518
  return f(e, $($({}, t), { forceRevalidate: !0 }));
3519
3519
  } });
3520
3520
  }
3521
- function Rr(e) {
3521
+ function zr(e) {
3522
3522
  return typeof e == "object" && !!e && typeof e.then == "function";
3523
3523
  }
3524
3524
  //#endregion
3525
3525
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/index.js
3526
- var zr = Lr;
3527
- zr.default, zr.default;
3528
- function Br(e) {
3526
+ var Br = Rr;
3527
+ Br.default, Br.default;
3528
+ function Vr(e) {
3529
3529
  return Array.isArray(e) ? [...e] : typeof e == "object" && e && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
3530
3530
  }
3531
- function Vr(e) {
3531
+ function Hr(e) {
3532
3532
  if (typeof e != "object" || !e || !("parts" in e) || !Array.isArray(e.parts)) return e;
3533
3533
  let t = e, n = {
3534
3534
  ...t,
3535
3535
  parts: t.parts.map((e) => ({ ...e }))
3536
3536
  };
3537
- return "metadata" in t && (n.metadata = Br(t.metadata)), n;
3537
+ return "metadata" in t && (n.metadata = Vr(t.metadata)), n;
3538
3538
  }
3539
- var Hr = class {
3539
+ var Ur = class {
3540
3540
  constructor({ initialMessages: e, messagesRef: t, statusRef: n, errorRef: r, throttleWaitMs: i }) {
3541
3541
  this.publishedMessages = [], this.publishedMessageSources = [], this.dirtyMessageIndices = /* @__PURE__ */ new Set(), this.statusValue = "ready", this.hasPendingPublication = !1, this.isActive = !0, this.isPublishing = !1, this.pushMessage = (e) => {
3542
3542
  this.messagesValue.push(e), this.dirtyMessageIndices.add(this.messagesValue.length - 1), this.schedulePublication();
@@ -3544,7 +3544,7 @@ var Hr = class {
3544
3544
  this.messagesValue.pop(), this.schedulePublication();
3545
3545
  }, this.replaceMessage = (e, t) => {
3546
3546
  this.messagesValue[e] = t, this.dirtyMessageIndices.add(e), this.schedulePublication();
3547
- }, this.snapshot = Vr, this.handleIntervalEnd = () => {
3547
+ }, this.snapshot = Hr, this.handleIntervalEnd = () => {
3548
3548
  this.timeout = void 0, this.isActive && this.hasPendingPublication && (this.hasPendingPublication = !1, this.publishMessages(), this.timeout = setTimeout(this.handleIntervalEnd, this.throttleWaitMs));
3549
3549
  }, this.messagesValue = e, this.messagesRef = t, this.statusRef = n, this.errorRef = r, this.throttleWaitMs = i != null && Number.isFinite(i) && i > 0 ? i : void 0;
3550
3550
  }
@@ -3586,7 +3586,7 @@ var Hr = class {
3586
3586
  }
3587
3587
  publishMessages() {
3588
3588
  if (!this.isActive) return;
3589
- let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ? Vr(e) : this.publishedMessages[t]);
3589
+ let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ? Hr(e) : this.publishedMessages[t]);
3590
3590
  this.publishedMessages = e, this.publishedMessageSources = [...this.messagesValue], this.dirtyMessageIndices.clear(), this.isPublishing = !0;
3591
3591
  try {
3592
3592
  this.messagesRef.value = e;
@@ -3594,7 +3594,7 @@ var Hr = class {
3594
3594
  this.isPublishing = !1;
3595
3595
  }
3596
3596
  }
3597
- }, Ur = class extends hr {
3597
+ }, Wr = class extends gr {
3598
3598
  constructor({ state: e, ...t }) {
3599
3599
  super({
3600
3600
  ...t,
@@ -3602,20 +3602,20 @@ var Hr = class {
3602
3602
  });
3603
3603
  }
3604
3604
  };
3605
- function Wr(e) {
3606
- let t = S([]), n = S("ready"), r = S(), i = S(), a;
3607
- return C(t, (e) => {
3605
+ function Gr(e) {
3606
+ let t = ye([]), n = ye("ready"), r = ye(), i = ye(), a;
3607
+ return S(t, (e) => {
3608
3608
  a != null && !a.isPublishing && a.setMessagesFromConsumer(e);
3609
- }, { flush: "sync" }), C(() => be(e), (e) => {
3609
+ }, { flush: "sync" }), S(() => xe(e), (e) => {
3610
3610
  a?.dispose();
3611
- let { throttle: o, ...s } = e ?? {}, c = new Hr({
3611
+ let { throttle: o, ...s } = e ?? {}, c = new Ur({
3612
3612
  initialMessages: s.messages ?? [],
3613
3613
  messagesRef: t,
3614
3614
  statusRef: n,
3615
3615
  errorRef: r,
3616
3616
  throttleWaitMs: o
3617
3617
  });
3618
- a = c, c.publishInitialState(), i.value = new Ur({
3618
+ a = c, c.publishInitialState(), i.value = new Wr({
3619
3619
  ...s,
3620
3620
  state: c
3621
3621
  });
@@ -3637,52 +3637,52 @@ function Wr(e) {
3637
3637
  }
3638
3638
  //#endregion
3639
3639
  //#region ../../packages/composable/src/chatbot/useChatbotStore.ts
3640
- var Gr = "voice-", Kr = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), qr = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Jr = (e) => qr(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Yr = 8, Xr = (e, t) => {
3640
+ var Kr = "voice-", qr = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), Jr = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Yr = (e) => Jr(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Xr = 8, Zr = (e, t) => {
3641
3641
  let n = e.filter((e) => e.role === "user").map((e) => ({
3642
- text: Jr(e),
3642
+ text: Yr(e),
3643
3643
  taken: !1
3644
3644
  }));
3645
3645
  return t.filter((e) => {
3646
3646
  if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
3647
- let t = Jr(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Yr && t.endsWith(e.text)));
3647
+ let t = Yr(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Xr && t.endsWith(e.text)));
3648
3648
  return !r || (r.taken = !0, !1);
3649
3649
  });
3650
- }, Zr = 12e4, Qr = 1e3, $r = (e) => {
3650
+ }, Qr = 12e4, $r = 1e3, ei = 5e3, ti = 100, ni = 3e4, ri = 5e3, ii = 250, ai = 1e3, oi = "\n\n", si = (e) => {
3651
3651
  let t = e.type ?? "";
3652
3652
  return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
3653
- }, ei = ({ messages: e }) => {
3653
+ }, ci = (e) => e?.role === "assistant" && e.parts.some((e) => te(si(e)) && !e.providerExecuted && !se.has(e.state ?? "")), li = ({ messages: e }) => {
3654
3654
  let t = e[e.length - 1];
3655
3655
  if (!t || t.role !== "assistant") return !1;
3656
- 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 && (te($r(e)) || oe(e)));
3656
+ 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 && (te(si(e)) || oe(e)));
3657
3657
  return r.length > 0 && r.every((e) => se.has(e.state ?? ""));
3658
3658
  };
3659
- function ti(e) {
3660
- return we(`chatbot-${e}`, () => {
3661
- let { t, te: n, locale: r } = Se({ useScope: "global" }), i = x(""), a = x(), o = x(e), s = x(), c = x(), l = x(), u = x(), d = x(), f = x(), p = x(), m = x(), h = x(), g = x(), _ = x(), v = x(), te = x(), ie = x(), ae = x(), se = x(), me = S(), he = x(0), _e = x(), ye = S(), be = S(), we = x(), Oe = x({}), Me = x(!1), Ne = x(0), w = x(), Pe = x(!1), Fe = Ce(), Ie = b(() => {
3659
+ function ui(e) {
3660
+ return Ee(`chatbot-${e}`, () => {
3661
+ let { t, te: n, locale: r } = Ce({ useScope: "global" }), i = x(""), a = x(), o = x(e), s = x(), c = x(), l = x(), u = x(), d = x(), f = x(), p = x(), m = x(), h = x(), g = x(), _ = x(), v = x(), te = x(), ie = x(), ae = x(), se = x(), me = ye(), he = x(0), be = x(), xe = ye(), Ee = ye(), Ae = x(), Pe = x({}), Fe = x(!1), C = x(0), Ie = x(), Le = x(!1), Re = Te(), ze = b(() => {
3662
3662
  let e = u.value?.theme;
3663
- return (!e || e === "auto") && (e = w.value), e ? e === "dark" : Fe.value;
3664
- }), T = b(() => c.value === "reasoning"), Le = b(() => T.value ? g.value?.filter((e) => ![
3663
+ return (!e || e === "auto") && (e = Ie.value), e ? e === "dark" : Re.value;
3664
+ }), w = b(() => c.value === "reasoning"), Be = b(() => w.value ? g.value?.filter((e) => ![
3665
3665
  "upvote",
3666
3666
  "downvote",
3667
3667
  "feedback"
3668
- ].includes(e)) : g.value), Re = pe(b(() => `${o.value}-chatId`), null);
3669
- xe(() => {
3670
- Re.value ||= st();
3668
+ ].includes(e)) : g.value), Ve = pe(b(() => `${o.value}-chatId`), null);
3669
+ Se(() => {
3670
+ Ve.value ||= dt();
3671
3671
  });
3672
- let E = b({
3673
- get: () => Re.value,
3672
+ let T = b({
3673
+ get: () => Ve.value,
3674
3674
  set: (e) => {
3675
- Re.value = e;
3675
+ Ve.value = e;
3676
3676
  }
3677
- }), D = fe(b(() => `${o.value}-pageAccessOff`), !1), ze = b(() => D.value ? [] : ye.value ?? []), Be = () => D.value ? [] : be.value?.() ?? [], Ve = b(() => !!(_e.value && ye.value?.length)), He = pe(b(() => `${o.value}-pageNotice`), null), Ue = b(() => {
3678
- let e = _e.value?.level;
3679
- return e && e !== ee.Off && ze.value.length && !y(He.value ?? void 0, e) ? e : void 0;
3677
+ }), He = fe(b(() => `${o.value}-pageAccessOff`), !1), Ue = b(() => He.value ? [] : xe.value ?? []), We = () => He.value ? [] : Ee.value?.() ?? [], Ge = b(() => !!(be.value && xe.value?.length)), Ke = pe(b(() => `${o.value}-pageNotice`), null), qe = b(() => {
3678
+ let e = be.value?.level;
3679
+ return e && e !== ee.Off && Ue.value.length && !y(Ke.value ?? void 0, e) ? e : void 0;
3680
3680
  });
3681
- function We() {
3682
- He.value = _e.value?.level ?? null;
3681
+ function Je() {
3682
+ Ke.value = be.value?.level ?? null;
3683
3683
  }
3684
- let O = x(), Ge = x(!1), Ke = b(() => O.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3685
- function qe(e) {
3684
+ let Ye = x(), Xe = x(!1), Ze = b(() => Ye.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3685
+ function Qe(e) {
3686
3686
  try {
3687
3687
  let t = JSON.parse(e.message);
3688
3688
  return t.status === 404 || t.type?.includes("entity-not-found");
@@ -3690,88 +3690,101 @@ function ti(e) {
3690
3690
  return !1;
3691
3691
  }
3692
3692
  }
3693
- function Je(e) {
3694
- if (qe(e)) {
3693
+ function $e(e) {
3694
+ if (Qe(e)) {
3695
3695
  let e = P.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? de(t) : void 0;
3696
- E.value = st(), O.value = void 0, ge(() => {
3696
+ T.value = dt(), Ye.value = void 0, ge(() => {
3697
3697
  P.value.clearError(), n && P.value.sendMessage({ text: n });
3698
3698
  });
3699
- } else le.error(e), O.value = e, Ke.value && (Ge.value = !0);
3699
+ } else le.error(e), Ye.value = e, Ze.value && (Xe.value = !0);
3700
3700
  }
3701
- let k = b(() => ce({
3701
+ let E = b(() => ce({
3702
3702
  baseUrl: i.value,
3703
3703
  basePath: a.value,
3704
3704
  headers: () => p.value
3705
- })), A = x(null), Ye = () => ({
3706
- ...Te(),
3707
- ...A.value ?? {}
3708
- }), Xe = () => {
3709
- let e = Ne.value;
3705
+ })), et = x(null), tt = () => ({
3706
+ ...De(),
3707
+ ...et.value ?? {}
3708
+ }), nt = () => {
3709
+ let e = C.value;
3710
3710
  return new Promise((t) => {
3711
3711
  let n = setTimeout(() => {
3712
3712
  r(), t(!1);
3713
- }, 3e4), r = C(() => [Ne.value, P.value.status], ([i, a]) => {
3713
+ }, 3e4), r = S(() => [C.value, P.value.status], ([i, a]) => {
3714
3714
  i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
3715
3715
  });
3716
3716
  });
3717
- }, j = S(), Ze = (e, t) => new Promise((n) => {
3718
- j.value?.answer(!1), j.value = {
3717
+ }, D = ye(), rt = (e, t) => new Promise((n) => {
3718
+ D.value?.answer(!1), D.value = {
3719
3719
  toolCallId: e.toolCallId,
3720
3720
  question: t?.question,
3721
3721
  details: t?.details,
3722
3722
  answer: (e) => {
3723
- j.value = void 0, n(e);
3723
+ D.value = void 0, n(e);
3724
3724
  }
3725
3725
  };
3726
3726
  });
3727
- function Qe(e) {
3728
- j.value?.answer(e);
3727
+ function it(e) {
3728
+ D.value?.answer(e);
3729
3729
  }
3730
- let $e = je({
3730
+ let at = Ne({
3731
3731
  registry: () => [
3732
3732
  ...(me.value ?? []).filter((e) => !re(e.name)),
3733
- ...ze.value,
3734
- ...Be()
3733
+ ...Ue.value,
3734
+ ...We()
3735
3735
  ],
3736
3736
  capability: () => se.value,
3737
3737
  addToolOutput: (e) => void P.value.addToolOutput(e),
3738
- confirm: Ze,
3739
- waitForResume: Xe,
3738
+ confirm: rt,
3739
+ waitForResume: nt,
3740
3740
  onPendingChange: (e) => {
3741
3741
  he.value = e;
3742
3742
  },
3743
3743
  onActivity: (e) => {
3744
3744
  if (e?.provider !== "page") {
3745
- we.value = void 0;
3745
+ Ae.value = void 0;
3746
3746
  return;
3747
3747
  }
3748
- let t = [...ze.value, ...Be()].find((t) => t.name === e.toolName), n;
3748
+ let t = [...Ue.value, ...We()].find((t) => t.name === e.toolName), n;
3749
3749
  try {
3750
3750
  n = t?.describe?.(e.input);
3751
3751
  } catch {
3752
3752
  n = void 0;
3753
3753
  }
3754
- n && (Oe.value = {
3755
- ...Oe.value,
3754
+ n && (Pe.value = {
3755
+ ...Pe.value,
3756
3756
  [e.toolCallId]: n
3757
- }), e.readOnly ? we.value = void 0 : (we.value = { title: n ?? t?.annotations?.title ?? e.toolName }, Me.value = !0);
3757
+ }), e.readOnly ? Ae.value = void 0 : (Ae.value = { title: n ?? t?.annotations?.title ?? e.toolName }, Fe.value = !0);
3758
3758
  }
3759
3759
  });
3760
- async function et() {
3761
- M(), we.value = void 0, Me.value = !1, H.value = "", await P.value.stop();
3760
+ async function O() {
3761
+ k(), Ae.value = void 0, Fe.value = !1, H.value = "", await P.value.stop();
3762
+ }
3763
+ function k() {
3764
+ at.cancelAll(), D.value?.answer(!1);
3762
3765
  }
3763
- function M() {
3764
- $e.cancelAll(), j.value?.answer(!1);
3766
+ async function ot(e) {
3767
+ He.value = e, e && await O();
3765
3768
  }
3766
- async function tt(e) {
3767
- D.value = e, e && await et();
3769
+ S(T, () => k(), { flush: "sync" });
3770
+ let st = !1, A, ct = x(), lt, ut = x([]), j = x([]), M = x([]), N = x({}), ft = /* @__PURE__ */ new Map(), pt = /* @__PURE__ */ new Set();
3771
+ function mt(e, t, n) {
3772
+ j.value.includes(e) || (j.value = [...j.value, e]), ft.set(e, Date.now()), n ? pt.add(e) : pt.delete(e), t && (N.value = {
3773
+ ...N.value,
3774
+ [e]: t
3775
+ }), q || vn();
3768
3776
  }
3769
- C(E, () => M(), { flush: "sync" });
3770
- let nt = !1, N, rt = Wr(() => ({
3771
- id: E.value,
3772
- transport: new mr({
3773
- api: k.value.getChatEndpoint(o.value, T.value ? "reasoning" : "chat"),
3774
- prepareReconnectToStreamRequest: ({ id: e }) => ({ api: k.value.getChatStreamEndpoint(o.value, e) }),
3777
+ function ht(e) {
3778
+ N.value = Object.fromEntries(Object.entries(N.value).filter(([t]) => t !== e));
3779
+ }
3780
+ function gt(e) {
3781
+ ft.delete(e), j.value = j.value.filter((t) => t !== e), M.value = M.value.filter((t) => t !== e), ht(e);
3782
+ }
3783
+ let _t = Gr(() => ({
3784
+ id: T.value,
3785
+ transport: new hr({
3786
+ api: E.value.getChatEndpoint(o.value, w.value ? "reasoning" : "chat"),
3787
+ prepareReconnectToStreamRequest: ({ id: e }) => ({ api: E.value.getChatStreamEndpoint(o.value, e) }),
3775
3788
  prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
3776
3789
  id: t,
3777
3790
  messages: [e[e.length - 1]],
@@ -3786,16 +3799,16 @@ function ti(e) {
3786
3799
  reasoning: d.value?.reasoning,
3787
3800
  webSearch: f.value?.webSearch,
3788
3801
  smoothStream: u.value?.smoothStream,
3789
- deviceContext: Ye(),
3802
+ deviceContext: tt(),
3790
3803
  externalContext: ae.value,
3791
3804
  disabledTools: f.value?.disabled,
3792
3805
  fallbackModels: te.value,
3793
3806
  gatewayOptions: ie.value,
3794
- hostTools: Ae(me.value, se.value),
3795
- pageTools: _e.value && ze.value.length ? {
3807
+ hostTools: Me(me.value, se.value),
3808
+ pageTools: be.value && Ue.value.length ? {
3796
3809
  version: 1,
3797
3810
  features: [...ne],
3798
- forms: Be().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3811
+ forms: We().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3799
3812
  name: e,
3800
3813
  description: t,
3801
3814
  inputSchema: n,
@@ -3806,44 +3819,48 @@ function ti(e) {
3806
3819
  credentials: "include",
3807
3820
  headers: () => p.value ?? {}
3808
3821
  }),
3809
- sendAutomaticallyWhen: (e) => ei(e) || gr(e),
3822
+ sendAutomaticallyWhen: (e) => li(e) || _r(e),
3810
3823
  onError: (e) => {
3811
- nt ? le.warn(e) : Je(e);
3824
+ st ? le.warn(e) : $e(e);
3812
3825
  },
3813
3826
  onToolCall: ({ toolCall: e }) => {
3814
- if (!ke(e) || nt) return;
3827
+ if (!je(e) || st) return;
3815
3828
  let t = e;
3816
- $e.enqueue({
3829
+ at.enqueue({
3817
3830
  toolCallId: t.toolCallId,
3818
3831
  toolName: t.toolName,
3819
3832
  input: t.input,
3820
- messageId: it()?.id ?? "",
3833
+ messageId: vt()?.id ?? "",
3821
3834
  readOnly: t.toolMetadata?.readOnly === !0,
3822
3835
  provider: t.toolMetadata?.provider === "page" ? "page" : "app"
3823
3836
  });
3824
3837
  },
3825
3838
  onData: (e) => {
3826
- e.type === "data-audioTranscripts" && (P.value.messages = ue(P.value.messages, e.data));
3839
+ e.type === "data-turnStream" ? lt = e.data.streamId : e.type === "data-audioTranscripts" && (P.value.messages = ue(P.value.messages, e.data));
3827
3840
  },
3828
3841
  onFinish: () => {
3829
- let e = E.value;
3830
- !T.value && !I.value.some((t) => t.id === e) && yt(o.value);
3842
+ let e = T.value;
3843
+ !w.value && !I.value.some((t) => t.id === e) && zt(o.value);
3831
3844
  }
3832
- })), P = b(() => ve(rt)), it = () => P.value.messages[P.value.messages.length - 1];
3833
- C(E, () => {
3834
- P.value.stop();
3845
+ })), P = b(() => ve(_t)), vt = () => P.value.messages[P.value.messages.length - 1];
3846
+ S(T, (e, t) => {
3847
+ if (t && !w.value && (G() || A?.chatId === t)) {
3848
+ let e = P.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
3849
+ mt(t, n ? de(n) ?? "" : "", P.value.status === "streaming" || A?.chatId === t);
3850
+ }
3851
+ gt(e), lt = void 0, clearTimeout(fn), dn.value = !1, P.value.stop();
3835
3852
  }, { flush: "sync" });
3836
- let at = b(() => {
3853
+ let yt = b(() => {
3837
3854
  let e = u.value?.initialMessage;
3838
3855
  return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
3839
- }), ot = st(), F = b(() => ({
3840
- id: ot,
3856
+ }), bt = dt(), F = b(() => ({
3857
+ id: bt,
3841
3858
  role: "assistant",
3842
3859
  parts: [{
3843
3860
  type: "text",
3844
- text: at.value
3861
+ text: yt.value
3845
3862
  }]
3846
- })), ct = b(() => {
3863
+ })), xt = b(() => {
3847
3864
  let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
3848
3865
  ...e,
3849
3866
  parts: e.parts.map((e) => {
@@ -3853,107 +3870,138 @@ function ti(e) {
3853
3870
  let e = t.url.slice(13);
3854
3871
  return {
3855
3872
  ...t,
3856
- url: k.value.getMediaUrl(o.value, E.value, e)
3873
+ url: E.value.getMediaUrl(o.value, T.value, e)
3857
3874
  };
3858
3875
  }
3859
3876
  return t.url.startsWith("blob:") ? t : {
3860
3877
  ...t,
3861
- url: k.value.appendAuthToken(t.url)
3878
+ url: E.value.appendAuthToken(t.url)
3862
3879
  };
3863
3880
  })
3864
- }), t = P.value.id === E.value ? P.value.messages : [];
3865
- return T.value ? e(t) : !Pe.value && t[0]?.role !== "assistant" ? [F.value, ...e(t)] : e(t);
3866
- }), lt = b(() => {
3881
+ }), t = P.value.id === T.value ? P.value.messages : [];
3882
+ return w.value ? e(t) : !Le.value && t[0]?.role !== "assistant" ? [F.value, ...e(t)] : e(t);
3883
+ }), St = b(() => {
3867
3884
  let e = u.value?.messagePlaceholder;
3868
3885
  return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
3869
- }), I = x([]), ut = x(!1), L = x([]), dt = x(!1), ft = x("chat"), R = x([]), pt = x(), mt = x(!1), ht = x(!1), z = x(), gt = x(!1), _t = x(!1), vt = x(), B = x(""), V = x([]), H = x(""), U = x(0);
3870
- async function yt(e) {
3871
- if (T.value) I.value = [];
3886
+ }), I = x([]), Ct = x(!1), L = x([]), wt = x(!1), Tt = x("chat"), R = x([]), Et = x(), Dt = x(!1), Ot = x(!1), kt = x(), At = x(!1), jt = x(!1), z = x(), B = x(""), V = x([]), H = x(""), Mt = x(0), U = fe(b(() => `${o.value}-queue`), {}), W = b(() => U.value[T.value] ?? []), Nt = b(() => !w.value);
3887
+ function Pt(e, t) {
3888
+ let n = Object.fromEntries(Object.entries(U.value).filter(([t]) => t !== e));
3889
+ U.value = t.length > 0 ? {
3890
+ ...n,
3891
+ [e]: t
3892
+ } : n;
3893
+ }
3894
+ function Ft(e) {
3895
+ let t = (U.value[e] ?? []).join(oi);
3896
+ return Pt(e, []), t;
3897
+ }
3898
+ function It(e) {
3899
+ e && (B.value = B.value ? `${B.value}${oi}${e}` : e);
3900
+ }
3901
+ function Lt(e) {
3902
+ Pt(T.value, W.value.filter((t, n) => n !== e));
3903
+ }
3904
+ function Rt(e) {
3905
+ let t = W.value[e];
3906
+ Lt(e), It(t ?? "");
3907
+ }
3908
+ async function zt(e) {
3909
+ if (w.value) I.value = [];
3872
3910
  else {
3873
- ut.value = !0;
3911
+ Ct.value = !0;
3874
3912
  try {
3875
- I.value = await k.value.getConversations(e, l.value);
3913
+ let t = await E.value.getConversations(e, l.value), n = new Set(t.map((e) => e.id)), r = j.value.filter((e) => !n.has(e) && N.value[e]).map((t) => ({
3914
+ id: t,
3915
+ agentId: e,
3916
+ title: N.value[t],
3917
+ summary: null,
3918
+ messages: [],
3919
+ lastMessageAt: /* @__PURE__ */ new Date()
3920
+ }));
3921
+ I.value = [...r, ...t];
3876
3922
  } catch {
3877
3923
  I.value = [];
3924
+ return;
3878
3925
  } finally {
3879
- ut.value = !1;
3926
+ Ct.value = !1;
3880
3927
  }
3928
+ yn([.../* @__PURE__ */ new Set([...mn(), ...I.value.map((e) => e.id)])]);
3881
3929
  }
3882
3930
  }
3883
- async function bt() {
3884
- let e = E.value;
3931
+ async function Bt() {
3932
+ let e = T.value;
3885
3933
  if (!e) L.value = [];
3886
3934
  else {
3887
- dt.value = !0;
3935
+ wt.value = !0;
3888
3936
  try {
3889
- L.value = await k.value.getChatFiles(e);
3937
+ L.value = await E.value.getChatFiles(e);
3890
3938
  } catch {
3891
3939
  L.value = [];
3892
3940
  } finally {
3893
- dt.value = !1;
3941
+ wt.value = !1;
3894
3942
  }
3895
3943
  }
3896
3944
  }
3897
- function xt(e, t = !1) {
3898
- return k.value.getChatFileDownloadUrl(e, t);
3945
+ function Vt(e, t = !1) {
3946
+ return E.value.getChatFileDownloadUrl(e, t);
3899
3947
  }
3900
- function St(e) {
3901
- return k.value.getChatFilePreviewUrl(e);
3948
+ function Ht(e) {
3949
+ return E.value.getChatFilePreviewUrl(e);
3902
3950
  }
3903
- async function Ct(e) {
3904
- await k.value.deleteChatFile(e);
3951
+ async function Ut(e) {
3952
+ await E.value.deleteChatFile(e);
3905
3953
  let t = L.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
3906
3954
  L.value = L.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
3907
3955
  }
3908
- async function wt(e, t) {
3909
- if (!T.value) try {
3910
- let n = await k.value.getChat(e, t);
3911
- if (t !== E.value || P.value.status !== "ready" || P.value.messages.length > 0) return;
3912
- n && (P.value.messages = n.messages, Ge.value = n.blocked ?? !1, Tt(e, t, n.turnInProgress === !0));
3956
+ async function Wt(e, t) {
3957
+ if (!w.value) try {
3958
+ let n = await E.value.getChat(e, t);
3959
+ if (t !== T.value || P.value.status !== "ready" || P.value.messages.length > 0) return;
3960
+ n && (P.value.messages = n.messages, Xe.value = n.blocked ?? !1, Gt(e, t, n.turnInProgress === !0));
3913
3961
  } catch {}
3914
3962
  }
3915
- async function Tt(e, t, n) {
3916
- n && (await W(t), t !== E.value || G()) || await Et(e, t);
3963
+ async function Gt(e, t, n) {
3964
+ n && (await Kt(t), t !== T.value || G()) || (await qt(e, t), t === T.value && await Zt());
3917
3965
  }
3918
- async function W(e) {
3966
+ async function Kt(e) {
3919
3967
  let t = { chatId: e };
3920
- N = t;
3921
- let n = () => N === t && e === E.value, r = Date.now() + Zr;
3968
+ A = t, ct.value = e;
3969
+ let n = () => A === t && e === T.value, r = Date.now() + Qr;
3922
3970
  try {
3923
3971
  for (; n() && !G() && Date.now() < r;) {
3924
- nt = !0;
3972
+ st = !0;
3925
3973
  try {
3926
3974
  await P.value.resumeStream();
3927
3975
  } finally {
3928
- nt = !1;
3976
+ st = !1;
3929
3977
  }
3930
3978
  if (!n()) return;
3931
3979
  P.value.clearError();
3932
- let t = await k.value.getChat(o.value, e).catch(() => null);
3980
+ let t = await E.value.getChat(o.value, e).catch(() => null);
3933
3981
  if (!t || !n() || G()) return;
3934
3982
  if (!t.turnInProgress) {
3935
3983
  P.value.messages = t.messages;
3936
3984
  return;
3937
3985
  }
3938
- await new Promise((e) => setTimeout(e, Qr));
3986
+ await new Promise((e) => setTimeout(e, $r));
3939
3987
  }
3940
3988
  } finally {
3941
- N === t && (N = void 0);
3989
+ A === t && (A = void 0, ct.value = void 0);
3942
3990
  }
3943
3991
  }
3944
- async function Et(e, t) {
3992
+ async function qt(e, t) {
3945
3993
  let n;
3946
3994
  try {
3947
- n = Number(sessionStorage.getItem(De)), sessionStorage.removeItem(De);
3995
+ n = Number(sessionStorage.getItem(ke)), sessionStorage.removeItem(ke);
3948
3996
  } catch {
3949
3997
  return;
3950
3998
  }
3951
- if (!(!n || Date.now() - n > 6e4 || D.value)) for (let n = 0; n < 12; n++) {
3999
+ if (!(!n || Date.now() - n > 6e4 || He.value)) for (let n = 0; n < 12; n++) {
3952
4000
  let n = P.value.messages[P.value.messages.length - 1];
3953
4001
  if (n?.role === "assistant") {
3954
4002
  let e = n.parts.filter((e) => oe(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
3955
4003
  if (e.length > 0) {
3956
- if (t.length === e.length && !D.value) for (let e of t) $e.enqueue({
4004
+ if (t.length === e.length && !He.value) for (let e of t) at.enqueue({
3957
4005
  toolCallId: e.toolCallId,
3958
4006
  toolName: e.toolName,
3959
4007
  input: e.input,
@@ -3965,10 +4013,10 @@ function ti(e) {
3965
4013
  }
3966
4014
  if (n.parts[n.parts.length - 1]?.type === "text") return;
3967
4015
  }
3968
- if (await new Promise((e) => setTimeout(e, 1500)), t !== E.value || P.value.status !== "ready") return;
4016
+ if (await new Promise((e) => setTimeout(e, 1500)), t !== T.value || P.value.status !== "ready") return;
3969
4017
  try {
3970
- let n = await k.value.getChat(e, t);
3971
- n && t === E.value && (P.value.messages = n.messages);
4018
+ let n = await E.value.getChat(e, t);
4019
+ n && t === T.value && (P.value.messages = n.messages);
3972
4020
  } catch {
3973
4021
  return;
3974
4022
  }
@@ -3977,50 +4025,72 @@ function ti(e) {
3977
4025
  let G = () => {
3978
4026
  let e = P.value.status;
3979
4027
  return e === "submitted" || e === "streaming";
3980
- }, Dt = 0, Ot = 0;
3981
- async function K() {
3982
- if (T.value || G()) return "indeterminate";
3983
- let e = E.value, t = Dt += 1;
4028
+ }, Jt = () => G() || A?.chatId === T.value || he.value > 0, Yt = () => {
4029
+ let e = vt();
4030
+ return D.value !== void 0 || qr(e) || ci(e);
4031
+ }, Xt = /* @__PURE__ */ new Set();
4032
+ async function Zt() {
4033
+ let e = T.value;
4034
+ if (!(Xt.has(e) || W.value.length === 0 || Jt() || Ye.value)) {
4035
+ if (Yt()) It(Ft(e));
4036
+ else {
4037
+ Xt.add(e);
4038
+ try {
4039
+ let t = Date.now() + ri;
4040
+ for (; Date.now() < t && (await Promise.race([E.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), ai))])).includes(e);) await new Promise((e) => setTimeout(e, ii));
4041
+ if (e !== T.value || Jt()) return;
4042
+ let n = Ft(e);
4043
+ n && sn(n);
4044
+ } finally {
4045
+ Xt.delete(e);
4046
+ }
4047
+ }
4048
+ }
4049
+ }
4050
+ let Qt = 0, $t = 0;
4051
+ async function en() {
4052
+ if (w.value || G()) return "indeterminate";
4053
+ let e = T.value, t = Qt += 1;
3984
4054
  try {
3985
- let n = await k.value.getChat(o.value, e);
3986
- if (!n || e !== E.value || G() || t <= Ot) return "indeterminate";
3987
- Ot = t;
3988
- let r = n.messages, i = Xr(r, P.value.messages);
3989
- return P.value.messages = [...r, ...i], Ge.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
4055
+ let n = await E.value.getChat(o.value, e);
4056
+ if (!n || e !== T.value || G() || t <= $t) return "indeterminate";
4057
+ $t = t;
4058
+ let r = n.messages, i = Zr(r, P.value.messages);
4059
+ return P.value.messages = [...r, ...i], Xe.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3990
4060
  } catch {}
3991
4061
  return "indeterminate";
3992
4062
  }
3993
- function q(e) {
4063
+ function tn(e) {
3994
4064
  P.value.messages = [...P.value.messages, e];
3995
4065
  }
3996
- async function kt(e) {
4066
+ async function K(e) {
3997
4067
  try {
3998
- R.value = await k.value.getMessageFeedbacks(e);
4068
+ R.value = await E.value.getMessageFeedbacks(e);
3999
4069
  } catch {
4000
4070
  R.value = [];
4001
4071
  }
4002
4072
  }
4003
- function At(e) {
4073
+ function nn(e) {
4004
4074
  let t = R.value.findIndex((t) => t.messageId === e.messageId);
4005
4075
  t >= 0 ? R.value[t] = e : R.value.push(e);
4006
4076
  }
4007
- function jt(e) {
4008
- let t = ct.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
4077
+ function rn(e) {
4078
+ let t = xt.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
4009
4079
  return {
4010
4080
  userQuestion: de(i ?? e) ?? "",
4011
4081
  assistantMessage: r
4012
4082
  };
4013
4083
  }
4014
- async function Mt(e, t) {
4084
+ async function an(e, t) {
4015
4085
  await Promise.all([
4016
- wt(e, t),
4017
- yt(e),
4018
- kt(t)
4019
- ]), A.value || Ee((e, t) => k.value.reverseGeocode(e, t, r.value)).then((e) => {
4020
- e && (A.value = e);
4086
+ Wt(e, t),
4087
+ zt(e),
4088
+ K(t)
4089
+ ]), et.value || Oe((e, t) => E.value.reverseGeocode(e, t, r.value)).then((e) => {
4090
+ e && (et.value = e);
4021
4091
  });
4022
4092
  }
4023
- async function Nt() {
4093
+ async function on() {
4024
4094
  let e = B.value.trim(), t = V.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
4025
4095
  type: "file",
4026
4096
  mediaType: e.mediaSource.mimeType,
@@ -4028,14 +4098,17 @@ function ti(e) {
4028
4098
  filename: e.mediaSource.name,
4029
4099
  providerMetadata: { "8bot": { media: e.mediaSource } }
4030
4100
  }));
4031
- T.value && ct.value.length > 0 && await Bt(), M(), H.value = e, U.value = P.value.messages.length;
4101
+ !w.value && Jt() ? e && t.length === 0 && (Pt(T.value, [...W.value, e]), B.value = "") : (w.value && xt.value.length > 0 && await wn(), sn(e, t), B.value = "", Cn());
4102
+ }
4103
+ function sn(e, t = []) {
4104
+ k(), H.value = e, Mt.value = P.value.messages.length;
4032
4105
  let n = P.value.sendMessage;
4033
4106
  n({
4034
4107
  text: e,
4035
4108
  files: t.length > 0 ? t : void 0
4036
- }), B.value = "", zt();
4109
+ });
4037
4110
  }
4038
- function Pt(e) {
4111
+ function cn(e) {
4039
4112
  let t = e.trim();
4040
4113
  if (!t) return;
4041
4114
  if (P.value.status !== "ready") {
@@ -4043,48 +4116,120 @@ function ti(e) {
4043
4116
  return;
4044
4117
  }
4045
4118
  let n = P.value.sendMessage;
4046
- M(), n({ text: t });
4119
+ k(), n({ text: t });
4047
4120
  }
4048
- async function Ft() {
4049
- let e = P.value.messages.slice(U.value).some((e) => e.parts.some(oe)), t = H.value, n = t.length > 0 && !e, r = E.value, i = U.value, a = N?.chatId === r;
4050
- N = void 0, M(), await P.value.stop();
4051
- let s = T.value || e && !a || await k.value.stopChatTurn(o.value, r).catch(() => !0);
4052
- r !== E.value || G() || U.value !== i || ((a || !s) && (await K(), a || P.value.messages.length > U.value) ? H.value = "" : n && (B.value = t, P.value.messages = P.value.messages.slice(0, U.value), H.value = ""));
4121
+ async function ln() {
4122
+ let e = P.value.messages.slice(Mt.value).some((e) => e.parts.some(oe)), t = H.value, n = t.length > 0 && !e, r = T.value, i = Mt.value, a = A?.chatId === r, s = lt, c = Ft(r), l = (e = "") => {
4123
+ B.value = [
4124
+ e,
4125
+ c,
4126
+ B.value
4127
+ ].filter(Boolean).join(oi);
4128
+ }, u = () => r === T.value && !G() && Mt.value === i ? !1 : (c && Pt(r, [c, ...U.value[r] ?? []]), !0);
4129
+ A = void 0, ct.value = void 0, k(), await P.value.stop();
4130
+ let d = w.value || e && !a || await E.value.stopChatTurn(o.value, r, s).catch(() => !0);
4131
+ if (!u()) {
4132
+ if (a || !d) {
4133
+ if (await en(), u()) return;
4134
+ if (a || P.value.messages.length > Mt.value) {
4135
+ H.value = "", l();
4136
+ return;
4137
+ }
4138
+ }
4139
+ n ? (l(t), P.value.messages = P.value.messages.slice(0, Mt.value), H.value = "") : l();
4140
+ }
4053
4141
  }
4054
- C(() => P.value.messages, (e) => {
4055
- let t = j.value?.toolCallId;
4056
- t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && M();
4057
- }), C(() => P.value.status, (e) => {
4058
- e === "submitted" && Ne.value++;
4142
+ S(() => P.value.messages, (e) => {
4143
+ let t = D.value?.toolCallId;
4144
+ t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && k();
4145
+ }), S(() => P.value.status, (e) => {
4146
+ e === "submitted" && (C.value++, lt = void 0);
4059
4147
  });
4060
- let It;
4061
- C(() => [P.value.status, he.value], ([e, t]) => {
4062
- clearTimeout(It), e === "ready" && t === 0 && (It = setTimeout(() => {
4063
- Me.value = !1;
4148
+ let un;
4149
+ S(() => [P.value.status, he.value], ([e, t]) => {
4150
+ clearTimeout(un), e === "ready" && t === 0 && (un = setTimeout(() => {
4151
+ Fe.value = !1;
4064
4152
  }, 1500));
4065
4153
  });
4066
- let Lt = x(!1), Rt;
4067
- C(() => !j.value && !Kr(it()) && (G() || he.value > 0), (e) => {
4068
- clearTimeout(Rt), e ? Lt.value = !0 : Rt = setTimeout(() => {
4069
- Lt.value = !1;
4154
+ let dn = x(!1), fn;
4155
+ S(() => !D.value && !qr(vt()) && (G() || he.value > 0), (e) => {
4156
+ clearTimeout(fn), e ? dn.value = !0 : fn = setTimeout(() => {
4157
+ dn.value = !1;
4070
4158
  }, 400);
4071
- }, { immediate: !0 }), C(() => P.value.status, (e) => {
4159
+ }, { immediate: !0 });
4160
+ let pn = b(() => {
4161
+ let e = ut.value.filter((e) => e !== T.value);
4162
+ return dn.value || ct.value === T.value ? [...e, T.value] : e;
4163
+ }), mn = () => [.../* @__PURE__ */ new Set([...ut.value, ...j.value])], hn = we(), q, gn = 0, _n = 0;
4164
+ function vn() {
4165
+ clearTimeout(q), q = void 0, mn().length !== 0 && hn.value === "visible" && (q = setTimeout(() => {
4166
+ q = void 0, yn(mn());
4167
+ }, ei));
4168
+ }
4169
+ async function yn(e) {
4170
+ let t = e.slice(0, ti);
4171
+ if (w.value || t.length === 0) {
4172
+ vn();
4173
+ return;
4174
+ }
4175
+ let n = gn += 1, r;
4176
+ try {
4177
+ r = await E.value.getRunningTurns(o.value, t);
4178
+ } catch {
4179
+ vn();
4180
+ return;
4181
+ }
4182
+ if (n <= _n) return;
4183
+ _n = n;
4184
+ for (let e of r) pt.add(e);
4185
+ let i = new Set(t), a = mn().filter((e) => i.has(e) && !r.includes(e)), s = (e) => j.value.includes(e) && !pt.has(e), c = a.filter((e) => s(e) && Date.now() - (ft.get(e) ?? 0) > ni), l = a.filter((e) => !s(e));
4186
+ ut.value = [...ut.value.filter((e) => !i.has(e)), ...r];
4187
+ let u = l.filter((e) => j.value.includes(e));
4188
+ (u.length > 0 || c.length > 0) && (j.value = j.value.filter((e) => !u.includes(e) && !c.includes(e)), M.value = [...M.value, ...u.filter((e) => e !== T.value && !M.value.includes(e))]), l.length > 0 && zt(o.value), vn();
4189
+ }
4190
+ S(hn, (e) => {
4191
+ e === "visible" ? yn(mn()) : (clearTimeout(q), q = void 0);
4192
+ }), _e(() => clearTimeout(q));
4193
+ let bn = b(() => M.value.map((e) => ({
4194
+ chatId: e,
4195
+ title: I.value.find((t) => t.id === e)?.title || N.value[e] || void 0
4196
+ })));
4197
+ function xn(e) {
4198
+ gt(e), T.value = e, Bn("chat");
4199
+ }
4200
+ function Sn(e) {
4201
+ M.value = M.value.filter((t) => t !== e), ht(e);
4202
+ }
4203
+ S(() => [P.value.status, P.value.id], ([e, t], [n, r]) => {
4204
+ if (t === r) {
4205
+ if (e === "error") A?.chatId !== T.value && It(Ft(T.value));
4206
+ else if (e === "ready" && (n === "streaming" || n === "submitted")) {
4207
+ if (Yt()) {
4208
+ It(Ft(T.value));
4209
+ return;
4210
+ }
4211
+ Zt();
4212
+ }
4213
+ }
4214
+ }), S(he, (e) => {
4215
+ e === 0 && P.value.status === "ready" && Zt();
4216
+ }), S(() => P.value.status, (e) => {
4072
4217
  e === "ready" && H.value.length > 0 && (H.value = "");
4073
4218
  });
4074
- function zt(e = !1) {
4219
+ function Cn(e = !1) {
4075
4220
  for (let t of V.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4076
- V.value = [], Yt.value = null;
4221
+ V.value = [], Z.value = null;
4077
4222
  }
4078
- async function Bt() {
4079
- return H.value = "", Oe.value = {}, E.value = st(), await ge(), P.value.clearError(), O.value = void 0, Ge.value = !1, zt(!0), on("chat"), E.value;
4223
+ async function wn() {
4224
+ return H.value = "", Pe.value = {}, T.value = dt(), await ge(), P.value.clearError(), Ye.value = void 0, Xe.value = !1, Cn(!0), Bn("chat"), T.value;
4080
4225
  }
4081
- async function Vt(e) {
4082
- P.value.status !== "ready" && (H.value = "", await Ft()), M(), await P.value.regenerate(e);
4226
+ async function Tn(e) {
4227
+ P.value.status !== "ready" && (H.value = "", await ln()), k(), await P.value.regenerate(e);
4083
4228
  }
4084
- function Ht(e) {
4229
+ function En(e) {
4085
4230
  if (e.tool === "requestGeolocation") {
4086
4231
  let t = e.output;
4087
- "latitude" in t && (A.value = {
4232
+ "latitude" in t && (et.value = {
4088
4233
  geolocationLatitude: t.latitude,
4089
4234
  geolocationLongitude: t.longitude,
4090
4235
  geolocationAccuracy: t.accuracy,
@@ -4093,27 +4238,27 @@ function ti(e) {
4093
4238
  }
4094
4239
  P.value.addToolOutput(e);
4095
4240
  }
4096
- function Ut(e) {
4241
+ function Dn(e) {
4097
4242
  P.value.addToolApprovalResponse(e);
4098
4243
  }
4099
- let Wt = b(() => P.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Gt = b(() => _.value?.maxFilesPerMessage ?? 5), Kt = b(() => _.value?.maxFilesPerChat ?? 20), qt = b(() => Math.max(0, Math.min(Gt.value - V.value.length, Kt.value - Wt.value - V.value.length))), Jt = b(() => qt.value <= 0), Yt = x(null), Xt = () => {
4100
- Yt.value = null;
4244
+ let On = b(() => P.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), J = b(() => _.value?.maxFilesPerMessage ?? 5), kn = b(() => _.value?.maxFilesPerChat ?? 20), Y = b(() => Math.max(0, Math.min(J.value - V.value.length, kn.value - On.value - V.value.length))), X = b(() => Y.value <= 0), Z = x(null), An = () => {
4245
+ Z.value = null;
4101
4246
  };
4102
- C(Jt, (e) => {
4103
- e || (Yt.value = null);
4247
+ S(X, (e) => {
4248
+ e || (Z.value = null);
4104
4249
  });
4105
- async function Zt(e) {
4106
- if (Jt.value) {
4107
- Yt.value = Kt.value - Wt.value - V.value.length <= Gt.value - V.value.length ? {
4250
+ async function jn(e) {
4251
+ if (X.value) {
4252
+ Z.value = kn.value - On.value - V.value.length <= J.value - V.value.length ? {
4108
4253
  reason: "per-chat",
4109
- max: Kt.value
4254
+ max: kn.value
4110
4255
  } : {
4111
4256
  reason: "per-message",
4112
- max: Gt.value
4257
+ max: J.value
4113
4258
  };
4114
4259
  return;
4115
4260
  }
4116
- let t = st(), n = {
4261
+ let t = dt(), n = {
4117
4262
  id: t,
4118
4263
  file: e,
4119
4264
  localUrl: URL.createObjectURL(e),
@@ -4121,7 +4266,7 @@ function ti(e) {
4121
4266
  };
4122
4267
  V.value = [...V.value, n];
4123
4268
  try {
4124
- let n = await k.value.uploadMedia(o.value, E.value, e);
4269
+ let n = await E.value.uploadMedia(o.value, T.value, e);
4125
4270
  V.value = V.value.map((e) => e.id === t ? {
4126
4271
  ...e,
4127
4272
  state: "done",
@@ -4136,83 +4281,83 @@ function ti(e) {
4136
4281
  } : e);
4137
4282
  }
4138
4283
  }
4139
- async function Qt(e, t) {
4140
- let { userQuestion: n, assistantMessage: r } = jt(e);
4141
- At(await k.value.submitMessageFeedback({
4284
+ async function Mn(e, t) {
4285
+ let { userQuestion: n, assistantMessage: r } = rn(e);
4286
+ nn(await E.value.submitMessageFeedback({
4142
4287
  messageId: e.id,
4143
- chatId: E.value,
4288
+ chatId: T.value,
4144
4289
  agentId: o.value,
4145
4290
  vote: t,
4146
4291
  userQuestion: n,
4147
4292
  assistantMessage: r
4148
4293
  }));
4149
4294
  }
4150
- async function J(e) {
4151
- await Qt(e, "upvote");
4295
+ async function Nn(e) {
4296
+ await Mn(e, "upvote");
4152
4297
  }
4153
- async function $t(e) {
4154
- await Qt(e, "downvote");
4298
+ async function Pn(e) {
4299
+ await Mn(e, "downvote");
4155
4300
  }
4156
- function en(e) {
4157
- ht.value = !1, z.value = void 0, pt.value = e;
4301
+ function Fn(e) {
4302
+ Ot.value = !1, kt.value = void 0, Et.value = e;
4158
4303
  }
4159
- async function tn(e) {
4160
- if (pt.value) try {
4161
- mt.value = !0, ht.value = !1, z.value = void 0;
4162
- let { userQuestion: t, assistantMessage: n } = jt(pt.value);
4163
- At(await k.value.submitMessageFeedback({
4164
- messageId: pt.value.id,
4165
- chatId: E.value,
4304
+ async function In(e) {
4305
+ if (Et.value) try {
4306
+ Dt.value = !0, Ot.value = !1, kt.value = void 0;
4307
+ let { userQuestion: t, assistantMessage: n } = rn(Et.value);
4308
+ nn(await E.value.submitMessageFeedback({
4309
+ messageId: Et.value.id,
4310
+ chatId: T.value,
4166
4311
  agentId: o.value,
4167
4312
  userQuestion: t,
4168
4313
  assistantMessage: n,
4169
4314
  comment: e
4170
- })), ht.value = !0, await kt(E.value);
4315
+ })), Ot.value = !0, await K(T.value);
4171
4316
  } catch {
4172
- z.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4317
+ kt.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4173
4318
  } finally {
4174
- mt.value = !1;
4319
+ Dt.value = !1;
4175
4320
  }
4176
4321
  }
4177
- async function nn(e) {
4322
+ async function Ln(e) {
4178
4323
  try {
4179
- _t.value = !0, gt.value = !1, vt.value = void 0, await k.value.submitLead({
4324
+ jt.value = !0, At.value = !1, z.value = void 0, await E.value.submitLead({
4180
4325
  agentId: o.value,
4181
- chatId: E.value,
4326
+ chatId: T.value,
4182
4327
  ...e
4183
- }), gt.value = !0;
4328
+ }), At.value = !0;
4184
4329
  } catch {
4185
- vt.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4330
+ z.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4186
4331
  } finally {
4187
- _t.value = !1;
4332
+ jt.value = !1;
4188
4333
  }
4189
4334
  }
4190
- async function rn(e, t) {
4191
- let n = await k.value.updateChatTitle(o.value, e, t);
4335
+ async function Rn(e, t) {
4336
+ let n = await E.value.updateChatTitle(o.value, e, t);
4192
4337
  I.value = I.value.map((t) => t.id === e ? {
4193
4338
  ...t,
4194
4339
  title: n.title
4195
4340
  } : t);
4196
4341
  }
4197
- async function an(e) {
4198
- await k.value.deleteChat(o.value, e), I.value = I.value.filter((t) => t.id !== e), E.value === e && await Bt();
4342
+ async function zn(e) {
4343
+ await E.value.deleteChat(o.value, e), I.value = I.value.filter((t) => t.id !== e), T.value === e && await wn();
4199
4344
  }
4200
- function on(e) {
4201
- ft.value = e;
4345
+ function Bn(e) {
4346
+ Tt.value = e;
4202
4347
  }
4203
- let sn;
4204
- function cn(e) {
4205
- let t = () => k.value.getChat(o.value, e).then((e) => e !== null);
4348
+ let Vn;
4349
+ function Hn(e) {
4350
+ let t = () => E.value.getChat(o.value, e).then((e) => e !== null);
4206
4351
  return t().catch(() => t().catch(() => !1));
4207
4352
  }
4208
- return C(l, async (e) => {
4209
- if (!e || e === sn) return;
4210
- let t = sn;
4211
- if (sn = e, t === void 0) return;
4212
- let n = E.value, r = !T.value && await cn(n);
4213
- l.value === e && E.value === n && (r ? yt(o.value) : (I.value = [], R.value = [], L.value = [], await Bt(), B.value = ""));
4353
+ return S(l, async (e) => {
4354
+ if (!e || e === Vn) return;
4355
+ let t = Vn;
4356
+ if (Vn = e, t === void 0) return;
4357
+ let n = T.value, r = !w.value && await Hn(n);
4358
+ l.value === e && T.value === n && (r ? zt(o.value) : (I.value = [], R.value = [], L.value = [], ut.value = [], j.value = [], M.value = [], N.value = {}, await wn(), B.value = ""));
4214
4359
  }), {
4215
- apiClient: k,
4360
+ apiClient: E,
4216
4361
  baseUrl: i,
4217
4362
  basePath: a,
4218
4363
  agentId: o,
@@ -4226,7 +4371,7 @@ function ti(e) {
4226
4371
  revisedAnswers: m,
4227
4372
  model: h,
4228
4373
  actionsInput: g,
4229
- actions: Le,
4374
+ actions: Be,
4230
4375
  agentFileUpload: _,
4231
4376
  agentVoice: v,
4232
4377
  fallbackModels: te,
@@ -4235,78 +4380,86 @@ function ti(e) {
4235
4380
  agentHostTools: se,
4236
4381
  hostToolRegistry: me,
4237
4382
  hostToolsPending: he,
4238
- agentPageAccess: _e,
4239
- pageToolRegistry: ye,
4240
- pageFormsProvider: be,
4241
- pageAction: we,
4242
- hostStepTitles: Oe,
4243
- pageControlActive: Me,
4244
- isWorking: Lt,
4245
- stopHostActions: et,
4246
- pageNoticeLevel: Ue,
4247
- closePageNotice: We,
4248
- hostConfirmation: j,
4249
- respondHostConfirmation: Qe,
4250
- pageAccessAvailable: Ve,
4251
- pageAccessOff: D,
4252
- setPageAccessOff: tt,
4253
- systemTheme: w,
4254
- hideWelcomeMessage: Pe,
4255
- isDark: Ie,
4383
+ agentPageAccess: be,
4384
+ pageToolRegistry: xe,
4385
+ pageFormsProvider: Ee,
4386
+ pageAction: Ae,
4387
+ hostStepTitles: Pe,
4388
+ pageControlActive: Fe,
4389
+ isWorking: dn,
4390
+ stopHostActions: O,
4391
+ pageNoticeLevel: qe,
4392
+ closePageNotice: Je,
4393
+ hostConfirmation: D,
4394
+ respondHostConfirmation: it,
4395
+ pageAccessAvailable: Ge,
4396
+ pageAccessOff: He,
4397
+ setPageAccessOff: ot,
4398
+ systemTheme: Ie,
4399
+ hideWelcomeMessage: Le,
4400
+ isDark: ze,
4256
4401
  chat: P,
4257
- messages: ct,
4402
+ messages: xt,
4258
4403
  conversations: I,
4259
- isLoadingConversations: ut,
4404
+ isLoadingConversations: Ct,
4260
4405
  chatFiles: L,
4261
- isLoadingChatFiles: dt,
4406
+ isLoadingChatFiles: wt,
4262
4407
  input: B,
4263
4408
  pendingAttachments: V,
4264
- isAttachmentLimitReached: Jt,
4265
- fileLimitError: Yt,
4266
- localChatId: E,
4267
- isConversationBlocked: Ge,
4268
- inputMessagePlaceholder: lt,
4269
- chatError: O,
4270
- activeView: ft,
4409
+ isAttachmentLimitReached: X,
4410
+ fileLimitError: Z,
4411
+ localChatId: T,
4412
+ isConversationBlocked: Xe,
4413
+ inputMessagePlaceholder: St,
4414
+ chatError: Ye,
4415
+ runningChatIds: pn,
4416
+ backgroundAnswers: bn,
4417
+ openBackgroundAnswer: xn,
4418
+ dismissBackgroundAnswer: Sn,
4419
+ canQueue: Nt,
4420
+ queuedMessages: W,
4421
+ removeQueuedMessage: Lt,
4422
+ editQueuedMessage: Rt,
4423
+ activeView: Tt,
4271
4424
  messageFeedbacks: R,
4272
- feedbackDialogMessage: pt,
4273
- isFeedbackSubmitting: mt,
4274
- isFeedbackSubmitted: ht,
4275
- feedbackSubmitError: z,
4276
- isLeadSubmitted: gt,
4277
- isLoadingSubmitLead: _t,
4278
- submitLeadError: vt,
4279
- buildDeviceContext: Ye,
4280
- initialize: Mt,
4281
- loadConversations: yt,
4282
- loadChatFiles: bt,
4283
- refreshMessages: K,
4284
- appendMessage: q,
4285
- getChatFileUrl: xt,
4286
- getChatFilePreviewUrl: St,
4287
- deleteChatFile: Ct,
4288
- handleSubmit: Nt,
4289
- sendMessage: Pt,
4290
- stopGeneration: Ft,
4291
- startNewChat: Bt,
4292
- regenerate: Vt,
4293
- addToolOutput: Ht,
4294
- addToolApprovalResponse: Ut,
4295
- handleFileSelect: Zt,
4296
- clearFileLimitError: Xt,
4297
- clearPendingAttachments: zt,
4298
- onUpvote: J,
4299
- onDownvote: $t,
4300
- onFeedback: en,
4301
- onFeedbackSubmit: tn,
4302
- onLeadSubmit: nn,
4303
- navigate: on,
4304
- renameChatTitle: rn,
4305
- deleteChat: an
4425
+ feedbackDialogMessage: Et,
4426
+ isFeedbackSubmitting: Dt,
4427
+ isFeedbackSubmitted: Ot,
4428
+ feedbackSubmitError: kt,
4429
+ isLeadSubmitted: At,
4430
+ isLoadingSubmitLead: jt,
4431
+ submitLeadError: z,
4432
+ buildDeviceContext: tt,
4433
+ initialize: an,
4434
+ loadConversations: zt,
4435
+ loadChatFiles: Bt,
4436
+ refreshMessages: en,
4437
+ appendMessage: tn,
4438
+ getChatFileUrl: Vt,
4439
+ getChatFilePreviewUrl: Ht,
4440
+ deleteChatFile: Ut,
4441
+ handleSubmit: on,
4442
+ sendMessage: cn,
4443
+ stopGeneration: ln,
4444
+ startNewChat: wn,
4445
+ regenerate: Tn,
4446
+ addToolOutput: En,
4447
+ addToolApprovalResponse: Dn,
4448
+ handleFileSelect: jn,
4449
+ clearFileLimitError: An,
4450
+ clearPendingAttachments: Cn,
4451
+ onUpvote: Nn,
4452
+ onDownvote: Pn,
4453
+ onFeedback: Fn,
4454
+ onFeedbackSubmit: In,
4455
+ onLeadSubmit: Ln,
4456
+ navigate: Bn,
4457
+ renameChatTitle: Rn,
4458
+ deleteChat: zn
4306
4459
  };
4307
4460
  })();
4308
4461
  }
4309
4462
  //#endregion
4310
- export { st as a, mr as i, ti as n, Wr as r, Gr as t };
4463
+ export { dt as a, hr as i, ui as n, Gr as r, Kr as t };
4311
4464
 
4312
- //# sourceMappingURL=useChatbotStore-D7LcpA-6.js.map
4465
+ //# sourceMappingURL=useChatbotStore-Ct7G-voO.js.map