@cbortech/cbor 0.26.6 → 0.26.7

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 (35) hide show
  1. package/README.ja.md +144 -0
  2. package/README.md +143 -0
  3. package/dist/ast/CborByteString.d.ts +14 -0
  4. package/dist/ast/CborEllipsis.d.ts +94 -2
  5. package/dist/ast/CborFloat.d.ts +10 -0
  6. package/dist/ast/CborItem.d.ts +93 -4
  7. package/dist/ast/CborNint.d.ts +9 -0
  8. package/dist/ast/CborSimple.d.ts +11 -2
  9. package/dist/ast/CborTag.d.ts +8 -0
  10. package/dist/ast/CborTextString.d.ts +20 -0
  11. package/dist/ast/CborUint.d.ts +8 -0
  12. package/dist/ast/index.cjs +1 -1
  13. package/dist/ast/index.js +2 -2
  14. package/dist/cddl/index.cjs +1 -1
  15. package/dist/cddl/index.js +1 -1
  16. package/dist/cdn/serialize-utils.d.ts +186 -8
  17. package/dist/extensions/dt.d.ts +3 -0
  18. package/dist/extensions/types.d.ts +31 -9
  19. package/dist/index.cjs +6 -6
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.js +61 -98
  22. package/dist/index.js.map +1 -1
  23. package/dist/mapEntries-D2NyeCX3.cjs +17 -0
  24. package/dist/mapEntries-D2NyeCX3.cjs.map +1 -0
  25. package/dist/{mapEntries-Czxt-cmd.js → mapEntries-DxrDre2P.js} +1461 -959
  26. package/dist/mapEntries-DxrDre2P.js.map +1 -0
  27. package/dist/{schema-BxkgvUY6.js → schema-Bofmsptw.js} +247 -247
  28. package/dist/{schema-BxkgvUY6.js.map → schema-Bofmsptw.js.map} +1 -1
  29. package/dist/{schema-BmGsaEaW.cjs → schema-t_bdPk8_.cjs} +5 -5
  30. package/dist/{schema-BmGsaEaW.cjs.map → schema-t_bdPk8_.cjs.map} +1 -1
  31. package/dist/types.d.ts +169 -7
  32. package/package.json +2 -2
  33. package/dist/mapEntries-BhMlCwYo.cjs +0 -15
  34. package/dist/mapEntries-BhMlCwYo.cjs.map +0 -1
  35. package/dist/mapEntries-Czxt-cmd.js.map +0 -1
@@ -112,7 +112,7 @@ function y(e) {
112
112
  return !!(e.comments?.leading?.length || e.comments?.trailing?.length || e.comments?.dangling?.length);
113
113
  }
114
114
  function te(e) {
115
- return !!(e.comments?.trailing?.length || e.comments?.dangling?.length);
115
+ return !!e.comments?.dangling?.length;
116
116
  }
