@cbortech/cbor 0.26.0 → 0.26.1
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 +35 -0
- package/README.md +35 -0
- package/dist/ast/index.cjs +1 -1
- package/dist/ast/index.js +2 -2
- package/dist/extensions/builtins.d.ts +24 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +149 -149
- package/dist/index.js.map +1 -1
- package/dist/js/fromJS.d.ts +1 -1
- package/dist/mapEntries-Bys9cXgV.cjs +14 -0
- package/dist/mapEntries-Bys9cXgV.cjs.map +1 -0
- package/dist/{mapEntries-BdzS6bFp.js → mapEntries-ClxYqDPp.js} +342 -316
- package/dist/mapEntries-ClxYqDPp.js.map +1 -0
- package/dist/types.d.ts +55 -0
- package/package.json +1 -1
- package/dist/mapEntries-BdzS6bFp.js.map +0 -1
- package/dist/mapEntries-DJtvWpWq.cjs +0 -14
- package/dist/mapEntries-DJtvWpWq.cjs.map +0 -1
|
@@ -717,7 +717,7 @@ var j = class extends O {
|
|
|
717
717
|
e.writeByte(255);
|
|
718
718
|
}
|
|
719
719
|
_toCDN(e, t) {
|
|
720
|
-
return (e?.encodingIndicators ?? "auto") === "never" ? new
|
|
720
|
+
return (e?.encodingIndicators ?? "auto") === "never" ? new V(this.chunks.map((e) => e.value).join(""))._toCDN(e, t) : this.chunks.length === 0 ? "\"\"_" : `(_ ${this.chunks.map((t) => t._toCDN(e, 0)).join(", ")})`;
|
|
721
721
|
}
|
|
722
722
|
_toHexDump(e, t) {
|
|
723
723
|
let r = [{
|
|
@@ -879,13 +879,13 @@ var j = class extends O {
|
|
|
879
879
|
}
|
|
880
880
|
return n;
|
|
881
881
|
};
|
|
882
|
-
return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof
|
|
882
|
+
return e?.mapAs === "entries" ? n() : e?.mapAs === "object" || this.entries.every(([e]) => e instanceof V) ? (() => {
|
|
883
883
|
let n = e ? {
|
|
884
884
|
...e,
|
|
885
885
|
reviver: void 0
|
|
886
886
|
} : void 0, r = {};
|
|
887
887
|
for (let [e, t] of this.entries) {
|
|
888
|
-
let i = e instanceof
|
|
888
|
+
let i = e instanceof V ? e.value : e.toCDN(), a = t._toJS(n);
|
|
889
889
|
i === "__proto__" ? Object.defineProperty(r, i, {
|
|
890
890
|
value: a,
|
|
891
891
|
writable: !0,
|
|
@@ -897,10 +897,10 @@ var j = class extends O {
|
|
|
897
897
|
let i = /* @__PURE__ */ new Map();
|
|
898
898
|
for (let e = 0; e < this.entries.length; e++) {
|
|
899
899
|
let [t] = this.entries[e];
|
|
900
|
-
i.set(t instanceof
|
|
900
|
+
i.set(t instanceof V ? t.value : t.toCDN(), e);
|
|
901
901
|
}
|
|
902
902
|
for (let n = 0; n < this.entries.length; n++) {
|
|
903
|
-
let [a, o] = this.entries[n], s = a instanceof
|
|
903
|
+
let [a, o] = this.entries[n], s = a instanceof V ? a.value : a.toCDN();
|
|
904
904
|
if (i.get(s) !== n) continue;
|
|
905
905
|
let c = o._toJS(e), l = t.call(r, s, c);
|
|
906
906
|
l === h || e?.undefinedOmits && l === void 0 ? delete r[s] : s === "__proto__" ? Object.defineProperty(r, s, {
|
|
@@ -991,13 +991,13 @@ var R = class e extends O {
|
|
|
991
991
|
}
|
|
992
992
|
}, We = 999n, Ge = class extends M {
|
|
993
993
|
constructor(e, t) {
|
|
994
|
-
let n = t.length === 1 && t[0] instanceof
|
|
995
|
-
super(We, new I([new
|
|
994
|
+
let n = t.length === 1 && t[0] instanceof V ? t[0] : new I(t);
|
|
995
|
+
super(We, new I([new V(e), n]));
|
|
996
996
|
}
|
|
997
997
|
_toCDN(e, t) {
|
|
998
998
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
999
999
|
let n = this.content, r = n.items[0].value, i = n.items[1];
|
|
1000
|
-
return i instanceof
|
|
1000
|
+
return i instanceof V ? `${r}${xe(i.value)}` : `${r}<<${i.items.map((n) => n._toCDN(e, t)).join(", ")}>>`;
|
|
1001
1001
|
}
|
|
1002
1002
|
}, Ke = class extends O {
|
|
1003
1003
|
inner;
|
|
@@ -1219,13 +1219,24 @@ function pt(e) {
|
|
|
1219
1219
|
return a + 1;
|
|
1220
1220
|
};
|
|
1221
1221
|
}
|
|
1222
|
-
var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, ht = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, gt = /* @__PURE__ */ new Map([
|
|
1222
|
+
var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`, ht = (e, t) => `install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`, B = (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)`, gt = /* @__PURE__ */ new Map([
|
|
1223
1223
|
["b32", mt("b32")],
|
|
1224
1224
|
["h32", mt("h32")],
|
|
1225
1225
|
["same", mt("same")],
|
|
1226
1226
|
["hash", ht("hash", "@cbortech/hash-extension")],
|
|
1227
1227
|
["uuid", ht("uuid", "@cbortech/uuid-extension")],
|
|
1228
|
-
["UUID", ht("uuid", "@cbortech/uuid-extension")]
|
|
1228
|
+
["UUID", ht("uuid", "@cbortech/uuid-extension")],
|
|
1229
|
+
["dt", B("dt")],
|
|
1230
|
+
["DT", B("dt")],
|
|
1231
|
+
["ip", B("ip")],
|
|
1232
|
+
["IP", B("ip")],
|
|
1233
|
+
["cri", B("cri")],
|
|
1234
|
+
["CRI", B("cri")],
|
|
1235
|
+
["t1", B("t1")],
|
|
1236
|
+
["b1", B("b1")],
|
|
1237
|
+
["ilbs", B("ilbs")],
|
|
1238
|
+
["ilts", B("ilts")],
|
|
1239
|
+
["float", B("float")]
|
|
1229
1240
|
]), _t = class {
|
|
1230
1241
|
t;
|
|
1231
1242
|
_options;
|
|
@@ -1236,7 +1247,8 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1236
1247
|
_hintedPrefixes = /* @__PURE__ */ new Set();
|
|
1237
1248
|
constructor(e, t) {
|
|
1238
1249
|
this.t = e, this._options = t, this.extByPrefix = /* @__PURE__ */ new Map(), this.extByTag = /* @__PURE__ */ new Map(), this.unresolvedExtension = t.unresolvedExtension ?? "cpa999";
|
|
1239
|
-
|
|
1250
|
+
let n = Z(t.builtinExtensions);
|
|
1251
|
+
for (let e of [...n, ...t.extensions ?? []]) {
|
|
1240
1252
|
for (let t of e.appStringPrefixes ?? []) this.extByPrefix.set(t, e);
|
|
1241
1253
|
for (let t of e.tagNumbers ?? []) this.extByTag.set(t, e);
|
|
1242
1254
|
}
|
|
@@ -1306,7 +1318,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1306
1318
|
}
|
|
1307
1319
|
let r = this.extByPrefix.get(e.appPrefix);
|
|
1308
1320
|
if (!r?.parseAppString) {
|
|
1309
|
-
if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ge(e.appPrefix, [new
|
|
1321
|
+
if (r || this._hintMissingExtension(e.appPrefix, e), this.unresolvedExtension === "cpa999") return new Ge(e.appPrefix, [new V(e.value)]);
|
|
1310
1322
|
this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`, e);
|
|
1311
1323
|
}
|
|
1312
1324
|
{
|
|
@@ -1320,7 +1332,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1320
1332
|
}) : (i instanceof j && i.ednSource === void 0 && (i.ednSource = e.raw + n), i);
|
|
1321
1333
|
} catch (t) {
|
|
1322
1334
|
if (this._options.strict !== !1) throw t;
|
|
1323
|
-
return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new Ge(e.appPrefix, [new
|
|
1335
|
+
return this._pendingWarnings.length === i && this._warn(t instanceof Error ? t.message : String(t), e), new Ge(e.appPrefix, [new V(e.value)]);
|
|
1324
1336
|
}
|
|
1325
1337
|
}
|
|
1326
1338
|
}
|
|
@@ -1402,7 +1414,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1402
1414
|
let e = this.t.consume();
|
|
1403
1415
|
if (this.t.peek().type !== "PLUS") {
|
|
1404
1416
|
let t = this.consumeEncodingIndicator(() => BigInt(nt.encode(e.value).length));
|
|
1405
|
-
return new
|
|
1417
|
+
return new V(e.value, t === void 0 ? void 0 : { encodingWidth: t });
|
|
1406
1418
|
}
|
|
1407
1419
|
let t = !1, n = [{ text: e.value }];
|
|
1408
1420
|
for (; this.t.peek().type === "PLUS";) {
|
|
@@ -1412,14 +1424,14 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1412
1424
|
}
|
|
1413
1425
|
if (!t) {
|
|
1414
1426
|
let e = n.map((e) => "text" in e ? e.text : ""), t = e.join(""), r = this.consumeEncodingIndicator(() => BigInt(nt.encode(t).length));
|
|
1415
|
-
return new
|
|
1427
|
+
return new V(t, {
|
|
1416
1428
|
ednParts: e,
|
|
1417
1429
|
...r === void 0 ? {} : { encodingWidth: r }
|
|
1418
1430
|
});
|
|
1419
1431
|
}
|
|
1420
1432
|
let r = [], i = "";
|
|
1421
|
-
for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new
|
|
1422
|
-
return i !== "" && r.push(new
|
|
1433
|
+
for (let e of n) "ellipsis" in e ? (i !== "" && (r.push(new V(i)), i = ""), r.push(new z())) : i += e.text;
|
|
1434
|
+
return i !== "" && r.push(new V(i)), new z(r);
|
|
1423
1435
|
}
|
|
1424
1436
|
_isBytesToken(e) {
|
|
1425
1437
|
return e === "BYTES_HEX" || e === "SQSTR" || e === "BYTES_B64";
|
|
@@ -1621,9 +1633,9 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1621
1633
|
}));
|
|
1622
1634
|
return t.length > 0 && (e.warnings = t), e;
|
|
1623
1635
|
}
|
|
1624
|
-
if (r instanceof
|
|
1636
|
+
if (r instanceof V) {
|
|
1625
1637
|
let e = new F(n.map((e, t) => {
|
|
1626
|
-
if (e instanceof
|
|
1638
|
+
if (e instanceof V) return e;
|
|
1627
1639
|
this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`);
|
|
1628
1640
|
}));
|
|
1629
1641
|
return t.length > 0 && (e.warnings = t), e;
|
|
@@ -1666,7 +1678,7 @@ var mt = (e) => `import { ${e} } from '@cbortech/cbor' and pass it via the 'exte
|
|
|
1666
1678
|
let r = this._validateEncodingFit(BigInt(e.value.length), t, n);
|
|
1667
1679
|
r !== void 0 && (e.encodingWidth = r);
|
|
1668
1680
|
}
|
|
1669
|
-
} else if (e instanceof
|
|
1681
|
+
} else if (e instanceof V) {
|
|
1670
1682
|
if (e.encodingWidth === void 0) {
|
|
1671
1683
|
let r = this._validateEncodingFit(BigInt(nt.encode(e.value).length), t, n);
|
|
1672
1684
|
r !== void 0 && (e.encodingWidth = r);
|
|
@@ -1744,7 +1756,7 @@ function vt(e) {
|
|
|
1744
1756
|
}
|
|
1745
1757
|
//#endregion
|
|
1746
1758
|
//#region src/ast/CborTextString.ts
|
|
1747
|
-
var yt = new TextEncoder(), bt = !1,
|
|
1759
|
+
var yt = new TextEncoder(), bt = !1, V = class extends O {
|
|
1748
1760
|
indefiniteLength = !1;
|
|
1749
1761
|
value;
|
|
1750
1762
|
encodingWidth;
|
|
@@ -1951,7 +1963,7 @@ function Pt(e, t) {
|
|
|
1951
1963
|
}
|
|
1952
1964
|
//#endregion
|
|
1953
1965
|
//#region src/extensions/dt.ts
|
|
1954
|
-
function
|
|
1966
|
+
function H(e) {
|
|
1955
1967
|
if (Number.isInteger(e)) return (/* @__PURE__ */ new Date(e * 1e3)).toISOString().replace(/\.000Z$/, "Z");
|
|
1956
1968
|
let t = Math.round(e * 1e3);
|
|
1957
1969
|
if (t / 1e3 === e) return new Date(t).toISOString().replace(/\.000Z$/, "Z");
|
|
@@ -1963,7 +1975,7 @@ var Ft = new TextDecoder("utf-8", { fatal: !0 });
|
|
|
1963
1975
|
function It(e) {
|
|
1964
1976
|
if (e.length !== 1) throw SyntaxError("dt<<...>>: expected exactly one item");
|
|
1965
1977
|
let t = e[0];
|
|
1966
|
-
if (t instanceof
|
|
1978
|
+
if (t instanceof V) return t.value;
|
|
1967
1979
|
if (t instanceof N) return Ft.decode(t.value);
|
|
1968
1980
|
throw SyntaxError("dt<<...>>: expected a text string or byte string");
|
|
1969
1981
|
}
|
|
@@ -1991,7 +2003,7 @@ var zt = 1n, Bt = class extends k {
|
|
|
1991
2003
|
_toCDN(e, t) {
|
|
1992
2004
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
1993
2005
|
let n = x(e, this.encodingWidth, () => b(this.value));
|
|
1994
|
-
return `dt'${
|
|
2006
|
+
return `dt'${H(Number(this.value))}'${n}`;
|
|
1995
2007
|
}
|
|
1996
2008
|
}, Vt = class extends A {
|
|
1997
2009
|
constructor(e, t) {
|
|
@@ -2000,7 +2012,7 @@ var zt = 1n, Bt = class extends k {
|
|
|
2000
2012
|
_toCDN(e, t) {
|
|
2001
2013
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2002
2014
|
let n = x(e, this.encodingWidth, () => b(this.argument));
|
|
2003
|
-
return `dt'${
|
|
2015
|
+
return `dt'${H(Number(this.value))}'${n}`;
|
|
2004
2016
|
}
|
|
2005
2017
|
}, Ht = class extends j {
|
|
2006
2018
|
constructor(e, t) {
|
|
@@ -2009,7 +2021,7 @@ var zt = 1n, Bt = class extends k {
|
|
|
2009
2021
|
_toCDN(e, t) {
|
|
2010
2022
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2011
2023
|
let n = D(this.value), r = we(this.value, this.precision, n, e?.encodingIndicators ?? "auto");
|
|
2012
|
-
return `dt'${
|
|
2024
|
+
return `dt'${H(this.value)}'${r}`;
|
|
2013
2025
|
}
|
|
2014
2026
|
}, Ut = class extends M {
|
|
2015
2027
|
constructor(e, t) {
|
|
@@ -2023,7 +2035,7 @@ var zt = 1n, Bt = class extends k {
|
|
|
2023
2035
|
appStrings: !1
|
|
2024
2036
|
}, t);
|
|
2025
2037
|
let r = n instanceof j ? n.value : Number(n.value), i = x(e, this.encodingWidth, () => b(zt));
|
|
2026
|
-
return `DT'${
|
|
2038
|
+
return `DT'${H(r)}'${i}`;
|
|
2027
2039
|
}
|
|
2028
2040
|
}, Wt = class extends Ut {
|
|
2029
2041
|
constructor(e, t) {
|
|
@@ -2060,7 +2072,7 @@ function Gt(e) {
|
|
|
2060
2072
|
}
|
|
2061
2073
|
};
|
|
2062
2074
|
return t && (r.fromJS = (e, t) => {
|
|
2063
|
-
if (e instanceof Date) return new Wt(
|
|
2075
|
+
if (e instanceof Date) return new Wt(H(e.getTime() / 1e3));
|
|
2064
2076
|
}, r.isJSType = (e) => e instanceof Date), r;
|
|
2065
2077
|
}
|
|
2066
2078
|
var Kt = Gt(), qt = Gt({ jsDate: !0 });
|
|
@@ -2118,11 +2130,11 @@ function Zt(e) {
|
|
|
2118
2130
|
}
|
|
2119
2131
|
//#endregion
|
|
2120
2132
|
//#region src/extensions/ip.ts
|
|
2121
|
-
var Qt = "ip",
|
|
2133
|
+
var Qt = "ip", U = "IP", W = 52n, $t = 54n, en = new TextDecoder("utf-8", { fatal: !0 });
|
|
2122
2134
|
function tn(e) {
|
|
2123
2135
|
if (e.length !== 1) throw SyntaxError("ip<<...>>: expected exactly one item");
|
|
2124
2136
|
let t = e[0];
|
|
2125
|
-
if (t instanceof
|
|
2137
|
+
if (t instanceof V) return t.value;
|
|
2126
2138
|
if (t instanceof N) return en.decode(t.value);
|
|
2127
2139
|
throw SyntaxError("ip<<...>>: expected a text string or byte string");
|
|
2128
2140
|
}
|
|
@@ -2176,16 +2188,16 @@ var sn = class extends N {
|
|
|
2176
2188
|
}
|
|
2177
2189
|
_toCDN(e, t) {
|
|
2178
2190
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2179
|
-
let n = this.tag ===
|
|
2191
|
+
let n = this.tag === W ? 4 : 16, r = this.content;
|
|
2180
2192
|
if (r instanceof N) {
|
|
2181
2193
|
if (r.encodingWidth !== void 0) return super._toCDN(e, t);
|
|
2182
2194
|
let n = x(e, this.encodingWidth, () => b(this.tag));
|
|
2183
|
-
return `${
|
|
2195
|
+
return `${U}'${rn(r.value)}'${n}`;
|
|
2184
2196
|
}
|
|
2185
2197
|
if (r instanceof I && r.items.length === 2 && r.items[0] instanceof k && r.items[1] instanceof N) {
|
|
2186
2198
|
if (r.encodingWidth !== void 0 || r.items[0].encodingWidth !== void 0 || r.items[1].encodingWidth !== void 0) return super._toCDN(e, t);
|
|
2187
2199
|
let i = Number(r.items[0].value), a = on(r.items[1].value, n), o = x(e, this.encodingWidth, () => b(this.tag));
|
|
2188
|
-
return `${
|
|
2200
|
+
return `${U}'${rn(a)}/${i}'${o}`;
|
|
2189
2201
|
}
|
|
2190
2202
|
return super._toCDN(e, t);
|
|
2191
2203
|
}
|
|
@@ -2194,18 +2206,18 @@ function un(e, t) {
|
|
|
2194
2206
|
let n = t.indexOf("/");
|
|
2195
2207
|
if (n === -1) {
|
|
2196
2208
|
let { bytes: n, isV4: r } = nn(t);
|
|
2197
|
-
return e ===
|
|
2209
|
+
return e === U ? new ln(r ? W : $t, new N(n)) : new sn(n);
|
|
2198
2210
|
}
|
|
2199
2211
|
let r = t.slice(0, n), i = t.slice(n + 1);
|
|
2200
2212
|
if (!/^\d+$/.test(i)) throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);
|
|
2201
2213
|
let a = parseInt(i, 10), { bytes: o, isV4: s } = nn(r), c = s ? 32 : 128;
|
|
2202
2214
|
if (a > c) throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s ? "IPv4" : "IPv6"}`);
|
|
2203
2215
|
let l = an(o, a);
|
|
2204
|
-
return e ===
|
|
2216
|
+
return e === U ? new ln(s ? W : $t, new I([new k(BigInt(a)), new N(l)])) : new cn(a, l, s);
|
|
2205
2217
|
}
|
|
2206
2218
|
var dn = {
|
|
2207
|
-
appStringPrefixes: [Qt,
|
|
2208
|
-
tagNumbers: [
|
|
2219
|
+
appStringPrefixes: [Qt, U],
|
|
2220
|
+
tagNumbers: [W, $t],
|
|
2209
2221
|
parseAppString(e, t) {
|
|
2210
2222
|
return un(e, t);
|
|
2211
2223
|
},
|
|
@@ -2213,23 +2225,9 @@ var dn = {
|
|
|
2213
2225
|
return un(e, tn(t));
|
|
2214
2226
|
},
|
|
2215
2227
|
parseTag(e, t) {
|
|
2216
|
-
if (!(e !==
|
|
2228
|
+
if (!(e !== W && e !== $t) && (t instanceof N || t instanceof I)) return new ln(e, t);
|
|
2217
2229
|
}
|
|
2218
|
-
}, fn =
|
|
2219
|
-
tagNumbers: [Je, Ye],
|
|
2220
|
-
parseTag(e, t) {
|
|
2221
|
-
if (t instanceof N) {
|
|
2222
|
-
if (e === 2n) {
|
|
2223
|
-
let e = $e(t.value);
|
|
2224
|
-
return e > fn ? new et(e) : void 0;
|
|
2225
|
-
}
|
|
2226
|
-
if (e === 3n) {
|
|
2227
|
-
let e = -1n - $e(t.value);
|
|
2228
|
-
return e < pn ? new tt(e) : void 0;
|
|
2229
|
-
}
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
}, hn = "cri", gn = "CRI", _n = 99n, vn = /* @__PURE__ */ new Map([
|
|
2230
|
+
}, fn = "cri", pn = "CRI", mn = 99n, hn = /* @__PURE__ */ new Map([
|
|
2233
2231
|
["coap", -1n],
|
|
2234
2232
|
["coaps", -2n],
|
|
2235
2233
|
["http", -3n],
|
|
@@ -2240,47 +2238,47 @@ var dn = {
|
|
|
2240
2238
|
["coaps+tcp", -8n],
|
|
2241
2239
|
["coap+ws", -25n],
|
|
2242
2240
|
["coaps+ws", -26n]
|
|
2243
|
-
]),
|
|
2244
|
-
function
|
|
2241
|
+
]), gn = new Map([...hn.entries()].map(([e, t]) => [t, e]));
|
|
2242
|
+
function G(e) {
|
|
2245
2243
|
try {
|
|
2246
2244
|
return decodeURIComponent(e);
|
|
2247
2245
|
} catch {
|
|
2248
2246
|
return e;
|
|
2249
2247
|
}
|
|
2250
2248
|
}
|
|
2251
|
-
var
|
|
2252
|
-
function
|
|
2253
|
-
return Array.from(
|
|
2249
|
+
var _n = new TextEncoder(), vn = new TextDecoder("utf-8", { fatal: !0 });
|
|
2250
|
+
function yn(e) {
|
|
2251
|
+
return Array.from(_n.encode(e), (e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
|
|
2254
2252
|
}
|
|
2255
|
-
function
|
|
2253
|
+
function K(e, t) {
|
|
2256
2254
|
let n = "";
|
|
2257
|
-
for (let r of e) n += t(r) ? r :
|
|
2255
|
+
for (let r of e) n += t(r) ? r : yn(r);
|
|
2258
2256
|
return n;
|
|
2259
2257
|
}
|
|
2260
|
-
function
|
|
2258
|
+
function bn(e) {
|
|
2261
2259
|
return /[A-Za-z0-9\-._~]/.test(e);
|
|
2262
2260
|
}
|
|
2263
|
-
function
|
|
2261
|
+
function xn(e) {
|
|
2264
2262
|
return /[!$&'()*+,;=]/.test(e);
|
|
2265
2263
|
}
|
|
2266
|
-
function
|
|
2267
|
-
return
|
|
2264
|
+
function Sn(e) {
|
|
2265
|
+
return bn(e) || xn(e) || e === ":" || e === "@";
|
|
2268
2266
|
}
|
|
2269
|
-
function
|
|
2270
|
-
return (
|
|
2267
|
+
function Cn(e) {
|
|
2268
|
+
return (Sn(e) || e === "/" || e === "?") && e !== "&";
|
|
2271
2269
|
}
|
|
2272
|
-
function
|
|
2273
|
-
return
|
|
2270
|
+
function wn(e) {
|
|
2271
|
+
return Sn(e) || e === "/" || e === "?";
|
|
2274
2272
|
}
|
|
2275
|
-
function
|
|
2276
|
-
return
|
|
2273
|
+
function Tn(e) {
|
|
2274
|
+
return bn(e) || xn(e) || e === ":";
|
|
2277
2275
|
}
|
|
2278
|
-
function
|
|
2279
|
-
return
|
|
2276
|
+
function En(e) {
|
|
2277
|
+
return bn(e) || xn(e);
|
|
2280
2278
|
}
|
|
2281
|
-
function
|
|
2279
|
+
function Dn(e) {
|
|
2282
2280
|
let t = [], n = e, r = n.indexOf("@");
|
|
2283
|
-
r >= 0 && (t.push(R.FALSE), t.push(new
|
|
2281
|
+
r >= 0 && (t.push(R.FALSE), t.push(new V(G(n.slice(0, r)))), n = n.slice(r + 1));
|
|
2284
2282
|
let i, a = null;
|
|
2285
2283
|
if (n.startsWith("[")) {
|
|
2286
2284
|
let e = n.indexOf("]");
|
|
@@ -2293,7 +2291,7 @@ function An(e) {
|
|
|
2293
2291
|
} else {
|
|
2294
2292
|
let e = n.lastIndexOf(":");
|
|
2295
2293
|
if (e >= 0 ? (i = n.slice(0, e), a = n.slice(e + 1)) : i = n, i !== "") if (/^\d{1,3}(\.\d{1,3}){3}$/.test(i)) t.push(new N(Jt(i)));
|
|
2296
|
-
else for (let e of i.toLowerCase().split(".")) t.push(new
|
|
2294
|
+
else for (let e of i.toLowerCase().split(".")) t.push(new V(e));
|
|
2297
2295
|
}
|
|
2298
2296
|
if (a !== null && a !== "") {
|
|
2299
2297
|
if (!/^\d+$/.test(a)) throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);
|
|
@@ -2303,12 +2301,12 @@ function An(e) {
|
|
|
2303
2301
|
}
|
|
2304
2302
|
return new I(t);
|
|
2305
2303
|
}
|
|
2306
|
-
function
|
|
2304
|
+
function On(e) {
|
|
2307
2305
|
let t = e.items, n = 0, r = "";
|
|
2308
2306
|
if (n < t.length && t[n] instanceof R && t[n].value === 20) {
|
|
2309
2307
|
n++;
|
|
2310
2308
|
let e = t[n++];
|
|
2311
|
-
r +=
|
|
2309
|
+
r += K(e.value, Tn) + "@";
|
|
2312
2310
|
}
|
|
2313
2311
|
if (n >= t.length) return r;
|
|
2314
2312
|
let i = t[n];
|
|
@@ -2318,97 +2316,97 @@ function jn(e) {
|
|
|
2318
2316
|
if (e === 4) r += Xt(i.value);
|
|
2319
2317
|
else if (e === 16) r += "[" + Zt(i.value) + "]";
|
|
2320
2318
|
else throw Error(`cri: unexpected host-ip byte length: ${e}`);
|
|
2321
|
-
n < t.length && t[n] instanceof
|
|
2319
|
+
n < t.length && t[n] instanceof V && (r += `%25${K(t[n++].value, En)}`);
|
|
2322
2320
|
} else {
|
|
2323
2321
|
let e = [];
|
|
2324
|
-
for (; n < t.length && t[n] instanceof
|
|
2322
|
+
for (; n < t.length && t[n] instanceof V;) e.push(K(t[n++].value, En));
|
|
2325
2323
|
r += e.join(".");
|
|
2326
2324
|
}
|
|
2327
2325
|
return n < t.length && t[n] instanceof k && (r += ":" + t[n].value.toString()), r;
|
|
2328
2326
|
}
|
|
2329
|
-
function
|
|
2327
|
+
function kn(e) {
|
|
2330
2328
|
let t = e.slice(2), n = t.indexOf("/"), r, i;
|
|
2331
|
-
return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new
|
|
2332
|
-
authority:
|
|
2329
|
+
return n >= 0 ? (r = t.slice(0, n), i = t.slice(n + 1).split("/").map((e) => new V(G(e)))) : (r = t, i = []), {
|
|
2330
|
+
authority: Dn(r),
|
|
2333
2331
|
pathSegments: i
|
|
2334
2332
|
};
|
|
2335
2333
|
}
|
|
2336
|
-
function
|
|
2334
|
+
function An(e) {
|
|
2337
2335
|
let t = e, n = null, r = t.indexOf("#");
|
|
2338
|
-
r >= 0 && (n =
|
|
2336
|
+
r >= 0 && (n = G(t.slice(r + 1)), t = t.slice(0, r));
|
|
2339
2337
|
let i = null, a = t.indexOf("?");
|
|
2340
2338
|
if (a >= 0) {
|
|
2341
2339
|
let e = t.slice(a + 1);
|
|
2342
|
-
t = t.slice(0, a), i = e.split("&").map((e) => new
|
|
2340
|
+
t = t.slice(0, a), i = e.split("&").map((e) => new V(G(e)));
|
|
2343
2341
|
}
|
|
2344
2342
|
let o = [], s = /^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);
|
|
2345
2343
|
if (s) {
|
|
2346
|
-
let e = s[1].toLowerCase(), t = s[2], n =
|
|
2347
|
-
if (o.push(n === void 0 ? new
|
|
2348
|
-
let { authority: e, pathSegments: n } =
|
|
2344
|
+
let e = s[1].toLowerCase(), t = s[2], n = hn.get(e);
|
|
2345
|
+
if (o.push(n === void 0 ? new V(e) : new A(n)), t.startsWith("//")) {
|
|
2346
|
+
let { authority: e, pathSegments: n } = kn(t);
|
|
2349
2347
|
o.push(e, new I(n));
|
|
2350
2348
|
} else if (t.startsWith("/")) {
|
|
2351
|
-
let e = t.slice(1).split("/").map((e) => new
|
|
2349
|
+
let e = t.slice(1).split("/").map((e) => new V(G(e)));
|
|
2352
2350
|
o.push(R.NULL, new I(e));
|
|
2353
2351
|
} else {
|
|
2354
|
-
let e = t.split("/").map((e) => new
|
|
2352
|
+
let e = t.split("/").map((e) => new V(G(e)));
|
|
2355
2353
|
o.push(R.TRUE, new I(e));
|
|
2356
2354
|
}
|
|
2357
2355
|
} else if (t.startsWith("//")) {
|
|
2358
|
-
let { authority: e, pathSegments: n } =
|
|
2356
|
+
let { authority: e, pathSegments: n } = kn(t);
|
|
2359
2357
|
o.push(R.FALSE, e, new I(n));
|
|
2360
2358
|
} else if (t.startsWith("/")) {
|
|
2361
|
-
let e = t.slice(1).split("/").map((e) => new
|
|
2359
|
+
let e = t.slice(1).split("/").map((e) => new V(G(e)));
|
|
2362
2360
|
o.push(R.TRUE, new I(e));
|
|
2363
2361
|
} else if (t === "") o.push(new k(0n));
|
|
2364
2362
|
else {
|
|
2365
2363
|
let n = 1n, r = t, i = !1;
|
|
2366
2364
|
for (r.startsWith("./") && (i = !0, r = r.slice(2)); r.startsWith("../");) n++, r = r.slice(3);
|
|
2367
2365
|
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)}`);
|
|
2368
|
-
let a = r === "" ? [] : r.split("/").map((e) => new
|
|
2366
|
+
let a = r === "" ? [] : r.split("/").map((e) => new V(G(e)));
|
|
2369
2367
|
o.push(new k(n), new I(a));
|
|
2370
2368
|
}
|
|
2371
|
-
if (i !== null && o.push(new I(i)), n !== null && (i === null && o.push(R.NULL), o.push(new
|
|
2369
|
+
if (i !== null && o.push(new I(i)), n !== null && (i === null && o.push(R.NULL), o.push(new V(n))), n !== null && i === null && o.splice(o.length - 2, 1), i === null && n === null) {
|
|
2372
2370
|
let e = o[o.length - 1];
|
|
2373
2371
|
e instanceof I && e.items.length === 0 && o.pop();
|
|
2374
2372
|
}
|
|
2375
2373
|
return o.length === 1 && o[0] instanceof k && o[0].value === 0n ? [] : o;
|
|
2376
2374
|
}
|
|
2377
|
-
function
|
|
2375
|
+
function q(e, t) {
|
|
2378
2376
|
let n = t, r = "";
|
|
2379
2377
|
if (n < e.length) {
|
|
2380
2378
|
let t = e[n];
|
|
2381
2379
|
if (t instanceof I) {
|
|
2382
2380
|
if (n++, t.items.length > 0) {
|
|
2383
2381
|
let e = t.items.map((e) => {
|
|
2384
|
-
if (!(e instanceof
|
|
2385
|
-
return
|
|
2382
|
+
if (!(e instanceof V)) throw Error("cri: query item must be a text string");
|
|
2383
|
+
return K(e.value, Cn);
|
|
2386
2384
|
});
|
|
2387
2385
|
r += "?" + e.join("&");
|
|
2388
2386
|
}
|
|
2389
2387
|
} else t instanceof R && t.value === 22 && n++;
|
|
2390
2388
|
}
|
|
2391
|
-
return n < e.length && e[n] instanceof
|
|
2389
|
+
return n < e.length && e[n] instanceof V && (r += "#" + K(e[n].value, wn)), r;
|
|
2392
2390
|
}
|
|
2393
|
-
function
|
|
2391
|
+
function jn(e) {
|
|
2394
2392
|
return e.items.map((e) => {
|
|
2395
|
-
if (!(e instanceof
|
|
2396
|
-
return
|
|
2393
|
+
if (!(e instanceof V)) throw Error("cri: path segment must be a text string");
|
|
2394
|
+
return K(e.value, Sn);
|
|
2397
2395
|
});
|
|
2398
2396
|
}
|
|
2399
|
-
function
|
|
2397
|
+
function Mn(e) {
|
|
2400
2398
|
if (e.length === 0) return "";
|
|
2401
2399
|
let t = 0, n = e[t++];
|
|
2402
|
-
if (n instanceof A || n instanceof
|
|
2400
|
+
if (n instanceof A || n instanceof V) {
|
|
2403
2401
|
let r;
|
|
2404
2402
|
if (n instanceof A) {
|
|
2405
|
-
let e =
|
|
2403
|
+
let e = gn.get(n.value);
|
|
2406
2404
|
if (e === void 0) throw Error(`cri: unrecognised scheme-id ${n.value}`);
|
|
2407
2405
|
r = e + ":";
|
|
2408
2406
|
} else r = n.value + ":";
|
|
2409
2407
|
if (t >= e.length) return r;
|
|
2410
2408
|
let i = e[t++], a = "", o = !1;
|
|
2411
|
-
if (i instanceof I) a = "//" +
|
|
2409
|
+
if (i instanceof I) a = "//" + On(i), o = !0;
|
|
2412
2410
|
else if (i instanceof R) if (i.value === 22) o = !0;
|
|
2413
2411
|
else if (i.value === 21) o = !1;
|
|
2414
2412
|
else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);
|
|
@@ -2416,95 +2414,109 @@ function Fn(e) {
|
|
|
2416
2414
|
let s = "";
|
|
2417
2415
|
if (t < e.length && e[t] instanceof I) {
|
|
2418
2416
|
let n = e[t++];
|
|
2419
|
-
n.items.length > 0 && (s = (o ? "/" : "") +
|
|
2417
|
+
n.items.length > 0 && (s = (o ? "/" : "") + jn(n).join("/"));
|
|
2420
2418
|
}
|
|
2421
|
-
return r + a + s +
|
|
2419
|
+
return r + a + s + q(e, t);
|
|
2422
2420
|
}
|
|
2423
2421
|
if (n instanceof R && n.value === 20) {
|
|
2424
2422
|
if (t >= e.length || !(e[t] instanceof I)) throw Error("cri: network-path reference requires an authority array");
|
|
2425
|
-
let n =
|
|
2423
|
+
let n = On(e[t++]), r = "";
|
|
2426
2424
|
if (t < e.length && e[t] instanceof I) {
|
|
2427
2425
|
let n = e[t++];
|
|
2428
|
-
n.items.length > 0 && (r = "/" +
|
|
2426
|
+
n.items.length > 0 && (r = "/" + jn(n).join("/"));
|
|
2429
2427
|
}
|
|
2430
|
-
return "//" + n + r +
|
|
2428
|
+
return "//" + n + r + q(e, t);
|
|
2431
2429
|
}
|
|
2432
2430
|
if (n instanceof R && n.value === 21) {
|
|
2433
2431
|
let n = "/";
|
|
2434
2432
|
if (t < e.length && e[t] instanceof I) {
|
|
2435
2433
|
let r = e[t++];
|
|
2436
|
-
n = "/" +
|
|
2434
|
+
n = "/" + jn(r).join("/");
|
|
2437
2435
|
}
|
|
2438
|
-
return n +
|
|
2436
|
+
return n + q(e, t);
|
|
2439
2437
|
}
|
|
2440
2438
|
if (n instanceof k) {
|
|
2441
2439
|
let r = n.value;
|
|
2442
|
-
if (r === 0n) return
|
|
2440
|
+
if (r === 0n) return q(e, t);
|
|
2443
2441
|
let i = r === 1n ? "" : "../".repeat(Number(r) - 1), a;
|
|
2444
2442
|
if (t < e.length && e[t] instanceof I) {
|
|
2445
2443
|
let n = e[t++];
|
|
2446
2444
|
if (n.items.length > 0) {
|
|
2447
|
-
let e =
|
|
2445
|
+
let e = jn(n);
|
|
2448
2446
|
a = (r === 1n && e[0].includes(":") ? "./" : i) + e.join("/");
|
|
2449
2447
|
} else a = i === "" ? "./" : i;
|
|
2450
2448
|
} else a = i === "" ? "./" : i;
|
|
2451
|
-
return a +
|
|
2449
|
+
return a + q(e, t);
|
|
2452
2450
|
}
|
|
2453
2451
|
throw Error("cri: unrecognised first element type in CRI array");
|
|
2454
2452
|
}
|
|
2455
|
-
var
|
|
2453
|
+
var Nn = class extends I {
|
|
2456
2454
|
_toCDN(e, t) {
|
|
2457
2455
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2458
2456
|
try {
|
|
2459
2457
|
let t = x(e, this.encodingWidth, () => b(BigInt(this.items.length)));
|
|
2460
|
-
return `${
|
|
2458
|
+
return `${fn}'${Mn(this.items)}'${t}`;
|
|
2461
2459
|
} catch {
|
|
2462
2460
|
return super._toCDN(e, t);
|
|
2463
2461
|
}
|
|
2464
2462
|
}
|
|
2465
|
-
},
|
|
2463
|
+
}, Pn = class extends M {
|
|
2466
2464
|
constructor(e) {
|
|
2467
|
-
super(
|
|
2465
|
+
super(mn, e);
|
|
2468
2466
|
}
|
|
2469
2467
|
_toCDN(e, t) {
|
|
2470
2468
|
if (e?.appStrings === !1) return super._toCDN(e, t);
|
|
2471
2469
|
try {
|
|
2472
2470
|
let n = this.content;
|
|
2473
2471
|
if (n.encodingWidth !== void 0) return super._toCDN(e, t);
|
|
2474
|
-
let r = x(e, this.encodingWidth, () => b(
|
|
2475
|
-
return `${
|
|
2472
|
+
let r = x(e, this.encodingWidth, () => b(mn));
|
|
2473
|
+
return `${pn}'${Mn(n.items)}'${r}`;
|
|
2476
2474
|
} catch {
|
|
2477
2475
|
return super._toCDN(e, t);
|
|
2478
2476
|
}
|
|
2479
2477
|
}
|
|
2480
2478
|
};
|
|
2481
|
-
function
|
|
2479
|
+
function Fn(e) {
|
|
2482
2480
|
if (e.length !== 1) throw SyntaxError("cri<<...>>: expected exactly one item");
|
|
2483
2481
|
let t = e[0];
|
|
2484
|
-
if (t instanceof
|
|
2485
|
-
if (t instanceof N) return
|
|
2482
|
+
if (t instanceof V) return t.value;
|
|
2483
|
+
if (t instanceof N) return vn.decode(t.value);
|
|
2486
2484
|
throw SyntaxError("cri<<...>>: expected a text string or byte string");
|
|
2487
2485
|
}
|
|
2488
|
-
function
|
|
2489
|
-
let n = new
|
|
2490
|
-
return e ===
|
|
2486
|
+
function In(e, t) {
|
|
2487
|
+
let n = new Nn(An(t));
|
|
2488
|
+
return e === pn ? new Pn(n) : n;
|
|
2491
2489
|
}
|
|
2492
|
-
var
|
|
2493
|
-
appStringPrefixes: [
|
|
2494
|
-
tagNumbers: [
|
|
2490
|
+
var Ln = {
|
|
2491
|
+
appStringPrefixes: [fn, pn],
|
|
2492
|
+
tagNumbers: [mn],
|
|
2495
2493
|
parseAppString(e, t) {
|
|
2496
|
-
return
|
|
2494
|
+
return In(e, t);
|
|
2497
2495
|
},
|
|
2498
2496
|
parseAppSequence(e, t) {
|
|
2499
|
-
return
|
|
2497
|
+
return In(e, Fn(t));
|
|
2500
2498
|
},
|
|
2501
2499
|
parseTag(e, t) {
|
|
2502
2500
|
if (e !== 99n || !(t instanceof I)) return;
|
|
2503
|
-
let n = new
|
|
2501
|
+
let n = new Nn(t.items, {
|
|
2504
2502
|
indefiniteLength: t.indefiniteLength,
|
|
2505
2503
|
encodingWidth: t.encodingWidth
|
|
2506
2504
|
});
|
|
2507
|
-
return n.start = t.start, n.end = t.end, new
|
|
2505
|
+
return n.start = t.start, n.end = t.end, new Pn(n);
|
|
2506
|
+
}
|
|
2507
|
+
}, Rn = 18446744073709551615n, zn = -18446744073709551616n, Bn = {
|
|
2508
|
+
tagNumbers: [Je, Ye],
|
|
2509
|
+
parseTag(e, t) {
|
|
2510
|
+
if (t instanceof N) {
|
|
2511
|
+
if (e === 2n) {
|
|
2512
|
+
let e = $e(t.value);
|
|
2513
|
+
return e > Rn ? new et(e) : void 0;
|
|
2514
|
+
}
|
|
2515
|
+
if (e === 3n) {
|
|
2516
|
+
let e = -1n - $e(t.value);
|
|
2517
|
+
return e < zn ? new tt(e) : void 0;
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2508
2520
|
}
|
|
2509
2521
|
};
|
|
2510
2522
|
//#endregion
|
|
@@ -2528,7 +2540,7 @@ var Un = new TextDecoder("utf-8", {
|
|
|
2528
2540
|
fatal: !1,
|
|
2529
2541
|
ignoreBOM: !0
|
|
2530
2542
|
});
|
|
2531
|
-
function
|
|
2543
|
+
function J(e) {
|
|
2532
2544
|
throw Error(`CBOR decode error: ${e}`);
|
|
2533
2545
|
}
|
|
2534
2546
|
function Gn(e, t, n) {
|
|
@@ -2539,13 +2551,13 @@ function Gn(e, t, n) {
|
|
|
2539
2551
|
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}`);
|
|
2540
2552
|
return r;
|
|
2541
2553
|
}
|
|
2542
|
-
function
|
|
2554
|
+
function Y(e, t) {
|
|
2543
2555
|
e.warnings ??= [], e.warnings.push(t);
|
|
2544
2556
|
}
|
|
2545
|
-
function
|
|
2557
|
+
function Kn(e) {
|
|
2546
2558
|
if (e instanceof k) return ["u", String(e.value)];
|
|
2547
2559
|
if (e instanceof A) return ["n", String(e.value)];
|
|
2548
|
-
if (e instanceof
|
|
2560
|
+
if (e instanceof V) return ["t", e.value];
|
|
2549
2561
|
if (e instanceof F) return ["t", e.chunks.map((e) => e.value).join("")];
|
|
2550
2562
|
if (e instanceof N) return ["b", i(e.value)];
|
|
2551
2563
|
if (e instanceof P) {
|
|
@@ -2555,9 +2567,9 @@ function Y(e) {
|
|
|
2555
2567
|
}
|
|
2556
2568
|
if (e instanceof j) return isNaN(e.value) ? ["f", "NaN"] : Object.is(e.value, -0) ? ["f", "-0"] : ["f", String(e.value)];
|
|
2557
2569
|
if (e instanceof R) return ["s", e.value];
|
|
2558
|
-
if (e instanceof I) return ["A", e.items.map(
|
|
2570
|
+
if (e instanceof I) return ["A", e.items.map(Kn)];
|
|
2559
2571
|
if (e instanceof L) {
|
|
2560
|
-
let t = e.entries.map(([e, t]) => [
|
|
2572
|
+
let t = e.entries.map(([e, t]) => [Kn(e), Kn(t)]);
|
|
2561
2573
|
if (t.length <= 1) return ["M", t];
|
|
2562
2574
|
let n = t.map((e) => [JSON.stringify(e[0]), e]);
|
|
2563
2575
|
return n.sort((e, t) => e[0] < t[0] ? -1 : +(e[0] > t[0])), ["M", n.map((e) => e[1])];
|
|
@@ -2565,13 +2577,13 @@ function Y(e) {
|
|
|
2565
2577
|
return e instanceof M ? [
|
|
2566
2578
|
"G",
|
|
2567
2579
|
String(e.tag),
|
|
2568
|
-
|
|
2580
|
+
Kn(e.content)
|
|
2569
2581
|
] : ["c", i(e.toCBOR())];
|
|
2570
2582
|
}
|
|
2571
|
-
function
|
|
2583
|
+
function qn(e) {
|
|
2572
2584
|
if (e instanceof k) return "u" + e.value;
|
|
2573
2585
|
if (e instanceof A) return "n" + e.value;
|
|
2574
|
-
if (e instanceof
|
|
2586
|
+
if (e instanceof V) return "t" + e.value;
|
|
2575
2587
|
if (e instanceof F) {
|
|
2576
2588
|
let t = "t";
|
|
2577
2589
|
for (let n of e.chunks) t += n.value;
|
|
@@ -2583,109 +2595,109 @@ function Kn(e) {
|
|
|
2583
2595
|
for (let n of e.chunks) t += i(n.value);
|
|
2584
2596
|
return t;
|
|
2585
2597
|
}
|
|
2586
|
-
return e instanceof j ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof R ? "s" + e.value : JSON.stringify(
|
|
2598
|
+
return e instanceof j ? isNaN(e.value) ? "fNaN" : Object.is(e.value, -0) ? "f-0" : "f" + e.value : e instanceof R ? "s" + e.value : JSON.stringify(Kn(e));
|
|
2587
2599
|
}
|
|
2588
|
-
var
|
|
2589
|
-
function
|
|
2590
|
-
return
|
|
2600
|
+
var Jn = Array.from({ length: 24 }, (e, t) => BigInt(t)), Yn;
|
|
2601
|
+
function Xn(e) {
|
|
2602
|
+
return e === void 0 ? Yn ??= Z(void 0).filter((e) => e.parseTag !== void 0) : Z(e).filter((e) => e.parseTag !== void 0);
|
|
2591
2603
|
}
|
|
2592
|
-
function
|
|
2604
|
+
function Zn(e, t) {
|
|
2593
2605
|
for (let n = 0; n < t; n++) if (e[n] >= 128) return;
|
|
2594
2606
|
return String.fromCharCode.apply(null, e);
|
|
2595
2607
|
}
|
|
2596
|
-
function
|
|
2608
|
+
function Qn(e, t, n) {
|
|
2597
2609
|
if (n <= 23) return {
|
|
2598
|
-
value:
|
|
2610
|
+
value: Jn[n],
|
|
2599
2611
|
nextOffset: t
|
|
2600
2612
|
};
|
|
2601
2613
|
switch (n) {
|
|
2602
|
-
case 24: return t + 1 > e.byteLength &&
|
|
2614
|
+
case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
|
|
2603
2615
|
value: BigInt(e.getUint8(t)),
|
|
2604
2616
|
nextOffset: t + 1
|
|
2605
2617
|
};
|
|
2606
|
-
case 25: return t + 2 > e.byteLength &&
|
|
2618
|
+
case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
|
|
2607
2619
|
value: BigInt(e.getUint16(t, !1)),
|
|
2608
2620
|
nextOffset: t + 2
|
|
2609
2621
|
};
|
|
2610
|
-
case 26: return t + 4 > e.byteLength &&
|
|
2622
|
+
case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
|
|
2611
2623
|
value: BigInt(e.getUint32(t, !1)),
|
|
2612
2624
|
nextOffset: t + 4
|
|
2613
2625
|
};
|
|
2614
|
-
case 27: return t + 8 > e.byteLength &&
|
|
2626
|
+
case 27: return t + 8 > e.byteLength && J("unexpected end of input"), {
|
|
2615
2627
|
value: e.getBigUint64(t, !1),
|
|
2616
2628
|
nextOffset: t + 8
|
|
2617
2629
|
};
|
|
2618
|
-
default:
|
|
2630
|
+
default: J(`reserved additional info value: ${n}`);
|
|
2619
2631
|
}
|
|
2620
2632
|
}
|
|
2621
|
-
function
|
|
2633
|
+
function $n(e, t, n) {
|
|
2622
2634
|
if (n <= 23) return {
|
|
2623
2635
|
value: n,
|
|
2624
2636
|
nextOffset: t
|
|
2625
2637
|
};
|
|
2626
2638
|
switch (n) {
|
|
2627
|
-
case 24: return t + 1 > e.byteLength &&
|
|
2639
|
+
case 24: return t + 1 > e.byteLength && J("unexpected end of input"), {
|
|
2628
2640
|
value: e.getUint8(t),
|
|
2629
2641
|
nextOffset: t + 1
|
|
2630
2642
|
};
|
|
2631
|
-
case 25: return t + 2 > e.byteLength &&
|
|
2643
|
+
case 25: return t + 2 > e.byteLength && J("unexpected end of input"), {
|
|
2632
2644
|
value: e.getUint16(t, !1),
|
|
2633
2645
|
nextOffset: t + 2
|
|
2634
2646
|
};
|
|
2635
|
-
case 26: return t + 4 > e.byteLength &&
|
|
2647
|
+
case 26: return t + 4 > e.byteLength && J("unexpected end of input"), {
|
|
2636
2648
|
value: e.getUint32(t, !1),
|
|
2637
2649
|
nextOffset: t + 4
|
|
2638
2650
|
};
|
|
2639
2651
|
case 27: {
|
|
2640
|
-
t + 8 > e.byteLength &&
|
|
2652
|
+
t + 8 > e.byteLength && J("unexpected end of input");
|
|
2641
2653
|
let n = e.getUint32(t, !1), r = e.getUint32(t + 4, !1);
|
|
2642
2654
|
return {
|
|
2643
2655
|
value: n * 4294967296 + r,
|
|
2644
2656
|
nextOffset: t + 8
|
|
2645
2657
|
};
|
|
2646
2658
|
}
|
|
2647
|
-
default:
|
|
2659
|
+
default: J(`reserved additional info value: ${n}`);
|
|
2648
2660
|
}
|
|
2649
2661
|
}
|
|
2650
|
-
function
|
|
2662
|
+
function er(e, t, n, r, i, a) {
|
|
2651
2663
|
let o = [], s = t;
|
|
2652
2664
|
for (;;) {
|
|
2653
|
-
if (s >= e.byteLength &&
|
|
2665
|
+
if (s >= e.byteLength && J(`unexpected end of indefinite ${i}`), e.getUint8(s) === 255) {
|
|
2654
2666
|
s++;
|
|
2655
2667
|
break;
|
|
2656
2668
|
}
|
|
2657
2669
|
let t = X(e, s, n, r);
|
|
2658
|
-
a(t.value) ||
|
|
2670
|
+
a(t.value) || J(`indefinite-length ${i} chunk must be a definite ${i}`), o.push(t.value), s = t.nextOffset;
|
|
2659
2671
|
}
|
|
2660
2672
|
return {
|
|
2661
2673
|
chunks: o,
|
|
2662
2674
|
nextOffset: s
|
|
2663
2675
|
};
|
|
2664
2676
|
}
|
|
2665
|
-
function
|
|
2666
|
-
let i =
|
|
2677
|
+
function tr(e, t, n, r) {
|
|
2678
|
+
let i = qn(e);
|
|
2667
2679
|
t.has(i) && n.push(Gn(`duplicate map key at offset ${e.start}`, e.start, r)), t.add(i);
|
|
2668
2680
|
}
|
|
2669
2681
|
function X(e, t, n, r) {
|
|
2670
|
-
let i = t, a =
|
|
2682
|
+
let i = t, a = rr(e, t, n, r);
|
|
2671
2683
|
return a.value.start = i, a.value.end = a.nextOffset, a;
|
|
2672
2684
|
}
|
|
2673
|
-
function
|
|
2685
|
+
function nr(e, t, n) {
|
|
2674
2686
|
return new Uint8Array(e.buffer, e.byteOffset + t, n).slice();
|
|
2675
2687
|
}
|
|
2676
|
-
function
|
|
2677
|
-
t >= e.byteLength &&
|
|
2688
|
+
function rr(e, t, n, r) {
|
|
2689
|
+
t >= e.byteLength && J("unexpected end of input");
|
|
2678
2690
|
let i = e.getUint8(t++), a = i >> 5, o = i & 31;
|
|
2679
2691
|
switch (a) {
|
|
2680
2692
|
case 0: {
|
|
2681
|
-
let { value: n, nextOffset: r } =
|
|
2693
|
+
let { value: n, nextOffset: r } = Qn(e, t, o);
|
|
2682
2694
|
return {
|
|
2683
2695
|
value: new k(n, { encodingWidth: Vn(o, n) }),
|
|
2684
2696
|
nextOffset: r
|
|
2685
2697
|
};
|
|
2686
2698
|
}
|
|
2687
2699
|
case 1: {
|
|
2688
|
-
let { value: n, nextOffset: r } =
|
|
2700
|
+
let { value: n, nextOffset: r } = Qn(e, t, o), i = Vn(o, n);
|
|
2689
2701
|
return {
|
|
2690
2702
|
value: new A(-1n - n, { encodingWidth: i }),
|
|
2691
2703
|
nextOffset: r
|
|
@@ -2693,37 +2705,37 @@ function nr(e, t, n, r) {
|
|
|
2693
2705
|
}
|
|
2694
2706
|
case 2: {
|
|
2695
2707
|
if (o === 31) {
|
|
2696
|
-
let { chunks: i, nextOffset: a } =
|
|
2708
|
+
let { chunks: i, nextOffset: a } = er(e, t, n, r, "byte string", (e) => e instanceof N);
|
|
2697
2709
|
return {
|
|
2698
2710
|
value: new P(i),
|
|
2699
2711
|
nextOffset: a
|
|
2700
2712
|
};
|
|
2701
2713
|
}
|
|
2702
|
-
let { value: i, nextOffset: a } =
|
|
2703
|
-
return a + i > e.byteLength &&
|
|
2714
|
+
let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i);
|
|
2715
|
+
return a + i > e.byteLength && J("byte string extends beyond input"), {
|
|
2704
2716
|
value: new N(new Uint8Array(e.buffer, e.byteOffset + a, i).slice(), { encodingWidth: s }),
|
|
2705
2717
|
nextOffset: a + i
|
|
2706
2718
|
};
|
|
2707
2719
|
}
|
|
2708
2720
|
case 3: {
|
|
2709
2721
|
if (o === 31) {
|
|
2710
|
-
let { chunks: i, nextOffset: a } =
|
|
2722
|
+
let { chunks: i, nextOffset: a } = er(e, t, n, r, "text string", (e) => e instanceof V);
|
|
2711
2723
|
return {
|
|
2712
2724
|
value: new F(i),
|
|
2713
2725
|
nextOffset: a
|
|
2714
2726
|
};
|
|
2715
2727
|
}
|
|
2716
|
-
let { value: i, nextOffset: a } =
|
|
2717
|
-
a + i > e.byteLength &&
|
|
2718
|
-
let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ?
|
|
2728
|
+
let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i);
|
|
2729
|
+
a + i > e.byteLength && J("text string extends beyond input");
|
|
2730
|
+
let c = new Uint8Array(e.buffer, e.byteOffset + a, i), l, u, d = i < 64 ? Zn(c, i) : void 0;
|
|
2719
2731
|
if (d !== void 0) l = d;
|
|
2720
2732
|
else try {
|
|
2721
2733
|
l = Un.decode(c);
|
|
2722
2734
|
} catch {
|
|
2723
2735
|
u = Gn("invalid UTF-8 sequence in text string", a, n), l = Wn.decode(c);
|
|
2724
2736
|
}
|
|
2725
|
-
let f = new
|
|
2726
|
-
return u &&
|
|
2737
|
+
let f = new V(l, { encodingWidth: s });
|
|
2738
|
+
return u && Y(f, u), {
|
|
2727
2739
|
value: f,
|
|
2728
2740
|
nextOffset: a + i
|
|
2729
2741
|
};
|
|
@@ -2732,7 +2744,7 @@ function nr(e, t, n, r) {
|
|
|
2732
2744
|
if (o === 31) {
|
|
2733
2745
|
let i = [], a = t;
|
|
2734
2746
|
for (;;) {
|
|
2735
|
-
if (a >= e.byteLength &&
|
|
2747
|
+
if (a >= e.byteLength && J("unexpected end of indefinite array"), e.getUint8(a) === 255) {
|
|
2736
2748
|
a++;
|
|
2737
2749
|
break;
|
|
2738
2750
|
}
|
|
@@ -2744,7 +2756,7 @@ function nr(e, t, n, r) {
|
|
|
2744
2756
|
nextOffset: a
|
|
2745
2757
|
};
|
|
2746
2758
|
}
|
|
2747
|
-
let { value: i, nextOffset: a } =
|
|
2759
|
+
let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i), c = [], l = a;
|
|
2748
2760
|
for (let t = 0; t < i; t++) {
|
|
2749
2761
|
let t = X(e, l, n, r);
|
|
2750
2762
|
c.push(t.value), l = t.nextOffset;
|
|
@@ -2758,39 +2770,39 @@ function nr(e, t, n, r) {
|
|
|
2758
2770
|
if (o === 31) {
|
|
2759
2771
|
let i = [], a = /* @__PURE__ */ new Set(), o = [], s = t;
|
|
2760
2772
|
for (;;) {
|
|
2761
|
-
if (s >= e.byteLength &&
|
|
2773
|
+
if (s >= e.byteLength && J("unexpected end of indefinite map"), e.getUint8(s) === 255) {
|
|
2762
2774
|
s++;
|
|
2763
2775
|
break;
|
|
2764
2776
|
}
|
|
2765
2777
|
let t = X(e, s, n, r);
|
|
2766
|
-
|
|
2778
|
+
tr(t.value, a, o, n), s = t.nextOffset;
|
|
2767
2779
|
let c = X(e, s, n, r);
|
|
2768
2780
|
s = c.nextOffset, i.push([t.value, c.value]);
|
|
2769
2781
|
}
|
|
2770
2782
|
let c = new L(i, { indefiniteLength: !0 });
|
|
2771
|
-
for (let e of o)
|
|
2783
|
+
for (let e of o) Y(c, e);
|
|
2772
2784
|
return {
|
|
2773
2785
|
value: c,
|
|
2774
2786
|
nextOffset: s
|
|
2775
2787
|
};
|
|
2776
2788
|
}
|
|
2777
|
-
let { value: i, nextOffset: a } =
|
|
2789
|
+
let { value: i, nextOffset: a } = $n(e, t, o), s = Hn(o, i), c = [], l = /* @__PURE__ */ new Set(), u = [], d = a;
|
|
2778
2790
|
for (let t = 0; t < i; t++) {
|
|
2779
2791
|
let t = X(e, d, n, r);
|
|
2780
|
-
|
|
2792
|
+
tr(t.value, l, u, n), d = t.nextOffset;
|
|
2781
2793
|
let i = X(e, d, n, r);
|
|
2782
2794
|
d = i.nextOffset, c.push([t.value, i.value]);
|
|
2783
2795
|
}
|
|
2784
2796
|
let f = new L(c, { encodingWidth: s });
|
|
2785
|
-
for (let e of u)
|
|
2797
|
+
for (let e of u) Y(f, e);
|
|
2786
2798
|
return {
|
|
2787
2799
|
value: f,
|
|
2788
2800
|
nextOffset: d
|
|
2789
2801
|
};
|
|
2790
2802
|
}
|
|
2791
2803
|
case 6: {
|
|
2792
|
-
o === 31 &&
|
|
2793
|
-
let { value: i, nextOffset: a } =
|
|
2804
|
+
o === 31 && J("tags cannot use indefinite-length encoding");
|
|
2805
|
+
let { value: i, nextOffset: a } = Qn(e, t, o), s = Vn(o, i), c = X(e, a, n, r);
|
|
2794
2806
|
for (let e of r) {
|
|
2795
2807
|
let t = e.parseTag(i, c.value, n);
|
|
2796
2808
|
if (t !== void 0) return t instanceof M && s !== void 0 && (t.encodingWidth = s), {
|
|
@@ -2825,11 +2837,11 @@ function nr(e, t, n, r) {
|
|
|
2825
2837
|
nextOffset: t
|
|
2826
2838
|
};
|
|
2827
2839
|
if (o === 24) {
|
|
2828
|
-
t + 1 > e.byteLength &&
|
|
2840
|
+
t + 1 > e.byteLength && J("unexpected end of input");
|
|
2829
2841
|
let r = e.getUint8(t);
|
|
2830
2842
|
if (r < 32) {
|
|
2831
2843
|
let e = Gn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`, t - 1, n), i = new R(r);
|
|
2832
|
-
return
|
|
2844
|
+
return Y(i, e), {
|
|
2833
2845
|
value: i,
|
|
2834
2846
|
nextOffset: t + 1
|
|
2835
2847
|
};
|
|
@@ -2840,100 +2852,101 @@ function nr(e, t, n, r) {
|
|
|
2840
2852
|
};
|
|
2841
2853
|
}
|
|
2842
2854
|
if (o === 25) {
|
|
2843
|
-
t + 2 > e.byteLength &&
|
|
2855
|
+
t + 2 > e.byteLength && J("unexpected end of input");
|
|
2844
2856
|
let n = C(e.getUint16(t, !1));
|
|
2845
2857
|
return {
|
|
2846
2858
|
value: new j(n, {
|
|
2847
2859
|
precision: "half",
|
|
2848
|
-
rawBits: Number.isNaN(n) ?
|
|
2860
|
+
rawBits: Number.isNaN(n) ? nr(e, t, 2) : void 0
|
|
2849
2861
|
}),
|
|
2850
2862
|
nextOffset: t + 2
|
|
2851
2863
|
};
|
|
2852
2864
|
}
|
|
2853
2865
|
if (o === 26) {
|
|
2854
|
-
t + 4 > e.byteLength &&
|
|
2866
|
+
t + 4 > e.byteLength && J("unexpected end of input");
|
|
2855
2867
|
let n = e.getFloat32(t, !1);
|
|
2856
2868
|
return {
|
|
2857
2869
|
value: new j(n, {
|
|
2858
2870
|
precision: "single",
|
|
2859
|
-
rawBits: Number.isNaN(n) ?
|
|
2871
|
+
rawBits: Number.isNaN(n) ? nr(e, t, 4) : void 0
|
|
2860
2872
|
}),
|
|
2861
2873
|
nextOffset: t + 4
|
|
2862
2874
|
};
|
|
2863
2875
|
}
|
|
2864
2876
|
if (o === 27) {
|
|
2865
|
-
t + 8 > e.byteLength &&
|
|
2877
|
+
t + 8 > e.byteLength && J("unexpected end of input");
|
|
2866
2878
|
let n = e.getFloat64(t, !1);
|
|
2867
2879
|
return {
|
|
2868
2880
|
value: new j(n, {
|
|
2869
2881
|
precision: "double",
|
|
2870
|
-
rawBits: Number.isNaN(n) ?
|
|
2882
|
+
rawBits: Number.isNaN(n) ? nr(e, t, 8) : void 0
|
|
2871
2883
|
}),
|
|
2872
2884
|
nextOffset: t + 8
|
|
2873
2885
|
};
|
|
2874
2886
|
}
|
|
2875
|
-
return o < 31 &&
|
|
2887
|
+
return o < 31 && J(`reserved additional info value in major type 7: ${o}`), J("unexpected break code outside indefinite-length item");
|
|
2876
2888
|
}
|
|
2877
|
-
return
|
|
2889
|
+
return J(`unknown major type: ${a}`);
|
|
2878
2890
|
}
|
|
2879
|
-
function
|
|
2891
|
+
function ir(e) {
|
|
2880
2892
|
if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new Uint8Array(e);
|
|
2881
2893
|
if (ArrayBuffer.isView(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
2882
2894
|
throw TypeError("expected ArrayBufferView or ArrayBufferLike");
|
|
2883
2895
|
}
|
|
2884
|
-
function
|
|
2885
|
-
let n =
|
|
2896
|
+
function ar(e, t) {
|
|
2897
|
+
let n = ir(e), r = new DataView(n.buffer, n.byteOffset, n.byteLength), i = t?.offset ?? 0;
|
|
2886
2898
|
if (!Number.isInteger(i) || i < 0 || i > r.byteLength) throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);
|
|
2887
|
-
let a = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...
|
|
2888
|
-
if (!t?.allowTrailing &&
|
|
2889
|
-
|
|
2899
|
+
let a = Xn(t?.builtinExtensions), o = t?.extensions?.length ? [...t.extensions.filter((e) => e.parseTag !== void 0), ...a] : a, { value: s, nextOffset: c } = X(r, i, t, o);
|
|
2900
|
+
if (!t?.allowTrailing && c !== r.byteLength) {
|
|
2901
|
+
Y(s, Gn(`${r.byteLength - c} trailing byte(s) after end of CBOR item`, c, t));
|
|
2890
2902
|
let e = {
|
|
2891
2903
|
strict: !1,
|
|
2892
2904
|
silent: !0
|
|
2893
|
-
}, n =
|
|
2894
|
-
for (; n < r.byteLength;) ({nextOffset: n} = X(r, n, e,
|
|
2905
|
+
}, n = c;
|
|
2906
|
+
for (; n < r.byteLength;) ({nextOffset: n} = X(r, n, e, o));
|
|
2895
2907
|
}
|
|
2896
|
-
return
|
|
2908
|
+
return s;
|
|
2897
2909
|
}
|
|
2898
2910
|
//#endregion
|
|
2899
2911
|
//#region src/extensions/cbordata.ts
|
|
2900
|
-
var
|
|
2901
|
-
tagNumbers: [
|
|
2912
|
+
var or = 24n, sr = {
|
|
2913
|
+
tagNumbers: [or],
|
|
2902
2914
|
parseTag(e, t, n) {
|
|
2903
2915
|
if (e !== 24n || !(t instanceof N)) return;
|
|
2904
2916
|
let r = n ? {
|
|
2905
2917
|
extensions: n.extensions,
|
|
2918
|
+
builtinExtensions: n.builtinExtensions,
|
|
2906
2919
|
strict: n.strict,
|
|
2907
2920
|
onWarning: n.onWarning,
|
|
2908
2921
|
silent: n.silent
|
|
2909
2922
|
} : void 0;
|
|
2910
2923
|
try {
|
|
2911
|
-
return new M(
|
|
2924
|
+
return new M(or, new Ue([ar(t.value, r)], { encodingWidth: t.encodingWidth }));
|
|
2912
2925
|
} catch (e) {
|
|
2913
2926
|
if (r?.strict !== !1) throw e;
|
|
2914
2927
|
return;
|
|
2915
2928
|
}
|
|
2916
2929
|
}
|
|
2917
|
-
},
|
|
2918
|
-
function
|
|
2930
|
+
}, cr = new TextEncoder(), lr = new TextDecoder("utf-8", { fatal: !0 }), ur = new TextDecoder("utf-8", { fatal: !1 }), dr = Symbol("ellipsis");
|
|
2931
|
+
function fr(e) {
|
|
2919
2932
|
let t = 0;
|
|
2920
2933
|
for (let n of e) t += n.length;
|
|
2921
2934
|
let n = new Uint8Array(t), r = 0;
|
|
2922
2935
|
for (let t of e) n.set(t, r), r += t.length;
|
|
2923
2936
|
return n;
|
|
2924
2937
|
}
|
|
2925
|
-
function
|
|
2938
|
+
function pr(e, t, n) {
|
|
2926
2939
|
if (t instanceof Ke) {
|
|
2927
|
-
|
|
2940
|
+
pr(e, t.inner, n);
|
|
2928
2941
|
return;
|
|
2929
2942
|
}
|
|
2930
2943
|
if (t instanceof z) {
|
|
2931
|
-
if (t.content instanceof I) for (let r of t.content.items)
|
|
2932
|
-
else n.push(
|
|
2944
|
+
if (t.content instanceof I) for (let r of t.content.items) pr(e, r, n);
|
|
2945
|
+
else n.push(dr);
|
|
2933
2946
|
return;
|
|
2934
2947
|
}
|
|
2935
|
-
if (t instanceof
|
|
2936
|
-
n.push(
|
|
2948
|
+
if (t instanceof V) {
|
|
2949
|
+
n.push(cr.encode(t.value));
|
|
2937
2950
|
return;
|
|
2938
2951
|
}
|
|
2939
2952
|
if (t instanceof N) {
|
|
@@ -2941,105 +2954,105 @@ function fr(e, t, n) {
|
|
|
2941
2954
|
return;
|
|
2942
2955
|
}
|
|
2943
2956
|
if (t instanceof F) {
|
|
2944
|
-
n.push(
|
|
2957
|
+
n.push(cr.encode(t.chunks.map((e) => e.value).join("")));
|
|
2945
2958
|
return;
|
|
2946
2959
|
}
|
|
2947
2960
|
if (t instanceof P) {
|
|
2948
|
-
n.push(
|
|
2961
|
+
n.push(fr(t.chunks.map((e) => e.value)));
|
|
2949
2962
|
return;
|
|
2950
2963
|
}
|
|
2951
2964
|
throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings or ellipses`);
|
|
2952
2965
|
}
|
|
2953
|
-
function
|
|
2966
|
+
function mr(e, t) {
|
|
2954
2967
|
try {
|
|
2955
|
-
return
|
|
2968
|
+
return lr.decode(e);
|
|
2956
2969
|
} catch {
|
|
2957
2970
|
let n = "t1 concatenation result is not valid UTF-8";
|
|
2958
2971
|
if (t) t(n);
|
|
2959
2972
|
else throw SyntaxError(n);
|
|
2960
|
-
return
|
|
2973
|
+
return ur.decode(e);
|
|
2961
2974
|
}
|
|
2962
2975
|
}
|
|
2963
|
-
function
|
|
2976
|
+
function hr(e, t, n) {
|
|
2964
2977
|
let r = [];
|
|
2965
|
-
for (let n of t)
|
|
2978
|
+
for (let n of t) pr(e, n, r);
|
|
2966
2979
|
let i = e === "t1", a = [], o = !1, s = [], c = () => {
|
|
2967
2980
|
if (s.length === 0) return;
|
|
2968
|
-
let e =
|
|
2969
|
-
s.length = 0, e.length !== 0 && a.push(i ? new
|
|
2981
|
+
let e = fr(s);
|
|
2982
|
+
s.length = 0, e.length !== 0 && a.push(i ? new V(mr(e, n)) : new N(e));
|
|
2970
2983
|
};
|
|
2971
|
-
for (let e of r) e ===
|
|
2984
|
+
for (let e of r) e === dr ? (c(), a[a.length - 1] instanceof z || (a.push(new z()), o = !0)) : s.push(e);
|
|
2972
2985
|
if (!o) {
|
|
2973
|
-
let e =
|
|
2974
|
-
return i ? new
|
|
2986
|
+
let e = fr(s);
|
|
2987
|
+
return i ? new V(mr(e, n)) : new N(e);
|
|
2975
2988
|
}
|
|
2976
2989
|
return c(), a.length === 1 ? new z() : new z(a);
|
|
2977
2990
|
}
|
|
2978
|
-
function
|
|
2991
|
+
function gr(e) {
|
|
2979
2992
|
return {
|
|
2980
2993
|
appStringPrefixes: [e],
|
|
2981
2994
|
preserveAppSeqSource: !0,
|
|
2982
2995
|
parseAppString(t, n, r) {
|
|
2983
|
-
return
|
|
2996
|
+
return hr(e, [new V(n)], r);
|
|
2984
2997
|
},
|
|
2985
2998
|
parseAppSequence(t, n, r) {
|
|
2986
|
-
return
|
|
2999
|
+
return hr(e, n, r);
|
|
2987
3000
|
}
|
|
2988
3001
|
};
|
|
2989
3002
|
}
|
|
2990
|
-
var
|
|
2991
|
-
function
|
|
3003
|
+
var _r = gr("t1"), vr = gr("b1"), yr = new TextEncoder(), br = new TextDecoder("utf-8", { fatal: !0 }), xr = new TextDecoder("utf-8", { fatal: !1 });
|
|
3004
|
+
function Sr(e) {
|
|
2992
3005
|
let t = 0;
|
|
2993
3006
|
for (let n of e) t += n.length;
|
|
2994
3007
|
let n = new Uint8Array(t), r = 0;
|
|
2995
3008
|
for (let t of e) n.set(t, r), r += t.length;
|
|
2996
3009
|
return n;
|
|
2997
3010
|
}
|
|
2998
|
-
function
|
|
3011
|
+
function Cr(e, t, n) {
|
|
2999
3012
|
let r = e === "ilts", i = [], a = [];
|
|
3000
3013
|
for (let o of t) {
|
|
3001
3014
|
if (o instanceof Ke && (o = o.inner), o instanceof z) throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);
|
|
3002
3015
|
let t, s, c;
|
|
3003
|
-
if (o instanceof
|
|
3016
|
+
if (o instanceof V) t = o.value, c = o.encodingWidth;
|
|
3004
3017
|
else if (o instanceof N) s = o.value, c = o.encodingWidth;
|
|
3005
3018
|
else if (o instanceof F) t = o.chunks.map((e) => e.value).join("");
|
|
3006
|
-
else if (o instanceof P) s =
|
|
3019
|
+
else if (o instanceof P) s = Sr(o.chunks.map((e) => e.value));
|
|
3007
3020
|
else throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings`);
|
|
3008
3021
|
if (r) {
|
|
3009
3022
|
let e;
|
|
3010
3023
|
if (t !== void 0) e = t;
|
|
3011
3024
|
else try {
|
|
3012
|
-
e =
|
|
3025
|
+
e = br.decode(s);
|
|
3013
3026
|
} catch {
|
|
3014
3027
|
let t = "ilts chunk is not valid UTF-8";
|
|
3015
3028
|
if (n) n(t);
|
|
3016
3029
|
else throw SyntaxError(t);
|
|
3017
|
-
e =
|
|
3030
|
+
e = xr.decode(s);
|
|
3018
3031
|
}
|
|
3019
|
-
a.push(new
|
|
3032
|
+
a.push(new V(e, c === void 0 ? void 0 : { encodingWidth: c }));
|
|
3020
3033
|
} else {
|
|
3021
|
-
let e = s ??
|
|
3034
|
+
let e = s ?? yr.encode(t);
|
|
3022
3035
|
i.push(new N(e, c === void 0 ? void 0 : { encodingWidth: c }));
|
|
3023
3036
|
}
|
|
3024
3037
|
}
|
|
3025
3038
|
return r ? new F(a) : new P(i);
|
|
3026
3039
|
}
|
|
3027
|
-
function
|
|
3040
|
+
function wr(e) {
|
|
3028
3041
|
return {
|
|
3029
3042
|
appStringPrefixes: [e],
|
|
3030
3043
|
preserveAppSeqSource: !0,
|
|
3031
3044
|
parseAppString(t, n, r) {
|
|
3032
|
-
return new Ke(
|
|
3045
|
+
return new Ke(Cr(e, [new V(n)], r), `${e}${xe(n)}`);
|
|
3033
3046
|
},
|
|
3034
3047
|
parseAppSequence(t, n, r) {
|
|
3035
|
-
return
|
|
3048
|
+
return Cr(e, n, r);
|
|
3036
3049
|
}
|
|
3037
3050
|
};
|
|
3038
3051
|
}
|
|
3039
|
-
var
|
|
3052
|
+
var Tr = wr("ilbs"), Er = wr("ilts");
|
|
3040
3053
|
//#endregion
|
|
3041
3054
|
//#region src/utils/strip-comments.ts
|
|
3042
|
-
function
|
|
3055
|
+
function Dr(e) {
|
|
3043
3056
|
let t = "", n = 0;
|
|
3044
3057
|
for (; n < e.length;) {
|
|
3045
3058
|
let r = e[n];
|
|
@@ -3074,7 +3087,7 @@ function Er(e) {
|
|
|
3074
3087
|
}
|
|
3075
3088
|
//#endregion
|
|
3076
3089
|
//#region src/extensions/float.ts
|
|
3077
|
-
var
|
|
3090
|
+
var Or = class extends j {
|
|
3078
3091
|
_bits;
|
|
3079
3092
|
constructor(e) {
|
|
3080
3093
|
super(C(e), { precision: "half" }), this._bits = e & 65535;
|
|
@@ -3086,7 +3099,7 @@ var Dr = class extends j {
|
|
|
3086
3099
|
this._bits & 255
|
|
3087
3100
|
]);
|
|
3088
3101
|
}
|
|
3089
|
-
},
|
|
3102
|
+
}, kr = class extends j {
|
|
3090
3103
|
_raw;
|
|
3091
3104
|
constructor(e) {
|
|
3092
3105
|
super(new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), { precision: "single" }), this._raw = e.slice();
|
|
@@ -3095,7 +3108,7 @@ var Dr = class extends j {
|
|
|
3095
3108
|
let e = /* @__PURE__ */ new Uint8Array(5);
|
|
3096
3109
|
return e[0] = 250, e.set(this._raw, 1), e;
|
|
3097
3110
|
}
|
|
3098
|
-
},
|
|
3111
|
+
}, Ar = class extends j {
|
|
3099
3112
|
_raw;
|
|
3100
3113
|
constructor(e) {
|
|
3101
3114
|
super(new DataView(e.buffer, e.byteOffset).getFloat64(0, !1), { precision: "double" }), this._raw = e.slice();
|
|
@@ -3105,13 +3118,13 @@ var Dr = class extends j {
|
|
|
3105
3118
|
return e[0] = 251, e.set(this._raw, 1), e;
|
|
3106
3119
|
}
|
|
3107
3120
|
};
|
|
3108
|
-
function
|
|
3109
|
-
if (e.length === 2) return new
|
|
3110
|
-
if (e.length === 4) return new
|
|
3111
|
-
if (e.length === 8) return new
|
|
3121
|
+
function jr(e) {
|
|
3122
|
+
if (e.length === 2) return new Or(e[0] << 8 | e[1]);
|
|
3123
|
+
if (e.length === 4) return new kr(e);
|
|
3124
|
+
if (e.length === 8) return new Ar(e);
|
|
3112
3125
|
throw SyntaxError(`float'...' requires 4, 8, or 16 hex digits (2, 4, or 8 bytes); got ${e.length} bytes`);
|
|
3113
3126
|
}
|
|
3114
|
-
function
|
|
3127
|
+
function Mr(e) {
|
|
3115
3128
|
let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i;
|
|
3116
3129
|
if (n === 31) i = t << 31 | 2139095040 | r << 13;
|
|
3117
3130
|
else if (n === 0 && r === 0) i = t << 31;
|
|
@@ -3123,7 +3136,7 @@ function Ar(e) {
|
|
|
3123
3136
|
let a = /* @__PURE__ */ new Uint8Array(4);
|
|
3124
3137
|
return new DataView(a.buffer).setUint32(0, i >>> 0, !1), a;
|
|
3125
3138
|
}
|
|
3126
|
-
function
|
|
3139
|
+
function Nr(e) {
|
|
3127
3140
|
let t = e >>> 15 & 1, n = e >>> 10 & 31, r = e & 1023, i = /* @__PURE__ */ new Uint8Array(8), a = new DataView(i.buffer);
|
|
3128
3141
|
if (n === 31) a.setUint32(0, (t << 31 | 2146435072 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
|
|
3129
3142
|
else if (n === 0 && r === 0) a.setUint32(0, t << 31 >>> 0, !1), a.setUint32(4, 0, !1);
|
|
@@ -3134,7 +3147,7 @@ function jr(e) {
|
|
|
3134
3147
|
} else a.setUint32(0, (t << 31 | n + 1008 << 20 | r << 10) >>> 0, !1), a.setUint32(4, 0, !1);
|
|
3135
3148
|
return i;
|
|
3136
3149
|
}
|
|
3137
|
-
function
|
|
3150
|
+
function Pr(e) {
|
|
3138
3151
|
let t = new DataView(e.buffer, e.byteOffset).getUint32(0, !1), n = t >>> 31 & 1, r = t >>> 23 & 255, i = t & 8388607, a = /* @__PURE__ */ new Uint8Array(8), o = new DataView(a.buffer);
|
|
3139
3152
|
if (r === 255) o.setUint32(0, (n << 31 | 2146435072 | i >>> 3) >>> 0, !1), o.setUint32(4, (i & 7) << 29, !1);
|
|
3140
3153
|
else if (r === 0 && i === 0) o.setUint32(0, n << 31 >>> 0, !1), o.setUint32(4, 0, !1);
|
|
@@ -3144,49 +3157,49 @@ function Mr(e) {
|
|
|
3144
3157
|
}
|
|
3145
3158
|
return a;
|
|
3146
3159
|
}
|
|
3147
|
-
function
|
|
3160
|
+
function Fr(e, t, n) {
|
|
3148
3161
|
let r = e.length === 2 ? 1 : e.length === 4 ? 2 : 3;
|
|
3149
3162
|
if (r === 1) {
|
|
3150
3163
|
let n = e[0] << 8 | e[1];
|
|
3151
|
-
if (t === 2) return new
|
|
3152
|
-
if (t === 3) return new
|
|
3164
|
+
if (t === 2) return new kr(Mr(n));
|
|
3165
|
+
if (t === 3) return new Ar(Nr(n));
|
|
3153
3166
|
}
|
|
3154
3167
|
if (r === 2) {
|
|
3155
|
-
if (t === 3) return new
|
|
3168
|
+
if (t === 3) return new Ar(Pr(e));
|
|
3156
3169
|
if (t === 1) {
|
|
3157
3170
|
let t = new DataView(e.buffer, e.byteOffset).getFloat32(0, !1), r = S(t);
|
|
3158
|
-
return !Object.is(C(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new
|
|
3171
|
+
return !Object.is(C(r), t) && !isNaN(t) && n("float'...' value cannot be exactly represented as float16 (_1)"), new Or(r);
|
|
3159
3172
|
}
|
|
3160
3173
|
}
|
|
3161
3174
|
if (r === 3) {
|
|
3162
3175
|
let r = new DataView(e.buffer, e.byteOffset).getFloat64(0, !1);
|
|
3163
3176
|
if (t === 1) {
|
|
3164
3177
|
let e = S(r);
|
|
3165
|
-
return !Object.is(C(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new
|
|
3178
|
+
return !Object.is(C(e), r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float16 (_1)"), new Or(e);
|
|
3166
3179
|
}
|
|
3167
3180
|
if (t === 2) {
|
|
3168
3181
|
let e = Math.fround(r);
|
|
3169
3182
|
!Object.is(e, r) && !isNaN(r) && n("float'...' value cannot be exactly represented as float32 (_2)");
|
|
3170
3183
|
let t = /* @__PURE__ */ new Uint8Array(4);
|
|
3171
|
-
return new DataView(t.buffer).setFloat32(0, e, !1), new
|
|
3184
|
+
return new DataView(t.buffer).setFloat32(0, e, !1), new kr(t);
|
|
3172
3185
|
}
|
|
3173
3186
|
}
|
|
3174
|
-
return
|
|
3187
|
+
return jr(e);
|
|
3175
3188
|
}
|
|
3176
|
-
var
|
|
3189
|
+
var Ir = {
|
|
3177
3190
|
appStringPrefixes: ["float"],
|
|
3178
3191
|
parseAppString(t, n, r, i) {
|
|
3179
|
-
let a =
|
|
3192
|
+
let a = Dr(n);
|
|
3180
3193
|
if (!/^[0-9a-fA-F]*$/.test(a)) throw SyntaxError("float'...' contains non-hex characters");
|
|
3181
3194
|
if (a.length % 2 != 0) throw SyntaxError(`float'...' hex content has odd length (${a.length} digits)`);
|
|
3182
3195
|
let o = e(a), s = i?.encodingWidth;
|
|
3183
|
-
if (s === void 0) return
|
|
3196
|
+
if (s === void 0) return jr(o);
|
|
3184
3197
|
if (s !== 1 && s !== 2 && s !== 3) {
|
|
3185
3198
|
let e = `float'...' encoding indicator _${s} is not valid; use _1, _2, or _3`;
|
|
3186
|
-
if (r) return r(e),
|
|
3199
|
+
if (r) return r(e), jr(o);
|
|
3187
3200
|
throw SyntaxError(e);
|
|
3188
3201
|
}
|
|
3189
|
-
return s === (o.length === 2 ? 1 : o.length === 4 ? 2 : 3) ?
|
|
3202
|
+
return s === (o.length === 2 ? 1 : o.length === 4 ? 2 : 3) ? jr(o) : Fr(o, s, r ?? ((e) => {
|
|
3190
3203
|
throw SyntaxError(e);
|
|
3191
3204
|
}));
|
|
3192
3205
|
},
|
|
@@ -3198,39 +3211,52 @@ var Pr = {
|
|
|
3198
3211
|
else throw SyntaxError(e);
|
|
3199
3212
|
}
|
|
3200
3213
|
if (!(t[0] instanceof N)) throw SyntaxError("float<<...>> item must be a byte string");
|
|
3201
|
-
return
|
|
3214
|
+
return jr(t[0].value);
|
|
3202
3215
|
}
|
|
3203
|
-
},
|
|
3216
|
+
}, Lr = [Bn, sr], Rr = [
|
|
3204
3217
|
Kt,
|
|
3205
3218
|
dn,
|
|
3206
|
-
|
|
3207
|
-
Bn,
|
|
3208
|
-
or,
|
|
3209
|
-
gr,
|
|
3219
|
+
Ln,
|
|
3210
3220
|
_r,
|
|
3211
|
-
|
|
3221
|
+
vr,
|
|
3212
3222
|
Tr,
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3223
|
+
Er,
|
|
3224
|
+
Ir
|
|
3225
|
+
], zr;
|
|
3226
|
+
function Z(e) {
|
|
3227
|
+
return e === void 0 ? zr ??= [...Lr, ...Rr] : e === !1 ? Lr : [...Lr, ...e];
|
|
3228
|
+
}
|
|
3229
|
+
//#endregion
|
|
3230
|
+
//#region src/js/fromJS.ts
|
|
3231
|
+
var Br;
|
|
3232
|
+
function Vr(e) {
|
|
3233
|
+
if (e === void 0) {
|
|
3234
|
+
if (Br) return Br;
|
|
3235
|
+
let e = Z(void 0);
|
|
3236
|
+
return Br = {
|
|
3237
|
+
fromJS: e.filter((e) => e.fromJS !== void 0),
|
|
3238
|
+
parseTag: e.filter((e) => e.parseTag !== void 0)
|
|
3239
|
+
};
|
|
3240
|
+
}
|
|
3241
|
+
let t = Z(e);
|
|
3242
|
+
return {
|
|
3243
|
+
fromJS: t.filter((e) => e.fromJS !== void 0),
|
|
3244
|
+
parseTag: t.filter((e) => e.parseTag !== void 0)
|
|
3219
3245
|
};
|
|
3220
3246
|
}
|
|
3221
|
-
function
|
|
3222
|
-
let t = e?.extensions, n =
|
|
3247
|
+
function Hr(e) {
|
|
3248
|
+
let t = e?.extensions, n = Vr(e?.builtinExtensions);
|
|
3223
3249
|
return t?.length ? {
|
|
3224
3250
|
fromJS: [...t.filter((e) => e.fromJS !== void 0), ...n.fromJS],
|
|
3225
3251
|
parseTag: [...t.filter((e) => e.parseTag !== void 0), ...n.parseTag]
|
|
3226
3252
|
} : n;
|
|
3227
3253
|
}
|
|
3228
|
-
function
|
|
3254
|
+
function Ur(e, t) {
|
|
3229
3255
|
if (t?.replacer) {
|
|
3230
|
-
let { replacer: n, ...r } = t, i =
|
|
3231
|
-
return i === h ? R.UNDEFINED :
|
|
3256
|
+
let { replacer: n, ...r } = t, i = Gr(e, n, r.extensions, r.undefinedOmits, r.builtinExtensions);
|
|
3257
|
+
return i === h ? R.UNDEFINED : Ur(i, Object.keys(r).length > 0 ? r : void 0);
|
|
3232
3258
|
}
|
|
3233
|
-
return Q(e, t, !0,
|
|
3259
|
+
return Q(e, t, !0, Hr(t));
|
|
3234
3260
|
}
|
|
3235
3261
|
function Q(e, t, n, r) {
|
|
3236
3262
|
for (let n of r.fromJS) {
|
|
@@ -3254,7 +3280,7 @@ function Q(e, t, n, r) {
|
|
|
3254
3280
|
if (e === !1) return R.FALSE;
|
|
3255
3281
|
if (typeof e == "bigint") return e > 18446744073709551615n ? new et(e) : e < -18446744073709551616n ? new tt(e) : e >= 0n ? new k(e) : new A(e);
|
|
3256
3282
|
if (typeof e == "number") return (t?.encodeIntegerAs ?? "int") === "int" && Number.isInteger(e) && !Object.is(e, -0) ? e >= 0 ? new k(BigInt(e)) : new A(BigInt(e)) : new j(e);
|
|
3257
|
-
if (typeof e == "string") return new
|
|
3283
|
+
if (typeof e == "string") return new V(e);
|
|
3258
3284
|
if (e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]") return Q(e.valueOf(), t, !1, r);
|
|
3259
3285
|
if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return new N(new Uint8Array(e));
|
|
3260
3286
|
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));
|
|
@@ -3262,17 +3288,17 @@ function Q(e, t, n, r) {
|
|
|
3262
3288
|
if (Array.isArray(e)) return new I(e.map((e) => Q(e, t, !0, r)));
|
|
3263
3289
|
if (typeof e == "object") {
|
|
3264
3290
|
let n = [];
|
|
3265
|
-
for (let [i, a] of Object.entries(e)) n.push([new
|
|
3291
|
+
for (let [i, a] of Object.entries(e)) n.push([new V(i), Q(a, t, !0, r)]);
|
|
3266
3292
|
return new L(n);
|
|
3267
3293
|
}
|
|
3268
3294
|
throw TypeError(`fromJS: unsupported value type: ${typeof e}`);
|
|
3269
3295
|
}
|
|
3270
|
-
function
|
|
3296
|
+
function Wr(e) {
|
|
3271
3297
|
return ArrayBuffer.isView(e) || e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer || e instanceof Number || e instanceof Boolean || e instanceof String || Object.prototype.toString.call(e) === "[object BigInt]" || e instanceof m.Null || e instanceof m.Undefined || e instanceof g;
|
|
3272
3298
|
}
|
|
3273
|
-
function
|
|
3274
|
-
let
|
|
3275
|
-
function
|
|
3299
|
+
function Gr(e, t, n, r, i) {
|
|
3300
|
+
let a = [...n ?? [], ...Z(i)].filter((e) => e.isJSType !== void 0);
|
|
3301
|
+
function o(e) {
|
|
3276
3302
|
return e === h || r === !0 && e === void 0;
|
|
3277
3303
|
}
|
|
3278
3304
|
if (Array.isArray(t)) {
|
|
@@ -3281,20 +3307,20 @@ function Vr(e, t, n, r) {
|
|
|
3281
3307
|
if (typeof e != "object" || !e) return e;
|
|
3282
3308
|
if (e instanceof $) return $.from(e, ([e, t]) => [e, r(t)]);
|
|
3283
3309
|
if (Array.isArray(e)) return e.map(r);
|
|
3284
|
-
if (m.symbol in e ||
|
|
3310
|
+
if (m.symbol in e || Wr(e) || a.some((t) => t.isJSType(e))) return e;
|
|
3285
3311
|
let t = Object.getPrototypeOf(e);
|
|
3286
3312
|
if (t === Object.prototype || t === null) {
|
|
3287
3313
|
let t = e.toJSON;
|
|
3288
3314
|
if (typeof t == "function") return r(t.call(e));
|
|
3289
3315
|
}
|
|
3290
|
-
let
|
|
3291
|
-
for (let t of n) Object.prototype.hasOwnProperty.call(e, t) && (
|
|
3292
|
-
return
|
|
3316
|
+
let i = {};
|
|
3317
|
+
for (let t of n) Object.prototype.hasOwnProperty.call(e, t) && (i[t] = r(e[t]));
|
|
3318
|
+
return i;
|
|
3293
3319
|
}
|
|
3294
3320
|
return r(e);
|
|
3295
3321
|
}
|
|
3296
|
-
let
|
|
3297
|
-
function
|
|
3322
|
+
let s = t;
|
|
3323
|
+
function c(e, t, n) {
|
|
3298
3324
|
if (typeof e == "object" && e && !(e instanceof $)) {
|
|
3299
3325
|
let n = Object.getPrototypeOf(e);
|
|
3300
3326
|
if (n === Object.prototype || n === null) {
|
|
@@ -3302,31 +3328,31 @@ function Vr(e, t, n, r) {
|
|
|
3302
3328
|
typeof n == "function" && (e = n.call(e, t));
|
|
3303
3329
|
}
|
|
3304
3330
|
}
|
|
3305
|
-
if (e =
|
|
3331
|
+
if (e = s.call(n, t, e), typeof e == "object" && e) {
|
|
3306
3332
|
if (m.symbol in e) return e;
|
|
3307
3333
|
if (e instanceof $) {
|
|
3308
3334
|
let t = new $();
|
|
3309
3335
|
for (let [n, r] of e) {
|
|
3310
|
-
let i =
|
|
3311
|
-
|
|
3336
|
+
let i = c(r, n, e);
|
|
3337
|
+
o(i) || t.push([n, i]);
|
|
3312
3338
|
}
|
|
3313
3339
|
return t;
|
|
3314
3340
|
}
|
|
3315
3341
|
if (Array.isArray(e)) return e.map((t, n) => {
|
|
3316
|
-
let r =
|
|
3317
|
-
return
|
|
3342
|
+
let r = c(t, String(n), e);
|
|
3343
|
+
return o(r) ? null : r;
|
|
3318
3344
|
});
|
|
3319
|
-
if (
|
|
3345
|
+
if (Wr(e) || a.some((t) => t.isJSType(e))) return e;
|
|
3320
3346
|
let t = {};
|
|
3321
3347
|
for (let n of Object.keys(e)) {
|
|
3322
|
-
let r =
|
|
3323
|
-
|
|
3348
|
+
let r = c(e[n], n, e);
|
|
3349
|
+
o(r) || (t[n] = r);
|
|
3324
3350
|
}
|
|
3325
3351
|
return t;
|
|
3326
3352
|
}
|
|
3327
3353
|
return e;
|
|
3328
3354
|
}
|
|
3329
|
-
return
|
|
3355
|
+
return c(e, "", { "": e });
|
|
3330
3356
|
}
|
|
3331
3357
|
//#endregion
|
|
3332
3358
|
//#region src/mapEntries.ts
|
|
@@ -3334,7 +3360,7 @@ var $ = class extends Array {
|
|
|
3334
3360
|
toJSON() {
|
|
3335
3361
|
let e = {};
|
|
3336
3362
|
for (let [t, n] of this) {
|
|
3337
|
-
let r = typeof t == "string" ? t :
|
|
3363
|
+
let r = typeof t == "string" ? t : Ur(t).toCDN();
|
|
3338
3364
|
r === "__proto__" ? Object.defineProperty(e, r, {
|
|
3339
3365
|
value: n,
|
|
3340
3366
|
writable: !0,
|
|
@@ -3346,6 +3372,6 @@ var $ = class extends Array {
|
|
|
3346
3372
|
}
|
|
3347
3373
|
};
|
|
3348
3374
|
//#endregion
|
|
3349
|
-
export {
|
|
3375
|
+
export { k as A, I as C, M as D, N as E, s as F, m as I, c as L, g as M, h as N, j as O, o as P, L as S, P as T, at as _, Ir as a, Ue as b, Er as c, ar as d, Ln as f, V as g, qt as h, Rr as i, O as j, A as k, vr as l, Kt as m, Gr as n, Dr as o, dn as p, Ur as r, Tr as s, $ as t, _r as u, tt as v, F as w, R as x, et as y };
|
|
3350
3376
|
|
|
3351
|
-
//# sourceMappingURL=mapEntries-
|
|
3377
|
+
//# sourceMappingURL=mapEntries-ClxYqDPp.js.map
|