@ghostlytools/sdk 1.8.1 → 1.10.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 (34) hide show
  1. package/dist/core.js +2 -593
  2. package/dist/core.js.map +1 -1
  3. package/dist/{fakes-Cyfc_vXC.js → fakes-BTB2ugB3.js} +2 -2
  4. package/dist/{fakes-Cyfc_vXC.js.map → fakes-BTB2ugB3.js.map} +1 -1
  5. package/dist/fakes.js +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/{keet-identity-key-uq3scTiE.js → keet-identity-key-a4pR0QSm.js} +2 -2
  8. package/dist/{keet-identity-key-uq3scTiE.js.map → keet-identity-key-a4pR0QSm.js.map} +1 -1
  9. package/dist/{src-DytzSJB6.js → src-BZy4lDju.js} +2045 -164
  10. package/dist/src-BZy4lDju.js.map +1 -0
  11. package/dist/testing.js +3 -3
  12. package/dist/types/core/src/appStatements.d.ts +7 -0
  13. package/dist/types/core/src/chatFiles.d.ts +4 -1
  14. package/dist/types/core/src/communityRendezvous.d.ts +5 -1
  15. package/dist/types/core/src/contactRecords.d.ts +31 -0
  16. package/dist/types/core/src/ghostlink.d.ts +38 -2
  17. package/dist/types/core/src/groupCommunity.d.ts +84 -9
  18. package/dist/types/core/src/groupFiles.d.ts +15 -0
  19. package/dist/types/core/src/groupMeta.d.ts +3 -2
  20. package/dist/types/core/src/groupSession.d.ts +96 -11
  21. package/dist/types/core/src/http.d.ts +13 -0
  22. package/dist/types/core/src/identityProofs.d.ts +7 -3
  23. package/dist/types/core/src/index.d.ts +1 -0
  24. package/dist/types/core/src/pairedAppRanges.d.ts +17 -9
  25. package/dist/types/core/src/pairedEdits.d.ts +4 -1
  26. package/dist/types/core/src/storeForward.d.ts +2 -1
  27. package/dist/types/core/src/text.d.ts +9 -0
  28. package/dist/types/core/src/turnRecord.d.ts +2 -2
  29. package/dist/types/core/src/videoMetadata.d.ts +33 -0
  30. package/dist/{verify-BC1Eu1lE.js → verify-Bcd7K4q-.js} +3 -3
  31. package/dist/verify-Bcd7K4q-.js.map +1 -0
  32. package/package.json +1 -1
  33. package/dist/src-DytzSJB6.js.map +0 -1
  34. package/dist/verify-BC1Eu1lE.js.map +0 -1
@@ -209,6 +209,45 @@ var KEEP = /[\u200c\u200d]/;
209
209
  function stripHidden(text) {
210
210
  return text.replace(HIDDEN, (char) => KEEP.test(char) ? char : "");
211
211
  }
