@ghostlytools/cli 1.9.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +35 -27
  2. package/SKILL.md +7 -3
  3. package/dist/assets/api-BOWLZYXM.js +3 -0
  4. package/dist/assets/{api-DFCgr6RH.js → api-Bi6hCcwG.js} +100 -47
  5. package/dist/assets/api-Bi6hCcwG.js.map +1 -0
  6. package/dist/assets/{apiKit-CCavJJcl.js → apiKit-DzXHZojD.js} +26 -9
  7. package/dist/assets/apiKit-DzXHZojD.js.map +1 -0
  8. package/dist/assets/{apps-B7o2BPj6.js → apps-0Ks6KjqS.js} +1 -1
  9. package/dist/assets/{apps-DmxEG147.js → apps-DIQbzG08.js} +33 -10
  10. package/dist/assets/apps-DIQbzG08.js.map +1 -0
  11. package/dist/assets/{arkade-DtYR9H0c.js → arkade-zozCldAE.js} +2 -2
  12. package/dist/assets/{arkade-DtYR9H0c.js.map → arkade-zozCldAE.js.map} +1 -1
  13. package/dist/assets/{backup-YIB2XIES.js → backup-BL49Kt-T.js} +7 -6
  14. package/dist/assets/{backup-YIB2XIES.js.map → backup-BL49Kt-T.js.map} +1 -1
  15. package/dist/assets/{backup-BserdrNk.js → backup-BvIFcZM7.js} +1 -1
  16. package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js.map +1 -1
  17. package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +1 -1
  18. package/dist/assets/{blobFiles-DOQDRdDI.js → blobFiles-BnjN_Vrz.js} +3 -3
  19. package/dist/assets/{blobFiles-DOQDRdDI.js.map → blobFiles-BnjN_Vrz.js.map} +1 -1
  20. package/dist/assets/buttons-CAW5v5EE.js +332 -0
  21. package/dist/assets/buttons-CAW5v5EE.js.map +1 -0
  22. package/dist/assets/buttons-oJI5mHSL.js +2 -0
  23. package/dist/assets/childEnv-BVOQK9EA.js +21 -0
  24. package/dist/assets/childEnv-BVOQK9EA.js.map +1 -0
  25. package/dist/assets/client-CyApKBEw.js +473 -0
  26. package/dist/assets/client-CyApKBEw.js.map +1 -0
  27. package/dist/assets/codec-DqFxxB_q.js +13 -0
  28. package/dist/assets/codec-DqFxxB_q.js.map +1 -0
  29. package/dist/assets/{endpoint-BdaeBw2L.js → endpoint-DWHkXWVM.js} +101 -16
  30. package/dist/assets/endpoint-DWHkXWVM.js.map +1 -0
  31. package/dist/assets/{envelope-Dt75vrmY.js → envelope-CMUgz31I.js} +3 -12
  32. package/dist/assets/envelope-CMUgz31I.js.map +1 -0
  33. package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js.map +1 -1
  34. package/dist/assets/{fileBytes-BPDKufla.js → fileBytes-DMzrIdCu.js} +1 -1
  35. package/dist/assets/{fileBytes-DNgrRL0R.js → fileBytes-DjBYYyXT.js} +3 -3
  36. package/dist/assets/{fileBytes-DNgrRL0R.js.map → fileBytes-DjBYYyXT.js.map} +1 -1
  37. package/dist/assets/{fileBytes-Q3ehcEr8.js → fileBytes-Douk1yOp.js} +2 -2
  38. package/dist/assets/{fileBytes-Q3ehcEr8.js.map → fileBytes-Douk1yOp.js.map} +1 -1
  39. package/dist/assets/fileBytesIdb-CD5Uv490.js +2 -0
  40. package/dist/assets/{fileBytesIdb-Dm1EyEbT.js → fileBytesIdb-CkClu9YI.js} +3 -3
  41. package/dist/assets/{fileBytesIdb-Dm1EyEbT.js.map → fileBytesIdb-CkClu9YI.js.map} +1 -1
  42. package/dist/assets/{fileBytesOpfs-ZGD21c4Q.js → fileBytesOpfs-WryQuOgK.js} +3 -3
  43. package/dist/assets/{fileBytesOpfs-ZGD21c4Q.js.map → fileBytesOpfs-WryQuOgK.js.map} +1 -1
  44. package/dist/assets/{fixedHosts-B598JzbC.js → fixedHosts-C2hdCfzK.js} +4 -4
  45. package/dist/assets/{fixedHosts-B598JzbC.js.map → fixedHosts-C2hdCfzK.js.map} +1 -1
  46. package/dist/assets/{groupFiles-FXel6zIc.js → groupFiles-BAQIt_bJ.js} +404 -161
  47. package/dist/assets/groupFiles-BAQIt_bJ.js.map +1 -0
  48. package/dist/assets/{host-DIBeK_c_.js → host-CaRlDMTd.js} +206 -49
  49. package/dist/assets/host-CaRlDMTd.js.map +1 -0
  50. package/dist/assets/{hyperdhtRelay-D185dETu.js → hyperdhtRelay-BxADl3SG.js} +2 -2
  51. package/dist/assets/{hyperdhtRelay-D185dETu.js.map → hyperdhtRelay-BxADl3SG.js.map} +1 -1
  52. package/dist/assets/{idb-BkOJES5_.js → idb-BHsAqENE.js} +37 -6
  53. package/dist/assets/idb-BHsAqENE.js.map +1 -0
  54. package/dist/assets/{irohWeb-BSv_BWyG.js → irohWeb-D2sh6EWp.js} +65 -7
  55. package/dist/assets/irohWeb-D2sh6EWp.js.map +1 -0
  56. package/dist/assets/{main-BbhfMTt8.js → main-Bc4Ow56Z.js} +221 -287
  57. package/dist/assets/main-Bc4Ow56Z.js.map +1 -0
  58. package/dist/assets/{mainline-9Vc3c3SA.js → mainline-DWh4Ccri.js} +2 -2
  59. package/dist/assets/{mainline-9Vc3c3SA.js.map → mainline-DWh4Ccri.js.map} +1 -1
  60. package/dist/assets/networkReason-DT_D_Wpc.js +474 -0
  61. package/dist/assets/networkReason-DT_D_Wpc.js.map +1 -0
  62. package/dist/assets/{nwc-QX3Yt1Sb.js → nwc-DoSEhUKb.js} +3 -3
  63. package/dist/assets/{nwc-QX3Yt1Sb.js.map → nwc-DoSEhUKb.js.map} +1 -1
  64. package/dist/assets/{nwcProvider-CzX3xH47.js → nwcProvider-CGWqUjpB.js} +2 -2
  65. package/dist/assets/{nwcProvider-CzX3xH47.js.map → nwcProvider-CGWqUjpB.js.map} +1 -1
  66. package/dist/assets/{ownDid-D8z5gwGI.js → ownDid-CbGjRLBn.js} +3 -3
  67. package/dist/assets/ownDid-CbGjRLBn.js.map +1 -0
  68. package/dist/assets/{profiles-MFtCmJwK.js → profiles-DgIfvBeN.js} +47 -4
  69. package/dist/assets/profiles-DgIfvBeN.js.map +1 -0
  70. package/dist/assets/{registry-B2Dtnibo.js → registry-BSyxGjN6.js} +11 -9
  71. package/dist/assets/registry-BSyxGjN6.js.map +1 -0
  72. package/dist/assets/{registry-PTtBMaYZ.js → registry-C5cn80Rw.js} +1 -1
  73. package/dist/assets/{resolve-ZxVzwFNA.js → resolve-D-9YRFhl.js} +2 -2
  74. package/dist/assets/{resolve-ZxVzwFNA.js.map → resolve-D-9YRFhl.js.map} +1 -1
  75. package/dist/assets/{restoredRows-BCRCjhdF.js → restoredRows-CRYwIx3g.js} +2 -2
  76. package/dist/assets/{restoredRows-BCRCjhdF.js.map → restoredRows-CRYwIx3g.js.map} +1 -1
  77. package/dist/assets/{buttons-CuRfKnPI.js → secretGuard-CSVNxXVW.js} +80 -330
  78. package/dist/assets/secretGuard-CSVNxXVW.js.map +1 -0
  79. package/dist/assets/secretGuard-Q2BKq0q0.js +2 -0
  80. package/dist/assets/{server-Dw1o8z1o.js → server-BufntkX8.js} +1734 -369
  81. package/dist/assets/server-BufntkX8.js.map +1 -0
  82. package/dist/assets/{src-BD8RBVEp.js → src-CCt5s4DK.js} +3073 -1890
  83. package/dist/assets/src-CCt5s4DK.js.map +1 -0
  84. package/dist/assets/{sshForges-DWrESWkK.js → sshForges-D8CPaIbR.js} +16 -9
  85. package/dist/assets/{sshForges-DWrESWkK.js.map → sshForges-D8CPaIbR.js.map} +1 -1
  86. package/dist/assets/{translate-D1uP0q32.js → translate-Cb-6hMhD.js} +17 -12
  87. package/dist/assets/translate-Cb-6hMhD.js.map +1 -0
  88. package/dist/assets/{usdt-DhVN8geQ.js → usdt-ds461mzA.js} +3 -3
  89. package/dist/assets/{usdt-DhVN8geQ.js.map → usdt-ds461mzA.js.map} +1 -1
  90. package/dist/assets/{words-DdXPkB3n.js → words-B1ylON2h.js} +4 -2
  91. package/dist/assets/words-B1ylON2h.js.map +1 -0
  92. package/dist/ghostly.mjs +1 -1
  93. package/package.json +1 -1
  94. package/dist/assets/api-DFCgr6RH.js.map +0 -1
  95. package/dist/assets/api-raWw9j_m.js +0 -3
  96. package/dist/assets/apiKit-CCavJJcl.js.map +0 -1
  97. package/dist/assets/apps-DmxEG147.js.map +0 -1
  98. package/dist/assets/buttons-CuRfKnPI.js.map +0 -1
  99. package/dist/assets/buttons-De3LPdSG.js +0 -2
  100. package/dist/assets/daemonProof-DtrL5lE5.js +0 -236
  101. package/dist/assets/daemonProof-DtrL5lE5.js.map +0 -1
  102. package/dist/assets/endpoint-BdaeBw2L.js.map +0 -1
  103. package/dist/assets/envelope-Dt75vrmY.js.map +0 -1
  104. package/dist/assets/fileBytesIdb-DZcESfTt.js +0 -2
  105. package/dist/assets/groupFiles-FXel6zIc.js.map +0 -1
  106. package/dist/assets/host-DIBeK_c_.js.map +0 -1
  107. package/dist/assets/idb-BkOJES5_.js.map +0 -1
  108. package/dist/assets/irohWeb-BSv_BWyG.js.map +0 -1
  109. package/dist/assets/main-BbhfMTt8.js.map +0 -1
  110. package/dist/assets/networkReason-BncJ9KSM.js +0 -154
  111. package/dist/assets/networkReason-BncJ9KSM.js.map +0 -1
  112. package/dist/assets/ownDid-D8z5gwGI.js.map +0 -1
  113. package/dist/assets/profiles-MFtCmJwK.js.map +0 -1
  114. package/dist/assets/registry-B2Dtnibo.js.map +0 -1
  115. package/dist/assets/server-Dw1o8z1o.js.map +0 -1
  116. package/dist/assets/src-BD8RBVEp.js.map +0 -1
  117. package/dist/assets/translate-D1uP0q32.js.map +0 -1
  118. package/dist/assets/words-DdXPkB3n.js.map +0 -1
