@8wave/ai-elements 0.102.0 → 0.103.0-beta.3

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 (75) hide show
  1. package/dist/_chunks/{Agent-Cq-9OZHI.js → Agent-hWgZhu7L.js} +99 -100
  2. package/dist/_chunks/{Agent-Cq-9OZHI.js.map → Agent-hWgZhu7L.js.map} +1 -1
  3. package/dist/_chunks/{PkToolRequestGeolocation-hAaQJW-t.js → PkToolRequestGeolocation-T16QI-Uv.js} +2 -2
  4. package/dist/_chunks/{PkToolRequestGeolocation-hAaQJW-t.js.map → PkToolRequestGeolocation-T16QI-Uv.js.map} +1 -1
  5. package/dist/_chunks/PkToolRequestOAuthConnection-C8e5np2q.js +116 -0
  6. package/dist/_chunks/PkToolRequestOAuthConnection-C8e5np2q.js.map +1 -0
  7. package/dist/_chunks/{PkToolShowForm-CdUUAjPc.js → PkToolShowForm-ztQFyFd9.js} +2 -2
  8. package/dist/_chunks/{PkToolShowForm-CdUUAjPc.js.map → PkToolShowForm-ztQFyFd9.js.map} +1 -1
  9. package/dist/_chunks/{PkToolShowSuggestedReply-BvHgjMQ4.js → PkToolShowSuggestedReply-Dqe4gtEY.js} +2 -2
  10. package/dist/_chunks/{PkToolShowSuggestedReply-BvHgjMQ4.js.map → PkToolShowSuggestedReply-Dqe4gtEY.js.map} +1 -1
  11. package/dist/_chunks/web-BMnEaWK7.js +20226 -0
  12. package/dist/_chunks/web-BMnEaWK7.js.map +1 -0
  13. package/dist/ai-elements.es.js +4443 -24347
  14. package/dist/ai-elements.es.js.map +1 -1
  15. package/dist-vue/PkChatbot.js +1 -1
  16. package/dist-vue/PkChatbotMessages.js +1 -1
  17. package/dist-vue/PkChatbotViewChat.js +1 -1
  18. package/dist-vue/PkChatbotViewConversations.js +1 -1
  19. package/dist-vue/PkChatbotViewFiles.js +1 -1
  20. package/dist-vue/PkChatbotViewProfile.js +1 -1
  21. package/dist-vue/_chunks/{Agent-Cy-XE9N1.js → Agent-CGp48ayw.js} +62 -63
  22. package/dist-vue/_chunks/{Agent-Cy-XE9N1.js.map → Agent-CGp48ayw.js.map} +1 -1
  23. package/dist-vue/_chunks/{Document-B6xVkCfQ.js → Document-CjfNDh6w.js} +15 -15
  24. package/dist-vue/_chunks/{Document-B6xVkCfQ.js.map → Document-CjfNDh6w.js.map} +1 -1
  25. package/dist-vue/_chunks/{PkChatbot-CHe6t-LR.js → PkChatbot-DZ6TaZHh.js} +6 -6
  26. package/dist-vue/_chunks/{PkChatbot-CHe6t-LR.js.map → PkChatbot-DZ6TaZHh.js.map} +1 -1
  27. package/dist-vue/_chunks/PkChatbotMessages-BgsyN-mB.js +771 -0
  28. package/dist-vue/_chunks/PkChatbotMessages-BgsyN-mB.js.map +1 -0
  29. package/dist-vue/_chunks/PkChatbotViewChat-0g30_sQH.js +802 -0
  30. package/dist-vue/_chunks/PkChatbotViewChat-0g30_sQH.js.map +1 -0
  31. package/dist-vue/_chunks/{PkChatbotViewConversations-DXwqumyn.js → PkChatbotViewConversations-p72SEhU-.js} +2 -2
  32. package/dist-vue/_chunks/{PkChatbotViewConversations-DXwqumyn.js.map → PkChatbotViewConversations-p72SEhU-.js.map} +1 -1
  33. package/dist-vue/_chunks/{PkChatbotViewFiles-B4u87oH6.js → PkChatbotViewFiles-C2PUVFV2.js} +3 -3
  34. package/dist-vue/_chunks/{PkChatbotViewFiles-B4u87oH6.js.map → PkChatbotViewFiles-C2PUVFV2.js.map} +1 -1
  35. package/dist-vue/_chunks/{PkChatbotViewProfile-C_A0AP8x.js → PkChatbotViewProfile-BqWLlla-.js} +2 -2
  36. package/dist-vue/_chunks/{PkChatbotViewProfile-C_A0AP8x.js.map → PkChatbotViewProfile-BqWLlla-.js.map} +1 -1
  37. package/dist-vue/_chunks/{PkToolRequestGeolocation-CaHo_418.js → PkToolRequestGeolocation-CsQghLEb.js} +2 -2
  38. package/dist-vue/_chunks/{PkToolRequestGeolocation-CaHo_418.js.map → PkToolRequestGeolocation-CsQghLEb.js.map} +1 -1
  39. package/dist-vue/_chunks/PkToolRequestOAuthConnection-D5Jq6UZh.js +116 -0
  40. package/dist-vue/_chunks/PkToolRequestOAuthConnection-D5Jq6UZh.js.map +1 -0
  41. package/dist-vue/_chunks/{PkToolShowDiagram-CuQyY0uv.js → PkToolShowDiagram-DoklcF3f.js} +2 -2
  42. package/dist-vue/_chunks/{PkToolShowDiagram-CuQyY0uv.js.map → PkToolShowDiagram-DoklcF3f.js.map} +1 -1
  43. package/dist-vue/_chunks/{PkToolShowForm-vXgu3bZO.js → PkToolShowForm-CpY1KKUt.js} +2 -2
  44. package/dist-vue/_chunks/{PkToolShowForm-vXgu3bZO.js.map → PkToolShowForm-CpY1KKUt.js.map} +1 -1
  45. package/dist-vue/_chunks/{PkToolShowSources-Die_j1bn.js → PkToolShowSources-CLsbqcDd.js} +2 -2
  46. package/dist-vue/_chunks/{PkToolShowSources-Die_j1bn.js.map → PkToolShowSources-CLsbqcDd.js.map} +1 -1
  47. package/dist-vue/_chunks/{PkToolShowSuggestedReply-CryAdy6t.js → PkToolShowSuggestedReply-B-QwwART.js} +2 -2
  48. package/dist-vue/_chunks/{PkToolShowSuggestedReply-CryAdy6t.js.map → PkToolShowSuggestedReply-B-QwwART.js.map} +1 -1
  49. package/dist-vue/_chunks/{createChatbotApiClient-CoTSUkuj.js → createChatbotApiClient-nOLu9GAQ.js} +32 -28
  50. package/dist-vue/_chunks/{createChatbotApiClient-CoTSUkuj.js.map → createChatbotApiClient-nOLu9GAQ.js.map} +1 -1
  51. package/dist-vue/_chunks/{useChatbotStore-BcLvyaIV.js → useChatbotStore-DhWHlZwO.js} +756 -783
  52. package/dist-vue/_chunks/{useChatbotStore-BcLvyaIV.js.map → useChatbotStore-DhWHlZwO.js.map} +1 -1
  53. package/dist-vue/_chunks/{PkChatbotViewChat-DeeGCFJf.js → web-BMnEaWK7.js} +3873 -4335
  54. package/dist-vue/_chunks/web-BMnEaWK7.js.map +1 -0
  55. package/dist-vue/api.js +1 -1
  56. package/dist-vue/composables.js +2 -2
  57. package/dist-vue/index.js +301 -301
  58. package/dist-vue/index.js.map +1 -1
  59. package/dist-vue/locales.js +6 -2
  60. package/dist-vue/packages/components/src/chat/PkToolRequestOAuthConnection.d.ts +4 -0
  61. package/dist-vue/packages/components/src/chat/useVoiceSession.d.ts +0 -7
  62. package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +4 -0
  63. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +6 -14
  64. package/dist-vue/packages/models/src/schema/Agent.d.ts +12 -5
  65. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +2 -2
  66. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +2 -2
  67. package/dist-vue/style.css +1 -1
  68. package/package.json +1 -1
  69. package/dist/_chunks/PkToolRequestOAuthConnection-Bf_zoT2r.js +0 -73
  70. package/dist/_chunks/PkToolRequestOAuthConnection-Bf_zoT2r.js.map +0 -1
  71. package/dist-vue/_chunks/PkChatbotMessages-CWPSx2ce.js +0 -770
  72. package/dist-vue/_chunks/PkChatbotMessages-CWPSx2ce.js.map +0 -1
  73. package/dist-vue/_chunks/PkChatbotViewChat-DeeGCFJf.js.map +0 -1
  74. package/dist-vue/_chunks/PkToolRequestOAuthConnection-URjYDFhm.js +0 -73
  75. package/dist-vue/_chunks/PkToolRequestOAuthConnection-URjYDFhm.js.map +0 -1
@@ -1,15 +1,15 @@
1
1
  import { C as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, v as g, w as _, y as ee } from "./schemas-COkEQ0wM.js";
2
- import { D as te, y as ne } from "./Agent-Cy-XE9N1.js";
3
- import { r as re, t as ie } from "./createChatbotApiClient-CoTSUkuj.js";
4
- import { t as ae } from "./src-BbpxM17m.js";
5
- import { n as oe } from "./message-RohfrdWS.js";
6
- import { t as se } from "./useSafeLocalStorage-D5Aa7nQY.js";
7
- import { computed as v, getCurrentScope as ce, isReadonly as le, onScopeDispose as ue, reactive as de, ref as y, toRefs as b, watch as fe, watchEffect as pe } from "vue";
2
+ import { E as te } from "./Agent-CGp48ayw.js";
3
+ import { r as ne, t as re } from "./createChatbotApiClient-nOLu9GAQ.js";
4
+ import { t as ie } from "./src-BbpxM17m.js";
5
+ import { n as ae } from "./message-RohfrdWS.js";
6
+ import { t as oe } from "./useSafeLocalStorage-D5Aa7nQY.js";
7
+ import { computed as v, getCurrentScope as se, isReadonly as ce, onScopeDispose as le, reactive as ue, ref as y, toRefs as de, watch as fe, watchEffect as pe } from "vue";
8
8
  import { useI18n as me } from "vue-i18n";
9
9
  import { usePreferredDark as he } from "@vueuse/core";
10
- import { defineStore as ge } from "pinia";
10
+ import { defineStore as b } from "pinia";
11
11
  //#region ../../packages/utils/src/device-context.ts
