@cbortech/cbor 0.25.8 → 0.25.9
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/dist/ast/index.cjs +1 -1
- package/dist/ast/index.js +1 -1
- package/dist/cdn/index.cjs +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/{mapEntries-BQYXoTz7.cjs → mapEntries-BkcJsv3C.cjs} +4 -4
- package/dist/{mapEntries-BQYXoTz7.cjs.map → mapEntries-BkcJsv3C.cjs.map} +1 -1
- package/dist/{mapEntries-Cc4If3gy.js → mapEntries-I8f0WuwK.js} +80 -71
- package/dist/{mapEntries-Cc4If3gy.js.map → mapEntries-I8f0WuwK.js.map} +1 -1
- package/dist/{tokenizer-IDqJN0Dw.js → tokenizer-CETZf2NR.js} +2 -2
- package/dist/tokenizer-CETZf2NR.js.map +1 -0
- package/dist/{tokenizer-Cg5EIl83.cjs → tokenizer-CMK8MtYl.cjs} +2 -2
- package/dist/tokenizer-CMK8MtYl.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/tokenizer-Cg5EIl83.cjs.map +0 -1
- package/dist/tokenizer-IDqJN0Dw.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e, t } from "./tokenizer-
|
|
1
|
+
import { n as e, t } from "./tokenizer-CETZf2NR.js";
|
|
2
2
|
//#region src/tag.ts
|
|
3
3
|
var n = Symbol.for("cbor.tag"), r = class {
|
|
4
4
|
valueOf() {
|
|
@@ -1185,7 +1185,7 @@ var ft = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1185
1185
|
_hintedPrefixes = /* @__PURE__ */ new Set();
|
|
1186
1186
|
constructor(t, n) {
|
|
1187
1187
|
this.t = t, this._options = n, this.extByPrefix = /* @__PURE__ */ new Map(), this.extByTag = /* @__PURE__ */ new Map(), this.unresolvedExtension = n.unresolvedExtension ?? "cpa999";
|
|
1188
|
-
for (let e of [...
|
|
1188
|
+
for (let e of [...Z, ...n.extensions ?? []]) {
|
|
1189
1189
|
for (let t of e.appStringPrefixes ?? []) this.extByPrefix.set(t, e);
|
|
1190
1190
|
for (let t of e.tagNumbers ?? []) this.extByTag.set(t, e);
|
|
1191
1191
|
}
|
|
@@ -2424,30 +2424,30 @@ function Rn(e, t, n) {
|
|
|
2424
2424
|
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}`);
|
|
2425
2425
|
return r;
|
|
2426
2426
|
}
|
|
2427
|
-
function
|
|
2427
|
+
function zn(e, t) {
|
|
2428
2428
|
e.warnings ??= [], e.warnings.push(t);
|
|
2429
2429
|
}
|
|
2430
|
-
function
|
|
2430
|
+
function Bn(e) {
|
|
2431
2431
|
let t = "";
|
|
2432
2432
|
for (let n of e) t += n.toString(16).padStart(2, "0");
|
|
2433
2433
|
return t;
|
|
2434
2434
|
}
|
|
2435
|
-
function
|
|
2435
|
+
function J(e) {
|
|
2436
2436
|
if (e instanceof O) return ["u", String(e.value)];
|
|
2437
2437
|
if (e instanceof k) return ["n", String(e.value)];
|
|
2438
2438
|
if (e instanceof z) return ["t", e.value];
|
|
2439
2439
|
if (e instanceof P) return ["t", e.chunks.map((e) => e.value).join("")];
|
|
2440
|
-
if (e instanceof M) return ["b",
|
|
2440
|
+
if (e instanceof M) return ["b", Bn(e.value)];
|
|
2441
2441
|
if (e instanceof N) {
|
|
2442
2442
|
let t = "";
|
|
2443
|
-
for (let n of e.chunks) t +=
|
|
2443
|
+
for (let n of e.chunks) t += Bn(n.value);
|
|
2444
2444
|
return ["b", t];
|
|
2445
2445
|
}
|
|
2446
2446
|
if (e instanceof A) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
|
|
2447
2447
|
if (e instanceof L) return ["s", e.value];
|
|
2448
|
-
if (e instanceof F) return ["A", e.items.map(
|
|
2448
|
+
if (e instanceof F) return ["A", e.items.map(J)];
|
|
2449
2449
|
if (e instanceof I) {
|
|
2450
|
-
let t = e.entries.map(([e, t]) => [
|
|
2450
|
+
let t = e.entries.map(([e, t]) => [J(e), J(t)]);
|
|
2451
2451
|
if (t.length <= 1) return ["M", t];
|
|
2452
2452
|
let n = t.map((e) => [JSON.stringify(e[0]), e]);
|
|
2453
2453
|
return n.sort((e, t) => e[0] < t[0] ? -1 : +(e[0] > t[0])), ["M", n.map((e) => e[1])];
|
|
@@ -2455,13 +2455,13 @@ function Y(e) {
|
|
|
2455
2455
|
if (e instanceof j) return [
|
|
2456
2456
|
"G",
|
|
2457
2457
|
String(e.tag),
|
|
2458
|
-
|
|
2458
|
+
J(e.content)
|
|
2459
2459
|
];
|
|
2460
2460
|
let t = e.toCBOR(), n = "";
|
|
2461
2461
|
for (let e of t) n += e.toString(16).padStart(2, "0");
|
|
2462
2462
|
return ["c", n];
|
|
2463
2463
|
}
|
|
2464
|
-
function
|
|
2464
|
+
function Vn(e) {
|
|
2465
2465
|
if (e instanceof O) return "u" + e.value;
|
|
2466
2466
|
if (e instanceof k) return "n" + e.value;
|
|
2467
2467
|
if (e instanceof z) return "t" + e.value;
|
|
@@ -2470,17 +2470,25 @@ function Bn(e) {
|
|
|
2470
2470
|
for (let n of e.chunks) t += n.value;
|
|
2471
2471
|
return t;
|
|
2472
2472
|
}
|
|
2473
|
-
if (e instanceof M) return "b" +
|
|
2473
|
+
if (e instanceof M) return "b" + Bn(e.value);
|
|
2474
2474
|
if (e instanceof N) {
|
|
2475
2475
|
let t = "b";
|
|
2476
|
-
for (let n of e.chunks) t +=
|
|
2476
|
+
for (let n of e.chunks) t += Bn(n.value);
|
|
2477
2477
|
return t;
|
|
2478
2478
|
}
|
|
2479
|
-
return e instanceof A ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof L ? "s" + e.value : JSON.stringify(
|
|
2479
|
+
return e instanceof A ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof L ? "s" + e.value : JSON.stringify(J(e));
|
|
2480
|
+
}
|
|
2481
|
+
var Hn = Array.from({ length: 24 }, (e, t) => BigInt(t)), Un;
|
|
2482
|
+
function Wn() {
|
|
2483
|
+
return Un ??= Z.filter((e) => e.parseTag !== void 0);
|
|
2484
|
+
}
|
|
2485
|
+
function Gn(e, t) {
|
|
2486
|
+
for (let n = 0; n < t; n++) if (e[n] >= 128) return;
|
|
2487
|
+
return String.fromCharCode.apply(null, e);
|
|
2480
2488
|
}
|
|
2481
|
-
function
|
|
2489
|
+
function Y(e, t, n) {
|
|
2482
2490
|
if (n <= 23) return {
|
|
2483
|
-
value:
|
|
2491
|
+
value: Hn[n],
|
|
2484
2492
|
nextOffset: t
|
|
2485
2493
|
};
|
|
2486
2494
|
switch (n) {
|
|
@@ -2503,14 +2511,14 @@ function X(e, t, n) {
|
|
|
2503
2511
|
default: q(`reserved additional info value: ${n}`);
|
|
2504
2512
|
}
|
|
2505
2513
|
}
|
|
2506
|
-
function
|
|
2514
|
+
function Kn(e, t, n, r, i, a) {
|
|
2507
2515
|
let o = [], s = t;
|
|
2508
2516
|
for (;;) {
|
|
2509
2517
|
if (s >= e.byteLength && q(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
|
|
2510
2518
|
s++;
|
|
2511
2519
|
break;
|
|
2512
2520
|
}
|
|
2513
|
-
let t =
|
|
2521
|
+
let t = X(e, s, n, r);
|
|
2514
2522
|
a(t.value) || q(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
|
|
2515
2523
|
}
|
|
2516
2524
|
return {
|
|
@@ -2518,27 +2526,27 @@ function Vn(e, t, n, r, i, a) {
|
|
|
2518
2526
|
nextOffset: s
|
|
2519
2527
|
};
|
|
2520
2528
|
}
|
|
2521
|
-
function
|
|
2522
|
-
let i =
|
|
2529
|
+
function qn(e, t, n, r) {
|
|
2530
|
+
let i = Vn(e);
|
|
2523
2531
|
t.has(i) && n.push(Rn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
|
|
2524
2532
|
}
|
|
2525
|
-
function
|
|
2526
|
-
let i = t, a =
|
|
2533
|
+
function X(e, t, n, r) {
|
|
2534
|
+
let i = t, a = Jn(e, t, n, r);
|
|
2527
2535
|
return a.value.start = i, a.value.end = a.nextOffset, a;
|
|
2528
2536
|
}
|
|
2529
|
-
function
|
|
2537
|
+
function Jn(e, t, n, r) {
|
|
2530
2538
|
t >= e.byteLength && q("unexpected end of input");
|
|
2531
2539
|
let i = e.getUint8(t++), a = i >> 5, o = i & 31;
|
|
2532
2540
|
switch (a) {
|
|
2533
2541
|
case 0: {
|
|
2534
|
-
let { value: n, nextOffset: r } =
|
|
2542
|
+
let { value: n, nextOffset: r } = Y(e, t, o);
|
|
2535
2543
|
return {
|
|
2536
2544
|
value: new O(n, { encodingWidth: K(o, n) }),
|
|
2537
2545
|
nextOffset: r
|
|
2538
2546
|
};
|
|
2539
2547
|
}
|
|
2540
2548
|
case 1: {
|
|
2541
|
-
let { value: n, nextOffset: r } =
|
|
2549
|
+
let { value: n, nextOffset: r } = Y(e, t, o), i = K(o, n);
|
|
2542
2550
|
return {
|
|
2543
2551
|
value: new k(-1n - n, { encodingWidth: i }),
|
|
2544
2552
|
nextOffset: r
|
|
@@ -2546,13 +2554,13 @@ function Un(e, t, n, r) {
|
|
|
2546
2554
|
}
|
|
2547
2555
|
case 2: {
|
|
2548
2556
|
if (o === 31) {
|
|
2549
|
-
let { chunks: i, nextOffset: a } =
|
|
2557
|
+
let { chunks: i, nextOffset: a } = Kn(e, t, n, r, "byte string", (e) => e instanceof M);
|
|
2550
2558
|
return {
|
|
2551
2559
|
value: new N(i),
|
|
2552
2560
|
nextOffset: a
|
|
2553
2561
|
};
|
|
2554
2562
|
}
|
|
2555
|
-
let { value: i, nextOffset: a } =
|
|
2563
|
+
let { value: i, nextOffset: a } = Y(e, t, o), s = Number(i), c = K(o, i);
|
|
2556
2564
|
return a + s > e.byteLength && q("byte string extends beyond input"), {
|
|
2557
2565
|
value: new M(new Uint8Array(e.buffer, e.byteOffset + a, s).slice(), { encodingWidth: c }),
|
|
2558
2566
|
nextOffset: a + s
|
|
@@ -2560,23 +2568,24 @@ function Un(e, t, n, r) {
|
|
|
2560
2568
|
}
|
|
2561
2569
|
case 3: {
|
|
2562
2570
|
if (o === 31) {
|
|
2563
|
-
let { chunks: i, nextOffset: a } =
|
|
2571
|
+
let { chunks: i, nextOffset: a } = Kn(e, t, n, r, "text string", (e) => e instanceof z);
|
|
2564
2572
|
return {
|
|
2565
2573
|
value: new P(i),
|
|
2566
2574
|
nextOffset: a
|
|
2567
2575
|
};
|
|
2568
2576
|
}
|
|
2569
|
-
let { value: i, nextOffset: a } =
|
|
2577
|
+
let { value: i, nextOffset: a } = Y(e, t, o), s = Number(i), c = K(o, i);
|
|
2570
2578
|
a + s > e.byteLength && q("text string extends beyond input");
|
|
2571
|
-
let l = new Uint8Array(e.buffer, e.byteOffset + a, s), u, d;
|
|
2572
|
-
|
|
2579
|
+
let l = new Uint8Array(e.buffer, e.byteOffset + a, s), u, d, f = s < 64 ? Gn(l, s) : void 0;
|
|
2580
|
+
if (f !== void 0) u = f;
|
|
2581
|
+
else try {
|
|
2573
2582
|
u = In.decode(l);
|
|
2574
2583
|
} catch {
|
|
2575
2584
|
d = Rn("invalid UTF-8 sequence in text string", a, n), u = Ln.decode(l);
|
|
2576
2585
|
}
|
|
2577
|
-
let
|
|
2578
|
-
return d &&
|
|
2579
|
-
value:
|
|
2586
|
+
let p = new z(u, { encodingWidth: c });
|
|
2587
|
+
return d && zn(p, d), {
|
|
2588
|
+
value: p,
|
|
2580
2589
|
nextOffset: a + s
|
|
2581
2590
|
};
|
|
2582
2591
|
}
|
|
@@ -2588,7 +2597,7 @@ function Un(e, t, n, r) {
|
|
|
2588
2597
|
a++;
|
|
2589
2598
|
break;
|
|
2590
2599
|
}
|
|
2591
|
-
let t =
|
|
2600
|
+
let t = X(e, a, n, r);
|
|
2592
2601
|
i.push(t.value), a = t.nextOffset;
|
|
2593
2602
|
}
|
|
2594
2603
|
return {
|
|
@@ -2596,9 +2605,9 @@ function Un(e, t, n, r) {
|
|
|
2596
2605
|
nextOffset: a
|
|
2597
2606
|
};
|
|
2598
2607
|
}
|
|
2599
|
-
let { value: i, nextOffset: a } =
|
|
2608
|
+
let { value: i, nextOffset: a } = Y(e, t, o), s = Number(i), c = K(o, i), l = [], u = a;
|
|
2600
2609
|
for (let t = 0; t < s; t++) {
|
|
2601
|
-
let t =
|
|
2610
|
+
let t = X(e, u, n, r);
|
|
2602
2611
|
l.push(t.value), u = t.nextOffset;
|
|
2603
2612
|
}
|
|
2604
2613
|
return {
|
|
@@ -2614,27 +2623,27 @@ function Un(e, t, n, r) {
|
|
|
2614
2623
|
s++;
|
|
2615
2624
|
break;
|
|
2616
2625
|
}
|
|
2617
|
-
let t =
|
|
2618
|
-
|
|
2619
|
-
let c =
|
|
2626
|
+
let t = X(e, s, n, r);
|
|
2627
|
+
qn(t.value, a, o, n), s = t.nextOffset;
|
|
2628
|
+
let c = X(e, s, n, r);
|
|
2620
2629
|
s = c.nextOffset, i.push([t.value, c.value]);
|
|
2621
2630
|
}
|
|
2622
2631
|
let c = new I(i, { indefiniteLength: !0 });
|
|
2623
|
-
for (let e of o)
|
|
2632
|
+
for (let e of o) zn(c, e);
|
|
2624
2633
|
return {
|
|
2625
2634
|
value: c,
|
|
2626
2635
|
nextOffset: s
|
|
2627
2636
|
};
|
|
2628
2637
|
}
|
|
2629
|
-
let { value: i, nextOffset: a } =
|
|
2638
|
+
let { value: i, nextOffset: a } = Y(e, t, o), s = Number(i), c = K(o, i), l = [], u = /* @__PURE__ */ new Set(), d = [], f = a;
|
|
2630
2639
|
for (let t = 0; t < s; t++) {
|
|
2631
|
-
let t =
|
|
2632
|
-
|
|
2633
|
-
let i =
|
|
2640
|
+
let t = X(e, f, n, r);
|
|
2641
|
+
qn(t.value, u, d, n), f = t.nextOffset;
|
|
2642
|
+
let i = X(e, f, n, r);
|
|
2634
2643
|
f = i.nextOffset, l.push([t.value, i.value]);
|
|
2635
2644
|
}
|
|
2636
2645
|
let p = new I(l, { encodingWidth: c });
|
|
2637
|
-
for (let e of d)
|
|
2646
|
+
for (let e of d) zn(p, e);
|
|
2638
2647
|
return {
|
|
2639
2648
|
value: p,
|
|
2640
2649
|
nextOffset: f
|
|
@@ -2642,7 +2651,7 @@ function Un(e, t, n, r) {
|
|
|
2642
2651
|
}
|
|
2643
2652
|
case 6: {
|
|
2644
2653
|
o === 31 && q("tags cannot use indefinite-length encoding");
|
|
2645
|
-
let { value: i, nextOffset: a } =
|
|
2654
|
+
let { value: i, nextOffset: a } = Y(e, t, o), s = K(o, i), c = X(e, a, n, r);
|
|
2646
2655
|
for (let e of r) {
|
|
2647
2656
|
let t = e.parseTag(i, c.value, n);
|
|
2648
2657
|
if (t !== void 0) return t instanceof j && s !== void 0 && (t.encodingWidth = s), {
|
|
@@ -2681,7 +2690,7 @@ function Un(e, t, n, r) {
|
|
|
2681
2690
|
let r = e.getUint8(t);
|
|
2682
2691
|
if (r < 32) {
|
|
2683
2692
|
let e = Rn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new L(r);
|
|
2684
|
-
return
|
|
2693
|
+
return zn(i, e), {
|
|
2685
2694
|
value: i,
|
|
2686
2695
|
nextOffset: t + 1
|
|
2687
2696
|
};
|
|
@@ -2704,34 +2713,34 @@ function Un(e, t, n, r) {
|
|
|
2704
2713
|
}
|
|
2705
2714
|
return q(`unknown major type: ${a}`);
|
|
2706
2715
|
}
|
|
2707
|
-
function
|
|
2716
|
+
function Yn(e) {
|
|
2708
2717
|
if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new Uint8Array(e);
|
|
2709
2718
|
if (ArrayBuffer.isView(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
2710
2719
|
throw TypeError("expected ArrayBufferView or ArrayBufferLike");
|
|
2711
2720
|
}
|
|
2712
|
-
function
|
|
2713
|
-
let n =
|
|
2721
|
+
function Xn(e, t) {
|
|
2722
|
+
let n = Yn(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
|
|
2714
2723
|
if (!Number.isInteger(i) || i < 0 || i > r.byteLength) throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);
|
|
2715
|
-
let a =
|
|
2724
|
+
let a = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...Wn()] : Wn(), { value: o, nextOffset: s } = X(r, i, t, a);
|
|
2716
2725
|
if (!t?.allowTrailing && s !== r.byteLength) {
|
|
2717
|
-
|
|
2726
|
+
zn(o, Rn(`${r.byteLength - s} trailing byte(s) after end of CBOR item`, s, t));
|
|
2718
2727
|
let e = {
|
|
2719
2728
|
strict: !1,
|
|
2720
2729
|
silent: !0
|
|
2721
2730
|
}, n = s;
|
|
2722
|
-
for (; n < r.byteLength;) ({nextOffset: n} =
|
|
2731
|
+
for (; n < r.byteLength;) ({nextOffset: n} = X(r, n, e, a));
|
|
2723
2732
|
}
|
|
2724
2733
|
return o;
|
|
2725
2734
|
}
|
|
2726
2735
|
//#endregion
|
|
2727
2736
|
//#region src/extensions/cbordata.ts
|
|
2728
|
-
var
|
|
2737
|
+
var Zn = 24n, Z = [
|
|
2729
2738
|
Vt,
|
|
2730
2739
|
on,
|
|
2731
2740
|
ln,
|
|
2732
2741
|
Fn,
|
|
2733
2742
|
{
|
|
2734
|
-
tagNumbers: [
|
|
2743
|
+
tagNumbers: [Zn],
|
|
2735
2744
|
parseTag(e, t, n) {
|
|
2736
2745
|
if (e !== 24n || !(t instanceof M)) return;
|
|
2737
2746
|
let r = n ? {
|
|
@@ -2741,7 +2750,7 @@ var Kn = 24n, qn = [
|
|
|
2741
2750
|
silent: n.silent
|
|
2742
2751
|
} : void 0;
|
|
2743
2752
|
try {
|
|
2744
|
-
return new j(
|
|
2753
|
+
return new j(Zn, new Ve([Xn(t.value, r)], { encodingWidth: t.encodingWidth }));
|
|
2745
2754
|
} catch (e) {
|
|
2746
2755
|
if (r?.strict !== !1) throw e;
|
|
2747
2756
|
return;
|
|
@@ -2753,19 +2762,19 @@ var Kn = 24n, qn = [
|
|
|
2753
2762
|
//#region src/js/fromJS.ts
|
|
2754
2763
|
function Q(e, t) {
|
|
2755
2764
|
if (t?.replacer) {
|
|
2756
|
-
let { replacer: n, ...r } = t, i =
|
|
2765
|
+
let { replacer: n, ...r } = t, i = er(e, n, r.extensions, r.undefinedOmits);
|
|
2757
2766
|
return i === d ? L.UNDEFINED : Q(i, Object.keys(r).length > 0 ? r : void 0);
|
|
2758
2767
|
}
|
|
2759
|
-
return
|
|
2768
|
+
return Qn(e, t, !0);
|
|
2760
2769
|
}
|
|
2761
|
-
function
|
|
2762
|
-
for (let n of [...t?.extensions ?? [], ...
|
|
2770
|
+
function Qn(e, t, n) {
|
|
2771
|
+
for (let n of [...t?.extensions ?? [], ...Z]) if (n.fromJS) {
|
|
2763
2772
|
let r = n.fromJS(e, t ?? {});
|
|
2764
2773
|
if (r !== void 0) return r;
|
|
2765
2774
|
}
|
|
2766
2775
|
if (n && typeof e == "object" && e && u.symbol in e) {
|
|
2767
|
-
let n = e[u.symbol], r =
|
|
2768
|
-
for (let e of [...t?.extensions ?? [], ...
|
|
2776
|
+
let n = e[u.symbol], r = Qn(e, t, !1);
|
|
2777
|
+
for (let e of [...t?.extensions ?? [], ...Z]) if (e.parseTag) {
|
|
2769
2778
|
let t = e.parseTag(n, r);
|
|
2770
2779
|
if (t !== void 0) return t;
|
|
2771
2780
|
}
|
|
@@ -2781,7 +2790,7 @@ function Jn(e, t, n) {
|
|
|
2781
2790
|
if (typeof e == "bigint") return e > 18446744073709551615n ? new Qe(e) : e < -18446744073709551616n ? new $e(e) : e >= 0n ? new O(e) : new k(e);
|
|
2782
2791
|
if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new O(BigInt(e)) : new k(BigInt(e)) : new A(e);
|
|
2783
2792
|
if (typeof e == "string") return new z(e);
|
|
2784
|
-
if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return
|
|
2793
|
+
if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Qn(e.valueOf(), t, !1);
|
|
2785
2794
|
if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new M(new Uint8Array(e));
|
|
2786
2795
|
if (ArrayBuffer.isView(e)) return e instanceof Uint8Array && t?.uint8ArrayAs === "array" ? new F(Array.from(e, (e) => new O(BigInt(e)))) : new M(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
|
|
2787
2796
|
if (e instanceof $) return new I([...e].map(([e, n]) => [Q(e, t), Q(n, t)]));
|
|
@@ -2793,11 +2802,11 @@ function Jn(e, t, n) {
|
|
|
2793
2802
|
}
|
|
2794
2803
|
throw TypeError(`fromJS: unsupported value type: ${typeof e}`);
|
|
2795
2804
|
}
|
|
2796
|
-
function
|
|
2805
|
+
function $n(e) {
|
|
2797
2806
|
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 u.Null || e instanceof u.Undefined || e instanceof f;
|
|
2798
2807
|
}
|
|
2799
|
-
function
|
|
2800
|
-
let i = [...n ?? [], ...
|
|
2808
|
+
function er(e, t, n, r) {
|
|
2809
|
+
let i = [...n ?? [], ...Z];
|
|
2801
2810
|
function a(e) {
|
|
2802
2811
|
return e === d || r === !0 && e === void 0;
|
|
2803
2812
|
}
|
|
@@ -2807,7 +2816,7 @@ function Xn(e, t, n, r) {
|
|
|
2807
2816
|
if (typeof e != "object" || !e) return e;
|
|
2808
2817
|
if (e instanceof $) return $.from(e, ([e, t]) => [e, r(t)]);
|
|
2809
2818
|
if (Array.isArray(e)) return e.map(r);
|
|
2810
|
-
if (u.symbol in e ||
|
|
2819
|
+
if (u.symbol in e || $n(e) || i.some((t) => t.isJSType?.(e))) return e;
|
|
2811
2820
|
let t = Object.getPrototypeOf(e);
|
|
2812
2821
|
if (t === Object.prototype || t === null) {
|
|
2813
2822
|
let t = e.toJSON;
|
|
@@ -2842,7 +2851,7 @@ function Xn(e, t, n, r) {
|
|
|
2842
2851
|
let r = s(t, String(n), e);
|
|
2843
2852
|
return a(r) ? null : r;
|
|
2844
2853
|
});
|
|
2845
|
-
if (
|
|
2854
|
+
if ($n(e) || i.some((t) => t.isJSType?.(e))) return e;
|
|
2846
2855
|
let t = {};
|
|
2847
2856
|
for (let n of Object.keys(e)) {
|
|
2848
2857
|
let r = s(e[n], n, e);
|
|
@@ -2872,6 +2881,6 @@ var $ = class extends Array {
|
|
|
2872
2881
|
}
|
|
2873
2882
|
};
|
|
2874
2883
|
//#endregion
|
|
2875
|
-
export { i as A, x as C, n as D, d as E, r as O, S, f as T, j as _, Ht as a, O as b, $e as c, L as d, I as f, M as g, N as h,
|
|
2884
|
+
export { i as A, x as C, n as D, d as E, r as O, S, f as T, j as _, Ht as a, O as b, $e as c, L as d, I as f, M as g, N as h, Xn as i, u as k, Qe as l, P as m, er as n, z as o, F as p, Q as r, rt as s, $ as t, Ve as u, A as v, ne as w, D as x, k as y };
|
|
2876
2885
|
|
|
2877
|
-
//# sourceMappingURL=mapEntries-
|
|
2886
|
+
//# sourceMappingURL=mapEntries-I8f0WuwK.js.map
|