@superinterface/react 2.15.9 → 2.16.1

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.
package/dist/index.js CHANGED
@@ -359,7 +359,7 @@ var SuperinterfaceProvider = function(param) {
359
359
  });
360
360
  };
361
361
  // src/components/threads/Thread/Messages/index.tsx
362
- import { Flex as Flex13 } from "@radix-ui/themes";
362
+ import { Flex as Flex12 } from "@radix-ui/themes";
363
363
  // src/components/threads/Thread/Messages/Content/index.tsx
364
364
  import { useEffect } from "react";
365
365
  // src/hooks/messages/useMessages/index.tsx
@@ -732,7 +732,7 @@ var UserAvatar = function() {
732
732
  });
733
733
  };
734
734
  // src/components/threads/Thread/Messages/Content/MessageGroup/Content/index.tsx
735
- import { Flex as Flex11 } from "@radix-ui/themes";
735
+ import { Flex as Flex10 } from "@radix-ui/themes";
736
736
  // src/components/threads/Thread/Message/index.tsx
737
737
  import { useMemo as useMemo5, Fragment } from "react";
738
738
  import { isEmpty } from "radash";
@@ -753,39 +753,35 @@ var StartingContentSkeleton = function() {
753
753
  });
754
754
  };
755
755
  // src/components/runSteps/RunSteps/index.tsx
756
- import { Flex as Flex10 } from "@radix-ui/themes";
756
+ import { Flex as Flex8 } from "@radix-ui/themes";
757
757
  import { useContext as useContext6 } from "react";
758
758
  // src/contexts/components/ComponentsContext/index.tsx
759
759
  import { createContext as createContext7 } from "react";
760
760
  // src/components/runSteps/RunStep/ToolCalls/index.tsx
761
- import { Flex as Flex9 } from "@radix-ui/themes";
762
- // src/components/runSteps/RunStep/ToolCalls/ToolCall/index.tsx
763
- import { Flex as Flex8 } from "@radix-ui/themes";
761
+ import { Flex as Flex7 } from "@radix-ui/themes";
764
762
  // src/components/runSteps/RunStep/ToolCalls/ToolCall/Fn/index.tsx
765
763
  import { useContext as useContext5 } from "react";
766
764
  // src/contexts/functions/FunctionComponentsContext/index.tsx
767
765
  import { createContext as createContext6 } from "react";
768
766
  var FunctionComponentsContext = createContext6({});
769
767
  // src/components/functions/FunctionBase/index.tsx
770
- import { Popover as Popover2 } from "@radix-ui/themes";
768
+ import { Popover } from "@radix-ui/themes";
771
769
  // src/components/toolCalls/ToolCallBase/index.tsx
772
- import { Flex as Flex6, Button, Popover } from "@radix-ui/themes";
770
+ import { Flex as Flex6, Button } from "@radix-ui/themes";
773
771
  import { jsx as jsx10 } from "react/jsx-runtime";
774
772
  var ToolCallBase = function(param) {
775
773
  var children = param.children;
776
774
  return /* @__PURE__ */ jsx10(Flex6, {
777
775
  py: "1",
778
776
  ml: "-2",
779
- children: /* @__PURE__ */ jsx10(Popover.Trigger, {
780
- children: /* @__PURE__ */ jsx10(Button, {
781
- size: "1",
782
- color: "gold",
783
- variant: "outline",
784
- style: {
785
- boxShadow: "none"
786
- },
787
- children: children
788
- })
777
+ children: /* @__PURE__ */ jsx10(Button, {
778
+ size: "1",
779
+ color: "gold",
780
+ variant: "outline",
781
+ style: {
782
+ boxShadow: "none"
783
+ },
784
+ children: children
789
785
  })
790
786
  });
791
787
  };
@@ -799,10 +795,10 @@ var ToolCallTitle = function(param) {
799
795
  children: children
800
796
  });
801
797
  };
802
- // src/components/functions/FunctionBase/Icon.tsx
798
+ // src/components/toolCalls/ToolCallBase/ToolCallIcon.tsx
803
799
  import { CircleIcon, CircleBackslashIcon, CheckCircledIcon } from "@radix-ui/react-icons";
804
800
  import { jsx as jsx12 } from "react/jsx-runtime";