@@ -1,11 +1,10 @@
1
- import { $a as replySnippet, $i as identityStatement, $n as GROUP_HAVE_FRAME, Br as transferEnded, Dn as decodeBolt11, En as resolveLightningDestination, Fu as fromBase64Url, Ir as ChatFiles, Ji as IdentityCheckUnavailable, Lu as randomBytes, Na as RateWindow, Qi as identityRevocationValue, Qn as GROUP_FILE_LIMITS, Rr as FileUplink, Ru as toBase64Url, Tn as requestLnurlInvoice, Xn as engineText, Yi as IdentityExchange, Yn as engineError, Zi as emptyIdentityLedger, cr as readGroupWantNo, ea as newIdentityBinding, ir as isGroupMessageId, ln as walletNetworkOf, na as revokesIdentity, nr as fetchesByItself, or as readGroupHave, qi as IDENTITY_REVOCATION_LABEL, rn as WALLET_NETWORKS, rr as groupFileFallback, sr as readGroupWant, ta as receivedIdentityStatus, tr as GROUP_WANT_NO_FRAME, wa as fileMessageText } from "./src-BD8RBVEp.js";
1
+ import { Br as FileUplink, Di as IDENTITY_REVOCATION_LABEL, Dn as resolveLightningDestination, En as requestLnurlInvoice, Fi as newIdentityBinding, Hr as transferEnded, Ii as receivedIdentityStatus, J as meshMessageRef, Ju as randomBytes, Ku as fromBase64Url, La as RateWindow, Li as revokesIdentity, Mi as identityRevocationValue, Ni as identityStatement, Oa as fileMessageText, Oi as IdentityCheckUnavailable, On as decodeBolt11, Ou as budgetRetryMs, Pi as isIdentityBinding, Qn as engineText, Rr as ChatFiles, Yu as toBase64Url, Zn as engineError, ar as groupFileFallback, cr as readGroupHave, er as GROUP_FILE_LIMITS, in as WALLET_NETWORKS, ir as fetchesByItself, ji as emptyIdentityLedger, ki as IdentityExchange, ku as isDiscoveryBudgetError, lr as readGroupWant, or as isGroupMessageId, ro as replySnippet, rr as GROUP_WANT_NO_FRAME, tr as GROUP_HAVE_FRAME, un as walletNetworkOf, ur as readGroupWantNo } from "./src-CCt5s4DK.js";
2
2
  import { a as describeProvider, c as offeredIn, d as sourceProblem, n as PROVIDER_PLATFORMS, o as isNothingSpentError, s as networkMode, t as NothingSpentError, u as redact } from "./types-C4_KafL_.js";
3
- import { g as wrap, h as transact, i as STORES, m as store, s as databaseName, u as fileStore } from "./idb-BkOJES5_.js";
4
- import { a as sealSeed, i as newDeviceKey, o as unsealSeed, t as networkReason } from "./networkReason-BncJ9KSM.js";
3
+ import { g as wrap, h as transact, i as STORES, m as store, s as databaseName, u as fileStore } from "./idb-BHsAqENE.js";
4
+ import { a as sealSeed, f as openSecret, i as newDeviceKey, m as whenDataKeyDropped, o as unsealSeed, p as sealSecret, t as networkReason } from "./networkReason-DT_D_Wpc.js";
5
5
  import { t as BITCOIN_INVOICE_ON_TESTNET, u as mintNetwork } from "./mints-j5XAOk4f.js";
6
- import { c as boundedIdentityFetch, l as verifyIdentity } from "./ownDid-D8z5gwGI.js";
7
- import { i as fromBase64Url$1 } from "./envelope-Dt75vrmY.js";
8
- import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-DNgrRL0R.js";
6
+ import { c as boundedIdentityFetch, l as verifyIdentity } from "./ownDid-CbGjRLBn.js";
7
+ import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-DjBYYyXT.js";
9
8
  import { sha256 } from "@noble/hashes/sha2.js";
10
9
  import { validateMnemonic } from "@scure/bip39";
11
10
  import { wordlist } from "@scure/bip39/wordlists/english.js";
@@ -1068,6 +1067,16 @@ async function readLightningJournal() {
1068
1067
  }
1069
1068
  return (await read.ops).map((op) => ({ ...op }));
1070
1069
  }
1070
+ /**
1071
+ * What the journal says of the payments of one chat request (`DeskLightning.interrupted`): "pending" while one has not
1072
+ * ended (sending, pending, unknown: its card settles it and says so), "paid" once one went through, undefined when
1073
+ * none left the wallet (none journaled, or only failed ones).
1074
+ */
1075
+ async function journaledPayment(paymentId) {
1076
+ const ops = (await readLightningJournal()).filter((op) => op.direction === "out" && op.paymentId === paymentId);
1077
+ if (ops.some((op) => op.state === "sending" || op.state === "pending" || op.state === "unknown")) return "pending";
1078
+ return ops.some((op) => op.state === "paid") ? "paid" : void 0;
1079
+ }
1071
1080
  var OUT_POLL_MS = 15e3;
1072
1081
  var RECENT = 20;
1073
1082
  /** Resolved Lightning addresses are kept this long for the amount to be chosen; this many at most. */
@@ -1193,6 +1202,18 @@ var LightningService = class {
1193
1202
  this.schedule(0);
1194
1203
  return true;
1195
1204
  }
1205
+ /**
1206
+ * A payer says it paid this invoice of ours: the source is asked about it now, and at the fast pace for
1207
+ * `INVOICE_PACE.watchMs`. The other open invoices keep their pace. Returns whether it is an open invoice of this card's.
1208
+ */
1209
+ async check(invoice) {
1210
+ const hash = decodeBolt11(invoice)?.paymentHash;
1211
+ const op = hash ? await this.get("in", hash) : void 0;
1212
+ if (!op || !this.owns(op) || op.state !== "open") return false;
1213
+ this.watched.set(op.paymentHash, Date.now() + INVOICE_PACE.watchMs);
1214
+ await this.reconcile(false, op.paymentHash);
1215
+ return true;
1216
+ }
1196
1217
  /** The Cashu wallet minted the ecash of one of its invoices (it polls its own quotes). */
