@poolse/react-native 3.7.0 → 3.8.0

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
@@ -1,4 +1,4 @@
1
- import { useUser, useMe, useConversations, useUserPresence, formatCallLogPreview, useAttachmentUpload, usePoolse, useConversation, useMembers, usePresence, receiptsOf, useMessages, useTyping, useMessageStreams, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, canEditOwnMessage, isTombstone, formatDayLabel, callLogDisplayFor, useLiveCall, sameDay, useReactions, useThread, useAttachmentUrl } from '@poolse/react';
1
+ import { useUser, useMe, useConversations, useUserPresence, formatCallLogPreview, useAttachmentUpload, usePoolse, filterConversations, useConversation, useMembers, usePresence, receiptsOf, useMessages, useTyping, useMessageStreams, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, canEditOwnMessage, isTombstone, formatDayLabel, callLogDisplayFor, useLiveCall, sameDay, useReactions, useThread, useAttachmentUrl } from '@poolse/react';
2
2
  import { createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect, useMemo, useCallback, useContext, createElement } from 'react';
3
3
  import { StyleSheet, View, Pressable, TextInput, Text, useWindowDimensions, Animated, Easing, PanResponder, Keyboard, Platform, ScrollView, Modal, AppState, ActivityIndicator, SectionList, FlatList, KeyboardAvoidingView, Image, Linking, useColorScheme } from 'react-native';
4
4
  import { SvgXml, Svg, Path, Circle, G } from 'react-native-svg';
@@ -6,6 +6,7 @@ import { toNativeTheme, isBuiltInThemeId } from '@poolse/theme';
6
6
  export { BUILT_IN_THEME_IDS, DEFAULT_THEME_ID, createTheme, decodeTheme, encodeTheme, tokensFromFlat } from '@poolse/theme';
7
7
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
8
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
9
+ import { safeUuid, MessageQueuedError } from '@poolse/sdk';
9
10
  import * as ImagePicker from 'expo-image-picker';
10
11
  import * as DocumentPicker from 'expo-document-picker';
11
12
  import { manipulateAsync, SaveFormat } from 'expo-image-manipulator';
@@ -1295,7 +1296,17 @@ function ChatHeader({
1295
1296
  }
1296
1297
  ],