12
- function _e() {
12
+ function ge() {
13
13
  let e = navigator.connection, t = navigator.userAgentData;
14
14
  return {
15
15
  dateTime: (/* @__PURE__ */ new Date()).toISOString(),
@@ -39,7 +39,7 @@ function _e() {
39
39
  historyLength: window.history.length
40
40
  };
41
41
  }
42
- async function ve(e) {
42
+ async function _e(e) {
43
43
  if (!navigator.geolocation || !navigator.permissions) return null;
44
44
  try {
45
45
  if ((await navigator.permissions.query({ name: "geolocation" })).state !== "granted") return null;
@@ -58,12 +58,12 @@ async function ve(e) {
58
58
  }
59
59
  //#endregion
60
60
  //#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.7/node_modules/@ai-sdk/provider/dist/index.js
61
- var ye = "vercel.ai.error", x = Symbol.for(ye), S, C, w = class e extends (C = Error, S = x, C) {
61
+ var ve = "vercel.ai.error", ye = Symbol.for(ve), x, S, C = class e extends (S = Error, x = ye, S) {
62
62
  constructor({ name: e, message: t, cause: n }) {
63
- super(t), this[S] = !0, this.name = e, this.cause = n;
63
+ super(t), this[x] = !0, this.name = e, this.cause = n;
64
64
  }
65
65
  static isInstance(t) {
66
- return e.hasMarker(t, ye);
66
+ return e.hasMarker(t, ve);
67
67
  }
68
68
  static hasMarker(e, t) {
69
69
  let n = Symbol.for(t);
@@ -73,7 +73,7 @@ var ye = "vercel.ai.error", x = Symbol.for(ye), S, C, w = class e extends (C = E
73
73
  function be(e) {
74
74
  return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
75
75
  }
76
- var xe = "AI_InvalidArgumentError", T = `vercel.ai.error.${xe}`, Se = Symbol.for(T), Ce, E, we = class extends (E = w, Ce = Se, E) {
76
+ var xe = "AI_InvalidArgumentError", Se = `vercel.ai.error.${xe}`, w = Symbol.for(Se), Ce, we, T = class extends (we = C, Ce = w, we) {
77
77
  constructor({ message: e, cause: t, argument: n }) {
78
78
  super({
79
79
  name: xe,
@@ -82,9 +82,9 @@ var xe = "AI_InvalidArgumentError", T = `vercel.ai.error.${xe}`, Se = Symbol.for
82
82
  }), this[Ce] = !0, this.argument = n;
83
83
  }
84
84
  static isInstance(e) {
85
- return w.hasMarker(e, T);
85
+ return C.hasMarker(e, Se);
86
86
  }
87
- }, Te = "AI_JSONParseError", Ee = `vercel.ai.error.${Te}`, De = Symbol.for(Ee), Oe, D, ke = class extends (D = w, Oe = De, D) {
87
+ }, Te = "AI_JSONParseError", Ee = `vercel.ai.error.${Te}`, De = Symbol.for(Ee), Oe, ke, E = class extends (ke = C, Oe = De, ke) {
88
88
  constructor({ text: e, cause: t }) {
89
89
  super({
90
90
  name: Te,
@@ -94,9 +94,9 @@ Error message: ${be(t)}`,
94
94
  }), this[Oe] = !0, this.text = e;
95
95
  }
96
96
  static isInstance(e) {
97
- return w.hasMarker(e, Ee);
97
+ return C.hasMarker(e, Ee);
98
98
  }
99
- }, O = "AI_TypeValidationError", Ae = `vercel.ai.error.${O}`, je = Symbol.for(Ae), k, A, j = class e extends (A = w, k = je, A) {
99
+ }, Ae = "AI_TypeValidationError", D = `vercel.ai.error.${Ae}`, je = Symbol.for(D), Me, O, k = class e extends (O = C, Me = je, O) {
100
100
  constructor({ value: e, cause: t, context: n }) {
101
101
  let r = "Type validation failed";
102
102
  if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
@@ -105,14 +105,14 @@ Error message: ${be(t)}`,
105
105
  n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
106
106
  }
107
107
  super({
108
- name: O,
108
+ name: Ae,
109
109
  message: `${r}: Value: ${JSON.stringify(e)}.
110
110
  Error message: ${be(t)}`,
111
111
  cause: t
112
- }), this[k] = !0, this.value = e, this.context = n;
112
+ }), this[Me] = !0, this.value = e, this.context = n;
113
113
  }
114
114
  static isInstance(e) {
115
- return w.hasMarker(e, Ae);
115
+ return C.hasMarker(e, D);
116
116
  }
117
117
  static wrap({ value: t, cause: n, context: r }) {
118
118
  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({
@@ -121,15 +121,15 @@ Error message: ${be(t)}`,
121
121
  context: r
122
122
  });
123
123
  }
124
- }, M = class extends Error {
124
+ }, Ne = class extends Error {
125
125
  constructor(e, t) {
126
126
  super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
127
127
  }
128
- }, Me = 10, Ne = 13, N = 32;
129
- function Pe(e) {}
130
- function Fe(e) {
128
+ }, Pe = 10, Fe = 13, A = 32;
129
+ function j(e) {}
130
+ function Ie(e) {
131
131
  if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
132
- let { onEvent: t = Pe, onError: n = Pe, onRetry: r = Pe, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
132
+ let { onEvent: t = j, onError: n = j, onRetry: r = j, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
133
133
  function m(e) {
134
134
  if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
135
135
  if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
@@ -148,7 +148,7 @@ function Fe(e) {
148
148
  n !== "" && (o.push(n), s = n.length), h();
149
149
  }
150
150
  function h() {
151
- 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 M(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
151
+ 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 Ne(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
152
152
  }
153
153
  function g(e) {
154
154
  let n = 0;
@@ -164,9 +164,9 @@ function Fe(e) {
164
164
  continue;
165
165
  }
166
166
  let i = e.charCodeAt(n);
167
- if (P(e, n, i)) {
168
- let i = e.charCodeAt(n + 5) === N ? n + 6 : n + 5, a = e.slice(i, r);
169
- if (d === 0 && e.charCodeAt(r + 1) === Me) {
167
+ if (M(e, n, i)) {
168
+ let i = e.charCodeAt(n + 5) === A ? n + 6 : n + 5, a = e.slice(i, r);
169
+ if (d === 0 && e.charCodeAt(r + 1) === Pe) {
170
170
  t({
171
171
  id: l,
172
172
  event: f,
@@ -176,7 +176,7 @@ function Fe(e) {
176
176
  }
177
177
  u = d === 0 ? a : `${u}
178
178
  ${a}`, d++;
179
- } else F(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === N ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
179
+ } else N(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === A ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
180
180
  n = r + 1, r = e.indexOf("\n", n);
181
181
  }
182
182
  return e.slice(n);
@@ -184,7 +184,7 @@ ${a}`, d++;
184
184
  for (; n < e.length;) {
185
185
  let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
186
186
  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;
187
- _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === Ne && e.charCodeAt(n) === Me && n++;
187
+ _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === Fe && e.charCodeAt(n) === Pe && n++;
188
188
  }
189
189
  return e.slice(n);
190
190
  }
@@ -194,25 +194,25 @@ ${a}`, d++;
194
194
  return;
195
195
  }
196
196
  let r = e.charCodeAt(t);
197
- if (P(e, t, r)) {
198
- let r = e.charCodeAt(t + 5) === N ? t + 6 : t + 5, i = e.slice(r, n);
197
+ if (M(e, t, r)) {
198
+ let r = e.charCodeAt(t + 5) === A ? t + 6 : t + 5, i = e.slice(r, n);
199
199
  u = d === 0 ? i : `${u}
200
200
  ${i}`, d++;
201
201
  return;
202
202
  }
203
- if (F(e, t, r)) {
204
- f = e.slice(e.charCodeAt(t + 6) === N ? t + 7 : t + 6, n) || void 0;
203
+ if (N(e, t, r)) {
204
+ f = e.slice(e.charCodeAt(t + 6) === A ? t + 7 : t + 6, n) || void 0;
205
205
  return;
206
206
  }
207
207
  if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
208
- let r = e.slice(e.charCodeAt(t + 3) === N ? t + 4 : t + 3, n);
208
+ let r = e.slice(e.charCodeAt(t + 3) === A ? t + 4 : t + 3, n);
209
209
  l = r.includes("\0") ? void 0 : r;
210
210
  return;
211
211
  }
212
212
  if (r === 58) {
213
213
  if (i) {
214
214
  let r = e.slice(t, n);
215
- i(r.slice(e.charCodeAt(t + 1) === N ? 2 : 1));
215
+ i(r.slice(e.charCodeAt(t + 1) === A ? 2 : 1));
216
216
  }
217
217
  return;
218
218
  }
@@ -221,7 +221,7 @@ ${i}`, d++;
221
221
  ee(a, "", a);
222
222
  return;
223
223
  }
224
- let s = a.slice(0, o), c = a.charCodeAt(o + 1) === N ? 2 : 1;
224
+ let s = a.slice(0, o), c = a.charCodeAt(o + 1) === A ? 2 : 1;
225
225
  ee(s, a.slice(o + c), a);
226
226
  }
227
227
  function ee(e, t, i) {
@@ -237,13 +237,13 @@ ${t}`, d++;
237
237
  l = t.includes("\0") ? void 0 : t;
238
238
  break;
239
239
  case "retry":
240
- /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new M(`Invalid \`retry\` value: "${t}"`, {
240
+ /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Ne(`Invalid \`retry\` value: "${t}"`, {
241
241
  type: "invalid-retry",
242
242
  value: t,
243
243
  line: i
244
244
  }));
245
245
  break;
246
- default: n(new M(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
246
+ default: n(new Ne(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
247
247
  type: "unknown-field",
248
248
  field: e,
249
249
  value: t,
@@ -270,20 +270,20 @@ ${t}`, d++;
270
270
  reset: ne
271
271
  };
272
272
  }
273
- function P(e, t, n) {
273
+ function M(e, t, n) {
274
274
  return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
275
275
  }
276
- function F(e, t, n) {
276
+ function N(e, t, n) {
277
277
  return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
278
278
  }
279
279
  //#endregion
280
280
  //#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
281
- var Ie = class extends TransformStream {
281
+ var P = class extends TransformStream {
282
282
  constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
283
283
  let i;
284
284
  super({
285
285
  start(a) {
286
- i = Fe({
286
+ i = Ie({
287
287
  onEvent: (e) => {
288
288
  a.enqueue(e);
289
289
  },
@@ -309,20 +309,20 @@ function Be(e) {
309
309
  let t = Function.prototype.toString.call(e);
310
310
  return t.includes("internal/deps/undici") || t.includes("lazy loading of undici");
311
311
  }
312
- var I = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
312
+ var F = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
313
313
  let i = () => {
314
314
  let e = n.length, r = Array(t);
315
315
  for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
316
316
  return r.join("");
317
317
  };
318
318
  if (e == null) return i;
319
- if (n.includes(r)) throw new we({
319
+ if (n.includes(r)) throw new T({
320
320
  argument: "separator",
321
321
  message: `The separator "${r}" must not be part of the alphabet "${n}".`
322
322
  });
323
323
  return () => `${e}${r}${i()}`;
324
- }, L = I();
325
- function R(e) {
324
+ }, I = F();
325
+ function L(e) {
326
326
  if (e == null) return {};
327
327
  let t = {};
328
328
  if (e instanceof Headers) e.forEach((e, n) => {
@@ -373,16 +373,16 @@ function Ke(e) {
373
373
  function qe(e) {
374
374
  if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
375
375
  let { additionalProperties: t } = e;
376
- e.additionalProperties = t != null && typeof t != "boolean" && z(t);
376
+ e.additionalProperties = t != null && typeof t != "boolean" && R(t);
377
377
  let { properties: n } = e;
378
- if (n != null) for (let e of Object.keys(n)) n[e] = z(n[e]);
378
+ if (n != null) for (let e of Object.keys(n)) n[e] = R(n[e]);
379
379
  }
380
- e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(z) : z(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(z)), e.allOf != null && (e.allOf = e.allOf.map(z)), e.oneOf != null && (e.oneOf = e.oneOf.map(z));
380
+ e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(R) : R(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(R)), e.allOf != null && (e.allOf = e.allOf.map(R)), e.oneOf != null && (e.oneOf = e.oneOf.map(R));
381
381
  let { definitions: t } = e;
382
- if (t != null) for (let e of Object.keys(t)) t[e] = z(t[e]);
382
+ if (t != null) for (let e of Object.keys(t)) t[e] = R(t[e]);
383
383
  return e;
384
384
  }
385
- function z(e) {
385
+ function R(e) {
386
386
  return typeof e == "boolean" ? e : qe(e);
387
387
  }
388
388
  var Je = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use"), Ye = {
@@ -412,12 +412,12 @@ var Je = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to u
412
412
  ...Ye,
413
413
  ...e
414
414
  };
415
- function B() {
415
+ function z() {
416
416
  return {};
417
417
  }
418
418
  function Ze(e, t) {
419
419
  let n = { type: "array" };
420
- return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = W(e.type._def, {
420
+ return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = U(e.type._def, {
421
421
  ...t,
422
422
  currentPath: [...t.currentPath, "items"]
423
423
  })), 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;
@@ -443,9 +443,9 @@ function $e() {
443
443
  return { type: "boolean" };
444
444
  }
445
445
  function et(e, t) {
446
- return W(e.type._def, t);
446
+ return U(e.type._def, t);
447
447
  }
448
- var tt = (e, t) => W(e.innerType._def, t);
448
+ var tt = (e, t) => U(e.innerType._def, t);
449
449
  function nt(e, t, n) {
450
450
  let r = n ?? t.dateStrategy;
451
451
  if (Array.isArray(r)) return { anyOf: r.map((n) => nt(e, t, n)) };
@@ -477,12 +477,12 @@ var rt = (e) => {
477
477
  };
478
478
  function it(e, t) {
479
479
  return {
480
- ...W(e.innerType._def, t),
480
+ ...U(e.innerType._def, t),
481
481
  default: e.defaultValue()
482
482
  };
483
483
  }
484
484
  function at(e, t) {
485
- return t.effectStrategy === "input" ? W(e.schema._def, t) : B();
485
+ return t.effectStrategy === "input" ? U(e.schema._def, t) : z();
486
486
  }
487
487
  function ot(e) {
488
488
  return {
@@ -492,14 +492,14 @@ function ot(e) {
492
492
  }
493
493
  var st = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
494
494
  function ct(e, t) {
495
- let n = [W(e.left._def, {
495
+ let n = [U(e.left._def, {
496
496
  ...t,
497
497
  currentPath: [
498
498
  ...t.currentPath,
499
499
  "allOf",
500
500
  "0"
501
501
  ]
502
- }), W(e.right._def, {
502
+ }), U(e.right._def, {
503
503
  ...t,
504
504
  currentPath: [
505
505
  ...t.currentPath,
@@ -526,7 +526,7 @@ function lt(e) {
526
526
  const: e.value
527
527
  };
528
528
  }
529
- var ut = void 0, V = {
529
+ var ut = void 0, B = {
530
530
  cuid: /^[cC][^\s-]{8,}$/,
531
531
  cuid2: /^[0-9a-z]+$/,
532
532
  ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
@@ -554,83 +554,83 @@ function dt(e, t) {
554
554
  case "email":
555
555
  switch (t.emailStrategy) {
556
556
  case "format:email":
557
- H(n, "email", r.message, t);
557
+ V(n, "email", r.message, t);
558
558
  break;
559
559
  case "format:idn-email":
560
- H(n, "idn-email", r.message, t);
560
+ V(n, "idn-email", r.message, t);
561
561
  break;
562
- case "pattern:zod": U(n, V.email, r.message, t);
562
+ case "pattern:zod": H(n, B.email, r.message, t);
563
563
  }
564
564
  break;
565
565
  case "url":
566
- H(n, "uri", r.message, t);
566
+ V(n, "uri", r.message, t);
567
567
  break;
568
568
  case "uuid":
569
- H(n, "uuid", r.message, t);
569
+ V(n, "uuid", r.message, t);
570
570
  break;
571
571
  case "regex":
572
- U(n, r.regex, r.message, t);
572
+ H(n, r.regex, r.message, t);
573
573
  break;
574
574
  case "cuid":
575
- U(n, V.cuid, r.message, t);
575
+ H(n, B.cuid, r.message, t);
576
576
  break;
577
577
  case "cuid2":
578
- U(n, V.cuid2, r.message, t);
578
+ H(n, B.cuid2, r.message, t);
579
579
  break;
580
580
  case "startsWith":
581
- U(n, RegExp(`^${ft(r.value, t)}`), r.message, t);
581
+ H(n, RegExp(`^${ft(r.value, t)}`), r.message, t);
582
582
  break;
583
583
  case "endsWith":
584
- U(n, RegExp(`${ft(r.value, t)}$`), r.message, t);
584
+ H(n, RegExp(`${ft(r.value, t)}$`), r.message, t);
585
585
  break;
586
586
  case "datetime":
587
- H(n, "date-time", r.message, t);
587
+ V(n, "date-time", r.message, t);
588
588
  break;
589
589
  case "date":
590
- H(n, "date", r.message, t);
590
+ V(n, "date", r.message, t);
591
591
  break;
592
592
  case "time":
593
- H(n, "time", r.message, t);
593
+ V(n, "time", r.message, t);
594
594
  break;
595
595
  case "duration":
596
- H(n, "duration", r.message, t);
596
+ V(n, "duration", r.message, t);
597
597
  break;
598
598
  case "length":
599
599
  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;
600
600
  break;
601
601
  case "includes":
602
- U(n, RegExp(ft(r.value, t)), r.message, t);
602
+ H(n, RegExp(ft(r.value, t)), r.message, t);
603
603
  break;
604
604
  case "ip":
605
- r.version !== "v6" && H(n, "ipv4", r.message, t), r.version !== "v4" && H(n, "ipv6", r.message, t);
605
+ r.version !== "v6" && V(n, "ipv4", r.message, t), r.version !== "v4" && V(n, "ipv6", r.message, t);
606
606
  break;
607
607
  case "base64url":
608
- U(n, V.base64url, r.message, t);
608
+ H(n, B.base64url, r.message, t);
609
609
  break;
610
610
  case "jwt":
611
- U(n, V.jwt, r.message, t);
611
+ H(n, B.jwt, r.message, t);
612
612
  break;
613
613
  case "cidr":
614
- r.version !== "v6" && U(n, V.ipv4Cidr, r.message, t), r.version !== "v4" && U(n, V.ipv6Cidr, r.message, t);
614
+ r.version !== "v6" && H(n, B.ipv4Cidr, r.message, t), r.version !== "v4" && H(n, B.ipv6Cidr, r.message, t);
615
615
  break;
616
616
  case "emoji":
617
- U(n, V.emoji(), r.message, t);
617
+ H(n, B.emoji(), r.message, t);
618
618
  break;
619
619
  case "ulid":
620
- U(n, V.ulid, r.message, t);
620
+ H(n, B.ulid, r.message, t);
621
621
  break;
622
622
  case "base64":
623
623
  switch (t.base64Strategy) {
624
624
  case "format:binary":
625
- H(n, "binary", r.message, t);
625
+ V(n, "binary", r.message, t);
626
626
  break;
627
627
  case "contentEncoding:base64":
628
628
  n.contentEncoding = "base64";
629
629
  break;
630
- case "pattern:zod": U(n, V.base64, r.message, t);
630
+ case "pattern:zod": H(n, B.base64, r.message, t);
631
631
  }
632
632
  break;
633
- case "nanoid": U(n, V.nanoid, r.message, t);
633
+ case "nanoid": H(n, B.nanoid, r.message, t);
634
634
  }
635
635
  return n;
636
636
  }
@@ -643,13 +643,13 @@ function mt(e) {
643
643
  for (let n = 0; n < e.length; n++) pt.has(e[n]) || (t += "\\"), t += e[n];
644
644
  return t;
645
645
  }
646
- function H(e, t, n, r) {
646
+ function V(e, t, n, r) {
647
647
  e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
648
648
  format: t,
649
649
  ...n && r.errorMessages && { errorMessage: { format: n } }
650
650
  })) : e.format = t;
651
651
  }
652
- function U(e, t, n, r) {
652
+ function H(e, t, n, r) {
653
653
  e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
654
654
  pattern: ht(t, r),
655
655
  ...n && r.errorMessages && { errorMessage: { pattern: n } }
@@ -706,7 +706,7 @@ function ht(e, t) {
706
706
  function gt(e, t) {
707
707
  let n = {
708
708
  type: "object",
709
- additionalProperties: W(e.valueType._def, {
709
+ additionalProperties: U(e.valueType._def, {
710
710
  ...t,
711
711
  currentPath: [...t.currentPath, "additionalProperties"]
712
712
  }) ?? t.allowedAdditionalProperties
@@ -737,7 +737,7 @@ function _t(e, t) {
737
737
  maxItems: 125,
738
738
  items: {
739
739
  type: "array",
740
- items: [W(e.keyType._def, {
740
+ items: [U(e.keyType._def, {
741
741
  ...t,
742
742
  currentPath: [
743
743
  ...t.currentPath,
@@ -745,7 +745,7 @@ function _t(e, t) {
745
745
  "items",
746
746
  "0"
747
747
  ]
748
- }) || B(), W(e.valueType._def, {
748
+ }) || z(), U(e.valueType._def, {
749
749
  ...t,
750
750
  currentPath: [
751
751
  ...t.currentPath,
@@ -753,7 +753,7 @@ function _t(e, t) {
753
753
  "items",
754
754
  "1"
755
755
  ]
756
- }) || B()],
756
+ }) || z()],
757
757
  minItems: 2,
758
758
  maxItems: 2
759
759
  }
@@ -767,7 +767,7 @@ function vt(e) {
767
767
  };
768
768
  }
769
769
  function yt() {
770
- return { not: B() };
770
+ return { not: z() };
771
771
  }
772
772
  function bt() {
773
773
  return { type: "null" };
@@ -814,7 +814,7 @@ function St(e, t) {
814
814
  return Ct(e, t);
815
815
  }
816
816
  var Ct = (e, t) => {
817
- let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => W(e._def, {
817
+ let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => U(e._def, {
818
818
  ...t,
819
819
  currentPath: [
820
820
  ...t.currentPath,
@@ -832,7 +832,7 @@ function wt(e, t) {
832
832
  "ZodBoolean",
833
833
  "ZodNull"
834
834
  ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [xt[e.innerType._def.typeName], "null"] };
835
- let n = W(e.innerType._def, {
835
+ let n = U(e.innerType._def, {
836
836
  ...t,
837
837
  currentPath: [
838
838
  ...t.currentPath,
@@ -867,7 +867,7 @@ function Et(e, t) {
867
867
  for (let e in i) {
868
868
  let a = i[e];
869
869
  if (a === void 0 || a._def === void 0) continue;
870
- let o = Ot(a), s = W(a._def, {
870
+ let o = Ot(a), s = U(a._def, {
871
871
  ...t,
872
872
  currentPath: [
873
873
  ...t.currentPath,
@@ -887,7 +887,7 @@ function Et(e, t) {
887
887
  return a !== void 0 && (n.additionalProperties = a), n;
888
888
  }
889
889
  function Dt(e, t) {
890
- if (e.catchall._def.typeName !== "ZodNever") return W(e.catchall._def, {
890
+ if (e.catchall._def.typeName !== "ZodNever") return U(e.catchall._def, {
891
891
  ...t,
892
892
  currentPath: [...t.currentPath, "additionalProperties"]
893
893
  });
@@ -905,8 +905,8 @@ function Ot(e) {
905
905
  }
906
906
  }
907
907
  var kt = (e, t) => {
908
- if (t.currentPath.toString() === t.propertyPath?.toString()) return W(e.innerType._def, t);
909
- let n = W(e.innerType._def, {
908
+ if (t.currentPath.toString() === t.propertyPath?.toString()) return U(e.innerType._def, t);
909
+ let n = U(e.innerType._def, {
910
910
  ...t,
911
911
  currentPath: [
912
912
  ...t.currentPath,
@@ -914,11 +914,11 @@ var kt = (e, t) => {
914
914
  "1"
915
915
  ]
916
916
  });
917
- return n ? { anyOf: [{ not: B() }, n] } : B();
917
+ return n ? { anyOf: [{ not: z() }, n] } : z();
918
918
  }, At = (e, t) => {
919
- if (t.pipeStrategy === "input") return W(e.in._def, t);
920
- if (t.pipeStrategy === "output") return W(e.out._def, t);
921
- let n = W(e.in._def, {
919
+ if (t.pipeStrategy === "input") return U(e.in._def, t);
920
+ if (t.pipeStrategy === "output") return U(e.out._def, t);
921
+ let n = U(e.in._def, {
922
922
  ...t,
923
923
  currentPath: [
924
924
  ...t.currentPath,
@@ -926,7 +926,7 @@ var kt = (e, t) => {
926
926
  "0"
927
927
  ]
928
928
  });
929
- return { allOf: [n, W(e.out._def, {
929
+ return { allOf: [n, U(e.out._def, {
930
930
  ...t,
931
931
  currentPath: [
932
932
  ...t.currentPath,
@@ -936,13 +936,13 @@ var kt = (e, t) => {
936
936
  })].filter((e) => e !== void 0) };
937
937
  };
938
938
  function jt(e, t) {
939
- return W(e.type._def, t);
939
+ return U(e.type._def, t);
940
940
  }
941
941
  function Mt(e, t) {
942
942
  let n = {
943
943
  type: "array",
944
944
  uniqueItems: !0,
945
- items: W(e.valueType._def, {
945
+ items: U(e.valueType._def, {
946
946
  ...t,
947
947
  currentPath: [...t.currentPath, "items"]
948
948
  })
@@ -953,7 +953,7 @@ function Nt(e, t) {
953
953
  return e.rest ? {
954
954
  type: "array",
955
955
  minItems: e.items.length,
956
- items: e.items.map((e, n) => W(e._def, {
956
+ items: e.items.map((e, n) => U(e._def, {
957
957
  ...t,
958
958
  currentPath: [
959
959
  ...t.currentPath,
@@ -961,7 +961,7 @@ function Nt(e, t) {
961
961
  `${n}`
962
962
  ]
963
963
  })).reduce((e, t) => t === void 0 ? e : [...e, t], []),
964
- additionalItems: W(e.rest._def, {
964
+ additionalItems: U(e.rest._def, {
965
965
  ...t,
966
966
  currentPath: [...t.currentPath, "additionalItems"]
967
967
  })
@@ -969,7 +969,7 @@ function Nt(e, t) {
969
969
  type: "array",
970
970
  minItems: e.items.length,
971
971
  maxItems: e.items.length,
972
- items: e.items.map((e, n) => W(e._def, {
972
+ items: e.items.map((e, n) => U(e._def, {
973
973
  ...t,
974
974
  currentPath: [
975
975
  ...t.currentPath,
@@ -980,12 +980,12 @@ function Nt(e, t) {
980
980
  };
981
981
  }
982
982
  function Pt() {
983
- return { not: B() };
983
+ return { not: z() };
984
984
  }
985
985
  function Ft() {
986
- return B();
986
+ return z();
987
987
  }
988
- var It = (e, t) => W(e.innerType._def, t), Lt = (e, t, n) => {
988
+ var It = (e, t) => U(e.innerType._def, t), Lt = (e, t, n) => {
989
989
  switch (t) {
990
990
  case "ZodString": return dt(e, n);
991
991
  case "ZodNumber": return Tt(e);
@@ -1013,7 +1013,7 @@ var It = (e, t) => W(e.innerType._def, t), Lt = (e, t, n) => {
1013
1013
  case "ZodNaN":
1014
1014
  case "ZodNever": return yt();
1015
1015
  case "ZodEffects": return at(e, n);
1016
- case "ZodAny": return B();
1016
+ case "ZodAny": return z();
1017
1017
  case "ZodUnknown": return Ft();
1018
1018
  case "ZodDefault": return it(e, n);
1019
1019
  case "ZodBranded": return et(e, n);
@@ -1030,7 +1030,7 @@ var It = (e, t) => W(e.innerType._def, t), Lt = (e, t, n) => {
1030
1030
  for (; n < e.length && n < t.length && e[n] === t[n]; n++);
1031
1031
  return [(e.length - n).toString(), ...t.slice(n)].join("/");
1032
1032
  };
1033
- function W(e, t, n = !1) {
1033
+ function U(e, t, n = !1) {
1034
1034
  let r = t.seen.get(e);
1035
1035
  if (t.override) {
1036
1036
  let i = t.override?.call(t, e, t, r, n);
@@ -1046,7 +1046,7 @@ function W(e, t, n = !1) {
1046
1046
  jsonSchema: void 0
1047
1047
  };
1048
1048
  t.seen.set(e, i);
1049
- let a = Lt(e, e.typeName, t), o = typeof a == "function" ? W(a(), t) : a;
1049
+ let a = Lt(e, e.typeName, t), o = typeof a == "function" ? U(a(), t) : a;
1050
1050
  if (o && Bt(e, t, o), t.postProcess) {
1051
1051
  let n = t.postProcess(o, e, t);
1052
1052
  return i.jsonSchema = o, n;
@@ -1058,7 +1058,7 @@ var zt = (e, t) => {
1058
1058
  case "root": return { $ref: e.path.join("/") };
1059
1059
  case "relative": return { $ref: Rt(t.currentPath, e.path) };
1060
1060
  case "none":
1061
- 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`), B()) : t.$refStrategy === "seen" ? B() : void 0;
1061
+ case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), z()) : t.$refStrategy === "seen" ? z() : void 0;
1062
1062
  }
1063
1063
  }, Bt = (e, t, n) => (e.description && (n.description = e.description), n), Vt = (e) => {
1064
1064
  let t = Xe(e), n = t.name === void 0 ? t.basePath : [
@@ -1083,22 +1083,22 @@ var zt = (e, t) => {
1083
1083
  }, Ht = (e, t) => {
1084
1084
  let n = Vt(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1085
1085
  ...e,
1086
- [t]: W(r._def, {
1086
+ [t]: U(r._def, {
1087
1087
  ...n,
1088
1088
  currentPath: [
1089
1089
  ...n.basePath,
1090
1090
  n.definitionPath,
1091
1091
  t
1092
1092
  ]
1093
- }, !0) ?? B()
1094
- }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = W(e._def, i === void 0 ? n : {
1093
+ }, !0) ?? z()
1094
+ }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = U(e._def, i === void 0 ? n : {
1095
1095
  ...n,
1096
1096
  currentPath: [
1097
1097
  ...n.basePath,
1098
1098
  n.definitionPath,
1099
1099
  i
1100
1100
  ]
1101
- }, !1) ?? B(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1101
+ }, !1) ?? z(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1102
1102
  o !== void 0 && (a.title = o);
1103
1103
  let s = i === void 0 ? r ? {
1104
1104
  ...a,
@@ -1151,7 +1151,7 @@ function Jt(e) {
1151
1151
  value: n.value
1152
1152
  } : {
1153
1153
  success: !1,
1154
- error: new j({
1154
+ error: new k({
1155
1155
  value: t,
1156
1156
  cause: n.issues
1157
1157
  })
@@ -1203,7 +1203,7 @@ async function en({ value: e, schema: t, context: n }) {
1203
1203
  schema: t,
1204
1204
  context: n
1205
1205
  });
1206
- if (!r.success) throw j.wrap({
1206
+ if (!r.success) throw k.wrap({
1207
1207
  value: e,
1208
1208
  cause: r.error,
1209
1209
  context: n
@@ -1225,7 +1225,7 @@ async function tn({ value: e, schema: t, context: n }) {
1225
1225
  rawValue: e
1226
1226
  } : {
1227
1227
  success: !1,
1228
- error: j.wrap({
1228
+ error: k.wrap({
1229
1229
  value: e,
1230
1230
  cause: t.error,
1231
1231
  context: n
@@ -1235,7 +1235,7 @@ async function tn({ value: e, schema: t, context: n }) {
1235
1235
  } catch (t) {
1236
1236
  return {
1237
1237
  success: !1,
1238
- error: j.wrap({
1238
+ error: k.wrap({
1239
1239
  value: e,
1240
1240
  cause: t,
1241
1241
  context: n
@@ -1244,7 +1244,7 @@ async function tn({ value: e, schema: t, context: n }) {
1244
1244
  };
1245
1245
  }
1246
1246
  }
1247
- async function G({ text: e, schema: t }) {
1247
+ async function W({ text: e, schema: t }) {
1248
1248
  try {
1249
1249
  let n = Ke(e);
1250
1250
  return t == null ? {
@@ -1258,7 +1258,7 @@ async function G({ text: e, schema: t }) {
1258
1258
  } catch (t) {
1259
1259
  return {
1260
1260
  success: !1,
1261
- error: ke.isInstance(t) ? t : new ke({
1261
+ error: E.isInstance(t) ? t : new E({
1262
1262
  text: e,
1263
1263
  cause: t
1264
1264
  }),
@@ -1267,14 +1267,14 @@ async function G({ text: e, schema: t }) {
1267
1267
  }
1268
1268
  }
1269
1269
  function nn({ stream: e, schema: t }) {
1270
- return e.pipeThrough(new TextDecoderStream()).pipeThrough(new Ie()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1271
- e !== "[DONE]" && n.enqueue(await G({
1270
+ return e.pipeThrough(new TextDecoderStream()).pipeThrough(new P()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1271
+ e !== "[DONE]" && n.enqueue(await W({
1272
1272
  text: e,
1273
1273
  schema: t
1274
1274
  }));
1275
1275
  } }));
1276
1276
  }
1277
- async function K(e) {
1277
+ async function G(e) {
1278
1278
  return typeof e == "function" && (e = e()), Promise.resolve(e);
1279
1279
  }
1280
1280
  new TextDecoder();
@@ -1283,7 +1283,7 @@ var rn = Object.defineProperty, an = (e, t) => {
1283
1283
  get: t[n],
1284
1284
  enumerable: !0
1285
1285
  });
1286
- }, on = "AI_NoObjectGeneratedError", sn = `vercel.ai.error.${on}`, cn = Symbol.for(sn), ln, q = class extends w {
1286
+ }, on = "AI_NoObjectGeneratedError", sn = `vercel.ai.error.${on}`, cn = Symbol.for(sn), ln, K = class extends C {
1287
1287
  constructor({ message: e = "No object generated.", cause: t, text: n, response: r, usage: i, finishReason: a }) {
1288
1288
  super({
1289
1289
  name: on,
@@ -1292,11 +1292,11 @@ var rn = Object.defineProperty, an = (e, t) => {
1292
1292
  }), this[ln] = !0, this.text = n, this.response = r, this.usage = i, this.finishReason = a;
1293
1293
  }
1294
1294
  static isInstance(e) {
1295
- return w.hasMarker(e, sn);
1295
+ return C.hasMarker(e, sn);
1296
1296
  }
1297
1297
  };
1298
1298
  ln = cn;
1299
- var un = "AI_UIMessageStreamError", dn = `vercel.ai.error.${un}`, fn = Symbol.for(dn), pn, J = class extends w {
1299
+ var un = "AI_UIMessageStreamError", dn = `vercel.ai.error.${un}`, fn = Symbol.for(dn), pn, q = class extends C {
1300
1300
  constructor({ chunkType: e, chunkId: t, message: n }) {
1301
1301
  super({
1302
1302
  name: un,
@@ -1304,7 +1304,7 @@ var un = "AI_UIMessageStreamError", dn = `vercel.ai.error.${un}`, fn = Symbol.fo
1304
1304
  }), this[pn] = !0, this.chunkType = e, this.chunkId = t;
1305
1305
  }
1306
1306
  static isInstance(e) {
1307
- return w.hasMarker(e, dn);
1307
+ return C.hasMarker(e, dn);
1308
1308
  }
1309
1309
  };
1310
1310
  pn = fn;
@@ -1321,7 +1321,7 @@ function mn(e, t) {
1321
1321
  }
1322
1322
  return n;
1323
1323
  }
1324
- var Y = {
1324
+ var J = {
1325
1325
  array: n,
1326
1326
  boolean: p,
1327
1327
  custom: i,
@@ -1339,210 +1339,210 @@ var Y = {
1339
1339
  string: g,
1340
1340
  union: ee,
1341
1341
  unknown: r
1342
- }, X = Y.lazy(() => Y.union([
1343
- Y.null(),
1344
- Y.string(),
1345
- Y.number(),
1346
- Y.boolean(),
1347
- Y.record(Y.string(), X.optional()),
1348
- Y.array(X)
1349
- ])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())), hn = Y.union([
1350
- Y.string(),
1351
- Y.instanceof(Uint8Array),
1352
- Y.instanceof(ArrayBuffer),
1353
- Y.custom(Ve, { message: "Must be a Buffer" })
1354
- ]), gn = Y.record(Y.string(), Y.string()), _n = Y.object({
1355
- type: Y.literal("text"),
1356
- text: Y.string(),
1357
- providerOptions: Z.optional()
1358
- }), vn = Y.object({
1359
- type: Y.literal("image"),
1360
- image: Y.union([
1342
+ }, Y = J.lazy(() => J.union([
1343
+ J.null(),
1344
+ J.string(),
1345
+ J.number(),
1346
+ J.boolean(),
1347
+ J.record(J.string(), Y.optional()),
1348
+ J.array(Y)
1349
+ ])), X = J.record(J.string(), J.record(J.string(), Y.optional())), hn = J.union([
1350
+ J.string(),
1351
+ J.instanceof(Uint8Array),
1352
+ J.instanceof(ArrayBuffer),
1353
+ J.custom(Ve, { message: "Must be a Buffer" })
1354
+ ]), gn = J.record(J.string(), J.string()), _n = J.object({
1355
+ type: J.literal("text"),
1356
+ text: J.string(),
1357
+ providerOptions: X.optional()
1358
+ }), vn = J.object({
1359
+ type: J.literal("image"),
1360
+ image: J.union([
1361
1361
  hn,
1362
- Y.instanceof(URL),
1362
+ J.instanceof(URL),
1363
1363
  gn
1364
1364
  ]),
1365
- mediaType: Y.string().optional(),
1366
- providerOptions: Z.optional()
1367
- }), yn = Y.discriminatedUnion("type", [
1368
- Y.object({
1369
- type: Y.literal("data"),
1365
+ mediaType: J.string().optional(),
1366
+ providerOptions: X.optional()
1367
+ }), yn = J.discriminatedUnion("type", [
1368
+ J.object({
1369
+ type: J.literal("data"),
1370
1370
  data: hn
1371
1371
  }),
1372
- Y.object({
1373
- type: Y.literal("url"),
1374
- url: Y.instanceof(URL)
1372
+ J.object({
1373
+ type: J.literal("url"),
1374
+ url: J.instanceof(URL)
1375
1375
  }),
1376
- Y.object({
1377
- type: Y.literal("reference"),
1376
+ J.object({
1377
+ type: J.literal("reference"),
1378
1378
  reference: gn
1379
1379
  }),
1380
- Y.object({
1381
- type: Y.literal("text"),
1382
- text: Y.string()
1380
+ J.object({
1381
+ type: J.literal("text"),
1382
+ text: J.string()
1383
1383
  })
1384
- ]), bn = Y.discriminatedUnion("type", [Y.object({
1385
- type: Y.literal("data"),
1384
+ ]), bn = J.discriminatedUnion("type", [J.object({
1385
+ type: J.literal("data"),
1386
1386
  data: hn
1387
- }), Y.object({
1388
- type: Y.literal("url"),
1389
- url: Y.instanceof(URL)
1390
- })]), xn = Y.object({
1391
- type: Y.literal("file"),
1392
- data: Y.union([
1387
+ }), J.object({
1388
+ type: J.literal("url"),
1389
+ url: J.instanceof(URL)
1390
+ })]), xn = J.object({
1391
+ type: J.literal("file"),
1392
+ data: J.union([
1393
1393
  yn,
1394
1394
  hn,
1395
- Y.instanceof(URL),
1395
+ J.instanceof(URL),
1396
1396
  gn
1397
1397
  ]),
1398
- filename: Y.string().optional(),
1399
- mediaType: Y.string(),
1400
- providerOptions: Z.optional()
1401
- }), Sn = Y.object({
1402
- type: Y.literal("reasoning"),
1403
- text: Y.string(),
1404
- providerOptions: Z.optional()
1405
- }), Cn = Y.object({
1406
- type: Y.literal("custom"),
1407
- kind: Y.string().transform((e) => e),
1408
- providerOptions: Z.optional()
1409
- }), wn = Y.object({
1410
- type: Y.literal("reasoning-file"),
1411
- data: Y.union([
1398
+ filename: J.string().optional(),
1399
+ mediaType: J.string(),
1400
+ providerOptions: X.optional()
1401
+ }), Sn = J.object({
1402
+ type: J.literal("reasoning"),
1403
+ text: J.string(),
1404
+ providerOptions: X.optional()
1405
+ }), Cn = J.object({
1406
+ type: J.literal("custom"),
1407
+ kind: J.string().transform((e) => e),
1408
+ providerOptions: X.optional()
1409
+ }), wn = J.object({
1410
+ type: J.literal("reasoning-file"),
1411
+ data: J.union([
1412
1412
  bn,
1413
1413
  hn,
1414
- Y.instanceof(URL)
1414
+ J.instanceof(URL)
1415
1415
  ]),
1416
- mediaType: Y.string(),
1417
- providerOptions: Z.optional()
1418
- }), Tn = Y.object({
1419
- type: Y.literal("tool-call"),
1420
- toolCallId: Y.string(),
1421
- toolName: Y.string(),
1422
- input: Y.unknown(),
1423
- providerOptions: Z.optional(),
1424
- providerExecuted: Y.boolean().optional()
1425
- }), En = Y.discriminatedUnion("type", [
1426
- Y.object({
1427
- type: Y.literal("text"),
1428
- value: Y.string(),
1429
- providerOptions: Z.optional()
1416
+ mediaType: J.string(),
1417
+ providerOptions: X.optional()
1418
+ }), Tn = J.object({
1419
+ type: J.literal("tool-call"),
1420
+ toolCallId: J.string(),
1421
+ toolName: J.string(),
1422
+ input: J.unknown(),
1423
+ providerOptions: X.optional(),
1424
+ providerExecuted: J.boolean().optional()
1425
+ }), En = J.discriminatedUnion("type", [
1426
+ J.object({
1427
+ type: J.literal("text"),
1428
+ value: J.string(),
1429
+ providerOptions: X.optional()
1430
1430
  }),
1431
- Y.object({
1432
- type: Y.literal("json"),
1433
- value: X,
1434
- providerOptions: Z.optional()
1431
+ J.object({
1432
+ type: J.literal("json"),
1433
+ value: Y,
1434
+ providerOptions: X.optional()
1435
1435
  }),
1436
- Y.object({
1437
- type: Y.literal("execution-denied"),
1438
- reason: Y.string().optional(),
1439
- providerOptions: Z.optional()
1436
+ J.object({
1437
+ type: J.literal("execution-denied"),
1438
+ reason: J.string().optional(),
1439
+ providerOptions: X.optional()
1440
1440
  }),
1441
- Y.object({
1442
- type: Y.literal("error-text"),
1443
- value: Y.string(),
1444
- providerOptions: Z.optional()
1441
+ J.object({
1442
+ type: J.literal("error-text"),
1443
+ value: J.string(),
1444
+ providerOptions: X.optional()
1445
1445
  }),
1446
- Y.object({
1447
- type: Y.literal("error-json"),
1448
- value: X,
1449
- providerOptions: Z.optional()
1446
+ J.object({
1447
+ type: J.literal("error-json"),
1448
+ value: Y,
1449
+ providerOptions: X.optional()
1450
1450
  }),
1451
- Y.object({
1452
- type: Y.literal("content"),
1453
- value: Y.array(Y.union([
1454
- Y.object({
1455
- type: Y.literal("text"),
1456
- text: Y.string(),
1457
- providerOptions: Z.optional()
1451
+ J.object({
1452
+ type: J.literal("content"),
1453
+ value: J.array(J.union([
1454
+ J.object({
1455
+ type: J.literal("text"),
1456
+ text: J.string(),
1457
+ providerOptions: X.optional()
1458
1458
  }),
1459
- Y.object({
1460
- type: Y.literal("file"),
1459
+ J.object({
1460
+ type: J.literal("file"),
1461
1461
  data: yn,
1462
- mediaType: Y.string(),
1463
- filename: Y.string().optional(),
1464
- providerOptions: Z.optional()
1462
+ mediaType: J.string(),
1463
+ filename: J.string().optional(),
1464
+ providerOptions: X.optional()
1465
1465
  }),
1466
- Y.object({
1467
- type: Y.literal("file-data"),
1468
- data: Y.string(),
1469
- mediaType: Y.string(),
1470
- filename: Y.string().optional(),
1471
- providerOptions: Z.optional()
1466
+ J.object({
1467
+ type: J.literal("file-data"),
1468
+ data: J.string(),
1469
+ mediaType: J.string(),
1470
+ filename: J.string().optional(),
1471
+ providerOptions: X.optional()
1472
1472
  }),
1473
- Y.object({
1474
- type: Y.literal("file-url"),
1475
- url: Y.string(),
1476
- mediaType: Y.string().optional(),
1477
- providerOptions: Z.optional()
1473
+ J.object({
1474
+ type: J.literal("file-url"),
1475
+ url: J.string(),
1476
+ mediaType: J.string().optional(),
1477
+ providerOptions: X.optional()
1478
1478
  }),
1479
- Y.object({
1480
- type: Y.literal("file-id"),
1481
- fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1482
- providerOptions: Z.optional()
1479
+ J.object({
1480
+ type: J.literal("file-id"),
1481
+ fileId: J.union([J.string(), J.record(J.string(), J.string())]),
1482
+ providerOptions: X.optional()
1483
1483
  }),
1484
- Y.object({
1485
- type: Y.literal("file-reference"),
1486
- providerReference: Y.record(Y.string(), Y.string()),
1487
- providerOptions: Z.optional()
1484
+ J.object({
1485
+ type: J.literal("file-reference"),
1486
+ providerReference: J.record(J.string(), J.string()),
1487
+ providerOptions: X.optional()
1488
1488
  }),
1489
- Y.object({
1490
- type: Y.literal("image-data"),
1491
- data: Y.string(),
1492
- mediaType: Y.string(),
1493
- providerOptions: Z.optional()
1489
+ J.object({
1490
+ type: J.literal("image-data"),
1491
+ data: J.string(),
1492
+ mediaType: J.string(),
1493
+ providerOptions: X.optional()
1494
1494
  }),
1495
- Y.object({
1496
- type: Y.literal("image-url"),
1497
- url: Y.string(),
1498
- providerOptions: Z.optional()
1495
+ J.object({
1496
+ type: J.literal("image-url"),
1497
+ url: J.string(),
1498
+ providerOptions: X.optional()
1499
1499
  }),
1500
- Y.object({
1501
- type: Y.literal("image-file-id"),
1502
- fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1503
- providerOptions: Z.optional()
1500
+ J.object({
1501
+ type: J.literal("image-file-id"),
1502
+ fileId: J.union([J.string(), J.record(J.string(), J.string())]),
1503
+ providerOptions: X.optional()
1504
1504
  }),
1505
- Y.object({
1506
- type: Y.literal("image-file-reference"),
1507
- providerReference: Y.record(Y.string(), Y.string()),
1508
- providerOptions: Z.optional()
1505
+ J.object({
1506
+ type: J.literal("image-file-reference"),
1507
+ providerReference: J.record(J.string(), J.string()),
1508
+ providerOptions: X.optional()
1509
1509
  }),
1510
- Y.object({
1511
- type: Y.literal("custom"),
1512
- providerOptions: Z.optional()
1510
+ J.object({
1511
+ type: J.literal("custom"),
1512
+ providerOptions: X.optional()
1513
1513
  })
1514
1514
  ]))
1515
1515
  })
1516
- ]), Dn = Y.object({
1517
- type: Y.literal("tool-result"),
1518
- toolCallId: Y.string(),
1519
- toolName: Y.string(),
1516
+ ]), Dn = J.object({
1517
+ type: J.literal("tool-result"),
1518
+ toolCallId: J.string(),
1519
+ toolName: J.string(),
1520
1520
  output: En,
1521
- providerOptions: Z.optional()
1522
- }), On = Y.object({
1523
- type: Y.literal("tool-approval-request"),
1524
- approvalId: Y.string(),
1525
- toolCallId: Y.string()
1526
- }), kn = Y.object({
1527
- type: Y.literal("tool-approval-response"),
1528
- approvalId: Y.string(),
1529
- approved: Y.boolean(),
1530
- reason: Y.string().optional()
1531
- }), An = Y.object({
1532
- role: Y.literal("system"),
1533
- content: Y.string(),
1534
- providerOptions: Z.optional()
1535
- }), jn = Y.object({
1536
- role: Y.literal("user"),
1537
- content: Y.union([Y.string(), Y.array(Y.union([
1521
+ providerOptions: X.optional()
1522
+ }), On = J.object({
1523
+ type: J.literal("tool-approval-request"),
1524
+ approvalId: J.string(),
1525
+ toolCallId: J.string()
1526
+ }), kn = J.object({
1527
+ type: J.literal("tool-approval-response"),
1528
+ approvalId: J.string(),
1529
+ approved: J.boolean(),
1530
+ reason: J.string().optional()
1531
+ }), An = J.object({
1532
+ role: J.literal("system"),
1533
+ content: J.string(),
1534
+ providerOptions: X.optional()
1535
+ }), jn = J.object({
1536
+ role: J.literal("user"),
1537
+ content: J.union([J.string(), J.array(J.union([
1538
1538
  _n,
1539
1539
  vn,
1540
1540
  xn
1541
1541
  ]))]),
1542
- providerOptions: Z.optional()
1543
- }), Mn = Y.object({
1544
- role: Y.literal("assistant"),
1545
- content: Y.union([Y.string(), Y.array(Y.union([
1542
+ providerOptions: X.optional()
1543
+ }), Mn = J.object({
1544
+ role: J.literal("assistant"),
1545
+ content: J.union([J.string(), J.array(J.union([
1546
1546
  _n,
1547
1547
  Cn,
1548
1548
  xn,
@@ -1552,13 +1552,13 @@ var Y = {
1552
1552
  Dn,
1553
1553
  On
1554
1554
  ]))]),
1555
- providerOptions: Z.optional()
1556
- }), Nn = Y.object({
1557
- role: Y.literal("tool"),
1558
- content: Y.array(Y.union([Dn, kn])),
1559
- providerOptions: Z.optional()
1555
+ providerOptions: X.optional()
1556
+ }), Nn = J.object({
1557
+ role: J.literal("tool"),
1558
+ content: J.array(J.union([Dn, kn])),
1559
+ providerOptions: X.optional()
1560
1560
  });
1561
- Y.union([
1561
+ J.union([
1562
1562
  An,
1563
1563
  jn,
1564
1564
  Mn,
@@ -1757,11 +1757,11 @@ async function Fn(e) {
1757
1757
  value: void 0,
1758
1758
  state: "undefined-input"
1759
1759
  };
1760
- let t = await G({ text: e });
1760
+ let t = await W({ text: e });
1761
1761
  return t.success ? {
1762
1762
  value: t.value,
1763
1763
  state: "successful-parse"
1764
- } : (t = await G({ text: Pn(e) }), t.success ? {
1764
+ } : (t = await W({ text: Pn(e) }), t.success ? {
1765
1765
  value: t.value,
1766
1766
  state: "repaired-parse"
1767
1767
  } : {
@@ -1783,15 +1783,15 @@ var In = () => ({
1783
1783
  let r = qt(e);
1784
1784
  return {
1785
1785
  name: "object",
1786
- responseFormat: K(r.jsonSchema).then((e) => ({
1786
+ responseFormat: G(r.jsonSchema).then((e) => ({
1787
1787
  type: "json",
1788
1788
  schema: e,
1789
1789
  ...t != null && { name: t },
1790
1790
  ...n != null && { description: n }
1791
1791
  })),
1792
1792
  async parseCompleteOutput({ text: e }, t) {
1793
- let n = await G({ text: e });
1794
- if (!n.success) throw new q({
1793
+ let n = await W({ text: e });
1794
+ if (!n.success) throw new K({
1795
1795
  message: "No object generated: could not parse the response.",
1796
1796
  cause: n.error,
1797
1797
  text: e,
@@ -1803,7 +1803,7 @@ var In = () => ({
1803
1803
  value: n.value,
1804
1804
  schema: r
1805
1805
  });
1806
- if (!i.success) throw new q({
1806
+ if (!i.success) throw new K({
1807
1807
  message: "No object generated: response did not match schema.",
1808
1808
  cause: i.error,
1809
1809
  text: e,
@@ -1828,7 +1828,7 @@ var In = () => ({
1828
1828
  let r = qt(e);
1829
1829
  return {
1830
1830
  name: "array",
1831
- responseFormat: K(r.jsonSchema).then((e) => {
1831
+ responseFormat: G(r.jsonSchema).then((e) => {
1832
1832
  let { $schema: r, definitions: i, $defs: a, ...o } = e;
1833
1833
  return {
1834
1834
  type: "json",
@@ -1849,8 +1849,8 @@ var In = () => ({
1849
1849
  };
1850
1850
  }),
1851
1851
  async parseCompleteOutput({ text: e }, t) {
1852
- let n = await G({ text: e });
1853
- if (!n.success) throw new q({
1852
+ let n = await W({ text: e });
1853
+ if (!n.success) throw new K({
1854
1854
  message: "No object generated: could not parse the response.",
1855
1855
  cause: n.error,
1856
1856
  text: e,
@@ -1859,9 +1859,9 @@ var In = () => ({
1859
1859
  finishReason: t.finishReason
1860
1860
  });
1861
1861
  let i = n.value;
1862
- if (typeof i != "object" || !i || !("elements" in i) || !Array.isArray(i.elements)) throw new q({
1862
+ if (typeof i != "object" || !i || !("elements" in i) || !Array.isArray(i.elements)) throw new K({
1863
1863
  message: "No object generated: response did not match schema.",
1864
- cause: new j({
1864
+ cause: new k({
1865
1865
  value: i,
1866
1866
  cause: "response must be an object with an elements array"
1867
1867
  }),
@@ -1876,7 +1876,7 @@ var In = () => ({
1876
1876
  value: n,
1877
1877
  schema: r
1878
1878
  });
1879
- if (!i.success) throw new q({
1879
+ if (!i.success) throw new K({
1880
1880
  message: "No object generated: response did not match schema.",
1881
1881
  cause: i.error,
1882
1882
  text: e,
@@ -1934,8 +1934,8 @@ var In = () => ({
1934
1934
  ...n != null && { description: n }
1935
1935
  }),
1936
1936
  async parseCompleteOutput({ text: t }, n) {
1937
- let r = await G({ text: t });
1938
- if (!r.success) throw new q({
1937
+ let r = await W({ text: t });
1938
+ if (!r.success) throw new K({
1939
1939
  message: "No object generated: could not parse the response.",
1940
1940
  cause: r.error,
1941
1941
  text: t,
@@ -1944,9 +1944,9 @@ var In = () => ({
1944
1944
  finishReason: n.finishReason
1945
1945
  });
1946
1946
  let i = r.value;
1947
- if (typeof i != "object" || !i || !("result" in i) || typeof i.result != "string" || !e.includes(i.result)) throw new q({
1947
+ if (typeof i != "object" || !i || !("result" in i) || typeof i.result != "string" || !e.includes(i.result)) throw new K({
1948
1948
  message: "No object generated: response did not match schema.",
1949
- cause: new j({
1949
+ cause: new k({
1950
1950
  value: i,
1951
1951
  cause: "response must be an object that contains a choice value."
1952
1952
  }),
@@ -1980,8 +1980,8 @@ var In = () => ({
1980
1980
  ...t != null && { description: t }
1981
1981
  }),
1982
1982
  async parseCompleteOutput({ text: e }, t) {
1983
- let n = await G({ text: e });
1984
- if (!n.success) throw new q({
1983
+ let n = await W({ text: e });
1984
+ if (!n.success) throw new K({
1985
1985
  message: "No object generated: could not parse the response.",
1986
1986
  cause: n.error,
1987
1987
  text: e,
@@ -2002,175 +2002,175 @@ var In = () => ({
2002
2002
  },
2003
2003
  createElementStreamTransform() {}
2004
2004
  });
2005
- new TextEncoder(), new TextEncoder(), I({
2005
+ new TextEncoder(), new TextEncoder(), F({
2006
2006
  prefix: "aitxt",
2007
2007
  size: 24
2008
- }), I({
2008
+ }), F({
2009
2009
  prefix: "call",
2010
2010
  size: 24
2011
2011
  }), TransformStream;
2012
- var Vn = Y.record(Y.string(), X.optional()), Hn = Wt(() => $t(Y.union([
2013
- Y.looseObject({
2014
- type: Y.literal("text-start"),
2015
- id: Y.string(),
2016
- providerMetadata: Z.optional()
2012
+ var Vn = J.record(J.string(), Y.optional()), Hn = Wt(() => $t(J.union([
2013
+ J.looseObject({
2014
+ type: J.literal("text-start"),
2015
+ id: J.string(),
2016
+ providerMetadata: X.optional()
2017
2017
  }),
2018
- Y.looseObject({
2019
- type: Y.literal("text-delta"),
2020
- id: Y.string(),
2021
- delta: Y.string(),
2022
- providerMetadata: Z.optional()
2018
+ J.looseObject({
2019
+ type: J.literal("text-delta"),
2020
+ id: J.string(),
2021
+ delta: J.string(),
2022
+ providerMetadata: X.optional()
2023
2023
  }),
2024
- Y.looseObject({
2025
- type: Y.literal("text-end"),
2026
- id: Y.string(),
2027
- providerMetadata: Z.optional()
2024
+ J.looseObject({
2025
+ type: J.literal("text-end"),
2026
+ id: J.string(),
2027
+ providerMetadata: X.optional()
2028
2028
  }),
2029
- Y.looseObject({
2030
- type: Y.literal("error"),
2031
- errorText: Y.string()
2029
+ J.looseObject({
2030
+ type: J.literal("error"),
2031
+ errorText: J.string()
2032
2032
  }),
2033
- Y.looseObject({
2034
- type: Y.literal("tool-input-start"),
2035
- toolCallId: Y.string(),
2036
- toolName: Y.string(),
2037
- providerExecuted: Y.boolean().optional(),
2038
- providerMetadata: Z.optional(),
2033
+ J.looseObject({
2034
+ type: J.literal("tool-input-start"),
2035
+ toolCallId: J.string(),
2036
+ toolName: J.string(),
2037
+ providerExecuted: J.boolean().optional(),
2038
+ providerMetadata: X.optional(),
2039
2039
  toolMetadata: Vn.optional(),
2040
- dynamic: Y.boolean().optional(),
2041
- title: Y.string().optional()
2040
+ dynamic: J.boolean().optional(),
2041
+ title: J.string().optional()
2042
2042
  }),
2043
- Y.looseObject({
2044
- type: Y.literal("tool-input-delta"),
2045
- toolCallId: Y.string(),
2046
- inputTextDelta: Y.string()
2043
+ J.looseObject({
2044
+ type: J.literal("tool-input-delta"),
2045
+ toolCallId: J.string(),
2046
+ inputTextDelta: J.string()
2047
2047
  }),
2048
- Y.looseObject({
2049
- type: Y.literal("tool-input-available"),
2050
- toolCallId: Y.string(),
2051
- toolName: Y.string(),
2052
- input: Y.unknown(),
2053
- providerExecuted: Y.boolean().optional(),
2054
- providerMetadata: Z.optional(),
2048
+ J.looseObject({
2049
+ type: J.literal("tool-input-available"),
2050
+ toolCallId: J.string(),
2051
+ toolName: J.string(),
2052
+ input: J.unknown(),
2053
+ providerExecuted: J.boolean().optional(),
2054
+ providerMetadata: X.optional(),
2055
2055
  toolMetadata: Vn.optional(),
2056
- dynamic: Y.boolean().optional(),
2057
- title: Y.string().optional()
2056
+ dynamic: J.boolean().optional(),
2057
+ title: J.string().optional()
2058
2058
  }),
2059
- Y.looseObject({
2060
- type: Y.literal("tool-input-error"),
2061
- toolCallId: Y.string(),
2062
- toolName: Y.string(),
2063
- input: Y.unknown(),
2064
- providerExecuted: Y.boolean().optional(),
2065
- providerMetadata: Z.optional(),
2059
+ J.looseObject({
2060
+ type: J.literal("tool-input-error"),
2061
+ toolCallId: J.string(),
2062
+ toolName: J.string(),
2063
+ input: J.unknown(),
2064
+ providerExecuted: J.boolean().optional(),
2065
+ providerMetadata: X.optional(),
2066
2066
  toolMetadata: Vn.optional(),
2067
- dynamic: Y.boolean().optional(),
2068
- errorText: Y.string(),
2069
- title: Y.string().optional()
2067
+ dynamic: J.boolean().optional(),
2068
+ errorText: J.string(),
2069
+ title: J.string().optional()
2070
2070
  }),
2071
- Y.looseObject({
2072
- type: Y.literal("tool-approval-request"),
2073
- approvalId: Y.string(),
2074
- toolCallId: Y.string(),
2075
- isAutomatic: Y.boolean().optional(),
2076
- signature: Y.string().optional()
2071
+ J.looseObject({
2072
+ type: J.literal("tool-approval-request"),
2073
+ approvalId: J.string(),
2074
+ toolCallId: J.string(),
2075
+ isAutomatic: J.boolean().optional(),
2076
+ signature: J.string().optional()
2077
2077
  }),
2078
- Y.looseObject({
2079
- type: Y.literal("tool-approval-response"),
2080
- approvalId: Y.string(),
2081
- approved: Y.boolean(),
2082
- reason: Y.string().optional(),
2083
- providerExecuted: Y.boolean().optional(),
2084
- providerMetadata: Z.optional()
2078
+ J.looseObject({
2079
+ type: J.literal("tool-approval-response"),
2080
+ approvalId: J.string(),
2081
+ approved: J.boolean(),
2082
+ reason: J.string().optional(),
2083
+ providerExecuted: J.boolean().optional(),
2084
+ providerMetadata: X.optional()
2085
2085
  }),
2086
- Y.looseObject({
2087
- type: Y.literal("tool-output-available"),
2088
- toolCallId: Y.string(),
2089
- output: Y.unknown(),
2090
- providerExecuted: Y.boolean().optional(),
2091
- providerMetadata: Z.optional(),
2086
+ J.looseObject({
2087
+ type: J.literal("tool-output-available"),
2088
+ toolCallId: J.string(),
2089
+ output: J.unknown(),
2090
+ providerExecuted: J.boolean().optional(),
2091
+ providerMetadata: X.optional(),
2092
2092
  toolMetadata: Vn.optional(),
2093
- dynamic: Y.boolean().optional(),
2094
- preliminary: Y.boolean().optional()
2093
+ dynamic: J.boolean().optional(),
2094
+ preliminary: J.boolean().optional()
2095
2095
  }),
2096
- Y.looseObject({
2097
- type: Y.literal("tool-output-error"),
2098
- toolCallId: Y.string(),
2099
- errorText: Y.string(),
2100
- providerExecuted: Y.boolean().optional(),
2101
- providerMetadata: Z.optional(),
2096
+ J.looseObject({
2097
+ type: J.literal("tool-output-error"),
2098
+ toolCallId: J.string(),
2099
+ errorText: J.string(),
2100
+ providerExecuted: J.boolean().optional(),
2101
+ providerMetadata: X.optional(),
2102
2102
  toolMetadata: Vn.optional(),
2103
- dynamic: Y.boolean().optional()
2103
+ dynamic: J.boolean().optional()
2104
2104
  }),
2105
- Y.looseObject({
2106
- type: Y.literal("tool-output-denied"),
2107
- toolCallId: Y.string()
2105
+ J.looseObject({
2106
+ type: J.literal("tool-output-denied"),
2107
+ toolCallId: J.string()
2108
2108
  }),
2109
- Y.looseObject({
2110
- type: Y.literal("reasoning-start"),
2111
- id: Y.string(),
2112
- providerMetadata: Z.optional()
2109
+ J.looseObject({
2110
+ type: J.literal("reasoning-start"),
2111
+ id: J.string(),
2112
+ providerMetadata: X.optional()
2113
2113
  }),
2114
- Y.looseObject({
2115
- type: Y.literal("reasoning-delta"),
2116
- id: Y.string(),
2117
- delta: Y.string(),
2118
- providerMetadata: Z.optional()
2114
+ J.looseObject({
2115
+ type: J.literal("reasoning-delta"),
2116
+ id: J.string(),
2117
+ delta: J.string(),
2118
+ providerMetadata: X.optional()
2119
2119
  }),
2120
- Y.looseObject({
2121
- type: Y.literal("reasoning-end"),
2122
- id: Y.string(),
2123
- providerMetadata: Z.optional()
2120
+ J.looseObject({
2121
+ type: J.literal("reasoning-end"),
2122
+ id: J.string(),
2123
+ providerMetadata: X.optional()
2124
2124
  }),
2125
- Y.looseObject({
2126
- type: Y.literal("custom"),
2127
- kind: Y.string().transform((e) => e),
2128
- providerMetadata: Z.optional()
2125
+ J.looseObject({
2126
+ type: J.literal("custom"),
2127
+ kind: J.string().transform((e) => e),
2128
+ providerMetadata: X.optional()
2129
2129
  }),
2130
- Y.looseObject({
2131
- type: Y.literal("source-url"),
2132
- sourceId: Y.string(),
2133
- url: Y.string(),
2134
- title: Y.string().optional(),
2135
- providerMetadata: Z.optional()
2130
+ J.looseObject({
2131
+ type: J.literal("source-url"),
2132
+ sourceId: J.string(),
2133
+ url: J.string(),
2134
+ title: J.string().optional(),
2135
+ providerMetadata: X.optional()
2136
2136
  }),
2137
- Y.looseObject({
2138
- type: Y.literal("source-document"),
2139
- sourceId: Y.string(),
2140
- mediaType: Y.string(),
2141
- title: Y.string(),
2142
- filename: Y.string().optional(),
2143
- providerMetadata: Z.optional()
2137
+ J.looseObject({
2138
+ type: J.literal("source-document"),
2139
+ sourceId: J.string(),
2140
+ mediaType: J.string(),
2141
+ title: J.string(),
2142
+ filename: J.string().optional(),
2143
+ providerMetadata: X.optional()
2144
2144
  }),
2145
- Y.looseObject({
2146
- type: Y.literal("file"),
2147
- url: Y.string(),
2148
- mediaType: Y.string(),
2149
- providerMetadata: Z.optional()
2145
+ J.looseObject({
2146
+ type: J.literal("file"),
2147
+ url: J.string(),
2148
+ mediaType: J.string(),
2149
+ providerMetadata: X.optional()
2150
2150
  }),
2151
- Y.looseObject({
2152
- type: Y.literal("reasoning-file"),
2153
- url: Y.string(),
2154
- mediaType: Y.string(),
2155
- providerMetadata: Z.optional()
2151
+ J.looseObject({
2152
+ type: J.literal("reasoning-file"),
2153
+ url: J.string(),
2154
+ mediaType: J.string(),
2155
+ providerMetadata: X.optional()
2156
2156
  }),
2157
- Y.looseObject({
2158
- type: Y.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2159
- id: Y.string().optional(),
2160
- data: Y.unknown(),
2161
- transient: Y.boolean().optional()
2157
+ J.looseObject({
2158
+ type: J.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2159
+ id: J.string().optional(),
2160
+ data: J.unknown(),
2161
+ transient: J.boolean().optional()
2162
2162
  }),
2163
- Y.looseObject({ type: Y.literal("start-step") }),
2164
- Y.looseObject({ type: Y.literal("finish-step") }),
2165
- Y.looseObject({ type: Y.literal("reset-step") }),
2166
- Y.looseObject({
2167
- type: Y.literal("start"),
2168
- messageId: Y.string().optional(),
2169
- messageMetadata: Y.unknown().optional()
2163
+ J.looseObject({ type: J.literal("start-step") }),
2164
+ J.looseObject({ type: J.literal("finish-step") }),
2165
+ J.looseObject({ type: J.literal("reset-step") }),
2166
+ J.looseObject({
2167
+ type: J.literal("start"),
2168
+ messageId: J.string().optional(),
2169
+ messageMetadata: J.unknown().optional()
2170
2170
  }),
2171
- Y.looseObject({
2172
- type: Y.literal("finish"),
2173
- finishReason: Y.enum([
2171
+ J.looseObject({
2172
+ type: J.literal("finish"),
2173
+ finishReason: J.enum([
2174
2174
  "stop",
2175
2175
  "length",
2176
2176
  "content-filter",
@@ -2178,21 +2178,21 @@ var Vn = Y.record(Y.string(), X.optional()), Hn = Wt(() => $t(Y.union([
2178
2178
  "error",
2179
2179
  "other"
2180
2180
  ]).optional(),
2181
- messageMetadata: Y.unknown().optional()
2181
+ messageMetadata: J.unknown().optional()
2182
2182
  }),
2183
- Y.looseObject({
2184
- type: Y.literal("abort"),
2185
- reason: Y.string().optional()
2183
+ J.looseObject({
2184
+ type: J.literal("abort"),
2185
+ reason: J.string().optional()
2186
2186
  }),
2187
- Y.looseObject({
2188
- type: Y.literal("message-metadata"),
2189
- messageMetadata: Y.unknown()
2187
+ J.looseObject({
2188
+ type: J.literal("message-metadata"),
2189
+ messageMetadata: J.unknown()
2190
2190
  })
2191
2191
  ])));
2192
2192
  function Un(e) {
2193
2193
  return e.type.startsWith("data-");
2194
2194
  }
2195
- function Q() {
2195
+ function Z() {
2196
2196
  return /* @__PURE__ */ Object.create(null);
2197
2197
  }
2198
2198
  function Wn(e) {
@@ -2201,13 +2201,13 @@ function Wn(e) {
2201
2201
  function Gn(e) {
2202
2202
  return e.type === "dynamic-tool";
2203
2203
  }
2204
- function Kn(e) {
2204
+ function Q(e) {
2205
2205
  return Wn(e) || Gn(e);
2206
2206
  }
2207
- function qn(e) {
2207
+ function Kn(e) {
2208
2208
  return e.type.split("-").slice(1).join("-");
2209
2209
  }
2210
- function Jn({ lastMessage: e, messageId: t }) {
2210
+ function qn({ lastMessage: e, messageId: t }) {
2211
2211
  return {
2212
2212
  message: e?.role === "assistant" ? e : {
2213
2213
  id: t,
@@ -2215,12 +2215,12 @@ function Jn({ lastMessage: e, messageId: t }) {
2215
2215
  role: "assistant",
2216
2216
  parts: []
2217
2217
  },
2218
- activeTextParts: Q(),
2219
- activeReasoningParts: Q(),
2220
- partialToolCalls: Q()
2218
+ activeTextParts: Z(),
2219
+ activeReasoningParts: Z(),
2220
+ partialToolCalls: Z()
2221
2221
  };
2222
2222
  }
2223
- function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o }) {
2223
+ function Jn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o }) {
2224
2224
  return e.pipeThrough(new TransformStream({ async transform(e, s) {
2225
2225
  await r(async ({ state: r, write: c }) => {
2226
2226
  function l() {
@@ -2229,7 +2229,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2229
2229
  return e.slice(t + 1);
2230
2230
  }
2231
2231
  function u() {
2232
- return l().filter(Kn);
2232
+ return l().filter(Q);
2233
2233
  }
2234
2234
  function d(e) {
2235
2235
  let t = u().find((t) => t.toolCallId === e);
@@ -2237,13 +2237,13 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2237
2237
  let n = r.message.parts;
2238
2238
  for (let r = n.length - 1; r >= 0; r--) {
2239
2239
  let i = n[r];
2240
- if (Kn(i) && i.toolCallId === e) {
2240
+ if (Q(i) && i.toolCallId === e) {
2241
2241
  t = i;
2242
2242
  break;
2243
2243
  }
2244
2244
  }
2245
2245
  }
2246
- if (t == null) throw new J({
2246
+ if (t == null) throw new q({
2247
2247
  chunkType: "tool-invocation",
2248
2248
  chunkId: e,
2249
2249
  message: `No tool invocation found for tool call ID "${e}".`
@@ -2251,8 +2251,8 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2251
2251
  return t;
2252
2252
  }
2253
2253
  function f(e) {
2254
- let t = r.message.parts.filter(Kn).find((t) => t.approval?.id === e);
2255
- if (t == null) throw new J({
2254
+ let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
2255
+ if (t == null) throw new q({
2256
2256
  chunkType: "tool-approval-response",
2257
2257
  chunkId: e,
2258
2258
  message: `No tool invocation found for approval ID "${e}".`
@@ -2339,7 +2339,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2339
2339
  }
2340
2340
  case "text-delta": {
2341
2341
  let t = r.activeTextParts[e.id];
2342
- if (t == null) throw new J({
2342
+ if (t == null) throw new q({
2343
2343
  chunkType: "text-delta",
2344
2344
  chunkId: e.id,
2345
2345
  message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
@@ -2349,7 +2349,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2349
2349
  }
2350
2350
  case "text-end": {
2351
2351
  let t = r.activeTextParts[e.id];
2352
- if (t == null) throw new J({
2352
+ if (t == null) throw new q({
2353
2353
  chunkType: "text-end",
2354
2354
  chunkId: e.id,
2355
2355
  message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
@@ -2379,7 +2379,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2379
2379
  }
2380
2380
  case "reasoning-delta": {
2381
2381
  let t = r.activeReasoningParts[e.id];
2382
- if (t == null) throw new J({
2382
+ if (t == null) throw new q({
2383
2383
  chunkType: "reasoning-delta",
2384
2384
  chunkId: e.id,
2385
2385
  message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
@@ -2389,7 +2389,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2389
2389
  }
2390
2390
  case "reasoning-end": {
2391
2391
  let t = r.activeReasoningParts[e.id];
2392
- if (t == null) throw new J({
2392
+ if (t == null) throw new q({
2393
2393
  chunkType: "reasoning-end",
2394
2394
  chunkId: e.id,
2395
2395
  message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
@@ -2457,7 +2457,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2457
2457
  }
2458
2458
  case "tool-input-delta": {
2459
2459
  let t = r.partialToolCalls[e.toolCallId];
2460
- if (t == null) throw new J({
2460
+ if (t == null) throw new q({
2461
2461
  chunkType: "tool-input-delta",
2462
2462
  chunkId: e.toolCallId,
2463
2463
  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.`
@@ -2503,7 +2503,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2503
2503
  }), c(), a && !e.providerExecuted && await a({ toolCall: e });
2504
2504
  break;
2505
2505
  case "tool-input-error": {
2506
- let t = l().filter(Kn).find((t) => t.toolCallId === e.toolCallId);
2506
+ let t = l().filter(Q).find((t) => t.toolCallId === e.toolCallId);
2507
2507
  (t == null ? e.dynamic : t.type === "dynamic-tool") ? m({
2508
2508
  toolCallId: e.toolCallId,
2509
2509
  toolName: e.toolName,
@@ -2566,7 +2566,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2566
2566
  toolMetadata: t.toolMetadata
2567
2567
  }, t) : p({
2568
2568
  toolCallId: e.toolCallId,
2569
- toolName: qn(t),
2569
+ toolName: Kn(t),
2570
2570
  state: "output-available",
2571
2571
  input: t.input,
2572
2572
  output: e.output,
@@ -2592,7 +2592,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2592
2592
  toolMetadata: t.toolMetadata
2593
2593
  }, t) : p({
2594
2594
  toolCallId: e.toolCallId,
2595
- toolName: qn(t),
2595
+ toolName: Kn(t),
2596
2596
  state: "output-error",
2597
2597
  input: t.input,
2598
2598
  rawInput: t.rawInput,
@@ -2608,11 +2608,11 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2608
2608
  r.message.parts.push({ type: "step-start" });
2609
2609
  break;
2610
2610
  case "finish-step":
2611
- r.activeTextParts = Q(), r.activeReasoningParts = Q();
2611
+ r.activeTextParts = Z(), r.activeReasoningParts = Z();
2612
2612
  break;
2613
2613
  case "reset-step": {
2614
2614
  let e = l();
2615
- r.activeTextParts = Q(), r.activeReasoningParts = Q(), r.partialToolCalls = Q(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), c());
2615
+ r.activeTextParts = Z(), r.activeReasoningParts = Z(), r.partialToolCalls = Z(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), c());
2616
2616
  break;
2617
2617
  }
2618
2618
  case "start":
@@ -2653,7 +2653,7 @@ function Yn({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2653
2653
  });
2654
2654
  } }));
2655
2655
  }
2656
- async function Xn({ stream: e, onError: t, abortSignal: n }) {
2656
+ async function Yn({ stream: e, onError: t, abortSignal: n }) {
2657
2657
  let r = e.getReader(), i = () => {
2658
2658
  r.cancel().catch(() => {});
2659
2659
  };
@@ -2669,29 +2669,29 @@ async function Xn({ stream: e, onError: t, abortSignal: n }) {
2669
2669
  n?.removeEventListener("abort", i), r.releaseLock();
2670
2670
  }
2671
2671
  }
2672
- I({
2672
+ F({
2673
2673
  prefix: "aitxt",
2674
2674
  size: 24
2675
- }), I({
2675
+ }), F({
2676
2676
  prefix: "call",
2677
2677
  size: 24
2678
- }), I({
2678
+ }), F({
2679
2679
  prefix: "aitxt",
2680
2680
  size: 24
2681
- }), I({
2681
+ }), F({
2682
2682
  prefix: "call",
2683
2683
  size: 24
2684
- }), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), I({
2684
+ }), J.record(J.string(), Y.optional()), J.record(J.string(), J.string()), F({
2685
2685
  prefix: "call",
2686
2686
  size: 24
2687
- }), I({
2687
+ }), F({
2688
2688
  prefix: "call",
2689
2689
  size: 24
2690
- }), I({
2690
+ }), F({
2691
2691
  prefix: "aiobj",
2692
2692
  size: 24
2693
2693
  });
2694
- var Zn = class {
2694
+ var Xn = class {
2695
2695
  constructor() {
2696
2696
  this.queue = [], this.isProcessing = !1;
2697
2697
  }
@@ -2713,14 +2713,14 @@ var Zn = class {
2713
2713
  });
2714
2714
  }
2715
2715
  };
2716
- I({
2716
+ F({
2717
2717
  prefix: "aiobj",
2718
2718
  size: 24
2719
- }), I({
2719
+ }), F({
2720
2720
  prefix: "call",
2721
2721
  size: 24
2722
2722
  });
2723
- async function Qn(e) {
2723
+ async function Zn(e) {
2724
2724
  if (e == null) return [];
2725
2725
  if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw Error("FileList is not supported in the current environment");
2726
2726
  return Promise.all(Array.from(e).map(async (e) => {
@@ -2738,14 +2738,14 @@ async function Qn(e) {
2738
2738
  };
2739
2739
  }));
2740
2740
  }
2741
- var $n = class {
2741
+ var Qn = class {
2742
2742
  constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
2743
2743
  this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
2744
2744
  }
2745
2745
  async sendMessages({ abortSignal: e, ...t }) {
2746
- let n = await K(this.body), r = await K(this.headers), i = await K(this.credentials), a = {
2747
- ...R(r),
2748
- ...R(t.headers)
2746
+ let n = await G(this.body), r = await G(this.headers), i = await G(this.credentials), a = {
2747
+ ...L(r),
2748
+ ...L(t.headers)
2749
2749
  }, o = await this.prepareSendMessagesRequest?.call(this, {
2750
2750
  api: this.api,
2751
2751
  id: t.chatId,
@@ -2759,7 +2759,7 @@ var $n = class {
2759
2759
  requestMetadata: t.metadata,
2760
2760
  trigger: t.trigger,
2761
2761
  messageId: t.messageId
2762
- }), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : R(o.headers), l = o?.body === void 0 ? {
2762
+ }), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : L(o.headers), l = o?.body === void 0 ? {
2763
2763
  ...n,
2764
2764
  ...t.body,
2765
2765
  id: t.chatId,
@@ -2781,9 +2781,9 @@ var $n = class {
2781
2781
  return this.processResponseStream(d.body);
2782
2782
  }
2783
2783
  async reconnectToStream(e) {
2784
- let t = await K(this.body), n = await K(this.headers), r = await K(this.credentials), i = {
2785
- ...R(n),
2786
- ...R(e.headers)
2784
+ let t = await G(this.body), n = await G(this.headers), r = await G(this.credentials), i = {
2785
+ ...L(n),
2786
+ ...L(e.headers)
2787
2787
  }, a = await this.prepareReconnectToStreamRequest?.call(this, {
2788
2788
  api: this.api,
2789
2789
  id: e.chatId,
@@ -2794,7 +2794,7 @@ var $n = class {
2794
2794
  headers: i,
2795
2795
  credentials: r,
2796
2796
  requestMetadata: e.metadata
2797
- }), o = a?.api ?? `${this.api}/${e.chatId}/stream`, s = a?.headers === void 0 ? i : R(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
2797
+ }), o = a?.api ?? `${this.api}/${e.chatId}/stream`, s = a?.headers === void 0 ? i : L(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
2798
2798
  method: "GET",
2799
2799
  headers: s,
2800
2800
  credentials: c,
@@ -2805,7 +2805,7 @@ var $n = class {
2805
2805
  if (!l.body) throw Error("The response body is empty.");
2806
2806
  return this.processResponseStream(l.body);
2807
2807
  }
2808
- }, er = class extends $n {
2808
+ }, $n = class extends Qn {
2809
2809
  constructor(e = {}) {
2810
2810
  super(e);
2811
2811
  }
@@ -2818,9 +2818,9 @@ var $n = class {
2818
2818
  t.enqueue(e.value);
2819
2819
  } }));
2820
2820
  }
2821
- }, tr = class {
2822
- constructor({ generateId: e = L, id: t = e(), transport: n = new er(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
2823
- this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.jobExecutor = new Zn(), this.sendMessage = async (e, t) => {
2821
+ }, er = class {
2822
+ constructor({ generateId: e = I, id: t = e(), transport: n = new $n(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
2823
+ this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.jobExecutor = new Xn(), this.sendMessage = async (e, t) => {
2824
2824
  if (e == null) {
2825
2825
  await this.makeRequest({
2826
2826
  trigger: "submit-message",
@@ -2835,7 +2835,7 @@ var $n = class {
2835
2835
  this.pendingMessagePreparations.add(t);
2836
2836
  let r;
2837
2837
  try {
2838
- r = Array.isArray(e.files) ? e.files : await Qn(e.files);
2838
+ r = Array.isArray(e.files) ? e.files : await Zn(e.files);
2839
2839
  } finally {
2840
2840
  this.pendingMessagePreparations.delete(t);
2841
2841
  }
@@ -2882,7 +2882,7 @@ var $n = class {
2882
2882
  }, this.clearError = () => {
2883
2883
  this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
2884
2884
  }, this.addToolApprovalResponse = async ({ id: e, approved: t, reason: n, options: r }) => this.jobExecutor.run(async () => {
2885
- let i = this.state.messages, a = i[i.length - 1], o = (r) => Kn(r) && r.state === "approval-requested" && r.approval.id === e ? {
2885
+ let i = this.state.messages, a = i[i.length - 1], o = (r) => Q(r) && r.state === "approval-requested" && r.approval.id === e ? {
2886
2886
  ...r,
2887
2887
  state: "approval-responded",
2888
2888
  approval: {
@@ -2903,7 +2903,7 @@ var $n = class {
2903
2903
  });
2904
2904
  });
2905
2905
  }), this.addToolOutput = async ({ state: e = "output-available", toolCallId: t, output: n, errorText: r, options: i }) => this.jobExecutor.run(async () => {
2906
- let a = this.state.messages, o = a[a.length - 1], s = (i) => Kn(i) && i.toolCallId === t ? {
2906
+ let a = this.state.messages, o = a[a.length - 1], s = (i) => Q(i) && i.toolCallId === t ? {
2907
2907
  ...i,
2908
2908
  state: e,
2909
2909
  output: n,
@@ -2991,7 +2991,7 @@ var $n = class {
2991
2991
  let f = this.lastMessage, p = !1, m = !1, h = !1, g;
2992
2992
  try {
2993
2993
  let a = {
2994
- state: Jn({
2994
+ state: qn({
2995
2995
  lastMessage: e === "resume-stream" || e === "regenerate-message" ? void 0 : this.state.snapshot(f),
2996
2996
  messageId: this.generateId()
2997
2997
  }),
@@ -3010,8 +3010,8 @@ var $n = class {
3010
3010
  body: r,
3011
3011
  trigger: e,
3012
3012
  messageId: i
3013
- }), await Xn({
3014
- stream: Yn({
3013
+ }), await Yn({
3014
+ stream: Jn({
3015
3015
  stream: o,
3016
3016
  onToolCall: this.onToolCall,
3017
3017
  onData: this.onData,
@@ -3063,39 +3063,39 @@ var $n = class {
3063
3063
  });
3064
3064
  }
3065
3065
  };
3066
- function nr({ messages: e }) {
3066
+ function tr({ messages: e }) {
3067
3067
  let t = e[e.length - 1];
3068
3068
  if (!t || t.role !== "assistant") return !1;
3069
- let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Kn);
3069
+ let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
3070
3070
  return r.filter((e) => e.state === "approval-responded").length > 0 && r.every((e) => e.state === "output-available" || e.state === "output-error" || e.state === "approval-responded");
3071
3071
  }
3072
3072
  //#endregion
3073
3073
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.41_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
3074
- var rr = /* @__PURE__ */ new WeakMap(), ir = 0;
3075
- function ar(e) {
3074
+ var nr = /* @__PURE__ */ new WeakMap(), rr = 0;
3075
+ function ir(e) {
3076
3076
  if (!e.length) return "";
3077
3077
  for (var t = "arg", n = 0; n < e.length; ++n) {
3078
3078
  var r = void 0;
3079
- e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : rr.has(e[n]) ? r = rr.get(e[n]) : (r = ir, rr.set(e[n], ir++)), t += "@" + r;
3079
+ e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : nr.has(e[n]) ? r = nr.get(e[n]) : (r = rr, nr.set(e[n], rr++)), t += "@" + r;
3080
3080
  }
3081
3081
  return t;
3082
3082
  }
3083
3083
  //#endregion
3084
3084
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.41_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
3085
- function or(e) {
3085
+ function ar(e) {
3086
3086
  if (typeof e == "function") try {
3087
3087
  e = e();
3088
3088
  } catch {
3089
3089
  e = "";
3090
3090
  }
3091
- return e = Array.isArray(e) ? ar(e) : String(e || ""), e;
3091
+ return e = Array.isArray(e) ? ir(e) : String(e || ""), e;
3092
3092
  }
3093
- var sr = function() {
3093
+ var or = function() {
3094
3094
  function e(e) {
3095
3095
  e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
3096
3096
  }
3097
3097
  return e.prototype.serializeKey = function(e) {
3098
- return or(e);
3098
+ return ar(e);
3099
3099
  }, e.prototype.get = function(e) {
3100
3100
  var t = this.serializeKey(e);
3101
3101
  return this.items.get(t);
@@ -3117,15 +3117,15 @@ var sr = function() {
3117
3117
  }();
3118
3118
  //#endregion
3119
3119
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.41_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
3120
- function cr() {
3120
+ function sr() {
3121
3121
  return navigator.onLine === void 0 || navigator.onLine;
3122
3122
  }
3123
- function lr() {
3123
+ function cr() {
3124
3124
  return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
3125
3125
  }
3126
- var ur = {
3127
- isOnline: cr,
3128
- isDocumentVisible: lr,
3126
+ var lr = {
3127
+ isOnline: sr,
3128
+ isDocumentVisible: cr,
3129
3129
  fetcher: function(e) {
3130
3130
  return fetch(e).then(function(e) {
3131
3131
  return e.json();
@@ -3136,7 +3136,7 @@ var ur = {
3136
3136
  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]);
3137
3137
  return e;
3138
3138
  }, $.apply(this, arguments);
3139
- }, dr = function(e, t, n, r) {
3139
+ }, ur = function(e, t, n, r) {
3140
3140
  function i(e) {
3141
3141
  return e instanceof n ? e : new n(function(t) {
3142
3142
  t(e);
@@ -3162,7 +3162,7 @@ var ur = {
3162
3162
  }
3163
3163
  c((r = r.apply(e, t || [])).next());
3164
3164
  });
3165
- }, fr = function(e, t) {
3165
+ }, dr = function(e, t) {
3166
3166
  var n = {
3167
3167
  label: 0,
3168
3168
  sent: function() {
@@ -3235,7 +3235,7 @@ var ur = {
3235
3235
  done: !0
3236
3236
  };
3237
3237
  }
3238
- }, pr = function(e, t) {
3238
+ }, fr = function(e, t) {
3239
3239
  var n = typeof Symbol == "function" && e[Symbol.iterator];
3240
3240
  if (!n) return e;
3241
3241
  var r = n.call(e), i, a = [], o;
@@ -3251,11 +3251,11 @@ var ur = {
3251
3251
  }
3252
3252
  }
3253
3253
  return a;
3254
- }, mr = function(e, t, n) {
3254
+ }, pr = function(e, t, n) {
3255
3255
  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]);
3256
3256
  return e.concat(a || Array.prototype.slice.call(t));
3257
- }, hr = new sr(), gr = new sr(), _r = new sr(), vr = {
3258
- cache: hr,
3257
+ }, mr = new or(), hr = new or(), gr = new or(), _r = {
3258
+ cache: mr,
3259
3259
  refreshInterval: 0,
3260
3260
  ttl: 0,
3261
3261
  serverTTL: 1e3,
@@ -3265,15 +3265,15 @@ var ur = {
3265
3265
  shouldRetryOnError: !0,
3266
3266
  errorRetryInterval: 5e3,
3267
3267
  errorRetryCount: 5,
3268
- fetcher: ur.fetcher,
3269
- isOnline: ur.isOnline,
3270
- isDocumentVisible: ur.isDocumentVisible
3268
+ fetcher: lr.fetcher,
3269
+ isOnline: lr.isOnline,
3270
+ isDocumentVisible: lr.isDocumentVisible
3271
3271
  };
3272
- function yr(e, t, n) {
3273
- var r = gr.get(e);
3274
- r ? r.data.push(t) : gr.set(e, [t], n > 0 ? n + 5e3 : n);
3272
+ function vr(e, t, n) {
3273
+ var r = hr.get(e);
3274
+ r ? r.data.push(t) : hr.set(e, [t], n > 0 ? n + 5e3 : n);
3275
3275
  }
3276
- function br(e, t, n) {
3276
+ function yr(e, t, n) {
3277
3277
  if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
3278
3278
  var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
3279
3279
  setTimeout(function() {
@@ -3284,17 +3284,17 @@ function br(e, t, n) {
3284
3284
  }, i);
3285
3285
  }
3286
3286
  }
3287
- function xr(e) {
3287
+ function br(e) {
3288
3288
  var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
3289
- return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : vr.shouldRetryOnError;
3289
+ return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : _r.shouldRetryOnError;
3290
3290
  }
3291
- var Sr = function(e, t, n, r) {
3292
- return n === void 0 && (n = hr), r === void 0 && (r = vr.ttl), dr(void 0, void 0, void 0, function() {
3291
+ var xr = function(e, t, n, r) {
3292
+ return n === void 0 && (n = mr), r === void 0 && (r = _r.ttl), ur(void 0, void 0, void 0, function() {
3293
3293
  var i, a, o, s, c, l, u;
3294
- return fr(this, function(d) {
3294
+ return dr(this, function(d) {
3295
3295
  switch (d.label) {
3296
3296
  case 0:
3297
- if (!wr(t)) return [3, 5];
3297
+ if (!Cr(t)) return [3, 5];
3298
3298
  d.label = 1;
3299
3299
  case 1: return d.trys.push([
3300
3300
  1,
@@ -3316,7 +3316,7 @@ var Sr = function(e, t, n, r) {
3316
3316
  } catch (e) {
3317
3317
  console.error("swrv(mutate): failed to set cache", e);
3318
3318
  }
3319
- return l = gr.get(e), l && l.data.length && (u = l.data.filter(function(t) {
3319
+ return l = hr.get(e), l && l.data.length && (u = l.data.filter(function(t) {
3320
3320
  return t.key === e;
3321
3321
  }), u.forEach(function(e, t) {
3322
3322
  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];
@@ -3325,16 +3325,16 @@ var Sr = function(e, t, n, r) {
3325
3325
  });
3326
3326
  });
3327
3327
  };
3328
- function Cr() {
3328
+ function Sr() {
3329
3329
  for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
3330
- var r, i, a = $({}, vr), o = !1, s = !1;
3331
- if (!ce()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
3330
+ var r, i, a = $({}, _r), o = !1, s = !1;
3331
+ if (!se()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
3332
3332
  var c = typeof window > "u" || typeof document > "u";
3333
3333
  t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
3334
3334
  var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : y(r);
3335
3335
  i === void 0 && (i = a.fetcher);
3336
3336
  var d = null;
3337
- d ||= de({
3337
+ d ||= ue({
3338
3338
  data: void 0,
3339
3339
  error: void 0,
3340
3340
  isValidating: !0,
@@ -3342,32 +3342,32 @@ function Cr() {
3342
3342
  key: null
3343
3343
  });
3344
3344
  var f = function(t, n) {
3345
- return dr(e, void 0, void 0, function() {
3345
+ return ur(e, void 0, void 0, function() {
3346
3346
  var e, r, s, c, p, m, h, g = this;
3347
- return fr(this, function(_) {
3347
+ return dr(this, function(_) {
3348
3348
  switch (_.label) {
3349
3349
  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() {
3350
- return dr(g, void 0, void 0, function() {
3350
+ return ur(g, void 0, void 0, function() {
3351
3351
  var e, t, i, s, c, u;
3352
- return fr(this, function(m) {
3352
+ return dr(this, function(m) {
3353
3353
  switch (m.label) {
3354
- case 0: return e = _r.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, mr([], pr(t), !1)), _r.set(r, i, a.dedupingInterval), [4, Sr(r, i, a.cache, l)]);
3354
+ case 0: return e = gr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, pr([], fr(t), !1)), gr.set(r, i, a.dedupingInterval), [4, xr(r, i, a.cache, l)]);
3355
3355
  case 1: return m.sent(), [3, 4];
3356
- case 2: return [4, Sr(r, e.data, a.cache, l)];
3356
+ case 2: return [4, xr(r, e.data, a.cache, l)];
3357
3357
  case 3: m.sent(), m.label = 4;
3358
- case 4: return d.isValidating = !1, d.isLoading = !1, _r.delete(r), d.error !== void 0 && (s = xr({
3358
+ case 4: return d.isValidating = !1, d.isLoading = !1, gr.delete(r), d.error !== void 0 && (s = br({
3359
3359
  shouldRetry: a.shouldRetryOnError,
3360
3360
  error: d.error
3361
- }), c = xr({
3361
+ }), c = br({
3362
3362
  shouldRetry: !n || n.shouldRetryOnError,
3363
3363
  error: d.error
3364
- }), u = !o && s && c, u && br(f, n ? n.errorRetryCount : 1, a)), [2];
3364
+ }), u = !o && s && c, u && yr(f, n ? n.errorRetryCount : 1, a)), [2];
3365
3365
  }
3366
3366
  });
3367
3367
  });
3368
3368
  }, c && a.revalidateDebounce ? (setTimeout(function() {
3369
- return dr(g, void 0, void 0, function() {
3370
- return fr(this, function(e) {
3369
+ return ur(g, void 0, void 0, function() {
3370
+ return dr(this, function(e) {
3371
3371
  switch (e.label) {
3372
3372
  case 0: return o ? [3, 2] : [4, h()];
3373
3373
  case 1: e.sent(), e.label = 2;
@@ -3383,16 +3383,16 @@ function Cr() {
3383
3383
  });
3384
3384
  });
3385
3385
  }, p = function() {
3386
- return dr(e, void 0, void 0, function() {
3387
- return fr(this, function(e) {
3386
+ return ur(e, void 0, void 0, function() {
3387
+ return dr(this, function(e) {
3388
3388
  return [2, f(null, { shouldRetryOnError: !1 })];
3389
3389
  });
3390
3390
  });
3391
3391
  }, m = null;
3392
3392
  if (!c) {
3393
3393
  var h = function() {
3394
- return dr(e, void 0, void 0, function() {
3395
- return fr(this, function(e) {
3394
+ return ur(e, void 0, void 0, function() {
3395
+ return dr(this, function(e) {
3396
3396
  switch (e.label) {
3397
3397
  case 0: return !d.error && a.isOnline() ? [4, f()] : [3, 2];
3398
3398
  case 1: return e.sent(), [3, 3];
@@ -3404,30 +3404,30 @@ function Cr() {
3404
3404
  };
3405
3405
  a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
3406
3406
  }
3407
- ue(function() {
3407
+ le(function() {
3408
3408
  o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
3409
- var e = gr.get(u.value);
3409
+ var e = hr.get(u.value);
3410
3410
  e && (e.data = e.data.filter(function(e) {
3411
3411
  return e !== d;
3412
3412
  }));
3413
3413
  });
3414
3414
  try {
3415
3415
  fe(u, function(e) {
3416
- le(u) || (u.value = e), d.key = e, d.isValidating = !!e, yr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3416
+ ce(u) || (u.value = e), d.key = e, d.isValidating = !!e, vr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3417
3417
  }, { immediate: !0 });
3418
3418
  } catch {}
3419
- return $($({}, b(d)), { mutate: function(e, t) {
3419
+ return $($({}, de(d)), { mutate: function(e, t) {
3420
3420
  return f(e, $($({}, t), { forceRevalidate: !0 }));
3421
3421
  } });
3422
3422
  }
3423
- function wr(e) {
3423
+ function Cr(e) {
3424
3424
  return typeof e == "object" && !!e && typeof e.then == "function";
3425
3425
  }
3426
3426
  //#endregion
3427
3427
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.41_typescript@6.0.3_/node_modules/swrv/esm/index.js
3428
- var Tr = Cr;
3429
- Tr.default, Tr.default;
3430
- var Er = class {
3428
+ var wr = Sr;
3429
+ wr.default, wr.default;
3430
+ var Tr = class {
3431
3431
  constructor(e) {
3432
3432
  this.statusRef = y("ready"), this.errorRef = y(void 0), this.pushMessage = (e) => {
3433
3433
  this.messagesRef.value = [...this.messagesRef.value, e];
@@ -3455,78 +3455,52 @@ var Er = class {
3455
3455
  set error(e) {
3456
3456
  this.errorRef.value = e;
3457
3457
  }
3458
- }, Dr = class extends tr {
3458
+ }, Er = class extends er {
3459
3459
  constructor({ messages: e, ...t }) {
3460
3460
  super({
3461
3461
  ...t,
3462
- state: new Er(e)
3462
+ state: new Tr(e)
3463
3463
  });
3464
3464
  }
3465
- }, Or = "voice-", kr = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Ar = (e) => kr(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), jr = `tool-${ne}`, Mr = (e) => e.parts.find((e) => e.type === jr)?.input?.message, Nr = (e) => e.map(kr).filter((e) => e.length > 0).sort((e, t) => t.length - e.length), Pr = (e, t) => {
3466
- let n = e;
3467
- for (;;) {
3468
- let e = t.find((e) => n.startsWith(e));
3469
- if (!e) return n;
3470
- n = n.slice(e.length).trim();
3471
- }
3472
- }, Fr = (e, t) => Pr(kr(e), Nr(t)).length === 0, Ir = 8, Lr = (e, t, n = []) => {
3473
- let r = Nr(n), i = e.flatMap((e) => {
3474
- let t = [{
3475
- role: e.role,
3476
- text: Ar(e),
3477
- isNewestAgentLine: !1,
3478
- taken: !1
3479
- }], n = e.role === "assistant" ? Mr(e) : void 0;
3480
- return n && t.push({
3481
- role: e.role,
3482
- text: kr(n),
3483
- isNewestAgentLine: !1,
3484
- taken: !1
3485
- }), t;
3486
- });
3487
- for (let e = i.length - 1; e >= 0; --e) {
3488
- let t = i[e];
3489
- if (t.role === "assistant" && t.text.length > 0) {
3490
- t.isNewestAgentLine = !0;
3491
- break;
3492
- }
3493
- }
3465
+ }, Dr = "voice-", Or = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), kr = (e) => Or(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Ar = 8, jr = (e, t) => {
3466
+ let n = e.filter((e) => e.role === "user").map((e) => ({
3467
+ text: kr(e),
3468
+ taken: !1
3469
+ }));
3494
3470
  return t.filter((e) => {
3495
- if (!e.id.startsWith("voice-")) return !1;
3496
- let t = Ar(e), n = e.role === "assistant", a = n ? Pr(t, r) : t;
3497
- if (n && a.length === 0) return !1;
3498
- let o = i.find((r) => !r.taken && r.role === e.role && r.text.length > 0 && (r.text === t || r.text.length >= Ir && t.endsWith(r.text) || n && (r.text === a || r.isNewestAgentLine && a.length >= Ir && r.text.startsWith(a))));
3499
- return !o || (o.taken = !0, !1);
3471
+ if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
3472
+ let t = kr(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Ar && t.endsWith(e.text)));
3473
+ return !r || (r.taken = !0, !1);
3500
3474
  });
3501
- }, Rr = (e) => {
3475
+ }, Mr = (e) => {
3502
3476
  let t = e.type ?? "";
3503
3477
  return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
3504
- }, zr = ({ messages: e }) => {
3478
+ }, Nr = ({ messages: e }) => {
3505
3479
  let t = e[e.length - 1];
3506
3480
  if (!t || t.role !== "assistant") return !1;
3507
- let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && te(Rr(e)));
3508
- return r.length > 0 && r.every((e) => re.has(e.state ?? ""));
3481
+ let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && te(Mr(e)));
3482
+ return r.length > 0 && r.every((e) => ne.has(e.state ?? ""));
3509
3483
  };
3510
- function Br(e) {
3511
- return ge(`chatbot-${e}`, () => {
3512
- let { t, te: n, locale: r } = me({ useScope: "global" }), i = y(""), a = y(), o = y(e), s = y(), c = y(), l = y(), u = y(), d = y(), f = y(), p = y(), m = y(), h = y(), g = y(), _ = y(), ee = y(), te = y(), ne = y(), re = y(), ce = y(), le = y(!1), ue = he(), de = v(() => {
3484
+ function Pr(e) {
3485
+ return b(`chatbot-${e}`, () => {
3486
+ let { t, te: n, locale: r } = me({ useScope: "global" }), i = y(""), a = y(), o = y(e), s = y(), c = y(), l = y(), u = y(), d = y(), f = y(), p = y(), m = y(), h = y(), g = y(), _ = y(), ee = y(), te = y(), ne = y(), se = y(), ce = y(), le = y(!1), ue = he(), de = v(() => {
3513
3487
  let e = u.value?.theme;
3514
3488
  return (!e || e === "auto") && (e = ce.value), e ? e === "dark" : ue.value;
3515
- }), b = v(() => c.value === "reasoning"), ge = v(() => b.value ? g.value?.filter((e) => ![
3489
+ }), b = v(() => c.value === "reasoning"), ve = v(() => b.value ? g.value?.filter((e) => ![
3516
3490
  "upvote",
3517
3491
  "downvote",
3518
3492
  "feedback"
3519
- ].includes(e)) : g.value), ye = se(v(() => `${o.value}-chatId`), null);
3493
+ ].includes(e)) : g.value), ye = oe(v(() => `${o.value}-chatId`), null);
3520
3494
  pe(() => {
3521
- ye.value ||= L();
3495
+ ye.value ||= I();
3522
3496
  });
3523
3497
  let x = v({
3524
3498
  get: () => ye.value,
3525
3499
  set: (e) => {
3526
3500
  ye.value = e;
3527
3501
  }
3528
- }), S = y(), C = y(!1), w = v(() => S.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3529
- function be(e) {
3502
+ }), S = y(), C = y(!1), be = v(() => S.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3503
+ function xe(e) {
3530
3504
  try {
3531
3505
  let t = JSON.parse(e.message);
3532
3506
  return t.status === 404 || t.type?.includes("entity-not-found");
@@ -3534,25 +3508,25 @@ function Br(e) {
3534
3508
  return !1;
3535
3509
  }
3536
3510
  }
3537
- function xe(e) {
3538
- if (be(e)) {
3539
- let e = E.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? oe(t) : void 0;
3540
- x.value = L(), E.value.clearError(), S.value = void 0, n && E.value.sendMessage({ text: n });
3511
+ function Se(e) {
3512
+ if (xe(e)) {
3513
+ let e = T.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ae(t) : void 0;
3514
+ x.value = I(), T.value.clearError(), S.value = void 0, n && T.value.sendMessage({ text: n });
3541
3515
  return;
3542
3516
  }
3543
- ae.error(e), S.value = e, w.value && (C.value = !0);
3517
+ ie.error(e), S.value = e, be.value && (C.value = !0);
3544
3518
  }
3545
- let T = v(() => ie({
3519
+ let w = v(() => re({
3546
3520
  baseUrl: i.value,
3547
3521
  basePath: a.value,
3548
3522
  headers: () => p.value
3549
- })), Se = y(null), Ce = () => ({
3550
- ..._e(),
3551
- ...Se.value ?? {}
3552
- }), E = v(() => new Dr({
3523
+ })), Ce = y(null), we = () => ({
3524
+ ...ge(),
3525
+ ...Ce.value ?? {}
3526
+ }), T = v(() => new Er({
3553
3527
  id: x.value,
3554
- transport: new er({
3555
- api: T.value.getChatEndpoint(o.value, b.value ? "reasoning" : "chat"),
3528
+ transport: new $n({
3529
+ api: w.value.getChatEndpoint(o.value, b.value ? "reasoning" : "chat"),
3556
3530
  prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
3557
3531
  id: t,
3558
3532
  messages: [e[e.length - 1]],
@@ -3567,8 +3541,8 @@ function Br(e) {
3567
3541
  reasoning: d.value?.reasoning,
3568
3542
  webSearch: f.value?.webSearch,
3569
3543
  smoothStream: u.value?.smoothStream,
3570
- deviceContext: Ce(),
3571
- externalContext: re.value,
3544
+ deviceContext: we(),
3545
+ externalContext: se.value,
3572
3546
  disabledTools: f.value?.disabled,
3573
3547
  fallbackModels: te.value,
3574
3548
  gatewayOptions: ne.value
@@ -3576,23 +3550,23 @@ function Br(e) {
3576
3550
  credentials: "include",
3577
3551
  headers: () => p.value ?? {}
3578
3552
  }),
3579
- sendAutomaticallyWhen: (e) => zr(e) || nr(e),
3580
- onError: xe,
3553
+ sendAutomaticallyWhen: (e) => Nr(e) || tr(e),
3554
+ onError: Se,
3581
3555
  onFinish: () => {
3582
3556
  let e = x.value;
3583
- !b.value && !D.value.some((t) => t.id === e) && Le(o.value);
3557
+ !b.value && !E.value.some((t) => t.id === e) && Re(o.value);
3584
3558
  }
3585
- })), we = v(() => {
3559
+ })), Te = v(() => {
3586
3560
  let e = u.value?.initialMessage;
3587
3561
  return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
3588
- }), Te = L(), Ee = v(() => ({
3589
- id: Te,
3562
+ }), Ee = I(), De = v(() => ({
3563
+ id: Ee,
3590
3564
  role: "assistant",
3591
3565
  parts: [{
3592
3566
  type: "text",
3593
- text: we.value
3567
+ text: Te.value
3594
3568
  }]
3595
- })), De = v(() => {
3569
+ })), Oe = v(() => {
3596
3570
  let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
3597
3571
  ...e,
3598
3572
  parts: e.parts.map((e) => {
@@ -3602,169 +3576,169 @@ function Br(e) {
3602
3576
  let e = t.url.slice(13);
3603
3577
  return {
3604
3578
  ...t,
3605
- url: T.value.getMediaUrl(o.value, x.value, e)
3579
+ url: w.value.getMediaUrl(o.value, x.value, e)
3606
3580
  };
3607
3581
  }
3608
3582
  return t.url.startsWith("blob:") ? t : {
3609
3583
  ...t,
3610
- url: T.value.appendAuthToken(t.url)
3584
+ url: w.value.appendAuthToken(t.url)
3611
3585
  };
3612
3586
  })
3613
3587
  });
3614
- return b.value ? e(E.value.messages) : !le.value && E.value.messages?.[0]?.role !== "assistant" ? [Ee.value, ...e(E.value.messages)] : e(E.value.messages);
3615
- }), Oe = v(() => {
3588
+ return b.value ? e(T.value.messages) : !le.value && T.value.messages?.[0]?.role !== "assistant" ? [De.value, ...e(T.value.messages)] : e(T.value.messages);
3589
+ }), ke = v(() => {
3616
3590
  let e = u.value?.messagePlaceholder;
3617
3591
  return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
3618
- }), D = y([]), ke = y(!1), O = y([]), Ae = y(!1), je = y("chat"), k = y([]), A = y(), j = y(!1), M = y(!1), Me = y(), Ne = y(!1), N = y(!1), Pe = y(), Fe = y(""), P = y([]), F = y(""), Ie = y(0);
3619
- async function Le(e) {
3592
+ }), E = y([]), Ae = y(!1), D = y([]), je = y(!1), Me = y("chat"), O = y([]), k = y(), Ne = y(!1), Pe = y(!1), Fe = y(), A = y(!1), j = y(!1), Ie = y(), M = y(""), N = y([]), P = y(""), Le = y(0);
3593
+ async function Re(e) {
3620
3594
  if (b.value) {
3621
- D.value = [];
3595
+ E.value = [];
3622
3596
  return;
3623
3597
  }
3624
- ke.value = !0;
3598
+ Ae.value = !0;
3625
3599
  try {
3626
- D.value = await T.value.getConversations(e, l.value);
3600
+ E.value = await w.value.getConversations(e, l.value);
3627
3601
  } catch {
3628
- D.value = [];
3602
+ E.value = [];
3629
3603
  } finally {
3630
- ke.value = !1;
3604
+ Ae.value = !1;
3631
3605
  }
3632
3606
  }
3633
- async function Re() {
3607
+ async function ze() {
3634
3608
  let e = x.value;
3635
3609
  if (!e) {
3636
- O.value = [];
3610
+ D.value = [];
3637
3611
  return;
3638
3612
  }
3639
- Ae.value = !0;
3613
+ je.value = !0;
3640
3614
  try {
3641
- O.value = await T.value.getChatFiles(e);
3615
+ D.value = await w.value.getChatFiles(e);
3642
3616
  } catch {
3643
- O.value = [];
3617
+ D.value = [];
3644
3618
  } finally {
3645
- Ae.value = !1;
3619
+ je.value = !1;
3646
3620
  }
3647
3621
  }
3648
- function ze(e, t = !1) {
3649
- return T.value.getChatFileDownloadUrl(e, t);
3622
+ function Be(e, t = !1) {
3623
+ return w.value.getChatFileDownloadUrl(e, t);
3650
3624
  }
3651
- function Be(e) {
3652
- return T.value.getChatFilePreviewUrl(e);
3625
+ function F(e) {
3626
+ return w.value.getChatFilePreviewUrl(e);
3653
3627
  }
3654
- async function I(e) {
3655
- await T.value.deleteChatFile(e), O.value = O.value.filter((t) => t.documentId !== e);
3628
+ async function L(e) {
3629
+ await w.value.deleteChatFile(e), D.value = D.value.filter((t) => t.documentId !== e);
3656
3630
  }
3657
- async function R(e, t) {
3631
+ async function Ve(e, t) {
3658
3632
  if (!b.value) try {
3659
- let n = await T.value.getChat(e, t);
3660
- if (t !== x.value || E.value.status !== "ready" || E.value.messages.length > 0) return;
3661
- n && (E.value.messages = n.messages, C.value = n.blocked ?? !1);
3633
+ let n = await w.value.getChat(e, t);
3634
+ if (t !== x.value || T.value.status !== "ready" || T.value.messages.length > 0) return;
3635
+ n && (T.value.messages = n.messages, C.value = n.blocked ?? !1);
3662
3636
  } catch {}
3663
3637
  }
3664
- let Ve = () => {
3665
- let e = E.value.status;
3638
+ let He = () => {
3639
+ let e = T.value.status;
3666
3640
  return e === "submitted" || e === "streaming";
3667
- }, He = 0, Ue = 0, We = y([]);
3641
+ }, Ue = 0, We = 0;
3668
3642
  async function Ge() {
3669
- if (b.value || Ve()) return "indeterminate";
3670
- let e = x.value, t = He += 1;
3643
+ if (b.value || He()) return "indeterminate";
3644
+ let e = x.value, t = Ue += 1;
3671
3645
  try {
3672
- let n = await T.value.getChat(o.value, e);
3673
- if (!n || e !== x.value || Ve() || t <= Ue) return "indeterminate";
3674
- Ue = t;
3675
- let r = n.messages, i = Lr(r, E.value.messages, We.value);
3676
- return E.value.messages = [...r, ...i], C.value = n.blocked ?? !1, i.some((e) => e.role === "user") ? "pending" : "caught-up";
3646
+ let n = await w.value.getChat(o.value, e);
3647
+ if (!n || e !== x.value || He() || t <= We) return "indeterminate";
3648
+ We = t;
3649
+ let r = n.messages, i = jr(r, T.value.messages);
3650
+ return T.value.messages = [...r, ...i], C.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3677
3651
  } catch {}
3678
3652
  return "indeterminate";
3679
3653
  }
3680
3654
  function Ke(e) {
3681
- E.value.messages = [...E.value.messages, e];
3655
+ T.value.messages = [...T.value.messages, e];
3682
3656
  }
3683
3657
  async function qe(e) {
3684
3658
  try {
3685
- k.value = await T.value.getMessageFeedbacks(e);
3659
+ O.value = await w.value.getMessageFeedbacks(e);
3686
3660
  } catch {
3687
- k.value = [];
3661
+ O.value = [];
3688
3662
  }
3689
3663
  }
3690
- function z(e) {
3691
- let t = k.value.findIndex((t) => t.messageId === e.messageId);
3692
- t >= 0 ? k.value[t] = e : k.value.push(e);
3664
+ function R(e) {
3665
+ let t = O.value.findIndex((t) => t.messageId === e.messageId);
3666
+ t >= 0 ? O.value[t] = e : O.value.push(e);
3693
3667
  }
3694
3668
  function Je(e) {
3695
- let t = De.value, n = t.findIndex((t) => t.id === e.id), r = oe(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3669
+ let t = Oe.value, n = t.findIndex((t) => t.id === e.id), r = ae(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3696
3670
  return {
3697
- userQuestion: oe(i ?? e) ?? "",
3671
+ userQuestion: ae(i ?? e) ?? "",
3698
3672
  assistantMessage: r
3699
3673
  };
3700
3674
  }
3701
3675
  async function Ye(e, t) {
3702
3676
  await Promise.all([
3703
- R(e, t),
3704
- Le(e),
3677
+ Ve(e, t),
3678
+ Re(e),
3705
3679
  qe(t)
3706
- ]), Se.value || ve((e, t) => T.value.reverseGeocode(e, t, r.value)).then((e) => {
3707
- e && (Se.value = e);
3680
+ ]), Ce.value || _e((e, t) => w.value.reverseGeocode(e, t, r.value)).then((e) => {
3681
+ e && (Ce.value = e);
3708
3682
  });
3709
3683
  }
3710
3684
  async function Xe() {
3711
- let e = Fe.value.trim(), t = P.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3685
+ let e = M.value.trim(), t = N.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3712
3686
  type: "file",
3713
3687
  mediaType: e.mediaSource.mimeType,
3714
3688
  url: e.localUrl,
3715
3689
  filename: e.mediaSource.name,
3716
3690
  providerMetadata: { "8bot": { media: e.mediaSource } }
3717
3691
  }));
3718
- b.value && De.value.length > 0 && await $e(), F.value = e, Ie.value = E.value.messages.length;
3719
- let n = E.value.sendMessage;
3692
+ b.value && Oe.value.length > 0 && await $e(), P.value = e, Le.value = T.value.messages.length;
3693
+ let n = T.value.sendMessage;
3720
3694
  n({
3721
3695
  text: e,
3722
3696
  files: t.length > 0 ? t : void 0
3723
- }), Fe.value = "", Qe();
3697
+ }), M.value = "", Qe();
3724
3698
  }
3725
- function B(e) {
3699
+ function z(e) {
3726
3700
  let t = e.trim();
3727
3701
  if (!t) return;
3728
- if (E.value.status !== "ready") {
3729
- ae.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
3702
+ if (T.value.status !== "ready") {
3703
+ ie.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
3730
3704
  return;
3731
3705
  }
3732
- let n = E.value.sendMessage;
3706
+ let n = T.value.sendMessage;
3733
3707
  n({ text: t });
3734
3708
  }
3735
3709
  async function Ze() {
3736
- let e = F.value.length > 0;
3737
- await E.value.stop(), e && (Fe.value = F.value, E.value.messages = E.value.messages.slice(0, Ie.value), F.value = "");
3710
+ let e = P.value.length > 0;
3711
+ await T.value.stop(), e && (M.value = P.value, T.value.messages = T.value.messages.slice(0, Le.value), P.value = "");
3738
3712
  }
3739
- fe(() => E.value.status, (e) => {
3740
- e === "ready" && F.value.length > 0 && (F.value = "");
3713
+ fe(() => T.value.status, (e) => {
3714
+ e === "ready" && P.value.length > 0 && (P.value = "");
3741
3715
  });
3742
3716
  function Qe(e = !1) {
3743
- for (let t of P.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
3744
- P.value = [], ct.value = null;
3717
+ for (let t of N.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
3718
+ N.value = [], ct.value = null;
3745
3719
  }
3746
3720
  async function $e() {
3747
- return F.value = "", await Ze(), x.value = L(), E.value.clearError(), S.value = void 0, C.value = !1, Qe(!0), gt("chat"), x.value;
3721
+ return P.value = "", await Ze(), x.value = I(), T.value.clearError(), S.value = void 0, C.value = !1, Qe(!0), gt("chat"), x.value;
3748
3722
  }
3749
3723
  async function et(e) {
3750
- E.value.status !== "ready" && (F.value = "", await Ze()), await E.value.regenerate(e);
3724
+ T.value.status !== "ready" && (P.value = "", await Ze()), await T.value.regenerate(e);
3751
3725
  }
3752
3726
  function tt(e) {
3753
3727
  if (e.tool === "requestGeolocation") {
3754
3728
  let t = e.output;
3755
- "latitude" in t && (Se.value = {
3729
+ "latitude" in t && (Ce.value = {
3756
3730
  geolocationLatitude: t.latitude,
3757
3731
  geolocationLongitude: t.longitude,
3758
3732
  geolocationAccuracy: t.accuracy,
3759
3733
  geolocationCity: t.city
3760
3734
  });
3761
3735
  }
3762
- E.value.addToolOutput(e);
3736
+ T.value.addToolOutput(e);
3763
3737
  }
3764
3738
  function nt(e) {
3765
- E.value.addToolApprovalResponse(e);
3739
+ T.value.addToolApprovalResponse(e);
3766
3740
  }
3767
- let rt = v(() => E.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), it = v(() => _.value?.maxFilesPerMessage ?? 5), at = v(() => _.value?.maxFilesPerChat ?? 20), ot = v(() => Math.max(0, Math.min(it.value - P.value.length, at.value - rt.value - P.value.length))), st = v(() => ot.value <= 0), ct = y(null), lt = () => {
3741
+ let rt = v(() => T.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), it = v(() => _.value?.maxFilesPerMessage ?? 5), at = v(() => _.value?.maxFilesPerChat ?? 20), ot = v(() => Math.max(0, Math.min(it.value - N.value.length, at.value - rt.value - N.value.length))), st = v(() => ot.value <= 0), ct = y(null), lt = () => {
3768
3742
  ct.value = null;
3769
3743
  };
3770
3744
  fe(st, (e) => {
@@ -3772,7 +3746,7 @@ function Br(e) {
3772
3746
  });
3773
3747
  async function ut(e) {
3774
3748
  if (st.value) {
3775
- ct.value = at.value - rt.value - P.value.length <= it.value - P.value.length ? {
3749
+ ct.value = at.value - rt.value - N.value.length <= it.value - N.value.length ? {
3776
3750
  reason: "per-chat",
3777
3751
  max: at.value
3778
3752
  } : {
@@ -3781,32 +3755,32 @@ function Br(e) {
3781
3755
  };
3782
3756
  return;
3783
3757
  }
3784
- let t = L(), n = {
3758
+ let t = I(), n = {
3785
3759
  id: t,
3786
3760
  file: e,
3787
3761
  localUrl: URL.createObjectURL(e),
3788
3762
  state: "uploading"
3789
3763
  };
3790
- P.value = [...P.value, n];
3764
+ N.value = [...N.value, n];
3791
3765
  try {
3792
- let n = await T.value.uploadMedia(o.value, x.value, e);
3793
- P.value = P.value.map((e) => e.id === t ? {
3766
+ let n = await w.value.uploadMedia(o.value, x.value, e);
3767
+ N.value = N.value.map((e) => e.id === t ? {
3794
3768
  ...e,
3795
3769
  state: "done",
3796
3770
  mediaSource: n
3797
3771
  } : e);
3798
3772
  } catch (e) {
3799
3773
  let n = e instanceof Error ? e.message : "Upload failed";
3800
- P.value = P.value.map((e) => e.id === t ? {
3774
+ N.value = N.value.map((e) => e.id === t ? {
3801
3775
  ...e,
3802
3776
  state: "error",
3803
3777
  error: n
3804
3778
  } : e);
3805
3779
  }
3806
3780
  }
3807
- async function V(e, t) {
3781
+ async function B(e, t) {
3808
3782
  let { userQuestion: n, assistantMessage: r } = Je(e);
3809
- z(await T.value.submitMessageFeedback({
3783
+ R(await w.value.submitMessageFeedback({
3810
3784
  messageId: e.id,
3811
3785
  chatId: x.value,
3812
3786
  agentId: o.value,
@@ -3816,61 +3790,61 @@ function Br(e) {
3816
3790
  }));
3817
3791
  }
3818
3792
  async function dt(e) {
3819
- await V(e, "upvote");
3793
+ await B(e, "upvote");
3820
3794
  }
3821
3795
  async function ft(e) {
3822
- await V(e, "downvote");
3796
+ await B(e, "downvote");
3823
3797
  }
3824
3798
  function pt(e) {
3825
- M.value = !1, Me.value = void 0, A.value = e;
3799
+ Pe.value = !1, Fe.value = void 0, k.value = e;
3826
3800
  }
3827
3801
  async function mt(e) {
3828
- if (A.value) try {
3829
- j.value = !0, M.value = !1, Me.value = void 0;
3830
- let { userQuestion: t, assistantMessage: n } = Je(A.value);
3831
- z(await T.value.submitMessageFeedback({
3832
- messageId: A.value.id,
3802
+ if (k.value) try {
3803
+ Ne.value = !0, Pe.value = !1, Fe.value = void 0;
3804
+ let { userQuestion: t, assistantMessage: n } = Je(k.value);
3805
+ R(await w.value.submitMessageFeedback({
3806
+ messageId: k.value.id,
3833
3807
  chatId: x.value,
3834
3808
  agentId: o.value,
3835
3809
  userQuestion: t,
3836
3810
  assistantMessage: n,
3837
3811
  comment: e
3838
- })), M.value = !0, await qe(x.value);
3812
+ })), Pe.value = !0, await qe(x.value);
3839
3813
  } catch {
3840
- Me.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
3814
+ Fe.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
3841
3815
  } finally {
3842
- j.value = !1;
3816
+ Ne.value = !1;
3843
3817
  }
3844
3818
  }
3845
- async function H(e) {
3819
+ async function V(e) {
3846
3820
  try {
3847
- N.value = !0, Ne.value = !1, Pe.value = void 0, await T.value.submitLead({
3821
+ j.value = !0, A.value = !1, Ie.value = void 0, await w.value.submitLead({
3848
3822
  agentId: o.value,
3849
3823
  chatId: x.value,
3850
3824
  ...e
3851
- }), Ne.value = !0;
3825
+ }), A.value = !0;
3852
3826
  } catch {
3853
- Pe.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
3827
+ Ie.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
3854
3828
  } finally {
3855
- N.value = !1;
3829
+ j.value = !1;
3856
3830
  }
3857
3831
  }
3858
- async function U(e, t) {
3859
- let n = await T.value.updateChatTitle(o.value, e, t);
3860
- D.value = D.value.map((t) => t.id === e ? {
3832
+ async function H(e, t) {
3833
+ let n = await w.value.updateChatTitle(o.value, e, t);
3834
+ E.value = E.value.map((t) => t.id === e ? {
3861
3835
  ...t,
3862
3836
  title: n.title
3863
3837
  } : t);
3864
3838
  }
3865
3839
  async function ht(e) {
3866
- await T.value.deleteChat(o.value, e), D.value = D.value.filter((t) => t.id !== e), x.value === e && await $e();
3840
+ await w.value.deleteChat(o.value, e), E.value = E.value.filter((t) => t.id !== e), x.value === e && await $e();
3867
3841
  }
3868
3842
  function gt(e) {
3869
- je.value = e;
3843
+ Me.value = e;
3870
3844
  }
3871
3845
  let _t;
3872
3846
  function vt(e) {
3873
- let t = () => T.value.getChat(o.value, e).then((e) => e !== null);
3847
+ let t = () => w.value.getChat(o.value, e).then((e) => e !== null);
3874
3848
  return t().catch(() => t().catch(() => !1));
3875
3849
  }
3876
3850
  return fe(l, async (e) => {
@@ -3880,13 +3854,13 @@ function Br(e) {
3880
3854
  let n = x.value, r = !b.value && await vt(n);
3881
3855
  if (l.value === e && x.value === n) {
3882
3856
  if (r) {
3883
- Le(o.value);
3857
+ Re(o.value);
3884
3858
  return;
3885
3859
  }
3886
- D.value = [], k.value = [], O.value = [], await $e(), Fe.value = "";
3860
+ E.value = [], O.value = [], D.value = [], await $e(), M.value = "";
3887
3861
  }
3888
3862
  }), {
3889
- apiClient: T,
3863
+ apiClient: w,
3890
3864
  baseUrl: i,
3891
3865
  basePath: a,
3892
3866
  agentId: o,
@@ -3900,50 +3874,49 @@ function Br(e) {
3900
3874
  revisedAnswers: m,
3901
3875
  model: h,
3902
3876
  actionsInput: g,
3903
- actions: ge,
3877
+ actions: ve,
3904
3878
  agentFileUpload: _,
3905
3879
  agentVoice: ee,
3906
3880
  fallbackModels: te,
3907
3881
  gatewayOptions: ne,
3908
- externalContext: re,
3882
+ externalContext: se,
3909
3883
  systemTheme: ce,
3910
3884
  hideWelcomeMessage: le,
3911
3885
  isDark: de,
3912
- chat: E,
3913
- messages: De,
3914
- conversations: D,
3915
- isLoadingConversations: ke,
3916
- chatFiles: O,
3917
- isLoadingChatFiles: Ae,
3918
- input: Fe,
3919
- pendingAttachments: P,
3886
+ chat: T,
3887
+ messages: Oe,
3888
+ conversations: E,
3889
+ isLoadingConversations: Ae,
3890
+ chatFiles: D,
3891
+ isLoadingChatFiles: je,
3892
+ input: M,
3893
+ pendingAttachments: N,
3920
3894
  isAttachmentLimitReached: st,
3921
3895
  fileLimitError: ct,
3922
3896
  localChatId: x,
3923
3897
  isConversationBlocked: C,
3924
- inputMessagePlaceholder: Oe,
3898
+ inputMessagePlaceholder: ke,
3925
3899
  chatError: S,
3926
- activeView: je,
3927
- messageFeedbacks: k,
3928
- feedbackDialogMessage: A,
3929
- isFeedbackSubmitting: j,
3930
- isFeedbackSubmitted: M,
3931
- feedbackSubmitError: Me,
3932
- isLeadSubmitted: Ne,
3933
- isLoadingSubmitLead: N,
3934
- submitLeadError: Pe,
3935
- buildDeviceContext: Ce,
3900
+ activeView: Me,
3901
+ messageFeedbacks: O,
3902
+ feedbackDialogMessage: k,
3903
+ isFeedbackSubmitting: Ne,
3904
+ isFeedbackSubmitted: Pe,
3905
+ feedbackSubmitError: Fe,
3906
+ isLeadSubmitted: A,
3907
+ isLoadingSubmitLead: j,
3908
+ submitLeadError: Ie,
3909
+ buildDeviceContext: we,
3936
3910
  initialize: Ye,
3937
- loadConversations: Le,
3938
- loadChatFiles: Re,
3911
+ loadConversations: Re,
3912
+ loadChatFiles: ze,
3939
3913
  refreshMessages: Ge,
3940
3914
  appendMessage: Ke,
3941
- voiceProviderSentences: We,
3942
- getChatFileUrl: ze,
3943
- getChatFilePreviewUrl: Be,
3944
- deleteChatFile: I,
3915
+ getChatFileUrl: Be,
3916
+ getChatFilePreviewUrl: F,
3917
+ deleteChatFile: L,
3945
3918
  handleSubmit: Xe,
3946
- sendMessage: B,
3919
+ sendMessage: z,
3947
3920
  stopGeneration: Ze,
3948
3921
  startNewChat: $e,
3949
3922
  regenerate: et,
@@ -3956,14 +3929,14 @@ function Br(e) {
3956
3929
  onDownvote: ft,
3957
3930
  onFeedback: pt,
3958
3931
  onFeedbackSubmit: mt,
3959
- onLeadSubmit: H,
3932
+ onLeadSubmit: V,
3960
3933
  navigate: gt,
3961
- renameChatTitle: U,
3934
+ renameChatTitle: H,
3962
3935
  deleteChat: ht
3963
3936
  };
3964
3937
  })();
3965
3938
  }
3966
3939
  //#endregion
3967
- export { er as a, Dr as i, Fr as n, L as o, Br as r, Or as t };
3940
+ export { I as a, $n as i, Pr as n, Er as r, Dr as t };
3968
3941
 
3969
- //# sourceMappingURL=useChatbotStore-BcLvyaIV.js.map
3942
+ //# sourceMappingURL=useChatbotStore-DhWHlZwO.js.map