1197
1218
  async reportInvoicePaid(invoice, context = {}) {
1198
1219
  const hash = decodeBolt11(invoice)?.paymentHash;
@@ -1379,14 +1400,15 @@ var LightningService = class {
1379
1400
  }
1380
1401
  /**
1381
1402
  * Asks the active source about everything of its that is open, pending or unknown. One pass at a time. `paced`: an
1382
- * open invoice only when its pace says so (`nextInvoiceAsk`); otherwise every one now (someone says it was paid).
1403
+ * open invoice only when its pace says so (`nextInvoiceAsk`); otherwise every one now. `only`: the open invoice with
1404
+ * this payment hash alone (a payer says it paid it, `check`).
1383
1405
  */
1384
- reconcile(paced = false) {
1385
- const pass = this.passes.then(() => this.reconcileOnce(paced));
1406
+ reconcile(paced = false, only) {
1407
+ const pass = this.passes.then(() => this.reconcileOnce(paced, only));
1386
1408
  this.passes = pass.catch(() => {});
1387
1409
  return pass;
1388
1410
  }
1389
- async reconcileOnce(paced) {
1411
+ async reconcileOnce(paced, only) {
1390
1412
  if (this.stopped) return;
1391
1413
  let again = 0;
1392
1414
  /** When the next open invoice is due. */
@@ -1398,7 +1420,7 @@ var LightningService = class {
1398
1420
  const open = new Set(ops.filter((op) => op.direction === "in" && op.state === "open").map((op) => op.paymentHash));
1399
1421
  for (const pace of [this.asked, this.watched]) for (const hash of pace.keys()) if (!open.has(hash)) pace.delete(hash);
1400
1422
  for (const op of ops) {
1401
- if (!this.owns(op)) continue;
1423
+ if (!this.owns(op) || only !== void 0 && (op.direction !== "in" || op.paymentHash !== only)) continue;
1402
1424
  if (op.selfSettled) {
1403
1425
  if (op.direction !== "out" || op.state !== "unknown") continue;
1404
1426
  if (!provider) {
@@ -1933,6 +1955,10 @@ var LightningCards = class {
1933
1955
  async watch(invoice) {
1934
1956
  return (await Promise.all(this.here().map((s) => s.watch(invoice)))).some(Boolean);
1935
1957
  }
1958
+ /** A payer says it paid this invoice of ours: the card that made it asks its source about it now, and about nothing else. */
1959
+ async check(invoice) {
1960
+ return (await Promise.all(this.here().map((s) => s.check(invoice)))).some(Boolean);
1961
+ }
1936
1962
  async recover() {
1937
1963
  for (const s of this.here()) await s.recover();
1938
1964
  }
@@ -1960,96 +1986,6 @@ var LightningCards = class {
1960
1986
  }
1961
1987
  };
1962
1988
  //#endregion
1963
- //#region ../browser/src/shared/profileKey.ts
1964
- /**
1965
- * Only the record key can hold a newline: the other parts come from the code, so the joined binding still reads one
1966
- * way (the first two lines, the last line, and the key between them).
1967
- */
1968
- function binding(b) {
1969
- for (const part of [
1970
- b.db,
1971
- b.store,
1972
- b.field
1973
- ]) if (!part || part.includes("\n")) throw new Error("Invalid sealed field binding");
1974
- return new TextEncoder().encode([
1975
- "ghostly-field/2",
1976
- b.db,
1977
- b.store,
1978
- b.key,
1979
- b.field
1980
- ].join("\n"));
1981
- }
1982
- function isSealedField(value) {
1983
- const v = value;
1984
- return !!v && typeof v === "object" && v.v === 2 && typeof v.iv === "string" && typeof v.ct === "string";
1985
- }
1986
- /** Seals one field under DK with a fresh random 96-bit nonce and no KDF per field. */
1987
- async function sealField(key, where, value) {
1988
- const iv = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(12));
1989
- const ct = new Uint8Array(await crypto.subtle.encrypt({
1990
- name: "AES-GCM",
1991
- iv,
1992
- additionalData: binding(where)
1993
- }, key, new TextEncoder().encode(value)));
1994
- return {
1995
- v: 2,
1996
- iv: toBase64Url(iv),
1997
- ct: toBase64Url(ct)
1998
- };
1999
- }
2000
- /** Opens a field sealed for exactly this place under this DK; anything else fails instead of opening wrong. */
2001
- async function openField(key, where, sealed) {
2002
- if (!isSealedField(sealed)) throw new Error("Unsupported sealed field version");
2003
- const aad = binding(where);
2004
- try {
2005
- const iv = fromBase64Url$1(sealed.iv);
2006
- if (iv.length !== 12) throw new Error("nonce");
2007
- return new TextDecoder().decode(await crypto.subtle.decrypt({
2008
- name: "AES-GCM",
2009
- iv,
2010
- additionalData: aad
2011
- }, key, fromBase64Url$1(sealed.ct)));
2012
- } catch {
2013
- throw new Error("A sealed field could not be opened: it was changed, or it belongs to another record");
2014
- }
2015
- }
2016
- //#endregion
2017
- //#region ../browser/src/engine/dataKey.ts
2018
- var PEER_DB = "ghostly";
2019
- /**
2020
- * The profile's data key (DK), when the profile is encrypted and unlocked: the one slot the engine owns. A
2021
- * non-extractable key; nothing writes it anywhere. Empty, every secret is sealed as today (version 1).
2022
- */
2023
- var slot = null;
2024
- var onDrop = /* @__PURE__ */ new Set();
2025
- /** A cache of opened secrets empties itself when the key goes. Returns the way to stop listening. */
2026
- function whenDataKeyDropped(drop) {
2027
- onDrop.add(drop);
2028
- return () => {
2029
- onDrop.delete(drop);
2030
- };
2031
- }
2032
- async function sealSecret(value, at) {
2033
- if (slot) return sealField(slot, {
2034
- db: PEER_DB,
2035
- ...at
2036
- }, value);
2037
- const deviceKey = newDeviceKey();
2038
- return {
2039
- sealed: await sealSeed(value, deviceKey),
2040
- deviceKey
2041
- };
2042
- }
2043
- /** Reads both versions: a profile being encrypted holds some of each until its migration ends. */
2044
- async function openSecret(secret, at) {
2045
- if (!isSealedField(secret)) return unsealSeed(secret.sealed, secret.deviceKey);
2046
- if (!slot) throw new Error("This profile is locked. Enter its passphrase first.");
2047
- return openField(slot, {
2048
- db: PEER_DB,
2049
- ...at
2050
- }, secret);
2051
- }
2052
- //#endregion
2053
1989
  //#region ../browser/src/proofs/load.ts
2054
1990
  /**
2055
1991
  * The identity proof providers, loaded on first need and not with the app: they and their libraries (OpenPGP, the
@@ -2060,7 +1996,7 @@ var registry;
2060
1996
  var loading;
2061
1997
  var listeners = /* @__PURE__ */ new Set();
2062
1998
  function loadIdentityProviders() {
2063
- return loading ??= import("./registry-PTtBMaYZ.js").then((m) => {
1999
+ return loading ??= import("./registry-C5cn80Rw.js").then((m) => {
2064
2000
  registry = m;
2065
2001
  for (const listener of listeners) listener();
2066
2002
  return m;
@@ -2083,10 +2019,21 @@ var KEY = "identityProofs";
2083
2019
  var REVOCATIONS = "identityRevocations";
2084
2020
  /** When the contacts' proofs were last looked up for a revocation (ms), so a reload does not look them all up again. */
2085
2021
  var REVOCATIONS_CHECKED_AT = "identityRevocationsCheckedAt";
2022
+ /** The lookup under way: when it began (ms) and the proofs it already looked up (`linkId|id`), so one cut short goes on from the rest. */
2023
+ var REVOCATIONS_ROUND = "identityRevocationsRound";
2086
2024
  /** Relays and the DHT forget a record within hours: republish revocations this often while the app runs. */
2087
2025
  var REPUBLISH_MS = 36e5;
2088
2026
  /** How often the contacts' proofs are looked up for a revocation (and once shortly after start). */
2089
2027
  var REVOCATION_CHECK_MS = 432e5;
2028
+ /** A lookup that could not run (offline, no relay answered) is tried again after this, doubled each time, up to the 12 h. */
2029
+ var REVOCATION_RETRY_MS = 3e5;
2030
+ /** A proof's lookup the relays' budget held back is read again when it frees, at most this many times; then the lookup stops there and goes on from it at its next try. */
2031
+ var BUDGET_TRIES = 5;
2032
+ /**
2033
+ * The 12 h lookup reads one proof key this often: 20 a minute, under half the relays' background share (44 a minute over
2034
+ * the three default relays), which the profile's DID, contact link and public profiles read through too.
2035
+ */
2036
+ var REVOCATION_READ_GAP_MS = 3e3;
2090
2037
  /**
2091
2038
  * After a contact withdraws a proof, how long to wait before each lookup for its revocation (WISP 300: removing a proof withdraws it from
2092
2039
  * every chat and revokes it). The notice goes out before the revocation is published, so not at once; each try backs
@@ -2097,6 +2044,18 @@ var WITHDRAWN_REVOCATION_TRIES_MS = [
2097
2044
  6e4,
2098
2045
  18e4
2099
2046
  ];
2047
+ /**
2048
+ * A contact's proof whose provider asks for re-checks is checked again on its own (the provider's check, as "Check
2049
+ * again" runs it) this long after its last check, or the provider's own interval when longer: a domain record or a
2050
+ * listed key that is gone then stops reading verified.
2051
+ */
2052
+ var AUTO_RECHECK_AFTER_S = 86400;
2053
+ /** Due proofs are looked for this often (the first time a few minutes after the start), and only a few checked each time. */
2054
+ var AUTO_RECHECK_TICK_MS = 9e5;
2055
+ var AUTO_RECHECK_FIRST_MS = 18e4;
2056
+ var AUTO_RECHECK_BATCH = 3;
2057
+ /** A check that could not reach the server leaves the proof as it was and is tried again after this, doubling, at most a day. */
2058
+ var AUTO_RECHECK_BACKOFF_MS = 72e5;
2100
2059
  /** A proof begun and not completed is dropped this long after, or when a fifth one begins (the CLI says the same). */
2101
2060
  var IDENTITY_DRAFT_TTL_MS = 18e5;
2102
2061
  var MAX_PROOFS = 32;
@@ -2112,7 +2071,27 @@ var IdentityProofs = class {
2112
2071
  proofs = [];
2113
2072
  revocations = [];
2114
2073
  revocationsCheckedAt = 0;
2115
- /** "Clear all data" (`revokeAll`): a revocation lookup still on its way notes nothing. */
2074
+ /** Revocation lookups in a row that could not run: the next waits `REVOCATION_RETRY_MS` doubled this many times less one. */
2075
+ lookupsMissed = 0;
2076
+ /** The lookup under way, if one was cut short (`REVOCATIONS_ROUND`). */
2077
+ round;
2078
+ /**
2079
+ * How the last Pkarr read of each contact's proof went (`revoked`), by proof id: answered, could not run (offline, no
2080
+ * relay answered), or held back by the relays' budget, which takes reads again in this many ms.
2081
+ */
2082
+ reads = /* @__PURE__ */ new Map();
2083
+ /** When each contact's proof was last read for a revocation this run (ms), by proof id: the 12 h lookup reads the longest unread first. */
2084
+ lastRead = /* @__PURE__ */ new Map();
2085
+ lookupTimer;
2086
+ looking = false;
2087
+ /** Counted at each `stop`: a 12 h lookup under way ends there. */
2088
+ stops = 0;
2089
+ /** Ends the 12 h lookup's wait (between two reads, or for the budget) at once: `stop`. */
2090
+ wakeLookup;
2091
+ /** Revocations not published because the app was offline: published when the network comes back (`networkBack`). */
2092
+ unpublished = /* @__PURE__ */ new Set();
2093
+ running = false;
2094
+ /** "Clear all data" (`revokeAll`): a revocation lookup or a proof's save still on its way writes nothing. */
2116
2095
  ended = false;
2117
2096
  /** Unsealed proof-key seeds, by proof id, for this run only. */
2118
2097
  seeds = /* @__PURE__ */ new Map();
@@ -2124,6 +2103,8 @@ var IdentityProofs = class {
2124
2103
  errors = /* @__PURE__ */ new Map();
2125
2104
  /** Chats whose current connection already got the hello: "ready" is reported more than once per connection. */
2126
2105
  greeted = /* @__PURE__ */ new Set();
2106
+ /** Automatic re-checks that could not reach the server, by chat and proof: how many in a row, and when to try again (ms). */
2107
+ recheckBackoff = /* @__PURE__ */ new Map();
2127
2108
  fetch;
2128
2109
  constructor(host, providers = loadedIdentityProviders) {
2129
2110
  this.host = host;
@@ -2134,15 +2115,17 @@ var IdentityProofs = class {
2134
2115
  async load() {
2135
2116
  const providers = loadIdentityProviders();
2136
2117
  const settings = await store(STORES.settings, "readonly");
2137
- [this.proofs, this.revocations, this.revocationsCheckedAt] = await Promise.all([
2118
+ [this.proofs, this.revocations, this.revocationsCheckedAt, this.round] = await Promise.all([
2138
2119
  wrap(settings.get(KEY)).then((v) => v ?? []),
2139
2120
  wrap(settings.get(REVOCATIONS)).then((v) => v ?? []),
2140
- wrap(settings.get(REVOCATIONS_CHECKED_AT)).then((v) => typeof v === "number" ? v : 0)
2121
+ wrap(settings.get(REVOCATIONS_CHECKED_AT)).then((v) => typeof v === "number" ? v : 0),
2122
+ wrap(settings.get(REVOCATIONS_ROUND)).then((v) => typeof v?.startedAt === "number" && Array.isArray(v.done) ? v : void 0)
2141
2123
  ]);
2142
2124
  await providers;
2143
2125
  }
2144
2126
  /** Background work: republish revocations, look up the contacts' proofs for revocations. */
2145
2127
  start() {
2128
+ this.running = true;
2146
2129
  const every = (ms, first, work) => {
2147
2130
  const tick = () => {
2148
2131
  work().catch(() => {}).finally(() => {
@@ -2153,12 +2136,42 @@ var IdentityProofs = class {
2153
2136
  };
2154
2137
  every(REPUBLISH_MS, 5e3, () => this.republish());
2155
2138
  const due = Math.min(REVOCATION_CHECK_MS, this.revocationsCheckedAt + REVOCATION_CHECK_MS - Date.now());
2156
- every(REVOCATION_CHECK_MS, Math.max(6e4, due), () => this.checkRevocations());
2139
+ this.lookUpIn(Math.max(6e4, due));
2140
+ every(AUTO_RECHECK_TICK_MS, AUTO_RECHECK_FIRST_MS, () => this.recheckDue());
2157
2141
  this.unlisten ??= whenDataKeyDropped(() => this.forgetSeeds());
2158
2142
  }
2143
+ /** The network is back: a revocation lookup that could not run, and a revocation not published offline, go now. */
2144
+ networkBack() {
2145
+ if (!this.running || this.ended) return;
2146
+ if (this.lookupsMissed > 0) this.lookUpIn(0);
2147
+ for (const r of this.revocations) if (this.unpublished.has(r.id) && r.expiresAt > now()) this.publishRevocation(r).catch(() => {});
2148
+ }
2149
+ lookUpIn(ms) {
2150
+ if (this.lookupTimer) clearTimeout(this.lookupTimer);
2151
+ const timer = this.lookupTimer = setTimeout(() => {
2152
+ this.timers = this.timers.filter((t) => t !== timer);
2153
+ this.lookupTimer = void 0;
2154
+ this.lookUp();
2155
+ }, ms);
2156
+ this.timers.push(timer);
2157
+ }
2158
+ /** A lookup done waits 12 h for the next; one that could not run is tried again sooner, backing off. */
2159
+ async lookUp() {
2160
+ if (this.looking) return;
2161
+ this.looking = true;
2162
+ const done = await this.checkRevocations().catch(() => false);
2163
+ this.looking = false;
2164
+ if (!this.running) return;
2165
+ this.lookupsMissed = done ? 0 : this.lookupsMissed + 1;
2166
+ this.lookUpIn(done ? REVOCATION_CHECK_MS : Math.min(REVOCATION_CHECK_MS, REVOCATION_RETRY_MS * 2 ** (this.lookupsMissed - 1)));
2167
+ }
2159
2168
  stop() {
2169
+ this.running = false;
2170
+ this.stops++;
2160
2171
  for (const t of this.timers) clearTimeout(t);
2161
2172
  this.timers = [];
2173
+ this.lookupTimer = void 0;
2174
+ this.wakeLookup?.();
2162
2175
  this.unlisten?.();
2163
2176
  this.unlisten = void 0;
2164
2177
  this.forgetSeeds();
@@ -2173,6 +2186,7 @@ var IdentityProofs = class {
2173
2186
  */
2174
2187
  save(change) {
2175
2188
  const run = this.saving.then(async () => {
2189
+ if (this.ended) throw new Error("This profile's data was cleared");
2176
2190
  const [proofs, revocations] = change(this.proofs, this.revocations);
2177
2191
  await transact([STORES.settings], (stores) => {
2178
2192
  stores[STORES.settings].put(proofs, KEY);
@@ -2209,7 +2223,7 @@ var IdentityProofs = class {
2209
2223
  */
2210
2224
  verifyContact = async (statement, evidence) => {
2211
2225
  if (!this.host.relayOnly?.()) return this.verify(statement, evidence);
2212
- const { fixedIdentityHosts } = await import("./fixedHosts-B598JzbC.js");
2226
+ const { fixedIdentityHosts } = await import("./fixedHosts-C2hdCfzK.js");
2213
2227
  const fixed = fixedIdentityHosts();
2214
2228
  let refused;
2215
2229
  const fetch = async (url, options) => {
@@ -2227,9 +2241,21 @@ var IdentityProofs = class {
2227
2241
  throw e;
2228
2242
  }
2229
2243
  };
2244
+ /**
2245
+ * The exchange reads a lookup that failed as "not revoked": noted here (`reads`), so the 12 h lookup looks that proof
2246
+ * up again. One the relays' budget held back is kept apart: the lookup waits for the budget and reads it again.
2247
+ */
2230
2248
  revoked = async (statement) => {
2231
- if (!this.host.online()) return false;
2232
- const records = await this.host.resolve(statement.binding.key);
2249
+ if (!this.host.online()) {
2250
+ this.reads.set(statement.id, "failed");
2251
+ return false;
2252
+ }
2253
+ const records = await this.host.resolve(statement.binding.key).catch((e) => {
2254
+ this.reads.set(statement.id, isDiscoveryBudgetError(e) ? budgetRetryMs(e, 1e3, 6e4) : "failed");
2255
+ throw e;
2256
+ });
2257
+ this.reads.set(statement.id, "answered");
2258
+ this.lastRead.set(statement.id, Date.now());
2233
2259
  return !!records && revokesIdentity(records, statement.id);
2234
2260
  };
2235
2261
  async local(id) {
@@ -2352,7 +2378,11 @@ var IdentityProofs = class {
2352
2378
  return !!p.shared || this.host.linkIds().some((l) => this.host.ledger(l)?.shared.some((s) => s.id === id));
2353
2379
  }
2354
2380
  async publishRevocation(r) {
2355
- if (!this.host.online()) return;
2381
+ if (!this.host.online()) {
2382
+ this.unpublished.add(r.id);
2383
+ return;
2384
+ }
2385
+ this.unpublished.delete(r.id);
2356
2386
  await this.host.publish(await this.seedOf(r.id, r.seed), [{
2357
2387
  label: IDENTITY_REVOCATION_LABEL,
2358
2388
  value: identityRevocationValue(r.id, r.revokedAt)
@@ -2372,18 +2402,118 @@ var IdentityProofs = class {
2372
2402
  /**
2373
2403
  * Looks up the contacts' proofs for a revocation (the Pkarr record only, not the provider): the ones standing, and the
2374
2404
  * ones withdrawn, which a removal also revokes. Not a proof already revoked, nor one past its expiry: its owner
2375
- * publishes the revocation only until then.
2405
+ * publishes the revocation only until then. True when every lookup was answered: only then is its time noted.
2406
+ *
2407
+ * Each proof answered is noted in the lookup under way (`round`, kept across a restart): one cut short (a read that
2408
+ * failed, the relays' budget still held after its tries, the network gone, the app stopped) goes on later from the
2409
+ * proofs still to look up. Started again from the first, a few keys no relay answered cost every proof's read again.
2410
+ *
2411
+ * One read every `REVOCATION_READ_GAP_MS`, the longest unread first: read back to back, the lookup took the relays'
2412
+ * whole background share for a minute, and every read past it was held back.
2376
2413
  */
2377
2414
  async checkRevocations() {
2378
- if (!this.host.online()) return;
2379
- for (const linkId of this.host.linkIds()) for (const r of this.host.ledger(linkId)?.received ?? []) {
2380
- if (this.ended) return;
2381
- if (this.revocable(r)) await this.exchange(linkId)?.recheck(r.id, { revocationOnly: true }).catch(() => {});
2415
+ if (!this.host.online()) return false;
2416
+ const at = Date.now();
2417
+ if (!this.round || at - this.round.startedAt >= REVOCATION_CHECK_MS || this.round.startedAt > at) this.round = {
2418
+ startedAt: at,
2419
+ done: []
2420
+ };
2421
+ const round = this.round, done = new Set(round.done);
2422
+ const todo = this.host.linkIds().flatMap((linkId) => (this.host.ledger(linkId)?.received ?? []).filter((r) => this.revocable(r) && !done.has(`${linkId}|${r.id}`)).map((r) => ({
2423
+ linkId,
2424
+ id: r.id
2425
+ }))).sort((a, b) => (this.lastRead.get(a.id) ?? 0) - (this.lastRead.get(b.id) ?? 0));
2426
+ let missed = false, wait = 0;
2427
+ const stops = this.stops;
2428
+ try {
2429
+ for (const { linkId, id } of todo) for (let tries = 0;; tries++) {
2430
+ if (wait > 0 && !await this.lookupPause(wait)) return false;
2431
+ if (this.ended || this.stops !== stops) return false;
2432
+ if (!this.host.online()) return false;
2433
+ this.reads.delete(id);
2434
+ await this.exchange(linkId)?.recheck(id, { revocationOnly: true }).catch(() => {});
2435
+ const read = this.reads.get(id);
2436
+ wait = typeof read === "number" ? read : REVOCATION_READ_GAP_MS;
2437
+ if (read === "failed") {
2438
+ missed = true;
2439
+ break;
2440
+ }
2441
+ if (typeof read !== "number") {
2442
+ round.done.push(`${linkId}|${id}`);
2443
+ this.saveRound(round);
2444
+ break;
2445
+ }
2446
+ if (tries >= BUDGET_TRIES) return false;
2447
+ }
2448
+ } finally {
2449
+ this.reads.clear();
2382
2450
  }
2383
- if (this.ended) return;
2451
+ if (this.ended || missed) return false;
2384
2452
  this.revocationsCheckedAt = Date.now();
2453
+ if (this.round === round) this.round = void 0;
2385
2454
  await transact([STORES.settings], (stores) => {
2386
2455
  stores[STORES.settings].put(this.revocationsCheckedAt, REVOCATIONS_CHECKED_AT);
2456
+ stores[STORES.settings].delete(REVOCATIONS_ROUND);
2457
+ });
2458
+ return true;
2459
+ }
2460
+ /** Not waited on: the writes keep their order, so the lookup's end (which deletes it) lands after. */
2461
+ saveRound(round) {
2462
+ if (this.ended || this.round !== round) return;
2463
+ transact([STORES.settings], (stores) => {
2464
+ stores[STORES.settings].put({
2465
+ ...round,
2466
+ done: [...round.done]
2467
+ }, REVOCATIONS_ROUND);
2468
+ }).catch(() => {});
2469
+ }
2470
+ /**
2471
+ * The contacts' proofs due for an automatic re-check (`AUTO_RECHECK_AFTER_S`), the longest unchecked first, a few at a
2472
+ * time, one after the other. A proof whose record or key is gone shows unconfirmed with the reason, as after "Check
2473
+ * again"; one whose server could not be reached (or a network that went away meanwhile) is left as it was and backs off.
2474
+ */
2475
+ async recheckDue() {
2476
+ if (!this.host.online()) return;
2477
+ const t = now(), at = Date.now();
2478
+ const due = [];
2479
+ for (const linkId of this.host.linkIds()) for (const r of this.host.ledger(linkId)?.received ?? []) {
2480
+ const after = this.providers().find((p) => p.id === r.binding.provider)?.recheck?.afterSeconds;
2481
+ if (after === void 0 || r.status !== "verified" && r.status !== "unconfirmed" || !this.revocable(r)) continue;
2482
+ if (t - r.checkedAt < Math.max(after, 86400) || (this.recheckBackoff.get(`${linkId}|${r.id}`)?.until ?? 0) > at) continue;
2483
+ due.push({
2484
+ linkId,
2485
+ r
2486
+ });
2487
+ }
2488
+ for (const { linkId, r } of due.sort((a, b) => a.r.checkedAt - b.r.checkedAt).slice(0, AUTO_RECHECK_BATCH)) {
2489
+ if (this.ended || !this.host.online()) return;
2490
+ const key = `${linkId}|${r.id}`;
2491
+ try {
2492
+ await this.exchange(linkId)?.recheck(r.id, { keepUnavailable: true });
2493
+ this.recheckBackoff.delete(key);
2494
+ } catch {
2495
+ const failures = (this.recheckBackoff.get(key)?.failures ?? 0) + 1;
2496
+ this.recheckBackoff.set(key, {
2497
+ failures,
2498
+ until: Date.now() + Math.min(AUTO_RECHECK_BACKOFF_MS * 2 ** (failures - 1), AUTO_RECHECK_AFTER_S * 1e3)
2499
+ });
2500
+ }
2501
+ }
2502
+ }
2503
+ /** The 12 h lookup's wait between two reads, or for the budget: false when `stop` ended it. */
2504
+ lookupPause(ms) {
2505
+ return new Promise((resolve) => {
2506
+ const timer = setTimeout(() => {
2507
+ this.timers = this.timers.filter((t) => t !== timer);
2508
+ this.wakeLookup = void 0;
2509
+ resolve(true);
2510
+ }, ms);
2511
+ this.timers.push(timer);
2512
+ this.wakeLookup = () => {
2513
+ clearTimeout(timer);
2514
+ this.wakeLookup = void 0;
2515
+ resolve(false);
2516
+ };
2387
2517
  });
2388
2518
  }
2389
2519
  revocable(r) {
@@ -2403,12 +2533,28 @@ var IdentityProofs = class {
2403
2533
  }, wait);
2404
2534
  this.timers.push(timer);
2405
2535
  }
2536
+ /** Every engine state builds these: each chat's ledger is read once for all the proofs, not once per proof. */
2406
2537
  views() {
2407
- return this.proofs.map((p) => this.viewOf(p));
2538
+ const sharedWith = this.sharedWith();
2539
+ return this.proofs.map((p) => this.viewOf(p, sharedWith));
2540
+ }
2541
+ /** The subjects of the profile's own proofs of one provider, without building their views (no chat's ledger is read). */
2542
+ subjects(provider) {
2543
+ return this.proofs.filter((p) => p.binding.provider === provider).map((p) => p.binding.subject);
2544
+ }
2545
+ /** By proof id, the chats it is shared in (not withdrawn, nor rejected by the contact). */
2546
+ sharedWith() {
2547
+ const counts = /* @__PURE__ */ new Map();
2548
+ for (const l of this.host.linkIds()) {
2549
+ const ids = /* @__PURE__ */ new Set();
2550
+ for (const s of this.host.ledger(l)?.shared ?? []) if (s.status !== "withdrawn" && s.status !== "withdrawal-pending" && s.status !== "rejected") ids.add(s.id);
2551
+ for (const id of ids) counts.set(id, (counts.get(id) ?? 0) + 1);
2552
+ }
2553
+ return counts;
2408
2554
  }
2409
- viewOf(p) {
2555
+ viewOf(p, shared = this.sharedWith()) {
2410
2556
  const id = identityStatement(p.binding).id;
2411
- const sharedWith = this.host.linkIds().filter((l) => this.host.ledger(l)?.shared.some((s) => s.id === id && s.status !== "withdrawn" && s.status !== "withdrawal-pending" && s.status !== "rejected")).length;
2557
+ const sharedWith = shared.get(id) ?? 0;
2412
2558
  const publicUri = this.publicUri(p);
2413
2559
  const expiresAt = Math.min(p.binding.expiresAt, p.verified.expiresAt ?? Infinity);
2414
2560
  const publicProfile = expiresAt > now() ? this.host.publicProfile?.(p.binding.provider, p.verified.subject) : void 0;
@@ -2512,9 +2658,11 @@ var IdentityProofs = class {
2512
2658
  async frame(linkId, frame) {
2513
2659
  const x = this.exchange(linkId);
2514
2660
  if (!x) return;
2515
- const withdrawn = frame.t === "idp-withdraw" && typeof frame.id === "string" && this.host.ledger(linkId)?.received.some((r) => r.id === frame.id && r.status !== "withdrawn" && r.status !== "revoked");
2661
+ const id = frame.t === "idp-withdraw" && typeof frame.id === "string" ? frame.id : frame.t === "idp-present" && isIdentityBinding(frame.binding) ? identityStatement(frame.binding).id : void 0;
2662
+ const withdrawn = () => !!id && !!this.host.ledger(linkId)?.received.some((r) => r.id === id && r.status === "withdrawn");
2663
+ const before = withdrawn();
2516
2664
  await x.receive(frame);
2517
- if (withdrawn && this.host.ledger(linkId)?.received.some((r) => r.id === frame.id && r.status === "withdrawn")) this.afterWithdrawal(linkId, frame.id);
2665
+ if (id && !before && withdrawn()) this.afterWithdrawal(linkId, id);
2518
2666
  }
2519
2667
  ready(linkId) {
2520
2668
  if (this.greeted.has(linkId) || !this.host.channel(linkId)) return;
@@ -2994,7 +3142,7 @@ var GroupFileDesk = class {
2994
3142
  groupId,
2995
3143
  message: file.group.message,
2996
3144
  author: file.group.author,
2997
- ...file.group.ts !== void 0 && { ts: file.group.ts },
3145
+ ...file.group.arrived !== void 0 && { arrived: file.group.arrived },
2998
3146
  meta: {
2999
3147
  name,
3000
3148
  size,
@@ -3147,8 +3295,10 @@ var GroupFileDesk = class {
3147
3295
  */
3148
3296
  async announced(groupId, m, me) {
3149
3297
  const known = this.byMessage.get(`${groupId}\n${m.id}`);
3150
- if (known) return messageFile(this.kept.get(known));
3151
- const ts = Math.min(m.ts, this.deps.now());
3298
+ if (known) {
3299
+ this.arrivedAgain(groupId, m.id, m.epoch);
3300
+ return messageFile(this.kept.get(known));
3301
+ }
3152
3302
  const ownId = m.sender === me ? this.own.get(`${groupId}\n${m.file.d}`) : void 0;
3153
3303
  if (ownId) {
3154
3304
  this.own.delete(`${groupId}\n${m.file.d}`);
@@ -3158,7 +3308,6 @@ var GroupFileDesk = class {
3158
3308
  groupId,
3159
3309
  message: m.id,
3160
3310
  author: me,
3161
- ts,
3162
3311
  meta: m.file,
3163
3312
  mine: true,
3164
3313
  auto: false,
@@ -3176,8 +3325,7 @@ var GroupFileDesk = class {
3176
3325
  await this.deps.store.patch(ownId, {
3177
3326
  group: {
3178
3327
  message: m.id,
3179
- author: me,
3180
- ts
3328
+ author: me
3181
3329
  },
3182
3330
  transfer
3183
3331
  }).catch(() => {});
@@ -3190,12 +3338,13 @@ var GroupFileDesk = class {
3190
3338
  const auto = paced && this.deps.settings().autoDownloads && fetchesByItself(m.file, this.keptAutomatically(groupId)) && await this.hasRoom(m.file.size);
3191
3339
  const holders = this.ahead.get(`${groupId}\n${m.id}`) ?? [];
3192
3340
  this.ahead.delete(`${groupId}\n${m.id}`);
3341
+ const arrived = laterEpoch(m.id, m.epoch);
3193
3342
  const kept = {
3194
3343
  id,
3195
3344
  groupId,
3196
3345
  message: m.id,
3197
3346
  author: m.sender,
3198
- ts,
3347
+ ...arrived !== void 0 && { arrived },
3199
3348
  meta: m.file,
3200
3349
  mine: false,
3201
3350
  auto,
@@ -3229,7 +3378,7 @@ var GroupFileDesk = class {
3229
3378
  group: {
3230
3379
  message: m.id,
3231
3380
  author: m.sender,
3232
- ts,
3381
+ ...arrived !== void 0 && { arrived },
3233
3382
  ...auto && { auto: true }
3234
3383
  }
3235
3384
  });
@@ -3239,6 +3388,17 @@ var GroupFileDesk = class {
3239
3388
  } else this.waiting(kept);
3240
3389
  return messageFile(kept);
3241
3390
  }
3391
+ /**
3392
+ * A message whose file is known here reached this device again, said again by its author under a later epoch (it was
3393
+ * behind): that epoch's members could read it too, and are served it.
3394
+ */
3395
+ arrivedAgain(groupId, messageId, epoch) {
3396
+ const kept = this.kept.get(this.byMessage.get(`${groupId}\n${messageId}`) ?? "");
3397
+ const arrived = laterEpoch(messageId, epoch);
3398
+ if (!kept || arrived === void 0 || arrived <= (kept.arrived ?? -1)) return;
3399
+ kept.arrived = arrived;
3400
+ this.deps.store.patch(kept.id, { group: this.groupField(kept) }).catch(() => {});
3401
+ }
3242
3402
  /** The person asks for a file this device did not fetch by itself (Download), or for one that stopped coming. */
3243
3403
  async download(fileId) {
3244
3404
  const kept = this.kept.get(fileId);
@@ -3306,7 +3466,8 @@ var GroupFileDesk = class {
3306
3466
  async frame(groupId, peer, linkId, frame) {
3307
3467
  if (frame.t === "group-want") {
3308
3468
  const want = readGroupWant(frame, groupId);
3309
- if (want) await this.serve(this.edge(groupId, peer, linkId), want.id);
3469
+ const edge = want && this.edge(groupId, peer, linkId);
3470
+ if (edge && edge.wantTaken.take()) await this.serve(edge, want.id);
3310
3471
  } else if (frame.t === "group-want-no") {
3311
3472
  const no = readGroupWantNo(frame, groupId);
3312
3473
  if (no) this.refused(groupId, peer, linkId, no.id, no.why);
@@ -3346,6 +3507,7 @@ var GroupFileDesk = class {
3346
3507
  want.movedAt = want.offeredAt = this.deps.now();
3347
3508
  want.offeredBytes = kept.stored ?? 0;
3348
3509
  want.free = void 0;
3510
+ want.knownAtOffer = new Set(kept.holders);
3349
3511
  }
3350
3512
  return edge.files.handle(frame);
3351
3513
  }
@@ -3378,6 +3540,13 @@ var GroupFileDesk = class {
3378
3540
  this.ask(kept);
3379
3541
  }
3380
3542
  this.letGo();
3543
+ this.makeRoomForWaiting();
3544
+ const freed = /* @__PURE__ */ new Set();
3545
+ for (const edge of this.edgesById.values()) if (edge.wantPaced && !this.paced(edge.linkId)) {
3546
+ edge.wantPaced = false;
3547
+ freed.add(edge.groupId);
3548
+ }
3549
+ for (const groupId of freed) this.retry(groupId);
3381
3550
  for (const edge of this.edgesById.values()) if (edge.have.size && this.deps.ready(edge.linkId)) this.sendHave(edge, [...edge.have]);
3382
3551
  for (const [groupId, have] of this.communityHave) {
3383
3552
  if (!have.ids.size || now - have.at < GROUP_FILE_LIMITS.communityHaveEveryMs) continue;
@@ -3419,7 +3588,11 @@ var GroupFileDesk = class {
3419
3588
  }
3420
3589
  /** The group's edges that are up, with files/3 live and no file asked of their member: a want could be asked on them. */
3421
3590
  freeEdges(groupId) {
3422
- return [...this.deps.edges(groupId)].filter(([, linkId]) => this.deps.ready(linkId) && this.edgesById.get(linkId)?.files.live && !this.askedOf(linkId));
3591
+ return [...this.deps.edges(groupId)].filter(([, linkId]) => this.deps.ready(linkId) && this.edgesById.get(linkId)?.files.live && !this.askedOf(linkId) && !this.paced(linkId));
3592
+ }
3593
+ /** This device sent as many wants on the edge as its window takes (`wantFrames`). */
3594
+ paced(linkId) {
3595
+ return !!this.edgesById.get(linkId)?.wantSent.wait();
3423
3596
  }
3424
3597
  /** One of these free edges (member key, link id) is one `ask` would ask this want on: asked now, it would not only queue again. */
3425
3598
  freeFor(kept, want, free) {
@@ -3427,7 +3600,7 @@ var GroupFileDesk = class {
3427
3600
  if (!membership) return false;
3428
3601
  const known = this.knownHolders(kept, membership);
3429
3602
  const others = !this.waitForKnown(kept, want, known, this.deps.edges(kept.groupId));
3430
- return free.some(([key, linkId]) => this.mayAsk(kept, want, key, linkId) && (known.includes(key) || others && key !== membership.me && membership.couldRead(key, kept.message, kept.ts)));
3603
+ return free.some(([key, linkId]) => this.mayAsk(kept, want, key, linkId) && (known.includes(key) || others && key !== membership.me && membership.couldRead(key, kept.message, kept.arrived)));
3431
3604
  }
3432
3605
  /** The members known to hold the file (its author first), in the group's roster, but this device. */
3433
3606
  knownHolders(kept, membership) {
@@ -3443,7 +3616,7 @@ var GroupFileDesk = class {
3443
3616
  waitForKnown(kept, want, known, edges) {
3444
3617
  if (!known.includes(kept.author)) return false;
3445
3618
  const linkId = edges.get(kept.author) ?? "";
3446
- return this.deps.ready(linkId) && (!!want.busy?.has(kept.author) || this.askedOf(linkId, want));
3619
+ return this.deps.ready(linkId) && (!!want.busy?.has(kept.author) || this.askedOf(linkId, want) || this.paced(linkId));
3447
3620
  }
3448
3621
  /** The want may ask this member in this round: not asked yet, it did not serve it damaged, and did not say it is gone. */
3449
3622
  mayAsk(kept, want, key, linkId) {
@@ -3468,7 +3641,7 @@ var GroupFileDesk = class {
3468
3641
  this.stopFailed(kept);
3469
3642
  return;
3470
3643
  }
3471
- const others = this.waitForKnown(kept, want, known, edges) ? [] : [...edges.keys()].filter((key) => !known.includes(key) && membership && key !== membership.me && membership.couldRead(key, kept.message, kept.ts));
3644
+ const others = this.waitForKnown(kept, want, known, edges) ? [] : [...edges.keys()].filter((key) => !known.includes(key) && membership && key !== membership.me && membership.couldRead(key, kept.message, kept.arrived));
3472
3645
  const order = [...known, ...others].filter((key) => this.mayAsk(kept, want, key, edges.get(key)));
3473
3646
  if (kept.left && order.includes(kept.left)) order.push(...order.splice(order.indexOf(kept.left), 1));
3474
3647
  for (const key of order.filter((key) => kept.suspect?.has(key))) order.push(...order.splice(order.indexOf(key), 1));
@@ -3480,6 +3653,11 @@ var GroupFileDesk = class {
3480
3653
  behind = true;
3481
3654
  continue;
3482
3655
  }
3656
+ if (this.paced(linkId)) {
3657
+ this.edgesById.get(linkId).wantPaced = true;
3658
+ behind = true;
3659
+ continue;
3660
+ }
3483
3661
  Object.assign(want, {
3484
3662
  holder: key,
3485
3663
  linkId,
@@ -3489,6 +3667,7 @@ var GroupFileDesk = class {
3489
3667
  id: kept.id,
3490
3668
  want
3491
3669
  });
3670
+ this.edgesById.get(linkId).wantSent.take();
3492
3671
  if (!this.deps.send(linkId, {
3493
3672
  t: "group-want",
3494
3673
  g: kept.groupId,
@@ -3547,13 +3726,14 @@ var GroupFileDesk = class {
3547
3726
  return false;
3548
3727
  }
3549
3728
  /**
3550
- * The holder serving this want is slow (served `slowAfterMs`, and at its pace more than `wantWaitMs` to go) and a holder
3551
- * that answered it busy said since that a place freed (`want.free`), and is free to ask: the transfer ends here, what
3552
- * came stays, and the next holder is asked (`transferChanged`), so a phone's slow upload does not keep a member the
3553
- * author or a fast holder could serve.
3729
+ * The holder serving this want is slow (served `slowAfterMs`, and at its pace more than `wantWaitMs` to go) and another
3730
+ * holder is free to ask, one known when it offered (`want.knownAtOffer`) or one that answered it busy and said since that
3731
+ * a place freed (`want.free`): the transfer ends here, what came stays, and the next holder is asked
3732
+ * (`transferChanged`), so a phone's slow upload does not keep a member the author or a fast holder could serve. (The
3733
+ * newest holder heard is asked first, whatever its pace: a phone that finished after a fast member is the one taken.)
3554
3734
  */
3555
3735
  leaveSlow(kept, want) {
3556
- if (!want.wire || !want.free?.size || want.offeredAt === void 0) return false;
3736
+ if (!want.wire || want.offeredAt === void 0) return false;
3557
3737
  const edge = want.linkId ? this.edgesById.get(want.linkId) : void 0;
3558
3738
  const record = edge?.files.get("in", want.wire);
3559
3739
  if (!edge || !record || transferEnded(record) || record.state === "verifying") return false;
@@ -3562,7 +3742,8 @@ var GroupFileDesk = class {
3562
3742
  const stored = Math.max(want.moved, kept.stored ?? 0, want.offeredBytes ?? 0), pace = (stored - (want.offeredBytes ?? 0)) / elapsed;
3563
3743
  if (pace > 0 && (kept.meta.size - stored) / pace <= GROUP_FILE_LIMITS.wantWaitMs) return false;
3564
3744
  const edges = this.deps.edges(kept.groupId);
3565
- if (![...want.free].some((key) => {
3745
+ const known = this.knownHolders(kept, this.deps.membership(kept.groupId)).filter((key) => want.knownAtOffer?.has(key));
3746
+ if (![.../* @__PURE__ */ new Set([...known, ...want.free ?? []])].some((key) => {
3566
3747
  const linkId = edges.get(key);
3567
3748
  return !!linkId && key !== want.holder && !kept.suspect?.has(key) && this.mayAsk(kept, want, key, linkId) && this.deps.ready(linkId) && !!this.edgesById.get(linkId)?.files.live && !this.askedOf(linkId, want);
3568
3749
  })) return false;
@@ -3656,7 +3837,7 @@ var GroupFileDesk = class {
3656
3837
  async serve(edge, messageId) {
3657
3838
  const kept = this.kept.get(this.byMessage.get(`${edge.groupId}\n${messageId}`) ?? "");
3658
3839
  const here = !!kept?.held && !!await this.deps.store.get(kept.id).catch(() => void 0);
3659
- const why = this.mayServe(edge, messageId, here ? kept : void 0, kept?.ts);
3840
+ const why = this.mayServe(edge, messageId, here ? kept : void 0, kept?.arrived);
3660
3841
  if (why || !kept) {
3661
3842
  this.deps.send(edge.linkId, {
3662
3843
  t: GROUP_WANT_NO_FRAME,
@@ -3691,17 +3872,19 @@ var GroupFileDesk = class {
3691
3872
  * someone who could not read the announcement, `gone` when it is not here (`kept` undefined), `busy` when serving is
3692
3873
  * off or full, `day` when this device served its bytes for the day (`serveBytesPerDay`).
3693
3874
  */
3694
- mayServe(edge, messageId, kept, ts) {
3875
+ mayServe(edge, messageId, kept, arrived) {
3695
3876
  const membership = this.deps.membership(edge.groupId);
3696
- if (!membership || !membership.couldRead(edge.peer, messageId, ts)) return "refused";
3877
+ if (!membership || !membership.couldRead(edge.peer, messageId, arrived)) return "refused";
3697
3878
  if (!kept) return "gone";
3698
3879
  if (!this.deps.settings().serveFiles || !edge.files.live) return "busy";
3699
3880
  this.letGo();
3700
3881
  const active = this.servingNow();
3701
3882
  const theirs = active.filter((a) => a.peer === edge.peer);
3702
3883
  const placed = theirs.length > 1 || theirs.some((a) => a.sending || this.deps.now() - a.since >= GROUP_FILE_LIMITS.doneWaitMs);
3703
- if (active.length >= GROUP_FILE_LIMITS.serveAtOnce && (placed || !this.makeRoom())) {
3704
- edge.busy.add(messageId);
3884
+ const full = active.length >= GROUP_FILE_LIMITS.serveAtOnce;
3885
+ const room = full && !placed ? this.roomFor() : void 0;
3886
+ if (full && !room) {
3887
+ edge.busy.set(messageId, this.deps.now());
3705
3888
  return "busy";
3706
3889
  }
3707
3890
  if (placed) return "busy";
@@ -3710,24 +3893,70 @@ var GroupFileDesk = class {
3710
3893
  day: today,
3711
3894
  bytes: 0
3712
3895
  };
3713
- const reserved = this.servingNow().reduce((sum, a) => sum + a.size, 0);
3714
- return this.served.bytes + reserved + kept.meta.size > GROUP_FILE_LIMITS.serveBytesPerDay ? "day" : null;
3896
+ const reserved = active.reduce((sum, a) => sum + a.size, 0) - (room ? room.size - room.sent : 0);
3897
+ if (this.served.bytes + reserved + kept.meta.size > GROUP_FILE_LIMITS.serveBytesPerDay) return "day";
3898
+ if (room) this.cut(room);
3899
+ return null;
3715
3900
  }
3716
- /** Ends the served transfer that has held its place longest, once past `servePlaceMs`: false when none has. */
3717
- makeRoom() {
3901
+ /**
3902
+ * The served transfer to end for a member that holds no place (undefined when none is): the one that has held its place
3903
+ * longest, once past `servePaceMs`; else the slowest of those under way for `servePaceMs` with more left to go at their
3904
+ * pace than they have been served (and than `servePaceMs`), each member's file once (its asker goes on from what it
3905
+ * stored, from the next holder or this one, and the members on fast links do not wait for the slow ones that asked
3906
+ * first). With its share of the day (as in `servingNow`) and what it sent.
3907
+ */
3908
+ roomFor() {
3718
3909
  const now = this.deps.now();
3719
3910
  let oldest;
3720
- for (const edge of this.edgesById.values()) for (const wire of edge.serving.keys()) {
3721
- const record = edge.files.get("out", wire), from = edge.servedMoved.get(wire)?.from ?? now;
3722
- if (record && !transferEnded(record) && now - from >= GROUP_FILE_LIMITS.servePlaceMs && (!oldest || from < oldest.from)) oldest = {
3911
+ let slowest;
3912
+ for (const edge of this.edgesById.values()) for (const [wire, id] of edge.serving) {
3913
+ const record = edge.files.get("out", wire), moved = edge.servedMoved.get(wire), from = moved?.from ?? now;
3914
+ if (!record || transferEnded(record)) continue;
3915
+ if (now - from >= GROUP_FILE_LIMITS.servePlaceMs && (!oldest || from < oldest.from)) oldest = {
3723
3916
  edge,
3724
3917
  wire,
3725
3918
  from
3726
3919
  };
3920
+ if (!moved?.mark || now - moved.mark[1] < GROUP_FILE_LIMITS.servePaceMs || edge.paced.has(id) || record.confirmed >= record.file.size) continue;
3921
+ const pace = (record.confirmed - moved.mark[0]) / (now - moved.mark[1]);
3922
+ if (pace > 0 && (record.file.size - record.confirmed) / pace <= Math.max(GROUP_FILE_LIMITS.servePaceMs, now - from)) continue;
3923
+ if (!slowest || pace < slowest.pace) slowest = {
3924
+ edge,
3925
+ wire,
3926
+ pace
3927
+ };
3727
3928
  }
3728
- if (!oldest) return false;
3729
- oldest.edge.files.cancel("out", oldest.wire);
3730
- return true;
3929
+ const cut = oldest ?? slowest;
3930
+ if (!cut) return void 0;
3931
+ const sent = cut.edge.files.sent(cut.wire);
3932
+ return {
3933
+ edge: cut.edge,
3934
+ wire: cut.wire,
3935
+ size: Math.max(cut.edge.files.get("out", cut.wire).file.size, sent),
3936
+ sent,
3937
+ paced: !oldest
3938
+ };
3939
+ }
3940
+ /** Ends the served transfer `roomFor` chose; one ended for its pace is not served its member again. */
3941
+ cut(room) {
3942
+ if (room.paced) room.edge.paced.add(room.edge.serving.get(room.wire));
3943
+ room.edge.files.cancel("out", room.wire);
3944
+ }
3945
+ /** Ends a served transfer for a member that holds no place (`roomFor`): false when none is. */
3946
+ makeRoom() {
3947
+ const room = this.roomFor();
3948
+ if (room) this.cut(room);
3949
+ return !!room;
3950
+ }
3951
+ /**
3952
+ * A member turned away as busy within `wantWaitMs`, holding no place, waits for the holder's word that a place freed:
3953
+ * it is made one as when it asks (`makeRoom`), and hears so.
3954
+ */
3955
+ makeRoomForWaiting() {
3956
+ if (!this.deps.settings().serveFiles) return;
3957
+ const active = this.servingNow(), now = this.deps.now();
3958
+ if (active.length < GROUP_FILE_LIMITS.serveAtOnce) return;
3959
+ if ([...this.edgesById.values()].some((edge) => edge.files.live && !active.some((a) => a.peer === edge.peer) && [...edge.busy.values()].some((at) => now - at < GROUP_FILE_LIMITS.wantWaitMs))) this.makeRoom();
3731
3960
  }
3732
3961
  /**
3733
3962
  * Transfers served now, all groups together: to whom, what each takes of the day (its size, or what it sent when that
@@ -3782,6 +4011,11 @@ var GroupFileDesk = class {
3782
4011
  if (gone || overtaken || now - moved.at >= GROUP_FILE_LIMITS.wantWaitMs) {
3783
4012
  edge.files.cancel("out", wire);
3784
4013
  theirs.set(edge.peer, theirs.get(edge.peer) - 1);
4014
+ continue;
4015
+ }
4016
+ if (moved.next && now - moved.next[1] >= GROUP_FILE_LIMITS.servePaceMs) {
4017
+ moved.mark = moved.next;
4018
+ moved.next = [record.confirmed, now];
3785
4019
  }
3786
4020
  }
3787
4021
  }
@@ -3834,8 +4068,11 @@ var GroupFileDesk = class {
3834
4068
  have: /* @__PURE__ */ new Set(),
3835
4069
  haveSent: new RateWindow(GROUP_FILE_LIMITS.haveFrames, GROUP_FILE_LIMITS.haveWindowMs, () => this.deps.now()),
3836
4070
  haveTaken: new RateWindow(GROUP_FILE_LIMITS.haveFramesTaken, GROUP_FILE_LIMITS.haveWindowMs, () => this.deps.now()),
3837
- busy: /* @__PURE__ */ new Set(),
3838
- gone: /* @__PURE__ */ new Set()
4071
+ wantSent: new RateWindow(GROUP_FILE_LIMITS.wantFrames, GROUP_FILE_LIMITS.wantWindowMs, () => this.deps.now()),
4072
+ wantTaken: new RateWindow(GROUP_FILE_LIMITS.wantFramesTaken, GROUP_FILE_LIMITS.wantWindowMs, () => this.deps.now()),
4073
+ busy: /* @__PURE__ */ new Map(),
4074
+ gone: /* @__PURE__ */ new Set(),
4075
+ paced: /* @__PURE__ */ new Set()
3839
4076
  };
3840
4077
  edge.files = new ChatFiles({
3841
4078
  uplink: this.uplink,
@@ -3942,6 +4179,7 @@ var GroupFileDesk = class {
3942
4179
  if (transferEnded(record)) this.transferOver(edge, record);
3943
4180
  if (record.direction === "out") {
3944
4181
  const moved = edge.servedMoved.get(record.id);
4182
+ if (moved && !moved.mark && record.state === "active") moved.mark = moved.next = [record.confirmed, moved.from];
3945
4183
  if (moved && record.confirmed > moved.confirmed && (record.confirmed - moved.confirmed >= GROUP_FILE_LIMITS.serveMoveBytes || record.confirmed === record.file.size)) edge.servedMoved.set(record.id, {
3946
4184
  ...moved,
3947
4185
  confirmed: record.confirmed,
@@ -3958,7 +4196,7 @@ var GroupFileDesk = class {
3958
4196
  edge.servedMoved.delete(record.id);
3959
4197
  const serving = this.deps.settings().serveFiles;
3960
4198
  for (const other of this.edgesById.values()) {
3961
- if (serving) for (const id of other.busy) other.have.add(id);
4199
+ if (serving) for (const id of other.busy.keys()) other.have.add(id);
3962
4200
  other.busy.clear();
3963
4201
  }
3964
4202
  }
@@ -4033,7 +4271,7 @@ var GroupFileDesk = class {
4033
4271
  return {
4034
4272
  message: kept.message,
4035
4273
  author: kept.author,
4036
- ...kept.ts !== void 0 && { ts: kept.ts },
4274
+ ...kept.arrived !== void 0 && { arrived: kept.arrived },
4037
4275
  ...kept.auto && { auto: true },
4038
4276
  ...kept.asked && { asked: true },
4039
4277
  ...kept.paused && { paused: true }
@@ -4099,6 +4337,11 @@ function sameView(a, b) {
4099
4337
  }
4100
4338
  /** A file's holders with `key` the newest of them, the `holders` newest kept. */
4101
4339
  var newestHolder = (key, holders) => [key, ...holders.filter((other) => other !== key)].slice(0, GROUP_FILE_LIMITS.holders);
4340
+ /** The epoch a private group's message reached this device under, when later than its own (said again); else none. */
4341
+ function laterEpoch(messageId, epoch) {
4342
+ const ref = meshMessageRef(messageId);
4343
+ return ref && epoch !== void 0 && epoch > ref.e ? epoch : void 0;
4344
+ }
4102
4345
  function messageFile(kept) {
4103
4346
  const { name, size, mime, voice, video, image } = kept.meta;
4104
4347
  return {
@@ -4112,6 +4355,6 @@ function messageFile(kept) {
4112
4355
  };
4113
4356
  }
4114
4357
  //#endregion
4115
- export { ModeChanged as $, IdentityProofs as A, INVOICE_PACE as B, FileAppender as C, streamStored as D, storedSize as E, LightningCards as F, cashuMint as G, ProviderSources as H, cardsKey as I, breezDatabasesFor as J, breezDatabase as K, isRecoveryPhrase as L, sealSecret as M, whenDataKeyDropped as N, waitingGroupFile as O, CASHU_CARD as P, relayOnlyProblem as Q, normalizePhrase as R, WALLET_TYPES as S, removeStored as T, sourceKey as U, nextInvoiceAsk as V, CASHU_MINT_SOURCE as W, iceServerProblem as X, dropBreezDatabase as Y, iceServerSetting as Z, crossNetwork as _, storedGroupFiles as a, requireTurn as at, walletInstances as b, receivedPairedReply as c, paymentAlias as d, ModeGate as et, paymentWireId as f, createTiming as g, createFailure as h, groupOfFile as i, refuseAway as it, openSecret as j, IDENTITY_DRAFT_TTL_MS as k, replyRef as l, assertConfirmedReal as m, groupFileId as n, networkLabel as nt, groupReply as o, setAwayWallets as ot, WALLET_NAMES as p, breezDatabaseInUse as q, groupFileText as r, awayFrom as rt, pairedWireReply as s, setSingleWriterGate as st, GroupFileDesk as t, WrongNetworkError as tt, replyTo as u, paymentNetwork as v, readStored as w, MESSAGE_DETAILS_MAX_BYTES as x, paymentNetworksOf as y, lightningPaying as z };
4358
+ export { WrongNetworkError as $, IdentityProofs as A, ProviderSources as B, FileAppender as C, streamStored as D, storedSize as E, normalizePhrase as F, breezDatabaseInUse as G, CASHU_MINT_SOURCE as H, journaledPayment as I, iceServerProblem as J, breezDatabasesFor as K, lightningPaying as L, LightningCards as M, cardsKey as N, waitingGroupFile as O, isRecoveryPhrase as P, ModeGate as Q, INVOICE_PACE as R, WALLET_TYPES as S, removeStored as T, cashuMint as U, sourceKey as V, breezDatabase as W, relayOnlyProblem as X, iceServerSetting as Y, ModeChanged as Z, crossNetwork as _, storedGroupFiles as a, setSingleWriterGate as at, walletInstances as b, receivedPairedReply as c, paymentAlias as d, networkLabel as et, paymentWireId as f, createTiming as g, createFailure as h, groupOfFile as i, setAwayWallets as it, CASHU_CARD as j, IDENTITY_DRAFT_TTL_MS as k, replyRef as l, assertConfirmedReal as m, groupFileId as n, refuseAway as nt, groupReply as o, WALLET_NAMES as p, dropBreezDatabase as q, groupFileText as r, requireTurn as rt, pairedWireReply as s, GroupFileDesk as t, awayFrom as tt, replyTo as u, paymentNetwork as v, readStored as w, MESSAGE_DETAILS_MAX_BYTES as x, paymentNetworksOf as y, nextInvoiceAsk as z };
4116
4359
 
4117
- //# sourceMappingURL=groupFiles-FXel6zIc.js.map
4360
+ //# sourceMappingURL=groupFiles-BAQIt_bJ.js.map