@superinterface/react 2.0.11 → 2.1.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
@@ -619,7 +619,7 @@ var useToasts = function() {
619
619
  };
620
620
  // src/components/threads/Thread/Messages/Content/MessageGroup/index.tsx
621
621
  import { useContext as useContext6 } from "react";
622
- import { Box as Box9, Avatar as Avatar3 } from "@radix-ui/themes";
622
+ import { Box as Box10, Avatar as Avatar3 } from "@radix-ui/themes";
623
623
  import { PersonIcon } from "@radix-ui/react-icons";
624
624
  // src/components/messageGroups/MessageGroupBase/AssistantAvatar.tsx
625
625
  import { useContext as useContext3 } from "react";
@@ -655,7 +655,7 @@ var AssistantNameContext = createContext4("Assistant");
655
655
  import { Flex as Flex10 } from "@radix-ui/themes";
656
656
  // src/components/threads/Thread/Message/index.tsx
657
657
  import { useMemo as useMemo4 } from "react";
658
- import { Box as Box8 } from "@radix-ui/themes";
658
+ import { Box as Box9 } from "@radix-ui/themes";
659
659
  // src/components/runSteps/RunSteps/index.tsx
660
660
  import { Flex as Flex9 } from "@radix-ui/themes";
661
661
  // src/components/runSteps/RunStep/ToolCalls/index.tsx
@@ -1039,6 +1039,20 @@ var Code2 = function(param) {
1039
1039
  children: children
1040
1040
  });
1041
1041
  };
1042
+ // src/contexts/markdown/MarkdownContext/lib/components/Img.tsx
1043
+ import { Box as Box8 } from "@radix-ui/themes";
1044
+ import { jsx as jsx28 } from "react/jsx-runtime";
1045
+ var Img = function(props) {
1046
+ return /* @__PURE__ */ jsx28(Box8, {
1047
+ pb: "3",
1048
+ children: /* @__PURE__ */ jsx28("img", _object_spread_props(_object_spread({}, props), {
1049
+ style: {
1050
+ maxWidth: "100%",
1051
+ height: "auto"
1052
+ }
1053
+ }))
1054
+ });
1055
+ };
1042
1056
  // src/contexts/markdown/MarkdownContext/lib/components/index.tsx
