@8wave/ai-elements 0.121.0-beta.4 → 0.121.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/_chunks/{Agent-BYC51e6E.js → Agent-7rbrjWzu.js} +64 -58
  2. package/dist/_chunks/Agent-7rbrjWzu.js.map +1 -0
  3. package/dist/_chunks/{PkStreamingMarkdown-CNoHyTuC.js → PkStreamingMarkdown-BnClGp-3.js} +826 -831
  4. package/dist/_chunks/PkStreamingMarkdown-BnClGp-3.js.map +1 -0
  5. package/dist/_chunks/{PkToolEditSpreadsheet-B8bO3vZa.js → PkToolEditSpreadsheet-D4M6BUKx.js} +2 -2
  6. package/dist/_chunks/{PkToolEditSpreadsheet-B8bO3vZa.js.map → PkToolEditSpreadsheet-D4M6BUKx.js.map} +1 -1
  7. package/dist/_chunks/{PkToolRequestGeolocation-DrvL0h9d.js → PkToolRequestGeolocation-DmOoFghZ.js} +2 -2
  8. package/dist/_chunks/{PkToolRequestGeolocation-DrvL0h9d.js.map → PkToolRequestGeolocation-DmOoFghZ.js.map} +1 -1
  9. package/dist/_chunks/{PkToolRequestOAuthConnection-BXti5Vkt.js → PkToolRequestOAuthConnection-DV0sfojC.js} +2 -2
  10. package/dist/_chunks/{PkToolRequestOAuthConnection-BXti5Vkt.js.map → PkToolRequestOAuthConnection-DV0sfojC.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowArtifact-DR71LNck.js → PkToolShowArtifact-V0a8zhdO.js} +2 -2
  12. package/dist/_chunks/{PkToolShowArtifact-DR71LNck.js.map → PkToolShowArtifact-V0a8zhdO.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowContactForm-C4BshHSs.js → PkToolShowContactForm-sLhBxf9e.js} +2 -2
  14. package/dist/_chunks/{PkToolShowContactForm-C4BshHSs.js.map → PkToolShowContactForm-sLhBxf9e.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowForm-BLSTn0xE.js → PkToolShowForm-Dl2k9jqk.js} +3 -3
  16. package/dist/_chunks/{PkToolShowForm-BLSTn0xE.js.map → PkToolShowForm-Dl2k9jqk.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowImageGallery-CqOXbo0Y.js → PkToolShowImageGallery-CTsq_DPb.js} +2 -2
  18. package/dist/_chunks/{PkToolShowImageGallery-CqOXbo0Y.js.map → PkToolShowImageGallery-CTsq_DPb.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowProductList-westY5bY.js → PkToolShowProductList-CpdKWQkP.js} +2 -2
  20. package/dist/_chunks/{PkToolShowProductList-westY5bY.js.map → PkToolShowProductList-CpdKWQkP.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowSources-Dy9VXRgv.js → PkToolShowSources-WFm2JF0r.js} +3 -3
  22. package/dist/_chunks/{PkToolShowSources-Dy9VXRgv.js.map → PkToolShowSources-WFm2JF0r.js.map} +1 -1
  23. package/dist/_chunks/{PkToolShowSuggestedReply-BZ2U3ULB.js → PkToolShowSuggestedReply-RcL_3RAz.js} +2 -2
  24. package/dist/_chunks/{PkToolShowSuggestedReply-BZ2U3ULB.js.map → PkToolShowSuggestedReply-RcL_3RAz.js.map} +1 -1
  25. package/dist/_chunks/{PkToolShowVideo-CrFaQbMp.js → PkToolShowVideo-Ua5heyl1.js} +2 -2
  26. package/dist/_chunks/{PkToolShowVideo-CrFaQbMp.js.map → PkToolShowVideo-Ua5heyl1.js.map} +1 -1
  27. package/dist/_chunks/{PkToolShowWebPages-DXszshY9.js → PkToolShowWebPages-STOCnsKm.js} +2 -2
  28. package/dist/_chunks/{PkToolShowWebPages-DXszshY9.js.map → PkToolShowWebPages-STOCnsKm.js.map} +1 -1
  29. package/dist/_chunks/{chatImagePolicy-B5-QV037.js → chatImagePolicy-C8X_GMnS.js} +2 -2
  30. package/dist/_chunks/{chatImagePolicy-B5-QV037.js.map → chatImagePolicy-C8X_GMnS.js.map} +1 -1
  31. package/dist/_chunks/{markdown-DO_FLvlJ.js → markdown-EqEd3eyd.js} +10 -10
  32. package/dist/_chunks/{markdown-DO_FLvlJ.js.map → markdown-EqEd3eyd.js.map} +1 -1
  33. package/dist/ai-elements.es.js +1572 -1572
  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-2DVqpLwz.js → Agent-SH2vEFKs.js} +63 -57
  47. package/dist-vue/_chunks/Agent-SH2vEFKs.js.map +1 -0
  48. package/dist-vue/_chunks/{Document-ChfbOVVs.js → Document-fmCxsccF.js} +10 -10
  49. package/dist-vue/_chunks/{Document-ChfbOVVs.js.map → Document-fmCxsccF.js.map} +1 -1
  50. package/dist-vue/_chunks/{PkChatbot-DsZ8mAbt.js → PkChatbot-DlIEIjKJ.js} +8 -8
  51. package/dist-vue/_chunks/{PkChatbot-DsZ8mAbt.js.map → PkChatbot-DlIEIjKJ.js.map} +1 -1
  52. package/dist-vue/_chunks/{PkChatbotEmptyState-DqzgF4vH.js → PkChatbotEmptyState-Bcozn56E.js} +2 -2
  53. package/dist-vue/_chunks/{PkChatbotEmptyState-DqzgF4vH.js.map → PkChatbotEmptyState-Bcozn56E.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkChatbotInput-BRhIG8HR.js → PkChatbotInput-DQVpDLNp.js} +2 -2
  55. package/dist-vue/_chunks/{PkChatbotInput-BRhIG8HR.js.map → PkChatbotInput-DQVpDLNp.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkChatbotMessages-WryjcyH7.js → PkChatbotMessages-BYFozlwC.js} +17 -17
  57. package/dist-vue/_chunks/{PkChatbotMessages-WryjcyH7.js.map → PkChatbotMessages-BYFozlwC.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkChatbotStepPayload-Bga_HEps.js → PkChatbotStepPayload-DjntsSlX.js} +2 -2
  59. package/dist-vue/_chunks/{PkChatbotStepPayload-Bga_HEps.js.map → PkChatbotStepPayload-DjntsSlX.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkChatbotStepToolDetail-YbUYP-Y3.js → PkChatbotStepToolDetail-If9goNdY.js} +3 -3
  61. package/dist-vue/_chunks/{PkChatbotStepToolDetail-YbUYP-Y3.js.map → PkChatbotStepToolDetail-If9goNdY.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkChatbotSteps-CVAkaIzk.js → PkChatbotSteps-DUFfniZn.js} +5 -5
  63. package/dist-vue/_chunks/{PkChatbotSteps-CVAkaIzk.js.map → PkChatbotSteps-DUFfniZn.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkChatbotViewChat-B1gbdvs1.js → PkChatbotViewChat-BGoltDr9.js} +7 -7
  65. package/dist-vue/_chunks/{PkChatbotViewChat-B1gbdvs1.js.map → PkChatbotViewChat-BGoltDr9.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkChatbotViewConversations-BHvHF0w7.js → PkChatbotViewConversations-WUpRm6GG.js} +3 -3
  67. package/dist-vue/_chunks/{PkChatbotViewConversations-BHvHF0w7.js.map → PkChatbotViewConversations-WUpRm6GG.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkChatbotViewFiles-C-4__qj_.js → PkChatbotViewFiles-CpG_LRg6.js} +3 -3
  69. package/dist-vue/_chunks/{PkChatbotViewFiles-C-4__qj_.js.map → PkChatbotViewFiles-CpG_LRg6.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkChatbotViewProfile-_WMSVDlA.js → PkChatbotViewProfile-DetQJa7E.js} +2 -2
  71. package/dist-vue/_chunks/{PkChatbotViewProfile-_WMSVDlA.js.map → PkChatbotViewProfile-DetQJa7E.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkStreamingMarkdown-6Y7qgbvS.js → PkStreamingMarkdown-DLKEIMcZ.js} +3 -3
  73. package/dist-vue/_chunks/{PkStreamingMarkdown-6Y7qgbvS.js.map → PkStreamingMarkdown-DLKEIMcZ.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolEditSpreadsheet-BTauPyXT.js → PkToolEditSpreadsheet-D2JtjXef.js} +2 -2
  75. package/dist-vue/_chunks/{PkToolEditSpreadsheet-BTauPyXT.js.map → PkToolEditSpreadsheet-D2JtjXef.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolRequestGeolocation-DBzup6bn.js → PkToolRequestGeolocation--MTT__Vu.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolRequestGeolocation-DBzup6bn.js.map → PkToolRequestGeolocation--MTT__Vu.js.map} +1 -1
  78. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-yrRDpNqp.js → PkToolRequestOAuthConnection-Gb_qfvlN.js} +2 -2
  79. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-yrRDpNqp.js.map → PkToolRequestOAuthConnection-Gb_qfvlN.js.map} +1 -1
  80. package/dist-vue/_chunks/{PkToolShowArtifact-fp37O1om.js → PkToolShowArtifact-BWVntj9H.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolShowArtifact-fp37O1om.js.map → PkToolShowArtifact-BWVntj9H.js.map} +1 -1
  82. package/dist-vue/_chunks/{PkToolShowContactForm-iSx2ioyT.js → PkToolShowContactForm-BbBt3ha0.js} +2 -2
  83. package/dist-vue/_chunks/{PkToolShowContactForm-iSx2ioyT.js.map → PkToolShowContactForm-BbBt3ha0.js.map} +1 -1
  84. package/dist-vue/_chunks/{PkToolShowDiagram-BlKrh4gK.js → PkToolShowDiagram-CE6KHz1M.js} +2 -2
  85. package/dist-vue/_chunks/{PkToolShowDiagram-BlKrh4gK.js.map → PkToolShowDiagram-CE6KHz1M.js.map} +1 -1
  86. package/dist-vue/_chunks/{PkToolShowForm-CwlXH13N.js → PkToolShowForm-CNm8HSUW.js} +4 -4
  87. package/dist-vue/_chunks/{PkToolShowForm-CwlXH13N.js.map → PkToolShowForm-CNm8HSUW.js.map} +1 -1
  88. package/dist-vue/_chunks/{PkToolShowImageGallery-C4esYiM_.js → PkToolShowImageGallery-6k3ituoi.js} +2 -2
  89. package/dist-vue/_chunks/{PkToolShowImageGallery-C4esYiM_.js.map → PkToolShowImageGallery-6k3ituoi.js.map} +1 -1
  90. package/dist-vue/_chunks/{PkToolShowProductList-CdeYQ-mF.js → PkToolShowProductList-Bu-pUg5d.js} +2 -2
  91. package/dist-vue/_chunks/{PkToolShowProductList-CdeYQ-mF.js.map → PkToolShowProductList-Bu-pUg5d.js.map} +1 -1
  92. package/dist-vue/_chunks/{PkToolShowSources-D8IF7g0d.js → PkToolShowSources-DTWNZqWu.js} +3 -3
  93. package/dist-vue/_chunks/{PkToolShowSources-D8IF7g0d.js.map → PkToolShowSources-DTWNZqWu.js.map} +1 -1
  94. package/dist-vue/_chunks/{PkToolShowSuggestedReply-DXyO8ki2.js → PkToolShowSuggestedReply-DSXhqWhx.js} +2 -2
  95. package/dist-vue/_chunks/{PkToolShowSuggestedReply-DXyO8ki2.js.map → PkToolShowSuggestedReply-DSXhqWhx.js.map} +1 -1
  96. package/dist-vue/_chunks/{PkToolShowVideo-CA7MNSp_.js → PkToolShowVideo-C0ycBiOI.js} +2 -2
  97. package/dist-vue/_chunks/{PkToolShowVideo-CA7MNSp_.js.map → PkToolShowVideo-C0ycBiOI.js.map} +1 -1
  98. package/dist-vue/_chunks/{PkToolShowWebPages-CKWnAbp8.js → PkToolShowWebPages-CWWv1tr5.js} +2 -2
  99. package/dist-vue/_chunks/{PkToolShowWebPages-CKWnAbp8.js.map → PkToolShowWebPages-CWWv1tr5.js.map} +1 -1
  100. package/dist-vue/_chunks/{createChatbotApiClient-DecVahlB.js → createChatbotApiClient-MbfcTdwY.js} +16 -16
  101. package/dist-vue/_chunks/{createChatbotApiClient-DecVahlB.js.map → createChatbotApiClient-MbfcTdwY.js.map} +1 -1
  102. package/dist-vue/_chunks/{useChatbotStore-BQTq8fq-.js → useChatbotStore-DDSgrRzg.js} +1143 -1143
  103. package/dist-vue/_chunks/{useChatbotStore-BQTq8fq-.js.map → useChatbotStore-DDSgrRzg.js.map} +1 -1
  104. package/dist-vue/_chunks/{utils-BLMOBcka.js → utils-B9-Vt10H.js} +35 -40
  105. package/dist-vue/_chunks/utils-B9-Vt10H.js.map +1 -0
  106. package/dist-vue/api.js +1 -1
  107. package/dist-vue/composables.js +6 -6
  108. package/dist-vue/composables.js.map +1 -1
  109. package/dist-vue/index.js +4212 -4204
  110. package/dist-vue/index.js.map +1 -1
  111. package/dist-vue/locales.js +8 -2
  112. package/dist-vue/packages/components/src/chat/PkWebSearchSettings.d.ts +2 -0
  113. package/dist-vue/packages/models/src/schema/Agent.d.ts +14 -0
  114. package/package.json +1 -1
  115. package/dist/_chunks/Agent-BYC51e6E.js.map +0 -1
  116. package/dist/_chunks/PkStreamingMarkdown-CNoHyTuC.js.map +0 -1
  117. package/dist-vue/_chunks/Agent-2DVqpLwz.js.map +0 -1
  118. package/dist-vue/_chunks/utils-BLMOBcka.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 { B as ee, G as y, H as te, K as ne, P as re, R as ie, W as ae, q as oe } from "./Agent-2DVqpLwz.js";
3
- import { r as se, t as ce } from "./createChatbotApiClient-DecVahlB.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, onScopeDispose as ge, reactive as _e, ref as x, shallowRef as ve, toRefs as ye, watch as S, 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 { 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-SH2vEFKs.js";
3
+ import { r as oe, t as se } from "./createChatbotApiClient-MbfcTdwY.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 S, onScopeDispose as me, reactive as he, ref as C, shallowRef as ge, toRefs as _e, watch as w, watchEffect as ve } from "vue";
8
+ import { useI18n as ye } from "vue-i18n";
9
+ import { usePreferredDark as be } from "@vueuse/core";
10
+ import { defineStore as xe } from "pinia";
11
11
  //#region ../../packages/utils/src/device-context.ts