212
+ /** The variation selectors other than VS15 and VS16: a symbol's, an ideograph's, a Mongolian letter's. */
213
+ var SELECTOR = /[︀-︍᠋-᠍᠏\u{e0100}-\u{e01ef}]/u;
214
+ /** Letters of the alphabets that neither join their letters nor make conjuncts: a joiner beside one changes nothing. */
215
+ var NO_JOINING = /[\p{sc=Latin}\p{sc=Greek}\p{sc=Cyrillic}\p{sc=Armenian}\p{sc=Georgian}\p{sc=Hebrew}\p{sc=Han}\p{sc=Hiragana}\p{sc=Katakana}\p{sc=Hangul}\p{sc=Thai}\p{sc=Lao}\p{sc=Ethiopic}]/u;
216
+ var EUROPEAN = /[\p{sc=Latin}\p{sc=Greek}\p{sc=Cyrillic}]/u;
217
+ var LETTER = /\p{L}/u;
218
+ var MARK = /\p{M}/u;
219
+ var SYMBOL = /\p{S}/u;
220
+ var PICTOGRAPH$1 = /\p{Extended_Pictographic}/u;
221
+ /** What an emoji sequence's joiner follows: a pictograph, a skin tone, or VS16 after a pictograph. */
222
+ var BEFORE_EMOJI_JOINER = /[\p{Extended_Pictographic}\p{Emoji_Modifier}️]/u;
223
+ var EMOJI = /\p{Emoji}/u;
224
+ var ASCII = /^[\0-\x7f]$/;
225
+ var KEYCAP_BASE = /^[#*0-9]$/;
226
+ var joining = (char) => LETTER.test(char) && !NO_JOINING.test(char);
227
+ /**
228
+ * `text` without the joiners and variation selectors that join or select nothing, which draw nothing and could only
229
+ * make a name look like another one, or one nobody can type. A zero-width joiner stays between two emoji (a skin tone
230
+ * or VS16 before it) and either joiner between two letters of a script that joins its letters or makes conjuncts
231
+ * (Persian, the Indic scripts; the marks after the first letter, a virama, don't count); VS15 and VS16 stay after an
232
+ * emoji (an ASCII one only in a keycap), and the other selectors after a symbol or a letter that is not Latin, Greek or
233
+ * Cyrillic.
234
+ */
235
+ function dropLoneJoiners(text) {
236
+ const chars = Array.from(text);
237
+ let out = "", last = "", base = "";
238
+ for (let i = 0; i < chars.length; i++) {
239
+ const char = chars[i], next = chars[i + 1] ?? "";
240
+ let keep = true;
241
+ if (char === "‍" || char === "‌") keep = char === "‍" && BEFORE_EMOJI_JOINER.test(last) && PICTOGRAPH$1.test(next) || joining(base) && joining(next);
242
+ else if (char === "︎" || char === "️") keep = EMOJI.test(last) && !ASCII.test(last) || KEYCAP_BASE.test(last) && next === "⃣";
243
+ else if (SELECTOR.test(char)) keep = SYMBOL.test(last) || LETTER.test(last) && !EUROPEAN.test(last);
244
+ if (!keep) continue;
245
+ out += char;
246
+ last = char;
247
+ if (!MARK.test(char)) base = char;
248
+ }
249
+ return out;
250
+ }
212
251
  /**
213
252
  * What draws nothing when it stands alone and `HIDDEN` leaves in, since text needs it beside something else: the
214
253
  * joiners, the fillers, the variation selectors and the other default-ignorable code points, combining marks, white
@@ -1379,7 +1418,14 @@ function normalizeRelayUrl(input) {
1379
1418
  function relayUrlProblem(input) {
1380
1419
  const line = input.trim();
1381
1420
  if (normalizeRelayUrl(line)) return null;
1382
- return /^(?:[a-z][a-z\d+.-]*:\/\/)?[^\s/:]+\.[^\s]+$/i.test(line) ? `Use an https:// relay address: ${line}` : `Not a relay address: ${line}`;
1421
+ return looksLikeHost(line) || looksLikeHost(line.replace(/^[a-z][a-z\d+.-]*:\/\//i, "")) ? `Use an https:// relay address: ${line}` : `Not a relay address: ${line}`;
1422
+ }
1423
+ /** No space, and a dot after the first character, before the last one and before any `/` or `:`; linear, for a long pasted line. */
1424
+ function looksLikeHost(text) {
1425
+ if (/\s/.test(text)) return false;
1426
+ const slash = text.search(/[/:]/);
1427
+ const dot = text.indexOf(".", 1);
1428
+ return dot > 0 && dot < text.length - 1 && (slash < 0 || dot < slash);
1383
1429
  }
1384
1430
  /** A relay the breaker leaves alone for failing (`RelayBreaker`): nothing was asked of it now. */
1385
1431
  var RelayLeftAloneError = class extends Error {};
@@ -2823,11 +2869,11 @@ var isZero = (bytes) => bytes.every((b) => b === 0);
2823
2869
  * A device's name as its slot holds it: UTF-8, cut at a character boundary to 16 bytes, and with no NUL (the padding).
2824
2870
  * A character is what a person sees as one (a grapheme), so a cut never leaves half an emoji or a lone joiner.
2825
2871
  * A name is display text a device chooses for itself and every device of the set shows: it is cleaned as a nickname is
2826
- * (`sanitizeDisplayText`: no control, invisible or direction-changing character, and empty when nothing of it shows)
2827
- * and trimmed, made and read alike.
2872
+ * (`sanitizeDisplayText`: no control, invisible or direction-changing character, and empty when nothing of it shows),
2873
+ * without a joiner or variation selector that joins nothing (`dropLoneJoiners`), and trimmed, made and read alike.
2828
2874
  */
2829
2875
  function turnName(name) {
2830
- const clean = stripHidden(name).trim();
2876
+ const clean = dropLoneJoiners(stripHidden(name)).trim();
2831
2877
  const Segmenter = typeof Intl === "undefined" ? void 0 : Intl.Segmenter;
2832
2878
  const characters = Segmenter ? Array.from(new Segmenter(void 0, { granularity: "grapheme" }).segment(clean), (s) => s.segment) : Array.from(clean);
2833
2879
  let out = "", length = 0;
@@ -2837,7 +2883,7 @@ function turnName(name) {
2837
2883
  out += character;
2838
2884
  length += size;
2839
2885
  }
2840
- return hasVisible(out) ? out.trimEnd() : "";
2886
+ return hasVisible(out) ? dropLoneJoiners(out).trimEnd() : "";
2841
2887
  }
2842
2888
  function u32$4(value) {
2843
2889
  return Uint8Array.of(value >>> 24 & 255, value >>> 16 & 255, value >>> 8 & 255, value & 255);
@@ -4146,17 +4192,17 @@ function parseImageMeta(value, mime) {
4146
4192
  height
4147
4193
  } : void 0;
4148
4194
  }
4149
- var u16be = (b, at) => b[at] << 8 | b[at + 1];
4195
+ var u16be$1 = (b, at) => b[at] << 8 | b[at + 1];
4150
4196
  var u16le = (b, at) => b[at] | b[at + 1] << 8;
4151
4197
  var u24le = (b, at) => b[at] | b[at + 1] << 8 | b[at + 2] << 16;
4152
- var u32be = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
4198
+ var u32be$2 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
4153
4199
  var ascii = (b, at, text) => [...text].every((c, i) => b[at + i] === c.charCodeAt(0));
4154
4200
  var sized = (width, height) => edge(width) && edge(height) ? {
4155
4201
  width,
4156
4202
  height
4157
4203
  } : void 0;
4158
4204
  /** SOFn markers: every frame type but DHT (C4), JPG (C8) and DAC (CC). */
4159
- var JPEG_FRAME = /* @__PURE__ */ new Set([
4205
+ var JPEG_FRAME$1 = /* @__PURE__ */ new Set([
4160
4206
  192,
4161
4207
  193,
4162
4208
  194,
@@ -4176,8 +4222,8 @@ function exifOrientation(b, tiff, end) {
4176
4222
  if (tiff + 8 > end) return 1;
4177
4223
  const little = ascii(b, tiff, "II");
4178
4224
  if (!little && !ascii(b, tiff, "MM")) return 1;
4179
- const u16 = (at) => little ? u16le(b, at) : u16be(b, at);
4180
- const u32 = (at) => little ? u16le(b, at) + u16le(b, at + 2) * 65536 : u32be(b, at);
4225
+ const u16 = (at) => little ? u16le(b, at) : u16be$1(b, at);
4226
+ const u32 = (at) => little ? u16le(b, at) + u16le(b, at + 2) * 65536 : u32be$2(b, at);
4181
4227
  if (u16(tiff + 2) !== 42) return 1;
4182
4228
  const ifd = tiff + u32(tiff + 4);
4183
4229
  if (ifd + 2 > end) return 1;
@@ -4206,13 +4252,13 @@ function jpegSize(b) {
4206
4252
  continue;
4207
4253
  }
4208
4254
  if (marker === 217 || marker === 218) return void 0;
4209
- const length = u16be(b, at + 2);
4255
+ const length = u16be$1(b, at + 2);
4210
4256
  if (length < 2) return void 0;
4211
4257
  const end = Math.min(b.length, at + 2 + length);
4212
4258
  if (marker === 225 && ascii(b, at + 4, "Exif\0\0")) orientation = exifOrientation(b, at + 10, end);
4213
- if (JPEG_FRAME.has(marker)) {
4259
+ if (JPEG_FRAME$1.has(marker)) {
4214
4260
  if (at + 9 > b.length) return void 0;
4215
- const height = u16be(b, at + 5), width = u16be(b, at + 7);
4261
+ const height = u16be$1(b, at + 5), width = u16be$1(b, at + 7);
4216
4262
  return orientation >= 5 ? sized(height, width) : sized(width, height);
4217
4263
  }
4218
4264
  at += 2 + length;
@@ -4262,7 +4308,7 @@ function gifSize(b) {
4262
4308
  function imageSize(head) {
4263
4309
  const b = head;
4264
4310
  try {
4265
- 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));
4311
+ 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));
4266
4312
  if (b.length >= 10 && (ascii(b, 0, "GIF87a") || ascii(b, 0, "GIF89a"))) return gifSize(b);
4267
4313
  if (b.length >= 4 && b[0] === 255 && b[1] === 216 && b[2] === 255) return jpegSize(b);
4268
4314
  if (b.length >= 16 && ascii(b, 0, "RIFF") && ascii(b, 8, "WEBP")) return webpSize(b);
@@ -4493,7 +4539,17 @@ function verifyAppStatementBytes(prefix, bytes, signature, key) {
4493
4539
  } : checked;
4494
4540
  }
4495
4541
  var isSequence = (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 1;
4496
- var isPlainLine = (v, max) => typeof v === "string" && [...v].length <= max && !/\p{Cc}/u.test(v);
4542
+ /**
4543
+ * One line of an app's text, from `min` to `max` code points: a title, a tagline, a store's name, a removal's or a
4544
+ * revocation's reason. It is shown alone (a heading, a window title), so it holds no control character and none of
4545
+ * what `stripHidden` takes from a nickname (invisible and direction-changing characters, line and paragraph
4546
+ * separators), and when it is not empty it shows something (`hasVisible`). The joiners an emoji or a script needs stay.
4547
+ */
4548
+ var isAppLine = (v, max, min = 0) => {
4549
+ if (typeof v !== "string") return false;
4550
+ const length = [...v].length;
4551
+ return length >= min && length <= max && stripHidden(v) === v && (v === "" || hasVisible(v));
4552
+ };
4497
4553
  /** Checks a revocation statement's shape; the reason it is refused, or null. */
4498
4554
  function checkAppRevokeStatement(value) {
4499
4555
  if (typeof value !== "object" || value === null || Array.isArray(value)) return "Not an object";
@@ -4511,7 +4567,7 @@ function checkAppRevokeStatement(value) {
4511
4567
  if (!Array.isArray(d) || d.length < 1 || d.length > APP_STATEMENT_LIMITS.revokeDigests) return "digests is not 1 to 64 digests";
4512
4568
  if (!d.every(isAppHash) || new Set(d).size !== d.length) return "digests holds a bad or repeated digest";
4513
4569
  } else if (!isSequence(v.upTo)) return "upTo is not a sequence";
4514
- if (v.reason !== void 0 && !isPlainLine(v.reason, APP_STATEMENT_LIMITS.reason)) return "reason is not one line of 200 characters";
4570
+ if (v.reason !== void 0 && !isAppLine(v.reason, APP_STATEMENT_LIMITS.reason)) return "reason is not one line of 200 characters";
4515
4571
  return null;
4516
4572
  }
4517
4573
  /** Signs a revocation with the publisher's key. */
@@ -4716,8 +4772,6 @@ var SEMVER$1 = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[
4716
4772
  var HOST = /^>=(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?$/;
4717
4773
  var SEGMENT$1 = /^[A-Za-z0-9._-]+$/;
4718
4774
  var codePoints = (s) => [...s].length;
4719
- /** One line: no control character. */
4720
- var isLine$1 = (v, max, min = 0) => typeof v === "string" && codePoints(v) >= min && codePoints(v) <= max && !/\p{Cc}/u.test(v);
4721
4775
  /** Text of several lines: no control character but the line feed. */
4722
4776
  var isText$3 = (v, max) => typeof v === "string" && codePoints(v) <= max && !/[^\P{Cc}\n]/u.test(v);
4723
4777
  var isSafeCount = (v, min) => typeof v === "number" && Number.isSafeInteger(v) && v >= min;
@@ -4835,10 +4889,10 @@ function checkAppManifest(value, options = {}) {
4835
4889
  if (typeof m.version !== "string" || m.version.length > APP_BUNDLE_LIMITS.version || !SEMVER$1.test(m.version)) return bad("version");
4836
4890
  if (!isSafeCount(m.sequence, 1)) return bad("sequence");
4837
4891
  if (m.kind !== "mini-app") return bad("kind");
4838
- if (!isLine$1(m.title, APP_BUNDLE_LIMITS.title, 1)) return bad("title");
4839
- if (!isLine$1(m.tagline, APP_BUNDLE_LIMITS.tagline, 1)) return bad("tagline");
4892
+ if (!isAppLine(m.title, APP_BUNDLE_LIMITS.title, 1)) return bad("title");
4893
+ if (!isAppLine(m.tagline, APP_BUNDLE_LIMITS.tagline, 1)) return bad("tagline");
4840
4894
  if (m.description !== void 0 && !isText$3(m.description, APP_BUNDLE_LIMITS.description)) return bad("description");
4841
- if (m.releaseNotes !== void 0 && !isLine$1(m.releaseNotes, APP_BUNDLE_LIMITS.releaseNotes)) return bad("releaseNotes");
4895
+ if (m.releaseNotes !== void 0 && !isAppLine(m.releaseNotes, APP_BUNDLE_LIMITS.releaseNotes)) return bad("releaseNotes");
4842
4896
  const permissions = m.permissions;
4843
4897
  if (!Array.isArray(permissions) || new Set(permissions).size !== permissions.length || !permissions.every((p) => APP_PERMISSIONS.includes(p))) return bad("permissions");
4844
4898
  if (m.view !== void 0 && !APP_VIEWS.includes(m.view)) return bad("view", `view is "chat" or "full"`);
@@ -5443,6 +5497,42 @@ function openRequest(linkSeedB64, askerZ32, records, now) {
5443
5497
  return null;
5444
5498
  }
5445
5499
  }
5500
+ /**
5501
+ * The asker's proof (WISP 8xx § Accept): in the chat a request started, the requester's app says on the live session
5502
+ * that it holds the asker key the request came under. The invite a request carries is a bearer code, so whoever made
5503
+ * the chat the owner joined may be someone other than the asker; until this proof comes, the request's text shows as
5504
+ * not confirmed. Signed by *K* over the link key, *K*, and both sides' participation keys in that chat: the joiner's is
5505
+ * new with the join, so a proof is made in the chat and for it, never before.
5506
+ */
5507
+ var CONTACT_ASKER_FRAME = "contact-asker";
5508
+ function askerProofBytes(linkKeyZ32, askerZ32, chat) {
5509
+ return concatBytes(label$1("ghostly-contact/1 asker"), publicKeyFromZ32(linkKeyZ32), publicKeyFromZ32(askerZ32), publicKeyFromZ32(chat.inviter), publicKeyFromZ32(chat.joiner));
5510
+ }
5511
+ /** The requester's proof for the chat its request started. */
5512
+ function contactAskerFrame(askerSeedB64, linkKeyZ32, chat) {
5513
+ const asker = identityFromSeedB64(askerSeedB64);
5514
+ return {
5515
+ t: CONTACT_ASKER_FRAME,
5516
+ l: linkKeyZ32,
5517
+ k: asker.pubKeyZ32,
5518
+ s: toBase64Url(ed25519.sign(askerProofBytes(linkKeyZ32, asker.pubKeyZ32, chat), asker.seed))
5519
+ };
5520
+ }
5521
+ /**
5522
+ * Whether a proof heard in a chat is the one the owner waits for there: the link and asker keys of the request it
5523
+ * accepted, signed by that asker key for this chat's two participation keys. Anything else proves nothing.
5524
+ */
5525
+ function contactAskerHolds(frame, expected, chat) {
5526
+ const f = frame;
5527
+ if (!f || typeof f !== "object" || f.t !== "contact-asker" || f.l !== expected.link || f.k !== expected.key) return false;
5528
+ if (typeof f.s !== "string" || !/^[A-Za-z0-9_-]{86}$/.test(f.s)) return false;
5529
+ if (![chat.inviter, chat.joiner].every((key) => Z32_KEY$1.test(key))) return false;
5530
+ try {
5531
+ return ed25519.verify(fromBase64Url(f.s), askerProofBytes(f.l, f.k, chat), publicKeyFromZ32(f.k));
5532
+ } catch {
5533
+ return false;
5534
+ }
5535
+ }
5446
5536
  //#endregion
5447
5537
  //#region ../core/src/contactInbox.ts
5448
5538
  var MAX_WAITING = 32;
@@ -6516,7 +6606,7 @@ function isViewerTag(tag) {
6516
6606
  }
6517
6607
  function serviceIdFromName(name, taken = []) {
6518
6608
  const used = new Set(taken);
6519
- const base = name.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 24) || "service";
6609
+ const base = name.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 24) || "service";
6520
6610
  let id = base;
6521
6611
  for (let n = 2; used.has(id) || LEGACY_SERVICES.some((s) => s.id === id); n++) id = `${base}-${n}`;
6522
6612
  return id;
@@ -7985,6 +8075,26 @@ function viewerResponseHeaders(headers) {
7985
8075
  return out;
7986
8076
  }
7987
8077
  /**
8078
+ * Ghostly's connection policy for a contact's app in a viewer: its requests and forms reach only its own origin, the
8079
+ * contact's service; its scripts, pictures, frames and the rest its own origin and public https sites (and inline,
8080
+ * data: and blob: content), never plain http, so not a service on this machine or the local network. The same value as
8081
+ * Desktop's `SERVICE_CSP` (apps/desktop/src/viewer.rs) and `OPENED_SERVICE_CSP` (`service open`,
8082
+ * packages/cli/src/services.ts).
8083
+ */
8084
+ var VIEWER_SERVICE_CSP = "default-src 'self' https: data: blob: 'unsafe-inline' 'unsafe-eval'; connect-src 'self'; form-action 'self'";
8085
+ /**
8086
+ * `headers` with Ghostly's policy after the contact's own, all in one `content-security-policy` joined by commas: a
8087
+ * browser enforces every policy of the list, so the contact's can narrow Ghostly's but never widen it.
8088
+ */
8089
+ function withViewerPolicy(headers) {
8090
+ const policies = [];
8091
+ const out = [];
8092
+ for (const [name, value] of headers) if (name.toLowerCase() === "content-security-policy") policies.push(value);
8093
+ else out.push([name, value]);
8094
+ out.push(["content-security-policy", [...policies, VIEWER_SERVICE_CSP].join(", ")]);
8095
+ return out;
8096
+ }
8097
+ /**
7988
8098
  * Turns `http://localhost:3400/base/x` into `/x` so the client never learns or
7989
8099
  * follows the local address. Null when the location is not on the target origin
7990
8100
  * and under its base path.
@@ -9950,7 +10060,7 @@ function messageKeys(mk) {
9950
10060
  function aad(lane, sender, recipient, header) {
9951
10061
  return concatBytes(utf8Encode("ghostly-ratchet/1"), new Uint8Array([LANE[lane]]), publicKeyFromZ32(sender), publicKeyFromZ32(recipient), header);
9952
10062
  }
9953
- function header$1(lane, session, n) {
10063
+ function header$2(lane, session, n) {
9954
10064
  return concatBytes(new Uint8Array([VERSION$1, LANE[lane]]), unb64(session.sid), unb64(session.dhsPub), u32$2(session.pnHold), u32$2(n));
9955
10065
  }
9956
10066
  function parseHeader(sealed) {
@@ -9995,7 +10105,7 @@ function ratchetSeal(prev, keys, lane, plaintext, options = {}) {
9995
10105
  }
9996
10106
  const session = state.current ??= newSession(context(keys), random(SID_BYTES), random, now);
9997
10107
  const [mk, next] = advance(session.send[lane]);
9998
- const head = header$1(lane, session, session.send[lane].n);
10108
+ const head = header$2(lane, session, session.send[lane].n);
9999
10109
  session.send[lane] = next;
10000
10110
  session.at = now;
10001
10111
  const { key, nonce } = messageKeys(mk);
@@ -11872,7 +11982,10 @@ function parseEditedFrame(frame) {
11872
11982
  function dhtEditId(id, e) {
11873
11983
  return toBase64Url(sha256(utf8Encode(`ghostly-edit/1:${id}:${e}`)).slice(0, 16));
11874
11984
  }
11875
- /** A sliding window of `limit` events per `windowMs`: the sender's pace and the receiver's limit. */
11985
+ /**
11986
+ * A sliding window of `limit` events per `windowMs`: the sender's pace and the receiver's limit. A time later than now
11987
+ * (the device clock went back) is long gone, or the window would stay full for as long as the clock went back.
11988
+ */
11876
11989
  var RateWindow = class {
11877
11990
  limit;
11878
11991
  windowMs;
@@ -11886,7 +11999,7 @@ var RateWindow = class {
11886
11999
  /** Counts one now; false (and not counted) when the window is full. */
11887
12000
  take() {
11888
12001
  const now = this.now();
11889
- this.recent = this.recent.filter((at) => now - at < this.windowMs);
12002
+ this.recent = this.recent.filter((at) => at <= now && now - at < this.windowMs);
11890
12003
  if (this.recent.length >= this.limit) return false;
11891
12004
  this.recent.push(now);
11892
12005
  return true;
@@ -11894,7 +12007,7 @@ var RateWindow = class {
11894
12007
  /** Milliseconds until the window has room again; 0 when it has room now. */
11895
12008
  wait() {
11896
12009
  const now = this.now();
11897
- this.recent = this.recent.filter((at) => now - at < this.windowMs);
12010
+ this.recent = this.recent.filter((at) => at <= now && now - at < this.windowMs);
11898
12011
  return this.recent.length < this.limit ? 0 : this.recent[0] + this.windowMs - now;
11899
12012
  }
11900
12013
  reset() {
@@ -14571,7 +14684,7 @@ var decOrEmpty = (s) => {
14571
14684
  }
14572
14685
  };
14573
14686
  var hash = (s) => enc(sha256(utf8Encode(s)));
14574
- var header = enc(utf8Encode(JSON.stringify({
14687
+ var header$1 = enc(utf8Encode(JSON.stringify({
14575
14688
  alg: "EdDSA",
14576
14689
  typ: "ghostly-pubky-identity-delegation/1"
14577
14690
  })));
@@ -14587,13 +14700,13 @@ function ringClaims(statement, issuer, delegate, issuedAt, expiresAt) {
14587
14700
  }
14588
14701
  function ringAuthorization(claims, seed) {
14589
14702
  if (toZ32(ed25519.getPublicKey(seed)) !== claims.iss) throw new Error("Ring identity mismatch");
14590
- const input = header + "." + enc(utf8Encode(JSON.stringify(claims)));
14703
+ const input = header$1 + "." + enc(utf8Encode(JSON.stringify(claims)));
14591
14704
  return input + "." + enc(ed25519.sign(utf8Encode(input), seed));
14592
14705
  }
14593
14706
  function verifyRingAuthorization(authorization, statement, issuer, issuedAt, expiresAt) {
14594
14707
  if (typeof authorization !== "string" || authorization.length > 2400) throw new Error("Invalid Ring authorization");
14595
14708
  const [h, p, s, ...extra] = authorization.split(".");
14596
- if (extra.length || h !== header || !p || !s) throw new Error("Unsupported Ring authorization");
14709
+ if (extra.length || h !== header$1 || !p || !s) throw new Error("Unsupported Ring authorization");
14597
14710
  let claims;
14598
14711
  try {
14599
14712
  claims = JSON.parse(utf8Decode(dec(p)));
@@ -14771,7 +14884,7 @@ async function verifyPeerProof(event, c, readStorage) {
14771
14884
  if (sig.length !== 64 || !verify(sig, data, fromZ32(c.externalKey))) throw new Error("Invalid Pubky signature");
14772
14885
  } else if (c.adapter === "keet-import") {
14773
14886
  if (sig.length !== 107 || sig[0] !== 1 || sig[41] !== 0 || sig[42] !== 1) throw new Error("Unsupported Keet attestation");
14774
- const { default: IdentityKey } = await import("./keet-identity-key-uq3scTiE.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
14887
+ const { default: IdentityKey } = await import("./keet-identity-key-a4pR0QSm.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
14775
14888
  if (!IdentityKey.verify(b4a.from(sig), b4a.from(data), { expectedIdentity: b4a.from(unhex(c.externalKey)) })) throw new Error("Invalid Keet attestation");
14776
14889
  } else throw new Error("Unsupported proof adapter");
14777
14890
  }
@@ -15422,16 +15535,19 @@ var IdentityExchange = class {
15422
15535
  subject: s.subject,
15423
15536
  reason: "withdrawn"
15424
15537
  });
15425
- if (connected) this.send({
15426
- t: "idp-withdraw",
15427
- id
15428
- });
15538
+ if (connected) try {
15539
+ this.send({
15540
+ t: "idp-withdraw",
15541
+ id
15542
+ });
15543
+ } catch {}
15429
15544
  }
15430
15545
  /**
15431
15546
  * Run the checks again on a received proof: its revocation record, then (unless `revocationOnly`) the
15432
- * provider's check (a domain record may be gone).
15547
+ * provider's check (a domain record may be gone). `keepUnavailable`: a check that could not run (IdentityCheckUnavailable)
15548
+ * is thrown, and the proof is left as it was, for a check this side started on its own.
15433
15549
  */
15434
- async recheck(id, { revocationOnly = false } = {}) {
15550
+ async recheck(id, { revocationOnly = false, keepUnavailable = false } = {}) {
15435
15551
  const r = this.options.storage.read().received.find((x) => x.id === id);
15436
15552
  if (!r) throw new Error("Unknown identity");
15437
15553
  if (r.status === "revoked") return r;
@@ -15464,6 +15580,7 @@ var IdentityExchange = class {
15464
15580
  error: void 0
15465
15581
  });
15466
15582
  } catch (e) {
15583
+ if (keepUnavailable && e instanceof IdentityCheckUnavailable) throw e;
15467
15584
  const error = shortError(e);
15468
15585
  outcome = (x) => ({
15469
15586
  ...x,
@@ -15505,19 +15622,29 @@ var IdentityExchange = class {
15505
15622
  case "idp-result": {
15506
15623
  const s = id ? this.shared(id) : void 0;
15507
15624
  if (!s || s.status !== "pending") return;
15508
- const error = frame.ok === true ? void 0 : clean$1(frame.error, ERROR_MAX) ?? "Your contact could not verify it";
15509
- await this.setShared({
15625
+ const ok = frame.ok === true;
15626
+ const error = ok ? void 0 : clean$1(frame.error, ERROR_MAX) ?? "Your contact could not verify it";
15627
+ const entry = {
15510
15628
  ...s,
15511
- status: frame.ok === true ? "accepted" : "rejected",
15629
+ status: ok ? "accepted" : "rejected",
15512
15630
  at: this.now(),
15513
15631
  error
15632
+ };
15633
+ const replaced = (x) => ok && x.status === "accepted" && x.provider === s.provider && x.subject === s.subject;
15634
+ await this.options.storage.update((l) => this.log({
15635
+ ...l,
15636
+ shared: [...l.shared.filter((x) => x.id !== s.id).map((x) => replaced(x) ? {
15637
+ ...x,
15638
+ status: "withdrawn",
15639
+ at: entry.at
15640
+ } : x), entry]
15514
15641
  }, {
15515
15642
  type: "result",
15516
15643
  side: "mine",
15517
15644
  proof: s.id,
15518
- ok: frame.ok === true,
15645
+ ok,
15519
15646
  error
15520
- });
15647
+ }));
15521
15648
  return;
15522
15649
  }
15523
15650
  case "idp-withdraw": {
@@ -15537,6 +15664,13 @@ var IdentityExchange = class {
15537
15664
  subject: r.verified.subject,
15538
15665
  reason: "withdrawn"
15539
15666
  }));
15667
+ if (this.options.storage.read().challenges.some((c) => c.id === id && !c.withdrawn)) await this.options.storage.update((l) => ({
15668
+ ...l,
15669
+ challenges: l.challenges.map((c) => c.id === id ? {
15670
+ ...c,
15671
+ withdrawn: true
15672
+ } : c)
15673
+ }));
15540
15674
  this.send({
15541
15675
  t: "idp-withdrawn",
15542
15676
  id
@@ -15649,6 +15783,7 @@ var IdentityExchange = class {
15649
15783
  let error;
15650
15784
  /** The same, as this side's own timeline says it. */
15651
15785
  let reason;
15786
+ let withdrawn = false;
15652
15787
  try {
15653
15788
  const mayReplace = (r) => r.binding.provider === binding.provider && (r.binding.subject === binding.subject || r.verified.subject === binding.subject);
15654
15789
  if (revokedHere(this.options.storage.read().received, id)) throw new Error(REVOKED);
@@ -15692,6 +15827,7 @@ var IdentityExchange = class {
15692
15827
  ...logged,
15693
15828
  challenges
15694
15829
  };
15830
+ withdrawn = !!challenge.withdrawn;
15695
15831
  const record = {
15696
15832
  id,
15697
15833
  binding,
@@ -15702,15 +15838,23 @@ var IdentityExchange = class {
15702
15838
  context: scope.context,
15703
15839
  verifiedAt: now,
15704
15840
  checkedAt: now,
15705
- status: "verified"
15841
+ status: withdrawn ? "withdrawn" : "verified"
15706
15842
  };
15707
- return {
15843
+ const kept = {
15708
15844
  ...logged,
15709
15845
  challenges,
15710
15846
  received: [...received, record]
15711
15847
  };
15848
+ return withdrawn ? this.log(kept, {
15849
+ type: "stopped",
15850
+ side: "theirs",
15851
+ proof: id,
15852
+ provider: binding.provider,
15853
+ subject: verified.subject,
15854
+ reason: "withdrawn"
15855
+ }) : kept;
15712
15856
  });
15713
- this.send(verified ? {
15857
+ if (!withdrawn) this.send(verified ? {
15714
15858
  t: "idp-result",
15715
15859
  id,
15716
15860
  ok: true
@@ -16929,7 +17073,8 @@ var LOCAL_SUFFIXES = [
16929
17073
  * A URL a bundle or manifest may be fetched from. The contact chose it and this device fetches it on its own, so it
16930
17074
  * is HTTPS, without a user or password, at a public name or a public IPv4 address: never this machine or its network.
16931
17075
  * A name with no dot or under a local suffix is a local one. A public name may still resolve to a local address:
16932
- * where the host can resolve, its `fetch` refuses that too (the CLI's, packages/cli/src/runtime/holdFetch.ts).
17076
+ * where the host can resolve, its `fetch` refuses that too (the CLI's, packages/cli/src/runtime/holdFetch.ts, and
17077
+ * Desktop's, apps/desktop/src/hold_fetch.rs).
16933
17078
  * `loopback` adds plain HTTP to this machine, for a test against a local server; no shipped app passes it.
16934
17079
  */
16935
17080
  function isHoldUrl(value, loopback = false) {
@@ -18098,7 +18243,7 @@ var slot = (app, request) => `${app}:${request}`;
18098
18243
  * are read and sent by the session, which calls `finish` or `fail` for each task. As the side that asks it sends at
18099
18244
  * most `inFlight` requests per app, keeps
18100
18245
  * the rest waiting, and puts each answer back together, in order, from the offset asked. Serves and requests last one
18101
- * session: `reset` ends them all, `closeApp` those of one app.
18246
+ * session: `reset` ends them all, `closeApp` those of one app; a task still being read counts until it is settled.
18102
18247
  */
18103
18248
  var AppRanges = class {
18104
18249
  send;
@@ -18106,7 +18251,10 @@ var AppRanges = class {
18106
18251
  now;
18107
18252
  serves = /* @__PURE__ */ new Map();
18108
18253
  serving = /* @__PURE__ */ new Map();
18109
- /** Tasks cancelled or unserved that the session is still reading or sending: each counts in its app's `inFlight` until settled. */
18254
+ /**
18255
+ * Tasks cancelled, unserved, or stopped by the contact's close or a session's end, that this side is still reading or
18256
+ * sending: each counts in its app's `inFlight` until settled, across sessions.
18257
+ */
18110
18258
  draining = /* @__PURE__ */ new Set();
18111
18259
  asking = /* @__PURE__ */ new Map();
18112
18260
  waiting = /* @__PURE__ */ new Map();
@@ -18217,8 +18365,8 @@ var AppRanges = class {
18217
18365
  this.take(task);
18218
18366
  }
18219
18367
  /**
18220
- * Whether `task` is still this session's: serving, or cancelled and draining until it is settled. False once it was
18221
- * settled, or its app closed or the session ended, which free its place: an answer to it sends and frees nothing.
18368
+ * Whether `task` still holds a place: serving, or no longer live and draining until it is settled. False once it was
18369
+ * settled, or this side's app closed, which frees its place: an answer to it sends and frees nothing.
18222
18370
  */
18223
18371
  holds(task) {
18224
18372
  return this.draining.has(task) || this.serving.get(slot(task.app, task.request)) === task;
@@ -18274,17 +18422,24 @@ var AppRanges = class {
18274
18422
  size: frame.z
18275
18423
  });
18276
18424
  }
18277
- /** `app` closed on either side: its serves end, what it was sending stops and what it asked fails with `error`. */
18278
- closeApp(app, error = "peer-closed") {
18425
+ /**
18426
+ * `app` closed on either side: its serves end, what it was sending stops and what it asked fails with `error`. A task
18427
+ * this side is still reading keeps its place until it is settled, as a cancelled one does, so a contact that closes
18428
+ * and opens its app again meets `busy`; only `stopped` (this side's app closed: nothing reads for it any more) frees
18429
+ * them now.
18430
+ */
18431
+ closeApp(app, error = "peer-closed", stopped = false) {
18279
18432
  for (const [id, serve] of this.serves) if (serve.app === app) this.serves.delete(id);
18280
- for (const task of this.serving.values()) if (task.app === app) this.drop(task);
18281
- for (const task of this.draining) if (task.app === app) this.draining.delete(task);
18433
+ for (const task of this.serving.values()) if (task.app === app) this.drop(task, !stopped);
18434
+ if (stopped) {
18435
+ for (const task of this.draining) if (task.app === app) this.draining.delete(task);
18436
+ }
18282
18437
  for (const ask of this.waiting.get(app) ?? []) ask.reject(new Error(error));
18283
18438
  this.waiting.delete(app);
18284
18439
  for (const ask of this.asking.values()) if (ask.app === app) this.settle(ask, error);
18285
18440
  for (const key of [...this.sizes.keys()]) if (key.startsWith(`${app} `)) this.sizes.delete(key);
18286
18441
  }
18287
- /** The session ended: no serve id lasts into the next, and every request fails with `offline`. */
18442
+ /** The session ended: no serve id lasts into the next, and every request fails with `offline`. Tasks still being read keep their places into the next. */
18288
18443
  reset() {
18289
18444
  this.sizes.clear();
18290
18445
  const apps = new Set([...this.serves.values()].map((serve) => serve.app).concat([...this.serving.values(), ...this.draining].map((task) => task.app), [...this.waiting.keys()], [...this.asking.values()].map((ask) => ask.app)));
@@ -19645,7 +19800,7 @@ var ChatFiles = class {
19645
19800
  out.next = record.confirmed;
19646
19801
  const paused = record.state === "paused" && record.pausedBy === "me";
19647
19802
  if (!this.send(this.offerFrame(record, paused))) return;
19648
- if (!paused && record.state !== "offered") {
19803
+ if (!paused && record.state !== "offered" && record.state !== "verifying") {
19649
19804
  record.state = "offered";
19650
19805
  record.pausedBy = void 0;
19651
19806
  this.changed(entry);
@@ -19881,9 +20036,16 @@ var ChatFiles = class {
19881
20036
  this.startNext();
19882
20037
  });
19883
20038
  }
19884
- /** The next file waiting its turn, once one ends. */
20039
+ /**
20040
+ * The next file waiting its turn, once one ends. The others were told they wait when they were queued: told again at
20041
+ * each end, n files at once made about n²/2 frames, and their sender stored its record for each.
20042
+ */
19885
20043
  startNext() {
19886
- for (const entry of this.entries.values()) if (entry.record.direction === "in" && entry.record.state === "queued") this.startIncoming(entry);
20044
+ for (const entry of this.entries.values()) {
20045
+ if (entry.record.direction !== "in" || entry.record.state !== "queued" || entry.in.starting) continue;
20046
+ if (this.activeIncoming(entry) >= FILE_LIMITS.maxActiveIncoming) return;
20047
+ this.startIncoming(entry);
20048
+ }
19887
20049
  }
19888
20050
  async onOffer(frame) {
19889
20051
  const id = frame.id;
@@ -20361,6 +20523,7 @@ var ChatFiles = class {
20361
20523
  return;
20362
20524
  case "pf-wait":
20363
20525
  if (record.state === "paused" && record.pausedBy === "me") return;
20526
+ if (frame.why === "paused" ? record.state === "paused" && record.pausedBy === "peer" : record.state === "asking" && record.waitingFor === (frame.why === "busy" ? "busy" : "consent")) return;
20364
20527
  out.generation++;
20365
20528
  out.next = record.confirmed;
20366
20529
  clearTimeout(out.timer);
@@ -20461,6 +20624,7 @@ var ChatFiles = class {
20461
20624
  const entry = this.entry(direction, id), { record } = entry;
20462
20625
  if (transferEnded(record) || record.state === "verifying" || record.state === "paused" && record.pausedBy === "me") return;
20463
20626
  if (direction === "in" && record.state === "asking") return;
20627
+ if (sentWhole(record)) return;
20464
20628
  record.state = "paused";
20465
20629
  record.pausedBy = "me";
20466
20630
  if (entry.out) {
@@ -20938,10 +21102,16 @@ function readLobby(keys, records) {
20938
21102
  /**
20939
21103
  * The beacon to publish: my entry (or none, `mine` null, when I step down) with the other fresh
20940
21104
  * hubs, newest first, at most `maxHubs`. A hub not in the roster any more is dropped.
21105
+ *
21106
+ * Anyone holding the rendezvous secret writes this record, so what is in it does not decide what stays: my entry always
21107
+ * does, then the keys I know as members (`known`) before keys I do not, and an entry dated ahead of now ranks as one of
21108
+ * now. Entries stay as their hubs dated them.
20941
21109
  */
20942
- function mergeBeacon(existing, me, mine, now = Date.now(), isMember = () => true) {
21110
+ function mergeBeacon(existing, me, mine, now = Date.now(), isMember = () => true, known = () => true) {
20943
21111
  const fresh = existing.filter((h) => h.key !== me && now - h.ts < COMMUNITY_TOPOLOGY.beaconFreshMs && h.ts <= now + 6e4 && isMember(h.key));
20944
- return (mine ? [mine, ...fresh] : fresh).sort((a, b) => b.ts - a.ts).slice(0, COMMUNITY_TOPOLOGY.maxHubs);
21112
+ const rank = (h) => known(h.key) ? 0 : 1;
21113
+ const others = fresh.sort((a, b) => rank(a) - rank(b) || Math.min(b.ts, now) - Math.min(a.ts, now));
21114
+ return (mine ? [mine, ...others] : others).slice(0, COMMUNITY_TOPOLOGY.maxHubs);
20945
21115
  }
20946
21116
  /** The lobby to publish: my request refreshed, others' still fresh, newest last. */
20947
21117
  function mergeLobby(existing, mine, now = Date.now()) {
@@ -21442,6 +21612,13 @@ var GROUP_FILE_LIMITS = {
21442
21612
  serveMoveBytes: 16384,
21443
21613
  /** How long a served transfer keeps its place while all are taken and another member asks: past it, the place is theirs. */
21444
21614
  servePlaceMs: 3e5,
21615
+ /**
21616
+ * A served transfer's pace is what it confirmed in the last `servePaceMs` (at most twice that), counted from its offer.
21617
+ * While all places are taken and a member holding none asks or waits, the slowest served that long gives it its place,
21618
+ * if at its pace more is left to go than it has been served and than `servePaceMs`: members on fast links do not wait
21619
+ * for slow ones that asked first. Each member's transfer of a file loses its place so once per holder.
21620
+ */
21621
+ servePaceMs: 1e4,
21445
21622
  /** File announcements a member sends to one group in a minute. */
21446
21623
  announcePerMinute: 8,
21447
21624
  /** File announcements of one member of a group fetched by themselves in `announceWindowMs`; past it, kept for a Download. */
@@ -21469,6 +21646,14 @@ var GROUP_FILE_LIMITS = {
21469
21646
  haveFramesTaken: 20,
21470
21647
  communityHaveEveryMs: 6e4,
21471
21648
  /**
21649
+ * `group-want` frames an edge sends in `wantWindowMs`, and takes from its member, the rest dropped before anything is
21650
+ * looked up: twice what it may send, as for `group-have`. A member back from away in a group of 16 asked one member
21651
+ * for at most 47 in 10 seconds, its files coming as fast as the network lets them.
21652
+ */
21653
+ wantFrames: 50,
21654
+ wantFramesTaken: 100,
21655
+ wantWindowMs: 1e4,
21656
+ /**
21472
21657
  * How long a want waits for an offer before the next holder is asked; a transfer that does not move for as long is
21473
21658
  * left for the next holder too.
21474
21659
  */
@@ -22075,7 +22260,8 @@ var QUIET_FRAMES = /* @__PURE__ */ new Set([
22075
22260
  "paired-groups",
22076
22261
  "paired-services",
22077
22262
  "paired-reconnect",
22078
- "paired-reconnect-ack"
22263
+ "paired-reconnect-ack",
22264
+ CONTACT_ASKER_FRAME
22079
22265
  ]);
22080
22266
  /**
22081
22267
  * A ping with nothing at all back this long after it went: the contact may have crashed and started again, with its new
@@ -22341,6 +22527,8 @@ var GhostLink = class {
22341
22527
  /** Edit frames the contact may send per window; the rest go unconfirmed and come again. */
22342
22528
  editsReceived = new RateWindow(30, EDIT_RATE_WINDOW_MS);
22343
22529
  wakeReceived = new RateWindow(6, 6e4);
22530
+ /** Said once a session by the requester's app: a few a minute at most. */
22531
+ askerReceived = new RateWindow(4, 6e4);
22344
22532
  /**
22345
22533
  * The contact's name and picture, its word on held items, its ways of paying and its transport descriptors, each saved
22346
22534
  * on this side when it changes: said once a session and when changed, so a handful a minute each. Past that only the
@@ -23300,6 +23488,14 @@ var GhostLink = class {
23300
23488
  });
23301
23489
  });
23302
23490
  }
23491
+ /**
23492
+ * `connect` for what only needs the link (a request, a file, a payment step): on a live session it does nothing, where
23493
+ * `connect` is a retry that says this side's transport policy again, and the contact reads 10 a minute
23494
+ * (POLICY_RECEIVE_LIMIT). A shared app's every file, each file sent and each payment step used to spend one.
23495
+ */
23496
+ open() {
23497
+ return this.paired?.state.status === "ready" && !this.streamBlocked ? Promise.resolve() : this.connect();
23498
+ }
23303
23499
  /** Closes what a switch replaced once the contact has had time to move too. */
23304
23500
  retire(old, also, rtc = false) {
23305
23501
  if (this.retiring.has(old)) return;
@@ -23877,6 +24073,14 @@ var GhostLink = class {
23877
24073
  }
23878
24074
  if (!this.channel) this.maybeAutoConnect(this.presence);
23879
24075
  }
24076
+ /**
24077
+ * This side's listener on `transport` is up again after it was let go while the contact was away (the engine's
24078
+ * `releaseGoneListeners`), and the contact is back: it is dialled once now, whichever side's turn it is, as after a
24079
+ * restart. The contact's own dials found no listener here meanwhile, and wait out their backoff (half a minute).
24080
+ */
24081
+ knockOnReturn(transport) {
24082
+ this.knock(transport);
24083
+ }
23880
24084
  /** The knock under way (`knock`): its transport, its attempt, and whether it was knocked again (`knockAgain`). */
23881
24085
  knocking = null;
23882
24086
  /**
@@ -24649,7 +24853,7 @@ var GhostLink = class {
24649
24853
  /** Issues an HTTP request to a service the peer advertises. */
24650
24854
  async request(serviceId, request) {
24651
24855
  if (this.options.params.profile) {
24652
- await this.connect();
24856
+ await this.open();
24653
24857
  if (!this.supportsServices) throw new GhostlyHttpError("unavailable", this.isDataLinkOpen ? "Your contact's app cannot share services in this chat, or needs an updated Ghostly" : "Shared services need a live connection");
24654
24858
  if (!this.pairedHttp) throw new GhostlyHttpError("closed", "Data link is closed");
24655
24859
  return this.pairedHttp.client.request(serviceId, request);
@@ -24720,7 +24924,7 @@ var GhostLink = class {
24720
24924
  }
24721
24925
  /** Sends a file over the data link, opening it first if needed. Files never travel through Pkarr. */
24722
24926
  async sendFile(file, source) {
24723
- await this.connect();
24927
+ await this.open();
24724
24928
  if (this.options.params.profile) {
24725
24929
  if (!this.supportsFiles || !this.pairedFiles) throw new Error("This contact does not support files. Both peers need an updated Ghostly.");
24726
24930
  return this.pairedFiles.send(file, source);
@@ -25236,6 +25440,31 @@ var GhostLink = class {
25236
25440
  return false;
25237
25441
  }
25238
25442
  }
25443
+ /**
25444
+ * This side's participation key and the pinned contact's, on a paired session that is open and ready: what the asker's
25445
+ * proof of a contact request is made for (WISP 8xx § Accept). Undefined otherwise.
25446
+ */
25447
+ get participationKeys() {
25448
+ const credentials = this.options.pairing?.credentials;
25449
+ if (!this.options.params.profile || !credentials?.peerKey || !this.channel || !this.isDataLinkOpen || this.paired?.state.status !== "ready") return void 0;
25450
+ return {
25451
+ mine: credentials.signer ? toZ32(credentials.signer.publicKey) : identityFromSeedB64(credentials.seedB64).pubKeyZ32,
25452
+ peer: credentials.peerKey
25453
+ };
25454
+ }
25455
+ /**
25456
+ * Says on the live session that this side asked through the contact's link (WISP 8xx § Accept). No capability: an app
25457
+ * that does not know the frame drops it. False when it could not go now: the caller says it again on the next session.
25458
+ */
25459
+ sendContactAsker(frame) {
25460
+ if (!this.channel || !this.participationKeys) return false;
25461
+ try {
25462
+ this.channel.send(JSON.stringify(frame));
25463
+ return true;
25464
+ } catch {
25465
+ return false;
25466
+ }
25467
+ }
25239
25468
  /** Both sides offer `pin/1` on the open session: a pin can be said and confirmed. */
25240
25469
  get supportsPins() {
25241
25470
  return this.isDataLinkOpen && this.sessionCapabilities.agreed("pin/1");
@@ -25339,7 +25568,7 @@ var GhostLink = class {
25339
25568
  closeApp(app) {
25340
25569
  const frame = JSON.stringify(appCloseFrame(app));
25341
25570
  if (!this.apps.open.delete(app)) return;
25342
- this.appRanges.closeApp(app, "offline");
25571
+ this.appRanges.closeApp(app, "offline", true);
25343
25572
  if (this.supportsApps && this.channel) try {
25344
25573
  this.channel.send(frame);
25345
25574
  } catch {}
@@ -25465,7 +25694,7 @@ var GhostLink = class {
25465
25694
  failAppRange(task, error) {
25466
25695
  this.appRanges.fail(task, error);
25467
25696
  }
25468
- /** Whether `task` still waits for an answer on this session (`AppRanges.holds`): one that does not needs none. */
25697
+ /** Whether `task` still holds a place until it is answered (`AppRanges.holds`): one that does not needs no answer. */
25469
25698
  holdsAppRange(task) {
25470
25699
  return this.appRanges.holds(task);
25471
25700
  }
@@ -25746,7 +25975,7 @@ var GhostLink = class {
25746
25975
  async requirePaymentSupport() {
25747
25976
  if (!PAYMENT_METHODS.some((m) => this.paymentEnabled(m))) throw new Error("Payments are turned off in this chat.");
25748
25977
  if (this.contactAway) throw engineError("contactAway");
25749
- await this.connect();
25978
+ await this.open();
25750
25979
  if (this.supportsPayments) return;
25751
25980
  const networks = this.peerNetworks;
25752
25981
  throw engineError(networks && !Object.keys(networks).length ? "contactNoWallet" : "contactNoPayments");
@@ -26392,6 +26621,11 @@ var GhostLink = class {
26392
26621
  if (target !== void 0) this.options.events?.onPeerWake?.(target);
26393
26622
  return;
26394
26623
  }
26624
+ if (frame?.t === "contact-asker") {
26625
+ const keys = this.participationKeys;
26626
+ if (keys && this.askerReceived.take()) this.options.events?.onContactAsker?.(frame, keys);
26627
+ return;
26628
+ }
26395
26629
  if (frame?.t === "paired-typing") {
26396
26630
  if (this.supportsTyping) this.typingReceiver.receive(frame);
26397
26631
  return;
@@ -27091,6 +27325,1240 @@ var GhostLink = class {
27091
27325
  }
27092
27326
  };
27093
27327
  //#endregion
27328
+ //#region ../core/src/pictureMetadata.ts
27329
+ /**
27330
+ * What a picture leaves with. A photo's file says more than its pixels: its Exif and XMP hold where it was taken, the
27331
+ * device, the time, often a thumbnail of the uncropped original. The sender removes them before the file is stored and
27332
+ * its digest computed, so what the contact (or anyone in a community) receives is the picture alone: JPEG, PNG, WebP
27333
+ * and HEIF (HEIC, AVIF), without decoding or re-encoding a pixel.
27334
+ *
27335
+ * Fail-closed: a file that is one of these pictures, by its bytes or by its type, and whose metadata cannot be removed
27336
+ * (truncated, malformed, a part this does not know) is refused with `NO_PICTURE_METADATA`, never sent as it was. Any
27337
+ * other file goes as it is.
27338
+ */
27339
+ var PICTURE_METADATA_LIMITS = {
27340
+ /** The largest picture read whole to remove its metadata: past this it is refused. */
27341
+ maxBytes: 268435456,
27342
+ /** Bytes read first to tell a picture from another file. */
27343
+ headBytes: 64
27344
+ };
27345
+ /** Why a picture is refused: its metadata could not be removed, so it does not go at all. */
27346
+ var NO_PICTURE_METADATA = "This picture cannot be sent: Ghostly could not remove the details saved in it, like where it was taken";
27347
+ /** The types of the pictures stripped here: a file of one of them whose bytes are not that picture is refused. */
27348
+ var STRIPPED_TYPES$1 = /* @__PURE__ */ new Set([
27349
+ "image/jpeg",
27350
+ "image/jpg",
27351
+ "image/pjpeg",
27352
+ "image/png",
27353
+ "image/apng",
27354
+ "image/webp",
27355
+ "image/heic",
27356
+ "image/heif",
27357
+ "image/heic-sequence",
27358
+ "image/heif-sequence",
27359
+ "image/avif",
27360
+ "image/gif",
27361
+ "image/tiff",
27362
+ "image/tiff-fx"
27363
+ ]);
27364
+ /** HEIF brands (HEIC, AVIF, the generic `mif1`): an MP4 video's `ftyp` names none of them. */
27365
+ var HEIF_BRANDS = /* @__PURE__ */ new Set([
27366
+ "heic",
27367
+ "heix",
27368
+ "heim",
27369
+ "heis",
27370
+ "hevc",
27371
+ "hevx",
27372
+ "mif1",
27373
+ "mif2",
27374
+ "msf1",
27375
+ "avif",
27376
+ "avis"
27377
+ ]);
27378
+ var u16be = (b, at) => b[at] << 8 | b[at + 1];
27379
+ var u32be$1 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
27380
+ var u32le = (b, at) => (b[at] | b[at + 1] << 8 | b[at + 2] << 16 | b[at + 3] << 24) >>> 0;
27381
+ var text$1 = (b, at, length) => String.fromCharCode(...b.subarray(at, at + length));
27382
+ var starts = (b, at, prefix) => at + prefix.length <= b.length && text$1(b, at, prefix.length) === prefix;
27383
+ /** A picture this strips, by its first bytes. */
27384
+ function kindOf(b) {
27385
+ if (b.length >= 3 && b[0] === 255 && b[1] === 216 && b[2] === 255) return "jpeg";
27386
+ if (b.length >= 8 && b[0] === 137 && starts(b, 1, "PNG\r\n\n")) return "png";
27387
+ if (b.length >= 12 && starts(b, 0, "RIFF") && starts(b, 8, "WEBP")) return "webp";
27388
+ if (starts(b, 0, "GIF87a") || starts(b, 0, "GIF89a")) return "gif";
27389
+ if (starts(b, 0, "II*\0") || starts(b, 0, "MM\0*") || starts(b, 0, "II+\0") || starts(b, 0, "MM\0+")) return "tiff";
27390
+ if (b.length >= 16 && starts(b, 4, "ftyp")) {
27391
+ const end = Math.min(b.length, u32be$1(b, 0));
27392
+ for (let at = 8; at + 4 <= end; at += 4) if (at !== 12 && HEIF_BRANDS.has(text$1(b, at, 4))) return "heif";
27393
+ }
27394
+ }
27395
+ /** Refuses the picture where its bytes are not what this expects. */
27396
+ function check$1(ok) {
27397
+ if (!ok) throw new Error(NO_PICTURE_METADATA);
27398
+ }
27399
+ /** SOFn markers: every frame type but DHT (C4), JPG (C8) and DAC (CC). */
27400
+ var JPEG_FRAME = /* @__PURE__ */ new Set([
27401
+ 192,
27402
+ 193,
27403
+ 194,
27404
+ 195,
27405
+ 197,
27406
+ 198,
27407
+ 199,
27408
+ 201,
27409
+ 202,
27410
+ 203,
27411
+ 205,
27412
+ 206,
27413
+ 207
27414
+ ]);
27415
+ function jpegKeeps(marker, b, payload) {
27416
+ if (marker >= 192 && marker <= 207 || marker >= 218 && marker <= 223) return true;
27417
+ if (marker === 224) return starts(b, payload, "JFIF\0");
27418
+ if (marker === 226) return starts(b, payload, "ICC_PROFILE\0");
27419
+ if (marker === 238) return starts(b, payload, "Adobe");
27420
+ return false;
27421
+ }
27422
+ /** An Exif (its TIFF), big-endian, whose IFD0 holds `orientation` alone: all a picture keeps of its Exif. */
27423
+ var orientationTiff = (orientation) => Uint8Array.of(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);
27424
+ /** An APP1 Exif whose IFD0 holds `orientation` alone. */
27425
+ var orientationOnly = (orientation) => Uint8Array.of(255, 225, 0, 34, 69, 120, 105, 102, 0, 0, ...orientationTiff(orientation));
27426
+ function stripJpeg(b) {
27427
+ const parts = [b.subarray(0, 2)];
27428
+ let at = 2, framed = false, scanned = false, exif = false;
27429
+ for (;;) {
27430
+ check$1(at < b.length && b[at] === 255);
27431
+ while (at < b.length && b[at] === 255) at++;
27432
+ check$1(at < b.length);
27433
+ const marker = b[at++];
27434
+ if (marker === 217) {
27435
+ check$1(framed && scanned);
27436
+ parts.push(Uint8Array.of(255, 217));
27437
+ return parts;
27438
+ }
27439
+ if (marker === 1 || marker >= 208 && marker <= 215) {
27440
+ parts.push(Uint8Array.of(255, marker));
27441
+ continue;
27442
+ }
27443
+ check$1(marker !== 0 && marker !== 216 && at + 2 <= b.length);
27444
+ const length = u16be(b, at);
27445
+ check$1(length >= 2 && at + length <= b.length);
27446
+ if (marker === 224 && length > 16 && starts(b, at + 2, "JFIF\0")) parts.push(Uint8Array.of(255, 224, 0, 16, ...b.subarray(at + 2, at + 14), 0, 0));
27447
+ else if (jpegKeeps(marker, b, at + 2)) {
27448
+ parts.push(Uint8Array.of(255, marker), b.subarray(at, at + length));
27449
+ if (JPEG_FRAME.has(marker)) framed = true;
27450
+ } else if (marker === 225 && !scanned && !exif && starts(b, at + 2, "Exif\0\0")) {
27451
+ exif = true;
27452
+ const orientation = exifOrientation(b, at + 8, at + length);
27453
+ if (orientation >= 2) parts.push(orientationOnly(orientation));
27454
+ }
27455
+ at += length;
27456
+ if (marker !== 218) continue;
27457
+ check$1(framed);
27458
+ scanned = true;
27459
+ let end = at;
27460
+ for (;;) {
27461
+ end = b.indexOf(255, end);
27462
+ check$1(end >= 0);
27463
+ let next = end + 1;
27464
+ while (next < b.length && b[next] === 255) next++;
27465
+ check$1(next < b.length);
27466
+ if (b[next] !== 0 && !(b[next] >= 208 && b[next] <= 215)) break;
27467
+ end = next + 1;
27468
+ }
27469
+ parts.push(b.subarray(at, end));
27470
+ at = end;
27471
+ }
27472
+ }
27473
+ var PNG_CRITICAL = /* @__PURE__ */ new Set([
27474
+ "IHDR",
27475
+ "PLTE",
27476
+ "IDAT",
27477
+ "IEND"
27478
+ ]);
27479
+ var PNG_DRAWS = /* @__PURE__ */ new Set([
27480
+ "tRNS",
27481
+ "gAMA",
27482
+ "cHRM",
27483
+ "sRGB",
27484
+ "iCCP",
27485
+ "sBIT",
27486
+ "bKGD",
27487
+ "pHYs",
27488
+ "cICP",
27489
+ "mDCV",
27490
+ "cLLI",
27491
+ "acTL",
27492
+ "fcTL",
27493
+ "fdAT"
27494
+ ]);
27495
+ var CRC_TABLE = Array.from({ length: 256 }, (_, n) => {
27496
+ for (let k = 0; k < 8; k++) n = n & 1 ? 3988292384 ^ n >>> 1 : n >>> 1;
27497
+ return n >>> 0;
27498
+ });
27499
+ /** A PNG chunk: its length, type, data and the CRC of its type and data. */
27500
+ function pngChunk(type, data) {
27501
+ const out = new Uint8Array(12 + data.length), view = new DataView(out.buffer);
27502
+ view.setUint32(0, data.length);
27503
+ for (let i = 0; i < 4; i++) out[4 + i] = type.charCodeAt(i);
27504
+ out.set(data, 8);
27505
+ let crc = -1;
27506
+ for (const byte of out.subarray(4, 8 + data.length)) crc = CRC_TABLE[(crc ^ byte) & 255] ^ crc >>> 8;
27507
+ view.setUint32(8 + data.length, ~crc >>> 0);
27508
+ return out;
27509
+ }
27510
+ function stripPng(b) {
27511
+ const parts = [b.subarray(0, 8)];
27512
+ let at = 8, exif = false, imaged = false;
27513
+ for (;;) {
27514
+ check$1(at + 12 <= b.length);
27515
+ const length = u32be$1(b, at), type = text$1(b, at + 4, 4);
27516
+ check$1(at + 12 + length <= b.length && (at > 8 || type === "IHDR"));
27517
+ const critical = (b[at + 4] & 32) === 0;
27518
+ check$1(!critical || PNG_CRITICAL.has(type));
27519
+ if (critical || PNG_DRAWS.has(type)) parts.push(b.subarray(at, at + 12 + length));
27520
+ else if (type === "eXIf" && !exif && !imaged) {
27521
+ exif = true;
27522
+ const orientation = exifOrientation(b, at + 8, at + 8 + length);
27523
+ if (orientation >= 2) parts.push(pngChunk("eXIf", orientationTiff(orientation)));
27524
+ }
27525
+ if (type === "IDAT") imaged = true;
27526
+ at += 12 + length;
27527
+ if (type === "IEND") return parts;
27528
+ }
27529
+ }
27530
+ var WEBP_KEEPS = /* @__PURE__ */ new Set([
27531
+ "VP8 ",
27532
+ "VP8L",
27533
+ "VP8X",
27534
+ "ALPH",
27535
+ "ANIM",
27536
+ "ANMF",
27537
+ "ICCP"
27538
+ ]);
27539
+ function stripWebp(b) {
27540
+ check$1(b.length >= 20);
27541
+ const riffEnd = 8 + u32le(b, 4);
27542
+ check$1(riffEnd <= b.length && riffEnd % 2 === 0);
27543
+ const parts = [];
27544
+ let at = 12, size = 4, drawn = false, exif = false, vp8x;
27545
+ while (at < riffEnd) {
27546
+ check$1(at + 8 <= riffEnd);
27547
+ const type = text$1(b, at, 4), length = u32le(b, at + 4), end = at + 8 + length + (length & 1);
27548
+ check$1(end <= riffEnd && (at > 12 || type === "VP8 " || type === "VP8L" || type === "VP8X"));
27549
+ let chunk;
27550
+ if (WEBP_KEEPS.has(type)) {
27551
+ chunk = b.subarray(at, end);
27552
+ if (type === "VP8X") {
27553
+ check$1(length >= 10);
27554
+ chunk = vp8x = chunk.slice();
27555
+ chunk[8] = chunk[8] & -13;
27556
+ }
27557
+ if (type === "VP8 " || type === "VP8L" || type === "ANMF") drawn = true;
27558
+ } else if (type === "EXIF" && !exif && vp8x) {
27559
+ exif = true;
27560
+ const orientation = exifOrientation(b, starts(b, at + 8, "Exif\0\0") ? at + 14 : at + 8, at + 8 + length);
27561
+ if (orientation >= 2) {
27562
+ const data = orientationTiff(orientation);
27563
+ chunk = new Uint8Array(8 + data.length);
27564
+ chunk.set([
27565
+ 69,
27566
+ 88,
27567
+ 73,
27568
+ 70,
27569
+ data.length
27570
+ ]);
27571
+ chunk.set(data, 8);
27572
+ vp8x[8] = vp8x[8] | 8;
27573
+ }
27574
+ }
27575
+ if (chunk) {
27576
+ parts.push(chunk);
27577
+ size += chunk.length;
27578
+ }
27579
+ at = end;
27580
+ }
27581
+ check$1(drawn);
27582
+ const header = /* @__PURE__ */ new Uint8Array(12);
27583
+ header.set(b.subarray(0, 12));
27584
+ new DataView(header.buffer).setUint32(4, size, true);
27585
+ return [header, ...parts];
27586
+ }
27587
+ var HEIF_TOP = /* @__PURE__ */ new Set([
27588
+ "ftyp",
27589
+ "meta",
27590
+ "mdat",
27591
+ "free",
27592
+ "skip"
27593
+ ]);
27594
+ var HEIF_META = /* @__PURE__ */ new Set([
27595
+ "hdlr",
27596
+ "dinf",
27597
+ "pitm",
27598
+ "iloc",
27599
+ "iinf",
27600
+ "iref",
27601
+ "iprp",
27602
+ "idat",
27603
+ "grpl",
27604
+ "free",
27605
+ "skip"
27606
+ ]);
27607
+ /** Items that hold metadata: Exif, and XMP (or any other document) as a MIME item. */
27608
+ var HEIF_METADATA_ITEMS = /* @__PURE__ */ new Set([
27609
+ "Exif",
27610
+ "mime",
27611
+ "uri "
27612
+ ]);
27613
+ function boxes$1(b, start, end) {
27614
+ const found = [];
27615
+ for (let at = start; at < end;) {
27616
+ check$1(at + 8 <= end);
27617
+ let size = u32be$1(b, at), body = at + 8;
27618
+ const type = text$1(b, at + 4, 4);
27619
+ if (size === 1) {
27620
+ check$1(at + 16 <= end);
27621
+ size = u32be$1(b, at + 8) * 2 ** 32 + u32be$1(b, at + 12);
27622
+ body = at + 16;
27623
+ } else if (size === 0) size = end - at;
27624
+ if (type === "uuid") body += 16;
27625
+ check$1(size >= body - at && at + size <= end);
27626
+ found.push({
27627
+ type,
27628
+ start: at,
27629
+ body,
27630
+ end: at + size
27631
+ });
27632
+ at += size;
27633
+ }
27634
+ return found;
27635
+ }
27636
+ function stripHeif(b) {
27637
+ const top = boxes$1(b, 0, b.length);
27638
+ check$1(top[0]?.type === "ftyp" && top.every((box) => HEIF_TOP.has(box.type)));
27639
+ const metas = top.filter((box) => box.type === "meta");
27640
+ check$1(metas.length === 1);
27641
+ const meta = metas[0];
27642
+ const children = boxes$1(b, meta.body + 4, meta.end);
27643
+ check$1(children.every((box) => HEIF_META.has(box.type)));
27644
+ const one = (type) => {
27645
+ const of = children.filter((box) => box.type === type);
27646
+ check$1(of.length <= 1);
27647
+ return of[0];
27648
+ };
27649
+ const iinf = one("iinf"), iloc = one("iloc"), idat = one("idat");
27650
+ check$1(!!iinf && !!iloc);
27651
+ const metadata = /* @__PURE__ */ new Set();
27652
+ const infeVersion = b[iinf.body];
27653
+ const entries = boxes$1(b, iinf.body + 4 + (infeVersion === 0 ? 2 : 4), iinf.end);
27654
+ for (const infe of entries) {
27655
+ check$1(infe.type === "infe" && infe.body + 4 <= infe.end);
27656
+ const version = b[infe.body];
27657
+ check$1(version === 2 || version === 3);
27658
+ let at = infe.body + 4;
27659
+ const id = version === 2 ? u16be(b, at) : u32be$1(b, at);
27660
+ at += version === 2 ? 2 : 4;
27661
+ check$1(at + 6 <= infe.end);
27662
+ if (HEIF_METADATA_ITEMS.has(text$1(b, at + 2, 4))) metadata.add(id);
27663
+ }
27664
+ /** `free` and `skip` boxes, at the top and in `meta`: their bodies go as zeros. */
27665
+ const space = [...top, ...children].filter((box) => box.type === "free" || box.type === "skip");
27666
+ const out = b.slice();
27667
+ const version = b[iloc.body];
27668
+ check$1(version <= 2);
27669
+ let at = iloc.body + 4;
27670
+ /** The next field of `size` bytes (0, 2, 4 or 8), big-endian. */
27671
+ const read = (size) => {
27672
+ check$1(at + size <= iloc.end);
27673
+ 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;
27674
+ check$1(Number.isSafeInteger(value));
27675
+ at += size;
27676
+ return value;
27677
+ };
27678
+ const read2 = () => read(2);
27679
+ check$1(at + 2 <= iloc.end);
27680
+ const offsetSize = b[at] >> 4, lengthSize = b[at] & 15, baseSize = b[at + 1] >> 4, indexSize = version > 0 ? b[at + 1] & 15 : 0;
27681
+ check$1([
27682
+ offsetSize,
27683
+ lengthSize,
27684
+ baseSize,
27685
+ indexSize
27686
+ ].every((size) => size === 0 || size === 4 || size === 8));
27687
+ at += 2;
27688
+ const count = read(version < 2 ? 2 : 4);
27689
+ for (let i = 0; i < count; i++) {
27690
+ const id = version < 2 ? read2() : read(4);
27691
+ const method = version > 0 ? read2() & 15 : 0;
27692
+ const reference = read2();
27693
+ const base = read(baseSize);
27694
+ const extents = read2();
27695
+ for (let e = 0; e < extents; e++) {
27696
+ if (indexSize) read(indexSize);
27697
+ const offset = read(offsetSize), length = read(lengthSize);
27698
+ if (!metadata.has(id)) {
27699
+ const start = base + offset, end = length ? start + length : b.length;
27700
+ check$1(reference !== 0 || method !== 0 || !space.some((box) => start < box.end && end > box.body));
27701
+ continue;
27702
+ }
27703
+ check$1(reference === 0 && length > 0 && (method === 0 || method === 1 && !!idat));
27704
+ const start = (method === 1 ? idat.body : 0) + base + offset, limit = method === 1 ? idat.end : b.length;
27705
+ check$1(start + length <= limit);
27706
+ out.fill(0, start, start + length);
27707
+ }
27708
+ }
27709
+ for (const box of space) out.fill(0, box.body, box.end);
27710
+ return [out];
27711
+ }
27712
+ var GIF_APPS_KEPT = /* @__PURE__ */ new Set([
27713
+ "NETSCAPE2.0",
27714
+ "ANIMEXTS1.0",
27715
+ "ICCRGBG1012"
27716
+ ]);
27717
+ function stripGif(b) {
27718
+ check$1(b.length >= 13);
27719
+ /** A colour table's bytes, from the flags that say it is there and its size. */
27720
+ const table = (flags) => flags & 128 ? 3 << (flags & 7) + 1 : 0;
27721
+ /** The end of the data sub-blocks at `at`, past their empty block. */
27722
+ const blocks = (at) => {
27723
+ for (;;) {
27724
+ check$1(at < b.length);
27725
+ const length = b[at];
27726
+ at += 1 + length;
27727
+ if (!length) return at;
27728
+ }
27729
+ };
27730
+ let at = 13 + table(b[10]), framed = false;
27731
+ check$1(at <= b.length);
27732
+ const parts = [b.subarray(0, at)];
27733
+ for (;;) {
27734
+ check$1(at < b.length);
27735
+ const introducer = b[at];
27736
+ if (introducer === 59) {
27737
+ check$1(framed);
27738
+ parts.push(Uint8Array.of(59));
27739
+ return parts;
27740
+ }
27741
+ if (introducer === 44) {
27742
+ check$1(at + 10 <= b.length);
27743
+ const data = at + 10 + table(b[at + 9]);
27744
+ check$1(data < b.length);
27745
+ const end = blocks(data + 1);
27746
+ parts.push(b.subarray(at, end));
27747
+ framed = true;
27748
+ at = end;
27749
+ continue;
27750
+ }
27751
+ check$1(introducer === 33 && at + 2 < b.length);
27752
+ const label = b[at + 1], end = blocks(at + 2);
27753
+ const app = label === 255 && b[at + 2] === 11 && GIF_APPS_KEPT.has(text$1(b, at + 3, 11));
27754
+ if (label === 249 || label === 1 || app) parts.push(b.subarray(at, end));
27755
+ else check$1(label === 254 || label === 255);
27756
+ at = end;
27757
+ }
27758
+ }
27759
+ var TIFF_DRAWS = /* @__PURE__ */ new Set([
27760
+ 254,
27761
+ 255,
27762
+ 256,
27763
+ 257,
27764
+ 258,
27765
+ 259,
27766
+ 262,
27767
+ 263,
27768
+ 264,
27769
+ 265,
27770
+ 266,
27771
+ 273,
27772
+ 274,
27773
+ 277,
27774
+ 278,
27775
+ 279,
27776
+ 280,
27777
+ 281,
27778
+ 282,
27779
+ 283,
27780
+ 284,
27781
+ 286,
27782
+ 287,
27783
+ 290,
27784
+ 291,
27785
+ 292,
27786
+ 293,
27787
+ 296,
27788
+ 297,
27789
+ 301,
27790
+ 317,
27791
+ 318,
27792
+ 319,
27793
+ 320,
27794
+ 321,
27795
+ 322,
27796
+ 323,
27797
+ 324,
27798
+ 325,
27799
+ 332,
27800
+ 334,
27801
+ 336,
27802
+ 338,
27803
+ 339,
27804
+ 340,
27805
+ 341,
27806
+ 529,
27807
+ 530,
27808
+ 531,
27809
+ 532,
27810
+ 34675
27811
+ ]);
27812
+ /** Text and documents about the picture: DocumentName to HostComputer, InkNames, XMP, Copyright, IPTC, Photoshop, Windows' XP tags, PrintIM. */
27813
+ var TIFF_METADATA = /* @__PURE__ */ new Set([
27814
+ 269,
27815
+ 270,
27816
+ 271,
27817
+ 272,
27818
+ 285,
27819
+ 305,
27820
+ 306,
27821
+ 315,
27822
+ 316,
27823
+ 333,
27824
+ 700,
27825
+ 33432,
27826
+ 33723,
27827
+ 34377,
27828
+ 18246,
27829
+ 18249,
27830
+ 40091,
27831
+ 40092,
27832
+ 40093,
27833
+ 40094,
27834
+ 40095,
27835
+ 50341
27836
+ ]);
27837
+ /** The IFDs of Exif, GPS and interoperability, emptied whole. */
27838
+ var TIFF_METADATA_IFDS = /* @__PURE__ */ new Set([
27839
+ 34665,
27840
+ 34853,
27841
+ 40965
27842
+ ]);
27843
+ /** Compression without JPEG: none, CCITT, LZW, Deflate, PackBits. */
27844
+ var TIFF_COMPRESSION = /* @__PURE__ */ new Set([
27845
+ 1,
27846
+ 2,
27847
+ 3,
27848
+ 4,
27849
+ 5,
27850
+ 8,
27851
+ 32773,
27852
+ 32946
27853
+ ]);
27854
+ /** Bytes per value of each field type. */
27855
+ var TIFF_TYPE_BYTES = [
27856
+ 0,
27857
+ 1,
27858
+ 1,
27859
+ 2,
27860
+ 4,
27861
+ 8,
27862
+ 1,
27863
+ 1,
27864
+ 2,
27865
+ 4,
27866
+ 8,
27867
+ 4,
27868
+ 8,
27869
+ 4
27870
+ ];
27871
+ function stripTiff(b) {
27872
+ const little = b[0] === 73;
27873
+ const u16 = (at) => {
27874
+ check$1(at + 2 <= b.length);
27875
+ return little ? b[at] | b[at + 1] << 8 : u16be(b, at);
27876
+ };
27877
+ const u32 = (at) => {
27878
+ check$1(at + 4 <= b.length);
27879
+ return little ? u32le(b, at) : u32be$1(b, at);
27880
+ };
27881
+ check$1(b.length >= 8 && u16(2) === 42);
27882
+ const out = b.slice(), seen = /* @__PURE__ */ new Set();
27883
+ /** An IFD's entries: tag, type, the value's first byte (in the entry or where it points) and its bytes. */
27884
+ const entries = (ifd) => {
27885
+ check$1(ifd >= 8 && !seen.has(ifd) && seen.size < 1024);
27886
+ seen.add(ifd);
27887
+ const count = u16(ifd), next = ifd + 2 + count * 12;
27888
+ u32(next);
27889
+ return {
27890
+ next,
27891
+ list: Array.from({ length: count }, (_, i) => {
27892
+ const at = ifd + 2 + i * 12, tag = u16(at), type = u16(at + 2);
27893
+ check$1(type >= 1 && type < TIFF_TYPE_BYTES.length);
27894
+ const bytes = TIFF_TYPE_BYTES[type] * u32(at + 4);
27895
+ const value = bytes <= 4 ? at + 8 : u32(at + 8);
27896
+ check$1(Number.isSafeInteger(bytes) && value + bytes <= b.length);
27897
+ return {
27898
+ at,
27899
+ tag,
27900
+ type,
27901
+ value,
27902
+ bytes
27903
+ };
27904
+ })
27905
+ };
27906
+ };
27907
+ /** An Exif, GPS or interoperability IFD: every value zeroed, then the IFD itself, so it holds no entry. */
27908
+ const empty = (ifd) => {
27909
+ const { next, list } = entries(ifd);
27910
+ for (const entry of list) {
27911
+ check$1(entry.tag !== 37500);
27912
+ if (TIFF_METADATA_IFDS.has(entry.tag)) empty(u32(entry.value));
27913
+ out.fill(0, entry.value, entry.value + entry.bytes);
27914
+ }
27915
+ out.fill(0, ifd, next + 4);
27916
+ };
27917
+ for (let ifd = u32(4); ifd;) {
27918
+ const { next, list } = entries(ifd);
27919
+ let kept = 0;
27920
+ for (const { at, tag, value, bytes } of list) {
27921
+ if (tag === 259) check$1(TIFF_COMPRESSION.has(u16(value)));
27922
+ if (TIFF_METADATA_IFDS.has(tag)) {
27923
+ empty(u32(value));
27924
+ continue;
27925
+ }
27926
+ if (TIFF_METADATA.has(tag)) out.fill(0, value, value + bytes);
27927
+ else check$1(TIFF_DRAWS.has(tag));
27928
+ out.copyWithin(ifd + 2 + kept++ * 12, at, at + 12);
27929
+ }
27930
+ check$1(kept > 0);
27931
+ const end = ifd + 2 + kept * 12;
27932
+ out.set(little ? [kept & 255, kept >> 8] : [kept >> 8, kept & 255], ifd);
27933
+ out.set(b.subarray(next, next + 4), end);
27934
+ out.fill(0, end + 4, next + 4);
27935
+ ifd = u32(next);
27936
+ }
27937
+ return [out];
27938
+ }
27939
+ var STRIP = {
27940
+ jpeg: stripJpeg,
27941
+ png: stripPng,
27942
+ webp: stripWebp,
27943
+ heif: stripHeif,
27944
+ gif: stripGif,
27945
+ tiff: stripTiff
27946
+ };
27947
+ /**
27948
+ * A picture's bytes without its metadata, as parts to put in a Blob; undefined when the file is not a picture this
27949
+ * strips (by its bytes and its type), so it goes as it is. Throws `NO_PICTURE_METADATA` when it is one but its
27950
+ * metadata cannot be removed.
27951
+ */
27952
+ function stripPictureMetadata(bytes, mime) {
27953
+ const kind = kindOf(bytes);
27954
+ if (!kind) {
27955
+ if (STRIPPED_TYPES$1.has(mime.split(";")[0].trim().toLowerCase())) throw new Error(NO_PICTURE_METADATA);
27956
+ return;
27957
+ }
27958
+ return STRIP[kind](bytes);
27959
+ }
27960
+ /**
27961
+ * Whether a file is a picture whose metadata goes before it is sent, by its first `PICTURE_METADATA_LIMITS.headBytes`
27962
+ * bytes or by its type: then it is read whole and stripped (`stripPictureMetadata`), else it goes as it is.
27963
+ */
27964
+ function isStrippedPicture(head, mime) {
27965
+ return !!kindOf(head) || STRIPPED_TYPES$1.has(mime.split(";")[0].trim().toLowerCase());
27966
+ }
27967
+ /**
27968
+ * `source` as it is sent: without its metadata when it is a picture (`stripPictureMetadata`), or undefined when it is
27969
+ * not one and goes as it is. Only its first bytes are read for any other file. Throws `NO_PICTURE_METADATA` for a
27970
+ * picture that cannot be stripped or is past `PICTURE_METADATA_LIMITS.maxBytes`; an error reading `source` as it is.
27971
+ */
27972
+ async function withoutPictureMetadata(source, mime) {
27973
+ if (!isStrippedPicture(new Uint8Array(await source.slice(0, PICTURE_METADATA_LIMITS.headBytes).arrayBuffer()), mime)) return void 0;
27974
+ if (source.size > PICTURE_METADATA_LIMITS.maxBytes) throw new Error(NO_PICTURE_METADATA);
27975
+ const parts = stripPictureMetadata(new Uint8Array(await source.arrayBuffer()), mime);
27976
+ return parts && new Blob(parts, { type: mime });
27977
+ }
27978
+ //#endregion
27979
+ //#region ../core/src/videoMetadata.ts
27980
+ /**
27981
+ * What a video leaves with. An MP4 or QuickTime file says more than its frames: its `udta` and `meta` boxes hold where
27982
+ * it was recorded (`©xyz`, `com.apple.quicktime.location.ISO6709`), the device, often its software; a timed metadata
27983
+ * track (an iPhone's location and motion, a GoPro's GPS) holds them sample by sample; the movie's, each track's and
27984
+ * each track's media header (`mvhd`, `tkhd`, `mdhd`) say when it was recorded, to the second, and a camera's timecode
27985
+ * track the time of day. The sender removes them before the file is stored and its digest computed, without decoding
27986
+ * or re-encoding a frame: each such box becomes a `free` box of the same size, zeroed, the headers' creation and
27987
+ * modification times are zeroed (0 is "unknown"), the space already left in it (`free`, `skip`, `wide`: what an edit in
27988
+ * place left behind, a recorder's GPS log) is zeroed after its header, so are the names of its handlers and of the
27989
+ * compressor that made its frames, and each metadata and timecode track's samples are zeroed where they are, so no
27990
+ * offset in the file moves and it plays as it did. Only the boxes' headers, `moov` and `moof` are read; the
27991
+ * media goes untouched.
27992
+ *
27993
+ * Fail-closed: a file that is an MP4 or QuickTime video, by its bytes or by its type, and whose metadata cannot be
27994
+ * removed (truncated, malformed, a part of its movie this does not know) is refused with `NO_VIDEO_METADATA`, never sent as it was.
27995
+ * A picture (HEIF is pictureMetadata.ts's), a file without a video track (an M4A) and any other file go as they are.
27996
+ */
27997
+ var VIDEO_METADATA_LIMITS = {
27998
+ /** The largest `moov` or `moof` read whole, and the most bytes of a metadata track's chunk: past this the video is refused. */
27999
+ maxBoxBytes: 67108864,
28000
+ /** The most top-level boxes walked (a fragmented MP4 has two per fragment). */
28001
+ maxBoxes: 1e5,
28002
+ /** Bytes read first to tell a video from another file. */
28003
+ headBytes: 64
28004
+ };
28005
+ /** Why a video is refused: its metadata could not be removed, so it does not go at all. */
28006
+ var NO_VIDEO_METADATA = "This video cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded";
28007
+ /** The types of the videos stripped here: a file of one of them whose bytes are not one is refused. */
28008
+ var STRIPPED_TYPES = /* @__PURE__ */ new Set([
28009
+ "video/mp4",
28010
+ "video/quicktime",
28011
+ "video/x-m4v",
28012
+ "video/3gpp",
28013
+ "video/3gpp2"
28014
+ ]);
28015
+ /**
28016
+ * The first box of an MP4 (`ftyp`), of a QuickTime file written without one, or of one a tool or a preview was put
28017
+ * before (`uuid`, `pnot`): a file that starts with one is a movie, refused when it is not one.
28018
+ */
28019
+ var FIRST_BOXES = /* @__PURE__ */ new Set([
28020
+ "ftyp",
28021
+ "moov",
28022
+ "mdat",
28023
+ "wide",
28024
+ "free",
28025
+ "skip",
28026
+ "uuid",
28027
+ "pnot",
28028
+ "PICT"
28029
+ ]);
28030
+ /** Boxes that hold metadata wherever they are: emptied into `free`. */
28031
+ var METADATA = /* @__PURE__ */ new Set([
28032
+ "udta",
28033
+ "meta",
28034
+ "uuid"
28035
+ ]);
28036
+ /**
28037
+ * Space left in a file (padding, or an old `moov` or `udta` an edit in place left behind), and what a recorder puts
28038
+ * there (a dashcam's GPS log, a thumbnail): kept where it is, its body zeroed.
28039
+ */
28040
+ var SPACE = /* @__PURE__ */ new Set([
28041
+ "free",
28042
+ "skip",
28043
+ "wide"
28044
+ ]);
28045
+ /**
28046
+ * At the top: what makes the movie, kept (`moov` and `moof` looked into). Any other box is emptied, unless the movie's
28047
+ * samples are in it: the ones known at a movie's top (a preview picture, an event message, the wall-clock time a
28048
+ * fragment was made, `prft`) and a device's own (Samsung's `sefd`, a GPS track's `gps0`) alike.
28049
+ */
28050
+ var TOP_KEEPS = /* @__PURE__ */ new Set([
28051
+ "ftyp",
28052
+ "styp",
28053
+ "moov",
28054
+ "mdat",
28055
+ "moof",
28056
+ "mfra",
28057
+ "sidx",
28058
+ "ssix",
28059
+ "pdin",
28060
+ ...SPACE
28061
+ ]);
28062
+ /** The boxes emptied that are known at a movie's top: a file that starts with one is read as boxes. */
28063
+ var TOP_EMPTIED = /* @__PURE__ */ new Set([
28064
+ ...METADATA,
28065
+ "pnot",
28066
+ "PICT",
28067
+ "emsg",
28068
+ "Xtra",
28069
+ "prft"
28070
+ ]);
28071
+ var MOOV_KEEPS = /* @__PURE__ */ new Set([
28072
+ "mvhd",
28073
+ "trak",
28074
+ "mvex",
28075
+ "iods",
28076
+ "ctab",
28077
+ ...SPACE
28078
+ ]);
28079
+ var TRAK_KEEPS = /* @__PURE__ */ new Set([
28080
+ "tkhd",
28081
+ "edts",
28082
+ "mdia",
28083
+ "tref",
28084
+ "tapt",
28085
+ "load",
28086
+ "txas",
28087
+ "matt",
28088
+ ...SPACE
28089
+ ]);
28090
+ /** Boxes looked into below a track (and in a fragment) for the metadata boxes in them. */
28091
+ var CONTAINERS = /* @__PURE__ */ new Set([
28092
+ "mdia",
28093
+ "minf",
28094
+ "dinf",
28095
+ "stbl",
28096
+ "edts",
28097
+ "mvex",
28098
+ "traf"
28099
+ ]);
28100
+ /** Track handlers kept as they are: picture, sound, text and subtitles, timecode, hints. `meta` tracks have their samples zeroed, `tmcd` ones too. */
28101
+ var HANDLERS = /* @__PURE__ */ new Set([
28102
+ "vide",
28103
+ "soun",
28104
+ "text",
28105
+ "sbtl",
28106
+ "subt",
28107
+ "clcp",
28108
+ "tmcd",
28109
+ "hint",
28110
+ "auxv",
28111
+ "pict",
28112
+ "sdsm",
28113
+ "odsm",
28114
+ "subp"
28115
+ ]);
28116
+ /** The handlers whose sample descriptions are a visual one's, a compressor's name in each. */
28117
+ var VISUAL = /* @__PURE__ */ new Set([
28118
+ "vide",
28119
+ "auxv",
28120
+ "pict"
28121
+ ]);
28122
+ /** Zeros put in a Blob a part at a time. */
28123
+ var ZEROS = /* @__PURE__ */ new Uint8Array(1048576);
28124
+ var u32be = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
28125
+ var text = (b, at, length) => String.fromCharCode(...b.subarray(at, at + length));
28126
+ /** Refuses the video where its bytes are not what this expects. */
28127
+ function check(ok) {
28128
+ if (!ok) throw new Error(NO_VIDEO_METADATA);
28129
+ }
28130
+ /** A box's header at `at` of `b` (`base` its offset in the file), up to `end` (a size of 0 runs to it). */
28131
+ function header(b, at, end, base = 0) {
28132
+ check(at + 8 <= b.length);
28133
+ let size = u32be(b, at), body = at + 8;
28134
+ const type = text(b, at + 4, 4);
28135
+ if (size === 1) {
28136
+ check(at + 16 <= b.length);
28137
+ size = u32be(b, at + 8) * 2 ** 32 + u32be(b, at + 12);
28138
+ body = at + 16;
28139
+ } else if (size === 0) size = end - (base + at);
28140
+ if (type === "uuid") body += 16;
28141
+ check(Number.isSafeInteger(size) && size >= body - at && base + at + size <= end);
28142
+ return {
28143
+ type,
28144
+ start: base + at,
28145
+ body: base + body,
28146
+ end: base + at + size
28147
+ };
28148
+ }
28149
+ function boxes(b, start, end) {
28150
+ const found = [];
28151
+ for (let at = start; at < end;) {
28152
+ check(at + 8 <= end);
28153
+ const box = header(b.subarray(0, end), at, end);
28154
+ found.push(box);
28155
+ at = box.end;
28156
+ }
28157
+ return found;
28158
+ }
28159
+ /** A box made `free` where it is: its size kept, everything after its size zeroed. */
28160
+ function empty(b, box) {
28161
+ b.set([
28162
+ 102,
28163
+ 114,
28164
+ 101,
28165
+ 101
28166
+ ], box.start + 4);
28167
+ b.fill(0, box.start + (u32be(b, box.start) === 1 ? 16 : 8), box.end);
28168
+ }
28169
+ /**
28170
+ * Every metadata box in a container's children (and in theirs, for the containers below a track) emptied, every
28171
+ * free space's body zeroed, and every handler's name (an `hdlr`'s after its 24 bytes of fields: "Core Media Video",
28172
+ * an encoder's or an app's) zeroed in place, its type kept.
28173
+ */
28174
+ function emptyWithin(b, start, end) {
28175
+ for (const box of boxes(b, start, end)) if (METADATA.has(box.type)) empty(b, box);
28176
+ else if (SPACE.has(box.type)) b.fill(0, box.body, box.end);
28177
+ else if (box.type === "hdlr") b.fill(0, Math.min(box.body + 24, box.end), box.end);
28178
+ else if (CONTAINERS.has(box.type)) emptyWithin(b, box.body, box.end);
28179
+ }
28180
+ /**
28181
+ * A visual track's sample descriptions with the name of the compressor that made them zeroed (32 bytes at 42 of each
28182
+ * entry's body, MP4's `compressorname` and QuickTime's alike: an encoder's version, a camera's).
28183
+ */
28184
+ function zeroCompressorNames(b, stbl) {
28185
+ const stsd = child(b, stbl, "stsd");
28186
+ check(!!stsd && stsd.body + 8 <= stsd.end);
28187
+ for (const entry of boxes(b, stsd.body + 8, stsd.end)) {
28188
+ check(entry.body + 74 <= entry.end);
28189
+ b.fill(0, entry.body + 42, entry.body + 74);
28190
+ }
28191
+ }
28192
+ /** A `mvhd`, `tkhd` or `mdhd` with its creation and modification times zeroed: 32 bits each in version 0, 64 in 1. */
28193
+ function zeroTimes(b, box) {
28194
+ const version = b[box.body], bytes = version === 1 ? 16 : 8;
28195
+ check(version <= 1 && box.body + 4 + bytes <= box.end);
28196
+ b.fill(0, box.body + 4, box.body + 4 + bytes);
28197
+ }
28198
+ var child = (b, parent, type) => {
28199
+ if (!parent) return void 0;
28200
+ const of = boxes(b, parent.body, parent.end).filter((box) => box.type === type);
28201
+ check(of.length <= 1);
28202
+ return of[0];
28203
+ };
28204
+ /** A sample table's chunks, from its `stco` or `co64`: how many, and where each starts in the file. */
28205
+ function chunkOffsets(b, stbl) {
28206
+ const stco = child(b, stbl, "stco"), co64 = child(b, stbl, "co64");
28207
+ check(!!stco !== !!co64);
28208
+ const offsets = stco ?? co64;
28209
+ check(offsets.body + 8 <= offsets.end);
28210
+ const chunks = u32be(b, offsets.body + 4);
28211
+ check(offsets.body + 8 + chunks * (co64 ? 8 : 4) <= offsets.end);
28212
+ 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);
28213
+ return {
28214
+ chunks,
28215
+ offsetOf
28216
+ };
28217
+ }
28218
+ /** The byte ranges of a track's samples in the file, one per chunk, from its sample table. */
28219
+ function sampleRanges(b, stbl) {
28220
+ const stsz = child(b, stbl, "stsz"), stz2 = child(b, stbl, "stz2"), stsc = child(b, stbl, "stsc");
28221
+ check(!!stsc && !!stsz !== !!stz2);
28222
+ const need = (box, at, bytes) => check(at + bytes <= box.end);
28223
+ const sizeTable = stsz ?? stz2;
28224
+ need(sizeTable, sizeTable.body, 12);
28225
+ const count = u32be(b, sizeTable.body + 8);
28226
+ let sizeOf;
28227
+ /** Samples of one size: a chunk's length is counted, not added up a sample at a time. */
28228
+ let uniform = 0;
28229
+ if (stsz) {
28230
+ uniform = u32be(b, stsz.body + 4);
28231
+ if (!uniform) need(stsz, stsz.body + 12, count * 4);
28232
+ sizeOf = (i) => u32be(b, stsz.body + 12 + i * 4);
28233
+ } else {
28234
+ const field = b[stz2.body + 7];
28235
+ check(field === 4 || field === 8 || field === 16);
28236
+ need(stz2, stz2.body + 12, Math.ceil(count * field / 8));
28237
+ const at = stz2.body + 12;
28238
+ 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;
28239
+ }
28240
+ const { chunks, offsetOf } = chunkOffsets(b, stbl);
28241
+ need(stsc, stsc.body, 8);
28242
+ const runs = u32be(b, stsc.body + 4);
28243
+ need(stsc, stsc.body + 8, runs * 12);
28244
+ const ranges = [];
28245
+ let sample = 0;
28246
+ for (let run = 0; run < runs; run++) {
28247
+ const first = u32be(b, stsc.body + 8 + run * 12), perChunk = u32be(b, stsc.body + 12 + run * 12);
28248
+ const last = run + 1 < runs ? u32be(b, stsc.body + 8 + (run + 1) * 12) : chunks + 1;
28249
+ check(first >= 1 && last > first && last <= chunks + 1);
28250
+ for (let chunk = first; chunk < last; chunk++) {
28251
+ const start = offsetOf(chunk - 1);
28252
+ check(sample + perChunk <= count);
28253
+ let length = uniform * perChunk;
28254
+ if (!uniform) for (let i = 0; i < perChunk; i++) length += sizeOf(sample + i);
28255
+ sample += perChunk;
28256
+ check(Number.isSafeInteger(start) && length <= VIDEO_METADATA_LIMITS.maxBoxBytes);
28257
+ if (length) ranges.push([start, start + length]);
28258
+ }
28259
+ }
28260
+ check(sample === count);
28261
+ return ranges;
28262
+ }
28263
+ /** Each track's default sample size in fragments, from `moov`'s `mvex/trex` boxes, by track ID. */
28264
+ function defaultSampleSizes(moov) {
28265
+ const sizes = /* @__PURE__ */ new Map();
28266
+ const mvex = child(moov, header(moov, 0, moov.length), "mvex");
28267
+ for (const trex of mvex ? boxes(moov, mvex.body, mvex.end) : []) {
28268
+ if (trex.type !== "trex") continue;
28269
+ check(trex.body + 24 <= trex.end);
28270
+ sizes.set(u32be(moov, trex.body + 4), u32be(moov, trex.body + 16));
28271
+ }
28272
+ return sizes;
28273
+ }
28274
+ /**
28275
+ * The byte ranges of a fragment's samples in the file, one per track run (`trun`), from its `moof` read whole (`at` its
28276
+ * offset in the file): each run starts at its data offset from its track fragment's base (`tfhd`'s base data offset,
28277
+ * else the `moof`'s start for the first track fragment or one that says so, else where the previous one's data ended),
28278
+ * or where the previous run ended; its length is its samples' sizes, its own or `tfhd`'s or `trex`'s default.
28279
+ */
28280
+ function fragmentRanges(b, at, sizes) {
28281
+ const ranges = [];
28282
+ let previous = at;
28283
+ for (const traf of boxes(b, header(b, 0, b.length).body, b.length)) {
28284
+ if (traf.type !== "traf") continue;
28285
+ const tfhd = child(b, traf, "tfhd");
28286
+ check(!!tfhd && tfhd.body + 8 <= tfhd.end);
28287
+ const flags = u32be(b, tfhd.body) & 16777215;
28288
+ let field = tfhd.body + 8, base = flags & 131072 ? at : previous;
28289
+ if (flags & 1) {
28290
+ check(field + 8 <= tfhd.end);
28291
+ base = u32be(b, field) * 2 ** 32 + u32be(b, field + 4);
28292
+ field += 8;
28293
+ }
28294
+ if (flags & 2) field += 4;
28295
+ if (flags & 8) field += 4;
28296
+ let size = sizes.get(u32be(b, tfhd.body + 4));
28297
+ if (flags & 16) {
28298
+ check(field + 4 <= tfhd.end);
28299
+ size = u32be(b, field);
28300
+ }
28301
+ let next = base;
28302
+ for (const trun of boxes(b, traf.body, traf.end)) {
28303
+ if (trun.type !== "trun") continue;
28304
+ check(trun.body + 8 <= trun.end);
28305
+ const runFlags = u32be(b, trun.body) & 16777215, count = u32be(b, trun.body + 4);
28306
+ let field = trun.body + 8;
28307
+ if (runFlags & 1) {
28308
+ check(field + 4 <= trun.end);
28309
+ next = base + (u32be(b, field) | 0);
28310
+ field += 4;
28311
+ }
28312
+ if (runFlags & 4) field += 4;
28313
+ const stride = [
28314
+ 256,
28315
+ 512,
28316
+ 1024,
28317
+ 2048
28318
+ ].filter((flag) => runFlags & flag).length * 4;
28319
+ check(field + count * stride <= trun.end);
28320
+ let length = 0;
28321
+ if (runFlags & 512) {
28322
+ const sizeAt = field + (runFlags & 256 ? 4 : 0);
28323
+ for (let i = 0; i < count; i++) length += u32be(b, sizeAt + i * stride);
28324
+ } else if (count) {
28325
+ check(size !== void 0);
28326
+ length = count * size;
28327
+ }
28328
+ check(Number.isSafeInteger(next) && Number.isSafeInteger(next + length));
28329
+ if (length) ranges.push([next, next + length]);
28330
+ next += length;
28331
+ }
28332
+ previous = next;
28333
+ }
28334
+ return ranges;
28335
+ }
28336
+ /** Whether every data reference of a track is this file (a self-contained `url ` or `alis`). */
28337
+ function selfContained(b, minf) {
28338
+ const dref = child(b, child(b, minf, "dinf"), "dref");
28339
+ if (!dref) return false;
28340
+ return boxes(b, dref.body + 8, dref.end).every((entry) => entry.body + 4 <= entry.end && (b[entry.body + 3] & 1) === 1);
28341
+ }
28342
+ /**
28343
+ * `moov` with its metadata boxes emptied and its headers' times zeroed, read whole: whether it has a video track, the
28344
+ * byte ranges of its metadata and timecode tracks' samples (zeroed by the caller where they are), whether a metadata
28345
+ * track has any, and every track's sample table.
28346
+ */
28347
+ function stripMoov(b) {
28348
+ let video = false, fragmented = false, metadata = false;
28349
+ const zeroed = [], tables = [];
28350
+ for (const box of boxes(b, header(b, 0, b.length).body, b.length)) {
28351
+ if (METADATA.has(box.type)) {
28352
+ empty(b, box);
28353
+ continue;
28354
+ }
28355
+ check(MOOV_KEEPS.has(box.type));
28356
+ if (SPACE.has(box.type)) b.fill(0, box.body, box.end);
28357
+ if (box.type === "mvhd") zeroTimes(b, box);
28358
+ if (box.type === "mvex") {
28359
+ fragmented = true;
28360
+ emptyWithin(b, box.body, box.end);
28361
+ }
28362
+ if (box.type !== "trak") continue;
28363
+ let mdia;
28364
+ for (const part of boxes(b, box.body, box.end)) {
28365
+ if (METADATA.has(part.type)) {
28366
+ empty(b, part);
28367
+ continue;
28368
+ }
28369
+ check(TRAK_KEEPS.has(part.type));
28370
+ if (part.type === "tkhd") zeroTimes(b, part);
28371
+ if (part.type === "mdia") {
28372
+ check(!mdia);
28373
+ mdia = part;
28374
+ }
28375
+ }
28376
+ check(!!mdia);
28377
+ const hdlr = child(b, mdia, "hdlr"), minf = child(b, mdia, "minf"), mdhd = child(b, mdia, "mdhd");
28378
+ check(!!hdlr && !!minf && hdlr.body + 12 <= hdlr.end);
28379
+ if (mdhd) zeroTimes(b, mdhd);
28380
+ const handler = text(b, hdlr.body + 8, 4);
28381
+ const stbl = child(b, minf, "stbl");
28382
+ check(!!stbl);
28383
+ tables.push(stbl);
28384
+ if (handler === "meta") {
28385
+ check(selfContained(b, minf));
28386
+ const ranges = sampleRanges(b, stbl);
28387
+ metadata ||= ranges.length > 0;
28388
+ for (const range of ranges) zeroed.push(range);
28389
+ } else if (handler === "tmcd" && selfContained(b, minf)) for (const range of sampleRanges(b, stbl)) zeroed.push(range);
28390
+ else check(HANDLERS.has(handler));
28391
+ if (handler === "vide") video = true;
28392
+ if (VISUAL.has(handler)) zeroCompressorNames(b, stbl);
28393
+ emptyWithin(b, box.body, box.end);
28394
+ }
28395
+ return {
28396
+ video,
28397
+ fragmented,
28398
+ metadata,
28399
+ zeroed,
28400
+ tables
28401
+ };
28402
+ }
28403
+ /** A whole box's header in the file at `at`, read from it; undefined where none fits (bytes after the last box). */
28404
+ async function headerAt(source, at) {
28405
+ const head = await source.read(at, 16);
28406
+ try {
28407
+ return header(head, 0, source.size, at);
28408
+ } catch {
28409
+ return;
28410
+ }
28411
+ }
28412
+ /** A box read whole, within the limit. */
28413
+ async function whole(source, box) {
28414
+ check(box.end - box.start <= VIDEO_METADATA_LIMITS.maxBoxBytes);
28415
+ const bytes = await source.read(box.start, box.end - box.start);
28416
+ check(bytes.length === box.end - box.start);
28417
+ return bytes;
28418
+ }
28419
+ /**
28420
+ * What a file is by its first box: a movie (`FIRST_BOXES`), a file of boxes that is one when it holds a `moov` (any
28421
+ * other box found at the top of a movie: a stream's segment holds none), or another file. An HEIF picture is
28422
+ * pictureMetadata.ts's.
28423
+ */
28424
+ function containerOf(head, mime) {
28425
+ const first = head.length >= 8 ? text(head, 4, 4) : "";
28426
+ if (isStrippedPicture(head, mime)) return void 0;
28427
+ if (FIRST_BOXES.has(first)) return "movie";
28428
+ return TOP_KEEPS.has(first) || TOP_EMPTIED.has(first) ? "boxes" : void 0;
28429
+ }
28430
+ /**
28431
+ * `source` as it is sent: an MP4 or QuickTime video without its metadata, made of `source`'s own bytes but for the
28432
+ * boxes and samples zeroed; undefined when it goes as it is (not one of these videos, a file without a video track).
28433
+ * Throws `NO_VIDEO_METADATA` for a video whose metadata cannot be removed; an error reading `source` as it is.
28434
+ */
28435
+ async function withoutVideoMetadata(source, mime) {
28436
+ const patches = await videoMetadataPatches({
28437
+ size: source.size,
28438
+ read: async (offset, length) => new Uint8Array(await source.slice(offset, offset + length).arrayBuffer())
28439
+ }, mime);
28440
+ if (!patches) return void 0;
28441
+ const parts = [];
28442
+ let at = 0;
28443
+ for (const patch of patches) {
28444
+ if (patch.start > at) parts.push(source.slice(at, patch.start));
28445
+ if (patch.bytes) parts.push(patch.bytes);
28446
+ else for (let left = patch.end - patch.start; left > 0; left -= ZEROS.length) parts.push(ZEROS.subarray(0, Math.min(left, ZEROS.length)));
28447
+ at = patch.end;
28448
+ }
28449
+ if (at < source.size) parts.push(source.slice(at));
28450
+ return new Blob(parts, { type: mime });
28451
+ }
28452
+ /**
28453
+ * What `withoutVideoMetadata` changes in a video read from `source` (one not held in a Blob: a file kept in storage):
28454
+ * the parts replaced, in order and apart, the rest of its bytes going as they are; undefined when it goes as it is.
28455
+ * Throws `NO_VIDEO_METADATA` as it does.
28456
+ */
28457
+ async function videoMetadataPatches(source, mime) {
28458
+ const head = await source.read(0, VIDEO_METADATA_LIMITS.headBytes);
28459
+ const typed = STRIPPED_TYPES.has(mime.split(";")[0].trim().toLowerCase());
28460
+ const container = containerOf(head, mime);
28461
+ if (!container) {
28462
+ if (typed && !isStrippedPicture(head, mime)) throw new Error(NO_VIDEO_METADATA);
28463
+ return;
28464
+ }
28465
+ /** What replaces the file's bytes, by where it starts: a box rewritten, or zeros (no `bytes`). */
28466
+ const patches = [];
28467
+ const top = [];
28468
+ /** What goes as zeros at the top: the boxes emptied, the space's bodies, and the bytes after the last box. */
28469
+ const dropped = [];
28470
+ let trailer = false;
28471
+ for (let at = 0; at < source.size;) {
28472
+ check(top.length < VIDEO_METADATA_LIMITS.maxBoxes);
28473
+ const box = await headerAt(source, at);
28474
+ if (!box || top.length && box.type === "\0\0\0\0") {
28475
+ patches.push({
28476
+ start: at,
28477
+ end: source.size
28478
+ });
28479
+ dropped.push([at, source.size]);
28480
+ trailer = !box || box.end !== source.size;
28481
+ break;
28482
+ }
28483
+ top.push(box);
28484
+ if (SPACE.has(box.type)) dropped.push([box.body, box.end]);
28485
+ else if (!TOP_KEEPS.has(box.type)) dropped.push([box.start, box.end]);
28486
+ at = box.end;
28487
+ }
28488
+ const moovs = top.filter((box) => box.type === "moov");
28489
+ if (!moovs.length && container === "boxes" && !typed) {
28490
+ check(!trailer && top.every((box) => TOP_KEEPS.has(box.type) || TOP_EMPTIED.has(box.type)));
28491
+ return;
28492
+ }
28493
+ check(moovs.length === 1);
28494
+ const moov = await whole(source, moovs[0]);
28495
+ const { video, fragmented, metadata, zeroed, tables } = stripMoov(moov);
28496
+ if (!video && !typed) return void 0;
28497
+ patches.push({
28498
+ start: moovs[0].start,
28499
+ end: moovs[0].end,
28500
+ bytes: moov
28501
+ });
28502
+ if (dropped.length) for (const stbl of tables) {
28503
+ const { chunks, offsetOf } = chunkOffsets(moov, stbl);
28504
+ for (let i = 0; i < chunks; i++) {
28505
+ const offset = offsetOf(i);
28506
+ check(!dropped.some(([start, end]) => offset >= start && offset < end));
28507
+ }
28508
+ }
28509
+ check(!fragmented || !metadata);
28510
+ const sizes = dropped.length && fragmented ? defaultSampleSizes(moov) : void 0;
28511
+ for (const box of top) if (box.type === "moof") {
28512
+ const moof = await whole(source, box);
28513
+ if (dropped.length) for (const [start, end] of fragmentRanges(moof, box.start, sizes ?? /* @__PURE__ */ new Map())) check(!dropped.some(([from, to]) => start < to && end > from));
28514
+ emptyWithin(moof, box.body - box.start, moof.length);
28515
+ patches.push({
28516
+ start: box.start,
28517
+ end: box.end,
28518
+ bytes: moof
28519
+ });
28520
+ } else if (SPACE.has(box.type)) {
28521
+ if (box.body < box.end) patches.push({
28522
+ start: box.body,
28523
+ end: box.end
28524
+ });
28525
+ } else if (!TOP_KEEPS.has(box.type)) {
28526
+ const head = await source.read(box.start, box.body - box.start);
28527
+ empty(head, {
28528
+ type: box.type,
28529
+ start: 0,
28530
+ body: head.length,
28531
+ end: head.length
28532
+ });
28533
+ patches.push({
28534
+ start: box.start,
28535
+ end: box.body,
28536
+ bytes: head
28537
+ }, {
28538
+ start: box.body,
28539
+ end: box.end
28540
+ });
28541
+ }
28542
+ const mdats = top.filter((box) => box.type === "mdat");
28543
+ const merged = [];
28544
+ for (const [start, end] of zeroed.sort((a, b) => a[0] - b[0])) {
28545
+ check(mdats.some((mdat) => start >= mdat.body && end <= mdat.end));
28546
+ const last = merged[merged.length - 1];
28547
+ if (last && start <= last[1]) last[1] = Math.max(last[1], end);
28548
+ else merged.push([start, end]);
28549
+ }
28550
+ for (const [start, end] of merged) patches.push({
28551
+ start,
28552
+ end
28553
+ });
28554
+ let at = 0;
28555
+ for (const patch of patches.sort((a, b) => a.start - b.start)) {
28556
+ check(patch.start >= at);
28557
+ at = patch.end;
28558
+ }
28559
+ return patches;
28560
+ }
28561
+ //#endregion
27094
28562
  //#region ../core/src/payments.ts
27095
28563
  /**
27096
28564
  * Payments between two linked peers. Ghostly does not move money itself: it
@@ -30803,10 +32271,11 @@ function groupMetaNewer(a, b) {
30803
32271
  /**
30804
32272
  * The revision of the next statement signed under `epoch`: one past the held statement's under the same epoch, else 1.
30805
32273
  * Counting on from a statement of an earlier epoch would let a former admin who signed the highest safe revision leave
30806
- * every later admin with a revision no member accepts.
32274
+ * every later admin with a revision no member accepts. Never under `floor` (WISP 06 § Raised counters): a copy started
32275
+ * from older state signs above every revision the device it replaced may have signed under the same commit.
30807
32276
  */
30808
- function nextGroupMetaRevision(before, epoch) {
30809
- return before && before.e === epoch ? before.r + 1 : 1;
32277
+ function nextGroupMetaRevision(before, epoch, floor = 0) {
32278
+ return Math.max(before && before.e === epoch ? before.r + 1 : 1, Number.isSafeInteger(floor) ? floor : 0);
30810
32279
  }
30811
32280
  /**
30812
32281
  * Statements a member keeps from before the one it holds, oldest first, so it can hand a member back from away each
@@ -31180,10 +32649,11 @@ var GROUP_LIMITS = {
31180
32649
  secretsPerFrame: 16,
31181
32650
  /**
31182
32651
  * Other members' messages kept to hand on to a member who missed them (any member catches up the others): count
31183
- * and total ciphertext bytes. The oldest go first.
32652
+ * and total bytes as `frameBytes` counts them. The oldest go first. The bytes hold 256 texts of `textBytes` (about
32653
+ * 22 KB each as a frame), so only messages carrying boxes beside a long text give way before their count.
31184
32654
  */
31185
32655
  relay: 256,
31186
- relayBytes: 262144,
32656
+ relayBytes: 6291456,
31187
32657
  /** Other members' edits kept to hand on, the latest per message (WISP 902 § Edits): count and ciphertext bytes. */
31188
32658
  relayEdits: 64,
31189
32659
  relayEditBytes: 524288,
@@ -31215,7 +32685,9 @@ var GROUP_LIMITS = {
31215
32685
  /** Between two slices, when the member's app cannot say it handled one (`handled` resolves `false`). */
31216
32686
  catchUpPauseMs: 500,
31217
32687
  /** A received message is in the saved state within this long (`persistSoon`): a burst of them is one save, not one each. */
31218
- saveWithinMs: 1e3
32688
+ saveWithinMs: 1e3,
32689
+ /** New name records of one member taken in `syncWindowMs` (WISP 902 § Messages, "The name record"): one a rename. */
32690
+ namesPerMember: 4
31219
32691
  };
31220
32692
  /** What every member should know about who can read what, in the words the apps show. */
31221
32693
  var GROUP_READ_NOTE = `Everyone in the group can read everything sent while they are a member. Someone removed keeps what they already received and cannot read what comes after; someone who joins later cannot read what came before. Messages go to each member; whoever was away gets what they missed from any member who has it (the group's last ${GROUP_LIMITS.relay} messages) when they meet again.`;
@@ -31223,7 +32695,7 @@ var GROUP_READ_NOTE = `Everyone in the group can read everything sent while they
31223
32695
  * After my sync to a member, how long what comes from it may be its answer (a catch-up), and after each frame of the
31224
32696
  * answer: slices go one after another, each once my app handled the last (`CATCH_UP_PAUSE_MS` at most between them).
31225
32697
  */
31226
- var ANSWER_WINDOW_MS = 5e3;
32698
+ var ANSWER_WINDOW_MS$1 = 5e3;
31227
32699
  var MAX_TEXT_BOX$1 = Math.ceil((GROUP_LIMITS.textBytes + 16) * 4 / 3) + 4;
31228
32700
  /** Sixteen mentions as JSON, each a key and two offsets, with room to spare, sealed. */
31229
32701
  var MAX_MENTIONS_BOX = Math.ceil((MENTION_LIMITS.count * 96 + 16) * 4 / 3) + 4;
@@ -31291,6 +32763,37 @@ var nickSigned = (f, nk) => utf8Encode(JSON.stringify([
31291
32763
  nk.c
31292
32764
  ]));
31293
32765
  var isNickBox = isSealedBox(MAX_NICK_BOX);
32766
+ /** A name record's box: the name as JSON (each character escaped at worst) and the signature. */
32767
+ var MAX_NAME_BOX = Math.ceil(1216) + 4;
32768
+ var nameSigned = (g, k, v, nm) => utf8Encode(JSON.stringify([
32769
+ "ghostly-group/1 name",
32770
+ g,
32771
+ k,
32772
+ v,
32773
+ nm
32774
+ ]));
32775
+ var nameAad = (f) => JSON.stringify([
32776
+ "ghostly-group/1 name",
32777
+ f.g,
32778
+ f.e,
32779
+ f.k,
32780
+ f.v
32781
+ ]);
32782
+ /** A name record's frame as it came, its fields checked, or null. */
32783
+ function readNameFrame(v) {
32784
+ if (!v || typeof v !== "object") return null;
32785
+ const f = v;
32786
+ if (f.t !== "group-name" || typeof f.g !== "string" || !GROUP_ID.test(f.g) || !Number.isSafeInteger(f.e) || f.e < 0 || typeof f.k !== "string" || !MEMBER_KEY.test(f.k) || !Number.isSafeInteger(f.v) || f.v <= 0 || typeof f.nn !== "string" || f.nn.length !== 32 || !B64$1.test(f.nn) || typeof f.c !== "string" || f.c.length > MAX_NAME_BOX || !B64$1.test(f.c)) return null;
32787
+ return {
32788
+ t: "group-name",
32789
+ g: f.g,
32790
+ e: f.e,
32791
+ k: f.k,
32792
+ v: f.v,
32793
+ nn: f.nn,
32794
+ c: f.c
32795
+ };
32796
+ }
31294
32797
  var isSignature = (v) => typeof v === "string" && v.length === 86 && B64$1.test(v);
31295
32798
  var B64$1 = /^[A-Za-z0-9_-]*$/;
31296
32799
  var secretAad$1 = (g, e, member) => JSON.stringify([
@@ -31554,8 +33057,15 @@ var GroupSession = class {
31554
33057
  asked = /* @__PURE__ */ new Map();
31555
33058
  /** The signed leave of each member I last passed on, kept for an admin that was away (`byesHeld`). In memory only. */
31556
33059
  byesPassed = /* @__PURE__ */ new Map();
31557
- /** Member → when the name I hold for it was said: its message's time, or the moment an edge said it (`heardName`). In memory only. */
33060
+ /**
33061
+ * Member → when the name I hold for it was said: its message's time, its name record's version, or the moment an edge
33062
+ * said it (`heardName`). In memory only; the records held start it.
33063
+ */
31558
33064
  nickAt = /* @__PURE__ */ new Map();
33065
+ /** The version of my name record last said to every member (`sayName`). In memory only: said again once per start. */
33066
+ nameSaid;
33067
+ /** New name records taken per member, a few a minute (`GROUP_LIMITS.namesPerMember`). In memory only. */
33068
+ namesTaken = /* @__PURE__ */ new Map();
31559
33069
  queue = Promise.resolve();
31560
33070
  /** One metadata frame that names a commit or an epoch I do not have yet: tried again when the chain moves. */
31561
33071
  pendingMeta;
@@ -31623,6 +33133,7 @@ var GroupSession = class {
31623
33133
  key: (frame) => frame.t === "group-msg" ? frameKey$1(frame) : frame.t === "group-commit" ? `commit:${frame.commit.e}` : void 0
31624
33134
  });
31625
33135
  this.provisional = new Set((state.provisional ?? []).slice(-GROUP_LIMITS.provisional));
33136
+ for (const [key, record] of Object.entries(state.names ?? {})) this.nickAt.set(key, record.v);
31626
33137
  this.chainMovedAt = this.clock();
31627
33138
  }
31628
33139
  clock() {
@@ -31748,23 +33259,19 @@ var GroupSession = class {
31748
33259
  }
31749
33260
  /**
31750
33261
  * Whether `key` could read message `messageId` (`<s>:<e>:<n>`) and still can: in the roster now, and in the roster of
31751
- * its epoch or, given the message's time `ts`, in the roster of the epoch its author, behind on the chain, said it
31752
- * again under (`saidAgainEpoch`): the newest after its own that comes before any `add` dated later than it. That
31753
- * member read it under its first id. A holder serves a group file only to such a member (WISP 503 § Asking).
31754
- */
31755
- couldRead(key, messageId, ts) {
31756
- const e = Number(messageId.split(":")[1]);
31757
- const then = this.state.chain.find((c) => c.e === e);
31758
- if (!then || !rosterHas(this.roster, key)) return false;
33262
+ * its epoch, or of an epoch it was said again under (its author was behind, `resealBehind`): `arrived`, the one its
33263
+ * copy reached this device under, or, for a message of mine, one I said it again under. That member read it under its
33264
+ * first id. Decided by the epochs a frame was sealed under, never by comparing two devices' clocks. A holder serves a
33265
+ * group file only to such a member (WISP 503 § Asking).
33266
+ */
33267
+ couldRead(key, messageId, arrived) {
33268
+ const ref = meshMessageRef(messageId);
33269
+ const then = ref && this.state.chain[ref.e];
33270
+ if (!ref || !then || !rosterHas(this.roster, key)) return false;
31759
33271
  if (rosterHas(then.m, key)) return true;
31760
- if (ts === void 0) return false;
31761
- let again;
31762
- for (let later = e + 1; later <= this.epoch; later++) {
31763
- const c = this.state.chain[later];
31764
- if (!c || c.k === "add" && c.ts > ts) break;
31765
- again = c;
31766
- }
31767
- return !!again && rosterHas(again.m, key);
33272
+ const again = ref.s === this.myKey ? this.state.sent.filter((f) => f.o?.e === ref.e && f.o.n === ref.n).map((f) => f.e) : [];
33273
+ if (arrived !== void 0 && arrived > ref.e) again.push(arrived);
33274
+ return again.some((e) => rosterHas(this.state.chain[e]?.m ?? [], key));
31768
33275
  }
31769
33276
  role(key) {
31770
33277
  return this.roster.find(([k]) => k === key)?.[1];
@@ -32130,11 +33637,19 @@ var GroupSession = class {
32130
33637
  const epochs = Object.keys(this.state.secrets).map(Number).sort((a, b) => a - b);
32131
33638
  for (const e of epochs.slice(0, Math.max(0, epochs.length - GROUP_LIMITS.secrets))) delete this.state.secrets[e];
32132
33639
  }
32133
- /** Leaves: my secrets go now; the admin removes me from the roster when it hears. */
32134
- leave() {
33640
+ /**
33641
+ * Leaves: my secrets go now; the admin removes me from the roster when it hears. `pick`: whom an admin with other
33642
+ * members hands the role to first, in the same turn. The role can reach me while my leave is under way (a hand-over
33643
+ * said at the same moment, agents#2890): without it the leave is refused, and the role would end with me.
33644
+ */
33645
+ leave(pick) {
32135
33646
  return this.serialize(async () => {
32136
33647
  if (this.state.status !== "active") return;
32137
- if (this.isAdmin && this.others.length) throw new Error("Make someone else the admin before leaving");
33648
+ if (this.isAdmin && this.others.length) {
33649
+ const next = pick?.();
33650
+ if (!next || next === this.myKey || !rosterHas(this.roster, next)) throw new Error("Make someone else the admin before leaving");
33651
+ await this.commit("role", next, Date.now());
33652
+ }
32138
33653
  const admin = this.admin;
32139
33654
  this.out("left", "You left this group");
32140
33655
  await this.persist();
@@ -32145,6 +33660,45 @@ var GroupSession = class {
32145
33660
  this.hooks.changed();
32146
33661
  });
32147
33662
  }
33663
+ /**
33664
+ * After I left (WISP 902 § Admission and departure, "A role that reaches a leave"): the next commit of my chain, by the
33665
+ * admin of its tip, that keeps me in the roster. Kept, without its secret, so that my leave follows the role to whoever
33666
+ * holds it now, and a role that names me goes on (`handOnAfterLeave`). True when taken. The commit that takes me out
33667
+ * is the end of the leave, which the engine reads itself.
33668
+ */
33669
+ followAfterLeave(raw) {
33670
+ return this.serialize(async () => {
33671
+ if (this.state.status !== "left" || !raw || typeof raw !== "object") return false;
33672
+ const frame = raw;
33673
+ if (frame.t !== "group-commit" || frame.g !== this.id) return false;
33674
+ const result = verifyCommit(frame.commit, this.top, this.id);
33675
+ if ("error" in result || !rosterHas(result.commit.m, this.myKey)) return false;
33676
+ this.state.chain.push(result.commit);
33677
+ this.chainMovedAt = this.clock();
33678
+ this.takeLeftMark(result.commit, frame.left);
33679
+ await this.persist();
33680
+ return true;
33681
+ });
33682
+ }
33683
+ /**
33684
+ * After I left, a chain that names me the admin (a hand-over that crossed my leave): the role goes on to
33685
+ * `pick(<the member who handed it to me>)` with a `role` commit of mine, as an admin's leave hands it. Its secret is
33686
+ * sealed to the members as any commit's, and not kept: I am gone. True when it went.
33687
+ */
33688
+ handOnAfterLeave(pick, now = Date.now()) {
33689
+ return this.serialize(async () => {
33690
+ if (this.state.status !== "left" || this.admin !== this.myKey) return false;
33691
+ const next = pick(this.top.by);
33692
+ if (!next || next === this.myKey || !rosterHas(this.roster, next)) return false;
33693
+ try {
33694
+ await this.commit("role", next, now);
33695
+ } finally {
33696
+ this.state.secrets = {};
33697
+ }
33698
+ await this.persist();
33699
+ return true;
33700
+ });
33701
+ }
32148
33702
  /** Told out of band (the admin's contact chat) that I was removed, before or instead of the commit. */
32149
33703
  markRemoved() {
32150
33704
  return this.serialize(async () => {
@@ -32435,7 +33989,7 @@ var GroupSession = class {
32435
33989
  * member it goes to, whose frames for a while may be its answer, a catch-up (never `live`).
32436
33990
  */
32437
33991
  syncFrame(ask = [], to) {
32438
- if (to) this.answering.set(to, this.now() + ANSWER_WINDOW_MS);
33992
+ if (to) this.answering.set(to, this.now() + ANSWER_WINDOW_MS$1);
32439
33993
  const have = {};
32440
33994
  const miss = {};
32441
33995
  for (const [sender, epochs] of Object.entries(this.state.seen)) {
@@ -32447,6 +34001,7 @@ var GroupSession = class {
32447
34001
  }
32448
34002
  }
32449
34003
  const wanted = ask.filter((k) => k !== this.myKey && rosterHas(this.roster, k));
34004
+ this.ownName();
32450
34005
  return {
32451
34006
  t: "group-sync",
32452
34007
  g: this.id,
@@ -32456,9 +34011,125 @@ var GroupSession = class {
32456
34011
  secrets: this.readableEpochs,
32457
34012
  mt: groupMetaTag(this.state.meta),
32458
34013
  ...Object.keys(miss).length ? { miss } : {},
32459
- ...wanted.length ? { ask: wanted } : {}
34014
+ ...wanted.length ? { ask: wanted } : {},
34015
+ nt: this.namesTag()
34016
+ };
34017
+ }
34018
+ /** Which name records I hold, of members in the roster: a sync whose tag differs is answered with them all. */
34019
+ namesTag() {
34020
+ return sha256Hex(utf8Encode(Object.entries(this.state.names ?? {}).filter(([key]) => rosterHas(this.roster, key)).map(([key, r]) => `${key}.${r.v}`).sort().join(","))).slice(0, 16);
34021
+ }
34022
+ /**
34023
+ * My name record, signed again when the name my app shares changed since, and once after my counters were raised (WISP
34024
+ * 06 § Raised counters): a copy from older state holds the record from before any rename the device it replaces made
34025
+ * since, which every other member holds newer. None while my app shares no name.
34026
+ */
34027
+ ownName() {
34028
+ const nm = sanitizeNick(this.hooks.nick?.());
34029
+ if (this.state.status !== "active" || nm === void 0) return void 0;
34030
+ const held = this.state.names?.[this.myKey], floor = this.seqFloor();
34031
+ if (held?.nm === nm && (held.nf ?? 0) >= floor) return held;
34032
+ const v = Math.max(this.clock(), (held?.v ?? 0) + 1);
34033
+ const record = {
34034
+ v,
34035
+ nm,
34036
+ sig: toBase64Url(sign(nameSigned(this.id, this.myKey, v, nm), this.identity.seed)),
34037
+ ...floor ? { nf: floor } : {}
34038
+ };
34039
+ (this.state.names ??= {})[this.myKey] = record;
34040
+ this.persistSoon();
34041
+ return record;
34042
+ }
34043
+ /** `key`'s record sealed under my current epoch, or none. */
34044
+ nameFrameOf(key, record) {
34045
+ const secret = this.secret(this.epoch);
34046
+ if (!secret) return void 0;
34047
+ const header = {
34048
+ g: this.id,
34049
+ e: this.epoch,
34050
+ k: key,
34051
+ v: record.v
34052
+ };
34053
+ const { n: nn, c } = encryptText(epochKeys(secret, this.id, this.epoch).message, nameAad(header), JSON.stringify({
34054
+ nm: record.nm,
34055
+ sig: record.sig
34056
+ }));
34057
+ return {
34058
+ t: "group-name",
34059
+ ...header,
34060
+ nn,
34061
+ c
32460
34062
  };
32461
34063
  }
34064
+ /** My name record, for an edge that just opened; none while my app shares no name. */
34065
+ nameFrame() {
34066
+ const record = this.ownName();
34067
+ return record && this.nameFrameOf(this.myKey, record);
34068
+ }
34069
+ /**
34070
+ * On each tick: my name record to every member, once per start and again when the name my app shares changes. Past
34071
+ * 16 members most have no edge with me: hubs pass it on, and whoever holds it hands it over at sync.
34072
+ */
34073
+ sayName() {
34074
+ return this.serialize(async () => {
34075
+ const record = this.ownName();
34076
+ if (!record || record.v === this.nameSaid) return;
34077
+ const frame = this.nameFrameOf(this.myKey, record);
34078
+ if (!frame) return;
34079
+ this.nameSaid = record.v;
34080
+ for (const key of this.others) this.hooks.send(key, frame);
34081
+ });
34082
+ }
34083
+ /** Every record I hold of members in the roster but `to`, sealed under my current epoch, for a sync whose tag differs from mine. */
34084
+ namesFor(to, theirTag) {
34085
+ if (typeof theirTag !== "string") return [];
34086
+ this.ownName();
34087
+ if (theirTag === this.namesTag()) return [];
34088
+ return Object.entries(this.state.names ?? {}).filter(([key]) => key !== to && rosterHas(this.roster, key)).map(([key, record]) => this.nameFrameOf(key, record)).filter((f) => !!f);
34089
+ }
34090
+ /**
34091
+ * A member's name record, from its edge or handed on: taken when it is newer than the one I hold, both the member and
34092
+ * whoever handed it are in the roster, its box opens and the member's signature holds. Its name shows when it is newer
34093
+ * than the last one a message or an edge said. A few new ones a minute per member; passed on the first time only.
34094
+ */
34095
+ async receiveName(from, raw) {
34096
+ const frame = readNameFrame(raw);
34097
+ if (!frame || frame.k === this.myKey || !rosterHas(this.roster, from) || !rosterHas(this.roster, frame.k) || frame.e > this.epoch) return;
34098
+ if (frame.v <= (this.state.names?.[frame.k]?.v ?? 0)) return;
34099
+ const secret = this.secret(frame.e);
34100
+ if (!secret) return;
34101
+ const plain = decryptText(epochKeys(secret, this.id, frame.e).message, nameAad(frame), frame.nn, frame.c);
34102
+ if (plain === null) return;
34103
+ let body;
34104
+ try {
34105
+ body = JSON.parse(plain);
34106
+ } catch {
34107
+ return;
34108
+ }
34109
+ if (!body || typeof body !== "object" || typeof body.nm !== "string" || sanitizeNick(body.nm) !== body.nm || !isSignature(body.sig)) return;
34110
+ try {
34111
+ if (!verify(fromBase64Url(body.sig), nameSigned(this.id, frame.k, frame.v, body.nm), publicKeyFromZ32(frame.k))) return;
34112
+ } catch {
34113
+ return;
34114
+ }
34115
+ let taken = this.namesTaken.get(frame.k);
34116
+ if (!taken) this.namesTaken.set(frame.k, taken = new RateWindow(GROUP_LIMITS.namesPerMember, GROUP_LIMITS.syncWindowMs, () => this.clock()));
34117
+ if (!taken.take()) return;
34118
+ (this.state.names ??= {})[frame.k] = {
34119
+ v: frame.v,
34120
+ nm: body.nm,
34121
+ sig: body.sig
34122
+ };
34123
+ if (frame.v > (this.nickAt.get(frame.k) ?? 0)) {
34124
+ this.nickAt.set(frame.k, frame.v);
34125
+ if (this.state.nicks[frame.k] !== body.nm) {
34126
+ this.state.nicks[frame.k] = body.nm;
34127
+ this.hooks.changed();
34128
+ }
34129
+ }
34130
+ this.persistSoon();
34131
+ this.took(frame);
34132
+ }
32462
34133
  /** Sequence numbers below the highest seen that never arrived, the newest `miss` of them. */
32463
34134
  gaps(entry) {
32464
34135
  const got = new Set(entry.window), gaps = [];
@@ -32512,6 +34183,9 @@ var GroupSession = class {
32512
34183
  case "group-bye":
32513
34184
  await this.receiveBye(from, raw);
32514
34185
  break;
34186
+ case "group-name":
34187
+ await this.receiveName(from, raw);
34188
+ break;
32515
34189
  case "group-leave": if (this.isAdmin && this.hooks.adminWork?.() !== false && rosterHas(this.roster, from) && from !== this.myKey) await this.commitUnlessTurnUnconfirmed("remove", from, true);
32516
34190
  }
32517
34191
  return this.state.status === "active" ? this.passOn : this.state.status === "removed" ? this.passOn.filter((f) => f.t === "group-commit") : [];
@@ -32674,7 +34348,7 @@ var GroupSession = class {
32674
34348
  }
32675
34349
  const relayed = raw.s !== from;
32676
34350
  const now = this.now(), answer = (this.answering.get(from) ?? 0) > now;
32677
- if (answer) this.answering.set(from, now + ANSWER_WINDOW_MS);
34351
+ if (answer) this.answering.set(from, now + ANSWER_WINDOW_MS$1);
32678
34352
  if (relayed && (!rosterHas(this.roster, from) || !this.handsOn(raw.s))) return;
32679
34353
  if (this.isDuplicate(raw)) return;
32680
34354
  const signedWhole = relayed && this.wholeSigned(raw);
@@ -32966,7 +34640,7 @@ var GroupSession = class {
32966
34640
  const raw = frame.commit;
32967
34641
  if (!raw || typeof raw !== "object" || !Number.isSafeInteger(raw.e)) return;
32968
34642
  const e = raw.e;
32969
- if (this.awaitsAnswer(from)) this.answering.set(from, this.now() + ANSWER_WINDOW_MS);
34643
+ if (this.awaitsAnswer(from)) this.answering.set(from, this.now() + ANSWER_WINDOW_MS$1);
32970
34644
  if (e <= this.epoch) {
32971
34645
  const known = this.state.chain[e];
32972
34646
  const result = verifyCommit(raw, this.state.chain[e - 1] ?? null, this.id);
@@ -33034,6 +34708,7 @@ var GroupSession = class {
33034
34708
  if (sealed) this.takeSecret(commit.e, sealed);
33035
34709
  this.pruneSecrets();
33036
34710
  this.pruneRelay();
34711
+ for (const key of Object.keys(this.state.names ?? {})) if (!rosterHas(commit.m, key)) delete this.state.names[key];
33037
34712
  this.persistSoon();
33038
34713
  this.hooks.changed();
33039
34714
  await this.replayWaiting();
@@ -33121,6 +34796,7 @@ var GroupSession = class {
33121
34796
  const gone = (this.state.relayEdits ?? []).filter((f) => !rosterHas(this.roster, f.s) && readable(f) && !handed?.has(editKey(f)));
33122
34797
  answer.push(...gone.slice(-GROUP_LIMITS.handOnEdits));
33123
34798
  answer.push(...metas.map((m) => m.frame));
34799
+ answer.push(...this.namesFor(from, frame.nt));
33124
34800
  this.handOut(from, answer);
33125
34801
  }
33126
34802
  /**
@@ -33192,14 +34868,22 @@ var GroupSession = class {
33192
34868
  }), now);
33193
34869
  });
33194
34870
  }
33195
- /** Signs a body under my current commit, keeps it and sends it to every member. Inside `serialize`. */
33196
- async publishMeta(body, now) {
34871
+ /**
34872
+ * Signs a body under my current commit, keeps it and sends it to every member. Inside `serialize`. Like a commit, only
34873
+ * with admin work on and a good turn read (WISP 06 § Forced takeover): refused otherwise, or, `quiet`, not made.
34874
+ */
34875
+ async publishMeta(body, now, quiet = false) {
34876
+ const refused = this.hooks.adminWork?.() === false ? new Error(GROUP_ADMIN_OFF_ERROR) : this.hooks.adminTurn && !await this.hooks.adminTurn() ? engineError("groupTurnUnconfirmed") : void 0;
34877
+ if (refused) {
34878
+ if (quiet) return;
34879
+ throw refused;
34880
+ }
33197
34881
  const before = this.state.meta;
33198
34882
  const meta = signGroupMeta({
33199
34883
  g: this.id,
33200
34884
  e: this.epoch,
33201
34885
  h: commitHash(this.top),
33202
- r: nextGroupMetaRevision(before, this.epoch),
34886
+ r: nextGroupMetaRevision(before, this.epoch, this.seqFloor()),
33203
34887
  ts: now
33204
34888
  }, body, this.identity.seed, this.myKey);
33205
34889
  this.state.meta = meta;
@@ -33294,7 +34978,7 @@ var GroupSession = class {
33294
34978
  const pending = this.pendingMeta;
33295
34979
  this.pendingMeta = void 0;
33296
34980
  if (pending) await this.receiveMeta(pending.from, pending.frame);
33297
- if (this.isAdmin && this.state.meta && this.state.meta.by !== this.myKey) await this.publishMeta(this.state.meta.body, this.state.meta.ts);
34981
+ if (this.isAdmin && this.state.meta && this.state.meta.by !== this.myKey) await this.publishMeta(this.state.meta.body, this.state.meta.ts, true);
33298
34982
  }
33299
34983
  async fork(reason) {
33300
34984
  if (this.state.status !== "active") return;
@@ -33564,6 +35248,8 @@ var COMMUNITY_LIMITS = {
33564
35248
  replay: 256,
33565
35249
  /** Commits in one welcome or chain piece. */
33566
35250
  chainPiece: 100,
35251
+ /** Admissions members other than the admin may commit in a row while the admin is away (`memberAdmissions`). */
35252
+ memberAdmissions: 32,
33567
35253
  pendingLeaves: 64,
33568
35254
  /** Leaves whose mark (`group-left`) is kept, and the epochs one names. */
33569
35255
  leftMarks: 64,
@@ -33590,8 +35276,18 @@ var COMMUNITY_LIMITS = {
33590
35276
  */
33591
35277
  catchUpSlice: 16,
33592
35278
  /** Between two slices, when the member's app cannot say it handled one (`handled` resolves `false`). */
33593
- catchUpPauseMs: 500
35279
+ catchUpPauseMs: 500,
35280
+ /**
35281
+ * A message a member handed on with its live mark (`lv`, WISP 903 § Relaying) is live here only when the time it says
35282
+ * is at most this long before my clock: the mark is that member's word, and past this it would make a catch-up ring.
35283
+ */
35284
+ liveMarkMs: 6e5
33594
35285
  };
35286
+ /**
35287
+ * After I send a member my sync: how long what comes over its edge may be its answer (a catch-up, never `live`). Each
35288
+ * frame of the answer keeps it open, since it goes a slice at a time. As a private group's.
35289
+ */
35290
+ var ANSWER_WINDOW_MS = 5e3;
33595
35291
  /** What every member should know about who can read what, and what the link does, in the words the apps show. */
33596
35292
  var GROUP_READ_NOTE_COMMUNITY = `Anyone with the group's link can join, and any member can let people in. Everyone in the group can read everything sent while they are a member; someone removed cannot read what comes after, someone who joins later cannot read what came before. Members who were away get the last ${COMMUNITY_LIMITS.store} messages from whoever is there when they return.`;
33597
35293
  /** A community group's link: `group2/<group id>/<entry key>` (web: `#/join/group2/…`). */
@@ -33657,6 +35353,23 @@ var ADMIN_ONLY = /* @__PURE__ */ new Set([
33657
35353
  "rotate",
33658
35354
  "link"
33659
35355
  ]);
35356
+ /**
35357
+ * The admissions signed by members other than `admin` on a branch (`before`: its commits, newest first) since the admin
35358
+ * last let someone in, rotated, changed the link or handed the role on, or since the group began. A removal or a leave
35359
+ * the admin commits does not count as the admin being there: its app commits leaves by itself, and a removal while
35360
+ * the admin clears keys let in would otherwise make room for as many more each time. An admission is a member's
35361
+ * right, and costs nothing: a key nobody holds is as good as anyone's, so without a bound one member could fill the
35362
+ * group to its cap in seconds. `COMMUNITY_LIMITS.memberAdmissions` in a row, then the admin's turn.
35363
+ */
35364
+ function memberAdmissions(admin, before) {
35365
+ let n = 0;
35366
+ for (const c of before) {
35367
+ if (c.k === "create" || c.k === "role" || c.by === admin && c.k !== "remove" && c.k !== "leave") break;
35368
+ if (c.k === "add") n++;
35369
+ }
35370
+ return n;
35371
+ }
35372
+ var MEMBER_ADMISSIONS_ERROR = "Members can let no one else in until the admin does";
33660
35373
  var HASH = /^[a-f0-9]{64}$/;
33661
35374
  var TAG = /^[A-Za-z0-9_-]{43}$/;
33662
35375
  var SIG = /^[A-Za-z0-9_-]{86}$/;
@@ -33845,6 +35558,8 @@ async function verifyCommunityChainPaced(raw, groupId) {
33845
35558
  }
33846
35559
  /** `verifyCommunityChainPaced` checks commits for this long at most before it lets the thread go. */
33847
35560
  var CHAIN_SLICE_MS = 5;
35561
+ /** A fresh epoch's secret is sealed to members for this long at most before the thread goes (`CommunitySession.commit`). */
35562
+ var SEAL_SLICE_MS = 5;
33848
35563
  /** The chain's checks, one commit per step. */
33849
35564
  function* checkChain(raw, groupId) {
33850
35565
  if (!Array.isArray(raw) || raw.length === 0 || raw.length > COMMUNITY_LIMITS.chain) return { error: "Malformed membership chain" };
@@ -33969,6 +35684,8 @@ var MessagePace = class {
33969
35684
  var frameKey = (f) => `${f.e}:${f.h}:${f.n}`;
33970
35685
  /** A frame among everyone's: each member counts its own `n`, so `frameKey` alone tells only one member's frames apart. */
33971
35686
  var storeKey = (f) => `${f.s}:${frameKey(f)}`;
35687
+ /** A new link's entry seed is sealed to members for this long at most before the thread goes (`replaceLink`). */
35688
+ var ENTRY_SLICE_MS = 5;
33972
35689
  /**
33973
35690
  * Where a frame said again under a newer commit was first said (`o`, WISP 903 § Messages and catch-up): its commit's
33974
35691
  * epoch and short hash and its number there. Never the frame's own place, nor a later epoch than its own.
@@ -34058,6 +35775,10 @@ var CommunitySession = class CommunitySession {
34058
35775
  waiting = [];
34059
35776
  waitingBytes = 0;
34060
35777
  asked = /* @__PURE__ */ new Map();
35778
+ /** Per member: until when what comes over its edge may be its answer to my sync (`ANSWER_WINDOW_MS`). In memory only. */
35779
+ answering = /* @__PURE__ */ new Map();
35780
+ /** The message frames given to `handle` that came live here (`CommunityIncomingMessage.live`): `passOn` marks them. */
35781
+ cameLive = /* @__PURE__ */ new WeakSet();
34061
35782
  /** Syncs answered per member, a few a minute (`COMMUNITY_LIMITS.syncAnswers`). In memory only. */
34062
35783
  syncsAnswered = /* @__PURE__ */ new Map();
34063
35784
  /** Messages taken per author, a few a second (`MessagePace`). In memory only. */
@@ -34076,6 +35797,8 @@ var CommunitySession = class CommunitySession {
34076
35797
  pendingMeta;
34077
35798
  /** The store's frames the app holds with their messages (`storeKey` → message id): in memory here, not in what is saved. */
34078
35799
  onRows = /* @__PURE__ */ new Map();
35800
+ /** The oldest epoch whose seen marks are kept, as of the last `pruneSeen`. In memory only. */
35801
+ seenFrom = -1;
34079
35802
  /** `rows`: the frames the app holds with the messages it stored (`CommunityIncomingMessage.frame`). They join the store. */
34080
35803
  constructor(state, hooks, rows = []) {
34081
35804
  this.hooks = hooks;
@@ -34090,6 +35813,7 @@ var CommunitySession = class CommunitySession {
34090
35813
  key: (frame) => frame.t === "group-msg" ? communityMessageId(frame.s, frame.e, frame.h, frame.n) : frame.t === "group-commit" ? `commit:${communityCommitHash(frame.commit)}` : frame.t === "group-secret" ? `secret:${frame.h}` : void 0
34091
35814
  });
34092
35815
  this.rebuild();
35816
+ this.pruneSeen();
34093
35817
  if ((state.status === "active" || state.status === "lost") && this.bestBranch().tip !== this.topHash) this.serialize(() => this.chooseBranch());
34094
35818
  }
34095
35819
  static create(name, now = Date.now()) {
@@ -34577,7 +36301,7 @@ var CommunitySession = class CommunitySession {
34577
36301
  this.state.chain.forEach((c, i) => counts.push((i ? counts[i - 1] : 0) + (ADMIN_ONLY.has(c.k) ? 1 : 0)));
34578
36302
  return counts;
34579
36303
  }
34580
- /** What each of two branches holds after their common parent: whether it has an admin change, and its first commit. */
36304
+ /** What each of two branches holds after their common parent: whether it has an admin change, its first commit, and its hand-overs. */
34581
36305
  parting(a, b, counts) {
34582
36306
  const m = Math.min(a.fork, b.fork);
34583
36307
  let shared = 0;
@@ -34585,34 +36309,73 @@ var CommunitySession = class CommunitySession {
34585
36309
  const parent = shared ? this.known.get(a.path[shared - 1]).e : this.state.chain[m].e;
34586
36310
  const side = (x) => {
34587
36311
  const path = x.path.slice(shared);
36312
+ const admin = counts[x.fork] - counts[m] > 0 || path.some((h) => ADMIN_ONLY.has(this.known.get(h).k));
34588
36313
  return {
34589
- admin: counts[x.fork] - counts[m] > 0 || path.some((h) => ADMIN_ONLY.has(this.known.get(h).k)),
34590
- first: x.fork > m ? communityCommitHash(this.state.chain[m + 1]) : path[0] ?? ""
36314
+ admin,
36315
+ first: x.fork > m ? communityCommitHash(this.state.chain[m + 1]) : path[0] ?? "",
36316
+ roles: !admin ? [] : [...this.state.chain.slice(m + 1, x.fork + 1).filter((c) => c.k === "role").map((c) => communityCommitHash(c)), ...path.filter((h) => this.known.get(h).k === "role")]
34591
36317
  };
34592
36318
  };
34593
36319
  const sa = side(a), sb = side(b);
34594
36320
  return {
34595
36321
  parent,
34596
36322
  admin: [sa.admin, sb.admin],
34597
- first: [sa.first, sb.first]
36323
+ first: [sa.first, sb.first],
36324
+ roles: [sa.roles, sb.roles]
34598
36325
  };
34599
36326
  }
34600
36327
  /**
34601
- * Is branch `a` better than branch `b`? After their common parent: the one that keeps an admin
34602
- * change first, however short and however far back it parts; then the longer; then, parting within
34603
- * the window, the lower hash of the first commit. Both holding admin changes means the admin signed
34604
- * two histories: `b` stays (a fresh one halts the group, see `receiveCommit`).
36328
+ * Whether a hand-over (`h`, a `role`) went to a member whose leave of that admission I know on a branch that does not
36329
+ * hold the hand-over: signed on a view from before the leave, it would leave the role with someone gone for good (a
36330
+ * leave never names the admin). Not when that member signed a commit after the hand-over: it took the role while still
36331
+ * in, so its leave came later, and a branch from before the hand-over must not undo what it and later admins did.
36332
+ */
36333
+ handedToLeaver(h) {
36334
+ const role = this.known.get(h), at = this.mainIndex.get(h), fork = this.branch(h)?.fork;
36335
+ if (fork === void 0 || this.signedAfter(h, role.s)) return false;
36336
+ return [...at === void 0 ? this.state.chain.slice(fork + 1) : [], ...this.state.side].some((c) => {
36337
+ if (c.k !== "leave" || c.s !== role.s) return false;
36338
+ const b = this.branch(communityCommitHash(c));
36339
+ if (!b || (at !== void 0 ? b.fork >= at : b.path.includes(h))) return false;
36340
+ return leaveStands(c, this.ancestry(role.p));
36341
+ });
36342
+ }
36343
+ /** Whether `key` signed a commit I know that comes after `h` (on the main branch past it, or on a side branch through it). */
36344
+ signedAfter(h, key) {
36345
+ const at = this.mainIndex.get(h);
36346
+ if (!key) return false;
36347
+ if (at !== void 0 && this.state.chain.slice(at + 1).some((c) => c.by === key)) return true;
36348
+ return this.state.side.some((c) => {
36349
+ if (c.by !== key) return false;
36350
+ const b = this.branch(communityCommitHash(c));
36351
+ return !!b && (at !== void 0 ? b.fork >= at : b.path.includes(h));
36352
+ });
36353
+ }
36354
+ /**
36355
+ * Is branch `a` better than branch `b`? After their common parent: first, the one that does not hand the
36356
+ * role to a member who left (`handedToLeaver`); then the one that keeps an admin change, however short
36357
+ * and however far back it parts; then one I can read over one whose tip lists me and whose secret I lack;
36358
+ * then the longer; then, parting within the window, the lower hash of the first commit. Both holding admin changes means the admin signed two histories: `b` stays (a fresh one
36359
+ * halts the group, see `receiveCommit`).
34605
36360
  */
34606
36361
  better(a, b, counts) {
34607
36362
  if (a.tip === b.tip) return false;
34608
- const { parent, admin, first } = this.parting(a, b, counts);
36363
+ const { parent, admin, first, roles } = this.parting(a, b, counts);
36364
+ const toLeaver = roles.map((r) => r.some((h) => this.handedToLeaver(h)));
36365
+ if (toLeaver[0] !== toLeaver[1]) return toLeaver[1];
34609
36366
  if (admin[0] !== admin[1]) return admin[0];
34610
36367
  if (admin[0]) return false;
36368
+ const wa = this.awaitsSecret(a.tip), wb = this.awaitsSecret(b.tip);
36369
+ if (wa !== wb) return wb;
34611
36370
  const ea = this.known.get(a.tip).e, eb = this.known.get(b.tip).e;
34612
36371
  if (ea !== eb) return ea > eb;
34613
36372
  if (parent < this.epoch - COMMUNITY_LIMITS.window) return false;
34614
36373
  return first[0] < first[1];
34615
36374
  }
36375
+ /** A commit whose roster lists me and whose secret I do not hold (yet). */
36376
+ awaitsSecret(h) {
36377
+ return !this.state.secrets[h] && rosterHas(this.rosterAt(h) ?? [], this.myKey);
36378
+ }
34616
36379
  /**
34617
36380
  * Takes in a commit (from a frame or from me): placed in the tree if it verifies against its
34618
36381
  * parent, a fork if the admin signed another commit after the same parent, and then the best
@@ -34650,6 +36413,8 @@ var CommunitySession = class CommunitySession {
34650
36413
  if (!confirmationMatches(epochKeys(derivedSecret(fromBase64Url(previous), untagged), this.id, result.commit.e).confirm, untagged, result.commit.c)) return false;
34651
36414
  }
34652
36415
  if (GROWS.has(result.commit.k) && !keepsRoom(result.commit.e, result.roster)) return false;
36416
+ const parentAdmin = rosterAdmin(parentRoster);
36417
+ if (result.commit.k === "add" && result.commit.by !== parentAdmin && memberAdmissions(parentAdmin, this.ancestry(p)) >= COMMUNITY_LIMITS.memberAdmissions) return false;
34653
36418
  const commit = result.commit, h = communityCommitHash(commit);
34654
36419
  const admin = rosterAdmin(parentRoster);
34655
36420
  if (commit.by === admin) {
@@ -34667,7 +36432,7 @@ var CommunitySession = class CommunitySession {
34667
36432
  if (branch && branch.path.length) {
34668
36433
  const { admin } = this.parting(branch, this.branch(this.topHash), this.adminCounts());
34669
36434
  if (ADMIN_ONLY.has(commit.k) && admin[1]) {
34670
- if (commit.by !== this.admin) {
36435
+ if (commit.by !== this.admin || commit.k === "role" && this.handedToLeaver(h)) {
34671
36436
  this.known.delete(h);
34672
36437
  this.rosters.delete(h);
34673
36438
  return false;
@@ -34823,6 +36588,22 @@ var CommunitySession = class CommunitySession {
34823
36588
  }
34824
36589
  }
34825
36590
  this.pruneSecrets();
36591
+ this.pruneSeen();
36592
+ }
36593
+ /**
36594
+ * Seen marks of epochs older than the window go, every sender's, once the branch I follow moves past them: as
36595
+ * `markSeen` drops the sender's it marks. Before, only that sender's went, so a member who left or went quiet kept
36596
+ * an entry for every epoch it wrote in, and its window of numbers, for the life of the group (agents#2904). Those
36597
+ * within the window stay, a leaver's too: what it wrote before its leave is still taken up to its mark there.
36598
+ */
36599
+ pruneSeen() {
36600
+ const from = this.epoch - COMMUNITY_LIMITS.window;
36601
+ if (from === this.seenFrom) return;
36602
+ this.seenFrom = from;
36603
+ for (const [sender, bySender] of Object.entries(this.state.seen)) {
36604
+ for (const key of Object.keys(bySender)) if (Number(key.split(":")[0]) < from) delete bySender[key];
36605
+ if (!Object.keys(bySender).length) delete this.state.seen[sender];
36606
+ }
34826
36607
  }
34827
36608
  pruneSecrets() {
34828
36609
  const order = [...this.state.chain.slice(-COMMUNITY_LIMITS.window - 1), ...this.state.side].map((c) => communityCommitHash(c));
@@ -34927,6 +36708,7 @@ var CommunitySession = class CommunitySession {
34927
36708
  const roster = communityRoster(this.roster, draftBase);
34928
36709
  if (!roster || kind === "leave" && !leaveStands(draftBase, this.ancestry(parentHash))) throw new Error("This change is not allowed");
34929
36710
  if (GROWS.has(kind) && !keepsRoom(draftBase.e, roster)) throw new Error("This group has reached its membership history limit. Create a new group.");
36711
+ if (kind === "add" && !this.isAdmin && memberAdmissions(this.admin, this.ancestry(parentHash)) >= COMMUNITY_LIMITS.memberAdmissions) throw new Error(MEMBER_ADMISSIONS_ERROR);
34930
36712
  const draft = {
34931
36713
  ...draftBase,
34932
36714
  m: rosterHash(roster)
@@ -34960,14 +36742,18 @@ var CommunitySession = class CommunitySession {
34960
36742
  commit
34961
36743
  });
34962
36744
  if (FRESH.has(kind)) {
34963
- for (const [key] of roster) if (key !== this.myKey && isZ32Key(key)) this.hooks.addressed(key, {
34964
- t: "group-secret",
34965
- v: 2,
34966
- g: this.id,
34967
- to: key,
34968
- h: hash,
34969
- s: sealSecret(key, secret, secretAad(this.id, hash, key))
34970
- });
36745
+ const pause = pacer(SEAL_SLICE_MS);
36746
+ for (const [key] of roster) if (key !== this.myKey && isZ32Key(key)) {
36747
+ this.hooks.addressed(key, {
36748
+ t: "group-secret",
36749
+ v: 2,
36750
+ g: this.id,
36751
+ to: key,
36752
+ h: hash,
36753
+ s: sealSecret(key, secret, secretAad(this.id, hash, key))
36754
+ });
36755
+ await pause();
36756
+ }
34971
36757
  }
34972
36758
  this.hooks.changed();
34973
36759
  await this.renewLasting();
@@ -35043,12 +36829,49 @@ var CommunitySession = class CommunitySession {
35043
36829
  });
35044
36830
  return frames;
35045
36831
  }
35046
- remove(memberKey, now = Date.now()) {
35047
- return this.serialize(async () => {
36832
+ /**
36833
+ * Takes a member out, and with it everyone it let in who is still in, and whom those let in in turn
36834
+ * (`admittedThrough`): keys a member let in cost it nothing, and one by one they were the admin's to clear. A
36835
+ * `remove` commit each, as before (an app from before follows them), one at a time, so what arrives meanwhile is
36836
+ * heard, and an admission signed meanwhile by one of them is taken out too (`memberAdmissions` bounds them, as a
36837
+ * removal is not the admin letting anyone in). A member already out still has those it let in cleared.
36838
+ */
36839
+ async remove(memberKey, now = Date.now()) {
36840
+ for (let first = true;; first = false) if (await this.serialize(async () => {
35048
36841
  this.requireAdmin();
35049
- if (!rosterHas(this.roster, memberKey) || memberKey === this.myKey) throw new Error("Not a member");
35050
- await this.commit("remove", { s: memberKey }, now);
35051
- });
36842
+ if (memberKey === this.myKey) throw new Error("Not a member");
36843
+ const next = rosterHas(this.roster, memberKey) ? memberKey : this.admittedThrough(memberKey)[0];
36844
+ if (next === void 0) {
36845
+ if (first) throw new Error("Not a member");
36846
+ return true;
36847
+ }
36848
+ await this.commit("remove", { s: next }, now);
36849
+ return false;
36850
+ })) return;
36851
+ }
36852
+ /**
36853
+ * The members still in whose admission, on the main branch, `root` signed, or one of them did, and so on: in the
36854
+ * order they were let in. An admission signed by whoever was the admin then is the admin's, not counted: removing
36855
+ * a former admin does not take out everyone it let in. Never the admin nor me.
36856
+ */
36857
+ admittedThrough(root) {
36858
+ const by = /* @__PURE__ */ new Map();
36859
+ let admin = "";
36860
+ for (const c of this.state.chain) if (c.k === "create") admin = c.by;
36861
+ else if (c.k === "role" && c.s) admin = c.s;
36862
+ else if (c.k === "add" && c.s) {
36863
+ by.delete(c.s);
36864
+ if (c.by !== admin) by.set(c.s, c.by);
36865
+ }
36866
+ const through = /* @__PURE__ */ new Set([root]);
36867
+ for (let grew = true; grew;) {
36868
+ grew = false;
36869
+ for (const [key, signer] of by) if (!through.has(key) && through.has(signer)) {
36870
+ through.add(key);
36871
+ grew = true;
36872
+ }
36873
+ }
36874
+ return [...by.keys()].filter((key) => key !== root && through.has(key) && key !== this.myKey && key !== this.admin && rosterHas(this.roster, key));
35052
36875
  }
35053
36876
  transferAdmin(memberKey, now = Date.now()) {
35054
36877
  return this.serialize(async () => {
@@ -35078,9 +36901,13 @@ var CommunitySession = class CommunitySession {
35078
36901
  seedB64: entry?.seedB64 ?? ""
35079
36902
  };
35080
36903
  await this.persist();
35081
- if (entry) for (const key of this.others) {
35082
- const frame = this.entryFrame(key);
35083
- if (frame) this.hooks.addressed(key, frame);
36904
+ if (entry) {
36905
+ const pause = pacer(ENTRY_SLICE_MS);
36906
+ for (const key of this.others) {
36907
+ const frame = this.entryFrame(key);
36908
+ if (frame) this.hooks.addressed(key, frame);
36909
+ await pause();
36910
+ }
35084
36911
  }
35085
36912
  this.hooks.changed();
35086
36913
  return this.state.entry.key;
@@ -35138,11 +36965,21 @@ var CommunitySession = class CommunitySession {
35138
36965
  return done;
35139
36966
  });
35140
36967
  }
35141
- /** Signs and says how far I had heard a member whose leave I just committed (`group-left`). */
36968
+ /**
36969
+ * Signs and says how far I had heard a member whose leave I just committed (`group-left`): per epoch, up to the first
36970
+ * number of my window of it I never heard, so a copy of the leaver's state cannot sign one later into the gap. A gap
36971
+ * at the window's bottom (a jump past it, or a counter raised by a restore) leaves the epoch out: nothing of it then.
36972
+ */
35142
36973
  markLeft(h, leaver) {
35143
36974
  const hi = {};
35144
36975
  const heard = Object.entries(this.state.seen[leaver] ?? {}).filter(([k]) => LEFT_EPOCH.test(k)).slice(-COMMUNITY_LIMITS.leftMarks);
35145
- for (const [k, entry] of heard) hi[k] = entry.high;
36976
+ for (const [k, entry] of heard) {
36977
+ const bottom = Math.max(0, entry.high - COMMUNITY_LIMITS.replay + 1);
36978
+ let n = bottom;
36979
+ while (n < entry.high && entry.window.includes(n)) n++;
36980
+ const top = n === entry.high ? n : n - 1;
36981
+ if (top >= bottom) hi[k] = top;
36982
+ }
35146
36983
  const sig = toBase64Url(sign(leftStatement(this.id, h, hi), this.identity.seed));
35147
36984
  this.keepLeft(h, {
35148
36985
  hi,
@@ -35225,14 +37062,20 @@ var CommunitySession = class CommunitySession {
35225
37062
  /**
35226
37063
  * An application frame to everyone in the group (a note about a payment, a request anyone may pay): sealed to
35227
37064
  * the epoch like text, signed, kept and caught up like text, and handed to the other members' `app` hook
35228
- * instead of their history.
37065
+ * instead of their history. A fleeting one (`CommunitySessionHooks.fleeting`) is only said to those up now.
35229
37066
  */
35230
37067
  sendApp(frame, nick, now = Date.now()) {
35231
37068
  return this.serialize(async () => {
35232
37069
  if (!this.isMember) return { error: this.state.statusReason ?? "You are not in this group" };
35233
37070
  if (!isObject$5(frame) || utf8Encode(JSON.stringify(frame)).length > COMMUNITY_LIMITS.appBytes) return { error: "Too large for the group" };
35234
- const sent = await this.sendPayload(() => ({ x: frame }), nick, now);
37071
+ const fleeting = this.hooks.fleeting?.(frame) === true;
37072
+ const sent = await this.sendPayload(() => ({ x: frame }), nick, now, !fleeting);
35235
37073
  if ("error" in sent) return sent;
37074
+ if (fleeting) {
37075
+ await this.persist();
37076
+ this.hooks.broadcast(sent.frame);
37077
+ return { id: sent.id };
37078
+ }
35236
37079
  this.keepLasting({
35237
37080
  id: sent.id,
35238
37081
  sender: this.myKey,
@@ -35315,7 +37158,7 @@ var CommunitySession = class CommunitySession {
35315
37158
  });
35316
37159
  }
35317
37160
  /** Seals, signs and keeps a frame under the current epoch (the caller holds the queue, persists and broadcasts). */
35318
- async sendPayload(body, nick, now) {
37161
+ async sendPayload(body, nick, now, kept = true) {
35319
37162
  const h = this.topHash, secret = this.state.secrets[h];
35320
37163
  if (!secret) return { error: "This epoch's key has not arrived yet. Wait for a member to catch you up." };
35321
37164
  if (this.state.seqH !== h) {
@@ -35351,7 +37194,7 @@ var CommunitySession = class CommunitySession {
35351
37194
  sig: toBase64Url(sign(messageSigned(unsigned), this.identity.seed))
35352
37195
  };
35353
37196
  this.markSeen(frame);
35354
- this.keep(frame);
37197
+ if (kept) this.keep(frame);
35355
37198
  return {
35356
37199
  id: communityMessageId(this.myKey, header.e, header.h, n),
35357
37200
  frame
@@ -35570,7 +37413,11 @@ var CommunitySession = class CommunitySession {
35570
37413
  * what was left of the first from its start: a member back after 256 messages was handed 288 (2026-10-14).
35571
37414
  */
35572
37415
  syncFrame(to) {
35573
- if (to) this.asked.set(to, this.hooks.clock?.() ?? Date.now());
37416
+ if (to) {
37417
+ const now = this.hooks.clock?.() ?? Date.now();
37418
+ this.asked.set(to, now);
37419
+ this.answering.set(to, now + ANSWER_WINDOW_MS);
37420
+ }
35574
37421
  const have = {};
35575
37422
  const recent = new Set(this.state.store.map((f) => seenKey(f.e, f.h)));
35576
37423
  for (const [sender, byKey] of Object.entries(this.state.seen)) for (const [key, entry] of Object.entries(byKey)) {
@@ -35605,6 +37452,8 @@ var CommunitySession = class CommunitySession {
35605
37452
  if (!raw || typeof raw !== "object") return false;
35606
37453
  const frame = raw;
35607
37454
  if (frame.g !== this.id || frame.v !== 2) return false;
37455
+ const now = this.hooks.clock?.() ?? Date.now();
37456
+ if ((this.answering.get(from) ?? 0) > now) this.answering.set(from, now + ANSWER_WINDOW_MS);
35608
37457
  if (this.state.status !== "active" && !(this.state.status === "lost" && (frame.t === "group-commit" || frame.t === "group-secret" || frame.t === "group-secrets"))) return false;
35609
37458
  switch (frame.t) {
35610
37459
  case "group-msg": return this.receiveMessage(from, raw);
@@ -35612,22 +37461,14 @@ var CommunitySession = class CommunitySession {
35612
37461
  case "group-secret": {
35613
37462
  if (frame.to !== this.myKey || typeof frame.h !== "string") return false;
35614
37463
  const took = this.takeSecret(frame.h, frame.s);
35615
- if (took) {
35616
- this.persistSoon();
35617
- this.hooks.changed();
35618
- await this.replayWaiting();
35619
- }
37464
+ if (took) await this.tookSecrets();
35620
37465
  return took;
35621
37466
  }
35622
37467
  case "group-secrets": {
35623
37468
  if (!Array.isArray(frame.secrets) || frame.secrets.length > COMMUNITY_LIMITS.secrets) return false;
35624
37469
  let took = false;
35625
37470
  for (const entry of frame.secrets) if (entry && typeof entry.h === "string") took = this.takeSecret(entry.h, entry.s) || took;
35626
- if (took) {
35627
- this.persistSoon();
35628
- this.hooks.changed();
35629
- await this.replayWaiting();
35630
- }
37471
+ if (took) await this.tookSecrets();
35631
37472
  return false;
35632
37473
  }
35633
37474
  case "group-sync":
@@ -35646,6 +37487,16 @@ var CommunitySession = class CommunitySession {
35646
37487
  }
35647
37488
  });
35648
37489
  }
37490
+ /** After a secret came that confirms: a branch that waited for it may be the one to follow now (see `better`). */
37491
+ async tookSecrets() {
37492
+ if (this.bestBranch().tip !== this.topHash) {
37493
+ await this.chooseBranch();
37494
+ return;
37495
+ }
37496
+ this.persistSoon();
37497
+ this.hooks.changed();
37498
+ await this.replayWaiting();
37499
+ }
35649
37500
  receiveLeave(frame) {
35650
37501
  const s = frame.s, ls = frame.ls;
35651
37502
  if (typeof s !== "string" || !MEMBER_KEY.test(s) || typeof ls !== "string" || !SIG.test(ls) || !rosterHas(this.roster, s)) return false;
@@ -35674,12 +37525,31 @@ var CommunitySession = class CommunitySession {
35674
37525
  this.persistSoon();
35675
37526
  return true;
35676
37527
  }
35677
- async receiveMessage(from, raw) {
35678
- if (!isMessageFrame(raw)) return false;
37528
+ /**
37529
+ * What a hub hands on of a frame it took (`handle` said it was new): as it came, without the live mark of whoever
37530
+ * handed it to me, and with mine when it came live here (WISP 903 § Relaying, revision 2026-11-03). Hand it on at
37531
+ * once: the mark says it is passed on as it came.
37532
+ */
37533
+ passOn(frame) {
37534
+ if (frame.t !== "group-msg") return frame;
37535
+ const { lv: _mark, ...rest } = frame;
37536
+ return this.cameLive.has(frame) ? {
37537
+ ...rest,
37538
+ lv: this.myKey
37539
+ } : rest;
37540
+ }
37541
+ /** `waited`: it waited for a commit or a secret (`replayWaiting`), so it is not live. */
37542
+ async receiveMessage(from, input, waited = false) {
37543
+ if (!isMessageFrame(input)) return false;
37544
+ const { lv: mark, ...unmarked } = input;
37545
+ const raw = unmarked;
35679
37546
  if (raw.s === this.myKey) {
35680
37547
  this.ownFrame(raw);
35681
37548
  return false;
35682
37549
  }
37550
+ const now = this.hooks.clock?.() ?? Date.now();
37551
+ const live = !waited && (raw.s === from ? (this.answering.get(from) ?? 0) <= now : mark === from && rosterHas(this.roster, from) && now - raw.ts <= COMMUNITY_LIMITS.liveMarkMs);
37552
+ if (live) this.cameLive.add(input);
35683
37553
  if (this.isDuplicate(raw)) return false;
35684
37554
  if (!verify(fromBase64Url(raw.sig), messageSigned(raw), publicKeyFromZ32(raw.s))) return false;
35685
37555
  if (!this.heardAfterOut(raw)) return false;
@@ -35751,7 +37621,7 @@ var CommunitySession = class CommunitySession {
35751
37621
  this.state.nicks[raw.s] = nick;
35752
37622
  this.hooks.changed();
35753
37623
  }
35754
- let onRow = false;
37624
+ let onRow = false, fleeting = false;
35755
37625
  if (text !== void 0) {
35756
37626
  const mentions = validMentions(parsed.m, text, false);
35757
37627
  const reply = parsed.r === void 0 ? void 0 : readReply(parsed.r, groupReplyAuthor);
@@ -35770,7 +37640,8 @@ var CommunitySession = class CommunitySession {
35770
37640
  ...forwarded ? { forwarded } : {},
35771
37641
  ...card ? { card } : {},
35772
37642
  ...file ? { file } : {},
35773
- frame: raw
37643
+ frame: raw,
37644
+ ...live ? { live: true } : {}
35774
37645
  });
35775
37646
  } else if (isObject$5(parsed.x)) {
35776
37647
  const app = {
@@ -35780,7 +37651,8 @@ var CommunitySession = class CommunitySession {
35780
37651
  timestamp: raw.ts,
35781
37652
  frame: parsed.x
35782
37653
  };
35783
- this.keepLasting(app, raw);
37654
+ fleeting = this.hooks.fleeting?.(parsed.x) === true;
37655
+ if (!fleeting) this.keepLasting(app, raw);
35784
37656
  await this.hooks.app?.(app);
35785
37657
  } else {
35786
37658
  const box = parsed.p;
@@ -35805,7 +37677,7 @@ var CommunitySession = class CommunitySession {
35805
37677
  ...raw,
35806
37678
  ...original
35807
37679
  });
35808
- this.keep(raw);
37680
+ if (!fleeting) this.keep(raw);
35809
37681
  if (onRow === true) this.onRows.set(storeKey(raw), id);
35810
37682
  this.persistSoon();
35811
37683
  return true;
@@ -35876,6 +37748,7 @@ var CommunitySession = class CommunitySession {
35876
37748
  const now = this.hooks.clock?.() ?? Date.now();
35877
37749
  if (now - (this.asked.get(from) ?? 0) < 5e3) return null;
35878
37750
  this.asked.set(from, now);
37751
+ this.answering.set(from, now + ANSWER_WINDOW_MS);
35879
37752
  return this.syncFrame();
35880
37753
  }
35881
37754
  async replayWaiting() {
@@ -35887,7 +37760,7 @@ var CommunitySession = class CommunitySession {
35887
37760
  if (!ready.length) return;
35888
37761
  this.waiting = this.waiting.filter((w) => !ready.includes(w));
35889
37762
  this.waitingBytes = this.waiting.reduce((sum, w) => sum + w.frame.c.length, 0);
35890
- for (const { from, frame } of ready) await this.receiveMessage(from, frame);
37763
+ for (const { from, frame } of ready) await this.receiveMessage(from, frame, true);
35891
37764
  }
35892
37765
  async receiveSync(from, frame) {
35893
37766
  if (!isZ32Key(from) || !Number.isSafeInteger(frame.e) || typeof frame.h !== "string") return;
@@ -36092,14 +37965,23 @@ var CommunitySession = class CommunitySession {
36092
37965
  if (body !== this.state.meta?.body) await this.publishMeta(body, now);
36093
37966
  });
36094
37967
  }
36095
- /** Signs a body under my current commit, keeps it and sends it to everyone (hubs relay it). Inside `serialize`. */
36096
- async publishMeta(body, now) {
37968
+ /**
37969
+ * Signs a body under my current commit, keeps it and sends it to everyone (hubs relay it). Inside `serialize`. Like a
37970
+ * commit, only with admin work on and a good turn read (WISP 06 § Forced takeover): refused otherwise, or, `quiet`,
37971
+ * not made. Its revision is never under the floor (WISP 06 § Raised counters).
37972
+ */
37973
+ async publishMeta(body, now, quiet = false) {
37974
+ const refused = !this.adminWork ? new Error(GROUP_ADMIN_OFF_ERROR) : this.hooks.adminTurn && !await this.hooks.adminTurn() ? engineError("groupTurnUnconfirmed") : void 0;
37975
+ if (refused) {
37976
+ if (quiet) return;
37977
+ throw refused;
37978
+ }
36097
37979
  const before = this.state.meta;
36098
37980
  const meta = signGroupMeta({
36099
37981
  g: this.id,
36100
37982
  e: this.epoch,
36101
37983
  h: this.topHash,
36102
- r: nextGroupMetaRevision(before, this.epoch),
37984
+ r: nextGroupMetaRevision(before, this.epoch, this.hooks.seqFloor?.()),
36103
37985
  ts: now
36104
37986
  }, body, this.identity.seed, this.myKey);
36105
37987
  this.state.meta = meta;
@@ -36200,7 +38082,7 @@ var CommunitySession = class CommunitySession {
36200
38082
  this.pendingMeta = void 0;
36201
38083
  if (pending && await this.receiveMeta(pending.from, pending.frame)) this.hooks.relay?.(pending.frame);
36202
38084
  const meta = this.state.meta;
36203
- if (this.isAdmin && meta && (meta.by !== this.myKey || !this.mainIndex.has(meta.h))) await this.publishMeta(meta.body, meta.ts);
38085
+ if (this.isAdmin && meta && (meta.by !== this.myKey || !this.mainIndex.has(meta.h))) await this.publishMeta(meta.body, meta.ts, true);
36204
38086
  }
36205
38087
  async fork(reason) {
36206
38088
  if (this.state.status !== "active") return;
@@ -36343,7 +38225,6 @@ var APP_STORE_LIMITS = {
36343
38225
  };
36344
38226
  var APP_STORE_KINDS = ["curated", "indexed"];
36345
38227
  var isObject$4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
36346
- var isLine = (v, max, min = 0) => typeof v === "string" && [...v].length >= min && [...v].length <= max && !/\p{Cc}/u.test(v);
36347
38228
  var isText$1 = (v, max) => typeof v === "string" && [...v].length <= max && !/[^\P{Cc}\n]/u.test(v);
36348
38229
  var isCount = (v, min) => typeof v === "number" && Number.isSafeInteger(v) && v >= min;
36349
38230
  var fine = { ok: true };
@@ -36400,13 +38281,13 @@ function checkAppListing(value, options = {}) {
36400
38281
  if (!isAppHash(value.digest)) return bad("digest");
36401
38282
  const urls = value.urls;
36402
38283
  if (!Array.isArray(urls) || urls.length < 1 || urls.length > APP_STORE_LIMITS.urls || !urls.every(isAppUrl)) return bad("urls");
36403
- if (!isLine(value.title, APP_STORE_LIMITS.title, 1)) return bad("title");
36404
- if (!isLine(value.tagline, APP_STORE_LIMITS.tagline, 1)) return bad("tagline");
38284
+ if (!isAppLine(value.title, APP_STORE_LIMITS.title, 1)) return bad("title");
38285
+ if (!isAppLine(value.tagline, APP_STORE_LIMITS.tagline, 1)) return bad("tagline");
36405
38286
  for (const k of [
36406
38287
  "category",
36407
38288
  "developer",
36408
38289
  "submitter"
36409
- ]) if (value[k] !== void 0 && !isLine(value[k], APP_STORE_LIMITS.label, 1)) return bad(k);
38290
+ ]) if (value[k] !== void 0 && !isAppLine(value[k], APP_STORE_LIMITS.label, 1)) return bad(k);
36410
38291
  for (const k of ["repo", "support"]) if (value[k] !== void 0 && !isAppUrl(value[k])) return bad(k);
36411
38292
  return fine;
36412
38293
  }
@@ -36482,7 +38363,7 @@ function checkRemoval(value, options) {
36482
38363
  "at"
36483
38364
  ], [], options);
36484
38365
  if (!keys.ok) return keys;
36485
- if (!isAppRef(value.ref) || !isAppHash(value.digest) || !isLine(value.reason, APP_STORE_LIMITS.reason, 1) || !isCount(value.at, 0)) return {
38366
+ if (!isAppRef(value.ref) || !isAppHash(value.digest) || !isAppLine(value.reason, APP_STORE_LIMITS.reason, 1) || !isCount(value.at, 0)) return {
36486
38367
  ok: false,
36487
38368
  reason: "bad-field",
36488
38369
  detail: "removed: not {ref, digest, reason, at}"
@@ -36540,7 +38421,7 @@ function* checkAppStoreFieldsSteps(value, options = {}) {
36540
38421
  detail: field
36541
38422
  });
36542
38423
  if (!isAppKey(value.key)) return bad("key");
36543
- if (!isLine(value.name, APP_STORE_LIMITS.name, 1)) return bad("name");
38424
+ if (!isAppLine(value.name, APP_STORE_LIMITS.name, 1)) return bad("name");
36544
38425
  if (value.description !== void 0 && !isText$1(value.description, APP_STORE_LIMITS.description)) return bad("description");
36545
38426
  if (!APP_STORE_KINDS.includes(value.kind)) return bad("kind");
36546
38427
  if (!isCount(value.sequence, 1)) return bad("sequence");
@@ -37495,6 +39376,6 @@ function x401ApprovalDigest(subject) {
37495
39376
  return toBase64Url(sha256(utf8Encode(canonical)));
37496
39377
  }
37497
39378
  //#endregion
37498
- export { COMMUNITY_LIMITS as $, decodeTxtPacket as $C, CHAT_RESERVE_MOST_SHARE as $S, handoffBusyFrame as $_, LIVENESS_MISSED_PINGS as $a, exifOrientation as $b, decodeAppRangeData as $c, DHT_TEXT_BYTES as $d, validEditMessage as $f, sdpHasCandidates as $g, UNUSED_INVITE_READS_PER_MINUTE as $h, isSparkAddress as $i, DNS_LABEL as $l, openPair as $m, MessageRefusal as $n, mayBeHub as $o, STATUS_CARD_LIMITS as $p, DidError as $r, typingKindOf as $s, GROUP_EDIT_TEXT_BYTES as $t, emptyIdentityLedger as $u, ENROLL_GRANT as $v, deviceLinkSecret as $x, openRequest as $y, readX401ProofResponseHeader as A, traceLink as AC, firstDeviceSetSecret as AS, HANDOFF_FILE_REQUEST as A_, findBolt11 as Aa, APP_PREFIXES as Ab, wakeFrame as Ac, verifyPeerProof as Ad, voicePeaksOf as Af, RTC_SIGNAL_FUTURE_MS as Ag, DIRECT_EVIDENCE_MS as Ah, jwkThumbprint as Ai, PIN_CAPABILITY as Al, MEMBER_KEY as Am, parseGroupMetaBody as An, GROUP_WANT_NO_FRAME as Ao, reactionIsNewer as Ap, parseAtprotoDidDocument as Ar, FILE_LIMITS as As, knockRecords as At, DHT_TEXT_CAPABILITY as Au, readHandoffHave as Av, isZ32Key as Aw, encodeGhostlyInvite as Ax, KNOCK_SLOTS as Ay, APP_STORE_KINDS as B, withRequestOptions as BC, turnKeys as BS, HANDOFF_RELEASE as B_, BLOCKED_DIAL_WAIT_MS as Ba, isAppRef as Bb, vapidAuthorization as Bc, TRANSPORTS as Bd, EDIT_FRAME as Bf, answersOffer as Bg, FIRST_PUBLISH_MAX_MS as Bh, TEST_USDT_FAUCET_AMOUNT as Bi, sessionCapabilitiesFrame as Bl, signCommit as Bm, SSH_PUBLIC_KEY_MAX as Bn, GROUP_SIGNAL_FRAME as Bo, readReply as Bp, parseAtprotoDidKey as Br, TYPING_RATE_LIMIT as Bs, groupWakes as Bt, IDENTITY_FRAME_WINDOW_MS as Bu, SET_ACK as Bv, __require as Bw, DEVICE_CAPABILITIES as Bx, REQUEST_TEXT_BYTES as By, buildX401TokenObject as C, WAY_BACK_SHARE as CC, TURN_SEALED_BYTES as CS, HANDOFF_BUSY as C_, parseInvoiceCallback as Ca, isAppUrl as Cb, WakeLimiter as Cc, proofHash as Cd, isPlayableAudioType as Cf, decodeControl as Cg, DATA_SETTLE_MS as Ch, decodeDidDhtPacket as Ci, APP_RANGES_CAPABILITY as Cl, GROUP_ADMIN_OFF_ERROR as Cm, groupMetaPicture as Cn, engineText as Co, nextReactionNumber as Cp, ATPROTO_PROOF_SCOPE as Cr, MAX_PAIRED_CALL_SIGNAL as Cs, KNOCK_TTL_MS as Ct, CAPS_LABEL as Cu, openHandoffPiece as Cv, trimEndOf as Cw, INVITE_LINK_ORIGIN as Cx, newInbox as Cy, readX401ProofRequest as D, readRelayBody as DC, TURN_VERSION as DS, HANDOFF_DATA as D_, resolveLightningDestination as Da, sha256Paced as Db, readWake as Dc, storageProofPath as Dd, voiceFileName as Df, wrapDataChannel as Dg, OFFER_HOST_GATHER_MS as Dh, didDhtRecords as Di, FILES_BINARY_CAPABILITY as Dl, LEGACY_GROUP_MEMBERS as Dm, keepPastGroupMeta as Dn, GROUP_HAVE_FRAME as Do, reactedFrame as Dp, checkAtprotoProofRecord as Dr, ChatFiles as Ds, entryParams as Dt, CapsExchange as Du, readHandoffData as Dv, fromBase64 as Dw, createChatInvite as Dx, turnOff as Dy, isX401Protocol as E, normalizeRelayUrl as EC, TURN_TTL as ES, HANDOFF_CANCEL_REASONS as E_, requestLnurlInvoice as Ea, readAppBundleAsync as Eb, parseWakeFrame as Ec, storageProofBody as Ed, voiceDownloadName as Ef, sendBody as Eg, GATHER_STALL_MS as Eh, didDhtKey as Ei, EDIT_CAPABILITY as El, GROUP_VERSION_LARGE as Em, groupName as En, GROUP_FILE_LIMITS as Eo, queueReaction as Ep, atprotoProofRkey as Er, parsePairedCallFrame as Es, encodeGroupEntryLink as Et, CAPS_REFRESH_MS as Eu, readHandoffCancel as Ev, concatBytes as Ew, OwnInviteError as Ex, takeRequest as Ey, appRevocationFor as F, RelayBreaker as FC, sealTurnBody as FS, HANDOFF_MANIFEST as F_, isFederationId as Fa, appRevocationId as Fb, checkPushEndpoint as Fc, validRingKey as Fd, isVideoMime as Ff, parseRtcSignal as Fg, symmetricNat as Fh, EVM_TEST_CHAINS as Fi, SessionCapabilities as Fl, expectedRoster as Fm, verifyGroupMetaSignature as Fn, readGroupHave as Fo, PAIRED_REPLY_AUTHORS as Fp, decodeAtprotoCommit as Fr, sentWhole as Fs, GROUP_WAKE_GROUP_WINDOW_MS as Ft, parsePacketTransports as Fu, readHandoffTurnFrame as Fv, utf8Decode as Fw, inviteQrText as Fx, REQUEST_CLOCK_SKEW_MS as Fy, readAppStore as G, createRelayPayload as GC, turnSequence as GS, HANDOFF_WINDOW as G_, DEMOTE_MS as Ga, readAppSignature as Gb, APP_RANGE_LIMITS as Gc, rankTransports as Gd, MAX_REMOVAL_NUMBER as Gf, contactRtcConfig as Gg, OFFER_LOOK_MS as Gh, assertWholeSats as Gi, HOLD_CAPABILITY as Gl, GROUP_PROFILE as Gm, sshFingerprint as Gn, SIGNAL_HOLD_MS as Go, BUTTON_STYLES as Gp, verifyAtprotoSignature as Gr, TYPING_TIMEOUT_MS as Gs, GROUP_READ_NOTE as Gt, IDENTITY_PROOF_CAPABILITY as Gu, setUpdateFrame as Gv, deviceEchoFrame as Gx, knockHolds as Gy, checkAppListing as H, PKARR_FUTURE_SKEW_MS as HC, turnPacket as HS, HANDOFF_TIMINGS as H_, CROSSED_PROBE_MS as Ha, readAppRevocation as Hb, APP_RANGE_DATA_KIND as Hc, checkedDescriptors as Hd, EDIT_RECEIVE_LIMIT as Hf, callRtcConfig as Hg, LinkSession as Hh, WALLET_NETWORKS as Hi, PairedSession as Hl, verifyChain as Hm, parseSshPublicKey as Hn, SIGNALS_PER_MINUTE as Ho, wireReply as Hp, readAtprotoCid as Hr, TYPING_REFRESH_MS as Hs, parseGroupWakeFrame as Ht, IDENTITY_MAX_FRAME as Hu, encodeSetSlots as Hv, DEVICE_PING_FRAME as Hx, STAMP_BITS_MAX as Hy, appStoreDecision as I, DiscoveryBudgetError as IC, signTurnBody as IS, HANDOFF_OFFER as I_, parseCashuRequestPayload as Ia, appSignedBytes as Ib, decryptPushPayload as Ic, verifyRingAuthorization as Id, parseVideoMeta as If, CALL_SIGNAL_FUTURE_MS as Ig, AWAITING_PEER_MS as Ih, ONCHAIN_PROVIDER as Ii, TYPING_CAPABILITY as Il, parseGroupCommit as Im, wrapGroupMeta as In, readGroupWant as Io, REPLY_ID as Ip, decodeDagCbor as Ir, transferEnded as Is, GROUP_WAKE_MEMBER_INTERVAL_MS as It, IDENTITY_CHALLENGE_WINDOW as Iu, readHandoffVerified as Iv, utf8Encode as Iw, ownInviteRefusal as Ix, REQUEST_LABEL as Iy, GROUP_TYPING_FRAME as J, openRelayPayload as JC, turnVerifierMark as JS, filePartName as J_, FIRST_PAIRING_PACE_MS as Ja, signAppRevocation as Jb, appRangeChunk as Jc, transportOrder as Jd, dhtEditId as Jf, heardCallSignal as Jg, PRESENCE_WINDOW as Jh, parsePaymentAmount as Ji, HoldKeys as Jl, decryptText as Jm, verifySshSignature as Jn, groupSignalFrame as Jo, PR_CHECKS as Jp, DID_GHOSTLY_SERVICE as Jr, parseTypingActivity as Js, chainPieces as Jt, IDENTITY_STATEMENT_PREFIX as Ju, verifySetUpdate as Jv, deviceKeyZ32 as Jx, knockSlotRecords as Jy, readAppStoreSteps as K, measureRecords as KC, turnSignedMessage as KS, NO_ATTEMPTS as K_, DHT_PIN_GRACE_MS as Ka, setAppSignatureFastPath as Kb, AppRanges as Kc, relayUrl as Kd, REMOVED_TEXT as Kf, decompressSdp as Kg, OFFER_STEP_MAX as Kh, formatPaymentAmount as Ki, HOLD_DATED_BACK_MS as Kl, confirmationMatches as Km, sshKeyDigestHex as Kn, SIGNAL_PROVEN_MS as Ko, CRON_LINE as Kp, DID_DOCUMENT_MAX_BYTES as Kr, TypingReceiver as Ks, GroupSession as Kt, IDENTITY_PROVIDER_ID as Ku, setUpdateMessage as Kv, deviceEchoNonce as Kx, knockSlotIdentity as Ky, appUpdateDecision as L, budgetRetryMs as LC, signTurnPacket as LS, HANDOFF_PAKE as L_, parseFedimintRequestPayload as La, checkAppRevokeStatement as Lb, encryptPushPayload as Lc, verifyRingEvidence as Ld, EDITED_FRAME as Lf, CALL_SIGNAL_MAX_AGE_MS as Lg, DEPARTED_READ_MS as Lh, PaymentPreflightError as Li, UPGRADE_CAPABILITY as Ll, rememberAlone as Lm, SSHSIG_MAX_ARMOR as Ln, readGroupWantNo as Lo, REPLY_LIMITS as Lp, encodeDagCbor as Lr, transferStalled as Ls, GROUP_WAKE_RECEIVE_LIMIT as Lt, IDENTITY_CHECK_UNAVAILABLE as Lu, sameDigest as Lv, __commonJSMin as Lw, pastedAgain as Lx, REQUEST_LIFETIME_MS as Ly, readX401ProofResultHeader as M, BREAKER_BASE_MS as MC, openTurnValue as MS, HANDOFF_HELLO as M_, cashuRequestPayload as Ma, appFingerprint as Mb, wakeRequest as Mc, ringAuthorization as Md, VIDEO_LIMITS as Mf, buildDataSdp as Mg, DIRECT_PEERS as Mh, resolveDidDht as Mi, SERVICES_CAPABILITY as Ml, SAID_AGAIN as Mm, parseGroupMetaStatement as Mn, groupFileFallback as Mo, readReaction as Mp, AtprotoCid as Mr, decodeFileData as Ms, readKnocks as Mt, dialDescriptors as Mu, readHandoffManifest as Mv, toBase64 as Mw, inviteLink as Mx, LINK_RECORD_LABEL as My, x401AnswerableRequests as N, BREAKER_MAX_MS as NC, readTurnBody as NS, HANDOFF_LATER_BYTES as N_, fedimintRequestPayload as Na, appRef as Nb, PUSH_SERVICE_HOSTS as Nc, ringClaims as Nd, formatVideoDuration as Nf, extractRtcParams as Ng, DirectPathWatch as Nh, signDidDhtPacket as Ni, SESSION_CAPABILITIES_FRAME as Nl, commitHash as Nm, parseGroupMetaTag as Nn, isGroupMessageId as No, validReactionNumber as Np, AtprotoProofError as Nr, encodeFileData as Ns, GROUP_WAKE_FRAME as Nt, emptyCapsState as Nu, readHandoffPake as Nv, toBase64Url as Nw, inviteOwnership as Nx, MAX_SEEN as Ny, readX401ProofRequestHeader as O, relayUrlProblem as OC, TurnRecordError as OS, HANDOFF_DONE as O_, BOLT11_PATTERN as Oa, yieldThread as Ob, readWakePayload as Oc, validExternalKey as Od, voiceLevel as Of, DATA_CHANNEL_ID as Og, REANSWERS as Oh, encodeDidDhtDeactivated as Oi, FILES_CAPABILITY as Ol, MAX_GROUP_CHAIN as Om, nextGroupMetaRevision as On, GROUP_VERSION_FILES as Oo, reactionEmoji as Op, isAtprotoDid as Or, FILE_DATA_KIND as Os, groupEntryUrl as Ot, CapsKeys as Ou, readHandoffDone as Ov, fromBase64Url as Ow, createLink as Ox, CONTACT_RECORD_TTL as Oy, addedAppPermissions as P, BREAKER_THRESHOLD as PC, readTurnPacket as PS, HANDOFF_LIST_PER_FRAME as P_, findEndpoint as Pa, appRefPublisher as Pb, WebPushError as Pc, ringEvidence as Pd, isPlayableVideoType as Pf, offerIsFresh as Pg, directBlocked as Ph, ETHEREUM_USDT as Pi, STATUS_CARD_CAPABILITY as Pl, commitUntaggedHash as Pm, signGroupMeta as Pn, readGroupFileMeta as Po, wireReaction as Pp, atprotoCidFor as Pr, refusalText as Ps, GROUP_WAKE_GROUP_LIMIT as Pt, encodePacketTransports as Pu, readHandoffRelease as Pv, toZ32 as Pw, inviteQrSegments as Px, MAX_SLOT_KNOCKS as Py, sealGroupTyping as Q, decodeDnsAnswers as QC, CHAT_RESERVE as QS, handoffAttemptSucceeded as Q_, INVITE_TAKEN as Qa, IMAGE_LIMITS as Qb, appRangeGetFrame as Qc, DHT_MESSAGE_TTL as Qd, parseEditedFrame as Qf, pickCallCandidates as Qg, TRANSPORTS_GONE_MS as Qh, SPARK_PROVIDER as Qi, readManifest as Ql, newEpochSecret as Qm, BIP322_REVISION as Qn, NO_HUB_POLICY as Qo, RUN_RESULTS as Qp, DID_METHODS as Qr, typingFrame as Qs, GROUP_EDIT_FRAME as Qt, boundVerifiedIdentity as Qu, ENROLL_DONE as Qv, deviceLinkSealKey as Qx, mergeContactKnocks as Qy, checkAppBeforeRun as R, heldBackError as RC, signTurnRelease as RS, HANDOFF_PIECE_BYTES as R_, ANSWERS_REFUSED_PAUSES as Ra, isAppHash as Rb, generateVapidKeys as Rc, RELAY_URL as Rd, EDIT_BUFFER_MAX as Rf, PAIRED_CALL_CANDIDATES as Rg, DHT_POLL_INTERVALS as Rh, SEPOLIA_TEST_USDT as Ri, WAKE_SESSION_CAPABILITY as Rl, rosterAdmin as Rm, SSHSIG_NAMESPACE as Rn, CARRIED_DEFER_MS as Ro, groupReplyAuthor as Rp, findInMst as Rr, TYPING_FRAME as Rs, GroupWakeLimiter as Rt, IDENTITY_CLOCK_SKEW as Ru, sealHandoffPiece as Rv, __esmMin as Rw, readInviteCode as Rx, REQUEST_NAME_UNITS as Ry, buildX401ResultArtifact as S, WATCH_SHARE as SC, TURN_REV_LIMIT as SS, HANDOFF_ATTEMPTS as S_, invoiceCallbackUrl as Sa, isAppPath as Sb, WAKE_TTL_SECONDS as Sc, proofCapability as Sd, formatVoiceDuration as Sf, decodeChunk as Sg, CONNECT_TIMEOUT_MS as Sh, DidDhtError as Si, APPS_CAPABILITY as Sl, shownTime as Sm, groupMetaNewer as Sn, engineError as So, ReactionWindow as Sp, ATPROTO_PROOF_COLLECTION as Sr, validHead as Ss, GROUP_ENTRY_PROFILE as St, CAPS_ISSUED_BACK_MS as Su, newHandoffId as Sv, stripHidden as Sw, INVITE_HRP as Sx, inboxRecord as Sy, encodeX401Header as T, currentRelays as TC, TURN_SLOTS as TS, HANDOFF_CANCEL as T_, parsePayParams as Ta, readAppBundle as Tb, newWakeToken as Tc, storageProof as Td, recordingMime as Tf, encodeControl as Tg, GATHER_ATTEMPTS as Th, didDhtFromPublicKey as Ti, CALLS_CAPABILITY as Tl, GROUP_MEMBER_CAP as Tm, groupMetaToHand as Tn, PairingTracker as To, parseReactionFrame as Tp, atprotoProofRecord as Tr, PairedCalls as Ts, decodeGroupEntryLink as Tt, CAPS_PUBLISH_SPACING_MS as Tu, readHandoffBusy as Tv, bytesEqual as Tw, INVITE_VERSION as Tx, settleRequest as Ty, checkAppStoreIndex as U, PacketTooLargeError as UC, turnPayloadSequence as US, HANDOFF_VERIFIED as U_, CROSSED_WAIT_MS as Ua, readAppRevocationShape as Ub, APP_RANGE_ERRORS as Uc, irohDescriptor as Ud, EDIT_SEND_LIMIT as Uf, callSignalHeardAt as Ug, MAX_DHT_TEXT_BYTES as Uh, arkAddressPrefix as Ui, SESSION_FRAME_MAX as Ul, verifyCommit as Um, parseSshSignature as Un, SIGNAL_CARRIERS as Uo, ACTIVE_TASK_STATUSES as Up, unsignedCommitBytes as Ur, TYPING_SEND_LIMIT as Us, GROUP_LIMITS as Ut, IDENTITY_MAX_RECEIVED as Uu, readSetUpdate as Uv, ENROLL_CAPABILITY as Ux, STAMP_BITS_MIN as Uy, APP_STORE_LIMITS as V, MAX_DNS_PACKET_BYTES as VC, turnName as VS, HANDOFF_REQUEST as V_, CROSSED_FRESH_MS as Va, isAppSignature as Vb, vapidKeysMatch as Vc, automaticTransport as Vd, EDIT_RATE_WINDOW_MS as Vf, buildSdpFromSignal as Vg, IDLE_THRESHOLD as Vh, USDT_PUBLIC_RPC as Vi, PAIRED_PROFILE as Vl, sortRoster as Vm, SshSigError as Vn, GROUP_VERSION_SIGNALS as Vo, replySnippet as Vp, parseAtprotoVerificationKey as Vr, TYPING_RATE_WINDOW_MS as Vs, mentionedMembers as Vt, IDENTITY_MAX_EVIDENCE as Vu, SET_UPDATE as Vv, __toCommonJS as Vw, DEVICE_ECHO_FRAME as Vx, STAMP_BITS_DEFAULT as Vy, readAppListing as W, RELAY_PAYLOAD_MAX_BYTES as WC, turnReleaseMessage as WS, HANDOFF_VERSION as W_, DEMOTE_AFTER_FAILURES as Wa, readAppRevocations as Wb, APP_RANGE_FRAMES as Wc, irohRelayUrl as Wd, MAX_EDITS_PER_MESSAGE as Wf, compressSdp as Wg, OFFER_FAST_MS as Wh, assertTokenUnits as Wi, SESSION_RECEIVE_PENDING as Wl, verifyCommitSignature as Wm, sameSshKey as Wn, SIGNAL_FRESH_MS as Wo, BUTTON_ID as Wp, verifyAtprotoRecordProof as Wr, TYPING_STATUS_MAX as Ws, GROUP_REACTED_FRAME as Wt, IDENTITY_MAX_VALIDITY as Wu, setAckFrame as Wv, HANDOFF_CAPABILITY as Wx, contactDay as Wy, groupTypingEpoch as X, readOwnRelayPayload as XC, BACKGROUND_WHILE_SIGNALING as XS, handoffAttemptAllowed as X_, HANDLED_WAIT_MS as Xa, verifyAppSignature as Xb, appRangeEndFrame as Xc, DHT_FILE_REFUSED as Xd, editedFrame as Xf, keepsToRelays as Xg, SIGNAL_OUT_READS as Xh, walletNetworkOf as Xi, isHoldUrl as Xl, encryptText as Xm, legacyMessageHash as Xn, GROUP_VERSION_HUBS as Xo, REMOVABLE_KINDS as Xp, DID_JWS_MAX_LENGTH as Xr, sanitizeTypingStatus as Xs, groupMessageId as Xt, IdentityCheckUnavailable as Xu, ENROLL_CANCEL as Xv, deviceLinkParams as Xx, makeStamp as Xy, GroupTypingBoard as Y, parseRelayPayload as YC, BACKGROUND_REQUESTS_PER_MINUTE as YS, handoffAckFrame as Y_, GhostLink as Ya, verifyAppRevocation as Yb, appRangeDataFrame as Yc, ACTIVE_DHT_POLL_MS as Yd, editFrame as Yf, isGlobalIpv4Host as Yg, RELAY_POLL_INTERVALS as Yh, validatePaymentTarget as Yi, HoldRefusedError as Yl, edgeParams as Ym, isLegacySignature as Yn, readGroupSignal as Yo, PR_STATES as Yp, DID_JWS_ALGS as Yr, parseTypingFrame as Ys, frameBytes as Yt, IDENTITY_SUBJECT as Yu, DEVICE_KINDS as Yv, deviceLinkPairing as Yx, linkRecords as Yy, openGroupTyping as Z, signRelayPayload as ZC, BACKGROUND_WRITES_SHARE as ZS, handoffAttemptFailed as Z_, INVITER_DIAL_GRACE_MS as Za, verifyAppStatementBytes as Zb, appRangeErrorFrame as Zc, DHT_FILE_TOO_LARGE as Zd, parseEditFrame as Zf, parseCallSignal as Zg, STALLED_LOOK_MS as Zh, SPARK_NETWORKS as Zi, newMailbox as Zl, epochKeys as Zm, verifyBitcoinMessage as Zn, MESH_HUBS as Zo, ROUTINE_STATES as Zp, DID_MAX_LENGTH as Zr, typingActivity as Zs, COMMUNITY_EDIT_FRAME as Zt, IdentityExchange as Zu, ENROLL_CANCEL_REASONS as Zv, deviceLinkRendezvousSeed as Zx, makeStampPaced as Zy, X401_PROTOCOLS as _, SIGNALING_ALLOWANCE_SHARE as _C, TURN_LABEL as _S, serviceIdFromName as __, pubkyHomeserverOf as _a, assembleAppBundle as _b, WAKE_CALL_TTL_SECONDS as _c, STORAGE_ROOT as _d, VOICE_LIMITS as _f, CHUNK_FLAG_END as _g, ratchetRoot as _h, strictBase64Url as _i, chatAppId as _l, MESSAGE_CLOCK_SKEW_MS as _m, MAX_GROUP_PICTURE_LENGTH as _n, pairedMessageFrame as _o, GROUP_REACTION_FRAME as _p, u32$1 as _r, rankHubs as _s, shortHash as _t, recordsFromWellKnown as _u, handoffStreamKey as _v, sanitizeAvatar as _w, deviceInviteJoinerKeyZ32 as _x, MAX_WAITING as _y, X401_DCQL_LIMITS as a, GROUP_BURST_MS as aC, seedSigner as aS, buildLinkRecords as a_, PUBKY_PROOF_MAX_BYTES as aa, stampHolds as ab, PIN_LIMITS as ac, newIdentityBinding as ad, DHT_FILE_CAPABILITY as af, unusedInviteWait as ag, MAX_SKIP as ah, didWebDocumentUrl as ai, APP_FRAME as al, cardLine as am, validEditText as an, PONG_WAIT_MS as ao, canonicalUrl as ap, BitcoinAddressError as ar, COMMUNITY_TOPOLOGY as as, communityHasFrame as at, NIP05_PATH as au, handoffDoneFrame as av, identityFromSeedB64 as aw, canonicalJson as ax, enrollDoneFrame as ay, buildX401ProofRequest as b, SLOW_MS as bC, TURN_NAME_BYTES as bS, viewerTag as b_, fetchLnurlJson as ba, findAppForbiddenKey as bb, WAKE_INTERVAL_MS as bc, isProofAdapter as bd, downsamplePeaks as bf, MAX_CHUNK_PAYLOAD_BYTES as bg, ratchetUnknownSession as bh, DID_DHT_TTL as bi, parseAppFrame as bl, heardTime as bm, groupMetaBody as bn, ENGINE_ERRORS as bo, REACTION_FRAME as bp, ATPROTO_DECLARED_SCOPE as br, readLobby as bs, verifyCommunityChainPaced as bt, validDomainRecord as bu, handoffVersions as bv, sanitizeDisplayText as bw, readDeviceInvite as bx, clearMissed as by, readX401DcqlQuery as c, GROUP_RATION_WINDOW_MS as cC, TURN_RAISE_READ_TIMEOUT_MS as cS, parseLinkRecords as c_, isPubkyProofFolder as ca, APP_CLIENTS as cb, parsePinFrame as cc, signIdentityPresentation as cd, readDhtFile as cf, HttpHost as cg, RATCHET_HEADER_BYTES as ch, didWebFileUrl as ci, APP_RATE_WINDOW_MS as cl, cardUrl as cm, mentionsBytes as cn, RACE_RELAYED_MS as co, linksIn as cp, decodeAnyBitcoinAddress as cr, doorHubs as cs, communityUntaggedHash as ct, dnsProofName as cu, handoffFileRequestFrame as cv, verify as cw, CONTACT_LINK_BYTES as cx, enrollMessage as cy, newX401HolderKey as d, HEDGE_MS as dC, classifyTurnRead as dS, MAX_SERVICES as d_, pubkyProofCapability as da, APP_ICON_PATH as db, pinIsNewer as dc, applyIdentityEvent as dd, formatFileSize as df, relativizeLocation as dg, RatchetBox as dh, parseDid as di, APP_VERSION_MAX as dl, removedCardText as dm, wireMentions as dn, RTC_UNSTARTED_MS as do, sanitizePreviewImage as dp, decodeWitness as dr, lobbyKeys as ds, encodeCommunityLink as dt, encodeDnsQuery as du, handoffManifestFrames as dv, generateEncryptionKey as dw, encodeContactLink as dx, readEnrollGrant as dy, CHAT_RESERVE_PER_CHAT as eC, devicePingFrame as eS, signalHasVideo as e_, sparkAddressKind as ea, readKnockSlot as eb, COMMUNITY_PIN_FRAME as ec, identityPresentationBytes as ed, DHT_TEXT_REFUSED as ef, UNUSED_INVITE_UPKEEP_MS as eg, openSecret as eh, checkDidJws as ei, encodeAppRangeData as el, TASK_STATUSES as em, carryMentions as en, LIVENESS_PING_MS as eo, validEditNumber as ep, bip322MessageHash as er, meshHubs as es, COMMUNITY_PROFILE as et, DNS_TYPE as eu, handoffCancelFrame as ev, encodeTxtPacket as ew, imageSize as ex, ENROLL_HELLO as ey, readX401SdJwtVc as f, PREVIOUS_DEFAULT_RELAYS as fC, keptAtEqualSequence as fS, SERVICES_VERSION as f_, pubkyProofFile as fa, APP_PERMISSIONS as fb, pinNumberHolds as fc, lastSharedWithMe as fd, safeBlobType as ff, resolveTargetUrl as fg, emptyRatchetState as fh, parseDidDocument as fi, AppSessions as fl, sameButtonText as fm, GROUP_META_PAST as fn, SWITCH_RETIRE_MS as fo, FORWARD_LIMITS as fp, encodeTx as fr, lobbyRecords as fs, leaveStands as ft, isPublicAddress as fu, handoffOfferFrame as fv, sealedLength as fw, readContactLink as fx, readEnrollHello as fy, X401_LIMITS as g, RelaysFailedError as gC, TURN_BODY_BYTES as gS, isViewerTag as g_, homeserverWebEndpoint as ga, appViewOf as gb, WAKE_CALL_INTERVAL_MS as gc, STORAGE_LIFETIME as gd, RECORDING_TYPES as gf, webLocalFetch as gg, ratchetOpen as gh, staticDidDocument as gi, appOpenFrame as gl, usageLeft as gm, MAX_GROUP_NAME_LENGTH as gn, pairedMessageFits as go, COMMUNITY_REACTION_FRAME as gp, txHash as gr, pickHubs as gs, rosterHash as gt, recordsFromTxt as gu, handoffRetryAfter as gv, jpegSize$1 as gw, createDeviceInvite as gx, MAX_MISSED as gy, X401_HEADERS as h, RelayTransport as hC, TOMBSTONE_TURN as hS, isValidServiceId as h_, encodeSvcbPacket as ha, appDigest as hb, DEVICE_WAKE_TTL_SECONDS as hc, PeerProofs as hd, PLAYABLE_AUDIO as hf, viewerResponseHeaders as hg, ratchetOn as hh, signingKeys as hi, appDataFrame as hl, taskProgress as hm, MAX_GROUP_NAME_BYTES as hn, WAKE_LOST_MS as ho, readForwarded as hp, sha256d as hr, newerHead as hs, leftStatement as ht, parseDomainTxt as hu, handoffRequestFrame as hv, MAX_AVATAR_SIDE as hw, DEVICE_INVITE_OWN_DEVICE as hx, MAX_DONE as hy, x401ApprovalDigest as i, FRESH_READ_MS as iC, verifyDeviceTransports as iS, RECORD_TTL as i_, isBitcoinAddress as ia, seenEntry as ib, PIN_FRAME as ic, isIdentityBinding as id, peekDhtMailbox as if, presenceSeenAt as ig, FOLLOW_MS as ih, didSignedMessages as ii, APP_DATA_MAX_BYTES as il, cardEditNumber as im, parseCommunityEdit as in, PAIRING_RETRY_MS as io, LINK_TRAILING as ip, verifyBip322 as ir, wireHubPolicy as is, communityGroupId as it, DOMAIN_TXT_MAX_BYTES as iu, handoffDigest as iv, identityFromSeed as iw, readImageMeta as ix, enrollDigits as iy, readX401ProofResult as j, BREAKER_ALL_DOWN_PROBE_MS as jC, nextTurnPosition as jS, HANDOFF_HAVE as j_, ENDPOINT as ja, APP_STATEMENT_LIMITS as jb, wakePayload as jc, RING_LIFETIME as jd, PLAYABLE_VIDEO as jf, RTC_SIGNAL_MAX_AGE_MS as jg, DIRECT_OWN_ATTEMPTS as jh, openDidDhtPayload as ji, REACTIONS_CAPABILITY as jl, OWN_FRAME_LIMIT as jm, parseGroupMetaFrame as jn, fetchesByItself as jo, readDhtReactions as jp, shortAtprotoDid as jr, FileUplink as js, mergeKnocks as jt, capsDescriptors as ju, readHandoffHello as jv, randomBytes as jw, encodeInviteCode as jx, KNOCK_SLOT_LABEL as jy, readX401ProofResponse as k, setLinkTraceSink as kC, encodeTurnFields as kS, HANDOFF_FILE_MISSING as k_, decodeBolt11 as ka, APP_NAME as kb, relayRequest as kc, verifyNostrProof as kd, voiceLevelsOf as kf, DATA_CHANNEL_LABEL as kg, STALLED_EVIDENCE_MS as kh, encodeDidDhtPacket as ki, KNOWN_SESSION_CAPABILITIES as kl, MAX_GROUP_MEMBERS as km, openGroupMeta as kn, GROUP_WANT_FRAME as ko, reactionFrame as kp, normalizeAtprotoHandle as kr, FILE_FRAMES as ks, knockIdentity as kt, CapsRefusedError as ku, readHandoffFileFrame as kv, fromZ32 as kw, decodeInviteCode as kx, ContactRequestError as ky, x401VpToken as l, GROUP_SIGNALING_ALLOWANCE_SHARE as lC, TURN_SETTLE_MS as lS, HTTP_SERVICE_PROTO as l_, newPubkyProofFolder as la, APP_CLIENT_NAME as lb, parsePinnedFrame as lc, verifyIdentityPresentation as ld, FileTransfers as lf, formatLocalTarget as lg, RATCHET_KEEP_MS as lh, didWebHost as li, APP_RESUME_GRACE_MS as ll, checkStatusCard as lm, mentionsMember as ln, REDESCRIBED_GRACE_MS as lo, parseLinkPreview as lp, decodeBitcoinAddress as lr, freshHubs as ls, decodeCommunityLink as lt, domainTxtRecord as lu, handoffHaveFrames as lv, decrypt as lw, CONTACT_LINK_VERSION as lx, enrollProofFrame as ly, x401HolderJwk as m, REQUESTS_PER_MINUTE as mC, TOMBSTONE_SEQUENCE as mS, encodeServices as m_, decodeSvcbRecords as ma, APP_VIEWS as mb, readPin as mc, PROOF_CAPABILITY as md, sanitizeMime as mf, sanitizeResponseHeaders as mg, ratchetHeard as mh, parseDidSignaturePaste as mi, appDataBytes as ml, statusCardText as mm, MAX_GROUP_META_BODY as mn, WAKE_ANSWER_GRACE_MS as mo, forwardedMany as mp, hash160 as mr, mergeLobby as ms, leaveStatement3 as mt, normalizeDomain as mu, handoffReleaseFrame as mv, MAX_AVATAR_LENGTH as mw, DEVICE_INVITE_LIFETIME_S as mx, FLOOD_PER_DAY as my, X401_RESPONSE_MODES as n, DEFAULT_RELAYS as nC, signDeviceTransports as nS, LABEL$1 as n_, sparkNetworkOf as na, requestPlaintextBytes as nb, PINNED_FRAME as nc, identityStatement as nd, LIVE_POLL_MS as nf, WATCH_PEER_MS as ng, sealSecret as nh, didGhostlyServiceEntry as ni, parseAppRangeFrame as nl, appCardUrl as nm, communityMessageAuthor as nn, PAIRED_FRAME_TOO_LARGE as no, LINK_MAX_CHARS as np, bip322ToSpend as nr, parseHubPolicy as ns, GROUP_READ_NOTE_COMMUNITY as nt, DOMAIN_MAX_RECORDS as nu, handoffContextProof as nv, IDENTITY_MEMO_SIZE as nw, parseImageMeta as nx, enrollCancelFrame as ny, matchX401Dcql as o, GROUP_BURST_ONE_LINK as oC, webCryptoSigner as oS, emptyLinkRecords as o_, PUBKY_PROOF_ROOT as oa, APP_BUNDLE_LIMITS as ob, mayPin as oc, receivedIdentityStatus as od, dhtFileElements as of, GhostlyHttpError as og, MAX_SKIPPED_KEYS as oh, didWebFile as oi, APP_PEER_OPEN_MAX as ol, cardLinkHost as om, MENTION_EVERYONE as on, RACE_ANSWERED_MS as oo, linkEnd as op, ByteReader as or, beaconKeys as os, communityMessageId as ot, WELL_KNOWN_PATH as ou, handoffEphemeral as ov, publicKeyFromZ32 as ow, canonicalJsonBytes as ox, enrollGrantFrame as oy, sameX401HolderJwk as p, RELAY_REQUESTS_PER_MINUTE as pC, turnPutSummary as pS, decodeServices as p_, pubkyProofPath as pa, APP_SCREENSHOTS_DIR as pb, pinnedFrame as pc, PROOF_ADAPTERS as pd, sanitizeFileName as pf, sanitizeRequestHeaders as pg, isRatcheted as ph, parseDidJws as pi, appCloseFrame as pl, statusCardBytes as pm, GROUP_META_PAST_CHARS as pn, UNPROVEN_AUTH_MS as po, forwardedAgain as pp, encodeWitness as pr, mergeBeacon as ps, leaveStatement as pt, nip05RootKey as pu, handoffPakeFrame as pv, tryDecrypt as pw, DEVICE_INVITE_BYTES as px, verifyEnrollProof as py, signAppStore as q, newerPacket as qC, turnStatedVerifier as qS, filePartDigest as q_, EARLY_DIAL_JOIN_MS as qa, signAppObject as qb, appRangeCancelFrame as qc, relayedTransports as qd, RateWindow as qf, extractParamsFromSdp as qg, PRESENCE_HEARTBEAT as qh, isWalletNetwork as qi, HOLD_LIMITS as ql, confirmationTag as qm, sshSignCommand as qn, SIGNAL_REPLY_MS as qo, ITEM_STATES as qp, DID_FILE_MAX_BYTES as qr, TypingSender as qs, asWritten as qt, IDENTITY_REVOCATION_LABEL as qu, signTombstone as qv, deviceFrameCapability as qx, knockSlotOf as qy, readX401OpenId4VpRequest as r, DEPARTED_READS as rC, unsignedDeviceTransports as rS, MAX_MSGS_PAYLOAD_B64 as r_, BITCOIN_NETWORKS as ra, requestRecords as rb, PIN_CLOCK_SKEW_MS as rc, identityStatementText as rd, emptyDhtDeliveryState as rf, countUnusedInvite as rg, sha256Hex as rh, didJwsAlg as ri, readAppRangeFrame as rl, buttonLabelClash as rm, meshMessageRef as rn, PAIRING_ATTEMPT_MS as ro, LINK_PREVIEW_LIMITS as rp, decodeBase64 as rr, pickMeshHubs as rs, communityCommitHash as rt, DOMAIN_METHODS as ru, handoffDataFrame as rv, createIdentity as rw, previewable as rx, enrollCancelReason as ry, presentX401SdJwtVc as s, GROUP_OVER_PACE_MS as sC, TURN_PUT_WINDOW_MS as sS, isEmptyLinkPacket as s_, isPubkyKey as sa, APP_BUNDLE_MAGIC as sb, nextPinNumber as sc, revokesIdentity as sd, dhtFileId as sf, HttpClient as sg, RATCHET_CAPABILITY as sh, didWebFileNames as si, APP_RATE_LIMIT as sl, cardTimeUtc as sm, MENTION_LIMITS as sn, RACE_DIRECT_MS as so, linkStop as sp, compactSize as sr, beaconRecords as ss, communityRoster as st, decodeDnsResponse as su, handoffFileMissingFrame as sv, sign as sw, readCanonicalJson as sx, enrollHelloFrame as sy, X401_REQUEST_LIMITS as t, CHAT_WATCH_SHARE as tC, newDeviceSetSecret as tS, waitForIceGathering as t_, sparkInvoiceDetails as ta, readLinkRecord as tb, GROUP_PIN_FRAME as tc, identityRevocationValue as td, DhtDelivery as tf, UNUSED_INVITE_WAIT_MAX_MS as tg, sealPair as th, checkDidSignature as ti, isServeId as tl, appCardId as tm, communityEditFrame as tn, MAX_PAIRED_MESSAGE_FRAME as to, validRemovalNumber as tp, bip322ToSign as tr, meshRendezvous as ts, CommunitySession as tt, DOMAIN_FILE_MAX_BYTES as tu, handoffContext as tv, readDnsName as tw, isImageMime as tx, ENROLL_PROOF as ty, X401_CREDENTIAL_LIMITS as u, HEDGE_MISSING_MS as uC, TURN_VISIBLE_MS as uS, LEGACY_SERVICES as u_, normalizePubkyKey as ua, APP_FORBIDDEN_KEYS as ub, pinFrame as uc, IDENTITY_TIMELINE_MAX as ud, PREVIEWABLE_IMAGE as uf, parseLocalTarget as ug, RATCHET_OVERHEAD as uh, normalizeDid as ui, APP_SEND_LIMIT as ul, readStatusCard as um, validMentions as un, RESUME_WAIT_MS as uo, previewImageSize as up, decodeTx as ur, hubRank as us, derivedSecret as ut, domainWellKnownFile as uu, handoffHelloFrame as uv, encrypt as uw, createContactLink as ux, formatEnrollDigits as uy, X401_SCHEME as v, SIGNALING_WINDOW_MS as vC, TURN_LAST_SEQUENCE as vS, servicesFromWire as v_, LIGHTNING_DESTINATION_PATTERN as va, buildAppBundle as vb, WAKE_CALL_WAIT_MS as vc, emptyProofLedger as vd, VOICE_METER as vf, CHUNK_KIND as vg, ratchetSeal as vh, DID_DHT_MAX_PAYLOAD as vi, isAppVersion as vl, arrivalKey as vm, encodeGroupMetaBody as vn, parsePaymentNetworks as vo, QUICK_REACTIONS as vp, u64 as vr, readBeacon as vs, signCommunity as vt, recordsName as vu, handoffVerifiedFrame as vv, MAX_NICK_LENGTH as vw, deviceInviteJoinerParams as vx, NEW_PER_HOUR as vy, decodeX401Header as w, WRITE_FIRST_MS as wC, TURN_SIGNED_BYTES as wS, HANDOFF_BUSY_REASONS as w_, parseLightningDestination as wa, pacer as wb, deviceWakeRequest as wc, proofStatement as wd, parseVoiceMeta as wf, encodeChunk as wg, DataLink as wh, didDhtDocument as wi, BUTTONS_CAPABILITY as wl, GROUP_ID as wm, groupMetaTag as wn, parseEngineError as wo, parseReactedFrame as wp, atprotoDidMethod as wr, PAIRED_CALL_FRAME as ws, MAX_KNOCKS as wt, CAPS_LIMITS as wu, readHandoffAck as wv, unwrapPasted as ww, INVITE_MAX_LENGTH as wx, planKnocks as wy, buildX401ProofResult as x, TURN_SOURCE_TIMEOUT_MS as xC, TURN_NO_ACTIVE as xS, HANDOFF_ACK as x_, findLightningDestination as xa, isAppLicense as xb, WAKE_SUBJECT as xc, nostrProofTemplate as xd, fileMessageText as xf, PROTOCOL_VERSION as xg, ANSWER_REFUSED_REDIALS as xh, DID_DHT_VERSION as xi, readAppFrame as xl, receivedTimestamp as xm, groupMetaChange as xn, EngineError as xo, REACTION_LIMITS as xp, ATPROTO_FULL_SCOPE as xr, shouldBeHub as xs, verifyCommunityCommit as xt, wellKnownUrl as xu, isHandoffPartName as xv, sanitizeNick as xw, DEVICE_INVITE_VERSION as xx, endedRequests as xy, X401_VERSION as y, SLOW_DEMOTE_MS as yC, TURN_MAX as yS, servicesToWire as y_, LNURL_LIMITS as ya, checkAppManifest as yb, WAKE_FRAME as yc, importedProof as yd, baseMime as yf, LIMITS as yg, ratchetSessionOf as yh, DID_DHT_PREFIX as yi, isChatAppId as yl, claimedTime as ym, groupDisplayName as yn, publishFailure as yo, REACTED_FRAME as yp, varBytes as yr, readBeaconHead as ys, verifyCommunityChain as yt, txtValue as yu, handoffVerifiedMessage as yv, hasVisible as yw, encodeDeviceInvite as yx, REOPEN_BELOW as yy, planAppUpdate as z, isDiscoveryBudgetError as zC, turnInstance as zS, HANDOFF_PIECE_OVERHEAD as z_, ANSWERS_REFUSED_PAUSE_MS as za, isAppKey as zb, pushRequest as zc, RELAY_WITH_SECRETS as zd, EDIT_BUFFER_MS as zf, RTC_CONFIG as zg, EXPECT_PEER_MS as zh, SEPOLIA_TEST_USDT_FAUCET as zi, parseSessionCapabilities as zl, rosterHas as zm, SSH_KEY_TYPES as zn, CarriedTransport as zo, pairedReplyAuthor as zp, parseAtprotoCar as zr, TYPING_KINDS as zs, groupWakeFrame as zt, IDENTITY_FRAME_LIMIT as zu, sortParts as zv, __exportAll as zw, DEVICES_CAPABILITY as zx, REQUEST_PACKET_BYTES as zy };
39379
+ export { COMMUNITY_LIMITS as $, heldBackError as $C, signTurnRelease as $S, HANDOFF_TIMINGS as $_, DEMOTE_AFTER_FAILURES as $a, isAppKey as $b, APP_RANGE_FRAMES as $c, irohRelayUrl as $d, MAX_EDITS_PER_MESSAGE as $f, callRtcConfig as $g, OFFER_FAST_MS as $h, isSparkAddress as $i, SESSION_RECEIVE_PENDING as $l, verifyCommitSignature as $m, MessageRefusal as $n, SIGNAL_FRESH_MS as $o, BUTTON_ID as $p, DidError as $r, TYPING_STATUS_MAX as $s, GROUP_EDIT_TEXT_BYTES as $t, IDENTITY_MAX_VALIDITY as $u, encodeSetSlots as $v, __commonJSMin as $w, readInviteCode as $x, STAMP_BITS_DEFAULT as $y, readX401ProofResponseHeader as A, RelayTransport as AC, TOMBSTONE_TURN as AS, servicesToWire as A_, findBolt11 as Aa, appViewOf as Ab, WAKE_SUBJECT as Ac, nostrProofTemplate as Ad, fileMessageText as Af, LIMITS as Ag, ANSWER_REFUSED_REDIALS as Ah, jwkThumbprint as Ai, readAppFrame as Al, receivedTimestamp as Am, parseGroupMetaBody as An, EngineError as Ao, REACTION_LIMITS as Ap, parseAtprotoDidDocument as Ar, shouldBeHub as As, knockRecords as At, wellKnownUrl as Au, handoffVerifiedMessage as Av, MAX_AVATAR_SIDE as Aw, DEVICE_INVITE_OWN_DEVICE as Ax, REOPEN_BELOW as Ay, APP_STORE_KINDS as B, currentRelays as BC, TURN_SLOTS as BS, HANDOFF_FILE_MISSING as B_, videoMetadataPatches as Ba, readAppBundleAsync as Bb, wakePayload as Bc, RING_LIFETIME as Bd, PLAYABLE_VIDEO as Bf, DATA_CHANNEL_LABEL as Bg, DIRECT_OWN_ATTEMPTS as Bh, TEST_USDT_FAUCET_AMOUNT as Bi, REACTIONS_CAPABILITY as Bl, OWN_FRAME_LIMIT as Bm, SSH_PUBLIC_KEY_MAX as Bn, fetchesByItself as Bo, readDhtReactions as Bp, parseAtprotoDidKey as Br, FileUplink as Bs, groupWakes as Bt, capsDescriptors as Bu, readHandoffFileFrame as Bv, unwrapPasted as Bw, INVITE_VERSION as Bx, CONTACT_RECORD_TTL as By, buildX401TokenObject as C, GROUP_RATION_WINDOW_MS as CC, TURN_RAISE_READ_TIMEOUT_MS as CS, SERVICES_VERSION as C_, parseInvoiceCallback as Ca, APP_CLIENT_NAME as Cb, readPin as Cc, PROOF_CAPABILITY as Cd, sanitizeMime as Cf, sanitizeRequestHeaders as Cg, ratchetHeard as Ch, decodeDidDhtPacket as Ci, appDataBytes as Cl, statusCardText as Cm, groupMetaPicture as Cn, WAKE_ANSWER_GRACE_MS as Co, forwardedMany as Cp, ATPROTO_PROOF_SCOPE as Cr, mergeLobby as Cs, KNOCK_TTL_MS as Ct, normalizeDomain as Cu, handoffOfferFrame as Cv, verify as Cw, CONTACT_LINK_BYTES as Cx, readEnrollHello as Cy, readX401ProofRequest as D, PREVIOUS_DEFAULT_RELAYS as DC, keptAtEqualSequence as DS, isViewerTag as D_, resolveLightningDestination as Da, APP_SCREENSHOTS_DIR as Db, WAKE_CALL_WAIT_MS as Dc, emptyProofLedger as Dd, VOICE_METER as Df, withViewerPolicy as Dg, ratchetSeal as Dh, didDhtRecords as Di, isAppVersion as Dl, arrivalKey as Dm, keepPastGroupMeta as Dn, parsePaymentNetworks as Do, QUICK_REACTIONS as Dp, checkAtprotoProofRecord as Dr, readBeacon as Ds, entryParams as Dt, recordsName as Du, handoffRetryAfter as Dv, sealedLength as Dw, readContactLink as Dx, MAX_MISSED as Dy, isX401Protocol as E, HEDGE_MS as EC, classifyTurnRead as ES, isValidServiceId as E_, requestLnurlInvoice as Ea, APP_PERMISSIONS as Eb, WAKE_CALL_TTL_SECONDS as Ec, STORAGE_ROOT as Ed, VOICE_LIMITS as Ef, webLocalFetch as Eg, ratchetRoot as Eh, didDhtKey as Ei, chatAppId as El, MESSAGE_CLOCK_SKEW_MS as Em, groupName as En, pairedMessageFrame as Eo, GROUP_REACTION_FRAME as Ep, atprotoProofRkey as Er, rankHubs as Es, encodeGroupEntryLink as Et, recordsFromWellKnown as Eu, handoffRequestFrame as Ev, generateEncryptionKey as Ew, encodeContactLink as Ex, MAX_DONE as Ey, appRevocationFor as F, SLOW_MS as FC, TURN_NAME_BYTES as FS, HANDOFF_BUSY_REASONS as F_, isFederationId as Fa, isAppLicense as Fb, parseWakeFrame as Fc, storageProofBody as Fd, voiceDownloadName as Ff, encodeChunk as Fg, GATHER_STALL_MS as Fh, EVM_TEST_CHAINS as Fi, EDIT_CAPABILITY as Fl, GROUP_VERSION_LARGE as Fm, verifyGroupMetaSignature as Fn, GROUP_FILE_LIMITS as Fo, queueReaction as Fp, decodeAtprotoCommit as Fr, parsePairedCallFrame as Fs, GROUP_WAKE_GROUP_WINDOW_MS as Ft, CAPS_REFRESH_MS as Fu, readHandoffAck as Fv, hasVisible as Fw, readDeviceInvite as Fx, planKnocks as Fy, readAppStore as G, traceLink as GC, firstDeviceSetSecret as GS, HANDOFF_LIST_PER_FRAME as G_, stripPictureMetadata as Ga, APP_STATEMENT_LIMITS as Gb, decryptPushPayload as Gc, verifyRingAuthorization as Gd, parseVideoMeta as Gf, offerIsFresh as Gg, AWAITING_PEER_MS as Gh, assertWholeSats as Gi, TYPING_CAPABILITY as Gl, parseGroupCommit as Gm, sshFingerprint as Gn, readGroupWant as Go, REPLY_ID as Gp, verifyAtprotoSignature as Gr, transferEnded as Gs, GROUP_READ_NOTE as Gt, IDENTITY_CHALLENGE_WINDOW as Gu, readHandoffRelease as Gv, fromZ32 as Gw, encodeGhostlyInvite as Gx, MAX_SEEN as Gy, checkAppListing as H, readRelayBody as HC, TURN_VERSION as HS, HANDOFF_HAVE as H_, NO_PICTURE_METADATA as Ha, yieldThread as Hb, PUSH_SERVICE_HOSTS as Hc, ringClaims as Hd, formatVideoDuration as Hf, RTC_SIGNAL_MAX_AGE_MS as Hg, DirectPathWatch as Hh, WALLET_NETWORKS as Hi, SESSION_CAPABILITIES_FRAME as Hl, commitHash as Hm, parseSshPublicKey as Hn, isGroupMessageId as Ho, validReactionNumber as Hp, readAtprotoCid as Hr, encodeFileData as Hs, parseGroupWakeFrame as Ht, emptyCapsState as Hu, readHandoffHello as Hv, concatBytes as Hw, createChatInvite as Hx, KNOCK_SLOTS as Hy, appStoreDecision as I, TURN_SOURCE_TIMEOUT_MS as IC, TURN_NO_ACTIVE as IS, HANDOFF_CANCEL as I_, parseCashuRequestPayload as Ia, isAppPath as Ib, readWake as Ic, storageProofPath as Id, voiceFileName as If, encodeControl as Ig, OFFER_HOST_GATHER_MS as Ih, ONCHAIN_PROVIDER as Ii, FILES_BINARY_CAPABILITY as Il, LEGACY_GROUP_MEMBERS as Im, wrapGroupMeta as In, GROUP_HAVE_FRAME as Io, reactedFrame as Ip, decodeDagCbor as Ir, ChatFiles as Is, GROUP_WAKE_MEMBER_INTERVAL_MS as It, CapsExchange as Iu, readHandoffBusy as Iv, sanitizeDisplayText as Iw, DEVICE_INVITE_VERSION as Ix, settleRequest as Iy, GROUP_TYPING_FRAME as J, BREAKER_MAX_MS as JC, readTurnBody as JS, HANDOFF_PAKE as J_, ANSWERS_REFUSED_PAUSE_MS as Ja, appRefPublisher as Jb, pushRequest as Jc, RELAY_WITH_SECRETS as Jd, EDIT_BUFFER_MS as Jf, CALL_SIGNAL_MAX_AGE_MS as Jg, EXPECT_PEER_MS as Jh, parsePaymentAmount as Ji, parseSessionCapabilities as Jl, rosterHas as Jm, verifySshSignature as Jn, CarriedTransport as Jo, pairedReplyAuthor as Jp, DID_GHOSTLY_SERVICE as Jr, TYPING_KINDS as Js, chainPieces as Jt, IDENTITY_FRAME_LIMIT as Ju, sameDigest as Jv, toBase64 as Jw, inviteOwnership as Jx, REQUEST_LABEL as Jy, readAppStoreSteps as K, BREAKER_ALL_DOWN_PROBE_MS as KC, nextTurnPosition as KS, HANDOFF_MANIFEST as K_, withoutPictureMetadata as Ka, appFingerprint as Kb, encryptPushPayload as Kc, verifyRingEvidence as Kd, EDITED_FRAME as Kf, parseRtcSignal as Kg, DEPARTED_READ_MS as Kh, formatPaymentAmount as Ki, UPGRADE_CAPABILITY as Kl, rememberAlone as Km, sshKeyDigestHex as Kn, readGroupWantNo as Ko, REPLY_LIMITS as Kp, DID_DOCUMENT_MAX_BYTES as Kr, transferStalled as Ks, GroupSession as Kt, IDENTITY_CHECK_UNAVAILABLE as Ku, readHandoffTurnFrame as Kv, isZ32Key as Kw, encodeInviteCode as Kx, MAX_SLOT_KNOCKS as Ky, appUpdateDecision as L, WATCH_SHARE as LC, TURN_REV_LIMIT as LS, HANDOFF_CANCEL_REASONS as L_, parseFedimintRequestPayload as La, isAppUrl as Lb, readWakePayload as Lc, validExternalKey as Ld, voiceLevel as Lf, sendBody as Lg, REANSWERS as Lh, PaymentPreflightError as Li, FILES_CAPABILITY as Ll, MAX_GROUP_CHAIN as Lm, SSHSIG_MAX_ARMOR as Ln, GROUP_VERSION_FILES as Lo, reactionEmoji as Lp, encodeDagCbor as Lr, FILE_DATA_KIND as Ls, GROUP_WAKE_RECEIVE_LIMIT as Lt, CapsKeys as Lu, readHandoffCancel as Lv, sanitizeNick as Lw, INVITE_HRP as Lx, takeRequest as Ly, readX401ProofResultHeader as M, SIGNALING_ALLOWANCE_SHARE as MC, TURN_LABEL as MS, HANDOFF_ACK as M_, cashuRequestPayload as Ma, buildAppBundle as Mb, WakeLimiter as Mc, proofHash as Md, isPlayableAudioType as Mf, PROTOCOL_VERSION as Mg, DATA_SETTLE_MS as Mh, resolveDidDht as Mi, APP_RANGES_CAPABILITY as Ml, GROUP_ADMIN_OFF_ERROR as Mm, parseGroupMetaStatement as Mn, engineText as Mo, nextReactionNumber as Mp, AtprotoCid as Mr, MAX_PAIRED_CALL_SIGNAL as Ms, readKnocks as Mt, CAPS_LABEL as Mu, isHandoffPartName as Mv, sanitizeAvatar as Mw, deviceInviteJoinerKeyZ32 as Mx, endedRequests as My, x401AnswerableRequests as N, SIGNALING_WINDOW_MS as NC, TURN_LAST_SEQUENCE as NS, HANDOFF_ATTEMPTS as N_, fedimintRequestPayload as Na, checkAppManifest as Nb, deviceWakeRequest as Nc, proofStatement as Nd, parseVoiceMeta as Nf, decodeChunk as Ng, DataLink as Nh, signDidDhtPacket as Ni, BUTTONS_CAPABILITY as Nl, GROUP_ID as Nm, parseGroupMetaTag as Nn, parseEngineError as No, parseReactedFrame as Np, AtprotoProofError as Nr, PAIRED_CALL_FRAME as Ns, GROUP_WAKE_FRAME as Nt, CAPS_LIMITS as Nu, newHandoffId as Nv, MAX_NICK_LENGTH as Nw, deviceInviteJoinerParams as Nx, inboxRecord as Ny, readX401ProofRequestHeader as O, RELAY_REQUESTS_PER_MINUTE as OC, turnPutSummary as OS, serviceIdFromName as O_, BOLT11_PATTERN as Oa, APP_VIEWS as Ob, WAKE_FRAME as Oc, importedProof as Od, baseMime as Of, CHUNK_FLAG_END as Og, ratchetSessionOf as Oh, encodeDidDhtDeactivated as Oi, isChatAppId as Ol, claimedTime as Om, nextGroupMetaRevision as On, publishFailure as Oo, REACTED_FRAME as Op, isAtprotoDid as Or, readBeaconHead as Os, groupEntryUrl as Ot, txtValue as Ou, handoffStreamKey as Ov, tryDecrypt as Ow, DEVICE_INVITE_BYTES as Ox, MAX_WAITING as Oy, addedAppPermissions as P, SLOW_DEMOTE_MS as PC, TURN_MAX as PS, HANDOFF_BUSY as P_, findEndpoint as Pa, findAppForbiddenKey as Pb, newWakeToken as Pc, storageProof as Pd, recordingMime as Pf, decodeControl as Pg, GATHER_ATTEMPTS as Ph, ETHEREUM_USDT as Pi, CALLS_CAPABILITY as Pl, GROUP_MEMBER_CAP as Pm, signGroupMeta as Pn, PairingTracker as Po, parseReactionFrame as Pp, atprotoCidFor as Pr, PairedCalls as Ps, GROUP_WAKE_GROUP_LIMIT as Pt, CAPS_PUBLISH_SPACING_MS as Pu, openHandoffPiece as Pv, dropLoneJoiners as Pw, encodeDeviceInvite as Px, newInbox as Py, sealGroupTyping as Q, budgetRetryMs as QC, signTurnPacket as QS, HANDOFF_REQUEST as Q_, CROSSED_WAIT_MS as Qa, isAppHash as Qb, APP_RANGE_ERRORS as Qc, irohDescriptor as Qd, EDIT_SEND_LIMIT as Qf, buildSdpFromSignal as Qg, MAX_DHT_TEXT_BYTES as Qh, SPARK_PROVIDER as Qi, SESSION_FRAME_MAX as Ql, verifyCommit as Qm, BIP322_REVISION as Qn, SIGNAL_CARRIERS as Qo, ACTIVE_TASK_STATUSES as Qp, DID_METHODS as Qr, TYPING_SEND_LIMIT as Qs, GROUP_EDIT_FRAME as Qt, IDENTITY_MAX_RECEIVED as Qu, SET_UPDATE as Qv, utf8Encode as Qw, pastedAgain as Qx, REQUEST_TEXT_BYTES as Qy, checkAppBeforeRun as R, WAY_BACK_SHARE as RC, TURN_SEALED_BYTES as RS, HANDOFF_DATA as R_, NO_VIDEO_METADATA as Ra, pacer as Rb, relayRequest as Rc, verifyNostrProof as Rd, voiceLevelsOf as Rf, wrapDataChannel as Rg, STALLED_EVIDENCE_MS as Rh, SEPOLIA_TEST_USDT as Ri, KNOWN_SESSION_CAPABILITIES as Rl, MAX_GROUP_MEMBERS as Rm, SSHSIG_NAMESPACE as Rn, GROUP_WANT_FRAME as Ro, reactionFrame as Rp, findInMst as Rr, FILE_FRAMES as Rs, GroupWakeLimiter as Rt, CapsRefusedError as Ru, readHandoffData as Rv, stripHidden as Rw, INVITE_LINK_ORIGIN as Rx, turnOff as Ry, buildX401ResultArtifact as S, GROUP_OVER_PACE_MS as SC, TURN_PUT_WINDOW_MS as SS, MAX_SERVICES as S_, invoiceCallbackUrl as Sa, APP_CLIENTS as Sb, pinnedFrame as Sc, PROOF_ADAPTERS as Sd, sanitizeFileName as Sf, resolveTargetUrl as Sg, isRatcheted as Sh, DidDhtError as Si, appCloseFrame as Sl, statusCardBytes as Sm, groupMetaNewer as Sn, UNPROVEN_AUTH_MS as So, forwardedAgain as Sp, ATPROTO_PROOF_COLLECTION as Sr, mergeBeacon as Ss, GROUP_ENTRY_PROFILE as St, nip05RootKey as Su, handoffManifestFrames as Sv, sign as Sw, readCanonicalJson as Sx, readEnrollGrant as Sy, encodeX401Header as T, HEDGE_MISSING_MS as TC, TURN_VISIBLE_MS as TS, encodeServices as T_, parsePayParams as Ta, APP_ICON_PATH as Tb, WAKE_CALL_INTERVAL_MS as Tc, STORAGE_LIFETIME as Td, RECORDING_TYPES as Tf, viewerResponseHeaders as Tg, ratchetOpen as Th, didDhtFromPublicKey as Ti, appOpenFrame as Tl, usageLeft as Tm, groupMetaToHand as Tn, pairedMessageFits as To, COMMUNITY_REACTION_FRAME as Tp, atprotoProofRecord as Tr, pickHubs as Ts, decodeGroupEntryLink as Tt, recordsFromTxt as Tu, handoffReleaseFrame as Tv, encrypt as Tw, createContactLink as Tx, FLOOD_PER_DAY as Ty, checkAppStoreIndex as U, relayUrlProblem as UC, TurnRecordError as US, HANDOFF_HELLO as U_, PICTURE_METADATA_LIMITS as Ua, APP_NAME as Ub, WebPushError as Uc, ringEvidence as Ud, isPlayableVideoType as Uf, buildDataSdp as Ug, directBlocked as Uh, arkAddressPrefix as Ui, STATUS_CARD_CAPABILITY as Ul, commitUntaggedHash as Um, parseSshSignature as Un, readGroupFileMeta as Uo, wireReaction as Up, unsignedCommitBytes as Ur, refusalText as Us, GROUP_LIMITS as Ut, encodePacketTransports as Uu, readHandoffManifest as Uv, fromBase64 as Uw, createLink as Ux, KNOCK_SLOT_LABEL as Uy, APP_STORE_LIMITS as V, normalizeRelayUrl as VC, TURN_TTL as VS, HANDOFF_FILE_REQUEST as V_, withoutVideoMetadata as Va, sha256Paced as Vb, wakeRequest as Vc, ringAuthorization as Vd, VIDEO_LIMITS as Vf, RTC_SIGNAL_FUTURE_MS as Vg, DIRECT_PEERS as Vh, USDT_PUBLIC_RPC as Vi, SERVICES_CAPABILITY as Vl, SAID_AGAIN as Vm, SshSigError as Vn, groupFileFallback as Vo, readReaction as Vp, parseAtprotoVerificationKey as Vr, decodeFileData as Vs, mentionedMembers as Vt, dialDescriptors as Vu, readHandoffHave as Vv, bytesEqual as Vw, OwnInviteError as Vx, ContactRequestError as Vy, readAppListing as W, setLinkTraceSink as WC, encodeTurnFields as WS, HANDOFF_LATER_BYTES as W_, isStrippedPicture as Wa, APP_PREFIXES as Wb, checkPushEndpoint as Wc, validRingKey as Wd, isVideoMime as Wf, extractRtcParams as Wg, symmetricNat as Wh, assertTokenUnits as Wi, SessionCapabilities as Wl, expectedRoster as Wm, sameSshKey as Wn, readGroupHave as Wo, PAIRED_REPLY_AUTHORS as Wp, verifyAtprotoRecordProof as Wr, sentWhole as Ws, GROUP_REACTED_FRAME as Wt, parsePacketTransports as Wu, readHandoffPake as Wv, fromBase64Url as Ww, decodeInviteCode as Wx, LINK_RECORD_LABEL as Wy, groupTypingEpoch as X, RelayBreaker as XC, sealTurnBody as XS, HANDOFF_PIECE_OVERHEAD as X_, CROSSED_FRESH_MS as Xa, appSignedBytes as Xb, vapidKeysMatch as Xc, automaticTransport as Xd, EDIT_RATE_WINDOW_MS as Xf, RTC_CONFIG as Xg, IDLE_THRESHOLD as Xh, walletNetworkOf as Xi, PAIRED_PROFILE as Xl, sortRoster as Xm, legacyMessageHash as Xn, GROUP_VERSION_SIGNALS as Xo, replySnippet as Xp, DID_JWS_MAX_LENGTH as Xr, TYPING_RATE_WINDOW_MS as Xs, groupMessageId as Xt, IDENTITY_MAX_EVIDENCE as Xu, sortParts as Xv, toZ32 as Xw, inviteQrText as Xx, REQUEST_NAME_UNITS as Xy, GroupTypingBoard as Y, BREAKER_THRESHOLD as YC, readTurnPacket as YS, HANDOFF_PIECE_BYTES as Y_, BLOCKED_DIAL_WAIT_MS as Ya, appRevocationId as Yb, vapidAuthorization as Yc, TRANSPORTS as Yd, EDIT_FRAME as Yf, PAIRED_CALL_CANDIDATES as Yg, FIRST_PUBLISH_MAX_MS as Yh, validatePaymentTarget as Yi, sessionCapabilitiesFrame as Yl, signCommit as Ym, isLegacySignature as Yn, GROUP_SIGNAL_FRAME as Yo, readReply as Yp, DID_JWS_ALGS as Yr, TYPING_RATE_LIMIT as Ys, frameBytes as Yt, IDENTITY_FRAME_WINDOW_MS as Yu, sealHandoffPiece as Yv, toBase64Url as Yw, inviteQrSegments as Yx, REQUEST_LIFETIME_MS as Yy, openGroupTyping as Z, DiscoveryBudgetError as ZC, signTurnBody as ZS, HANDOFF_RELEASE as Z_, CROSSED_PROBE_MS as Za, checkAppRevokeStatement as Zb, APP_RANGE_DATA_KIND as Zc, checkedDescriptors as Zd, EDIT_RECEIVE_LIMIT as Zf, answersOffer as Zg, LinkSession as Zh, SPARK_NETWORKS as Zi, PairedSession as Zl, verifyChain as Zm, verifyBitcoinMessage as Zn, SIGNALS_PER_MINUTE as Zo, wireReply as Zp, DID_MAX_LENGTH as Zr, TYPING_REFRESH_MS as Zs, COMMUNITY_EDIT_FRAME as Zt, IDENTITY_MAX_FRAME as Zu, SET_ACK as Zv, utf8Decode as Zw, ownInviteRefusal as Zx, REQUEST_PACKET_BYTES as Zy, X401_PROTOCOLS as _, DEFAULT_RELAYS as _C, signDeviceTransports as _S, emptyLinkRecords as __, pubkyHomeserverOf as _a, requestRecords as _b, parsePinFrame as _c, signIdentityPresentation as _d, readDhtFile as _f, HttpHost as _g, RATCHET_HEADER_BYTES as _h, strictBase64Url as _i, APP_RATE_WINDOW_MS as _l, cardUrl as _m, MAX_GROUP_PICTURE_LENGTH as _n, RACE_RELAYED_MS as _o, linksIn as _p, u32$1 as _r, doorHubs as _s, shortHash as _t, dnsProofName as _u, handoffEphemeral as _v, IDENTITY_MEMO_SIZE as _w, parseImageMeta as _x, enrollGrantFrame as _y, X401_DCQL_LIMITS as a, turnReleaseMessage as aC, HANDOFF_CAPABILITY as aS, heardCallSignal as a_, PUBKY_PROOF_MAX_BYTES as aa, knockHolds as ab, sanitizeTypingStatus as ac, IdentityCheckUnavailable as ad, DHT_FILE_REFUSED as af, SIGNAL_OUT_READS as ag, encryptText as ah, didWebDocumentUrl as ai, appRangeEndFrame as al, REMOVABLE_KINDS as am, validEditText as an, HANDLED_WAIT_MS as ao, editedFrame as ap, BitcoinAddressError as ar, GROUP_VERSION_HUBS as as, communityHasFrame as at, isHoldUrl as au, filePartName as av, RELAY_PAYLOAD_MAX_BYTES as aw, readAppRevocations as ax, verifySetUpdate as ay, buildX401ProofRequest as b, GROUP_BURST_MS as bC, seedSigner as bS, HTTP_SERVICE_PROTO as b_, fetchLnurlJson as ba, APP_BUNDLE_LIMITS as bb, pinIsNewer as bc, applyIdentityEvent as bd, formatFileSize as bf, parseLocalTarget as bg, RatchetBox as bh, DID_DHT_TTL as bi, APP_VERSION_MAX as bl, removedCardText as bm, groupMetaBody as bn, RTC_UNSTARTED_MS as bo, sanitizePreviewImage as bp, ATPROTO_DECLARED_SCOPE as br, lobbyKeys as bs, verifyCommunityChainPaced as bt, encodeDnsQuery as bu, handoffHaveFrames as bv, identityFromSeedB64 as bw, canonicalJson as bx, enrollProofFrame as by, readX401DcqlQuery as c, turnStatedVerifier as cC, deviceFrameCapability as cS, parseCallSignal as c_, isPubkyProofFolder as ca, knockSlotRecords as cb, typingKindOf as cc, emptyIdentityLedger as cd, DHT_TEXT_BYTES as cf, UNUSED_INVITE_READS_PER_MINUTE as cg, openPair as ch, didWebFileUrl as ci, decodeAppRangeData as cl, STATUS_CARD_LIMITS as cm, mentionsBytes as cn, LIVENESS_MISSED_PINGS as co, validEditMessage as cp, decodeAnyBitcoinAddress as cr, mayBeHub as cs, communityUntaggedHash as ct, DNS_LABEL as cu, handoffAttemptFailed as cv, newerPacket as cw, signAppObject as cx, ENROLL_CANCEL_REASONS as cy, newX401HolderKey as d, BACKGROUND_WHILE_SIGNALING as dC, deviceLinkParams as dS, signalHasVideo as d_, pubkyProofCapability as da, makeStampPaced as db, PINNED_FRAME as dc, identityStatement as dd, LIVE_POLL_MS as df, WATCH_PEER_MS as dg, sealSecret as dh, parseDid as di, parseAppRangeFrame as dl, appCardUrl as dm, wireMentions as dn, PAIRED_FRAME_TOO_LARGE as do, LINK_MAX_CHARS as dp, decodeWitness as dr, parseHubPolicy as ds, encodeCommunityLink as dt, DOMAIN_MAX_RECORDS as du, handoffCancelFrame as dv, readOwnRelayPayload as dw, verifyAppSignature as dx, ENROLL_HELLO as dy, turnInstance as eC, DEVICES_CAPABILITY as eS, __esmMin as eT, callSignalHeardAt as e_, sparkAddressKind as ea, STAMP_BITS_MAX as eb, TYPING_TIMEOUT_MS as ec, IDENTITY_PROOF_CAPABILITY as ed, rankTransports as ef, OFFER_LOOK_MS as eg, GROUP_PROFILE as eh, checkDidJws as ei, APP_RANGE_LIMITS as el, BUTTON_STYLES as em, carryMentions as en, DEMOTE_MS as eo, MAX_REMOVAL_NUMBER as ep, bip322MessageHash as er, SIGNAL_HOLD_MS as es, COMMUNITY_PROFILE as et, HOLD_CAPABILITY as eu, HANDOFF_VERIFIED as ev, isDiscoveryBudgetError as ew, isAppLine as ex, readSetUpdate as ey, readX401SdJwtVc as f, BACKGROUND_WRITES_SHARE as fC, deviceLinkRendezvousSeed as fS, waitForIceGathering as f_, pubkyProofFile as fa, mergeContactKnocks as fb, PIN_CLOCK_SKEW_MS as fc, identityStatementText as fd, emptyDhtDeliveryState as ff, countUnusedInvite as fg, sha256Hex as fh, parseDidDocument as fi, readAppRangeFrame as fl, buttonLabelClash as fm, GROUP_META_PAST as fn, PAIRING_ATTEMPT_MS as fo, LINK_PREVIEW_LIMITS as fp, encodeTx as fr, pickMeshHubs as fs, leaveStands as ft, DOMAIN_METHODS as fu, handoffContext as fv, signRelayPayload as fw, verifyAppStatementBytes as fx, ENROLL_PROOF as fy, X401_LIMITS as g, CHAT_WATCH_SHARE as gC, newDeviceSetSecret as gS, buildLinkRecords as g_, homeserverWebEndpoint as ga, requestPlaintextBytes as gb, nextPinNumber as gc, revokesIdentity as gd, dhtFileId as gf, HttpClient as gg, RATCHET_CAPABILITY as gh, staticDidDocument as gi, APP_RATE_LIMIT as gl, cardTimeUtc as gm, MAX_GROUP_NAME_LENGTH as gn, RACE_DIRECT_MS as go, linkStop as gp, txHash as gr, beaconRecords as gs, rosterHash as gt, decodeDnsResponse as gu, handoffDoneFrame as gv, readDnsName as gw, isImageMime as gx, enrollDoneFrame as gy, X401_HEADERS as h, CHAT_RESERVE_PER_CHAT as hC, devicePingFrame as hS, RECORD_TTL as h_, encodeSvcbPacket as ha, readLinkRecord as hb, mayPin as hc, receivedIdentityStatus as hd, dhtFileElements as hf, GhostlyHttpError as hg, MAX_SKIPPED_KEYS as hh, signingKeys as hi, APP_PEER_OPEN_MAX as hl, cardLinkHost as hm, MAX_GROUP_NAME_BYTES as hn, RACE_ANSWERED_MS as ho, linkEnd as hp, sha256d as hr, beaconKeys as hs, leftStatement as ht, WELL_KNOWN_PATH as hu, handoffDigest as hv, encodeTxtPacket as hw, imageSize as hx, enrollDigits as hy, x401ApprovalDigest as i, turnPayloadSequence as iC, ENROLL_CAPABILITY as iS, extractParamsFromSdp as i_, isBitcoinAddress as ia, contactDay as ib, parseTypingFrame as ic, IDENTITY_SUBJECT as id, ACTIVE_DHT_POLL_MS as if, RELAY_POLL_INTERVALS as ig, edgeParams as ih, didSignedMessages as ii, appRangeDataFrame as il, PR_STATES as im, parseCommunityEdit as in, GhostLink as io, editFrame as ip, verifyBip322 as ir, readGroupSignal as is, communityGroupId as it, HoldRefusedError as iu, filePartDigest as iv, PacketTooLargeError as iw, readAppRevocationShape as ix, signTombstone as iy, readX401ProofResult as j, RelaysFailedError as jC, TURN_BODY_BYTES as jS, viewerTag as j_, ENDPOINT as ja, assembleAppBundle as jb, WAKE_TTL_SECONDS as jc, proofCapability as jd, formatVoiceDuration as jf, MAX_CHUNK_PAYLOAD_BYTES as jg, CONNECT_TIMEOUT_MS as jh, openDidDhtPayload as ji, APPS_CAPABILITY as jl, shownTime as jm, parseGroupMetaFrame as jn, engineError as jo, ReactionWindow as jp, shortAtprotoDid as jr, validHead as js, mergeKnocks as jt, CAPS_ISSUED_BACK_MS as ju, handoffVersions as jv, jpegSize$1 as jw, createDeviceInvite as jx, clearMissed as jy, readX401ProofResponse as k, REQUESTS_PER_MINUTE as kC, TOMBSTONE_SEQUENCE as kS, servicesFromWire as k_, decodeBolt11 as ka, appDigest as kb, WAKE_INTERVAL_MS as kc, isProofAdapter as kd, downsamplePeaks as kf, CHUNK_KIND as kg, ratchetUnknownSession as kh, encodeDidDhtPacket as ki, parseAppFrame as kl, heardTime as km, openGroupMeta as kn, ENGINE_ERRORS as ko, REACTION_FRAME as kp, normalizeAtprotoHandle as kr, readLobby as ks, knockIdentity as kt, validDomainRecord as ku, handoffVerifiedFrame as kv, MAX_AVATAR_LENGTH as kw, DEVICE_INVITE_LIFETIME_S as kx, NEW_PER_HOUR as ky, x401VpToken as l, turnVerifierMark as lC, deviceKeyZ32 as lS, pickCallCandidates as l_, newPubkyProofFolder as la, linkRecords as lb, COMMUNITY_PIN_FRAME as lc, identityPresentationBytes as ld, DHT_TEXT_REFUSED as lf, UNUSED_INVITE_UPKEEP_MS as lg, openSecret as lh, didWebHost as li, encodeAppRangeData as ll, TASK_STATUSES as lm, mentionsMember as ln, LIVENESS_PING_MS as lo, validEditNumber as lp, decodeBitcoinAddress as lr, meshHubs as ls, decodeCommunityLink as lt, DNS_TYPE as lu, handoffAttemptSucceeded as lv, openRelayPayload as lw, signAppRevocation as lx, ENROLL_DONE as ly, x401HolderJwk as m, CHAT_RESERVE_MOST_SHARE as mC, deviceLinkSecret as mS, MAX_MSGS_PAYLOAD_B64 as m_, decodeSvcbRecords as ma, readKnockSlot as mb, PIN_LIMITS as mc, newIdentityBinding as md, DHT_FILE_CAPABILITY as mf, unusedInviteWait as mg, MAX_SKIP as mh, parseDidSignaturePaste as mi, APP_FRAME as ml, cardLine as mm, MAX_GROUP_META_BODY as mn, PONG_WAIT_MS as mo, canonicalUrl as mp, hash160 as mr, COMMUNITY_TOPOLOGY as ms, leaveStatement3 as mt, NIP05_PATH as mu, handoffDataFrame as mv, decodeTxtPacket as mw, exifOrientation as mx, enrollCancelReason as my, X401_RESPONSE_MODES as n, turnName as nC, DEVICE_ECHO_FRAME as nS, __require as nT, contactRtcConfig as n_, sparkNetworkOf as na, contactAskerFrame as nb, TypingSender as nc, IDENTITY_REVOCATION_LABEL as nd, relayedTransports as nf, PRESENCE_HEARTBEAT as ng, confirmationTag as nh, didGhostlyServiceEntry as ni, appRangeCancelFrame as nl, ITEM_STATES as nm, communityMessageAuthor as nn, EARLY_DIAL_JOIN_MS as no, RateWindow as np, bip322ToSpend as nr, SIGNAL_REPLY_MS as ns, GROUP_READ_NOTE_COMMUNITY as nt, HOLD_LIMITS as nu, HANDOFF_WINDOW as nv, MAX_DNS_PACKET_BYTES as nw, isAppSignature as nx, setUpdateFrame as ny, matchX401Dcql as o, turnSequence as oC, deviceEchoFrame as oS, isGlobalIpv4Host as o_, PUBKY_PROOF_ROOT as oa, knockSlotIdentity as ob, typingActivity as oc, IdentityExchange as od, DHT_FILE_TOO_LARGE as of, STALLED_LOOK_MS as og, epochKeys as oh, didWebFile as oi, appRangeErrorFrame as ol, ROUTINE_STATES as om, MENTION_EVERYONE as on, INVITER_DIAL_GRACE_MS as oo, parseEditFrame as op, ByteReader as or, MESH_HUBS as os, communityMessageId as ot, newMailbox as ou, handoffAckFrame as ov, createRelayPayload as ow, readAppSignature as ox, DEVICE_KINDS as oy, sameX401HolderJwk as p, CHAT_RESERVE as pC, deviceLinkSealKey as pS, LABEL$1 as p_, pubkyProofPath as pa, openRequest as pb, PIN_FRAME as pc, isIdentityBinding as pd, peekDhtMailbox as pf, presenceSeenAt as pg, FOLLOW_MS as ph, parseDidJws as pi, APP_DATA_MAX_BYTES as pl, cardEditNumber as pm, GROUP_META_PAST_CHARS as pn, PAIRING_RETRY_MS as po, LINK_TRAILING as pp, encodeWitness as pr, wireHubPolicy as ps, leaveStatement as pt, DOMAIN_TXT_MAX_BYTES as pu, handoffContextProof as pv, decodeDnsAnswers as pw, IMAGE_LIMITS as px, enrollCancelFrame as py, signAppStore as q, BREAKER_BASE_MS as qC, openTurnValue as qS, HANDOFF_OFFER as q_, ANSWERS_REFUSED_PAUSES as qa, appRef as qb, generateVapidKeys as qc, RELAY_URL as qd, EDIT_BUFFER_MAX as qf, CALL_SIGNAL_FUTURE_MS as qg, DHT_POLL_INTERVALS as qh, isWalletNetwork as qi, WAKE_SESSION_CAPABILITY as ql, rosterAdmin as qm, sshSignCommand as qn, CARRIED_DEFER_MS as qo, groupReplyAuthor as qp, DID_FILE_MAX_BYTES as qr, TYPING_FRAME as qs, asWritten as qt, IDENTITY_CLOCK_SKEW as qu, readHandoffVerified as qv, randomBytes as qw, inviteLink as qx, REQUEST_CLOCK_SKEW_MS as qy, readX401OpenId4VpRequest as r, turnPacket as rC, DEVICE_PING_FRAME as rS, __toCommonJS as rT, decompressSdp as r_, BITCOIN_NETWORKS as ra, contactAskerHolds as rb, parseTypingActivity as rc, IDENTITY_STATEMENT_PREFIX as rd, transportOrder as rf, PRESENCE_WINDOW as rg, decryptText as rh, didJwsAlg as ri, appRangeChunk as rl, PR_CHECKS as rm, meshMessageRef as rn, FIRST_PAIRING_PACE_MS as ro, dhtEditId as rp, decodeBase64 as rr, groupSignalFrame as rs, communityCommitHash as rt, HoldKeys as ru, NO_ATTEMPTS as rv, PKARR_FUTURE_SKEW_MS as rw, readAppRevocation as rx, setUpdateMessage as ry, presentX401SdJwtVc as s, turnSignedMessage as sC, deviceEchoNonce as sS, keepsToRelays as s_, isPubkyKey as sa, knockSlotOf as sb, typingFrame as sc, boundVerifiedIdentity as sd, DHT_MESSAGE_TTL as sf, TRANSPORTS_GONE_MS as sg, newEpochSecret as sh, didWebFileNames as si, appRangeGetFrame as sl, RUN_RESULTS as sm, MENTION_LIMITS as sn, INVITE_TAKEN as so, parseEditedFrame as sp, compactSize as sr, NO_HUB_POLICY as ss, communityRoster as st, readManifest as su, handoffAttemptAllowed as sv, measureRecords as sw, setAppSignatureFastPath as sx, ENROLL_CANCEL as sy, X401_REQUEST_LIMITS as t, turnKeys as tC, DEVICE_CAPABILITIES as tS, __exportAll as tT, compressSdp as t_, sparkInvoiceDetails as ta, STAMP_BITS_MIN as tb, TypingReceiver as tc, IDENTITY_PROVIDER_ID as td, relayUrl as tf, OFFER_STEP_MAX as tg, confirmationMatches as th, checkDidSignature as ti, AppRanges as tl, CRON_LINE as tm, communityEditFrame as tn, DHT_PIN_GRACE_MS as to, REMOVED_TEXT as tp, bip322ToSign as tr, SIGNAL_PROVEN_MS as ts, CommunitySession as tt, HOLD_DATED_BACK_MS as tu, HANDOFF_VERSION as tv, withRequestOptions as tw, isAppRef as tx, setAckFrame as ty, X401_CREDENTIAL_LIMITS as u, BACKGROUND_REQUESTS_PER_MINUTE as uC, deviceLinkPairing as uS, sdpHasCandidates as u_, normalizePubkyKey as ua, makeStamp as ub, GROUP_PIN_FRAME as uc, identityRevocationValue as ud, DhtDelivery as uf, UNUSED_INVITE_WAIT_MAX_MS as ug, sealPair as uh, normalizeDid as ui, isServeId as ul, appCardId as um, validMentions as un, MAX_PAIRED_MESSAGE_FRAME as uo, validRemovalNumber as up, decodeTx as ur, meshRendezvous as us, derivedSecret as ut, DOMAIN_FILE_MAX_BYTES as uu, handoffBusyFrame as uv, parseRelayPayload as uw, verifyAppRevocation as ux, ENROLL_GRANT as uy, X401_SCHEME as v, DEPARTED_READS as vC, unsignedDeviceTransports as vS, isEmptyLinkPacket as v_, LIGHTNING_DESTINATION_PATTERN as va, seenEntry as vb, parsePinnedFrame as vc, verifyIdentityPresentation as vd, FileTransfers as vf, VIEWER_SERVICE_CSP as vg, RATCHET_KEEP_MS as vh, DID_DHT_MAX_PAYLOAD as vi, APP_RESUME_GRACE_MS as vl, checkStatusCard as vm, encodeGroupMetaBody as vn, REDESCRIBED_GRACE_MS as vo, parseLinkPreview as vp, u64 as vr, freshHubs as vs, signCommunity as vt, domainTxtRecord as vu, handoffFileMissingFrame as vv, createIdentity as vw, previewable as vx, enrollHelloFrame as vy, decodeX401Header as w, GROUP_SIGNALING_ALLOWANCE_SHARE as wC, TURN_SETTLE_MS as wS, decodeServices as w_, parseLightningDestination as wa, APP_FORBIDDEN_KEYS as wb, DEVICE_WAKE_TTL_SECONDS as wc, PeerProofs as wd, PLAYABLE_AUDIO as wf, sanitizeResponseHeaders as wg, ratchetOn as wh, didDhtDocument as wi, appDataFrame as wl, taskProgress as wm, groupMetaTag as wn, WAKE_LOST_MS as wo, readForwarded as wp, atprotoDidMethod as wr, newerHead as ws, MAX_KNOCKS as wt, parseDomainTxt as wu, handoffPakeFrame as wv, decrypt as ww, CONTACT_LINK_VERSION as wx, verifyEnrollProof as wy, buildX401ProofResult as x, GROUP_BURST_ONE_LINK as xC, webCryptoSigner as xS, LEGACY_SERVICES as x_, findLightningDestination as xa, APP_BUNDLE_MAGIC as xb, pinNumberHolds as xc, lastSharedWithMe as xd, safeBlobType as xf, relativizeLocation as xg, emptyRatchetState as xh, DID_DHT_VERSION as xi, AppSessions as xl, sameButtonText as xm, groupMetaChange as xn, SWITCH_RETIRE_MS as xo, FORWARD_LIMITS as xp, ATPROTO_FULL_SCOPE as xr, lobbyRecords as xs, verifyCommunityCommit as xt, isPublicAddress as xu, handoffHelloFrame as xv, publicKeyFromZ32 as xw, canonicalJsonBytes as xx, formatEnrollDigits as xy, X401_VERSION as y, FRESH_READ_MS as yC, verifyDeviceTransports as yS, parseLinkRecords as y_, LNURL_LIMITS as ya, stampHolds as yb, pinFrame as yc, IDENTITY_TIMELINE_MAX as yd, PREVIEWABLE_IMAGE as yf, formatLocalTarget as yg, RATCHET_OVERHEAD as yh, DID_DHT_PREFIX as yi, APP_SEND_LIMIT as yl, readStatusCard as ym, groupDisplayName as yn, RESUME_WAIT_MS as yo, previewImageSize as yp, varBytes as yr, hubRank as ys, verifyCommunityChain as yt, domainWellKnownFile as yu, handoffFileRequestFrame as yv, identityFromSeed as yw, readImageMeta as yx, enrollMessage as yy, planAppUpdate as z, WRITE_FIRST_MS as zC, TURN_SIGNED_BYTES as zS, HANDOFF_DONE as z_, VIDEO_METADATA_LIMITS as za, readAppBundle as zb, wakeFrame as zc, verifyPeerProof as zd, voicePeaksOf as zf, DATA_CHANNEL_ID as zg, DIRECT_EVIDENCE_MS as zh, SEPOLIA_TEST_USDT_FAUCET as zi, PIN_CAPABILITY as zl, MEMBER_KEY as zm, SSH_KEY_TYPES as zn, GROUP_WANT_NO_FRAME as zo, reactionIsNewer as zp, parseAtprotoCar as zr, FILE_LIMITS as zs, groupWakeFrame as zt, DHT_TEXT_CAPABILITY as zu, readHandoffDone as zv, trimEndOf as zw, INVITE_MAX_LENGTH as zx, CONTACT_ASKER_FRAME as zy };
37499
39380
 
37500
- //# sourceMappingURL=src-DytzSJB6.js.map
39381
+ //# sourceMappingURL=src-BZy4lDju.js.map