@cbortech/cbor 0.27.0 → 0.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.ja.md +100 -0
  2. package/README.md +103 -0
  3. package/dist/ast/CborAppSeqResult.d.ts +37 -4
  4. package/dist/ast/CborArray.d.ts +2 -2
  5. package/dist/ast/CborByteString.d.ts +2 -2
  6. package/dist/ast/CborEmbeddedCBOR.d.ts +1 -1
  7. package/dist/ast/CborFloat.d.ts +1 -1
  8. package/dist/ast/CborIndefiniteByteString.d.ts +1 -1
  9. package/dist/ast/CborIndefiniteTextString.d.ts +1 -1
  10. package/dist/ast/CborItem.d.ts +314 -9
  11. package/dist/ast/CborMap.d.ts +2 -2
  12. package/dist/ast/CborNint.d.ts +1 -1
  13. package/dist/ast/CborTag.d.ts +26 -4
  14. package/dist/ast/CborTextString.d.ts +2 -2
  15. package/dist/ast/CborUint.d.ts +1 -1
  16. package/dist/ast/CborUnresolvedAppExt.d.ts +9 -0
  17. package/dist/ast/index.cjs +1 -1
  18. package/dist/ast/index.js +2 -2
  19. package/dist/cbor/tagLabels.d.ts +26 -0
  20. package/dist/cddl/eRefScope.d.ts +241 -0
  21. package/dist/cddl/eref.d.ts +64 -0
  22. package/dist/cddl/implicitTags.d.ts +28 -0
  23. package/dist/cddl/index.cjs +2 -2
  24. package/dist/cddl/index.cjs.map +1 -1
  25. package/dist/cddl/index.d.ts +2 -0
  26. package/dist/cddl/index.js +26 -25
  27. package/dist/cddl/index.js.map +1 -1
  28. package/dist/cddl/validator.d.ts +98 -2
  29. package/dist/cdn/index.cjs +1 -1
  30. package/dist/cdn/index.js +1 -1
  31. package/dist/cdn/serialize-utils.d.ts +50 -15
  32. package/dist/extensions/cri.d.ts +2 -2
  33. package/dist/extensions/dt.d.ts +4 -4
  34. package/dist/extensions/eref.d.ts +135 -0
  35. package/dist/extensions/ip.d.ts +3 -3
  36. package/dist/extensions/types.d.ts +40 -1
  37. package/dist/index.cjs +7 -7
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.ts +2 -1
  40. package/dist/index.js +190 -81
  41. package/dist/index.js.map +1 -1
  42. package/dist/js/fromJS.d.ts +23 -1
  43. package/dist/mapEntries-8zshEr-t.js +7085 -0
  44. package/dist/mapEntries-8zshEr-t.js.map +1 -0
  45. package/dist/mapEntries-DwHPAzCN.cjs +68 -0
  46. package/dist/mapEntries-DwHPAzCN.cjs.map +1 -0
  47. package/dist/schema-7r2xjpMK.js +345 -0
  48. package/dist/schema-7r2xjpMK.js.map +1 -0
  49. package/dist/schema-YiigSWjR.cjs +8 -0
  50. package/dist/schema-YiigSWjR.cjs.map +1 -0
  51. package/dist/{serialize-utils-BuIZPaUc.js → serialize-utils-BQtutOo6.js} +70 -52
  52. package/dist/serialize-utils-BQtutOo6.js.map +1 -0
  53. package/dist/{serialize-utils-CjTqQivB.cjs → serialize-utils-DQ8T3Mzw.cjs} +9 -9
  54. package/dist/serialize-utils-DQ8T3Mzw.cjs.map +1 -0
  55. package/dist/types.d.ts +426 -4
  56. package/dist/utils/hexfloat.d.ts +10 -2
  57. package/package.json +13 -14
  58. package/dist/mapEntries-C1f7G0AM.cjs +0 -13
  59. package/dist/mapEntries-C1f7G0AM.cjs.map +0 -1
  60. package/dist/mapEntries-CvLdiN0h.js +0 -3946
  61. package/dist/mapEntries-CvLdiN0h.js.map +0 -1
  62. package/dist/schema-CNfrVRYp.js +0 -1977
  63. package/dist/schema-CNfrVRYp.js.map +0 -1
  64. package/dist/schema-iXpYtKQl.cjs +0 -63
  65. package/dist/schema-iXpYtKQl.cjs.map +0 -1
  66. package/dist/serialize-utils-BuIZPaUc.js.map +0 -1
  67. package/dist/serialize-utils-CjTqQivB.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -1,48 +1,155 @@
