@8wave/ai-elements 0.121.0-beta.3 → 0.121.0-beta.30

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 (154) hide show
  1. package/README.md +125 -54
  2. package/dist/_chunks/{Agent-BYC51e6E.js → Agent-wvUJZjp3.js} +70 -61
  3. package/dist/_chunks/Agent-wvUJZjp3.js.map +1 -0
  4. package/dist/_chunks/{PkStreamingMarkdown-CNoHyTuC.js → PkStreamingMarkdown-DeZn-hPo.js} +846 -841
  5. package/dist/_chunks/PkStreamingMarkdown-DeZn-hPo.js.map +1 -0
  6. package/dist/_chunks/{PkToolEditSpreadsheet-B8bO3vZa.js → PkToolEditSpreadsheet-BJEWc_nV.js} +2 -2
  7. package/dist/_chunks/{PkToolEditSpreadsheet-B8bO3vZa.js.map → PkToolEditSpreadsheet-BJEWc_nV.js.map} +1 -1
  8. package/dist/_chunks/{PkToolRequestGeolocation-DrvL0h9d.js → PkToolRequestGeolocation-CPU3e3iJ.js} +2 -2
  9. package/dist/_chunks/{PkToolRequestGeolocation-DrvL0h9d.js.map → PkToolRequestGeolocation-CPU3e3iJ.js.map} +1 -1
  10. package/dist/_chunks/{PkToolRequestOAuthConnection-BXti5Vkt.js → PkToolRequestOAuthConnection-C8nfpS3d.js} +2 -2
  11. package/dist/_chunks/{PkToolRequestOAuthConnection-BXti5Vkt.js.map → PkToolRequestOAuthConnection-C8nfpS3d.js.map} +1 -1
  12. package/dist/_chunks/{PkToolShowArtifact-DR71LNck.js → PkToolShowArtifact-Bt_qBvdI.js} +2 -2
  13. package/dist/_chunks/{PkToolShowArtifact-DR71LNck.js.map → PkToolShowArtifact-Bt_qBvdI.js.map} +1 -1
  14. package/dist/_chunks/{PkToolShowContactForm-C4BshHSs.js → PkToolShowContactForm-BwKW5txM.js} +2 -2
  15. package/dist/_chunks/{PkToolShowContactForm-C4BshHSs.js.map → PkToolShowContactForm-BwKW5txM.js.map} +1 -1
  16. package/dist/_chunks/{PkToolShowForm-BLSTn0xE.js → PkToolShowForm-DJhe2pV3.js} +3 -3
  17. package/dist/_chunks/{PkToolShowForm-BLSTn0xE.js.map → PkToolShowForm-DJhe2pV3.js.map} +1 -1
  18. package/dist/_chunks/{PkToolShowImageGallery-CqOXbo0Y.js → PkToolShowImageGallery-DPEIoeDc.js} +2 -2
  19. package/dist/_chunks/{PkToolShowImageGallery-CqOXbo0Y.js.map → PkToolShowImageGallery-DPEIoeDc.js.map} +1 -1
  20. package/dist/_chunks/{PkToolShowProductList-westY5bY.js → PkToolShowProductList-C5alYUrB.js} +2 -2
  21. package/dist/_chunks/{PkToolShowProductList-westY5bY.js.map → PkToolShowProductList-C5alYUrB.js.map} +1 -1
  22. package/dist/_chunks/{PkToolShowSources-Dy9VXRgv.js → PkToolShowSources-CkwbyMdU.js} +3 -3
  23. package/dist/_chunks/{PkToolShowSources-Dy9VXRgv.js.map → PkToolShowSources-CkwbyMdU.js.map} +1 -1
  24. package/dist/_chunks/{PkToolShowSuggestedReply-BZ2U3ULB.js → PkToolShowSuggestedReply-C-yCzH_d.js} +2 -2
  25. package/dist/_chunks/{PkToolShowSuggestedReply-BZ2U3ULB.js.map → PkToolShowSuggestedReply-C-yCzH_d.js.map} +1 -1
  26. package/dist/_chunks/{PkToolShowVideo-CrFaQbMp.js → PkToolShowVideo-DL554qVB.js} +2 -2
  27. package/dist/_chunks/{PkToolShowVideo-CrFaQbMp.js.map → PkToolShowVideo-DL554qVB.js.map} +1 -1
  28. package/dist/_chunks/{PkToolShowWebPages-DXszshY9.js → PkToolShowWebPages-D35l7s9P.js} +2 -2
  29. package/dist/_chunks/{PkToolShowWebPages-DXszshY9.js.map → PkToolShowWebPages-D35l7s9P.js.map} +1 -1
  30. package/dist/_chunks/{chatImagePolicy-B5-QV037.js → chatImagePolicy-Caj4GsFN.js} +2 -2
  31. package/dist/_chunks/{chatImagePolicy-B5-QV037.js.map → chatImagePolicy-Caj4GsFN.js.map} +1 -1
  32. package/dist/_chunks/{markdown-DO_FLvlJ.js → markdown-DzN3Q-au.js} +10 -10
  33. package/dist/_chunks/{markdown-DO_FLvlJ.js.map → markdown-DzN3Q-au.js.map} +1 -1
  34. package/dist/ai-elements.es.js +3912 -3048
  35. package/dist/ai-elements.es.js.map +1 -1
  36. package/dist-vue/PkChatbot.js +1 -1
  37. package/dist-vue/PkChatbotEmptyState.js +1 -1
  38. package/dist-vue/PkChatbotInput.js +1 -1
  39. package/dist-vue/PkChatbotMessages.js +1 -1
  40. package/dist-vue/PkChatbotStepPayload.js +1 -1
  41. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  42. package/dist-vue/PkChatbotSteps.js +1 -1
  43. package/dist-vue/PkChatbotViewChat.js +1 -1
  44. package/dist-vue/PkChatbotViewConversations.js +1 -1
  45. package/dist-vue/PkChatbotViewFiles.js +1 -1
  46. package/dist-vue/PkChatbotViewProfile.js +1 -1
  47. package/dist-vue/_chunks/{Agent-2DVqpLwz.js → Agent-ywfLo1Hg.js} +71 -61
  48. package/dist-vue/_chunks/Agent-ywfLo1Hg.js.map +1 -0
  49. package/dist-vue/_chunks/{Document-ChfbOVVs.js → Document-DqkgJZNx.js} +10 -10
  50. package/dist-vue/_chunks/{Document-ChfbOVVs.js.map → Document-DqkgJZNx.js.map} +1 -1
  51. package/dist-vue/_chunks/{PkChatbot-DsZ8mAbt.js → PkChatbot-CLy8LgF8.js} +9 -9
  52. package/dist-vue/_chunks/PkChatbot-CLy8LgF8.js.map +1 -0
  53. package/dist-vue/_chunks/{PkChatbotEmptyState-DqzgF4vH.js → PkChatbotEmptyState-DLg5tLl5.js} +2 -2
  54. package/dist-vue/_chunks/{PkChatbotEmptyState-DqzgF4vH.js.map → PkChatbotEmptyState-DLg5tLl5.js.map} +1 -1
  55. package/dist-vue/_chunks/{PkChatbotInput-BRhIG8HR.js → PkChatbotInput-CjE0vZAK.js} +87 -80
  56. package/dist-vue/_chunks/PkChatbotInput-CjE0vZAK.js.map +1 -0
  57. package/dist-vue/_chunks/{PkChatbotMessages-WryjcyH7.js → PkChatbotMessages-Dzc0kzyo.js} +18 -18
  58. package/dist-vue/_chunks/PkChatbotMessages-Dzc0kzyo.js.map +1 -0
  59. package/dist-vue/_chunks/{PkChatbotStepPayload-Bga_HEps.js → PkChatbotStepPayload-DjGNmloY.js} +2 -2
  60. package/dist-vue/_chunks/{PkChatbotStepPayload-Bga_HEps.js.map → PkChatbotStepPayload-DjGNmloY.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkChatbotStepToolDetail-YbUYP-Y3.js → PkChatbotStepToolDetail-CUIWz1nJ.js} +3 -3
  62. package/dist-vue/_chunks/{PkChatbotStepToolDetail-YbUYP-Y3.js.map → PkChatbotStepToolDetail-CUIWz1nJ.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkChatbotSteps-CVAkaIzk.js → PkChatbotSteps-B4r68w6z.js} +5 -5
  64. package/dist-vue/_chunks/{PkChatbotSteps-CVAkaIzk.js.map → PkChatbotSteps-B4r68w6z.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkChatbotViewChat-B1gbdvs1.js → PkChatbotViewChat-B1iNTeQm.js} +7 -7
  66. package/dist-vue/_chunks/{PkChatbotViewChat-B1gbdvs1.js.map → PkChatbotViewChat-B1iNTeQm.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkChatbotViewConversations-BHvHF0w7.js → PkChatbotViewConversations-D608ghH3.js} +3 -3
  68. package/dist-vue/_chunks/{PkChatbotViewConversations-BHvHF0w7.js.map → PkChatbotViewConversations-D608ghH3.js.map} +1 -1
  69. package/dist-vue/_chunks/{PkChatbotViewFiles-C-4__qj_.js → PkChatbotViewFiles-CTg7R5HF.js} +3 -3
  70. package/dist-vue/_chunks/{PkChatbotViewFiles-C-4__qj_.js.map → PkChatbotViewFiles-CTg7R5HF.js.map} +1 -1
  71. package/dist-vue/_chunks/{PkChatbotViewProfile-_WMSVDlA.js → PkChatbotViewProfile-HBgg-zuj.js} +2 -2
  72. package/dist-vue/_chunks/{PkChatbotViewProfile-_WMSVDlA.js.map → PkChatbotViewProfile-HBgg-zuj.js.map} +1 -1
  73. package/dist-vue/_chunks/{PkStreamingMarkdown-6Y7qgbvS.js → PkStreamingMarkdown-O7p8Vyju.js} +3 -3
  74. package/dist-vue/_chunks/{PkStreamingMarkdown-6Y7qgbvS.js.map → PkStreamingMarkdown-O7p8Vyju.js.map} +1 -1
  75. package/dist-vue/_chunks/{PkToolEditSpreadsheet-BTauPyXT.js → PkToolEditSpreadsheet-B_Ge2pGx.js} +2 -2
  76. package/dist-vue/_chunks/{PkToolEditSpreadsheet-BTauPyXT.js.map → PkToolEditSpreadsheet-B_Ge2pGx.js.map} +1 -1
  77. package/dist-vue/_chunks/{PkToolRequestGeolocation-DBzup6bn.js → PkToolRequestGeolocation-D0FIRJk2.js} +2 -2
  78. package/dist-vue/_chunks/{PkToolRequestGeolocation-DBzup6bn.js.map → PkToolRequestGeolocation-D0FIRJk2.js.map} +1 -1
  79. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-yrRDpNqp.js → PkToolRequestOAuthConnection-DFlZkvLP.js} +2 -2
  80. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-yrRDpNqp.js.map → PkToolRequestOAuthConnection-DFlZkvLP.js.map} +1 -1
  81. package/dist-vue/_chunks/{PkToolShowArtifact-fp37O1om.js → PkToolShowArtifact-BTY19659.js} +2 -2
  82. package/dist-vue/_chunks/{PkToolShowArtifact-fp37O1om.js.map → PkToolShowArtifact-BTY19659.js.map} +1 -1
  83. package/dist-vue/_chunks/{PkToolShowContactForm-iSx2ioyT.js → PkToolShowContactForm-D82n3tZ4.js} +2 -2
  84. package/dist-vue/_chunks/{PkToolShowContactForm-iSx2ioyT.js.map → PkToolShowContactForm-D82n3tZ4.js.map} +1 -1
  85. package/dist-vue/_chunks/{PkToolShowDiagram-BlKrh4gK.js → PkToolShowDiagram-BlIarn5u.js} +2 -2
  86. package/dist-vue/_chunks/{PkToolShowDiagram-BlKrh4gK.js.map → PkToolShowDiagram-BlIarn5u.js.map} +1 -1
  87. package/dist-vue/_chunks/{PkToolShowForm-CwlXH13N.js → PkToolShowForm-b5m2ahty.js} +4 -4
  88. package/dist-vue/_chunks/{PkToolShowForm-CwlXH13N.js.map → PkToolShowForm-b5m2ahty.js.map} +1 -1
  89. package/dist-vue/_chunks/{PkToolShowImageGallery-C4esYiM_.js → PkToolShowImageGallery-CtIphioH.js} +2 -2
  90. package/dist-vue/_chunks/{PkToolShowImageGallery-C4esYiM_.js.map → PkToolShowImageGallery-CtIphioH.js.map} +1 -1
  91. package/dist-vue/_chunks/{PkToolShowProductList-CdeYQ-mF.js → PkToolShowProductList-Vq4zUoN5.js} +2 -2
  92. package/dist-vue/_chunks/{PkToolShowProductList-CdeYQ-mF.js.map → PkToolShowProductList-Vq4zUoN5.js.map} +1 -1
  93. package/dist-vue/_chunks/{PkToolShowSources-D8IF7g0d.js → PkToolShowSources-B-r0dOgi.js} +3 -3
  94. package/dist-vue/_chunks/{PkToolShowSources-D8IF7g0d.js.map → PkToolShowSources-B-r0dOgi.js.map} +1 -1
  95. package/dist-vue/_chunks/{PkToolShowSuggestedReply-DXyO8ki2.js → PkToolShowSuggestedReply-Dl2VLfJk.js} +2 -2
  96. package/dist-vue/_chunks/{PkToolShowSuggestedReply-DXyO8ki2.js.map → PkToolShowSuggestedReply-Dl2VLfJk.js.map} +1 -1
  97. package/dist-vue/_chunks/{PkToolShowVideo-CA7MNSp_.js → PkToolShowVideo-CssORBGr.js} +2 -2
  98. package/dist-vue/_chunks/{PkToolShowVideo-CA7MNSp_.js.map → PkToolShowVideo-CssORBGr.js.map} +1 -1
  99. package/dist-vue/_chunks/{PkToolShowWebPages-CKWnAbp8.js → PkToolShowWebPages-Bhpc1HA2.js} +2 -2
  100. package/dist-vue/_chunks/{PkToolShowWebPages-CKWnAbp8.js.map → PkToolShowWebPages-Bhpc1HA2.js.map} +1 -1
  101. package/dist-vue/_chunks/{createChatbotApiClient-DecVahlB.js → createChatbotApiClient-DN6SHs1X.js} +29 -21
  102. package/dist-vue/_chunks/createChatbotApiClient-DN6SHs1X.js.map +1 -0
  103. package/dist-vue/_chunks/{useChatbotStore-BQTq8fq-.js → useChatbotStore-BlIWevWi.js} +1037 -920
  104. package/dist-vue/_chunks/useChatbotStore-BlIWevWi.js.map +1 -0
  105. package/dist-vue/_chunks/{utils-BLMOBcka.js → utils-FkhB6Tl2.js} +36 -41
  106. package/dist-vue/_chunks/utils-FkhB6Tl2.js.map +1 -0
  107. package/dist-vue/api.js +1 -1
  108. package/dist-vue/apps/web-component/src/components/EmbeddedChatWidget.ce.d.ts +12 -4
  109. package/dist-vue/apps/web-component/src/components/FloatingChatWidget.ce.d.ts +4 -3
  110. package/dist-vue/apps/web-component/src/composables/useChatbotAgent.d.ts +11 -5
  111. package/dist-vue/apps/web-component/src/composables/useChatbotProfileProvider.d.ts +3 -2
  112. package/dist-vue/apps/web-component/src/composables/useCopilotPageCss.d.ts +12 -4
  113. package/dist-vue/apps/web-component/src/composables/usePageModal.d.ts +19 -0
  114. package/dist-vue/apps/web-component/src/lib.d.ts +10 -3
  115. package/dist-vue/apps/web-component/src/pageTools/actions.d.ts +33 -0
  116. package/dist-vue/apps/web-component/src/pageTools/navigation.d.ts +27 -0
  117. package/dist-vue/apps/web-component/src/pageTools/snapshot.d.ts +18 -2
  118. package/dist-vue/apps/web-component/src/utils/emitWidgetEvent.d.ts +8 -0
  119. package/dist-vue/apps/web-component/src/utils/layout.d.ts +3 -3
  120. package/dist-vue/composables.js +213 -25
  121. package/dist-vue/composables.js.map +1 -1
  122. package/dist-vue/index.js +4051 -4015
  123. package/dist-vue/index.js.map +1 -1
  124. package/dist-vue/locales.js +54 -20
  125. package/dist-vue/packages/auth/src/active-membership.d.ts +2 -0
  126. package/dist-vue/packages/components/src/PkSkeleton.d.ts +1 -1
  127. package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +8 -5
  128. package/dist-vue/packages/components/src/chat/PkHostCallConfirmDialog.d.ts +19 -0
  129. package/dist-vue/packages/components/src/chat/PkWebSearchSettings.d.ts +2 -0
  130. package/dist-vue/packages/components/src/chat/utils.d.ts +5 -0
  131. package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +7 -0
  132. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +123 -13
  133. package/dist-vue/packages/models/src/schema/Agent.d.ts +53 -25
  134. package/dist-vue/packages/models/src/schema/Chat.d.ts +2 -0
  135. package/dist-vue/packages/models/src/schema/Member.d.ts +13 -2
  136. package/dist-vue/packages/models/src/schema/Organization.d.ts +105 -0
  137. package/dist-vue/packages/models/src/schema/OrganizationDeletion.d.ts +197 -0
  138. package/dist-vue/packages/models/src/schema/OrganizationExternalAuth.d.ts +8 -2
  139. package/dist-vue/packages/models/src/schema/OrganizationIdentityProvider.d.ts +4 -1
  140. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +6 -3
  141. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +5 -3
  142. package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
  143. package/dist-vue/style.css +1 -1
  144. package/package.json +1 -1
  145. package/dist/_chunks/Agent-BYC51e6E.js.map +0 -1
  146. package/dist/_chunks/PkStreamingMarkdown-CNoHyTuC.js.map +0 -1
  147. package/dist-vue/_chunks/Agent-2DVqpLwz.js.map +0 -1
  148. package/dist-vue/_chunks/PkChatbot-DsZ8mAbt.js.map +0 -1
  149. package/dist-vue/_chunks/PkChatbotInput-BRhIG8HR.js.map +0 -1
  150. package/dist-vue/_chunks/PkChatbotMessages-WryjcyH7.js.map +0 -1
  151. package/dist-vue/_chunks/createChatbotApiClient-DecVahlB.js.map +0 -1
  152. package/dist-vue/_chunks/useChatbotStore-BQTq8fq-.js.map +0 -1
  153. package/dist-vue/_chunks/utils-BLMOBcka.js.map +0 -1
  154. package/dist-vue/apps/web-component/src/composables/useCopilotPush.d.ts +0 -25