12
- function we() {
12
+ function Se() {
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 Ce(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 === y, ke = (e, t) => {
61
+ var we = "agentstudio:page-navigation", Te = (e) => typeof e?.afterOutput == "function", Ee = (e) => e.toolMetadata?.source === te, De = (e, t) => {
62
62
  if (!t || !e?.length) return;
63
- let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !ee(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) && !re(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
64
64
  return r.length > 0 ? r : void 0;
65
65
  };
66
- function Ae(e) {
66
+ function Oe(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, ne(n.readOnly));
82
+ c(n, ie(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, ae);
97
+ c(n, b);
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
+ Te(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 ? ne(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
119
+ c(n, t ? ie(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), C = class e extends Error {
140
+ var ke = "vercel.ai.error", Ae = Symbol.for(ke), T = 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[Ae] = !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, ke);
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", w = `vercel.ai.error.${Ne}`, Pe = Symbol.for(w), Fe = class extends C {
151
+ }, je = "AI_APICallError", E = `vercel.ai.error.${je}`, Me = Symbol.for(E), Ne = class extends T {
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: je,
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[Me] = !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 C.hasMarker(e, w);
160
+ return T.hasMarker(e, E);
161
161
  }
162
- }, T = "AI_EmptyResponseBodyError", E = `vercel.ai.error.${T}`, Ie = Symbol.for(E), Le = class extends C {
162
+ }, D = "AI_EmptyResponseBodyError", O = `vercel.ai.error.${D}`, Pe = Symbol.for(O), Fe = class extends T {
163
163
  constructor({ message: e = "Empty response body" } = {}) {
164
164
  super({
165
- name: T,
165
+ name: D,
166
166
  message: e
167
- }), this[Ie] = !0;
167
+ }), this[Pe] = !0;
168
168
  }
169
169
  static isInstance(e) {
170
- return C.hasMarker(e, E);
170
+ return T.hasMarker(e, O);
171
171
  }
172
172
  };
173
- function Re(e) {
173
+ function Ie(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), D = class extends C {
176
+ var Le = "AI_InvalidArgumentError", Re = `vercel.ai.error.${Le}`, ze = Symbol.for(Re), Be = class extends T {
177
177
  constructor({ message: e, cause: t, argument: n }) {
178
178
  super({
179
- name: ze,
179
+ name: Le,
180
180
  message: e,
181
181
  cause: t
182
- }), this[Ve] = !0, this.argument = n;
182
+ }), this[ze] = !0, this.argument = n;
183
183
  }
184
184
  static isInstance(e) {
185
- return C.hasMarker(e, Be);
185
+ return T.hasMarker(e, Re);
186
186
  }
187
- }, O = "AI_JSONParseError", He = `vercel.ai.error.${O}`, Ue = Symbol.for(He), We = class extends C {
187
+ }, k = "AI_JSONParseError", Ve = `vercel.ai.error.${k}`, He = Symbol.for(Ve), Ue = class extends T {
188
188
  constructor({ text: e, cause: t }) {
189
189
  super({
190
- name: O,
191
- message: `JSON parsing failed: Text: ${e}.\nError message: ${Re(t)}`,
190
+ name: k,
191
+ message: `JSON parsing failed: Text: ${e}.\nError message: ${Ie(t)}`,
192
192
  cause: t
193
- }), this[Ue] = !0, this.text = e;
193
+ }), this[He] = !0, this.text = e;
194
194
  }
195
195
  static isInstance(e) {
196
- return C.hasMarker(e, He);
196
+ return T.hasMarker(e, Ve);
197
197
  }
198
- }, k = "AI_TypeValidationError", Ge = `vercel.ai.error.${k}`, Ke = Symbol.for(Ge), qe = class e extends C {
198
+ }, A = "AI_TypeValidationError", We = `vercel.ai.error.${A}`, Ge = Symbol.for(We), Ke = class e extends T {
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: A,
208
+ message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${Ie(t)}`,
209
209
  cause: t
210
- }), this[Ke] = !0, this.value = e, this.context = n;
210
+ }), this[Ge] = !0, this.value = e, this.context = n;
211
211
  }
212
212
  static isInstance(e) {
213
- return C.hasMarker(e, Ge);
213
+ return T.hasMarker(e, We);
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", Je = `vercel.ai.error.${A}`, Ye = Symbol.for(Je), Xe = class extends C {
222
+ }, j = "AI_UnsupportedFunctionalityError", qe = `vercel.ai.error.${j}`, Je = Symbol.for(qe), Ye = class extends T {
223
223
  constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
224
224
  super({
225
- name: A,
225
+ name: j,
226
226
  message: t
227
- }), this[Ye] = !0, this.functionality = e;
227
+ }), this[Je] = !0, this.functionality = e;
228
228
  }
229
229
  static isInstance(e) {
230
- return C.hasMarker(e, Je);
230
+ return T.hasMarker(e, qe);
231
231
  }
232
- }, Ze = class extends Error {
232
+ }, Xe = 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, Qe = 13, M = 32;
237
- function $e(e) {}
238
- function et(e) {
236
+ }, M = 10, Ze = 13, N = 32;
237
+ function Qe(e) {}
238
+ function $e(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 = $e, onError: n = $e, onRetry: r = $e, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
240
+ let { onEvent: t = Qe, onError: n = Qe, onRetry: r = Qe, 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 et(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 Ze(`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 Xe(`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 et(e) {
272
272
  continue;
273
273
  }
274
274
  let i = e.charCodeAt(n);
275
- if (tt(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 (et(e, n, i)) {
276
+ let i = e.charCodeAt(n + 5) === N ? n + 6 : n + 5, a = e.slice(i, r);
277
+ if (d === 0 && e.charCodeAt(r + 1) === M) {
278
278
  t({
279
279
  id: l,
280
280
  event: f,
@@ -284,7 +284,7 @@ function et(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 tt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === N ? 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) === Qe && e.charCodeAt(n) === j && n++;
295
+ _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === Ze && e.charCodeAt(n) === M && n++;
296
296
  }
297
297
  return e.slice(n);
298
298
  }
299
299
  function _(e, t, n) {
300
300
  if (t === n) {
301
- ee();
301
+ y();
302
302
  return;
303
303
  }
304
304
  let r = e.charCodeAt(t);
305
- if (tt(e, t, r)) {
306
- let r = e.charCodeAt(t + 5) === M ? t + 6 : t + 5, i = e.slice(r, n);
305
+ if (et(e, t, r)) {
306
+ let r = e.charCodeAt(t + 5) === N ? 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 (tt(e, t, r)) {
312
+ f = e.slice(e.charCodeAt(t + 6) === N ? 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) === N ? 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) === N ? 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) === N ? 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 Ze(`Invalid \`retry\` value: "${t}"`, {
348
+ /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Xe(`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 Ze(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
354
+ default: n(new Xe(`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 ee() {
362
+ function y() {
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 y(e = {}) {
369
+ function b(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: y
378
+ reset: b
379
379
  };
380
380
  }
381
- function tt(e, t, n) {
381
+ function et(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 tt(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 nt = 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 = et({
394
+ i = $e({
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: N, atob: it } = globalThis;
414
- function P(e) {
413
+ var { btoa: P, atob: rt } = globalThis;
414
+ function F(e) {
415
415
  if (e == null) return {};
416
416
  let t = {};
417
417
  if (e instanceof Headers) e.forEach((e, n) => {
@@ -423,26 +423,26 @@ function P(e) {
423
423
  }
424
424
  return t;
425
425
  }
426
- var F = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
426
+ var I = ({ 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 D({
433
+ if (n.includes(r)) throw new Be({
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
- }, I = F();
439
- function at(e) {
438
+ }, L = I();
439
+ function it(e) {
440
440
  return globalThis.Buffer?.isBuffer(e) ?? !1;
441
441
  }
442
- var L = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, R = /"(?: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*:/;
442
+ var R = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, at = /"(?: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
443
  function ot(e) {
444
444
  let t = JSON.parse(e);
445
- return typeof t != "object" || !t || L.test(e) === !1 && R.test(e) === !1 ? t : st(t);
445
+ return typeof t != "object" || !t || R.test(e) === !1 && at.test(e) === !1 ? t : st(t);
446
446
  }
447
447
  function st(e) {
448
448
  let t = [e];
@@ -472,22 +472,22 @@ function ct(e) {
472
472
  Error.stackTraceLimit = t;
473
473
  }
474
474
  }
475
- function z(e) {
475
+ function lt(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" && B(t);
478
+ e.additionalProperties = t != null && typeof t != "boolean" && z(t);
479
479
  let { properties: n } = e;
480
- if (n != null) for (let e of Object.keys(n)) n[e] = B(n[e]);
480
+ if (n != null) for (let e of Object.keys(n)) n[e] = z(n[e]);
481
481
  }
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));
482
+ e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(z) : z(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(z)), e.allOf != null && (e.allOf = e.allOf.map(z)), e.oneOf != null && (e.oneOf = e.oneOf.map(z));
483
483
  let { definitions: t } = e;
484
- if (t != null) for (let e of Object.keys(t)) t[e] = B(t[e]);
484
+ if (t != null) for (let e of Object.keys(t)) t[e] = z(t[e]);
485
485
  return e;
486
486
  }
487
- function B(e) {
488
- return typeof e == "boolean" ? e : z(e);
487
+ function z(e) {
488
+ return typeof e == "boolean" ? e : lt(e);
489
489
  }
490
- var lt = Symbol("Let zodToJsonSchema decide on which parser to use"), V = {
490
+ var ut = Symbol("Let zodToJsonSchema decide on which parser to use"), B = {
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"), V = {
507
507
  emailStrategy: "format:email",
508
508
  base64Strategy: "contentEncoding:base64",
509
509
  nameStrategy: "ref"
510
- }, H = (e) => typeof e == "string" ? {
511
- ...V,
510
+ }, V = (e) => typeof e == "string" ? {
511
+ ...B,
512
512
  name: e
513
513
  } : {
514
- ...V,
514
+ ...B,
515
515
  ...e
516
516
  };
517
- function U() {
517
+ function H() {
518
518
  return {};
519
519
  }
520
- function ut(e, t) {
520
+ function dt(e, t) {
521
521
  let n = { type: "array" };
522
- return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = q(e.type._def, {
522
+ return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = K(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 dt(e) {
527
+ function ft(e) {
528
528
  let t = {
529
529
  type: "integer",
530
530
  format: "int64"
@@ -541,16 +541,16 @@ function dt(e) {
541
541
  }
542
542
  return t;
543
543
  }
544
- function ft() {
544
+ function pt() {
545
545
  return { type: "boolean" };
546
546
  }
547
- function pt(e, t) {
548
- return q(e.type._def, t);
547
+ function mt(e, t) {
548
+ return K(e.type._def, t);
549
549
  }
550
- var mt = (e, t) => q(e.innerType._def, t);
551
- function ht(e, t, n) {
550
+ var ht = (e, t) => K(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
- ...q(e.innerType._def, t),
582
+ ...K(e.innerType._def, t),
583
583
  default: e.defaultValue()
584
584
  };
585
585
  }
586
- function vt(e, t) {
587
- return t.effectStrategy === "input" ? q(e.schema._def, t) : U();
586
+ function yt(e, t) {
587
+ return t.effectStrategy === "input" ? K(e.schema._def, t) : H();
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 = [q(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 = [K(e.left._def, {
598
598
  ...t,
599
599
  currentPath: [
600
600
  ...t.currentPath,
601
601
  "allOf",
602
602
  "0"
603
603
  ]
604
- }), q(e.right._def, {
604
+ }), K(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, W = {
631
+ var wt = void 0, U = {
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, W = {
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
- G(n, "email", r.message, t);
659
+ W(n, "email", r.message, t);
660
660
  break;
661
661
  case "format:idn-email":
662
- G(n, "idn-email", r.message, t);
662
+ W(n, "idn-email", r.message, t);
663
663
  break;
664
- case "pattern:zod": K(n, W.email, r.message, t);
664
+ case "pattern:zod": G(n, U.email, r.message, t);
665
665
  }
666
666
  break;
667
667
  case "url":
668
- G(n, "uri", r.message, t);
668
+ W(n, "uri", r.message, t);
669
669
  break;
670
670
  case "uuid":
671
- G(n, "uuid", r.message, t);
671
+ W(n, "uuid", r.message, t);
672
672
  break;
673
673
  case "regex":
674
- K(n, r.regex, r.message, t);
674
+ G(n, r.regex, r.message, t);
675
675
  break;
676
676
  case "cuid":
677
- K(n, W.cuid, r.message, t);
677
+ G(n, U.cuid, r.message, t);
678
678
  break;
679
679
  case "cuid2":
680
- K(n, W.cuid2, r.message, t);
680
+ G(n, U.cuid2, r.message, t);
681
681
  break;
682
682
  case "startsWith":
683
- K(n, RegExp(`^${Tt(r.value, t)}`), r.message, t);
683
+ G(n, RegExp(`^${Et(r.value, t)}`), r.message, t);
684
684
  break;
685
685
  case "endsWith":
686
- K(n, RegExp(`${Tt(r.value, t)}$`), r.message, t);
686
+ G(n, RegExp(`${Et(r.value, t)}$`), r.message, t);
687
687
  break;
688
688
  case "datetime":
689
- G(n, "date-time", r.message, t);
689
+ W(n, "date-time", r.message, t);
690
690
  break;
691
691
  case "date":
692
- G(n, "date", r.message, t);
692
+ W(n, "date", r.message, t);
693
693
  break;
694
694
  case "time":
695
- G(n, "time", r.message, t);
695
+ W(n, "time", r.message, t);
696
696
  break;
697
697
  case "duration":
698
- G(n, "duration", r.message, t);
698
+ W(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
- K(n, RegExp(Tt(r.value, t)), r.message, t);
704
+ G(n, RegExp(Et(r.value, t)), r.message, t);
705
705
  break;
706
706
  case "ip":
707
- r.version !== "v6" && G(n, "ipv4", r.message, t), r.version !== "v4" && G(n, "ipv6", r.message, t);
707
+ r.version !== "v6" && W(n, "ipv4", r.message, t), r.version !== "v4" && W(n, "ipv6", r.message, t);
708
708
  break;
709
709
  case "base64url":
710
- K(n, W.base64url, r.message, t);
710
+ G(n, U.base64url, r.message, t);
711
711
  break;
712
712
  case "jwt":
713
- K(n, W.jwt, r.message, t);
713
+ G(n, U.jwt, r.message, t);
714
714
  break;
715
715
  case "cidr":
716
- r.version !== "v6" && K(n, W.ipv4Cidr, r.message, t), r.version !== "v4" && K(n, W.ipv6Cidr, r.message, t);
716
+ r.version !== "v6" && G(n, U.ipv4Cidr, r.message, t), r.version !== "v4" && G(n, U.ipv6Cidr, r.message, t);
717
717
  break;
718
718
  case "emoji":
719
- K(n, W.emoji(), r.message, t);
719
+ G(n, U.emoji(), r.message, t);
720
720
  break;
721
721
  case "ulid":
722
- K(n, W.ulid, r.message, t);
722
+ G(n, U.ulid, r.message, t);
723
723
  break;
724
724
  case "base64":
725
725
  switch (t.base64Strategy) {
726
726
  case "format:binary":
727
- G(n, "binary", r.message, t);
727
+ W(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": K(n, W.base64, r.message, t);
732
+ case "pattern:zod": G(n, U.base64, r.message, t);
733
733
  }
734
734
  break;
735
- case "nanoid": K(n, W.nanoid, r.message, t);
735
+ case "nanoid": G(n, U.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 G(e, t, n, r) {
748
+ function W(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 K(e, t, n, r) {
754
+ function G(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: q(e.valueType._def, {
802
+ additionalProperties: K(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 } = pt(e.keyType._def, t);
819
+ let { type: r, ...i } = mt(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: [q(e.keyType._def, {
833
+ items: [K(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(), q(e.valueType._def, {
841
+ }) || H(), K(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
+ }) || H()],
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: H() };
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) => q(e._def, {
909
+ var Lt = (e, t) => {
910
+ let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => K(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 = q(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 = K(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 = q(a._def, {
963
+ let o = Ht(a), s = K(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 q(e.catchall._def, {
982
+ function Vt(e, t) {
983
+ if (e.catchall._def.typeName !== "ZodNever") return K(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 q(e.innerType._def, t);
1002
- let n = q(e.innerType._def, {
1000
+ var Ut = (e, t) => {
1001
+ if (t.currentPath.toString() === t.propertyPath?.toString()) return K(e.innerType._def, t);
1002
+ let n = K(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 q(e.in._def, t);
1013
- if (t.pipeStrategy === "output") return q(e.out._def, t);
1014
- let n = q(e.in._def, {
1010
+ return n ? { anyOf: [{ not: H() }, n] } : H();
1011
+ }, Wt = (e, t) => {
1012
+ if (t.pipeStrategy === "input") return K(e.in._def, t);
1013
+ if (t.pipeStrategy === "output") return K(e.out._def, t);
1014
+ let n = K(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, q(e.out._def, {
1022
+ return { allOf: [n, K(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 q(e.type._def, t);
1033
- }
1034
1031
  function Gt(e, t) {
1032
+ return K(e.type._def, t);
1033
+ }
1034
+ function Kt(e, t) {
1035
1035
  let n = {
1036
1036
  type: "array",
1037
1037
  uniqueItems: !0,
1038
- items: q(e.valueType._def, {
1038
+ items: K(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) => q(e._def, {
1049
+ items: e.items.map((e, n) => K(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: q(e.rest._def, {
1057
+ additionalItems: K(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) => q(e._def, {
1065
+ items: e.items.map((e, n) => K(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: H() };
1080
1077
  }
1081
- var Yt = (e, t) => q(e.innerType._def, t), Xt = (e, t, n) => {
1078
+ function Yt() {
1079
+ return H();
1080
+ }
1081
+ var Xt = (e, t) => K(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 dt(e);
1087
- case "ZodBoolean": return ft();
1088
- case "ZodDate": return ht(e, n);
1089
- case "ZodUndefined": return qt();
1090
- case "ZodNull": return Nt();
1091
- case "ZodArray": return ut(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 ft(e);
1087
+ case "ZodBoolean": return pt();
1088
+ case "ZodDate": return gt(e, n);
1089
+ case "ZodUndefined": return Jt();
1090
+ case "ZodNull": return Pt();
1091
+ case "ZodArray": return dt(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 pt(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 H();
1110
+ case "ZodUnknown": return Yt();
1111
+ case "ZodDefault": return vt(e, n);
1112
+ case "ZodBranded": return mt(e, n);
1113
+ case "ZodReadonly": return Xt(e, n);
1114
+ case "ZodCatch": return ht(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) => q(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 q(e, t, n = !1) {
1128
+ function K(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 !== ut) 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 q(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" ? q(a(), t) : a;
1145
- if (o && $t(e, t, o), t.postProcess) {
1144
+ let a = Zt(e, e.typeName, t), o = typeof a == "function" ? K(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`), H()) : t.$refStrategy === "seen" ? H() : void 0;
1157
1157
  }
1158
- }, $t = (e, t, n) => (e.description && (n.description = e.description), n), en = (e) => {
1159
- let t = H(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 = V(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]: q(r._def, {
1181
+ [t]: K(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 = q(e._def, i === void 0 ? n : {
1188
+ }, !0) ?? H()
1189
+ }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = K(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) ?? H(), 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 z(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 lt(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 qe({
1249
+ error: new Ke({
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(() => z(n(e, {
1274
+ return on(() => lt(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 qe.wrap({
1301
+ if (!r.success) throw Ke.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: qe.wrap({
1323
+ error: Ke.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: qe.wrap({
1333
+ error: Ke.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
1344
  let n = ct(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: We.isInstance(t) ? t : new We({
1356
+ error: Ue.isInstance(t) ? t : new Ue({
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 nt()).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 C {
1378
+ var bn = "AI_InvalidArgumentError", xn = `vercel.ai.error.${bn}`, Sn = Symbol.for(xn), Cn = class extends T {
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 C.hasMarker(e, bn);
1386
+ return T.hasMarker(e, xn);
1387
1387
  }
1388
- }, Cn = "AI_UIMessageStreamError", wn = `vercel.ai.error.${Cn}`, Tn = Symbol.for(wn), J = class extends C {
1388
+ }, wn = "AI_UIMessageStreamError", Tn = `vercel.ai.error.${wn}`, En = Symbol.for(Tn), q = class extends T {
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 C.hasMarker(e, wn);
1396
+ return T.hasMarker(e, Tn);
1397
1397
  }
1398
1398
  };
1399
- function En(e, t) {
1399
+ function Dn(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 En(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 ? En(a, i) : i;
1408
+ n[r] = o && s ? Dn(a, i) : i;
1409
1409
  }
1410
1410
  return n;
1411
1411
  }
1412
- var Y = {
1412
+ var J = {
1413
1413
  array: d,
1414
1414
  boolean: m,
1415
1415
  custom: l,
@@ -1427,236 +1427,236 @@ var Y = {
1427
1427
  string: r,
1428
1428
  union: e,
1429
1429
  unknown: _
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())), Dn = Y.union([
1438
- Y.string(),
1439
- Y.instanceof(Uint8Array),
1440
- Y.instanceof(ArrayBuffer),
1441
- Y.custom(at, { message: "Must be a Buffer" })
1442
- ]), On = Y.record(Y.string(), Y.string()), kn = Y.object({
1443
- type: Y.literal("text"),
1444
- text: Y.string(),
1445
- providerOptions: Z.optional()
1446
- }), An = Y.object({
1447
- type: Y.literal("image"),
1448
- image: Y.union([
1449
- Dn,
1450
- Y.instanceof(URL),
1451
- On
1430
+ }, Y = J.lazy(() => J.union([
1431
+ J.null(),
1432
+ J.string(),
1433
+ J.number(),
1434
+ J.boolean(),
1435
+ J.record(J.string(), Y.optional()),
1436
+ J.array(Y)
1437
+ ])), X = J.record(J.string(), J.record(J.string(), Y.optional())), On = J.union([
1438
+ J.string(),
1439
+ J.instanceof(Uint8Array),
1440
+ J.instanceof(ArrayBuffer),
1441
+ J.custom(it, { message: "Must be a Buffer" })
1442
+ ]), kn = J.record(J.string(), J.string()), An = J.object({
1443
+ type: J.literal("text"),
1444
+ text: J.string(),
1445
+ providerOptions: X.optional()
1446
+ }), jn = J.object({
1447
+ type: J.literal("image"),
1448
+ image: J.union([
1449
+ On,
1450
+ J.instanceof(URL),
1451
+ kn
1452
1452
  ]),
1453
- mediaType: Y.string().optional(),
1454
- providerOptions: Z.optional()
1455
- }), jn = Y.discriminatedUnion("type", [
1456
- Y.object({
1457
- type: Y.literal("data"),
1458
- data: Dn
1453
+ mediaType: J.string().optional(),
1454
+ providerOptions: X.optional()
1455
+ }), Mn = J.discriminatedUnion("type", [
1456
+ J.object({
1457
+ type: J.literal("data"),
1458
+ data: On
1459
1459
  }),
1460
- Y.object({
1461
- type: Y.literal("url"),
1462
- url: Y.instanceof(URL)
1460
+ J.object({
1461
+ type: J.literal("url"),
1462
+ url: J.instanceof(URL)
1463
1463
  }),
1464
- Y.object({
1465
- type: Y.literal("reference"),
1466
- reference: On
1464
+ J.object({
1465
+ type: J.literal("reference"),
1466
+ reference: kn
1467
1467
  }),
1468
- Y.object({
1469
- type: Y.literal("text"),
1470
- text: Y.string()
1468
+ J.object({
1469
+ type: J.literal("text"),
1470
+ text: J.string()
1471
1471
  })
1472
- ]), Mn = Y.discriminatedUnion("type", [Y.object({
1473
- type: Y.literal("data"),
1474
- data: Dn
1475
- }), Y.object({
1476
- type: Y.literal("url"),
1477
- url: Y.instanceof(URL)
1478
- })]), Nn = Y.object({
1479
- type: Y.literal("file"),
1480
- data: Y.union([
1481
- jn,
1482
- Dn,
1483
- Y.instanceof(URL),
1484
- On
1485
- ]),
1486
- filename: Y.string().optional(),
1487
- mediaType: Y.string(),
1488
- providerOptions: Z.optional()
1489
- }), Pn = Y.object({
1490
- type: Y.literal("reasoning"),
1491
- text: Y.string(),
1492
- providerOptions: Z.optional()
1493
- }), Fn = Y.object({
1494
- type: Y.literal("custom"),
1495
- kind: Y.string().transform((e) => e),
1496
- providerOptions: Z.optional()
1497
- }), In = Y.object({
1498
- type: Y.literal("reasoning-file"),
1499
- data: Y.union([
1472
+ ]), Nn = J.discriminatedUnion("type", [J.object({
1473
+ type: J.literal("data"),
1474
+ data: On
1475
+ }), J.object({
1476
+ type: J.literal("url"),
1477
+ url: J.instanceof(URL)
1478
+ })]), Pn = J.object({
1479
+ type: J.literal("file"),
1480
+ data: J.union([
1500
1481
  Mn,
1501
- Dn,
1502
- Y.instanceof(URL)
1482
+ On,
1483
+ J.instanceof(URL),
1484
+ kn
1503
1485
  ]),
1504
- mediaType: Y.string(),
1505
- providerOptions: Z.optional()
1506
- }), Ln = Y.object({
1507
- type: Y.literal("tool-call"),
1508
- toolCallId: Y.string(),
1509
- toolName: Y.string(),
1510
- input: Y.unknown(),
1511
- providerOptions: Z.optional(),
1512
- providerExecuted: Y.boolean().optional()
1513
- }), Rn = Y.discriminatedUnion("type", [
1514
- Y.object({
1515
- type: Y.literal("text"),
1516
- value: Y.string(),
1517
- providerOptions: Z.optional()
1486
+ filename: J.string().optional(),
1487
+ mediaType: J.string(),
1488
+ providerOptions: X.optional()
1489
+ }), Fn = J.object({
1490
+ type: J.literal("reasoning"),
1491
+ text: J.string(),
1492
+ providerOptions: X.optional()
1493
+ }), In = J.object({
1494
+ type: J.literal("custom"),
1495
+ kind: J.string().transform((e) => e),
1496
+ providerOptions: X.optional()
1497
+ }), Ln = J.object({
1498
+ type: J.literal("reasoning-file"),
1499
+ data: J.union([
1500
+ Nn,
1501
+ On,
1502
+ J.instanceof(URL)
1503
+ ]),
1504
+ mediaType: J.string(),
1505
+ providerOptions: X.optional()
1506
+ }), Rn = J.object({
1507
+ type: J.literal("tool-call"),
1508
+ toolCallId: J.string(),
1509
+ toolName: J.string(),
1510
+ input: J.unknown(),
1511
+ providerOptions: X.optional(),
1512
+ providerExecuted: J.boolean().optional()
1513
+ }), zn = J.discriminatedUnion("type", [
1514
+ J.object({
1515
+ type: J.literal("text"),
1516
+ value: J.string(),
1517
+ providerOptions: X.optional()
1518
1518
  }),
1519
- Y.object({
1520
- type: Y.literal("json"),
1521
- value: X,
1522
- providerOptions: Z.optional()
1519
+ J.object({
1520
+ type: J.literal("json"),
1521
+ value: Y,
1522
+ providerOptions: X.optional()
1523
1523
  }),
1524
- Y.object({
1525
- type: Y.literal("execution-denied"),
1526
- reason: Y.string().optional(),
1527
- providerOptions: Z.optional()
1524
+ J.object({
1525
+ type: J.literal("execution-denied"),
1526
+ reason: J.string().optional(),
1527
+ providerOptions: X.optional()
1528
1528
  }),
1529
- Y.object({
1530
- type: Y.literal("error-text"),
1531
- value: Y.string(),
1532
- providerOptions: Z.optional()
1529
+ J.object({
1530
+ type: J.literal("error-text"),
1531
+ value: J.string(),
1532
+ providerOptions: X.optional()
1533
1533
  }),
1534
- Y.object({
1535
- type: Y.literal("error-json"),
1536
- value: X,
1537
- providerOptions: Z.optional()
1534
+ J.object({
1535
+ type: J.literal("error-json"),
1536
+ value: Y,
1537
+ providerOptions: X.optional()
1538
1538
  }),
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
- providerOptions: Z.optional()
1539
+ J.object({
1540
+ type: J.literal("content"),
1541
+ value: J.array(J.union([
1542
+ J.object({
1543
+ type: J.literal("text"),
1544
+ text: J.string(),
1545
+ providerOptions: X.optional()
1546
1546
  }),
1547
- Y.object({
1548
- type: Y.literal("file"),
1549
- data: jn,
1550
- mediaType: Y.string(),
1551
- filename: Y.string().optional(),
1552
- providerOptions: Z.optional()
1547
+ J.object({
1548
+ type: J.literal("file"),
1549
+ data: Mn,
1550
+ mediaType: J.string(),
1551
+ filename: J.string().optional(),
1552
+ providerOptions: X.optional()
1553
1553
  }),
1554
- Y.object({
1555
- type: Y.literal("file-data"),
1556
- data: Y.string(),
1557
- mediaType: Y.string(),
1558
- filename: Y.string().optional(),
1559
- providerOptions: Z.optional()
1554
+ J.object({
1555
+ type: J.literal("file-data"),
1556
+ data: J.string(),
1557
+ mediaType: J.string(),
1558
+ filename: J.string().optional(),
1559
+ providerOptions: X.optional()
1560
1560
  }),
1561
- Y.object({
1562
- type: Y.literal("file-url"),
1563
- url: Y.string(),
1564
- mediaType: Y.string().optional(),
1565
- providerOptions: Z.optional()
1561
+ J.object({
1562
+ type: J.literal("file-url"),
1563
+ url: J.string(),
1564
+ mediaType: J.string().optional(),
1565
+ providerOptions: X.optional()
1566
1566
  }),
1567
- Y.object({
1568
- type: Y.literal("file-id"),
1569
- fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1570
- providerOptions: Z.optional()
1567
+ J.object({
1568
+ type: J.literal("file-id"),
1569
+ fileId: J.union([J.string(), J.record(J.string(), J.string())]),
1570
+ providerOptions: X.optional()
1571
1571
  }),
1572
- Y.object({
1573
- type: Y.literal("file-reference"),
1574
- providerReference: Y.record(Y.string(), Y.string()),
1575
- providerOptions: Z.optional()
1572
+ J.object({
1573
+ type: J.literal("file-reference"),
1574
+ providerReference: J.record(J.string(), J.string()),
1575
+ providerOptions: X.optional()
1576
1576
  }),
1577
- Y.object({
1578
- type: Y.literal("image-data"),
1579
- data: Y.string(),
1580
- mediaType: Y.string(),
1581
- providerOptions: Z.optional()
1577
+ J.object({
1578
+ type: J.literal("image-data"),
1579
+ data: J.string(),
1580
+ mediaType: J.string(),
1581
+ providerOptions: X.optional()
1582
1582
  }),
1583
- Y.object({
1584
- type: Y.literal("image-url"),
1585
- url: Y.string(),
1586
- providerOptions: Z.optional()
1583
+ J.object({
1584
+ type: J.literal("image-url"),
1585
+ url: J.string(),
1586
+ providerOptions: X.optional()
1587
1587
  }),
1588
- Y.object({
1589
- type: Y.literal("image-file-id"),
1590
- fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1591
- providerOptions: Z.optional()
1588
+ J.object({
1589
+ type: J.literal("image-file-id"),
1590
+ fileId: J.union([J.string(), J.record(J.string(), J.string())]),
1591
+ providerOptions: X.optional()
1592
1592
  }),
1593
- Y.object({
1594
- type: Y.literal("image-file-reference"),
1595
- providerReference: Y.record(Y.string(), Y.string()),
1596
- providerOptions: Z.optional()
1593
+ J.object({
1594
+ type: J.literal("image-file-reference"),
1595
+ providerReference: J.record(J.string(), J.string()),
1596
+ providerOptions: X.optional()
1597
1597
  }),
1598
- Y.object({
1599
- type: Y.literal("custom"),
1600
- providerOptions: Z.optional()
1598
+ J.object({
1599
+ type: J.literal("custom"),
1600
+ providerOptions: X.optional()
1601
1601
  })
1602
1602
  ]))
1603
1603
  })
1604
- ]), zn = Y.object({
1605
- type: Y.literal("tool-result"),
1606
- toolCallId: Y.string(),
1607
- toolName: Y.string(),
1608
- output: Rn,
1609
- providerOptions: Z.optional()
1610
- }), Bn = 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
- }), Vn = Y.object({
1619
- type: Y.literal("tool-approval-response"),
1620
- approvalId: Y.string(),
1621
- approved: Y.boolean(),
1622
- reason: Y.string().optional()
1623
- }), Hn = Y.object({
1624
- role: Y.literal("system"),
1625
- content: Y.string(),
1626
- providerOptions: Z.optional()
1627
- }), Un = Y.object({
1628
- role: Y.literal("user"),
1629
- content: Y.union([Y.string(), Y.array(Y.union([
1630
- kn,
1604
+ ]), Bn = J.object({
1605
+ type: J.literal("tool-result"),
1606
+ toolCallId: J.string(),
1607
+ toolName: J.string(),
1608
+ output: zn,
1609
+ providerOptions: X.optional()
1610
+ }), Vn = J.object({
1611
+ type: J.literal("tool-approval-request"),
1612
+ approvalId: J.string(),
1613
+ toolCallId: J.string(),
1614
+ reason: J.string().optional(),
1615
+ isAutomatic: J.boolean().optional(),
1616
+ signature: J.string().optional(),
1617
+ inputSchemaInput: J.unknown().optional()
1618
+ }), Hn = J.object({
1619
+ type: J.literal("tool-approval-response"),
1620
+ approvalId: J.string(),
1621
+ approved: J.boolean(),
1622
+ reason: J.string().optional()
1623
+ }), Un = J.object({
1624
+ role: J.literal("system"),
1625
+ content: J.string(),
1626
+ providerOptions: X.optional()
1627
+ }), Wn = J.object({
1628
+ role: J.literal("user"),
1629
+ content: J.union([J.string(), J.array(J.union([
1631
1630
  An,
1632
- Nn
1631
+ jn,
1632
+ Pn
1633
1633
  ]))]),
1634
- providerOptions: Z.optional()
1635
- }), Wn = Y.object({
1636
- role: Y.literal("assistant"),
1637
- content: Y.union([Y.string(), Y.array(Y.union([
1638
- kn,
1639
- Fn,
1640
- Nn,
1641
- Pn,
1634
+ providerOptions: X.optional()
1635
+ }), Gn = J.object({
1636
+ role: J.literal("assistant"),
1637
+ content: J.union([J.string(), J.array(J.union([
1638
+ An,
1642
1639
  In,
1640
+ Pn,
1641
+ Fn,
1643
1642
  Ln,
1644
- zn,
1645
- Bn
1643
+ Rn,
1644
+ Bn,
1645
+ Vn
1646
1646
  ]))]),
1647
- providerOptions: Z.optional()
1648
- }), Gn = Y.object({
1649
- role: Y.literal("tool"),
1650
- content: Y.array(Y.union([zn, Vn])),
1651
- providerOptions: Z.optional()
1647
+ providerOptions: X.optional()
1648
+ }), Kn = J.object({
1649
+ role: J.literal("tool"),
1650
+ content: J.array(J.union([Bn, Hn])),
1651
+ providerOptions: X.optional()
1652
1652
  });
1653
- Y.union([
1654
- Hn,
1653
+ J.union([
1655
1654
  Un,
1656
1655
  Wn,
1657
- Gn
1656
+ Gn,
1657
+ Kn
1658
1658
  ]);
1659
- function Kn(e) {
1659
+ function qn(e) {
1660
1660
  let t = ["ROOT"], n = -1, r = null, i = 0;
1661
1661
  function a(e) {
1662
1662
  return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
@@ -1838,16 +1838,16 @@ function Kn(e) {
1838
1838
  }
1839
1839
  return l;
1840
1840
  }
1841
- async function qn(e) {
1841
+ async function Jn(e) {
1842
1842
  if (e === void 0) return {
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: Kn(e) }), t.success ? {
1850
+ } : (t = await _n({ text: qn(e) }), t.success ? {
1851
1851
  value: t.value,
1852
1852
  state: "repaired-parse"
1853
1853
  } : {
@@ -1855,199 +1855,199 @@ async function qn(e) {
1855
1855
  state: "failed-parse"
1856
1856
  });
1857
1857
  }
1858
- new TextEncoder(), new TextEncoder(), F({
1858
+ new TextEncoder(), new TextEncoder(), I({
1859
1859
  prefix: "aitxt",
1860
1860
  size: 24
1861
- }), F({
1861
+ }), I({
1862
1862
  prefix: "call",
1863
1863
  size: 24
1864
1864
  }), TransformStream;
1865
- var Jn = 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
- providerMetadata: Z.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
- providerMetadata: Z.optional()
1865
+ var Yn = J.object({
1866
+ source: J.discriminatedUnion("sourceType", [J.object({
1867
+ type: J.literal("source"),
1868
+ sourceType: J.literal("url"),
1869
+ id: J.string(),
1870
+ url: J.string(),
1871
+ title: J.string().optional(),
1872
+ providerMetadata: X.optional()
1873
+ }), J.object({
1874
+ type: J.literal("source"),
1875
+ sourceType: J.literal("document"),
1876
+ id: J.string(),
1877
+ mediaType: J.string(),
1878
+ title: J.string(),
1879
+ filename: J.string().optional(),
1880
+ providerMetadata: X.optional()
1881
1881
  })]),
1882
- startIndex: Y.number().int().nonnegative().optional(),
1883
- endIndex: Y.number().int().nonnegative().optional(),
1884
- citedText: Y.string().optional()
1885
- }), Yn = Y.record(Y.string(), X.optional()), Xn = rn(() => pn(Y.union([
1886
- Y.looseObject({
1887
- type: Y.literal("text-start"),
1888
- id: Y.string(),
1889
- providerMetadata: Z.optional()
1882
+ startIndex: J.number().int().nonnegative().optional(),
1883
+ endIndex: J.number().int().nonnegative().optional(),
1884
+ citedText: J.string().optional()
1885
+ }), Xn = J.record(J.string(), Y.optional()), Zn = an(() => mn(J.union([
1886
+ J.looseObject({
1887
+ type: J.literal("text-start"),
1888
+ id: J.string(),
1889
+ providerMetadata: X.optional()
1890
1890
  }),
1891
- Y.looseObject({
1892
- type: Y.literal("text-delta"),
1893
- id: Y.string(),
1894
- delta: Y.string(),
1895
- providerMetadata: Z.optional()
1891
+ J.looseObject({
1892
+ type: J.literal("text-delta"),
1893
+ id: J.string(),
1894
+ delta: J.string(),
1895
+ providerMetadata: X.optional()
1896
1896
  }),
1897
- Y.looseObject({
1898
- type: Y.literal("text-end"),
1899
- id: Y.string(),
1900
- citations: Y.array(Jn).optional(),
1901
- providerMetadata: Z.optional()
1897
+ J.looseObject({
1898
+ type: J.literal("text-end"),
1899
+ id: J.string(),
1900
+ citations: J.array(Yn).optional(),
1901
+ providerMetadata: X.optional()
1902
1902
  }),
1903
- Y.looseObject({
1904
- type: Y.literal("error"),
1905
- errorText: Y.string()
1903
+ J.looseObject({
1904
+ type: J.literal("error"),
1905
+ errorText: J.string()
1906
1906
  }),
1907
- Y.looseObject({
1908
- type: Y.literal("tool-input-start"),
1909
- toolCallId: Y.string(),
1910
- toolName: Y.string(),
1911
- providerExecuted: Y.boolean().optional(),
1912
- providerMetadata: Z.optional(),
1913
- toolMetadata: Yn.optional(),
1914
- dynamic: Y.boolean().optional(),
1915
- title: Y.string().optional()
1907
+ J.looseObject({
1908
+ type: J.literal("tool-input-start"),
1909
+ toolCallId: J.string(),
1910
+ toolName: J.string(),
1911
+ providerExecuted: J.boolean().optional(),
1912
+ providerMetadata: X.optional(),
1913
+ toolMetadata: Xn.optional(),
1914
+ dynamic: J.boolean().optional(),
1915
+ title: J.string().optional()
1916
1916
  }),
1917
- Y.looseObject({
1918
- type: Y.literal("tool-input-delta"),
1919
- toolCallId: Y.string(),
1920
- inputTextDelta: Y.string()
1917
+ J.looseObject({
1918
+ type: J.literal("tool-input-delta"),
1919
+ toolCallId: J.string(),
1920
+ inputTextDelta: J.string()
1921
1921
  }),
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
- providerMetadata: Z.optional(),
1929
- toolMetadata: Yn.optional(),
1930
- dynamic: Y.boolean().optional(),
1931
- title: Y.string().optional()
1922
+ J.looseObject({
1923
+ type: J.literal("tool-input-available"),
1924
+ toolCallId: J.string(),
1925
+ toolName: J.string(),
1926
+ input: J.unknown(),
1927
+ providerExecuted: J.boolean().optional(),
1928
+ providerMetadata: X.optional(),
1929
+ toolMetadata: Xn.optional(),
1930
+ dynamic: J.boolean().optional(),
1931
+ title: J.string().optional()
1932
1932
  }),
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
- providerMetadata: Z.optional(),
1940
- toolMetadata: Yn.optional(),
1941
- dynamic: Y.boolean().optional(),
1942
- errorText: Y.string(),
1943
- title: Y.string().optional()
1933
+ J.looseObject({
1934
+ type: J.literal("tool-input-error"),
1935
+ toolCallId: J.string(),
1936
+ toolName: J.string(),
1937
+ input: J.unknown(),
1938
+ providerExecuted: J.boolean().optional(),
1939
+ providerMetadata: X.optional(),
1940
+ toolMetadata: Xn.optional(),
1941
+ dynamic: J.boolean().optional(),
1942
+ errorText: J.string(),
1943
+ title: J.string().optional()
1944
1944
  }),
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()
1945
+ J.looseObject({
1946
+ type: J.literal("tool-approval-request"),
1947
+ approvalId: J.string(),
1948
+ toolCallId: J.string(),
1949
+ approvalDescriptor: J.unknown().optional(),
1950
+ inputSchemaInput: J.unknown().optional(),
1951
+ reason: J.string().optional(),
1952
+ isAutomatic: J.boolean().optional(),
1953
+ signature: J.string().optional()
1954
1954
  }),
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
- providerMetadata: Z.optional()
1955
+ J.looseObject({
1956
+ type: J.literal("tool-approval-response"),
1957
+ approvalId: J.string(),
1958
+ approved: J.boolean(),
1959
+ reason: J.string().optional(),
1960
+ providerExecuted: J.boolean().optional(),
1961
+ providerMetadata: X.optional()
1962
1962
  }),
1963
- Y.looseObject({
1964
- type: Y.literal("tool-output-available"),
1965
- toolCallId: Y.string(),
1966
- output: Y.unknown(),
1967
- providerExecuted: Y.boolean().optional(),
1968
- providerMetadata: Z.optional(),
1969
- toolMetadata: Yn.optional(),
1970
- dynamic: Y.boolean().optional(),
1971
- preliminary: Y.boolean().optional()
1963
+ J.looseObject({
1964
+ type: J.literal("tool-output-available"),
1965
+ toolCallId: J.string(),
1966
+ output: J.unknown(),
1967
+ providerExecuted: J.boolean().optional(),
1968
+ providerMetadata: X.optional(),
1969
+ toolMetadata: Xn.optional(),
1970
+ dynamic: J.boolean().optional(),
1971
+ preliminary: J.boolean().optional()
1972
1972
  }),
1973
- Y.looseObject({
1974
- type: Y.literal("tool-output-error"),
1975
- toolCallId: Y.string(),
1976
- errorText: Y.string(),
1977
- providerExecuted: Y.boolean().optional(),
1978
- providerMetadata: Z.optional(),
1979
- toolMetadata: Yn.optional(),
1980
- dynamic: Y.boolean().optional()
1973
+ J.looseObject({
1974
+ type: J.literal("tool-output-error"),
1975
+ toolCallId: J.string(),
1976
+ errorText: J.string(),
1977
+ providerExecuted: J.boolean().optional(),
1978
+ providerMetadata: X.optional(),
1979
+ toolMetadata: Xn.optional(),
1980
+ dynamic: J.boolean().optional()
1981
1981
  }),
1982
- Y.looseObject({
1983
- type: Y.literal("tool-output-denied"),
1984
- toolCallId: Y.string()
1982
+ J.looseObject({
1983
+ type: J.literal("tool-output-denied"),
1984
+ toolCallId: J.string()
1985
1985
  }),
1986
- Y.looseObject({
1987
- type: Y.literal("reasoning-start"),
1988
- id: Y.string(),
1989
- providerMetadata: Z.optional()
1986
+ J.looseObject({
1987
+ type: J.literal("reasoning-start"),
1988
+ id: J.string(),
1989
+ providerMetadata: X.optional()
1990
1990
  }),
1991
- Y.looseObject({
1992
- type: Y.literal("reasoning-delta"),
1993
- id: Y.string(),
1994
- delta: Y.string(),
1995
- providerMetadata: Z.optional()
1991
+ J.looseObject({
1992
+ type: J.literal("reasoning-delta"),
1993
+ id: J.string(),
1994
+ delta: J.string(),
1995
+ providerMetadata: X.optional()
1996
1996
  }),
1997
- Y.looseObject({
1998
- type: Y.literal("reasoning-end"),
1999
- id: Y.string(),
2000
- providerMetadata: Z.optional()
1997
+ J.looseObject({
1998
+ type: J.literal("reasoning-end"),
1999
+ id: J.string(),
2000
+ providerMetadata: X.optional()
2001
2001
  }),
2002
- Y.looseObject({
2003
- type: Y.literal("custom"),
2004
- kind: Y.string().transform((e) => e),
2005
- providerMetadata: Z.optional()
2002
+ J.looseObject({
2003
+ type: J.literal("custom"),
2004
+ kind: J.string().transform((e) => e),
2005
+ providerMetadata: X.optional()
2006
2006
  }),
2007
- Y.looseObject({
2008
- type: Y.literal("source-url"),
2009
- sourceId: Y.string(),
2010
- url: Y.string(),
2011
- title: Y.string().optional(),
2012
- providerMetadata: Z.optional()
2007
+ J.looseObject({
2008
+ type: J.literal("source-url"),
2009
+ sourceId: J.string(),
2010
+ url: J.string(),
2011
+ title: J.string().optional(),
2012
+ providerMetadata: X.optional()
2013
2013
  }),
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
- providerMetadata: Z.optional()
2014
+ J.looseObject({
2015
+ type: J.literal("source-document"),
2016
+ sourceId: J.string(),
2017
+ mediaType: J.string(),
2018
+ title: J.string(),
2019
+ filename: J.string().optional(),
2020
+ providerMetadata: X.optional()
2021
2021
  }),
2022
- Y.looseObject({
2023
- type: Y.literal("file"),
2024
- url: Y.string(),
2025
- mediaType: Y.string(),
2026
- providerMetadata: Z.optional()
2022
+ J.looseObject({
2023
+ type: J.literal("file"),
2024
+ url: J.string(),
2025
+ mediaType: J.string(),
2026
+ providerMetadata: X.optional()
2027
2027
  }),
2028
- Y.looseObject({
2029
- type: Y.literal("reasoning-file"),
2030
- url: Y.string(),
2031
- mediaType: Y.string(),
2032
- providerMetadata: Z.optional()
2028
+ J.looseObject({
2029
+ type: J.literal("reasoning-file"),
2030
+ url: J.string(),
2031
+ mediaType: J.string(),
2032
+ providerMetadata: X.optional()
2033
2033
  }),
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()
2034
+ J.looseObject({
2035
+ type: J.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2036
+ id: J.string().optional(),
2037
+ data: J.unknown(),
2038
+ transient: J.boolean().optional()
2039
2039
  }),
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()
2040
+ J.looseObject({ type: J.literal("start-step") }),
2041
+ J.looseObject({ type: J.literal("finish-step") }),
2042
+ J.looseObject({ type: J.literal("reset-step") }),
2043
+ J.looseObject({
2044
+ type: J.literal("start"),
2045
+ messageId: J.string().optional(),
2046
+ messageMetadata: J.unknown().optional()
2047
2047
  }),
2048
- Y.looseObject({
2049
- type: Y.literal("finish"),
2050
- finishReason: Y.enum([
2048
+ J.looseObject({
2049
+ type: J.literal("finish"),
2050
+ finishReason: J.enum([
2051
2051
  "stop",
2052
2052
  "length",
2053
2053
  "content-filter",
@@ -2055,49 +2055,49 @@ var Jn = Y.object({
2055
2055
  "error",
2056
2056
  "other"
2057
2057
  ]).optional(),
2058
- messageMetadata: Y.unknown().optional()
2058
+ messageMetadata: J.unknown().optional()
2059
2059
  }),
2060
- Y.looseObject({
2061
- type: Y.literal("abort"),
2062
- reason: Y.string().optional()
2060
+ J.looseObject({
2061
+ type: J.literal("abort"),
2062
+ reason: J.string().optional()
2063
2063
  }),
2064
- Y.looseObject({
2065
- type: Y.literal("message-metadata"),
2066
- messageMetadata: Y.unknown()
2064
+ J.looseObject({
2065
+ type: J.literal("message-metadata"),
2066
+ messageMetadata: J.unknown()
2067
2067
  })
2068
2068
  ])));
2069
- function Zn(e) {
2069
+ function Qn(e) {
2070
2070
  return e.type.startsWith("data-");
2071
2071
  }
2072
- function Qn() {
2072
+ function $n() {
2073
2073
  return Object.create(null);
2074
2074
  }
2075
- function $n(e) {
2075
+ function er(e) {
2076
2076
  return e.type.startsWith("tool-");
2077
2077
  }
2078
- function er(e) {
2078
+ function tr(e) {
2079
2079
  return e.type === "dynamic-tool";
2080
2080
  }
2081
- function Q(e) {
2082
- return $n(e) || er(e);
2081
+ function Z(e) {
2082
+ return er(e) || tr(e);
2083
2083
  }
2084
- function tr(e) {
2084
+ function nr(e) {
2085
2085
  return e.type.split("-").slice(1).join("-");
2086
2086
  }
2087
- function nr({ lastMessage: e, messageId: t }) {
2087
+ function rr({ lastMessage: e, messageId: t }) {
2088
2088
  let n = e?.role === "assistant" ? e : {
2089
2089
  id: t,
2090
2090
  metadata: void 0,
2091
2091
  role: "assistant",
2092
2092
  parts: []
2093
- }, r = Qn(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
2093
+ }, r = $n(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
2094
2094
  for (let e of n.parts.slice(i + 1)) {
2095
- if (!Q(e)) continue;
2095
+ if (!Z(e)) continue;
2096
2096
  let t = a;
2097
- $n(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
2097
+ er(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
2098
2098
  text: e.rawInput ?? "",
2099
2099
  index: t,
2100
- toolName: e.type === "dynamic-tool" ? e.toolName : tr(e),
2100
+ toolName: e.type === "dynamic-tool" ? e.toolName : nr(e),
2101
2101
  dynamic: e.type === "dynamic-tool",
2102
2102
  title: e.title,
2103
2103
  toolMetadata: e.toolMetadata
@@ -2105,12 +2105,12 @@ function nr({ lastMessage: e, messageId: t }) {
2105
2105
  }
2106
2106
  return {
2107
2107
  message: n,
2108
- activeTextParts: Qn(),
2109
- activeReasoningParts: Qn(),
2108
+ activeTextParts: $n(),
2109
+ activeReasoningParts: $n(),
2110
2110
  partialToolCalls: r
2111
2111
  };
2112
2112
  }
2113
- function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
2113
+ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
2114
2114
  let l = !0;
2115
2115
  return e.pipeThrough(new TransformStream({ async transform(e, u) {
2116
2116
  await r(async ({ state: r, write: d }) => {
@@ -2120,7 +2120,7 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2120
2120
  return e.slice(t + 1);
2121
2121
  }
2122
2122
  function p() {
2123
- return f().filter(Q);
2123
+ return f().filter(Z);
2124
2124
  }
2125
2125
  function m(e) {
2126
2126
  let t = p().find((t) => t.toolCallId === e);
@@ -2128,13 +2128,13 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2128
2128
  let n = r.message.parts;
2129
2129
  for (let r = n.length - 1; r >= 0; r--) {
2130
2130
  let i = n[r];
2131
- if (Q(i) && i.toolCallId === e) {
2131
+ if (Z(i) && i.toolCallId === e) {
2132
2132
  t = i;
2133
2133
  break;
2134
2134
  }
2135
2135
  }
2136
2136
  }
2137
- if (t == null) throw new J({
2137
+ if (t == null) throw new q({
2138
2138
  chunkType: "tool-invocation",
2139
2139
  chunkId: e,
2140
2140
  message: `No tool invocation found for tool call ID "${e}".`
@@ -2142,8 +2142,8 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2142
2142
  return t;
2143
2143
  }
2144
2144
  function h(e) {
2145
- let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
2146
- if (t == null) throw new J({
2145
+ let t = r.message.parts.filter(Z).find((t) => t.approval?.id === e);
2146
+ if (t == null) throw new q({
2147
2147
  chunkType: "tool-approval-response",
2148
2148
  chunkId: e,
2149
2149
  message: `No tool invocation found for approval ID "${e}".`
@@ -2151,7 +2151,7 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2151
2151
  return t;
2152
2152
  }
2153
2153
  function g(e, t) {
2154
- let n = t ?? f().find((t) => $n(t) && t.toolCallId === e.toolCallId), i = e, a = n;
2154
+ let n = t ?? f().find((t) => er(t) && t.toolCallId === e.toolCallId), i = e, a = n;
2155
2155
  if (n != null) {
2156
2156
  n.state = e.state, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput, a.preliminary = i.preliminary, e.title !== void 0 && (a.title = e.title), e.toolMetadata !== void 0 && (a.toolMetadata = e.toolMetadata), a.providerExecuted = i.providerExecuted ?? n.providerExecuted;
2157
2157
  let t = i.providerMetadata;
@@ -2206,8 +2206,8 @@ function rr({ 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 : En(r.message.metadata, e);
2210
- t != null && await mn({
2209
+ let n = r.message.metadata == null ? e : Dn(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 rr({ 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 J({
2233
+ if (t == null) throw new q({
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 rr({ 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 J({
2243
+ if (t == null) throw new q({
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 rr({ 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 J({
2273
+ if (t == null) throw new q({
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 rr({ 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 J({
2283
+ if (t == null) throw new q({
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.`
@@ -2317,7 +2317,7 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2317
2317
  }), d();
2318
2318
  break;
2319
2319
  case "tool-input-start": {
2320
- let t = f().filter($n);
2320
+ let t = f().filter(er);
2321
2321
  r.partialToolCalls[e.toolCallId] = {
2322
2322
  text: "",
2323
2323
  toolName: e.toolName,
@@ -2348,13 +2348,13 @@ function rr({ 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 J({
2351
+ if (t == null) throw new q({
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.`
2355
2355
  });
2356
2356
  t.text += e.inputTextDelta;
2357
- let { value: n } = await qn(t.text);
2357
+ let { value: n } = await Jn(t.text);
2358
2358
  t.dynamic ? _({
2359
2359
  toolCallId: e.toolCallId,
2360
2360
  toolName: t.toolName,
@@ -2396,7 +2396,7 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2396
2396
  }), d(), a && !e.providerExecuted && await a({ toolCall: e });
2397
2397
  break;
2398
2398
  case "tool-input-error": {
2399
- let t = f().filter(Q).find((t) => t.toolCallId === e.toolCallId);
2399
+ let t = f().filter(Z).find((t) => t.toolCallId === e.toolCallId);
2400
2400
  (t == null ? e.dynamic : t.type === "dynamic-tool") ? _({
2401
2401
  toolCallId: e.toolCallId,
2402
2402
  toolName: e.toolName,
@@ -2460,7 +2460,7 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2460
2460
  toolMetadata: e.toolMetadata ?? t.toolMetadata
2461
2461
  }, t) : g({
2462
2462
  toolCallId: e.toolCallId,
2463
- toolName: tr(t),
2463
+ toolName: nr(t),
2464
2464
  state: "output-available",
2465
2465
  input: t.input,
2466
2466
  output: e.output,
@@ -2486,7 +2486,7 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2486
2486
  toolMetadata: e.toolMetadata ?? t.toolMetadata
2487
2487
  }, t) : g({
2488
2488
  toolCallId: e.toolCallId,
2489
- toolName: tr(t),
2489
+ toolName: nr(t),
2490
2490
  state: "output-error",
2491
2491
  input: t.input,
2492
2492
  rawInput: t.rawInput,
@@ -2504,12 +2504,12 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2504
2504
  case "finish-step": break;
2505
2505
  case "reset-step": {
2506
2506
  let e = f();
2507
- r.activeTextParts = Qn(), r.activeReasoningParts = Qn(), r.partialToolCalls = Qn(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
2507
+ r.activeTextParts = $n(), r.activeReasoningParts = $n(), r.partialToolCalls = $n(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
2508
2508
  break;
2509
2509
  }
2510
2510
  case "start": {
2511
2511
  let t = c && l || s && e.messageId != null && e.messageId !== r.message.id;
2512
- l = !1, t && Object.assign(r, nr({
2512
+ l = !1, t && Object.assign(r, rr({
2513
2513
  lastMessage: void 0,
2514
2514
  messageId: e.messageId ?? r.message.id
2515
2515
  }), { finishReason: void 0 }), e.messageId != null && (r.message.id = e.messageId), await v(e.messageMetadata), (t || e.messageId != null || e.messageMetadata != null) && d({ updateStatus: !1 });
@@ -2524,10 +2524,10 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2524
2524
  case "error":
2525
2525
  i?.(Error(e.errorText));
2526
2526
  break;
2527
- default: if (Zn(e)) {
2527
+ default: if (Qn(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: {
@@ -2550,7 +2550,7 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2550
2550
  });
2551
2551
  } }));
2552
2552
  }
2553
- async function ir({ stream: e, onError: t, abortSignal: n }) {
2553
+ async function ar({ stream: e, onError: t, abortSignal: n }) {
2554
2554
  let r = e.getReader(), i = () => {
2555
2555
  r.cancel().catch(() => {});
2556
2556
  };
@@ -2566,7 +2566,7 @@ async function ir({ stream: e, onError: t, abortSignal: n }) {
2566
2566
  n?.removeEventListener("abort", i), r.releaseLock();
2567
2567
  }
2568
2568
  }
2569
- function ar() {
2569
+ function or() {
2570
2570
  let e, t;
2571
2571
  return {
2572
2572
  promise: new Promise((n, r) => {
@@ -2576,32 +2576,32 @@ function ar() {
2576
2576
  reject: t
2577
2577
  };
2578
2578
  }
2579
- F({
2579
+ I({
2580
2580
  prefix: "aitxt",
2581
2581
  size: 24
2582
- }), F({
2582
+ }), I({
2583
2583
  prefix: "call",
2584
2584
  size: 24
2585
- }), F({
2585
+ }), I({
2586
2586
  prefix: "aitxt",
2587
2587
  size: 24
2588
- }), F({
2588
+ }), I({
2589
2589
  prefix: "call",
2590
2590
  size: 24
2591
- }), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), F({
2591
+ }), J.record(J.string(), Y.optional()), J.record(J.string(), J.string()), I({
2592
2592
  prefix: "call",
2593
2593
  size: 24
2594
- }), F({
2594
+ }), I({
2595
2595
  prefix: "call",
2596
2596
  size: 24
2597
- }), new TextEncoder(), F({
2597
+ }), new TextEncoder(), I({
2598
2598
  prefix: "call",
2599
2599
  size: 24
2600
- }), F({
2600
+ }), I({
2601
2601
  prefix: "aiobj",
2602
2602
  size: 24
2603
2603
  });
2604
- var { atob: or } = globalThis, sr = class {
2604
+ var { atob: sr } = globalThis, cr = class {
2605
2605
  constructor() {
2606
2606
  this.queue = [], this.isProcessing = !1, this.idleWaiters = [];
2607
2607
  }
@@ -2633,15 +2633,15 @@ var { atob: or } = globalThis, sr = class {
2633
2633
  });
2634
2634
  }
2635
2635
  };
2636
- F({
2636
+ I({
2637
2637
  prefix: "aiobj",
2638
2638
  size: 24
2639
- }), F({
2639
+ }), I({
2640
2640
  prefix: "call",
2641
2641
  size: 24
2642
- }), Y.object({
2643
- token: Y.string().refine((e) => e.trim().length > 0),
2644
- url: Y.string().refine((e) => {
2642
+ }), J.object({
2643
+ token: J.string().refine((e) => e.trim().length > 0),
2644
+ url: J.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 @@ F({
2649
2649
  return !1;
2650
2650
  }
2651
2651
  }),
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())
2652
+ expiresAt: J.number().positive().max(2 ** 53 - 1).optional(),
2653
+ tools: J.array(J.object({
2654
+ type: J.literal("function"),
2655
+ name: J.string().min(1),
2656
+ description: J.string().optional(),
2657
+ parameters: J.record(J.string(), J.unknown())
2658
2658
  })).optional()
2659
- }), F({
2659
+ }), I({
2660
2660
  prefix: "call",
2661
2661
  size: 24
2662
- }), F({
2662
+ }), I({
2663
2663
  prefix: "call",
2664
2664
  size: 24
2665
- }), F({
2665
+ }), I({
2666
2666
  prefix: "call",
2667
2667
  size: 24
2668
2668
  });
2669
- async function cr({ response: e, url: t, fallbackMessage: n }) {
2669
+ async function lr({ response: e, url: t, fallbackMessage: n }) {
2670
2670
  let r = await e.text();
2671
- return new Fe({
2671
+ return new Ne({
2672
2672
  message: r || n,
2673
2673
  url: t,
2674
2674
  requestBodyValues: void 0,
@@ -2676,9 +2676,9 @@ async function cr({ response: e, url: t, fallbackMessage: n }) {
2676
2676
  responseBody: r
2677
2677
  });
2678
2678
  }
2679
- async function lr(e) {
2679
+ async function ur(e) {
2680
2680
  if (e == null) return [];
2681
- if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Xe({
2681
+ if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Ye({
2682
2682
  functionality: "FileList",
2683
2683
  message: "FileList is not supported in the current environment"
2684
2684
  });
@@ -2697,18 +2697,18 @@ async function lr(e) {
2697
2697
  };
2698
2698
  }));
2699
2699
  }
2700
- function ur(e, t) {
2700
+ function dr(e, t) {
2701
2701
  let n = e.search(/[?#]/), r = n === -1 ? e : e.slice(0, n), i = n === -1 ? "" : e.slice(n);
2702
2702
  return `${r.endsWith("/") && t.startsWith("/") ? r.slice(0, -1) : r}${t}${i}`;
2703
2703
  }
2704
- var dr = class {
2704
+ var fr = class {
2705
2705
  constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
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
- ...P(r),
2711
- ...P(t.headers)
2709
+ let n = await yn(this.body), r = await yn(this.headers), i = await yn(this.credentials), a = {
2710
+ ...F(r),
2711
+ ...F(t.headers)
2712
2712
  }, o = await this.prepareSendMessagesRequest?.({
2713
2713
  api: this.api,
2714
2714
  id: t.chatId,
@@ -2722,7 +2722,7 @@ var dr = 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 : P(o.headers), l = o?.body === void 0 ? {
2725
+ }), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : F(o.headers), l = o?.body === void 0 ? {
2726
2726
  ...n,
2727
2727
  ...t.body,
2728
2728
  id: t.chatId,
@@ -2739,18 +2739,18 @@ var dr = class {
2739
2739
  credentials: u,
2740
2740
  signal: e
2741
2741
  });
2742
- if (!d.ok) throw await cr({
2742
+ if (!d.ok) throw await lr({
2743
2743
  response: d,
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 Fe({ 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
- ...P(n),
2753
- ...P(e.headers)
2751
+ let t = await yn(this.body), n = await yn(this.headers), r = await yn(this.credentials), i = {
2752
+ ...F(n),
2753
+ ...F(e.headers)
2754
2754
  }, a = await this.prepareReconnectToStreamRequest?.({
2755
2755
  api: this.api,
2756
2756
  id: e.chatId,
@@ -2763,51 +2763,51 @@ var dr = 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
- o = ur(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
2771
+ o = dr(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
2772
2772
  }
2773
- let s = a?.headers === void 0 ? i : P(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
2773
+ let s = a?.headers === void 0 ? i : F(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,
2777
2777
  signal: e.abortSignal
2778
2778
  });
2779
2779
  if (l.status === 204) return null;
2780
- if (!l.ok) throw await cr({
2780
+ if (!l.ok) throw await lr({
2781
2781
  response: l,
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 Fe({ message: "The response body is empty." });
2786
2786
  return this.processResponseStream(l.body);
2787
2787
  }
2788
- }, fr = class extends dr {
2788
+ }, pr = class extends fr {
2789
2789
  constructor({ resumeStreamIsReplay: e = !0, ...t } = {}) {
2790
2790
  super(t), this.resumeStreamIsReplay = e;
2791
2791
  }
2792
2792
  processResponseStream(e) {
2793
- return _n({
2793
+ return vn({
2794
2794
  stream: e,
2795
- schema: Xn
2795
+ schema: Zn
2796
2796
  }).pipeThrough(new TransformStream({ async transform(e, t) {
2797
2797
  if (!e.success) throw e.error;
2798
2798
  t.enqueue(e.value);
2799
2799
  } }));
2800
2800
  }
2801
- }, pr = class {
2802
- constructor({ generateId: e = I, id: t = e(), transport: n = new fr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
2803
- this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new sr(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
2801
+ }, mr = class {
2802
+ constructor({ generateId: e = L, id: t = e(), transport: n = new pr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
2803
+ this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new cr(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
2804
2804
  if (e == null) {
2805
2805
  let e = this.pendingApprovalMessageId;
2806
2806
  if (e == null) {
2807
2807
  e = this.lastMessage?.id;
2808
2808
  for (let t = this.state.messages.length - 1; t >= 0; t--) {
2809
2809
  let n = this.state.messages[t];
2810
- if (n.role === "assistant" && n.parts.some((e) => Q(e) && e.state === "approval-responded")) {
2810
+ if (n.role === "assistant" && n.parts.some((e) => Z(e) && e.state === "approval-responded")) {
2811
2811
  e = n.id;
2812
2812
  break;
2813
2813
  }
@@ -2827,7 +2827,7 @@ var dr = class {
2827
2827
  this.pendingMessagePreparations.add(t);
2828
2828
  let r;
2829
2829
  try {
2830
- r = Array.isArray(e.files) ? e.files : await lr(e.files);
2830
+ r = Array.isArray(e.files) ? e.files : await ur(e.files);
2831
2831
  } finally {
2832
2832
  this.pendingMessagePreparations.delete(t);
2833
2833
  }
@@ -2839,12 +2839,12 @@ var dr = 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 dr = 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`
@@ -2889,7 +2889,7 @@ var dr = class {
2889
2889
  }, this.clearError = () => {
2890
2890
  this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
2891
2891
  }, this.addToolApprovalResponse = async ({ id: e, approved: t, reason: n, options: r }) => this.jobExecutor.run(async () => {
2892
- let i = this.state.messages, a = (r) => Q(r) && r.state === "approval-requested" && r.approval.id === e ? {
2892
+ let i = this.state.messages, a = (r) => Z(r) && r.state === "approval-requested" && r.approval.id === e ? {
2893
2893
  ...r,
2894
2894
  state: "approval-responded",
2895
2895
  approval: {
@@ -2898,7 +2898,7 @@ var dr = class {
2898
2898
  approved: t,
2899
2899
  reason: n
2900
2900
  }
2901
- } : r, o = i.findIndex((t) => t.parts.some((t) => Q(t) && t.state === "approval-requested" && t.approval.id === e));
2901
+ } : r, o = i.findIndex((t) => t.parts.some((t) => Z(t) && t.state === "approval-requested" && t.approval.id === e));
2902
2902
  if (o !== -1) {
2903
2903
  let e = i[o];
2904
2904
  this.state.replaceMessage(o, {
@@ -2919,7 +2919,7 @@ var dr = class {
2919
2919
  }
2920
2920
  }), this.addToolOutput = async ({ state: e, toolCallId: t, output: n, errorText: r, options: i }) => this.jobExecutor.run(async () => {
2921
2921
  let a = this.state.messages, o = (i) => {
2922
- if (!Q(i) || i.toolCallId !== t) return i;
2922
+ if (!Z(i) || i.toolCallId !== t) return i;
2923
2923
  let { approval: a, ...o } = i, s = a?.approved === !0 ? { approval: {
2924
2924
  ...a,
2925
2925
  approved: a.approved
@@ -2939,7 +2939,7 @@ var dr = class {
2939
2939
  output: n,
2940
2940
  errorText: void 0
2941
2941
  };
2942
- }, s = a.findIndex((e) => e.parts.some((e) => Q(e) && e.toolCallId === t));
2942
+ }, s = a.findIndex((e) => e.parts.some((e) => Z(e) && e.toolCallId === t));
2943
2943
  if (s !== -1) {
2944
2944
  let e = a[s];
2945
2945
  this.state.replaceMessage(s, {
@@ -3004,7 +3004,7 @@ var dr = class {
3004
3004
  }), r && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = this.state.messages[t]?.id ?? e);
3005
3005
  }
3006
3006
  async makeRequest(e) {
3007
- let t = ar();
3007
+ let t = or();
3008
3008
  try {
3009
3009
  await this.makeRequestImpl({
3010
3010
  ...e,
@@ -3057,17 +3057,17 @@ var dr = 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, ee = !1, y;
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) => Z(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;
3061
3061
  try {
3062
3062
  let s = {
3063
- state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : nr({
3063
+ state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : rr({
3064
3064
  lastMessage: e === "resume-stream" ? h : e === "regenerate-message" ? void 0 : this.state.snapshot(p),
3065
3065
  messageId: this.generateId()
3066
3066
  }),
3067
3067
  abortController: o,
3068
3068
  completionPromise: a
3069
3069
  };
3070
- y = s, s.abortController.signal.addEventListener("abort", () => {
3070
+ b = s, s.abortController.signal.addEventListener("abort", () => {
3071
3071
  _ = !0;
3072
3072
  }), this.activeResponse = s;
3073
3073
  let l;
@@ -3080,8 +3080,8 @@ var dr = class {
3080
3080
  body: r,
3081
3081
  trigger: e,
3082
3082
  messageId: i
3083
- }), await ir({
3084
- stream: rr({
3083
+ }), await ar({
3084
+ stream: ir({
3085
3085
  stream: l,
3086
3086
  resetStateOnMessageIdChange: e === "resume-stream",
3087
3087
  resetStateOnFirstMessageStart: e === "resume-stream" && this.transport.resumeStreamIsReplay,
@@ -3113,31 +3113,31 @@ var dr = 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 === y?.state && (this.resumableStreamState = void 0)), null;
3116
+ if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === b?.state && (this.resumableStreamState = void 0)), null;
3117
3117
  if (!c()) return null;
3118
- if (ee = !0, e instanceof TypeError) {
3118
+ if (y = !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 = y?.state : this.resumableStreamState === y?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
3122
+ v ? this.resumableStreamState = b?.state : this.resumableStreamState === b?.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
- y && this.onFinish?.({
3129
- message: y.state.message,
3128
+ b && this.onFinish?.({
3129
+ message: b.state.message,
3130
3130
  messages: this.state.messages,
3131
3131
  isAbort: _,
3132
3132
  isDisconnect: v,
3133
- isError: ee,
3134
- finishReason: y.state.finishReason
3133
+ isError: y,
3134
+ finishReason: b.state.finishReason
3135
3135
  });
3136
3136
  } finally {
3137
- this.activeResponse === y && (this.activeResponse = void 0), l();
3137
+ this.activeResponse === b && (this.activeResponse = void 0), l();
3138
3138
  }
3139
3139
  }
3140
- !_ && !ee && await this.runAutomaticRequest(() => this.makeRequest({
3140
+ !_ && !y && await this.runAutomaticRequest(() => this.makeRequest({
3141
3141
  trigger: "submit-message",
3142
3142
  messageId: this.lastMessage?.id,
3143
3143
  metadata: t,
@@ -3146,39 +3146,39 @@ var dr = class {
3146
3146
  }));
3147
3147
  }
3148
3148
  };
3149
- function mr({ messages: e }) {
3149
+ function hr({ messages: e }) {
3150
3150
  let t = e[e.length - 1];
3151
3151
  if (!t || t.role !== "assistant") return !1;
3152
- let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
3152
+ let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Z);
3153
3153
  return r.filter((e) => e.state === "approval-responded").length > 0 && r.every((e) => e.state === "output-available" && e.preliminary !== !0 || e.state === "output-error" || e.state === "output-denied" || e.state === "approval-responded");
3154
3154
  }
3155
3155
  //#endregion
3156
3156
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
3157
- var hr = /* @__PURE__ */ new WeakMap(), gr = 0;
3158
- function _r(e) {
3157
+ var gr = /* @__PURE__ */ new WeakMap(), _r = 0;
3158
+ function vr(e) {
3159
3159
  if (!e.length) return "";
3160
3160
  for (var t = "arg", n = 0; n < e.length; ++n) {
3161
3161
  var r = void 0;
3162
- e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : hr.has(e[n]) ? r = hr.get(e[n]) : (r = gr, hr.set(e[n], gr++)), t += "@" + r;
3162
+ e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : gr.has(e[n]) ? r = gr.get(e[n]) : (r = _r, gr.set(e[n], _r++)), t += "@" + r;
3163
3163
  }
3164
3164
  return t;
3165
3165
  }
3166
3166
  //#endregion
3167
3167
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
3168
- function vr(e) {
3168
+ function yr(e) {
3169
3169
  if (typeof e == "function") try {
3170
3170
  e = e();
3171
3171
  } catch {
3172
3172
  e = "";
3173
3173
  }
3174
- return e = Array.isArray(e) ? _r(e) : String(e || ""), e;
3174
+ return e = Array.isArray(e) ? vr(e) : String(e || ""), e;
3175
3175
  }
3176
- var yr = function() {
3176
+ var br = function() {
3177
3177
  function e(e) {
3178
3178
  e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
3179
3179
  }
3180
3180
  return e.prototype.serializeKey = function(e) {
3181
- return vr(e);
3181
+ return yr(e);
3182
3182
  }, e.prototype.get = function(e) {
3183
3183
  var t = this.serializeKey(e);
3184
3184
  return this.items.get(t);
@@ -3200,26 +3200,26 @@ var yr = function() {
3200
3200
  }();
3201
3201
  //#endregion
3202
3202
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
3203
- function br() {
3203
+ function xr() {
3204
3204
  return navigator.onLine === void 0 || navigator.onLine;
3205
3205
  }
3206
- function xr() {
3206
+ function Sr() {
3207
3207
  return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
3208
3208
  }
3209
- var Sr = {
3210
- isOnline: br,
3211
- isDocumentVisible: xr,
3209
+ var Cr = {
3210
+ isOnline: xr,
3211
+ isDocumentVisible: Sr,
3212
3212
  fetcher: function(e) {
3213
3213
  return fetch(e).then(function(e) {
3214
3214
  return e.json();
3215
3215
  });
3216
3216
  }
3217
- }, $ = function() {
3218
- return $ = Object.assign || function(e) {
3217
+ }, Q = function() {
3218
+ return Q = Object.assign || function(e) {
3219
3219
  for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
3220
3220
  return e;
3221
- }, $.apply(this, arguments);
3222
- }, Cr = function(e, t, n, r) {
3221
+ }, Q.apply(this, arguments);
3222
+ }, wr = function(e, t, n, r) {
3223
3223
  function i(e) {
3224
3224
  return e instanceof n ? e : new n(function(t) {
3225
3225
  t(e);
@@ -3245,7 +3245,7 @@ var Sr = {
3245
3245
  }
3246
3246
  c((r = r.apply(e, t || [])).next());
3247
3247
  });
3248
- }, wr = function(e, t) {
3248
+ }, $ = function(e, t) {
3249
3249
  var n = {
3250
3250
  label: 0,
3251
3251
  sent: function() {
@@ -3337,7 +3337,7 @@ var Sr = {
3337
3337
  }, Er = function(e, t, n) {
3338
3338
  if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
3339
3339
  return e.concat(a || Array.prototype.slice.call(t));
3340
- }, Dr = new yr(), Or = new yr(), kr = new yr(), Ar = {
3340
+ }, Dr = new br(), Or = new br(), kr = new br(), Ar = {
3341
3341
  cache: Dr,
3342
3342
  refreshInterval: 0,
3343
3343
  ttl: 0,
@@ -3348,9 +3348,9 @@ var Sr = {
3348
3348
  shouldRetryOnError: !0,
3349
3349
  errorRetryInterval: 5e3,
3350
3350
  errorRetryCount: 5,
3351
- fetcher: Sr.fetcher,
3352
- isOnline: Sr.isOnline,
3353
- isDocumentVisible: Sr.isDocumentVisible
3351
+ fetcher: Cr.fetcher,
3352
+ isOnline: Cr.isOnline,
3353
+ isDocumentVisible: Cr.isDocumentVisible
3354
3354
  };
3355
3355
  function jr(e, t, n) {
3356
3356
  var r = Or.get(e);
@@ -3372,9 +3372,9 @@ function Nr(e) {
3372
3372
  return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Ar.shouldRetryOnError;
3373
3373
  }
3374
3374
  var Pr = function(e, t, n, r) {
3375
- return n === void 0 && (n = Dr), r === void 0 && (r = Ar.ttl), Cr(void 0, void 0, void 0, function() {
3375
+ return n === void 0 && (n = Dr), r === void 0 && (r = Ar.ttl), wr(void 0, void 0, void 0, function() {
3376
3376
  var i, a, o, s, c, l, u;
3377
- return wr(this, function(d) {
3377
+ return $(this, function(d) {
3378
3378
  switch (d.label) {
3379
3379
  case 0:
3380
3380
  if (!Ir(t)) return [3, 5];
@@ -3410,14 +3410,14 @@ var Pr = function(e, t, n, r) {
3410
3410
  };
3411
3411
  function Fr() {
3412
3412
  for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
3413
- var r, i, a = $({}, Ar), o = !1, s = !1;
3414
- if (!me()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
3413
+ var r, i, a = Q({}, Ar), o = !1, s = !1;
3414
+ if (!pe()) 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
- 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 : x(r);
3416
+ t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = Q(Q({}, a), t[2]));
3417
+ var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : C(r);
3418
3418
  i === void 0 && (i = a.fetcher);
3419
3419
  var d = null;
3420
- d ||= _e({
3420
+ d ||= he({
3421
3421
  data: void 0,
3422
3422
  error: void 0,
3423
3423
  isValidating: !0,
@@ -3425,14 +3425,14 @@ function Fr() {
3425
3425
  key: null
3426
3426
  });
3427
3427
  var f = function(t, n) {
3428
- return Cr(e, void 0, void 0, function() {
3428
+ return wr(e, void 0, void 0, function() {
3429
3429
  var e, r, s, c, p, m, h, g = this;
3430
- return wr(this, function(_) {
3430
+ return $(this, function(_) {
3431
3431
  switch (_.label) {
3432
3432
  case 0: return e = d.data === void 0, r = u.value, r ? (s = a.cache.get(r), c = s && s.data, d.isValidating = !0, d.isLoading = !c, c && (d.data = c.data, d.error = c.error), p = t || i, !p || !a.isDocumentVisible() && !e || n?.forceRevalidate !== void 0 && !n?.forceRevalidate || s && (m = !!(Date.now() - s.createdAt >= a.dedupingInterval || n?.forceRevalidate), !m) ? (d.isValidating = !1, d.isLoading = !1, [2]) : (h = function() {
3433
- return Cr(g, void 0, void 0, function() {
3433
+ return wr(g, void 0, void 0, function() {
3434
3434
  var e, t, i, s, c, u;
3435
- return wr(this, function(m) {
3435
+ return $(this, function(m) {
3436
3436
  switch (m.label) {
3437
3437
  case 0: return e = kr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, Er([], Tr(t), !1)), kr.set(r, i, a.dedupingInterval), [4, Pr(r, i, a.cache, l)]);
3438
3438
  case 1: return m.sent(), [3, 4];
@@ -3449,8 +3449,8 @@ function Fr() {
3449
3449
  });
3450
3450
  });
3451
3451
  }, c && a.revalidateDebounce ? (setTimeout(function() {
3452
- return Cr(g, void 0, void 0, function() {
3453
- return wr(this, function(e) {
3452
+ return wr(g, void 0, void 0, function() {
3453
+ return $(this, function(e) {
3454
3454
  switch (e.label) {
3455
3455
  case 0: return o ? [3, 2] : [4, h()];
3456
3456
  case 1: e.sent(), e.label = 2;
@@ -3466,16 +3466,16 @@ function Fr() {
3466
3466
  });
3467
3467
  });
3468
3468
  }, p = function() {
3469
- return Cr(e, void 0, void 0, function() {
3470
- return wr(this, function(e) {
3469
+ return wr(e, void 0, void 0, function() {
3470
+ return $(this, function(e) {
3471
3471
  return [2, f(null, { shouldRetryOnError: !1 })];
3472
3472
  });
3473
3473
  });
3474
3474
  }, m = null;
3475
3475
  if (!c) {
3476
3476
  var h = function() {
3477
- return Cr(e, void 0, void 0, function() {
3478
- return wr(this, function(e) {
3477
+ return wr(e, void 0, void 0, function() {
3478
+ return $(this, function(e) {
3479
3479
  switch (e.label) {
3480
3480
  case 0: return d.error || !a.isOnline() ? [3, 2] : [4, f()];
3481
3481
  case 1: return e.sent(), [3, 3];
@@ -3487,7 +3487,7 @@ function Fr() {
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
+ me(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 = Or.get(u.value);
3493
3493
  e && (e.data = e.data.filter(function(e) {
@@ -3495,12 +3495,12 @@ function Fr() {
3495
3495
  }));
3496
3496
  });
3497
3497
  try {
3498
- S(u, function(e) {
3499
- he(u) || (u.value = e), d.key = e, d.isValidating = !!e, jr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3498
+ w(u, function(e) {
3499
+ S(u) || (u.value = e), d.key = e, d.isValidating = !!e, jr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3500
3500
  }, { immediate: !0 });
3501
3501
  } catch {}
3502
- return $($({}, ye(d)), { mutate: function(e, t) {
3503
- return f(e, $($({}, t), { forceRevalidate: !0 }));
3502
+ return Q(Q({}, _e(d)), { mutate: function(e, t) {
3503
+ return f(e, Q(Q({}, t), { forceRevalidate: !0 }));
3504
3504
  } });
3505
3505
  }
3506
3506
  function Ir(e) {
@@ -3512,13 +3512,13 @@ var Lr = Fr;
3512
3512
  Lr.default, Lr.default;
3513
3513
  var Rr = class {
3514
3514
  constructor(e) {
3515
- this.statusRef = x("ready"), this.errorRef = x(void 0), this.pushMessage = (e) => {
3515
+ this.statusRef = C("ready"), this.errorRef = C(void 0), this.pushMessage = (e) => {
3516
3516
  this.messagesRef.value = [...this.messagesRef.value, e];
3517
3517
  }, this.popMessage = () => {
3518
3518
  this.messagesRef.value = this.messagesRef.value.slice(0, -1);
3519
3519
  }, this.replaceMessage = (e, t) => {
3520
3520
  this.messagesRef.value[e] = { ...t };
3521
- }, this.snapshot = (e) => e, this.messagesRef = x(e ?? []);
3521
+ }, this.snapshot = (e) => e, this.messagesRef = C(e ?? []);
3522
3522
  }
3523
3523
  get messages() {
3524
3524
  return this.messagesRef.value;
@@ -3538,7 +3538,7 @@ var Rr = class {
3538
3538
  set error(e) {
3539
3539
  this.errorRef.value = e;
3540
3540
  }
3541
- }, zr = class extends pr {
3541
+ }, zr = class extends mr {
3542
3542
  constructor({ messages: e, ...t }) {
3543
3543
  super({
3544
3544
  ...t,
@@ -3561,36 +3561,36 @@ var Rr = class {
3561
3561
  }, qr = ({ messages: e }) => {
3562
3562
  let t = e[e.length - 1];
3563
3563
  if (!t || t.role !== "assistant") return !1;
3564
- let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && (re(Kr(e)) || oe(e)));
3565
- return r.length > 0 && r.every((e) => se.has(e.state ?? ""));
3564
+ 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(Kr(e)) || ee(e)));
3565
+ return r.length > 0 && r.every((e) => oe.has(e.state ?? ""));
3566
3566
  };
3567
3567
  function Jr(e) {
3568
- return Ce(`chatbot-${e}`, () => {
3569
- let { t, te: n, locale: r } = xe({ 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(), ne = x(), re = x(), ae = x(), se = ve(), me = x(0), he = x(), ge = ve(), _e = ve(), ye = x(), Ce = x(!1), De = x(0), je = x(), Me = x(!1), C = Se(), Ne = b(() => {
3568
+ return xe(`chatbot-${e}`, () => {
3569
+ let { t, te: n, locale: r } = ye({ useScope: "global" }), i = C(""), a = C(), o = C(e), s = C(), c = C(), l = C(), u = C(), d = C(), f = C(), p = C(), m = C(), h = C(), g = C(), _ = C(), v = C(), y = C(), b = C(), te = C(), ie = C(), oe = ge(), pe = C(0), S = C(), me = ge(), he = ge(), _e = C(), xe = C(!1), Te = C(0), ke = C(), Ae = C(!1), T = be(), je = x(() => {
3570
3570
  let e = u.value?.theme;
3571
- return (!e || e === "auto") && (e = je.value), e ? e === "dark" : C.value;
3572
- }), w = b(() => c.value === "reasoning"), Pe = b(() => w.value ? g.value?.filter((e) => ![
3571
+ return (!e || e === "auto") && (e = ke.value), e ? e === "dark" : T.value;
3572
+ }), E = x(() => c.value === "reasoning"), Me = x(() => E.value ? g.value?.filter((e) => ![
3573
3573
  "upvote",
3574
3574
  "downvote",
3575
3575
  "feedback"
3576
- ].includes(e)) : g.value), Fe = pe(b(() => `${o.value}-chatId`), null);
3577
- be(() => {
3578
- Fe.value ||= I();
3576
+ ].includes(e)) : g.value), Ne = fe(x(() => `${o.value}-chatId`), null);
3577
+ ve(() => {
3578
+ Ne.value ||= L();
3579
3579
  });
3580
- let T = b({
3581
- get: () => Fe.value,
3580
+ let D = x({
3581
+ get: () => Ne.value,
3582
3582
  set: (e) => {
3583
- Fe.value = e;
3583
+ Ne.value = e;
3584
3584
  }
3585
- }), E = fe(b(() => `${o.value}-pageAccessOff`), !1), Ie = b(() => E.value ? [] : ge.value ?? []), Le = () => E.value ? [] : _e.value?.() ?? [], Re = b(() => !!(he.value && ge.value?.length)), ze = pe(b(() => `${o.value}-pageNotice`), null), Be = b(() => {
3586
- let e = he.value?.level;
3587
- return e && e !== ie.Off && Ie.value.length && !te(ze.value ?? void 0, e) ? e : void 0;
3585
+ }), O = de(x(() => `${o.value}-pageAccessOff`), !1), Pe = x(() => O.value ? [] : me.value ?? []), Fe = () => O.value ? [] : he.value?.() ?? [], Ie = x(() => !!(S.value && me.value?.length)), Le = fe(x(() => `${o.value}-pageNotice`), null), Re = x(() => {
3586
+ let e = S.value?.level;
3587
+ return e && e !== ae.Off && Pe.value.length && !ne(Le.value ?? void 0, e) ? e : void 0;
3588
3588
  });
3589
- function Ve() {
3590
- ze.value = he.value?.level ?? null;
3589
+ function ze() {
3590
+ Le.value = S.value?.level ?? null;
3591
3591
  }
3592
- let D = x(), O = x(!1), He = b(() => D.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3593
- function Ue(e) {
3592
+ let Be = C(), k = C(!1), Ve = x(() => Be.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3593
+ function He(e) {
3594
3594
  try {
3595
3595
  let t = JSON.parse(e.message);
3596
3596
  return t.status === 404 || t.type?.includes("entity-not-found");
@@ -3598,76 +3598,76 @@ function Jr(e) {
3598
3598
  return !1;
3599
3599
  }
3600
3600
  }
3601
- function We(e) {
3602
- if (Ue(e)) {
3603
- let e = M.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? de(t) : void 0;
3604
- T.value = I(), M.value.clearError(), D.value = void 0, n && M.value.sendMessage({ text: n });
3605
- } else le.error(e), D.value = e, He.value && (O.value = !0);
3601
+ function Ue(e) {
3602
+ if (He(e)) {
3603
+ let e = N.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ue(t) : void 0;
3604
+ D.value = L(), N.value.clearError(), Be.value = void 0, n && N.value.sendMessage({ text: n });
3605
+ } else ce.error(e), Be.value = e, Ve.value && (k.value = !0);
3606
3606
  }
3607
- let k = b(() => ce({
3607
+ let A = x(() => se({
3608
3608
  baseUrl: i.value,
3609
3609
  basePath: a.value,
3610
3610
  headers: () => p.value
3611
- })), Ge = x(null), Ke = () => ({
3612
- ...we(),
3613
- ...Ge.value ?? {}
3614
- }), qe = () => {
3615
- let e = De.value;
3611
+ })), We = C(null), Ge = () => ({
3612
+ ...Se(),
3613
+ ...We.value ?? {}
3614
+ }), Ke = () => {
3615
+ let e = Te.value;
3616
3616
  return new Promise((t) => {
3617
3617
  let n = setTimeout(() => {
3618
3618
  r(), t(!1);
3619
- }, 3e4), r = S(() => [De.value, M.value.status], ([i, a]) => {
3619
+ }, 3e4), r = w(() => [Te.value, N.value.status], ([i, a]) => {
3620
3620
  i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
3621
3621
  });
3622
3622
  });
3623
- }, A = ve(), Je = (e, t) => new Promise((n) => {
3624
- A.value?.answer(!1), A.value = {
3623
+ }, j = ge(), qe = (e, t) => new Promise((n) => {
3624
+ j.value?.answer(!1), j.value = {
3625
3625
  toolCallId: e.toolCallId,
3626
3626
  question: t,
3627
3627
  answer: (e) => {
3628
- A.value = void 0, n(e);
3628
+ j.value = void 0, n(e);
3629
3629
  }
3630
3630
  };
3631
3631
  });
3632
- function Ye(e) {
3633
- A.value?.answer(e);
3632
+ function Je(e) {
3633
+ j.value?.answer(e);
3634
3634
  }
3635
- let Xe = Ae({
3635
+ let Ye = Oe({
3636
3636
  registry: () => [
3637
- ...(se.value ?? []).filter((e) => !ee(e.name)),
3638
- ...Ie.value,
3639
- ...Le()
3637
+ ...(oe.value ?? []).filter((e) => !re(e.name)),
3638
+ ...Pe.value,
3639
+ ...Fe()
3640
3640
  ],
3641
- capability: () => ae.value,
3642
- addToolOutput: (e) => void M.value.addToolOutput(e),
3643
- confirm: Je,
3644
- waitForResume: qe,
3641
+ capability: () => ie.value,
3642
+ addToolOutput: (e) => void N.value.addToolOutput(e),
3643
+ confirm: qe,
3644
+ waitForResume: Ke,
3645
3645
  onPendingChange: (e) => {
3646
- me.value = e;
3646
+ pe.value = e;
3647
3647
  },
3648
3648
  onActivity: (e) => {
3649
3649
  if (e?.provider !== "page" || e.readOnly) {
3650
- ye.value = void 0;
3650
+ _e.value = void 0;
3651
3651
  return;
3652
3652
  }
3653
- let t = [...Ie.value, ...Le()].find((t) => t.name === e.toolName);
3654
- ye.value = { title: t?.annotations?.title ?? e.toolName }, Ce.value = !0;
3653
+ let t = [...Pe.value, ...Fe()].find((t) => t.name === e.toolName);
3654
+ _e.value = { title: t?.annotations?.title ?? e.toolName }, xe.value = !0;
3655
3655
  }
3656
3656
  });
3657
- async function Ze() {
3658
- j(), ye.value = void 0, Ce.value = !1, U.value = "", await M.value.stop();
3657
+ async function Xe() {
3658
+ M(), _e.value = void 0, xe.value = !1, H.value = "", await N.value.stop();
3659
3659
  }
3660
- function j() {
3661
- Xe.cancelAll(), A.value?.answer(!1);
3660
+ function M() {
3661
+ Ye.cancelAll(), j.value?.answer(!1);
3662
3662
  }
3663
- async function Qe(e) {
3664
- E.value = e, e && await Ze();
3663
+ async function Ze(e) {
3664
+ O.value = e, e && await Xe();
3665
3665
  }
3666
- S(T, () => j());
3667
- let M = b(() => new zr({
3668
- id: T.value,
3669
- transport: new fr({
3670
- api: k.value.getChatEndpoint(o.value, w.value ? "reasoning" : "chat"),
3666
+ w(D, () => M());
3667
+ let N = x(() => new zr({
3668
+ id: D.value,
3669
+ transport: new pr({
3670
+ api: A.value.getChatEndpoint(o.value, E.value ? "reasoning" : "chat"),
3671
3671
  prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
3672
3672
  id: t,
3673
3673
  messages: [e[e.length - 1]],
@@ -3682,15 +3682,15 @@ function Jr(e) {
3682
3682
  reasoning: d.value?.reasoning,
3683
3683
  webSearch: f.value?.webSearch,
3684
3684
  smoothStream: u.value?.smoothStream,
3685
- deviceContext: Ke(),
3686
- externalContext: re.value,
3685
+ deviceContext: Ge(),
3686
+ externalContext: te.value,
3687
3687
  disabledTools: f.value?.disabled,
3688
3688
  fallbackModels: y.value,
3689
- gatewayOptions: ne.value,
3690
- hostTools: ke(se.value, ae.value),
3691
- pageTools: he.value && Ie.value.length ? {
3689
+ gatewayOptions: b.value,
3690
+ hostTools: De(oe.value, ie.value),
3691
+ pageTools: S.value && Pe.value.length ? {
3692
3692
  version: 1,
3693
- forms: Le().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3693
+ forms: Fe().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3694
3694
  name: e,
3695
3695
  description: t,
3696
3696
  inputSchema: n,
@@ -3701,38 +3701,38 @@ function Jr(e) {
3701
3701
  credentials: "include",
3702
3702
  headers: () => p.value ?? {}
3703
3703
  }),
3704
- sendAutomaticallyWhen: (e) => qr(e) || mr(e),
3705
- onError: We,
3704
+ sendAutomaticallyWhen: (e) => qr(e) || hr(e),
3705
+ onError: Ue,
3706
3706
  onToolCall: ({ toolCall: e }) => {
3707
- if (!Oe(e)) return;
3707
+ if (!Ee(e)) return;
3708
3708
  let t = e;
3709
- Xe.enqueue({
3709
+ Ye.enqueue({
3710
3710
  toolCallId: t.toolCallId,
3711
3711
  toolName: t.toolName,
3712
3712
  input: t.input,
3713
- messageId: M.value.lastMessage?.id ?? "",
3713
+ messageId: N.value.lastMessage?.id ?? "",
3714
3714
  readOnly: t.toolMetadata?.readOnly === !0,
3715
3715
  provider: t.toolMetadata?.provider === "page" ? "page" : "app"
3716
3716
  });
3717
3717
  },
3718
3718
  onData: (e) => {
3719
- e.type === "data-audioTranscripts" && (M.value.messages = ue(M.value.messages, e.data));
3719
+ e.type === "data-audioTranscripts" && (N.value.messages = le(N.value.messages, e.data));
3720
3720
  },
3721
3721
  onFinish: () => {
3722
- let e = T.value;
3723
- !w.value && !N.value.some((t) => t.id === e) && dt(o.value);
3722
+ let e = D.value;
3723
+ !E.value && !P.value.some((t) => t.id === e) && ft(o.value);
3724
3724
  }
3725
- })), $e = b(() => {
3725
+ })), Qe = x(() => {
3726
3726
  let e = u.value?.initialMessage;
3727
3727
  return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
3728
- }), et = I(), tt = b(() => ({
3729
- id: et,
3728
+ }), $e = L(), et = x(() => ({
3729
+ id: $e,
3730
3730
  role: "assistant",
3731
3731
  parts: [{
3732
3732
  type: "text",
3733
- text: $e.value
3733
+ text: Qe.value
3734
3734
  }]
3735
- })), nt = b(() => {
3735
+ })), tt = x(() => {
3736
3736
  let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
3737
3737
  ...e,
3738
3738
  parts: e.parts.map((e) => {
@@ -3742,78 +3742,78 @@ function Jr(e) {
3742
3742
  let e = t.url.slice(13);
3743
3743
  return {
3744
3744
  ...t,
3745
- url: k.value.getMediaUrl(o.value, T.value, e)
3745
+ url: A.value.getMediaUrl(o.value, D.value, e)
3746
3746
  };
3747
3747
  }
3748
3748
  return t.url.startsWith("blob:") ? t : {
3749
3749
  ...t,
3750
- url: k.value.appendAuthToken(t.url)
3750
+ url: A.value.appendAuthToken(t.url)
3751
3751
  };
3752
3752
  })
3753
3753
  });
3754
- return w.value ? e(M.value.messages) : !Me.value && M.value.messages?.[0]?.role !== "assistant" ? [tt.value, ...e(M.value.messages)] : e(M.value.messages);
3755
- }), rt = b(() => {
3754
+ return E.value ? e(N.value.messages) : !Ae.value && N.value.messages?.[0]?.role !== "assistant" ? [et.value, ...e(N.value.messages)] : e(N.value.messages);
3755
+ }), nt = x(() => {
3756
3756
  let e = u.value?.messagePlaceholder;
3757
3757
  return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
3758
- }), N = x([]), it = x(!1), P = x([]), F = x(!1), at = x("chat"), L = x([]), R = x(), ot = x(!1), st = x(!1), ct = x(), z = x(!1), B = x(!1), lt = x(), V = x(""), H = x([]), U = x(""), ut = x(0);
3759
- async function dt(e) {
3760
- if (w.value) N.value = [];
3758
+ }), P = C([]), rt = C(!1), F = C([]), I = C(!1), it = C("chat"), R = C([]), at = C(), ot = C(!1), st = C(!1), ct = C(), lt = C(!1), z = C(!1), ut = C(), B = C(""), V = C([]), H = C(""), dt = C(0);
3759
+ async function ft(e) {
3760
+ if (E.value) P.value = [];
3761
3761
  else {
3762
- it.value = !0;
3762
+ rt.value = !0;
3763
3763
  try {
3764
- N.value = await k.value.getConversations(e, l.value);
3764
+ P.value = await A.value.getConversations(e, l.value);
3765
3765
  } catch {
3766
- N.value = [];
3766
+ P.value = [];
3767
3767
  } finally {
3768
- it.value = !1;
3768
+ rt.value = !1;
3769
3769
  }
3770
3770
  }
3771
3771
  }
3772
- async function ft() {
3773
- let e = T.value;
3774
- if (!e) P.value = [];
3772
+ async function pt() {
3773
+ let e = D.value;
3774
+ if (!e) F.value = [];
3775
3775
  else {
3776
- F.value = !0;
3776
+ I.value = !0;
3777
3777
  try {
3778
- P.value = await k.value.getChatFiles(e);
3778
+ F.value = await A.value.getChatFiles(e);
3779
3779
  } catch {
3780
- P.value = [];
3780
+ F.value = [];
3781
3781
  } finally {
3782
- F.value = !1;
3782
+ I.value = !1;
3783
3783
  }
3784
3784
  }
3785
3785
  }
3786
- function pt(e, t = !1) {
3787
- return k.value.getChatFileDownloadUrl(e, t);
3786
+ function mt(e, t = !1) {
3787
+ return A.value.getChatFileDownloadUrl(e, t);
3788
3788
  }
3789
- function mt(e) {
3790
- return k.value.getChatFilePreviewUrl(e);
3789
+ function ht(e) {
3790
+ return A.value.getChatFilePreviewUrl(e);
3791
3791
  }
3792
- async function ht(e) {
3793
- await k.value.deleteChatFile(e);
3794
- let t = P.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
3795
- P.value = P.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
3792
+ async function gt(e) {
3793
+ await A.value.deleteChatFile(e);
3794
+ let t = F.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
3795
+ F.value = F.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
3796
3796
  }
3797
- async function gt(e, t) {
3798
- if (!w.value) try {
3799
- let n = await k.value.getChat(e, t);
3800
- if (t !== T.value || M.value.status !== "ready" || M.value.messages.length > 0) return;
3801
- n && (M.value.messages = n.messages, O.value = n.blocked ?? !1, _t(e, t));
3797
+ async function _t(e, t) {
3798
+ if (!E.value) try {
3799
+ let n = await A.value.getChat(e, t);
3800
+ if (t !== D.value || N.value.status !== "ready" || N.value.messages.length > 0) return;
3801
+ n && (N.value.messages = n.messages, k.value = n.blocked ?? !1, vt(e, t));
3802
3802
  } catch {}
3803
3803
  }
3804
- async function _t(e, t) {
3804
+ async function vt(e, t) {
3805
3805
  let n;
3806
3806
  try {
3807
- n = Number(sessionStorage.getItem(Ee)), sessionStorage.removeItem(Ee);
3807
+ n = Number(sessionStorage.getItem(we)), sessionStorage.removeItem(we);
3808
3808
  } catch {
3809
3809
  return;
3810
3810
  }
3811
- if (!(!n || Date.now() - n > 6e4 || E.value)) for (let n = 0; n < 12; n++) {
3812
- let n = M.value.messages[M.value.messages.length - 1];
3811
+ if (!(!n || Date.now() - n > 6e4 || O.value)) for (let n = 0; n < 12; n++) {
3812
+ let n = N.value.messages[N.value.messages.length - 1];
3813
3813
  if (n?.role === "assistant") {
3814
- let e = n.parts.filter((e) => oe(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
3814
+ let e = n.parts.filter((e) => ee(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
3815
3815
  if (e.length > 0) {
3816
- if (t.length === e.length && !E.value) for (let e of t) Xe.enqueue({
3816
+ if (t.length === e.length && !O.value) for (let e of t) Ye.enqueue({
3817
3817
  toolCallId: e.toolCallId,
3818
3818
  toolName: e.toolName,
3819
3819
  input: e.input,
@@ -3825,252 +3825,252 @@ function Jr(e) {
3825
3825
  }
3826
3826
  if (n.parts[n.parts.length - 1]?.type === "text") return;
3827
3827
  }
3828
- if (await new Promise((e) => setTimeout(e, 1500)), t !== T.value || M.value.status !== "ready") return;
3828
+ if (await new Promise((e) => setTimeout(e, 1500)), t !== D.value || N.value.status !== "ready") return;
3829
3829
  try {
3830
- let n = await k.value.getChat(e, t);
3831
- n && t === T.value && (M.value.messages = n.messages);
3830
+ let n = await A.value.getChat(e, t);
3831
+ n && t === D.value && (N.value.messages = n.messages);
3832
3832
  } catch {
3833
3833
  return;
3834
3834
  }
3835
3835
  }
3836
3836
  }
3837
- let vt = () => {
3838
- let e = M.value.status;
3837
+ let yt = () => {
3838
+ let e = N.value.status;
3839
3839
  return e === "submitted" || e === "streaming";
3840
- }, yt = 0, bt = 0;
3841
- async function xt() {
3842
- if (w.value || vt()) return "indeterminate";
3843
- let e = T.value, t = yt += 1;
3840
+ }, bt = 0, xt = 0;
3841
+ async function St() {
3842
+ if (E.value || yt()) return "indeterminate";
3843
+ let e = D.value, t = bt += 1;
3844
3844
  try {
3845
- let n = await k.value.getChat(o.value, e);
3846
- if (!n || e !== T.value || vt() || t <= bt) return "indeterminate";
3847
- bt = t;
3848
- let r = n.messages, i = Gr(r, M.value.messages);
3849
- return M.value.messages = [...r, ...i], O.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3845
+ let n = await A.value.getChat(o.value, e);
3846
+ if (!n || e !== D.value || yt() || t <= xt) return "indeterminate";
3847
+ xt = t;
3848
+ let r = n.messages, i = Gr(r, N.value.messages);
3849
+ return N.value.messages = [...r, ...i], k.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3850
3850
  } catch {}
3851
3851
  return "indeterminate";
3852
3852
  }
3853
- function St(e) {
3854
- M.value.messages = [...M.value.messages, e];
3853
+ function Ct(e) {
3854
+ N.value.messages = [...N.value.messages, e];
3855
3855
  }
3856
- async function Ct(e) {
3856
+ async function wt(e) {
3857
3857
  try {
3858
- L.value = await k.value.getMessageFeedbacks(e);
3858
+ R.value = await A.value.getMessageFeedbacks(e);
3859
3859
  } catch {
3860
- L.value = [];
3860
+ R.value = [];
3861
3861
  }
3862
3862
  }
3863
- function W(e) {
3864
- let t = L.value.findIndex((t) => t.messageId === e.messageId);
3865
- t >= 0 ? L.value[t] = e : L.value.push(e);
3863
+ function U(e) {
3864
+ let t = R.value.findIndex((t) => t.messageId === e.messageId);
3865
+ t >= 0 ? R.value[t] = e : R.value.push(e);
3866
3866
  }
3867
- function wt(e) {
3868
- let t = nt.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3867
+ function Tt(e) {
3868
+ let t = tt.value, n = t.findIndex((t) => t.id === e.id), r = ue(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3869
3869
  return {
3870
- userQuestion: de(i ?? e) ?? "",
3870
+ userQuestion: ue(i ?? e) ?? "",
3871
3871
  assistantMessage: r
3872
3872
  };
3873
3873
  }
3874
- async function Tt(e, t) {
3874
+ async function Et(e, t) {
3875
3875
  await Promise.all([
3876
- gt(e, t),
3877
- dt(e),
3878
- Ct(t)
3879
- ]), Ge.value || Te((e, t) => k.value.reverseGeocode(e, t, r.value)).then((e) => {
3880
- e && (Ge.value = e);
3876
+ _t(e, t),
3877
+ ft(e),
3878
+ wt(t)
3879
+ ]), We.value || Ce((e, t) => A.value.reverseGeocode(e, t, r.value)).then((e) => {
3880
+ e && (We.value = e);
3881
3881
  });
3882
3882
  }
3883
- async function Et() {
3884
- let e = V.value.trim(), t = H.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3883
+ async function Dt() {
3884
+ let e = B.value.trim(), t = V.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3885
3885
  type: "file",
3886
3886
  mediaType: e.mediaSource.mimeType,
3887
3887
  url: e.localUrl,
3888
3888
  filename: e.mediaSource.name,
3889
3889
  providerMetadata: { "8bot": { media: e.mediaSource } }
3890
3890
  }));
3891
- w.value && nt.value.length > 0 && await jt(), j(), U.value = e, ut.value = M.value.messages.length;
3892
- let n = M.value.sendMessage;
3891
+ E.value && tt.value.length > 0 && await Mt(), M(), H.value = e, dt.value = N.value.messages.length;
3892
+ let n = N.value.sendMessage;
3893
3893
  n({
3894
3894
  text: e,
3895
3895
  files: t.length > 0 ? t : void 0
3896
- }), V.value = "", At();
3896
+ }), B.value = "", jt();
3897
3897
  }
3898
- function Dt(e) {
3898
+ function Ot(e) {
3899
3899
  let t = e.trim();
3900
3900
  if (!t) return;
3901
- if (M.value.status !== "ready") {
3902
- le.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
3901
+ if (N.value.status !== "ready") {
3902
+ ce.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
3903
3903
  return;
3904
3904
  }
3905
- let n = M.value.sendMessage;
3906
- j(), n({ text: t });
3905
+ let n = N.value.sendMessage;
3906
+ M(), n({ text: t });
3907
3907
  }
3908
- async function G() {
3909
- let e = M.value.messages.slice(ut.value).some((e) => e.parts.some(oe)), t = U.value, n = t.length > 0 && !e;
3910
- j(), await M.value.stop(), n && (V.value = t, M.value.messages = M.value.messages.slice(0, ut.value), U.value = "");
3908
+ async function W() {
3909
+ let e = N.value.messages.slice(dt.value).some((e) => e.parts.some(ee)), t = H.value, n = t.length > 0 && !e;
3910
+ M(), await N.value.stop(), n && (B.value = t, N.value.messages = N.value.messages.slice(0, dt.value), H.value = "");
3911
3911
  }
3912
- S(() => M.value.messages, (e) => {
3913
- let t = A.value?.toolCallId;
3914
- t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && j();
3915
- }), S(() => M.value.status, (e) => {
3916
- e === "submitted" && De.value++;
3912
+ w(() => N.value.messages, (e) => {
3913
+ let t = j.value?.toolCallId;
3914
+ t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && M();
3915
+ }), w(() => N.value.status, (e) => {
3916
+ e === "submitted" && Te.value++;
3917
3917
  });
3918
- let K;
3919
- S(() => [M.value.status, me.value], ([e, t]) => {
3920
- clearTimeout(K), e === "ready" && t === 0 && (K = setTimeout(() => {
3921
- Ce.value = !1;
3918
+ let G;
3919
+ w(() => [N.value.status, pe.value], ([e, t]) => {
3920
+ clearTimeout(G), e === "ready" && t === 0 && (G = setTimeout(() => {
3921
+ xe.value = !1;
3922
3922
  }, 1500));
3923
3923
  });
3924
- let Ot = x(!1), kt;
3925
- S(() => !A.value && !Vr(M.value.lastMessage) && (vt() || me.value > 0), (e) => {
3926
- clearTimeout(kt), e ? Ot.value = !0 : kt = setTimeout(() => {
3927
- Ot.value = !1;
3924
+ let kt = C(!1), At;
3925
+ w(() => !j.value && !Vr(N.value.lastMessage) && (yt() || pe.value > 0), (e) => {
3926
+ clearTimeout(At), e ? kt.value = !0 : At = setTimeout(() => {
3927
+ kt.value = !1;
3928
3928
  }, 400);
3929
- }, { immediate: !0 }), S(() => M.value.status, (e) => {
3930
- e === "ready" && U.value.length > 0 && (U.value = "");
3929
+ }, { immediate: !0 }), w(() => N.value.status, (e) => {
3930
+ e === "ready" && H.value.length > 0 && (H.value = "");
3931
3931
  });
3932
- function At(e = !1) {
3933
- for (let t of H.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
3934
- H.value = [], Bt.value = null;
3932
+ function jt(e = !1) {
3933
+ for (let t of V.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
3934
+ V.value = [], Vt.value = null;
3935
3935
  }
3936
- async function jt() {
3937
- return U.value = "", await G(), T.value = I(), M.value.clearError(), D.value = void 0, O.value = !1, At(!0), Zt("chat"), T.value;
3936
+ async function Mt() {
3937
+ return H.value = "", await W(), D.value = L(), N.value.clearError(), Be.value = void 0, k.value = !1, jt(!0), Qt("chat"), D.value;
3938
3938
  }
3939
- async function Mt(e) {
3940
- M.value.status !== "ready" && (U.value = "", await G()), j(), await M.value.regenerate(e);
3939
+ async function Nt(e) {
3940
+ N.value.status !== "ready" && (H.value = "", await W()), M(), await N.value.regenerate(e);
3941
3941
  }
3942
- function Nt(e) {
3942
+ function Pt(e) {
3943
3943
  if (e.tool === "requestGeolocation") {
3944
3944
  let t = e.output;
3945
- "latitude" in t && (Ge.value = {
3945
+ "latitude" in t && (We.value = {
3946
3946
  geolocationLatitude: t.latitude,
3947
3947
  geolocationLongitude: t.longitude,
3948
3948
  geolocationAccuracy: t.accuracy,
3949
3949
  geolocationCity: t.city
3950
3950
  });
3951
3951
  }
3952
- M.value.addToolOutput(e);
3952
+ N.value.addToolOutput(e);
3953
3953
  }
3954
- function Pt(e) {
3955
- M.value.addToolApprovalResponse(e);
3954
+ function Ft(e) {
3955
+ N.value.addToolApprovalResponse(e);
3956
3956
  }
3957
- let Ft = b(() => M.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), It = b(() => _.value?.maxFilesPerMessage ?? 5), Lt = b(() => _.value?.maxFilesPerChat ?? 20), Rt = b(() => Math.max(0, Math.min(It.value - H.value.length, Lt.value - Ft.value - H.value.length))), zt = b(() => Rt.value <= 0), Bt = x(null), Vt = () => {
3958
- Bt.value = null;
3957
+ let It = x(() => N.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Lt = x(() => _.value?.maxFilesPerMessage ?? 5), Rt = x(() => _.value?.maxFilesPerChat ?? 20), zt = x(() => Math.max(0, Math.min(Lt.value - V.value.length, Rt.value - It.value - V.value.length))), Bt = x(() => zt.value <= 0), Vt = C(null), Ht = () => {
3958
+ Vt.value = null;
3959
3959
  };
3960
- S(zt, (e) => {
3961
- e || (Bt.value = null);
3960
+ w(Bt, (e) => {
3961
+ e || (Vt.value = null);
3962
3962
  });
3963
- async function Ht(e) {
3964
- if (zt.value) {
3965
- Bt.value = Lt.value - Ft.value - H.value.length <= It.value - H.value.length ? {
3963
+ async function Ut(e) {
3964
+ if (Bt.value) {
3965
+ Vt.value = Rt.value - It.value - V.value.length <= Lt.value - V.value.length ? {
3966
3966
  reason: "per-chat",
3967
- max: Lt.value
3967
+ max: Rt.value
3968
3968
  } : {
3969
3969
  reason: "per-message",
3970
- max: It.value
3970
+ max: Lt.value
3971
3971
  };
3972
3972
  return;
3973
3973
  }
3974
- let t = I(), n = {
3974
+ let t = L(), n = {
3975
3975
  id: t,
3976
3976
  file: e,
3977
3977
  localUrl: URL.createObjectURL(e),
3978
3978
  state: "uploading"
3979
3979
  };
3980
- H.value = [...H.value, n];
3980
+ V.value = [...V.value, n];
3981
3981
  try {
3982
- let n = await k.value.uploadMedia(o.value, T.value, e);
3983
- H.value = H.value.map((e) => e.id === t ? {
3982
+ let n = await A.value.uploadMedia(o.value, D.value, e);
3983
+ V.value = V.value.map((e) => e.id === t ? {
3984
3984
  ...e,
3985
3985
  state: "done",
3986
3986
  mediaSource: n
3987
3987
  } : e);
3988
3988
  } catch (e) {
3989
3989
  let n = e instanceof Error ? e.message : "Upload failed";
3990
- H.value = H.value.map((e) => e.id === t ? {
3990
+ V.value = V.value.map((e) => e.id === t ? {
3991
3991
  ...e,
3992
3992
  state: "error",
3993
3993
  error: n
3994
3994
  } : e);
3995
3995
  }
3996
3996
  }
3997
- async function Ut(e, t) {
3998
- let { userQuestion: n, assistantMessage: r } = wt(e);
3999
- W(await k.value.submitMessageFeedback({
3997
+ async function Wt(e, t) {
3998
+ let { userQuestion: n, assistantMessage: r } = Tt(e);
3999
+ U(await A.value.submitMessageFeedback({
4000
4000
  messageId: e.id,
4001
- chatId: T.value,
4001
+ chatId: D.value,
4002
4002
  agentId: o.value,
4003
4003
  vote: t,
4004
4004
  userQuestion: n,
4005
4005
  assistantMessage: r
4006
4006
  }));
4007
4007
  }
4008
- async function Wt(e) {
4009
- await Ut(e, "upvote");
4010
- }
4011
4008
  async function Gt(e) {
4012
- await Ut(e, "downvote");
4009
+ await Wt(e, "upvote");
4013
4010
  }
4014
- function Kt(e) {
4015
- st.value = !1, ct.value = void 0, R.value = e;
4011
+ async function Kt(e) {
4012
+ await Wt(e, "downvote");
4016
4013
  }
4017
- async function qt(e) {
4018
- if (R.value) try {
4014
+ function qt(e) {
4015
+ st.value = !1, ct.value = void 0, at.value = e;
4016
+ }
4017
+ async function Jt(e) {
4018
+ if (at.value) try {
4019
4019
  ot.value = !0, st.value = !1, ct.value = void 0;
4020
- let { userQuestion: t, assistantMessage: n } = wt(R.value);
4021
- W(await k.value.submitMessageFeedback({
4022
- messageId: R.value.id,
4023
- chatId: T.value,
4020
+ let { userQuestion: t, assistantMessage: n } = Tt(at.value);
4021
+ U(await A.value.submitMessageFeedback({
4022
+ messageId: at.value.id,
4023
+ chatId: D.value,
4024
4024
  agentId: o.value,
4025
4025
  userQuestion: t,
4026
4026
  assistantMessage: n,
4027
4027
  comment: e
4028
- })), st.value = !0, await Ct(T.value);
4028
+ })), st.value = !0, await wt(D.value);
4029
4029
  } catch {
4030
4030
  ct.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4031
4031
  } finally {
4032
4032
  ot.value = !1;
4033
4033
  }
4034
4034
  }
4035
- async function Jt(e) {
4035
+ async function Yt(e) {
4036
4036
  try {
4037
- B.value = !0, z.value = !1, lt.value = void 0, await k.value.submitLead({
4037
+ z.value = !0, lt.value = !1, ut.value = void 0, await A.value.submitLead({
4038
4038
  agentId: o.value,
4039
- chatId: T.value,
4039
+ chatId: D.value,
4040
4040
  ...e
4041
- }), z.value = !0;
4041
+ }), lt.value = !0;
4042
4042
  } catch {
4043
- lt.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4043
+ ut.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4044
4044
  } finally {
4045
- B.value = !1;
4045
+ z.value = !1;
4046
4046
  }
4047
4047
  }
4048
- async function Yt(e, t) {
4049
- let n = await k.value.updateChatTitle(o.value, e, t);
4050
- N.value = N.value.map((t) => t.id === e ? {
4048
+ async function Xt(e, t) {
4049
+ let n = await A.value.updateChatTitle(o.value, e, t);
4050
+ P.value = P.value.map((t) => t.id === e ? {
4051
4051
  ...t,
4052
4052
  title: n.title
4053
4053
  } : t);
4054
4054
  }
4055
- async function Xt(e) {
4056
- await k.value.deleteChat(o.value, e), N.value = N.value.filter((t) => t.id !== e), T.value === e && await jt();
4057
- }
4058
- function Zt(e) {
4059
- at.value = e;
4055
+ async function Zt(e) {
4056
+ await A.value.deleteChat(o.value, e), P.value = P.value.filter((t) => t.id !== e), D.value === e && await Mt();
4060
4057
  }
4061
- let q;
4062
4058
  function Qt(e) {
4063
- let t = () => k.value.getChat(o.value, e).then((e) => e !== null);
4059
+ it.value = e;
4060
+ }
4061
+ let K;
4062
+ function $t(e) {
4063
+ let t = () => A.value.getChat(o.value, e).then((e) => e !== null);
4064
4064
  return t().catch(() => t().catch(() => !1));
4065
4065
  }
4066
- return S(l, async (e) => {
4067
- if (!e || e === q) return;
4068
- let t = q;
4069
- if (q = e, t === void 0) return;
4070
- let n = T.value, r = !w.value && await Qt(n);
4071
- l.value === e && T.value === n && (r ? dt(o.value) : (N.value = [], L.value = [], P.value = [], await jt(), V.value = ""));
4066
+ return w(l, async (e) => {
4067
+ if (!e || e === K) return;
4068
+ let t = K;
4069
+ if (K = e, t === void 0) return;
4070
+ let n = D.value, r = !E.value && await $t(n);
4071
+ l.value === e && D.value === n && (r ? ft(o.value) : (P.value = [], R.value = [], F.value = [], await Mt(), B.value = ""));
4072
4072
  }), {
4073
- apiClient: k,
4073
+ apiClient: A,
4074
4074
  baseUrl: i,
4075
4075
  basePath: a,
4076
4076
  agentId: o,
@@ -4084,86 +4084,86 @@ function Jr(e) {
4084
4084
  revisedAnswers: m,
4085
4085
  model: h,
4086
4086
  actionsInput: g,
4087
- actions: Pe,
4087
+ actions: Me,
4088
4088
  agentFileUpload: _,
4089
4089
  agentVoice: v,
4090
4090
  fallbackModels: y,
4091
- gatewayOptions: ne,
4092
- externalContext: re,
4093
- agentHostTools: ae,
4094
- hostToolRegistry: se,
4095
- hostToolsPending: me,
4096
- agentPageAccess: he,
4097
- pageToolRegistry: ge,
4098
- pageFormsProvider: _e,
4099
- pageAction: ye,
4100
- pageControlActive: Ce,
4101
- isWorking: Ot,
4102
- stopHostActions: Ze,
4103
- pageNoticeLevel: Be,
4104
- closePageNotice: Ve,
4105
- hostConfirmation: A,
4106
- respondHostConfirmation: Ye,
4107
- pageAccessAvailable: Re,
4108
- pageAccessOff: E,
4109
- setPageAccessOff: Qe,
4110
- systemTheme: je,
4111
- hideWelcomeMessage: Me,
4112
- isDark: Ne,
4113
- chat: M,
4114
- messages: nt,
4115
- conversations: N,
4116
- isLoadingConversations: it,
4117
- chatFiles: P,
4118
- isLoadingChatFiles: F,
4119
- input: V,
4120
- pendingAttachments: H,
4121
- isAttachmentLimitReached: zt,
4122
- fileLimitError: Bt,
4123
- localChatId: T,
4124
- isConversationBlocked: O,
4125
- inputMessagePlaceholder: rt,
4126
- chatError: D,
4127
- activeView: at,
4128
- messageFeedbacks: L,
4129
- feedbackDialogMessage: R,
4091
+ gatewayOptions: b,
4092
+ externalContext: te,
4093
+ agentHostTools: ie,
4094
+ hostToolRegistry: oe,
4095
+ hostToolsPending: pe,
4096
+ agentPageAccess: S,
4097
+ pageToolRegistry: me,
4098
+ pageFormsProvider: he,
4099
+ pageAction: _e,
4100
+ pageControlActive: xe,
4101
+ isWorking: kt,
4102
+ stopHostActions: Xe,
4103
+ pageNoticeLevel: Re,
4104
+ closePageNotice: ze,
4105
+ hostConfirmation: j,
4106
+ respondHostConfirmation: Je,
4107
+ pageAccessAvailable: Ie,
4108
+ pageAccessOff: O,
4109
+ setPageAccessOff: Ze,
4110
+ systemTheme: ke,
4111
+ hideWelcomeMessage: Ae,
4112
+ isDark: je,
4113
+ chat: N,
4114
+ messages: tt,
4115
+ conversations: P,
4116
+ isLoadingConversations: rt,
4117
+ chatFiles: F,
4118
+ isLoadingChatFiles: I,
4119
+ input: B,
4120
+ pendingAttachments: V,
4121
+ isAttachmentLimitReached: Bt,
4122
+ fileLimitError: Vt,
4123
+ localChatId: D,
4124
+ isConversationBlocked: k,
4125
+ inputMessagePlaceholder: nt,
4126
+ chatError: Be,
4127
+ activeView: it,
4128
+ messageFeedbacks: R,
4129
+ feedbackDialogMessage: at,
4130
4130
  isFeedbackSubmitting: ot,
4131
4131
  isFeedbackSubmitted: st,
4132
4132
  feedbackSubmitError: ct,
4133
- isLeadSubmitted: z,
4134
- isLoadingSubmitLead: B,
4135
- submitLeadError: lt,
4136
- buildDeviceContext: Ke,
4137
- initialize: Tt,
4138
- loadConversations: dt,
4139
- loadChatFiles: ft,
4140
- refreshMessages: xt,
4141
- appendMessage: St,
4142
- getChatFileUrl: pt,
4143
- getChatFilePreviewUrl: mt,
4144
- deleteChatFile: ht,
4145
- handleSubmit: Et,
4146
- sendMessage: Dt,
4147
- stopGeneration: G,
4148
- startNewChat: jt,
4149
- regenerate: Mt,
4150
- addToolOutput: Nt,
4151
- addToolApprovalResponse: Pt,
4152
- handleFileSelect: Ht,
4153
- clearFileLimitError: Vt,
4154
- clearPendingAttachments: At,
4155
- onUpvote: Wt,
4156
- onDownvote: Gt,
4157
- onFeedback: Kt,
4158
- onFeedbackSubmit: qt,
4159
- onLeadSubmit: Jt,
4160
- navigate: Zt,
4161
- renameChatTitle: Yt,
4162
- deleteChat: Xt
4133
+ isLeadSubmitted: lt,
4134
+ isLoadingSubmitLead: z,
4135
+ submitLeadError: ut,
4136
+ buildDeviceContext: Ge,
4137
+ initialize: Et,
4138
+ loadConversations: ft,
4139
+ loadChatFiles: pt,
4140
+ refreshMessages: St,
4141
+ appendMessage: Ct,
4142
+ getChatFileUrl: mt,
4143
+ getChatFilePreviewUrl: ht,
4144
+ deleteChatFile: gt,
4145
+ handleSubmit: Dt,
4146
+ sendMessage: Ot,
4147
+ stopGeneration: W,
4148
+ startNewChat: Mt,
4149
+ regenerate: Nt,
4150
+ addToolOutput: Pt,
4151
+ addToolApprovalResponse: Ft,
4152
+ handleFileSelect: Ut,
4153
+ clearFileLimitError: Ht,
4154
+ clearPendingAttachments: jt,
4155
+ onUpvote: Gt,
4156
+ onDownvote: Kt,
4157
+ onFeedback: qt,
4158
+ onFeedbackSubmit: Jt,
4159
+ onLeadSubmit: Yt,
4160
+ navigate: Qt,
4161
+ renameChatTitle: Xt,
4162
+ deleteChat: Zt
4163
4163
  };
4164
4164
  })();
4165
4165
  }
4166
4166
  //#endregion
4167
- export { I as a, fr as i, Jr as n, zr as r, Br as t };
4167
+ export { L as a, pr as i, Jr as n, zr as r, Br as t };
4168
4168
 
4169
- //# sourceMappingURL=useChatbotStore-BQTq8fq-.js.map
4169
+ //# sourceMappingURL=useChatbotStore-DDSgrRzg.js.map