1
- import { D as e, I as t } from "./serialize-utils-BuIZPaUc.js";
2
- import { n, s as r } from "./schema-CNfrVRYp.js";
3
- import { B as i, H as a, L as o, R as s, S as c, V as l, a as u, c as d, d as f, f as p, g as m, i as h, l as g, m as _, n as v, o as y, p as b, r as x, s as S, t as C, u as w, x as T, z as E } from "./mapEntries-CvLdiN0h.js";
1
+ import { D as e, I as t } from "./serialize-utils-BQtutOo6.js";
2
+ import { A as n, B as r, C as i, D as a, F as o, G as s, I as c, J as l, K as u, M as d, S as f, T as p, X as m, Y as h, Z as g, _ as ee, a as _, b as v, c as y, g as te, h as ne, i as re, j as b, l as x, n as S, o as C, q as w, r as T, s as E, t as D, v as O, w as ie, x as k, y as ae } from "./mapEntries-8zshEr-t.js";
3
+ import { n as oe } from "./schema-7r2xjpMK.js";
4
4
  //#region src/extensions/same.ts
5
- function D(e, t) {
5
+ function se(e, t) {
6
6
  if (e.length !== t.length) return !1;
7
7
  for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
8
8
  return !0;
9
9
  }
10
- var O = {
10
+ var ce = {
11
11
  appStringPrefixes: ["same"],
12
12
  preserveAppSeqSource: !0,
13
13
  parseAppSequence(e, t, n) {
14
14
  if (t.length === 0) throw SyntaxError("same<<...>> requires at least one item");
15
15
  let r = t[0], i = r.toCBOR();
16
- for (let e = 1; e < t.length; e++) if (!D(i, t[e].toCBOR())) {
16
+ for (let e = 1; e < t.length; e++) if (!se(i, t[e].toCBOR())) {
17
17
  let t = `same<<...>>: item ${e} produces different CBOR bytes than item 0`;
18
18
  if (n) n(t);
19
19
  else throw SyntaxError(t);
20
20
  }
21
21
  return r;
22
22
  }
23
- }, k = /* @__PURE__ */ new Map(), A = 64;
24
- function j(e) {
23
+ }, A = 8;
24
+ function j(e, t, n, r) {
25
+ if (x(e, t, n).valid) return t;
26
+ let i = [];
27
+ if (!x(e, t, n, {
28
+ infer: !0,
29
+ trail: i
30
+ }).valid) return t;
31
+ let a = F(i);
32
+ return !a || a.size === 0 ? t : B(t, a, r);
33
+ }
34
+ function M(e, t, n, r) {
35
+ R(t);
36
+ let i = /* @__PURE__ */ new Set();
37
+ for (let e of r) !e.inferred && I(e.item) && i.add(e.item);
38
+ for (let r = 0; i.size > 0 && r < A; r++) {
39
+ let r = N(e, t, n, i);
40
+ if (!r) return;
41
+ if (r.size === i.size) {
42
+ for (let e of i) e._implicit = !0;
43
+ return;
44
+ }
45
+ i = r;
46
+ }
47
+ }
48
+ function N(e, t, n, r) {
49
+ if (x(e, t, n, {
50
+ stripped: r,
51
+ trail: []
52
+ }).valid) return /* @__PURE__ */ new Set();
53
+ let i = [];
54
+ if (!x(e, t, n, {
55
+ infer: !0,
56
+ stripped: r,
57
+ trail: i
58
+ }).valid) return /* @__PURE__ */ new Set();
59
+ let a = /* @__PURE__ */ new Map();
60
+ for (let e of r) {
61
+ let t = P(e, r), n = L(t[t.length - 1].content);
62
+ (a.get(n)?.length ?? 0) < t.length && a.set(n, t);
63
+ }
64
+ let o = F(i);
65
+ if (!o) return;
66
+ let s = /* @__PURE__ */ new Set();
67
+ for (let [e, t] of o) {
68
+ let n = a.get(e);
69
+ if (!n) return;
70
+ if (n.length === t.length && n.every((e, n) => e.tag === t[n])) for (let e of n) s.add(e);
71
+ }
72
+ return s;
73
+ }
74
+ function P(e, t) {
75
+ let n = [], i = e;
76
+ for (; i instanceof r && t.has(i);) n.push(i), i = L(i.content);
77
+ return n;
78
+ }
79
+ function F(e) {
80
+ let t = /* @__PURE__ */ new Map();
81
+ for (let n of e) {
82
+ if (!n.inferred) continue;
83
+ let e = t.get(n.item);
84
+ e || t.set(n.item, e = []);
85
+ let r = e[n.layer];
86
+ if (r === void 0) e[n.layer] = n.tag;
87
+ else if (r !== n.tag) return;
88
+ }
89
+ for (let e of t.values()) for (let t = 0; t < e.length; t++) if (e[t] === void 0) return;
90
+ return t;
91
+ }
92
+ function I(e) {
93
+ return e instanceof r && e._toJS === r.prototype._toJS;
94
+ }
95
+ function L(e) {
96
+ for (; e instanceof n;) e = e.inner;
97
+ return e;
98
+ }
99
+ function R(e) {
100
+ z(e, R), e instanceof r && (e._implicit = !1);
101
+ }
102
+ function z(e, t) {
103
+ if (e instanceof c) e.items.forEach(t);
104
+ else if (e instanceof o) for (let [n, r] of e.entries) t(n), t(r);
105
+ else e instanceof r ? t(e.content) : e instanceof n && t(e.inner);
106
+ }
107
+ function B(e, t, n) {
108
+ let i = (e) => {
109
+ if (e instanceof c) {
110
+ let { items: t } = e;
111
+ for (let e = 0; e < t.length; e++) t[e] = i(t[e]);
112
+ } else if (e instanceof o) for (let t of e.entries) t[0] = i(t[0]), t[1] = i(t[1]);
113
+ else e instanceof r && (e.content = i(e.content));
114
+ let a = e, s = t.get(e) ?? [];
115
+ for (let e = s.length - 1; e >= 0; e--) a = n(s[e], a);
116
+ return a;
117
+ };
118
+ return i(e);
119
+ }
120
+ //#endregion
121
+ //#region src/cbor.ts
122
+ var V = /* @__PURE__ */ new Map(), H = 64;
123
+ function U(e) {
25
124
  if (typeof e != "string") return e;
26
- let t = k.get(e);
27
- return t || (t = n(e), k.size >= A && k.delete(k.keys().next().value), k.set(e, t)), t;
125
+ let t = V.get(e);
126
+ return t || (t = oe(e), V.size >= H && V.delete(V.keys().next().value), V.set(e, t)), t;
28
127
  }
29
- function M(e, t, n) {
128
+ function W(e, t, n, r, i) {
30
129
  if (t) {
31
- let i = t.validate(e, n);
32
- if (!i.valid) throw new r(i.errors, i.warnings);
130
+ i && i.implicitTags !== !1 && (e = j(t, e, n, (e, t) => re(e, t, i)));
131
+ let a = [], o = x(t, e, n, { trail: a });
132
+ if (!o.valid) throw new g(o.errors, o.warnings);
133
+ M(t, e, n, a), E(e, t, n, r);
33
134
  }
34
135
  return e;
35
136
  }
36
- function N(e, t) {
37
- return M(e, j(t?.cddl), t?.cddlValidationOptions);
137
+ function G(e, t) {
138
+ return t ? {
139
+ ...e,
140
+ extensions: [y(t), ...e?.extensions ?? []]
141
+ } : e;
142
+ }
143
+ function K(e, t) {
144
+ return W(e, U(t?.cddl), t?.cddlValidationOptions, t);
38
145
  }
39
- var P = class n {
40
- static OMIT = s;
41
- static TAG = E;
42
- static Tag = l;
43
- static Simple = o;
44
- static MapEntries = C;
45
- static dt_as_Date = _;
146
+ var q = class n {
147
+ static OMIT = u;
148
+ static TAG = w;
149
+ static Tag = h;
150
+ static Simple = s;
151
+ static MapEntries = D;
152
+ static dt_as_Date = p;
46
153
  #e;
47
154
  constructor(e) {
48
155
  this.#e = e ?? {};
@@ -133,7 +240,7 @@ var P = class n {
133
240
  stringify(e, t, r) {
134
241
  if (typeof t == "function" || Array.isArray(t) || t === null || t === void 0 && r !== void 0) {
135
242
  let i = { ...this.#e };
136
- return t === null ? i.replacer = void 0 : (typeof t == "function" || Array.isArray(t)) && (i.replacer = t), r !== void 0 && (i.indent = V(r)), n.stringify(e, i);
243
+ return t === null ? i.replacer = void 0 : (typeof t == "function" || Array.isArray(t)) && (i.replacer = t), r !== void 0 && (i.indent = $(r)), n.stringify(e, i);
137
244
  }
138
245
  return n.stringify(e, this.#t(t ?? void 0));
139
246
  }
@@ -141,73 +248,75 @@ var P = class n {
141
248
  return n.format(e, this.#t(t));
142
249
  }
143
250
  static fromCBOR(e, t) {
144
- return N(w(e, t), t);
251
+ return K(k(e, t), t);
145
252
  }
146
253
  static fromCDN(e, t) {
147
- return N(m(e, t), t);
254
+ let n = U(t?.cddl);
255
+ return W(a(e, G(t, n)), n, t?.cddlValidationOptions, t);
148
256
  }
149
257
  static fromEDN(e, t) {
150
258
  return n.fromCDN(e, t);
151
259
  }
152
260
  static *fromHexDumpSeq(e, t) {
153
- let r = [], i = F(e).trim().split(/\s+/).filter(Boolean);
261
+ let r = [], i = J(e).trim().split(/\s+/).filter(Boolean);
154
262
  for (let e of i) if (/^[0-9A-Fa-f]{2}$/.test(e)) r.push(parseInt(e, 16));
155
263
  else if (/^[0-9A-Fa-f]+$/.test(e) && e.length % 2 == 0) for (let t = 0; t < e.length; t += 2) r.push(parseInt(e.slice(t, t + 2), 16));
156
264
  else throw SyntaxError(`Invalid hex token in dump: ${JSON.stringify(e)}`);
157
265
  yield* n.fromCBORSeq(new Uint8Array(r), t);
158
266
  }
159
267
  static *fromCBORSeq(e, t) {
160
- let n = j(t?.cddl), r = e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength), i = 0;
268
+ let n = U(t?.cddl), r = e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength), i = 0;
161
269
  for (; i < r.byteLength;) {
162
- let e = w(r, {
270
+ let e = k(r, {
163
271
  ...t,
164
272
  offset: i,
165
273
  allowTrailing: !0
166
274
  });
167
- yield M(e, n, t?.cddlValidationOptions), i = e.end;
275
+ yield W(e, n, t?.cddlValidationOptions, t), i = e.end;
168
276
  }
169
277
  }
170
278
  static *fromCDNSeq(n, r) {
171
- let i = j(r?.cddl), a = e(r) || !!r?.preserveAll, o = 0, s = !0;
279
+ let i = U(r?.cddl), o = e(r) || !!r?.preserveAll, s = 0, c = !0;
172
280
  for (;;) {
173
- let { offset: e, hadSeparator: c, commaOffset: l } = B(n, o, r, a ? s ? "all" : "after-newline" : "none");
174
- if (s && l >= 0) {
281
+ let { offset: e, hadSeparator: l, commaOffset: u } = Q(n, s, r, o ? c ? "all" : "after-newline" : "none");
282
+ if (c && u >= 0) {
175
283
  let e = "leading comma in CDN sequence";
176
284
  if (r?.strict !== !1) throw SyntaxError(e);
177
- R(e, l, r);
285
+ Z(e, u, r);
178
286
  }
179
- if (e >= n.length || a && z(n, e) && B(n, e, r).offset >= n.length) break;
180
- if (!s && !c) {
287
+ if (e >= n.length || o && le(n, e) && Q(n, e, r).offset >= n.length) break;
288
+ if (!c && !l) {
181
289
  let t = "CDN sequence items must be separated by whitespace, comma, or comment";
182
290
  if (r?.strict !== !1) throw SyntaxError(t);
183
- R(t, e, r);
291
+ Z(t, e, r);
184
292
  }
185
- o = e;
186
- let u;
293
+ s = e;
294
+ let d;
187
295
  try {
188
- u = m(n, {
296
+ d = a(n, G({
189
297
  ...r,
190
- offset: o,
298
+ offset: s,
191
299
  allowTrailing: !0,
192
300
  _skipRS: !0
193
- });
301
+ }, i));
194
302
  } catch (e) {
195
303
  if (r?.strict !== !1) throw e;
196
- R(e instanceof Error ? e.message : String(e), o, r, !0, e instanceof t ? e : void 0);
304
+ Z(e instanceof Error ? e.message : String(e), s, r, !0, e instanceof t ? e : void 0);
197
305
  break;
198
306
  }
199
- yield M(u, i, r?.cddlValidationOptions), o = u.end, s = !1;
307
+ yield W(d, i, r?.cddlValidationOptions, r), s = d.end, c = !1;
200
308
  }
201
309
  }
202
310
  static fromJS(e, t) {
203
- return N(x(e, t), t);
311
+ let n = U(t?.cddl);
312
+ return W(T(e, t, n), n, t?.cddlValidationOptions, t, t ?? {});
204
313
  }
205
314
  static fromHexDump(e, t) {
206
- let n = [], r = F(e).trim().split(/\s+/).filter(Boolean);
315
+ let n = [], r = J(e).trim().split(/\s+/).filter(Boolean);
207
316
  for (let e of r) if (/^[0-9A-Fa-f]{2}$/.test(e)) n.push(parseInt(e, 16));
208
317
  else if (/^[0-9A-Fa-f]+$/.test(e) && e.length % 2 == 0) for (let t = 0; t < e.length; t += 2) n.push(parseInt(e.slice(t, t + 2), 16));
209
318
  else throw SyntaxError(`Invalid hex token in dump: ${JSON.stringify(e)}`);
210
- return N(w(new Uint8Array(n), t), t);
319
+ return K(k(new Uint8Array(n), t), t);
211
320
  }
212
321
  static decode(e, t) {
213
322
  return n.fromCBOR(e, t).toJS(t);
@@ -238,9 +347,9 @@ var P = class n {
238
347
  return a;
239
348
  }
240
349
  static validate(e, r) {
241
- let i = [], a = [], o, s = {
350
+ let i = [], a = [], o, s = U(r?.cddl), c = {
242
351
  strict: !1,
243
- extensions: r?.extensions,
352
+ extensions: s ? [y(s), ...r?.extensions ?? []] : r?.extensions,
244
353
  builtinExtensions: r?.builtinExtensions,
245
354
  onWarning: (e) => {
246
355
  if ("hint" in e && e.hint) {
@@ -253,11 +362,11 @@ var P = class n {
253
362
  }
254
363
  i.push(e);
255
364
  }
256
- }, c = j(r?.cddl), l = [], u = [], d = (e) => {
257
- if (!c) return;
258
- let t = c.validate(e, r?.cddlValidationOptions);
365
+ }, l = [], u = [], d = (e) => {
366
+ if (!s) return;
367
+ let t = s.validate(e, r?.cddlValidationOptions);
259
368
  l.push(...t.errors), t.warnings && u.push(...t.warnings);
260
- }, f = c ? {
369
+ }, f = s ? {
261
370
  cddlErrors: l,
262
371
  cddlWarnings: u
263
372
  } : {}, p = 0;
@@ -265,12 +374,12 @@ var P = class n {
265
374
  let t = r?.type ?? "cbor";
266
375
  if (t === "cdn") {
267
376
  let t = {
268
- ...s,
377
+ ...c,
269
378
  unresolvedExtension: r?.unresolvedExtension
270
379
  };
271
380
  for (let r of n.fromCDNSeq(e, t)) p++, d(r);
272
- } else if (t === "hex") for (let t of n.fromHexDumpSeq(e, s)) p++, d(t);
273
- else for (let t of n.fromCBORSeq(e, s)) p++, d(t);
381
+ } else if (t === "hex") for (let t of n.fromHexDumpSeq(e, c)) p++, d(t);
382
+ else for (let t of n.fromCBORSeq(e, c)) p++, d(t);
274
383
  } catch (e) {
275
384
  return {
276
385
  valid: !1,
@@ -317,81 +426,81 @@ var P = class n {
317
426
  }
318
427
  static stringify(e, t, n) {
319
428
  if (typeof t == "function" || Array.isArray(t) || t === null || t === void 0 && n !== void 0) {
320
- let r = typeof t == "function" || Array.isArray(t) ? t : void 0, i = V(n);
429
+ let r = typeof t == "function" || Array.isArray(t) ? t : void 0, i = $(n);
321
430
  if (r) {
322
- let t = v(e, r);
323
- return t === void 0 || t === s ? void 0 : x(t).toCDN(i === void 0 ? void 0 : { indent: i });
431
+ let t = S(e, r);
432
+ return t === void 0 || t === u ? void 0 : T(t).toCDN(i === void 0 ? void 0 : { indent: i });
324
433
  }
325
- return x(e).toCDN(i === void 0 ? void 0 : { indent: i });
434
+ return T(e).toCDN(i === void 0 ? void 0 : { indent: i });
326
435
  }
327
- let r = t;
436
+ let r = t, i = U(r?.cddl);
328
437
  if (r?.replacer) {
329
- let t = v(e, r.replacer, r.extensions, r.undefinedOmits, r.builtinExtensions);
330
- if (t === void 0 || t === s) return;
331
- let { replacer: n, ...i } = r;
332
- return N(x(t, Object.keys(i).length > 0 ? i : void 0), r).toCDN(r);
438
+ let t = S(e, r.replacer, r.extensions, r.undefinedOmits, r.builtinExtensions);
439
+ if (t === void 0 || t === u) return;
440
+ let { replacer: n, ...a } = r;
441
+ return W(T(t, Object.keys(a).length > 0 ? a : void 0, i), i, r.cddlValidationOptions, r, a).toCDN(r);
333
442
  }
334
- return N(x(e, r), r).toCDN(r);
443
+ return W(T(e, r, i), i, r?.cddlValidationOptions, r, r ?? {}).toCDN(r);
335
444
  }
336
445
  static format(e, t) {
337
446
  return n.fromCDN(e, t).toCDN(t);
338
447
  }
339
448
  };
340
- function F(e) {
449
+ function J(e) {
341
450
  let t = "", n = 0;
342
451
  for (; n < e.length;) {
343
452
  let r = e[n], i = e[n + 1] ?? "";
344
453
  if (r === "-" && i === "-") {
345
- n = I(e, n + 2), t += " ";
454
+ n = Y(e, n + 2), t += " ";
346
455
  continue;
347
456
  }
348
457
  if (r === "—") {
349
- n = I(e, n + 1), t += " ";
458
+ n = Y(e, n + 1), t += " ";
350
459
  continue;
351
460
  }
352
461
  if (r === "#") {
353
- n = I(e, n + 1), t += " ";
462
+ n = Y(e, n + 1), t += " ";
354
463
  continue;
355
464
  }
356
465
  if (r === "/" && i === "/") {
357
- n = I(e, n + 2), t += " ";
466
+ n = Y(e, n + 2), t += " ";
358
467
  continue;
359
468
  }
360
469
  if (r === "/" && i === "*") {
361
470
  let r = e.indexOf("*/", n + 2);
362
471
  if (r < 0) throw SyntaxError("Unterminated comment in hex dump");
363
- t += L(e.slice(n, r + 2)), n = r + 2;
472
+ t += X(e.slice(n, r + 2)), n = r + 2;
364
473
  continue;
365
474
  }
366
475
  if (r === "/") {
367
476
  let r = e.indexOf("/", n + 1);
368
477
  if (r < 0) throw SyntaxError("Unterminated comment in hex dump");
369
- t += L(e.slice(n, r + 1)), n = r + 1;
478
+ t += X(e.slice(n, r + 1)), n = r + 1;
370
479
  continue;
371
480
  }
372
481
  t += r, n++;
373
482
  }
374
483
  return t;
375
484
  }
376
- function I(e, t) {
485
+ function Y(e, t) {
377
486
  let n = e.indexOf("\n", t);
378
487
  return n < 0 ? e.length : n;
379
488
  }
380
- function L(e) {
489
+ function X(e) {
381
490
  return e.replace(/[^\r\n]/g, " ");
382
491
  }
383
- function R(e, t, n, r, i) {
492
+ function Z(e, t, n, r, i) {
384
493
  let a = i?.offset ?? t, o = {
385
494
  message: e,
386
495
  offset: a
387
496
  };
388
497
  r && (o.fatal = !0), i && (o.cause = i), i?.offset !== void 0 && (o.line = i.line, o.column = i.column, o.endOffset = i.endOffset), n?.onWarning ? n.onWarning(o) : n?.silent || console.warn(`CDN sequence warning at offset ${a}: ${e}`);
389
498
  }
390
- function z(e, t) {
499
+ function le(e, t) {
391
500
  let n = e[t];
392
501
  return n === "#" || n === "/";
393
502
  }
394
- function B(e, t, n, r = "none") {
503
+ function Q(e, t, n, r = "none") {
395
504
  let i = t, a = !1, o = !1, s = !1, c = -1, l = () => r === "all" || r === "after-newline" && s;
396
505
  for (; i < e.length;) {
397
506
  let t = e[i];
@@ -421,7 +530,7 @@ function B(e, t, n, r = "none") {
421
530
  if (t < 0) {
422
531
  let t = "unterminated /* comment in CDN sequence";
423
532
  if (n?.strict !== !1) throw SyntaxError(t);
424
- R(t, i, n, !0), i = e.length;
533
+ Z(t, i, n, !0), i = e.length;
425
534
  } else e.slice(i, t).includes("\n") && (s = !0), i = t + 2;
426
535
  continue;
427
536
  }
@@ -431,7 +540,7 @@ function B(e, t, n, r = "none") {
431
540
  if (t < 0) {
432
541
  let t = "unterminated / comment in CDN sequence";
433
542
  if (n?.strict !== !1) throw SyntaxError(t);
434
- R(t, i, n, !0), i = e.length;
543
+ Z(t, i, n, !0), i = e.length;
435
544
  } else e.slice(i, t).includes("\n") && (s = !0), i = t + 1;
436
545
  continue;
437
546
  }
@@ -447,7 +556,7 @@ function B(e, t, n, r = "none") {
447
556
  commaOffset: c
448
557
  };
449
558
  }
450
- function V(e) {
559
+ function $(e) {
451
560
  if (typeof e == "number") {
452
561
  let t = Math.floor(Math.min(10, Math.max(0, e)));
453
562
  return t === 0 ? void 0 : t;
@@ -455,6 +564,6 @@ function V(e) {
455
564
  if (typeof e == "string") return e.slice(0, 10) || void 0;
456
565
  }
457
566
  //#endregion
458
- export { h as BUILTIN_EXTENSIONS, P as CBOR, P as default, s as CBOR_OMIT, E as CBOR_TAG, r as CddlMismatchError, t as CdnSyntaxError, C as MapEntries, i as Null, o as Simple, l as Tag, a as Undefined, d as b1, T as b32, f as cri, b as dt, _ as dt_as_Date, u as float, c as h32, y as ilbs, S as ilts, p as ip, O as same, g as t1 };
567
+ export { ne as BUILTIN_EXTENSIONS, q as CBOR, q as default, u as CBOR_OMIT, w as CBOR_TAG, _ as CborERefNint, C as CborERefUint, g as CddlMismatchError, t as CdnSyntaxError, D as MapEntries, l as Null, s as Simple, h as Tag, m as Undefined, E as annotateERefKeys, ae as b1, b as b32, y as createERefExtension, f as cri, ie as dt, p as dt_as_Date, te as float, d as h32, ee as ilbs, O as ilts, i as ip, ce as same, v as t1 };
459
568
 
460
569
  //# sourceMappingURL=index.js.map