@8wave/ai-elements 0.121.0-beta.35 → 0.121.0-beta.36

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 (123) hide show
  1. package/dist/_chunks/{Agent-BPIcUM9P.js → Agent-C3m0UmlL.js} +21 -3
  2. package/dist/_chunks/Agent-C3m0UmlL.js.map +1 -0
  3. package/dist/_chunks/{PkStreamingMarkdown-C8_9bk_Y.js → PkStreamingMarkdown--PCkA4Fg.js} +3 -3
  4. package/dist/_chunks/{PkStreamingMarkdown-C8_9bk_Y.js.map → PkStreamingMarkdown--PCkA4Fg.js.map} +1 -1
  5. package/dist/_chunks/{PkToolEditSpreadsheet-DM5BCKd2.js → PkToolEditSpreadsheet-DAMWWIVt.js} +2 -2
  6. package/dist/_chunks/{PkToolEditSpreadsheet-DM5BCKd2.js.map → PkToolEditSpreadsheet-DAMWWIVt.js.map} +1 -1
  7. package/dist/_chunks/{PkToolRequestGeolocation-DnZFIG1Q.js → PkToolRequestGeolocation-BgsvQb7Q.js} +2 -2
  8. package/dist/_chunks/{PkToolRequestGeolocation-DnZFIG1Q.js.map → PkToolRequestGeolocation-BgsvQb7Q.js.map} +1 -1
  9. package/dist/_chunks/{PkToolRequestOAuthConnection-9LX5kQ43.js → PkToolRequestOAuthConnection-DtuZw7yk.js} +2 -2
  10. package/dist/_chunks/{PkToolRequestOAuthConnection-9LX5kQ43.js.map → PkToolRequestOAuthConnection-DtuZw7yk.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowArtifact-2ovT7cCd.js → PkToolShowArtifact-B163OvqY.js} +2 -2
  12. package/dist/_chunks/{PkToolShowArtifact-2ovT7cCd.js.map → PkToolShowArtifact-B163OvqY.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowContactForm-Bkoa-XYM.js → PkToolShowContactForm-C_ptr7Xs.js} +2 -2
  14. package/dist/_chunks/{PkToolShowContactForm-Bkoa-XYM.js.map → PkToolShowContactForm-C_ptr7Xs.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowForm-CvAgDlx8.js → PkToolShowForm-fburTpQm.js} +3 -3
  16. package/dist/_chunks/{PkToolShowForm-CvAgDlx8.js.map → PkToolShowForm-fburTpQm.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowImageGallery-CjA-r8o5.js → PkToolShowImageGallery-ChauJukk.js} +2 -2
  18. package/dist/_chunks/{PkToolShowImageGallery-CjA-r8o5.js.map → PkToolShowImageGallery-ChauJukk.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowProductList-DGPs57sX.js → PkToolShowProductList-B_XZezYw.js} +2 -2
  20. package/dist/_chunks/{PkToolShowProductList-DGPs57sX.js.map → PkToolShowProductList-B_XZezYw.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowSources-BVuYkrXs.js → PkToolShowSources-CS4nEuL0.js} +3 -3
  22. package/dist/_chunks/{PkToolShowSources-BVuYkrXs.js.map → PkToolShowSources-CS4nEuL0.js.map} +1 -1
  23. package/dist/_chunks/{PkToolShowSuggestedReply-B869o1YP.js → PkToolShowSuggestedReply-BIe56XdA.js} +2 -2
  24. package/dist/_chunks/{PkToolShowSuggestedReply-B869o1YP.js.map → PkToolShowSuggestedReply-BIe56XdA.js.map} +1 -1
  25. package/dist/_chunks/{PkToolShowVideo-DayRkHzW.js → PkToolShowVideo-DzU1XJqv.js} +2 -2
  26. package/dist/_chunks/{PkToolShowVideo-DayRkHzW.js.map → PkToolShowVideo-DzU1XJqv.js.map} +1 -1
  27. package/dist/_chunks/{PkToolShowWebPages-DTwnqmP-.js → PkToolShowWebPages-BlKe8Arf.js} +2 -2
  28. package/dist/_chunks/{PkToolShowWebPages-DTwnqmP-.js.map → PkToolShowWebPages-BlKe8Arf.js.map} +1 -1
  29. package/dist/_chunks/{chatImagePolicy-IKP98mdB.js → chatImagePolicy-ChSkpiw6.js} +2 -2
  30. package/dist/_chunks/{chatImagePolicy-IKP98mdB.js.map → chatImagePolicy-ChSkpiw6.js.map} +1 -1
  31. package/dist/_chunks/{markdown-D7lXKAr4.js → markdown-D3iMlF6T.js} +2 -2
  32. package/dist/_chunks/{markdown-D7lXKAr4.js.map → markdown-D3iMlF6T.js.map} +1 -1
  33. package/dist/ai-elements.es.js +76 -34
  34. package/dist/ai-elements.es.js.map +1 -1
  35. package/dist-vue/PkChatbot.js +1 -1
  36. package/dist-vue/PkChatbotEmptyState.js +1 -1
  37. package/dist-vue/PkChatbotInput.js +1 -1
  38. package/dist-vue/PkChatbotMessages.js +1 -1
  39. package/dist-vue/PkChatbotStepPayload.js +1 -1
  40. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  41. package/dist-vue/PkChatbotSteps.js +1 -1
  42. package/dist-vue/PkChatbotViewChat.js +1 -1
  43. package/dist-vue/PkChatbotViewConversations.js +1 -1
  44. package/dist-vue/PkChatbotViewFiles.js +1 -1
  45. package/dist-vue/PkChatbotViewProfile.js +1 -1
  46. package/dist-vue/_chunks/{Agent-D70vAgX4.js → Agent-3IHYHv05.js} +153 -137
  47. package/dist-vue/_chunks/Agent-3IHYHv05.js.map +1 -0
  48. package/dist-vue/_chunks/{Document-Bo4xInDb.js → Document-B0A_y6N5.js} +10 -10
  49. package/dist-vue/_chunks/{Document-Bo4xInDb.js.map → Document-B0A_y6N5.js.map} +1 -1
  50. package/dist-vue/_chunks/{PkChatbot-65tNfhpY.js → PkChatbot-Bu76hH4F.js} +8 -8
  51. package/dist-vue/_chunks/{PkChatbot-65tNfhpY.js.map → PkChatbot-Bu76hH4F.js.map} +1 -1
  52. package/dist-vue/_chunks/{PkChatbotEmptyState-CcRoSIb7.js → PkChatbotEmptyState-ilPJoYjk.js} +2 -2
  53. package/dist-vue/_chunks/{PkChatbotEmptyState-CcRoSIb7.js.map → PkChatbotEmptyState-ilPJoYjk.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkChatbotInput-BeXWvNLw.js → PkChatbotInput-CY0YRGkG.js} +2 -2
  55. package/dist-vue/_chunks/{PkChatbotInput-BeXWvNLw.js.map → PkChatbotInput-CY0YRGkG.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkChatbotMessages-BGOyBww5.js → PkChatbotMessages-BfKqJ8n_.js} +20 -20
  57. package/dist-vue/_chunks/{PkChatbotMessages-BGOyBww5.js.map → PkChatbotMessages-BfKqJ8n_.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkChatbotStepPayload-DsqiKy3M.js → PkChatbotStepPayload-CiEcIlzW.js} +2 -2
  59. package/dist-vue/_chunks/{PkChatbotStepPayload-DsqiKy3M.js.map → PkChatbotStepPayload-CiEcIlzW.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkChatbotStepToolDetail-Bg4IBzGh.js → PkChatbotStepToolDetail-VqLkuWi7.js} +3 -3
  61. package/dist-vue/_chunks/{PkChatbotStepToolDetail-Bg4IBzGh.js.map → PkChatbotStepToolDetail-VqLkuWi7.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkChatbotSteps-DfeBzC1S.js → PkChatbotSteps-CoDtEaL7.js} +5 -5
  63. package/dist-vue/_chunks/{PkChatbotSteps-DfeBzC1S.js.map → PkChatbotSteps-CoDtEaL7.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkChatbotViewChat-Cj3MKRFE.js → PkChatbotViewChat-t-XkwFbe.js} +7 -7
  65. package/dist-vue/_chunks/{PkChatbotViewChat-Cj3MKRFE.js.map → PkChatbotViewChat-t-XkwFbe.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkChatbotViewConversations-GqapFcx3.js → PkChatbotViewConversations-CgRMohUQ.js} +3 -3
  67. package/dist-vue/_chunks/{PkChatbotViewConversations-GqapFcx3.js.map → PkChatbotViewConversations-CgRMohUQ.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkChatbotViewFiles-B-P6z7eN.js → PkChatbotViewFiles-DkeysDGW.js} +3 -3
  69. package/dist-vue/_chunks/{PkChatbotViewFiles-B-P6z7eN.js.map → PkChatbotViewFiles-DkeysDGW.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkChatbotViewProfile-Bbu10IMd.js → PkChatbotViewProfile-kgqu10ED.js} +2 -2
  71. package/dist-vue/_chunks/{PkChatbotViewProfile-Bbu10IMd.js.map → PkChatbotViewProfile-kgqu10ED.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkStreamingMarkdown-BFrymqYD.js → PkStreamingMarkdown-CDlpb5w0.js} +3 -3
  73. package/dist-vue/_chunks/{PkStreamingMarkdown-BFrymqYD.js.map → PkStreamingMarkdown-CDlpb5w0.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolEditSpreadsheet-CfNQMSWR.js → PkToolEditSpreadsheet-D0EPgCmp.js} +2 -2
  75. package/dist-vue/_chunks/{PkToolEditSpreadsheet-CfNQMSWR.js.map → PkToolEditSpreadsheet-D0EPgCmp.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolRequestGeolocation-DvO0z7sQ.js → PkToolRequestGeolocation-DZnJd1od.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolRequestGeolocation-DvO0z7sQ.js.map → PkToolRequestGeolocation-DZnJd1od.js.map} +1 -1
  78. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-CTqtzwJm.js → PkToolRequestOAuthConnection-C8MGtBlh.js} +2 -2
  79. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-CTqtzwJm.js.map → PkToolRequestOAuthConnection-C8MGtBlh.js.map} +1 -1
  80. package/dist-vue/_chunks/{PkToolShowArtifact-BKZKi6J4.js → PkToolShowArtifact-CtXB1-vJ.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolShowArtifact-BKZKi6J4.js.map → PkToolShowArtifact-CtXB1-vJ.js.map} +1 -1
  82. package/dist-vue/_chunks/{PkToolShowContactForm-CWpQaNOh.js → PkToolShowContactForm-DlZdfcNw.js} +2 -2
  83. package/dist-vue/_chunks/{PkToolShowContactForm-CWpQaNOh.js.map → PkToolShowContactForm-DlZdfcNw.js.map} +1 -1
  84. package/dist-vue/_chunks/{PkToolShowDiagram-DElkZZVV.js → PkToolShowDiagram-BUUjmUpE.js} +2 -2
  85. package/dist-vue/_chunks/{PkToolShowDiagram-DElkZZVV.js.map → PkToolShowDiagram-BUUjmUpE.js.map} +1 -1
  86. package/dist-vue/_chunks/{PkToolShowForm-BnM1fsi4.js → PkToolShowForm-DxiiMSCC.js} +4 -4
  87. package/dist-vue/_chunks/{PkToolShowForm-BnM1fsi4.js.map → PkToolShowForm-DxiiMSCC.js.map} +1 -1
  88. package/dist-vue/_chunks/{PkToolShowImageGallery-CzcPqcoS.js → PkToolShowImageGallery-D01aM-9U.js} +2 -2
  89. package/dist-vue/_chunks/{PkToolShowImageGallery-CzcPqcoS.js.map → PkToolShowImageGallery-D01aM-9U.js.map} +1 -1
  90. package/dist-vue/_chunks/{PkToolShowProductList-Cpf5SLLk.js → PkToolShowProductList-BRMF3WJf.js} +2 -2
  91. package/dist-vue/_chunks/{PkToolShowProductList-Cpf5SLLk.js.map → PkToolShowProductList-BRMF3WJf.js.map} +1 -1
  92. package/dist-vue/_chunks/{PkToolShowSources-E7BcGvof.js → PkToolShowSources-C0_MwX7m.js} +3 -3
  93. package/dist-vue/_chunks/{PkToolShowSources-E7BcGvof.js.map → PkToolShowSources-C0_MwX7m.js.map} +1 -1
  94. package/dist-vue/_chunks/{PkToolShowSuggestedReply-JTMiOpHZ.js → PkToolShowSuggestedReply-BcjKYwbk.js} +2 -2
  95. package/dist-vue/_chunks/{PkToolShowSuggestedReply-JTMiOpHZ.js.map → PkToolShowSuggestedReply-BcjKYwbk.js.map} +1 -1
  96. package/dist-vue/_chunks/{PkToolShowVideo-DFdmzUkS.js → PkToolShowVideo-CjjoQH7j.js} +2 -2
  97. package/dist-vue/_chunks/{PkToolShowVideo-DFdmzUkS.js.map → PkToolShowVideo-CjjoQH7j.js.map} +1 -1
  98. package/dist-vue/_chunks/{PkToolShowWebPages-CG_Mq77j.js → PkToolShowWebPages-B5reGh4g.js} +2 -2
  99. package/dist-vue/_chunks/{PkToolShowWebPages-CG_Mq77j.js.map → PkToolShowWebPages-B5reGh4g.js.map} +1 -1
  100. package/dist-vue/_chunks/{createChatbotApiClient-BTrOwIYi.js → createChatbotApiClient-DcLpptlt.js} +18 -18
  101. package/dist-vue/_chunks/{createChatbotApiClient-BTrOwIYi.js.map → createChatbotApiClient-DcLpptlt.js.map} +1 -1
  102. package/dist-vue/_chunks/{useChatbotStore-KjeThRAo.js → useChatbotStore-BliRphuB.js} +1012 -1012
  103. package/dist-vue/_chunks/{useChatbotStore-KjeThRAo.js.map → useChatbotStore-BliRphuB.js.map} +1 -1
  104. package/dist-vue/_chunks/{utils-Bf29zWlC.js → utils-C7-KrzRE.js} +7 -7
  105. package/dist-vue/_chunks/{utils-Bf29zWlC.js.map → utils-C7-KrzRE.js.map} +1 -1
  106. package/dist-vue/api.js +1 -1
  107. package/dist-vue/composables.js +64 -22
  108. package/dist-vue/composables.js.map +1 -1
  109. package/dist-vue/index.js +5293 -5288
  110. package/dist-vue/index.js.map +1 -1
  111. package/dist-vue/locales.js +4 -12
  112. package/dist-vue/packages/components/src/agentGlyphs.d.ts +5 -4
  113. package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +10 -2
  114. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +1 -1
  115. package/dist-vue/packages/models/src/schema/Agent.d.ts +58 -6
  116. package/dist-vue/packages/models/src/schema/Chat.d.ts +1 -1
  117. package/dist-vue/packages/models/src/schema/Invitation.d.ts +1 -1
  118. package/dist-vue/packages/models/src/schema/Lead.d.ts +5 -5
  119. package/dist-vue/packages/models/src/schema/Member.d.ts +4 -1
  120. package/dist-vue/packages/models/src/schema/SignInSecurity.d.ts +1 -1
  121. package/package.json +1 -1
  122. package/dist/_chunks/Agent-BPIcUM9P.js.map +0 -1
  123. package/dist-vue/_chunks/Agent-D70vAgX4.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
- import { F as y, G as b, J as ee, K as te, U as ne, V as re, q as ie, z as ae } from "./Agent-D70vAgX4.js";
3
- import { r as oe, t as se } from "./createChatbotApiClient-BTrOwIYi.js";
4
- import { n as ce } from "./src-BZRiAJsH.js";
5
- import { d as le, r as ue } from "./message-DZvfzt9j.js";
6
- import { n as de, t as fe } from "./useSafeLocalStorage-C1BlCeKw.js";
7
- import { computed as x, getCurrentScope as pe, isReadonly as me, nextTick as he, onScopeDispose as ge, reactive as _e, ref as S, shallowRef as C, toRefs as ve, toValue as ye, watch as w, watchEffect as be } from "vue";
8
- import { useI18n as xe } from "vue-i18n";
9
- import { usePreferredDark as Se } from "@vueuse/core";
10
- import { defineStore as Ce } from "pinia";
2
+ import { G as ee, J as y, L as te, U as ne, V as re, X as ie, Y as ae, q as oe } from "./Agent-3IHYHv05.js";
3
+ import { r as se, t as ce } from "./createChatbotApiClient-DcLpptlt.js";
4
+ import { n as le } from "./src-BZRiAJsH.js";
5
+ import { d as ue, r as de } from "./message-DZvfzt9j.js";
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";
11
11
  //#region ../../packages/utils/src/device-context.ts