@@ -1,10 +1,10 @@
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";
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-ywfLo1Hg.js";
3
+ import { r as oe, t as se } from "./createChatbotApiClient-DN6SHs1X.js";
4
+ import { n as ce } from "./src-BZRiAJsH.js";
5
+ import { d as le, r as ue } from "./message-DZvfzt9j.js";
6
+ import { n as de, t as fe } from "./useSafeLocalStorage-C1BlCeKw.js";
7
+ import { computed as x, getCurrentScope as pe, isReadonly as me, nextTick as he, onScopeDispose as ge, reactive as _e, ref as S, shallowRef as C, toRefs as ve, toValue as ye, watch as w, watchEffect as be } from "vue";
8
8
  import { useI18n as xe } from "vue-i18n";
9
9
  import { usePreferredDark as Se } from "@vueuse/core";
10
10
  import { defineStore as Ce } from "pinia";
@@ -58,9 +58,9 @@ 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 Ee = "agentstudio:page-navigation", De = (e) => typeof e?.afterOutput == "function", Oe = (e) => e.toolMetadata?.source === te, ke = (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
66
  function Ae(e) {
@@ -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
  }
@@ -116,7 +116,7 @@ function Ae(e) {
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,7 +137,7 @@ 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 je = "vercel.ai.error", Me = Symbol.for(je), T = class e extends Error {
141
141
  constructor({ name: e, message: t, cause: n }) {
142
142
  super(t), this[Me] = !0, this.name = e, this.cause = n;
143
143
  }
@@ -148,7 +148,7 @@ var je = "vercel.ai.error", Me = Symbol.for(je), C = class e extends Error {
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
+ }, Ne = "AI_APICallError", E = `vercel.ai.error.${Ne}`, Pe = Symbol.for(E), Fe = 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
154
  name: Ne,
@@ -157,23 +157,23 @@ var je = "vercel.ai.error", Me = Symbol.for(je), C = class e extends Error {
157
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;
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}`, Ie = Symbol.for(O), Le = 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
167
  }), this[Ie] = !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
173
  function Re(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 ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.for(Be), He = class extends T {
177
177
  constructor({ message: e, cause: t, argument: n }) {
178
178
  super({
179
179
  name: ze,
@@ -182,20 +182,20 @@ var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.fo
182
182
  }), this[Ve] = !0, this.argument = n;
183
183
  }
184
184
  static isInstance(e) {
185
- return C.hasMarker(e, Be);
185
+ return T.hasMarker(e, Be);
186
186
  }
187
- }, O = "AI_JSONParseError", He = `vercel.ai.error.${O}`, Ue = Symbol.for(He), We = class extends C {
187
+ }, Ue = "AI_JSONParseError", We = `vercel.ai.error.${Ue}`, Ge = Symbol.for(We), Ke = class extends T {
188
188
  constructor({ text: e, cause: t }) {
189
189
  super({
190
- name: O,
190
+ name: Ue,
191
191
  message: `JSON parsing failed: Text: ${e}.\nError message: ${Re(t)}`,
192
192
  cause: t
193
- }), this[Ue] = !0, this.text = e;
193
+ }), this[Ge] = !0, this.text = e;
194
194
  }
195
195
  static isInstance(e) {
196
- return C.hasMarker(e, He);
196
+ return T.hasMarker(e, We);
197
197
  }
198
- }, k = "AI_TypeValidationError", Ge = `vercel.ai.error.${k}`, Ke = Symbol.for(Ge), qe = class e extends C {
198
+ }, k = "AI_TypeValidationError", qe = `vercel.ai.error.${k}`, Je = Symbol.for(qe), Ye = 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) {
@@ -207,10 +207,10 @@ var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.fo
207
207
  name: k,
208
208
  message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${Re(t)}`,
209
209
  cause: t
210
- }), this[Ke] = !0, this.value = e, this.context = n;
210
+ }), this[Je] = !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, qe);
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
+ }, A = "AI_UnsupportedFunctionalityError", Xe = `vercel.ai.error.${A}`, Ze = Symbol.for(Xe), Qe = class extends T {
223
223
  constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
224
224
  super({
225
225
  name: A,
226
226
  message: t
227
- }), this[Ye] = !0, this.functionality = e;
227
+ }), this[Ze] = !0, this.functionality = e;
228
228
  }
229
229
  static isInstance(e) {
230
- return C.hasMarker(e, Je);
230
+ return T.hasMarker(e, Xe);
231
231
  }
