@ghostlytools/sdk 1.10.2 → 1.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/core.js +2 -2
  2. package/dist/{fakes-Bj5HAJFV.js → fakes-r4tfM7wk.js} +2 -2
  3. package/dist/{fakes-Bj5HAJFV.js.map → fakes-r4tfM7wk.js.map} +1 -1
  4. package/dist/fakes.js +1 -1
  5. package/dist/index.js +2 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/{keet-identity-key-BgbqG2dL.js → keet-identity-key-CIwy3XtG.js} +2 -2
  8. package/dist/{keet-identity-key-BgbqG2dL.js.map → keet-identity-key-CIwy3XtG.js.map} +1 -1
  9. package/dist/{src-DHR2fUGx.js → src-0lxL4lAH.js} +930 -199
  10. package/dist/src-0lxL4lAH.js.map +1 -0
  11. package/dist/testing.js +3 -3
  12. package/dist/types/browser/src/proofs/contract.d.ts +4 -1
  13. package/dist/types/core/src/chatFiles.d.ts +6 -0
  14. package/dist/types/core/src/dhtDelivery.d.ts +52 -0
  15. package/dist/types/core/src/frames.d.ts +6 -0
  16. package/dist/types/core/src/ghostlink.d.ts +4 -0
  17. package/dist/types/core/src/groupCommunity.d.ts +26 -3
  18. package/dist/types/core/src/groupSession.d.ts +46 -3
  19. package/dist/types/core/src/http.d.ts +1 -0
  20. package/dist/types/core/src/identityProofs.d.ts +17 -0
  21. package/dist/types/core/src/identityTimeline.d.ts +8 -2
  22. package/dist/types/core/src/link.d.ts +8 -0
  23. package/dist/types/core/src/relay.d.ts +46 -7
  24. package/dist/types/core/src/transport.d.ts +29 -0
  25. package/dist/types/core/src/transportSwitch.d.ts +2 -0
  26. package/dist/{verify-aVAh4GtV.js → verify-DyjsMutX.js} +3 -2
  27. package/dist/verify-DyjsMutX.js.map +1 -0
  28. package/package.json +1 -1
  29. package/dist/src-DHR2fUGx.js.map +0 -1
  30. package/dist/verify-aVAh4GtV.js.map +0 -1
