@ghostlytools/cli 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +11 -8
  2. package/SKILL.md +4 -3
  3. package/dist/assets/{api-I_KbuXHa.js → api-DFCgr6RH.js} +94 -35
  4. package/dist/assets/api-DFCgr6RH.js.map +1 -0
  5. package/dist/assets/{api-Dj1yn0px.js → api-raWw9j_m.js} +2 -2
  6. package/dist/assets/{apiKit-C-_PWZvy.js → apiKit-CCavJJcl.js} +2 -2
  7. package/dist/assets/{apiKit-C-_PWZvy.js.map → apiKit-CCavJJcl.js.map} +1 -1
  8. package/dist/assets/{apps-DbEfL_3b.js → apps-B7o2BPj6.js} +1 -1
  9. package/dist/assets/{apps-DKIe8VjF.js → apps-DmxEG147.js} +2 -2
  10. package/dist/assets/{apps-DKIe8VjF.js.map → apps-DmxEG147.js.map} +1 -1
  11. package/dist/assets/{arkade-k1bdSm70.js → arkade-DtYR9H0c.js} +2 -2
  12. package/dist/assets/{arkade-k1bdSm70.js.map → arkade-DtYR9H0c.js.map} +1 -1
  13. package/dist/assets/{backup-Cdd6-HNu.js → backup-BserdrNk.js} +1 -1
  14. package/dist/assets/{backup-beKfbfNk.js → backup-YIB2XIES.js} +4 -4
  15. package/dist/assets/{backup-beKfbfNk.js.map → backup-YIB2XIES.js.map} +1 -1
  16. package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +1 -1
  17. package/dist/assets/buttons-CuRfKnPI.js +1331 -0
  18. package/dist/assets/buttons-CuRfKnPI.js.map +1 -0
  19. package/dist/assets/buttons-De3LPdSG.js +2 -0
  20. package/dist/assets/{envelope-B88yiCQj.js → envelope-Dt75vrmY.js} +2 -2
  21. package/dist/assets/{envelope-B88yiCQj.js.map → envelope-Dt75vrmY.js.map} +1 -1
  22. package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js.map +1 -1
  23. package/dist/assets/fixedHosts-B598JzbC.js +24 -0
  24. package/dist/assets/fixedHosts-B598JzbC.js.map +1 -0
  25. package/dist/assets/{ghostly_iroh_web-CO0onry8.js → ghostly_iroh_web-BzAXJUYH.js} +10 -10
  26. package/dist/assets/{ghostly_iroh_web-CO0onry8.js.map → ghostly_iroh_web-BzAXJUYH.js.map} +1 -1
  27. package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
  28. package/dist/assets/{groupFiles-DjQc5XXv.js → groupFiles-FXel6zIc.js} +41 -11
  29. package/dist/assets/groupFiles-FXel6zIc.js.map +1 -0
  30. package/dist/assets/{host-CNWGB3-j.js → host-DIBeK_c_.js} +95 -28
  31. package/dist/assets/host-DIBeK_c_.js.map +1 -0
  32. package/dist/assets/hyperdhtRelay-1wzya_0L.js +25 -0
  33. package/dist/assets/hyperdhtRelay-1wzya_0L.js.map +1 -0
  34. package/dist/assets/{hyperdhtRelay-g7eXzf5h.js → hyperdhtRelay-D185dETu.js} +15 -3
  35. package/dist/assets/hyperdhtRelay-D185dETu.js.map +1 -0
  36. package/dist/assets/{irohWeb-Bx8dI4be.js → irohWeb-BSv_BWyG.js} +25 -8
  37. package/dist/assets/{irohWeb-Bx8dI4be.js.map → irohWeb-BSv_BWyG.js.map} +1 -1
  38. package/dist/assets/{main-BRxhBctJ.js → main-BbhfMTt8.js} +50 -22
  39. package/dist/assets/main-BbhfMTt8.js.map +1 -0
  40. package/dist/assets/{mainline-CwuS6ngj.js → mainline-9Vc3c3SA.js} +2 -2
  41. package/dist/assets/{mainline-CwuS6ngj.js.map → mainline-9Vc3c3SA.js.map} +1 -1
  42. package/dist/assets/{networkReason-CIAMieQm.js → networkReason-BncJ9KSM.js} +2 -2
  43. package/dist/assets/{networkReason-CIAMieQm.js.map → networkReason-BncJ9KSM.js.map} +1 -1
  44. package/dist/assets/{nwc-C9JLJJkL.js → nwc-QX3Yt1Sb.js} +3 -3
  45. package/dist/assets/{nwc-C9JLJJkL.js.map → nwc-QX3Yt1Sb.js.map} +1 -1
  46. package/dist/assets/{nwcProvider-pFMrsUJh.js → nwcProvider-CzX3xH47.js} +2 -2
  47. package/dist/assets/{nwcProvider-pFMrsUJh.js.map → nwcProvider-CzX3xH47.js.map} +1 -1
  48. package/dist/assets/ownDid-D8z5gwGI.js +281 -0
  49. package/dist/assets/ownDid-D8z5gwGI.js.map +1 -0
  50. package/dist/assets/{registry-Cks7FA_o.js → registry-B2Dtnibo.js} +5 -246
  51. package/dist/assets/registry-B2Dtnibo.js.map +1 -0
  52. package/dist/assets/{registry-DY2ixQfU.js → registry-PTtBMaYZ.js} +1 -1
  53. package/dist/assets/{resolve-C4Y2HPqQ.js → resolve-ZxVzwFNA.js} +3 -280
  54. package/dist/assets/resolve-ZxVzwFNA.js.map +1 -0
  55. package/dist/assets/{server-D9RAmGdm.js → server-Dw1o8z1o.js} +1144 -359
  56. package/dist/assets/server-Dw1o8z1o.js.map +1 -0
  57. package/dist/assets/{src-1RU4TilT.js → src-BD8RBVEp.js} +1269 -134
  58. package/dist/assets/src-BD8RBVEp.js.map +1 -0
  59. package/dist/assets/sshForges-DWrESWkK.js +253 -0
  60. package/dist/assets/sshForges-DWrESWkK.js.map +1 -0
  61. package/dist/assets/{translate-od5GbpvR.js → translate-D1uP0q32.js} +17 -5
  62. package/dist/assets/translate-D1uP0q32.js.map +1 -0
  63. package/dist/assets/{usdt-DldXV0MR.js → usdt-DhVN8geQ.js} +3 -3
  64. package/dist/assets/{usdt-DldXV0MR.js.map → usdt-DhVN8geQ.js.map} +1 -1
  65. package/dist/assets/{waitNotice-Ck3el3_Z.js → waitNotice-B8D8WhbE.js} +2 -2
  66. package/dist/assets/waitNotice-B8D8WhbE.js.map +1 -0
  67. package/dist/assets/{words-BS2qq_vV.js → words-DdXPkB3n.js} +3 -2
  68. package/dist/assets/words-DdXPkB3n.js.map +1 -0
  69. package/dist/ghostly.mjs +1 -1
  70. package/examples/call-echo.mjs +7 -5
  71. package/package.json +1 -1
  72. package/dist/assets/api-I_KbuXHa.js.map +0 -1
  73. package/dist/assets/buttons-BO1_7V4L.js +0 -2
  74. package/dist/assets/buttons-ClI13rdv.js +0 -545
  75. package/dist/assets/buttons-ClI13rdv.js.map +0 -1
  76. package/dist/assets/groupFiles-DjQc5XXv.js.map +0 -1
  77. package/dist/assets/host-CNWGB3-j.js.map +0 -1
  78. package/dist/assets/hyperdhtRelay-BT_wRxab.js +0 -21
  79. package/dist/assets/hyperdhtRelay-BT_wRxab.js.map +0 -1
  80. package/dist/assets/hyperdhtRelay-g7eXzf5h.js.map +0 -1
  81. package/dist/assets/main-BRxhBctJ.js.map +0 -1
  82. package/dist/assets/registry-Cks7FA_o.js.map +0 -1
  83. package/dist/assets/resolve-C4Y2HPqQ.js.map +0 -1
  84. package/dist/assets/server-D9RAmGdm.js.map +0 -1
  85. package/dist/assets/src-1RU4TilT.js.map +0 -1
  86. package/dist/assets/translate-od5GbpvR.js.map +0 -1
  87. package/dist/assets/waitNotice-Ck3el3_Z.js.map +0 -1
  88. package/dist/assets/words-BS2qq_vV.js.map +0 -1
@@ -3898,17 +3898,17 @@ function parseImageMeta(value, mime) {
3898
3898
  height
3899
3899
  } : void 0;
3900
3900
  }
3901
- var u16be = (b, at) => b[at] << 8 | b[at + 1];
3901
+ var u16be$1 = (b, at) => b[at] << 8 | b[at + 1];
3902
3902
  var u16le = (b, at) => b[at] | b[at + 1] << 8;
3903
3903
  var u24le = (b, at) => b[at] | b[at + 1] << 8 | b[at + 2] << 16;
3904
- var u32be = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
3904
+ var u32be$2 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
3905
3905
  var ascii = (b, at, text) => [...text].every((c, i) => b[at + i] === c.charCodeAt(0));
3906
3906
  var sized = (width, height) => edge(width) && edge(height) ? {
3907
3907
  width,
3908
3908
  height
3909
3909
  } : void 0;
3910
3910
  /** SOFn markers: every frame type but DHT (C4), JPG (C8) and DAC (CC). */