805
- var Icon = function(param) {
801
+ var ToolCallIcon = function(param) {
806
802
  var runStep = param.runStep;
807
803
  if (runStep.completed_at) {
808
804
  return /* @__PURE__ */ jsx12(CheckCircledIcon, {});
@@ -867,19 +863,21 @@ var Content = function(param) {
867
863
  import { jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
868
864
  var FunctionBase = function(param) {
869
865
  var fn = param.fn, runStep = param.runStep, title2 = param.title;
870
- return /* @__PURE__ */ jsxs3(Popover2.Root, {
866
+ return /* @__PURE__ */ jsxs3(Popover.Root, {
871
867
  children: [
872
- /* @__PURE__ */ jsxs3(ToolCallBase, {
873
- children: [
874
- /* @__PURE__ */ jsx14(Icon, {
875
- runStep: runStep
876
- }),
877
- /* @__PURE__ */ jsx14(ToolCallTitle, {
878
- children: title2
879
- })
880
- ]
868
+ /* @__PURE__ */ jsx14(Popover.Trigger, {
869
+ children: /* @__PURE__ */ jsxs3(ToolCallBase, {
870
+ children: [
871
+ /* @__PURE__ */ jsx14(ToolCallIcon, {
872
+ runStep: runStep
873
+ }),
874
+ /* @__PURE__ */ jsx14(ToolCallTitle, {
875
+ children: title2
876
+ })
877
+ ]
878
+ })
881
879
  }),
882
- /* @__PURE__ */ jsx14(Popover2.Content, {
880
+ /* @__PURE__ */ jsx14(Popover.Content, {
883
881
  style: {
884
882
  maxHeight: "200px"
885
883
  },
@@ -926,55 +924,101 @@ var Fn = function(param) {
926
924
  runStep: runStep
927
925
  }));
928
926
  };
929
- // src/components/runSteps/RunStep/ToolCalls/ToolCall/CodeInterpreter/index.tsx
930
- import { Flex as Flex7 } from "@radix-ui/themes";
931
- import { jsx as jsx17 } from "react/jsx-runtime";
927
+ // src/components/runSteps/RunStep/ToolCalls/ToolCall/CodeInterpreter.tsx
928
+ import { jsx as jsx17, jsxs as jsxs4 } from "react/jsx-runtime";
932
929
  var CodeInterpreter = function(param) {
933
- var codeInterpreter = param.codeInterpreter;
934
- return /* @__PURE__ */ jsx17(Flex7, {
935
- children: codeInterpreter.input
930
+ var runStep = param.runStep, toolCall = param.toolCall;
931
+ return /* @__PURE__ */ jsxs4(ToolCallBase, {
932
+ children: [
933
+ /* @__PURE__ */ jsx17(ToolCallIcon, {
934
+ runStep: runStep
935
+ }),
936
+ /* @__PURE__ */ jsx17(ToolCallTitle, {
937
+ children: "Using code interpreter"
938
+ })
939
+ ]
940
+ });
941
+ };
942
+ // src/components/runSteps/RunStep/ToolCalls/ToolCall/FileSearch.tsx
943
+ import { jsx as jsx18, jsxs as jsxs5 } from "react/jsx-runtime";
944
+ var FileSearch = function(param) {
945
+ var runStep = param.runStep, toolCall = param.toolCall;
946
+ return /* @__PURE__ */ jsxs5(ToolCallBase, {
947
+ children: [
948
+ /* @__PURE__ */ jsx18(ToolCallIcon, {
949
+ runStep: runStep
950
+ }),
951
+ /* @__PURE__ */ jsx18(ToolCallTitle, {
952
+ children: "Searching files"
953
+ })
954
+ ]
955
+ });
956
+ };
957
+ // src/components/runSteps/RunStep/ToolCalls/ToolCall/Fallback.tsx
958
+ import { jsx as jsx19, jsxs as jsxs6 } from "react/jsx-runtime";
959
+ var Fallback = function(param) {
960
+ var runStep = param.runStep, toolCall = param.toolCall;
961
+ return /* @__PURE__ */ jsxs6(ToolCallBase, {
962
+ children: [
963
+ /* @__PURE__ */ jsx19(ToolCallIcon, {
964
+ runStep: runStep
965
+ }),
966
+ /* @__PURE__ */ jsxs6(ToolCallTitle, {
967
+ children: [
968
+ "Using tool: ",
969
+ toolCall.type
970
+ ]
971
+ })
972
+ ]
936
973
  });
937
974
  };
938
975
  // src/components/runSteps/RunStep/ToolCalls/ToolCall/index.tsx
939
- import { jsx as jsx18 } from "react/jsx-runtime";
976
+ import { jsx as jsx20 } from "react/jsx-runtime";
940
977
  var ToolCall = function(param) {
941
978
  var toolCall = param.toolCall, runStep = param.runStep;
942
979
  if (toolCall.type === "function") {
943
- return /* @__PURE__ */ jsx18(Fn, {
980
+ return /* @__PURE__ */ jsx20(Fn, {
944
981
  fn: toolCall.function,
945
982
  runStep: runStep
946
983
  });
947
984
  }
948
985
  if (toolCall.type === "code_interpreter") {
949
- return /* @__PURE__ */ jsx18(CodeInterpreter, {
950
- codeInterpreter: toolCall.code_interpreter,
986
+ return /* @__PURE__ */ jsx20(CodeInterpreter, {
987
+ toolCall: toolCall,
988
+ runStep: runStep
989
+ });
990
+ }
991
+ if (toolCall.type === "file_search") {
992
+ return /* @__PURE__ */ jsx20(FileSearch, {
993
+ toolCall: toolCall,
951
994
  runStep: runStep
952
995
  });
953
996
  }
954
- return /* @__PURE__ */ jsx18(Flex8, {
955
- children: toolCall.type
997
+ return /* @__PURE__ */ jsx20(Fallback, {
998
+ toolCall: toolCall,
999
+ runStep: runStep
956
1000
  });
957
1001
  };
958
1002
  // src/components/runSteps/RunStep/ToolCalls/Starting/index.tsx
959
- import { Popover as Popover3, Text as Text3 } from "@radix-ui/themes";
1003
+ import { Popover as Popover2, Text as Text3 } from "@radix-ui/themes";
960
1004
  import { CircleIcon as CircleIcon2 } from "@radix-ui/react-icons";
961
- import { jsx as jsx19, jsxs as jsxs4 } from "react/jsx-runtime";
1005
+ import { jsx as jsx21, jsxs as jsxs7 } from "react/jsx-runtime";
962
1006
  var Starting = function() {
963
- return /* @__PURE__ */ jsxs4(Popover3.Root, {
1007
+ return /* @__PURE__ */ jsxs7(Popover2.Root, {
964
1008
  children: [
965
- /* @__PURE__ */ jsxs4(ToolCallBase, {
1009
+ /* @__PURE__ */ jsxs7(ToolCallBase, {
966
1010
  children: [
967
- /* @__PURE__ */ jsx19(CircleIcon2, {}),
968
- /* @__PURE__ */ jsx19(ToolCallTitle, {
1011
+ /* @__PURE__ */ jsx21(CircleIcon2, {}),
1012
+ /* @__PURE__ */ jsx21(ToolCallTitle, {
969
1013
  children: "Starting actions"
970
1014
  })
971
1015
  ]
972
1016
  }),
973
- /* @__PURE__ */ jsx19(Popover3.Content, {
1017
+ /* @__PURE__ */ jsx21(Popover2.Content, {
974
1018
  style: {
975
1019
  maxHeight: "500px"
976
1020
  },
977
- children: /* @__PURE__ */ jsx19(Text3, {
1021
+ children: /* @__PURE__ */ jsx21(Text3, {
978
1022
  children: "Getting ready to connect to domain API"
979
1023
  })
980
1024
  })
@@ -982,21 +1026,21 @@ var Starting = function() {
982
1026
  });
983
1027
  };
984
1028
  // src/components/runSteps/RunStep/ToolCalls/index.tsx
985
- import { jsx as jsx20, jsxs as jsxs5 } from "react/jsx-runtime";
1029
+ import { jsx as jsx22, jsxs as jsxs8 } from "react/jsx-runtime";
986
1030
  var Root = function(param) {
987
1031
  var children = param.children;
988
- return /* @__PURE__ */ jsx20(Flex9, {
1032
+ return /* @__PURE__ */ jsx22(Flex7, {
989
1033
  direction: "column",
990
1034
  children: children
991
1035
  });
992
1036
  };
993
1037
  var ToolCalls = function(param) {
994
1038
  var stepDetails = param.stepDetails, runStep = param.runStep;
995
- return /* @__PURE__ */ jsxs5(Root, {
1039
+ return /* @__PURE__ */ jsxs8(Root, {
996
1040
  children: [
997
- !stepDetails.tool_calls.length && /* @__PURE__ */ jsx20(Starting, {}),
1041
+ !stepDetails.tool_calls.length && /* @__PURE__ */ jsx22(Starting, {}),
998
1042
  stepDetails.tool_calls.map(function(toolCall) {
999
- return /* @__PURE__ */ jsx20(ToolCall, {
1043
+ return /* @__PURE__ */ jsx22(ToolCall, {
1000
1044
  toolCall: toolCall,
1001
1045
  runStep: runStep
1002
1046
  }, toolCall.id);
@@ -1008,11 +1052,11 @@ ToolCalls.Root = Root;
1008
1052
  ToolCalls.Starting = Starting;
1009
1053
  ToolCalls.ToolCall = ToolCall;
1010
1054
  // src/components/runSteps/RunStep/index.tsx
1011
- import { jsx as jsx21 } from "react/jsx-runtime";
1055
+ import { jsx as jsx23 } from "react/jsx-runtime";
1012
1056
  var RunStep = function(param) {
1013
1057
  var runStep = param.runStep;
1014
1058
  if (runStep.step_details.type === "tool_calls") {
1015
- return /* @__PURE__ */ jsx21(ToolCalls, {
1059
+ return /* @__PURE__ */ jsx23(ToolCalls, {
1016
1060
  stepDetails: runStep.step_details,
1017
1061
  runStep: runStep
1018
1062
  });
@@ -1027,15 +1071,15 @@ var ComponentsContext = createContext7({
1027
1071
  }
1028
1072
  });
1029
1073
  // src/components/runSteps/RunSteps/index.tsx
1030
- import { jsx as jsx22 } from "react/jsx-runtime";
1074
+ import { jsx as jsx24 } from "react/jsx-runtime";
1031
1075
  var RunSteps = function(param) {
1032
1076
  var runSteps = param.runSteps;
1033
1077
  var componentsContext = useContext6(ComponentsContext);
1034
1078
  var Component = componentsContext.components.RunStep;
1035
- return /* @__PURE__ */ jsx22(Flex10, {
1079
+ return /* @__PURE__ */ jsx24(Flex8, {
1036
1080
  direction: "column-reverse",
1037
1081
  children: runSteps.map(function(runStep) {
1038
- return /* @__PURE__ */ jsx22(Component, {
1082
+ return /* @__PURE__ */ jsx24(Component, {
1039
1083
  runStep: runStep
1040
1084
  }, runStep.id);
1041
1085
  })
@@ -1074,12 +1118,12 @@ import { useContext as useContext7 } from "react";
1074
1118
  import { createContext as createContext9 } from "react";
1075
1119
  // src/contexts/markdown/MarkdownContext/lib/components/Paragraph.tsx
1076
1120
  import { Box as Box3, Text as Text4 } from "@radix-ui/themes";
1077
- import { jsx as jsx23 } from "react/jsx-runtime";
1121
+ import { jsx as jsx25 } from "react/jsx-runtime";
1078
1122
  var Paragraph = function(param) {
1079
1123
  var children = param.children;
1080
- return /* @__PURE__ */ jsx23(Box3, {
1124
+ return /* @__PURE__ */ jsx25(Box3, {
1081
1125
  pb: "3",
1082
- children: /* @__PURE__ */ jsx23(Text4, {
1126
+ children: /* @__PURE__ */ jsx25(Text4, {
1083
1127
  size: "3",
1084
1128
  style: {
1085
1129
  whiteSpace: "pre-line",
@@ -1091,23 +1135,23 @@ var Paragraph = function(param) {
1091
1135
  };
1092
1136
  // src/contexts/markdown/MarkdownContext/lib/components/Link.tsx
1093
1137
  import { Link as RadixLink } from "@radix-ui/themes";
1094
- import { jsx as jsx24 } from "react/jsx-runtime";
1138
+ import { jsx as jsx26 } from "react/jsx-runtime";
1095
1139
  var Link = function(param) {
1096
1140
  var children = param.children, href = param.href;
1097
- return /* @__PURE__ */ jsx24(RadixLink, {
1141
+ return /* @__PURE__ */ jsx26(RadixLink, {
1098
1142
  href: href,
1099
1143
  children: children
1100
1144
  });
1101
1145
  };
1102
1146
  // src/contexts/markdown/MarkdownContext/lib/components/UnorderedList.tsx
1103
1147
  import { Box as Box4 } from "@radix-ui/themes";
1104
- import { jsx as jsx25 } from "react/jsx-runtime";
1148
+ import { jsx as jsx27 } from "react/jsx-runtime";
1105
1149
  var UnorderedList = function(param) {
1106
1150
  var children = param.children;
1107
- return /* @__PURE__ */ jsx25(Box4, {
1151
+ return /* @__PURE__ */ jsx27(Box4, {
1108
1152
  pb: "3",
1109
1153
  asChild: true,
1110
- children: /* @__PURE__ */ jsx25("ul", {
1154
+ children: /* @__PURE__ */ jsx27("ul", {
1111
1155
  style: {
1112
1156
  listStylePosition: "inside"
1113
1157
  },
@@ -1117,13 +1161,13 @@ var UnorderedList = function(param) {
1117
1161
  };
1118
1162
  // src/contexts/markdown/MarkdownContext/lib/components/OrderedList.tsx
1119
1163
  import { Box as Box5 } from "@radix-ui/themes";
1120
- import { jsx as jsx26 } from "react/jsx-runtime";
1164
+ import { jsx as jsx28 } from "react/jsx-runtime";
1121
1165
  var OrderedList = function(param) {
1122
1166
  var children = param.children;
1123
- return /* @__PURE__ */ jsx26(Box5, {
1167
+ return /* @__PURE__ */ jsx28(Box5, {
1124
1168
  pb: "3",
1125
1169
  asChild: true,
1126
- children: /* @__PURE__ */ jsx26("ol", {
1170
+ children: /* @__PURE__ */ jsx28("ol", {
1127
1171
  style: {
1128
1172
  listStylePosition: "inside"
1129
1173
  },
@@ -1133,31 +1177,31 @@ var OrderedList = function(param) {
1133
1177
  };
1134
1178
  // src/contexts/markdown/MarkdownContext/lib/components/ListItem.tsx
1135
1179
  import { Box as Box6 } from "@radix-ui/themes";
1136
- import { jsx as jsx27 } from "react/jsx-runtime";
1180
+ import { jsx as jsx29 } from "react/jsx-runtime";
1137
1181
  var ListItem = function(param) {
1138
1182
  var children = param.children;
1139
- return /* @__PURE__ */ jsx27(Box6, {
1183
+ return /* @__PURE__ */ jsx29(Box6, {
1140
1184
  pb: "1",
1141
- children: /* @__PURE__ */ jsx27("li", {
1185
+ children: /* @__PURE__ */ jsx29("li", {
1142
1186
  children: children
1143
1187
  })
1144
1188
  });
1145
1189
  };
1146
1190
  // src/contexts/markdown/MarkdownContext/lib/components/Strong.tsx
1147
1191
  import { Strong as RadixStrong } from "@radix-ui/themes";
1148
- import { jsx as jsx28 } from "react/jsx-runtime";
1192
+ import { jsx as jsx30 } from "react/jsx-runtime";
1149
1193
  var Strong = function(param) {
1150
1194
  var children = param.children;
1151
- return /* @__PURE__ */ jsx28(RadixStrong, {
1195
+ return /* @__PURE__ */ jsx30(RadixStrong, {
1152
1196
  children: children
1153
1197
  });
1154
1198
  };
1155
1199
  // src/contexts/markdown/MarkdownContext/lib/components/Pre.tsx
1156
1200
  import { Box as Box7 } from "@radix-ui/themes";
1157
- import { jsx as jsx29 } from "react/jsx-runtime";
1201
+ import { jsx as jsx31 } from "react/jsx-runtime";
1158
1202
  var Pre = function(param) {
1159
1203
  var children = param.children;
1160
- return /* @__PURE__ */ jsx29(Box7, {
1204
+ return /* @__PURE__ */ jsx31(Box7, {
1161
1205
  style: {
1162
1206
  whiteSpace: "pre-wrap",
1163
1207
  wordBreak: "break-word"
@@ -1167,20 +1211,20 @@ var Pre = function(param) {
1167
1211
  };
1168
1212
  // src/contexts/markdown/MarkdownContext/lib/components/Code.tsx
1169
1213
  import { Code as RadixCode } from "@radix-ui/themes";
1170
- import { jsx as jsx30 } from "react/jsx-runtime";
1214
+ import { jsx as jsx32 } from "react/jsx-runtime";
1171
1215
  var Code2 = function(param) {
1172
1216
  var children = param.children;
1173
- return /* @__PURE__ */ jsx30(RadixCode, {
1217
+ return /* @__PURE__ */ jsx32(RadixCode, {
1174
1218
  children: children
1175
1219
  });
1176
1220
  };
1177
1221
  // src/contexts/markdown/MarkdownContext/lib/components/Img.tsx
1178
1222
  import { Box as Box8 } from "@radix-ui/themes";
1179
- import { jsx as jsx31 } from "react/jsx-runtime";
1223
+ import { jsx as jsx33 } from "react/jsx-runtime";
1180
1224
  var Img = function(props) {
1181
- return /* @__PURE__ */ jsx31(Box8, {
1225
+ return /* @__PURE__ */ jsx33(Box8, {
1182
1226
  pb: "3",
1183
- children: /* @__PURE__ */ jsx31("img", _object_spread_props(_object_spread({}, props), {
1227
+ children: /* @__PURE__ */ jsx33("img", _object_spread_props(_object_spread({}, props), {
1184
1228
  style: {
1185
1229
  maxWidth: "100%",
1186
1230
  height: "auto"
@@ -1202,26 +1246,46 @@ var components = {
1202
1246
  };
1203
1247
  // src/contexts/markdown/MarkdownContext/index.ts
1204
1248
  var MarkdownContext = createContext9({
1205
- remarkPlugins: [],
1206
- rehypeReactOptions: {
1207
- components: components
1208
- }
1249
+ components: components
1209
1250
  });
1210
1251
  // src/hooks/markdown/useMarkdownContext/index.ts
1211
1252
  var useMarkdownContext = function() {
1212
1253
  return useContext7(MarkdownContext);
1213
1254
  };
1214
1255
  // src/components/threads/Thread/Message/TextContent.tsx
1215
- import { jsx as jsx32 } from "react/jsx-runtime";
1256
+ import { jsx as jsx34 } from "react/jsx-runtime";
1216
1257
  var TextContent = function(param) {
1217
1258
  var content = param.content;
1218
1259
  var markdownContext = useMarkdownContext();
1219
- return /* @__PURE__ */ jsx32(Markdown, _object_spread_props(_object_spread({}, markdownContext), {
1260
+ return /* @__PURE__ */ jsx34(Markdown, _object_spread_props(_object_spread({}, markdownContext), {
1220
1261
  children: content.text.value
1221
1262
  }));
1222
1263
  };
1264
+ // src/components/threads/Thread/Message/Attachments/index.tsx
1265
+ import { Flex as Flex9, Badge } from "@radix-ui/themes";
1266
+ import { FileIcon } from "@radix-ui/react-icons";
1267
+ import { jsx as jsx35, jsxs as jsxs9 } from "react/jsx-runtime";
1268
+ var Attachments = function(param) {
1269
+ var message = param.message;
1270
+ var _message_attachments;
1271
+ if (!((_message_attachments = message.attachments) === null || _message_attachments === void 0 ? void 0 : _message_attachments.length)) return null;
1272
+ return /* @__PURE__ */ jsx35(Flex9, {
1273
+ align: "start",
1274
+ pb: "1",
1275
+ children: /* @__PURE__ */ jsxs9(Badge, {
1276
+ color: "gray",
1277
+ variant: "surface",
1278
+ children: [
1279
+ /* @__PURE__ */ jsx35(FileIcon, {}),
1280
+ message.attachments.length,
1281
+ " file",
1282
+ message.attachments.length > 1 ? "s" : ""
1283
+ ]
1284
+ })
1285
+ });
1286
+ };
1223
1287
  // src/components/threads/Thread/Message/index.tsx
1224
- import { jsx as jsx33, jsxs as jsxs6 } from "react/jsx-runtime";
1288
+ import { jsx as jsx36, jsxs as jsxs10 } from "react/jsx-runtime";
1225
1289
  var Message = function(param) {
1226
1290
  var message = param.message;
1227
1291
  var _useMemo5 = _sliced_to_array(useMemo5(function() {
@@ -1266,65 +1330,68 @@ var Message = function(param) {
1266
1330
  }, [
1267
1331
  message
1268
1332
  ]);
1269
- return /* @__PURE__ */ jsx33(Provider, {
1333
+ return /* @__PURE__ */ jsx36(Provider, {
1270
1334
  value: {
1271
1335
  message: message
1272
1336
  },
1273
- children: /* @__PURE__ */ jsxs6(Box9, {
1337
+ children: /* @__PURE__ */ jsxs10(Box9, {
1274
1338
  children: [
1275
- /* @__PURE__ */ jsx33(RunSteps, {
1339
+ /* @__PURE__ */ jsx36(RunSteps, {
1276
1340
  runSteps: olderRunSteps
1277
1341
  }),
1278
- /* @__PURE__ */ jsxs6(Box9, {
1342
+ /* @__PURE__ */ jsxs10(Box9, {
1279
1343
  children: [
1344
+ /* @__PURE__ */ jsx36(Attachments, {
1345
+ message: message
1346
+ }),
1280
1347
  message.content.map(function(content, index) {
1281
- return /* @__PURE__ */ jsx33(Fragment, {
1282
- children: content.type === "text" && /* @__PURE__ */ jsx33(TextContent, {
1348
+ return /* @__PURE__ */ jsx36(Fragment, {
1349
+ children: content.type === "text" && /* @__PURE__ */ jsx36(TextContent, {
1283
1350
  content: content
1284
1351
  })
1285
1352
  }, index);
1286
1353
  }),
1287
- isInProgress && isEmpty(laterRunSteps) && /* @__PURE__ */ jsx33(StartingContentSkeleton, {})
1354
+ isInProgress && isEmpty(laterRunSteps) && /* @__PURE__ */ jsx36(StartingContentSkeleton, {})
1288
1355
  ]
1289
1356
  }),
1290
- /* @__PURE__ */ jsx33(RunSteps, {
1357
+ /* @__PURE__ */ jsx36(RunSteps, {
1291
1358
  runSteps: laterRunSteps
1292
1359
  }),
1293
- isInProgress && !isEmpty(laterRunSteps) && /* @__PURE__ */ jsx33(Box9, {
1294
- children: /* @__PURE__ */ jsx33(StartingContentSkeleton, {})
1360
+ isInProgress && !isEmpty(laterRunSteps) && /* @__PURE__ */ jsx36(Box9, {
1361
+ children: /* @__PURE__ */ jsx36(StartingContentSkeleton, {})
1295
1362
  })
1296
1363
  ]
1297
1364
  })
1298
1365
  });
1299
1366
  };
1300
1367
  // src/components/threads/Thread/Messages/Content/MessageGroup/Content/index.tsx
1301
- import { jsx as jsx34 } from "react/jsx-runtime";
1368
+ import { jsx as jsx37 } from "react/jsx-runtime";
1302
1369
  var Content2 = function(param) {
1303
1370
  var messageGroup = param.messageGroup;
1304
- return /* @__PURE__ */ jsx34(Flex11, {
1371
+ return /* @__PURE__ */ jsx37(Flex10, {
1305
1372
  direction: "column-reverse",
1306
1373
  children: messageGroup.messages.map(function(message) {
1307
- return /* @__PURE__ */ jsx34(Message, {
1374
+ return /* @__PURE__ */ jsx37(Message, {
1308
1375
  message: message
1309
1376
  }, message.id);
1310
1377
  })
1311
1378
  });
1312
1379
  };
1313
1380
  // src/components/threads/Thread/Messages/Content/MessageGroup/index.tsx
1314
- import { jsx as jsx35, jsxs as jsxs7 } from "react/jsx-runtime";
1381
+ import { jsx as jsx38, jsxs as jsxs11 } from "react/jsx-runtime";
1315
1382
  var MessageGroup = function(param) {
1316
1383
  var messageGroup = param.messageGroup;
1317
1384
  var assistantNameContext = useContext8(AssistantNameContext);
1318
- return /* @__PURE__ */ jsxs7(MessageGroupBase, {
1385
+ return /* @__PURE__ */ jsxs11(MessageGroupBase, {
1319
1386
  children: [
1320
- messageGroup.role === "user" ? /* @__PURE__ */ jsx35(UserAvatar, {}) : /* @__PURE__ */ jsx35(AssistantAvatar, {}),
1321
- /* @__PURE__ */ jsxs7(Box10, {
1387
+ messageGroup.role === "user" ? /* @__PURE__ */ jsx38(UserAvatar, {}) : /* @__PURE__ */ jsx38(AssistantAvatar, {}),
1388
+ /* @__PURE__ */ jsxs11(Box10, {
1322
1389
  flexGrow: "1",
1323
1390
  children: [
1324
- /* @__PURE__ */ jsx35(Name, {
1391
+ /* @__PURE__ */ jsx38(Name, {
1325
1392
  children: messageGroup.role === "user" ? "You" : assistantNameContext
1326
1393
  }),
1327
- /* @__PURE__ */ jsx35(Content2, {
1394
+ /* @__PURE__ */ jsx38(Content2, {
1328
1395
  messageGroup: messageGroup
1329
1396
  })
1330
1397
  ]
@@ -1333,7 +1400,7 @@ var MessageGroup = function(param) {
1333
1400
  });
1334
1401
  };
1335
1402
  // src/components/threads/Thread/Messages/Content/index.tsx
1336
- import { Fragment as Fragment2, jsx as jsx36 } from "react/jsx-runtime";
1403
+ import { Fragment as Fragment2, jsx as jsx39 } from "react/jsx-runtime";
1337
1404
  var Content3 = function() {
1338
1405
  var _useMessages = useMessages(), messages2 = _useMessages.messages, isLoading = _useMessages.isLoading, isLoadingError = _useMessages.isLoadingError;
1339
1406
  var addToast = useToasts().addToast;
@@ -1352,11 +1419,11 @@ var Content3 = function() {
1352
1419
  addToast
1353
1420
  ]);
1354
1421
  if (isLoading || isLoadingError) {
1355
- return /* @__PURE__ */ jsx36(MessagesSkeleton, {});
1422
+ return /* @__PURE__ */ jsx39(MessagesSkeleton, {});
1356
1423
  }
1357
- return /* @__PURE__ */ jsx36(Fragment2, {
1424
+ return /* @__PURE__ */ jsx39(Fragment2, {
1358
1425
  children: messageGroups2.map(function(messageGroup) {
1359
- return /* @__PURE__ */ jsx36(MessageGroup, {
1426
+ return /* @__PURE__ */ jsx39(MessageGroup, {
1360
1427
  messageGroup: messageGroup
1361
1428
  }, messageGroup.id);
1362
1429
  })
@@ -1367,20 +1434,20 @@ import { useMemo as useMemo7 } from "react";
1367
1434
  // src/components/skeletons/StartingSkeleton/index.tsx
1368
1435
  import { useContext as useContext9 } from "react";
1369
1436
  import { Box as Box11 } from "@radix-ui/themes";
1370
- import { jsx as jsx37, jsxs as jsxs8 } from "react/jsx-runtime";
1437
+ import { jsx as jsx40, jsxs as jsxs12 } from "react/jsx-runtime";
1371
1438
  var StartingSkeleton = function(param) {
1372
1439
  var children = param.children;
1373
1440
  var assistantNameContext = useContext9(AssistantNameContext);
1374
- return /* @__PURE__ */ jsxs8(MessageGroupBase, {
1441
+ return /* @__PURE__ */ jsxs12(MessageGroupBase, {
1375
1442
  children: [
1376
- /* @__PURE__ */ jsx37(AssistantAvatar, {}),
1377
- /* @__PURE__ */ jsxs8(Box11, {
1443
+ /* @__PURE__ */ jsx40(AssistantAvatar, {}),
1444
+ /* @__PURE__ */ jsxs12(Box11, {
1378
1445
  children: [
1379
- /* @__PURE__ */ jsx37(Name, {
1446
+ /* @__PURE__ */ jsx40(Name, {
1380
1447
  children: assistantNameContext
1381
1448
  }),
1382
1449
  children,
1383
- /* @__PURE__ */ jsx37(StartingContentSkeleton, {})
1450
+ /* @__PURE__ */ jsx40(StartingContentSkeleton, {})
1384
1451
  ]
1385
1452
  })
1386
1453
  ]
@@ -1405,7 +1472,7 @@ var isOptimistic = function(param) {
1405
1472
  return _4.startsWith(id, "-");
1406
1473
  };
1407
1474
  // src/components/threads/Thread/Messages/Progress/index.tsx
1408
- import { jsx as jsx38 } from "react/jsx-runtime";
1475
+ import { jsx as jsx41 } from "react/jsx-runtime";
1409
1476
  var Progress = function() {
1410
1477
  var latestMessage = useLatestMessage().latestMessage;
1411
1478
  var isMutatingMessage = useIsMutatingMessage();
@@ -1423,10 +1490,10 @@ var Progress = function() {
1423
1490
  isMutatingMessage
1424
1491
  ]);
1425
1492
  if (!isVisible) return null;
1426
- return /* @__PURE__ */ jsx38(StartingSkeleton, {});
1493
+ return /* @__PURE__ */ jsx41(StartingSkeleton, {});
1427
1494
  };
1428
1495
  // src/components/threads/Thread/Messages/Root/index.tsx
1429
- import { Flex as Flex12 } from "@radix-ui/themes";
1496
+ import { Flex as Flex11 } from "@radix-ui/themes";
1430
1497
  // src/hooks/misc/useInfiniteScroll/index.tsx
1431
1498
  import { useRef as useRef3 } from "react";
1432
1499
  import { useInView } from "react-intersection-observer";
@@ -1482,7 +1549,7 @@ var useInfiniteScroll = function(param) {
1482
1549
  };
1483
1550
  };
1484
1551
  // src/components/threads/Thread/Messages/Root/index.tsx
1485
- import { jsx as jsx39, jsxs as jsxs9 } from "react/jsx-runtime";
1552
+ import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
1486
1553
  var Root2 = function(param) {
1487
1554
  var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
1488
1555
  var _useMessages = useMessages(), isFetchingNextPage = _useMessages.isFetchingNextPage, hasNextPage = _useMessages.hasNextPage, fetchNextPage = _useMessages.fetchNextPage;
@@ -1491,7 +1558,7 @@ var Root2 = function(param) {
1491
1558
  hasNextPage: hasNextPage,
1492
1559
  fetchNextPage: fetchNextPage
1493
1560
  }), containerRef = _useInfiniteScroll.containerRef, loaderRef = _useInfiniteScroll.loaderRef;
1494
- return /* @__PURE__ */ jsxs9(Flex12, {
1561
+ return /* @__PURE__ */ jsxs13(Flex11, {
1495
1562
  ref: containerRef,
1496
1563
  direction: "column-reverse",
1497
1564
  flexGrow: "1",
@@ -1500,10 +1567,10 @@ var Root2 = function(param) {
1500
1567
  }),
1501
1568
  children: [
1502
1569
  children,
1503
- hasNextPage && /* @__PURE__ */ jsx39(Flex12, {
1570
+ hasNextPage && /* @__PURE__ */ jsx42(Flex11, {
1504
1571
  ref: loaderRef
1505
1572
  }),
1506
- /* @__PURE__ */ jsx39(Flex12, {
1573
+ /* @__PURE__ */ jsx42(Flex11, {
1507
1574
  flexShrink: "0",
1508
1575
  flexGrow: "1"
1509
1576
  })
@@ -1511,30 +1578,30 @@ var Root2 = function(param) {
1511
1578
  });
1512
1579
  };
1513
1580
  // src/components/threads/Thread/Messages/NextPageSkeleton.tsx
1514
- import { jsx as jsx40 } from "react/jsx-runtime";
1581
+ import { jsx as jsx43 } from "react/jsx-runtime";
1515
1582
  var NextPageSkeleton = function() {
1516
1583
  var hasNextPage = useMessages().hasNextPage;
1517
1584
  if (!hasNextPage) {
1518
1585
  return null;
1519
1586
  }
1520
- return /* @__PURE__ */ jsx40(MessagesSkeleton, {});
1587
+ return /* @__PURE__ */ jsx43(MessagesSkeleton, {});
1521
1588
  };
1522
1589
  // src/components/threads/Thread/Messages/index.tsx
1523
- import { jsx as jsx41, jsxs as jsxs10 } from "react/jsx-runtime";
1590
+ import { jsx as jsx44, jsxs as jsxs14 } from "react/jsx-runtime";
1524
1591
  var Messages = function(param) {
1525
1592
  var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
1526
- return /* @__PURE__ */ jsxs10(Root2, {
1593
+ return /* @__PURE__ */ jsxs14(Root2, {
1527
1594
  style: style,
1528
1595
  children: [
1529
- /* @__PURE__ */ jsx41(Flex13, {
1596
+ /* @__PURE__ */ jsx44(Flex12, {
1530
1597
  flexShrink: "0",
1531
1598
  height: "var(--space-3)"
1532
1599
  }),
1533
- /* @__PURE__ */ jsx41(Progress, {}),
1600
+ /* @__PURE__ */ jsx44(Progress, {}),
1534
1601
  children,
1535
- /* @__PURE__ */ jsx41(Content3, {}),
1536
- /* @__PURE__ */ jsx41(NextPageSkeleton, {}),
1537
- /* @__PURE__ */ jsx41(Flex13, {
1602
+ /* @__PURE__ */ jsx44(Content3, {}),
1603
+ /* @__PURE__ */ jsx44(NextPageSkeleton, {}),
1604
+ /* @__PURE__ */ jsx44(Flex12, {
1538
1605
  flexShrink: "0",
1539
1606
  flexGrow: "1"
1540
1607
  })
@@ -1544,47 +1611,63 @@ var Messages = function(param) {
1544
1611
  Messages.Root = Root2;
1545
1612
  Messages.Message = Message;
1546
1613
  Messages.NextPageSkeleton = NextPageSkeleton;
1547
- // src/components/threads/Thread/MessageForm/index.tsx
1548
- import { Flex as Flex15, Text as Text5 } from "@radix-ui/themes";
1549
1614
  // src/components/threads/Thread/MessageForm/Submit/index.tsx
1550
1615
  import { ArrowUpIcon, StopIcon } from "@radix-ui/react-icons";
1551
- import { IconButton } from "@radix-ui/themes";
1616
+ import { IconButton, Flex as Flex13 } from "@radix-ui/themes";
1552
1617
  // src/hooks/messages/useMessageFormContext/index.ts
1553
1618
  import { useContext as useContext10 } from "react";
1554
1619
  // src/contexts/messages/MessageFormContext/index.ts
1555
1620
  import { createContext as createContext10 } from "react";
1556
1621
  var MessageFormContext = createContext10({
1557
1622
  isDisabled: false,
1558
- isLoading: false
1623
+ isLoading: false,
1624
+ files: [],
1625
+ setFiles: function() {},
1626
+ isFileLoading: false
1559
1627
  });
1560
1628
  // src/hooks/messages/useMessageFormContext/index.ts
1561
1629
  var useMessageFormContext = function() {
1562
1630
  return useContext10(MessageFormContext);
1563
1631
  };
1564
1632
  // src/components/threads/Thread/MessageForm/Submit/index.tsx
1565
- import { jsx as jsx42 } from "react/jsx-runtime";
1566
- var Submit = function() {
1633
+ import { jsx as jsx45 } from "react/jsx-runtime";
1634
+ var Root3 = function(param) {
1635
+ var children = param.children;
1636
+ return /* @__PURE__ */ jsx45(Flex13, {
1637
+ flexShrink: "0",
1638
+ align: "end",
1639
+ children: children
1640
+ });
1641
+ };
1642
+ var Button2 = function() {
1567
1643
  var superinterfaceContext = useSuperinterfaceContext();
1568
- var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading;
1644
+ var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading, isFileLoading = _useMessageFormContext.isFileLoading;
1569
1645
  if (isLoading) {
1570
- return /* @__PURE__ */ jsx42(IconButton, {
1646
+ return /* @__PURE__ */ jsx45(IconButton, {
1571
1647
  type: "button",
1572
1648
  onClick: function() {
1573
1649
  var _superinterfaceContext_createMessageAbortControllerRef_current;
1574
1650
  return (_superinterfaceContext_createMessageAbortControllerRef_current = superinterfaceContext.createMessageAbortControllerRef.current) === null || _superinterfaceContext_createMessageAbortControllerRef_current === void 0 ? void 0 : _superinterfaceContext_createMessageAbortControllerRef_current.abort();
1575
1651
  },
1576
- children: /* @__PURE__ */ jsx42(StopIcon, {})
1652
+ children: /* @__PURE__ */ jsx45(StopIcon, {})
1577
1653
  });
1578
1654
  }
1579
- return /* @__PURE__ */ jsx42(IconButton, {
1655
+ return /* @__PURE__ */ jsx45(IconButton, {
1580
1656
  type: "submit",
1581
- disabled: isDisabled,
1582
- children: /* @__PURE__ */ jsx42(ArrowUpIcon, {})
1657
+ disabled: isDisabled || isFileLoading,
1658
+ children: /* @__PURE__ */ jsx45(ArrowUpIcon, {})
1659
+ });
1660
+ };
1661
+ var Submit = function() {
1662
+ return /* @__PURE__ */ jsx45(Root3, {
1663
+ children: /* @__PURE__ */ jsx45(Button2, {})
1583
1664
  });
1584
1665
  };
1666
+ Submit.Root = Root3;
1667
+ Submit.Button = Button2;
1585
1668
  // src/components/threads/Thread/MessageForm/Root/index.tsx
1586
1669
  import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
1587
- import { useMemo as useMemo8 } from "react";
1670
+ import { useMemo as useMemo8, useState } from "react";
1588
1671
  import { useForm, FormProvider } from "react-hook-form";
1589
1672
  import { Box as Box12 } from "@radix-ui/themes";
1590
1673
  // src/hooks/messages/useCreateMessage/index.ts
@@ -1603,6 +1686,7 @@ var optimisticId = function() {
1603
1686
  var data = function(param) {
1604
1687
  var newMessage = param.newMessage;
1605
1688
  return function(prevData) {
1689
+ var _newMessage_attachments;
1606
1690
  var message = {
1607
1691
  id: optimisticId(),
1608
1692
  role: "user",
@@ -1620,7 +1704,7 @@ var data = function(param) {
1620
1704
  run_id: null,
1621
1705
  assistant_id: null,
1622
1706
  thread_id: null,
1623
- attachments: [],
1707
+ attachments: (_newMessage_attachments = newMessage.attachments) !== null && _newMessage_attachments !== void 0 ? _newMessage_attachments : [],
1624
1708
  metadata: {},
1625
1709
  runSteps: []
1626
1710
  };
@@ -1662,7 +1746,8 @@ var onMutate = function(param) {
1662
1746
  queryKey = [
1663
1747
  "messages",
1664
1748
  omit(newMessage, [
1665
- "content"
1749
+ "content",
1750
+ "attachments"
1666
1751
  ])
1667
1752
  ];
1668
1753
  return [
@@ -2207,9 +2292,10 @@ var formOptions = {
2207
2292
  };
2208
2293
  // src/components/threads/Thread/MessageForm/Root/index.tsx
2209
2294
  import { partob as partob2 } from "radash";
2210
- import { jsx as jsx43 } from "react/jsx-runtime";
2211
- var Root3 = function(param) {
2295
+ import { jsx as jsx46 } from "react/jsx-runtime";
2296
+ var Root4 = function(param) {
2212
2297
  var children = param.children, onSubmitArg = param.onSubmit;
2298
+ var _useState = _sliced_to_array(useState([]), 2), files = _useState[0], setFiles = _useState[1];
2213
2299
  var formProps = useForm(formOptions);
2214
2300
  var handleSubmit = formProps.handleSubmit, isSubmitting = formProps.formState.isSubmitting, reset = formProps.reset;
2215
2301
  var addToast = useToasts().addToast;
@@ -2239,27 +2325,69 @@ var Root3 = function(param) {
2239
2325
  }
2240
2326
  }).createMessage;
2241
2327
  var isMutatingMessage = useIsMutatingMessage();
2328
+ var isFileLoading = useMemo8(function() {
2329
+ return files.some(function(file) {
2330
+ return isOptimistic({
2331
+ id: file.id
2332
+ });
2333
+ });
2334
+ }, [
2335
+ files
2336
+ ]);
2242
2337
  var isLoading = useMemo8(function() {
2243
2338
  return isMutatingMessage || isSubmitting;
2244
2339
  }, [
2245
2340
  isMutatingMessage,
2246
2341
  isSubmitting
2247
2342
  ]);
2343
+ var latestMessage = useLatestMessage().latestMessage;
2344
+ var isDisabled = useMemo8(function() {
2345
+ var // @ts-ignore-next-line
2346
+ _latestMessage_metadata;
2347
+ return latestMessage === null || latestMessage === void 0 ? void 0 : (_latestMessage_metadata = latestMessage.metadata) === null || _latestMessage_metadata === void 0 ? void 0 : _latestMessage_metadata.isBlocking;
2348
+ }, [
2349
+ latestMessage,
2350
+ isLoading,
2351
+ files
2352
+ ]);
2248
2353
  var onSubmit = onSubmitArg ? partob2(onSubmitArg, {
2249
2354
  reset: reset,
2250
2355
  createMessage: createMessage
2251
2356
  }) : function() {
2252
2357
  var _ref = _async_to_generator(function(data2) {
2358
+ var attachments;
2253
2359
  return _ts_generator(this, function(_state) {
2254
2360
  switch(_state.label){
2255
2361
  case 0:
2362
+ if (isFileLoading) return [
2363
+ 2
2364
+ ];
2365
+ if (isLoading) return [
2366
+ 2
2367
+ ];
2368
+ if (isDisabled) return [
2369
+ 2
2370
+ ];
2256
2371
  reset();
2372
+ setFiles([]);
2373
+ attachments = files.map(function(file) {
2374
+ return {
2375
+ file_id: file.id,
2376
+ tools: [
2377
+ {
2378
+ type: "file_search"
2379
+ }
2380
+ ]
2381
+ };
2382
+ });
2257
2383
  return [
2258
2384
  4,
2259
- createMessage({
2385
+ createMessage(_object_spread({
2260
2386
  // @ts-ignore-next-line
2261
2387
  content: data2.content
2262
- })
2388
+ }, attachments.length ? {
2389
+ attachments: attachments
2390
+ } : {}))
2263
2391
  ];
2264
2392
  case 1:
2265
2393
  _state.sent();
@@ -2273,25 +2401,19 @@ var Root3 = function(param) {
2273
2401
  return _ref.apply(this, arguments);
2274
2402
  };
2275
2403
  }();
2276
- var latestMessage = useLatestMessage().latestMessage;
2277
- var isDisabled = useMemo8(function() {
2278
- var // @ts-ignore-next-line
2279
- _latestMessage_metadata;
2280
- return latestMessage === null || latestMessage === void 0 ? void 0 : (_latestMessage_metadata = latestMessage.metadata) === null || _latestMessage_metadata === void 0 ? void 0 : _latestMessage_metadata.isBlocking;
2281
- }, [
2282
- latestMessage,
2283
- isLoading
2284
- ]);
2285
- return /* @__PURE__ */ jsx43(MessageFormContext.Provider, {
2404
+ return /* @__PURE__ */ jsx46(MessageFormContext.Provider, {
2286
2405
  value: {
2287
2406
  isDisabled: isDisabled,
2288
- isLoading: isLoading
2407
+ isLoading: isLoading,
2408
+ files: files,
2409
+ setFiles: setFiles,
2410
+ isFileLoading: isFileLoading
2289
2411
  },
2290
- children: /* @__PURE__ */ jsx43(FormProvider, _object_spread_props(_object_spread({}, formProps), {
2291
- children: /* @__PURE__ */ jsx43(Box12, {
2412
+ children: /* @__PURE__ */ jsx46(FormProvider, _object_spread_props(_object_spread({}, formProps), {
2413
+ children: /* @__PURE__ */ jsx46(Box12, {
2292
2414
  asChild: true,
2293
2415
  flexShrink: "0",
2294
- children: /* @__PURE__ */ jsx43("form", {
2416
+ children: /* @__PURE__ */ jsx46("form", {
2295
2417
  onSubmit: handleSubmit(onSubmit),
2296
2418
  children: children
2297
2419
  })
@@ -2300,20 +2422,24 @@ var Root3 = function(param) {
2300
2422
  });
2301
2423
  };
2302
2424
  // src/components/threads/Thread/MessageForm/Field/index.tsx
2425
+ import { useFormContext as useFormContext2 } from "react-hook-form";
2426
+ import { Container as RadixContainer, Flex as Flex17 } from "@radix-ui/themes";
2427
+ // src/components/threads/Thread/MessageForm/Field/Control.tsx
2428
+ import { Flex as Flex14 } from "@radix-ui/themes";
2429
+ import { useFormContext } from "react-hook-form";
2303
2430
  import { usePrevious } from "react-use";
2304
2431
  import { useContext as useContext11, useMemo as useMemo9, useRef as useRef4, useEffect as useEffect3 } from "react";
2305
2432
  // src/components/textareas/TextareaBase/index.tsx
2306
2433
  import { forwardRef as forwardRef3 } from "react";
2307
2434
  import TextareaAutosize from "react-textarea-autosize";
2308
- import { Fragment as Fragment3, jsx as jsx44, jsxs as jsxs11 } from "react/jsx-runtime";
2309
- var UPSCALE_RATIO = 16 / 14;
2435
+ import { Fragment as Fragment3, jsx as jsx47, jsxs as jsxs15 } from "react/jsx-runtime";
2310
2436
  var TextareaBase = forwardRef3(function TextareaBase2(props, ref) {
2311
- return /* @__PURE__ */ jsxs11(Fragment3, {
2437
+ return /* @__PURE__ */ jsxs15(Fragment3, {
2312
2438
  children: [
2313
- /* @__PURE__ */ jsx44("style", {
2439
+ /* @__PURE__ */ jsx47("style", {
2314
2440
  children: ".superinterface-textarea { min-height: inherit; height: 30px; }\n.superinterface-textarea::placeholder { color: var(--gray-a10); }"
2315
2441
  }),
2316
- /* @__PURE__ */ jsx44(TextareaAutosize, _object_spread({
2442
+ /* @__PURE__ */ jsx47(TextareaAutosize, _object_spread({
2317
2443
  ref: ref,
2318
2444
  className: "rt-reset superinterface-textarea",
2319
2445
  style: {
@@ -2322,12 +2448,6 @@ var TextareaBase = forwardRef3(function TextareaBase2(props, ref) {
2322
2448
  boxSizing: "border-box",
2323
2449
  resize: "none",
2324
2450
  color: "var(--gray-12)",
2325
- fontSize: "".concat(14 * UPSCALE_RATIO, "px"),
2326
- lineHeight: "".concat(24 * UPSCALE_RATIO, "px"),
2327
- transform: "scale(".concat(1 / UPSCALE_RATIO, ")"),
2328
- margin: "0 ".concat((-100 * UPSCALE_RATIO + 100) / 2, "%"),
2329
- width: "".concat(100 * UPSCALE_RATIO, "%"),
2330
- maxWidth: "".concat(100 * UPSCALE_RATIO, "%"),
2331
2451
  flexGrow: 1,
2332
2452
  display: "flex"
2333
2453
  }
@@ -2335,40 +2455,17 @@ var TextareaBase = forwardRef3(function TextareaBase2(props, ref) {
2335
2455
  ]
2336
2456
  });
2337
2457
  });
2338
- // src/components/threads/Thread/MessageForm/Field/index.tsx
2339
- import { useFormContext } from "react-hook-form";
2340
- import { Container as Container2, Flex as Flex14 } from "@radix-ui/themes";
2341
- import { jsx as jsx45 } from "react/jsx-runtime";
2342
- var Root4 = function(param) {
2458
+ // src/components/threads/Thread/MessageForm/Field/Control.tsx
2459
+ import { jsx as jsx48 } from "react/jsx-runtime";
2460
+ var Root5 = function(param) {
2343
2461
  var children = param.children;
2344
- var _useFormContext = useFormContext(), errors = _useFormContext.formState.errors;
2345
- return /* @__PURE__ */ jsx45(Container2, {
2346
- size: "2",
2347
- flexGrow: "0",
2348
- children: /* @__PURE__ */ jsx45(Flex14, {
2349
- direction: "column",
2350
- flexShrink: "0",
2351
- children: /* @__PURE__ */ jsx45(Flex14, {
2352
- direction: "column",
2353
- flexShrink: "0",
2354
- children: /* @__PURE__ */ jsx45(Flex14, {
2355
- style: _object_spread({
2356
- borderRadius: "var(--radius-2)",
2357
- borderWidth: "1px",
2358
- borderStyle: "solid",
2359
- borderColor: errors.content ? "var(--red-9)" : "var(--gray-5)"
2360
- }, errors.content ? {
2361
- backgroundColor: "var(--red-2)"
2362
- } : {}),
2363
- p: "2",
2364
- pl: "4",
2365
- children: children
2366
- })
2367
- })
2368
- })
2462
+ return /* @__PURE__ */ jsx48(Flex14, {
2463
+ flexGrow: "1",
2464
+ pt: "4px",
2465
+ children: children
2369
2466
  });
2370
2467
  };
2371
- var Control = function() {
2468
+ var Input = function() {
2372
2469
  var assistantNameContext = useContext11(AssistantNameContext);
2373
2470
  var register = useFormContext().register;
2374
2471
  var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading;
@@ -2391,7 +2488,7 @@ var Control = function() {
2391
2488
  isDisabledPrevious,
2392
2489
  textareaProps
2393
2490
  ]);
2394
- return /* @__PURE__ */ jsx45(TextareaBase, _object_spread_props(_object_spread({
2491
+ return /* @__PURE__ */ jsx48(TextareaBase, _object_spread_props(_object_spread({
2395
2492
  minRows: 1,
2396
2493
  placeholder: "Message ".concat(assistantNameContext, "..."),
2397
2494
  disabled: isDisabled,
@@ -2410,51 +2507,348 @@ var Control = function() {
2410
2507
  }
2411
2508
  }));
2412
2509
  };
2510
+ var Control = function() {
2511
+ return /* @__PURE__ */ jsx48(Root5, {
2512
+ children: /* @__PURE__ */ jsx48(Input, {})
2513
+ });
2514
+ };
2515
+ Control.Root = Root5;
2516
+ Control.Input = Input;
2517
+ // src/components/threads/Thread/MessageForm/Field/Files/Preview.tsx
2518
+ import { Flex as Flex15, Card as Card2, Spinner, Text as Text6, IconButton as IconButton2 } from "@radix-ui/themes";
2519
+ import { FileIcon as FileIcon2, Cross2Icon } from "@radix-ui/react-icons";
2520
+ import { jsx as jsx49, jsxs as jsxs16 } from "react/jsx-runtime";
2521
+ var Preview = function() {
2522
+ var _useMessageFormContext = useMessageFormContext(), files = _useMessageFormContext.files, setFiles = _useMessageFormContext.setFiles;
2523
+ if (!files.length) {
2524
+ return null;
2525
+ }
2526
+ return /* @__PURE__ */ jsx49(Flex15, {
2527
+ flexBasis: "100%",
2528
+ direction: "column",
2529
+ pb: "2",
2530
+ gap: "1",
2531
+ children: files.map(function(file) {
2532
+ return /* @__PURE__ */ jsx49(Card2, {
2533
+ variant: "ghost",
2534
+ children: /* @__PURE__ */ jsxs16(Flex15, {
2535
+ align: "center",
2536
+ justify: "between",
2537
+ gap: "1",
2538
+ children: [
2539
+ /* @__PURE__ */ jsxs16(Flex15, {
2540
+ align: "center",
2541
+ gap: "1",
2542
+ flexShrink: "1",
2543
+ minWidth: "0",
2544
+ maxWidth: "250px",
2545
+ children: [
2546
+ /* @__PURE__ */ jsx49(Flex15, {
2547
+ flexShrink: "0",
2548
+ children: /* @__PURE__ */ jsx49(Spinner, {
2549
+ loading: isOptimistic({
2550
+ id: file.id
2551
+ }),
2552
+ children: /* @__PURE__ */ jsx49(FileIcon2, {})
2553
+ })
2554
+ }),
2555
+ /* @__PURE__ */ jsx49(Text6, {
2556
+ size: "2",
2557
+ truncate: true,
2558
+ wrap: "nowrap",
2559
+ children: file.filename
2560
+ })
2561
+ ]
2562
+ }),
2563
+ /* @__PURE__ */ jsx49(Flex15, {
2564
+ flexShrink: "0",
2565
+ children: /* @__PURE__ */ jsx49(IconButton2, {
2566
+ onClick: function() {
2567
+ return setFiles(function(prev) {
2568
+ return prev.filter(function(prevFile) {
2569
+ return prevFile.id !== file.id;
2570
+ });
2571
+ });
2572
+ },
2573
+ color: "gray",
2574
+ variant: "ghost",
2575
+ size: "1",
2576
+ children: /* @__PURE__ */ jsx49(Cross2Icon, {})
2577
+ })
2578
+ })
2579
+ ]
2580
+ })
2581
+ }, file.id);
2582
+ })
2583
+ });
2584
+ };
2585
+ // src/components/threads/Thread/MessageForm/Field/Files/Control.tsx
2586
+ import { useCallback as useCallback2 } from "react";
2587
+ import dayjs2 from "dayjs";
2588
+ import { FilePlusIcon } from "@radix-ui/react-icons";
2589
+ import { IconButton as IconButton3, Flex as Flex16 } from "@radix-ui/themes";
2590
+ // src/hooks/files/useCreateFile/index.ts
2591
+ import { useMutation as useMutation2, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
2592
+ // src/hooks/files/useCreateFile/lib/mutationOptions/mutationFn/body/formData.ts
2593
+ var formData = function(variables) {
2594
+ var data2 = new FormData();
2595
+ for(var key2 in variables){
2596
+ data2.append(key2, variables[key2]);
2597
+ }
2598
+ return data2;
2599
+ };
2600
+ // src/hooks/files/useCreateFile/lib/mutationOptions/mutationFn/body/index.ts
2601
+ var body2 = function(param) {
2602
+ var variables = param.variables, superinterfaceContext = param.superinterfaceContext;
2603
+ var _superinterfaceContext_threadIdCookieOptions;
2604
+ if (variables.threadId) return formData(variables);
2605
+ if (!variables.assistantId) return formData(variables);
2606
+ if (!((_superinterfaceContext_threadIdCookieOptions = superinterfaceContext.threadIdCookieOptions) === null || _superinterfaceContext_threadIdCookieOptions === void 0 ? void 0 : _superinterfaceContext_threadIdCookieOptions.get)) return formData(variables);
2607
+ var threadId = superinterfaceContext.threadIdCookieOptions.get({
2608
+ assistantId: variables.assistantId
2609
+ });
2610
+ if (!threadId) return formData(variables);
2611
+ return formData(_object_spread_props(_object_spread({}, variables), {
2612
+ threadId: threadId
2613
+ }));
2614
+ };
2615
+ // src/hooks/files/useCreateFile/lib/mutationOptions/mutationFn/index.ts
2616
+ var mutationFn2 = function(param) {
2617
+ var superinterfaceContext = param.superinterfaceContext, queryClient = param.queryClient, threadContext = param.threadContext;
2618
+ return function() {
2619
+ var _ref = _async_to_generator(function(variables) {
2620
+ var response, result;
2621
+ return _ts_generator(this, function(_state) {
2622
+ switch(_state.label){
2623
+ case 0:
2624
+ return [
2625
+ 4,
2626
+ fetch("".concat(superinterfaceContext.baseUrl, "/files"), {
2627
+ method: "POST",
2628
+ body: body2({
2629
+ variables: variables,
2630
+ superinterfaceContext: superinterfaceContext
2631
+ })
2632
+ })
2633
+ ];
2634
+ case 1:
2635
+ response = _state.sent();
2636
+ return [
2637
+ 4,
2638
+ response.json()
2639
+ ];
2640
+ case 2:
2641
+ result = _state.sent();
2642
+ return [
2643
+ 2,
2644
+ result
2645
+ ];
2646
+ }
2647
+ });
2648
+ });
2649
+ return function(variables) {
2650
+ return _ref.apply(this, arguments);
2651
+ };
2652
+ }();
2653
+ };
2654
+ // src/hooks/files/useCreateFile/lib/mutationOptions/index.ts
2655
+ var mutationOptions2 = function(param) {
2656
+ var queryClient = param.queryClient, threadContext = param.threadContext, superinterfaceContext = param.superinterfaceContext, onError = param.onError;
2657
+ var mutationKey = [
2658
+ "createFile",
2659
+ threadContext.variables
2660
+ ];
2661
+ return _object_spread_props(_object_spread({
2662
+ mutationFn: mutationFn2({
2663
+ queryClient: queryClient,
2664
+ superinterfaceContext: superinterfaceContext,
2665
+ threadContext: threadContext
2666
+ }),
2667
+ onError: onError
2668
+ }, threadContext.defaultOptions.mutations, queryClient.getMutationDefaults(mutationKey)), {
2669
+ mutationKey: mutationKey
2670
+ });
2671
+ };
2672
+ // src/hooks/files/useCreateFile/index.ts
2673
+ var useCreateFile = function() {
2674
+ var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
2675
+ onError: function() {}
2676
+ }, _ref_onError = _ref.onError, onError = _ref_onError === void 0 ? function() {} : _ref_onError;
2677
+ var queryClient = useQueryClient5();
2678
+ var superinterfaceContext = useSuperinterfaceContext();
2679
+ var threadContext = useSuperinterfaceContext();
2680
+ var props = useMutation2(mutationOptions2({
2681
+ queryClient: queryClient,
2682
+ threadContext: threadContext,
2683
+ superinterfaceContext: superinterfaceContext,
2684
+ onError: onError
2685
+ }));
2686
+ return _object_spread_props(_object_spread({}, props), {
2687
+ createFile: function() {
2688
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2689
+ args[_key] = arguments[_key];
2690
+ }
2691
+ var _props;
2692
+ var _args = _to_array(args), firstArg = _args[0], restArgs = _args.slice(1);
2693
+ return (_props = props).mutateAsync.apply(_props, [
2694
+ _object_spread({}, threadContext.variables, firstArg)
2695
+ ].concat(_to_consumable_array(restArgs)));
2696
+ }
2697
+ });
2698
+ };
2699
+ // src/components/threads/Thread/MessageForm/Field/Files/Control.tsx
2700
+ import { jsx as jsx50, jsxs as jsxs17 } from "react/jsx-runtime";
2701
+ var accept = ".c,text/x-c,\n.cs,text/x-csharp,\n.cpp,text/x-c++,\n.doc,application/msword,\n.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document,\n.html,text/html,\n.java,text/x-java,\n.json,application/json,\n.md,text/markdown,\n.pdf,application/pdf,\n.php,text/x-php,\n.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation,\n.py,text/x-python,\n.py,text/x-script.python,\n.rb,text/x-ruby,\n.tex,text/x-tex,\n.txt,text/plain,\n.css,text/css,\n.js,text/javascript,\n.sh,application/x-sh,\n.ts,application/typescript";
2702
+ var Control2 = function() {
2703
+ var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading, setFiles = _useMessageFormContext.setFiles;
2704
+ var createFile = useCreateFile().createFile;
2705
+ var addToast = useToasts().addToast;
2706
+ var onChange = useCallback2(function(event) {
2707
+ var files = event.target.files;
2708
+ if (!files) return;
2709
+ var newFiles = Array.from(files).map(function(file) {
2710
+ var id = optimisticId();
2711
+ createFile({
2712
+ file: file
2713
+ }, {
2714
+ onSuccess: function(param) {
2715
+ var file2 = param.file;
2716
+ setFiles(function(prev) {
2717
+ return _to_consumable_array(prev.filter(function(prevFile) {
2718
+ return prevFile.id !== id;
2719
+ })).concat([
2720
+ file2
2721
+ ]);
2722
+ });
2723
+ },
2724
+ onError: function() {
2725
+ addToast({
2726
+ type: "error",
2727
+ message: "Could not upload file. Please try again."
2728
+ });
2729
+ setFiles(function(prev) {
2730
+ return prev.filter(function(prevFile) {
2731
+ return prevFile.id !== id;
2732
+ });
2733
+ });
2734
+ }
2735
+ });
2736
+ return {
2737
+ id: id,
2738
+ filename: file.name,
2739
+ object: "file",
2740
+ purpose: "assistants",
2741
+ created_at: dayjs2().unix(),
2742
+ bytes: file.size,
2743
+ status: "processed"
2744
+ };
2745
+ });
2746
+ setFiles(function(prev) {
2747
+ return _to_consumable_array(prev).concat(_to_consumable_array(newFiles));
2748
+ });
2749
+ }, []);
2750
+ return /* @__PURE__ */ jsx50(Flex16, {
2751
+ pt: "2",
2752
+ pr: "2",
2753
+ flexGrow: "0",
2754
+ children: /* @__PURE__ */ jsxs17(IconButton3, {
2755
+ type: "button",
2756
+ variant: "ghost",
2757
+ color: "gray",
2758
+ disabled: isDisabled || isLoading,
2759
+ style: {
2760
+ position: "relative",
2761
+ overflow: "hidden"
2762
+ },
2763
+ children: [
2764
+ /* @__PURE__ */ jsx50(FilePlusIcon, {}),
2765
+ /* @__PURE__ */ jsx50("input", {
2766
+ type: "file",
2767
+ accept: accept,
2768
+ onChange: onChange,
2769
+ style: {
2770
+ cursor: "pointer",
2771
+ position: "absolute",
2772
+ top: 0,
2773
+ left: 0,
2774
+ right: 0,
2775
+ bottom: 0,
2776
+ opacity: 0
2777
+ }
2778
+ })
2779
+ ]
2780
+ })
2781
+ });
2782
+ };
2783
+ // src/components/threads/Thread/MessageForm/Field/Files/index.tsx
2784
+ var Files = {
2785
+ Preview: Preview,
2786
+ Control: Control2
2787
+ };
2788
+ // src/components/threads/Thread/MessageForm/Field/index.tsx
2789
+ import { jsx as jsx51 } from "react/jsx-runtime";
2790
+ var Root6 = function(param) {
2791
+ var children = param.children;
2792
+ var _useFormContext2 = useFormContext2(), errors = _useFormContext2.formState.errors;
2793
+ return /* @__PURE__ */ jsx51(RadixContainer, {
2794
+ size: "2",
2795
+ flexGrow: "0",
2796
+ children: /* @__PURE__ */ jsx51(Flex17, {
2797
+ direction: "column",
2798
+ flexShrink: "0",
2799
+ children: /* @__PURE__ */ jsx51(Flex17, {
2800
+ direction: "column",
2801
+ flexShrink: "0",
2802
+ children: /* @__PURE__ */ jsx51(Flex17, {
2803
+ style: _object_spread({
2804
+ borderRadius: "var(--radius-2)",
2805
+ borderWidth: "1px",
2806
+ borderStyle: "solid",
2807
+ borderColor: errors.content ? "var(--red-9)" : "var(--gray-5)"
2808
+ }, errors.content ? {
2809
+ backgroundColor: "var(--red-2)"
2810
+ } : {}),
2811
+ p: "2",
2812
+ pl: "3",
2813
+ wrap: "wrap",
2814
+ children: children
2815
+ })
2816
+ })
2817
+ })
2818
+ });
2819
+ };
2413
2820
  var Field = {
2414
- Root: Root4,
2415
- Control: Control
2821
+ Root: Root6,
2822
+ Control: Control,
2823
+ Files: Files
2416
2824
  };
2417
2825
  // src/components/threads/Thread/MessageForm/index.tsx
2418
- import { jsx as jsx46, jsxs as jsxs12 } from "react/jsx-runtime";
2826
+ import { jsx as jsx52, jsxs as jsxs18 } from "react/jsx-runtime";
2419
2827
  var MessageForm = function() {
2420
- return /* @__PURE__ */ jsx46(Root3, {
2421
- children: /* @__PURE__ */ jsxs12(Field.Root, {
2828
+ return /* @__PURE__ */ jsx52(Root4, {
2829
+ children: /* @__PURE__ */ jsxs18(Field.Root, {
2422
2830
  children: [
2423
- /* @__PURE__ */ jsx46(Text5, {
2424
- size: "2",
2425
- style: {
2426
- flexGrow: 1
2427
- },
2428
- children: /* @__PURE__ */ jsx46(Flex15, {
2429
- flexGrow: "1",
2430
- direction: "column",
2431
- children: /* @__PURE__ */ jsx46(Field.Control, {})
2432
- })
2433
- }),
2434
- /* @__PURE__ */ jsx46(Flex15, {
2435
- flexShrink: "0",
2436
- align: "end",
2437
- children: /* @__PURE__ */ jsx46(Submit, {})
2438
- })
2831
+ /* @__PURE__ */ jsx52(Field.Control, {}),
2832
+ /* @__PURE__ */ jsx52(Submit, {})
2439
2833
  ]
2440
2834
  })
2441
2835
  });
2442
2836
  };
2443
- MessageForm.Root = Root3;
2837
+ MessageForm.Root = Root4;
2444
2838
  MessageForm.Field = Field;
2445
2839
  MessageForm.Submit = Submit;
2446
2840
  // src/components/threads/Thread/Root/index.tsx
2447
- import { Flex as Flex16 } from "@radix-ui/themes";
2841
+ import { Flex as Flex18 } from "@radix-ui/themes";
2448
2842
  // src/components/threads/Thread/Provider/index.tsx
2449
2843
  var Provider2 = SuperinterfaceProvider;
2450
2844
  // src/components/threads/Thread/Root/index.tsx
2451
- import { jsx as jsx47 } from "react/jsx-runtime";
2452
- var Root5 = function(_param) {
2845
+ import { jsx as jsx53 } from "react/jsx-runtime";
2846
+ var Root7 = function(_param) {
2453
2847
  var children = _param.children, rest = _object_without_properties(_param, [
2454
2848
  "children"
2455
2849
  ]);
2456
- return /* @__PURE__ */ jsx47(Provider2, _object_spread_props(_object_spread({}, rest), {
2457
- children: /* @__PURE__ */ jsx47(Flex16, {
2850
+ return /* @__PURE__ */ jsx53(Provider2, _object_spread_props(_object_spread({}, rest), {
2851
+ children: /* @__PURE__ */ jsx53(Flex18, {
2458
2852
  direction: "column",
2459
2853
  flexGrow: "1",
2460
2854
  children: children
@@ -2462,16 +2856,16 @@ var Root5 = function(_param) {
2462
2856
  }));
2463
2857
  };
2464
2858
  // src/components/threads/Thread/index.tsx
2465
- import { jsx as jsx48, jsxs as jsxs13 } from "react/jsx-runtime";
2859
+ import { jsx as jsx54, jsxs as jsxs19 } from "react/jsx-runtime";
2466
2860
  var Thread = function(props) {
2467
- return /* @__PURE__ */ jsxs13(Root5, _object_spread_props(_object_spread({}, props), {
2861
+ return /* @__PURE__ */ jsxs19(Root7, _object_spread_props(_object_spread({}, props), {
2468
2862
  children: [
2469
- /* @__PURE__ */ jsx48(Messages, {}),
2470
- /* @__PURE__ */ jsx48(MessageForm, {})
2863
+ /* @__PURE__ */ jsx54(Messages, {}),
2864
+ /* @__PURE__ */ jsx54(MessageForm, {})
2471
2865
  ]
2472
2866
  }));
2473
2867
  };
2474
- Thread.Root = Root5;
2868
+ Thread.Root = Root7;
2475
2869
  Thread.Messages = Messages;
2476
2870
  Thread.MessageForm = MessageForm;
2477
2871
  // src/hooks/messages/useMessageContext/index.ts
@@ -2480,7 +2874,7 @@ var useMessageContext = function() {
2480
2874
  return useContext12(MessageContext);
2481
2875
  };
2482
2876
  // src/components/threads/ThreadDialog/Provider/index.tsx
2483
- import { useState } from "react";
2877
+ import { useState as useState2 } from "react";
2484
2878
  // src/contexts/threads/ThreadDialogContext/index.ts
2485
2879
  import { createContext as createContext11 } from "react";
2486
2880
  var ThreadDialogContext = createContext11({
@@ -2493,12 +2887,12 @@ var useThreadDialogContext = function() {
2493
2887
  return useContext13(ThreadDialogContext);
2494
2888
  };
2495
2889
  // src/components/threads/ThreadDialog/Provider/index.tsx
2496
- import { jsx as jsx49 } from "react/jsx-runtime";
2890
+ import { jsx as jsx55 } from "react/jsx-runtime";
2497
2891
  var Provider3 = function(param) {
2498
2892
  var children = param.children;
2499
2893
  var threadDialogContext = useThreadDialogContext();
2500
- var _useState = _sliced_to_array(useState(threadDialogContext.isOpen), 2), isOpen = _useState[0], setIsOpen = _useState[1];
2501
- return /* @__PURE__ */ jsx49(ThreadDialogContext.Provider, {
2894
+ var _useState2 = _sliced_to_array(useState2(threadDialogContext.isOpen), 2), isOpen = _useState2[0], setIsOpen = _useState2[1];
2895
+ return /* @__PURE__ */ jsx55(ThreadDialogContext.Provider, {
2502
2896
  value: {
2503
2897
  isOpen: isOpen,
2504
2898
  setIsOpen: setIsOpen
@@ -2507,31 +2901,31 @@ var Provider3 = function(param) {
2507
2901
  });
2508
2902
  };
2509
2903
  // src/components/toasts/ToastsProvider/index.tsx
2510
- import { useState as useState2, useCallback as useCallback2 } from "react";
2904
+ import { useState as useState3, useCallback as useCallback3 } from "react";
2511
2905
  import * as Toast2 from "@radix-ui/react-toast";
2512
2906
  // src/components/toasts/ToastsProvider/CustomToast.tsx
2513
2907
  import * as Toast from "@radix-ui/react-toast";
2514
- import { Card, Text as Text6, Flex as Flex17 } from "@radix-ui/themes";
2908
+ import { Card as Card3, Text as Text7, Flex as Flex19 } from "@radix-ui/themes";
2515
2909
  import { CheckCircledIcon as CheckCircledIcon2, CrossCircledIcon } from "@radix-ui/react-icons";
2516
- import { jsx as jsx50, jsxs as jsxs14 } from "react/jsx-runtime";
2910
+ import { jsx as jsx56, jsxs as jsxs20 } from "react/jsx-runtime";
2517
2911
  var CustomToast = function(param) {
2518
2912
  var toast = param.toast;
2519
- return /* @__PURE__ */ jsx50(Toast.Root, {
2520
- children: /* @__PURE__ */ jsx50(Card, {
2521
- children: /* @__PURE__ */ jsx50(Toast.Title, {
2522
- children: /* @__PURE__ */ jsxs14(Flex17, {
2913
+ return /* @__PURE__ */ jsx56(Toast.Root, {
2914
+ children: /* @__PURE__ */ jsx56(Card3, {
2915
+ children: /* @__PURE__ */ jsx56(Toast.Title, {
2916
+ children: /* @__PURE__ */ jsxs20(Flex19, {
2523
2917
  children: [
2524
- /* @__PURE__ */ jsx50(Flex17, {
2918
+ /* @__PURE__ */ jsx56(Flex19, {
2525
2919
  pr: "2",
2526
2920
  height: "14px",
2527
2921
  align: "center",
2528
- children: toast.type === "success" ? /* @__PURE__ */ jsx50(CheckCircledIcon2, {
2922
+ children: toast.type === "success" ? /* @__PURE__ */ jsx56(CheckCircledIcon2, {
2529
2923
  color: "var(--accent-9)"
2530
- }) : /* @__PURE__ */ jsx50(CrossCircledIcon, {
2924
+ }) : /* @__PURE__ */ jsx56(CrossCircledIcon, {
2531
2925
  color: "var(--red-9)"
2532
2926
  })
2533
2927
  }),
2534
- /* @__PURE__ */ jsx50(Text6, {
2928
+ /* @__PURE__ */ jsx56(Text7, {
2535
2929
  weight: "medium",
2536
2930
  size: "1",
2537
2931
  children: toast.message
@@ -2543,31 +2937,31 @@ var CustomToast = function(param) {
2543
2937
  });
2544
2938
  };
2545
2939
  // src/components/toasts/ToastsProvider/index.tsx
2546
- import { jsx as jsx51, jsxs as jsxs15 } from "react/jsx-runtime";
2940
+ import { jsx as jsx57, jsxs as jsxs21 } from "react/jsx-runtime";
2547
2941
  var ToastsProvider = function(param) {
2548
2942
  var children = param.children;
2549
- var _useState2 = _sliced_to_array(useState2([]), 2), toasts = _useState2[0], setToasts = _useState2[1];
2550
- var addToast = useCallback2(function(toast) {
2943
+ var _useState3 = _sliced_to_array(useState3([]), 2), toasts = _useState3[0], setToasts = _useState3[1];
2944
+ var addToast = useCallback3(function(toast) {
2551
2945
  return setToasts(function(prevToasts) {
2552
2946
  return _to_consumable_array(prevToasts).concat([
2553
2947
  toast
2554
2948
  ]);
2555
2949
  });
2556
2950
  }, []);
2557
- return /* @__PURE__ */ jsx51(ToastsContext.Provider, {
2951
+ return /* @__PURE__ */ jsx57(ToastsContext.Provider, {
2558
2952
  value: {
2559
2953
  toasts: toasts,
2560
2954
  addToast: addToast
2561
2955
  },
2562
- children: /* @__PURE__ */ jsxs15(Toast2.Provider, {
2956
+ children: /* @__PURE__ */ jsxs21(Toast2.Provider, {
2563
2957
  children: [
2564
2958
  children,
2565
2959
  Array.from(toasts).map(function(toast, index) {
2566
- return /* @__PURE__ */ jsx51(CustomToast, {
2960
+ return /* @__PURE__ */ jsx57(CustomToast, {
2567
2961
  toast: toast
2568
2962
  }, index);
2569
2963
  }),
2570
- /* @__PURE__ */ jsx51(Toast2.Viewport, {
2964
+ /* @__PURE__ */ jsx57(Toast2.Viewport, {
2571
2965
  style: {
2572
2966
  position: "absolute",
2573
2967
  bottom: 0,
@@ -2589,22 +2983,34 @@ var ToastsProvider = function(param) {
2589
2983
  });
2590
2984
  };
2591
2985
  // src/components/threads/ThreadDialog/Root/index.tsx
2592
- import { jsx as jsx52 } from "react/jsx-runtime";
2593
- var Root7 = function(param) {
2986
+ import { jsx as jsx58 } from "react/jsx-runtime";
2987
+ var Root9 = function(param) {
2594
2988
  var children = param.children;
2595
- return /* @__PURE__ */ jsx52(ToastsProvider, {
2596
- children: /* @__PURE__ */ jsx52(Provider3, {
2989
+ return /* @__PURE__ */ jsx58(ToastsProvider, {
2990
+ children: /* @__PURE__ */ jsx58(Provider3, {
2597
2991
  children: children
2598
2992
  })
2599
2993
  });
2600
2994
  };
2601
2995
  // src/components/threads/ThreadDialog/Trigger/index.tsx
2602
- import { Flex as Flex18 } from "@radix-ui/themes";
2603
- import { jsx as jsx53 } from "react/jsx-runtime";
2604
- var Trigger = function(param) {
2996
+ import { Flex as Flex20 } from "@radix-ui/themes";
2997
+ // src/components/threads/ThreadDialog/Trigger/Button.tsx
2998
+ import { IconButton as IconButton4 } from "@radix-ui/themes";
2999
+ import { ChatBubbleIcon } from "@radix-ui/react-icons";
3000
+ import { jsx as jsx59 } from "react/jsx-runtime";
3001
+ var Button3 = function() {
3002
+ return /* @__PURE__ */ jsx59(IconButton4, {
3003
+ size: "4",
3004
+ radius: "full",
3005
+ children: /* @__PURE__ */ jsx59(ChatBubbleIcon, {})
3006
+ });
3007
+ };
3008
+ // src/components/threads/ThreadDialog/Trigger/index.tsx
3009
+ import { jsx as jsx60 } from "react/jsx-runtime";
3010
+ var Root10 = function(param) {
2605
3011
  var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
2606
3012
  var _useThreadDialogContext = useThreadDialogContext(), setIsOpen = _useThreadDialogContext.setIsOpen, isOpen = _useThreadDialogContext.isOpen;
2607
- return /* @__PURE__ */ jsx53(Flex18, {
3013
+ return /* @__PURE__ */ jsx60(Flex20, {
2608
3014
  display: {
2609
3015
  initial: isOpen ? "none" : "flex",
2610
3016
  sm: "flex"
@@ -2627,26 +3033,22 @@ var Trigger = function(param) {
2627
3033
  children: children
2628
3034
  });
2629
3035
  };
2630
- // src/components/threads/ThreadDialog/Button/index.tsx
2631
- import { IconButton as IconButton2 } from "@radix-ui/themes";
2632
- import { ChatBubbleIcon } from "@radix-ui/react-icons";
2633
- import { jsx as jsx54 } from "react/jsx-runtime";
2634
- var Button2 = function() {
2635
- return /* @__PURE__ */ jsx54(IconButton2, {
2636
- size: "4",
2637
- radius: "full",
2638
- children: /* @__PURE__ */ jsx54(ChatBubbleIcon, {})
2639
- });
3036
+ var Trigger = function(args) {
3037
+ return /* @__PURE__ */ jsx60(Root10, _object_spread_props(_object_spread({}, args), {
3038
+ children: /* @__PURE__ */ jsx60(Button3, {})
3039
+ }));
2640
3040
  };
3041
+ Trigger.Root = Root10;
3042
+ Trigger.Button = Button3;
2641
3043
  // src/components/threads/ThreadDialog/Content/index.tsx
2642
- import { Card as Card2, Inset, Flex as Flex20 } from "@radix-ui/themes";
3044
+ import { Card as Card4, Inset, Flex as Flex22 } from "@radix-ui/themes";
2643
3045
  // src/components/threads/ThreadDialog/Close/index.tsx
2644
3046
  import { Cross1Icon } from "@radix-ui/react-icons";
2645
- import { IconButton as IconButton3, Flex as Flex19 } from "@radix-ui/themes";
2646
- import { jsx as jsx55 } from "react/jsx-runtime";
3047
+ import { IconButton as IconButton5, Flex as Flex21 } from "@radix-ui/themes";
3048
+ import { jsx as jsx61 } from "react/jsx-runtime";
2647
3049
  var Close = function() {
2648
3050
  var _useThreadDialogContext = useThreadDialogContext(), setIsOpen = _useThreadDialogContext.setIsOpen, isOpen = _useThreadDialogContext.isOpen;
2649
- return /* @__PURE__ */ jsx55(Flex19, {
3051
+ return /* @__PURE__ */ jsx61(Flex21, {
2650
3052
  display: {
2651
3053
  initial: isOpen ? "flex" : "none",
2652
3054
  sm: "none"
@@ -2666,20 +3068,20 @@ var Close = function() {
2666
3068
  style: {
2667
3069
  zIndex: 9999999999
2668
3070
  },
2669
- children: /* @__PURE__ */ jsx55(IconButton3, {
3071
+ children: /* @__PURE__ */ jsx61(IconButton5, {
2670
3072
  size: "2",
2671
3073
  variant: "soft",
2672
- children: /* @__PURE__ */ jsx55(Cross1Icon, {})
3074
+ children: /* @__PURE__ */ jsx61(Cross1Icon, {})
2673
3075
  })
2674
3076
  });
2675
3077
  };
2676
3078
  // src/components/threads/ThreadDialog/Content/index.tsx
2677
- import { jsx as jsx56, jsxs as jsxs16 } from "react/jsx-runtime";
2678
- var Root8 = function(param) {
3079
+ import { jsx as jsx62, jsxs as jsxs22 } from "react/jsx-runtime";
3080
+ var Root11 = function(param) {
2679
3081
  var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
2680
3082
  var isOpen = useThreadDialogContext().isOpen;
2681
3083
  if (!isOpen) return null;
2682
- return /* @__PURE__ */ jsx56(Flex20, {
3084
+ return /* @__PURE__ */ jsx62(Flex22, {
2683
3085
  direction: "column",
2684
3086
  justify: "end",
2685
3087
  position: "fixed",
@@ -2707,7 +3109,7 @@ var Root8 = function(param) {
2707
3109
  style: _object_spread({
2708
3110
  zIndex: 9999999999
2709
3111
  }, style),
2710
- children: /* @__PURE__ */ jsxs16(Card2, {
3112
+ children: /* @__PURE__ */ jsxs22(Card4, {
2711
3113
  mb: {
2712
3114
  initial: void 0,
2713
3115
  sm: "3"
@@ -2718,7 +3120,7 @@ var Root8 = function(param) {
2718
3120
  flexGrow: 1
2719
3121
  },
2720
3122
  children: [
2721
- /* @__PURE__ */ jsx56(Inset, {
3123
+ /* @__PURE__ */ jsx62(Inset, {
2722
3124
  clip: "padding-box",
2723
3125
  side: "all",
2724
3126
  pb: "current",
@@ -2728,56 +3130,64 @@ var Root8 = function(param) {
2728
3130
  },
2729
3131
  children: children
2730
3132
  }),
2731
- /* @__PURE__ */ jsx56(Close, {})
3133
+ /* @__PURE__ */ jsx62(Close, {})
2732
3134
  ]
2733
3135
  })
2734
3136
  });
2735
3137
  };
3138
+ var Messages2 = function() {
3139
+ return /* @__PURE__ */ jsx62(Thread.Messages, {
3140
+ style: {
3141
+ paddingTop: "var(--space-5)",
3142
+ paddingRight: "var(--space-5)",
3143
+ paddingLeft: "var(--space-5)"
3144
+ }
3145
+ });
3146
+ };
3147
+ var FormContainer = function(param) {
3148
+ var children = param.children;
3149
+ return /* @__PURE__ */ jsx62(Flex22, {
3150
+ direction: "column",
3151
+ pl: "5",
3152
+ pr: "5",
3153
+ pb: "3",
3154
+ flexShrink: "0",
3155
+ children: children
3156
+ });
3157
+ };
2736
3158
  var Content4 = function(param) {
2737
3159
  var _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
2738
- return /* @__PURE__ */ jsx56(Root8, {
3160
+ return /* @__PURE__ */ jsx62(Root11, {
2739
3161
  style: style,
2740
- children: /* @__PURE__ */ jsxs16(Thread.Root, {
3162
+ children: /* @__PURE__ */ jsxs22(Thread.Root, {
2741
3163
  children: [
2742
- /* @__PURE__ */ jsx56(Thread.Messages, {
2743
- style: {
2744
- paddingTop: "var(--space-5)",
2745
- paddingRight: "var(--space-5)",
2746
- paddingLeft: "var(--space-5)"
2747
- }
2748
- }),
2749
- /* @__PURE__ */ jsx56(Flex20, {
2750
- direction: "column",
2751
- pl: "5",
2752
- pr: "5",
2753
- pb: "3",
2754
- flexShrink: "0",
2755
- children: /* @__PURE__ */ jsx56(Thread.MessageForm, {})
3164
+ /* @__PURE__ */ jsx62(Messages2, {}),
3165
+ /* @__PURE__ */ jsx62(FormContainer, {
3166
+ children: /* @__PURE__ */ jsx62(Thread.MessageForm, {})
2756
3167
  })
2757
3168
  ]
2758
3169
  })
2759
3170
  });
2760
3171
  };
2761
- Content4.Root = Root8;
3172
+ Content4.Root = Root11;
3173
+ Content4.Messages = Messages2;
3174
+ Content4.FormContainer = FormContainer;
2762
3175
  // src/components/threads/ThreadDialog/index.tsx
2763
- import { jsx as jsx57, jsxs as jsxs17 } from "react/jsx-runtime";
3176
+ import { jsx as jsx63, jsxs as jsxs23 } from "react/jsx-runtime";
2764
3177
  var ThreadDialog = function() {
2765
- return /* @__PURE__ */ jsxs17(Root7, {
3178
+ return /* @__PURE__ */ jsxs23(Root9, {
2766
3179
  children: [
2767
- /* @__PURE__ */ jsx57(Content4, {}),
2768
- /* @__PURE__ */ jsx57(Trigger, {
2769
- children: /* @__PURE__ */ jsx57(Button2, {})
2770
- })
3180
+ /* @__PURE__ */ jsx63(Content4, {}),
3181
+ /* @__PURE__ */ jsx63(Trigger, {})
2771
3182
  ]
2772
3183
  });
2773
3184
  };
2774
- ThreadDialog.Root = Root7;
3185
+ ThreadDialog.Root = Root9;
2775
3186
  ThreadDialog.Trigger = Trigger;
2776
- ThreadDialog.Button = Button2;
2777
3187
  ThreadDialog.Content = Content4;
2778
3188
  // src/components/threads/AudioThread/Root/index.tsx
2779
3189
  import "regenerator-runtime/runtime";
2780
- import { Flex as Flex21 } from "@radix-ui/themes";
3190
+ import { Flex as Flex23 } from "@radix-ui/themes";
2781
3191
  // src/contexts/threads/AudioThreadContext/index.ts
2782
3192
  import { createContext as createContext12 } from "react";
2783
3193
  var AudioThreadContext = createContext12({
@@ -2874,20 +3284,20 @@ var useStatus = function(param) {
2874
3284
  };
2875
3285
  };
2876
3286
  // src/hooks/audioThreads/useRecorder/index.ts
2877
- import dayjs2 from "dayjs";
3287
+ import dayjs3 from "dayjs";
2878
3288
  import { useAudioCapture } from "use-audio-capture";
2879
- import { useMemo as useMemo11, useRef as useRef5, useState as useState3, useCallback as useCallback3, useEffect as useEffect4 } from "react";
3289
+ import { useMemo as useMemo11, useRef as useRef5, useState as useState4, useCallback as useCallback4, useEffect as useEffect4 } from "react";
2880
3290
  import { useAudioPlayer } from "react-use-audio-player";
2881
3291
  import { useInterval } from "react-use";
2882
3292
  var useRecorder = function(param) {
2883
3293
  var isStopOnSilence = param.isStopOnSilence, onStart = param.onStart, onStop = param.onStop;
2884
- var _useState3 = _sliced_to_array(useState3(null), 2), silenceStart = _useState3[0], setSilenceStart = _useState3[1];
2885
- var _useState31 = _sliced_to_array(useState3(null), 2), noiseStart = _useState31[0], setNoiseStart = _useState31[1];
2886
- var _useState32 = _sliced_to_array(useState3(null), 2), mediaStream = _useState32[0], setMediaStream = _useState32[1];
2887
- var _useState33 = _sliced_to_array(useState3("idle"), 2), status = _useState33[0], setStatus = _useState33[1];
3294
+ var _useState4 = _sliced_to_array(useState4(null), 2), silenceStart = _useState4[0], setSilenceStart = _useState4[1];
3295
+ var _useState41 = _sliced_to_array(useState4(null), 2), noiseStart = _useState41[0], setNoiseStart = _useState41[1];
3296
+ var _useState42 = _sliced_to_array(useState4(null), 2), mediaStream = _useState42[0], setMediaStream = _useState42[1];
3297
+ var _useState43 = _sliced_to_array(useState4("idle"), 2), status = _useState43[0], setStatus = _useState43[1];
2888
3298
  var startAudioPlayer = useAudioPlayer();
2889
3299
  var endAudioPlayer = useAudioPlayer();
2890
- var _useState34 = _sliced_to_array(useState3(false), 2), isLoaded = _useState34[0], setIsLoaded = _useState34[1];
3300
+ var _useState44 = _sliced_to_array(useState4(false), 2), isLoaded = _useState44[0], setIsLoaded = _useState44[1];
2891
3301
  useEffect4(function() {
2892
3302
  if (isLoaded) return;
2893
3303
  setIsLoaded(true);
@@ -2946,7 +3356,7 @@ var useRecorder = function(param) {
2946
3356
  setNoiseStart(null);
2947
3357
  }
2948
3358
  });
2949
- var _useState35 = _sliced_to_array(useState3(null), 2), audioEngine = _useState35[0], setAudioEngine = _useState35[1];
3359
+ var _useState45 = _sliced_to_array(useState4(null), 2), audioEngine = _useState45[0], setAudioEngine = _useState45[1];
2950
3360
  var isInited = useRef5(false);
2951
3361
  useEffect4(function() {
2952
3362
  if (!mediaStream) return;
@@ -2978,7 +3388,7 @@ var useRecorder = function(param) {
2978
3388
  }, [
2979
3389
  audioEngine
2980
3390
  ]);
2981
- var handleSilence = useCallback3(function() {
3391
+ var handleSilence = useCallback4(function() {
2982
3392
  if (!silenceAnalyser) return;
2983
3393
  var frequencyData = new Uint8Array(silenceAnalyser.frequencyBinCount);
2984
3394
  silenceAnalyser.getByteFrequencyData(frequencyData);
@@ -2986,12 +3396,12 @@ var useRecorder = function(param) {
2986
3396
  return f === 0;
2987
3397
  });
2988
3398
  setSilenceStart(function(silenceStart2) {
2989
- if (isSilent) return silenceStart2 || dayjs2();
3399
+ if (isSilent) return silenceStart2 || dayjs3();
2990
3400
  return null;
2991
3401
  });
2992
3402
  setNoiseStart(function(noiseStart2) {
2993
3403
  if (isSilent) return noiseStart2;
2994
- return noiseStart2 || dayjs2();
3404
+ return noiseStart2 || dayjs3();
2995
3405
  });
2996
3406
  requestAnimationFrame(function() {
2997
3407
  return handleSilence();
@@ -3015,7 +3425,7 @@ var useRecorder = function(param) {
3015
3425
  if (status !== "recording") return;
3016
3426
  if (!silenceStart) return;
3017
3427
  if (!noiseStart) return;
3018
- if (!silenceStart.isBefore(dayjs2().subtract(1.5, "second"))) return;
3428
+ if (!silenceStart.isBefore(dayjs3().subtract(1.5, "second"))) return;
3019
3429
  audioCaptureProps.stop();
3020
3430
  }, 300);
3021
3431
  return _object_spread_props(_object_spread({}, audioCaptureProps), {
@@ -3024,7 +3434,7 @@ var useRecorder = function(param) {
3024
3434
  });
3025
3435
  };
3026
3436
  // src/hooks/audioThreads/useMessageAudio/index.ts
3027
- import { useMemo as useMemo12, useRef as useRef6, useState as useState4, useEffect as useEffect5 } from "react";
3437
+ import { useMemo as useMemo12, useRef as useRef6, useState as useState5, useEffect as useEffect5 } from "react";
3028
3438
  import nlp from "compromise";
3029
3439
  import { Howler } from "howler";
3030
3440
  import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
@@ -3062,13 +3472,13 @@ var getMessageSentences = function(param) {
3062
3472
  };
3063
3473
  var useMessageAudio = function(param) {
3064
3474
  var onEnd = param.onEnd;
3065
- var _useState4 = _sliced_to_array(useState4(false), 2), isAudioPlayed = _useState4[0], setIsAudioPlayed = _useState4[1];
3066
- var _useState41 = _sliced_to_array(useState4([]), 2), stoppedMessageIds = _useState41[0], setStoppedMessageIds = _useState41[1];
3067
- var _useState42 = _sliced_to_array(useState4([]), 2), playedMessageSentences = _useState42[0], setPlayedMessageSentences = _useState42[1];
3475
+ var _useState5 = _sliced_to_array(useState5(false), 2), isAudioPlayed = _useState5[0], setIsAudioPlayed = _useState5[1];
3476
+ var _useState51 = _sliced_to_array(useState5([]), 2), stoppedMessageIds = _useState51[0], setStoppedMessageIds = _useState51[1];
3477
+ var _useState52 = _sliced_to_array(useState5([]), 2), playedMessageSentences = _useState52[0], setPlayedMessageSentences = _useState52[1];
3068
3478
  var audioPlayer = useAudioPlayer2();
3069
3479
  var nextAudioPlayer = useAudioPlayer2();
3070
3480
  var superinterfaceContext = useSuperinterfaceContext();
3071
- var _useState43 = _sliced_to_array(useState4(false), 2), isPlaying = _useState43[0], setIsPlaying = _useState43[1];
3481
+ var _useState53 = _sliced_to_array(useState5(false), 2), isPlaying = _useState53[0], setIsPlaying = _useState53[1];
3072
3482
  var latestMessageProps = useLatestMessage();
3073
3483
  var unplayedMessageSentences = useMemo12(function() {
3074
3484
  if (!latestMessageProps.latestMessage) return [];
@@ -3168,7 +3578,7 @@ var useMessageAudio = function(param) {
3168
3578
  }, [
3169
3579
  audioPlayer
3170
3580
  ]);
3171
- var _useState44 = _sliced_to_array(useState4(null), 2), audioEngine = _useState44[0], setAudioEngine = _useState44[1];
3581
+ var _useState54 = _sliced_to_array(useState5(null), 2), audioEngine = _useState54[0], setAudioEngine = _useState54[1];
3172
3582
  var isAudioEngineInited = useRef6(false);
3173
3583
  useEffect5(function() {
3174
3584
  if (!audioPlayer.playing) return;
@@ -3214,8 +3624,8 @@ var useMessageAudio = function(param) {
3214
3624
  });
3215
3625
  };
3216
3626
  // src/components/threads/AudioThread/Root/index.tsx
3217
- import { jsx as jsx58 } from "react/jsx-runtime";
3218
- var Root9 = function(param) {
3627
+ import { jsx as jsx64 } from "react/jsx-runtime";
3628
+ var Root12 = function(param) {
3219
3629
  var children = param.children;
3220
3630
  var createMessageProps = useCreateMessage();
3221
3631
  var recorderProps = useRecorder({
@@ -3272,13 +3682,13 @@ var Root9 = function(param) {
3272
3682
  createMessageProps: createMessageProps,
3273
3683
  messageAudioProps: messageAudioProps
3274
3684
  }).status;
3275
- return /* @__PURE__ */ jsx58(AudioThreadContext.Provider, {
3685
+ return /* @__PURE__ */ jsx64(AudioThreadContext.Provider, {
3276
3686
  value: {
3277
3687
  status: status,
3278
3688
  recorderProps: recorderProps,
3279
3689
  messageAudioProps: messageAudioProps
3280
3690
  },
3281
- children: /* @__PURE__ */ jsx58(Flex21, {
3691
+ children: /* @__PURE__ */ jsx64(Flex23, {
3282
3692
  direction: "column",
3283
3693
  flexGrow: "1",
3284
3694
  p: "9",
@@ -3287,9 +3697,9 @@ var Root9 = function(param) {
3287
3697
  });
3288
3698
  };
3289
3699
  // src/components/threads/AudioThread/Visualization/index.tsx
3290
- import { useContext as useContext15, useState as useState6, useCallback as useCallback5, useEffect as useEffect7 } from "react";
3700
+ import { useContext as useContext15, useState as useState7, useCallback as useCallback6, useEffect as useEffect7 } from "react";
3291
3701
  import _9 from "lodash";
3292
- import { Flex as Flex23 } from "@radix-ui/themes";
3702
+ import { Flex as Flex25 } from "@radix-ui/themes";
3293
3703
  // src/hooks/threads/useAudioThreadContext/index.ts
3294
3704
  import { useContext as useContext14 } from "react";
3295
3705
  var useAudioThreadContext = function() {
@@ -3297,15 +3707,15 @@ var useAudioThreadContext = function() {
3297
3707
  };
3298
3708
  // src/components/threads/AudioThread/BarsVisualizer/index.tsx
3299
3709
  import _8 from "lodash";
3300
- import { Flex as Flex22, Grid } from "@radix-ui/themes";
3301
- import { useState as useState5, useEffect as useEffect6, useCallback as useCallback4 } from "react";
3710
+ import { Flex as Flex24, Grid } from "@radix-ui/themes";
3711
+ import { useState as useState6, useEffect as useEffect6, useCallback as useCallback5 } from "react";
3302
3712
  import { cluster } from "radash";
3303
- import { jsx as jsx59 } from "react/jsx-runtime";
3713
+ import { jsx as jsx65 } from "react/jsx-runtime";
3304
3714
  var barCount = 4;
3305
3715
  var BarsVisualizer = function(param) {
3306
3716
  var visualizationAnalyser = param.visualizationAnalyser, backgroundColor = param.backgroundColor, height = param.height, barWidth = param.barWidth;
3307
- var _useState5 = _sliced_to_array(useState5([]), 2), barHeights = _useState5[0], setBarHeights = _useState5[1];
3308
- var draw = useCallback4(function(param) {
3717
+ var _useState6 = _sliced_to_array(useState6([]), 2), barHeights = _useState6[0], setBarHeights = _useState6[1];
3718
+ var draw = useCallback5(function(param) {
3309
3719
  var visualizationAnalyser2 = param.visualizationAnalyser;
3310
3720
  if (!visualizationAnalyser2) {
3311
3721
  setBarHeights(Array(barCount).fill(0));
@@ -3331,7 +3741,7 @@ var BarsVisualizer = function(param) {
3331
3741
  draw,
3332
3742
  visualizationAnalyser
3333
3743
  ]);
3334
- return /* @__PURE__ */ jsx59(Grid, {
3744
+ return /* @__PURE__ */ jsx65(Grid, {
3335
3745
  columns: "".concat(barCount),
3336
3746
  gap: "1",
3337
3747
  width: "auto",
@@ -3340,12 +3750,12 @@ var BarsVisualizer = function(param) {
3340
3750
  gridTemplateColumns: "repeat(4, minmax(0, 1fr))"
3341
3751
  },
3342
3752
  children: barHeights.map(function(barHeight, index) {
3343
- return /* @__PURE__ */ jsx59(Flex22, {
3753
+ return /* @__PURE__ */ jsx65(Flex24, {
3344
3754
  direction: "column",
3345
3755
  align: "center",
3346
3756
  justify: "center",
3347
3757
  height: height,
3348
- children: /* @__PURE__ */ jsx59(Flex22, {
3758
+ children: /* @__PURE__ */ jsx65(Flex24, {
3349
3759
  minHeight: "50%",
3350
3760
  maxHeight: "100%",
3351
3761
  height: "".concat(barHeight + 20, "%"),
@@ -3360,12 +3770,12 @@ var BarsVisualizer = function(param) {
3360
3770
  });
3361
3771
  };
3362
3772
  // src/components/threads/AudioThread/Visualization/index.tsx
3363
- import { jsx as jsx60, jsxs as jsxs18 } from "react/jsx-runtime";
3773
+ import { jsx as jsx66, jsxs as jsxs24 } from "react/jsx-runtime";
3364
3774
  var Visualization = function() {
3365
3775
  var audioThreadContext = useAudioThreadContext();
3366
3776
  var assistantNameContext = useContext15(AssistantNameContext);
3367
- var _useState6 = _sliced_to_array(useState6(0), 2), scale = _useState6[0], setScale = _useState6[1];
3368
- var draw = useCallback5(function(param) {
3777
+ var _useState7 = _sliced_to_array(useState7(0), 2), scale = _useState7[0], setScale = _useState7[1];
3778
+ var draw = useCallback6(function(param) {
3369
3779
  var visualizationAnalyser = param.visualizationAnalyser;
3370
3780
  if (!visualizationAnalyser) {
3371
3781
  setScale(1);
@@ -3388,14 +3798,14 @@ var Visualization = function() {
3388
3798
  draw,
3389
3799
  audioThreadContext
3390
3800
  ]);
3391
- return /* @__PURE__ */ jsxs18(Flex23, {
3801
+ return /* @__PURE__ */ jsxs24(Flex25, {
3392
3802
  direction: "column",
3393
3803
  align: "center",
3394
3804
  justify: "center",
3395
3805
  mb: "3",
3396
3806
  flexGrow: "1",
3397
3807
  children: [
3398
- /* @__PURE__ */ jsx60(Flex23, {
3808
+ /* @__PURE__ */ jsx66(Flex25, {
3399
3809
  align: "center",
3400
3810
  justify: "center",
3401
3811
  height: "200px",
@@ -3405,20 +3815,20 @@ var Visualization = function() {
3405
3815
  borderRadius: "9999px",
3406
3816
  scale: scale
3407
3817
  },
3408
- children: /* @__PURE__ */ jsx60(BarsVisualizer, {
3818
+ children: /* @__PURE__ */ jsx66(BarsVisualizer, {
3409
3819
  visualizationAnalyser: audioThreadContext.messageAudioProps.visualizationAnalyser,
3410
3820
  backgroundColor: audioThreadContext.status === "playing" ? "var(--accent-11)" : "var(--gray-11)",
3411
3821
  height: "40px",
3412
3822
  barWidth: "24px"
3413
3823
  })
3414
3824
  }),
3415
- /* @__PURE__ */ jsxs18(Flex23, {
3825
+ /* @__PURE__ */ jsxs24(Flex25, {
3416
3826
  ml: "-22.5px",
3417
3827
  gap: "3",
3418
3828
  pt: "5",
3419
3829
  children: [
3420
- /* @__PURE__ */ jsx60(AssistantAvatar, {}),
3421
- /* @__PURE__ */ jsx60(Name, {
3830
+ /* @__PURE__ */ jsx66(AssistantAvatar, {}),
3831
+ /* @__PURE__ */ jsx66(Name, {
3422
3832
  children: assistantNameContext
3423
3833
  })
3424
3834
  ]
@@ -3427,8 +3837,8 @@ var Visualization = function() {
3427
3837
  });
3428
3838
  };
3429
3839
  // src/components/threads/AudioThread/Status/StatusMessages.tsx
3430
- import { Flex as Flex24, Text as Text7 } from "@radix-ui/themes";
3431
- import { jsx as jsx61, jsxs as jsxs19 } from "react/jsx-runtime";
3840
+ import { Flex as Flex26, Text as Text8 } from "@radix-ui/themes";
3841
+ import { jsx as jsx67, jsxs as jsxs25 } from "react/jsx-runtime";
3432
3842
  var html = function(param) {
3433
3843
  var texts = param.texts;
3434
3844
  return "\n .status-messages-texts:after {\n content: '".concat(texts[0], "';\n animation: texts ").concat(texts.length * 5, "s linear infinite;\n }\n\n @keyframes texts {\n ").concat(texts.map(function(_10, i) {
@@ -3437,17 +3847,17 @@ var html = function(param) {
3437
3847
  };
3438
3848
  var StatusMessages = function(param) {
3439
3849
  var texts = param.texts;
3440
- return /* @__PURE__ */ jsxs19(Flex24, {
3850
+ return /* @__PURE__ */ jsxs25(Flex26, {
3441
3851
  justify: "center",
3442
3852
  pb: "5",
3443
3853
  children: [
3444
- /* @__PURE__ */ jsx61(Text7, {
3854
+ /* @__PURE__ */ jsx67(Text8, {
3445
3855
  size: "2",
3446
3856
  weight: "regular",
3447
3857
  color: "gray",
3448
3858
  className: "status-messages-texts"
3449
3859
  }),
3450
- /* @__PURE__ */ jsx61("style", {
3860
+ /* @__PURE__ */ jsx67("style", {
3451
3861
  dangerouslySetInnerHTML: {
3452
3862
  __html: html({
3453
3863
  texts: texts
@@ -3458,11 +3868,11 @@ var StatusMessages = function(param) {
3458
3868
  });
3459
3869
  };
3460
3870
  // src/components/threads/AudioThread/Status/index.tsx
3461
- import { jsx as jsx62 } from "react/jsx-runtime";
3871
+ import { jsx as jsx68 } from "react/jsx-runtime";
3462
3872
  var Status = function() {
3463
3873
  var audioThreadContext = useAudioThreadContext();
3464
3874
  if (audioThreadContext.status === "recording") {
3465
- return /* @__PURE__ */ jsx62(StatusMessages, {
3875
+ return /* @__PURE__ */ jsx68(StatusMessages, {
3466
3876
  texts: [
3467
3877
  "Start speaking",
3468
3878
  "Listening",
@@ -3476,31 +3886,31 @@ var Status = function() {
3476
3886
  "idle",
3477
3887
  "playerPaused"
3478
3888
  ].includes(audioThreadContext.status)) {
3479
- return /* @__PURE__ */ jsx62(StatusMessages, {
3889
+ return /* @__PURE__ */ jsx68(StatusMessages, {
3480
3890
  texts: [
3481
3891
  "Click the button below to activate"
3482
3892
  ]
3483
3893
  });
3484
3894
  }
3485
3895
  if (audioThreadContext.status === "playing") {
3486
- return /* @__PURE__ */ jsx62(StatusMessages, {
3896
+ return /* @__PURE__ */ jsx68(StatusMessages, {
3487
3897
  texts: [
3488
3898
  "Click the button below to interrupt"
3489
3899
  ]
3490
3900
  });
3491
3901
  }
3492
- return /* @__PURE__ */ jsx62(StatusMessages, {
3902
+ return /* @__PURE__ */ jsx68(StatusMessages, {
3493
3903
  texts: [
3494
3904
  "Thinking"
3495
3905
  ]
3496
3906
  });
3497
3907
  };
3498
3908
  // src/components/threads/AudioThread/Form/index.tsx
3499
- import { Flex as Flex26 } from "@radix-ui/themes";
3909
+ import { Flex as Flex28 } from "@radix-ui/themes";
3500
3910
  // src/components/threads/AudioThread/Form/MicIcon.tsx
3501
- import { jsx as jsx63 } from "react/jsx-runtime";
3911
+ import { jsx as jsx69 } from "react/jsx-runtime";
3502
3912
  var MicIcon = function(props) {
3503
- return /* @__PURE__ */ jsx63("svg", _object_spread_props(_object_spread({
3913
+ return /* @__PURE__ */ jsx69("svg", _object_spread_props(_object_spread({
3504
3914
  xmlns: "http://www.w3.org/2000/svg",
3505
3915
  fill: "currentColor",
3506
3916
  stroke: "currentColor",
@@ -3509,54 +3919,54 @@ var MicIcon = function(props) {
3509
3919
  height: "15",
3510
3920
  width: "15"
3511
3921
  }, props), {
3512
- children: /* @__PURE__ */ jsx63("path", {
3922
+ children: /* @__PURE__ */ jsx69("path", {
3513
3923
  stroke: "none",
3514
3924
  d: "M192 0c-53 0-96 43-96 96v160c0 53 43 96 96 96s96-43 96-96V96c0-53-43-96-96-96zM64 216c0-13.3-10.7-24-24-24s-24 10.7-24 24v40c0 89.1 66.2 162.7 152 174.4V464h-48c-13.3 0-24 10.7-24 24s10.7 24 24 24h144c13.3 0 24-10.7 24-24s-10.7-24-24-24h-48v-33.6c85.8-11.7 152-85.3 152-174.4v-40c0-13.3-10.7-24-24-24s-24 10.7-24 24v40c0 70.7-57.3 128-128 128S64 326.7 64 256v-40z"
3515
3925
  })
3516
3926
  }));
3517
3927
  };
3518
3928
  // src/components/threads/AudioThread/Form/ActionButton/index.tsx
3519
- import { Flex as Flex25, IconButton as IconButton4 } from "@radix-ui/themes";
3929
+ import { Flex as Flex27, IconButton as IconButton6 } from "@radix-ui/themes";
3520
3930
  import { StopIcon as StopIcon2, PauseIcon, ArrowUpIcon as ArrowUpIcon2, ResumeIcon } from "@radix-ui/react-icons";
3521
- import { jsx as jsx64, jsxs as jsxs20 } from "react/jsx-runtime";
3931
+ import { jsx as jsx70, jsxs as jsxs26 } from "react/jsx-runtime";
3522
3932
  var ActionButton = function() {
3523
3933
  var audioThreadContext = useAudioThreadContext();
3524
3934
  var superinterfaceContext = useSuperinterfaceContext();
3525
3935
  if (audioThreadContext.status === "recording") {
3526
- return /* @__PURE__ */ jsxs20(Flex25, {
3936
+ return /* @__PURE__ */ jsxs26(Flex27, {
3527
3937
  align: "center",
3528
3938
  children: [
3529
- /* @__PURE__ */ jsx64(Flex25, {
3939
+ /* @__PURE__ */ jsx70(Flex27, {
3530
3940
  mr: "3",
3531
3941
  ml: "-7",
3532
- children: /* @__PURE__ */ jsx64(IconButton4, {
3942
+ children: /* @__PURE__ */ jsx70(IconButton6, {
3533
3943
  onClick: audioThreadContext.recorderProps.pause,
3534
3944
  color: "gray",
3535
3945
  variant: "soft",
3536
3946
  size: "1",
3537
- children: /* @__PURE__ */ jsx64(PauseIcon, {})
3947
+ children: /* @__PURE__ */ jsx70(PauseIcon, {})
3538
3948
  })
3539
3949
  }),
3540
- /* @__PURE__ */ jsx64(IconButton4, {
3950
+ /* @__PURE__ */ jsx70(IconButton6, {
3541
3951
  onClick: audioThreadContext.recorderProps.stop,
3542
3952
  highContrast: true,
3543
3953
  variant: "soft",
3544
3954
  size: "4",
3545
- children: /* @__PURE__ */ jsx64(ArrowUpIcon2, {})
3955
+ children: /* @__PURE__ */ jsx70(ArrowUpIcon2, {})
3546
3956
  })
3547
3957
  ]
3548
3958
  });
3549
3959
  }
3550
3960
  if (audioThreadContext.status === "recorderPaused") {
3551
- return /* @__PURE__ */ jsx64(IconButton4, {
3961
+ return /* @__PURE__ */ jsx70(IconButton6, {
3552
3962
  onClick: audioThreadContext.recorderProps.resume,
3553
3963
  color: "red",
3554
3964
  size: "4",
3555
- children: /* @__PURE__ */ jsx64(ResumeIcon, {})
3965
+ children: /* @__PURE__ */ jsx70(ResumeIcon, {})
3556
3966
  });
3557
3967
  }
3558
3968
  if (audioThreadContext.status === "idle") {
3559
- return /* @__PURE__ */ jsx64(IconButton4, {
3969
+ return /* @__PURE__ */ jsx70(IconButton6, {
3560
3970
  onClick: function() {
3561
3971
  return audioThreadContext.recorderProps.start();
3562
3972
  },
@@ -3565,7 +3975,7 @@ var ActionButton = function() {
3565
3975
  });
3566
3976
  }
3567
3977
  if (audioThreadContext.status === "playing") {
3568
- return /* @__PURE__ */ jsx64(IconButton4, {
3978
+ return /* @__PURE__ */ jsx70(IconButton6, {
3569
3979
  onClick: function() {
3570
3980
  var _superinterfaceContext_createMessageAbortControllerRef_current;
3571
3981
  audioThreadContext.messageAudioProps.stop();
@@ -3575,54 +3985,54 @@ var ActionButton = function() {
3575
3985
  size: "4",
3576
3986
  color: "gray",
3577
3987
  variant: "soft",
3578
- children: /* @__PURE__ */ jsx64(StopIcon2, {})
3988
+ children: /* @__PURE__ */ jsx70(StopIcon2, {})
3579
3989
  });
3580
3990
  }
3581
3991
  if (audioThreadContext.status === "playerPaused") {
3582
- return /* @__PURE__ */ jsx64(IconButton4, {
3992
+ return /* @__PURE__ */ jsx70(IconButton6, {
3583
3993
  onClick: function() {
3584
3994
  return audioThreadContext.messageAudioProps.play();
3585
3995
  },
3586
3996
  size: "4",
3587
- children: /* @__PURE__ */ jsx64(ResumeIcon, {})
3997
+ children: /* @__PURE__ */ jsx70(ResumeIcon, {})
3588
3998
  });
3589
3999
  }
3590
- return /* @__PURE__ */ jsx64(IconButton4, {
4000
+ return /* @__PURE__ */ jsx70(IconButton6, {
3591
4001
  size: "4",
3592
4002
  variant: "soft",
3593
4003
  disabled: true
3594
4004
  });
3595
4005
  };
3596
4006
  // src/components/threads/AudioThread/Form/index.tsx
3597
- import { jsx as jsx65, jsxs as jsxs21 } from "react/jsx-runtime";
4007
+ import { jsx as jsx71, jsxs as jsxs27 } from "react/jsx-runtime";
3598
4008
  var Form = function() {
3599
4009
  var audioThreadContext = useAudioThreadContext();
3600
- return /* @__PURE__ */ jsxs21(Flex26, {
4010
+ return /* @__PURE__ */ jsxs27(Flex28, {
3601
4011
  direction: "column",
3602
4012
  align: "center",
3603
4013
  children: [
3604
- /* @__PURE__ */ jsxs21(Flex26, {
4014
+ /* @__PURE__ */ jsxs27(Flex28, {
3605
4015
  pb: "3",
3606
4016
  align: "center",
3607
4017
  children: [
3608
- /* @__PURE__ */ jsx65(Flex26, {
4018
+ /* @__PURE__ */ jsx71(Flex28, {
3609
4019
  ml: "-22.5px",
3610
4020
  mr: "2",
3611
4021
  align: "center",
3612
- children: /* @__PURE__ */ jsx65(MicIcon, {
4022
+ children: /* @__PURE__ */ jsx71(MicIcon, {
3613
4023
  style: {
3614
4024
  color: audioThreadContext.status === "recording" ? "var(--accent-11)" : "var(--gray-11)"
3615
4025
  }
3616
4026
  })
3617
4027
  }),
3618
- /* @__PURE__ */ jsx65(Flex26, {
4028
+ /* @__PURE__ */ jsx71(Flex28, {
3619
4029
  px: "2",
3620
4030
  py: "1",
3621
4031
  style: {
3622
4032
  backgroundColor: audioThreadContext.status === "recording" ? "var(--accent-4)" : "var(--gray-4)",
3623
4033
  borderRadius: "var(--radius-6)"
3624
4034
  },
3625
- children: /* @__PURE__ */ jsx65(BarsVisualizer, {
4035
+ children: /* @__PURE__ */ jsx71(BarsVisualizer, {
3626
4036
  visualizationAnalyser: audioThreadContext.recorderProps.visualizationAnalyser,
3627
4037
  backgroundColor: audioThreadContext.status === "recording" ? "var(--accent-11)" : "var(--gray-11)",
3628
4038
  height: "20px",
@@ -3631,41 +4041,38 @@ var Form = function() {
3631
4041
  })
3632
4042
  ]
3633
4043
  }),
3634
- /* @__PURE__ */ jsx65(ActionButton, {})
4044
+ /* @__PURE__ */ jsx71(ActionButton, {})
3635
4045
  ]
3636
4046
  });
3637
4047
  };
3638
4048
  // src/components/threads/AudioThread/index.tsx
3639
- import { jsx as jsx66, jsxs as jsxs22 } from "react/jsx-runtime";
4049
+ import { jsx as jsx72, jsxs as jsxs28 } from "react/jsx-runtime";
3640
4050
  var AudioThread = function(props) {
3641
- return /* @__PURE__ */ jsxs22(Root9, _object_spread_props(_object_spread({}, props), {
4051
+ return /* @__PURE__ */ jsxs28(Root12, _object_spread_props(_object_spread({}, props), {
3642
4052
  children: [
3643
- /* @__PURE__ */ jsx66(Visualization, {}),
3644
- /* @__PURE__ */ jsx66(Status, {}),
3645
- /* @__PURE__ */ jsx66(Form, {})
4053
+ /* @__PURE__ */ jsx72(Visualization, {}),
4054
+ /* @__PURE__ */ jsx72(Status, {}),
4055
+ /* @__PURE__ */ jsx72(Form, {})
3646
4056
  ]
3647
4057
  }));
3648
4058
  };
3649
- AudioThread.Root = Root9;
4059
+ AudioThread.Root = Root12;
3650
4060
  AudioThread.Visualization = Visualization;
3651
4061
  AudioThread.Form = Form;
3652
4062
  // src/components/threads/AudioThreadDialog/index.tsx
3653
- import { jsx as jsx67, jsxs as jsxs23 } from "react/jsx-runtime";
4063
+ import { jsx as jsx73, jsxs as jsxs29 } from "react/jsx-runtime";
3654
4064
  var AudioThreadDialog = function() {
3655
- return /* @__PURE__ */ jsxs23(Root7, {
4065
+ return /* @__PURE__ */ jsxs29(Root9, {
3656
4066
  children: [
3657
- /* @__PURE__ */ jsx67(Content4.Root, {
3658
- children: /* @__PURE__ */ jsx67(AudioThread, {})
4067
+ /* @__PURE__ */ jsx73(Content4.Root, {
4068
+ children: /* @__PURE__ */ jsx73(AudioThread, {})
3659
4069
  }),
3660
- /* @__PURE__ */ jsx67(Trigger, {
3661
- children: /* @__PURE__ */ jsx67(Button2, {})
3662
- })
4070
+ /* @__PURE__ */ jsx73(Trigger, {})
3663
4071
  ]
3664
4072
  });
3665
4073
  };
3666
- AudioThreadDialog.Root = Root7;
4074
+ AudioThreadDialog.Root = Root9;
3667
4075
  AudioThreadDialog.Trigger = Trigger;
3668
- AudioThreadDialog.Button = Button2;
3669
4076
  AudioThreadDialog.Content = Content4;
3670
4077
  // src/components/suggestions/Suggestions/index.tsx
3671
4078
  import { useMemo as useMemo14 } from "react";
@@ -3673,15 +4080,15 @@ import { useMemo as useMemo14 } from "react";
3673
4080
  import { useMemo as useMemo13 } from "react";
3674
4081
  import { isEmpty as isEmpty3 } from "radash";
3675
4082
  import { onlyText } from "react-children-utilities";
3676
- import { Flex as Flex27 } from "@radix-ui/themes";
4083
+ import { Flex as Flex29 } from "@radix-ui/themes";
3677
4084
  // src/components/suggestions/Suggestions/Item.tsx
3678
4085
  import { ArrowUpIcon as ArrowUpIcon3 } from "@radix-ui/react-icons";
3679
- import { Text as Text8, Button as Button3, Spinner } from "@radix-ui/themes";
3680
- import { jsx as jsx68, jsxs as jsxs24 } from "react/jsx-runtime";
4086
+ import { Text as Text9, Button as Button4, Spinner as Spinner2 } from "@radix-ui/themes";
4087
+ import { jsx as jsx74, jsxs as jsxs30 } from "react/jsx-runtime";
3681
4088
  var Item = function(param) {
3682
4089
  var suggestion = param.suggestion, isDisabled = param.isDisabled;
3683
4090
  var _useCreateMessage = useCreateMessage(), createMessage = _useCreateMessage.createMessage, isPending = _useCreateMessage.isPending;
3684
- return /* @__PURE__ */ jsx68(Content5, {
4091
+ return /* @__PURE__ */ jsx74(Content5, {
3685
4092
  onClick: function() {
3686
4093
  createMessage({
3687
4094
  // @ts-ignore-next-line
@@ -3695,7 +4102,7 @@ var Item = function(param) {
3695
4102
  };
3696
4103
  var Content5 = function(param) {
3697
4104
  var onClick = param.onClick, isDisabled = param.isDisabled, isPending = param.isPending, children = param.children;
3698
- return /* @__PURE__ */ jsxs24(Button3, {
4105
+ return /* @__PURE__ */ jsxs30(Button4, {
3699
4106
  variant: "soft",
3700
4107
  onClick: onClick,
3701
4108
  disabled: isDisabled,
@@ -3705,14 +4112,14 @@ var Content5 = function(param) {
3705
4112
  flexShrink: 1
3706
4113
  },
3707
4114
  children: [
3708
- /* @__PURE__ */ jsx68(Text8, {
4115
+ /* @__PURE__ */ jsx74(Text9, {
3709
4116
  size: "1",
3710
4117
  weight: "regular",
3711
4118
  children: children
3712
4119
  }),
3713
- /* @__PURE__ */ jsx68(Spinner, {
4120
+ /* @__PURE__ */ jsx74(Spinner2, {
3714
4121
  loading: isPending,
3715
- children: /* @__PURE__ */ jsx68(ArrowUpIcon3, {
4122
+ children: /* @__PURE__ */ jsx74(ArrowUpIcon3, {
3716
4123
  style: {
3717
4124
  flexShrink: 0
3718
4125
  }
@@ -3723,7 +4130,7 @@ var Content5 = function(param) {
3723
4130
  };
3724
4131
  Item.Content = Content5;
3725
4132
  // src/components/suggestions/Suggestions/Content.tsx
3726
- import { jsx as jsx69 } from "react/jsx-runtime";
4133
+ import { jsx as jsx75 } from "react/jsx-runtime";
3727
4134
  var Content6 = function(param) {
3728
4135
  var children = param.children;
3729
4136
  var isMutatingMessage = useIsMutatingMessage();
@@ -3737,12 +4144,12 @@ var Content6 = function(param) {
3737
4144
  children
3738
4145
  ]);
3739
4146
  if (isEmpty3(suggestions)) return null;
3740
- return /* @__PURE__ */ jsx69(Flex27, {
4147
+ return /* @__PURE__ */ jsx75(Flex29, {
3741
4148
  gap: "2",
3742
4149
  py: "2",
3743
4150
  wrap: "wrap",
3744
4151
  children: suggestions.map(function(suggestion) {
3745
- return /* @__PURE__ */ jsx69(Item, {
4152
+ return /* @__PURE__ */ jsx75(Item, {
3746
4153
  suggestion: suggestion,
3747
4154
  isDisabled: isMutatingMessage
3748
4155
  }, suggestion);
@@ -3750,7 +4157,7 @@ var Content6 = function(param) {
3750
4157
  });
3751
4158
  };
3752
4159
  // src/components/suggestions/Suggestions/index.tsx
3753
- import { jsx as jsx70 } from "react/jsx-runtime";
4160
+ import { jsx as jsx76 } from "react/jsx-runtime";
3754
4161
  var Suggestions = function(param) {
3755
4162
  var children = param.children;
3756
4163
  var latestMessageProps = useLatestMessage();
@@ -3763,14 +4170,14 @@ var Suggestions = function(param) {
3763
4170
  ]);
3764
4171
  if (latestMessageProps.isLoading) return null;
3765
4172
  if (isDisabled) return null;
3766
- return /* @__PURE__ */ jsx70(Content6, {
4173
+ return /* @__PURE__ */ jsx76(Content6, {
3767
4174
  children: children
3768
4175
  });
3769
4176
  };
3770
4177
  Suggestions.Item = Item;
3771
4178
  // src/components/markdown/MarkdownProvider/index.tsx
3772
4179
  import { useMemo as useMemo15 } from "react";
3773
- import { jsx as jsx71 } from "react/jsx-runtime";
4180
+ import { jsx as jsx77 } from "react/jsx-runtime";
3774
4181
  var MarkdownProvider = function(_param) {
3775
4182
  var children = _param.children, rest = _object_without_properties(_param, [
3776
4183
  "children"
@@ -3782,7 +4189,7 @@ var MarkdownProvider = function(_param) {
3782
4189
  rest,
3783
4190
  prevMarkdownContext
3784
4191
  ]);
3785
- return /* @__PURE__ */ jsx71(MarkdownContext.Provider, {
4192
+ return /* @__PURE__ */ jsx77(MarkdownContext.Provider, {
3786
4193
  value: value,
3787
4194
  children: children
3788
4195
  });
@@ -3795,7 +4202,7 @@ var useComponents = function() {
3795
4202
  return useContext16(ComponentsContext);
3796
4203
  };
3797
4204
  // src/components/components/ComponentsProvider.tsx
3798
- import { jsx as jsx72 } from "react/jsx-runtime";
4205
+ import { jsx as jsx78 } from "react/jsx-runtime";
3799
4206
  var ComponentsProvider = function(_param) {
3800
4207
  var children = _param.children, rest = _object_without_properties(_param, [
3801
4208
  "children"
@@ -3807,7 +4214,7 @@ var ComponentsProvider = function(_param) {
3807
4214
  rest,
3808
4215
  prevComponents
3809
4216
  ]);
3810
- return /* @__PURE__ */ jsx72(ComponentsContext.Provider, {
4217
+ return /* @__PURE__ */ jsx78(ComponentsContext.Provider, {
3811
4218
  value: value,
3812
4219
  children: children
3813
4220
  });