@@ -659,6 +659,7 @@ function createRelayPayload(identity, records, timestampMicros = BigInt(Date.now
659
659
  */
660
660
  function signRelayPayload(identity, dnsPacket, seq) {
661
661
  if (dnsPacket.length > 1e3) throw new PacketTooLargeError(dnsPacket.length);
662
+ if (seq < 0n || seq >= 1n << 64n) throw new RangeError(`Sequence number ${seq} does not fit in 64 bits`);
662
663
  const signature = sign(signable(seq, dnsPacket), identity.seed);
663
664
  const timestamp = new Uint8Array(TIMESTAMP_LENGTH);
664
665
  new DataView(timestamp.buffer).setBigUint64(0, seq);
@@ -761,6 +762,7 @@ function withRequestOptions(transport, extra) {
761
762
  if (transport.turnRead) wrapped.turnRead = (pubKeyZ32, options) => transport.turnRead(pubKeyZ32, options);
762
763
  if (transport.turnPut) wrapped.turnPut = (pubKeyZ32, payload, conditions) => transport.turnPut(pubKeyZ32, payload, conditions);
763
764
  if (transport.turnWarm) wrapped.turnWarm = () => transport.turnWarm();
765
+ if (transport.forget) wrapped.forget = (keys) => transport.forget(keys);
764
766
  return wrapped;
765
767
  }
766
768
  /**
@@ -782,6 +784,30 @@ function isDiscoveryBudgetError(error) {
782
784
  return error instanceof DiscoveryBudgetError || typeof error === "object" && error !== null && error.code === "discovery-budget" && typeof error.retryInMs === "number";
783
785
  }
784
786
  /**
787
+ * A publish no relay took (`RelayTransport`), saying whether one of them may hold the packet all the same. Not
788
+ * `mayBeStored` only when every relay was not asked now (its budget, its rate limit, its breaker, its network
789
+ * cooldown), answered that it did not take it (a 4xx), or could not be reached before the request went (a refused
790
+ * connection or a name that does not resolve, where the runtime says so: Node does, a browser does not), or when there
791
+ * is no relay at all. A relay that did not answer in time, dropped the connection, or answered with a server error
792
+ * may have stored it. The message is the publish's usual one.
793
+ */
794
+ var PublishFailedError = class extends Error {
795
+ mayBeStored;
796
+ code = "publish-failed";
797
+ constructor(message, mayBeStored) {
798
+ super(message);
799
+ this.mayBeStored = mayBeStored;
800
+ }
801
+ };
802
+ /**
803
+ * Whether `error` is a publish that went nowhere (`PublishFailedError` with `mayBeStored` false), also from another
804
+ * copy of this module. Anything else (a timeout, the DHT's own failure beside the relays', a Desktop's error in
805
+ * words) may have left this device.
806
+ */
807
+ function publishedNowhere(error) {
808
+ return typeof error === "object" && error !== null && error.code === "publish-failed" && error.mayBeStored === false;
809
+ }
810
+ /**
785
811
  * A publish Ghostly Desktop's Rust relay client held back, as it says it in words (`pkarr_network.rs`
786
812
  * `publish_failure`: "Publish held back on every relay…; retry in N ms: …"), as the `DiscoveryBudgetError` it is: every
787
813
  * relay held the packet back for its rate limit, or held it back beside relays left alone for failing, and nothing failed
@@ -997,6 +1023,7 @@ var asker = (options, write) => ({
997
1023
  watch: !!options.watch && !write,
998
1024
  watchWrite: !!options.watch && write,
999
1025
  departed: !!options.departed && !write,
1026
+ awaited: !!options.awaited && !write,
1000
1027
  resume: !!options.resume && !write,
1001
1028
  back: !!options.back
1002
1029
  });
@@ -1006,6 +1033,8 @@ var isChat = (who) => !who.background && !who.group;
1006
1033
  var isChatSignal = (who) => who.signal && isChat(who);
1007
1034
  /** A 1:1 chat's read of a contact that just went away: a few may use the chat's allowance (`DEPARTED_READS`). */
1008
1035
  var isDepartedRead = (who) => who.departed && isChat(who);
1036
+ /** A 1:1 chat's read of an invite this side made, its joiner due: a few may use the chat's allowance (`AWAITED_READS`). */
1037
+ var isAwaitedRead = (who) => who.awaited && isChat(who);
1009
1038
  /** A group's edge looking fast for a signal (`GROUP_BURST_MS`). */
1010
1039
  var isGroupUrgentRead = (who) => who.group && who.urgent && !who.write && !who.background;
1011
1040
  /**
@@ -1034,6 +1063,7 @@ var ANSWER_READER = {
1034
1063
  watch: false,
1035
1064
  watchWrite: false,
1036
1065
  departed: false,
1066
+ awaited: false,
1037
1067
  resume: false,
1038
1068
  back: false
1039
1069
  };
@@ -1053,6 +1083,13 @@ var firstWriter = (who) => !who.write || who.background ? null : who.group ? "gr
1053
1083
  /** A key's turn neither asked nor read in the last minute: it is dropped, and asking again starts a new one (`TURNS_PRUNE_MS`). */
1054
1084
  var staleTurn = (turn, now) => now - Math.max(turn.askedAt, turn.servedAt) >= 6e4;
1055
1085
  /**
1086
+ * The times of `list` (oldest first) within the last `ms`. One dated after now, the device clock gone back since (an NTP
1087
+ * step, a clock that ran ahead fixed by hand), counts as of now: as just spent, not for as long as the clock went back.
1088
+ * Counted as they were, an hour's step back held every background read for 59 minutes, and a daemon with 50 contacts
1089
+ * away read 4 of them in the next 15 (bug hunt, 2026-11-07).
1090
+ */
1091
+ var within = (list, now, ms) => list.map((at) => Math.min(at, now)).filter((at) => now - at < ms);
1092
+ /**
1056
1093
  * Keys and when each was last set, those of the last minute: how many and the latest, without walking them all (the
1057
1094
  * chats that need a relay, `chatNeeds`). Each is set at the time it is set, so the sets come oldest first; a clock
1058
1095
  * gone back makes the later ones as of now.
@@ -1206,6 +1243,19 @@ var SIGNALING_ALLOWANCE_SHARE = 1 / 5;
1206
1243
  */
1207
1244
  var DEPARTED_READS = 6;
1208
1245
  /**
1246
+ * A 1:1 chat's reads of an invite this side made, while its joiner is due and has not shown (`awaited`, `AWAITING_PEER_MS`
1247
+ * in link.ts), may go over a relay's minute within the chat's allowance (`SIGNALING_ALLOWANCE_SHARE`) the same way: at
1248
+ * most this many of each invite's in a minute, every relay together. And while one asked in the last minute, the departed
1249
+ * reads leave them half of that on each relay: the last `AWAITED_READS / 2` of the allowance's reads (`DEPARTED_READS`
1250
+ * then take at most 3 on a relay of 30, against 5). Read every 2 to 4 s, they cover the seconds in which a joiner that
1251
+ * opened the link at once knocks. Within the chats' allowance, they add nothing to what a relay may see in a minute
1252
+ * (`WAY_BACK_SHARE`): 36 at most from the chats on a relay of 30, none past 5 on a relay of 5. An inviter pairing one joiner after
1253
+ * another on relays of 30 spent the minute on both 12 s in (two pairings, about 15 requests a relay each), the departed
1254
+ * reads of the contact that had just left took the allowance, and the third invite's key was read once, then not until
1255
+ * the minute freed: the joiner's knock 48 s late, and join to live in 60 s, against 2.6 and 4.6 s (CLI lab, 2026-11-07).
1256
+ */
1257
+ var AWAITED_READS = 4;
1258
+ /**
1209
1259
  * A group edge's requests for a member that may be back may go over a relay's minute by this fraction of it (4 on a
1210
1260
  * relay of 30, 8 on one of 60, none on a relay of 5): its reads of a member that went away and its packet
1211
1261
  * written meanwhile, which that member reads first when it is back (`watch`), its offer or answer, and its reads for
@@ -1386,6 +1436,7 @@ var CATCH_UP_ASKER = {
1386
1436
  watch: false,
1387
1437
  watchWrite: false,
1388
1438
  departed: false,
1439
+ awaited: false,
1389
1440
  resume: false,
1390
1441
  back: false
1391
1442
  };
@@ -1476,6 +1527,47 @@ function looksLikeHost(text) {
1476
1527
  /** A relay the breaker leaves alone for failing (`RelayBreaker`): nothing was asked of it now. */
1477
1528
  var RelayLeftAloneError = class extends Error {};
1478
1529
  /**
1530
+ * A relay a put did not get an answer from. `sent` false: the request never left (its network cooling down after a
1531
+ * failure, or a connection that could not be made, `connectFailed`); true: it may have reached the relay.
1532
+ */
1533
+ var RelayNoAnswerError = class extends Error {
1534
+ sent;
1535
+ constructor(message, sent) {
1536
+ super(message);
1537
+ this.sent = sent;
1538
+ }
1539
+ };
1540
+ /** What Node says of a connection it could not make: the request never left. A browser's TypeError says nothing either way. */
1541
+ var CONNECT_FAILURES = /* @__PURE__ */ new Set([
1542
+ "ECONNREFUSED",
1543
+ "ENOTFOUND",
1544
+ "EAI_AGAIN",
1545
+ "EHOSTUNREACH",
1546
+ "ENETUNREACH",
1547
+ "ENETDOWN",
1548
+ "EHOSTDOWN",
1549
+ "EADDRNOTAVAIL",
1550
+ "UND_ERR_CONNECT_TIMEOUT"
1551
+ ]);
1552
+ /** A fetch that failed before its request left this device: Node's `cause.code` (each of an AggregateError's, for several addresses). */
1553
+ function connectFailed(error) {
1554
+ const cause = error?.cause;
1555
+ if (!cause || typeof cause !== "object") return false;
1556
+ if (Array.isArray(cause.errors) && cause.errors.length) return cause.errors.every((e) => CONNECT_FAILURES.has(e?.code));
1557
+ return CONNECT_FAILURES.has(cause.code);
1558
+ }
1559
+ /**
1560
+ * The error a publish ends with after a second round dated past a relay's later copy failed too: one that may have
1561
+ * stored the first round's packet still may, whatever the second round's relays said.
1562
+ */
1563
+ function laterRound(first, later) {
1564
+ return publishedNowhere(later) && !publishedNowhere(first) ? new PublishFailedError(later.message, true) : later;
1565
+ }
1566
+ /** A packet date no further ahead of this clock than readers take (`newerPacket`): one this client may date past. */
1567
+ function withinSkew(timestamp) {
1568
+ return timestamp <= BigInt(Date.now() + PKARR_FUTURE_SKEW_MS) * 1000n;
1569
+ }
1570
+ /**
1479
1571
  * A read the relays failed (or left alone for failing before), when its caller has another path to ask
1480
1572
  * (`RelayTransport.resolve` with `keptOnFailure` false): `kept` is the newest packet the relays gave for the key before.
1481
1573
  */
@@ -1499,7 +1591,9 @@ var RelayTransport = class {
1499
1591
  * records are written by every member, an inviter warms its contact's key with an empty packet, and this device's
1500
1592
  * own clock may have been set back since it last wrote. A relay and the DHT keep only the packet dated latest, so
1501
1593
  * one dated by this clock alone, when it is behind, was refused (409) or silently never read, until this clock
1502
- * caught up with the other one: minutes, or an hour.
1594
+ * caught up with the other one: minutes, or an hour. Only up to `PKARR_FUTURE_SKEW_MS` ahead of this clock
1595
+ * (`withinSkew`): a packet one holder of a shared key dated further ahead must not date every later one of this
1596
+ * device past it (past 64 bits, unsignable; else ahead of every reader's clock, never taken over one dated now).
1503
1597
  */
1504
1598
  seenTimestamp = /* @__PURE__ */ new Map();
1505
1599
  /**
@@ -1534,6 +1628,10 @@ var RelayTransport = class {
1534
1628
  spentAnswerAllowance = /* @__PURE__ */ new Map();
1535
1629
  /** Per contact, its departed reads past the limit in the last minute, every relay together (`DEPARTED_READS`). */
1536
1630
  departedOver = /* @__PURE__ */ new Map();
1631
+ /** Per invite, its awaited reads past the limit in the last minute, every relay together (`AWAITED_READS`). */
1632
+ awaitedOver = /* @__PURE__ */ new Map();
1633
+ /** When an awaited invite's read last asked: the departed reads leave it room for a minute (`AWAITED_READS`). */
1634
+ awaitedAt = -Infinity;
1537
1635
  /**
1538
1636
  * Per key a group reads (not in the background), when a read of it last went out and when it last asked: whose turn
1539
1637
  * it is under the watch share (`WATCH_SHARE`) and while the groups' reads are rationed (`GROUP_RATION_WINDOW_MS`). And
@@ -1586,6 +1684,10 @@ var RelayTransport = class {
1586
1684
  hedgeMs;
1587
1685
  /** Until when each relay found slow (`SLOW_MS`) goes after the others in a read (`readOrder`). */
1588
1686
  slowUntil = /* @__PURE__ */ new Map();
1687
+ /** Per relay, when each of this client's requests still waiting for its answer went out (`unanswering`). */
1688
+ waiting = /* @__PURE__ */ new Map();
1689
+ /** When each relay last answered a request of this client, whatever it said (`unanswering`). */
1690
+ answeredAt = /* @__PURE__ */ new Map();
1589
1691
  /** Keys whose last read was answered 404: their next read hedges later (`HEDGE_MISSING_MS`). */
1590
1692
  missing = /* @__PURE__ */ new Set();
1591
1693
  listeners = /* @__PURE__ */ new Set();
@@ -1642,6 +1744,24 @@ var RelayTransport = class {
1642
1744
  this.slowUntil.clear();
1643
1745
  this.changed("recovered");
1644
1746
  }
1747
+ /**
1748
+ * `PkarrTransport.forget`: the packets and dates this client kept under these keys go, on every relay (`written`,
1749
+ * `newest`, `lastTimestamp`, `seenTimestamp`, `lastPut`). A spare invite replaced unused left them here for its two keys
1750
+ * for good: an idle CLI daemon gained 8 keys an hour (343 in `written` and 690 `lastPut` entries after a day). The maps
1751
+ * that bound themselves (`readAt`, `lastReadFrom`, `heldBack`, `missing`, the turns) and the catch-ups, which go once
1752
+ * put, are left as they are. A later put under one of these keys goes as a key's first.
1753
+ */
1754
+ forget(keys) {
1755
+ const gone = new Set(keys);
1756
+ if (gone.size === 0) return;
1757
+ for (const key of gone) for (const perKey of [
1758
+ this.lastTimestamp,
1759
+ this.seenTimestamp,
1760
+ this.newest,
1761
+ this.written
1762
+ ]) perKey.delete(key);
1763
+ for (const slot of this.lastPut.keys()) if (gone.has(slot.slice(slot.lastIndexOf(" ") + 1))) this.lastPut.delete(slot);
1764
+ }
1645
1765
  /** Called when a relay trips or recovers. */
1646
1766
  subscribe(listener) {
1647
1767
  this.listeners.add(listener);
@@ -1677,7 +1797,7 @@ var RelayTransport = class {
1677
1797
  * Returns once one relay took the packet: the others finish in the background.
1678
1798
  */
1679
1799
  async publish(identity, records, options = {}) {
1680
- if (this.relays.length === 0) throw new Error("No Pkarr relays configured");
1800
+ if (this.relays.length === 0) throw new PublishFailedError("No Pkarr relays configured", false);
1681
1801
  await this.publishDated(identity, records, (key, payload, timestamp, conflict) => this.putEverywhere(key, payload, timestamp, options, conflict), options);
1682
1802
  }
1683
1803
  /**
@@ -1716,7 +1836,7 @@ var RelayTransport = class {
1716
1836
  if (again || redated) return;
1717
1837
  redated = (async () => {
1718
1838
  const held = read ? await read().catch(() => null) : await this.heldAt(relay, key, asker(options, true));
1719
- if (held === null || held < timestamp) return false;
1839
+ if (held === null || held < timestamp || !withinSkew(held)) return false;
1720
1840
  traceLink(key, "publish-redated", {
1721
1841
  aheadMs: Number((held - timestamp) / 1000n),
1722
1842
  relay
@@ -1731,7 +1851,9 @@ var RelayTransport = class {
1731
1851
  await put(key, createRelayPayload(identity, records, timestamp), timestamp, conflict);
1732
1852
  } catch (error) {
1733
1853
  const pending = redated;
1734
- if (!pending || !await pending) throw error;
1854
+ if (!pending || !await pending.catch((later) => {
1855
+ throw laterRound(error, later);
1856
+ })) throw error;
1735
1857
  }
1736
1858
  }
1737
1859
  /** `PkarrTransport.publishHeld`: `publishDated`'s check before signing, for a payload signed elsewhere in this process. */
@@ -1797,7 +1919,7 @@ var RelayTransport = class {
1797
1919
  }
1798
1920
  /** A packet under this key was read (on a relay, or by the CLI on the DHT): its time, for `nextTimestamp`. */
1799
1921
  sawTimestamp(pubKeyZ32, timestamp) {
1800
- if (timestamp > (this.seenTimestamp.get(pubKeyZ32) ?? 0n)) this.seenTimestamp.set(pubKeyZ32, timestamp);
1922
+ if (withinSkew(timestamp) && timestamp > (this.seenTimestamp.get(pubKeyZ32) ?? 0n)) this.seenTimestamp.set(pubKeyZ32, timestamp);
1801
1923
  }
1802
1924
  /**
1803
1925
  * Puts a payload `publishDated` just signed, dated `timestamp`, on every relay. Its signature is not checked: it was
@@ -1805,7 +1927,7 @@ var RelayTransport = class {
1805
1927
  * gives it.
1806
1928
  */
1807
1929
  async putSigned(pubKeyZ32, payload, timestamp, options = {}, conflict) {
1808
- if (this.relays.length === 0) throw new Error("No Pkarr relays configured");
1930
+ if (this.relays.length === 0) throw new PublishFailedError("No Pkarr relays configured", false);
1809
1931
  await this.putEverywhere(pubKeyZ32, payload, timestamp, options, conflict);
1810
1932
  }
1811
1933
  /**
@@ -1813,7 +1935,7 @@ var RelayTransport = class {
1813
1935
  * (`signedAt`) and is not checked again. `conflict`: as `publishDated` gives it.
1814
1936
  */
1815
1937
  async publishPayload(pubKeyZ32, payload, options = {}, conflict) {
1816
- if (this.relays.length === 0) throw new Error("No Pkarr relays configured");
1938
+ if (this.relays.length === 0) throw new PublishFailedError("No Pkarr relays configured", false);
1817
1939
  const seq = options.signedAt ?? openRelayPayload(pubKeyZ32, payload).seq;
1818
1940
  if (options.signedAt === void 0 || !options.redate) return this.putEverywhere(pubKeyZ32, payload, seq, options, conflict);
1819
1941
  await this.putRedated(pubKeyZ32, payload, seq, options, PAYLOAD_REDATES);
@@ -1846,7 +1968,7 @@ var RelayTransport = class {
1846
1968
  if (left <= 0 || redated) return;
1847
1969
  redated = (async () => {
1848
1970
  const held = await this.heldAt(relay, key, asker(options, true));
1849
- if (held === null || held < timestamp) return false;
1971
+ if (held === null || held < timestamp || !withinSkew(held)) return false;
1850
1972
  if (this.lastTimestamp.get(key) !== timestamp) return true;
1851
1973
  const again = options.redate(held);
1852
1974
  if (!again) return true;
@@ -1866,7 +1988,9 @@ var RelayTransport = class {
1866
1988
  await this.putEverywhere(key, payload, timestamp, options, conflict);
1867
1989
  } catch (error) {
1868
1990
  const pending = redated;
1869
- if (!pending || !await pending) throw error;
1991
+ if (!pending || !await pending.catch((later) => {
1992
+ throw laterRound(error, later);
1993
+ })) throw error;
1870
1994
  }
1871
1995
  }
1872
1996
  /**
@@ -1892,11 +2016,15 @@ var RelayTransport = class {
1892
2016
  let first;
1893
2017
  const edgeSignal = isGroupSignal(asker(options, true));
1894
2018
  const failed = /* @__PURE__ */ new Set();
1895
- const puts = this.relays.map(async (relay) => {
2019
+ const nowhere = this.relays.map(() => false);
2020
+ const puts = this.relays.map(async (relay, i) => {
1896
2021
  const slot = `${relay} ${pubKeyZ32}`;
1897
2022
  const previous = this.lastPut.get(slot);
1898
2023
  this.lastPut.set(slot, timestamp);
1899
- if (first && isChat(asker(options, true)) && this.spareHeldFor(relay, Date.now()) > 0 && await answeredWithin(first, 3e3)) throw new DiscoveryBudgetError(Math.max(CATCH_UP_MIN_MS, this.spareHeldFor(relay, Date.now())));
2024
+ if (first && isChat(asker(options, true)) && this.spareHeldFor(relay, Date.now()) > 0 && await answeredWithin(first, 3e3)) {
2025
+ nowhere[i] = true;
2026
+ throw new DiscoveryBudgetError(Math.max(CATCH_UP_MIN_MS, this.spareHeldFor(relay, Date.now())));
2027
+ }
1900
2028
  let response;
1901
2029
  try {
1902
2030
  response = await this.put(relay, pubKeyZ32, payload, previous, asker(options, true), relay === probe, (ok) => {
@@ -1905,8 +2033,10 @@ var RelayTransport = class {
1905
2033
  if (response.status === 412) response = await this.put(relay, pubKeyZ32, payload, void 0, asker(options, true));
1906
2034
  } catch (error) {
1907
2035
  if (!isDiscoveryBudgetError(error) && !(error instanceof RelayLeftAloneError)) failed.add(relay);
2036
+ nowhere[i] = isDiscoveryBudgetError(error) || error instanceof RelayLeftAloneError || error instanceof RelayNoAnswerError && !error.sent;
1908
2037
  throw error;
1909
2038
  }
2039
+ nowhere[i] = response.status >= 400 && response.status < 500;
1910
2040
  if (response.status >= 500 || response.status === 428) failed.add(relay);
1911
2041
  if (response.status === 409) conflict?.(relay);
1912
2042
  if (response.status === 429) throw new DiscoveryBudgetError(this.coolDown(relay, response), `${relay} responded 429; retry shortly`);
@@ -1939,7 +2069,7 @@ var RelayTransport = class {
1939
2069
  const reasons = results.map((r) => r.status === "rejected" ? String(r.reason) : "").join("; ");
1940
2070
  if (waits.length === results.length) reject(new DiscoveryBudgetError(Math.min(...waits.map((e) => e.retryInMs)), `Publish held back on every relay: ${reasons}`));
1941
2071
  else if (waits.length && results.every((r, i) => held[i] !== null || leftAlone(r))) reject(new DiscoveryBudgetError(Math.min(...waits.map((e) => e.retryInMs)), `Publish held back on every relay not left alone: ${reasons}`));
1942
- else reject(/* @__PURE__ */ new Error(`Publish failed on every relay: ${reasons}`));
2072
+ else reject(new PublishFailedError(`Publish failed on every relay: ${reasons}`, !nowhere.every(Boolean)));
1943
2073
  });
1944
2074
  });
1945
2075
  }
@@ -1967,8 +2097,8 @@ var RelayTransport = class {
1967
2097
  async resolve(pubKeyZ32, options = {}, keptOnFailure = true) {
1968
2098
  if (this.relays.length === 0) throw new Error("No Pkarr relays configured");
1969
2099
  if (options.background && !options.urgent && !options.group) this.chatNeedLapsed(pubKeyZ32);
1970
- const readAt = this.readAt.get(pubKeyZ32);
1971
- if (readAt !== void 0 && Date.now() - readAt < this.freshReadMs) return this.newest.get(pubKeyZ32) ?? null;
2100
+ const readAt = this.readAt.get(pubKeyZ32), age = readAt === void 0 ? Infinity : Date.now() - readAt;
2101
+ if (age >= 0 && age < this.freshReadMs) return this.newest.get(pubKeyZ32) ?? null;
1972
2102
  const order = this.readOrder(pubKeyZ32);
1973
2103
  const probe = this.breaker.allDownProbe(this.relays);
1974
2104
  let budgetWait = Infinity, down = false;
@@ -2087,7 +2217,7 @@ var RelayTransport = class {
2087
2217
  }
2088
2218
  for (const loser of asked.values()) {
2089
2219
  loser.controller.abort();
2090
- if (outcome.kind === "packet" && loser.started <= attempt.started) this.slow(loser.relay);
2220
+ if (loser.started <= attempt.started && (outcome.kind === "packet" || Date.now() - loser.started >= 6e3)) this.slow(loser.relay);
2091
2221
  else this.breaker.cancel(loser.relay);
2092
2222
  }
2093
2223
  this.lastRelay = relay;
@@ -2109,7 +2239,8 @@ var RelayTransport = class {
2109
2239
  throw new Error("No Pkarr relay reachable");
2110
2240
  }
2111
2241
  /**
2112
- * The order a key's read asks the relays in: in turn per key (see `resolve`), relays found slow lately last. A relay
2242
+ * The order a key's read asks the relays in: in turn per key (see `resolve`), relays found slow lately or leaving a
2243
+ * request unanswered (`unanswering`) last. A relay
2113
2244
  * with a small share of its own (`RELAY_REQUESTS_PER_MINUTE` under `REQUESTS_PER_MINUTE`: pkarr.miguelmedeiros.dev's 5)
2114
2245
  * takes no turns: it comes after the others, for when they refuse, fail or are slow, unless every relay is one. In the
2115
2246
  * turn, it was spent in seconds and the relay after it took its turns too: pkarr.pubky.org got two reads in three and
@@ -2122,8 +2253,19 @@ var RelayTransport = class {
2122
2253
  const after = lastAt < 0 ? -1 : ring.findIndex((relay) => this.relays.indexOf(relay) > lastAt);
2123
2254
  const start = lastAt < 0 ? this.cursor++ : after < 0 ? 0 : after;
2124
2255
  const turn = [...ring.map((_, i) => ring[(start + i) % ring.length]), ...this.relays.filter((relay) => !ring.includes(relay))];
2125
- const now = Date.now(), slow = (relay) => (this.slowUntil.get(relay) ?? 0) > now;
2126
- return [...turn.filter((relay) => !slow(relay)), ...turn.filter(slow)];
2256
+ const now = Date.now(), behind = (relay) => (this.slowUntil.get(relay) ?? 0) > now || this.unanswering(relay, now);
2257
+ return [...turn.filter((relay) => !behind(relay)), ...turn.filter(behind)];
2258
+ }
2259
+ /**
2260
+ * A request of this client has waited on the relay for `HEDGE_MS` and it has answered none since: it goes after the
2261
+ * others in a read (`readOrder`), at no cost of a request. A relay that took connections and never answered held a
2262
+ * fresh device's first pairing at its turn: the key's last read had found nothing (`HEDGE_MISSING_MS`), so the read
2263
+ * waited 6 s on it before asking the relay that had held the packet all along (8 s join to live, not 2.5 s).
2264
+ */
2265
+ unanswering(relay, now) {
2266
+ const since = this.answeredAt.get(relay) ?? -Infinity;
2267
+ for (const request of this.waiting.get(relay) ?? []) if (request.at > since && now - request.at >= this.hedgeMs) return true;
2268
+ return false;
2127
2269
  }
2128
2270
  /** One GET of a key at one relay, which `controller` drops. Never rejects: what happened is the outcome. */
2129
2271
  readFromRelay(relay, pubKeyZ32) {
@@ -2176,7 +2318,7 @@ var RelayTransport = class {
2176
2318
  */
2177
2319
  hedgeRoom(relay) {
2178
2320
  const now = Date.now();
2179
- return (this.spent.get(relay) ?? []).filter((at) => now - at < 6e4).length < this.limitOf(relay) - this.reserveOf(relay);
2321
+ return within(this.spent.get(relay) ?? [], now, 6e4).length < this.limitOf(relay) - this.reserveOf(relay);
2180
2322
  }
2181
2323
  readAnsweredAt(pubKeyZ32) {
2182
2324
  return this.readAt.get(pubKeyZ32);
@@ -2273,7 +2415,7 @@ var RelayTransport = class {
2273
2415
  }
2274
2416
  /** `sent`: told, once the budget took the request, whether the relay takes the packet (a 2xx). */
2275
2417
  async put(relay, pubKeyZ32, payload, replaces, who, probe = false, sent) {
2276
- if (!probe && this.networkCoolingDown(relay, "PUT")) throw new Error(`${relay} did not answer a moment ago; retry shortly`);
2418
+ if (!probe && this.networkCoolingDown(relay, "PUT")) throw new RelayNoAnswerError(`${relay} did not answer a moment ago; retry shortly`, false);
2277
2419
  const limited = this.rateLimitedFor(relay);
2278
2420
  if (limited > 0) throw new DiscoveryBudgetError(limited, "Discovery relay is cooling down after a 429; retry shortly");
2279
2421
  const blocked = probe ? 0 : this.breaker.blockedFor(relay);
@@ -2293,13 +2435,13 @@ var RelayTransport = class {
2293
2435
  let response;
2294
2436
  try {
2295
2437
  response = await request;
2296
- } catch {
2438
+ } catch (error) {
2297
2439
  this.networkCooldown.set(`PUT ${relay}`, Date.now() + NETWORK_ERROR_COOLDOWN_MS);
2298
2440
  this.answered(relay, {
2299
2441
  kind: "error",
2300
2442
  reason: "no answer"
2301
2443
  });
2302
- throw new Error(`${relay} did not answer`);
2444
+ throw new RelayNoAnswerError(`${relay} did not answer`, !connectFailed(error));
2303
2445
  }
2304
2446
  if (response.status === 429) this.answered(relay, {
2305
2447
  kind: "throttled",
@@ -2326,6 +2468,7 @@ var RelayTransport = class {
2326
2468
  }
2327
2469
  if (isGroupRead(who) || isChatWatch(who)) this.readAsked(key, who, now);
2328
2470
  if (isTurnRead(who)) this.turnAsked(key, who, now);
2471
+ if (isAwaitedRead(who)) this.awaitedAt = now;
2329
2472
  if (this.heldFor(relay, who, now, key) > 0) {
2330
2473
  if (isGroupRead(who) && (this.spent.get(relay)?.length ?? 0) >= this.limitOf(relay)) this.groupsFullAt.set(relay, now);
2331
2474
  if (isChat(who)) this.chatNeed(key, now, relay);
@@ -2367,7 +2510,8 @@ var RelayTransport = class {
2367
2510
  if (isGroupSignal(who) && !who.write && this.spent.get(relay).length >= this.limitOf(relay)) this.spentGroupOver.get(relay).push(now);
2368
2511
  if (isGroupSignal(who)) this.spentGroupSignal.get(relay).push(now);
2369
2512
  const departedOver = isDepartedRead(who) && this.spent.get(relay).length >= this.limitOf(relay);
2370
- if (departedOver) this.departedOverAdd(key, now);
2513
+ if (departedOver) this.overAdd(this.departedOver, key, now);
2514
+ if (isAwaitedRead(who) && this.spent.get(relay).length >= this.limitOf(relay)) this.overAdd(this.awaitedOver, key, now);
2371
2515
  this.spent.get(relay).push(now);
2372
2516
  if (who.background) this.spentBackground.get(relay).push(now);
2373
2517
  if (who.background && who.write) this.spentBackgroundWrites.get(relay).push(now);
@@ -2398,27 +2542,29 @@ var RelayTransport = class {
2398
2542
  * Who goes first: a chat's refused write holds back everything but chat writes; a group's refused write holds back
2399
2543
  * group reads and background requests, never a chat's. Background requests yield to a link that signals. A chat's
2400
2544
  * signaling goes over the limit by its allowance (`SIGNALING_ALLOWANCE_SHARE`), and so do a few of its reads of a
2401
- * contact that just went away (`DEPARTED_READS`). `ownAllowance` false: what holds an edge's read for its answer
2545
+ * contact that just went away (`DEPARTED_READS`) or of an invite awaited (`AWAITED_READS`). `ownAllowance` false: what holds an edge's read for its answer
2402
2546
  * without its own allowance (`ANSWER_READ_ALLOWANCE`).
2403
2547
  */
2404
2548
  heldFor(relay, who, now = Date.now(), key, turns = true, ownAllowance = true) {
2405
- const recent = (this.spent.get(relay) ?? []).filter((at) => now - at < 6e4);
2406
- const recentBackground = (this.spentBackground.get(relay) ?? []).filter((at) => now - at < 6e4);
2549
+ const recent = within(this.spent.get(relay) ?? [], now, 6e4);
2550
+ const recentBackground = within(this.spentBackground.get(relay) ?? [], now, 6e4);
2407
2551
  this.spent.set(relay, recent);
2408
2552
  this.spentBackground.set(relay, recentBackground);
2409
- const recentBackgroundWrites = (this.spentBackgroundWrites.get(relay) ?? []).filter((at) => now - at < 6e4);
2553
+ const recentBackgroundWrites = within(this.spentBackgroundWrites.get(relay) ?? [], now, 6e4);
2410
2554
  this.spentBackgroundWrites.set(relay, recentBackgroundWrites);
2411
2555
  const over = (list, limit) => list.length >= limit ? list[list.length - limit] + 6e4 - now : 0;
2412
2556
  const limit = this.limitOf(relay);
2413
- const departed = isDepartedRead(who) && key !== void 0 && recent.length >= limit && this.departedReads(key, now) < 6;
2414
- const share = isChatSignal(who) || departed ? SIGNALING_ALLOWANCE_SHARE : isGroupSignal(who) ? GROUP_SIGNALING_ALLOWANCE_SHARE : 0;
2415
- const allowance = share ? Math.max(0, Math.floor(limit * share) - (who.write ? 0 : 1)) : 0;
2416
- const groupSignaled = (this.spentGroupSignal.get(relay) ?? []).filter((at) => now - at < 6e4);
2557
+ const departed = isDepartedRead(who) && key !== void 0 && recent.length >= limit && this.overReads(this.departedOver, key, now) < 6;
2558
+ const awaited = isAwaitedRead(who) && key !== void 0 && recent.length >= limit && this.overReads(this.awaitedOver, key, now) < 4;
2559
+ const share = isChatSignal(who) || departed || awaited ? SIGNALING_ALLOWANCE_SHARE : isGroupSignal(who) ? GROUP_SIGNALING_ALLOWANCE_SHARE : 0;
2560
+ let allowance = share ? Math.max(0, Math.floor(limit * share) - (who.write ? 0 : 1)) : 0;
2561
+ if (departed && now - this.awaitedAt < 6e4) allowance = Math.max(0, allowance - 2);
2562
+ const groupSignaled = within(this.spentGroupSignal.get(relay) ?? [], now, 6e4);
2417
2563
  this.spentGroupSignal.set(relay, groupSignaled);
2418
2564
  const groupFloor = isGroupSignal(who) && groupSignaled.length < allowance;
2419
2565
  let wait = groupFloor ? 0 : over(recent, limit + allowance);
2420
2566
  const starved = key !== void 0 && this.starved(key, who, now);
2421
- const groupOver = (this.spentGroupOver.get(relay) ?? []).filter((at) => now - at < GROUP_OVER_PACE_MS);
2567
+ const groupOver = within(this.spentGroupOver.get(relay) ?? [], now, GROUP_OVER_PACE_MS);
2422
2568
  this.spentGroupOver.set(relay, groupOver);
2423
2569
  if (isGroupSignal(who) && !who.write && recent.length >= limit && groupOver.length > 0) wait = Math.max(wait, groupOver[groupOver.length - 1] + GROUP_OVER_PACE_MS - now);
2424
2570
  if (who.background && !starved) {
@@ -2428,16 +2574,16 @@ var RelayTransport = class {
2428
2574
  const signaling = this.urgentAt + SIGNALING_WINDOW_MS - now;
2429
2575
  if (signaling > 0 && !who.door) wait = Math.max(wait, Math.min(signaling, over(recentBackground, Math.min(this.backgroundWhileSignaling, Math.ceil(limit / 6)))));
2430
2576
  }
2431
- const burst = (this.spentGroupUrgent.get(relay) ?? []).filter((at) => now - at < GROUP_BURST_MS);
2577
+ const burst = within(this.spentGroupUrgent.get(relay) ?? [], now, GROUP_BURST_MS);
2432
2578
  this.spentGroupUrgent.set(relay, burst);
2433
- const answerBurst = (this.spentAnswerUrgent.get(relay) ?? []).filter((at) => now - at < GROUP_BURST_MS);
2579
+ const answerBurst = within(this.spentAnswerUrgent.get(relay) ?? [], now, GROUP_BURST_MS);
2434
2580
  this.spentAnswerUrgent.set(relay, answerBurst);
2435
2581
  if (isGroupUrgentRead(who)) {
2436
2582
  const most = Math.max(8, Math.floor(limit * GROUP_BURST_MS / 6e4));
2437
2583
  const spent = isGroupAnswerRead(who) ? answerBurst : burst;
2438
2584
  if (spent.length >= most) wait = Math.max(wait, spent[spent.length - most] + GROUP_BURST_MS - now);
2439
2585
  }
2440
- const watched = (this.spentWatch.get(relay) ?? []).filter((at) => now - at < GROUP_RATION_WINDOW_MS);
2586
+ const watched = within(this.spentWatch.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2441
2587
  this.spentWatch.set(relay, watched);
2442
2588
  let turn = 0;
2443
2589
  if (isWatch(who)) {
@@ -2445,14 +2591,14 @@ var RelayTransport = class {
2445
2591
  if (watched.length >= most) wait = Math.max(wait, watched[watched.length - most] + GROUP_RATION_WINDOW_MS - now);
2446
2592
  if (this.readsAhead(key, now, watchLane(who)) > 0) turn = TURN_WAIT_MS;
2447
2593
  }
2448
- const chatWatched = (this.spentChatWatch.get(relay) ?? []).filter((at) => now - at < GROUP_RATION_WINDOW_MS);
2594
+ const chatWatched = within(this.spentChatWatch.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2449
2595
  this.spentChatWatch.set(relay, chatWatched);
2450
2596
  if (isChatWatch(who) && !departed) {
2451
2597
  const most = Math.max(1, Math.ceil(limit * CHAT_WATCH_SHARE * GROUP_RATION_WINDOW_MS / 6e4));
2452
2598
  if (chatWatched.length >= most) wait = Math.max(wait, chatWatched[chatWatched.length - most] + GROUP_RATION_WINDOW_MS - now);
2453
2599
  if (this.readsAhead(key, now, watchLane(who)) > 0) turn = TURN_WAIT_MS;
2454
2600
  }
2455
- const rationed = (this.spentGroupReads.get(relay) ?? []).filter((at) => now - at < GROUP_RATION_WINDOW_MS);
2601
+ const rationed = within(this.spentGroupReads.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2456
2602
  this.spentGroupReads.set(relay, rationed);
2457
2603
  const pastLimit = isGroupSignal(who) && recent.length >= limit;
2458
2604
  if (isGroupRead(who) && !pastLimit && now - (this.groupsFullAt.get(relay) ?? -Infinity) < GROUP_RATION_MS) {
@@ -2469,7 +2615,8 @@ var RelayTransport = class {
2469
2615
  const at = this.writeWaiting.get(`${lane} ${relay}`);
2470
2616
  return at !== void 0 && now - at < 5e3 ? at + WRITE_FIRST_MS - now : 0;
2471
2617
  };
2472
- if (writer !== "chat" && !departed && !starved) wait = Math.max(wait, waiting("chat"));
2618
+ const signalOver = isChatSignal(who) && !who.write && recent.length >= limit;
2619
+ if (writer !== "chat" && !departed && !awaited && !signalOver && !starved) wait = Math.max(wait, waiting("chat"));
2473
2620
  if ((writer === null && who.group && !pastLimit && !isGroupAnswerRead(who) || who.background) && !starved) wait = Math.max(wait, waiting("group"));
2474
2621
  if (isGroupSignal(who) && !isGroupAnswerRead(who)) {
2475
2622
  const ahead = this.answerReadAhead(relay, now);
@@ -2485,7 +2632,7 @@ var RelayTransport = class {
2485
2632
  * than it in the last minute, and none within `ANSWER_READ_SPACING_MS`. None where the groups have no allowance.
2486
2633
  */
2487
2634
  answerAllowanceFree(relay, now) {
2488
- const spent = (this.spentAnswerAllowance.get(relay) ?? []).filter((at) => now - at < 6e4);
2635
+ const spent = within(this.spentAnswerAllowance.get(relay) ?? [], now, 6e4);
2489
2636
  this.spentAnswerAllowance.set(relay, spent);
2490
2637
  const most = Math.min(3, Math.floor(this.limitOf(relay) * GROUP_SIGNALING_ALLOWANCE_SHARE));
2491
2638
  return spent.length < most && (spent.length === 0 || now - spent[spent.length - 1] >= 2e4);
@@ -2510,7 +2657,7 @@ var RelayTransport = class {
2510
2657
  }
2511
2658
  /** What is left of the community members' way back allowance on this relay (`WAY_BACK_SHARE`); its reads leave a write the last of it. */
2512
2659
  wayBackLeft(relay, who, now) {
2513
- const spent = (this.spentWayBack.get(relay) ?? []).filter((at) => now - at < 6e4);
2660
+ const spent = within(this.spentWayBack.get(relay) ?? [], now, 6e4);
2514
2661
  this.spentWayBack.set(relay, spent);
2515
2662
  return Math.floor(this.limitOf(relay) * WAY_BACK_SHARE) - (who.write ? 0 : 1) - spent.length;
2516
2663
  }
@@ -2557,9 +2704,17 @@ var RelayTransport = class {
2557
2704
  }
2558
2705
  /** Drops the turns asked and read over a minute ago, at most once in `TURNS_PRUNE_MS` (or when the clock went back). */
2559
2706
  pruneTurns(turns, now) {
2560
- if (Math.abs(now - (this.turnsPrunedAt.get(turns) ?? -Infinity)) < TURNS_PRUNE_MS) return;
2707
+ const prunedAt = this.turnsPrunedAt.get(turns) ?? -Infinity;
2708
+ if (Math.abs(now - prunedAt) < TURNS_PRUNE_MS) return;
2561
2709
  this.turnsPrunedAt.set(turns, now);
2562
- for (const [key, turn] of turns) if (staleTurn(turn, now)) turns.delete(key);
2710
+ const back = now < prunedAt;
2711
+ for (const [key, turn] of turns) {
2712
+ if (back) {
2713
+ turn.servedAt = Math.min(turn.servedAt, now);
2714
+ turn.askedAt = Math.min(turn.askedAt, now);
2715
+ }
2716
+ if (staleTurn(turn, now)) turns.delete(key);
2717
+ }
2563
2718
  }
2564
2719
  /**
2565
2720
  * Whether a key read in turn longer ago than `key`, still asking, would take this relay's next request: one read in the
@@ -2584,17 +2739,17 @@ var RelayTransport = class {
2584
2739
  const since = this.heldBack.get(key)?.since;
2585
2740
  return !who.group && !who.write && !who.door && since !== void 0 && now - since >= READ_STARVED_MS;
2586
2741
  }
2587
- /** This contact's departed reads past the limit in the last minute (`DEPARTED_READS`). */
2588
- departedReads(key, now) {
2589
- const reads = (this.departedOver.get(key) ?? []).filter((at) => now - at < 6e4);
2590
- if (reads.length) this.departedOver.set(key, reads);
2591
- else this.departedOver.delete(key);
2742
+ /** This key's departed or awaited reads past the limit in the last minute (`DEPARTED_READS`, `AWAITED_READS`). */
2743
+ overReads(over, key, now) {
2744
+ const reads = within(over.get(key) ?? [], now, 6e4);
2745
+ if (reads.length) over.set(key, reads);
2746
+ else over.delete(key);
2592
2747
  return reads.length;
2593
2748
  }
2594
- /** One more, the contacts with none in the last minute dropped. */
2595
- departedOverAdd(key, now) {
2596
- for (const [other, reads] of this.departedOver) if (now - reads[reads.length - 1] >= 6e4) this.departedOver.delete(other);
2597
- this.departedOver.set(key, [...this.departedOver.get(key) ?? [], now]);
2749
+ /** One more, the keys with none in the last minute dropped. */
2750
+ overAdd(over, key, now) {
2751
+ for (const [other, reads] of over) if (now - reads[reads.length - 1] >= 6e4) over.delete(other);
2752
+ over.set(key, [...over.get(key) ?? [], now]);
2598
2753
  }
2599
2754
  /** A chat's request of `key` asked urgently (it needs every relay), or the budget refused it on `relay` (it needs that one). */
2600
2755
  chatNeed(key, now, relay) {
@@ -2634,7 +2789,7 @@ var RelayTransport = class {
2634
2789
  spareHeldFor(relay, now) {
2635
2790
  const reserved = this.chatReservedFor(relay, now);
2636
2791
  if (reserved <= 0) return 0;
2637
- const recent = (this.spent.get(relay) ?? []).filter((at) => now - at < 6e4);
2792
+ const recent = within(this.spent.get(relay) ?? [], now, 6e4);
2638
2793
  const keep = this.limitOf(relay) - this.chatReserveOf(relay, now);
2639
2794
  return recent.length >= keep ? Math.min(reserved, recent[recent.length - keep] + 6e4 - now) : 0;
2640
2795
  }
@@ -2808,6 +2963,9 @@ var RelayTransport = class {
2808
2963
  const timer = setTimeout(() => controller.abort(), this.timeoutMs);
2809
2964
  const drop = () => controller.abort();
2810
2965
  cancel?.addEventListener("abort", drop, { once: true });
2966
+ const relay = url.slice(0, url.lastIndexOf("/")), request = { at: Date.now() };
2967
+ const waiting = this.waiting.get(relay) ?? /* @__PURE__ */ new Set();
2968
+ this.waiting.set(relay, waiting.add(request));
2811
2969
  try {
2812
2970
  const sent = Date.now();
2813
2971
  const response = await this.fetchFn(url, {
@@ -2815,10 +2973,12 @@ var RelayTransport = class {
2815
2973
  cache: "no-store",
2816
2974
  signal: controller.signal
2817
2975
  });
2976
+ this.answeredAt.set(relay, Date.now());
2818
2977
  this.serverTime(url, response, sent);
2819
2978
  await read?.(response, controller.signal);
2820
2979
  return response;
2821
2980
  } finally {
2981
+ waiting.delete(request);
2822
2982
  clearTimeout(timer);
2823
2983
  cancel?.removeEventListener("abort", drop);
2824
2984
  }
@@ -6634,11 +6794,16 @@ var NO_ATTEMPTS = {
6634
6794
  recent: [],
6635
6795
  total: 0
6636
6796
  };
6797
+ /**
6798
+ * When the lock-out ends by this clock, if it has not: one more than an hour away was stamped by a clock that ran ahead,
6799
+ * and is over (WISP 06 § Failure table, clocks wrong by days).
6800
+ */
6801
+ var lockedUntil = (attempts, now) => attempts?.until !== void 0 && now < attempts.until && attempts.until - now <= HANDOFF_ATTEMPTS.hourMs ? attempts.until : void 0;
6637
6802
  /** Whether a device may try now: `refused` after 15 failures with no success, until the person lets it try again. */
6638
6803
  function handoffAttemptAllowed(attempts, now) {
6639
6804
  if (!attempts) return "ok";
6640
6805
  if (attempts.total >= HANDOFF_ATTEMPTS.total) return "refused";
6641
- if (attempts.until !== void 0 && now < attempts.until) return "locked-out";
6806
+ if (lockedUntil(attempts, now) !== void 0) return "locked-out";
6642
6807
  return "ok";
6643
6808
  }
6644
6809
  /**
@@ -6646,17 +6811,18 @@ function handoffAttemptAllowed(attempts, now) {
6646
6811
  * outcome, and takes it back on success: a taker that stops after the second message has used a try.
6647
6812
  */
6648
6813
  function handoffAttemptFailed(attempts, now) {
6649
- const recent = [...(attempts?.recent ?? []).filter((at) => now - at < HANDOFF_ATTEMPTS.hourMs), now];
6814
+ const recent = [...(attempts?.recent ?? []).map((at) => Math.min(at, now)).filter((at) => now - at < HANDOFF_ATTEMPTS.hourMs), now];
6650
6815
  const total = (attempts?.total ?? 0) + 1;
6651
6816
  if (recent.length >= HANDOFF_ATTEMPTS.perHour) return {
6652
6817
  recent: [],
6653
6818
  total,
6654
6819
  until: now + HANDOFF_ATTEMPTS.hourMs
6655
6820
  };
6821
+ const until = lockedUntil(attempts, now);
6656
6822
  return {
6657
6823
  recent,
6658
6824
  total,
6659
- ...attempts?.until !== void 0 && now < attempts.until ? { until: attempts.until } : {}
6825
+ ...until !== void 0 ? { until } : {}
6660
6826
  };
6661
6827
  }
6662
6828
  /** A proof that held: the count starts again. */
@@ -6665,7 +6831,10 @@ var handoffAttemptSucceeded = () => ({
6665
6831
  total: 0
6666
6832
  });
6667
6833
  /** Seconds until a locked-out device may try again (for `handoff-busy`). */
6668
- var handoffRetryAfter = (attempts, now) => attempts?.until !== void 0 && attempts.until > now ? Math.ceil((attempts.until - now) / 1e3) : 0;
6834
+ var handoffRetryAfter = (attempts, now) => {
6835
+ const until = lockedUntil(attempts, now);
6836
+ return until !== void 0 ? Math.ceil((until - now) / 1e3) : 0;
6837
+ };
6669
6838
  /** Two digests compared. */
6670
6839
  var sameDigest = (a, b) => a.length === b.length && bytesEqual(a, b);
6671
6840
  //#endregion
@@ -7735,6 +7904,12 @@ var LIMITS = {
7735
7904
  maxConcurrentRequestsPerPeer: 32,
7736
7905
  /** Requests a client keeps in flight; the rest wait in a queue. */
7737
7906
  maxClientInFlight: 16,
7907
+ /**
7908
+ * Requests, and their bodies' bytes, a client keeps waiting for a slot: past either, a request is refused at once
7909
+ * (`busy`), so whatever asks (a contact's app in a viewer) cannot make it hold unbounded memory.
7910
+ */
7911
+ maxClientWaiting: 64,
7912
+ maxClientWaitingBodyBytes: 67108864,
7738
7913
  maxChatMessageBytes: 16384,
7739
7914
  maxFileBytes: 104857600,
7740
7915
  /** Files a peer may be sending us at once. */
@@ -8506,6 +8681,7 @@ var HttpClient = class {
8506
8681
  nextId = 1;
8507
8682
  streams = /* @__PURE__ */ new Map();
8508
8683
  waiting = [];
8684
+ waitingBytes = 0;
8509
8685
  inFlight = 0;
8510
8686
  closed = false;
8511
8687
  constructor(channel) {
@@ -8514,7 +8690,28 @@ var HttpClient = class {
8514
8690
  async request(serviceId, request) {
8515
8691
  if (this.closed) throw new GhostlyHttpError("closed", "Data link is closed");
8516
8692
  if (this.inFlight >= LIMITS.maxClientInFlight) {
8517
- await new Promise((resolve) => this.waiting.push(resolve));
8693
+ const bytes = request.body?.length ?? 0;
8694
+ if (this.waiting.length >= LIMITS.maxClientWaiting || this.waitingBytes + bytes > LIMITS.maxClientWaitingBodyBytes) throw new GhostlyHttpError("busy", "Too many requests waiting");
8695
+ this.waitingBytes += bytes;
8696
+ let leave = () => {};
8697
+ try {
8698
+ await new Promise((resolve, reject) => {
8699
+ const wake = () => {
8700
+ request.signal?.removeEventListener("abort", leave);
8701
+ resolve();
8702
+ };
8703
+ leave = () => {
8704
+ const at = this.waiting.indexOf(wake);
8705
+ if (at >= 0) this.waiting.splice(at, 1);
8706
+ reject(new GhostlyHttpError("aborted", "Request aborted"));
8707
+ };
8708
+ if (request.signal?.aborted) return leave();
8709
+ this.waiting.push(wake);
8710
+ request.signal?.addEventListener("abort", leave, { once: true });
8711
+ });
8712
+ } finally {
8713
+ this.waitingBytes -= bytes;
8714
+ }
8518
8715
  if (this.closed) throw new GhostlyHttpError("closed", "Data link is closed");
8519
8716
  }
8520
8717
  this.inFlight++;
@@ -8850,6 +9047,8 @@ var LinkSession = class {
8850
9047
  signalReadsLeft = 0;
8851
9048
  /** Fast reads still signaling while the contact's offer is due (`SIGNAL_DUE_READS`). */
8852
9049
  dueSignalReadsLeft = 0;
9050
+ /** This side just left DHT only and its presence is not out yet: the contact dials on it (`presenceDue`). */
9051
+ presenceDueOut = false;
8853
9052
  /** When the last `expectPeer` window ends (or ended): the pace slows down from there step by step. */
8854
9053
  expectUntil = 0;
8855
9054
  /**
@@ -8992,6 +9191,7 @@ var LinkSession = class {
8992
9191
  countUnusedInvite(this.transport, this, false);
8993
9192
  this.rtcSignal = null;
8994
9193
  this.callSignal = null;
9194
+ this.presenceDueOut = false;
8995
9195
  this.events.onStatus?.("offline");
8996
9196
  if (announce) try {
8997
9197
  await this.publishOnce(false);
@@ -9052,6 +9252,14 @@ var LinkSession = class {
9052
9252
  * the windows that look fast for the contact (`expectPeer`, `watchPeer`) end, and the link reads at its pace from the
9053
9253
  * next read on. An offer of this side's out keeps its window.
9054
9254
  */
9255
+ /**
9256
+ * This side just left DHT only: the contact that dials waits on its next packet that advertises, so that one is
9257
+ * signaling (`PkarrRequestOptions.signal`). As a plain write, an app that had spent its relay minute held it 55 s,
9258
+ * and the contact dialled only then.
9259
+ */
9260
+ presenceDue() {
9261
+ this.presenceDueOut = true;
9262
+ }
9055
9263
  calm() {
9056
9264
  if (this.rtcSignal !== null) return;
9057
9265
  this.fastPollUntil = this.fastStepsAfter = this.expectUntil = this.watchUntil = this.lingerUntil = this.dueSignalReadsLeft = 0;
@@ -9271,7 +9479,7 @@ var LinkSession = class {
9271
9479
  try {
9272
9480
  const awaited = this.connected || this.presence.online || this.sentBuffer.length > 0 || this.callSignal !== null || this.awaitingPeer();
9273
9481
  const takesBack = !rtcSignal && this.rtcSignalOut !== null;
9274
- const options = rtcSignal && rtcSignal !== this.rtcSignalOut ? { signal: true } : this.watching() ? { watch: true } : upkeep && (this.connected || takesBack) || !rtcSignal && !awaited ? { background: true } : void 0;
9482
+ const options = rtcSignal && rtcSignal !== this.rtcSignalOut || advertise && this.presenceDueOut ? { signal: true } : this.watching() ? { watch: true } : upkeep && (this.connected || takesBack) || !rtcSignal && !awaited ? { background: true } : void 0;
9275
9483
  this.wroteInBackground = options?.background === true;
9276
9484
  const held = this.transport.publishHeld?.(this.identity.pubKeyZ32, options);
9277
9485
  if (held) throw held;
@@ -9310,6 +9518,7 @@ var LinkSession = class {
9310
9518
  }
9311
9519
  const ms = Date.now() - started;
9312
9520
  this.lastPublishedAt = Date.now();
9521
+ if (advertise) this.presenceDueOut = false;
9313
9522
  const signalOut = !!rtcSignal && rtcSignal !== this.rtcSignalOut;
9314
9523
  this.signalReadsLeft = signalOut ? 3 : rtcSignal ? this.signalReadsLeft : 0;
9315
9524
  if (signalOut && this.fastPollUntil > 0) {
@@ -9369,6 +9578,7 @@ var LinkSession = class {
9369
9578
  }
9370
9579
  const watch = !signal && this.watching();
9371
9580
  const departed = !signal && Date.now() < this.departedUntil;
9581
+ const awaited = !signal && this.ownInvite() && this.awaitingPeer();
9372
9582
  const background = pace === "background" || pace === "connected" || pace === "idle" && !this.active;
9373
9583
  const resume = !signal && !watch && (this.resumeReads || Date.now() < this.awaitedUntil);
9374
9584
  let unread;
@@ -9378,6 +9588,7 @@ var LinkSession = class {
9378
9588
  ...signal && { signal },
9379
9589
  ...watch && { watch },
9380
9590
  ...departed && { departed },
9591
+ ...awaited && { awaited },
9381
9592
  ...resume && { resume }
9382
9593
  }, false).catch((error) => {
9383
9594
  if (!(error instanceof RelaysFailedError)) throw error;
@@ -12806,6 +13017,7 @@ function readDhtFile(raw, message) {
12806
13017
  var DHT_TEXT_BYTES = 256;
12807
13018
  var DHT_MESSAGE_TTL = 3e5;
12808
13019
  var DHT_TEXT_TOO_LONG = `DHT text is limited to 256 UTF-8 bytes. Shorten it or choose a live connection.`;
13020
+ var DHT_PACKET_BUDGET = "Text and authentication exceed the DHT packet budget. Shorten the message.";
12809
13021
  var CONTROL_TTL = 6e5;
12810
13022
  /**
12811
13023
  * How far apart two devices' clocks may be for an envelope's expiry: a reader takes one until this long after `expires`
@@ -12832,7 +13044,10 @@ var MAX_ATTEMPTS = 8;
12832
13044
  var SEQUENCE_BLOCK = 64;
12833
13045
  /** The wait before publication attempt `attempts + 1` of a text, or of a receipt the contact still asks for. */
12834
13046
  var backoff = (attempts) => Math.min(6e4, 4e3 * 2 ** attempts);
12835
- /** The contact's mailbox is read this often while either side is DHT-only, and otherwise… */
13047
+ /**
13048
+ * The contact's mailbox is read this often while this side is DHT-only (a contact that chose it is read at the chat's
13049
+ * pace: `ACTIVE_DHT_POLL_MS` open, or on a daemon, `peerDhtPollMs`), and otherwise…
13050
+ */
12836
13051
  var DHT_POLL_MS = 4e3;
12837
13052
  var STREAM_POLL_MS = 3e4;
12838
13053
  /**
@@ -12841,6 +13056,7 @@ var STREAM_POLL_MS = 3e4;
12841
13056
  * each has seen the other leave).
12842
13057
  */
12843
13058
  var LEAVING_DHT_FAST_MS = 12e4;
13059
+ var LEAVING_PROBE_MAX_GAP_MS = 96e4;
12844
13060
  /** Only this often while layer 1 carries the chat (WISP 403, Q7): the relays' per-IP budget is shared by every chat. */
12845
13061
  var LIVE_POLL_MS = 3e5;
12846
13062
  /**
@@ -12907,6 +13123,11 @@ var DhtDelivery = class DhtDelivery {
12907
13123
  urgent = false;
12908
13124
  /** Reads left that are signaling: the contact is leaving DHT only, and the live link waits on them (`expect`). */
12909
13125
  signalReads = 0;
13126
+ /** The read as this side leaves DHT only, before the signaling ones (`setMode`): a plain one. */
13127
+ leavingRead = false;
13128
+ /** Until when a fresh link packet of the contact starts no signaling reads, and the wait it was held to (`peerLinkPacket`). */
13129
+ probeAt = 0;
13130
+ probeGap = 0;
12910
13131
  timer = null;
12911
13132
  /** The first control envelope of a start that waits (`firstControlAfterMs`). */
12912
13133
  controlTimer = null;
@@ -12926,12 +13147,19 @@ var DhtDelivery = class DhtDelivery {
12926
13147
  /** Until when the relays' request budget holds publications back: what is due then goes at once. */
12927
13148
  budgetUntil = 0;
12928
13149
  /**
13150
+ * This side left DHT only and no envelope saying so went out yet: the contact's live link waits on it (it holds this
13151
+ * side's offer until it reads that), so it goes as signaling (`PkarrRequestOptions.signal`).
13152
+ */
13153
+ leavingOut = false;
13154
+ /**
12929
13155
  * Until when it held this side's last read of the contact's mailbox back: the read goes again then, not at the next
12930
13156
  * poll. A chat in the background reads every 30 s, and one held back while its link was redialling read the contact
12931
13157
  * 60 s after its live link dropped, the chat "On DHT · retrying live" all along while the contact had chosen DHT only.
12932
13158
  */
12933
13159
  readHeldUntil = 0;
12934
13160
  errors = {};
13161
+ /** Texts whose last `send` went nowhere (`wentNowhereFor`), newest last. */
13162
+ wentNowhere = /* @__PURE__ */ new Set();
12935
13163
  /** When the device's network last came back (`networkBack`): a read or publication started before failed for want of it. */
12936
13164
  networkBackAt = -Infinity;
12937
13165
  foreignKeySeenAt;
@@ -13086,9 +13314,17 @@ var DhtDelivery = class DhtDelivery {
13086
13314
  }
13087
13315
  this.state = next;
13088
13316
  }
13317
+ /** The key an envelope between this side and `peer` is sealed with: the same for the same contact, so derived once. */
13318
+ sealedKeys;
13089
13319
  sealedKey(peer) {
13090
- const shared = x25519.getSharedSecret(ed25519.utils.toMontgomerySecret(this.participation.seed), ed25519.utils.toMontgomery(publicKeyFromZ32(peer)));
13091
- return hkdf(sha256, shared, this.key, utf8Encode("ghostly-dht-participation-envelope/1"), 32);
13320
+ if (this.sealedKeys?.peer !== peer) {
13321
+ const shared = x25519.getSharedSecret(ed25519.utils.toMontgomerySecret(this.participation.seed), ed25519.utils.toMontgomery(publicKeyFromZ32(peer)));
13322
+ this.sealedKeys = {
13323
+ peer,
13324
+ key: hkdf(sha256, shared, this.key, utf8Encode("ghostly-dht-participation-envelope/1"), 32)
13325
+ };
13326
+ }
13327
+ return this.sealedKeys.key;
13092
13328
  }
13093
13329
  signed(body, recipient = "invite") {
13094
13330
  return utf8Encode(JSON.stringify([
@@ -13103,6 +13339,32 @@ var DhtDelivery = class DhtDelivery {
13103
13339
  return this.envelope(body, recipient).records;
13104
13340
  }
13105
13341
  /**
13342
+ * Whether an envelope to `recipient` whose plaintext is this many bytes fits the packet: its size depends on the
13343
+ * length alone, so it is measured on a placeholder, with no signature, key or encryption.
13344
+ */
13345
+ fits(bytes, recipient) {
13346
+ if (bytes > MAX_ENVELOPE_PLAINTEXT) return false;
13347
+ const ratchet = this.ratcheted(recipient);
13348
+ const sealed = ratchet ? 4 * Math.ceil((66 + bytes) / 3) : sealedLength(bytes);
13349
+ const hint = recipient ? [{
13350
+ label: "_dmk",
13351
+ value: "A".repeat(sealedLength(utf8Encode(this.participation.pubKeyZ32).length)),
13352
+ ttl: ENVELOPE_TTL
13353
+ }] : [];
13354
+ return measureRecords(this.identity.pubKeyZ32, [{
13355
+ label: ratchet ? "_dr" : "_dm",
13356
+ value: "A".repeat(sealed),
13357
+ ttl: ENVELOPE_TTL
13358
+ }, ...hint]) <= ENVELOPE_PACKET_BYTES;
13359
+ }
13360
+ /**
13361
+ * Whether `body` fits an envelope to `recipient`, as `envelope` would find it, without building one: the signature is
13362
+ * always 86 characters of base64url.
13363
+ */
13364
+ bodyFits(body, recipient) {
13365
+ return this.fits(utf8Encode(JSON.stringify([body, "x".repeat(86)])).length, recipient);
13366
+ }
13367
+ /**
13106
13368
  * The envelope's records. Ratcheted (`ratcheted`), its `_dr` record is the right length but not sealed yet: `seal`
13107
13369
  * gives its bytes, under the chat's lock, once the publication is sure to go. Measuring a packet takes no key.
13108
13370
  */
@@ -13117,13 +13379,9 @@ var DhtDelivery = class DhtDelivery {
13117
13379
  const ratchet = this.ratcheted(recipient);
13118
13380
  const sealedBytes = (bytes) => ratchet ? 4 * Math.ceil((66 + bytes) / 3) : sealedLength(bytes);
13119
13381
  const label = ratchet ? "_dr" : "_dm";
13120
- const fits = (bytes) => bytes <= MAX_ENVELOPE_PLAINTEXT && measureRecords(this.identity.pubKeyZ32, [{
13121
- label,
13122
- value: "A".repeat(sealedBytes(bytes)),
13123
- ttl: ENVELOPE_TTL
13124
- }, ...hint]) <= ENVELOPE_PACKET_BYTES;
13382
+ const fits = (bytes) => this.fits(bytes, recipient);
13125
13383
  const bytes = utf8Encode(plaintext).length;
13126
- if (!fits(bytes)) throw new Error("Text and authentication exceed the DHT packet budget. Shorten the message.");
13384
+ if (!fits(bytes)) throw new Error(DHT_PACKET_BUDGET);
13127
13385
  let padded = bytes;
13128
13386
  for (let step = 512; step >= 1; step >>= 1) if (fits(padded + step)) padded += step;
13129
13387
  const full = plaintext + " ".repeat(padded - bytes);
@@ -13191,7 +13449,12 @@ var DhtDelivery = class DhtDelivery {
13191
13449
  this.lastPublish = 0;
13192
13450
  this.leavingUntil = mode === "stream" ? Date.now() + LEAVING_DHT_FAST_MS : 0;
13193
13451
  if (mode === "dht") this.signalReads = 0;
13194
- else if (this.state.peerMode === "dht") this.signalReads = 3;
13452
+ else if (this.state.peerMode === "dht") {
13453
+ this.signalReads = 3;
13454
+ this.leavingRead = true;
13455
+ }
13456
+ this.leavingOut = mode === "stream";
13457
+ if (this.leavingOut) this.budgetUntil = 0;
13195
13458
  this.changed();
13196
13459
  });
13197
13460
  this.tick();
@@ -13228,6 +13491,20 @@ var DhtDelivery = class DhtDelivery {
13228
13491
  this.tick();
13229
13492
  }
13230
13493
  /**
13494
+ * A fresh link packet of a contact still saying DHT only (`expect`, signaling). Nothing signed says it is the contact's,
13495
+ * and one that stays on DHT only (or anyone holding the invite) can put one before every read: the reads it starts are
13496
+ * then held to a wait that doubles from `LEAVING_PROBE_GAP_MS` to `LEAVING_PROBE_MAX_GAP_MS`, and start over once the
13497
+ * contact says it left. False when held. Its offer, signed by its pinned key, is not held (`expect` directly).
13498
+ */
13499
+ peerLinkPacket(ms) {
13500
+ const now = Date.now();
13501
+ if (now < this.probeAt && this.probeAt - now <= this.probeGap) return false;
13502
+ this.probeGap = Math.min(this.probeGap * 2 || 12e4, LEAVING_PROBE_MAX_GAP_MS);
13503
+ this.probeAt = now + this.probeGap;
13504
+ this.expect(ms, true);
13505
+ return true;
13506
+ }
13507
+ /**
13231
13508
  * Layer 1 carries the chat, or no longer does. While it does, the mailbox is read every 5 minutes, after one
13232
13509
  * last look as it goes live: a text the contact put on the DHT in the seconds before (after this side's last
13233
13510
  * read) would otherwise wait for the next look. That look is a background request, which yields to links that
@@ -13296,23 +13573,18 @@ var DhtDelivery = class DhtDelivery {
13296
13573
  const error = this.packetError(next.message, next.expires, next.reply, next.edit);
13297
13574
  return error && next.reply ? this.packetError(next.message, next.expires) : error;
13298
13575
  }
13576
+ /**
13577
+ * Measured, not built (`bodyFits`): the outbox asks it of every waiting text at each look, and a text that waits as no
13578
+ * relay takes it would cost a signature and a seal each time, for an answer that does not change.
13579
+ */
13299
13580
  packetError(message, expires, reply, edit) {
13300
- try {
13301
- this.records(this.body(this.sequence + 1, Date.now(), expires, message, this.state.receipt?.id ?? "abcdefghijklmnopqrstuv", reply, [], edit), this.options.credentials.peerKey ?? this.participation.pubKeyZ32);
13302
- return null;
13303
- } catch (error) {
13304
- return error instanceof Error ? error.message : String(error);
13305
- }
13581
+ const body = this.body(this.sequence + 1, Date.now(), expires, message, this.state.receipt?.id ?? "abcdefghijklmnopqrstuv", reply, [], edit);
13582
+ return this.bodyFits(body, this.options.credentials.peerKey ?? this.participation.pubKeyZ32) ? null : DHT_PACKET_BUDGET;
13306
13583
  }
13307
13584
  /** Whether a text with its hop count fits the packet and what a reader reads (`MAX_ENVELOPE_PLAINTEXT`). */
13308
13585
  roomForHops(message, expires, reply, forwarded) {
13309
13586
  const body = this.body(this.sequence + 1, Date.now(), expires, message, this.state.receipt?.id ?? "abcdefghijklmnopqrstuv", reply, [], void 0, forwarded);
13310
- try {
13311
- this.records(body, this.options.credentials.peerKey ?? this.participation.pubKeyZ32);
13312
- } catch {
13313
- return false;
13314
- }
13315
- return utf8Encode(JSON.stringify([body, "x".repeat(86)])).length <= MAX_ENVELOPE_PLAINTEXT;
13587
+ return this.bodyFits(body, this.options.credentials.peerKey ?? this.participation.pubKeyZ32);
13316
13588
  }
13317
13589
  /**
13318
13590
  * `forwarded`: a forwarded text's hop count (WISP 403 § Forwards). Like a reply's id it goes only when the packet has
@@ -13320,11 +13592,13 @@ var DhtDelivery = class DhtDelivery {
13320
13592
  */
13321
13593
  async send(text, timestamp, id, reply, edit, forwarded) {
13322
13594
  return this.serialize(async () => {
13595
+ this.wentNowhere.delete(id);
13323
13596
  const error = this.validate(text, timestamp, id, reply, edit);
13324
13597
  if (error) return error;
13325
13598
  const now = Date.now(), pending = this.state.pending;
13326
13599
  const hops = edit ? void 0 : readForwarded(forwarded);
13327
- let next = pending?.message[0] === id && pending.expires > now ? pending : {
13600
+ const again = pending?.message[0] === id && pending.expires > now;
13601
+ let next = again ? pending : {
13328
13602
  message: [
13329
13603
  id,
13330
13604
  timestamp,
@@ -13360,12 +13634,27 @@ var DhtDelivery = class DhtDelivery {
13360
13634
  return null;
13361
13635
  }
13362
13636
  this.errors.publish = `DHT publication failed: ${String(error instanceof Error ? error.message : error)}. Bounded retry continues until expiry.`;
13637
+ if (!again && !edit && publishedNowhere(error) && this.state.pending?.message[0] === id) {
13638
+ await this.persist({
13639
+ ...this.state,
13640
+ pending: void 0
13641
+ });
13642
+ this.wentNowhere.add(id);
13643
+ if (this.wentNowhere.size > 64) this.wentNowhere.delete(this.wentNowhere.values().next().value);
13644
+ }
13363
13645
  this.changed();
13364
13646
  return this.errors.publish;
13365
13647
  }
13366
13648
  });
13367
13649
  }
13368
13650
  /**
13651
+ * The last `send` of this id failed with no relay holding it, and it was not out before (`PublishFailedError`): it
13652
+ * never left this device, and is no longer the floor's to publish.
13653
+ */
13654
+ wentNowhereFor(id) {
13655
+ return this.wentNowhere.has(id);
13656
+ }
13657
+ /**
13369
13658
  * The envelope a file's offer would go in, as `send` builds a text's: the most it can say that fits the packet and
13370
13659
  * what a reader reads (`MAX_ENVELOPE_PLAINTEXT`). Its meta goes first (a voice note's waveform thinned if it must),
13371
13660
  * then the reply's id, then the hop count; the name, size, type and id always. A string: why it cannot go.
@@ -13386,12 +13675,7 @@ var DhtDelivery = class DhtDelivery {
13386
13675
  const hops = readForwarded(forwarded);
13387
13676
  const fits = (element, withReply, withHops) => {
13388
13677
  const body = this.body(this.sequence + 1, now, expires, message, this.state.receipt?.id ?? "abcdefghijklmnopqrstuv", withReply ? reply : void 0, [], void 0, withHops ? hops : void 0, element);
13389
- try {
13390
- this.records(body, this.options.credentials.peerKey ?? this.participation.pubKeyZ32);
13391
- } catch {
13392
- return false;
13393
- }
13394
- return utf8Encode(JSON.stringify([body, "x".repeat(86)])).length <= MAX_ENVELOPE_PLAINTEXT;
13678
+ return this.bodyFits(body, this.options.credentials.peerKey ?? this.participation.pubKeyZ32);
13395
13679
  };
13396
13680
  const elements = dhtFileElements(file), bare = elements[elements.length - 1];
13397
13681
  const found = [
@@ -13576,7 +13860,7 @@ var DhtDelivery = class DhtDelivery {
13576
13860
  const issued = Math.min(now, Math.max(now - DHT_ISSUED_BACK_MS, expires - (pending ? DHT_MESSAGE_TTL : CONTROL_TTL), (pending?.message[1] ?? 0) - 3e4));
13577
13861
  const identity = !reseal && this.state.peerPinned && this.state.peerPinned !== "can" && this.pinned()?.identity || this.identity;
13578
13862
  const away = !!this.options.credentials.peerKey && now - this.peerNewAt >= 6e5;
13579
- const options = keepAlive && (this.live || away) ? { background: true } : void 0;
13863
+ const options = this.leavingOut ? { signal: true } : keepAlive && (this.live || away) ? { background: true } : void 0;
13580
13864
  const held = this.options.transport.publishHeld?.(identity.pubKeyZ32, options);
13581
13865
  if (held) {
13582
13866
  await this.heldBack(held, now, {
@@ -13628,6 +13912,7 @@ var DhtDelivery = class DhtDelivery {
13628
13912
  throw error;
13629
13913
  }
13630
13914
  this.namedRev = body[8] ?? void 0;
13915
+ if (options?.signal) this.leavingOut = false;
13631
13916
  if (identity === this.identity) this.unsealedOut = !this.options.credentials.peerKey;
13632
13917
  delete this.errors.publish;
13633
13918
  this.changed();
@@ -13977,8 +14262,9 @@ var DhtDelivery = class DhtDelivery {
13977
14262
  await this.serialize(async () => {
13978
14263
  if (!this.running) return;
13979
14264
  const background = !this.urgent && this.pollMs >= STREAM_POLL_MS;
13980
- const signal = this.signalReads > 0;
14265
+ const signal = this.signalReads > 0 && !this.leavingRead;
13981
14266
  this.urgent = false;
14267
+ this.leavingRead = false;
13982
14268
  if (signal) this.signalReads--;
13983
14269
  if (!this.options.credentials.peerKey && !this.options.credentials.expectedPeerKey && !this.state.sequence) await this.publishOnTick();
13984
14270
  const readAt = Date.now();
@@ -13992,7 +14278,10 @@ var DhtDelivery = class DhtDelivery {
13992
14278
  else if (readAt >= this.networkBackAt) this.errors.read = `Could not read DHT delivery: ${error instanceof Error ? error.message : String(error)}`;
13993
14279
  }
13994
14280
  if (signal && this.readHeldUntil > 0) this.signalReads++;
13995
- if (this.state.peerMode !== "dht") this.signalReads = 0;
14281
+ if (this.state.peerMode !== "dht") {
14282
+ this.signalReads = 0;
14283
+ this.probeAt = this.probeGap = 0;
14284
+ }
13996
14285
  await this.publishOnTick();
13997
14286
  this.changed();
13998
14287
  });
@@ -14032,7 +14321,8 @@ var DhtDelivery = class DhtDelivery {
14032
14321
  if (this.mode === "dht" || this.state.peerMode === "dht" && now < this.leavingUntil || now < this.fastUntil) return DHT_POLL_MS;
14033
14322
  if (this.live) return LIVE_POLL_MS;
14034
14323
  if (this.state.pending && this.state.pending.expires > now) return DHT_POLL_MS;
14035
- return this.active ? ACTIVE_DHT_POLL_MS : STREAM_POLL_MS;
14324
+ if (this.active) return ACTIVE_DHT_POLL_MS;
14325
+ return this.state.peerMode === "dht" && this.options.peerDhtPollMs ? Math.min(this.options.peerDhtPollMs, STREAM_POLL_MS) : STREAM_POLL_MS;
14036
14326
  }
14037
14327
  /**
14038
14328
  * How long ago this side's invite was made (or joined), while nobody used it (or its inviter never answered,
@@ -15218,6 +15508,8 @@ var TransportSwitch = class {
15218
15508
  /** This side chose while no session was open: the next one begins with it as a choice. */
15219
15509
  apart = false;
15220
15510
  policiesRead = new RateWindow(10, POLICY_RECEIVE_WINDOW_MS);
15511
+ /** The session on which the contact's policy, the one read already, was said again and read for free (`handle`). */
15512
+ repeatRead = "";
15221
15513
  policyHeld = null;
15222
15514
  constructor(options) {
15223
15515
  this.options = options;
@@ -15532,7 +15824,8 @@ var TransportSwitch = class {
15532
15824
  if (frame.t === "paired-policy") {
15533
15825
  const policy = parsePolicy(frame.policy);
15534
15826
  if (!policy || this.remote && (policy.revision < this.remote.revision || policy.revision === this.remote.revision && JSON.stringify(policy) !== JSON.stringify(this.remote))) return true;
15535
- if (!this.policiesRead.take()) {
15827
+ if (!!this.remote && policy.revision === this.remote.revision && this.repeatRead !== this.context) this.repeatRead = this.context;
15828
+ else if (!this.policiesRead.take()) {
15536
15829
  if (this.policyHeld) this.policyHeld.frame = frame;
15537
15830
  else this.policyHeld = {
15538
15831
  frame,
@@ -15837,7 +16130,7 @@ async function verifyPeerProof(event, c, readStorage) {
15837
16130
  if (sig.length !== 64 || !verify(sig, data, fromZ32(c.externalKey))) throw new Error("Invalid Pubky signature");
15838
16131
  } else if (c.adapter === "keet-import") {
15839
16132
  if (sig.length !== 107 || sig[0] !== 1 || sig[41] !== 0 || sig[42] !== 1) throw new Error("Unsupported Keet attestation");
15840
- const { default: IdentityKey } = await import("./keet-identity-key-BgbqG2dL.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
16133
+ const { default: IdentityKey } = await import("./keet-identity-key-CIwy3XtG.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
15841
16134
  if (!IdentityKey.verify(b4a.from(sig), b4a.from(data), { expectedIdentity: b4a.from(unhex(c.externalKey)) })) throw new Error("Invalid Keet attestation");
15842
16135
  } else throw new Error("Unsupported proof adapter");
15843
16136
  }
@@ -16051,15 +16344,43 @@ var lastOf = (timeline, side, proofs) => {
16051
16344
  for (let i = timeline.length - 1; i >= 0; i--) if (timeline[i].side === side && proofs.includes(timeline[i].proof)) return i;
16052
16345
  return -1;
16053
16346
  };
16347
+ /** The contact's share of this kind still not verified (checking, or failed): the one its next attempt takes over. */
16348
+ var unverifiedOf = (timeline, provider) => {
16349
+ for (let i = timeline.length - 1; i >= 0; i--) {
16350
+ const e = timeline[i];
16351
+ if (e.side === "theirs" && e.kind === "shared" && e.state !== "verified" && e.provider === provider) return i;
16352
+ }
16353
+ return -1;
16354
+ };
16054
16355
  /**
16055
16356
  * The timeline after one step. A share already on it is updated in place, never repeated: a request sent again at
16056
16357
  * a reconnect, a second share of a proof the contact already verified. A new attempt after a failure or a stop is
16057
- * a new entry. A stop is written once; a withdrawal later found revoked becomes a revocation in place.
16358
+ * a new entry, except the contact's own not verified: those keep one entry per kind, which its next attempt takes
16359
+ * over in place (its id and time stay, so no new sound and the chat does not move). The ids and the kind are the
16360
+ * contact's to choose, so otherwise its requests alone could push every other entry, this side's too, out of the
16361
+ * bound. A stop is written once; a withdrawal later found revoked becomes a revocation in place.
16058
16362
  */
16059
16363
  function applyIdentityEvent(timeline, event, at) {
16060
16364
  const out = [...timeline];
16061
16365
  const i = lastOf(out, event.side, event.type === "result" ? [event.proof, event.requested] : [event.proof]);
16062
16366
  const last = i >= 0 ? out[i] : void 0;
16367
+ /** Puts the contact's attempt on the entry of its kind still not verified, if there is one. */
16368
+ const takeOver = (entry) => {
16369
+ const j = event.side === "theirs" ? unverifiedOf(out, entry.provider) : -1;
16370
+ if (j < 0) return false;
16371
+ out[j] = {
16372
+ id: out[j].id,
16373
+ proof: entry.proof,
16374
+ side: "theirs",
16375
+ kind: "shared",
16376
+ provider: entry.provider,
16377
+ ...entry.subject ? { subject: entry.subject } : {},
16378
+ state: entry.state,
16379
+ ...entry.error ? { error: entry.error } : {},
16380
+ at: out[j].at
16381
+ };
16382
+ return true;
16383
+ };
16063
16384
  const add = (entry) => {
16064
16385
  const prefix = `${entry.side}:${entry.proof}:`;
16065
16386
  let n = 0;
@@ -16080,6 +16401,12 @@ function applyIdentityEvent(timeline, event, at) {
16080
16401
  };
16081
16402
  break;
16082
16403
  }
16404
+ if (takeOver({
16405
+ proof: event.proof,
16406
+ provider: event.provider,
16407
+ subject: event.subject,
16408
+ state: "verifying"
16409
+ })) break;
16083
16410
  add({
16084
16411
  proof: event.proof,
16085
16412
  side: event.side,
@@ -16105,6 +16432,12 @@ function applyIdentityEvent(timeline, event, at) {
16105
16432
  };
16106
16433
  break;
16107
16434
  }
16435
+ if (!event.ok && event.provider && takeOver({
16436
+ proof: event.proof,
16437
+ provider: event.provider,
16438
+ subject: event.subject,
16439
+ ...settled
16440
+ })) break;
16108
16441
  if (event.provider) add({
16109
16442
  proof: event.proof,
16110
16443
  side: event.side,
@@ -16182,6 +16515,19 @@ var IDENTITY_MAX_RECEIVED = 16;
16182
16515
  /** `idp-*` frames a paired session reads from the contact per `IDENTITY_FRAME_WINDOW_MS`; the rest are dropped unread. */
16183
16516
  var IDENTITY_FRAME_LIMIT = 40;
16184
16517
  var IDENTITY_FRAME_WINDOW_MS = 6e4;
16518
+ /**
16519
+ * A proof this side holds verified, presented again with the same evidence between the same keys, is answered from that
16520
+ * check while it is younger than this (seconds): the contact chooses how often it presents, and each check costs this
16521
+ * device a provider lookup (a forge's per-IP quota, a DNS query, a contact's server) and a Pkarr read. An hour keeps an
16522
+ * answer as fresh as a re-share can expect; past it, and between, the daily re-check (or Check again) asks the provider.
16523
+ */
16524
+ var IDENTITY_REUSE_CHECK_S = 3600;
16525
+ /**
16526
+ * Presentations a verifier checks with their provider per contact in an hour; past it the contact is told the check
16527
+ * could not run. Room for every proof it may keep (`IDENTITY_MAX_RECEIVED`) and a few retries: a contact making fresh
16528
+ * proofs cannot spend a forge's per-IP quota (GitHub: 60 an hour) for every chat and app on this network.
16529
+ */
16530
+ var IDENTITY_MAX_CHECKS_PER_HOUR = 20;
16185
16531
  var IDENTITY_PROVIDER_ID = /^[a-z][a-z0-9-]{0,31}$/;
16186
16532
  /** Printable ASCII without spaces, so the statement can be built but never needs parsing. */
16187
16533
  var IDENTITY_SUBJECT = /^[\x21-\x7e]{1,512}$/;
@@ -16295,23 +16641,24 @@ function boundVerifiedIdentity(v) {
16295
16641
  if (!isInt$2(v.expiresAt)) throw new Error("Provider returned an invalid expiry");
16296
16642
  out.expiresAt = v.expiresAt;
16297
16643
  }
16298
- if (v.display) {
16299
- const d = v.display;
16300
- const display = {
16301
- source: clean$1(d.source, 120) ?? "Self-described",
16302
- fetchedAt: isInt$2(d.fetchedAt) ? d.fetchedAt : nowSeconds()
16303
- };
16304
- const name = clean$1(d.name, 64);
16305
- if (name) display.name = name;
16306
- if (typeof d.avatar === "string" && d.avatar.length <= 49152 && /^data:image\/(png|jpeg);base64,[A-Za-z0-9+/=]+$/.test(d.avatar)) display.avatar = d.avatar;
16307
- if (typeof d.url === "string" && d.url.length <= 512) try {
16308
- const u = new URL(d.url);
16309
- if (u.protocol === "https:" && !u.username && !u.password) display.url = u.href;
16310
- } catch {}
16311
- out.display = display;
16312
- }
16644
+ if (v.display) out.display = boundIdentityDisplay(v.display);
16313
16645
  return out;
16314
16646
  }
16647
+ /** Bounds a provider's public name/picture (from a proof or `lookupDisplay`): a name with nothing visible left is dropped. */
16648
+ function boundIdentityDisplay(d) {
16649
+ const display = {
16650
+ source: clean$1(d.source, 120) ?? "Self-described",
16651
+ fetchedAt: isInt$2(d.fetchedAt) ? d.fetchedAt : nowSeconds()
16652
+ };
16653
+ const name = clean$1(d.name, 64);
16654
+ if (name) display.name = name;
16655
+ if (typeof d.avatar === "string" && d.avatar.length <= 49152 && /^data:image\/(png|jpeg);base64,[A-Za-z0-9+/=]+$/.test(d.avatar)) display.avatar = d.avatar;
16656
+ if (typeof d.url === "string" && d.url.length <= 512) try {
16657
+ const u = new URL(d.url);
16658
+ if (u.protocol === "https:" && !u.username && !u.password) display.url = u.href;
16659
+ } catch {}
16660
+ return display;
16661
+ }
16315
16662
  var emptyIdentityLedger = () => ({
16316
16663
  challenges: [],
16317
16664
  shared: [],
@@ -16356,6 +16703,7 @@ var IdentityCheckUnavailable = class extends Error {
16356
16703
  /** What the contact is told when the check failed with an IdentityCheckUnavailable. */
16357
16704
  var IDENTITY_CHECK_UNAVAILABLE = "Your contact's app could not check it. Try again later.";
16358
16705
  var TOO_MANY_RECEIVED = "Your contact keeps too many identities from you already";
16706
+ var NEWER_HELD = "Your contact keeps a newer proof of this identity from you";
16359
16707
  var peerError = (e) => e instanceof IdentityCheckUnavailable ? IDENTITY_CHECK_UNAVAILABLE : shortError(e);
16360
16708
  var UNSUPPORTED_KIND = "Your contact's app cannot verify this kind of identity yet";
16361
16709
  var NOT_IN_PROFILE = "That identity is no longer in your profile";
@@ -16367,7 +16715,8 @@ var CONTACT_REFUSALS = /* @__PURE__ */ new Set([
16367
16715
  IDENTITY_CHECK_UNAVAILABLE,
16368
16716
  TOO_MANY_RECEIVED,
16369
16717
  REVOKED,
16370
- EXPIRED
16718
+ EXPIRED,
16719
+ NEWER_HELD
16371
16720
  ]);
16372
16721
  /**
16373
16722
  * Why a share of mine was not accepted, as this app may say it under my identity: one of the refusals above or my own
@@ -16392,6 +16741,8 @@ var IdentityExchange = class {
16392
16741
  requested = /* @__PURE__ */ new Set();
16393
16742
  /** The nonces of the presentations in their provider's check now. */
16394
16743
  checking = /* @__PURE__ */ new Set();
16744
+ /** When the contact's presentations were checked with their provider (seconds), for `IDENTITY_MAX_CHECKS_PER_HOUR`. */
16745
+ checks = [];
16395
16746
  constructor(options) {
16396
16747
  this.options = options;
16397
16748
  }
@@ -16792,6 +17143,10 @@ var IdentityExchange = class {
16792
17143
  let reason;
16793
17144
  /** Its owner withdrew the proof while this check ran: no result goes out (see below). */
16794
17145
  let withdrawn = false;
17146
+ /** The check could not run on this side (IdentityCheckUnavailable). */
17147
+ let unavailable = false;
17148
+ /** The same proof this side holds verified, checked recently: its answer is reused (`IDENTITY_REUSE_CHECK_S`). */
17149
+ let reused;
16795
17150
  try {
16796
17151
  const mayReplace = (r) => r.binding.provider === binding.provider && (r.binding.subject === binding.subject || r.verified.subject === binding.subject);
16797
17152
  if (revokedHere(this.options.storage.read().received, id)) throw new Error(REVOKED);
@@ -16799,13 +17154,21 @@ var IdentityExchange = class {
16799
17154
  if (JSON.stringify(evidence ?? null).length > 16384) throw new Error("Evidence too large");
16800
17155
  if (!verifyIdentityPresentation(binding.key, sig, id, scope, nonce, issuedAt)) throw new Error("The proof key did not sign this conversation's challenge");
16801
17156
  if (binding.issuedAt > now + 300) throw new Error("The proof is dated in the future");
16802
- const result = boundVerifiedIdentity(await this.options.verify(statement, evidence));
17157
+ const evidenceJson = JSON.stringify(evidence ?? null);
17158
+ reused = this.options.storage.read().received.find((r) => r.id === id && r.status === "verified" && r.presenter === scope.subject && r.audience === scope.audience && r.context === scope.context && r.checkedAt <= now && now - r.checkedAt < 3600 && JSON.stringify(r.evidence ?? null) === evidenceJson);
17159
+ if (!reused) {
17160
+ this.checks = this.checks.filter((t) => t > now - 3600 && t <= now);
17161
+ if (this.checks.length >= 20) throw new IdentityCheckUnavailable("Too many of this contact's proofs to check this hour");
17162
+ this.checks.push(now);
17163
+ }
17164
+ const result = reused ? reused.verified : boundVerifiedIdentity(await this.options.verify(statement, evidence));
16803
17165
  if (Math.min(binding.expiresAt, result.expiresAt ?? Infinity) <= now) throw new Error(EXPIRED);
16804
- if (await this.options.revoked?.(statement).catch(() => false)) throw new Error(REVOKED);
17166
+ if (!reused && await this.options.revoked?.(statement).catch(() => false)) throw new Error(REVOKED);
16805
17167
  verified = result;
16806
17168
  } catch (e) {
16807
17169
  error = peerError(e);
16808
17170
  reason = shortError(e);
17171
+ unavailable = e instanceof IdentityCheckUnavailable;
16809
17172
  }
16810
17173
  await this.options.storage.update((l) => {
16811
17174
  const challenge = challengeOf(l);
@@ -16821,11 +17184,27 @@ var IdentityExchange = class {
16821
17184
  verified = void 0;
16822
17185
  error = reason = REVOKED;
16823
17186
  }
17187
+ if (verified && l.received.some((r) => r.id !== id && r.binding.provider === binding.provider && r.verified.subject === subject && r.binding.issuedAt > binding.issuedAt && standing(r, now))) {
17188
+ verified = void 0;
17189
+ error = reason = NEWER_HELD;
17190
+ }
17191
+ const prior = reused && l.received.find((r) => r.id === id);
17192
+ if (verified && reused && prior?.status !== (withdrawn ? "withdrawn" : "verified")) {
17193
+ verified = void 0;
17194
+ error = IDENTITY_CHECK_UNAVAILABLE;
17195
+ reason = "It was checked again while it was presented";
17196
+ }
16824
17197
  const received = verified && receivedWithRoom(l.received, id, (r) => r.binding.provider === binding.provider && r.verified.subject === subject, now);
16825
17198
  if (verified && !received) {
16826
17199
  verified = void 0;
16827
17200
  error = reason = TOO_MANY_RECEIVED;
16828
17201
  }
17202
+ const held = verified ? void 0 : l.received.find((r) => r.id === id && r.presenter === scope.subject && r.audience === scope.audience && (r.status === "verified" || r.status === "unconfirmed"));
17203
+ const stands = held?.status === "verified" && unavailable;
17204
+ if (stands) {
17205
+ verified = held.verified;
17206
+ error = reason = void 0;
17207
+ }
16829
17208
  const logged = this.log(l, {
16830
17209
  type: "result",
16831
17210
  side: "theirs",
@@ -16836,10 +17215,20 @@ var IdentityExchange = class {
16836
17215
  ok: !!verified,
16837
17216
  ...reason ? { error: reason } : {}
16838
17217
  });
16839
- if (!verified || !received) return {
17218
+ if (stands) return {
16840
17219
  ...logged,
16841
17220
  challenges
16842
17221
  };
17222
+ if (!verified || !received) return {
17223
+ ...logged,
17224
+ challenges,
17225
+ received: held && !unavailable ? l.received.map((r) => r === held ? {
17226
+ ...r,
17227
+ checkedAt: now,
17228
+ status: "unconfirmed",
17229
+ error: reason
17230
+ } : r) : l.received
17231
+ };
16843
17232
  const record = {
16844
17233
  id,
16845
17234
  binding,
@@ -16848,8 +17237,8 @@ var IdentityExchange = class {
16848
17237
  presenter: scope.subject,
16849
17238
  audience: scope.audience,
16850
17239
  context: scope.context,
16851
- verifiedAt: now,
16852
- checkedAt: now,
17240
+ verifiedAt: prior?.verifiedAt ?? now,
17241
+ checkedAt: prior?.checkedAt ?? now,
16853
17242
  status: withdrawn ? "withdrawn" : "verified"
16854
17243
  };
16855
17244
  const kept = l.received.filter((r) => r.id !== id && !received.includes(r) && r.binding.provider === binding.provider && r.verified.subject === subject && r.status !== "withdrawn" && r.status !== "revoked").reduce((out, r) => this.log(out, {
@@ -20988,6 +21377,28 @@ var ChatFiles = class {
20988
21377
  });
20989
21378
  this.startNext();
20990
21379
  }
21380
+ /**
21381
+ * An offer taken here whose record or message the host could not store: refused, so its sender does not count it
21382
+ * delivered and keeps its Retry, and forgotten, so that retry is a new offer here. Nothing of it is reported changed
21383
+ * (there is nothing to write it to); what was stored of it is removed.
21384
+ */
21385
+ refuse(id, why) {
21386
+ const entry = this.entries.get(key("in", id));
21387
+ if (!entry || transferEnded(entry.record)) return;
21388
+ this.entries.delete(key("in", id));
21389
+ const incoming = entry.in;
21390
+ entry.record.state = "failed";
21391
+ clearTimeout(incoming.timer);
21392
+ clearTimeout(incoming.ackTimer);
21393
+ incoming.dropped = true;
21394
+ incoming.writing.then(() => incoming.target?.then((t) => t.discard())).catch(() => {});
21395
+ this.send({
21396
+ t: "pf-refuse",
21397
+ id,
21398
+ why
21399
+ });
21400
+ this.startNext();
21401
+ }
20991
21402
  pause(direction, id) {
20992
21403
  const entry = this.entry(direction, id), { record } = entry;
20993
21404
  if (transferEnded(record) || record.state === "verifying" || record.state === "paused" && record.pausedBy === "me") return;
@@ -23132,6 +23543,7 @@ var GhostLink = class {
23132
23543
  save: options.dht.save,
23133
23544
  pollMs: options.dht.pollMs,
23134
23545
  firstControlAfterMs: options.dht.firstControlAfterMs,
23546
+ ...options.dht.peerDhtPollMs && { peerDhtPollMs: options.dht.peerDhtPollMs },
23135
23547
  ...backsOff && { inviteMadeAt: options.madeAt ?? Date.now() },
23136
23548
  capsRev: options.dht.capsRev,
23137
23549
  peerCapsRev: options.dht.peerCapsRev,
@@ -23367,7 +23779,9 @@ var GhostLink = class {
23367
23779
  if (this.activeBinding) return;
23368
23780
  const wasLive = !!this.channel && this.paired?.state.status === "ready";
23369
23781
  this.detach();
23370
- if (wasLive) this.peerLost("closed");
23782
+ if (!wasLive) return;
23783
+ if (this.dataLink.state === "idle" && this.awaitsContactDial()) this.resumeAfterAbsence();
23784
+ this.peerLost("closed");
23371
23785
  },
23372
23786
  onState: (state) => {
23373
23787
  const was = this.lastDataLinkState;
@@ -23613,8 +24027,11 @@ var GhostLink = class {
23613
24027
  if (!this.dht || this.dht.peerMode !== "dht" || this.deliveryMode === "dht" || !presence.online) return;
23614
24028
  if (Date.now() - presenceSeenAt(presence) >= 3e4 || presence.lastPacketAt === this.leftDhtSeenFor) return;
23615
24029
  this.leftDhtSeenFor = presence.lastPacketAt;
23616
- traceLink(this.myPubKeyZ32, "peer-link-packet", { age: Date.now() - presenceSeenAt(presence) });
23617
- this.dht.expect(EXPECT_PEER_MS, true);
24030
+ const read = this.dht.peerLinkPacket(EXPECT_PEER_MS);
24031
+ traceLink(this.myPubKeyZ32, "peer-link-packet", {
24032
+ age: Date.now() - presenceSeenAt(presence),
24033
+ ...!read && { held: true }
24034
+ });
23618
24035
  }
23619
24036
  /**
23620
24037
  * The contact dials (a WebRTC offer signed by its pinned key, or a connection on a native endpoint) while its
@@ -23779,7 +24196,10 @@ var GhostLink = class {
23779
24196
  if (mode === "dht") {
23780
24197
  this.disconnect();
23781
24198
  this.heldSignal = null;
23782
- } else if (!this.quietForTaken) this.session.start();
24199
+ } else if (!this.quietForTaken) {
24200
+ if (this.myPubKeyZ32 > this.options.params.peerPubKeyZ32) this.session.presenceDue();
24201
+ this.session.start();
24202
+ }
23783
24203
  await this.dht.setMode(mode);
23784
24204
  if (mode === "dht") {
23785
24205
  await this.session.stop(false);
@@ -25207,6 +25627,10 @@ var GhostLink = class {
25207
25627
  get dhtPendingId() {
25208
25628
  return this.dht?.pendingId;
25209
25629
  }
25630
+ /** The last DHT send of this text went nowhere: no relay holds it, and it is off the floor (`DhtDelivery.wentNowhereFor`). */
25631
+ dhtWentNowhere(id) {
25632
+ return !!this.dht?.wentNowhereFor(id);
25633
+ }
25210
25634
  /** What went on the DHT floor under this id needs no more retries there (it went live, or was withdrawn). */
25211
25635
  async settleDht(id) {
25212
25636
  await this.dht?.acknowledge(id);
@@ -28005,6 +28429,54 @@ var HEIF_METADATA_ITEMS = /* @__PURE__ */ new Set([
28005
28429
  "mime",
28006
28430
  "uri "
28007
28431
  ]);
28432
+ /**
28433
+ * Item properties that only draw the picture: the codec's configuration (HEVC, AV1, AVC, VVC, JPEG, JPEG 2000,
28434
+ * uncompressed and its components, layered HEVC with its operating points and layers), the size (`ispe`), the bits
28435
+ * per channel (`pixi`), colour (`colr`, its light levels and display volumes `clli`, `mdcv`, `cclv`, `amve`), geometry
28436
+ * (`irot`, `imir`, `clap`, `pasp`, `rloc`, `iscl`), what an auxiliary image is (`auxC`: alpha, depth, a gain map), and
28437
+ * AV1's operating point and layers (`a1op`, `a1lx`).
28438
+ */
28439
+ var HEIF_DRAWS = /* @__PURE__ */ new Set([
28440
+ "hvcC",
28441
+ "av1C",
28442
+ "avcC",
28443
+ "vvcC",
28444
+ "jpgC",
28445
+ "j2kH",
28446
+ "uncC",
28447
+ "cmpd",
28448
+ "lhvC",
28449
+ "oinf",
28450
+ "tols",
28451
+ "lsel",
28452
+ "ispe",
28453
+ "pixi",
28454
+ "colr",
28455
+ "clli",
28456
+ "mdcv",
28457
+ "cclv",
28458
+ "amve",
28459
+ "irot",
28460
+ "imir",
28461
+ "clap",
28462
+ "pasp",
28463
+ "rloc",
28464
+ "iscl",
28465
+ "auxC",
28466
+ "a1op",
28467
+ "a1lx"
28468
+ ]);
28469
+ /** Item properties about the picture: its user description (name, description, tags), accessibility text, creation and modification times, TAI clock and timestamp; and `free`, `skip`. */
28470
+ var HEIF_ABOUT = /* @__PURE__ */ new Set([
28471
+ "udes",
28472
+ "altt",
28473
+ "crtt",
28474
+ "mdft",
28475
+ "taic",
28476
+ "itai",
28477
+ "free",
28478
+ "skip"
28479
+ ]);
28008
28480
  function boxes$1(b, start, end) {
28009
28481
  const found = [];
28010
28482
  for (let at = start; at < end;) {
@@ -28056,8 +28528,16 @@ function stripHeif(b) {
28056
28528
  check$1(at + 6 <= infe.end);
28057
28529
  if (HEIF_METADATA_ITEMS.has(text$1(b, at + 2, 4))) metadata.add(id);
28058
28530
  }
28059
- /** `free` and `skip` boxes, at the top and in `meta`: their bodies go as zeros. */
28060
- const space = [...top, ...children].filter((box) => box.type === "free" || box.type === "skip");
28531
+ const iprp = one("iprp"), properties = [];
28532
+ if (iprp) {
28533
+ const held = boxes$1(b, iprp.body, iprp.end);
28534
+ const ipco = held.filter((box) => box.type === "ipco");
28535
+ check$1(ipco.length === 1 && held.every((box) => box.type === "ipco" || box.type === "ipma"));
28536
+ properties.push(...boxes$1(b, ipco[0].body, ipco[0].end));
28537
+ check$1(properties.every((box) => HEIF_DRAWS.has(box.type) || HEIF_ABOUT.has(box.type)));
28538
+ }
28539
+ /** `free` and `skip` boxes, at the top and in `meta`, and the properties about the picture: their bodies go as zeros. */
28540
+ const space = [...[...top, ...children].filter((box) => box.type === "free" || box.type === "skip"), ...properties.filter((box) => HEIF_ABOUT.has(box.type))];
28061
28541
  const out = b.slice();
28062
28542
  const version = b[iloc.body];
28063
28543
  check$1(version <= 2);
@@ -28375,13 +28855,14 @@ async function withoutPictureMetadata(source, mime) {
28375
28855
  /**
28376
28856
  * What a video leaves with. An MP4 or QuickTime file says more than its frames: its `udta` and `meta` boxes hold where
28377
28857
  * it was recorded (`©xyz`, `com.apple.quicktime.location.ISO6709`), the device, often its software; a timed metadata
28378
- * track (an iPhone's location and motion, a GoPro's GPS) holds them sample by sample; the movie's, each track's and
28858
+ * track (an iPhone's location and motion, a GoPro's GPS) holds them sample by sample, a caption track (a drone's, a
28859
+ * dashcam's) a line of them each second; the movie's, each track's and
28379
28860
  * each track's media header (`mvhd`, `tkhd`, `mdhd`) say when it was recorded, to the second, and a camera's timecode
28380
28861
  * track the time of day. The sender removes them before the file is stored and its digest computed, without decoding
28381
28862
  * or re-encoding a frame: each such box becomes a `free` box of the same size, zeroed, the headers' creation and
28382
28863
  * modification times are zeroed (0 is "unknown"), the space already left in it (`free`, `skip`, `wide`: what an edit in
28383
28864
  * place left behind, a recorder's GPS log) is zeroed after its header, so are the names of its handlers and of the
28384
- * compressor that made its frames, and each metadata and timecode track's samples are zeroed where they are, so no
28865
+ * compressor that made its frames, and each metadata, timecode and caption track's samples are zeroed where they are, so no
28385
28866
  * offset in the file moves and it plays as it did. Only the boxes' headers, `moov` and `moof` are read; the
28386
28867
  * media goes untouched.
28387
28868
  *
@@ -28494,14 +28975,10 @@ var CONTAINERS = /* @__PURE__ */ new Set([
28494
28975
  "mvex",
28495
28976
  "traf"
28496
28977
  ]);
28497
- /** Track handlers kept as they are: picture, sound, text and subtitles, timecode, hints. `meta` tracks have their samples zeroed, `tmcd` ones too. */
28978
+ /** Track handlers kept as they are: picture, sound, timecode, hints. `meta` tracks have their samples zeroed, `tmcd` ones and `CAPTIONS` too. */
28498
28979
  var HANDLERS = /* @__PURE__ */ new Set([
28499
28980
  "vide",
28500
28981
  "soun",
28501
- "text",
28502
- "sbtl",
28503
- "subt",
28504
- "clcp",
28505
28982
  "tmcd",
28506
28983
  "hint",
28507
28984
  "auxv",
@@ -28510,6 +28987,16 @@ var HANDLERS = /* @__PURE__ */ new Set([
28510
28987
  "odsm",
28511
28988
  "subp"
28512
28989
  ]);
28990
+ /**
28991
+ * Text, subtitle and caption tracks: what a recorder writes there is a log (a drone's or a dashcam's GPS, home point,
28992
+ * date and time each second), so their samples are zeroed, in `moov`'s tables and in fragments alike; they show nothing.
28993
+ */
28994
+ var CAPTIONS = /* @__PURE__ */ new Set([
28995
+ "text",
28996
+ "sbtl",
28997
+ "subt",
28998
+ "clcp"
28999
+ ]);
28513
29000
  /** The handlers whose sample descriptions are a visual one's, a compressor's name in each. */
28514
29001
  var VISUAL = /* @__PURE__ */ new Set([
28515
29002
  "vide",
@@ -28672,7 +29159,8 @@ function defaultSampleSizes(moov) {
28672
29159
  * The byte ranges of a fragment's samples in the file, one per track run (`trun`), from its `moof` read whole (`at` its
28673
29160
  * offset in the file): each run starts at its data offset from its track fragment's base (`tfhd`'s base data offset,
28674
29161
  * else the `moof`'s start for the first track fragment or one that says so, else where the previous one's data ended),
28675
- * or where the previous run ended; its length is its samples' sizes, its own or `tfhd`'s or `trex`'s default.
29162
+ * or where the previous run ended; its length is its samples' sizes, its own or `tfhd`'s or `trex`'s default. Each
29163
+ * with its track's ID.
28676
29164
  */
28677
29165
  function fragmentRanges(b, at, sizes) {
28678
29166
  const ranges = [];
@@ -28690,7 +29178,8 @@ function fragmentRanges(b, at, sizes) {
28690
29178
  }
28691
29179
  if (flags & 2) field += 4;
28692
29180
  if (flags & 8) field += 4;
28693
- let size = sizes.get(u32be(b, tfhd.body + 4));
29181
+ const track = u32be(b, tfhd.body + 4);
29182
+ let size = sizes.get(track);
28694
29183
  if (flags & 16) {
28695
29184
  check(field + 4 <= tfhd.end);
28696
29185
  size = u32be(b, field);
@@ -28723,7 +29212,11 @@ function fragmentRanges(b, at, sizes) {
28723
29212
  length = count * size;
28724
29213
  }
28725
29214
  check(Number.isSafeInteger(next) && Number.isSafeInteger(next + length));
28726
- if (length) ranges.push([next, next + length]);
29215
+ if (length) ranges.push([
29216
+ next,
29217
+ next + length,
29218
+ track
29219
+ ]);
28727
29220
  next += length;
28728
29221
  }
28729
29222
  previous = next;
@@ -28738,12 +29231,13 @@ function selfContained(b, minf) {
28738
29231
  }
28739
29232
  /**
28740
29233
  * `moov` with its metadata boxes emptied and its headers' times zeroed, read whole: whether it has a video track, the
28741
- * byte ranges of its metadata and timecode tracks' samples (zeroed by the caller where they are), whether a metadata
28742
- * track has any, and every track's sample table.
29234
+ * byte ranges of its metadata, timecode and caption tracks' samples (zeroed by the caller where they are), whether it
29235
+ * has a metadata or timecode track, every track's sample table, and the IDs of its caption tracks (their samples in
29236
+ * fragments zeroed too).
28743
29237
  */
28744
29238
  function stripMoov(b) {
28745
29239
  let video = false, fragmented = false, metadata = false;
28746
- const zeroed = [], tables = [];
29240
+ const zeroed = [], tables = [], captions = /* @__PURE__ */ new Set();
28747
29241
  for (const box of boxes(b, header(b, 0, b.length).body, b.length)) {
28748
29242
  if (METADATA.has(box.type)) {
28749
29243
  empty(b, box);
@@ -28757,14 +29251,18 @@ function stripMoov(b) {
28757
29251
  emptyWithin(b, box.body, box.end);
28758
29252
  }
28759
29253
  if (box.type !== "trak") continue;
28760
- let mdia;
29254
+ let mdia, tkhd;
28761
29255
  for (const part of boxes(b, box.body, box.end)) {
28762
29256
  if (METADATA.has(part.type)) {
28763
29257
  empty(b, part);
28764
29258
  continue;
28765
29259
  }
28766
29260
  check(TRAK_KEEPS.has(part.type));
28767
- if (part.type === "tkhd") zeroTimes(b, part);
29261
+ if (part.type === "tkhd") {
29262
+ check(!tkhd);
29263
+ tkhd = part;
29264
+ zeroTimes(b, part);
29265
+ }
28768
29266
  if (part.type === "mdia") {
28769
29267
  check(!mdia);
28770
29268
  mdia = part;
@@ -28780,11 +29278,18 @@ function stripMoov(b) {
28780
29278
  tables.push(stbl);
28781
29279
  if (handler === "meta") {
28782
29280
  check(selfContained(b, minf));
28783
- const ranges = sampleRanges(b, stbl);
28784
- metadata ||= ranges.length > 0;
28785
- for (const range of ranges) zeroed.push(range);
28786
- } else if (handler === "tmcd" && selfContained(b, minf)) for (const range of sampleRanges(b, stbl)) zeroed.push(range);
28787
- else check(HANDLERS.has(handler));
29281
+ metadata = true;
29282
+ for (const range of sampleRanges(b, stbl)) zeroed.push(range);
29283
+ } else if (handler === "tmcd" && selfContained(b, minf)) {
29284
+ metadata = true;
29285
+ for (const range of sampleRanges(b, stbl)) zeroed.push(range);
29286
+ } else if (CAPTIONS.has(handler)) {
29287
+ check(selfContained(b, minf) && !!tkhd);
29288
+ const id = tkhd.body + 4 + (b[tkhd.body] === 1 ? 16 : 8);
29289
+ check(id + 4 <= tkhd.end);
29290
+ captions.add(u32be(b, id));
29291
+ for (const range of sampleRanges(b, stbl)) zeroed.push(range);
29292
+ } else check(HANDLERS.has(handler));
28788
29293
  if (handler === "vide") video = true;
28789
29294
  if (VISUAL.has(handler)) zeroCompressorNames(b, stbl);
28790
29295
  emptyWithin(b, box.body, box.end);
@@ -28794,7 +29299,8 @@ function stripMoov(b) {
28794
29299
  fragmented,
28795
29300
  metadata,
28796
29301
  zeroed,
28797
- tables
29302
+ tables,
29303
+ captions
28798
29304
  };
28799
29305
  }
28800
29306
  /**
@@ -28923,7 +29429,7 @@ async function videoMetadataPatches(file, mime) {
28923
29429
  }
28924
29430
  check(moovs.length === 1);
28925
29431
  const moov = await whole(source, moovs[0]);
28926
- const { video, fragmented, metadata, zeroed, tables } = stripMoov(moov);
29432
+ const { video, fragmented, metadata, zeroed, tables, captions } = stripMoov(moov);
28927
29433
  if (!video && !typed) return void 0;
28928
29434
  patches.push({
28929
29435
  start: moovs[0].start,
@@ -28938,10 +29444,13 @@ async function videoMetadataPatches(file, mime) {
28938
29444
  }
28939
29445
  }
28940
29446
  check(!fragmented || !metadata);
28941
- const sizes = dropped.length && fragmented ? defaultSampleSizes(moov) : void 0;
29447
+ const sizes = (dropped.length || captions.size) && fragmented ? defaultSampleSizes(moov) : void 0;
28942
29448
  for (const box of top) if (box.type === "moof") {
28943
29449
  const moof = await whole(source, box);
28944
- if (dropped.length) for (const [start, end] of fragmentRanges(moof, box.start, sizes ?? /* @__PURE__ */ new Map())) check(!meets(dropped, start, end));
29450
+ if (dropped.length || captions.size) for (const [start, end, track] of fragmentRanges(moof, box.start, sizes ?? /* @__PURE__ */ new Map())) {
29451
+ check(!meets(dropped, start, end));
29452
+ if (captions.has(track)) zeroed.push([start, end]);
29453
+ }
28945
29454
  emptyWithin(moof, box.body - box.start, moof.length);
28946
29455
  patches.push({
28947
29456
  start: box.start,
@@ -29315,7 +29824,8 @@ function findLightningDestination(text) {
29315
29824
  };
29316
29825
  }
29317
29826
  var hex = (bytes) => Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
29318
- var reason = (value) => typeof value === "string" ? value.replace(/\s+/g, " ").slice(0, 200) : "";
29827
+ /** A server's own words on one line, bounded, with no character that hides text or reorders what follows it. */
29828
+ var reason = (value) => typeof value === "string" ? stripHidden(value.replace(/\s+/g, " ")).slice(0, 200) : "";
29319
29829
  var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
29320
29830
  async function readBounded(response, maxBytes) {
29321
29831
  const reader = response.body?.getReader?.();
@@ -29466,6 +29976,16 @@ function invoiceCallbackUrl(params, amountSat, comment) {
29466
29976
  }
29467
29977
  return url.href;
29468
29978
  }
29979
+ /** A success action's link: HTTPS, bounded, and no user part ("https://www.paypal.com@evil.example" opens evil.example). */
29980
+ function successUrl(text) {
29981
+ if (!/^https:\/\//i.test(text) || text.length > LNURL_LIMITS.maxUrlLength) return false;
29982
+ try {
29983
+ const url = new URL(text);
29984
+ return !url.username && !url.password;
29985
+ } catch {
29986
+ return false;
29987
+ }
29988
+ }
29469
29989
  /**
29470
29990
  * Checks the invoice a service answered with (LUD-06): the amount asked, a payment hash, not expired, and
29471
29991
  * a commitment to the metadata the person was shown: the `h` tag is its sha256, or the invoice carries the
@@ -29475,7 +29995,7 @@ function parseInvoiceCallback(body, params, amountSat) {
29475
29995
  if (!isRecord(body) || typeof body.pr !== "string") throw new Error(`${params.callbackDomain} did not answer with an invoice`);
29476
29996
  const invoice = decodeBolt11(body.pr);
29477
29997
  if (!invoice) throw new Error(`${params.callbackDomain} answered with an invoice that does not decode`);
29478
- if (invoice.amountMsat !== BigInt(amountSat) * 1000n) throw new Error(`The invoice asks for ${invoice.amountSat === null ? "any amount" : `${invoice.amountSat.toLocaleString()} sats`}, not the ${amountSat.toLocaleString()} sats you chose`);
29998
+ if (invoice.amountMsat !== BigInt(amountSat) * 1000n) throw new Error(`The invoice asks for ${invoice.amountSat === null ? "any amount" : `${invoice.amountSat.toLocaleString("en-US")} sats`}, not the ${amountSat.toLocaleString("en-US")} sats you chose`);
29479
29999
  if (!invoice.paymentHash) throw new Error("The invoice has no payment hash");
29480
30000
  if (invoice.descriptionHash !== params.descriptionHash && invoice.description !== params.metadata) throw new Error("The invoice does not commit to what the service said the payment is for");
29481
30001
  if (invoice.expiresAt * 1e3 < Date.now()) throw new Error("The invoice the service answered with has already expired");
@@ -29486,7 +30006,7 @@ function parseInvoiceCallback(body, params, amountSat) {
29486
30006
  tag: "message",
29487
30007
  message: reason(action.message)
29488
30008
  };
29489
- else if (action.tag === "url" && typeof action.url === "string" && /^https:\/\//i.test(action.url) && action.url.length <= LNURL_LIMITS.maxUrlLength) successAction = {
30009
+ else if (action.tag === "url" && typeof action.url === "string" && successUrl(action.url)) successAction = {
29490
30010
  tag: "url",
29491
30011
  description: reason(action.description),
29492
30012
  url: action.url
@@ -30928,7 +31448,7 @@ function parseDidJws(input) {
30928
31448
  }
30929
31449
  if (!isObject$6(header)) throw new DidError("The JWS header is not a JSON object");
30930
31450
  const alg = header.alg;
30931
- if (typeof alg !== "string" || !DID_JWS_ALGS[alg]) throw new DidError(`The JWS uses ${typeof alg === "string" ? alg.slice(0, 16) : "no algorithm"}: Ghostly checks EdDSA, ES256K and ES256`);
31451
+ if (typeof alg !== "string" || !DID_JWS_ALGS[alg]) throw new DidError(`The JWS uses ${typeof alg === "string" ? "another algorithm" : "no algorithm"}: Ghostly checks EdDSA, ES256K and ES256`);
30932
31452
  if (header.kid !== void 0 && (typeof header.kid !== "string" || header.kid.length > 640)) throw new DidError("The JWS kid is not a key id");
30933
31453
  if (header.b64 !== void 0 && typeof header.b64 !== "boolean") throw new DidError("The JWS b64 header is not true or false");
30934
31454
  const crit = header.crit;
@@ -30975,7 +31495,7 @@ function verifyWith(key, signature, message, format = "compact") {
30975
31495
  return false;
30976
31496
  }
30977
31497
  }
30978
- var refusedKey = (key) => new DidError(`Signed by ${key.id}, which the DID document does not list under authentication or assertionMethod`);
31498
+ var refusedKey = () => new DidError("Signed by a key the DID document does not list under authentication or assertionMethod");
30979
31499
  /**
30980
31500
  * Which key of `doc` made this JWS over one of `messages` (the statement, and the statement with a
30981
31501
  * trailing newline some tools add). With a `kid`, only that key is tried. Refused unless the key is
@@ -30986,9 +31506,9 @@ function checkDidJws(input, messages, doc) {
30986
31506
  let candidates = doc.keys.filter((k) => k.curve === jws.curve);
30987
31507
  if (jws.kid !== void 0) {
30988
31508
  const kid = methodId(doc.did, jws.kid);
30989
- if (!kid) throw new DidError(`The JWS names key ${jws.kid.slice(0, 100)}, which is not a key of ${doc.did}`);
31509
+ if (!kid) throw new DidError(`The JWS names a key that is not a key of ${doc.did}`);
30990
31510
  candidates = candidates.filter((k) => k.id === kid);
30991
- if (!candidates.length) throw new DidError(doc.keys.some((k) => k.id === kid) ? `Key ${kid} is not a ${jws.curve} key: the JWS says ${jws.alg}` : `The DID document lists no key ${kid}`);
31511
+ if (!candidates.length) throw new DidError(doc.keys.some((k) => k.id === kid) ? `The key the JWS names is not a ${jws.curve} key: the JWS says ${jws.alg}` : "The DID document does not list the key the JWS names");
30992
31512
  }
30993
31513
  if (!candidates.length) throw new DidError(`The DID document lists no ${jws.curve} key for ${jws.alg}`);
30994
31514
  let inputs;
@@ -31010,7 +31530,7 @@ function checkDidJws(input, messages, doc) {
31010
31530
  alg: jws.alg
31011
31531
  };
31012
31532
  }
31013
- if (refused) throw refusedKey(refused);
31533
+ if (refused) throw refusedKey();
31014
31534
  throw new DidError("The JWS signature does not match: sign exactly the statement shown, with a key of this DID");
31015
31535
  }
31016
31536
  /**
@@ -31022,9 +31542,9 @@ function checkDidSignature(signature, messages, doc, vm) {
31022
31542
  let candidates = doc.keys;
31023
31543
  if (vm !== void 0) {
31024
31544
  const id = methodId(doc.did, vm);
31025
- if (!id) throw new DidError(`${vm.slice(0, 100)} is not a key of ${doc.did}`);
31545
+ if (!id) throw new DidError(`The proof names a key that is not a key of ${doc.did}`);
31026
31546
  candidates = candidates.filter((k) => k.id === id);
31027
- if (!candidates.length) throw new DidError(`The DID document lists no key ${id}`);
31547
+ if (!candidates.length) throw new DidError("The DID document does not list the key the proof names");
31028
31548
  }
31029
31549
  const der = signature.length !== 64 && signature[0] === 48;
31030
31550
  if (signature.length !== 64 && !der) throw new DidError("A signature is 64 bytes (or DER, for ECDSA)");
@@ -31043,7 +31563,7 @@ function checkDidSignature(signature, messages, doc, vm) {
31043
31563
  signature: canonical
31044
31564
  };
31045
31565
  }
31046
- if (refused) throw refusedKey(refused);
31566
+ if (refused) throw refusedKey();
31047
31567
  throw new DidError("The signature does not match: sign exactly the statement shown, with a key of this DID");
31048
31568
  }
31049
31569
  function parseDidSignaturePaste(pasted) {
@@ -32334,7 +32854,7 @@ function parseKeyBlob(blob) {
32334
32854
  if (blob.length > 1100) fail("SSH public key too large");
32335
32855
  const r = new Reader(blob);
32336
32856
  const type = r.text(64);
32337
- if (!SSH_KEY_TYPES.includes(type)) fail(`Unsupported SSH key type ${JSON.stringify(type)}`);
32857
+ if (!SSH_KEY_TYPES.includes(type)) fail(`Unsupported SSH key type${type === "ssh-dss" ? " \"ssh-dss\"" : ""}`);
32338
32858
  const key = {
32339
32859
  type,
32340
32860
  blob,
@@ -32447,7 +32967,7 @@ function ecdsaSignature(blob, size) {
32447
32967
  async function verifySshSignature(armored, message, options = {}) {
32448
32968
  const parsed = parseSshSignature(armored);
32449
32969
  const namespace = options.namespace ?? "ghostly";
32450
- if (parsed.namespace !== namespace) fail(`Signed for namespace ${JSON.stringify(parsed.namespace)}, not ${JSON.stringify(namespace)}. Use -n ${namespace}.`);
32970
+ if (parsed.namespace !== namespace) fail(`Signed for another namespace, not ${JSON.stringify(namespace)}. Use -n ${namespace}.`);
32451
32971
  const bytes = typeof message === "string" ? utf8Encode(message) : message;
32452
32972
  const digest = parsed.hashAlgorithm === "sha512" ? sha512(bytes) : sha256(bytes);
32453
32973
  const signed = concatBytes(utf8Encode("SSHSIG"), sshString(utf8Encode(parsed.namespace)), sshString(/* @__PURE__ */ new Uint8Array()), sshString(utf8Encode(parsed.hashAlgorithm)), sshString(digest));
@@ -33074,6 +33594,13 @@ var GROUP_LIMITS = {
33074
33594
  /** Frames waiting for an epoch (or its secret) that has not arrived yet. */
33075
33595
  waiting: 64,
33076
33596
  waitingBytes: 1048576,
33597
+ /**
33598
+ * Of those, and of the edits waiting, the ones signed by a key no recent commit names (a newcomer whose admission has
33599
+ * not come yet, or a key anyone can make up): the newest only, they go first, and they never say I am behind.
33600
+ */
33601
+ waitingStrangers: 8,
33602
+ /** How long a frame or edit waits: then it is dropped, and a later catch-up brings it again if it was real. */
33603
+ waitingMs: 12e4,
33077
33604
  /** Epoch secrets kept: past this, older epochs cannot be read or handed on. */
33078
33605
  secrets: 32,
33079
33606
  /** Secrets in one `group-secrets` frame: apps from before revision 0.9 drop a frame with more. */
@@ -33118,7 +33645,16 @@ var GROUP_LIMITS = {
33118
33645
  /** A received message is in the saved state within this long (`persistSoon`): a burst of them is one save, not one each. */
33119
33646
  saveWithinMs: 1e3,
33120
33647
  /** New name records of one member taken in `syncWindowMs` (WISP 902 § Messages, "The name record"): one a rename. */
33121
- namesPerMember: 4
33648
+ namesPerMember: 4,
33649
+ /**
33650
+ * Messages of one member taken per `messageWindowMs`, and the bytes of their frames, past a burst of twice its whole
33651
+ * log (`AuthorPace`); its edits the same, counted apart. As a community's (`COMMUNITY_LIMITS.messagesPerAuthor`): each
33652
+ * one taken is a row in every member's app and a frame each hub passes on. The rest are not taken now and come again
33653
+ * in a catch-up.
33654
+ */
33655
+ messagesPerAuthor: 30,
33656
+ messageBytesPerAuthor: 131072,
33657
+ messageWindowMs: 1e4
33122
33658
  };
33123
33659
  /** What every member should know about who can read what, in the words the apps show. */
33124
33660
  var GROUP_READ_NOTE = `Everyone in the group can read everything sent while they are a member. Someone removed keeps what they already received and cannot read what comes after; someone who joins later cannot read what came before. Messages go to each member; whoever was away gets what they missed from any member who has it (the group's last ${GROUP_LIMITS.relay} messages) when they meet again.`;
@@ -33127,6 +33663,55 @@ var GROUP_READ_NOTE = `Everyone in the group can read everything sent while they
33127
33663
  * answer: slices go one after another, each once my app handled the last (`CATCH_UP_PAUSE_MS` at most between them).
33128
33664
  */
33129
33665
  var ANSWER_WINDOW_MS$1 = 5e3;
33666
+ /**
33667
+ * One member's messages (or edits) taken: its whole log handed back at once twice over (`AUTHOR_BURST`: an edge opening
33668
+ * hears it, with what the member says live beside it, and the edits its app says again), then
33669
+ * `GROUP_LIMITS.messagesPerAuthor` and `messageBytesPerAuthor` per `messageWindowMs`, as a community's `MessagePace`.
33670
+ * One not taken is neither seen nor kept nor passed on, so a sync still names it (`miss`) and a catch-up hands it again.
33671
+ * What another member hands on in its answer to my sync (or what waited for a secret) is counted too, and may run the
33672
+ * author's allowance below nothing by one answer's worth (`AUTHOR_OWED`): a catch-up holds more than a burst, and lands
33673
+ * at once; the author's next frames wait until the pace pays it back. Not counted, a member at the other end of my sync
33674
+ * handed on all a second member signed, at any rate.
33675
+ */
33676
+ var AUTHOR_BURST = {
33677
+ frames: 2 * GROUP_LIMITS.outlog,
33678
+ bytes: 2 * GROUP_LIMITS.outlogBytes
33679
+ };
33680
+ /** How far below nothing an answer may run an author's allowance: all its messages one answer hands on, or edits. */
33681
+ var AUTHOR_OWED = {
33682
+ messages: {
33683
+ frames: GROUP_LIMITS.relay,
33684
+ bytes: GROUP_LIMITS.relayBytes
33685
+ },
33686
+ edits: {
33687
+ frames: GROUP_LIMITS.handOnEdits,
33688
+ bytes: GROUP_LIMITS.relayEditBytes
33689
+ }
33690
+ };
33691
+ var AuthorPace = class {
33692
+ owed;
33693
+ frames = AUTHOR_BURST.frames;
33694
+ bytes = AUTHOR_BURST.bytes;
33695
+ at;
33696
+ constructor(owed) {
33697
+ this.owed = owed;
33698
+ }
33699
+ /** `answer`: handed on in an answer to my sync, or waited, so it may run the allowance below nothing (`owed`). */
33700
+ take(bytes, now, answer = false) {
33701
+ const elapsed = Math.max(0, now - (this.at ?? now)) / GROUP_LIMITS.messageWindowMs;
33702
+ this.at = now;
33703
+ this.frames = Math.min(AUTHOR_BURST.frames, this.frames + elapsed * GROUP_LIMITS.messagesPerAuthor);
33704
+ this.bytes = Math.min(AUTHOR_BURST.bytes, this.bytes + elapsed * GROUP_LIMITS.messageBytesPerAuthor);
33705
+ const floor = answer ? this.owed : {
33706
+ frames: 0,
33707
+ bytes: 0
33708
+ };
33709
+ if (this.frames + floor.frames < 1 || this.bytes + floor.bytes < bytes) return false;
33710
+ this.frames -= 1;
33711
+ this.bytes -= bytes;
33712
+ return true;
33713
+ }
33714
+ };
33130
33715
  var MAX_TEXT_BOX$1 = Math.ceil((GROUP_LIMITS.textBytes + 16) * 4 / 3) + 4;
33131
33716
  /** Sixteen mentions as JSON, each a key and two offsets, with room to spare, sealed. */
33132
33717
  var MAX_MENTIONS_BOX = Math.ceil((MENTION_LIMITS.count * 96 + 16) * 4 / 3) + 4;
@@ -33457,6 +34042,20 @@ function isMessageFrame$1(v) {
33457
34042
  const f = v;
33458
34043
  return f.t === "group-msg" && typeof f.g === "string" && GROUP_ID.test(f.g) && Number.isSafeInteger(f.e) && f.e >= 0 && typeof f.s === "string" && MEMBER_KEY.test(f.s) && Number.isSafeInteger(f.n) && f.n >= 0 && Number.isSafeInteger(f.ts) && f.ts > 0 && typeof f.nn === "string" && f.nn.length === 32 && B64$1.test(f.nn) && typeof f.c === "string" && f.c.length <= MAX_TEXT_BOX$1 && B64$1.test(f.c) && typeof f.sig === "string" && f.sig.length === 86 && B64$1.test(f.sig);
33459
34044
  }
34045
+ /**
34046
+ * A waiting list past `max` places, past `waitingStrangers` of keys no recent commit names, or past its bytes (`heavy`):
34047
+ * which one goes, or -1. Such a key's oldest first, else the oldest of the author holding the most places, so one
34048
+ * author's frames for an epoch that never comes push out its own, not another member's.
34049
+ */
34050
+ function overflow(list, max, heavy = false) {
34051
+ const strangers = list.filter((w) => w.stranger).length;
34052
+ if (!list.length || !heavy && list.length <= max && strangers <= GROUP_LIMITS.waitingStrangers) return -1;
34053
+ if (strangers) return list.findIndex((w) => w.stranger);
34054
+ const places = /* @__PURE__ */ new Map();
34055
+ for (const w of list) places.set(w.frame.s, (places.get(w.frame.s) ?? 0) + 1);
34056
+ const most = Math.max(...places.values());
34057
+ return list.findIndex((w) => places.get(w.frame.s) === most);
34058
+ }
33460
34059
  /** The chain cut in consecutive pieces of at most `chainPiece` commits and `chainPieceBytes`: a roster of 32 makes a commit ~2.4 KB. */
33461
34060
  function chainPieces(chain) {
33462
34061
  const pieces = [];
@@ -33483,6 +34082,11 @@ var GroupSession = class {
33483
34082
  waitingBytes = 0;
33484
34083
  /** Edits for an epoch, or a secret, not here yet: tried again with the frames above. In memory only. */
33485
34084
  waitingEdits = [];
34085
+ /**
34086
+ * Members one of whose frames waited `waitingMs` for an epoch that never came → when it was dropped: until my chain
34087
+ * moves, theirs waiting say I am behind no more (`behind`). In memory only.
34088
+ */
34089
+ waitedInVain = /* @__PURE__ */ new Map();
33486
34090
  pendingCommits = /* @__PURE__ */ new Map();
33487
34091
  /** When each member was last asked to catch me up, so a stream of unreadable frames is one question, not a loop. */
33488
34092
  asked = /* @__PURE__ */ new Map();
@@ -33497,6 +34101,9 @@ var GroupSession = class {
33497
34101
  nameSaid;
33498
34102
  /** New name records taken per member, a few a minute (`GROUP_LIMITS.namesPerMember`). In memory only. */
33499
34103
  namesTaken = /* @__PURE__ */ new Map();
34104
+ /** Messages, and apart from them edits, taken per author (`AuthorPace`). In memory only. */
34105
+ messagePace = /* @__PURE__ */ new Map();
34106
+ editPace = /* @__PURE__ */ new Map();
33500
34107
  queue = Promise.resolve();
33501
34108
  /** One metadata frame that names a commit or an epoch I do not have yet: tried again when the chain moves. */
33502
34109
  pendingMeta;
@@ -34055,16 +34662,29 @@ var GroupSession = class {
34055
34662
  return false;
34056
34663
  }
34057
34664
  }
34058
- /** Another member's edit, kept to hand on: the latest per message; the oldest go once the log is full. False: one as new was kept. */
34665
+ /**
34666
+ * Another member's edit, kept to hand on: the latest per message. Full (in count or in bytes), the oldest of the author
34667
+ * who holds the most of it goes (the one just kept's own on a tie): an author's edits of messages that are not there,
34668
+ * which no keeper can tell (a hub cannot even open them), as many as it likes, push out only its own. False: one as
34669
+ * new was kept, or this one went.
34670
+ */
34059
34671
  keepEdit(frame) {
34060
34672
  const same = (f) => f.s === frame.s && f.e === frame.e && f.n === frame.n;
34061
34673
  const log = this.state.relayEdits ?? [];
34062
34674
  if (log.some((f) => same(f) && f.v >= frame.v)) return false;
34063
- const next = [...log.filter((f) => !same(f)), cleanEdit(frame)];
34675
+ const kept = cleanEdit(frame);
34676
+ const next = [...log.filter((f) => !same(f)), kept];
34064
34677
  let bytes = next.reduce((sum, f) => sum + f.c.length, 0);
34065
- while (next.length > GROUP_LIMITS.relayEdits || bytes > GROUP_LIMITS.relayEditBytes) bytes -= next.shift().c.length;
34678
+ while (next.length > GROUP_LIMITS.relayEdits || bytes > GROUP_LIMITS.relayEditBytes) {
34679
+ const byCount = next.length > GROUP_LIMITS.relayEdits;
34680
+ const held = /* @__PURE__ */ new Map();
34681
+ for (const f of next) held.set(f.s, (held.get(f.s) ?? 0) + (byCount ? 1 : f.c.length));
34682
+ let most = frame.s;
34683
+ for (const [author, amount] of held) if (amount > held.get(most)) most = author;
34684
+ bytes -= next.splice(next.findIndex((f) => f.s === most), 1)[0].c.length;
34685
+ }
34066
34686
  this.state.relayEdits = next;
34067
- return true;
34687
+ return next.includes(kept);
34068
34688
  }
34069
34689
  /** A frame of another member, kept to hand on; the oldest go once the log is full. */
34070
34690
  keep(frame) {
@@ -34396,9 +35016,14 @@ var GroupSession = class {
34396
35016
  await this.resealBehind();
34397
35017
  });
34398
35018
  }
34399
- /** Something is missing here: the current epoch's secret, a commit ahead of my chain, or the epoch of frames waiting. */
35019
+ /**
35020
+ * Something is missing here: the current epoch's secret, a commit ahead of my chain, or the epoch of a member's frames
35021
+ * waiting, unless one of that member's waited in vain since my chain last moved (`waitedInVain`).
35022
+ */
34400
35023
  get behind() {
34401
- return !this.state.secrets[this.epoch] || this.waiting.length > 0 || this.pendingCommits.size > 0;
35024
+ this.expireWaiting();
35025
+ const member = (w) => !w.stranger && !((this.waitedInVain.get(w.frame.s) ?? -Infinity) >= this.chainMovedAt);
35026
+ return !this.state.secrets[this.epoch] || this.waiting.some(member) || this.pendingCommits.size > 0;
34402
35027
  }
34403
35028
  async resealBehind() {
34404
35029
  const alone = new Set(this.state.alone ?? []);
@@ -34462,7 +35087,8 @@ var GroupSession = class {
34462
35087
  /**
34463
35088
  * Says an edit of one of my messages (WISP 902 § Edits): edit `v`, the whole new text and its mentions, sealed under
34464
35089
  * the key of the message's epoch and signed, to every member of that epoch still in the group, or to `to` alone (an
34465
- * edge that just opened). Someone admitted after the message cannot open it and is not sent it. The message's
35090
+ * edge that just opened). Someone admitted after the message cannot open it and is not sent it, but a hub I count on
35091
+ * (`hooks.carriers`), which carries it on to the members who can. The message's
34466
35092
  * epoch key must still be here: past `GROUP_LIMITS.secrets` epochs a message cannot be edited.
34467
35093
  */
34468
35094
  sendEdit(messageId, edit, to) {
@@ -34487,6 +35113,7 @@ var GroupSession = class {
34487
35113
  if (utf8Encode(plain).length > MAX_EDIT_PLAIN) return { error: "Message exceeds 16 KiB" };
34488
35114
  const copies = [ref, ...this.state.sent.filter((f) => f.o && f.o.e === ref.e && f.o.n === ref.n)];
34489
35115
  const told = /* @__PURE__ */ new Set();
35116
+ const carriers = this.hooks.carriers?.() ?? [];
34490
35117
  for (const copy of copies) {
34491
35118
  const readers = this.state.chain[copy.e]?.m, key = this.secret(copy.e);
34492
35119
  if (!readers || !key) continue;
@@ -34509,11 +35136,12 @@ var GroupSession = class {
34509
35136
  ...unsigned,
34510
35137
  sig: toBase64Url(sign(editSigned(unsigned), this.identity.seed))
34511
35138
  };
34512
- const members = (to === void 0 ? this.others : [to]).filter((k) => k !== this.myKey && !told.has(k) && rosterHas(this.roster, k) && rosterHas(readers, k));
34513
- for (const k of members) {
35139
+ const targets = (to === void 0 ? this.others : [to]).filter((k) => k !== this.myKey && rosterHas(this.roster, k));
35140
+ for (const k of targets.filter((k) => !told.has(k) && rosterHas(readers, k))) {
34514
35141
  this.hooks.send(k, frame);
34515
35142
  told.add(k);
34516
35143
  }
35144
+ for (const k of targets.filter((k) => carriers.includes(k) && !rosterHas(readers, k))) this.hooks.send(k, frame);
34517
35145
  }
34518
35146
  return { sent: told.size };
34519
35147
  });
@@ -34912,11 +35540,11 @@ var GroupSession = class {
34912
35540
  }
34913
35541
  const relayed = raw.s !== from;
34914
35542
  const now = this.now(), answer = (this.answering.get(from) ?? 0) > now;
34915
- if (answer) this.answering.set(from, now + ANSWER_WINDOW_MS$1);
34916
35543
  if (relayed && (!rosterHas(this.roster, from) || !this.handsOn(raw.s))) return;
34917
35544
  if (this.isDuplicate(raw)) return;
34918
35545
  const signedWhole = relayed && this.wholeSigned(raw);
34919
35546
  if (!signedWhole && !verify(fromBase64Url(raw.sig), messageSigned$1(raw), publicKeyFromZ32(raw.s))) return;
35547
+ if (answer) this.answering.set(from, now + ANSWER_WINDOW_MS$1);
34920
35548
  if (raw.e > this.epoch) {
34921
35549
  this.park(from, raw);
34922
35550
  return;
@@ -34936,6 +35564,7 @@ var GroupSession = class {
34936
35564
  delete raw.o;
34937
35565
  delete raw.xs;
34938
35566
  }
35567
+ if (!this.paced(this.messagePace, raw.s, frameBytes(raw), relayed && (answer || waited))) return;
34939
35568
  const first = raw.o === void 0 ? null : readFirstPlace(raw.o, raw.e);
34940
35569
  if (raw.o !== void 0 && !first) return;
34941
35570
  const secret = this.secret(raw.e);
@@ -35012,7 +35641,7 @@ var GroupSession = class {
35012
35641
  * in, and a member away when it was said would keep the message for good. One for an epoch or a secret not here yet
35013
35642
  * waits, as a message does. Taken, it is kept to hand on in turn.
35014
35643
  */
35015
- async receiveEdit(from, raw) {
35644
+ async receiveEdit(from, raw, waited = false) {
35016
35645
  if (!isEditFrame(raw) || raw.s === this.myKey || !rosterHas(this.roster, from)) return;
35017
35646
  const member = rosterHas(this.roster, raw.s);
35018
35647
  if (!verify(fromBase64Url(raw.sig), editSigned(raw), publicKeyFromZ32(raw.s))) return;
@@ -35021,7 +35650,15 @@ var GroupSession = class {
35021
35650
  return;
35022
35651
  }
35023
35652
  const commit = this.state.chain[raw.e];
35024
- if (!commit || !rosterHas(commit.m, raw.s) || !rosterHas(commit.m, this.myKey)) return;
35653
+ if (!commit || !rosterHas(commit.m, raw.s)) return;
35654
+ if (!(this.state.relayEdits ?? []).some((f) => f.s === raw.s && f.e === raw.e && f.n === raw.n && f.v >= raw.v) && !this.paced(this.editPace, raw.s, raw.c.length + 400, raw.s !== from && (this.awaitsAnswer(from) || waited))) return;
35655
+ if (!rosterHas(commit.m, this.myKey)) {
35656
+ if (member && this.keepEdit(raw)) {
35657
+ this.persistSoon();
35658
+ this.took(cleanEdit(raw));
35659
+ }
35660
+ return;
35661
+ }
35025
35662
  const secret = this.secret(raw.e);
35026
35663
  if (!secret) {
35027
35664
  if (raw.e >= this.epoch - GROUP_LIMITS.secrets) this.parkEdit(from, raw);
@@ -35056,18 +35693,27 @@ var GroupSession = class {
35056
35693
  ...rm ? { rm: true } : {}
35057
35694
  });
35058
35695
  if (this.keepEdit(raw)) {
35059
- await this.persist();
35696
+ this.persistSoon();
35060
35697
  this.took(cleanEdit(raw));
35061
35698
  }
35062
35699
  }
35063
35700
  parkEdit(from, frame) {
35064
35701
  if (frame.e > this.epoch + GROUP_LIMITS.secrets) return;
35702
+ this.expireWaiting();
35065
35703
  this.waitingEdits = [...this.waitingEdits.filter((w) => !(w.frame.s === frame.s && w.frame.e === frame.e && w.frame.n === frame.n && w.frame.v <= frame.v)), {
35066
35704
  from,
35067
- frame
35068
- }].slice(-GROUP_LIMITS.outlog);
35705
+ frame,
35706
+ at: this.now(),
35707
+ stranger: this.stranger(frame.s)
35708
+ }];
35709
+ for (let i; (i = overflow(this.waitingEdits, GROUP_LIMITS.outlog)) >= 0;) this.waitingEdits.splice(i, 1);
35069
35710
  this.ask(from);
35070
35711
  }
35712
+ paced(paces, author, bytes, answer) {
35713
+ let pace = paces.get(author);
35714
+ if (!pace) paces.set(author, pace = new AuthorPace(paces === this.editPace ? AUTHOR_OWED.edits : AUTHOR_OWED.messages));
35715
+ return pace.take(bytes, this.now(), answer);
35716
+ }
35071
35717
  wholeSigned(raw) {
35072
35718
  if (typeof raw.xs !== "string" || raw.xs.length !== 86 || !B64$1.test(raw.xs)) return false;
35073
35719
  try {
@@ -35176,15 +35822,31 @@ var GroupSession = class {
35176
35822
  }
35177
35823
  park(from, frame) {
35178
35824
  if (frame.e > this.epoch + GROUP_LIMITS.secrets) return;
35825
+ this.expireWaiting();
35179
35826
  if (this.waiting.some((w) => w.frame.s === frame.s && w.frame.e === frame.e && w.frame.n === frame.n)) return;
35180
35827
  this.waiting.push({
35181
35828
  from,
35182
- frame
35829
+ frame,
35830
+ at: this.now(),
35831
+ stranger: this.stranger(frame.s)
35183
35832
  });
35184
35833
  this.waitingBytes += frame.c.length;
35185
- while (this.waiting.length > GROUP_LIMITS.waiting || this.waitingBytes > GROUP_LIMITS.waitingBytes) this.waitingBytes -= this.waiting.shift().frame.c.length;
35834
+ for (let i; (i = overflow(this.waiting, GROUP_LIMITS.waiting, this.waitingBytes > GROUP_LIMITS.waitingBytes)) >= 0;) this.waitingBytes -= this.waiting.splice(i, 1)[0].frame.c.length;
35186
35835
  this.ask(from);
35187
35836
  }
35837
+ /** Not in the roster, nor in any of the last `secrets` commits: a key whose frames may be no member's. */
35838
+ stranger(key) {
35839
+ return !this.state.chain.slice(-GROUP_LIMITS.secrets).some((c) => rosterHas(c.m, key));
35840
+ }
35841
+ /** Frames and edits that waited `waitingMs`: dropped, and a member's noted (`waitedInVain`). */
35842
+ expireWaiting() {
35843
+ const now = this.now(), stale = (w) => now - w.at >= GROUP_LIMITS.waitingMs;
35844
+ if (!this.waiting.some(stale) && !this.waitingEdits.some(stale)) return;
35845
+ for (const w of this.waiting) if (stale(w) && !w.stranger) this.waitedInVain.set(w.frame.s, now);
35846
+ this.waiting = this.waiting.filter((w) => !stale(w));
35847
+ this.waitingBytes = this.waiting.reduce((sum, w) => sum + w.frame.c.length, 0);
35848
+ this.waitingEdits = this.waitingEdits.filter((w) => !stale(w));
35849
+ }
35188
35850
  /** Whoever sent something I cannot read yet is ahead of me, or holds a secret I lack: ask, but not in a loop. */
35189
35851
  ask(from) {
35190
35852
  const now = Date.now();
@@ -35208,7 +35870,7 @@ var GroupSession = class {
35208
35870
  for (const { from, frame } of ready) await this.receiveMessage(from, frame, true);
35209
35871
  const edits = this.waitingEdits.filter((w) => w.frame.e <= this.epoch && !!this.state.secrets[w.frame.e]);
35210
35872
  this.waitingEdits = this.waitingEdits.filter((w) => !edits.includes(w));
35211
- for (const { from, frame } of edits) await this.receiveEdit(from, frame);
35873
+ for (const { from, frame } of edits) await this.receiveEdit(from, frame, true);
35212
35874
  }
35213
35875
  async receiveCommit(from, frame) {
35214
35876
  const raw = frame.commit;
@@ -35825,6 +36487,12 @@ var COMMUNITY_LIMITS = {
35825
36487
  window: 64,
35826
36488
  /** Commits known off the main branch. */
35827
36489
  side: 512,
36490
+ /**
36491
+ * Of those, the branches one member's commit ends (its newest), and the commits it signed: a handful of races, and
36492
+ * one full run of its admissions (`memberAdmissions`, with the leaves among them). The admin's are not counted.
36493
+ */
36494
+ sideTips: 8,
36495
+ sideCommits: 64,
35828
36496
  /** Commits waiting for their parent. */
35829
36497
  pendingCommits: 64,
35830
36498
  /** Epoch secrets waiting for their commit. */
@@ -35833,6 +36501,11 @@ var COMMUNITY_LIMITS = {
35833
36501
  pendingMs: 12e4,
35834
36502
  waiting: 64,
35835
36503
  waitingBytes: 1048576,
36504
+ /**
36505
+ * Of those, the ones signed by a key no commit I know names (a newcomer whose admission has not come yet, or a key
36506
+ * anyone can make up): the newest only, they push out nobody else's, and they make no catch-up hurry.
36507
+ */
36508
+ waitingStrangers: 8,
35836
36509
  replay: 256,
35837
36510
  /** Commits in one welcome or chain piece. */
35838
36511
  chainPiece: 100,
@@ -36718,11 +37391,12 @@ var CommunitySession = class CommunitySession {
36718
37391
  * it was in. What one who left wrote while in the group is taken and handed on, its goodbye included, up to what the
36719
37392
  * member who committed the leave had heard of it then (its `group-left` mark), never past it: the leaver still holds
36720
37393
  * those epochs' secrets, and anything it signs later is not heard (WISP 903 § Leaving and removal). No mark here
36721
- * (one not come yet, or a committer's app before it) and nothing of it is heard.
37394
+ * (one not come yet, or a committer's app before it) and nothing of it is heard. A key let in only on a branch that
37395
+ * lost is heard no more either, as one removed, once this member knows it lost.
36722
37396
  */
36723
37397
  heardAfterOut(f) {
36724
37398
  const i = this.outIndex(f.s);
36725
- if (i < 0) return true;
37399
+ if (i < 0) return rosterHas(this.roster, f.s) || this.isRecentMember(f.s) || !this.lostAt(f.s);
36726
37400
  const commit = this.state.chain[i];
36727
37401
  if (commit.k !== "leave") return false;
36728
37402
  const high = this.state.left?.[communityCommitHash(commit)]?.hi[seenKey(f.e, f.h)];
@@ -37084,6 +37758,7 @@ var CommunitySession = class CommunitySession {
37084
37758
  }
37085
37759
  this.followEntry();
37086
37760
  this.pruneSide();
37761
+ this.state.pendingLeaves = this.state.pendingLeaves.filter((r) => rosterHas(this.roster, r.s));
37087
37762
  if (this.state.status !== status) await this.persist();
37088
37763
  else this.persistSoon();
37089
37764
  this.hooks.changed();
@@ -37164,10 +37839,45 @@ var CommunitySession = class CommunitySession {
37164
37839
  seedB64: ""
37165
37840
  };
37166
37841
  }
37167
- /** Side commits stay up to a bound, the most recent ones (a longer branch being assembled included). */
37842
+ /**
37843
+ * Side commits stay up to a bound, the most recent ones (a longer branch being assembled included), and a member's
37844
+ * newest only: past `sideTips` of the branches it ends or `sideCommits` of its commits, its oldest branch goes, from
37845
+ * the tip down, so nothing kept loses its parent. Each is weighed at every commit taken and saved with the group, so
37846
+ * what one member signs off the main branch costs every member a bounded amount. What it signs last is kept, so a
37847
+ * branch it grows still comes in commit by commit (one let go comes again from where it parts in a catch-up).
37848
+ */
37168
37849
  pruneSide() {
37169
- this.state.side = this.state.side.slice(-COMMUNITY_LIMITS.side);
37170
- const keep = new Set(this.state.side.map((c) => communityCommitHash(c)));
37850
+ const admin = this.admin, hashes = /* @__PURE__ */ new Map();
37851
+ const hash = (c) => {
37852
+ let h = hashes.get(c);
37853
+ if (!h) hashes.set(c, h = communityCommitHash(c));
37854
+ return h;
37855
+ };
37856
+ let side = this.state.side.slice(-COMMUNITY_LIMITS.side);
37857
+ for (;;) {
37858
+ const held = new Set(side.map(hash)), parents = new Set(side.map((c) => c.p)), drop = /* @__PURE__ */ new Set();
37859
+ const signed = /* @__PURE__ */ new Map(), tips = /* @__PURE__ */ new Map(), oldest = /* @__PURE__ */ new Map(), cut = /* @__PURE__ */ new Set();
37860
+ for (const c of side) signed.set(c.by, (signed.get(c.by) ?? 0) + 1);
37861
+ for (let i = side.length - 1; i >= 0; i--) {
37862
+ const c = side[i];
37863
+ if (!held.has(c.p) && !this.mainIndex.has(c.p)) {
37864
+ drop.add(c);
37865
+ continue;
37866
+ }
37867
+ if (parents.has(hash(c))) continue;
37868
+ const n = (tips.get(c.by) ?? 0) + 1;
37869
+ tips.set(c.by, n);
37870
+ if (c.by !== admin && n > COMMUNITY_LIMITS.sideTips) {
37871
+ drop.add(c);
37872
+ cut.add(c.by);
37873
+ } else oldest.set(c.by, c);
37874
+ }
37875
+ for (const [by, n] of signed) if (by !== admin && n > COMMUNITY_LIMITS.sideCommits && !cut.has(by) && oldest.has(by)) drop.add(oldest.get(by));
37876
+ if (!drop.size) break;
37877
+ side = side.filter((c) => !drop.has(c));
37878
+ }
37879
+ this.state.side = side;
37880
+ const keep = new Set(side.map(hash));
37171
37881
  for (const [h, c] of [...this.known]) {
37172
37882
  if (this.mainIndex.has(h)) {
37173
37883
  if (this.mainIndex.get(h) < this.state.chain.length - 1 - COMMUNITY_LIMITS.window) this.rosters.delete(h);
@@ -37196,9 +37906,20 @@ var CommunitySession = class CommunitySession {
37196
37906
  if (!Object.keys(bySender).length) delete this.state.seen[sender];
37197
37907
  }
37198
37908
  }
37909
+ /**
37910
+ * Those of the main branch's window always stay, the current epoch's included; side commits, however many are
37911
+ * kept, only get what is left of the bound, the most recent first.
37912
+ */
37199
37913
  pruneSecrets() {
37200
- const order = [...this.state.chain.slice(-COMMUNITY_LIMITS.window - 1), ...this.state.side].map((c) => communityCommitHash(c));
37201
- const keep = new Set(order.slice(-COMMUNITY_LIMITS.secrets));
37914
+ const keep = new Set(this.state.chain.slice(-COMMUNITY_LIMITS.window - 1).map((c) => communityCommitHash(c)));
37915
+ let room = COMMUNITY_LIMITS.secrets - [...keep].filter((h) => this.state.secrets[h]).length;
37916
+ for (let i = this.state.side.length - 1; i >= 0 && room > 0; i--) {
37917
+ const h = communityCommitHash(this.state.side[i]);
37918
+ if (this.state.secrets[h] && !keep.has(h)) {
37919
+ keep.add(h);
37920
+ room--;
37921
+ }
37922
+ }
37202
37923
  for (const h of Object.keys(this.state.secrets)) if (!keep.has(h)) delete this.state.secrets[h];
37203
37924
  }
37204
37925
  /** A derived epoch's secret, from its parent's, when that is held. */
@@ -37281,7 +38002,8 @@ var CommunitySession = class CommunitySession {
37281
38002
  this.requireMember();
37282
38003
  if (!this.isAdmin) throw new Error("Only the admin can do that");
37283
38004
  }
37284
- async commit(kind, fields, now) {
38005
+ /** `alongside`: what else the commit changes in the state, saved in the same write (only once the commit is signed). */
38006
+ async commit(kind, fields, now, alongside) {
37285
38007
  if (!this.adminWork) throw new Error(GROUP_ADMIN_OFF_ERROR);
37286
38008
  if (this.hooks.adminTurn && !await this.hooks.adminTurn()) throw engineError("groupTurnUnconfirmed");
37287
38009
  if (this.state.chain.length >= COMMUNITY_LIMITS.chain) throw new Error("This group has reached its membership history limit. Create a new group.");
@@ -37325,6 +38047,7 @@ var CommunitySession = class CommunitySession {
37325
38047
  this.state.seq = 0;
37326
38048
  this.state.seqH = hash;
37327
38049
  this.pruneSide();
38050
+ alongside?.();
37328
38051
  await this.persist();
37329
38052
  this.hooks.broadcast({
37330
38053
  t: "group-commit",
@@ -37486,12 +38209,12 @@ var CommunitySession = class CommunitySession {
37486
38209
  return this.serialize(async () => {
37487
38210
  this.requireAdmin();
37488
38211
  const entry = off ? null : identityFromSeedB64(toBase64Url(randomBytes(32)));
37489
- await this.commit("link", { x: entry?.pubKeyZ32 ?? "" }, now);
37490
- this.state.entry = {
37491
- key: entry?.pubKeyZ32 ?? "",
37492
- seedB64: entry?.seedB64 ?? ""
37493
- };
37494
- await this.persist();
38212
+ await this.commit("link", { x: entry?.pubKeyZ32 ?? "" }, now, () => {
38213
+ this.state.entry = {
38214
+ key: entry?.pubKeyZ32 ?? "",
38215
+ seedB64: entry?.seedB64 ?? ""
38216
+ };
38217
+ });
37495
38218
  if (entry) {
37496
38219
  const pause = pacer(ENTRY_SLICE_MS);
37497
38220
  for (const key of this.others) {
@@ -38442,19 +39165,25 @@ var CommunitySession = class CommunitySession {
38442
39165
  park(from, frame) {
38443
39166
  if (frame.e > this.epoch + COMMUNITY_LIMITS.window) return;
38444
39167
  if (this.waiting.some((w) => w.frame.s === frame.s && w.frame.e === frame.e && w.frame.h === frame.h && w.frame.n === frame.n)) return;
39168
+ const stranger = !rosterHas(this.roster, frame.s) && !this.isRecentMember(frame.s);
38445
39169
  this.waiting.push({
38446
39170
  from,
38447
- frame
39171
+ frame,
39172
+ stranger
38448
39173
  });
38449
39174
  this.waitingBytes += frame.c.length;
38450
- while (this.waiting.length > COMMUNITY_LIMITS.waiting || this.waitingBytes > COMMUNITY_LIMITS.waitingBytes) this.waitingBytes -= this.waiting.shift().frame.c.length;
39175
+ for (;;) {
39176
+ const strangers = this.waiting.filter((w) => w.stranger).length;
39177
+ if (strangers <= COMMUNITY_LIMITS.waitingStrangers && this.waiting.length <= COMMUNITY_LIMITS.waiting && this.waitingBytes <= COMMUNITY_LIMITS.waitingBytes) break;
39178
+ this.waitingBytes -= this.waiting.splice(strangers ? this.waiting.findIndex((w) => w.stranger) : 0, 1)[0].frame.c.length;
39179
+ }
38451
39180
  this.ask(from);
38452
39181
  }
38453
- /** Something is missing here: the current epoch's secret, or the epoch of frames waiting. */
39182
+ /** Something is missing here: the current epoch's secret, or the epoch of a member's frames waiting. */
38454
39183
  get needsCatchUp() {
38455
39184
  if (!this.isMember) return false;
38456
39185
  this.dropStale(this.pendingCommits, this.hooks.clock?.() ?? Date.now());
38457
- return !this.state.secrets[this.topHash] || this.waiting.length > 0 || this.pendingCommits.size > 0;
39186
+ return !this.state.secrets[this.topHash] || this.waiting.some((w) => !w.stranger) || this.pendingCommits.size > 0;
38458
39187
  }
38459
39188
  /** Asks a member I have an edge to for what I lack (the engine calls it now and then while `needsCatchUp`). */
38460
39189
  catchUp(to) {
@@ -38492,7 +39221,9 @@ var CommunitySession = class CommunitySession {
38492
39221
  if (!answered.take()) return;
38493
39222
  if (lost) {
38494
39223
  const at = this.mainIndex.get(frame.h);
38495
- const commits = this.state.chain.slice(at !== void 0 ? at + 1 : lost.fork + 1, lost.end + 1);
39224
+ let commits = this.state.chain.slice(at !== void 0 ? at + 1 : lost.fork + 1, lost.end + 1);
39225
+ const link = commits.findIndex((c) => c.k === "link" && !!c.x);
39226
+ if (link >= 0) commits = commits.slice(0, link);
38496
39227
  if (commits.length) this.answers.handOut(from, commits.map((commit) => ({
38497
39228
  t: "group-commit",
38498
39229
  v: 2,
@@ -38581,7 +39312,7 @@ var CommunitySession = class CommunitySession {
38581
39312
  const entry = this.entryFrame(from);
38582
39313
  if (entry) answer.push(entry);
38583
39314
  }
38584
- for (const request of this.state.pendingLeaves) answer.push({
39315
+ for (const request of this.state.pendingLeaves) if (rosterHas(this.roster, request.s)) answer.push({
38585
39316
  t: "group-leave",
38586
39317
  v: 2,
38587
39318
  g: this.id,
@@ -40097,6 +40828,6 @@ function x401ApprovalDigest(subject) {
40097
40828
  return toBase64Url(sha256(utf8Encode(canonical)));
40098
40829
  }
40099
40830
  //#endregion
40100
- export { COMMUNITY_LIMITS as $, currentRelays as $C, TurnRecordError as $S, HANDOFF_HELLO as $_, DEMOTE_AFTER_FAILURES as $a, APP_NAME as $b, APP_RANGE_DATA_KIND as $c, nip05RootKey as $d, EDIT_FRAME as $f, parseRtcSignal as $g, DHT_POLL_INTERVALS as $h, isSparkAddress as $i, PairedSession as $l, signCommit as $m, MessageRefusal as $n, SIGNAL_CARRIERS as $o, readReply as $p, DidError as $r, TYPING_SEND_LIMIT as $s, GROUP_EDIT_TEXT_BYTES as $t, emptyProofLedger as $u, readHandoffManifest as $v, unwrapPasted as $w, createLink as $x, KNOCK_SLOT_LABEL as $y, readX401ProofResponseHeader as A, DEFAULT_RELAYS as AC, seedSigner as AS, HTTP_SERVICE_PROTO as A_, findBolt11 as Aa, APP_BUNDLE_LIMITS as Ab, WAKE_INTERVAL_MS as Ac, transportOrder as Ad, VOICE_LIMITS as Af, sanitizeRequestHeaders as Ag, ratchetRoot as Ah, jwkThumbprint as Ai, isChatAppId as Al, MESSAGE_CLOCK_SKEW_MS as Am, parseGroupMetaBody as An, ENGINE_ERRORS as Ao, GROUP_REACTION_FRAME as Ap, parseAtprotoDidDocument as Ar, readLobby as As, knockRecords as At, IdentityCheckUnavailable as Au, handoffHaveFrames as Av, IDENTITY_MEMO_SIZE as Aw, canonicalJson as Ax, enrollProofFrame as Ay, APP_STORE_KINDS as B, PREVIOUS_DEFAULT_RELAYS as BC, TOMBSTONE_TURN as BS, servicesToWire as B_, videoMetadataPatches as Ba, appViewOf as Bb, wakeFrame as Bc, DNS_TYPE as Bd, voiceFileName as Bf, decodeChunk as Bg, LATE_ANSWER_MS as Bh, TEST_USDT_FAUCET_AMOUNT as Bi, KNOWN_SESSION_CAPABILITIES as Bl, LEGACY_GROUP_MEMBERS as Bm, SSH_PUBLIC_KEY_MAX as Bn, GROUP_WANT_NO_FRAME as Bo, reactedFrame as Bp, parseAtprotoDidKey as Br, FILE_LIMITS as Bs, groupWakes as Bt, newIdentityBinding as Bu, handoffVerifiedMessage as Bv, sealedLength as Bw, DEVICE_INVITE_OWN_DEVICE as Bx, REOPEN_BELOW as By, buildX401TokenObject as C, BACKGROUND_REQUESTS_PER_MINUTE as CC, deviceLinkSealKey as CS, LABEL$1 as C_, parseInvoiceCallback as Ca, openRequest as Cb, pinnedFrame as Cc, checkedDescriptors as Cd, PREVIEWABLE_IMAGE as Cf, HttpClient as Cg, RATCHET_OVERHEAD as Ch, decodeDidDhtPacket as Ci, AppSessions as Cl, readStatusCard as Cm, groupMetaPicture as Cn, WAKE_ANSWER_GRACE_MS as Co, previewImageSize as Cp, ATPROTO_PROOF_SCOPE as Cr, mergeBeacon as Cs, KNOCK_TTL_MS as Ct, IDENTITY_MAX_RECEIVED as Cu, handoffContextProof as Cv, parseRelayPayload as Cw, IMAGE_LIMITS as Cx, enrollCancelFrame as Cy, readX401ProofRequest as D, CHAT_RESERVE_MOST_SHARE as DC, signDeviceTransports as DS, emptyLinkRecords as D_, resolveLightningDestination as Da, requestRecords as Db, WAKE_CALL_TTL_SECONDS as Dc, rankTransports as Dd, sanitizeMime as Df, parseLocalTarget as Dg, ratchetHeard as Dh, didDhtRecords as Di, appOpenFrame as Dl, statusCardText as Dm, keepPastGroupMeta as Dn, pairedMessageFrame as Do, forwardedMany as Dp, checkAtprotoProofRecord as Dr, rankHubs as Ds, entryParams as Dt, IDENTITY_REVOCATION_LABEL as Du, handoffEphemeral as Dv, decodeTxtPacket as Dw, parseImageMeta as Dx, enrollGrantFrame as Dy, isX401Protocol as E, CHAT_RESERVE as EC, newDeviceSetSecret as ES, buildLinkRecords as E_, requestLnurlInvoice as Ea, requestPlaintextBytes as Eb, WAKE_CALL_INTERVAL_MS as Ec, irohRelayUrl as Ed, sanitizeFileName as Ef, formatLocalTarget as Eg, isRatcheted as Eh, didDhtKey as Ei, appDataFrame as El, statusCardBytes as Em, groupName as En, pairedMessageFits as Eo, forwardedAgain as Ep, atprotoProofRkey as Er, pickHubs as Es, encodeGroupEntryLink as Et, IDENTITY_PROVIDER_ID as Eu, handoffDoneFrame as Ev, decodeDnsAnswers as Ew, isImageMime as Ex, enrollDoneFrame as Ey, appRevocationFor as F, GROUP_OVER_PACE_MS as FC, TURN_VISIBLE_MS as FS, encodeServices as F_, isFederationId as Fa, APP_ICON_PATH as Fb, newWakeToken as Fc, HoldRefusedError as Fd, formatVoiceDuration as Ff, CHUNK_FLAG_END as Fg, CONNECT_TIMEOUT_MS as Fh, EVM_TEST_CHAINS as Fi, BUTTONS_CAPABILITY as Fl, shownTime as Fm, verifyGroupMetaSignature as Fn, PairingTracker as Fo, ReactionWindow as Fp, decodeAtprotoCommit as Fr, PairedCalls as Fs, GROUP_WAKE_GROUP_WINDOW_MS as Ft, identityRefusal as Fu, handoffReleaseFrame as Fv, sign as Fw, createContactLink as Fx, FLOOD_PER_DAY as Fy, readAppStore as G, SIGNALING_ALLOWANCE_SHARE as GC, TURN_NAME_BYTES as GS, HANDOFF_BUSY_REASONS as G_, stripPictureMetadata as Ga, isAppLicense as Gb, WebPushError as Gc, NIP05_PATH as Gd, VIDEO_LIMITS as Gf, wrapDataChannel as Gg, DIRECT_OWN_ATTEMPTS as Gh, assertWholeSats as Gi, STATUS_CARD_CAPABILITY as Gl, SAID_AGAIN as Gm, sshFingerprint as Gn, readGroupHave as Go, readReaction as Gp, verifyAtprotoSignature as Gr, sentWhole as Gs, GROUP_READ_NOTE as Gt, IDENTITY_TIMELINE_MAX as Gu, readHandoffAck as Gv, sanitizeAvatar as Gw, readDeviceInvite as Gx, planKnocks as Gy, checkAppListing as H, REQUESTS_PER_MINUTE as HC, TURN_LABEL as HS, HANDOFF_ACK as H_, NO_PICTURE_METADATA as Ha, buildAppBundle as Hb, wakeRequest as Hc, DOMAIN_MAX_RECORDS as Hd, voiceLevelsOf as Hf, encodeChunk as Hg, REANSWERS as Hh, WALLET_NETWORKS as Hi, REACTIONS_CAPABILITY as Hl, MAX_GROUP_MEMBERS as Hm, parseSshPublicKey as Hn, groupFileFallback as Ho, reactionFrame as Hp, readAtprotoCid as Hr, decodeFileData as Hs, parseGroupWakeFrame as Ht, revokesIdentity as Hu, isHandoffPartName as Hv, MAX_AVATAR_LENGTH as Hw, deviceInviteJoinerKeyZ32 as Hx, endedRequests as Hy, appStoreDecision as I, GROUP_RATION_WINDOW_MS as IC, classifyTurnRead as IS, isValidServiceId as I_, parseCashuRequestPayload as Ia, APP_PERMISSIONS as Ib, parseWakeFrame as Ic, isHoldUrl as Id, isPlayableAudioType as If, CHUNK_KIND as Ig, DATA_SETTLE_MS as Ih, ONCHAIN_PROVIDER as Ii, CALLS_CAPABILITY as Il, GROUP_ADMIN_OFF_ERROR as Im, wrapGroupMeta as In, GROUP_FILE_LIMITS as Io, nextReactionNumber as Ip, decodeDagCbor as Ir, parsePairedCallFrame as Is, GROUP_WAKE_MEMBER_INTERVAL_MS as It, identityRevocationValue as Iu, handoffRequestFrame as Iv, verify as Iw, encodeContactLink as Ix, MAX_DONE as Iy, GROUP_TYPING_FRAME as J, SLOW_MS as JC, TURN_SEALED_BYTES as JS, HANDOFF_DATA as J_, ANSWERS_REFUSED_PAUSE_MS as Ja, pacer as Jb, encryptPushPayload as Jc, dnsProofName as Jd, isVideoMime as Jf, RTC_SIGNAL_FUTURE_MS as Jg, directBlocked as Jh, parsePaymentAmount as Ji, UPGRADE_CAPABILITY as Jl, expectedRoster as Jm, verifySshSignature as Jn, CARRIED_DEFER_MS as Jo, PAIRED_REPLY_AUTHORS as Jp, DID_GHOSTLY_SERVICE as Jr, TYPING_FRAME as Js, chainPieces as Jt, PROOF_ADAPTERS as Ju, readHandoffData as Jv, hasVisible as Jw, INVITE_LINK_ORIGIN as Jx, turnOff as Jy, readAppStoreSteps as K, SIGNALING_WINDOW_MS as KC, TURN_NO_ACTIVE as KS, HANDOFF_CANCEL as K_, withoutPictureMetadata as Ka, isAppPath as Kb, checkPushEndpoint as Kc, WELL_KNOWN_PATH as Kd, formatVideoDuration as Kf, DATA_CHANNEL_ID as Kg, DIRECT_PEERS as Kh, formatPaymentAmount as Ki, SessionCapabilities as Kl, commitHash as Km, sshKeyDigestHex as Kn, readGroupWant as Ko, validReactionNumber as Kp, DID_DOCUMENT_MAX_BYTES as Kr, transferEnded as Ks, GroupSession as Kt, applyIdentityEvent as Ku, readHandoffBusy as Kv, MAX_NICK_LENGTH as Kw, DEVICE_INVITE_VERSION as Kx, settleRequest as Ky, appUpdateDecision as L, GROUP_SIGNALING_ALLOWANCE_SHARE as LC, keptAtEqualSequence as LS, isViewerTag as L_, parseFedimintRequestPayload as La, APP_SCREENSHOTS_DIR as Lb, readWake as Lc, newMailbox as Ld, parseVoiceMeta as Lf, LIMITS as Lg, DataLink as Lh, PaymentPreflightError as Li, EDIT_CAPABILITY as Ll, GROUP_ID as Lm, SSHSIG_MAX_ARMOR as Ln, GROUP_HAVE_FRAME as Lo, parseReactedFrame as Lp, encodeDagCbor as Lr, ChatFiles as Ls, GROUP_WAKE_RECEIVE_LIMIT as Lt, identityStatement as Lu, handoffRetryAfter as Lv, decrypt as Lw, readContactLink as Lx, MAX_MISSED as Ly, readX401ProofResultHeader as M, FRESH_READ_MS as MC, TURN_PUT_WINDOW_MS as MS, MAX_SERVICES as M_, cashuRequestPayload as Ma, APP_CLIENTS as Mb, WAKE_TTL_SECONDS as Mc, HOLD_DATED_BACK_MS as Md, baseMime as Mf, viewerResponseHeaders as Mg, ratchetSessionOf as Mh, resolveDidDht as Mi, readAppFrame as Ml, claimedTime as Mm, parseGroupMetaStatement as Mn, engineError as Mo, REACTED_FRAME as Mp, AtprotoCid as Mr, validHead as Ms, readKnocks as Mt, boundVerifiedIdentity as Mu, handoffManifestFrames as Mv, identityFromSeed as Mw, readCanonicalJson as Mx, readEnrollGrant as My, x401AnswerableRequests as N, GROUP_BURST_MS as NC, TURN_RAISE_READ_TIMEOUT_MS as NS, SERVICES_VERSION as N_, fedimintRequestPayload as Na, APP_CLIENT_NAME as Nb, WakeLimiter as Nc, HOLD_LIMITS as Nd, downsamplePeaks as Nf, webLocalFetch as Ng, ratchetUnknownSession as Nh, signDidDhtPacket as Ni, APPS_CAPABILITY as Nl, heardTime as Nm, parseGroupMetaTag as Nn, engineText as No, REACTION_FRAME as Np, AtprotoProofError as Nr, MAX_PAIRED_CALL_SIGNAL as Ns, GROUP_WAKE_FRAME as Nt, emptyIdentityLedger as Nu, handoffOfferFrame as Nv, identityFromSeedB64 as Nw, CONTACT_LINK_BYTES as Nx, readEnrollHello as Ny, readX401ProofRequestHeader as O, CHAT_RESERVE_PER_CHAT as OC, unsignedDeviceTransports as OS, isEmptyLinkPacket as O_, BOLT11_PATTERN as Oa, seenEntry as Ob, WAKE_CALL_WAIT_MS as Oc, relayUrl as Od, PLAYABLE_AUDIO as Of, relativizeLocation as Og, ratchetOn as Oh, encodeDidDhtDeactivated as Oi, chatAppId as Ol, taskProgress as Om, nextGroupMetaRevision as On, parsePaymentNetworks as Oo, readForwarded as Op, isAtprotoDid as Or, readBeacon as Os, groupEntryUrl as Ot, IDENTITY_STATEMENT_PREFIX as Ou, handoffFileMissingFrame as Ov, encodeTxtPacket as Ow, previewable as Ox, enrollHelloFrame as Oy, addedAppPermissions as P, GROUP_BURST_ONE_LINK as PC, TURN_SETTLE_MS as PS, decodeServices as P_, findEndpoint as Pa, APP_FORBIDDEN_KEYS as Pb, deviceWakeRequest as Pc, HoldKeys as Pd, fileMessageText as Pf, withViewerPolicy as Pg, ANSWER_REFUSED_REDIALS as Ph, ETHEREUM_USDT as Pi, APP_RANGES_CAPABILITY as Pl, receivedTimestamp as Pm, signGroupMeta as Pn, parseEngineError as Po, REACTION_LIMITS as Pp, atprotoCidFor as Pr, PAIRED_CALL_FRAME as Ps, GROUP_WAKE_GROUP_LIMIT as Pt, identityPresentationBytes as Pu, handoffPakeFrame as Pv, publicKeyFromZ32 as Pw, CONTACT_LINK_VERSION as Px, verifyEnrollProof as Py, sealGroupTyping as Q, WRITE_FIRST_MS as QC, TURN_VERSION as QS, HANDOFF_HAVE as Q_, CROSSED_WAIT_MS as Qa, yieldThread as Qb, vapidKeysMatch as Qc, isPublicAddress as Qd, EDIT_BUFFER_MS as Qf, offerIsFresh as Qg, DEPARTED_READ_MS as Qh, SPARK_PROVIDER as Qi, PAIRED_PROFILE as Ql, rosterHas as Qm, BIP322_REVISION as Qn, SIGNALS_PER_MINUTE as Qo, pairedReplyAuthor as Qp, DID_METHODS as Qr, TYPING_REFRESH_MS as Qs, GROUP_EDIT_FRAME as Qt, STORAGE_ROOT as Qu, readHandoffHello as Qv, trimEndOf as Qw, createChatInvite as Qx, KNOCK_SLOTS as Qy, checkAppBeforeRun as R, HEDGE_MISSING_MS as RC, turnPutSummary as RS, serviceIdFromName as R_, NO_VIDEO_METADATA as Ra, APP_VIEWS as Rb, readWakePayload as Rc, readManifest as Rd, recordingMime as Rf, MAX_CHUNK_PAYLOAD_BYTES as Rg, GATHER_ATTEMPTS as Rh, SEPOLIA_TEST_USDT as Ri, FILES_BINARY_CAPABILITY as Rl, GROUP_MEMBER_CAP as Rm, SSHSIG_NAMESPACE as Rn, GROUP_VERSION_FILES as Ro, parseReactionFrame as Rp, findInMst as Rr, FILE_DATA_KIND as Rs, GroupWakeLimiter as Rt, identityStatementText as Ru, handoffStreamKey as Rv, encrypt as Rw, DEVICE_INVITE_BYTES as Rx, MAX_WAITING as Ry, buildX401ResultArtifact as S, ANSWER_READ_SPACING_MS as SC, deviceLinkRendezvousSeed as SS, waitForIceGathering as S_, invoiceCallbackUrl as Sa, mergeContactKnocks as Sb, pinNumberHolds as Sc, automaticTransport as Sd, FileTransfers as Sf, GhostlyHttpError as Sg, RATCHET_KEEP_MS as Sh, DidDhtError as Si, APP_VERSION_MAX as Sl, checkStatusCard as Sm, groupMetaNewer as Sn, UNPROVEN_AUTH_MS as So, parseLinkPreview as Sp, ATPROTO_PROOF_COLLECTION as Sr, lobbyRecords as Ss, GROUP_ENTRY_PROFILE as St, IDENTITY_MAX_FRAME as Su, handoffContext as Sv, openRelayPayload as Sw, verifyAppStatementBytes as Sx, ENROLL_PROOF as Sy, encodeX401Header as T, BACKGROUND_WRITES_SHARE as TC, devicePingFrame as TS, RECORD_TTL as T_, parsePayParams as Ta, readLinkRecord as Tb, DEVICE_WAKE_TTL_SECONDS as Tc, irohDescriptor as Td, safeBlobType as Tf, VIEWER_SERVICE_CSP as Tg, emptyRatchetState as Th, didDhtFromPublicKey as Ti, appDataBytes as Tl, sameButtonText as Tm, groupMetaToHand as Tn, pairedEditFits as To, FORWARD_LIMITS as Tp, atprotoProofRecord as Tr, newerHead as Ts, decodeGroupEntryLink as Tt, IDENTITY_PROOF_CAPABILITY as Tu, handoffDigest as Tv, signRelayPayload as Tw, imageSize as Tx, enrollDigits as Ty, checkAppStoreIndex as U, RelayTransport as UC, TURN_LAST_SEQUENCE as US, HANDOFF_ATTEMPTS as U_, PICTURE_METADATA_LIMITS as Ua, checkAppManifest as Ub, PUSH_PAD_BYTES as Uc, DOMAIN_METHODS as Ud, voicePeaksOf as Uf, encodeControl as Ug, STALLED_EVIDENCE_MS as Uh, arkAddressPrefix as Ui, SERVICES_CAPABILITY as Ul, MEMBER_KEY as Um, parseSshSignature as Un, isGroupMessageId as Uo, reactionIsNewer as Up, unsignedCommitBytes as Ur, encodeFileData as Us, GROUP_LIMITS as Ut, signIdentityPresentation as Uu, newHandoffId as Uv, MAX_AVATAR_SIDE as Uw, deviceInviteJoinerParams as Ux, inboxRecord as Uy, APP_STORE_LIMITS as V, RELAY_REQUESTS_PER_MINUTE as VC, TURN_BODY_BYTES as VS, viewerTag as V_, withoutVideoMetadata as Va, assembleAppBundle as Vb, wakePayload as Vc, DOMAIN_FILE_MAX_BYTES as Vd, voiceLevel as Vf, decodeControl as Vg, OFFER_HOST_GATHER_MS as Vh, USDT_PUBLIC_RPC as Vi, PIN_CAPABILITY as Vl, MAX_GROUP_CHAIN as Vm, SshSigError as Vn, fetchesByItself as Vo, reactionEmoji as Vp, parseAtprotoVerificationKey as Vr, FileUplink as Vs, mentionedMembers as Vt, receivedIdentityStatus as Vu, handoffVersions as Vv, tryDecrypt as Vw, createDeviceInvite as Vx, clearMissed as Vy, readAppListing as W, RelaysFailedError as WC, TURN_MAX as WS, HANDOFF_BUSY as W_, isStrippedPicture as Wa, findAppForbiddenKey as Wb, PUSH_SERVICE_HOSTS as Wc, DOMAIN_TXT_MAX_BYTES as Wd, PLAYABLE_VIDEO as Wf, sendBody as Wg, DIRECT_EVIDENCE_MS as Wh, assertTokenUnits as Wi, SESSION_CAPABILITIES_FRAME as Wl, OWN_FRAME_LIMIT as Wm, sameSshKey as Wn, readGroupFileMeta as Wo, readDhtReactions as Wp, verifyAtprotoRecordProof as Wr, refusalText as Ws, GROUP_REACTED_FRAME as Wt, verifyIdentityPresentation as Wu, openHandoffPiece as Wv, jpegSize$1 as Ww, encodeDeviceInvite as Wx, newInbox as Wy, groupTypingEpoch as X, WATCH_SHARE as XC, TURN_SLOTS as XS, HANDOFF_FILE_MISSING as X_, CROSSED_FRESH_MS as Xa, readAppBundleAsync as Xb, pushRequest as Xc, domainWellKnownFile as Xd, EDITED_FRAME as Xf, buildDataSdp as Xg, AWAITING_PEER_MS as Xh, walletNetworkOf as Xi, parseSessionCapabilities as Xl, rememberAlone as Xm, legacyMessageHash as Xn, GROUP_SIGNAL_FRAME as Xo, REPLY_LIMITS as Xp, DID_JWS_MAX_LENGTH as Xr, TYPING_RATE_LIMIT as Xs, groupMessageId as Xt, PeerProofs as Xu, readHandoffFileFrame as Xv, sanitizeNick as Xw, INVITE_VERSION as Xx, CONTACT_RECORD_TTL as Xy, GroupTypingBoard as Y, TURN_SOURCE_TIMEOUT_MS as YC, TURN_SIGNED_BYTES as YS, HANDOFF_DONE as Y_, BLOCKED_DIAL_WAIT_MS as Ya, readAppBundle as Yb, generateVapidKeys as Yc, domainTxtRecord as Yd, parseVideoMeta as Yf, RTC_SIGNAL_MAX_AGE_MS as Yg, symmetricNat as Yh, validatePaymentTarget as Yi, WAKE_SESSION_CAPABILITY as Yl, parseGroupCommit as Ym, isLegacySignature as Yn, CarriedTransport as Yo, REPLY_ID as Yp, DID_JWS_ALGS as Yr, TYPING_KINDS as Ys, frameBytes as Yt, PROOF_CAPABILITY as Yu, readHandoffDone as Yv, sanitizeDisplayText as Yw, INVITE_MAX_LENGTH as Yx, CONTACT_ASKER_FRAME as Yy, openGroupTyping as Z, WAY_BACK_SHARE as ZC, TURN_TTL as ZS, HANDOFF_FILE_REQUEST as Z_, CROSSED_PROBE_MS as Za, sha256Paced as Zb, vapidAuthorization as Zc, encodeDnsQuery as Zd, EDIT_BUFFER_MAX as Zf, extractRtcParams as Zg, DAEMON_WATCH_PEER_IDLE_MS as Zh, SPARK_NETWORKS as Zi, sessionCapabilitiesFrame as Zl, rosterAdmin as Zm, verifyBitcoinMessage as Zn, GROUP_VERSION_SIGNALS as Zo, groupReplyAuthor as Zp, DID_MAX_LENGTH as Zr, TYPING_RATE_WINDOW_MS as Zs, COMMUNITY_EDIT_FRAME as Zt, STORAGE_LIFETIME as Zu, readHandoffHave as Zv, stripHidden as Zw, OwnInviteError as Zx, ContactRequestError as Zy, X401_PROTOCOLS as _, turnSignedMessage as _C, deviceEchoNonce as _S, keepsToRelays as __, pubkyHomeserverOf as _a, knockSlotOf as _b, nextPinNumber as _c, verifyRingAuthorization as _d, peekDhtMailbox as _f, UNUSED_INVITE_WAIT_MAX_MS as _g, FOLLOW_MS as _h, strictBase64Url as _i, APP_PEER_OPEN_MAX as _l, cardEditNumber as _m, MAX_GROUP_PICTURE_LENGTH as _n, RACE_RELAYED_MS as _o, LINK_TRAILING as _p, u32$1 as _r, beaconRecords as _s, shortHash as _t, IDENTITY_CHECK_UNAVAILABLE as _u, handoffAttemptAllowed as _v, PacketTooLargeError as _w, setAppSignatureFastPath as _x, ENROLL_CANCEL as _y, X401_DCQL_LIMITS as a, readTurnPacket as aC, inviteQrSegments as aS, isZ32Key as aT, RTC_CONFIG as a_, PUBKY_PROOF_MAX_BYTES as aa, REQUEST_LIFETIME_MS as ab, parseTypingFrame as ac, proofStatement as ad, txtValue as af, OFFER_FAST_MS as ag, confirmationMatches as ah, didWebDocumentUrl as ai, appRangeChunk as al, CRON_LINE as am, validEditText as an, HANDLED_WAIT_MS as ao, REMOVED_TEXT as ap, BitcoinAddressError as ar, readGroupSignal as as, communityHasFrame as at, CAPS_PUBLISH_SPACING_MS as au, HANDOFF_PIECE_BYTES as av, BREAKER_ALL_DOWN_PROBE_MS as aw, appRevocationId as ax, sealHandoffPiece as ay, buildX401ProofRequest as b, ANSWER_READ_ALLOWANCE as bC, deviceLinkPairing as bS, sdpHasCandidates as b_, fetchLnurlJson as ba, makeStamp as bb, pinFrame as bc, RELAY_WITH_SECRETS as bd, dhtFileId as bf, presenceSeenAt as bg, RATCHET_CAPABILITY as bh, DID_DHT_TTL as bi, APP_RESUME_GRACE_MS as bl, cardTimeUtc as bm, groupMetaBody as bn, RTC_UNSTARTED_MS as bo, linkStop as bp, ATPROTO_DECLARED_SCOPE as br, hubRank as bs, verifyCommunityChainPaced as bt, IDENTITY_FRAME_WINDOW_MS as bu, handoffBusyFrame as bv, measureRecords as bw, verifyAppRevocation as bx, ENROLL_GRANT as by, readX401DcqlQuery as c, signTurnPacket as cC, pastedAgain as cS, toBase64Url as cT, callRtcConfig as c_, isPubkyProofFolder as ca, REQUEST_TEXT_BYTES as cb, typingFrame as cc, storageProofPath as cd, ACTIVE_DHT_POLL_MS as cf, PRESENCE_HEARTBEAT as cg, edgeParams as ch, didWebFileUrl as ci, appRangeErrorFrame as cl, PR_STATES as cm, mentionsBytes as cn, LIVENESS_MISSED_PINGS as co, editFrame as cp, decodeAnyBitcoinAddress as cr, NO_HUB_POLICY as cs, communityUntaggedHash as ct, CapsKeys as cu, HANDOFF_REQUEST as cv, BREAKER_THRESHOLD as cw, isAppHash as cx, SET_UPDATE as cy, newX401HolderKey as d, turnKeys as dC, DEVICE_CAPABILITIES as dS, utf8Encode as dT, contactRtcConfig as d_, pubkyProofCapability as da, STAMP_BITS_MIN as db, GROUP_PIN_FRAME as dc, verifyPeerProof as dd, DHT_MESSAGE_TTL as df, SIGNAL_DUE_READS as dg, newEpochSecret as dh, parseDid as di, encodeAppRangeData as dl, RUN_RESULTS as dm, wireMentions as dn, PAIRED_FRAME_TOO_LARGE as do, parseEditedFrame as dp, decodeWitness as dr, meshRendezvous as ds, encodeCommunityLink as dt, capsDescriptors as du, HANDOFF_VERSION as dv, budgetRetryMs as dw, isAppRef as dx, setAckFrame as dy, encodeTurnFields as eC, decodeInviteCode as eS, bytesEqual as eT, BURST_RING_MS as e_, sparkAddressKind as ea, LINK_RECORD_LABEL as eb, TYPING_STATUS_MAX as ec, importedProof as ed, normalizeDomain as ef, EXPECT_PEER_MS as eg, sortRoster as eh, checkDidJws as ei, APP_RANGE_ERRORS as el, replySnippet as em, carryMentions as en, DEMOTE_MS as eo, EDIT_RATE_WINDOW_MS as ep, bip322MessageHash as er, SIGNAL_FRESH_MS as es, COMMUNITY_PROFILE as et, SESSION_FRAME_MAX as eu, HANDOFF_LATER_BYTES as ev, normalizeRelayUrl as ew, APP_PREFIXES as ex, readHandoffPake as ey, readX401SdJwtVc as f, turnName as fC, DEVICE_ECHO_FRAME as fS, __commonJSMin as fT, decompressSdp as f_, pubkyProofFile as fa, contactAskerFrame as fb, PINNED_FRAME as fc, RING_LIFETIME as fd, DHT_TEXT_BYTES as ff, SIGNAL_OUT_READS as fg, openPair as fh, parseDidDocument as fi, isServeId as fl, STATUS_CARD_LIMITS as fm, GROUP_META_PAST as fn, PAIRING_ATTEMPT_MS as fo, validEditMessage as fp, encodeTx as fr, parseHubPolicy as fs, leaveStands as ft, dialDescriptors as fu, HANDOFF_WINDOW as fv, heldBackError as fw, isAppSignature as fx, setUpdateFrame as fy, X401_LIMITS as g, turnSequence as gC, deviceEchoFrame as gS, __toCommonJS as gT, isGlobalIpv4Host as g_, homeserverWebEndpoint as ga, knockSlotIdentity as gb, mayPin as gc, validRingKey as gd, emptyDhtDeliveryState as gf, UNUSED_INVITE_UPKEEP_MS as gg, sha256Hex as gh, staticDidDocument as gi, APP_FRAME as gl, buttonLabelClash as gm, MAX_GROUP_NAME_LENGTH as gn, RACE_DIRECT_MS as go, LINK_PREVIEW_LIMITS as gp, txHash as gr, beaconKeys as gs, rosterHash as gt, IDENTITY_CHALLENGE_WINDOW as gu, handoffAckFrame as gv, PKARR_FUTURE_SKEW_MS as gw, readAppSignature as gx, DEVICE_KINDS as gy, X401_HEADERS as h, turnReleaseMessage as hC, HANDOFF_CAPABILITY as hS, __require as hT, isCandidateAddress as h_, encodeSvcbPacket as ha, knockHolds as hb, PIN_LIMITS as hc, ringEvidence as hd, LIVE_POLL_MS as hf, UNUSED_INVITE_READS_PER_MINUTE as hg, sealSecret as hh, signingKeys as hi, APP_DATA_MAX_BYTES as hl, appCardUrl as hm, MAX_GROUP_NAME_BYTES as hn, RACE_ANSWERED_MS as ho, LINK_MAX_CHARS as hp, sha256d as hr, COMMUNITY_TOPOLOGY as hs, leftStatement as ht, parsePacketTransports as hu, filePartName as hv, MAX_DNS_PACKET_BYTES as hw, readAppRevocations as hx, verifySetUpdate as hy, x401ApprovalDigest as i, readTurnBody as iC, inviteOwnership as iS, fromZ32 as iT, QUICK_REDIAL_MS as i_, isBitcoinAddress as ia, REQUEST_LABEL as ib, parseTypingActivity as ic, proofHash as id, recordsName as if, MAX_DHT_TEXT_BYTES as ig, GROUP_PROFILE as ih, didSignedMessages as ii, appRangeCancelFrame as il, BUTTON_STYLES as im, parseCommunityEdit as in, GhostLink as io, MAX_REMOVAL_NUMBER as ip, verifyBip322 as ir, groupSignalFrame as is, communityGroupId as it, CAPS_LIMITS as iu, HANDOFF_PAKE as iv, traceLink as iw, appRefPublisher as ix, sameDigest as iy, readX401ProofResult as j, DEPARTED_READS as jC, webCryptoSigner as jS, LEGACY_SERVICES as j_, ENDPOINT as ja, APP_BUNDLE_MAGIC as jb, WAKE_SUBJECT as jc, HOLD_CAPABILITY as jd, VOICE_METER as jf, sanitizeResponseHeaders as jg, ratchetSeal as jh, openDidDhtPayload as ji, parseAppFrame as jl, arrivalKey as jm, parseGroupMetaFrame as jn, EngineError as jo, QUICK_REACTIONS as jp, shortAtprotoDid as jr, shouldBeHub as js, mergeKnocks as jt, IdentityExchange as ju, handoffHelloFrame as jv, createIdentity as jw, canonicalJsonBytes as jx, formatEnrollDigits as jy, readX401ProofResponse as k, CHAT_WATCH_SHARE as kC, verifyDeviceTransports as kS, parseLinkRecords as k_, decodeBolt11 as ka, stampHolds as kb, WAKE_FRAME as kc, relayedTransports as kd, RECORDING_TYPES as kf, resolveTargetUrl as kg, ratchetOpen as kh, encodeDidDhtPacket as ki, isAppVersion as kl, usageLeft as km, openGroupMeta as kn, publishFailure as ko, COMMUNITY_REACTION_FRAME as kp, normalizeAtprotoHandle as kr, readBeaconHead as ks, knockIdentity as kt, IDENTITY_SUBJECT as ku, handoffFileRequestFrame as kv, readDnsName as kw, readImageMeta as kx, enrollMessage as ky, x401VpToken as l, signTurnRelease as lC, readInviteCode as lS, toZ32 as lT, callSignalHeardAt as l_, newPubkyProofFolder as la, STAMP_BITS_DEFAULT as lb, typingKindOf as lc, validExternalKey as ld, DHT_FILE_REFUSED as lf, PRESENCE_WINDOW as lg, encryptText as lh, didWebHost as li, appRangeGetFrame as ll, REMOVABLE_KINDS as lm, mentionsMember as ln, LIVENESS_PING_MS as lo, editedFrame as lp, decodeBitcoinAddress as lr, mayBeHub as ls, decodeCommunityLink as lt, CapsRefusedError as lu, HANDOFF_TIMINGS as lv, RelayBreaker as lw, isAppKey as lx, encodeSetSlots as ly, x401HolderJwk as m, turnPayloadSequence as mC, ENROLL_CAPABILITY as mS, __exportAll as mT, heardCallSignal as m_, decodeSvcbRecords as ma, contactDay as mb, PIN_FRAME as mc, ringClaims as md, DhtDelivery as mf, TRANSPORTS_GONE_MS as mg, sealPair as mh, parseDidSignaturePaste as mi, readAppRangeFrame as ml, appCardId as mm, MAX_GROUP_META_BODY as mn, PONG_WAIT_MS as mo, validRemovalNumber as mp, hash160 as mr, wireHubPolicy as ms, leaveStatement3 as mt, encodePacketTransports as mu, filePartDigest as mv, withRequestOptions as mw, readAppRevocationShape as mx, signTombstone as my, X401_RESPONSE_MODES as n, nextTurnPosition as nC, encodeInviteCode as nS, fromBase64 as nT, CALL_SIGNAL_MAX_AGE_MS as n_, sparkNetworkOf as na, MAX_SLOT_KNOCKS as nb, TypingReceiver as nc, nostrProofTemplate as nd, recordsFromTxt as nf, IDLE_THRESHOLD as ng, verifyCommit as nh, didGhostlyServiceEntry as ni, APP_RANGE_LIMITS as nl, ACTIVE_TASK_STATUSES as nm, communityMessageAuthor as nn, EARLY_DIAL_JOIN_MS as no, EDIT_SEND_LIMIT as np, bip322ToSpend as nr, SIGNAL_PROVEN_MS as ns, GROUP_READ_NOTE_COMMUNITY as nt, CAPS_ISSUED_BACK_MS as nu, HANDOFF_MANIFEST as nv, relayUrlProblem as nw, appFingerprint as nx, readHandoffTurnFrame as ny, matchX401Dcql as o, sealTurnBody as oC, inviteQrText as oS, randomBytes as oT, answersOffer as o_, PUBKY_PROOF_ROOT as oa, REQUEST_NAME_UNITS as ob, sanitizeTypingStatus as oc, storageProof as od, validDomainRecord as of, OFFER_LOOK_MS as og, confirmationTag as oh, didWebFile as oi, appRangeDataFrame as ol, ITEM_STATES as om, MENTION_EVERYONE as on, INVITER_DIAL_GRACE_MS as oo, RateWindow as op, ByteReader as or, GROUP_VERSION_HUBS as os, communityMessageId as ot, CAPS_REFRESH_MS as ou, HANDOFF_PIECE_OVERHEAD as ov, BREAKER_BASE_MS as ow, appSignedBytes as ox, sortParts as oy, sameX401HolderJwk as p, turnPacket as pC, DEVICE_PING_FRAME as pS, __esmMin as pT, extractParamsFromSdp as p_, pubkyProofPath as pa, contactAskerHolds as pb, PIN_CLOCK_SKEW_MS as pc, ringAuthorization as pd, DHT_TEXT_REFUSED as pf, STALLED_LOOK_MS as pg, openSecret as ph, parseDidJws as pi, parseAppRangeFrame as pl, TASK_STATUSES as pm, GROUP_META_PAST_CHARS as pn, PAIRING_RETRY_MS as po, validEditNumber as pp, encodeWitness as pr, pickMeshHubs as ps, leaveStatement as pt, emptyCapsState as pu, NO_ATTEMPTS as pv, isDiscoveryBudgetError as pw, readAppRevocation as px, setUpdateMessage as py, signAppStore as q, SLOW_DEMOTE_MS as qC, TURN_REV_LIMIT as qS, HANDOFF_CANCEL_REASONS as q_, ANSWERS_REFUSED_PAUSES as qa, isAppUrl as qb, decryptPushPayload as qc, decodeDnsResponse as qd, isPlayableVideoType as qf, DATA_CHANNEL_LABEL as qg, DirectPathWatch as qh, isWalletNetwork as qi, TYPING_CAPABILITY as ql, commitUntaggedHash as qm, sshSignCommand as qn, readGroupWantNo as qo, wireReaction as qp, DID_FILE_MAX_BYTES as qr, transferStalled as qs, asWritten as qt, lastSharedWithMe as qu, readHandoffCancel as qv, dropLoneJoiners as qw, INVITE_HRP as qx, takeRequest as qy, readX401OpenId4VpRequest as r, openTurnValue as rC, inviteLink as rS, fromBase64Url as rT, PAIRED_CALL_CANDIDATES as r_, BITCOIN_NETWORKS as ra, REQUEST_CLOCK_SKEW_MS as rb, TypingSender as rc, proofCapability as rd, recordsFromWellKnown as rf, LinkSession as rg, verifyCommitSignature as rh, didJwsAlg as ri, AppRanges as rl, BUTTON_ID as rm, meshMessageRef as rn, FIRST_PAIRING_PACE_MS as ro, MAX_EDITS_PER_MESSAGE as rp, decodeBase64 as rr, SIGNAL_REPLY_MS as rs, communityCommitHash as rt, CAPS_LABEL as ru, HANDOFF_OFFER as rv, setLinkTraceSink as rw, appRef as rx, readHandoffVerified as ry, presentX401SdJwtVc as s, signTurnBody as sC, ownInviteRefusal as sS, toBase64 as sT, buildSdpFromSignal as s_, isPubkyKey as sa, REQUEST_PACKET_BYTES as sb, typingActivity as sc, storageProofBody as sd, wellKnownUrl as sf, OFFER_STEP_MAX as sg, decryptText as sh, didWebFileNames as si, appRangeEndFrame as sl, PR_CHECKS as sm, MENTION_LIMITS as sn, INVITE_TAKEN as so, dhtEditId as sp, compactSize as sr, MESH_HUBS as ss, communityRoster as st, CapsExchange as su, HANDOFF_RELEASE as sv, BREAKER_MAX_MS as sw, checkAppRevokeStatement as sx, SET_ACK as sy, X401_REQUEST_LIMITS as t, firstDeviceSetSecret as tC, encodeGhostlyInvite as tS, concatBytes as tT, CALL_SIGNAL_FUTURE_MS as t_, sparkInvoiceDetails as ta, MAX_SEEN as tb, TYPING_TIMEOUT_MS as tc, isProofAdapter as td, parseDomainTxt as tf, FIRST_PUBLISH_MAX_MS as tg, verifyChain as th, checkDidSignature as ti, APP_RANGE_FRAMES as tl, wireReply as tm, communityEditFrame as tn, DHT_PIN_GRACE_MS as to, EDIT_RECEIVE_LIMIT as tp, bip322ToSign as tr, SIGNAL_HOLD_MS as ts, CommunitySession as tt, SESSION_RECEIVE_PENDING as tu, HANDOFF_LIST_PER_FRAME as tv, readRelayBody as tw, APP_STATEMENT_LIMITS as tx, readHandoffRelease as ty, X401_CREDENTIAL_LIMITS as u, turnInstance as uC, DEVICES_CAPABILITY as uS, utf8Decode as uT, compressSdp as u_, normalizePubkyKey as ua, STAMP_BITS_MAX as ub, COMMUNITY_PIN_FRAME as uc, verifyNostrProof as ud, DHT_FILE_TOO_LARGE as uf, RELAY_POLL_INTERVALS as ug, epochKeys as uh, normalizeDid as ui, decodeAppRangeData as ul, ROUTINE_STATES as um, validMentions as un, MAX_PAIRED_MESSAGE_FRAME as uo, parseEditFrame as up, decodeTx as ur, meshHubs as us, derivedSecret as ut, DHT_TEXT_CAPABILITY as uu, HANDOFF_VERIFIED as uv, DiscoveryBudgetError as uw, isAppLine as ux, readSetUpdate as uy, X401_SCHEME as v, turnStatedVerifier as vC, deviceFrameCapability as vS, parseCallSignal as v_, LIGHTNING_DESTINATION_PATTERN as va, knockSlotRecords as vb, parsePinFrame as vc, verifyRingEvidence as vd, DHT_FILE_CAPABILITY as vf, WATCH_PEER_MS as vg, MAX_SKIP as vh, DID_DHT_MAX_PAYLOAD as vi, APP_RATE_LIMIT as vl, cardLine as vm, encodeGroupMetaBody as vn, REDESCRIBED_GRACE_MS as vo, canonicalUrl as vp, u64 as vr, doorHubs as vs, signCommunity as vt, IDENTITY_CLOCK_SKEW as vu, handoffAttemptFailed as vv, RELAY_PAYLOAD_MAX_BYTES as vw, signAppObject as vx, ENROLL_CANCEL_REASONS as vy, decodeX401Header as w, BACKGROUND_WHILE_SIGNALING as wC, deviceLinkSecret as wS, MAX_MSGS_PAYLOAD_B64 as w_, parseLightningDestination as wa, readKnockSlot as wb, readPin as wc, dialableIrohRelay as wd, formatFileSize as wf, HttpHost as wg, RatchetBox as wh, didDhtDocument as wi, appCloseFrame as wl, removedCardText as wm, groupMetaTag as wn, WAKE_LOST_MS as wo, sanitizePreviewImage as wp, atprotoDidMethod as wr, mergeLobby as ws, MAX_KNOCKS as wt, IDENTITY_MAX_VALIDITY as wu, handoffDataFrame as wv, readOwnRelayPayload as ww, exifOrientation as wx, enrollCancelReason as wy, buildX401ProofResult as x, ANSWER_READ_FIRST_MS as xC, deviceLinkParams as xS, signalHasVideo as x_, findLightningDestination as xa, makeStampPaced as xb, pinIsNewer as xc, TRANSPORTS as xd, readDhtFile as xf, unusedInviteWait as xg, RATCHET_HEADER_BYTES as xh, DID_DHT_VERSION as xi, APP_SEND_LIMIT as xl, cardUrl as xm, groupMetaChange as xn, SWITCH_RETIRE_MS as xo, linksIn as xp, ATPROTO_FULL_SCOPE as xr, lobbyKeys as xs, verifyCommunityCommit as xt, IDENTITY_MAX_EVIDENCE as xu, handoffCancelFrame as xv, newerPacket as xw, verifyAppSignature as xx, ENROLL_HELLO as xy, X401_VERSION as y, turnVerifierMark as yC, deviceKeyZ32 as yS, pickCallCandidates as y_, LNURL_LIMITS as ya, linkRecords as yb, parsePinnedFrame as yc, RELAY_URL as yd, dhtFileElements as yf, countUnusedInvite as yg, MAX_SKIPPED_KEYS as yh, DID_DHT_PREFIX as yi, APP_RATE_WINDOW_MS as yl, cardLinkHost as ym, groupDisplayName as yn, RESUME_WAIT_MS as yo, linkEnd as yp, varBytes as yr, freshHubs as ys, verifyCommunityChain as yt, IDENTITY_FRAME_LIMIT as yu, handoffAttemptSucceeded as yv, createRelayPayload as yw, signAppRevocation as yx, ENROLL_DONE as yy, planAppUpdate as z, HEDGE_MS as zC, TOMBSTONE_SEQUENCE as zS, servicesFromWire as z_, VIDEO_METADATA_LIMITS as za, appDigest as zb, relayRequest as zc, DNS_LABEL as zd, voiceDownloadName as zf, PROTOCOL_VERSION as zg, GATHER_STALL_MS as zh, SEPOLIA_TEST_USDT_FAUCET as zi, FILES_CAPABILITY as zl, GROUP_VERSION_LARGE as zm, SSH_KEY_TYPES as zn, GROUP_WANT_FRAME as zo, queueReaction as zp, parseAtprotoCar as zr, FILE_FRAMES as zs, groupWakeFrame as zt, isIdentityBinding as zu, handoffVerifiedFrame as zv, generateEncryptionKey as zw, DEVICE_INVITE_LIFETIME_S as zx, NEW_PER_HOUR as zy };
40831
+ export { COMMUNITY_LIMITS as $, TURN_SOURCE_TIMEOUT_MS as $C, TURN_SLOTS as $S, HANDOFF_FILE_MISSING as $_, DEMOTE_AFTER_FAILURES as $a, readAppBundleAsync as $b, APP_RANGE_DATA_KIND as $c, domainWellKnownFile as $d, EDITED_FRAME as $f, buildDataSdp as $g, AWAITING_PEER_MS as $h, isSparkAddress as $i, PairedSession as $l, rememberAlone as $m, MessageRefusal as $n, SIGNAL_CARRIERS as $o, REPLY_LIMITS as $p, DidError as $r, TYPING_SEND_LIMIT as $s, GROUP_EDIT_TEXT_BYTES as $t, PeerProofs as $u, readHandoffFileFrame as $v, dropLoneJoiners as $w, INVITE_VERSION as $x, CONTACT_RECORD_TTL as $y, readX401ProofResponseHeader as A, CHAT_RESERVE as AC, signDeviceTransports as AS, emptyLinkRecords as A_, findBolt11 as Aa, requestRecords as Ab, WAKE_INTERVAL_MS as Ac, rankTransports as Ad, sanitizeMime as Af, parseLocalTarget as Ag, ratchetHeard as Ah, jwkThumbprint as Ai, isChatAppId as Al, statusCardText as Am, parseGroupMetaBody as An, ENGINE_ERRORS as Ao, forwardedMany as Ap, parseAtprotoDidDocument as Ar, readLobby as As, knockRecords as At, IDENTITY_STATEMENT_PREFIX as Au, handoffEphemeral as Av, readOwnRelayPayload as Aw, parseImageMeta as Ax, enrollGrantFrame as Ay, APP_STORE_KINDS as B, GROUP_RATION_WINDOW_MS as BC, keptAtEqualSequence as BS, isViewerTag as B_, videoMetadataPatches as Ba, APP_SCREENSHOTS_DIR as Bb, wakeFrame as Bc, newMailbox as Bd, parseVoiceMeta as Bf, LIMITS as Bg, DataLink as Bh, TEST_USDT_FAUCET_AMOUNT as Bi, KNOWN_SESSION_CAPABILITIES as Bl, GROUP_ID as Bm, SSH_PUBLIC_KEY_MAX as Bn, GROUP_WANT_NO_FRAME as Bo, parseReactedFrame as Bp, parseAtprotoDidKey as Br, FILE_LIMITS as Bs, groupWakes as Bt, identityStatement as Bu, handoffRetryAfter as Bv, publicKeyFromZ32 as Bw, readContactLink as Bx, MAX_MISSED as By, buildX401TokenObject as C, ANSWER_READ_ALLOWANCE as CC, deviceLinkPairing as CS, sdpHasCandidates as C_, parseInvoiceCallback as Ca, makeStamp as Cb, pinnedFrame as Cc, RELAY_WITH_SECRETS as Cd, dhtFileId as Cf, presenceSeenAt as Cg, RATCHET_CAPABILITY as Ch, decodeDidDhtPacket as Ci, AppSessions as Cl, cardTimeUtc as Cm, groupMetaPicture as Cn, WAKE_ANSWER_GRACE_MS as Co, linkStop as Cp, ATPROTO_PROOF_SCOPE as Cr, mergeBeacon as Cs, KNOCK_TTL_MS as Ct, IDENTITY_MAX_FRAME as Cu, handoffBusyFrame as Cv, PacketTooLargeError as Cw, verifyAppRevocation as Cx, ENROLL_GRANT as Cy, readX401ProofRequest as D, BACKGROUND_REQUESTS_PER_MINUTE as DC, deviceLinkSecret as DS, MAX_MSGS_PAYLOAD_B64 as D_, resolveLightningDestination as Da, readKnockSlot as Db, WAKE_CALL_TTL_SECONDS as Dc, dialableIrohRelay as Dd, formatFileSize as Df, HttpHost as Dg, RatchetBox as Dh, didDhtRecords as Di, appOpenFrame as Dl, removedCardText as Dm, keepPastGroupMeta as Dn, pairedMessageFrame as Do, sanitizePreviewImage as Dp, checkAtprotoProofRecord as Dr, rankHubs as Ds, entryParams as Dt, IDENTITY_PROVIDER_ID as Du, handoffDataFrame as Dv, newerPacket as Dw, exifOrientation as Dx, enrollCancelReason as Dy, isX401Protocol as E, AWAITED_READS as EC, deviceLinkSealKey as ES, LABEL$1 as E_, requestLnurlInvoice as Ea, openRequest as Eb, WAKE_CALL_INTERVAL_MS as Ec, checkedDescriptors as Ed, PREVIEWABLE_IMAGE as Ef, HttpClient as Eg, RATCHET_OVERHEAD as Eh, didDhtKey as Ei, appDataFrame as El, readStatusCard as Em, groupName as En, pairedMessageFits as Eo, previewImageSize as Ep, atprotoProofRkey as Er, pickHubs as Es, encodeGroupEntryLink as Et, IDENTITY_PROOF_CAPABILITY as Eu, handoffContextProof as Ev, measureRecords as Ew, IMAGE_LIMITS as Ex, enrollCancelFrame as Ey, appRevocationFor as F, DEPARTED_READS as FC, TURN_PUT_WINDOW_MS as FS, MAX_SERVICES as F_, isFederationId as Fa, APP_CLIENTS as Fb, newWakeToken as Fc, HOLD_DATED_BACK_MS as Fd, baseMime as Ff, viewerResponseHeaders as Fg, ratchetSessionOf as Fh, EVM_TEST_CHAINS as Fi, BUTTONS_CAPABILITY as Fl, claimedTime as Fm, verifyGroupMetaSignature as Fn, PairingTracker as Fo, REACTED_FRAME as Fp, decodeAtprotoCommit as Fr, PairedCalls as Fs, GROUP_WAKE_GROUP_WINDOW_MS as Ft, boundVerifiedIdentity as Fu, handoffManifestFrames as Fv, readDnsName as Fw, readCanonicalJson as Fx, readEnrollGrant as Fy, readAppStore as G, RELAY_REQUESTS_PER_MINUTE as GC, TURN_LABEL as GS, HANDOFF_ACK as G_, stripPictureMetadata as Ga, buildAppBundle as Gb, WebPushError as Gc, DOMAIN_MAX_RECORDS as Gd, voiceLevelsOf as Gf, encodeChunk as Gg, REANSWERS as Gh, assertWholeSats as Gi, STATUS_CARD_CAPABILITY as Gl, MAX_GROUP_MEMBERS as Gm, sshFingerprint as Gn, readGroupHave as Go, reactionFrame as Gp, verifyAtprotoSignature as Gr, sentWhole as Gs, GROUP_READ_NOTE as Gt, revokesIdentity as Gu, isHandoffPartName as Gv, generateEncryptionKey as Gw, deviceInviteJoinerKeyZ32 as Gx, endedRequests as Gy, checkAppListing as H, HEDGE_MISSING_MS as HC, TOMBSTONE_SEQUENCE as HS, servicesFromWire as H_, NO_PICTURE_METADATA as Ha, appDigest as Hb, wakeRequest as Hc, DNS_LABEL as Hd, voiceDownloadName as Hf, PROTOCOL_VERSION as Hg, GATHER_STALL_MS as Hh, WALLET_NETWORKS as Hi, REACTIONS_CAPABILITY as Hl, GROUP_VERSION_LARGE as Hm, parseSshPublicKey as Hn, groupFileFallback as Ho, queueReaction as Hp, readAtprotoCid as Hr, decodeFileData as Hs, parseGroupWakeFrame as Ht, isIdentityBinding as Hu, handoffVerifiedFrame as Hv, verify as Hw, DEVICE_INVITE_LIFETIME_S as Hx, NEW_PER_HOUR as Hy, appStoreDecision as I, FRESH_READ_MS as IC, TURN_RAISE_READ_TIMEOUT_MS as IS, SERVICES_VERSION as I_, parseCashuRequestPayload as Ia, APP_CLIENT_NAME as Ib, parseWakeFrame as Ic, HOLD_LIMITS as Id, downsamplePeaks as If, webLocalFetch as Ig, ratchetUnknownSession as Ih, ONCHAIN_PROVIDER as Ii, CALLS_CAPABILITY as Il, heardTime as Im, wrapGroupMeta as In, GROUP_FILE_LIMITS as Io, REACTION_FRAME as Ip, decodeDagCbor as Ir, parsePairedCallFrame as Is, GROUP_WAKE_MEMBER_INTERVAL_MS as It, emptyIdentityLedger as Iu, handoffOfferFrame as Iv, IDENTITY_MEMO_SIZE as Iw, CONTACT_LINK_BYTES as Ix, readEnrollHello as Iy, GROUP_TYPING_FRAME as J, RelaysFailedError as JC, TURN_NAME_BYTES as JS, HANDOFF_BUSY_REASONS as J_, ANSWERS_REFUSED_PAUSE_MS as Ja, isAppLicense as Jb, encryptPushPayload as Jc, NIP05_PATH as Jd, VIDEO_LIMITS as Jf, wrapDataChannel as Jg, DIRECT_OWN_ATTEMPTS as Jh, parsePaymentAmount as Ji, UPGRADE_CAPABILITY as Jl, SAID_AGAIN as Jm, verifySshSignature as Jn, CARRIED_DEFER_MS as Jo, readReaction as Jp, DID_GHOSTLY_SERVICE as Jr, TYPING_FRAME as Js, chainPieces as Jt, IDENTITY_TIMELINE_MAX as Ju, readHandoffAck as Jv, MAX_AVATAR_LENGTH as Jw, readDeviceInvite as Jx, planKnocks as Jy, readAppStoreSteps as K, REQUESTS_PER_MINUTE as KC, TURN_LAST_SEQUENCE as KS, HANDOFF_ATTEMPTS as K_, withoutPictureMetadata as Ka, checkAppManifest as Kb, checkPushEndpoint as Kc, DOMAIN_METHODS as Kd, voicePeaksOf as Kf, encodeControl as Kg, STALLED_EVIDENCE_MS as Kh, formatPaymentAmount as Ki, SessionCapabilities as Kl, MEMBER_KEY as Km, sshKeyDigestHex as Kn, readGroupWant as Ko, reactionIsNewer as Kp, DID_DOCUMENT_MAX_BYTES as Kr, transferEnded as Ks, GroupSession as Kt, signIdentityPresentation as Ku, newHandoffId as Kv, sealedLength as Kw, deviceInviteJoinerParams as Kx, inboxRecord as Ky, appUpdateDecision as L, GROUP_BURST_MS as LC, TURN_SETTLE_MS as LS, decodeServices as L_, parseFedimintRequestPayload as La, APP_FORBIDDEN_KEYS as Lb, readWake as Lc, HoldKeys as Ld, fileMessageText as Lf, withViewerPolicy as Lg, ANSWER_REFUSED_REDIALS as Lh, PaymentPreflightError as Li, EDIT_CAPABILITY as Ll, receivedTimestamp as Lm, SSHSIG_MAX_ARMOR as Ln, GROUP_HAVE_FRAME as Lo, REACTION_LIMITS as Lp, encodeDagCbor as Lr, ChatFiles as Ls, GROUP_WAKE_RECEIVE_LIMIT as Lt, identityPresentationBytes as Lu, handoffPakeFrame as Lv, createIdentity as Lw, CONTACT_LINK_VERSION as Lx, verifyEnrollProof as Ly, readX401ProofResultHeader as M, CHAT_RESERVE_PER_CHAT as MC, verifyDeviceTransports as MS, parseLinkRecords as M_, cashuRequestPayload as Ma, stampHolds as Mb, WAKE_TTL_SECONDS as Mc, relayedTransports as Md, RECORDING_TYPES as Mf, resolveTargetUrl as Mg, ratchetOpen as Mh, resolveDidDht as Mi, readAppFrame as Ml, usageLeft as Mm, parseGroupMetaStatement as Mn, engineError as Mo, COMMUNITY_REACTION_FRAME as Mp, AtprotoCid as Mr, validHead as Ms, readKnocks as Mt, IdentityCheckUnavailable as Mu, handoffFileRequestFrame as Mv, decodeDnsAnswers as Mw, readImageMeta as Mx, enrollMessage as My, x401AnswerableRequests as N, CHAT_WATCH_SHARE as NC, seedSigner as NS, HTTP_SERVICE_PROTO as N_, fedimintRequestPayload as Na, APP_BUNDLE_LIMITS as Nb, WakeLimiter as Nc, transportOrder as Nd, VOICE_LIMITS as Nf, sanitizeRequestHeaders as Ng, ratchetRoot as Nh, signDidDhtPacket as Ni, APPS_CAPABILITY as Nl, MESSAGE_CLOCK_SKEW_MS as Nm, parseGroupMetaTag as Nn, engineText as No, GROUP_REACTION_FRAME as Np, AtprotoProofError as Nr, MAX_PAIRED_CALL_SIGNAL as Ns, GROUP_WAKE_FRAME as Nt, IdentityExchange as Nu, handoffHaveFrames as Nv, decodeTxtPacket as Nw, canonicalJson as Nx, enrollProofFrame as Ny, readX401ProofRequestHeader as O, BACKGROUND_WHILE_SIGNALING as OC, devicePingFrame as OS, RECORD_TTL as O_, BOLT11_PATTERN as Oa, readLinkRecord as Ob, WAKE_CALL_WAIT_MS as Oc, irohDescriptor as Od, safeBlobType as Of, VIEWER_SERVICE_CSP as Og, emptyRatchetState as Oh, encodeDidDhtDeactivated as Oi, chatAppId as Ol, sameButtonText as Om, nextGroupMetaRevision as On, parsePaymentNetworks as Oo, FORWARD_LIMITS as Op, isAtprotoDid as Or, readBeacon as Os, groupEntryUrl as Ot, IDENTITY_REUSE_CHECK_S as Ou, handoffDigest as Ov, openRelayPayload as Ow, imageSize as Ox, enrollDigits as Oy, addedAppPermissions as P, DEFAULT_RELAYS as PC, webCryptoSigner as PS, LEGACY_SERVICES as P_, findEndpoint as Pa, APP_BUNDLE_MAGIC as Pb, deviceWakeRequest as Pc, HOLD_CAPABILITY as Pd, VOICE_METER as Pf, sanitizeResponseHeaders as Pg, ratchetSeal as Ph, ETHEREUM_USDT as Pi, APP_RANGES_CAPABILITY as Pl, arrivalKey as Pm, signGroupMeta as Pn, parseEngineError as Po, QUICK_REACTIONS as Pp, atprotoCidFor as Pr, PAIRED_CALL_FRAME as Ps, GROUP_WAKE_GROUP_LIMIT as Pt, boundIdentityDisplay as Pu, handoffHelloFrame as Pv, encodeTxtPacket as Pw, canonicalJsonBytes as Px, formatEnrollDigits as Py, sealGroupTyping as Q, SLOW_MS as QC, TURN_SIGNED_BYTES as QS, HANDOFF_DONE as Q_, CROSSED_WAIT_MS as Qa, readAppBundle as Qb, vapidKeysMatch as Qc, domainTxtRecord as Qd, parseVideoMeta as Qf, RTC_SIGNAL_MAX_AGE_MS as Qg, symmetricNat as Qh, SPARK_PROVIDER as Qi, PAIRED_PROFILE as Ql, parseGroupCommit as Qm, BIP322_REVISION as Qn, SIGNALS_PER_MINUTE as Qo, REPLY_ID as Qp, DID_METHODS as Qr, TYPING_REFRESH_MS as Qs, GROUP_EDIT_FRAME as Qt, PROOF_CAPABILITY as Qu, readHandoffDone as Qv, MAX_NICK_LENGTH as Qw, INVITE_MAX_LENGTH as Qx, CONTACT_ASKER_FRAME as Qy, checkAppBeforeRun as R, GROUP_BURST_ONE_LINK as RC, TURN_VISIBLE_MS as RS, encodeServices as R_, NO_VIDEO_METADATA as Ra, APP_ICON_PATH as Rb, readWakePayload as Rc, HoldRefusedError as Rd, formatVoiceDuration as Rf, CHUNK_FLAG_END as Rg, CONNECT_TIMEOUT_MS as Rh, SEPOLIA_TEST_USDT as Ri, FILES_BINARY_CAPABILITY as Rl, shownTime as Rm, SSHSIG_NAMESPACE as Rn, GROUP_VERSION_FILES as Ro, ReactionWindow as Rp, findInMst as Rr, FILE_DATA_KIND as Rs, GroupWakeLimiter as Rt, identityRefusal as Ru, handoffReleaseFrame as Rv, identityFromSeed as Rw, createContactLink as Rx, FLOOD_PER_DAY as Ry, buildX401ResultArtifact as S, turnVerifierMark as SC, deviceKeyZ32 as SS, __toCommonJS as ST, pickCallCandidates as S_, invoiceCallbackUrl as Sa, linkRecords as Sb, pinNumberHolds as Sc, RELAY_URL as Sd, dhtFileElements as Sf, countUnusedInvite as Sg, MAX_SKIPPED_KEYS as Sh, DidDhtError as Si, APP_VERSION_MAX as Sl, cardLinkHost as Sm, groupMetaNewer as Sn, UNPROVEN_AUTH_MS as So, linkEnd as Sp, ATPROTO_PROOF_COLLECTION as Sr, lobbyRecords as Ss, GROUP_ENTRY_PROFILE as St, IDENTITY_MAX_EVIDENCE as Su, handoffAttemptSucceeded as Sv, PKARR_FUTURE_SKEW_MS as Sw, signAppRevocation as Sx, ENROLL_DONE as Sy, encodeX401Header as T, ANSWER_READ_SPACING_MS as TC, deviceLinkRendezvousSeed as TS, waitForIceGathering as T_, parsePayParams as Ta, mergeContactKnocks as Tb, DEVICE_WAKE_TTL_SECONDS as Tc, automaticTransport as Td, FileTransfers as Tf, GhostlyHttpError as Tg, RATCHET_KEEP_MS as Th, didDhtFromPublicKey as Ti, appDataBytes as Tl, checkStatusCard as Tm, groupMetaToHand as Tn, pairedEditFits as To, parseLinkPreview as Tp, atprotoProofRecord as Tr, newerHead as Ts, decodeGroupEntryLink as Tt, IDENTITY_MAX_VALIDITY as Tu, handoffContext as Tv, createRelayPayload as Tw, verifyAppStatementBytes as Tx, ENROLL_PROOF as Ty, checkAppStoreIndex as U, HEDGE_MS as UC, TOMBSTONE_TURN as US, servicesToWire as U_, PICTURE_METADATA_LIMITS as Ua, appViewOf as Ub, PUSH_PAD_BYTES as Uc, DNS_TYPE as Ud, voiceFileName as Uf, decodeChunk as Ug, LATE_ANSWER_MS as Uh, arkAddressPrefix as Ui, SERVICES_CAPABILITY as Ul, LEGACY_GROUP_MEMBERS as Um, parseSshSignature as Un, isGroupMessageId as Uo, reactedFrame as Up, unsignedCommitBytes as Ur, encodeFileData as Us, GROUP_LIMITS as Ut, newIdentityBinding as Uu, handoffVerifiedMessage as Uv, decrypt as Uw, DEVICE_INVITE_OWN_DEVICE as Ux, REOPEN_BELOW as Uy, APP_STORE_LIMITS as V, GROUP_SIGNALING_ALLOWANCE_SHARE as VC, turnPutSummary as VS, serviceIdFromName as V_, withoutVideoMetadata as Va, APP_VIEWS as Vb, wakePayload as Vc, readManifest as Vd, recordingMime as Vf, MAX_CHUNK_PAYLOAD_BYTES as Vg, GATHER_ATTEMPTS as Vh, USDT_PUBLIC_RPC as Vi, PIN_CAPABILITY as Vl, GROUP_MEMBER_CAP as Vm, SshSigError as Vn, fetchesByItself as Vo, parseReactionFrame as Vp, parseAtprotoVerificationKey as Vr, FileUplink as Vs, mentionedMembers as Vt, identityStatementText as Vu, handoffStreamKey as Vv, sign as Vw, DEVICE_INVITE_BYTES as Vx, MAX_WAITING as Vy, readAppListing as W, PREVIOUS_DEFAULT_RELAYS as WC, TURN_BODY_BYTES as WS, viewerTag as W_, isStrippedPicture as Wa, assembleAppBundle as Wb, PUSH_SERVICE_HOSTS as Wc, DOMAIN_FILE_MAX_BYTES as Wd, voiceLevel as Wf, decodeControl as Wg, OFFER_HOST_GATHER_MS as Wh, assertTokenUnits as Wi, SESSION_CAPABILITIES_FRAME as Wl, MAX_GROUP_CHAIN as Wm, sameSshKey as Wn, readGroupFileMeta as Wo, reactionEmoji as Wp, verifyAtprotoRecordProof as Wr, refusalText as Ws, GROUP_REACTED_FRAME as Wt, receivedIdentityStatus as Wu, handoffVersions as Wv, encrypt as Ww, createDeviceInvite as Wx, clearMissed as Wy, groupTypingEpoch as X, SIGNALING_WINDOW_MS as XC, TURN_REV_LIMIT as XS, HANDOFF_CANCEL_REASONS as X_, CROSSED_FRESH_MS as Xa, isAppUrl as Xb, pushRequest as Xc, decodeDnsResponse as Xd, isPlayableVideoType as Xf, DATA_CHANNEL_LABEL as Xg, DirectPathWatch as Xh, walletNetworkOf as Xi, parseSessionCapabilities as Xl, commitUntaggedHash as Xm, legacyMessageHash as Xn, GROUP_SIGNAL_FRAME as Xo, wireReaction as Xp, DID_JWS_MAX_LENGTH as Xr, TYPING_RATE_LIMIT as Xs, groupMessageId as Xt, lastSharedWithMe as Xu, readHandoffCancel as Xv, jpegSize$1 as Xw, INVITE_HRP as Xx, takeRequest as Xy, GroupTypingBoard as Y, SIGNALING_ALLOWANCE_SHARE as YC, TURN_NO_ACTIVE as YS, HANDOFF_CANCEL as Y_, BLOCKED_DIAL_WAIT_MS as Ya, isAppPath as Yb, generateVapidKeys as Yc, WELL_KNOWN_PATH as Yd, formatVideoDuration as Yf, DATA_CHANNEL_ID as Yg, DIRECT_PEERS as Yh, validatePaymentTarget as Yi, WAKE_SESSION_CAPABILITY as Yl, commitHash as Ym, isLegacySignature as Yn, CarriedTransport as Yo, validReactionNumber as Yp, DID_JWS_ALGS as Yr, TYPING_KINDS as Ys, frameBytes as Yt, applyIdentityEvent as Yu, readHandoffBusy as Yv, MAX_AVATAR_SIDE as Yw, DEVICE_INVITE_VERSION as Yx, settleRequest as Yy, openGroupTyping as Z, SLOW_DEMOTE_MS as ZC, TURN_SEALED_BYTES as ZS, HANDOFF_DATA as Z_, CROSSED_PROBE_MS as Za, pacer as Zb, vapidAuthorization as Zc, dnsProofName as Zd, isVideoMime as Zf, RTC_SIGNAL_FUTURE_MS as Zg, directBlocked as Zh, SPARK_NETWORKS as Zi, sessionCapabilitiesFrame as Zl, expectedRoster as Zm, verifyBitcoinMessage as Zn, GROUP_VERSION_SIGNALS as Zo, PAIRED_REPLY_AUTHORS as Zp, DID_MAX_LENGTH as Zr, TYPING_RATE_WINDOW_MS as Zs, COMMUNITY_EDIT_FRAME as Zt, PROOF_ADAPTERS as Zu, readHandoffData as Zv, sanitizeAvatar as Zw, INVITE_LINK_ORIGIN as Zx, turnOff as Zy, X401_PROTOCOLS as _, turnPayloadSequence as _C, ENROLL_CAPABILITY as _S, utf8Encode as _T, heardCallSignal as __, pubkyHomeserverOf as _a, contactDay as _b, nextPinNumber as _c, ringClaims as _d, DhtDelivery as _f, TRANSPORTS_GONE_MS as _g, sealPair as _h, strictBase64Url as _i, APP_PEER_OPEN_MAX as _l, appCardId as _m, MAX_GROUP_PICTURE_LENGTH as _n, RACE_RELAYED_MS as _o, validRemovalNumber as _p, u32$1 as _r, beaconRecords as _s, shortHash as _t, IDENTITY_CHECK_UNAVAILABLE as _u, filePartDigest as _v, heldBackError as _w, readAppRevocationShape as _x, signTombstone as _y, X401_DCQL_LIMITS as a, nextTurnPosition as aC, encodeInviteCode as aS, unwrapPasted as aT, CALL_SIGNAL_MAX_AGE_MS as a_, PUBKY_PROOF_MAX_BYTES as aa, MAX_SLOT_KNOCKS as ab, parseTypingFrame as ac, nostrProofTemplate as ad, recordsFromTxt as af, IDLE_THRESHOLD as ag, verifyCommit as ah, didWebDocumentUrl as ai, appRangeChunk as al, ACTIVE_TASK_STATUSES as am, validEditText as an, HANDLED_WAIT_MS as ao, EDIT_SEND_LIMIT as ap, BitcoinAddressError as ar, readGroupSignal as as, communityHasFrame as at, CAPS_PUBLISH_SPACING_MS as au, HANDOFF_MANIFEST as av, readRelayBody as aw, appFingerprint as ax, readHandoffTurnFrame as ay, buildX401ProofRequest as b, turnSignedMessage as bC, deviceEchoNonce as bS, __exportAll as bT, keepsToRelays as b_, fetchLnurlJson as ba, knockSlotOf as bb, pinFrame as bc, verifyRingAuthorization as bd, peekDhtMailbox as bf, UNUSED_INVITE_WAIT_MAX_MS as bg, FOLLOW_MS as bh, DID_DHT_TTL as bi, APP_RESUME_GRACE_MS as bl, cardEditNumber as bm, groupMetaBody as bn, RTC_UNSTARTED_MS as bo, LINK_TRAILING as bp, ATPROTO_DECLARED_SCOPE as br, hubRank as bs, verifyCommunityChainPaced as bt, IDENTITY_FRAME_WINDOW_MS as bu, handoffAttemptAllowed as bv, withRequestOptions as bw, setAppSignatureFastPath as bx, ENROLL_CANCEL as by, readX401DcqlQuery as c, readTurnPacket as cC, inviteQrSegments as cS, fromBase64 as cT, RTC_CONFIG as c_, isPubkyProofFolder as ca, REQUEST_LIFETIME_MS as cb, typingFrame as cc, proofStatement as cd, txtValue as cf, OFFER_FAST_MS as cg, confirmationMatches as ch, didWebFileUrl as ci, appRangeErrorFrame as cl, CRON_LINE as cm, mentionsBytes as cn, LIVENESS_MISSED_PINGS as co, REMOVED_TEXT as cp, decodeAnyBitcoinAddress as cr, NO_HUB_POLICY as cs, communityUntaggedHash as ct, CapsKeys as cu, HANDOFF_PIECE_BYTES as cv, traceLink as cw, appRevocationId as cx, sealHandoffPiece as cy, newX401HolderKey as d, signTurnPacket as dC, pastedAgain as dS, isZ32Key as dT, callRtcConfig as d_, pubkyProofCapability as da, REQUEST_TEXT_BYTES as db, GROUP_PIN_FRAME as dc, storageProofPath as dd, ACTIVE_DHT_POLL_MS as df, PRESENCE_HEARTBEAT as dg, edgeParams as dh, parseDid as di, encodeAppRangeData as dl, PR_STATES as dm, wireMentions as dn, PAIRED_FRAME_TOO_LARGE as do, editFrame as dp, decodeWitness as dr, meshRendezvous as ds, encodeCommunityLink as dt, capsDescriptors as du, HANDOFF_REQUEST as dv, BREAKER_MAX_MS as dw, isAppHash as dx, SET_UPDATE as dy, TURN_TTL as eC, OwnInviteError as eS, hasVisible as eT, extractRtcParams as e_, sparkAddressKind as ea, ContactRequestError as eb, TYPING_STATUS_MAX as ec, STORAGE_LIFETIME as ed, encodeDnsQuery as ef, DAEMON_WATCH_PEER_IDLE_MS as eg, rosterAdmin as eh, checkDidJws as ei, APP_RANGE_ERRORS as el, groupReplyAuthor as em, carryMentions as en, DEMOTE_MS as eo, EDIT_BUFFER_MAX as ep, bip322MessageHash as er, SIGNAL_FRESH_MS as es, COMMUNITY_PROFILE as et, SESSION_FRAME_MAX as eu, HANDOFF_FILE_REQUEST as ev, WATCH_SHARE as ew, sha256Paced as ex, readHandoffHave as ey, readX401SdJwtVc as f, signTurnRelease as fC, readInviteCode as fS, randomBytes as fT, callSignalHeardAt as f_, pubkyProofFile as fa, STAMP_BITS_DEFAULT as fb, PINNED_FRAME as fc, validExternalKey as fd, DHT_FILE_REFUSED as ff, PRESENCE_WINDOW as fg, encryptText as fh, parseDidDocument as fi, isServeId as fl, REMOVABLE_KINDS as fm, GROUP_META_PAST as fn, PAIRING_ATTEMPT_MS as fo, editedFrame as fp, encodeTx as fr, parseHubPolicy as fs, leaveStands as ft, dialDescriptors as fu, HANDOFF_TIMINGS as fv, BREAKER_THRESHOLD as fw, isAppKey as fx, encodeSetSlots as fy, X401_LIMITS as g, turnPacket as gC, DEVICE_PING_FRAME as gS, utf8Decode as gT, extractParamsFromSdp as g_, homeserverWebEndpoint as ga, contactAskerHolds as gb, mayPin as gc, ringAuthorization as gd, DHT_TEXT_REFUSED as gf, STALLED_LOOK_MS as gg, openSecret as gh, staticDidDocument as gi, APP_FRAME as gl, TASK_STATUSES as gm, MAX_GROUP_NAME_LENGTH as gn, RACE_DIRECT_MS as go, validEditNumber as gp, txHash as gr, beaconKeys as gs, rosterHash as gt, IDENTITY_CHALLENGE_WINDOW as gu, NO_ATTEMPTS as gv, budgetRetryMs as gw, readAppRevocation as gx, setUpdateMessage as gy, X401_HEADERS as h, turnName as hC, DEVICE_ECHO_FRAME as hS, toZ32 as hT, decompressSdp as h_, encodeSvcbPacket as ha, contactAskerFrame as hb, PIN_LIMITS as hc, RING_LIFETIME as hd, DHT_TEXT_BYTES as hf, SIGNAL_OUT_READS as hg, openPair as hh, signingKeys as hi, APP_DATA_MAX_BYTES as hl, STATUS_CARD_LIMITS as hm, MAX_GROUP_NAME_BYTES as hn, RACE_ANSWERED_MS as ho, validEditMessage as hp, sha256d as hr, COMMUNITY_TOPOLOGY as hs, leftStatement as ht, parsePacketTransports as hu, HANDOFF_WINDOW as hv, PublishFailedError as hw, isAppSignature as hx, setUpdateFrame as hy, x401ApprovalDigest as i, firstDeviceSetSecret as iC, encodeGhostlyInvite as iS, trimEndOf as iT, CALL_SIGNAL_FUTURE_MS as i_, isBitcoinAddress as ia, MAX_SEEN as ib, parseTypingActivity as ic, isProofAdapter as id, parseDomainTxt as if, FIRST_PUBLISH_MAX_MS as ig, verifyChain as ih, didSignedMessages as ii, appRangeCancelFrame as il, wireReply as im, parseCommunityEdit as in, GhostLink as io, EDIT_RECEIVE_LIMIT as ip, verifyBip322 as ir, groupSignalFrame as is, communityGroupId as it, CAPS_LIMITS as iu, HANDOFF_LIST_PER_FRAME as iv, normalizeRelayUrl as iw, APP_STATEMENT_LIMITS as ix, readHandoffRelease as iy, readX401ProofResult as j, CHAT_RESERVE_MOST_SHARE as jC, unsignedDeviceTransports as jS, isEmptyLinkPacket as j_, ENDPOINT as ja, seenEntry as jb, WAKE_SUBJECT as jc, relayUrl as jd, PLAYABLE_AUDIO as jf, relativizeLocation as jg, ratchetOn as jh, openDidDhtPayload as ji, parseAppFrame as jl, taskProgress as jm, parseGroupMetaFrame as jn, EngineError as jo, readForwarded as jp, shortAtprotoDid as jr, shouldBeHub as js, mergeKnocks as jt, IDENTITY_SUBJECT as ju, handoffFileMissingFrame as jv, signRelayPayload as jw, previewable as jx, enrollHelloFrame as jy, readX401ProofResponse as k, BACKGROUND_WRITES_SHARE as kC, newDeviceSetSecret as kS, buildLinkRecords as k_, decodeBolt11 as ka, requestPlaintextBytes as kb, WAKE_FRAME as kc, irohRelayUrl as kd, sanitizeFileName as kf, formatLocalTarget as kg, isRatcheted as kh, encodeDidDhtPacket as ki, isAppVersion as kl, statusCardBytes as km, openGroupMeta as kn, publishFailure as ko, forwardedAgain as kp, normalizeAtprotoHandle as kr, readBeaconHead as ks, knockIdentity as kt, IDENTITY_REVOCATION_LABEL as ku, handoffDoneFrame as kv, parseRelayPayload as kw, isImageMime as kx, enrollDoneFrame as ky, x401VpToken as l, sealTurnBody as lC, inviteQrText as lS, fromBase64Url as lT, answersOffer as l_, newPubkyProofFolder as la, REQUEST_NAME_UNITS as lb, typingKindOf as lc, storageProof as ld, validDomainRecord as lf, OFFER_LOOK_MS as lg, confirmationTag as lh, didWebHost as li, appRangeGetFrame as ll, ITEM_STATES as lm, mentionsMember as ln, LIVENESS_PING_MS as lo, RateWindow as lp, decodeBitcoinAddress as lr, mayBeHub as ls, decodeCommunityLink as lt, CapsRefusedError as lu, HANDOFF_PIECE_OVERHEAD as lv, BREAKER_ALL_DOWN_PROBE_MS as lw, appSignedBytes as lx, sortParts as ly, x401HolderJwk as m, turnKeys as mC, DEVICE_CAPABILITIES as mS, toBase64Url as mT, contactRtcConfig as m_, decodeSvcbRecords as ma, STAMP_BITS_MIN as mb, PIN_FRAME as mc, verifyPeerProof as md, DHT_MESSAGE_TTL as mf, SIGNAL_DUE_READS as mg, newEpochSecret as mh, parseDidSignaturePaste as mi, readAppRangeFrame as ml, RUN_RESULTS as mm, MAX_GROUP_META_BODY as mn, PONG_WAIT_MS as mo, parseEditedFrame as mp, hash160 as mr, wireHubPolicy as ms, leaveStatement3 as mt, encodePacketTransports as mu, HANDOFF_VERSION as mv, DiscoveryBudgetError as mw, isAppRef as mx, setAckFrame as my, X401_RESPONSE_MODES as n, TurnRecordError as nC, createLink as nS, sanitizeNick as nT, parseRtcSignal as n_, sparkNetworkOf as na, KNOCK_SLOT_LABEL as nb, TypingReceiver as nc, emptyProofLedger as nd, nip05RootKey as nf, DHT_POLL_INTERVALS as ng, signCommit as nh, didGhostlyServiceEntry as ni, APP_RANGE_LIMITS as nl, readReply as nm, communityMessageAuthor as nn, EARLY_DIAL_JOIN_MS as no, EDIT_FRAME as np, bip322ToSpend as nr, SIGNAL_PROVEN_MS as ns, GROUP_READ_NOTE_COMMUNITY as nt, CAPS_ISSUED_BACK_MS as nu, HANDOFF_HELLO as nv, WRITE_FIRST_MS as nw, APP_NAME as nx, readHandoffManifest as ny, matchX401Dcql as o, openTurnValue as oC, inviteLink as oS, bytesEqual as oT, PAIRED_CALL_CANDIDATES as o_, PUBKY_PROOF_ROOT as oa, REQUEST_CLOCK_SKEW_MS as ob, sanitizeTypingStatus as oc, proofCapability as od, recordsFromWellKnown as of, LinkSession as og, verifyCommitSignature as oh, didWebFile as oi, appRangeDataFrame as ol, BUTTON_ID as om, MENTION_EVERYONE as on, INVITER_DIAL_GRACE_MS as oo, MAX_EDITS_PER_MESSAGE as op, ByteReader as or, GROUP_VERSION_HUBS as os, communityMessageId as ot, CAPS_REFRESH_MS as ou, HANDOFF_OFFER as ov, relayUrlProblem as ow, appRef as ox, readHandoffVerified as oy, sameX401HolderJwk as p, turnInstance as pC, DEVICES_CAPABILITY as pS, toBase64 as pT, compressSdp as p_, pubkyProofPath as pa, STAMP_BITS_MAX as pb, PIN_CLOCK_SKEW_MS as pc, verifyNostrProof as pd, DHT_FILE_TOO_LARGE as pf, RELAY_POLL_INTERVALS as pg, epochKeys as ph, parseDidJws as pi, parseAppRangeFrame as pl, ROUTINE_STATES as pm, GROUP_META_PAST_CHARS as pn, PAIRING_RETRY_MS as po, parseEditFrame as pp, encodeWitness as pr, pickMeshHubs as ps, leaveStatement as pt, emptyCapsState as pu, HANDOFF_VERIFIED as pv, RelayBreaker as pw, isAppLine as px, readSetUpdate as py, signAppStore as q, RelayTransport as qC, TURN_MAX as qS, HANDOFF_BUSY as q_, ANSWERS_REFUSED_PAUSES as qa, findAppForbiddenKey as qb, decryptPushPayload as qc, DOMAIN_TXT_MAX_BYTES as qd, PLAYABLE_VIDEO as qf, sendBody as qg, DIRECT_EVIDENCE_MS as qh, isWalletNetwork as qi, TYPING_CAPABILITY as ql, OWN_FRAME_LIMIT as qm, sshSignCommand as qn, readGroupWantNo as qo, readDhtReactions as qp, DID_FILE_MAX_BYTES as qr, transferStalled as qs, asWritten as qt, verifyIdentityPresentation as qu, openHandoffPiece as qv, tryDecrypt as qw, encodeDeviceInvite as qx, newInbox as qy, readX401OpenId4VpRequest as r, encodeTurnFields as rC, decodeInviteCode as rS, stripHidden as rT, BURST_RING_MS as r_, BITCOIN_NETWORKS as ra, LINK_RECORD_LABEL as rb, TypingSender as rc, importedProof as rd, normalizeDomain as rf, EXPECT_PEER_MS as rg, sortRoster as rh, didJwsAlg as ri, AppRanges as rl, replySnippet as rm, meshMessageRef as rn, FIRST_PAIRING_PACE_MS as ro, EDIT_RATE_WINDOW_MS as rp, decodeBase64 as rr, SIGNAL_REPLY_MS as rs, communityCommitHash as rt, CAPS_LABEL as ru, HANDOFF_LATER_BYTES as rv, currentRelays as rw, APP_PREFIXES as rx, readHandoffPake as ry, presentX401SdJwtVc as s, readTurnBody as sC, inviteOwnership as sS, concatBytes as sT, QUICK_REDIAL_MS as s_, isPubkyKey as sa, REQUEST_LABEL as sb, typingActivity as sc, proofHash as sd, recordsName as sf, MAX_DHT_TEXT_BYTES as sg, GROUP_PROFILE as sh, didWebFileNames as si, appRangeEndFrame as sl, BUTTON_STYLES as sm, MENTION_LIMITS as sn, INVITE_TAKEN as so, MAX_REMOVAL_NUMBER as sp, compactSize as sr, MESH_HUBS as ss, communityRoster as st, CapsExchange as su, HANDOFF_PAKE as sv, setLinkTraceSink as sw, appRefPublisher as sx, sameDigest as sy, X401_REQUEST_LIMITS as t, TURN_VERSION as tC, createChatInvite as tS, sanitizeDisplayText as tT, offerIsFresh as t_, sparkInvoiceDetails as ta, KNOCK_SLOTS as tb, TYPING_TIMEOUT_MS as tc, STORAGE_ROOT as td, isPublicAddress as tf, DEPARTED_READ_MS as tg, rosterHas as th, checkDidSignature as ti, APP_RANGE_FRAMES as tl, pairedReplyAuthor as tm, communityEditFrame as tn, DHT_PIN_GRACE_MS as to, EDIT_BUFFER_MS as tp, bip322ToSign as tr, SIGNAL_HOLD_MS as ts, CommunitySession as tt, SESSION_RECEIVE_PENDING as tu, HANDOFF_HAVE as tv, WAY_BACK_SHARE as tw, yieldThread as tx, readHandoffHello as ty, X401_CREDENTIAL_LIMITS as u, signTurnBody as uC, ownInviteRefusal as uS, fromZ32 as uT, buildSdpFromSignal as u_, normalizePubkyKey as ua, REQUEST_PACKET_BYTES as ub, COMMUNITY_PIN_FRAME as uc, storageProofBody as ud, wellKnownUrl as uf, OFFER_STEP_MAX as ug, decryptText as uh, normalizeDid as ui, decodeAppRangeData as ul, PR_CHECKS as um, validMentions as un, MAX_PAIRED_MESSAGE_FRAME as uo, dhtEditId as up, decodeTx as ur, meshHubs as us, derivedSecret as ut, DHT_TEXT_CAPABILITY as uu, HANDOFF_RELEASE as uv, BREAKER_BASE_MS as uw, checkAppRevokeStatement as ux, SET_ACK as uy, X401_SCHEME as v, turnReleaseMessage as vC, HANDOFF_CAPABILITY as vS, __commonJSMin as vT, isCandidateAddress as v_, LIGHTNING_DESTINATION_PATTERN as va, knockHolds as vb, parsePinFrame as vc, ringEvidence as vd, LIVE_POLL_MS as vf, UNUSED_INVITE_READS_PER_MINUTE as vg, sealSecret as vh, DID_DHT_MAX_PAYLOAD as vi, APP_RATE_LIMIT as vl, appCardUrl as vm, encodeGroupMetaBody as vn, REDESCRIBED_GRACE_MS as vo, LINK_MAX_CHARS as vp, u64 as vr, doorHubs as vs, signCommunity as vt, IDENTITY_CLOCK_SKEW as vu, filePartName as vv, isDiscoveryBudgetError as vw, readAppRevocations as vx, verifySetUpdate as vy, decodeX401Header as w, ANSWER_READ_FIRST_MS as wC, deviceLinkParams as wS, signalHasVideo as w_, parseLightningDestination as wa, makeStampPaced as wb, readPin as wc, TRANSPORTS as wd, readDhtFile as wf, unusedInviteWait as wg, RATCHET_HEADER_BYTES as wh, didDhtDocument as wi, appCloseFrame as wl, cardUrl as wm, groupMetaTag as wn, WAKE_LOST_MS as wo, linksIn as wp, atprotoDidMethod as wr, mergeLobby as ws, MAX_KNOCKS as wt, IDENTITY_MAX_RECEIVED as wu, handoffCancelFrame as wv, RELAY_PAYLOAD_MAX_BYTES as ww, verifyAppSignature as wx, ENROLL_HELLO as wy, buildX401ProofResult as x, turnStatedVerifier as xC, deviceFrameCapability as xS, __require as xT, parseCallSignal as x_, findLightningDestination as xa, knockSlotRecords as xb, pinIsNewer as xc, verifyRingEvidence as xd, DHT_FILE_CAPABILITY as xf, WATCH_PEER_MS as xg, MAX_SKIP as xh, DID_DHT_VERSION as xi, APP_SEND_LIMIT as xl, cardLine as xm, groupMetaChange as xn, SWITCH_RETIRE_MS as xo, canonicalUrl as xp, ATPROTO_FULL_SCOPE as xr, lobbyKeys as xs, verifyCommunityCommit as xt, IDENTITY_MAX_CHECKS_PER_HOUR as xu, handoffAttemptFailed as xv, MAX_DNS_PACKET_BYTES as xw, signAppObject as xx, ENROLL_CANCEL_REASONS as xy, X401_VERSION as y, turnSequence as yC, deviceEchoFrame as yS, __esmMin as yT, isGlobalIpv4Host as y_, LNURL_LIMITS as ya, knockSlotIdentity as yb, parsePinnedFrame as yc, validRingKey as yd, emptyDhtDeliveryState as yf, UNUSED_INVITE_UPKEEP_MS as yg, sha256Hex as yh, DID_DHT_PREFIX as yi, APP_RATE_WINDOW_MS as yl, buttonLabelClash as ym, groupDisplayName as yn, RESUME_WAIT_MS as yo, LINK_PREVIEW_LIMITS as yp, varBytes as yr, freshHubs as ys, verifyCommunityChain as yt, IDENTITY_FRAME_LIMIT as yu, handoffAckFrame as yv, publishedNowhere as yw, readAppSignature as yx, DEVICE_KINDS as yy, planAppUpdate as z, GROUP_OVER_PACE_MS as zC, classifyTurnRead as zS, isValidServiceId as z_, VIDEO_METADATA_LIMITS as za, APP_PERMISSIONS as zb, relayRequest as zc, isHoldUrl as zd, isPlayableAudioType as zf, CHUNK_KIND as zg, DATA_SETTLE_MS as zh, SEPOLIA_TEST_USDT_FAUCET as zi, FILES_CAPABILITY as zl, GROUP_ADMIN_OFF_ERROR as zm, SSH_KEY_TYPES as zn, GROUP_WANT_FRAME as zo, nextReactionNumber as zp, parseAtprotoCar as zr, FILE_FRAMES as zs, groupWakeFrame as zt, identityRevocationValue as zu, handoffRequestFrame as zv, identityFromSeedB64 as zw, encodeContactLink as zx, MAX_DONE as zy };
40101
40832
 
40102
- //# sourceMappingURL=src-DHR2fUGx.js.map
40833
+ //# sourceMappingURL=src-0lxL4lAH.js.map