1297
1298
  children: [
1298
- onBack ? /* @__PURE__ */ jsx(Pressable, { onPress: onBack, hitSlop: 12, style: styles5.backBtn, accessibilityLabel: "Back", children: /* @__PURE__ */ jsx(PoolseIcon, { name: "reply", size: 20, color: theme.colors.text }) }) : null,
1299
+ onBack ? /* @__PURE__ */ jsx(
1300
+ Pressable,
1301
+ {
1302
+ onPress: onBack,
1303
+ hitSlop: 12,
1304
+ style: styles5.backBtn,
1305
+ accessibilityRole: "button",
1306
+ accessibilityLabel: "Back",
1307
+ children: /* @__PURE__ */ jsx(PoolseIcon, { name: "reply", size: 20, color: theme.colors.text })
1308
+ }
1309
+ ) : null,
1299
1310
  /* @__PURE__ */ jsx(
1300
1311
  Avatar,
1301
1312
  {
@@ -1326,6 +1337,7 @@ function ChatHeader({
1326
1337
  onPress: onMembersPress,
1327
1338
  hitSlop: 12,
1328
1339
  style: styles5.actionBtn,
1340
+ accessibilityRole: "button",
1329
1341
  accessibilityLabel: "Show members",
1330
1342
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "users", size: 20, color: theme.colors.textMuted })
1331
1343
  }
@@ -1381,6 +1393,34 @@ var styles5 = StyleSheet.create({
1381
1393
  marginLeft: -6
1382
1394
  }
1383
1395
  });
1396
+ function EmptyState({ title, hint, action }) {
1397
+ const theme = useTheme();
1398
+ return /* @__PURE__ */ jsxs(View, { style: styles6.root, accessible: true, accessibilityRole: "text", children: [
1399
+ /* @__PURE__ */ jsx(
1400
+ Text,
1401
+ {
1402
+ style: [styles6.title, { color: theme.colors.text, fontFamily: theme.fonts.body }],
1403
+ maxFontSizeMultiplier: 2,
1404
+ children: title
1405
+ }
1406
+ ),
1407
+ hint ? /* @__PURE__ */ jsx(
1408
+ Text,
1409
+ {
1410
+ style: [styles6.hint, { color: theme.colors.textMuted, fontFamily: theme.fonts.body }],
1411
+ maxFontSizeMultiplier: 2,
1412
+ children: hint
1413
+ }
1414
+ ) : null,
1415
+ action ? /* @__PURE__ */ jsx(View, { style: styles6.action, children: action }) : null
1416
+ ] });
1417
+ }
1418
+ var styles6 = StyleSheet.create({
1419
+ root: { alignItems: "center", paddingHorizontal: 24, paddingVertical: 24, maxWidth: 360 },
1420
+ title: { fontSize: 16, fontWeight: "600", textAlign: "center" },
1421
+ hint: { fontSize: 14, lineHeight: 20, marginTop: 6, textAlign: "center" },
1422
+ action: { marginTop: 14 }
1423
+ });
1384
1424
 
1385
1425
  // src/internal/conversationSections.ts
1386
1426
  var TYPE_SECTIONS = [
@@ -1402,6 +1442,8 @@ function ConversationList({
1402
1442
  onSelect,
1403
1443
  renderItem,
1404
1444
  emptyState,
1445
+ query = "",
1446
+ noResultsState,
1405
1447
  conversations: controlled,
1406
1448
  loading: controlledLoading,
1407
1449
  error: controlledError,
@@ -1423,7 +1465,15 @@ function ConversationList({
1423
1465
  const meExternalId = me?.external_id ?? null;
1424
1466
  const meId = me?.id ?? null;
1425
1467
  const isControlled = controlled !== void 0;
1426
- const conversations = isControlled ? controlled : auto.conversations;
1468
+ const allConversations = isControlled ? controlled : auto.conversations;
1469
+ const needle = query.trim();
1470
+ const conversations = useMemo(
1471
+ () => needle ? filterConversations(allConversations, needle, {
1472
+ meExternalId,
1473
+ ...labelFor ? { labelFor } : {}
1474
+ }) : allConversations,
1475
+ [allConversations, needle, meExternalId, labelFor]
1476
+ );
1427
1477
  const loading = isControlled ? controlledLoading ?? false : auto.loading;
1428
1478
  const error = isControlled ? controlledError ?? null : auto.error;
1429
1479
  const counts = unreadCounts ?? (isControlled ? void 0 : auto.unreadCounts);
@@ -1472,9 +1522,9 @@ function ConversationList({
1472
1522
  onSelect
1473
1523
  ]
1474
1524
  );
1475
- const placeholder = (node) => /* @__PURE__ */ jsxs(View, { style: [styles6.flex, { backgroundColor: theme.colors.background }], children: [
1525
+ const placeholder = (node) => /* @__PURE__ */ jsxs(View, { style: [styles7.flex, { backgroundColor: theme.colors.background }], children: [
1476
1526
  header,
1477
- /* @__PURE__ */ jsx(View, { style: styles6.placeholder, children: node })
1527
+ /* @__PURE__ */ jsx(View, { style: styles7.placeholder, children: node })
1478
1528
  ] });
1479
1529
  if (loading && conversations.length === 0) {
1480
1530
  return placeholder(/* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent }));
@@ -1484,12 +1534,29 @@ function ConversationList({
1484
1534
  /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.danger, fontFamily: theme.fonts.body }, children: "Failed to load conversations." })
1485
1535
  );
1486
1536
  }
1537
+ if (conversations.length === 0 && needle && allConversations.length > 0) {
1538
+ return placeholder(
1539
+ typeof noResultsState === "function" ? noResultsState(needle) : noResultsState !== void 0 ? noResultsState : /* @__PURE__ */ jsx(
1540
+ EmptyState,
1541
+ {
1542
+ title: `Nothing matches \u201C${needle}\u201D`,
1543
+ hint: "Check the spelling, or search by a person's or channel's name."
1544
+ }
1545
+ )
1546
+ );
1547
+ }
1487
1548
  if (conversations.length === 0) {
1488
1549
  return placeholder(
1489
- typeof emptyState === "string" || emptyState == null ? /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState ?? "No conversations yet." }) : emptyState
1550
+ emptyState == null ? /* @__PURE__ */ jsx(
1551
+ EmptyState,
1552
+ {
1553
+ title: "No conversations yet",
1554
+ hint: "Start a chat with someone, or join a channel \u2014 it shows up here."
1555
+ }
1556
+ ) : typeof emptyState === "string" ? /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState }) : emptyState
1490
1557
  );
1491
1558
  }
1492
- const footer = loadingMore ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.textSubtle, style: styles6.footerSpinner }) : null;
1559
+ const footer = loadingMore ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.textSubtle, style: styles7.footerSpinner }) : null;
1493
1560
  const common = {
1494
1561
  style: { backgroundColor: theme.colors.background },
1495
1562
  onEndReached: hasMore ? loadMore : void 0,
@@ -1510,8 +1577,8 @@ function ConversationList({
1510
1577
  Text,
1511
1578
  {
1512
1579
  style: [
1513
- styles6.sectionTitle,
1514
- density === "compact" ? styles6.sectionTitleDense : null,
1580
+ styles7.sectionTitle,
1581
+ density === "compact" ? styles7.sectionTitleDense : null,
1515
1582
  { color: theme.colors.textMuted, fontFamily: theme.fonts.body }
1516
1583
  ],
1517
1584
  accessibilityRole: "header",
@@ -1563,7 +1630,7 @@ function ConversationRow({
1563
1630
  accessibilityState: { selected },
1564
1631
  accessibilityLabel: unread > 0 ? `${title}, ${unread} unread` : title,
1565
1632
  style: ({ pressed }) => [
1566
- styles6.row,
1633
+ styles7.row,
1567
1634
  {
1568
1635
  paddingHorizontal: theme.spacing.md,
1569
1636
  paddingVertical: dense ? theme.spacing.xs + 2 : theme.spacing.sm + 2,
@@ -1582,14 +1649,14 @@ function ConversationRow({
1582
1649
  ...presence ? { presence: presence.state, doNotDisturb: !!presence.do_not_disturb } : {}
1583
1650
  }
1584
1651
  ),
1585
- /* @__PURE__ */ jsxs(View, { style: styles6.body, children: [
1586
- /* @__PURE__ */ jsxs(View, { style: styles6.titleLine, children: [
1652
+ /* @__PURE__ */ jsxs(View, { style: styles7.body, children: [
1653
+ /* @__PURE__ */ jsxs(View, { style: styles7.titleLine, children: [
1587
1654
  /* @__PURE__ */ jsx(
1588
1655
  Text,
1589
1656
  {
1590
1657
  style: [
1591
- styles6.name,
1592
- dense ? styles6.nameDense : null,
1658
+ styles7.name,
1659
+ dense ? styles7.nameDense : null,
1593
1660
  {
1594
1661
  color: theme.colors.text,
1595
1662
  fontFamily: theme.fonts.body,
@@ -1604,7 +1671,7 @@ function ConversationRow({
1604
1671
  Text,
1605
1672
  {
1606
1673
  style: [
1607
- styles6.time,
1674
+ styles7.time,
1608
1675
  { color: bold ? theme.colors.accentStrong : theme.colors.textSubtle }
1609
1676
  ],
1610
1677
  children: when
@@ -1615,7 +1682,7 @@ function ConversationRow({
1615
1682
  Text,
1616
1683
  {
1617
1684
  style: [
1618
- styles6.preview,
1685
+ styles7.preview,
1619
1686
  { color: bold ? theme.colors.textMuted : theme.colors.textSubtle }
1620
1687
  ],
1621
1688
  numberOfLines: 1,
@@ -1623,12 +1690,12 @@ function ConversationRow({
1623
1690
  }
1624
1691
  ) : null
1625
1692
  ] }),
1626
- unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles6.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsx(Text, { style: [styles6.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
1693
+ unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles7.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsx(Text, { style: [styles7.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
1627
1694
  ]
1628
1695
  }
1629
1696
  );
1630
1697
  }
1631
- var styles6 = StyleSheet.create({
1698
+ var styles7 = StyleSheet.create({
1632
1699
  flex: {
1633
1700
  flex: 1
1634
1701
  },
@@ -1833,11 +1900,11 @@ function AttachmentPicker({
1833
1900
  animationType: "slide",
1834
1901
  onRequestClose: onClose,
1835
1902
  ...EDGE_TO_EDGE_MODAL,
1836
- children: /* @__PURE__ */ jsx(Pressable, { style: styles7.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs(
1903
+ children: /* @__PURE__ */ jsx(Pressable, { style: styles8.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs(
1837
1904
  View,
1838
1905
  {
1839
1906
  style: [
1840
- styles7.sheet,
1907
+ styles8.sheet,
1841
1908
  {
1842
1909
  backgroundColor: theme.colors.surface,
1843
1910
  borderTopLeftRadius: theme.radii.lg,
@@ -1850,19 +1917,19 @@ function AttachmentPicker({
1850
1917
  theme.shadows.lg
1851
1918
  ],
1852
1919
  children: [
1853
- camera ? /* @__PURE__ */ jsxs(Pressable, { style: styles7.item, onPress: () => pickFromKind("camera"), children: [
1920
+ camera ? /* @__PURE__ */ jsxs(Pressable, { style: styles8.item, onPress: () => pickFromKind("camera"), children: [
1854
1921
  /* @__PURE__ */ jsx(PoolseIcon, { name: "camera", size: 20, color: theme.colors.textMuted }),
1855
- /* @__PURE__ */ jsx(Text, { style: [styles7.itemText, { color: theme.colors.text }], children: "Camera" })
1922
+ /* @__PURE__ */ jsx(Text, { style: [styles8.itemText, { color: theme.colors.text }], children: "Camera" })
1856
1923
  ] }) : null,
1857
- /* @__PURE__ */ jsxs(Pressable, { style: styles7.item, onPress: () => pickFromKind("image"), children: [
1924
+ /* @__PURE__ */ jsxs(Pressable, { style: styles8.item, onPress: () => pickFromKind("image"), children: [
1858
1925
  /* @__PURE__ */ jsx(PoolseIcon, { name: "image", size: 20, color: theme.colors.textMuted }),
1859
- /* @__PURE__ */ jsx(Text, { style: [styles7.itemText, { color: theme.colors.text }], children: "Photo library" })
1926
+ /* @__PURE__ */ jsx(Text, { style: [styles8.itemText, { color: theme.colors.text }], children: "Photo library" })
1860
1927
  ] }),
1861
- /* @__PURE__ */ jsxs(Pressable, { style: styles7.item, onPress: () => pickFromKind("document"), children: [
1928
+ /* @__PURE__ */ jsxs(Pressable, { style: styles8.item, onPress: () => pickFromKind("document"), children: [
1862
1929
  /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 20, color: theme.colors.textMuted }),
1863
- /* @__PURE__ */ jsx(Text, { style: [styles7.itemText, { color: theme.colors.text }], children: "File" })
1930
+ /* @__PURE__ */ jsx(Text, { style: [styles8.itemText, { color: theme.colors.text }], children: "File" })
1864
1931
  ] }),
1865
- /* @__PURE__ */ jsx(Pressable, { style: styles7.cancel, onPress: onClose, children: /* @__PURE__ */ jsx(Text, { style: [styles7.itemText, { color: theme.colors.accent }], children: "Cancel" }) })
1932
+ /* @__PURE__ */ jsx(Pressable, { style: styles8.cancel, onPress: onClose, children: /* @__PURE__ */ jsx(Text, { style: [styles8.itemText, { color: theme.colors.accent }], children: "Cancel" }) })
1866
1933
  ]
1867
1934
  }
1868
1935
  ) })
@@ -2017,7 +2084,7 @@ async function defaultAdapter(kind, { multiple }) {
2017
2084
  })
2018
2085
  );
2019
2086
  }
2020
- var styles7 = StyleSheet.create({
2087
+ var styles8 = StyleSheet.create({
2021
2088
  backdrop: {
2022
2089
  flex: 1,
2023
2090
  backgroundColor: "rgba(0,0,0,0.35)",
@@ -2047,14 +2114,14 @@ var styles7 = StyleSheet.create({
2047
2114
  });
2048
2115
  function DaySeparator({ label, variant = "pill" }) {
2049
2116
  const theme = useTheme();
2050
- const rule = variant === "rule" ? /* @__PURE__ */ jsx(View, { style: [styles8.rule, { backgroundColor: theme.colors.border }] }) : null;
2051
- return /* @__PURE__ */ jsxs(View, { style: [styles8.wrap, rule ? styles8.wrapRule : null], children: [
2117
+ const rule = variant === "rule" ? /* @__PURE__ */ jsx(View, { style: [styles9.rule, { backgroundColor: theme.colors.border }] }) : null;
2118
+ return /* @__PURE__ */ jsxs(View, { style: [styles9.wrap, rule ? styles9.wrapRule : null], children: [
2052
2119
  rule,
2053
2120
  /* @__PURE__ */ jsx(
2054
2121
  View,
2055
2122
  {
2056
2123
  style: [
2057
- styles8.chip,
2124
+ styles9.chip,
2058
2125
  {
2059
2126
  backgroundColor: theme.colors.surfaceAlt,
2060
2127
  borderColor: theme.colors.border
@@ -2064,7 +2131,7 @@ function DaySeparator({ label, variant = "pill" }) {
2064
2131
  Text,
2065
2132
  {
2066
2133
  style: [
2067
- styles8.label,
2134
+ styles9.label,
2068
2135
  {
2069
2136
  color: theme.colors.textMuted,
2070
2137
  fontFamily: theme.fonts.body
@@ -2078,7 +2145,7 @@ function DaySeparator({ label, variant = "pill" }) {
2078
2145
  rule
2079
2146
  ] });
2080
2147
  }
2081
- var styles8 = StyleSheet.create({
2148
+ var styles9 = StyleSheet.create({
2082
2149
  wrap: {
2083
2150
  alignItems: "center",
2084
2151
  marginVertical: 8
@@ -2111,7 +2178,7 @@ function LiveCallBanner({ call, inCall, onJoin }) {
2111
2178
  return /* @__PURE__ */ jsxs(
2112
2179
  View,
2113
2180
  {
2114
- style: [styles9.bar, { backgroundColor: theme.colors.success }],
2181
+ style: [styles10.bar, { backgroundColor: theme.colors.success }],
2115
2182
  accessibilityRole: "summary",
2116
2183
  accessibilityLabel: `${what}, ${who}`,
2117
2184
  children: [
@@ -2124,9 +2191,9 @@ function LiveCallBanner({ call, inCall, onJoin }) {
2124
2191
  label: null
2125
2192
  }
2126
2193
  ),
2127
- /* @__PURE__ */ jsxs(View, { style: styles9.text, children: [
2128
- /* @__PURE__ */ jsx(Text, { style: [styles9.title, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: what }),
2129
- /* @__PURE__ */ jsx(Text, { style: [styles9.meta, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: who })
2194
+ /* @__PURE__ */ jsxs(View, { style: styles10.text, children: [
2195
+ /* @__PURE__ */ jsx(Text, { style: [styles10.title, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: what }),
2196
+ /* @__PURE__ */ jsx(Text, { style: [styles10.meta, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: who })
2130
2197
  ] }),
2131
2198
  /* @__PURE__ */ jsx(
2132
2199
  Pressable,
@@ -2135,11 +2202,11 @@ function LiveCallBanner({ call, inCall, onJoin }) {
2135
2202
  accessibilityRole: "button",
2136
2203
  accessibilityLabel: "Join call",
2137
2204
  hitSlop: 8,
2138
- style: ({ pressed }) => [styles9.join, pressed && styles9.joinPressed],
2205
+ style: ({ pressed }) => [styles10.join, pressed && styles10.joinPressed],
2139
2206
  children: /* @__PURE__ */ jsx(
2140
2207
  Text,
2141
2208
  {
2142
- style: [styles9.joinText, { color: theme.colors.success, fontFamily: theme.fonts.body }],
2209
+ style: [styles10.joinText, { color: theme.colors.success, fontFamily: theme.fonts.body }],
2143
2210
  children: "Join"
2144
2211
  }
2145
2212
  )
@@ -2149,7 +2216,7 @@ function LiveCallBanner({ call, inCall, onJoin }) {
2149
2216
  }
2150
2217
  );
2151
2218
  }
2152
- var styles9 = StyleSheet.create({
2219
+ var styles10 = StyleSheet.create({
2153
2220
  bar: {
2154
2221
  flexDirection: "row",
2155
2222
  alignItems: "center",
@@ -2355,7 +2422,7 @@ function PickerSheet({
2355
2422
  {
2356
2423
  onPress: () => pick(emoji),
2357
2424
  style: ({ pressed }) => [
2358
- styles10.cell,
2425
+ styles11.cell,
2359
2426
  {
2360
2427
  borderRadius: theme.radii.sm,
2361
2428
  backgroundColor: pressed ? theme.colors.surfaceAlt : void 0
@@ -2363,15 +2430,15 @@ function PickerSheet({
2363
2430
  ],
2364
2431
  accessibilityRole: "button",
2365
2432
  accessibilityLabel: emoji,
2366
- children: /* @__PURE__ */ jsx(Text, { style: styles10.emoji, children: emoji })
2433
+ children: /* @__PURE__ */ jsx(Text, { style: styles11.emoji, children: emoji })
2367
2434
  },
2368
2435
  emoji
2369
2436
  );
2370
- return /* @__PURE__ */ jsxs(KeyboardAvoidingView, { style: styles10.kav, behavior: "padding", children: [
2437
+ return /* @__PURE__ */ jsxs(KeyboardAvoidingView, { style: styles11.kav, behavior: "padding", children: [
2371
2438
  /* @__PURE__ */ jsx(
2372
2439
  Pressable,
2373
2440
  {
2374
- style: [styles10.backdrop, { backgroundColor: theme.colors.overlay }],
2441
+ style: [styles11.backdrop, { backgroundColor: theme.colors.overlay }],
2375
2442
  onPress: onClose,
2376
2443
  accessibilityLabel: "Close emoji picker"
2377
2444
  }
@@ -2380,7 +2447,7 @@ function PickerSheet({
2380
2447
  View,
2381
2448
  {
2382
2449
  style: [
2383
- styles10.sheet,
2450
+ styles11.sheet,
2384
2451
  {
2385
2452
  height: Math.round(height * 0.55),
2386
2453
  backgroundColor: theme.colors.surface,
@@ -2393,11 +2460,11 @@ function PickerSheet({
2393
2460
  theme.shadows.lg
2394
2461
  ],
2395
2462
  children: [
2396
- /* @__PURE__ */ jsxs(View, { style: styles10.headRow, children: [
2463
+ /* @__PURE__ */ jsxs(View, { style: styles11.headRow, children: [
2397
2464
  /* @__PURE__ */ jsx(
2398
2465
  Text,
2399
2466
  {
2400
- style: [styles10.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
2467
+ style: [styles11.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
2401
2468
  accessibilityRole: "header",
2402
2469
  children: title
2403
2470
  }
@@ -2408,7 +2475,7 @@ function PickerSheet({
2408
2475
  View,
2409
2476
  {
2410
2477
  style: [
2411
- styles10.search,
2478
+ styles11.search,
2412
2479
  { backgroundColor: theme.colors.surfaceAlt, borderRadius: theme.radii.md }
2413
2480
  ],
2414
2481
  children: [
@@ -2422,19 +2489,19 @@ function PickerSheet({
2422
2489
  placeholderTextColor: theme.colors.textSubtle,
2423
2490
  autoCorrect: false,
2424
2491
  autoCapitalize: "none",
2425
- style: [styles10.searchInput, { color: theme.colors.text, fontFamily: theme.fonts.body }],
2492
+ style: [styles11.searchInput, { color: theme.colors.text, fontFamily: theme.fonts.body }],
2426
2493
  accessibilityLabel: "Search emoji"
2427
2494
  }
2428
2495
  )
2429
2496
  ]
2430
2497
  }
2431
2498
  ),
2432
- query.trim() ? results.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles10.results, children: results.map((r) => cell(r.emoji)) }) : /* @__PURE__ */ jsx(Text, { style: [styles10.empty, { color: theme.colors.textMuted }], children: "No emoji found." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2433
- /* @__PURE__ */ jsx(View, { style: [styles10.tabs, { borderBottomColor: theme.colors.border }], children: sections.map((s, i) => /* @__PURE__ */ jsx(
2499
+ query.trim() ? results.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles11.results, children: results.map((r) => cell(r.emoji)) }) : /* @__PURE__ */ jsx(Text, { style: [styles11.empty, { color: theme.colors.textMuted }], children: "No emoji found." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2500
+ /* @__PURE__ */ jsx(View, { style: [styles11.tabs, { borderBottomColor: theme.colors.border }], children: sections.map((s, i) => /* @__PURE__ */ jsx(
2434
2501
  Pressable,
2435
2502
  {
2436
2503
  hitSlop: 4,
2437
- style: styles10.tab,
2504
+ style: styles11.tab,
2438
2505
  onPress: () => listRef.current?.scrollToLocation({
2439
2506
  sectionIndex: i,
2440
2507
  itemIndex: 0,
@@ -2443,7 +2510,7 @@ function PickerSheet({
2443
2510
  }),
2444
2511
  accessibilityRole: "button",
2445
2512
  accessibilityLabel: s.title,
2446
- children: /* @__PURE__ */ jsx(Text, { style: styles10.tabEmoji, children: s.id === "recent" ? "\u{1F558}" : s.data[0]?.[0] })
2513
+ children: /* @__PURE__ */ jsx(Text, { style: styles11.tabEmoji, children: s.id === "recent" ? "\u{1F558}" : s.data[0]?.[0] })
2447
2514
  },
2448
2515
  s.id
2449
2516
  )) }),
@@ -2457,8 +2524,8 @@ function PickerSheet({
2457
2524
  stickySectionHeadersEnabled: false,
2458
2525
  initialNumToRender: 8,
2459
2526
  onScrollToIndexFailed: () => void 0,
2460
- renderSectionHeader: ({ section }) => /* @__PURE__ */ jsx(Text, { style: [styles10.sectionTitle, { color: theme.colors.textMuted }], children: section.title }),
2461
- renderItem: ({ item }) => /* @__PURE__ */ jsx(View, { style: styles10.gridRow, children: item.map(cell) })
2527
+ renderSectionHeader: ({ section }) => /* @__PURE__ */ jsx(Text, { style: [styles11.sectionTitle, { color: theme.colors.textMuted }], children: section.title }),
2528
+ renderItem: ({ item }) => /* @__PURE__ */ jsx(View, { style: styles11.gridRow, children: item.map(cell) })
2462
2529
  }
2463
2530
  )
2464
2531
  ] })
@@ -2472,7 +2539,7 @@ function chunk(list, size) {
2472
2539
  for (let i = 0; i < list.length; i += size) out.push(list.slice(i, i + size));
2473
2540
  return out;
2474
2541
  }
2475
- var styles10 = StyleSheet.create({
2542
+ var styles11 = StyleSheet.create({
2476
2543
  kav: {
2477
2544
  flex: 1,
2478
2545
  justifyContent: "flex-end"
@@ -2563,8 +2630,8 @@ function UploadQueueStrip() {
2563
2630
  {
2564
2631
  horizontal: true,
2565
2632
  showsHorizontalScrollIndicator: false,
2566
- contentContainerStyle: styles11.scroll,
2567
- style: [styles11.scrollStyle, { marginBottom: 8 }],
2633
+ contentContainerStyle: styles12.scroll,
2634
+ style: [styles12.scrollStyle, { marginBottom: 8 }],
2568
2635
  children: upload.queue.map((item) => {
2569
2636
  const isError = item.status === "error";
2570
2637
  const isUploading = item.status === "uploading" || item.status === "pending";
@@ -2575,7 +2642,7 @@ function UploadQueueStrip() {
2575
2642
  if (item.status === "ready" || isError) upload.remove(item.localId);
2576
2643
  else upload.cancel(item.localId);
2577
2644
  };
2578
- return /* @__PURE__ */ jsxs(View, { style: styles11.tileWrap, children: [
2645
+ return /* @__PURE__ */ jsxs(View, { style: styles12.tileWrap, children: [
2579
2646
  isImage && previewUri ? /* @__PURE__ */ jsx(ImageTile, { uri: previewUri, uploading: isUploading, error: isError }) : /* @__PURE__ */ jsx(
2580
2647
  FileTile,
2581
2648
  {
@@ -2590,13 +2657,13 @@ function UploadQueueStrip() {
2590
2657
  {
2591
2658
  onPress: handleClose,
2592
2659
  hitSlop: 8,
2593
- style: styles11.closeBtn,
2660
+ style: styles12.closeBtn,
2594
2661
  accessibilityLabel: isError ? "Remove failed upload" : "Cancel upload",
2595
2662
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 11, color: "#fff" })
2596
2663
  }
2597
2664
  ) : null,
2598
- isUploading ? /* @__PURE__ */ jsx(View, { style: styles11.progressOverlay, children: /* @__PURE__ */ jsx(View, { style: [styles11.spinner, { borderColor: theme.colors.accentText }] }) }) : null,
2599
- isError ? /* @__PURE__ */ jsx(View, { style: [styles11.errorOverlay, { backgroundColor: "rgba(229,72,77,0.85)" }], children: /* @__PURE__ */ jsx(Text, { style: [styles11.errorText, { color: "#fff" }], children: "Failed" }) }) : null
2665
+ isUploading ? /* @__PURE__ */ jsx(View, { style: styles12.progressOverlay, children: /* @__PURE__ */ jsx(View, { style: [styles12.spinner, { borderColor: theme.colors.accentText }] }) }) : null,
2666
+ isError ? /* @__PURE__ */ jsx(View, { style: [styles12.errorOverlay, { backgroundColor: "rgba(229,72,77,0.85)" }], children: /* @__PURE__ */ jsx(Text, { style: [styles12.errorText, { color: "#fff" }], children: "Failed" }) }) : null
2600
2667
  ] }, item.localId);
2601
2668
  })
2602
2669
  }
@@ -2609,7 +2676,7 @@ function ImageTile({ uri, uploading, error }) {
2609
2676
  {
2610
2677
  source: { uri },
2611
2678
  style: [
2612
- styles11.imageTile,
2679
+ styles12.imageTile,
2613
2680
  {
2614
2681
  backgroundColor: theme.colors.surfaceAlt,
2615
2682
  borderColor: error ? theme.colors.danger : "transparent",
@@ -2631,24 +2698,24 @@ function FileTile({
2631
2698
  View,
2632
2699
  {
2633
2700
  style: [
2634
- styles11.fileTile,
2701
+ styles12.fileTile,
2635
2702
  {
2636
2703
  backgroundColor: theme.colors.surfaceAlt,
2637
2704
  borderColor: error ? theme.colors.danger : uploading ? theme.colors.accent : theme.colors.border
2638
2705
  }
2639
2706
  ],
2640
2707
  children: [
2641
- /* @__PURE__ */ jsx(View, { style: [styles11.fileIconBox, { backgroundColor: theme.colors.accentSoft }], children: /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 18, color: theme.colors.accent }) }),
2642
- /* @__PURE__ */ jsxs(View, { style: styles11.fileInfo, children: [
2708
+ /* @__PURE__ */ jsx(View, { style: [styles12.fileIconBox, { backgroundColor: theme.colors.accentSoft }], children: /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 18, color: theme.colors.accent }) }),
2709
+ /* @__PURE__ */ jsxs(View, { style: styles12.fileInfo, children: [
2643
2710
  /* @__PURE__ */ jsx(
2644
2711
  Text,
2645
2712
  {
2646
- style: [styles11.fileName, { color: theme.colors.text, fontFamily: theme.fonts.body }],
2713
+ style: [styles12.fileName, { color: theme.colors.text, fontFamily: theme.fonts.body }],
2647
2714
  numberOfLines: 1,
2648
2715
  children: filename
2649
2716
  }
2650
2717
  ),
2651
- /* @__PURE__ */ jsx(Text, { style: [styles11.fileSize, { color: theme.colors.textSubtle }], children: formatBytes2(size) })
2718
+ /* @__PURE__ */ jsx(Text, { style: [styles12.fileSize, { color: theme.colors.textSubtle }], children: formatBytes2(size) })
2652
2719
  ] })
2653
2720
  ]
2654
2721
  }
@@ -2662,7 +2729,7 @@ function formatBytes2(n) {
2662
2729
  return `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;
2663
2730
  }
2664
2731
  var TILE = 64;
2665
- var styles11 = StyleSheet.create({
2732
+ var styles12 = StyleSheet.create({
2666
2733
  scrollStyle: {
2667
2734
  overflow: "visible"
2668
2735
  },
@@ -2896,7 +2963,7 @@ var MessageComposer = forwardRef(
2896
2963
  View,
2897
2964
  {
2898
2965
  style: [
2899
- styles12.wrap,
2966
+ styles13.wrap,
2900
2967
  {
2901
2968
  backgroundColor: theme.colors.surface,
2902
2969
  borderTopColor: theme.colors.border,
@@ -2920,13 +2987,14 @@ var MessageComposer = forwardRef(
2920
2987
  ) : null,
2921
2988
  attachments && !isEditing ? /* @__PURE__ */ jsx(UploadQueueStrip, {}) : null,
2922
2989
  isEditing ? null : accessory,
2923
- /* @__PURE__ */ jsxs(View, { style: styles12.row, children: [
2990
+ /* @__PURE__ */ jsxs(View, { style: styles13.row, children: [
2924
2991
  attachments && onAttachPress ? /* @__PURE__ */ jsx(
2925
2992
  Pressable,
2926
2993
  {
2927
2994
  onPress: onAttachPress,
2928
2995
  hitSlop: 8,
2929
- style: styles12.iconBtn,
2996
+ style: styles13.iconBtn,
2997
+ accessibilityRole: "button",
2930
2998
  accessibilityLabel: "Attach file",
2931
2999
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 22, color: theme.colors.textMuted })
2932
3000
  }
@@ -2936,7 +3004,7 @@ var MessageComposer = forwardRef(
2936
3004
  {
2937
3005
  onPress: () => setEmojiOpen(true),
2938
3006
  hitSlop: 8,
2939
- style: styles12.iconBtn,
3007
+ style: styles13.iconBtn,
2940
3008
  accessibilityRole: "button",
2941
3009
  accessibilityLabel: "Insert emoji",
2942
3010
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "emoji", size: 22, color: theme.colors.textMuted, label: null })
@@ -2956,11 +3024,12 @@ var MessageComposer = forwardRef(
2956
3024
  if (!isEditing) onSelectionChange?.(e.nativeEvent.selection);
2957
3025
  },
2958
3026
  placeholder,
3027
+ accessibilityLabel: placeholder,
2959
3028
  placeholderTextColor: theme.colors.textSubtle,
2960
3029
  multiline: true,
2961
3030
  editable: !disabled,
2962
3031
  style: [
2963
- styles12.input,
3032
+ styles13.input,
2964
3033
  {
2965
3034
  color: theme.colors.text,
2966
3035
  backgroundColor: theme.colors.surfaceAlt,
@@ -2977,12 +3046,13 @@ var MessageComposer = forwardRef(
2977
3046
  onPress: handleSend,
2978
3047
  disabled: submitDisabled,
2979
3048
  style: [
2980
- styles12.sendBtn,
3049
+ styles13.sendBtn,
2981
3050
  {
2982
3051
  backgroundColor: submitDisabled ? theme.colors.textSubtle : theme.colors.accent,
2983
3052
  opacity: submitDisabled ? 0.6 : 1
2984
3053
  }
2985
3054
  ],
3055
+ accessibilityRole: "button",
2986
3056
  accessibilityLabel: "Send message",
2987
3057
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "send", size: 18, color: theme.colors.accentText })
2988
3058
  }
@@ -3020,7 +3090,7 @@ function EditChip({ message, onCancel }) {
3020
3090
  View,
3021
3091
  {
3022
3092
  style: [
3023
- styles12.replyChip,
3093
+ styles13.replyChip,
3024
3094
  {
3025
3095
  backgroundColor: theme.colors.surfaceAlt,
3026
3096
  borderLeftColor: theme.colors.accent
@@ -3028,10 +3098,10 @@ function EditChip({ message, onCancel }) {
3028
3098
  ],
3029
3099
  children: [
3030
3100
  /* @__PURE__ */ jsxs(View, { style: { flex: 1 }, children: [
3031
- /* @__PURE__ */ jsx(Text, { style: [styles12.replyName, { color: theme.colors.accent }], children: "Editing message" }),
3032
- /* @__PURE__ */ jsx(Text, { style: [styles12.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
3101
+ /* @__PURE__ */ jsx(Text, { style: [styles13.replyName, { color: theme.colors.accent }], children: "Editing message" }),
3102
+ /* @__PURE__ */ jsx(Text, { style: [styles13.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
3033
3103
  ] }),
3034
- onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles12.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
3104
+ onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles13.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
3035
3105
  ]
3036
3106
  }
3037
3107
  );
@@ -3048,7 +3118,7 @@ function ReplyChip({
3048
3118
  View,
3049
3119
  {
3050
3120
  style: [
3051
- styles12.replyChip,
3121
+ styles13.replyChip,
3052
3122
  {
3053
3123
  backgroundColor: theme.colors.surfaceAlt,
3054
3124
  borderLeftColor: theme.colors.accent
@@ -3056,18 +3126,18 @@ function ReplyChip({
3056
3126
  ],
3057
3127
  children: [
3058
3128
  /* @__PURE__ */ jsxs(View, { style: { flex: 1 }, children: [
3059
- /* @__PURE__ */ jsxs(Text, { style: [styles12.replyName, { color: theme.colors.accent }], children: [
3129
+ /* @__PURE__ */ jsxs(Text, { style: [styles13.replyName, { color: theme.colors.accent }], children: [
3060
3130
  "Replying to ",
3061
3131
  senderName
3062
3132
  ] }),
3063
- /* @__PURE__ */ jsx(Text, { style: [styles12.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
3133
+ /* @__PURE__ */ jsx(Text, { style: [styles13.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
3064
3134
  ] }),
3065
- onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles12.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
3135
+ onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles13.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
3066
3136
  ]
3067
3137
  }
3068
3138
  );
3069
3139
  }
3070
- var styles12 = StyleSheet.create({
3140
+ var styles13 = StyleSheet.create({
3071
3141
  wrap: {
3072
3142
  borderTopWidth: StyleSheet.hairlineWidth,
3073
3143
  paddingTop: 8,
@@ -3178,7 +3248,7 @@ function MentionInput({
3178
3248
  View,
3179
3249
  {
3180
3250
  style: [
3181
- styles13.suggestions,
3251
+ styles14.suggestions,
3182
3252
  {
3183
3253
  backgroundColor: theme.colors.surface,
3184
3254
  borderColor: theme.colors.border,
@@ -3189,7 +3259,7 @@ function MentionInput({
3189
3259
  accessibilityRole: "menu",
3190
3260
  accessibilityLabel: "Mention suggestions",
3191
3261
  children: [
3192
- /* @__PURE__ */ jsx(ScrollView, { keyboardShouldPersistTaps: "always", style: styles13.suggestionScroll, children: candidates.map((c) => /* @__PURE__ */ jsx(
3262
+ /* @__PURE__ */ jsx(ScrollView, { keyboardShouldPersistTaps: "always", style: styles14.suggestionScroll, children: candidates.map((c) => /* @__PURE__ */ jsx(
3193
3263
  MentionRow,
3194
3264
  {
3195
3265
  externalId: c.externalId,
@@ -3202,7 +3272,7 @@ function MentionInput({
3202
3272
  Pressable,
3203
3273
  {
3204
3274
  onPress: () => setDismissedAt(query.start),
3205
- style: styles13.dismiss,
3275
+ style: styles14.dismiss,
3206
3276
  accessibilityRole: "button",
3207
3277
  accessibilityLabel: "Dismiss suggestions",
3208
3278
  hitSlop: 6,
@@ -3245,7 +3315,7 @@ function MentionRow({
3245
3315
  {
3246
3316
  onPress,
3247
3317
  style: ({ pressed }) => [
3248
- styles13.row,
3318
+ styles14.row,
3249
3319
  { backgroundColor: pressed ? theme.colors.surfaceAlt : "transparent" }
3250
3320
  ],
3251
3321
  accessibilityRole: "menuitem",
@@ -3255,17 +3325,16 @@ function MentionRow({
3255
3325
  /* @__PURE__ */ jsx(
3256
3326
  Text,
3257
3327
  {
3258
- style: [styles13.rowText, { color: theme.colors.text, fontFamily: theme.fonts.body }],
3328
+ style: [styles14.rowText, { color: theme.colors.text, fontFamily: theme.fonts.body }],
3259
3329
  numberOfLines: 1,
3260
3330
  children: name
3261
3331
  }
3262
- ),
3263
- name !== externalId ? /* @__PURE__ */ jsx(Text, { style: [styles13.rowId, { color: theme.colors.textSubtle }], numberOfLines: 1, children: externalId }) : null
3332
+ )
3264
3333
  ]
3265
3334
  }
3266
3335
  );
3267
3336
  }
3268
- var styles13 = StyleSheet.create({
3337
+ var styles14 = StyleSheet.create({
3269
3338
  suggestions: {
3270
3339
  borderWidth: StyleSheet.hairlineWidth,
3271
3340
  marginBottom: 8,
@@ -3281,14 +3350,12 @@ var styles13 = StyleSheet.create({
3281
3350
  paddingVertical: 8,
3282
3351
  gap: 10
3283
3352
  },
3353
+ // The name alone, with the whole row's width: an id next to it only
3354
+ // pushed the name out.
3284
3355
  rowText: {
3356
+ flex: 1,
3285
3357
  fontSize: 14,
3286
- fontWeight: "500",
3287
- flexShrink: 1
3288
- },
3289
- rowId: {
3290
- fontSize: 12,
3291
- flexShrink: 1
3358
+ fontWeight: "500"
3292
3359
  },
3293
3360
  dismiss: {
3294
3361
  position: "absolute",
@@ -3399,15 +3466,15 @@ function MessageList({
3399
3466
  [renderItem, data.length]
3400
3467
  );
3401
3468
  if (loading && messages.length === 0) {
3402
- return /* @__PURE__ */ jsx(View, { style: [styles14.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent }) });
3469
+ return /* @__PURE__ */ jsx(View, { style: [styles15.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent }) });
3403
3470
  }
3404
3471
  if (messages.length === 0) {
3405
- return /* @__PURE__ */ jsxs(View, { style: [styles14.placeholder, { backgroundColor: theme.colors.background }], children: [
3406
- ListHeader ? /* @__PURE__ */ jsx(View, { style: styles14.emptyHeader, children: ListHeader }) : null,
3472
+ return /* @__PURE__ */ jsxs(View, { style: [styles15.placeholder, { backgroundColor: theme.colors.background }], children: [
3473
+ ListHeader ? /* @__PURE__ */ jsx(View, { style: styles15.emptyHeader, children: ListHeader }) : null,
3407
3474
  typeof emptyState === "string" ? /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState }) : emptyState ?? null
3408
3475
  ] });
3409
3476
  }
3410
- return /* @__PURE__ */ jsxs(View, { style: styles14.root, children: [
3477
+ return /* @__PURE__ */ jsxs(View, { style: styles15.root, children: [
3411
3478
  /* @__PURE__ */ jsx(
3412
3479
  FlatList,
3413
3480
  {
@@ -3437,7 +3504,7 @@ function MessageList({
3437
3504
  {
3438
3505
  onPress: scrollToBottom,
3439
3506
  style: [
3440
- styles14.jumpButton,
3507
+ styles15.jumpButton,
3441
3508
  {
3442
3509
  backgroundColor: theme.colors.accent
3443
3510
  },
@@ -3446,7 +3513,7 @@ function MessageList({
3446
3513
  accessibilityLabel: `${newCount} new ${newCount === 1 ? "message" : "messages"}, jump to latest`,
3447
3514
  children: [
3448
3515
  /* @__PURE__ */ jsx(PoolseIcon, { name: "chevron-down", size: 14, color: theme.colors.accentText }),
3449
- /* @__PURE__ */ jsxs(Text, { style: [styles14.jumpText, { color: theme.colors.accentText }], children: [
3516
+ /* @__PURE__ */ jsxs(Text, { style: [styles15.jumpText, { color: theme.colors.accentText }], children: [
3450
3517
  newCount,
3451
3518
  " new ",
3452
3519
  newCount === 1 ? "message" : "messages"
@@ -3457,7 +3524,7 @@ function MessageList({
3457
3524
  ] });
3458
3525
  }
3459
3526
  var VIEWABILITY = { itemVisiblePercentThreshold: 50 };
3460
- var styles14 = StyleSheet.create({
3527
+ var styles15 = StyleSheet.create({
3461
3528
  root: {
3462
3529
  flex: 1
3463
3530
  },
@@ -3496,13 +3563,13 @@ function CallLogRow({ msg, meId, onCallBack }) {
3496
3563
  const accent = display.missed ? theme.colors.danger : theme.colors.textSubtle;
3497
3564
  const time = formatTime(msg.inserted_at);
3498
3565
  const label = [display.title, display.detail, time].filter(Boolean).join(", ");
3499
- const metaStyle = [styles15.meta, { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }];
3500
- return /* @__PURE__ */ jsxs(View, { style: styles15.wrap, accessible: true, accessibilityLabel: label, children: [
3566
+ const metaStyle = [styles16.meta, { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }];
3567
+ return /* @__PURE__ */ jsxs(View, { style: styles16.wrap, accessible: true, accessibilityLabel: label, children: [
3501
3568
  /* @__PURE__ */ jsxs(
3502
3569
  View,
3503
3570
  {
3504
3571
  style: [
3505
- styles15.chip,
3572
+ styles16.chip,
3506
3573
  {
3507
3574
  backgroundColor: theme.colors.surfaceAlt,
3508
3575
  borderColor: theme.colors.border
@@ -3514,7 +3581,7 @@ function CallLogRow({ msg, meId, onCallBack }) {
3514
3581
  Text,
3515
3582
  {
3516
3583
  style: [
3517
- styles15.title,
3584
+ styles16.title,
3518
3585
  {
3519
3586
  color: display.missed ? theme.colors.danger : theme.colors.textMuted,
3520
3587
  fontFamily: theme.fonts.body
@@ -3542,12 +3609,12 @@ function CallLogRow({ msg, meId, onCallBack }) {
3542
3609
  accessibilityRole: "button",
3543
3610
  accessibilityLabel: display.media === "video" ? "Video call back" : "Call back",
3544
3611
  hitSlop: 8,
3545
- style: ({ pressed }) => [styles15.callBack, pressed && styles15.callBackPressed],
3612
+ style: ({ pressed }) => [styles16.callBack, pressed && styles16.callBackPressed],
3546
3613
  children: /* @__PURE__ */ jsx(
3547
3614
  Text,
3548
3615
  {
3549
3616
  style: [
3550
- styles15.callBackText,
3617
+ styles16.callBackText,
3551
3618
  { color: theme.colors.accent, fontFamily: theme.fonts.body }
3552
3619
  ],
3553
3620
  children: "Call back"
@@ -3562,7 +3629,7 @@ function formatTime(iso) {
3562
3629
  if (Number.isNaN(d.getTime())) return "";
3563
3630
  return d.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
3564
3631
  }
3565
- var styles15 = StyleSheet.create({
3632
+ var styles16 = StyleSheet.create({
3566
3633
  wrap: {
3567
3634
  alignItems: "center",
3568
3635
  alignSelf: "stretch",
@@ -3636,12 +3703,12 @@ function EditHistorySheet({
3636
3703
  live = false;
3637
3704
  };
3638
3705
  }, [visible, messageId, chat]);
3639
- const entry = (key, label, body, when) => /* @__PURE__ */ jsxs(View, { style: [styles16.entry, { borderBottomColor: theme.colors.border }], children: [
3640
- /* @__PURE__ */ jsxs(View, { style: styles16.entryHead, children: [
3641
- /* @__PURE__ */ jsx(Text, { style: [styles16.entryLabel, { color: theme.colors.textMuted }], children: label }),
3642
- when ? /* @__PURE__ */ jsx(Text, { style: [styles16.entryTime, { color: theme.colors.textSubtle }], children: when }) : null
3706
+ const entry = (key, label, body, when) => /* @__PURE__ */ jsxs(View, { style: [styles17.entry, { borderBottomColor: theme.colors.border }], children: [
3707
+ /* @__PURE__ */ jsxs(View, { style: styles17.entryHead, children: [
3708
+ /* @__PURE__ */ jsx(Text, { style: [styles17.entryLabel, { color: theme.colors.textMuted }], children: label }),
3709
+ when ? /* @__PURE__ */ jsx(Text, { style: [styles17.entryTime, { color: theme.colors.textSubtle }], children: when }) : null
3643
3710
  ] }),
3644
- /* @__PURE__ */ jsx(Text, { style: [styles16.entryBody, { color: theme.colors.text, fontFamily: theme.fonts.body }], children: body ?? "\u2014" })
3711
+ /* @__PURE__ */ jsx(Text, { style: [styles17.entryBody, { color: theme.colors.text, fontFamily: theme.fonts.body }], children: body ?? "\u2014" })
3645
3712
  ] }, key);
3646
3713
  return /* @__PURE__ */ jsx(
3647
3714
  Modal,
@@ -3654,14 +3721,14 @@ function EditHistorySheet({
3654
3721
  children: /* @__PURE__ */ jsx(
3655
3722
  Pressable,
3656
3723
  {
3657
- style: [styles16.backdrop, { backgroundColor: theme.colors.overlay }],
3724
+ style: [styles17.backdrop, { backgroundColor: theme.colors.overlay }],
3658
3725
  onPress: onClose,
3659
3726
  children: /* @__PURE__ */ jsxs(
3660
3727
  Pressable,
3661
3728
  {
3662
3729
  onPress: () => void 0,
3663
3730
  style: [
3664
- styles16.sheet,
3731
+ styles17.sheet,
3665
3732
  {
3666
3733
  backgroundColor: theme.colors.surface,
3667
3734
  borderTopLeftRadius: theme.radii.lg,
@@ -3676,12 +3743,12 @@ function EditHistorySheet({
3676
3743
  /* @__PURE__ */ jsx(
3677
3744
  Text,
3678
3745
  {
3679
- style: [styles16.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
3746
+ style: [styles17.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
3680
3747
  accessibilityRole: "header",
3681
3748
  children: "Edit history"
3682
3749
  }
3683
3750
  ),
3684
- failed ? /* @__PURE__ */ jsx(Text, { style: [styles16.status, { color: theme.colors.textMuted }], children: "Couldn't load the earlier versions." }) : edits === null ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent, style: styles16.spinner }) : /* @__PURE__ */ jsxs(ScrollView, { style: styles16.scroll, children: [
3751
+ failed ? /* @__PURE__ */ jsx(Text, { style: [styles17.status, { color: theme.colors.textMuted }], children: "Couldn't load the earlier versions." }) : edits === null ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent, style: styles17.spinner }) : /* @__PURE__ */ jsxs(ScrollView, { style: styles17.scroll, children: [
3685
3752
  currentBody !== void 0 ? entry("current", "Current", currentBody, "") : null,
3686
3753
  edits.map(
3687
3754
  (e) => entry(
@@ -3691,7 +3758,7 @@ function EditHistorySheet({
3691
3758
  relativeTime(e.written_at)
3692
3759
  )
3693
3760
  ),
3694
- edits.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [styles16.status, { color: theme.colors.textMuted }], children: "No earlier versions." }) : null
3761
+ edits.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [styles17.status, { color: theme.colors.textMuted }], children: "No earlier versions." }) : null
3695
3762
  ] })
3696
3763
  ]
3697
3764
  }
@@ -3701,7 +3768,7 @@ function EditHistorySheet({
3701
3768
  }
3702
3769
  );
3703
3770
  }
3704
- var styles16 = StyleSheet.create({
3771
+ var styles17 = StyleSheet.create({
3705
3772
  backdrop: {
3706
3773
  flex: 1,
3707
3774
  justifyContent: "flex-end"
@@ -3779,7 +3846,7 @@ function AttachmentPreview({
3779
3846
  View,
3780
3847
  {
3781
3848
  style: [
3782
- styles17.imagePlaceholder,
3849
+ styles18.imagePlaceholder,
3783
3850
  {
3784
3851
  width: maxWidth,
3785
3852
  height: 200,
@@ -3799,7 +3866,7 @@ function AttachmentPreview({
3799
3866
  onPress,
3800
3867
  disabled: !onPress,
3801
3868
  style: [
3802
- styles17.fileCard,
3869
+ styles18.fileCard,
3803
3870
  {
3804
3871
  backgroundColor: onBrand ? "rgba(255,255,255,0.18)" : theme.colors.surfaceAlt,
3805
3872
  borderColor: onBrand ? "transparent" : theme.colors.border,
@@ -3812,12 +3879,12 @@ function AttachmentPreview({
3812
3879
  /* @__PURE__ */ jsx(
3813
3880
  Text,
3814
3881
  {
3815
- style: [styles17.fileName, { color: ink, fontFamily: theme.fonts.body }],
3882
+ style: [styles18.fileName, { color: ink, fontFamily: theme.fonts.body }],
3816
3883
  numberOfLines: 1,
3817
3884
  children: attachment.original_filename ?? "file"
3818
3885
  }
3819
3886
  ),
3820
- /* @__PURE__ */ jsx(Text, { style: [styles17.fileSize, { color: inkSoft, opacity: onBrand ? 0.8 : 1 }], children: formatBytes3(attachment.byte_size) })
3887
+ /* @__PURE__ */ jsx(Text, { style: [styles18.fileSize, { color: inkSoft, opacity: onBrand ? 0.8 : 1 }], children: formatBytes3(attachment.byte_size) })
3821
3888
  ] })
3822
3889
  ]
3823
3890
  }
@@ -3829,7 +3896,7 @@ function formatBytes3(n) {
3829
3896
  if (n < 1024 * 1024 * 1024) return `${(n / 1024 / 1024).toFixed(1)} MB`;
3830
3897
  return `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;
3831
3898
  }
3832
- var styles17 = StyleSheet.create({
3899
+ var styles18 = StyleSheet.create({
3833
3900
  imagePlaceholder: {},
3834
3901
  fileCard: {
3835
3902
  flexDirection: "row",
@@ -3865,7 +3932,7 @@ function ImageMosaic({
3865
3932
  View,
3866
3933
  {
3867
3934
  style: [
3868
- styles18.root,
3935
+ styles19.root,
3869
3936
  {
3870
3937
  borderTopLeftRadius: r,
3871
3938
  borderTopRightRadius: r,
@@ -3886,18 +3953,18 @@ function ImageMosaic({
3886
3953
  {
3887
3954
  onLongPress,
3888
3955
  attachment: visible[0],
3889
- style: styles18.tileFull,
3956
+ style: styles19.tileFull,
3890
3957
  onPress: () => setViewerIndex(0),
3891
3958
  overlay: null
3892
3959
  }
3893
3960
  ) : null,
3894
- n === 2 ? /* @__PURE__ */ jsxs(View, { style: styles18.rowEven, children: [
3961
+ n === 2 ? /* @__PURE__ */ jsxs(View, { style: styles19.rowEven, children: [
3895
3962
  /* @__PURE__ */ jsx(
3896
3963
  Tile,
3897
3964
  {
3898
3965
  onLongPress,
3899
3966
  attachment: visible[0],
3900
- style: styles18.tileHalfSquare,
3967
+ style: styles19.tileHalfSquare,
3901
3968
  onPress: () => setViewerIndex(0),
3902
3969
  overlay: null
3903
3970
  }
@@ -3907,7 +3974,7 @@ function ImageMosaic({
3907
3974
  {
3908
3975
  onLongPress,
3909
3976
  attachment: visible[1],
3910
- style: styles18.tileHalfSquare,
3977
+ style: styles19.tileHalfSquare,
3911
3978
  onPress: () => setViewerIndex(1),
3912
3979
  overlay: null
3913
3980
  }
@@ -3919,18 +3986,18 @@ function ImageMosaic({
3919
3986
  {
3920
3987
  onLongPress,
3921
3988
  attachment: visible[0],
3922
- style: styles18.tileHero,
3989
+ style: styles19.tileHero,
3923
3990
  onPress: () => setViewerIndex(0),
3924
3991
  overlay: null
3925
3992
  }
3926
3993
  ),
3927
- /* @__PURE__ */ jsxs(View, { style: [styles18.rowEven, { marginTop: 2 }], children: [
3994
+ /* @__PURE__ */ jsxs(View, { style: [styles19.rowEven, { marginTop: 2 }], children: [
3928
3995
  /* @__PURE__ */ jsx(
3929
3996
  Tile,
3930
3997
  {
3931
3998
  onLongPress,
3932
3999
  attachment: visible[1],
3933
- style: styles18.tileHalfSquare,
4000
+ style: styles19.tileHalfSquare,
3934
4001
  onPress: () => setViewerIndex(1),
3935
4002
  overlay: null
3936
4003
  }
@@ -3940,7 +4007,7 @@ function ImageMosaic({
3940
4007
  {
3941
4008
  onLongPress,
3942
4009
  attachment: visible[2],
3943
- style: styles18.tileHalfSquare,
4010
+ style: styles19.tileHalfSquare,
3944
4011
  onPress: () => setViewerIndex(2),
3945
4012
  overlay: null
3946
4013
  }
@@ -3948,13 +4015,13 @@ function ImageMosaic({
3948
4015
  ] })
3949
4016
  ] }) : null,
3950
4017
  n === 4 ? /* @__PURE__ */ jsxs(Fragment, { children: [
3951
- /* @__PURE__ */ jsxs(View, { style: styles18.rowEven, children: [
4018
+ /* @__PURE__ */ jsxs(View, { style: styles19.rowEven, children: [
3952
4019
  /* @__PURE__ */ jsx(
3953
4020
  Tile,
3954
4021
  {
3955
4022
  onLongPress,
3956
4023
  attachment: visible[0],
3957
- style: styles18.tileHalfSquare,
4024
+ style: styles19.tileHalfSquare,
3958
4025
  onPress: () => setViewerIndex(0),
3959
4026
  overlay: null
3960
4027
  }
@@ -3964,19 +4031,19 @@ function ImageMosaic({
3964
4031
  {
3965
4032
  onLongPress,
3966
4033
  attachment: visible[1],
3967
- style: styles18.tileHalfSquare,
4034
+ style: styles19.tileHalfSquare,
3968
4035
  onPress: () => setViewerIndex(1),
3969
4036
  overlay: null
3970
4037
  }
3971
4038
  )
3972
4039
  ] }),
3973
- /* @__PURE__ */ jsxs(View, { style: [styles18.rowEven, { marginTop: 2 }], children: [
4040
+ /* @__PURE__ */ jsxs(View, { style: [styles19.rowEven, { marginTop: 2 }], children: [
3974
4041
  /* @__PURE__ */ jsx(
3975
4042
  Tile,
3976
4043
  {
3977
4044
  onLongPress,
3978
4045
  attachment: visible[2],
3979
- style: styles18.tileHalfSquare,
4046
+ style: styles19.tileHalfSquare,
3980
4047
  onPress: () => setViewerIndex(2),
3981
4048
  overlay: null
3982
4049
  }
@@ -3986,7 +4053,7 @@ function ImageMosaic({
3986
4053
  {
3987
4054
  onLongPress,
3988
4055
  attachment: visible[3],
3989
- style: styles18.tileHalfSquare,
4056
+ style: styles19.tileHalfSquare,
3990
4057
  onPress: () => setViewerIndex(3),
3991
4058
  overlay: overflow > 0 ? `+${overflow}` : null
3992
4059
  }
@@ -4024,18 +4091,18 @@ function Tile({
4024
4091
  }) {
4025
4092
  const theme = useTheme();
4026
4093
  const { url } = useAttachmentUrl(attachment.id);
4027
- return /* @__PURE__ */ jsxs(Pressable, { onPress, onLongPress, style: [styles18.tileBase, style], children: [
4094
+ return /* @__PURE__ */ jsxs(Pressable, { onPress, onLongPress, style: [styles19.tileBase, style], children: [
4028
4095
  url ? /* @__PURE__ */ jsx(
4029
4096
  Image,
4030
4097
  {
4031
4098
  source: { uri: url },
4032
- style: [styles18.tileImage, { backgroundColor: theme.colors.surfaceAlt }],
4099
+ style: [styles19.tileImage, { backgroundColor: theme.colors.surfaceAlt }],
4033
4100
  resizeMode: "cover",
4034
4101
  accessible: true,
4035
4102
  accessibilityLabel: attachment.original_filename ?? "image"
4036
4103
  }
4037
- ) : /* @__PURE__ */ jsx(View, { style: [styles18.tileImage, { backgroundColor: theme.colors.surfaceAlt }] }),
4038
- overlay ? /* @__PURE__ */ jsx(View, { style: styles18.overflow, children: /* @__PURE__ */ jsx(Text, { style: styles18.overflowText, children: overlay }) }) : null
4104
+ ) : /* @__PURE__ */ jsx(View, { style: [styles19.tileImage, { backgroundColor: theme.colors.surfaceAlt }] }),
4105
+ overlay ? /* @__PURE__ */ jsx(View, { style: styles19.overflow, children: /* @__PURE__ */ jsx(Text, { style: styles19.overflowText, children: overlay }) }) : null
4039
4106
  ] });
4040
4107
  }
4041
4108
  function FullScreenViewer({
@@ -4045,7 +4112,7 @@ function FullScreenViewer({
4045
4112
  const { url } = useAttachmentUrl(attachment.id);
4046
4113
  const { width, height } = useWindowDimensions();
4047
4114
  const insets = useSafeInsets();
4048
- return /* @__PURE__ */ jsxs(Pressable, { style: styles18.viewer, onPress: onClose, children: [
4115
+ return /* @__PURE__ */ jsxs(Pressable, { style: styles19.viewer, onPress: onClose, children: [
4049
4116
  url ? /* @__PURE__ */ jsx(
4050
4117
  Image,
4051
4118
  {
@@ -4061,14 +4128,14 @@ function FullScreenViewer({
4061
4128
  {
4062
4129
  onPress: onClose,
4063
4130
  hitSlop: 12,
4064
- style: [styles18.closeBtn, { top: insets.top + 12, right: insets.right + 16 }],
4131
+ style: [styles19.closeBtn, { top: insets.top + 12, right: insets.right + 16 }],
4065
4132
  accessibilityLabel: "Close viewer",
4066
4133
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 20, color: "#ffffff" })
4067
4134
  }
4068
4135
  )
4069
4136
  ] });
4070
4137
  }
4071
- var styles18 = StyleSheet.create({
4138
+ var styles19 = StyleSheet.create({
4072
4139
  root: {
4073
4140
  width: "100%",
4074
4141
  overflow: "hidden",
@@ -4206,6 +4273,9 @@ function formatClock(date, format2) {
4206
4273
  }
4207
4274
  return date.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
4208
4275
  }
4276
+ function gutterTime(time) {
4277
+ return time.replace(/\s+(?=[AaPp]\.?[Mm]\.?$)/, "").replace(/\u202f/g, "");
4278
+ }
4209
4279
  function formatMessageTime(iso, format2) {
4210
4280
  if (!iso) return "";
4211
4281
  const date = new Date(iso);
@@ -4238,7 +4308,7 @@ function LinkPreviewCard({
4238
4308
  {
4239
4309
  onPress: onRemove,
4240
4310
  hitSlop: 8,
4241
- style: [styles19.remove, { backgroundColor: theme.colors.overlay }],
4311
+ style: [styles20.remove, { backgroundColor: theme.colors.overlay }],
4242
4312
  accessibilityRole: "button",
4243
4313
  accessibilityLabel: "Remove preview",
4244
4314
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 12, color: "#FFFFFF", label: null })
@@ -4254,13 +4324,13 @@ function LinkPreviewCard({
4254
4324
  ...onLongPress ? { onLongPress } : {},
4255
4325
  accessibilityRole: "link",
4256
4326
  accessibilityLabel: preview.title || "Image link",
4257
- style: [styles19.imageOnly, { maxWidth, borderRadius: theme.radii.md }],
4327
+ style: [styles20.imageOnly, { maxWidth, borderRadius: theme.radii.md }],
4258
4328
  children: [
4259
4329
  /* @__PURE__ */ jsx(
4260
4330
  Image,
4261
4331
  {
4262
4332
  source: { uri: src },
4263
- style: [styles19.inlineImage, { borderRadius: theme.radii.md }],
4333
+ style: [styles20.inlineImage, { borderRadius: theme.radii.md }],
4264
4334
  resizeMode: "cover",
4265
4335
  onError: () => setImageFailed(true),
4266
4336
  accessible: false
@@ -4280,7 +4350,7 @@ function LinkPreviewCard({
4280
4350
  accessibilityRole: "link",
4281
4351
  accessibilityLabel: [site, preview.title].filter(Boolean).join(": ") || preview.url,
4282
4352
  style: ({ pressed }) => [
4283
- styles19.card,
4353
+ styles20.card,
4284
4354
  {
4285
4355
  maxWidth,
4286
4356
  borderRadius: theme.radii.md,
@@ -4295,7 +4365,7 @@ function LinkPreviewCard({
4295
4365
  {
4296
4366
  source: { uri: preview.image_url },
4297
4367
  style: [
4298
- styles19.cardImage,
4368
+ styles20.cardImage,
4299
4369
  { borderTopLeftRadius: theme.radii.md, borderTopRightRadius: theme.radii.md }
4300
4370
  ],
4301
4371
  resizeMode: "cover",
@@ -4303,13 +4373,13 @@ function LinkPreviewCard({
4303
4373
  accessible: false
4304
4374
  }
4305
4375
  ) : null,
4306
- /* @__PURE__ */ jsxs(View, { style: [styles19.cardBody, { padding: theme.spacing.sm, gap: 2 }], children: [
4307
- /* @__PURE__ */ jsxs(View, { style: styles19.siteLine, children: [
4376
+ /* @__PURE__ */ jsxs(View, { style: [styles20.cardBody, { padding: theme.spacing.sm, gap: 2 }], children: [
4377
+ /* @__PURE__ */ jsxs(View, { style: styles20.siteLine, children: [
4308
4378
  preview.favicon_url && !faviconFailed ? /* @__PURE__ */ jsx(
4309
4379
  Image,
4310
4380
  {
4311
4381
  source: { uri: preview.favicon_url },
4312
- style: styles19.favicon,
4382
+ style: styles20.favicon,
4313
4383
  onError: () => setFaviconFailed(true),
4314
4384
  accessible: false
4315
4385
  }
@@ -4317,7 +4387,7 @@ function LinkPreviewCard({
4317
4387
  /* @__PURE__ */ jsx(
4318
4388
  Text,
4319
4389
  {
4320
- style: [styles19.site, { color: muted, fontFamily: theme.fonts.body }],
4390
+ style: [styles20.site, { color: muted, fontFamily: theme.fonts.body }],
4321
4391
  numberOfLines: 1,
4322
4392
  children: site
4323
4393
  }
@@ -4327,7 +4397,7 @@ function LinkPreviewCard({
4327
4397
  Text,
4328
4398
  {
4329
4399
  style: [
4330
- styles19.title,
4400
+ styles20.title,
4331
4401
  { color: onBrand ? text : theme.colors.link, fontFamily: theme.fonts.body }
4332
4402
  ],
4333
4403
  numberOfLines: 2,
@@ -4337,7 +4407,7 @@ function LinkPreviewCard({
4337
4407
  preview.description ? /* @__PURE__ */ jsx(
4338
4408
  Text,
4339
4409
  {
4340
- style: [styles19.description, { color: muted, fontFamily: theme.fonts.body }],
4410
+ style: [styles20.description, { color: muted, fontFamily: theme.fonts.body }],
4341
4411
  numberOfLines: 2,
4342
4412
  children: preview.description
4343
4413
  }
@@ -4352,7 +4422,7 @@ function hostOf(url) {
4352
4422
  const m = /^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i.exec(url);
4353
4423
  return (m?.[1] ?? url).replace(/^www\./, "");
4354
4424
  }
4355
- var styles19 = StyleSheet.create({
4425
+ var styles20 = StyleSheet.create({
4356
4426
  card: {
4357
4427
  alignSelf: "stretch",
4358
4428
  borderLeftWidth: 3,
@@ -4478,16 +4548,16 @@ function MessageBubble({
4478
4548
  View,
4479
4549
  {
4480
4550
  style: [
4481
- styles20.metaRow,
4482
- variant === "inline" && styles20.metaInline,
4483
- variant === "inline" && dense && styles20.metaInlineDense,
4484
- variant === "wrapped" && styles20.metaWrapped,
4485
- variant === "overlay" && styles20.metaOverlay,
4486
- variant === "block" && styles20.metaBlock,
4551
+ styles21.metaRow,
4552
+ variant === "inline" && styles21.metaInline,
4553
+ variant === "inline" && dense && styles21.metaInlineDense,
4554
+ variant === "wrapped" && styles21.metaWrapped,
4555
+ variant === "overlay" && styles21.metaOverlay,
4556
+ variant === "block" && styles21.metaBlock,
4487
4557
  // File-only bubble: the meta row follows the cards directly —
4488
4558
  // give it air so the time doesn't sit glued to the card.
4489
- variant === "block" && hasFiles && !hasBody && styles20.metaBlockAfterFiles,
4490
- variant === "jumbo" && styles20.metaJumbo
4559
+ variant === "block" && hasFiles && !hasBody && styles21.metaBlockAfterFiles,
4560
+ variant === "jumbo" && styles21.metaJumbo
4491
4561
  ],
4492
4562
  onLayout: variant === "inline" || variant === "wrapped" ? (e) => setMetaWidth(e.nativeEvent.layout.width) : void 0,
4493
4563
  pointerEvents: isEdited && onEditedPress ? "box-none" : "none",
@@ -4495,7 +4565,7 @@ function MessageBubble({
4495
4565
  isEdited ? /* @__PURE__ */ jsx(
4496
4566
  Text,
4497
4567
  {
4498
- style: [styles20.editedTag, { color, opacity: 0.8 }],
4568
+ style: [styles21.editedTag, { color, opacity: 0.8 }],
4499
4569
  ...onEditedPress ? {
4500
4570
  onPress: onEditedPress,
4501
4571
  suppressHighlighting: true,
@@ -4506,8 +4576,8 @@ function MessageBubble({
4506
4576
  children: "edited"
4507
4577
  }
4508
4578
  ) : null,
4509
- /* @__PURE__ */ jsx(Text, { style: [styles20.meta, { color, opacity: variant === "overlay" ? 1 : 0.75 }], children: time }),
4510
- isSelf && readState ? /* @__PURE__ */ jsx(View, { style: styles20.readTick, children: /* @__PURE__ */ jsx(
4579
+ /* @__PURE__ */ jsx(Text, { style: [styles21.meta, { color, opacity: variant === "overlay" ? 1 : 0.75 }], children: time }),
4580
+ isSelf && readState ? /* @__PURE__ */ jsx(View, { style: styles21.readTick, children: /* @__PURE__ */ jsx(
4511
4581
  PoolseIcon,
4512
4582
  {
4513
4583
  name: readState === "read" ? "check-double" : "check",
@@ -4523,7 +4593,7 @@ function MessageBubble({
4523
4593
  View,
4524
4594
  {
4525
4595
  style: [
4526
- styles20.wrap,
4596
+ styles21.wrap,
4527
4597
  { alignSelf: isSelf ? "flex-end" : "flex-start", maxWidth: bubbleMaxWidth }
4528
4598
  ],
4529
4599
  children: [
@@ -4549,7 +4619,7 @@ function MessageBubble({
4549
4619
  showSenderName && !isSelf && jumboCount === 0 && (groupPosition === "first" || groupPosition === "standalone") ? /* @__PURE__ */ jsx(
4550
4620
  Text,
4551
4621
  {
4552
- style: [styles20.senderName, { color: senderTint, fontFamily: theme.fonts.body }],
4622
+ style: [styles21.senderName, { color: senderTint, fontFamily: theme.fonts.body }],
4553
4623
  ...onSenderPress ? {
4554
4624
  onPress: onSenderPress,
4555
4625
  accessibilityRole: "button",
@@ -4576,7 +4646,7 @@ function MessageBubble({
4576
4646
  // 3px of bubble color framing the picture; the mosaic clips
4577
4647
  // itself 3px tighter than the bubble so the curves stay
4578
4648
  // concentric.
4579
- /* @__PURE__ */ jsxs(View, { style: styles20.mediaFrame, children: [
4649
+ /* @__PURE__ */ jsxs(View, { style: styles21.mediaFrame, children: [
4580
4650
  /* @__PURE__ */ jsx(
4581
4651
  ImageMosaic,
4582
4652
  {
@@ -4590,7 +4660,7 @@ function MessageBubble({
4590
4660
  metaOverlay ? metaRow("overlay") : null
4591
4661
  ] })
4592
4662
  ) : null,
4593
- hasFiles ? /* @__PURE__ */ jsx(View, { style: styles20.filesBlock, children: files.map((att) => /* @__PURE__ */ jsx(
4663
+ hasFiles ? /* @__PURE__ */ jsx(View, { style: styles21.filesBlock, children: files.map((att) => /* @__PURE__ */ jsx(
4594
4664
  AttachmentPreview,
4595
4665
  {
4596
4666
  attachment: att,
@@ -4609,9 +4679,9 @@ function MessageBubble({
4609
4679
  View,
4610
4680
  {
4611
4681
  style: [
4612
- styles20.textBlock,
4613
- dense && styles20.textBlockDense,
4614
- sectionAbove && styles20.textBlockAfter
4682
+ styles21.textBlock,
4683
+ dense && styles21.textBlockDense,
4684
+ sectionAbove && styles21.textBlockAfter
4615
4685
  ],
4616
4686
  children: /* @__PURE__ */ jsx(
4617
4687
  Text,
@@ -4629,7 +4699,7 @@ function MessageBubble({
4629
4699
  )
4630
4700
  }
4631
4701
  ) : null,
4632
- hasBody && jumboCount > 0 ? /* @__PURE__ */ jsx(View, { style: styles20.jumboBlock, children: /* @__PURE__ */ jsx(
4702
+ hasBody && jumboCount > 0 ? /* @__PURE__ */ jsx(View, { style: styles21.jumboBlock, children: /* @__PURE__ */ jsx(
4633
4703
  Text,
4634
4704
  {
4635
4705
  style: {
@@ -4643,9 +4713,9 @@ function MessageBubble({
4643
4713
  View,
4644
4714
  {
4645
4715
  style: [
4646
- styles20.textBlock,
4647
- dense && styles20.textBlockDense,
4648
- sectionAbove && styles20.textBlockAfter
4716
+ styles21.textBlock,
4717
+ dense && styles21.textBlockDense,
4718
+ sectionAbove && styles21.textBlockAfter
4649
4719
  ],
4650
4720
  onLayout: inlineMeta ? (e) => setTextBoxWidth(e.nativeEvent.layout.width - 24) : void 0,
4651
4721
  children: [
@@ -4680,7 +4750,7 @@ function MessageBubble({
4680
4750
  Text,
4681
4751
  {
4682
4752
  style: [
4683
- styles20.readMore,
4753
+ styles21.readMore,
4684
4754
  { color: isSelf ? theme.colors.ownBubbleText : theme.colors.link }
4685
4755
  ],
4686
4756
  children: expanded ? "Show less" : "Read more"
@@ -4695,7 +4765,7 @@ function MessageBubble({
4695
4765
  hasPreviews ? (
4696
4766
  // A fixed width, like media: a card squeezed into the width of
4697
4767
  // a one-word message would be unreadable.
4698
- /* @__PURE__ */ jsx(View, { style: [styles20.previews, !hasBody && styles20.previewsAlone, { width: mediaWidth }], children: previews.map((p) => /* @__PURE__ */ jsx(
4768
+ /* @__PURE__ */ jsx(View, { style: [styles21.previews, !hasBody && styles21.previewsAlone, { width: mediaWidth }], children: previews.map((p) => /* @__PURE__ */ jsx(
4699
4769
  LinkPreviewCard,
4700
4770
  {
4701
4771
  preview: p,
@@ -4707,7 +4777,7 @@ function MessageBubble({
4707
4777
  )) })
4708
4778
  ) : null,
4709
4779
  !inlineMeta && !metaOverlay && jumboCount === 0 ? metaRow("block") : null,
4710
- actionsTrigger ? /* @__PURE__ */ jsx(View, { style: styles20.actionsSlot, children: actionsTrigger }) : null
4780
+ actionsTrigger ? /* @__PURE__ */ jsx(View, { style: styles21.actionsSlot, children: actionsTrigger }) : null
4711
4781
  ]
4712
4782
  }
4713
4783
  ),
@@ -4734,15 +4804,15 @@ function QuotedCard({
4734
4804
  onPress,
4735
4805
  disabled: !onPress,
4736
4806
  style: [
4737
- styles20.quoted,
4807
+ styles21.quoted,
4738
4808
  {
4739
4809
  backgroundColor: bg,
4740
4810
  borderLeftColor: accent
4741
4811
  }
4742
4812
  ],
4743
4813
  children: [
4744
- /* @__PURE__ */ jsx(Text, { style: [styles20.quotedSender, { color: accent }], numberOfLines: 1, children: senderName }),
4745
- /* @__PURE__ */ jsx(Text, { style: [styles20.quotedBody, { color: txt }], numberOfLines: 2, children: quoted.deleted_at ? "Original message deleted" : quoted.body ?? "\u2026" })
4814
+ /* @__PURE__ */ jsx(Text, { style: [styles21.quotedSender, { color: accent }], numberOfLines: 1, children: senderName }),
4815
+ /* @__PURE__ */ jsx(Text, { style: [styles21.quotedBody, { color: txt }], numberOfLines: 2, children: quoted.deleted_at ? "Original message deleted" : quoted.body ?? "\u2026" })
4746
4816
  ]
4747
4817
  }
4748
4818
  );
@@ -4775,7 +4845,7 @@ function formatTime2(iso, format2) {
4775
4845
  function isSameDay(a, b) {
4776
4846
  return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
4777
4847
  }
4778
- var styles20 = StyleSheet.create({
4848
+ var styles21 = StyleSheet.create({
4779
4849
  wrap: {
4780
4850
  marginBottom: 2
4781
4851
  },
@@ -4902,6 +4972,24 @@ var styles20 = StyleSheet.create({
4902
4972
  opacity: 0.8
4903
4973
  }
4904
4974
  });
4975
+
4976
+ // src/internal/a11y.ts
4977
+ function messageA11yLabel(msg, senderName, isSelf) {
4978
+ const who = isSelf ? "You" : senderName;
4979
+ if (msg.deleted_at) return `${who}: message deleted`;
4980
+ const parts = [];
4981
+ const body = (msg.body ?? "").trim();
4982
+ if (body) parts.push(body.length > 300 ? `${body.slice(0, 300)}\u2026` : body);
4983
+ const files = Array.isArray(msg.attachments) ? msg.attachments.length : 0;
4984
+ if (files > 0) parts.push(files === 1 ? "1 attachment" : `${files} attachments`);
4985
+ if (msg.edited_at) parts.push("edited");
4986
+ if (msg.local_status === "queued") parts.push("waiting for network");
4987
+ if (msg.local_status === "failed") parts.push("not sent");
4988
+ return `${who}: ${parts.join(", ") || "message"}`;
4989
+ }
4990
+ function reactionA11yLabel(emoji, count, mine) {
4991
+ return `${emoji} ${count}${mine ? ", you reacted" : ""}`;
4992
+ }
4905
4993
  var DEFAULT_EMOJIS = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}", "\u{1F64F}", "\u{1F525}"];
4906
4994
  function ReactionStrip({
4907
4995
  messageId,
@@ -4918,7 +5006,7 @@ function ReactionStrip({
4918
5006
  });
4919
5007
  const entries = Object.entries(reactions);
4920
5008
  if (entries.length === 0) return null;
4921
- return /* @__PURE__ */ jsxs(View, { style: styles21.strip, children: [
5009
+ return /* @__PURE__ */ jsxs(View, { style: styles22.strip, children: [
4922
5010
  entries.map(([emoji, userIds]) => {
4923
5011
  const userArr = Array.isArray(userIds) ? userIds : [];
4924
5012
  const meReacted = meId !== null && userArr.includes(meId);
@@ -4926,8 +5014,12 @@ function ReactionStrip({
4926
5014
  Pressable,
4927
5015
  {
4928
5016
  onPress: () => meReacted ? removeReaction(emoji) : addReaction(emoji),
5017
+ accessibilityRole: "button",
5018
+ accessibilityLabel: reactionA11yLabel(emoji, userArr.length, meReacted),
5019
+ accessibilityState: { selected: meReacted },
5020
+ accessibilityHint: meReacted ? "Removes your reaction" : "Adds this reaction",
4929
5021
  style: [
4930
- styles21.chip,
5022
+ styles22.chip,
4931
5023
  {
4932
5024
  backgroundColor: meReacted ? theme.colors.accentSoft : theme.colors.surfaceAlt,
4933
5025
  borderColor: meReacted ? theme.colors.accent : theme.colors.border,
@@ -4936,12 +5028,12 @@ function ReactionStrip({
4936
5028
  }
4937
5029
  ],
4938
5030
  children: [
4939
- /* @__PURE__ */ jsx(Text, { style: styles21.emoji, children: emoji }),
5031
+ /* @__PURE__ */ jsx(Text, { style: styles22.emoji, children: emoji }),
4940
5032
  /* @__PURE__ */ jsx(
4941
5033
  Text,
4942
5034
  {
4943
5035
  style: [
4944
- styles21.count,
5036
+ styles22.count,
4945
5037
  {
4946
5038
  color: meReacted ? theme.colors.accent : theme.colors.textMuted,
4947
5039
  fontWeight: meReacted ? "700" : "600"
@@ -4961,7 +5053,7 @@ function ReactionStrip({
4961
5053
  onPress: onMorePress,
4962
5054
  hitSlop: 4,
4963
5055
  style: [
4964
- styles21.chip,
5056
+ styles22.chip,
4965
5057
  {
4966
5058
  backgroundColor: theme.colors.surfaceAlt,
4967
5059
  borderColor: theme.colors.border,
@@ -4994,13 +5086,13 @@ function ReactionPicker({
4994
5086
  children: /* @__PURE__ */ jsx(
4995
5087
  Pressable,
4996
5088
  {
4997
- style: [styles21.backdrop, { paddingTop: insets.top, paddingBottom: insets.bottom }],
5089
+ style: [styles22.backdrop, { paddingTop: insets.top, paddingBottom: insets.bottom }],
4998
5090
  onPress: onClose,
4999
5091
  children: /* @__PURE__ */ jsx(
5000
5092
  View,
5001
5093
  {
5002
5094
  style: [
5003
- styles21.sheet,
5095
+ styles22.sheet,
5004
5096
  {
5005
5097
  backgroundColor: theme.colors.surface,
5006
5098
  borderRadius: theme.radii.lg
@@ -5010,12 +5102,12 @@ function ReactionPicker({
5010
5102
  children: emojis.map((emoji) => /* @__PURE__ */ jsx(
5011
5103
  Pressable,
5012
5104
  {
5013
- style: styles21.emojiBtn,
5105
+ style: styles22.emojiBtn,
5014
5106
  onPress: () => {
5015
5107
  onPick(emoji);
5016
5108
  onClose();
5017
5109
  },
5018
- children: /* @__PURE__ */ jsx(Text, { style: styles21.bigEmoji, children: emoji })
5110
+ children: /* @__PURE__ */ jsx(Text, { style: styles22.bigEmoji, children: emoji })
5019
5111
  },
5020
5112
  emoji
5021
5113
  ))
@@ -5026,7 +5118,7 @@ function ReactionPicker({
5026
5118
  }
5027
5119
  );
5028
5120
  }
5029
- var styles21 = StyleSheet.create({
5121
+ var styles22 = StyleSheet.create({
5030
5122
  strip: {
5031
5123
  flexDirection: "row",
5032
5124
  flexWrap: "wrap",
@@ -5082,6 +5174,69 @@ var styles21 = StyleSheet.create({
5082
5174
  lineHeight: 38
5083
5175
  }
5084
5176
  });
5177
+ function SendStatus({ message, onRetry, onDiscard, alignEnd = true }) {
5178
+ const theme = useTheme();
5179
+ const status = message.local_status;
5180
+ if (status !== "queued" && status !== "failed") return null;
5181
+ const failed = status === "failed";
5182
+ const text = failed ? message.local_error ? `Not sent: ${message.local_error}` : "Not sent" : "Waiting for network\u2026";
5183
+ const button = (label, onPress, danger = false) => /* @__PURE__ */ jsx(
5184
+ Pressable,
5185
+ {
5186
+ onPress,
5187
+ accessibilityRole: "button",
5188
+ accessibilityLabel: `${label} message`,
5189
+ hitSlop: 8,
5190
+ style: styles23.button,
5191
+ children: /* @__PURE__ */ jsx(
5192
+ Text,
5193
+ {
5194
+ style: [
5195
+ styles23.buttonText,
5196
+ { color: danger ? theme.colors.danger : theme.colors.accentStrong },
5197
+ { fontFamily: theme.fonts.body }
5198
+ ],
5199
+ children: label
5200
+ }
5201
+ )
5202
+ }
5203
+ );
5204
+ return /* @__PURE__ */ jsxs(
5205
+ View,
5206
+ {
5207
+ style: [styles23.root, { justifyContent: alignEnd ? "flex-end" : "flex-start" }],
5208
+ accessibilityLiveRegion: "polite",
5209
+ children: [
5210
+ /* @__PURE__ */ jsx(
5211
+ Text,
5212
+ {
5213
+ style: [
5214
+ styles23.text,
5215
+ { color: failed ? theme.colors.danger : theme.colors.textMuted },
5216
+ { fontFamily: theme.fonts.body }
5217
+ ],
5218
+ children: text
5219
+ }
5220
+ ),
5221
+ onRetry ? button(failed ? "Retry" : "Send now", onRetry) : null,
5222
+ failed && onDiscard ? button("Delete", onDiscard, true) : null
5223
+ ]
5224
+ }
5225
+ );
5226
+ }
5227
+ var styles23 = StyleSheet.create({
5228
+ root: {
5229
+ flexDirection: "row",
5230
+ flexWrap: "wrap",
5231
+ alignItems: "center",
5232
+ gap: 10,
5233
+ marginTop: 2,
5234
+ marginBottom: 4
5235
+ },
5236
+ text: { fontSize: 12, flexShrink: 1 },
5237
+ button: { paddingVertical: 2 },
5238
+ buttonText: { fontSize: 12, fontWeight: "700" }
5239
+ });
5085
5240
 
5086
5241
  // src/internal/thread.ts
5087
5242
  function threadSummaryText(replyCount, lastReplyAt, now = Date.now()) {
@@ -5122,7 +5277,7 @@ function ThreadSummary({
5122
5277
  accessibilityLabel: `${label}. Open thread`,
5123
5278
  hitSlop: 4,
5124
5279
  style: ({ pressed }) => [
5125
- styles22.row,
5280
+ styles24.row,
5126
5281
  {
5127
5282
  alignSelf: alignEnd ? "flex-end" : "flex-start",
5128
5283
  borderRadius: theme.radii.pill,
@@ -5130,11 +5285,11 @@ function ThreadSummary({
5130
5285
  }
5131
5286
  ],
5132
5287
  children: [
5133
- people.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles22.stack, children: people.map((p, i) => /* @__PURE__ */ jsx(
5288
+ people.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles24.stack, children: people.map((p, i) => /* @__PURE__ */ jsx(
5134
5289
  View,
5135
5290
  {
5136
5291
  style: [
5137
- styles22.stacked,
5292
+ styles24.stacked,
5138
5293
  {
5139
5294
  marginLeft: i === 0 ? 0 : -6,
5140
5295
  borderColor: theme.colors.background,
@@ -5156,7 +5311,7 @@ function ThreadSummary({
5156
5311
  /* @__PURE__ */ jsx(
5157
5312
  Text,
5158
5313
  {
5159
- style: [styles22.text, { color: theme.colors.link, fontFamily: theme.fonts.body }],
5314
+ style: [styles24.text, { color: theme.colors.link, fontFamily: theme.fonts.body }],
5160
5315
  numberOfLines: 1,
5161
5316
  children: label
5162
5317
  }
@@ -5176,7 +5331,7 @@ function Participant({
5176
5331
  const src = externalId ? avatarFor?.(externalId) ?? resolved.profile?.avatarUrl ?? null : null;
5177
5332
  return /* @__PURE__ */ jsx(Avatar, { src, name, seed: externalId ?? fallback, size: "xs" });
5178
5333
  }
5179
- var styles22 = StyleSheet.create({
5334
+ var styles24 = StyleSheet.create({
5180
5335
  row: {
5181
5336
  flexDirection: "row",
5182
5337
  alignItems: "center",
@@ -5231,7 +5386,9 @@ function FlatMessageRow({
5231
5386
  linkPreviews = true,
5232
5387
  onRemoveLinkPreview,
5233
5388
  onMarkUnread,
5234
- editHistory = true
5389
+ editHistory = true,
5390
+ onRetrySend,
5391
+ onDiscardSend
5235
5392
  }) {
5236
5393
  const theme = useTheme();
5237
5394
  const { width: screenWidth } = useWindowDimensions();
@@ -5260,9 +5417,10 @@ function FlatMessageRow({
5260
5417
  const isRunStart = compact || groupPosition === "first" || groupPosition === "standalone";
5261
5418
  const ctx = { message: msg, isSelf, sender, layout, isRunStart };
5262
5419
  const deleted = isTombstone(msg);
5420
+ const inert = deleted || !!msg.local_status;
5263
5421
  const time = formatMessageTime(msg.inserted_at, timeFormat);
5264
5422
  const openActions = () => {
5265
- if (actions && !deleted) setActionsOpen(true);
5423
+ if (actions && !inert) setActionsOpen(true);
5266
5424
  };
5267
5425
  const text = { fontFamily: theme.fonts.body, color: theme.colors.text };
5268
5426
  const avatarEl = showAvatar ? /* @__PURE__ */ jsx(
@@ -5289,10 +5447,10 @@ function FlatMessageRow({
5289
5447
  Text,
5290
5448
  {
5291
5449
  style: [
5292
- styles23.name,
5450
+ styles25.name,
5293
5451
  text,
5294
5452
  compact ? { color: userColor(ext ?? msg.sender_id ?? msg.id) } : null,
5295
- compact ? styles23.nameCompact : null
5453
+ compact ? styles25.nameCompact : null
5296
5454
  ],
5297
5455
  numberOfLines: 1,
5298
5456
  ...onSenderPress && !isSelf ? {
@@ -5307,21 +5465,22 @@ function FlatMessageRow({
5307
5465
  Text,
5308
5466
  {
5309
5467
  style: [
5310
- styles23.time,
5468
+ styles25.time,
5311
5469
  { color: theme.colors.textSubtle, fontFamily: theme.fonts.body },
5312
- dim ? styles23.timeDim : null
5470
+ dim ? styles25.timeDim : null
5313
5471
  ],
5314
- children: time
5472
+ ...dim ? { numberOfLines: 1, adjustsFontSizeToFit: true, minimumFontScale: 0.6 } : {},
5473
+ children: dim ? gutterTime(time) : time
5315
5474
  }
5316
5475
  );
5317
- const header = compact ? name : isRunStart ? /* @__PURE__ */ jsxs(View, { style: styles23.header, children: [
5476
+ const header = compact ? name : isRunStart ? /* @__PURE__ */ jsxs(View, { style: styles25.header, children: [
5318
5477
  name,
5319
5478
  timeText(false)
5320
5479
  ] }) : null;
5321
5480
  const images = attachments && !deleted ? (msg.attachments ?? []).filter((a) => isImageContentType(a.content_type)) : [];
5322
5481
  const files = attachments && !deleted ? (msg.attachments ?? []).filter((a) => !isImageContentType(a.content_type)) : [];
5323
5482
  const mediaWidth = Math.min(screenWidth - GUTTER - 48, 320);
5324
- const attachmentsEl = images.length > 0 || files.length > 0 ? /* @__PURE__ */ jsxs(View, { style: styles23.attachments, children: [
5483
+ const attachmentsEl = images.length > 0 || files.length > 0 ? /* @__PURE__ */ jsxs(View, { style: styles25.attachments, children: [
5325
5484
  images.length > 0 ? /* @__PURE__ */ jsx(
5326
5485
  ImageMosaic,
5327
5486
  {
@@ -5344,11 +5503,11 @@ function FlatMessageRow({
5344
5503
  lineHeight: dense ? theme.fonts.lineHeight - 3 : theme.fonts.lineHeight
5345
5504
  };
5346
5505
  const edited = !!msg.edited_at && !deleted;
5347
- const meta = edited || isSelf && readState ? /* @__PURE__ */ jsxs(View, { style: styles23.meta, children: [
5506
+ const meta = edited || isSelf && readState ? /* @__PURE__ */ jsxs(View, { style: styles25.meta, children: [
5348
5507
  edited ? /* @__PURE__ */ jsx(
5349
5508
  Text,
5350
5509
  {
5351
- style: [styles23.edited, { color: theme.colors.textSubtle }],
5510
+ style: [styles25.edited, { color: theme.colors.textSubtle }],
5352
5511
  ...editHistory && canShowEditHistory(msg.id) ? {
5353
5512
  onPress: () => setHistoryOpen(true),
5354
5513
  suppressHighlighting: true,
@@ -5368,7 +5527,7 @@ function FlatMessageRow({
5368
5527
  }
5369
5528
  ) : null
5370
5529
  ] }) : null;
5371
- const body = deleted ? /* @__PURE__ */ jsx(Text, { style: [bodyText, styles23.deleted, { color: theme.colors.textMuted }], children: "This message was deleted" }) : raw ? /* @__PURE__ */ jsxs(View, { children: [
5530
+ const body = deleted ? /* @__PURE__ */ jsx(Text, { style: [bodyText, styles25.deleted, { color: theme.colors.textMuted }], children: "This message was deleted" }) : raw ? /* @__PURE__ */ jsxs(View, { children: [
5372
5531
  jumbo > 0 ? /* @__PURE__ */ jsx(Text, { style: { fontSize: emojiFontSize(jumbo), lineHeight: emojiFontSize(jumbo) + 8 }, children: raw }) : markdown && hasMarkdown(shown) ? renderMarkdown(shown, {
5373
5532
  textColor: bodyText.color,
5374
5533
  linkColor: theme.colors.link,
@@ -5380,8 +5539,8 @@ function FlatMessageRow({
5380
5539
  return false;
5381
5540
  }
5382
5541
  }) : /* @__PURE__ */ jsx(Text, { style: bodyText, children: shown }),
5383
- trimmable ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsx(Text, { style: [styles23.readMore, { color: theme.colors.link }], children: expanded ? "Show less" : "Read more" }) }) : null,
5384
- previews.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles23.previews, children: previews.map((p) => /* @__PURE__ */ jsx(
5542
+ trimmable ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsx(Text, { style: [styles25.readMore, { color: theme.colors.link }], children: expanded ? "Show less" : "Read more" }) }) : null,
5543
+ previews.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles25.previews, children: previews.map((p) => /* @__PURE__ */ jsx(
5385
5544
  LinkPreviewCard,
5386
5545
  {
5387
5546
  preview: p,
@@ -5405,7 +5564,7 @@ function FlatMessageRow({
5405
5564
  }
5406
5565
  ) : null
5407
5566
  );
5408
- const reactionsEl = reactions && !deleted ? /* @__PURE__ */ jsx(View, { style: styles23.reactions, children: /* @__PURE__ */ jsx(
5567
+ const reactionsEl = reactions && !inert ? /* @__PURE__ */ jsx(View, { style: styles25.reactions, children: /* @__PURE__ */ jsx(
5409
5568
  ReactionStrip,
5410
5569
  {
5411
5570
  messageId: msg.id,
@@ -5424,15 +5583,24 @@ function FlatMessageRow({
5424
5583
  ...onQuotedClick ? { onPress: () => onQuotedClick(msg.quoted_message.id) } : {}
5425
5584
  }
5426
5585
  ) : null;
5427
- const content = /* @__PURE__ */ jsxs(View, { style: styles23.content, children: [
5586
+ const content = /* @__PURE__ */ jsxs(View, { style: styles25.content, children: [
5428
5587
  !compact ? renderSlot(slots?.header, ctx, header) : null,
5429
5588
  quote,
5430
5589
  renderSlot(slots?.attachments, ctx, attachmentsEl),
5431
5590
  renderSlot(slots?.body, ctx, body),
5432
5591
  renderSlot(slots?.reactions, ctx, reactionsEl),
5433
- renderSlot(slots?.thread, ctx, threadEl)
5592
+ renderSlot(slots?.thread, ctx, threadEl),
5593
+ /* @__PURE__ */ jsx(
5594
+ SendStatus,
5595
+ {
5596
+ message: msg,
5597
+ alignEnd: false,
5598
+ ...onRetrySend ? { onRetry: onRetrySend } : {},
5599
+ ...onDiscardSend ? { onDiscard: onDiscardSend } : {}
5600
+ }
5601
+ )
5434
5602
  ] });
5435
- const sheet = actions && actionsOpen && !deleted ? /* @__PURE__ */ jsx(
5603
+ const sheet = actions && actionsOpen && !inert ? /* @__PURE__ */ jsx(
5436
5604
  RowActionsSheet,
5437
5605
  {
5438
5606
  msg,
@@ -5456,28 +5624,32 @@ function FlatMessageRow({
5456
5624
  View,
5457
5625
  {
5458
5626
  style: [
5459
- styles23.row,
5460
- compact ? styles23.rowCompact : null,
5461
- dense ? styles23.rowDense : null,
5462
- !compact && isRunStart ? dense ? styles23.runStartDense : styles23.runStart : null,
5627
+ styles25.row,
5628
+ compact ? styles25.rowCompact : null,
5629
+ dense ? styles25.rowDense : null,
5630
+ !compact && isRunStart ? dense ? styles25.runStartDense : styles25.runStart : null,
5463
5631
  mentionsMe ? { backgroundColor: theme.colors.mention, borderLeftColor: theme.colors.accent } : null,
5464
- isEditing ? styles23.rowEditing : null
5632
+ isEditing ? styles25.rowEditing : null
5465
5633
  ],
5466
5634
  children: [
5467
5635
  /* @__PURE__ */ jsx(
5468
5636
  Pressable,
5469
5637
  {
5470
5638
  onLongPress: openActions,
5471
- style: [styles23.line, compact ? styles23.lineCompact : null],
5472
- accessibilityRole: "button",
5473
- accessibilityLabel: "Message actions",
5639
+ style: [styles25.line, compact ? styles25.lineCompact : null],
5640
+ accessibilityLabel: messageA11yLabel(msg, senderName, isSelf),
5641
+ ...actions && !inert ? {
5642
+ accessibilityHint: "Long press for message actions",
5643
+ accessibilityActions: [{ name: "longpress", label: "Message actions" }],
5644
+ onAccessibilityAction: openActions
5645
+ } : {},
5474
5646
  children: compact ? /* @__PURE__ */ jsxs(Fragment, { children: [
5475
5647
  timeText(false),
5476
- avatar ? /* @__PURE__ */ jsx(View, { style: styles23.avatarCompact, children: avatar }) : null,
5648
+ avatar ? /* @__PURE__ */ jsx(View, { style: styles25.avatarCompact, children: avatar }) : null,
5477
5649
  renderSlot(slots?.header, ctx, header),
5478
5650
  content
5479
5651
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5480
- /* @__PURE__ */ jsx(View, { style: styles23.gutter, children: isRunStart ? avatar : timeText(true) }),
5652
+ /* @__PURE__ */ jsx(View, { style: styles25.gutter, children: isRunStart ? avatar : timeText(true) }),
5481
5653
  content
5482
5654
  ] })
5483
5655
  }
@@ -5498,7 +5670,7 @@ function FlatMessageRow({
5498
5670
  }
5499
5671
  );
5500
5672
  }
5501
- var styles23 = StyleSheet.create({
5673
+ var styles25 = StyleSheet.create({
5502
5674
  row: {
5503
5675
  // 3px left border reserved for the mention accent bar.
5504
5676
  borderLeftWidth: 3,
@@ -5566,7 +5738,10 @@ var styles23 = StyleSheet.create({
5566
5738
  },
5567
5739
  timeDim: {
5568
5740
  fontSize: 10,
5569
- opacity: 0.7
5741
+ opacity: 0.7,
5742
+ // Fill the gutter so shrink-to-fit measures against its width.
5743
+ width: GUTTER,
5744
+ textAlign: "center"
5570
5745
  },
5571
5746
  attachments: {
5572
5747
  marginVertical: 4,
@@ -5647,13 +5822,13 @@ function MessageActions({
5647
5822
  animationType: "fade",
5648
5823
  onRequestClose: onClose,
5649
5824
  ...EDGE_TO_EDGE_MODAL,
5650
- children: /* @__PURE__ */ jsx(Pressable, { style: styles24.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs(
5825
+ children: /* @__PURE__ */ jsx(Pressable, { style: styles26.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs(
5651
5826
  Pressable,
5652
5827
  {
5653
5828
  onPress: () => void 0,
5654
5829
  accessible: false,
5655
5830
  style: [
5656
- styles24.sheet,
5831
+ styles26.sheet,
5657
5832
  {
5658
5833
  backgroundColor: theme.colors.surface,
5659
5834
  borderTopLeftRadius: theme.radii.lg,
@@ -5666,7 +5841,7 @@ function MessageActions({
5666
5841
  theme.shadows.lg
5667
5842
  ],
5668
5843
  children: [
5669
- showEmojiRow ? /* @__PURE__ */ jsxs(View, { style: [styles24.emojiRow, { borderBottomColor: theme.colors.border }], children: [
5844
+ showEmojiRow ? /* @__PURE__ */ jsxs(View, { style: [styles26.emojiRow, { borderBottomColor: theme.colors.border }], children: [
5670
5845
  emojis.map((emoji) => /* @__PURE__ */ jsx(
5671
5846
  Pressable,
5672
5847
  {
@@ -5674,10 +5849,10 @@ function MessageActions({
5674
5849
  onPickReaction(emoji);
5675
5850
  onClose();
5676
5851
  },
5677
- style: styles24.emojiBtn,
5852
+ style: styles26.emojiBtn,
5678
5853
  hitSlop: 6,
5679
5854
  accessibilityLabel: `React with ${emoji}`,
5680
- children: /* @__PURE__ */ jsx(Text, { style: styles24.emoji, children: emoji })
5855
+ children: /* @__PURE__ */ jsx(Text, { style: styles26.emoji, children: emoji })
5681
5856
  },
5682
5857
  emoji
5683
5858
  )),
@@ -5688,7 +5863,7 @@ function MessageActions({
5688
5863
  onClose();
5689
5864
  onMoreReactions();
5690
5865
  },
5691
- style: [styles24.moreBtn, { backgroundColor: theme.colors.surfaceAlt }],
5866
+ style: [styles26.moreBtn, { backgroundColor: theme.colors.surfaceAlt }],
5692
5867
  hitSlop: 6,
5693
5868
  accessibilityRole: "button",
5694
5869
  accessibilityLabel: "More reactions",
@@ -5696,7 +5871,7 @@ function MessageActions({
5696
5871
  }
5697
5872
  ) : null
5698
5873
  ] }) : null,
5699
- items.map((item) => /* @__PURE__ */ jsxs(Pressable, { onPress: item.onPress, style: styles24.item, children: [
5874
+ items.map((item) => /* @__PURE__ */ jsxs(Pressable, { onPress: item.onPress, style: styles26.item, children: [
5700
5875
  /* @__PURE__ */ jsx(
5701
5876
  PoolseIcon,
5702
5877
  {
@@ -5709,7 +5884,7 @@ function MessageActions({
5709
5884
  Text,
5710
5885
  {
5711
5886
  style: [
5712
- styles24.itemText,
5887
+ styles26.itemText,
5713
5888
  {
5714
5889
  color: item.danger ? theme.colors.danger : theme.colors.text,
5715
5890
  fontFamily: theme.fonts.body
@@ -5729,7 +5904,7 @@ function hostOf2(url) {
5729
5904
  const m = /^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i.exec(url);
5730
5905
  return (m?.[1] ?? url).replace(/^www\./, "");
5731
5906
  }
5732
- var styles24 = StyleSheet.create({
5907
+ var styles26 = StyleSheet.create({
5733
5908
  backdrop: {
5734
5909
  flex: 1,
5735
5910
  backgroundColor: "rgba(0,0,0,0.35)",
@@ -5893,11 +6068,13 @@ function BubbleMessageRow({
5893
6068
  linkPreviews = true,
5894
6069
  onRemoveLinkPreview,
5895
6070
  onMarkUnread,
5896
- editHistory = true
6071
+ editHistory = true,
6072
+ onRetrySend,
6073
+ onDiscardSend
5897
6074
  }) {
5898
6075
  const theme = useTheme();
5899
6076
  const isSelf = meId !== null && msg.sender_id === meId;
5900
- const tombstone = isTombstone(msg);
6077
+ const tombstone = isTombstone(msg) || !!msg.local_status;
5901
6078
  const [actionsOpen, setActionsOpen] = useState(false);
5902
6079
  const [emojiOpen, setEmojiOpen] = useState(false);
5903
6080
  const [historyOpen, setHistoryOpen] = useState(false);
@@ -5979,8 +6156,7 @@ function BubbleMessageRow({
5979
6156
  });
5980
6157
  const showAvatarSlot = showAvatar && !isSelf;
5981
6158
  const showAvatarRender = showAvatarSlot && (groupPosition === "last" || groupPosition === "standalone");
5982
- const wantsSender = showAvatarSlot || !isSelf && onSenderPress !== void 0;
5983
- const rowSender = useUser(wantsSender ? msg.sender_external_id : null);
6159
+ const rowSender = useUser(msg.sender_external_id);
5984
6160
  const avatarUrl = msg.sender_external_id ? avatarFor?.(msg.sender_external_id) ?? rowSender.profile?.avatarUrl ?? null : null;
5985
6161
  const senderLabel = msg.sender_external_id ? labelFor?.(msg.sender_external_id) ?? rowSender.profile?.displayName ?? msg.sender_external_id : null;
5986
6162
  const sender = {
@@ -6010,16 +6186,16 @@ function BubbleMessageRow({
6010
6186
  View,
6011
6187
  {
6012
6188
  style: [
6013
- styles25.row,
6189
+ styles27.row,
6014
6190
  { alignSelf: isSelf ? "flex-end" : "flex-start" },
6015
- density === "compact" ? styles25.rowDense : null,
6191
+ density === "compact" ? styles27.rowDense : null,
6016
6192
  // Lift this row above the dim backdrop the parent renders
6017
6193
  // during edit mode. zIndex covers iOS / web; elevation does
6018
6194
  // the equivalent on Android.
6019
- isEditing ? styles25.rowEditing : null
6195
+ isEditing ? styles27.rowEditing : null
6020
6196
  ],
6021
6197
  children: [
6022
- showAvatarSlot ? /* @__PURE__ */ jsx(View, { style: styles25.avatarSlot, children: !showAvatarRender ? null : onAvatarPress ? /* @__PURE__ */ jsx(
6198
+ showAvatarSlot ? /* @__PURE__ */ jsx(View, { style: styles27.avatarSlot, children: !showAvatarRender ? null : onAvatarPress ? /* @__PURE__ */ jsx(
6023
6199
  Pressable,
6024
6200
  {
6025
6201
  onPress: () => onAvatarPress(sender),
@@ -6029,14 +6205,14 @@ function BubbleMessageRow({
6029
6205
  children: avatar
6030
6206
  }
6031
6207
  ) : avatar }) : null,
6032
- /* @__PURE__ */ jsxs(View, { style: styles25.bubbleCol, children: [
6208
+ /* @__PURE__ */ jsxs(View, { style: styles27.bubbleCol, children: [
6033
6209
  swipeEnabled ? /* @__PURE__ */ jsx(
6034
6210
  Animated.View,
6035
6211
  {
6036
6212
  pointerEvents: "none",
6037
6213
  style: [
6038
- styles25.replyHint,
6039
- isSelf ? styles25.replyHintRight : styles25.replyHintLeft,
6214
+ styles27.replyHint,
6215
+ isSelf ? styles27.replyHintRight : styles27.replyHintLeft,
6040
6216
  {
6041
6217
  opacity: replyIconOpacity,
6042
6218
  transform: [{ scale: replyIconScale }],
@@ -6058,8 +6234,12 @@ function BubbleMessageRow({
6058
6234
  if (!actions || tombstone) return;
6059
6235
  setActionsOpen(true);
6060
6236
  },
6061
- accessibilityRole: "button",
6062
- accessibilityLabel: "Message actions",
6237
+ accessibilityLabel: messageA11yLabel(msg, senderLabel ?? "Unknown", isSelf),
6238
+ ...actions && !tombstone ? {
6239
+ accessibilityHint: "Long press for message actions",
6240
+ accessibilityActions: [{ name: "longpress", label: "Message actions" }],
6241
+ onAccessibilityAction: () => setActionsOpen(true)
6242
+ } : {},
6063
6243
  children: /* @__PURE__ */ jsx(
6064
6244
  MessageBubble,
6065
6245
  {
@@ -6088,6 +6268,15 @@ function BubbleMessageRow({
6088
6268
  )
6089
6269
  }
6090
6270
  ),
6271
+ /* @__PURE__ */ jsx(
6272
+ SendStatus,
6273
+ {
6274
+ message: msg,
6275
+ alignEnd: isSelf,
6276
+ ...onRetrySend ? { onRetry: onRetrySend } : {},
6277
+ ...onDiscardSend ? { onDiscard: onDiscardSend } : {}
6278
+ }
6279
+ ),
6091
6280
  renderSlot(
6092
6281
  slots?.thread,
6093
6282
  slotContext,
@@ -6105,7 +6294,7 @@ function BubbleMessageRow({
6105
6294
  renderSlot(
6106
6295
  slots?.reactions,
6107
6296
  slotContext,
6108
- reactions && !tombstone ? /* @__PURE__ */ jsx(View, { style: [styles25.reactionsRow, { alignSelf: isSelf ? "flex-end" : "flex-start" }], children: /* @__PURE__ */ jsx(
6297
+ reactions && !tombstone ? /* @__PURE__ */ jsx(View, { style: [styles27.reactionsRow, { alignSelf: isSelf ? "flex-end" : "flex-start" }], children: /* @__PURE__ */ jsx(
6109
6298
  ReactionStrip,
6110
6299
  {
6111
6300
  messageId: msg.id,
@@ -6156,7 +6345,7 @@ function BubbleMessageRow({
6156
6345
  }
6157
6346
  );
6158
6347
  }
6159
- var styles25 = StyleSheet.create({
6348
+ var styles27 = StyleSheet.create({
6160
6349
  row: {
6161
6350
  flexDirection: "row",
6162
6351
  alignItems: "flex-end",
@@ -6213,24 +6402,24 @@ function NewMessagesDivider({ label = "New messages" }) {
6213
6402
  return /* @__PURE__ */ jsxs(
6214
6403
  View,
6215
6404
  {
6216
- style: [styles26.row, { paddingHorizontal: theme.spacing.md }],
6405
+ style: [styles28.row, { paddingHorizontal: theme.spacing.md }],
6217
6406
  accessibilityRole: "text",
6218
6407
  accessibilityLabel: label,
6219
6408
  children: [
6220
- /* @__PURE__ */ jsx(View, { style: [styles26.line, { backgroundColor: theme.colors.accent }] }),
6409
+ /* @__PURE__ */ jsx(View, { style: [styles28.line, { backgroundColor: theme.colors.accent }] }),
6221
6410
  /* @__PURE__ */ jsx(
6222
6411
  Text,
6223
6412
  {
6224
- style: [styles26.label, { color: theme.colors.accentStrong, fontFamily: theme.fonts.body }],
6413
+ style: [styles28.label, { color: theme.colors.accentStrong, fontFamily: theme.fonts.body }],
6225
6414
  children: label
6226
6415
  }
6227
6416
  ),
6228
- /* @__PURE__ */ jsx(View, { style: [styles26.line, { backgroundColor: theme.colors.accent }] })
6417
+ /* @__PURE__ */ jsx(View, { style: [styles28.line, { backgroundColor: theme.colors.accent }] })
6229
6418
  ]
6230
6419
  }
6231
6420
  );
6232
6421
  }
6233
- var styles26 = StyleSheet.create({
6422
+ var styles28 = StyleSheet.create({
6234
6423
  row: {
6235
6424
  flexDirection: "row",
6236
6425
  alignItems: "center",
@@ -6399,15 +6588,15 @@ function ThreadSheet({
6399
6588
  return /* @__PURE__ */ jsxs(
6400
6589
  View,
6401
6590
  {
6402
- style: styles27.modalRoot,
6591
+ style: styles29.modalRoot,
6403
6592
  onLayout: (e) => setRootHeight(Math.round(e.nativeEvent.layout.height)),
6404
6593
  children: [
6405
- /* @__PURE__ */ jsx(Pressable, { style: styles27.backdrop, onPress: onClose, accessibilityLabel: "Close thread" }),
6594
+ /* @__PURE__ */ jsx(Pressable, { style: styles29.backdrop, onPress: onClose, accessibilityLabel: "Close thread" }),
6406
6595
  /* @__PURE__ */ jsxs(
6407
6596
  Animated.View,
6408
6597
  {
6409
6598
  style: [
6410
- styles27.sheet,
6599
+ styles29.sheet,
6411
6600
  {
6412
6601
  height: sheetHeight,
6413
6602
  backgroundColor: theme.colors.background,
@@ -6421,14 +6610,14 @@ function ThreadSheet({
6421
6610
  ],
6422
6611
  children: [
6423
6612
  /* @__PURE__ */ jsxs(View, { ...panHandlers, children: [
6424
- /* @__PURE__ */ jsx(View, { style: styles27.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles27.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
6425
- /* @__PURE__ */ jsxs(View, { style: [styles27.header, { borderBottomColor: theme.colors.border }], children: [
6613
+ /* @__PURE__ */ jsx(View, { style: styles29.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles29.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
6614
+ /* @__PURE__ */ jsxs(View, { style: [styles29.header, { borderBottomColor: theme.colors.border }], children: [
6426
6615
  /* @__PURE__ */ jsx(
6427
6616
  Pressable,
6428
6617
  {
6429
6618
  onPress: onClose,
6430
6619
  hitSlop: 16,
6431
- style: [styles27.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
6620
+ style: [styles29.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
6432
6621
  accessibilityLabel: "Close thread",
6433
6622
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.text })
6434
6623
  }
@@ -6436,7 +6625,7 @@ function ThreadSheet({
6436
6625
  /* @__PURE__ */ jsx(
6437
6626
  Text,
6438
6627
  {
6439
- style: [styles27.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
6628
+ style: [styles29.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
6440
6629
  children: "Thread"
6441
6630
  }
6442
6631
  )
@@ -6445,18 +6634,25 @@ function ThreadSheet({
6445
6634
  /* @__PURE__ */ jsxs(
6446
6635
  KeyboardAvoidingView,
6447
6636
  {
6448
- style: styles27.kavBody,
6637
+ style: styles29.kavBody,
6449
6638
  behavior: "padding",
6450
6639
  keyboardVerticalOffset: gutter,
6451
6640
  children: [
6452
- /* @__PURE__ */ jsx(View, { style: [styles27.rootPreview, { backgroundColor: theme.colors.surfaceAlt }], children: rootRow }),
6453
- /* @__PURE__ */ jsx(View, { style: styles27.listWrap, children: /* @__PURE__ */ jsx(
6641
+ /* @__PURE__ */ jsx(View, { style: [styles29.rootPreview, { backgroundColor: theme.colors.surfaceAlt }], children: rootRow }),
6642
+ /* @__PURE__ */ jsx(View, { style: styles29.listWrap, children: /* @__PURE__ */ jsx(
6454
6643
  MessageList,
6455
6644
  {
6456
6645
  messages: replies,
6457
6646
  hasMore,
6458
6647
  onLoadMore: loadMore,
6459
- renderItem: renderReply
6648
+ renderItem: renderReply,
6649
+ emptyState: /* @__PURE__ */ jsx(
6650
+ EmptyState,
6651
+ {
6652
+ title: "No replies yet",
6653
+ hint: "Write a reply below to start the thread."
6654
+ }
6655
+ )
6460
6656
  }
6461
6657
  ) }),
6462
6658
  /* @__PURE__ */ jsx(
@@ -6488,7 +6684,7 @@ function ThreadSheet({
6488
6684
  }
6489
6685
  );
6490
6686
  }
6491
- var styles27 = StyleSheet.create({
6687
+ var styles29 = StyleSheet.create({
6492
6688
  modalRoot: {
6493
6689
  flex: 1,
6494
6690
  justifyContent: "flex-end"
@@ -6560,7 +6756,7 @@ function TypingIndicator({ typing, labelFor }) {
6560
6756
  const ids = Array.from(typing);
6561
6757
  const isTyping = ids.length > 0;
6562
6758
  if (!isTyping) return /* @__PURE__ */ jsx(View, { style: { height: 0 } });
6563
- return /* @__PURE__ */ jsxs(View, { style: styles28.row, children: [
6759
+ return /* @__PURE__ */ jsxs(View, { style: styles30.row, children: [
6564
6760
  /* @__PURE__ */ jsx(TypingDots, {}),
6565
6761
  /* @__PURE__ */ jsx(TypingLabel, { ids, ...labelFor ? { labelFor } : {} })
6566
6762
  ] });
@@ -6605,7 +6801,7 @@ function TypingDots() {
6605
6801
  ],
6606
6802
  opacity: val.interpolate({ inputRange: [0, 1], outputRange: [0.5, 1] })
6607
6803
  });
6608
- return /* @__PURE__ */ jsxs(View, { style: styles28.dotsWrap, children: [
6804
+ return /* @__PURE__ */ jsxs(View, { style: styles30.dotsWrap, children: [
6609
6805
  /* @__PURE__ */ jsx(Animated.View, { style: dot(a) }),
6610
6806
  /* @__PURE__ */ jsx(Animated.View, { style: dot(b) }),
6611
6807
  /* @__PURE__ */ jsx(Animated.View, { style: dot(c) })
@@ -6621,9 +6817,9 @@ function TypingLabel({
6621
6817
  const name1 = useDisplayName(id1, labelFor);
6622
6818
  const name2 = useDisplayName(id2, labelFor);
6623
6819
  const text = ids.length === 1 ? `${name1} is typing` : ids.length === 2 ? `${name1} and ${name2} are typing` : `${ids.length} people are typing`;
6624
- return /* @__PURE__ */ jsx(Text, { style: [styles28.label, { color: theme.colors.textMuted, fontFamily: theme.fonts.body }], children: text });
6820
+ return /* @__PURE__ */ jsx(Text, { style: [styles30.label, { color: theme.colors.textMuted, fontFamily: theme.fonts.body }], children: text });
6625
6821
  }
6626
- var styles28 = StyleSheet.create({
6822
+ var styles30 = StyleSheet.create({
6627
6823
  row: {
6628
6824
  flexDirection: "row",
6629
6825
  alignItems: "center",
@@ -6661,21 +6857,40 @@ function parseDraft(raw) {
6661
6857
  }
6662
6858
  }
6663
6859
  var DraftStore = class {
6860
+ /**
6861
+ * `namespace` resolves to the client's namespace; without it keys are
6862
+ * the pre-3.8 `poolse:draft:<conversation>` (tests, single client).
6863
+ */
6864
+ constructor(namespace) {
6865
+ this.namespace = namespace;
6866
+ }
6867
+ namespace;
6664
6868
  memory = /* @__PURE__ */ new Map();
6869
+ written = /* @__PURE__ */ new Map();
6665
6870
  /** The in-memory draft, if any. */
6666
6871
  peek(conversationId) {
6667
6872
  return this.memory.get(conversationId) ?? null;
6668
6873
  }
6669
6874
  /**
6670
6875
  * The draft: from memory, else from `storage` (which then seeds the
6671
- * memory). Null when there's none, or storage fails.
6876
+ * memory; a pre-3.8 key is moved over). Null when there's none, or
6877
+ * storage fails.
6672
6878
  */
6673
6879
  async load(conversationId, storage) {
6674
6880
  const inMemory = this.memory.get(conversationId);
6675
6881
  if (inMemory) return inMemory;
6676
6882
  if (!storage) return null;
6677
6883
  try {
6678
- const stored = parseDraft(await storage.get(draftKey(conversationId)));
6884
+ const key = await this.key(conversationId);
6885
+ let stored = parseDraft(await storage.get(key));
6886
+ const legacy = draftKey(conversationId);
6887
+ if (!stored && key !== legacy) {
6888
+ stored = parseDraft(await storage.get(legacy));
6889
+ if (stored && !isEmptyDraft(stored)) {
6890
+ this.write(storage, key, stored);
6891
+ swallow(() => storage.remove(legacy));
6892
+ }
6893
+ }
6679
6894
  if (stored && !isEmptyDraft(stored) && !this.memory.has(conversationId)) {
6680
6895
  this.memory.set(conversationId, stored);
6681
6896
  }
@@ -6691,15 +6906,72 @@ var DraftStore = class {
6691
6906
  return;
6692
6907
  }
6693
6908
  this.memory.set(conversationId, draft);
6694
- if (storage) {
6695
- swallow(() => storage.set(draftKey(conversationId), JSON.stringify(draft)));
6909
+ if (storage && !this.namespace) {
6910
+ this.write(storage, draftKey(conversationId), draft);
6911
+ } else if (storage) {
6912
+ void this.key(conversationId).then(
6913
+ (key) => this.write(storage, key, draft),
6914
+ () => void 0
6915
+ );
6696
6916
  }
6697
6917
  }
6698
6918
  clear(conversationId, storage) {
6699
6919
  this.memory.delete(conversationId);
6700
- if (storage) swallow(() => storage.remove(draftKey(conversationId)));
6920
+ if (storage && !this.namespace) {
6921
+ swallow(() => storage.remove(draftKey(conversationId)));
6922
+ } else if (storage) {
6923
+ void this.key(conversationId).then(
6924
+ (key) => swallow(() => storage.remove(key)),
6925
+ () => void 0
6926
+ );
6927
+ }
6928
+ }
6929
+ /** Called by `chat.destroy()`. @internal */
6930
+ async destroy(opts) {
6931
+ this.memory.clear();
6932
+ if (!opts.clearStorage) return;
6933
+ const ns = this.namespace ? await this.namespace() : null;
6934
+ for (const [storage, keys] of this.written) {
6935
+ const all = new Set(keys);
6936
+ if (ns) {
6937
+ try {
6938
+ const listed = JSON.parse(await storage.get(indexKey(ns)) ?? "[]");
6939
+ if (Array.isArray(listed)) {
6940
+ for (const k of listed) if (typeof k === "string") all.add(k);
6941
+ }
6942
+ } catch {
6943
+ }
6944
+ swallow(() => storage.remove(indexKey(ns)));
6945
+ }
6946
+ for (const k of all) swallow(() => storage.remove(k));
6947
+ }
6948
+ this.written.clear();
6949
+ }
6950
+ async key(conversationId) {
6951
+ if (!this.namespace) return draftKey(conversationId);
6952
+ return `${await this.namespace()}:draft:${conversationId}`;
6953
+ }
6954
+ write(storage, key, draft) {
6955
+ swallow(() => storage.set(key, JSON.stringify(draft)));
6956
+ let keys = this.written.get(storage);
6957
+ if (!keys) {
6958
+ keys = /* @__PURE__ */ new Set();
6959
+ this.written.set(storage, keys);
6960
+ }
6961
+ if (keys.has(key) || !this.namespace) return;
6962
+ keys.add(key);
6963
+ const all = keys;
6964
+ void this.namespace().then(async (ns) => {
6965
+ try {
6966
+ const listed = JSON.parse(await storage.get(indexKey(ns)) ?? "[]");
6967
+ const prev = Array.isArray(listed) ? listed.filter((k) => typeof k === "string") : [];
6968
+ await storage.set(indexKey(ns), JSON.stringify([.../* @__PURE__ */ new Set([...prev, ...all])]));
6969
+ } catch {
6970
+ }
6971
+ });
6701
6972
  }
6702
6973
  };
6974
+ var indexKey = (ns) => `${ns}:draft-index`;
6703
6975
  function swallow(fn) {
6704
6976
  try {
6705
6977
  const r = fn();
@@ -6709,7 +6981,9 @@ function swallow(fn) {
6709
6981
  } catch {
6710
6982
  }
6711
6983
  }
6712
- var sharedDraftStore = new DraftStore();
6984
+ function draftStoreOf(chat) {
6985
+ return chat.scoped("react-native:drafts", (c) => new DraftStore(() => c.whenNamespace()));
6986
+ }
6713
6987
 
6714
6988
  // src/internal/errors.ts
6715
6989
  function sendErrorNotice(err) {
@@ -6824,11 +7098,14 @@ function ConversationView({
6824
7098
  loadMore,
6825
7099
  loadUntil,
6826
7100
  send,
7101
+ retry: retrySend,
7102
+ discard: discardSend,
6827
7103
  edit,
6828
7104
  delete: deleteMsg,
6829
7105
  markReadUpTo,
6830
7106
  refetch
6831
7107
  } = useMessages(conversationId);
7108
+ const drafts = draftStoreOf(chat);
6832
7109
  const { typing: typingPeople, signalTyping } = useTyping(conversationId);
6833
7110
  const streams = useMessageStreams(conversationId);
6834
7111
  const typing = useMemo(() => {
@@ -6869,24 +7146,22 @@ function ConversationView({
6869
7146
  [layout, density, timeFormat, slots]
6870
7147
  );
6871
7148
  const [draftFor, setDraftFor] = useState(conversationId);
6872
- const [draftText, setDraftText] = useState(
6873
- () => sharedDraftStore.peek(conversationId)?.text ?? ""
6874
- );
7149
+ const [draftText, setDraftText] = useState(() => drafts.peek(conversationId)?.text ?? "");
6875
7150
  const [replyingTo, setReplyingTo] = useState(
6876
- () => sharedDraftStore.peek(conversationId)?.quote ?? null
7151
+ () => drafts.peek(conversationId)?.quote ?? null
6877
7152
  );
6878
7153
  const touchedRef = useRef(false);
6879
7154
  const [storedDraftRead, setStoredDraftRead] = useState(false);
6880
7155
  useEffect(() => {
6881
7156
  let live = true;
6882
7157
  touchedRef.current = false;
6883
- const inMemory = sharedDraftStore.peek(conversationId);
7158
+ const inMemory = drafts.peek(conversationId);
6884
7159
  setDraftFor(conversationId);
6885
7160
  setDraftText(inMemory?.text ?? "");
6886
7161
  setReplyingTo(inMemory?.quote ?? null);
6887
7162
  if (!inMemory && storage) {
6888
7163
  setStoredDraftRead(false);
6889
- void sharedDraftStore.load(conversationId, storage).then((d) => {
7164
+ void drafts.load(conversationId, storage).then((d) => {
6890
7165
  if (!live) return;
6891
7166
  setStoredDraftRead(true);
6892
7167
  if (!d || touchedRef.current) return;
@@ -6904,23 +7179,23 @@ function ConversationView({
6904
7179
  useEffect(() => {
6905
7180
  if (draftFor !== conversationId) return;
6906
7181
  const draft = { text: draftText, quote: replyingTo };
6907
- sharedDraftStore.save(conversationId, draft);
7182
+ drafts.save(conversationId, draft);
6908
7183
  if (!storage || !storedDraftRead) return;
6909
7184
  pendingDraftRef.current = { id: conversationId, draft };
6910
7185
  const t = setTimeout(() => {
6911
7186
  pendingDraftRef.current = null;
6912
- sharedDraftStore.save(conversationId, draft, storage);
7187
+ drafts.save(conversationId, draft, storage);
6913
7188
  }, 400);
6914
7189
  return () => clearTimeout(t);
6915
- }, [draftFor, conversationId, draftText, replyingTo, storage, storedDraftRead]);
7190
+ }, [drafts, draftFor, conversationId, draftText, replyingTo, storage, storedDraftRead]);
6916
7191
  const storageRef = useRef(storage);
6917
7192
  storageRef.current = storage;
6918
7193
  useEffect(
6919
7194
  () => () => {
6920
7195
  const pending = pendingDraftRef.current;
6921
- if (pending) sharedDraftStore.save(pending.id, pending.draft, storageRef.current);
7196
+ if (pending) drafts.save(pending.id, pending.draft, storageRef.current);
6922
7197
  },
6923
- []
7198
+ [drafts]
6924
7199
  );
6925
7200
  const [notice, setNotice] = useState(null);
6926
7201
  useEffect(() => {
@@ -7107,6 +7382,10 @@ function ConversationView({
7107
7382
  showPresence,
7108
7383
  linkPreviews,
7109
7384
  ...markable ? { onMarkUnread: () => markMessageUnread(msg) } : {},
7385
+ ...msg.local_status ? {
7386
+ onRetrySend: () => void retrySend(msg.id).catch(() => void 0),
7387
+ onDiscardSend: () => discardSend(msg.id)
7388
+ } : {},
7110
7389
  ...linkPreviews && isSelf && !tombstone && (msg.link_previews?.length ?? 0) > 0 ? { onRemoveLinkPreview: (url) => removeLinkPreview(msg.id, url) } : {},
7111
7390
  reactions,
7112
7391
  attachments,
@@ -7138,6 +7417,8 @@ function ConversationView({
7138
7417
  return /* @__PURE__ */ jsx(View, { style: { backgroundColor: theme.colors.accentSoft }, children: row });
7139
7418
  },
7140
7419
  [
7420
+ retrySend,
7421
+ discardSend,
7141
7422
  onCallBack,
7142
7423
  onQuotedClick,
7143
7424
  onSenderPress,
@@ -7213,9 +7494,17 @@ function ConversationView({
7213
7494
  const composerProps = useMemo(
7214
7495
  () => ({
7215
7496
  onSend: async (body, opts) => {
7497
+ const id = safeUuid();
7216
7498
  try {
7217
- await send({ body, ...opts });
7499
+ await send({ body, ...opts, id });
7218
7500
  } catch (err) {
7501
+ const kept = err instanceof MessageQueuedError || chat.outboxEnabled && !isQuoteGone(err);
7502
+ if (kept) {
7503
+ setReplyingTo(null);
7504
+ setAutoReadPaused(false);
7505
+ return;
7506
+ }
7507
+ if (isQuoteGone(err)) discardSend(id);
7219
7508
  setDraftText((now) => now ? now : body);
7220
7509
  if (isQuoteGone(err)) setReplyingTo(null);
7221
7510
  setNotice(sendErrorNotice(err));
@@ -7248,6 +7537,8 @@ function ConversationView({
7248
7537
  }),
7249
7538
  [
7250
7539
  send,
7540
+ chat.outboxEnabled,
7541
+ discardSend,
7251
7542
  signalTyping,
7252
7543
  attachments,
7253
7544
  replyingTo,
@@ -7275,7 +7566,7 @@ function ConversationView({
7275
7566
  return /* @__PURE__ */ jsx(UploadProvider, { children: /* @__PURE__ */ jsxs(
7276
7567
  KeyboardAvoidingView,
7277
7568
  {
7278
- style: [styles29.root, { backgroundColor: theme.colors.background }],
7569
+ style: [styles31.root, { backgroundColor: theme.colors.background }],
7279
7570
  behavior: Platform.OS === "ios" ? "padding" : "height",
7280
7571
  keyboardVerticalOffset: keyboardOffset,
7281
7572
  children: [
@@ -7284,7 +7575,7 @@ function ConversationView({
7284
7575
  Text,
7285
7576
  {
7286
7577
  style: [
7287
- styles29.notice,
7578
+ styles31.notice,
7288
7579
  { color: theme.colors.textMuted, backgroundColor: theme.colors.surfaceAlt }
7289
7580
  ],
7290
7581
  accessibilityRole: "alert",
@@ -7300,7 +7591,7 @@ function ConversationView({
7300
7591
  onJoin: onJoinCall
7301
7592
  }
7302
7593
  ) : null,
7303
- /* @__PURE__ */ jsxs(View, { style: styles29.listWrap, children: [
7594
+ /* @__PURE__ */ jsxs(View, { style: styles31.listWrap, children: [
7304
7595
  /* @__PURE__ */ jsx(
7305
7596
  MessageList,
7306
7597
  {
@@ -7319,7 +7610,7 @@ function ConversationView({
7319
7610
  (stream) => stream.status === "failed" ? /* @__PURE__ */ jsx(
7320
7611
  Text,
7321
7612
  {
7322
- style: [styles29.streamFailed, { color: theme.colors.textSubtle }],
7613
+ style: [styles31.streamFailed, { color: theme.colors.textSubtle }],
7323
7614
  accessibilityRole: "alert",
7324
7615
  children: stream.error ? `The agent couldn't reply: ${stream.error}` : "The agent couldn't reply."
7325
7616
  },
@@ -7346,7 +7637,13 @@ function ConversationView({
7346
7637
  ),
7347
7638
  /* @__PURE__ */ jsx(TypingIndicator, { typing, ...labelFor ? { labelFor } : {} })
7348
7639
  ] }),
7349
- ...emptyState !== void 0 ? { emptyState } : {}
7640
+ emptyState: emptyState !== void 0 ? emptyState : /* @__PURE__ */ jsx(
7641
+ EmptyState,
7642
+ {
7643
+ title: "No messages yet",
7644
+ ...showComposer ? { hint: "Write the first message below \u2014 everyone here will see it." } : {}
7645
+ }
7646
+ )
7350
7647
  }
7351
7648
  ),
7352
7649
  unreadPending ? /* @__PURE__ */ jsxs(
@@ -7354,7 +7651,7 @@ function ConversationView({
7354
7651
  {
7355
7652
  onPress: jumpToUnread,
7356
7653
  style: [
7357
- styles29.unreadPill,
7654
+ styles31.unreadPill,
7358
7655
  { backgroundColor: theme.colors.accent, borderRadius: theme.radii.pill },
7359
7656
  theme.shadows.sm
7360
7657
  ],
@@ -7370,7 +7667,7 @@ function ConversationView({
7370
7667
  label: null
7371
7668
  }
7372
7669
  ),
7373
- /* @__PURE__ */ jsx(Text, { style: [styles29.unreadPillText, { color: theme.colors.accentText }], children: seekingUnread ? "Loading\u2026" : "New messages" }),
7670
+ /* @__PURE__ */ jsx(Text, { style: [styles31.unreadPillText, { color: theme.colors.accentText }], children: seekingUnread ? "Loading\u2026" : "New messages" }),
7374
7671
  /* @__PURE__ */ jsx(
7375
7672
  Pressable,
7376
7673
  {
@@ -7387,7 +7684,7 @@ function ConversationView({
7387
7684
  editingId ? /* @__PURE__ */ jsx(
7388
7685
  Pressable,
7389
7686
  {
7390
- style: [styles29.editBackdrop, { backgroundColor: theme.colors.overlay }],
7687
+ style: [styles31.editBackdrop, { backgroundColor: theme.colors.overlay }],
7391
7688
  onPress: () => setEditingId(null),
7392
7689
  accessibilityLabel: "Cancel editing"
7393
7690
  }
@@ -7449,7 +7746,7 @@ function readStateForMessage(msg, members, meId, sequenceByMessageId) {
7449
7746
  return anyRead ? "read" : "sent";
7450
7747
  }
7451
7748
  var NEW_MESSAGES_KEY = "new-messages";
7452
- var styles29 = StyleSheet.create({
7749
+ var styles31 = StyleSheet.create({
7453
7750
  root: {
7454
7751
  flex: 1
7455
7752
  },
@@ -7585,15 +7882,15 @@ function UserPickerSheet({
7585
7882
  children: /* @__PURE__ */ jsxs(
7586
7883
  View,
7587
7884
  {
7588
- style: styles30.modalRoot,
7885
+ style: styles32.modalRoot,
7589
7886
  onLayout: (e) => setRootHeight(Math.round(e.nativeEvent.layout.height)),
7590
7887
  children: [
7591
- /* @__PURE__ */ jsx(Pressable, { style: styles30.backdrop, onPress: handleClose }),
7888
+ /* @__PURE__ */ jsx(Pressable, { style: styles32.backdrop, onPress: handleClose }),
7592
7889
  /* @__PURE__ */ jsx(
7593
7890
  Animated.View,
7594
7891
  {
7595
7892
  style: [
7596
- styles30.sheet,
7893
+ styles32.sheet,
7597
7894
  {
7598
7895
  backgroundColor: theme.colors.background,
7599
7896
  borderTopLeftRadius: theme.radii.xl,
@@ -7611,18 +7908,18 @@ function UserPickerSheet({
7611
7908
  children: /* @__PURE__ */ jsxs(
7612
7909
  KeyboardAvoidingView,
7613
7910
  {
7614
- style: styles30.kav,
7911
+ style: styles32.kav,
7615
7912
  behavior: "padding",
7616
7913
  keyboardVerticalOffset: screenHeight - sheetHeight,
7617
7914
  children: [
7618
- /* @__PURE__ */ jsx(View, { ...panHandlers, style: styles30.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles30.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
7619
- /* @__PURE__ */ jsxs(View, { style: styles30.header, children: [
7915
+ /* @__PURE__ */ jsx(View, { ...panHandlers, style: styles32.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles32.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
7916
+ /* @__PURE__ */ jsxs(View, { style: styles32.header, children: [
7620
7917
  /* @__PURE__ */ jsx(
7621
7918
  Pressable,
7622
7919
  {
7623
7920
  onPress: handleClose,
7624
7921
  hitSlop: 16,
7625
- style: [styles30.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
7922
+ style: [styles32.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
7626
7923
  accessibilityLabel: "Close picker",
7627
7924
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.text })
7628
7925
  }
@@ -7631,7 +7928,7 @@ function UserPickerSheet({
7631
7928
  Text,
7632
7929
  {
7633
7930
  style: [
7634
- styles30.title,
7931
+ styles32.title,
7635
7932
  { color: theme.colors.text, fontFamily: theme.fonts.display }
7636
7933
  ],
7637
7934
  numberOfLines: 1,
@@ -7645,7 +7942,7 @@ function UserPickerSheet({
7645
7942
  disabled: !canCreate,
7646
7943
  hitSlop: 6,
7647
7944
  style: [
7648
- styles30.createBtn,
7945
+ styles32.createBtn,
7649
7946
  {
7650
7947
  backgroundColor: canCreate ? theme.colors.accent : theme.colors.surfaceAlt,
7651
7948
  opacity: canCreate ? 1 : 0.6
@@ -7676,7 +7973,7 @@ function UserPickerSheet({
7676
7973
  value: groupName,
7677
7974
  onChangeText: setGroupName,
7678
7975
  style: [
7679
- styles30.groupNameInput,
7976
+ styles32.groupNameInput,
7680
7977
  {
7681
7978
  color: theme.colors.text,
7682
7979
  backgroundColor: theme.colors.surfaceAlt,
@@ -7695,7 +7992,7 @@ function UserPickerSheet({
7695
7992
  value: query,
7696
7993
  onChangeText: setQuery,
7697
7994
  style: [
7698
- styles30.searchInput,
7995
+ styles32.searchInput,
7699
7996
  {
7700
7997
  color: theme.colors.text,
7701
7998
  backgroundColor: theme.colors.surfaceAlt,
@@ -7712,7 +8009,7 @@ function UserPickerSheet({
7712
8009
  data: filtered,
7713
8010
  keyExtractor: (u) => u.externalId,
7714
8011
  keyboardShouldPersistTaps: "handled",
7715
- ListEmptyComponent: /* @__PURE__ */ jsx(View, { style: styles30.empty, children: /* @__PURE__ */ jsx(Text, { style: [styles30.emptyText, { color: theme.colors.textSubtle }], children: query ? "No matches." : "No users to show." }) }),
8012
+ ListEmptyComponent: /* @__PURE__ */ jsx(View, { style: styles32.empty, children: /* @__PURE__ */ jsx(Text, { style: [styles32.emptyText, { color: theme.colors.textSubtle }], children: query ? "No matches." : "No users to show." }) }),
7716
8013
  renderItem: ({ item }) => /* @__PURE__ */ jsx(
7717
8014
  UserRow,
7718
8015
  {
@@ -7754,29 +8051,29 @@ function UserRow({
7754
8051
  {
7755
8052
  onPress,
7756
8053
  style: [
7757
- styles30.row,
8054
+ styles32.row,
7758
8055
  {
7759
8056
  backgroundColor: selected ? theme.colors.accentSoft : "transparent"
7760
8057
  }
7761
8058
  ],
7762
8059
  children: [
7763
- user.avatarUrl ? /* @__PURE__ */ jsx(Image, { source: { uri: user.avatarUrl }, style: styles30.avatarImg }) : /* @__PURE__ */ jsx(Avatar, { src: null, name: user.name, seed: user.externalId, size: "md" }),
7764
- /* @__PURE__ */ jsxs(View, { style: styles30.body, children: [
8060
+ user.avatarUrl ? /* @__PURE__ */ jsx(Image, { source: { uri: user.avatarUrl }, style: styles32.avatarImg }) : /* @__PURE__ */ jsx(Avatar, { src: null, name: user.name, seed: user.externalId, size: "md" }),
8061
+ /* @__PURE__ */ jsxs(View, { style: styles32.body, children: [
7765
8062
  /* @__PURE__ */ jsx(
7766
8063
  Text,
7767
8064
  {
7768
- style: [styles30.name, { color: theme.colors.text, fontFamily: theme.fonts.body }],
8065
+ style: [styles32.name, { color: theme.colors.text, fontFamily: theme.fonts.body }],
7769
8066
  numberOfLines: 1,
7770
8067
  children: user.name
7771
8068
  }
7772
8069
  ),
7773
- user.subtitle ? /* @__PURE__ */ jsx(Text, { style: [styles30.subtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: user.subtitle }) : null
8070
+ user.subtitle ? /* @__PURE__ */ jsx(Text, { style: [styles32.subtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: user.subtitle }) : null
7774
8071
  ] }),
7775
8072
  isGroup ? /* @__PURE__ */ jsx(
7776
8073
  View,
7777
8074
  {
7778
8075
  style: [
7779
- styles30.checkbox,
8076
+ styles32.checkbox,
7780
8077
  {
7781
8078
  borderColor: selected ? theme.colors.accent : theme.colors.border,
7782
8079
  backgroundColor: selected ? theme.colors.accent : "transparent"
@@ -7789,7 +8086,7 @@ function UserRow({
7789
8086
  }
7790
8087
  );
7791
8088
  }
7792
- var styles30 = StyleSheet.create({
8089
+ var styles32 = StyleSheet.create({
7793
8090
  modalRoot: {
7794
8091
  flex: 1,
7795
8092
  justifyContent: "flex-end"
@@ -8060,7 +8357,7 @@ var PoolseInbox = forwardRef(
8060
8357
  },
8061
8358
  [renderConversationRow, meExternalId, meId, labelFor, avatarFor, unreadCounts, showPresence]
8062
8359
  );
8063
- return /* @__PURE__ */ jsxs(View, { style: [styles31.root, { backgroundColor: theme.colors.background }], children: [
8360
+ return /* @__PURE__ */ jsxs(View, { style: [styles33.root, { backgroundColor: theme.colors.background }], children: [
8064
8361
  /* @__PURE__ */ jsxs(
8065
8362
  Animated.View,
8066
8363
  {
@@ -8071,7 +8368,7 @@ var PoolseInbox = forwardRef(
8071
8368
  View,
8072
8369
  {
8073
8370
  style: [
8074
- styles31.listHeader,
8371
+ styles33.listHeader,
8075
8372
  {
8076
8373
  backgroundColor: theme.colors.surface,
8077
8374
  borderBottomColor: theme.colors.border
@@ -8082,13 +8379,13 @@ var PoolseInbox = forwardRef(
8082
8379
  Text,
8083
8380
  {
8084
8381
  style: [
8085
- styles31.listTitle,
8382
+ styles33.listTitle,
8086
8383
  { color: theme.colors.text, fontFamily: theme.fonts.display }
8087
8384
  ],
8088
8385
  children: title
8089
8386
  }
8090
8387
  ),
8091
- /* @__PURE__ */ jsxs(View, { style: styles31.headerActions, children: [
8388
+ /* @__PURE__ */ jsxs(View, { style: styles33.headerActions, children: [
8092
8389
  users ? /* @__PURE__ */ jsxs(Fragment, { children: [
8093
8390
  /* @__PURE__ */ jsx(
8094
8391
  HeaderIconButton,
@@ -8204,7 +8501,7 @@ function HeaderIconButton({
8204
8501
  hitSlop: 10,
8205
8502
  accessibilityLabel: label,
8206
8503
  style: ({ pressed }) => [
8207
- styles31.iconBtn,
8504
+ styles33.iconBtn,
8208
8505
  {
8209
8506
  backgroundColor: pressed ? theme.colors.surfaceAlt : "transparent"
8210
8507
  }
@@ -8237,7 +8534,7 @@ function DefaultConversationRow({
8237
8534
  {
8238
8535
  onPress,
8239
8536
  style: [
8240
- styles31.row,
8537
+ styles33.row,
8241
8538
  {
8242
8539
  backgroundColor: selected ? theme.colors.surfaceAlt : "transparent",
8243
8540
  borderBottomColor: theme.colors.border
@@ -8254,23 +8551,23 @@ function DefaultConversationRow({
8254
8551
  ...presence ? { presence: presence.state, doNotDisturb: !!presence.do_not_disturb } : {}
8255
8552
  }
8256
8553
  ),
8257
- /* @__PURE__ */ jsxs(View, { style: styles31.rowBody, children: [
8554
+ /* @__PURE__ */ jsxs(View, { style: styles33.rowBody, children: [
8258
8555
  /* @__PURE__ */ jsx(
8259
8556
  Text,
8260
8557
  {
8261
- style: [styles31.rowTitle, { color: theme.colors.text, fontFamily: theme.fonts.body }],
8558
+ style: [styles33.rowTitle, { color: theme.colors.text, fontFamily: theme.fonts.body }],
8262
8559
  numberOfLines: 1,
8263
8560
  children: title
8264
8561
  }
8265
8562
  ),
8266
- /* @__PURE__ */ jsx(Text, { style: [styles31.rowSubtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview ?? (isDirect ? otherExtId ?? "" : `${(conv.member_external_ids ?? []).length} members`) })
8563
+ /* @__PURE__ */ jsx(Text, { style: [styles33.rowSubtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview ?? (isDirect ? otherExtId ?? "" : `${(conv.member_external_ids ?? []).length} members`) })
8267
8564
  ] }),
8268
- unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles31.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsx(Text, { style: [styles31.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
8565
+ unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles33.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsx(Text, { style: [styles33.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
8269
8566
  ]
8270
8567
  }
8271
8568
  );
8272
8569
  }
8273
- var styles31 = StyleSheet.create({
8570
+ var styles33 = StyleSheet.create({
8274
8571
  root: {
8275
8572
  flex: 1,
8276
8573
  overflow: "hidden"
@@ -8406,9 +8703,9 @@ function useAppStateLifecycle(options = {}) {
8406
8703
  const sub = AppState.addEventListener("change", (next) => {
8407
8704
  if (next === "background") {
8408
8705
  setActivity("idle");
8409
- poolse.realtime.pause();
8706
+ poolse.setBackground(true);
8410
8707
  } else if (next === "active") {
8411
- poolse.realtime.resume();
8708
+ poolse.setBackground(false);
8412
8709
  setActivity("active");
8413
8710
  } else {
8414
8711
  setActivity("idle");
@@ -8418,6 +8715,41 @@ function useAppStateLifecycle(options = {}) {
8418
8715
  }, [poolse, presence]);
8419
8716
  }
8420
8717
 
8718
+ // src/internal/background.ts
8719
+ function applyBackground(clients, active, appActive, keepConnected = []) {
8720
+ for (const c of clients) {
8721
+ if (c.destroyed) continue;
8722
+ const foreground = appActive && (c === active || keepConnected.includes(c));
8723
+ c.setBackground(!foreground);
8724
+ }
8725
+ }
8726
+
8727
+ // src/lifecycle/useBackgroundClients.ts
8728
+ function useBackgroundClients(clients, active, opts = {}) {
8729
+ const [appState, setAppState] = useState(AppState.currentState ?? "active");
8730
+ useEffect(() => {
8731
+ const sub = AppState.addEventListener("change", setAppState);
8732
+ return () => sub.remove();
8733
+ }, []);
8734
+ const appActive = appState !== "background";
8735
+ const keep = opts.keepConnected ?? EMPTY;
8736
+ const presence = opts.presence ?? true;
8737
+ const lastActive = useRef(null);
8738
+ useEffect(() => {
8739
+ applyBackground(clients, active, appActive, keep);
8740
+ }, [clients, active, appActive, keep]);
8741
+ useEffect(() => {
8742
+ if (!presence) return;
8743
+ const prev = lastActive.current;
8744
+ if (prev && prev !== active && !prev.destroyed) prev.presence.setActivity("idle");
8745
+ lastActive.current = active;
8746
+ if (active && !active.destroyed) {
8747
+ active.presence.setActivity(appState === "active" ? "active" : "idle");
8748
+ }
8749
+ }, [active, appState, presence]);
8750
+ }
8751
+ var EMPTY = [];
8752
+
8421
8753
  // src/voice/callTheme.ts
8422
8754
  var callColors = {
8423
8755
  /** Behind everything. Near-black, cooled toward the brand. */
@@ -8466,7 +8798,7 @@ function CallControlButton({
8466
8798
  const size = large ? CONTROL_SIZE_LARGE : CONTROL_SIZE;
8467
8799
  const background = tone === "danger" ? callColors.danger : tone === "accept" ? callColors.accept : active ? callColors.controlActive : callColors.control;
8468
8800
  const iconColor = tone === "neutral" && active ? callColors.controlActiveIcon : callColors.onAction;
8469
- return /* @__PURE__ */ jsxs(View, { style: styles32.slot, children: [
8801
+ return /* @__PURE__ */ jsxs(View, { style: styles34.slot, children: [
8470
8802
  /* @__PURE__ */ jsx(
8471
8803
  Pressable,
8472
8804
  {
@@ -8477,7 +8809,7 @@ function CallControlButton({
8477
8809
  accessibilityLabel: accessibilityLabel ?? label ?? icon,
8478
8810
  hitSlop: 8,
8479
8811
  style: ({ pressed }) => [
8480
- styles32.button,
8812
+ styles34.button,
8481
8813
  {
8482
8814
  width: size,
8483
8815
  height: size,
@@ -8491,10 +8823,10 @@ function CallControlButton({
8491
8823
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: icon, size: large ? 30 : 25, color: iconColor, label: null })
8492
8824
  }
8493
8825
  ),
8494
- label ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles32.label, children: label }) : null
8826
+ label ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles34.label, children: label }) : null
8495
8827
  ] });
8496
8828
  }
8497
- var styles32 = StyleSheet.create({
8829
+ var styles34 = StyleSheet.create({
8498
8830
  // Fixed width so captions of different lengths cannot shift the row.
8499
8831
  slot: { width: 76, alignItems: "center", gap: 7 },
8500
8832
  button: { alignItems: "center", justifyContent: "center" },
@@ -8507,7 +8839,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
8507
8839
  View,
8508
8840
  {
8509
8841
  style: [
8510
- styles33.ring,
8842
+ styles35.ring,
8511
8843
  {
8512
8844
  width: outer,
8513
8845
  height: outer,
@@ -8520,7 +8852,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
8520
8852
  View,
8521
8853
  {
8522
8854
  style: [
8523
- styles33.circle,
8855
+ styles35.circle,
8524
8856
  {
8525
8857
  width: size,
8526
8858
  height: size,
@@ -8531,7 +8863,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
8531
8863
  children: /* @__PURE__ */ jsx(
8532
8864
  Text,
8533
8865
  {
8534
- style: [styles33.initials, { fontSize: Math.round(size * 0.38) }],
8866
+ style: [styles35.initials, { fontSize: Math.round(size * 0.38) }],
8535
8867
  numberOfLines: 1,
8536
8868
  allowFontScaling: false,
8537
8869
  children: initialsOf(name)
@@ -8548,7 +8880,7 @@ function initialsOf(name) {
8548
8880
  if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
8549
8881
  return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
8550
8882
  }
8551
- var styles33 = StyleSheet.create({
8883
+ var styles35 = StyleSheet.create({
8552
8884
  ring: { alignItems: "center", justifyContent: "center" },
8553
8885
  circle: { alignItems: "center", justifyContent: "center" },
8554
8886
  initials: { color: "#ffffff", fontWeight: "600" }
@@ -8576,15 +8908,15 @@ function AudioRouteSheet({
8576
8908
  animationType: "fade",
8577
8909
  onRequestClose: onClose,
8578
8910
  ...EDGE_TO_EDGE_MODAL,
8579
- children: /* @__PURE__ */ jsx(Pressable, { style: styles34.backdrop, onPress: onClose, accessibilityRole: "button", children: /* @__PURE__ */ jsxs(
8911
+ children: /* @__PURE__ */ jsx(Pressable, { style: styles36.backdrop, onPress: onClose, accessibilityRole: "button", children: /* @__PURE__ */ jsxs(
8580
8912
  Pressable,
8581
8913
  {
8582
- style: [styles34.sheet, { paddingBottom: Math.max(34, insets.bottom + 16) }],
8914
+ style: [styles36.sheet, { paddingBottom: Math.max(34, insets.bottom + 16) }],
8583
8915
  onPress: () => {
8584
8916
  },
8585
8917
  children: [
8586
- /* @__PURE__ */ jsx(View, { style: styles34.grabber }),
8587
- /* @__PURE__ */ jsx(Text, { style: styles34.title, children: "Audio output" }),
8918
+ /* @__PURE__ */ jsx(View, { style: styles36.grabber }),
8919
+ /* @__PURE__ */ jsx(Text, { style: styles36.title, children: "Audio output" }),
8588
8920
  routes.map((route) => {
8589
8921
  const selected = route.id === selectedRouteId;
8590
8922
  return /* @__PURE__ */ jsxs(
@@ -8596,7 +8928,7 @@ function AudioRouteSheet({
8596
8928
  },
8597
8929
  accessibilityRole: "button",
8598
8930
  accessibilityState: { selected },
8599
- style: ({ pressed }) => [styles34.row, pressed && styles34.rowPressed],
8931
+ style: ({ pressed }) => [styles36.row, pressed && styles36.rowPressed],
8600
8932
  children: [
8601
8933
  /* @__PURE__ */ jsx(
8602
8934
  PoolseIcon,
@@ -8607,7 +8939,7 @@ function AudioRouteSheet({
8607
8939
  label: null
8608
8940
  }
8609
8941
  ),
8610
- /* @__PURE__ */ jsx(Text, { style: [styles34.label, selected && styles34.labelSelected], children: route.label }),
8942
+ /* @__PURE__ */ jsx(Text, { style: [styles36.label, selected && styles36.labelSelected], children: route.label }),
8611
8943
  selected && /* @__PURE__ */ jsx(PoolseIcon, { name: "check", size: 19, color: callColors.accept, label: "selected" })
8612
8944
  ]
8613
8945
  },
@@ -8620,7 +8952,7 @@ function AudioRouteSheet({
8620
8952
  }
8621
8953
  );
8622
8954
  }
8623
- var styles34 = StyleSheet.create({
8955
+ var styles36 = StyleSheet.create({
8624
8956
  backdrop: { flex: 1, backgroundColor: "rgba(0,0,0,0.55)", justifyContent: "flex-end" },
8625
8957
  sheet: {
8626
8958
  backgroundColor: callColors.tile,
@@ -8680,6 +9012,6 @@ function format(total) {
8680
9012
  return `${hours > 0 ? `${hours}:` : ""}${mm}:${String(seconds).padStart(2, "0")}`;
8681
9013
  }
8682
9014
 
8683
- export { AttachmentPicker, AttachmentPreview, AudioRouteSheet, Avatar, CallAvatar, CallControlButton, CallLogRow, ChatHeader, ConversationList, ConversationView, DaySeparator, EditHistorySheet, EmojiPicker, GroupDetailsSheet, ImageMosaic, LinkPreviewCard, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, MessageList, MessageRow, NewMessagesDivider, PoolseIcon, PoolseInbox, PoolseLogo, PoolseTheme, PresenceBadge, primitives as Primitives, ReactionPicker, ReactionStrip, ThreadSummary, ThreadView, TypingIndicator, UploadQueueStrip, UserName, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useAppStatePresence, useCallDuration, useDisplayName, usePoolseTheme, useTheme };
9015
+ export { AttachmentPicker, AttachmentPreview, AudioRouteSheet, Avatar, CallAvatar, CallControlButton, CallLogRow, ChatHeader, ConversationList, ConversationView, DaySeparator, EditHistorySheet, EmojiPicker, EmptyState, GroupDetailsSheet, ImageMosaic, LinkPreviewCard, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, MessageList, MessageRow, NewMessagesDivider, PoolseIcon, PoolseInbox, PoolseLogo, PoolseTheme, PresenceBadge, primitives as Primitives, ReactionPicker, ReactionStrip, SendStatus, ThreadSummary, ThreadView, TypingIndicator, UploadQueueStrip, UserName, applyBackground, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useAppStatePresence, useBackgroundClients, useCallDuration, useDisplayName, usePoolseTheme, useTheme };
8684
9016
  //# sourceMappingURL=index.js.map
8685
9017
  //# sourceMappingURL=index.js.map