@cbortech/cbor 0.26.6 → 0.26.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +144 -0
- package/README.md +143 -0
- package/dist/ast/CborByteString.d.ts +14 -0
- package/dist/ast/CborEllipsis.d.ts +94 -2
- package/dist/ast/CborFloat.d.ts +10 -0
- package/dist/ast/CborItem.d.ts +93 -4
- package/dist/ast/CborNint.d.ts +9 -0
- package/dist/ast/CborSimple.d.ts +11 -2
- package/dist/ast/CborTag.d.ts +8 -0
- package/dist/ast/CborTextString.d.ts +20 -0
- package/dist/ast/CborUint.d.ts +8 -0
- package/dist/ast/index.cjs +1 -1
- package/dist/ast/index.js +2 -2
- package/dist/cddl/index.cjs +1 -1
- package/dist/cddl/index.js +1 -1
- package/dist/cdn/serialize-utils.d.ts +186 -8
- package/dist/extensions/dt.d.ts +3 -0
- package/dist/extensions/types.d.ts +31 -9
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +61 -98
- package/dist/index.js.map +1 -1
- package/dist/mapEntries-D2NyeCX3.cjs +17 -0
- package/dist/mapEntries-D2NyeCX3.cjs.map +1 -0
- package/dist/{mapEntries-Czxt-cmd.js → mapEntries-DxrDre2P.js} +1461 -959
- package/dist/mapEntries-DxrDre2P.js.map +1 -0
- package/dist/{schema-BxkgvUY6.js → schema-Bofmsptw.js} +247 -247
- package/dist/{schema-BxkgvUY6.js.map → schema-Bofmsptw.js.map} +1 -1
- package/dist/{schema-BmGsaEaW.cjs → schema-t_bdPk8_.cjs} +5 -5
- package/dist/{schema-BmGsaEaW.cjs.map → schema-t_bdPk8_.cjs.map} +1 -1
- package/dist/types.d.ts +169 -7
- package/package.json +2 -2
- package/dist/mapEntries-BhMlCwYo.cjs +0 -15
- package/dist/mapEntries-BhMlCwYo.cjs.map +0 -1
- package/dist/mapEntries-Czxt-cmd.js.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -389,6 +389,17 @@ export interface FromCDNOptions {
|
|
|
389
389
|
* @default false
|
|
390
390
|
*/
|
|
391
391
|
preserveComments?: boolean | 'c-style' | 'cdn-style';
|
|
392
|
+
/**
|
|
393
|
+
* Shorthand for `ToCDNOptions.preserveAll`, so a single option enables
|
|
394
|
+
* round-tripping through both `fromCDN()` and `toCDN()` (as
|
|
395
|
+
* `CBOR.format()` does internally). On the parse side, this only implies
|
|
396
|
+
* `preserveComments: true` (comments must be captured while parsing to be
|
|
397
|
+
* re-emittable); the other `preserve*` behaviors are always captured by
|
|
398
|
+
* the parser and only need to be turned on for `toCDN()`.
|
|
399
|
+
*
|
|
400
|
+
* @default false
|
|
401
|
+
*/
|
|
402
|
+
preserveAll?: boolean;
|
|
392
403
|
/**
|
|
393
404
|
* Controls how CDN/EDN validity violations are handled.
|
|
394
405
|
*
|
|
@@ -511,9 +522,34 @@ export interface ToCDNOptions {
|
|
|
511
522
|
* Like `JSON.stringify`, `0` and `''` are equivalent to omitting the
|
|
512
523
|
* option: the output is a single line. Single-line output is guaranteed
|
|
513
524
|
* to contain no newlines; layout-dependent options (`preserveComments`,
|
|
514
|
-
* `splitCdn`, `splitNewline`, `preserveConcatenation`)
|
|
525
|
+
* `preserveBlankLines`, `splitCdn`, `splitNewline`, `preserveConcatenation`)
|
|
526
|
+
* are ignored.
|
|
515
527
|
*/
|
|
516
528
|
indent?: number | string;
|
|
529
|
+
/**
|
|
530
|
+
* Master switch that turns on every `preserve*` option below at once —
|
|
531
|
+
* `preserveComments`, `preserveByteString`, `preserveRawString`,
|
|
532
|
+
* `preserveTextString`, `preserveConcatenation`, `preserveNumberFormat`,
|
|
533
|
+
* `preserveAppSequence`, and `preserveBlankLines` — for reformatting CDN
|
|
534
|
+
* text (e.g. on save in an editor) with minimal changes: only
|
|
535
|
+
* whitespace/indentation, plus anything an explicitly-set individual
|
|
536
|
+
* option overrides.
|
|
537
|
+
*
|
|
538
|
+
* An option explicitly set to a value (including `false`) is left as-is;
|
|
539
|
+
* `preserveAll` only fills in the ones left `undefined`. So
|
|
540
|
+
* `{ preserveAll: true, preserveNumberFormat: false }` preserves
|
|
541
|
+
* everything except number literal spelling.
|
|
542
|
+
*
|
|
543
|
+
* When parsing via `CBOR.fromCDN()` separately from `toCDN()` (rather
|
|
544
|
+
* than through `CBOR.format()`, which passes the same options to both),
|
|
545
|
+
* also pass `preserveAll` (or `preserveComments`) to `FromCDNOptions` so
|
|
546
|
+
* comments are captured in the first place — see
|
|
547
|
+
* `FromCDNOptions.preserveAll`. Bignums are unaffected by
|
|
548
|
+
* `preserveNumberFormat` even under `preserveAll`; see that option.
|
|
549
|
+
*
|
|
550
|
+
* @default false
|
|
551
|
+
*/
|
|
552
|
+
preserveAll?: boolean;
|
|
517
553
|
/**
|
|
518
554
|
* Emit comments previously captured by `FromCDNOptions.preserveComments`.
|
|
519
555
|
*
|
|
@@ -533,23 +569,48 @@ export interface ToCDNOptions {
|
|
|
533
569
|
* @default false
|
|
534
570
|
*/
|
|
535
571
|
preserveComments?: boolean | 'c-style' | 'cdn-style';
|
|
572
|
+
/**
|
|
573
|
+
* Re-emit a blank line above an array/map entry (or indefinite-length
|
|
574
|
+
* string chunk) that had one before it anywhere in the parsed CDN source,
|
|
575
|
+
* so paragraph-like groupings of entries survive a reformat. At most one
|
|
576
|
+
* blank line is ever emitted per gap, regardless of how many blank lines
|
|
577
|
+
* were originally there.
|
|
578
|
+
*
|
|
579
|
+
* Detection is based purely on entry source positions — it does not
|
|
580
|
+
* require `preserveComments` and is unaffected by whether comments are
|
|
581
|
+
* emitted.
|
|
582
|
+
*
|
|
583
|
+
* Only effective when `indent` enables pretty-printing. A container with
|
|
584
|
+
* a preserved blank line is always emitted one-entry-per-line, the same
|
|
585
|
+
* as a container with preserved comments (see `inlineLeafContainers`).
|
|
586
|
+
*
|
|
587
|
+
* @default false
|
|
588
|
+
*/
|
|
589
|
+
preserveBlankLines?: boolean;
|
|
536
590
|
/**
|
|
537
591
|
* Re-emit byte string literals parsed from CDN using their original source
|
|
538
592
|
* text when available.
|
|
539
593
|
*
|
|
540
594
|
* This preserves the spelling and interior layout of non-concatenated
|
|
541
595
|
* `h'...'`, `b64'...'`, `b32'...'`, `h32'...'`, raw-backtick byte strings,
|
|
542
|
-
* and single-quoted byte strings
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
596
|
+
* and single-quoted byte strings — including a `h'xx...yy'`-family elided
|
|
597
|
+
* literal (§4.2), whose spelling is kept independently of
|
|
598
|
+
* `preserveConcatenation` when it has no `+` of its own (see that
|
|
599
|
+
* option). Byte strings produced by `+` concatenation are normalised as
|
|
600
|
+
* usual; combine with `preserveConcatenation` to keep both the part
|
|
601
|
+
* boundaries and each part's spelling.
|
|
602
|
+
*
|
|
603
|
+
* A comment inside the literal is stripped unless `preserveComments` is
|
|
604
|
+
* also set — `preserveByteString` alone preserves everything about the
|
|
605
|
+
* literal's spelling *except* its comments, the same as an unpreserved
|
|
606
|
+
* literal (re-derived from the decoded value) never has comments either.
|
|
546
607
|
*
|
|
547
608
|
* When enabled, this takes precedence over `bstrEncoding` and `sqstr` for
|
|
548
609
|
* byte strings that carry original EDN source text.
|
|
549
610
|
*
|
|
550
611
|
* In single-line output (no `indent`), an original spelling that spans
|
|
551
|
-
* multiple lines
|
|
552
|
-
*
|
|
612
|
+
* multiple lines — after any comment is stripped — falls back to normal
|
|
613
|
+
* serialization; single-line spellings are kept.
|
|
553
614
|
*
|
|
554
615
|
* @default false
|
|
555
616
|
*/
|
|
@@ -573,6 +634,48 @@ export interface ToCDNOptions {
|
|
|
573
634
|
* @default false
|
|
574
635
|
*/
|
|
575
636
|
preserveRawString?: boolean;
|
|
637
|
+
/**
|
|
638
|
+
* Re-emit double-quoted text strings (`"..."`) using their original CDN
|
|
639
|
+
* source spelling — escape sequences (`é` vs. the literal character),
|
|
640
|
+
* quoting choices, etc. — instead of re-escaping them from the decoded
|
|
641
|
+
* string value.
|
|
642
|
+
*
|
|
643
|
+
* Applies to non-concatenated double-quoted literals only; a string
|
|
644
|
+
* reached via `+` concatenation is normalised as usual regardless of this
|
|
645
|
+
* option. Preserved strings are emitted verbatim: they are never
|
|
646
|
+
* re-indented or split by `splitCdn` / `splitNewline`.
|
|
647
|
+
*
|
|
648
|
+
* Raw backtick literals (`` `...` ``) are covered by `preserveRawString`,
|
|
649
|
+
* not this option.
|
|
650
|
+
*
|
|
651
|
+
* In single-line output (no `indent`), a spelling that spans multiple
|
|
652
|
+
* lines falls back to normal escaping; single-line spellings are kept.
|
|
653
|
+
*
|
|
654
|
+
* @default false
|
|
655
|
+
*/
|
|
656
|
+
preserveTextString?: boolean;
|
|
657
|
+
/**
|
|
658
|
+
* Re-emit integer and floating-point literals using their original CDN
|
|
659
|
+
* source spelling — base (`0xff` / `0o377` / `0b101` / decimal), digit
|
|
660
|
+
* spelling, decimal point / exponent form, and encoding-indicator suffix
|
|
661
|
+
* (e.g. `1.5_1`) — instead of normalising them via `intFormat` /
|
|
662
|
+
* `floatFormat` and recomputed encoding indicators.
|
|
663
|
+
*
|
|
664
|
+
* Takes precedence over `intFormat` and `floatFormat` for literals parsed
|
|
665
|
+
* from CDN text. Values that did not originate from CDN text (e.g. built
|
|
666
|
+
* via `CBOR.from()` or decoded from CBOR bytes) always fall back to normal
|
|
667
|
+
* formatting, since there is no original spelling to preserve. Bignums
|
|
668
|
+
* (integers outside the uint64/int64 range) are unaffected and always
|
|
669
|
+
* render as plain decimal.
|
|
670
|
+
*
|
|
671
|
+
* Combine with `preserveByteString`, `preserveRawString`,
|
|
672
|
+
* `preserveConcatenation`, and `preserveComments` to reformat CDN text
|
|
673
|
+
* (e.g. whitespace/indentation only) with minimal changes to the rest of
|
|
674
|
+
* the source.
|
|
675
|
+
*
|
|
676
|
+
* @default false
|
|
677
|
+
*/
|
|
678
|
+
preserveNumberFormat?: boolean;
|
|
576
679
|
/**
|
|
577
680
|
* Whether to emit commas between array/map elements.
|
|
578
681
|
* - `'comma'`: emit commas (`[1, 2, 3]`)
|
|
@@ -607,6 +710,37 @@ export interface ToCDNOptions {
|
|
|
607
710
|
* @default true
|
|
608
711
|
*/
|
|
609
712
|
appStrings?: boolean;
|
|
713
|
+
/**
|
|
714
|
+
* For built-in extensions that support application-string notation
|
|
715
|
+
* (`prefix'...'` or `` prefix`...` ``), application-sequence notation
|
|
716
|
+
* (`prefix<<...>>`), and/or a raw tag literal (`N(...)`), re-emit a value
|
|
717
|
+
* using its exact original spelling instead of normalizing it to the
|
|
718
|
+
* regenerated `prefix'...'` form.
|
|
719
|
+
*
|
|
720
|
+
* By default, an extension like `dt`/`DT` or `ip`/`IP` regenerates its
|
|
721
|
+
* notation from the resolved value on every call — so
|
|
722
|
+
* `` DT`1969-07-21T02:56:16Z` ``, `DT<<'1969-07-21T02:56:16Z'>>`, and even
|
|
723
|
+
* the raw tag form `1(1749772800)` all become
|
|
724
|
+
* `DT'2025-06-13T00:00:00Z'`-style `prefix'...'` notation, even though all
|
|
725
|
+
* of these denote the same value. `preserveAppSequence` keeps the
|
|
726
|
+
* original spelling instead — whichever quoting (`'...'` vs `` `...` ``),
|
|
727
|
+
* bracketing (`<<...>>`), or raw tag form was used. Has no effect when
|
|
728
|
+
* `appStrings` is `false` (raw tag notation is used either way regardless
|
|
729
|
+
* of the original spelling), or on values not parsed from one of these
|
|
730
|
+
* forms.
|
|
731
|
+
*
|
|
732
|
+
* In single-line output (no `indent`), a spelling that spans multiple
|
|
733
|
+
* lines falls back to normal (regenerated) notation; single-line
|
|
734
|
+
* spellings are kept.
|
|
735
|
+
*
|
|
736
|
+
* An explicit `preserveComments` setting is still applied to comments
|
|
737
|
+
* inside a preserved application-sequence spelling: marker styles are
|
|
738
|
+
* normalised without changing the notation family, and `false` removes
|
|
739
|
+
* the comments while retaining the surrounding source spelling.
|
|
740
|
+
*
|
|
741
|
+
* @default false
|
|
742
|
+
*/
|
|
743
|
+
preserveAppSequence?: boolean;
|
|
610
744
|
/**
|
|
611
745
|
* Numeric format for integer values in CDN output.
|
|
612
746
|
* - `'decimal'`: standard decimal notation (e.g. `42`, `-14159024`)
|
|
@@ -684,6 +818,19 @@ export interface ToCDNOptions {
|
|
|
684
818
|
* concatenation, and only takes effect when `indent` enables
|
|
685
819
|
* pretty-printing (single-line output joins the parts into one literal).
|
|
686
820
|
*
|
|
821
|
+
* Also applies within an elision (`...`, §4.2 of
|
|
822
|
+
* draft-ietf-cbor-edn-literals-25): a `+`-joined fragment on either side of
|
|
823
|
+
* an ellipsis keeps its own part boundaries too (e.g. `'test' +
|
|
824
|
+
* h'1234...abcd' + ...` stays exactly as written instead of merging
|
|
825
|
+
* `'test'` into the byte fragment before it), and byte-string elision
|
|
826
|
+
* keeps the `h'xx' + ... + h'yy'` spelling instead of the default compact
|
|
827
|
+
* `h'xx...yy'` literal. Unlike the text/byte-string case above, this
|
|
828
|
+
* applies regardless of `indent`, and the parts stay on one line even
|
|
829
|
+
* under `indent` (elision is always single-line): a `+` boundary inside an
|
|
830
|
+
* ellipsis is never a lossless merge — the elided middle can't be "joined
|
|
831
|
+
* in" — so there's no indent-dependent fallback to prefer, and no reason
|
|
832
|
+
* to reflow it.
|
|
833
|
+
*
|
|
687
834
|
* @default false
|
|
688
835
|
*/
|
|
689
836
|
preserveConcatenation?: boolean;
|
|
@@ -694,6 +841,12 @@ export interface ToCDNOptions {
|
|
|
694
841
|
* `{"a": 1}`, `(_ "a", "b")`). Nested leaf containers still collapse
|
|
695
842
|
* individually: `[[1, 2], [3, 4]]` renders with one inner array per line.
|
|
696
843
|
*
|
|
844
|
+
* `<<...>>` (CBOR Sequence Literal / embedded CBOR) is the one exception:
|
|
845
|
+
* since it's a flat sequence of encoded items rather than a
|
|
846
|
+
* nested-structure display, an entry that is itself an array/map still
|
|
847
|
+
* inlines there as long as its own rendering fits on one line — e.g.
|
|
848
|
+
* `<<{1: -7}>>` stays on one line, even though `[{1: -7}]` would not.
|
|
849
|
+
*
|
|
697
850
|
* Containers with preserved comments are always emitted in multi-line
|
|
698
851
|
* form. Has no effect when `indent` is omitted.
|
|
699
852
|
*
|
|
@@ -730,6 +883,15 @@ export interface CborComment {
|
|
|
730
883
|
end: number;
|
|
731
884
|
line: number;
|
|
732
885
|
col: number;
|
|
886
|
+
/**
|
|
887
|
+
* `true` when this is a `leading` comment that ends on the same source
|
|
888
|
+
* line as the node it's attached to — e.g. `/ protected / << ... >>` in an
|
|
889
|
+
* RFC 9052-style annotated array, as opposed to a comment on its own line
|
|
890
|
+
* above the value. `toCDN()` renders these as an inline prefix on the
|
|
891
|
+
* value's own line instead of a separate line above it. `undefined` for
|
|
892
|
+
* `trailing`/`dangling` comments, where it doesn't apply.
|
|
893
|
+
*/
|
|
894
|
+
sameLine?: boolean;
|
|
733
895
|
}
|
|
734
896
|
export interface CborComments {
|
|
735
897
|
leading?: CborComment[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cbortech/cbor",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.7",
|
|
4
4
|
"description": "Convert between CBOR, CDN (CBOR-EDN), and JavaScript values with CDDL validation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cbor",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"@vitest/ui": "^4.1.10",
|
|
127
127
|
"cross-env": "^10.1.0",
|
|
128
128
|
"playwright": "^1.61.1",
|
|
129
|
-
"prettier": "^3.9.
|
|
129
|
+
"prettier": "^3.9.6",
|
|
130
130
|
"typescript": "^5.9.3",
|
|
131
131
|
"vite": "^8.1.5",
|
|
132
132
|
"vite-plugin-dts": "^4.5.4",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const e=require("./tokenizer-EciPlN0n.cjs");var t=Symbol.for(`cbor.tag`),n=class{valueOf(){return null}toJSON(){return null}},r=class{valueOf(){}toJSON(){}};function i(e){if(!c(e))return;let n=e[t];return typeof n==`bigint`?n:void 0}function a(e,i){let a;switch(typeof e){case`number`:a=new Number(e);break;case`string`:a=new String(e);break;case`boolean`:a=new Boolean(e);break;case`bigint`:a=Object(e);break;case`undefined`:a=new r;break;case`object`:if(e===null){a=new n;break}a=e;break;default:throw TypeError(`setCborTag: cannot tag value of type ${typeof e}`)}return a[t]=i,a}function o(e){if(e instanceof Number||e instanceof String||e instanceof Boolean||Object.prototype.toString.call(e)===`[object BigInt]`)return e.valueOf();if(e instanceof n)return null;if(!(e instanceof r))return typeof e==`object`&&e&&delete e[t],e}function s(e){if(e instanceof Number||e instanceof String||e instanceof Boolean||Object.prototype.toString.call(e)===`[object BigInt]`)return e.valueOf();if(e instanceof n)return null;if(!(e instanceof r))return e}function c(e){return typeof e==`object`&&!!e}var l=class{constructor(){}static symbol=t;static Null=n;static Undefined=r;static get(e){return i(e)}static set(e,t){return a(e,t)}static remove(e){return o(e)}static getValue(e){return s(e)}},u=Symbol(`cbor.omit`),d=class e{value;constructor(e){if(!Number.isInteger(e)||e<0||e>255)throw RangeError(`Simple value must be an integer in 0–255`);this.value=e}valueOf(){return this.value}toJSON(){throw TypeError(`simple(${this.value}) cannot be serialized to JSON`)}static is(t){return t instanceof e}static get(t){return t instanceof e?t.value:void 0}};function f(e){let t=e?.indent;if(t===void 0)return null;let n=typeof t==`number`?` `.repeat(t):t;return n===``?null:n}function p(e,t){return e.repeat(t)}function m(e,t,n){return t===null?e.join(` + `):e.join(` +\n${p(t,n+1)}`)}function h(e){return!!(e.comments?.leading?.length||e.comments?.trailing?.length||e.comments?.dangling?.length)}function ee(e){return!!(e.comments?.trailing?.length||e.comments?.dangling?.length)}function g(e,t){if(!t)return e.text;let{marker:n,text:r}=e;if(t===`c-style`)return n===`#`?`//`+r.slice(1):n===`/`?`/*`+r.slice(1,-1)+`*/`:r;if(n===`//`)return`#`+r.slice(2);if(n===`/*`){let e=r.slice(2,-2);return e.includes(`/`)?r:`/`+(e.startsWith(`*`)||e.startsWith(`/`)?` `+e:e)+`/`}return r}function te(e,t,n){return(e.comments?.leading??[]).map(e=>t+g(e,n))}function _(e,t){let n=e.comments?.trailing??[];return n.length===0?``:` `+n.map(e=>g(e,t)).join(` `)}function ne(e,t,n){return(e.comments?.dangling??[]).map(e=>t+g(e,n))}function re(e,t=!1){let n=e?.commas??`comma`,r=n!==`none`;return{inlineSep:r?t?`,`:`, `:` `,multilineSep:r?`,`:``,trailSep:n===`trailing`?`,`:``,colSep:t?`:`:`: `}}function v(e){let{options:t,depth:n,openChar:r,closeChar:i,count:a}=e,o=f(t),s=t?.preserveComments,c=typeof s==`string`?s:void 0,l=o!==null&&s&&(ee(e.node)||e.hasEntryComments()),{inlineSep:u,multilineSep:d,trailSep:m,colSep:h}=re(t,o===null),g=e.indefiniteLength?``:x(t,e.encodingWidth,()=>b(BigInt(a))),_=g?g+` `:``,v=e.indefiniteLength&&(t?.encodingIndicators??`auto`)!==`never`,ie=t=>e.indefiniteLength?v?a===0?`${r}_ ${i}`:`${r}_ ${t}${i}`:`${r}${t}${i}`:`${r}${_}${t}${i}`;if(o===null||a===0&&!l){let t=``;for(let n=0;n<a;n++)n>0&&(t+=u),t+=e.renderEntry(n,h);return ie(t)}let ae=null;if(t?.inlineLeafContainers&&a>0&&!l){let t=[],n=!0;for(let r=0;r<a;r++){if(e.entryIsLeaf&&!e.entryIsLeaf(r)){n=!1;break}let i=e.renderEntry(r,h);if(t.push(i),i.includes(`
|
|
2
|
-
`)){n=!1;break}}if(n)return ie(t.join(u));ae=t}let oe=p(o,n+1),se=p(o,n),ce=e.indefiniteLength?v?`${r}_ `:r:`${r}${_}`,y=[];for(let t=0;t<a;t++){s&&y.push(...te(e.entryLeadingNode(t),oe,c));let n=t<a-1?d:m,r=ae?.[t]??e.renderEntry(t,h);y.push(`${oe}${r}${n}${s?e.entryTrailing(t,c):``}`)}return s&&y.push(...ne(e.node,oe,c)),`${ce}\n${y.join(`
|
|
3
|
-
`)}\n${se}${i}`}var ie=typeof new Uint8Array().toBase64==`function`;function ae(e){if(ie)return e.toBase64({omitPadding:!0});let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/=/g,``)}function oe(e){if(ie)return e.toBase64({alphabet:`base64url`,omitPadding:!0});let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}var se=`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`,ce=`0123456789ABCDEFGHIJKLMNOPQRSTUV`;function y(e,t){let n=``,r=0,i=0;for(let a of e)for(r=r<<8|a,i+=8;i>=5;)i-=5,n+=t[r>>i&31];return i>0&&(n+=t[r<<5-i&31]),n}function le(e){for(let t of e){let e=t.codePointAt(0);if(e<32||e===127)return!0}return!1}function ue(t,n,r){if(r===`string`){let e=fe(t);if(e!=null)return he(e)}if(r===`printable-string`||r===void 0){let e=fe(t);if(e!=null&&!le(e))return he(e)}switch(n){case`base64`:return`b64'${ae(t)}'`;case`base64url`:return`b64'${oe(t)}'`;case`base32`:return`b32'${y(t,se)}'`;case`base32hex`:return`h32'${y(t,ce)}'`;default:return`h'${e.r(t)}'`}}var de=new TextDecoder(`utf-8`,{fatal:!0});function fe(e){try{return de.decode(e)}catch{return null}}function pe(e,t){for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===t||r===92||r<32||r===127||r>=8192&&(r===8232||r===8233||r>=8203&&r<=8205||r===65279))return!0}return!1}function me(e,t){let n=t.codePointAt(0);if(!pe(e,n))return t+e+t;let r=t;for(let i of e){let e=i.codePointAt(0);switch(e){case n:r+=`\\${t}`;break;case 92:r+=`\\\\`;break;case 10:r+=`\\n`;break;case 13:r+=`\\r`;break;case 9:r+=`\\t`;break;default:e<32||e===127||e===8232||e===8233||e===8203||e===8204||e===8205||e===65279?r+=`\\u${e.toString(16).padStart(4,`0`)}`:r+=i}}return r+t}function he(e){return me(e,`'`)}function ge(e){return me(e,`'`)}function _e(e){return me(e,`"`)}function ve(e){if(isNaN(e))return`NaN`;if(!isFinite(e))return e>0?`Infinity`:`-Infinity`;if(Object.is(e,-0))return`-0.0`;let t=e.toString();return t.includes(`.`)||t.includes(`e`)?t:t+`.0`}function ye(e,t,n,r){if(r===`never`)return``;let i=t??n;return r===`always`?i===`half`?`_1`:i===`single`?`_2`:`_3`:t===void 0||t===n?``:t===`half`?`_1`:t===`single`?`_2`:`_3`}function b(e){return e<=23n?`i`:e<=255n?0:e<=65535n?1:e<=4294967295n?2:3}function x(e,t,n){let r=e?.encodingIndicators??`auto`;return r===`never`?``:r===`always`?`_${t??n()}`:t===void 0?``:`_${t}`}var be=`getFloat16`in DataView.prototype&&`setFloat16`in DataView.prototype,xe=new DataView(new ArrayBuffer(8));function S(e){xe.setFloat64(0,e,!1);let t=xe.getUint32(0,!1),n=xe.getUint32(4,!1),r=t>>>31&1,i=t>>>20&2047,a=t&1048575;if(i===2047){if(a===0&&n===0)return r<<15|31744;let e=a>>10|(n===0?0:1)||1;return r<<15|31744|e&1023}let o=i-1023+15;if(o>=31)return r<<15|31744;let s,c,l;if(o<=0){if(o<-10)return r<<15;let e=1<<20|a,t=11-o;t<=20?(s=e>>t&1023,c=e>>t-1&1,l=(e&(1<<t-1)-1)!=0||n!==0):(s=0,c=1,l=a!==0||n!==0)}else s=a>>10,c=a>>9&1,l=(a&511)!=0||n!==0;if(c!==0&&(l||s&1)&&s++,s>=1024){let e=o<=0?1:o+1;return e>=31?r<<15|31744:r<<15|e<<10}let u=o<=0?0:o;return r<<15|u<<10|s}function C(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023;return n===31?r===0?t?-1/0:1/0:NaN:n===0?r===0?t?-0:0:(t?-1:1)*2**-14*(r/1024):(t?-1:1)*2**(n-15)*(1+r/1024)}var Se=be?(e,t,n,r)=>{e.setFloat16(t,n,r)}:(e,t,n,r)=>{e.setUint16(t,S(n),r)},w=new DataView(new ArrayBuffer(8)),T=new Uint8Array(w.buffer),Ce=new TextEncoder,we=typeof Ce.encodeInto==`function`;function Te(e){return e<=23?1:e<=255?2:e<=65535?3:e<=4294967295?5:9}function Ee(e){return e===`i`?1:[2,3,5,9][e]}var De=class{buf;len=0;constructor(e=256){this.buf=new Uint8Array(e)}_ensure(e){let t=this.len+e;if(t<=this.buf.length)return;let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Uint8Array(n);r.set(this.buf),this.buf=r}writeByte(e){this._ensure(1),this.buf[this.len++]=e}writeBytes(e){this._ensure(e.length),this.buf.set(e,this.len),this.len+=e.length}writeUint16(e){this._ensure(2);let t=this.buf;t[this.len++]=e>>>8&255,t[this.len++]=e&255}writeUint32(e){this._ensure(4);let t=this.buf;t[this.len++]=e>>>24&255,t[this.len++]=e>>>16&255,t[this.len++]=e>>>8&255,t[this.len++]=e&255}writeBigUint64(e){w.setBigUint64(0,e,!1),this._ensure(8),this.buf.set(T,this.len),this.len+=8}writeFloat16(e){Se(w,0,e,!1),this._ensure(2);let t=this.buf;t[this.len++]=T[0],t[this.len++]=T[1]}writeFloat32(e){w.setFloat32(0,e,!1),this._ensure(4);let t=this.buf;t[this.len++]=T[0],t[this.len++]=T[1],t[this.len++]=T[2],t[this.len++]=T[3]}writeFloat64(e){w.setFloat64(0,e,!1),this._ensure(8),this.buf.set(T,this.len),this.len+=8}writeTextString(e,t,n){if(!we){let r=Ce.encode(t);E(this,e,r.length,n),this.writeBytes(r);return}let r=n===void 0?Te(t.length):Ee(n);this._ensure(9+3*t.length);let{written:i}=Ce.encodeInto(t,this.buf.subarray(this.len+r)),a=n===void 0?Te(i):r;a!==r&&this.buf.copyWithin(this.len+a,this.len+r,this.len+r+i),E(this,e,i,n),this.len+=i}finish(){return this.buf.slice(0,this.len)}},Oe=[255n,65535n,4294967295n,18446744073709551615n];function ke(e){return e===`i`?23n:Oe[e]}function E(e,t,n,r){if(r===void 0&&typeof n==`number`&&n<4294967296){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));return}let i=typeof n==`number`?BigInt(n):n;if(r!==void 0){if(r===`i`){if(i>23n)throw RangeError(`value ${i} does not fit in immediate encoding _i (max 23)`);e.writeByte(t<<5|Number(i));return}if(i>Oe[r])throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${Oe[r]})`);let n=24+r;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);return}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))}function Ae(e,t,n){let r=new De(9);return E(r,e,t,n),r.finish()}var je=new DataView(new ArrayBuffer(4));function Me(e){return Object.is(C(S(e)),e)}function Ne(e){return je.setFloat32(0,e,!1),Object.is(je.getFloat32(0,!1),e)}function D(e){return Me(e)?`half`:Ne(e)?`single`:`double`}var O=class t{start;end;comments;warnings;_defaults;get _containsCdnContainer(){return!1}toCBOR(e){let t=this._defaults?{...this._defaults,...e}:e,n=new De;return this._encode(n,t),n.finish()}toCDN(e){let t=this._defaults?{...this._defaults,...e}:e,n=this._toCDN(t,0),r=t?.preserveComments;if(!r||f(t)===null)return n;let i=typeof r==`string`?r:void 0,a=this.comments?.leading?.map(e=>g(e,i))??[],o=this.comments?.trailing??[],s=o.length===0?n:`${n} ${o.map(e=>g(e,i).trimEnd()).join(` `)}`;return[...a,s].join(`
|
|
4
|
-
`)}toEDN(e){return this.toCDN(e)}toJS(e){let t=this._defaults?{...this._defaults,...e}:e,n=this._toJS(t);if(!t?.reviver)return n;let r=t.reviver.call({"":n},``,n);return r===u?void 0:r}toHexDump(e){let t=this._defaults?{...this._defaults,...e}:e,n=t?.indent??3,r=typeof n==`string`?n:` `.repeat(n),i=(t?.commentStyle??`--`)+` `,a=this._toHexDump(0,t),o=0;for(let e of a){let t=e.depth*r.length+e.hex.length;t>o&&(o=t)}let s=o+2;return a.map(e=>(r.repeat(e.depth)+e.hex).padEnd(s)+i+e.comment).join(`
|
|
5
|
-
`)}_encode(e,n){if(this._toCBOR!==t.prototype._toCBOR){e.writeBytes(this._toCBOR(n));return}this._encodeTo(e,n)}_encodeTo(e,n){if(this._toCBOR===t.prototype._toCBOR)throw TypeError(`CborItem subclass must implement _encodeTo() or _toCBOR()`);e.writeBytes(this._toCBOR(n))}_toCBOR(e){let t=new De;return this._encodeTo(t,e),t.finish()}_toHexDump(t,n){return[{depth:t,hex:e.i(this._toCBOR()),comment:this._toCDN(n,0)}]}},k=class extends O{value;encodingWidth;constructor(e,t){if(super(),this.value=BigInt(e),this.value<0n)throw RangeError(`CborUint value must be non-negative`);if(this.value>18446744073709551615n)throw RangeError(`CborUint value exceeds maximum uint64`);this.encodingWidth=t?.encodingWidth}_encodeTo(e,t){E(e,0,this.value,this.encodingWidth)}_toCDN(e,t){let n=x(e,this.encodingWidth,()=>b(this.value)),r=this.value;switch(e?.intFormat){case`hex`:return`0x${r.toString(16)}${n}`;case`octal`:return`0o${r.toString(8)}${n}`;case`binary`:return`0b${r.toString(2)}${n}`;default:return r.toString()+n}}_toJS(e){let t=e?.integerAs??`auto`;return t===`bigint`?this.value:t===`number`||this.value<=BigInt(2**53-1)?Number(this.value):this.value}},A=class extends O{argument;encodingWidth;constructor(e,t){super();let n=BigInt(e);if(n>=0n)throw RangeError(`CborNint value must be negative`);if(n<-18446744073709551616n)throw RangeError(`CborNint value exceeds minimum int64`);this.argument=-1n-n,this.encodingWidth=t?.encodingWidth}get value(){return-1n-this.argument}_encodeTo(e,t){E(e,1,this.argument,this.encodingWidth)}_toCDN(e,t){let n=x(e,this.encodingWidth,()=>b(this.argument)),r=this.argument+1n;switch(e?.intFormat){case`hex`:return`-0x${r.toString(16)}${n}`;case`octal`:return`-0o${r.toString(8)}${n}`;case`binary`:return`-0b${r.toString(2)}${n}`;default:return this.value.toString()+n}}_toJS(e){let t=this.value,n=e?.integerAs??`auto`;return n===`bigint`?t:n===`number`||t>=BigInt(-(2**53-1))?Number(t):t}},Pe=new DataView(new ArrayBuffer(8));function Fe(e){let t=e.startsWith(`-`),n=e.slice(t?3:2),r=n.search(/[pP]/);if(r===-1)throw SyntaxError(`EDN parse error: hex float missing 'p' exponent: ${e}`);let i=n.slice(0,r),a=n.slice(r+1);if(!/^[+-]?\d+$/.test(a))throw SyntaxError(`EDN parse error: hex float has invalid or missing exponent: ${e}`);let o=parseInt(a,10),s=i.indexOf(`.`),c;if(s===-1){if(!/^[0-9a-fA-F]+$/.test(i))throw SyntaxError(`EDN parse error: hex float has no mantissa digits: ${e}`);c=parseInt(i,16)}else{let t=i.slice(0,s),n=i.slice(s+1);if(t===``&&n===``)throw SyntaxError(`EDN parse error: hex float has no mantissa digits: ${e}`);if(t!==``&&!/^[0-9a-fA-F]+$/.test(t)||n!==``&&!/^[0-9a-fA-F]+$/.test(n))throw SyntaxError(`EDN parse error: hex float has invalid mantissa: ${e}`);c=(t===``?0:parseInt(t,16))+(n===``?0:parseInt(n,16)/16**n.length)}let l=c*2**o;return t?-l:l}function Ie(e){if(isNaN(e))return`NaN`;if(!isFinite(e))return e>0?`Infinity`:`-Infinity`;let t=Object.is(e,-0)||e<0,n=Math.abs(e);if(n===0)return t?`-0x0p+0`:`0x0p+0`;Pe.setFloat64(0,n,!1);let r=Pe.getUint32(0,!1),i=Pe.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;a===0?(u=`0`,d=-1022):(u=`1`,d=a-1023);let f=d>=0?`+${d}`:`${d}`,p=`0x${u}${l}p${f}`;return t?`-${p}`:p}var j=class extends O{value;precision;ednSource;rawBits;constructor(e,t){super(),this.value=e,this.precision=t?.precision,this.rawBits=t?.rawBits}_encodeTo(e,t){let n=this.precision??D(this.value),r=Number.isNaN(this.value)?this.rawBits:void 0;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))}_toCDN(e,t){let n=e?.encodingIndicators??`auto`;if(e?.appStrings!==!1&&this.ednSource!==void 0&&(f(e)!==null||!/[\r\n]/.test(this.ednSource))){let e=this.ednSource;if(n===`never`)return e.replace(/_[0-3i]$/,``);if(n===`always`){if(/_[0-3i]$/.test(e))return e;let t=this.precision??D(this.value);return e+(t===`half`?`_1`:t===`single`?`_2`:`_3`)}return e}let r=D(this.value);return(e?.floatFormat===`hex`?Ie(this.value):ve(this.value))+ye(this.value,this.precision,r,n)}_toJS(e){return this.value}},M=class extends O{tag;content;encodingWidth;constructor(e,t,n){if(super(),this.tag=BigInt(e),this.tag<0n)throw RangeError(`CborTag tag number must be non-negative`);this.content=t,this.encodingWidth=n?.encodingWidth}get _containsCdnContainer(){return this.content._containsCdnContainer}_encodeTo(e,t){E(e,6,this.tag,this.encodingWidth),this.content._encode(e,t)}_toCDN(e,t){let n=x(e,this.encodingWidth,()=>b(this.tag));return`${this.tag}${n}(${this.content._toCDN(e,t)})`}_toHexDump(t,n){let r=[{depth:t,hex:e.i(Ae(6,this.tag,this.encodingWidth)),comment:`Tag ${this.tag}`}];return r.push(...this.content._toHexDump(t+1,{...n,appStrings:!1})),r}_toJS(e){let t=this.content._toJS(e);return e?.stripTags?t:l.set(t,this.tag)}},N=class extends O{indefiniteLength=!1;value;ednEncoding;encodingWidth;ednSource;ednParts;constructor(e,t){super(),this.value=e,this.ednEncoding=t?.ednEncoding??`hex`,this.encodingWidth=t?.encodingWidth,this.ednSource=t?.ednSource,this.ednParts=t?.ednParts}_encodeTo(e,t){E(e,2,this.value.length,this.encodingWidth),e.writeBytes(this.value)}_toCDN(e,t){let n=f(e);if(e?.preserveConcatenation&&n!==null&&this.ednParts!==void 0&&this.ednParts.length>1){let r=x(e,this.encodingWidth,()=>b(BigInt(this.value.length))),i=e?.bstrEncoding??this.ednEncoding;e?.appStrings===!1&&i!==`hex`&&(i=`hex`);let a=this.ednParts.map(t=>e?.preserveByteString&&t.source!==void 0?t.source:ue(t.bytes,i,e?.sqstr));return a[a.length-1]+=r,m(a,n,t)}if(e?.preserveByteString&&this.ednSource!==void 0&&(n!==null||!/[\r\n]/.test(this.ednSource))){if(/_[0-3i]$/.test(this.ednSource))return(e?.encodingIndicators??`auto`)===`never`?this.ednSource.replace(/_[0-3i]$/,``):this.ednSource;let t=x(e,this.encodingWidth,()=>b(BigInt(this.value.length)));return this.ednSource+t}let r=x(e,this.encodingWidth,()=>b(BigInt(this.value.length))),i=e?.bstrEncoding??this.ednEncoding;return e?.appStrings===!1&&i!==`hex`&&(i=`hex`),ue(this.value,i,e?.sqstr)+r}_toJS(e){return this.value}},P=class extends O{indefiniteLength=!0;chunks;constructor(e){super(),this.chunks=e}_encodeTo(e,t){e.writeByte(95);for(let n of this.chunks)n._encode(e,t);e.writeByte(255)}_toCDN(e,t){if((e?.encodingIndicators??`auto`)===`never`){let n=this.chunks.reduce((e,t)=>e+t.value.length,0),r=new Uint8Array(n),i=0;for(let e of this.chunks)r.set(e.value,i),i+=e.value.length;return new N(r)._toCDN(e,t)}return this.chunks.length===0?`''_`:v({node:this,options:e,depth:t,openChar:`(`,closeChar:`)`,count:this.chunks.length,indefiniteLength:!0,encodingWidth:void 0,hasEntryComments:()=>this.chunks.some(h),renderEntry:n=>this.chunks[n]._toCDN(e,t+1),entryLeadingNode:e=>this.chunks[e],entryTrailing:(e,t)=>_(this.chunks[e],t)})}_toHexDump(t,n){let r=[{depth:t,hex:e.n(95),comment:`Start indefinite-length byte string`}];for(let e of this.chunks)r.push(...e._toHexDump(t+1,n));return r.push({depth:t,hex:e.n(255),comment:`"break"`}),r}_toJS(e){let t=this.chunks.reduce((e,t)=>e+t.value.length,0),n=new Uint8Array(t),r=0;for(let e of this.chunks)n.set(e.value,r),r+=e.value.length;return n}},F=class extends O{indefiniteLength=!0;chunks;constructor(e){super(),this.chunks=e}_encodeTo(e,t){e.writeByte(127);for(let n of this.chunks)n._encode(e,t);e.writeByte(255)}_toCDN(e,t){return(e?.encodingIndicators??`auto`)===`never`?new H(this.chunks.map(e=>e.value).join(``))._toCDN(e,t):this.chunks.length===0?`""_`:v({node:this,options:e,depth:t,openChar:`(`,closeChar:`)`,count:this.chunks.length,indefiniteLength:!0,encodingWidth:void 0,hasEntryComments:()=>this.chunks.some(h),renderEntry:n=>this.chunks[n]._toCDN(e,t+1),entryLeadingNode:e=>this.chunks[e],entryTrailing:(e,t)=>_(this.chunks[e],t)})}_toHexDump(t,n){let r=[{depth:t,hex:e.n(127),comment:`Start indefinite-length text string`}];for(let e of this.chunks)r.push(...e._toHexDump(t+1,n));return r.push({depth:t,hex:e.n(255),comment:`"break"`}),r}_toJS(e){return this.chunks.map(e=>e.value).join(``)}},I=class extends O{items;indefiniteLength;encodingWidth;constructor(e,t){super(),this.items=e,this.indefiniteLength=t?.indefiniteLength??!1,this.encodingWidth=t?.encodingWidth}get _containsCdnContainer(){return!0}_encodeTo(e,t){if(this.indefiniteLength){e.writeByte(159);for(let n of this.items)n._encode(e,t);e.writeByte(255);return}E(e,4,this.items.length,this.encodingWidth);for(let n of this.items)n._encode(e,t)}_toCDN(e,t){return v({node:this,options:e,depth:t,openChar:`[`,closeChar:`]`,count:this.items.length,indefiniteLength:this.indefiniteLength,encodingWidth:this.encodingWidth,hasEntryComments:()=>this.items.some(h),renderEntry:n=>this.items[n]._toCDN(e,t+1),entryIsLeaf:e=>!this.items[e]._containsCdnContainer,entryLeadingNode:e=>this.items[e],entryTrailing:(e,t)=>_(this.items[e],t)})}_toHexDump(t,n){if(this.indefiniteLength){let r=[{depth:t,hex:e.n(159),comment:`Start indefinite-length array`}];for(let e of this.items)r.push(...e._toHexDump(t+1,n));return r.push({depth:t,hex:e.n(255),comment:`"break"`}),r}let r=[{depth:t,hex:e.i(Ae(4,BigInt(this.items.length),this.encodingWidth)),comment:`Array of length ${this.items.length}`}];for(let e of this.items)r.push(...e._toHexDump(t+1,n));return r}_toJS(e){let t=e?.reviver;if(!t)return this.items.map(t=>t._toJS(e));let n=e?{...e,reviver:void 0}:void 0,r=this.items.map(e=>e._toJS(n)),i=0;for(let n=0;n<this.items.length;n++){let a=n-i,o=this.items[n]._toJS(e),s=t.call(r,String(n),o);s===u||e?.undefinedOmits&&s===void 0?(r.splice(a,1),i++):r[a]=s}return r}},L=class extends O{entries;indefiniteLength;encodingWidth;constructor(e,t){super(),this.entries=e,this.indefiniteLength=t?.indefiniteLength??!1,this.encodingWidth=t?.encodingWidth}get _containsCdnContainer(){return!0}_encodeTo(e,t){if(this.indefiniteLength){e.writeByte(191);for(let[n,r]of this.entries)n._encode(e,t),r._encode(e,t);e.writeByte(255);return}E(e,5,this.entries.length,this.encodingWidth);for(let[n,r]of this.entries)n._encode(e,t),r._encode(e,t)}_toCDN(e,t){return v({node:this,options:e,depth:t,openChar:`{`,closeChar:`}`,count:this.entries.length,indefiniteLength:this.indefiniteLength,encodingWidth:this.encodingWidth,hasEntryComments:()=>this.entries.some(([e,t])=>h(e)||h(t)),renderEntry:(n,r)=>{let[i,a]=this.entries[n];return`${i._toCDN(e,t+1)}${r}${a._toCDN(e,t+1)}`},entryIsLeaf:e=>{let[t,n]=this.entries[e];return!t._containsCdnContainer&&!n._containsCdnContainer},entryLeadingNode:e=>this.entries[e][0],entryTrailing:(e,t)=>{let[n,r]=this.entries[e];return Le([...n.comments?.trailing??[],...r.comments?.leading??[],...r.comments?.trailing??[]],t)}})}_toHexDump(t,n){if(this.indefiniteLength){let r=[{depth:t,hex:e.n(191),comment:`Start indefinite-length map`}];for(let[e,i]of this.entries)r.push(...e._toHexDump(t+1,n)),r.push(...i._toHexDump(t+1,n));return r.push({depth:t,hex:e.n(255),comment:`"break"`}),r}let r=[{depth:t,hex:e.i(Ae(5,BigInt(this.entries.length),this.encodingWidth)),comment:`Map of length ${this.entries.length}`}];for(let[e,i]of this.entries)r.push(...e._toHexDump(t+1,n)),r.push(...i._toHexDump(t+1,n));return r}_toJS(e){let t=e?.reviver,n=()=>{let n=$.from(this.entries,([t,n])=>[t._toJS(e),n._toJS(e)]);if(!t)return n;let r=e?.undefinedOmits;for(let e=0;e<n.length;e++){let[i,a]=n[e],o=t.call(n,i,a);o===u||r&&o===void 0?n.splice(e--,1):n[e]=[i,o]}return n};return e?.mapAs===`entries`?n():e?.mapAs===`object`||this.entries.every(([e])=>e instanceof H)?(()=>{let n=e?{...e,reviver:void 0}:void 0,r={};for(let[e,t]of this.entries){let i=e instanceof H?e.value:e.toCDN(),a=t._toJS(n);i===`__proto__`?Object.defineProperty(r,i,{value:a,writable:!0,enumerable:!0,configurable:!0}):r[i]=a}if(!t)return r;let i=new Map;for(let e=0;e<this.entries.length;e++){let[t]=this.entries[e];i.set(t instanceof H?t.value:t.toCDN(),e)}for(let n=0;n<this.entries.length;n++){let[a,o]=this.entries[n],s=a instanceof H?a.value:a.toCDN();if(i.get(s)!==n)continue;let c=o._toJS(e),l=t.call(r,s,c);l===u||e?.undefinedOmits&&l===void 0?delete r[s]:s===`__proto__`?Object.defineProperty(r,s,{value:l,writable:!0,enumerable:!0,configurable:!0}):r[s]=l}return r})():n()}};function Le(e,t){return e.length===0?``:` `+e.map(e=>g(e,t).trimEnd()).join(` `)}var R=class e extends O{value;constructor(e){if(super(),!Number.isInteger(e)||e<0||e>255)throw RangeError(`CborSimple value must be an integer in 0–255`);this.value=e}static FALSE=new e(20);static TRUE=new e(21);static NULL=new e(22);static UNDEFINED=new e(23);_encodeTo(e,t){if(this.value<=23){e.writeByte(224|this.value);return}e.writeByte(248),e.writeByte(this.value)}_toCDN(e,t){switch(this.value){case 20:return`false`;case 21:return`true`;case 22:return`null`;case 23:return`undefined`;default:return`simple(${this.value})`}}_toJS(e){switch(this.value){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:return new d(this.value)}}},Re=class extends O{items;encodingWidth;constructor(e,t){super(),this.items=e,this.encodingWidth=t?.encodingWidth}get _containsCdnContainer(){return this.items.some(e=>e._containsCdnContainer)}_content(e){let t=new De;for(let n of this.items)n._encode(t,e);return t.finish()}_encodeTo(e,t){let n=this._content(t);E(e,2,n.length,this.encodingWidth),e.writeBytes(n)}_toCDN(e,t){let n=x(e,this.encodingWidth,()=>b(BigInt(this._content(e).length)));if(this.items.length===0)return`<<>>${n}`;let r=f(e),{inlineSep:i,multilineSep:a,trailSep:o}=re(e,r===null);if(r===null)return`<<${this.items.map(n=>n._toCDN(e,t+1)).join(i)}>>${n}`;let s=p(r,t+1),c=p(r,t),l=this.items.map(n=>`${s}${n._toCDN(e,t+1)}`),u=l.length-1;return`<<\n${l.map((e,t)=>t<u?`${e}${a}`:`${e}${o}`).join(`
|
|
6
|
-
`)}\n${c}>>${n}`}_toHexDump(t,n){let r=this._content().length,i=[{depth:t,hex:e.i(Ae(2,BigInt(r),this.encodingWidth)),comment:`Embedded CBOR sequence, ${r} byte${r===1?``:`s`}`}];for(let e of this.items)i.push(...e._toHexDump(t+1,n));return i}_toJS(e){return this._content()}};function ze(e,t){let n=e.indexOf(`=`),r=n>=0?e.slice(0,n):e,i=n>=0?e.slice(n):``;if(/[^A-Za-z0-9+/\-_]/.test(r)){let e=[...r].find(e=>!/[A-Za-z0-9+/\-_]/.test(e))??``;throw SyntaxError(`invalid character ${JSON.stringify(e)} in base64 data`)}if(i&&!/^=+$/.test(i))throw SyntaxError(`invalid character after base64 '=' padding`);let a=r.length%4;if(a===1)throw SyntaxError(`invalid base64 length: ${r.length} data characters (length mod 4 = 1 is never valid)`);let o=a===0?0:4-a;if(i.length>o){let e=`base64 has ${i.length} '=' character${i.length>1?`s`:``} but the data length (${r.length}) requires at most ${o}`;if(t)t(e);else throw SyntaxError(e)}if(i.length>0&&i.length<o){let e=`base64 has ${i.length} '=' character${i.length>1?`s`:``} but needs exactly ${o} — use full padding or no padding at all`;if(t)t(e);else throw SyntaxError(e)}if(a!==0&&r.length>0){let e=r[r.length-1].replace(`-`,`+`).replace(`_`,`/`),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.indexOf(e);if(n>=0&&n&(a===2?15:3)){let e=`base64 has non-zero trailing bits in the final quantum (RFC 4648 §3.5)`;if(t)t(e);else throw SyntaxError(e)}}let s=r.replace(/-/g,`+`).replace(/_/g,`/`)+`=`.repeat(o);if(typeof Uint8Array.fromBase64==`function`)return Uint8Array.fromBase64(s,{alphabet:`base64`,lastChunkHandling:`loose`});let c=atob(s),l=new Uint8Array(c.length);for(let e=0;e<c.length;e++)l[e]=c.charCodeAt(e);return l}var Be=999n,Ve=class extends M{constructor(e,t){let n=t.length===1&&t[0]instanceof H?t[0]:new I(t);super(Be,new I([new H(e),n]))}_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);let n=this.content,r=n.items[0].value,i=n.items[1];return i instanceof H?`${r}${ge(i.value)}`:`${r}<<${i.items.map(n=>n._toCDN(e,t)).join(`, `)}>>`}},z=class extends O{inner;ednSource;constructor(e,t){super(),this.inner=e,this.ednSource=t}get _containsCdnContainer(){return this.inner._containsCdnContainer}_encodeTo(e,t){this.inner._encode(e,t)}_toCDN(e,t){let n=e?.encodingIndicators??`auto`;return e?.appStrings!==!1&&n===`auto`&&(f(e)!==null||!/[\r\n]/.test(this.ednSource))?this.ednSource:this.inner._toCDN(e,t)}_toJS(e){return this.inner._toJS(e)}},He=888n,B=class extends M{constructor(e){e===void 0?super(He,R.NULL):super(He,new I(e))}_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);if(this.content instanceof R)return`...`;if(this.content instanceof I){let n=this.content.items.map(n=>n._toCDN(e,t));return n.length===0?``:m(n,f(e),t)}return super._toCDN(e,t)}},Ue=2n,We=3n,Ge=18446744073709551615n,Ke=-18446744073709551616n;function qe(e){if(e<0n)throw RangeError(`bigintToBytes requires a non-negative value`);if(e===0n)return new Uint8Array;let t=e.toString(16);t.length%2!=0&&(t=`0`+t);let n=new Uint8Array(t.length/2);for(let e=0;e<n.length;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return n}function Je(e){let t=0n;for(let n of e)t=t<<8n|BigInt(n);return t}var Ye=class extends M{bigValue;constructor(e){if(e<=Ge)throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);super(Ue,new N(qe(e))),this.bigValue=e}_toCDN(e,t){return this.bigValue.toString()}_toJS(e){return this.bigValue}},Xe=class extends M{bigValue;constructor(e){if(e>=Ke)throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);super(We,new N(qe(-1n-e))),this.bigValue=e}_toCDN(e,t){return this.bigValue.toString()}_toJS(e){return this.bigValue}},Ze=new TextEncoder,Qe=new TextDecoder(`utf-8`,{fatal:!0}),$e=new TextDecoder(`utf-8`,{fatal:!1});function et(t,n){let r=new e.t(t,{offset:n?.offset,skipRS:n?._skipRS}),i=new dt(r,n??{}).parse();return n?.preserveComments&&it(i,r.comments,t),i}function tt(e){let t=e,n;return/[_][0-7i]$/.test(e)&&(n=e[e.length-1],t=e.slice(0,-2)),{numStr:t,rawSuffix:n}}function nt(e){return e.startsWith(`-`)?-BigInt(e.slice(1)):BigInt(e)}function rt(e,t){if(e.endsWith(`_i`)||e.endsWith(`_0`)){let n=`_0 and _i encoding indicators are not valid for floating-point values`;if(t)t(n),e=e.slice(0,-2);else throw SyntaxError(`EDN parse error: ${n}`)}else if(/[_][4567]$/.test(e)){let n=e[e.length-1],r=n===`7`?`indefinite-length encoding (_7) is not valid for floating-point values`:`encoding indicator _${n} (AI ${Number(n)+24}) is reserved and not valid`;if(t)t(r),e=e.slice(0,-2);else throw SyntaxError(`EDN parse error: ${r}`)}if(e===`NaN`)return{value:NaN,precision:void 0};if(e===`Infinity`)return{value:1/0,precision:void 0};if(e===`-Infinity`)return{value:-1/0,precision:void 0};let n=e,r;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)?{value:Fe(n),precision:r}:{value:parseFloat(n),precision:r}}function it(e,t,n){if(t.length===0)return;let r=at(e),i=st(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;for(let t of s){let r={...t},s=0,u=o.length;for(;s<u;){let e=s+u>>1;o[e].end<=t.start?s=e+1:u=e}let d=s>0?o[s-1]:void 0,f=d?n.slice(d.end,t.start):``;if(d&&i(d.end)===t.line&&!f.includes(`:`)){ot(d.node,`trailing`,r);continue}for(;l<a.length&&a[l].start<t.start;){let e=a[l++];for(;c.length>0&&c[c.length-1].end<=e.start;)c.pop();c.push(e)}for(;c.length>0&&c[c.length-1].end<=t.start;)c.pop();let p=c.length>0?c[c.length-1]:void 0;for(s=0,u=a.length;s<u;){let e=s+u>>1;a[e].start<t.end?s=e+1:u=e}let m=s<a.length?a[s]:void 0;if((!p||m&&m.end<=p.end)&&m){ot(m.node,`leading`,r);continue}ot(p?.node??e,`dangling`,r)}}function at(e){let t=[],n=e=>{if(e.start!==void 0&&e.end!==void 0&&t.push({node:e,start:e.start,end:e.end}),e instanceof I||e instanceof Re){for(let t of e.items)n(t);return}if(e instanceof L){for(let[t,r]of e.entries)n(t),n(r);return}if(e instanceof P||e instanceof F){for(let t of e.chunks)n(t);return}e instanceof M&&n(e.content)};return n(e),t}function ot(e,t,n){e.comments??={},e.comments[t]??=[],e.comments[t].push(n)}function st(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
7
|
-
`&&t.push(n+1);return n=>{let r=Math.max(0,Math.min(e.length,n));r>0&&r===e.length&&r--;let i=0,a=t.length-1;for(;i<=a;){let e=i+a>>1;t[e]<=r?i=e+1:a=e-1}return a+1}}var ct=e=>`import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`,lt=(e,t)=>`install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`,V=e=>`'${e}' is a default built-in extension that was excluded via the 'builtinExtensions' option; add it back to that array (or omit 'builtinExtensions' to use the default set)`,ut=new Map([[`b32`,ct(`b32`)],[`h32`,ct(`h32`)],[`same`,ct(`same`)],[`hash`,lt(`hash`,`@cbortech/hash-extension`)],[`uuid`,lt(`uuid`,`@cbortech/uuid-extension`)],[`UUID`,lt(`uuid`,`@cbortech/uuid-extension`)],[`dt`,V(`dt`)],[`DT`,V(`dt`)],[`ip`,V(`ip`)],[`IP`,V(`ip`)],[`cri`,V(`cri`)],[`CRI`,V(`cri`)],[`t1`,V(`t1`)],[`b1`,V(`b1`)],[`ilbs`,V(`ilbs`)],[`ilts`,V(`ilts`)],[`float`,V(`float`)]]),dt=class{t;_options;extByPrefix;extByTag;unresolvedExtension;_pendingWarnings=[];_hintedPrefixes=new Set;constructor(t,n){this.t=t,this._options=n,this.extByPrefix=new Map,this.extByTag=new Map,this.unresolvedExtension=n.unresolvedExtension??`cpa999`;let r=Z(n.builtinExtensions);for(let e of[...r,...n.extensions??[]]){for(let t of e.appStringPrefixes??[])this.extByPrefix.set(t,e);for(let t of e.tagNumbers??[])this.extByTag.set(t,e)}this.t.onEscapeWarning=(t,n,r,i,a)=>{let o={message:t,offset:n,line:r,column:i,endOffset:a};if(this._pendingWarnings.push(o),this._options.onWarning?this._options.onWarning(o):this._options.silent||console.warn(`CDN strict violation at line ${r}, column ${i}: ${t}`),this._options.strict!==!1)throw new e.o(t,{offset:n,line:r,column:i,endOffset:a})}}parse(){let e=this.parseValue();if(this._options.allowTrailing)return e;let t=this.t.peek();if(t.type!==`EOF`)for(this._warnOrFail(`unexpected token after value: ${JSON.stringify(t.value)}`,t),this._pendingWarnings.length>0&&(e.warnings??=[],e.warnings.push(...this._pendingWarnings),this._pendingWarnings=[]);this.t.peek().type!==`EOF`;)this.t.consume();return e}parseValue(){let e=this.t.peek().offset,t=this._parseValueNode();if(this.t.peek().type===`UNDERSCORE`){let e=this.t.consume();this._warnOrFail(`bare _ is not a valid encoding indicator; use _0, _1, _2, _3, or _i`,e)}if(this._pendingWarnings.length>0){t.warnings??=[];for(let e of this._pendingWarnings)t.warnings.push(e);this._pendingWarnings=[]}return t.start=e,t.end=this.t.lastEndOffset,t}_parseValueNode(){let e=this.t.peek();switch(e.type){case`INTEGER`:return this.parseIntegerOrTag();case`FLOAT`:return this.parseFloat();case`TSTR`:case`RAWSTRING`:return this.parseString();case`BYTES_HEX`:case`SQSTR`:case`BYTES_B64`:return this.t.consume(),this._parseBytesConcat(this._decodeBytesToken(e),e.type,e.raw);case`EMPTY_INDEF_BYTES`:return this.t.consume(),new P([]);case`EMPTY_INDEF_TEXT`:return this.t.consume(),new F([]);case`TRUE`:return this.t.consume(),new R(21);case`FALSE`:return this.t.consume(),new R(20);case`NULL`:return this.t.consume(),new R(22);case`UNDEFINED`:return this.t.consume(),new R(23);case`SIMPLE`:return this.parseSimple();case`LBRACKET`:return this.parseArray();case`LBRACE`:return this.parseMap();case`LPAREN`:return this.parseIndefGroup();case`LT_LT`:return this.parseEmbeddedCBOR();case`APP_STRING`:{this.t.consume();let t,n=``;if(this.t.peek().type===`ENCODING_INDICATOR`){let e=this.t.consume();t=this._resolveEncodingWidth(e.value,e),n=e.raw}let r=this.extByPrefix.get(e.appPrefix);if(!r?.parseAppString){if(r||this._hintMissingExtension(e.appPrefix,e),this.unresolvedExtension===`cpa999`)return new Ve(e.appPrefix,[new H(e.value)]);this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`,e)}{let i=this._pendingWarnings.length;try{let i=r.parseAppString(e.appPrefix,e.value,this._extOnError(e),t===void 0?void 0:{encodingWidth:t});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,{ednEncoding:i.ednEncoding,encodingWidth:i.encodingWidth,ednSource:e.raw+n}):(i instanceof j&&i.ednSource===void 0&&(i.ednSource=e.raw+n),i)}catch(t){if(this._options.strict!==!1)throw t;return this._pendingWarnings.length===i&&this._warn(t instanceof Error?t.message:String(t),e),new Ve(e.appPrefix,[new H(e.value)])}}}case`APP_SEQUENCE`:{this.t.consume();let t=[];for(;this.t.peek().type!==`GT_GT`;){if(this.t.peek().type===`EOF`&&this._fail(`unterminated ${e.appPrefix}<<...>>`,e),t.length>0)if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`GT_GT`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`<<...>> items must be separated by "," or whitespace`,this.t.peek());t.push(this.parseValue())}this.expect(`GT_GT`);let n,r;this.t.peek().type===`ENCODING_INDICATOR`&&(r=this.t.consume(),n=this._resolveEncodingWidth(r.value,r));let i=this.extByPrefix.get(e.appPrefix);if(!i){if(this._hintMissingExtension(e.appPrefix,e),this.unresolvedExtension===`cpa999`)return new Ve(e.appPrefix,t);this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`,e)}i.parseAppSequence||this._fail(`app-string extension ${JSON.stringify(e.appPrefix)} does not support <<...>> form`,e);{let a=this._pendingWarnings.length;try{let a=i.parseAppSequence(e.appPrefix,t,this._extOnError(e));n!==void 0&&this._applyEiToResult(a,n,r??e);let o=this.t.source.slice(e.offset,this.t.lastEndOffset);if(a instanceof j)a.ednSource===void 0&&(a.ednSource=o);else if(i.preserveAppSeqSource)return new z(a,o);return a}catch(n){if(this._options.strict!==!1)throw n;return this._pendingWarnings.length===a&&this._warn(n instanceof Error?n.message:String(n),e),new Ve(e.appPrefix,t)}}}case`ELLIPSIS`:{if(this.t.consume(),this.t.peek().type!==`PLUS`)return new B;let e=[new B];for(;this.t.peek().type===`PLUS`;)this.t.consume(),e.push(this.parseValue());return new B(e)}case`BYTES_HEX_ELIDED`:return this.t.consume(),this._parseHexElidedConcat(e);default:this._fail(`unexpected token: ${JSON.stringify(e.value)}`,e)}}parseIntegerOrTag(){let e=this.t.consume(),{numStr:t,rawSuffix:n}=tt(e.value),r=n===void 0?this.consumeEncodingIndicator():this._resolveEncodingWidth(n,e),i=nt(t);if(i>18446744073709551615n)return this.t.peek().type===`LPAREN`&&this._fail(`tag number exceeds maximum uint64`,e),new Ye(i);if(i<-18446744073709551616n)return new Xe(i);if(r!==void 0){let t=i>=0n?i:-(i+1n);r=this._validateEncodingFit(t,r,e)}let a=i>=0n?new k(i,r===void 0?void 0:{encodingWidth:r}):new A(i,r===void 0?void 0:{encodingWidth:r});if(this.t.peek().type===`LPAREN`){a instanceof k||this._fail(`tag number must be non-negative`,e),this.t.consume();let t=this._pendingWarnings.splice(0),n=this.parseValue();this.expect(`RPAREN`);let i=a.value,o=this.extByTag.get(i);if(o?.parseTag){let e=o.parseTag(i,n);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}let s=new M(i,n,r===void 0?void 0:{encodingWidth:r});return t.length>0&&(s.warnings??=[],s.warnings.push(...t)),s}return a}parseFloat(){let e=this.t.consume(),t=t=>this._warnOrFail(t,e),{value:n,precision:r}=rt(e.value,t);if(r===`half`||r===`single`){let e=r===`half`?C(S(n)):Math.fround(n);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`)}return new j(n,r===void 0?void 0:{precision:r})}parseString(){let e=this.t.consume();if(this.t.peek().type!==`PLUS`){let t=this.consumeEncodingIndicator(()=>BigInt(Ze.encode(e.value).length));return e.type===`RAWSTRING`?new H(e.value,{ednSource:e.raw,...t===void 0?{}:{encodingWidth:t}}):new H(e.value,t===void 0?void 0:{encodingWidth:t})}let t=!1,n=[e.type===`RAWSTRING`?{text:e.value,source:e.raw}:{text:e.value}];for(;this.t.peek().type===`PLUS`;){this.t.consume();let e=this.t.peek();e.type===`ELLIPSIS`?(this.t.consume(),n.push({ellipsis:!0}),t=!0):e.type===`TSTR`||e.type===`RAWSTRING`?(this.t.consume(),n.push(e.type===`RAWSTRING`?{text:e.value,source:e.raw}:{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)}if(!t){let e=n.map(e=>`text`in e?e.text:``),t=n.map(e=>`text`in e?e.source:void 0),r=e.join(``),i=this.consumeEncodingIndicator(()=>BigInt(Ze.encode(r).length));return new H(r,{ednParts:e,...t.some(e=>e!==void 0)?{ednPartSources:t}:{},...i===void 0?{}:{encodingWidth:i}})}let r=[],i=[],a=()=>{let e=i.map(e=>e.text),t=e.join(``);if(t!==``){let n=i.map(e=>e.source);r.push(new H(t,{ednParts:e,...n.some(e=>e!==void 0)?{ednPartSources:n}:{}}))}i.length=0};for(let e of n)`ellipsis`in e?(a(),r.push(new B)):i.push(e);return a(),new B(r)}_isBytesToken(e){return e===`BYTES_HEX`||e===`SQSTR`||e===`BYTES_B64`}_hexToBytes(t,n){try{return e.a(t)}catch(t){if(t instanceof e.o||!(t instanceof SyntaxError))throw t;this._fail(t.message,n)}}_decodeBytesToken(t){let n=e=>this._warnOrFail(e,t);switch(t.type){case`SQSTR`:{let e=t._sqstrBytes;return e===void 0?this._hexToBytes(t.value,t):e}case`BYTES_HEX`:return this._hexToBytes(t.value,t);case`BYTES_B64`:try{return ze(t.value,n)}catch(n){if(n instanceof e.o||!(n instanceof SyntaxError))throw n;this._fail(n.message,t)}default:this._fail(`expected byte string token`,t)}}_decodeUtf8(e,t){if(this._options.allowInvalidUtf8)return $e.decode(e);try{return Qe.decode(e)}catch{return this._warnOrFail(`byte string in text concatenation is not valid UTF-8`,t),$e.decode(e)}}_tokenTypeToCdnEncoding(e){return e===`BYTES_B64`?`base64`:`hex`}_parseBytesConcat(e,t,n){if(this.t.peek().type!==`PLUS`){let r=this.consumeEncodingIndicator(()=>BigInt(e.length));return new N(e,{ednEncoding:this._tokenTypeToCdnEncoding(t),ednSource:n,...r===void 0?{}:{encodingWidth:r}})}let r=!1,i=[{bytes:e,source:n}];for(;this.t.peek().type===`PLUS`;){this.t.consume();let e=this.t.peek();if(e.type===`ELLIPSIS`)this.t.consume(),i.push({ellipsis:!0}),r=!0;else if(e.type===`BYTES_HEX_ELIDED`){this.t.consume();let t=this._buildBytesElidedItems(e.value,e);for(let e of t)e instanceof B?(i.push({ellipsis:!0}),r=!0):e instanceof N&&i.push({bytes:e.value})}else this._isBytesToken(e.type)?(this.t.consume(),i.push({bytes:this._decodeBytesToken(e),source:e.raw})):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:Ze.encode(e.value)})):this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`,e)}if(!r){let e=i.map(e=>`bytes`in e?e:{bytes:new Uint8Array}),n=this._concatBytes(e.map(e=>e.bytes)),r=this.consumeEncodingIndicator(()=>BigInt(n.length));return new N(n,{ednEncoding:this._tokenTypeToCdnEncoding(t),ednParts:e,...r===void 0?{}:{encodingWidth:r}})}let a=[],o=[],s=()=>{o.length>0&&(a.push(new N(this._concatBytes([...o]))),o.length=0)};for(let e of i)`ellipsis`in e?(s(),a.push(new B)):o.push(e.bytes);return s(),new B(a)}_parseHexElidedConcat(e){let t=this._buildBytesElidedItems(e.value,e);for(;this.t.peek().type===`PLUS`;){this.t.consume();let e=this.t.peek();if(e.type===`ELLIPSIS`)this.t.consume(),t.push(new B);else if(e.type===`BYTES_HEX_ELIDED`){this.t.consume();let n=this._buildBytesElidedItems(e.value,e);this._mergeFirstBytesItem(t,n)}else if(this._isBytesToken(e.type)){this.t.consume();let n=this._decodeBytesToken(e),r=t[t.length-1];r instanceof N?t[t.length-1]=new N(this._concatBytes([r.value,n])):t.push(new N(n))}else this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`,e)}return new B(t)}_buildBytesElidedItems(e,t){let n=e.split(`...`),r=[];for(let e=0;e<n.length;e++)e>0&&r.push(new B),n[e].length>0&&r.push(new N(this._hexToBytes(n[e],t)));return r}_mergeFirstBytesItem(e,t){if(t.length===0)return;let n=e[e.length-1],r=t[0];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)}_concatBytes(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}parseSimple(){this.t.consume(),this.expect(`LPAREN`);let e=this.t.peek();e.type!==`INTEGER`&&this._fail(`expected integer inside simple(), got ${JSON.stringify(e.value)}`,e),this.t.consume();let{numStr:t}=tt(e.value),n=Number(nt(t));return this.expect(`RPAREN`),new R(n)}parseEmbeddedCBOR(){this.t.consume();let e=[];for(;this.t.peek().type!==`GT_GT`;){if(e.length>0)if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`GT_GT`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`<<...>> items must be separated by "," or whitespace`,this.t.peek());e.push(this.parseValue())}this.expect(`GT_GT`);let t;if(this.t.peek().type===`ENCODING_INDICATOR`){let e=this.t.consume();t=this._resolveEncodingWidth(e.value,e)}return new Re(e,{encodingWidth:t})}parseArray(){this.t.consume();let e=!1,t,n;this.t.peek().type===`UNDERSCORE`?(this.t.consume(),e=!0):this.t.peek().type===`ENCODING_INDICATOR`&&(n=this.t.consume(),n.value===`7`?(e=!0,this._warnOrFail(`encoding indicator _7 is non-standard; use _ to indicate indefinite length`,n),n=void 0):t=this._resolveEncodingWidth(n.value,n));let r=this._pendingWarnings.splice(0),i=[];for(;this.t.peek().type!==`RBRACKET`;){if(i.length>0)if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`RBRACKET`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`array items must be separated by "," or whitespace`,this.t.peek());i.push(this.parseValue())}this.expect(`RBRACKET`),t!==void 0&&n!==void 0&&(t=this._validateEncodingFit(BigInt(i.length),t,n));let a=new I(i,{indefiniteLength:e,encodingWidth:t});return r.length>0&&(a.warnings??=[],a.warnings.push(...r)),a}parseMap(){this.t.consume();let e=!1,t,n;this.t.peek().type===`UNDERSCORE`?(this.t.consume(),e=!0):this.t.peek().type===`ENCODING_INDICATOR`&&(n=this.t.consume(),n.value===`7`?(e=!0,this._warnOrFail(`encoding indicator _7 is non-standard; use _ to indicate indefinite length`,n),n=void 0):t=this._resolveEncodingWidth(n.value,n));let r=this._pendingWarnings.splice(0),i=[];for(;this.t.peek().type!==`RBRACE`;){if(i.length>0)if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`RBRACE`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`map entries must be separated by "," or whitespace`,this.t.peek());let e=this.parseValue();this.expect(`COLON`);let t=this.parseValue();i.push([e,t])}this.expect(`RBRACE`),t!==void 0&&n!==void 0&&(t=this._validateEncodingFit(BigInt(i.length),t,n));let a=new L(i,{indefiniteLength:e,encodingWidth:t});return r.length>0&&(a.warnings??=[],a.warnings.push(...r)),a}parseIndefGroup(){this.t.consume();let e=this.t.peek();if(e.type===`UNDERSCORE`)this.t.consume();else if(e.type===`ENCODING_INDICATOR`&&e.value===`7`)this.t.consume(),this._warnOrFail(`encoding indicator _7 is non-standard; use _ to indicate indefinite length`,e);else if(e.type===`ENCODING_INDICATOR`){let e=this.t.consume(),t=`encoding indicator _${e.value} is not valid in an indefinite string group; use _`;this._warnOrFail(t,e)}else e.type!==`RPAREN`&&this._warnOrFail(`indefinite string group is missing _ after (; interpreting as (_ ...)`,e);let t=this._pendingWarnings.splice(0),n=[];for(;this.t.peek().type!==`RPAREN`;){if(n.length>0)if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`RPAREN`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`indefinite string chunks must be separated by "," or whitespace`,this.t.peek());n.push(this.parseValue())}this.expect(`RPAREN`),n.length===0&&this._fail(`empty indefinite group (_ ) is ambiguous; use ''_ for bytes or ""_ for text`);let r=n[0];if(r instanceof N){let e=new P(n.map((e,t)=>{if(e instanceof N)return e;this._fail(`indefinite byte string chunk ${t} must be a byte string, not a text string`)}));return t.length>0&&(e.warnings=t),e}if(r instanceof H){let e=new F(n.map((e,t)=>{if(e instanceof H)return e;this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`)}));return t.length>0&&(e.warnings=t),e}this._fail(`indefinite group chunks must be byte strings or text strings`)}consumeEncodingIndicator(e){if(this.t.peek().type===`ENCODING_INDICATOR`){let t=this.t.consume(),n=this._resolveEncodingWidth(t.value,t);return n!==void 0&&e!==void 0&&(n=this._validateEncodingFit(e(),n,t)),n}}expect(e){let t=this.t.consume();return t.type!==e&&this._fail(`expected ${e}, got ${t.type} (${JSON.stringify(t.value)})`,t),t}_applyEiToResult(e,t,n){if(e instanceof j){let r=t===1?`half`:t===2?`single`:t===3?`double`:void 0;if(r===void 0)this._warnOrFail(`encoding indicator _${t} is not valid for a float; use _1, _2, or _3`,n);else if(e.precision!==r){if(r!==`double`){let t=r===`half`?C(S(e.value)):Math.fround(e.value);!Object.is(t,e.value)&&!isNaN(e.value)&&this._warnOrFail(`${e.value} cannot be exactly represented as ${r===`half`?`float16 (_1)`:`float32 (_2)`}`,n)}e.precision=r}}else if(e instanceof k){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(e.value,t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof A){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(e.argument,t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof N){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(e.value.length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof H){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(Ze.encode(e.value).length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof I){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(e.items.length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof L){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(e.entries.length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof M){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(e.tag,t,n);r!==void 0&&(e.encodingWidth=r)}}else this._warnOrFail(`encoding indicator _${t} is not applicable to this app-string result type`,n)}_validateEncodingFit(e,t,n){let r=ke(t);if(e<=r)return t;let i=`value ${e} does not fit in encoding indicator ${t===`i`?`_i (max 23)`:`_${t} (max ${r})`}`;this._warnOrFail(i,n)}_resolveEncodingWidth(e,t){if(e===`4`||e===`5`||e===`6`){let n=`encoding indicator _${e} (AI ${Number(e)+24}) is reserved and not valid`;this._warnOrFail(n,t);return}if(e===`7`){this._warnOrFail(`indefinite-length encoding (_7) is not valid here; use [_ ...] or {_ ...} for indefinite collections`,t);return}return e===`i`?`i`:Number(e)}_extOnError(e){return t=>this._warnOrFail(t,e)}_warnOrFail(e,t){this._warn(e,t),this._options.strict!==!1&&this._fail(e,t)}_hintMissingExtension(e,t){let n=ut.get(e);if(n===void 0||this._hintedPrefixes.has(e))return;this._hintedPrefixes.add(e);let r=`app-string prefix '${e}' requires an extension that is not enabled; ${n}`;this._options.onWarning?this._options.onWarning({message:r,...ft(t),hint:!0}):this._options.silent||console.warn(`CDN: ${r}`)}_warn(e,t){let n={message:e};if(t!==void 0&&Object.assign(n,ft(t)),this._pendingWarnings.push(n),this._options.onWarning)this._options.onWarning(n);else if(!this._options.silent){let n=t?` at line ${t.line}, column ${t.col}`:``;console.warn(`CDN strict violation${n}: ${e}`)}}_fail(t,n){throw new e.o(t,n?ft(n):void 0)}};function ft(e){return{offset:e.offset,line:e.line,column:e.col,endOffset:e.endOffset}}var pt=new TextEncoder,mt=!1,H=class extends O{indefiniteLength=!1;value;encodingWidth;ednParts;ednSource;ednPartSources;constructor(e,t){super(),this.value=e,this.encodingWidth=t?.encodingWidth,this.ednParts=t?.ednParts,this.ednSource=t?.ednSource,this.ednPartSources=t?.ednPartSources}_encodeTo(e,t){e.writeTextString(3,this.value,this.encodingWidth)}_toCDN(e,t){let n=x(e,this.encodingWidth,()=>b(BigInt(pt.encode(this.value).length)));return ht(this.value,n,e,t,this.ednParts,this.ednSource,this.ednPartSources)}_toJS(e){return this.value}};function ht(e,t,n,r,i,a,o){let s=f(n);if(n?.preserveRawString&&a!==void 0&&(s!==null||!/[\r\n]/.test(a)))return a+t;if(s===null)return _e(e)+t;let c=n?.preserveRawString?o:void 0,l=c?.some(e=>e!==void 0)??!1,{cdn:u,newline:d}=_t(n),p=n?.preserveConcatenation&&i!==void 0&&(i.length>1||l)?i:void 0;if(!u&&!d&&p===void 0)return _e(e)+t;let m=u?bt(e):null;if(p!==void 0&&(m===null||l)){let e=[];for(let[t,n]of p.entries()){let r=c?.[t];if(r!==void 0)e.push({text:n,contentDepth:0,source:r});else if(d){let t=new Map;for(let{point:e,contentDepth:r}of yt(n,0))t.set(e,r);e.push(...Ot(n,t))}else e.push({text:n,contentDepth:0})}return gt(e,t,s,r)}let h=new Map;if(m!==null)for(let{point:e,contentDepth:t}of m)h.set(e,t);if(d){let t=m===null?yt(e,0):xt(e);for(let{point:e,contentDepth:n}of t)h.has(e)||h.set(e,n)}let ee=Ot(e,h);return ee.length<=1?_e(e)+t:gt(ee,t,s,r)}function gt(e,t,n,r){let i=e.map(({text:n,source:r},i)=>{let a=r??_e(n);return i===e.length-1?a+t:a}),a=i[0];for(let t=1;t<i.length;t++){let o=p(n,r+1+e[t].contentDepth);a+=` +\n${o}${i[t]}`}return a}function _t(e){let t=e?.splitCdn===void 0||e?.splitNewline===void 0?vt(e?.textStringFormat??[]):[];return{cdn:e?.splitCdn??t.includes(`cdn`),newline:e?.splitNewline??t.includes(`newline`)}}function vt(e){return e.map(e=>e===`cboredn`?(mt||(mt=!0,console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")),`cdn`):e)}function yt(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r];i===`\r`?e[r+1]===`
|
|
8
|
-
`?(n.push({point:r+2,contentDepth:t}),r++):n.push({point:r+1,contentDepth:t}):i===`
|
|
9
|
-
`&&n.push({point:r+1,contentDepth:t})}return n}function bt(t){try{et(t)}catch{return null}let n=[],r=new e.t(t),i=0,a=null,o=!1,s=0;for(;;){let e=r.consume();if(e.type===`EOF`)break;let c=!1;if(o||(o=!0,e.offset>0&&Et(r.comments,0,e.offset)&&n.push({point:e.offset,contentDepth:i})),a!==null){if(a.kind===`opener`&&Ct.has(e.type)){a.point=e.endOffset,s=e.endOffset;continue}else a.kind===`opener`&&Tt.has(e.type)&&Dt(t,a.point,e.offset)?c=!0:n.push({point:e.offset,contentDepth:a.contentDepth});a=null}wt.has(e.type)?(i++,a={point:e.endOffset,contentDepth:i,kind:`opener`}):Tt.has(e.type)?(i=Math.max(0,i-1),c||n.push({point:e.offset,contentDepth:i})):e.type===`COMMA`&&(a={point:e.endOffset,contentDepth:i,kind:`comma`}),s=e.endOffset}let c=r.comments.find(e=>e.start>=s);return c!==void 0&&n.push({point:c.start,contentDepth:i}),n}function xt(t){let n=[],r=new e.t(t),i=0;for(;;){let e=r.consume();if(e.type===`EOF`)break;if(wt.has(e.type))i++;else if(Tt.has(e.type))i=Math.max(0,i-1);else if(e.type!==`COMMA`){if(e.type===`TSTR`){let r=t.slice(e.offset,e.endOffset);for(let t of St(r))n.push({point:e.offset+t,contentDepth:i+1})}else if(e.type===`RAWSTRING`){let r=t.slice(e.offset,e.endOffset);for(let{point:t}of yt(r,0))n.push({point:e.offset+t,contentDepth:i+1})}}}return n}function St(e){let t=[],n=1,r=e.length-1;for(;n<r;){let r=e[n];if(r===`\\`){let r=e[n+1];if(r===`n`||r===`r`)t.push(n+2),n+=2;else if(r===`u`)if(e[n+2]===`{`){let t=e.indexOf(`}`,n+3);n=t>=0?t+1:n+2}else n+=6;else n+=2}else r===`\r`?e[n+1]===`
|
|
10
|
-
`?(t.push(n+2),n+=2):(t.push(n+1),n++):(r===`
|
|
11
|
-
`&&t.push(n+1),n++)}return t}var Ct=new Set([`ENCODING_INDICATOR`,`UNDERSCORE`]),wt=new Set([`LBRACKET`,`LBRACE`,`LPAREN`,`LT_LT`]),Tt=new Set([`RBRACKET`,`RBRACE`,`RPAREN`,`GT_GT`]);function Et(e,t,n){return e.some(e=>e.start>=t&&e.end<=n)}function Dt(e,t,n){return/^[\t\n\r ]*$/.test(e.slice(t,n))}function Ot(e,t){let n=[...t].filter(([t])=>t>0&&t<e.length).sort(([e],[t])=>e-t);if(n.length===0)return[{text:e,contentDepth:0}];let r=[],i=0,a=0;for(let[t,o]of n)t!==i&&(r.push({text:e.slice(i,t),contentDepth:a}),i=t,a=o);return i<e.length&&r.push({text:e.slice(i),contentDepth:a}),r}function U(e){if(Number.isInteger(e))return new Date(e*1e3).toISOString().replace(/\.000Z$/,`Z`);let t=Math.round(e*1e3);if(t/1e3===e)return new Date(t).toISOString().replace(/\.000Z$/,`Z`);let n=Math.floor(e),r=e-n,i=new Date(n*1e3).toISOString().replace(/\.\d+Z$/,``),a=r.toString(),o=a.indexOf(`.`),s=o>=0?a.slice(o+1):`0`;for(;s.length<3;)s+=`0`;return`${i}.${s}Z`}var kt=new TextDecoder(`utf-8`,{fatal:!0});function At(e){if(e.length!==1)throw SyntaxError(`dt<<...>>: expected exactly one item`);let t=e[0];if(t instanceof H)return t.value;if(t instanceof N)return kt.decode(t.value);throw SyntaxError(`dt<<...>>: expected a text string or byte string`)}var jt=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;function Mt(e,t){if(!jt.test(e)){let n=`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`;if(t)t(n);else throw SyntaxError(n)}let n=e.match(/^(.+T\d{2}:\d{2}:\d{2})(\.\d+)(Z|[+-]\d{2}:\d{2})$/i),r,i;n?(r=n[1]+n[3],i=parseFloat(`0`+n[2])):(r=e,i=void 0);let a=Date.parse(r);if(isNaN(a))throw SyntaxError(`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`);if(i===void 0){let e=a/1e3;return e>=0?new Pt(BigInt(e)):new Ft(BigInt(e))}return new It(a/1e3+i)}var Nt=1n,Pt=class extends k{constructor(e,t){super(e,t)}_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);let n=x(e,this.encodingWidth,()=>b(this.value));return`dt'${U(Number(this.value))}'${n}`}},Ft=class extends A{constructor(e,t){super(e,t)}_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);let n=x(e,this.encodingWidth,()=>b(this.argument));return`dt'${U(Number(this.value))}'${n}`}},It=class extends j{constructor(e,t){super(e,t)}_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);let n=D(this.value),r=ye(this.value,this.precision,n,e?.encodingIndicators??`auto`);return`dt'${U(this.value)}'${r}`}},Lt=class extends M{constructor(e,t){super(Nt,typeof e==`string`?Mt(e):e,t)}_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);let n=this.content;if(n instanceof j?n.precision!==void 0&&n.precision!==D(n.value):n.encodingWidth!==void 0)return super._toCDN({...e,appStrings:!1},t);let r=n instanceof j?n.value:Number(n.value),i=x(e,this.encodingWidth,()=>b(Nt));return`DT'${U(r)}'${i}`}},Rt=class extends Lt{constructor(e,t){super(e,t)}_toJS(e){let t=this.content,n=t instanceof j?t.value*1e3:Number(t.value)*1e3;return new Date(n)}};function zt(e){let t=e?.jsDate??!1;function n(e){return t?new Rt(e):new Lt(e)}let r={appStringPrefixes:[`dt`,`DT`],tagNumbers:[Nt],parseAppString(e,t,r){return e===`DT`?n(t):Mt(t,r)},parseAppSequence(e,t,r){let i=At(t);return e===`DT`?n(i):Mt(i,r)},parseTag(e,n){if(e!==1n)return;let r;if(n instanceof k)r=new Pt(n.value,{encodingWidth:n.encodingWidth});else if(n instanceof A)r=new Ft(n.value,{encodingWidth:n.encodingWidth});else if(n instanceof j)r=new It(n.value),n.precision!==void 0&&(r.precision=n.precision);else return;return r.start=n.start,r.end=n.end,t?new Rt(r):new Lt(r)}};return t&&(r.fromJS=(e,t)=>{if(e instanceof Date)return new Rt(U(e.getTime()/1e3))},r.isJSType=e=>e instanceof Date),r}var Bt=zt(),Vt=zt({jsDate:!0});function Ht(e){let t=e.split(`.`);if(t.length!==4)throw SyntaxError(`ip: invalid IPv4 address: ${JSON.stringify(e)}`);let n=new Uint8Array(4);for(let e=0;e<4;e++){let r=t[e];if(!/^\d+$/.test(r)||r.length>1&&r[0]===`0`)throw SyntaxError(`ip: invalid IPv4 octet: ${JSON.stringify(r)}`);let i=parseInt(r,10);if(i>255)throw SyntaxError(`ip: IPv4 octet out of range: ${i}`);n[e]=i}return n}function Ut(e){let t=new Uint8Array(16);if(e===`::`)return t;let n=e,r=null,i=e.match(/^(.*):(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);i&&(n=i[1],n.endsWith(`:`)&&(n+=`:`),r=Ht(i[2]));let a=n.split(`::`);if(a.length>2)throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);let o=a.length===2,s=a[0]?a[0].split(`:`):[],c=o&&a[1]?a[1].split(`:`):[],l=r?6:8;if(!o&&s.length!==l||o&&s.length+c.length>=l)throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);let u=l-s.length-c.length,d=[...s,...Array(u).fill(`0`),...c],f=0;for(let e of d){if(!/^[0-9a-fA-F]{1,4}$/.test(e))throw SyntaxError(`ip: invalid IPv6 group: ${JSON.stringify(e)}`);let n=parseInt(e,16);t[f++]=n>>8&255,t[f++]=n&255}return r&&t.set(r,12),t}function Wt(e){return Array.from(e).join(`.`)}function Gt(e){let t=e.slice(0,10).every(e=>e===0)&&e[10]===255&&e[11]===255?Wt(e.slice(12)):null,n=t?6:8,r=[];for(let t=0;t<n*2;t+=2)r.push(e[t]<<8|e[t+1]);let i=-1,a=0,o=0;for(;o<n;)if(r[o]===0){let e=o+1;for(;e<n&&r[e]===0;)e++;e-o>a&&(i=o,a=e-o),o=e}else o++;a<2&&(i=-1);let s=e=>e.toString(16),c;return c=i===-1?r.map(s).join(`:`):`${r.slice(0,i).map(s).join(`:`)}::${r.slice(i+a).map(s).join(`:`)}`,t?`${c}:${t}`:c}var Kt=`ip`,W=`IP`,G=52n,qt=54n,Jt=new TextDecoder(`utf-8`,{fatal:!0});function Yt(e){if(e.length!==1)throw SyntaxError(`ip<<...>>: expected exactly one item`);let t=e[0];if(t instanceof H)return t.value;if(t instanceof N)return Jt.decode(t.value);throw SyntaxError(`ip<<...>>: expected a text string or byte string`)}function Xt(e){return/^\d/.test(e)&&e.includes(`.`)&&!e.includes(`:`)?{bytes:Ht(e),isV4:!0}:{bytes:Ut(e),isV4:!1}}function Zt(e){if(e.length===4)return Wt(e);if(e.length===16)return Gt(e);throw SyntaxError(`ip: unexpected byte length: ${e.length}`)}function Qt(e,t){let n=new Uint8Array(e.length);n.set(e);let r=Math.floor(t/8),i=t%8;i>0&&r<e.length&&(n[r]&=255<<8-i&255);for(let t=r+ +(i>0);t<e.length;t++)n[t]=0;let a=Math.ceil(t/8);for(;a>0&&n[a-1]===0;)a--;return n.slice(0,a)}function $t(e,t){let n=new Uint8Array(t);return n.set(e),n}var en=class extends N{_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);let n=x(e,this.encodingWidth,()=>b(BigInt(this.value.length)));return`${Kt}'${Zt(this.value)}'${n}`}},tn=class extends I{_isV4;constructor(e,t,n){super([new k(BigInt(e)),new N(t)]),this._isV4=n}_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);let n=Number(this.items[0].value),r=this.items[1].value;return`${Kt}'${Zt($t(r,this._isV4?4:16))}/${n}'`}},nn=class extends M{constructor(e,t){super(e,t)}_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);let n=this.tag===G?4:16,r=this.content;if(r instanceof N){if(r.encodingWidth!==void 0)return super._toCDN(e,t);let n=x(e,this.encodingWidth,()=>b(this.tag));return`${W}'${Zt(r.value)}'${n}`}if(r instanceof I&&r.items.length===2&&r.items[0]instanceof k&&r.items[1]instanceof N){if(r.encodingWidth!==void 0||r.items[0].encodingWidth!==void 0||r.items[1].encodingWidth!==void 0)return super._toCDN(e,t);let i=Number(r.items[0].value),a=$t(r.items[1].value,n),o=x(e,this.encodingWidth,()=>b(this.tag));return`${W}'${Zt(a)}/${i}'${o}`}return super._toCDN(e,t)}};function rn(e,t){let n=t.indexOf(`/`);if(n===-1){let{bytes:n,isV4:r}=Xt(t);return e===W?new nn(r?G:qt,new N(n)):new en(n)}let r=t.slice(0,n),i=t.slice(n+1);if(!/^\d+$/.test(i))throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);let a=parseInt(i,10),{bytes:o,isV4:s}=Xt(r),c=s?32:128;if(a>c)throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s?`IPv4`:`IPv6`}`);let l=Qt(o,a);return e===W?new nn(s?G:qt,new I([new k(BigInt(a)),new N(l)])):new tn(a,l,s)}var an={appStringPrefixes:[Kt,W],tagNumbers:[G,qt],parseAppString(e,t){return rn(e,t)},parseAppSequence(e,t){return rn(e,Yt(t))},parseTag(e,t){if(!(e!==G&&e!==qt)&&(t instanceof N||t instanceof I))return new nn(e,t)}},on=`cri`,sn=`CRI`,cn=99n,ln=new Map([[`coap`,-1n],[`coaps`,-2n],[`http`,-3n],[`https`,-4n],[`urn`,-5n],[`did`,-6n],[`coap+tcp`,-7n],[`coaps+tcp`,-8n],[`coap+ws`,-25n],[`coaps+ws`,-26n]]),un=new Map([...ln.entries()].map(([e,t])=>[t,e]));function K(e){try{return decodeURIComponent(e)}catch{return e}}var dn=new TextEncoder,fn=new TextDecoder(`utf-8`,{fatal:!0});function pn(e){return Array.from(dn.encode(e),e=>`%${e.toString(16).toUpperCase().padStart(2,`0`)}`).join(``)}function q(e,t){let n=``;for(let r of e)n+=t(r)?r:pn(r);return n}function mn(e){return/[A-Za-z0-9\-._~]/.test(e)}function hn(e){return/[!$&'()*+,;=]/.test(e)}function gn(e){return mn(e)||hn(e)||e===`:`||e===`@`}function _n(e){return(gn(e)||e===`/`||e===`?`)&&e!==`&`}function vn(e){return gn(e)||e===`/`||e===`?`}function yn(e){return mn(e)||hn(e)||e===`:`}function bn(e){return mn(e)||hn(e)}function xn(e){let t=[],n=e,r=n.indexOf(`@`);r>=0&&(t.push(R.FALSE),t.push(new H(K(n.slice(0,r)))),n=n.slice(r+1));let i,a=null;if(n.startsWith(`[`)){let e=n.indexOf(`]`);if(e<0)throw SyntaxError(`cri: unterminated IPv6 bracket in authority`);i=n.slice(1,e);let r=n.slice(e+1);if(r.startsWith(`:`))a=r.slice(1);else if(r.length>0)throw SyntaxError(`cri: unexpected characters after ']' in authority`);t.push(new N(Ut(i)))}else{let e=n.lastIndexOf(`:`);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(Ht(i)));else for(let e of i.toLowerCase().split(`.`))t.push(new H(e))}if(a!==null&&a!==``){if(!/^\d+$/.test(a))throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);let e=parseInt(a,10);if(e>65535)throw SyntaxError(`cri: port ${e} out of range`);t.push(new k(BigInt(e)))}return new I(t)}function Sn(e){let t=e.items,n=0,r=``;if(n<t.length&&t[n]instanceof R&&t[n].value===20){n++;let e=t[n++];r+=q(e.value,yn)+`@`}if(n>=t.length)return r;let i=t[n];if(i instanceof N){n++;let{length:e}=i.value;if(e===4)r+=Wt(i.value);else if(e===16)r+=`[`+Gt(i.value)+`]`;else throw Error(`cri: unexpected host-ip byte length: ${e}`);n<t.length&&t[n]instanceof H&&(r+=`%25${q(t[n++].value,bn)}`)}else{let e=[];for(;n<t.length&&t[n]instanceof H;)e.push(q(t[n++].value,bn));r+=e.join(`.`)}return n<t.length&&t[n]instanceof k&&(r+=`:`+t[n].value.toString()),r}function Cn(e){let t=e.slice(2),n=t.indexOf(`/`),r,i;return n>=0?(r=t.slice(0,n),i=t.slice(n+1).split(`/`).map(e=>new H(K(e)))):(r=t,i=[]),{authority:xn(r),pathSegments:i}}function wn(e){let t=e,n=null,r=t.indexOf(`#`);r>=0&&(n=K(t.slice(r+1)),t=t.slice(0,r));let i=null,a=t.indexOf(`?`);if(a>=0){let e=t.slice(a+1);t=t.slice(0,a),i=e.split(`&`).map(e=>new H(K(e)))}let o=[],s=/^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);if(s){let e=s[1].toLowerCase(),t=s[2],n=ln.get(e);if(o.push(n===void 0?new H(e):new A(n)),t.startsWith(`//`)){let{authority:e,pathSegments:n}=Cn(t);o.push(e,new I(n))}else if(t.startsWith(`/`)){let e=t.slice(1).split(`/`).map(e=>new H(K(e)));o.push(R.NULL,new I(e))}else{let e=t.split(`/`).map(e=>new H(K(e)));o.push(R.TRUE,new I(e))}}else if(t.startsWith(`//`)){let{authority:e,pathSegments:n}=Cn(t);o.push(R.FALSE,e,new I(n))}else if(t.startsWith(`/`)){let e=t.slice(1).split(`/`).map(e=>new H(K(e)));o.push(R.TRUE,new I(e))}else if(t===``)o.push(new k(0n));else{let n=1n,r=t,i=!1;for(r.startsWith(`./`)&&(i=!0,r=r.slice(2));r.startsWith(`../`);)n++,r=r.slice(3);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)}`);let a=r===``?[]:r.split(`/`).map(e=>new H(K(e)));o.push(new k(n),new I(a))}if(i!==null&&o.push(new I(i)),n!==null&&(i===null&&o.push(R.NULL),o.push(new H(n))),n!==null&&i===null&&o.splice(o.length-2,1),i===null&&n===null){let e=o[o.length-1];e instanceof I&&e.items.length===0&&o.pop()}return o.length===1&&o[0]instanceof k&&o[0].value===0n?[]:o}function J(e,t){let n=t,r=``;if(n<e.length){let t=e[n];if(t instanceof I){if(n++,t.items.length>0){let e=t.items.map(e=>{if(!(e instanceof H))throw Error(`cri: query item must be a text string`);return q(e.value,_n)});r+=`?`+e.join(`&`)}}else t instanceof R&&t.value===22&&n++}return n<e.length&&e[n]instanceof H&&(r+=`#`+q(e[n].value,vn)),r}function Tn(e){return e.items.map(e=>{if(!(e instanceof H))throw Error(`cri: path segment must be a text string`);return q(e.value,gn)})}function En(e){if(e.length===0)return``;let t=0,n=e[t++];if(n instanceof A||n instanceof H){let r;if(n instanceof A){let e=un.get(n.value);if(e===void 0)throw Error(`cri: unrecognised scheme-id ${n.value}`);r=e+`:`}else r=n.value+`:`;if(t>=e.length)return r;let i=e[t++],a=``,o=!1;if(i instanceof I)a=`//`+Sn(i),o=!0;else if(i instanceof R)if(i.value===22)o=!0;else if(i.value===21)o=!1;else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);else throw Error(`cri: unexpected type for authority element`);let s=``;if(t<e.length&&e[t]instanceof I){let n=e[t++];n.items.length>0&&(s=(o?`/`:``)+Tn(n).join(`/`))}return r+a+s+J(e,t)}if(n instanceof R&&n.value===20){if(t>=e.length||!(e[t]instanceof I))throw Error(`cri: network-path reference requires an authority array`);let n=Sn(e[t++]),r=``;if(t<e.length&&e[t]instanceof I){let n=e[t++];n.items.length>0&&(r=`/`+Tn(n).join(`/`))}return`//`+n+r+J(e,t)}if(n instanceof R&&n.value===21){let n=`/`;if(t<e.length&&e[t]instanceof I){let r=e[t++];n=`/`+Tn(r).join(`/`)}return n+J(e,t)}if(n instanceof k){let r=n.value;if(r===0n)return J(e,t);let i=r===1n?``:`../`.repeat(Number(r)-1),a;if(t<e.length&&e[t]instanceof I){let n=e[t++];if(n.items.length>0){let e=Tn(n);a=(r===1n&&e[0].includes(`:`)?`./`:i)+e.join(`/`)}else a=i===``?`./`:i}else a=i===``?`./`:i;return a+J(e,t)}throw Error(`cri: unrecognised first element type in CRI array`)}var Dn=class extends I{_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);try{let t=x(e,this.encodingWidth,()=>b(BigInt(this.items.length)));return`${on}'${En(this.items)}'${t}`}catch{return super._toCDN(e,t)}}},On=class extends M{constructor(e){super(cn,e)}_toCDN(e,t){if(e?.appStrings===!1)return super._toCDN(e,t);try{let n=this.content;if(n.encodingWidth!==void 0)return super._toCDN(e,t);let r=x(e,this.encodingWidth,()=>b(cn));return`${sn}'${En(n.items)}'${r}`}catch{return super._toCDN(e,t)}}};function kn(e){if(e.length!==1)throw SyntaxError(`cri<<...>>: expected exactly one item`);let t=e[0];if(t instanceof H)return t.value;if(t instanceof N)return fn.decode(t.value);throw SyntaxError(`cri<<...>>: expected a text string or byte string`)}function An(e,t){let n=new Dn(wn(t));return e===sn?new On(n):n}var jn={appStringPrefixes:[on,sn],tagNumbers:[cn],parseAppString(e,t){return An(e,t)},parseAppSequence(e,t){return An(e,kn(t))},parseTag(e,t){if(e!==99n||!(t instanceof I))return;let n=new Dn(t.items,{indefiniteLength:t.indefiniteLength,encodingWidth:t.encodingWidth});return n.start=t.start,n.end=t.end,new On(n)}},Mn=18446744073709551615n,Nn=-18446744073709551616n,Pn={tagNumbers:[Ue,We],parseTag(e,t){if(t instanceof N){if(e===2n){let e=Je(t.value);return e>Mn?new Ye(e):void 0}if(e===3n){let e=-1n-Je(t.value);return e<Nn?new Xe(e):void 0}}}};function Fn(e,t){if(e===24&&t<=23n)return 0;if(e===25&&t<=255n)return 1;if(e===26&&t<=65535n)return 2;if(e===27&&t<=4294967295n)return 3}function In(e,t){if(e===24&&t<=23)return 0;if(e===25&&t<=255)return 1;if(e===26&&t<=65535)return 2;if(e===27&&t<=4294967295)return 3}var Ln=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}),Rn=new TextDecoder(`utf-8`,{fatal:!1,ignoreBOM:!0});function Y(e){throw Error(`CBOR decode error: ${e}`)}function zn(e,t,n){let r={message:e,offset:t};if(n?.onWarning?n.onWarning(r):n?.silent||console.warn(`CBOR strict violation at offset ${t}: ${e}`),n?.strict!==!1)throw Error(`CBOR decode error: ${e}`);return r}function Bn(e,t){e.warnings??=[],e.warnings.push(t)}function Vn(t){if(t instanceof k)return[`u`,String(t.value)];if(t instanceof A)return[`n`,String(t.value)];if(t instanceof H)return[`t`,t.value];if(t instanceof F)return[`t`,t.chunks.map(e=>e.value).join(``)];if(t instanceof N)return[`b`,e.r(t.value)];if(t instanceof P){let n=``;for(let r of t.chunks)n+=e.r(r.value);return[`b`,n]}if(t instanceof j)return isNaN(t.value)?[`f`,`NaN`]:Object.is(t.value,-0)?[`f`,`-0`]:[`f`,String(t.value)];if(t instanceof R)return[`s`,t.value];if(t instanceof I)return[`A`,t.items.map(Vn)];if(t instanceof L){let e=t.entries.map(([e,t])=>[Vn(e),Vn(t)]);if(e.length<=1)return[`M`,e];let n=e.map(e=>[JSON.stringify(e[0]),e]);return n.sort((e,t)=>e[0]<t[0]?-1:+(e[0]>t[0])),[`M`,n.map(e=>e[1])]}return t instanceof M?[`G`,String(t.tag),Vn(t.content)]:[`c`,e.r(t.toCBOR())]}function Hn(t){if(t instanceof k)return`u`+t.value;if(t instanceof A)return`n`+t.value;if(t instanceof H)return`t`+t.value;if(t instanceof F){let e=`t`;for(let n of t.chunks)e+=n.value;return e}if(t instanceof N)return`b`+e.r(t.value);if(t instanceof P){let n=`b`;for(let r of t.chunks)n+=e.r(r.value);return n}return t instanceof j?isNaN(t.value)?`fNaN`:Object.is(t.value,-0)?`f-0`:`f`+t.value:t instanceof R?`s`+t.value:JSON.stringify(Vn(t))}var Un=Array.from({length:24},(e,t)=>BigInt(t)),Wn;function Gn(e){return e===void 0?Wn??=Z(void 0).filter(e=>e.parseTag!==void 0):Z(e).filter(e=>e.parseTag!==void 0)}function Kn(e,t){for(let n=0;n<t;n++)if(e[n]>=128)return;return String.fromCharCode.apply(null,e)}function qn(e,t,n){if(n<=23)return{value:Un[n],nextOffset:t};switch(n){case 24:return t+1>e.byteLength&&Y(`unexpected end of input`),{value:BigInt(e.getUint8(t)),nextOffset:t+1};case 25:return t+2>e.byteLength&&Y(`unexpected end of input`),{value:BigInt(e.getUint16(t,!1)),nextOffset:t+2};case 26:return t+4>e.byteLength&&Y(`unexpected end of input`),{value:BigInt(e.getUint32(t,!1)),nextOffset:t+4};case 27:return t+8>e.byteLength&&Y(`unexpected end of input`),{value:e.getBigUint64(t,!1),nextOffset:t+8};default:Y(`reserved additional info value: ${n}`)}}function Jn(e,t,n){if(n<=23)return{value:n,nextOffset:t};switch(n){case 24:return t+1>e.byteLength&&Y(`unexpected end of input`),{value:e.getUint8(t),nextOffset:t+1};case 25:return t+2>e.byteLength&&Y(`unexpected end of input`),{value:e.getUint16(t,!1),nextOffset:t+2};case 26:return t+4>e.byteLength&&Y(`unexpected end of input`),{value:e.getUint32(t,!1),nextOffset:t+4};case 27:{t+8>e.byteLength&&Y(`unexpected end of input`);let n=e.getUint32(t,!1),r=e.getUint32(t+4,!1);return{value:n*4294967296+r,nextOffset:t+8}}default:Y(`reserved additional info value: ${n}`)}}function Yn(e,t,n,r,i,a){let o=[],s=t;for(;;){if(s>=e.byteLength&&Y(`unexpected end of indefinite ${i}`),e.getUint8(s)===255){s++;break}let t=X(e,s,n,r);a(t.value)||Y(`indefinite-length ${i} chunk must be a definite ${i}`),o.push(t.value),s=t.nextOffset}return{chunks:o,nextOffset:s}}function Xn(e,t,n,r){let i=Hn(e);t.has(i)&&n.push(zn(`duplicate map key at offset ${e.start}`,e.start,r)),t.add(i)}function X(e,t,n,r){let i=t,a=Qn(e,t,n,r);return a.value.start=i,a.value.end=a.nextOffset,a}function Zn(e,t,n){return new Uint8Array(e.buffer,e.byteOffset+t,n).slice()}function Qn(e,t,n,r){t>=e.byteLength&&Y(`unexpected end of input`);let i=e.getUint8(t++),a=i>>5,o=i&31;switch(a){case 0:{let{value:n,nextOffset:r}=qn(e,t,o);return{value:new k(n,{encodingWidth:Fn(o,n)}),nextOffset:r}}case 1:{let{value:n,nextOffset:r}=qn(e,t,o),i=Fn(o,n);return{value:new A(-1n-n,{encodingWidth:i}),nextOffset:r}}case 2:{if(o===31){let{chunks:i,nextOffset:a}=Yn(e,t,n,r,`byte string`,e=>e instanceof N);return{value:new P(i),nextOffset:a}}let{value:i,nextOffset:a}=Jn(e,t,o),s=In(o,i);return a+i>e.byteLength&&Y(`byte string extends beyond input`),{value:new N(new Uint8Array(e.buffer,e.byteOffset+a,i).slice(),{encodingWidth:s}),nextOffset:a+i}}case 3:{if(o===31){let{chunks:i,nextOffset:a}=Yn(e,t,n,r,`text string`,e=>e instanceof H);return{value:new F(i),nextOffset:a}}let{value:i,nextOffset:a}=Jn(e,t,o),s=In(o,i);a+i>e.byteLength&&Y(`text string extends beyond input`);let c=new Uint8Array(e.buffer,e.byteOffset+a,i),l,u,d=i<64?Kn(c,i):void 0;if(d!==void 0)l=d;else try{l=Ln.decode(c)}catch{u=zn(`invalid UTF-8 sequence in text string`,a,n),l=Rn.decode(c)}let f=new H(l,{encodingWidth:s});return u&&Bn(f,u),{value:f,nextOffset:a+i}}case 4:{if(o===31){let i=[],a=t;for(;;){if(a>=e.byteLength&&Y(`unexpected end of indefinite array`),e.getUint8(a)===255){a++;break}let t=X(e,a,n,r);i.push(t.value),a=t.nextOffset}return{value:new I(i,{indefiniteLength:!0}),nextOffset:a}}let{value:i,nextOffset:a}=Jn(e,t,o),s=In(o,i),c=[],l=a;for(let t=0;t<i;t++){let t=X(e,l,n,r);c.push(t.value),l=t.nextOffset}return{value:new I(c,{encodingWidth:s}),nextOffset:l}}case 5:{if(o===31){let i=[],a=new Set,o=[],s=t;for(;;){if(s>=e.byteLength&&Y(`unexpected end of indefinite map`),e.getUint8(s)===255){s++;break}let t=X(e,s,n,r);Xn(t.value,a,o,n),s=t.nextOffset;let c=X(e,s,n,r);s=c.nextOffset,i.push([t.value,c.value])}let c=new L(i,{indefiniteLength:!0});for(let e of o)Bn(c,e);return{value:c,nextOffset:s}}let{value:i,nextOffset:a}=Jn(e,t,o),s=In(o,i),c=[],l=new Set,u=[],d=a;for(let t=0;t<i;t++){let t=X(e,d,n,r);Xn(t.value,l,u,n),d=t.nextOffset;let i=X(e,d,n,r);d=i.nextOffset,c.push([t.value,i.value])}let f=new L(c,{encodingWidth:s});for(let e of u)Bn(f,e);return{value:f,nextOffset:d}}case 6:{o===31&&Y(`tags cannot use indefinite-length encoding`);let{value:i,nextOffset:a}=qn(e,t,o),s=Fn(o,i),c=X(e,a,n,r);for(let e of r){let t=e.parseTag(i,c.value,n);if(t!==void 0)return t instanceof M&&s!==void 0&&(t.encodingWidth=s),{value:t,nextOffset:c.nextOffset}}return{value:new M(i,c.value,{encodingWidth:s}),nextOffset:c.nextOffset}}case 7:if(o<=19)return{value:new R(o),nextOffset:t};if(o===20)return{value:new R(20),nextOffset:t};if(o===21)return{value:new R(21),nextOffset:t};if(o===22)return{value:new R(22),nextOffset:t};if(o===23)return{value:new R(23),nextOffset:t};if(o===24){t+1>e.byteLength&&Y(`unexpected end of input`);let r=e.getUint8(t);if(r<32){let e=zn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`,t-1,n),i=new R(r);return Bn(i,e),{value:i,nextOffset:t+1}}return{value:new R(r),nextOffset:t+1}}if(o===25){t+2>e.byteLength&&Y(`unexpected end of input`);let n=C(e.getUint16(t,!1));return{value:new j(n,{precision:`half`,rawBits:Number.isNaN(n)?Zn(e,t,2):void 0}),nextOffset:t+2}}if(o===26){t+4>e.byteLength&&Y(`unexpected end of input`);let n=e.getFloat32(t,!1);return{value:new j(n,{precision:`single`,rawBits:Number.isNaN(n)?Zn(e,t,4):void 0}),nextOffset:t+4}}if(o===27){t+8>e.byteLength&&Y(`unexpected end of input`);let n=e.getFloat64(t,!1);return{value:new j(n,{precision:`double`,rawBits:Number.isNaN(n)?Zn(e,t,8):void 0}),nextOffset:t+8}}return o<31&&Y(`reserved additional info value in major type 7: ${o}`),Y(`unexpected break code outside indefinite-length item`)}return Y(`unknown major type: ${a}`)}function $n(e){if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw TypeError(`expected ArrayBufferView or ArrayBufferLike`)}function er(e,t){let n=$n(e),r=new DataView(n.buffer,n.byteOffset,n.byteLength),i=t?.offset??0;if(!Number.isInteger(i)||i<0||i>r.byteLength)throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);let a=Gn(t?.builtinExtensions),o=t?.extensions?.length?[...t.extensions.filter(e=>e.parseTag!==void 0),...a]:a,{value:s,nextOffset:c}=X(r,i,t,o);if(!t?.allowTrailing&&c!==r.byteLength){Bn(s,zn(`${r.byteLength-c} trailing byte(s) after end of CBOR item`,c,t));let e={strict:!1,silent:!0},n=c;for(;n<r.byteLength;)({nextOffset:n}=X(r,n,e,o))}return s}var tr=24n,nr={tagNumbers:[tr],parseTag(e,t,n){if(e!==24n||!(t instanceof N))return;let r=(t.end??t.value.length)-t.value.length,i=n?{extensions:n.extensions,builtinExtensions:n.builtinExtensions,strict:n.strict,onWarning:n.onWarning?e=>n.onWarning({...e,offset:e.offset+r}):void 0,silent:n.silent}:void 0;try{return new M(tr,new Re([er(t.value,i)],{encodingWidth:t.encodingWidth}))}catch(e){if(i?.strict!==!1)throw e;let t=`tag 24 content is not valid CBOR: ${e instanceof Error?e.message:String(e)}`,a={message:t,offset:r};n?.onWarning?n.onWarning(a):n?.silent||console.warn(`CBOR strict violation at offset ${a.offset}: ${t}`);return}}};function rr(e){return e instanceof B&&!(e.content instanceof I)}function ir(e){let t=!1,n=!1,r=!1,i;for(let a of e){let e;if(rr(a))e=!0,r=!0;else if(a instanceof H)e=!1,t=!0;else if(a instanceof N)e=!1,n=!0;else return!1;if(e===i)return!1;i=e}return r&&!(t&&n)}var ar={tagNumbers:[He],parseTag(e,t){if(e===888n){if(t instanceof R&&t.value===22)return new B;if(t instanceof I&&ir(t.items))return new B(t.items)}}},or=new TextEncoder,sr=new TextDecoder(`utf-8`,{fatal:!0}),cr=new TextDecoder(`utf-8`,{fatal:!1}),lr=Symbol(`ellipsis`);function ur(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function dr(e,t,n){if(t instanceof z){dr(e,t.inner,n);return}if(t instanceof B){if(t.content instanceof I)for(let r of t.content.items)dr(e,r,n);else n.push(lr);return}if(t instanceof H){n.push(or.encode(t.value));return}if(t instanceof N){n.push(t.value);return}if(t instanceof F){n.push(or.encode(t.chunks.map(e=>e.value).join(``)));return}if(t instanceof P){n.push(ur(t.chunks.map(e=>e.value)));return}throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings or ellipses`)}function fr(e,t){try{return sr.decode(e)}catch{let n=`t1 concatenation result is not valid UTF-8`;if(t)t(n);else throw SyntaxError(n);return cr.decode(e)}}function pr(e,t,n){let r=[];for(let n of t)dr(e,n,r);let i=e===`t1`,a=[],o=!1,s=[],c=()=>{if(s.length===0)return;let e=ur(s);s.length=0,e.length!==0&&a.push(i?new H(fr(e,n)):new N(e))};for(let e of r)e===lr?(c(),a[a.length-1]instanceof B||(a.push(new B),o=!0)):s.push(e);if(!o){let e=ur(s);return i?new H(fr(e,n)):new N(e)}return c(),a.length===1?new B:new B(a)}function mr(e){return{appStringPrefixes:[e],preserveAppSeqSource:!0,parseAppString(t,n,r){return pr(e,[new H(n)],r)},parseAppSequence(t,n,r){return pr(e,n,r)}}}var hr=mr(`t1`),gr=mr(`b1`),_r=new TextEncoder,vr=new TextDecoder(`utf-8`,{fatal:!0}),yr=new TextDecoder(`utf-8`,{fatal:!1});function br(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function xr(e,t,n){let r=e===`ilts`,i=[],a=[];for(let o of t){if(o instanceof z&&(o=o.inner),o instanceof B)throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);let t,s,c;if(o instanceof H)t=o.value,c=o.encodingWidth;else if(o instanceof N)s=o.value,c=o.encodingWidth;else if(o instanceof F)t=o.chunks.map(e=>e.value).join(``);else if(o instanceof P)s=br(o.chunks.map(e=>e.value));else throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings`);if(r){let e;if(t!==void 0)e=t;else try{e=vr.decode(s)}catch{let t=`ilts chunk is not valid UTF-8`;if(n)n(t);else throw SyntaxError(t);e=yr.decode(s)}a.push(new H(e,c===void 0?void 0:{encodingWidth:c}))}else{let e=s??_r.encode(t);i.push(new N(e,c===void 0?void 0:{encodingWidth:c}))}}return r?new F(a):new P(i)}function Sr(e){return{appStringPrefixes:[e],preserveAppSeqSource:!0,parseAppString(t,n,r){return new z(xr(e,[new H(n)],r),`${e}${ge(n)}`)},parseAppSequence(t,n,r){return xr(e,n,r)}}}var Cr=Sr(`ilbs`),wr=Sr(`ilts`);function Tr(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r===` `||r===`
|
|
12
|
-
`||r===`\r`){n++;continue}if(r===`#`){for(;n<e.length&&e[n]!==`
|
|
13
|
-
`;)n++;continue}if(r===`/`){let t=e[n+1]??``;if(t===`/`){for(;n<e.length&&e[n]!==`
|
|
14
|
-
`;)n++;continue}if(t===`*`){for(n+=2;n<e.length&&!(e[n]===`*`&&(e[n+1]??``)===`/`);)n++;if(n>=e.length)throw SyntaxError(`unterminated block comment`);n+=2;continue}for(n++;n<e.length&&e[n]!==`/`;)n++;if(n>=e.length)throw SyntaxError(`unterminated block comment`);n++;continue}t+=r,n++}return t}var Er=class extends j{_bits;constructor(e){super(C(e),{precision:`half`}),this._bits=e&65535}_toCBOR(){return new Uint8Array([249,this._bits>>8&255,this._bits&255])}},Dr=class extends j{_raw;constructor(e){super(new DataView(e.buffer,e.byteOffset).getFloat32(0,!1),{precision:`single`}),this._raw=e.slice()}_toCBOR(){let e=new Uint8Array(5);return e[0]=250,e.set(this._raw,1),e}},Or=class extends j{_raw;constructor(e){super(new DataView(e.buffer,e.byteOffset).getFloat64(0,!1),{precision:`double`}),this._raw=e.slice()}_toCBOR(){let e=new Uint8Array(9);return e[0]=251,e.set(this._raw,1),e}};function kr(e){if(e.length===2)return new Er(e[0]<<8|e[1]);if(e.length===4)return new Dr(e);if(e.length===8)return new Or(e);throw SyntaxError(`float'...' requires 4, 8, or 16 hex digits (2, 4, or 8 bytes); got ${e.length} bytes`)}function Ar(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023,i;if(n===31)i=t<<31|2139095040|r<<13;else if(n===0&&r===0)i=t<<31;else if(n===0){let e=r,n=0;for(;!(e&512);)e<<=1,n++;i=t<<31|112-n<<23|(e&511)<<14}else i=t<<31|n+112<<23|r<<13;let a=new Uint8Array(4);return new DataView(a.buffer).setUint32(0,i>>>0,!1),a}function jr(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023,i=new Uint8Array(8),a=new DataView(i.buffer);if(n===31)a.setUint32(0,(t<<31|2146435072|r<<10)>>>0,!1),a.setUint32(4,0,!1);else if(n===0&&r===0)a.setUint32(0,t<<31>>>0,!1),a.setUint32(4,0,!1);else if(n===0){let e=r,n=0;for(;!(e&512);)e<<=1,n++;a.setUint32(0,(t<<31|1008-n<<20|(e&511)<<11)>>>0,!1),a.setUint32(4,0,!1)}else a.setUint32(0,(t<<31|n+1008<<20|r<<10)>>>0,!1),a.setUint32(4,0,!1);return i}function Mr(e){let t=new DataView(e.buffer,e.byteOffset).getUint32(0,!1),n=t>>>31&1,r=t>>>23&255,i=t&8388607,a=new Uint8Array(8),o=new DataView(a.buffer);if(r===255)o.setUint32(0,(n<<31|2146435072|i>>>3)>>>0,!1),o.setUint32(4,(i&7)<<29,!1);else if(r===0&&i===0)o.setUint32(0,n<<31>>>0,!1),o.setUint32(4,0,!1);else{let t=new DataView(e.buffer,e.byteOffset).getFloat32(0,!1);o.setFloat64(0,t,!1)}return a}function Nr(e,t,n){let r=e.length===2?1:e.length===4?2:3;if(r===1){let n=e[0]<<8|e[1];if(t===2)return new Dr(Ar(n));if(t===3)return new Or(jr(n))}if(r===2){if(t===3)return new Or(Mr(e));if(t===1){let t=new DataView(e.buffer,e.byteOffset).getFloat32(0,!1),r=S(t);return!Object.is(C(r),t)&&!isNaN(t)&&n(`float'...' value cannot be exactly represented as float16 (_1)`),new Er(r)}}if(r===3){let r=new DataView(e.buffer,e.byteOffset).getFloat64(0,!1);if(t===1){let e=S(r);return!Object.is(C(e),r)&&!isNaN(r)&&n(`float'...' value cannot be exactly represented as float16 (_1)`),new Er(e)}if(t===2){let e=Math.fround(r);!Object.is(e,r)&&!isNaN(r)&&n(`float'...' value cannot be exactly represented as float32 (_2)`);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!1),new Dr(t)}}return kr(e)}var Pr={appStringPrefixes:[`float`],parseAppString(t,n,r,i){let a=Tr(n);if(!/^[0-9a-fA-F]*$/.test(a))throw SyntaxError(`float'...' contains non-hex characters`);if(a.length%2!=0)throw SyntaxError(`float'...' hex content has odd length (${a.length} digits)`);let o=e.a(a),s=i?.encodingWidth;if(s===void 0)return kr(o);if(s!==1&&s!==2&&s!==3){let e=`float'...' encoding indicator _${s} is not valid; use _1, _2, or _3`;if(r)return r(e),kr(o);throw SyntaxError(e)}return s===(o.length===2?1:o.length===4?2:3)?kr(o):Nr(o,s,r??(e=>{throw SyntaxError(e)}))},parseAppSequence(e,t,n){if(t.length===0)throw SyntaxError(`float<<...>> requires exactly one byte-string item`);if(t.length>1){let e=`float<<...>> expects 1 item; got ${t.length} — using first`;if(n)n(e);else throw SyntaxError(e)}if(!(t[0]instanceof N))throw SyntaxError(`float<<...>> item must be a byte string`);return kr(t[0].value)}},Fr=[Pn,nr,ar],Ir=[Bt,an,jn,hr,gr,Cr,wr,Pr],Lr;function Z(e){return e===void 0?Lr??=[...Fr,...Ir]:e===!1?Fr:[...Fr,...e]}var Rr;function zr(e){if(e===void 0){if(Rr)return Rr;let e=Z(void 0);return Rr={fromJS:e.filter(e=>e.fromJS!==void 0),parseTag:e.filter(e=>e.parseTag!==void 0)}}let t=Z(e);return{fromJS:t.filter(e=>e.fromJS!==void 0),parseTag:t.filter(e=>e.parseTag!==void 0)}}function Br(e){let t=e?.extensions,n=zr(e?.builtinExtensions);return t?.length?{fromJS:[...t.filter(e=>e.fromJS!==void 0),...n.fromJS],parseTag:[...t.filter(e=>e.parseTag!==void 0),...n.parseTag]}:n}function Vr(e,t){if(t?.replacer){let{replacer:n,...r}=t,i=Ur(e,n,r.extensions,r.undefinedOmits,r.builtinExtensions);return i===u?R.UNDEFINED:Vr(i,Object.keys(r).length>0?r:void 0)}return Q(e,t,!0,Br(t))}function Q(e,t,n,r){for(let n of r.fromJS){let r=n.fromJS(e,t??{});if(r!==void 0)return r}if(n&&typeof e==`object`&&e&&l.symbol in e){let n=e[l.symbol],i=Q(e,t,!1,r);for(let e of r.parseTag){let t=e.parseTag(n,i);if(t!==void 0)return t}return new M(n,i)}if(e instanceof l.Null)return R.NULL;if(e instanceof l.Undefined)return R.UNDEFINED;if(e instanceof d)return new R(e.value);if(e===null)return R.NULL;if(e===void 0)return R.UNDEFINED;if(e===!0)return R.TRUE;if(e===!1)return R.FALSE;if(typeof e==`bigint`)return e>18446744073709551615n?new Ye(e):e<-18446744073709551616n?new Xe(e):e>=0n?new k(e):new A(e);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);if(typeof e==`string`)return new H(e);if(e instanceof Number||e instanceof Boolean||e instanceof String||Object.prototype.toString.call(e)===`[object BigInt]`)return Q(e.valueOf(),t,!1,r);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return new N(new Uint8Array(e));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));if(e instanceof $)return new L([...e].map(([e,n])=>[Q(e,t,!0,r),Q(n,t,!0,r)]));if(Array.isArray(e))return new I(e.map(e=>Q(e,t,!0,r)));if(typeof e==`object`){let n=[];for(let[i,a]of Object.entries(e))n.push([new H(i),Q(a,t,!0,r)]);return new L(n)}throw TypeError(`fromJS: unsupported value type: ${typeof e}`)}function Hr(e){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 l.Null||e instanceof l.Undefined||e instanceof d}function Ur(e,t,n,r,i){let a=[...n??[],...Z(i)].filter(e=>e.isJSType!==void 0);function o(e){return e===u||r===!0&&e===void 0}if(Array.isArray(t)){let n=t.map(String);function s(e){if(typeof e!=`object`||!e)return e;if(e instanceof $)return $.from(e,([e,t])=>[e,s(t)]);if(Array.isArray(e))return e.map(s);if(l.symbol in e||Hr(e)||a.some(t=>t.isJSType(e)))return e;let t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null){let t=e.toJSON;if(typeof t==`function`)return s(t.call(e))}let r={};for(let t of n)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=s(e[t]));return r}return s(e)}let c=t;function d(e,t,n){if(typeof e==`object`&&e&&!(e instanceof $)){let n=Object.getPrototypeOf(e);if(n===Object.prototype||n===null){let n=e.toJSON;typeof n==`function`&&(e=n.call(e,t))}}if(e=c.call(n,t,e),typeof e==`object`&&e){if(l.symbol in e)return e;if(e instanceof $){let t=new $;for(let[n,r]of e){let i=d(r,n,e);o(i)||t.push([n,i])}return t}if(Array.isArray(e))return e.map((t,n)=>{let r=d(t,String(n),e);return o(r)?null:r});if(Hr(e)||a.some(t=>t.isJSType(e)))return e;let t={};for(let n of Object.keys(e)){let r=d(e[n],n,e);o(r)||(t[n]=r)}return t}return e}return d(e,``,{"":e})}var $=class extends Array{toJSON(){let e={};for(let[t,n]of this){let r=typeof t==`string`?t:Vr(t).toCDN();r===`__proto__`?Object.defineProperty(e,r,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[r]=n}return e}};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return wr}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return er}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return jn}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return gr}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Ur}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Tr}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return an}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Vr}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Cr}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return t}});
|
|
15
|
-
//# sourceMappingURL=mapEntries-BhMlCwYo.cjs.map
|