117
117
  function b(e, t) {
118
118
  if (!t) return e.text;
@@ -126,16 +126,21 @@ function b(e, t) {
126
126
  return r;
127
127
  }
128
128
  function ne(e, t, n) {
129
- return (e.comments?.leading ?? []).map((e) => t + b(e, n));
129
+ let r = e.comments?.leading ?? [], i = r.length;
130
+ for (; i > 0 && r[i - 1].sameLine;) i--;
131
+ return {
132
+ ownLines: r.slice(0, i).map((e) => t + b(e, n)),
133
+ inlinePrefix: r.slice(i).map((e) => b(e, n) + " ").join("")
134
+ };
130
135
  }
131
- function re(e, t) {
136
+ function x(e, t) {
132
137
  let n = e.comments?.trailing ?? [];
133
138
  return n.length === 0 ? "" : " " + n.map((e) => b(e, t)).join(" ");
134
139
  }
135
- function ie(e, t, n) {
140
+ function re(e, t, n) {
136
141
  return (e.comments?.dangling ?? []).map((e) => t + b(e, n));
137
142
  }
138
- function ae(e, t = !1) {
143
+ function ie(e, t = !1) {
139
144
  let n = e?.commas ?? "comma", r = n !== "none";
140
145
  return {
141
146
  inlineSep: r ? t ? "," : ", " : " ",
@@ -144,47 +149,69 @@ function ae(e, t = !1) {
144
149
  colSep: t ? ":" : ": "
145
150
  };
146
151
  }
147
- function x(e) {
148
- let { options: t, depth: n, openChar: r, closeChar: i, count: a } = e, o = _(t), s = t?.preserveComments, c = typeof s == "string" ? s : void 0, l = o !== null && s && (te(e.node) || e.hasEntryComments()), { inlineSep: u, multilineSep: d, trailSep: f, colSep: p } = ae(t, o === null), m = e.indefiniteLength ? "" : w(t, e.encodingWidth, () => C(BigInt(a))), h = m ? m + " " : "", g = e.indefiniteLength && (t?.encodingIndicators ?? "auto") !== "never", ee = (t) => e.indefiniteLength ? g ? a === 0 ? `${r}_ ${i}` : `${r}_ ${t}${i}` : `${r}${t}${i}` : `${r}${h}${t}${i}`;
152
+ function S(e) {
153
+ let { options: t, depth: n, openChar: r, closeChar: i, count: a } = e, o = _(t), s = t?.preserveComments, c = typeof s == "string" ? s : void 0, l = o !== null && s && (te(e.node) || e.hasEntryComments()), u = o !== null && !!t?.preserveBlankLines, d = !1;
154
+ if (u) {
155
+ for (let t = 0; t < a; t++) if (e.entryLeadingNode(t).blankLineBefore) {
156
+ d = !0;
157
+ break;
158
+ }
159
+ }
160
+ let { inlineSep: f, multilineSep: p, trailSep: m, colSep: h } = ie(t, o === null), g = e.eiPosition ?? "open", ee = e.indefiniteLength ? "" : T(t, e.encodingWidth, () => w(e.canonicalCount ? e.canonicalCount() : BigInt(a))), y = g === "open" && ee ? ee + " " : "", b = g === "close" ? ee : "", x = e.indefiniteLength && (t?.encodingIndicators ?? "auto") !== "never", S = (t) => e.indefiniteLength ? x ? a === 0 ? `${r}_ ${i}` : `${r}_ ${t}${i}` : `${r}${t}${i}` : `${r}${y}${t}${i}${b}`;
149
161
  if (o === null || a === 0 && !l) {
150
162
  let t = "";
151
- for (let n = 0; n < a; n++) n > 0 && (t += u), t += e.renderEntry(n, p);
152
- return ee(t);
163
+ for (let n = 0; n < a; n++) n > 0 && (t += f), t += e.renderEntry(n, h);
164
+ return S(t);
153
165
  }
154
- let y = null;
155
- if (t?.inlineLeafContainers && a > 0 && !l) {
166
+ let ae = null;
167
+ if (t?.inlineLeafContainers && a > 0 && !l && !d) {
156
168
  let t = [], n = !0;
157
169
  for (let r = 0; r < a; r++) {
158
170
  if (e.entryIsLeaf && !e.entryIsLeaf(r)) {
159
171
  n = !1;
160
172
  break;
161
173
  }
162
- let i = e.renderEntry(r, p);
174
+ let i = e.renderEntry(r, h);
163
175
  if (t.push(i), i.includes("\n")) {
164
176
  n = !1;
165
177
  break;
166
178
  }
167
179
  }
168
- if (n) return ee(t.join(u));
169
- y = t;
180
+ if (n) return S(t.join(f));
181
+ ae = t;
170
182
  }
171
- let b = v(o, n + 1), re = v(o, n), x = e.indefiniteLength ? g ? `${r}_ ` : r : `${r}${h}`, S = [];
183
+ let oe = v(o, n + 1), se = v(o, n), ce = e.indefiniteLength ? x ? `${r}_ ` : r : `${r}${y}`, C = [];
172
184
  for (let t = 0; t < a; t++) {
173
- s && S.push(...ne(e.entryLeadingNode(t), b, c));
174
- let n = t < a - 1 ? d : f, r = y?.[t] ?? e.renderEntry(t, p);
175
- S.push(`${b}${r}${n}${s ? e.entryTrailing(t, c) : ""}`);
176
- }
177
- return s && S.push(...ie(e.node, b, c)), `${x}\n${S.join("\n")}\n${re}${i}`;
178
- }
179
- var S = typeof (/* @__PURE__ */ new Uint8Array()).toBase64 == "function";
180
- function oe(e) {
181
- if (S) return e.toBase64({ omitPadding: !0 });
185
+ u && e.entryLeadingNode(t).blankLineBefore && C.push("");
186
+ let n = "";
187
+ if (s) {
188
+ let { ownLines: r, inlinePrefix: i } = ne(e.entryLeadingNode(t), oe, c);
189
+ C.push(...r), n = i;
190
+ }
191
+ let r = t < a - 1 ? p : m, i = ae?.[t] ?? e.renderEntry(t, h);
192
+ C.push(`${oe}${n}${i}${r}${s ? e.entryTrailing(t, c) : ""}`);
193
+ }
194
+ return s && C.push(...re(e.node, oe, c)), `${ce}\n${C.join("\n")}\n${se}${i}${b}`;
195
+ }
196
+ function ae(e, t, n, r, i, a, o) {
197
+ let s = _(n), c = n?.preserveComments;
198
+ if (!(s !== null && c && (y(e) || te(t)))) return `${a}${i(r)}${o}`;
199
+ let l = typeof c == "string" ? c : void 0, u = v(s, r + 1), d = v(s, r), { ownLines: f, inlinePrefix: p } = ne(e, u, l);
200
+ return `${a}\n${[
201
+ ...f,
202
+ `${u}${p}${i(r + 1)}${x(e, l)}`,
203
+ ...re(t, u, l)
204
+ ].join("\n")}\n${d}${o}`;
205
+ }
206
+ var oe = typeof (/* @__PURE__ */ new Uint8Array()).toBase64 == "function";
207
+ function se(e) {
208
+ if (oe) return e.toBase64({ omitPadding: !0 });
182
209
  let t = "";
183
210
  for (let n of e) t += String.fromCharCode(n);
184
211
  return btoa(t).replace(/=/g, "");
185
212
  }
186
- function se(e) {
187
- if (S) return e.toBase64({
213
+ function ce(e) {
214
+ if (oe) return e.toBase64({
188
215
  alphabet: "base64url",
189
216
  omitPadding: !0
190
217
  });
@@ -192,7 +219,7 @@ function se(e) {
192
219
  for (let n of e) t += String.fromCharCode(n);
193
220
  return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
194
221
  }
195
- var ce = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", le = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
222
+ var C = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", le = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
196
223
  function ue(e, t) {
197
224
  let n = "", r = 0, i = 0;
198
225
  for (let a of e) for (r = r << 8 | a, i += 8; i >= 5;) i -= 5, n += t[r >> i & 31];
@@ -207,39 +234,82 @@ function de(e) {
207
234
  }
208
235
  function fe(e, t, n) {
209
236
  if (n === "string") {
210
- let t = me(e);
211
- if (t != null) return _e(t);
237
+ let t = _e(e);
238
+ if (t != null) return be(t);
212
239
  }
213
240
  if (n === "printable-string" || n === void 0) {
214
- let t = me(e);
215
- if (t != null && !de(t)) return _e(t);
241
+ let t = _e(e);
242
+ if (t != null && !de(t)) return be(t);
216
243
  }
217
244
  switch (t) {
218
- case "base64": return `b64'${oe(e)}'`;
219
- case "base64url": return `b64'${se(e)}'`;
220
- case "base32": return `b32'${ue(e, ce)}'`;
245
+ case "base64": return `b64'${se(e)}'`;
246
+ case "base64url": return `b64'${ce(e)}'`;
247
+ case "base32": return `b32'${ue(e, C)}'`;
221
248
  case "base32hex": return `h32'${ue(e, le)}'`;
222
249
  default: return `h'${i(e)}'`;
223
250
  }
224
251
  }
225
- var pe = new TextDecoder("utf-8", { fatal: !0 });
252
+ function pe(e, t) {
253
+ let n = 0;
254
+ for (; n < e.length && e[n] !== "'" && e[n] !== "`";) n++;
255
+ if (n >= e.length) return e;
256
+ let r = e[n], i = e.lastIndexOf(r);
257
+ if (i <= n) return e;
258
+ let a = e.slice(n + 1, i), o = t === "hash-only" ? me(a) : he(a);
259
+ return e.slice(0, n + 1) + o + e.slice(i);
260
+ }
226
261
  function me(e) {
262
+ let t = "", n = 0;
263
+ for (; n < e.length;) {
264
+ if (e[n] === "#") {
265
+ for (; n < e.length && e[n] !== "\n";) n += e[n] === "\\" && n + 1 < e.length ? 2 : 1;
266
+ continue;
267
+ }
268
+ t += e[n], n++;
269
+ }
270
+ return t;
271
+ }
272
+ function he(e) {
273
+ let t = "", n = 0;
274
+ for (; n < e.length;) {
275
+ let r = e[n], i = e[n + 1];
276
+ if (r === "#" || r === "/" && i === "/") {
277
+ for (n += r === "#" ? 1 : 2; n < e.length && e[n] !== "\n";) n += e[n] === "\\" && n + 1 < e.length ? 2 : 1;
278
+ continue;
279
+ }
280
+ if (r === "/" && i === "*") {
281
+ let t = e.indexOf("*/", n + 2);
282
+ n = t === -1 ? e.length : t + 2;
283
+ continue;
284
+ }
285
+ if (r === "/") {
286
+ let t = n + 1;
287
+ for (; t < e.length && e[t] !== "/";) t += e[t] === "\\" && t + 1 < e.length ? 2 : 1;
288
+ n = t < e.length ? t + 1 : e.length;
289
+ continue;
290
+ }
291
+ t += r, n++;
292
+ }
293
+ return t;
294
+ }
295
+ var ge = new TextDecoder("utf-8", { fatal: !0 });
296
+ function _e(e) {
227
297
  try {
228
- return pe.decode(e);
298
+ return ge.decode(e);
229
299
  } catch {
230
300
  return null;
231
301
  }
232
302
  }
233
- function he(e, t) {
303
+ function ve(e, t) {
234
304
  for (let n = 0; n < e.length; n++) {
235
305
  let r = e.charCodeAt(n);
236
306
  if (r === t || r === 92 || r < 32 || r === 127 || r >= 8192 && (r === 8232 || r === 8233 || r >= 8203 && r <= 8205 || r === 65279)) return !0;
237
307
  }
238
308
  return !1;
239
309
  }
240
- function ge(e, t) {
310
+ function ye(e, t) {
241
311
  let n = t.codePointAt(0);
242
- if (!he(e, n)) return t + e + t;
312
+ if (!ve(e, n)) return t + e + t;
243
313
  let r = t;
244
314
  for (let i of e) {
245
315
  let e = i.codePointAt(0);
@@ -264,40 +334,89 @@ function ge(e, t) {
264
334
  }
265
335
  return r + t;
266
336
  }
267
- function _e(e) {
268
- return ge(e, "'");
337
+ function be(e) {
338
+ return ye(e, "'");
269
339
  }
270
- function ve(e) {
271
- return ge(e, "'");
340
+ function xe(e) {
341
+ return ye(e, "'");
272
342
  }
273
- function ye(e) {
274
- return ge(e, "\"");
343
+ function Se(e) {
344
+ return ye(e, "\"");
275
345
  }
276
- function be(e) {
346
+ function Ce(e) {
277
347
  if (isNaN(e)) return "NaN";
278
348
  if (!isFinite(e)) return e > 0 ? "Infinity" : "-Infinity";
279
349
  if (Object.is(e, -0)) return "-0.0";
280
350
  let t = e.toString();
281
351
  return t.includes(".") || t.includes("e") ? t : t + ".0";
282
352
  }
283
- function xe(e, t, n, r) {
353
+ function we(e, t, n, r) {
284
354
  if (r === "never") return "";
285
355
  let i = t ?? n;
286
356
  return r === "always" ? i === "half" ? "_1" : i === "single" ? "_2" : "_3" : t === void 0 || t === n ? "" : t === "half" ? "_1" : t === "single" ? "_2" : "_3";
287
357
  }
288
- function C(e) {
358
+ function w(e) {
289
359
  return e <= 23n ? "i" : e <= 255n ? 0 : e <= 65535n ? 1 : e <= 4294967295n ? 2 : 3;
290
360
  }
291
- function w(e, t, n) {
361
+ function T(e, t, n) {
292
362
  let r = e?.encodingIndicators ?? "auto";
293
363
  return r === "never" ? "" : r === "always" ? `_${t ?? n()}` : t === void 0 ? "" : `_${t}`;
294
364
  }
365
+ function E(e, t, n, r, i) {
366
+ if (!e?.preserveAppSequence || t === void 0 || _(e) === null && /[\r\n]/.test(t)) return "normal";
367
+ if (n === void 0) return r?.byteString && e?.preserveByteString === !1 || r?.textString && e?.preserveTextString === !1 || r?.rawString && e?.preserveRawString === !1 || r?.concatenation && e?.preserveConcatenation === !1 ? "normal" : "adjusted";
368
+ let a = e?.preserveComments === !1 || typeof e?.preserveComments == "string" || e?.preserveComments === !0 && _(e) === null, o = e?.encodingIndicators ?? "auto";
369
+ return e?.preserveNumberFormat === !1 || r?.byteString && e?.preserveByteString === !1 || r?.textString && e?.preserveTextString === !1 || r?.rawString && e?.preserveRawString === !1 || r?.concatenation && e?.preserveConcatenation === !1 || o !== "auto" && i === !1 ? "structural" : o !== "auto" || a ? "source" : "verbatim";
370
+ }
371
+ function Te(e, t, n) {
372
+ let r = t > 0 ? e[t - 1] : "", i = n < e.length ? e[n] : "", a = (e) => e !== "" && !/[\s,]/.test(e);
373
+ return a(r) && a(i) ? " " : "";
374
+ }
375
+ function Ee(e, t, n, r) {
376
+ let i = t?.preserveComments;
377
+ if (i === void 0 || !n?.length) return e;
378
+ let a = i === !1 || _(t) === null, o = typeof i == "string" ? i : void 0, s = e, c = [...n].sort((e, t) => t.start - e.start);
379
+ for (let e of c) {
380
+ let t = r !== void 0 && e.start >= r ? -2 : 0, n = e.start + t, i = e.end + t, c = a ? Te(s, n, i) : b(e, o);
381
+ s = s.slice(0, n) + c + s.slice(i);
382
+ }
383
+ return s;
384
+ }
385
+ function De(e, t, n, r) {
386
+ let i = [], a = t?.preserveComments;
387
+ if (a !== void 0 && n?.length) {
388
+ let r = a === !1 || _(t) === null, o = typeof a == "string" ? a : void 0;
389
+ for (let t of n) i.push({
390
+ start: t.start,
391
+ end: t.end,
392
+ replacement: r ? Te(e, t.start, t.end) : b(t, o)
393
+ });
394
+ }
395
+ let o = t?.encodingIndicators ?? "auto";
396
+ if (o !== "auto" && r) for (let e of r) i.push({
397
+ start: e.start,
398
+ end: e.end,
399
+ replacement: o === "always" ? e.always : e.never
400
+ });
401
+ i.sort((e, t) => t.start - e.start || t.end - e.end);
402
+ let s = e;
403
+ for (let e of i) s = s.slice(0, e.start) + e.replacement + s.slice(e.end);
404
+ return s;
405
+ }
406
+ function D(e, t, n, r, i) {
407
+ let a = e, o;
408
+ if ((n?.encodingIndicators ?? "auto") === "never" && r !== void 0) {
409
+ let e = a.slice(0, r);
410
+ /_[0-3i]$/.test(e) && (o = r - 2, a = e.slice(0, -2) + a.slice(r));
411
+ }
412
+ return a = Ee(a, n, i, o), a.replace(/_[0-3i]$/, "") + t;
413
+ }
295
414
  //#endregion
296
415
  //#region src/utils/float16.ts
297
- var Se = "getFloat16" in DataView.prototype && "setFloat16" in DataView.prototype, Ce = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
298
- function T(e) {
299
- Ce.setFloat64(0, e, !1);
300
- let t = Ce.getUint32(0, !1), n = Ce.getUint32(4, !1), r = t >>> 31 & 1, i = t >>> 20 & 2047, a = t & 1048575;
416
+ var Oe = "getFloat16" in DataView.prototype && "setFloat16" in DataView.prototype, ke = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
417
+ function Ae(e) {
418
+ ke.setFloat64(0, e, !1);
419
+ let t = ke.getUint32(0, !1), n = ke.getUint32(4, !1), r = t >>> 31 & 1, i = t >>> 20 & 2047, a = t & 1048575;
301
420
  if (i === 2047) {
302
421
  if (a === 0 && n === 0) return r << 15 | 31744;
303
422
  let e = a >> 10 | (n === 0 ? 0 : 1) || 1;
@@ -318,19 +437,19 @@ function T(e) {
318
437
  let u = o <= 0 ? 0 : o;
319
438
  return r << 15 | u << 10 | s;
320
439
  }
321
- function E(e) {
440
+ function O(e) {
322
441
  let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023;
323
442
  return n === 31 ? r === 0 ? t ? -Infinity : Infinity : NaN : n === 0 ? r === 0 ? t ? -0 : 0 : (t ? -1 : 1) * 2 ** -14 * (r / 1024) : (t ? -1 : 1) * 2 ** (n - 15) * (1 + r / 1024);
324
443
  }
325
- var we = Se ? (e, t, n, r) => {
444
+ var je = Oe ? (e, t, n, r) => {
326
445
  e.setFloat16(t, n, r);
327
446
  } : (e, t, n, r) => {
328
- e.setUint16(t, T(n), r);
329
- }, Te = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8)), D = new Uint8Array(Te.buffer), Ee = new TextEncoder(), De = typeof Ee.encodeInto == "function";
330
- function Oe(e) {
447
+ e.setUint16(t, Ae(n), r);
448
+ }, Me = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8)), k = new Uint8Array(Me.buffer), Ne = new TextEncoder(), Pe = typeof Ne.encodeInto == "function";
449
+ function Fe(e) {
331
450
  return e <= 23 ? 1 : e <= 255 ? 2 : e <= 65535 ? 3 : e <= 4294967295 ? 5 : 9;
332
451
  }
333
- function ke(e) {
452
+ function Ie(e) {
334
453
  return e === "i" ? 1 : [
335
454
  2,
336
455
  3,
@@ -338,7 +457,7 @@ function ke(e) {
338
457
  9
339
458
  ][e];
340
459
  }
341
- var Ae = class {
460
+ var Le = class {
342
461
  buf;
343
462
  len = 0;
344
463
  constructor(e = 256) {
@@ -369,45 +488,45 @@ var Ae = class {
369
488
  t[this.len++] = e >>> 24 & 255, t[this.len++] = e >>> 16 & 255, t[this.len++] = e >>> 8 & 255, t[this.len++] = e & 255;
370
489
  }
371
490
  writeBigUint64(e) {
372
- Te.setBigUint64(0, e, !1), this._ensure(8), this.buf.set(D, this.len), this.len += 8;
491
+ Me.setBigUint64(0, e, !1), this._ensure(8), this.buf.set(k, this.len), this.len += 8;
373
492
  }
374
493
  writeFloat16(e) {
375
- we(Te, 0, e, !1), this._ensure(2);
494
+ je(Me, 0, e, !1), this._ensure(2);
376
495
  let t = this.buf;
377
- t[this.len++] = D[0], t[this.len++] = D[1];
496
+ t[this.len++] = k[0], t[this.len++] = k[1];
378
497
  }
379
498
  writeFloat32(e) {
380
- Te.setFloat32(0, e, !1), this._ensure(4);
499
+ Me.setFloat32(0, e, !1), this._ensure(4);
381
500
  let t = this.buf;
382
- t[this.len++] = D[0], t[this.len++] = D[1], t[this.len++] = D[2], t[this.len++] = D[3];
501
+ t[this.len++] = k[0], t[this.len++] = k[1], t[this.len++] = k[2], t[this.len++] = k[3];
383
502
  }
384
503
  writeFloat64(e) {
385
- Te.setFloat64(0, e, !1), this._ensure(8), this.buf.set(D, this.len), this.len += 8;
504
+ Me.setFloat64(0, e, !1), this._ensure(8), this.buf.set(k, this.len), this.len += 8;
386
505
  }
387
506
  writeTextString(e, t, n) {
388
- if (!De) {
389
- let r = Ee.encode(t);
390
- O(this, e, r.length, n), this.writeBytes(r);
507
+ if (!Pe) {
508
+ let r = Ne.encode(t);
509
+ A(this, e, r.length, n), this.writeBytes(r);
391
510
  return;
392
511
  }
393
- let r = n === void 0 ? Oe(t.length) : ke(n);
512
+ let r = n === void 0 ? Fe(t.length) : Ie(n);
394
513
  this._ensure(9 + 3 * t.length);
395
- let { written: i } = Ee.encodeInto(t, this.buf.subarray(this.len + r)), a = n === void 0 ? Oe(i) : r;
396
- a !== r && this.buf.copyWithin(this.len + a, this.len + r, this.len + r + i), O(this, e, i, n), this.len += i;
514
+ let { written: i } = Ne.encodeInto(t, this.buf.subarray(this.len + r)), a = n === void 0 ? Fe(i) : r;
515
+ a !== r && this.buf.copyWithin(this.len + a, this.len + r, this.len + r + i), A(this, e, i, n), this.len += i;
397
516
  }
398
517
  finish() {
399
518
  return this.buf.slice(0, this.len);
400
519
  }
401
- }, je = [
520
+ }, Re = [
402
521
  255n,
403
522
  65535n,
404
523
  4294967295n,
405
524
  18446744073709551615n
406
525
  ];
407
- function Me(e) {
408
- return e === "i" ? 23n : je[e];
526
+ function ze(e) {
527
+ return e === "i" ? 23n : Re[e];
409
528
  }
410
- function O(e, t, n, r) {
529
+ function A(e, t, n, r) {
411
530
  if (r === void 0 && typeof n == "number" && n < 4294967296) {
412
531
  n <= 23 ? e.writeByte(t << 5 | n) : n <= 255 ? (e.writeByte(t << 5 | 24), e.writeByte(n)) : n <= 65535 ? (e.writeByte(t << 5 | 25), e.writeUint16(n)) : (e.writeByte(t << 5 | 26), e.writeUint32(n));
413
532
  return;
@@ -419,33 +538,53 @@ function O(e, t, n, r) {
419
538
  e.writeByte(t << 5 | Number(i));
420
539
  return;
421
540
  }
422
- if (i > je[r]) throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${je[r]})`);
541
+ if (i > Re[r]) throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${Re[r]})`);
423
542
  let n = 24 + r;
424
543
  e.writeByte(t << 5 | n), n === 24 ? e.writeByte(Number(i)) : n === 25 ? e.writeUint16(Number(i)) : n === 26 ? e.writeUint32(Number(i)) : e.writeBigUint64(i);
425
544
  return;
426
545
  }
427
546
  i <= 23n ? e.writeByte(t << 5 | Number(i)) : i <= 255n ? (e.writeByte(t << 5 | 24), e.writeByte(Number(i))) : i <= 65535n ? (e.writeByte(t << 5 | 25), e.writeUint16(Number(i))) : i <= 4294967295n ? (e.writeByte(t << 5 | 26), e.writeUint32(Number(i))) : (e.writeByte(t << 5 | 27), e.writeBigUint64(i));
428
547
  }
429
- function Ne(e, t, n) {
430
- let r = new Ae(9);
431
- return O(r, e, t, n), r.finish();
548
+ function Be(e, t, n) {
549
+ let r = new Le(9);
550
+ return A(r, e, t, n), r.finish();
432
551
  }
433
- var Pe = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
434
- function Fe(e) {
435
- return Object.is(E(T(e)), e);
552
+ var Ve = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
553
+ function He(e) {
554
+ return Object.is(O(Ae(e)), e);
436
555
  }
437
- function Ie(e) {
438
- return Pe.setFloat32(0, e, !1), Object.is(Pe.getFloat32(0, !1), e);
556
+ function Ue(e) {
557
+ return Ve.setFloat32(0, e, !1), Object.is(Ve.getFloat32(0, !1), e);
439
558
  }
440
- function k(e) {
441
- return Fe(e) ? "half" : Ie(e) ? "single" : "double";
559
+ function j(e) {
560
+ return He(e) ? "half" : Ue(e) ? "single" : "double";
442
561
  }
443
562
  //#endregion
444
563
  //#region src/ast/CborItem.ts
445
- var A = class e {
564
+ function We(e) {
565
+ return {
566
+ ...e,
567
+ preserveComments: e.preserveComments ?? !0,
568
+ preserveByteString: e.preserveByteString ?? !0,
569
+ preserveRawString: e.preserveRawString ?? !0,
570
+ preserveTextString: e.preserveTextString ?? !0,
571
+ preserveConcatenation: e.preserveConcatenation ?? !0,
572
+ preserveNumberFormat: e.preserveNumberFormat ?? !0,
573
+ preserveAppSequence: e.preserveAppSequence ?? !0,
574
+ preserveBlankLines: e.preserveBlankLines ?? !0
575
+ };
576
+ }
577
+ var M = class e {
446
578
  start;
447
579
  end;
448
580
  comments;
581
+ blankLineBefore;
582
+ appSeqSource;
583
+ appSeqComments;
584
+ appSeqEncodingEdits;
585
+ appSeqEncodingEditsComplete;
586
+ appSeqInnerEnd;
587
+ appSeqSourceFeatures;
449
588
  warnings;
450
589
  _defaults;
451
590
  get _containsCdnContainer() {
@@ -455,17 +594,19 @@ var A = class e {
455
594
  let t = this._defaults ? {
456
595
  ...this._defaults,
457
596
  ...e
458
- } : e, n = new Ae();
597
+ } : e, n = new Le();
459
598
  return this._encode(n, t), n.finish();
460
599
  }
461
600
  toCDN(e) {
462
601
  let t = this._defaults ? {
463
602
  ...this._defaults,
464
603
  ...e
465
- } : e, n = this._toCDN(t, 0), r = t?.preserveComments;
604
+ } : e;
605
+ t?.preserveAll && (t = We(t));
606
+ let n = this._toCDN(t, 0), r = t?.preserveComments;
466
607
  if (!r || _(t) === null) return n;
467
- let i = typeof r == "string" ? r : void 0, a = this.comments?.leading?.map((e) => b(e, i)) ?? [], o = this.comments?.trailing ?? [], s = o.length === 0 ? n : `${n} ${o.map((e) => b(e, i).trimEnd()).join(" ")}`;
468
- return [...a, s].join("\n");
608
+ let i = typeof r == "string" ? r : void 0, { ownLines: a, inlinePrefix: o } = ne(this, "", i), s = this.comments?.trailing ?? [], c = s.length === 0 ? n : `${n} ${s.map((e) => b(e, i).trimEnd()).join(" ")}`;
609
+ return [...a, `${o}${c}`].join("\n");
469
610
  }
470
611
  toEDN(e) {
471
612
  return this.toCDN(e);
@@ -503,7 +644,7 @@ var A = class e {
503
644
  t.writeBytes(this._toCBOR(n));
504
645
  }
505
646
  _toCBOR(e) {
506
- let t = new Ae();
647
+ let t = new Le();
507
648
  return this._encodeTo(t, e), t.finish();
508
649
  }
509
650
  _toHexDump(e, n) {
@@ -513,19 +654,22 @@ var A = class e {
513
654
  comment: this._toCDN(n, 0)
514
655
  }];
515
656
  }
516
- }, j = class extends A {
657
+ }, N = class extends M {
517
658
  value;
518
659
  encodingWidth;
660
+ ednSource;
519
661
  constructor(e, t) {
520
662
  if (super(), this.value = BigInt(e), this.value < 0n) throw RangeError("CborUint value must be non-negative");
521
663
  if (this.value > 18446744073709551615n) throw RangeError("CborUint value exceeds maximum uint64");
522
- this.encodingWidth = t?.encodingWidth;
664
+ this.encodingWidth = t?.encodingWidth, this.ednSource = t?.ednSource;
523
665
  }
524
666
  _encodeTo(e, t) {
525
- O(e, 0, this.value, this.encodingWidth);
667
+ A(e, 0, this.value, this.encodingWidth);
526
668
  }
527
669
  _toCDN(e, t) {
528
- let n = w(e, this.encodingWidth, () => C(this.value)), r = this.value;
670
+ let n = T(e, this.encodingWidth, () => w(this.value));
671
+ if (e?.preserveNumberFormat && this.ednSource !== void 0) return this.ednSource + n;
672
+ let r = this.value;
529
673
  switch (e?.intFormat) {
530
674
  case "hex": return `0x${r.toString(16)}${n}`;
531
675
  case "octal": return `0o${r.toString(8)}${n}`;
@@ -537,24 +681,27 @@ var A = class e {
537
681
  let t = e?.integerAs ?? "auto";
538
682
  return t === "bigint" ? this.value : t === "number" || this.value <= BigInt(2 ** 53 - 1) ? Number(this.value) : this.value;
539
683
  }
540
- }, M = class extends A {
684
+ }, P = class extends M {
541
685
  argument;
542
686
  encodingWidth;
687
+ ednSource;
543
688
  constructor(e, t) {
544
689
  super();
545
690
  let n = BigInt(e);
546
691
  if (n >= 0n) throw RangeError("CborNint value must be negative");
547
692
  if (n < -18446744073709551616n) throw RangeError("CborNint value exceeds minimum int64");
548
- this.argument = -1n - n, this.encodingWidth = t?.encodingWidth;
693
+ this.argument = -1n - n, this.encodingWidth = t?.encodingWidth, this.ednSource = t?.ednSource;
549
694
  }
550
695
  get value() {
551
696
  return -1n - this.argument;
552
697
  }
553
698
  _encodeTo(e, t) {
554
- O(e, 1, this.argument, this.encodingWidth);
699
+ A(e, 1, this.argument, this.encodingWidth);
555
700
  }
556
701
  _toCDN(e, t) {
557
- let n = w(e, this.encodingWidth, () => C(this.argument)), r = this.argument + 1n;
702
+ let n = T(e, this.encodingWidth, () => w(this.argument));
703
+ if (e?.preserveNumberFormat && this.ednSource !== void 0) return this.ednSource + n;
704
+ let r = this.argument + 1n;
558
705
  switch (e?.intFormat) {
559
706
  case "hex": return `-0x${r.toString(16)}${n}`;
560
707
  case "octal": return `-0o${r.toString(8)}${n}`;
@@ -566,8 +713,8 @@ var A = class e {
566
713
  let t = this.value, n = e?.integerAs ?? "auto";
567
714
  return n === "bigint" ? t : n === "number" || t >= BigInt(-(2 ** 53 - 1)) ? Number(t) : t;
568
715
  }
569
- }, Le = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
570
- function Re(e) {
716
+ }, Ge = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
717
+ function Ke(e) {
571
718
  let t = e.startsWith("-"), n = e.slice(t ? 3 : 2), r = n.search(/[pP]/);
572
719
  if (r === -1) throw SyntaxError(`EDN parse error: hex float missing 'p' exponent: ${e}`);
573
720
  let i = n.slice(0, r), a = n.slice(r + 1);
@@ -585,29 +732,30 @@ function Re(e) {
585
732
  let l = c * 2 ** o;
586
733
  return t ? -l : l;
587
734
  }
588
- function ze(e) {
735
+ function qe(e) {
589
736
  if (isNaN(e)) return "NaN";
590
737
  if (!isFinite(e)) return e > 0 ? "Infinity" : "-Infinity";
591
738
  let t = Object.is(e, -0) || e < 0, n = Math.abs(e);
592
739
  if (n === 0) return t ? "-0x0p+0" : "0x0p+0";
593
- Le.setFloat64(0, n, !1);
594
- let r = Le.getUint32(0, !1), i = Le.getUint32(4, !1), a = r >>> 20 & 2047, o = r & 1048575, s = i, c = (o.toString(16).padStart(5, "0") + s.toString(16).padStart(8, "0")).replace(/0+$/, ""), l = c === "" ? "" : `.${c}`, u, d;
740
+ Ge.setFloat64(0, n, !1);
741
+ let r = Ge.getUint32(0, !1), i = Ge.getUint32(4, !1), a = r >>> 20 & 2047, o = r & 1048575, s = i, c = (o.toString(16).padStart(5, "0") + s.toString(16).padStart(8, "0")).replace(/0+$/, ""), l = c === "" ? "" : `.${c}`, u, d;
595
742
  a === 0 ? (u = "0", d = -1022) : (u = "1", d = a - 1023);
596
743
  let f = d >= 0 ? `+${d}` : `${d}`, p = `0x${u}${l}p${f}`;
597
744
  return t ? `-${p}` : p;
598
745
  }
599
746
  //#endregion
600
747
  //#region src/ast/CborFloat.ts
601
- var N = class extends A {
748
+ var F = class extends M {
602
749
  value;
603
750
  precision;
604
751
  ednSource;
752
+ literalSource;
605
753
  rawBits;
606
754
  constructor(e, t) {
607
- super(), this.value = e, this.precision = t?.precision, this.rawBits = t?.rawBits;
755
+ super(), this.value = e, this.precision = t?.precision, this.rawBits = t?.rawBits, this.literalSource = t?.literalSource;
608
756
  }
609
757
  _encodeTo(e, t) {
610
- let n = this.precision ?? k(this.value), r = Number.isNaN(this.value) ? this.rawBits : void 0;
758
+ let n = this.precision ?? j(this.value), r = Number.isNaN(this.value) ? this.rawBits : void 0;
611
759
  n === "half" ? (e.writeByte(249), r?.length === 2 ? e.writeBytes(r) : e.writeFloat16(this.value)) : n === "single" ? (e.writeByte(250), r?.length === 4 ? e.writeBytes(r) : e.writeFloat32(this.value)) : (e.writeByte(251), r?.length === 8 ? e.writeBytes(r) : e.writeFloat64(this.value));
612
760
  }
613
761
  _toCDN(e, t) {
@@ -617,39 +765,50 @@ var N = class extends A {
617
765
  if (n === "never") return e.replace(/_[0-3i]$/, "");
618
766
  if (n === "always") {
619
767
  if (/_[0-3i]$/.test(e)) return e;
620
- let t = this.precision ?? k(this.value);
768
+ let t = this.precision ?? j(this.value);
621
769
  return e + (t === "half" ? "_1" : t === "single" ? "_2" : "_3");
622
770
  }
623
771
  return e;
624
772
  }
625
- let r = k(this.value);
626
- return (e?.floatFormat === "hex" ? ze(this.value) : be(this.value)) + xe(this.value, this.precision, r, n);
773
+ if (e?.preserveNumberFormat && this.literalSource !== void 0) {
774
+ let e = this.literalSource;
775
+ if (n === "never") return e.replace(/_[0-7i]$/, "");
776
+ if (n === "always") {
777
+ if (/_[0-7i]$/.test(e)) return e;
778
+ let t = j(this.value);
779
+ return e + we(this.value, this.precision, t, "always");
780
+ }
781
+ return e;
782
+ }
783
+ let r = j(this.value);
784
+ return (e?.floatFormat === "hex" ? qe(this.value) : Ce(this.value)) + we(this.value, this.precision, r, n);
627
785
  }
628
786
  _toJS(e) {
629
787
  return this.value;
630
788
  }
631
- }, P = class extends A {
789
+ }, I = class extends M {
632
790
  tag;
633
791
  content;
634
792
  encodingWidth;
793
+ ednSource;
635
794
  constructor(e, t, n) {
636
795
  if (super(), this.tag = BigInt(e), this.tag < 0n) throw RangeError("CborTag tag number must be non-negative");
637
- this.content = t, this.encodingWidth = n?.encodingWidth;
796
+ this.content = t, this.encodingWidth = n?.encodingWidth, this.ednSource = n?.ednSource;
638
797
  }
639
798
  get _containsCdnContainer() {
640
799
  return this.content._containsCdnContainer;
641
800
  }
642
801
  _encodeTo(e, t) {
643
- O(e, 6, this.tag, this.encodingWidth), this.content._encode(e, t);
802
+ A(e, 6, this.tag, this.encodingWidth), this.content._encode(e, t);
644
803
  }
645
804
  _toCDN(e, t) {
646
- let n = w(e, this.encodingWidth, () => C(this.tag));
647
- return `${this.tag}${n}(${this.content._toCDN(e, t)})`;
805
+ let n = T(e, this.encodingWidth, () => w(this.tag));
806
+ return `${e?.preserveNumberFormat && this.ednSource !== void 0 ? this.ednSource : this.tag.toString()}${n}${ae(this.content, this, e, t, (t) => this.content._toCDN(e, t), "(", ")")}`;
648
807
  }
649
808
  _toHexDump(e, n) {
650
809
  let r = [{
651
810
  depth: e,
652
- hex: t(Ne(6, this.tag, this.encodingWidth)),
811
+ hex: t(Be(6, this.tag, this.encodingWidth)),
653
812
  comment: `Tag ${this.tag}`
654
813
  }];
655
814
  return r.push(...this.content._toHexDump(e + 1, {
@@ -661,39 +820,46 @@ var N = class extends A {
661
820
  let t = this.content._toJS(e);
662
821
  return e?.stripTags ? t : m.set(t, this.tag);
663
822
  }
664
- }, F = class extends A {
823
+ };
824
+ //#endregion
825
+ //#region src/ast/CborByteString.ts
826
+ function Je(e, t, n) {
827
+ if (e !== void 0) return t?.preserveComments || n === void 0 ? e : pe(e, n);
828
+ }
829
+ var L = class extends M {
665
830
  indefiniteLength = !1;
666
831
  value;
667
832
  ednEncoding;
668
833
  encodingWidth;
669
834
  ednSource;
835
+ ednCommentSyntax;
670
836
  ednParts;
671
837
  constructor(e, t) {
672
- super(), this.value = e, this.ednEncoding = t?.ednEncoding ?? "hex", this.encodingWidth = t?.encodingWidth, this.ednSource = t?.ednSource, this.ednParts = t?.ednParts;
838
+ super(), this.value = e, this.ednEncoding = t?.ednEncoding ?? "hex", this.encodingWidth = t?.encodingWidth, this.ednSource = t?.ednSource, this.ednCommentSyntax = t?.ednCommentSyntax, this.ednParts = t?.ednParts;
673
839
  }
674
840
  _encodeTo(e, t) {
675
- O(e, 2, this.value.length, this.encodingWidth), e.writeBytes(this.value);
841
+ A(e, 2, this.value.length, this.encodingWidth), e.writeBytes(this.value);
676
842
  }
677
843
  _toCDN(e, t) {
678
844
  let n = _(e);
679
845
  if (e?.preserveConcatenation && n !== null && this.ednParts !== void 0 && this.ednParts.length > 1) {
680
- let r = w(e, this.encodingWidth, () => C(BigInt(this.value.length))), i = e?.bstrEncoding ?? this.ednEncoding;
846
+ let r = T(e, this.encodingWidth, () => w(BigInt(this.value.length))), i = e?.bstrEncoding ?? this.ednEncoding;
681
847
  e?.appStrings === !1 && i !== "hex" && (i = "hex");
682
- let a = this.ednParts.map((t) => e?.preserveByteString && t.source !== void 0 ? t.source : fe(t.bytes, i, e?.sqstr));
848
+ let a = this.ednParts.map((t) => {
849
+ let n = e?.preserveByteString ? Je(t.source, e, t.commentSyntax) : void 0;
850
+ return n === void 0 ? fe(t.bytes, i, e?.sqstr) : n;
851
+ });
683
852
  return a[a.length - 1] += r, ee(a, n, t);
684
853
  }
685
- if (e?.preserveByteString && this.ednSource !== void 0 && (n !== null || !/[\r\n]/.test(this.ednSource))) {
686
- if (/_[0-3i]$/.test(this.ednSource)) return (e?.encodingIndicators ?? "auto") === "never" ? this.ednSource.replace(/_[0-3i]$/, "") : this.ednSource;
687
- let t = w(e, this.encodingWidth, () => C(BigInt(this.value.length)));
688
- return this.ednSource + t;
689
- }
690
- let r = w(e, this.encodingWidth, () => C(BigInt(this.value.length))), i = e?.bstrEncoding ?? this.ednEncoding;
691
- return e?.appStrings === !1 && i !== "hex" && (i = "hex"), fe(this.value, i, e?.sqstr) + r;
854
+ let r = e?.preserveByteString ? Je(this.ednSource, e, this.ednCommentSyntax) : void 0;
855
+ if (r !== void 0 && (n !== null || !/[\r\n]/.test(r))) return /_[0-3i]$/.test(r) ? (e?.encodingIndicators ?? "auto") === "never" ? r.replace(/_[0-3i]$/, "") : r : r + T(e, this.encodingWidth, () => w(BigInt(this.value.length)));
856
+ let i = T(e, this.encodingWidth, () => w(BigInt(this.value.length))), a = e?.bstrEncoding ?? this.ednEncoding;
857
+ return e?.appStrings === !1 && a !== "hex" && (a = "hex"), fe(this.value, a, e?.sqstr) + i;
692
858
  }
693
859
  _toJS(e) {
694
860
  return this.value;
695
861
  }
696
- }, I = class extends A {
862
+ }, R = class extends M {
697
863
  indefiniteLength = !0;
698
864
  chunks;
699
865
  constructor(e) {
@@ -708,9 +874,9 @@ var N = class extends A {
708
874
  if ((e?.encodingIndicators ?? "auto") === "never") {
709
875
  let n = this.chunks.reduce((e, t) => e + t.value.length, 0), r = new Uint8Array(n), i = 0;
710
876
  for (let e of this.chunks) r.set(e.value, i), i += e.value.length;
711
- return new F(r)._toCDN(e, t);
877
+ return new L(r)._toCDN(e, t);
712
878
  }
713
- return this.chunks.length === 0 ? "''_" : x({
879
+ return this.chunks.length === 0 ? "''_" : S({
714
880
  node: this,
715
881
  options: e,
716
882
  depth: t,
@@ -722,7 +888,7 @@ var N = class extends A {
722
888
  hasEntryComments: () => this.chunks.some(y),
723
889
  renderEntry: (n) => this.chunks[n]._toCDN(e, t + 1),
724
890
  entryLeadingNode: (e) => this.chunks[e],
725
- entryTrailing: (e, t) => re(this.chunks[e], t)
891
+ entryTrailing: (e, t) => x(this.chunks[e], t)
726
892
  });
727
893
  }
728
894
  _toHexDump(e, t) {
@@ -743,7 +909,7 @@ var N = class extends A {
743
909
  for (let e of this.chunks) n.set(e.value, r), r += e.value.length;
744
910
  return n;
745
911
  }
746
- }, L = class extends A {
912
+ }, z = class extends M {
747
913
  indefiniteLength = !0;
748
914
  chunks;
749
915
  constructor(e) {
@@ -755,7 +921,7 @@ var N = class extends A {
755
921
  e.writeByte(255);
756
922
  }
757
923
  _toCDN(e, t) {
758
- return (e?.encodingIndicators ?? "auto") === "never" ? new U(this.chunks.map((e) => e.value).join(""))._toCDN(e, t) : this.chunks.length === 0 ? "\"\"_" : x({
924
+ return (e?.encodingIndicators ?? "auto") === "never" ? new q(this.chunks.map((e) => e.value).join(""))._toCDN(e, t) : this.chunks.length === 0 ? "\"\"_" : S({
759
925
  node: this,
760
926
  options: e,
761
927
  depth: t,
@@ -767,7 +933,7 @@ var N = class extends A {
767
933
  hasEntryComments: () => this.chunks.some(y),
768
934
  renderEntry: (n) => this.chunks[n]._toCDN(e, t + 1),
769
935
  entryLeadingNode: (e) => this.chunks[e],
770
- entryTrailing: (e, t) => re(this.chunks[e], t)
936
+ entryTrailing: (e, t) => x(this.chunks[e], t)
771
937
  });
772
938
  }
773
939
  _toHexDump(e, t) {
@@ -786,7 +952,7 @@ var N = class extends A {
786
952
  _toJS(e) {
787
953
  return this.chunks.map((e) => e.value).join("");
788
954
  }
789
- }, R = class extends A {
955
+ }, B = class extends M {
790
956
  items;
791
957
  indefiniteLength;
792
958
  encodingWidth;
@@ -803,11 +969,11 @@ var N = class extends A {
803
969
  e.writeByte(255);
804
970
  return;
805
971
  }
806
- O(e, 4, this.items.length, this.encodingWidth);
972
+ A(e, 4, this.items.length, this.encodingWidth);
807
973
  for (let n of this.items) n._encode(e, t);
808
974
  }
809
975
  _toCDN(e, t) {
810
- return x({
976
+ return S({
811
977
  node: this,
812
978
  options: e,
813
979
  depth: t,
@@ -820,7 +986,7 @@ var N = class extends A {
820
986
  renderEntry: (n) => this.items[n]._toCDN(e, t + 1),
821
987
  entryIsLeaf: (e) => !this.items[e]._containsCdnContainer,
822
988
  entryLeadingNode: (e) => this.items[e],
823
- entryTrailing: (e, t) => re(this.items[e], t)
989
+ entryTrailing: (e, t) => x(this.items[e], t)
824
990
  });
825
991
  }
826
992
  _toHexDump(e, r) {
@@ -839,7 +1005,7 @@ var N = class extends A {
839
1005
  }
840
1006
  let i = [{
841
1007
  depth: e,
842
- hex: t(Ne(4, BigInt(this.items.length), this.encodingWidth)),
1008
+ hex: t(Be(4, BigInt(this.items.length), this.encodingWidth)),
843
1009
  comment: `Array of length ${this.items.length}`
844
1010
  }];
845
1011
  for (let t of this.items) i.push(...t._toHexDump(e + 1, r));
@@ -858,7 +1024,7 @@ var N = class extends A {
858
1024
  }
859
1025
  return r;
860
1026
  }
861
- }, z = class extends A {
1027
+ }, V = class extends M {
862
1028
  entries;
863
1029
  indefiniteLength;
864
1030
  encodingWidth;
@@ -875,11 +1041,11 @@ var N = class extends A {
875
1041
  e.writeByte(255);
876
1042
  return;
877
1043
  }
878
- O(e, 5, this.entries.length, this.encodingWidth);
1044
+ A(e, 5, this.entries.length, this.encodingWidth);
879
1045
  for (let [n, r] of this.entries) n._encode(e, t), r._encode(e, t);
880
1046
  }
881
1047
  _toCDN(e, t) {
882
- return x({
1048
+ return S({
883
1049
  node: this,
884
1050
  options: e,
885
1051
  depth: t,
@@ -900,7 +1066,7 @@ var N = class extends A {
900
1066
  entryLeadingNode: (e) => this.entries[e][0],
901
1067
  entryTrailing: (e, t) => {
902
1068
  let [n, r] = this.entries[e];
903
- return Be([
1069
+ return Ye([
904
1070
  ...n.comments?.trailing ?? [],
905
1071
  ...r.comments?.leading ?? [],
906
1072
  ...r.comments?.trailing ?? []
@@ -924,7 +1090,7 @@ var N = class extends A {
924
1090
  }
925
1091
  let i = [{
926
1092
  depth: e,
927
- hex: t(Ne(5, BigInt(this.entries.length), this.encodingWidth)),
1093
+ hex: t(Be(5, BigInt(this.entries.length), this.encodingWidth)),
928
1094
  comment: `Map of length ${this.entries.length}`
929
1095
  }];
930
1096
  for (let [t, n] of this.entries) i.push(...t._toHexDump(e + 1, r)), i.push(...n._toHexDump(e + 1, r));
@@ -941,13 +1107,13 @@ var N = class extends A {
941
1107
  }
942
1108
  return n;
943
1109
  };
944
- return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof U) ? (() => {
1110
+ return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof q) ? (() => {
945
1111
  let n = e ? {
946
1112
  ...e,
947
1113
  reviver: void 0
948
1114
  } : void 0, r = {};
949
1115
  for (let [e, t] of this.entries) {
950
- let i = e instanceof U ? e.value : e.toCDN(), a = t._toJS(n);
1116
+ let i = e instanceof q ? e.value : e.toCDN(), a = t._toJS(n);
951
1117
  i === "__proto__" ? Object.defineProperty(r, i, {
952
1118
  value: a,
953
1119
  writable: !0,
@@ -959,10 +1125,10 @@ var N = class extends A {
959
1125
  let i = /* @__PURE__ */ new Map();
960
1126
  for (let e = 0; e < this.entries.length; e++) {
961
1127
  let [t] = this.entries[e];
962
- i.set(t instanceof U ? t.value : t.toCDN(), e);
1128
+ i.set(t instanceof q ? t.value : t.toCDN(), e);
963
1129
  }
964
1130
  for (let n = 0; n < this.entries.length; n++) {
965
- let [a, o] = this.entries[n], s = a instanceof U ? a.value : a.toCDN();
1131
+ let [a, o] = this.entries[n], s = a instanceof q ? a.value : a.toCDN();
966
1132
  if (i.get(s) !== n) continue;
967
1133
  let c = o._toJS(e), l = t.call(r, s, c);
968
1134
  l === h || e?.undefinedOmits && l === void 0 ? delete r[s] : s === "__proto__" ? Object.defineProperty(r, s, {
@@ -976,16 +1142,17 @@ var N = class extends A {
976
1142
  })() : n();
977
1143
  }
978
1144
  };
979
- function Be(e, t) {
1145
+ function Ye(e, t) {
980
1146
  return e.length === 0 ? "" : " " + e.map((e) => b(e, t).trimEnd()).join(" ");
981
1147
  }
982
1148
  //#endregion
983
1149
  //#region src/ast/CborSimple.ts
984
- var B = class e extends A {
1150
+ var H = class e extends M {
985
1151
  value;
986
- constructor(e) {
1152
+ ednSource;
1153
+ constructor(e, t) {
987
1154
  if (super(), !Number.isInteger(e) || e < 0 || e > 255) throw RangeError("CborSimple value must be an integer in 0–255");
988
- this.value = e;
1155
+ this.value = e, this.ednSource = t?.ednSource;
989
1156
  }
990
1157
  static FALSE = new e(20);
991
1158
  static TRUE = new e(21);
@@ -999,6 +1166,7 @@ var B = class e extends A {
999
1166
  e.writeByte(248), e.writeByte(this.value);
1000
1167
  }
1001
1168
  _toCDN(e, t) {
1169
+ if (e?.preserveNumberFormat && this.ednSource !== void 0) return `simple(${this.ednSource})`;
1002
1170
  switch (this.value) {
1003
1171
  case 20: return "false";
1004
1172
  case 21: return "true";
@@ -1016,7 +1184,7 @@ var B = class e extends A {
1016
1184
  default: return new g(this.value);
1017
1185
  }
1018
1186
  }
1019
- }, Ve = class extends A {
1187
+ }, U = class extends M {
1020
1188
  items;
1021
1189
  encodingWidth;
1022
1190
  constructor(e, t) {
@@ -1026,26 +1194,36 @@ var B = class e extends A {
1026
1194
  return this.items.some((e) => e._containsCdnContainer);
1027
1195
  }
1028
1196
  _content(e) {
1029
- let t = new Ae();
1197
+ let t = new Le();
1030
1198
  for (let n of this.items) n._encode(t, e);
1031
1199
  return t.finish();
1032
1200
  }
1033
1201
  _encodeTo(e, t) {
1034
1202
  let n = this._content(t);
1035
- O(e, 2, n.length, this.encodingWidth), e.writeBytes(n);
1203
+ A(e, 2, n.length, this.encodingWidth), e.writeBytes(n);
1036
1204
  }
1037
1205
  _toCDN(e, t) {
1038
- let n = w(e, this.encodingWidth, () => C(BigInt(this._content(e).length)));
1039
- if (this.items.length === 0) return `<<>>${n}`;
1040
- let r = _(e), { inlineSep: i, multilineSep: a, trailSep: o } = ae(e, r === null);
1041
- if (r === null) return `<<${this.items.map((n) => n._toCDN(e, t + 1)).join(i)}>>${n}`;
1042
- let s = v(r, t + 1), c = v(r, t), l = this.items.map((n) => `${s}${n._toCDN(e, t + 1)}`), u = l.length - 1;
1043
- return `<<\n${l.map((e, t) => t < u ? `${e}${a}` : `${e}${o}`).join("\n")}\n${c}>>${n}`;
1206
+ return S({
1207
+ node: this,
1208
+ options: e,
1209
+ depth: t,
1210
+ openChar: "<<",
1211
+ closeChar: ">>",
1212
+ count: this.items.length,
1213
+ indefiniteLength: !1,
1214
+ encodingWidth: this.encodingWidth,
1215
+ eiPosition: "close",
1216
+ canonicalCount: () => BigInt(this._content(e).length),
1217
+ hasEntryComments: () => this.items.some(y),
1218
+ renderEntry: (n) => this.items[n]._toCDN(e, t + 1),
1219
+ entryLeadingNode: (e) => this.items[e],
1220
+ entryTrailing: (e, t) => x(this.items[e], t)
1221
+ });
1044
1222
  }
1045
1223
  _toHexDump(e, n) {
1046
1224
  let r = this._content().length, i = [{
1047
1225
  depth: e,
1048
- hex: t(Ne(2, BigInt(r), this.encodingWidth)),
1226
+ hex: t(Be(2, BigInt(r), this.encodingWidth)),
1049
1227
  comment: `Embedded CBOR sequence, ${r} byte${r === 1 ? "" : "s"}`
1050
1228
  }];
1051
1229
  for (let t of this.items) i.push(...t._toHexDump(e + 1, n));
@@ -1056,8 +1234,80 @@ var B = class e extends A {
1056
1234
  }
1057
1235
  };
1058
1236
  //#endregion
1237
+ //#region src/utils/strip-comments.ts
1238
+ function Xe(e) {
1239
+ let t = "", n = 0;
1240
+ for (; n < e.length;) {
1241
+ let r = e[n];
1242
+ if (r === " " || r === "\n" || r === "\r") {
1243
+ n++;
1244
+ continue;
1245
+ }
1246
+ if (r === "#") {
1247
+ for (; n < e.length && e[n] !== "\n";) n++;
1248
+ continue;
1249
+ }
1250
+ if (r === "/") {
1251
+ let t = e[n + 1] ?? "";
1252
+ if (t === "/") {
1253
+ for (; n < e.length && e[n] !== "\n";) n++;
1254
+ continue;
1255
+ }
1256
+ if (t === "*") {
1257
+ for (n += 2; n < e.length && !(e[n] === "*" && (e[n + 1] ?? "") === "/");) n++;
1258
+ if (n >= e.length) throw SyntaxError("unterminated block comment");
1259
+ n += 2;
1260
+ continue;
1261
+ }
1262
+ for (n++; n < e.length && e[n] !== "/";) n++;
1263
+ if (n >= e.length) throw SyntaxError("unterminated block comment");
1264
+ n++;
1265
+ continue;
1266
+ }
1267
+ t += r, n++;
1268
+ }
1269
+ return t;
1270
+ }
1271
+ //#endregion
1272
+ //#region src/extensions/b32.ts
1273
+ var Ze = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", Qe = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
1274
+ function $e(e) {
1275
+ let t = e.length;
1276
+ for (; t > 0 && e.charCodeAt(t - 1) === 61;) t--;
1277
+ return e.slice(0, t);
1278
+ }
1279
+ function et(e, t, n) {
1280
+ let r = $e(e).toUpperCase(), i = r.length % 8;
1281
+ if (i === 1 || i === 3 || i === 6) throw SyntaxError(`invalid base32 length: ${r.length} characters`);
1282
+ let a = (/* @__PURE__ */ new Uint8Array(128)).fill(255);
1283
+ for (let e = 0; e < t.length; e++) a[t.charCodeAt(e)] = e;
1284
+ let o = new Uint8Array(Math.floor(r.length * 5 / 8)), s = 0, c = 0, l = 0;
1285
+ for (let e of r) {
1286
+ let t = e.charCodeAt(0), n = t < 128 ? a[t] : 255;
1287
+ if (n === 255) throw SyntaxError(`invalid character in byte string: ${JSON.stringify(e)}`);
1288
+ s = s << 5 | n, c += 5, c >= 8 && (c -= 8, o[l++] = s >> c & 255);
1289
+ }
1290
+ if (c > 0 && s & (1 << c) - 1) {
1291
+ let e = "non-zero trailing bits in base32 input";
1292
+ if (n) n(e);
1293
+ else throw SyntaxError(e);
1294
+ }
1295
+ return o;
1296
+ }
1297
+ var tt = {
1298
+ appStringPrefixes: ["b32"],
1299
+ parseAppString(e, t, n) {
1300
+ return new L(et(Xe(t), Ze, n), { ednEncoding: "base32" });
1301
+ }
1302
+ }, nt = {
1303
+ appStringPrefixes: ["h32"],
1304
+ parseAppString(e, t, n) {
1305
+ return new L(et(Xe(t), Qe, n), { ednEncoding: "base32hex" });
1306
+ }
1307
+ };
1308
+ //#endregion
1059
1309
  //#region src/utils/base64.ts
1060
- function He(e, t) {
1310
+ function rt(e, t) {
1061
1311
  let n = e.indexOf("="), r = n >= 0 ? e.slice(0, n) : e, i = n >= 0 ? e.slice(n) : "";
1062
1312
  if (/[^A-Za-z0-9+/\-_]/.test(r)) {
1063
1313
  let e = [...r].find((e) => !/[A-Za-z0-9+/\-_]/.test(e)) ?? "";
@@ -1096,17 +1346,17 @@ function He(e, t) {
1096
1346
  }
1097
1347
  //#endregion
1098
1348
  //#region src/ast/CborUnresolvedAppExt.ts
1099
- var Ue = 999n, We = class extends P {
1349
+ var it = 999n, at = class extends I {
1100
1350
  constructor(e, t) {
1101
- let n = t.length === 1 && t[0] instanceof U ? t[0] : new R(t);
1102
- super(Ue, new R([new U(e), n]));
1351
+ let n = t.length === 1 && t[0] instanceof q ? t[0] : new B(t);
1352
+ super(it, new B([new q(e), n]));
1103
1353
  }
1104
1354
  _toCDN(e, t) {
1105
1355
  if (e?.appStrings === !1) return super._toCDN(e, t);
1106
1356
  let n = this.content, r = n.items[0].value, i = n.items[1];
1107
- return i instanceof U ? `${r}${ve(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1357
+ return i instanceof q ? `${r}${xe(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1108
1358
  }
1109
- }, Ge = class extends A {
1359
+ }, ot = class extends M {
1110
1360
  inner;
1111
1361
  ednSource;
1112
1362
  constructor(e, t) {
@@ -1125,21 +1375,120 @@ var Ue = 999n, We = class extends P {
1125
1375
  _toJS(e) {
1126
1376
  return this.inner._toJS(e);
1127
1377
  }
1128
- }, Ke = 888n, V = class extends P {
1129
- constructor(e) {
1130
- e === void 0 ? super(Ke, B.NULL) : super(Ke, new R(e));
1378
+ }, st = 888n;
1379
+ function ct(e, t, n, r) {
1380
+ if (e === void 0) return;
1381
+ let i = t?.preserveComments || r === void 0 ? e : pe(e, r);
1382
+ return ut(i, n) ? i : void 0;
1383
+ }
1384
+ function lt(e, t) {
1385
+ return e !== void 0 && ut(e, t);
1386
+ }
1387
+ function ut(e, t) {
1388
+ return t !== null || !/[\r\n]/.test(e);
1389
+ }
1390
+ var W = class e extends I {
1391
+ realBoundary;
1392
+ fromByteLiteral;
1393
+ literalSource;
1394
+ constructor(e, t) {
1395
+ Array.isArray(e) ? (super(st, new B(e)), this.fromByteLiteral = !1, this.literalSource = void 0, this.realBoundary = t) : (super(st, H.NULL), this.fromByteLiteral = e ?? !1, this.literalSource = t, this.realBoundary = void 0);
1131
1396
  }
1132
1397
  _toCDN(e, t) {
1133
1398
  if (e?.appStrings === !1) return super._toCDN(e, t);
1134
- if (this.content instanceof B) return "...";
1135
- if (this.content instanceof R) {
1136
- let n = this.content.items.map((n) => n._toCDN(e, t));
1137
- return n.length === 0 ? "" : ee(n, _(e), t);
1399
+ if (this.content instanceof H) return "...";
1400
+ if (this.content instanceof B) {
1401
+ let n = !!e?.preserveConcatenation;
1402
+ if (n || e?.preserveByteString && !this._hasRealConcatenation()) {
1403
+ let t = this._renderPreservedBytesElision(e);
1404
+ if (t !== void 0) return t;
1405
+ }
1406
+ if (!n || this.realBoundary === void 0) {
1407
+ let e = this._compactHexElided();
1408
+ if (e !== void 0) return e;
1409
+ }
1410
+ return this.content.items.map((r) => n ? this._renderFragment(r, e) : r._toCDN(e, t)).join(" + ");
1138
1411
  }
1139
1412
  return super._toCDN(e, t);
1140
1413
  }
1141
- }, qe = 2n, Je = 3n, Ye = 18446744073709551615n, Xe = -18446744073709551616n;
1142
- function Ze(e) {
1414
+ _hasRealConcatenation() {
1415
+ return this.realBoundary?.some((e, t) => t > 0 && e) ? !0 : this.content.items.some((e) => e instanceof L && e.ednParts !== void 0 && e.ednParts.length > 1);
1416
+ }
1417
+ _renderFragment(e, t) {
1418
+ let n = _(t);
1419
+ if (e instanceof L && e.ednParts !== void 0 && e.ednParts.length > 1) {
1420
+ let r = t?.appStrings === !1 ? "hex" : t?.bstrEncoding ?? e.ednEncoding;
1421
+ return e.ednParts.map((e) => {
1422
+ let i = t?.preserveByteString ? ct(e.source, t, n, e.commentSyntax) : void 0;
1423
+ return i === void 0 ? fe(e.bytes, r, t?.sqstr) : i;
1424
+ }).join(" + ");
1425
+ }
1426
+ if (e instanceof q && e.ednParts !== void 0 && e.ednParts.length > 1) {
1427
+ let r = t?.preserveRawString ? e.ednPartSources : void 0;
1428
+ return e.ednParts.map((e, t) => {
1429
+ let i = r?.[t];
1430
+ return lt(i, n) ? i : Se(e);
1431
+ }).join(" + ");
1432
+ }
1433
+ return e._toCDN(t, 0);
1434
+ }
1435
+ _compactHexElided() {
1436
+ let t = this.content.items, n = "", r = !1;
1437
+ for (let a of t) if (a instanceof L) n += i(a.value), r = !0;
1438
+ else if (a instanceof e && a.content instanceof H) n += "...";
1439
+ else return;
1440
+ if (r) return `h'${n}'`;
1441
+ }
1442
+ _renderPreservedBytesElision(t) {
1443
+ if (this.realBoundary === void 0) return;
1444
+ let n = this.realBoundary, r = this.content.items, a = [], o = [], s = () => {
1445
+ o.length > 0 && (a.push(o), o = []);
1446
+ };
1447
+ for (let t = 0; t < r.length; t++) {
1448
+ let i = r[t];
1449
+ if (t > 0 && n[t] && s(), i instanceof e && i.content instanceof H) o.push({
1450
+ ellipsis: !0,
1451
+ fromByteLiteral: i.fromByteLiteral,
1452
+ literalSource: i.literalSource
1453
+ });
1454
+ else if (i instanceof L) if (i.ednParts !== void 0 && i.ednParts.length > 1) {
1455
+ let [e, ...t] = i.ednParts;
1456
+ o.push({
1457
+ bytes: e.bytes,
1458
+ source: e.source,
1459
+ commentSyntax: e.commentSyntax
1460
+ });
1461
+ for (let e of t) s(), o.push({
1462
+ bytes: e.bytes,
1463
+ source: e.source,
1464
+ commentSyntax: e.commentSyntax
1465
+ });
1466
+ } else o.push({
1467
+ bytes: i.value,
1468
+ source: i.ednSource,
1469
+ commentSyntax: i.ednCommentSyntax
1470
+ });
1471
+ else return;
1472
+ }
1473
+ if (s(), a.length === 0) return;
1474
+ let c = t?.appStrings === !1 ? "hex" : t?.bstrEncoding ?? "hex", l = _(t);
1475
+ return a.map((e) => {
1476
+ if (t?.preserveByteString) for (let n of e) {
1477
+ if (!("ellipsis" in n)) continue;
1478
+ let e = ct(n.literalSource, t, l, "full");
1479
+ if (e !== void 0) return e;
1480
+ }
1481
+ let n = e.filter((e) => !("ellipsis" in e));
1482
+ if (n.length === 0) return e.some((e) => "ellipsis" in e && e.fromByteLiteral) ? "h'...'" : "...";
1483
+ if (e.length === 1) {
1484
+ let e = n[0], r = t?.preserveByteString ? ct(e.source, t, l, e.commentSyntax) : void 0;
1485
+ return r === void 0 ? fe(e.bytes, c, t?.sqstr) : r;
1486
+ }
1487
+ return `h'${e.map((e) => "ellipsis" in e ? "..." : i(e.bytes)).join("")}'`;
1488
+ }).join(" + ");
1489
+ }
1490
+ }, dt = 2n, ft = 3n, pt = 18446744073709551615n, mt = -18446744073709551616n;
1491
+ function ht(e) {
1143
1492
  if (e < 0n) throw RangeError("bigintToBytes requires a non-negative value");
1144
1493
  if (e === 0n) return /* @__PURE__ */ new Uint8Array();
1145
1494
  let t = e.toString(16);
@@ -1148,16 +1497,16 @@ function Ze(e) {
1148
1497
  for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
1149
1498
  return n;
1150
1499
  }
1151
- function Qe(e) {
1500
+ function gt(e) {
1152
1501
  let t = 0n;
1153
1502
  for (let n of e) t = t << 8n | BigInt(n);
1154
1503
  return t;
1155
1504
  }
1156
- var $e = class extends P {
1505
+ var _t = class extends I {
1157
1506
  bigValue;
1158
1507
  constructor(e) {
1159
- if (e <= Ye) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
1160
- super(qe, new F(Ze(e))), this.bigValue = e;
1508
+ if (e <= pt) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
1509
+ super(dt, new L(ht(e))), this.bigValue = e;
1161
1510
  }
1162
1511
  _toCDN(e, t) {
1163
1512
  return this.bigValue.toString();
@@ -1165,11 +1514,11 @@ var $e = class extends P {
1165
1514
  _toJS(e) {
1166
1515
  return this.bigValue;
1167
1516
  }
1168
- }, et = class extends P {
1517
+ }, vt = class extends I {
1169
1518
  bigValue;
1170
1519
  constructor(e) {
1171
- if (e >= Xe) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
1172
- super(Je, new F(Ze(-1n - e))), this.bigValue = e;
1520
+ if (e >= mt) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
1521
+ super(ft, new L(ht(-1n - e))), this.bigValue = e;
1173
1522
  }
1174
1523
  _toCDN(e, t) {
1175
1524
  return this.bigValue.toString();
@@ -1177,25 +1526,59 @@ var $e = class extends P {
1177
1526
  _toJS(e) {
1178
1527
  return this.bigValue;
1179
1528
  }
1180
- }, tt = new TextEncoder(), nt = new TextDecoder("utf-8", { fatal: !0 }), rt = new TextDecoder("utf-8", { fatal: !1 });
1181
- function it(e, t) {
1529
+ }, yt = new TextEncoder(), bt = new TextDecoder("utf-8", { fatal: !0 }), xt = new TextDecoder("utf-8", { fatal: !1 });
1530
+ function St(e, t) {
1182
1531
  let n = new a(e, {
1183
1532
  offset: t?.offset,
1184
1533
  skipRS: t?._skipRS
1185
- }), r = new ht(n, t ?? {}).parse();
1186
- return t?.preserveComments && ct(r, n.comments, e), r;
1534
+ }), r = new Bt(n, t ?? {}).parse();
1535
+ return (t?.preserveComments || t?.preserveAll) && Nt(r, n.comments, e), r;
1187
1536
  }
1188
- function at(e) {
1537
+ function Ct(e) {
1189
1538
  let t = e, n;
1190
1539
  return /[_][0-7i]$/.test(e) && (n = e[e.length - 1], t = e.slice(0, -2)), {
1191
1540
  numStr: t,
1192
1541
  rawSuffix: n
1193
1542
  };
1194
1543
  }
1195
- function ot(e) {
1544
+ function wt(e) {
1196
1545
  return e.startsWith("-") ? -BigInt(e.slice(1)) : BigInt(e);
1197
1546
  }
1198
- function st(e, t) {
1547
+ function G(e) {
1548
+ if (e !== void 0) return Et([e.appSeqSourceFeatures, Tt(e)]);
1549
+ }
1550
+ function Tt(e) {
1551
+ if (e instanceof L) return {
1552
+ byteString: !0,
1553
+ concatenation: e.ednParts !== void 0 && e.ednParts.length > 1
1554
+ };
1555
+ if (e instanceof q) {
1556
+ let t = e.ednParts !== void 0, n = e.ednPartSources?.filter((e) => e !== void 0).length ?? 0, r = t ? e.ednParts.reduce((t, n, r) => {
1557
+ let i = e.ednPartSources?.[r] !== void 0, a = e.ednPartIsByteString?.[r] ?? !1;
1558
+ return i || !a ? t : t + 1;
1559
+ }, 0) : 0, i = (t ? e.ednParts.length : 0) - n - r;
1560
+ return {
1561
+ byteString: r > 0,
1562
+ textString: e.quotedEdnSource !== void 0 || i > 0,
1563
+ rawString: e.ednSource !== void 0 || n > 0,
1564
+ concatenation: t && e.ednParts.length > 1
1565
+ };
1566
+ }
1567
+ if (e instanceof B) return Et(e.items.map(G));
1568
+ if (e instanceof V) return Et(e.entries.flatMap(([e, t]) => [G(e), G(t)]));
1569
+ if (e instanceof I) return G(e.content);
1570
+ if (e instanceof R || e instanceof z || e instanceof U) return Et((e instanceof U ? e.items : e.chunks).map(G));
1571
+ }
1572
+ function Et(e) {
1573
+ let t = e.filter((e) => e !== void 0);
1574
+ if (t.length !== 0) return {
1575
+ byteString: t.some((e) => e.byteString),
1576
+ textString: t.some((e) => e.textString),
1577
+ rawString: t.some((e) => e.rawString),
1578
+ concatenation: t.some((e) => e.concatenation)
1579
+ };
1580
+ }
1581
+ function Dt(e, t) {
1199
1582
  if (e.endsWith("_i") || e.endsWith("_0")) {
1200
1583
  let n = "_0 and _i encoding indicators are not valid for floating-point values";
1201
1584
  if (t) t(n), e = e.slice(0, -2);
@@ -1219,72 +1602,138 @@ function st(e, t) {
1219
1602
  };
1220
1603
  let n = e, r;
1221
1604
  return e.endsWith("_1") ? (r = "half", n = e.slice(0, -2)) : e.endsWith("_2") ? (r = "single", n = e.slice(0, -2)) : e.endsWith("_3") && (r = "double", n = e.slice(0, -2)), /^-?0[xX]/.test(n) ? {
1222
- value: Re(n),
1605
+ value: Ke(n),
1223
1606
  precision: r
1224
1607
  } : {
1225
1608
  value: parseFloat(n),
1226
1609
  precision: r
1227
1610
  };
1228
1611
  }
1229
- function ct(e, t, n) {
1612
+ var Ot = /\r?\n[ \t]*\r?\n/;
1613
+ function kt(e, t, n) {
1614
+ return Ot.test(e.slice(t, n));
1615
+ }
1616
+ function At(e, t, n, r) {
1617
+ let i = [];
1618
+ for (let a = t; a < e.length; a++) {
1619
+ let t = e[a];
1620
+ if (t.start >= r) break;
1621
+ t.start >= n && t.end <= r && i.push({
1622
+ ...t,
1623
+ start: t.start - n,
1624
+ end: t.end - n
1625
+ });
1626
+ }
1627
+ return i;
1628
+ }
1629
+ function jt(e, t, n, r) {
1630
+ if (n.end !== void 0) return {
1631
+ start: (/_[0-7i]$/.test(e.slice(Math.max(0, n.end - 2), n.end)) ? n.end - 2 : n.end) - t,
1632
+ end: n.end - t,
1633
+ always: r,
1634
+ never: ""
1635
+ };
1636
+ }
1637
+ function Mt(e, t, n) {
1638
+ if (n instanceof N) {
1639
+ let r = jt(e, t, n, `_${n.encodingWidth ?? w(n.value)}`);
1640
+ return r ? [r] : [];
1641
+ }
1642
+ if (n instanceof P) {
1643
+ let r = jt(e, t, n, `_${n.encodingWidth ?? w(n.argument)}`);
1644
+ return r ? [r] : [];
1645
+ }
1646
+ if (n instanceof F) {
1647
+ let r = n.precision ?? j(n.value), i = jt(e, t, n, r === "half" ? "_1" : r === "single" ? "_2" : "_3");
1648
+ return i ? [i] : [];
1649
+ }
1650
+ if (n instanceof L) {
1651
+ let r = jt(e, t, n, `_${n.encodingWidth ?? w(BigInt(n.value.length))}`);
1652
+ return r ? [r] : [];
1653
+ }
1654
+ if (n instanceof q) {
1655
+ let r = jt(e, t, n, `_${n.encodingWidth ?? w(BigInt(yt.encode(n.value).length))}`);
1656
+ return r ? [r] : [];
1657
+ }
1658
+ if (n instanceof B) {
1659
+ let r = [];
1660
+ if (n.indefiniteLength) return;
1661
+ if (n.start !== void 0) {
1662
+ let i = new a(e, { offset: n.start }), o = i.consume(), s = i.peek(), c = s.type === "ENCODING_INDICATOR", l = `_${n.encodingWidth ?? w(BigInt(n.items.length))}`, u = e[o.endOffset] ?? "", d = !c && /[+\-.0-9A-Z_a-z]/.test(u) ? " " : "";
1663
+ r.push({
1664
+ start: (c ? s.offset : o.endOffset) - t,
1665
+ end: (c ? s.endOffset : o.endOffset) - t,
1666
+ always: l + d,
1667
+ never: ""
1668
+ });
1669
+ }
1670
+ for (let i of n.items) {
1671
+ let n = Mt(e, t, i);
1672
+ if (n === void 0) return;
1673
+ r.push(...n);
1674
+ }
1675
+ return r;
1676
+ }
1677
+ }
1678
+ function Nt(e, t, n) {
1230
1679
  if (t.length === 0) return;
1231
- let r = lt(e), i = dt(n), a = [...r].sort((e, t) => e.start - t.start || t.end - e.end), o = [...r].sort((e, t) => e.end - t.end || e.start - t.start), s = [...t].sort((e, t) => e.start - t.start), c = [], l = 0;
1232
- for (let t of s) {
1233
- let r = { ...t }, s = 0, u = o.length;
1234
- for (; s < u;) {
1235
- let e = s + u >> 1;
1236
- o[e].end <= t.start ? s = e + 1 : u = e;
1237
- }
1238
- let d = s > 0 ? o[s - 1] : void 0, f = d ? n.slice(d.end, t.start) : "";
1239
- if (d && i(d.end) === t.line && !f.includes(":")) {
1240
- ut(d.node, "trailing", r);
1680
+ let r = Pt(e), i = It(n), a = [...r].sort((e, t) => e.start - t.start || t.end - e.end), o = [...r].sort((e, t) => e.end - t.end || e.start - t.start), s = [...t].sort((e, t) => e.start - t.start), c = [], l = 0;
1681
+ for (let e of s) {
1682
+ let t = { ...e }, r = 0, s = o.length;
1683
+ for (; r < s;) {
1684
+ let t = r + s >> 1;
1685
+ o[t].end <= e.start ? r = t + 1 : s = t;
1686
+ }
1687
+ let u = r > 0 ? o[r - 1] : void 0, d = u ? n.slice(u.end, e.start) : "";
1688
+ if (u && i(u.end) === e.line && !d.includes(":")) {
1689
+ Ft(u.node, "trailing", t);
1241
1690
  continue;
1242
1691
  }
1243
- for (; l < a.length && a[l].start < t.start;) {
1692
+ for (; l < a.length && a[l].start < e.start;) {
1244
1693
  let e = a[l++];
1245
1694
  for (; c.length > 0 && c[c.length - 1].end <= e.start;) c.pop();
1246
1695
  c.push(e);
1247
1696
  }
1248
- for (; c.length > 0 && c[c.length - 1].end <= t.start;) c.pop();
1249
- let p = c.length > 0 ? c[c.length - 1] : void 0;
1250
- for (s = 0, u = a.length; s < u;) {
1251
- let e = s + u >> 1;
1252
- a[e].start < t.end ? s = e + 1 : u = e;
1697
+ for (; c.length > 0 && c[c.length - 1].end <= e.start;) c.pop();
1698
+ let f = c.length > 0 ? c[c.length - 1] : void 0;
1699
+ for (r = 0, s = a.length; r < s;) {
1700
+ let t = r + s >> 1;
1701
+ a[t].start < e.end ? r = t + 1 : s = t;
1253
1702
  }
1254
- let m = s < a.length ? a[s] : void 0;
1255
- if ((!p || m && m.end <= p.end) && m) {
1256
- ut(m.node, "leading", r);
1703
+ let p = r < a.length ? a[r] : void 0;
1704
+ if ((!f || p && p.end <= f.end) && p) {
1705
+ t.sameLine = i(e.end) === i(p.start), Ft(p.node, "leading", t);
1257
1706
  continue;
1258
1707
  }
1259
- ut(p?.node ?? e, "dangling", r);
1708
+ f && Ft(f.node, "dangling", t);
1260
1709
  }
1261
1710
  }
1262
- function lt(e) {
1711
+ function Pt(e) {
1263
1712
  let t = [], n = (e) => {
1264
1713
  if (e.start !== void 0 && e.end !== void 0 && t.push({
1265
1714
  node: e,
1266
1715
  start: e.start,
1267
1716
  end: e.end
1268
- }), e instanceof R || e instanceof Ve) {
1717
+ }), e instanceof B || e instanceof U) {
1269
1718
  for (let t of e.items) n(t);
1270
1719
  return;
1271
1720
  }
1272
- if (e instanceof z) {
1721
+ if (e instanceof V) {
1273
1722
  for (let [t, r] of e.entries) n(t), n(r);
1274
1723
  return;
1275
1724
  }
1276
- if (e instanceof I || e instanceof L) {
1725
+ if (e instanceof R || e instanceof z) {
1277
1726
  for (let t of e.chunks) n(t);
1278
1727
  return;
1279
1728
  }
1280
- e instanceof P && n(e.content);
1729
+ e instanceof I && n(e.content);
1281
1730
  };
1282
1731
  return n(e), t;
1283
1732
  }
1284
- function ut(e, t, n) {
1733
+ function Ft(e, t, n) {
1285
1734
  e.comments ??= {}, e.comments[t] ??= [], e.comments[t].push(n);
1286
1735
  }
1287
- function dt(e) {
1736
+ function It(e) {
1288
1737
  let t = [0];
1289
1738
  for (let n = 0; n < e.length; n++) e[n] === "\n" && t.push(n + 1);
1290
1739
  return (n) => {
@@ -1298,25 +1747,25 @@ function dt(e) {
1298
1747
  return a + 1;
1299
1748
  };
1300
1749
  }
1301
- var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, pt = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, H = (e) => `'${e}' is a default built-in extension that was excluded via the 'builtinExtensions' option; add it back to that array (or omit 'builtinExtensions' to use the default set)`, mt = /* @__PURE__ */ new Map([
1302
- ["b32", ft("b32")],
1303
- ["h32", ft("h32")],
1304
- ["same", ft("same")],
1305
- ["hash", pt("hash", "@cbortech/hash-extension")],
1306
- ["uuid", pt("uuid", "@cbortech/uuid-extension")],
1307
- ["UUID", pt("uuid", "@cbortech/uuid-extension")],
1308
- ["dt", H("dt")],
1309
- ["DT", H("dt")],
1310
- ["ip", H("ip")],
1311
- ["IP", H("ip")],
1312
- ["cri", H("cri")],
1313
- ["CRI", H("cri")],
1314
- ["t1", H("t1")],
1315
- ["b1", H("b1")],
1316
- ["ilbs", H("ilbs")],
1317
- ["ilts", H("ilts")],
1318
- ["float", H("float")]
1319
- ]), ht = class {
1750
+ var Lt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, Rt = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, K = (e) => `'${e}' is a default built-in extension that was excluded via the 'builtinExtensions' option; add it back to that array (or omit 'builtinExtensions' to use the default set)`, zt = /* @__PURE__ */ new Map([
1751
+ ["b32", Lt("b32")],
1752
+ ["h32", Lt("h32")],
1753
+ ["same", Lt("same")],
1754
+ ["hash", Rt("hash", "@cbortech/hash-extension")],
1755
+ ["uuid", Rt("uuid", "@cbortech/uuid-extension")],
1756
+ ["UUID", Rt("uuid", "@cbortech/uuid-extension")],
1757
+ ["dt", K("dt")],
1758
+ ["DT", K("dt")],
1759
+ ["ip", K("ip")],
1760
+ ["IP", K("ip")],
1761
+ ["cri", K("cri")],
1762
+ ["CRI", K("cri")],
1763
+ ["t1", K("t1")],
1764
+ ["b1", K("b1")],
1765
+ ["ilbs", K("ilbs")],
1766
+ ["ilts", K("ilts")],
1767
+ ["float", K("float")]
1768
+ ]), Bt = class {
1320
1769
  t;
1321
1770
  _options;
1322
1771
  extByPrefix;
@@ -1326,7 +1775,7 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1326
1775
  _hintedPrefixes = /* @__PURE__ */ new Set();
1327
1776
  constructor(e, t) {
1328
1777
  this.t = e, this._options = t, this.extByPrefix = /* @__PURE__ */ new Map(), this.extByTag = /* @__PURE__ */ new Map(), this.unresolvedExtension = t.unresolvedExtension ?? "cpa999";
1329
- let n = Z(t.builtinExtensions);
1778
+ let n = gi(t.builtinExtensions);
1330
1779
  for (let e of [...n, ...t.extensions ?? []]) {
1331
1780
  for (let t of e.appStringPrefixes ?? []) this.extByPrefix.set(t, e);
1332
1781
  for (let t of e.tagNumbers ?? []) this.extByTag.set(t, e);
@@ -1377,12 +1826,12 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1377
1826
  case "BYTES_HEX":
1378
1827
  case "SQSTR":
1379
1828
  case "BYTES_B64": return this.t.consume(), this._parseBytesConcat(this._decodeBytesToken(e), e.type, e.raw);
1380
- case "EMPTY_INDEF_BYTES": return this.t.consume(), new I([]);
1381
- case "EMPTY_INDEF_TEXT": return this.t.consume(), new L([]);
1382
- case "TRUE": return this.t.consume(), new B(21);
1383
- case "FALSE": return this.t.consume(), new B(20);
1384
- case "NULL": return this.t.consume(), new B(22);
1385
- case "UNDEFINED": return this.t.consume(), new B(23);
1829
+ case "EMPTY_INDEF_BYTES": return this.t.consume(), new R([]);
1830
+ case "EMPTY_INDEF_TEXT": return this.t.consume(), new z([]);
1831
+ case "TRUE": return this.t.consume(), new H(21);
1832
+ case "FALSE": return this.t.consume(), new H(20);
1833
+ case "NULL": return this.t.consume(), new H(22);
1834
+ case "UNDEFINED": return this.t.consume(), new H(23);
1386
1835
  case "SIMPLE": return this.parseSimple();
1387
1836
  case "LBRACKET": return this.parseArray();
1388
1837
  case "LBRACE": return this.parseMap();
@@ -1397,106 +1846,138 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1397
1846
  }
1398
1847
  let r = this.extByPrefix.get(e.appPrefix);
1399
1848
  if (!r?.parseAppString) {
1400
- if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new We(e.appPrefix, [new U(e.value)]);
1849
+ if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new at(e.appPrefix, [new q(e.value)]);
1401
1850
  this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
1402
1851
  }
1403
1852
  {
1404
1853
  let i = this._pendingWarnings.length;
1405
1854
  try {
1406
1855
  let i = r.parseAppString(e.appPrefix, e.value, this._extOnError(e), t === void 0 ? void 0 : { encodingWidth: t });
1407
- return t !== void 0 && this._applyEiToResult(i, t, e), i instanceof F && Object.getPrototypeOf(i) === F.prototype && i.ednSource === void 0 ? new F(i.value, {
1856
+ return t !== void 0 && this._applyEiToResult(i, t, e), r.preserveAppSeqSource === "optional" ? (i.appSeqSource = e.raw + n, i) : i instanceof L && Object.getPrototypeOf(i) === L.prototype && i.ednSource === void 0 ? new L(i.value, {
1408
1857
  ednEncoding: i.ednEncoding,
1409
1858
  encodingWidth: i.encodingWidth,
1410
- ednSource: e.raw + n
1411
- }) : (i instanceof N && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
1859
+ ednSource: e.raw + n,
1860
+ ednCommentSyntax: r === tt || r === nt ? "full" : void 0
1861
+ }) : (i instanceof F && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
1412
1862
  } catch (t) {
1413
1863
  if (this._options.strict !== !1) throw t;
1414
- return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new We(e.appPrefix, [new U(e.value)]);
1864
+ return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new at(e.appPrefix, [new q(e.value)]);
1415
1865
  }
1416
1866
  }
1417
1867
  }
1418
1868
  case "APP_SEQUENCE": {
1869
+ let t = this.t.comments.length;
1419
1870
  this.t.consume();
1420
- let t = [];
1871
+ let n = [];
1421
1872
  for (; this.t.peek().type !== "GT_GT";) {
1422
- if (this.t.peek().type === "EOF" && this._fail(`unterminated ${e.appPrefix}<<...>>`, e), t.length > 0) if (this.t.peek().type === "COMMA") {
1873
+ if (this.t.peek().type === "EOF" && this._fail(`unterminated ${e.appPrefix}<<...>>`, e), n.length > 0) if (this.t.peek().type === "COMMA") {
1423
1874
  if (this.t.consume(), this.t.peek().type === "GT_GT") break;
1424
1875
  } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("<<...>> items must be separated by \",\" or whitespace", this.t.peek());
1425
- t.push(this.parseValue());
1876
+ n.push(this.parseValue());
1426
1877
  }
1427
1878
  this.expect("GT_GT");
1428
- let n, r;
1429
- this.t.peek().type === "ENCODING_INDICATOR" && (r = this.t.consume(), n = this._resolveEncodingWidth(r.value, r));
1430
- let i = this.extByPrefix.get(e.appPrefix);
1431
- if (!i) {
1432
- if (this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new We(e.appPrefix, t);
1879
+ let r, i;
1880
+ this.t.peek().type === "ENCODING_INDICATOR" && (i = this.t.consume(), r = this._resolveEncodingWidth(i.value, i));
1881
+ let a = this.extByPrefix.get(e.appPrefix);
1882
+ if (!a) {
1883
+ if (this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new at(e.appPrefix, n);
1433
1884
  this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
1434
1885
  }
1435
- i.parseAppSequence || this._fail(`app-string extension ${JSON.stringify(e.appPrefix)} does not support <<...>> form`, e);
1886
+ a.parseAppSequence || this._fail(`app-string extension ${JSON.stringify(e.appPrefix)} does not support <<...>> form`, e);
1436
1887
  {
1437
- let a = this._pendingWarnings.length;
1888
+ let o = this._pendingWarnings.length;
1438
1889
  try {
1439
- let a = i.parseAppSequence(e.appPrefix, t, this._extOnError(e));
1440
- n !== void 0 && this._applyEiToResult(a, n, r ?? e);
1441
- let o = this.t.source.slice(e.offset, this.t.lastEndOffset);
1442
- if (a instanceof N) a.ednSource === void 0 && (a.ednSource = o);
1443
- else if (i.preserveAppSeqSource) return new Ge(a, o);
1444
- return a;
1445
- } catch (n) {
1446
- if (this._options.strict !== !1) throw n;
1447
- return this._pendingWarnings.length === a && this._warn(n instanceof Error ? n.message : String(n), e), new We(e.appPrefix, t);
1890
+ let o = a.parseAppSequence(e.appPrefix, n, this._extOnError(e));
1891
+ r !== void 0 && this._applyEiToResult(o, r, i ?? e);
1892
+ let s = this.t.source.slice(e.offset, this.t.lastEndOffset);
1893
+ if (a.preserveAppSeqSource === "optional") o.appSeqSource = s, o.appSeqComments = At(this.t.comments, t, e.offset, this.t.lastEndOffset), n.length === 1 && (n[0].end !== void 0 && (o.appSeqInnerEnd = n[0].end - e.offset), o.appSeqSourceFeatures = G(n[0]));
1894
+ else if (o instanceof F) o.ednSource === void 0 && (o.ednSource = s);
1895
+ else if (a.preserveAppSeqSource) return new ot(o, s);
1896
+ return o;
1897
+ } catch (t) {
1898
+ if (this._options.strict !== !1) throw t;
1899
+ return this._pendingWarnings.length === o && this._warn(t instanceof Error ? t.message : String(t), e), new at(e.appPrefix, n);
1448
1900
  }
1449
1901
  }
1450
1902
  }
1451
1903
  case "ELLIPSIS": {
1452
- if (this.t.consume(), this.t.peek().type !== "PLUS") return new V();
1453
- let e = [new V()];
1904
+ if (this.t.consume(), this.t.peek().type !== "PLUS") return new W();
1905
+ let e = [new W()];
1454
1906
  for (; this.t.peek().type === "PLUS";) this.t.consume(), e.push(this.parseValue());
1455
- return new V(e);
1907
+ return new W(e, e.map(() => !0));
1456
1908
  }
1457
1909
  case "BYTES_HEX_ELIDED": return this.t.consume(), this._parseHexElidedConcat(e);
1458
1910
  default: this._fail(`unexpected token: ${JSON.stringify(e.value)}`, e);
1459
1911
  }
1460
1912
  }
1461
1913
  parseIntegerOrTag() {
1462
- let e = this.t.consume(), { numStr: t, rawSuffix: n } = at(e.value), r = n === void 0 ? this.consumeEncodingIndicator() : this._resolveEncodingWidth(n, e), i = ot(t);
1463
- if (i > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", e), new $e(i);
1464
- if (i < -18446744073709551616n) return new et(i);
1465
- if (r !== void 0) {
1466
- let t = i >= 0n ? i : -(i + 1n);
1467
- r = this._validateEncodingFit(t, r, e);
1468
- }
1469
- let a = i >= 0n ? new j(i, r === void 0 ? void 0 : { encodingWidth: r }) : new M(i, r === void 0 ? void 0 : { encodingWidth: r });
1914
+ let e = this.t.comments.length, t = this.t.consume(), { numStr: n, rawSuffix: r } = Ct(t.value), i = r === void 0 ? t.endOffset : t.endOffset - 2, a = t.endOffset, o = r === void 0 ? this.consumeEncodingIndicator(void 0, (e) => {
1915
+ i = e.offset, a = e.endOffset;
1916
+ }) : this._resolveEncodingWidth(r, t), s = wt(n), c = r === void 0 ? t.raw : t.raw.slice(0, -2);
1917
+ if (s > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", t), new _t(s);
1918
+ if (s < -18446744073709551616n) return new vt(s);
1919
+ if (o !== void 0) {
1920
+ let e = s >= 0n ? s : -(s + 1n);
1921
+ o = this._validateEncodingFit(e, o, t);
1922
+ }
1923
+ let l = s >= 0n ? new N(s, {
1924
+ encodingWidth: o,
1925
+ ednSource: c
1926
+ }) : new P(s, {
1927
+ encodingWidth: o,
1928
+ ednSource: c
1929
+ });
1470
1930
  if (this.t.peek().type === "LPAREN") {
1471
- a instanceof j || this._fail("tag number must be non-negative", e), this.t.consume();
1472
- let t = this._pendingWarnings.splice(0), n = this.parseValue();
1931
+ l instanceof N || this._fail("tag number must be non-negative", t), this.t.consume();
1932
+ let n = this._pendingWarnings.splice(0), r = this.parseValue();
1473
1933
  this.expect("RPAREN");
1474
- let i = a.value, o = this.extByTag.get(i);
1475
- if (o?.parseTag) {
1476
- let e = o.parseTag(i, n);
1477
- if (e !== void 0) return e instanceof P && r !== void 0 && e.encodingWidth === void 0 && (e.encodingWidth = r), t.length > 0 && (e.warnings ??= [], e.warnings.push(...t)), e;
1934
+ let s = l.value, u = this.extByTag.get(s);
1935
+ if (u?.parseTag) {
1936
+ let l = u.parseTag(s, r);
1937
+ if (l !== void 0) {
1938
+ if (l instanceof I && (o !== void 0 && l.encodingWidth === void 0 && (l.encodingWidth = o), l.ednSource === void 0 && (l.ednSource = c), u.preserveAppSeqSource === "optional" && l.appSeqSource === void 0)) {
1939
+ l.appSeqSource = this.t.source.slice(t.offset, this.t.lastEndOffset), l.appSeqComments = At(this.t.comments, e, t.offset, this.t.lastEndOffset);
1940
+ let n = l.encodingWidth ?? w(l.tag), o = Mt(this.t.source, t.offset, l.content);
1941
+ l.appSeqEncodingEdits = [{
1942
+ start: i - t.offset,
1943
+ end: a - t.offset,
1944
+ always: `_${n}`,
1945
+ never: ""
1946
+ }, ...o ?? []], o === void 0 && (l.appSeqEncodingEditsComplete = !1), l.appSeqSourceFeatures = G(r);
1947
+ }
1948
+ return n.length > 0 && (l.warnings ??= [], l.warnings.push(...n)), l;
1949
+ }
1478
1950
  }
1479
- let s = new P(i, n, r === void 0 ? void 0 : { encodingWidth: r });
1480
- return t.length > 0 && (s.warnings ??= [], s.warnings.push(...t)), s;
1951
+ let d = new I(s, r, {
1952
+ encodingWidth: o,
1953
+ ednSource: c
1954
+ });
1955
+ return n.length > 0 && (d.warnings ??= [], d.warnings.push(...n)), d;
1481
1956
  }
1482
- return a;
1957
+ return l;
1483
1958
  }
1484
1959
  parseFloat() {
1485
- let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = st(e.value, t);
1960
+ let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = Dt(e.value, t);
1486
1961
  if (r === "half" || r === "single") {
1487
- let e = r === "half" ? E(T(n)) : Math.fround(n);
1962
+ let e = r === "half" ? O(Ae(n)) : Math.fround(n);
1488
1963
  Object.is(n, e) || isNaN(n) && isNaN(e) || t(`${n} cannot be exactly represented as ${r === "half" ? "f16 (_1)" : "f32 (_2)"}; use _3 or remove the indicator`);
1489
1964
  }
1490
- return new N(n, r === void 0 ? void 0 : { precision: r });
1965
+ return new F(n, {
1966
+ precision: r,
1967
+ literalSource: e.raw
1968
+ });
1491
1969
  }
1492
1970
  parseString() {
1493
1971
  let e = this.t.consume();
1494
1972
  if (this.t.peek().type !== "PLUS") {
1495
- let t = this.consumeEncodingIndicator(() => BigInt(tt.encode(e.value).length));
1496
- return e.type === "RAWSTRING" ? new U(e.value, {
1973
+ let t = this.consumeEncodingIndicator(() => BigInt(yt.encode(e.value).length));
1974
+ return e.type === "RAWSTRING" ? new q(e.value, {
1497
1975
  ednSource: e.raw,
1498
1976
  ...t === void 0 ? {} : { encodingWidth: t }
1499
- }) : new U(e.value, t === void 0 ? void 0 : { encodingWidth: t });
1977
+ }) : new q(e.value, {
1978
+ quotedEdnSource: e.raw,
1979
+ ...t === void 0 ? {} : { encodingWidth: t }
1980
+ });
1500
1981
  }
1501
1982
  let t = !1, n = [e.type === "RAWSTRING" ? {
1502
1983
  text: e.value,
@@ -1508,29 +1989,34 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1508
1989
  e.type === "ELLIPSIS" ? (this.t.consume(), n.push({ ellipsis: !0 }), t = !0) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), n.push(e.type === "RAWSTRING" ? {
1509
1990
  text: e.value,
1510
1991
  source: e.raw
1511
- } : { text: e.value })) : this._isBytesToken(e.type) ? (this.t.consume(), n.push({ text: this._decodeUtf8(this._decodeBytesToken(e), e) })) : this._fail(`expected string or byte string after +, got ${JSON.stringify(e.value)}`, e);
1992
+ } : { text: e.value })) : this._isBytesToken(e.type) ? (this.t.consume(), n.push({
1993
+ text: this._decodeUtf8(this._decodeBytesToken(e), e),
1994
+ isByteString: !0
1995
+ })) : this._fail(`expected string or byte string after +, got ${JSON.stringify(e.value)}`, e);
1512
1996
  }
1513
1997
  if (!t) {
1514
- let e = n.map((e) => "text" in e ? e.text : ""), t = n.map((e) => "text" in e ? e.source : void 0), r = e.join(""), i = this.consumeEncodingIndicator(() => BigInt(tt.encode(r).length));
1515
- return new U(r, {
1998
+ let e = n.map((e) => "text" in e ? e.text : ""), t = n.map((e) => "text" in e ? e.source : void 0), r = n.map((e) => "text" in e ? e.isByteString ?? !1 : !1), i = e.join(""), a = this.consumeEncodingIndicator(() => BigInt(yt.encode(i).length));
1999
+ return new q(i, {
1516
2000
  ednParts: e,
1517
2001
  ...t.some((e) => e !== void 0) ? { ednPartSources: t } : {},
1518
- ...i === void 0 ? {} : { encodingWidth: i }
2002
+ ...r.some((e) => e) ? { ednPartIsByteString: r } : {},
2003
+ ...a === void 0 ? {} : { encodingWidth: a }
1519
2004
  });
1520
2005
  }
1521
2006
  let r = [], i = [], a = () => {
1522
2007
  let e = i.map((e) => e.text), t = e.join("");
1523
2008
  if (t !== "") {
1524
- let n = i.map((e) => e.source);
1525
- r.push(new U(t, {
2009
+ let n = i.map((e) => e.source), a = i.map((e) => e.isByteString ?? !1);
2010
+ r.push(new q(t, {
1526
2011
  ednParts: e,
1527
- ...n.some((e) => e !== void 0) ? { ednPartSources: n } : {}
2012
+ ...n.some((e) => e !== void 0) ? { ednPartSources: n } : {},
2013
+ ...a.some((e) => e) ? { ednPartIsByteString: a } : {}
1528
2014
  }));
1529
2015
  }
1530
2016
  i.length = 0;
1531
2017
  };
1532
- for (let e of n) "ellipsis" in e ? (a(), r.push(new V())) : i.push(e);
1533
- return a(), new V(r);
2018
+ for (let e of n) "ellipsis" in e ? (a(), r.push(new W())) : i.push(e);
2019
+ return a(), new W(r);
1534
2020
  }
1535
2021
  _isBytesToken(e) {
1536
2022
  return e === "BYTES_HEX" || e === "SQSTR" || e === "BYTES_B64";
@@ -1552,7 +2038,7 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1552
2038
  }
1553
2039
  case "BYTES_HEX": return this._hexToBytes(e.value, e);
1554
2040
  case "BYTES_B64": try {
1555
- return He(e.value, t);
2041
+ return rt(e.value, t);
1556
2042
  } catch (t) {
1557
2043
  if (t instanceof r || !(t instanceof SyntaxError)) throw t;
1558
2044
  this._fail(t.message, e);
@@ -1561,83 +2047,103 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1561
2047
  }
1562
2048
  }
1563
2049
  _decodeUtf8(e, t) {
1564
- if (this._options.allowInvalidUtf8) return rt.decode(e);
2050
+ if (this._options.allowInvalidUtf8) return xt.decode(e);
1565
2051
  try {
1566
- return nt.decode(e);
2052
+ return bt.decode(e);
1567
2053
  } catch {
1568
- return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), rt.decode(e);
2054
+ return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), xt.decode(e);
1569
2055
  }
1570
2056
  }
1571
2057
  _tokenTypeToCdnEncoding(e) {
1572
2058
  return e === "BYTES_B64" ? "base64" : "hex";
1573
2059
  }
2060
+ _tokenTypeToCommentSyntax(e) {
2061
+ if (e === "BYTES_HEX") return "full";
2062
+ if (e === "BYTES_B64") return "hash-only";
2063
+ }
1574
2064
  _parseBytesConcat(e, t, n) {
1575
2065
  if (this.t.peek().type !== "PLUS") {
1576
2066
  let r = this.consumeEncodingIndicator(() => BigInt(e.length));
1577
- return new F(e, {
2067
+ return new L(e, {
1578
2068
  ednEncoding: this._tokenTypeToCdnEncoding(t),
1579
2069
  ednSource: n,
2070
+ ednCommentSyntax: this._tokenTypeToCommentSyntax(t),
1580
2071
  ...r === void 0 ? {} : { encodingWidth: r }
1581
2072
  });
1582
2073
  }
1583
- let r = !1, i = [{
2074
+ let r = [{
1584
2075
  bytes: e,
1585
- source: n
1586
- }];
1587
- for (; this.t.peek().type === "PLUS";) {
1588
- this.t.consume();
1589
- let e = this.t.peek();
1590
- if (e.type === "ELLIPSIS") this.t.consume(), i.push({ ellipsis: !0 }), r = !0;
1591
- else if (e.type === "BYTES_HEX_ELIDED") {
1592
- this.t.consume();
1593
- let t = this._buildBytesElidedItems(e.value, e);
1594
- for (let e of t) e instanceof V ? (i.push({ ellipsis: !0 }), r = !0) : e instanceof F && i.push({ bytes: e.value });
1595
- } else this._isBytesToken(e.type) ? (this.t.consume(), i.push({
1596
- bytes: this._decodeBytesToken(e),
1597
- source: e.raw
1598
- })) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), this._warnOrFail("text string in a byte-string concatenation is not allowed; use a byte string literal (h'...', b64'...', or '...') instead", e), i.push({ bytes: tt.encode(e.value) })) : this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
1599
- }
1600
- if (!r) {
1601
- let e = i.map((e) => "bytes" in e ? e : { bytes: /* @__PURE__ */ new Uint8Array() }), n = this._concatBytes(e.map((e) => e.bytes)), r = this.consumeEncodingIndicator(() => BigInt(n.length));
1602
- return new F(n, {
1603
- ednEncoding: this._tokenTypeToCdnEncoding(t),
1604
- ednParts: e,
1605
- ...r === void 0 ? {} : { encodingWidth: r }
1606
- });
1607
- }
1608
- let a = [], o = [], s = () => {
1609
- o.length > 0 && (a.push(new F(this._concatBytes([...o]))), o.length = 0);
1610
- };
1611
- for (let e of i) "ellipsis" in e ? (s(), a.push(new V())) : o.push(e.bytes);
1612
- return s(), new V(a);
2076
+ source: n,
2077
+ commentSyntax: this._tokenTypeToCommentSyntax(t),
2078
+ real: !1
2079
+ }], i = this._consumeByteEllipsisChain(r);
2080
+ return this._buildFromByteAtoms(i, this._tokenTypeToCdnEncoding(t));
1613
2081
  }
1614
2082
  _parseHexElidedConcat(e) {
1615
- let t = this._buildBytesElidedItems(e.value, e);
2083
+ let t = this._consumeByteEllipsisChain(this._elidedHexAtoms(e.value, e));
2084
+ return this._buildFromByteAtoms(t, "hex");
2085
+ }
2086
+ _consumeByteEllipsisChain(e) {
2087
+ let t = e;
1616
2088
  for (; this.t.peek().type === "PLUS";) {
1617
2089
  this.t.consume();
1618
2090
  let e = this.t.peek();
1619
- if (e.type === "ELLIPSIS") this.t.consume(), t.push(new V());
2091
+ if (e.type === "ELLIPSIS") this.t.consume(), t.push({
2092
+ ellipsis: !0,
2093
+ real: !0,
2094
+ fromByteLiteral: !1
2095
+ });
1620
2096
  else if (e.type === "BYTES_HEX_ELIDED") {
1621
2097
  this.t.consume();
1622
- let n = this._buildBytesElidedItems(e.value, e);
1623
- this._mergeFirstBytesItem(t, n);
1624
- } else if (this._isBytesToken(e.type)) {
1625
- this.t.consume();
1626
- let n = this._decodeBytesToken(e), r = t[t.length - 1];
1627
- r instanceof F ? t[t.length - 1] = new F(this._concatBytes([r.value, n])) : t.push(new F(n));
1628
- } else this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
2098
+ let n = this._elidedHexAtoms(e.value, e);
2099
+ n.length > 0 && (n[0].real = !0), t.push(...n);
2100
+ } else this._isBytesToken(e.type) ? (this.t.consume(), t.push({
2101
+ bytes: this._decodeBytesToken(e),
2102
+ source: e.raw,
2103
+ commentSyntax: this._tokenTypeToCommentSyntax(e.type),
2104
+ real: !0
2105
+ })) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), this._warnOrFail("text string in a byte-string concatenation is not allowed; use a byte string literal (h'...', b64'...', or '...') instead", e), t.push({
2106
+ bytes: yt.encode(e.value),
2107
+ real: !0
2108
+ })) : this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
1629
2109
  }
1630
- return new V(t);
2110
+ return t;
1631
2111
  }
1632
- _buildBytesElidedItems(e, t) {
2112
+ _elidedHexAtoms(e, t) {
1633
2113
  let n = e.split("..."), r = [];
1634
- for (let e = 0; e < n.length; e++) e > 0 && r.push(new V()), n[e].length > 0 && r.push(new F(this._hexToBytes(n[e], t)));
2114
+ for (let e = 0; e < n.length; e++) e > 0 && r.push({
2115
+ ellipsis: !0,
2116
+ real: !1,
2117
+ fromByteLiteral: !0,
2118
+ literalSource: t.raw
2119
+ }), n[e].length > 0 && r.push({
2120
+ bytes: this._hexToBytes(n[e], t),
2121
+ commentSyntax: "full",
2122
+ real: !1
2123
+ });
1635
2124
  return r;
1636
2125
  }
1637
- _mergeFirstBytesItem(e, t) {
1638
- if (t.length === 0) return;
1639
- let n = e[e.length - 1], r = t[0];
1640
- n instanceof F && r instanceof F ? (e[e.length - 1] = new F(this._concatBytes([n.value, r.value])), e.push(...t.slice(1))) : e.push(...t);
2126
+ _buildFromByteAtoms(e, t) {
2127
+ if (!e.some((e) => "ellipsis" in e)) {
2128
+ let n = e, r = this._concatBytes(n.map((e) => e.bytes)), i = this.consumeEncodingIndicator(() => BigInt(r.length));
2129
+ return new L(r, {
2130
+ ednEncoding: t,
2131
+ ednParts: n,
2132
+ ...i === void 0 ? {} : { encodingWidth: i }
2133
+ });
2134
+ }
2135
+ let n = [], r = [], i = [], a = () => {
2136
+ i.length > 0 && (n.push(new L(this._concatBytes(i.map((e) => e.bytes)), { ...i.length > 1 ? { ednParts: i.map(({ bytes: e, source: t, commentSyntax: n }) => ({
2137
+ bytes: e,
2138
+ source: t,
2139
+ commentSyntax: n
2140
+ })) } : {
2141
+ ednSource: i[0].source,
2142
+ ednCommentSyntax: i[0].commentSyntax
2143
+ } })), r.push(i[0].real), i.length = 0);
2144
+ };
2145
+ for (let t of e) "ellipsis" in t ? (a(), n.push(new W(t.fromByteLiteral, t.literalSource)), r.push(t.real)) : i.push(t);
2146
+ return a(), new W(n, r);
1641
2147
  }
1642
2148
  _concatBytes(e) {
1643
2149
  let t = e.reduce((e, t) => e + t.byteLength, 0), n = new Uint8Array(t), r = 0;
@@ -1648,8 +2154,8 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1648
2154
  this.t.consume(), this.expect("LPAREN");
1649
2155
  let e = this.t.peek();
1650
2156
  e.type !== "INTEGER" && this._fail(`expected integer inside simple(), got ${JSON.stringify(e.value)}`, e), this.t.consume();
1651
- let { numStr: t } = at(e.value), n = Number(ot(t));
1652
- return this.expect("RPAREN"), new B(n);
2157
+ let { numStr: t } = Ct(e.value), n = Number(wt(t));
2158
+ return this.expect("RPAREN"), new H(n, { ednSource: e.raw });
1653
2159
  }
1654
2160
  parseEmbeddedCBOR() {
1655
2161
  this.t.consume();
@@ -1666,46 +2172,47 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1666
2172
  let e = this.t.consume();
1667
2173
  t = this._resolveEncodingWidth(e.value, e);
1668
2174
  }
1669
- return new Ve(e, { encodingWidth: t });
2175
+ return new U(e, { encodingWidth: t });
1670
2176
  }
1671
2177
  parseArray() {
1672
2178
  this.t.consume();
1673
2179
  let e = !1, t, n;
1674
2180
  this.t.peek().type === "UNDERSCORE" ? (this.t.consume(), e = !0) : this.t.peek().type === "ENCODING_INDICATOR" && (n = this.t.consume(), n.value === "7" ? (e = !0, this._warnOrFail("encoding indicator _7 is non-standard; use _ to indicate indefinite length", n), n = void 0) : t = this._resolveEncodingWidth(n.value, n));
1675
- let r = this._pendingWarnings.splice(0), i = [];
2181
+ let r = this._pendingWarnings.splice(0), i = [], a = this.t.lastEndOffset;
1676
2182
  for (; this.t.peek().type !== "RBRACKET";) {
1677
2183
  if (i.length > 0) if (this.t.peek().type === "COMMA") {
1678
2184
  if (this.t.consume(), this.t.peek().type === "RBRACKET") break;
1679
2185
  } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("array items must be separated by \",\" or whitespace", this.t.peek());
1680
- i.push(this.parseValue());
2186
+ let e = this.parseValue();
2187
+ kt(this.t.source, a, e.start) && (e.blankLineBefore = !0), a = e.end, i.push(e);
1681
2188
  }
1682
2189
  this.expect("RBRACKET"), t !== void 0 && n !== void 0 && (t = this._validateEncodingFit(BigInt(i.length), t, n));
1683
- let a = new R(i, {
2190
+ let o = new B(i, {
1684
2191
  indefiniteLength: e,
1685
2192
  encodingWidth: t
1686
2193
  });
1687
- return r.length > 0 && (a.warnings ??= [], a.warnings.push(...r)), a;
2194
+ return r.length > 0 && (o.warnings ??= [], o.warnings.push(...r)), o;
1688
2195
  }
1689
2196
  parseMap() {
1690
2197
  this.t.consume();
1691
2198
  let e = !1, t, n;
1692
2199
  this.t.peek().type === "UNDERSCORE" ? (this.t.consume(), e = !0) : this.t.peek().type === "ENCODING_INDICATOR" && (n = this.t.consume(), n.value === "7" ? (e = !0, this._warnOrFail("encoding indicator _7 is non-standard; use _ to indicate indefinite length", n), n = void 0) : t = this._resolveEncodingWidth(n.value, n));
1693
- let r = this._pendingWarnings.splice(0), i = [];
2200
+ let r = this._pendingWarnings.splice(0), i = [], a = this.t.lastEndOffset;
1694
2201
  for (; this.t.peek().type !== "RBRACE";) {
1695
2202
  if (i.length > 0) if (this.t.peek().type === "COMMA") {
1696
2203
  if (this.t.consume(), this.t.peek().type === "RBRACE") break;
1697
2204
  } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("map entries must be separated by \",\" or whitespace", this.t.peek());
1698
2205
  let e = this.parseValue();
1699
- this.expect("COLON");
2206
+ kt(this.t.source, a, e.start) && (e.blankLineBefore = !0), this.expect("COLON");
1700
2207
  let t = this.parseValue();
1701
- i.push([e, t]);
2208
+ a = t.end, i.push([e, t]);
1702
2209
  }
1703
2210
  this.expect("RBRACE"), t !== void 0 && n !== void 0 && (t = this._validateEncodingFit(BigInt(i.length), t, n));
1704
- let a = new z(i, {
2211
+ let o = new V(i, {
1705
2212
  indefiniteLength: e,
1706
2213
  encodingWidth: t
1707
2214
  });
1708
- return r.length > 0 && (a.warnings ??= [], a.warnings.push(...r)), a;
2215
+ return r.length > 0 && (o.warnings ??= [], o.warnings.push(...r)), o;
1709
2216
  }
1710
2217
  parseIndefGroup() {
1711
2218
  this.t.consume();
@@ -1716,35 +2223,38 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1716
2223
  let e = this.t.consume(), t = `encoding indicator _${e.value} is not valid in an indefinite string group; use _`;
1717
2224
  this._warnOrFail(t, e);
1718
2225
  } else e.type !== "RPAREN" && this._warnOrFail("indefinite string group is missing _ after (; interpreting as (_ ...)", e);
1719
- let t = this._pendingWarnings.splice(0), n = [];
2226
+ let t = this._pendingWarnings.splice(0), n = [], r = this.t.lastEndOffset;
1720
2227
  for (; this.t.peek().type !== "RPAREN";) {
1721
2228
  if (n.length > 0) if (this.t.peek().type === "COMMA") {
1722
2229
  if (this.t.consume(), this.t.peek().type === "RPAREN") break;
1723
2230
  } else this.t.peek().offset === this.t.lastEndOffset && this._warnOrFail("indefinite string chunks must be separated by \",\" or whitespace", this.t.peek());
1724
- n.push(this.parseValue());
2231
+ let e = this.parseValue();
2232
+ kt(this.t.source, r, e.start) && (e.blankLineBefore = !0), r = e.end, n.push(e);
1725
2233
  }
1726
2234
  this.expect("RPAREN"), n.length === 0 && this._fail("empty indefinite group (_ ) is ambiguous; use ''_ for bytes or \"\"_ for text");
1727
- let r = n[0];
1728
- if (r instanceof F) {
1729
- let e = new I(n.map((e, t) => {
1730
- if (e instanceof F) return e;
2235
+ let i = n[0];
2236
+ if (i instanceof L) {
2237
+ let e = new R(n.map((e, t) => {
2238
+ if (e instanceof L) return e;
1731
2239
  this._fail(`indefinite byte string chunk ${t} must be a byte string, not a text string`);
1732
2240
  }));
1733
2241
  return t.length > 0 && (e.warnings = t), e;
1734
2242
  }
1735
- if (r instanceof U) {
1736
- let e = new L(n.map((e, t) => {
1737
- if (e instanceof U) return e;
2243
+ if (i instanceof q) {
2244
+ let e = new z(n.map((e, t) => {
2245
+ if (e instanceof q) return e;
1738
2246
  this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`);
1739
2247
  }));
1740
2248
  return t.length > 0 && (e.warnings = t), e;
1741
2249
  }
1742
2250
  this._fail("indefinite group chunks must be byte strings or text strings");
1743
2251
  }
1744
- consumeEncodingIndicator(e) {
2252
+ consumeEncodingIndicator(e, t) {
1745
2253
  if (this.t.peek().type === "ENCODING_INDICATOR") {
1746
- let t = this.t.consume(), n = this._resolveEncodingWidth(t.value, t);
1747
- return n !== void 0 && e !== void 0 && (n = this._validateEncodingFit(e(), n, t)), n;
2254
+ let n = this.t.consume();
2255
+ t?.(n);
2256
+ let r = this._resolveEncodingWidth(n.value, n);
2257
+ return r !== void 0 && e !== void 0 && (r = this._validateEncodingFit(e(), r, n)), r;
1748
2258
  }
1749
2259
  }
1750
2260
  expect(e) {
@@ -1752,47 +2262,47 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1752
2262
  return t.type !== e && this._fail(`expected ${e}, got ${t.type} (${JSON.stringify(t.value)})`, t), t;
1753
2263
  }
1754
2264
  _applyEiToResult(e, t, n) {
1755
- if (e instanceof N) {
2265
+ if (e instanceof F) {
1756
2266
  let r = t === 1 ? "half" : t === 2 ? "single" : t === 3 ? "double" : void 0;
1757
2267
  if (r === void 0) this._warnOrFail(`encoding indicator _${t} is not valid for a float; use _1, _2, or _3`, n);
1758
2268
  else if (e.precision !== r) {
1759
2269
  if (r !== "double") {
1760
- let t = r === "half" ? E(T(e.value)) : Math.fround(e.value);
2270
+ let t = r === "half" ? O(Ae(e.value)) : Math.fround(e.value);
1761
2271
  !Object.is(t, e.value) && !isNaN(e.value) && this._warnOrFail(`${e.value} cannot be exactly represented as ${r === "half" ? "float16 (_1)" : "float32 (_2)"}`, n);
1762
2272
  }
1763
2273
  e.precision = r;
1764
2274
  }
1765
- } else if (e instanceof j) {
2275
+ } else if (e instanceof N) {
1766
2276
  if (e.encodingWidth === void 0) {
1767
2277
  let r = this._validateEncodingFit(e.value, t, n);
1768
2278
  r !== void 0 && (e.encodingWidth = r);
1769
2279
  }
1770
- } else if (e instanceof M) {
2280
+ } else if (e instanceof P) {
1771
2281
  if (e.encodingWidth === void 0) {
1772
2282
  let r = this._validateEncodingFit(e.argument, t, n);
1773
2283
  r !== void 0 && (e.encodingWidth = r);
1774
2284
  }
1775
- } else if (e instanceof F) {
2285
+ } else if (e instanceof L) {
1776
2286
  if (e.encodingWidth === void 0) {
1777
2287
  let r = this._validateEncodingFit(BigInt(e.value.length), t, n);
1778
2288
  r !== void 0 && (e.encodingWidth = r);
1779
2289
  }
1780
- } else if (e instanceof U) {
2290
+ } else if (e instanceof q) {
1781
2291
  if (e.encodingWidth === void 0) {
1782
- let r = this._validateEncodingFit(BigInt(tt.encode(e.value).length), t, n);
2292
+ let r = this._validateEncodingFit(BigInt(yt.encode(e.value).length), t, n);
1783
2293
  r !== void 0 && (e.encodingWidth = r);
1784
2294
  }
1785
- } else if (e instanceof R) {
2295
+ } else if (e instanceof B) {
1786
2296
  if (e.encodingWidth === void 0) {
1787
2297
  let r = this._validateEncodingFit(BigInt(e.items.length), t, n);
1788
2298
  r !== void 0 && (e.encodingWidth = r);
1789
2299
  }
1790
- } else if (e instanceof z) {
2300
+ } else if (e instanceof V) {
1791
2301
  if (e.encodingWidth === void 0) {
1792
2302
  let r = this._validateEncodingFit(BigInt(e.entries.length), t, n);
1793
2303
  r !== void 0 && (e.encodingWidth = r);
1794
2304
  }
1795
- } else if (e instanceof P) {
2305
+ } else if (e instanceof I) {
1796
2306
  if (e.encodingWidth === void 0) {
1797
2307
  let r = this._validateEncodingFit(e.tag, t, n);
1798
2308
  r !== void 0 && (e.encodingWidth = r);
@@ -1800,7 +2310,7 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1800
2310
  } else this._warnOrFail(`encoding indicator _${t} is not applicable to this app-string result type`, n);
1801
2311
  }
1802
2312
  _validateEncodingFit(e, t, n) {
1803
- let r = Me(t);
2313
+ let r = ze(t);
1804
2314
  if (e <= r) return t;
1805
2315
  let i = `value ${e} does not fit in encoding indicator ${t === "i" ? "_i (max 23)" : `_${t} (max ${r})`}`;
1806
2316
  this._warnOrFail(i, n);
@@ -1824,29 +2334,29 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1824
2334
  this._warn(e, t), this._options.strict !== !1 && this._fail(e, t);
1825
2335
  }
1826
2336
  _hintMissingExtension(e, t) {
1827
- let n = mt.get(e);
2337
+ let n = zt.get(e);
1828
2338
  if (n === void 0 || this._hintedPrefixes.has(e)) return;
1829
2339
  this._hintedPrefixes.add(e);
1830
2340
  let r = `app-string prefix '${e}' requires an extension that is not enabled; ${n}`;
1831
2341
  this._options.onWarning ? this._options.onWarning({
1832
2342
  message: r,
1833
- ...gt(t),
2343
+ ...Vt(t),
1834
2344
  hint: !0
1835
2345
  }) : this._options.silent || console.warn(`CDN: ${r}`);
1836
2346
  }
1837
2347
  _warn(e, t) {
1838
2348
  let n = { message: e };
1839
- if (t !== void 0 && Object.assign(n, gt(t)), this._pendingWarnings.push(n), this._options.onWarning) this._options.onWarning(n);
2349
+ if (t !== void 0 && Object.assign(n, Vt(t)), this._pendingWarnings.push(n), this._options.onWarning) this._options.onWarning(n);
1840
2350
  else if (!this._options.silent) {
1841
2351
  let n = t ? ` at line ${t.line}, column ${t.col}` : "";
1842
2352
  console.warn(`CDN strict violation${n}: ${e}`);
1843
2353
  }
1844
2354
  }
1845
2355
  _fail(e, t) {
1846
- throw new r(e, t ? gt(t) : void 0);
2356
+ throw new r(e, t ? Vt(t) : void 0);
1847
2357
  }
1848
2358
  };
1849
- function gt(e) {
2359
+ function Vt(e) {
1850
2360
  return {
1851
2361
  offset: e.offset,
1852
2362
  line: e.line,
@@ -1856,66 +2366,69 @@ function gt(e) {
1856
2366
  }
1857
2367
  //#endregion
1858
2368
  //#region src/ast/CborTextString.ts
1859
- var _t = new TextEncoder(), vt = !1, U = class extends A {
2369
+ var Ht = new TextEncoder(), Ut = !1, q = class extends M {
1860
2370
  indefiniteLength = !1;
1861
2371
  value;
1862
2372
  encodingWidth;
1863
2373
  ednParts;
1864
2374
  ednSource;
2375
+ quotedEdnSource;
1865
2376
  ednPartSources;
2377
+ ednPartIsByteString;
1866
2378
  constructor(e, t) {
1867
- super(), this.value = e, this.encodingWidth = t?.encodingWidth, this.ednParts = t?.ednParts, this.ednSource = t?.ednSource, this.ednPartSources = t?.ednPartSources;
2379
+ super(), this.value = e, this.encodingWidth = t?.encodingWidth, this.ednParts = t?.ednParts, this.ednSource = t?.ednSource, this.quotedEdnSource = t?.quotedEdnSource, this.ednPartSources = t?.ednPartSources, this.ednPartIsByteString = t?.ednPartIsByteString;
1868
2380
  }
1869
2381
  _encodeTo(e, t) {
1870
2382
  e.writeTextString(3, this.value, this.encodingWidth);
1871
2383
  }
1872
2384
  _toCDN(e, t) {
1873
- let n = w(e, this.encodingWidth, () => C(BigInt(_t.encode(this.value).length)));
1874
- return yt(this.value, n, e, t, this.ednParts, this.ednSource, this.ednPartSources);
2385
+ let n = T(e, this.encodingWidth, () => w(BigInt(Ht.encode(this.value).length)));
2386
+ return Wt(this.value, n, e, t, this.ednParts, this.ednSource, this.quotedEdnSource, this.ednPartSources);
1875
2387
  }
1876
2388
  _toJS(e) {
1877
2389
  return this.value;
1878
2390
  }
1879
2391
  };
1880
- function yt(e, t, n, r, i, a, o) {
1881
- let s = _(n);
1882
- if (n?.preserveRawString && a !== void 0 && (s !== null || !/[\r\n]/.test(a))) return a + t;
1883
- if (s === null) return ye(e) + t;
1884
- let c = n?.preserveRawString ? o : void 0, l = c?.some((e) => e !== void 0) ?? !1, { cdn: u, newline: d } = xt(n), f = n?.preserveConcatenation && i !== void 0 && (i.length > 1 || l) ? i : void 0;
1885
- if (!u && !d && f === void 0) return ye(e) + t;
1886
- let p = u ? wt(e) : null;
1887
- if (f !== void 0 && (p === null || l)) {
2392
+ function Wt(e, t, n, r, i, a, o, s) {
2393
+ let c = _(n);
2394
+ if (n?.preserveRawString && a !== void 0 && (c !== null || !/[\r\n]/.test(a))) return a + t;
2395
+ if (n?.preserveTextString && o !== void 0 && (c !== null || !/[\r\n]/.test(o))) return o + t;
2396
+ if (c === null) return Se(e) + t;
2397
+ let l = n?.preserveRawString ? s : void 0, u = l?.some((e) => e !== void 0) ?? !1, { cdn: d, newline: f } = Kt(n), p = n?.preserveConcatenation && i !== void 0 && (i.length > 1 || u) ? i : void 0;
2398
+ if (!d && !f && p === void 0) return Se(e) + t;
2399
+ let m = d ? Yt(e) : null;
2400
+ if (p !== void 0 && (m === null || u)) {
1888
2401
  let e = [];
1889
- for (let [t, n] of f.entries()) {
1890
- let r = c?.[t];
2402
+ for (let [t, n] of p.entries()) {
2403
+ let r = l?.[t];
1891
2404
  if (r !== void 0) e.push({
1892
2405
  text: n,
1893
2406
  contentDepth: 0,
1894
2407
  source: r
1895
2408
  });
1896
- else if (d) {
2409
+ else if (f) {
1897
2410
  let t = /* @__PURE__ */ new Map();
1898
- for (let { point: e, contentDepth: r } of Ct(n, 0)) t.set(e, r);
1899
- e.push(...Mt(n, t));
2411
+ for (let { point: e, contentDepth: r } of Jt(n, 0)) t.set(e, r);
2412
+ e.push(...rn(n, t));
1900
2413
  } else e.push({
1901
2414
  text: n,
1902
2415
  contentDepth: 0
1903
2416
  });
1904
2417
  }
1905
- return bt(e, t, s, r);
2418
+ return Gt(e, t, c, r);
1906
2419
  }
1907
- let m = /* @__PURE__ */ new Map();
1908
- if (p !== null) for (let { point: e, contentDepth: t } of p) m.set(e, t);
1909
- if (d) {
1910
- let t = p === null ? Ct(e, 0) : Tt(e);
1911
- for (let { point: e, contentDepth: n } of t) m.has(e) || m.set(e, n);
2420
+ let h = /* @__PURE__ */ new Map();
2421
+ if (m !== null) for (let { point: e, contentDepth: t } of m) h.set(e, t);
2422
+ if (f) {
2423
+ let t = m === null ? Jt(e, 0) : Xt(e);
2424
+ for (let { point: e, contentDepth: n } of t) h.has(e) || h.set(e, n);
1912
2425
  }
1913
- let h = Mt(e, m);
1914
- return h.length <= 1 ? ye(e) + t : bt(h, t, s, r);
2426
+ let g = rn(e, h);
2427
+ return g.length <= 1 ? Se(e) + t : Gt(g, t, c, r);
1915
2428
  }
1916
- function bt(e, t, n, r) {
2429
+ function Gt(e, t, n, r) {
1917
2430
  let i = e.map(({ text: n, source: r }, i) => {
1918
- let a = r ?? ye(n);
2431
+ let a = r ?? Se(n);
1919
2432
  return i === e.length - 1 ? a + t : a;
1920
2433
  }), a = i[0];
1921
2434
  for (let t = 1; t < i.length; t++) {
@@ -1924,17 +2437,17 @@ function bt(e, t, n, r) {
1924
2437
  }
1925
2438
  return a;
1926
2439
  }
1927
- function xt(e) {
1928
- let t = e?.splitCdn === void 0 || e?.splitNewline === void 0 ? St(e?.textStringFormat ?? []) : [];
2440
+ function Kt(e) {
2441
+ let t = e?.splitCdn === void 0 || e?.splitNewline === void 0 ? qt(e?.textStringFormat ?? []) : [];
1929
2442
  return {
1930
2443
  cdn: e?.splitCdn ?? t.includes("cdn"),
1931
2444
  newline: e?.splitNewline ?? t.includes("newline")
1932
2445
  };
1933
2446
  }
1934
- function St(e) {
1935
- return e.map((e) => e === "cboredn" ? (vt || (vt = !0, console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")), "cdn") : e);
2447
+ function qt(e) {
2448
+ return e.map((e) => e === "cboredn" ? (Ut || (Ut = !0, console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")), "cdn") : e);
1936
2449
  }
1937
- function Ct(e, t) {
2450
+ function Jt(e, t) {
1938
2451
  let n = [];
1939
2452
  for (let r = 0; r < e.length; r++) {
1940
2453
  let i = e[r];
@@ -1951,9 +2464,9 @@ function Ct(e, t) {
1951
2464
  }
1952
2465
  return n;
1953
2466
  }
1954
- function wt(e) {
2467
+ function Yt(e) {
1955
2468
  try {
1956
- it(e);
2469
+ St(e);
1957
2470
  } catch {
1958
2471
  return null;
1959
2472
  }
@@ -1962,24 +2475,24 @@ function wt(e) {
1962
2475
  let a = n.consume();
1963
2476
  if (a.type === "EOF") break;
1964
2477
  let c = !1;
1965
- if (o || (o = !0, a.offset > 0 && At(n.comments, 0, a.offset) && t.push({
2478
+ if (o || (o = !0, a.offset > 0 && tn(n.comments, 0, a.offset) && t.push({
1966
2479
  point: a.offset,
1967
2480
  contentDepth: r
1968
2481
  })), i !== null) {
1969
- if (i.kind === "opener" && Dt.has(a.type)) {
2482
+ if (i.kind === "opener" && Qt.has(a.type)) {
1970
2483
  i.point = a.endOffset, s = a.endOffset;
1971
2484
  continue;
1972
- } else i.kind === "opener" && kt.has(a.type) && jt(e, i.point, a.offset) ? c = !0 : t.push({
2485
+ } else i.kind === "opener" && en.has(a.type) && nn(e, i.point, a.offset) ? c = !0 : t.push({
1973
2486
  point: a.offset,
1974
2487
  contentDepth: i.contentDepth
1975
2488
  });
1976
2489
  i = null;
1977
2490
  }
1978
- Ot.has(a.type) ? (r++, i = {
2491
+ $t.has(a.type) ? (r++, i = {
1979
2492
  point: a.endOffset,
1980
2493
  contentDepth: r,
1981
2494
  kind: "opener"
1982
- }) : kt.has(a.type) ? (r = Math.max(0, r - 1), c || t.push({
2495
+ }) : en.has(a.type) ? (r = Math.max(0, r - 1), c || t.push({
1983
2496
  point: a.offset,
1984
2497
  contentDepth: r
1985
2498
  })) : a.type === "COMMA" && (i = {
@@ -1994,23 +2507,23 @@ function wt(e) {
1994
2507
  contentDepth: r
1995
2508
  }), t;
1996
2509
  }
1997
- function Tt(e) {
2510
+ function Xt(e) {
1998
2511
  let t = [], n = new a(e), r = 0;
1999
2512
  for (;;) {
2000
2513
  let i = n.consume();
2001
2514
  if (i.type === "EOF") break;
2002
- if (Ot.has(i.type)) r++;
2003
- else if (kt.has(i.type)) r = Math.max(0, r - 1);
2515
+ if ($t.has(i.type)) r++;
2516
+ else if (en.has(i.type)) r = Math.max(0, r - 1);
2004
2517
  else if (i.type !== "COMMA") {
2005
2518
  if (i.type === "TSTR") {
2006
2519
  let n = e.slice(i.offset, i.endOffset);
2007
- for (let e of Et(n)) t.push({
2520
+ for (let e of Zt(n)) t.push({
2008
2521
  point: i.offset + e,
2009
2522
  contentDepth: r + 1
2010
2523
  });
2011
2524
  } else if (i.type === "RAWSTRING") {
2012
2525
  let n = e.slice(i.offset, i.endOffset);
2013
- for (let { point: e } of Ct(n, 0)) t.push({
2526
+ for (let { point: e } of Jt(n, 0)) t.push({
2014
2527
  point: i.offset + e,
2015
2528
  contentDepth: r + 1
2016
2529
  });
@@ -2019,7 +2532,7 @@ function Tt(e) {
2019
2532
  }
2020
2533
  return t;
2021
2534
  }
2022
- function Et(e) {
2535
+ function Zt(e) {
2023
2536
  let t = [], n = 1, r = e.length - 1;
2024
2537
  for (; n < r;) {
2025
2538
  let r = e[n];
@@ -2035,24 +2548,24 @@ function Et(e) {
2035
2548
  }
2036
2549
  return t;
2037
2550
  }
2038
- var Dt = /* @__PURE__ */ new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), Ot = /* @__PURE__ */ new Set([
2551
+ var Qt = /* @__PURE__ */ new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), $t = /* @__PURE__ */ new Set([
2039
2552
  "LBRACKET",
2040
2553
  "LBRACE",
2041
2554
  "LPAREN",
2042
2555
  "LT_LT"
2043
- ]), kt = /* @__PURE__ */ new Set([
2556
+ ]), en = /* @__PURE__ */ new Set([
2044
2557
  "RBRACKET",
2045
2558
  "RBRACE",
2046
2559
  "RPAREN",
2047
2560
  "GT_GT"
2048
2561
  ]);
2049
- function At(e, t, n) {
2562
+ function tn(e, t, n) {
2050
2563
  return e.some((e) => e.start >= t && e.end <= n);
2051
2564
  }
2052
- function jt(e, t, n) {
2565
+ function nn(e, t, n) {
2053
2566
  return /^[\t\n\r ]*$/.test(e.slice(t, n));
2054
2567
  }
2055
- function Mt(e, t) {
2568
+ function rn(e, t) {
2056
2569
  let n = [...t].filter(([t]) => t > 0 && t < e.length).sort(([e], [t]) => e - t);
2057
2570
  if (n.length === 0) return [{
2058
2571
  text: e,
@@ -2070,7 +2583,7 @@ function Mt(e, t) {
2070
2583
  }
2071
2584
  //#endregion
2072
2585
  //#region src/extensions/dt.ts
2073
- function W(e) {
2586
+ function an(e) {
2074
2587
  if (Number.isInteger(e)) return (/* @__PURE__ */ new Date(e * 1e3)).toISOString().replace(/\.000Z$/, "Z");
2075
2588
  let t = Math.round(e * 1e3);
2076
2589
  if (t / 1e3 === e) return new Date(t).toISOString().replace(/\.000Z$/, "Z");
@@ -2078,17 +2591,17 @@ function W(e) {
2078
2591
  for (; s.length < 3;) s += "0";
2079
2592
  return `${i}.${s}Z`;
2080
2593
  }
2081
- var Nt = new TextDecoder("utf-8", { fatal: !0 });
2082
- function Pt(e) {
2594
+ var on = new TextDecoder("utf-8", { fatal: !0 });
2595
+ function sn(e) {
2083
2596
  if (e.length !== 1) throw SyntaxError("dt<<...>>: expected exactly one item");
2084
2597
  let t = e[0];
2085
- if (t instanceof U) return t.value;
2086
- if (t instanceof F) return Nt.decode(t.value);
2598
+ if (t instanceof q) return t.value;
2599
+ if (t instanceof L) return on.decode(t.value);
2087
2600
  throw SyntaxError("dt<<...>>: expected a text string or byte string");
2088
2601
  }
2089
- var Ft = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;
2090
- function It(e, t) {
2091
- if (!Ft.test(e)) {
2602
+ var cn = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;
2603
+ function ln(e, t) {
2604
+ if (!cn.test(e)) {
2092
2605
  let n = `dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`;
2093
2606
  if (t) t(n);
2094
2607
  else throw SyntaxError(n);
@@ -2099,93 +2612,110 @@ function It(e, t) {
2099
2612
  if (isNaN(a)) throw SyntaxError(`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`);
2100
2613
  if (i === void 0) {
2101
2614
  let e = a / 1e3;
2102
- return e >= 0 ? new Rt(BigInt(e)) : new zt(BigInt(e));
2615
+ return e >= 0 ? new dn(BigInt(e)) : new fn(BigInt(e));
2103
2616
  }
2104
- return new Bt(a / 1e3 + i);
2617
+ return new pn(a / 1e3 + i);
2105
2618
  }
2106
- var Lt = 1n, Rt = class extends j {
2619
+ var un = 1n, dn = class extends N {
2107
2620
  constructor(e, t) {
2108
2621
  super(e, t);
2109
2622
  }
2110
2623
  _toCDN(e, t) {
2111
2624
  if (e?.appStrings === !1) return super._toCDN(e, t);
2112
- let n = w(e, this.encodingWidth, () => C(this.value));
2113
- return `dt'${W(Number(this.value))}'${n}`;
2625
+ let n = T(e, this.encodingWidth, () => w(this.value));
2626
+ return E(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? D(this.appSeqSource, n, e, this.appSeqInnerEnd, this.appSeqComments) : `dt'${an(Number(this.value))}'${n}`;
2114
2627
  }
2115
- }, zt = class extends M {
2628
+ }, fn = class extends P {
2116
2629
  constructor(e, t) {
2117
2630
  super(e, t);
2118
2631
  }
2119
2632
  _toCDN(e, t) {
2120
2633
  if (e?.appStrings === !1) return super._toCDN(e, t);
2121
- let n = w(e, this.encodingWidth, () => C(this.argument));
2122
- return `dt'${W(Number(this.value))}'${n}`;
2634
+ let n = T(e, this.encodingWidth, () => w(this.argument));
2635
+ return E(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? D(this.appSeqSource, n, e, this.appSeqInnerEnd, this.appSeqComments) : `dt'${an(Number(this.value))}'${n}`;
2123
2636
  }
2124
- }, Bt = class extends N {
2637
+ }, pn = class extends F {
2125
2638
  constructor(e, t) {
2126
2639
  super(e, t);
2127
2640
  }
2128
2641
  _toCDN(e, t) {
2129
2642
  if (e?.appStrings === !1) return super._toCDN(e, t);
2130
- let n = k(this.value), r = xe(this.value, this.precision, n, e?.encodingIndicators ?? "auto");
2131
- return `dt'${W(this.value)}'${r}`;
2643
+ let n = j(this.value), r = we(this.value, this.precision, n, e?.encodingIndicators ?? "auto");
2644
+ return E(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? D(this.appSeqSource, r, e, this.appSeqInnerEnd, this.appSeqComments) : `dt'${an(this.value)}'${r}`;
2132
2645
  }
2133
- }, Vt = class extends P {
2646
+ }, mn = class extends I {
2134
2647
  constructor(e, t) {
2135
- super(Lt, typeof e == "string" ? It(e) : e, t);
2648
+ super(un, typeof e == "string" ? ln(e) : e, t);
2136
2649
  }
2137
2650
  _toCDN(e, t) {
2138
2651
  if (e?.appStrings === !1) return super._toCDN(e, t);
2139
- let n = this.content;
2140
- if (n instanceof N ? n.precision !== void 0 && n.precision !== k(n.value) : n.encodingWidth !== void 0) return super._toCDN({
2652
+ let n = E(e, this.appSeqSource, this.ednSource, this.appSeqSourceFeatures, this.appSeqEncodingEditsComplete);
2653
+ if (n === "verbatim") return this.appSeqSource;
2654
+ if (n === "source") return De(this.appSeqSource, e, this.appSeqComments, this.appSeqEncodingEdits);
2655
+ if (n === "structural") return super._toCDN({
2141
2656
  ...e,
2142
2657
  appStrings: !1
2143
2658
  }, t);
2144
- let r = n instanceof N ? n.value : Number(n.value), i = w(e, this.encodingWidth, () => C(Lt));
2145
- return `DT'${W(r)}'${i}`;
2659
+ let r = T(e, this.encodingWidth, () => w(un));
2660
+ if (n === "adjusted") return D(this.appSeqSource, r, e, this.appSeqInnerEnd, this.appSeqComments);
2661
+ let i = this.content;
2662
+ return (i instanceof F ? i.precision !== void 0 && i.precision !== j(i.value) : i.encodingWidth !== void 0) ? super._toCDN({
2663
+ ...e,
2664
+ appStrings: !1
2665
+ }, t) : `DT'${an(i instanceof F ? i.value : Number(i.value))}'${r}`;
2146
2666
  }
2147
- }, Ht = class extends Vt {
2667
+ }, hn = class extends mn {
2148
2668
  constructor(e, t) {
2149
2669
  super(e, t);
2150
2670
  }
2151
2671
  _toJS(e) {
2152
- let t = this.content, n = t instanceof N ? t.value * 1e3 : Number(t.value) * 1e3;
2672
+ let t = this.content, n = t instanceof F ? t.value * 1e3 : Number(t.value) * 1e3;
2153
2673
  return new Date(n);
2154
2674
  }
2155
2675
  };
2156
- function Ut(e) {
2676
+ function gn(e) {
2157
2677
  let t = e?.jsDate ?? !1;
2158
2678
  function n(e) {
2159
- return t ? new Ht(e) : new Vt(e);
2679
+ return t ? new hn(e) : new mn(e);
2160
2680
  }
2161
2681
  let r = {
2162
2682
  appStringPrefixes: ["dt", "DT"],
2163
- tagNumbers: [Lt],
2683
+ tagNumbers: [un],
2684
+ preserveAppSeqSource: "optional",
2164
2685
  parseAppString(e, t, r) {
2165
- return e === "DT" ? n(t) : It(t, r);
2686
+ return e === "DT" ? n(t) : ln(t, r);
2166
2687
  },
2167
2688
  parseAppSequence(e, t, r) {
2168
- let i = Pt(t);
2169
- return e === "DT" ? n(i) : It(i, r);
2689
+ let i = sn(t);
2690
+ return e === "DT" ? n(i) : ln(i, r);
2170
2691
  },
2171
2692
  parseTag(e, n) {
2172
2693
  if (e !== 1n) return;
2173
2694
  let r;
2174
- if (n instanceof j) r = new Rt(n.value, { encodingWidth: n.encodingWidth });
2175
- else if (n instanceof M) r = new zt(n.value, { encodingWidth: n.encodingWidth });
2176
- else if (n instanceof N) r = new Bt(n.value), n.precision !== void 0 && (r.precision = n.precision);
2695
+ if (n instanceof N) r = new dn(n.value, {
2696
+ encodingWidth: n.encodingWidth,
2697
+ ednSource: n.ednSource
2698
+ });
2699
+ else if (n instanceof P) r = new fn(n.value, {
2700
+ encodingWidth: n.encodingWidth,
2701
+ ednSource: n.ednSource
2702
+ });
2703
+ else if (n instanceof F) r = new pn(n.value, {
2704
+ precision: n.precision,
2705
+ literalSource: n.literalSource
2706
+ });
2177
2707
  else return;
2178
- return r.start = n.start, r.end = n.end, t ? new Ht(r) : new Vt(r);
2708
+ return r.start = n.start, r.end = n.end, t ? new hn(r) : new mn(r);
2179
2709
  }
2180
2710
  };
2181
2711
  return t && (r.fromJS = (e, t) => {
2182
- if (e instanceof Date) return new Ht(W(e.getTime() / 1e3));
2712
+ if (e instanceof Date) return new hn(an(e.getTime() / 1e3));
2183
2713
  }, r.isJSType = (e) => e instanceof Date), r;
2184
2714
  }
2185
- var Wt = Ut(), Gt = Ut({ jsDate: !0 });
2715
+ var _n = gn(), vn = gn({ jsDate: !0 });
2186
2716
  //#endregion
2187
2717
  //#region src/utils/ip.ts
2188
- function Kt(e) {
2718
+ function yn(e) {
2189
2719
  let t = e.split(".");
2190
2720
  if (t.length !== 4) throw SyntaxError(`ip: invalid IPv4 address: ${JSON.stringify(e)}`);
2191
2721
  let n = /* @__PURE__ */ new Uint8Array(4);
@@ -2198,11 +2728,11 @@ function Kt(e) {
2198
2728
  }
2199
2729
  return n;
2200
2730
  }
2201
- function qt(e) {
2731
+ function bn(e) {
2202
2732
  let t = /* @__PURE__ */ new Uint8Array(16);
2203
2733
  if (e === "::") return t;
2204
2734
  let n = e, r = null, i = e.match(/^(.*):(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
2205
- i && (n = i[1], n.endsWith(":") && (n += ":"), r = Kt(i[2]));
2735
+ i && (n = i[1], n.endsWith(":") && (n += ":"), r = yn(i[2]));
2206
2736
  let a = n.split("::");
2207
2737
  if (a.length > 2) throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);
2208
2738
  let o = a.length === 2, s = a[0] ? a[0].split(":") : [], c = o && a[1] ? a[1].split(":") : [], l = r ? 6 : 8;
@@ -2219,11 +2749,11 @@ function qt(e) {
2219
2749
  }
2220
2750
  return r && t.set(r, 12), t;
2221
2751
  }
2222
- function Jt(e) {
2752
+ function xn(e) {
2223
2753
  return Array.from(e).join(".");
2224
2754
  }
2225
- function Yt(e) {
2226
- let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? Jt(e.slice(12)) : null, n = t ? 6 : 8, r = [];
2755
+ function Sn(e) {
2756
+ let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? xn(e.slice(12)) : null, n = t ? 6 : 8, r = [];
2227
2757
  for (let t = 0; t < n * 2; t += 2) r.push(e[t] << 8 | e[t + 1]);
2228
2758
  let i = -1, a = 0, o = 0;
2229
2759
  for (; o < n;) if (r[o] === 0) {
@@ -2237,29 +2767,29 @@ function Yt(e) {
2237
2767
  }
2238
2768
  //#endregion
2239
2769
  //#region src/extensions/ip.ts
2240
- var Xt = "ip", G = "IP", Zt = 52n, Qt = 54n, $t = new TextDecoder("utf-8", { fatal: !0 });
2241
- function en(e) {
2770
+ var Cn = "ip", wn = "IP", Tn = 52n, En = 54n, Dn = new TextDecoder("utf-8", { fatal: !0 });
2771
+ function On(e) {
2242
2772
  if (e.length !== 1) throw SyntaxError("ip<<...>>: expected exactly one item");
2243
2773
  let t = e[0];
2244
- if (t instanceof U) return t.value;
2245
- if (t instanceof F) return $t.decode(t.value);
2774
+ if (t instanceof q) return t.value;
2775
+ if (t instanceof L) return Dn.decode(t.value);
2246
2776
  throw SyntaxError("ip<<...>>: expected a text string or byte string");
2247
2777
  }
2248
- function tn(e) {
2778
+ function kn(e) {
2249
2779
  return /^\d/.test(e) && e.includes(".") && !e.includes(":") ? {
2250
- bytes: Kt(e),
2780
+ bytes: yn(e),
2251
2781
  isV4: !0
2252
2782
  } : {
2253
- bytes: qt(e),
2783
+ bytes: bn(e),
2254
2784
  isV4: !1
2255
2785
  };
2256
2786
  }
2257
- function nn(e) {
2258
- if (e.length === 4) return Jt(e);
2259
- if (e.length === 16) return Yt(e);
2787
+ function An(e) {
2788
+ if (e.length === 4) return xn(e);
2789
+ if (e.length === 16) return Sn(e);
2260
2790
  throw SyntaxError(`ip: unexpected byte length: ${e.length}`);
2261
2791
  }
2262
- function rn(e, t) {
2792
+ function jn(e, t) {
2263
2793
  let n = new Uint8Array(e.length);
2264
2794
  n.set(e);
2265
2795
  let r = Math.floor(t / 8), i = t % 8;
@@ -2269,72 +2799,82 @@ function rn(e, t) {
2269
2799
  for (; a > 0 && n[a - 1] === 0;) a--;
2270
2800
  return n.slice(0, a);
2271
2801
  }
2272
- function an(e, t) {
2802
+ function Mn(e, t) {
2273
2803
  let n = new Uint8Array(t);
2274
2804
  return n.set(e), n;
2275
2805
  }
2276
- var on = class extends F {
2806
+ var Nn = class extends L {
2277
2807
  _toCDN(e, t) {
2278
2808
  if (e?.appStrings === !1) return super._toCDN(e, t);
2279
- let n = w(e, this.encodingWidth, () => C(BigInt(this.value.length)));
2280
- return `${Xt}'${nn(this.value)}'${n}`;
2809
+ let n = T(e, this.encodingWidth, () => w(BigInt(this.value.length)));
2810
+ return E(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted" ? D(this.appSeqSource, n, e, this.appSeqInnerEnd, this.appSeqComments) : `${Cn}'${An(this.value)}'${n}`;
2281
2811
  }
2282
- }, sn = class extends R {
2812
+ }, Pn = class extends B {
2283
2813
  _isV4;
2284
2814
  constructor(e, t, n) {
2285
- super([new j(BigInt(e)), new F(t)]), this._isV4 = n;
2815
+ super([new N(BigInt(e)), new L(t)]), this._isV4 = n;
2286
2816
  }
2287
2817
  _toCDN(e, t) {
2288
2818
  if (e?.appStrings === !1) return super._toCDN(e, t);
2819
+ if (E(e, this.appSeqSource, void 0, this.appSeqSourceFeatures) === "adjusted") return D(this.appSeqSource, "", e, this.appSeqInnerEnd, this.appSeqComments);
2289
2820
  let n = Number(this.items[0].value), r = this.items[1].value;
2290
- return `${Xt}'${nn(an(r, this._isV4 ? 4 : 16))}/${n}'`;
2821
+ return `${Cn}'${An(Mn(r, this._isV4 ? 4 : 16))}/${n}'`;
2291
2822
  }
2292
- }, cn = class extends P {
2823
+ }, Fn = class extends I {
2293
2824
  constructor(e, t) {
2294
2825
  super(e, t);
2295
2826
  }
2296
2827
  _toCDN(e, t) {
2297
2828
  if (e?.appStrings === !1) return super._toCDN(e, t);
2298
- let n = this.tag === Zt ? 4 : 16, r = this.content;
2299
- if (r instanceof F) {
2300
- if (r.encodingWidth !== void 0) return super._toCDN(e, t);
2301
- let n = w(e, this.encodingWidth, () => C(this.tag));
2302
- return `${G}'${nn(r.value)}'${n}`;
2303
- }
2304
- if (r instanceof R && r.items.length === 2 && r.items[0] instanceof j && r.items[1] instanceof F) {
2305
- if (r.encodingWidth !== void 0 || r.items[0].encodingWidth !== void 0 || r.items[1].encodingWidth !== void 0) return super._toCDN(e, t);
2306
- let i = Number(r.items[0].value), a = an(r.items[1].value, n), o = w(e, this.encodingWidth, () => C(this.tag));
2307
- return `${G}'${nn(a)}/${i}'${o}`;
2829
+ let n = E(e, this.appSeqSource, this.ednSource, this.appSeqSourceFeatures, this.appSeqEncodingEditsComplete);
2830
+ if (n === "verbatim") return this.appSeqSource;
2831
+ if (n === "source") return De(this.appSeqSource, e, this.appSeqComments, this.appSeqEncodingEdits);
2832
+ if (n === "structural") return super._toCDN(e, t);
2833
+ if (n === "adjusted") {
2834
+ let t = T(e, this.encodingWidth, () => w(this.tag));
2835
+ return D(this.appSeqSource, t, e, this.appSeqInnerEnd, this.appSeqComments);
2836
+ }
2837
+ let r = this.tag === Tn ? 4 : 16, i = this.content;
2838
+ if (i instanceof L) {
2839
+ if (i.encodingWidth !== void 0) return super._toCDN(e, t);
2840
+ let n = T(e, this.encodingWidth, () => w(this.tag));
2841
+ return `${wn}'${An(i.value)}'${n}`;
2842
+ }
2843
+ if (i instanceof B && i.items.length === 2 && i.items[0] instanceof N && i.items[1] instanceof L) {
2844
+ if (i.encodingWidth !== void 0 || i.items[0].encodingWidth !== void 0 || i.items[1].encodingWidth !== void 0) return super._toCDN(e, t);
2845
+ let n = Number(i.items[0].value), a = Mn(i.items[1].value, r), o = T(e, this.encodingWidth, () => w(this.tag));
2846
+ return `${wn}'${An(a)}/${n}'${o}`;
2308
2847
  }
2309
2848
  return super._toCDN(e, t);
2310
2849
  }
2311
2850
  };
2312
- function ln(e, t) {
2851
+ function In(e, t) {
2313
2852
  let n = t.indexOf("/");
2314
2853
  if (n === -1) {
2315
- let { bytes: n, isV4: r } = tn(t);
2316
- return e === G ? new cn(r ? Zt : Qt, new F(n)) : new on(n);
2854
+ let { bytes: n, isV4: r } = kn(t);
2855
+ return e === wn ? new Fn(r ? Tn : En, new L(n)) : new Nn(n);
2317
2856
  }
2318
2857
  let r = t.slice(0, n), i = t.slice(n + 1);
2319
2858
  if (!/^\d+$/.test(i)) throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);
2320
- let a = parseInt(i, 10), { bytes: o, isV4: s } = tn(r), c = s ? 32 : 128;
2859
+ let a = parseInt(i, 10), { bytes: o, isV4: s } = kn(r), c = s ? 32 : 128;
2321
2860
  if (a > c) throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s ? "IPv4" : "IPv6"}`);
2322
- let l = rn(o, a);
2323
- return e === G ? new cn(s ? Zt : Qt, new R([new j(BigInt(a)), new F(l)])) : new sn(a, l, s);
2861
+ let l = jn(o, a);
2862
+ return e === wn ? new Fn(s ? Tn : En, new B([new N(BigInt(a)), new L(l)])) : new Pn(a, l, s);
2324
2863
  }
2325
- var un = {
2326
- appStringPrefixes: [Xt, G],
2327
- tagNumbers: [Zt, Qt],
2864
+ var Ln = {
2865
+ appStringPrefixes: [Cn, wn],
2866
+ tagNumbers: [Tn, En],
2867
+ preserveAppSeqSource: "optional",
2328
2868
  parseAppString(e, t) {
2329
- return ln(e, t);
2869
+ return In(e, t);
2330
2870
  },
2331
2871
  parseAppSequence(e, t) {
2332
- return ln(e, en(t));
2872
+ return In(e, On(t));
2333
2873
  },
2334
2874
  parseTag(e, t) {
2335
- if (!(e !== Zt && e !== Qt) && (t instanceof F || t instanceof R)) return new cn(e, t);
2875
+ if (!(e !== Tn && e !== En) && (t instanceof L || t instanceof B)) return new Fn(e, t);
2336
2876
  }
2337
- }, dn = "cri", fn = "CRI", pn = 99n, mn = /* @__PURE__ */ new Map([
2877
+ }, Rn = "cri", zn = "CRI", Bn = 99n, Vn = /* @__PURE__ */ new Map([
2338
2878
  ["coap", -1n],
2339
2879
  ["coaps", -2n],
2340
2880
  ["http", -3n],
@@ -2345,47 +2885,47 @@ var un = {
2345
2885
  ["coaps+tcp", -8n],
2346
2886
  ["coap+ws", -25n],
2347
2887
  ["coaps+ws", -26n]
2348
- ]), hn = new Map([...mn.entries()].map(([e, t]) => [t, e]));
2349
- function K(e) {
2888
+ ]), Hn = new Map([...Vn.entries()].map(([e, t]) => [t, e]));
2889
+ function J(e) {
2350
2890
  try {
2351
2891
  return decodeURIComponent(e);
2352
2892
  } catch {
2353
2893
  return e;
2354
2894
  }
2355
2895
  }
2356
- var gn = new TextEncoder(), _n = new TextDecoder("utf-8", { fatal: !0 });
2357
- function vn(e) {
2358
- return Array.from(gn.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2896
+ var Un = new TextEncoder(), Wn = new TextDecoder("utf-8", { fatal: !0 });
2897
+ function Gn(e) {
2898
+ return Array.from(Un.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2359
2899
  }
2360
- function q(e, t) {
2900
+ function Y(e, t) {
2361
2901
  let n = "";
2362
- for (let r of e) n += t(r) ? r : vn(r);
2902
+ for (let r of e) n += t(r) ? r : Gn(r);
2363
2903
  return n;
2364
2904
  }
2365
- function yn(e) {
2905
+ function Kn(e) {
2366
2906
  return /[A-Za-z0-9\-._~]/.test(e);
2367
2907
  }
2368
- function bn(e) {
2908
+ function qn(e) {
2369
2909
  return /[!$&'()*+,;=]/.test(e);
2370
2910
  }
2371
- function xn(e) {
2372
- return yn(e) || bn(e) || e === ":" || e === "@";
2911
+ function Jn(e) {
2912
+ return Kn(e) || qn(e) || e === ":" || e === "@";
2373
2913
  }
2374
- function Sn(e) {
2375
- return (xn(e) || e === "/" || e === "?") && e !== "&";
2914
+ function Yn(e) {
2915
+ return (Jn(e) || e === "/" || e === "?") && e !== "&";
2376
2916
  }
2377
- function Cn(e) {
2378
- return xn(e) || e === "/" || e === "?";
2917
+ function Xn(e) {
2918
+ return Jn(e) || e === "/" || e === "?";
2379
2919
  }
2380
- function wn(e) {
2381
- return yn(e) || bn(e) || e === ":";
2920
+ function Zn(e) {
2921
+ return Kn(e) || qn(e) || e === ":";
2382
2922
  }
2383
- function Tn(e) {
2384
- return yn(e) || bn(e);
2923
+ function Qn(e) {
2924
+ return Kn(e) || qn(e);
2385
2925
  }
2386
- function En(e) {
2926
+ function $n(e) {
2387
2927
  let t = [], n = e, r = n.indexOf("@");
2388
- r >= 0 && (t.push(B.FALSE), t.push(new U(K(n.slice(0, r)))), n = n.slice(r + 1));
2928
+ r >= 0 && (t.push(H.FALSE), t.push(new q(J(n.slice(0, r)))), n = n.slice(r + 1));
2389
2929
  let i, a = null;
2390
2930
  if (n.startsWith("[")) {
2391
2931
  let e = n.indexOf("]");
@@ -2394,263 +2934,263 @@ function En(e) {
2394
2934
  let r = n.slice(e + 1);
2395
2935
  if (r.startsWith(":")) a = r.slice(1);
2396
2936
  else if (r.length > 0) throw SyntaxError("cri: unexpected characters after ']' in authority");
2397
- t.push(new F(qt(i)));
2937
+ t.push(new L(bn(i)));
2398
2938
  } else {
2399
2939
  let e = n.lastIndexOf(":");
2400
- if (e >= 0 ? (i = n.slice(0, e), a = n.slice(e + 1)) : i = n, i !== "") if (/^\d{1,3}(\.\d{1,3}){3}$/.test(i)) t.push(new F(Kt(i)));
2401
- else for (let e of i.toLowerCase().split(".")) t.push(new U(e));
2940
+ if (e >= 0 ? (i = n.slice(0, e), a = n.slice(e + 1)) : i = n, i !== "") if (/^\d{1,3}(\.\d{1,3}){3}$/.test(i)) t.push(new L(yn(i)));
2941
+ else for (let e of i.toLowerCase().split(".")) t.push(new q(e));
2402
2942
  }
2403
2943
  if (a !== null && a !== "") {
2404
2944
  if (!/^\d+$/.test(a)) throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);
2405
2945
  let e = parseInt(a, 10);
2406
2946
  if (e > 65535) throw SyntaxError(`cri: port ${e} out of range`);
2407
- t.push(new j(BigInt(e)));
2947
+ t.push(new N(BigInt(e)));
2408
2948
  }
2409
- return new R(t);
2949
+ return new B(t);
2410
2950
  }
2411
- function Dn(e) {
2951
+ function er(e) {
2412
2952
  let t = e.items, n = 0, r = "";
2413
- if (n < t.length && t[n] instanceof B && t[n].value === 20) {
2953
+ if (n < t.length && t[n] instanceof H && t[n].value === 20) {
2414
2954
  n++;
2415
2955
  let e = t[n++];
2416
- r += q(e.value, wn) + "@";
2956
+ r += Y(e.value, Zn) + "@";
2417
2957
  }
2418
2958
  if (n >= t.length) return r;
2419
2959
  let i = t[n];
2420
- if (i instanceof F) {
2960
+ if (i instanceof L) {
2421
2961
  n++;
2422
2962
  let { length: e } = i.value;
2423
- if (e === 4) r += Jt(i.value);
2424
- else if (e === 16) r += "[" + Yt(i.value) + "]";
2963
+ if (e === 4) r += xn(i.value);
2964
+ else if (e === 16) r += "[" + Sn(i.value) + "]";
2425
2965
  else throw Error(`cri: unexpected host-ip byte length: ${e}`);
2426
- n < t.length && t[n] instanceof U && (r += `%25${q(t[n++].value, Tn)}`);
2966
+ n < t.length && t[n] instanceof q && (r += `%25${Y(t[n++].value, Qn)}`);
2427
2967
  } else {
2428
2968
  let e = [];
2429
- for (; n < t.length && t[n] instanceof U;) e.push(q(t[n++].value, Tn));
2969
+ for (; n < t.length && t[n] instanceof q;) e.push(Y(t[n++].value, Qn));
2430
2970
  r += e.join(".");
2431
2971
  }
2432
- return n < t.length && t[n] instanceof j && (r += ":" + t[n].value.toString()), r;
2972
+ return n < t.length && t[n] instanceof N && (r += ":" + t[n].value.toString()), r;
2433
2973
  }
2434
- function On(e) {
2974
+ function tr(e) {
2435
2975
  let t = e.slice(2), n = t.indexOf("/"), r, i;
2436
- return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new U(K(e)))) : (r = t, i = []), {
2437
- authority: En(r),
2976
+ return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new q(J(e)))) : (r = t, i = []), {
2977
+ authority: $n(r),
2438
2978
  pathSegments: i
2439
2979
  };
2440
2980
  }
2441
- function kn(e) {
2981
+ function nr(e) {
2442
2982
  let t = e, n = null, r = t.indexOf("#");
2443
- r >= 0 && (n = K(t.slice(r + 1)), t = t.slice(0, r));
2983
+ r >= 0 && (n = J(t.slice(r + 1)), t = t.slice(0, r));
2444
2984
  let i = null, a = t.indexOf("?");
2445
2985
  if (a >= 0) {
2446
2986
  let e = t.slice(a + 1);
2447
- t = t.slice(0, a), i = e.split("&").map((e) => new U(K(e)));
2987
+ t = t.slice(0, a), i = e.split("&").map((e) => new q(J(e)));
2448
2988
  }
2449
2989
  let o = [], s = /^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);
2450
2990
  if (s) {
2451
- let e = s[1].toLowerCase(), t = s[2], n = mn.get(e);
2452
- if (o.push(n === void 0 ? new U(e) : new M(n)), t.startsWith("//")) {
2453
- let { authority: e, pathSegments: n } = On(t);
2454
- o.push(e, new R(n));
2991
+ let e = s[1].toLowerCase(), t = s[2], n = Vn.get(e);
2992
+ if (o.push(n === void 0 ? new q(e) : new P(n)), t.startsWith("//")) {
2993
+ let { authority: e, pathSegments: n } = tr(t);
2994
+ o.push(e, new B(n));
2455
2995
  } else if (t.startsWith("/")) {
2456
- let e = t.slice(1).split("/").map((e) => new U(K(e)));
2457
- o.push(B.NULL, new R(e));
2996
+ let e = t.slice(1).split("/").map((e) => new q(J(e)));
2997
+ o.push(H.NULL, new B(e));
2458
2998
  } else {
2459
- let e = t.split("/").map((e) => new U(K(e)));
2460
- o.push(B.TRUE, new R(e));
2999
+ let e = t.split("/").map((e) => new q(J(e)));
3000
+ o.push(H.TRUE, new B(e));
2461
3001
  }
2462
3002
  } else if (t.startsWith("//")) {
2463
- let { authority: e, pathSegments: n } = On(t);
2464
- o.push(B.FALSE, e, new R(n));
3003
+ let { authority: e, pathSegments: n } = tr(t);
3004
+ o.push(H.FALSE, e, new B(n));
2465
3005
  } else if (t.startsWith("/")) {
2466
- let e = t.slice(1).split("/").map((e) => new U(K(e)));
2467
- o.push(B.TRUE, new R(e));
2468
- } else if (t === "") o.push(new j(0n));
3006
+ let e = t.slice(1).split("/").map((e) => new q(J(e)));
3007
+ o.push(H.TRUE, new B(e));
3008
+ } else if (t === "") o.push(new N(0n));
2469
3009
  else {
2470
3010
  let n = 1n, r = t, i = !1;
2471
3011
  for (r.startsWith("./") && (i = !0, r = r.slice(2)); r.startsWith("../");) n++, r = r.slice(3);
2472
3012
  if (r === ".." ? (n++, r = "") : r === "." && (r = ""), n === 1n && !i && r !== "" && r.split("/")[0].includes(":")) throw SyntaxError(`cri: invalid relative-path reference — first segment must not contain ':' without a './' prefix (RFC 3986 §3.3): ${JSON.stringify(e)}`);
2473
- let a = r === "" ? [] : r.split("/").map((e) => new U(K(e)));
2474
- o.push(new j(n), new R(a));
3013
+ let a = r === "" ? [] : r.split("/").map((e) => new q(J(e)));
3014
+ o.push(new N(n), new B(a));
2475
3015
  }
2476
- if (i !== null && o.push(new R(i)), n !== null && (i === null && o.push(B.NULL), o.push(new U(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
3016
+ if (i !== null && o.push(new B(i)), n !== null && (i === null && o.push(H.NULL), o.push(new q(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
2477
3017
  let e = o[o.length - 1];
2478
- e instanceof R && e.items.length === 0 && o.pop();
3018
+ e instanceof B && e.items.length === 0 && o.pop();
2479
3019
  }
2480
- return o.length === 1 && o[0] instanceof j && o[0].value === 0n ? [] : o;
3020
+ return o.length === 1 && o[0] instanceof N && o[0].value === 0n ? [] : o;
2481
3021
  }
2482
- function An(e, t) {
3022
+ function rr(e, t) {
2483
3023
  let n = t, r = "";
2484
3024
  if (n < e.length) {
2485
3025
  let t = e[n];
2486
- if (t instanceof R) {
3026
+ if (t instanceof B) {
2487
3027
  if (n++, t.items.length > 0) {
2488
3028
  let e = t.items.map((e) => {
2489
- if (!(e instanceof U)) throw Error("cri: query item must be a text string");
2490
- return q(e.value, Sn);
3029
+ if (!(e instanceof q)) throw Error("cri: query item must be a text string");
3030
+ return Y(e.value, Yn);
2491
3031
  });
2492
3032
  r += "?" + e.join("&");
2493
3033
  }
2494
- } else t instanceof B && t.value === 22 && n++;
3034
+ } else t instanceof H && t.value === 22 && n++;
2495
3035
  }
2496
- return n < e.length && e[n] instanceof U && (r += "#" + q(e[n].value, Cn)), r;
3036
+ return n < e.length && e[n] instanceof q && (r += "#" + Y(e[n].value, Xn)), r;
2497
3037
  }
2498
- function jn(e) {
3038
+ function ir(e) {
2499
3039
  return e.items.map((e) => {
2500
- if (!(e instanceof U)) throw Error("cri: path segment must be a text string");
2501
- return q(e.value, xn);
3040
+ if (!(e instanceof q)) throw Error("cri: path segment must be a text string");
3041
+ return Y(e.value, Jn);
2502
3042
  });
2503
3043
  }
2504
- function Mn(e) {
3044
+ function ar(e) {
2505
3045
  if (e.length === 0) return "";
2506
3046
  let t = 0, n = e[t++];
2507
- if (n instanceof M || n instanceof U) {
3047
+ if (n instanceof P || n instanceof q) {
2508
3048
  let r;
2509
- if (n instanceof M) {
2510
- let e = hn.get(n.value);
3049
+ if (n instanceof P) {
3050
+ let e = Hn.get(n.value);
2511
3051
  if (e === void 0) throw Error(`cri: unrecognised scheme-id ${n.value}`);
2512
3052
  r = e + ":";
2513
3053
  } else r = n.value + ":";
2514
3054
  if (t >= e.length) return r;
2515
3055
  let i = e[t++], a = "", o = !1;
2516
- if (i instanceof R) a = "//" + Dn(i), o = !0;
2517
- else if (i instanceof B) if (i.value === 22) o = !0;
3056
+ if (i instanceof B) a = "//" + er(i), o = !0;
3057
+ else if (i instanceof H) if (i.value === 22) o = !0;
2518
3058
  else if (i.value === 21) o = !1;
2519
3059
  else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);
2520
3060
  else throw Error("cri: unexpected type for authority element");
2521
3061
  let s = "";
2522
- if (t < e.length && e[t] instanceof R) {
3062
+ if (t < e.length && e[t] instanceof B) {
2523
3063
  let n = e[t++];
2524
- n.items.length > 0 && (s = (o ? "/" : "") + jn(n).join("/"));
3064
+ n.items.length > 0 && (s = (o ? "/" : "") + ir(n).join("/"));
2525
3065
  }
2526
- return r + a + s + An(e, t);
3066
+ return r + a + s + rr(e, t);
2527
3067
  }
2528
- if (n instanceof B && n.value === 20) {
2529
- if (t >= e.length || !(e[t] instanceof R)) throw Error("cri: network-path reference requires an authority array");
2530
- let n = Dn(e[t++]), r = "";
2531
- if (t < e.length && e[t] instanceof R) {
3068
+ if (n instanceof H && n.value === 20) {
3069
+ if (t >= e.length || !(e[t] instanceof B)) throw Error("cri: network-path reference requires an authority array");
3070
+ let n = er(e[t++]), r = "";
3071
+ if (t < e.length && e[t] instanceof B) {
2532
3072
  let n = e[t++];
2533
- n.items.length > 0 && (r = "/" + jn(n).join("/"));
3073
+ n.items.length > 0 && (r = "/" + ir(n).join("/"));
2534
3074
  }
2535
- return "//" + n + r + An(e, t);
3075
+ return "//" + n + r + rr(e, t);
2536
3076
  }
2537
- if (n instanceof B && n.value === 21) {
3077
+ if (n instanceof H && n.value === 21) {
2538
3078
  let n = "/";
2539
- if (t < e.length && e[t] instanceof R) {
3079
+ if (t < e.length && e[t] instanceof B) {
2540
3080
  let r = e[t++];
2541
- n = "/" + jn(r).join("/");
3081
+ n = "/" + ir(r).join("/");
2542
3082
  }
2543
- return n + An(e, t);
3083
+ return n + rr(e, t);
2544
3084
  }
2545
- if (n instanceof j) {
3085
+ if (n instanceof N) {
2546
3086
  let r = n.value;
2547
- if (r === 0n) return An(e, t);
3087
+ if (r === 0n) return rr(e, t);
2548
3088
  let i = r === 1n ? "" : "../".repeat(Number(r) - 1), a;
2549
- if (t < e.length && e[t] instanceof R) {
3089
+ if (t < e.length && e[t] instanceof B) {
2550
3090
  let n = e[t++];
2551
3091
  if (n.items.length > 0) {
2552
- let e = jn(n);
3092
+ let e = ir(n);
2553
3093
  a = (r === 1n && e[0].includes(":") ? "./" : i) + e.join("/");
2554
3094
  } else a = i === "" ? "./" : i;
2555
3095
  } else a = i === "" ? "./" : i;
2556
- return a + An(e, t);
3096
+ return a + rr(e, t);
2557
3097
  }
2558
3098
  throw Error("cri: unrecognised first element type in CRI array");
2559
3099
  }
2560
- var Nn = class extends R {
3100
+ var or = class extends B {
2561
3101
  _toCDN(e, t) {
2562
3102
  if (e?.appStrings === !1) return super._toCDN(e, t);
2563
3103
  try {
2564
- let t = w(e, this.encodingWidth, () => C(BigInt(this.items.length)));
2565
- return `${dn}'${Mn(this.items)}'${t}`;
3104
+ let t = T(e, this.encodingWidth, () => w(BigInt(this.items.length)));
3105
+ return `${Rn}'${ar(this.items)}'${t}`;
2566
3106
  } catch {
2567
3107
  return super._toCDN(e, t);
2568
3108
  }
2569
3109
  }
2570
- }, Pn = class extends P {
3110
+ }, sr = class extends I {
2571
3111
  constructor(e) {
2572
- super(pn, e);
3112
+ super(Bn, e);
2573
3113
  }
2574
3114
  _toCDN(e, t) {
2575
3115
  if (e?.appStrings === !1) return super._toCDN(e, t);
2576
3116
  try {
2577
3117
  let n = this.content;
2578
3118
  if (n.encodingWidth !== void 0) return super._toCDN(e, t);
2579
- let r = w(e, this.encodingWidth, () => C(pn));
2580
- return `${fn}'${Mn(n.items)}'${r}`;
3119
+ let r = T(e, this.encodingWidth, () => w(Bn));
3120
+ return `${zn}'${ar(n.items)}'${r}`;
2581
3121
  } catch {
2582
3122
  return super._toCDN(e, t);
2583
3123
  }
2584
3124
  }
2585
3125
  };
2586
- function Fn(e) {
3126
+ function cr(e) {
2587
3127
  if (e.length !== 1) throw SyntaxError("cri<<...>>: expected exactly one item");
2588
3128
  let t = e[0];
2589
- if (t instanceof U) return t.value;
2590
- if (t instanceof F) return _n.decode(t.value);
3129
+ if (t instanceof q) return t.value;
3130
+ if (t instanceof L) return Wn.decode(t.value);
2591
3131
  throw SyntaxError("cri<<...>>: expected a text string or byte string");
2592
3132
  }
2593
- function In(e, t) {
2594
- let n = new Nn(kn(t));
2595
- return e === fn ? new Pn(n) : n;
3133
+ function lr(e, t) {
3134
+ let n = new or(nr(t));
3135
+ return e === zn ? new sr(n) : n;
2596
3136
  }
2597
- var Ln = {
2598
- appStringPrefixes: [dn, fn],
2599
- tagNumbers: [pn],
3137
+ var ur = {
3138
+ appStringPrefixes: [Rn, zn],
3139
+ tagNumbers: [Bn],
2600
3140
  parseAppString(e, t) {
2601
- return In(e, t);
3141
+ return lr(e, t);
2602
3142
  },
2603
3143
  parseAppSequence(e, t) {
2604
- return In(e, Fn(t));
3144
+ return lr(e, cr(t));
2605
3145
  },
2606
3146
  parseTag(e, t) {
2607
- if (e !== 99n || !(t instanceof R)) return;
2608
- let n = new Nn(t.items, {
3147
+ if (e !== 99n || !(t instanceof B)) return;
3148
+ let n = new or(t.items, {
2609
3149
  indefiniteLength: t.indefiniteLength,
2610
3150
  encodingWidth: t.encodingWidth
2611
3151
  });
2612
- return n.start = t.start, n.end = t.end, new Pn(n);
3152
+ return n.start = t.start, n.end = t.end, new sr(n);
2613
3153
  }
2614
- }, Rn = 18446744073709551615n, zn = -18446744073709551616n, Bn = {
2615
- tagNumbers: [qe, Je],
3154
+ }, dr = 18446744073709551615n, fr = -18446744073709551616n, pr = {
3155
+ tagNumbers: [dt, ft],
2616
3156
  parseTag(e, t) {
2617
- if (t instanceof F) {
3157
+ if (t instanceof L) {
2618
3158
  if (e === 2n) {
2619
- let e = Qe(t.value);
2620
- return e > Rn ? new $e(e) : void 0;
3159
+ let e = gt(t.value);
3160
+ return e > dr ? new _t(e) : void 0;
2621
3161
  }
2622
3162
  if (e === 3n) {
2623
- let e = -1n - Qe(t.value);
2624
- return e < zn ? new et(e) : void 0;
3163
+ let e = -1n - gt(t.value);
3164
+ return e < fr ? new vt(e) : void 0;
2625
3165
  }
2626
3166
  }
2627
3167
  }
2628
3168
  };
2629
3169
  //#endregion
2630
3170
  //#region src/cbor/decoder.ts
2631
- function Vn(e, t) {
3171
+ function mr(e, t) {
2632
3172
  if (e === 24 && t <= 23n) return 0;
2633
3173
  if (e === 25 && t <= 255n) return 1;
2634
3174
  if (e === 26 && t <= 65535n) return 2;
2635
3175
  if (e === 27 && t <= 4294967295n) return 3;
2636
3176
  }
2637
- function Hn(e, t) {
3177
+ function hr(e, t) {
2638
3178
  if (e === 24 && t <= 23) return 0;
2639
3179
  if (e === 25 && t <= 255) return 1;
2640
3180
  if (e === 26 && t <= 65535) return 2;
2641
3181
  if (e === 27 && t <= 4294967295) return 3;
2642
3182
  }
2643
- var Un = new TextDecoder("utf-8", {
3183
+ var gr = new TextDecoder("utf-8", {
2644
3184
  fatal: !0,
2645
3185
  ignoreBOM: !0
2646
- }), Wn = new TextDecoder("utf-8", {
3186
+ }), _r = new TextDecoder("utf-8", {
2647
3187
  fatal: !1,
2648
3188
  ignoreBOM: !0
2649
3189
  });
2650
- function J(e) {
3190
+ function X(e) {
2651
3191
  throw Error(`CBOR decode error: ${e}`);
2652
3192
  }
2653
- function Gn(e, t, n) {
3193
+ function vr(e, t, n) {
2654
3194
  let r = {
2655
3195
  message: e,
2656
3196
  offset: t
@@ -2658,191 +3198,191 @@ function Gn(e, t, n) {
2658
3198
  if (n?.onWarning ? n.onWarning(r) : n?.silent || console.warn(`CBOR strict violation at offset ${t}: ${e}`), n?.strict !== !1) throw Error(`CBOR decode error: ${e}`);
2659
3199
  return r;
2660
3200
  }
2661
- function Y(e, t) {
3201
+ function yr(e, t) {
2662
3202
  e.warnings ??= [], e.warnings.push(t);
2663
3203
  }
2664
- function Kn(e) {
2665
- if (e instanceof j) return ["u", String(e.value)];
2666
- if (e instanceof M) return ["n", String(e.value)];
2667
- if (e instanceof U) return ["t", e.value];
2668
- if (e instanceof L) return ["t", e.chunks.map((e) => e.value).join("")];
2669
- if (e instanceof F) return ["b", i(e.value)];
2670
- if (e instanceof I) {
3204
+ function br(e) {
3205
+ if (e instanceof N) return ["u", String(e.value)];
3206
+ if (e instanceof P) return ["n", String(e.value)];
3207
+ if (e instanceof q) return ["t", e.value];
3208
+ if (e instanceof z) return ["t", e.chunks.map((e) => e.value).join("")];
3209
+ if (e instanceof L) return ["b", i(e.value)];
3210
+ if (e instanceof R) {
2671
3211
  let t = "";
2672
3212
  for (let n of e.chunks) t += i(n.value);
2673
3213
  return ["b", t];
2674
3214
  }
2675
- if (e instanceof N) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
2676
- if (e instanceof B) return ["s", e.value];
2677
- if (e instanceof R) return ["A", e.items.map(Kn)];
2678
- if (e instanceof z) {
2679
- let t = e.entries.map(([e, t]) => [Kn(e), Kn(t)]);
3215
+ if (e instanceof F) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
3216
+ if (e instanceof H) return ["s", e.value];
3217
+ if (e instanceof B) return ["A", e.items.map(br)];
3218
+ if (e instanceof V) {
3219
+ let t = e.entries.map(([e, t]) => [br(e), br(t)]);
2680
3220
  if (t.length <= 1) return ["M", t];
2681
3221
  let n = t.map((e) => [JSON.stringify(e[0]), e]);
2682
3222
  return n.sort((e, t) => e[0] < t[0] ? -1 : +(e[0] > t[0])), ["M", n.map((e) => e[1])];
2683
3223
  }
2684
- return e instanceof P ? [
3224
+ return e instanceof I ? [
2685
3225
  "G",
2686
3226
  String(e.tag),
2687
- Kn(e.content)
3227
+ br(e.content)
2688
3228
  ] : ["c", i(e.toCBOR())];
2689
3229
  }
2690
- function qn(e) {
2691
- if (e instanceof j) return "u" + e.value;
2692
- if (e instanceof M) return "n" + e.value;
2693
- if (e instanceof U) return "t" + e.value;
2694
- if (e instanceof L) {
3230
+ function xr(e) {
3231
+ if (e instanceof N) return "u" + e.value;
3232
+ if (e instanceof P) return "n" + e.value;
3233
+ if (e instanceof q) return "t" + e.value;
3234
+ if (e instanceof z) {
2695
3235
  let t = "t";
2696
3236
  for (let n of e.chunks) t += n.value;
2697
3237
  return t;
2698
3238
  }
2699
- if (e instanceof F) return "b" + i(e.value);
2700
- if (e instanceof I) {
3239
+ if (e instanceof L) return "b" + i(e.value);
3240
+ if (e instanceof R) {
2701
3241
  let t = "b";
2702
3242
  for (let n of e.chunks) t += i(n.value);
2703
3243
  return t;
2704
3244
  }
2705
- return e instanceof N ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof B ? "s" + e.value : JSON.stringify(Kn(e));
3245
+ return e instanceof F ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof H ? "s" + e.value : JSON.stringify(br(e));
2706
3246
  }
2707
- var Jn = Array.from({ length: 24 }, (e, t) => BigInt(t)), Yn;
2708
- function Xn(e) {
2709
- return e === void 0 ? Yn ??= Z(void 0).filter((e) => e.parseTag !== void 0) : Z(e).filter((e) => e.parseTag !== void 0);
3247
+ var Sr = Array.from({ length: 24 }, (e, t) => BigInt(t)), Cr;
3248
+ function wr(e) {
3249
+ return e === void 0 ? Cr ??= gi(void 0).filter((e) => e.parseTag !== void 0) : gi(e).filter((e) => e.parseTag !== void 0);
2710
3250
  }
2711
- function Zn(e, t) {
3251
+ function Tr(e, t) {
2712
3252
  for (let n = 0; n < t; n++) if (e[n] >= 128) return;
2713
3253
  return String.fromCharCode.apply(null, e);
2714
3254
  }
2715
- function Qn(e, t, n) {
3255
+ function Er(e, t, n) {
2716
3256
  if (n <= 23) return {
2717
- value: Jn[n],
3257
+ value: Sr[n],
2718
3258
  nextOffset: t
2719
3259
  };
2720
3260
  switch (n) {
2721
- case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
3261
+ case 24: return t + 1 > e.byteLength && X("unexpected end of input"), {
2722
3262
  value: BigInt(e.getUint8(t)),
2723
3263
  nextOffset: t + 1
2724
3264
  };
2725
- case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
3265
+ case 25: return t + 2 > e.byteLength && X("unexpected end of input"), {
2726
3266
  value: BigInt(e.getUint16(t, !1)),
2727
3267
  nextOffset: t + 2
2728
3268
  };
2729
- case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
3269
+ case 26: return t + 4 > e.byteLength && X("unexpected end of input"), {
2730
3270
  value: BigInt(e.getUint32(t, !1)),
2731
3271
  nextOffset: t + 4
2732
3272
  };
2733
- case 27: return t + 8 > e.byteLength && J("unexpected end of input"), {
3273
+ case 27: return t + 8 > e.byteLength && X("unexpected end of input"), {
2734
3274
  value: e.getBigUint64(t, !1),
2735
3275
  nextOffset: t + 8
2736
3276
  };
2737
- default: J(`reserved additional info value: ${n}`);
3277
+ default: X(`reserved additional info value: ${n}`);
2738
3278
  }
2739
3279
  }
2740
- function $n(e, t, n) {
3280
+ function Dr(e, t, n) {
2741
3281
  if (n <= 23) return {
2742
3282
  value: n,
2743
3283
  nextOffset: t
2744
3284
  };
2745
3285
  switch (n) {
2746
- case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
3286
+ case 24: return t + 1 > e.byteLength && X("unexpected end of input"), {
2747
3287
  value: e.getUint8(t),
2748
3288
  nextOffset: t + 1
2749
3289
  };
2750
- case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
3290
+ case 25: return t + 2 > e.byteLength && X("unexpected end of input"), {
2751
3291
  value: e.getUint16(t, !1),
2752
3292
  nextOffset: t + 2
2753
3293
  };
2754
- case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
3294
+ case 26: return t + 4 > e.byteLength && X("unexpected end of input"), {
2755
3295
  value: e.getUint32(t, !1),
2756
3296
  nextOffset: t + 4
2757
3297
  };
2758
3298
  case 27: {
2759
- t + 8 > e.byteLength && J("unexpected end of input");
3299
+ t + 8 > e.byteLength && X("unexpected end of input");
2760
3300
  let n = e.getUint32(t, !1), r = e.getUint32(t + 4, !1);
2761
3301
  return {
2762
3302
  value: n * 4294967296 + r,
2763
3303
  nextOffset: t + 8
2764
3304
  };
2765
3305
  }
2766
- default: J(`reserved additional info value: ${n}`);
3306
+ default: X(`reserved additional info value: ${n}`);
2767
3307
  }
2768
3308
  }
2769
- function er(e, t, n, r, i, a) {
3309
+ function Or(e, t, n, r, i, a) {
2770
3310
  let o = [], s = t;
2771
3311
  for (;;) {
2772
- if (s >= e.byteLength && J(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
3312
+ if (s >= e.byteLength && X(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
2773
3313
  s++;
2774
3314
  break;
2775
3315
  }
2776
- let t = X(e, s, n, r);
2777
- a(t.value) || J(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
3316
+ let t = Z(e, s, n, r);
3317
+ a(t.value) || X(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
2778
3318
  }
2779
3319
  return {
2780
3320
  chunks: o,
2781
3321
  nextOffset: s
2782
3322
  };
2783
3323
  }
2784
- function tr(e, t, n, r) {
2785
- let i = qn(e);
2786
- t.has(i) && n.push(Gn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
3324
+ function kr(e, t, n, r) {
3325
+ let i = xr(e);
3326
+ t.has(i) && n.push(vr(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
2787
3327
  }
2788
- function X(e, t, n, r) {
2789
- let i = t, a = rr(e, t, n, r);
3328
+ function Z(e, t, n, r) {
3329
+ let i = t, a = jr(e, t, n, r);
2790
3330
  return a.value.start = i, a.value.end = a.nextOffset, a;
2791
3331
  }
2792
- function nr(e, t, n) {
3332
+ function Ar(e, t, n) {
2793
3333
  return new Uint8Array(e.buffer, e.byteOffset + t, n).slice();
2794
3334
  }
2795
- function rr(e, t, n, r) {
2796
- t >= e.byteLength && J("unexpected end of input");
3335
+ function jr(e, t, n, r) {
3336
+ t >= e.byteLength && X("unexpected end of input");
2797
3337
  let i = e.getUint8(t++), a = i >> 5, o = i & 31;
2798
3338
  switch (a) {
2799
3339
  case 0: {
2800
- let { value: n, nextOffset: r } = Qn(e, t, o);
3340
+ let { value: n, nextOffset: r } = Er(e, t, o);
2801
3341
  return {
2802
- value: new j(n, { encodingWidth: Vn(o, n) }),
3342
+ value: new N(n, { encodingWidth: mr(o, n) }),
2803
3343
  nextOffset: r
2804
3344
  };
2805
3345
  }
2806
3346
  case 1: {
2807
- let { value: n, nextOffset: r } = Qn(e, t, o), i = Vn(o, n);
3347
+ let { value: n, nextOffset: r } = Er(e, t, o), i = mr(o, n);
2808
3348
  return {
2809
- value: new M(-1n - n, { encodingWidth: i }),
3349
+ value: new P(-1n - n, { encodingWidth: i }),
2810
3350
  nextOffset: r
2811
3351
  };
2812
3352
  }
2813
3353
  case 2: {
2814
3354
  if (o === 31) {
2815
- let { chunks: i, nextOffset: a } = er(e, t, n, r, "byte string", (e) => e instanceof F);
3355
+ let { chunks: i, nextOffset: a } = Or(e, t, n, r, "byte string", (e) => e instanceof L);
2816
3356
  return {
2817
- value: new I(i),
3357
+ value: new R(i),
2818
3358
  nextOffset: a
2819
3359
  };
2820
3360
  }
2821
- let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i);
2822
- return a + i > e.byteLength && J("byte string extends beyond input"), {
2823
- value: new F(new Uint8Array(e.buffer, e.byteOffset + a, i).slice(), { encodingWidth: s }),
3361
+ let { value: i, nextOffset: a } = Dr(e, t, o), s = hr(o, i);
3362
+ return a + i > e.byteLength && X("byte string extends beyond input"), {
3363
+ value: new L(new Uint8Array(e.buffer, e.byteOffset + a, i).slice(), { encodingWidth: s }),
2824
3364
  nextOffset: a + i
2825
3365
  };
2826
3366
  }
2827
3367
  case 3: {
2828
3368
  if (o === 31) {
2829
- let { chunks: i, nextOffset: a } = er(e, t, n, r, "text string", (e) => e instanceof U);
3369
+ let { chunks: i, nextOffset: a } = Or(e, t, n, r, "text string", (e) => e instanceof q);
2830
3370
  return {
2831
- value: new L(i),
3371
+ value: new z(i),
2832
3372
  nextOffset: a
2833
3373
  };
2834
3374
  }
2835
- let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i);
2836
- a + i > e.byteLength && J("text string extends beyond input");
2837
- let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? Zn(c, i) : void 0;
3375
+ let { value: i, nextOffset: a } = Dr(e, t, o), s = hr(o, i);
3376
+ a + i > e.byteLength && X("text string extends beyond input");
3377
+ let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? Tr(c, i) : void 0;
2838
3378
  if (d !== void 0) l = d;
2839
3379
  else try {
2840
- l = Un.decode(c);
3380
+ l = gr.decode(c);
2841
3381
  } catch {
2842
- u = Gn("invalid UTF-8 sequence in text string", a, n), l = Wn.decode(c);
3382
+ u = vr("invalid UTF-8 sequence in text string", a, n), l = _r.decode(c);
2843
3383
  }
2844
- let f = new U(l, { encodingWidth: s });
2845
- return u && Y(f, u), {
3384
+ let f = new q(l, { encodingWidth: s });
3385
+ return u && yr(f, u), {
2846
3386
  value: f,
2847
3387
  nextOffset: a + i
2848
3388
  };
@@ -2851,25 +3391,25 @@ function rr(e, t, n, r) {
2851
3391
  if (o === 31) {
2852
3392
  let i = [], a = t;
2853
3393
  for (;;) {
2854
- if (a >= e.byteLength && J("unexpected end of indefinite array"), e.getUint8(a) === 255) {
3394
+ if (a >= e.byteLength && X("unexpected end of indefinite array"), e.getUint8(a) === 255) {
2855
3395
  a++;
2856
3396
  break;
2857
3397
  }
2858
- let t = X(e, a, n, r);
3398
+ let t = Z(e, a, n, r);
2859
3399
  i.push(t.value), a = t.nextOffset;
2860
3400
  }
2861
3401
  return {
2862
- value: new R(i, { indefiniteLength: !0 }),
3402
+ value: new B(i, { indefiniteLength: !0 }),
2863
3403
  nextOffset: a
2864
3404
  };
2865
3405
  }
2866
- let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i), c = [], l = a;
3406
+ let { value: i, nextOffset: a } = Dr(e, t, o), s = hr(o, i), c = [], l = a;
2867
3407
  for (let t = 0; t < i; t++) {
2868
- let t = X(e, l, n, r);
3408
+ let t = Z(e, l, n, r);
2869
3409
  c.push(t.value), l = t.nextOffset;
2870
3410
  }
2871
3411
  return {
2872
- value: new R(c, { encodingWidth: s }),
3412
+ value: new B(c, { encodingWidth: s }),
2873
3413
  nextOffset: l
2874
3414
  };
2875
3415
  }
@@ -2877,149 +3417,149 @@ function rr(e, t, n, r) {
2877
3417
  if (o === 31) {
2878
3418
  let i = [], a = /* @__PURE__ */ new Set(), o = [], s = t;
2879
3419
  for (;;) {
2880
- if (s >= e.byteLength && J("unexpected end of indefinite map"), e.getUint8(s) === 255) {
3420
+ if (s >= e.byteLength && X("unexpected end of indefinite map"), e.getUint8(s) === 255) {
2881
3421
  s++;
2882
3422
  break;
2883
3423
  }
2884
- let t = X(e, s, n, r);
2885
- tr(t.value, a, o, n), s = t.nextOffset;
2886
- let c = X(e, s, n, r);
3424
+ let t = Z(e, s, n, r);
3425
+ kr(t.value, a, o, n), s = t.nextOffset;
3426
+ let c = Z(e, s, n, r);
2887
3427
  s = c.nextOffset, i.push([t.value, c.value]);
2888
3428
  }
2889
- let c = new z(i, { indefiniteLength: !0 });
2890
- for (let e of o) Y(c, e);
3429
+ let c = new V(i, { indefiniteLength: !0 });
3430
+ for (let e of o) yr(c, e);
2891
3431
  return {
2892
3432
  value: c,
2893
3433
  nextOffset: s
2894
3434
  };
2895
3435
  }
2896
- let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
3436
+ let { value: i, nextOffset: a } = Dr(e, t, o), s = hr(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
2897
3437
  for (let t = 0; t < i; t++) {
2898
- let t = X(e, d, n, r);
2899
- tr(t.value, l, u, n), d = t.nextOffset;
2900
- let i = X(e, d, n, r);
3438
+ let t = Z(e, d, n, r);
3439
+ kr(t.value, l, u, n), d = t.nextOffset;
3440
+ let i = Z(e, d, n, r);
2901
3441
  d = i.nextOffset, c.push([t.value, i.value]);
2902
3442
  }
2903
- let f = new z(c, { encodingWidth: s });
2904
- for (let e of u) Y(f, e);
3443
+ let f = new V(c, { encodingWidth: s });
3444
+ for (let e of u) yr(f, e);
2905
3445
  return {
2906
3446
  value: f,
2907
3447
  nextOffset: d
2908
3448
  };
2909
3449
  }
2910
3450
  case 6: {
2911
- o === 31 && J("tags cannot use indefinite-length encoding");
2912
- let { value: i, nextOffset: a } = Qn(e, t, o), s = Vn(o, i), c = X(e, a, n, r);
3451
+ o === 31 && X("tags cannot use indefinite-length encoding");
3452
+ let { value: i, nextOffset: a } = Er(e, t, o), s = mr(o, i), c = Z(e, a, n, r);
2913
3453
  for (let e of r) {
2914
3454
  let t = e.parseTag(i, c.value, n);
2915
- if (t !== void 0) return t instanceof P && s !== void 0 && (t.encodingWidth = s), {
3455
+ if (t !== void 0) return t instanceof I && s !== void 0 && (t.encodingWidth = s), {
2916
3456
  value: t,
2917
3457
  nextOffset: c.nextOffset
2918
3458
  };
2919
3459
  }
2920
3460
  return {
2921
- value: new P(i, c.value, { encodingWidth: s }),
3461
+ value: new I(i, c.value, { encodingWidth: s }),
2922
3462
  nextOffset: c.nextOffset
2923
3463
  };
2924
3464
  }
2925
3465
  case 7:
2926
3466
  if (o <= 19) return {
2927
- value: new B(o),
3467
+ value: new H(o),
2928
3468
  nextOffset: t
2929
3469
  };
2930
3470
  if (o === 20) return {
2931
- value: new B(20),
3471
+ value: new H(20),
2932
3472
  nextOffset: t
2933
3473
  };
2934
3474
  if (o === 21) return {
2935
- value: new B(21),
3475
+ value: new H(21),
2936
3476
  nextOffset: t
2937
3477
  };
2938
3478
  if (o === 22) return {
2939
- value: new B(22),
3479
+ value: new H(22),
2940
3480
  nextOffset: t
2941
3481
  };
2942
3482
  if (o === 23) return {
2943
- value: new B(23),
3483
+ value: new H(23),
2944
3484
  nextOffset: t
2945
3485
  };
2946
3486
  if (o === 24) {
2947
- t + 1 > e.byteLength && J("unexpected end of input");
3487
+ t + 1 > e.byteLength && X("unexpected end of input");
2948
3488
  let r = e.getUint8(t);
2949
3489
  if (r < 32) {
2950
- let e = Gn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new B(r);
2951
- return Y(i, e), {
3490
+ let e = vr(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new H(r);
3491
+ return yr(i, e), {
2952
3492
  value: i,
2953
3493
  nextOffset: t + 1
2954
3494
  };
2955
3495
  }
2956
3496
  return {
2957
- value: new B(r),
3497
+ value: new H(r),
2958
3498
  nextOffset: t + 1
2959
3499
  };
2960
3500
  }
2961
3501
  if (o === 25) {
2962
- t + 2 > e.byteLength && J("unexpected end of input");
2963
- let n = E(e.getUint16(t, !1));
3502
+ t + 2 > e.byteLength && X("unexpected end of input");
3503
+ let n = O(e.getUint16(t, !1));
2964
3504
  return {
2965
- value: new N(n, {
3505
+ value: new F(n, {
2966
3506
  precision: "half",
2967
- rawBits: Number.isNaN(n) ? nr(e, t, 2) : void 0
3507
+ rawBits: Number.isNaN(n) ? Ar(e, t, 2) : void 0
2968
3508
  }),
2969
3509
  nextOffset: t + 2
2970
3510
  };
2971
3511
  }
2972
3512
  if (o === 26) {
2973
- t + 4 > e.byteLength && J("unexpected end of input");
3513
+ t + 4 > e.byteLength && X("unexpected end of input");
2974
3514
  let n = e.getFloat32(t, !1);
2975
3515
  return {
2976
- value: new N(n, {
3516
+ value: new F(n, {
2977
3517
  precision: "single",
2978
- rawBits: Number.isNaN(n) ? nr(e, t, 4) : void 0
3518
+ rawBits: Number.isNaN(n) ? Ar(e, t, 4) : void 0
2979
3519
  }),
2980
3520
  nextOffset: t + 4
2981
3521
  };
2982
3522
  }
2983
3523
  if (o === 27) {
2984
- t + 8 > e.byteLength && J("unexpected end of input");
3524
+ t + 8 > e.byteLength && X("unexpected end of input");
2985
3525
  let n = e.getFloat64(t, !1);
2986
3526
  return {
2987
- value: new N(n, {
3527
+ value: new F(n, {
2988
3528
  precision: "double",
2989
- rawBits: Number.isNaN(n) ? nr(e, t, 8) : void 0
3529
+ rawBits: Number.isNaN(n) ? Ar(e, t, 8) : void 0
2990
3530
  }),
2991
3531
  nextOffset: t + 8
2992
3532
  };
2993
3533
  }
2994
- return o < 31 && J(`reserved additional info value in major type 7: ${o}`), J("unexpected break code outside indefinite-length item");
3534
+ return o < 31 && X(`reserved additional info value in major type 7: ${o}`), X("unexpected break code outside indefinite-length item");
2995
3535
  }
2996
- return J(`unknown major type: ${a}`);
3536
+ return X(`unknown major type: ${a}`);
2997
3537
  }
2998
- function ir(e) {
3538
+ function Mr(e) {
2999
3539
  if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new Uint8Array(e);
3000
3540
  if (ArrayBuffer.isView(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
3001
3541
  throw TypeError("expected ArrayBufferView or ArrayBufferLike");
3002
3542
  }
3003
- function ar(e, t) {
3004
- let n = ir(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
3543
+ function Nr(e, t) {
3544
+ let n = Mr(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
3005
3545
  if (!Number.isInteger(i) || i < 0 || i > r.byteLength) throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);
3006
- let a = Xn(t?.builtinExtensions), o = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...a] : a, { value: s, nextOffset: c } = X(r, i, t, o);
3546
+ let a = wr(t?.builtinExtensions), o = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...a] : a, { value: s, nextOffset: c } = Z(r, i, t, o);
3007
3547
  if (!t?.allowTrailing && c !== r.byteLength) {
3008
- Y(s, Gn(`${r.byteLength - c} trailing byte(s) after end of CBOR item`, c, t));
3548
+ yr(s, vr(`${r.byteLength - c} trailing byte(s) after end of CBOR item`, c, t));
3009
3549
  let e = {
3010
3550
  strict: !1,
3011
3551
  silent: !0
3012
3552
  }, n = c;
3013
- for (; n < r.byteLength;) ({nextOffset: n} = X(r, n, e, o));
3553
+ for (; n < r.byteLength;) ({nextOffset: n} = Z(r, n, e, o));
3014
3554
  }
3015
3555
  return s;
3016
3556
  }
3017
3557
  //#endregion
3018
3558
  //#region src/extensions/cbordata.ts
3019
- var or = 24n, sr = {
3020
- tagNumbers: [or],
3559
+ var Pr = 24n, Fr = {
3560
+ tagNumbers: [Pr],
3021
3561
  parseTag(e, t, n) {
3022
- if (e !== 24n || !(t instanceof F)) return;
3562
+ if (e !== 24n || !(t instanceof L)) return;
3023
3563
  let r = (t.end ?? t.value.length) - t.value.length, i = n ? {
3024
3564
  extensions: n.extensions,
3025
3565
  builtinExtensions: n.builtinExtensions,
@@ -3031,7 +3571,7 @@ var or = 24n, sr = {
3031
3571
  silent: n.silent
3032
3572
  } : void 0;
3033
3573
  try {
3034
- return new P(or, new Ve([ar(t.value, i)], { encodingWidth: t.encodingWidth }));
3574
+ return new I(Pr, new U([Nr(t.value, i)], { encodingWidth: t.encodingWidth }));
3035
3575
  } catch (e) {
3036
3576
  if (i?.strict !== !1) throw e;
3037
3577
  let t = `tag 24 content is not valid CBOR: ${e instanceof Error ? e.message : String(e)}`, a = {
@@ -3045,194 +3585,156 @@ var or = 24n, sr = {
3045
3585
  };
3046
3586
  //#endregion
3047
3587
  //#region src/extensions/ellipsis.ts
3048
- function cr(e) {
3049
- return e instanceof V && !(e.content instanceof R);
3588
+ function Ir(e) {
3589
+ return e instanceof W && !(e.content instanceof B);
3050
3590
  }
3051
- function lr(e) {
3591
+ function Lr(e) {
3052
3592
  let t = !1, n = !1, r = !1, i;
3053
3593
  for (let a of e) {
3054
3594
  let e;
3055
- if (cr(a)) e = !0, r = !0;
3056
- else if (a instanceof U) e = !1, t = !0;
3057
- else if (a instanceof F) e = !1, n = !0;
3595
+ if (Ir(a)) e = !0, r = !0;
3596
+ else if (a instanceof q) e = !1, t = !0;
3597
+ else if (a instanceof L) e = !1, n = !0;
3058
3598
  else return !1;
3059
3599
  if (e === i) return !1;
3060
3600
  i = e;
3061
3601
  }
3062
3602
  return r && !(t && n);
3063
3603
  }
3064
- var ur = {
3065
- tagNumbers: [Ke],
3604
+ var Rr = {
3605
+ tagNumbers: [st],
3066
3606
  parseTag(e, t) {
3067
3607
  if (e === 888n) {
3068
- if (t instanceof B && t.value === 22) return new V();
3069
- if (t instanceof R && lr(t.items)) return new V(t.items);
3608
+ if (t instanceof H && t.value === 22) return new W();
3609
+ if (t instanceof B && Lr(t.items)) return new W(t.items);
3070
3610
  }
3071
3611
  }
3072
- }, dr = new TextEncoder(), fr = new TextDecoder("utf-8", { fatal: !0 }), pr = new TextDecoder("utf-8", { fatal: !1 }), mr = Symbol("ellipsis");
3073
- function hr(e) {
3612
+ }, zr = new TextEncoder(), Br = new TextDecoder("utf-8", { fatal: !0 }), Vr = new TextDecoder("utf-8", { fatal: !1 }), Hr = Symbol("ellipsis");
3613
+ function Ur(e) {
3074
3614
  let t = 0;
3075
3615
  for (let n of e) t += n.length;
3076
3616
  let n = new Uint8Array(t), r = 0;
3077
3617
  for (let t of e) n.set(t, r), r += t.length;
3078
3618
  return n;
3079
3619
  }
3080
- function gr(e, t, n) {
3081
- if (t instanceof Ge) {
3082
- gr(e, t.inner, n);
3620
+ function Wr(e, t, n) {
3621
+ if (t instanceof ot) {
3622
+ Wr(e, t.inner, n);
3083
3623
  return;
3084
3624
  }
3085
- if (t instanceof V) {
3086
- if (t.content instanceof R) for (let r of t.content.items) gr(e, r, n);
3087
- else n.push(mr);
3625
+ if (t instanceof W) {
3626
+ if (t.content instanceof B) for (let r of t.content.items) Wr(e, r, n);
3627
+ else n.push(Hr);
3088
3628
  return;
3089
3629
  }
3090
- if (t instanceof U) {
3091
- n.push(dr.encode(t.value));
3630
+ if (t instanceof q) {
3631
+ n.push(zr.encode(t.value));
3092
3632
  return;
3093
3633
  }
3094
- if (t instanceof F) {
3634
+ if (t instanceof L) {
3095
3635
  n.push(t.value);
3096
3636
  return;
3097
3637
  }
3098
- if (t instanceof L) {
3099
- n.push(dr.encode(t.chunks.map((e) => e.value).join("")));
3638
+ if (t instanceof z) {
3639
+ n.push(zr.encode(t.chunks.map((e) => e.value).join("")));
3100
3640
  return;
3101
3641
  }
3102
- if (t instanceof I) {
3103
- n.push(hr(t.chunks.map((e) => e.value)));
3642
+ if (t instanceof R) {
3643
+ n.push(Ur(t.chunks.map((e) => e.value)));
3104
3644
  return;
3105
3645
  }
3106
3646
  throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings or ellipses`);
3107
3647
  }
3108
- function _r(e, t) {
3648
+ function Gr(e, t) {
3109
3649
  try {
3110
- return fr.decode(e);
3650
+ return Br.decode(e);
3111
3651
  } catch {
3112
3652
  let n = "t1 concatenation result is not valid UTF-8";
3113
3653
  if (t) t(n);
3114
3654
  else throw SyntaxError(n);
3115
- return pr.decode(e);
3655
+ return Vr.decode(e);
3116
3656
  }
3117
3657
  }
3118
- function vr(e, t, n) {
3658
+ function Kr(e, t, n) {
3119
3659
  let r = [];
3120
- for (let n of t) gr(e, n, r);
3660
+ for (let n of t) Wr(e, n, r);
3121
3661
  let i = e === "t1", a = [], o = !1, s = [], c = () => {
3122
3662
  if (s.length === 0) return;
3123
- let e = hr(s);
3124
- s.length = 0, e.length !== 0 && a.push(i ? new U(_r(e, n)) : new F(e));
3663
+ let e = Ur(s);
3664
+ s.length = 0, e.length !== 0 && a.push(i ? new q(Gr(e, n)) : new L(e));
3125
3665
  };
3126
- for (let e of r) e === mr ? (c(), a[a.length - 1] instanceof V || (a.push(new V()), o = !0)) : s.push(e);
3666
+ for (let e of r) e === Hr ? (c(), a[a.length - 1] instanceof W || (a.push(new W()), o = !0)) : s.push(e);
3127
3667
  if (!o) {
3128
- let e = hr(s);
3129
- return i ? new U(_r(e, n)) : new F(e);
3668
+ let e = Ur(s);
3669
+ return i ? new q(Gr(e, n)) : new L(e);
3130
3670
  }
3131
- return c(), a.length === 1 ? new V() : new V(a);
3671
+ return c(), a.length === 1 ? new W() : new W(a);
3132
3672
  }
3133
- function yr(e) {
3673
+ function qr(e) {
3134
3674
  return {
3135
3675
  appStringPrefixes: [e],
3136
3676
  preserveAppSeqSource: !0,
3137
3677
  parseAppString(t, n, r) {
3138
- return vr(e, [new U(n)], r);
3678
+ return Kr(e, [new q(n)], r);
3139
3679
  },
3140
3680
  parseAppSequence(t, n, r) {
3141
- return vr(e, n, r);
3681
+ return Kr(e, n, r);
3142
3682
  }
3143
3683
  };
3144
3684
  }
3145
- var br = yr("t1"), xr = yr("b1"), Sr = new TextEncoder(), Cr = new TextDecoder("utf-8", { fatal: !0 }), wr = new TextDecoder("utf-8", { fatal: !1 });
3146
- function Tr(e) {
3685
+ var Jr = qr("t1"), Yr = qr("b1"), Xr = new TextEncoder(), Zr = new TextDecoder("utf-8", { fatal: !0 }), Qr = new TextDecoder("utf-8", { fatal: !1 });
3686
+ function $r(e) {
3147
3687
  let t = 0;
3148
3688
  for (let n of e) t += n.length;
3149
3689
  let n = new Uint8Array(t), r = 0;
3150
3690
  for (let t of e) n.set(t, r), r += t.length;
3151
3691
  return n;
3152
3692
  }
3153
- function Er(e, t, n) {
3693
+ function ei(e, t, n) {
3154
3694
  let r = e === "ilts", i = [], a = [];
3155
3695
  for (let o of t) {
3156
- if (o instanceof Ge && (o = o.inner), o instanceof V) throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);
3696
+ if (o instanceof ot && (o = o.inner), o instanceof W) throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);
3157
3697
  let t, s, c;
3158
- if (o instanceof U) t = o.value, c = o.encodingWidth;
3159
- else if (o instanceof F) s = o.value, c = o.encodingWidth;
3160
- else if (o instanceof L) t = o.chunks.map((e) => e.value).join("");
3161
- else if (o instanceof I) s = Tr(o.chunks.map((e) => e.value));
3698
+ if (o instanceof q) t = o.value, c = o.encodingWidth;
3699
+ else if (o instanceof L) s = o.value, c = o.encodingWidth;
3700
+ else if (o instanceof z) t = o.chunks.map((e) => e.value).join("");
3701
+ else if (o instanceof R) s = $r(o.chunks.map((e) => e.value));
3162
3702
  else throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings`);
3163
3703
  if (r) {
3164
3704
  let e;
3165
3705
  if (t !== void 0) e = t;
3166
3706
  else try {
3167
- e = Cr.decode(s);
3707
+ e = Zr.decode(s);
3168
3708
  } catch {
3169
3709
  let t = "ilts chunk is not valid UTF-8";
3170
3710
  if (n) n(t);
3171
3711
  else throw SyntaxError(t);
3172
- e = wr.decode(s);
3712
+ e = Qr.decode(s);
3173
3713
  }
3174
- a.push(new U(e, c === void 0 ? void 0 : { encodingWidth: c }));
3714
+ a.push(new q(e, c === void 0 ? void 0 : { encodingWidth: c }));
3175
3715
  } else {
3176
- let e = s ?? Sr.encode(t);
3177
- i.push(new F(e, c === void 0 ? void 0 : { encodingWidth: c }));
3716
+ let e = s ?? Xr.encode(t);
3717
+ i.push(new L(e, c === void 0 ? void 0 : { encodingWidth: c }));
3178
3718
  }
3179
3719
  }
3180
- return r ? new L(a) : new I(i);
3720
+ return r ? new z(a) : new R(i);
3181
3721
  }
3182
- function Dr(e) {
3722
+ function ti(e) {
3183
3723
  return {
3184
3724
  appStringPrefixes: [e],
3185
3725
  preserveAppSeqSource: !0,
3186
3726
  parseAppString(t, n, r) {
3187
- return new Ge(Er(e, [new U(n)], r), `${e}${ve(n)}`);
3727
+ return new ot(ei(e, [new q(n)], r), `${e}${xe(n)}`);
3188
3728
  },
3189
3729
  parseAppSequence(t, n, r) {
3190
- return Er(e, n, r);
3730
+ return ei(e, n, r);
3191
3731
  }
3192
3732
  };
3193
3733
  }
3194
- var Or = Dr("ilbs"), kr = Dr("ilts");
3195
- //#endregion
3196
- //#region src/utils/strip-comments.ts
3197
- function Ar(e) {
3198
- let t = "", n = 0;
3199
- for (; n < e.length;) {
3200
- let r = e[n];
3201
- if (r === " " || r === "\n" || r === "\r") {
3202
- n++;
3203
- continue;
3204
- }
3205
- if (r === "#") {
3206
- for (; n < e.length && e[n] !== "\n";) n++;
3207
- continue;
3208
- }
3209
- if (r === "/") {
3210
- let t = e[n + 1] ?? "";
3211
- if (t === "/") {
3212
- for (; n < e.length && e[n] !== "\n";) n++;
3213
- continue;
3214
- }
3215
- if (t === "*") {
3216
- for (n += 2; n < e.length && !(e[n] === "*" && (e[n + 1] ?? "") === "/");) n++;
3217
- if (n >= e.length) throw SyntaxError("unterminated block comment");
3218
- n += 2;
3219
- continue;
3220
- }
3221
- for (n++; n < e.length && e[n] !== "/";) n++;
3222
- if (n >= e.length) throw SyntaxError("unterminated block comment");
3223
- n++;
3224
- continue;
3225
- }
3226
- t += r, n++;
3227
- }
3228
- return t;
3229
- }
3230
- //#endregion
3231
- //#region src/extensions/float.ts
3232
- var jr = class extends N {
3734
+ var ni = ti("ilbs"), ri = ti("ilts"), ii = class extends F {
3233
3735
  _bits;
3234
3736
  constructor(e) {
3235
- super(E(e), { precision: "half" }), this._bits = e & 65535;
3737
+ super(O(e), { precision: "half" }), this._bits = e & 65535;
3236
3738
  }
3237
3739
  _toCBOR() {
3238
3740
  return new Uint8Array([
@@ -3241,7 +3743,7 @@ var jr = class extends N {
3241
3743
  this._bits & 255
3242
3744
  ]);
3243
3745
  }
3244
- }, Mr = class extends N {
3746
+ }, ai = class extends F {
3245
3747
  _raw;
3246
3748
  constructor(e) {
3247
3749
  super(new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), { precision: "single" }), this._raw = e.slice();
@@ -3250,7 +3752,7 @@ var jr = class extends N {
3250
3752
  let e = /* @__PURE__ */ new Uint8Array(5);
3251
3753
  return e[0] = 250, e.set(this._raw, 1), e;
3252
3754
  }
3253
- }, Nr = class extends N {
3755
+ }, oi = class extends F {
3254
3756
  _raw;
3255
3757
  constructor(e) {
3256
3758
  super(new DataView(e.buffer, e.byteOffset).getFloat64(0, !1), { precision: "double" }), this._raw = e.slice();
@@ -3260,13 +3762,13 @@ var jr = class extends N {
3260
3762
  return e[0] = 251, e.set(this._raw, 1), e;
3261
3763
  }
3262
3764
  };
3263
- function Pr(e) {
3264
- if (e.length === 2) return new jr(e[0] << 8 | e[1]);
3265
- if (e.length === 4) return new Mr(e);
3266
- if (e.length === 8) return new Nr(e);
3765
+ function si(e) {
3766
+ if (e.length === 2) return new ii(e[0] << 8 | e[1]);
3767
+ if (e.length === 4) return new ai(e);
3768
+ if (e.length === 8) return new oi(e);
3267
3769
  throw SyntaxError(`float'...' requires 4, 8, or 16 hex digits (2, 4, or 8 bytes); got ${e.length} bytes`);
3268
3770
  }
3269
- function Fr(e) {
3771
+ function ci(e) {
3270
3772
  let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i;
3271
3773
  if (n === 31) i = t << 31 | 2139095040 | r << 13;
3272
3774
  else if (n === 0 && r === 0) i = t << 31;
@@ -3278,7 +3780,7 @@ function Fr(e) {
3278
3780
  let a = /* @__PURE__ */ new Uint8Array(4);
3279
3781
  return new DataView(a.buffer).setUint32(0, i >>> 0, !1), a;
3280
3782
  }
3281
- function Ir(e) {
3783
+ function li(e) {
3282
3784
  let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i = /* @__PURE__ */ new Uint8Array(8), a = new DataView(i.buffer);
3283
3785
  if (n === 31) a.setUint32(0, (t << 31 | 2146435072 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
3284
3786
  else if (n === 0 && r === 0) a.setUint32(0, t << 31 >>> 0, !1), a.setUint32(4, 0, !1);
@@ -3289,7 +3791,7 @@ function Ir(e) {
3289
3791
  } else a.setUint32(0, (t << 31 | n + 1008 << 20 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
3290
3792
  return i;
3291
3793
  }
3292
- function Lr(e) {
3794
+ function ui(e) {
3293
3795
  let t = new DataView(e.buffer, e.byteOffset).getUint32(0, !1), n = t >>> 31 & 1, r = t >>> 23 & 255, i = t & 8388607, a = /* @__PURE__ */ new Uint8Array(8), o = new DataView(a.buffer);
3294
3796
  if (r === 255) o.setUint32(0, (n << 31 | 2146435072 | i >>> 3) >>> 0, !1), o.setUint32(4, (i & 7) << 29, !1);
3295
3797
  else if (r === 0 && i === 0) o.setUint32(0, n << 31 >>> 0, !1), o.setUint32(4, 0, !1);
@@ -3299,49 +3801,49 @@ function Lr(e) {
3299
3801
  }
3300
3802
  return a;
3301
3803
  }
3302
- function Rr(e, t, n) {
3804
+ function di(e, t, n) {
3303
3805
  let r = e.length === 2 ? 1 : e.length === 4 ? 2 : 3;
3304
3806
  if (r === 1) {
3305
3807
  let n = e[0] << 8 | e[1];
3306
- if (t === 2) return new Mr(Fr(n));
3307
- if (t === 3) return new Nr(Ir(n));
3808
+ if (t === 2) return new ai(ci(n));
3809
+ if (t === 3) return new oi(li(n));
3308
3810
  }
3309
3811
  if (r === 2) {
3310
- if (t === 3) return new Nr(Lr(e));
3812
+ if (t === 3) return new oi(ui(e));
3311
3813
  if (t === 1) {
3312
- let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), r = T(t);
3313
- return !Object.is(E(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new jr(r);
3814
+ let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), r = Ae(t);
3815
+ return !Object.is(O(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new ii(r);
3314
3816
  }
3315
3817
  }
3316
3818
  if (r === 3) {
3317
3819
  let r = new DataView(e.buffer, e.byteOffset).getFloat64(0, !1);
3318
3820
  if (t === 1) {
3319
- let e = T(r);
3320
- return !Object.is(E(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new jr(e);
3821
+ let e = Ae(r);
3822
+ return !Object.is(O(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new ii(e);
3321
3823
  }
3322
3824
  if (t === 2) {
3323
3825
  let e = Math.fround(r);
3324
3826
  !Object.is(e, r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float32 (_2)");
3325
3827
  let t = /* @__PURE__ */ new Uint8Array(4);
3326
- return new DataView(t.buffer).setFloat32(0, e, !1), new Mr(t);
3828
+ return new DataView(t.buffer).setFloat32(0, e, !1), new ai(t);
3327
3829
  }
3328
3830
  }
3329
- return Pr(e);
3831
+ return si(e);
3330
3832
  }
3331
- var zr = {
3833
+ var fi = {
3332
3834
  appStringPrefixes: ["float"],
3333
3835
  parseAppString(t, n, r, i) {
3334
- let a = Ar(n);
3836
+ let a = Xe(n);
3335
3837
  if (!/^[0-9a-fA-F]*$/.test(a)) throw SyntaxError("float'...' contains non-hex characters");
3336
3838
  if (a.length % 2 != 0) throw SyntaxError(`float'...' hex content has odd length (${a.length} digits)`);
3337
3839
  let o = e(a), s = i?.encodingWidth;
3338
- if (s === void 0) return Pr(o);
3840
+ if (s === void 0) return si(o);
3339
3841
  if (s !== 1 && s !== 2 && s !== 3) {
3340
3842
  let e = `float'...' encoding indicator _${s} is not valid; use _1, _2, or _3`;
3341
- if (r) return r(e), Pr(o);
3843
+ if (r) return r(e), si(o);
3342
3844
  throw SyntaxError(e);
3343
3845
  }
3344
- return s === (o.length === 2 ? 1 : o.length === 4 ? 2 : 3) ? Pr(o) : Rr(o, s, r ?? ((e) => {
3846
+ return s === (o.length === 2 ? 1 : o.length === 4 ? 2 : 3) ? si(o) : di(o, s, r ?? ((e) => {
3345
3847
  throw SyntaxError(e);
3346
3848
  }));
3347
3849
  },
@@ -3352,57 +3854,57 @@ var zr = {
3352
3854
  if (n) n(e);
3353
3855
  else throw SyntaxError(e);
3354
3856
  }
3355
- if (!(t[0] instanceof F)) throw SyntaxError("float<<...>> item must be a byte string");
3356
- return Pr(t[0].value);
3857
+ if (!(t[0] instanceof L)) throw SyntaxError("float<<...>> item must be a byte string");
3858
+ return si(t[0].value);
3357
3859
  }
3358
- }, Br = [
3359
- Bn,
3360
- sr,
3361
- ur
3362
- ], Vr = [
3363
- Wt,
3364
- un,
3860
+ }, pi = [
3861
+ pr,
3862
+ Fr,
3863
+ Rr
3864
+ ], mi = [
3865
+ _n,
3365
3866
  Ln,
3366
- br,
3367
- xr,
3368
- Or,
3369
- kr,
3370
- zr
3371
- ], Hr;
3372
- function Z(e) {
3373
- return e === void 0 ? Hr ??= [...Br, ...Vr] : e === !1 ? Br : [...Br, ...e];
3867
+ ur,
3868
+ Jr,
3869
+ Yr,
3870
+ ni,
3871
+ ri,
3872
+ fi
3873
+ ], hi;
3874
+ function gi(e) {
3875
+ return e === void 0 ? hi ??= [...pi, ...mi] : e === !1 ? pi : [...pi, ...e];
3374
3876
  }
3375
3877
  //#endregion
3376
3878
  //#region src/js/fromJS.ts
3377
- var Ur;
3378
- function Wr(e) {
3879
+ var _i;
3880
+ function vi(e) {
3379
3881
  if (e === void 0) {
3380
- if (Ur) return Ur;
3381
- let e = Z(void 0);
3382
- return Ur = {
3882
+ if (_i) return _i;
3883
+ let e = gi(void 0);
3884
+ return _i = {
3383
3885
  fromJS: e.filter((e) => e.fromJS !== void 0),
3384
3886
  parseTag: e.filter((e) => e.parseTag !== void 0)
3385
3887
  };
3386
3888
  }
3387
- let t = Z(e);
3889
+ let t = gi(e);
3388
3890
  return {
3389
3891
  fromJS: t.filter((e) => e.fromJS !== void 0),
3390
3892
  parseTag: t.filter((e) => e.parseTag !== void 0)
3391
3893
  };
3392
3894
  }
3393
- function Gr(e) {
3394
- let t = e?.extensions, n = Wr(e?.builtinExtensions);
3895
+ function yi(e) {
3896
+ let t = e?.extensions, n = vi(e?.builtinExtensions);
3395
3897
  return t?.length ? {
3396
3898
  fromJS: [...t.filter((e) => e.fromJS !== void 0), ...n.fromJS],
3397
3899
  parseTag: [...t.filter((e) => e.parseTag !== void 0), ...n.parseTag]
3398
3900
  } : n;
3399
3901
  }
3400
- function Kr(e, t) {
3902
+ function bi(e, t) {
3401
3903
  if (t?.replacer) {
3402
- let { replacer: n, ...r } = t, i = Jr(e, n, r.extensions, r.undefinedOmits, r.builtinExtensions);
3403
- return i === h ? B.UNDEFINED : Kr(i, Object.keys(r).length > 0 ? r : void 0);
3904
+ let { replacer: n, ...r } = t, i = Si(e, n, r.extensions, r.undefinedOmits, r.builtinExtensions);
3905
+ return i === h ? H.UNDEFINED : bi(i, Object.keys(r).length > 0 ? r : void 0);
3404
3906
  }
3405
- return Q(e, t, !0, Gr(t));
3907
+ return Q(e, t, !0, yi(t));
3406
3908
  }
3407
3909
  function Q(e, t, n, r) {
3408
3910
  for (let n of r.fromJS) {
@@ -3415,35 +3917,35 @@ function Q(e, t, n, r) {
3415
3917
  let t = e.parseTag(n, i);
3416
3918
  if (t !== void 0) return t;
3417
3919
  }
3418
- return new P(n, i);
3419
- }
3420
- if (e instanceof m.Null) return B.NULL;
3421
- if (e instanceof m.Undefined) return B.UNDEFINED;
3422
- if (e instanceof g) return new B(e.value);
3423
- if (e === null) return B.NULL;
3424
- if (e === void 0) return B.UNDEFINED;
3425
- if (e === !0) return B.TRUE;
3426
- if (e === !1) return B.FALSE;
3427
- if (typeof e == "bigint") return e > 18446744073709551615n ? new $e(e) : e < -18446744073709551616n ? new et(e) : e >= 0n ? new j(e) : new M(e);
3428
- if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new j(BigInt(e)) : new M(BigInt(e)) : new N(e);
3429
- if (typeof e == "string") return new U(e);
3920
+ return new I(n, i);
3921
+ }
3922
+ if (e instanceof m.Null) return H.NULL;
3923
+ if (e instanceof m.Undefined) return H.UNDEFINED;
3924
+ if (e instanceof g) return new H(e.value);
3925
+ if (e === null) return H.NULL;
3926
+ if (e === void 0) return H.UNDEFINED;
3927
+ if (e === !0) return H.TRUE;
3928
+ if (e === !1) return H.FALSE;
3929
+ if (typeof e == "bigint") return e > 18446744073709551615n ? new _t(e) : e < -18446744073709551616n ? new vt(e) : e >= 0n ? new N(e) : new P(e);
3930
+ if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new N(BigInt(e)) : new P(BigInt(e)) : new F(e);
3931
+ if (typeof e == "string") return new q(e);
3430
3932
  if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Q(e.valueOf(), t, !1, r);
3431
- if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new F(new Uint8Array(e));
3432
- if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new R(Array.from(e, (e) => new j(BigInt(e)))) : new F(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3433
- if (e instanceof $) return new z([...e].map(([e, n]) => [Q(e, t, !0, r), Q(n, t, !0, r)]));
3434
- if (Array.isArray(e)) return new R(e.map((e) => Q(e, t, !0, r)));
3933
+ if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new L(new Uint8Array(e));
3934
+ if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new B(Array.from(e, (e) => new N(BigInt(e)))) : new L(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3935
+ if (e instanceof $) return new V([...e].map(([e, n]) => [Q(e, t, !0, r), Q(n, t, !0, r)]));
3936
+ if (Array.isArray(e)) return new B(e.map((e) => Q(e, t, !0, r)));
3435
3937
  if (typeof e == "object") {
3436
3938
  let n = [];
3437
- for (let [i, a] of Object.entries(e)) n.push([new U(i), Q(a, t, !0, r)]);
3438
- return new z(n);
3939
+ for (let [i, a] of Object.entries(e)) n.push([new q(i), Q(a, t, !0, r)]);
3940
+ return new V(n);
3439
3941
  }
3440
3942
  throw TypeError(`fromJS: unsupported value type: ${typeof e}`);
3441
3943
  }
3442
- function qr(e) {
3944
+ function xi(e) {
3443
3945
  return ArrayBuffer.isView(e) || e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer || e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]" || e instanceof m.Null || e instanceof m.Undefined || e instanceof g;
3444
3946
  }
3445
- function Jr(e, t, n, r, i) {
3446
- let a = [...n ?? [], ...Z(i)].filter((e) => e.isJSType !== void 0);
3947
+ function Si(e, t, n, r, i) {
3948
+ let a = [...n ?? [], ...gi(i)].filter((e) => e.isJSType !== void 0);
3447
3949
  function o(e) {
3448
3950
  return e === h || r === !0 && e === void 0;
3449
3951
  }
@@ -3453,7 +3955,7 @@ function Jr(e, t, n, r, i) {
3453
3955
  if (typeof e != "object" || !e) return e;
3454
3956
  if (e instanceof $) return $.from(e, ([e, t]) => [e, r(t)]);
3455
3957
  if (Array.isArray(e)) return e.map(r);
3456
- if (m.symbol in e || qr(e) || a.some((t) => t.isJSType(e))) return e;
3958
+ if (m.symbol in e || xi(e) || a.some((t) => t.isJSType(e))) return e;
3457
3959
  let t = Object.getPrototypeOf(e);
3458
3960
  if (t === Object.prototype || t === null) {
3459
3961
  let t = e.toJSON;
@@ -3488,7 +3990,7 @@ function Jr(e, t, n, r, i) {
3488
3990
  let r = c(t, String(n), e);
3489
3991
  return o(r) ? null : r;
3490
3992
  });
3491
- if (qr(e) || a.some((t) => t.isJSType(e))) return e;
3993
+ if (xi(e) || a.some((t) => t.isJSType(e))) return e;
3492
3994
  let t = {};
3493
3995
  for (let n of Object.keys(e)) {
3494
3996
  let r = c(e[n], n, e);
@@ -3506,7 +4008,7 @@ var $ = class extends Array {
3506
4008
  toJSON() {
3507
4009
  let e = {};
3508
4010
  for (let [t, n] of this) {
3509
- let r = typeof t == "string" ? t : Kr(t).toCDN();
4011
+ let r = typeof t == "string" ? t : bi(t).toCDN();
3510
4012
  r === "__proto__" ? Object.defineProperty(e, r, {
3511
4013
  value: n,
3512
4014
  writable: !0,
@@ -3518,6 +4020,6 @@ var $ = class extends Array {
3518
4020
  }
3519
4021
  };
3520
4022
  //#endregion
3521
- export { P as A, s as B, Ve as C, L as D, R as E, A as F, c as H, k as I, g as L, Re as M, M as N, I as O, j as P, h as R, He as S, z as T, m as V, it as _, zr as a, V as b, kr as c, ar as d, Ln as f, U as g, Gt as h, Vr as i, N as j, F as k, xr as l, Wt as m, Jr as n, Ar as o, un as p, Kr as r, Or as s, $ as t, br as u, et as v, B as w, Ge as x, $e as y, o as z };
4023
+ export { L as A, o as B, nt as C, B as D, V as E, N as F, m as H, M as I, j as L, F as M, Ke as N, z as O, P, g as R, tt as S, H as T, c as U, s as V, vt as _, fi as a, ot as b, Yr as c, ur as d, Ln as f, St as g, q as h, mi as i, I as j, R as k, Jr as l, vn as m, Si as n, ni as o, _n as p, bi as r, ri as s, $ as t, Nr as u, _t as v, U as w, rt as x, W as y, h as z };
3522
4024
 
3523
- //# sourceMappingURL=mapEntries-Czxt-cmd.js.map
4025
+ //# sourceMappingURL=mapEntries-DxrDre2P.js.map