12
- function we() {
12
+ function Te() {
13
13
  let e = navigator.connection, t = navigator.userAgentData;
14
14
  return {
15
15
  dateTime: (/* @__PURE__ */ new Date()).toISOString(),
@@ -39,7 +39,7 @@ function we() {
39
39
  historyLength: window.history.length
40
40
  };
41
41
  }
42
- async function Te(e) {
42
+ async function Ee(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,12 +58,12 @@ async function Te(e) {
58
58
  }
59
59
  //#endregion
60
60
  //#region ../../packages/composable/src/chatbot/hostTools.ts
61
- var Ee = "agentstudio:page-navigation", De = (e) => typeof e?.afterOutput == "function", Oe = (e) => e.toolMetadata?.source === te, ke = (e, t) => {
61
+ var De = "agentstudio:page-navigation", Oe = (e) => typeof e?.afterOutput == "function", ke = (e) => e.toolMetadata?.source === y, Ae = (e, t) => {
62
62
  if (!t || !e?.length) return;
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);
63
+ let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !ne(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
64
64
  return r.length > 0 ? r : void 0;
65
65
  };
66
- function Ae(e) {
66
+ function je(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 = (e, t) => t.requireConfirmation.includes(e.name) || t.confirmDestructive && e.annotations?.destructiveHint === !0, s = (t, n) => e.addToolOutput({
@@ -79,7 +79,7 @@ function Ae(e) {
79
79
  async function l(n, r) {
80
80
  let i = () => r === t, l = e.capability(), u = e.registry()?.find((e) => e.name === n.toolName), d = u?.policy?.timeoutMs ?? l?.timeoutMs;
81
81
  if (!u || d === void 0) {
82
- c(n, ie(n.readOnly));
82
+ c(n, ae(n.readOnly));
83
83
  return;
84
84
  }
85
85
  let f;
@@ -94,7 +94,7 @@ function Ae(e) {
94
94
  let t = await e.confirm(n, f);
95
95
  if (!i()) return;
96
96
  if (!t) {
97
- c(n, b);
97
+ c(n, oe);
98
98
  return;
99
99
  }
100
100
  }
@@ -110,13 +110,13 @@ function Ae(e) {
110
110
  messageId: n.messageId
111
111
  }), t]);
112
112
  if (!i()) return;
113
- De(r) ? (s(n, r.result ?? null), e.waitForResume().then((e) => {
113
+ Oe(r) ? (s(n, r.result ?? null), e.waitForResume().then((e) => {
114
114
  e && i() && r.afterOutput();
115
115
  })) : s(n, r ?? null);
116
116
  } catch (e) {
117
117
  if (!i()) return;
118
118
  let t = m.signal.aborted;
119
- c(n, t ? ie(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
119
+ c(n, t ? ae(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
120
120
  } finally {
121
121
  clearTimeout(h), a.delete(n.toolCallId), e.onActivity?.(void 0);
122
122
  }
@@ -137,65 +137,65 @@ function Ae(e) {
137
137
  }
138
138
  //#endregion
139
139
  //#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.27/node_modules/@ai-sdk/provider/dist/index.js
140
- var je = "vercel.ai.error", Me = Symbol.for(je), T = class e extends Error {
140
+ var Me = "vercel.ai.error", Ne = Symbol.for(Me), w = class e extends Error {
141
141
  constructor({ name: e, message: t, cause: n }) {
142
- super(t), this[Me] = !0, this.name = e, this.cause = n;
142
+ super(t), this[Ne] = !0, this.name = e, this.cause = n;
143
143
  }
144
144
  static isInstance(t) {
145
- return e.hasMarker(t, je);
145
+ return e.hasMarker(t, Me);
146
146
  }
147
147
  static hasMarker(e, t) {
148
148
  let n = Symbol.for(t);
149
149
  return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
150
150
  }
151
- }, Ne = "AI_APICallError", E = `vercel.ai.error.${Ne}`, Pe = Symbol.for(E), Fe = class extends T {
151
+ }, Pe = "AI_APICallError", T = `vercel.ai.error.${Pe}`, Fe = Symbol.for(T), Ie = class extends w {
152
152
  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 }) {
153
153
  super({
154
- name: Ne,
154
+ name: Pe,
155
155
  message: e,
156
156
  cause: o
157
- }), this[Pe] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
157
+ }), this[Fe] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
158
158
  }
159
159
  static isInstance(e) {
160
- return T.hasMarker(e, E);
160
+ return w.hasMarker(e, T);
161
161
  }
162
- }, D = "AI_EmptyResponseBodyError", O = `vercel.ai.error.${D}`, Ie = Symbol.for(O), Le = class extends T {
162
+ }, E = "AI_EmptyResponseBodyError", D = `vercel.ai.error.${E}`, Le = Symbol.for(D), Re = class extends w {
163
163
  constructor({ message: e = "Empty response body" } = {}) {
164
164
  super({
165
- name: D,
165
+ name: E,
166
166
  message: e
167
- }), this[Ie] = !0;
167
+ }), this[Le] = !0;
168
168
  }
169
169
  static isInstance(e) {
170
- return T.hasMarker(e, O);
170
+ return w.hasMarker(e, D);
171
171
  }
172
172
  };
173
- function Re(e) {
173
+ function ze(e) {
174
174
  return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
175
175
  }
176
- var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.for(Be), He = class extends T {
176
+ var Be = "AI_InvalidArgumentError", Ve = `vercel.ai.error.${Be}`, He = Symbol.for(Ve), Ue = class extends w {
177
177
  constructor({ message: e, cause: t, argument: n }) {
178
178
  super({
179
- name: ze,
179
+ name: Be,
180
180
  message: e,
181
181
  cause: t
182
- }), this[Ve] = !0, this.argument = n;
182
+ }), this[He] = !0, this.argument = n;
183
183
  }
184
184
  static isInstance(e) {
185
- return T.hasMarker(e, Be);
185
+ return w.hasMarker(e, Ve);
186
186
  }
187
- }, Ue = "AI_JSONParseError", We = `vercel.ai.error.${Ue}`, Ge = Symbol.for(We), Ke = class extends T {
187
+ }, We = "AI_JSONParseError", Ge = `vercel.ai.error.${We}`, Ke = Symbol.for(Ge), qe = class extends w {
188
188
  constructor({ text: e, cause: t }) {
189
189
  super({
190
- name: Ue,
191
- message: `JSON parsing failed: Text: ${e}.\nError message: ${Re(t)}`,
190
+ name: We,
191
+ message: `JSON parsing failed: Text: ${e}.\nError message: ${ze(t)}`,
192
192
  cause: t
193
- }), this[Ge] = !0, this.text = e;
193
+ }), this[Ke] = !0, this.text = e;
194
194
  }
195
195
  static isInstance(e) {
196
- return T.hasMarker(e, We);
196
+ return w.hasMarker(e, Ge);
197
197
  }
198
- }, k = "AI_TypeValidationError", qe = `vercel.ai.error.${k}`, Je = Symbol.for(qe), Ye = class e extends T {
198
+ }, O = "AI_TypeValidationError", Je = `vercel.ai.error.${O}`, Ye = Symbol.for(Je), Xe = class e extends w {
199
199
  constructor({ value: e, cause: t, context: n }) {
200
200
  let r = "Type validation failed";
201
201
  if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
@@ -204,13 +204,13 @@ var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.fo
204
204
  n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
205
205
  }
206
206
  super({
207
- name: k,
208
- message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${Re(t)}`,
207
+ name: O,
208
+ message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${ze(t)}`,
209
209
  cause: t
210
- }), this[Je] = !0, this.value = e, this.context = n;
210
+ }), this[Ye] = !0, this.value = e, this.context = n;
211
211
  }
212
212
  static isInstance(e) {
213
- return T.hasMarker(e, qe);
213
+ return w.hasMarker(e, Je);
214
214
  }
215
215
  static wrap({ value: t, cause: n, context: r }) {
216
216
  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({
@@ -219,25 +219,25 @@ var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.fo
219
219
  context: r
220
220
  });
221
221
  }
222
- }, A = "AI_UnsupportedFunctionalityError", Xe = `vercel.ai.error.${A}`, Ze = Symbol.for(Xe), Qe = class extends T {
222
+ }, k = "AI_UnsupportedFunctionalityError", Ze = `vercel.ai.error.${k}`, Qe = Symbol.for(Ze), $e = class extends w {
223
223
  constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
224
224
  super({
225
- name: A,
225
+ name: k,
226
226
  message: t
227
- }), this[Ze] = !0, this.functionality = e;
227
+ }), this[Qe] = !0, this.functionality = e;
228
228
  }
229
229
  static isInstance(e) {
230
- return T.hasMarker(e, Xe);
230
+ return w.hasMarker(e, Ze);
231
231
  }
232
- }, $e = class extends Error {
232
+ }, et = class extends Error {
233
233
  constructor(e, t) {
234
234
  super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
235
235
  }
236
- }, j = 10, et = 13, M = 32;
237
- function N(e) {}
238
- function tt(e) {
236
+ }, A = 10, tt = 13, j = 32;
237
+ function M(e) {}
238
+ function nt(e) {
239
239
  if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
240
- let { onEvent: t = N, onError: n = N, onRetry: r = N, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
240
+ let { onEvent: t = M, onError: n = M, onRetry: r = M, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
241
241
  function m(e) {
242
242
  if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
243
243
  if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
@@ -256,7 +256,7 @@ function tt(e) {
256
256
  n !== "" && (o.push(n), s = n.length), h();
257
257
  }
258
258
  function h() {
259
- 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 $e(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
259
+ 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 et(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
260
260
  }
261
261
  function g(e) {
262
262
  let n = 0;
@@ -272,9 +272,9 @@ function tt(e) {
272
272
  continue;
273
273
  }
274
274
  let i = e.charCodeAt(n);
275
- if (P(e, n, i)) {
276
- let i = e.charCodeAt(n + 5) === M ? n + 6 : n + 5, a = e.slice(i, r);
277
- if (d === 0 && e.charCodeAt(r + 1) === j) {
275
+ if (N(e, n, i)) {
276
+ let i = e.charCodeAt(n + 5) === j ? n + 6 : n + 5, a = e.slice(i, r);
277
+ if (d === 0 && e.charCodeAt(r + 1) === A) {
278
278
  t({
279
279
  id: l,
280
280
  event: f,
@@ -284,7 +284,7 @@ function tt(e) {
284
284
  }
285
285
  u = d === 0 ? a : `${u}
286
286
  ${a}`, d++;
287
- } else nt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === M ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
287
+ } else rt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === j ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
288
288
  n = r + 1, r = e.indexOf("\n", n);
289
289
  }
290
290
  return e.slice(n);
@@ -292,35 +292,35 @@ ${a}`, d++;
292
292
  for (; n < e.length;) {
293
293
  let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
294
294
  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;
295
- _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === et && e.charCodeAt(n) === j && n++;
295
+ _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === tt && e.charCodeAt(n) === A && n++;
296
296
  }
297
297
  return e.slice(n);
298
298
  }
299
299
  function _(e, t, n) {
300
300
  if (t === n) {
301
- y();
301
+ ee();
302
302
  return;
303
303
  }
304
304
  let r = e.charCodeAt(t);
305
- if (P(e, t, r)) {
306
- let r = e.charCodeAt(t + 5) === M ? t + 6 : t + 5, i = e.slice(r, n);
305
+ if (N(e, t, r)) {
306
+ let r = e.charCodeAt(t + 5) === j ? t + 6 : t + 5, i = e.slice(r, n);
307
307
  u = d === 0 ? i : `${u}
308
308
  ${i}`, d++;
309
309
  return;
310
310
  }
311
- if (nt(e, t, r)) {
312
- f = e.slice(e.charCodeAt(t + 6) === M ? t + 7 : t + 6, n) || void 0;
311
+ if (rt(e, t, r)) {
312
+ f = e.slice(e.charCodeAt(t + 6) === j ? t + 7 : t + 6, n) || void 0;
313
313
  return;
314
314
  }
315
315
  if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
316
- let r = e.slice(e.charCodeAt(t + 3) === M ? t + 4 : t + 3, n);
316
+ let r = e.slice(e.charCodeAt(t + 3) === j ? t + 4 : t + 3, n);
317
317
  l = r.includes("\0") ? void 0 : r;
318
318
  return;
319
319
  }
320
320
  if (r === 58) {
321
321
  if (i) {
322
322
  let r = e.slice(t, n);
323
- i(r.slice(e.charCodeAt(t + 1) === M ? 2 : 1));
323
+ i(r.slice(e.charCodeAt(t + 1) === j ? 2 : 1));
324
324
  }
325
325
  return;
326
326
  }
@@ -329,7 +329,7 @@ ${i}`, d++;
329
329
  v(a, "", a);
330
330
  return;
331
331
  }
332
- let s = a.slice(0, o), c = a.charCodeAt(o + 1) === M ? 2 : 1;
332
+ let s = a.slice(0, o), c = a.charCodeAt(o + 1) === j ? 2 : 1;
333
333
  v(s, a.slice(o + c), a);
334
334
  }
335
335
  function v(e, t, i) {
@@ -345,13 +345,13 @@ ${t}`, d++;
345
345
  l = t.includes("\0") ? void 0 : t;
346
346
  break;
347
347
  case "retry":
348
- /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new $e(`Invalid \`retry\` value: "${t}"`, {
348
+ /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new et(`Invalid \`retry\` value: "${t}"`, {
349
349
  type: "invalid-retry",
350
350
  value: t,
351
351
  line: i
352
352
  }));
353
353
  break;
354
- default: n(new $e(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
354
+ default: n(new et(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
355
355
  type: "unknown-field",
356
356
  field: e,
357
357
  value: t,
@@ -359,14 +359,14 @@ ${t}`, d++;
359
359
  }));
360
360
  }
361
361
  }
362
- function y() {
362
+ function ee() {
363
363
  d > 0 && t({
364
364
  id: l,
365
365
  event: f,
366
366
  data: u
367
367
  }), l = void 0, u = "", d = 0, f = void 0;
368
368
  }
369
- function b(e = {}) {
369
+ function y(e = {}) {
370
370
  if (e.consume && o.length > 0) {
371
371
  let e = o.join("");
372
372
  _(e, 0, e.length);
@@ -375,23 +375,23 @@ ${t}`, d++;
375
375
  }
376
376
  return {
377
377
  feed: m,
378
- reset: b
378
+ reset: y
379
379
  };
380
380
  }
381
- function P(e, t, n) {
381
+ function N(e, t, n) {
382
382
  return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
383
383
  }
384
- function nt(e, t, n) {
384
+ function rt(e, t, n) {
385
385
  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;
386
386
  }
387
387
  //#endregion
388
388
  //#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
389
- var rt = class extends TransformStream {
389
+ var it = class extends TransformStream {
390
390
  constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
391
391
  let i;
392
392
  super({
393
393
  start(a) {
394
- i = tt({
394
+ i = nt({
395
395
  onEvent: (e) => {
396
396
  a.enqueue(e);
397
397
  },
@@ -410,8 +410,8 @@ var rt = class extends TransformStream {
410
410
  }
411
411
  };
412
412
  new TextDecoder();
413
- var { btoa: it, atob: at } = globalThis;
414
- function F(e) {
413
+ var { btoa: at, atob: ot } = globalThis;
414
+ function P(e) {
415
415
  if (e == null) return {};
416
416
  let t = {};
417
417
  if (e instanceof Headers) e.forEach((e, n) => {
@@ -423,28 +423,28 @@ function F(e) {
423
423
  }
424
424
  return t;
425
425
  }
426
- var I = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
426
+ var F = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
427
427
  let i = () => {
428
428
  let e = n.length, r = Array(t);
429
429
  for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
430
430
  return r.join("");
431
431
  };
432
432
  if (e == null) return i;
433
- if (n.includes(r)) throw new He({
433
+ if (n.includes(r)) throw new Ue({
434
434
  argument: "separator",
435
435
  message: `The separator "${r}" must not be part of the alphabet "${n}".`
436
436
  });
437
437
  return () => `${e}${r}${i()}`;
438
- }, L = I();
439
- function R(e) {
438
+ }, st = F();
439
+ function I(e) {
440
440
  return globalThis.Buffer?.isBuffer(e) ?? !1;
441
441
  }
442
- var ot = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, z = /"(?: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*:/;
443
- function st(e) {
442
+ var ct = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, L = /"(?: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*:/;
443
+ function lt(e) {
444
444
  let t = JSON.parse(e);
445
- return typeof t != "object" || !t || ot.test(e) === !1 && z.test(e) === !1 ? t : ct(t);
445
+ return typeof t != "object" || !t || ct.test(e) === !1 && L.test(e) === !1 ? t : ut(t);
446
446
  }
447
- function ct(e) {
447
+ function ut(e) {
448
448
  let t = [e];
449
449
  for (; t.length;) {
450
450
  let e = t;
@@ -459,35 +459,35 @@ function ct(e) {
459
459
  }
460
460
  return e;
461
461
  }
462
- function B(e) {
462
+ function R(e) {
463
463
  let { stackTraceLimit: t } = Error;
464
464
  try {
465
465
  Error.stackTraceLimit = 0;
466
466
  } catch {
467
- return st(e);
467
+ return lt(e);
468
468
  }
469
469
  try {
470
- return st(e);
470
+ return lt(e);
471
471
  } finally {
472
472
  Error.stackTraceLimit = t;
473
473
  }
474
474
  }
475
- function V(e) {
475
+ function z(e) {
476
476
  if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
477
477
  let { additionalProperties: t } = e;
478
- e.additionalProperties = t != null && typeof t != "boolean" && H(t);
478
+ e.additionalProperties = t != null && typeof t != "boolean" && B(t);
479
479
  let { properties: n } = e;
480
- if (n != null) for (let e of Object.keys(n)) n[e] = H(n[e]);
480
+ if (n != null) for (let e of Object.keys(n)) n[e] = B(n[e]);
481
481
  }
482
- e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(H) : H(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(H)), e.allOf != null && (e.allOf = e.allOf.map(H)), e.oneOf != null && (e.oneOf = e.oneOf.map(H));
482
+ e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(B) : B(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(B)), e.allOf != null && (e.allOf = e.allOf.map(B)), e.oneOf != null && (e.oneOf = e.oneOf.map(B));
483
483
  let { definitions: t } = e;
484
- if (t != null) for (let e of Object.keys(t)) t[e] = H(t[e]);
484
+ if (t != null) for (let e of Object.keys(t)) t[e] = B(t[e]);
485
485
  return e;
486
486
  }
487
- function H(e) {
488
- return typeof e == "boolean" ? e : V(e);
487
+ function B(e) {
488
+ return typeof e == "boolean" ? e : z(e);
489
489
  }
490
- var lt = Symbol("Let zodToJsonSchema decide on which parser to use"), ut = {
490
+ var dt = Symbol("Let zodToJsonSchema decide on which parser to use"), ft = {
491
491
  name: void 0,
492
492
  $refStrategy: "root",
493
493
  basePath: ["#"],
@@ -507,24 +507,24 @@ var lt = Symbol("Let zodToJsonSchema decide on which parser to use"), ut = {
507
507
  emailStrategy: "format:email",
508
508
  base64Strategy: "contentEncoding:base64",
509
509
  nameStrategy: "ref"
510
- }, dt = (e) => typeof e == "string" ? {
511
- ...ut,
510
+ }, pt = (e) => typeof e == "string" ? {
511
+ ...ft,
512
512
  name: e
513
513
  } : {
514
- ...ut,
514
+ ...ft,
515
515
  ...e
516
516
  };
517
- function U() {
517
+ function V() {
518
518
  return {};
519
519
  }
520
- function ft(e, t) {
520
+ function mt(e, t) {
521
521
  let n = { type: "array" };
522
- return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = Y(e.type._def, {
522
+ return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = J(e.type._def, {
523
523
  ...t,
524
524
  currentPath: [...t.currentPath, "items"]
525
525
  })), 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;
526
526
  }
527
- function pt(e) {
527
+ function ht(e) {
528
528
  let t = {
529
529
  type: "integer",
530
530
  format: "int64"
@@ -541,16 +541,16 @@ function pt(e) {
541
541
  }
542
542
  return t;
543
543
  }
544
- function W() {
544
+ function H() {
545
545
  return { type: "boolean" };
546
546
  }
547
- function G(e, t) {
548
- return Y(e.type._def, t);
547
+ function U(e, t) {
548
+ return J(e.type._def, t);
549
549
  }
550
- var mt = (e, t) => Y(e.innerType._def, t);
551
- function ht(e, t, n) {
550
+ var W = (e, t) => J(e.innerType._def, t);
551
+ function gt(e, t, n) {
552
552
  let r = n ?? t.dateStrategy;
553
- if (Array.isArray(r)) return { anyOf: r.map((n) => ht(e, t, n)) };
553
+ if (Array.isArray(r)) return { anyOf: r.map((n) => gt(e, t, n)) };
554
554
  switch (r) {
555
555
  case "string":
556
556
  case "format:date-time": return {
@@ -561,10 +561,10 @@ function ht(e, t, n) {
561
561
  type: "string",
562
562
  format: "date"
563
563
  };
564
- case "integer": return gt(e);
564
+ case "integer": return _t(e);
565
565
  }
566
566
  }
567
- var gt = (e) => {
567
+ var _t = (e) => {
568
568
  let t = {
569
569
  type: "integer",
570
570
  format: "unix-time"
@@ -577,31 +577,31 @@ var gt = (e) => {
577
577
  }
578
578
  return t;
579
579
  };
580
- function _t(e, t) {
580
+ function vt(e, t) {
581
581
  return {
582
- ...Y(e.innerType._def, t),
582
+ ...J(e.innerType._def, t),
583
583
  default: e.defaultValue()
584
584
  };
585
585
  }
586
- function vt(e, t) {
587
- return t.effectStrategy === "input" ? Y(e.schema._def, t) : U();
586
+ function yt(e, t) {
587
+ return t.effectStrategy === "input" ? J(e.schema._def, t) : V();
588
588
  }
589
- function yt(e) {
589
+ function bt(e) {
590
590
  return {
591
591
  type: "string",
592
592
  enum: Array.from(e.values)
593
593
  };
594
594
  }
595
- var bt = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
596
- function xt(e, t) {
597
- let n = [Y(e.left._def, {
595
+ var xt = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
596
+ function St(e, t) {
597
+ let n = [J(e.left._def, {
598
598
  ...t,
599
599
  currentPath: [
600
600
  ...t.currentPath,
601
601
  "allOf",
602
602
  "0"
603
603
  ]
604
- }), Y(e.right._def, {
604
+ }), J(e.right._def, {
605
605
  ...t,
606
606
  currentPath: [
607
607
  ...t.currentPath,
@@ -610,7 +610,7 @@ function xt(e, t) {
610
610
  ]
611
611
  })].filter((e) => !!e), r = [];
612
612
  return n.forEach((e) => {
613
- if (bt(e)) r.push(...e.allOf);
613
+ if (xt(e)) r.push(...e.allOf);
614
614
  else {
615
615
  let t = e;
616
616
  if ("additionalProperties" in e && e.additionalProperties === !1) {
@@ -621,19 +621,19 @@ function xt(e, t) {
621
621
  }
622
622
  }), r.length ? { allOf: r } : void 0;
623
623
  }
624
- function St(e) {
624
+ function Ct(e) {
625
625
  let t = typeof e.value;
626
626
  return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
627
627
  type: t === "bigint" ? "integer" : t,
628
628
  const: e.value
629
629
  };
630
630
  }
631
- var Ct = void 0, K = {
631
+ var wt = void 0, G = {
632
632
  cuid: /^[cC][^\s-]{8,}$/,
633
633
  cuid2: /^[0-9a-z]+$/,
634
634
  ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
635
635
  email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
636
- emoji: () => (Ct === void 0 && (Ct = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), Ct),
636
+ emoji: () => (wt === void 0 && (wt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), wt),
637
637
  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}$/,
638
638
  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])$/,
639
639
  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])$/,
@@ -644,7 +644,7 @@ var Ct = void 0, K = {
644
644
  nanoid: /^[a-zA-Z0-9_-]{21}$/,
645
645
  jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
646
646
  };
647
- function wt(e, t) {
647
+ function Tt(e, t) {
648
648
  let n = { type: "string" };
649
649
  if (e.checks) for (let r of e.checks) switch (r.kind) {
650
650
  case "min":
@@ -656,108 +656,108 @@ function wt(e, t) {
656
656
  case "email":
657
657
  switch (t.emailStrategy) {
658
658
  case "format:email":
659
- q(n, "email", r.message, t);
659
+ K(n, "email", r.message, t);
660
660
  break;
661
661
  case "format:idn-email":
662
- q(n, "idn-email", r.message, t);
662
+ K(n, "idn-email", r.message, t);
663
663
  break;
664
- case "pattern:zod": J(n, K.email, r.message, t);
664
+ case "pattern:zod": q(n, G.email, r.message, t);
665
665
  }
666
666
  break;
667
667
  case "url":
668
- q(n, "uri", r.message, t);
668
+ K(n, "uri", r.message, t);
669
669
  break;
670
670
  case "uuid":
671
- q(n, "uuid", r.message, t);
671
+ K(n, "uuid", r.message, t);
672
672
  break;
673
673
  case "regex":
674
- J(n, r.regex, r.message, t);
674
+ q(n, r.regex, r.message, t);
675
675
  break;
676
676
  case "cuid":
677
- J(n, K.cuid, r.message, t);
677
+ q(n, G.cuid, r.message, t);
678
678
  break;
679
679
  case "cuid2":
680
- J(n, K.cuid2, r.message, t);
680
+ q(n, G.cuid2, r.message, t);
681
681
  break;
682
682
  case "startsWith":
683
- J(n, RegExp(`^${Tt(r.value, t)}`), r.message, t);
683
+ q(n, RegExp(`^${Et(r.value, t)}`), r.message, t);
684
684
  break;
685
685
  case "endsWith":
686
- J(n, RegExp(`${Tt(r.value, t)}$`), r.message, t);
686
+ q(n, RegExp(`${Et(r.value, t)}$`), r.message, t);
687
687
  break;
688
688
  case "datetime":
689
- q(n, "date-time", r.message, t);
689
+ K(n, "date-time", r.message, t);
690
690
  break;
691
691
  case "date":
692
- q(n, "date", r.message, t);
692
+ K(n, "date", r.message, t);
693
693
  break;
694
694
  case "time":
695
- q(n, "time", r.message, t);
695
+ K(n, "time", r.message, t);
696
696
  break;
697
697
  case "duration":
698
- q(n, "duration", r.message, t);
698
+ K(n, "duration", r.message, t);
699
699
  break;
700
700
  case "length":
701
701
  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;
702
702
  break;
703
703
  case "includes":
704
- J(n, RegExp(Tt(r.value, t)), r.message, t);
704
+ q(n, RegExp(Et(r.value, t)), r.message, t);
705
705
  break;
706
706
  case "ip":
707
- r.version !== "v6" && q(n, "ipv4", r.message, t), r.version !== "v4" && q(n, "ipv6", r.message, t);
707
+ r.version !== "v6" && K(n, "ipv4", r.message, t), r.version !== "v4" && K(n, "ipv6", r.message, t);
708
708
  break;
709
709
  case "base64url":
710
- J(n, K.base64url, r.message, t);
710
+ q(n, G.base64url, r.message, t);
711
711
  break;
712
712
  case "jwt":
713
- J(n, K.jwt, r.message, t);
713
+ q(n, G.jwt, r.message, t);
714
714
  break;
715
715
  case "cidr":
716
- r.version !== "v6" && J(n, K.ipv4Cidr, r.message, t), r.version !== "v4" && J(n, K.ipv6Cidr, r.message, t);
716
+ r.version !== "v6" && q(n, G.ipv4Cidr, r.message, t), r.version !== "v4" && q(n, G.ipv6Cidr, r.message, t);
717
717
  break;
718
718
  case "emoji":
719
- J(n, K.emoji(), r.message, t);
719
+ q(n, G.emoji(), r.message, t);
720
720
  break;
721
721
  case "ulid":
722
- J(n, K.ulid, r.message, t);
722
+ q(n, G.ulid, r.message, t);
723
723
  break;
724
724
  case "base64":
725
725
  switch (t.base64Strategy) {
726
726
  case "format:binary":
727
- q(n, "binary", r.message, t);
727
+ K(n, "binary", r.message, t);
728
728
  break;
729
729
  case "contentEncoding:base64":
730
730
  n.contentEncoding = "base64";
731
731
  break;
732
- case "pattern:zod": J(n, K.base64, r.message, t);
732
+ case "pattern:zod": q(n, G.base64, r.message, t);
733
733
  }
734
734
  break;
735
- case "nanoid": J(n, K.nanoid, r.message, t);
735
+ case "nanoid": q(n, G.nanoid, r.message, t);
736
736
  }
737
737
  return n;
738
738
  }
739
- function Tt(e, t) {
740
- return t.patternStrategy === "escape" ? Dt(e) : e;
739
+ function Et(e, t) {
740
+ return t.patternStrategy === "escape" ? Ot(e) : e;
741
741
  }
742
- var Et = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
743
- function Dt(e) {
742
+ var Dt = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
743
+ function Ot(e) {
744
744
  let t = "";
745
- for (let n = 0; n < e.length; n++) Et.has(e[n]) || (t += "\\"), t += e[n];
745
+ for (let n = 0; n < e.length; n++) Dt.has(e[n]) || (t += "\\"), t += e[n];
746
746
  return t;
747
747
  }
748
- function q(e, t, n, r) {
748
+ function K(e, t, n, r) {
749
749
  e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
750
750
  format: t,
751
751
  ...n && r.errorMessages && { errorMessage: { format: n } }
752
752
  })) : e.format = t;
753
753
  }
754
- function J(e, t, n, r) {
754
+ function q(e, t, n, r) {
755
755
  e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
756
- pattern: Ot(t, r),
756
+ pattern: kt(t, r),
757
757
  ...n && r.errorMessages && { errorMessage: { pattern: n } }
758
- })) : e.pattern = Ot(t, r);
758
+ })) : e.pattern = kt(t, r);
759
759
  }
760
- function Ot(e, t) {
760
+ function kt(e, t) {
761
761
  if (!t.applyRegexFlags || !e.flags) return e.source;
762
762
  let n = {
763
763
  i: e.flags.includes("i"),
@@ -796,16 +796,16 @@ function Ot(e, t) {
796
796
  }
797
797
  return i;
798
798
  }
799
- function kt(e, t) {
799
+ function At(e, t) {
800
800
  let n = {
801
801
  type: "object",
802
- additionalProperties: Y(e.valueType._def, {
802
+ additionalProperties: J(e.valueType._def, {
803
803
  ...t,
804
804
  currentPath: [...t.currentPath, "additionalProperties"]
805
805
  }) ?? t.allowedAdditionalProperties
806
806
  };
807
807
  if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
808
- let { type: r, ...i } = wt(e.keyType._def, t);
808
+ let { type: r, ...i } = Tt(e.keyType._def, t);
809
809
  return {
810
810
  ...n,
811
811
  propertyNames: i
@@ -816,7 +816,7 @@ function kt(e, t) {
816
816
  propertyNames: { enum: e.keyType._def.values }
817
817
  };
818
818
  if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
819
- let { type: r, ...i } = G(e.keyType._def, t);
819
+ let { type: r, ...i } = U(e.keyType._def, t);
820
820
  return {
821
821
  ...n,
822
822
  propertyNames: i
@@ -824,13 +824,13 @@ function kt(e, t) {
824
824
  }
825
825
  return n;
826
826
  }
827
- function At(e, t) {
828
- return t.mapStrategy === "record" ? kt(e, t) : {
827
+ function jt(e, t) {
828
+ return t.mapStrategy === "record" ? At(e, t) : {
829
829
  type: "array",
830
830
  maxItems: 125,
831
831
  items: {
832
832
  type: "array",
833
- items: [Y(e.keyType._def, {
833
+ items: [J(e.keyType._def, {
834
834
  ...t,
835
835
  currentPath: [
836
836
  ...t.currentPath,
@@ -838,7 +838,7 @@ function At(e, t) {
838
838
  "items",
839
839
  "0"
840
840
  ]
841
- }) || U(), Y(e.valueType._def, {
841
+ }) || V(), J(e.valueType._def, {
842
842
  ...t,
843
843
  currentPath: [
844
844
  ...t.currentPath,
@@ -846,37 +846,37 @@ function At(e, t) {
846
846
  "items",
847
847
  "1"
848
848
  ]
849
- }) || U()],
849
+ }) || V()],
850
850
  minItems: 2,
851
851
  maxItems: 2
852
852
  }
853
853
  };
854
854
  }
855
- function jt(e) {
855
+ function Mt(e) {
856
856
  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)));
857
857
  return {
858
858
  type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
859
859
  enum: n
860
860
  };
861
861
  }
862
- function Mt() {
863
- return { not: U() };
864
- }
865
862
  function Nt() {
863
+ return { not: V() };
864
+ }
865
+ function Pt() {
866
866
  return { type: "null" };
867
867
  }
868
- var Pt = {
868
+ var Ft = {
869
869
  ZodString: "string",
870
870
  ZodNumber: "number",
871
871
  ZodBigInt: "integer",
872
872
  ZodBoolean: "boolean",
873
873
  ZodNull: "null"
874
874
  };
875
- function Ft(e, t) {
875
+ function It(e, t) {
876
876
  let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
877
- if (n.every((e) => e._def.typeName in Pt && (!e._def.checks || !e._def.checks.length))) {
877
+ if (n.every((e) => e._def.typeName in Ft && (!e._def.checks || !e._def.checks.length))) {
878
878
  let e = n.reduce((e, t) => {
879
- let n = Pt[t._def.typeName];
879
+ let n = Ft[t._def.typeName];
880
880
  return n && !e.includes(n) ? [...e, n] : e;
881
881
  }, []);
882
882
  return { type: e.length > 1 ? e : e[0] };
@@ -904,10 +904,10 @@ function Ft(e, t) {
904
904
  type: "string",
905
905
  enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
906
906
  };
907
- return It(e, t);
907
+ return Lt(e, t);
908
908
  }
909
- var It = (e, t) => {
910
- let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => Y(e._def, {
909
+ var Lt = (e, t) => {
910
+ let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => J(e._def, {
911
911
  ...t,
912
912
  currentPath: [
913
913
  ...t.currentPath,
@@ -917,15 +917,15 @@ var It = (e, t) => {
917
917
  })).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
918
918
  return n.length ? { anyOf: n } : void 0;
919
919
  };
920
- function Lt(e, t) {
920
+ function Rt(e, t) {
921
921
  if ([
922
922
  "ZodString",
923
923
  "ZodNumber",
924
924
  "ZodBigInt",
925
925
  "ZodBoolean",
926
926
  "ZodNull"
927
- ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Pt[e.innerType._def.typeName], "null"] };
928
- let n = Y(e.innerType._def, {
927
+ ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Ft[e.innerType._def.typeName], "null"] };
928
+ let n = J(e.innerType._def, {
929
929
  ...t,
930
930
  currentPath: [
931
931
  ...t.currentPath,
@@ -935,7 +935,7 @@ function Lt(e, t) {
935
935
  });
936
936
  return n && { anyOf: [n, { type: "null" }] };
937
937
  }
938
- function Rt(e) {
938
+ function zt(e) {
939
939
  let t = { type: "number" };
940
940
  if (!e.checks) return t;
941
941
  for (let n of e.checks) switch (n.kind) {
@@ -952,7 +952,7 @@ function Rt(e) {
952
952
  }
953
953
  return t;
954
954
  }
955
- function zt(e, t) {
955
+ function Bt(e, t) {
956
956
  let n = {
957
957
  type: "object",
958
958
  properties: {}
@@ -960,7 +960,7 @@ function zt(e, t) {
960
960
  for (let e in i) {
961
961
  let a = i[e];
962
962
  if (a === void 0 || a._def === void 0) continue;
963
- let o = Vt(a), s = Y(a._def, {
963
+ let o = Ht(a), s = J(a._def, {
964
964
  ...t,
965
965
  currentPath: [
966
966
  ...t.currentPath,
@@ -976,11 +976,11 @@ function zt(e, t) {
976
976
  s !== void 0 && (n.properties[e] = s, o || r.push(e));
977
977
  }
978
978
  r.length && (n.required = r);
979
- let a = Bt(e, t);
979
+ let a = Vt(e, t);
980
980
  return a !== void 0 && (n.additionalProperties = a), n;
981
981
  }
982
- function Bt(e, t) {
983
- if (e.catchall._def.typeName !== "ZodNever") return Y(e.catchall._def, {
982
+ function Vt(e, t) {
983
+ if (e.catchall._def.typeName !== "ZodNever") return J(e.catchall._def, {
984
984
  ...t,
985
985
  currentPath: [...t.currentPath, "additionalProperties"]
986
986
  });
@@ -990,16 +990,16 @@ function Bt(e, t) {
990
990
  case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
991
991
  }
992
992
  }
993
- function Vt(e) {
993
+ function Ht(e) {
994
994
  try {
995
995
  return e.isOptional();
996
996
  } catch {
997
997
  return !0;
998
998
  }
999
999
  }
1000
- var Ht = (e, t) => {
1001
- if (t.currentPath.toString() === t.propertyPath?.toString()) return Y(e.innerType._def, t);
1002
- let n = Y(e.innerType._def, {
1000
+ var Ut = (e, t) => {
1001
+ if (t.currentPath.toString() === t.propertyPath?.toString()) return J(e.innerType._def, t);
1002
+ let n = J(e.innerType._def, {
1003
1003
  ...t,
1004
1004
  currentPath: [
1005
1005
  ...t.currentPath,
@@ -1007,11 +1007,11 @@ var Ht = (e, t) => {
1007
1007
  "1"
1008
1008
  ]
1009
1009
  });
1010
- return n ? { anyOf: [{ not: U() }, n] } : U();
1011
- }, Ut = (e, t) => {
1012
- if (t.pipeStrategy === "input") return Y(e.in._def, t);
1013
- if (t.pipeStrategy === "output") return Y(e.out._def, t);
1014
- let n = Y(e.in._def, {
1010
+ return n ? { anyOf: [{ not: V() }, n] } : V();
1011
+ }, Wt = (e, t) => {
1012
+ if (t.pipeStrategy === "input") return J(e.in._def, t);
1013
+ if (t.pipeStrategy === "output") return J(e.out._def, t);
1014
+ let n = J(e.in._def, {
1015
1015
  ...t,
1016
1016
  currentPath: [
1017
1017
  ...t.currentPath,
@@ -1019,7 +1019,7 @@ var Ht = (e, t) => {
1019
1019
  "0"
1020
1020
  ]
1021
1021
  });
1022
- return { allOf: [n, Y(e.out._def, {
1022
+ return { allOf: [n, J(e.out._def, {
1023
1023
  ...t,
1024
1024
  currentPath: [
1025
1025
  ...t.currentPath,
@@ -1028,25 +1028,25 @@ var Ht = (e, t) => {
1028
1028
  ]
1029
1029
  })].filter((e) => e !== void 0) };
1030
1030
  };
1031
- function Wt(e, t) {
1032
- return Y(e.type._def, t);
1033
- }
1034
1031
  function Gt(e, t) {
1032
+ return J(e.type._def, t);
1033
+ }
1034
+ function Kt(e, t) {
1035
1035
  let n = {
1036
1036
  type: "array",
1037
1037
  uniqueItems: !0,
1038
- items: Y(e.valueType._def, {
1038
+ items: J(e.valueType._def, {
1039
1039
  ...t,
1040
1040
  currentPath: [...t.currentPath, "items"]
1041
1041
  })
1042
1042
  };
1043
1043
  return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
1044
1044
  }
1045
- function Kt(e, t) {
1045
+ function qt(e, t) {
1046
1046
  return e.rest ? {
1047
1047
  type: "array",
1048
1048
  minItems: e.items.length,
1049
- items: e.items.map((e, n) => Y(e._def, {
1049
+ items: e.items.map((e, n) => J(e._def, {
1050
1050
  ...t,
1051
1051
  currentPath: [
1052
1052
  ...t.currentPath,
@@ -1054,7 +1054,7 @@ function Kt(e, t) {
1054
1054
  `${n}`
1055
1055
  ]
1056
1056
  })).reduce((e, t) => t === void 0 ? e : [...e, t], []),
1057
- additionalItems: Y(e.rest._def, {
1057
+ additionalItems: J(e.rest._def, {
1058
1058
  ...t,
1059
1059
  currentPath: [...t.currentPath, "additionalItems"]
1060
1060
  })
@@ -1062,7 +1062,7 @@ function Kt(e, t) {
1062
1062
  type: "array",
1063
1063
  minItems: e.items.length,
1064
1064
  maxItems: e.items.length,
1065
- items: e.items.map((e, n) => Y(e._def, {
1065
+ items: e.items.map((e, n) => J(e._def, {
1066
1066
  ...t,
1067
1067
  currentPath: [
1068
1068
  ...t.currentPath,
@@ -1072,47 +1072,47 @@ function Kt(e, t) {
1072
1072
  })).reduce((e, t) => t === void 0 ? e : [...e, t], [])
1073
1073
  };
1074
1074
  }
1075
- function qt() {
1076
- return { not: U() };
1077
- }
1078
1075
  function Jt() {
1079
- return U();
1076
+ return { not: V() };
1080
1077
  }
1081
- var Yt = (e, t) => Y(e.innerType._def, t), Xt = (e, t, n) => {
1078
+ function Yt() {
1079
+ return V();
1080
+ }
1081
+ var Xt = (e, t) => J(e.innerType._def, t), Zt = (e, t, n) => {
1082
1082
  switch (t) {
1083
- case "ZodString": return wt(e, n);
1084
- case "ZodNumber": return Rt(e);
1085
- case "ZodObject": return zt(e, n);
1086
- case "ZodBigInt": return pt(e);
1087
- case "ZodBoolean": return W();
1088
- case "ZodDate": return ht(e, n);
1089
- case "ZodUndefined": return qt();
1090
- case "ZodNull": return Nt();
1091
- case "ZodArray": return ft(e, n);
1083
+ case "ZodString": return Tt(e, n);
1084
+ case "ZodNumber": return zt(e);
1085
+ case "ZodObject": return Bt(e, n);
1086
+ case "ZodBigInt": return ht(e);
1087
+ case "ZodBoolean": return H();
1088
+ case "ZodDate": return gt(e, n);
1089
+ case "ZodUndefined": return Jt();
1090
+ case "ZodNull": return Pt();
1091
+ case "ZodArray": return mt(e, n);
1092
1092
  case "ZodUnion":
1093
- case "ZodDiscriminatedUnion": return Ft(e, n);
1094
- case "ZodIntersection": return xt(e, n);
1095
- case "ZodTuple": return Kt(e, n);
1096
- case "ZodRecord": return kt(e, n);
1097
- case "ZodLiteral": return St(e);
1098
- case "ZodEnum": return yt(e);
1099
- case "ZodNativeEnum": return jt(e);
1100
- case "ZodNullable": return Lt(e, n);
1101
- case "ZodOptional": return Ht(e, n);
1102
- case "ZodMap": return At(e, n);
1103
- case "ZodSet": return Gt(e, n);
1093
+ case "ZodDiscriminatedUnion": return It(e, n);
1094
+ case "ZodIntersection": return St(e, n);
1095
+ case "ZodTuple": return qt(e, n);
1096
+ case "ZodRecord": return At(e, n);
1097
+ case "ZodLiteral": return Ct(e);
1098
+ case "ZodEnum": return bt(e);
1099
+ case "ZodNativeEnum": return Mt(e);
1100
+ case "ZodNullable": return Rt(e, n);
1101
+ case "ZodOptional": return Ut(e, n);
1102
+ case "ZodMap": return jt(e, n);
1103
+ case "ZodSet": return Kt(e, n);
1104
1104
  case "ZodLazy": return () => e.getter()._def;
1105
- case "ZodPromise": return Wt(e, n);
1105
+ case "ZodPromise": return Gt(e, n);
1106
1106
  case "ZodNaN":
1107
- case "ZodNever": return Mt();
1108
- case "ZodEffects": return vt(e, n);
1109
- case "ZodAny": return U();
1110
- case "ZodUnknown": return Jt();
1111
- case "ZodDefault": return _t(e, n);
1112
- case "ZodBranded": return G(e, n);
1113
- case "ZodReadonly": return Yt(e, n);
1114
- case "ZodCatch": return mt(e, n);
1115
- case "ZodPipeline": return Ut(e, n);
1107
+ case "ZodNever": return Nt();
1108
+ case "ZodEffects": return yt(e, n);
1109
+ case "ZodAny": return V();
1110
+ case "ZodUnknown": return Yt();
1111
+ case "ZodDefault": return vt(e, n);
1112
+ case "ZodBranded": return U(e, n);
1113
+ case "ZodReadonly": return Xt(e, n);
1114
+ case "ZodCatch": return W(e, n);
1115
+ case "ZodPipeline": return Wt(e, n);
1116
1116
  case "ZodFunction":
1117
1117
  case "ZodVoid":
1118
1118
  case "ZodSymbol": return;
@@ -1120,19 +1120,19 @@ var Yt = (e, t) => Y(e.innerType._def, t), Xt = (e, t, n) => {
1120
1120
  /* c8 ignore next */
1121
1121
  return ((e) => void 0)(t);
1122
1122
  }
1123
- }, Zt = (e, t) => {
1123
+ }, Qt = (e, t) => {
1124
1124
  let n = 0;
1125
1125
  for (; n < e.length && n < t.length && e[n] === t[n]; n++);
1126
1126
  return [(e.length - n).toString(), ...t.slice(n)].join("/");
1127
1127
  };
1128
- function Y(e, t, n = !1) {
1128
+ function J(e, t, n = !1) {
1129
1129
  let r = t.seen.get(e);
1130
1130
  if (t.override) {
1131
1131
  let i = t.override?.(e, t, r, n);
1132
- if (i !== lt) return i;
1132
+ if (i !== dt) return i;
1133
1133
  }
1134
1134
  if (r && !n) {
1135
- let e = Qt(r, t);
1135
+ let e = $t(r, t);
1136
1136
  if (e !== void 0) return e;
1137
1137
  }
1138
1138
  let i = {
@@ -1141,22 +1141,22 @@ function Y(e, t, n = !1) {
1141
1141
  jsonSchema: void 0
1142
1142
  };
1143
1143
  t.seen.set(e, i);
1144
- let a = Xt(e, e.typeName, t), o = typeof a == "function" ? Y(a(), t) : a;
1145
- if (o && $t(e, t, o), t.postProcess) {
1144
+ let a = Zt(e, e.typeName, t), o = typeof a == "function" ? J(a(), t) : a;
1145
+ if (o && en(e, t, o), t.postProcess) {
1146
1146
  let n = t.postProcess(o, e, t);
1147
1147
  return i.jsonSchema = o, n;
1148
1148
  }
1149
1149
  return i.jsonSchema = o, o;
1150
1150
  }
1151
- var Qt = (e, t) => {
1151
+ var $t = (e, t) => {
1152
1152
  switch (t.$refStrategy) {
1153
1153
  case "root": return { $ref: e.path.join("/") };
1154
- case "relative": return { $ref: Zt(t.currentPath, e.path) };
1154
+ case "relative": return { $ref: Qt(t.currentPath, e.path) };
1155
1155
  case "none":
1156
- 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`), U()) : t.$refStrategy === "seen" ? U() : void 0;
1156
+ case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), V()) : t.$refStrategy === "seen" ? V() : void 0;
1157
1157
  }
1158
- }, $t = (e, t, n) => (e.description && (n.description = e.description), n), en = (e) => {
1159
- let t = dt(e), n = t.name === void 0 ? t.basePath : [
1158
+ }, en = (e, t, n) => (e.description && (n.description = e.description), n), tn = (e) => {
1159
+ let t = pt(e), n = t.name === void 0 ? t.basePath : [
1160
1160
  ...t.basePath,
1161
1161
  t.definitionPath,
1162
1162
  t.name
@@ -1175,25 +1175,25 @@ var Qt = (e, t) => {
1175
1175
  jsonSchema: void 0
1176
1176
  }]))
1177
1177
  };
1178
- }, tn = (e, t) => {
1179
- let n = en(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1178
+ }, nn = (e, t) => {
1179
+ let n = tn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1180
1180
  ...e,
1181
- [t]: Y(r._def, {
1181
+ [t]: J(r._def, {
1182
1182
  ...n,
1183
1183
  currentPath: [
1184
1184
  ...n.basePath,
1185
1185
  n.definitionPath,
1186
1186
  t
1187
1187
  ]
1188
- }, !0) ?? U()
1189
- }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = Y(e._def, i === void 0 ? n : {
1188
+ }, !0) ?? V()
1189
+ }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = J(e._def, i === void 0 ? n : {
1190
1190
  ...n,
1191
1191
  currentPath: [
1192
1192
  ...n.basePath,
1193
1193
  n.definitionPath,
1194
1194
  i
1195
1195
  ]
1196
- }, !1) ?? U(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1196
+ }, !1) ?? V(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1197
1197
  o !== void 0 && (a.title = o);
1198
1198
  let s = i === void 0 ? r ? {
1199
1199
  ...a,
@@ -1210,14 +1210,14 @@ var Qt = (e, t) => {
1210
1210
  }
1211
1211
  };
1212
1212
  return s.$schema = "http://json-schema.org/draft-07/schema#", s;
1213
- }, nn = Symbol.for("vercel.ai.schema");
1214
- function rn(e) {
1213
+ }, rn = Symbol.for("vercel.ai.schema");
1214
+ function an(e) {
1215
1215
  let t;
1216
1216
  return () => (t ??= e(), t);
1217
1217
  }
1218
- function an(e, { validate: t } = {}) {
1218
+ function on(e, { validate: t } = {}) {
1219
1219
  return {
1220
- [nn]: !0,
1220
+ [rn]: !0,
1221
1221
  _type: void 0,
1222
1222
  get jsonSchema() {
1223
1223
  return typeof e == "function" && (e = e()), e;
@@ -1225,20 +1225,20 @@ function an(e, { validate: t } = {}) {
1225
1225
  validate: t
1226
1226
  };
1227
1227
  }
1228
- function on(e) {
1229
- return typeof e == "object" && !!e && nn in e && e[nn] === !0 && "jsonSchema" in e && "validate" in e;
1230
- }
1231
1228
  function sn(e) {
1232
- return e == null ? an({
1229
+ return typeof e == "object" && !!e && rn in e && e[rn] === !0 && "jsonSchema" in e && "validate" in e;
1230
+ }
1231
+ function cn(e) {
1232
+ return e == null ? on({
1233
1233
  type: "object",
1234
1234
  properties: {},
1235
1235
  additionalProperties: !1
1236
- }) : on(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? pn(e) : cn(e) : e();
1236
+ }) : sn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? mn(e) : ln(e) : e();
1237
1237
  }
1238
- function cn(e) {
1239
- return an(() => {
1240
- if (!ln(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1241
- return V(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1238
+ function ln(e) {
1239
+ return on(() => {
1240
+ if (!un(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1241
+ return z(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1242
1242
  }, { validate: async (t) => {
1243
1243
  let n = await e["~standard"].validate(t);
1244
1244
  return "value" in n ? {
@@ -1246,19 +1246,19 @@ function cn(e) {
1246
1246
  value: n.value
1247
1247
  } : {
1248
1248
  success: !1,
1249
- error: new Ye({
1249
+ error: new Xe({
1250
1250
  value: t,
1251
1251
  cause: n.issues
1252
1252
  })
1253
1253
  };
1254
1254
  } });
1255
1255
  }
1256
- function ln(e) {
1256
+ function un(e) {
1257
1257
  return e["~standard"].jsonSchema != null;
1258
1258
  }
1259
- function un(e, t) {
1259
+ function dn(e, t) {
1260
1260
  let n = t?.useReferences ?? !1;
1261
- return an(() => tn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1261
+ return on(() => nn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1262
1262
  let n = await e.safeParseAsync(t);
1263
1263
  return n.success ? {
1264
1264
  success: !0,
@@ -1269,9 +1269,9 @@ function un(e, t) {
1269
1269
  };
1270
1270
  } });
1271
1271
  }
1272
- function dn(e, r) {
1272
+ function fn(e, r) {
1273
1273
  let i = r?.useReferences ?? !1;
1274
- return an(() => V(n(e, {
1274
+ return on(() => z(n(e, {
1275
1275
  target: "draft-7",
1276
1276
  io: "input",
1277
1277
  reused: i ? "ref" : "inline"
@@ -1286,27 +1286,27 @@ function dn(e, r) {
1286
1286
  };
1287
1287
  } });
1288
1288
  }
1289
- function fn(e) {
1289
+ function pn(e) {
1290
1290
  return "_zod" in e;
1291
1291
  }
1292
- function pn(e, t) {
1293
- return fn(e) ? dn(e, t) : un(e, t);
1292
+ function mn(e, t) {
1293
+ return pn(e) ? fn(e, t) : dn(e, t);
1294
1294
  }
1295
- async function mn({ value: e, schema: t, context: n }) {
1296
- let r = await hn({
1295
+ async function hn({ value: e, schema: t, context: n }) {
1296
+ let r = await gn({
1297
1297
  value: e,
1298
1298
  schema: t,
1299
1299
  context: n
1300
1300
  });
1301
- if (!r.success) throw Ye.wrap({
1301
+ if (!r.success) throw Xe.wrap({
1302
1302
  value: e,
1303
1303
  cause: r.error,
1304
1304
  context: n
1305
1305
  });
1306
1306
  return r.value;
1307
1307
  }
1308
- async function hn({ value: e, schema: t, context: n }) {
1309
- let r = sn(t);
1308
+ async function gn({ value: e, schema: t, context: n }) {
1309
+ let r = cn(t);
1310
1310
  try {
1311
1311
  if (r.validate == null) return {
1312
1312
  success: !0,
@@ -1320,7 +1320,7 @@ async function hn({ value: e, schema: t, context: n }) {
1320
1320
  rawValue: e
1321
1321
  } : {
1322
1322
  success: !1,
1323
- error: Ye.wrap({
1323
+ error: Xe.wrap({
1324
1324
  value: e,
1325
1325
  cause: t.error,
1326
1326
  context: n
@@ -1330,7 +1330,7 @@ async function hn({ value: e, schema: t, context: n }) {
1330
1330
  } catch (t) {
1331
1331
  return {
1332
1332
  success: !1,
1333
- error: Ye.wrap({
1333
+ error: Xe.wrap({
1334
1334
  value: e,
1335
1335
  cause: t,
1336
1336
  context: n
@@ -1339,21 +1339,21 @@ async function hn({ value: e, schema: t, context: n }) {
1339
1339
  };
1340
1340
  }
1341
1341
  }
1342
- async function gn({ text: e, schema: t }) {
1342
+ async function _n({ text: e, schema: t }) {
1343
1343
  try {
1344
- let n = B(e);
1344
+ let n = R(e);
1345
1345
  return t == null ? {
1346
1346
  success: !0,
1347
1347
  value: n,
1348
1348
  rawValue: n
1349
- } : await hn({
1349
+ } : await gn({
1350
1350
  value: n,
1351
1351
  schema: t
1352
1352
  });
1353
1353
  } catch (t) {
1354
1354
  return {
1355
1355
  success: !1,
1356
- error: Ke.isInstance(t) ? t : new Ke({
1356
+ error: qe.isInstance(t) ? t : new qe({
1357
1357
  text: e,
1358
1358
  cause: t
1359
1359
  }),
@@ -1361,42 +1361,42 @@ async function gn({ text: e, schema: t }) {
1361
1361
  };
1362
1362
  }
1363
1363
  }
1364
- function _n({ stream: e, schema: t }) {
1365
- return e.pipeThrough(new TextDecoderStream()).pipeThrough(new rt()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1366
- e !== "[DONE]" && n.enqueue(await gn({
1364
+ function vn({ stream: e, schema: t }) {
1365
+ return e.pipeThrough(new TextDecoderStream()).pipeThrough(new it()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1366
+ e !== "[DONE]" && n.enqueue(await _n({
1367
1367
  text: e,
1368
1368
  schema: t
1369
1369
  }));
1370
1370
  } }));
1371
1371
  }
1372
- async function vn(e) {
1372
+ async function yn(e) {
1373
1373
  return typeof e == "function" && (e = e()), e;
1374
1374
  }
1375
1375
  new TextDecoder();
1376
1376
  //#endregion
1377
1377
  //#region ../../node_modules/.pnpm/ai@7.0.140_zod@4.6.7/node_modules/ai/dist/index.js
1378
- var yn = "AI_InvalidArgumentError", bn = `vercel.ai.error.${yn}`, xn = Symbol.for(bn), Sn = class extends T {
1378
+ var bn = "AI_InvalidArgumentError", xn = `vercel.ai.error.${bn}`, Sn = Symbol.for(xn), Cn = class extends w {
1379
1379
  constructor({ parameter: e, value: t, message: n }) {
1380
1380
  super({
1381
- name: yn,
1381
+ name: bn,
1382
1382
  message: `Invalid argument for parameter ${e}: ${n}`
1383
- }), this[xn] = !0, this.parameter = e, this.value = t;
1383
+ }), this[Sn] = !0, this.parameter = e, this.value = t;
1384
1384
  }
1385
1385
  static isInstance(e) {
1386
- return T.hasMarker(e, bn);
1386
+ return w.hasMarker(e, xn);
1387
1387
  }
1388
- }, Cn = "AI_UIMessageStreamError", wn = `vercel.ai.error.${Cn}`, Tn = Symbol.for(wn), En = class extends T {
1388
+ }, wn = "AI_UIMessageStreamError", Tn = `vercel.ai.error.${wn}`, En = Symbol.for(Tn), Dn = class extends w {
1389
1389
  constructor({ chunkType: e, chunkId: t, message: n }) {
1390
1390
  super({
1391
- name: Cn,
1391
+ name: wn,
1392
1392
  message: n
1393
- }), this[Tn] = !0, this.chunkType = e, this.chunkId = t;
1393
+ }), this[En] = !0, this.chunkType = e, this.chunkId = t;
1394
1394
  }
1395
1395
  static isInstance(e) {
1396
- return T.hasMarker(e, wn);
1396
+ return w.hasMarker(e, Tn);
1397
1397
  }
1398
1398
  };
1399
- function Dn(e, t) {
1399
+ function On(e, t) {
1400
1400
  if (e === void 0 && t === void 0) return;
1401
1401
  if (e === void 0) return t;
1402
1402
  if (t === void 0) return e;
@@ -1405,11 +1405,11 @@ function Dn(e, t) {
1405
1405
  let i = t[r];
1406
1406
  if (i === void 0) continue;
1407
1407
  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);
1408
- n[r] = o && s ? Dn(a, i) : i;
1408
+ n[r] = o && s ? On(a, i) : i;
1409
1409
  }
1410
1410
  return n;
1411
1411
  }
1412
- var X = {
1412
+ var Y = {
1413
1413
  array: d,
1414
1414
  boolean: m,
1415
1415
  custom: l,
@@ -1427,214 +1427,214 @@ var X = {
1427
1427
  string: r,
1428
1428
  union: e,
1429
1429
  unknown: _
1430
- }, On = X.lazy(() => X.union([
1431
- X.null(),
1432
- X.string(),
1433
- X.number(),
1434
- X.boolean(),
1435
- X.record(X.string(), On.optional()),
1436
- X.array(On)
1437
- ])), Z = X.record(X.string(), X.record(X.string(), On.optional())), kn = X.union([
1438
- X.string(),
1439
- X.instanceof(Uint8Array),
1440
- X.instanceof(ArrayBuffer),
1441
- X.custom(R, { message: "Must be a Buffer" })
1442
- ]), An = X.record(X.string(), X.string()), jn = X.object({
1443
- type: X.literal("text"),
1444
- text: X.string(),
1430
+ }, X = Y.lazy(() => Y.union([
1431
+ Y.null(),
1432
+ Y.string(),
1433
+ Y.number(),
1434
+ Y.boolean(),
1435
+ Y.record(Y.string(), X.optional()),
1436
+ Y.array(X)
1437
+ ])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())), kn = Y.union([
1438
+ Y.string(),
1439
+ Y.instanceof(Uint8Array),
1440
+ Y.instanceof(ArrayBuffer),
1441
+ Y.custom(I, { message: "Must be a Buffer" })
1442
+ ]), An = Y.record(Y.string(), Y.string()), jn = Y.object({
1443
+ type: Y.literal("text"),
1444
+ text: Y.string(),
1445
1445
  providerOptions: Z.optional()
1446
- }), Mn = X.object({
1447
- type: X.literal("image"),
1448
- image: X.union([
1446
+ }), Mn = Y.object({
1447
+ type: Y.literal("image"),
1448
+ image: Y.union([
1449
1449
  kn,
1450
- X.instanceof(URL),
1450
+ Y.instanceof(URL),
1451
1451
  An
1452
1452
  ]),
1453
- mediaType: X.string().optional(),
1453
+ mediaType: Y.string().optional(),
1454
1454
  providerOptions: Z.optional()
1455
- }), Nn = X.discriminatedUnion("type", [
1456
- X.object({
1457
- type: X.literal("data"),
1455
+ }), Nn = Y.discriminatedUnion("type", [
1456
+ Y.object({
1457
+ type: Y.literal("data"),
1458
1458
  data: kn
1459
1459
  }),
1460
- X.object({
1461
- type: X.literal("url"),
1462
- url: X.instanceof(URL)
1460
+ Y.object({
1461
+ type: Y.literal("url"),
1462
+ url: Y.instanceof(URL)
1463
1463
  }),
1464
- X.object({
1465
- type: X.literal("reference"),
1464
+ Y.object({
1465
+ type: Y.literal("reference"),
1466
1466
  reference: An
1467
1467
  }),
1468
- X.object({
1469
- type: X.literal("text"),
1470
- text: X.string()
1468
+ Y.object({
1469
+ type: Y.literal("text"),
1470
+ text: Y.string()
1471
1471
  })
1472
- ]), Pn = X.discriminatedUnion("type", [X.object({
1473
- type: X.literal("data"),
1472
+ ]), Pn = Y.discriminatedUnion("type", [Y.object({
1473
+ type: Y.literal("data"),
1474
1474
  data: kn
1475
- }), X.object({
1476
- type: X.literal("url"),
1477
- url: X.instanceof(URL)
1478
- })]), Fn = X.object({
1479
- type: X.literal("file"),
1480
- data: X.union([
1475
+ }), Y.object({
1476
+ type: Y.literal("url"),
1477
+ url: Y.instanceof(URL)
1478
+ })]), Fn = Y.object({
1479
+ type: Y.literal("file"),
1480
+ data: Y.union([
1481
1481
  Nn,
1482
1482
  kn,
1483
- X.instanceof(URL),
1483
+ Y.instanceof(URL),
1484
1484
  An
1485
1485
  ]),
1486
- filename: X.string().optional(),
1487
- mediaType: X.string(),
1486
+ filename: Y.string().optional(),
1487
+ mediaType: Y.string(),
1488
1488
  providerOptions: Z.optional()
1489
- }), In = X.object({
1490
- type: X.literal("reasoning"),
1491
- text: X.string(),
1489
+ }), In = Y.object({
1490
+ type: Y.literal("reasoning"),
1491
+ text: Y.string(),
1492
1492
  providerOptions: Z.optional()
1493
- }), Ln = X.object({
1494
- type: X.literal("custom"),
1495
- kind: X.string().transform((e) => e),
1493
+ }), Ln = Y.object({
1494
+ type: Y.literal("custom"),
1495
+ kind: Y.string().transform((e) => e),
1496
1496
  providerOptions: Z.optional()
1497
- }), Rn = X.object({
1498
- type: X.literal("reasoning-file"),
1499
- data: X.union([
1497
+ }), Rn = Y.object({
1498
+ type: Y.literal("reasoning-file"),
1499
+ data: Y.union([
1500
1500
  Pn,
1501
1501
  kn,
1502
- X.instanceof(URL)
1502
+ Y.instanceof(URL)
1503
1503
  ]),
1504
- mediaType: X.string(),
1504
+ mediaType: Y.string(),
1505
1505
  providerOptions: Z.optional()
1506
- }), zn = X.object({
1507
- type: X.literal("tool-call"),
1508
- toolCallId: X.string(),
1509
- toolName: X.string(),
1510
- input: X.unknown(),
1506
+ }), zn = Y.object({
1507
+ type: Y.literal("tool-call"),
1508
+ toolCallId: Y.string(),
1509
+ toolName: Y.string(),
1510
+ input: Y.unknown(),
1511
1511
  providerOptions: Z.optional(),
1512
- providerExecuted: X.boolean().optional()
1513
- }), Bn = X.discriminatedUnion("type", [
1514
- X.object({
1515
- type: X.literal("text"),
1516
- value: X.string(),
1512
+ providerExecuted: Y.boolean().optional()
1513
+ }), Bn = Y.discriminatedUnion("type", [
1514
+ Y.object({
1515
+ type: Y.literal("text"),
1516
+ value: Y.string(),
1517
1517
  providerOptions: Z.optional()
1518
1518
  }),
1519
- X.object({
1520
- type: X.literal("json"),
1521
- value: On,
1519
+ Y.object({
1520
+ type: Y.literal("json"),
1521
+ value: X,
1522
1522
  providerOptions: Z.optional()
1523
1523
  }),
1524
- X.object({
1525
- type: X.literal("execution-denied"),
1526
- reason: X.string().optional(),
1524
+ Y.object({
1525
+ type: Y.literal("execution-denied"),
1526
+ reason: Y.string().optional(),
1527
1527
  providerOptions: Z.optional()
1528
1528
  }),
1529
- X.object({
1530
- type: X.literal("error-text"),
1531
- value: X.string(),
1529
+ Y.object({
1530
+ type: Y.literal("error-text"),
1531
+ value: Y.string(),
1532
1532
  providerOptions: Z.optional()
1533
1533
  }),
1534
- X.object({
1535
- type: X.literal("error-json"),
1536
- value: On,
1534
+ Y.object({
1535
+ type: Y.literal("error-json"),
1536
+ value: X,
1537
1537
  providerOptions: Z.optional()
1538
1538
  }),
1539
- X.object({
1540
- type: X.literal("content"),
1541
- value: X.array(X.union([
1542
- X.object({
1543
- type: X.literal("text"),
1544
- text: X.string(),
1539
+ Y.object({
1540
+ type: Y.literal("content"),
1541
+ value: Y.array(Y.union([
1542
+ Y.object({
1543
+ type: Y.literal("text"),
1544
+ text: Y.string(),
1545
1545
  providerOptions: Z.optional()
1546
1546
  }),
1547
- X.object({
1548
- type: X.literal("file"),
1547
+ Y.object({
1548
+ type: Y.literal("file"),
1549
1549
  data: Nn,
1550
- mediaType: X.string(),
1551
- filename: X.string().optional(),
1550
+ mediaType: Y.string(),
1551
+ filename: Y.string().optional(),
1552
1552
  providerOptions: Z.optional()
1553
1553
  }),
1554
- X.object({
1555
- type: X.literal("file-data"),
1556
- data: X.string(),
1557
- mediaType: X.string(),
1558
- filename: X.string().optional(),
1554
+ Y.object({
1555
+ type: Y.literal("file-data"),
1556
+ data: Y.string(),
1557
+ mediaType: Y.string(),
1558
+ filename: Y.string().optional(),
1559
1559
  providerOptions: Z.optional()
1560
1560
  }),
1561
- X.object({
1562
- type: X.literal("file-url"),
1563
- url: X.string(),
1564
- mediaType: X.string().optional(),
1561
+ Y.object({
1562
+ type: Y.literal("file-url"),
1563
+ url: Y.string(),
1564
+ mediaType: Y.string().optional(),
1565
1565
  providerOptions: Z.optional()
1566
1566
  }),
1567
- X.object({
1568
- type: X.literal("file-id"),
1569
- fileId: X.union([X.string(), X.record(X.string(), X.string())]),
1567
+ Y.object({
1568
+ type: Y.literal("file-id"),
1569
+ fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1570
1570
  providerOptions: Z.optional()
1571
1571
  }),
1572
- X.object({
1573
- type: X.literal("file-reference"),
1574
- providerReference: X.record(X.string(), X.string()),
1572
+ Y.object({
1573
+ type: Y.literal("file-reference"),
1574
+ providerReference: Y.record(Y.string(), Y.string()),
1575
1575
  providerOptions: Z.optional()
1576
1576
  }),
1577
- X.object({
1578
- type: X.literal("image-data"),
1579
- data: X.string(),
1580
- mediaType: X.string(),
1577
+ Y.object({
1578
+ type: Y.literal("image-data"),
1579
+ data: Y.string(),
1580
+ mediaType: Y.string(),
1581
1581
  providerOptions: Z.optional()
1582
1582
  }),
1583
- X.object({
1584
- type: X.literal("image-url"),
1585
- url: X.string(),
1583
+ Y.object({
1584
+ type: Y.literal("image-url"),
1585
+ url: Y.string(),
1586
1586
  providerOptions: Z.optional()
1587
1587
  }),
1588
- X.object({
1589
- type: X.literal("image-file-id"),
1590
- fileId: X.union([X.string(), X.record(X.string(), X.string())]),
1588
+ Y.object({
1589
+ type: Y.literal("image-file-id"),
1590
+ fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1591
1591
  providerOptions: Z.optional()
1592
1592
  }),
1593
- X.object({
1594
- type: X.literal("image-file-reference"),
1595
- providerReference: X.record(X.string(), X.string()),
1593
+ Y.object({
1594
+ type: Y.literal("image-file-reference"),
1595
+ providerReference: Y.record(Y.string(), Y.string()),
1596
1596
  providerOptions: Z.optional()
1597
1597
  }),
1598
- X.object({
1599
- type: X.literal("custom"),
1598
+ Y.object({
1599
+ type: Y.literal("custom"),
1600
1600
  providerOptions: Z.optional()
1601
1601
  })
1602
1602
  ]))
1603
1603
  })
1604
- ]), Vn = X.object({
1605
- type: X.literal("tool-result"),
1606
- toolCallId: X.string(),
1607
- toolName: X.string(),
1604
+ ]), Vn = Y.object({
1605
+ type: Y.literal("tool-result"),
1606
+ toolCallId: Y.string(),
1607
+ toolName: Y.string(),
1608
1608
  output: Bn,
1609
1609
  providerOptions: Z.optional()
1610
- }), Hn = X.object({
1611
- type: X.literal("tool-approval-request"),
1612
- approvalId: X.string(),
1613
- toolCallId: X.string(),
1614
- reason: X.string().optional(),
1615
- isAutomatic: X.boolean().optional(),
1616
- signature: X.string().optional(),
1617
- inputSchemaInput: X.unknown().optional()
1618
- }), Un = X.object({
1619
- type: X.literal("tool-approval-response"),
1620
- approvalId: X.string(),
1621
- approved: X.boolean(),
1622
- reason: X.string().optional()
1623
- }), Wn = X.object({
1624
- role: X.literal("system"),
1625
- content: X.string(),
1610
+ }), Hn = Y.object({
1611
+ type: Y.literal("tool-approval-request"),
1612
+ approvalId: Y.string(),
1613
+ toolCallId: Y.string(),
1614
+ reason: Y.string().optional(),
1615
+ isAutomatic: Y.boolean().optional(),
1616
+ signature: Y.string().optional(),
1617
+ inputSchemaInput: Y.unknown().optional()
1618
+ }), Un = Y.object({
1619
+ type: Y.literal("tool-approval-response"),
1620
+ approvalId: Y.string(),
1621
+ approved: Y.boolean(),
1622
+ reason: Y.string().optional()
1623
+ }), Wn = Y.object({
1624
+ role: Y.literal("system"),
1625
+ content: Y.string(),
1626
1626
  providerOptions: Z.optional()
1627
- }), Gn = X.object({
1628
- role: X.literal("user"),
1629
- content: X.union([X.string(), X.array(X.union([
1627
+ }), Gn = Y.object({
1628
+ role: Y.literal("user"),
1629
+ content: Y.union([Y.string(), Y.array(Y.union([
1630
1630
  jn,
1631
1631
  Mn,
1632
1632
  Fn
1633
1633
  ]))]),
1634
1634
  providerOptions: Z.optional()
1635
- }), Kn = X.object({
1636
- role: X.literal("assistant"),
1637
- content: X.union([X.string(), X.array(X.union([
1635
+ }), Kn = Y.object({
1636
+ role: Y.literal("assistant"),
1637
+ content: Y.union([Y.string(), Y.array(Y.union([
1638
1638
  jn,
1639
1639
  Ln,
1640
1640
  Fn,
@@ -1645,12 +1645,12 @@ var X = {
1645
1645
  Hn
1646
1646
  ]))]),
1647
1647
  providerOptions: Z.optional()
1648
- }), qn = X.object({
1649
- role: X.literal("tool"),
1650
- content: X.array(X.union([Vn, Un])),
1648
+ }), qn = Y.object({
1649
+ role: Y.literal("tool"),
1650
+ content: Y.array(Y.union([Vn, Un])),
1651
1651
  providerOptions: Z.optional()
1652
1652
  });
1653
- X.union([
1653
+ Y.union([
1654
1654
  Wn,
1655
1655
  Gn,
1656
1656
  Kn,
@@ -1843,11 +1843,11 @@ async function Yn(e) {
1843
1843
  value: void 0,
1844
1844
  state: "undefined-input"
1845
1845
  };
1846
- let t = await gn({ text: e });
1846
+ let t = await _n({ text: e });
1847
1847
  return t.success ? {
1848
1848
  value: t.value,
1849
1849
  state: "successful-parse"
1850
- } : (t = await gn({ text: Jn(e) }), t.success ? {
1850
+ } : (t = await _n({ text: Jn(e) }), t.success ? {
1851
1851
  value: t.value,
1852
1852
  state: "repaired-parse"
1853
1853
  } : {
@@ -1855,199 +1855,199 @@ async function Yn(e) {
1855
1855
  state: "failed-parse"
1856
1856
  });
1857
1857
  }
1858
- new TextEncoder(), new TextEncoder(), I({
1858
+ new TextEncoder(), new TextEncoder(), F({
1859
1859
  prefix: "aitxt",
1860
1860
  size: 24
1861
- }), I({
1861
+ }), F({
1862
1862
  prefix: "call",
1863
1863
  size: 24
1864
1864
  }), TransformStream;
1865
- var Xn = X.object({
1866
- source: X.discriminatedUnion("sourceType", [X.object({
1867
- type: X.literal("source"),
1868
- sourceType: X.literal("url"),
1869
- id: X.string(),
1870
- url: X.string(),
1871
- title: X.string().optional(),
1865
+ var Xn = Y.object({
1866
+ source: Y.discriminatedUnion("sourceType", [Y.object({
1867
+ type: Y.literal("source"),
1868
+ sourceType: Y.literal("url"),
1869
+ id: Y.string(),
1870
+ url: Y.string(),
1871
+ title: Y.string().optional(),
1872
1872
  providerMetadata: Z.optional()
1873
- }), X.object({
1874
- type: X.literal("source"),
1875
- sourceType: X.literal("document"),
1876
- id: X.string(),
1877
- mediaType: X.string(),
1878
- title: X.string(),
1879
- filename: X.string().optional(),
1873
+ }), Y.object({
1874
+ type: Y.literal("source"),
1875
+ sourceType: Y.literal("document"),
1876
+ id: Y.string(),
1877
+ mediaType: Y.string(),
1878
+ title: Y.string(),
1879
+ filename: Y.string().optional(),
1880
1880
  providerMetadata: Z.optional()
1881
1881
  })]),
1882
- startIndex: X.number().int().nonnegative().optional(),
1883
- endIndex: X.number().int().nonnegative().optional(),
1884
- citedText: X.string().optional()
1885
- }), Zn = X.record(X.string(), On.optional()), Qn = rn(() => pn(X.union([
1886
- X.looseObject({
1887
- type: X.literal("text-start"),
1888
- id: X.string(),
1882
+ startIndex: Y.number().int().nonnegative().optional(),
1883
+ endIndex: Y.number().int().nonnegative().optional(),
1884
+ citedText: Y.string().optional()
1885
+ }), Zn = Y.record(Y.string(), X.optional()), Qn = an(() => mn(Y.union([
1886
+ Y.looseObject({
1887
+ type: Y.literal("text-start"),
1888
+ id: Y.string(),
1889
1889
  providerMetadata: Z.optional()
1890
1890
  }),
1891
- X.looseObject({
1892
- type: X.literal("text-delta"),
1893
- id: X.string(),
1894
- delta: X.string(),
1891
+ Y.looseObject({
1892
+ type: Y.literal("text-delta"),
1893
+ id: Y.string(),
1894
+ delta: Y.string(),
1895
1895
  providerMetadata: Z.optional()
1896
1896
  }),
1897
- X.looseObject({
1898
- type: X.literal("text-end"),
1899
- id: X.string(),
1900
- citations: X.array(Xn).optional(),
1897
+ Y.looseObject({
1898
+ type: Y.literal("text-end"),
1899
+ id: Y.string(),
1900
+ citations: Y.array(Xn).optional(),
1901
1901
  providerMetadata: Z.optional()
1902
1902
  }),
1903
- X.looseObject({
1904
- type: X.literal("error"),
1905
- errorText: X.string()
1903
+ Y.looseObject({
1904
+ type: Y.literal("error"),
1905
+ errorText: Y.string()
1906
1906
  }),
1907
- X.looseObject({
1908
- type: X.literal("tool-input-start"),
1909
- toolCallId: X.string(),
1910
- toolName: X.string(),
1911
- providerExecuted: X.boolean().optional(),
1907
+ Y.looseObject({
1908
+ type: Y.literal("tool-input-start"),
1909
+ toolCallId: Y.string(),
1910
+ toolName: Y.string(),
1911
+ providerExecuted: Y.boolean().optional(),
1912
1912
  providerMetadata: Z.optional(),
1913
1913
  toolMetadata: Zn.optional(),
1914
- dynamic: X.boolean().optional(),
1915
- title: X.string().optional()
1914
+ dynamic: Y.boolean().optional(),
1915
+ title: Y.string().optional()
1916
1916
  }),
1917
- X.looseObject({
1918
- type: X.literal("tool-input-delta"),
1919
- toolCallId: X.string(),
1920
- inputTextDelta: X.string()
1917
+ Y.looseObject({
1918
+ type: Y.literal("tool-input-delta"),
1919
+ toolCallId: Y.string(),
1920
+ inputTextDelta: Y.string()
1921
1921
  }),
1922
- X.looseObject({
1923
- type: X.literal("tool-input-available"),
1924
- toolCallId: X.string(),
1925
- toolName: X.string(),
1926
- input: X.unknown(),
1927
- providerExecuted: X.boolean().optional(),
1922
+ Y.looseObject({
1923
+ type: Y.literal("tool-input-available"),
1924
+ toolCallId: Y.string(),
1925
+ toolName: Y.string(),
1926
+ input: Y.unknown(),
1927
+ providerExecuted: Y.boolean().optional(),
1928
1928
  providerMetadata: Z.optional(),
1929
1929
  toolMetadata: Zn.optional(),
1930
- dynamic: X.boolean().optional(),
1931
- title: X.string().optional()
1930
+ dynamic: Y.boolean().optional(),
1931
+ title: Y.string().optional()
1932
1932
  }),
1933
- X.looseObject({
1934
- type: X.literal("tool-input-error"),
1935
- toolCallId: X.string(),
1936
- toolName: X.string(),
1937
- input: X.unknown(),
1938
- providerExecuted: X.boolean().optional(),
1933
+ Y.looseObject({
1934
+ type: Y.literal("tool-input-error"),
1935
+ toolCallId: Y.string(),
1936
+ toolName: Y.string(),
1937
+ input: Y.unknown(),
1938
+ providerExecuted: Y.boolean().optional(),
1939
1939
  providerMetadata: Z.optional(),
1940
1940
  toolMetadata: Zn.optional(),
1941
- dynamic: X.boolean().optional(),
1942
- errorText: X.string(),
1943
- title: X.string().optional()
1941
+ dynamic: Y.boolean().optional(),
1942
+ errorText: Y.string(),
1943
+ title: Y.string().optional()
1944
1944
  }),
1945
- X.looseObject({
1946
- type: X.literal("tool-approval-request"),
1947
- approvalId: X.string(),
1948
- toolCallId: X.string(),
1949
- approvalDescriptor: X.unknown().optional(),
1950
- inputSchemaInput: X.unknown().optional(),
1951
- reason: X.string().optional(),
1952
- isAutomatic: X.boolean().optional(),
1953
- signature: X.string().optional()
1945
+ Y.looseObject({
1946
+ type: Y.literal("tool-approval-request"),
1947
+ approvalId: Y.string(),
1948
+ toolCallId: Y.string(),
1949
+ approvalDescriptor: Y.unknown().optional(),
1950
+ inputSchemaInput: Y.unknown().optional(),
1951
+ reason: Y.string().optional(),
1952
+ isAutomatic: Y.boolean().optional(),
1953
+ signature: Y.string().optional()
1954
1954
  }),
1955
- X.looseObject({
1956
- type: X.literal("tool-approval-response"),
1957
- approvalId: X.string(),
1958
- approved: X.boolean(),
1959
- reason: X.string().optional(),
1960
- providerExecuted: X.boolean().optional(),
1955
+ Y.looseObject({
1956
+ type: Y.literal("tool-approval-response"),
1957
+ approvalId: Y.string(),
1958
+ approved: Y.boolean(),
1959
+ reason: Y.string().optional(),
1960
+ providerExecuted: Y.boolean().optional(),
1961
1961
  providerMetadata: Z.optional()
1962
1962
  }),
1963
- X.looseObject({
1964
- type: X.literal("tool-output-available"),
1965
- toolCallId: X.string(),
1966
- output: X.unknown(),
1967
- providerExecuted: X.boolean().optional(),
1963
+ Y.looseObject({
1964
+ type: Y.literal("tool-output-available"),
1965
+ toolCallId: Y.string(),
1966
+ output: Y.unknown(),
1967
+ providerExecuted: Y.boolean().optional(),
1968
1968
  providerMetadata: Z.optional(),
1969
1969
  toolMetadata: Zn.optional(),
1970
- dynamic: X.boolean().optional(),
1971
- preliminary: X.boolean().optional()
1970
+ dynamic: Y.boolean().optional(),
1971
+ preliminary: Y.boolean().optional()
1972
1972
  }),
1973
- X.looseObject({
1974
- type: X.literal("tool-output-error"),
1975
- toolCallId: X.string(),
1976
- errorText: X.string(),
1977
- providerExecuted: X.boolean().optional(),
1973
+ Y.looseObject({
1974
+ type: Y.literal("tool-output-error"),
1975
+ toolCallId: Y.string(),
1976
+ errorText: Y.string(),
1977
+ providerExecuted: Y.boolean().optional(),
1978
1978
  providerMetadata: Z.optional(),
1979
1979
  toolMetadata: Zn.optional(),
1980
- dynamic: X.boolean().optional()
1980
+ dynamic: Y.boolean().optional()
1981
1981
  }),
1982
- X.looseObject({
1983
- type: X.literal("tool-output-denied"),
1984
- toolCallId: X.string()
1982
+ Y.looseObject({
1983
+ type: Y.literal("tool-output-denied"),
1984
+ toolCallId: Y.string()
1985
1985
  }),
1986
- X.looseObject({
1987
- type: X.literal("reasoning-start"),
1988
- id: X.string(),
1986
+ Y.looseObject({
1987
+ type: Y.literal("reasoning-start"),
1988
+ id: Y.string(),
1989
1989
  providerMetadata: Z.optional()
1990
1990
  }),
1991
- X.looseObject({
1992
- type: X.literal("reasoning-delta"),
1993
- id: X.string(),
1994
- delta: X.string(),
1991
+ Y.looseObject({
1992
+ type: Y.literal("reasoning-delta"),
1993
+ id: Y.string(),
1994
+ delta: Y.string(),
1995
1995
  providerMetadata: Z.optional()
1996
1996
  }),
1997
- X.looseObject({
1998
- type: X.literal("reasoning-end"),
1999
- id: X.string(),
1997
+ Y.looseObject({
1998
+ type: Y.literal("reasoning-end"),
1999
+ id: Y.string(),
2000
2000
  providerMetadata: Z.optional()
2001
2001
  }),
2002
- X.looseObject({
2003
- type: X.literal("custom"),
2004
- kind: X.string().transform((e) => e),
2002
+ Y.looseObject({
2003
+ type: Y.literal("custom"),
2004
+ kind: Y.string().transform((e) => e),
2005
2005
  providerMetadata: Z.optional()
2006
2006
  }),
2007
- X.looseObject({
2008
- type: X.literal("source-url"),
2009
- sourceId: X.string(),
2010
- url: X.string(),
2011
- title: X.string().optional(),
2007
+ Y.looseObject({
2008
+ type: Y.literal("source-url"),
2009
+ sourceId: Y.string(),
2010
+ url: Y.string(),
2011
+ title: Y.string().optional(),
2012
2012
  providerMetadata: Z.optional()
2013
2013
  }),
2014
- X.looseObject({
2015
- type: X.literal("source-document"),
2016
- sourceId: X.string(),
2017
- mediaType: X.string(),
2018
- title: X.string(),
2019
- filename: X.string().optional(),
2014
+ Y.looseObject({
2015
+ type: Y.literal("source-document"),
2016
+ sourceId: Y.string(),
2017
+ mediaType: Y.string(),
2018
+ title: Y.string(),
2019
+ filename: Y.string().optional(),
2020
2020
  providerMetadata: Z.optional()
2021
2021
  }),
2022
- X.looseObject({
2023
- type: X.literal("file"),
2024
- url: X.string(),
2025
- mediaType: X.string(),
2022
+ Y.looseObject({
2023
+ type: Y.literal("file"),
2024
+ url: Y.string(),
2025
+ mediaType: Y.string(),
2026
2026
  providerMetadata: Z.optional()
2027
2027
  }),
2028
- X.looseObject({
2029
- type: X.literal("reasoning-file"),
2030
- url: X.string(),
2031
- mediaType: X.string(),
2028
+ Y.looseObject({
2029
+ type: Y.literal("reasoning-file"),
2030
+ url: Y.string(),
2031
+ mediaType: Y.string(),
2032
2032
  providerMetadata: Z.optional()
2033
2033
  }),
2034
- X.looseObject({
2035
- type: X.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2036
- id: X.string().optional(),
2037
- data: X.unknown(),
2038
- transient: X.boolean().optional()
2034
+ Y.looseObject({
2035
+ type: Y.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2036
+ id: Y.string().optional(),
2037
+ data: Y.unknown(),
2038
+ transient: Y.boolean().optional()
2039
2039
  }),
2040
- X.looseObject({ type: X.literal("start-step") }),
2041
- X.looseObject({ type: X.literal("finish-step") }),
2042
- X.looseObject({ type: X.literal("reset-step") }),
2043
- X.looseObject({
2044
- type: X.literal("start"),
2045
- messageId: X.string().optional(),
2046
- messageMetadata: X.unknown().optional()
2040
+ Y.looseObject({ type: Y.literal("start-step") }),
2041
+ Y.looseObject({ type: Y.literal("finish-step") }),
2042
+ Y.looseObject({ type: Y.literal("reset-step") }),
2043
+ Y.looseObject({
2044
+ type: Y.literal("start"),
2045
+ messageId: Y.string().optional(),
2046
+ messageMetadata: Y.unknown().optional()
2047
2047
  }),
2048
- X.looseObject({
2049
- type: X.literal("finish"),
2050
- finishReason: X.enum([
2048
+ Y.looseObject({
2049
+ type: Y.literal("finish"),
2050
+ finishReason: Y.enum([
2051
2051
  "stop",
2052
2052
  "length",
2053
2053
  "content-filter",
@@ -2055,15 +2055,15 @@ var Xn = X.object({
2055
2055
  "error",
2056
2056
  "other"
2057
2057
  ]).optional(),
2058
- messageMetadata: X.unknown().optional()
2058
+ messageMetadata: Y.unknown().optional()
2059
2059
  }),
2060
- X.looseObject({
2061
- type: X.literal("abort"),
2062
- reason: X.string().optional()
2060
+ Y.looseObject({
2061
+ type: Y.literal("abort"),
2062
+ reason: Y.string().optional()
2063
2063
  }),
2064
- X.looseObject({
2065
- type: X.literal("message-metadata"),
2066
- messageMetadata: X.unknown()
2064
+ Y.looseObject({
2065
+ type: Y.literal("message-metadata"),
2066
+ messageMetadata: Y.unknown()
2067
2067
  })
2068
2068
  ])));
2069
2069
  function $n(e) {
@@ -2134,7 +2134,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2134
2134
  }
2135
2135
  }
2136
2136
  }
2137
- if (t == null) throw new En({
2137
+ if (t == null) throw new Dn({
2138
2138
  chunkType: "tool-invocation",
2139
2139
  chunkId: e,
2140
2140
  message: `No tool invocation found for tool call ID "${e}".`
@@ -2143,7 +2143,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2143
2143
  }
2144
2144
  function h(e) {
2145
2145
  let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
2146
- if (t == null) throw new En({
2146
+ if (t == null) throw new Dn({
2147
2147
  chunkType: "tool-approval-response",
2148
2148
  chunkId: e,
2149
2149
  message: `No tool invocation found for approval ID "${e}".`
@@ -2206,8 +2206,8 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2206
2206
  }
2207
2207
  async function v(e) {
2208
2208
  if (e != null) {
2209
- let n = r.message.metadata == null ? e : Dn(r.message.metadata, e);
2210
- t != null && await mn({
2209
+ let n = r.message.metadata == null ? e : On(r.message.metadata, e);
2210
+ t != null && await hn({
2211
2211
  value: n,
2212
2212
  schema: t,
2213
2213
  context: {
@@ -2230,7 +2230,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2230
2230
  }
2231
2231
  case "text-delta": {
2232
2232
  let t = r.activeTextParts[e.id];
2233
- if (t == null) throw new En({
2233
+ if (t == null) throw new Dn({
2234
2234
  chunkType: "text-delta",
2235
2235
  chunkId: e.id,
2236
2236
  message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
@@ -2240,7 +2240,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2240
2240
  }
2241
2241
  case "text-end": {
2242
2242
  let t = r.activeTextParts[e.id];
2243
- if (t == null) throw new En({
2243
+ if (t == null) throw new Dn({
2244
2244
  chunkType: "text-end",
2245
2245
  chunkId: e.id,
2246
2246
  message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
@@ -2270,7 +2270,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2270
2270
  }
2271
2271
  case "reasoning-delta": {
2272
2272
  let t = r.activeReasoningParts[e.id];
2273
- if (t == null) throw new En({
2273
+ if (t == null) throw new Dn({
2274
2274
  chunkType: "reasoning-delta",
2275
2275
  chunkId: e.id,
2276
2276
  message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
@@ -2280,7 +2280,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2280
2280
  }
2281
2281
  case "reasoning-end": {
2282
2282
  let t = r.activeReasoningParts[e.id];
2283
- if (t == null) throw new En({
2283
+ if (t == null) throw new Dn({
2284
2284
  chunkType: "reasoning-end",
2285
2285
  chunkId: e.id,
2286
2286
  message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
@@ -2348,7 +2348,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2348
2348
  }
2349
2349
  case "tool-input-delta": {
2350
2350
  let t = r.partialToolCalls[e.toolCallId];
2351
- if (t == null) throw new En({
2351
+ if (t == null) throw new Dn({
2352
2352
  chunkType: "tool-input-delta",
2353
2353
  chunkId: e.toolCallId,
2354
2354
  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.`
@@ -2527,7 +2527,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2527
2527
  default: if ($n(e)) {
2528
2528
  if (n?.[e.type] != null) {
2529
2529
  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;
2530
- await mn({
2530
+ await hn({
2531
2531
  value: e.data,
2532
2532
  schema: n[e.type],
2533
2533
  context: {
@@ -2576,28 +2576,28 @@ function sr() {
2576
2576
  reject: t
2577
2577
  };
2578
2578
  }
2579
- I({
2579
+ F({
2580
2580
  prefix: "aitxt",
2581
2581
  size: 24
2582
- }), I({
2582
+ }), F({
2583
2583
  prefix: "call",
2584
2584
  size: 24
2585
- }), I({
2585
+ }), F({
2586
2586
  prefix: "aitxt",
2587
2587
  size: 24
2588
- }), I({
2588
+ }), F({
2589
2589
  prefix: "call",
2590
2590
  size: 24
2591
- }), X.record(X.string(), On.optional()), X.record(X.string(), X.string()), I({
2591
+ }), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), F({
2592
2592
  prefix: "call",
2593
2593
  size: 24
2594
- }), I({
2594
+ }), F({
2595
2595
  prefix: "call",
2596
2596
  size: 24
2597
- }), new TextEncoder(), I({
2597
+ }), new TextEncoder(), F({
2598
2598
  prefix: "call",
2599
2599
  size: 24
2600
- }), I({
2600
+ }), F({
2601
2601
  prefix: "aiobj",
2602
2602
  size: 24
2603
2603
  });
@@ -2633,15 +2633,15 @@ var { atob: cr } = globalThis, lr = class {
2633
2633
  });
2634
2634
  }
2635
2635
  };
2636
- I({
2636
+ F({
2637
2637
  prefix: "aiobj",
2638
2638
  size: 24
2639
- }), I({
2639
+ }), F({
2640
2640
  prefix: "call",
2641
2641
  size: 24
2642
- }), X.object({
2643
- token: X.string().refine((e) => e.trim().length > 0),
2644
- url: X.string().refine((e) => {
2642
+ }), Y.object({
2643
+ token: Y.string().refine((e) => e.trim().length > 0),
2644
+ url: Y.string().refine((e) => {
2645
2645
  try {
2646
2646
  let t = new URL(e);
2647
2647
  return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
@@ -2649,26 +2649,26 @@ I({
2649
2649
  return !1;
2650
2650
  }
2651
2651
  }),
2652
- expiresAt: X.number().positive().max(2 ** 53 - 1).optional(),
2653
- tools: X.array(X.object({
2654
- type: X.literal("function"),
2655
- name: X.string().min(1),
2656
- description: X.string().optional(),
2657
- parameters: X.record(X.string(), X.unknown())
2652
+ expiresAt: Y.number().positive().max(2 ** 53 - 1).optional(),
2653
+ tools: Y.array(Y.object({
2654
+ type: Y.literal("function"),
2655
+ name: Y.string().min(1),
2656
+ description: Y.string().optional(),
2657
+ parameters: Y.record(Y.string(), Y.unknown())
2658
2658
  })).optional()
2659
- }), I({
2659
+ }), F({
2660
2660
  prefix: "call",
2661
2661
  size: 24
2662
- }), I({
2662
+ }), F({
2663
2663
  prefix: "call",
2664
2664
  size: 24
2665
- }), I({
2665
+ }), F({
2666
2666
  prefix: "call",
2667
2667
  size: 24
2668
2668
  });
2669
2669
  async function ur({ response: e, url: t, fallbackMessage: n }) {
2670
2670
  let r = await e.text();
2671
- return new Fe({
2671
+ return new Ie({
2672
2672
  message: r || n,
2673
2673
  url: t,
2674
2674
  requestBodyValues: void 0,
@@ -2678,7 +2678,7 @@ async function ur({ response: e, url: t, fallbackMessage: n }) {
2678
2678
  }
2679
2679
  async function dr(e) {
2680
2680
  if (e == null) return [];
2681
- if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Qe({
2681
+ if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new $e({
2682
2682
  functionality: "FileList",
2683
2683
  message: "FileList is not supported in the current environment"
2684
2684
  });
@@ -2706,9 +2706,9 @@ var pr = class {
2706
2706
  this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
2707
2707
  }
2708
2708
  async sendMessages({ abortSignal: e, ...t }) {
2709
- let n = await vn(this.body), r = await vn(this.headers), i = await vn(this.credentials), a = {
2710
- ...F(r),
2711
- ...F(t.headers)
2709
+ let n = await yn(this.body), r = await yn(this.headers), i = await yn(this.credentials), a = {
2710
+ ...P(r),
2711
+ ...P(t.headers)
2712
2712
  }, o = await this.prepareSendMessagesRequest?.({
2713
2713
  api: this.api,
2714
2714
  id: t.chatId,
@@ -2722,7 +2722,7 @@ var pr = class {
2722
2722
  requestMetadata: t.metadata,
2723
2723
  trigger: t.trigger,
2724
2724
  messageId: t.messageId
2725
- }), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : F(o.headers), l = o?.body === void 0 ? {
2725
+ }), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : P(o.headers), l = o?.body === void 0 ? {
2726
2726
  ...n,
2727
2727
  ...t.body,
2728
2728
  id: t.chatId,
@@ -2744,13 +2744,13 @@ var pr = class {
2744
2744
  url: s,
2745
2745
  fallbackMessage: "Failed to fetch the chat response."
2746
2746
  });
2747
- if (!d.body) throw new Le({ message: "The response body is empty." });
2747
+ if (!d.body) throw new Re({ message: "The response body is empty." });
2748
2748
  return this.processResponseStream(d.body);
2749
2749
  }
2750
2750
  async reconnectToStream(e) {
2751
- let t = await vn(this.body), n = await vn(this.headers), r = await vn(this.credentials), i = {
2752
- ...F(n),
2753
- ...F(e.headers)
2751
+ let t = await yn(this.body), n = await yn(this.headers), r = await yn(this.credentials), i = {
2752
+ ...P(n),
2753
+ ...P(e.headers)
2754
2754
  }, a = await this.prepareReconnectToStreamRequest?.({
2755
2755
  api: this.api,
2756
2756
  id: e.chatId,
@@ -2763,14 +2763,14 @@ var pr = class {
2763
2763
  requestMetadata: e.metadata
2764
2764
  }), o = a?.api;
2765
2765
  if (o == null) {
2766
- if (e.chatId === "." || e.chatId === "..") throw new Sn({
2766
+ if (e.chatId === "." || e.chatId === "..") throw new Cn({
2767
2767
  parameter: "chatId",
2768
2768
  value: e.chatId,
2769
2769
  message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
2770
2770
  });
2771
2771
  o = fr(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
2772
2772
  }
2773
- let s = a?.headers === void 0 ? i : F(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
2773
+ let s = a?.headers === void 0 ? i : P(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
2774
2774
  method: "GET",
2775
2775
  headers: s,
2776
2776
  credentials: c,
@@ -2782,7 +2782,7 @@ var pr = class {
2782
2782
  url: o,
2783
2783
  fallbackMessage: "Failed to fetch the chat response."
2784
2784
  });
2785
- if (!l.body) throw new Le({ message: "The response body is empty." });
2785
+ if (!l.body) throw new Re({ message: "The response body is empty." });
2786
2786
  return this.processResponseStream(l.body);
2787
2787
  }
2788
2788
  }, mr = class extends pr {
@@ -2790,7 +2790,7 @@ var pr = class {
2790
2790
  super(t), this.resumeStreamIsReplay = e;
2791
2791
  }
2792
2792
  processResponseStream(e) {
2793
- return _n({
2793
+ return vn({
2794
2794
  stream: e,
2795
2795
  schema: Qn
2796
2796
  }).pipeThrough(new TransformStream({ async transform(e, t) {
@@ -2799,7 +2799,7 @@ var pr = class {
2799
2799
  } }));
2800
2800
  }
2801
2801
  }, hr = class {
2802
- constructor({ generateId: e = L, id: t = e(), transport: n = new mr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
2802
+ 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 }) {
2803
2803
  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) => {
2804
2804
  if (e == null) {
2805
2805
  let e = this.pendingApprovalMessageId;
@@ -2839,12 +2839,12 @@ var pr = class {
2839
2839
  } else n = e;
2840
2840
  if (e.messageId != null) {
2841
2841
  let t = this.state.messages.findIndex((t) => t.id === e.messageId);
2842
- if (t === -1) throw new Sn({
2842
+ if (t === -1) throw new Cn({
2843
2843
  parameter: "message.messageId",
2844
2844
  value: e.messageId,
2845
2845
  message: `message with id ${e.messageId} not found`
2846
2846
  });
2847
- if (this.state.messages[t].role !== "user") throw new Sn({
2847
+ if (this.state.messages[t].role !== "user") throw new Cn({
2848
2848
  parameter: "message.messageId",
2849
2849
  value: e.messageId,
2850
2850
  message: `message with id ${e.messageId} is not a user message`
@@ -2868,7 +2868,7 @@ var pr = class {
2868
2868
  });
2869
2869
  }, this.regenerate = async ({ messageId: e, ...t } = {}) => {
2870
2870
  let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
2871
- if (n === -1) throw new Sn({
2871
+ if (n === -1) throw new Cn({
2872
2872
  parameter: "messageId",
2873
2873
  value: e,
2874
2874
  message: `message ${e} not found`
@@ -3057,7 +3057,7 @@ var pr = class {
3057
3057
  status: "submitted",
3058
3058
  error: void 0
3059
3059
  });
3060
- let d = this.lastMessage, f = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, p = f === -1 ? d : this.state.messages[f], m = p?.id, h = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) => Q(e) && (e.state === "input-streaming" || e.state === "input-available" && e.providerExecuted || e.state === "approval-responded")) ? this.state.snapshot(p) : void 0, g = f !== -1 && f < this.state.messages.length - 1 && p?.role === "assistant", _ = !1, v = !1, y = !1, b;
3060
+ 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;
3061
3061
  try {
3062
3062
  let s = {
3063
3063
  state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : ir({
@@ -3067,7 +3067,7 @@ var pr = class {
3067
3067
  abortController: o,
3068
3068
  completionPromise: a
3069
3069
  };
3070
- b = s, s.abortController.signal.addEventListener("abort", () => {
3070
+ y = s, s.abortController.signal.addEventListener("abort", () => {
3071
3071
  _ = !0;
3072
3072
  }), this.activeResponse = s;
3073
3073
  let l;
@@ -3113,31 +3113,31 @@ var pr = class {
3113
3113
  }), _) return c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0)), null;
3114
3114
  c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0));
3115
3115
  } catch (e) {
3116
- if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === b?.state && (this.resumableStreamState = void 0)), null;
3116
+ if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === y?.state && (this.resumableStreamState = void 0)), null;
3117
3117
  if (!c()) return null;
3118
- if (y = !0, e instanceof TypeError) {
3118
+ if (ee = !0, e instanceof TypeError) {
3119
3119
  let t = e.message.toLowerCase();
3120
3120
  v = t.includes("fetch") || t.includes("network") || t === "load failed";
3121
3121
  }
3122
- v ? this.resumableStreamState = b?.state : this.resumableStreamState === b?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
3122
+ v ? this.resumableStreamState = y?.state : this.resumableStreamState === y?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
3123
3123
  status: "error",
3124
3124
  error: e
3125
3125
  });
3126
3126
  } finally {
3127
3127
  try {
3128
- b && this.onFinish?.({
3129
- message: b.state.message,
3128
+ y && this.onFinish?.({
3129
+ message: y.state.message,
3130
3130
  messages: this.state.messages,
3131
3131
  isAbort: _,
3132
3132
  isDisconnect: v,
3133
- isError: y,
3134
- finishReason: b.state.finishReason
3133
+ isError: ee,
3134
+ finishReason: y.state.finishReason
3135
3135
  });
3136
3136
  } finally {
3137
- this.activeResponse === b && (this.activeResponse = void 0), l();
3137
+ this.activeResponse === y && (this.activeResponse = void 0), l();
3138
3138
  }
3139
3139
  }
3140
- !_ && !y && await this.runAutomaticRequest(() => this.makeRequest({
3140
+ !_ && !ee && await this.runAutomaticRequest(() => this.makeRequest({
3141
3141
  trigger: "submit-message",
3142
3142
  messageId: this.lastMessage?.id,
3143
3143
  metadata: t,
@@ -3411,13 +3411,13 @@ var Ir = function(e, t, n, r) {
3411
3411
  function Lr() {
3412
3412
  for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
3413
3413
  var r, i, a = $({}, Mr), o = !1, s = !1;
3414
- if (!pe()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
3414
+ if (!me()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
3415
3415
  var c = typeof window > "u" || typeof document > "u";
3416
3416
  t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
3417
- var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : S(r);
3417
+ var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : x(r);
3418
3418
  i === void 0 && (i = a.fetcher);
3419
3419
  var d = null;
3420
- d ||= _e({
3420
+ d ||= ve({
3421
3421
  data: void 0,
3422
3422
  error: void 0,
3423
3423
  isValidating: !0,
@@ -3487,7 +3487,7 @@ function Lr() {
3487
3487
  };
3488
3488
  a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
3489
3489
  }
3490
- ge(function() {
3490
+ _e(function() {
3491
3491
  o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
3492
3492
  var e = Ar.get(u.value);
3493
3493
  e && (e.data = e.data.filter(function(e) {
@@ -3495,11 +3495,11 @@ function Lr() {
3495
3495
  }));
3496
3496
  });
3497
3497
  try {
3498
- w(u, function(e) {
3499
- me(u) || (u.value = e), d.key = e, d.isValidating = !!e, Nr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3498
+ C(u, function(e) {
3499
+ he(u) || (u.value = e), d.key = e, d.isValidating = !!e, Nr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3500
3500
  }, { immediate: !0 });
3501
3501
  } catch {}
3502
- return $($({}, ve(d)), { mutate: function(e, t) {
3502
+ return $($({}, ye(d)), { mutate: function(e, t) {
3503
3503
  return f(e, $($({}, t), { forceRevalidate: !0 }));
3504
3504
  } });
3505
3505
  }
@@ -3588,10 +3588,10 @@ var Hr = class {
3588
3588
  }
3589
3589
  };
3590
3590
  function Wr(e) {
3591
- let t = C([]), n = C("ready"), r = C(), i = C(), a;
3592
- return w(t, (e) => {
3591
+ let t = S([]), n = S("ready"), r = S(), i = S(), a;
3592
+ return C(t, (e) => {
3593
3593
  a != null && !a.isPublishing && a.setMessagesFromConsumer(e);
3594
- }, { flush: "sync" }), w(() => ye(e), (e) => {
3594
+ }, { flush: "sync" }), C(() => be(e), (e) => {
3595
3595
  a?.dispose();
3596
3596
  let { throttle: o, ...s } = e ?? {}, c = new Hr({
3597
3597
  initialMessages: s.messages ?? [],
@@ -3604,10 +3604,10 @@ function Wr(e) {
3604
3604
  ...s,
3605
3605
  state: c
3606
3606
  });
3607
- }, { immediate: !0 }), pe() != null && ge(() => {
3607
+ }, { immediate: !0 }), me() != null && _e(() => {
3608
3608
  a?.dispose();
3609
3609
  }), {
3610
- id: x(() => i.value.id),
3610
+ id: b(() => i.value.id),
3611
3611
  status: n,
3612
3612
  messages: t,
3613
3613
  error: r,
@@ -3638,36 +3638,36 @@ var Gr = "voice-", Kr = (e) => e?.role === "assistant" && e.parts.some((e) => e.
3638
3638
  }, ei = ({ messages: e }) => {
3639
3639
  let t = e[e.length - 1];
3640
3640
  if (!t || t.role !== "assistant") return !1;
3641
- 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 && (y($r(e)) || ee(e)));
3642
- return r.length > 0 && r.every((e) => oe.has(e.state ?? ""));
3641
+ 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)) || ie(e)));
3642
+ return r.length > 0 && r.every((e) => se.has(e.state ?? ""));
3643
3643
  };
3644
3644
  function ti(e) {
3645
- return Ce(`chatbot-${e}`, () => {
3646
- let { t, te: n, locale: r } = xe({ useScope: "global" }), i = S(""), a = S(), o = S(e), s = S(), c = S(), l = S(), u = S(), d = S(), f = S(), p = S(), m = S(), h = S(), g = S(), _ = S(), v = S(), y = S(), b = S(), te = S(), ie = S(), oe = C(), pe = S(0), me = S(), ge = C(), ve = C(), ye = S(), Ce = S(!1), De = S(0), je = S(), Me = S(!1), T = Se(), Ne = x(() => {
3645
+ return we(`chatbot-${e}`, () => {
3646
+ 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(), y = x(), te = x(), ae = x(), oe = x(), se = S(), me = x(0), he = x(), _e = S(), ye = S(), be = x(), we = x(!1), Oe = x(0), Me = x(), Ne = x(!1), w = Ce(), Pe = b(() => {
3647
3647
  let e = u.value?.theme;
3648
- return (!e || e === "auto") && (e = je.value), e ? e === "dark" : T.value;
3649
- }), E = x(() => c.value === "reasoning"), Pe = x(() => E.value ? g.value?.filter((e) => ![
3648
+ return (!e || e === "auto") && (e = Me.value), e ? e === "dark" : w.value;
3649
+ }), T = b(() => c.value === "reasoning"), Fe = b(() => T.value ? g.value?.filter((e) => ![
3650
3650
  "upvote",
3651
3651
  "downvote",
3652
3652
  "feedback"
3653
- ].includes(e)) : g.value), Fe = fe(x(() => `${o.value}-chatId`), null);
3654
- be(() => {
3655
- Fe.value ||= L();
3653
+ ].includes(e)) : g.value), Ie = pe(b(() => `${o.value}-chatId`), null);
3654
+ xe(() => {
3655
+ Ie.value ||= st();
3656
3656
  });
3657
- let D = x({
3658
- get: () => Fe.value,
3657
+ let E = b({
3658
+ get: () => Ie.value,
3659
3659
  set: (e) => {
3660
- Fe.value = e;
3660
+ Ie.value = e;
3661
3661
  }
3662
- }), O = de(x(() => `${o.value}-pageAccessOff`), !1), Ie = x(() => O.value ? [] : ge.value ?? []), Le = () => O.value ? [] : ve.value?.() ?? [], Re = x(() => !!(me.value && ge.value?.length)), ze = fe(x(() => `${o.value}-pageNotice`), null), Be = x(() => {
3663
- let e = me.value?.level;
3664
- return e && e !== ae.Off && Ie.value.length && !ne(ze.value ?? void 0, e) ? e : void 0;
3662
+ }), D = fe(b(() => `${o.value}-pageAccessOff`), !1), Le = b(() => D.value ? [] : _e.value ?? []), Re = () => D.value ? [] : ye.value?.() ?? [], ze = b(() => !!(he.value && _e.value?.length)), Be = pe(b(() => `${o.value}-pageNotice`), null), Ve = b(() => {
3663
+ let e = he.value?.level;
3664
+ return e && e !== re.Off && Le.value.length && !ee(Be.value ?? void 0, e) ? e : void 0;
3665
3665
  });
3666
- function Ve() {
3667
- ze.value = me.value?.level ?? null;
3666
+ function He() {
3667
+ Be.value = he.value?.level ?? null;
3668
3668
  }
3669
- let He = S(), Ue = S(!1), We = x(() => He.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3670
- function Ge(e) {
3669
+ let Ue = x(), We = x(!1), Ge = b(() => Ue.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3670
+ function Ke(e) {
3671
3671
  try {
3672
3672
  let t = JSON.parse(e.message);
3673
3673
  return t.status === 404 || t.type?.includes("entity-not-found");
@@ -3675,79 +3675,79 @@ function ti(e) {
3675
3675
  return !1;
3676
3676
  }
3677
3677
  }
3678
- function Ke(e) {
3679
- if (Ge(e)) {
3680
- let e = P.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ue(t) : void 0;
3681
- D.value = L(), He.value = void 0, he(() => {
3682
- P.value.clearError(), n && P.value.sendMessage({ text: n });
3678
+ function qe(e) {
3679
+ if (Ke(e)) {
3680
+ let e = N.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? de(t) : void 0;
3681
+ E.value = st(), Ue.value = void 0, ge(() => {
3682
+ N.value.clearError(), n && N.value.sendMessage({ text: n });
3683
3683
  });
3684
- } else ce.error(e), He.value = e, We.value && (Ue.value = !0);
3684
+ } else le.error(e), Ue.value = e, Ge.value && (We.value = !0);
3685
3685
  }
3686
- let k = x(() => se({
3686
+ let O = b(() => ce({
3687
3687
  baseUrl: i.value,
3688
3688
  basePath: a.value,
3689
3689
  headers: () => p.value
3690
- })), qe = S(null), Je = () => ({
3691
- ...we(),
3692
- ...qe.value ?? {}
3693
- }), Ye = () => {
3694
- let e = De.value;
3690
+ })), Je = x(null), Ye = () => ({
3691
+ ...Te(),
3692
+ ...Je.value ?? {}
3693
+ }), Xe = () => {
3694
+ let e = Oe.value;
3695
3695
  return new Promise((t) => {
3696
3696
  let n = setTimeout(() => {
3697
3697
  r(), t(!1);
3698
- }, 3e4), r = w(() => [De.value, P.value.status], ([i, a]) => {
3698
+ }, 3e4), r = C(() => [Oe.value, N.value.status], ([i, a]) => {
3699
3699
  i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
3700
3700
  });
3701
3701
  });
3702
- }, A = C(), Xe = (e, t) => new Promise((n) => {
3703
- A.value?.answer(!1), A.value = {
3702
+ }, k = S(), Ze = (e, t) => new Promise((n) => {
3703
+ k.value?.answer(!1), k.value = {
3704
3704
  toolCallId: e.toolCallId,
3705
3705
  question: t,
3706
3706
  answer: (e) => {
3707
- A.value = void 0, n(e);
3707
+ k.value = void 0, n(e);
3708
3708
  }
3709
3709
  };
3710
3710
  });
3711
- function Ze(e) {
3712
- A.value?.answer(e);
3711
+ function Qe(e) {
3712
+ k.value?.answer(e);
3713
3713
  }
3714
- let Qe = Ae({
3714
+ let $e = je({
3715
3715
  registry: () => [
3716
- ...(oe.value ?? []).filter((e) => !re(e.name)),
3717
- ...Ie.value,
3718
- ...Le()
3716
+ ...(se.value ?? []).filter((e) => !ne(e.name)),
3717
+ ...Le.value,
3718
+ ...Re()
3719
3719
  ],
3720
- capability: () => ie.value,
3721
- addToolOutput: (e) => void P.value.addToolOutput(e),
3722
- confirm: Xe,
3723
- waitForResume: Ye,
3720
+ capability: () => oe.value,
3721
+ addToolOutput: (e) => void N.value.addToolOutput(e),
3722
+ confirm: Ze,
3723
+ waitForResume: Xe,
3724
3724
  onPendingChange: (e) => {
3725
- pe.value = e;
3725
+ me.value = e;
3726
3726
  },
3727
3727
  onActivity: (e) => {
3728
3728
  if (e?.provider !== "page" || e.readOnly) {
3729
- ye.value = void 0;
3729
+ be.value = void 0;
3730
3730
  return;
3731
3731
  }
3732
- let t = [...Ie.value, ...Le()].find((t) => t.name === e.toolName);
3733
- ye.value = { title: t?.annotations?.title ?? e.toolName }, Ce.value = !0;
3732
+ let t = [...Le.value, ...Re()].find((t) => t.name === e.toolName);
3733
+ be.value = { title: t?.annotations?.title ?? e.toolName }, we.value = !0;
3734
3734
  }
3735
3735
  });
3736
- async function $e() {
3737
- j(), ye.value = void 0, Ce.value = !1, G.value = "", await P.value.stop();
3736
+ async function et() {
3737
+ A(), be.value = void 0, we.value = !1, U.value = "", await N.value.stop();
3738
3738
  }
3739
- function j() {
3740
- Qe.cancelAll(), A.value?.answer(!1);
3739
+ function A() {
3740
+ $e.cancelAll(), k.value?.answer(!1);
3741
3741
  }
3742
- async function et(e) {
3743
- O.value = e, e && await $e();
3742
+ async function tt(e) {
3743
+ D.value = e, e && await et();
3744
3744
  }
3745
- w(D, () => j(), { flush: "sync" });
3746
- let M = !1, N, tt = Wr(() => ({
3747
- id: D.value,
3745
+ C(E, () => A(), { flush: "sync" });
3746
+ let j = !1, M, nt = Wr(() => ({
3747
+ id: E.value,
3748
3748
  transport: new mr({
3749
- api: k.value.getChatEndpoint(o.value, E.value ? "reasoning" : "chat"),
3750
- prepareReconnectToStreamRequest: ({ id: e }) => ({ api: k.value.getChatStreamEndpoint(o.value, e) }),
3749
+ api: O.value.getChatEndpoint(o.value, T.value ? "reasoning" : "chat"),
3750
+ prepareReconnectToStreamRequest: ({ id: e }) => ({ api: O.value.getChatStreamEndpoint(o.value, e) }),
3751
3751
  prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
3752
3752
  id: t,
3753
3753
  messages: [e[e.length - 1]],
@@ -3762,15 +3762,15 @@ function ti(e) {
3762
3762
  reasoning: d.value?.reasoning,
3763
3763
  webSearch: f.value?.webSearch,
3764
3764
  smoothStream: u.value?.smoothStream,
3765
- deviceContext: Je(),
3766
- externalContext: te.value,
3765
+ deviceContext: Ye(),
3766
+ externalContext: ae.value,
3767
3767
  disabledTools: f.value?.disabled,
3768
3768
  fallbackModels: y.value,
3769
- gatewayOptions: b.value,
3770
- hostTools: ke(oe.value, ie.value),
3771
- pageTools: me.value && Ie.value.length ? {
3769
+ gatewayOptions: te.value,
3770
+ hostTools: Ae(se.value, oe.value),
3771
+ pageTools: he.value && Le.value.length ? {
3772
3772
  version: 1,
3773
- forms: Le().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3773
+ forms: Re().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3774
3774
  name: e,
3775
3775
  description: t,
3776
3776
  inputSchema: n,
@@ -3783,42 +3783,42 @@ function ti(e) {
3783
3783
  }),
3784
3784
  sendAutomaticallyWhen: (e) => ei(e) || gr(e),
3785
3785
  onError: (e) => {
3786
- M ? ce.warn(e) : Ke(e);
3786
+ j ? le.warn(e) : qe(e);
3787
3787
  },
3788
3788
  onToolCall: ({ toolCall: e }) => {
3789
- if (!Oe(e) || M) return;
3789
+ if (!ke(e) || j) return;
3790
3790
  let t = e;
3791
- Qe.enqueue({
3791
+ $e.enqueue({
3792
3792
  toolCallId: t.toolCallId,
3793
3793
  toolName: t.toolName,
3794
3794
  input: t.input,
3795
- messageId: nt()?.id ?? "",
3795
+ messageId: rt()?.id ?? "",
3796
3796
  readOnly: t.toolMetadata?.readOnly === !0,
3797
3797
  provider: t.toolMetadata?.provider === "page" ? "page" : "app"
3798
3798
  });
3799
3799
  },
3800
3800
  onData: (e) => {
3801
- e.type === "data-audioTranscripts" && (P.value.messages = le(P.value.messages, e.data));
3801
+ e.type === "data-audioTranscripts" && (N.value.messages = ue(N.value.messages, e.data));
3802
3802
  },
3803
3803
  onFinish: () => {
3804
- let e = D.value;
3805
- !E.value && !R.value.some((t) => t.id === e) && ht(o.value);
3804
+ let e = E.value;
3805
+ !T.value && !I.value.some((t) => t.id === e) && gt(o.value);
3806
3806
  }
3807
- })), P = x(() => _e(tt)), nt = () => P.value.messages[P.value.messages.length - 1];
3808
- w(D, () => {
3809
- P.value.stop();
3807
+ })), N = b(() => ve(nt)), rt = () => N.value.messages[N.value.messages.length - 1];
3808
+ C(E, () => {
3809
+ N.value.stop();
3810
3810
  }, { flush: "sync" });
3811
- let rt = x(() => {
3811
+ let it = b(() => {
3812
3812
  let e = u.value?.initialMessage;
3813
3813
  return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
3814
- }), it = L(), at = x(() => ({
3815
- id: it,
3814
+ }), at = st(), ot = b(() => ({
3815
+ id: at,
3816
3816
  role: "assistant",
3817
3817
  parts: [{
3818
3818
  type: "text",
3819
- text: rt.value
3819
+ text: it.value
3820
3820
  }]
3821
- })), F = x(() => {
3821
+ })), P = b(() => {
3822
3822
  let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
3823
3823
  ...e,
3824
3824
  parts: e.parts.map((e) => {
@@ -3828,107 +3828,107 @@ function ti(e) {
3828
3828
  let e = t.url.slice(13);
3829
3829
  return {
3830
3830
  ...t,
3831
- url: k.value.getMediaUrl(o.value, D.value, e)
3831
+ url: O.value.getMediaUrl(o.value, E.value, e)
3832
3832
  };
3833
3833
  }
3834
3834
  return t.url.startsWith("blob:") ? t : {
3835
3835
  ...t,
3836
- url: k.value.appendAuthToken(t.url)
3836
+ url: O.value.appendAuthToken(t.url)
3837
3837
  };
3838
3838
  })
3839
- }), t = P.value.id === D.value ? P.value.messages : [];
3840
- return E.value ? e(t) : !Me.value && t[0]?.role !== "assistant" ? [at.value, ...e(t)] : e(t);
3841
- }), I = x(() => {
3839
+ }), t = N.value.id === E.value ? N.value.messages : [];
3840
+ return T.value ? e(t) : !Ne.value && t[0]?.role !== "assistant" ? [ot.value, ...e(t)] : e(t);
3841
+ }), F = b(() => {
3842
3842
  let e = u.value?.messagePlaceholder;
3843
3843
  return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
3844
- }), R = S([]), ot = S(!1), z = S([]), st = S(!1), ct = S("chat"), B = S([]), V = S(), H = S(!1), lt = S(!1), ut = S(), dt = S(!1), U = S(!1), ft = S(), pt = S(""), W = S([]), G = S(""), mt = S(0);
3845
- async function ht(e) {
3846
- if (E.value) R.value = [];
3844
+ }), I = x([]), ct = x(!1), L = x([]), lt = x(!1), ut = x("chat"), R = x([]), z = x(), B = x(!1), dt = x(!1), ft = x(), pt = x(!1), V = x(!1), mt = x(), ht = x(""), H = x([]), U = x(""), W = x(0);
3845
+ async function gt(e) {
3846
+ if (T.value) I.value = [];
3847
3847
  else {
3848
- ot.value = !0;
3848
+ ct.value = !0;
3849
3849
  try {
3850
- R.value = await k.value.getConversations(e, l.value);
3850
+ I.value = await O.value.getConversations(e, l.value);
3851
3851
  } catch {
3852
- R.value = [];
3852
+ I.value = [];
3853
3853
  } finally {
3854
- ot.value = !1;
3854
+ ct.value = !1;
3855
3855
  }
3856
3856
  }
3857
3857
  }
3858
- async function gt() {
3859
- let e = D.value;
3860
- if (!e) z.value = [];
3858
+ async function _t() {
3859
+ let e = E.value;
3860
+ if (!e) L.value = [];
3861
3861
  else {
3862
- st.value = !0;
3862
+ lt.value = !0;
3863
3863
  try {
3864
- z.value = await k.value.getChatFiles(e);
3864
+ L.value = await O.value.getChatFiles(e);
3865
3865
  } catch {
3866
- z.value = [];
3866
+ L.value = [];
3867
3867
  } finally {
3868
- st.value = !1;
3868
+ lt.value = !1;
3869
3869
  }
3870
3870
  }
3871
3871
  }
3872
- function _t(e, t = !1) {
3873
- return k.value.getChatFileDownloadUrl(e, t);
3872
+ function vt(e, t = !1) {
3873
+ return O.value.getChatFileDownloadUrl(e, t);
3874
3874
  }
3875
- function vt(e) {
3876
- return k.value.getChatFilePreviewUrl(e);
3875
+ function yt(e) {
3876
+ return O.value.getChatFilePreviewUrl(e);
3877
3877
  }
3878
- async function yt(e) {
3879
- await k.value.deleteChatFile(e);
3880
- let t = z.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
3881
- z.value = z.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
3878
+ async function bt(e) {
3879
+ await O.value.deleteChatFile(e);
3880
+ let t = L.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
3881
+ L.value = L.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
3882
3882
  }
3883
- async function bt(e, t) {
3884
- if (!E.value) try {
3885
- let n = await k.value.getChat(e, t);
3886
- if (t !== D.value || P.value.status !== "ready" || P.value.messages.length > 0) return;
3887
- n && (P.value.messages = n.messages, Ue.value = n.blocked ?? !1, xt(e, t, n.turnInProgress === !0));
3883
+ async function xt(e, t) {
3884
+ if (!T.value) try {
3885
+ let n = await O.value.getChat(e, t);
3886
+ if (t !== E.value || N.value.status !== "ready" || N.value.messages.length > 0) return;
3887
+ n && (N.value.messages = n.messages, We.value = n.blocked ?? !1, St(e, t, n.turnInProgress === !0));
3888
3888
  } catch {}
3889
3889
  }
3890
- async function xt(e, t, n) {
3891
- n && (await St(t), t !== D.value || K()) || await Ct(e, t);
3890
+ async function St(e, t, n) {
3891
+ n && (await Ct(t), t !== E.value || G()) || await wt(e, t);
3892
3892
  }
3893
- async function St(e) {
3893
+ async function Ct(e) {
3894
3894
  let t = { chatId: e };
3895
- N = t;
3896
- let n = () => N === t && e === D.value, r = Date.now() + Zr;
3895
+ M = t;
3896
+ let n = () => M === t && e === E.value, r = Date.now() + Zr;
3897
3897
  try {
3898
- for (; n() && !K() && Date.now() < r;) {
3899
- M = !0;
3898
+ for (; n() && !G() && Date.now() < r;) {
3899
+ j = !0;
3900
3900
  try {
3901
- await P.value.resumeStream();
3901
+ await N.value.resumeStream();
3902
3902
  } finally {
3903
- M = !1;
3903
+ j = !1;
3904
3904
  }
3905
3905
  if (!n()) return;
3906
- P.value.clearError();
3907
- let t = await k.value.getChat(o.value, e).catch(() => null);
3908
- if (!t || !n() || K()) return;
3906
+ N.value.clearError();
3907
+ let t = await O.value.getChat(o.value, e).catch(() => null);
3908
+ if (!t || !n() || G()) return;
3909
3909
  if (!t.turnInProgress) {
3910
- P.value.messages = t.messages;
3910
+ N.value.messages = t.messages;
3911
3911
  return;
3912
3912
  }
3913
3913
  await new Promise((e) => setTimeout(e, Qr));
3914
3914
  }
3915
3915
  } finally {
3916
- N === t && (N = void 0);
3916
+ M === t && (M = void 0);
3917
3917
  }
3918
3918
  }
3919
- async function Ct(e, t) {
3919
+ async function wt(e, t) {
3920
3920
  let n;
3921
3921
  try {
3922
- n = Number(sessionStorage.getItem(Ee)), sessionStorage.removeItem(Ee);
3922
+ n = Number(sessionStorage.getItem(De)), sessionStorage.removeItem(De);
3923
3923
  } catch {
3924
3924
  return;
3925
3925
  }
3926
- if (!(!n || Date.now() - n > 6e4 || O.value)) for (let n = 0; n < 12; n++) {
3927
- let n = P.value.messages[P.value.messages.length - 1];
3926
+ if (!(!n || Date.now() - n > 6e4 || D.value)) for (let n = 0; n < 12; n++) {
3927
+ let n = N.value.messages[N.value.messages.length - 1];
3928
3928
  if (n?.role === "assistant") {
3929
- let e = n.parts.filter((e) => ee(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
3929
+ let e = n.parts.filter((e) => ie(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
3930
3930
  if (e.length > 0) {
3931
- if (t.length === e.length && !O.value) for (let e of t) Qe.enqueue({
3931
+ if (t.length === e.length && !D.value) for (let e of t) $e.enqueue({
3932
3932
  toolCallId: e.toolCallId,
3933
3933
  toolName: e.toolName,
3934
3934
  input: e.input,
@@ -3940,254 +3940,254 @@ function ti(e) {
3940
3940
  }
3941
3941
  if (n.parts[n.parts.length - 1]?.type === "text") return;
3942
3942
  }
3943
- if (await new Promise((e) => setTimeout(e, 1500)), t !== D.value || P.value.status !== "ready") return;
3943
+ if (await new Promise((e) => setTimeout(e, 1500)), t !== E.value || N.value.status !== "ready") return;
3944
3944
  try {
3945
- let n = await k.value.getChat(e, t);
3946
- n && t === D.value && (P.value.messages = n.messages);
3945
+ let n = await O.value.getChat(e, t);
3946
+ n && t === E.value && (N.value.messages = n.messages);
3947
3947
  } catch {
3948
3948
  return;
3949
3949
  }
3950
3950
  }
3951
3951
  }
3952
- let K = () => {
3953
- let e = P.value.status;
3952
+ let G = () => {
3953
+ let e = N.value.status;
3954
3954
  return e === "submitted" || e === "streaming";
3955
- }, wt = 0, Tt = 0;
3956
- async function Et() {
3957
- if (E.value || K()) return "indeterminate";
3958
- let e = D.value, t = wt += 1;
3955
+ }, Tt = 0, Et = 0;
3956
+ async function Dt() {
3957
+ if (T.value || G()) return "indeterminate";
3958
+ let e = E.value, t = Tt += 1;
3959
3959
  try {
3960
- let n = await k.value.getChat(o.value, e);
3961
- if (!n || e !== D.value || K() || t <= Tt) return "indeterminate";
3962
- Tt = t;
3963
- let r = n.messages, i = Xr(r, P.value.messages);
3964
- return P.value.messages = [...r, ...i], Ue.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3960
+ let n = await O.value.getChat(o.value, e);
3961
+ if (!n || e !== E.value || G() || t <= Et) return "indeterminate";
3962
+ Et = t;
3963
+ let r = n.messages, i = Xr(r, N.value.messages);
3964
+ return N.value.messages = [...r, ...i], We.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3965
3965
  } catch {}
3966
3966
  return "indeterminate";
3967
3967
  }
3968
- function Dt(e) {
3969
- P.value.messages = [...P.value.messages, e];
3968
+ function Ot(e) {
3969
+ N.value.messages = [...N.value.messages, e];
3970
3970
  }
3971
- async function q(e) {
3971
+ async function K(e) {
3972
3972
  try {
3973
- B.value = await k.value.getMessageFeedbacks(e);
3973
+ R.value = await O.value.getMessageFeedbacks(e);
3974
3974
  } catch {
3975
- B.value = [];
3975
+ R.value = [];
3976
3976
  }
3977
3977
  }
3978
- function J(e) {
3979
- let t = B.value.findIndex((t) => t.messageId === e.messageId);
3980
- t >= 0 ? B.value[t] = e : B.value.push(e);
3978
+ function q(e) {
3979
+ let t = R.value.findIndex((t) => t.messageId === e.messageId);
3980
+ t >= 0 ? R.value[t] = e : R.value.push(e);
3981
3981
  }
3982
- function Ot(e) {
3983
- let t = F.value, n = t.findIndex((t) => t.id === e.id), r = ue(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3982
+ function kt(e) {
3983
+ let t = P.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3984
3984
  return {
3985
- userQuestion: ue(i ?? e) ?? "",
3985
+ userQuestion: de(i ?? e) ?? "",
3986
3986
  assistantMessage: r
3987
3987
  };
3988
3988
  }
3989
- async function kt(e, t) {
3989
+ async function At(e, t) {
3990
3990
  await Promise.all([
3991
- bt(e, t),
3992
- ht(e),
3993
- q(t)
3994
- ]), qe.value || Te((e, t) => k.value.reverseGeocode(e, t, r.value)).then((e) => {
3995
- e && (qe.value = e);
3991
+ xt(e, t),
3992
+ gt(e),
3993
+ K(t)
3994
+ ]), Je.value || Ee((e, t) => O.value.reverseGeocode(e, t, r.value)).then((e) => {
3995
+ e && (Je.value = e);
3996
3996
  });
3997
3997
  }
3998
- async function At() {
3999
- let e = pt.value.trim(), t = W.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3998
+ async function jt() {
3999
+ let e = ht.value.trim(), t = H.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
4000
4000
  type: "file",
4001
4001
  mediaType: e.mediaSource.mimeType,
4002
4002
  url: e.localUrl,
4003
4003
  filename: e.mediaSource.name,
4004
4004
  providerMetadata: { "8bot": { media: e.mediaSource } }
4005
4005
  }));
4006
- E.value && F.value.length > 0 && await Lt(), j(), G.value = e, mt.value = P.value.messages.length;
4007
- let n = P.value.sendMessage;
4006
+ T.value && P.value.length > 0 && await Rt(), A(), U.value = e, W.value = N.value.messages.length;
4007
+ let n = N.value.sendMessage;
4008
4008
  n({
4009
4009
  text: e,
4010
4010
  files: t.length > 0 ? t : void 0
4011
- }), pt.value = "", It();
4011
+ }), ht.value = "", Lt();
4012
4012
  }
4013
- function jt(e) {
4013
+ function Mt(e) {
4014
4014
  let t = e.trim();
4015
4015
  if (!t) return;
4016
- if (P.value.status !== "ready") {
4017
- ce.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
4016
+ if (N.value.status !== "ready") {
4017
+ le.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
4018
4018
  return;
4019
4019
  }
4020
- let n = P.value.sendMessage;
4021
- j(), n({ text: t });
4020
+ let n = N.value.sendMessage;
4021
+ A(), n({ text: t });
4022
4022
  }
4023
- async function Mt() {
4024
- let e = P.value.messages.slice(mt.value).some((e) => e.parts.some(ee)), t = G.value, n = t.length > 0 && !e, r = D.value, i = mt.value, a = N?.chatId === r;
4025
- N = void 0, j(), await P.value.stop();
4026
- let s = E.value || e && !a || await k.value.stopChatTurn(o.value, r).catch(() => !0);
4027
- r !== D.value || K() || mt.value !== i || ((a || !s) && (await Et(), a || P.value.messages.length > mt.value) ? G.value = "" : n && (pt.value = t, P.value.messages = P.value.messages.slice(0, mt.value), G.value = ""));
4023
+ async function Nt() {
4024
+ let e = N.value.messages.slice(W.value).some((e) => e.parts.some(ie)), t = U.value, n = t.length > 0 && !e, r = E.value, i = W.value, a = M?.chatId === r;
4025
+ M = void 0, A(), await N.value.stop();
4026
+ let s = T.value || e && !a || await O.value.stopChatTurn(o.value, r).catch(() => !0);
4027
+ r !== E.value || G() || W.value !== i || ((a || !s) && (await Dt(), a || N.value.messages.length > W.value) ? U.value = "" : n && (ht.value = t, N.value.messages = N.value.messages.slice(0, W.value), U.value = ""));
4028
4028
  }
4029
- w(() => P.value.messages, (e) => {
4030
- let t = A.value?.toolCallId;
4031
- t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && j();
4032
- }), w(() => P.value.status, (e) => {
4033
- e === "submitted" && De.value++;
4029
+ C(() => N.value.messages, (e) => {
4030
+ let t = k.value?.toolCallId;
4031
+ t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && A();
4032
+ }), C(() => N.value.status, (e) => {
4033
+ e === "submitted" && Oe.value++;
4034
4034
  });
4035
- let Nt;
4036
- w(() => [P.value.status, pe.value], ([e, t]) => {
4037
- clearTimeout(Nt), e === "ready" && t === 0 && (Nt = setTimeout(() => {
4038
- Ce.value = !1;
4035
+ let Pt;
4036
+ C(() => [N.value.status, me.value], ([e, t]) => {
4037
+ clearTimeout(Pt), e === "ready" && t === 0 && (Pt = setTimeout(() => {
4038
+ we.value = !1;
4039
4039
  }, 1500));
4040
4040
  });
4041
- let Pt = S(!1), Ft;
4042
- w(() => !A.value && !Kr(nt()) && (K() || pe.value > 0), (e) => {
4043
- clearTimeout(Ft), e ? Pt.value = !0 : Ft = setTimeout(() => {
4044
- Pt.value = !1;
4041
+ let Ft = x(!1), It;
4042
+ C(() => !k.value && !Kr(rt()) && (G() || me.value > 0), (e) => {
4043
+ clearTimeout(It), e ? Ft.value = !0 : It = setTimeout(() => {
4044
+ Ft.value = !1;
4045
4045
  }, 400);
4046
- }, { immediate: !0 }), w(() => P.value.status, (e) => {
4047
- e === "ready" && G.value.length > 0 && (G.value = "");
4046
+ }, { immediate: !0 }), C(() => N.value.status, (e) => {
4047
+ e === "ready" && U.value.length > 0 && (U.value = "");
4048
4048
  });
4049
- function It(e = !1) {
4050
- for (let t of W.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4051
- W.value = [], Kt.value = null;
4049
+ function Lt(e = !1) {
4050
+ for (let t of H.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4051
+ H.value = [], qt.value = null;
4052
4052
  }
4053
- async function Lt() {
4054
- return G.value = "", D.value = L(), await he(), P.value.clearError(), He.value = void 0, Ue.value = !1, It(!0), nn("chat"), D.value;
4053
+ async function Rt() {
4054
+ return U.value = "", E.value = st(), await ge(), N.value.clearError(), Ue.value = void 0, We.value = !1, Lt(!0), rn("chat"), E.value;
4055
4055
  }
4056
- async function Rt(e) {
4057
- P.value.status !== "ready" && (G.value = "", await Mt()), j(), await P.value.regenerate(e);
4056
+ async function zt(e) {
4057
+ N.value.status !== "ready" && (U.value = "", await Nt()), A(), await N.value.regenerate(e);
4058
4058
  }
4059
- function zt(e) {
4059
+ function Bt(e) {
4060
4060
  if (e.tool === "requestGeolocation") {
4061
4061
  let t = e.output;
4062
- "latitude" in t && (qe.value = {
4062
+ "latitude" in t && (Je.value = {
4063
4063
  geolocationLatitude: t.latitude,
4064
4064
  geolocationLongitude: t.longitude,
4065
4065
  geolocationAccuracy: t.accuracy,
4066
4066
  geolocationCity: t.city
4067
4067
  });
4068
4068
  }
4069
- P.value.addToolOutput(e);
4069
+ N.value.addToolOutput(e);
4070
4070
  }
4071
- function Bt(e) {
4072
- P.value.addToolApprovalResponse(e);
4071
+ function Vt(e) {
4072
+ N.value.addToolApprovalResponse(e);
4073
4073
  }
4074
- let Vt = x(() => P.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Ht = x(() => _.value?.maxFilesPerMessage ?? 5), Ut = x(() => _.value?.maxFilesPerChat ?? 20), Wt = x(() => Math.max(0, Math.min(Ht.value - W.value.length, Ut.value - Vt.value - W.value.length))), Gt = x(() => Wt.value <= 0), Kt = S(null), qt = () => {
4075
- Kt.value = null;
4074
+ let Ht = b(() => N.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Ut = b(() => _.value?.maxFilesPerMessage ?? 5), Wt = b(() => _.value?.maxFilesPerChat ?? 20), Gt = b(() => Math.max(0, Math.min(Ut.value - H.value.length, Wt.value - Ht.value - H.value.length))), Kt = b(() => Gt.value <= 0), qt = x(null), Jt = () => {
4075
+ qt.value = null;
4076
4076
  };
4077
- w(Gt, (e) => {
4078
- e || (Kt.value = null);
4077
+ C(Kt, (e) => {
4078
+ e || (qt.value = null);
4079
4079
  });
4080
- async function Jt(e) {
4081
- if (Gt.value) {
4082
- Kt.value = Ut.value - Vt.value - W.value.length <= Ht.value - W.value.length ? {
4080
+ async function Yt(e) {
4081
+ if (Kt.value) {
4082
+ qt.value = Wt.value - Ht.value - H.value.length <= Ut.value - H.value.length ? {
4083
4083
  reason: "per-chat",
4084
- max: Ut.value
4084
+ max: Wt.value
4085
4085
  } : {
4086
4086
  reason: "per-message",
4087
- max: Ht.value
4087
+ max: Ut.value
4088
4088
  };
4089
4089
  return;
4090
4090
  }
4091
- let t = L(), n = {
4091
+ let t = st(), n = {
4092
4092
  id: t,
4093
4093
  file: e,
4094
4094
  localUrl: URL.createObjectURL(e),
4095
4095
  state: "uploading"
4096
4096
  };
4097
- W.value = [...W.value, n];
4097
+ H.value = [...H.value, n];
4098
4098
  try {
4099
- let n = await k.value.uploadMedia(o.value, D.value, e);
4100
- W.value = W.value.map((e) => e.id === t ? {
4099
+ let n = await O.value.uploadMedia(o.value, E.value, e);
4100
+ H.value = H.value.map((e) => e.id === t ? {
4101
4101
  ...e,
4102
4102
  state: "done",
4103
4103
  mediaSource: n
4104
4104
  } : e);
4105
4105
  } catch (e) {
4106
4106
  let n = e instanceof Error ? e.message : "Upload failed";
4107
- W.value = W.value.map((e) => e.id === t ? {
4107
+ H.value = H.value.map((e) => e.id === t ? {
4108
4108
  ...e,
4109
4109
  state: "error",
4110
4110
  error: n
4111
4111
  } : e);
4112
4112
  }
4113
4113
  }
4114
- async function Yt(e, t) {
4115
- let { userQuestion: n, assistantMessage: r } = Ot(e);
4116
- J(await k.value.submitMessageFeedback({
4114
+ async function Xt(e, t) {
4115
+ let { userQuestion: n, assistantMessage: r } = kt(e);
4116
+ q(await O.value.submitMessageFeedback({
4117
4117
  messageId: e.id,
4118
- chatId: D.value,
4118
+ chatId: E.value,
4119
4119
  agentId: o.value,
4120
4120
  vote: t,
4121
4121
  userQuestion: n,
4122
4122
  assistantMessage: r
4123
4123
  }));
4124
4124
  }
4125
- async function Xt(e) {
4126
- await Yt(e, "upvote");
4127
- }
4128
4125
  async function Zt(e) {
4129
- await Yt(e, "downvote");
4130
- }
4131
- function Y(e) {
4132
- lt.value = !1, ut.value = void 0, V.value = e;
4126
+ await Xt(e, "upvote");
4133
4127
  }
4134
4128
  async function Qt(e) {
4135
- if (V.value) try {
4136
- H.value = !0, lt.value = !1, ut.value = void 0;
4137
- let { userQuestion: t, assistantMessage: n } = Ot(V.value);
4138
- J(await k.value.submitMessageFeedback({
4139
- messageId: V.value.id,
4140
- chatId: D.value,
4129
+ await Xt(e, "downvote");
4130
+ }
4131
+ function J(e) {
4132
+ dt.value = !1, ft.value = void 0, z.value = e;
4133
+ }
4134
+ async function $t(e) {
4135
+ if (z.value) try {
4136
+ B.value = !0, dt.value = !1, ft.value = void 0;
4137
+ let { userQuestion: t, assistantMessage: n } = kt(z.value);
4138
+ q(await O.value.submitMessageFeedback({
4139
+ messageId: z.value.id,
4140
+ chatId: E.value,
4141
4141
  agentId: o.value,
4142
4142
  userQuestion: t,
4143
4143
  assistantMessage: n,
4144
4144
  comment: e
4145
- })), lt.value = !0, await q(D.value);
4145
+ })), dt.value = !0, await K(E.value);
4146
4146
  } catch {
4147
- ut.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4147
+ ft.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4148
4148
  } finally {
4149
- H.value = !1;
4149
+ B.value = !1;
4150
4150
  }
4151
4151
  }
4152
- async function $t(e) {
4152
+ async function en(e) {
4153
4153
  try {
4154
- U.value = !0, dt.value = !1, ft.value = void 0, await k.value.submitLead({
4154
+ V.value = !0, pt.value = !1, mt.value = void 0, await O.value.submitLead({
4155
4155
  agentId: o.value,
4156
- chatId: D.value,
4156
+ chatId: E.value,
4157
4157
  ...e
4158
- }), dt.value = !0;
4158
+ }), pt.value = !0;
4159
4159
  } catch {
4160
- ft.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4160
+ mt.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4161
4161
  } finally {
4162
- U.value = !1;
4162
+ V.value = !1;
4163
4163
  }
4164
4164
  }
4165
- async function en(e, t) {
4166
- let n = await k.value.updateChatTitle(o.value, e, t);
4167
- R.value = R.value.map((t) => t.id === e ? {
4165
+ async function tn(e, t) {
4166
+ let n = await O.value.updateChatTitle(o.value, e, t);
4167
+ I.value = I.value.map((t) => t.id === e ? {
4168
4168
  ...t,
4169
4169
  title: n.title
4170
4170
  } : t);
4171
4171
  }
4172
- async function tn(e) {
4173
- await k.value.deleteChat(o.value, e), R.value = R.value.filter((t) => t.id !== e), D.value === e && await Lt();
4172
+ async function nn(e) {
4173
+ await O.value.deleteChat(o.value, e), I.value = I.value.filter((t) => t.id !== e), E.value === e && await Rt();
4174
4174
  }
4175
- function nn(e) {
4176
- ct.value = e;
4175
+ function rn(e) {
4176
+ ut.value = e;
4177
4177
  }
4178
- let rn;
4179
- function an(e) {
4180
- let t = () => k.value.getChat(o.value, e).then((e) => e !== null);
4178
+ let an;
4179
+ function on(e) {
4180
+ let t = () => O.value.getChat(o.value, e).then((e) => e !== null);
4181
4181
  return t().catch(() => t().catch(() => !1));
4182
4182
  }
4183
- return w(l, async (e) => {
4184
- if (!e || e === rn) return;
4185
- let t = rn;
4186
- if (rn = e, t === void 0) return;
4187
- let n = D.value, r = !E.value && await an(n);
4188
- l.value === e && D.value === n && (r ? ht(o.value) : (R.value = [], B.value = [], z.value = [], await Lt(), pt.value = ""));
4183
+ return C(l, async (e) => {
4184
+ if (!e || e === an) return;
4185
+ let t = an;
4186
+ if (an = e, t === void 0) return;
4187
+ let n = E.value, r = !T.value && await on(n);
4188
+ l.value === e && E.value === n && (r ? gt(o.value) : (I.value = [], R.value = [], L.value = [], await Rt(), ht.value = ""));
4189
4189
  }), {
4190
- apiClient: k,
4190
+ apiClient: O,
4191
4191
  baseUrl: i,
4192
4192
  basePath: a,
4193
4193
  agentId: o,
@@ -4201,86 +4201,86 @@ function ti(e) {
4201
4201
  revisedAnswers: m,
4202
4202
  model: h,
4203
4203
  actionsInput: g,
4204
- actions: Pe,
4204
+ actions: Fe,
4205
4205
  agentFileUpload: _,
4206
4206
  agentVoice: v,
4207
4207
  fallbackModels: y,
4208
- gatewayOptions: b,
4209
- externalContext: te,
4210
- agentHostTools: ie,
4211
- hostToolRegistry: oe,
4212
- hostToolsPending: pe,
4213
- agentPageAccess: me,
4214
- pageToolRegistry: ge,
4215
- pageFormsProvider: ve,
4216
- pageAction: ye,
4217
- pageControlActive: Ce,
4218
- isWorking: Pt,
4219
- stopHostActions: $e,
4220
- pageNoticeLevel: Be,
4221
- closePageNotice: Ve,
4222
- hostConfirmation: A,
4223
- respondHostConfirmation: Ze,
4224
- pageAccessAvailable: Re,
4225
- pageAccessOff: O,
4226
- setPageAccessOff: et,
4227
- systemTheme: je,
4228
- hideWelcomeMessage: Me,
4229
- isDark: Ne,
4230
- chat: P,
4231
- messages: F,
4232
- conversations: R,
4233
- isLoadingConversations: ot,
4234
- chatFiles: z,
4235
- isLoadingChatFiles: st,
4236
- input: pt,
4237
- pendingAttachments: W,
4238
- isAttachmentLimitReached: Gt,
4239
- fileLimitError: Kt,
4240
- localChatId: D,
4241
- isConversationBlocked: Ue,
4242
- inputMessagePlaceholder: I,
4243
- chatError: He,
4244
- activeView: ct,
4245
- messageFeedbacks: B,
4246
- feedbackDialogMessage: V,
4247
- isFeedbackSubmitting: H,
4248
- isFeedbackSubmitted: lt,
4249
- feedbackSubmitError: ut,
4250
- isLeadSubmitted: dt,
4251
- isLoadingSubmitLead: U,
4252
- submitLeadError: ft,
4253
- buildDeviceContext: Je,
4254
- initialize: kt,
4255
- loadConversations: ht,
4256
- loadChatFiles: gt,
4257
- refreshMessages: Et,
4258
- appendMessage: Dt,
4259
- getChatFileUrl: _t,
4260
- getChatFilePreviewUrl: vt,
4261
- deleteChatFile: yt,
4262
- handleSubmit: At,
4263
- sendMessage: jt,
4264
- stopGeneration: Mt,
4265
- startNewChat: Lt,
4266
- regenerate: Rt,
4267
- addToolOutput: zt,
4268
- addToolApprovalResponse: Bt,
4269
- handleFileSelect: Jt,
4270
- clearFileLimitError: qt,
4271
- clearPendingAttachments: It,
4272
- onUpvote: Xt,
4273
- onDownvote: Zt,
4274
- onFeedback: Y,
4275
- onFeedbackSubmit: Qt,
4276
- onLeadSubmit: $t,
4277
- navigate: nn,
4278
- renameChatTitle: en,
4279
- deleteChat: tn
4208
+ gatewayOptions: te,
4209
+ externalContext: ae,
4210
+ agentHostTools: oe,
4211
+ hostToolRegistry: se,
4212
+ hostToolsPending: me,
4213
+ agentPageAccess: he,
4214
+ pageToolRegistry: _e,
4215
+ pageFormsProvider: ye,
4216
+ pageAction: be,
4217
+ pageControlActive: we,
4218
+ isWorking: Ft,
4219
+ stopHostActions: et,
4220
+ pageNoticeLevel: Ve,
4221
+ closePageNotice: He,
4222
+ hostConfirmation: k,
4223
+ respondHostConfirmation: Qe,
4224
+ pageAccessAvailable: ze,
4225
+ pageAccessOff: D,
4226
+ setPageAccessOff: tt,
4227
+ systemTheme: Me,
4228
+ hideWelcomeMessage: Ne,
4229
+ isDark: Pe,
4230
+ chat: N,
4231
+ messages: P,
4232
+ conversations: I,
4233
+ isLoadingConversations: ct,
4234
+ chatFiles: L,
4235
+ isLoadingChatFiles: lt,
4236
+ input: ht,
4237
+ pendingAttachments: H,
4238
+ isAttachmentLimitReached: Kt,
4239
+ fileLimitError: qt,
4240
+ localChatId: E,
4241
+ isConversationBlocked: We,
4242
+ inputMessagePlaceholder: F,
4243
+ chatError: Ue,
4244
+ activeView: ut,
4245
+ messageFeedbacks: R,
4246
+ feedbackDialogMessage: z,
4247
+ isFeedbackSubmitting: B,
4248
+ isFeedbackSubmitted: dt,
4249
+ feedbackSubmitError: ft,
4250
+ isLeadSubmitted: pt,
4251
+ isLoadingSubmitLead: V,
4252
+ submitLeadError: mt,
4253
+ buildDeviceContext: Ye,
4254
+ initialize: At,
4255
+ loadConversations: gt,
4256
+ loadChatFiles: _t,
4257
+ refreshMessages: Dt,
4258
+ appendMessage: Ot,
4259
+ getChatFileUrl: vt,
4260
+ getChatFilePreviewUrl: yt,
4261
+ deleteChatFile: bt,
4262
+ handleSubmit: jt,
4263
+ sendMessage: Mt,
4264
+ stopGeneration: Nt,
4265
+ startNewChat: Rt,
4266
+ regenerate: zt,
4267
+ addToolOutput: Bt,
4268
+ addToolApprovalResponse: Vt,
4269
+ handleFileSelect: Yt,
4270
+ clearFileLimitError: Jt,
4271
+ clearPendingAttachments: Lt,
4272
+ onUpvote: Zt,
4273
+ onDownvote: Qt,
4274
+ onFeedback: J,
4275
+ onFeedbackSubmit: $t,
4276
+ onLeadSubmit: en,
4277
+ navigate: rn,
4278
+ renameChatTitle: tn,
4279
+ deleteChat: nn
4280
4280
  };
4281
4281
  })();
4282
4282
  }
4283
4283
  //#endregion
4284
- export { L as a, mr as i, ti as n, Wr as r, Gr as t };
4284
+ export { st as a, mr as i, ti as n, Wr as r, Gr as t };
4285
4285
 
4286
- //# sourceMappingURL=useChatbotStore-KjeThRAo.js.map
4286
+ //# sourceMappingURL=useChatbotStore-BliRphuB.js.map