@8wave/ai-elements 0.125.0-beta.18 → 0.125.0-beta.19

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 (34) hide show
  1. package/dist/_chunks/{PkFilePreview-BIFkMsAC.js → PkFilePreview-BzNLupQS.js} +318 -315
  2. package/dist/_chunks/PkFilePreview-BzNLupQS.js.map +1 -0
  3. package/dist/_chunks/{PkFilePreviewDialog-NLk4gZMd.js → PkFilePreviewDialog-BfZFgdOi.js} +2 -2
  4. package/dist/_chunks/{PkFilePreviewDialog-NLk4gZMd.js.map → PkFilePreviewDialog-BfZFgdOi.js.map} +1 -1
  5. package/dist/ai-elements.es.js +205 -202
  6. package/dist/ai-elements.es.js.map +1 -1
  7. package/dist-vue/PkChatbot.js +1 -1
  8. package/dist-vue/PkChatbotViewChat.js +1 -1
  9. package/dist-vue/PkChatbotViewConversations.js +1 -1
  10. package/dist-vue/PkChatbotViewFiles.js +1 -1
  11. package/dist-vue/PkChatbotViewProfile.js +1 -1
  12. package/dist-vue/_chunks/{PkChatbot-DCGQnndK.js → PkChatbot-BVZgvanv.js} +6 -6
  13. package/dist-vue/_chunks/{PkChatbot-DCGQnndK.js.map → PkChatbot-BVZgvanv.js.map} +1 -1
  14. package/dist-vue/_chunks/{PkChatbotViewChat-CHvtUHuO.js → PkChatbotViewChat-C1uzFQCJ.js} +338 -335
  15. package/dist-vue/_chunks/PkChatbotViewChat-C1uzFQCJ.js.map +1 -0
  16. package/dist-vue/_chunks/{PkChatbotViewConversations-7JU_5-F2.js → PkChatbotViewConversations-DjhiHp8-.js} +2 -2
  17. package/dist-vue/_chunks/{PkChatbotViewConversations-7JU_5-F2.js.map → PkChatbotViewConversations-DjhiHp8-.js.map} +1 -1
  18. package/dist-vue/_chunks/{PkChatbotViewFiles-D53wtRPS.js → PkChatbotViewFiles-CtOhnFCc.js} +2 -2
  19. package/dist-vue/_chunks/{PkChatbotViewFiles-D53wtRPS.js.map → PkChatbotViewFiles-CtOhnFCc.js.map} +1 -1
  20. package/dist-vue/_chunks/{PkChatbotViewProfile-BRlLIofM.js → PkChatbotViewProfile-NfTamy9j.js} +2 -2
  21. package/dist-vue/_chunks/{PkChatbotViewProfile-BRlLIofM.js.map → PkChatbotViewProfile-NfTamy9j.js.map} +1 -1
  22. package/dist-vue/_chunks/{PkFilePreview-DLo9nI2g.js → PkFilePreview-C2VOU99H.js} +469 -466
  23. package/dist-vue/_chunks/PkFilePreview-C2VOU99H.js.map +1 -0
  24. package/dist-vue/_chunks/{PkFilePreviewDialog-CgDJQgIJ.js → PkFilePreviewDialog-C6QQMntW.js} +2 -2
  25. package/dist-vue/_chunks/{PkFilePreviewDialog-CgDJQgIJ.js.map → PkFilePreviewDialog-C6QQMntW.js.map} +1 -1
  26. package/dist-vue/_chunks/{useChatbotStore-Bj00X4yT.js → useChatbotStore-BZ1n3Hyx.js} +654 -654
  27. package/dist-vue/_chunks/useChatbotStore-BZ1n3Hyx.js.map +1 -0
  28. package/dist-vue/composables.js +1 -1
  29. package/dist-vue/index.js +6 -6
  30. package/package.json +1 -1
  31. package/dist/_chunks/PkFilePreview-BIFkMsAC.js.map +0 -1
  32. package/dist-vue/_chunks/PkChatbotViewChat-CHvtUHuO.js.map +0 -1
  33. package/dist-vue/_chunks/PkFilePreview-DLo9nI2g.js.map +0 -1
  34. package/dist-vue/_chunks/useChatbotStore-Bj00X4yT.js.map +0 -1
@@ -532,7 +532,7 @@ function P() {
532
532
  }
