@cbortech/cbor 0.25.10 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "./tokenizer-DkLlZ1gc.js";
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./tokenizer-CeuixxXi.js";
2
2
  //#region src/tag.ts
3
3
  var o = Symbol.for("cbor.tag"), s = class {
4
4
  valueOf() {
@@ -96,23 +96,23 @@ var m = class {
96
96
  };
97
97
  //#endregion
98
98
  //#region src/cdn/serialize-utils.ts
99
- function _(e) {
99
+ function ee(e) {
100
100
  let t = e?.indent;
101
101
  return t === void 0 ? null : typeof t == "number" ? " ".repeat(t) : t;
102
102
  }
103
- function v(e, t) {
103
+ function _(e, t) {
104
104
  return e.repeat(t);
105
105
  }
106
- function ee(e, t, n) {
107
- return t === null ? e.join(" + ") : e.join(` +\n${v(t, n + 1)}`);
106
+ function te(e, t, n) {
107
+ return t === null ? e.join(" + ") : e.join(` +\n${_(t, n + 1)}`);
108
108
  }
109
- function te(e) {
109
+ function ne(e) {
110
110
  return !!(e.comments?.leading?.length || e.comments?.trailing?.length || e.comments?.dangling?.length);
111
111
  }
112
- function ne(e) {
112
+ function re(e) {
113
113
  return !!(e.comments?.trailing?.length || e.comments?.dangling?.length);
114
114
  }
115
- function y(e, t) {
115
+ function v(e, t) {
116
116
  if (!t) return e.text;
117
117
  let { marker: n, text: r } = e;
118
118
  if (t === "c-style") return n === "#" ? "//" + r.slice(1) : n === "/" ? "/*" + r.slice(1, -1) + "*/" : r;
@@ -123,17 +123,17 @@ function y(e, t) {
123
123
  }
124
124
  return r;
125
125
  }
126
- function re(e, t, n) {
127
- return (e.comments?.leading ?? []).map((e) => t + y(e, n));
126
+ function ie(e, t, n) {
127
+ return (e.comments?.leading ?? []).map((e) => t + v(e, n));
128
128
  }
129
- function b(e, t) {
129
+ function y(e, t) {
130
130
  let n = e.comments?.trailing ?? [];
131
- return n.length === 0 ? "" : " " + n.map((e) => y(e, t)).join(" ");
131
+ return n.length === 0 ? "" : " " + n.map((e) => v(e, t)).join(" ");
132
132
  }
133
- function ie(e, t, n) {
134
- return (e.comments?.dangling ?? []).map((e) => t + y(e, n));
133
+ function ae(e, t, n) {
134
+ return (e.comments?.dangling ?? []).map((e) => t + v(e, n));
135
135
  }
136
- function ae(e, t = !1) {
136
+ function oe(e, t = !1) {
137
137
  let n = e?.commas ?? "comma", r = n !== "none";
138
138
  return {
139
139
  inlineSep: r ? t ? "," : ", " : " ",
@@ -142,32 +142,32 @@ function ae(e, t = !1) {
142
142
  colSep: t ? ":" : ": "
143
143
  };
144
144
  }
145
- function oe(e) {
146
- 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 = s && (ne(e.node) || e.hasEntryComments());
145
+ function se(e) {
146
+ let { options: t, depth: n, openChar: r, closeChar: i, count: a } = e, o = ee(t), s = t?.preserveComments, c = typeof s == "string" ? s : void 0, l = s && (re(e.node) || e.hasEntryComments());
147
147
  o === null && l && (o = " ");
148
- let { inlineSep: u, multilineSep: d, trailSep: f, colSep: p } = ae(t, o === null), m = e.indefiniteLength ? "" : S(t, e.encodingWidth, () => x(BigInt(a))), h = m ? m + " " : "", g = e.indefiniteLength && (t?.encodingIndicators ?? "auto") !== "never";
148
+ let { inlineSep: u, multilineSep: d, trailSep: f, colSep: p } = oe(t, o === null), m = e.indefiniteLength ? "" : x(t, e.encodingWidth, () => b(BigInt(a))), h = m ? m + " " : "", g = e.indefiniteLength && (t?.encodingIndicators ?? "auto") !== "never";
149
149
  if (o === null || a === 0 && !l) {
150
150
  let t = "";
151
151
  for (let n = 0; n < a; n++) n > 0 && (t += u), t += e.renderEntry(n, p);
152
152
  return e.indefiniteLength ? g ? a === 0 ? `${r}_ ${i}` : `${r}_ ${t}${i}` : `${r}${t}${i}` : `${r}${h}${t}${i}`;
153
153
  }
154
- let ee = v(o, n + 1), te = v(o, n), y = e.indefiniteLength ? g ? `${r}_ ` : r : `${r}${h}`, b = [];
154
+ let te = _(o, n + 1), ne = _(o, n), v = e.indefiniteLength ? g ? `${r}_ ` : r : `${r}${h}`, y = [];
155
155
  for (let t = 0; t < a; t++) {
156
- s && b.push(...re(e.entryLeadingNode(t), ee, c));
156
+ s && y.push(...ie(e.entryLeadingNode(t), te, c));
157
157
  let n = t < a - 1 ? d : f;
158
- b.push(`${ee}${e.renderEntry(t, p)}${n}${s ? e.entryTrailing(t, c) : ""}`);
158
+ y.push(`${te}${e.renderEntry(t, p)}${n}${s ? e.entryTrailing(t, c) : ""}`);
159
159
  }
160
- return s && b.push(...ie(e.node, ee, c)), `${y}\n${b.join("\n")}\n${te}${i}`;
160
+ return s && y.push(...ae(e.node, te, c)), `${v}\n${y.join("\n")}\n${ne}${i}`;
161
161
  }
162
- var se = typeof (/* @__PURE__ */ new Uint8Array()).toBase64 == "function";
163
- function ce(e) {
164
- if (se) return e.toBase64({ omitPadding: !0 });
162
+ var ce = typeof (/* @__PURE__ */ new Uint8Array()).toBase64 == "function";
163
+ function le(e) {
164
+ if (ce) return e.toBase64({ omitPadding: !0 });
165
165
  let t = "";
166
166
  for (let n of e) t += String.fromCharCode(n);
167
167
  return btoa(t).replace(/=/g, "");
168
168
  }
169
- function le(e) {
170
- if (se) return e.toBase64({
169
+ function ue(e) {
170
+ if (ce) return e.toBase64({
171
171
  alphabet: "base64url",
172
172
  omitPadding: !0
173
173
  });
@@ -175,54 +175,54 @@ function le(e) {
175
175
  for (let n of e) t += String.fromCharCode(n);
176
176
  return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
177
177
  }
178
- var ue = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", de = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
179
- function fe(e, t) {
178
+ var de = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", fe = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
179
+ function pe(e, t) {
180
180
  let n = "", r = 0, i = 0;
181
181
  for (let a of e) for (r = r << 8 | a, i += 8; i >= 5;) i -= 5, n += t[r >> i & 31];
182
182
  return i > 0 && (n += t[r << 5 - i & 31]), n;
183
183
  }
184
- function pe(e) {
184
+ function me(e) {
185
185
  for (let t of e) {
186
186
  let e = t.codePointAt(0);
187
187
  if (e < 32 || e === 127) return !0;
188
188
  }
189
189
  return !1;
190
190
  }
191
- function me(e, t, n) {
191
+ function he(e, t, n) {
192
192
  if (n === "string") {
193
- let t = ge(e);
194
- if (t != null) return ye(t);
193
+ let t = _e(e);
194
+ if (t != null) return be(t);
195
195
  }
196
196
  if (n === "printable-string" || n === void 0) {
197
- let t = ge(e);
198
- if (t != null && !pe(t)) return ye(t);
197
+ let t = _e(e);
198
+ if (t != null && !me(t)) return be(t);
199
199
  }
200
200
  switch (t) {
201
- case "base64": return `b64'${ce(e)}'`;
202
- case "base64url": return `b64'${le(e)}'`;
203
- case "base32": return `b32'${fe(e, ue)}'`;
204
- case "base32hex": return `h32'${fe(e, de)}'`;
201
+ case "base64": return `b64'${le(e)}'`;
202
+ case "base64url": return `b64'${ue(e)}'`;
203
+ case "base32": return `b32'${pe(e, de)}'`;
204
+ case "base32hex": return `h32'${pe(e, fe)}'`;
205
205
  default: return `h'${i(e)}'`;
206
206
  }
207
207
  }
208
- var he = new TextDecoder("utf-8", { fatal: !0 });
209
- function ge(e) {
208
+ var ge = new TextDecoder("utf-8", { fatal: !0 });
209
+ function _e(e) {
210
210
  try {
211
- return he.decode(e);
211
+ return ge.decode(e);
212
212
  } catch {
213
213
  return null;
214
214
  }
215
215
  }
216
- function _e(e, t) {
216
+ function ve(e, t) {
217
217
  for (let n = 0; n < e.length; n++) {
218
218
  let r = e.charCodeAt(n);
219
219
  if (r === t || r === 92 || r < 32 || r === 127 || r >= 8192 && (r === 8232 || r === 8233 || r >= 8203 && r <= 8205 || r === 65279)) return !0;
220
220
  }
221
221
  return !1;
222
222
  }
223
- function ve(e, t) {
223
+ function ye(e, t) {
224
224
  let n = t.codePointAt(0);
225
- if (!_e(e, n)) return t + e + t;
225
+ if (!ve(e, n)) return t + e + t;
226
226
  let r = t;
227
227
  for (let i of e) {
228
228
  let e = i.codePointAt(0);
@@ -247,40 +247,40 @@ function ve(e, t) {
247
247
  }
248
248
  return r + t;
249
249
  }
250
- function ye(e) {
251
- return ve(e, "'");
252
- }
253
250
  function be(e) {
254
- return ve(e, "'");
251
+ return ye(e, "'");
255
252
  }
256
253
  function xe(e) {
257
- return ve(e, "\"");
254
+ return ye(e, "'");
258
255
  }
259
256
  function Se(e) {
257
+ return ye(e, "\"");
258
+ }
259
+ function Ce(e) {
260
260
  if (isNaN(e)) return "NaN";
261
261
  if (!isFinite(e)) return e > 0 ? "Infinity" : "-Infinity";
262
262
  if (Object.is(e, -0)) return "-0.0";
263
263
  let t = e.toString();
264
264
  return t.includes(".") || t.includes("e") ? t : t + ".0";
265
265
  }
266
- function Ce(e, t, n, r) {
266
+ function we(e, t, n, r) {
267
267
  if (r === "never") return "";
268
268
  let i = t ?? n;
269
269
  return r === "always" ? i === "half" ? "_1" : i === "single" ? "_2" : "_3" : t === void 0 || t === n ? "" : t === "half" ? "_1" : t === "single" ? "_2" : "_3";
270
270
  }
271
- function x(e) {
271
+ function b(e) {
272
272
  return e <= 23n ? "i" : e <= 255n ? 0 : e <= 65535n ? 1 : e <= 4294967295n ? 2 : 3;
273
273
  }
274
- function S(e, t, n) {
274
+ function x(e, t, n) {
275
275
  let r = e?.encodingIndicators ?? "auto";
276
276
  return r === "never" ? "" : r === "always" ? `_${t ?? n()}` : t === void 0 ? "" : `_${t}`;
277
277
  }
278
278
  //#endregion
279
279
  //#region src/utils/float16.ts
280
- var we = "getFloat16" in DataView.prototype && "setFloat16" in DataView.prototype, Te = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
281
- function C(e) {
282
- Te.setFloat64(0, e, !1);
283
- let t = Te.getUint32(0, !1), n = Te.getUint32(4, !1), r = t >>> 31 & 1, i = t >>> 20 & 2047, a = t & 1048575;
280
+ var Te = "getFloat16" in DataView.prototype && "setFloat16" in DataView.prototype, Ee = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
281
+ function S(e) {
282
+ Ee.setFloat64(0, e, !1);
283
+ let t = Ee.getUint32(0, !1), n = Ee.getUint32(4, !1), r = t >>> 31 & 1, i = t >>> 20 & 2047, a = t & 1048575;
284
284
  if (i === 2047) {
285
285
  if (a === 0 && n === 0) return r << 15 | 31744;
286
286
  let e = a >> 10 | (n === 0 ? 0 : 1) || 1;
@@ -301,19 +301,19 @@ function C(e) {
301
301
  let u = o <= 0 ? 0 : o;
302
302
  return r << 15 | u << 10 | s;
303
303
  }
304
- function w(e) {
304
+ function C(e) {
305
305
  let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023;
306
306
  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);
307
307
  }
308
- var Ee = we ? (e, t, n, r) => {
308
+ var De = Te ? (e, t, n, r) => {
309
309
  e.setFloat16(t, n, r);
310
310
  } : (e, t, n, r) => {
311
- e.setUint16(t, C(n), r);
312
- }, T = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8)), E = new Uint8Array(T.buffer), De = new TextEncoder(), Oe = typeof De.encodeInto == "function";
313
- function ke(e) {
311
+ e.setUint16(t, S(n), r);
312
+ }, w = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8)), T = new Uint8Array(w.buffer), Oe = new TextEncoder(), ke = typeof Oe.encodeInto == "function";
313
+ function Ae(e) {
314
314
  return e <= 23 ? 1 : e <= 255 ? 2 : e <= 65535 ? 3 : e <= 4294967295 ? 5 : 9;
315
315
  }
316
- function Ae(e) {
316
+ function je(e) {
317
317
  return e === "i" ? 1 : [
318
318
  2,
319
319
  3,
@@ -321,7 +321,7 @@ function Ae(e) {
321
321
  9
322
322
  ][e];
323
323
  }
324
- var je = class {
324
+ var Me = class {
325
325
  buf;
326
326
  len = 0;
327
327
  constructor(e = 256) {
@@ -352,45 +352,45 @@ var je = class {
352
352
  t[this.len++] = e >>> 24 & 255, t[this.len++] = e >>> 16 & 255, t[this.len++] = e >>> 8 & 255, t[this.len++] = e & 255;
353
353
  }
354
354
  writeBigUint64(e) {
355
- T.setBigUint64(0, e, !1), this._ensure(8), this.buf.set(E, this.len), this.len += 8;
355
+ w.setBigUint64(0, e, !1), this._ensure(8), this.buf.set(T, this.len), this.len += 8;
356
356
  }
357
357
  writeFloat16(e) {
358
- Ee(T, 0, e, !1), this._ensure(2);
358
+ De(w, 0, e, !1), this._ensure(2);
359
359
  let t = this.buf;
360
- t[this.len++] = E[0], t[this.len++] = E[1];
360
+ t[this.len++] = T[0], t[this.len++] = T[1];
361
361
  }
362
362
  writeFloat32(e) {
363
- T.setFloat32(0, e, !1), this._ensure(4);
363
+ w.setFloat32(0, e, !1), this._ensure(4);
364
364
  let t = this.buf;
365
- t[this.len++] = E[0], t[this.len++] = E[1], t[this.len++] = E[2], t[this.len++] = E[3];
365
+ t[this.len++] = T[0], t[this.len++] = T[1], t[this.len++] = T[2], t[this.len++] = T[3];
366
366
  }
367
367
  writeFloat64(e) {
368
- T.setFloat64(0, e, !1), this._ensure(8), this.buf.set(E, this.len), this.len += 8;
368
+ w.setFloat64(0, e, !1), this._ensure(8), this.buf.set(T, this.len), this.len += 8;
369
369
  }
370
370
  writeTextString(e, t, n) {
371
- if (!Oe) {
372
- let r = De.encode(t);
373
- D(this, e, r.length, n), this.writeBytes(r);
371
+ if (!ke) {
372
+ let r = Oe.encode(t);
373
+ E(this, e, r.length, n), this.writeBytes(r);
374
374
  return;
375
375
  }
376
- let r = n === void 0 ? ke(t.length) : Ae(n);
376
+ let r = n === void 0 ? Ae(t.length) : je(n);
377
377
  this._ensure(9 + 3 * t.length);
378
- let { written: i } = De.encodeInto(t, this.buf.subarray(this.len + r)), a = n === void 0 ? ke(i) : r;
379
- a !== r && this.buf.copyWithin(this.len + a, this.len + r, this.len + r + i), D(this, e, i, n), this.len += i;
378
+ let { written: i } = Oe.encodeInto(t, this.buf.subarray(this.len + r)), a = n === void 0 ? Ae(i) : r;
379
+ a !== r && this.buf.copyWithin(this.len + a, this.len + r, this.len + r + i), E(this, e, i, n), this.len += i;
380
380
  }
381
381
  finish() {
382
382
  return this.buf.slice(0, this.len);
383
383
  }
384
- }, Me = [
384
+ }, Ne = [
385
385
  255n,
386
386
  65535n,
387
387
  4294967295n,
388
388
  18446744073709551615n
389
389
  ];
390
- function Ne(e) {
391
- return e === "i" ? 23n : Me[e];
390
+ function Pe(e) {
391
+ return e === "i" ? 23n : Ne[e];
392
392
  }
393
- function D(e, t, n, r) {
393
+ function E(e, t, n, r) {
394
394
  if (r === void 0 && typeof n == "number" && n < 4294967296) {
395
395
  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));
396
396
  return;
@@ -402,30 +402,30 @@ function D(e, t, n, r) {
402
402
  e.writeByte(t << 5 | Number(i));
403
403
  return;
404
404
  }
405
- if (i > Me[r]) throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${Me[r]})`);
405
+ if (i > Ne[r]) throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${Ne[r]})`);
406
406
  let n = 24 + r;
407
407
  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);
408
408
  return;
409
409
  }
410
410
  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));
411
411
  }
412
- function Pe(e, t, n) {
413
- let r = new je(9);
414
- return D(r, e, t, n), r.finish();
415
- }
416
- var Fe = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
417
- function Ie(e) {
418
- return Object.is(w(C(e)), e);
412
+ function Fe(e, t, n) {
413
+ let r = new Me(9);
414
+ return E(r, e, t, n), r.finish();
419
415
  }
416
+ var Ie = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
420
417
  function Le(e) {
421
- return Fe.setFloat32(0, e, !1), Object.is(Fe.getFloat32(0, !1), e);
418
+ return Object.is(C(S(e)), e);
419
+ }
420
+ function Re(e) {
421
+ return Ie.setFloat32(0, e, !1), Object.is(Ie.getFloat32(0, !1), e);
422
422
  }
423
- function O(e) {
424
- return Ie(e) ? "half" : Le(e) ? "single" : "double";
423
+ function D(e) {
424
+ return Le(e) ? "half" : Re(e) ? "single" : "double";
425
425
  }
426
426
  //#endregion
427
427
  //#region src/ast/CborItem.ts
428
- var k = class e {
428
+ var O = class e {
429
429
  start;
430
430
  end;
431
431
  comments;
@@ -435,7 +435,7 @@ var k = class e {
435
435
  let t = this._defaults ? {
436
436
  ...this._defaults,
437
437
  ...e
438
- } : e, n = new je();
438
+ } : e, n = new Me();
439
439
  return this._encode(n, t), n.finish();
440
440
  }
441
441
  toCDN(e) {
@@ -444,7 +444,7 @@ var k = class e {
444
444
  ...e
445
445
  } : e, n = this._toCDN(t, 0), r = t?.preserveComments;
446
446
  if (!r) return n;
447
- let i = typeof r == "string" ? r : void 0, a = this.comments?.leading?.map((e) => y(e, i)) ?? [], o = this.comments?.trailing ?? [], s = o.length === 0 ? n : `${n} ${o.map((e) => y(e, i).trimEnd()).join(" ")}`;
447
+ let i = typeof r == "string" ? r : void 0, a = this.comments?.leading?.map((e) => v(e, i)) ?? [], o = this.comments?.trailing ?? [], s = o.length === 0 ? n : `${n} ${o.map((e) => v(e, i).trimEnd()).join(" ")}`;
448
448
  return [...a, s].join("\n");
449
449
  }
450
450
  toEDN(e) {
@@ -483,7 +483,7 @@ var k = class e {
483
483
  t.writeBytes(this._toCBOR(n));
484
484
  }
485
485
  _toCBOR(e) {
486
- let t = new je();
486
+ let t = new Me();
487
487
  return this._encodeTo(t, e), t.finish();
488
488
  }
489
489
  _toHexDump(e, n) {
@@ -493,7 +493,7 @@ var k = class e {
493
493
  comment: this._toCDN(n, 0)
494
494
  }];
495
495
  }
496
- }, A = class extends k {
496
+ }, k = class extends O {
497
497
  value;
498
498
  encodingWidth;
499
499
  constructor(e, t) {
@@ -502,10 +502,10 @@ var k = class e {
502
502
  this.encodingWidth = t?.encodingWidth;
503
503
  }
504
504
  _encodeTo(e, t) {
505
- D(e, 0, this.value, this.encodingWidth);
505
+ E(e, 0, this.value, this.encodingWidth);
506
506
  }
507
507
  _toCDN(e, t) {
508
- let n = S(e, this.encodingWidth, () => x(this.value)), r = this.value;
508
+ let n = x(e, this.encodingWidth, () => b(this.value)), r = this.value;
509
509
  switch (e?.intFormat) {
510
510
  case "hex": return `0x${r.toString(16)}${n}`;
511
511
  case "octal": return `0o${r.toString(8)}${n}`;
@@ -517,7 +517,7 @@ var k = class e {
517
517
  let t = e?.integerAs ?? "auto";
518
518
  return t === "bigint" ? this.value : t === "number" || this.value <= BigInt(2 ** 53 - 1) ? Number(this.value) : this.value;
519
519
  }
520
- }, j = class extends k {
520
+ }, A = class extends O {
521
521
  argument;
522
522
  encodingWidth;
523
523
  constructor(e, t) {
@@ -531,10 +531,10 @@ var k = class e {
531
531
  return -1n - this.argument;
532
532
  }
533
533
  _encodeTo(e, t) {
534
- D(e, 1, this.argument, this.encodingWidth);
534
+ E(e, 1, this.argument, this.encodingWidth);
535
535
  }
536
536
  _toCDN(e, t) {
537
- let n = S(e, this.encodingWidth, () => x(this.argument)), r = this.argument + 1n;
537
+ let n = x(e, this.encodingWidth, () => b(this.argument)), r = this.argument + 1n;
538
538
  switch (e?.intFormat) {
539
539
  case "hex": return `-0x${r.toString(16)}${n}`;
540
540
  case "octal": return `-0o${r.toString(8)}${n}`;
@@ -546,8 +546,8 @@ var k = class e {
546
546
  let t = this.value, n = e?.integerAs ?? "auto";
547
547
  return n === "bigint" ? t : n === "number" || t >= BigInt(-(2 ** 53 - 1)) ? Number(t) : t;
548
548
  }
549
- }, Re = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
550
- function ze(e) {
549
+ }, ze = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
550
+ function Be(e) {
551
551
  let t = e.startsWith("-"), n = e.slice(t ? 3 : 2), r = n.search(/[pP]/);
552
552
  if (r === -1) throw SyntaxError(`EDN parse error: hex float missing 'p' exponent: ${e}`);
553
553
  let i = n.slice(0, r), a = n.slice(r + 1);
@@ -565,20 +565,20 @@ function ze(e) {
565
565
  let l = c * 2 ** o;
566
566
  return t ? -l : l;
567
567
  }
568
- function Be(e) {
568
+ function Ve(e) {
569
569
  if (isNaN(e)) return "NaN";
570
570
  if (!isFinite(e)) return e > 0 ? "Infinity" : "-Infinity";
571
571
  let t = Object.is(e, -0) || e < 0, n = Math.abs(e);
572
572
  if (n === 0) return t ? "-0x0p+0" : "0x0p+0";
573
- Re.setFloat64(0, n, !1);
574
- let r = Re.getUint32(0, !1), i = Re.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;
573
+ ze.setFloat64(0, n, !1);
574
+ let r = ze.getUint32(0, !1), i = ze.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;
575
575
  a === 0 ? (u = "0", d = -1022) : (u = "1", d = a - 1023);
576
576
  let f = d >= 0 ? `+${d}` : `${d}`, p = `0x${u}${l}p${f}`;
577
577
  return t ? `-${p}` : p;
578
578
  }
579
579
  //#endregion
580
580
  //#region src/ast/CborFloat.ts
581
- var M = class extends k {
581
+ var j = class extends O {
582
582
  value;
583
583
  precision;
584
584
  ednSource;
@@ -587,7 +587,7 @@ var M = class extends k {
587
587
  super(), this.value = e, this.precision = t?.precision, this.rawBits = t?.rawBits;
588
588
  }
589
589
  _encodeTo(e, t) {
590
- let n = this.precision ?? O(this.value), r = Number.isNaN(this.value) ? this.rawBits : void 0;
590
+ let n = this.precision ?? D(this.value), r = Number.isNaN(this.value) ? this.rawBits : void 0;
591
591
  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));
592
592
  }
593
593
  _toCDN(e, t) {
@@ -596,18 +596,18 @@ var M = class extends k {
596
596
  if (n === "never") return this.ednSource.replace(/_[0-3i]$/, "");
597
597
  if (n === "always") {
598
598
  if (/_[0-3i]$/.test(this.ednSource)) return this.ednSource;
599
- let e = this.precision ?? O(this.value), t = e === "half" ? "_1" : e === "single" ? "_2" : "_3";
599
+ let e = this.precision ?? D(this.value), t = e === "half" ? "_1" : e === "single" ? "_2" : "_3";
600
600
  return this.ednSource + t;
601
601
  }
602
602
  return this.ednSource;
603
603
  }
604
- let r = O(this.value);
605
- return (e?.floatFormat === "hex" ? Be(this.value) : Se(this.value)) + Ce(this.value, this.precision, r, n);
604
+ let r = D(this.value);
605
+ return (e?.floatFormat === "hex" ? Ve(this.value) : Ce(this.value)) + we(this.value, this.precision, r, n);
606
606
  }
607
607
  _toJS(e) {
608
608
  return this.value;
609
609
  }
610
- }, N = class extends k {
610
+ }, M = class extends O {
611
611
  tag;
612
612
  content;
613
613
  encodingWidth;
@@ -616,16 +616,16 @@ var M = class extends k {
616
616
  this.content = t, this.encodingWidth = n?.encodingWidth;
617
617
  }
618
618
  _encodeTo(e, t) {
619
- D(e, 6, this.tag, this.encodingWidth), this.content._encode(e, t);
619
+ E(e, 6, this.tag, this.encodingWidth), this.content._encode(e, t);
620
620
  }
621
621
  _toCDN(e, t) {
622
- let n = S(e, this.encodingWidth, () => x(this.tag));
622
+ let n = x(e, this.encodingWidth, () => b(this.tag));
623
623
  return `${this.tag}${n}(${this.content._toCDN(e, t)})`;
624
624
  }
625
625
  _toHexDump(e, n) {
626
626
  let r = [{
627
627
  depth: e,
628
- hex: t(Pe(6, this.tag, this.encodingWidth)),
628
+ hex: t(Fe(6, this.tag, this.encodingWidth)),
629
629
  comment: `Tag ${this.tag}`
630
630
  }];
631
631
  return r.push(...this.content._toHexDump(e + 1, {
@@ -637,7 +637,7 @@ var M = class extends k {
637
637
  let t = this.content._toJS(e);
638
638
  return e?.stripTags ? t : m.set(t, this.tag);
639
639
  }
640
- }, P = class extends k {
640
+ }, N = class extends O {
641
641
  indefiniteLength = !1;
642
642
  value;
643
643
  ednEncoding;
@@ -648,27 +648,27 @@ var M = class extends k {
648
648
  super(), this.value = e, this.ednEncoding = t?.ednEncoding ?? "hex", this.encodingWidth = t?.encodingWidth, this.ednSource = t?.ednSource, this.ednParts = t?.ednParts;
649
649
  }
650
650
  _encodeTo(e, t) {
651
- D(e, 2, this.value.length, this.encodingWidth), e.writeBytes(this.value);
651
+ E(e, 2, this.value.length, this.encodingWidth), e.writeBytes(this.value);
652
652
  }
653
653
  _toCDN(e, t) {
654
654
  if (e?.preserveConcatenation && this.ednParts !== void 0 && this.ednParts.length > 1) {
655
- let n = S(e, this.encodingWidth, () => x(BigInt(this.value.length))), r = e?.bstrEncoding ?? this.ednEncoding;
655
+ let n = x(e, this.encodingWidth, () => b(BigInt(this.value.length))), r = e?.bstrEncoding ?? this.ednEncoding;
656
656
  e?.appStrings === !1 && r !== "hex" && (r = "hex");
657
- let i = this.ednParts.map((t) => e?.preserveByteString && t.source !== void 0 ? t.source : me(t.bytes, r, e?.sqstr));
658
- return i[i.length - 1] += n, ee(i, _(e), t);
657
+ let i = this.ednParts.map((t) => e?.preserveByteString && t.source !== void 0 ? t.source : he(t.bytes, r, e?.sqstr));
658
+ return i[i.length - 1] += n, te(i, ee(e), t);
659
659
  }
660
660
  if (e?.preserveByteString && this.ednSource !== void 0) {
661
661
  if (/_[0-3i]$/.test(this.ednSource)) return (e?.encodingIndicators ?? "auto") === "never" ? this.ednSource.replace(/_[0-3i]$/, "") : this.ednSource;
662
- let t = S(e, this.encodingWidth, () => x(BigInt(this.value.length)));
662
+ let t = x(e, this.encodingWidth, () => b(BigInt(this.value.length)));
663
663
  return this.ednSource + t;
664
664
  }
665
- let n = S(e, this.encodingWidth, () => x(BigInt(this.value.length))), r = e?.bstrEncoding ?? this.ednEncoding;
666
- return e?.appStrings === !1 && r !== "hex" && (r = "hex"), me(this.value, r, e?.sqstr) + n;
665
+ let n = x(e, this.encodingWidth, () => b(BigInt(this.value.length))), r = e?.bstrEncoding ?? this.ednEncoding;
666
+ return e?.appStrings === !1 && r !== "hex" && (r = "hex"), he(this.value, r, e?.sqstr) + n;
667
667
  }
668
668
  _toJS(e) {
669
669
  return this.value;
670
670
  }
671
- }, F = class extends k {
671
+ }, P = class extends O {
672
672
  indefiniteLength = !0;
673
673
  chunks;
674
674
  constructor(e) {
@@ -683,7 +683,7 @@ var M = class extends k {
683
683
  if ((e?.encodingIndicators ?? "auto") === "never") {
684
684
  let t = this.chunks.reduce((e, t) => e + t.value.length, 0), n = new Uint8Array(t), r = 0;
685
685
  for (let e of this.chunks) n.set(e.value, r), r += e.value.length;
686
- return new P(n)._toCDN(e, 0);
686
+ return new N(n)._toCDN(e, 0);
687
687
  }
688
688
  return this.chunks.length === 0 ? "''_" : `(_ ${this.chunks.map((t) => t._toCDN(e, 0)).join(", ")})`;
689
689
  }
@@ -705,7 +705,7 @@ var M = class extends k {
705
705
  for (let e of this.chunks) n.set(e.value, r), r += e.value.length;
706
706
  return n;
707
707
  }
708
- }, I = class extends k {
708
+ }, F = class extends O {
709
709
  indefiniteLength = !0;
710
710
  chunks;
711
711
  constructor(e) {
@@ -717,7 +717,7 @@ var M = class extends k {
717
717
  e.writeByte(255);
718
718
  }
719
719
  _toCDN(e, t) {
720
- return (e?.encodingIndicators ?? "auto") === "never" ? new V(this.chunks.map((e) => e.value).join(""))._toCDN(e, t) : this.chunks.length === 0 ? "\"\"_" : `(_ ${this.chunks.map((t) => t._toCDN(e, 0)).join(", ")})`;
720
+ return (e?.encodingIndicators ?? "auto") === "never" ? new B(this.chunks.map((e) => e.value).join(""))._toCDN(e, t) : this.chunks.length === 0 ? "\"\"_" : `(_ ${this.chunks.map((t) => t._toCDN(e, 0)).join(", ")})`;
721
721
  }
722
722
  _toHexDump(e, t) {
723
723
  let r = [{
@@ -735,7 +735,7 @@ var M = class extends k {
735
735
  _toJS(e) {
736
736
  return this.chunks.map((e) => e.value).join("");
737
737
  }
738
- }, L = class extends k {
738
+ }, I = class extends O {
739
739
  items;
740
740
  indefiniteLength;
741
741
  encodingWidth;
@@ -749,11 +749,11 @@ var M = class extends k {
749
749
  e.writeByte(255);
750
750
  return;
751
751
  }
752
- D(e, 4, this.items.length, this.encodingWidth);
752
+ E(e, 4, this.items.length, this.encodingWidth);
753
753
  for (let n of this.items) n._encode(e, t);
754
754
  }
755
755
  _toCDN(e, t) {
756
- return oe({
756
+ return se({
757
757
  node: this,
758
758
  options: e,
759
759
  depth: t,
@@ -762,10 +762,10 @@ var M = class extends k {
762
762
  count: this.items.length,
763
763
  indefiniteLength: this.indefiniteLength,
764
764
  encodingWidth: this.encodingWidth,
765
- hasEntryComments: () => this.items.some(te),
765
+ hasEntryComments: () => this.items.some(ne),
766
766
  renderEntry: (n) => this.items[n]._toCDN(e, t + 1),
767
767
  entryLeadingNode: (e) => this.items[e],
768
- entryTrailing: (e, t) => b(this.items[e], t)
768
+ entryTrailing: (e, t) => y(this.items[e], t)
769
769
  });
770
770
  }
771
771
  _toHexDump(e, r) {
@@ -784,7 +784,7 @@ var M = class extends k {
784
784
  }
785
785
  let i = [{
786
786
  depth: e,
787
- hex: t(Pe(4, BigInt(this.items.length), this.encodingWidth)),
787
+ hex: t(Fe(4, BigInt(this.items.length), this.encodingWidth)),
788
788
  comment: `Array of length ${this.items.length}`
789
789
  }];
790
790
  for (let t of this.items) i.push(...t._toHexDump(e + 1, r));
@@ -803,7 +803,7 @@ var M = class extends k {
803
803
  }
804
804
  return r;
805
805
  }
806
- }, R = class extends k {
806
+ }, L = class extends O {
807
807
  entries;
808
808
  indefiniteLength;
809
809
  encodingWidth;
@@ -817,11 +817,11 @@ var M = class extends k {
817
817
  e.writeByte(255);
818
818
  return;
819
819
  }
820
- D(e, 5, this.entries.length, this.encodingWidth);
820
+ E(e, 5, this.entries.length, this.encodingWidth);
821
821
  for (let [n, r] of this.entries) n._encode(e, t), r._encode(e, t);
822
822
  }
823
823
  _toCDN(e, t) {
824
- return oe({
824
+ return se({
825
825
  node: this,
826
826
  options: e,
827
827
  depth: t,
@@ -830,7 +830,7 @@ var M = class extends k {
830
830
  count: this.entries.length,
831
831
  indefiniteLength: this.indefiniteLength,
832
832
  encodingWidth: this.encodingWidth,
833
- hasEntryComments: () => this.entries.some(([e, t]) => te(e) || te(t)),
833
+ hasEntryComments: () => this.entries.some(([e, t]) => ne(e) || ne(t)),
834
834
  renderEntry: (n, r) => {
835
835
  let [i, a] = this.entries[n];
836
836
  return `${i._toCDN(e, t + 1)}${r}${a._toCDN(e, t + 1)}`;
@@ -838,7 +838,7 @@ var M = class extends k {
838
838
  entryLeadingNode: (e) => this.entries[e][0],
839
839
  entryTrailing: (e, t) => {
840
840
  let [n, r] = this.entries[e];
841
- return Ve([
841
+ return He([
842
842
  ...n.comments?.trailing ?? [],
843
843
  ...r.comments?.leading ?? [],
844
844
  ...r.comments?.trailing ?? []
@@ -862,7 +862,7 @@ var M = class extends k {
862
862
  }
863
863
  let i = [{
864
864
  depth: e,
865
- hex: t(Pe(5, BigInt(this.entries.length), this.encodingWidth)),
865
+ hex: t(Fe(5, BigInt(this.entries.length), this.encodingWidth)),
866
866
  comment: `Map of length ${this.entries.length}`
867
867
  }];
868
868
  for (let [t, n] of this.entries) i.push(...t._toHexDump(e + 1, r)), i.push(...n._toHexDump(e + 1, r));
@@ -879,13 +879,13 @@ var M = class extends k {
879
879
  }
880
880
  return n;
881
881
  };
882
- return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof V) ? (() => {
882
+ return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof B) ? (() => {
883
883
  let n = e ? {
884
884
  ...e,
885
885
  reviver: void 0
886
886
  } : void 0, r = {};
887
887
  for (let [e, t] of this.entries) {
888
- let i = e instanceof V ? e.value : e.toCDN(), a = t._toJS(n);
888
+ let i = e instanceof B ? e.value : e.toCDN(), a = t._toJS(n);
889
889
  i === "__proto__" ? Object.defineProperty(r, i, {
890
890
  value: a,
891
891
  writable: !0,
@@ -897,10 +897,10 @@ var M = class extends k {
897
897
  let i = /* @__PURE__ */ new Map();
898
898
  for (let e = 0; e < this.entries.length; e++) {
899
899
  let [t] = this.entries[e];
900
- i.set(t instanceof V ? t.value : t.toCDN(), e);
900
+ i.set(t instanceof B ? t.value : t.toCDN(), e);
901
901
  }
902
902
  for (let n = 0; n < this.entries.length; n++) {
903
- let [a, o] = this.entries[n], s = a instanceof V ? a.value : a.toCDN();
903
+ let [a, o] = this.entries[n], s = a instanceof B ? a.value : a.toCDN();
904
904
  if (i.get(s) !== n) continue;
905
905
  let c = o._toJS(e), l = t.call(r, s, c);
906
906
  l === h || e?.undefinedOmits && l === void 0 ? delete r[s] : s === "__proto__" ? Object.defineProperty(r, s, {
@@ -914,12 +914,12 @@ var M = class extends k {
914
914
  })() : n();
915
915
  }
916
916
  };
917
- function Ve(e, t) {
918
- return e.length === 0 ? "" : " " + e.map((e) => y(e, t).trimEnd()).join(" ");
917
+ function He(e, t) {
918
+ return e.length === 0 ? "" : " " + e.map((e) => v(e, t).trimEnd()).join(" ");
919
919
  }
920
920
  //#endregion
921
921
  //#region src/ast/CborSimple.ts
922
- var z = class e extends k {
922
+ var R = class e extends O {
923
923
  value;
924
924
  constructor(e) {
925
925
  if (super(), !Number.isInteger(e) || e < 0 || e > 255) throw RangeError("CborSimple value must be an integer in 0–255");
@@ -954,33 +954,33 @@ var z = class e extends k {
954
954
  default: return new g(this.value);
955
955
  }
956
956
  }
957
- }, He = class extends k {
957
+ }, Ue = class extends O {
958
958
  items;
959
959
  encodingWidth;
960
960
  constructor(e, t) {
961
961
  super(), this.items = e, this.encodingWidth = t?.encodingWidth;
962
962
  }
963
963
  _content(e) {
964
- let t = new je();
964
+ let t = new Me();
965
965
  for (let n of this.items) n._encode(t, e);
966
966
  return t.finish();
967
967
  }
968
968
  _encodeTo(e, t) {
969
969
  let n = this._content(t);
970
- D(e, 2, n.length, this.encodingWidth), e.writeBytes(n);
970
+ E(e, 2, n.length, this.encodingWidth), e.writeBytes(n);
971
971
  }
972
972
  _toCDN(e, t) {
973
- let n = S(e, this.encodingWidth, () => x(BigInt(this._content(e).length)));
973
+ let n = x(e, this.encodingWidth, () => b(BigInt(this._content(e).length)));
974
974
  if (this.items.length === 0) return `<<>>${n}`;
975
- let r = _(e), { inlineSep: i, multilineSep: a, trailSep: o } = ae(e, r === null);
975
+ let r = ee(e), { inlineSep: i, multilineSep: a, trailSep: o } = oe(e, r === null);
976
976
  if (r === null) return `<<${this.items.map((n) => n._toCDN(e, t + 1)).join(i)}>>${n}`;
977
- 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;
977
+ let s = _(r, t + 1), c = _(r, t), l = this.items.map((n) => `${s}${n._toCDN(e, t + 1)}`), u = l.length - 1;
978
978
  return `<<\n${l.map((e, t) => t < u ? `${e}${a}` : `${e}${o}`).join("\n")}\n${c}>>${n}`;
979
979
  }
980
980
  _toHexDump(e, n) {
981
981
  let r = this._content().length, i = [{
982
982
  depth: e,
983
- hex: t(Pe(2, BigInt(r), this.encodingWidth)),
983
+ hex: t(Fe(2, BigInt(r), this.encodingWidth)),
984
984
  comment: `Embedded CBOR sequence, ${r} byte${r === 1 ? "" : "s"}`
985
985
  }];
986
986
  for (let t of this.items) i.push(...t._toHexDump(e + 1, n));
@@ -989,17 +989,17 @@ var z = class e extends k {
989
989
  _toJS(e) {
990
990
  return this._content();
991
991
  }
992
- }, Ue = 999n, We = class extends N {
992
+ }, We = 999n, Ge = class extends M {
993
993
  constructor(e, t) {
994
- let n = t.length === 1 && t[0] instanceof V ? t[0] : new L(t);
995
- super(Ue, new L([new V(e), n]));
994
+ let n = t.length === 1 && t[0] instanceof B ? t[0] : new I(t);
995
+ super(We, new I([new B(e), n]));
996
996
  }
997
997
  _toCDN(e, t) {
998
998
  if (e?.appStrings === !1) return super._toCDN(e, t);
999
999
  let n = this.content, r = n.items[0].value, i = n.items[1];
1000
- return i instanceof V ? `${r}${be(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1000
+ return i instanceof B ? `${r}${xe(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
1001
1001
  }
1002
- }, Ge = class extends k {
1002
+ }, Ke = class extends O {
1003
1003
  inner;
1004
1004
  ednSource;
1005
1005
  constructor(e, t) {
@@ -1015,15 +1015,15 @@ var z = class e extends k {
1015
1015
  _toJS(e) {
1016
1016
  return this.inner._toJS(e);
1017
1017
  }
1018
- }, Ke = 888n, B = class extends N {
1018
+ }, qe = 888n, z = class extends M {
1019
1019
  constructor(e) {
1020
- e === void 0 ? super(Ke, z.NULL) : super(Ke, new L(e));
1020
+ e === void 0 ? super(qe, R.NULL) : super(qe, new I(e));
1021
1021
  }
1022
1022
  _toCDN(e, t) {
1023
- return this.content instanceof z ? "..." : this.content instanceof L ? this.content.items.map((n) => n._toCDN(e, t)).join(" + ") : super._toCDN(e, t);
1023
+ return this.content instanceof R ? "..." : this.content instanceof I ? this.content.items.map((n) => n._toCDN(e, t)).join(" + ") : super._toCDN(e, t);
1024
1024
  }
1025
- }, qe = 2n, Je = 3n, Ye = 18446744073709551615n, Xe = -18446744073709551616n;
1026
- function Ze(e) {
1025
+ }, Je = 2n, Ye = 3n, Xe = 18446744073709551615n, Ze = -18446744073709551616n;
1026
+ function Qe(e) {
1027
1027
  if (e < 0n) throw RangeError("bigintToBytes requires a non-negative value");
1028
1028
  if (e === 0n) return /* @__PURE__ */ new Uint8Array();
1029
1029
  let t = e.toString(16);
@@ -1032,16 +1032,16 @@ function Ze(e) {
1032
1032
  for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
1033
1033
  return n;
1034
1034
  }
1035
- function Qe(e) {
1035
+ function $e(e) {
1036
1036
  let t = 0n;
1037
1037
  for (let n of e) t = t << 8n | BigInt(n);
1038
1038
  return t;
1039
1039
  }
1040
- var $e = class extends N {
1040
+ var et = class extends M {
1041
1041
  bigValue;
1042
1042
  constructor(e) {
1043
- if (e <= Ye) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
1044
- super(qe, new P(Ze(e))), this.bigValue = e;
1043
+ if (e <= Xe) throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);
1044
+ super(Je, new N(Qe(e))), this.bigValue = e;
1045
1045
  }
1046
1046
  _toCDN(e, t) {
1047
1047
  return this.bigValue.toString();
@@ -1049,11 +1049,11 @@ var $e = class extends N {
1049
1049
  _toJS(e) {
1050
1050
  return this.bigValue;
1051
1051
  }
1052
- }, et = class extends N {
1052
+ }, tt = class extends M {
1053
1053
  bigValue;
1054
1054
  constructor(e) {
1055
- if (e >= Xe) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
1056
- super(Je, new P(Ze(-1n - e))), this.bigValue = e;
1055
+ if (e >= Ze) throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);
1056
+ super(Ye, new N(Qe(-1n - e))), this.bigValue = e;
1057
1057
  }
1058
1058
  _toCDN(e, t) {
1059
1059
  return this.bigValue.toString();
@@ -1061,25 +1061,25 @@ var $e = class extends N {
1061
1061
  _toJS(e) {
1062
1062
  return this.bigValue;
1063
1063
  }
1064
- }, tt = new TextEncoder(), nt = new TextDecoder("utf-8", { fatal: !0 }), rt = new TextDecoder("utf-8", { fatal: !1 });
1065
- function it(e, t) {
1064
+ }, nt = new TextEncoder(), rt = new TextDecoder("utf-8", { fatal: !0 }), it = new TextDecoder("utf-8", { fatal: !1 });
1065
+ function at(e, t) {
1066
1066
  let n = new a(e, {
1067
1067
  offset: t?.offset,
1068
1068
  skipRS: t?._skipRS
1069
- }), r = new gt(n, t ?? {}).parse();
1070
- return t?.preserveComments && lt(r, n.comments, e), r;
1069
+ }), r = new _t(n, t ?? {}).parse();
1070
+ return t?.preserveComments && ut(r, n.comments, e), r;
1071
1071
  }
1072
- function at(e) {
1072
+ function ot(e) {
1073
1073
  let t = e, n;
1074
1074
  return /[_][0-7i]$/.test(e) && (n = e[e.length - 1], t = e.slice(0, -2)), {
1075
1075
  numStr: t,
1076
1076
  rawSuffix: n
1077
1077
  };
1078
1078
  }
1079
- function ot(e) {
1079
+ function st(e) {
1080
1080
  return e.startsWith("-") ? -BigInt(e.slice(1)) : BigInt(e);
1081
1081
  }
1082
- function st(e, t) {
1082
+ function ct(e, t) {
1083
1083
  if (e.endsWith("_i") || e.endsWith("_0")) {
1084
1084
  let n = "_0 and _i encoding indicators are not valid for floating-point values";
1085
1085
  if (t) t(n), e = e.slice(0, -2);
@@ -1103,14 +1103,14 @@ function st(e, t) {
1103
1103
  };
1104
1104
  let n = e, r;
1105
1105
  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) ? {
1106
- value: ze(n),
1106
+ value: Be(n),
1107
1107
  precision: r
1108
1108
  } : {
1109
1109
  value: parseFloat(n),
1110
1110
  precision: r
1111
1111
  };
1112
1112
  }
1113
- function ct(e, t) {
1113
+ function lt(e, t) {
1114
1114
  let n = e.indexOf("="), r = n >= 0 ? e.slice(0, n) : e, i = n >= 0 ? e.slice(n) : "";
1115
1115
  if (/[^A-Za-z0-9+/\-_]/.test(r)) {
1116
1116
  let e = [...r].find((e) => !/[A-Za-z0-9+/\-_]/.test(e)) ?? "";
@@ -1147,9 +1147,9 @@ function ct(e, t) {
1147
1147
  for (let e = 0; e < c.length; e++) l[e] = c.charCodeAt(e);
1148
1148
  return l;
1149
1149
  }
1150
- function lt(e, t, n) {
1150
+ function ut(e, t, n) {
1151
1151
  if (t.length === 0) return;
1152
- let r = ut(e), i = ft(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;
1152
+ let r = dt(e), i = pt(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;
1153
1153
  for (let t of s) {
1154
1154
  let r = { ...t }, s = 0, u = o.length;
1155
1155
  for (; s < u;) {
@@ -1158,7 +1158,7 @@ function lt(e, t, n) {
1158
1158
  }
1159
1159
  let d = s > 0 ? o[s - 1] : void 0, f = d ? n.slice(d.end, t.start) : "";
1160
1160
  if (d && i(d.end) === t.line && !f.includes(":")) {
1161
- dt(d.node, "trailing", r);
1161
+ ft(d.node, "trailing", r);
1162
1162
  continue;
1163
1163
  }
1164
1164
  for (; l < a.length && a[l].start < t.start;) {
@@ -1174,38 +1174,38 @@ function lt(e, t, n) {
1174
1174
  }
1175
1175
  let m = s < a.length ? a[s] : void 0;
1176
1176
  if ((!p || m && m.end <= p.end) && m) {
1177
- dt(m.node, "leading", r);
1177
+ ft(m.node, "leading", r);
1178
1178
  continue;
1179
1179
  }
1180
- dt(p?.node ?? e, "dangling", r);
1180
+ ft(p?.node ?? e, "dangling", r);
1181
1181
  }
1182
1182
  }
1183
- function ut(e) {
1183
+ function dt(e) {
1184
1184
  let t = [], n = (e) => {
1185
1185
  if (e.start !== void 0 && e.end !== void 0 && t.push({
1186
1186
  node: e,
1187
1187
  start: e.start,
1188
1188
  end: e.end
1189
- }), e instanceof L || e instanceof He) {
1189
+ }), e instanceof I || e instanceof Ue) {
1190
1190
  for (let t of e.items) n(t);
1191
1191
  return;
1192
1192
  }
1193
- if (e instanceof R) {
1193
+ if (e instanceof L) {
1194
1194
  for (let [t, r] of e.entries) n(t), n(r);
1195
1195
  return;
1196
1196
  }
1197
- if (e instanceof F || e instanceof I) {
1197
+ if (e instanceof P || e instanceof F) {
1198
1198
  for (let t of e.chunks) n(t);
1199
1199
  return;
1200
1200
  }
1201
- e instanceof N && n(e.content);
1201
+ e instanceof M && n(e.content);
1202
1202
  };
1203
1203
  return n(e), t;
1204
1204
  }
1205
- function dt(e, t, n) {
1205
+ function ft(e, t, n) {
1206
1206
  e.comments ??= {}, e.comments[t] ??= [], e.comments[t].push(n);
1207
1207
  }
1208
- function ft(e) {
1208
+ function pt(e) {
1209
1209
  let t = [0];
1210
1210
  for (let n = 0; n < e.length; n++) e[n] === "\n" && t.push(n + 1);
1211
1211
  return (n) => {
@@ -1219,15 +1219,14 @@ function ft(e) {
1219
1219
  return a + 1;
1220
1220
  };
1221
1221
  }
1222
- var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, mt = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, ht = /* @__PURE__ */ new Map([
1223
- ["b32", pt("b32")],
1224
- ["h32", pt("h32")],
1225
- ["float", pt("float")],
1226
- ["same", pt("same")],
1227
- ["hash", mt("hash", "@cbortech/hash-extension")],
1228
- ["uuid", mt("uuid", "@cbortech/uuid-extension")],
1229
- ["UUID", mt("uuid", "@cbortech/uuid-extension")]
1230
- ]), gt = class {
1222
+ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, ht = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, gt = /* @__PURE__ */ new Map([
1223
+ ["b32", mt("b32")],
1224
+ ["h32", mt("h32")],
1225
+ ["same", mt("same")],
1226
+ ["hash", ht("hash", "@cbortech/hash-extension")],
1227
+ ["uuid", ht("uuid", "@cbortech/uuid-extension")],
1228
+ ["UUID", ht("uuid", "@cbortech/uuid-extension")]
1229
+ ]), _t = class {
1231
1230
  t;
1232
1231
  _options;
1233
1232
  extByPrefix;
@@ -1237,7 +1236,7 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1237
1236
  _hintedPrefixes = /* @__PURE__ */ new Set();
1238
1237
  constructor(e, t) {
1239
1238
  this.t = e, this._options = t, this.extByPrefix = /* @__PURE__ */ new Map(), this.extByTag = /* @__PURE__ */ new Map(), this.unresolvedExtension = t.unresolvedExtension ?? "cpa999";
1240
- for (let e of [...Z, ...t.extensions ?? []]) {
1239
+ for (let e of [...Fr, ...t.extensions ?? []]) {
1241
1240
  for (let t of e.appStringPrefixes ?? []) this.extByPrefix.set(t, e);
1242
1241
  for (let t of e.tagNumbers ?? []) this.extByTag.set(t, e);
1243
1242
  }
@@ -1287,12 +1286,12 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1287
1286
  case "BYTES_HEX":
1288
1287
  case "SQSTR":
1289
1288
  case "BYTES_B64": return this.t.consume(), this._parseBytesConcat(this._decodeBytesToken(e), e.type, e.raw);
1290
- case "EMPTY_INDEF_BYTES": return this.t.consume(), new F([]);
1291
- case "EMPTY_INDEF_TEXT": return this.t.consume(), new I([]);
1292
- case "TRUE": return this.t.consume(), new z(21);
1293
- case "FALSE": return this.t.consume(), new z(20);
1294
- case "NULL": return this.t.consume(), new z(22);
1295
- case "UNDEFINED": return this.t.consume(), new z(23);
1289
+ case "EMPTY_INDEF_BYTES": return this.t.consume(), new P([]);
1290
+ case "EMPTY_INDEF_TEXT": return this.t.consume(), new F([]);
1291
+ case "TRUE": return this.t.consume(), new R(21);
1292
+ case "FALSE": return this.t.consume(), new R(20);
1293
+ case "NULL": return this.t.consume(), new R(22);
1294
+ case "UNDEFINED": return this.t.consume(), new R(23);
1296
1295
  case "SIMPLE": return this.parseSimple();
1297
1296
  case "LBRACKET": return this.parseArray();
1298
1297
  case "LBRACE": return this.parseMap();
@@ -1307,21 +1306,21 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1307
1306
  }
1308
1307
  let r = this.extByPrefix.get(e.appPrefix);
1309
1308
  if (!r?.parseAppString) {
1310
- if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new We(e.appPrefix, [new V(e.value)]);
1309
+ if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ge(e.appPrefix, [new B(e.value)]);
1311
1310
  this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
1312
1311
  }
1313
1312
  {
1314
1313
  let i = this._pendingWarnings.length;
1315
1314
  try {
1316
1315
  let i = r.parseAppString(e.appPrefix, e.value, this._extOnError(e), t === void 0 ? void 0 : { encodingWidth: t });
1317
- return t !== void 0 && this._applyEiToResult(i, t, e), i instanceof P && Object.getPrototypeOf(i) === P.prototype && i.ednSource === void 0 ? new P(i.value, {
1316
+ return t !== void 0 && this._applyEiToResult(i, t, e), i instanceof N && Object.getPrototypeOf(i) === N.prototype && i.ednSource === void 0 ? new N(i.value, {
1318
1317
  ednEncoding: i.ednEncoding,
1319
1318
  encodingWidth: i.encodingWidth,
1320
1319
  ednSource: e.raw + n
1321
- }) : (i instanceof M && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
1320
+ }) : (i instanceof j && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
1322
1321
  } catch (t) {
1323
1322
  if (this._options.strict !== !1) throw t;
1324
- return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new We(e.appPrefix, [new V(e.value)]);
1323
+ return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new Ge(e.appPrefix, [new B(e.value)]);
1325
1324
  }
1326
1325
  }
1327
1326
  }
@@ -1339,7 +1338,7 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1339
1338
  this.t.peek().type === "ENCODING_INDICATOR" && (r = this.t.consume(), n = this._resolveEncodingWidth(r.value, r));
1340
1339
  let i = this.extByPrefix.get(e.appPrefix);
1341
1340
  if (!i) {
1342
- if (this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new We(e.appPrefix, t);
1341
+ if (this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ge(e.appPrefix, t);
1343
1342
  this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
1344
1343
  }
1345
1344
  i.parseAppSequence || this._fail(`app-string extension ${JSON.stringify(e.appPrefix)} does not support <<...>> form`, e);
@@ -1349,61 +1348,61 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1349
1348
  let a = i.parseAppSequence(e.appPrefix, t, this._extOnError(e));
1350
1349
  n !== void 0 && this._applyEiToResult(a, n, r ?? e);
1351
1350
  let o = this.t.source.slice(e.offset, this.t.lastEndOffset);
1352
- if (a instanceof M) a.ednSource === void 0 && (a.ednSource = o);
1353
- else if (i.preserveAppSeqSource) return new Ge(a, o);
1351
+ if (a instanceof j) a.ednSource === void 0 && (a.ednSource = o);
1352
+ else if (i.preserveAppSeqSource) return new Ke(a, o);
1354
1353
  return a;
1355
1354
  } catch (n) {
1356
1355
  if (this._options.strict !== !1) throw n;
1357
- return this._pendingWarnings.length === a && this._warn(n instanceof Error ? n.message : String(n), e), new We(e.appPrefix, t);
1356
+ return this._pendingWarnings.length === a && this._warn(n instanceof Error ? n.message : String(n), e), new Ge(e.appPrefix, t);
1358
1357
  }
1359
1358
  }
1360
1359
  }
1361
1360
  case "ELLIPSIS": {
1362
- if (this.t.consume(), this.t.peek().type !== "PLUS") return new B();
1363
- let e = [new B()];
1361
+ if (this.t.consume(), this.t.peek().type !== "PLUS") return new z();
1362
+ let e = [new z()];
1364
1363
  for (; this.t.peek().type === "PLUS";) this.t.consume(), e.push(this.parseValue());
1365
- return new B(e);
1364
+ return new z(e);
1366
1365
  }
1367
1366
  case "BYTES_HEX_ELIDED": return this.t.consume(), this._parseHexElidedConcat(e);
1368
1367
  default: this._fail(`unexpected token: ${JSON.stringify(e.value)}`, e);
1369
1368
  }
1370
1369
  }
1371
1370
  parseIntegerOrTag() {
1372
- 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);
1373
- if (i > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", e), new $e(i);
1374
- if (i < -18446744073709551616n) return new et(i);
1371
+ let e = this.t.consume(), { numStr: t, rawSuffix: n } = ot(e.value), r = n === void 0 ? this.consumeEncodingIndicator() : this._resolveEncodingWidth(n, e), i = st(t);
1372
+ if (i > 18446744073709551615n) return this.t.peek().type === "LPAREN" && this._fail("tag number exceeds maximum uint64", e), new et(i);
1373
+ if (i < -18446744073709551616n) return new tt(i);
1375
1374
  if (r !== void 0) {
1376
1375
  let t = i >= 0n ? i : -(i + 1n);
1377
1376
  r = this._validateEncodingFit(t, r, e);
1378
1377
  }
1379
- let a = i >= 0n ? new A(i, r === void 0 ? void 0 : { encodingWidth: r }) : new j(i, r === void 0 ? void 0 : { encodingWidth: r });
1378
+ let a = i >= 0n ? new k(i, r === void 0 ? void 0 : { encodingWidth: r }) : new A(i, r === void 0 ? void 0 : { encodingWidth: r });
1380
1379
  if (this.t.peek().type === "LPAREN") {
1381
- a instanceof A || this._fail("tag number must be non-negative", e), this.t.consume();
1380
+ a instanceof k || this._fail("tag number must be non-negative", e), this.t.consume();
1382
1381
  let t = this._pendingWarnings.splice(0), n = this.parseValue();
1383
1382
  this.expect("RPAREN");
1384
1383
  let i = a.value, o = this.extByTag.get(i);
1385
1384
  if (o?.parseTag) {
1386
1385
  let e = o.parseTag(i, n);
1387
- if (e !== void 0) return e instanceof N && r !== void 0 && e.encodingWidth === void 0 && (e.encodingWidth = r), t.length > 0 && (e.warnings ??= [], e.warnings.push(...t)), e;
1386
+ if (e !== void 0) return e instanceof M && r !== void 0 && e.encodingWidth === void 0 && (e.encodingWidth = r), t.length > 0 && (e.warnings ??= [], e.warnings.push(...t)), e;
1388
1387
  }
1389
- let s = new N(i, n, r === void 0 ? void 0 : { encodingWidth: r });
1388
+ let s = new M(i, n, r === void 0 ? void 0 : { encodingWidth: r });
1390
1389
  return t.length > 0 && (s.warnings ??= [], s.warnings.push(...t)), s;
1391
1390
  }
1392
1391
  return a;
1393
1392
  }
1394
1393
  parseFloat() {
1395
- let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = st(e.value, t);
1394
+ let e = this.t.consume(), t = (t) => this._warnOrFail(t, e), { value: n, precision: r } = ct(e.value, t);
1396
1395
  if (r === "half" || r === "single") {
1397
- let e = r === "half" ? w(C(n)) : Math.fround(n);
1396
+ let e = r === "half" ? C(S(n)) : Math.fround(n);
1398
1397
  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`);
1399
1398
  }
1400
- return new M(n, r === void 0 ? void 0 : { precision: r });
1399
+ return new j(n, r === void 0 ? void 0 : { precision: r });
1401
1400
  }
1402
1401
  parseString() {
1403
1402
  let e = this.t.consume();
1404
1403
  if (this.t.peek().type !== "PLUS") {
1405
- let t = this.consumeEncodingIndicator(() => BigInt(tt.encode(e.value).length));
1406
- return new V(e.value, t === void 0 ? void 0 : { encodingWidth: t });
1404
+ let t = this.consumeEncodingIndicator(() => BigInt(nt.encode(e.value).length));
1405
+ return new B(e.value, t === void 0 ? void 0 : { encodingWidth: t });
1407
1406
  }
1408
1407
  let t = !1, n = [{ text: e.value }];
1409
1408
  for (; this.t.peek().type === "PLUS";) {
@@ -1412,15 +1411,15 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1412
1411
  e.type === "ELLIPSIS" ? (this.t.consume(), n.push({ ellipsis: !0 }), t = !0) : e.type === "TSTR" || e.type === "RAWSTRING" ? (this.t.consume(), n.push({ 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);
1413
1412
  }
1414
1413
  if (!t) {
1415
- let e = n.map((e) => "text" in e ? e.text : ""), t = e.join(""), r = this.consumeEncodingIndicator(() => BigInt(tt.encode(t).length));
1416
- return new V(t, {
1414
+ let e = n.map((e) => "text" in e ? e.text : ""), t = e.join(""), r = this.consumeEncodingIndicator(() => BigInt(nt.encode(t).length));
1415
+ return new B(t, {
1417
1416
  ednParts: e,
1418
1417
  ...r === void 0 ? {} : { encodingWidth: r }
1419
1418
  });
1420
1419
  }
1421
1420
  let r = [], i = "";
1422
- for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new V(i)), i = ""), r.push(new B())) : i += e.text;
1423
- return i !== "" && r.push(new V(i)), new B(r);
1421
+ for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new B(i)), i = ""), r.push(new z())) : i += e.text;
1422
+ return i !== "" && r.push(new B(i)), new z(r);
1424
1423
  }
1425
1424
  _isBytesToken(e) {
1426
1425
  return e === "BYTES_HEX" || e === "SQSTR" || e === "BYTES_B64";
@@ -1442,7 +1441,7 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1442
1441
  }
1443
1442
  case "BYTES_HEX": return this._hexToBytes(e.value, e);
1444
1443
  case "BYTES_B64": try {
1445
- return ct(e.value, t);
1444
+ return lt(e.value, t);
1446
1445
  } catch (t) {
1447
1446
  if (t instanceof r || !(t instanceof SyntaxError)) throw t;
1448
1447
  this._fail(t.message, e);
@@ -1451,11 +1450,11 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1451
1450
  }
1452
1451
  }
1453
1452
  _decodeUtf8(e, t) {
1454
- if (this._options.allowInvalidUtf8) return rt.decode(e);
1453
+ if (this._options.allowInvalidUtf8) return it.decode(e);
1455
1454
  try {
1456
- return nt.decode(e);
1455
+ return rt.decode(e);
1457
1456
  } catch {
1458
- return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), rt.decode(e);
1457
+ return this._warnOrFail("byte string in text concatenation is not valid UTF-8", t), it.decode(e);
1459
1458
  }
1460
1459
  }
1461
1460
  _tokenTypeToCdnEncoding(e) {
@@ -1464,7 +1463,7 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1464
1463
  _parseBytesConcat(e, t, n) {
1465
1464
  if (this.t.peek().type !== "PLUS") {
1466
1465
  let r = this.consumeEncodingIndicator(() => BigInt(e.length));
1467
- return new P(e, {
1466
+ return new N(e, {
1468
1467
  ednEncoding: this._tokenTypeToCdnEncoding(t),
1469
1468
  ednSource: n,
1470
1469
  ...r === void 0 ? {} : { encodingWidth: r }
@@ -1481,32 +1480,32 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1481
1480
  else if (e.type === "BYTES_HEX_ELIDED") {
1482
1481
  this.t.consume();
1483
1482
  let t = this._buildBytesElidedItems(e.value, e);
1484
- for (let e of t) e instanceof B ? (i.push({ ellipsis: !0 }), r = !0) : e instanceof P && i.push({ bytes: e.value });
1483
+ for (let e of t) e instanceof z ? (i.push({ ellipsis: !0 }), r = !0) : e instanceof N && i.push({ bytes: e.value });
1485
1484
  } else this._isBytesToken(e.type) ? (this.t.consume(), i.push({
1486
1485
  bytes: this._decodeBytesToken(e),
1487
1486
  source: e.raw
1488
- })) : 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);
1487
+ })) : 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: nt.encode(e.value) })) : this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
1489
1488
  }
1490
1489
  if (!r) {
1491
1490
  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));
1492
- return new P(n, {
1491
+ return new N(n, {
1493
1492
  ednEncoding: this._tokenTypeToCdnEncoding(t),
1494
1493
  ednParts: e,
1495
1494
  ...r === void 0 ? {} : { encodingWidth: r }
1496
1495
  });
1497
1496
  }
1498
1497
  let a = [], o = [], s = () => {
1499
- o.length > 0 && (a.push(new P(this._concatBytes([...o]))), o.length = 0);
1498
+ o.length > 0 && (a.push(new N(this._concatBytes([...o]))), o.length = 0);
1500
1499
  };
1501
- for (let e of i) "ellipsis" in e ? (s(), a.push(new B())) : o.push(e.bytes);
1502
- return s(), new B(a);
1500
+ for (let e of i) "ellipsis" in e ? (s(), a.push(new z())) : o.push(e.bytes);
1501
+ return s(), new z(a);
1503
1502
  }
1504
1503
  _parseHexElidedConcat(e) {
1505
1504
  let t = this._buildBytesElidedItems(e.value, e);
1506
1505
  for (; this.t.peek().type === "PLUS";) {
1507
1506
  this.t.consume();
1508
1507
  let e = this.t.peek();
1509
- if (e.type === "ELLIPSIS") this.t.consume(), t.push(new B());
1508
+ if (e.type === "ELLIPSIS") this.t.consume(), t.push(new z());
1510
1509
  else if (e.type === "BYTES_HEX_ELIDED") {
1511
1510
  this.t.consume();
1512
1511
  let n = this._buildBytesElidedItems(e.value, e);
@@ -1514,20 +1513,20 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1514
1513
  } else if (this._isBytesToken(e.type)) {
1515
1514
  this.t.consume();
1516
1515
  let n = this._decodeBytesToken(e), r = t[t.length - 1];
1517
- r instanceof P ? t[t.length - 1] = new P(this._concatBytes([r.value, n])) : t.push(new P(n));
1516
+ r instanceof N ? t[t.length - 1] = new N(this._concatBytes([r.value, n])) : t.push(new N(n));
1518
1517
  } else this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`, e);
1519
1518
  }
1520
- return new B(t);
1519
+ return new z(t);
1521
1520
  }
1522
1521
  _buildBytesElidedItems(e, t) {
1523
1522
  let n = e.split("..."), r = [];
1524
- for (let e = 0; e < n.length; e++) e > 0 && r.push(new B()), n[e].length > 0 && r.push(new P(this._hexToBytes(n[e], t)));
1523
+ for (let e = 0; e < n.length; e++) e > 0 && r.push(new z()), n[e].length > 0 && r.push(new N(this._hexToBytes(n[e], t)));
1525
1524
  return r;
1526
1525
  }
1527
1526
  _mergeFirstBytesItem(e, t) {
1528
1527
  if (t.length === 0) return;
1529
1528
  let n = e[e.length - 1], r = t[0];
1530
- n instanceof P && r instanceof P ? (e[e.length - 1] = new P(this._concatBytes([n.value, r.value])), e.push(...t.slice(1))) : e.push(...t);
1529
+ n instanceof N && r instanceof N ? (e[e.length - 1] = new N(this._concatBytes([n.value, r.value])), e.push(...t.slice(1))) : e.push(...t);
1531
1530
  }
1532
1531
  _concatBytes(e) {
1533
1532
  let t = e.reduce((e, t) => e + t.byteLength, 0), n = new Uint8Array(t), r = 0;
@@ -1538,8 +1537,8 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1538
1537
  this.t.consume(), this.expect("LPAREN");
1539
1538
  let e = this.t.peek();
1540
1539
  e.type !== "INTEGER" && this._fail(`expected integer inside simple(), got ${JSON.stringify(e.value)}`, e), this.t.consume();
1541
- let { numStr: t } = at(e.value), n = Number(ot(t));
1542
- return this.expect("RPAREN"), new z(n);
1540
+ let { numStr: t } = ot(e.value), n = Number(st(t));
1541
+ return this.expect("RPAREN"), new R(n);
1543
1542
  }
1544
1543
  parseEmbeddedCBOR() {
1545
1544
  this.t.consume();
@@ -1556,7 +1555,7 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1556
1555
  let e = this.t.consume();
1557
1556
  t = this._resolveEncodingWidth(e.value, e);
1558
1557
  }
1559
- return new He(e, { encodingWidth: t });
1558
+ return new Ue(e, { encodingWidth: t });
1560
1559
  }
1561
1560
  parseArray() {
1562
1561
  this.t.consume();
@@ -1570,7 +1569,7 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1570
1569
  i.push(this.parseValue());
1571
1570
  }
1572
1571
  this.expect("RBRACKET"), t !== void 0 && n !== void 0 && (t = this._validateEncodingFit(BigInt(i.length), t, n));
1573
- let a = new L(i, {
1572
+ let a = new I(i, {
1574
1573
  indefiniteLength: e,
1575
1574
  encodingWidth: t
1576
1575
  });
@@ -1591,7 +1590,7 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1591
1590
  i.push([e, t]);
1592
1591
  }
1593
1592
  this.expect("RBRACE"), t !== void 0 && n !== void 0 && (t = this._validateEncodingFit(BigInt(i.length), t, n));
1594
- let a = new R(i, {
1593
+ let a = new L(i, {
1595
1594
  indefiniteLength: e,
1596
1595
  encodingWidth: t
1597
1596
  });
@@ -1615,16 +1614,16 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1615
1614
  }
1616
1615
  this.expect("RPAREN"), n.length === 0 && this._fail("empty indefinite group (_ ) is ambiguous; use ''_ for bytes or \"\"_ for text");
1617
1616
  let r = n[0];
1618
- if (r instanceof P) {
1619
- let e = new F(n.map((e, t) => {
1620
- if (e instanceof P) return e;
1617
+ if (r instanceof N) {
1618
+ let e = new P(n.map((e, t) => {
1619
+ if (e instanceof N) return e;
1621
1620
  this._fail(`indefinite byte string chunk ${t} must be a byte string, not a text string`);
1622
1621
  }));
1623
1622
  return t.length > 0 && (e.warnings = t), e;
1624
1623
  }
1625
- if (r instanceof V) {
1626
- let e = new I(n.map((e, t) => {
1627
- if (e instanceof V) return e;
1624
+ if (r instanceof B) {
1625
+ let e = new F(n.map((e, t) => {
1626
+ if (e instanceof B) return e;
1628
1627
  this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`);
1629
1628
  }));
1630
1629
  return t.length > 0 && (e.warnings = t), e;
@@ -1642,47 +1641,47 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1642
1641
  return t.type !== e && this._fail(`expected ${e}, got ${t.type} (${JSON.stringify(t.value)})`, t), t;
1643
1642
  }
1644
1643
  _applyEiToResult(e, t, n) {
1645
- if (e instanceof M) {
1644
+ if (e instanceof j) {
1646
1645
  let r = t === 1 ? "half" : t === 2 ? "single" : t === 3 ? "double" : void 0;
1647
1646
  if (r === void 0) this._warnOrFail(`encoding indicator _${t} is not valid for a float; use _1, _2, or _3`, n);
1648
1647
  else if (e.precision !== r) {
1649
1648
  if (r !== "double") {
1650
- let t = r === "half" ? w(C(e.value)) : Math.fround(e.value);
1649
+ let t = r === "half" ? C(S(e.value)) : Math.fround(e.value);
1651
1650
  !Object.is(t, e.value) && !isNaN(e.value) && this._warnOrFail(`${e.value} cannot be exactly represented as ${r === "half" ? "float16 (_1)" : "float32 (_2)"}`, n);
1652
1651
  }
1653
1652
  e.precision = r;
1654
1653
  }
1655
- } else if (e instanceof A) {
1654
+ } else if (e instanceof k) {
1656
1655
  if (e.encodingWidth === void 0) {
1657
1656
  let r = this._validateEncodingFit(e.value, t, n);
1658
1657
  r !== void 0 && (e.encodingWidth = r);
1659
1658
  }
1660
- } else if (e instanceof j) {
1659
+ } else if (e instanceof A) {
1661
1660
  if (e.encodingWidth === void 0) {
1662
1661
  let r = this._validateEncodingFit(e.argument, t, n);
1663
1662
  r !== void 0 && (e.encodingWidth = r);
1664
1663
  }
1665
- } else if (e instanceof P) {
1664
+ } else if (e instanceof N) {
1666
1665
  if (e.encodingWidth === void 0) {
1667
1666
  let r = this._validateEncodingFit(BigInt(e.value.length), t, n);
1668
1667
  r !== void 0 && (e.encodingWidth = r);
1669
1668
  }
1670
- } else if (e instanceof V) {
1669
+ } else if (e instanceof B) {
1671
1670
  if (e.encodingWidth === void 0) {
1672
- let r = this._validateEncodingFit(BigInt(tt.encode(e.value).length), t, n);
1671
+ let r = this._validateEncodingFit(BigInt(nt.encode(e.value).length), t, n);
1673
1672
  r !== void 0 && (e.encodingWidth = r);
1674
1673
  }
1675
- } else if (e instanceof L) {
1674
+ } else if (e instanceof I) {
1676
1675
  if (e.encodingWidth === void 0) {
1677
1676
  let r = this._validateEncodingFit(BigInt(e.items.length), t, n);
1678
1677
  r !== void 0 && (e.encodingWidth = r);
1679
1678
  }
1680
- } else if (e instanceof R) {
1679
+ } else if (e instanceof L) {
1681
1680
  if (e.encodingWidth === void 0) {
1682
1681
  let r = this._validateEncodingFit(BigInt(e.entries.length), t, n);
1683
1682
  r !== void 0 && (e.encodingWidth = r);
1684
1683
  }
1685
- } else if (e instanceof N) {
1684
+ } else if (e instanceof M) {
1686
1685
  if (e.encodingWidth === void 0) {
1687
1686
  let r = this._validateEncodingFit(e.tag, t, n);
1688
1687
  r !== void 0 && (e.encodingWidth = r);
@@ -1690,7 +1689,7 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1690
1689
  } else this._warnOrFail(`encoding indicator _${t} is not applicable to this app-string result type`, n);
1691
1690
  }
1692
1691
  _validateEncodingFit(e, t, n) {
1693
- let r = Ne(t);
1692
+ let r = Pe(t);
1694
1693
  if (e <= r) return t;
1695
1694
  let i = `value ${e} does not fit in encoding indicator ${t === "i" ? "_i (max 23)" : `_${t} (max ${r})`}`;
1696
1695
  this._warnOrFail(i, n);
@@ -1714,28 +1713,28 @@ var pt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
1714
1713
  this._warn(e, t), this._options.strict !== !1 && this._fail(e, t);
1715
1714
  }
1716
1715
  _hintMissingExtension(e, t) {
1717
- let n = ht.get(e);
1716
+ let n = gt.get(e);
1718
1717
  if (n === void 0 || this._hintedPrefixes.has(e)) return;
1719
1718
  this._hintedPrefixes.add(e);
1720
1719
  let r = `app-string prefix '${e}' requires an extension that is not enabled; ${n}`;
1721
1720
  this._options.onWarning ? this._options.onWarning({
1722
1721
  message: r,
1723
- ..._t(t)
1722
+ ...vt(t)
1724
1723
  }) : this._options.silent || console.warn(`CDN: ${r}`);
1725
1724
  }
1726
1725
  _warn(e, t) {
1727
1726
  let n = { message: e };
1728
- if (t !== void 0 && Object.assign(n, _t(t)), this._pendingWarnings.push(n), this._options.onWarning) this._options.onWarning(n);
1727
+ if (t !== void 0 && Object.assign(n, vt(t)), this._pendingWarnings.push(n), this._options.onWarning) this._options.onWarning(n);
1729
1728
  else if (!this._options.silent) {
1730
1729
  let n = t ? ` at line ${t.line}, column ${t.col}` : "";
1731
1730
  console.warn(`CDN strict violation${n}: ${e}`);
1732
1731
  }
1733
1732
  }
1734
1733
  _fail(e, t) {
1735
- throw new r(e, t ? _t(t) : void 0);
1734
+ throw new r(e, t ? vt(t) : void 0);
1736
1735
  }
1737
1736
  };
1738
- function _t(e) {
1737
+ function vt(e) {
1739
1738
  return {
1740
1739
  offset: e.offset,
1741
1740
  line: e.line,
@@ -1745,7 +1744,7 @@ function _t(e) {
1745
1744
  }
1746
1745
  //#endregion
1747
1746
  //#region src/ast/CborTextString.ts
1748
- var vt = new TextEncoder(), yt = !1, V = class extends k {
1747
+ var yt = new TextEncoder(), bt = !1, B = class extends O {
1749
1748
  indefiniteLength = !1;
1750
1749
  value;
1751
1750
  encodingWidth;
@@ -1757,51 +1756,66 @@ var vt = new TextEncoder(), yt = !1, V = class extends k {
1757
1756
  e.writeTextString(3, this.value, this.encodingWidth);
1758
1757
  }
1759
1758
  _toCDN(e, t) {
1760
- let n = S(e, this.encodingWidth, () => x(BigInt(vt.encode(this.value).length)));
1761
- if (e?.preserveConcatenation && this.ednParts !== void 0 && this.ednParts.length > 1) {
1762
- let r = this.ednParts.map((e) => xe(e));
1763
- return r[r.length - 1] += n, ee(r, _(e), t);
1764
- }
1765
- return bt(this.value, n, e, t);
1759
+ let n = x(e, this.encodingWidth, () => b(BigInt(yt.encode(this.value).length)));
1760
+ return xt(this.value, n, e, t, this.ednParts);
1766
1761
  }
1767
1762
  _toJS(e) {
1768
1763
  return this.value;
1769
1764
  }
1770
1765
  };
1771
- function bt(e, t, n, r) {
1772
- let i = xt(n), a = _(n);
1773
- if (i.length === 0 || a === null) return xe(e) + t;
1774
- let o = /* @__PURE__ */ new Map(), s = null;
1775
- if (i.includes("cdn") && (s = wt(e), s !== null)) for (let { point: e, contentDepth: t } of s) o.set(e, t);
1776
- if (i.includes("newline")) {
1777
- let t = s === null ? Ct(e, 0) : Tt(e);
1778
- for (let { point: e, contentDepth: n } of t) o.has(e) || o.set(e, n);
1779
- }
1780
- let c = Mt(e, o);
1781
- if (c.length <= 1) return xe(e) + t;
1782
- let l = c.map(({ text: e }, n) => {
1783
- let r = xe(e);
1784
- return n === c.length - 1 ? r + t : r;
1785
- }), u = l[0];
1786
- for (let e = 1; e < l.length; e++) {
1787
- let t = v(a, r + 1 + c[e].contentDepth);
1788
- u += ` +\n${t}${l[e]}`;
1789
- }
1790
- return u;
1791
- }
1792
- function xt(e) {
1793
- switch (e?.textStringSplit) {
1794
- case "none": return [];
1795
- case "newline": return ["newline"];
1796
- case "cdn": return ["cdn"];
1797
- case "cdn+newline": return ["cdn", "newline"];
1798
- case void 0: return St(e?.textStringFormat ?? []);
1799
- }
1800
- }
1801
- function St(e) {
1802
- return e.map((e) => e === "cboredn" ? (yt || (yt = !0, console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")), "cdn") : e);
1803
- }
1804
- function Ct(e, t) {
1766
+ function xt(e, t, n, r, i) {
1767
+ let { cdn: a, newline: o } = Ct(n), s = ee(n), c = n?.preserveConcatenation && i !== void 0 && i.length > 1 ? i : void 0;
1768
+ if (s === null) return c === void 0 ? Se(e) + t : St(c.map((e) => ({
1769
+ text: e,
1770
+ contentDepth: 0
1771
+ })), t, null, r);
1772
+ if (!a && !o && c === void 0) return Se(e) + t;
1773
+ let l = a ? Et(e) : null;
1774
+ if (l === null && c !== void 0) {
1775
+ let e = [];
1776
+ for (let t of c) if (o) {
1777
+ let n = /* @__PURE__ */ new Map();
1778
+ for (let { point: e, contentDepth: r } of Tt(t, 0)) n.set(e, r);
1779
+ e.push(...Pt(t, n));
1780
+ } else e.push({
1781
+ text: t,
1782
+ contentDepth: 0
1783
+ });
1784
+ return St(e, t, s, r);
1785
+ }
1786
+ let u = /* @__PURE__ */ new Map();
1787
+ if (l !== null) for (let { point: e, contentDepth: t } of l) u.set(e, t);
1788
+ if (o) {
1789
+ let t = l === null ? Tt(e, 0) : Dt(e);
1790
+ for (let { point: e, contentDepth: n } of t) u.has(e) || u.set(e, n);
1791
+ }
1792
+ let d = Pt(e, u);
1793
+ return d.length <= 1 ? Se(e) + t : St(d, t, s, r);
1794
+ }
1795
+ function St(e, t, n, r) {
1796
+ let i = e.map(({ text: n }, r) => {
1797
+ let i = Se(n);
1798
+ return r === e.length - 1 ? i + t : i;
1799
+ });
1800
+ if (n === null) return i.join(" + ");
1801
+ let a = i[0];
1802
+ for (let t = 1; t < i.length; t++) {
1803
+ let o = _(n, r + 1 + e[t].contentDepth);
1804
+ a += ` +\n${o}${i[t]}`;
1805
+ }
1806
+ return a;
1807
+ }
1808
+ function Ct(e) {
1809
+ let t = e?.splitCdn === void 0 || e?.splitNewline === void 0 ? wt(e?.textStringFormat ?? []) : [];
1810
+ return {
1811
+ cdn: e?.splitCdn ?? t.includes("cdn"),
1812
+ newline: e?.splitNewline ?? t.includes("newline")
1813
+ };
1814
+ }
1815
+ function wt(e) {
1816
+ return e.map((e) => e === "cboredn" ? (bt || (bt = !0, console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")), "cdn") : e);
1817
+ }
1818
+ function Tt(e, t) {
1805
1819
  let n = [];
1806
1820
  for (let r = 0; r < e.length; r++) {
1807
1821
  let i = e[r];
@@ -1818,9 +1832,9 @@ function Ct(e, t) {
1818
1832
  }
1819
1833
  return n;
1820
1834
  }
1821
- function wt(e) {
1835
+ function Et(e) {
1822
1836
  try {
1823
- it(e);
1837
+ at(e);
1824
1838
  } catch {
1825
1839
  return null;
1826
1840
  }
@@ -1829,24 +1843,24 @@ function wt(e) {
1829
1843
  let a = n.consume();
1830
1844
  if (a.type === "EOF") break;
1831
1845
  let c = !1;
1832
- if (o || (o = !0, a.offset > 0 && At(n.comments, 0, a.offset) && t.push({
1846
+ if (o || (o = !0, a.offset > 0 && Mt(n.comments, 0, a.offset) && t.push({
1833
1847
  point: a.offset,
1834
1848
  contentDepth: r
1835
1849
  })), i !== null) {
1836
- if (i.kind === "opener" && Dt.has(a.type)) {
1850
+ if (i.kind === "opener" && kt.has(a.type)) {
1837
1851
  i.point = a.endOffset, s = a.endOffset;
1838
1852
  continue;
1839
- } else i.kind === "opener" && kt.has(a.type) && jt(e, i.point, a.offset) ? c = !0 : t.push({
1853
+ } else i.kind === "opener" && jt.has(a.type) && Nt(e, i.point, a.offset) ? c = !0 : t.push({
1840
1854
  point: a.offset,
1841
1855
  contentDepth: i.contentDepth
1842
1856
  });
1843
1857
  i = null;
1844
1858
  }
1845
- Ot.has(a.type) ? (r++, i = {
1859
+ At.has(a.type) ? (r++, i = {
1846
1860
  point: a.endOffset,
1847
1861
  contentDepth: r,
1848
1862
  kind: "opener"
1849
- }) : kt.has(a.type) ? (r = Math.max(0, r - 1), c || t.push({
1863
+ }) : jt.has(a.type) ? (r = Math.max(0, r - 1), c || t.push({
1850
1864
  point: a.offset,
1851
1865
  contentDepth: r
1852
1866
  })) : a.type === "COMMA" && (i = {
@@ -1861,23 +1875,23 @@ function wt(e) {
1861
1875
  contentDepth: r
1862
1876
  }), t;
1863
1877
  }
1864
- function Tt(e) {
1878
+ function Dt(e) {
1865
1879
  let t = [], n = new a(e), r = 0;
1866
1880
  for (;;) {
1867
1881
  let i = n.consume();
1868
1882
  if (i.type === "EOF") break;
1869
- if (Ot.has(i.type)) r++;
1870
- else if (kt.has(i.type)) r = Math.max(0, r - 1);
1883
+ if (At.has(i.type)) r++;
1884
+ else if (jt.has(i.type)) r = Math.max(0, r - 1);
1871
1885
  else if (i.type !== "COMMA") {
1872
1886
  if (i.type === "TSTR") {
1873
1887
  let n = e.slice(i.offset, i.endOffset);
1874
- for (let e of Et(n)) t.push({
1888
+ for (let e of Ot(n)) t.push({
1875
1889
  point: i.offset + e,
1876
1890
  contentDepth: r + 1
1877
1891
  });
1878
1892
  } else if (i.type === "RAWSTRING") {
1879
1893
  let n = e.slice(i.offset, i.endOffset);
1880
- for (let { point: e } of Ct(n, 0)) t.push({
1894
+ for (let { point: e } of Tt(n, 0)) t.push({
1881
1895
  point: i.offset + e,
1882
1896
  contentDepth: r + 1
1883
1897
  });
@@ -1886,7 +1900,7 @@ function Tt(e) {
1886
1900
  }
1887
1901
  return t;
1888
1902
  }
1889
- function Et(e) {
1903
+ function Ot(e) {
1890
1904
  let t = [], n = 1, r = e.length - 1;
1891
1905
  for (; n < r;) {
1892
1906
  let r = e[n];
@@ -1902,24 +1916,24 @@ function Et(e) {
1902
1916
  }
1903
1917
  return t;
1904
1918
  }
1905
- var Dt = /* @__PURE__ */ new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), Ot = /* @__PURE__ */ new Set([
1919
+ var kt = /* @__PURE__ */ new Set(["ENCODING_INDICATOR", "UNDERSCORE"]), At = /* @__PURE__ */ new Set([
1906
1920
  "LBRACKET",
1907
1921
  "LBRACE",
1908
1922
  "LPAREN",
1909
1923
  "LT_LT"
1910
- ]), kt = /* @__PURE__ */ new Set([
1924
+ ]), jt = /* @__PURE__ */ new Set([
1911
1925
  "RBRACKET",
1912
1926
  "RBRACE",
1913
1927
  "RPAREN",
1914
1928
  "GT_GT"
1915
1929
  ]);
1916
- function At(e, t, n) {
1930
+ function Mt(e, t, n) {
1917
1931
  return e.some((e) => e.start >= t && e.end <= n);
1918
1932
  }
1919
- function jt(e, t, n) {
1933
+ function Nt(e, t, n) {
1920
1934
  return /^[\t\n\r ]*$/.test(e.slice(t, n));
1921
1935
  }
1922
- function Mt(e, t) {
1936
+ function Pt(e, t) {
1923
1937
  let n = [...t].filter(([t]) => t > 0 && t < e.length).sort(([e], [t]) => e - t);
1924
1938
  if (n.length === 0) return [{
1925
1939
  text: e,
@@ -1937,7 +1951,7 @@ function Mt(e, t) {
1937
1951
  }
1938
1952
  //#endregion
1939
1953
  //#region src/extensions/dt.ts
1940
- function Nt(e) {
1954
+ function V(e) {
1941
1955
  if (Number.isInteger(e)) return (/* @__PURE__ */ new Date(e * 1e3)).toISOString().replace(/\.000Z$/, "Z");
1942
1956
  let t = Math.round(e * 1e3);
1943
1957
  if (t / 1e3 === e) return new Date(t).toISOString().replace(/\.000Z$/, "Z");
@@ -1945,17 +1959,17 @@ function Nt(e) {
1945
1959
  for (; s.length < 3;) s += "0";
1946
1960
  return `${i}.${s}Z`;
1947
1961
  }
1948
- var Pt = new TextDecoder("utf-8", { fatal: !0 });
1949
- function Ft(e) {
1962
+ var Ft = new TextDecoder("utf-8", { fatal: !0 });
1963
+ function It(e) {
1950
1964
  if (e.length !== 1) throw SyntaxError("dt<<...>>: expected exactly one item");
1951
1965
  let t = e[0];
1952
- if (t instanceof V) return t.value;
1953
- if (t instanceof P) return Pt.decode(t.value);
1966
+ if (t instanceof B) return t.value;
1967
+ if (t instanceof N) return Ft.decode(t.value);
1954
1968
  throw SyntaxError("dt<<...>>: expected a text string or byte string");
1955
1969
  }
1956
- var It = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;
1957
- function Lt(e, t) {
1958
- if (!It.test(e)) {
1970
+ var Lt = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;
1971
+ function Rt(e, t) {
1972
+ if (!Lt.test(e)) {
1959
1973
  let n = `dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`;
1960
1974
  if (t) t(n);
1961
1975
  else throw SyntaxError(n);
@@ -1966,93 +1980,93 @@ function Lt(e, t) {
1966
1980
  if (isNaN(a)) throw SyntaxError(`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`);
1967
1981
  if (i === void 0) {
1968
1982
  let e = a / 1e3;
1969
- return e >= 0 ? new zt(BigInt(e)) : new Bt(BigInt(e));
1983
+ return e >= 0 ? new Bt(BigInt(e)) : new Vt(BigInt(e));
1970
1984
  }
1971
- return new Vt(a / 1e3 + i);
1985
+ return new Ht(a / 1e3 + i);
1972
1986
  }
1973
- var Rt = 1n, zt = class extends A {
1987
+ var zt = 1n, Bt = class extends k {
1974
1988
  constructor(e, t) {
1975
1989
  super(e, t);
1976
1990
  }
1977
1991
  _toCDN(e, t) {
1978
1992
  if (e?.appStrings === !1) return super._toCDN(e, t);
1979
- let n = S(e, this.encodingWidth, () => x(this.value));
1980
- return `dt'${Nt(Number(this.value))}'${n}`;
1993
+ let n = x(e, this.encodingWidth, () => b(this.value));
1994
+ return `dt'${V(Number(this.value))}'${n}`;
1981
1995
  }
1982
- }, Bt = class extends j {
1996
+ }, Vt = class extends A {
1983
1997
  constructor(e, t) {
1984
1998
  super(e, t);
1985
1999
  }
1986
2000
  _toCDN(e, t) {
1987
2001
  if (e?.appStrings === !1) return super._toCDN(e, t);
1988
- let n = S(e, this.encodingWidth, () => x(this.argument));
1989
- return `dt'${Nt(Number(this.value))}'${n}`;
2002
+ let n = x(e, this.encodingWidth, () => b(this.argument));
2003
+ return `dt'${V(Number(this.value))}'${n}`;
1990
2004
  }
1991
- }, Vt = class extends M {
2005
+ }, Ht = class extends j {
1992
2006
  constructor(e, t) {
1993
2007
  super(e, t);
1994
2008
  }
1995
2009
  _toCDN(e, t) {
1996
2010
  if (e?.appStrings === !1) return super._toCDN(e, t);
1997
- let n = O(this.value), r = Ce(this.value, this.precision, n, e?.encodingIndicators ?? "auto");
1998
- return `dt'${Nt(this.value)}'${r}`;
2011
+ let n = D(this.value), r = we(this.value, this.precision, n, e?.encodingIndicators ?? "auto");
2012
+ return `dt'${V(this.value)}'${r}`;
1999
2013
  }
2000
- }, Ht = class extends N {
2014
+ }, Ut = class extends M {
2001
2015
  constructor(e, t) {
2002
- super(Rt, typeof e == "string" ? Lt(e) : e, t);
2016
+ super(zt, typeof e == "string" ? Rt(e) : e, t);
2003
2017
  }
2004
2018
  _toCDN(e, t) {
2005
2019
  if (e?.appStrings === !1) return super._toCDN(e, t);
2006
2020
  let n = this.content;
2007
- if (n instanceof M ? n.precision !== void 0 && n.precision !== O(n.value) : n.encodingWidth !== void 0) return super._toCDN({
2021
+ if (n instanceof j ? n.precision !== void 0 && n.precision !== D(n.value) : n.encodingWidth !== void 0) return super._toCDN({
2008
2022
  ...e,
2009
2023
  appStrings: !1
2010
2024
  }, t);
2011
- let r = n instanceof M ? n.value : Number(n.value), i = S(e, this.encodingWidth, () => x(Rt));
2012
- return `DT'${Nt(r)}'${i}`;
2025
+ let r = n instanceof j ? n.value : Number(n.value), i = x(e, this.encodingWidth, () => b(zt));
2026
+ return `DT'${V(r)}'${i}`;
2013
2027
  }
2014
- }, Ut = class extends Ht {
2028
+ }, Wt = class extends Ut {
2015
2029
  constructor(e, t) {
2016
2030
  super(e, t);
2017
2031
  }
2018
2032
  _toJS(e) {
2019
- let t = this.content, n = t instanceof M ? t.value * 1e3 : Number(t.value) * 1e3;
2033
+ let t = this.content, n = t instanceof j ? t.value * 1e3 : Number(t.value) * 1e3;
2020
2034
  return new Date(n);
2021
2035
  }
2022
2036
  };
2023
- function Wt(e) {
2037
+ function Gt(e) {
2024
2038
  let t = e?.jsDate ?? !1;
2025
2039
  function n(e) {
2026
- return t ? new Ut(e) : new Ht(e);
2040
+ return t ? new Wt(e) : new Ut(e);
2027
2041
  }
2028
2042
  let r = {
2029
2043
  appStringPrefixes: ["dt", "DT"],
2030
- tagNumbers: [Rt],
2044
+ tagNumbers: [zt],
2031
2045
  parseAppString(e, t, r) {
2032
- return e === "DT" ? n(t) : Lt(t, r);
2046
+ return e === "DT" ? n(t) : Rt(t, r);
2033
2047
  },
2034
2048
  parseAppSequence(e, t, r) {
2035
- let i = Ft(t);
2036
- return e === "DT" ? n(i) : Lt(i, r);
2049
+ let i = It(t);
2050
+ return e === "DT" ? n(i) : Rt(i, r);
2037
2051
  },
2038
2052
  parseTag(e, n) {
2039
2053
  if (e !== 1n) return;
2040
2054
  let r;
2041
- if (n instanceof A) r = new zt(n.value, { encodingWidth: n.encodingWidth });
2042
- else if (n instanceof j) r = new Bt(n.value, { encodingWidth: n.encodingWidth });
2043
- else if (n instanceof M) r = new Vt(n.value), n.precision !== void 0 && (r.precision = n.precision);
2055
+ if (n instanceof k) r = new Bt(n.value, { encodingWidth: n.encodingWidth });
2056
+ else if (n instanceof A) r = new Vt(n.value, { encodingWidth: n.encodingWidth });
2057
+ else if (n instanceof j) r = new Ht(n.value), n.precision !== void 0 && (r.precision = n.precision);
2044
2058
  else return;
2045
- return r.start = n.start, r.end = n.end, t ? new Ut(r) : new Ht(r);
2059
+ return r.start = n.start, r.end = n.end, t ? new Wt(r) : new Ut(r);
2046
2060
  }
2047
2061
  };
2048
2062
  return t && (r.fromJS = (e, t) => {
2049
- if (e instanceof Date) return new Ut(Nt(e.getTime() / 1e3));
2063
+ if (e instanceof Date) return new Wt(V(e.getTime() / 1e3));
2050
2064
  }, r.isJSType = (e) => e instanceof Date), r;
2051
2065
  }
2052
- var Gt = Wt(), Kt = Wt({ jsDate: !0 });
2066
+ var Kt = Gt(), qt = Gt({ jsDate: !0 });
2053
2067
  //#endregion
2054
2068
  //#region src/utils/ip.ts
2055
- function qt(e) {
2069
+ function Jt(e) {
2056
2070
  let t = e.split(".");
2057
2071
  if (t.length !== 4) throw SyntaxError(`ip: invalid IPv4 address: ${JSON.stringify(e)}`);
2058
2072
  let n = /* @__PURE__ */ new Uint8Array(4);
@@ -2065,11 +2079,11 @@ function qt(e) {
2065
2079
  }
2066
2080
  return n;
2067
2081
  }
2068
- function Jt(e) {
2082
+ function Yt(e) {
2069
2083
  let t = /* @__PURE__ */ new Uint8Array(16);
2070
2084
  if (e === "::") return t;
2071
2085
  let n = e, r = null, i = e.match(/^(.*):(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
2072
- i && (n = i[1], n.endsWith(":") && (n += ":"), r = qt(i[2]));
2086
+ i && (n = i[1], n.endsWith(":") && (n += ":"), r = Jt(i[2]));
2073
2087
  let a = n.split("::");
2074
2088
  if (a.length > 2) throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);
2075
2089
  let o = a.length === 2, s = a[0] ? a[0].split(":") : [], c = o && a[1] ? a[1].split(":") : [], l = r ? 6 : 8;
@@ -2086,11 +2100,11 @@ function Jt(e) {
2086
2100
  }
2087
2101
  return r && t.set(r, 12), t;
2088
2102
  }
2089
- function Yt(e) {
2103
+ function Xt(e) {
2090
2104
  return Array.from(e).join(".");
2091
2105
  }
2092
- function Xt(e) {
2093
- let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? Yt(e.slice(12)) : null, n = t ? 6 : 8, r = [];
2106
+ function Zt(e) {
2107
+ let t = e.slice(0, 10).every((e) => e === 0) && e[10] === 255 && e[11] === 255 ? Xt(e.slice(12)) : null, n = t ? 6 : 8, r = [];
2094
2108
  for (let t = 0; t < n * 2; t += 2) r.push(e[t] << 8 | e[t + 1]);
2095
2109
  let i = -1, a = 0, o = 0;
2096
2110
  for (; o < n;) if (r[o] === 0) {
@@ -2104,29 +2118,29 @@ function Xt(e) {
2104
2118
  }
2105
2119
  //#endregion
2106
2120
  //#region src/extensions/ip.ts
2107
- var Zt = "ip", H = "IP", U = 52n, Qt = 54n, $t = new TextDecoder("utf-8", { fatal: !0 });
2108
- function en(e) {
2121
+ var Qt = "ip", H = "IP", U = 52n, $t = 54n, en = new TextDecoder("utf-8", { fatal: !0 });
2122
+ function tn(e) {
2109
2123
  if (e.length !== 1) throw SyntaxError("ip<<...>>: expected exactly one item");
2110
2124
  let t = e[0];
2111
- if (t instanceof V) return t.value;
2112
- if (t instanceof P) return $t.decode(t.value);
2125
+ if (t instanceof B) return t.value;
2126
+ if (t instanceof N) return en.decode(t.value);
2113
2127
  throw SyntaxError("ip<<...>>: expected a text string or byte string");
2114
2128
  }
2115
- function tn(e) {
2129
+ function nn(e) {
2116
2130
  return /^\d/.test(e) && e.includes(".") && !e.includes(":") ? {
2117
- bytes: qt(e),
2131
+ bytes: Jt(e),
2118
2132
  isV4: !0
2119
2133
  } : {
2120
- bytes: Jt(e),
2134
+ bytes: Yt(e),
2121
2135
  isV4: !1
2122
2136
  };
2123
2137
  }
2124
- function nn(e) {
2125
- if (e.length === 4) return Yt(e);
2126
- if (e.length === 16) return Xt(e);
2138
+ function rn(e) {
2139
+ if (e.length === 4) return Xt(e);
2140
+ if (e.length === 16) return Zt(e);
2127
2141
  throw SyntaxError(`ip: unexpected byte length: ${e.length}`);
2128
2142
  }
2129
- function rn(e, t) {
2143
+ function an(e, t) {
2130
2144
  let n = new Uint8Array(e.length);
2131
2145
  n.set(e);
2132
2146
  let r = Math.floor(t / 8), i = t % 8;
@@ -2136,86 +2150,86 @@ function rn(e, t) {
2136
2150
  for (; a > 0 && n[a - 1] === 0;) a--;
2137
2151
  return n.slice(0, a);
2138
2152
  }
2139
- function an(e, t) {
2153
+ function on(e, t) {
2140
2154
  let n = new Uint8Array(t);
2141
2155
  return n.set(e), n;
2142
2156
  }
2143
- var on = class extends P {
2157
+ var sn = class extends N {
2144
2158
  _toCDN(e, t) {
2145
2159
  if (e?.appStrings === !1) return super._toCDN(e, t);
2146
- let n = S(e, this.encodingWidth, () => x(BigInt(this.value.length)));
2147
- return `${Zt}'${nn(this.value)}'${n}`;
2160
+ let n = x(e, this.encodingWidth, () => b(BigInt(this.value.length)));
2161
+ return `${Qt}'${rn(this.value)}'${n}`;
2148
2162
  }
2149
- }, sn = class extends L {
2163
+ }, cn = class extends I {
2150
2164
  _isV4;
2151
2165
  constructor(e, t, n) {
2152
- super([new A(BigInt(e)), new P(t)]), this._isV4 = n;
2166
+ super([new k(BigInt(e)), new N(t)]), this._isV4 = n;
2153
2167
  }
2154
2168
  _toCDN(e, t) {
2155
2169
  if (e?.appStrings === !1) return super._toCDN(e, t);
2156
2170
  let n = Number(this.items[0].value), r = this.items[1].value;
2157
- return `${Zt}'${nn(an(r, this._isV4 ? 4 : 16))}/${n}'`;
2171
+ return `${Qt}'${rn(on(r, this._isV4 ? 4 : 16))}/${n}'`;
2158
2172
  }
2159
- }, cn = class extends N {
2173
+ }, ln = class extends M {
2160
2174
  constructor(e, t) {
2161
2175
  super(e, t);
2162
2176
  }
2163
2177
  _toCDN(e, t) {
2164
2178
  if (e?.appStrings === !1) return super._toCDN(e, t);
2165
2179
  let n = this.tag === U ? 4 : 16, r = this.content;
2166
- if (r instanceof P) {
2180
+ if (r instanceof N) {
2167
2181
  if (r.encodingWidth !== void 0) return super._toCDN(e, t);
2168
- let n = S(e, this.encodingWidth, () => x(this.tag));
2169
- return `${H}'${nn(r.value)}'${n}`;
2182
+ let n = x(e, this.encodingWidth, () => b(this.tag));
2183
+ return `${H}'${rn(r.value)}'${n}`;
2170
2184
  }
2171
- if (r instanceof L && r.items.length === 2 && r.items[0] instanceof A && r.items[1] instanceof P) {
2185
+ if (r instanceof I && r.items.length === 2 && r.items[0] instanceof k && r.items[1] instanceof N) {
2172
2186
  if (r.encodingWidth !== void 0 || r.items[0].encodingWidth !== void 0 || r.items[1].encodingWidth !== void 0) return super._toCDN(e, t);
2173
- let i = Number(r.items[0].value), a = an(r.items[1].value, n), o = S(e, this.encodingWidth, () => x(this.tag));
2174
- return `${H}'${nn(a)}/${i}'${o}`;
2187
+ let i = Number(r.items[0].value), a = on(r.items[1].value, n), o = x(e, this.encodingWidth, () => b(this.tag));
2188
+ return `${H}'${rn(a)}/${i}'${o}`;
2175
2189
  }
2176
2190
  return super._toCDN(e, t);
2177
2191
  }
2178
2192
  };
2179
- function ln(e, t) {
2193
+ function un(e, t) {
2180
2194
  let n = t.indexOf("/");
2181
2195
  if (n === -1) {
2182
- let { bytes: n, isV4: r } = tn(t);
2183
- return e === H ? new cn(r ? U : Qt, new P(n)) : new on(n);
2196
+ let { bytes: n, isV4: r } = nn(t);
2197
+ return e === H ? new ln(r ? U : $t, new N(n)) : new sn(n);
2184
2198
  }
2185
2199
  let r = t.slice(0, n), i = t.slice(n + 1);
2186
2200
  if (!/^\d+$/.test(i)) throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);
2187
- let a = parseInt(i, 10), { bytes: o, isV4: s } = tn(r), c = s ? 32 : 128;
2201
+ let a = parseInt(i, 10), { bytes: o, isV4: s } = nn(r), c = s ? 32 : 128;
2188
2202
  if (a > c) throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s ? "IPv4" : "IPv6"}`);
2189
- let l = rn(o, a);
2190
- return e === H ? new cn(s ? U : Qt, new L([new A(BigInt(a)), new P(l)])) : new sn(a, l, s);
2203
+ let l = an(o, a);
2204
+ return e === H ? new ln(s ? U : $t, new I([new k(BigInt(a)), new N(l)])) : new cn(a, l, s);
2191
2205
  }
2192
- var un = {
2193
- appStringPrefixes: [Zt, H],
2194
- tagNumbers: [U, Qt],
2206
+ var dn = {
2207
+ appStringPrefixes: [Qt, H],
2208
+ tagNumbers: [U, $t],
2195
2209
  parseAppString(e, t) {
2196
- return ln(e, t);
2210
+ return un(e, t);
2197
2211
  },
2198
2212
  parseAppSequence(e, t) {
2199
- return ln(e, en(t));
2213
+ return un(e, tn(t));
2200
2214
  },
2201
2215
  parseTag(e, t) {
2202
- if (!(e !== U && e !== Qt) && (t instanceof P || t instanceof L)) return new cn(e, t);
2216
+ if (!(e !== U && e !== $t) && (t instanceof N || t instanceof I)) return new ln(e, t);
2203
2217
  }
2204
- }, dn = 18446744073709551615n, fn = -18446744073709551616n, pn = {
2205
- tagNumbers: [qe, Je],
2218
+ }, fn = 18446744073709551615n, pn = -18446744073709551616n, mn = {
2219
+ tagNumbers: [Je, Ye],
2206
2220
  parseTag(e, t) {
2207
- if (t instanceof P) {
2221
+ if (t instanceof N) {
2208
2222
  if (e === 2n) {
2209
- let e = Qe(t.value);
2210
- return e > dn ? new $e(e) : void 0;
2223
+ let e = $e(t.value);
2224
+ return e > fn ? new et(e) : void 0;
2211
2225
  }
2212
2226
  if (e === 3n) {
2213
- let e = -1n - Qe(t.value);
2214
- return e < fn ? new et(e) : void 0;
2227
+ let e = -1n - $e(t.value);
2228
+ return e < pn ? new tt(e) : void 0;
2215
2229
  }
2216
2230
  }
2217
2231
  }
2218
- }, mn = "cri", hn = "CRI", gn = 99n, _n = /* @__PURE__ */ new Map([
2232
+ }, hn = "cri", gn = "CRI", _n = 99n, vn = /* @__PURE__ */ new Map([
2219
2233
  ["coap", -1n],
2220
2234
  ["coaps", -2n],
2221
2235
  ["http", -3n],
@@ -2226,7 +2240,7 @@ var un = {
2226
2240
  ["coaps+tcp", -8n],
2227
2241
  ["coap+ws", -25n],
2228
2242
  ["coaps+ws", -26n]
2229
- ]), vn = new Map([..._n.entries()].map(([e, t]) => [t, e]));
2243
+ ]), yn = new Map([...vn.entries()].map(([e, t]) => [t, e]));
2230
2244
  function W(e) {
2231
2245
  try {
2232
2246
  return decodeURIComponent(e);
@@ -2234,39 +2248,39 @@ function W(e) {
2234
2248
  return e;
2235
2249
  }
2236
2250
  }
2237
- var yn = new TextEncoder(), bn = new TextDecoder("utf-8", { fatal: !0 });
2238
- function xn(e) {
2239
- return Array.from(yn.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2251
+ var bn = new TextEncoder(), xn = new TextDecoder("utf-8", { fatal: !0 });
2252
+ function Sn(e) {
2253
+ return Array.from(bn.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
2240
2254
  }
2241
2255
  function G(e, t) {
2242
2256
  let n = "";
2243
- for (let r of e) n += t(r) ? r : xn(r);
2257
+ for (let r of e) n += t(r) ? r : Sn(r);
2244
2258
  return n;
2245
2259
  }
2246
- function Sn(e) {
2247
- return /[A-Za-z0-9\-._~]/.test(e);
2248
- }
2249
2260
  function Cn(e) {
2250
- return /[!$&'()*+,;=]/.test(e);
2261
+ return /[A-Za-z0-9\-._~]/.test(e);
2251
2262
  }
2252
2263
  function wn(e) {
2253
- return Sn(e) || Cn(e) || e === ":" || e === "@";
2264
+ return /[!$&'()*+,;=]/.test(e);
2254
2265
  }
2255
2266
  function Tn(e) {
2256
- return (wn(e) || e === "/" || e === "?") && e !== "&";
2267
+ return Cn(e) || wn(e) || e === ":" || e === "@";
2257
2268
  }
2258
2269
  function En(e) {
2259
- return wn(e) || e === "/" || e === "?";
2270
+ return (Tn(e) || e === "/" || e === "?") && e !== "&";
2260
2271
  }
2261
2272
  function Dn(e) {
2262
- return Sn(e) || Cn(e) || e === ":";
2273
+ return Tn(e) || e === "/" || e === "?";
2263
2274
  }
2264
2275
  function On(e) {
2265
- return Sn(e) || Cn(e);
2276
+ return Cn(e) || wn(e) || e === ":";
2266
2277
  }
2267
2278
  function kn(e) {
2279
+ return Cn(e) || wn(e);
2280
+ }
2281
+ function An(e) {
2268
2282
  let t = [], n = e, r = n.indexOf("@");
2269
- r >= 0 && (t.push(z.FALSE), t.push(new V(W(n.slice(0, r)))), n = n.slice(r + 1));
2283
+ r >= 0 && (t.push(R.FALSE), t.push(new B(W(n.slice(0, r)))), n = n.slice(r + 1));
2270
2284
  let i, a = null;
2271
2285
  if (n.startsWith("[")) {
2272
2286
  let e = n.indexOf("]");
@@ -2275,162 +2289,162 @@ function kn(e) {
2275
2289
  let r = n.slice(e + 1);
2276
2290
  if (r.startsWith(":")) a = r.slice(1);
2277
2291
  else if (r.length > 0) throw SyntaxError("cri: unexpected characters after ']' in authority");
2278
- t.push(new P(Jt(i)));
2292
+ t.push(new N(Yt(i)));
2279
2293
  } else {
2280
2294
  let e = n.lastIndexOf(":");
2281
- 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 P(qt(i)));
2282
- else for (let e of i.toLowerCase().split(".")) t.push(new V(e));
2295
+ 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 N(Jt(i)));
2296
+ else for (let e of i.toLowerCase().split(".")) t.push(new B(e));
2283
2297
  }
2284
2298
  if (a !== null && a !== "") {
2285
2299
  if (!/^\d+$/.test(a)) throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);
2286
2300
  let e = parseInt(a, 10);
2287
2301
  if (e > 65535) throw SyntaxError(`cri: port ${e} out of range`);
2288
- t.push(new A(BigInt(e)));
2302
+ t.push(new k(BigInt(e)));
2289
2303
  }
2290
- return new L(t);
2304
+ return new I(t);
2291
2305
  }
2292
- function An(e) {
2306
+ function jn(e) {
2293
2307
  let t = e.items, n = 0, r = "";
2294
- if (n < t.length && t[n] instanceof z && t[n].value === 20) {
2308
+ if (n < t.length && t[n] instanceof R && t[n].value === 20) {
2295
2309
  n++;
2296
2310
  let e = t[n++];
2297
- r += G(e.value, Dn) + "@";
2311
+ r += G(e.value, On) + "@";
2298
2312
  }
2299
2313
  if (n >= t.length) return r;
2300
2314
  let i = t[n];
2301
- if (i instanceof P) {
2315
+ if (i instanceof N) {
2302
2316
  n++;
2303
2317
  let { length: e } = i.value;
2304
- if (e === 4) r += Yt(i.value);
2305
- else if (e === 16) r += "[" + Xt(i.value) + "]";
2318
+ if (e === 4) r += Xt(i.value);
2319
+ else if (e === 16) r += "[" + Zt(i.value) + "]";
2306
2320
  else throw Error(`cri: unexpected host-ip byte length: ${e}`);
2307
- n < t.length && t[n] instanceof V && (r += `%25${G(t[n++].value, On)}`);
2321
+ n < t.length && t[n] instanceof B && (r += `%25${G(t[n++].value, kn)}`);
2308
2322
  } else {
2309
2323
  let e = [];
2310
- for (; n < t.length && t[n] instanceof V;) e.push(G(t[n++].value, On));
2324
+ for (; n < t.length && t[n] instanceof B;) e.push(G(t[n++].value, kn));
2311
2325
  r += e.join(".");
2312
2326
  }
2313
- return n < t.length && t[n] instanceof A && (r += ":" + t[n].value.toString()), r;
2327
+ return n < t.length && t[n] instanceof k && (r += ":" + t[n].value.toString()), r;
2314
2328
  }
2315
- function jn(e) {
2329
+ function Mn(e) {
2316
2330
  let t = e.slice(2), n = t.indexOf("/"), r, i;
2317
- return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new V(W(e)))) : (r = t, i = []), {
2318
- authority: kn(r),
2331
+ return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new B(W(e)))) : (r = t, i = []), {
2332
+ authority: An(r),
2319
2333
  pathSegments: i
2320
2334
  };
2321
2335
  }
2322
- function Mn(e) {
2336
+ function Nn(e) {
2323
2337
  let t = e, n = null, r = t.indexOf("#");
2324
2338
  r >= 0 && (n = W(t.slice(r + 1)), t = t.slice(0, r));
2325
2339
  let i = null, a = t.indexOf("?");
2326
2340
  if (a >= 0) {
2327
2341
  let e = t.slice(a + 1);
2328
- t = t.slice(0, a), i = e.split("&").map((e) => new V(W(e)));
2342
+ t = t.slice(0, a), i = e.split("&").map((e) => new B(W(e)));
2329
2343
  }
2330
2344
  let o = [], s = /^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);
2331
2345
  if (s) {
2332
- let e = s[1].toLowerCase(), t = s[2], n = _n.get(e);
2333
- if (o.push(n === void 0 ? new V(e) : new j(n)), t.startsWith("//")) {
2334
- let { authority: e, pathSegments: n } = jn(t);
2335
- o.push(e, new L(n));
2346
+ let e = s[1].toLowerCase(), t = s[2], n = vn.get(e);
2347
+ if (o.push(n === void 0 ? new B(e) : new A(n)), t.startsWith("//")) {
2348
+ let { authority: e, pathSegments: n } = Mn(t);
2349
+ o.push(e, new I(n));
2336
2350
  } else if (t.startsWith("/")) {
2337
- let e = t.slice(1).split("/").map((e) => new V(W(e)));
2338
- o.push(z.NULL, new L(e));
2351
+ let e = t.slice(1).split("/").map((e) => new B(W(e)));
2352
+ o.push(R.NULL, new I(e));
2339
2353
  } else {
2340
- let e = t.split("/").map((e) => new V(W(e)));
2341
- o.push(z.TRUE, new L(e));
2354
+ let e = t.split("/").map((e) => new B(W(e)));
2355
+ o.push(R.TRUE, new I(e));
2342
2356
  }
2343
2357
  } else if (t.startsWith("//")) {
2344
- let { authority: e, pathSegments: n } = jn(t);
2345
- o.push(z.FALSE, e, new L(n));
2358
+ let { authority: e, pathSegments: n } = Mn(t);
2359
+ o.push(R.FALSE, e, new I(n));
2346
2360
  } else if (t.startsWith("/")) {
2347
- let e = t.slice(1).split("/").map((e) => new V(W(e)));
2348
- o.push(z.TRUE, new L(e));
2349
- } else if (t === "") o.push(new A(0n));
2361
+ let e = t.slice(1).split("/").map((e) => new B(W(e)));
2362
+ o.push(R.TRUE, new I(e));
2363
+ } else if (t === "") o.push(new k(0n));
2350
2364
  else {
2351
2365
  let n = 1n, r = t, i = !1;
2352
2366
  for (r.startsWith("./") && (i = !0, r = r.slice(2)); r.startsWith("../");) n++, r = r.slice(3);
2353
2367
  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)}`);
2354
- let a = r === "" ? [] : r.split("/").map((e) => new V(W(e)));
2355
- o.push(new A(n), new L(a));
2368
+ let a = r === "" ? [] : r.split("/").map((e) => new B(W(e)));
2369
+ o.push(new k(n), new I(a));
2356
2370
  }
2357
- if (i !== null && o.push(new L(i)), n !== null && (i === null && o.push(z.NULL), o.push(new V(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
2371
+ if (i !== null && o.push(new I(i)), n !== null && (i === null && o.push(R.NULL), o.push(new B(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
2358
2372
  let e = o[o.length - 1];
2359
- e instanceof L && e.items.length === 0 && o.pop();
2373
+ e instanceof I && e.items.length === 0 && o.pop();
2360
2374
  }
2361
- return o.length === 1 && o[0] instanceof A && o[0].value === 0n ? [] : o;
2375
+ return o.length === 1 && o[0] instanceof k && o[0].value === 0n ? [] : o;
2362
2376
  }
2363
2377
  function K(e, t) {
2364
2378
  let n = t, r = "";
2365
2379
  if (n < e.length) {
2366
2380
  let t = e[n];
2367
- if (t instanceof L) {
2381
+ if (t instanceof I) {
2368
2382
  if (n++, t.items.length > 0) {
2369
2383
  let e = t.items.map((e) => {
2370
- if (!(e instanceof V)) throw Error("cri: query item must be a text string");
2371
- return G(e.value, Tn);
2384
+ if (!(e instanceof B)) throw Error("cri: query item must be a text string");
2385
+ return G(e.value, En);
2372
2386
  });
2373
2387
  r += "?" + e.join("&");
2374
2388
  }
2375
- } else t instanceof z && t.value === 22 && n++;
2389
+ } else t instanceof R && t.value === 22 && n++;
2376
2390
  }
2377
- return n < e.length && e[n] instanceof V && (r += "#" + G(e[n].value, En)), r;
2391
+ return n < e.length && e[n] instanceof B && (r += "#" + G(e[n].value, Dn)), r;
2378
2392
  }
2379
- function Nn(e) {
2393
+ function Pn(e) {
2380
2394
  return e.items.map((e) => {
2381
- if (!(e instanceof V)) throw Error("cri: path segment must be a text string");
2382
- return G(e.value, wn);
2395
+ if (!(e instanceof B)) throw Error("cri: path segment must be a text string");
2396
+ return G(e.value, Tn);
2383
2397
  });
2384
2398
  }
2385
- function Pn(e) {
2399
+ function Fn(e) {
2386
2400
  if (e.length === 0) return "";
2387
2401
  let t = 0, n = e[t++];
2388
- if (n instanceof j || n instanceof V) {
2402
+ if (n instanceof A || n instanceof B) {
2389
2403
  let r;
2390
- if (n instanceof j) {
2391
- let e = vn.get(n.value);
2404
+ if (n instanceof A) {
2405
+ let e = yn.get(n.value);
2392
2406
  if (e === void 0) throw Error(`cri: unrecognised scheme-id ${n.value}`);
2393
2407
  r = e + ":";
2394
2408
  } else r = n.value + ":";
2395
2409
  if (t >= e.length) return r;
2396
2410
  let i = e[t++], a = "", o = !1;
2397
- if (i instanceof L) a = "//" + An(i), o = !0;
2398
- else if (i instanceof z) if (i.value === 22) o = !0;
2411
+ if (i instanceof I) a = "//" + jn(i), o = !0;
2412
+ else if (i instanceof R) if (i.value === 22) o = !0;
2399
2413
  else if (i.value === 21) o = !1;
2400
2414
  else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);
2401
2415
  else throw Error("cri: unexpected type for authority element");
2402
2416
  let s = "";
2403
- if (t < e.length && e[t] instanceof L) {
2417
+ if (t < e.length && e[t] instanceof I) {
2404
2418
  let n = e[t++];
2405
- n.items.length > 0 && (s = (o ? "/" : "") + Nn(n).join("/"));
2419
+ n.items.length > 0 && (s = (o ? "/" : "") + Pn(n).join("/"));
2406
2420
  }
2407
2421
  return r + a + s + K(e, t);
2408
2422
  }
2409
- if (n instanceof z && n.value === 20) {
2410
- if (t >= e.length || !(e[t] instanceof L)) throw Error("cri: network-path reference requires an authority array");
2411
- let n = An(e[t++]), r = "";
2412
- if (t < e.length && e[t] instanceof L) {
2423
+ if (n instanceof R && n.value === 20) {
2424
+ if (t >= e.length || !(e[t] instanceof I)) throw Error("cri: network-path reference requires an authority array");
2425
+ let n = jn(e[t++]), r = "";
2426
+ if (t < e.length && e[t] instanceof I) {
2413
2427
  let n = e[t++];
2414
- n.items.length > 0 && (r = "/" + Nn(n).join("/"));
2428
+ n.items.length > 0 && (r = "/" + Pn(n).join("/"));
2415
2429
  }
2416
2430
  return "//" + n + r + K(e, t);
2417
2431
  }
2418
- if (n instanceof z && n.value === 21) {
2432
+ if (n instanceof R && n.value === 21) {
2419
2433
  let n = "/";
2420
- if (t < e.length && e[t] instanceof L) {
2434
+ if (t < e.length && e[t] instanceof I) {
2421
2435
  let r = e[t++];
2422
- n = "/" + Nn(r).join("/");
2436
+ n = "/" + Pn(r).join("/");
2423
2437
  }
2424
2438
  return n + K(e, t);
2425
2439
  }
2426
- if (n instanceof A) {
2440
+ if (n instanceof k) {
2427
2441
  let r = n.value;
2428
2442
  if (r === 0n) return K(e, t);
2429
2443
  let i = r === 1n ? "" : "../".repeat(Number(r) - 1), a;
2430
- if (t < e.length && e[t] instanceof L) {
2444
+ if (t < e.length && e[t] instanceof I) {
2431
2445
  let n = e[t++];
2432
2446
  if (n.items.length > 0) {
2433
- let e = Nn(n);
2447
+ let e = Pn(n);
2434
2448
  a = (r === 1n && e[0].includes(":") ? "./" : i) + e.join("/");
2435
2449
  } else a = i === "" ? "./" : i;
2436
2450
  } else a = i === "" ? "./" : i;
@@ -2438,86 +2452,86 @@ function Pn(e) {
2438
2452
  }
2439
2453
  throw Error("cri: unrecognised first element type in CRI array");
2440
2454
  }
2441
- var Fn = class extends L {
2455
+ var In = class extends I {
2442
2456
  _toCDN(e, t) {
2443
2457
  if (e?.appStrings === !1) return super._toCDN(e, t);
2444
2458
  try {
2445
- let t = S(e, this.encodingWidth, () => x(BigInt(this.items.length)));
2446
- return `${mn}'${Pn(this.items)}'${t}`;
2459
+ let t = x(e, this.encodingWidth, () => b(BigInt(this.items.length)));
2460
+ return `${hn}'${Fn(this.items)}'${t}`;
2447
2461
  } catch {
2448
2462
  return super._toCDN(e, t);
2449
2463
  }
2450
2464
  }
2451
- }, In = class extends N {
2465
+ }, Ln = class extends M {
2452
2466
  constructor(e) {
2453
- super(gn, e);
2467
+ super(_n, e);
2454
2468
  }
2455
2469
  _toCDN(e, t) {
2456
2470
  if (e?.appStrings === !1) return super._toCDN(e, t);
2457
2471
  try {
2458
2472
  let n = this.content;
2459
2473
  if (n.encodingWidth !== void 0) return super._toCDN(e, t);
2460
- let r = S(e, this.encodingWidth, () => x(gn));
2461
- return `${hn}'${Pn(n.items)}'${r}`;
2474
+ let r = x(e, this.encodingWidth, () => b(_n));
2475
+ return `${gn}'${Fn(n.items)}'${r}`;
2462
2476
  } catch {
2463
2477
  return super._toCDN(e, t);
2464
2478
  }
2465
2479
  }
2466
2480
  };
2467
- function Ln(e) {
2481
+ function Rn(e) {
2468
2482
  if (e.length !== 1) throw SyntaxError("cri<<...>>: expected exactly one item");
2469
2483
  let t = e[0];
2470
- if (t instanceof V) return t.value;
2471
- if (t instanceof P) return bn.decode(t.value);
2484
+ if (t instanceof B) return t.value;
2485
+ if (t instanceof N) return xn.decode(t.value);
2472
2486
  throw SyntaxError("cri<<...>>: expected a text string or byte string");
2473
2487
  }
2474
- function Rn(e, t) {
2475
- let n = new Fn(Mn(t));
2476
- return e === hn ? new In(n) : n;
2488
+ function zn(e, t) {
2489
+ let n = new In(Nn(t));
2490
+ return e === gn ? new Ln(n) : n;
2477
2491
  }
2478
- var zn = {
2479
- appStringPrefixes: [mn, hn],
2480
- tagNumbers: [gn],
2492
+ var Bn = {
2493
+ appStringPrefixes: [hn, gn],
2494
+ tagNumbers: [_n],
2481
2495
  parseAppString(e, t) {
2482
- return Rn(e, t);
2496
+ return zn(e, t);
2483
2497
  },
2484
2498
  parseAppSequence(e, t) {
2485
- return Rn(e, Ln(t));
2499
+ return zn(e, Rn(t));
2486
2500
  },
2487
2501
  parseTag(e, t) {
2488
- if (e !== 99n || !(t instanceof L)) return;
2489
- let n = new Fn(t.items, {
2502
+ if (e !== 99n || !(t instanceof I)) return;
2503
+ let n = new In(t.items, {
2490
2504
  indefiniteLength: t.indefiniteLength,
2491
2505
  encodingWidth: t.encodingWidth
2492
2506
  });
2493
- return n.start = t.start, n.end = t.end, new In(n);
2507
+ return n.start = t.start, n.end = t.end, new Ln(n);
2494
2508
  }
2495
2509
  };
2496
2510
  //#endregion
2497
2511
  //#region src/cbor/decoder.ts
2498
- function Bn(e, t) {
2512
+ function Vn(e, t) {
2499
2513
  if (e === 24 && t <= 23n) return 0;
2500
2514
  if (e === 25 && t <= 255n) return 1;
2501
2515
  if (e === 26 && t <= 65535n) return 2;
2502
2516
  if (e === 27 && t <= 4294967295n) return 3;
2503
2517
  }
2504
- function Vn(e, t) {
2518
+ function Hn(e, t) {
2505
2519
  if (e === 24 && t <= 23) return 0;
2506
2520
  if (e === 25 && t <= 255) return 1;
2507
2521
  if (e === 26 && t <= 65535) return 2;
2508
2522
  if (e === 27 && t <= 4294967295) return 3;
2509
2523
  }
2510
- var Hn = new TextDecoder("utf-8", {
2524
+ var Un = new TextDecoder("utf-8", {
2511
2525
  fatal: !0,
2512
2526
  ignoreBOM: !0
2513
- }), Un = new TextDecoder("utf-8", {
2527
+ }), Wn = new TextDecoder("utf-8", {
2514
2528
  fatal: !1,
2515
2529
  ignoreBOM: !0
2516
2530
  });
2517
2531
  function q(e) {
2518
2532
  throw Error(`CBOR decode error: ${e}`);
2519
2533
  }
2520
- function Wn(e, t, n) {
2534
+ function Gn(e, t, n) {
2521
2535
  let r = {
2522
2536
  message: e,
2523
2537
  offset: t
@@ -2529,59 +2543,59 @@ function J(e, t) {
2529
2543
  e.warnings ??= [], e.warnings.push(t);
2530
2544
  }
2531
2545
  function Y(e) {
2532
- if (e instanceof A) return ["u", String(e.value)];
2533
- if (e instanceof j) return ["n", String(e.value)];
2534
- if (e instanceof V) return ["t", e.value];
2535
- if (e instanceof I) return ["t", e.chunks.map((e) => e.value).join("")];
2536
- if (e instanceof P) return ["b", i(e.value)];
2537
- if (e instanceof F) {
2546
+ if (e instanceof k) return ["u", String(e.value)];
2547
+ if (e instanceof A) return ["n", String(e.value)];
2548
+ if (e instanceof B) return ["t", e.value];
2549
+ if (e instanceof F) return ["t", e.chunks.map((e) => e.value).join("")];
2550
+ if (e instanceof N) return ["b", i(e.value)];
2551
+ if (e instanceof P) {
2538
2552
  let t = "";
2539
2553
  for (let n of e.chunks) t += i(n.value);
2540
2554
  return ["b", t];
2541
2555
  }
2542
- if (e instanceof M) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
2543
- if (e instanceof z) return ["s", e.value];
2544
- if (e instanceof L) return ["A", e.items.map(Y)];
2545
- if (e instanceof R) {
2556
+ if (e instanceof j) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
2557
+ if (e instanceof R) return ["s", e.value];
2558
+ if (e instanceof I) return ["A", e.items.map(Y)];
2559
+ if (e instanceof L) {
2546
2560
  let t = e.entries.map(([e, t]) => [Y(e), Y(t)]);
2547
2561
  if (t.length <= 1) return ["M", t];
2548
2562
  let n = t.map((e) => [JSON.stringify(e[0]), e]);
2549
2563
  return n.sort((e, t) => e[0] < t[0] ? -1 : +(e[0] > t[0])), ["M", n.map((e) => e[1])];
2550
2564
  }
2551
- return e instanceof N ? [
2565
+ return e instanceof M ? [
2552
2566
  "G",
2553
2567
  String(e.tag),
2554
2568
  Y(e.content)
2555
2569
  ] : ["c", i(e.toCBOR())];
2556
2570
  }
2557
- function Gn(e) {
2558
- if (e instanceof A) return "u" + e.value;
2559
- if (e instanceof j) return "n" + e.value;
2560
- if (e instanceof V) return "t" + e.value;
2561
- if (e instanceof I) {
2571
+ function Kn(e) {
2572
+ if (e instanceof k) return "u" + e.value;
2573
+ if (e instanceof A) return "n" + e.value;
2574
+ if (e instanceof B) return "t" + e.value;
2575
+ if (e instanceof F) {
2562
2576
  let t = "t";
2563
2577
  for (let n of e.chunks) t += n.value;
2564
2578
  return t;
2565
2579
  }
2566
- if (e instanceof P) return "b" + i(e.value);
2567
- if (e instanceof F) {
2580
+ if (e instanceof N) return "b" + i(e.value);
2581
+ if (e instanceof P) {
2568
2582
  let t = "b";
2569
2583
  for (let n of e.chunks) t += i(n.value);
2570
2584
  return t;
2571
2585
  }
2572
- return e instanceof M ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof z ? "s" + e.value : JSON.stringify(Y(e));
2586
+ return e instanceof j ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof R ? "s" + e.value : JSON.stringify(Y(e));
2573
2587
  }
2574
- var Kn = Array.from({ length: 24 }, (e, t) => BigInt(t)), qn;
2575
- function Jn() {
2576
- return qn ??= Z.filter((e) => e.parseTag !== void 0);
2588
+ var qn = Array.from({ length: 24 }, (e, t) => BigInt(t)), Jn;
2589
+ function Yn() {
2590
+ return Jn ??= Fr.filter((e) => e.parseTag !== void 0);
2577
2591
  }
2578
- function Yn(e, t) {
2592
+ function Xn(e, t) {
2579
2593
  for (let n = 0; n < t; n++) if (e[n] >= 128) return;
2580
2594
  return String.fromCharCode.apply(null, e);
2581
2595
  }
2582
- function Xn(e, t, n) {
2596
+ function Zn(e, t, n) {
2583
2597
  if (n <= 23) return {
2584
- value: Kn[n],
2598
+ value: qn[n],
2585
2599
  nextOffset: t
2586
2600
  };
2587
2601
  switch (n) {
@@ -2604,7 +2618,7 @@ function Xn(e, t, n) {
2604
2618
  default: q(`reserved additional info value: ${n}`);
2605
2619
  }
2606
2620
  }
2607
- function Zn(e, t, n) {
2621
+ function Qn(e, t, n) {
2608
2622
  if (n <= 23) return {
2609
2623
  value: n,
2610
2624
  nextOffset: t
@@ -2633,7 +2647,7 @@ function Zn(e, t, n) {
2633
2647
  default: q(`reserved additional info value: ${n}`);
2634
2648
  }
2635
2649
  }
2636
- function Qn(e, t, n, r, i, a) {
2650
+ function $n(e, t, n, r, i, a) {
2637
2651
  let o = [], s = t;
2638
2652
  for (;;) {
2639
2653
  if (s >= e.byteLength && q(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
@@ -2648,67 +2662,67 @@ function Qn(e, t, n, r, i, a) {
2648
2662
  nextOffset: s
2649
2663
  };
2650
2664
  }
2651
- function $n(e, t, n, r) {
2652
- let i = Gn(e);
2653
- t.has(i) && n.push(Wn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
2665
+ function er(e, t, n, r) {
2666
+ let i = Kn(e);
2667
+ t.has(i) && n.push(Gn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
2654
2668
  }
2655
2669
  function X(e, t, n, r) {
2656
- let i = t, a = tr(e, t, n, r);
2670
+ let i = t, a = nr(e, t, n, r);
2657
2671
  return a.value.start = i, a.value.end = a.nextOffset, a;
2658
2672
  }
2659
- function er(e, t, n) {
2673
+ function tr(e, t, n) {
2660
2674
  return new Uint8Array(e.buffer, e.byteOffset + t, n).slice();
2661
2675
  }
2662
- function tr(e, t, n, r) {
2676
+ function nr(e, t, n, r) {
2663
2677
  t >= e.byteLength && q("unexpected end of input");
2664
2678
  let i = e.getUint8(t++), a = i >> 5, o = i & 31;
2665
2679
  switch (a) {
2666
2680
  case 0: {
2667
- let { value: n, nextOffset: r } = Xn(e, t, o);
2681
+ let { value: n, nextOffset: r } = Zn(e, t, o);
2668
2682
  return {
2669
- value: new A(n, { encodingWidth: Bn(o, n) }),
2683
+ value: new k(n, { encodingWidth: Vn(o, n) }),
2670
2684
  nextOffset: r
2671
2685
  };
2672
2686
  }
2673
2687
  case 1: {
2674
- let { value: n, nextOffset: r } = Xn(e, t, o), i = Bn(o, n);
2688
+ let { value: n, nextOffset: r } = Zn(e, t, o), i = Vn(o, n);
2675
2689
  return {
2676
- value: new j(-1n - n, { encodingWidth: i }),
2690
+ value: new A(-1n - n, { encodingWidth: i }),
2677
2691
  nextOffset: r
2678
2692
  };
2679
2693
  }
2680
2694
  case 2: {
2681
2695
  if (o === 31) {
2682
- let { chunks: i, nextOffset: a } = Qn(e, t, n, r, "byte string", (e) => e instanceof P);
2696
+ let { chunks: i, nextOffset: a } = $n(e, t, n, r, "byte string", (e) => e instanceof N);
2683
2697
  return {
2684
- value: new F(i),
2698
+ value: new P(i),
2685
2699
  nextOffset: a
2686
2700
  };
2687
2701
  }
2688
- let { value: i, nextOffset: a } = Zn(e, t, o), s = Vn(o, i);
2702
+ let { value: i, nextOffset: a } = Qn(e, t, o), s = Hn(o, i);
2689
2703
  return a + i > e.byteLength && q("byte string extends beyond input"), {
2690
- value: new P(new Uint8Array(e.buffer, e.byteOffset + a, i).slice(), { encodingWidth: s }),
2704
+ value: new N(new Uint8Array(e.buffer, e.byteOffset + a, i).slice(), { encodingWidth: s }),
2691
2705
  nextOffset: a + i
2692
2706
  };
2693
2707
  }
2694
2708
  case 3: {
2695
2709
  if (o === 31) {
2696
- let { chunks: i, nextOffset: a } = Qn(e, t, n, r, "text string", (e) => e instanceof V);
2710
+ let { chunks: i, nextOffset: a } = $n(e, t, n, r, "text string", (e) => e instanceof B);
2697
2711
  return {
2698
- value: new I(i),
2712
+ value: new F(i),
2699
2713
  nextOffset: a
2700
2714
  };
2701
2715
  }
2702
- let { value: i, nextOffset: a } = Zn(e, t, o), s = Vn(o, i);
2716
+ let { value: i, nextOffset: a } = Qn(e, t, o), s = Hn(o, i);
2703
2717
  a + i > e.byteLength && q("text string extends beyond input");
2704
- let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? Yn(c, i) : void 0;
2718
+ let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? Xn(c, i) : void 0;
2705
2719
  if (d !== void 0) l = d;
2706
2720
  else try {
2707
- l = Hn.decode(c);
2721
+ l = Un.decode(c);
2708
2722
  } catch {
2709
- u = Wn("invalid UTF-8 sequence in text string", a, n), l = Un.decode(c);
2723
+ u = Gn("invalid UTF-8 sequence in text string", a, n), l = Wn.decode(c);
2710
2724
  }
2711
- let f = new V(l, { encodingWidth: s });
2725
+ let f = new B(l, { encodingWidth: s });
2712
2726
  return u && J(f, u), {
2713
2727
  value: f,
2714
2728
  nextOffset: a + i
@@ -2726,17 +2740,17 @@ function tr(e, t, n, r) {
2726
2740
  i.push(t.value), a = t.nextOffset;
2727
2741
  }
2728
2742
  return {
2729
- value: new L(i, { indefiniteLength: !0 }),
2743
+ value: new I(i, { indefiniteLength: !0 }),
2730
2744
  nextOffset: a
2731
2745
  };
2732
2746
  }
2733
- let { value: i, nextOffset: a } = Zn(e, t, o), s = Vn(o, i), c = [], l = a;
2747
+ let { value: i, nextOffset: a } = Qn(e, t, o), s = Hn(o, i), c = [], l = a;
2734
2748
  for (let t = 0; t < i; t++) {
2735
2749
  let t = X(e, l, n, r);
2736
2750
  c.push(t.value), l = t.nextOffset;
2737
2751
  }
2738
2752
  return {
2739
- value: new L(c, { encodingWidth: s }),
2753
+ value: new I(c, { encodingWidth: s }),
2740
2754
  nextOffset: l
2741
2755
  };
2742
2756
  }
@@ -2749,25 +2763,25 @@ function tr(e, t, n, r) {
2749
2763
  break;
2750
2764
  }
2751
2765
  let t = X(e, s, n, r);
2752
- $n(t.value, a, o, n), s = t.nextOffset;
2766
+ er(t.value, a, o, n), s = t.nextOffset;
2753
2767
  let c = X(e, s, n, r);
2754
2768
  s = c.nextOffset, i.push([t.value, c.value]);
2755
2769
  }
2756
- let c = new R(i, { indefiniteLength: !0 });
2770
+ let c = new L(i, { indefiniteLength: !0 });
2757
2771
  for (let e of o) J(c, e);
2758
2772
  return {
2759
2773
  value: c,
2760
2774
  nextOffset: s
2761
2775
  };
2762
2776
  }
2763
- let { value: i, nextOffset: a } = Zn(e, t, o), s = Vn(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
2777
+ let { value: i, nextOffset: a } = Qn(e, t, o), s = Hn(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
2764
2778
  for (let t = 0; t < i; t++) {
2765
2779
  let t = X(e, d, n, r);
2766
- $n(t.value, l, u, n), d = t.nextOffset;
2780
+ er(t.value, l, u, n), d = t.nextOffset;
2767
2781
  let i = X(e, d, n, r);
2768
2782
  d = i.nextOffset, c.push([t.value, i.value]);
2769
2783
  }
2770
- let f = new R(c, { encodingWidth: s });
2784
+ let f = new L(c, { encodingWidth: s });
2771
2785
  for (let e of u) J(f, e);
2772
2786
  return {
2773
2787
  value: f,
@@ -2776,62 +2790,62 @@ function tr(e, t, n, r) {
2776
2790
  }
2777
2791
  case 6: {
2778
2792
  o === 31 && q("tags cannot use indefinite-length encoding");
2779
- let { value: i, nextOffset: a } = Xn(e, t, o), s = Bn(o, i), c = X(e, a, n, r);
2793
+ let { value: i, nextOffset: a } = Zn(e, t, o), s = Vn(o, i), c = X(e, a, n, r);
2780
2794
  for (let e of r) {
2781
2795
  let t = e.parseTag(i, c.value, n);
2782
- if (t !== void 0) return t instanceof N && s !== void 0 && (t.encodingWidth = s), {
2796
+ if (t !== void 0) return t instanceof M && s !== void 0 && (t.encodingWidth = s), {
2783
2797
  value: t,
2784
2798
  nextOffset: c.nextOffset
2785
2799
  };
2786
2800
  }
2787
2801
  return {
2788
- value: new N(i, c.value, { encodingWidth: s }),
2802
+ value: new M(i, c.value, { encodingWidth: s }),
2789
2803
  nextOffset: c.nextOffset
2790
2804
  };
2791
2805
  }
2792
2806
  case 7:
2793
2807
  if (o <= 19) return {
2794
- value: new z(o),
2808
+ value: new R(o),
2795
2809
  nextOffset: t
2796
2810
  };
2797
2811
  if (o === 20) return {
2798
- value: new z(20),
2812
+ value: new R(20),
2799
2813
  nextOffset: t
2800
2814
  };
2801
2815
  if (o === 21) return {
2802
- value: new z(21),
2816
+ value: new R(21),
2803
2817
  nextOffset: t
2804
2818
  };
2805
2819
  if (o === 22) return {
2806
- value: new z(22),
2820
+ value: new R(22),
2807
2821
  nextOffset: t
2808
2822
  };
2809
2823
  if (o === 23) return {
2810
- value: new z(23),
2824
+ value: new R(23),
2811
2825
  nextOffset: t
2812
2826
  };
2813
2827
  if (o === 24) {
2814
2828
  t + 1 > e.byteLength && q("unexpected end of input");
2815
2829
  let r = e.getUint8(t);
2816
2830
  if (r < 32) {
2817
- let e = Wn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new z(r);
2831
+ let e = Gn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new R(r);
2818
2832
  return J(i, e), {
2819
2833
  value: i,
2820
2834
  nextOffset: t + 1
2821
2835
  };
2822
2836
  }
2823
2837
  return {
2824
- value: new z(r),
2838
+ value: new R(r),
2825
2839
  nextOffset: t + 1
2826
2840
  };
2827
2841
  }
2828
2842
  if (o === 25) {
2829
2843
  t + 2 > e.byteLength && q("unexpected end of input");
2830
- let n = w(e.getUint16(t, !1));
2844
+ let n = C(e.getUint16(t, !1));
2831
2845
  return {
2832
- value: new M(n, {
2846
+ value: new j(n, {
2833
2847
  precision: "half",
2834
- rawBits: Number.isNaN(n) ? er(e, t, 2) : void 0
2848
+ rawBits: Number.isNaN(n) ? tr(e, t, 2) : void 0
2835
2849
  }),
2836
2850
  nextOffset: t + 2
2837
2851
  };
@@ -2840,9 +2854,9 @@ function tr(e, t, n, r) {
2840
2854
  t + 4 > e.byteLength && q("unexpected end of input");
2841
2855
  let n = e.getFloat32(t, !1);
2842
2856
  return {
2843
- value: new M(n, {
2857
+ value: new j(n, {
2844
2858
  precision: "single",
2845
- rawBits: Number.isNaN(n) ? er(e, t, 4) : void 0
2859
+ rawBits: Number.isNaN(n) ? tr(e, t, 4) : void 0
2846
2860
  }),
2847
2861
  nextOffset: t + 4
2848
2862
  };
@@ -2851,9 +2865,9 @@ function tr(e, t, n, r) {
2851
2865
  t + 8 > e.byteLength && q("unexpected end of input");
2852
2866
  let n = e.getFloat64(t, !1);
2853
2867
  return {
2854
- value: new M(n, {
2868
+ value: new j(n, {
2855
2869
  precision: "double",
2856
- rawBits: Number.isNaN(n) ? er(e, t, 8) : void 0
2870
+ rawBits: Number.isNaN(n) ? tr(e, t, 8) : void 0
2857
2871
  }),
2858
2872
  nextOffset: t + 8
2859
2873
  };
@@ -2862,17 +2876,17 @@ function tr(e, t, n, r) {
2862
2876
  }
2863
2877
  return q(`unknown major type: ${a}`);
2864
2878
  }
2865
- function nr(e) {
2879
+ function rr(e) {
2866
2880
  if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new Uint8Array(e);
2867
2881
  if (ArrayBuffer.isView(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
2868
2882
  throw TypeError("expected ArrayBufferView or ArrayBufferLike");
2869
2883
  }
2870
- function rr(e, t) {
2871
- let n = nr(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
2884
+ function ir(e, t) {
2885
+ let n = rr(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
2872
2886
  if (!Number.isInteger(i) || i < 0 || i > r.byteLength) throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);
2873
- let a = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...Jn()] : Jn(), { value: o, nextOffset: s } = X(r, i, t, a);
2887
+ let a = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...Yn()] : Yn(), { value: o, nextOffset: s } = X(r, i, t, a);
2874
2888
  if (!t?.allowTrailing && s !== r.byteLength) {
2875
- J(o, Wn(`${r.byteLength - s} trailing byte(s) after end of CBOR item`, s, t));
2889
+ J(o, Gn(`${r.byteLength - s} trailing byte(s) after end of CBOR item`, s, t));
2876
2890
  let e = {
2877
2891
  strict: !1,
2878
2892
  silent: !0
@@ -2883,49 +2897,340 @@ function rr(e, t) {
2883
2897
  }
2884
2898
  //#endregion
2885
2899
  //#region src/extensions/cbordata.ts
2886
- var ir = 24n, Z = [
2887
- Gt,
2888
- un,
2889
- pn,
2890
- zn,
2891
- {
2892
- tagNumbers: [ir],
2893
- parseTag(e, t, n) {
2894
- if (e !== 24n || !(t instanceof P)) return;
2895
- let r = n ? {
2896
- extensions: n.extensions,
2897
- strict: n.strict,
2898
- onWarning: n.onWarning,
2899
- silent: n.silent
2900
- } : void 0;
2901
- try {
2902
- return new N(ir, new He([rr(t.value, r)], { encodingWidth: t.encodingWidth }));
2903
- } catch (e) {
2904
- if (r?.strict !== !1) throw e;
2905
- return;
2900
+ var ar = 24n, or = {
2901
+ tagNumbers: [ar],
2902
+ parseTag(e, t, n) {
2903
+ if (e !== 24n || !(t instanceof N)) return;
2904
+ let r = n ? {
2905
+ extensions: n.extensions,
2906
+ strict: n.strict,
2907
+ onWarning: n.onWarning,
2908
+ silent: n.silent
2909
+ } : void 0;
2910
+ try {
2911
+ return new M(ar, new Ue([ir(t.value, r)], { encodingWidth: t.encodingWidth }));
2912
+ } catch (e) {
2913
+ if (r?.strict !== !1) throw e;
2914
+ return;
2915
+ }
2916
+ }
2917
+ }, sr = new TextEncoder(), cr = new TextDecoder("utf-8", { fatal: !0 }), lr = new TextDecoder("utf-8", { fatal: !1 }), ur = Symbol("ellipsis");
2918
+ function dr(e) {
2919
+ let t = 0;
2920
+ for (let n of e) t += n.length;
2921
+ let n = new Uint8Array(t), r = 0;
2922
+ for (let t of e) n.set(t, r), r += t.length;
2923
+ return n;
2924
+ }
2925
+ function fr(e, t, n) {
2926
+ if (t instanceof Ke) {
2927
+ fr(e, t.inner, n);
2928
+ return;
2929
+ }
2930
+ if (t instanceof z) {
2931
+ if (t.content instanceof I) for (let r of t.content.items) fr(e, r, n);
2932
+ else n.push(ur);
2933
+ return;
2934
+ }
2935
+ if (t instanceof B) {
2936
+ n.push(sr.encode(t.value));
2937
+ return;
2938
+ }
2939
+ if (t instanceof N) {
2940
+ n.push(t.value);
2941
+ return;
2942
+ }
2943
+ if (t instanceof F) {
2944
+ n.push(sr.encode(t.chunks.map((e) => e.value).join("")));
2945
+ return;
2946
+ }
2947
+ if (t instanceof P) {
2948
+ n.push(dr(t.chunks.map((e) => e.value)));
2949
+ return;
2950
+ }
2951
+ throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings or ellipses`);
2952
+ }
2953
+ function pr(e, t) {
2954
+ try {
2955
+ return cr.decode(e);
2956
+ } catch {
2957
+ let n = "t1 concatenation result is not valid UTF-8";
2958
+ if (t) t(n);
2959
+ else throw SyntaxError(n);
2960
+ return lr.decode(e);
2961
+ }
2962
+ }
2963
+ function mr(e, t, n) {
2964
+ let r = [];
2965
+ for (let n of t) fr(e, n, r);
2966
+ let i = e === "t1", a = [], o = !1, s = [], c = () => {
2967
+ if (s.length === 0) return;
2968
+ let e = dr(s);
2969
+ s.length = 0, e.length !== 0 && a.push(i ? new B(pr(e, n)) : new N(e));
2970
+ };
2971
+ for (let e of r) e === ur ? (c(), a[a.length - 1] instanceof z || (a.push(new z()), o = !0)) : s.push(e);
2972
+ if (!o) {
2973
+ let e = dr(s);
2974
+ return i ? new B(pr(e, n)) : new N(e);
2975
+ }
2976
+ return c(), a.length === 1 ? new z() : new z(a);
2977
+ }
2978
+ function hr(e) {
2979
+ return {
2980
+ appStringPrefixes: [e],
2981
+ preserveAppSeqSource: !0,
2982
+ parseAppString(t, n, r) {
2983
+ return mr(e, [new B(n)], r);
2984
+ },
2985
+ parseAppSequence(t, n, r) {
2986
+ return mr(e, n, r);
2987
+ }
2988
+ };
2989
+ }
2990
+ var gr = hr("t1"), _r = hr("b1"), vr = new TextEncoder(), yr = new TextDecoder("utf-8", { fatal: !0 }), br = new TextDecoder("utf-8", { fatal: !1 });
2991
+ function xr(e) {
2992
+ let t = 0;
2993
+ for (let n of e) t += n.length;
2994
+ let n = new Uint8Array(t), r = 0;
2995
+ for (let t of e) n.set(t, r), r += t.length;
2996
+ return n;
2997
+ }
2998
+ function Sr(e, t, n) {
2999
+ let r = e === "ilts", i = [], a = [];
3000
+ for (let o of t) {
3001
+ if (o instanceof Ke && (o = o.inner), o instanceof z) throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);
3002
+ let t, s, c;
3003
+ if (o instanceof B) t = o.value, c = o.encodingWidth;
3004
+ else if (o instanceof N) s = o.value, c = o.encodingWidth;
3005
+ else if (o instanceof F) t = o.chunks.map((e) => e.value).join("");
3006
+ else if (o instanceof P) s = xr(o.chunks.map((e) => e.value));
3007
+ else throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings`);
3008
+ if (r) {
3009
+ let e;
3010
+ if (t !== void 0) e = t;
3011
+ else try {
3012
+ e = yr.decode(s);
3013
+ } catch {
3014
+ let t = "ilts chunk is not valid UTF-8";
3015
+ if (n) n(t);
3016
+ else throw SyntaxError(t);
3017
+ e = br.decode(s);
2906
3018
  }
3019
+ a.push(new B(e, c === void 0 ? void 0 : { encodingWidth: c }));
3020
+ } else {
3021
+ let e = s ?? vr.encode(t);
3022
+ i.push(new N(e, c === void 0 ? void 0 : { encodingWidth: c }));
2907
3023
  }
2908
3024
  }
2909
- ], ar;
2910
- function or() {
2911
- return ar ??= {
2912
- fromJS: Z.filter((e) => e.fromJS !== void 0),
2913
- parseTag: Z.filter((e) => e.parseTag !== void 0)
3025
+ return r ? new F(a) : new P(i);
3026
+ }
3027
+ function Cr(e) {
3028
+ return {
3029
+ appStringPrefixes: [e],
3030
+ preserveAppSeqSource: !0,
3031
+ parseAppString(t, n, r) {
3032
+ return new Ke(Sr(e, [new B(n)], r), `${e}${xe(n)}`);
3033
+ },
3034
+ parseAppSequence(t, n, r) {
3035
+ return Sr(e, n, r);
3036
+ }
3037
+ };
3038
+ }
3039
+ var wr = Cr("ilbs"), Tr = Cr("ilts");
3040
+ //#endregion
3041
+ //#region src/utils/strip-comments.ts
3042
+ function Er(e) {
3043
+ let t = "", n = 0;
3044
+ for (; n < e.length;) {
3045
+ let r = e[n];
3046
+ if (r === " " || r === "\n" || r === "\r") {
3047
+ n++;
3048
+ continue;
3049
+ }
3050
+ if (r === "#") {
3051
+ for (; n < e.length && e[n] !== "\n";) n++;
3052
+ continue;
3053
+ }
3054
+ if (r === "/") {
3055
+ let t = e[n + 1] ?? "";
3056
+ if (t === "/") {
3057
+ for (; n < e.length && e[n] !== "\n";) n++;
3058
+ continue;
3059
+ }
3060
+ if (t === "*") {
3061
+ for (n += 2; n < e.length && !(e[n] === "*" && (e[n + 1] ?? "") === "/");) n++;
3062
+ if (n >= e.length) throw SyntaxError("unterminated block comment");
3063
+ n += 2;
3064
+ continue;
3065
+ }
3066
+ for (n++; n < e.length && e[n] !== "/";) n++;
3067
+ if (n >= e.length) throw SyntaxError("unterminated block comment");
3068
+ n++;
3069
+ continue;
3070
+ }
3071
+ t += r, n++;
3072
+ }
3073
+ return t;
3074
+ }
3075
+ //#endregion
3076
+ //#region src/extensions/float.ts
3077
+ var Dr = class extends j {
3078
+ _bits;
3079
+ constructor(e) {
3080
+ super(C(e), { precision: "half" }), this._bits = e & 65535;
3081
+ }
3082
+ _toCBOR() {
3083
+ return new Uint8Array([
3084
+ 249,
3085
+ this._bits >> 8 & 255,
3086
+ this._bits & 255
3087
+ ]);
3088
+ }
3089
+ }, Or = class extends j {
3090
+ _raw;
3091
+ constructor(e) {
3092
+ super(new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), { precision: "single" }), this._raw = e.slice();
3093
+ }
3094
+ _toCBOR() {
3095
+ let e = /* @__PURE__ */ new Uint8Array(5);
3096
+ return e[0] = 250, e.set(this._raw, 1), e;
3097
+ }
3098
+ }, kr = class extends j {
3099
+ _raw;
3100
+ constructor(e) {
3101
+ super(new DataView(e.buffer, e.byteOffset).getFloat64(0, !1), { precision: "double" }), this._raw = e.slice();
3102
+ }
3103
+ _toCBOR() {
3104
+ let e = /* @__PURE__ */ new Uint8Array(9);
3105
+ return e[0] = 251, e.set(this._raw, 1), e;
3106
+ }
3107
+ };
3108
+ function Z(e) {
3109
+ if (e.length === 2) return new Dr(e[0] << 8 | e[1]);
3110
+ if (e.length === 4) return new Or(e);
3111
+ if (e.length === 8) return new kr(e);
3112
+ throw SyntaxError(`float'...' requires 4, 8, or 16 hex digits (2, 4, or 8 bytes); got ${e.length} bytes`);
3113
+ }
3114
+ function Ar(e) {
3115
+ let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i;
3116
+ if (n === 31) i = t << 31 | 2139095040 | r << 13;
3117
+ else if (n === 0 && r === 0) i = t << 31;
3118
+ else if (n === 0) {
3119
+ let e = r, n = 0;
3120
+ for (; !(e & 512);) e <<= 1, n++;
3121
+ i = t << 31 | 112 - n << 23 | (e & 511) << 14;
3122
+ } else i = t << 31 | n + 112 << 23 | r << 13;
3123
+ let a = /* @__PURE__ */ new Uint8Array(4);
3124
+ return new DataView(a.buffer).setUint32(0, i >>> 0, !1), a;
3125
+ }
3126
+ function jr(e) {
3127
+ let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i = /* @__PURE__ */ new Uint8Array(8), a = new DataView(i.buffer);
3128
+ if (n === 31) a.setUint32(0, (t << 31 | 2146435072 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
3129
+ else if (n === 0 && r === 0) a.setUint32(0, t << 31 >>> 0, !1), a.setUint32(4, 0, !1);
3130
+ else if (n === 0) {
3131
+ let e = r, n = 0;
3132
+ for (; !(e & 512);) e <<= 1, n++;
3133
+ a.setUint32(0, (t << 31 | 1008 - n << 20 | (e & 511) << 11) >>> 0, !1), a.setUint32(4, 0, !1);
3134
+ } else a.setUint32(0, (t << 31 | n + 1008 << 20 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
3135
+ return i;
3136
+ }
3137
+ function Mr(e) {
3138
+ 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);
3139
+ if (r === 255) o.setUint32(0, (n << 31 | 2146435072 | i >>> 3) >>> 0, !1), o.setUint32(4, (i & 7) << 29, !1);
3140
+ else if (r === 0 && i === 0) o.setUint32(0, n << 31 >>> 0, !1), o.setUint32(4, 0, !1);
3141
+ else {
3142
+ let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1);
3143
+ o.setFloat64(0, t, !1);
3144
+ }
3145
+ return a;
3146
+ }
3147
+ function Nr(e, t, n) {
3148
+ let r = e.length === 2 ? 1 : e.length === 4 ? 2 : 3;
3149
+ if (r === 1) {
3150
+ let n = e[0] << 8 | e[1];
3151
+ if (t === 2) return new Or(Ar(n));
3152
+ if (t === 3) return new kr(jr(n));
3153
+ }
3154
+ if (r === 2) {
3155
+ if (t === 3) return new kr(Mr(e));
3156
+ if (t === 1) {
3157
+ let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), r = S(t);
3158
+ return !Object.is(C(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new Dr(r);
3159
+ }
3160
+ }
3161
+ if (r === 3) {
3162
+ let r = new DataView(e.buffer, e.byteOffset).getFloat64(0, !1);
3163
+ if (t === 1) {
3164
+ let e = S(r);
3165
+ return !Object.is(C(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new Dr(e);
3166
+ }
3167
+ if (t === 2) {
3168
+ let e = Math.fround(r);
3169
+ !Object.is(e, r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float32 (_2)");
3170
+ let t = /* @__PURE__ */ new Uint8Array(4);
3171
+ return new DataView(t.buffer).setFloat32(0, e, !1), new Or(t);
3172
+ }
3173
+ }
3174
+ return Z(e);
3175
+ }
3176
+ var Pr = {
3177
+ appStringPrefixes: ["float"],
3178
+ parseAppString(t, n, r, i) {
3179
+ let a = Er(n);
3180
+ if (!/^[0-9a-fA-F]*$/.test(a)) throw SyntaxError("float'...' contains non-hex characters");
3181
+ if (a.length % 2 != 0) throw SyntaxError(`float'...' hex content has odd length (${a.length} digits)`);
3182
+ let o = e(a), s = i?.encodingWidth;
3183
+ if (s === void 0) return Z(o);
3184
+ if (s !== 1 && s !== 2 && s !== 3) {
3185
+ let e = `float'...' encoding indicator _${s} is not valid; use _1, _2, or _3`;
3186
+ if (r) return r(e), Z(o);
3187
+ throw SyntaxError(e);
3188
+ }
3189
+ return s === (o.length === 2 ? 1 : o.length === 4 ? 2 : 3) ? Z(o) : Nr(o, s, r ?? ((e) => {
3190
+ throw SyntaxError(e);
3191
+ }));
3192
+ },
3193
+ parseAppSequence(e, t, n) {
3194
+ if (t.length === 0) throw SyntaxError("float<<...>> requires exactly one byte-string item");
3195
+ if (t.length > 1) {
3196
+ let e = `float<<...>> expects 1 item; got ${t.length} — using first`;
3197
+ if (n) n(e);
3198
+ else throw SyntaxError(e);
3199
+ }
3200
+ if (!(t[0] instanceof N)) throw SyntaxError("float<<...>> item must be a byte string");
3201
+ return Z(t[0].value);
3202
+ }
3203
+ }, Fr = [
3204
+ Kt,
3205
+ dn,
3206
+ mn,
3207
+ Bn,
3208
+ or,
3209
+ gr,
3210
+ _r,
3211
+ wr,
3212
+ Tr,
3213
+ Pr
3214
+ ], Ir;
3215
+ function Lr() {
3216
+ return Ir ??= {
3217
+ fromJS: Fr.filter((e) => e.fromJS !== void 0),
3218
+ parseTag: Fr.filter((e) => e.parseTag !== void 0)
2914
3219
  };
2915
3220
  }
2916
- function sr(e) {
2917
- let t = e?.extensions, n = or();
3221
+ function Rr(e) {
3222
+ let t = e?.extensions, n = Lr();
2918
3223
  return t?.length ? {
2919
3224
  fromJS: [...t.filter((e) => e.fromJS !== void 0), ...n.fromJS],
2920
3225
  parseTag: [...t.filter((e) => e.parseTag !== void 0), ...n.parseTag]
2921
3226
  } : n;
2922
3227
  }
2923
- function cr(e, t) {
3228
+ function zr(e, t) {
2924
3229
  if (t?.replacer) {
2925
- let { replacer: n, ...r } = t, i = ur(e, n, r.extensions, r.undefinedOmits);
2926
- return i === h ? z.UNDEFINED : cr(i, Object.keys(r).length > 0 ? r : void 0);
3230
+ let { replacer: n, ...r } = t, i = Vr(e, n, r.extensions, r.undefinedOmits);
3231
+ return i === h ? R.UNDEFINED : zr(i, Object.keys(r).length > 0 ? r : void 0);
2927
3232
  }
2928
- return Q(e, t, !0, sr(t));
3233
+ return Q(e, t, !0, Rr(t));
2929
3234
  }
2930
3235
  function Q(e, t, n, r) {
2931
3236
  for (let n of r.fromJS) {
@@ -2938,35 +3243,35 @@ function Q(e, t, n, r) {
2938
3243
  let t = e.parseTag(n, i);
2939
3244
  if (t !== void 0) return t;
2940
3245
  }
2941
- return new N(n, i);
2942
- }
2943
- if (e instanceof m.Null) return z.NULL;
2944
- if (e instanceof m.Undefined) return z.UNDEFINED;
2945
- if (e instanceof g) return new z(e.value);
2946
- if (e === null) return z.NULL;
2947
- if (e === void 0) return z.UNDEFINED;
2948
- if (e === !0) return z.TRUE;
2949
- if (e === !1) return z.FALSE;
2950
- if (typeof e == "bigint") return e > 18446744073709551615n ? new $e(e) : e < -18446744073709551616n ? new et(e) : e >= 0n ? new A(e) : new j(e);
2951
- if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new A(BigInt(e)) : new j(BigInt(e)) : new M(e);
2952
- if (typeof e == "string") return new V(e);
3246
+ return new M(n, i);
3247
+ }
3248
+ if (e instanceof m.Null) return R.NULL;
3249
+ if (e instanceof m.Undefined) return R.UNDEFINED;
3250
+ if (e instanceof g) return new R(e.value);
3251
+ if (e === null) return R.NULL;
3252
+ if (e === void 0) return R.UNDEFINED;
3253
+ if (e === !0) return R.TRUE;
3254
+ if (e === !1) return R.FALSE;
3255
+ if (typeof e == "bigint") return e > 18446744073709551615n ? new et(e) : e < -18446744073709551616n ? new tt(e) : e >= 0n ? new k(e) : new A(e);
3256
+ if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new k(BigInt(e)) : new A(BigInt(e)) : new j(e);
3257
+ if (typeof e == "string") return new B(e);
2953
3258
  if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Q(e.valueOf(), t, !1, r);
2954
- if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new P(new Uint8Array(e));
2955
- if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new L(Array.from(e, (e) => new A(BigInt(e)))) : new P(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
2956
- if (e instanceof $) return new R([...e].map(([e, n]) => [Q(e, t, !0, r), Q(n, t, !0, r)]));
2957
- if (Array.isArray(e)) return new L(e.map((e) => Q(e, t, !0, r)));
3259
+ if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new N(new Uint8Array(e));
3260
+ if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new I(Array.from(e, (e) => new k(BigInt(e)))) : new N(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3261
+ if (e instanceof $) return new L([...e].map(([e, n]) => [Q(e, t, !0, r), Q(n, t, !0, r)]));
3262
+ if (Array.isArray(e)) return new I(e.map((e) => Q(e, t, !0, r)));
2958
3263
  if (typeof e == "object") {
2959
3264
  let n = [];
2960
- for (let [i, a] of Object.entries(e)) n.push([new V(i), Q(a, t, !0, r)]);
2961
- return new R(n);
3265
+ for (let [i, a] of Object.entries(e)) n.push([new B(i), Q(a, t, !0, r)]);
3266
+ return new L(n);
2962
3267
  }
2963
3268
  throw TypeError(`fromJS: unsupported value type: ${typeof e}`);
2964
3269
  }
2965
- function lr(e) {
3270
+ function Br(e) {
2966
3271
  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;
2967
3272
  }
2968
- function ur(e, t, n, r) {
2969
- let i = [...n ?? [], ...Z].filter((e) => e.isJSType !== void 0);
3273
+ function Vr(e, t, n, r) {
3274
+ let i = [...n ?? [], ...Fr].filter((e) => e.isJSType !== void 0);
2970
3275
  function a(e) {
2971
3276
  return e === h || r === !0 && e === void 0;
2972
3277
  }
@@ -2976,7 +3281,7 @@ function ur(e, t, n, r) {
2976
3281
  if (typeof e != "object" || !e) return e;
2977
3282
  if (e instanceof $) return $.from(e, ([e, t]) => [e, r(t)]);
2978
3283
  if (Array.isArray(e)) return e.map(r);
2979
- if (m.symbol in e || lr(e) || i.some((t) => t.isJSType(e))) return e;
3284
+ if (m.symbol in e || Br(e) || i.some((t) => t.isJSType(e))) return e;
2980
3285
  let t = Object.getPrototypeOf(e);
2981
3286
  if (t === Object.prototype || t === null) {
2982
3287
  let t = e.toJSON;
@@ -3011,7 +3316,7 @@ function ur(e, t, n, r) {
3011
3316
  let r = s(t, String(n), e);
3012
3317
  return a(r) ? null : r;
3013
3318
  });
3014
- if (lr(e) || i.some((t) => t.isJSType(e))) return e;
3319
+ if (Br(e) || i.some((t) => t.isJSType(e))) return e;
3015
3320
  let t = {};
3016
3321
  for (let n of Object.keys(e)) {
3017
3322
  let r = s(e[n], n, e);
@@ -3029,7 +3334,7 @@ var $ = class extends Array {
3029
3334
  toJSON() {
3030
3335
  let e = {};
3031
3336
  for (let [t, n] of this) {
3032
- let r = typeof t == "string" ? t : cr(t).toCDN();
3337
+ let r = typeof t == "string" ? t : zr(t).toCDN();
3033
3338
  r === "__proto__" ? Object.defineProperty(e, r, {
3034
3339
  value: n,
3035
3340
  writable: !0,
@@ -3041,6 +3346,6 @@ var $ = class extends Array {
3041
3346
  }
3042
3347
  };
3043
3348
  //#endregion
3044
- export { C, s as D, o as E, m as O, w as S, h as T, N as _, Kt as a, A as b, et as c, z as d, R as f, P as g, F as h, rr as i, c as k, $e as l, I as m, ur as n, V as o, L as p, cr as r, it as s, $ as t, He as u, M as v, g as w, k as x, j as y };
3349
+ export { o as A, M as C, O as D, k as E, m as M, c as N, g as O, N as S, A as T, R as _, Er as a, F as b, _r as c, qt as d, B as f, Ue as g, et as h, Pr as i, s as j, h as k, gr as l, tt as m, Vr as n, wr as o, at as p, zr as r, Tr as s, $ as t, ir as u, L as v, j as w, P as x, I as y };
3045
3350
 
3046
- //# sourceMappingURL=mapEntries-B8riGPMD.js.map
3351
+ //# sourceMappingURL=mapEntries-BdzS6bFp.js.map