1043
1057
  var components = {
1044
1058
  p: Paragraph,
@@ -1048,7 +1062,8 @@ var components = {
1048
1062
  ol: OrderedList,
1049
1063
  li: ListItem,
1050
1064
  pre: Pre,
1051
- code: Code2
1065
+ code: Code2,
1066
+ img: Img
1052
1067
  };
1053
1068
  // src/contexts/markdown/MarkdownContext/index.ts
1054
1069
  var MarkdownContext = createContext7({
@@ -1068,7 +1083,7 @@ var TextContent = function(param) {
1068
1083
  return useRemarkSync(content.text.value, markdownContext);
1069
1084
  };
1070
1085
  // src/components/threads/Thread/Message/index.tsx
1071
- import { jsx as jsx28, jsxs as jsxs6 } from "react/jsx-runtime";
1086
+ import { jsx as jsx29, jsxs as jsxs6 } from "react/jsx-runtime";
1072
1087
  var Message = function(param) {
1073
1088
  var message = param.message;
1074
1089
  var _useMemo4 = _sliced_to_array(useMemo4(function() {
@@ -1103,23 +1118,23 @@ var Message = function(param) {
1103
1118
  }, [
1104
1119
  message
1105
1120
  ]), 2), olderRunSteps = _useMemo4[0], laterRunSteps = _useMemo4[1];
1106
- return /* @__PURE__ */ jsx28(Provider, {
1121
+ return /* @__PURE__ */ jsx29(Provider, {
1107
1122
  value: {
1108
1123
  message: message
1109
1124
  },
1110
- children: /* @__PURE__ */ jsxs6(Box8, {
1125
+ children: /* @__PURE__ */ jsxs6(Box9, {
1111
1126
  children: [
1112
- /* @__PURE__ */ jsx28(RunSteps, {
1127
+ /* @__PURE__ */ jsx29(RunSteps, {
1113
1128
  runSteps: olderRunSteps
1114
1129
  }),
1115
1130
  message.content.map(function(content, index) {
1116
- return /* @__PURE__ */ jsx28(Box8, {
1117
- children: content.type === "text" && /* @__PURE__ */ jsx28(TextContent, {
1131
+ return /* @__PURE__ */ jsx29(Box9, {
1132
+ children: content.type === "text" && /* @__PURE__ */ jsx29(TextContent, {
1118
1133
  content: content
1119
1134
  })
1120
1135
  }, index);
1121
1136
  }),
1122
- /* @__PURE__ */ jsx28(RunSteps, {
1137
+ /* @__PURE__ */ jsx29(RunSteps, {
1123
1138
  runSteps: laterRunSteps
1124
1139
  })
1125
1140
  ]
@@ -1127,36 +1142,36 @@ var Message = function(param) {
1127
1142
  });
1128
1143
  };
1129
1144
  // src/components/threads/Thread/Messages/Content/MessageGroup/Content/index.tsx
1130
- import { jsx as jsx29 } from "react/jsx-runtime";
1145
+ import { jsx as jsx30 } from "react/jsx-runtime";
1131
1146
  var Content2 = function(param) {
1132
1147
  var messageGroup = param.messageGroup;
1133
- return /* @__PURE__ */ jsx29(Flex10, {
1148
+ return /* @__PURE__ */ jsx30(Flex10, {
1134
1149
  direction: "column-reverse",
1135
1150
  children: messageGroup.messages.map(function(message) {
1136
- return /* @__PURE__ */ jsx29(Message, {
1151
+ return /* @__PURE__ */ jsx30(Message, {
1137
1152
  message: message
1138
1153
  }, message.id);
1139
1154
  })
1140
1155
  });
1141
1156
  };
1142
1157
  // src/components/threads/Thread/Messages/Content/MessageGroup/index.tsx
1143
- import { jsx as jsx30, jsxs as jsxs7 } from "react/jsx-runtime";
1158
+ import { jsx as jsx31, jsxs as jsxs7 } from "react/jsx-runtime";
1144
1159
  var MessageGroup = function(param) {
1145
1160
  var messageGroup = param.messageGroup;
1146
1161
  var assistantNameContext = useContext6(AssistantNameContext);
1147
1162
  return /* @__PURE__ */ jsxs7(MessageGroupBase, {
1148
1163
  children: [
1149
- messageGroup.role === "user" ? /* @__PURE__ */ jsx30(Avatar3, {
1150
- fallback: /* @__PURE__ */ jsx30(PersonIcon, {}),
1164
+ messageGroup.role === "user" ? /* @__PURE__ */ jsx31(Avatar3, {
1165
+ fallback: /* @__PURE__ */ jsx31(PersonIcon, {}),
1151
1166
  size: "1"
1152
- }) : /* @__PURE__ */ jsx30(AssistantAvatar, {}),
1153
- /* @__PURE__ */ jsxs7(Box9, {
1167
+ }) : /* @__PURE__ */ jsx31(AssistantAvatar, {}),
1168
+ /* @__PURE__ */ jsxs7(Box10, {
1154
1169
  flexGrow: "1",
1155
1170
  children: [
1156
- /* @__PURE__ */ jsx30(Name, {
1171
+ /* @__PURE__ */ jsx31(Name, {
1157
1172
  children: messageGroup.role === "user" ? "You" : assistantNameContext
1158
1173
  }),
1159
- /* @__PURE__ */ jsx30(Content2, {
1174
+ /* @__PURE__ */ jsx31(Content2, {
1160
1175
  messageGroup: messageGroup
1161
1176
  })
1162
1177
  ]
@@ -1165,7 +1180,7 @@ var MessageGroup = function(param) {
1165
1180
  });
1166
1181
  };
1167
1182
  // src/components/threads/Thread/Messages/Content/index.tsx
1168
- import { Fragment, jsx as jsx31 } from "react/jsx-runtime";
1183
+ import { Fragment, jsx as jsx32 } from "react/jsx-runtime";
1169
1184
  var Content3 = function() {
1170
1185
  var _useMessages = useMessages(), messages2 = _useMessages.messages, isLoading = _useMessages.isLoading, isLoadingError = _useMessages.isLoadingError;
1171
1186
  var addToast = useToasts().addToast;
@@ -1184,23 +1199,23 @@ var Content3 = function() {
1184
1199
  addToast
1185
1200
  ]);
1186
1201
  if (isLoading || isLoadingError) {
1187
- return /* @__PURE__ */ jsx31(MessagesSkeleton, {});
1202
+ return /* @__PURE__ */ jsx32(MessagesSkeleton, {});
1188
1203
  }
1189
- return /* @__PURE__ */ jsx31(Fragment, {
1204
+ return /* @__PURE__ */ jsx32(Fragment, {
1190
1205
  children: messageGroups2.map(function(messageGroup) {
1191
- return /* @__PURE__ */ jsx31(MessageGroup, {
1206
+ return /* @__PURE__ */ jsx32(MessageGroup, {
1192
1207
  messageGroup: messageGroup
1193
1208
  }, messageGroup.id);
1194
1209
  })
1195
1210
  });
1196
1211
  };
1197
1212
  // src/components/threads/Thread/Messages/Progress/index.tsx
1198
- import { Box as Box11 } from "@radix-ui/themes";
1213
+ import { Box as Box12 } from "@radix-ui/themes";
1199
1214
  // src/components/skeletons/StartingContentSkeleton/index.tsx
1200
1215
  import { Skeleton as Skeleton2 } from "@radix-ui/themes";
1201
- import { jsx as jsx32 } from "react/jsx-runtime";
1216
+ import { jsx as jsx33 } from "react/jsx-runtime";
1202
1217
  var StartingContentSkeleton = function() {
1203
- return /* @__PURE__ */ jsx32(Skeleton2, {
1218
+ return /* @__PURE__ */ jsx33(Skeleton2, {
1204
1219
  loading: true,
1205
1220
  mt: "1",
1206
1221
  height: "var(--space-4)",
@@ -1213,21 +1228,21 @@ var StartingContentSkeleton = function() {
1213
1228
  };
1214
1229
  // src/components/skeletons/StartingSkeleton/index.tsx
1215
1230
  import { useContext as useContext7 } from "react";
1216
- import { Box as Box10 } from "@radix-ui/themes";
1217
- import { jsx as jsx33, jsxs as jsxs8 } from "react/jsx-runtime";
1231
+ import { Box as Box11 } from "@radix-ui/themes";
1232
+ import { jsx as jsx34, jsxs as jsxs8 } from "react/jsx-runtime";
1218
1233
  var StartingSkeleton = function(param) {
1219
1234
  var children = param.children;
1220
1235
  var assistantNameContext = useContext7(AssistantNameContext);
1221
1236
  return /* @__PURE__ */ jsxs8(MessageGroupBase, {
1222
1237
  children: [
1223
- /* @__PURE__ */ jsx33(AssistantAvatar, {}),
1224
- /* @__PURE__ */ jsxs8(Box10, {
1238
+ /* @__PURE__ */ jsx34(AssistantAvatar, {}),
1239
+ /* @__PURE__ */ jsxs8(Box11, {
1225
1240
  children: [
1226
- /* @__PURE__ */ jsx33(Name, {
1241
+ /* @__PURE__ */ jsx34(Name, {
1227
1242
  children: assistantNameContext
1228
1243
  }),
1229
1244
  children,
1230
- /* @__PURE__ */ jsx33(StartingContentSkeleton, {})
1245
+ /* @__PURE__ */ jsx34(StartingContentSkeleton, {})
1231
1246
  ]
1232
1247
  })
1233
1248
  ]
@@ -1306,19 +1321,6 @@ var useLatestRun = function() {
1306
1321
  props
1307
1322
  ]);
1308
1323
  };
1309
- // src/lib/runs/isRunEditingMessage/index.ts
1310
- import _4 from "lodash";
1311
- var isRunEditingMessage = function(param) {
1312
- var message = param.message;
1313
- if (!message) return false;
1314
- if (message.role === "user") return false;
1315
- if (!message.run_id) return false;
1316
- var hasContent = _4.some(message.content, function(content) {
1317
- var _content_text;
1318
- return content.type !== "text" || content.type === "text" && ((_content_text = content.text) === null || _content_text === void 0 ? void 0 : _content_text.value) !== "";
1319
- });
1320
- return !hasContent;
1321
- };
1322
1324
  // src/hooks/runs/usePollingContext/index.ts
1323
1325
  import { useContext as useContext8 } from "react";
1324
1326
  // src/contexts/runs/PollingContext/index.tsx
@@ -1352,9 +1354,7 @@ var isRunActive = function(param) {
1352
1354
  if (!latestRunProps.latestRun) return false;
1353
1355
  if (progressStatuses.includes(latestRunProps.latestRun.status)) return true;
1354
1356
  if (stoppedStatuses.includes(latestRunProps.latestRun.status)) return false;
1355
- return isRunEditingMessage({
1356
- message: latestMessageProps.latestMessage
1357
- });
1357
+ return false;
1358
1358
  };
1359
1359
  var useIsRunActive = function() {
1360
1360
  var latestRunProps = useLatestRun();
@@ -1398,21 +1398,21 @@ var useIsRunActive = function() {
1398
1398
  ]);
1399
1399
  };
1400
1400
  // src/components/threads/Thread/Messages/Progress/index.tsx
1401
- import { jsx as jsx34, jsxs as jsxs9 } from "react/jsx-runtime";
1401
+ import { jsx as jsx35, jsxs as jsxs9 } from "react/jsx-runtime";
1402
1402
  var Progress = function() {
1403
1403
  var _useIsRunActive = useIsRunActive(), isRunActive2 = _useIsRunActive.isRunActive;
1404
1404
  var latestMessage = useLatestMessage().latestMessage;
1405
1405
  if (!latestMessage) return null;
1406
1406
  if (!isRunActive2) return null;
1407
1407
  if (latestMessage.role === "user") {
1408
- return /* @__PURE__ */ jsx34(StartingSkeleton, {});
1408
+ return /* @__PURE__ */ jsx35(StartingSkeleton, {});
1409
1409
  }
1410
1410
  return /* @__PURE__ */ jsxs9(MessageGroupBase, {
1411
1411
  children: [
1412
- /* @__PURE__ */ jsx34(Box11, {
1412
+ /* @__PURE__ */ jsx35(Box12, {
1413
1413
  pl: "5"
1414
1414
  }),
1415
- /* @__PURE__ */ jsx34(StartingContentSkeleton, {})
1415
+ /* @__PURE__ */ jsx35(StartingContentSkeleton, {})
1416
1416
  ]
1417
1417
  });
1418
1418
  };
@@ -1422,12 +1422,12 @@ import { Flex as Flex11 } from "@radix-ui/themes";
1422
1422
  import { useRef as useRef2 } from "react";
1423
1423
  import { useInView } from "react-intersection-observer";
1424
1424
  // src/hooks/misc/useThrottledEffect/index.tsx
1425
- import _5 from "lodash";
1425
+ import _4 from "lodash";
1426
1426
  import { useRef, useEffect as useEffect2, useCallback } from "react";
1427
1427
  var useThrottledEffect = function(cb, delay, additionalDeps) {
1428
1428
  var _cbRef;
1429
1429
  var cbRef = useRef(cb);
1430
- var throttledCb = useCallback(_5.throttle(function() {
1430
+ var throttledCb = useCallback(_4.throttle(function() {
1431
1431
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
1432
1432
  args[_key] = arguments[_key];
1433
1433
  }
@@ -1754,10 +1754,10 @@ var useCreateRun = function() {
1754
1754
  });
1755
1755
  };
1756
1756
  // src/lib/optimistic/isOptimistic.ts
1757
- import _6 from "lodash";
1757
+ import _5 from "lodash";
1758
1758
  var isOptimistic = function(param) {
1759
1759
  var id = param.id;
1760
- return _6.startsWith(id, "-");
1760
+ return _5.startsWith(id, "-");
1761
1761
  };
1762
1762
  // src/hooks/runs/useManageRuns/index.tsx
1763
1763
  var useManageRuns = function() {
@@ -1836,7 +1836,7 @@ var refetch = function() {
1836
1836
  queryClient = param.queryClient, threadContext = param.threadContext;
1837
1837
  return [
1838
1838
  4,
1839
- queryClient.invalidateQueries({
1839
+ queryClient.refetchQueries({
1840
1840
  queryKey: (_threadContext_defaultOptions_queries_queryKey = threadContext.defaultOptions.queries.queryKey) !== null && _threadContext_defaultOptions_queries_queryKey !== void 0 ? _threadContext_defaultOptions_queries_queryKey : [
1841
1841
  "messages",
1842
1842
  threadContext.variables
@@ -1847,7 +1847,7 @@ var refetch = function() {
1847
1847
  _state.sent();
1848
1848
  return [
1849
1849
  4,
1850
- queryClient.invalidateQueries({
1850
+ queryClient.refetchQueries({
1851
1851
  queryKey: (_threadContext_defaultOptions_queries_queryKey1 = threadContext.defaultOptions.queries.queryKey) !== null && _threadContext_defaultOptions_queries_queryKey1 !== void 0 ? _threadContext_defaultOptions_queries_queryKey1 : [
1852
1852
  "runs",
1853
1853
  threadContext.variables
@@ -1870,12 +1870,15 @@ var refetch = function() {
1870
1870
  var usePolling = function() {
1871
1871
  var threadContext = useSuperinterfaceContext();
1872
1872
  var queryClient = useQueryClient6();
1873
- var setIsPollRefetching = usePollingContext().setIsPollRefetching;
1873
+ var _usePollingContext = usePollingContext(), isPollRefetching = _usePollingContext.isPollRefetching, setIsPollRefetching = _usePollingContext.setIsPollRefetching;
1874
1874
  var isRunActiveProps = useIsRunActive();
1875
1875
  useInterval(/*#__PURE__*/ _async_to_generator(function() {
1876
1876
  return _ts_generator(this, function(_state) {
1877
1877
  switch(_state.label){
1878
1878
  case 0:
1879
+ if (isPollRefetching) return [
1880
+ 2
1881
+ ];
1879
1882
  setIsPollRefetching(true);
1880
1883
  return [
1881
1884
  4,
@@ -1911,8 +1914,7 @@ var usePolling = function() {
1911
1914
  return null;
1912
1915
  };
1913
1916
  // src/hooks/actions/useManageActions/index.tsx
1914
- import { useQueryClient as useQueryClient8 } from "@tanstack/react-query";
1915
- import { useEffect as useEffect5 } from "react";
1917
+ import { useEffect as useEffect5, useState as useState2 } from "react";
1916
1918
  // src/hooks/actions/useHandleAction/index.tsx
1917
1919
  import { partob as partob2 } from "radash";
1918
1920
  import { useMutation as useMutation2, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
@@ -1976,34 +1978,34 @@ var useHandleAction = function() {
1976
1978
  superinterfaceContext: superinterfaceContext
1977
1979
  })));
1978
1980
  return _object_spread_props(_object_spread({}, props), {
1979
- handleAction: partob2(props.mutate, threadContext.variables)
1981
+ handleAction: partob2(props.mutateAsync, threadContext.variables)
1980
1982
  });
1981
1983
  };
1982
1984
  // src/hooks/actions/useManageActions/index.tsx
1983
1985
  var useManageActions = function() {
1984
- var queryClient = useQueryClient8();
1985
- var threadContext = useSuperinterfaceContext();
1986
1986
  var latestRunProps = useLatestRun();
1987
1987
  var handleActionProps = useHandleAction();
1988
+ var _useState2 = _sliced_to_array(useState2([]), 2), handledRunIds = _useState2[0], setHandledRunIds = _useState2[1];
1988
1989
  useEffect5(function() {
1989
1990
  if (handleActionProps.isPending) return;
1990
1991
  if (latestRunProps.isFetching) return;
1991
1992
  if (!latestRunProps.latestRun) return;
1992
1993
  if (latestRunProps.latestRun.status !== "requires_action") return;
1993
- var isMutating = queryClient.isMutating({
1994
- mutationKey: [
1995
- "handleAction",
1996
- threadContext.variables
1997
- ]
1994
+ if (handledRunIds.includes(latestRunProps.latestRun.id)) return;
1995
+ setHandledRunIds(function(prev) {
1996
+ return _to_consumable_array(prev).concat([
1997
+ latestRunProps.latestRun.id
1998
+ ]);
1998
1999
  });
1999
- if (isMutating) return;
2000
- console.log("requires action", {
2001
- latestRunProps: latestRunProps
2000
+ console.log("Requires action", {
2001
+ latestRunProps: latestRunProps,
2002
+ handleActionProps: handleActionProps
2002
2003
  });
2003
2004
  handleActionProps.handleAction({
2004
2005
  latestRun: latestRunProps.latestRun
2005
2006
  });
2006
2007
  }, [
2008
+ handledRunIds,
2007
2009
  handleActionProps,
2008
2010
  latestRunProps
2009
2011
  ]);
@@ -2017,7 +2019,7 @@ var useLifecycle = function() {
2017
2019
  return null;
2018
2020
  };
2019
2021
  // src/components/threads/Thread/Messages/Root/index.tsx
2020
- import { jsx as jsx35, jsxs as jsxs10 } from "react/jsx-runtime";
2022
+ import { jsx as jsx36, jsxs as jsxs10 } from "react/jsx-runtime";
2021
2023
  var Root = function(param) {
2022
2024
  var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
2023
2025
  var _useMessages = useMessages(), isFetchingNextPage = _useMessages.isFetchingNextPage, hasNextPage = _useMessages.hasNextPage, fetchNextPage = _useMessages.fetchNextPage;
@@ -2036,10 +2038,10 @@ var Root = function(param) {
2036
2038
  }),
2037
2039
  children: [
2038
2040
  children,
2039
- hasNextPage && /* @__PURE__ */ jsx35(Flex11, {
2041
+ hasNextPage && /* @__PURE__ */ jsx36(Flex11, {
2040
2042
  ref: loaderRef
2041
2043
  }),
2042
- /* @__PURE__ */ jsx35(Flex11, {
2044
+ /* @__PURE__ */ jsx36(Flex11, {
2043
2045
  flexShrink: "0",
2044
2046
  flexGrow: "1"
2045
2047
  })
@@ -2047,30 +2049,30 @@ var Root = function(param) {
2047
2049
  });
2048
2050
  };
2049
2051
  // src/components/threads/Thread/Messages/NextPageSkeleton.tsx
2050
- import { jsx as jsx36 } from "react/jsx-runtime";
2052
+ import { jsx as jsx37 } from "react/jsx-runtime";
2051
2053
  var NextPageSkeleton = function() {
2052
2054
  var hasNextPage = useMessages().hasNextPage;
2053
2055
  if (!hasNextPage) {
2054
2056
  return null;
2055
2057
  }
2056
- return /* @__PURE__ */ jsx36(MessagesSkeleton, {});
2058
+ return /* @__PURE__ */ jsx37(MessagesSkeleton, {});
2057
2059
  };
2058
2060
  // src/components/threads/Thread/Messages/index.tsx
2059
- import { jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
2061
+ import { jsx as jsx38, jsxs as jsxs11 } from "react/jsx-runtime";
2060
2062
  var Messages = function(param) {
2061
2063
  var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
2062
2064
  return /* @__PURE__ */ jsxs11(Root, {
2063
2065
  style: style,
2064
2066
  children: [
2065
- /* @__PURE__ */ jsx37(Flex12, {
2067
+ /* @__PURE__ */ jsx38(Flex12, {
2066
2068
  flexShrink: "0",
2067
2069
  height: "var(--space-3)"
2068
2070
  }),
2069
- /* @__PURE__ */ jsx37(Progress, {}),
2071
+ /* @__PURE__ */ jsx38(Progress, {}),
2070
2072
  children,
2071
- /* @__PURE__ */ jsx37(Content3, {}),
2072
- /* @__PURE__ */ jsx37(NextPageSkeleton, {}),
2073
- /* @__PURE__ */ jsx37(Flex12, {
2073
+ /* @__PURE__ */ jsx38(Content3, {}),
2074
+ /* @__PURE__ */ jsx38(NextPageSkeleton, {}),
2075
+ /* @__PURE__ */ jsx38(Flex12, {
2074
2076
  flexShrink: "0",
2075
2077
  flexGrow: "1"
2076
2078
  })
@@ -2084,7 +2086,7 @@ Messages.NextPageSkeleton = NextPageSkeleton;
2084
2086
  import { Flex as Flex14, Text as Text5 } from "@radix-ui/themes";
2085
2087
  // src/components/threads/Thread/MessageForm/Submit/index.tsx
2086
2088
  import { ArrowUpIcon } from "@radix-ui/react-icons";
2087
- import { Button as Button2, Spinner } from "@radix-ui/themes";
2089
+ import { IconButton, Spinner } from "@radix-ui/themes";
2088
2090
  // src/hooks/messages/useMessageFormContext/index.ts
2089
2091
  import { useContext as useContext9 } from "react";
2090
2092
  // src/contexts/messages/MessageFormContext/index.ts
@@ -2098,16 +2100,15 @@ var useMessageFormContext = function() {
2098
2100
  return useContext9(MessageFormContext);
2099
2101
  };
2100
2102
  // src/components/threads/Thread/MessageForm/Submit/index.tsx
2101
- import { jsx as jsx38 } from "react/jsx-runtime";
2103
+ import { jsx as jsx39 } from "react/jsx-runtime";
2102
2104
  var Submit = function() {
2103
2105
  var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading;
2104
- return /* @__PURE__ */ jsx38(Button2, {
2106
+ return /* @__PURE__ */ jsx39(IconButton, {
2105
2107
  type: "submit",
2106
- radius: "large",
2107
2108
  disabled: isDisabled || isLoading,
2108
- children: /* @__PURE__ */ jsx38(Spinner, {
2109
+ children: /* @__PURE__ */ jsx39(Spinner, {
2109
2110
  loading: isLoading,
2110
- children: /* @__PURE__ */ jsx38(ArrowUpIcon, {})
2111
+ children: /* @__PURE__ */ jsx39(ArrowUpIcon, {})
2111
2112
  })
2112
2113
  });
2113
2114
  };
@@ -2116,7 +2117,7 @@ import { useMemo as useMemo9 } from "react";
2116
2117
  import { useForm, FormProvider } from "react-hook-form";
2117
2118
  // src/hooks/messages/useCreateMessage/index.ts
2118
2119
  import { partob as partob3 } from "radash";
2119
- import { useMutation as useMutation3, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
2120
+ import { useMutation as useMutation3, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
2120
2121
  // src/hooks/messages/useCreateMessage/lib/mutationOptions/onMutate/index.ts
2121
2122
  import { omit } from "radash";
2122
2123
  // src/hooks/messages/useCreateMessage/lib/mutationOptions/onMutate/data.ts
@@ -2263,7 +2264,7 @@ var useCreateMessage = function() {
2263
2264
  var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
2264
2265
  onError: function() {}
2265
2266
  }, _ref_onError = _ref.onError, onError = _ref_onError === void 0 ? function() {} : _ref_onError;
2266
- var queryClient = useQueryClient9();
2267
+ var queryClient = useQueryClient8();
2267
2268
  var superinterfaceContext = useSuperinterfaceContext();
2268
2269
  var threadContext = useSuperinterfaceContext();
2269
2270
  var props = useMutation3(_object_spread({
@@ -2297,7 +2298,7 @@ var formOptions = {
2297
2298
  resolver: zodResolver(schema)
2298
2299
  };
2299
2300
  // src/components/threads/Thread/MessageForm/Root/index.tsx
2300
- import { jsx as jsx39 } from "react/jsx-runtime";
2301
+ import { jsx as jsx40 } from "react/jsx-runtime";
2301
2302
  var Root2 = function(param) {
2302
2303
  var children = param.children;
2303
2304
  var formProps = useForm(formOptions);
@@ -2351,13 +2352,13 @@ var Root2 = function(param) {
2351
2352
  latestMessage,
2352
2353
  isLoading
2353
2354
  ]);
2354
- return /* @__PURE__ */ jsx39(MessageFormContext.Provider, {
2355
+ return /* @__PURE__ */ jsx40(MessageFormContext.Provider, {
2355
2356
  value: {
2356
2357
  isDisabled: isDisabled,
2357
2358
  isLoading: isLoading
2358
2359
  },
2359
- children: /* @__PURE__ */ jsx39(FormProvider, _object_spread_props(_object_spread({}, formProps), {
2360
- children: /* @__PURE__ */ jsx39("form", {
2360
+ children: /* @__PURE__ */ jsx40(FormProvider, _object_spread_props(_object_spread({}, formProps), {
2361
+ children: /* @__PURE__ */ jsx40("form", {
2361
2362
  onSubmit: handleSubmit(onSubmit),
2362
2363
  children: children
2363
2364
  })
@@ -2370,15 +2371,15 @@ import { useContext as useContext10, useMemo as useMemo10, useRef as useRef3, us
2370
2371
  // src/components/textareas/TextareaBase/index.tsx
2371
2372
  import { forwardRef as forwardRef3 } from "react";
2372
2373
  import TextareaAutosize from "react-textarea-autosize";
2373
- import { Fragment as Fragment2, jsx as jsx40, jsxs as jsxs12 } from "react/jsx-runtime";
2374
+ import { Fragment as Fragment2, jsx as jsx41, jsxs as jsxs12 } from "react/jsx-runtime";
2374
2375
  var UPSCALE_RATIO = 16 / 14;
2375
2376
  var TextareaBase = forwardRef3(function TextareaBase2(props, ref) {
2376
2377
  return /* @__PURE__ */ jsxs12(Fragment2, {
2377
2378
  children: [
2378
- /* @__PURE__ */ jsx40("style", {
2379
+ /* @__PURE__ */ jsx41("style", {
2379
2380
  children: ".superinterface-textarea { min-height: inherit; height: 30px; }\n.superinterface-textarea::placeholder { color: var(--gray-a10); }"
2380
2381
  }),
2381
- /* @__PURE__ */ jsx40(TextareaAutosize, _object_spread({
2382
+ /* @__PURE__ */ jsx41(TextareaAutosize, _object_spread({
2382
2383
  ref: ref,
2383
2384
  className: "rt-reset superinterface-textarea",
2384
2385
  style: {
@@ -2403,20 +2404,20 @@ var TextareaBase = forwardRef3(function TextareaBase2(props, ref) {
2403
2404
  // src/components/threads/Thread/MessageForm/Field/index.tsx
2404
2405
  import { useFormContext } from "react-hook-form";
2405
2406
  import { Container as Container2, Flex as Flex13 } from "@radix-ui/themes";
2406
- import { jsx as jsx41 } from "react/jsx-runtime";
2407
+ import { jsx as jsx42 } from "react/jsx-runtime";
2407
2408
  var Root3 = function(param) {
2408
2409
  var children = param.children;
2409
2410
  var _useFormContext = useFormContext(), errors = _useFormContext.formState.errors;
2410
- return /* @__PURE__ */ jsx41(Container2, {
2411
+ return /* @__PURE__ */ jsx42(Container2, {
2411
2412
  size: "2",
2412
2413
  flexGrow: "0",
2413
- children: /* @__PURE__ */ jsx41(Flex13, {
2414
+ children: /* @__PURE__ */ jsx42(Flex13, {
2414
2415
  direction: "column",
2415
2416
  flexShrink: "0",
2416
- children: /* @__PURE__ */ jsx41(Flex13, {
2417
+ children: /* @__PURE__ */ jsx42(Flex13, {
2417
2418
  direction: "column",
2418
2419
  flexShrink: "0",
2419
- children: /* @__PURE__ */ jsx41(Flex13, {
2420
+ children: /* @__PURE__ */ jsx42(Flex13, {
2420
2421
  style: _object_spread({
2421
2422
  borderRadius: "var(--radius-2)",
2422
2423
  borderWidth: "1px",
@@ -2456,7 +2457,7 @@ var Control = function() {
2456
2457
  isDisabledPrevious,
2457
2458
  textareaProps
2458
2459
  ]);
2459
- return /* @__PURE__ */ jsx41(TextareaBase, _object_spread_props(_object_spread({
2460
+ return /* @__PURE__ */ jsx42(TextareaBase, _object_spread_props(_object_spread({
2460
2461
  minRows: 1,
2461
2462
  placeholder: "Message ".concat(assistantNameContext, "..."),
2462
2463
  disabled: isDisabled,
@@ -2480,26 +2481,26 @@ var Field = {
2480
2481
  Control: Control
2481
2482
  };
2482
2483
  // src/components/threads/Thread/MessageForm/index.tsx
2483
- import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
2484
+ import { jsx as jsx43, jsxs as jsxs13 } from "react/jsx-runtime";
2484
2485
  var MessageForm = function() {
2485
- return /* @__PURE__ */ jsx42(Root2, {
2486
+ return /* @__PURE__ */ jsx43(Root2, {
2486
2487
  children: /* @__PURE__ */ jsxs13(Field.Root, {
2487
2488
  children: [
2488
- /* @__PURE__ */ jsx42(Text5, {
2489
+ /* @__PURE__ */ jsx43(Text5, {
2489
2490
  size: "2",
2490
2491
  style: {
2491
2492
  flexGrow: 1
2492
2493
  },
2493
- children: /* @__PURE__ */ jsx42(Flex14, {
2494
+ children: /* @__PURE__ */ jsx43(Flex14, {
2494
2495
  flexGrow: "1",
2495
2496
  direction: "column",
2496
- children: /* @__PURE__ */ jsx42(Field.Control, {})
2497
+ children: /* @__PURE__ */ jsx43(Field.Control, {})
2497
2498
  })
2498
2499
  }),
2499
- /* @__PURE__ */ jsx42(Flex14, {
2500
+ /* @__PURE__ */ jsx43(Flex14, {
2500
2501
  flexShrink: "0",
2501
2502
  align: "end",
2502
- children: /* @__PURE__ */ jsx42(Submit, {})
2503
+ children: /* @__PURE__ */ jsx43(Submit, {})
2503
2504
  })
2504
2505
  ]
2505
2506
  })
@@ -2511,12 +2512,12 @@ MessageForm.Submit = Submit;
2511
2512
  // src/components/threads/Thread/Root/index.tsx
2512
2513
  import { Flex as Flex15 } from "@radix-ui/themes";
2513
2514
  // src/components/runs/PollingProvider/index.tsx
2514
- import { useState as useState2 } from "react";
2515
- import { jsx as jsx43 } from "react/jsx-runtime";
2515
+ import { useState as useState3 } from "react";
2516
+ import { jsx as jsx44 } from "react/jsx-runtime";
2516
2517
  var PollingProvider = function(param) {
2517
2518
  var children = param.children;
2518
- var _useState2 = _sliced_to_array(useState2(false), 2), isPollRefetching = _useState2[0], setIsPollRefetching = _useState2[1];
2519
- return /* @__PURE__ */ jsx43(PollingContext.Provider, {
2519
+ var _useState3 = _sliced_to_array(useState3(false), 2), isPollRefetching = _useState3[0], setIsPollRefetching = _useState3[1];
2520
+ return /* @__PURE__ */ jsx44(PollingContext.Provider, {
2520
2521
  value: {
2521
2522
  isPollRefetching: isPollRefetching,
2522
2523
  setIsPollRefetching: setIsPollRefetching
@@ -2525,20 +2526,20 @@ var PollingProvider = function(param) {
2525
2526
  });
2526
2527
  };
2527
2528
  // src/components/threads/Thread/Provider/index.tsx
2528
- import { jsx as jsx44 } from "react/jsx-runtime";
2529
+ import { jsx as jsx45 } from "react/jsx-runtime";
2529
2530
  var Provider2 = function(args) {
2530
- return /* @__PURE__ */ jsx44(PollingProvider, {
2531
- children: /* @__PURE__ */ jsx44(SuperinterfaceProvider, _object_spread({}, args))
2531
+ return /* @__PURE__ */ jsx45(PollingProvider, {
2532
+ children: /* @__PURE__ */ jsx45(SuperinterfaceProvider, _object_spread({}, args))
2532
2533
  });
2533
2534
  };
2534
2535
  // src/components/threads/Thread/Root/index.tsx
2535
- import { jsx as jsx45 } from "react/jsx-runtime";
2536
+ import { jsx as jsx46 } from "react/jsx-runtime";
2536
2537
  var Root4 = function(_param) {
2537
2538
  var children = _param.children, rest = _object_without_properties(_param, [
2538
2539
  "children"
2539
2540
  ]);
2540
- return /* @__PURE__ */ jsx45(Provider2, _object_spread_props(_object_spread({}, rest), {
2541
- children: /* @__PURE__ */ jsx45(Flex15, {
2541
+ return /* @__PURE__ */ jsx46(Provider2, _object_spread_props(_object_spread({}, rest), {
2542
+ children: /* @__PURE__ */ jsx46(Flex15, {
2542
2543
  direction: "column",
2543
2544
  flexGrow: "1",
2544
2545
  children: children
@@ -2546,12 +2547,12 @@ var Root4 = function(_param) {
2546
2547
  }));
2547
2548
  };
2548
2549
  // src/components/threads/Thread/index.tsx
2549
- import { jsx as jsx46, jsxs as jsxs14 } from "react/jsx-runtime";
2550
+ import { jsx as jsx47, jsxs as jsxs14 } from "react/jsx-runtime";
2550
2551
  var Thread = function(props) {
2551
2552
  return /* @__PURE__ */ jsxs14(Root4, _object_spread_props(_object_spread({}, props), {
2552
2553
  children: [
2553
- /* @__PURE__ */ jsx46(Messages, {}),
2554
- /* @__PURE__ */ jsx46(MessageForm, {})
2554
+ /* @__PURE__ */ jsx47(Messages, {}),
2555
+ /* @__PURE__ */ jsx47(MessageForm, {})
2555
2556
  ]
2556
2557
  }));
2557
2558
  };
@@ -2563,10 +2564,8 @@ import { useContext as useContext11 } from "react";
2563
2564
  var useMessageContext = function() {
2564
2565
  return useContext11(MessageContext);
2565
2566
  };
2566
- // src/components/threads/ThreadDialog/Root/index.tsx
2567
- import { Flex as Flex17 } from "@radix-ui/themes";
2568
2567
  // src/components/threads/ThreadDialog/Provider/index.tsx
2569
- import { useState as useState3 } from "react";
2568
+ import { useState as useState4 } from "react";
2570
2569
  // src/contexts/threads/ThreadDialogContext/index.ts
2571
2570
  import { createContext as createContext10 } from "react";
2572
2571
  var ThreadDialogContext = createContext10({
@@ -2579,12 +2578,12 @@ var useThreadDialogContext = function() {
2579
2578
  return useContext12(ThreadDialogContext);
2580
2579
  };
2581
2580
  // src/components/threads/ThreadDialog/Provider/index.tsx
2582
- import { jsx as jsx47 } from "react/jsx-runtime";
2581
+ import { jsx as jsx48 } from "react/jsx-runtime";
2583
2582
  var Provider3 = function(param) {
2584
2583
  var children = param.children;
2585
2584
  var threadDialogContext = useThreadDialogContext();
2586
- var _useState3 = _sliced_to_array(useState3(threadDialogContext.isOpen), 2), isOpen = _useState3[0], setIsOpen = _useState3[1];
2587
- return /* @__PURE__ */ jsx47(ThreadDialogContext.Provider, {
2585
+ var _useState4 = _sliced_to_array(useState4(threadDialogContext.isOpen), 2), isOpen = _useState4[0], setIsOpen = _useState4[1];
2586
+ return /* @__PURE__ */ jsx48(ThreadDialogContext.Provider, {
2588
2587
  value: {
2589
2588
  isOpen: isOpen,
2590
2589
  setIsOpen: setIsOpen
@@ -2593,31 +2592,31 @@ var Provider3 = function(param) {
2593
2592
  });
2594
2593
  };
2595
2594
  // src/components/toasts/ToastsProvider/index.tsx
2596
- import { useState as useState4, useCallback as useCallback2 } from "react";
2595
+ import { useState as useState5, useCallback as useCallback2 } from "react";
2597
2596
  import * as Toast2 from "@radix-ui/react-toast";
2598
2597
  // src/components/toasts/ToastsProvider/CustomToast.tsx
2599
2598
  import * as Toast from "@radix-ui/react-toast";
2600
2599
  import { Card, Text as Text6, Flex as Flex16 } from "@radix-ui/themes";
2601
2600
  import { CheckCircledIcon as CheckCircledIcon2, CrossCircledIcon } from "@radix-ui/react-icons";
2602
- import { jsx as jsx48, jsxs as jsxs15 } from "react/jsx-runtime";
2601
+ import { jsx as jsx49, jsxs as jsxs15 } from "react/jsx-runtime";
2603
2602
  var CustomToast = function(param) {
2604
2603
  var toast = param.toast;
2605
- return /* @__PURE__ */ jsx48(Toast.Root, {
2606
- children: /* @__PURE__ */ jsx48(Card, {
2607
- children: /* @__PURE__ */ jsx48(Toast.Title, {
2604
+ return /* @__PURE__ */ jsx49(Toast.Root, {
2605
+ children: /* @__PURE__ */ jsx49(Card, {
2606
+ children: /* @__PURE__ */ jsx49(Toast.Title, {
2608
2607
  children: /* @__PURE__ */ jsxs15(Flex16, {
2609
2608
  children: [
2610
- /* @__PURE__ */ jsx48(Flex16, {
2609
+ /* @__PURE__ */ jsx49(Flex16, {
2611
2610
  pr: "2",
2612
2611
  height: "14px",
2613
2612
  align: "center",
2614
- children: toast.type === "success" ? /* @__PURE__ */ jsx48(CheckCircledIcon2, {
2613
+ children: toast.type === "success" ? /* @__PURE__ */ jsx49(CheckCircledIcon2, {
2615
2614
  color: "var(--mint-9)"
2616
- }) : /* @__PURE__ */ jsx48(CrossCircledIcon, {
2615
+ }) : /* @__PURE__ */ jsx49(CrossCircledIcon, {
2617
2616
  color: "var(--red-9)"
2618
2617
  })
2619
2618
  }),
2620
- /* @__PURE__ */ jsx48(Text6, {
2619
+ /* @__PURE__ */ jsx49(Text6, {
2621
2620
  weight: "medium",
2622
2621
  size: "1",
2623
2622
  children: toast.message
@@ -2629,10 +2628,10 @@ var CustomToast = function(param) {
2629
2628
  });
2630
2629
  };
2631
2630
  // src/components/toasts/ToastsProvider/index.tsx
2632
- import { jsx as jsx49, jsxs as jsxs16 } from "react/jsx-runtime";
2631
+ import { jsx as jsx50, jsxs as jsxs16 } from "react/jsx-runtime";
2633
2632
  var ToastsProvider = function(param) {
2634
2633
  var children = param.children;
2635
- var _useState4 = _sliced_to_array(useState4([]), 2), toasts = _useState4[0], setToasts = _useState4[1];
2634
+ var _useState5 = _sliced_to_array(useState5([]), 2), toasts = _useState5[0], setToasts = _useState5[1];
2636
2635
  var addToast = useCallback2(function(toast) {
2637
2636
  return setToasts(function(prevToasts) {
2638
2637
  return _to_consumable_array(prevToasts).concat([
@@ -2640,7 +2639,7 @@ var ToastsProvider = function(param) {
2640
2639
  ]);
2641
2640
  });
2642
2641
  }, []);
2643
- return /* @__PURE__ */ jsx49(ToastsContext.Provider, {
2642
+ return /* @__PURE__ */ jsx50(ToastsContext.Provider, {
2644
2643
  value: {
2645
2644
  toasts: toasts,
2646
2645
  addToast: addToast
@@ -2649,11 +2648,11 @@ var ToastsProvider = function(param) {
2649
2648
  children: [
2650
2649
  children,
2651
2650
  Array.from(toasts).map(function(toast, index) {
2652
- return /* @__PURE__ */ jsx49(CustomToast, {
2651
+ return /* @__PURE__ */ jsx50(CustomToast, {
2653
2652
  toast: toast
2654
2653
  }, index);
2655
2654
  }),
2656
- /* @__PURE__ */ jsx49(Toast2.Viewport, {
2655
+ /* @__PURE__ */ jsx50(Toast2.Viewport, {
2657
2656
  style: {
2658
2657
  position: "absolute",
2659
2658
  bottom: 0,
@@ -2675,34 +2674,26 @@ var ToastsProvider = function(param) {
2675
2674
  });
2676
2675
  };
2677
2676
  // src/components/threads/ThreadDialog/Root/index.tsx
2678
- import { jsx as jsx50 } from "react/jsx-runtime";
2677
+ import { jsx as jsx51 } from "react/jsx-runtime";
2679
2678
  var Root6 = function(param) {
2680
2679
  var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
2681
- return /* @__PURE__ */ jsx50(ToastsProvider, {
2682
- children: /* @__PURE__ */ jsx50(Provider3, {
2683
- children: /* @__PURE__ */ jsx50(Flex17, {
2684
- direction: "column",
2685
- justify: "end",
2686
- align: "end",
2687
- position: "fixed",
2688
- style: _object_spread({
2689
- bottom: "24px",
2690
- right: "24px",
2691
- top: "24px",
2692
- zIndex: 9999999999
2693
- }, style),
2694
- children: children
2695
- })
2680
+ return /* @__PURE__ */ jsx51(ToastsProvider, {
2681
+ children: /* @__PURE__ */ jsx51(Provider3, {
2682
+ children: children
2696
2683
  })
2697
2684
  });
2698
2685
  };
2699
2686
  // src/components/threads/ThreadDialog/Trigger/index.tsx
2700
- import { Flex as Flex18 } from "@radix-ui/themes";
2701
- import { jsx as jsx51 } from "react/jsx-runtime";
2687
+ import { Flex as Flex17 } from "@radix-ui/themes";
2688
+ import { jsx as jsx52 } from "react/jsx-runtime";
2702
2689
  var Trigger = function(param) {
2703
- var children = param.children;
2704
- var setIsOpen = useThreadDialogContext().setIsOpen;
2705
- return /* @__PURE__ */ jsx51(Flex18, {
2690
+ var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
2691
+ var _useThreadDialogContext = useThreadDialogContext(), setIsOpen = _useThreadDialogContext.setIsOpen, isOpen = _useThreadDialogContext.isOpen;
2692
+ return /* @__PURE__ */ jsx52(Flex17, {
2693
+ display: {
2694
+ initial: isOpen ? "none" : "flex",
2695
+ sm: "flex"
2696
+ },
2706
2697
  onClick: function() {
2707
2698
  return setIsOpen(function(prev) {
2708
2699
  return !prev;
@@ -2710,66 +2701,143 @@ var Trigger = function(param) {
2710
2701
  },
2711
2702
  direction: "column",
2712
2703
  flexShrink: "0",
2704
+ justify: "end",
2705
+ align: "end",
2706
+ position: "fixed",
2707
+ bottom: "24px",
2708
+ right: "24px",
2709
+ style: _object_spread({
2710
+ zIndex: 9999999999
2711
+ }, style),
2713
2712
  children: children
2714
2713
  });
2715
2714
  };
2716
2715
  // src/components/threads/ThreadDialog/Button/index.tsx
2717
- import { IconButton } from "@radix-ui/themes";
2716
+ import { IconButton as IconButton2 } from "@radix-ui/themes";
2718
2717
  import { ChatBubbleIcon } from "@radix-ui/react-icons";
2719
- import { jsx as jsx52 } from "react/jsx-runtime";
2720
- var Button3 = function() {
2721
- return /* @__PURE__ */ jsx52(IconButton, {
2718
+ import { jsx as jsx53 } from "react/jsx-runtime";
2719
+ var Button2 = function() {
2720
+ return /* @__PURE__ */ jsx53(IconButton2, {
2722
2721
  size: "4",
2723
2722
  radius: "full",
2724
- children: /* @__PURE__ */ jsx52(ChatBubbleIcon, {})
2723
+ children: /* @__PURE__ */ jsx53(ChatBubbleIcon, {})
2725
2724
  });
2726
2725
  };
2727
2726
  // src/components/threads/ThreadDialog/Content/index.tsx
2728
2727
  import { Card as Card2, Inset, Flex as Flex19 } from "@radix-ui/themes";
2729
- import { jsx as jsx53, jsxs as jsxs17 } from "react/jsx-runtime";
2728
+ // src/components/threads/ThreadDialog/Close/index.tsx
2729
+ import { Cross1Icon } from "@radix-ui/react-icons";
2730
+ import { IconButton as IconButton3, Flex as Flex18 } from "@radix-ui/themes";
2731
+ import { jsx as jsx54 } from "react/jsx-runtime";
2732
+ var Close = function() {
2733
+ var _useThreadDialogContext = useThreadDialogContext(), setIsOpen = _useThreadDialogContext.setIsOpen, isOpen = _useThreadDialogContext.isOpen;
2734
+ return /* @__PURE__ */ jsx54(Flex18, {
2735
+ display: {
2736
+ initial: isOpen ? "flex" : "none",
2737
+ sm: "none"
2738
+ },
2739
+ onClick: function() {
2740
+ return setIsOpen(function(prev) {
2741
+ return !prev;
2742
+ });
2743
+ },
2744
+ direction: "column",
2745
+ flexShrink: "0",
2746
+ justify: "end",
2747
+ align: "end",
2748
+ position: "absolute",
2749
+ top: "24px",
2750
+ right: "24px",
2751
+ style: {
2752
+ zIndex: 9999999999
2753
+ },
2754
+ children: /* @__PURE__ */ jsx54(IconButton3, {
2755
+ size: "2",
2756
+ variant: "soft",
2757
+ children: /* @__PURE__ */ jsx54(Cross1Icon, {})
2758
+ })
2759
+ });
2760
+ };
2761
+ // src/components/threads/ThreadDialog/Content/index.tsx
2762
+ import { jsx as jsx55, jsxs as jsxs17 } from "react/jsx-runtime";
2730
2763
  var Root7 = function(param) {
2731
- var children = param.children;
2764
+ var children = param.children, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
2732
2765
  var isOpen = useThreadDialogContext().isOpen;
2733
2766
  if (!isOpen) return null;
2734
- return /* @__PURE__ */ jsx53(Card2, {
2735
- mb: "3",
2736
- style: {
2737
- display: "flex",
2738
- flexGrow: 1,
2739
- width: "100vw",
2740
- maxWidth: "400px",
2741
- maxHeight: "720px"
2767
+ return /* @__PURE__ */ jsx55(Flex19, {
2768
+ direction: "column",
2769
+ justify: "end",
2770
+ position: "fixed",
2771
+ bottom: {
2772
+ initial: "0",
2773
+ sm: "72px"
2742
2774
  },
2743
- children: /* @__PURE__ */ jsx53(Inset, {
2744
- clip: "padding-box",
2745
- side: "all",
2746
- pb: "current",
2775
+ right: {
2776
+ initial: "0",
2777
+ sm: "24px"
2778
+ },
2779
+ top: {
2780
+ initial: "0",
2781
+ sm: "24px"
2782
+ },
2783
+ maxHeight: {
2784
+ initial: void 0,
2785
+ sm: "720px"
2786
+ },
2787
+ maxWidth: {
2788
+ initial: void 0,
2789
+ sm: "400px"
2790
+ },
2791
+ width: "100%",
2792
+ style: _object_spread({
2793
+ zIndex: 9999999999
2794
+ }, style),
2795
+ children: /* @__PURE__ */ jsxs17(Card2, {
2796
+ mb: {
2797
+ initial: void 0,
2798
+ sm: "3"
2799
+ },
2747
2800
  style: {
2801
+ position: "relative",
2748
2802
  display: "flex",
2749
2803
  flexGrow: 1
2750
2804
  },
2751
- children: children
2805
+ children: [
2806
+ /* @__PURE__ */ jsx55(Inset, {
2807
+ clip: "padding-box",
2808
+ side: "all",
2809
+ pb: "current",
2810
+ style: {
2811
+ display: "flex",
2812
+ flexGrow: 1
2813
+ },
2814
+ children: children
2815
+ }),
2816
+ /* @__PURE__ */ jsx55(Close, {})
2817
+ ]
2752
2818
  })
2753
2819
  });
2754
2820
  };
2755
- var Content4 = function() {
2756
- return /* @__PURE__ */ jsx53(Root7, {
2821
+ var Content4 = function(param) {
2822
+ var _param_style = param.style, style = _param_style === void 0 ? {} : _param_style;
2823
+ return /* @__PURE__ */ jsx55(Root7, {
2824
+ style: style,
2757
2825
  children: /* @__PURE__ */ jsxs17(Thread.Root, {
2758
2826
  children: [
2759
- /* @__PURE__ */ jsx53(Thread.Messages, {
2827
+ /* @__PURE__ */ jsx55(Thread.Messages, {
2760
2828
  style: {
2761
2829
  paddingTop: "var(--space-5)",
2762
2830
  paddingRight: "var(--space-5)",
2763
2831
  paddingLeft: "var(--space-5)"
2764
2832
  }
2765
2833
  }),
2766
- /* @__PURE__ */ jsx53(Flex19, {
2834
+ /* @__PURE__ */ jsx55(Flex19, {
2767
2835
  direction: "column",
2768
2836
  pl: "5",
2769
2837
  pr: "5",
2770
2838
  pb: "3",
2771
2839
  flexShrink: "0",
2772
- children: /* @__PURE__ */ jsx53(Thread.MessageForm, {})
2840
+ children: /* @__PURE__ */ jsx55(Thread.MessageForm, {})
2773
2841
  })
2774
2842
  ]
2775
2843
  })
@@ -2777,20 +2845,20 @@ var Content4 = function() {
2777
2845
  };
2778
2846
  Content4.Root = Root7;
2779
2847
  // src/components/threads/ThreadDialog/index.tsx
2780
- import { jsx as jsx54, jsxs as jsxs18 } from "react/jsx-runtime";
2848
+ import { jsx as jsx56, jsxs as jsxs18 } from "react/jsx-runtime";
2781
2849
  var ThreadDialog = function() {
2782
2850
  return /* @__PURE__ */ jsxs18(Root6, {
2783
2851
  children: [
2784
- /* @__PURE__ */ jsx54(Content4, {}),
2785
- /* @__PURE__ */ jsx54(Trigger, {
2786
- children: /* @__PURE__ */ jsx54(Button3, {})
2852
+ /* @__PURE__ */ jsx56(Content4, {}),
2853
+ /* @__PURE__ */ jsx56(Trigger, {
2854
+ children: /* @__PURE__ */ jsx56(Button2, {})
2787
2855
  })
2788
2856
  ]
2789
2857
  });
2790
2858
  };
2791
2859
  ThreadDialog.Root = Root6;
2792
2860
  ThreadDialog.Trigger = Trigger;
2793
- ThreadDialog.Button = Button3;
2861
+ ThreadDialog.Button = Button2;
2794
2862
  ThreadDialog.Content = Content4;
2795
2863
  // src/components/threads/AudioThread/Root/index.tsx
2796
2864
  import "regenerator-runtime/runtime";
@@ -2892,18 +2960,18 @@ var useStatus = function(param) {
2892
2960
  // src/hooks/audioThreads/useRecorder/index.ts
2893
2961
  import dayjs from "dayjs";
2894
2962
  import { useAudioCapture } from "use-audio-capture";
2895
- import { useMemo as useMemo12, useRef as useRef4, useState as useState5, useCallback as useCallback3, useEffect as useEffect7 } from "react";
2963
+ import { useMemo as useMemo12, useRef as useRef4, useState as useState6, useCallback as useCallback3, useEffect as useEffect7 } from "react";
2896
2964
  import { useAudioPlayer } from "react-use-audio-player";
2897
2965
  import { useInterval as useInterval2 } from "react-use";
2898
2966
  var useRecorder = function(param) {
2899
2967
  var isStopOnSilence = param.isStopOnSilence, onStart = param.onStart, onStop = param.onStop;
2900
- var _useState5 = _sliced_to_array(useState5(null), 2), silenceStart = _useState5[0], setSilenceStart = _useState5[1];
2901
- var _useState51 = _sliced_to_array(useState5(null), 2), noiseStart = _useState51[0], setNoiseStart = _useState51[1];
2902
- var _useState52 = _sliced_to_array(useState5(null), 2), mediaStream = _useState52[0], setMediaStream = _useState52[1];
2903
- var _useState53 = _sliced_to_array(useState5("idle"), 2), status = _useState53[0], setStatus = _useState53[1];
2968
+ var _useState6 = _sliced_to_array(useState6(null), 2), silenceStart = _useState6[0], setSilenceStart = _useState6[1];
2969
+ var _useState61 = _sliced_to_array(useState6(null), 2), noiseStart = _useState61[0], setNoiseStart = _useState61[1];
2970
+ var _useState62 = _sliced_to_array(useState6(null), 2), mediaStream = _useState62[0], setMediaStream = _useState62[1];
2971
+ var _useState63 = _sliced_to_array(useState6("idle"), 2), status = _useState63[0], setStatus = _useState63[1];
2904
2972
  var startAudioPlayer = useAudioPlayer();
2905
2973
  var endAudioPlayer = useAudioPlayer();
2906
- var _useState54 = _sliced_to_array(useState5(false), 2), isLoaded = _useState54[0], setIsLoaded = _useState54[1];
2974
+ var _useState64 = _sliced_to_array(useState6(false), 2), isLoaded = _useState64[0], setIsLoaded = _useState64[1];
2907
2975
  useEffect7(function() {
2908
2976
  if (isLoaded) return;
2909
2977
  setIsLoaded(true);
@@ -2962,7 +3030,7 @@ var useRecorder = function(param) {
2962
3030
  setNoiseStart(null);
2963
3031
  }
2964
3032
  });
2965
- var _useState55 = _sliced_to_array(useState5(null), 2), audioEngine = _useState55[0], setAudioEngine = _useState55[1];
3033
+ var _useState65 = _sliced_to_array(useState6(null), 2), audioEngine = _useState65[0], setAudioEngine = _useState65[1];
2966
3034
  var isInited = useRef4(false);
2967
3035
  useEffect7(function() {
2968
3036
  if (!mediaStream) return;
@@ -3040,7 +3108,7 @@ var useRecorder = function(param) {
3040
3108
  });
3041
3109
  };
3042
3110
  // src/hooks/audioThreads/useMessageAudio/index.ts
3043
- import { useMemo as useMemo13, useRef as useRef5, useState as useState6, useEffect as useEffect8 } from "react";
3111
+ import { useMemo as useMemo13, useRef as useRef5, useState as useState7, useEffect as useEffect8 } from "react";
3044
3112
  import { Howler } from "howler";
3045
3113
  import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
3046
3114
  // src/hooks/audioThreads/useMessageAudio/lib/input.ts
@@ -3066,7 +3134,7 @@ var isHtmlAudioSupported = !unsupportedNames.includes(((_detect = detect()) ===
3066
3134
  // src/hooks/audioThreads/useMessageAudio/index.ts
3067
3135
  var useMessageAudio = function(param) {
3068
3136
  var onEnd = param.onEnd;
3069
- var _useState6 = _sliced_to_array(useState6([]), 2), playedMessageIds = _useState6[0], setPlayedMessageIds = _useState6[1];
3137
+ var _useState7 = _sliced_to_array(useState7([]), 2), playedMessages = _useState7[0], setPlayedMessages = _useState7[1];
3070
3138
  var audioPlayer = useAudioPlayer2();
3071
3139
  var superinterfaceContext = useSuperinterfaceContext();
3072
3140
  var latestMessageProps = useLatestMessage();
@@ -3074,14 +3142,19 @@ var useMessageAudio = function(param) {
3074
3142
  if (audioPlayer.playing) return;
3075
3143
  if (!latestMessageProps.latestMessage) return;
3076
3144
  if (latestMessageProps.latestMessage.role !== "assistant") return;
3077
- if (playedMessageIds.includes(latestMessageProps.latestMessage.id)) return;
3145
+ if (playedMessages.find(function(pm) {
3146
+ return pm.id === latestMessageProps.latestMessage.id || isOptimistic({
3147
+ id: pm.id
3148
+ }) && pm.content === latestMessageProps.latestMessage.content;
3149
+ })) return;
3150
+ if (playedMessages.includes(latestMessageProps.latestMessage)) return;
3078
3151
  var input2 = input({
3079
3152
  message: latestMessageProps.latestMessage
3080
3153
  });
3081
3154
  if (!input2) return;
3082
- setPlayedMessageIds(function(prev) {
3155
+ setPlayedMessages(function(prev) {
3083
3156
  return _to_consumable_array(prev).concat([
3084
- latestMessageProps.latestMessage.id
3157
+ latestMessageProps.latestMessage
3085
3158
  ]);
3086
3159
  });
3087
3160
  audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/tts?input=").concat(input2), {
@@ -3101,11 +3174,11 @@ var useMessageAudio = function(param) {
3101
3174
  superinterfaceContext,
3102
3175
  latestMessageProps,
3103
3176
  audioPlayer,
3104
- playedMessageIds,
3177
+ playedMessages,
3105
3178
  onEnd
3106
3179
  ]);
3107
3180
  var isInited = useRef5(false);
3108
- var _useState61 = _sliced_to_array(useState6(null), 2), audioEngine = _useState61[0], setAudioEngine = _useState61[1];
3181
+ var _useState71 = _sliced_to_array(useState7(null), 2), audioEngine = _useState71[0], setAudioEngine = _useState71[1];
3109
3182
  useEffect8(function() {
3110
3183
  if (!audioPlayer.playing) return;
3111
3184
  if (isInited.current) return;
@@ -3141,7 +3214,7 @@ var useMessageAudio = function(param) {
3141
3214
  });
3142
3215
  };
3143
3216
  // src/components/threads/AudioThread/Root/index.tsx
3144
- import { jsx as jsx55 } from "react/jsx-runtime";
3217
+ import { jsx as jsx57 } from "react/jsx-runtime";
3145
3218
  var Root8 = function(param) {
3146
3219
  var children = param.children;
3147
3220
  useLifecycle();
@@ -3201,73 +3274,47 @@ var Root8 = function(param) {
3201
3274
  createMessageProps: createMessageProps,
3202
3275
  messageAudioProps: messageAudioProps
3203
3276
  }).status;
3204
- return /* @__PURE__ */ jsx55(AudioThreadContext.Provider, {
3277
+ return /* @__PURE__ */ jsx57(AudioThreadContext.Provider, {
3205
3278
  value: {
3206
3279
  status: status,
3207
3280
  recorderProps: recorderProps,
3208
3281
  messageAudioProps: messageAudioProps
3209
3282
  },
3210
- children: /* @__PURE__ */ jsx55(Flex20, {
3283
+ children: /* @__PURE__ */ jsx57(Flex20, {
3211
3284
  direction: "column",
3212
3285
  flexGrow: "1",
3213
- p: "5",
3286
+ p: "9",
3214
3287
  children: children
3215
3288
  })
3216
3289
  });
3217
3290
  };
3218
3291
  // src/components/threads/AudioThread/Visualization/index.tsx
3219
- import { Flex as Flex21 } from "@radix-ui/themes";
3292
+ import { Flex as Flex22 } from "@radix-ui/themes";
3220
3293
  // src/hooks/threads/useAudioThreadContext/index.ts
3221
3294
  import { useContext as useContext13 } from "react";
3222
3295
  var useAudioThreadContext = function() {
3223
3296
  return useContext13(AudioThreadContext);
3224
3297
  };
3225
- // src/components/threads/AudioThread/Visualization/index.tsx
3226
- import { jsx as jsx56 } from "react/jsx-runtime";
3227
- var Visualization = function() {
3228
- var audioThreadContext = useAudioThreadContext();
3229
- return /* @__PURE__ */ jsx56(Flex21, {
3230
- direction: "column",
3231
- align: "center",
3232
- justify: "center",
3233
- mb: "3",
3234
- flexGrow: "1",
3235
- children: /* @__PURE__ */ jsx56(Flex21, {
3236
- align: "center",
3237
- justify: "center",
3238
- height: "200px",
3239
- width: "200px",
3240
- style: {
3241
- backgroundColor: "var(--".concat(audioThreadContext.status === "playing" ? "mint" : "gray", "-4)"),
3242
- borderRadius: "9999px"
3243
- }
3244
- })
3245
- });
3246
- };
3247
- // src/components/threads/AudioThread/Form/index.tsx
3248
- import { SpeakerModerateIcon } from "@radix-ui/react-icons";
3249
- import { Flex as Flex24 } from "@radix-ui/themes";
3250
- // src/components/threads/AudioThread/Form/Visualizer/index.tsx
3251
- import _7 from "lodash";
3252
- import { Flex as Flex22, Grid } from "@radix-ui/themes";
3253
- import { useState as useState7, useEffect as useEffect9, useCallback as useCallback4 } from "react";
3298
+ // src/components/threads/AudioThread/BarsVisualizer/index.tsx
3299
+ import _6 from "lodash";
3300
+ import { Flex as Flex21, Grid } from "@radix-ui/themes";
3301
+ import { useState as useState8, useEffect as useEffect9, useCallback as useCallback4 } from "react";
3254
3302
  import { cluster } from "radash";
3255
- import { jsx as jsx57 } from "react/jsx-runtime";
3303
+ import { jsx as jsx58 } from "react/jsx-runtime";
3256
3304
  var barCount = 4;
3257
- var Visualizer = function() {
3258
- var audioThreadContext = useAudioThreadContext();
3259
- var visualizationAnalyser = audioThreadContext.recorderProps.visualizationAnalyser;
3260
- var _useState7 = _sliced_to_array(useState7(function() {
3305
+ var BarsVisualizer = function(param) {
3306
+ var visualizationAnalyser = param.visualizationAnalyser, color = param.color, height = param.height, barWidth = param.barWidth;
3307
+ var _useState8 = _sliced_to_array(useState8(function() {
3261
3308
  return new AudioContext().createAnalyser();
3262
- }), 1), emptyVisualizer = _useState7[0];
3263
- var _useState71 = _sliced_to_array(useState7([]), 2), barHeights = _useState71[0], setBarHeights = _useState71[1];
3309
+ }), 1), emptyVisualizer = _useState8[0];
3310
+ var _useState81 = _sliced_to_array(useState8([]), 2), barHeights = _useState81[0], setBarHeights = _useState81[1];
3264
3311
  var draw = useCallback4(function(param) {
3265
3312
  var visualizationAnalyser2 = param.visualizationAnalyser;
3266
3313
  var frequencyData = new Uint8Array(visualizationAnalyser2.frequencyBinCount / 15);
3267
3314
  visualizationAnalyser2.getByteFrequencyData(frequencyData);
3268
3315
  var clusteredFrequencyData = cluster(frequencyData, frequencyData.length / barCount);
3269
3316
  setBarHeights(clusteredFrequencyData.map(function(frequencyDataCluster) {
3270
- return _7.mean(frequencyDataCluster) / 255 * 100;
3317
+ return _6.mean(frequencyDataCluster) / 255 * 100;
3271
3318
  }));
3272
3319
  requestAnimationFrame(function() {
3273
3320
  return draw({
@@ -3284,7 +3331,7 @@ var Visualizer = function() {
3284
3331
  visualizationAnalyser,
3285
3332
  emptyVisualizer
3286
3333
  ]);
3287
- return /* @__PURE__ */ jsx57(Grid, {
3334
+ return /* @__PURE__ */ jsx58(Grid, {
3288
3335
  columns: "".concat(barCount),
3289
3336
  gap: "1",
3290
3337
  width: "auto",
@@ -3293,18 +3340,18 @@ var Visualizer = function() {
3293
3340
  gridTemplateColumns: "repeat(4, minmax(0, 1fr))"
3294
3341
  },
3295
3342
  children: barHeights.map(function(barHeight, index) {
3296
- return /* @__PURE__ */ jsx57(Flex22, {
3343
+ return /* @__PURE__ */ jsx58(Flex21, {
3297
3344
  direction: "column",
3298
3345
  align: "center",
3299
3346
  justify: "center",
3300
- height: "20px",
3301
- children: /* @__PURE__ */ jsx57(Flex22, {
3347
+ height: height,
3348
+ children: /* @__PURE__ */ jsx58(Flex21, {
3302
3349
  minHeight: "50%",
3303
3350
  maxHeight: "100%",
3304
3351
  height: "".concat(barHeight + 20, "%"),
3305
- width: "12px",
3352
+ width: barWidth,
3306
3353
  style: {
3307
- backgroundColor: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-11)"),
3354
+ backgroundColor: "var(--".concat(color, "-11)"),
3308
3355
  borderRadius: "var(--radius-6)"
3309
3356
  }
3310
3357
  })
@@ -3312,32 +3359,63 @@ var Visualizer = function() {
3312
3359
  })
3313
3360
  });
3314
3361
  };
3362
+ // src/components/threads/AudioThread/Visualization/index.tsx
3363
+ import { jsx as jsx59 } from "react/jsx-runtime";
3364
+ var Visualization = function() {
3365
+ var audioThreadContext = useAudioThreadContext();
3366
+ return /* @__PURE__ */ jsx59(Flex22, {
3367
+ direction: "column",
3368
+ align: "center",
3369
+ justify: "center",
3370
+ mb: "3",
3371
+ flexGrow: "1",
3372
+ children: /* @__PURE__ */ jsx59(Flex22, {
3373
+ align: "center",
3374
+ justify: "center",
3375
+ height: "200px",
3376
+ width: "200px",
3377
+ style: {
3378
+ backgroundColor: "var(--".concat(audioThreadContext.status === "playing" ? "mint" : "gray", "-4)"),
3379
+ borderRadius: "9999px"
3380
+ },
3381
+ children: /* @__PURE__ */ jsx59(BarsVisualizer, {
3382
+ visualizationAnalyser: audioThreadContext.messageAudioProps.visualizationAnalyser,
3383
+ color: audioThreadContext.status === "playing" ? "mint" : "gray",
3384
+ height: "40px",
3385
+ barWidth: "24px"
3386
+ })
3387
+ })
3388
+ });
3389
+ };
3390
+ // src/components/threads/AudioThread/Form/index.tsx
3391
+ import { SpeakerModerateIcon } from "@radix-ui/react-icons";
3392
+ import { Flex as Flex24 } from "@radix-ui/themes";
3315
3393
  // src/components/threads/AudioThread/Form/ActionButton/index.tsx
3316
- import { Flex as Flex23, IconButton as IconButton2, Tooltip } from "@radix-ui/themes";
3394
+ import { Flex as Flex23, IconButton as IconButton4, Tooltip } from "@radix-ui/themes";
3317
3395
  import { PauseIcon, ArrowUpIcon as ArrowUpIcon2, ResumeIcon } from "@radix-ui/react-icons";
3318
- import { jsx as jsx58, jsxs as jsxs19 } from "react/jsx-runtime";
3396
+ import { jsx as jsx60, jsxs as jsxs19 } from "react/jsx-runtime";
3319
3397
  var ActionButton = function() {
3320
3398
  var audioThreadContext = useAudioThreadContext();
3321
3399
  if (audioThreadContext.status === "recording") {
3322
3400
  return /* @__PURE__ */ jsxs19(Flex23, {
3323
3401
  align: "center",
3324
3402
  children: [
3325
- /* @__PURE__ */ jsx58(Flex23, {
3403
+ /* @__PURE__ */ jsx60(Flex23, {
3326
3404
  mr: "3",
3327
3405
  ml: "-7",
3328
- children: /* @__PURE__ */ jsx58(IconButton2, {
3406
+ children: /* @__PURE__ */ jsx60(IconButton4, {
3329
3407
  onClick: audioThreadContext.recorderProps.pause,
3330
3408
  color: "gray",
3331
3409
  radius: "full",
3332
3410
  size: "1",
3333
- children: /* @__PURE__ */ jsx58(PauseIcon, {})
3411
+ children: /* @__PURE__ */ jsx60(PauseIcon, {})
3334
3412
  })
3335
3413
  }),
3336
- /* @__PURE__ */ jsx58(Tooltip, {
3414
+ /* @__PURE__ */ jsx60(Tooltip, {
3337
3415
  open: true,
3338
3416
  content: "Send your message",
3339
3417
  side: "bottom",
3340
- children: /* @__PURE__ */ jsx58(IconButton2, {
3418
+ children: /* @__PURE__ */ jsx60(IconButton4, {
3341
3419
  onClick: audioThreadContext.recorderProps.stop,
3342
3420
  color: "gray",
3343
3421
  highContrast: true,
@@ -3346,14 +3424,14 @@ var ActionButton = function() {
3346
3424
  style: {
3347
3425
  border: "2px solid var(--gray-8)"
3348
3426
  },
3349
- children: /* @__PURE__ */ jsx58(ArrowUpIcon2, {})
3427
+ children: /* @__PURE__ */ jsx60(ArrowUpIcon2, {})
3350
3428
  })
3351
3429
  })
3352
3430
  ]
3353
3431
  });
3354
3432
  }
3355
3433
  if (audioThreadContext.status === "recorderPaused") {
3356
- return /* @__PURE__ */ jsx58(IconButton2, {
3434
+ return /* @__PURE__ */ jsx60(IconButton4, {
3357
3435
  onClick: audioThreadContext.recorderProps.resume,
3358
3436
  color: "red",
3359
3437
  radius: "full",
@@ -3361,11 +3439,11 @@ var ActionButton = function() {
3361
3439
  style: {
3362
3440
  border: "2px solid var(--gray-8)"
3363
3441
  },
3364
- children: /* @__PURE__ */ jsx58(ResumeIcon, {})
3442
+ children: /* @__PURE__ */ jsx60(ResumeIcon, {})
3365
3443
  });
3366
3444
  }
3367
3445
  if (audioThreadContext.status === "idle") {
3368
- return /* @__PURE__ */ jsx58(IconButton2, {
3446
+ return /* @__PURE__ */ jsx60(IconButton4, {
3369
3447
  onClick: function() {
3370
3448
  return audioThreadContext.recorderProps.start();
3371
3449
  },
@@ -3378,7 +3456,7 @@ var ActionButton = function() {
3378
3456
  });
3379
3457
  }
3380
3458
  if (audioThreadContext.status === "playing") {
3381
- return /* @__PURE__ */ jsx58(IconButton2, {
3459
+ return /* @__PURE__ */ jsx60(IconButton4, {
3382
3460
  onClick: function() {
3383
3461
  return audioThreadContext.messageAudioProps.pause();
3384
3462
  },
@@ -3388,11 +3466,11 @@ var ActionButton = function() {
3388
3466
  style: {
3389
3467
  border: "2px solid var(--gray-8)"
3390
3468
  },
3391
- children: /* @__PURE__ */ jsx58(PauseIcon, {})
3469
+ children: /* @__PURE__ */ jsx60(PauseIcon, {})
3392
3470
  });
3393
3471
  }
3394
3472
  if (audioThreadContext.status === "playerPaused") {
3395
- return /* @__PURE__ */ jsx58(IconButton2, {
3473
+ return /* @__PURE__ */ jsx60(IconButton4, {
3396
3474
  onClick: function() {
3397
3475
  return audioThreadContext.messageAudioProps.play();
3398
3476
  },
@@ -3402,10 +3480,10 @@ var ActionButton = function() {
3402
3480
  style: {
3403
3481
  border: "2px solid var(--gray-8)"
3404
3482
  },
3405
- children: /* @__PURE__ */ jsx58(ResumeIcon, {})
3483
+ children: /* @__PURE__ */ jsx60(ResumeIcon, {})
3406
3484
  });
3407
3485
  }
3408
- return /* @__PURE__ */ jsx58(IconButton2, {
3486
+ return /* @__PURE__ */ jsx60(IconButton4, {
3409
3487
  size: "4",
3410
3488
  color: "red",
3411
3489
  radius: "full",
@@ -3416,7 +3494,7 @@ var ActionButton = function() {
3416
3494
  });
3417
3495
  };
3418
3496
  // src/components/threads/AudioThread/Form/index.tsx
3419
- import { jsx as jsx59, jsxs as jsxs20 } from "react/jsx-runtime";
3497
+ import { jsx as jsx61, jsxs as jsxs20 } from "react/jsx-runtime";
3420
3498
  var Form = function() {
3421
3499
  var audioThreadContext = useAudioThreadContext();
3422
3500
  return /* @__PURE__ */ jsxs20(Flex24, {
@@ -3427,38 +3505,43 @@ var Form = function() {
3427
3505
  pb: "3",
3428
3506
  align: "center",
3429
3507
  children: [
3430
- /* @__PURE__ */ jsx59(Flex24, {
3508
+ /* @__PURE__ */ jsx61(Flex24, {
3431
3509
  ml: "-5",
3432
3510
  mr: "2",
3433
3511
  align: "center",
3434
- children: /* @__PURE__ */ jsx59(SpeakerModerateIcon, {
3512
+ children: /* @__PURE__ */ jsx61(SpeakerModerateIcon, {
3435
3513
  style: {
3436
3514
  color: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-12)")
3437
3515
  }
3438
3516
  })
3439
3517
  }),
3440
- /* @__PURE__ */ jsx59(Flex24, {
3518
+ /* @__PURE__ */ jsx61(Flex24, {
3441
3519
  px: "2",
3442
3520
  py: "1",
3443
3521
  style: {
3444
3522
  backgroundColor: "var(--".concat(audioThreadContext.status === "recording" ? "mint" : "gray", "-4)"),
3445
3523
  borderRadius: "var(--radius-6)"
3446
3524
  },
3447
- children: /* @__PURE__ */ jsx59(Visualizer, {})
3525
+ children: /* @__PURE__ */ jsx61(BarsVisualizer, {
3526
+ visualizationAnalyser: audioThreadContext.recorderProps.visualizationAnalyser,
3527
+ color: audioThreadContext.status === "recording" ? "mint" : "gray",
3528
+ height: "20px",
3529
+ barWidth: "12px"
3530
+ })
3448
3531
  })
3449
3532
  ]
3450
3533
  }),
3451
- /* @__PURE__ */ jsx59(ActionButton, {})
3534
+ /* @__PURE__ */ jsx61(ActionButton, {})
3452
3535
  ]
3453
3536
  });
3454
3537
  };
3455
3538
  // src/components/threads/AudioThread/index.tsx
3456
- import { jsx as jsx60, jsxs as jsxs21 } from "react/jsx-runtime";
3539
+ import { jsx as jsx62, jsxs as jsxs21 } from "react/jsx-runtime";
3457
3540
  var AudioThread = function(props) {
3458
3541
  return /* @__PURE__ */ jsxs21(Root8, _object_spread_props(_object_spread({}, props), {
3459
3542
  children: [
3460
- /* @__PURE__ */ jsx60(Visualization, {}),
3461
- /* @__PURE__ */ jsx60(Form, {})
3543
+ /* @__PURE__ */ jsx62(Visualization, {}),
3544
+ /* @__PURE__ */ jsx62(Form, {})
3462
3545
  ]
3463
3546
  }));
3464
3547
  };
@@ -3466,22 +3549,22 @@ AudioThread.Root = Root8;
3466
3549
  AudioThread.Visualization = Visualization;
3467
3550
  AudioThread.Form = Form;
3468
3551
  // src/components/threads/AudioThreadDialog/index.tsx
3469
- import { jsx as jsx61, jsxs as jsxs22 } from "react/jsx-runtime";
3552
+ import { jsx as jsx63, jsxs as jsxs22 } from "react/jsx-runtime";
3470
3553
  var AudioThreadDialog = function() {
3471
3554
  return /* @__PURE__ */ jsxs22(Root6, {
3472
3555
  children: [
3473
- /* @__PURE__ */ jsx61(Content4.Root, {
3474
- children: /* @__PURE__ */ jsx61(AudioThread, {})
3556
+ /* @__PURE__ */ jsx63(Content4.Root, {
3557
+ children: /* @__PURE__ */ jsx63(AudioThread, {})
3475
3558
  }),
3476
- /* @__PURE__ */ jsx61(Trigger, {
3477
- children: /* @__PURE__ */ jsx61(Button3, {})
3559
+ /* @__PURE__ */ jsx63(Trigger, {
3560
+ children: /* @__PURE__ */ jsx63(Button2, {})
3478
3561
  })
3479
3562
  ]
3480
3563
  });
3481
3564
  };
3482
3565
  AudioThreadDialog.Root = Root6;
3483
3566
  AudioThreadDialog.Trigger = Trigger;
3484
- AudioThreadDialog.Button = Button3;
3567
+ AudioThreadDialog.Button = Button2;
3485
3568
  AudioThreadDialog.Content = Content4;
3486
3569
  // src/components/suggestions/Suggestions/index.tsx
3487
3570
  import { useMemo as useMemo15 } from "react";
@@ -3492,12 +3575,12 @@ import { onlyText } from "react-children-utilities";
3492
3575
  import { Flex as Flex25 } from "@radix-ui/themes";
3493
3576
  // src/components/suggestions/Suggestions/Item.tsx
3494
3577
  import { ArrowUpIcon as ArrowUpIcon3 } from "@radix-ui/react-icons";
3495
- import { Text as Text7, Button as Button4, Spinner as Spinner2 } from "@radix-ui/themes";
3496
- import { jsx as jsx62, jsxs as jsxs23 } from "react/jsx-runtime";
3578
+ import { Text as Text7, Button as Button3, Spinner as Spinner2 } from "@radix-ui/themes";
3579
+ import { jsx as jsx64, jsxs as jsxs23 } from "react/jsx-runtime";
3497
3580
  var Item = function(param) {
3498
3581
  var suggestion = param.suggestion, isDisabled = param.isDisabled;
3499
3582
  var _useCreateMessage = useCreateMessage(), createMessage = _useCreateMessage.createMessage, isPending = _useCreateMessage.isPending;
3500
- return /* @__PURE__ */ jsx62(Content5, {
3583
+ return /* @__PURE__ */ jsx64(Content5, {
3501
3584
  onClick: function() {
3502
3585
  createMessage({
3503
3586
  // @ts-ignore-next-line
@@ -3511,26 +3594,35 @@ var Item = function(param) {
3511
3594
  };
3512
3595
  var Content5 = function(param) {
3513
3596
  var onClick = param.onClick, isDisabled = param.isDisabled, isPending = param.isPending, children = param.children;
3514
- return /* @__PURE__ */ jsxs23(Button4, {
3597
+ return /* @__PURE__ */ jsxs23(Button3, {
3515
3598
  variant: "soft",
3516
3599
  onClick: onClick,
3517
3600
  disabled: isDisabled,
3601
+ style: {
3602
+ minHeight: "var(--base-button-height)",
3603
+ height: "inherit",
3604
+ flexShrink: 1
3605
+ },
3518
3606
  children: [
3519
- /* @__PURE__ */ jsx62(Text7, {
3607
+ /* @__PURE__ */ jsx64(Text7, {
3520
3608
  size: "1",
3521
3609
  weight: "regular",
3522
3610
  children: children
3523
3611
  }),
3524
- /* @__PURE__ */ jsx62(Spinner2, {
3612
+ /* @__PURE__ */ jsx64(Spinner2, {
3525
3613
  loading: isPending,
3526
- children: /* @__PURE__ */ jsx62(ArrowUpIcon3, {})
3614
+ children: /* @__PURE__ */ jsx64(ArrowUpIcon3, {
3615
+ style: {
3616
+ flexShrink: 0
3617
+ }
3618
+ })
3527
3619
  })
3528
3620
  ]
3529
3621
  });
3530
3622
  };
3531
3623
  Item.Content = Content5;
3532
3624
  // src/components/suggestions/Suggestions/Content.tsx
3533
- import { jsx as jsx63 } from "react/jsx-runtime";
3625
+ import { jsx as jsx65 } from "react/jsx-runtime";
3534
3626
  var Content6 = function(param) {
3535
3627
  var children = param.children;
3536
3628
  var isRunActiveProps = useIsRunActive();
@@ -3549,12 +3641,12 @@ var Content6 = function(param) {
3549
3641
  isRunActiveProps
3550
3642
  ]);
3551
3643
  if (isEmpty2(suggestions)) return null;
3552
- return /* @__PURE__ */ jsx63(Flex25, {
3644
+ return /* @__PURE__ */ jsx65(Flex25, {
3553
3645
  gap: "2",
3554
3646
  py: "2",
3555
3647
  wrap: "wrap",
3556
3648
  children: suggestions.map(function(suggestion) {
3557
- return /* @__PURE__ */ jsx63(Item, {
3649
+ return /* @__PURE__ */ jsx65(Item, {
3558
3650
  suggestion: suggestion,
3559
3651
  isDisabled: isDisabled
3560
3652
  }, suggestion);
@@ -3562,7 +3654,7 @@ var Content6 = function(param) {
3562
3654
  });
3563
3655
  };
3564
3656
  // src/components/suggestions/Suggestions/index.tsx
3565
- import { jsx as jsx64 } from "react/jsx-runtime";
3657
+ import { jsx as jsx66 } from "react/jsx-runtime";
3566
3658
  var Suggestions = function(param) {
3567
3659
  var children = param.children;
3568
3660
  var latestMessageProps = useLatestMessage();
@@ -3575,14 +3667,14 @@ var Suggestions = function(param) {
3575
3667
  ]);
3576
3668
  if (latestMessageProps.isLoading) return null;
3577
3669
  if (isDisabled) return null;
3578
- return /* @__PURE__ */ jsx64(Content6, {
3670
+ return /* @__PURE__ */ jsx66(Content6, {
3579
3671
  children: children
3580
3672
  });
3581
3673
  };
3582
3674
  Suggestions.Item = Item;
3583
3675
  // src/components/markdown/MarkdownProvider/index.tsx
3584
3676
  import { useMemo as useMemo16 } from "react";
3585
- import { jsx as jsx65 } from "react/jsx-runtime";
3677
+ import { jsx as jsx67 } from "react/jsx-runtime";
3586
3678
  var MarkdownProvider = function(_param) {
3587
3679
  var children = _param.children, rest = _object_without_properties(_param, [
3588
3680
  "children"
@@ -3594,7 +3686,7 @@ var MarkdownProvider = function(_param) {
3594
3686
  rest,
3595
3687
  prevMarkdownContext
3596
3688
  ]);
3597
- return /* @__PURE__ */ jsx65(MarkdownContext.Provider, {
3689
+ return /* @__PURE__ */ jsx67(MarkdownContext.Provider, {
3598
3690
  value: value,
3599
3691
  children: children
3600
3692
  });