533
533
  function St(e, t) {
534
534
  let n = { type: "array" };
535
- return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = q(e.type._def, {
535
+ return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = J(e.type._def, {
536
536
  ...t,
537
537
  currentPath: [...t.currentPath, "items"]
538
538
  })), 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;
@@ -558,9 +558,9 @@ function wt() {
558
558
  return { type: "boolean" };
559
559
  }
560
560
  function Tt(e, t) {
561
- return q(e.type._def, t);
561
+ return J(e.type._def, t);
562
562
  }
563
- var F = (e, t) => q(e.innerType._def, t);
563
+ var F = (e, t) => J(e.innerType._def, t);
564
564
  function Et(e, t, n) {
565
565
  let r = n ?? t.dateStrategy;
566
566
  if (Array.isArray(r)) return { anyOf: r.map((n) => Et(e, t, n)) };
@@ -592,12 +592,12 @@ var Dt = (e) => {
592
592
  };
593
593
  function Ot(e, t) {
594
594
  return {
595
- ...q(e.innerType._def, t),
595
+ ...J(e.innerType._def, t),
596
596
  default: e.defaultValue()
597
597
  };
598
598
  }
599
599
  function I(e, t) {
600
- return t.effectStrategy === "input" ? q(e.schema._def, t) : P();
600
+ return t.effectStrategy === "input" ? J(e.schema._def, t) : P();
601
601
  }
602
602
  function L(e) {
603
603
  return {
@@ -607,14 +607,14 @@ function L(e) {
607
607
  }
608
608
  var R = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
609
609
  function kt(e, t) {
610
- let n = [q(e.left._def, {
610
+ let n = [J(e.left._def, {
611
611
  ...t,
612
612
  currentPath: [
613
613
  ...t.currentPath,
614
614
  "allOf",
615
615
  "0"
616
616
  ]
617
- }), q(e.right._def, {
617
+ }), J(e.right._def, {
618
618
  ...t,
619
619
  currentPath: [
620
620
  ...t.currentPath,
@@ -812,7 +812,7 @@ function Ft(e, t) {
812
812
  function It(e, t) {
813
813
  let n = {
814
814
  type: "object",
815
- additionalProperties: q(e.valueType._def, {
815
+ additionalProperties: J(e.valueType._def, {
816
816
  ...t,
817
817
  currentPath: [...t.currentPath, "additionalProperties"]
818
818
  }) ?? t.allowedAdditionalProperties
@@ -843,7 +843,7 @@ function Lt(e, t) {
843
843
  maxItems: 125,
844
844
  items: {
845
845
  type: "array",
846
- items: [q(e.keyType._def, {
846
+ items: [J(e.keyType._def, {
847
847
  ...t,
848
848
  currentPath: [
849
849
  ...t.currentPath,
@@ -851,7 +851,7 @@ function Lt(e, t) {
851
851
  "items",
852
852
  "0"
853
853
  ]
854
- }) || P(), q(e.valueType._def, {
854
+ }) || P(), J(e.valueType._def, {
855
855
  ...t,
856
856
  currentPath: [
857
857
  ...t.currentPath,
@@ -920,7 +920,7 @@ function Vt(e, t) {
920
920
  return Ht(e, t);
921
921
  }
922
922
  var Ht = (e, t) => {
923
- let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => q(e._def, {
923
+ let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => J(e._def, {
924
924
  ...t,
925
925
  currentPath: [
926
926
  ...t.currentPath,
@@ -930,7 +930,7 @@ var Ht = (e, t) => {
930
930
  })).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
931
931
  return n.length ? { anyOf: n } : void 0;
932
932
  };
933
- function Ut(e, t) {
933
+ function W(e, t) {
934
934
  if ([
935
935
  "ZodString",
936
936
  "ZodNumber",
@@ -938,7 +938,7 @@ function Ut(e, t) {
938
938
  "ZodBoolean",
939
939
  "ZodNull"
940
940
  ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Bt[e.innerType._def.typeName], "null"] };
941
- let n = q(e.innerType._def, {
941
+ let n = J(e.innerType._def, {
942
942
  ...t,
943
943
  currentPath: [
944
944
  ...t.currentPath,
@@ -948,7 +948,7 @@ function Ut(e, t) {
948
948
  });
949
949
  return n && { anyOf: [n, { type: "null" }] };
950
950
  }
951
- function Wt(e) {
951
+ function Ut(e) {
952
952
  let t = { type: "number" };
953
953
  if (!e.checks) return t;
954
954
  for (let n of e.checks) switch (n.kind) {
@@ -965,7 +965,7 @@ function Wt(e) {
965
965
  }
966
966
  return t;
967
967
  }
968
- function Gt(e, t) {
968
+ function Wt(e, t) {
969
969
  let n = {
970
970
  type: "object",
971
971
  properties: {}
@@ -973,7 +973,7 @@ function Gt(e, t) {
973
973
  for (let e in i) {
974
974
  let a = i[e];
975
975
  if (a === void 0 || a._def === void 0) continue;
976
- let o = qt(a), s = q(a._def, {
976
+ let o = Kt(a), s = J(a._def, {
977
977
  ...t,
978
978
  currentPath: [
979
979
  ...t.currentPath,
@@ -989,11 +989,11 @@ function Gt(e, t) {
989
989
  s !== void 0 && (n.properties[e] = s, o || r.push(e));
990
990
  }
991
991
  r.length && (n.required = r);
992
- let a = Kt(e, t);
992
+ let a = Gt(e, t);
993
993
  return a !== void 0 && (n.additionalProperties = a), n;
994
994
  }
995
- function Kt(e, t) {
996
- if (e.catchall._def.typeName !== "ZodNever") return q(e.catchall._def, {
995
+ function Gt(e, t) {
996
+ if (e.catchall._def.typeName !== "ZodNever") return J(e.catchall._def, {
997
997
  ...t,
998
998
  currentPath: [...t.currentPath, "additionalProperties"]
999
999
  });
@@ -1003,16 +1003,16 @@ function Kt(e, t) {
1003
1003
  case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
1004
1004
  }
1005
1005
  }
1006
- function qt(e) {
1006
+ function Kt(e) {
1007
1007
  try {
1008
1008
  return e.isOptional();
1009
1009
  } catch {
1010
1010
  return !0;
1011
1011
  }
1012
1012
  }
1013
- var Jt = (e, t) => {
1014
- if (t.currentPath.toString() === t.propertyPath?.toString()) return q(e.innerType._def, t);
1015
- let n = q(e.innerType._def, {
1013
+ var qt = (e, t) => {
1014
+ if (t.currentPath.toString() === t.propertyPath?.toString()) return J(e.innerType._def, t);
1015
+ let n = J(e.innerType._def, {
1016
1016
  ...t,
1017
1017
  currentPath: [
1018
1018
  ...t.currentPath,
@@ -1021,10 +1021,10 @@ var Jt = (e, t) => {
1021
1021
  ]
1022
1022
  });
1023
1023
  return n ? { anyOf: [{ not: P() }, n] } : P();
1024
- }, Yt = (e, t) => {
1025
- if (t.pipeStrategy === "input") return q(e.in._def, t);
1026
- if (t.pipeStrategy === "output") return q(e.out._def, t);
1027
- let n = q(e.in._def, {
1024
+ }, Jt = (e, t) => {
1025
+ if (t.pipeStrategy === "input") return J(e.in._def, t);
1026
+ if (t.pipeStrategy === "output") return J(e.out._def, t);
1027
+ let n = J(e.in._def, {
1028
1028
  ...t,
1029
1029
  currentPath: [
1030
1030
  ...t.currentPath,
@@ -1032,7 +1032,7 @@ var Jt = (e, t) => {
1032
1032
  "0"
1033
1033
  ]
1034
1034
  });
1035
- return { allOf: [n, q(e.out._def, {
1035
+ return { allOf: [n, J(e.out._def, {
1036
1036
  ...t,
1037
1037
  currentPath: [
1038
1038
  ...t.currentPath,
@@ -1041,25 +1041,25 @@ var Jt = (e, t) => {
1041
1041
  ]
1042
1042
  })].filter((e) => e !== void 0) };
1043
1043
  };
1044
- function Xt(e, t) {
1045
- return q(e.type._def, t);
1044
+ function Yt(e, t) {
1045
+ return J(e.type._def, t);
1046
1046
  }
1047
- function Zt(e, t) {
1047
+ function Xt(e, t) {
1048
1048
  let n = {
1049
1049
  type: "array",
1050
1050
  uniqueItems: !0,
1051
- items: q(e.valueType._def, {
1051
+ items: J(e.valueType._def, {
1052
1052
  ...t,
1053
1053
  currentPath: [...t.currentPath, "items"]
1054
1054
  })
1055
1055
  };
1056
1056
  return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
1057
1057
  }
1058
- function Qt(e, t) {
1058
+ function Zt(e, t) {
1059
1059
  return e.rest ? {
1060
1060
  type: "array",
1061
1061
  minItems: e.items.length,
1062
- items: e.items.map((e, n) => q(e._def, {
1062
+ items: e.items.map((e, n) => J(e._def, {
1063
1063
  ...t,
1064
1064
  currentPath: [
1065
1065
  ...t.currentPath,
@@ -1067,7 +1067,7 @@ function Qt(e, t) {
1067
1067
  `${n}`
1068
1068
  ]
1069
1069
  })).reduce((e, t) => t === void 0 ? e : [...e, t], []),
1070
- additionalItems: q(e.rest._def, {
1070
+ additionalItems: J(e.rest._def, {
1071
1071
  ...t,
1072
1072
  currentPath: [...t.currentPath, "additionalItems"]
1073
1073
  })
@@ -1075,7 +1075,7 @@ function Qt(e, t) {
1075
1075
  type: "array",
1076
1076
  minItems: e.items.length,
1077
1077
  maxItems: e.items.length,
1078
- items: e.items.map((e, n) => q(e._def, {
1078
+ items: e.items.map((e, n) => J(e._def, {
1079
1079
  ...t,
1080
1080
  currentPath: [
1081
1081
  ...t.currentPath,
@@ -1085,47 +1085,47 @@ function Qt(e, t) {
1085
1085
  })).reduce((e, t) => t === void 0 ? e : [...e, t], [])
1086
1086
  };
1087
1087
  }
1088
- function $t() {
1088
+ function Qt() {
1089
1089
  return { not: P() };
1090
1090
  }
1091
- function en() {
1091
+ function $t() {
1092
1092
  return P();
1093
1093
  }
1094
- var W = (e, t) => q(e.innerType._def, t), G = (e, t, n) => {
1094
+ var G = (e, t) => J(e.innerType._def, t), K = (e, t, n) => {
1095
1095
  switch (t) {
1096
1096
  case "ZodString": return Mt(e, n);
1097
- case "ZodNumber": return Wt(e);
1098
- case "ZodObject": return Gt(e, n);
1097
+ case "ZodNumber": return Ut(e);
1098
+ case "ZodObject": return Wt(e, n);
1099
1099
  case "ZodBigInt": return Ct(e);
1100
1100
  case "ZodBoolean": return wt();
1101
1101
  case "ZodDate": return Et(e, n);
1102
- case "ZodUndefined": return $t();
1102
+ case "ZodUndefined": return Qt();
1103
1103
  case "ZodNull": return zt();
1104
1104
  case "ZodArray": return St(e, n);
1105
1105
  case "ZodUnion":
1106
1106
  case "ZodDiscriminatedUnion": return Vt(e, n);
1107
1107
  case "ZodIntersection": return kt(e, n);
1108
- case "ZodTuple": return Qt(e, n);
1108
+ case "ZodTuple": return Zt(e, n);
1109
1109
  case "ZodRecord": return It(e, n);
1110
1110
  case "ZodLiteral": return At(e);
1111
1111
  case "ZodEnum": return L(e);
1112
1112
  case "ZodNativeEnum": return U(e);
1113
- case "ZodNullable": return Ut(e, n);
1114
- case "ZodOptional": return Jt(e, n);
1113
+ case "ZodNullable": return W(e, n);
1114
+ case "ZodOptional": return qt(e, n);
1115
1115
  case "ZodMap": return Lt(e, n);
1116
- case "ZodSet": return Zt(e, n);
1116
+ case "ZodSet": return Xt(e, n);
1117
1117
  case "ZodLazy": return () => e.getter()._def;
1118
- case "ZodPromise": return Xt(e, n);
1118
+ case "ZodPromise": return Yt(e, n);
1119
1119
  case "ZodNaN":
1120
1120
  case "ZodNever": return Rt();
1121
1121
  case "ZodEffects": return I(e, n);
1122
1122
  case "ZodAny": return P();
1123
- case "ZodUnknown": return en();
1123
+ case "ZodUnknown": return $t();
1124
1124
  case "ZodDefault": return Ot(e, n);
1125
1125
  case "ZodBranded": return Tt(e, n);
1126
- case "ZodReadonly": return W(e, n);
1126
+ case "ZodReadonly": return G(e, n);
1127
1127
  case "ZodCatch": return F(e, n);
1128
- case "ZodPipeline": return Yt(e, n);
1128
+ case "ZodPipeline": return Jt(e, n);
1129
1129
  case "ZodFunction":
1130
1130
  case "ZodVoid":
1131
1131
  case "ZodSymbol": return;
@@ -1133,19 +1133,19 @@ var W = (e, t) => q(e.innerType._def, t), G = (e, t, n) => {
1133
1133
  /* c8 ignore next */
1134
1134
  return ((e) => void 0)(t);
1135
1135
  }
1136
- }, K = (e, t) => {
1136
+ }, q = (e, t) => {
1137
1137
  let n = 0;
1138
1138
  for (; n < e.length && n < t.length && e[n] === t[n]; n++);
1139
1139
  return [(e.length - n).toString(), ...t.slice(n)].join("/");
1140
1140
  };
1141
- function q(e, t, n = !1) {
1141
+ function J(e, t, n = !1) {
1142
1142
  let r = t.seen.get(e);
1143
1143
  if (t.override) {
1144
1144
  let i = t.override?.(e, t, r, n);
1145
1145
  if (i !== yt) return i;
1146
1146
  }
1147
1147
  if (r && !n) {
1148
- let e = tn(r, t);
1148
+ let e = en(r, t);
1149
1149
  if (e !== void 0) return e;
1150
1150
  }
1151
1151
  let i = {
@@ -1154,21 +1154,21 @@ function q(e, t, n = !1) {
1154
1154
  jsonSchema: void 0
1155
1155
  };
1156
1156
  t.seen.set(e, i);
1157
- let a = G(e, e.typeName, t), o = typeof a == "function" ? q(a(), t) : a;
1158
- if (o && nn(e, t, o), t.postProcess) {
1157
+ let a = K(e, e.typeName, t), o = typeof a == "function" ? J(a(), t) : a;
1158
+ if (o && tn(e, t, o), t.postProcess) {
1159
1159
  let n = t.postProcess(o, e, t);
1160
1160
  return i.jsonSchema = o, n;
1161
1161
  }
1162
1162
  return i.jsonSchema = o, o;
1163
1163
  }
1164
- var tn = (e, t) => {
1164
+ var en = (e, t) => {
1165
1165
  switch (t.$refStrategy) {
1166
1166
  case "root": return { $ref: e.path.join("/") };
1167
- case "relative": return { $ref: K(t.currentPath, e.path) };
1167
+ case "relative": return { $ref: q(t.currentPath, e.path) };
1168
1168
  case "none":
1169
1169
  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`), P()) : t.$refStrategy === "seen" ? P() : void 0;
1170
1170
  }
1171
- }, nn = (e, t, n) => (e.description && (n.description = e.description), n), rn = (e) => {
1171
+ }, tn = (e, t, n) => (e.description && (n.description = e.description), n), nn = (e) => {
1172
1172
  let t = xt(e), n = t.name === void 0 ? t.basePath : [
1173
1173
  ...t.basePath,
1174
1174
  t.definitionPath,
@@ -1188,10 +1188,10 @@ var tn = (e, t) => {
1188
1188
  jsonSchema: void 0
1189
1189
  }]))
1190
1190
  };
1191
- }, an = (e, t) => {
1192
- let n = rn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1191
+ }, rn = (e, t) => {
1192
+ let n = nn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1193
1193
  ...e,
1194
- [t]: q(r._def, {
1194
+ [t]: J(r._def, {
1195
1195
  ...n,
1196
1196
  currentPath: [
1197
1197
  ...n.basePath,
@@ -1199,7 +1199,7 @@ var tn = (e, t) => {
1199
1199
  t
1200
1200
  ]
1201
1201
  }, !0) ?? P()
1202
- }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = q(e._def, i === void 0 ? n : {
1202
+ }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = J(e._def, i === void 0 ? n : {
1203
1203
  ...n,
1204
1204
  currentPath: [
1205
1205
  ...n.basePath,
@@ -1223,14 +1223,14 @@ var tn = (e, t) => {
1223
1223
  }
1224
1224
  };
1225
1225
  return s.$schema = "http://json-schema.org/draft-07/schema#", s;
1226
- }, on = Symbol.for("vercel.ai.schema");
1227
- function sn(e) {
1226
+ }, an = Symbol.for("vercel.ai.schema");
1227
+ function on(e) {
1228
1228
  let t;
1229
1229
  return () => (t ??= e(), t);
1230
1230
  }
1231
- function cn(e, { validate: t } = {}) {
1231
+ function sn(e, { validate: t } = {}) {
1232
1232
  return {
1233
- [on]: !0,
1233
+ [an]: !0,
1234
1234
  _type: void 0,
1235
1235
  get jsonSchema() {
1236
1236
  return typeof e == "function" && (e = e()), e;
@@ -1238,19 +1238,19 @@ function cn(e, { validate: t } = {}) {
1238
1238
  validate: t
1239
1239
  };
1240
1240
  }
1241
- function ln(e) {
1242
- return typeof e == "object" && !!e && on in e && e[on] === !0 && "jsonSchema" in e && "validate" in e;
1241
+ function cn(e) {
1242
+ return typeof e == "object" && !!e && an in e && e[an] === !0 && "jsonSchema" in e && "validate" in e;
1243
1243
  }
1244
- function un(e) {
1245
- return e == null ? cn({
1244
+ function ln(e) {
1245
+ return e == null ? sn({
1246
1246
  type: "object",
1247
1247
  properties: {},
1248
1248
  additionalProperties: !1
1249
- }) : ln(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? gn(e) : dn(e) : e();
1249
+ }) : cn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? hn(e) : un(e) : e();
1250
1250
  }
1251
- function dn(e) {
1252
- return cn(() => {
1253
- if (!fn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1251
+ function un(e) {
1252
+ return sn(() => {
1253
+ if (!dn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1254
1254
  return vt(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1255
1255
  }, { validate: async (t) => {
1256
1256
  let n = await e["~standard"].validate(t);
@@ -1266,12 +1266,12 @@ function dn(e) {
1266
1266
  };
1267
1267
  } });
1268
1268
  }
1269
- function fn(e) {
1269
+ function dn(e) {
1270
1270
  return e["~standard"].jsonSchema != null;
1271
1271
  }
1272
- function pn(e, t) {
1272
+ function fn(e, t) {
1273
1273
  let n = t?.useReferences ?? !1;
1274
- return cn(() => an(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1274
+ return sn(() => rn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1275
1275
  let n = await e.safeParseAsync(t);
1276
1276
  return n.success ? {
1277
1277
  success: !0,
@@ -1282,9 +1282,9 @@ function pn(e, t) {
1282
1282
  };
1283
1283
  } });
1284
1284
  }
1285
- function mn(e, r) {
1285
+ function pn(e, r) {
1286
1286
  let i = r?.useReferences ?? !1;
1287
- return cn(() => vt(n(e, {
1287
+ return sn(() => vt(n(e, {
1288
1288
  target: "draft-7",
1289
1289
  io: "input",
1290
1290
  reused: i ? "ref" : "inline"
@@ -1299,14 +1299,14 @@ function mn(e, r) {
1299
1299
  };
1300
1300
  } });
1301
1301
  }
1302
- function hn(e) {
1302
+ function mn(e) {
1303
1303
  return "_zod" in e;
1304
1304
  }
1305
- function gn(e, t) {
1306
- return hn(e) ? mn(e, t) : pn(e, t);
1305
+ function hn(e, t) {
1306
+ return mn(e) ? pn(e, t) : fn(e, t);
1307
1307
  }
1308
- async function _n({ value: e, schema: t, context: n }) {
1309
- let r = await vn({
1308
+ async function gn({ value: e, schema: t, context: n }) {
1309
+ let r = await _n({
1310
1310
  value: e,
1311
1311
  schema: t,
1312
1312
  context: n
@@ -1318,8 +1318,8 @@ async function _n({ value: e, schema: t, context: n }) {
1318
1318
  });
1319
1319
  return r.value;
1320
1320
  }
1321
- async function vn({ value: e, schema: t, context: n }) {
1322
- let r = un(t);
1321
+ async function _n({ value: e, schema: t, context: n }) {
1322
+ let r = ln(t);
1323
1323
  try {
1324
1324
  if (r.validate == null) return {
1325
1325
  success: !0,
@@ -1352,14 +1352,14 @@ async function vn({ value: e, schema: t, context: n }) {
1352
1352
  };
1353
1353
  }
1354
1354
  }
1355
- async function yn({ text: e, schema: t }) {
1355
+ async function vn({ text: e, schema: t }) {
1356
1356
  try {
1357
1357
  let n = M(e);
1358
1358
  return t == null ? {
1359
1359
  success: !0,
1360
1360
  value: n,
1361
1361
  rawValue: n
1362
- } : await vn({
1362
+ } : await _n({
1363
1363
  value: n,
1364
1364
  schema: t
1365
1365
  });
@@ -1374,41 +1374,41 @@ async function yn({ text: e, schema: t }) {
1374
1374
  };
1375
1375
  }
1376
1376
  }
1377
- function bn({ stream: e, schema: t }) {
1377
+ function yn({ stream: e, schema: t }) {
1378
1378
  return e.pipeThrough(new TextDecoderStream()).pipeThrough(new lt()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1379
- e !== "[DONE]" && n.enqueue(await yn({
1379
+ e !== "[DONE]" && n.enqueue(await vn({
1380
1380
  text: e,
1381
1381
  schema: t
1382
1382
  }));
1383
1383
  } }));
1384
1384
  }
1385
- async function xn(e) {
1385
+ async function bn(e) {
1386
1386
  return typeof e == "function" && (e = e()), e;
1387
1387
  }
1388
1388
  new TextDecoder();
1389
1389
  // ../../node_modules/.pnpm/ai@7.0.154_zod@4.6.7/node_modules/ai/dist/index.js
1390
- var J = "AI_InvalidArgumentError", Sn = `vercel.ai.error.${J}`, Cn = Symbol.for(Sn), wn = class extends w {
1390
+ var xn = "AI_InvalidArgumentError", Y = `vercel.ai.error.${xn}`, Sn = Symbol.for(Y), Cn = class extends w {
1391
1391
  constructor({ parameter: e, value: t, message: n }) {
1392
1392
  super({
1393
- name: J,
1393
+ name: xn,
1394
1394
  message: `Invalid argument for parameter ${e}: ${n}`
1395
- }), this[Cn] = !0, this.parameter = e, this.value = t;
1395
+ }), this[Sn] = !0, this.parameter = e, this.value = t;
1396
1396
  }
1397
1397
  static isInstance(e) {
1398
- return w.hasMarker(e, Sn);
1398
+ return w.hasMarker(e, Y);
1399
1399
  }
1400
- }, Tn = "AI_UIMessageStreamError", En = `vercel.ai.error.${Tn}`, Dn = Symbol.for(En), On = class extends w {
1400
+ }, wn = "AI_UIMessageStreamError", Tn = `vercel.ai.error.${wn}`, En = Symbol.for(Tn), Dn = class extends w {
1401
1401
  constructor({ chunkType: e, chunkId: t, message: n }) {
1402
1402
  super({
1403
- name: Tn,
1403
+ name: wn,
1404
1404
  message: n
1405
- }), this[Dn] = !0, this.chunkType = e, this.chunkId = t;
1405
+ }), this[En] = !0, this.chunkType = e, this.chunkId = t;
1406
1406
  }
1407
1407
  static isInstance(e) {
1408
- return w.hasMarker(e, En);
1408
+ return w.hasMarker(e, Tn);
1409
1409
  }
1410
1410
  };
1411
- function kn(e, t) {
1411
+ function On(e, t) {
1412
1412
  if (e === void 0 && t === void 0) return;
1413
1413
  if (e === void 0) return t;
1414
1414
  if (t === void 0) return e;
@@ -1417,11 +1417,11 @@ function kn(e, t) {
1417
1417
  let i = t[r];
1418
1418
  if (i === void 0) continue;
1419
1419
  let a = r in e ? e[r] : void 0, o = typeof i == "object" && !!i && !Array.isArray(i) && !(i instanceof Date) && !(i instanceof RegExp), s = typeof a == "object" && !!a && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof RegExp);
1420
- n[r] = o && s ? kn(a, i) : i;
1420
+ n[r] = o && s ? On(a, i) : i;
1421
1421
  }
1422
1422
  return n;
1423
1423
  }
1424
- var Y = {
1424
+ var X = {
1425
1425
  array: d,
1426
1426
  boolean: m,
1427
1427
  custom: l,
@@ -1439,230 +1439,230 @@ var Y = {
1439
1439
  string: r,
1440
1440
  union: e,
1441
1441
  unknown: _
1442
- }, An = Y.lazy(() => Y.union([
1443
- Y.null(),
1444
- Y.string(),
1445
- Y.number(),
1446
- Y.boolean(),
1447
- Y.record(Y.string(), An.optional()),
1448
- Y.array(An)
1449
- ])), X = Y.record(Y.string(), Y.record(Y.string(), An.optional())), jn = Y.union([
1450
- Y.string(),
1451
- Y.instanceof(Uint8Array),
1452
- Y.instanceof(ArrayBuffer),
1453
- Y.custom(pt, { message: "Must be a Buffer" })
1454
- ]), Mn = Y.record(Y.string(), Y.string()), Nn = Y.object({
1455
- type: Y.literal("text"),
1456
- text: Y.string(),
1457
- providerOptions: X.optional()
1458
- }), Pn = Y.object({
1459
- type: Y.literal("image"),
1460
- image: Y.union([
1461
- jn,
1462
- Y.instanceof(URL),
1463
- Mn
1442
+ }, kn = X.lazy(() => X.union([
1443
+ X.null(),
1444
+ X.string(),
1445
+ X.number(),
1446
+ X.boolean(),
1447
+ X.record(X.string(), kn.optional()),
1448
+ X.array(kn)
1449
+ ])), Z = X.record(X.string(), X.record(X.string(), kn.optional())), An = X.union([
1450
+ X.string(),
1451
+ X.instanceof(Uint8Array),
1452
+ X.instanceof(ArrayBuffer),
1453
+ X.custom(pt, { message: "Must be a Buffer" })
1454
+ ]), jn = X.record(X.string(), X.string()), Mn = X.object({
1455
+ type: X.literal("text"),
1456
+ text: X.string(),
1457
+ providerOptions: Z.optional()
1458
+ }), Nn = X.object({
1459
+ type: X.literal("image"),
1460
+ image: X.union([
1461
+ An,
1462
+ X.instanceof(URL),
1463
+ jn
1464
1464
  ]),
1465
- mediaType: Y.string().optional(),
1466
- providerOptions: X.optional()
1467
- }), Fn = Y.discriminatedUnion("type", [
1468
- Y.object({
1469
- type: Y.literal("data"),
1470
- data: jn
1465
+ mediaType: X.string().optional(),
1466
+ providerOptions: Z.optional()
1467
+ }), Pn = X.discriminatedUnion("type", [
1468
+ X.object({
1469
+ type: X.literal("data"),
1470
+ data: An
1471
1471
  }),
1472
- Y.object({
1473
- type: Y.literal("url"),
1474
- url: Y.instanceof(URL)
1472
+ X.object({
1473
+ type: X.literal("url"),
1474
+ url: X.instanceof(URL)
1475
1475
  }),
1476
- Y.object({
1477
- type: Y.literal("reference"),
1478
- reference: Mn
1476
+ X.object({
1477
+ type: X.literal("reference"),
1478
+ reference: jn
1479
1479
  }),
1480
- Y.object({
1481
- type: Y.literal("text"),
1482
- text: Y.string()
1480
+ X.object({
1481
+ type: X.literal("text"),
1482
+ text: X.string()
1483
1483
  })
1484
- ]), In = Y.discriminatedUnion("type", [Y.object({
1485
- type: Y.literal("data"),
1486
- data: jn
1487
- }), Y.object({
1488
- type: Y.literal("url"),
1489
- url: Y.instanceof(URL)
1490
- })]), Ln = Y.object({
1491
- type: Y.literal("file"),
1492
- data: Y.union([
1493
- Fn,
1494
- jn,
1495
- Y.instanceof(URL),
1496
- Mn
1484
+ ]), Fn = X.discriminatedUnion("type", [X.object({
1485
+ type: X.literal("data"),
1486
+ data: An
1487
+ }), X.object({
1488
+ type: X.literal("url"),
1489
+ url: X.instanceof(URL)
1490
+ })]), In = X.object({
1491
+ type: X.literal("file"),
1492
+ data: X.union([
1493
+ Pn,
1494
+ An,
1495
+ X.instanceof(URL),
1496
+ jn
1497
1497
  ]),
1498
- filename: Y.string().optional(),
1499
- mediaType: Y.string(),
1500
- providerOptions: X.optional()
1501
- }), Rn = Y.object({
1502
- type: Y.literal("reasoning"),
1503
- text: Y.string(),
1504
- providerOptions: X.optional()
1505
- }), zn = Y.object({
1506
- type: Y.literal("custom"),
1507
- kind: Y.string().transform((e) => e),
1508
- providerOptions: X.optional()
1509
- }), Bn = Y.object({
1510
- type: Y.literal("reasoning-file"),
1511
- data: Y.union([
1512
- In,
1513
- jn,
1514
- Y.instanceof(URL)
1498
+ filename: X.string().optional(),
1499
+ mediaType: X.string(),
1500
+ providerOptions: Z.optional()
1501
+ }), Ln = X.object({
1502
+ type: X.literal("reasoning"),
1503
+ text: X.string(),
1504
+ providerOptions: Z.optional()
1505
+ }), Rn = X.object({
1506
+ type: X.literal("custom"),
1507
+ kind: X.string().transform((e) => e),
1508
+ providerOptions: Z.optional()
1509
+ }), zn = X.object({
1510
+ type: X.literal("reasoning-file"),
1511
+ data: X.union([
1512
+ Fn,
1513
+ An,
1514
+ X.instanceof(URL)
1515
1515
  ]),
1516
- mediaType: Y.string(),
1517
- providerOptions: X.optional()
1518
- }), Vn = Y.object({
1519
- type: Y.literal("tool-call"),
1520
- toolCallId: Y.string(),
1521
- toolName: Y.string(),
1522
- input: Y.unknown(),
1523
- providerOptions: X.optional(),
1524
- providerExecuted: Y.boolean().optional()
1525
- }), Hn = Y.discriminatedUnion("type", [
1526
- Y.object({
1527
- type: Y.literal("text"),
1528
- value: Y.string(),
1529
- providerOptions: X.optional()
1516
+ mediaType: X.string(),
1517
+ providerOptions: Z.optional()
1518
+ }), Bn = X.object({
1519
+ type: X.literal("tool-call"),
1520
+ toolCallId: X.string(),
1521
+ toolName: X.string(),
1522
+ input: X.unknown(),
1523
+ providerOptions: Z.optional(),
1524
+ providerExecuted: X.boolean().optional()
1525
+ }), Vn = X.discriminatedUnion("type", [
1526
+ X.object({
1527
+ type: X.literal("text"),
1528
+ value: X.string(),
1529
+ providerOptions: Z.optional()
1530
1530
  }),
1531
- Y.object({
1532
- type: Y.literal("json"),
1533
- value: An,
1534
- providerOptions: X.optional()
1531
+ X.object({
1532
+ type: X.literal("json"),
1533
+ value: kn,
1534
+ providerOptions: Z.optional()
1535
1535
  }),
1536
- Y.object({
1537
- type: Y.literal("execution-denied"),
1538
- reason: Y.string().optional(),
1539
- providerOptions: X.optional()
1536
+ X.object({
1537
+ type: X.literal("execution-denied"),
1538
+ reason: X.string().optional(),
1539
+ providerOptions: Z.optional()
1540
1540
  }),
1541
- Y.object({
1542
- type: Y.literal("error-text"),
1543
- value: Y.string(),
1544
- providerOptions: X.optional()
1541
+ X.object({
1542
+ type: X.literal("error-text"),
1543
+ value: X.string(),
1544
+ providerOptions: Z.optional()
1545
1545
  }),
1546
- Y.object({
1547
- type: Y.literal("error-json"),
1548
- value: An,
1549
- providerOptions: X.optional()
1546
+ X.object({
1547
+ type: X.literal("error-json"),
1548
+ value: kn,
1549
+ providerOptions: Z.optional()
1550
1550
  }),
1551
- Y.object({
1552
- type: Y.literal("content"),
1553
- value: Y.array(Y.union([
1554
- Y.object({
1555
- type: Y.literal("text"),
1556
- text: Y.string(),
1557
- providerOptions: X.optional()
1551
+ X.object({
1552
+ type: X.literal("content"),
1553
+ value: X.array(X.union([
1554
+ X.object({
1555
+ type: X.literal("text"),
1556
+ text: X.string(),
1557
+ providerOptions: Z.optional()
1558
1558
  }),
1559
- Y.object({
1560
- type: Y.literal("file"),
1561
- data: Fn,
1562
- mediaType: Y.string(),
1563
- filename: Y.string().optional(),
1564
- providerOptions: X.optional()
1559
+ X.object({
1560
+ type: X.literal("file"),
1561
+ data: Pn,
1562
+ mediaType: X.string(),
1563
+ filename: X.string().optional(),
1564
+ providerOptions: Z.optional()
1565
1565
  }),
1566
- Y.object({
1567
- type: Y.literal("file-data"),
1568
- data: Y.string(),
1569
- mediaType: Y.string(),
1570
- filename: Y.string().optional(),
1571
- providerOptions: X.optional()
1566
+ X.object({
1567
+ type: X.literal("file-data"),
1568
+ data: X.string(),
1569
+ mediaType: X.string(),
1570
+ filename: X.string().optional(),
1571
+ providerOptions: Z.optional()
1572
1572
  }),
1573
- Y.object({
1574
- type: Y.literal("file-url"),
1575
- url: Y.string(),
1576
- mediaType: Y.string().optional(),
1577
- providerOptions: X.optional()
1573
+ X.object({
1574
+ type: X.literal("file-url"),
1575
+ url: X.string(),
1576
+ mediaType: X.string().optional(),
1577
+ providerOptions: Z.optional()
1578
1578
  }),
1579
- Y.object({
1580
- type: Y.literal("file-id"),
1581
- fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1582
- providerOptions: X.optional()
1579
+ X.object({
1580
+ type: X.literal("file-id"),
1581
+ fileId: X.union([X.string(), X.record(X.string(), X.string())]),
1582
+ providerOptions: Z.optional()
1583
1583
  }),
1584
- Y.object({
1585
- type: Y.literal("file-reference"),
1586
- providerReference: Y.record(Y.string(), Y.string()),
1587
- providerOptions: X.optional()
1584
+ X.object({
1585
+ type: X.literal("file-reference"),
1586
+ providerReference: X.record(X.string(), X.string()),
1587
+ providerOptions: Z.optional()
1588
1588
  }),
1589
- Y.object({
1590
- type: Y.literal("image-data"),
1591
- data: Y.string(),
1592
- mediaType: Y.string(),
1593
- providerOptions: X.optional()
1589
+ X.object({
1590
+ type: X.literal("image-data"),
1591
+ data: X.string(),
1592
+ mediaType: X.string(),
1593
+ providerOptions: Z.optional()
1594
1594
  }),
1595
- Y.object({
1596
- type: Y.literal("image-url"),
1597
- url: Y.string(),
1598
- providerOptions: X.optional()
1595
+ X.object({
1596
+ type: X.literal("image-url"),
1597
+ url: X.string(),
1598
+ providerOptions: Z.optional()
1599
1599
  }),
1600
- Y.object({
1601
- type: Y.literal("image-file-id"),
1602
- fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1603
- providerOptions: X.optional()
1600
+ X.object({
1601
+ type: X.literal("image-file-id"),
1602
+ fileId: X.union([X.string(), X.record(X.string(), X.string())]),
1603
+ providerOptions: Z.optional()
1604
1604
  }),
1605
- Y.object({
1606
- type: Y.literal("image-file-reference"),
1607
- providerReference: Y.record(Y.string(), Y.string()),
1608
- providerOptions: X.optional()
1605
+ X.object({
1606
+ type: X.literal("image-file-reference"),
1607
+ providerReference: X.record(X.string(), X.string()),
1608
+ providerOptions: Z.optional()
1609
1609
  }),
1610
- Y.object({
1611
- type: Y.literal("custom"),
1612
- providerOptions: X.optional()
1610
+ X.object({
1611
+ type: X.literal("custom"),
1612
+ providerOptions: Z.optional()
1613
1613
  })
1614
1614
  ]))
1615
1615
  })
1616
- ]), Z = Y.object({
1617
- type: Y.literal("tool-result"),
1618
- toolCallId: Y.string(),
1619
- toolName: Y.string(),
1620
- output: Hn,
1621
- providerOptions: X.optional()
1622
- }), Un = Y.object({
1623
- type: Y.literal("tool-approval-request"),
1624
- approvalId: Y.string(),
1625
- toolCallId: Y.string(),
1626
- reason: Y.string().optional(),
1627
- isAutomatic: Y.boolean().optional(),
1628
- signature: Y.string().optional(),
1629
- inputSchemaInput: Y.unknown().optional()
1630
- }), Wn = Y.object({
1631
- type: Y.literal("tool-approval-response"),
1632
- approvalId: Y.string(),
1633
- approved: Y.boolean(),
1634
- reason: Y.string().optional()
1635
- }), Gn = Y.object({
1636
- role: Y.literal("system"),
1637
- content: Y.string(),
1638
- providerOptions: X.optional()
1639
- }), Kn = Y.object({
1640
- role: Y.literal("user"),
1641
- content: Y.union([Y.string(), Y.array(Y.union([
1616
+ ]), Hn = X.object({
1617
+ type: X.literal("tool-result"),
1618
+ toolCallId: X.string(),
1619
+ toolName: X.string(),
1620
+ output: Vn,
1621
+ providerOptions: Z.optional()
1622
+ }), Un = X.object({
1623
+ type: X.literal("tool-approval-request"),
1624
+ approvalId: X.string(),
1625
+ toolCallId: X.string(),
1626
+ reason: X.string().optional(),
1627
+ isAutomatic: X.boolean().optional(),
1628
+ signature: X.string().optional(),
1629
+ inputSchemaInput: X.unknown().optional()
1630
+ }), Wn = X.object({
1631
+ type: X.literal("tool-approval-response"),
1632
+ approvalId: X.string(),
1633
+ approved: X.boolean(),
1634
+ reason: X.string().optional()
1635
+ }), Gn = X.object({
1636
+ role: X.literal("system"),
1637
+ content: X.string(),
1638
+ providerOptions: Z.optional()
1639
+ }), Kn = X.object({
1640
+ role: X.literal("user"),
1641
+ content: X.union([X.string(), X.array(X.union([
1642
+ Mn,
1642
1643
  Nn,
1643
- Pn,
1644
- Ln
1644
+ In
1645
1645
  ]))]),
1646
- providerOptions: X.optional()
1647
- }), qn = Y.object({
1648
- role: Y.literal("assistant"),
1649
- content: Y.union([Y.string(), Y.array(Y.union([
1650
- Nn,
1651
- zn,
1652
- Ln,
1646
+ providerOptions: Z.optional()
1647
+ }), qn = X.object({
1648
+ role: X.literal("assistant"),
1649
+ content: X.union([X.string(), X.array(X.union([
1650
+ Mn,
1653
1651
  Rn,
1652
+ In,
1653
+ Ln,
1654
+ zn,
1654
1655
  Bn,
1655
- Vn,
1656
- Z,
1656
+ Hn,
1657
1657
  Un
1658
1658
  ]))]),
1659
- providerOptions: X.optional()
1660
- }), Jn = Y.object({
1661
- role: Y.literal("tool"),
1662
- content: Y.array(Y.union([Z, Wn])),
1663
- providerOptions: X.optional()
1659
+ providerOptions: Z.optional()
1660
+ }), Jn = X.object({
1661
+ role: X.literal("tool"),
1662
+ content: X.array(X.union([Hn, Wn])),
1663
+ providerOptions: Z.optional()
1664
1664
  });
1665
- Y.union([
1665
+ X.union([
1666
1666
  Gn,
1667
1667
  Kn,
1668
1668
  qn,
@@ -1855,11 +1855,11 @@ async function Xn(e) {
1855
1855
  value: void 0,
1856
1856
  state: "undefined-input"
1857
1857
  };
1858
- let t = await yn({ text: e });
1858
+ let t = await vn({ text: e });
1859
1859
  return t.success ? {
1860
1860
  value: t.value,
1861
1861
  state: "successful-parse"
1862
- } : (t = await yn({ text: Yn(e) }), t.success ? {
1862
+ } : (t = await vn({ text: Yn(e) }), t.success ? {
1863
1863
  value: t.value,
1864
1864
  state: "repaired-parse"
1865
1865
  } : {
@@ -1877,193 +1877,193 @@ j({
1877
1877
  prefix: "call",
1878
1878
  size: 24
1879
1879
  }), TransformStream;
1880
- var Zn = Y.object({
1881
- source: Y.discriminatedUnion("sourceType", [Y.object({
1882
- type: Y.literal("source"),
1883
- sourceType: Y.literal("url"),
1884
- id: Y.string(),
1885
- url: Y.string(),
1886
- title: Y.string().optional(),
1887
- providerMetadata: X.optional()
1888
- }), Y.object({
1889
- type: Y.literal("source"),
1890
- sourceType: Y.literal("document"),
1891
- id: Y.string(),
1892
- mediaType: Y.string(),
1893
- title: Y.string(),
1894
- filename: Y.string().optional(),
1895
- providerMetadata: X.optional()
1880
+ var Zn = X.object({
1881
+ source: X.discriminatedUnion("sourceType", [X.object({
1882
+ type: X.literal("source"),
1883
+ sourceType: X.literal("url"),
1884
+ id: X.string(),
1885
+ url: X.string(),
1886
+ title: X.string().optional(),
1887
+ providerMetadata: Z.optional()
1888
+ }), X.object({
1889
+ type: X.literal("source"),
1890
+ sourceType: X.literal("document"),
1891
+ id: X.string(),
1892
+ mediaType: X.string(),
1893
+ title: X.string(),
1894
+ filename: X.string().optional(),
1895
+ providerMetadata: Z.optional()
1896
1896
  })]),
1897
- startIndex: Y.number().int().nonnegative().optional(),
1898
- endIndex: Y.number().int().nonnegative().optional(),
1899
- citedText: Y.string().optional()
1900
- }), Qn = Y.record(Y.string(), An.optional()), $n = sn(() => gn(Y.union([
1901
- Y.looseObject({
1902
- type: Y.literal("text-start"),
1903
- id: Y.string(),
1904
- providerMetadata: X.optional()
1897
+ startIndex: X.number().int().nonnegative().optional(),
1898
+ endIndex: X.number().int().nonnegative().optional(),
1899
+ citedText: X.string().optional()
1900
+ }), Qn = X.record(X.string(), kn.optional()), $n = on(() => hn(X.union([
1901
+ X.looseObject({
1902
+ type: X.literal("text-start"),
1903
+ id: X.string(),
1904
+ providerMetadata: Z.optional()
1905
1905
  }),
1906
- Y.looseObject({
1907
- type: Y.literal("text-delta"),
1908
- id: Y.string(),
1909
- delta: Y.string(),
1910
- providerMetadata: X.optional()
1906
+ X.looseObject({
1907
+ type: X.literal("text-delta"),
1908
+ id: X.string(),
1909
+ delta: X.string(),
1910
+ providerMetadata: Z.optional()
1911
1911
  }),
1912
- Y.looseObject({
1913
- type: Y.literal("text-end"),
1914
- id: Y.string(),
1915
- citations: Y.array(Zn).optional(),
1916
- providerMetadata: X.optional()
1912
+ X.looseObject({
1913
+ type: X.literal("text-end"),
1914
+ id: X.string(),
1915
+ citations: X.array(Zn).optional(),
1916
+ providerMetadata: Z.optional()
1917
1917
  }),
1918
- Y.looseObject({
1919
- type: Y.literal("error"),
1920
- errorText: Y.string()
1918
+ X.looseObject({
1919
+ type: X.literal("error"),
1920
+ errorText: X.string()
1921
1921
  }),
1922
- Y.looseObject({
1923
- type: Y.literal("tool-input-start"),
1924
- toolCallId: Y.string(),
1925
- toolName: Y.string(),
1926
- inputEncoding: Y.enum(["json", "text"]).optional(),
1927
- providerExecuted: Y.boolean().optional(),
1928
- providerMetadata: X.optional(),
1922
+ X.looseObject({
1923
+ type: X.literal("tool-input-start"),
1924
+ toolCallId: X.string(),
1925
+ toolName: X.string(),
1926
+ inputEncoding: X.enum(["json", "text"]).optional(),
1927
+ providerExecuted: X.boolean().optional(),
1928
+ providerMetadata: Z.optional(),
1929
1929
  toolMetadata: Qn.optional(),
1930
- dynamic: Y.boolean().optional(),
1931
- title: Y.string().optional()
1930
+ dynamic: X.boolean().optional(),
1931
+ title: X.string().optional()
1932
1932
  }),
1933
- Y.looseObject({
1934
- type: Y.literal("tool-input-delta"),
1935
- toolCallId: Y.string(),
1936
- inputTextDelta: Y.string()
1933
+ X.looseObject({
1934
+ type: X.literal("tool-input-delta"),
1935
+ toolCallId: X.string(),
1936
+ inputTextDelta: X.string()
1937
1937
  }),
1938
- Y.looseObject({
1939
- type: Y.literal("tool-input-available"),
1940
- toolCallId: Y.string(),
1941
- toolName: Y.string(),
1942
- input: Y.unknown(),
1943
- providerExecuted: Y.boolean().optional(),
1944
- providerMetadata: X.optional(),
1938
+ X.looseObject({
1939
+ type: X.literal("tool-input-available"),
1940
+ toolCallId: X.string(),
1941
+ toolName: X.string(),
1942
+ input: X.unknown(),
1943
+ providerExecuted: X.boolean().optional(),
1944
+ providerMetadata: Z.optional(),
1945
1945
  toolMetadata: Qn.optional(),
1946
- dynamic: Y.boolean().optional(),
1947
- title: Y.string().optional()
1946
+ dynamic: X.boolean().optional(),
1947
+ title: X.string().optional()
1948
1948
  }),
1949
- Y.looseObject({
1950
- type: Y.literal("tool-input-error"),
1951
- toolCallId: Y.string(),
1952
- toolName: Y.string(),
1953
- input: Y.unknown(),
1954
- providerExecuted: Y.boolean().optional(),
1955
- providerMetadata: X.optional(),
1949
+ X.looseObject({
1950
+ type: X.literal("tool-input-error"),
1951
+ toolCallId: X.string(),
1952
+ toolName: X.string(),
1953
+ input: X.unknown(),
1954
+ providerExecuted: X.boolean().optional(),
1955
+ providerMetadata: Z.optional(),
1956
1956
  toolMetadata: Qn.optional(),
1957
- dynamic: Y.boolean().optional(),
1958
- errorText: Y.string(),
1959
- title: Y.string().optional()
1957
+ dynamic: X.boolean().optional(),
1958
+ errorText: X.string(),
1959
+ title: X.string().optional()
1960
1960
  }),
1961
- Y.looseObject({
1962
- type: Y.literal("tool-approval-request"),
1963
- approvalId: Y.string(),
1964
- toolCallId: Y.string(),
1965
- approvalDescriptor: Y.unknown().optional(),
1966
- inputSchemaInput: Y.unknown().optional(),
1967
- reason: Y.string().optional(),
1968
- isAutomatic: Y.boolean().optional(),
1969
- signature: Y.string().optional()
1961
+ X.looseObject({
1962
+ type: X.literal("tool-approval-request"),
1963
+ approvalId: X.string(),
1964
+ toolCallId: X.string(),
1965
+ approvalDescriptor: X.unknown().optional(),
1966
+ inputSchemaInput: X.unknown().optional(),
1967
+ reason: X.string().optional(),
1968
+ isAutomatic: X.boolean().optional(),
1969
+ signature: X.string().optional()
1970
1970
  }),
1971
- Y.looseObject({
1972
- type: Y.literal("tool-approval-response"),
1973
- approvalId: Y.string(),
1974
- approved: Y.boolean(),
1975
- reason: Y.string().optional(),
1976
- providerExecuted: Y.boolean().optional(),
1977
- providerMetadata: X.optional()
1971
+ X.looseObject({
1972
+ type: X.literal("tool-approval-response"),
1973
+ approvalId: X.string(),
1974
+ approved: X.boolean(),
1975
+ reason: X.string().optional(),
1976
+ providerExecuted: X.boolean().optional(),
1977
+ providerMetadata: Z.optional()
1978
1978
  }),
1979
- Y.looseObject({
1980
- type: Y.literal("tool-output-available"),
1981
- toolCallId: Y.string(),
1982
- output: Y.unknown(),
1983
- providerExecuted: Y.boolean().optional(),
1984
- providerMetadata: X.optional(),
1979
+ X.looseObject({
1980
+ type: X.literal("tool-output-available"),
1981
+ toolCallId: X.string(),
1982
+ output: X.unknown(),
1983
+ providerExecuted: X.boolean().optional(),
1984
+ providerMetadata: Z.optional(),
1985
1985
  toolMetadata: Qn.optional(),
1986
- dynamic: Y.boolean().optional(),
1987
- preliminary: Y.boolean().optional()
1986
+ dynamic: X.boolean().optional(),
1987
+ preliminary: X.boolean().optional()
1988
1988
  }),
1989
- Y.looseObject({
1990
- type: Y.literal("tool-output-error"),
1991
- toolCallId: Y.string(),
1992
- errorText: Y.string(),
1993
- providerExecuted: Y.boolean().optional(),
1994
- providerMetadata: X.optional(),
1989
+ X.looseObject({
1990
+ type: X.literal("tool-output-error"),
1991
+ toolCallId: X.string(),
1992
+ errorText: X.string(),
1993
+ providerExecuted: X.boolean().optional(),
1994
+ providerMetadata: Z.optional(),
1995
1995
  toolMetadata: Qn.optional(),
1996
- dynamic: Y.boolean().optional()
1996
+ dynamic: X.boolean().optional()
1997
1997
  }),
1998
- Y.looseObject({
1999
- type: Y.literal("tool-output-denied"),
2000
- toolCallId: Y.string()
1998
+ X.looseObject({
1999
+ type: X.literal("tool-output-denied"),
2000
+ toolCallId: X.string()
2001
2001
  }),
2002
- Y.looseObject({
2003
- type: Y.literal("reasoning-start"),
2004
- id: Y.string(),
2005
- providerMetadata: X.optional()
2002
+ X.looseObject({
2003
+ type: X.literal("reasoning-start"),
2004
+ id: X.string(),
2005
+ providerMetadata: Z.optional()
2006
2006
  }),
2007
- Y.looseObject({
2008
- type: Y.literal("reasoning-delta"),
2009
- id: Y.string(),
2010
- delta: Y.string(),
2011
- providerMetadata: X.optional()
2007
+ X.looseObject({
2008
+ type: X.literal("reasoning-delta"),
2009
+ id: X.string(),
2010
+ delta: X.string(),
2011
+ providerMetadata: Z.optional()
2012
2012
  }),
2013
- Y.looseObject({
2014
- type: Y.literal("reasoning-end"),
2015
- id: Y.string(),
2016
- providerMetadata: X.optional()
2013
+ X.looseObject({
2014
+ type: X.literal("reasoning-end"),
2015
+ id: X.string(),
2016
+ providerMetadata: Z.optional()
2017
2017
  }),
2018
- Y.looseObject({
2019
- type: Y.literal("custom"),
2020
- kind: Y.string().transform((e) => e),
2021
- providerMetadata: X.optional()
2018
+ X.looseObject({
2019
+ type: X.literal("custom"),
2020
+ kind: X.string().transform((e) => e),
2021
+ providerMetadata: Z.optional()
2022
2022
  }),
2023
- Y.looseObject({
2024
- type: Y.literal("source-url"),
2025
- sourceId: Y.string(),
2026
- url: Y.string(),
2027
- title: Y.string().optional(),
2028
- providerMetadata: X.optional()
2023
+ X.looseObject({
2024
+ type: X.literal("source-url"),
2025
+ sourceId: X.string(),
2026
+ url: X.string(),
2027
+ title: X.string().optional(),
2028
+ providerMetadata: Z.optional()
2029
2029
  }),
2030
- Y.looseObject({
2031
- type: Y.literal("source-document"),
2032
- sourceId: Y.string(),
2033
- mediaType: Y.string(),
2034
- title: Y.string(),
2035
- filename: Y.string().optional(),
2036
- providerMetadata: X.optional()
2030
+ X.looseObject({
2031
+ type: X.literal("source-document"),
2032
+ sourceId: X.string(),
2033
+ mediaType: X.string(),
2034
+ title: X.string(),
2035
+ filename: X.string().optional(),
2036
+ providerMetadata: Z.optional()
2037
2037
  }),
2038
- Y.looseObject({
2039
- type: Y.literal("file"),
2040
- url: Y.string(),
2041
- mediaType: Y.string(),
2042
- providerMetadata: X.optional()
2038
+ X.looseObject({
2039
+ type: X.literal("file"),
2040
+ url: X.string(),
2041
+ mediaType: X.string(),
2042
+ providerMetadata: Z.optional()
2043
2043
  }),
2044
- Y.looseObject({
2045
- type: Y.literal("reasoning-file"),
2046
- url: Y.string(),
2047
- mediaType: Y.string(),
2048
- providerMetadata: X.optional()
2044
+ X.looseObject({
2045
+ type: X.literal("reasoning-file"),
2046
+ url: X.string(),
2047
+ mediaType: X.string(),
2048
+ providerMetadata: Z.optional()
2049
2049
  }),
2050
- Y.looseObject({
2051
- type: Y.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2052
- id: Y.string().optional(),
2053
- data: Y.unknown(),
2054
- transient: Y.boolean().optional()
2050
+ X.looseObject({
2051
+ type: X.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2052
+ id: X.string().optional(),
2053
+ data: X.unknown(),
2054
+ transient: X.boolean().optional()
2055
2055
  }),
2056
- Y.looseObject({ type: Y.literal("start-step") }),
2057
- Y.looseObject({ type: Y.literal("finish-step") }),
2058
- Y.looseObject({ type: Y.literal("reset-step") }),
2059
- Y.looseObject({
2060
- type: Y.literal("start"),
2061
- messageId: Y.string().optional(),
2062
- messageMetadata: Y.unknown().optional()
2056
+ X.looseObject({ type: X.literal("start-step") }),
2057
+ X.looseObject({ type: X.literal("finish-step") }),
2058
+ X.looseObject({ type: X.literal("reset-step") }),
2059
+ X.looseObject({
2060
+ type: X.literal("start"),
2061
+ messageId: X.string().optional(),
2062
+ messageMetadata: X.unknown().optional()
2063
2063
  }),
2064
- Y.looseObject({
2065
- type: Y.literal("finish"),
2066
- finishReason: Y.enum([
2064
+ X.looseObject({
2065
+ type: X.literal("finish"),
2066
+ finishReason: X.enum([
2067
2067
  "stop",
2068
2068
  "length",
2069
2069
  "content-filter",
@@ -2072,15 +2072,15 @@ var Zn = Y.object({
2072
2072
  "interrupted",
2073
2073
  "other"
2074
2074
  ]).optional(),
2075
- messageMetadata: Y.unknown().optional()
2075
+ messageMetadata: X.unknown().optional()
2076
2076
  }),
2077
- Y.looseObject({
2078
- type: Y.literal("abort"),
2079
- reason: Y.string().optional()
2077
+ X.looseObject({
2078
+ type: X.literal("abort"),
2079
+ reason: X.string().optional()
2080
2080
  }),
2081
- Y.looseObject({
2082
- type: Y.literal("message-metadata"),
2083
- messageMetadata: Y.unknown()
2081
+ X.looseObject({
2082
+ type: X.literal("message-metadata"),
2083
+ messageMetadata: X.unknown()
2084
2084
  })
2085
2085
  ])));
2086
2086
  function er(e) {
@@ -2152,7 +2152,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2152
2152
  }
2153
2153
  }
2154
2154
  }
2155
- if (t == null) throw new On({
2155
+ if (t == null) throw new Dn({
2156
2156
  chunkType: "tool-invocation",
2157
2157
  chunkId: e,
2158
2158
  message: `No tool invocation found for tool call ID "${e}".`
@@ -2161,7 +2161,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2161
2161
  }
2162
2162
  function h(e) {
2163
2163
  let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
2164
- if (t == null) throw new On({
2164
+ if (t == null) throw new Dn({
2165
2165
  chunkType: "tool-approval-response",
2166
2166
  chunkId: e,
2167
2167
  message: `No tool invocation found for approval ID "${e}".`
@@ -2226,8 +2226,8 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2226
2226
  }
2227
2227
  async function v(e) {
2228
2228
  if (e != null) {
2229
- let n = r.message.metadata == null ? e : kn(r.message.metadata, e);
2230
- t != null && await _n({
2229
+ let n = r.message.metadata == null ? e : On(r.message.metadata, e);
2230
+ t != null && await gn({
2231
2231
  value: n,
2232
2232
  schema: t,
2233
2233
  context: {
@@ -2250,7 +2250,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2250
2250
  }
2251
2251
  case "text-delta": {
2252
2252
  let t = r.activeTextParts[e.id];
2253
- if (t == null) throw new On({
2253
+ if (t == null) throw new Dn({
2254
2254
  chunkType: "text-delta",
2255
2255
  chunkId: e.id,
2256
2256
  message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
@@ -2260,7 +2260,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2260
2260
  }
2261
2261
  case "text-end": {
2262
2262
  let t = r.activeTextParts[e.id];
2263
- if (t == null) throw new On({
2263
+ if (t == null) throw new Dn({
2264
2264
  chunkType: "text-end",
2265
2265
  chunkId: e.id,
2266
2266
  message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
@@ -2290,7 +2290,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2290
2290
  }
2291
2291
  case "reasoning-delta": {
2292
2292
  let t = r.activeReasoningParts[e.id];
2293
- if (t == null) throw new On({
2293
+ if (t == null) throw new Dn({
2294
2294
  chunkType: "reasoning-delta",
2295
2295
  chunkId: e.id,
2296
2296
  message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
@@ -2300,7 +2300,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2300
2300
  }
2301
2301
  case "reasoning-end": {
2302
2302
  let t = r.activeReasoningParts[e.id];
2303
- if (t == null) throw new On({
2303
+ if (t == null) throw new Dn({
2304
2304
  chunkType: "reasoning-end",
2305
2305
  chunkId: e.id,
2306
2306
  message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
@@ -2371,7 +2371,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2371
2371
  }
2372
2372
  case "tool-input-delta": {
2373
2373
  let t = r.partialToolCalls[e.toolCallId];
2374
- if (t == null) throw new On({
2374
+ if (t == null) throw new Dn({
2375
2375
  chunkType: "tool-input-delta",
2376
2376
  chunkId: e.toolCallId,
2377
2377
  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.`
@@ -2552,7 +2552,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2552
2552
  default: if (er(e)) {
2553
2553
  if (n?.[e.type] != null) {
2554
2554
  let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
2555
- await _n({
2555
+ await gn({
2556
2556
  value: e.data,
2557
2557
  schema: n[e.type],
2558
2558
  context: {
@@ -2613,7 +2613,7 @@ j({
2613
2613
  }), j({
2614
2614
  prefix: "call",
2615
2615
  size: 24
2616
- }), Y.record(Y.string(), An.optional()), Y.record(Y.string(), Y.string()), j({
2616
+ }), X.record(X.string(), kn.optional()), X.record(X.string(), X.string()), j({
2617
2617
  prefix: "call",
2618
2618
  size: 24
2619
2619
  }), j({
@@ -2664,9 +2664,9 @@ j({
2664
2664
  }), j({
2665
2665
  prefix: "call",
2666
2666
  size: 24
2667
- }), Y.object({
2668
- token: Y.string().refine((e) => e.trim().length > 0),
2669
- url: Y.string().refine((e) => {
2667
+ }), X.object({
2668
+ token: X.string().refine((e) => e.trim().length > 0),
2669
+ url: X.string().refine((e) => {
2670
2670
  try {
2671
2671
  let t = new URL(e);
2672
2672
  return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
@@ -2674,12 +2674,12 @@ j({
2674
2674
  return !1;
2675
2675
  }
2676
2676
  }),
2677
- expiresAt: Y.number().positive().max(2 ** 53 - 1).optional(),
2678
- tools: Y.array(Y.object({
2679
- type: Y.literal("function"),
2680
- name: Y.string().min(1),
2681
- description: Y.string().optional(),
2682
- parameters: Y.record(Y.string(), Y.unknown())
2677
+ expiresAt: X.number().positive().max(2 ** 53 - 1).optional(),
2678
+ tools: X.array(X.object({
2679
+ type: X.literal("function"),
2680
+ name: X.string().min(1),
2681
+ description: X.string().optional(),
2682
+ parameters: X.record(X.string(), X.unknown())
2683
2683
  })).optional()
2684
2684
  }), j({
2685
2685
  prefix: "call",
@@ -2731,7 +2731,7 @@ var mr = class {
2731
2731
  this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
2732
2732
  }
2733
2733
  async sendMessages({ abortSignal: e, ...t }) {
2734
- let n = await xn(this.body), r = await xn(this.headers), i = await xn(this.credentials), a = {
2734
+ let n = await bn(this.body), r = await bn(this.headers), i = await bn(this.credentials), a = {
2735
2735
  ...A(r),
2736
2736
  ...A(t.headers)
2737
2737
  }, o = await this.prepareSendMessagesRequest?.({
@@ -2773,7 +2773,7 @@ var mr = class {
2773
2773
  return this.processResponseStream(d.body);
2774
2774
  }
2775
2775
  async reconnectToStream(e) {
2776
- let t = await xn(this.body), n = await xn(this.headers), r = await xn(this.credentials), i = {
2776
+ let t = await bn(this.body), n = await bn(this.headers), r = await bn(this.credentials), i = {
2777
2777
  ...A(n),
2778
2778
  ...A(e.headers)
2779
2779
  }, a = await this.prepareReconnectToStreamRequest?.({
@@ -2788,7 +2788,7 @@ var mr = class {
2788
2788
  requestMetadata: e.metadata
2789
2789
  }), o = a?.api;
2790
2790
  if (o == null) {
2791
- if (e.chatId === "." || e.chatId === "..") throw new wn({
2791
+ if (e.chatId === "." || e.chatId === "..") throw new Cn({
2792
2792
  parameter: "chatId",
2793
2793
  value: e.chatId,
2794
2794
  message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
@@ -2815,7 +2815,7 @@ var mr = class {
2815
2815
  super(t), this.resumeStreamIsReplay = e;
2816
2816
  }
2817
2817
  processResponseStream(e) {
2818
- return bn({
2818
+ return yn({
2819
2819
  stream: e,
2820
2820
  schema: $n
2821
2821
  }).pipeThrough(new TransformStream({ async transform(e, t) {
@@ -2867,12 +2867,12 @@ var mr = class {
2867
2867
  } else n = e;
2868
2868
  if (e.messageId != null) {
2869
2869
  let t = this.state.messages.findIndex((t) => t.id === e.messageId);
2870
- if (t === -1) throw new wn({
2870
+ if (t === -1) throw new Cn({
2871
2871
  parameter: "message.messageId",
2872
2872
  value: e.messageId,
2873
2873
  message: `message with id ${e.messageId} not found`
2874
2874
  });
2875
- if (this.state.messages[t].role !== "user") throw new wn({
2875
+ if (this.state.messages[t].role !== "user") throw new Cn({
2876
2876
  parameter: "message.messageId",
2877
2877
  value: e.messageId,
2878
2878
  message: `message with id ${e.messageId} is not a user message`
@@ -2896,7 +2896,7 @@ var mr = class {
2896
2896
  });
2897
2897
  }, this.regenerate = async ({ messageId: e, ...t } = {}) => {
2898
2898
  let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
2899
- if (n === -1) throw new wn({
2899
+ if (n === -1) throw new Cn({
2900
2900
  parameter: "messageId",
2901
2901
  value: e,
2902
2902
  message: `message ${e} not found`
@@ -3852,7 +3852,7 @@ function di(e) {
3852
3852
  });
3853
3853
  }
3854
3854
  async function St() {
3855
- Ct(), P(), w.value = void 0, Be.value = !1, K.value = "", await B.value.stop();
3855
+ Ct(), P(), w.value = void 0, Be.value = !1, q.value = "", await B.value.stop();
3856
3856
  }
3857
3857
  function Ct() {
3858
3858
  _t.cancelAll(), A.value && !M.has(A.value.toolCallId) && A.value.answer(!1);
@@ -3866,7 +3866,7 @@ function di(e) {
3866
3866
  I.value.includes(e) || (I.value = [...I.value, e]), kt.set(e, Date.now()), n ? At.add(e) : At.delete(e), t && (R.value = {
3867
3867
  ...R.value,
3868
3868
  [e]: t
3869
- }), Z || Gn();
3869
+ }), Un || Kn();
3870
3870
  }
3871
3871
  function z(e) {
3872
3872
  R.value = Object.fromEntries(Object.entries(R.value).filter(([t]) => t !== e));
@@ -3930,7 +3930,7 @@ function di(e) {
3930
3930
  }
3931
3931
  })), B = b(() => ve(Nt)), Pt = () => B.value.messages[B.value.messages.length - 1];
3932
3932
  C(E, (e, t) => {
3933
- if (t && !T.value && (J() || F?.chatId === t)) {
3933
+ if (t && !T.value && (Y() || F?.chatId === t)) {
3934
3934
  let e = B.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
3935
3935
  jt(t, n ? de(n) ?? "" : "", B.value.status === "streaming" || F?.chatId === t);
3936
3936
  }
@@ -3969,7 +3969,7 @@ function di(e) {
3969
3969
  }), Lt = b(() => {
3970
3970
  let e = u.value?.messagePlaceholder;
3971
3971
  return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
3972
- }), U = x([]), Rt = x(!1), zt = x(1), Bt = x(!1), Vt = x(!1), Ht, Ut = x([]), Wt = x(!1), Gt = x("chat"), Kt = x(0), qt = x([]), Jt = x(), Yt = x(!1), Xt = x(!1), Zt = x(), Qt = x(!1), $t = x(!1), en = x(), W = x(""), G = x([]), K = x(""), q = S(), tn = x(0), nn = fe(b(() => `${o.value}-queue`), {}), rn = b(() => nn.value[E.value] ?? []), an = b(() => !T.value);
3972
+ }), U = x([]), Rt = x(!1), zt = x(1), Bt = x(!1), Vt = x(!1), Ht, W = x([]), Ut = x(!1), Wt = x("chat"), Gt = x(0), Kt = x([]), qt = x(), Jt = x(!1), Yt = x(!1), Xt = x(), Zt = x(!1), Qt = x(!1), $t = x(), G = x(""), K = x([]), q = x(""), J = x(!0), en = S(), tn = x(0), nn = fe(b(() => `${o.value}-queue`), {}), rn = b(() => nn.value[E.value] ?? []), an = b(() => !T.value);
3973
3973
  function on(e, t) {
3974
3974
  let n = Object.fromEntries(Object.entries(nn.value).filter(([t]) => t !== e));
3975
3975
  nn.value = t.length > 0 ? {
@@ -3982,7 +3982,7 @@ function di(e) {
3982
3982
  return on(e, []), t;
3983
3983
  }
3984
3984
  function cn(e) {
3985
- e && (W.value = W.value ? `${W.value}${si}${e}` : e);
3985
+ e && (G.value = G.value ? `${G.value}${si}${e}` : e);
3986
3986
  }
3987
3987
  function ln(e) {
3988
3988
  on(E.value, rn.value.filter((t, n) => n !== e));
@@ -4017,7 +4017,7 @@ function di(e) {
4017
4017
  } finally {
4018
4018
  Rt.value = !1;
4019
4019
  }
4020
- Kn([.../* @__PURE__ */ new Set([...Vn(), ...U.value.map((e) => e.id)])]);
4020
+ qn([.../* @__PURE__ */ new Set([...Vn(), ...U.value.map((e) => e.id)])]);
4021
4021
  }
4022
4022
  }
4023
4023
  async function fn() {
@@ -4038,15 +4038,15 @@ function di(e) {
4038
4038
  }
4039
4039
  async function mn() {
4040
4040
  let e = E.value;
4041
- if (!e) Ut.value = [];
4041
+ if (!e) W.value = [];
4042
4042
  else {
4043
- Wt.value = !0;
4043
+ Ut.value = !0;
4044
4044
  try {
4045
- Ut.value = await k.value.getChatFiles(e);
4045
+ W.value = await k.value.getChatFiles(e);
4046
4046
  } catch {
4047
- Ut.value = [];
4047
+ W.value = [];
4048
4048
  } finally {
4049
- Wt.value = !1;
4049
+ Ut.value = !1;
4050
4050
  }
4051
4051
  }
4052
4052
  }
@@ -4058,8 +4058,8 @@ function di(e) {
4058
4058
  }
4059
4059
  async function _n(e) {
4060
4060
  await k.value.deleteChatFile(e);
4061
- let t = Ut.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
4062
- Ut.value = Ut.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
4061
+ let t = W.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
4062
+ W.value = W.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
4063
4063
  }
4064
4064
  async function vn(e, t) {
4065
4065
  if (!T.value) try {
@@ -4069,14 +4069,14 @@ function di(e) {
4069
4069
  } catch {}
4070
4070
  }
4071
4071
  async function yn(e, t, n) {
4072
- n && (await bn(t), t !== E.value || J()) || (await xn(e, t), t === E.value && await Tn());
4072
+ n && (await bn(t), t !== E.value || Y()) || (await xn(e, t), t === E.value && await Tn());
4073
4073
  }
4074
4074
  async function bn(e) {
4075
4075
  let t = { chatId: e };
4076
4076
  F = t, Et.value = e;
4077
4077
  let n = () => F === t && e === E.value, r = Date.now() + $r;
4078
4078
  try {
4079
- for (; n() && !J() && Date.now() < r;) {
4079
+ for (; n() && !Y() && Date.now() < r;) {
4080
4080
  Tt = !0;
4081
4081
  try {
4082
4082
  await B.value.resumeStream();
@@ -4086,7 +4086,7 @@ function di(e) {
4086
4086
  if (!n()) return;
4087
4087
  B.value.clearError();
4088
4088
  let t = await k.value.getChat(o.value, e).catch(() => null);
4089
- if (!t || !n() || J()) return;
4089
+ if (!t || !n() || Y()) return;
4090
4090
  if (!t.turnInProgress) {
4091
4091
  B.value.messages = t.messages;
4092
4092
  return;
@@ -4130,10 +4130,10 @@ function di(e) {
4130
4130
  }
4131
4131
  }
4132
4132
  }
4133
- let J = () => {
4133
+ let Y = () => {
4134
4134
  let e = B.value.status;
4135
4135
  return e === "submitted" || e === "streaming";
4136
- }, Sn = () => J() || F?.chatId === E.value || he.value > 0, Cn = () => {
4136
+ }, Sn = () => Y() || F?.chatId === E.value || he.value > 0, Cn = () => {
4137
4137
  let e = Pt();
4138
4138
  return A.value !== void 0 || Jr(e) || li(e);
4139
4139
  }, wn = /* @__PURE__ */ new Set();
@@ -4157,32 +4157,32 @@ function di(e) {
4157
4157
  }
4158
4158
  let En = 0, Dn = 0;
4159
4159
  async function On() {
4160
- if (T.value || J()) return "indeterminate";
4160
+ if (T.value || Y()) return "indeterminate";
4161
4161
  let e = E.value, t = En += 1;
4162
4162
  try {
4163
4163
  let n = await k.value.getChat(o.value, e);
4164
- if (!n || e !== E.value || J() || t <= Dn) return "indeterminate";
4164
+ if (!n || e !== E.value || Y() || t <= Dn) return "indeterminate";
4165
4165
  Dn = t;
4166
4166
  let r = n.messages, i = Qr(r, B.value.messages);
4167
4167
  return B.value.messages = [...r, ...i], O.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
4168
4168
  } catch {}
4169
4169
  return "indeterminate";
4170
4170
  }
4171
- function kn(e) {
4171
+ function X(e) {
4172
4172
  B.value.messages = [...B.value.messages, e];
4173
4173
  }
4174
- async function Y(e) {
4174
+ async function kn(e) {
4175
4175
  try {
4176
- qt.value = await k.value.getMessageFeedbacks(e);
4176
+ Kt.value = await k.value.getMessageFeedbacks(e);
4177
4177
  } catch {
4178
- qt.value = [];
4178
+ Kt.value = [];
4179
4179
  }
4180
4180
  }
4181
- function An(e) {
4182
- let t = qt.value.findIndex((t) => t.messageId === e.messageId);
4183
- t >= 0 ? qt.value[t] = e : qt.value.push(e);
4181
+ function Z(e) {
4182
+ let t = Kt.value.findIndex((t) => t.messageId === e.messageId);
4183
+ t >= 0 ? Kt.value[t] = e : Kt.value.push(e);
4184
4184
  }
4185
- function X(e) {
4185
+ function An(e) {
4186
4186
  let t = It.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
4187
4187
  return {
4188
4188
  userQuestion: de(i ?? e) ?? "",
@@ -4193,27 +4193,27 @@ function di(e) {
4193
4193
  await Promise.all([
4194
4194
  vn(e, t),
4195
4195
  dn(e),
4196
- Y(t)
4196
+ kn(t)
4197
4197
  ]), lt.value || De((e, t) => k.value.reverseGeocode(e, t, r.value)).then((e) => {
4198
4198
  e && (lt.value = e);
4199
4199
  });
4200
4200
  }
4201
4201
  async function Mn() {
4202
- let e = W.value.trim(), t = G.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
4202
+ let e = G.value.trim(), t = K.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
4203
4203
  type: "file",
4204
4204
  mediaType: e.mediaSource.mimeType,
4205
4205
  url: e.localUrl,
4206
4206
  filename: e.mediaSource.name,
4207
4207
  providerMetadata: { "8bot": { media: e.mediaSource } }
4208
4208
  })), n = tt.value ? Fe.value : void 0;
4209
- !T.value && Sn() ? e && t.length === 0 && !n && (on(E.value, [...rn.value, e]), W.value = "") : (T.value && It.value.length > 0 && await Zn(), Pn(e, t, n && { pagePointer: n }), W.value = "", Fe.value = void 0, Xn());
4209
+ !T.value && Sn() ? e && t.length === 0 && !n && (on(E.value, [...rn.value, e]), G.value = "") : (T.value && It.value.length > 0 && await Qn(), Pn(e, t, n && { pagePointer: n }), G.value = "", Fe.value = void 0, Zn());
4210
4210
  }
4211
4211
  function Nn(e, t) {
4212
4212
  let n = e.trim();
4213
- return !n || O.value || Sn() || B.value.status !== "ready" ? !1 : (Pn(n, [], t, { rollback: !1 }), !0);
4213
+ return !n || O.value || Sn() || B.value.status !== "ready" ? !1 : (Pn(n, [], t, { toInput: !1 }), !0);
4214
4214
  }
4215
- function Pn(e, t = [], n, { rollback: r = !0 } = {}) {
4216
- Ct(), K.value = r ? e : "", q.value = r && n && "pagePointer" in n ? n.pagePointer : void 0, tn.value = B.value.messages.length;
4215
+ function Pn(e, t = [], n, { toInput: r = !0 } = {}) {
4216
+ Ct(), q.value = e, J.value = r, en.value = r && n && "pagePointer" in n ? n.pagePointer : void 0, tn.value = B.value.messages.length;
4217
4217
  let i = B.value.sendMessage;
4218
4218
  i({
4219
4219
  text: e,
@@ -4232,24 +4232,24 @@ function di(e) {
4232
4232
  Ct(), n({ text: t });
4233
4233
  }
4234
4234
  async function In() {
4235
- let e = B.value.messages.slice(tn.value).some((e) => e.parts.some(re)), t = K.value, n = q.value, r = t.length > 0 && !e, i = E.value, a = tn.value, s = F?.chatId === i, c = Dt, l = sn(i), u = (e = "") => {
4236
- W.value = [
4235
+ let e = B.value.messages.slice(tn.value).some((e) => e.parts.some(re)), t = q.value, n = J.value, r = en.value, i = t.length > 0 && !e, a = E.value, s = tn.value, c = F?.chatId === a, l = Dt, u = sn(a), d = (e = "") => {
4236
+ G.value = [
4237
4237
  e,
4238
- l,
4239
- W.value
4238
+ u,
4239
+ G.value
4240
4240
  ].filter(Boolean).join(si);
4241
- }, d = () => i === E.value && !J() && tn.value === a ? !1 : (l && on(i, [l, ...nn.value[i] ?? []]), !0);
4241
+ }, f = () => a === E.value && !Y() && tn.value === s ? !1 : (u && on(a, [u, ...nn.value[a] ?? []]), !0);
4242
4242
  F = void 0, Et.value = void 0, Ct(), await B.value.stop();
4243
- let f = T.value || e && !s || await k.value.stopChatTurn(o.value, i, c).catch(() => !0);
4244
- if (!d()) {
4245
- if (s || !f) {
4246
- if (await On(), d()) return;
4247
- if (s || B.value.messages.length > tn.value) {
4248
- K.value = "", u();
4243
+ let p = T.value || e && !c || await k.value.stopChatTurn(o.value, a, l).catch(() => !0);
4244
+ if (!f()) {
4245
+ if (c || !p) {
4246
+ if (await On(), f()) return;
4247
+ if (c || B.value.messages.length > tn.value) {
4248
+ q.value = "", d();
4249
4249
  return;
4250
4250
  }
4251
4251
  }
4252
- r ? (u(t), Fe.value ??= n, B.value.messages = B.value.messages.slice(0, tn.value), K.value = "") : u();
4252
+ i ? (d(n ? t : ""), Fe.value ??= r, B.value.messages = B.value.messages.slice(0, tn.value), q.value = "") : d();
4253
4253
  }
4254
4254
  }
4255
4255
  C(() => B.value.messages, (e) => {
@@ -4269,7 +4269,7 @@ function di(e) {
4269
4269
  }, 1500));
4270
4270
  });
4271
4271
  let Rn = x(!1), zn;
4272
- C(() => !A.value && !Jr(Pt()) && (J() || he.value > 0), (e) => {
4272
+ C(() => !A.value && !Jr(Pt()) && (Y() || he.value > 0), (e) => {
4273
4273
  clearTimeout(zn), e ? Rn.value = !0 : zn = setTimeout(() => {
4274
4274
  Rn.value = !1;
4275
4275
  }, 400);
@@ -4277,44 +4277,44 @@ function di(e) {
4277
4277
  let Bn = b(() => {
4278
4278
  let e = Ot.value.filter((e) => e !== E.value);
4279
4279
  return Rn.value || Et.value === E.value ? [...e, E.value] : e;
4280
- }), Vn = () => [.../* @__PURE__ */ new Set([...Ot.value, ...I.value])], Hn = Ce(), Z, Un = 0, Wn = 0;
4281
- function Gn() {
4282
- clearTimeout(Z), Z = void 0, Vn().length !== 0 && Hn.value === "visible" && (Z = setTimeout(() => {
4283
- Z = void 0, Kn(Vn());
4280
+ }), Vn = () => [.../* @__PURE__ */ new Set([...Ot.value, ...I.value])], Hn = Ce(), Un, Wn = 0, Gn = 0;
4281
+ function Kn() {
4282
+ clearTimeout(Un), Un = void 0, Vn().length !== 0 && Hn.value === "visible" && (Un = setTimeout(() => {
4283
+ Un = void 0, qn(Vn());
4284
4284
  }, ti));
4285
4285
  }
4286
- async function Kn(e) {
4286
+ async function qn(e) {
4287
4287
  let t = e.slice(0, ni);
4288
4288
  if (T.value || t.length === 0) {
4289
- Gn();
4289
+ Kn();
4290
4290
  return;
4291
4291
  }
4292
- let n = Un += 1, r;
4292
+ let n = Wn += 1, r;
4293
4293
  try {
4294
4294
  r = await k.value.getRunningTurns(o.value, t);
4295
4295
  } catch {
4296
- Gn();
4296
+ Kn();
4297
4297
  return;
4298
4298
  }
4299
- if (n <= Wn) return;
4300
- Wn = n;
4299
+ if (n <= Gn) return;
4300
+ Gn = n;
4301
4301
  for (let e of r) At.add(e);
4302
4302
  let i = new Set(t), a = Vn().filter((e) => i.has(e) && !r.includes(e)), s = (e) => I.value.includes(e) && !At.has(e), c = a.filter((e) => s(e) && Date.now() - (kt.get(e) ?? 0) > ri), l = a.filter((e) => !s(e));
4303
4303
  Ot.value = [...Ot.value.filter((e) => !i.has(e)), ...r];
4304
4304
  let u = l.filter((e) => I.value.includes(e));
4305
- (u.length > 0 || c.length > 0) && (I.value = I.value.filter((e) => !u.includes(e) && !c.includes(e)), L.value = [...L.value, ...u.filter((e) => e !== E.value && !L.value.includes(e))]), l.length > 0 && dn(o.value), Gn();
4305
+ (u.length > 0 || c.length > 0) && (I.value = I.value.filter((e) => !u.includes(e) && !c.includes(e)), L.value = [...L.value, ...u.filter((e) => e !== E.value && !L.value.includes(e))]), l.length > 0 && dn(o.value), Kn();
4306
4306
  }
4307
4307
  C(Hn, (e) => {
4308
- e === "visible" ? Kn(Vn()) : (clearTimeout(Z), Z = void 0);
4309
- }), _e(() => clearTimeout(Z));
4310
- let qn = b(() => L.value.map((e) => ({
4308
+ e === "visible" ? qn(Vn()) : (clearTimeout(Un), Un = void 0);
4309
+ }), _e(() => clearTimeout(Un));
4310
+ let Jn = b(() => L.value.map((e) => ({
4311
4311
  chatId: e,
4312
4312
  title: U.value.find((t) => t.id === e)?.title || R.value[e] || void 0
4313
4313
  })));
4314
- function Jn(e) {
4315
- Mt(e), E.value = e, br("chat");
4316
- }
4317
4314
  function Yn(e) {
4315
+ Mt(e), E.value = e, xr("chat");
4316
+ }
4317
+ function Xn(e) {
4318
4318
  L.value = L.value.filter((t) => t !== e), z(e);
4319
4319
  }
4320
4320
  C(() => [B.value.status, B.value.id], ([e, t], [n, r]) => {
@@ -4331,19 +4331,19 @@ function di(e) {
4331
4331
  }), C(he, (e) => {
4332
4332
  e === 0 && B.value.status === "ready" && Tn();
4333
4333
  }), C(() => B.value.status, (e) => {
4334
- e === "ready" && K.value.length > 0 && (K.value = "");
4334
+ e === "ready" && q.value.length > 0 && (q.value = "");
4335
4335
  });
4336
- function Xn(e = !1) {
4337
- for (let t of G.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4338
- G.value = [], ar.value = null;
4336
+ function Zn(e = !1) {
4337
+ for (let t of K.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4338
+ K.value = [], or.value = null;
4339
4339
  }
4340
- async function Zn() {
4341
- return K.value = "", Re.value = {}, ze.value = {}, E.value = ft(), await ge(), B.value.clearError(), at.value = void 0, O.value = !1, Xn(!0), br("chat"), E.value;
4340
+ async function Qn() {
4341
+ return q.value = "", Re.value = {}, ze.value = {}, E.value = ft(), await ge(), B.value.clearError(), at.value = void 0, O.value = !1, Zn(!0), xr("chat"), E.value;
4342
4342
  }
4343
- async function Qn(e) {
4344
- B.value.status !== "ready" && (K.value = "", await In()), Ct(), await B.value.regenerate(e);
4343
+ async function $n(e) {
4344
+ B.value.status !== "ready" && (q.value = "", await In()), Ct(), await B.value.regenerate(e);
4345
4345
  }
4346
- function $n(e) {
4346
+ function er(e) {
4347
4347
  if (e.tool === "requestGeolocation") {
4348
4348
  let t = e.output;
4349
4349
  "latitude" in t && (lt.value = {
@@ -4355,23 +4355,23 @@ function di(e) {
4355
4355
  }
4356
4356
  B.value.addToolOutput(e);
4357
4357
  }
4358
- function er(e) {
4358
+ function tr(e) {
4359
4359
  B.value.addToolApprovalResponse(e);
4360
4360
  }
4361
- let tr = b(() => B.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), nr = b(() => _.value?.maxFilesPerMessage ?? 5), rr = b(() => _.value?.maxFilesPerChat ?? 20), Q = b(() => Math.max(0, Math.min(nr.value - G.value.length, rr.value - tr.value - G.value.length))), ir = b(() => Q.value <= 0), ar = x(null), or = () => {
4362
- ar.value = null;
4361
+ let nr = b(() => B.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), rr = b(() => _.value?.maxFilesPerMessage ?? 5), Q = b(() => _.value?.maxFilesPerChat ?? 20), ir = b(() => Math.max(0, Math.min(rr.value - K.value.length, Q.value - nr.value - K.value.length))), ar = b(() => ir.value <= 0), or = x(null), sr = () => {
4362
+ or.value = null;
4363
4363
  };
4364
- C(ir, (e) => {
4365
- e || (ar.value = null);
4364
+ C(ar, (e) => {
4365
+ e || (or.value = null);
4366
4366
  });
4367
- async function sr(e) {
4368
- if (ir.value) {
4369
- ar.value = rr.value - tr.value - G.value.length <= nr.value - G.value.length ? {
4367
+ async function cr(e) {
4368
+ if (ar.value) {
4369
+ or.value = Q.value - nr.value - K.value.length <= rr.value - K.value.length ? {
4370
4370
  reason: "per-chat",
4371
- max: rr.value
4371
+ max: Q.value
4372
4372
  } : {
4373
4373
  reason: "per-message",
4374
- max: nr.value
4374
+ max: rr.value
4375
4375
  };
4376
4376
  return;
4377
4377
  }
@@ -4381,38 +4381,38 @@ function di(e) {
4381
4381
  localUrl: URL.createObjectURL(e),
4382
4382
  state: "uploading"
4383
4383
  };
4384
- G.value = [...G.value, n];
4384
+ K.value = [...K.value, n];
4385
4385
  try {
4386
4386
  let n = await k.value.uploadMedia(o.value, E.value, e);
4387
- if (!G.value.some((e) => e.id === t)) {
4388
- await lr(n);
4387
+ if (!K.value.some((e) => e.id === t)) {
4388
+ await ur(n);
4389
4389
  return;
4390
4390
  }
4391
- G.value = G.value.map((e) => e.id === t ? {
4391
+ K.value = K.value.map((e) => e.id === t ? {
4392
4392
  ...e,
4393
4393
  state: "done",
4394
4394
  mediaSource: n
4395
4395
  } : e);
4396
4396
  } catch (e) {
4397
4397
  let n = e instanceof Error ? e.message : "Upload failed";
4398
- G.value = G.value.map((e) => e.id === t ? {
4398
+ K.value = K.value.map((e) => e.id === t ? {
4399
4399
  ...e,
4400
4400
  state: "error",
4401
4401
  error: n
4402
4402
  } : e);
4403
4403
  }
4404
4404
  }
4405
- async function cr(e) {
4406
- e.mediaSource && await lr(e.mediaSource);
4407
- }
4408
4405
  async function lr(e) {
4406
+ e.mediaSource && await ur(e.mediaSource);
4407
+ }
4408
+ async function ur(e) {
4409
4409
  try {
4410
4410
  await k.value.discardMedia(e);
4411
4411
  } catch {}
4412
4412
  }
4413
- async function ur(e, t) {
4414
- let { userQuestion: n, assistantMessage: r } = X(e);
4415
- An(await k.value.submitMessageFeedback({
4413
+ async function dr(e, t) {
4414
+ let { userQuestion: n, assistantMessage: r } = An(e);
4415
+ Z(await k.value.submitMessageFeedback({
4416
4416
  messageId: e.id,
4417
4417
  chatId: E.value,
4418
4418
  agentId: o.value,
@@ -4421,73 +4421,73 @@ function di(e) {
4421
4421
  assistantMessage: r
4422
4422
  }));
4423
4423
  }
4424
- async function dr(e) {
4425
- await ur(e, "upvote");
4426
- }
4427
4424
  async function fr(e) {
4428
- await ur(e, "downvote");
4425
+ await dr(e, "upvote");
4426
+ }
4427
+ async function pr(e) {
4428
+ await dr(e, "downvote");
4429
4429
  }
4430
- function pr(e) {
4431
- Xt.value = !1, Zt.value = void 0, Jt.value = e;
4430
+ function mr(e) {
4431
+ Yt.value = !1, Xt.value = void 0, qt.value = e;
4432
4432
  }
4433
- async function mr(e) {
4434
- if (Jt.value) try {
4435
- Yt.value = !0, Xt.value = !1, Zt.value = void 0;
4436
- let { userQuestion: t, assistantMessage: n } = X(Jt.value);
4437
- An(await k.value.submitMessageFeedback({
4438
- messageId: Jt.value.id,
4433
+ async function gr(e) {
4434
+ if (qt.value) try {
4435
+ Jt.value = !0, Yt.value = !1, Xt.value = void 0;
4436
+ let { userQuestion: t, assistantMessage: n } = An(qt.value);
4437
+ Z(await k.value.submitMessageFeedback({
4438
+ messageId: qt.value.id,
4439
4439
  chatId: E.value,
4440
4440
  agentId: o.value,
4441
4441
  userQuestion: t,
4442
4442
  assistantMessage: n,
4443
4443
  comment: e
4444
- })), Xt.value = !0, await Y(E.value);
4444
+ })), Yt.value = !0, await kn(E.value);
4445
4445
  } catch {
4446
- Zt.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4446
+ Xt.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4447
4447
  } finally {
4448
- Yt.value = !1;
4448
+ Jt.value = !1;
4449
4449
  }
4450
4450
  }
4451
- async function gr(e) {
4451
+ async function vr(e) {
4452
4452
  try {
4453
- $t.value = !0, Qt.value = !1, en.value = void 0, await k.value.submitLead({
4453
+ Qt.value = !0, Zt.value = !1, $t.value = void 0, await k.value.submitLead({
4454
4454
  agentId: o.value,
4455
4455
  chatId: E.value,
4456
4456
  ...e
4457
- }), Qt.value = !0;
4457
+ }), Zt.value = !0;
4458
4458
  } catch {
4459
- en.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4459
+ $t.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4460
4460
  } finally {
4461
- $t.value = !1;
4461
+ Qt.value = !1;
4462
4462
  }
4463
4463
  }
4464
- async function vr(e, t) {
4464
+ async function yr(e, t) {
4465
4465
  let n = await k.value.updateChatTitle(o.value, e, t);
4466
4466
  U.value = U.value.map((t) => t.id === e ? {
4467
4467
  ...t,
4468
4468
  title: n.title
4469
4469
  } : t);
4470
4470
  }
4471
- async function yr(e) {
4472
- await k.value.deleteChat(o.value, e), U.value = U.value.filter((t) => t.id !== e), E.value === e && await Zn();
4471
+ async function br(e) {
4472
+ await k.value.deleteChat(o.value, e), U.value = U.value.filter((t) => t.id !== e), E.value === e && await Qn();
4473
4473
  }
4474
- function br(e) {
4475
- Gt.value = e;
4474
+ function xr(e) {
4475
+ Wt.value = e;
4476
4476
  }
4477
- function xr() {
4478
- br("chat"), Kt.value++;
4477
+ function Sr() {
4478
+ xr("chat"), Gt.value++;
4479
4479
  }
4480
- let Sr;
4481
- function Cr(e) {
4480
+ let Cr;
4481
+ function wr(e) {
4482
4482
  let t = () => k.value.getChat(o.value, e).then((e) => e !== null);
4483
4483
  return t().catch(() => t().catch(() => !1));
4484
4484
  }
4485
4485
  return C(l, async (e) => {
4486
- if (!e || e === Sr) return;
4487
- let t = Sr;
4488
- if (Sr = e, t === void 0) return;
4489
- let n = E.value, r = !T.value && await Cr(n);
4490
- l.value === e && E.value === n && (r ? dn(o.value) : (U.value = [], qt.value = [], Ut.value = [], Ot.value = [], I.value = [], L.value = [], R.value = {}, await Zn(), W.value = ""));
4486
+ if (!e || e === Cr) return;
4487
+ let t = Cr;
4488
+ if (Cr = e, t === void 0) return;
4489
+ let n = E.value, r = !T.value && await wr(n);
4490
+ l.value === e && E.value === n && (r ? dn(o.value) : (U.value = [], Kt.value = [], W.value = [], Ot.value = [], I.value = [], L.value = [], R.value = {}, await Qn(), G.value = ""));
4491
4491
  }), {
4492
4492
  apiClient: k,
4493
4493
  baseUrl: i,
@@ -4549,34 +4549,34 @@ function di(e) {
4549
4549
  isLoadingConversations: Rt,
4550
4550
  hasMoreConversations: Bt,
4551
4551
  isLoadingMoreConversations: Vt,
4552
- chatFiles: Ut,
4553
- isLoadingChatFiles: Wt,
4554
- input: W,
4555
- pendingAttachments: G,
4556
- isAttachmentLimitReached: ir,
4557
- fileLimitError: ar,
4552
+ chatFiles: W,
4553
+ isLoadingChatFiles: Ut,
4554
+ input: G,
4555
+ pendingAttachments: K,
4556
+ isAttachmentLimitReached: ar,
4557
+ fileLimitError: or,
4558
4558
  localChatId: E,
4559
4559
  isConversationBlocked: O,
4560
4560
  inputMessagePlaceholder: Lt,
4561
4561
  chatError: at,
4562
4562
  runningChatIds: Bn,
4563
- backgroundAnswers: qn,
4564
- openBackgroundAnswer: Jn,
4565
- dismissBackgroundAnswer: Yn,
4563
+ backgroundAnswers: Jn,
4564
+ openBackgroundAnswer: Yn,
4565
+ dismissBackgroundAnswer: Xn,
4566
4566
  canQueue: an,
4567
4567
  queuedMessages: rn,
4568
4568
  removeQueuedMessage: ln,
4569
4569
  editQueuedMessage: un,
4570
- activeView: Gt,
4571
- inputFocusRequest: Kt,
4572
- messageFeedbacks: qt,
4573
- feedbackDialogMessage: Jt,
4574
- isFeedbackSubmitting: Yt,
4575
- isFeedbackSubmitted: Xt,
4576
- feedbackSubmitError: Zt,
4577
- isLeadSubmitted: Qt,
4578
- isLoadingSubmitLead: $t,
4579
- submitLeadError: en,
4570
+ activeView: Wt,
4571
+ inputFocusRequest: Gt,
4572
+ messageFeedbacks: Kt,
4573
+ feedbackDialogMessage: qt,
4574
+ isFeedbackSubmitting: Jt,
4575
+ isFeedbackSubmitted: Yt,
4576
+ feedbackSubmitError: Xt,
4577
+ isLeadSubmitted: Zt,
4578
+ isLoadingSubmitLead: Qt,
4579
+ submitLeadError: $t,
4580
4580
  buildDeviceContext: ut,
4581
4581
  initialize: jn,
4582
4582
  loadConversations: dn,
@@ -4584,33 +4584,33 @@ function di(e) {
4584
4584
  searchConversations: pn,
4585
4585
  loadChatFiles: mn,
4586
4586
  refreshMessages: On,
4587
- appendMessage: kn,
4587
+ appendMessage: X,
4588
4588
  getChatFileUrl: hn,
4589
4589
  getChatFilePreviewUrl: gn,
4590
4590
  deleteChatFile: _n,
4591
4591
  handleSubmit: Mn,
4592
4592
  sendMessage: Fn,
4593
4593
  stopGeneration: In,
4594
- startNewChat: Zn,
4595
- regenerate: Qn,
4596
- addToolOutput: $n,
4597
- addToolApprovalResponse: er,
4598
- handleFileSelect: sr,
4599
- discardPendingAttachment: cr,
4600
- clearFileLimitError: or,
4601
- clearPendingAttachments: Xn,
4602
- onUpvote: dr,
4603
- onDownvote: fr,
4604
- onFeedback: pr,
4605
- onFeedbackSubmit: mr,
4606
- onLeadSubmit: gr,
4607
- navigate: br,
4608
- focusInput: xr,
4609
- renameChatTitle: vr,
4610
- deleteChat: yr
4594
+ startNewChat: Qn,
4595
+ regenerate: $n,
4596
+ addToolOutput: er,
4597
+ addToolApprovalResponse: tr,
4598
+ handleFileSelect: cr,
4599
+ discardPendingAttachment: lr,
4600
+ clearFileLimitError: sr,
4601
+ clearPendingAttachments: Zn,
4602
+ onUpvote: fr,
4603
+ onDownvote: pr,
4604
+ onFeedback: mr,
4605
+ onFeedbackSubmit: gr,
4606
+ onLeadSubmit: vr,
4607
+ navigate: xr,
4608
+ focusInput: Sr,
4609
+ renameChatTitle: yr,
4610
+ deleteChat: br
4611
4611
  };
4612
4612
  })();
4613
4613
  }
4614
4614
  export { ft as a, hr as i, di as n, Gr as r, Kr as t };
4615
4615
 
4616
- //# sourceMappingURL=useChatbotStore-Bj00X4yT.js.map
4616
+ //# sourceMappingURL=useChatbotStore-BZ1n3Hyx.js.map