@ghostlytools/cli 1.11.3 → 1.11.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 (92) hide show
  1. package/README.md +27 -22
  2. package/SKILL.md +4 -2
  3. package/dist/assets/{api-DgU4MZPD.js → api-BwyFq4lA.js} +2 -2
  4. package/dist/assets/{api-DBlaoz8i.js → api-MYc6QNRs.js} +187 -87
  5. package/dist/assets/api-MYc6QNRs.js.map +1 -0
  6. package/dist/assets/{apiKit-DesObIDf.js → apiKit-CfsNx9ZR.js} +60 -14
  7. package/dist/assets/apiKit-CfsNx9ZR.js.map +1 -0
  8. package/dist/assets/{appFetch-C8yZIq1e.js → appFetch-DVYZOZFw.js} +2 -2
  9. package/dist/assets/{appFetch-C8yZIq1e.js.map → appFetch-DVYZOZFw.js.map} +1 -1
  10. package/dist/assets/{apps-rzxsjfBV.js → apps-Dbw2Hcko.js} +1 -1
  11. package/dist/assets/{apps-DkMjDHML.js → apps-h12II1us.js} +52 -30
  12. package/dist/assets/apps-h12II1us.js.map +1 -0
  13. package/dist/assets/{arkade-CarKONmH.js → arkade-Bw_4PZRG.js} +2 -2
  14. package/dist/assets/{arkade-CarKONmH.js.map → arkade-Bw_4PZRG.js.map} +1 -1
  15. package/dist/assets/{backup-CgWU7x0T.js → backup-CdEzTq5C.js} +1 -1
  16. package/dist/assets/{backup-C0OJCJlM.js → backup-Chvy79SN.js} +49 -36
  17. package/dist/assets/backup-Chvy79SN.js.map +1 -0
  18. package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js.map +1 -1
  19. package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +1 -1
  20. package/dist/assets/{buttons-fZTEa_2i.js → buttons-BgoExb4E.js} +6 -5
  21. package/dist/assets/{buttons-fZTEa_2i.js.map → buttons-BgoExb4E.js.map} +1 -1
  22. package/dist/assets/buttons-DK2aAGat.js +2 -0
  23. package/dist/assets/{client-Ibk3-e60.js → client-DY8tZZWi.js} +28 -8
  24. package/dist/assets/client-DY8tZZWi.js.map +1 -0
  25. package/dist/assets/{codec-DMpQqVSt.js → codec-BnMg-Grj.js} +2 -2
  26. package/dist/assets/{codec-DMpQqVSt.js.map → codec-BnMg-Grj.js.map} +1 -1
  27. package/dist/assets/{envelope-CvQVCGdf.js → envelope-CdV7vHVZ.js} +2 -2
  28. package/dist/assets/{envelope-CvQVCGdf.js.map → envelope-CdV7vHVZ.js.map} +1 -1
  29. package/dist/assets/{errors-Dt-ZnyOX.js → errors-CAh6GLJZ.js} +27 -2
  30. package/dist/assets/errors-CAh6GLJZ.js.map +1 -0
  31. package/dist/assets/{fedimintSdk-zV_5Qdqz.js → fedimintSdk-CPFfVK-G.js} +2 -2
  32. package/dist/assets/{fedimintSdk-zV_5Qdqz.js.map → fedimintSdk-CPFfVK-G.js.map} +1 -1
  33. package/dist/assets/{fixedHosts-6gKn8dp2.js → fixedHosts-CbgqrIKs.js} +3 -3
  34. package/dist/assets/{fixedHosts-6gKn8dp2.js.map → fixedHosts-CbgqrIKs.js.map} +1 -1
  35. package/dist/assets/{host-CYlIiY3r.js → host-C0NMNQLl.js} +556 -126
  36. package/dist/assets/host-C0NMNQLl.js.map +1 -0
  37. package/dist/assets/{hyperdhtRelay-CdsLcAhY.js → hyperdhtRelay-Dz7pvcBA.js} +2 -2
  38. package/dist/assets/{hyperdhtRelay-CdsLcAhY.js.map → hyperdhtRelay-Dz7pvcBA.js.map} +1 -1
  39. package/dist/assets/{irohWeb-D2IuloLL.js → irohWeb-caAj4Dms.js} +7 -7
  40. package/dist/assets/{irohWeb-D2IuloLL.js.map → irohWeb-caAj4Dms.js.map} +1 -1
  41. package/dist/assets/{main-C0PfjKTe.js → main-C6t5zrD5.js} +298 -92
  42. package/dist/assets/main-C6t5zrD5.js.map +1 -0
  43. package/dist/assets/{mainline-Cu61qcPS.js → mainline-DCuGUSZF.js} +2 -2
  44. package/dist/assets/{mainline-Cu61qcPS.js.map → mainline-DCuGUSZF.js.map} +1 -1
  45. package/dist/assets/{networkReason-Dt7Yx_n4.js → networkReason-BbQW1Xpc.js} +3 -3
  46. package/dist/assets/{networkReason-Dt7Yx_n4.js.map → networkReason-BbQW1Xpc.js.map} +1 -1
  47. package/dist/assets/{nwc-CtZypDcv.js → nwc-CSDRMZ0e.js} +3 -3
  48. package/dist/assets/{nwc-CtZypDcv.js.map → nwc-CSDRMZ0e.js.map} +1 -1
  49. package/dist/assets/{nwcProvider-DYHkd0iu.js → nwcProvider-PE0wli8n.js} +2 -2
  50. package/dist/assets/{nwcProvider-DYHkd0iu.js.map → nwcProvider-PE0wli8n.js.map} +1 -1
  51. package/dist/assets/{ownDid-CJ0ta8CL.js → ownDid-C1R5Kd8q.js} +2 -2
  52. package/dist/assets/{ownDid-CJ0ta8CL.js.map → ownDid-C1R5Kd8q.js.map} +1 -1
  53. package/dist/assets/{ownStatus-D4HC6tNR.js → ownStatus-BoTf5WqQ.js} +19 -6
  54. package/dist/assets/ownStatus-BoTf5WqQ.js.map +1 -0
  55. package/dist/assets/{profiles-Ccdq6Xf6.js → profiles-DszHjEJi.js} +25 -10
  56. package/dist/assets/profiles-DszHjEJi.js.map +1 -0
  57. package/dist/assets/{registry-LvxsLJ5S.js → registry-Da-r6eC3.js} +17 -10
  58. package/dist/assets/registry-Da-r6eC3.js.map +1 -0
  59. package/dist/assets/{registry-CE0PpQAE.js → registry-zUZBSHYv.js} +1 -1
  60. package/dist/assets/{resolve-6kVu2DE5.js → resolve-tUzh4lHh.js} +2 -2
  61. package/dist/assets/{resolve-6kVu2DE5.js.map → resolve-tUzh4lHh.js.map} +1 -1
  62. package/dist/assets/{secretGuard-B7Hj0Kvz.js → secretGuard-CsVHDdYk.js} +68 -6
  63. package/dist/assets/{secretGuard-B7Hj0Kvz.js.map → secretGuard-CsVHDdYk.js.map} +1 -1
  64. package/dist/assets/secretGuard-DCb1I0_B.js +2 -0
  65. package/dist/assets/{server-Q3VcNqGt.js → server-C1jZZ61O.js} +667 -196
  66. package/dist/assets/server-C1jZZ61O.js.map +1 -0
  67. package/dist/assets/{src-DjVj2ynY.js → src-DJe-OYxd.js} +826 -198
  68. package/dist/assets/src-DJe-OYxd.js.map +1 -0
  69. package/dist/assets/{sshForges-DeZ9cN9Q.js → sshForges-C9zTO72R.js} +2 -2
  70. package/dist/assets/{sshForges-DeZ9cN9Q.js.map → sshForges-C9zTO72R.js.map} +1 -1
  71. package/dist/assets/{translate-iQZq4TnY.js → translate-CUuC5szR.js} +3 -3
  72. package/dist/assets/{translate-iQZq4TnY.js.map → translate-CUuC5szR.js.map} +1 -1
  73. package/dist/assets/{usdt-DnyTGdTX.js → usdt-DI51znt-.js} +3 -3
  74. package/dist/assets/{usdt-DnyTGdTX.js.map → usdt-DI51znt-.js.map} +1 -1
  75. package/dist/ghostly.mjs +1 -1
  76. package/npm-shrinkwrap.json +2 -2
  77. package/package.json +1 -1
  78. package/dist/assets/api-DBlaoz8i.js.map +0 -1
  79. package/dist/assets/apiKit-DesObIDf.js.map +0 -1
  80. package/dist/assets/apps-DkMjDHML.js.map +0 -1
  81. package/dist/assets/backup-C0OJCJlM.js.map +0 -1
  82. package/dist/assets/buttons-Cco0Agfa.js +0 -2
  83. package/dist/assets/client-Ibk3-e60.js.map +0 -1
  84. package/dist/assets/errors-Dt-ZnyOX.js.map +0 -1
  85. package/dist/assets/host-CYlIiY3r.js.map +0 -1
  86. package/dist/assets/main-C0PfjKTe.js.map +0 -1
  87. package/dist/assets/ownStatus-D4HC6tNR.js.map +0 -1
  88. package/dist/assets/profiles-Ccdq6Xf6.js.map +0 -1
  89. package/dist/assets/registry-LvxsLJ5S.js.map +0 -1
  90. package/dist/assets/secretGuard-DUr6bgKc.js +0 -2
  91. package/dist/assets/server-Q3VcNqGt.js.map +0 -1
  92. package/dist/assets/src-DjVj2ynY.js.map +0 -1
@@ -1017,7 +1017,7 @@ var staleTurn = (turn, now) => now - Math.max(turn.askedAt, turn.servedAt) >= 6e
1017
1017
  * Counted as they were, an hour's step back held every background read for 59 minutes, and a daemon with 50 contacts
1018
1018
  * away read 4 of them in the next 15 (bug hunt, 2026-11-07).
1019
1019
  */
1020
- var within = (list, now, ms) => list.map((at) => Math.min(at, now)).filter((at) => now - at < ms);
1020
+ var within$1 = (list, now, ms) => list.map((at) => Math.min(at, now)).filter((at) => now - at < ms);
1021
1021
  /**
1022
1022
  * Keys and when each was last set, those of the last minute: how many and the latest, without walking them all (the
1023
1023
  * chats that need a relay, `chatNeeds`). Each is set at the time it is set, so the sets come oldest first; a clock
@@ -2181,7 +2181,7 @@ var RelayTransport = class {
2181
2181
  */
2182
2182
  hedgeRoom(relay) {
2183
2183
  const now = Date.now();
2184
- return within(this.spent.get(relay) ?? [], now, 6e4).length < this.limitOf(relay) - this.reserveOf(relay);
2184
+ return within$1(this.spent.get(relay) ?? [], now, 6e4).length < this.limitOf(relay) - this.reserveOf(relay);
2185
2185
  }