232
- }, Ze = class extends Error {
232
+ }, $e = 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
+ }, j = 10, et = 13, M = 32;
237
+ function N(e) {}
238
+ function tt(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 = N, onError: n = N, onRetry: r = N, 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 $e(`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,7 +272,7 @@ function et(e) {
272
272
  continue;
273
273
  }
274
274
  let i = e.charCodeAt(n);
275
- if (tt(e, n, i)) {
275
+ if (P(e, n, i)) {
276
276
  let i = e.charCodeAt(n + 5) === M ? n + 6 : n + 5, a = e.slice(i, r);
277
277
  if (d === 0 && e.charCodeAt(r + 1) === j) {
278
278
  t({
@@ -292,17 +292,17 @@ ${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) === et && e.charCodeAt(n) === j && 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)) {
305
+ if (P(e, t, r)) {
306
306
  let r = e.charCodeAt(t + 5) === M ? t + 6 : t + 5, i = e.slice(r, n);
307
307
  u = d === 0 ? i : `${u}
308
308
  ${i}`, d++;
@@ -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 $e(`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 $e(`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,10 +375,10 @@ ${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 P(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
384
  function nt(e, t, n) {
@@ -391,7 +391,7 @@ var rt = class extends TransformStream {
391
391
  let i;
392
392
  super({
393
393
  start(a) {
394
- i = et({
394
+ i = tt({
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: it, atob: at } = 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,28 +423,28 @@ 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 He({
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 R(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*:/;
443
- function ot(e) {
442
+ var ot = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, z = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
443
+ function st(e) {
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 || ot.test(e) === !1 && z.test(e) === !1 ? t : ct(t);
446
446
  }
447
- function st(e) {
447
+ function ct(e) {
448
448
  let t = [e];
449
449
  for (; t.length;) {
450
450
  let e = t;
@@ -459,35 +459,35 @@ function st(e) {
459
459
  }
460
460
  return e;
461
461
  }
462
- function ct(e) {
462
+ function B(e) {
463
463
  let { stackTraceLimit: t } = Error;
464
464
  try {
465
465
  Error.stackTraceLimit = 0;
466
466
  } catch {
467
- return ot(e);
467
+ return st(e);
468
468
  }
469
469
  try {
470
- return ot(e);
470
+ return st(e);
471
471
  } finally {
472
472
  Error.stackTraceLimit = t;
473
473
  }
474
474
  }
475
- function z(e) {
475
+ function V(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" && H(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] = H(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(H) : H(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(H)), e.allOf != null && (e.allOf = e.allOf.map(H)), e.oneOf != null && (e.oneOf = e.oneOf.map(H));
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] = H(t[e]);
485
485
  return e;
486
486
  }
487
- function B(e) {
488
- return typeof e == "boolean" ? e : z(e);
487
+ function H(e) {
488
+ return typeof e == "boolean" ? e : V(e);
489
489
  }
490
- var lt = Symbol("Let zodToJsonSchema decide on which parser to use"), V = {
490
+ var lt = Symbol("Let zodToJsonSchema decide on which parser to use"), ut = {
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
+ }, dt = (e) => typeof e == "string" ? {
511
+ ...ut,
512
512
  name: e
513
513
  } : {
514
- ...V,
514
+ ...ut,
515
515
  ...e
516
516
  };
517
517
  function U() {
518
518
  return {};
519
519
  }
520
- function ut(e, t) {
520
+ function ft(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 = Y(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 pt(e) {
528
528
  let t = {
529
529
  type: "integer",
530
530
  format: "int64"
@@ -541,13 +541,13 @@ function dt(e) {
541
541
  }
542
542
  return t;
543
543
  }
544
- function ft() {
544
+ function W() {
545
545
  return { type: "boolean" };
546
546
  }
547
- function pt(e, t) {
548
- return q(e.type._def, t);
547
+ function G(e, t) {
548
+ return Y(e.type._def, t);
549
549
  }
550
- var mt = (e, t) => q(e.innerType._def, t);
550
+ var mt = (e, t) => Y(e.innerType._def, t);
551
551
  function ht(e, t, n) {
552
552
  let r = n ?? t.dateStrategy;
553
553
  if (Array.isArray(r)) return { anyOf: r.map((n) => ht(e, t, n)) };
@@ -579,12 +579,12 @@ var gt = (e) => {
579
579
  };
580
580
  function _t(e, t) {
581
581
  return {
582
- ...q(e.innerType._def, t),
582
+ ...Y(e.innerType._def, t),
583
583
  default: e.defaultValue()
584
584
  };
585
585
  }
586
586
  function vt(e, t) {
587
- return t.effectStrategy === "input" ? q(e.schema._def, t) : U();
587
+ return t.effectStrategy === "input" ? Y(e.schema._def, t) : U();
588
588
  }
589
589
  function yt(e) {
590
590
  return {
@@ -594,14 +594,14 @@ function yt(e) {
594
594
  }
595
595
  var bt = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
596
596
  function xt(e, t) {
597
- let n = [q(e.left._def, {
597
+ let n = [Y(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
+ }), Y(e.right._def, {
605
605
  ...t,
606
606
  currentPath: [
607
607
  ...t.currentPath,
@@ -628,7 +628,7 @@ function St(e) {
628
628
  const: e.value
629
629
  };
630
630
  }
631
- var Ct = void 0, W = {
631
+ var Ct = void 0, K = {
632
632
  cuid: /^[cC][^\s-]{8,}$/,
633
633
  cuid2: /^[0-9a-z]+$/,
634
634
  ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
@@ -656,83 +656,83 @@ 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
+ q(n, "email", r.message, t);
660
660
  break;
661
661
  case "format:idn-email":
662
- G(n, "idn-email", r.message, t);
662
+ q(n, "idn-email", r.message, t);
663
663
  break;
664
- case "pattern:zod": K(n, W.email, r.message, t);
664
+ case "pattern:zod": J(n, K.email, r.message, t);
665
665
  }
666
666
  break;
667
667
  case "url":
668
- G(n, "uri", r.message, t);
668
+ q(n, "uri", r.message, t);
669
669
  break;
670
670
  case "uuid":
671
- G(n, "uuid", r.message, t);
671
+ q(n, "uuid", r.message, t);
672
672
  break;
673
673
  case "regex":
674
- K(n, r.regex, r.message, t);
674
+ J(n, r.regex, r.message, t);
675
675
  break;
676
676
  case "cuid":
677
- K(n, W.cuid, r.message, t);
677
+ J(n, K.cuid, r.message, t);
678
678
  break;
679
679
  case "cuid2":
680
- K(n, W.cuid2, r.message, t);
680
+ J(n, K.cuid2, r.message, t);
681
681
  break;
682
682
  case "startsWith":
683
- K(n, RegExp(`^${Tt(r.value, t)}`), r.message, t);
683
+ J(n, RegExp(`^${Tt(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
+ J(n, RegExp(`${Tt(r.value, t)}$`), r.message, t);
687
687
  break;
688
688
  case "datetime":
689
- G(n, "date-time", r.message, t);
689
+ q(n, "date-time", r.message, t);
690
690
  break;
691
691
  case "date":
692
- G(n, "date", r.message, t);
692
+ q(n, "date", r.message, t);
693
693
  break;
694
694
  case "time":
695
- G(n, "time", r.message, t);
695
+ q(n, "time", r.message, t);
696
696
  break;
697
697
  case "duration":
698
- G(n, "duration", r.message, t);
698
+ q(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
+ J(n, RegExp(Tt(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" && q(n, "ipv4", r.message, t), r.version !== "v4" && q(n, "ipv6", r.message, t);
708
708
  break;
709
709
  case "base64url":
710
- K(n, W.base64url, r.message, t);
710
+ J(n, K.base64url, r.message, t);
711
711
  break;
712
712
  case "jwt":
713
- K(n, W.jwt, r.message, t);
713
+ J(n, K.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" && J(n, K.ipv4Cidr, r.message, t), r.version !== "v4" && J(n, K.ipv6Cidr, r.message, t);
717
717
  break;
718
718
  case "emoji":
719
- K(n, W.emoji(), r.message, t);
719
+ J(n, K.emoji(), r.message, t);
720
720
  break;
721
721
  case "ulid":
722
- K(n, W.ulid, r.message, t);
722
+ J(n, K.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
+ q(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": J(n, K.base64, r.message, t);
733
733
  }
734
734
  break;
735
- case "nanoid": K(n, W.nanoid, r.message, t);
735
+ case "nanoid": J(n, K.nanoid, r.message, t);
736
736
  }
737
737
  return n;
738
738
  }
@@ -745,13 +745,13 @@ function Dt(e) {
745
745
  for (let n = 0; n < e.length; n++) Et.has(e[n]) || (t += "\\"), t += e[n];
746
746
  return t;
747
747
  }
748
- function G(e, t, n, r) {
748
+ function q(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 J(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
756
  pattern: Ot(t, r),
757
757
  ...n && r.errorMessages && { errorMessage: { pattern: n } }
@@ -799,7 +799,7 @@ function Ot(e, t) {
799
799
  function kt(e, t) {
800
800
  let n = {
801
801
  type: "object",
802
- additionalProperties: q(e.valueType._def, {
802
+ additionalProperties: Y(e.valueType._def, {
803
803
  ...t,
804
804
  currentPath: [...t.currentPath, "additionalProperties"]
805
805
  }) ?? t.allowedAdditionalProperties
@@ -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 } = G(e.keyType._def, t);
820
820
  return {
821
821
  ...n,
822
822
  propertyNames: i
@@ -830,7 +830,7 @@ function At(e, t) {
830
830
  maxItems: 125,
831
831
  items: {
832
832
  type: "array",
833
- items: [q(e.keyType._def, {
833
+ items: [Y(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
+ }) || U(), Y(e.valueType._def, {
842
842
  ...t,
843
843
  currentPath: [
844
844
  ...t.currentPath,
@@ -907,7 +907,7 @@ function Ft(e, t) {
907
907
  return It(e, t);
908
908
  }
909
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, {
910
+ let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => Y(e._def, {
911
911
  ...t,
912
912
  currentPath: [
913
913
  ...t.currentPath,
@@ -925,7 +925,7 @@ function Lt(e, t) {
925
925
  "ZodBoolean",
926
926
  "ZodNull"
927
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, {
928
+ let n = Y(e.innerType._def, {
929
929
  ...t,
930
930
  currentPath: [
931
931
  ...t.currentPath,
@@ -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 = Vt(a), s = Y(a._def, {
964
964
  ...t,
965
965
  currentPath: [
966
966
  ...t.currentPath,
@@ -980,7 +980,7 @@ function zt(e, t) {
980
980
  return a !== void 0 && (n.additionalProperties = a), n;
981
981
  }
982
982
  function Bt(e, t) {
983
- if (e.catchall._def.typeName !== "ZodNever") return q(e.catchall._def, {
983
+ if (e.catchall._def.typeName !== "ZodNever") return Y(e.catchall._def, {
984
984
  ...t,
985
985
  currentPath: [...t.currentPath, "additionalProperties"]
986
986
  });
@@ -998,8 +998,8 @@ function Vt(e) {
998
998
  }
999
999
  }
1000
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, {
1001
+ if (t.currentPath.toString() === t.propertyPath?.toString()) return Y(e.innerType._def, t);
1002
+ let n = Y(e.innerType._def, {
1003
1003
  ...t,
1004
1004
  currentPath: [
1005
1005
  ...t.currentPath,
@@ -1009,9 +1009,9 @@ var Ht = (e, t) => {
1009
1009
  });
1010
1010
  return n ? { anyOf: [{ not: U() }, n] } : U();
1011
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, {
1012
+ if (t.pipeStrategy === "input") return Y(e.in._def, t);
1013
+ if (t.pipeStrategy === "output") return Y(e.out._def, t);
1014
+ let n = Y(e.in._def, {
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, Y(e.out._def, {
1023
1023
  ...t,
1024
1024
  currentPath: [
1025
1025
  ...t.currentPath,
@@ -1029,13 +1029,13 @@ var Ht = (e, t) => {
1029
1029
  })].filter((e) => e !== void 0) };
1030
1030
  };
1031
1031
  function Wt(e, t) {
1032
- return q(e.type._def, t);
1032
+ return Y(e.type._def, t);
1033
1033
  }
1034
1034
  function Gt(e, t) {
1035
1035
  let n = {
1036
1036
  type: "array",
1037
1037
  uniqueItems: !0,
1038
- items: q(e.valueType._def, {
1038
+ items: Y(e.valueType._def, {
1039
1039
  ...t,
1040
1040
  currentPath: [...t.currentPath, "items"]
1041
1041
  })
@@ -1046,7 +1046,7 @@ function Kt(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) => Y(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: Y(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) => Y(e._def, {
1066
1066
  ...t,
1067
1067
  currentPath: [
1068
1068
  ...t.currentPath,
@@ -1078,17 +1078,17 @@ function qt() {
1078
1078
  function Jt() {
1079
1079
  return U();
1080
1080
  }
1081
- var Yt = (e, t) => q(e.innerType._def, t), Xt = (e, t, n) => {
1081
+ var Yt = (e, t) => Y(e.innerType._def, t), Xt = (e, t, n) => {
1082
1082
  switch (t) {
1083
1083
  case "ZodString": return wt(e, n);
1084
1084
  case "ZodNumber": return Rt(e);
1085
1085
  case "ZodObject": return zt(e, n);
1086
- case "ZodBigInt": return dt(e);
1087
- case "ZodBoolean": return ft();
1086
+ case "ZodBigInt": return pt(e);
1087
+ case "ZodBoolean": return W();
1088
1088
  case "ZodDate": return ht(e, n);
1089
1089
  case "ZodUndefined": return qt();
1090
1090
  case "ZodNull": return Nt();
1091
- case "ZodArray": return ut(e, n);
1091
+ case "ZodArray": return ft(e, n);
1092
1092
  case "ZodUnion":
1093
1093
  case "ZodDiscriminatedUnion": return Ft(e, n);
1094
1094
  case "ZodIntersection": return xt(e, n);
@@ -1109,7 +1109,7 @@ var Yt = (e, t) => q(e.innerType._def, t), Xt = (e, t, n) => {
1109
1109
  case "ZodAny": return U();
1110
1110
  case "ZodUnknown": return Jt();
1111
1111
  case "ZodDefault": return _t(e, n);
1112
- case "ZodBranded": return pt(e, n);
1112
+ case "ZodBranded": return G(e, n);
1113
1113
  case "ZodReadonly": return Yt(e, n);
1114
1114
  case "ZodCatch": return mt(e, n);
1115
1115
  case "ZodPipeline": return Ut(e, n);
@@ -1125,7 +1125,7 @@ var Yt = (e, t) => q(e.innerType._def, t), Xt = (e, t, n) => {
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 Y(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);
@@ -1141,7 +1141,7 @@ 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;
1144
+ let a = Xt(e, e.typeName, t), o = typeof a == "function" ? Y(a(), t) : a;
1145
1145
  if (o && $t(e, t, o), t.postProcess) {
1146
1146
  let n = t.postProcess(o, e, t);
1147
1147
  return i.jsonSchema = o, n;
@@ -1156,7 +1156,7 @@ var Qt = (e, t) => {
1156
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;
1157
1157
  }
1158
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 : [
1159
+ let t = dt(e), n = t.name === void 0 ? t.basePath : [
1160
1160
  ...t.basePath,
1161
1161
  t.definitionPath,
1162
1162
  t.name
@@ -1178,7 +1178,7 @@ var Qt = (e, t) => {
1178
1178
  }, tn = (e, t) => {
1179
1179
  let n = en(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]: Y(r._def, {
1182
1182
  ...n,
1183
1183
  currentPath: [
1184
1184
  ...n.basePath,
@@ -1186,7 +1186,7 @@ var Qt = (e, t) => {
1186
1186
  t
1187
1187
  ]
1188
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 : {
1189
+ }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = Y(e._def, i === void 0 ? n : {
1190
1190
  ...n,
1191
1191
  currentPath: [
1192
1192
  ...n.basePath,
@@ -1238,7 +1238,7 @@ function sn(e) {
1238
1238
  function cn(e) {
1239
1239
  return an(() => {
1240
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" }));
1241
+ return V(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,7 +1246,7 @@ function cn(e) {
1246
1246
  value: n.value
1247
1247
  } : {
1248
1248
  success: !1,
1249
- error: new qe({
1249
+ error: new Ye({
1250
1250
  value: t,
1251
1251
  cause: n.issues
1252
1252
  })
@@ -1271,7 +1271,7 @@ function un(e, t) {
1271
1271
  }
1272
1272
  function dn(e, r) {
1273
1273
  let i = r?.useReferences ?? !1;
1274
- return an(() => z(n(e, {
1274
+ return an(() => V(n(e, {
1275
1275
  target: "draft-7",
1276
1276
  io: "input",
1277
1277
  reused: i ? "ref" : "inline"
@@ -1298,7 +1298,7 @@ async function mn({ value: e, schema: t, context: n }) {
1298
1298
  schema: t,
1299
1299
  context: n
1300
1300
  });
1301
- if (!r.success) throw qe.wrap({
1301
+ if (!r.success) throw Ye.wrap({
1302
1302
  value: e,
1303
1303
  cause: r.error,
1304
1304
  context: n
@@ -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: Ye.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: Ye.wrap({
1334
1334
  value: e,
1335
1335
  cause: t,
1336
1336
  context: n
@@ -1341,7 +1341,7 @@ async function hn({ value: e, schema: t, context: n }) {
1341
1341
  }
1342
1342
  async function gn({ text: e, schema: t }) {
1343
1343
  try {
1344
- let n = ct(e);
1344
+ let n = B(e);
1345
1345
  return t == null ? {
1346
1346
  success: !0,
1347
1347
  value: n,
@@ -1353,7 +1353,7 @@ async function gn({ text: e, schema: t }) {
1353
1353
  } catch (t) {
1354
1354
  return {
1355
1355
  success: !1,
1356
- error: We.isInstance(t) ? t : new We({
1356
+ error: Ke.isInstance(t) ? t : new Ke({
1357
1357
  text: e,
1358
1358
  cause: t
1359
1359
  }),
@@ -1375,7 +1375,7 @@ async function vn(e) {
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 yn = "AI_InvalidArgumentError", bn = `vercel.ai.error.${yn}`, xn = Symbol.for(bn), Sn = class extends T {
1379
1379
  constructor({ parameter: e, value: t, message: n }) {
1380
1380
  super({
1381
1381
  name: yn,
@@ -1383,9 +1383,9 @@ var yn = "AI_InvalidArgumentError", bn = `vercel.ai.error.${yn}`, xn = Symbol.fo
1383
1383
  }), this[xn] = !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, bn);
1387
1387
  }
1388
- }, Cn = "AI_UIMessageStreamError", wn = `vercel.ai.error.${Cn}`, Tn = Symbol.for(wn), J = class extends C {
1388
+ }, Cn = "AI_UIMessageStreamError", wn = `vercel.ai.error.${Cn}`, Tn = Symbol.for(wn), En = class extends T {
1389
1389
  constructor({ chunkType: e, chunkId: t, message: n }) {
1390
1390
  super({
1391
1391
  name: Cn,
@@ -1393,10 +1393,10 @@ var yn = "AI_InvalidArgumentError", bn = `vercel.ai.error.${yn}`, xn = Symbol.fo
1393
1393
  }), this[Tn] = !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, wn);
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 X = {
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(),
1430
+ }, On = X.lazy(() => X.union([
1431
+ X.null(),
1432
+ X.string(),
1433
+ X.number(),
1434
+ X.boolean(),
1435
+ X.record(X.string(), On.optional()),
1436
+ X.array(On)
1437
+ ])), Z = X.record(X.string(), X.record(X.string(), On.optional())), kn = X.union([
1438
+ X.string(),
1439
+ X.instanceof(Uint8Array),
1440
+ X.instanceof(ArrayBuffer),
1441
+ X.custom(R, { message: "Must be a Buffer" })
1442
+ ]), An = X.record(X.string(), X.string()), jn = X.object({
1443
+ type: X.literal("text"),
1444
+ text: X.string(),
1445
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
1446
+ }), Mn = X.object({
1447
+ type: X.literal("image"),
1448
+ image: X.union([
1449
+ kn,
1450
+ X.instanceof(URL),
1451
+ An
1452
1452
  ]),
1453
- mediaType: Y.string().optional(),
1453
+ mediaType: X.string().optional(),
1454
1454
  providerOptions: Z.optional()
1455
- }), jn = Y.discriminatedUnion("type", [
1456
- Y.object({
1457
- type: Y.literal("data"),
1458
- data: Dn
1455
+ }), Nn = X.discriminatedUnion("type", [
1456
+ X.object({
1457
+ type: X.literal("data"),
1458
+ data: kn
1459
1459
  }),
1460
- Y.object({
1461
- type: Y.literal("url"),
1462
- url: Y.instanceof(URL)
1460
+ X.object({
1461
+ type: X.literal("url"),
1462
+ url: X.instanceof(URL)
1463
1463
  }),
1464
- Y.object({
1465
- type: Y.literal("reference"),
1466
- reference: On
1464
+ X.object({
1465
+ type: X.literal("reference"),
1466
+ reference: An
1467
1467
  }),
1468
- Y.object({
1469
- type: Y.literal("text"),
1470
- text: Y.string()
1468
+ X.object({
1469
+ type: X.literal("text"),
1470
+ text: X.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
1472
+ ]), Pn = X.discriminatedUnion("type", [X.object({
1473
+ type: X.literal("data"),
1474
+ data: kn
1475
+ }), X.object({
1476
+ type: X.literal("url"),
1477
+ url: X.instanceof(URL)
1478
+ })]), Fn = X.object({
1479
+ type: X.literal("file"),
1480
+ data: X.union([
1481
+ Nn,
1482
+ kn,
1483
+ X.instanceof(URL),
1484
+ An
1485
1485
  ]),
1486
- filename: Y.string().optional(),
1487
- mediaType: Y.string(),
1486
+ filename: X.string().optional(),
1487
+ mediaType: X.string(),
1488
1488
  providerOptions: Z.optional()
1489
- }), Pn = Y.object({
1490
- type: Y.literal("reasoning"),
1491
- text: Y.string(),
1489
+ }), In = X.object({
1490
+ type: X.literal("reasoning"),
1491
+ text: X.string(),
1492
1492
  providerOptions: Z.optional()
1493
- }), Fn = Y.object({
1494
- type: Y.literal("custom"),
1495
- kind: Y.string().transform((e) => e),
1493
+ }), Ln = X.object({
1494
+ type: X.literal("custom"),
1495
+ kind: X.string().transform((e) => e),
1496
1496
  providerOptions: Z.optional()
1497
- }), In = Y.object({
1498
- type: Y.literal("reasoning-file"),
1499
- data: Y.union([
1500
- Mn,
1501
- Dn,
1502
- Y.instanceof(URL)
1497
+ }), Rn = X.object({
1498
+ type: X.literal("reasoning-file"),
1499
+ data: X.union([
1500
+ Pn,
1501
+ kn,
1502
+ X.instanceof(URL)
1503
1503
  ]),
1504
- mediaType: Y.string(),
1504
+ mediaType: X.string(),
1505
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(),
1506
+ }), zn = X.object({
1507
+ type: X.literal("tool-call"),
1508
+ toolCallId: X.string(),
1509
+ toolName: X.string(),
1510
+ input: X.unknown(),
1511
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(),
1512
+ providerExecuted: X.boolean().optional()
1513
+ }), Bn = X.discriminatedUnion("type", [
1514
+ X.object({
1515
+ type: X.literal("text"),
1516
+ value: X.string(),
1517
1517
  providerOptions: Z.optional()
1518
1518
  }),
1519
- Y.object({
1520
- type: Y.literal("json"),
1521
- value: X,
1519
+ X.object({
1520
+ type: X.literal("json"),
1521
+ value: On,
1522
1522
  providerOptions: Z.optional()
1523
1523
  }),
1524
- Y.object({
1525
- type: Y.literal("execution-denied"),
1526
- reason: Y.string().optional(),
1524
+ X.object({
1525
+ type: X.literal("execution-denied"),
1526
+ reason: X.string().optional(),
1527
1527
  providerOptions: Z.optional()
1528
1528
  }),
1529
- Y.object({
1530
- type: Y.literal("error-text"),
1531
- value: Y.string(),
1529
+ X.object({
1530
+ type: X.literal("error-text"),
1531
+ value: X.string(),
1532
1532
  providerOptions: Z.optional()
1533
1533
  }),
1534
- Y.object({
1535
- type: Y.literal("error-json"),
1536
- value: X,
1534
+ X.object({
1535
+ type: X.literal("error-json"),
1536
+ value: On,
1537
1537
  providerOptions: Z.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(),
1539
+ X.object({
1540
+ type: X.literal("content"),
1541
+ value: X.array(X.union([
1542
+ X.object({
1543
+ type: X.literal("text"),
1544
+ text: X.string(),
1545
1545
  providerOptions: Z.optional()
1546
1546
  }),
1547
- Y.object({
1548
- type: Y.literal("file"),
1549
- data: jn,
1550
- mediaType: Y.string(),
1551
- filename: Y.string().optional(),
1547
+ X.object({
1548
+ type: X.literal("file"),
1549
+ data: Nn,
1550
+ mediaType: X.string(),
1551
+ filename: X.string().optional(),
1552
1552
  providerOptions: Z.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(),
1554
+ X.object({
1555
+ type: X.literal("file-data"),
1556
+ data: X.string(),
1557
+ mediaType: X.string(),
1558
+ filename: X.string().optional(),
1559
1559
  providerOptions: Z.optional()
1560
1560
  }),
1561
- Y.object({
1562
- type: Y.literal("file-url"),
1563
- url: Y.string(),
1564
- mediaType: Y.string().optional(),
1561
+ X.object({
1562
+ type: X.literal("file-url"),
1563
+ url: X.string(),
1564
+ mediaType: X.string().optional(),
1565
1565
  providerOptions: Z.optional()
1566
1566
  }),
1567
- Y.object({
1568
- type: Y.literal("file-id"),
1569
- fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1567
+ X.object({
1568
+ type: X.literal("file-id"),
1569
+ fileId: X.union([X.string(), X.record(X.string(), X.string())]),
1570
1570
  providerOptions: Z.optional()
1571
1571
  }),
1572
- Y.object({
1573
- type: Y.literal("file-reference"),
1574
- providerReference: Y.record(Y.string(), Y.string()),
1572
+ X.object({
1573
+ type: X.literal("file-reference"),
1574
+ providerReference: X.record(X.string(), X.string()),
1575
1575
  providerOptions: Z.optional()
1576
1576
  }),
1577
- Y.object({
1578
- type: Y.literal("image-data"),
1579
- data: Y.string(),
1580
- mediaType: Y.string(),
1577
+ X.object({
1578
+ type: X.literal("image-data"),
1579
+ data: X.string(),
1580
+ mediaType: X.string(),
1581
1581
  providerOptions: Z.optional()
1582
1582
  }),
1583
- Y.object({
1584
- type: Y.literal("image-url"),
1585
- url: Y.string(),
1583
+ X.object({
1584
+ type: X.literal("image-url"),
1585
+ url: X.string(),
1586
1586
  providerOptions: Z.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())]),
1588
+ X.object({
1589
+ type: X.literal("image-file-id"),
1590
+ fileId: X.union([X.string(), X.record(X.string(), X.string())]),
1591
1591
  providerOptions: Z.optional()
1592
1592
  }),
1593
- Y.object({
1594
- type: Y.literal("image-file-reference"),
1595
- providerReference: Y.record(Y.string(), Y.string()),
1593
+ X.object({
1594
+ type: X.literal("image-file-reference"),
1595
+ providerReference: X.record(X.string(), X.string()),
1596
1596
  providerOptions: Z.optional()
1597
1597
  }),
1598
- Y.object({
1599
- type: Y.literal("custom"),
1598
+ X.object({
1599
+ type: X.literal("custom"),
1600
1600
  providerOptions: Z.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,
1604
+ ]), Vn = X.object({
1605
+ type: X.literal("tool-result"),
1606
+ toolCallId: X.string(),
1607
+ toolName: X.string(),
1608
+ output: Bn,
1609
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(),
1610
+ }), Hn = X.object({
1611
+ type: X.literal("tool-approval-request"),
1612
+ approvalId: X.string(),
1613
+ toolCallId: X.string(),
1614
+ reason: X.string().optional(),
1615
+ isAutomatic: X.boolean().optional(),
1616
+ signature: X.string().optional(),
1617
+ inputSchemaInput: X.unknown().optional()
1618
+ }), Un = X.object({
1619
+ type: X.literal("tool-approval-response"),
1620
+ approvalId: X.string(),
1621
+ approved: X.boolean(),
1622
+ reason: X.string().optional()
1623
+ }), Wn = X.object({
1624
+ role: X.literal("system"),
1625
+ content: X.string(),
1626
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,
1631
- An,
1632
- Nn
1627
+ }), Gn = X.object({
1628
+ role: X.literal("user"),
1629
+ content: X.union([X.string(), X.array(X.union([
1630
+ jn,
1631
+ Mn,
1632
+ Fn
1633
1633
  ]))]),
1634
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,
1635
+ }), Kn = X.object({
1636
+ role: X.literal("assistant"),
1637
+ content: X.union([X.string(), X.array(X.union([
1638
+ jn,
1639
+ Ln,
1639
1640
  Fn,
1640
- Nn,
1641
- Pn,
1642
1641
  In,
1643
- Ln,
1642
+ Rn,
1644
1643
  zn,
1645
- Bn
1644
+ Vn,
1645
+ Hn
1646
1646
  ]))]),
1647
1647
  providerOptions: Z.optional()
1648
- }), Gn = Y.object({
1649
- role: Y.literal("tool"),
1650
- content: Y.array(Y.union([zn, Vn])),
1648
+ }), qn = X.object({
1649
+ role: X.literal("tool"),
1650
+ content: X.array(X.union([Vn, Un])),
1651
1651
  providerOptions: Z.optional()
1652
1652
  });
1653
- Y.union([
1654
- Hn,
1655
- Un,
1653
+ X.union([
1656
1654
  Wn,
1657
- Gn
1655
+ Gn,
1656
+ Kn,
1657
+ qn
1658
1658
  ]);
1659
- function Kn(e) {
1659
+ function Jn(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,7 +1838,7 @@ function Kn(e) {
1838
1838
  }
1839
1839
  return l;
1840
1840
  }
1841
- async function qn(e) {
1841
+ async function Yn(e) {
1842
1842
  if (e === void 0) return {
1843
1843
  value: void 0,
1844
1844
  state: "undefined-input"
@@ -1847,7 +1847,7 @@ async function qn(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 gn({ text: Jn(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(),
1865
+ var Xn = X.object({
1866
+ source: X.discriminatedUnion("sourceType", [X.object({
1867
+ type: X.literal("source"),
1868
+ sourceType: X.literal("url"),
1869
+ id: X.string(),
1870
+ url: X.string(),
1871
+ title: X.string().optional(),
1872
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(),
1873
+ }), X.object({
1874
+ type: X.literal("source"),
1875
+ sourceType: X.literal("document"),
1876
+ id: X.string(),
1877
+ mediaType: X.string(),
1878
+ title: X.string(),
1879
+ filename: X.string().optional(),
1880
1880
  providerMetadata: Z.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(),
1882
+ startIndex: X.number().int().nonnegative().optional(),
1883
+ endIndex: X.number().int().nonnegative().optional(),
1884
+ citedText: X.string().optional()
1885
+ }), Zn = X.record(X.string(), On.optional()), Qn = rn(() => pn(X.union([
1886
+ X.looseObject({
1887
+ type: X.literal("text-start"),
1888
+ id: X.string(),
1889
1889
  providerMetadata: Z.optional()
1890
1890
  }),
1891
- Y.looseObject({
1892
- type: Y.literal("text-delta"),
1893
- id: Y.string(),
1894
- delta: Y.string(),
1891
+ X.looseObject({
1892
+ type: X.literal("text-delta"),
1893
+ id: X.string(),
1894
+ delta: X.string(),
1895
1895
  providerMetadata: Z.optional()
1896
1896
  }),
1897
- Y.looseObject({
1898
- type: Y.literal("text-end"),
1899
- id: Y.string(),
1900
- citations: Y.array(Jn).optional(),
1897
+ X.looseObject({
1898
+ type: X.literal("text-end"),
1899
+ id: X.string(),
1900
+ citations: X.array(Xn).optional(),
1901
1901
  providerMetadata: Z.optional()
1902
1902
  }),
1903
- Y.looseObject({
1904
- type: Y.literal("error"),
1905
- errorText: Y.string()
1903
+ X.looseObject({
1904
+ type: X.literal("error"),
1905
+ errorText: X.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(),
1907
+ X.looseObject({
1908
+ type: X.literal("tool-input-start"),
1909
+ toolCallId: X.string(),
1910
+ toolName: X.string(),
1911
+ providerExecuted: X.boolean().optional(),
1912
1912
  providerMetadata: Z.optional(),
1913
- toolMetadata: Yn.optional(),
1914
- dynamic: Y.boolean().optional(),
1915
- title: Y.string().optional()
1913
+ toolMetadata: Zn.optional(),
1914
+ dynamic: X.boolean().optional(),
1915
+ title: X.string().optional()
1916
1916
  }),
1917
- Y.looseObject({
1918
- type: Y.literal("tool-input-delta"),
1919
- toolCallId: Y.string(),
1920
- inputTextDelta: Y.string()
1917
+ X.looseObject({
1918
+ type: X.literal("tool-input-delta"),
1919
+ toolCallId: X.string(),
1920
+ inputTextDelta: X.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(),
1922
+ X.looseObject({
1923
+ type: X.literal("tool-input-available"),
1924
+ toolCallId: X.string(),
1925
+ toolName: X.string(),
1926
+ input: X.unknown(),
1927
+ providerExecuted: X.boolean().optional(),
1928
1928
  providerMetadata: Z.optional(),
1929
- toolMetadata: Yn.optional(),
1930
- dynamic: Y.boolean().optional(),
1931
- title: Y.string().optional()
1929
+ toolMetadata: Zn.optional(),
1930
+ dynamic: X.boolean().optional(),
1931
+ title: X.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(),
1933
+ X.looseObject({
1934
+ type: X.literal("tool-input-error"),
1935
+ toolCallId: X.string(),
1936
+ toolName: X.string(),
1937
+ input: X.unknown(),
1938
+ providerExecuted: X.boolean().optional(),
1939
1939
  providerMetadata: Z.optional(),
1940
- toolMetadata: Yn.optional(),
1941
- dynamic: Y.boolean().optional(),
1942
- errorText: Y.string(),
1943
- title: Y.string().optional()
1940
+ toolMetadata: Zn.optional(),
1941
+ dynamic: X.boolean().optional(),
1942
+ errorText: X.string(),
1943
+ title: X.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
+ X.looseObject({
1946
+ type: X.literal("tool-approval-request"),
1947
+ approvalId: X.string(),
1948
+ toolCallId: X.string(),
1949
+ approvalDescriptor: X.unknown().optional(),
1950
+ inputSchemaInput: X.unknown().optional(),
1951
+ reason: X.string().optional(),
1952
+ isAutomatic: X.boolean().optional(),
1953
+ signature: X.string().optional()
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(),
1955
+ X.looseObject({
1956
+ type: X.literal("tool-approval-response"),
1957
+ approvalId: X.string(),
1958
+ approved: X.boolean(),
1959
+ reason: X.string().optional(),
1960
+ providerExecuted: X.boolean().optional(),
1961
1961
  providerMetadata: Z.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(),
1963
+ X.looseObject({
1964
+ type: X.literal("tool-output-available"),
1965
+ toolCallId: X.string(),
1966
+ output: X.unknown(),
1967
+ providerExecuted: X.boolean().optional(),
1968
1968
  providerMetadata: Z.optional(),
1969
- toolMetadata: Yn.optional(),
1970
- dynamic: Y.boolean().optional(),
1971
- preliminary: Y.boolean().optional()
1969
+ toolMetadata: Zn.optional(),
1970
+ dynamic: X.boolean().optional(),
1971
+ preliminary: X.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(),
1973
+ X.looseObject({
1974
+ type: X.literal("tool-output-error"),
1975
+ toolCallId: X.string(),
1976
+ errorText: X.string(),
1977
+ providerExecuted: X.boolean().optional(),
1978
1978
  providerMetadata: Z.optional(),
1979
- toolMetadata: Yn.optional(),
1980
- dynamic: Y.boolean().optional()
1979
+ toolMetadata: Zn.optional(),
1980
+ dynamic: X.boolean().optional()
1981
1981
  }),
1982
- Y.looseObject({
1983
- type: Y.literal("tool-output-denied"),
1984
- toolCallId: Y.string()
1982
+ X.looseObject({
1983
+ type: X.literal("tool-output-denied"),
1984
+ toolCallId: X.string()
1985
1985
  }),
1986
- Y.looseObject({
1987
- type: Y.literal("reasoning-start"),
1988
- id: Y.string(),
1986
+ X.looseObject({
1987
+ type: X.literal("reasoning-start"),
1988
+ id: X.string(),
1989
1989
  providerMetadata: Z.optional()
1990
1990
  }),
1991
- Y.looseObject({
1992
- type: Y.literal("reasoning-delta"),
1993
- id: Y.string(),
1994
- delta: Y.string(),
1991
+ X.looseObject({
1992
+ type: X.literal("reasoning-delta"),
1993
+ id: X.string(),
1994
+ delta: X.string(),
1995
1995
  providerMetadata: Z.optional()
1996
1996
  }),
1997
- Y.looseObject({
1998
- type: Y.literal("reasoning-end"),
1999
- id: Y.string(),
1997
+ X.looseObject({
1998
+ type: X.literal("reasoning-end"),
1999
+ id: X.string(),
2000
2000
  providerMetadata: Z.optional()
2001
2001
  }),
2002
- Y.looseObject({
2003
- type: Y.literal("custom"),
2004
- kind: Y.string().transform((e) => e),
2002
+ X.looseObject({
2003
+ type: X.literal("custom"),
2004
+ kind: X.string().transform((e) => e),
2005
2005
  providerMetadata: Z.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(),
2007
+ X.looseObject({
2008
+ type: X.literal("source-url"),
2009
+ sourceId: X.string(),
2010
+ url: X.string(),
2011
+ title: X.string().optional(),
2012
2012
  providerMetadata: Z.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(),
2014
+ X.looseObject({
2015
+ type: X.literal("source-document"),
2016
+ sourceId: X.string(),
2017
+ mediaType: X.string(),
2018
+ title: X.string(),
2019
+ filename: X.string().optional(),
2020
2020
  providerMetadata: Z.optional()
2021
2021
  }),
2022
- Y.looseObject({
2023
- type: Y.literal("file"),
2024
- url: Y.string(),
2025
- mediaType: Y.string(),
2022
+ X.looseObject({
2023
+ type: X.literal("file"),
2024
+ url: X.string(),
2025
+ mediaType: X.string(),
2026
2026
  providerMetadata: Z.optional()
2027
2027
  }),
2028
- Y.looseObject({
2029
- type: Y.literal("reasoning-file"),
2030
- url: Y.string(),
2031
- mediaType: Y.string(),
2028
+ X.looseObject({
2029
+ type: X.literal("reasoning-file"),
2030
+ url: X.string(),
2031
+ mediaType: X.string(),
2032
2032
  providerMetadata: Z.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
+ X.looseObject({
2035
+ type: X.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2036
+ id: X.string().optional(),
2037
+ data: X.unknown(),
2038
+ transient: X.boolean().optional()
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
+ X.looseObject({ type: X.literal("start-step") }),
2041
+ X.looseObject({ type: X.literal("finish-step") }),
2042
+ X.looseObject({ type: X.literal("reset-step") }),
2043
+ X.looseObject({
2044
+ type: X.literal("start"),
2045
+ messageId: X.string().optional(),
2046
+ messageMetadata: X.unknown().optional()
2047
2047
  }),
2048
- Y.looseObject({
2049
- type: Y.literal("finish"),
2050
- finishReason: Y.enum([
2048
+ X.looseObject({
2049
+ type: X.literal("finish"),
2050
+ finishReason: X.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: X.unknown().optional()
2059
2059
  }),
2060
- Y.looseObject({
2061
- type: Y.literal("abort"),
2062
- reason: Y.string().optional()
2060
+ X.looseObject({
2061
+ type: X.literal("abort"),
2062
+ reason: X.string().optional()
2063
2063
  }),
2064
- Y.looseObject({
2065
- type: Y.literal("message-metadata"),
2066
- messageMetadata: Y.unknown()
2064
+ X.looseObject({
2065
+ type: X.literal("message-metadata"),
2066
+ messageMetadata: X.unknown()
2067
2067
  })
2068
2068
  ])));
2069
- function Zn(e) {
2069
+ function $n(e) {
2070
2070
  return e.type.startsWith("data-");
2071
2071
  }
2072
- function Qn() {
2072
+ function er() {
2073
2073
  return Object.create(null);
2074
2074
  }
2075
- function $n(e) {
2075
+ function tr(e) {
2076
2076
  return e.type.startsWith("tool-");
2077
2077
  }
2078
- function er(e) {
2078
+ function nr(e) {
2079
2079
  return e.type === "dynamic-tool";
2080
2080
  }
2081
2081
  function Q(e) {
2082
- return $n(e) || er(e);
2082
+ return tr(e) || nr(e);
2083
2083
  }
2084
- function tr(e) {
2084
+ function rr(e) {
2085
2085
  return e.type.split("-").slice(1).join("-");
2086
2086
  }
2087
- function nr({ lastMessage: e, messageId: t }) {
2087
+ function ir({ 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 = er(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
2094
2094
  for (let e of n.parts.slice(i + 1)) {
2095
2095
  if (!Q(e)) continue;
2096
2096
  let t = a;
2097
- $n(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
2097
+ tr(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 : rr(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: er(),
2109
+ activeReasoningParts: er(),
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 ar({ 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 }) => {
@@ -2134,7 +2134,7 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2134
2134
  }
2135
2135
  }
2136
2136
  }
2137
- if (t == null) throw new J({
2137
+ if (t == null) throw new En({
2138
2138
  chunkType: "tool-invocation",
2139
2139
  chunkId: e,
2140
2140
  message: `No tool invocation found for tool call ID "${e}".`
@@ -2143,7 +2143,7 @@ function rr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2143
2143
  }
2144
2144
  function h(e) {
2145
2145
  let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
2146
- if (t == null) throw new J({
2146
+ if (t == null) throw new En({
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) => tr(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,7 +2206,7 @@ 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);
2209
+ let n = r.message.metadata == null ? e : Dn(r.message.metadata, e);
2210
2210
  t != null && await mn({
2211
2211
  value: n,
2212
2212
  schema: t,
@@ -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 En({
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 En({
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 En({
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 En({
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(tr);
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 En({
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 Yn(t.text);
2358
2358
  t.dynamic ? _({
2359
2359
  toolCallId: e.toolCallId,
2360
2360
  toolName: t.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: rr(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: rr(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 = er(), r.activeReasoningParts = er(), r.partialToolCalls = er(), 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, ir({
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,7 +2524,7 @@ 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 ($n(e)) {
2528
2528
  if (n?.[e.type] != null) {
2529
2529
  let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
2530
2530
  await mn({
@@ -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 or({ 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 sr() {
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
+ }), X.record(X.string(), On.optional()), X.record(X.string(), X.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: cr } = globalThis, lr = 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
+ }), X.object({
2643
+ token: X.string().refine((e) => e.trim().length > 0),
2644
+ url: X.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,24 +2649,24 @@ 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: X.number().positive().max(2 ** 53 - 1).optional(),
2653
+ tools: X.array(X.object({
2654
+ type: X.literal("function"),
2655
+ name: X.string().min(1),
2656
+ description: X.string().optional(),
2657
+ parameters: X.record(X.string(), X.unknown())
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 ur({ response: e, url: t, fallbackMessage: n }) {
2670
2670
  let r = await e.text();
2671
2671
  return new Fe({
2672
2672
  message: r || n,
@@ -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 dr(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 Qe({
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 fr(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 pr = 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
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)
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,7 +2739,7 @@ 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 ur({
2743
2743
  response: d,
2744
2744
  url: s,
2745
2745
  fallbackMessage: "Failed to fetch the chat response."
@@ -2749,8 +2749,8 @@ var dr = class {
2749
2749
  }
2750
2750
  async reconnectToStream(e) {
2751
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)
2752
+ ...F(n),
2753
+ ...F(e.headers)
2754
2754
  }, a = await this.prepareReconnectToStreamRequest?.({
2755
2755
  api: this.api,
2756
2756
  id: e.chatId,
@@ -2768,16 +2768,16 @@ var dr = class {
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 = fr(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 ur({
2781
2781
  response: l,
2782
2782
  url: o,
2783
2783
  fallbackMessage: "Failed to fetch the chat response."
@@ -2785,22 +2785,22 @@ var dr = class {
2785
2785
  if (!l.body) throw new Le({ message: "The response body is empty." });
2786
2786
  return this.processResponseStream(l.body);
2787
2787
  }
2788
- }, fr = class extends dr {
2788
+ }, mr = class extends pr {
2789
2789
  constructor({ resumeStreamIsReplay: e = !0, ...t } = {}) {
2790
2790
  super(t), this.resumeStreamIsReplay = e;
2791
2791
  }
2792
2792
  processResponseStream(e) {
2793
2793
  return _n({
2794
2794
  stream: e,
2795
- schema: Xn
2795
+ schema: Qn
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
+ }, hr = class {
2802
+ constructor({ generateId: e = L, id: t = e(), transport: n = new mr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
2803
+ this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new lr(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
2804
2804
  if (e == null) {
2805
2805
  let e = this.pendingApprovalMessageId;
2806
2806
  if (e == null) {
@@ -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 dr(e.files);
2831
2831
  } finally {
2832
2832
  this.pendingMessagePreparations.delete(t);
2833
2833
  }
@@ -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 = sr();
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) => Q(e) && (e.state === "input-streaming" || e.state === "input-available" && e.providerExecuted || e.state === "approval-responded")) ? this.state.snapshot(p) : void 0, g = f !== -1 && f < this.state.messages.length - 1 && p?.role === "assistant", _ = !1, v = !1, y = !1, b;
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 : ir({
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 or({
3084
+ stream: ar({
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,7 +3146,7 @@ var dr = class {
3146
3146
  }));
3147
3147
  }
3148
3148
  };
3149
- function mr({ messages: e }) {
3149
+ function gr({ messages: e }) {
3150
3150
  let t = e[e.length - 1];
3151
3151
  if (!t || t.role !== "assistant") return !1;
3152
3152
  let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
@@ -3154,31 +3154,31 @@ function mr({ messages: e }) {
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 _r = /* @__PURE__ */ new WeakMap(), vr = 0;
3158
+ function yr(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]) : _r.has(e[n]) ? r = _r.get(e[n]) : (r = vr, _r.set(e[n], vr++)), 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 br(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) ? yr(e) : String(e || ""), e;
3175
3175
  }
3176
- var yr = function() {
3176
+ var xr = 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 br(e);
3182
3182
  }, e.prototype.get = function(e) {
3183
3183
  var t = this.serializeKey(e);
3184
3184
  return this.items.get(t);
@@ -3200,15 +3200,15 @@ 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 Sr() {
3204
3204
  return navigator.onLine === void 0 || navigator.onLine;
3205
3205
  }
3206
- function xr() {
3206
+ function Cr() {
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 wr = {
3210
+ isOnline: Sr,
3211
+ isDocumentVisible: Cr,
3212
3212
  fetcher: function(e) {
3213
3213
  return fetch(e).then(function(e) {
3214
3214
  return e.json();
@@ -3219,7 +3219,7 @@ var Sr = {
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
3221
  }, $.apply(this, arguments);
3222
- }, Cr = function(e, t, n, r) {
3222
+ }, Tr = 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
+ }, Er = function(e, t) {
3249
3249
  var n = {
3250
3250
  label: 0,
3251
3251
  sent: function() {
@@ -3318,7 +3318,7 @@ var Sr = {
3318
3318
  done: !0
3319
3319
  };
3320
3320
  }
3321
- }, Tr = function(e, t) {
3321
+ }, Dr = function(e, t) {
3322
3322
  var n = typeof Symbol == "function" && e[Symbol.iterator];
3323
3323
  if (!n) return e;
3324
3324
  var r = n.call(e), i, a = [], o;
@@ -3334,11 +3334,11 @@ var Sr = {
3334
3334
  }
3335
3335
  }
3336
3336
  return a;
3337
- }, Er = function(e, t, n) {
3337
+ }, Or = 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 = {
3341
- cache: Dr,
3340
+ }, kr = new xr(), Ar = new xr(), jr = new xr(), Mr = {
3341
+ cache: kr,
3342
3342
  refreshInterval: 0,
3343
3343
  ttl: 0,
3344
3344
  serverTTL: 1e3,
@@ -3348,15 +3348,15 @@ 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: wr.fetcher,
3352
+ isOnline: wr.isOnline,
3353
+ isDocumentVisible: wr.isDocumentVisible
3354
3354
  };
3355
- function jr(e, t, n) {
3356
- var r = Or.get(e);
3357
- r ? r.data.push(t) : Or.set(e, [t], n > 0 ? n + 5e3 : n);
3355
+ function Nr(e, t, n) {
3356
+ var r = Ar.get(e);
3357
+ r ? r.data.push(t) : Ar.set(e, [t], n > 0 ? n + 5e3 : n);
3358
3358
  }
3359
- function Mr(e, t, n) {
3359
+ function Pr(e, t, n) {
3360
3360
  if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
3361
3361
  var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
3362
3362
  setTimeout(function() {
@@ -3367,17 +3367,17 @@ function Mr(e, t, n) {
3367
3367
  }, i);
3368
3368
  }
3369
3369
  }
3370
- function Nr(e) {
3370
+ function Fr(e) {
3371
3371
  var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
3372
- return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Ar.shouldRetryOnError;
3372
+ return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Mr.shouldRetryOnError;
3373
3373
  }
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() {
3374
+ var Ir = function(e, t, n, r) {
3375
+ return n === void 0 && (n = kr), r === void 0 && (r = Mr.ttl), Tr(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 Er(this, function(d) {
3378
3378
  switch (d.label) {
3379
3379
  case 0:
3380
- if (!Ir(t)) return [3, 5];
3380
+ if (!Rr(t)) return [3, 5];
3381
3381
  d.label = 1;
3382
3382
  case 1: return d.trys.push([
3383
3383
  1,
@@ -3399,7 +3399,7 @@ var Pr = function(e, t, n, r) {
3399
3399
  } catch (e) {
3400
3400
  console.error("swrv(mutate): failed to set cache", e);
3401
3401
  }
3402
- return l = Or.get(e), l && l.data.length && (u = l.data.filter(function(t) {
3402
+ return l = Ar.get(e), l && l.data.length && (u = l.data.filter(function(t) {
3403
3403
  return t.key === e;
3404
3404
  }), u.forEach(function(e, t) {
3405
3405
  c.data !== void 0 && (e.data = c.data), e.error = c.error, e.isValidating = c.isValidating, e.isLoading = c.isValidating, t !== u.length - 1 && delete u[t];
@@ -3408,13 +3408,13 @@ var Pr = function(e, t, n, r) {
3408
3408
  });
3409
3409
  });
3410
3410
  };
3411
- function Fr() {
3411
+ function Lr() {
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 = $({}, Mr), 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
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);
3417
+ var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : S(r);
3418
3418
  i === void 0 && (i = a.fetcher);
3419
3419
  var d = null;
3420
3420
  d ||= _e({
@@ -3425,32 +3425,32 @@ 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 Tr(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 Er(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 Tr(g, void 0, void 0, function() {
3434
3434
  var e, t, i, s, c, u;
3435
- return wr(this, function(m) {
3435
+ return Er(this, function(m) {
3436
3436
  switch (m.label) {
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)]);
3437
+ case 0: return e = jr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, Or([], Dr(t), !1)), jr.set(r, i, a.dedupingInterval), [4, Ir(r, i, a.cache, l)]);
3438
3438
  case 1: return m.sent(), [3, 4];
3439
- case 2: return [4, Pr(r, e.data, a.cache, l)];
3439
+ case 2: return [4, Ir(r, e.data, a.cache, l)];
3440
3440
  case 3: m.sent(), m.label = 4;
3441
- case 4: return d.isValidating = !1, d.isLoading = !1, kr.delete(r), d.error !== void 0 && (s = Nr({
3441
+ case 4: return d.isValidating = !1, d.isLoading = !1, jr.delete(r), d.error !== void 0 && (s = Fr({
3442
3442
  shouldRetry: a.shouldRetryOnError,
3443
3443
  error: d.error
3444
- }), c = Nr({
3444
+ }), c = Fr({
3445
3445
  shouldRetry: !n || n.shouldRetryOnError,
3446
3446
  error: d.error
3447
- }), u = !o && s && c, u && Mr(f, n ? n.errorRetryCount : 1, a)), [2];
3447
+ }), u = !o && s && c, u && Pr(f, n ? n.errorRetryCount : 1, a)), [2];
3448
3448
  }
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 Tr(g, void 0, void 0, function() {
3453
+ return Er(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 Tr(e, void 0, void 0, function() {
3470
+ return Er(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 Tr(e, void 0, void 0, function() {
3478
+ return Er(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];
@@ -3489,108 +3489,185 @@ function Fr() {
3489
3489
  }
3490
3490
  ge(function() {
3491
3491
  o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
3492
- var e = Or.get(u.value);
3492
+ var e = Ar.get(u.value);
3493
3493
  e && (e.data = e.data.filter(function(e) {
3494
3494
  return e !== d;
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
+ me(u) || (u.value = e), d.key = e, d.isValidating = !!e, Nr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3500
3500
  }, { immediate: !0 });
3501
3501
  } catch {}
3502
- return $($({}, ye(d)), { mutate: function(e, t) {
3502
+ return $($({}, ve(d)), { mutate: function(e, t) {
3503
3503
  return f(e, $($({}, t), { forceRevalidate: !0 }));
3504
3504
  } });
3505
3505
  }
3506
- function Ir(e) {
3506
+ function Rr(e) {
3507
3507
  return typeof e == "object" && !!e && typeof e.then == "function";
3508
3508
  }
3509
3509
  //#endregion
3510
3510
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/index.js
3511
- var Lr = Fr;
3512
- Lr.default, Lr.default;
3513
- var Rr = class {
3514
- constructor(e) {
3515
- this.statusRef = x("ready"), this.errorRef = x(void 0), this.pushMessage = (e) => {
3516
- this.messagesRef.value = [...this.messagesRef.value, e];
3511
+ var zr = Lr;
3512
+ zr.default, zr.default;
3513
+ function Br(e) {
3514
+ return Array.isArray(e) ? [...e] : typeof e == "object" && e && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
3515
+ }
3516
+ function Vr(e) {
3517
+ if (typeof e != "object" || !e || !("parts" in e) || !Array.isArray(e.parts)) return e;
3518
+ let t = e, n = {
3519
+ ...t,
3520
+ parts: t.parts.map((e) => ({ ...e }))
3521
+ };
3522
+ return "metadata" in t && (n.metadata = Br(t.metadata)), n;
3523
+ }
3524
+ var Hr = class {
3525
+ constructor({ initialMessages: e, messagesRef: t, statusRef: n, errorRef: r, throttleWaitMs: i }) {
3526
+ this.publishedMessages = [], this.publishedMessageSources = [], this.dirtyMessageIndices = /* @__PURE__ */ new Set(), this.statusValue = "ready", this.hasPendingPublication = !1, this.isActive = !0, this.isPublishing = !1, this.pushMessage = (e) => {
3527
+ this.messagesValue.push(e), this.dirtyMessageIndices.add(this.messagesValue.length - 1), this.schedulePublication();
3517
3528
  }, this.popMessage = () => {
3518
- this.messagesRef.value = this.messagesRef.value.slice(0, -1);
3529
+ this.messagesValue.pop(), this.schedulePublication();
3519
3530
  }, this.replaceMessage = (e, t) => {
3520
- this.messagesRef.value[e] = { ...t };
3521
- }, this.snapshot = (e) => e, this.messagesRef = x(e ?? []);
3531
+ this.messagesValue[e] = t, this.dirtyMessageIndices.add(e), this.schedulePublication();
3532
+ }, this.snapshot = Vr, this.handleIntervalEnd = () => {
3533
+ this.timeout = void 0, this.isActive && this.hasPendingPublication && (this.hasPendingPublication = !1, this.publishMessages(), this.timeout = setTimeout(this.handleIntervalEnd, this.throttleWaitMs));
3534
+ }, this.messagesValue = e, this.messagesRef = t, this.statusRef = n, this.errorRef = r, this.throttleWaitMs = i != null && Number.isFinite(i) && i > 0 ? i : void 0;
3522
3535
  }
3523
3536
  get messages() {
3524
- return this.messagesRef.value;
3537
+ return this.messagesValue;
3525
3538
  }
3526
3539
  set messages(e) {
3527
- this.messagesRef.value = e;
3540
+ let t = this.messagesValue;
3541
+ this.messagesValue = e;
3542
+ for (let n = 0; n < e.length; n++) e[n] !== t[n] && this.dirtyMessageIndices.add(n);
3543
+ this.schedulePublication();
3528
3544
  }
3529
3545
  get status() {
3530
- return this.statusRef.value;
3546
+ return this.statusValue;
3531
3547
  }
3532
3548
  set status(e) {
3533
- this.statusRef.value = e;
3549
+ this.statusValue = e, this.isActive && ((e === "ready" || e === "error") && this.flushPublication(), this.statusRef.value = e);
3534
3550
  }
3535
3551
  get error() {
3536
- return this.errorRef.value;
3552
+ return this.errorValue;
3537
3553
  }
3538
3554
  set error(e) {
3539
- this.errorRef.value = e;
3555
+ this.errorValue = e, this.isActive && (this.errorRef.value = e);
3556
+ }
3557
+ publishInitialState() {
3558
+ this.publishMessages(), this.statusRef.value = this.statusValue, this.errorRef.value = this.errorValue;
3559
+ }
3560
+ setMessagesFromConsumer(e) {
3561
+ this.messagesValue = e, this.publishedMessages = e, this.publishedMessageSources = e, this.dirtyMessageIndices.clear();
3562
+ }
3563
+ dispose() {
3564
+ this.isActive = !1, this.hasPendingPublication = !1, this.dirtyMessageIndices.clear(), this.publishedMessages = [], this.publishedMessageSources = [], this.timeout != null && (clearTimeout(this.timeout), this.timeout = void 0);
3565
+ }
3566
+ schedulePublication() {
3567
+ this.isActive && (this.throttleWaitMs == null ? this.publishMessages() : this.timeout == null ? (this.publishMessages(), this.timeout = setTimeout(this.handleIntervalEnd, this.throttleWaitMs)) : this.hasPendingPublication = !0);
3568
+ }
3569
+ flushPublication() {
3570
+ this.timeout != null && (clearTimeout(this.timeout), this.timeout = void 0), this.hasPendingPublication = !1, this.publishMessages();
3540
3571
  }
3541
- }, zr = class extends pr {
3542
- constructor({ messages: e, ...t }) {
3572
+ publishMessages() {
3573
+ if (!this.isActive) return;
3574
+ let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ? Vr(e) : this.publishedMessages[t]);
3575
+ this.publishedMessages = e, this.publishedMessageSources = [...this.messagesValue], this.dirtyMessageIndices.clear(), this.isPublishing = !0;
3576
+ try {
3577
+ this.messagesRef.value = e;
3578
+ } finally {
3579
+ this.isPublishing = !1;
3580
+ }
3581
+ }
3582
+ }, Ur = class extends hr {
3583
+ constructor({ state: e, ...t }) {
3543
3584
  super({
3544
3585
  ...t,
3545
- state: new Rr(e)
3586
+ state: e
3546
3587
  });
3547
3588
  }
3548
- }, Br = "voice-", Vr = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), Hr = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Ur = (e) => Hr(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Wr = 8, Gr = (e, t) => {
3589
+ };
3590
+ function Wr(e) {
3591
+ let t = C([]), n = C("ready"), r = C(), i = C(), a;
3592
+ return w(t, (e) => {
3593
+ a != null && !a.isPublishing && a.setMessagesFromConsumer(e);
3594
+ }, { flush: "sync" }), w(() => ye(e), (e) => {
3595
+ a?.dispose();
3596
+ let { throttle: o, ...s } = e ?? {}, c = new Hr({
3597
+ initialMessages: s.messages ?? [],
3598
+ messagesRef: t,
3599
+ statusRef: n,
3600
+ errorRef: r,
3601
+ throttleWaitMs: o
3602
+ });
3603
+ a = c, c.publishInitialState(), i.value = new Ur({
3604
+ ...s,
3605
+ state: c
3606
+ });
3607
+ }, { immediate: !0 }), pe() != null && ge(() => {
3608
+ a?.dispose();
3609
+ }), {
3610
+ id: x(() => i.value.id),
3611
+ status: n,
3612
+ messages: t,
3613
+ error: r,
3614
+ addToolApprovalResponse: (e) => i.value.addToolApprovalResponse(e),
3615
+ addToolOutput: (e) => i.value.addToolOutput(e),
3616
+ clearError: () => i.value.clearError(),
3617
+ regenerate: (e) => i.value.regenerate(e),
3618
+ sendMessage: (...e) => i.value.sendMessage(...e),
3619
+ stop: () => i.value.stop(),
3620
+ resumeStream: (e) => i.value.resumeStream(e)
3621
+ };
3622
+ }
3623
+ //#endregion
3624
+ //#region ../../packages/composable/src/chatbot/useChatbotStore.ts
3625
+ var Gr = "voice-", Kr = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), qr = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Jr = (e) => qr(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Yr = 8, Xr = (e, t) => {
3549
3626
  let n = e.filter((e) => e.role === "user").map((e) => ({
3550
- text: Ur(e),
3627
+ text: Jr(e),
3551
3628
  taken: !1
3552
3629
  }));
3553
3630
  return t.filter((e) => {
3554
3631
  if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
3555
- let t = Ur(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Wr && t.endsWith(e.text)));
3632
+ let t = Jr(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Yr && t.endsWith(e.text)));
3556
3633
  return !r || (r.taken = !0, !1);
3557
3634
  });
3558
- }, Kr = (e) => {
3635
+ }, Zr = 12e4, Qr = 1e3, $r = (e) => {
3559
3636
  let t = e.type ?? "";
3560
3637
  return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
3561
- }, qr = ({ messages: e }) => {
3638
+ }, ei = ({ messages: e }) => {
3562
3639
  let t = e[e.length - 1];
3563
3640
  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 ?? ""));
3641
+ let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && (y($r(e)) || ee(e)));
3642
+ return r.length > 0 && r.every((e) => oe.has(e.state ?? ""));
3566
3643
  };
3567
- function Jr(e) {
3644
+ function ti(e) {
3568
3645
  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(() => {
3646
+ let { t, te: n, locale: r } = xe({ useScope: "global" }), i = S(""), a = S(), o = S(e), s = S(), c = S(), l = S(), u = S(), d = S(), f = S(), p = S(), m = S(), h = S(), g = S(), _ = S(), v = S(), y = S(), b = S(), te = S(), ie = S(), oe = C(), pe = S(0), me = S(), ge = C(), ve = C(), ye = S(), Ce = S(!1), De = S(0), je = S(), Me = S(!1), T = Se(), Ne = x(() => {
3570
3647
  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) => ![
3648
+ return (!e || e === "auto") && (e = je.value), e ? e === "dark" : T.value;
3649
+ }), E = x(() => c.value === "reasoning"), Pe = x(() => E.value ? g.value?.filter((e) => ![
3573
3650
  "upvote",
3574
3651
  "downvote",
3575
3652
  "feedback"
3576
- ].includes(e)) : g.value), Fe = pe(b(() => `${o.value}-chatId`), null);
3653
+ ].includes(e)) : g.value), Fe = fe(x(() => `${o.value}-chatId`), null);
3577
3654
  be(() => {
3578
- Fe.value ||= I();
3655
+ Fe.value ||= L();
3579
3656
  });
3580
- let T = b({
3657
+ let D = x({
3581
3658
  get: () => Fe.value,
3582
3659
  set: (e) => {
3583
3660
  Fe.value = e;
3584
3661
  }
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;
3662
+ }), O = de(x(() => `${o.value}-pageAccessOff`), !1), Ie = x(() => O.value ? [] : ge.value ?? []), Le = () => O.value ? [] : ve.value?.() ?? [], Re = x(() => !!(me.value && ge.value?.length)), ze = fe(x(() => `${o.value}-pageNotice`), null), Be = x(() => {
3663
+ let e = me.value?.level;
3664
+ return e && e !== ae.Off && Ie.value.length && !ne(ze.value ?? void 0, e) ? e : void 0;
3588
3665
  });
3589
3666
  function Ve() {
3590
- ze.value = he.value?.level ?? null;
3667
+ ze.value = me.value?.level ?? null;
3591
3668
  }
3592
- let D = x(), O = x(!1), He = b(() => D.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3593
- function Ue(e) {
3669
+ let He = S(), Ue = S(!1), We = x(() => He.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3670
+ function Ge(e) {
3594
3671
  try {
3595
3672
  let t = JSON.parse(e.message);
3596
3673
  return t.status === 404 || t.type?.includes("entity-not-found");
@@ -3598,29 +3675,31 @@ function Jr(e) {
3598
3675
  return !1;
3599
3676
  }
3600
3677
  }
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);
3678
+ function Ke(e) {
3679
+ if (Ge(e)) {
3680
+ let e = P.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ue(t) : void 0;
3681
+ D.value = L(), He.value = void 0, he(() => {
3682
+ P.value.clearError(), n && P.value.sendMessage({ text: n });
3683
+ });
3684
+ } else ce.error(e), He.value = e, We.value && (Ue.value = !0);
3606
3685
  }
3607
- let k = b(() => ce({
3686
+ let k = x(() => se({
3608
3687
  baseUrl: i.value,
3609
3688
  basePath: a.value,
3610
3689
  headers: () => p.value
3611
- })), Ge = x(null), Ke = () => ({
3690
+ })), qe = S(null), Je = () => ({
3612
3691
  ...we(),
3613
- ...Ge.value ?? {}
3614
- }), qe = () => {
3692
+ ...qe.value ?? {}
3693
+ }), Ye = () => {
3615
3694
  let e = De.value;
3616
3695
  return new Promise((t) => {
3617
3696
  let n = setTimeout(() => {
3618
3697
  r(), t(!1);
3619
- }, 3e4), r = S(() => [De.value, M.value.status], ([i, a]) => {
3698
+ }, 3e4), r = w(() => [De.value, P.value.status], ([i, a]) => {
3620
3699
  i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
3621
3700
  });
3622
3701
  });
3623
- }, A = ve(), Je = (e, t) => new Promise((n) => {
3702
+ }, A = C(), Xe = (e, t) => new Promise((n) => {
3624
3703
  A.value?.answer(!1), A.value = {
3625
3704
  toolCallId: e.toolCallId,
3626
3705
  question: t,
@@ -3629,21 +3708,21 @@ function Jr(e) {
3629
3708
  }
3630
3709
  };
3631
3710
  });
3632
- function Ye(e) {
3711
+ function Ze(e) {
3633
3712
  A.value?.answer(e);
3634
3713
  }
3635
- let Xe = Ae({
3714
+ let Qe = Ae({
3636
3715
  registry: () => [
3637
- ...(se.value ?? []).filter((e) => !ee(e.name)),
3716
+ ...(oe.value ?? []).filter((e) => !re(e.name)),
3638
3717
  ...Ie.value,
3639
3718
  ...Le()
3640
3719
  ],
3641
- capability: () => ae.value,
3642
- addToolOutput: (e) => void M.value.addToolOutput(e),
3643
- confirm: Je,
3644
- waitForResume: qe,
3720
+ capability: () => ie.value,
3721
+ addToolOutput: (e) => void P.value.addToolOutput(e),
3722
+ confirm: Xe,
3723
+ waitForResume: Ye,
3645
3724
  onPendingChange: (e) => {
3646
- me.value = e;
3725
+ pe.value = e;
3647
3726
  },
3648
3727
  onActivity: (e) => {
3649
3728
  if (e?.provider !== "page" || e.readOnly) {
@@ -3654,20 +3733,21 @@ function Jr(e) {
3654
3733
  ye.value = { title: t?.annotations?.title ?? e.toolName }, Ce.value = !0;
3655
3734
  }
3656
3735
  });
3657
- async function Ze() {
3658
- j(), ye.value = void 0, Ce.value = !1, U.value = "", await M.value.stop();
3736
+ async function $e() {
3737
+ j(), ye.value = void 0, Ce.value = !1, G.value = "", await P.value.stop();
3659
3738
  }
3660
3739
  function j() {
3661
- Xe.cancelAll(), A.value?.answer(!1);
3740
+ Qe.cancelAll(), A.value?.answer(!1);
3662
3741
  }
3663
- async function Qe(e) {
3664
- E.value = e, e && await Ze();
3742
+ async function et(e) {
3743
+ O.value = e, e && await $e();
3665
3744
  }
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"),
3745
+ w(D, () => j(), { flush: "sync" });
3746
+ let M = !1, N, tt = Wr(() => ({
3747
+ id: D.value,
3748
+ transport: new mr({
3749
+ api: k.value.getChatEndpoint(o.value, E.value ? "reasoning" : "chat"),
3750
+ prepareReconnectToStreamRequest: ({ id: e }) => ({ api: k.value.getChatStreamEndpoint(o.value, e) }),
3671
3751
  prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
3672
3752
  id: t,
3673
3753
  messages: [e[e.length - 1]],
@@ -3682,13 +3762,13 @@ function Jr(e) {
3682
3762
  reasoning: d.value?.reasoning,
3683
3763
  webSearch: f.value?.webSearch,
3684
3764
  smoothStream: u.value?.smoothStream,
3685
- deviceContext: Ke(),
3686
- externalContext: re.value,
3765
+ deviceContext: Je(),
3766
+ externalContext: te.value,
3687
3767
  disabledTools: f.value?.disabled,
3688
3768
  fallbackModels: y.value,
3689
- gatewayOptions: ne.value,
3690
- hostTools: ke(se.value, ae.value),
3691
- pageTools: he.value && Ie.value.length ? {
3769
+ gatewayOptions: b.value,
3770
+ hostTools: ke(oe.value, ie.value),
3771
+ pageTools: me.value && Ie.value.length ? {
3692
3772
  version: 1,
3693
3773
  forms: Le().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3694
3774
  name: e,
@@ -3701,38 +3781,44 @@ function Jr(e) {
3701
3781
  credentials: "include",
3702
3782
  headers: () => p.value ?? {}
3703
3783
  }),
3704
- sendAutomaticallyWhen: (e) => qr(e) || mr(e),
3705
- onError: We,
3784
+ sendAutomaticallyWhen: (e) => ei(e) || gr(e),
3785
+ onError: (e) => {
3786
+ M ? ce.warn(e) : Ke(e);
3787
+ },
3706
3788
  onToolCall: ({ toolCall: e }) => {
3707
- if (!Oe(e)) return;
3789
+ if (!Oe(e) || M) return;
3708
3790
  let t = e;
3709
- Xe.enqueue({
3791
+ Qe.enqueue({
3710
3792
  toolCallId: t.toolCallId,
3711
3793
  toolName: t.toolName,
3712
3794
  input: t.input,
3713
- messageId: M.value.lastMessage?.id ?? "",
3795
+ messageId: nt()?.id ?? "",
3714
3796
  readOnly: t.toolMetadata?.readOnly === !0,
3715
3797
  provider: t.toolMetadata?.provider === "page" ? "page" : "app"
3716
3798
  });
3717
3799
  },
3718
3800
  onData: (e) => {
3719
- e.type === "data-audioTranscripts" && (M.value.messages = ue(M.value.messages, e.data));
3801
+ e.type === "data-audioTranscripts" && (P.value.messages = le(P.value.messages, e.data));
3720
3802
  },
3721
3803
  onFinish: () => {
3722
- let e = T.value;
3723
- !w.value && !N.value.some((t) => t.id === e) && dt(o.value);
3804
+ let e = D.value;
3805
+ !E.value && !R.value.some((t) => t.id === e) && ht(o.value);
3724
3806
  }
3725
- })), $e = b(() => {
3807
+ })), P = x(() => _e(tt)), nt = () => P.value.messages[P.value.messages.length - 1];
3808
+ w(D, () => {
3809
+ P.value.stop();
3810
+ }, { flush: "sync" });
3811
+ let rt = x(() => {
3726
3812
  let e = u.value?.initialMessage;
3727
3813
  return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
3728
- }), et = I(), tt = b(() => ({
3729
- id: et,
3814
+ }), it = L(), at = x(() => ({
3815
+ id: it,
3730
3816
  role: "assistant",
3731
3817
  parts: [{
3732
3818
  type: "text",
3733
- text: $e.value
3819
+ text: rt.value
3734
3820
  }]
3735
- })), nt = b(() => {
3821
+ })), F = x(() => {
3736
3822
  let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
3737
3823
  ...e,
3738
3824
  parts: e.parts.map((e) => {
@@ -3742,7 +3828,7 @@ function Jr(e) {
3742
3828
  let e = t.url.slice(13);
3743
3829
  return {
3744
3830
  ...t,
3745
- url: k.value.getMediaUrl(o.value, T.value, e)
3831
+ url: k.value.getMediaUrl(o.value, D.value, e)
3746
3832
  };
3747
3833
  }
3748
3834
  return t.url.startsWith("blob:") ? t : {
@@ -3750,70 +3836,99 @@ function Jr(e) {
3750
3836
  url: k.value.appendAuthToken(t.url)
3751
3837
  };
3752
3838
  })
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(() => {
3839
+ }), t = P.value.id === D.value ? P.value.messages : [];
3840
+ return E.value ? e(t) : !Me.value && t[0]?.role !== "assistant" ? [at.value, ...e(t)] : e(t);
3841
+ }), I = x(() => {
3756
3842
  let e = u.value?.messagePlaceholder;
3757
3843
  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 = [];
3844
+ }), R = S([]), ot = S(!1), z = S([]), st = S(!1), ct = S("chat"), B = S([]), V = S(), H = S(!1), lt = S(!1), ut = S(), dt = S(!1), U = S(!1), ft = S(), pt = S(""), W = S([]), G = S(""), mt = S(0);
3845
+ async function ht(e) {
3846
+ if (E.value) R.value = [];
3761
3847
  else {
3762
- it.value = !0;
3848
+ ot.value = !0;
3763
3849
  try {
3764
- N.value = await k.value.getConversations(e, l.value);
3850
+ R.value = await k.value.getConversations(e, l.value);
3765
3851
  } catch {
3766
- N.value = [];
3852
+ R.value = [];
3767
3853
  } finally {
3768
- it.value = !1;
3854
+ ot.value = !1;
3769
3855
  }
3770
3856
  }
3771
3857
  }
3772
- async function ft() {
3773
- let e = T.value;
3774
- if (!e) P.value = [];
3858
+ async function gt() {
3859
+ let e = D.value;
3860
+ if (!e) z.value = [];
3775
3861
  else {
3776
- F.value = !0;
3862
+ st.value = !0;
3777
3863
  try {
3778
- P.value = await k.value.getChatFiles(e);
3864
+ z.value = await k.value.getChatFiles(e);
3779
3865
  } catch {
3780
- P.value = [];
3866
+ z.value = [];
3781
3867
  } finally {
3782
- F.value = !1;
3868
+ st.value = !1;
3783
3869
  }
3784
3870
  }
3785
3871
  }
3786
- function pt(e, t = !1) {
3872
+ function _t(e, t = !1) {
3787
3873
  return k.value.getChatFileDownloadUrl(e, t);
3788
3874
  }
3789
- function mt(e) {
3875
+ function vt(e) {
3790
3876
  return k.value.getChatFilePreviewUrl(e);
3791
3877
  }
3792
- async function ht(e) {
3878
+ async function yt(e) {
3793
3879
  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));
3880
+ let t = z.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
3881
+ z.value = z.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
3796
3882
  }
3797
- async function gt(e, t) {
3798
- if (!w.value) try {
3883
+ async function bt(e, t) {
3884
+ if (!E.value) try {
3799
3885
  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));
3886
+ if (t !== D.value || P.value.status !== "ready" || P.value.messages.length > 0) return;
3887
+ n && (P.value.messages = n.messages, Ue.value = n.blocked ?? !1, xt(e, t, n.turnInProgress === !0));
3802
3888
  } catch {}
3803
3889
  }
3804
- async function _t(e, t) {
3890
+ async function xt(e, t, n) {
3891
+ n && (await St(t), t !== D.value || K()) || await Ct(e, t);
3892
+ }
3893
+ async function St(e) {
3894
+ let t = { chatId: e };
3895
+ N = t;
3896
+ let n = () => N === t && e === D.value, r = Date.now() + Zr;
3897
+ try {
3898
+ for (; n() && !K() && Date.now() < r;) {
3899
+ M = !0;
3900
+ try {
3901
+ await P.value.resumeStream();
3902
+ } finally {
3903
+ M = !1;
3904
+ }
3905
+ if (!n()) return;
3906
+ P.value.clearError();
3907
+ let t = await k.value.getChat(o.value, e).catch(() => null);
3908
+ if (!t || !n() || K()) return;
3909
+ if (!t.turnInProgress) {
3910
+ P.value.messages = t.messages;
3911
+ return;
3912
+ }
3913
+ await new Promise((e) => setTimeout(e, Qr));
3914
+ }
3915
+ } finally {
3916
+ N === t && (N = void 0);
3917
+ }
3918
+ }
3919
+ async function Ct(e, t) {
3805
3920
  let n;
3806
3921
  try {
3807
3922
  n = Number(sessionStorage.getItem(Ee)), sessionStorage.removeItem(Ee);
3808
3923
  } catch {
3809
3924
  return;
3810
3925
  }
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];
3926
+ if (!(!n || Date.now() - n > 6e4 || O.value)) for (let n = 0; n < 12; n++) {
3927
+ let n = P.value.messages[P.value.messages.length - 1];
3813
3928
  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);
3929
+ let e = n.parts.filter((e) => ee(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
3815
3930
  if (e.length > 0) {
3816
- if (t.length === e.length && !E.value) for (let e of t) Xe.enqueue({
3931
+ if (t.length === e.length && !O.value) for (let e of t) Qe.enqueue({
3817
3932
  toolCallId: e.toolCallId,
3818
3933
  toolName: e.toolName,
3819
3934
  input: e.input,
@@ -3825,250 +3940,252 @@ function Jr(e) {
3825
3940
  }
3826
3941
  if (n.parts[n.parts.length - 1]?.type === "text") return;
3827
3942
  }
3828
- if (await new Promise((e) => setTimeout(e, 1500)), t !== T.value || M.value.status !== "ready") return;
3943
+ if (await new Promise((e) => setTimeout(e, 1500)), t !== D.value || P.value.status !== "ready") return;
3829
3944
  try {
3830
3945
  let n = await k.value.getChat(e, t);
3831
- n && t === T.value && (M.value.messages = n.messages);
3946
+ n && t === D.value && (P.value.messages = n.messages);
3832
3947
  } catch {
3833
3948
  return;
3834
3949
  }
3835
3950
  }
3836
3951
  }
3837
- let vt = () => {
3838
- let e = M.value.status;
3952
+ let K = () => {
3953
+ let e = P.value.status;
3839
3954
  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;
3955
+ }, wt = 0, Tt = 0;
3956
+ async function Et() {
3957
+ if (E.value || K()) return "indeterminate";
3958
+ let e = D.value, t = wt += 1;
3844
3959
  try {
3845
3960
  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";
3961
+ if (!n || e !== D.value || K() || t <= Tt) return "indeterminate";
3962
+ Tt = t;
3963
+ let r = n.messages, i = Xr(r, P.value.messages);
3964
+ return P.value.messages = [...r, ...i], Ue.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3850
3965
  } catch {}
3851
3966
  return "indeterminate";
3852
3967
  }
3853
- function St(e) {
3854
- M.value.messages = [...M.value.messages, e];
3968
+ function Dt(e) {
3969
+ P.value.messages = [...P.value.messages, e];
3855
3970
  }
3856
- async function Ct(e) {
3971
+ async function q(e) {
3857
3972
  try {
3858
- L.value = await k.value.getMessageFeedbacks(e);
3973
+ B.value = await k.value.getMessageFeedbacks(e);
3859
3974
  } catch {
3860
- L.value = [];
3975
+ B.value = [];
3861
3976
  }
3862
3977
  }
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);
3978
+ function J(e) {
3979
+ let t = B.value.findIndex((t) => t.messageId === e.messageId);
3980
+ t >= 0 ? B.value[t] = e : B.value.push(e);
3866
3981
  }
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");
3982
+ function Ot(e) {
3983
+ let t = F.value, n = t.findIndex((t) => t.id === e.id), r = ue(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3869
3984
  return {
3870
- userQuestion: de(i ?? e) ?? "",
3985
+ userQuestion: ue(i ?? e) ?? "",
3871
3986
  assistantMessage: r
3872
3987
  };
3873
3988
  }
3874
- async function Tt(e, t) {
3989
+ async function kt(e, t) {
3875
3990
  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);
3991
+ bt(e, t),
3992
+ ht(e),
3993
+ q(t)
3994
+ ]), qe.value || Te((e, t) => k.value.reverseGeocode(e, t, r.value)).then((e) => {
3995
+ e && (qe.value = e);
3881
3996
  });
3882
3997
  }
3883
- async function Et() {
3884
- let e = V.value.trim(), t = H.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3998
+ async function At() {
3999
+ let e = pt.value.trim(), t = W.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3885
4000
  type: "file",
3886
4001
  mediaType: e.mediaSource.mimeType,
3887
4002
  url: e.localUrl,
3888
4003
  filename: e.mediaSource.name,
3889
4004
  providerMetadata: { "8bot": { media: e.mediaSource } }
3890
4005
  }));
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;
4006
+ E.value && F.value.length > 0 && await Lt(), j(), G.value = e, mt.value = P.value.messages.length;
4007
+ let n = P.value.sendMessage;
3893
4008
  n({
3894
4009
  text: e,
3895
4010
  files: t.length > 0 ? t : void 0
3896
- }), V.value = "", At();
4011
+ }), pt.value = "", It();
3897
4012
  }
3898
- function Dt(e) {
4013
+ function jt(e) {
3899
4014
  let t = e.trim();
3900
4015
  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.");
4016
+ if (P.value.status !== "ready") {
4017
+ ce.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
3903
4018
  return;
3904
4019
  }
3905
- let n = M.value.sendMessage;
4020
+ let n = P.value.sendMessage;
3906
4021
  j(), n({ text: t });
3907
4022
  }
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 = "");
4023
+ async function Mt() {
4024
+ let e = P.value.messages.slice(mt.value).some((e) => e.parts.some(ee)), t = G.value, n = t.length > 0 && !e, r = D.value, i = mt.value, a = N?.chatId === r;
4025
+ N = void 0, j(), await P.value.stop();
4026
+ let s = E.value || e && !a || await k.value.stopChatTurn(o.value, r).catch(() => !0);
4027
+ r !== D.value || K() || mt.value !== i || ((a || !s) && (await Et(), a || P.value.messages.length > mt.value) ? G.value = "" : n && (pt.value = t, P.value.messages = P.value.messages.slice(0, mt.value), G.value = ""));
3911
4028
  }
3912
- S(() => M.value.messages, (e) => {
4029
+ w(() => P.value.messages, (e) => {
3913
4030
  let t = A.value?.toolCallId;
3914
4031
  t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && j();
3915
- }), S(() => M.value.status, (e) => {
4032
+ }), w(() => P.value.status, (e) => {
3916
4033
  e === "submitted" && De.value++;
3917
4034
  });
3918
- let K;
3919
- S(() => [M.value.status, me.value], ([e, t]) => {
3920
- clearTimeout(K), e === "ready" && t === 0 && (K = setTimeout(() => {
4035
+ let Nt;
4036
+ w(() => [P.value.status, pe.value], ([e, t]) => {
4037
+ clearTimeout(Nt), e === "ready" && t === 0 && (Nt = setTimeout(() => {
3921
4038
  Ce.value = !1;
3922
4039
  }, 1500));
3923
4040
  });
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;
4041
+ let Pt = S(!1), Ft;
4042
+ w(() => !A.value && !Kr(nt()) && (K() || pe.value > 0), (e) => {
4043
+ clearTimeout(Ft), e ? Pt.value = !0 : Ft = setTimeout(() => {
4044
+ Pt.value = !1;
3928
4045
  }, 400);
3929
- }, { immediate: !0 }), S(() => M.value.status, (e) => {
3930
- e === "ready" && U.value.length > 0 && (U.value = "");
4046
+ }, { immediate: !0 }), w(() => P.value.status, (e) => {
4047
+ e === "ready" && G.value.length > 0 && (G.value = "");
3931
4048
  });
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;
4049
+ function It(e = !1) {
4050
+ for (let t of W.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4051
+ W.value = [], Kt.value = null;
3935
4052
  }
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;
4053
+ async function Lt() {
4054
+ return G.value = "", D.value = L(), await he(), P.value.clearError(), He.value = void 0, Ue.value = !1, It(!0), nn("chat"), D.value;
3938
4055
  }
3939
- async function Mt(e) {
3940
- M.value.status !== "ready" && (U.value = "", await G()), j(), await M.value.regenerate(e);
4056
+ async function Rt(e) {
4057
+ P.value.status !== "ready" && (G.value = "", await Mt()), j(), await P.value.regenerate(e);
3941
4058
  }
3942
- function Nt(e) {
4059
+ function zt(e) {
3943
4060
  if (e.tool === "requestGeolocation") {
3944
4061
  let t = e.output;
3945
- "latitude" in t && (Ge.value = {
4062
+ "latitude" in t && (qe.value = {
3946
4063
  geolocationLatitude: t.latitude,
3947
4064
  geolocationLongitude: t.longitude,
3948
4065
  geolocationAccuracy: t.accuracy,
3949
4066
  geolocationCity: t.city
3950
4067
  });
3951
4068
  }
3952
- M.value.addToolOutput(e);
4069
+ P.value.addToolOutput(e);
3953
4070
  }
3954
- function Pt(e) {
3955
- M.value.addToolApprovalResponse(e);
4071
+ function Bt(e) {
4072
+ P.value.addToolApprovalResponse(e);
3956
4073
  }
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;
4074
+ let Vt = x(() => P.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Ht = x(() => _.value?.maxFilesPerMessage ?? 5), Ut = x(() => _.value?.maxFilesPerChat ?? 20), Wt = x(() => Math.max(0, Math.min(Ht.value - W.value.length, Ut.value - Vt.value - W.value.length))), Gt = x(() => Wt.value <= 0), Kt = S(null), qt = () => {
4075
+ Kt.value = null;
3959
4076
  };
3960
- S(zt, (e) => {
3961
- e || (Bt.value = null);
4077
+ w(Gt, (e) => {
4078
+ e || (Kt.value = null);
3962
4079
  });
3963
- async function Ht(e) {
3964
- if (zt.value) {
3965
- Bt.value = Lt.value - Ft.value - H.value.length <= It.value - H.value.length ? {
4080
+ async function Jt(e) {
4081
+ if (Gt.value) {
4082
+ Kt.value = Ut.value - Vt.value - W.value.length <= Ht.value - W.value.length ? {
3966
4083
  reason: "per-chat",
3967
- max: Lt.value
4084
+ max: Ut.value
3968
4085
  } : {
3969
4086
  reason: "per-message",
3970
- max: It.value
4087
+ max: Ht.value
3971
4088
  };
3972
4089
  return;
3973
4090
  }
3974
- let t = I(), n = {
4091
+ let t = L(), n = {
3975
4092
  id: t,
3976
4093
  file: e,
3977
4094
  localUrl: URL.createObjectURL(e),
3978
4095
  state: "uploading"
3979
4096
  };
3980
- H.value = [...H.value, n];
4097
+ W.value = [...W.value, n];
3981
4098
  try {
3982
- let n = await k.value.uploadMedia(o.value, T.value, e);
3983
- H.value = H.value.map((e) => e.id === t ? {
4099
+ let n = await k.value.uploadMedia(o.value, D.value, e);
4100
+ W.value = W.value.map((e) => e.id === t ? {
3984
4101
  ...e,
3985
4102
  state: "done",
3986
4103
  mediaSource: n
3987
4104
  } : e);
3988
4105
  } catch (e) {
3989
4106
  let n = e instanceof Error ? e.message : "Upload failed";
3990
- H.value = H.value.map((e) => e.id === t ? {
4107
+ W.value = W.value.map((e) => e.id === t ? {
3991
4108
  ...e,
3992
4109
  state: "error",
3993
4110
  error: n
3994
4111
  } : e);
3995
4112
  }
3996
4113
  }
3997
- async function Ut(e, t) {
3998
- let { userQuestion: n, assistantMessage: r } = wt(e);
3999
- W(await k.value.submitMessageFeedback({
4114
+ async function Yt(e, t) {
4115
+ let { userQuestion: n, assistantMessage: r } = Ot(e);
4116
+ J(await k.value.submitMessageFeedback({
4000
4117
  messageId: e.id,
4001
- chatId: T.value,
4118
+ chatId: D.value,
4002
4119
  agentId: o.value,
4003
4120
  vote: t,
4004
4121
  userQuestion: n,
4005
4122
  assistantMessage: r
4006
4123
  }));
4007
4124
  }
4008
- async function Wt(e) {
4009
- await Ut(e, "upvote");
4125
+ async function Xt(e) {
4126
+ await Yt(e, "upvote");
4010
4127
  }
4011
- async function Gt(e) {
4012
- await Ut(e, "downvote");
4128
+ async function Zt(e) {
4129
+ await Yt(e, "downvote");
4013
4130
  }
4014
- function Kt(e) {
4015
- st.value = !1, ct.value = void 0, R.value = e;
4131
+ function Y(e) {
4132
+ lt.value = !1, ut.value = void 0, V.value = e;
4016
4133
  }
4017
- async function qt(e) {
4018
- if (R.value) try {
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,
4134
+ async function Qt(e) {
4135
+ if (V.value) try {
4136
+ H.value = !0, lt.value = !1, ut.value = void 0;
4137
+ let { userQuestion: t, assistantMessage: n } = Ot(V.value);
4138
+ J(await k.value.submitMessageFeedback({
4139
+ messageId: V.value.id,
4140
+ chatId: D.value,
4024
4141
  agentId: o.value,
4025
4142
  userQuestion: t,
4026
4143
  assistantMessage: n,
4027
4144
  comment: e
4028
- })), st.value = !0, await Ct(T.value);
4145
+ })), lt.value = !0, await q(D.value);
4029
4146
  } catch {
4030
- ct.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4147
+ ut.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4031
4148
  } finally {
4032
- ot.value = !1;
4149
+ H.value = !1;
4033
4150
  }
4034
4151
  }
4035
- async function Jt(e) {
4152
+ async function $t(e) {
4036
4153
  try {
4037
- B.value = !0, z.value = !1, lt.value = void 0, await k.value.submitLead({
4154
+ U.value = !0, dt.value = !1, ft.value = void 0, await k.value.submitLead({
4038
4155
  agentId: o.value,
4039
- chatId: T.value,
4156
+ chatId: D.value,
4040
4157
  ...e
4041
- }), z.value = !0;
4158
+ }), dt.value = !0;
4042
4159
  } catch {
4043
- lt.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4160
+ ft.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4044
4161
  } finally {
4045
- B.value = !1;
4162
+ U.value = !1;
4046
4163
  }
4047
4164
  }
4048
- async function Yt(e, t) {
4165
+ async function en(e, t) {
4049
4166
  let n = await k.value.updateChatTitle(o.value, e, t);
4050
- N.value = N.value.map((t) => t.id === e ? {
4167
+ R.value = R.value.map((t) => t.id === e ? {
4051
4168
  ...t,
4052
4169
  title: n.title
4053
4170
  } : t);
4054
4171
  }
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();
4172
+ async function tn(e) {
4173
+ await k.value.deleteChat(o.value, e), R.value = R.value.filter((t) => t.id !== e), D.value === e && await Lt();
4057
4174
  }
4058
- function Zt(e) {
4059
- at.value = e;
4175
+ function nn(e) {
4176
+ ct.value = e;
4060
4177
  }
4061
- let q;
4062
- function Qt(e) {
4178
+ let rn;
4179
+ function an(e) {
4063
4180
  let t = () => k.value.getChat(o.value, e).then((e) => e !== null);
4064
4181
  return t().catch(() => t().catch(() => !1));
4065
4182
  }
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 = ""));
4183
+ return w(l, async (e) => {
4184
+ if (!e || e === rn) return;
4185
+ let t = rn;
4186
+ if (rn = e, t === void 0) return;
4187
+ let n = D.value, r = !E.value && await an(n);
4188
+ l.value === e && D.value === n && (r ? ht(o.value) : (R.value = [], B.value = [], z.value = [], await Lt(), pt.value = ""));
4072
4189
  }), {
4073
4190
  apiClient: k,
4074
4191
  baseUrl: i,
@@ -4088,82 +4205,82 @@ function Jr(e) {
4088
4205
  agentFileUpload: _,
4089
4206
  agentVoice: v,
4090
4207
  fallbackModels: y,
4091
- gatewayOptions: ne,
4092
- externalContext: re,
4093
- agentHostTools: ae,
4094
- hostToolRegistry: se,
4095
- hostToolsPending: me,
4096
- agentPageAccess: he,
4208
+ gatewayOptions: b,
4209
+ externalContext: te,
4210
+ agentHostTools: ie,
4211
+ hostToolRegistry: oe,
4212
+ hostToolsPending: pe,
4213
+ agentPageAccess: me,
4097
4214
  pageToolRegistry: ge,
4098
- pageFormsProvider: _e,
4215
+ pageFormsProvider: ve,
4099
4216
  pageAction: ye,
4100
4217
  pageControlActive: Ce,
4101
- isWorking: Ot,
4102
- stopHostActions: Ze,
4218
+ isWorking: Pt,
4219
+ stopHostActions: $e,
4103
4220
  pageNoticeLevel: Be,
4104
4221
  closePageNotice: Ve,
4105
4222
  hostConfirmation: A,
4106
- respondHostConfirmation: Ye,
4223
+ respondHostConfirmation: Ze,
4107
4224
  pageAccessAvailable: Re,
4108
- pageAccessOff: E,
4109
- setPageAccessOff: Qe,
4225
+ pageAccessOff: O,
4226
+ setPageAccessOff: et,
4110
4227
  systemTheme: je,
4111
4228
  hideWelcomeMessage: Me,
4112
4229
  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,
4130
- isFeedbackSubmitting: ot,
4131
- isFeedbackSubmitted: st,
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
4230
+ chat: P,
4231
+ messages: F,
4232
+ conversations: R,
4233
+ isLoadingConversations: ot,
4234
+ chatFiles: z,
4235
+ isLoadingChatFiles: st,
4236
+ input: pt,
4237
+ pendingAttachments: W,
4238
+ isAttachmentLimitReached: Gt,
4239
+ fileLimitError: Kt,
4240
+ localChatId: D,
4241
+ isConversationBlocked: Ue,
4242
+ inputMessagePlaceholder: I,
4243
+ chatError: He,
4244
+ activeView: ct,
4245
+ messageFeedbacks: B,
4246
+ feedbackDialogMessage: V,
4247
+ isFeedbackSubmitting: H,
4248
+ isFeedbackSubmitted: lt,
4249
+ feedbackSubmitError: ut,
4250
+ isLeadSubmitted: dt,
4251
+ isLoadingSubmitLead: U,
4252
+ submitLeadError: ft,
4253
+ buildDeviceContext: Je,
4254
+ initialize: kt,
4255
+ loadConversations: ht,
4256
+ loadChatFiles: gt,
4257
+ refreshMessages: Et,
4258
+ appendMessage: Dt,
4259
+ getChatFileUrl: _t,
4260
+ getChatFilePreviewUrl: vt,
4261
+ deleteChatFile: yt,
4262
+ handleSubmit: At,
4263
+ sendMessage: jt,
4264
+ stopGeneration: Mt,
4265
+ startNewChat: Lt,
4266
+ regenerate: Rt,
4267
+ addToolOutput: zt,
4268
+ addToolApprovalResponse: Bt,
4269
+ handleFileSelect: Jt,
4270
+ clearFileLimitError: qt,
4271
+ clearPendingAttachments: It,
4272
+ onUpvote: Xt,
4273
+ onDownvote: Zt,
4274
+ onFeedback: Y,
4275
+ onFeedbackSubmit: Qt,
4276
+ onLeadSubmit: $t,
4277
+ navigate: nn,
4278
+ renameChatTitle: en,
4279
+ deleteChat: tn
4163
4280
  };
4164
4281
  })();
4165
4282
  }
4166
4283
  //#endregion
4167
- export { I as a, fr as i, Jr as n, zr as r, Br as t };
4284
+ export { L as a, mr as i, ti as n, Wr as r, Gr as t };
4168
4285
 
4169
- //# sourceMappingURL=useChatbotStore-BQTq8fq-.js.map
4286
+ //# sourceMappingURL=useChatbotStore-BlIWevWi.js.map