3911
- var JPEG_FRAME = /* @__PURE__ */ new Set([
3911
+ var JPEG_FRAME$1 = /* @__PURE__ */ new Set([
3912
3912
  192,
3913
3913
  193,
3914
3914
  194,
@@ -3928,8 +3928,8 @@ function exifOrientation(b, tiff, end) {
3928
3928
  if (tiff + 8 > end) return 1;
3929
3929
  const little = ascii(b, tiff, "II");
3930
3930
  if (!little && !ascii(b, tiff, "MM")) return 1;
3931
- const u16 = (at) => little ? u16le(b, at) : u16be(b, at);
3932
- const u32 = (at) => little ? u16le(b, at) + u16le(b, at + 2) * 65536 : u32be(b, at);
3931
+ const u16 = (at) => little ? u16le(b, at) : u16be$1(b, at);
3932
+ const u32 = (at) => little ? u16le(b, at) + u16le(b, at + 2) * 65536 : u32be$2(b, at);
3933
3933
  if (u16(tiff + 2) !== 42) return 1;
3934
3934
  const ifd = tiff + u32(tiff + 4);
3935
3935
  if (ifd + 2 > end) return 1;
@@ -3958,13 +3958,13 @@ function jpegSize(b) {
3958
3958
  continue;
3959
3959
  }
3960
3960
  if (marker === 217 || marker === 218) return void 0;
3961
- const length = u16be(b, at + 2);
3961
+ const length = u16be$1(b, at + 2);
3962
3962
  if (length < 2) return void 0;
3963
3963
  const end = Math.min(b.length, at + 2 + length);
3964
3964
  if (marker === 225 && ascii(b, at + 4, "Exif\0\0")) orientation = exifOrientation(b, at + 10, end);
3965
- if (JPEG_FRAME.has(marker)) {
3965
+ if (JPEG_FRAME$1.has(marker)) {
3966
3966
  if (at + 9 > b.length) return void 0;
3967
- const height = u16be(b, at + 5), width = u16be(b, at + 7);
3967
+ const height = u16be$1(b, at + 5), width = u16be$1(b, at + 7);
3968
3968
  return orientation >= 5 ? sized(height, width) : sized(width, height);
3969
3969
  }
3970
3970
  at += 2 + length;
@@ -4014,7 +4014,7 @@ function gifSize(b) {
4014
4014
  function imageSize(head) {
4015
4015
  const b = head;
4016
4016
  try {
4017
- if (b.length >= 24 && b[0] === 137 && ascii(b, 1, "PNG\r\n\n") && ascii(b, 12, "IHDR")) return sized(u32be(b, 16), u32be(b, 20));
4017
+ 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));
4018
4018
  if (b.length >= 10 && (ascii(b, 0, "GIF87a") || ascii(b, 0, "GIF89a"))) return gifSize(b);
4019
4019
  if (b.length >= 4 && b[0] === 255 && b[1] === 216 && b[2] === 255) return jpegSize(b);
4020
4020
  if (b.length >= 16 && ascii(b, 0, "RIFF") && ascii(b, 8, "WEBP")) return webpSize(b);
@@ -6028,7 +6028,7 @@ function isValidServiceId(id) {
6028
6028
  }
6029
6029
  function serviceIdFromName(name, taken = []) {
6030
6030
  const used = new Set(taken);
6031
- const base = name.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 24) || "service";
6031
+ const base = name.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 24) || "service";
6032
6032
  let id = base;
6033
6033
  for (let n = 2; used.has(id) || LEGACY_SERVICES.some((s) => s.id === id); n++) id = `${base}-${n}`;
6034
6034
  return id;
@@ -9349,7 +9349,7 @@ function messageKeys(mk) {
9349
9349
  function aad(lane, sender, recipient, header) {
9350
9350
  return concatBytes$1(utf8Encode("ghostly-ratchet/1"), new Uint8Array([LANE[lane]]), publicKeyFromZ32(sender), publicKeyFromZ32(recipient), header);
9351
9351
  }
9352
- function header$1(lane, session, n) {
9352
+ function header$2(lane, session, n) {
9353
9353
  return concatBytes$1(new Uint8Array([VERSION$1, LANE[lane]]), unb64(session.sid), unb64(session.dhsPub), u32$2(session.pnHold), u32$2(n));
9354
9354
  }
9355
9355
  function parseHeader(sealed) {
@@ -9394,7 +9394,7 @@ function ratchetSeal(prev, keys, lane, plaintext, options = {}) {
9394
9394
  }
9395
9395
  const session = state.current ??= newSession(context(keys), random(SID_BYTES), random, now);
9396
9396
  const [mk, next] = advance(session.send[lane]);
9397
- const head = header$1(lane, session, session.send[lane].n);
9397
+ const head = header$2(lane, session, session.send[lane].n);
9398
9398
  session.send[lane] = next;
9399
9399
  session.at = now;
9400
9400
  const { key, nonce } = messageKeys(mk);
@@ -10146,6 +10146,18 @@ function cardUrl(value) {
10146
10146
  if (url.protocol !== "https:" || !url.hostname || url.username || url.password) return void 0;
10147
10147
  return url.href.length <= STATUS_CARD_LIMITS.url ? url.href : void 0;
10148
10148
  }
10149
+ /**
10150
+ * The link an app card names, sent or read (WISP 405 § An app): a card's link without its query or fragment. A
10151
+ * private file's read token rides in a query, and a card goes to a contact; a bundle is pinned by its digest, not its link.
10152
+ */
10153
+ function appCardUrl(value) {
10154
+ const href = cardUrl(value);
10155
+ if (!href) return void 0;
10156
+ const url = new URL(href);
10157
+ url.search = "";
10158
+ url.hash = "";
10159
+ return url.href;
10160
+ }
10149
10161
  var count = (value, min = 0) => typeof value === "number" && Number.isSafeInteger(value) && value >= min && value <= STATUS_CARD_LIMITS.count ? value : void 0;
10150
10162
  /** A time on a card as a reader keeps it: a positive whole number, never later than `latest`. */
10151
10163
  var time = (value, latest) => typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? Math.min(value, latest) : void 0;
@@ -10255,7 +10267,7 @@ function readStatusCard(raw, now = Date.now()) {
10255
10267
  if (!isAppRef(raw.ref) || id !== appCardId(raw.ref) || !isAppHash(raw.digest) || !appSequence(raw.sequence)) return void 0;
10256
10268
  const title = cardLine(raw.title, STATUS_CARD_LIMITS.appTitle);
10257
10269
  if (!title) return void 0;
10258
- const version = cardLine(raw.version, STATUS_CARD_LIMITS.appVersion), url = cardUrl(raw.url);
10270
+ const version = cardLine(raw.version, STATUS_CARD_LIMITS.appVersion), url = appCardUrl(raw.url);
10259
10271
  return {
10260
10272
  kind: "app",
10261
10273
  id,
@@ -10593,8 +10605,8 @@ function removedCardText(of, title) {
10593
10605
  function statusCardText(card) {
10594
10606
  if (card.kind === "removed") return removedCardText(card.of);
10595
10607
  if (card.kind === "app") {
10596
- const named = `${card.title}${card.version ? ` ${card.version}` : ""}`;
10597
- return [card.opened ? `🧩 Opened ${named} in this chat (Ghostly app)` : `🧩 ${named} (Ghostly app)`, ...card.url ? [card.url] : []].join("\n");
10608
+ const named = `${card.title}${card.version ? ` ${card.version}` : ""}`, url = appCardUrl(card.url);
10609
+ return [card.opened ? `🧩 Opened ${named} in this chat (Ghostly app)` : `🧩 ${named} (Ghostly app)`, ...url ? [url] : []].join("\n");
10598
10610
  }
10599
10611
  if (card.kind === "usage") {
10600
10612
  const left = `${usageLeft(card)}% left${card.window ? ` (${card.window})` : ""}`;
@@ -13281,7 +13293,7 @@ function irohRelayUrl(value, spelling = "dotted") {
13281
13293
  const host = url.hostname, name = host.replace(/\.$/, "");
13282
13294
  if (!name.includes(".") && name !== "localhost") return value;
13283
13295
  if (name.startsWith("[") || /^\d+(\.\d+){3}$/.test(name)) return value;
13284
- const wanted = spelling === "plain" || name === "localhost" ? name : `${name}.`;
13296
+ const wanted = spelling === "dotted" && /(^|\.)iroh\.link$/.test(name) ? `${name}.` : name;
13285
13297
  if (wanted === host) return value;
13286
13298
  url.hostname = wanted;
13287
13299
  return url.href;
@@ -13301,6 +13313,14 @@ function irohDescriptor(descriptor, spelling = "dotted") {
13301
13313
  * as a test relay is (the same rule as the relay settings).
13302
13314
  */
13303
13315
  var RELAY_URL = /^((https|wss):\/\/[^\s]{1,120}|(http|ws):\/\/(127\.0\.0\.1|localhost|\[::1\])(:\d{1,5})?(\/[^\s]{0,100})?)$/;
13316
+ /**
13317
+ * A relay URL with more than its server's address in it: a login, a query or a fragment, which no relay setting takes
13318
+ * (irohWeb.ts `irohRelayProblem`, hyperdhtRelay.ts `hyperdhtRelayProblem`). An older app named its HyperDHT relay as
13319
+ * set, with them; such a descriptor is not dialed or kept, and the rest of what the contact told still is.
13320
+ */
13321
+ var RELAY_WITH_SECRETS = /^[a-z]+:\/\/[^/?#]*@|[?#]/i;
13322
+ /** A relay URL a descriptor may name: `RELAY_URL`, with nothing but the server's address in it. */
13323
+ var relayUrl = (value) => typeof value === "string" && RELAY_URL.test(value) && !RELAY_WITH_SECRETS.test(value);
13304
13324
  var HEX_KEY = /^[0-9a-f]{64}$/;
13305
13325
  /** An Iroh direct address as the adapters parse it: an IPv4 or bracketed IPv6 address and its port. */
13306
13326
  var SOCKET_ADDRESS = /^(\d{1,3}(\.\d{1,3}){3}|\[[0-9A-Fa-f:.]{2,45}(%[A-Za-z0-9._-]{1,16})?\]):\d{1,5}$/;
@@ -13308,7 +13328,7 @@ var MAX_ADDRESSES = 8;
13308
13328
  /**
13309
13329
  * A contact's native descriptors as it tells them on a session (`paired-policy`, `paired-adapters`) or as this app
13310
13330
  * kept them: only what the adapters dial, each field in the shape its adapter makes. The keys are 64 hex characters,
13311
- * a relay passes `RELAY_URL` (the rule its capability record is read by), an Iroh descriptor lists at most eight
13331
+ * a relay passes `relayUrl` (the rule its capability record is read by), an Iroh descriptor lists at most eight
13312
13332
  * socket addresses. A descriptor that is anything else is left out, as one the contact never told; a field this app
13313
13333
  * does not know is not kept.
13314
13334
  */
@@ -13316,17 +13336,16 @@ function checkedDescriptors(value) {
13316
13336
  const out = {};
13317
13337
  if (!value || typeof value !== "object" || Array.isArray(value)) return out;
13318
13338
  const raw = value;
13319
- const relay = (v) => typeof v === "string" && RELAY_URL.test(v);
13320
13339
  const relayed = (v) => v === void 0 || typeof v === "boolean";
13321
13340
  const iroh = raw["iroh/1"];
13322
- if (iroh && typeof iroh === "object" && typeof iroh.id === "string" && HEX_KEY.test(iroh.id) && (iroh.relay === void 0 || iroh.relay === null || relay(iroh.relay)) && relayed(iroh.relayed) && Array.isArray(iroh.addresses) && iroh.addresses.length <= MAX_ADDRESSES && iroh.addresses.every((a) => typeof a === "string" && SOCKET_ADDRESS.test(a))) out["iroh/1"] = {
13341
+ if (iroh && typeof iroh === "object" && typeof iroh.id === "string" && HEX_KEY.test(iroh.id) && (iroh.relay === void 0 || iroh.relay === null || relayUrl(iroh.relay)) && relayed(iroh.relayed) && Array.isArray(iroh.addresses) && iroh.addresses.length <= MAX_ADDRESSES && iroh.addresses.every((a) => typeof a === "string" && SOCKET_ADDRESS.test(a))) out["iroh/1"] = {
13323
13342
  id: iroh.id,
13324
13343
  relay: iroh.relay ?? null,
13325
13344
  addresses: [...iroh.addresses],
13326
13345
  ...iroh.relayed !== void 0 ? { relayed: iroh.relayed } : {}
13327
13346
  };
13328
13347
  const hyper = raw["hyperdht/1"];
13329
- if (hyper && typeof hyper === "object" && typeof hyper.publicKey === "string" && HEX_KEY.test(hyper.publicKey) && (hyper.relay === void 0 || relay(hyper.relay)) && relayed(hyper.relayed)) out["hyperdht/1"] = {
13348
+ if (hyper && typeof hyper === "object" && typeof hyper.publicKey === "string" && HEX_KEY.test(hyper.publicKey) && (hyper.relay === void 0 || relayUrl(hyper.relay)) && relayed(hyper.relayed)) out["hyperdht/1"] = {
13330
13349
  publicKey: hyper.publicKey,
13331
13350
  ...hyper.relay !== void 0 ? { relay: hyper.relay } : {},
13332
13351
  ...hyper.relayed !== void 0 ? { relayed: hyper.relayed } : {}
@@ -13820,7 +13839,7 @@ var decOrEmpty = (s) => {
13820
13839
  }
13821
13840
  };
13822
13841
  var hash = (s) => enc(sha256(utf8Encode(s)));
13823
- var header = enc(utf8Encode(JSON.stringify({
13842
+ var header$1 = enc(utf8Encode(JSON.stringify({
13824
13843
  alg: "EdDSA",
13825
13844
  typ: "ghostly-pubky-identity-delegation/1"
13826
13845
  })));
@@ -13837,7 +13856,7 @@ function ringClaims(statement, issuer, delegate, issuedAt, expiresAt) {
13837
13856
  function verifyRingAuthorization(authorization, statement, issuer, issuedAt, expiresAt) {
13838
13857
  if (typeof authorization !== "string" || authorization.length > 2400) throw new Error("Invalid Ring authorization");
13839
13858
  const [h, p, s, ...extra] = authorization.split(".");
13840
- if (extra.length || h !== header || !p || !s) throw new Error("Unsupported Ring authorization");
13859
+ if (extra.length || h !== header$1 || !p || !s) throw new Error("Unsupported Ring authorization");
13841
13860
  let claims;
13842
13861
  try {
13843
13862
  claims = JSON.parse(utf8Decode(dec(p)));
@@ -15020,12 +15039,12 @@ function capsDescriptors(descriptors) {
15020
15039
  const iroh = descriptors?.["iroh/1"];
15021
15040
  if (iroh && typeof iroh.id === "string" && HEX64$1.test(iroh.id)) out["iroh/1"] = {
15022
15041
  id: hexToKey(iroh.id),
15023
- ...typeof iroh.relay === "string" && RELAY_URL.test(iroh.relay) ? { relay: iroh.relay } : {}
15042
+ ...relayUrl(iroh.relay) ? { relay: iroh.relay } : {}
15024
15043
  };
15025
15044
  const hyper = descriptors?.["hyperdht/1"];
15026
15045
  if (hyper && typeof hyper.publicKey === "string" && HEX64$1.test(hyper.publicKey)) out["hyperdht/1"] = {
15027
15046
  publicKey: hexToKey(hyper.publicKey),
15028
- ...typeof hyper.relay === "string" && RELAY_URL.test(hyper.relay) ? { relay: hyper.relay } : {}
15047
+ ...relayUrl(hyper.relay) ? { relay: hyper.relay } : {}
15029
15048
  };
15030
15049
  return out;
15031
15050
  }
@@ -15059,16 +15078,17 @@ function parseDescriptors(value) {
15059
15078
  const raw = value;
15060
15079
  const out = {};
15061
15080
  const iroh = raw["iroh/1"], hyper = raw["hyperdht/1"];
15081
+ const withSecrets = (relay) => typeof relay === "string" && RELAY_WITH_SECRETS.test(relay);
15062
15082
  if (iroh !== void 0) {
15063
15083
  if (!iroh || typeof iroh.id !== "string" || !KEY.test(iroh.id) || iroh.relay !== void 0 && (typeof iroh.relay !== "string" || !RELAY_URL.test(iroh.relay))) return null;
15064
- out["iroh/1"] = {
15084
+ if (!withSecrets(iroh.relay)) out["iroh/1"] = {
15065
15085
  id: iroh.id,
15066
15086
  ...iroh.relay !== void 0 ? { relay: iroh.relay } : {}
15067
15087
  };
15068
15088
  }
15069
15089
  if (hyper !== void 0) {
15070
15090
  if (!hyper || typeof hyper.publicKey !== "string" || !KEY.test(hyper.publicKey) || hyper.relay !== void 0 && (typeof hyper.relay !== "string" || !RELAY_URL.test(hyper.relay))) return null;
15071
- out["hyperdht/1"] = {
15091
+ if (!withSecrets(hyper.relay)) out["hyperdht/1"] = {
15072
15092
  publicKey: hyper.publicKey,
15073
15093
  ...hyper.relay !== void 0 ? { relay: hyper.relay } : {}
15074
15094
  };
@@ -18185,8 +18205,20 @@ var FILE_LIMITS = {
18185
18205
  stallMs: 6e4,
18186
18206
  /** A receiver makes what it stored durable, and records the point to resume from, this often. */
18187
18207
  checkpointBytes: 8388608,
18188
- /** A receiver confirms at least this often while writing. */
18208
+ /**
18209
+ * A receiver confirms at least this often while writing, and the file's last bytes at once. Its writes are buffered
18210
+ * and done at once, so confirming whenever they were all done too was confirming nearly every chunk: 6,400 confirms for
18211
+ * 100 MiB, each a native call and a progress update on both sides. A host that batches them (`batchConfirms`) does not.
18212
+ */
18189
18213
  ackEveryBytes: 131072,
18214
+ /**
18215
+ * Batched (`ChatFilesHost.batchConfirms`), bytes stored and not confirmed are confirmed this long after the first of
18216
+ * them was stored, at most. What a sender has in flight may be no more than `ackEveryBytes` (a window at its floor, one
18217
+ * chunk while the path is measured), and bytes waiting here for a confirm are bytes it cannot send: on a slow or
18218
+ * wavering path a confirm comes about every this long, as fast as the window needs. A round trip it measures is up to
18219
+ * this much longer, well inside the queue it allows (`queueMs`).
18220
+ */
18221
+ ackWaitMs: 10,
18190
18222
  /** A sender reads its file this much at a time. */
18191
18223
  readBytes: 1048576,
18192
18224
  /** The session refused a data frame (its send budget was full): the sender looks again after this long. */
@@ -18516,6 +18548,13 @@ var ChatFiles = class {
18516
18548
  peerRoomValue = null;
18517
18549
  /** What the chat's files may have in flight, sized by the path. */
18518
18550
  pace = new FilePace();
18551
+ /**
18552
+ * What the chat's files had in flight just before the last confirm. A receiver confirms many chunks at once
18553
+ * (`ackEveryBytes`), and the chunks sent for them go with that much in flight, the window: counted one by one, the
18554
+ * first went with the window less a confirm, and read as a path carrying that little, it shrank the window and ended
18555
+ * every trial of a larger one (a fifth of the rate on a wavering path). Confirmed chunk by chunk, it is what each sends with.
18556
+ */
18557
+ refill = 0;
18519
18558
  constructor(host) {
18520
18559
  this.host = host;
18521
18560
  }
@@ -18600,6 +18639,7 @@ var ChatFiles = class {
18600
18639
  this.attached = true;
18601
18640
  this.peerRoomValue = null;
18602
18641
  this.pace.reset();
18642
+ this.refill = 0;
18603
18643
  this.host.uplink?.join(this);
18604
18644
  this.sayRoom();
18605
18645
  this.sweep();
@@ -18635,7 +18675,11 @@ var ChatFiles = class {
18635
18675
  clearTimeout(entry.out.wake);
18636
18676
  entry.out.next = entry.record.confirmed;
18637
18677
  }
18638
- if (entry.in) clearTimeout(entry.in.timer);
18678
+ if (entry.in) {
18679
+ clearTimeout(entry.in.timer);
18680
+ clearTimeout(entry.in.ackTimer);
18681
+ entry.in.ackTimer = void 0;
18682
+ }
18639
18683
  if (entry.in && !transferEnded(entry.record)) this.checkpoint(entry);
18640
18684
  }
18641
18685
  }
@@ -18722,7 +18766,7 @@ var ChatFiles = class {
18722
18766
  out.next = record.confirmed;
18723
18767
  const paused = record.state === "paused" && record.pausedBy === "me";
18724
18768
  if (!this.send(this.offerFrame(record, paused))) return;
18725
- if (!paused && record.state !== "offered") {
18769
+ if (!paused && record.state !== "offered" && record.state !== "verifying") {
18726
18770
  record.state = "offered";
18727
18771
  record.pausedBy = void 0;
18728
18772
  this.changed(entry);
@@ -18829,7 +18873,7 @@ var ChatFiles = class {
18829
18873
  out.sends.push({
18830
18874
  end: out.next,
18831
18875
  at: this.now(),
18832
- flight: this.inFlight(),
18876
+ flight: Math.max(this.inFlight(), Math.min(this.refill, this.pace.limit(this.floor()))),
18833
18877
  generation
18834
18878
  });
18835
18879
  }
@@ -18958,9 +19002,16 @@ var ChatFiles = class {
18958
19002
  this.startNext();
18959
19003
  });
18960
19004
  }
18961
- /** The next file waiting its turn, once one ends. */
19005
+ /**
19006
+ * The next file waiting its turn, once one ends. The others were told they wait when they were queued: told again at
19007
+ * each end, n files at once made about n²/2 frames, and their sender stored its record for each.
19008
+ */
18962
19009
  startNext() {
18963
- for (const entry of this.entries.values()) if (entry.record.direction === "in" && entry.record.state === "queued") this.startIncoming(entry);
19010
+ for (const entry of this.entries.values()) {
19011
+ if (entry.record.direction !== "in" || entry.record.state !== "queued" || entry.in.starting) continue;
19012
+ if (this.activeIncoming(entry) >= FILE_LIMITS.maxActiveIncoming) return;
19013
+ this.startIncoming(entry);
19014
+ }
18964
19015
  }
18965
19016
  async onOffer(frame) {
18966
19017
  const id = frame.id;
@@ -19178,6 +19229,7 @@ var ChatFiles = class {
19178
19229
  /** An agreed file that ended here, offered again: taken again from the start. */
19179
19230
  async retake(entry) {
19180
19231
  await entry.in?.target?.then((t) => t.discard()).catch(() => {});
19232
+ clearTimeout(entry.in?.ackTimer);
19181
19233
  entry.in = {
19182
19234
  written: 0,
19183
19235
  stored: 0,
@@ -19230,15 +19282,8 @@ var ChatFiles = class {
19230
19282
  if (transferEnded(record) || incoming.dropped) return;
19231
19283
  await (await target).append(bytes);
19232
19284
  incoming.stored = offset + bytes.length;
19233
- if (incoming.stored === incoming.written || incoming.stored - incoming.acked >= FILE_LIMITS.ackEveryBytes) {
19234
- incoming.acked = incoming.stored;
19235
- this.send({
19236
- t: "pf-got",
19237
- id: record.id,
19238
- offset: incoming.stored
19239
- });
19240
- this.changed(entry, true);
19241
- }
19285
+ if (incoming.stored - incoming.acked >= FILE_LIMITS.ackEveryBytes || incoming.stored === record.file.size || !this.host.batchConfirms && incoming.stored === incoming.written) this.confirm(entry);
19286
+ else if (this.host.batchConfirms) incoming.ackTimer ??= setTimeout(() => this.confirm(entry), FILE_LIMITS.ackWaitMs);
19242
19287
  if (incoming.stored - incoming.checkpointed >= FILE_LIMITS.checkpointBytes) await this.checkpointNow(entry);
19243
19288
  }).catch((error) => {
19244
19289
  if (transferEnded(record)) return;
@@ -19252,6 +19297,20 @@ var ChatFiles = class {
19252
19297
  this.startNext();
19253
19298
  });
19254
19299
  }
19300
+ /** `pf-got` for what is stored and not confirmed yet. */
19301
+ confirm(entry) {
19302
+ const { record } = entry, incoming = entry.in;
19303
+ clearTimeout(incoming.ackTimer);
19304
+ incoming.ackTimer = void 0;
19305
+ if (transferEnded(record) || incoming.stored <= incoming.acked) return;
19306
+ incoming.acked = incoming.stored;
19307
+ this.send({
19308
+ t: "pf-got",
19309
+ id: record.id,
19310
+ offset: incoming.stored
19311
+ });
19312
+ this.changed(entry, true);
19313
+ }
19255
19314
  /** What was stored is durable, and a restart resumes from there. */
19256
19315
  async checkpoint(entry) {
19257
19316
  if (!entry.in?.target) return;
@@ -19417,6 +19476,7 @@ var ChatFiles = class {
19417
19476
  out.generation++;
19418
19477
  record.confirmed = frame.offset;
19419
19478
  out.next = frame.offset;
19479
+ this.refill = 0;
19420
19480
  record.state = "active";
19421
19481
  record.pausedBy = record.waitingFor = void 0;
19422
19482
  this.changed(outgoing);
@@ -19429,6 +19489,7 @@ var ChatFiles = class {
19429
19489
  return;
19430
19490
  case "pf-wait":
19431
19491
  if (record.state === "paused" && record.pausedBy === "me") return;
19492
+ if (frame.why === "paused" ? record.state === "paused" && record.pausedBy === "peer" : record.state === "asking" && record.waitingFor === (frame.why === "busy" ? "busy" : "consent")) return;
19432
19493
  out.generation++;
19433
19494
  out.next = record.confirmed;
19434
19495
  clearTimeout(out.timer);
@@ -19444,6 +19505,7 @@ var ChatFiles = class {
19444
19505
  return;
19445
19506
  case "pf-got": {
19446
19507
  if (!isInt$1(frame.offset) || frame.offset <= record.confirmed || frame.offset > out.next) return;
19508
+ this.refill = this.inFlight();
19447
19509
  this.pace.delivered += frame.offset - record.confirmed;
19448
19510
  record.confirmed = frame.offset;
19449
19511
  let sample;
@@ -19488,6 +19550,8 @@ var ChatFiles = class {
19488
19550
  if (entry.in) {
19489
19551
  const incoming = entry.in;
19490
19552
  clearTimeout(incoming.timer);
19553
+ clearTimeout(incoming.ackTimer);
19554
+ incoming.ackTimer = void 0;
19491
19555
  incoming.writing.finally(() => {
19492
19556
  if (transferEnded(record)) incoming.target = void 0;
19493
19557
  });
@@ -19526,6 +19590,7 @@ var ChatFiles = class {
19526
19590
  const entry = this.entry(direction, id), { record } = entry;
19527
19591
  if (transferEnded(record) || record.state === "verifying" || record.state === "paused" && record.pausedBy === "me") return;
19528
19592
  if (direction === "in" && record.state === "asking") return;
19593
+ if (sentWhole(record)) return;
19529
19594
  record.state = "paused";
19530
19595
  record.pausedBy = "me";
19531
19596
  if (entry.out) {
@@ -20212,6 +20277,8 @@ var CarriedTransport = class {
20212
20277
  seen = -1n;
20213
20278
  /** A read under way: resolved when a carried packet comes meanwhile. */
20214
20279
  waiting = null;
20280
+ /** The records of a publish refused before they were signed, while nobody could carry them: signed when one can (`latest`). */
20281
+ unsigned = null;
20215
20282
  /** The packet the relays have not got yet. */
20216
20283
  pending = null;
20217
20284
  /** How many carried packets of the member's came: a deferral that ends with none more says no member reaches it. */
@@ -20244,6 +20311,7 @@ var CarriedTransport = class {
20244
20311
  async publish(identity, records, options) {
20245
20312
  if (this.stopped || identity.pubKeyZ32 !== this.myKey) return this.inner.publish(identity, records, options);
20246
20313
  this.drop();
20314
+ this.unsigned = null;
20247
20315
  if (this.hooks.open()) {
20248
20316
  const relayOptions = options?.signal ? options : {
20249
20317
  ...options,
@@ -20257,6 +20325,16 @@ var CarriedTransport = class {
20257
20325
  if (this.hooks.direct && this.inner.publishPayload) published.then(() => this.handDirect(payload), () => {});
20258
20326
  return published;
20259
20327
  }
20328
+ if (this.hooks.canCarry && !this.hooks.canCarry()) {
20329
+ const held = this.inner.publishHeld?.(identity.pubKeyZ32, options);
20330
+ if (held) {
20331
+ this.unsigned = {
20332
+ identity,
20333
+ records
20334
+ };
20335
+ throw held;
20336
+ }
20337
+ }
20260
20338
  const payload = this.newest = this.stamp(identity, records);
20261
20339
  this.mine = payload;
20262
20340
  let carried = {
@@ -20423,13 +20501,20 @@ var CarriedTransport = class {
20423
20501
  }
20424
20502
  /** My newest packet for this edge while it is down, for a member that can pass it on now; null once it is up. */
20425
20503
  latest() {
20426
- return this.stopped || this.hooks.open() ? null : this.mine;
20504
+ if (this.stopped || this.hooks.open()) return null;
20505
+ if (this.unsigned) {
20506
+ const { identity, records } = this.unsigned;
20507
+ this.unsigned = null;
20508
+ this.mine = this.newest = this.stamp(identity, records);
20509
+ }
20510
+ return this.mine;
20427
20511
  }
20428
20512
  /** The edge is going: nothing more is deferred or carried, and a last packet goes straight to the relays. */
20429
20513
  stop() {
20430
20514
  this.stopped = true;
20431
20515
  this.drop();
20432
20516
  this.mine = null;
20517
+ this.unsigned = null;
20433
20518
  const waiting = this.waiting;
20434
20519
  this.waiting = null;
20435
20520
  waiting?.();
@@ -22640,6 +22725,9 @@ var GhostLink = class {
22640
22725
  this.advertiseTransports();
22641
22726
  this.options.events?.onTransportsChanged?.();
22642
22727
  };
22728
+ endpoint.onRelayBack = () => {
22729
+ if (this.endpoints.get(endpoint.transport) === endpoint) this.knockAgain(endpoint.transport);
22730
+ };
22643
22731
  this.advertiseTransports();
22644
22732
  if (this.resuming === endpoint.transport) this.knock(endpoint.transport);
22645
22733
  else this.joinRace(endpoint.transport);
@@ -22817,6 +22905,11 @@ var GhostLink = class {
22817
22905
  if (!this.transportOffer().includes(transport)) return;
22818
22906
  const epoch = this.connectionEpoch;
22819
22907
  this.dialing = true;
22908
+ const knocking = this.knocking = {
22909
+ transport,
22910
+ epoch,
22911
+ again: false
22912
+ };
22820
22913
  traceLink(this.myPubKeyZ32, "knock", { transport });
22821
22914
  try {
22822
22915
  const { channel, binding } = await endpoint.connect(descriptor);
@@ -22831,6 +22924,7 @@ var GhostLink = class {
22831
22924
  error: error instanceof Error ? error.message : String(error)
22832
22925
  });
22833
22926
  } finally {
22927
+ if (this.knocking === knocking) this.knocking = null;
22834
22928
  if (epoch === this.connectionEpoch) {
22835
22929
  this.dialing = false;
22836
22930
  this.settleCrossed();
@@ -22838,6 +22932,36 @@ var GhostLink = class {
22838
22932
  }
22839
22933
  if (!this.channel) this.maybeAutoConnect(this.presence);
22840
22934
  }
22935
+ /** The knock under way (`knock`): its transport, its attempt, and whether it was knocked again (`knockAgain`). */
22936
+ knocking = null;
22937
+ /**
22938
+ * The endpoint of a knock still under way is back on its relay (`NativeEndpoint.onRelayBack`): it is knocked again, once,
22939
+ * beside the first, and the first live wins. An Android phone back from Doze knocked at once through an Iroh whose relay
22940
+ * was gone; Iroh found it again only seconds later (its reconnect backoff, up to 16 s), and what the knock sent meanwhile
22941
+ * went nowhere: QUIC sends it again seconds on, and the dial is given 20 s. Live again 4.4 s and 9.8 s after the
22942
+ * return (away 5 and 15 minutes), and once not over Iroh at all (the emulator with a CLI bot, 2026-11-01).
22943
+ */
22944
+ async knockAgain(transport) {
22945
+ const knocking = this.knocking;
22946
+ if (!knocking || knocking.transport !== transport || knocking.again || knocking.epoch !== this.connectionEpoch) return;
22947
+ const endpoint = this.endpoints.get(transport), descriptor = this.peerDescriptors[transport];
22948
+ if (!endpoint || !descriptor || this.channel || this.stopped || this.streamBlocked || this.keyStopped) return;
22949
+ knocking.again = true;
22950
+ traceLink(this.myPubKeyZ32, "knock-again", { transport });
22951
+ try {
22952
+ const { channel, binding } = await endpoint.connect(descriptor);
22953
+ if (this.stopped || knocking.epoch !== this.connectionEpoch || this.channel) {
22954
+ channel.close();
22955
+ return;
22956
+ }
22957
+ this.attach(channel, binding);
22958
+ } catch (error) {
22959
+ traceLink(this.myPubKeyZ32, "knock-again-failed", {
22960
+ transport,
22961
+ error: error instanceof Error ? error.message : String(error)
22962
+ });
22963
+ }
22964
+ }
22841
22965
  canReleaseEndpoint(transport) {
22842
22966
  return this.activeBinding?.transport !== transport && this.candidate?.binding?.transport !== transport && !this.dialing && !this.switcher.pending && !this.transitionTarget;
22843
22967
  }
@@ -26022,6 +26146,993 @@ var GhostLink = class {
26022
26146
  }
26023
26147
  };
26024
26148
  //#endregion
26149
+ //#region ../core/src/pictureMetadata.ts
26150
+ /**
26151
+ * What a picture leaves with. A photo's file says more than its pixels: its Exif and XMP hold where it was taken, the
26152
+ * device, the time, often a thumbnail of the uncropped original. The sender removes them before the file is stored and
26153
+ * its digest computed, so what the contact (or anyone in a community) receives is the picture alone: JPEG, PNG, WebP
26154
+ * and HEIF (HEIC, AVIF), without decoding or re-encoding a pixel.
26155
+ *
26156
+ * Fail-closed: a file that is one of these pictures, by its bytes or by its type, and whose metadata cannot be removed
26157
+ * (truncated, malformed, a part this does not know) is refused with `NO_PICTURE_METADATA`, never sent as it was. Any
26158
+ * other file goes as it is.
26159
+ */
26160
+ var PICTURE_METADATA_LIMITS = {
26161
+ /** The largest picture read whole to remove its metadata: past this it is refused. */
26162
+ maxBytes: 268435456,
26163
+ /** Bytes read first to tell a picture from another file. */
26164
+ headBytes: 64
26165
+ };
26166
+ /** Why a picture is refused: its metadata could not be removed, so it does not go at all. */
26167
+ var NO_PICTURE_METADATA = "This picture cannot be sent: Ghostly could not remove the details saved in it, like where it was taken";
26168
+ /** The types of the pictures stripped here: a file of one of them whose bytes are not that picture is refused. */
26169
+ var STRIPPED_TYPES$1 = /* @__PURE__ */ new Set([
26170
+ "image/jpeg",
26171
+ "image/jpg",
26172
+ "image/pjpeg",
26173
+ "image/png",
26174
+ "image/apng",
26175
+ "image/webp",
26176
+ "image/heic",
26177
+ "image/heif",
26178
+ "image/heic-sequence",
26179
+ "image/heif-sequence",
26180
+ "image/avif",
26181
+ "image/gif",
26182
+ "image/tiff",
26183
+ "image/tiff-fx"
26184
+ ]);
26185
+ /** HEIF brands (HEIC, AVIF, the generic `mif1`): an MP4 video's `ftyp` names none of them. */
26186
+ var HEIF_BRANDS = /* @__PURE__ */ new Set([
26187
+ "heic",
26188
+ "heix",
26189
+ "heim",
26190
+ "heis",
26191
+ "hevc",
26192
+ "hevx",
26193
+ "mif1",
26194
+ "mif2",
26195
+ "msf1",
26196
+ "avif",
26197
+ "avis"
26198
+ ]);
26199
+ var u16be = (b, at) => b[at] << 8 | b[at + 1];
26200
+ var u32be$1 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
26201
+ var u32le = (b, at) => (b[at] | b[at + 1] << 8 | b[at + 2] << 16 | b[at + 3] << 24) >>> 0;
26202
+ var text$1 = (b, at, length) => String.fromCharCode(...b.subarray(at, at + length));
26203
+ var starts = (b, at, prefix) => at + prefix.length <= b.length && text$1(b, at, prefix.length) === prefix;
26204
+ /** A picture this strips, by its first bytes. */
26205
+ function kindOf(b) {
26206
+ if (b.length >= 3 && b[0] === 255 && b[1] === 216 && b[2] === 255) return "jpeg";
26207
+ if (b.length >= 8 && b[0] === 137 && starts(b, 1, "PNG\r\n\n")) return "png";
26208
+ if (b.length >= 12 && starts(b, 0, "RIFF") && starts(b, 8, "WEBP")) return "webp";
26209
+ if (starts(b, 0, "GIF87a") || starts(b, 0, "GIF89a")) return "gif";
26210
+ if (starts(b, 0, "II*\0") || starts(b, 0, "MM\0*") || starts(b, 0, "II+\0") || starts(b, 0, "MM\0+")) return "tiff";
26211
+ if (b.length >= 16 && starts(b, 4, "ftyp")) {
26212
+ const end = Math.min(b.length, u32be$1(b, 0));
26213
+ for (let at = 8; at + 4 <= end; at += 4) if (at !== 12 && HEIF_BRANDS.has(text$1(b, at, 4))) return "heif";
26214
+ }
26215
+ }
26216
+ /** Refuses the picture where its bytes are not what this expects. */
26217
+ function check$1(ok) {
26218
+ if (!ok) throw new Error(NO_PICTURE_METADATA);
26219
+ }
26220
+ /** SOFn markers: every frame type but DHT (C4), JPG (C8) and DAC (CC). */
26221
+ var JPEG_FRAME = /* @__PURE__ */ new Set([
26222
+ 192,
26223
+ 193,
26224
+ 194,
26225
+ 195,
26226
+ 197,
26227
+ 198,
26228
+ 199,
26229
+ 201,
26230
+ 202,
26231
+ 203,
26232
+ 205,
26233
+ 206,
26234
+ 207
26235
+ ]);
26236
+ function jpegKeeps(marker, b, payload) {
26237
+ if (marker >= 192 && marker <= 207 || marker >= 218 && marker <= 223) return true;
26238
+ if (marker === 224) return starts(b, payload, "JFIF\0");
26239
+ if (marker === 226) return starts(b, payload, "ICC_PROFILE\0");
26240
+ if (marker === 238) return starts(b, payload, "Adobe");
26241
+ return false;
26242
+ }
26243
+ /** An APP1 Exif, big-endian, whose IFD0 holds `orientation` alone. */
26244
+ var orientationOnly = (orientation) => Uint8Array.of(255, 225, 0, 34, 69, 120, 105, 102, 0, 0, 77, 77, 0, 42, 0, 0, 0, 8, 0, 1, 1, 18, 0, 3, 0, 0, 0, 1, 0, orientation, 0, 0, 0, 0, 0, 0);
26245
+ function stripJpeg(b) {
26246
+ const parts = [b.subarray(0, 2)];
26247
+ let at = 2, framed = false, scanned = false, exif = false;
26248
+ for (;;) {
26249
+ check$1(at < b.length && b[at] === 255);
26250
+ while (at < b.length && b[at] === 255) at++;
26251
+ check$1(at < b.length);
26252
+ const marker = b[at++];
26253
+ if (marker === 217) {
26254
+ check$1(framed && scanned);
26255
+ parts.push(Uint8Array.of(255, 217));
26256
+ return parts;
26257
+ }
26258
+ if (marker === 1 || marker >= 208 && marker <= 215) {
26259
+ parts.push(Uint8Array.of(255, marker));
26260
+ continue;
26261
+ }
26262
+ check$1(marker !== 0 && marker !== 216 && at + 2 <= b.length);
26263
+ const length = u16be(b, at);
26264
+ check$1(length >= 2 && at + length <= b.length);
26265
+ if (jpegKeeps(marker, b, at + 2)) {
26266
+ parts.push(Uint8Array.of(255, marker), b.subarray(at, at + length));
26267
+ if (JPEG_FRAME.has(marker)) framed = true;
26268
+ } else if (marker === 225 && !scanned && !exif && starts(b, at + 2, "Exif\0\0")) {
26269
+ exif = true;
26270
+ const orientation = exifOrientation(b, at + 8, at + length);
26271
+ if (orientation >= 2) parts.push(orientationOnly(orientation));
26272
+ }
26273
+ at += length;
26274
+ if (marker !== 218) continue;
26275
+ check$1(framed);
26276
+ scanned = true;
26277
+ let end = at;
26278
+ for (;;) {
26279
+ end = b.indexOf(255, end);
26280
+ check$1(end >= 0);
26281
+ let next = end + 1;
26282
+ while (next < b.length && b[next] === 255) next++;
26283
+ check$1(next < b.length);
26284
+ if (b[next] !== 0 && !(b[next] >= 208 && b[next] <= 215)) break;
26285
+ end = next + 1;
26286
+ }
26287
+ parts.push(b.subarray(at, end));
26288
+ at = end;
26289
+ }
26290
+ }
26291
+ var PNG_CRITICAL = /* @__PURE__ */ new Set([
26292
+ "IHDR",
26293
+ "PLTE",
26294
+ "IDAT",
26295
+ "IEND"
26296
+ ]);
26297
+ var PNG_DRAWS = /* @__PURE__ */ new Set([
26298
+ "tRNS",
26299
+ "gAMA",
26300
+ "cHRM",
26301
+ "sRGB",
26302
+ "iCCP",
26303
+ "sBIT",
26304
+ "bKGD",
26305
+ "pHYs",
26306
+ "cICP",
26307
+ "mDCV",
26308
+ "cLLI",
26309
+ "acTL",
26310
+ "fcTL",
26311
+ "fdAT"
26312
+ ]);
26313
+ function stripPng(b) {
26314
+ const parts = [b.subarray(0, 8)];
26315
+ let at = 8;
26316
+ for (;;) {
26317
+ check$1(at + 12 <= b.length);
26318
+ const length = u32be$1(b, at), type = text$1(b, at + 4, 4);
26319
+ check$1(at + 12 + length <= b.length && (at > 8 || type === "IHDR"));
26320
+ const critical = (b[at + 4] & 32) === 0;
26321
+ check$1(!critical || PNG_CRITICAL.has(type));
26322
+ if (critical || PNG_DRAWS.has(type)) parts.push(b.subarray(at, at + 12 + length));
26323
+ at += 12 + length;
26324
+ if (type === "IEND") return parts;
26325
+ }
26326
+ }
26327
+ var WEBP_KEEPS = /* @__PURE__ */ new Set([
26328
+ "VP8 ",
26329
+ "VP8L",
26330
+ "VP8X",
26331
+ "ALPH",
26332
+ "ANIM",
26333
+ "ANMF",
26334
+ "ICCP"
26335
+ ]);
26336
+ function stripWebp(b) {
26337
+ check$1(b.length >= 20);
26338
+ const riffEnd = 8 + u32le(b, 4);
26339
+ check$1(riffEnd <= b.length && riffEnd % 2 === 0);
26340
+ const parts = [];
26341
+ let at = 12, size = 4, drawn = false;
26342
+ while (at < riffEnd) {
26343
+ check$1(at + 8 <= riffEnd);
26344
+ const type = text$1(b, at, 4), length = u32le(b, at + 4), end = at + 8 + length + (length & 1);
26345
+ check$1(end <= riffEnd && (at > 12 || type === "VP8 " || type === "VP8L" || type === "VP8X"));
26346
+ if (WEBP_KEEPS.has(type)) {
26347
+ let chunk = b.subarray(at, end);
26348
+ if (type === "VP8X") {
26349
+ check$1(length >= 10);
26350
+ chunk = chunk.slice();
26351
+ chunk[8] = chunk[8] & -13;
26352
+ }
26353
+ if (type === "VP8 " || type === "VP8L" || type === "ANMF") drawn = true;
26354
+ parts.push(chunk);
26355
+ size += chunk.length;
26356
+ }
26357
+ at = end;
26358
+ }
26359
+ check$1(drawn);
26360
+ const header = /* @__PURE__ */ new Uint8Array(12);
26361
+ header.set(b.subarray(0, 12));
26362
+ new DataView(header.buffer).setUint32(4, size, true);
26363
+ return [header, ...parts];
26364
+ }
26365
+ var HEIF_TOP = /* @__PURE__ */ new Set([
26366
+ "ftyp",
26367
+ "meta",
26368
+ "mdat",
26369
+ "free",
26370
+ "skip"
26371
+ ]);
26372
+ var HEIF_META = /* @__PURE__ */ new Set([
26373
+ "hdlr",
26374
+ "dinf",
26375
+ "pitm",
26376
+ "iloc",
26377
+ "iinf",
26378
+ "iref",
26379
+ "iprp",
26380
+ "idat",
26381
+ "grpl",
26382
+ "free",
26383
+ "skip"
26384
+ ]);
26385
+ /** Items that hold metadata: Exif, and XMP (or any other document) as a MIME item. */
26386
+ var HEIF_METADATA_ITEMS = /* @__PURE__ */ new Set([
26387
+ "Exif",
26388
+ "mime",
26389
+ "uri "
26390
+ ]);
26391
+ function boxes$1(b, start, end) {
26392
+ const found = [];
26393
+ for (let at = start; at < end;) {
26394
+ check$1(at + 8 <= end);
26395
+ let size = u32be$1(b, at), body = at + 8;
26396
+ const type = text$1(b, at + 4, 4);
26397
+ if (size === 1) {
26398
+ check$1(at + 16 <= end);
26399
+ size = u32be$1(b, at + 8) * 2 ** 32 + u32be$1(b, at + 12);
26400
+ body = at + 16;
26401
+ } else if (size === 0) size = end - at;
26402
+ if (type === "uuid") body += 16;
26403
+ check$1(size >= body - at && at + size <= end);
26404
+ found.push({
26405
+ type,
26406
+ start: at,
26407
+ body,
26408
+ end: at + size
26409
+ });
26410
+ at += size;
26411
+ }
26412
+ return found;
26413
+ }
26414
+ function stripHeif(b) {
26415
+ const top = boxes$1(b, 0, b.length);
26416
+ check$1(top[0]?.type === "ftyp" && top.every((box) => HEIF_TOP.has(box.type)));
26417
+ const metas = top.filter((box) => box.type === "meta");
26418
+ check$1(metas.length === 1);
26419
+ const meta = metas[0];
26420
+ const children = boxes$1(b, meta.body + 4, meta.end);
26421
+ check$1(children.every((box) => HEIF_META.has(box.type)));
26422
+ const one = (type) => {
26423
+ const of = children.filter((box) => box.type === type);
26424
+ check$1(of.length <= 1);
26425
+ return of[0];
26426
+ };
26427
+ const iinf = one("iinf"), iloc = one("iloc"), idat = one("idat");
26428
+ check$1(!!iinf && !!iloc);
26429
+ const metadata = /* @__PURE__ */ new Set();
26430
+ const infeVersion = b[iinf.body];
26431
+ const entries = boxes$1(b, iinf.body + 4 + (infeVersion === 0 ? 2 : 4), iinf.end);
26432
+ for (const infe of entries) {
26433
+ check$1(infe.type === "infe" && infe.body + 4 <= infe.end);
26434
+ const version = b[infe.body];
26435
+ check$1(version === 2 || version === 3);
26436
+ let at = infe.body + 4;
26437
+ const id = version === 2 ? u16be(b, at) : u32be$1(b, at);
26438
+ at += version === 2 ? 2 : 4;
26439
+ check$1(at + 6 <= infe.end);
26440
+ if (HEIF_METADATA_ITEMS.has(text$1(b, at + 2, 4))) metadata.add(id);
26441
+ }
26442
+ const out = b.slice();
26443
+ const version = b[iloc.body];
26444
+ check$1(version <= 2);
26445
+ let at = iloc.body + 4;
26446
+ /** The next field of `size` bytes (0, 2, 4 or 8), big-endian. */
26447
+ const read = (size) => {
26448
+ check$1(at + size <= iloc.end);
26449
+ 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;
26450
+ check$1(Number.isSafeInteger(value));
26451
+ at += size;
26452
+ return value;
26453
+ };
26454
+ const read2 = () => read(2);
26455
+ check$1(at + 2 <= iloc.end);
26456
+ const offsetSize = b[at] >> 4, lengthSize = b[at] & 15, baseSize = b[at + 1] >> 4, indexSize = version > 0 ? b[at + 1] & 15 : 0;
26457
+ check$1([
26458
+ offsetSize,
26459
+ lengthSize,
26460
+ baseSize,
26461
+ indexSize
26462
+ ].every((size) => size === 0 || size === 4 || size === 8));
26463
+ at += 2;
26464
+ const count = read(version < 2 ? 2 : 4);
26465
+ for (let i = 0; i < count; i++) {
26466
+ const id = version < 2 ? read2() : read(4);
26467
+ const method = version > 0 ? read2() & 15 : 0;
26468
+ const reference = read2();
26469
+ const base = read(baseSize);
26470
+ const extents = read2();
26471
+ for (let e = 0; e < extents; e++) {
26472
+ if (indexSize) read(indexSize);
26473
+ const offset = read(offsetSize), length = read(lengthSize);
26474
+ if (!metadata.has(id)) continue;
26475
+ check$1(reference === 0 && length > 0 && (method === 0 || method === 1 && !!idat));
26476
+ const start = (method === 1 ? idat.body : 0) + base + offset, limit = method === 1 ? idat.end : b.length;
26477
+ check$1(start + length <= limit);
26478
+ out.fill(0, start, start + length);
26479
+ }
26480
+ }
26481
+ return [out];
26482
+ }
26483
+ var GIF_APPS_KEPT = /* @__PURE__ */ new Set([
26484
+ "NETSCAPE2.0",
26485
+ "ANIMEXTS1.0",
26486
+ "ICCRGBG1012"
26487
+ ]);
26488
+ function stripGif(b) {
26489
+ check$1(b.length >= 13);
26490
+ /** A colour table's bytes, from the flags that say it is there and its size. */
26491
+ const table = (flags) => flags & 128 ? 3 << (flags & 7) + 1 : 0;
26492
+ /** The end of the data sub-blocks at `at`, past their empty block. */
26493
+ const blocks = (at) => {
26494
+ for (;;) {
26495
+ check$1(at < b.length);
26496
+ const length = b[at];
26497
+ at += 1 + length;
26498
+ if (!length) return at;
26499
+ }
26500
+ };
26501
+ let at = 13 + table(b[10]), framed = false;
26502
+ check$1(at <= b.length);
26503
+ const parts = [b.subarray(0, at)];
26504
+ for (;;) {
26505
+ check$1(at < b.length);
26506
+ const introducer = b[at];
26507
+ if (introducer === 59) {
26508
+ check$1(framed);
26509
+ parts.push(Uint8Array.of(59));
26510
+ return parts;
26511
+ }
26512
+ if (introducer === 44) {
26513
+ check$1(at + 10 <= b.length);
26514
+ const data = at + 10 + table(b[at + 9]);
26515
+ check$1(data < b.length);
26516
+ const end = blocks(data + 1);
26517
+ parts.push(b.subarray(at, end));
26518
+ framed = true;
26519
+ at = end;
26520
+ continue;
26521
+ }
26522
+ check$1(introducer === 33 && at + 2 < b.length);
26523
+ const label = b[at + 1], end = blocks(at + 2);
26524
+ const app = label === 255 && b[at + 2] === 11 && GIF_APPS_KEPT.has(text$1(b, at + 3, 11));
26525
+ if (label === 249 || label === 1 || app) parts.push(b.subarray(at, end));
26526
+ else check$1(label === 254 || label === 255);
26527
+ at = end;
26528
+ }
26529
+ }
26530
+ var TIFF_DRAWS = /* @__PURE__ */ new Set([
26531
+ 254,
26532
+ 255,
26533
+ 256,
26534
+ 257,
26535
+ 258,
26536
+ 259,
26537
+ 262,
26538
+ 263,
26539
+ 264,
26540
+ 265,
26541
+ 266,
26542
+ 273,
26543
+ 274,
26544
+ 277,
26545
+ 278,
26546
+ 279,
26547
+ 280,
26548
+ 281,
26549
+ 282,
26550
+ 283,
26551
+ 284,
26552
+ 286,
26553
+ 287,
26554
+ 290,
26555
+ 291,
26556
+ 292,
26557
+ 293,
26558
+ 296,
26559
+ 297,
26560
+ 301,
26561
+ 317,
26562
+ 318,
26563
+ 319,
26564
+ 320,
26565
+ 321,
26566
+ 322,
26567
+ 323,
26568
+ 324,
26569
+ 325,
26570
+ 332,
26571
+ 334,
26572
+ 336,
26573
+ 338,
26574
+ 339,
26575
+ 340,
26576
+ 341,
26577
+ 529,
26578
+ 530,
26579
+ 531,
26580
+ 532,
26581
+ 34675
26582
+ ]);
26583
+ /** Text and documents about the picture: DocumentName to HostComputer, InkNames, XMP, Copyright, IPTC, Photoshop, Windows' XP tags, PrintIM. */
26584
+ var TIFF_METADATA = /* @__PURE__ */ new Set([
26585
+ 269,
26586
+ 270,
26587
+ 271,
26588
+ 272,
26589
+ 285,
26590
+ 305,
26591
+ 306,
26592
+ 315,
26593
+ 316,
26594
+ 333,
26595
+ 700,
26596
+ 33432,
26597
+ 33723,
26598
+ 34377,
26599
+ 18246,
26600
+ 18249,
26601
+ 40091,
26602
+ 40092,
26603
+ 40093,
26604
+ 40094,
26605
+ 40095,
26606
+ 50341
26607
+ ]);
26608
+ /** The IFDs of Exif, GPS and interoperability, emptied whole. */
26609
+ var TIFF_METADATA_IFDS = /* @__PURE__ */ new Set([
26610
+ 34665,
26611
+ 34853,
26612
+ 40965
26613
+ ]);
26614
+ /** Compression without JPEG: none, CCITT, LZW, Deflate, PackBits. */
26615
+ var TIFF_COMPRESSION = /* @__PURE__ */ new Set([
26616
+ 1,
26617
+ 2,
26618
+ 3,
26619
+ 4,
26620
+ 5,
26621
+ 8,
26622
+ 32773,
26623
+ 32946
26624
+ ]);
26625
+ /** Bytes per value of each field type. */
26626
+ var TIFF_TYPE_BYTES = [
26627
+ 0,
26628
+ 1,
26629
+ 1,
26630
+ 2,
26631
+ 4,
26632
+ 8,
26633
+ 1,
26634
+ 1,
26635
+ 2,
26636
+ 4,
26637
+ 8,
26638
+ 4,
26639
+ 8,
26640
+ 4
26641
+ ];
26642
+ function stripTiff(b) {
26643
+ const little = b[0] === 73;
26644
+ const u16 = (at) => {
26645
+ check$1(at + 2 <= b.length);
26646
+ return little ? b[at] | b[at + 1] << 8 : u16be(b, at);
26647
+ };
26648
+ const u32 = (at) => {
26649
+ check$1(at + 4 <= b.length);
26650
+ return little ? u32le(b, at) : u32be$1(b, at);
26651
+ };
26652
+ check$1(b.length >= 8 && u16(2) === 42);
26653
+ const out = b.slice(), seen = /* @__PURE__ */ new Set();
26654
+ /** An IFD's entries: tag, type, the value's first byte (in the entry or where it points) and its bytes. */
26655
+ const entries = (ifd) => {
26656
+ check$1(ifd >= 8 && !seen.has(ifd) && seen.size < 1024);
26657
+ seen.add(ifd);
26658
+ const count = u16(ifd), next = ifd + 2 + count * 12;
26659
+ u32(next);
26660
+ return {
26661
+ next,
26662
+ list: Array.from({ length: count }, (_, i) => {
26663
+ const at = ifd + 2 + i * 12, tag = u16(at), type = u16(at + 2);
26664
+ check$1(type >= 1 && type < TIFF_TYPE_BYTES.length);
26665
+ const bytes = TIFF_TYPE_BYTES[type] * u32(at + 4);
26666
+ const value = bytes <= 4 ? at + 8 : u32(at + 8);
26667
+ check$1(Number.isSafeInteger(bytes) && value + bytes <= b.length);
26668
+ return {
26669
+ at,
26670
+ tag,
26671
+ type,
26672
+ value,
26673
+ bytes
26674
+ };
26675
+ })
26676
+ };
26677
+ };
26678
+ /** An Exif, GPS or interoperability IFD: every value zeroed, then the IFD itself, so it holds no entry. */
26679
+ const empty = (ifd) => {
26680
+ const { next, list } = entries(ifd);
26681
+ for (const entry of list) {
26682
+ check$1(entry.tag !== 37500);
26683
+ if (TIFF_METADATA_IFDS.has(entry.tag)) empty(u32(entry.value));
26684
+ out.fill(0, entry.value, entry.value + entry.bytes);
26685
+ }
26686
+ out.fill(0, ifd, next + 4);
26687
+ };
26688
+ for (let ifd = u32(4); ifd;) {
26689
+ const { next, list } = entries(ifd);
26690
+ let kept = 0;
26691
+ for (const { at, tag, value, bytes } of list) {
26692
+ if (tag === 259) check$1(TIFF_COMPRESSION.has(u16(value)));
26693
+ if (TIFF_METADATA_IFDS.has(tag)) {
26694
+ empty(u32(value));
26695
+ continue;
26696
+ }
26697
+ if (TIFF_METADATA.has(tag)) out.fill(0, value, value + bytes);
26698
+ else check$1(TIFF_DRAWS.has(tag));
26699
+ out.copyWithin(ifd + 2 + kept++ * 12, at, at + 12);
26700
+ }
26701
+ check$1(kept > 0);
26702
+ const end = ifd + 2 + kept * 12;
26703
+ out.set(little ? [kept & 255, kept >> 8] : [kept >> 8, kept & 255], ifd);
26704
+ out.set(b.subarray(next, next + 4), end);
26705
+ out.fill(0, end + 4, next + 4);
26706
+ ifd = u32(next);
26707
+ }
26708
+ return [out];
26709
+ }
26710
+ var STRIP = {
26711
+ jpeg: stripJpeg,
26712
+ png: stripPng,
26713
+ webp: stripWebp,
26714
+ heif: stripHeif,
26715
+ gif: stripGif,
26716
+ tiff: stripTiff
26717
+ };
26718
+ /**
26719
+ * A picture's bytes without its metadata, as parts to put in a Blob; undefined when the file is not a picture this
26720
+ * strips (by its bytes and its type), so it goes as it is. Throws `NO_PICTURE_METADATA` when it is one but its
26721
+ * metadata cannot be removed.
26722
+ */
26723
+ function stripPictureMetadata(bytes, mime) {
26724
+ const kind = kindOf(bytes);
26725
+ if (!kind) {
26726
+ if (STRIPPED_TYPES$1.has(mime.split(";")[0].trim().toLowerCase())) throw new Error(NO_PICTURE_METADATA);
26727
+ return;
26728
+ }
26729
+ return STRIP[kind](bytes);
26730
+ }
26731
+ /**
26732
+ * Whether a file is a picture whose metadata goes before it is sent, by its first `PICTURE_METADATA_LIMITS.headBytes`
26733
+ * bytes or by its type: then it is read whole and stripped (`stripPictureMetadata`), else it goes as it is.
26734
+ */
26735
+ function isStrippedPicture(head, mime) {
26736
+ return !!kindOf(head) || STRIPPED_TYPES$1.has(mime.split(";")[0].trim().toLowerCase());
26737
+ }
26738
+ /**
26739
+ * `source` as it is sent: without its metadata when it is a picture (`stripPictureMetadata`), or undefined when it is
26740
+ * not one and goes as it is. Only its first bytes are read for any other file. Throws `NO_PICTURE_METADATA` for a
26741
+ * picture that cannot be stripped or is past `PICTURE_METADATA_LIMITS.maxBytes`; an error reading `source` as it is.
26742
+ */
26743
+ async function withoutPictureMetadata(source, mime) {
26744
+ if (!isStrippedPicture(new Uint8Array(await source.slice(0, PICTURE_METADATA_LIMITS.headBytes).arrayBuffer()), mime)) return void 0;
26745
+ if (source.size > PICTURE_METADATA_LIMITS.maxBytes) throw new Error(NO_PICTURE_METADATA);
26746
+ const parts = stripPictureMetadata(new Uint8Array(await source.arrayBuffer()), mime);
26747
+ return parts && new Blob(parts, { type: mime });
26748
+ }
26749
+ //#endregion
26750
+ //#region ../core/src/videoMetadata.ts
26751
+ /**
26752
+ * What a video leaves with. An MP4 or QuickTime file says more than its frames: its `udta` and `meta` boxes hold where
26753
+ * it was recorded (`©xyz`, `com.apple.quicktime.location.ISO6709`), the device, often its software; a timed metadata
26754
+ * track (an iPhone's location and motion, a GoPro's GPS) holds them sample by sample. The sender removes them before
26755
+ * the file is stored and its digest computed, without decoding or re-encoding a frame: each such box becomes a `free`
26756
+ * box of the same size, zeroed, and each metadata track's samples are zeroed where they are, so no offset in the file
26757
+ * moves and it plays as it did. Only the boxes' headers, `moov` and `moof` are read; the media goes untouched.
26758
+ *
26759
+ * Fail-closed: a file that is an MP4 or QuickTime video, by its bytes or by its type, and whose metadata cannot be
26760
+ * removed (truncated, malformed, a part this does not know) is refused with `NO_VIDEO_METADATA`, never sent as it was.
26761
+ * A picture (HEIF is pictureMetadata.ts's), a file without a video track (an M4A) and any other file go as they are.
26762
+ */
26763
+ var VIDEO_METADATA_LIMITS = {
26764
+ /** The largest `moov` or `moof` read whole, and the most bytes of a metadata track's chunk: past this the video is refused. */
26765
+ maxBoxBytes: 67108864,
26766
+ /** The most top-level boxes walked (a fragmented MP4 has two per fragment). */
26767
+ maxBoxes: 1e5,
26768
+ /** Bytes read first to tell a video from another file. */
26769
+ headBytes: 64
26770
+ };
26771
+ /** Why a video is refused: its metadata could not be removed, so it does not go at all. */
26772
+ var NO_VIDEO_METADATA = "This video cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded";
26773
+ /** The types of the videos stripped here: a file of one of them whose bytes are not one is refused. */
26774
+ var STRIPPED_TYPES = /* @__PURE__ */ new Set([
26775
+ "video/mp4",
26776
+ "video/quicktime",
26777
+ "video/x-m4v",
26778
+ "video/3gpp",
26779
+ "video/3gpp2"
26780
+ ]);
26781
+ /** The first box of an MP4 (`ftyp`) or of a QuickTime file written without one. */
26782
+ var FIRST_BOXES = /* @__PURE__ */ new Set([
26783
+ "ftyp",
26784
+ "moov",
26785
+ "mdat",
26786
+ "wide",
26787
+ "free",
26788
+ "skip"
26789
+ ]);
26790
+ /** Boxes that hold metadata wherever they are: emptied into `free`. */
26791
+ var METADATA = /* @__PURE__ */ new Set([
26792
+ "udta",
26793
+ "meta",
26794
+ "uuid"
26795
+ ]);
26796
+ /** At the top: what makes the movie, kept (`moov` and `moof` looked into); a preview picture, an event message, emptied. */
26797
+ var TOP_KEEPS = /* @__PURE__ */ new Set([
26798
+ "ftyp",
26799
+ "styp",
26800
+ "moov",
26801
+ "mdat",
26802
+ "moof",
26803
+ "mfra",
26804
+ "sidx",
26805
+ "ssix",
26806
+ "prft",
26807
+ "pdin",
26808
+ "free",
26809
+ "skip",
26810
+ "wide"
26811
+ ]);
26812
+ var TOP_EMPTIED = /* @__PURE__ */ new Set([
26813
+ ...METADATA,
26814
+ "pnot",
26815
+ "PICT",
26816
+ "emsg",
26817
+ "Xtra"
26818
+ ]);
26819
+ var MOOV_KEEPS = /* @__PURE__ */ new Set([
26820
+ "mvhd",
26821
+ "trak",
26822
+ "mvex",
26823
+ "iods",
26824
+ "ctab",
26825
+ "free",
26826
+ "skip",
26827
+ "wide"
26828
+ ]);
26829
+ var TRAK_KEEPS = /* @__PURE__ */ new Set([
26830
+ "tkhd",
26831
+ "edts",
26832
+ "mdia",
26833
+ "tref",
26834
+ "tapt",
26835
+ "load",
26836
+ "txas",
26837
+ "matt",
26838
+ "free",
26839
+ "skip",
26840
+ "wide"
26841
+ ]);
26842
+ /** Boxes looked into below a track (and in a fragment) for the metadata boxes in them. */
26843
+ var CONTAINERS = /* @__PURE__ */ new Set([
26844
+ "mdia",
26845
+ "minf",
26846
+ "dinf",
26847
+ "stbl",
26848
+ "edts",
26849
+ "mvex",
26850
+ "traf"
26851
+ ]);
26852
+ /** Track handlers kept as they are: picture, sound, text and subtitles, timecode, hints. `meta` tracks have their samples zeroed. */
26853
+ var HANDLERS = /* @__PURE__ */ new Set([
26854
+ "vide",
26855
+ "soun",
26856
+ "text",
26857
+ "sbtl",
26858
+ "subt",
26859
+ "clcp",
26860
+ "tmcd",
26861
+ "hint",
26862
+ "auxv",
26863
+ "pict",
26864
+ "sdsm",
26865
+ "odsm",
26866
+ "subp"
26867
+ ]);
26868
+ /** Zeros put in a Blob a part at a time. */
26869
+ var ZEROS = /* @__PURE__ */ new Uint8Array(1048576);
26870
+ var u32be = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
26871
+ var text = (b, at, length) => String.fromCharCode(...b.subarray(at, at + length));
26872
+ /** Refuses the video where its bytes are not what this expects. */
26873
+ function check(ok) {
26874
+ if (!ok) throw new Error(NO_VIDEO_METADATA);
26875
+ }
26876
+ /** A box's header at `at` of `b` (`base` its offset in the file), up to `end` (a size of 0 runs to it). */
26877
+ function header(b, at, end, base = 0) {
26878
+ check(at + 8 <= b.length);
26879
+ let size = u32be(b, at), body = at + 8;
26880
+ const type = text(b, at + 4, 4);
26881
+ if (size === 1) {
26882
+ check(at + 16 <= b.length);
26883
+ size = u32be(b, at + 8) * 2 ** 32 + u32be(b, at + 12);
26884
+ body = at + 16;
26885
+ } else if (size === 0) size = end - (base + at);
26886
+ if (type === "uuid") body += 16;
26887
+ check(Number.isSafeInteger(size) && size >= body - at && base + at + size <= end);
26888
+ return {
26889
+ type,
26890
+ start: base + at,
26891
+ body: base + body,
26892
+ end: base + at + size
26893
+ };
26894
+ }
26895
+ function boxes(b, start, end) {
26896
+ const found = [];
26897
+ for (let at = start; at < end;) {
26898
+ check(at + 8 <= end);
26899
+ const box = header(b.subarray(0, end), at, end);
26900
+ found.push(box);
26901
+ at = box.end;
26902
+ }
26903
+ return found;
26904
+ }
26905
+ /** A box made `free` where it is: its size kept, everything after its size zeroed. */
26906
+ function empty(b, box) {
26907
+ b.set([
26908
+ 102,
26909
+ 114,
26910
+ 101,
26911
+ 101
26912
+ ], box.start + 4);
26913
+ b.fill(0, box.start + (u32be(b, box.start) === 1 ? 16 : 8), box.end);
26914
+ }
26915
+ /** Every metadata box in a container's children (and in theirs, for the containers below a track) emptied. */
26916
+ function emptyWithin(b, start, end) {
26917
+ for (const box of boxes(b, start, end)) if (METADATA.has(box.type)) empty(b, box);
26918
+ else if (CONTAINERS.has(box.type)) emptyWithin(b, box.body, box.end);
26919
+ }
26920
+ var child = (b, parent, type) => {
26921
+ if (!parent) return void 0;
26922
+ const of = boxes(b, parent.body, parent.end).filter((box) => box.type === type);
26923
+ check(of.length <= 1);
26924
+ return of[0];
26925
+ };
26926
+ /** The byte ranges of a track's samples in the file, one per chunk, from its sample table. */
26927
+ function sampleRanges(b, stbl) {
26928
+ const stsz = child(b, stbl, "stsz"), stz2 = child(b, stbl, "stz2"), stsc = child(b, stbl, "stsc");
26929
+ const stco = child(b, stbl, "stco"), co64 = child(b, stbl, "co64");
26930
+ check(!!stsc && !!stsz !== !!stz2 && !!stco !== !!co64);
26931
+ const need = (box, at, bytes) => check(at + bytes <= box.end);
26932
+ const sizeTable = stsz ?? stz2;
26933
+ need(sizeTable, sizeTable.body, 12);
26934
+ const count = u32be(b, sizeTable.body + 8);
26935
+ let sizeOf;
26936
+ /** Samples of one size: a chunk's length is counted, not added up a sample at a time. */
26937
+ let uniform = 0;
26938
+ if (stsz) {
26939
+ uniform = u32be(b, stsz.body + 4);
26940
+ if (!uniform) need(stsz, stsz.body + 12, count * 4);
26941
+ sizeOf = (i) => u32be(b, stsz.body + 12 + i * 4);
26942
+ } else {
26943
+ const field = b[stz2.body + 7];
26944
+ check(field === 4 || field === 8 || field === 16);
26945
+ need(stz2, stz2.body + 12, Math.ceil(count * field / 8));
26946
+ const at = stz2.body + 12;
26947
+ sizeOf = field === 16 ? (i) => b[at + i * 2] << 8 | b[at + i * 2 + 1] : field === 8 ? (i) => b[at + i] : (i) => i & 1 ? b[at + (i >> 1)] & 15 : b[at + (i >> 1)] >> 4;
26948
+ }
26949
+ const offsets = stco ?? co64;
26950
+ need(offsets, offsets.body, 8);
26951
+ const chunks = u32be(b, offsets.body + 4);
26952
+ need(offsets, offsets.body + 8, chunks * (co64 ? 8 : 4));
26953
+ 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);
26954
+ need(stsc, stsc.body, 8);
26955
+ const runs = u32be(b, stsc.body + 4);
26956
+ need(stsc, stsc.body + 8, runs * 12);
26957
+ const ranges = [];
26958
+ let sample = 0;
26959
+ for (let run = 0; run < runs; run++) {
26960
+ const first = u32be(b, stsc.body + 8 + run * 12), perChunk = u32be(b, stsc.body + 12 + run * 12);
26961
+ const last = run + 1 < runs ? u32be(b, stsc.body + 8 + (run + 1) * 12) : chunks + 1;
26962
+ check(first >= 1 && last > first && last <= chunks + 1);
26963
+ for (let chunk = first; chunk < last; chunk++) {
26964
+ const start = offsetOf(chunk - 1);
26965
+ check(sample + perChunk <= count);
26966
+ let length = uniform * perChunk;
26967
+ if (!uniform) for (let i = 0; i < perChunk; i++) length += sizeOf(sample + i);
26968
+ sample += perChunk;
26969
+ check(Number.isSafeInteger(start) && length <= VIDEO_METADATA_LIMITS.maxBoxBytes);
26970
+ if (length) ranges.push([start, start + length]);
26971
+ }
26972
+ }
26973
+ check(sample === count);
26974
+ return ranges;
26975
+ }
26976
+ /** Whether every data reference of a track is this file (a self-contained `url ` or `alis`). */
26977
+ function selfContained(b, minf) {
26978
+ const dref = child(b, child(b, minf, "dinf"), "dref");
26979
+ if (!dref) return false;
26980
+ return boxes(b, dref.body + 8, dref.end).every((entry) => entry.body + 4 <= entry.end && (b[entry.body + 3] & 1) === 1);
26981
+ }
26982
+ /**
26983
+ * `moov` with its metadata boxes emptied, read whole: whether it has a video track, and the byte ranges of its
26984
+ * metadata tracks' samples (zeroed by the caller where they are).
26985
+ */
26986
+ function stripMoov(b) {
26987
+ let video = false, fragmented = false;
26988
+ const zeroed = [];
26989
+ for (const box of boxes(b, header(b, 0, b.length).body, b.length)) {
26990
+ if (METADATA.has(box.type)) {
26991
+ empty(b, box);
26992
+ continue;
26993
+ }
26994
+ check(MOOV_KEEPS.has(box.type));
26995
+ if (box.type === "mvex") {
26996
+ fragmented = true;
26997
+ emptyWithin(b, box.body, box.end);
26998
+ }
26999
+ if (box.type !== "trak") continue;
27000
+ let mdia;
27001
+ for (const part of boxes(b, box.body, box.end)) {
27002
+ if (METADATA.has(part.type)) {
27003
+ empty(b, part);
27004
+ continue;
27005
+ }
27006
+ check(TRAK_KEEPS.has(part.type));
27007
+ if (part.type === "mdia") {
27008
+ check(!mdia);
27009
+ mdia = part;
27010
+ }
27011
+ }
27012
+ check(!!mdia);
27013
+ const hdlr = child(b, mdia, "hdlr"), minf = child(b, mdia, "minf");
27014
+ check(!!hdlr && !!minf && hdlr.body + 12 <= hdlr.end);
27015
+ const handler = text(b, hdlr.body + 8, 4);
27016
+ const stbl = child(b, minf, "stbl");
27017
+ check(!!stbl);
27018
+ if (handler === "meta") {
27019
+ check(selfContained(b, minf));
27020
+ for (const range of sampleRanges(b, stbl)) zeroed.push(range);
27021
+ } else check(HANDLERS.has(handler));
27022
+ if (handler === "vide") video = true;
27023
+ emptyWithin(b, box.body, box.end);
27024
+ }
27025
+ return {
27026
+ video,
27027
+ fragmented,
27028
+ zeroed
27029
+ };
27030
+ }
27031
+ /** A box's header in the file at `at`, read from it. */
27032
+ async function headerAt(source, at) {
27033
+ return header(new Uint8Array(await source.slice(at, at + 16).arrayBuffer()), 0, source.size, at);
27034
+ }
27035
+ /** A box read whole, within the limit. */
27036
+ async function whole(source, box) {
27037
+ check(box.end - box.start <= VIDEO_METADATA_LIMITS.maxBoxBytes);
27038
+ const bytes = new Uint8Array(await source.slice(box.start, box.end).arrayBuffer());
27039
+ check(bytes.length === box.end - box.start);
27040
+ return bytes;
27041
+ }
27042
+ /** An MP4 or QuickTime file, by its first box: an HEIF picture is pictureMetadata.ts's. */
27043
+ function isVideoContainer(head, mime) {
27044
+ return head.length >= 8 && FIRST_BOXES.has(text(head, 4, 4)) && !isStrippedPicture(head, mime);
27045
+ }
27046
+ /**
27047
+ * `source` as it is sent: an MP4 or QuickTime video without its metadata, made of `source`'s own bytes but for the
27048
+ * boxes and samples zeroed; undefined when it goes as it is (not one of these videos, a file without a video track).
27049
+ * Throws `NO_VIDEO_METADATA` for a video whose metadata cannot be removed; an error reading `source` as it is.
27050
+ */
27051
+ async function withoutVideoMetadata(source, mime) {
27052
+ const head = new Uint8Array(await source.slice(0, VIDEO_METADATA_LIMITS.headBytes).arrayBuffer());
27053
+ const typed = STRIPPED_TYPES.has(mime.split(";")[0].trim().toLowerCase());
27054
+ if (!isVideoContainer(head, mime)) {
27055
+ if (typed && !isStrippedPicture(head, mime)) throw new Error(NO_VIDEO_METADATA);
27056
+ return;
27057
+ }
27058
+ /** What replaces the file's bytes, by where it starts: a box rewritten, or zeros (no `bytes`). */
27059
+ const patches = [];
27060
+ const top = [];
27061
+ for (let at = 0; at < source.size;) {
27062
+ check(top.length < VIDEO_METADATA_LIMITS.maxBoxes);
27063
+ const box = await headerAt(source, at);
27064
+ if (top.length && box.type === "\0\0\0\0" && box.end === source.size) {
27065
+ patches.push({
27066
+ start: at,
27067
+ end: source.size
27068
+ });
27069
+ break;
27070
+ }
27071
+ check(TOP_KEEPS.has(box.type) || TOP_EMPTIED.has(box.type));
27072
+ top.push(box);
27073
+ at = box.end;
27074
+ }
27075
+ const moovs = top.filter((box) => box.type === "moov");
27076
+ check(moovs.length === 1);
27077
+ const moov = await whole(source, moovs[0]);
27078
+ const { video, fragmented, zeroed } = stripMoov(moov);
27079
+ if (!video && !typed) return void 0;
27080
+ patches.push({
27081
+ start: moovs[0].start,
27082
+ end: moovs[0].end,
27083
+ bytes: moov
27084
+ });
27085
+ check(!fragmented || !zeroed.length);
27086
+ for (const box of top) if (box.type === "moof") {
27087
+ const moof = await whole(source, box);
27088
+ emptyWithin(moof, box.body - box.start, moof.length);
27089
+ patches.push({
27090
+ start: box.start,
27091
+ end: box.end,
27092
+ bytes: moof
27093
+ });
27094
+ } else if (TOP_EMPTIED.has(box.type)) {
27095
+ const head = new Uint8Array(await source.slice(box.start, box.body).arrayBuffer());
27096
+ empty(head, {
27097
+ type: box.type,
27098
+ start: 0,
27099
+ body: head.length,
27100
+ end: head.length
27101
+ });
27102
+ patches.push({
27103
+ start: box.start,
27104
+ end: box.body,
27105
+ bytes: head
27106
+ }, {
27107
+ start: box.body,
27108
+ end: box.end
27109
+ });
27110
+ }
27111
+ const mdats = top.filter((box) => box.type === "mdat");
27112
+ const merged = [];
27113
+ for (const [start, end] of zeroed.sort((a, b) => a[0] - b[0])) {
27114
+ check(mdats.some((mdat) => start >= mdat.body && end <= mdat.end));
27115
+ const last = merged[merged.length - 1];
27116
+ if (last && start <= last[1]) last[1] = Math.max(last[1], end);
27117
+ else merged.push([start, end]);
27118
+ }
27119
+ for (const [start, end] of merged) patches.push({
27120
+ start,
27121
+ end
27122
+ });
27123
+ const parts = [];
27124
+ let at = 0;
27125
+ for (const patch of patches.sort((a, b) => a.start - b.start)) {
27126
+ check(patch.start >= at);
27127
+ if (patch.start > at) parts.push(source.slice(at, patch.start));
27128
+ if (patch.bytes) parts.push(patch.bytes);
27129
+ else for (let left = patch.end - patch.start; left > 0; left -= ZEROS.length) parts.push(ZEROS.subarray(0, Math.min(left, ZEROS.length)));
27130
+ at = patch.end;
27131
+ }
27132
+ if (at < source.size) parts.push(source.slice(at));
27133
+ return new Blob(parts, { type: mime });
27134
+ }
27135
+ //#endregion
26025
27136
  //#region ../core/src/payments.ts
26026
27137
  /**
26027
27138
  * Payments between two linked peers. Ghostly does not move money itself: it
@@ -30330,16 +31441,10 @@ var GroupSession = class {
30330
31441
  /** Set while a save of what received messages changed is due (`persistSoon`). */
30331
31442
  saveTimer;
30332
31443
  /**
30333
- * The frames of members who left that each member was handed (`frameKey`), so an app that does not take them (from
30334
- * before revision 2026-10-13, and never marks them seen) is not handed them again at every sync. In memory only.
31444
+ * The removals of authors out of the roster that each member was handed (`editKey`), so an app that does not take
31445
+ * them is not handed them again at every sync. In memory only.
30335
31446
  */
30336
31447
  leaversHanded = /* @__PURE__ */ new Map();
30337
- /**
30338
- * The frames a commit took out of the logs (`pruneRelay`), newest last, and whether the app holds them with its
30339
- * messages: a removal's `left` mark can come after its commit, and what the leaver wrote is then kept again
30340
- * (`unprune`). In memory only: started again, the app's rows bring theirs back.
30341
- */
30342
- pruned = [];
30343
31448
  /** Syncs answered per member, a few a minute (`GROUP_LIMITS.syncAnswers`). In memory only. */
30344
31449
  syncsAnswered = /* @__PURE__ */ new Map();
30345
31450
  /**
@@ -30353,6 +31458,8 @@ var GroupSession = class {
30353
31458
  * message written just now. Each frame of the answer keeps it open: it goes a slice at a time. In memory only.
30354
31459
  */
30355
31460
  answering = /* @__PURE__ */ new Map();
31461
+ /** Per member ahead of me: the epoch its last sync said, up to which its answer to mine brings the chain. In memory only. */
31462
+ syncedEpoch = /* @__PURE__ */ new Map();
30356
31463
  /** Catch-up answers still going out, a slice at a time (`handOut`). */
30357
31464
  answers;
30358
31465
  /**
@@ -30375,20 +31482,20 @@ var GroupSession = class {
30375
31482
  if (onRows) {
30376
31483
  const held = new Set(onRows.map(frameKey$1));
30377
31484
  if (state.relay?.length) state.relay = state.relay.filter((f) => !held.has(frameKey$1(f)));
30378
- this.onRows = state.status === "active" ? onRows.filter((f) => this.handsOn(f.s, f.e)) : [];
31485
+ this.onRows = state.status === "active" ? onRows.filter((f) => this.handsOn(f.s)) : [];
30379
31486
  this.trimRelay();
30380
31487
  }
30381
31488
  this.answers = new CatchUpAnswers({
30382
31489
  send: (to, frame) => {
30383
- if ((frame.t === "group-msg" || frame.t === "group-edit") && !rosterHas(this.roster, frame.s)) {
31490
+ if (frame.t === "group-edit" && !rosterHas(this.roster, frame.s)) {
30384
31491
  const handed = this.leaversHanded.get(to) ?? /* @__PURE__ */ new Set();
30385
- this.leaversHanded.set(to, handed.add(frame.t === "group-edit" ? editKey(frame) : frameKey$1(frame)));
31492
+ this.leaversHanded.set(to, handed.add(editKey(frame)));
30386
31493
  }
30387
31494
  return hooks.send(to, frame);
30388
31495
  },
30389
31496
  ...hooks.handled && { handled: (to) => hooks.handled(to) },
30390
31497
  active: () => this.state.status === "active",
30391
- key: (frame) => frame.t === "group-msg" ? frameKey$1(frame) : void 0
31498
+ key: (frame) => frame.t === "group-msg" ? frameKey$1(frame) : frame.t === "group-commit" ? `commit:${frame.commit.e}` : void 0
30392
31499
  });
30393
31500
  this.provisional = new Set((state.provisional ?? []).slice(-GROUP_LIMITS.provisional));
30394
31501
  this.chainMovedAt = this.clock();
@@ -30677,8 +31784,9 @@ var GroupSession = class {
30677
31784
  return this.hooks.save(structuredClone(this.state));
30678
31785
  }
30679
31786
  /**
30680
- * A save within `GROUP_LIMITS.saveWithinMs`, for what a received message changes (what was seen, what is kept to hand
30681
- * on): the state holds the whole hand-on log, and a member back in a busy group wrote all of it once per message.
31787
+ * A save within `GROUP_LIMITS.saveWithinMs`, for what a received message, commit or secret changes (what was seen,
31788
+ * what is kept to hand on, the chain): the state holds the whole hand-on log and chain, and a member back in a busy
31789
+ * group wrote all of it once per message, and once per commit.
30682
31790
  * The message itself is stored before (`hooks.message`). An app killed before the save takes those frames again when
30683
31791
  * it syncs: its store has the messages already, and the state then catches up.
30684
31792
  */
@@ -30786,7 +31894,7 @@ var GroupSession = class {
30786
31894
  }
30787
31895
  transferAdmin(memberKey, now = Date.now()) {
30788
31896
  return this.serialize(async () => {
30789
- this.requireAdmin();
31897
+ this.requireAdmin("Only the admin can hand the admin role over");
30790
31898
  if (!rosterHas(this.roster, memberKey) || memberKey === this.myKey) throw new Error("Not a member");
30791
31899
  await this.commit("role", memberKey, now);
30792
31900
  });
@@ -30847,18 +31955,10 @@ var GroupSession = class {
30847
31955
  this.hooks.changed();
30848
31956
  return { secret };
30849
31957
  }
30850
- /**
30851
- * Someone removed is not handed on any more, whatever they sent while in the roster; one who left still is, for the
30852
- * epochs before its leave (WISP 902 § Catch-up).
30853
- */
31958
+ /** Someone removed or gone is not handed on any more, whatever they sent while in the roster (WISP 902 § Catch-up). */
30854
31959
  pruneRelay() {
30855
- const prune = (log, row) => log.filter((f) => this.handsOn(f.s, f.e) || (this.pruned.push({
30856
- frame: f,
30857
- row
30858
- }), false));
30859
- if (this.state.relay?.length) this.state.relay = prune(this.state.relay, false);
30860
- if (this.onRows?.length) this.onRows = prune(this.onRows, true);
30861
- this.pruned.splice(0, this.pruned.length - GROUP_LIMITS.relay);
31960
+ if (this.state.relay?.length) this.state.relay = this.state.relay.filter((f) => this.handsOn(f.s));
31961
+ if (this.onRows?.length) this.onRows = this.onRows.filter((f) => this.handsOn(f.s));
30862
31962
  if (this.state.relayEdits?.length) this.state.relayEdits = this.state.relayEdits.filter((f) => rosterHas(this.roster, f.s) || this.isRemovalEdit(f));
30863
31963
  }
30864
31964
  /** Whether a kept edit is a removal (WISP 400 § Delete for everyone): its box, under its epoch's key, says `rm`. */
@@ -30872,18 +31972,6 @@ var GroupSession = class {
30872
31972
  return false;
30873
31973
  }
30874
31974
  }
30875
- /** The frames `pruneRelay` dropped that are handed on again now (a removal's `left` mark came after it), back in their logs. */
30876
- unprune() {
30877
- const back = this.pruned.filter((p) => this.handsOn(p.frame.s, p.frame.e));
30878
- if (!back.length) return;
30879
- this.pruned = this.pruned.filter((p) => !back.includes(p));
30880
- for (const { frame, row } of back) {
30881
- const log = row && this.onRows ? this.onRows : this.state.relay ??= [];
30882
- const at = log.findIndex((f) => f.ts > frame.ts);
30883
- log.splice(at < 0 ? log.length : at, 0, frame);
30884
- }
30885
- this.trimRelay();
30886
- }
30887
31975
  /** Another member's edit, kept to hand on: the latest per message; the oldest go once the log is full. False: one as new was kept. */
30888
31976
  keepEdit(frame) {
30889
31977
  const same = (f) => f.s === frame.s && f.e === frame.e && f.n === frame.n;
@@ -30948,7 +32036,6 @@ var GroupSession = class {
30948
32036
  this.state.sent = [];
30949
32037
  this.state.relay = [];
30950
32038
  if (this.onRows) this.onRows = [];
30951
- this.pruned = [];
30952
32039
  this.state.relayEdits = [];
30953
32040
  this.state.alone = [];
30954
32041
  this.waiting = [];
@@ -31451,8 +32538,8 @@ var GroupSession = class {
31451
32538
  }
31452
32539
  /**
31453
32540
  * A message, from its author's edge or handed on by another member. Handed on, it is taken only while both are in
31454
- * the roster (someone removed is neither heard from nor handed on, #300), or from a member in it when its author left
31455
- * after it (`handsOn`), and its boxes only with the author's `xs`.
32541
+ * the roster (someone removed or gone is neither heard from nor handed on, #300, `handsOn`), and its boxes only with
32542
+ * the author's `xs`.
31456
32543
  */
31457
32544
  async receiveMessage(from, raw, waited = false) {
31458
32545
  if (!isMessageFrame$1(raw)) return;
@@ -31463,7 +32550,7 @@ var GroupSession = class {
31463
32550
  const relayed = raw.s !== from;
31464
32551
  const now = this.now(), answer = (this.answering.get(from) ?? 0) > now;
31465
32552
  if (answer) this.answering.set(from, now + ANSWER_WINDOW_MS);
31466
- if (relayed && (!rosterHas(this.roster, from) || !this.handsOn(raw.s, raw.e))) return;
32553
+ if (relayed && (!rosterHas(this.roster, from) || !this.handsOn(raw.s))) return;
31467
32554
  if (this.isDuplicate(raw)) return;
31468
32555
  const signedWhole = relayed && this.wholeSigned(raw);
31469
32556
  if (!signedWhole && !verify(fromBase64Url(raw.sig), messageSigned$1(raw), publicKeyFromZ32(raw.s))) return;
@@ -31514,7 +32601,7 @@ var GroupSession = class {
31514
32601
  this.markSeen(raw);
31515
32602
  this.keep(clean(raw));
31516
32603
  this.persistSoon();
31517
- if (this.handsOn(raw.s, raw.e)) this.took(clean(raw));
32604
+ if (this.handsOn(raw.s)) this.took(clean(raw));
31518
32605
  return;
31519
32606
  }
31520
32607
  const id = first && !this.provisional.has(own) ? groupMessageId(raw.s, first.e, first.n) : own;
@@ -31552,7 +32639,7 @@ var GroupSession = class {
31552
32639
  if (firstFrame && rosterHas(this.state.chain[firstFrame.e]?.m ?? [], this.myKey)) this.markSeen(firstFrame);
31553
32640
  this.keep(clean(raw));
31554
32641
  this.persistSoon();
31555
- if (this.handsOn(raw.s, raw.e)) this.took(clean(raw));
32642
+ if (this.handsOn(raw.s)) this.took(clean(raw));
31556
32643
  }
31557
32644
  /**
31558
32645
  * An edit of a member's own message, from its author's edge or handed on by another member: believed only while its
@@ -31732,6 +32819,14 @@ var GroupSession = class {
31732
32819
  this.asked.set(from, now);
31733
32820
  this.hooks.send(from, this.syncFrame([], from));
31734
32821
  }
32822
+ /**
32823
+ * Whether my sync to `from` (the one my edge opened with) still waits for its answer, which has the chain from the
32824
+ * epoch it said: asking again on reading its newer sync, or a commit of that answer, had each commit I missed sent
32825
+ * twice, each with a secret sealed again (200 missed went as 400 frames, 1,456 when answers go a slice at a time).
32826
+ */
32827
+ awaitsAnswer(from) {
32828
+ return (this.answering.get(from) ?? 0) > this.now();
32829
+ }
31735
32830
  async replayWaiting() {
31736
32831
  await this.metaFollowsChain();
31737
32832
  const ready = this.waiting.filter((w) => w.frame.e <= this.epoch && !!this.state.secrets[w.frame.e]);
@@ -31746,15 +32841,13 @@ var GroupSession = class {
31746
32841
  const raw = frame.commit;
31747
32842
  if (!raw || typeof raw !== "object" || !Number.isSafeInteger(raw.e)) return;
31748
32843
  const e = raw.e;
32844
+ if (this.awaitsAnswer(from)) this.answering.set(from, this.now() + ANSWER_WINDOW_MS);
31749
32845
  if (e <= this.epoch) {
31750
32846
  const known = this.state.chain[e];
31751
32847
  const result = verifyCommit(raw, this.state.chain[e - 1] ?? null, this.id);
31752
32848
  if ("error" in result || result.commit.by !== known.by || result.commit.by !== this.admin) return;
31753
32849
  if (commitHash(result.commit) !== commitHash(known)) await this.fork(`Member ${from.slice(0, 8)} holds a different membership history for epoch ${e}`);
31754
- else if (this.takeLeftMark(known, frame.left)) {
31755
- this.unprune();
31756
- await this.persist();
31757
- }
32850
+ else if (this.takeLeftMark(known, frame.left)) await this.persist();
31758
32851
  return;
31759
32852
  }
31760
32853
  if (e > this.epoch + 1) {
@@ -31776,7 +32869,7 @@ var GroupSession = class {
31776
32869
  commit: result.commit,
31777
32870
  ...mark ? { left: mark } : {}
31778
32871
  });
31779
- if (this.state.status === "active" && !this.state.secrets[this.epoch]) this.ask(from);
32872
+ if (this.state.status === "active" && !this.state.secrets[this.epoch] && !(this.awaitsAnswer(from) && this.epoch < (this.syncedEpoch.get(from) ?? 0))) this.ask(from);
31780
32873
  const next = this.pendingCommits.get(this.epoch + 1);
31781
32874
  if (next) {
31782
32875
  this.pendingCommits.delete(this.epoch + 1);
@@ -31784,21 +32877,12 @@ var GroupSession = class {
31784
32877
  }
31785
32878
  }
31786
32879
  /**
31787
- * Whether a frame of `author` under `epoch` is taken from another member, kept and handed on: while its author is in
31788
- * the roster, or when it left (its removal marked `left`, and it is not back in) and the frame is from before that,
31789
- * and from after any removal of it before that was not a leave: let back in, it is not handed on for those epochs.
32880
+ * Whether a frame of `author` is taken from another member, kept and handed on: only while its author is in the
32881
+ * roster. One who left, as one removed, keeps its seed and the secrets of its epochs, and a copy of its state signs
32882
+ * frames for them after the leave, dated as it likes: whether the admin marked its removal `left` changes nothing.
31790
32883
  */
31791
- handsOn(author, epoch) {
31792
- if (rosterHas(this.roster, author)) return true;
31793
- const chain = this.state.chain;
31794
- let left = false;
31795
- for (let e = chain.length - 1; e > 0; e--) {
31796
- if (chain[e].k !== "remove" || chain[e].s !== author) continue;
31797
- if (left && epoch >= e) return true;
31798
- if (!this.state.leftMarks?.[e] || epoch >= e) return false;
31799
- left = true;
31800
- }
31801
- return left;
32884
+ handsOn(author) {
32885
+ return rosterHas(this.roster, author);
31802
32886
  }
31803
32887
  /** Keeps the admin's mark on a commit that took out a member who left (`GroupCommitFrame.left`) when it holds; true when new. */
31804
32888
  takeLeftMark(commit, mark) {
@@ -31825,7 +32909,7 @@ var GroupSession = class {
31825
32909
  if (sealed) this.takeSecret(commit.e, sealed);
31826
32910
  this.pruneSecrets();
31827
32911
  this.pruneRelay();
31828
- await this.persist();
32912
+ this.persistSoon();
31829
32913
  this.hooks.changed();
31830
32914
  await this.replayWaiting();
31831
32915
  }
@@ -31847,7 +32931,7 @@ var GroupSession = class {
31847
32931
  taken = this.takeSecret(entry.e, entry.s) || taken;
31848
32932
  }
31849
32933
  if (!taken) return;
31850
- await this.persist();
32934
+ this.persistSoon();
31851
32935
  this.hooks.changed();
31852
32936
  await this.replayWaiting();
31853
32937
  }
@@ -31858,7 +32942,8 @@ var GroupSession = class {
31858
32942
  if (!answered.take()) return;
31859
32943
  this.hear(frame);
31860
32944
  if (frame.e > this.epoch) {
31861
- this.ask(from);
32945
+ this.syncedEpoch.set(from, frame.e);
32946
+ if (!this.awaitsAnswer(from)) this.ask(from);
31862
32947
  this.offerMeta(from, frame.mt);
31863
32948
  this.handOwn(from, frame);
31864
32949
  return;
@@ -31895,12 +32980,7 @@ var GroupSession = class {
31895
32980
  });
31896
32981
  const lacks = missingIn(frame, from);
31897
32982
  const asked = new Set(Array.isArray(frame.ask) ? frame.ask.filter((k) => typeof k === "string" && k !== from && k !== this.myKey && rosterHas(this.roster, k)) : []);
31898
- const handed = this.leaversHanded.get(from);
31899
- const kept = !asked.size && !this.state.leftMarks ? [] : this.kept().filter((f) => {
31900
- if (!this.state.chain[f.e] || !rosterHas(this.state.chain[f.e].m, from) || !lacks(f) || this.isRemoved(f)) return false;
31901
- if (asked.has(f.s)) return true;
31902
- return !rosterHas(this.roster, f.s) && !handed?.has(frameKey$1(f)) && this.handsOn(f.s, f.e);
31903
- });
32983
+ const kept = !asked.size ? [] : this.kept().filter((f) => asked.has(f.s) && !!this.state.chain[f.e] && rosterHas(this.state.chain[f.e].m, from) && lacks(f) && !this.isRemoved(f));
31904
32984
  const written = asWritten(this.ownLacked(from, frame), kept);
31905
32985
  const metas = this.metaFor(from, frame.mt);
31906
32986
  for (const f of written) {
@@ -31912,6 +32992,7 @@ var GroupSession = class {
31912
32992
  const edits = (this.state.relayEdits ?? []).filter((f) => f.s === author && readable(f));
31913
32993
  answer.push(...edits.slice(-GROUP_LIMITS.handOnEdits));
31914
32994
  }
32995
+ const handed = this.leaversHanded.get(from);
31915
32996
  const gone = (this.state.relayEdits ?? []).filter((f) => !rosterHas(this.roster, f.s) && readable(f) && !handed?.has(editKey(f)));
31916
32997
  answer.push(...gone.slice(-GROUP_LIMITS.handOnEdits));
31917
32998
  answer.push(...metas.map((m) => m.frame));
@@ -32589,6 +33670,31 @@ function verifyCommunityCommit(raw, parent, parentRoster, groupId, before) {
32589
33670
  * member's second leave under the one statement there was, and no newcomer could enter that group again.
32590
33671
  */
32591
33672
  function verifyCommunityChain(raw, groupId) {
33673
+ const check = checkChain(raw, groupId);
33674
+ for (;;) {
33675
+ const step = check.next();
33676
+ if (step.done) return step.value;
33677
+ }
33678
+ }
33679
+ /**
33680
+ * `verifyCommunityChain` for a client whose engine shares its page's thread: the same checks, letting the thread go every
33681
+ * `CHAIN_SLICE_MS` of them. One commit's signature takes ~2.6 ms in JavaScript on a desktop CPU, several times that on a
33682
+ * phone, so a history near `COMMUNITY_LIMITS.chain` checked at once was an app that drew nothing for 5 s and more.
33683
+ */
33684
+ async function verifyCommunityChainPaced(raw, groupId) {
33685
+ const check = checkChain(raw, groupId), pause = pacer(CHAIN_SLICE_MS);
33686
+ for (;;) {
33687
+ const step = check.next();
33688
+ if (step.done) return step.value;
33689
+ await pause();
33690
+ }
33691
+ }
33692
+ /** `verifyCommunityChainPaced` checks commits for this long at most before it lets the thread go. */
33693
+ var CHAIN_SLICE_MS = 5;
33694
+ /** A fresh epoch's secret is sealed to members for this long at most before the thread goes (`CommunitySession.commit`). */
33695
+ var SEAL_SLICE_MS = 5;
33696
+ /** The chain's checks, one commit per step. */
33697
+ function* checkChain(raw, groupId) {
32592
33698
  if (!Array.isArray(raw) || raw.length === 0 || raw.length > COMMUNITY_LIMITS.chain) return { error: "Malformed membership chain" };
32593
33699
  const chain = [], rosters = [];
32594
33700
  let entry = "";
@@ -32598,6 +33704,7 @@ function verifyCommunityChain(raw, groupId) {
32598
33704
  chain.push(result.commit);
32599
33705
  rosters.push(result.roster);
32600
33706
  if (result.commit.x !== void 0) entry = result.commit.x;
33707
+ yield;
32601
33708
  }
32602
33709
  return {
32603
33710
  chain,
@@ -32710,6 +33817,8 @@ var MessagePace = class {
32710
33817
  var frameKey = (f) => `${f.e}:${f.h}:${f.n}`;
32711
33818
  /** A frame among everyone's: each member counts its own `n`, so `frameKey` alone tells only one member's frames apart. */
32712
33819
  var storeKey = (f) => `${f.s}:${frameKey(f)}`;
33820
+ /** A new link's entry seed is sealed to members for this long at most before the thread goes (`replaceLink`). */
33821
+ var ENTRY_SLICE_MS = 5;
32713
33822
  /**
32714
33823
  * Where a frame said again under a newer commit was first said (`o`, WISP 903 § Messages and catch-up): its commit's
32715
33824
  * epoch and short hash and its number there. Never the frame's own place, nor a later epoch than its own.
@@ -32749,6 +33858,18 @@ function isSealed(v) {
32749
33858
  "c"
32750
33859
  ].every((k) => typeof v[k] === "string" && B64.test(v[k]) && v[k].length <= 128);
32751
33860
  }
33861
+ /** A welcome's shape and the whole chain it and the pieces before it carry, not yet checked (`CommunitySession.join`). */
33862
+ function readWelcome(link, pieces, welcome) {
33863
+ if (!welcome || typeof welcome !== "object") return { error: "Malformed welcome" };
33864
+ const w = welcome;
33865
+ if (w.t !== "group-welcome" || w.v !== 2 || w.g !== link.g || !Array.isArray(w.commits) || !Array.isArray(w.secrets) || !isSealed(w.rv) || !isSealed(w.entry)) return { error: "Malformed welcome" };
33866
+ const commits = [...pieces.flatMap((p) => p && typeof p === "object" && Array.isArray(p.commits) ? p.commits : []), ...w.commits];
33867
+ if (commits.length > COMMUNITY_LIMITS.chain) return { error: "Membership chain too long" };
33868
+ return {
33869
+ welcome: w,
33870
+ commits
33871
+ };
33872
+ }
32752
33873
  /** A pair payload's box: an ephemeral key, a nonce and a ciphertext of at most `appBytes` sealed. */
32753
33874
  var MAX_PAIR_BOX = Math.ceil((COMMUNITY_LIMITS.appBytes + 16) * 4 / 3) + 4;
32754
33875
  function isPairBox(v) {
@@ -32763,7 +33884,7 @@ function isMessageFrame(v) {
32763
33884
  * One member's view of a community group: the branch it follows and the ones it knows, the
32764
33885
  * secrets it holds, what it has seen, and the recent frames it keeps for others.
32765
33886
  */
32766
- var CommunitySession = class {
33887
+ var CommunitySession = class CommunitySession {
32767
33888
  hooks;
32768
33889
  state;
32769
33890
  identity;
@@ -32876,12 +33997,17 @@ var CommunitySession = class {
32876
33997
  * add was made by another member (the first one to answer me went away) is as good.
32877
33998
  */
32878
33999
  static join(link, pieces, welcome, seedB64, now = Date.now()) {
32879
- if (!welcome || typeof welcome !== "object") return { error: "Malformed welcome" };
32880
- const w = welcome;
32881
- if (w.t !== "group-welcome" || w.v !== 2 || w.g !== link.g || !Array.isArray(w.commits) || !Array.isArray(w.secrets) || !isSealed(w.rv) || !isSealed(w.entry)) return { error: "Malformed welcome" };
32882
- const commits = [...pieces.flatMap((p) => p && typeof p === "object" && Array.isArray(p.commits) ? p.commits : []), ...w.commits];
32883
- if (commits.length > COMMUNITY_LIMITS.chain) return { error: "Membership chain too long" };
32884
- const verified = verifyCommunityChain(commits, link.g);
34000
+ const read = readWelcome(link, pieces, welcome);
34001
+ if ("error" in read) return read;
34002
+ return CommunitySession.joinVerified(link, read.welcome, verifyCommunityChain(read.commits, link.g), seedB64, now);
34003
+ }
34004
+ /** `join`, its chain checked a slice at a time (`verifyCommunityChainPaced`): what an app sharing its page's thread calls. */
34005
+ static async joinPaced(link, pieces, welcome, seedB64, now = Date.now()) {
34006
+ const read = readWelcome(link, pieces, welcome);
34007
+ if ("error" in read) return read;
34008
+ return CommunitySession.joinVerified(link, read.welcome, await verifyCommunityChainPaced(read.commits, link.g), seedB64, now);
34009
+ }
34010
+ static joinVerified(link, w, verified, seedB64, now) {
32885
34011
  if ("error" in verified) return verified;
32886
34012
  const { chain, roster, entry } = verified;
32887
34013
  const me = identityFromSeedB64(seedB64);
@@ -33684,14 +34810,18 @@ var CommunitySession = class {
33684
34810
  commit
33685
34811
  });
33686
34812
  if (FRESH.has(kind)) {
33687
- for (const [key] of roster) if (key !== this.myKey && isZ32Key(key)) this.hooks.addressed(key, {
33688
- t: "group-secret",
33689
- v: 2,
33690
- g: this.id,
33691
- to: key,
33692
- h: hash,
33693
- s: sealSecret(key, secret, secretAad(this.id, hash, key))
33694
- });
34813
+ const pause = pacer(SEAL_SLICE_MS);
34814
+ for (const [key] of roster) if (key !== this.myKey && isZ32Key(key)) {
34815
+ this.hooks.addressed(key, {
34816
+ t: "group-secret",
34817
+ v: 2,
34818
+ g: this.id,
34819
+ to: key,
34820
+ h: hash,
34821
+ s: sealSecret(key, secret, secretAad(this.id, hash, key))
34822
+ });
34823
+ await pause();
34824
+ }
33695
34825
  }
33696
34826
  this.hooks.changed();
33697
34827
  await this.renewLasting();
@@ -33802,9 +34932,13 @@ var CommunitySession = class {
33802
34932
  seedB64: entry?.seedB64 ?? ""
33803
34933
  };
33804
34934
  await this.persist();
33805
- if (entry) for (const key of this.others) {
33806
- const frame = this.entryFrame(key);
33807
- if (frame) this.hooks.addressed(key, frame);
34935
+ if (entry) {
34936
+ const pause = pacer(ENTRY_SLICE_MS);
34937
+ for (const key of this.others) {
34938
+ const frame = this.entryFrame(key);
34939
+ if (frame) this.hooks.addressed(key, frame);
34940
+ await pause();
34941
+ }
33808
34942
  }
33809
34943
  this.hooks.changed();
33810
34944
  return this.state.entry.key;
@@ -34362,6 +35496,7 @@ var CommunitySession = class {
34362
35496
  case "group-left": return this.receiveLeft(frame);
34363
35497
  case "group-entry": {
34364
35498
  if (frame.to !== this.myKey || !isSealed(frame.s) || frame.x !== this.currentEntryKey()) return false;
35499
+ if (this.state.entry.key === frame.x && this.state.entry.seedB64) return false;
34365
35500
  const seed = openSecret(this.identity.seed, this.myKey, frame.s, entryAad(this.id, this.myKey));
34366
35501
  return !!seed && this.takeEntrySeed(toBase64Url(seed));
34367
35502
  }
@@ -35594,6 +36729,6 @@ function readX401SdJwtVc(text) {
35594
36729
  };
35595
36730
  }
35596
36731
  //#endregion
35597
- export { SshSigError as $, ROUTINE_STATES as $a, isAppHash as $c, validExternalKey as $i, DEFAULT_RELAYS as $l, readGroupHave as $n, parseCallSignal as $o, wakeRequest as $r, ENROLL_DONE as $s, SEPOLIA_TEST_USDT as $t, knockIdentity as A, parseLinkPreview as Aa, openRequest as Ac, recordsFromWellKnown as Ai, deviceKeyZ32 as Al, fedimintRequestPayload as An, DirectPathWatch as Ao, FILE_LIMITS as Ar, handoffOfferFrame as As, didSignedMessages as At, toBase64Url as Au, GROUP_REACTED_FRAME as B, reactionIsNewer as Ba, appViewOf as Bc, IDENTITY_REVOCATION_LABEL as Bi, turnPutSummary as Bl, pairedMessageFrame as Bn, parseLocalTarget as Bo, GROUP_PIN_FRAME as Br, readHandoffHave as Bs, signingKeys as Bt, communityHasFrame as C, EDIT_RATE_WINDOW_MS as Ca, contactDay as Cc, domainTxtRecord as Ci, inviteOwnership as Cl, homeserverWebEndpoint as Cn, rosterHas as Co, pickHubs as Cr, handoffContext as Cs, DID_FILE_MAX_BYTES as Ct, MAX_AVATAR_LENGTH as Cu, decodeGroupEntryLink as D, dhtEditId as Da, linkRecords as Dc, nip05RootKey as Di, HANDOFF_CAPABILITY as Dl, decodeBolt11 as Dn, RatchetBox as Do, readLobby as Dr, handoffEphemeral as Ds, checkDidSignature as Dt, fromBase64Url as Du, KNOCK_TTL_MS as E, RateWindow as Ea, knockSlotRecords as Ec, isPublicAddress as Ei, ENROLL_CAPABILITY as El, resolveLightningDestination as En, RATCHET_CAPABILITY as Eo, readBeaconHead as Er, handoffDigest as Es, checkDidJws as Et, bytesEqual as Eu, GroupWakeLimiter as F, REACTION_LIMITS as Fa, APP_BUNDLE_LIMITS as Fc, DHT_TEXT_CAPABILITY as Fi, webCryptoSigner as Fl, GhostLink as Fn, RELAY_POLL_INTERVALS as Fo, TYPING_KINDS as Fr, handoffVersions as Fs, didWebHost as Ft, GROUP_EDIT_FRAME as G, readReply as Ga, readAppBundle as Gc, identityRevocationValue as Gi, readTurnPacket as Gl, GROUP_FILE_LIMITS as Gn, CALL_SIGNAL_MAX_AGE_MS as Go, pinNumberHolds as Gr, sealHandoffPiece as Gs, encodeDidDhtDeactivated as Gt, GroupSession as H, validReactionNumber as Ha, checkAppManifest as Hc, IdentityExchange as Hi, TURN_MAX as Hl, engineError as Hn, LIMITS as Ho, mayPin as Hr, readHandoffPake as Hs, strictBase64Url as Ht, groupWakeFrame as I, ReactionWindow as Ia, APP_BUNDLE_MAGIC as Ic, capsDescriptors as Ii, TURN_PUT_WINDOW_MS as Il, INVITE_TAKEN as In, WATCH_PEER_MS as Io, TYPING_REFRESH_MS as Ir, newHandoffId as Is, normalizeDid as It, parseCommunityEdit as J, BUTTON_STYLES as Ja, APP_PREFIXES as Jc, receivedIdentityStatus as Ji, turnInstance as Jl, GROUP_WANT_NO_FRAME as Jn, buildSdpFromSignal as Jo, WakeLimiter as Jr, readSetUpdate as Js, signDidDhtPacket as Jt, GROUP_EDIT_TEXT_BYTES as K, replySnippet as Ka, readAppBundleAsync as Kc, identityStatement as Ki, signTurnPacket as Kl, GROUP_HAVE_FRAME as Kn, RTC_CONFIG as Ko, readPin as Kr, SET_ACK as Ks, encodeDidDhtPacket as Kt, groupWakes as L, nextReactionNumber as La, APP_ICON_PATH as Lc, dialDescriptors as Li, TURN_RAISE_READ_TIMEOUT_MS as Ll, LIVENESS_PING_MS as Ln, presenceSeenAt as Lo, TypingSender as Lr, readHandoffAck as Ls, parseDid as Lt, mergeKnocks as M, readForwarded as Ma, readLinkRecord as Mc, txtValue as Mi, devicePingFrame as Ml, isFederationId as Mn, DHT_POLL_INTERVALS as Mo, sentWhole as Mr, handoffReleaseFrame as Ms, didWebFile as Mt, utf8Decode as Mu, readKnocks as N, COMMUNITY_REACTION_FRAME as Na, requestRecords as Nc, wellKnownUrl as Ni, newDeviceSetSecret as Nl, parseCashuRequestPayload as Nn, EXPECT_PEER_MS as No, transferEnded as Nr, handoffRetryAfter as Ns, didWebFileNames as Nt, utf8Encode as Nu, encodeGroupEntryLink as O, LINK_TRAILING as Oa, makeStampPaced as Oc, normalizeDomain as Oi, deviceEchoFrame as Ol, ENDPOINT as On, emptyRatchetState as Oo, shouldBeHub as Or, handoffHelloFrame as Os, didGhostlyServiceEntry as Ot, isZ32Key as Ou, GROUP_WAKE_FRAME as P, GROUP_REACTION_FRAME as Pa, seenEntry as Pc, CapsExchange as Pi, seedSigner as Pl, parseFedimintRequestPayload as Pn, PRESENCE_WINDOW as Po, transferStalled as Pr, handoffStreamKey as Ps, didWebFileUrl as Pt, SSHSIG_NAMESPACE as Q, PR_STATES as Qa, checkAppRevokeStatement as Qc, emptyProofLedger as Qi, turnVerifierMark as Ql, readGroupFileMeta as Qn, extractParamsFromSdp as Qo, relayRequest as Qr, verifySetUpdate as Qs, PaymentPreflightError as Qt, parseGroupWakeFrame as R, queueReaction as Ra, APP_PERMISSIONS as Rc, IDENTITY_MAX_EVIDENCE as Ri, TURN_SETTLE_MS as Rl, PAIRED_FRAME_TOO_LARGE as Rn, GhostlyHttpError as Ro, sanitizeTypingStatus as Rr, readHandoffCancel as Rs, parseDidDocument as Rt, GROUP_READ_NOTE_COMMUNITY as S, EDIT_BUFFER_MS as Sa, REQUEST_LIFETIME_MS as Sc, dnsProofName as Si, inviteLink as Sl, pubkyProofPath as Sn, rosterAdmin as So, newerHead as Sr, handoffCancelFrame as Ss, DID_DOCUMENT_MAX_BYTES as St, verify as Su, encodeCommunityLink as T, REMOVED_TEXT as Ta, knockSlotOf as Tc, encodeDnsQuery as Ti, DEVICES_CAPABILITY as Tl, requestLnurlInvoice as Tn, edgeParams as To, readBeacon as Tr, handoffDataFrame as Ts, DidError as Tt, sanitizeDisplayText as Tu, frameBytes as U, wireReaction as Ua, isAppUrl as Uc, boundVerifiedIdentity as Ui, firstDeviceSetSecret as Ul, engineText as Un, decodeControl as Uo, nextPinNumber as Ur, readHandoffTurnFrame as Us, didDhtDocument as Ut, GROUP_READ_NOTE as V, readReaction as Va, assembleAppBundle as Vc, IdentityCheckUnavailable as Vi, TURN_LAST_SEQUENCE as Vl, EngineError as Vn, webLocalFetch as Vo, PIN_LIMITS as Vr, readHandoffHello as Vs, staticDidDocument as Vt, COMMUNITY_EDIT_FRAME as W, pairedReplyAuthor as Wa, pacer as Wc, emptyIdentityLedger as Wi, nextTurnPosition as Wl, parseEngineError as Wn, encodeControl as Wo, pinIsNewer as Wr, readHandoffVerified as Ws, didDhtFromPublicKey as Wt, groupName as X, ITEM_STATES as Xa, appFingerprint as Xc, lastSharedWithMe as Xi, turnName as Xl, groupFileFallback as Xn, callSignalHeardAt as Xo, newWakeToken as Xr, setUpdateFrame as Xs, EVM_TEST_CHAINS as Xt, mentionsMember as Y, CRON_LINE as Ya, APP_STATEMENT_LIMITS as Yc, revokesIdentity as Yi, turnKeys as Yl, fetchesByItself as Yn, callRtcConfig as Yo, deviceWakeRequest as Yr, setAckFrame as Ys, ETHEREUM_USDT as Yt, SSHSIG_MAX_ARMOR as Z, PR_CHECKS as Za, appRef as Zc, PeerProofs as Zi, turnStatedVerifier as Zl, isGroupMessageId as Zn, contactRtcConfig as Zo, parseWakeFrame as Zr, signTombstone as Zs, ONCHAIN_PROVIDER as Zt, groupTypingEpoch as _, fileMessageText as _a, planKnocks as _c, isHoldUrl as _i, readDeviceInvite as _l, isPubkyProofFolder as _n, GROUP_MEMBER_CAP as _o, freshHubs as _r, filePartName as _s, normalizeAtprotoHandle as _t, parseRelayPayload as _u, appRevocationFor as a, DHT_MESSAGE_TTL as aa, enrollDigits as ac, chatAppId as ai, signAppObject as al, assertTokenUnits as an, cardLine as ao, SIGNAL_HOLD_MS as ar, HANDOFF_ACK as as, verifyBitcoinMessage as at, currentRelays as au, COMMUNITY_LIMITS as b, voiceLevel as ba, turnOff as bc, DOMAIN_FILE_MAX_BYTES as bi, decodeInviteCode as bl, pubkyProofCapability as bn, commitHash as bo, mergeBeacon as br, handoffAttemptSucceeded as bs, AtprotoProofError as bt, identityFromSeedB64 as bu, checkAppBeforeRun as c, dhtFileId as ca, enrollHelloFrame as cc, BUTTONS_CAPABILITY as ci, readImageMeta as cl, validatePaymentTarget as cn, sameButtonText as co, readGroupSignal as cr, HANDOFF_HAVE as cs, ATPROTO_DECLARED_SCOPE as ct, traceLink as cu, checkAppStoreIndex as d, sanitizeMime as da, readEnrollHello as dc, UPGRADE_CAPABILITY as di, readCanonicalJson as dl, SPARK_PROVIDER as dn, arrivalKey as do, meshHubs as dr, HANDOFF_PAKE as ds, ATPROTO_PROOF_SCOPE as dt, withRequestOptions as du, TRANSPORTS as ea, ENROLL_GRANT as ec, checkPushEndpoint as ei, isAppKey as el, SEPOLIA_TEST_USDT_FAUCET as en, RUN_RESULTS as eo, readGroupWant as er, signalHasVideo as es, parseSshPublicKey as et, HEDGE_MISSING_MS as eu, readAppStore as f, PLAYABLE_AUDIO as fa, verifyEnrollProof as fc, HOLD_CAPABILITY as fi, createContactLink as fl, sparkAddressKind as fn, claimedTime as fo, pickMeshHubs as fr, HANDOFF_PIECE_BYTES as fs, atprotoDidMethod as ft, PacketTooLargeError as fu, GroupTypingBoard as g, downsamplePeaks as ga, newInbox as gc, HoldRefusedError as gi, deviceInviteJoinerParams as gl, isPubkyKey as gn, GROUP_ADMIN_OFF_ERROR as go, doorHubs as gr, NO_ATTEMPTS as gs, isAtprotoDid as gt, openRelayPayload as gu, GROUP_TYPING_FRAME as h, baseMime as ha, inboxRecord as hc, HoldKeys as hi, createDeviceInvite as hl, PUBKY_PROOF_MAX_BYTES as hn, shownTime as ho, beaconRecords as hr, HANDOFF_VERIFIED as hs, checkAtprotoProofRecord as ht, newerPacket as hu, addedAppPermissions as i, DHT_FILE_TOO_LARGE as ia, enrollCancelReason as ic, APP_DATA_MAX_BYTES as ii, setAppSignatureFastPath as il, arkAddressPrefix as in, buttonLabelClash as io, SIGNAL_FRESH_MS as ir, serviceIdFromName as is, verifySshSignature as it, SLOW_MS as iu, knockRecords as j, forwardedAgain as ja, readKnockSlot as jc, recordsName as ji, deviceLinkPairing as jl, findEndpoint as jn, AWAITING_PEER_MS as jo, FileUplink as jr, handoffPakeFrame as js, didWebDocumentUrl as jt, toZ32 as ju, entryParams as k, linkStop as ka, mergeContactKnocks as kc, recordsFromTxt as ki, deviceEchoNonce as kl, cashuRequestPayload as kn, ratchetSessionOf as ko, ChatFiles as kr, handoffManifestFrames as ks, didJwsAlg as kt, randomBytes as ku, planAppUpdate as l, formatFileSize as la, enrollProofFrame as lc, EDIT_CAPABILITY as li, canonicalJson as ll, walletNetworkOf as ln, statusCardBytes as lo, MESH_HUBS as lr, HANDOFF_HELLO as ls, ATPROTO_FULL_SCOPE as lt, budgetRetryMs as lu, signAppStore as m, VOICE_METER as ma, endedRequests as mc, HOLD_LIMITS as mi, readContactLink as ml, isBitcoinAddress as mn, receivedTimestamp as mo, beaconKeys as mr, HANDOFF_TIMINGS as ms, atprotoProofRkey as mt, createRelayPayload as mu, readX401SdJwtVc as n, irohDescriptor as na, ENROLL_PROOF as nc, APP_RANGE_LIMITS as ni, readAppRevocation as nl, USDT_PUBLIC_RPC as nn, TASK_STATUSES as no, CarriedTransport as nr, HTTP_SERVICE_PROTO as ns, sameSshKey as nt, RelayTransport as nu, appStoreDecision as o, peekDhtMailbox as oa, enrollDoneFrame as oc, isAppVersion as oi, signAppRevocation as ol, assertWholeSats as on, cardUrl as oo, SIGNAL_REPLY_MS as or, HANDOFF_CANCEL as os, BitcoinAddressError as ot, normalizeRelayUrl as ou, readAppStoreSteps as p, VOICE_LIMITS as pa, clearMissed as pc, HOLD_DATED_BACK_MS as pi, encodeContactLink as pl, sparkInvoiceDetails as pn, heardTime as po, COMMUNITY_TOPOLOGY as pr, HANDOFF_REQUEST as ps, atprotoProofRecord as pt, RELAY_PAYLOAD_MAX_BYTES as pu, carryMentions as q, BUTTON_ID as qa, sha256Paced as qc, newIdentityBinding as qi, signTurnRelease as ql, GROUP_WANT_FRAME as qn, answersOffer as qo, WAKE_CALL_INTERVAL_MS as qr, SET_UPDATE as qs, resolveDidDht as qt, sameX401HolderJwk as r, irohRelayUrl as ra, enrollCancelFrame as rc, isServeId as ri, readAppRevocations as rl, WALLET_NETWORKS as rn, appCardId as ro, GROUP_SIGNAL_FRAME as rr, LEGACY_SERVICES as rs, sshSignCommand as rt, RelaysFailedError as ru, appUpdateDecision as s, DHT_FILE_CAPABILITY as sa, enrollGrantFrame as sc, APPS_CAPABILITY as si, parseImageMeta as sl, formatPaymentAmount as sn, checkStatusCard as so, groupSignalFrame as sr, HANDOFF_DONE as ss, decodeAnyBitcoinAddress as st, setLinkTraceSink as su, newX401HolderKey as t, automaticTransport as ta, ENROLL_HELLO as tc, vapidKeysMatch as ti, isAppRef as tl, TEST_USDT_FAUCET_AMOUNT as tn, STATUS_CARD_LIMITS as to, readGroupWantNo as tr, emptyLinkRecords as ts, parseSshSignature as tt, HEDGE_MS as tu, APP_STORE_LIMITS as u, sanitizeFileName as ua, readEnrollGrant as uc, STATUS_CARD_CAPABILITY as ui, canonicalJsonBytes as ul, SPARK_NETWORKS as un, statusCardText as uo, mayBeHub as ur, HANDOFF_OFFER as us, ATPROTO_PROOF_COLLECTION as ut, isDiscoveryBudgetError as uu, openGroupTyping as v, parseVoiceMeta as va, settleRequest as vc, newMailbox as vi, OwnInviteError as vl, newPubkyProofFolder as vn, MAX_GROUP_CHAIN as vo, lobbyKeys as vr, handoffAttemptAllowed as vs, parseAtprotoDidDocument as vt, createIdentity as vu, decodeCommunityLink as w, MAX_REMOVAL_NUMBER as wa, knockSlotIdentity as wc, domainWellKnownFile as wi, ownInviteRefusal as wl, pubkyHomeserverOf as wn, verifyCommitSignature as wo, rankHubs as wr, handoffContextProof as ws, DID_JWS_MAX_LENGTH as wt, sanitizeAvatar as wu, CommunitySession as x, parseVideoMeta as xa, ContactRequestError as xc, decodeDnsResponse as xi, encodeInviteCode as xl, pubkyProofFile as xn, parseGroupCommit as xo, mergeLobby as xr, handoffBusyFrame as xs, verifyAtprotoRecordProof as xt, publicKeyFromZ32 as xu, sealGroupTyping as y, voiceDownloadName as ya, takeRequest as yc, readManifest as yi, createChatInvite as yl, normalizePubkyKey as yn, MEMBER_KEY as yo, lobbyRecords as yr, handoffAttemptFailed as ys, shortAtprotoDid as yt, identityFromSeed as yu, GROUP_LIMITS as z, reactionEmoji as za, appDigest as zc, IDENTITY_MAX_VALIDITY as zi, classifyTurnRead as zl, pairedMessageFits as zn, formatLocalTarget as zo, typingActivity as zr, readHandoffDone as zs, parseDidSignaturePaste as zt };
36732
+ export { SshSigError as $, replySnippet as $a, readAppBundle as $c, identityStatement as $i, readTurnPacket as $l, GROUP_HAVE_FRAME as $n, CALL_SIGNAL_MAX_AGE_MS as $o, readPin as $r, sealHandoffPiece as $s, SEPOLIA_TEST_USDT as $t, knockIdentity as A, EDIT_RATE_WINDOW_MS as Aa, REQUEST_LIFETIME_MS as Ac, domainTxtRecord as Ai, inviteLink as Al, fedimintRequestPayload as An, rosterAdmin as Ao, pickHubs as Ar, handoffCancelFrame as As, didSignedMessages as At, verify as Au, GROUP_REACTED_FRAME as B, COMMUNITY_REACTION_FRAME as Ba, readLinkRecord as Bc, wellKnownUrl as Bi, devicePingFrame as Bl, stripPictureMetadata as Bn, DHT_POLL_INTERVALS as Bo, transferEnded as Br, handoffReleaseFrame as Bs, signingKeys as Bt, utf8Decode as Bu, communityHasFrame as C, downsamplePeaks as Ca, inboxRecord as Cc, HoldRefusedError as Ci, createDeviceInvite as Cl, homeserverWebEndpoint as Cn, shownTime as Co, doorHubs as Cr, HANDOFF_VERIFIED as Cs, DID_FILE_MAX_BYTES as Ct, newerPacket as Cu, decodeGroupEntryLink as D, voiceLevel as Da, takeRequest as Dc, DOMAIN_FILE_MAX_BYTES as Di, createChatInvite as Dl, decodeBolt11 as Dn, MEMBER_KEY as Do, mergeBeacon as Dr, handoffAttemptFailed as Ds, checkDidSignature as Dt, identityFromSeed as Du, KNOCK_TTL_MS as E, voiceDownloadName as Ea, settleRequest as Ec, readManifest as Ei, OwnInviteError as El, resolveLightningDestination as En, MAX_GROUP_CHAIN as Eo, lobbyRecords as Er, handoffAttemptAllowed as Es, checkDidJws as Et, createIdentity as Eu, GroupWakeLimiter as F, LINK_TRAILING as Fa, linkRecords as Fc, normalizeDomain as Fi, HANDOFF_CAPABILITY as Fl, NO_VIDEO_METADATA as Fn, RatchetBox as Fo, shouldBeHub as Fr, handoffEphemeral as Fs, didWebHost as Ft, fromBase64Url as Fu, GROUP_EDIT_FRAME as G, queueReaction as Ga, APP_ICON_PATH as Gc, IDENTITY_MAX_EVIDENCE as Gi, TURN_RAISE_READ_TIMEOUT_MS as Gl, PAIRED_FRAME_TOO_LARGE as Gn, presenceSeenAt as Go, sanitizeTypingStatus as Gr, readHandoffAck as Gs, encodeDidDhtDeactivated as Gt, GroupSession as H, REACTION_LIMITS as Ha, seenEntry as Hc, DHT_TEXT_CAPABILITY as Hi, seedSigner as Hl, GhostLink as Hn, PRESENCE_WINDOW as Ho, TYPING_KINDS as Hr, handoffStreamKey as Hs, strictBase64Url as Ht, groupWakeFrame as I, linkStop as Ia, makeStampPaced as Ic, recordsFromTxt as Ii, deviceEchoFrame as Il, withoutVideoMetadata as In, emptyRatchetState as Io, ChatFiles as Ir, handoffHelloFrame as Is, normalizeDid as It, isZ32Key as Iu, parseCommunityEdit as J, readReaction as Ja, appViewOf as Jc, IdentityCheckUnavailable as Ji, turnPutSummary as Jl, EngineError as Jn, parseLocalTarget as Jo, PIN_LIMITS as Jr, readHandoffHave as Js, signDidDhtPacket as Jt, GROUP_EDIT_TEXT_BYTES as K, reactionEmoji as Ka, APP_PERMISSIONS as Kc, IDENTITY_MAX_VALIDITY as Ki, TURN_SETTLE_MS as Kl, pairedMessageFits as Kn, GhostlyHttpError as Ko, typingActivity as Kr, readHandoffCancel as Ks, encodeDidDhtPacket as Kt, groupWakes as L, parseLinkPreview as La, mergeContactKnocks as Lc, recordsFromWellKnown as Li, deviceEchoNonce as Ll, NO_PICTURE_METADATA as Ln, ratchetSessionOf as Lo, FILE_LIMITS as Lr, handoffManifestFrames as Ls, parseDid as Lt, randomBytes as Lu, mergeKnocks as M, REMOVED_TEXT as Ma, knockSlotIdentity as Mc, encodeDnsQuery as Mi, ownInviteRefusal as Ml, isFederationId as Mn, verifyCommitSignature as Mo, readBeacon as Mr, handoffContextProof as Ms, didWebFile as Mt, sanitizeAvatar as Mu, readKnocks as N, RateWindow as Na, knockSlotOf as Nc, isPublicAddress as Ni, DEVICES_CAPABILITY as Nl, parseCashuRequestPayload as Nn, edgeParams as No, readBeaconHead as Nr, handoffDataFrame as Ns, didWebFileNames as Nt, sanitizeDisplayText as Nu, encodeGroupEntryLink as O, parseVideoMeta as Oa, turnOff as Oc, decodeDnsResponse as Oi, decodeInviteCode as Ol, ENDPOINT as On, commitHash as Oo, mergeLobby as Or, handoffAttemptSucceeded as Os, didGhostlyServiceEntry as Ot, identityFromSeedB64 as Ou, GROUP_WAKE_FRAME as P, dhtEditId as Pa, knockSlotRecords as Pc, nip05RootKey as Pi, ENROLL_CAPABILITY as Pl, parseFedimintRequestPayload as Pn, RATCHET_CAPABILITY as Po, readLobby as Pr, handoffDigest as Ps, didWebFileUrl as Pt, bytesEqual as Pu, SSHSIG_NAMESPACE as Q, readReply as Qa, pacer as Qc, identityRevocationValue as Qi, nextTurnPosition as Ql, GROUP_FILE_LIMITS as Qn, encodeControl as Qo, pinNumberHolds as Qr, readHandoffVerified as Qs, PaymentPreflightError as Qt, parseGroupWakeFrame as R, forwardedAgain as Ra, openRequest as Rc, recordsName as Ri, deviceKeyZ32 as Rl, PICTURE_METADATA_LIMITS as Rn, DirectPathWatch as Ro, FileUplink as Rr, handoffOfferFrame as Rs, parseDidDocument as Rt, toBase64Url as Ru, GROUP_READ_NOTE_COMMUNITY as S, baseMime as Sa, endedRequests as Sc, HoldKeys as Si, readContactLink as Sl, pubkyProofPath as Sn, receivedTimestamp as So, beaconRecords as Sr, HANDOFF_TIMINGS as Ss, DID_DOCUMENT_MAX_BYTES as St, createRelayPayload as Su, encodeCommunityLink as T, parseVoiceMeta as Ta, planKnocks as Tc, newMailbox as Ti, readDeviceInvite as Tl, requestLnurlInvoice as Tn, GROUP_MEMBER_CAP as To, lobbyKeys as Tr, filePartName as Ts, DidError as Tt, parseRelayPayload as Tu, frameBytes as U, ReactionWindow as Ua, APP_BUNDLE_LIMITS as Uc, capsDescriptors as Ui, webCryptoSigner as Ul, INVITE_TAKEN as Un, RELAY_POLL_INTERVALS as Uo, TYPING_REFRESH_MS as Ur, handoffVersions as Us, didDhtDocument as Ut, GROUP_READ_NOTE as V, GROUP_REACTION_FRAME as Va, requestRecords as Vc, CapsExchange as Vi, newDeviceSetSecret as Vl, withoutPictureMetadata as Vn, EXPECT_PEER_MS as Vo, transferStalled as Vr, handoffRetryAfter as Vs, staticDidDocument as Vt, utf8Encode as Vu, COMMUNITY_EDIT_FRAME as W, nextReactionNumber as Wa, APP_BUNDLE_MAGIC as Wc, dialDescriptors as Wi, TURN_PUT_WINDOW_MS as Wl, LIVENESS_PING_MS as Wn, WATCH_PEER_MS as Wo, TypingSender as Wr, newHandoffId as Ws, didDhtFromPublicKey as Wt, groupName as X, wireReaction as Xa, checkAppManifest as Xc, boundVerifiedIdentity as Xi, TURN_MAX as Xl, engineText as Xn, LIMITS as Xo, nextPinNumber as Xr, readHandoffPake as Xs, EVM_TEST_CHAINS as Xt, mentionsMember as Y, validReactionNumber as Ya, assembleAppBundle as Yc, IdentityExchange as Yi, TURN_LAST_SEQUENCE as Yl, engineError as Yn, webLocalFetch as Yo, mayPin as Yr, readHandoffHello as Ys, ETHEREUM_USDT as Yt, SSHSIG_MAX_ARMOR as Z, pairedReplyAuthor as Za, isAppUrl as Zc, emptyIdentityLedger as Zi, firstDeviceSetSecret as Zl, parseEngineError as Zn, decodeControl as Zo, pinIsNewer as Zr, readHandoffTurnFrame as Zs, ONCHAIN_PROVIDER as Zt, groupTypingEpoch as _, sanitizeFileName as _a, enrollProofFrame as _c, STATUS_CARD_CAPABILITY as _i, canonicalJson as _l, isPubkyProofFolder as _n, statusCardBytes as _o, mayBeHub as _r, HANDOFF_HELLO as _s, normalizeAtprotoHandle as _t, budgetRetryMs as _u, appRevocationFor as a, emptyProofLedger as aa, signTombstone as ac, relayRequest as ai, appRef as al, assertTokenUnits as an, PR_STATES as ao, readGroupFileMeta as ar, contactRtcConfig as as, verifyBitcoinMessage as at, turnStatedVerifier as au, COMMUNITY_LIMITS as b, VOICE_LIMITS as ba, verifyEnrollProof as bc, HOLD_DATED_BACK_MS as bi, createContactLink as bl, pubkyProofCapability as bn, claimedTime as bo, COMMUNITY_TOPOLOGY as br, HANDOFF_PIECE_BYTES as bs, AtprotoProofError as bt, PacketTooLargeError as bu, checkAppBeforeRun as c, automaticTransport as ca, ENROLL_GRANT as cc, vapidKeysMatch as ci, isAppKey as cl, validatePaymentTarget as cn, STATUS_CARD_LIMITS as co, readGroupWantNo as cr, signalHasVideo as cs, ATPROTO_DECLARED_SCOPE as ct, HEDGE_MISSING_MS as cu, checkAppStoreIndex as d, DHT_FILE_TOO_LARGE as da, enrollCancelFrame as dc, APP_DATA_MAX_BYTES as di, readAppRevocations as dl, SPARK_PROVIDER as dn, appCardUrl as do, SIGNAL_FRESH_MS as dr, LEGACY_SERVICES as ds, ATPROTO_PROOF_SCOPE as dt, RelaysFailedError as du, newIdentityBinding as ea, SET_ACK as ec, WAKE_CALL_INTERVAL_MS as ei, readAppBundleAsync as el, SEPOLIA_TEST_USDT_FAUCET as en, BUTTON_ID as eo, GROUP_WANT_FRAME as er, RTC_CONFIG as es, parseSshPublicKey as et, signTurnPacket as eu, readAppStore as f, DHT_MESSAGE_TTL as fa, enrollCancelReason as fc, chatAppId as fi, setAppSignatureFastPath as fl, sparkAddressKind as fn, buttonLabelClash as fo, SIGNAL_HOLD_MS as fr, serviceIdFromName as fs, atprotoDidMethod as ft, SLOW_MS as fu, GroupTypingBoard as g, formatFileSize as ga, enrollHelloFrame as gc, EDIT_CAPABILITY as gi, readImageMeta as gl, isPubkyKey as gn, sameButtonText as go, MESH_HUBS as gr, HANDOFF_HAVE as gs, isAtprotoDid as gt, traceLink as gu, GROUP_TYPING_FRAME as h, dhtFileId as ha, enrollGrantFrame as hc, BUTTONS_CAPABILITY as hi, parseImageMeta as hl, PUBKY_PROOF_MAX_BYTES as hn, checkStatusCard as ho, readGroupSignal as hr, HANDOFF_DONE as hs, checkAtprotoProofRecord as ht, setLinkTraceSink as hu, addedAppPermissions as i, PeerProofs as ia, setUpdateFrame as ic, parseWakeFrame as ii, appFingerprint as il, arkAddressPrefix as in, PR_CHECKS as io, isGroupMessageId as ir, callSignalHeardAt as is, verifySshSignature as it, turnName as iu, knockRecords as j, MAX_REMOVAL_NUMBER as ja, contactDay as jc, domainWellKnownFile as ji, inviteOwnership as jl, findEndpoint as jn, rosterHas as jo, rankHubs as jr, handoffContext as js, didWebDocumentUrl as jt, MAX_AVATAR_LENGTH as ju, entryParams as k, EDIT_BUFFER_MS as ka, ContactRequestError as kc, dnsProofName as ki, encodeInviteCode as kl, cashuRequestPayload as kn, parseGroupCommit as ko, newerHead as kr, handoffBusyFrame as ks, didJwsAlg as kt, publicKeyFromZ32 as ku, planAppUpdate as l, irohDescriptor as la, ENROLL_HELLO as lc, APP_RANGE_LIMITS as li, isAppRef as ll, walletNetworkOf as ln, TASK_STATUSES as lo, CarriedTransport as lr, emptyLinkRecords as ls, ATPROTO_FULL_SCOPE as lt, HEDGE_MS as lu, signAppStore as m, DHT_FILE_CAPABILITY as ma, enrollDoneFrame as mc, APPS_CAPABILITY as mi, signAppRevocation as ml, isBitcoinAddress as mn, cardUrl as mo, groupSignalFrame as mr, HANDOFF_CANCEL as ms, atprotoProofRkey as mt, normalizeRelayUrl as mu, readX401SdJwtVc as n, revokesIdentity as na, readSetUpdate as nc, deviceWakeRequest as ni, APP_PREFIXES as nl, USDT_PUBLIC_RPC as nn, CRON_LINE as no, fetchesByItself as nr, buildSdpFromSignal as ns, sameSshKey as nt, turnInstance as nu, appStoreDecision as o, validExternalKey as oa, verifySetUpdate as oc, wakeRequest as oi, checkAppRevokeStatement as ol, assertWholeSats as on, ROUTINE_STATES as oo, readGroupHave as or, extractParamsFromSdp as os, BitcoinAddressError as ot, turnVerifierMark as ou, readAppStoreSteps as p, peekDhtMailbox as pa, enrollDigits as pc, isAppVersion as pi, signAppObject as pl, sparkInvoiceDetails as pn, cardLine as po, SIGNAL_REPLY_MS as pr, HANDOFF_ACK as ps, atprotoProofRecord as pt, currentRelays as pu, carryMentions as q, reactionIsNewer as qa, appDigest as qc, IDENTITY_REVOCATION_LABEL as qi, classifyTurnRead as ql, pairedMessageFrame as qn, formatLocalTarget as qo, GROUP_PIN_FRAME as qr, readHandoffDone as qs, resolveDidDht as qt, sameX401HolderJwk as r, lastSharedWithMe as ra, setAckFrame as rc, newWakeToken as ri, APP_STATEMENT_LIMITS as rl, WALLET_NETWORKS as rn, ITEM_STATES as ro, groupFileFallback as rr, callRtcConfig as rs, sshSignCommand as rt, turnKeys as ru, appUpdateDecision as s, TRANSPORTS as sa, ENROLL_DONE as sc, checkPushEndpoint as si, isAppHash as sl, formatPaymentAmount as sn, RUN_RESULTS as so, readGroupWant as sr, parseCallSignal as ss, decodeAnyBitcoinAddress as st, DEFAULT_RELAYS as su, newX401HolderKey as t, receivedIdentityStatus as ta, SET_UPDATE as tc, WakeLimiter as ti, sha256Paced as tl, TEST_USDT_FAUCET_AMOUNT as tn, BUTTON_STYLES as to, GROUP_WANT_NO_FRAME as tr, answersOffer as ts, parseSshSignature as tt, signTurnRelease as tu, APP_STORE_LIMITS as u, irohRelayUrl as ua, ENROLL_PROOF as uc, isServeId as ui, readAppRevocation as ul, SPARK_NETWORKS as un, appCardId as uo, GROUP_SIGNAL_FRAME as ur, HTTP_SERVICE_PROTO as us, ATPROTO_PROOF_COLLECTION as ut, RelayTransport as uu, openGroupTyping as v, sanitizeMime as va, readEnrollGrant as vc, UPGRADE_CAPABILITY as vi, canonicalJsonBytes as vl, newPubkyProofFolder as vn, statusCardText as vo, meshHubs as vr, HANDOFF_OFFER as vs, parseAtprotoDidDocument as vt, isDiscoveryBudgetError as vu, decodeCommunityLink as w, fileMessageText as wa, newInbox as wc, isHoldUrl as wi, deviceInviteJoinerParams as wl, pubkyHomeserverOf as wn, GROUP_ADMIN_OFF_ERROR as wo, freshHubs as wr, NO_ATTEMPTS as ws, DID_JWS_MAX_LENGTH as wt, openRelayPayload as wu, CommunitySession as x, VOICE_METER as xa, clearMissed as xc, HOLD_LIMITS as xi, encodeContactLink as xl, pubkyProofFile as xn, heardTime as xo, beaconKeys as xr, HANDOFF_REQUEST as xs, verifyAtprotoRecordProof as xt, RELAY_PAYLOAD_MAX_BYTES as xu, sealGroupTyping as y, PLAYABLE_AUDIO as ya, readEnrollHello as yc, HOLD_CAPABILITY as yi, readCanonicalJson as yl, normalizePubkyKey as yn, arrivalKey as yo, pickMeshHubs as yr, HANDOFF_PAKE as ys, shortAtprotoDid as yt, withRequestOptions as yu, GROUP_LIMITS as z, readForwarded as za, readKnockSlot as zc, txtValue as zi, deviceLinkPairing as zl, isStrippedPicture as zn, AWAITING_PEER_MS as zo, sentWhole as zr, handoffPakeFrame as zs, parseDidSignaturePaste as zt, toZ32 as zu };
35598
36733
 
35599
- //# sourceMappingURL=src-1RU4TilT.js.map
36734
+ //# sourceMappingURL=src-BD8RBVEp.js.map