2186
2186
  readAnsweredAt(pubKeyZ32) {
2187
2187
  return this.readAt.get(pubKeyZ32);
@@ -2368,7 +2368,7 @@ var RelayTransport = class {
2368
2368
  if (isGroupSignal(who)) this.spentGroupSignal.get(relay).push(now);
2369
2369
  const departedOver = isDepartedRead(who) && this.spent.get(relay).length >= this.limitOf(relay);
2370
2370
  if (departedOver) this.overAdd(this.departedOver, key, now);
2371
- if (isAwaitedRead(who) && this.spent.get(relay).length >= this.limitOf(relay)) this.awaitedOver = [...within(this.awaitedOver, now, 6e4), now];
2371
+ if (isAwaitedRead(who) && this.spent.get(relay).length >= this.limitOf(relay)) this.awaitedOver = [...within$1(this.awaitedOver, now, 6e4), now];
2372
2372
  this.spent.get(relay).push(now);
2373
2373
  if (who.background) this.spentBackground.get(relay).push(now);
2374
2374
  if (who.background && who.write) this.spentBackgroundWrites.get(relay).push(now);
@@ -2403,26 +2403,26 @@ var RelayTransport = class {
2403
2403
  * without its own allowance (`ANSWER_READ_ALLOWANCE`).
2404
2404
  */
2405
2405
  heldFor(relay, who, now = Date.now(), key, turns = true, ownAllowance = true) {
2406
- const recent = within(this.spent.get(relay) ?? [], now, 6e4);
2407
- const recentBackground = within(this.spentBackground.get(relay) ?? [], now, 6e4);
2406
+ const recent = within$1(this.spent.get(relay) ?? [], now, 6e4);
2407
+ const recentBackground = within$1(this.spentBackground.get(relay) ?? [], now, 6e4);
2408
2408
  this.spent.set(relay, recent);
2409
2409
  this.spentBackground.set(relay, recentBackground);
2410
- const recentBackgroundWrites = within(this.spentBackgroundWrites.get(relay) ?? [], now, 6e4);
2410
+ const recentBackgroundWrites = within$1(this.spentBackgroundWrites.get(relay) ?? [], now, 6e4);
2411
2411
  this.spentBackgroundWrites.set(relay, recentBackgroundWrites);
2412
2412
  const over = (list, limit) => list.length >= limit ? list[list.length - limit] + 6e4 - now : 0;
2413
2413
  const limit = this.limitOf(relay);
2414
2414
  const departed = isDepartedRead(who) && key !== void 0 && recent.length >= limit && this.overReads(this.departedOver, key, now) < 6;
2415
- if (isAwaitedRead(who)) this.awaitedOver = within(this.awaitedOver, now, 6e4);
2415
+ if (isAwaitedRead(who)) this.awaitedOver = within$1(this.awaitedOver, now, 6e4);
2416
2416
  const awaited = isAwaitedRead(who) && key !== void 0 && recent.length >= limit && this.awaitedOver.length < 4;
2417
2417
  const share = isChatSignal(who) || departed || awaited ? SIGNALING_ALLOWANCE_SHARE : isGroupSignal(who) ? GROUP_SIGNALING_ALLOWANCE_SHARE : 0;
2418
2418
  let allowance = share ? Math.max(0, Math.floor(limit * share) - (who.write ? 0 : 1)) : 0;
2419
2419
  if (departed && now - this.awaitedAt < 6e4) allowance = Math.max(0, allowance - 2);
2420
- const groupSignaled = within(this.spentGroupSignal.get(relay) ?? [], now, 6e4);
2420
+ const groupSignaled = within$1(this.spentGroupSignal.get(relay) ?? [], now, 6e4);
2421
2421
  this.spentGroupSignal.set(relay, groupSignaled);
2422
2422
  const groupFloor = isGroupSignal(who) && groupSignaled.length < allowance;
2423
2423
  let wait = groupFloor ? 0 : over(recent, limit + allowance);
2424
2424
  const starved = key !== void 0 && this.starved(key, who, now);
2425
- const groupOver = within(this.spentGroupOver.get(relay) ?? [], now, GROUP_OVER_PACE_MS);
2425
+ const groupOver = within$1(this.spentGroupOver.get(relay) ?? [], now, GROUP_OVER_PACE_MS);
2426
2426
  this.spentGroupOver.set(relay, groupOver);
2427
2427
  if (isGroupSignal(who) && !who.write && recent.length >= limit && groupOver.length > 0) wait = Math.max(wait, groupOver[groupOver.length - 1] + GROUP_OVER_PACE_MS - now);
2428
2428
  if (who.background && !starved) {
@@ -2432,16 +2432,16 @@ var RelayTransport = class {
2432
2432
  const signaling = this.urgentAt + SIGNALING_WINDOW_MS - now;
2433
2433
  if (signaling > 0 && !who.door) wait = Math.max(wait, Math.min(signaling, over(recentBackground, Math.min(this.backgroundWhileSignaling, Math.ceil(limit / 6)))));
2434
2434
  }
2435
- const burst = within(this.spentGroupUrgent.get(relay) ?? [], now, GROUP_BURST_MS);
2435
+ const burst = within$1(this.spentGroupUrgent.get(relay) ?? [], now, GROUP_BURST_MS);
2436
2436
  this.spentGroupUrgent.set(relay, burst);
2437
- const answerBurst = within(this.spentAnswerUrgent.get(relay) ?? [], now, GROUP_BURST_MS);
2437
+ const answerBurst = within$1(this.spentAnswerUrgent.get(relay) ?? [], now, GROUP_BURST_MS);
2438
2438
  this.spentAnswerUrgent.set(relay, answerBurst);
2439
2439
  if (isGroupUrgentRead(who)) {
2440
2440
  const most = Math.max(8, Math.floor(limit * GROUP_BURST_MS / 6e4));
2441
2441
  const spent = isGroupAnswerRead(who) ? answerBurst : burst;
2442
2442
  if (spent.length >= most) wait = Math.max(wait, spent[spent.length - most] + GROUP_BURST_MS - now);
2443
2443
  }
2444
- const watched = within(this.spentWatch.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2444
+ const watched = within$1(this.spentWatch.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2445
2445
  this.spentWatch.set(relay, watched);
2446
2446
  let turn = 0;
2447
2447
  if (isWatch(who)) {
@@ -2449,14 +2449,14 @@ var RelayTransport = class {
2449
2449
  if (watched.length >= most) wait = Math.max(wait, watched[watched.length - most] + GROUP_RATION_WINDOW_MS - now);
2450
2450
  if (this.readsAhead(key, now, watchLane(who)) > 0) turn = TURN_WAIT_MS;
2451
2451
  }
2452
- const chatWatched = within(this.spentChatWatch.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2452
+ const chatWatched = within$1(this.spentChatWatch.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2453
2453
  this.spentChatWatch.set(relay, chatWatched);
2454
2454
  if (isChatWatch(who) && !departed) {
2455
2455
  const most = Math.max(1, Math.ceil(limit * CHAT_WATCH_SHARE * GROUP_RATION_WINDOW_MS / 6e4));
2456
2456
  if (chatWatched.length >= most) wait = Math.max(wait, chatWatched[chatWatched.length - most] + GROUP_RATION_WINDOW_MS - now);
2457
2457
  if (this.readsAhead(key, now, watchLane(who)) > 0) turn = TURN_WAIT_MS;
2458
2458
  }
2459
- const rationed = within(this.spentGroupReads.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2459
+ const rationed = within$1(this.spentGroupReads.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2460
2460
  this.spentGroupReads.set(relay, rationed);
2461
2461
  const pastLimit = isGroupSignal(who) && recent.length >= limit;
2462
2462
  if (isGroupRead(who) && !pastLimit && now - (this.groupsFullAt.get(relay) ?? -Infinity) < GROUP_RATION_MS) {
@@ -2490,7 +2490,7 @@ var RelayTransport = class {
2490
2490
  * than it in the last minute, and none within `ANSWER_READ_SPACING_MS`. None where the groups have no allowance.
2491
2491
  */
2492
2492
  answerAllowanceFree(relay, now) {
2493
- const spent = within(this.spentAnswerAllowance.get(relay) ?? [], now, 6e4);
2493
+ const spent = within$1(this.spentAnswerAllowance.get(relay) ?? [], now, 6e4);
2494
2494
  this.spentAnswerAllowance.set(relay, spent);
2495
2495
  const most = Math.min(3, Math.floor(this.limitOf(relay) * GROUP_SIGNALING_ALLOWANCE_SHARE));
2496
2496
  return spent.length < most && (spent.length === 0 || now - spent[spent.length - 1] >= 2e4);
@@ -2515,7 +2515,7 @@ var RelayTransport = class {
2515
2515
  }
2516
2516
  /** 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. */
2517
2517
  wayBackLeft(relay, who, now) {
2518
- const spent = within(this.spentWayBack.get(relay) ?? [], now, 6e4);
2518
+ const spent = within$1(this.spentWayBack.get(relay) ?? [], now, 6e4);
2519
2519
  this.spentWayBack.set(relay, spent);
2520
2520
  return Math.floor(this.limitOf(relay) * WAY_BACK_SHARE) - (who.write ? 0 : 1) - spent.length;
2521
2521
  }
@@ -2599,7 +2599,7 @@ var RelayTransport = class {
2599
2599
  }
2600
2600
  /** This key's departed reads past the limit in the last minute (`DEPARTED_READS`). */
2601
2601
  overReads(over, key, now) {
2602
- const reads = within(over.get(key) ?? [], now, 6e4);
2602
+ const reads = within$1(over.get(key) ?? [], now, 6e4);
2603
2603
  if (reads.length) over.set(key, reads);
2604
2604
  else over.delete(key);
2605
2605
  return reads.length;
@@ -2647,7 +2647,7 @@ var RelayTransport = class {
2647
2647
  spareHeldFor(relay, now) {
2648
2648
  const reserved = this.chatReservedFor(relay, now);
2649
2649
  if (reserved <= 0) return 0;
2650
- const recent = within(this.spent.get(relay) ?? [], now, 6e4);
2650
+ const recent = within$1(this.spent.get(relay) ?? [], now, 6e4);
2651
2651
  const keep = this.limitOf(relay) - this.chatReserveOf(relay, now);
2652
2652
  return recent.length >= keep ? Math.min(reserved, recent[recent.length - keep] + 6e4 - now) : 0;
2653
2653
  }
@@ -2970,7 +2970,7 @@ var TurnRecordError = class extends Error {
2970
2970
  this.name = "TurnRecordError";
2971
2971
  }
2972
2972
  };
2973
- var refuse = (refusal, detail) => {
2973
+ var refuse$1 = (refusal, detail) => {
2974
2974
  throw new TurnRecordError(refusal, detail);
2975
2975
  };
2976
2976
  var isZero = (bytes) => bytes.every((b) => b === 0);
@@ -3066,70 +3066,70 @@ async function signTurnBody(address, fields, signer) {
3066
3066
  * against the device that was active before) is the caller's: `turnRead.ts`.
3067
3067
  */
3068
3068
  function readTurnBody(body, address) {
3069
- if (body.length !== 374) refuse("length");
3070
- if (body[OFFSET.version] !== 1) refuse("version");
3069
+ if (body.length !== 374) refuse$1("length");
3070
+ if (body[OFFSET.version] !== 1) refuse$1("version");
3071
3071
  const turn = new DataView(body.buffer, body.byteOffset, body.byteLength).getUint32(OFFSET.turn);
3072
3072
  const rev = body[OFFSET.rev] << 16 | body[OFFSET.rev + 1] << 8 | body[OFFSET.rev + 2];
3073
- if (rev >= TURN_REV_LIMIT) refuse("rev");
3073
+ if (rev >= TURN_REV_LIMIT) refuse$1("rev");
3074
3074
  const author = body[OFFSET.author], active = body[OFFSET.active], count = body[OFFSET.count];
3075
- if (author >= 4) refuse("author");
3076
- if (active >= 4 && active !== 255) refuse("active");
3077
- if (count > 4) refuse("count");
3075
+ if (author >= 4) refuse$1("author");
3076
+ if (active >= 4 && active !== 255) refuse$1("active");
3077
+ if (count > 4) refuse$1("count");
3078
3078
  const slots = [];
3079
3079
  const decoder = new TextDecoder("utf-8", { fatal: true });
3080
3080
  for (let i = 0; i < 4; i++) {
3081
3081
  const at = OFFSET.slots + i * SLOT_BYTES;
3082
3082
  const key = body.slice(at, at + 32), padded = body.subarray(at + 32, at + SLOT_BYTES);
3083
3083
  if (isZero(key)) {
3084
- if (!isZero(padded)) refuse("slots");
3084
+ if (!isZero(padded)) refuse$1("slots");
3085
3085
  slots.push(null);
3086
3086
  continue;
3087
3087
  }
3088
3088
  const end = padded.indexOf(0);
3089
3089
  const name = end < 0 ? padded : padded.subarray(0, end);
3090
- if (end >= 0 && !isZero(padded.subarray(end))) refuse("name");
3090
+ if (end >= 0 && !isZero(padded.subarray(end))) refuse$1("name");
3091
3091
  let text = "";
3092
3092
  try {
3093
3093
  text = decoder.decode(name);
3094
3094
  } catch {
3095
- refuse("name");
3095
+ refuse$1("name");
3096
3096
  }
3097
- if (slots.some((other) => other && bytesEqual(other.key, key))) refuse("slots", "one key in two slots");
3097
+ if (slots.some((other) => other && bytesEqual(other.key, key))) refuse$1("slots", "one key in two slots");
3098
3098
  slots.push({
3099
3099
  key,
3100
3100
  name: turnName(text)
3101
3101
  });
3102
3102
  }
3103
- if (slots.filter(Boolean).length !== count) refuse("count");
3103
+ if (slots.filter(Boolean).length !== count) refuse$1("count");
3104
3104
  const authorSlot = slots[author];
3105
- if (!authorSlot) return refuse("author");
3105
+ if (!authorSlot) return refuse$1("author");
3106
3106
  const tombstone = turn === TOMBSTONE_TURN;
3107
- if (tombstone !== (active === 255)) refuse("tombstone");
3107
+ if (tombstone !== (active === 255)) refuse$1("tombstone");
3108
3108
  if (!tombstone) {
3109
- if (!slots[active]) refuse("active");
3110
- if (author !== active) refuse("author-not-active");
3109
+ if (!slots[active]) refuse$1("active");
3110
+ if (author !== active) refuse$1("author-not-active");
3111
3111
  }
3112
3112
  const present = body[OFFSET.releasePresent];
3113
- if (present > 1) refuse("release-layout");
3113
+ if (present > 1) refuse$1("release-layout");
3114
3114
  let release;
3115
3115
  if (!present) {
3116
- if (!isZero(body.subarray(OFFSET.releaseFrom, OFFSET.signature))) refuse("release-layout");
3116
+ if (!isZero(body.subarray(OFFSET.releaseFrom, OFFSET.signature))) refuse$1("release-layout");
3117
3117
  } else {
3118
- if (tombstone) refuse("tombstone", "a tombstone carries no release");
3118
+ if (tombstone) refuse$1("tombstone", "a tombstone carries no release");
3119
3119
  const from = body[OFFSET.releaseFrom], to = body[OFFSET.releaseTo];
3120
3120
  const fromSlot = from < 4 ? slots[from] : null, toSlot = to < 4 ? slots[to] : null;
3121
- if (!fromSlot || !toSlot) return refuse("release-layout");
3121
+ if (!fromSlot || !toSlot) return refuse$1("release-layout");
3122
3122
  release = {
3123
3123
  from,
3124
3124
  to,
3125
3125
  h: body.slice(OFFSET.releaseH, OFFSET.releaseSignature),
3126
3126
  signature: body.slice(OFFSET.releaseSignature, OFFSET.signature)
3127
3127
  };
3128
- if (to !== active) refuse("release", "the release is to another device than the active one");
3129
- if (!verify(release.signature, turnReleaseMessage(address, turn, toSlot.key, release.h), fromSlot.key)) refuse("release");
3128
+ if (to !== active) refuse$1("release", "the release is to another device than the active one");
3129
+ if (!verify(release.signature, turnReleaseMessage(address, turn, toSlot.key, release.h), fromSlot.key)) refuse$1("release");
3130
3130
  }
3131
3131
  const signature = body.slice(OFFSET.signature);
3132
- if (!verify(signature, turnSignedMessage(address, body), authorSlot.key)) refuse("signature");
3132
+ if (!verify(signature, turnSignedMessage(address, body), authorSlot.key)) refuse$1("signature");
3133
3133
  return {
3134
3134
  turn,
3135
3135
  rev,
@@ -4237,7 +4237,7 @@ function parseImageMeta(value, mime) {
4237
4237
  var u16be$1 = (b, at) => b[at] << 8 | b[at + 1];
4238
4238
  var u16le = (b, at) => b[at] | b[at + 1] << 8;
4239
4239
  var u24le = (b, at) => b[at] | b[at + 1] << 8 | b[at + 2] << 16;
4240
- var u32be$2 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
4240
+ var u32be$3 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
4241
4241
  var ascii = (b, at, text) => [...text].every((c, i) => b[at + i] === c.charCodeAt(0));
4242
4242
  var sized = (width, height) => edge(width) && edge(height) ? {
4243
4243
  width,
@@ -4265,7 +4265,7 @@ function exifOrientation(b, tiff, end) {
4265
4265
  const little = ascii(b, tiff, "II");
4266
4266
  if (!little && !ascii(b, tiff, "MM")) return 1;
4267
4267
  const u16 = (at) => little ? u16le(b, at) : u16be$1(b, at);
4268
- const u32 = (at) => little ? u16le(b, at) + u16le(b, at + 2) * 65536 : u32be$2(b, at);
4268
+ const u32 = (at) => little ? u16le(b, at) + u16le(b, at + 2) * 65536 : u32be$3(b, at);
4269
4269
  if (u16(tiff + 2) !== 42) return 1;
4270
4270
  const ifd = tiff + u32(tiff + 4);
4271
4271
  if (ifd + 2 > end) return 1;
@@ -4350,7 +4350,7 @@ function gifSize(b) {
4350
4350
  function imageSize(head) {
4351
4351
  const b = head;
4352
4352
  try {
4353
- if (b.length >= 24 && b[0] === 137 && ascii(b, 1, "PNG\r\n\n") && ascii(b, 12, "IHDR")) return sized(u32be$2(b, 16), u32be$2(b, 20));
4353
+ if (b.length >= 24 && b[0] === 137 && ascii(b, 1, "PNG\r\n\n") && ascii(b, 12, "IHDR")) return sized(u32be$3(b, 16), u32be$3(b, 20));
4354
4354
  if (b.length >= 10 && (ascii(b, 0, "GIF87a") || ascii(b, 0, "GIF89a"))) return gifSize(b);
4355
4355
  if (b.length >= 4 && b[0] === 255 && b[1] === 216 && b[2] === 255) return jpegSize(b);
4356
4356
  if (b.length >= 16 && ascii(b, 0, "RIFF") && ascii(b, 8, "WEBP")) return webpSize(b);
@@ -7426,6 +7426,24 @@ var LIMITS = {
7426
7426
  */
7427
7427
  maxClientWaiting: 64,
7428
7428
  maxClientWaitingBodyBytes: 67108864,
7429
+ /**
7430
+ * Response-body bytes a client holds for one response before whatever reads it took them. Past it, a response its
7431
+ * reader takes nothing of for `unreadStallMs` is reset: its reader stalled. Four times what a host keeps buffered on
7432
+ * the link (`sendHighWaterMark`), so a reader that keeps up never reaches it.
7433
+ */
7434
+ maxUnreadResponseBytes: 4194304,
7435
+ /**
7436
+ * How long a reader past `maxUnreadResponseBytes` may take nothing before its response is reset. One that keeps
7437
+ * reading, only slower than the link (a video playing as it arrives, a contact's app read through the web's services
7438
+ * worker), is not cut: it holds up to the response's own bound.
7439
+ */
7440
+ unreadStallMs: 2e3,
7441
+ /**
7442
+ * Response-body bytes a client holds for all its responses before their readers took them. Past it, a response over
7443
+ * `maxUnreadResponseBytes` is reset at once, its reader's pace aside: one slow reader keeps its whole response (as
7444
+ * much as `maxResponseBodyBytes`), but many cannot add up (a contact's app reading each answer a chunk at a time).
7445
+ */
7446
+ maxClientUnreadResponseBytes: 67108864,
7429
7447
  maxChatMessageBytes: 16384,
7430
7448
  maxFileBytes: 104857600,
7431
7449
  /** Files a peer may be sending us at once. */
@@ -7795,10 +7813,11 @@ function resolveTargetUrl(target, path) {
7795
7813
  if (!path.startsWith("/") || path.startsWith("//")) return null;
7796
7814
  for (const char of path) {
7797
7815
  const code = char.codePointAt(0) ?? 0;
7798
- if (code <= 32 || code === 127 || char === "\\") return null;
7816
+ if (code <= 32 || code === 127) return null;
7799
7817
  }
7800
7818
  const queryAt = path.indexOf("?");
7801
7819
  const pathPart = queryAt === -1 ? path : path.slice(0, queryAt);
7820
+ if (pathPart.includes("\\")) return null;
7802
7821
  if (/%(2f|5c|2e)/i.test(pathPart)) return null;
7803
7822
  if (pathPart.split("/").some(climbsOut)) return null;
7804
7823
  let url;
@@ -7877,14 +7896,15 @@ function sanitizeRequestHeaders(headers) {
7877
7896
  return !DROPPED_REQUEST_HEADER_PREFIXES.some((prefix) => lower.startsWith(prefix));
7878
7897
  });
7879
7898
  }
7880
- function sanitizeResponseHeaders(headers, target) {
7899
+ /** `from`: the local URL of the request answered, the one a relative `Location` is read against. */
7900
+ function sanitizeResponseHeaders(headers, target, from) {
7881
7901
  const out = [];
7882
7902
  for (const [name, value] of headers) {
7883
7903
  const lower = name.toLowerCase();
7884
7904
  if (!HEADER_NAME.test(name) || !isCleanHeaderValue(value)) continue;
7885
7905
  if (HOP_BY_HOP.has(lower) || DROPPED_RESPONSE_HEADERS.has(lower)) continue;
7886
7906
  if (lower === "location" || lower === "content-location") {
7887
- const location = relativizeLocation(value, target);
7907
+ const location = relativizeLocation(value, target, from);
7888
7908
  if (location !== null) out.push([name, location]);
7889
7909
  } else if (lower === "set-cookie") out.push([name, value.replace(/;\s*domain\s*=[^;]*/gi, "")]);
7890
7910
  else out.push([name, value]);
@@ -7910,12 +7930,14 @@ function sanitizeResponseHeaders(headers, target) {
7910
7930
  /**
7911
7931
  * Turns `http://localhost:3400/base/x` into `/x` so the client never learns or
7912
7932
  * follows the local address. Null when the location is not on the target origin
7913
- * and under its base path.
7933
+ * and under its base path. A relative one (`edit`, `?page=2`, `../x`) is read
7934
+ * against `from`, the local URL of the request it answers, as a browser reads it;
7935
+ * without one, against the base path.
7914
7936
  */
7915
- function relativizeLocation(location, target) {
7937
+ function relativizeLocation(location, target, from) {
7916
7938
  let url;
7917
7939
  try {
7918
- url = new URL(location, `${target.origin}${target.basePath}/`);
7940
+ url = new URL(location, from ?? `${target.origin}${target.basePath}/`);
7919
7941
  } catch {
7920
7942
  return null;
7921
7943
  }
@@ -7928,10 +7950,10 @@ function relativizeLocation(location, target) {
7928
7950
  if (!path.startsWith("/") || path.startsWith("//")) return null;
7929
7951
  return `${path}${url.search}${url.hash}`;
7930
7952
  }
7931
- function isRedirectBlocked(response, target) {
7953
+ function isRedirectBlocked(response, target, from) {
7932
7954
  if (response.status < 300 || response.status > 399) return false;
7933
7955
  const location = response.headers.find(([name]) => name.toLowerCase() === "location");
7934
- return location !== void 0 && relativizeLocation(location[1], target) === null;
7956
+ return location !== void 0 && relativizeLocation(location[1], target, from) === null;
7935
7957
  }
7936
7958
  var ALLOWED_METHODS = /* @__PURE__ */ new Set([
7937
7959
  "GET",
@@ -7956,6 +7978,8 @@ var HttpHost = class {
7956
7978
  live = /* @__PURE__ */ new Set();
7957
7979
  /** Body bytes of the streams in `live`: a peer cannot make the host hold more than `maxHostBodyBytesPerPeer`. */
7958
7980
  heldBodyBytes = 0;
7981
+ /** One listener per `revoked` signal of the open streams, not one per stream: a page opens dozens at once. */
7982
+ revokedListeners = /* @__PURE__ */ new Map();
7959
7983
  constructor(channel, getService, localFetch) {
7960
7984
  this.channel = channel;
7961
7985
  this.getService = getService;
@@ -7968,7 +7992,7 @@ var HttpHost = class {
7968
7992
  if (this.streams.has(frame.id)) return;
7969
7993
  const method = frame.m.toUpperCase();
7970
7994
  const service = this.getService(frame.s);
7971
- if (!service) return this.fail(frame.id, 404, "unknown-service", "This peer does not share that service.");
7995
+ if (!service || service.revoked?.aborted) return this.fail(frame.id, 404, "unknown-service", "This peer does not share that service.");
7972
7996
  if (!ALLOWED_METHODS.has(method)) return this.fail(frame.id, 405, "method-not-allowed", "Method not allowed.");
7973
7997
  if (this.live.size >= LIMITS.maxConcurrentRequestsPerPeer) return this.fail(frame.id, 503, "busy", "Too many concurrent requests.");
7974
7998
  const url = resolveTargetUrl(service.target, frame.p);
@@ -7988,6 +8012,7 @@ var HttpHost = class {
7988
8012
  };
7989
8013
  this.streams.set(frame.id, stream);
7990
8014
  this.live.add(stream);
8015
+ if (service.revoked) this.watchRevoked(service.revoked);
7991
8016
  if (frame.b && !BODYLESS_METHODS.has(method)) this.watchPace(stream);
7992
8017
  else this.run(stream);
7993
8018
  }
@@ -8036,6 +8061,33 @@ var HttpHost = class {
8036
8061
  stream.abort.abort();
8037
8062
  if (this.isCurrent(stream)) this.streams.delete(stream.frame.id);
8038
8063
  if (!stream.started) this.release(stream);
8064
+ const revoked = stream.service.revoked;
8065
+ const listener = revoked && this.revokedListeners.get(revoked);
8066
+ if (listener && ![...this.streams.values()].some((s) => s.service.revoked === revoked)) {
8067
+ revoked.removeEventListener("abort", listener);
8068
+ this.revokedListeners.delete(revoked);
8069
+ }
8070
+ }
8071
+ /** An answer still on its way would reach someone the app is no longer shared with: those streams are reset. */
8072
+ watchRevoked(revoked) {
8073
+ if (this.revokedListeners.has(revoked)) return;
8074
+ const listener = () => {
8075
+ this.revokedListeners.delete(revoked);
8076
+ for (const stream of [...this.streams.values()]) {
8077
+ if (stream.service.revoked !== revoked) continue;
8078
+ this.end(stream);
8079
+ try {
8080
+ this.channel.send(encodeControl({
8081
+ t: "rst",
8082
+ id: stream.frame.id,
8083
+ d: "s",
8084
+ e: "The app is no longer shared with you."
8085
+ }));
8086
+ } catch {}
8087
+ }
8088
+ };
8089
+ this.revokedListeners.set(revoked, listener);
8090
+ revoked.addEventListener("abort", listener, { once: true });
8039
8091
  }
8040
8092
  /** The stream no longer counts toward the limits: its body is dropped, or its local fetch has settled. */
8041
8093
  release(stream) {
@@ -8087,7 +8139,7 @@ var HttpHost = class {
8087
8139
  }));
8088
8140
  return;
8089
8141
  }
8090
- if (isRedirectBlocked(response, service.target)) {
8142
+ if (isRedirectBlocked(response, service.target, stream.url)) {
8091
8143
  this.end(stream);
8092
8144
  return this.fail(frame.id, 502, "redirect-blocked", "The service redirected outside of the shared target.");
8093
8145
  }
@@ -8096,7 +8148,7 @@ var HttpHost = class {
8096
8148
  t: "res",
8097
8149
  id: frame.id,
8098
8150
  st: response.status,
8099
- h: sanitizeResponseHeaders(response.headers, service.target),
8151
+ h: sanitizeResponseHeaders(response.headers, service.target, stream.url),
8100
8152
  b: hasBody
8101
8153
  };
8102
8154
  this.channel.send(encodeControl(res));
@@ -8168,12 +8220,23 @@ var GhostlyHttpError = class extends Error {
8168
8220
  }
8169
8221
  };
8170
8222
  var BodyQueue = class {
8223
+ all;
8171
8224
  chunks = [];
8172
8225
  done = false;
8173
8226
  error = null;
8174
8227
  wake = null;
8228
+ /** Bytes received and not yet read. */
8229
+ held = 0;
8230
+ /** Bytes read so far, all told. */
8231
+ taken = 0;
8232
+ /** `all`: what every queue of the same client holds, kept with this one's. */
8233
+ constructor(all) {
8234
+ this.all = all;
8235
+ }
8175
8236
  push(chunk) {
8176
8237
  this.chunks.push(chunk);
8238
+ this.held += chunk.length;
8239
+ this.all.held += chunk.length;
8177
8240
  this.wake?.();
8178
8241
  }
8179
8242
  finish(error) {
@@ -8182,9 +8245,24 @@ var BodyQueue = class {
8182
8245
  this.error = error ?? null;
8183
8246
  this.wake?.();
8184
8247
  }
8248
+ /** Lets go of what was not read yet, ended or not: the reader gets `error` in its place. */
8249
+ drop(error) {
8250
+ this.chunks = [];
8251
+ this.all.held -= this.held;
8252
+ this.held = 0;
8253
+ this.done = true;
8254
+ this.error = error;
8255
+ this.wake?.();
8256
+ }
8185
8257
  async *[Symbol.asyncIterator]() {
8186
8258
  for (;;) {
8187
- while (this.chunks.length > 0) yield this.chunks.shift();
8259
+ while (this.chunks.length > 0) {
8260
+ const chunk = this.chunks.shift();
8261
+ this.held -= chunk.length;
8262
+ this.all.held -= chunk.length;
8263
+ this.taken += chunk.length;
8264
+ yield chunk;
8265
+ }
8188
8266
  if (this.error) throw this.error;
8189
8267
  if (this.done) return;
8190
8268
  await new Promise((resolve) => this.wake = resolve);
@@ -8200,6 +8278,8 @@ var HttpClient = class {
8200
8278
  waitingBytes = 0;
8201
8279
  inFlight = 0;
8202
8280
  closed = false;
8281
+ /** Response-body bytes all this client's responses hold before their readers took them. */
8282
+ unread = { held: 0 };
8203
8283
  constructor(channel) {
8204
8284
  this.channel = channel;
8205
8285
  }
@@ -8272,7 +8352,7 @@ var HttpClient = class {
8272
8352
  const stream = this.streams.get(frame.id);
8273
8353
  if (!stream || stream.queue) return;
8274
8354
  clearTimeout(stream.headersTimer);
8275
- const queue = new BodyQueue();
8355
+ const queue = new BodyQueue(this.unread);
8276
8356
  stream.queue = queue;
8277
8357
  if (frame.b) this.armIdleTimer(frame.id, stream);
8278
8358
  else this.finish(frame.id);
@@ -8293,9 +8373,34 @@ var HttpClient = class {
8293
8373
  stream.received += chunk.payload.length;
8294
8374
  if (stream.received > stream.maxBytes) return this.abort(chunk.id, new GhostlyHttpError("response-too-large", "Response body too large"));
8295
8375
  if (chunk.payload.length > 0) stream.queue.push(chunk.payload.slice());
8376
+ if (stream.queue.held > LIMITS.maxUnreadResponseBytes) {
8377
+ if (this.unread.held > LIMITS.maxClientUnreadResponseBytes) return this.dropUnread(chunk.id, stream.queue);
8378
+ this.checkUnread(chunk.id, stream, stream.queue);
8379
+ }
8296
8380
  if (chunk.end) this.finish(chunk.id);
8297
8381
  else this.armIdleTimer(chunk.id, stream);
8298
8382
  }
8383
+ /**
8384
+ * Nothing tells the peer to slow down, and its last chunk frees the slot: a reader that stalls (a contact's page that
8385
+ * never reads what it fetched) would have the whole body held here, one per request it leaves unread. Past the bound
8386
+ * the reader gets `unreadStallMs`, as a link that hands over many chunks at once leaves it no turn: one that took
8387
+ * something in it is looked at again, one that took nothing has the response reset and what it held let go.
8388
+ */
8389
+ checkUnread(id, stream, queue) {
8390
+ if (stream.unreadCheck) return;
8391
+ const taken = queue.taken;
8392
+ stream.unreadCheck = setTimeout(() => {
8393
+ stream.unreadCheck = void 0;
8394
+ if (queue.held <= LIMITS.maxUnreadResponseBytes) return;
8395
+ if (queue.taken > taken) return this.checkUnread(id, stream, queue);
8396
+ this.dropUnread(id, queue);
8397
+ }, LIMITS.unreadStallMs);
8398
+ }
8399
+ dropUnread(id, queue) {
8400
+ const error = new GhostlyHttpError("unread", "Response body not read in time");
8401
+ queue.drop(error);
8402
+ this.abort(id, error);
8403
+ }
8299
8404
  handleReset(frame) {
8300
8405
  this.abort(frame.id, new GhostlyHttpError("reset", frame.e || "Request reset by peer"), false);
8301
8406
  }
@@ -9396,6 +9501,8 @@ var DataLink = class {
9396
9501
  fullGather = false;
9397
9502
  /** The offer or answer out has no public candidate (as it went: the connection's description gains any that come later). */
9398
9503
  sentLacksPublic = false;
9504
+ /** Connections the gathering under way replaced for finding no candidate at all (`gathered`); 0 when none is under way. */
9505
+ gatherStalls = 0;
9399
9506
  lastSignalTs = 0;
9400
9507
  /** The peer's description as this connection was given it: Chrome shows it as `remoteDescription` only once applied. */
9401
9508
  remoteSdp = null;
@@ -9489,11 +9596,13 @@ var DataLink = class {
9489
9596
  }
9490
9597
  this.lastSignalTs = signal.ts;
9491
9598
  const wasOpen = this.state === "open";
9599
+ const unpublic = this.gatherStalled;
9492
9600
  this.teardown();
9493
9601
  if (wasOpen) {
9494
9602
  this.options.onDirect?.("closed");
9495
9603
  this.options.onClose();
9496
9604
  }
9605
+ if (unpublic) this.options.onDirect?.("no-public");
9497
9606
  this.answered = {
9498
9607
  offer: signal,
9499
9608
  at: Date.now(),
@@ -9571,7 +9680,7 @@ var DataLink = class {
9571
9680
  }
9572
9681
  close() {
9573
9682
  const stalled = Date.now() - this.connectingSince >= STALLED_EVIDENCE_MS;
9574
- const evidence = stalled ? this.directEvidence() : null;
9683
+ const evidence = (stalled ? this.directEvidence() : null) ?? (this.gatherStalled ? "no-public" : null);
9575
9684
  this.noteNoPublic(stalled);
9576
9685
  this.answered = null;
9577
9686
  this.reset();
@@ -9603,6 +9712,16 @@ var DataLink = class {
9603
9712
  return !PUBLIC_CANDIDATE.test(local) ? "no-public" : symmetricNat(local) ? "symmetric" : this.myOfferTs ? "no-path" : null;
9604
9713
  }
9605
9714
  /**
9715
+ * The gathering under way found no candidate on every connection but the one it waits on now (`GATHER_ATTEMPTS` - 1
9716
+ * stalls): ended from outside now (another transport went live, the contact's offer took its place), it says what
9717
+ * one that ran out says, `no-public`. Saying nothing held the note back on a network that blocks direct connections:
9718
+ * a browser there gathers none, its chats went live over Iroh before the third stall, and only a later attempt, if
9719
+ * any came, said it (direct-blocked e2e, 2026-11-13).
9720
+ */
9721
+ get gatherStalled() {
9722
+ return this.gatherStalls >= 2;
9723
+ }
9724
+ /**
9606
9725
  * The attempt on this connection failed (it timed out, ICE failed or closed, its channel closed). An answer the
9607
9726
  * offerer may not have read yet is made again for the same offer while it still stands (`REANSWERS`); anything
9608
9727
  * else goes back to idle. `byConnection`: the connection said so itself, rather than a timer of this link's.
@@ -9687,6 +9806,7 @@ var DataLink = class {
9687
9806
  */
9688
9807
  async gathered(offer, describe) {
9689
9808
  let stalled = null;
9809
+ this.gatherStalls = 0;
9690
9810
  for (let attempt = 1;; attempt++) {
9691
9811
  const pc = this.createConnection();
9692
9812
  if (stalled) this.closeConnection(stalled);
@@ -9706,6 +9826,7 @@ var DataLink = class {
9706
9826
  offer,
9707
9827
  ...attempt > 1 ? { attempt } : {}
9708
9828
  });
9829
+ this.gatherStalls = 0;
9709
9830
  return pc;
9710
9831
  }
9711
9832
  traceLink(this.options.myPubKeyZ32, "ice-stalled", {
@@ -9719,6 +9840,7 @@ var DataLink = class {
9719
9840
  return null;
9720
9841
  }
9721
9842
  stalled = pc;
9843
+ this.gatherStalls = attempt;
9722
9844
  }
9723
9845
  }
9724
9846
  createConnection() {
@@ -9796,6 +9918,7 @@ var DataLink = class {
9796
9918
  this.myOfferTs = this.myOfferOutAt = 0;
9797
9919
  this.answerCameLate = false;
9798
9920
  this.remoteSdp = null;
9921
+ this.gatherStalls = 0;
9799
9922
  if (!pc) return false;
9800
9923
  this.closeConnection(pc);
9801
9924
  return true;
@@ -18423,6 +18546,8 @@ var AppRanges = class {
18423
18546
  newServeId;
18424
18547
  now;
18425
18548
  serves = /* @__PURE__ */ new Map();
18549
+ /** The same serves by app, then file: an app may serve 100,000 files, and walking `serves` for each was O(n²). */
18550
+ servesByApp = /* @__PURE__ */ new Map();
18426
18551
  serving = /* @__PURE__ */ new Map();
18427
18552
  /**
18428
18553
  * Tasks cancelled, unserved, or stopped by the contact's close or a session's end, that this side is still reading or
@@ -18452,25 +18577,33 @@ var AppRanges = class {
18452
18577
  */
18453
18578
  serve(app, file) {
18454
18579
  if (!isChatAppId(app)) throw new Error("Not a chat app id");
18455
- for (const [served, serve] of this.serves) if (serve.app === app && serve.file === file) return served;
18580
+ const files = this.servesByApp.get(app) ?? /* @__PURE__ */ new Map();
18581
+ const served = files.get(file);
18582
+ if (served !== void 0) return served;
18456
18583
  let id = this.newServeId();
18457
18584
  while (this.serves.has(id)) id = this.newServeId();
18458
18585
  this.serves.set(id, {
18459
18586
  app,
18460
18587
  file
18461
18588
  });
18589
+ files.set(file, id);
18590
+ this.servesByApp.set(app, files);
18462
18591
  return id;
18463
18592
  }
18464
18593
  /** Ends one serve: requests under it still being sent stop. False when it was not served. */
18465
18594
  unserve(serveId) {
18466
- if (!this.serves.get(serveId)) return false;
18595
+ const serve = this.serves.get(serveId);
18596
+ if (!serve) return false;
18467
18597
  this.serves.delete(serveId);
18598
+ const files = this.servesByApp.get(serve.app);
18599
+ files.delete(serve.file);
18600
+ if (!files.size) this.servesByApp.delete(serve.app);
18468
18601
  for (const task of this.serving.values()) if (task.serve === serveId) this.drop(task, true);
18469
18602
  return true;
18470
18603
  }
18471
18604
  /** The serve ids `app` has given out and not ended (what the panel's "Sharing with" line shows). */
18472
18605
  servesOf(app) {
18473
- return [...this.serves].filter(([, serve]) => serve.app === app).map(([id]) => id);
18606
+ return [...this.servesByApp.get(app)?.values() ?? []];
18474
18607
  }
18475
18608
  /** An `ar-get` from the contact: the task to read and send, or null when it was refused (the refusal is sent) or dropped. */
18476
18609
  receiveGet(frame) {
@@ -18603,14 +18736,15 @@ var AppRanges = class {
18603
18736
  * them now.
18604
18737
  */
18605
18738
  closeApp(app, error = "peer-closed", stopped = false) {
18606
- for (const [id, serve] of this.serves) if (serve.app === app) this.serves.delete(id);
18739
+ for (const id of this.servesByApp.get(app)?.values() ?? []) this.serves.delete(id);
18740
+ this.servesByApp.delete(app);
18607
18741
  for (const key of [...this.sizes.keys()]) if (key.startsWith(`${app} `)) this.sizes.delete(key);
18608
18742
  this.endRequests(app, error, stopped);
18609
18743
  }
18610
18744
  /** The session ended: no serve id lasts into the next, and every request fails with `offline`. Tasks still being read keep their places into the next. */
18611
18745
  reset() {
18612
18746
  this.sizes.clear();
18613
- for (const app of new Set([...this.serves.values()].map((serve) => serve.app))) this.closeApp(app, "offline");
18747
+ for (const app of [...this.servesByApp.keys()]) this.closeApp(app, "offline");
18614
18748
  this.suspend();
18615
18749
  }
18616
18750
  /**
@@ -21479,9 +21613,10 @@ function mergeLobby(existing, mine, now = Date.now()) {
21479
21613
  function freshHubs(hubs, now = Date.now()) {
21480
21614
  return hubs.filter((h) => now - h.ts < COMMUNITY_TOPOLOGY.beaconFreshMs && h.ts <= now + 6e4);
21481
21615
  }
21616
+ var rankHash = (subject, hubKey) => sha256(concatBytes$1(utf8Encode("ghostly-group-community/1 rank"), publicKeyFromZ32(subject), publicKeyFromZ32(hubKey)));
21482
21617
  /** Rendezvous hashing: how strongly a hub is responsible for someone (a knock, a member). Highest first. */
21483
21618
  function hubRank(subject, hubKey) {
21484
- return toBase64Url(sha256(concatBytes$1(utf8Encode("ghostly-group-community/1 rank"), publicKeyFromZ32(subject), publicKeyFromZ32(hubKey))));
21619
+ return toBase64Url(rankHash(subject, hubKey));
21485
21620
  }
21486
21621
  function rankHubs(subject, hubs) {
21487
21622
  return [...hubs].sort((a, b) => {
@@ -21490,12 +21625,25 @@ function rankHubs(subject, hubs) {
21490
21625
  });
21491
21626
  }
21492
21627
  /**
21493
- * The hubs a member asks for edges: the least loaded fresh ones with room, ties broken by rank
21494
- * for this member (so members spread out), at most `hubsPerMember`.
21628
+ * The hubs a member asks for edges: fresh ones with room, at most `hubsPerMember`, by rendezvous hashing weighted by
21629
+ * the room each has left, so the members picking at once spread over the hubs in proportion to it. The members a
21630
+ * closing hub carried all pick in the same second: each took the least loaded hub, all of them the same one, which
21631
+ * opened their 12 or 16 edges at once on its relays' budget and brought none up for minutes, then the next hub did the
21632
+ * same, and 6 of them stepped up as hubs with nobody on them (36 members, bug hunt, 2026-11-11).
21495
21633
  */
21496
21634
  function pickHubs(me, hubs, now = Date.now(), avoid = /* @__PURE__ */ new Set()) {
21497
21635
  const lately = (h) => now - h.ts < COMMUNITY_TOPOLOGY.beaconEveryMs * 1.5 ? 0 : 1;
21498
- return freshHubs(hubs, now).filter((h) => h.key !== me && !avoid.has(h.key) && h.load < COMMUNITY_TOPOLOGY.hubCapacity).sort((a, b) => lately(a) - lately(b) || a.load - b.load || (hubRank(me, a.key) < hubRank(me, b.key) ? 1 : -1)).slice(0, COMMUNITY_TOPOLOGY.hubsPerMember).map((h) => h.key);
21636
+ return freshHubs(hubs, now).filter((h) => h.key !== me && !avoid.has(h.key) && h.load < COMMUNITY_TOPOLOGY.hubCapacity).map((h) => ({
21637
+ key: h.key,
21638
+ lately: lately(h),
21639
+ score: spreadScore(me, h)
21640
+ })).sort((a, b) => a.lately - b.lately || b.score - a.score).slice(0, COMMUNITY_TOPOLOGY.hubsPerMember).map((h) => h.key);
21641
+ }
21642
+ /** Weighted rendezvous hashing: room / -ln(u), u in (0, 1) from this member's rank of the hub; the highest is picked. */
21643
+ function spreadScore(me, hub) {
21644
+ const r = rankHash(me, hub.key);
21645
+ const u = (r[0] * 65536 + r[1] * 256 + r[2] + .5) / 16777216;
21646
+ return (COMMUNITY_TOPOLOGY.hubCapacity - hub.load) / -Math.log(u);
21499
21647
  }
21500
21648
  /** Should this member be a hub? Too few fresh hubs, or all full, and room in the beacon. */
21501
21649
  function shouldBeHub(me, hubs, now = Date.now()) {
@@ -22791,6 +22939,11 @@ var GhostLink = class {
22791
22939
  switcher;
22792
22940
  /** `plan`: a switch both sides agreed; without one, a replacement the contact dialled (`attachReplacement`). */
22793
22941
  candidate = null;
22942
+ /**
22943
+ * Connections that authenticate beside a `candidate` dialled in and unproven (`contend`), oldest first: whichever
22944
+ * authenticates first takes over, so one that never does neither holds the place nor takes it from the contact's.
22945
+ */
22946
+ contenders = [];
22794
22947
  candidateEpoch = 0;
22795
22948
  /** The native dial a transport change has in flight, per transport (`prepareSwitch`). */
22796
22949
  switchDials = /* @__PURE__ */ new Map();
@@ -22955,6 +23108,10 @@ var GhostLink = class {
22955
23108
  /** The attempt (its epoch) whose direct transports were knocked on as its offer went out (`knockEarly`), and whether that is under way. */
22956
23109
  knockedEarly = -1;
22957
23110
  knockingEarly = false;
23111
+ /** The attempt (its epoch) of a resume over WebRTC whose offer Iroh joined, its endpoint up only after the dial (`joinRace`). */
23112
+ irohJoinedResume = -1;
23113
+ /** The same for HyperDHT (direct, and already in the race's `afterRtc`). */
23114
+ hyperdhtJoinedResume = -1;
22958
23115
  /** When this side's offer's answer was applied (`RACE_ANSWERED_MS`); 0 while the data link is not connecting on it. */
22959
23116
  answeredAt = 0;
22960
23117
  /** This side's offer is out unanswered, or answered and not connected yet: what is ranked after WebRTC may race it. */
@@ -23302,7 +23459,7 @@ var GhostLink = class {
23302
23459
  if (isDiscoveryBudgetError(error)) return;
23303
23460
  if (!signal || !options.params.profile) return;
23304
23461
  this.signalPublishFailed = true;
23305
- events.onPairingState?.({
23462
+ this.sayPairingState({
23306
23463
  status: "error",
23307
23464
  error: publishFailure(error)
23308
23465
  });
@@ -23558,7 +23715,7 @@ var GhostLink = class {
23558
23715
  } else if (credentials?.requireSignedSignals && !this.isDataLinkOpen) {
23559
23716
  this.securityRejected = true;
23560
23717
  this.tracker?.failed("rejected", false);
23561
- options.events?.onPairingState?.({
23718
+ this.sayPairingState({
23562
23719
  status: "error",
23563
23720
  keyMismatch: false,
23564
23721
  error: "Ignored an unauthenticated discovery signal. Keep both peers on the updated version; the saved key has not been replaced."
@@ -23650,7 +23807,7 @@ var GhostLink = class {
23650
23807
  if (this.stopped || this.keyStopped || this.securityRejected) return;
23651
23808
  if (this.streamBlocked) this.emitDeliveryState();
23652
23809
  else if (this.paired?.state) this.emitPairingState();
23653
- else this.options.events?.onPairingState?.({ status: "connecting" });
23810
+ else this.sayPairingState({ status: "connecting" });
23654
23811
  }
23655
23812
  emitPairingState() {
23656
23813
  this.syncWait();
@@ -23667,7 +23824,7 @@ var GhostLink = class {
23667
23824
  if (!open) this.pairedFiles?.closeAll();
23668
23825
  this.options.events?.onDataLinkState?.(open ? "open" : "idle");
23669
23826
  }
23670
- this.options.events?.onPairingState?.({
23827
+ this.sayPairingState({
23671
23828
  ...state,
23672
23829
  ...blocked ? {
23673
23830
  status: this.transitionError ? "error" : "negotiating",
@@ -23754,17 +23911,36 @@ var GhostLink = class {
23754
23911
  this.session.setActive(active);
23755
23912
  this.dht?.setActive(active);
23756
23913
  }
23914
+ /**
23915
+ * What `emitDeliveryState` said last, cleared by any other pairing state: every mailbox read and publication of a
23916
+ * DHT-only chat asks for it again, and one that changed nothing builds no engine state (bug hunt 1109-chat-perf).
23917
+ */
23918
+ saidDeliveryState;
23919
+ sayPairingState(state) {
23920
+ this.saidDeliveryState = void 0;
23921
+ this.options.events?.onPairingState?.(state);
23922
+ }
23757
23923
  emitDeliveryState() {
23758
23924
  if (!this.streamBlocked) return;
23759
23925
  const credentials = this.options.pairing?.credentials;
23760
23926
  const error = this.dht?.view.error;
23761
- this.options.events?.onPairingState?.({
23927
+ const state = {
23762
23928
  status: error ? "error" : credentials?.peerKey ? "ready" : "connecting",
23763
23929
  peerKey: credentials?.peerKey,
23764
23930
  code: this.dht?.comparisonCode,
23765
23931
  verified: !!credentials?.peerKey && credentials.verifiedPeerKey === credentials.peerKey,
23766
23932
  error
23767
- });
23933
+ };
23934
+ const said = JSON.stringify([
23935
+ state.status,
23936
+ state.peerKey,
23937
+ state.code,
23938
+ state.verified,
23939
+ state.error
23940
+ ]);
23941
+ if (said === this.saidDeliveryState) return;
23942
+ this.saidDeliveryState = said;
23943
+ this.options.events?.onPairingState?.(state);
23768
23944
  }
23769
23945
  async setDeliveryMode(mode) {
23770
23946
  if (!this.dht) throw new Error("DHT delivery is unavailable for this conversation.");
@@ -23875,7 +24051,7 @@ var GhostLink = class {
23875
24051
  if (epoch !== this.connectionEpoch) return;
23876
24052
  const message = error instanceof Error ? error.message : String(error);
23877
24053
  this.tracker?.failed("transport", true, message);
23878
- if (!this.dialFailed(message)) this.options.events?.onPairingState?.({
24054
+ if (!this.dialFailed(message)) this.sayPairingState({
23879
24055
  status: "error",
23880
24056
  error: message
23881
24057
  });
@@ -24657,7 +24833,7 @@ var GhostLink = class {
24657
24833
  side: "dialled",
24658
24834
  failed: []
24659
24835
  };
24660
- this.options.events?.onPairingState?.({ status: "connecting" });
24836
+ this.sayPairingState({ status: "connecting" });
24661
24837
  try {
24662
24838
  const local = this.transportOffer();
24663
24839
  const relayed = relayedTransports(this.localDescriptors(), this.peerDescriptors);
@@ -24990,9 +25166,12 @@ var GhostLink = class {
24990
25166
  maybeKnockEarly(epoch) {
24991
25167
  const next = this.afterRtc, missed = !!this.offered?.knockMissed;
24992
25168
  if (!(this.offered?.resume || missed) || this.offered?.epoch !== epoch || this.knockedEarly === epoch || next?.epoch !== epoch || epoch !== this.connectionEpoch) return;
24993
- if (this.dialing || this.channel || this.stopped || !this.offerOut || !(missed || this.offered.woke || this.contactQuiet())) return;
25169
+ if (this.dialing || this.channel || this.stopped || !this.offerOut) return;
25170
+ const iroh = !missed && this.irohJoinedResume === epoch && this.irohRanksFirst();
25171
+ const hyperdht = !missed && this.hyperdhtJoinedResume === epoch && next.rest.includes("hyperdht/1") && !this.relayedTransports.includes("hyperdht/1") && this.canDial("hyperdht/1");
25172
+ if (!iroh && !hyperdht && !(missed || this.offered.woke || this.contactQuiet())) return;
24994
25173
  const relayed = missed || this.upgradesFromRelay() ? [] : this.relayedTransports;
24995
- const direct = next.rest.filter((t) => !relayed.includes(t) && this.canDial(t));
25174
+ const direct = iroh || hyperdht ? [...iroh ? ["iroh/1"] : [], ...hyperdht ? ["hyperdht/1"] : []] : next.rest.filter((t) => !relayed.includes(t) && this.canDial(t));
24996
25175
  if (!direct.length) return;
24997
25176
  this.knockedEarly = epoch;
24998
25177
  this.knockEarly(epoch, direct);
@@ -25039,9 +25218,20 @@ var GhostLink = class {
25039
25218
  rest: [...rest, transport]
25040
25219
  };
25041
25220
  traceLink(this.myPubKeyZ32, "race-join", { transport });
25221
+ if (offered.resume && transport === "iroh/1") this.irohJoinedResume = offered.epoch;
25222
+ if (offered.resume && transport === "hyperdht/1") this.hyperdhtJoinedResume = offered.epoch;
25042
25223
  if (offered.knockMissed && this.canDial(transport)) this.knockEarly(offered.epoch, [transport]);
25043
25224
  if (!this.racing) this.scheduleRace(offered.epoch, offered.at);
25044
25225
  }
25226
+ /**
25227
+ * On Automatic with no choice standing, Iroh ranks ahead of WebRTC for this contact and can be dialled now (WISP 100,
25228
+ * revision 2026-11-08): where a resume over WebRTC goes on Iroh instead (`dial`).
25229
+ */
25230
+ irohRanksFirst() {
25231
+ if (!this.automatic || !this.peerTransports || !this.canDial("iroh/1") || (this.switcher.chosenTarget ?? this.choiceApart?.transport)) return false;
25232
+ const ranked = rankTransports(this.transportOffer(), this.peerFallback ? this.peerTransports : this.peerTransports.slice(0, 1), this.relayedTransports);
25233
+ return ranked.includes("iroh/1") && ranked.indexOf("iroh/1") < ranked.indexOf("webrtc/1");
25234
+ }
25045
25235
  /** WebRTC could not start an attempt here: it goes last in the dial order for `RTC_UNSTARTED_MS`, while another transport remains. */
25046
25236
  rtcUnstarted() {
25047
25237
  traceLink(this.myPubKeyZ32, "rtc-unstarted", {});
@@ -26486,16 +26676,18 @@ var GhostLink = class {
26486
26676
  requireLegacyCapabilities() {
26487
26677
  if (this.options.params.profile) throw new Error("This experimental paired profile supports chat only.");
26488
26678
  }
26489
- cancelCandidate() {
26679
+ /** `closeRtc`: a WebRTC attempt under way beside a native session is this change's, and ends with it. */
26680
+ cancelCandidate(closeRtc = true) {
26490
26681
  this.candidateEpoch++;
26491
26682
  const candidate = this.candidate;
26492
26683
  this.candidate = null;
26493
26684
  candidate?.session.stop();
26494
26685
  candidate?.reject(/* @__PURE__ */ new Error("Transport change cancelled"));
26495
26686
  candidate?.channel.close();
26687
+ this.dropContenders("Transport change cancelled");
26496
26688
  this.rtcCandidateWaiter?.reject(/* @__PURE__ */ new Error("Transport change cancelled"));
26497
26689
  this.rtcCandidateWaiter = null;
26498
- if (this.activeBinding) this.dataLink.close();
26690
+ if (this.activeBinding && closeRtc) this.dataLink.close();
26499
26691
  }
26500
26692
  async prepareSwitch(plan) {
26501
26693
  const epoch = ++this.candidateEpoch;
@@ -26581,6 +26773,7 @@ var GhostLink = class {
26581
26773
  candidate?.session.stop();
26582
26774
  candidate?.reject(/* @__PURE__ */ new Error("Candidate failed"));
26583
26775
  candidate?.channel.close();
26776
+ this.dropContenders("Candidate failed");
26584
26777
  this.rtcCandidateWaiter = null;
26585
26778
  if (transport === "webrtc/1") this.dataLink.close();
26586
26779
  }
@@ -26588,16 +26781,62 @@ var GhostLink = class {
26588
26781
  if (epoch === this.candidateEpoch && this.switcher.pending === plan) this.switcher.fail(`Transport change failed: ${lastError instanceof Error ? lastError.message : "no permitted transport connected"}. Retry or choose another transport.`);
26589
26782
  }
26590
26783
  attachCandidate(channel, binding, plan) {
26591
- if (this.candidate || this.switcher.pending !== plan || !plan.choices.includes(binding?.transport ?? "webrtc/1")) {
26784
+ const rtcMove = !binding && plan.choices[0] === "webrtc/1";
26785
+ if (this.candidate && !this.contendable(rtcMove ? this.candidate.plan : plan) || this.switcher.pending !== plan || !plan.choices.includes(binding?.transport ?? "webrtc/1")) {
26592
26786
  channel.close();
26593
26787
  return Promise.reject(/* @__PURE__ */ new Error("Obsolete or duplicate transport candidate"));
26594
26788
  }
26595
- return new Promise((resolve, reject) => this.attach(channel, binding, {
26789
+ return new Promise((resolve, reject) => this.contend(channel, binding, {
26596
26790
  plan,
26597
26791
  resolve,
26598
26792
  reject
26599
26793
  }));
26600
26794
  }
26795
+ /** The candidate waiting for `plan` (none: a replacement) was dialled in and has not authenticated yet. */
26796
+ contendable(plan) {
26797
+ const held = this.candidate;
26798
+ return !!held && held.plan === plan && this.unproven(held.channel) && held.session.state.status !== "ready";
26799
+ }
26800
+ /**
26801
+ * A connection that authenticates beside the candidate held (`contenders`), or takes the place if none is. With
26802
+ * `DIALED_IN_CONTENDERS` waiting already, the oldest dialled in and unproven of them gives its place up.
26803
+ */
26804
+ contend(channel, binding, migration) {
26805
+ if (this.candidate && this.contenders.length >= 8) {
26806
+ const at = this.contenders.findIndex((c) => this.unproven(c.channel));
26807
+ if (at < 0) {
26808
+ channel.close();
26809
+ migration.reject(/* @__PURE__ */ new Error("Obsolete or duplicate transport candidate"));
26810
+ return;
26811
+ }
26812
+ const [oldest] = this.contenders.splice(at, 1);
26813
+ traceLink(this.myPubKeyZ32, "dialed-in-dropped", { transport: oldest.binding?.transport });
26814
+ oldest.session.stop();
26815
+ oldest.reject(/* @__PURE__ */ new Error("A newer connection took its place"));
26816
+ oldest.channel.close();
26817
+ }
26818
+ this.attach(channel, binding, migration);
26819
+ }
26820
+ /** One of the `contenders` authenticated first: it takes the candidate's place, and the candidate held closes. */
26821
+ promoteContender(channel) {
26822
+ const at = this.contenders.findIndex((c) => c.channel === channel);
26823
+ if (at < 0) return false;
26824
+ const [won] = this.contenders.splice(at, 1), held = this.candidate;
26825
+ this.candidate = won;
26826
+ if (held) {
26827
+ held.session.stop();
26828
+ held.reject(/* @__PURE__ */ new Error("Another connection authenticated first"));
26829
+ held.channel.close();
26830
+ }
26831
+ return true;
26832
+ }
26833
+ dropContenders(reason) {
26834
+ for (const c of this.contenders.splice(0)) {
26835
+ c.session.stop();
26836
+ c.reject(new Error(reason));
26837
+ c.channel.close();
26838
+ }
26839
+ }
26601
26840
  /**
26602
26841
  * Both sides dialled at once (two apps back after a restart, each knocking): the lower key's dial carries the chat, on
26603
26842
  * both sides; the higher key's side takes it over as a replacement (`attachReplacement`). Here, on the lower key's
@@ -26664,13 +26903,12 @@ var GhostLink = class {
26664
26903
  channel.close();
26665
26904
  return;
26666
26905
  }
26667
- const waiting = this.candidate;
26668
- if (waiting && !waiting.plan && this.unproven(waiting.channel) && waiting.session.state.status !== "ready") {
26669
- traceLink(this.myPubKeyZ32, "dialed-in-dropped", { transport: waiting.binding?.transport });
26670
- this.candidate = null;
26671
- waiting.session.stop();
26672
- waiting.channel.close();
26673
- waiting.reject(/* @__PURE__ */ new Error("A newer connection took its place"));
26906
+ if (this.contendable()) {
26907
+ this.contend(channel, binding, {
26908
+ resolve: () => {},
26909
+ reject: () => {}
26910
+ });
26911
+ return;
26674
26912
  }
26675
26913
  if (this.candidate) {
26676
26914
  channel.close();
@@ -26812,6 +27050,11 @@ var GhostLink = class {
26812
27050
  this.candidate = null;
26813
27051
  migration?.reject(/* @__PURE__ */ new Error("Candidate connection closed"));
26814
27052
  }
27053
+ const contender = this.contenders.findIndex((c) => c.channel === channel);
27054
+ if (contender >= 0) {
27055
+ this.contenders.splice(contender, 1)[0].session.stop();
27056
+ migration?.reject(/* @__PURE__ */ new Error("Candidate connection closed"));
27057
+ }
26815
27058
  if (this.channel === channel) {
26816
27059
  const wasLive = this.paired?.state.status === "ready";
26817
27060
  this.rejectWaiters(/* @__PURE__ */ new Error("The peer closed this connection. Check that both transport preferences allow a common transport, then reconnect."));
@@ -26885,7 +27128,7 @@ var GhostLink = class {
26885
27128
  let carried = null;
26886
27129
  let switched = null, replaced = false;
26887
27130
  if (migration) {
26888
- if (this.candidate?.channel !== channel) {
27131
+ if (this.candidate?.channel !== channel && !this.promoteContender(channel)) {
26889
27132
  paired.stop();
26890
27133
  channel.close();
26891
27134
  return;
@@ -26893,6 +27136,7 @@ var GhostLink = class {
26893
27136
  const oldChannel = this.channel, oldPaired = this.paired, oldBinding = this.activeBinding;
26894
27137
  const from = oldPaired?.state.transport;
26895
27138
  this.candidate = null;
27139
+ this.dropContenders("Another connection authenticated first");
26896
27140
  const files = this.pairedFiles;
26897
27141
  this.pairedFiles = null;
26898
27142
  if (files && migration.plan && paired.supports("files/2")) {
@@ -27333,14 +27577,17 @@ var GhostLink = class {
27333
27577
  }
27334
27578
  }
27335
27579
  });
27336
- if (migration) this.candidate = {
27337
- channel,
27338
- session: paired,
27339
- binding,
27340
- ...migration.plan && { plan: migration.plan },
27341
- reject: migration.reject
27342
- };
27343
- else this.paired = paired;
27580
+ if (migration) {
27581
+ const entry = {
27582
+ channel,
27583
+ session: paired,
27584
+ binding,
27585
+ ...migration.plan && { plan: migration.plan },
27586
+ reject: migration.reject
27587
+ };
27588
+ if (this.candidate) this.contenders.push(entry);
27589
+ else this.candidate = entry;
27590
+ } else this.paired = paired;
27344
27591
  paired.start();
27345
27592
  return;
27346
27593
  }
@@ -27737,7 +27984,7 @@ var GhostLink = class {
27737
27984
  this.applicationOpen = false;
27738
27985
  this.dht?.setLive(false);
27739
27986
  if (!this.candidate) {
27740
- this.cancelCandidate();
27987
+ this.cancelCandidate(!!this.switcher.pending || !!this.rtcCandidateWaiter);
27741
27988
  this.switcher.stop();
27742
27989
  this.transitionTarget = this.transitionError = void 0;
27743
27990
  }
@@ -27804,9 +28051,12 @@ var GhostLink = class {
27804
28051
  via: "datalink"
27805
28052
  });
27806
28053
  break;
27807
- case "call":
27808
- this.options.events?.onCallSignal?.(heardCallSignal(frame.s, Date.now()));
28054
+ case "call": {
28055
+ if (!this.callsReceived.take()) break;
28056
+ const signal = heardCallSignal(frame.s, Date.now());
28057
+ if (this.pairedCalls.heard(signal)) this.options.events?.onCallSignal?.(signal);
27809
28058
  break;
28059
+ }
27810
28060
  case "req":
27811
28061
  this.httpHost?.handleRequest(frame);
27812
28062
  break;
@@ -27873,8 +28123,9 @@ var GhostLink = class {
27873
28123
  * and HEIF (HEIC, AVIF), without decoding or re-encoding a pixel.
27874
28124
  *
27875
28125
  * Fail-closed: a file that is one of these pictures, by its bytes or by its type, and whose metadata cannot be removed
27876
- * (truncated, malformed, a part this does not know) is refused with `NO_PICTURE_METADATA`, never sent as it was. Any
27877
- * other file goes as it is.
28126
+ * (truncated, malformed, a part this does not know) is refused with `NO_PICTURE_METADATA`, never sent as it was. So is
28127
+ * a JPEG XL or a JPEG 2000 in its boxes (their Exif, XMP and GeoJP2 boxes are not removed here). Any other file goes
28128
+ * as it is.
27878
28129
  */
27879
28130
  var PICTURE_METADATA_LIMITS = {
27880
28131
  /** The largest picture read whole to remove its metadata: past this it is refused. */
@@ -27915,9 +28166,11 @@ var HEIF_BRANDS = /* @__PURE__ */ new Set([
27915
28166
  "avif",
27916
28167
  "avis"
27917
28168
  ]);
28169
+ /** The signature box a JPEG XL (`JXL `) or a JPEG 2000 (`jP `) in boxes starts with. */
28170
+ var SIGNATURE_BOXES = /* @__PURE__ */ new Set(["JXL ", "jP "]);
27918
28171
  var u16be = (b, at) => b[at] << 8 | b[at + 1];
27919
- var u32be$1 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
27920
- var u32le$1 = (b, at) => (b[at] | b[at + 1] << 8 | b[at + 2] << 16 | b[at + 3] << 24) >>> 0;
28172
+ var u32be$2 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
28173
+ var u32le$2 = (b, at) => (b[at] | b[at + 1] << 8 | b[at + 2] << 16 | b[at + 3] << 24) >>> 0;
27921
28174
  var text$2 = (b, at, length) => String.fromCharCode(...b.subarray(at, at + length));
27922
28175
  var starts = (b, at, prefix) => at + prefix.length <= b.length && text$2(b, at, prefix.length) === prefix;
27923
28176
  /** A picture this strips, by its first bytes. */
@@ -27927,8 +28180,9 @@ function kindOf(b) {
27927
28180
  if (b.length >= 12 && starts(b, 0, "RIFF") && starts(b, 8, "WEBP")) return "webp";
27928
28181
  if (starts(b, 0, "GIF87a") || starts(b, 0, "GIF89a")) return "gif";
27929
28182
  if (starts(b, 0, "II*\0") || starts(b, 0, "MM\0*") || starts(b, 0, "II+\0") || starts(b, 0, "MM\0+")) return "tiff";
28183
+ if (b.length >= 12 && u32be$2(b, 0) === 12 && SIGNATURE_BOXES.has(text$2(b, 4, 4)) && u32be$2(b, 8) === 218793738) return "boxes";
27930
28184
  if (b.length >= 16 && starts(b, 4, "ftyp")) {
27931
- const end = Math.min(b.length, u32be$1(b, 0));
28185
+ const end = Math.min(b.length, u32be$2(b, 0));
27932
28186
  for (let at = 8; at + 4 <= end; at += 4) if (at !== 12 && HEIF_BRANDS.has(text$2(b, at, 4))) return "heif";
27933
28187
  }
27934
28188
  }
@@ -28052,7 +28306,7 @@ function stripPng(b) {
28052
28306
  let at = 8, exif = false, imaged = false;
28053
28307
  for (;;) {
28054
28308
  check$2(at + 12 <= b.length);
28055
- const length = u32be$1(b, at), type = text$2(b, at + 4, 4);
28309
+ const length = u32be$2(b, at), type = text$2(b, at + 4, 4);
28056
28310
  check$2(at + 12 + length <= b.length && (at > 8 || type === "IHDR"));
28057
28311
  const critical = (b[at + 4] & 32) === 0;
28058
28312
  check$2(!critical || PNG_CRITICAL.has(type));
@@ -28078,13 +28332,13 @@ var WEBP_KEEPS = /* @__PURE__ */ new Set([
28078
28332
  ]);
28079
28333
  function stripWebp(b) {
28080
28334
  check$2(b.length >= 20);
28081
- const riffEnd = 8 + u32le$1(b, 4);
28335
+ const riffEnd = 8 + u32le$2(b, 4);
28082
28336
  check$2(riffEnd <= b.length && riffEnd % 2 === 0);
28083
28337
  const parts = [];
28084
28338
  let at = 12, size = 4, drawn = false, exif = false, vp8x;
28085
28339
  while (at < riffEnd) {
28086
28340
  check$2(at + 8 <= riffEnd);
28087
- const type = text$2(b, at, 4), length = u32le$1(b, at + 4), end = at + 8 + length + (length & 1);
28341
+ const type = text$2(b, at, 4), length = u32le$2(b, at + 4), end = at + 8 + length + (length & 1);
28088
28342
  check$2(end <= riffEnd && (at > 12 || type === "VP8 " || type === "VP8L" || type === "VP8X"));
28089
28343
  let chunk;
28090
28344
  if (WEBP_KEEPS.has(type)) {
@@ -28202,11 +28456,11 @@ function boxes$1(b, start, end) {
28202
28456
  const found = [];
28203
28457
  for (let at = start; at < end;) {
28204
28458
  check$2(at + 8 <= end);
28205
- let size = u32be$1(b, at), body = at + 8;
28459
+ let size = u32be$2(b, at), body = at + 8;
28206
28460
  const type = text$2(b, at + 4, 4);
28207
28461
  if (size === 1) {
28208
28462
  check$2(at + 16 <= end);
28209
- size = u32be$1(b, at + 8) * 2 ** 32 + u32be$1(b, at + 12);
28463
+ size = u32be$2(b, at + 8) * 2 ** 32 + u32be$2(b, at + 12);
28210
28464
  body = at + 16;
28211
28465
  } else if (size === 0) size = end - at;
28212
28466
  if (type === "uuid") body += 16;
@@ -28244,7 +28498,7 @@ function stripHeif(b) {
28244
28498
  const version = b[infe.body];
28245
28499
  check$2(version === 2 || version === 3);
28246
28500
  let at = infe.body + 4;
28247
- const id = version === 2 ? u16be(b, at) : u32be$1(b, at);
28501
+ const id = version === 2 ? u16be(b, at) : u32be$2(b, at);
28248
28502
  at += version === 2 ? 2 : 4;
28249
28503
  check$2(at + 6 <= infe.end);
28250
28504
  if (HEIF_METADATA_ITEMS.has(text$2(b, at + 2, 4))) metadata.add(id);
@@ -28266,7 +28520,7 @@ function stripHeif(b) {
28266
28520
  /** The next field of `size` bytes (0, 2, 4 or 8), big-endian. */
28267
28521
  const read = (size) => {
28268
28522
  check$2(at + size <= iloc.end);
28269
- const value = size === 0 ? 0 : size === 2 ? u16be(b, at) : size === 4 ? u32be$1(b, at) : size === 8 ? u32be$1(b, at) * 2 ** 32 + u32be$1(b, at + 4) : NaN;
28523
+ const value = size === 0 ? 0 : size === 2 ? u16be(b, at) : size === 4 ? u32be$2(b, at) : size === 8 ? u32be$2(b, at) * 2 ** 32 + u32be$2(b, at + 4) : NaN;
28270
28524
  check$2(Number.isSafeInteger(value));
28271
28525
  at += size;
28272
28526
  return value;
@@ -28472,7 +28726,7 @@ function stripTiff(b) {
28472
28726
  };
28473
28727
  const u32 = (at) => {
28474
28728
  check$2(at + 4 <= b.length);
28475
- return little ? u32le$1(b, at) : u32be$1(b, at);
28729
+ return little ? u32le$2(b, at) : u32be$2(b, at);
28476
28730
  };
28477
28731
  check$2(b.length >= 8 && u16(2) === 42);
28478
28732
  const out = b.slice(), seen = /* @__PURE__ */ new Set();
@@ -28532,13 +28786,18 @@ function stripTiff(b) {
28532
28786
  }
28533
28787
  return [out];
28534
28788
  }
28789
+ /** A JPEG XL or a JPEG 2000 in boxes: refused. */
28790
+ function refuse() {
28791
+ throw new Error(NO_PICTURE_METADATA);
28792
+ }
28535
28793
  var STRIP = {
28536
28794
  jpeg: stripJpeg,
28537
28795
  png: stripPng,
28538
28796
  webp: stripWebp,
28539
28797
  heif: stripHeif,
28540
28798
  gif: stripGif,
28541
- tiff: stripTiff
28799
+ tiff: stripTiff,
28800
+ boxes: refuse
28542
28801
  };
28543
28802
  /**
28544
28803
  * A picture's bytes without its metadata, as parts to put in a Blob; undefined when the file is not a picture this
@@ -28591,18 +28850,31 @@ async function withoutPictureMetadata(source, mime) {
28591
28850
  * removed (truncated, malformed, a part of its movie this does not know) is refused with `NO_VIDEO_METADATA`, never sent as it was.
28592
28851
  * A picture (HEIF is pictureMetadata.ts's) and any other file go as they are; so does a file without a video track (an
28593
28852
  * M4A) here: audioMetadata.ts strips it.
28853
+ *
28854
+ * An AVI (a dashcam's, an older camera's) goes without what its header and its `INFO` list say: each chunk but the
28855
+ * ones its frames and sound are made of (`avih`, `strh`, `strf`, `indx`, `vprp`, `dmlh`) becomes `JUNK`, zeroed (a
28856
+ * stream's name `strn` and data `strd`, `IDIT`'s date, a camera's `LIST ncdt`), and the chunks of a stream that is
28857
+ * neither pictures nor sound (a GPS or subtitle text stream) are zeroed in `movi`, so no offset moves. An ASF (WMV,
28858
+ * WMA), an FLV and an MPEG transport stream are refused with `NO_VIDEO_METADATA` (a WMA, typed as audio, with
28859
+ * `NO_AUDIO_METADATA`): their titles, places and dates are not removed here.
28594
28860
  */
28595
28861
  var VIDEO_METADATA_LIMITS = {
28596
28862
  /** The largest `moov` or `moof` read whole, and the most bytes of a metadata track's chunk: past this the video is refused. */
28597
28863
  maxBoxBytes: 67108864,
28598
28864
  /** The most top-level boxes walked (a fragmented MP4 has two per fragment). */
28599
28865
  maxBoxes: 1e5,
28866
+ /** The most chunks of an AVI walked (one per frame and per piece of sound). */
28867
+ maxChunks: 4e6,
28600
28868
  /** Bytes read first to tell a video from another file. */
28601
28869
  headBytes: 64,
28602
28870
  /** Bytes read at once for a box's header or a small box, so the next headers and `moof`s are read with it. */
28603
28871
  readAhead: 65536,
28604
28872
  /** The most a walk going on from its window reads at once (an Ogg's pages, a live WebM's blocks: the whole file). */
28605
- readAheadMax: 4194304
28873
+ readAheadMax: 4194304,
28874
+ /** The most bytes between two parts replaced that are read and sent with them as one part of the stripped video. */
28875
+ joinGap: 65536,
28876
+ /** The most bytes of such a part. */
28877
+ joinedBytes: 4194304
28606
28878
  };
28607
28879
  /** Why a video is refused: its metadata could not be removed, so it does not go at all. */
28608
28880
  var NO_VIDEO_METADATA = "This video cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded";
@@ -28729,7 +29001,7 @@ var VISUAL = /* @__PURE__ */ new Set([
28729
29001
  ]);
28730
29002
  /** Zeros put in a Blob a slice at a time: a Blob's Blob parts are not copied, so a zeroed range of any size holds no more. */
28731
29003
  var ZEROS$1 = new Blob([/* @__PURE__ */ new Uint8Array(1048576)]);
28732
- var u32be = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
29004
+ var u32be$1 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
28733
29005
  var text$1 = (b, at, length) => String.fromCharCode(...b.subarray(at, at + length));
28734
29006
  /** Refuses the video where its bytes are not what this expects. */
28735
29007
  function check$1(ok) {
@@ -28738,11 +29010,11 @@ function check$1(ok) {
28738
29010
  /** A box's header at `at` of `b` (`base` its offset in the file), up to `end` (a size of 0 runs to it). */
28739
29011
  function header(b, at, end, base = 0) {
28740
29012
  check$1(at + 8 <= b.length);
28741
- let size = u32be(b, at), body = at + 8;
29013
+ let size = u32be$1(b, at), body = at + 8;
28742
29014
  const type = text$1(b, at + 4, 4);
28743
29015
  if (size === 1) {
28744
29016
  check$1(at + 16 <= b.length);
28745
- size = u32be(b, at + 8) * 2 ** 32 + u32be(b, at + 12);
29017
+ size = u32be$1(b, at + 8) * 2 ** 32 + u32be$1(b, at + 12);
28746
29018
  body = at + 16;
28747
29019
  } else if (size === 0) size = end - (base + at);
28748
29020
  if (type === "uuid") body += 16;
@@ -28772,7 +29044,7 @@ function empty(b, box) {
28772
29044
  101,
28773
29045
  101
28774
29046
  ], box.start + 4);
28775
- b.fill(0, box.start + (u32be(b, box.start) === 1 ? 16 : 8), box.end);
29047
+ b.fill(0, box.start + (u32be$1(b, box.start) === 1 ? 16 : 8), box.end);
28776
29048
  }
28777
29049
  /**
28778
29050
  * Every metadata box in a container's children (and in theirs, for the containers below a track) emptied, every
@@ -28815,9 +29087,9 @@ function chunkOffsets(b, stbl) {
28815
29087
  check$1(!!stco !== !!co64);
28816
29088
  const offsets = stco ?? co64;
28817
29089
  check$1(offsets.body + 8 <= offsets.end);
28818
- const chunks = u32be(b, offsets.body + 4);
29090
+ const chunks = u32be$1(b, offsets.body + 4);
28819
29091
  check$1(offsets.body + 8 + chunks * (co64 ? 8 : 4) <= offsets.end);
28820
- const offsetOf = (i) => co64 ? u32be(b, co64.body + 8 + i * 8) * 2 ** 32 + u32be(b, co64.body + 12 + i * 8) : u32be(b, stco.body + 8 + i * 4);
29092
+ const offsetOf = (i) => co64 ? u32be$1(b, co64.body + 8 + i * 8) * 2 ** 32 + u32be$1(b, co64.body + 12 + i * 8) : u32be$1(b, stco.body + 8 + i * 4);
28821
29093
  return {
28822
29094
  chunks,
28823
29095
  offsetOf
@@ -28830,14 +29102,14 @@ function sampleRanges(b, stbl) {
28830
29102
  const need = (box, at, bytes) => check$1(at + bytes <= box.end);
28831
29103
  const sizeTable = stsz ?? stz2;
28832
29104
  need(sizeTable, sizeTable.body, 12);
28833
- const count = u32be(b, sizeTable.body + 8);
29105
+ const count = u32be$1(b, sizeTable.body + 8);
28834
29106
  let sizeOf;
28835
29107
  /** Samples of one size: a chunk's length is counted, not added up a sample at a time. */
28836
29108
  let uniform = 0;
28837
29109
  if (stsz) {
28838
- uniform = u32be(b, stsz.body + 4);
29110
+ uniform = u32be$1(b, stsz.body + 4);
28839
29111
  if (!uniform) need(stsz, stsz.body + 12, count * 4);
28840
- sizeOf = (i) => u32be(b, stsz.body + 12 + i * 4);
29112
+ sizeOf = (i) => u32be$1(b, stsz.body + 12 + i * 4);
28841
29113
  } else {
28842
29114
  const field = b[stz2.body + 7];
28843
29115
  check$1(field === 4 || field === 8 || field === 16);
@@ -28847,13 +29119,13 @@ function sampleRanges(b, stbl) {
28847
29119
  }
28848
29120
  const { chunks, offsetOf } = chunkOffsets(b, stbl);
28849
29121
  need(stsc, stsc.body, 8);
28850
- const runs = u32be(b, stsc.body + 4);
29122
+ const runs = u32be$1(b, stsc.body + 4);
28851
29123
  need(stsc, stsc.body + 8, runs * 12);
28852
29124
  const ranges = [];
28853
29125
  let sample = 0;
28854
29126
  for (let run = 0; run < runs; run++) {
28855
- const first = u32be(b, stsc.body + 8 + run * 12), perChunk = u32be(b, stsc.body + 12 + run * 12);
28856
- const last = run + 1 < runs ? u32be(b, stsc.body + 8 + (run + 1) * 12) : chunks + 1;
29127
+ const first = u32be$1(b, stsc.body + 8 + run * 12), perChunk = u32be$1(b, stsc.body + 12 + run * 12);
29128
+ const last = run + 1 < runs ? u32be$1(b, stsc.body + 8 + (run + 1) * 12) : chunks + 1;
28857
29129
  check$1(first >= 1 && last > first && last <= chunks + 1);
28858
29130
  for (let chunk = first; chunk < last; chunk++) {
28859
29131
  const start = offsetOf(chunk - 1);
@@ -28875,7 +29147,7 @@ function defaultSampleSizes(moov) {
28875
29147
  for (const trex of mvex ? boxes(moov, mvex.body, mvex.end) : []) {
28876
29148
  if (trex.type !== "trex") continue;
28877
29149
  check$1(trex.body + 24 <= trex.end);
28878
- sizes.set(u32be(moov, trex.body + 4), u32be(moov, trex.body + 16));
29150
+ sizes.set(u32be$1(moov, trex.body + 4), u32be$1(moov, trex.body + 16));
28879
29151
  }
28880
29152
  return sizes;
28881
29153
  }
@@ -28893,30 +29165,30 @@ function fragmentRanges(b, at, sizes) {
28893
29165
  if (traf.type !== "traf") continue;
28894
29166
  const tfhd = child(b, traf, "tfhd");
28895
29167
  check$1(!!tfhd && tfhd.body + 8 <= tfhd.end);
28896
- const flags = u32be(b, tfhd.body) & 16777215;
29168
+ const flags = u32be$1(b, tfhd.body) & 16777215;
28897
29169
  let field = tfhd.body + 8, base = flags & 131072 ? at : previous;
28898
29170
  if (flags & 1) {
28899
29171
  check$1(field + 8 <= tfhd.end);
28900
- base = u32be(b, field) * 2 ** 32 + u32be(b, field + 4);
29172
+ base = u32be$1(b, field) * 2 ** 32 + u32be$1(b, field + 4);
28901
29173
  field += 8;
28902
29174
  }
28903
29175
  if (flags & 2) field += 4;
28904
29176
  if (flags & 8) field += 4;
28905
- const track = u32be(b, tfhd.body + 4);
29177
+ const track = u32be$1(b, tfhd.body + 4);
28906
29178
  let size = sizes.get(track);
28907
29179
  if (flags & 16) {
28908
29180
  check$1(field + 4 <= tfhd.end);
28909
- size = u32be(b, field);
29181
+ size = u32be$1(b, field);
28910
29182
  }
28911
29183
  let next = base;
28912
29184
  for (const trun of boxes(b, traf.body, traf.end)) {
28913
29185
  if (trun.type !== "trun") continue;
28914
29186
  check$1(trun.body + 8 <= trun.end);
28915
- const runFlags = u32be(b, trun.body) & 16777215, count = u32be(b, trun.body + 4);
29187
+ const runFlags = u32be$1(b, trun.body) & 16777215, count = u32be$1(b, trun.body + 4);
28916
29188
  let field = trun.body + 8;
28917
29189
  if (runFlags & 1) {
28918
29190
  check$1(field + 4 <= trun.end);
28919
- next = base + (u32be(b, field) | 0);
29191
+ next = base + (u32be$1(b, field) | 0);
28920
29192
  field += 4;
28921
29193
  }
28922
29194
  if (runFlags & 4) field += 4;
@@ -28930,7 +29202,7 @@ function fragmentRanges(b, at, sizes) {
28930
29202
  let length = 0;
28931
29203
  if (runFlags & 512) {
28932
29204
  const sizeAt = field + (runFlags & 256 ? 4 : 0);
28933
- for (let i = 0; i < count; i++) length += u32be(b, sizeAt + i * stride);
29205
+ for (let i = 0; i < count; i++) length += u32be$1(b, sizeAt + i * stride);
28934
29206
  } else if (count) {
28935
29207
  check$1(size !== void 0);
28936
29208
  length = count * size;
@@ -29011,7 +29283,7 @@ function stripMoov(b) {
29011
29283
  check$1(selfContained(b, minf) && !!tkhd);
29012
29284
  const id = tkhd.body + 4 + (b[tkhd.body] === 1 ? 16 : 8);
29013
29285
  check$1(id + 4 <= tkhd.end);
29014
- captions.add(u32be(b, id));
29286
+ captions.add(u32be$1(b, id));
29015
29287
  for (const range of sampleRanges(b, stbl)) zeroed.push(range);
29016
29288
  } else check$1(HANDLERS.has(handler));
29017
29289
  if (handler === "vide") video = true;
@@ -29041,6 +29313,20 @@ function meets(ranges, start, end) {
29041
29313
  return low < ranges.length && ranges[low][0] < end;
29042
29314
  }
29043
29315
  /**
29316
+ * Whether `start` to `end` of the file is within one of `boxes` (in file order, apart): the first one that ends at or
29317
+ * past `end` is the only one that can hold it, found by halves, so a caption run per fragment is not checked against
29318
+ * every fragment's `mdat`.
29319
+ */
29320
+ function within(boxes, start, end) {
29321
+ let low = 0, high = boxes.length;
29322
+ while (low < high) {
29323
+ const middle = low + high >>> 1;
29324
+ if (boxes[middle].end >= end) high = middle;
29325
+ else low = middle + 1;
29326
+ }
29327
+ return low < boxes.length && start >= boxes[low].body;
29328
+ }
29329
+ /**
29044
29330
  * `source` read a window at a time: a read that fits in `readAhead` bytes reads that many from where it starts, and
29045
29331
  * the reads after it within them (the next boxes' headers, a fragment's `moof`) are served from it, as copies (they
29046
29332
  * are changed in place). A Blob's read costs most for being one (in Chromium ~0.3 ms, and ~0.9 ms per MiB), so a
@@ -29082,6 +29368,142 @@ async function whole(source, box) {
29082
29368
  check$1(bytes.length === box.end - box.start);
29083
29369
  return bytes;
29084
29370
  }
29371
+ var u32le$1 = (b, at) => (b[at] | b[at + 1] << 8 | b[at + 2] << 16 | b[at + 3] << 24) >>> 0;
29372
+ var JUNK = Uint8Array.from("JUNK", (c) => c.charCodeAt(0));
29373
+ /** The chunks of an AVI's header its frames and sound are read with, kept; any other becomes `JUNK`. */
29374
+ var AVI_HEADER_KEEPS = /* @__PURE__ */ new Set([
29375
+ "avih",
29376
+ "strh",
29377
+ "strf",
29378
+ "indx",
29379
+ "vprp",
29380
+ "dmlh"
29381
+ ]);
29382
+ /** The lists of an AVI's header looked into. */
29383
+ var AVI_HEADER_LISTS = /* @__PURE__ */ new Set([
29384
+ "hdrl",
29385
+ "strl",
29386
+ "odml"
29387
+ ]);
29388
+ /** The streams whose chunks in `movi` are kept: pictures and sound. */
29389
+ var AVI_STREAMS = /* @__PURE__ */ new Set(["vids", "auds"]);
29390
+ /** A frame's or a piece of sound's chunk in `movi`: its stream's number, then what it is. */
29391
+ var AVI_DATA = /^\d\d(dc|db|wb|pc)$/;
29392
+ /** An AVI: `RIFF` `AVI `, then any `RIFF` `AVIX` (an OpenDML one past 1 GiB). */
29393
+ var isAvi = (head) => head.length >= 12 && text$1(head, 0, 4) === "RIFF" && text$1(head, 8, 4) === "AVI ";
29394
+ /** An AVI without what its header and `INFO` say, nor its text and data streams' chunks; the patches in file order. */
29395
+ async function avi(source) {
29396
+ const patches = [], size = source.size;
29397
+ /** Whether each stream, in order, is kept (pictures or sound). */
29398
+ const streams = [];
29399
+ let chunks = 0;
29400
+ const chunkAt = async (at, end) => {
29401
+ check$1(++chunks <= VIDEO_METADATA_LIMITS.maxChunks && at + 8 <= end);
29402
+ const head = await source.read(at, 12);
29403
+ check$1(head.length >= 8);
29404
+ const id = text$1(head, 0, 4), length = u32le$1(head, 4), list = id === "LIST" || id === "RIFF";
29405
+ check$1(!list || length >= 4 && head.length >= 12);
29406
+ return {
29407
+ id,
29408
+ type: list ? text$1(head, 8, 4) : "",
29409
+ start: at,
29410
+ body: at + (list ? 12 : 8),
29411
+ end: at + 8 + length,
29412
+ next: at + 8 + length + (length & 1)
29413
+ };
29414
+ };
29415
+ /** Zeros from `start` to `end`; a chunk made `JUNK` (`junk`) has its id replaced too. */
29416
+ const zero = (start, end) => {
29417
+ if (end > start) patches.push({
29418
+ start,
29419
+ end
29420
+ });
29421
+ };
29422
+ const junk = (chunk, end = chunk.end) => {
29423
+ if (chunk.id !== "JUNK") patches.push({
29424
+ start: chunk.start,
29425
+ end: chunk.start + 4,
29426
+ bytes: JUNK
29427
+ });
29428
+ zero(chunk.start + 8, end);
29429
+ };
29430
+ const header = async (start, end) => {
29431
+ for (let at = start; at < end;) {
29432
+ const chunk = await chunkAt(at, end);
29433
+ check$1(chunk.end <= end);
29434
+ if (chunk.id === "LIST" && AVI_HEADER_LISTS.has(chunk.type)) await header(chunk.body, chunk.end);
29435
+ else if (chunk.id === "strh") {
29436
+ check$1(chunk.end - chunk.body >= 4);
29437
+ streams.push(AVI_STREAMS.has(text$1(await source.read(chunk.body, 4), 0, 4)));
29438
+ } else if (chunk.id === "JUNK") zero(chunk.body, chunk.end);
29439
+ else if (!AVI_HEADER_KEEPS.has(chunk.id)) junk(chunk);
29440
+ at = Math.min(chunk.next, end);
29441
+ }
29442
+ };
29443
+ const movi = async (start, end) => {
29444
+ let at = start;
29445
+ for (; at + 8 <= end;) {
29446
+ const chunk = await chunkAt(at, end), until = Math.min(chunk.end, end);
29447
+ if (chunk.id === "LIST" && chunk.type === "rec ") await movi(chunk.body, until);
29448
+ else if (chunk.id.startsWith("ix") || AVI_DATA.test(chunk.id) && streams[Number(chunk.id.slice(0, 2))]) {} else if (/^\d\d/.test(chunk.id)) zero(chunk.body, until);
29449
+ else junk(chunk, until);
29450
+ at = Math.min(chunk.next, end);
29451
+ }
29452
+ zero(at, end);
29453
+ };
29454
+ let at = 0;
29455
+ for (let first = true; at + 12 <= size; first = false) {
29456
+ const head = await source.read(at, 12);
29457
+ if (text$1(head, 0, 4) !== "RIFF" || text$1(head, 8, 4) !== (first ? "AVI " : "AVIX")) break;
29458
+ const form = await chunkAt(at, size), end = Math.min(form.end, size);
29459
+ for (let inner = form.body; inner + 8 <= end;) {
29460
+ const chunk = await chunkAt(inner, end);
29461
+ if (first && chunk.id === "LIST" && chunk.type === "hdrl") {
29462
+ check$1(!streams.length && chunk.end <= end);
29463
+ await header(chunk.body, chunk.end);
29464
+ } else if (chunk.id === "LIST" && chunk.type === "movi") {
29465
+ check$1(streams.length > 0);
29466
+ await movi(chunk.body, Math.min(chunk.end, end));
29467
+ } else if (chunk.id === "JUNK") zero(chunk.body, Math.min(chunk.end, end));
29468
+ else if (chunk.id !== "idx1") junk(chunk, Math.min(chunk.end, end));
29469
+ inner = Math.min(chunk.next, end);
29470
+ }
29471
+ at = Math.min(form.next, size);
29472
+ }
29473
+ zero(at, size);
29474
+ return patches;
29475
+ }
29476
+ /** An ASF (WMV, WMA): its header object's GUID. */
29477
+ var ASF = [
29478
+ 48,
29479
+ 38,
29480
+ 178,
29481
+ 117,
29482
+ 142,
29483
+ 102,
29484
+ 207,
29485
+ 17,
29486
+ 166,
29487
+ 217,
29488
+ 0,
29489
+ 170,
29490
+ 0,
29491
+ 98,
29492
+ 206,
29493
+ 108
29494
+ ];
29495
+ var isAsf = (head) => head.length >= 16 && ASF.every((byte, i) => head[i] === byte);
29496
+ /** A video whose metadata is not removed here, so it is refused: an ASF, an FLV, an MPEG transport stream (`.ts`, `.m2ts`). */
29497
+ async function refused(source, head) {
29498
+ if (isAsf(head) || head.length >= 4 && text$1(head, 0, 3) === "FLV" && head[3] === 1) return true;
29499
+ const packetAt = (b, at) => b[at] === 71 && (b[at + 3] & 48) !== 0;
29500
+ for (const [packet, offset] of [[188, 0], [192, 4]]) {
29501
+ if (!packetAt(head, offset) || source.size < offset + 2 * packet + 4) continue;
29502
+ const next = await source.read(offset + packet, packet + 4);
29503
+ if (packetAt(next, 0) && packetAt(next, packet)) return true;
29504
+ }
29505
+ return false;
29506
+ }
29085
29507
  /**
29086
29508
  * What a file is by its first box: a movie (`FIRST_BOXES`), a file of boxes that is one when it holds a `moov` (any
29087
29509
  * other box found at the top of a movie: a stream's segment holds none), or another file. An HEIF picture is
@@ -29106,11 +29528,20 @@ async function withoutVideoMetadata(source, mime) {
29106
29528
  if (!patches) return void 0;
29107
29529
  const parts = [];
29108
29530
  let at = 0;
29109
- for (const patch of patches) {
29531
+ for (let i = 0; i < patches.length;) {
29532
+ const patch = patches[i];
29533
+ let last = i;
29534
+ while (last + 1 < patches.length && patches[last + 1].start - patches[last].end <= VIDEO_METADATA_LIMITS.joinGap && patches[last + 1].end - patch.start <= VIDEO_METADATA_LIMITS.joinedBytes) last++;
29110
29535
  if (patch.start > at) parts.push(source.slice(at, patch.start));
29111
- if (patch.bytes) parts.push(patch.bytes);
29536
+ if (last > i) {
29537
+ const joined = new Uint8Array(await source.slice(patch.start, patches[last].end).arrayBuffer());
29538
+ for (const { start, end, bytes } of patches.slice(i, last + 1)) if (bytes) joined.set(bytes, start - patch.start);
29539
+ else joined.fill(0, start - patch.start, end - patch.start);
29540
+ parts.push(joined);
29541
+ } else if (patch.bytes) parts.push(patch.bytes);
29112
29542
  else for (let left = patch.end - patch.start; left > 0; left -= ZEROS$1.size) parts.push(ZEROS$1.slice(0, Math.min(left, ZEROS$1.size)));
29113
- at = patch.end;
29543
+ at = patches[last].end;
29544
+ i = last + 1;
29114
29545
  }
29115
29546
  if (at < source.size) parts.push(source.slice(at));
29116
29547
  return new Blob(parts, { type: mime });
@@ -29123,6 +29554,11 @@ async function withoutVideoMetadata(source, mime) {
29123
29554
  async function videoMetadataPatches(file, mime, audio = false) {
29124
29555
  const source = readingAhead(file);
29125
29556
  const head = await source.read(0, VIDEO_METADATA_LIMITS.headBytes);
29557
+ if (isAvi(head)) {
29558
+ const patches = await avi(source);
29559
+ return patches.length ? patches : void 0;
29560
+ }
29561
+ if (!(isAsf(head) && mime.toLowerCase().startsWith("audio/"))) check$1(!await refused(source, head));
29126
29562
  const typed = STRIPPED_TYPES.has(mime.split(";")[0].trim().toLowerCase());
29127
29563
  const container = containerOf(head, mime);
29128
29564
  if (!container) {
@@ -29212,7 +29648,7 @@ async function videoMetadataPatches(file, mime, audio = false) {
29212
29648
  const mdats = top.filter((box) => box.type === "mdat");
29213
29649
  const merged = [];
29214
29650
  for (const [start, end] of zeroed.sort((a, b) => a[0] - b[0])) {
29215
- check$1(mdats.some((mdat) => start >= mdat.body && end <= mdat.end));
29651
+ check$1(within(mdats, start, end));
29216
29652
  const last = merged[merged.length - 1];
29217
29653
  if (last && start <= last[1]) last[1] = Math.max(last[1], end);
29218
29654
  else merged.push([start, end]);
@@ -29248,13 +29684,22 @@ async function videoMetadataPatches(file, mime, audio = false) {
29248
29684
  * - WAV (RIFF, RF64 or BW64): every chunk but its format, data and the ones of the sound itself (`fact`, `cue `,
29249
29685
  * `smpl`, `inst`, an RF64's `ds64`) becomes `JUNK`, zeroed (an INFO list, an `id3 ` chunk, a broadcast `bext` with
29250
29686
  * its date and originator, iXML, XMP).
29687
+ * - AIFF and AIFF-C: every chunk but its sound's (`COMM`, `SSND`, `FVER`, `MARK`, `INST`, `AESD`, `chan`) becomes
29688
+ * `JUNK`, zeroed (NAME, AUTH, ANNO, `(c) `, COMT, an `ID3 ` chunk, an app's `APPL`).
29689
+ * - CAF: every chunk but its sound's (`desc`, `data`, `pakt`, `kuki`, `chan`, `peak`, `ovvw`) becomes `free`, zeroed
29690
+ * (its `info` strings, a marker's names in `strg`, `edct` comments, `uuid` chunks).
29691
+ * - WavPack: its APEv2 and ID3v1 tags at the end as an MP3's, and the source file's header and trailer each block may
29692
+ * keep for a lossless restore (a WAV's INFO list, an AIFF's NAME) made a sub-block that says nothing, zeroed.
29693
+ * - TTA: its tags at the end (and an ID3v2 before it) as an MP3's.
29694
+ * - Sun AU: its annotation, zeros.
29251
29695
  * - WebM and Matroska, audio or video: `Tags`, `Attachments`, `Chapters`, the title, the date, the file names and each
29252
29696
  * track's name become `Void` elements (and the SeekHead's entries for them); the muxer's and the writing app's names
29253
29697
  * are zeroed. A Vorbis, Theora or FLAC track's CodecPrivate (its Ogg headers or its FLAC metadata blocks) has its
29254
29698
  * comments emptied as an Ogg's or a FLAC's. Clusters, cues and other track settings are kept as they are.
29255
29699
  *
29256
29700
  * Fail-closed: a file that is one of these by its bytes and whose tags cannot be removed (truncated, malformed) is
29257
- * refused with `NO_AUDIO_METADATA`, never sent as it was. Any other file goes as it is (other audio formats too).
29701
+ * refused with `NO_AUDIO_METADATA`, never sent as it was. So is a WMA (ASF): its title, place and date are not removed
29702
+ * here. Any other file goes as it is (other audio formats too).
29258
29703
  */
29259
29704
  var AUDIO_METADATA_LIMITS = {
29260
29705
  /** The largest header, element or tag read whole (an Ogg comment header with a picture in it): past this the file is refused. */
@@ -29270,6 +29715,7 @@ var NO_AUDIO_METADATA = "This audio cannot be sent: Ghostly could not remove the
29270
29715
  var ZEROS = new Blob([/* @__PURE__ */ new Uint8Array(1048576)]);
29271
29716
  var text = (b, at, length) => String.fromCharCode(...b.subarray(at, at + length));
29272
29717
  var u32le = (b, at) => (b[at] | b[at + 1] << 8 | b[at + 2] << 16 | b[at + 3] << 24) >>> 0;
29718
+ var u32be = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
29273
29719
  var syncsafe = (b, at) => b[at] << 21 | b[at + 1] << 14 | b[at + 2] << 7 | b[at + 3];
29274
29720
  var latin = (s) => Uint8Array.from(s, (c) => c.charCodeAt(0));
29275
29721
  /** Refuses the file where its bytes are not what this expects. */
@@ -29632,6 +30078,121 @@ async function wav(read, size, rf64, patches) {
29632
30078
  at = Math.min(end, size);
29633
30079
  }
29634
30080
  }
30081
+ /** The chunks an AIFF's or AIFF-C's sound is made of, kept; any other becomes `JUNK`. */
30082
+ var AIFF_KEEPS = /* @__PURE__ */ new Set([
30083
+ "COMM",
30084
+ "SSND",
30085
+ "FVER",
30086
+ "MARK",
30087
+ "INST",
30088
+ "AESD",
30089
+ "chan"
30090
+ ]);
30091
+ /** An AIFF's chunks from its form type: big-endian sizes, each padded to an even length. */
30092
+ async function aiff(read, size, patches) {
30093
+ const count = counter();
30094
+ for (let at = 12; at + 8 <= size;) {
30095
+ count();
30096
+ const head = await read(at, 8);
30097
+ const id = text(head, 0, 4), length = u32be(head, 4);
30098
+ let end = at + 8 + length + length % 2;
30099
+ if (id === "SSND") end = length ? Math.min(end, size) : size;
30100
+ else check(at + 8 + length <= size);
30101
+ if (!AIFF_KEEPS.has(id)) {
30102
+ if (id !== "JUNK") patches.push({
30103
+ start: at,
30104
+ end: at + 4,
30105
+ bytes: latin("JUNK")
30106
+ });
30107
+ if (length) patches.push({
30108
+ start: at + 8,
30109
+ end: at + 8 + length
30110
+ });
30111
+ }
30112
+ at = Math.min(end, size);
30113
+ }
30114
+ }
30115
+ /** The chunks a CAF's sound is made of, kept; any other becomes `free`. */
30116
+ var CAF_KEEPS = /* @__PURE__ */ new Set([
30117
+ "desc",
30118
+ "data",
30119
+ "pakt",
30120
+ "kuki",
30121
+ "chan",
30122
+ "peak",
30123
+ "ovvw"
30124
+ ]);
30125
+ /** A CAF's chunks after its 8-byte header: big-endian 64-bit sizes, `data`'s -1 when it runs to the end. */
30126
+ async function caf(read, size, patches) {
30127
+ const count = counter();
30128
+ for (let at = 8; at + 12 <= size;) {
30129
+ count();
30130
+ const head = await read(at, 12);
30131
+ const id = text(head, 0, 4), high = u32be(head, 4), length = high * 2 ** 32 + u32be(head, 8);
30132
+ const toEnd = id === "data" && high === 4294967295 && u32be(head, 8) === 4294967295;
30133
+ check(toEnd || Number.isSafeInteger(length) && at + 12 + length <= size);
30134
+ const end = toEnd ? size : at + 12 + length;
30135
+ if (!CAF_KEEPS.has(id)) {
30136
+ if (id !== "free") patches.push({
30137
+ start: at,
30138
+ end: at + 4,
30139
+ bytes: latin("free")
30140
+ });
30141
+ if (end > at + 12) patches.push({
30142
+ start: at + 12,
30143
+ end
30144
+ });
30145
+ }
30146
+ at = end;
30147
+ }
30148
+ }
30149
+ /** A WavPack sub-block's own id (its flags apart): the source file's header and trailer, a WAV's or another's. */
30150
+ var WAVPACK_SOURCE = /* @__PURE__ */ new Set([
30151
+ 33,
30152
+ 34,
30153
+ 35,
30154
+ 36
30155
+ ]);
30156
+ /** A WavPack's blocks from `at`, their source file's header and trailer emptied; returns where they end (its tags). */
30157
+ async function wavpack(read, size, at, patches) {
30158
+ const count = counter();
30159
+ while (at + 32 <= size && text(await read(at, 4), 0, 4) === "wvpk") {
30160
+ count();
30161
+ const end = at + 8 + u32le(await read(at + 4, 4), 0);
30162
+ check(end >= at + 32 && end <= size);
30163
+ for (let sub = at + 32; sub < end;) {
30164
+ count();
30165
+ const head = await read(sub, Math.min(4, end - sub));
30166
+ const large = (head[0] & 128) !== 0, body = sub + (large ? 4 : 2);
30167
+ check(body <= end);
30168
+ const length = (large ? head[1] | head[2] << 8 | head[3] << 16 : head[1]) * 2;
30169
+ check(body + length <= end);
30170
+ if (WAVPACK_SOURCE.has(head[0] & 63)) {
30171
+ patches.push({
30172
+ start: sub,
30173
+ end: sub + 1,
30174
+ bytes: Uint8Array.of(head[0] & 192 | 32)
30175
+ });
30176
+ if (length) patches.push({
30177
+ start: body,
30178
+ end: body + length
30179
+ });
30180
+ }
30181
+ sub = body + length;
30182
+ }
30183
+ at = end;
30184
+ }
30185
+ return at;
30186
+ }
30187
+ /** A Sun AU's annotation: from its 24-byte header to its sound. */
30188
+ async function au(read, size, patches) {
30189
+ const offset = u32be(await read(4, 4), 0);
30190
+ check(offset >= 24 && offset <= size);
30191
+ if (offset > 24) patches.push({
30192
+ start: 24,
30193
+ end: offset
30194
+ });
30195
+ }
29635
30196
  var EBML_HEADER = 440786851;
29636
30197
  var SEGMENT$1 = 408125543;
29637
30198
  var CLUSTER = 524531317;
@@ -29886,6 +30447,12 @@ async function audioMetadataPatches(file, mime) {
29886
30447
  "BW64"
29887
30448
  ].includes(text(head, 0, 4)) && text(head, 8, 4) === "WAVE") await wav(read, size, text(head, 0, 4) !== "RIFF", patches);
29888
30449
  else if (text(head, 0, 4) === "Eߣ") await matroska(source, read, patches);
30450
+ else if (head.length >= 12 && text(head, 0, 4) === "FORM" && ["AIFF", "AIFC"].includes(text(head, 8, 4))) await aiff(read, size, patches);
30451
+ else if (head.length >= 8 && text(head, 0, 4) === "caff") await caf(read, size, patches);
30452
+ else if (head.length >= 24 && text(head, 0, 4) === ".snd") await au(read, size, patches);
30453
+ else if (text(head, 0, 4) === "wvpk") await trailingTags(read, size, await wavpack(read, size, 0, patches), patches);
30454
+ else if (text(head, 0, 4) === "TTA1") await trailingTags(read, size, 0, patches);
30455
+ else if (isAsf(head)) check(false);
29889
30456
  else if (text(head, 0, 4) === "fLaC") await trailingTags(read, size, await flac(read, size, 0, patches), patches);
29890
30457
  else if (isId3(head) || isFrame(head, 0)) {
29891
30458
  let at = 0;
@@ -29895,6 +30462,7 @@ async function audioMetadataPatches(file, mime) {
29895
30462
  at = await emptyId3(read, size, at, next, patches);
29896
30463
  }
29897
30464
  if (at + 4 <= size && text(await read(at, 4), 0, 4) === "fLaC") at = await flac(read, size, at, patches);
30465
+ else if (at + 4 <= size && text(await read(at, 4), 0, 4) === "wvpk") at = await wavpack(read, size, at, patches);
29898
30466
  await trailingTags(read, size, at, patches);
29899
30467
  } else if (MPEG_AUDIO.has(baseMime(mime))) await trailingTags(read, size, 0, patches);
29900
30468
  else return void 0;
@@ -30342,7 +30910,7 @@ function parsePayParams(body, destination) {
30342
30910
  maxSat,
30343
30911
  metadata,
30344
30912
  descriptionHash: hex$1(sha256(new TextEncoder().encode(metadata))),
30345
- description: description.slice(0, 280),
30913
+ description: stripHidden(description.replace(/\s+/g, " ")).slice(0, 280),
30346
30914
  identifier,
30347
30915
  commentAllowed: comment
30348
30916
  };
@@ -30368,12 +30936,15 @@ function invoiceCallbackUrl(params, amountSat, comment) {
30368
30936
  }
30369
30937
  return url.href;
30370
30938
  }
30371
- /** A success action's link: HTTPS, bounded, and no user part ("https://www.paypal.com@evil.example" opens evil.example). */
30372
- function successUrl(text) {
30939
+ /**
30940
+ * A success action's link: HTTPS, bounded, no user part ("https://www.paypal.com@evil.example" opens evil.example),
30941
+ * and on the callback's own host (LUD-09), so a service cannot hand out a link to somewhere else.
30942
+ */
30943
+ function successUrl(text, host) {
30373
30944
  if (!/^https:\/\//i.test(text) || text.length > LNURL_LIMITS.maxUrlLength) return false;
30374
30945
  try {
30375
30946
  const url = new URL(text);
30376
- return !url.username && !url.password;
30947
+ return !url.username && !url.password && url.host === host;
30377
30948
  } catch {
30378
30949
  return false;
30379
30950
  }
@@ -30398,7 +30969,7 @@ function parseInvoiceCallback(body, params, amountSat) {
30398
30969
  tag: "message",
30399
30970
  message: reason(action.message)
30400
30971
  };
30401
- else if (action.tag === "url" && typeof action.url === "string" && successUrl(action.url)) successAction = {
30972
+ else if (action.tag === "url" && typeof action.url === "string" && successUrl(action.url, params.callbackDomain)) successAction = {
30402
30973
  tag: "url",
30403
30974
  description: reason(action.description),
30404
30975
  url: action.url
@@ -30734,6 +31305,14 @@ var SEPOLIA_TEST_USDT = "0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0";
30734
31305
  var SEPOLIA_TEST_USDT_FAUCET = "0xC959483DBa39aa9E78757139af0e9a2EDEb3f42D";
30735
31306
  /** What one "Get test USDT" asks for: 1,000 TEST-USDT (6 decimals). */
30736
31307
  var TEST_USDT_FAUCET_AMOUNT = 1e9;
31308
+ function parsePaymentAmount(value, decimals) {
31309
+ if (!Number.isInteger(decimals) || decimals < 0 || decimals > 18 || !/^\d+(?:\.\d+)?$/.test(value)) throw new Error("Enter a valid amount");
31310
+ const [whole, fraction = ""] = value.split(".");
31311
+ if (fraction.length > decimals) throw new Error(`Use at most ${decimals} decimal places`);
31312
+ const units = BigInt(whole) * 10n ** BigInt(decimals) + BigInt(fraction.padEnd(decimals, "0") || "0");
31313
+ if (units > BigInt(Number.MAX_SAFE_INTEGER)) throw new Error("Amount exceeds the wallet limit");
31314
+ return Number(units);
31315
+ }
30737
31316
  function formatPaymentAmount(value, decimals = 0) {
30738
31317
  const digits = BigInt(value).toString().padStart(decimals + 1, "0");
30739
31318
  if (!decimals) return digits;
@@ -37314,6 +37893,37 @@ function isSealed(v) {
37314
37893
  "c"
37315
37894
  ].every((k) => typeof v[k] === "string" && B64.test(v[k]) && v[k].length <= 128);
37316
37895
  }
37896
+ var COMMIT_HASH = /^[0-9a-f]{64}$/;
37897
+ /**
37898
+ * A `group-secret` or `group-entry` frame a hub routes for another member, rebuilt from its known fields when each has
37899
+ * its real shape: what a hub remembers and hands on is no bigger than a real one. Null for anything else.
37900
+ */
37901
+ function routedCommunityFrame(raw) {
37902
+ const { t, v, g, to, s } = raw;
37903
+ if (v !== 2 || typeof g !== "string" || !GROUP_ID.test(g) || !MEMBER_KEY.test(to) || !isSealed(s)) return null;
37904
+ const sealed = {
37905
+ e: s.e,
37906
+ n: s.n,
37907
+ c: s.c
37908
+ };
37909
+ if (t === "group-secret" && typeof raw.h === "string" && COMMIT_HASH.test(raw.h)) return {
37910
+ t,
37911
+ v,
37912
+ g,
37913
+ to,
37914
+ h: raw.h,
37915
+ s: sealed
37916
+ };
37917
+ if (t === "group-entry" && isZ32Key(raw.x)) return {
37918
+ t,
37919
+ v,
37920
+ g,
37921
+ to,
37922
+ x: raw.x,
37923
+ s: sealed
37924
+ };
37925
+ return null;
37926
+ }
37317
37927
  /** A welcome's shape and the whole chain it and the pieces before it carry, not yet checked (`CommunitySession.join`). */
37318
37928
  function readWelcome(link, pieces, welcome) {
37319
37929
  if (!welcome || typeof welcome !== "object") return { error: "Malformed welcome" };
@@ -37550,18 +38160,22 @@ var CommunitySession = class CommunitySession {
37550
38160
  return this.state.chain[this.state.chain.length - 1];
37551
38161
  }
37552
38162
  /**
37553
- * The top commit's hash, kept for the commit it was taken from: a view reads it for each member (its roster, what
37554
- * each member's lines are missing), and hashing it every time cost tens of milliseconds per state in big communities.
38163
+ * The top commit's hash: a view reads it for each member (its roster, what each member's lines are missing), and
38164
+ * hashing it every time cost tens of milliseconds per state in big communities.
37555
38165
  */
37556
38166
  get topHash() {
37557
- const top = this.top;
37558
- if (this.topHashOf?.commit !== top) this.topHashOf = {
37559
- commit: top,
37560
- hash: communityCommitHash(top)
37561
- };
37562
- return this.topHashOf.hash;
38167
+ return this.hashOf(this.top);
38168
+ }
38169
+ /**
38170
+ * A commit's hash, kept for the commit it was taken from (a commit never changes once made): every sync frame, sync
38171
+ * answer and commit hashed the whole window again, about a tenth of the load test's CPU at 64 and 128 members.
38172
+ */
38173
+ hashOf(c) {
38174
+ let h = this.hashes.get(c);
38175
+ if (h === void 0) this.hashes.set(c, h = communityCommitHash(c));
38176
+ return h;
37563
38177
  }
37564
- topHashOf;
38178
+ hashes = /* @__PURE__ */ new WeakMap();
37565
38179
  get epoch() {
37566
38180
  return this.top.e;
37567
38181
  }
@@ -37627,11 +38241,11 @@ var CommunitySession = class CommunitySession {
37627
38241
  * does never wins, see `better`), and it parts within the window. Kept until the tip or the side moves.
37628
38242
  */
37629
38243
  mayWin() {
37630
- const side = this.state.side, at = `${this.topHash}:${side.length}:${side.length ? communityCommitHash(side[side.length - 1]) : ""}`;
38244
+ const side = this.state.side, at = `${this.topHash}:${side.length}:${side.length ? this.hashOf(side[side.length - 1]) : ""}`;
37631
38245
  if (this.winning?.at === at) return this.winning.set;
37632
38246
  const counts = this.adminCounts(), main = this.branch(this.topHash), set = /* @__PURE__ */ new Set();
37633
38247
  for (const c of side) {
37634
- const h = communityCommitHash(c), branch = this.rosters.has(h) ? this.branch(h) : null;
38248
+ const h = this.hashOf(c), branch = this.rosters.has(h) ? this.branch(h) : null;
37635
38249
  if (!branch || !branch.path.length) continue;
37636
38250
  const { parent, admin } = this.parting(branch, main, counts);
37637
38251
  if (!(admin[1] && !admin[0]) && parent >= this.epoch - COMMUNITY_LIMITS.window) set.add(h);
@@ -37651,12 +38265,12 @@ var CommunitySession = class CommunitySession {
37651
38265
  const side = this.state.side, parents = new Set(side.map((c) => c.p)), counts = this.adminCounts();
37652
38266
  let lost;
37653
38267
  for (const c of side) {
37654
- const h = communityCommitHash(c);
38268
+ const h = this.hashOf(c);
37655
38269
  if (parents.has(h)) continue;
37656
38270
  const branch = this.branch(h);
37657
38271
  if (!branch || !branch.path.some((x) => rosterHas(this.rosters.get(x) ?? [], key))) continue;
37658
38272
  for (let j = branch.fork + 1; j < this.state.chain.length; j++) {
37659
- if (this.better(branch, this.branch(communityCommitHash(this.state.chain[j])), counts)) continue;
38273
+ if (this.better(branch, this.branch(this.hashOf(this.state.chain[j])), counts)) continue;
37660
38274
  lost = {
37661
38275
  fork: Math.min(lost?.fork ?? j, branch.fork),
37662
38276
  end: Math.max(lost?.end ?? j, j)
@@ -37677,7 +38291,7 @@ var CommunitySession = class CommunitySession {
37677
38291
  if (found) return rosterHas(this.rosterAt(found.hash) ?? [], key);
37678
38292
  const i = this.state.chain.length - 1 - (this.epoch - Number(e));
37679
38293
  const commit = Number.isSafeInteger(i) && i >= 0 ? this.state.chain[i] : void 0;
37680
- const hash = commit && communityCommitHash(commit);
38294
+ const hash = commit && this.hashOf(commit);
37681
38295
  return !!hash && hash.startsWith(h) && this.wasInAt(key, i);
37682
38296
  }
37683
38297
  /**
@@ -37700,7 +38314,7 @@ var CommunitySession = class CommunitySession {
37700
38314
  for (const k of after) if (!before.has(k)) s.byKey.set(k, [...s.byKey.get(k) ?? [], s.through]);
37701
38315
  for (const k of before) if (!after.has(k)) s.byKey.get(k).push(s.through);
37702
38316
  }
37703
- s.top = communityCommitHash(this.state.chain[s.through - 1]);
38317
+ s.top = this.hashOf(this.state.chain[s.through - 1]);
37704
38318
  }
37705
38319
  const at = s.byKey.get(key) ?? [];
37706
38320
  for (let j = 0; j < at.length; j += 2) if (at[j] <= i && (j + 1 >= at.length || i < at[j + 1])) return true;
@@ -37736,14 +38350,14 @@ var CommunitySession = class CommunitySession {
37736
38350
  if (i < 0) return rosterHas(this.roster, f.s) || this.isRecentMember(f.s) || !this.lostAt(f.s);
37737
38351
  const commit = this.state.chain[i];
37738
38352
  if (commit.k !== "leave") return false;
37739
- const high = this.state.left?.[communityCommitHash(commit)]?.hi[seenKey(f.e, f.h)];
38353
+ const high = this.state.left?.[this.hashOf(commit)]?.hi[seenKey(f.e, f.h)];
37740
38354
  return high !== void 0 && f.n <= high;
37741
38355
  }
37742
38356
  /** The mark of a leave on my branch, as a frame to hand on (see `heardAfterOut`). */
37743
38357
  leftFrame(key) {
37744
38358
  const i = this.outIndex(key);
37745
38359
  if (i < 0 || this.state.chain[i].k !== "leave") return void 0;
37746
- const h = communityCommitHash(this.state.chain[i]), mark = this.state.left?.[h];
38360
+ const h = this.hashOf(this.state.chain[i]), mark = this.state.left?.[h];
37747
38361
  return mark && {
37748
38362
  t: "group-left",
37749
38363
  v: 2,
@@ -37862,7 +38476,7 @@ var CommunitySession = class CommunitySession {
37862
38476
  this.state.chain.forEach((commit, i) => {
37863
38477
  roster = communityRoster(roster, commit, true);
37864
38478
  if (!roster) throw new Error("Stored membership chain does not replay");
37865
- const h = communityCommitHash(commit);
38479
+ const h = this.hashOf(commit);
37866
38480
  this.known.set(h, commit);
37867
38481
  this.mainIndex.set(h, i);
37868
38482
  if (i >= keepFrom) this.rosters.set(h, roster);
@@ -37874,7 +38488,7 @@ var CommunitySession = class CommunitySession {
37874
38488
  if (!parentRoster || !parent) return false;
37875
38489
  const result = verifyCommunityCommit(commit, parent, parentRoster, this.id, this.ancestry(commit.p));
37876
38490
  if ("error" in result) return false;
37877
- const h = communityCommitHash(result.commit);
38491
+ const h = this.hashOf(result.commit);
37878
38492
  this.known.set(h, result.commit);
37879
38493
  this.rosters.set(h, result.roster);
37880
38494
  return true;
@@ -37901,7 +38515,7 @@ var CommunitySession = class CommunitySession {
37901
38515
  const i = this.state.chain.length - 1 - (this.epoch - e);
37902
38516
  const candidates = [...i >= 0 && i < this.state.chain.length ? [this.state.chain[i]] : [], ...this.state.side.filter((c) => c.e === e)];
37903
38517
  for (const commit of candidates) {
37904
- const hash = communityCommitHash(commit);
38518
+ const hash = this.hashOf(commit);
37905
38519
  if (hash.startsWith(h16) && this.rosters.has(hash)) return {
37906
38520
  commit,
37907
38521
  hash
@@ -37951,8 +38565,8 @@ var CommunitySession = class CommunitySession {
37951
38565
  const admin = counts[x.fork] - counts[m] > 0 || path.some((h) => ADMIN_ONLY.has(this.known.get(h).k));
37952
38566
  return {
37953
38567
  admin,
37954
- first: x.fork > m ? communityCommitHash(this.state.chain[m + 1]) : path[0] ?? "",
37955
- roles: !admin ? [] : [...this.state.chain.slice(m + 1, x.fork + 1).filter((c) => c.k === "role").map((c) => communityCommitHash(c)), ...path.filter((h) => this.known.get(h).k === "role")]
38568
+ first: x.fork > m ? this.hashOf(this.state.chain[m + 1]) : path[0] ?? "",
38569
+ roles: !admin ? [] : [...this.state.chain.slice(m + 1, x.fork + 1).filter((c) => c.k === "role").map((c) => this.hashOf(c)), ...path.filter((h) => this.known.get(h).k === "role")]
37956
38570
  };
37957
38571
  };
37958
38572
  const sa = side(a), sb = side(b);
@@ -37974,7 +38588,7 @@ var CommunitySession = class CommunitySession {
37974
38588
  if (fork === void 0 || this.signedAfter(h, role.s)) return false;
37975
38589
  return [...at === void 0 ? this.state.chain.slice(fork + 1) : [], ...this.state.side].some((c) => {
37976
38590
  if (c.k !== "leave" || c.s !== role.s) return false;
37977
- const b = this.branch(communityCommitHash(c));
38591
+ const b = this.branch(this.hashOf(c));
37978
38592
  if (!b || (at !== void 0 ? b.fork >= at : b.path.includes(h))) return false;
37979
38593
  return leaveStands(c, this.ancestry(role.p));
37980
38594
  });
@@ -37986,7 +38600,7 @@ var CommunitySession = class CommunitySession {
37986
38600
  if (at !== void 0 && this.state.chain.slice(at + 1).some((c) => c.by === key)) return true;
37987
38601
  return this.state.side.some((c) => {
37988
38602
  if (c.by !== key) return false;
37989
- const b = this.branch(communityCommitHash(c));
38603
+ const b = this.branch(this.hashOf(c));
37990
38604
  return !!b && (at !== void 0 ? b.fork >= at : b.path.includes(h));
37991
38605
  });
37992
38606
  }
@@ -38054,7 +38668,7 @@ var CommunitySession = class CommunitySession {
38054
38668
  if (GROWS.has(result.commit.k) && !keepsRoom(result.commit.e, result.roster)) return false;
38055
38669
  const parentAdmin = rosterAdmin(parentRoster);
38056
38670
  if (result.commit.k === "add" && result.commit.by !== parentAdmin && memberAdmissions(parentAdmin, this.ancestry(p)) >= COMMUNITY_LIMITS.memberAdmissions) return false;
38057
- const commit = result.commit, h = communityCommitHash(commit);
38671
+ const commit = result.commit, h = this.hashOf(commit);
38058
38672
  const admin = rosterAdmin(parentRoster);
38059
38673
  if (commit.by === admin) {
38060
38674
  for (const [other, c] of this.known) if (other !== h && c.p === commit.p && c.by === admin) {
@@ -38144,7 +38758,7 @@ var CommunitySession = class CommunitySession {
38144
38758
  let best = this.branch(this.topHash);
38145
38759
  const parents = new Set(this.state.side.map((c) => c.p));
38146
38760
  for (const c of this.state.side) {
38147
- const h = communityCommitHash(c);
38761
+ const h = this.hashOf(c);
38148
38762
  if (this.mainIndex.has(h) || parents.has(h)) continue;
38149
38763
  const branch = this.branch(h);
38150
38764
  if (branch && this.better(branch, best, counts)) best = branch;
@@ -38157,13 +38771,13 @@ var CommunitySession = class CommunitySession {
38157
38771
  const ancestor = this.mainIndex.get(this.known.get(path[0]).p);
38158
38772
  const dropped = this.state.chain.splice(ancestor + 1);
38159
38773
  for (const c of dropped) {
38160
- const h = communityCommitHash(c);
38774
+ const h = this.hashOf(c);
38161
38775
  this.mainIndex.delete(h);
38162
38776
  this.state.side.push(c);
38163
38777
  }
38164
38778
  for (const h of path) {
38165
38779
  const c = this.known.get(h);
38166
- this.state.side = this.state.side.filter((x) => communityCommitHash(x) !== h);
38780
+ this.state.side = this.state.side.filter((x) => this.hashOf(x) !== h);
38167
38781
  this.mainIndex.set(h, this.state.chain.length);
38168
38782
  this.state.chain.push(c);
38169
38783
  this.takeDerived(h);
@@ -38221,12 +38835,7 @@ var CommunitySession = class CommunitySession {
38221
38835
  * branch it grows still comes in commit by commit (one let go comes again from where it parts in a catch-up).
38222
38836
  */
38223
38837
  pruneSide() {
38224
- const admin = this.admin, hashes = /* @__PURE__ */ new Map();
38225
- const hash = (c) => {
38226
- let h = hashes.get(c);
38227
- if (!h) hashes.set(c, h = communityCommitHash(c));
38228
- return h;
38229
- };
38838
+ const admin = this.admin, hash = (c) => this.hashOf(c);
38230
38839
  let side = this.state.side.slice(-COMMUNITY_LIMITS.side);
38231
38840
  for (;;) {
38232
38841
  const held = new Set(side.map(hash)), parents = new Set(side.map((c) => c.p)), drop = /* @__PURE__ */ new Set();
@@ -38285,10 +38894,10 @@ var CommunitySession = class CommunitySession {
38285
38894
  * kept, only get what is left of the bound, the most recent first.
38286
38895
  */
38287
38896
  pruneSecrets() {
38288
- const keep = new Set(this.state.chain.slice(-COMMUNITY_LIMITS.window - 1).map((c) => communityCommitHash(c)));
38897
+ const keep = new Set(this.state.chain.slice(-COMMUNITY_LIMITS.window - 1).map((c) => this.hashOf(c)));
38289
38898
  let room = COMMUNITY_LIMITS.secrets - [...keep].filter((h) => this.state.secrets[h]).length;
38290
38899
  for (let i = this.state.side.length - 1; i >= 0 && room > 0; i--) {
38291
- const h = communityCommitHash(this.state.side[i]);
38900
+ const h = this.hashOf(this.state.side[i]);
38292
38901
  if (this.state.secrets[h] && !keep.has(h)) {
38293
38902
  keep.add(h);
38294
38903
  room--;
@@ -38426,7 +39035,7 @@ var CommunitySession = class CommunitySession {
38426
39035
  ...draft,
38427
39036
  c: confirmationTag(epochKeys(secret, this.id, draft.e).confirm, untagged)
38428
39037
  }, this.identity.seed);
38429
- const hash = communityCommitHash(commit);
39038
+ const hash = this.hashOf(commit);
38430
39039
  this.known.set(hash, commit);
38431
39040
  this.rosters.set(hash, roster);
38432
39041
  this.mainIndex.set(hash, this.state.chain.length);
@@ -38499,7 +39108,7 @@ var CommunitySession = class CommunitySession {
38499
39108
  if (!rosterHas(this.roster, memberKey) || memberKey === this.myKey || !isZ32Key(memberKey)) throw new Error("Not a member");
38500
39109
  for (let i = this.state.chain.length - 1; i >= 0; i--) {
38501
39110
  const c = this.state.chain[i];
38502
- if (c.k === "add" && c.s === memberKey) return this.welcomeFor(memberKey, communityCommitHash(c));
39111
+ if (c.k === "add" && c.s === memberKey) return this.welcomeFor(memberKey, this.hashOf(c));
38503
39112
  }
38504
39113
  throw new Error("Not a member");
38505
39114
  });
@@ -38507,7 +39116,7 @@ var CommunitySession = class CommunitySession {
38507
39116
  /** The chain, the secrets from the admitting commit on, the rendezvous secret and the entry seed, for one newcomer. */
38508
39117
  welcomeFor(memberKey, admittedAt) {
38509
39118
  const chain = this.state.chain, from = this.mainIndex.get(admittedAt);
38510
- const secrets = chain.slice(from).map((c) => communityCommitHash(c)).filter((h) => this.state.secrets[h]).map((h) => ({
39119
+ const secrets = chain.slice(from).map((c) => this.hashOf(c)).filter((h) => this.state.secrets[h]).map((h) => ({
38511
39120
  h,
38512
39121
  s: sealSecret(memberKey, fromBase64Url(this.state.secrets[h]), secretAad(this.id, h, memberKey))
38513
39122
  }));
@@ -38632,7 +39241,7 @@ var CommunitySession = class CommunitySession {
38632
39241
  ls: toBase64Url(sign(leaveStatement(this.id, this.myKey), this.identity.seed))
38633
39242
  };
38634
39243
  for (const c of this.ancestry(this.topHash)) if (c.k === "add" && c.s === this.myKey || c.k === "create" && c.by === this.myKey) {
38635
- frame.ls3 = toBase64Url(sign(leaveStatement3(this.id, this.myKey, communityCommitHash(c)), this.identity.seed));
39244
+ frame.ls3 = toBase64Url(sign(leaveStatement3(this.id, this.myKey, this.hashOf(c)), this.identity.seed));
38636
39245
  break;
38637
39246
  }
38638
39247
  this.hooks.broadcast(frame);
@@ -39276,9 +39885,9 @@ var CommunitySession = class CommunitySession {
39276
39885
  heard: open?.heard ?? false
39277
39886
  });
39278
39887
  }
39279
- const secrets = this.state.chain.slice(-COMMUNITY_LIMITS.window - 1).map((c) => communityCommitHash(c)).filter((h) => this.state.secrets[h]).map(shortHash);
39888
+ const secrets = this.state.chain.slice(-COMMUNITY_LIMITS.window - 1).map((c) => this.hashOf(c)).filter((h) => this.state.secrets[h]).map(shortHash);
39280
39889
  const loc = [];
39281
- for (let back = 1; back < this.state.chain.length && loc.length < 12; back *= 2) loc.push(communityCommitHash(this.state.chain[this.state.chain.length - 1 - back]));
39890
+ for (let back = 1; back < this.state.chain.length && loc.length < 12; back *= 2) loc.push(this.hashOf(this.state.chain[this.state.chain.length - 1 - back]));
39282
39891
  return {
39283
39892
  t: "group-sync",
39284
39893
  v: 2,
@@ -39723,7 +40332,7 @@ var CommunitySession = class CommunitySession {
39723
40332
  }
39724
40333
  const out = this.outEpoch(from);
39725
40334
  for (let i = start; i < this.state.chain.length; i++) {
39726
- const commit = this.state.chain[i], h = communityCommitHash(commit);
40335
+ const commit = this.state.chain[i], h = this.hashOf(commit);
39727
40336
  answer.push({
39728
40337
  t: "group-commit",
39729
40338
  v: 2,
@@ -39741,7 +40350,7 @@ var CommunitySession = class CommunitySession {
39741
40350
  });
39742
40351
  }
39743
40352
  const held = new Set(Array.isArray(frame.secrets) ? frame.secrets.filter((x) => typeof x === "string") : []);
39744
- const secrets = this.state.chain.slice(-COMMUNITY_LIMITS.window - 1).map((c) => communityCommitHash(c)).filter((h) => this.state.secrets[h] && !held.has(shortHash(h)) && this.readsAt(h, from, out)).map((h) => ({
40353
+ const secrets = this.state.chain.slice(-COMMUNITY_LIMITS.window - 1).map((c) => this.hashOf(c)).filter((h) => this.state.secrets[h] && !held.has(shortHash(h)) && this.readsAt(h, from, out)).map((h) => ({
39745
40354
  h,
39746
40355
  s: sealSecret(from, fromBase64Url(this.state.secrets[h]), secretAad(this.id, h, from))
39747
40356
  }));
@@ -40480,12 +41089,14 @@ function appRevocationFor(version, revocations) {
40480
41089
  return null;
40481
41090
  }
40482
41091
  function checkAppBeforeRun(version, stores, revocations = []) {
40483
- const revocation = appRevocationFor(version, [...revocations, ...stores.flatMap((s) => s.revoked)]);
40484
- if (revocation) return {
40485
- status: "revoked",
40486
- revocation
40487
- };
40488
- const by = stores.flatMap((s) => s.removed.filter((r) => r.ref === version.ref && r.digest === version.digest).map((r) => ({
41092
+ for (const list of [revocations, ...stores.map((s) => s.revoked)]) {
41093
+ const revocation = appRevocationFor(version, indexed(list, (r) => r.statement.app).get(version.ref) ?? []);
41094
+ if (revocation) return {
41095
+ status: "revoked",
41096
+ revocation
41097
+ };
41098
+ }
41099
+ const by = stores.flatMap((s) => (indexed(s.removed, (r) => `${r.ref} ${r.digest}`).get(`${version.ref} ${version.digest}`) ?? []).map((r) => ({
40489
41100
  store: s.key,
40490
41101
  name: s.name,
40491
41102
  reason: r.reason,
@@ -40496,6 +41107,23 @@ function checkAppBeforeRun(version, stores, revocations = []) {
40496
41107
  by
40497
41108
  } : { status: "ok" };
40498
41109
  }
41110
+ var indexes = /* @__PURE__ */ new WeakMap();
41111
+ function indexed(list, key) {
41112
+ const held = indexes.get(list);
41113
+ if (held && held.length === list.length) return held.byKey;
41114
+ const byKey = /* @__PURE__ */ new Map();
41115
+ for (const entry of list) {
41116
+ const k = key(entry);
41117
+ const same = byKey.get(k);
41118
+ if (same) same.push(entry);
41119
+ else byKey.set(k, [entry]);
41120
+ }
41121
+ indexes.set(list, {
41122
+ length: list.length,
41123
+ byKey
41124
+ });
41125
+ return byKey;
41126
+ }
40499
41127
  function appStoreDecision(held, read) {
40500
41128
  if (!held) return "new";
40501
41129
  if (held.key !== read.key) return "other-key";
@@ -40713,6 +41341,6 @@ function readX401SdJwtVc(text) {
40713
41341
  };
40714
41342
  }
40715
41343
  //#endregion
40716
- export { groupName as $, EDIT_RATE_WINDOW_MS as $a, planKnocks as $c, newIdentityBinding as $i, createContactLink as $l, PAIRED_FRAME_TOO_LARGE as $n, commitHash as $o, STATUS_IDLE_AFTER_MS as $r, filePartName as $s, ETHEREUM_USDT as $t, isDiscoveryBudgetError as $u, entryParams as A, recordsName as Aa, readSetUpdate as Ac, chatAppId as Ai, readAppBundleAsync as Al, resolveLightningDestination as An, ROUTINE_STATES as Ao, beaconKeys as Ar, buildSdpFromSignal as As, checkDidSignature as At, firstDeviceSetSecret as Au, GROUP_LIMITS as B, sanitizeFileName as Ba, enrollCancelReason as Bc, dialDescriptors as Bi, isAppLine as Bl, audioMetadataPatches as Bn, sameButtonText as Bo, pickHubs as Br, serviceIdFromName as Bs, parseDid as Bt, DEFAULT_RELAYS as Bu, GROUP_READ_NOTE_COMMUNITY as C, domainWellKnownFile as Ca, readHandoffHello as Cc, toBase64Url as Cd, relayRequest as Ci, appDigest as Cl, normalizePubkyKey as Cn, replySnippet as Co, groupSignalFrame as Cr, decodeControl as Cs, AtprotoProofError as Ct, TURN_PUT_WINDOW_MS as Cu, KNOCK_TTL_MS as D, normalizeDomain as Da, sealHandoffPiece as Dc, APP_RANGE_LIMITS as Di, isAppUrl as Dl, homeserverWebEndpoint as Dn, ITEM_STATES as Do, meshHubs as Dr, QUICK_REDIAL_MS as Ds, DID_JWS_MAX_LENGTH as Dt, turnPutSummary as Du, encodeCommunityLink as E, nip05RootKey as Ea, readHandoffVerified as Ec, utf8Encode as Ed, vapidKeysMatch as Ei, checkAppManifest as El, pubkyProofPath as En, CRON_LINE as Eo, mayBeHub as Er, CALL_SIGNAL_MAX_AGE_MS as Es, DID_FILE_MAX_BYTES as Et, classifyTurnRead as Eu, GROUP_WAKE_FRAME as F, DHT_MESSAGE_TTL as Fa, ENROLL_DONE as Fc, STATUS_CARD_CAPABILITY as Fi, appRef as Fl, findEndpoint as Fn, appCardUrl as Fo, lobbyKeys as Fr, parseCallSignal as Fs, didWebFile as Ft, turnInstance as Fu, CatchUpAnswers as G, baseMime as Ga, enrollProofFrame as Gc, IdentityExchange as Gi, setAppSignatureFastPath as Gl, NO_PICTURE_METADATA as Gn, claimedTime as Go, shouldBeHub as Gr, HANDOFF_HELLO as Gs, strictBase64Url as Gt, SLOW_MS as Gu, GROUP_READ_NOTE as H, PLAYABLE_AUDIO as Ha, enrollDoneFrame as Hc, IDENTITY_MAX_VALIDITY as Hi, readAppRevocation as Hl, NO_VIDEO_METADATA as Hn, statusCardText as Ho, readBeacon as Hr, HANDOFF_CANCEL as Hs, parseDidSignaturePaste as Ht, HEDGE_MS as Hu, GroupWakeLimiter as I, peekDhtMailbox as Ia, ENROLL_GRANT as Ic, UPGRADE_CAPABILITY as Ii, appRefPublisher as Il, isFederationId as In, buttonLabelClash as Io, lobbyRecords as Ir, signalHasVideo as Is, didWebFileNames as It, turnKeys as Iu, GROUP_EDIT_TEXT_BYTES as J, parseVoiceMeta as Ja, verifyEnrollProof as Jc, emptyIdentityLedger as Ji, parseImageMeta as Jl, stripPictureMetadata as Jn, shownTime as Jo, FileUplink as Jr, HANDOFF_PIECE_BYTES as Js, didDhtFromPublicKey as Jt, relayUrlProblem as Ju, COMMUNITY_EDIT_FRAME as K, downsamplePeaks as Ka, readEnrollGrant as Kc, boundIdentityDisplay as Ki, signAppObject as Kl, PICTURE_METADATA_LIMITS as Kn, heardTime as Ko, ChatFiles as Kr, HANDOFF_OFFER as Ks, DidDhtError as Kt, currentRelays as Ku, groupWakeFrame as L, DHT_FILE_CAPABILITY as La, ENROLL_HELLO as Lc, CapsExchange as Li, checkAppRevokeStatement as Ll, parseCashuRequestPayload as Ln, cardLine as Lo, mergeBeacon as Lr, emptyLinkRecords as Ls, didWebFileUrl as Lt, turnName as Lu, knockRecords as M, wellKnownUrl as Ma, setUpdateFrame as Mc, APPS_CAPABILITY as Mi, APP_PREFIXES as Ml, ENDPOINT as Mn, STATUS_CARD_LIMITS as Mo, doorHubs as Mr, callSignalHeardAt as Ms, didJwsAlg as Mt, readTurnPacket as Mu, mergeKnocks as N, ACTIVE_DHT_POLL_MS as Na, signTombstone as Nc, BUTTONS_CAPABILITY as Ni, APP_STATEMENT_LIMITS as Nl, cashuRequestPayload as Nn, TASK_STATUSES as No, freshHubs as Nr, contactRtcConfig as Ns, didSignedMessages as Nt, signTurnPacket as Nu, decodeGroupEntryLink as O, recordsFromTxt as Oa, SET_ACK as Oc, isServeId as Oi, pacer as Ol, pubkyHomeserverOf as On, PR_CHECKS as Oo, pickMeshHubs as Or, RTC_CONFIG as Os, DidError as Ot, TURN_LAST_SEQUENCE as Ou, readKnocks as P, DHT_FILE_TOO_LARGE as Pa, verifySetUpdate as Pc, EDIT_CAPABILITY as Pi, appFingerprint as Pl, fedimintRequestPayload as Pn, appCardId as Po, hubRank as Pr, extractParamsFromSdp as Ps, didWebDocumentUrl as Pt, signTurnRelease as Pu, mentionsMember as Q, EDIT_BUFFER_MS as Qa, newInbox as Qc, isIdentityBinding as Qi, readCanonicalJson as Ql, LIVENESS_PING_MS as Qn, MEMBER_KEY as Qo, STATUS_AVAILABILITIES as Qr, NO_ATTEMPTS as Qs, signDidDhtPacket as Qt, budgetRetryMs as Qu, groupWakes as R, dhtFileId as Ra, ENROLL_PROOF as Rc, DHT_TEXT_CAPABILITY as Ri, isAppHash as Rl, parseFedimintRequestPayload as Rn, cardUrl as Ro, mergeLobby as Rr, HTTP_SERVICE_PROTO as Rs, didWebHost as Rt, turnStatedVerifier as Ru, CommunitySession as S, domainTxtRecord as Sa, readHandoffHave as Sc, randomBytes as Sd, parseWakeFrame as Si, APP_PERMISSIONS as Sl, newPubkyProofFolder as Sn, readReply as So, SIGNAL_REPLY_MS as Sr, LIMITS as Ss, shortAtprotoDid as St, webCryptoSigner as Su, decodeCommunityLink as T, isPublicAddress as Ta, readHandoffTurnFrame as Tc, utf8Decode as Td, checkPushEndpoint as Ti, assembleAppBundle as Tl, pubkyProofFile as Tn, BUTTON_STYLES as To, MESH_HUBS as Tr, BURST_RING_MS as Ts, DID_DOCUMENT_MAX_BYTES as Tt, TURN_SETTLE_MS as Tu, GroupSession as U, VOICE_LIMITS as Ua, enrollGrantFrame as Uc, IDENTITY_REVOCATION_LABEL as Ui, readAppRevocationShape as Ul, videoMetadataPatches as Un, MESSAGE_CLOCK_SKEW_MS as Uo, readBeaconHead as Ur, HANDOFF_DONE as Us, signingKeys as Ut, RelayTransport as Uu, GROUP_REACTED_FRAME as V, sanitizeMime as Va, enrollDigits as Vc, IDENTITY_MAX_EVIDENCE as Vi, isAppRef as Vl, withoutAudioMetadata as Vn, statusCardBytes as Vo, rankHubs as Vr, HANDOFF_ACK as Vs, parseDidDocument as Vt, HEDGE_MISSING_MS as Vu, frameBytes as W, VOICE_METER as Wa, enrollHelloFrame as Wc, IdentityCheckUnavailable as Wi, readAppRevocations as Wl, withoutVideoMetadata as Wn, arrivalKey as Wo, readLobby as Wr, HANDOFF_HAVE as Ws, staticDidDocument as Wt, RelaysFailedError as Wu, meshMessageRef as X, voiceLevel as Xa, endedRequests as Xc, identityRevocationValue as Xi, canonicalJson as Xl, GhostLink as Xn, GROUP_MEMBER_CAP as Xo, transferEnded as Xr, HANDOFF_TIMINGS as Xs, encodeDidDhtPacket as Xt, traceLink as Xu, carryMentions as Y, voiceDownloadName as Ya, clearMissed as Yc, identityRefusal as Yi, readImageMeta as Yl, withoutPictureMetadata as Yn, GROUP_ADMIN_OFF_ERROR as Yo, sentWhole as Yr, HANDOFF_REQUEST as Ys, encodeDidDhtDeactivated as Yt, setLinkTraceSink as Yu, parseCommunityEdit as Z, parseVideoMeta as Za, inboxRecord as Zc, identityStatement as Zi, canonicalJsonBytes as Zl, INVITE_TAKEN as Zn, MAX_GROUP_CHAIN as Zo, transferStalled as Zr, HANDOFF_VERIFIED as Zs, resolveDidDht as Zt, DiscoveryBudgetError as Zu, GroupTypingBoard as _, newMailbox as _a, handoffVersions as _c, sanitizeDisplayText as _d, WAKE_ONLINE_DELAY_MS as _i, requestRecords as _l, sparkInvoiceDetails as _n, reactionIsNewer as _o, readGroupWantNo as _r, presenceSeenAt as _s, atprotoProofRkey as _t, deviceKeyZ32 as _u, appRevocationFor as a, validExternalKey as aa, handoffContext as ac, openRelayPayload as ad, TypingSender as ai, contactAskerFrame as al, TEST_USDT_FAUCET_AMOUNT as an, linkStop as ao, engineText as ar, RATCHET_CAPABILITY as as, sameSshKey as at, OwnInviteError as au, sealGroupTyping as b, decodeDnsResponse as ba, readHandoffCancel as bc, fromBase64Url as bd, deviceWakeRequest as bi, APP_BUNDLE_MAGIC as bl, isPubkyKey as bn, wireReaction as bo, SIGNAL_FRESH_MS as br, parseLocalTarget as bs, normalizeAtprotoHandle as bt, newDeviceSetSecret as bu, checkAppBeforeRun as c, dialableIrohRelay as ca, handoffDigest as cc, identityFromSeed as cd, GROUP_PIN_FRAME as ci, knockSlotIdentity as cl, arkAddressPrefix as cn, forwardedAgain as co, GROUP_HAVE_FRAME as cr, ratchetSessionOf as cs, verifyBitcoinMessage as ct, encodeInviteCode as cu, checkAppStoreIndex as d, HOLD_CAPABILITY as da, handoffManifestFrames as dc, setPublicKeyFastPath as dd, nextPinNumber as di, linkRecords as dl, formatPaymentAmount as dn, GROUP_REACTION_FRAME as do, fetchesByItself as dr, DAEMON_WATCH_PEER_IDLE_MS as ds, ATPROTO_DECLARED_SCOPE as dt, ownInviteRefusal as du, receivedIdentityStatus as ea, handoffAttemptAllowed as ec, withRequestOptions as ed, liveStatus as ei, settleRequest as el, EVM_TEST_CHAINS as en, MAX_REMOVAL_NUMBER as eo, pairedEditFits as er, parseGroupCommit as es, SSHSIG_MAX_ARMOR as et, encodeContactLink as eu, readAppStore as f, HOLD_DATED_BACK_MS as fa, handoffOfferFrame as fc, verify as fd, pinIsNewer as fi, makeStampPaced as fl, validatePaymentTarget as fn, REACTION_LIMITS as fo, groupFileFallback as fr, DHT_POLL_INTERVALS as fs, ATPROTO_FULL_SCOPE as ft, DEVICES_CAPABILITY as fu, GROUP_TYPING_FRAME as g, isHoldUrl as ga, handoffStreamKey as gc, hasVisible as gd, WAKE_ONLINE_BATCH_MS as gi, readLinkRecord as gl, sparkAddressKind as gn, reactionEmoji as go, readGroupWant as gr, WATCH_PEER_MS as gs, atprotoProofRecord as gt, deviceEchoNonce as gu, signAppStore as h, HoldRefusedError as ha, handoffRetryAfter as hc, dropLoneJoiners as hd, WAKE_CALL_INTERVAL_MS as hi, readKnockSlot as hl, SPARK_PROVIDER as hn, queueReaction as ho, readGroupHave as hr, RELAY_POLL_INTERVALS as hs, atprotoDidMethod as ht, deviceEchoFrame as hu, addedAppPermissions as i, emptyProofLedger as ia, handoffCancelFrame as ic, newerPacket as id, TYPING_REFRESH_MS as ii, REQUEST_LIFETIME_MS as il, SEPOLIA_TEST_USDT_FAUCET as in, LINK_TRAILING as io, engineError as ir, edgeParams as is, parseSshSignature as it, readDeviceInvite as iu, knockIdentity as j, txtValue as ja, setAckFrame as jc, isAppVersion as ji, sha256Paced as jl, decodeBolt11 as jn, RUN_RESULTS as jo, beaconRecords as jr, callRtcConfig as js, didGhostlyServiceEntry as jt, nextTurnPosition as ju, encodeGroupEntryLink as k, recordsFromWellKnown as ka, SET_UPDATE as kc, APP_DATA_MAX_BYTES as ki, readAppBundle as kl, requestLnurlInvoice as kn, PR_STATES as ko, COMMUNITY_TOPOLOGY as kr, answersOffer as ks, checkDidJws as kt, TURN_MAX as ku, planAppUpdate as l, irohDescriptor as la, handoffEphemeral as lc, identityFromSeedB64 as ld, PIN_LIMITS as li, knockSlotOf as ll, assertTokenUnits as ln, readForwarded as lo, GROUP_WANT_FRAME as lr, DirectPathWatch as ls, BitcoinAddressError as lt, inviteLink as lu, repeatedJsonKey as m, HoldKeys as ma, handoffReleaseFrame as mc, sanitizeAvatar as md, readPin as mi, openRequest as ml, SPARK_NETWORKS as mn, nextReactionNumber as mo, readGroupFileMeta as mr, PRESENCE_WINDOW as ms, ATPROTO_PROOF_SCOPE as mt, HANDOFF_CAPABILITY as mu, readX401SdJwtVc as n, lastSharedWithMe as na, handoffAttemptSucceeded as nc, RELAY_PAYLOAD_MAX_BYTES as nd, sanitizeStatusText as ni, turnOff as nl, PaymentPreflightError as nn, RateWindow as no, pairedMessageFrame as nr, rosterHas as ns, SshSigError as nt, createDeviceInvite as nu, appStoreDecision as o, TRANSPORTS as oa, handoffContextProof as oc, parseRelayPayload as od, sanitizeTypingStatus as oi, contactAskerHolds as ol, USDT_PUBLIC_RPC as on, linkTail as oo, parseEngineError as or, RatchetBox as os, sshSignCommand as ot, createChatInvite as ou, readAppStoreSteps as p, HOLD_LIMITS as pa, handoffPakeFrame as pc, MAX_AVATAR_LENGTH as pd, pinNumberHolds as pi, mergeContactKnocks as pl, walletNetworkOf as pn, ReactionWindow as po, isGroupMessageId as pr, EXPECT_PEER_MS as ps, ATPROTO_PROOF_COLLECTION as pt, ENROLL_CAPABILITY as pu, GROUP_EDIT_FRAME as q, fileMessageText as qa, readEnrollHello as qc, boundVerifiedIdentity as qi, signAppRevocation as ql, isStrippedPicture as qn, receivedTimestamp as qo, FILE_LIMITS as qr, HANDOFF_PAKE as qs, didDhtDocument as qt, normalizeRelayUrl as qu, sameX401HolderJwk as r, PeerProofs as ra, handoffBusyFrame as rc, createRelayPayload as rd, TYPING_KINDS as ri, ContactRequestError as rl, SEPOLIA_TEST_USDT as rn, dhtEditId as ro, EngineError as rr, verifyCommitSignature as rs, parseSshPublicKey as rt, deviceInviteJoinerParams as ru, appUpdateDecision as s, automaticTransport as sa, handoffDataFrame as sc, createIdentity as sd, typingActivity as si, contactDay as sl, WALLET_NETWORKS as sn, parseLinkPreview as so, GROUP_FILE_LIMITS as sr, emptyRatchetState as ss, verifySshSignature as st, decodeInviteCode as su, newX401HolderKey as t, revokesIdentity as ta, handoffAttemptFailed as tc, PacketTooLargeError as td, personStatus as ti, takeRequest as tl, ONCHAIN_PROVIDER as tn, REMOVED_TEXT as to, pairedMessageFits as tr, rosterAdmin as ts, SSHSIG_NAMESPACE as tt, readContactLink as tu, APP_STORE_LIMITS as u, irohRelayUrl as ua, handoffHelloFrame as uc, publicKeyFromZ32 as ud, mayPin as ui, knockSlotRecords as ul, assertWholeSats as un, COMMUNITY_REACTION_FRAME as uo, GROUP_WANT_NO_FRAME as ur, AWAITING_PEER_MS as us, decodeAnyBitcoinAddress as ut, inviteOwnership as uu, groupTypingEpoch as v, readManifest as va, newHandoffId as vc, stripHidden as vd, WAKE_ONLINE_INTERVAL_MS as vi, seenEntry as vl, isBitcoinAddress as vn, readReaction as vo, CarriedTransport as vr, GhostlyHttpError as vs, checkAtprotoProofRecord as vt, deviceLinkPairing as vu, communityHasFrame as w, encodeDnsQuery as wa, readHandoffPake as wc, toZ32 as wd, wakeRequest as wi, appViewOf as wl, pubkyProofCapability as wn, BUTTON_ID as wo, readGroupSignal as wr, encodeControl as ws, verifyAtprotoRecordProof as wt, TURN_RAISE_READ_TIMEOUT_MS as wu, COMMUNITY_LIMITS as x, dnsProofName as xa, readHandoffDone as xc, isZ32Key as xd, newWakeToken as xi, APP_ICON_PATH as xl, isPubkyProofFolder as xn, pairedReplyAuthor as xo, SIGNAL_HOLD_MS as xr, webLocalFetch as xs, parseAtprotoDidDocument as xt, seedSigner as xu, openGroupTyping as y, DOMAIN_FILE_MAX_BYTES as ya, readHandoffAck as yc, bytesEqual as yd, WakeLimiter as yi, APP_BUNDLE_LIMITS as yl, PUBKY_PROOF_MAX_BYTES as yn, validReactionNumber as yo, GROUP_SIGNAL_FRAME as yr, formatLocalTarget as ys, isAtprotoDid as yt, devicePingFrame as yu, parseGroupWakeFrame as z, formatFileSize as za, enrollCancelFrame as zc, capsDescriptors as zi, isAppKey as zl, NO_AUDIO_METADATA as zn, checkStatusCard as zo, newerHead as zr, LEGACY_SERVICES as zs, normalizeDid as zt, turnVerifierMark as zu };
41344
+ export { mentionsMember as $, parseVideoMeta as $a, inboxRecord as $c, identityStatement as $i, readCanonicalJson as $l, INVITE_TAKEN as $n, MAX_GROUP_CHAIN as $o, transferStalled as $r, HANDOFF_VERIFIED as $s, signDidDhtPacket as $t, budgetRetryMs as $u, encodeGroupEntryLink as A, recordsFromTxt as Aa, SET_ACK as Ac, isServeId as Ai, readAppBundle as Al, pubkyHomeserverOf as An, PR_CHECKS as Ao, pickMeshHubs as Ar, RTC_CONFIG as As, checkDidJws as At, TURN_MAX as Au, parseGroupWakeFrame as B, dhtFileId as Ba, ENROLL_PROOF as Bc, DHT_TEXT_CAPABILITY as Bi, isAppKey as Bl, parseFedimintRequestPayload as Bn, cardUrl as Bo, mergeLobby as Br, HTTP_SERVICE_PROTO as Bs, normalizeDid as Bt, turnVerifierMark as Bu, GROUP_READ_NOTE_COMMUNITY as C, dnsProofName as Ca, readHandoffDone as Cc, randomBytes as Cd, newWakeToken as Ci, APP_ICON_PATH as Cl, isPubkyProofFolder as Cn, pairedReplyAuthor as Co, SIGNAL_HOLD_MS as Cr, webLocalFetch as Cs, shortAtprotoDid as Ct, webCryptoSigner as Cu, routedCommunityFrame as D, isPublicAddress as Da, readHandoffTurnFrame as Dc, utf8Encode as Dd, checkPushEndpoint as Di, checkAppManifest as Dl, pubkyProofFile as Dn, BUTTON_STYLES as Do, MESH_HUBS as Dr, BURST_RING_MS as Ds, DID_FILE_MAX_BYTES as Dt, classifyTurnRead as Du, encodeCommunityLink as E, encodeDnsQuery as Ea, readHandoffPake as Ec, utf8Decode as Ed, wakeRequest as Ei, assembleAppBundle as El, pubkyProofCapability as En, BUTTON_ID as Eo, readGroupSignal as Er, encodeControl as Es, DID_DOCUMENT_MAX_BYTES as Et, TURN_SETTLE_MS as Eu, readKnocks as F, ACTIVE_DHT_POLL_MS as Fa, signTombstone as Fc, BUTTONS_CAPABILITY as Fi, appFingerprint as Fl, cashuRequestPayload as Fn, TASK_STATUSES as Fo, freshHubs as Fr, contactRtcConfig as Fs, didWebDocumentUrl as Ft, signTurnRelease as Fu, frameBytes as G, VOICE_LIMITS as Ga, enrollGrantFrame as Gc, IDENTITY_REVOCATION_LABEL as Gi, readAppRevocations as Gl, videoMetadataPatches as Gn, MESSAGE_CLOCK_SKEW_MS as Go, readBeaconHead as Gr, HANDOFF_DONE as Gs, staticDidDocument as Gt, RelaysFailedError as Gu, GROUP_REACTED_FRAME as H, sanitizeFileName as Ha, enrollCancelReason as Hc, dialDescriptors as Hi, isAppRef as Hl, audioMetadataPatches as Hn, sameButtonText as Ho, pickHubs as Hr, serviceIdFromName as Hs, parseDidDocument as Ht, HEDGE_MISSING_MS as Hu, GROUP_WAKE_FRAME as I, DHT_FILE_TOO_LARGE as Ia, verifySetUpdate as Ic, EDIT_CAPABILITY as Ii, appRef as Il, fedimintRequestPayload as In, appCardId as Io, hubRank as Ir, extractParamsFromSdp as Is, didWebFile as It, turnInstance as Iu, GROUP_EDIT_FRAME as J, downsamplePeaks as Ja, readEnrollGrant as Jc, boundIdentityDisplay as Ji, signAppRevocation as Jl, PICTURE_METADATA_LIMITS as Jn, heardTime as Jo, ChatFiles as Jr, HANDOFF_OFFER as Js, didDhtDocument as Jt, normalizeRelayUrl as Ju, CatchUpAnswers as K, VOICE_METER as Ka, enrollHelloFrame as Kc, IdentityCheckUnavailable as Ki, setAppSignatureFastPath as Kl, withoutVideoMetadata as Kn, arrivalKey as Ko, readLobby as Kr, HANDOFF_HAVE as Ks, strictBase64Url as Kt, SLOW_MS as Ku, GroupWakeLimiter as L, DHT_MESSAGE_TTL as La, ENROLL_DONE as Lc, STATUS_CARD_CAPABILITY as Li, appRefPublisher as Ll, findEndpoint as Ln, appCardUrl as Lo, lobbyKeys as Lr, parseCallSignal as Ls, didWebFileNames as Lt, turnKeys as Lu, knockIdentity as M, recordsName as Ma, readSetUpdate as Mc, chatAppId as Mi, sha256Paced as Ml, resolveLightningDestination as Mn, ROUTINE_STATES as Mo, beaconKeys as Mr, buildSdpFromSignal as Ms, didGhostlyServiceEntry as Mt, nextTurnPosition as Mu, knockRecords as N, txtValue as Na, setAckFrame as Nc, isAppVersion as Ni, APP_PREFIXES as Nl, decodeBolt11 as Nn, RUN_RESULTS as No, beaconRecords as Nr, callRtcConfig as Ns, didJwsAlg as Nt, readTurnPacket as Nu, KNOCK_TTL_MS as O, nip05RootKey as Oa, readHandoffVerified as Oc, vapidKeysMatch as Oi, isAppUrl as Ol, pubkyProofPath as On, CRON_LINE as Oo, mayBeHub as Or, CALL_SIGNAL_MAX_AGE_MS as Os, DID_JWS_MAX_LENGTH as Ot, turnPutSummary as Ou, mergeKnocks as P, wellKnownUrl as Pa, setUpdateFrame as Pc, APPS_CAPABILITY as Pi, APP_STATEMENT_LIMITS as Pl, ENDPOINT as Pn, STATUS_CARD_LIMITS as Po, doorHubs as Pr, callSignalHeardAt as Ps, didSignedMessages as Pt, signTurnPacket as Pu, parseCommunityEdit as Q, voiceLevel as Qa, endedRequests as Qc, identityRevocationValue as Qi, canonicalJsonBytes as Ql, GhostLink as Qn, GROUP_MEMBER_CAP as Qo, transferEnded as Qr, HANDOFF_TIMINGS as Qs, resolveDidDht as Qt, DiscoveryBudgetError as Qu, groupWakeFrame as R, peekDhtMailbox as Ra, ENROLL_GRANT as Rc, UPGRADE_CAPABILITY as Ri, checkAppRevokeStatement as Rl, isFederationId as Rn, buttonLabelClash as Ro, lobbyRecords as Rr, signalHasVideo as Rs, didWebFileUrl as Rt, turnName as Ru, CommunitySession as S, decodeDnsResponse as Sa, readHandoffCancel as Sc, isZ32Key as Sd, deviceWakeRequest as Si, APP_BUNDLE_MAGIC as Sl, isPubkyKey as Sn, wireReaction as So, SIGNAL_FRESH_MS as Sr, parseLocalTarget as Ss, parseAtprotoDidDocument as St, seedSigner as Su, decodeCommunityLink as T, domainWellKnownFile as Ta, readHandoffHello as Tc, toZ32 as Td, relayRequest as Ti, appViewOf as Tl, normalizePubkyKey as Tn, replySnippet as To, groupSignalFrame as Tr, decodeControl as Ts, verifyAtprotoRecordProof as Tt, TURN_RAISE_READ_TIMEOUT_MS as Tu, GROUP_READ_NOTE as U, sanitizeMime as Ua, enrollDigits as Uc, IDENTITY_MAX_EVIDENCE as Ui, readAppRevocation as Ul, withoutAudioMetadata as Un, statusCardBytes as Uo, rankHubs as Ur, HANDOFF_ACK as Us, parseDidSignaturePaste as Ut, HEDGE_MS as Uu, GROUP_LIMITS as V, formatFileSize as Va, enrollCancelFrame as Vc, capsDescriptors as Vi, isAppLine as Vl, NO_AUDIO_METADATA as Vn, checkStatusCard as Vo, newerHead as Vr, LEGACY_SERVICES as Vs, parseDid as Vt, DEFAULT_RELAYS as Vu, GroupSession as W, PLAYABLE_AUDIO as Wa, enrollDoneFrame as Wc, IDENTITY_MAX_VALIDITY as Wi, readAppRevocationShape as Wl, NO_VIDEO_METADATA as Wn, statusCardText as Wo, readBeacon as Wr, HANDOFF_CANCEL as Ws, signingKeys as Wt, RelayTransport as Wu, carryMentions as X, parseVoiceMeta as Xa, verifyEnrollProof as Xc, emptyIdentityLedger as Xi, readImageMeta as Xl, stripPictureMetadata as Xn, shownTime as Xo, FileUplink as Xr, HANDOFF_PIECE_BYTES as Xs, encodeDidDhtDeactivated as Xt, setLinkTraceSink as Xu, GROUP_EDIT_TEXT_BYTES as Y, fileMessageText as Ya, readEnrollHello as Yc, boundVerifiedIdentity as Yi, parseImageMeta as Yl, isStrippedPicture as Yn, receivedTimestamp as Yo, FILE_LIMITS as Yr, HANDOFF_PAKE as Ys, didDhtFromPublicKey as Yt, relayUrlProblem as Yu, meshMessageRef as Z, voiceDownloadName as Za, clearMissed as Zc, identityRefusal as Zi, canonicalJson as Zl, withoutPictureMetadata as Zn, GROUP_ADMIN_OFF_ERROR as Zo, sentWhole as Zr, HANDOFF_REQUEST as Zs, encodeDidDhtPacket as Zt, traceLink as Zu, GroupTypingBoard as _, HoldRefusedError as _a, handoffRetryAfter as _c, hasVisible as _d, WAKE_CALL_INTERVAL_MS as _i, readKnockSlot as _l, SPARK_PROVIDER as _n, queueReaction as _o, readGroupHave as _r, RELAY_POLL_INTERVALS as _s, atprotoProofRecord as _t, deviceEchoNonce as _u, appRevocationFor as a, PeerProofs as aa, handoffBusyFrame as ac, newerPacket as ad, TYPING_KINDS as ai, ContactRequestError as al, SEPOLIA_TEST_USDT_FAUCET as an, dhtEditId as ao, EngineError as ar, verifyCommitSignature as as, parseSshSignature as at, readDeviceInvite as au, sealGroupTyping as b, readManifest as ba, newHandoffId as bc, bytesEqual as bd, WAKE_ONLINE_INTERVAL_MS as bi, seenEntry as bl, isBitcoinAddress as bn, readReaction as bo, CarriedTransport as br, GhostlyHttpError as bs, isAtprotoDid as bt, devicePingFrame as bu, checkAppBeforeRun as c, TRANSPORTS as ca, handoffContextProof as cc, createIdentity as cd, sanitizeTypingStatus as ci, contactAskerHolds as cl, WALLET_NETWORKS as cn, linkTail as co, parseEngineError as cr, RatchetBox as cs, verifySshSignature as ct, decodeInviteCode as cu, checkAppStoreIndex as d, irohDescriptor as da, handoffEphemeral as dc, publicKeyFromZ32 as dd, PIN_LIMITS as di, knockSlotOf as dl, assertWholeSats as dn, readForwarded as do, GROUP_WANT_FRAME as dr, DirectPathWatch as ds, decodeAnyBitcoinAddress as dt, inviteOwnership as du, isIdentityBinding as ea, NO_ATTEMPTS as ec, isDiscoveryBudgetError as ed, STATUS_AVAILABILITIES as ei, newInbox as el, ETHEREUM_USDT as en, EDIT_BUFFER_MS as eo, LIVENESS_PING_MS as er, MEMBER_KEY as es, groupName as et, createContactLink as eu, readAppStore as f, irohRelayUrl as fa, handoffHelloFrame as fc, setPublicKeyFastPath as fd, mayPin as fi, knockSlotRecords as fl, formatPaymentAmount as fn, COMMUNITY_REACTION_FRAME as fo, GROUP_WANT_NO_FRAME as fr, AWAITING_PEER_MS as fs, ATPROTO_DECLARED_SCOPE as ft, ownInviteRefusal as fu, GROUP_TYPING_FRAME as g, HoldKeys as ga, handoffReleaseFrame as gc, dropLoneJoiners as gd, readPin as gi, openRequest as gl, SPARK_NETWORKS as gn, nextReactionNumber as go, readGroupFileMeta as gr, PRESENCE_WINDOW as gs, atprotoDidMethod as gt, deviceEchoFrame as gu, signAppStore as h, HOLD_LIMITS as ha, handoffPakeFrame as hc, sanitizeAvatar as hd, pinNumberHolds as hi, mergeContactKnocks as hl, walletNetworkOf as hn, ReactionWindow as ho, isGroupMessageId as hr, EXPECT_PEER_MS as hs, ATPROTO_PROOF_SCOPE as ht, HANDOFF_CAPABILITY as hu, addedAppPermissions as i, lastSharedWithMe as ia, handoffAttemptSucceeded as ic, createRelayPayload as id, sanitizeStatusText as ii, turnOff as il, SEPOLIA_TEST_USDT as in, RateWindow as io, pairedMessageFrame as ir, rosterHas as is, parseSshPublicKey as it, deviceInviteJoinerParams as iu, entryParams as j, recordsFromWellKnown as ja, SET_UPDATE as jc, APP_DATA_MAX_BYTES as ji, readAppBundleAsync as jl, requestLnurlInvoice as jn, PR_STATES as jo, COMMUNITY_TOPOLOGY as jr, answersOffer as js, checkDidSignature as jt, firstDeviceSetSecret as ju, decodeGroupEntryLink as k, normalizeDomain as ka, sealHandoffPiece as kc, APP_RANGE_LIMITS as ki, pacer as kl, homeserverWebEndpoint as kn, ITEM_STATES as ko, meshHubs as kr, QUICK_REDIAL_MS as ks, DidError as kt, TURN_LAST_SEQUENCE as ku, planAppUpdate as l, automaticTransport as la, handoffDataFrame as lc, identityFromSeed as ld, typingActivity as li, contactDay as ll, arkAddressPrefix as ln, parseLinkPreview as lo, GROUP_FILE_LIMITS as lr, emptyRatchetState as ls, verifyBitcoinMessage as lt, encodeInviteCode as lu, repeatedJsonKey as m, HOLD_DATED_BACK_MS as ma, handoffOfferFrame as mc, MAX_AVATAR_LENGTH as md, pinIsNewer as mi, makeStampPaced as ml, validatePaymentTarget as mn, REACTION_LIMITS as mo, groupFileFallback as mr, DHT_POLL_INTERVALS as ms, ATPROTO_PROOF_COLLECTION as mt, ENROLL_CAPABILITY as mu, readX401SdJwtVc as n, receivedIdentityStatus as na, handoffAttemptAllowed as nc, PacketTooLargeError as nd, liveStatus as ni, settleRequest as nl, ONCHAIN_PROVIDER as nn, MAX_REMOVAL_NUMBER as no, pairedEditFits as nr, parseGroupCommit as ns, SSHSIG_NAMESPACE as nt, readContactLink as nu, appStoreDecision as o, emptyProofLedger as oa, handoffCancelFrame as oc, openRelayPayload as od, TYPING_REFRESH_MS as oi, REQUEST_LIFETIME_MS as ol, TEST_USDT_FAUCET_AMOUNT as on, LINK_TRAILING as oo, engineError as or, edgeParams as os, sameSshKey as ot, OwnInviteError as ou, readAppStoreSteps as p, HOLD_CAPABILITY as pa, handoffManifestFrames as pc, verify as pd, nextPinNumber as pi, linkRecords as pl, parsePaymentAmount as pn, GROUP_REACTION_FRAME as po, fetchesByItself as pr, DAEMON_WATCH_PEER_IDLE_MS as ps, ATPROTO_FULL_SCOPE as pt, DEVICES_CAPABILITY as pu, COMMUNITY_EDIT_FRAME as q, baseMime as qa, enrollProofFrame as qc, IdentityExchange as qi, signAppObject as ql, NO_PICTURE_METADATA as qn, claimedTime as qo, shouldBeHub as qr, HANDOFF_HELLO as qs, DidDhtError as qt, currentRelays as qu, sameX401HolderJwk as r, revokesIdentity as ra, handoffAttemptFailed as rc, RELAY_PAYLOAD_MAX_BYTES as rd, personStatus as ri, takeRequest as rl, PaymentPreflightError as rn, REMOVED_TEXT as ro, pairedMessageFits as rr, rosterAdmin as rs, SshSigError as rt, createDeviceInvite as ru, appUpdateDecision as s, validExternalKey as sa, handoffContext as sc, parseRelayPayload as sd, TypingSender as si, contactAskerFrame as sl, USDT_PUBLIC_RPC as sn, linkStop as so, engineText as sr, RATCHET_CAPABILITY as ss, sshSignCommand as st, createChatInvite as su, newX401HolderKey as t, newIdentityBinding as ta, filePartName as tc, withRequestOptions as td, STATUS_IDLE_AFTER_MS as ti, planKnocks as tl, EVM_TEST_CHAINS as tn, EDIT_RATE_WINDOW_MS as to, PAIRED_FRAME_TOO_LARGE as tr, commitHash as ts, SSHSIG_MAX_ARMOR as tt, encodeContactLink as tu, APP_STORE_LIMITS as u, dialableIrohRelay as ua, handoffDigest as uc, identityFromSeedB64 as ud, GROUP_PIN_FRAME as ui, knockSlotIdentity as ul, assertTokenUnits as un, forwardedAgain as uo, GROUP_HAVE_FRAME as ur, ratchetSessionOf as us, BitcoinAddressError as ut, inviteLink as uu, groupTypingEpoch as v, isHoldUrl as va, handoffStreamKey as vc, sanitizeDisplayText as vd, WAKE_ONLINE_BATCH_MS as vi, readLinkRecord as vl, sparkAddressKind as vn, reactionEmoji as vo, readGroupWant as vr, WATCH_PEER_MS as vs, atprotoProofRkey as vt, deviceKeyZ32 as vu, communityHasFrame as w, domainTxtRecord as wa, readHandoffHave as wc, toBase64Url as wd, parseWakeFrame as wi, appDigest as wl, newPubkyProofFolder as wn, readReply as wo, SIGNAL_REPLY_MS as wr, LIMITS as ws, AtprotoProofError as wt, TURN_PUT_WINDOW_MS as wu, COMMUNITY_LIMITS as x, DOMAIN_FILE_MAX_BYTES as xa, readHandoffAck as xc, fromBase64Url as xd, WakeLimiter as xi, APP_BUNDLE_LIMITS as xl, PUBKY_PROOF_MAX_BYTES as xn, validReactionNumber as xo, GROUP_SIGNAL_FRAME as xr, formatLocalTarget as xs, normalizeAtprotoHandle as xt, newDeviceSetSecret as xu, openGroupTyping as y, newMailbox as ya, handoffVersions as yc, stripHidden as yd, WAKE_ONLINE_DELAY_MS as yi, requestRecords as yl, sparkInvoiceDetails as yn, reactionIsNewer as yo, readGroupWantNo as yr, presenceSeenAt as ys, checkAtprotoProofRecord as yt, deviceLinkPairing as yu, groupWakes as z, DHT_FILE_CAPABILITY as za, ENROLL_HELLO as zc, CapsExchange as zi, isAppHash as zl, parseCashuRequestPayload as zn, cardLine as zo, mergeBeacon as zr, emptyLinkRecords as zs, didWebHost as zt, turnStatedVerifier as zu };
40717
41345
 
40718
- //# sourceMappingURL=src-DjVj2ynY.js.map
41346
+ //# sourceMappingURL=src-DJe-OYxd.js.map