@learncard/core 5.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core.cjs.development.js +3415 -176
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +165 -143
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +13 -1
- package/dist/core.esm.js +3415 -176
- package/dist/core.esm.js.map +3 -3
- package/package.json +4 -1
@@ -123,7 +123,7 @@ function base(ALPHABET, name5) {
|
|
123
123
|
var LEADER = ALPHABET.charAt(0);
|
124
124
|
var FACTOR = Math.log(BASE) / Math.log(256);
|
125
125
|
var iFACTOR = Math.log(256) / Math.log(BASE);
|
126
|
-
function
|
126
|
+
function encode18(source) {
|
127
127
|
if (source instanceof Uint8Array)
|
128
128
|
;
|
129
129
|
else if (ArrayBuffer.isView(source)) {
|
@@ -171,7 +171,7 @@ function base(ALPHABET, name5) {
|
|
171
171
|
}
|
172
172
|
return str;
|
173
173
|
}
|
174
|
-
__name(
|
174
|
+
__name(encode18, "encode");
|
175
175
|
function decodeUnsafe(source) {
|
176
176
|
if (typeof source !== "string") {
|
177
177
|
throw new TypeError("Expected String");
|
@@ -223,18 +223,18 @@ function base(ALPHABET, name5) {
|
|
223
223
|
return vch;
|
224
224
|
}
|
225
225
|
__name(decodeUnsafe, "decodeUnsafe");
|
226
|
-
function
|
226
|
+
function decode14(string2) {
|
227
227
|
var buffer2 = decodeUnsafe(string2);
|
228
228
|
if (buffer2) {
|
229
229
|
return buffer2;
|
230
230
|
}
|
231
231
|
throw new Error(`Non-${name5} character`);
|
232
232
|
}
|
233
|
-
__name(
|
233
|
+
__name(decode14, "decode");
|
234
234
|
return {
|
235
|
-
encode:
|
235
|
+
encode: encode18,
|
236
236
|
decodeUnsafe,
|
237
|
-
decode:
|
237
|
+
decode: decode14
|
238
238
|
};
|
239
239
|
}
|
240
240
|
var src, _brrp__multiformats_scope_baseX, base_x_default;
|
@@ -379,20 +379,20 @@ var init_base = __esm({
|
|
379
379
|
}
|
380
380
|
};
|
381
381
|
__name(Codec, "Codec");
|
382
|
-
from = /* @__PURE__ */ __name(({ name: name5, prefix, encode:
|
383
|
-
baseX = /* @__PURE__ */ __name(({ prefix, name: name5, alphabet:
|
384
|
-
const { encode:
|
382
|
+
from = /* @__PURE__ */ __name(({ name: name5, prefix, encode: encode18, decode: decode14 }) => new Codec(name5, prefix, encode18, decode14), "from");
|
383
|
+
baseX = /* @__PURE__ */ __name(({ prefix, name: name5, alphabet: alphabet3 }) => {
|
384
|
+
const { encode: encode18, decode: decode14 } = base_x_default(alphabet3, name5);
|
385
385
|
return from({
|
386
386
|
prefix,
|
387
387
|
name: name5,
|
388
|
-
encode:
|
389
|
-
decode: (text) => coerce(
|
388
|
+
encode: encode18,
|
389
|
+
decode: (text) => coerce(decode14(text))
|
390
390
|
});
|
391
391
|
}, "baseX");
|
392
|
-
decode = /* @__PURE__ */ __name((string2,
|
392
|
+
decode = /* @__PURE__ */ __name((string2, alphabet3, bitsPerChar, name5) => {
|
393
393
|
const codes = {};
|
394
|
-
for (let i = 0; i <
|
395
|
-
codes[
|
394
|
+
for (let i = 0; i < alphabet3.length; ++i) {
|
395
|
+
codes[alphabet3[i]] = i;
|
396
396
|
}
|
397
397
|
let end = string2.length;
|
398
398
|
while (string2[end - 1] === "=") {
|
@@ -419,8 +419,8 @@ var init_base = __esm({
|
|
419
419
|
}
|
420
420
|
return out;
|
421
421
|
}, "decode");
|
422
|
-
encode = /* @__PURE__ */ __name((data,
|
423
|
-
const pad2 =
|
422
|
+
encode = /* @__PURE__ */ __name((data, alphabet3, bitsPerChar) => {
|
423
|
+
const pad2 = alphabet3[alphabet3.length - 1] === "=";
|
424
424
|
const mask = (1 << bitsPerChar) - 1;
|
425
425
|
let out = "";
|
426
426
|
let bits = 0;
|
@@ -430,11 +430,11 @@ var init_base = __esm({
|
|
430
430
|
bits += 8;
|
431
431
|
while (bits > bitsPerChar) {
|
432
432
|
bits -= bitsPerChar;
|
433
|
-
out +=
|
433
|
+
out += alphabet3[mask & buffer2 >> bits];
|
434
434
|
}
|
435
435
|
}
|
436
436
|
if (bits) {
|
437
|
-
out +=
|
437
|
+
out += alphabet3[mask & buffer2 << bitsPerChar - bits];
|
438
438
|
}
|
439
439
|
if (pad2) {
|
440
440
|
while (out.length * bitsPerChar & 7) {
|
@@ -443,15 +443,15 @@ var init_base = __esm({
|
|
443
443
|
}
|
444
444
|
return out;
|
445
445
|
}, "encode");
|
446
|
-
rfc4648 = /* @__PURE__ */ __name(({ name: name5, prefix, bitsPerChar, alphabet:
|
446
|
+
rfc4648 = /* @__PURE__ */ __name(({ name: name5, prefix, bitsPerChar, alphabet: alphabet3 }) => {
|
447
447
|
return from({
|
448
448
|
prefix,
|
449
449
|
name: name5,
|
450
450
|
encode(input) {
|
451
|
-
return encode(input,
|
451
|
+
return encode(input, alphabet3, bitsPerChar);
|
452
452
|
},
|
453
453
|
decode(input) {
|
454
|
-
return decode(input,
|
454
|
+
return decode(input, alphabet3, bitsPerChar, name5);
|
455
455
|
}
|
456
456
|
});
|
457
457
|
}, "rfc4648");
|
@@ -916,12 +916,12 @@ var from2, Hasher;
|
|
916
916
|
var init_hasher = __esm({
|
917
917
|
"../../node_modules/.pnpm/multiformats@9.7.0/node_modules/multiformats/esm/src/hashes/hasher.js"() {
|
918
918
|
init_digest();
|
919
|
-
from2 = /* @__PURE__ */ __name(({ name: name5, code: code5, encode:
|
919
|
+
from2 = /* @__PURE__ */ __name(({ name: name5, code: code5, encode: encode18 }) => new Hasher(name5, code5, encode18), "from");
|
920
920
|
Hasher = class {
|
921
|
-
constructor(name5, code5,
|
921
|
+
constructor(name5, code5, encode18) {
|
922
922
|
this.name = name5;
|
923
923
|
this.code = code5;
|
924
|
-
this.encode =
|
924
|
+
this.encode = encode18;
|
925
925
|
}
|
926
926
|
digest(input) {
|
927
927
|
if (input instanceof Uint8Array) {
|
@@ -1034,9 +1034,9 @@ var init_cid = __esm({
|
|
1034
1034
|
init_base32();
|
1035
1035
|
init_bytes();
|
1036
1036
|
CID = class {
|
1037
|
-
constructor(
|
1037
|
+
constructor(version12, code5, multihash, bytes) {
|
1038
1038
|
this.code = code5;
|
1039
|
-
this.version =
|
1039
|
+
this.version = version12;
|
1040
1040
|
this.multihash = multihash;
|
1041
1041
|
this.bytes = bytes;
|
1042
1042
|
this.byteOffset = bytes.byteOffset;
|
@@ -1090,8 +1090,8 @@ var init_cid = __esm({
|
|
1090
1090
|
return other && this.code === other.code && this.version === other.version && equals2(this.multihash, other.multihash);
|
1091
1091
|
}
|
1092
1092
|
toString(base4) {
|
1093
|
-
const { bytes, version:
|
1094
|
-
switch (
|
1093
|
+
const { bytes, version: version12, _baseCache } = this;
|
1094
|
+
switch (version12) {
|
1095
1095
|
case 0:
|
1096
1096
|
return toStringV0(bytes, _baseCache, base4 || base58btc.encoder);
|
1097
1097
|
default:
|
@@ -1134,31 +1134,31 @@ var init_cid = __esm({
|
|
1134
1134
|
if (value instanceof CID) {
|
1135
1135
|
return value;
|
1136
1136
|
} else if (value != null && value.asCID === value) {
|
1137
|
-
const { version:
|
1138
|
-
return new CID(
|
1137
|
+
const { version: version12, code: code5, multihash, bytes } = value;
|
1138
|
+
return new CID(version12, code5, multihash, bytes || encodeCID(version12, code5, multihash.bytes));
|
1139
1139
|
} else if (value != null && value[cidSymbol] === true) {
|
1140
|
-
const { version:
|
1140
|
+
const { version: version12, multihash, code: code5 } = value;
|
1141
1141
|
const digest2 = decode5(multihash);
|
1142
|
-
return CID.create(
|
1142
|
+
return CID.create(version12, code5, digest2);
|
1143
1143
|
} else {
|
1144
1144
|
return null;
|
1145
1145
|
}
|
1146
1146
|
}
|
1147
|
-
static create(
|
1147
|
+
static create(version12, code5, digest2) {
|
1148
1148
|
if (typeof code5 !== "number") {
|
1149
1149
|
throw new Error("String codecs are no longer supported");
|
1150
1150
|
}
|
1151
|
-
switch (
|
1151
|
+
switch (version12) {
|
1152
1152
|
case 0: {
|
1153
1153
|
if (code5 !== DAG_PB_CODE) {
|
1154
1154
|
throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
|
1155
1155
|
} else {
|
1156
|
-
return new CID(
|
1156
|
+
return new CID(version12, code5, digest2, digest2.bytes);
|
1157
1157
|
}
|
1158
1158
|
}
|
1159
1159
|
case 1: {
|
1160
|
-
const bytes = encodeCID(
|
1161
|
-
return new CID(
|
1160
|
+
const bytes = encodeCID(version12, code5, digest2.bytes);
|
1161
|
+
return new CID(version12, code5, digest2, bytes);
|
1162
1162
|
}
|
1163
1163
|
default: {
|
1164
1164
|
throw new Error("Invalid version");
|
@@ -1200,16 +1200,16 @@ var init_cid = __esm({
|
|
1200
1200
|
offset += length2;
|
1201
1201
|
return i;
|
1202
1202
|
}, "next");
|
1203
|
-
let
|
1203
|
+
let version12 = next();
|
1204
1204
|
let codec = DAG_PB_CODE;
|
1205
|
-
if (
|
1206
|
-
|
1205
|
+
if (version12 === 18) {
|
1206
|
+
version12 = 0;
|
1207
1207
|
offset = 0;
|
1208
|
-
} else if (
|
1208
|
+
} else if (version12 === 1) {
|
1209
1209
|
codec = next();
|
1210
1210
|
}
|
1211
|
-
if (
|
1212
|
-
throw new RangeError(`Invalid CID version ${
|
1211
|
+
if (version12 !== 0 && version12 !== 1) {
|
1212
|
+
throw new RangeError(`Invalid CID version ${version12}`);
|
1213
1213
|
}
|
1214
1214
|
const prefixSize = offset;
|
1215
1215
|
const multihashCode = next();
|
@@ -1217,7 +1217,7 @@ var init_cid = __esm({
|
|
1217
1217
|
const size = offset + digestSize;
|
1218
1218
|
const multihashSize = size - prefixSize;
|
1219
1219
|
return {
|
1220
|
-
version:
|
1220
|
+
version: version12,
|
1221
1221
|
codec,
|
1222
1222
|
multihashCode,
|
1223
1223
|
digestSize,
|
@@ -1294,11 +1294,11 @@ var init_cid = __esm({
|
|
1294
1294
|
}, "toStringV1");
|
1295
1295
|
DAG_PB_CODE = 112;
|
1296
1296
|
SHA_256_CODE = 18;
|
1297
|
-
encodeCID = /* @__PURE__ */ __name((
|
1298
|
-
const codeOffset = encodingLength(
|
1297
|
+
encodeCID = /* @__PURE__ */ __name((version12, code5, multihash) => {
|
1298
|
+
const codeOffset = encodingLength(version12);
|
1299
1299
|
const hashOffset = codeOffset + encodingLength(code5);
|
1300
1300
|
const bytes = new Uint8Array(hashOffset + multihash.byteLength);
|
1301
|
-
encodeTo(
|
1301
|
+
encodeTo(version12, bytes, 0);
|
1302
1302
|
encodeTo(code5, bytes, codeOffset);
|
1303
1303
|
bytes.set(multihash, hashOffset);
|
1304
1304
|
return bytes;
|
@@ -1391,16 +1391,16 @@ var init_basics = __esm({
|
|
1391
1391
|
});
|
1392
1392
|
|
1393
1393
|
// ../../node_modules/.pnpm/uint8arrays@3.0.0/node_modules/uint8arrays/esm/src/util/bases.js
|
1394
|
-
function createCodec(name5, prefix,
|
1394
|
+
function createCodec(name5, prefix, encode18, decode14) {
|
1395
1395
|
return {
|
1396
1396
|
name: name5,
|
1397
1397
|
prefix,
|
1398
1398
|
encoder: {
|
1399
1399
|
name: name5,
|
1400
1400
|
prefix,
|
1401
|
-
encode:
|
1401
|
+
encode: encode18
|
1402
1402
|
},
|
1403
|
-
decoder: { decode:
|
1403
|
+
decoder: { decode: decode14 }
|
1404
1404
|
};
|
1405
1405
|
}
|
1406
1406
|
var string, ascii, BASES, bases_default;
|
@@ -3190,7 +3190,7 @@ var require_bn = __commonJS({
|
|
3190
3190
|
}
|
3191
3191
|
return this;
|
3192
3192
|
}, "_normSign");
|
3193
|
-
BN3.prototype.inspect = /* @__PURE__ */ __name(function
|
3193
|
+
BN3.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
3194
3194
|
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
|
3195
3195
|
}, "inspect");
|
3196
3196
|
var zeros = [
|
@@ -3299,7 +3299,7 @@ var require_bn = __commonJS({
|
|
3299
3299
|
52521875,
|
3300
3300
|
60466176
|
3301
3301
|
];
|
3302
|
-
BN3.prototype.toString = /* @__PURE__ */ __name(function
|
3302
|
+
BN3.prototype.toString = /* @__PURE__ */ __name(function toString6(base4, padding) {
|
3303
3303
|
base4 = base4 || 10;
|
3304
3304
|
padding = padding | 0 || 1;
|
3305
3305
|
var out;
|
@@ -5808,7 +5808,7 @@ var require_utils = __commonJS({
|
|
5808
5808
|
}
|
5809
5809
|
__name(toHex2, "toHex");
|
5810
5810
|
utils.toHex = toHex2;
|
5811
|
-
utils.encode = /* @__PURE__ */ __name(function
|
5811
|
+
utils.encode = /* @__PURE__ */ __name(function encode18(arr, enc) {
|
5812
5812
|
if (enc === "hex")
|
5813
5813
|
return toHex2(arr);
|
5814
5814
|
else
|
@@ -6019,7 +6019,7 @@ var require_base = __commonJS({
|
|
6019
6019
|
BaseCurve2.prototype.point = /* @__PURE__ */ __name(function point3() {
|
6020
6020
|
throw new Error("Not implemented");
|
6021
6021
|
}, "point");
|
6022
|
-
BaseCurve2.prototype.validate = /* @__PURE__ */ __name(function
|
6022
|
+
BaseCurve2.prototype.validate = /* @__PURE__ */ __name(function validate7() {
|
6023
6023
|
throw new Error("Not implemented");
|
6024
6024
|
}, "validate");
|
6025
6025
|
BaseCurve2.prototype._fixedNafMul = /* @__PURE__ */ __name(function _fixedNafMul2(p, k) {
|
@@ -6198,7 +6198,7 @@ var require_base = __commonJS({
|
|
6198
6198
|
BasePoint2.prototype.eq = /* @__PURE__ */ __name(function eq4() {
|
6199
6199
|
throw new Error("Not implemented");
|
6200
6200
|
}, "eq");
|
6201
|
-
BasePoint2.prototype.validate = /* @__PURE__ */ __name(function
|
6201
|
+
BasePoint2.prototype.validate = /* @__PURE__ */ __name(function validate7() {
|
6202
6202
|
return this.curve.validate(this);
|
6203
6203
|
}, "validate");
|
6204
6204
|
BaseCurve2.prototype.decodePoint = /* @__PURE__ */ __name(function decodePoint2(bytes, enc) {
|
@@ -6219,14 +6219,14 @@ var require_base = __commonJS({
|
|
6219
6219
|
BasePoint2.prototype.encodeCompressed = /* @__PURE__ */ __name(function encodeCompressed2(enc) {
|
6220
6220
|
return this.encode(enc, true);
|
6221
6221
|
}, "encodeCompressed");
|
6222
|
-
BasePoint2.prototype._encode = /* @__PURE__ */ __name(function
|
6222
|
+
BasePoint2.prototype._encode = /* @__PURE__ */ __name(function _encode3(compact) {
|
6223
6223
|
var len = this.curve.p.byteLength();
|
6224
6224
|
var x = this.getX().toArray("be", len);
|
6225
6225
|
if (compact)
|
6226
6226
|
return [this.getY().isEven() ? 2 : 3].concat(x);
|
6227
6227
|
return [4].concat(x, this.getY().toArray("be", len));
|
6228
6228
|
}, "_encode");
|
6229
|
-
BasePoint2.prototype.encode = /* @__PURE__ */ __name(function
|
6229
|
+
BasePoint2.prototype.encode = /* @__PURE__ */ __name(function encode18(enc, compact) {
|
6230
6230
|
return utils.encode(this._encode(compact), enc);
|
6231
6231
|
}, "encode");
|
6232
6232
|
BasePoint2.prototype.precompute = /* @__PURE__ */ __name(function precompute2(power) {
|
@@ -6482,7 +6482,7 @@ var require_short = __commonJS({
|
|
6482
6482
|
y = y.redNeg();
|
6483
6483
|
return this.point(x, y);
|
6484
6484
|
}, "pointFromX");
|
6485
|
-
ShortCurve2.prototype.validate = /* @__PURE__ */ __name(function
|
6485
|
+
ShortCurve2.prototype.validate = /* @__PURE__ */ __name(function validate7(point3) {
|
6486
6486
|
if (point3.inf)
|
6487
6487
|
return true;
|
6488
6488
|
var x = point3.x;
|
@@ -6611,7 +6611,7 @@ var require_short = __commonJS({
|
|
6611
6611
|
};
|
6612
6612
|
return res;
|
6613
6613
|
}, "fromJSON");
|
6614
|
-
Point2.prototype.inspect = /* @__PURE__ */ __name(function
|
6614
|
+
Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
6615
6615
|
if (this.isInfinity())
|
6616
6616
|
return "<EC Point Infinity>";
|
6617
6617
|
return "<EC Point x: " + this.x.fromRed().toString(16, 2) + " y: " + this.y.fromRed().toString(16, 2) + ">";
|
@@ -7014,7 +7014,7 @@ var require_short = __commonJS({
|
|
7014
7014
|
return true;
|
7015
7015
|
}
|
7016
7016
|
}, "eqXToP");
|
7017
|
-
JPoint2.prototype.inspect = /* @__PURE__ */ __name(function
|
7017
|
+
JPoint2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
7018
7018
|
if (this.isInfinity())
|
7019
7019
|
return "<EC JPoint Infinity>";
|
7020
7020
|
return "<EC JPoint x: " + this.x.toString(16, 2) + " y: " + this.y.toString(16, 2) + " z: " + this.z.toString(16, 2) + ">";
|
@@ -7044,7 +7044,7 @@ var require_mont = __commonJS({
|
|
7044
7044
|
__name(MontCurve, "MontCurve");
|
7045
7045
|
inherits(MontCurve, Base);
|
7046
7046
|
module2.exports = MontCurve;
|
7047
|
-
MontCurve.prototype.validate = /* @__PURE__ */ __name(function
|
7047
|
+
MontCurve.prototype.validate = /* @__PURE__ */ __name(function validate7(point3) {
|
7048
7048
|
var x = point3.normalize().x;
|
7049
7049
|
var x2 = x.redSqr();
|
7050
7050
|
var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
|
@@ -7078,13 +7078,13 @@ var require_mont = __commonJS({
|
|
7078
7078
|
}, "pointFromJSON");
|
7079
7079
|
Point2.prototype.precompute = /* @__PURE__ */ __name(function precompute2() {
|
7080
7080
|
}, "precompute");
|
7081
|
-
Point2.prototype._encode = /* @__PURE__ */ __name(function
|
7081
|
+
Point2.prototype._encode = /* @__PURE__ */ __name(function _encode3() {
|
7082
7082
|
return this.getX().toArray("be", this.curve.p.byteLength());
|
7083
7083
|
}, "_encode");
|
7084
7084
|
Point2.fromJSON = /* @__PURE__ */ __name(function fromJSON2(curve, obj) {
|
7085
7085
|
return new Point2(curve, obj[0], obj[1] || curve.one);
|
7086
7086
|
}, "fromJSON");
|
7087
|
-
Point2.prototype.inspect = /* @__PURE__ */ __name(function
|
7087
|
+
Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
7088
7088
|
if (this.isInfinity())
|
7089
7089
|
return "<EC Point Infinity>";
|
7090
7090
|
return "<EC Point x: " + this.x.fromRed().toString(16, 2) + " z: " + this.z.fromRed().toString(16, 2) + ">";
|
@@ -7233,7 +7233,7 @@ var require_edwards = __commonJS({
|
|
7233
7233
|
x = x.redNeg();
|
7234
7234
|
return this.point(x, y);
|
7235
7235
|
}, "pointFromY");
|
7236
|
-
EdwardsCurve.prototype.validate = /* @__PURE__ */ __name(function
|
7236
|
+
EdwardsCurve.prototype.validate = /* @__PURE__ */ __name(function validate7(point3) {
|
7237
7237
|
if (point3.isInfinity())
|
7238
7238
|
return true;
|
7239
7239
|
point3.normalize();
|
@@ -7283,7 +7283,7 @@ var require_edwards = __commonJS({
|
|
7283
7283
|
Point2.fromJSON = /* @__PURE__ */ __name(function fromJSON2(curve, obj) {
|
7284
7284
|
return new Point2(curve, obj[0], obj[1], obj[2]);
|
7285
7285
|
}, "fromJSON");
|
7286
|
-
Point2.prototype.inspect = /* @__PURE__ */ __name(function
|
7286
|
+
Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
7287
7287
|
if (this.isInfinity())
|
7288
7288
|
return "<EC Point Infinity>";
|
7289
7289
|
return "<EC Point x: " + this.x.fromRed().toString(16, 2) + " y: " + this.y.fromRed().toString(16, 2) + " z: " + this.z.fromRed().toString(16, 2) + ">";
|
@@ -10179,7 +10179,7 @@ var require_key = __commonJS({
|
|
10179
10179
|
privEnc: enc
|
10180
10180
|
});
|
10181
10181
|
}, "fromPrivate");
|
10182
|
-
KeyPair2.prototype.validate = /* @__PURE__ */ __name(function
|
10182
|
+
KeyPair2.prototype.validate = /* @__PURE__ */ __name(function validate7() {
|
10183
10183
|
var pub = this.getPublic();
|
10184
10184
|
if (pub.isInfinity())
|
10185
10185
|
return { result: false, reason: "Invalid public key" };
|
@@ -10234,7 +10234,7 @@ var require_key = __commonJS({
|
|
10234
10234
|
KeyPair2.prototype.verify = /* @__PURE__ */ __name(function verify4(msg, signature2) {
|
10235
10235
|
return this.ec.verify(msg, signature2, this);
|
10236
10236
|
}, "verify");
|
10237
|
-
KeyPair2.prototype.inspect = /* @__PURE__ */ __name(function
|
10237
|
+
KeyPair2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
10238
10238
|
return "<Key priv: " + (this.priv && this.priv.toString(16, 2)) + " pub: " + (this.pub && this.pub.inspect()) + " >";
|
10239
10239
|
}, "inspect");
|
10240
10240
|
}
|
@@ -15299,7 +15299,7 @@ var require_transformers = __commonJS({
|
|
15299
15299
|
return void 0;
|
15300
15300
|
},
|
15301
15301
|
decode(codes) {
|
15302
|
-
function
|
15302
|
+
function validate7(buf3) {
|
15303
15303
|
const chars = [];
|
15304
15304
|
let tail2 = 0;
|
15305
15305
|
for (let i2 = 0; i2 < buf3.length; i2 += 1) {
|
@@ -15358,11 +15358,11 @@ var require_transformers = __commonJS({
|
|
15358
15358
|
}
|
15359
15359
|
return { tail: tail2, buf: Buffer.from(chars) };
|
15360
15360
|
}
|
15361
|
-
__name(
|
15361
|
+
__name(validate7, "validate");
|
15362
15362
|
if (codes.length === 0) {
|
15363
15363
|
return Buffer.alloc(0);
|
15364
15364
|
}
|
15365
|
-
const val =
|
15365
|
+
const val = validate7(codes);
|
15366
15366
|
const { tail } = val;
|
15367
15367
|
const base642 = val.buf;
|
15368
15368
|
let i;
|
@@ -15433,7 +15433,7 @@ ${c4}`;
|
|
15433
15433
|
}
|
15434
15434
|
}
|
15435
15435
|
__name(buildLine, "buildLine");
|
15436
|
-
function
|
15436
|
+
function validate7(c) {
|
15437
15437
|
if (c >= 65 && c <= 90) {
|
15438
15438
|
return true;
|
15439
15439
|
}
|
@@ -15454,10 +15454,10 @@ ${c4}`;
|
|
15454
15454
|
}
|
15455
15455
|
return false;
|
15456
15456
|
}
|
15457
|
-
__name(
|
15457
|
+
__name(validate7, "validate");
|
15458
15458
|
for (let i = 0; i < buf2.length; i += 4) {
|
15459
15459
|
for (let j = i; j < i + 4; j += 1) {
|
15460
|
-
if (!
|
15460
|
+
if (!validate7(buf2[j])) {
|
15461
15461
|
throw new RangeError(`base64.toString: buf[${j}]: ${buf2[j]} : not valid base64 character code`);
|
15462
15462
|
}
|
15463
15463
|
}
|
@@ -15756,7 +15756,7 @@ var require_converter = __commonJS({
|
|
15756
15756
|
}
|
15757
15757
|
return ret;
|
15758
15758
|
}, "validateDst");
|
15759
|
-
var
|
15759
|
+
var encode18 = /* @__PURE__ */ __name(function encode19(type, chars) {
|
15760
15760
|
switch (type) {
|
15761
15761
|
case UTF8:
|
15762
15762
|
return trans.utf8.encode(chars);
|
@@ -15788,7 +15788,7 @@ var require_converter = __commonJS({
|
|
15788
15788
|
throw new TypeError(`encode type "${type}" not recognized`);
|
15789
15789
|
}
|
15790
15790
|
}, "encode");
|
15791
|
-
var
|
15791
|
+
var decode14 = /* @__PURE__ */ __name(function decode15(src2) {
|
15792
15792
|
switch (src2.type) {
|
15793
15793
|
case UTF8:
|
15794
15794
|
return trans.utf8.decode(src2.data, src2.bom);
|
@@ -15822,7 +15822,7 @@ var require_converter = __commonJS({
|
|
15822
15822
|
}, "decode");
|
15823
15823
|
exports.decode = /* @__PURE__ */ __name(function exportsDecode(type, data) {
|
15824
15824
|
const src2 = validateSrc(type, data);
|
15825
|
-
return
|
15825
|
+
return decode14(src2);
|
15826
15826
|
}, "exportsDecode");
|
15827
15827
|
exports.encode = /* @__PURE__ */ __name(function exportsEncode(type, chars) {
|
15828
15828
|
let c;
|
@@ -15830,12 +15830,12 @@ var require_converter = __commonJS({
|
|
15830
15830
|
const dst = validateDst(type, chars);
|
15831
15831
|
if (dst.crlf) {
|
15832
15832
|
c = trans.lineEnds.crlf(chars);
|
15833
|
-
buf2 =
|
15833
|
+
buf2 = encode18(dst.type, c);
|
15834
15834
|
} else if (dst.lf) {
|
15835
15835
|
c = trans.lineEnds.lf(chars);
|
15836
|
-
buf2 =
|
15836
|
+
buf2 = encode18(dst.type, c);
|
15837
15837
|
} else {
|
15838
|
-
buf2 =
|
15838
|
+
buf2 = encode18(dst.type, chars);
|
15839
15839
|
}
|
15840
15840
|
if (dst.base64) {
|
15841
15841
|
buf2 = trans.base64.encode(buf2);
|
@@ -17045,7 +17045,7 @@ var require_parser = __commonJS({
|
|
17045
17045
|
initializeInputChars(inputChars, inputIndex, inputLength);
|
17046
17046
|
return privateParse(grammar, startRule, callbackData);
|
17047
17047
|
}, "parseSubstring");
|
17048
|
-
this.parse = /* @__PURE__ */ __name(function
|
17048
|
+
this.parse = /* @__PURE__ */ __name(function parse3(grammar, startRule, inputChars, callbackData) {
|
17049
17049
|
clear();
|
17050
17050
|
initializeInputChars(inputChars, 0, inputChars.length);
|
17051
17051
|
return privateParse(grammar, startRule, callbackData);
|
@@ -18027,7 +18027,7 @@ var require_stats = __commonJS({
|
|
18027
18027
|
}
|
18028
18028
|
return html;
|
18029
18029
|
}, "displayRules");
|
18030
|
-
this.validate = /* @__PURE__ */ __name(function
|
18030
|
+
this.validate = /* @__PURE__ */ __name(function validate7(name5) {
|
18031
18031
|
let ret = false;
|
18032
18032
|
if (typeof name5 === "string" && nameId === name5) {
|
18033
18033
|
ret = true;
|
@@ -18659,9 +18659,9 @@ var require_trace = __commonJS({
|
|
18659
18659
|
obj.tree = display(root, root.depth, false);
|
18660
18660
|
return obj;
|
18661
18661
|
}, "toTreeObj");
|
18662
|
-
this.toTree = function(
|
18662
|
+
this.toTree = function(stringify3) {
|
18663
18663
|
const obj = toTreeObj();
|
18664
|
-
if (
|
18664
|
+
if (stringify3) {
|
18665
18665
|
return JSON.stringify(obj);
|
18666
18666
|
}
|
18667
18667
|
return obj;
|
@@ -19235,7 +19235,7 @@ var require_scanner_grammar = __commonJS({
|
|
19235
19235
|
this.rules[8].opcodes[0] = { type: 6, string: [10] };
|
19236
19236
|
this.rules[9].opcodes = [];
|
19237
19237
|
this.rules[9].opcodes[0] = { type: 6, string: [13] };
|
19238
|
-
this.toString = /* @__PURE__ */ __name(function
|
19238
|
+
this.toString = /* @__PURE__ */ __name(function toString6() {
|
19239
19239
|
let str = "";
|
19240
19240
|
str += "file = *line [last-line]\n";
|
19241
19241
|
str += "line = line-text end\n";
|
@@ -21448,7 +21448,7 @@ var require_sabnf_grammar = __commonJS({
|
|
21448
21448
|
this.rules[94].opcodes[5] = { type: 1, children: [6, 7] };
|
21449
21449
|
this.rules[94].opcodes[6] = { type: 6, string: [32] };
|
21450
21450
|
this.rules[94].opcodes[7] = { type: 6, string: [9] };
|
21451
|
-
this.toString = /* @__PURE__ */ __name(function
|
21451
|
+
this.toString = /* @__PURE__ */ __name(function toString6() {
|
21452
21452
|
let str = "";
|
21453
21453
|
str += ";\n";
|
21454
21454
|
str += "; ABNF for JavaScript APG 2.0 SABNF\n";
|
@@ -23263,7 +23263,7 @@ var require_api = __commonJS({
|
|
23263
23263
|
this.lines = scanner(this.chars, this.errors, strict, trace);
|
23264
23264
|
isScanned = true;
|
23265
23265
|
}, "scan");
|
23266
|
-
this.parse = /* @__PURE__ */ __name(function
|
23266
|
+
this.parse = /* @__PURE__ */ __name(function parse3(strict, trace) {
|
23267
23267
|
if (!isScanned) {
|
23268
23268
|
throw new Error(`${thisFileName}grammar not scanned`);
|
23269
23269
|
}
|
@@ -23690,17 +23690,17 @@ var require_bn2 = __commonJS({
|
|
23690
23690
|
}, "_normSign");
|
23691
23691
|
if (typeof Symbol !== "undefined" && typeof Symbol.for === "function") {
|
23692
23692
|
try {
|
23693
|
-
BN3.prototype[Symbol.for("nodejs.util.inspect.custom")] =
|
23693
|
+
BN3.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect5;
|
23694
23694
|
} catch (e) {
|
23695
|
-
BN3.prototype.inspect =
|
23695
|
+
BN3.prototype.inspect = inspect5;
|
23696
23696
|
}
|
23697
23697
|
} else {
|
23698
|
-
BN3.prototype.inspect =
|
23698
|
+
BN3.prototype.inspect = inspect5;
|
23699
23699
|
}
|
23700
|
-
function
|
23700
|
+
function inspect5() {
|
23701
23701
|
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
|
23702
23702
|
}
|
23703
|
-
__name(
|
23703
|
+
__name(inspect5, "inspect");
|
23704
23704
|
var zeros = [
|
23705
23705
|
"",
|
23706
23706
|
"0",
|
@@ -23807,7 +23807,7 @@ var require_bn2 = __commonJS({
|
|
23807
23807
|
52521875,
|
23808
23808
|
60466176
|
23809
23809
|
];
|
23810
|
-
BN3.prototype.toString = /* @__PURE__ */ __name(function
|
23810
|
+
BN3.prototype.toString = /* @__PURE__ */ __name(function toString6(base4, padding) {
|
23811
23811
|
base4 = base4 || 10;
|
23812
23812
|
padding = padding | 0 || 1;
|
23813
23813
|
var out;
|
@@ -26310,14 +26310,14 @@ var require_bn2 = __commonJS({
|
|
26310
26310
|
// ../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js
|
26311
26311
|
var require_encode = __commonJS({
|
26312
26312
|
"../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(exports, module2) {
|
26313
|
-
module2.exports =
|
26313
|
+
module2.exports = encode18;
|
26314
26314
|
var MSB2 = 128;
|
26315
26315
|
var REST2 = 127;
|
26316
26316
|
var MSBALL2 = ~REST2;
|
26317
26317
|
var INT2 = Math.pow(2, 31);
|
26318
|
-
function
|
26318
|
+
function encode18(num, out, offset) {
|
26319
26319
|
if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
|
26320
|
-
|
26320
|
+
encode18.bytes = 0;
|
26321
26321
|
throw new RangeError("Could not encode varint");
|
26322
26322
|
}
|
26323
26323
|
out = out || [];
|
@@ -26332,10 +26332,10 @@ var require_encode = __commonJS({
|
|
26332
26332
|
num >>>= 7;
|
26333
26333
|
}
|
26334
26334
|
out[offset] = num | 0;
|
26335
|
-
|
26335
|
+
encode18.bytes = offset - oldOffset + 1;
|
26336
26336
|
return out;
|
26337
26337
|
}
|
26338
|
-
__name(
|
26338
|
+
__name(encode18, "encode");
|
26339
26339
|
}
|
26340
26340
|
});
|
26341
26341
|
|
@@ -26366,17 +26366,17 @@ var require_decode = __commonJS({
|
|
26366
26366
|
// ../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js
|
26367
26367
|
var require_length = __commonJS({
|
26368
26368
|
"../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(exports, module2) {
|
26369
|
-
var
|
26370
|
-
var
|
26371
|
-
var
|
26372
|
-
var
|
26369
|
+
var N13 = Math.pow(2, 7);
|
26370
|
+
var N23 = Math.pow(2, 14);
|
26371
|
+
var N33 = Math.pow(2, 21);
|
26372
|
+
var N43 = Math.pow(2, 28);
|
26373
26373
|
var N52 = Math.pow(2, 35);
|
26374
26374
|
var N62 = Math.pow(2, 42);
|
26375
26375
|
var N72 = Math.pow(2, 49);
|
26376
26376
|
var N82 = Math.pow(2, 56);
|
26377
26377
|
var N92 = Math.pow(2, 63);
|
26378
26378
|
module2.exports = function(value) {
|
26379
|
-
return value <
|
26379
|
+
return value < N13 ? 1 : value < N23 ? 2 : value < N33 ? 3 : value < N43 ? 4 : value < N52 ? 5 : value < N62 ? 6 : value < N72 ? 7 : value < N82 ? 8 : value < N92 ? 9 : 10;
|
26380
26380
|
};
|
26381
26381
|
}
|
26382
26382
|
});
|
@@ -26416,7 +26416,7 @@ var require_src = __commonJS({
|
|
26416
26416
|
var LEADER = ALPHABET.charAt(0);
|
26417
26417
|
var FACTOR = Math.log(BASE) / Math.log(256);
|
26418
26418
|
var iFACTOR = Math.log(256) / Math.log(BASE);
|
26419
|
-
function
|
26419
|
+
function encode18(source) {
|
26420
26420
|
if (source instanceof Uint8Array) {
|
26421
26421
|
} else if (ArrayBuffer.isView(source)) {
|
26422
26422
|
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
@@ -26463,7 +26463,7 @@ var require_src = __commonJS({
|
|
26463
26463
|
}
|
26464
26464
|
return str;
|
26465
26465
|
}
|
26466
|
-
__name(
|
26466
|
+
__name(encode18, "encode");
|
26467
26467
|
function decodeUnsafe(source) {
|
26468
26468
|
if (typeof source !== "string") {
|
26469
26469
|
throw new TypeError("Expected String");
|
@@ -26515,18 +26515,18 @@ var require_src = __commonJS({
|
|
26515
26515
|
return vch;
|
26516
26516
|
}
|
26517
26517
|
__name(decodeUnsafe, "decodeUnsafe");
|
26518
|
-
function
|
26518
|
+
function decode14(string2) {
|
26519
26519
|
var buffer2 = decodeUnsafe(string2);
|
26520
26520
|
if (buffer2) {
|
26521
26521
|
return buffer2;
|
26522
26522
|
}
|
26523
26523
|
throw new Error("Non-base" + BASE + " character");
|
26524
26524
|
}
|
26525
|
-
__name(
|
26525
|
+
__name(decode14, "decode");
|
26526
26526
|
return {
|
26527
|
-
encode:
|
26527
|
+
encode: encode18,
|
26528
26528
|
decodeUnsafe,
|
26529
|
-
decode:
|
26529
|
+
decode: decode14
|
26530
26530
|
};
|
26531
26531
|
}
|
26532
26532
|
__name(base4, "base");
|
@@ -26562,12 +26562,12 @@ var require_base2 = __commonJS({
|
|
26562
26562
|
"use strict";
|
26563
26563
|
var { encodeText } = require_util();
|
26564
26564
|
var Base = class {
|
26565
|
-
constructor(name5, code5, factory,
|
26565
|
+
constructor(name5, code5, factory, alphabet3) {
|
26566
26566
|
this.name = name5;
|
26567
26567
|
this.code = code5;
|
26568
26568
|
this.codeBuf = encodeText(this.code);
|
26569
|
-
this.alphabet =
|
26570
|
-
this.codec = factory(
|
26569
|
+
this.alphabet = alphabet3;
|
26570
|
+
this.codec = factory(alphabet3);
|
26571
26571
|
}
|
26572
26572
|
encode(buf2) {
|
26573
26573
|
return this.codec.encode(buf2);
|
@@ -26590,10 +26590,10 @@ var require_base2 = __commonJS({
|
|
26590
26590
|
var require_rfc4648 = __commonJS({
|
26591
26591
|
"../../node_modules/.pnpm/multibase@4.0.6/node_modules/multibase/src/rfc4648.js"(exports, module2) {
|
26592
26592
|
"use strict";
|
26593
|
-
var
|
26593
|
+
var decode14 = /* @__PURE__ */ __name((string2, alphabet3, bitsPerChar) => {
|
26594
26594
|
const codes = {};
|
26595
|
-
for (let i = 0; i <
|
26596
|
-
codes[
|
26595
|
+
for (let i = 0; i < alphabet3.length; ++i) {
|
26596
|
+
codes[alphabet3[i]] = i;
|
26597
26597
|
}
|
26598
26598
|
let end = string2.length;
|
26599
26599
|
while (string2[end - 1] === "=") {
|
@@ -26620,8 +26620,8 @@ var require_rfc4648 = __commonJS({
|
|
26620
26620
|
}
|
26621
26621
|
return out;
|
26622
26622
|
}, "decode");
|
26623
|
-
var
|
26624
|
-
const pad2 =
|
26623
|
+
var encode18 = /* @__PURE__ */ __name((data, alphabet3, bitsPerChar) => {
|
26624
|
+
const pad2 = alphabet3[alphabet3.length - 1] === "=";
|
26625
26625
|
const mask = (1 << bitsPerChar) - 1;
|
26626
26626
|
let out = "";
|
26627
26627
|
let bits = 0;
|
@@ -26631,11 +26631,11 @@ var require_rfc4648 = __commonJS({
|
|
26631
26631
|
bits += 8;
|
26632
26632
|
while (bits > bitsPerChar) {
|
26633
26633
|
bits -= bitsPerChar;
|
26634
|
-
out +=
|
26634
|
+
out += alphabet3[mask & buffer2 >> bits];
|
26635
26635
|
}
|
26636
26636
|
}
|
26637
26637
|
if (bits) {
|
26638
|
-
out +=
|
26638
|
+
out += alphabet3[mask & buffer2 << bitsPerChar - bits];
|
26639
26639
|
}
|
26640
26640
|
if (pad2) {
|
26641
26641
|
while (out.length * bitsPerChar & 7) {
|
@@ -26644,13 +26644,13 @@ var require_rfc4648 = __commonJS({
|
|
26644
26644
|
}
|
26645
26645
|
return out;
|
26646
26646
|
}, "encode");
|
26647
|
-
var rfc46482 = /* @__PURE__ */ __name((bitsPerChar) => (
|
26647
|
+
var rfc46482 = /* @__PURE__ */ __name((bitsPerChar) => (alphabet3) => {
|
26648
26648
|
return {
|
26649
26649
|
encode(input) {
|
26650
|
-
return
|
26650
|
+
return encode18(input, alphabet3, bitsPerChar);
|
26651
26651
|
},
|
26652
26652
|
decode(input) {
|
26653
|
-
return
|
26653
|
+
return decode14(input, alphabet3, bitsPerChar);
|
26654
26654
|
}
|
26655
26655
|
};
|
26656
26656
|
}, "rfc4648");
|
@@ -26727,13 +26727,13 @@ var require_src2 = __commonJS({
|
|
26727
26727
|
return concat4([codeBuf, buf2], codeBuf.length + buf2.length);
|
26728
26728
|
}
|
26729
26729
|
__name(multibase, "multibase");
|
26730
|
-
function
|
26730
|
+
function encode18(nameOrCode, buf2) {
|
26731
26731
|
const enc = encoding(nameOrCode);
|
26732
26732
|
const data = encodeText(enc.encode(buf2));
|
26733
26733
|
return concat4([enc.codeBuf, data], enc.codeBuf.length + data.length);
|
26734
26734
|
}
|
26735
|
-
__name(
|
26736
|
-
function
|
26735
|
+
__name(encode18, "encode");
|
26736
|
+
function decode14(data) {
|
26737
26737
|
if (data instanceof Uint8Array) {
|
26738
26738
|
data = decodeText(data);
|
26739
26739
|
}
|
@@ -26744,7 +26744,7 @@ var require_src2 = __commonJS({
|
|
26744
26744
|
const enc = encoding(data[0]);
|
26745
26745
|
return enc.decode(data.substring(1));
|
26746
26746
|
}
|
26747
|
-
__name(
|
26747
|
+
__name(decode14, "decode");
|
26748
26748
|
function isEncoded(data) {
|
26749
26749
|
if (data instanceof Uint8Array) {
|
26750
26750
|
data = decodeText(data);
|
@@ -26783,8 +26783,8 @@ var require_src2 = __commonJS({
|
|
26783
26783
|
}
|
26784
26784
|
__name(encodingFromData, "encodingFromData");
|
26785
26785
|
exports = module2.exports = multibase;
|
26786
|
-
exports.encode =
|
26787
|
-
exports.decode =
|
26786
|
+
exports.encode = encode18;
|
26787
|
+
exports.decode = decode14;
|
26788
26788
|
exports.isEncoded = isEncoded;
|
26789
26789
|
exports.encoding = encoding;
|
26790
26790
|
exports.encodingFromData = encodingFromData;
|
@@ -26870,17 +26870,17 @@ var require_bases = __commonJS({
|
|
26870
26870
|
"../../node_modules/.pnpm/uint8arrays@2.1.10/node_modules/uint8arrays/util/bases.js"(exports, module2) {
|
26871
26871
|
"use strict";
|
26872
26872
|
var { bases: bases2 } = (init_basics(), __toCommonJS(basics_exports));
|
26873
|
-
function createCodec2(name5, prefix,
|
26873
|
+
function createCodec2(name5, prefix, encode18, decode14) {
|
26874
26874
|
return {
|
26875
26875
|
name: name5,
|
26876
26876
|
prefix,
|
26877
26877
|
encoder: {
|
26878
26878
|
name: name5,
|
26879
26879
|
prefix,
|
26880
|
-
encode:
|
26880
|
+
encode: encode18
|
26881
26881
|
},
|
26882
26882
|
decoder: {
|
26883
|
-
decode:
|
26883
|
+
decode: decode14
|
26884
26884
|
}
|
26885
26885
|
};
|
26886
26886
|
}
|
@@ -26940,15 +26940,15 @@ var require_to_string = __commonJS({
|
|
26940
26940
|
"../../node_modules/.pnpm/uint8arrays@2.1.10/node_modules/uint8arrays/to-string.js"(exports, module2) {
|
26941
26941
|
"use strict";
|
26942
26942
|
var bases2 = require_bases();
|
26943
|
-
function
|
26943
|
+
function toString6(array, encoding = "utf8") {
|
26944
26944
|
const base4 = bases2[encoding];
|
26945
26945
|
if (!base4) {
|
26946
26946
|
throw new Error(`Unsupported encoding "${encoding}"`);
|
26947
26947
|
}
|
26948
26948
|
return base4.encoder.encode(array).substring(1);
|
26949
26949
|
}
|
26950
|
-
__name(
|
26951
|
-
module2.exports =
|
26950
|
+
__name(toString6, "toString");
|
26951
|
+
module2.exports = toString6;
|
26952
26952
|
}
|
26953
26953
|
});
|
26954
26954
|
|
@@ -26979,14 +26979,14 @@ var require_uint8arrays = __commonJS({
|
|
26979
26979
|
var concat4 = require_concat();
|
26980
26980
|
var equals4 = require_equals();
|
26981
26981
|
var fromString6 = require_from_string();
|
26982
|
-
var
|
26982
|
+
var toString6 = require_to_string();
|
26983
26983
|
var xor2 = require_xor();
|
26984
26984
|
module2.exports = {
|
26985
26985
|
compare: compare4,
|
26986
26986
|
concat: concat4,
|
26987
26987
|
equals: equals4,
|
26988
26988
|
fromString: fromString6,
|
26989
|
-
toString:
|
26989
|
+
toString: toString6,
|
26990
26990
|
xor: xor2
|
26991
26991
|
};
|
26992
26992
|
}
|
@@ -27233,7 +27233,7 @@ var require_fast_json_stable_stringify = __commonJS({
|
|
27233
27233
|
};
|
27234
27234
|
}(opts.cmp);
|
27235
27235
|
var seen = [];
|
27236
|
-
return (/* @__PURE__ */ __name(function
|
27236
|
+
return (/* @__PURE__ */ __name(function stringify3(node) {
|
27237
27237
|
if (node && node.toJSON && typeof node.toJSON === "function") {
|
27238
27238
|
node = node.toJSON();
|
27239
27239
|
}
|
@@ -27249,7 +27249,7 @@ var require_fast_json_stable_stringify = __commonJS({
|
|
27249
27249
|
for (i = 0; i < node.length; i++) {
|
27250
27250
|
if (i)
|
27251
27251
|
out += ",";
|
27252
|
-
out +=
|
27252
|
+
out += stringify3(node[i]) || "null";
|
27253
27253
|
}
|
27254
27254
|
return out + "]";
|
27255
27255
|
}
|
@@ -27265,7 +27265,7 @@ var require_fast_json_stable_stringify = __commonJS({
|
|
27265
27265
|
out = "";
|
27266
27266
|
for (i = 0; i < keys.length; i++) {
|
27267
27267
|
var key2 = keys[i];
|
27268
|
-
var value =
|
27268
|
+
var value = stringify3(node[key2]);
|
27269
27269
|
if (!value)
|
27270
27270
|
continue;
|
27271
27271
|
if (out)
|
@@ -28678,12 +28678,12 @@ var require_dataloader = __commonJS({
|
|
28678
28678
|
// ../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/encode.js
|
28679
28679
|
var require_encode2 = __commonJS({
|
28680
28680
|
"../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/encode.js"(exports, module2) {
|
28681
|
-
module2.exports =
|
28681
|
+
module2.exports = encode18;
|
28682
28682
|
var MSB2 = 128;
|
28683
28683
|
var REST2 = 127;
|
28684
28684
|
var MSBALL2 = ~REST2;
|
28685
28685
|
var INT2 = Math.pow(2, 31);
|
28686
|
-
function
|
28686
|
+
function encode18(num, out, offset) {
|
28687
28687
|
out = out || [];
|
28688
28688
|
offset = offset || 0;
|
28689
28689
|
var oldOffset = offset;
|
@@ -28696,10 +28696,10 @@ var require_encode2 = __commonJS({
|
|
28696
28696
|
num >>>= 7;
|
28697
28697
|
}
|
28698
28698
|
out[offset] = num | 0;
|
28699
|
-
|
28699
|
+
encode18.bytes = offset - oldOffset + 1;
|
28700
28700
|
return out;
|
28701
28701
|
}
|
28702
|
-
__name(
|
28702
|
+
__name(encode18, "encode");
|
28703
28703
|
}
|
28704
28704
|
});
|
28705
28705
|
|
@@ -28730,17 +28730,17 @@ var require_decode2 = __commonJS({
|
|
28730
28730
|
// ../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/length.js
|
28731
28731
|
var require_length2 = __commonJS({
|
28732
28732
|
"../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/length.js"(exports, module2) {
|
28733
|
-
var
|
28734
|
-
var
|
28735
|
-
var
|
28736
|
-
var
|
28733
|
+
var N13 = Math.pow(2, 7);
|
28734
|
+
var N23 = Math.pow(2, 14);
|
28735
|
+
var N33 = Math.pow(2, 21);
|
28736
|
+
var N43 = Math.pow(2, 28);
|
28737
28737
|
var N52 = Math.pow(2, 35);
|
28738
28738
|
var N62 = Math.pow(2, 42);
|
28739
28739
|
var N72 = Math.pow(2, 49);
|
28740
28740
|
var N82 = Math.pow(2, 56);
|
28741
28741
|
var N92 = Math.pow(2, 63);
|
28742
28742
|
module2.exports = function(value) {
|
28743
|
-
return value <
|
28743
|
+
return value < N13 ? 1 : value < N23 ? 2 : value < N33 ? 3 : value < N43 ? 4 : value < N52 ? 5 : value < N62 ? 6 : value < N72 ? 7 : value < N82 ? 8 : value < N92 ? 9 : 10;
|
28744
28744
|
};
|
28745
28745
|
}
|
28746
28746
|
});
|
@@ -29156,7 +29156,7 @@ var require_src3 = __commonJS({
|
|
29156
29156
|
return multibase.decode("z" + encoded);
|
29157
29157
|
}
|
29158
29158
|
__name(fromB58String, "fromB58String");
|
29159
|
-
function
|
29159
|
+
function decode14(bytes) {
|
29160
29160
|
if (!(bytes instanceof Uint8Array)) {
|
29161
29161
|
throw new Error("multihash must be a Uint8Array");
|
29162
29162
|
}
|
@@ -29183,8 +29183,8 @@ var require_src3 = __commonJS({
|
|
29183
29183
|
digest: bytes
|
29184
29184
|
};
|
29185
29185
|
}
|
29186
|
-
__name(
|
29187
|
-
function
|
29186
|
+
__name(decode14, "decode");
|
29187
|
+
function encode18(digest2, code5, length2) {
|
29188
29188
|
if (!digest2 || code5 === void 0) {
|
29189
29189
|
throw new Error("multihash encode requires at least two args: digest, code");
|
29190
29190
|
}
|
@@ -29202,7 +29202,7 @@ var require_src3 = __commonJS({
|
|
29202
29202
|
const len = varint5.encode(length2);
|
29203
29203
|
return uint8ArrayConcat([hash3, len, digest2], hash3.length + len.length + digest2.length);
|
29204
29204
|
}
|
29205
|
-
__name(
|
29205
|
+
__name(encode18, "encode");
|
29206
29206
|
function coerceCode(name5) {
|
29207
29207
|
let code5 = name5;
|
29208
29208
|
if (typeof name5 === "string") {
|
@@ -29234,12 +29234,12 @@ var require_src3 = __commonJS({
|
|
29234
29234
|
return false;
|
29235
29235
|
}
|
29236
29236
|
__name(isValidCode, "isValidCode");
|
29237
|
-
function
|
29238
|
-
|
29237
|
+
function validate7(multihash) {
|
29238
|
+
decode14(multihash);
|
29239
29239
|
}
|
29240
|
-
__name(
|
29240
|
+
__name(validate7, "validate");
|
29241
29241
|
function prefix(multihash) {
|
29242
|
-
|
29242
|
+
validate7(multihash);
|
29243
29243
|
return multihash.subarray(0, 2);
|
29244
29244
|
}
|
29245
29245
|
__name(prefix, "prefix");
|
@@ -29250,11 +29250,11 @@ var require_src3 = __commonJS({
|
|
29250
29250
|
fromHexString,
|
29251
29251
|
toB58String,
|
29252
29252
|
fromB58String,
|
29253
|
-
decode:
|
29254
|
-
encode:
|
29253
|
+
decode: decode14,
|
29254
|
+
encode: encode18,
|
29255
29255
|
coerceCode,
|
29256
29256
|
isAppCode,
|
29257
|
-
validate:
|
29257
|
+
validate: validate7,
|
29258
29258
|
prefix,
|
29259
29259
|
isValidCode
|
29260
29260
|
};
|
@@ -35212,6 +35212,57 @@ var require_uniswap_default_tokenlist = __commonJS({
|
|
35212
35212
|
}
|
35213
35213
|
});
|
35214
35214
|
|
35215
|
+
// ../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js
|
35216
|
+
var require_base32_decode = __commonJS({
|
35217
|
+
"../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js"(exports, module2) {
|
35218
|
+
var RFC46482 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
35219
|
+
var RFC4648_HEX2 = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
35220
|
+
var CROCKFORD2 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
35221
|
+
function readChar(alphabet3, char) {
|
35222
|
+
var idx = alphabet3.indexOf(char);
|
35223
|
+
if (idx === -1) {
|
35224
|
+
throw new Error("Invalid character found: " + char);
|
35225
|
+
}
|
35226
|
+
return idx;
|
35227
|
+
}
|
35228
|
+
__name(readChar, "readChar");
|
35229
|
+
module2.exports = /* @__PURE__ */ __name(function base32Decode2(input, variant) {
|
35230
|
+
var alphabet3;
|
35231
|
+
switch (variant) {
|
35232
|
+
case "RFC3548":
|
35233
|
+
case "RFC4648":
|
35234
|
+
alphabet3 = RFC46482;
|
35235
|
+
input = input.replace(/=+$/, "");
|
35236
|
+
break;
|
35237
|
+
case "RFC4648-HEX":
|
35238
|
+
alphabet3 = RFC4648_HEX2;
|
35239
|
+
input = input.replace(/=+$/, "");
|
35240
|
+
break;
|
35241
|
+
case "Crockford":
|
35242
|
+
alphabet3 = CROCKFORD2;
|
35243
|
+
input = input.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1");
|
35244
|
+
break;
|
35245
|
+
default:
|
35246
|
+
throw new Error("Unknown base32 variant: " + variant);
|
35247
|
+
}
|
35248
|
+
var length2 = input.length;
|
35249
|
+
var bits = 0;
|
35250
|
+
var value = 0;
|
35251
|
+
var index = 0;
|
35252
|
+
var output = new Uint8Array(length2 * 5 / 8 | 0);
|
35253
|
+
for (var i = 0; i < length2; i++) {
|
35254
|
+
value = value << 5 | readChar(alphabet3, input[i]);
|
35255
|
+
bits += 5;
|
35256
|
+
if (bits >= 8) {
|
35257
|
+
output[index++] = value >>> bits - 8 & 255;
|
35258
|
+
bits -= 8;
|
35259
|
+
}
|
35260
|
+
}
|
35261
|
+
return output.buffer;
|
35262
|
+
}, "base32Decode");
|
35263
|
+
}
|
35264
|
+
});
|
35265
|
+
|
35215
35266
|
// src/index.ts
|
35216
35267
|
var src_exports2 = {};
|
35217
35268
|
__export(src_exports2, {
|
@@ -44096,7 +44147,7 @@ var ChainId = /* @__PURE__ */ function() {
|
|
44096
44147
|
this.reference = params.reference;
|
44097
44148
|
}
|
44098
44149
|
__name(ChainId2, "ChainId");
|
44099
|
-
ChainId2.parse = /* @__PURE__ */ __name(function
|
44150
|
+
ChainId2.parse = /* @__PURE__ */ __name(function parse3(id) {
|
44100
44151
|
if (!isValidId(id, this.spec)) {
|
44101
44152
|
throw new Error("Invalid " + this.spec.name + " provided: " + id);
|
44102
44153
|
}
|
@@ -44106,7 +44157,7 @@ var ChainId = /* @__PURE__ */ function() {
|
|
44106
44157
|
return joinParams(params, this.spec);
|
44107
44158
|
}, "format");
|
44108
44159
|
var _proto = ChainId2.prototype;
|
44109
|
-
_proto.toString = /* @__PURE__ */ __name(function
|
44160
|
+
_proto.toString = /* @__PURE__ */ __name(function toString6() {
|
44110
44161
|
return ChainId2.format(this.toJSON());
|
44111
44162
|
}, "toString");
|
44112
44163
|
_proto.toJSON = /* @__PURE__ */ __name(function toJSON2() {
|
@@ -44127,7 +44178,7 @@ var AccountId = /* @__PURE__ */ function() {
|
|
44127
44178
|
this.address = params.address;
|
44128
44179
|
}
|
44129
44180
|
__name(AccountId2, "AccountId");
|
44130
|
-
AccountId2.parse = /* @__PURE__ */ __name(function
|
44181
|
+
AccountId2.parse = /* @__PURE__ */ __name(function parse3(id) {
|
44131
44182
|
if (!isValidId(id, this.spec)) {
|
44132
44183
|
throw new Error("Invalid " + this.spec.name + " provided: " + id);
|
44133
44184
|
}
|
@@ -44149,7 +44200,7 @@ var AccountId = /* @__PURE__ */ function() {
|
|
44149
44200
|
return joinParams(splitParams2, this.spec);
|
44150
44201
|
}, "format");
|
44151
44202
|
var _proto = AccountId2.prototype;
|
44152
|
-
_proto.toString = /* @__PURE__ */ __name(function
|
44203
|
+
_proto.toString = /* @__PURE__ */ __name(function toString6() {
|
44153
44204
|
return AccountId2.format(this.toJSON());
|
44154
44205
|
}, "toString");
|
44155
44206
|
_proto.toJSON = /* @__PURE__ */ __name(function toJSON2() {
|
@@ -44170,7 +44221,7 @@ var AssetName = /* @__PURE__ */ function() {
|
|
44170
44221
|
this.reference = params.reference;
|
44171
44222
|
}
|
44172
44223
|
__name(AssetName2, "AssetName");
|
44173
|
-
AssetName2.parse = /* @__PURE__ */ __name(function
|
44224
|
+
AssetName2.parse = /* @__PURE__ */ __name(function parse3(id) {
|
44174
44225
|
if (!isValidId(id, this.spec)) {
|
44175
44226
|
throw new Error("Invalid " + this.spec.name + " provided: " + id);
|
44176
44227
|
}
|
@@ -44180,7 +44231,7 @@ var AssetName = /* @__PURE__ */ function() {
|
|
44180
44231
|
return joinParams(params, this.spec);
|
44181
44232
|
}, "format");
|
44182
44233
|
var _proto = AssetName2.prototype;
|
44183
|
-
_proto.toString = /* @__PURE__ */ __name(function
|
44234
|
+
_proto.toString = /* @__PURE__ */ __name(function toString6() {
|
44184
44235
|
return AssetName2.format(this.toJSON());
|
44185
44236
|
}, "toString");
|
44186
44237
|
_proto.toJSON = /* @__PURE__ */ __name(function toJSON2() {
|
@@ -44201,7 +44252,7 @@ var AssetType = /* @__PURE__ */ function() {
|
|
44201
44252
|
this.assetName = new AssetName(params.assetName);
|
44202
44253
|
}
|
44203
44254
|
__name(AssetType2, "AssetType");
|
44204
|
-
AssetType2.parse = /* @__PURE__ */ __name(function
|
44255
|
+
AssetType2.parse = /* @__PURE__ */ __name(function parse3(id) {
|
44205
44256
|
if (!isValidId(id, this.spec)) {
|
44206
44257
|
throw new Error("Invalid " + this.spec.name + " provided: " + id);
|
44207
44258
|
}
|
@@ -44211,7 +44262,7 @@ var AssetType = /* @__PURE__ */ function() {
|
|
44211
44262
|
return joinParams(params, this.spec);
|
44212
44263
|
}, "format");
|
44213
44264
|
var _proto = AssetType2.prototype;
|
44214
|
-
_proto.toString = /* @__PURE__ */ __name(function
|
44265
|
+
_proto.toString = /* @__PURE__ */ __name(function toString6() {
|
44215
44266
|
return AssetType2.format(this.toJSON());
|
44216
44267
|
}, "toString");
|
44217
44268
|
_proto.toJSON = /* @__PURE__ */ __name(function toJSON2() {
|
@@ -44233,7 +44284,7 @@ var AssetId = /* @__PURE__ */ function() {
|
|
44233
44284
|
this.tokenId = params.tokenId;
|
44234
44285
|
}
|
44235
44286
|
__name(AssetId2, "AssetId");
|
44236
|
-
AssetId2.parse = /* @__PURE__ */ __name(function
|
44287
|
+
AssetId2.parse = /* @__PURE__ */ __name(function parse3(id) {
|
44237
44288
|
if (!isValidId(id, this.spec)) {
|
44238
44289
|
throw new Error("Invalid " + this.spec.name + " provided: " + id);
|
44239
44290
|
}
|
@@ -44243,7 +44294,7 @@ var AssetId = /* @__PURE__ */ function() {
|
|
44243
44294
|
return joinParams(params, this.spec);
|
44244
44295
|
}, "format");
|
44245
44296
|
var _proto = AssetId2.prototype;
|
44246
|
-
_proto.toString = /* @__PURE__ */ __name(function
|
44297
|
+
_proto.toString = /* @__PURE__ */ __name(function toString6() {
|
44247
44298
|
return AssetId2.format(this.toJSON());
|
44248
44299
|
}, "toString");
|
44249
44300
|
_proto.toJSON = /* @__PURE__ */ __name(function toJSON2() {
|
@@ -44323,10 +44374,10 @@ var ErrorCode;
|
|
44323
44374
|
})(ErrorCode || (ErrorCode = {}));
|
44324
44375
|
var HEX = "0123456789abcdef";
|
44325
44376
|
var Logger = class {
|
44326
|
-
constructor(
|
44377
|
+
constructor(version12) {
|
44327
44378
|
Object.defineProperty(this, "version", {
|
44328
44379
|
enumerable: true,
|
44329
|
-
value:
|
44380
|
+
value: version12,
|
44330
44381
|
writable: false
|
44331
44382
|
});
|
44332
44383
|
}
|
@@ -44541,8 +44592,8 @@ var Logger = class {
|
|
44541
44592
|
}
|
44542
44593
|
_logLevel = level;
|
44543
44594
|
}
|
44544
|
-
static from(
|
44545
|
-
return new Logger(
|
44595
|
+
static from(version12) {
|
44596
|
+
return new Logger(version12);
|
44546
44597
|
}
|
44547
44598
|
};
|
44548
44599
|
__name(Logger, "Logger");
|
@@ -45189,7 +45240,7 @@ var utils_1 = createCommonjsModule(function(module2, exports) {
|
|
45189
45240
|
}
|
45190
45241
|
__name(toHex2, "toHex");
|
45191
45242
|
utils.toHex = toHex2;
|
45192
|
-
utils.encode = /* @__PURE__ */ __name(function
|
45243
|
+
utils.encode = /* @__PURE__ */ __name(function encode18(arr, enc) {
|
45193
45244
|
if (enc === "hex")
|
45194
45245
|
return toHex2(arr);
|
45195
45246
|
else
|
@@ -47303,14 +47354,14 @@ var ParsedMessage = class {
|
|
47303
47354
|
return ret;
|
47304
47355
|
}, "uri");
|
47305
47356
|
parser.ast.callbacks.uri = uri;
|
47306
|
-
const
|
47357
|
+
const version12 = /* @__PURE__ */ __name(function(state, chars, phraseIndex, phraseLength, data) {
|
47307
47358
|
const ret = id.SEM_OK;
|
47308
47359
|
if (state === id.SEM_PRE) {
|
47309
47360
|
data.version = import_node_exports.default.utils.charsToString(chars, phraseIndex, phraseLength);
|
47310
47361
|
}
|
47311
47362
|
return ret;
|
47312
47363
|
}, "version");
|
47313
|
-
parser.ast.callbacks.version =
|
47364
|
+
parser.ast.callbacks.version = version12;
|
47314
47365
|
const chainId = /* @__PURE__ */ __name(function(state, chars, phraseIndex, phraseLength, data) {
|
47315
47366
|
const ret = id.SEM_OK;
|
47316
47367
|
if (state === id.SEM_PRE) {
|
@@ -53781,6 +53832,3170 @@ var getEthereumPlugin = /* @__PURE__ */ __name((initWallet, config2) => {
|
|
53781
53832
|
};
|
53782
53833
|
}, "getEthereumPlugin");
|
53783
53834
|
|
53835
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/CborldError.js
|
53836
|
+
var CborldError = class extends Error {
|
53837
|
+
constructor(value, message) {
|
53838
|
+
super();
|
53839
|
+
this.message = message;
|
53840
|
+
this.value = value;
|
53841
|
+
this.stack = new Error(`${value}: ${message}`).stack;
|
53842
|
+
this.name = this.constructor.name;
|
53843
|
+
}
|
53844
|
+
};
|
53845
|
+
__name(CborldError, "CborldError");
|
53846
|
+
|
53847
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/CborldDecoder.js
|
53848
|
+
var CborldDecoder = class {
|
53849
|
+
decode({ value } = {}) {
|
53850
|
+
throw new Error("Must be implemented by derived class.");
|
53851
|
+
}
|
53852
|
+
static createDecoder({ value, transformer } = {}) {
|
53853
|
+
throw new Error("Must be implemented by derived class.");
|
53854
|
+
}
|
53855
|
+
};
|
53856
|
+
__name(CborldDecoder, "CborldDecoder");
|
53857
|
+
|
53858
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/registeredContexts.js
|
53859
|
+
var ID_TO_URL = /* @__PURE__ */ new Map();
|
53860
|
+
var URL_TO_ID = /* @__PURE__ */ new Map();
|
53861
|
+
_addRegistration(16, "https://www.w3.org/ns/activitystreams");
|
53862
|
+
_addRegistration(17, "https://www.w3.org/2018/credentials/v1");
|
53863
|
+
_addRegistration(18, "https://www.w3.org/ns/did/v1");
|
53864
|
+
_addRegistration(19, "https://w3id.org/security/suites/ed25519-2018/v1");
|
53865
|
+
_addRegistration(20, "https://w3id.org/security/suites/ed25519-2020/v1");
|
53866
|
+
_addRegistration(21, "https://w3id.org/cit/v1");
|
53867
|
+
_addRegistration(22, "https://w3id.org/age/v1");
|
53868
|
+
_addRegistration(23, "https://w3id.org/security/suites/x25519-2020/v1");
|
53869
|
+
_addRegistration(24, "https://w3id.org/veres-one/v1");
|
53870
|
+
_addRegistration(25, "https://w3id.org/webkms/v1");
|
53871
|
+
_addRegistration(26, "https://w3id.org/zcap/v1");
|
53872
|
+
_addRegistration(27, "https://w3id.org/security/suites/hmac-2019/v1");
|
53873
|
+
_addRegistration(28, "https://w3id.org/security/suites/aes-2019/v1");
|
53874
|
+
_addRegistration(29, "https://w3id.org/vaccination/v1");
|
53875
|
+
_addRegistration(30, "https://w3id.org/vc-revocation-list-2020/v1");
|
53876
|
+
_addRegistration(31, "https://w3id.org/dcc/v1c");
|
53877
|
+
_addRegistration(32, "https://w3id.org/vc/status-list/v1");
|
53878
|
+
function _addRegistration(id, url) {
|
53879
|
+
URL_TO_ID.set(url, id);
|
53880
|
+
ID_TO_URL.set(id, url);
|
53881
|
+
}
|
53882
|
+
__name(_addRegistration, "_addRegistration");
|
53883
|
+
|
53884
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/ContextDecoder.js
|
53885
|
+
var ContextDecoder = class extends CborldDecoder {
|
53886
|
+
constructor({ reverseAppContextMap } = {}) {
|
53887
|
+
super();
|
53888
|
+
this.reverseAppContextMap = reverseAppContextMap;
|
53889
|
+
}
|
53890
|
+
decode({ value } = {}) {
|
53891
|
+
if (typeof value !== "number") {
|
53892
|
+
return _mapToObject(value);
|
53893
|
+
}
|
53894
|
+
const url = ID_TO_URL.get(value) || this.reverseAppContextMap.get(value);
|
53895
|
+
if (url === void 0) {
|
53896
|
+
throw new CborldError("ERR_UNDEFINED_COMPRESSED_CONTEXT", `Undefined compressed context "${value}".`);
|
53897
|
+
}
|
53898
|
+
return url;
|
53899
|
+
}
|
53900
|
+
static createDecoder({ transformer } = {}) {
|
53901
|
+
const { reverseAppContextMap } = transformer;
|
53902
|
+
return new ContextDecoder({ reverseAppContextMap });
|
53903
|
+
}
|
53904
|
+
};
|
53905
|
+
__name(ContextDecoder, "ContextDecoder");
|
53906
|
+
function _mapToObject(map2) {
|
53907
|
+
if (Array.isArray(map2)) {
|
53908
|
+
return map2.map(_mapToObject);
|
53909
|
+
}
|
53910
|
+
if (!(map2 instanceof Map)) {
|
53911
|
+
return map2;
|
53912
|
+
}
|
53913
|
+
const obj = {};
|
53914
|
+
for (const [key2, value] of map2) {
|
53915
|
+
obj[key2] = _mapToObject(value);
|
53916
|
+
}
|
53917
|
+
return obj;
|
53918
|
+
}
|
53919
|
+
__name(_mapToObject, "_mapToObject");
|
53920
|
+
|
53921
|
+
// ../../node_modules/.pnpm/js-base64@3.7.2/node_modules/js-base64/base64.mjs
|
53922
|
+
var version11 = "3.7.2";
|
53923
|
+
var VERSION = version11;
|
53924
|
+
var _hasatob = typeof atob === "function";
|
53925
|
+
var _hasbtoa = typeof btoa === "function";
|
53926
|
+
var _hasBuffer = typeof Buffer === "function";
|
53927
|
+
var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
53928
|
+
var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
53929
|
+
var b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
53930
|
+
var b64chs = Array.prototype.slice.call(b64ch);
|
53931
|
+
var b64tab = ((a) => {
|
53932
|
+
let tab = {};
|
53933
|
+
a.forEach((c, i) => tab[c] = i);
|
53934
|
+
return tab;
|
53935
|
+
})(b64chs);
|
53936
|
+
var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
53937
|
+
var _fromCC = String.fromCharCode.bind(String);
|
53938
|
+
var _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it, fn = (x) => x) => new Uint8Array(Array.prototype.slice.call(it, 0).map(fn));
|
53939
|
+
var _mkUriSafe = /* @__PURE__ */ __name((src2) => src2.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_"), "_mkUriSafe");
|
53940
|
+
var _tidyB64 = /* @__PURE__ */ __name((s) => s.replace(/[^A-Za-z0-9\+\/]/g, ""), "_tidyB64");
|
53941
|
+
var btoaPolyfill = /* @__PURE__ */ __name((bin) => {
|
53942
|
+
let u32, c0, c1, c2, asc = "";
|
53943
|
+
const pad2 = bin.length % 3;
|
53944
|
+
for (let i = 0; i < bin.length; ) {
|
53945
|
+
if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255)
|
53946
|
+
throw new TypeError("invalid character found");
|
53947
|
+
u32 = c0 << 16 | c1 << 8 | c2;
|
53948
|
+
asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
|
53949
|
+
}
|
53950
|
+
return pad2 ? asc.slice(0, pad2 - 3) + "===".substring(pad2) : asc;
|
53951
|
+
}, "btoaPolyfill");
|
53952
|
+
var _btoa = _hasbtoa ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
|
53953
|
+
var _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
|
53954
|
+
const maxargs = 4096;
|
53955
|
+
let strs = [];
|
53956
|
+
for (let i = 0, l = u8a.length; i < l; i += maxargs) {
|
53957
|
+
strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
|
53958
|
+
}
|
53959
|
+
return _btoa(strs.join(""));
|
53960
|
+
};
|
53961
|
+
var fromUint8Array = /* @__PURE__ */ __name((u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a), "fromUint8Array");
|
53962
|
+
var cb_utob = /* @__PURE__ */ __name((c) => {
|
53963
|
+
if (c.length < 2) {
|
53964
|
+
var cc = c.charCodeAt(0);
|
53965
|
+
return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
53966
|
+
} else {
|
53967
|
+
var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
|
53968
|
+
return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
53969
|
+
}
|
53970
|
+
}, "cb_utob");
|
53971
|
+
var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
53972
|
+
var utob = /* @__PURE__ */ __name((u) => u.replace(re_utob, cb_utob), "utob");
|
53973
|
+
var _encode2 = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
|
53974
|
+
var encode11 = /* @__PURE__ */ __name((src2, urlsafe = false) => urlsafe ? _mkUriSafe(_encode2(src2)) : _encode2(src2), "encode");
|
53975
|
+
var encodeURI = /* @__PURE__ */ __name((src2) => encode11(src2, true), "encodeURI");
|
53976
|
+
var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
53977
|
+
var cb_btou = /* @__PURE__ */ __name((cccc) => {
|
53978
|
+
switch (cccc.length) {
|
53979
|
+
case 4:
|
53980
|
+
var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
|
53981
|
+
return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
|
53982
|
+
case 3:
|
53983
|
+
return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
|
53984
|
+
default:
|
53985
|
+
return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
|
53986
|
+
}
|
53987
|
+
}, "cb_btou");
|
53988
|
+
var btou = /* @__PURE__ */ __name((b) => b.replace(re_btou, cb_btou), "btou");
|
53989
|
+
var atobPolyfill = /* @__PURE__ */ __name((asc) => {
|
53990
|
+
asc = asc.replace(/\s+/g, "");
|
53991
|
+
if (!b64re.test(asc))
|
53992
|
+
throw new TypeError("malformed base64.");
|
53993
|
+
asc += "==".slice(2 - (asc.length & 3));
|
53994
|
+
let u24, bin = "", r1, r2;
|
53995
|
+
for (let i = 0; i < asc.length; ) {
|
53996
|
+
u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]);
|
53997
|
+
bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
|
53998
|
+
}
|
53999
|
+
return bin;
|
54000
|
+
}, "atobPolyfill");
|
54001
|
+
var _atob = _hasatob ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
|
54002
|
+
var _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a), (c) => c.charCodeAt(0));
|
54003
|
+
var toUint8Array2 = /* @__PURE__ */ __name((a) => _toUint8Array(_unURI(a)), "toUint8Array");
|
54004
|
+
var _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
|
54005
|
+
var _unURI = /* @__PURE__ */ __name((a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/")), "_unURI");
|
54006
|
+
var decode10 = /* @__PURE__ */ __name((src2) => _decode(_unURI(src2)), "decode");
|
54007
|
+
var isValid3 = /* @__PURE__ */ __name((src2) => {
|
54008
|
+
if (typeof src2 !== "string")
|
54009
|
+
return false;
|
54010
|
+
const s = src2.replace(/\s+/g, "").replace(/={0,2}$/, "");
|
54011
|
+
return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
|
54012
|
+
}, "isValid");
|
54013
|
+
var _noEnum = /* @__PURE__ */ __name((v) => {
|
54014
|
+
return {
|
54015
|
+
value: v,
|
54016
|
+
enumerable: false,
|
54017
|
+
writable: true,
|
54018
|
+
configurable: true
|
54019
|
+
};
|
54020
|
+
}, "_noEnum");
|
54021
|
+
var extendString = /* @__PURE__ */ __name(function() {
|
54022
|
+
const _add = /* @__PURE__ */ __name((name5, body) => Object.defineProperty(String.prototype, name5, _noEnum(body)), "_add");
|
54023
|
+
_add("fromBase64", function() {
|
54024
|
+
return decode10(this);
|
54025
|
+
});
|
54026
|
+
_add("toBase64", function(urlsafe) {
|
54027
|
+
return encode11(this, urlsafe);
|
54028
|
+
});
|
54029
|
+
_add("toBase64URI", function() {
|
54030
|
+
return encode11(this, true);
|
54031
|
+
});
|
54032
|
+
_add("toBase64URL", function() {
|
54033
|
+
return encode11(this, true);
|
54034
|
+
});
|
54035
|
+
_add("toUint8Array", function() {
|
54036
|
+
return toUint8Array2(this);
|
54037
|
+
});
|
54038
|
+
}, "extendString");
|
54039
|
+
var extendUint8Array = /* @__PURE__ */ __name(function() {
|
54040
|
+
const _add = /* @__PURE__ */ __name((name5, body) => Object.defineProperty(Uint8Array.prototype, name5, _noEnum(body)), "_add");
|
54041
|
+
_add("toBase64", function(urlsafe) {
|
54042
|
+
return fromUint8Array(this, urlsafe);
|
54043
|
+
});
|
54044
|
+
_add("toBase64URI", function() {
|
54045
|
+
return fromUint8Array(this, true);
|
54046
|
+
});
|
54047
|
+
_add("toBase64URL", function() {
|
54048
|
+
return fromUint8Array(this, true);
|
54049
|
+
});
|
54050
|
+
}, "extendUint8Array");
|
54051
|
+
var extendBuiltins = /* @__PURE__ */ __name(() => {
|
54052
|
+
extendString();
|
54053
|
+
extendUint8Array();
|
54054
|
+
}, "extendBuiltins");
|
54055
|
+
var gBase64 = {
|
54056
|
+
version: version11,
|
54057
|
+
VERSION,
|
54058
|
+
atob: _atob,
|
54059
|
+
atobPolyfill,
|
54060
|
+
btoa: _btoa,
|
54061
|
+
btoaPolyfill,
|
54062
|
+
fromBase64: decode10,
|
54063
|
+
toBase64: encode11,
|
54064
|
+
encode: encode11,
|
54065
|
+
encodeURI,
|
54066
|
+
encodeURL: encodeURI,
|
54067
|
+
utob,
|
54068
|
+
btou,
|
54069
|
+
decode: decode10,
|
54070
|
+
isValid: isValid3,
|
54071
|
+
fromUint8Array,
|
54072
|
+
toUint8Array: toUint8Array2,
|
54073
|
+
extendString,
|
54074
|
+
extendUint8Array,
|
54075
|
+
extendBuiltins
|
54076
|
+
};
|
54077
|
+
|
54078
|
+
// ../../node_modules/.pnpm/base58-universal@2.0.0/node_modules/base58-universal/lib/baseN.js
|
54079
|
+
var _reverseAlphabets = {};
|
54080
|
+
function encode12(input, alphabet3, maxline) {
|
54081
|
+
if (!(input instanceof Uint8Array)) {
|
54082
|
+
throw new TypeError('"input" must be a Uint8Array.');
|
54083
|
+
}
|
54084
|
+
if (typeof alphabet3 !== "string") {
|
54085
|
+
throw new TypeError('"alphabet" must be a string.');
|
54086
|
+
}
|
54087
|
+
if (maxline !== void 0 && typeof maxline !== "number") {
|
54088
|
+
throw new TypeError('"maxline" must be a number.');
|
54089
|
+
}
|
54090
|
+
if (input.length === 0) {
|
54091
|
+
return "";
|
54092
|
+
}
|
54093
|
+
let output = "";
|
54094
|
+
let i = 0;
|
54095
|
+
const base4 = alphabet3.length;
|
54096
|
+
const first2 = alphabet3.charAt(0);
|
54097
|
+
const digits = [0];
|
54098
|
+
for (i = 0; i < input.length; ++i) {
|
54099
|
+
let carry = input[i];
|
54100
|
+
for (let j = 0; j < digits.length; ++j) {
|
54101
|
+
carry += digits[j] << 8;
|
54102
|
+
digits[j] = carry % base4;
|
54103
|
+
carry = carry / base4 | 0;
|
54104
|
+
}
|
54105
|
+
while (carry > 0) {
|
54106
|
+
digits.push(carry % base4);
|
54107
|
+
carry = carry / base4 | 0;
|
54108
|
+
}
|
54109
|
+
}
|
54110
|
+
for (i = 0; input[i] === 0 && i < input.length - 1; ++i) {
|
54111
|
+
output += first2;
|
54112
|
+
}
|
54113
|
+
for (i = digits.length - 1; i >= 0; --i) {
|
54114
|
+
output += alphabet3[digits[i]];
|
54115
|
+
}
|
54116
|
+
if (maxline) {
|
54117
|
+
const regex = new RegExp(".{1," + maxline + "}", "g");
|
54118
|
+
output = output.match(regex).join("\r\n");
|
54119
|
+
}
|
54120
|
+
return output;
|
54121
|
+
}
|
54122
|
+
__name(encode12, "encode");
|
54123
|
+
function decode11(input, alphabet3) {
|
54124
|
+
if (typeof input !== "string") {
|
54125
|
+
throw new TypeError('"input" must be a string.');
|
54126
|
+
}
|
54127
|
+
if (typeof alphabet3 !== "string") {
|
54128
|
+
throw new TypeError('"alphabet" must be a string.');
|
54129
|
+
}
|
54130
|
+
if (input.length === 0) {
|
54131
|
+
return new Uint8Array();
|
54132
|
+
}
|
54133
|
+
let table = _reverseAlphabets[alphabet3];
|
54134
|
+
if (!table) {
|
54135
|
+
table = _reverseAlphabets[alphabet3] = [];
|
54136
|
+
for (let i = 0; i < alphabet3.length; ++i) {
|
54137
|
+
table[alphabet3.charCodeAt(i)] = i;
|
54138
|
+
}
|
54139
|
+
}
|
54140
|
+
input = input.replace(/\s/g, "");
|
54141
|
+
const base4 = alphabet3.length;
|
54142
|
+
const first2 = alphabet3.charAt(0);
|
54143
|
+
const bytes = [0];
|
54144
|
+
for (let i = 0; i < input.length; i++) {
|
54145
|
+
const value = table[input.charCodeAt(i)];
|
54146
|
+
if (value === void 0) {
|
54147
|
+
return;
|
54148
|
+
}
|
54149
|
+
let carry = value;
|
54150
|
+
for (let j = 0; j < bytes.length; ++j) {
|
54151
|
+
carry += bytes[j] * base4;
|
54152
|
+
bytes[j] = carry & 255;
|
54153
|
+
carry >>= 8;
|
54154
|
+
}
|
54155
|
+
while (carry > 0) {
|
54156
|
+
bytes.push(carry & 255);
|
54157
|
+
carry >>= 8;
|
54158
|
+
}
|
54159
|
+
}
|
54160
|
+
for (let k = 0; input[k] === first2 && k < input.length - 1; ++k) {
|
54161
|
+
bytes.push(0);
|
54162
|
+
}
|
54163
|
+
return new Uint8Array(bytes.reverse());
|
54164
|
+
}
|
54165
|
+
__name(decode11, "decode");
|
54166
|
+
|
54167
|
+
// ../../node_modules/.pnpm/base58-universal@2.0.0/node_modules/base58-universal/lib/index.js
|
54168
|
+
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
54169
|
+
function encode13(input, maxline) {
|
54170
|
+
return encode12(input, alphabet2, maxline);
|
54171
|
+
}
|
54172
|
+
__name(encode13, "encode");
|
54173
|
+
function decode12(input) {
|
54174
|
+
return decode11(input, alphabet2);
|
54175
|
+
}
|
54176
|
+
__name(decode12, "decode");
|
54177
|
+
|
54178
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseDecoder.js
|
54179
|
+
var MultibaseDecoder = class extends CborldDecoder {
|
54180
|
+
decode({ value } = {}) {
|
54181
|
+
const { buffer: buffer2, byteOffset, length: length2 } = value;
|
54182
|
+
const suffix = new Uint8Array(buffer2, byteOffset + 1, length2 - 1);
|
54183
|
+
if (value[0] === 122) {
|
54184
|
+
return `z${encode13(suffix)}`;
|
54185
|
+
}
|
54186
|
+
if (value[0] === 77) {
|
54187
|
+
return `M${gBase64.fromUint8Array(suffix)}`;
|
54188
|
+
}
|
54189
|
+
return value;
|
54190
|
+
}
|
54191
|
+
static createDecoder({ value } = {}) {
|
54192
|
+
if (!(value instanceof Uint8Array)) {
|
54193
|
+
return false;
|
54194
|
+
}
|
54195
|
+
if (value[0] === 122 || value[0] === 77) {
|
54196
|
+
return new MultibaseDecoder();
|
54197
|
+
}
|
54198
|
+
}
|
54199
|
+
};
|
54200
|
+
__name(MultibaseDecoder, "MultibaseDecoder");
|
54201
|
+
|
54202
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/keywords.js
|
54203
|
+
var KEYWORDS = /* @__PURE__ */ new Map([
|
54204
|
+
["@context", 0],
|
54205
|
+
["@type", 2],
|
54206
|
+
["@id", 4],
|
54207
|
+
["@value", 6],
|
54208
|
+
["@direction", 8],
|
54209
|
+
["@graph", 10],
|
54210
|
+
["@included", 12],
|
54211
|
+
["@index", 14],
|
54212
|
+
["@json", 16],
|
54213
|
+
["@language", 18],
|
54214
|
+
["@list", 20],
|
54215
|
+
["@nest", 22],
|
54216
|
+
["@reverse", 24],
|
54217
|
+
["@base", 26],
|
54218
|
+
["@container", 28],
|
54219
|
+
["@default", 30],
|
54220
|
+
["@embed", 32],
|
54221
|
+
["@explicit", 34],
|
54222
|
+
["@none", 36],
|
54223
|
+
["@omitDefault", 38],
|
54224
|
+
["@prefix", 40],
|
54225
|
+
["@preserve", 42],
|
54226
|
+
["@protected", 44],
|
54227
|
+
["@requireAll", 46],
|
54228
|
+
["@set", 48],
|
54229
|
+
["@version", 50],
|
54230
|
+
["@vocab", 52]
|
54231
|
+
]);
|
54232
|
+
var FIRST_CUSTOM_TERM_ID = 100;
|
54233
|
+
|
54234
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/Transformer.js
|
54235
|
+
var Transformer = class {
|
54236
|
+
constructor({ appContextMap, documentLoader } = {}) {
|
54237
|
+
this.appContextMap = appContextMap;
|
54238
|
+
this.documentLoader = documentLoader;
|
54239
|
+
}
|
54240
|
+
_beforeObjectContexts() {
|
54241
|
+
}
|
54242
|
+
_afterObjectContexts() {
|
54243
|
+
}
|
54244
|
+
_beforeTypeScopedContexts() {
|
54245
|
+
}
|
54246
|
+
_transform(_0) {
|
54247
|
+
return __async(this, arguments, function* ({ obj, transformMap, contextStack = [] }) {
|
54248
|
+
this._beforeObjectContexts({ obj, transformMap });
|
54249
|
+
let activeCtx = yield this._applyEmbeddedContexts({ obj, contextStack });
|
54250
|
+
this._afterObjectContexts({ obj, transformMap });
|
54251
|
+
const childContextStack = contextStack.slice();
|
54252
|
+
this._beforeTypeScopedContexts({ activeCtx, obj, transformMap });
|
54253
|
+
activeCtx = yield this._applyTypeScopedContexts({ obj, contextStack });
|
54254
|
+
const { aliases, scopedContextMap, termMap } = activeCtx;
|
54255
|
+
const termEntries = this._getEntries({ obj, transformMap, transformer: this, termMap });
|
54256
|
+
for (const [termInfo, value] of termEntries) {
|
54257
|
+
const { term } = termInfo;
|
54258
|
+
if (term === "@id" || aliases.id.has(term)) {
|
54259
|
+
this._transformObjectId({ obj, transformMap, termInfo, value });
|
54260
|
+
continue;
|
54261
|
+
}
|
54262
|
+
if (term === "@type" || aliases.type.has(term)) {
|
54263
|
+
this._transformObjectType({ obj, transformMap, termInfo, value });
|
54264
|
+
continue;
|
54265
|
+
}
|
54266
|
+
let propertyContextStack = childContextStack;
|
54267
|
+
let newActiveCtx;
|
54268
|
+
const propertyScopedContext = scopedContextMap.get(term);
|
54269
|
+
if (propertyScopedContext) {
|
54270
|
+
newActiveCtx = yield this._applyEmbeddedContexts({
|
54271
|
+
obj: { "@context": propertyScopedContext },
|
54272
|
+
contextStack
|
54273
|
+
});
|
54274
|
+
propertyContextStack = contextStack.slice();
|
54275
|
+
}
|
54276
|
+
const { plural, def } = termInfo;
|
54277
|
+
const termType = this._getTermType({ activeCtx: newActiveCtx || activeCtx, def });
|
54278
|
+
const values = plural ? value : [value];
|
54279
|
+
const entries = [];
|
54280
|
+
for (const value2 of values) {
|
54281
|
+
if (value2 === null) {
|
54282
|
+
entries.push(null);
|
54283
|
+
continue;
|
54284
|
+
}
|
54285
|
+
if (this._transformTypedValue({ entries, termType, value: value2, termInfo })) {
|
54286
|
+
continue;
|
54287
|
+
}
|
54288
|
+
if (typeof value2 !== "object") {
|
54289
|
+
entries.push(value2);
|
54290
|
+
continue;
|
54291
|
+
}
|
54292
|
+
if (Array.isArray(value2)) {
|
54293
|
+
yield this._transformArray({ entries, contextStack: propertyContextStack, value: value2 });
|
54294
|
+
continue;
|
54295
|
+
}
|
54296
|
+
yield this._transformObject({
|
54297
|
+
entries,
|
54298
|
+
contextStack: propertyContextStack,
|
54299
|
+
value: value2
|
54300
|
+
});
|
54301
|
+
}
|
54302
|
+
if (newActiveCtx) {
|
54303
|
+
newActiveCtx.revert();
|
54304
|
+
}
|
54305
|
+
this._assignEntries({ entries, obj, transformMap, termInfo });
|
54306
|
+
}
|
54307
|
+
activeCtx.revert();
|
54308
|
+
});
|
54309
|
+
}
|
54310
|
+
_applyEmbeddedContexts(_0) {
|
54311
|
+
return __async(this, arguments, function* ({ obj, contextStack }) {
|
54312
|
+
const stackTop = contextStack.length;
|
54313
|
+
const localContexts = obj["@context"];
|
54314
|
+
yield this._updateContextStack({ contextStack, contexts: localContexts });
|
54315
|
+
let active = contextStack[contextStack.length - 1];
|
54316
|
+
if (!active) {
|
54317
|
+
active = {
|
54318
|
+
aliases: {
|
54319
|
+
id: /* @__PURE__ */ new Set(),
|
54320
|
+
type: /* @__PURE__ */ new Set()
|
54321
|
+
},
|
54322
|
+
context: {},
|
54323
|
+
scopedContextMap: /* @__PURE__ */ new Map(),
|
54324
|
+
termMap: /* @__PURE__ */ new Map()
|
54325
|
+
};
|
54326
|
+
}
|
54327
|
+
return __spreadProps(__spreadValues({}, active), {
|
54328
|
+
revert() {
|
54329
|
+
contextStack.length = stackTop;
|
54330
|
+
}
|
54331
|
+
});
|
54332
|
+
});
|
54333
|
+
}
|
54334
|
+
_applyTypeScopedContexts(_0) {
|
54335
|
+
return __async(this, arguments, function* ({ obj, contextStack }) {
|
54336
|
+
const stackTop = contextStack.length;
|
54337
|
+
let active = contextStack[contextStack.length - 1];
|
54338
|
+
if (!active) {
|
54339
|
+
active = {
|
54340
|
+
aliases: {
|
54341
|
+
id: /* @__PURE__ */ new Set(),
|
54342
|
+
type: /* @__PURE__ */ new Set()
|
54343
|
+
},
|
54344
|
+
context: {},
|
54345
|
+
scopedContextMap: /* @__PURE__ */ new Map(),
|
54346
|
+
termMap: /* @__PURE__ */ new Map()
|
54347
|
+
};
|
54348
|
+
}
|
54349
|
+
const { aliases } = active;
|
54350
|
+
let totalTypes = [];
|
54351
|
+
const typeTerms = ["@type", ...aliases.type];
|
54352
|
+
for (const term of typeTerms) {
|
54353
|
+
const types = obj[term];
|
54354
|
+
if (Array.isArray(types)) {
|
54355
|
+
totalTypes.push(...types);
|
54356
|
+
} else {
|
54357
|
+
totalTypes.push(types);
|
54358
|
+
}
|
54359
|
+
}
|
54360
|
+
totalTypes = [...new Set(totalTypes)].sort();
|
54361
|
+
let { scopedContextMap } = active;
|
54362
|
+
for (const type of totalTypes) {
|
54363
|
+
const contexts = scopedContextMap.get(type);
|
54364
|
+
if (contexts) {
|
54365
|
+
yield this._updateContextStack({ contextStack, contexts });
|
54366
|
+
active = contextStack[contextStack.length - 1];
|
54367
|
+
({ scopedContextMap } = active);
|
54368
|
+
}
|
54369
|
+
}
|
54370
|
+
return __spreadProps(__spreadValues({}, active), {
|
54371
|
+
revert() {
|
54372
|
+
contextStack.length = stackTop;
|
54373
|
+
}
|
54374
|
+
});
|
54375
|
+
});
|
54376
|
+
}
|
54377
|
+
_updateContextStack(_0) {
|
54378
|
+
return __async(this, arguments, function* ({ contextStack, contexts, transformer }) {
|
54379
|
+
if (!contexts) {
|
54380
|
+
return;
|
54381
|
+
}
|
54382
|
+
if (!Array.isArray(contexts)) {
|
54383
|
+
contexts = [contexts];
|
54384
|
+
}
|
54385
|
+
const { contextMap } = this;
|
54386
|
+
for (const context2 of contexts) {
|
54387
|
+
let entry = contextMap.get(context2);
|
54388
|
+
if (!entry) {
|
54389
|
+
let ctx = context2;
|
54390
|
+
let contextUrl;
|
54391
|
+
if (typeof context2 === "string") {
|
54392
|
+
contextUrl = context2;
|
54393
|
+
({ "@context": ctx } = yield this._getDocument({ url: contextUrl }));
|
54394
|
+
}
|
54395
|
+
entry = yield this._addContext({ context: ctx, contextUrl, transformer });
|
54396
|
+
}
|
54397
|
+
const newActive = {
|
54398
|
+
aliases: {
|
54399
|
+
id: new Set(entry.aliases.id),
|
54400
|
+
type: new Set(entry.aliases.type)
|
54401
|
+
},
|
54402
|
+
context: context2,
|
54403
|
+
scopedContextMap: new Map(entry.scopedContextMap),
|
54404
|
+
termMap: new Map(entry.termMap)
|
54405
|
+
};
|
54406
|
+
const oldActive = contextStack[contextStack.length - 1];
|
54407
|
+
contextStack.push(newActive);
|
54408
|
+
if (!oldActive) {
|
54409
|
+
continue;
|
54410
|
+
}
|
54411
|
+
const { aliases, termMap } = newActive;
|
54412
|
+
for (const key2 of ["id", "type"]) {
|
54413
|
+
for (const alias of oldActive.aliases[key2]) {
|
54414
|
+
if (!(context2[alias] === null || newActive.termMap.has(alias))) {
|
54415
|
+
aliases[key2].add(alias);
|
54416
|
+
}
|
54417
|
+
}
|
54418
|
+
}
|
54419
|
+
const { scopedContextMap } = newActive;
|
54420
|
+
for (const [key2, value] of oldActive.scopedContextMap) {
|
54421
|
+
if (!(context2[key2] === null || scopedContextMap.has(key2))) {
|
54422
|
+
scopedContextMap.set(key2, value);
|
54423
|
+
}
|
54424
|
+
}
|
54425
|
+
for (const [key2, value] of oldActive.termMap) {
|
54426
|
+
if (!(context2[key2] === null || termMap.has(key2))) {
|
54427
|
+
termMap.set(key2, value);
|
54428
|
+
}
|
54429
|
+
}
|
54430
|
+
}
|
54431
|
+
});
|
54432
|
+
}
|
54433
|
+
_addContext(_0) {
|
54434
|
+
return __async(this, arguments, function* ({ context: context2, contextUrl }) {
|
54435
|
+
const { contextMap, termToId, idToTerm } = this;
|
54436
|
+
const importUrl = context2["@import"];
|
54437
|
+
if (importUrl) {
|
54438
|
+
let importEntry = contextMap.get(importUrl);
|
54439
|
+
if (!importEntry) {
|
54440
|
+
const { "@context": importCtx } = yield this._getDocument({ url: importUrl });
|
54441
|
+
importEntry = yield this._addContext({ context: importCtx, contextUrl: importUrl });
|
54442
|
+
}
|
54443
|
+
context2 = __spreadValues(__spreadValues({}, importEntry.context), context2);
|
54444
|
+
}
|
54445
|
+
const scopedContextMap = /* @__PURE__ */ new Map();
|
54446
|
+
const termMap = /* @__PURE__ */ new Map();
|
54447
|
+
const entry = {
|
54448
|
+
aliases: { id: /* @__PURE__ */ new Set(), type: /* @__PURE__ */ new Set() },
|
54449
|
+
context: context2,
|
54450
|
+
scopedContextMap,
|
54451
|
+
termMap
|
54452
|
+
};
|
54453
|
+
const keys = Object.keys(context2).sort();
|
54454
|
+
for (const key2 of keys) {
|
54455
|
+
const def = context2[key2];
|
54456
|
+
if (!def) {
|
54457
|
+
continue;
|
54458
|
+
}
|
54459
|
+
if (def === "@id" || def.id === "@id") {
|
54460
|
+
entry.aliases.id.add(key2);
|
54461
|
+
} else if (def === "@type" || def.id === "@type") {
|
54462
|
+
entry.aliases.type.add(key2);
|
54463
|
+
}
|
54464
|
+
if (KEYWORDS.has(key2)) {
|
54465
|
+
continue;
|
54466
|
+
}
|
54467
|
+
if (!termToId.has(key2)) {
|
54468
|
+
const id = this.nextTermId;
|
54469
|
+
this.nextTermId += 2;
|
54470
|
+
termToId.set(key2, id);
|
54471
|
+
if (idToTerm) {
|
54472
|
+
idToTerm.set(id, key2);
|
54473
|
+
}
|
54474
|
+
}
|
54475
|
+
termMap.set(key2, def);
|
54476
|
+
const scopedContext = def["@context"];
|
54477
|
+
if (scopedContext) {
|
54478
|
+
scopedContextMap.set(key2, scopedContext);
|
54479
|
+
}
|
54480
|
+
}
|
54481
|
+
contextMap.set(contextUrl || context2, entry);
|
54482
|
+
return entry;
|
54483
|
+
});
|
54484
|
+
}
|
54485
|
+
_getDocument(_0) {
|
54486
|
+
return __async(this, arguments, function* ({ url }) {
|
54487
|
+
const { document } = yield this.documentLoader(url);
|
54488
|
+
if (typeof document === "string") {
|
54489
|
+
return JSON.parse(document);
|
54490
|
+
}
|
54491
|
+
return document;
|
54492
|
+
});
|
54493
|
+
}
|
54494
|
+
_getTermType({ activeCtx, def }) {
|
54495
|
+
const { "@type": type } = def;
|
54496
|
+
if (!type) {
|
54497
|
+
return;
|
54498
|
+
}
|
54499
|
+
const [prefix, ...suffix] = type.split(":");
|
54500
|
+
const prefixDef = activeCtx.termMap.get(prefix);
|
54501
|
+
if (prefixDef === void 0) {
|
54502
|
+
return type;
|
54503
|
+
}
|
54504
|
+
if (typeof prefixDef === "string") {
|
54505
|
+
return prefixDef + suffix.join(":");
|
54506
|
+
}
|
54507
|
+
if (!(typeof prefixDef === "object" && typeof prefixDef["@id"] === "string")) {
|
54508
|
+
throw new CborldError("ERR_INVALID_TERM_DEFINITION", 'JSON-LD term definitions must be strings or objects with "@id".');
|
54509
|
+
}
|
54510
|
+
return prefixDef["@id"] + suffix.join(":");
|
54511
|
+
}
|
54512
|
+
_getIdForTerm({ term, plural }) {
|
54513
|
+
const id = this.termToId.get(term);
|
54514
|
+
if (id === void 0) {
|
54515
|
+
throw new CborldError("ERR_UNDEFINED_TERM", "CBOR-LD compression requires all terms to be defined in a JSON-LD context.");
|
54516
|
+
}
|
54517
|
+
return plural ? id + 1 : id;
|
54518
|
+
}
|
54519
|
+
_getTermForId({ id }) {
|
54520
|
+
const plural = (id & 1) === 1;
|
54521
|
+
const term = this.idToTerm.get(plural ? id - 1 : id);
|
54522
|
+
return { term, plural };
|
54523
|
+
}
|
54524
|
+
};
|
54525
|
+
__name(Transformer, "Transformer");
|
54526
|
+
|
54527
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlDecoder.js
|
54528
|
+
var ID_TO_SCHEME = /* @__PURE__ */ new Map([
|
54529
|
+
[1024, "did:v1:nym:"],
|
54530
|
+
[1025, "did:key:"]
|
54531
|
+
]);
|
54532
|
+
var Base58DidUrlDecoder = class extends CborldDecoder {
|
54533
|
+
decode({ value } = {}) {
|
54534
|
+
let url = ID_TO_SCHEME.get(value[0]);
|
54535
|
+
if (typeof value[1] === "string") {
|
54536
|
+
url += value[1];
|
54537
|
+
} else {
|
54538
|
+
url += `z${encode13(value[1])}`;
|
54539
|
+
}
|
54540
|
+
if (value.length > 2) {
|
54541
|
+
if (typeof value[2] === "string") {
|
54542
|
+
url += `#${value[2]}`;
|
54543
|
+
} else {
|
54544
|
+
url += `#z${encode13(value[2])}`;
|
54545
|
+
}
|
54546
|
+
}
|
54547
|
+
return url;
|
54548
|
+
}
|
54549
|
+
static createDecoder({ value } = {}) {
|
54550
|
+
if (!(Array.isArray(value) && value.length > 1 && value.length <= 3)) {
|
54551
|
+
return false;
|
54552
|
+
}
|
54553
|
+
if (!ID_TO_SCHEME.has(value[0])) {
|
54554
|
+
return false;
|
54555
|
+
}
|
54556
|
+
return new Base58DidUrlDecoder();
|
54557
|
+
}
|
54558
|
+
};
|
54559
|
+
__name(Base58DidUrlDecoder, "Base58DidUrlDecoder");
|
54560
|
+
|
54561
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlDecoder.js
|
54562
|
+
var HttpUrlDecoder = class extends CborldDecoder {
|
54563
|
+
constructor({ secure } = {}) {
|
54564
|
+
super();
|
54565
|
+
this.secure = secure;
|
54566
|
+
}
|
54567
|
+
decode({ value } = {}) {
|
54568
|
+
const scheme = this.secure ? "https://" : "http://";
|
54569
|
+
return `${scheme}${value[1]}`;
|
54570
|
+
}
|
54571
|
+
static createDecoder({ value } = {}) {
|
54572
|
+
if (!(value.length === 2 && typeof value[1] === "string")) {
|
54573
|
+
return false;
|
54574
|
+
}
|
54575
|
+
return new HttpUrlDecoder({ secure: value[0] === 2 });
|
54576
|
+
}
|
54577
|
+
};
|
54578
|
+
__name(HttpUrlDecoder, "HttpUrlDecoder");
|
54579
|
+
|
54580
|
+
// ../../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/regex.js
|
54581
|
+
var regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
54582
|
+
|
54583
|
+
// ../../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/validate.js
|
54584
|
+
function validate6(uuid) {
|
54585
|
+
return typeof uuid === "string" && regex_default.test(uuid);
|
54586
|
+
}
|
54587
|
+
__name(validate6, "validate");
|
54588
|
+
var validate_default = validate6;
|
54589
|
+
|
54590
|
+
// ../../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/stringify.js
|
54591
|
+
var byteToHex = [];
|
54592
|
+
for (i = 0; i < 256; ++i) {
|
54593
|
+
byteToHex.push((i + 256).toString(16).substr(1));
|
54594
|
+
}
|
54595
|
+
var i;
|
54596
|
+
function stringify2(arr) {
|
54597
|
+
var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
54598
|
+
var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
54599
|
+
if (!validate_default(uuid)) {
|
54600
|
+
throw TypeError("Stringified UUID is invalid");
|
54601
|
+
}
|
54602
|
+
return uuid;
|
54603
|
+
}
|
54604
|
+
__name(stringify2, "stringify");
|
54605
|
+
var stringify_default = stringify2;
|
54606
|
+
|
54607
|
+
// ../../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/parse.js
|
54608
|
+
function parse2(uuid) {
|
54609
|
+
if (!validate_default(uuid)) {
|
54610
|
+
throw TypeError("Invalid UUID");
|
54611
|
+
}
|
54612
|
+
var v;
|
54613
|
+
var arr = new Uint8Array(16);
|
54614
|
+
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
54615
|
+
arr[1] = v >>> 16 & 255;
|
54616
|
+
arr[2] = v >>> 8 & 255;
|
54617
|
+
arr[3] = v & 255;
|
54618
|
+
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
54619
|
+
arr[5] = v & 255;
|
54620
|
+
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
54621
|
+
arr[7] = v & 255;
|
54622
|
+
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
54623
|
+
arr[9] = v & 255;
|
54624
|
+
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255;
|
54625
|
+
arr[11] = v / 4294967296 & 255;
|
54626
|
+
arr[12] = v >>> 24 & 255;
|
54627
|
+
arr[13] = v >>> 16 & 255;
|
54628
|
+
arr[14] = v >>> 8 & 255;
|
54629
|
+
arr[15] = v & 255;
|
54630
|
+
return arr;
|
54631
|
+
}
|
54632
|
+
__name(parse2, "parse");
|
54633
|
+
var parse_default = parse2;
|
54634
|
+
|
54635
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnDecoder.js
|
54636
|
+
var UuidUrnDecoder = class extends CborldDecoder {
|
54637
|
+
decode({ value } = {}) {
|
54638
|
+
const uuid = typeof value[1] === "string" ? value[1] : stringify_default(value[1]);
|
54639
|
+
return `urn:uuid:${uuid}`;
|
54640
|
+
}
|
54641
|
+
static createDecoder({ value } = {}) {
|
54642
|
+
if (value.length === 2 && (typeof value[1] === "string" || value[1] instanceof Uint8Array)) {
|
54643
|
+
return new UuidUrnDecoder();
|
54644
|
+
}
|
54645
|
+
}
|
54646
|
+
};
|
54647
|
+
__name(UuidUrnDecoder, "UuidUrnDecoder");
|
54648
|
+
|
54649
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/UriDecoder.js
|
54650
|
+
var SCHEME_ID_TO_DECODER = /* @__PURE__ */ new Map([
|
54651
|
+
[1, HttpUrlDecoder],
|
54652
|
+
[2, HttpUrlDecoder],
|
54653
|
+
[3, UuidUrnDecoder],
|
54654
|
+
[1024, Base58DidUrlDecoder],
|
54655
|
+
[1025, Base58DidUrlDecoder]
|
54656
|
+
]);
|
54657
|
+
var UriDecoder = class extends CborldDecoder {
|
54658
|
+
static createDecoder({ value } = {}) {
|
54659
|
+
if (!(Array.isArray(value) || value.length > 1)) {
|
54660
|
+
return false;
|
54661
|
+
}
|
54662
|
+
const DecoderClass = SCHEME_ID_TO_DECODER.get(value[0]);
|
54663
|
+
return DecoderClass && DecoderClass.createDecoder({ value });
|
54664
|
+
}
|
54665
|
+
};
|
54666
|
+
__name(UriDecoder, "UriDecoder");
|
54667
|
+
|
54668
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermDecoder.js
|
54669
|
+
var VocabTermDecoder = class extends CborldDecoder {
|
54670
|
+
constructor({ term } = {}) {
|
54671
|
+
super();
|
54672
|
+
this.term = term;
|
54673
|
+
}
|
54674
|
+
decode() {
|
54675
|
+
return this.term;
|
54676
|
+
}
|
54677
|
+
static createDecoder({ value, transformer } = {}) {
|
54678
|
+
if (Array.isArray(value)) {
|
54679
|
+
return UriDecoder.createDecoder({ value, transformer });
|
54680
|
+
}
|
54681
|
+
const term = transformer.idToTerm.get(value);
|
54682
|
+
if (term !== void 0) {
|
54683
|
+
return new VocabTermDecoder({ term });
|
54684
|
+
}
|
54685
|
+
}
|
54686
|
+
};
|
54687
|
+
__name(VocabTermDecoder, "VocabTermDecoder");
|
54688
|
+
|
54689
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateDecoder.js
|
54690
|
+
var XsdDateDecoder = class extends CborldDecoder {
|
54691
|
+
decode({ value } = {}) {
|
54692
|
+
const dateString = new Date(value * 1e3).toISOString();
|
54693
|
+
return dateString.substring(0, dateString.indexOf("T"));
|
54694
|
+
}
|
54695
|
+
static createDecoder({ value } = {}) {
|
54696
|
+
if (typeof value === "number") {
|
54697
|
+
return new XsdDateDecoder();
|
54698
|
+
}
|
54699
|
+
}
|
54700
|
+
};
|
54701
|
+
__name(XsdDateDecoder, "XsdDateDecoder");
|
54702
|
+
|
54703
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeDecoder.js
|
54704
|
+
var XsdDateTimeDecoder = class extends CborldDecoder {
|
54705
|
+
constructor({ value } = {}) {
|
54706
|
+
super();
|
54707
|
+
this.value = value;
|
54708
|
+
}
|
54709
|
+
decode({ value } = {}) {
|
54710
|
+
if (typeof value === "number") {
|
54711
|
+
return new Date(value * 1e3).toISOString().replace(".000Z", "Z");
|
54712
|
+
}
|
54713
|
+
return new Date(value[0] * 1e3 + value[1]).toISOString();
|
54714
|
+
}
|
54715
|
+
static createDecoder({ value } = {}) {
|
54716
|
+
if (typeof value === "number") {
|
54717
|
+
return new XsdDateTimeDecoder();
|
54718
|
+
}
|
54719
|
+
if (Array.isArray(value) && value.length === 2 && (typeof value[0] === "number" || typeof value[1] === "number")) {
|
54720
|
+
return new XsdDateTimeDecoder();
|
54721
|
+
}
|
54722
|
+
}
|
54723
|
+
};
|
54724
|
+
__name(XsdDateTimeDecoder, "XsdDateTimeDecoder");
|
54725
|
+
|
54726
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/util-browser.js
|
54727
|
+
function inspect4(data, options) {
|
54728
|
+
return JSON.stringify(data, null, 2);
|
54729
|
+
}
|
54730
|
+
__name(inspect4, "inspect");
|
54731
|
+
|
54732
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/Decompressor.js
|
54733
|
+
var TYPE_DECODERS = /* @__PURE__ */ new Map([
|
54734
|
+
["@id", UriDecoder],
|
54735
|
+
["@vocab", VocabTermDecoder],
|
54736
|
+
["https://w3id.org/security#multibase", MultibaseDecoder],
|
54737
|
+
["http://www.w3.org/2001/XMLSchema#date", XsdDateDecoder],
|
54738
|
+
["http://www.w3.org/2001/XMLSchema#dateTime", XsdDateTimeDecoder]
|
54739
|
+
]);
|
54740
|
+
var CONTEXT_TERM_ID = KEYWORDS.get("@context");
|
54741
|
+
var CONTEXT_TERM_ID_PLURAL = CONTEXT_TERM_ID + 1;
|
54742
|
+
var Decompressor = class extends Transformer {
|
54743
|
+
constructor({ documentLoader, appContextMap } = {}) {
|
54744
|
+
super({ documentLoader, appContextMap });
|
54745
|
+
this.reverseAppContextMap = /* @__PURE__ */ new Map();
|
54746
|
+
if (appContextMap) {
|
54747
|
+
for (const [k, v] of appContextMap) {
|
54748
|
+
this.reverseAppContextMap.set(v, k);
|
54749
|
+
}
|
54750
|
+
}
|
54751
|
+
}
|
54752
|
+
decompress() {
|
54753
|
+
return __async(this, arguments, function* ({ compressedBytes, diagnose } = {}) {
|
54754
|
+
this.contextMap = /* @__PURE__ */ new Map();
|
54755
|
+
this.termToId = new Map(KEYWORDS);
|
54756
|
+
this.nextTermId = FIRST_CUSTOM_TERM_ID;
|
54757
|
+
this.idToTerm = /* @__PURE__ */ new Map();
|
54758
|
+
for (const [term, id] of this.termToId) {
|
54759
|
+
this.idToTerm.set(id, term);
|
54760
|
+
}
|
54761
|
+
const transformMap = decode8(compressedBytes, { useMaps: true });
|
54762
|
+
if (diagnose) {
|
54763
|
+
diagnose("Diagnostic CBOR-LD decompression transform map(s):");
|
54764
|
+
diagnose(inspect4(transformMap, { depth: null, colors: true }));
|
54765
|
+
}
|
54766
|
+
const results = [];
|
54767
|
+
const isArray2 = Array.isArray(transformMap);
|
54768
|
+
const transformMaps = isArray2 ? transformMap : [transformMap];
|
54769
|
+
for (const transformMap2 of transformMaps) {
|
54770
|
+
const obj = {};
|
54771
|
+
yield this._transform({ obj, transformMap: transformMap2 });
|
54772
|
+
results.push(obj);
|
54773
|
+
}
|
54774
|
+
return isArray2 ? results : results[0];
|
54775
|
+
});
|
54776
|
+
}
|
54777
|
+
_beforeObjectContexts({ obj, transformMap }) {
|
54778
|
+
const encodedContext = transformMap.get(CONTEXT_TERM_ID);
|
54779
|
+
if (encodedContext) {
|
54780
|
+
const decoder = ContextDecoder.createDecoder({ value: encodedContext, transformer: this });
|
54781
|
+
obj["@context"] = decoder ? decoder.decode({ value: encodedContext }) : encodedContext;
|
54782
|
+
}
|
54783
|
+
const encodedContexts = transformMap.get(CONTEXT_TERM_ID_PLURAL);
|
54784
|
+
if (encodedContexts) {
|
54785
|
+
if (encodedContext) {
|
54786
|
+
throw new CborldError("ERR_INVALID_ENCODED_CONTEXT", "Both singular and plural context IDs were found in the CBOR-LD input.");
|
54787
|
+
}
|
54788
|
+
if (!Array.isArray(encodedContexts)) {
|
54789
|
+
throw new CborldError("ERR_INVALID_ENCODED_CONTEXT", "Encoded plural context value must be an array.");
|
54790
|
+
}
|
54791
|
+
const entries = [];
|
54792
|
+
for (const value of encodedContexts) {
|
54793
|
+
const decoder = ContextDecoder.createDecoder({ value, transformer: this });
|
54794
|
+
entries.push(decoder ? decoder.decode({ value }) : value);
|
54795
|
+
}
|
54796
|
+
obj["@context"] = entries;
|
54797
|
+
}
|
54798
|
+
}
|
54799
|
+
_beforeTypeScopedContexts({ activeCtx, obj, transformMap }) {
|
54800
|
+
const { termToId } = this;
|
54801
|
+
const typeTerms = ["@type", ...activeCtx.aliases.type];
|
54802
|
+
for (const term of typeTerms) {
|
54803
|
+
const termId = termToId.get(term);
|
54804
|
+
let value = transformMap.get(termId);
|
54805
|
+
if (value === void 0) {
|
54806
|
+
value = transformMap.get(termId + 1);
|
54807
|
+
}
|
54808
|
+
if (value !== void 0) {
|
54809
|
+
if (Array.isArray(value)) {
|
54810
|
+
obj[term] = value.map((value2) => {
|
54811
|
+
const decoder = VocabTermDecoder.createDecoder({ value: value2, transformer: this });
|
54812
|
+
return decoder ? decoder.decode({ value: value2 }) : value2;
|
54813
|
+
});
|
54814
|
+
} else {
|
54815
|
+
const decoder = VocabTermDecoder.createDecoder({ value, transformer: this });
|
54816
|
+
obj[term] = decoder ? decoder.decode({ value }) : value;
|
54817
|
+
}
|
54818
|
+
}
|
54819
|
+
}
|
54820
|
+
}
|
54821
|
+
_getEntries({ transformMap, termMap }) {
|
54822
|
+
const entries = [];
|
54823
|
+
for (const [key2, value] of transformMap) {
|
54824
|
+
if (key2 === CONTEXT_TERM_ID || key2 === CONTEXT_TERM_ID_PLURAL) {
|
54825
|
+
continue;
|
54826
|
+
}
|
54827
|
+
const { term, plural } = this._getTermForId({ id: key2 });
|
54828
|
+
if (term === void 0) {
|
54829
|
+
throw new CborldError("ERR_UNKNOWN_CBORLD_TERM_ID", `Unknown term ID '${key2}' was detected in the CBOR-LD input.`);
|
54830
|
+
}
|
54831
|
+
const def = termMap.get(term);
|
54832
|
+
if (def === void 0 && !(term.startsWith("@") && KEYWORDS.has(term))) {
|
54833
|
+
throw new CborldError("ERR_UNKNOWN_CBORLD_TERM", `Unknown term "${term}" was detected in the CBOR-LD input.`);
|
54834
|
+
}
|
54835
|
+
entries.push([{ term, termId: key2, plural, def }, value]);
|
54836
|
+
}
|
54837
|
+
return entries.sort(_sortEntriesByTerm);
|
54838
|
+
}
|
54839
|
+
_getTermInfo({ termMap, key: key2 }) {
|
54840
|
+
const { term, plural } = this._getTermForId({ id: key2 });
|
54841
|
+
if (term === void 0) {
|
54842
|
+
throw new CborldError("ERR_UNKNOWN_CBORLD_TERM_ID", `Unknown term ID '${key2}' was detected in the CBOR-LD input.`);
|
54843
|
+
}
|
54844
|
+
const def = termMap.get(term);
|
54845
|
+
if (def === void 0 && !(term.startsWith("@") && KEYWORDS.has(term))) {
|
54846
|
+
throw new CborldError("ERR_UNKNOWN_CBORLD_TERM", `Unknown term "${term}" was detected in the CBOR-LD input.`);
|
54847
|
+
}
|
54848
|
+
return { term, termId: key2, plural, def };
|
54849
|
+
}
|
54850
|
+
_transformObjectId({ obj, termInfo, value }) {
|
54851
|
+
const decoder = UriDecoder.createDecoder({ value });
|
54852
|
+
obj[termInfo.term] = decoder ? decoder.decode({ value }) : value;
|
54853
|
+
}
|
54854
|
+
_transformObjectType({ obj, termInfo, value }) {
|
54855
|
+
const { term, plural } = termInfo;
|
54856
|
+
const values = plural ? value : [value];
|
54857
|
+
const entries = [];
|
54858
|
+
for (const value2 of values) {
|
54859
|
+
const decoder = VocabTermDecoder.createDecoder({ value: value2, transformer: this });
|
54860
|
+
entries.push(decoder ? decoder.decode({ value: value2 }) : value2);
|
54861
|
+
}
|
54862
|
+
obj[term] = plural ? entries : entries[0];
|
54863
|
+
}
|
54864
|
+
_transformTypedValue({ entries, termType, value }) {
|
54865
|
+
const DecoderClass = TYPE_DECODERS.get(termType);
|
54866
|
+
const decoder = DecoderClass && DecoderClass.createDecoder({ value, transformer: this });
|
54867
|
+
if (decoder) {
|
54868
|
+
entries.push(decoder.decode({ value }));
|
54869
|
+
return true;
|
54870
|
+
}
|
54871
|
+
}
|
54872
|
+
_transformArray(_0) {
|
54873
|
+
return __async(this, arguments, function* ({ entries, contextStack, value }) {
|
54874
|
+
const children = [];
|
54875
|
+
for (const transformMap of value) {
|
54876
|
+
const obj = {};
|
54877
|
+
children.push(obj);
|
54878
|
+
yield this._transform({ obj, transformMap, contextStack });
|
54879
|
+
}
|
54880
|
+
entries.push(children);
|
54881
|
+
});
|
54882
|
+
}
|
54883
|
+
_transformObject(_0) {
|
54884
|
+
return __async(this, arguments, function* ({ entries, contextStack, value }) {
|
54885
|
+
const child = {};
|
54886
|
+
entries.push(child);
|
54887
|
+
return this._transform({ obj: child, transformMap: value, contextStack });
|
54888
|
+
});
|
54889
|
+
}
|
54890
|
+
_assignEntries({ entries, obj, termInfo }) {
|
54891
|
+
const { term, plural } = termInfo;
|
54892
|
+
obj[term] = plural ? entries : entries[0];
|
54893
|
+
}
|
54894
|
+
};
|
54895
|
+
__name(Decompressor, "Decompressor");
|
54896
|
+
function _sortEntriesByTerm([{ term: t1 }], [{ term: t2 }]) {
|
54897
|
+
return t1 < t2 ? -1 : t1 > t2 ? 1 : 0;
|
54898
|
+
}
|
54899
|
+
__name(_sortEntriesByTerm, "_sortEntriesByTerm");
|
54900
|
+
|
54901
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/decode.js
|
54902
|
+
function decode13(_0) {
|
54903
|
+
return __async(this, arguments, function* ({
|
54904
|
+
cborldBytes,
|
54905
|
+
documentLoader,
|
54906
|
+
appContextMap = /* @__PURE__ */ new Map(),
|
54907
|
+
diagnose
|
54908
|
+
}) {
|
54909
|
+
if (!(cborldBytes instanceof Uint8Array)) {
|
54910
|
+
throw new TypeError('"cborldBytes" must be a Uint8Array.');
|
54911
|
+
}
|
54912
|
+
let index = 0;
|
54913
|
+
if (cborldBytes[index++] !== 217) {
|
54914
|
+
throw new CborldError("ERR_NOT_CBORLD", 'CBOR-LD must start with a CBOR major type "Tag" header of `0xd9`.');
|
54915
|
+
}
|
54916
|
+
if (cborldBytes[index++] !== 5) {
|
54917
|
+
throw new CborldError("ERR_NOT_CBORLD", "CBOR-LD 16-bit tag must start with `0x05`.");
|
54918
|
+
}
|
54919
|
+
const compressionMode = cborldBytes[index];
|
54920
|
+
if (compressionMode === void 0) {
|
54921
|
+
throw new CborldError("ERR_NOT_CBORLD", "Truncated CBOR-LD 16-bit tag.");
|
54922
|
+
}
|
54923
|
+
if (!(compressionMode === 0 || compressionMode === 1)) {
|
54924
|
+
throw new CborldError("ERR_NOT_CBORLD", `Unsupported CBOR-LD compression mode "${compressionMode}".`);
|
54925
|
+
}
|
54926
|
+
index++;
|
54927
|
+
const { buffer: buffer2, byteOffset, length: length2 } = cborldBytes;
|
54928
|
+
const suffix = new Uint8Array(buffer2, byteOffset + index, length2 - index);
|
54929
|
+
if (compressionMode === 0) {
|
54930
|
+
return decode8(suffix, { useMaps: false });
|
54931
|
+
}
|
54932
|
+
const decompressor = new Decompressor({ documentLoader, appContextMap });
|
54933
|
+
const result = yield decompressor.decompress({ compressedBytes: suffix, diagnose });
|
54934
|
+
if (diagnose) {
|
54935
|
+
diagnose("Diagnostic JSON-LD result:");
|
54936
|
+
diagnose(inspect4(result, { depth: null, colors: true }));
|
54937
|
+
}
|
54938
|
+
return result;
|
54939
|
+
});
|
54940
|
+
}
|
54941
|
+
__name(decode13, "decode");
|
54942
|
+
|
54943
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/CborldEncoder.js
|
54944
|
+
var CborldEncoder = class {
|
54945
|
+
encode() {
|
54946
|
+
throw new Error("Must be implemented by derived class.");
|
54947
|
+
}
|
54948
|
+
static createEncoder({ value } = {}) {
|
54949
|
+
throw new Error("Must be implemented by derived class.");
|
54950
|
+
}
|
54951
|
+
};
|
54952
|
+
__name(CborldEncoder, "CborldEncoder");
|
54953
|
+
|
54954
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/ContextEncoder.js
|
54955
|
+
var ContextEncoder = class extends CborldEncoder {
|
54956
|
+
constructor({ context: context2, appContextMap } = {}) {
|
54957
|
+
super();
|
54958
|
+
this.context = context2;
|
54959
|
+
this.appContextMap = appContextMap;
|
54960
|
+
}
|
54961
|
+
encode() {
|
54962
|
+
const { context: context2 } = this;
|
54963
|
+
const id = URL_TO_ID.get(context2) || this.appContextMap.get(context2);
|
54964
|
+
if (id === void 0) {
|
54965
|
+
return new Token(Type.string, context2);
|
54966
|
+
}
|
54967
|
+
return new Token(Type.uint, id);
|
54968
|
+
}
|
54969
|
+
static createEncoder({ value, transformer } = {}) {
|
54970
|
+
if (typeof value !== "string") {
|
54971
|
+
return false;
|
54972
|
+
}
|
54973
|
+
const { appContextMap } = transformer;
|
54974
|
+
return new ContextEncoder({ context: value, appContextMap });
|
54975
|
+
}
|
54976
|
+
};
|
54977
|
+
__name(ContextEncoder, "ContextEncoder");
|
54978
|
+
|
54979
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseEncoder.js
|
54980
|
+
var MultibaseEncoder = class extends CborldEncoder {
|
54981
|
+
constructor({ value } = {}) {
|
54982
|
+
super();
|
54983
|
+
this.value = value;
|
54984
|
+
}
|
54985
|
+
encode() {
|
54986
|
+
const { value } = this;
|
54987
|
+
let prefix;
|
54988
|
+
let suffix;
|
54989
|
+
if (value[0] === "z") {
|
54990
|
+
prefix = 122;
|
54991
|
+
suffix = decode12(value.substr(1));
|
54992
|
+
} else if (value[0] === "M") {
|
54993
|
+
prefix = 77;
|
54994
|
+
suffix = gBase64.toUint8Array(value.substr(1));
|
54995
|
+
}
|
54996
|
+
const bytes = new Uint8Array(1 + suffix.length);
|
54997
|
+
bytes[0] = prefix;
|
54998
|
+
bytes.set(suffix, 1);
|
54999
|
+
return new Token(Type.bytes, bytes);
|
55000
|
+
}
|
55001
|
+
static createEncoder({ value } = {}) {
|
55002
|
+
if (typeof value !== "string") {
|
55003
|
+
return false;
|
55004
|
+
}
|
55005
|
+
if (value[0] === "z" || value[0] === "M") {
|
55006
|
+
return new MultibaseEncoder({ value });
|
55007
|
+
}
|
55008
|
+
}
|
55009
|
+
};
|
55010
|
+
__name(MultibaseEncoder, "MultibaseEncoder");
|
55011
|
+
|
55012
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlEncoder.js
|
55013
|
+
var SCHEME_TO_ID = /* @__PURE__ */ new Map([
|
55014
|
+
["did:v1:nym:", 1024],
|
55015
|
+
["did:key:", 1025]
|
55016
|
+
]);
|
55017
|
+
var Base58DidUrlEncoder = class extends CborldEncoder {
|
55018
|
+
constructor({ value, scheme } = {}) {
|
55019
|
+
super();
|
55020
|
+
this.value = value;
|
55021
|
+
this.scheme = scheme;
|
55022
|
+
}
|
55023
|
+
encode() {
|
55024
|
+
const { value, scheme } = this;
|
55025
|
+
const suffix = value.substr(scheme.length);
|
55026
|
+
const [authority, fragment] = suffix.split("#");
|
55027
|
+
const entries = [
|
55028
|
+
new Token(Type.uint, SCHEME_TO_ID.get(scheme)),
|
55029
|
+
_multibase58ToToken(authority)
|
55030
|
+
];
|
55031
|
+
if (fragment !== void 0) {
|
55032
|
+
entries.push(_multibase58ToToken(fragment));
|
55033
|
+
}
|
55034
|
+
return [new Token(Type.array, entries.length), entries];
|
55035
|
+
}
|
55036
|
+
static createEncoder({ value } = {}) {
|
55037
|
+
const keys = [...SCHEME_TO_ID.keys()];
|
55038
|
+
for (const key2 of keys) {
|
55039
|
+
if (value.startsWith(key2)) {
|
55040
|
+
return new Base58DidUrlEncoder({ value, scheme: key2 });
|
55041
|
+
}
|
55042
|
+
}
|
55043
|
+
}
|
55044
|
+
};
|
55045
|
+
__name(Base58DidUrlEncoder, "Base58DidUrlEncoder");
|
55046
|
+
function _multibase58ToToken(str) {
|
55047
|
+
if (str.startsWith("z")) {
|
55048
|
+
const decoded = decode12(str.substr(1));
|
55049
|
+
if (decoded) {
|
55050
|
+
return new Token(Type.bytes, decoded);
|
55051
|
+
}
|
55052
|
+
}
|
55053
|
+
return new Token(Type.string, str);
|
55054
|
+
}
|
55055
|
+
__name(_multibase58ToToken, "_multibase58ToToken");
|
55056
|
+
|
55057
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlEncoder.js
|
55058
|
+
var HttpUrlEncoder = class extends CborldEncoder {
|
55059
|
+
constructor({ value, secure } = {}) {
|
55060
|
+
super();
|
55061
|
+
this.value = value;
|
55062
|
+
this.secure = secure;
|
55063
|
+
}
|
55064
|
+
encode() {
|
55065
|
+
const { value, secure } = this;
|
55066
|
+
const length2 = secure ? "https://".length : "http://".length;
|
55067
|
+
const entries = [
|
55068
|
+
new Token(Type.uint, secure ? 2 : 1),
|
55069
|
+
new Token(Type.string, value.substr(length2))
|
55070
|
+
];
|
55071
|
+
return [new Token(Type.array, entries.length), entries];
|
55072
|
+
}
|
55073
|
+
static createEncoder({ value } = {}) {
|
55074
|
+
if (value.startsWith("https://")) {
|
55075
|
+
return new HttpUrlEncoder({ value, secure: true });
|
55076
|
+
}
|
55077
|
+
if (value.startsWith("http://")) {
|
55078
|
+
return new HttpUrlEncoder({ value, secure: false });
|
55079
|
+
}
|
55080
|
+
}
|
55081
|
+
};
|
55082
|
+
__name(HttpUrlEncoder, "HttpUrlEncoder");
|
55083
|
+
|
55084
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnEncoder.js
|
55085
|
+
var UuidUrnEncoder = class extends CborldEncoder {
|
55086
|
+
constructor({ value } = {}) {
|
55087
|
+
super();
|
55088
|
+
this.value = value;
|
55089
|
+
}
|
55090
|
+
encode() {
|
55091
|
+
const { value } = this;
|
55092
|
+
const rest = value.substr("urn:uuid:".length);
|
55093
|
+
const entries = [new Token(Type.uint, 3)];
|
55094
|
+
if (rest.toLowerCase() === rest) {
|
55095
|
+
const uuidBytes = parse_default(rest);
|
55096
|
+
entries.push(new Token(Type.bytes, uuidBytes));
|
55097
|
+
} else {
|
55098
|
+
entries.push(new Token(Type.string, rest));
|
55099
|
+
}
|
55100
|
+
return [new Token(Type.array, entries.length), entries];
|
55101
|
+
}
|
55102
|
+
static createEncoder({ value } = {}) {
|
55103
|
+
if (value.startsWith("urn:uuid:")) {
|
55104
|
+
return new UuidUrnEncoder({ value });
|
55105
|
+
}
|
55106
|
+
}
|
55107
|
+
};
|
55108
|
+
__name(UuidUrnEncoder, "UuidUrnEncoder");
|
55109
|
+
|
55110
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/UriEncoder.js
|
55111
|
+
var SCHEME_TO_ENCODER = /* @__PURE__ */ new Map([
|
55112
|
+
["http", HttpUrlEncoder],
|
55113
|
+
["https", HttpUrlEncoder],
|
55114
|
+
["urn:uuid", UuidUrnEncoder],
|
55115
|
+
["did:v1:nym", Base58DidUrlEncoder],
|
55116
|
+
["did:key", Base58DidUrlEncoder]
|
55117
|
+
]);
|
55118
|
+
var UriEncoder = class extends CborldEncoder {
|
55119
|
+
static createEncoder({ value } = {}) {
|
55120
|
+
if (typeof value !== "string") {
|
55121
|
+
return false;
|
55122
|
+
}
|
55123
|
+
let scheme;
|
55124
|
+
try {
|
55125
|
+
const { protocol, pathname } = new URL(value);
|
55126
|
+
scheme = protocol;
|
55127
|
+
if (pathname.includes(":")) {
|
55128
|
+
scheme += pathname;
|
55129
|
+
}
|
55130
|
+
const split = value.split(":");
|
55131
|
+
split.pop();
|
55132
|
+
scheme = split.join(":");
|
55133
|
+
} catch (e) {
|
55134
|
+
return false;
|
55135
|
+
}
|
55136
|
+
const EncoderClass = SCHEME_TO_ENCODER.get(scheme);
|
55137
|
+
return EncoderClass && EncoderClass.createEncoder({ value });
|
55138
|
+
}
|
55139
|
+
};
|
55140
|
+
__name(UriEncoder, "UriEncoder");
|
55141
|
+
|
55142
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermEncoder.js
|
55143
|
+
var VocabTermEncoder = class extends CborldEncoder {
|
55144
|
+
constructor({ termId } = {}) {
|
55145
|
+
super();
|
55146
|
+
this.termId = termId;
|
55147
|
+
}
|
55148
|
+
encode() {
|
55149
|
+
return new Token(Type.uint, this.termId);
|
55150
|
+
}
|
55151
|
+
static createEncoder({ value, transformer } = {}) {
|
55152
|
+
const { termToId } = transformer;
|
55153
|
+
const termId = termToId.get(value);
|
55154
|
+
if (termId !== void 0) {
|
55155
|
+
return new VocabTermEncoder({ termId });
|
55156
|
+
}
|
55157
|
+
return UriEncoder.createEncoder({ value });
|
55158
|
+
}
|
55159
|
+
};
|
55160
|
+
__name(VocabTermEncoder, "VocabTermEncoder");
|
55161
|
+
|
55162
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateEncoder.js
|
55163
|
+
var XsdDateEncoder = class extends CborldEncoder {
|
55164
|
+
constructor({ value, parsed } = {}) {
|
55165
|
+
super();
|
55166
|
+
this.value = value;
|
55167
|
+
this.parsed = parsed;
|
55168
|
+
}
|
55169
|
+
encode() {
|
55170
|
+
const { value, parsed } = this;
|
55171
|
+
const secondsSinceEpoch = Math.floor(parsed / 1e3);
|
55172
|
+
const dateString = new Date(secondsSinceEpoch * 1e3).toISOString();
|
55173
|
+
const expectedDate = dateString.substring(0, dateString.indexOf("T"));
|
55174
|
+
if (value !== expectedDate) {
|
55175
|
+
return new Token(Type.string, value);
|
55176
|
+
}
|
55177
|
+
return new Token(Type.uint, secondsSinceEpoch);
|
55178
|
+
}
|
55179
|
+
static createEncoder({ value } = {}) {
|
55180
|
+
if (value.includes("T")) {
|
55181
|
+
return false;
|
55182
|
+
}
|
55183
|
+
const parsed = Date.parse(value);
|
55184
|
+
if (isNaN(parsed)) {
|
55185
|
+
return false;
|
55186
|
+
}
|
55187
|
+
return new XsdDateEncoder({ value, parsed });
|
55188
|
+
}
|
55189
|
+
};
|
55190
|
+
__name(XsdDateEncoder, "XsdDateEncoder");
|
55191
|
+
|
55192
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeEncoder.js
|
55193
|
+
var XsdDateTimeEncoder = class extends CborldEncoder {
|
55194
|
+
constructor({ value, parsed } = {}) {
|
55195
|
+
super();
|
55196
|
+
this.value = value;
|
55197
|
+
this.parsed = parsed;
|
55198
|
+
}
|
55199
|
+
encode() {
|
55200
|
+
const { value, parsed } = this;
|
55201
|
+
const secondsSinceEpoch = Math.floor(parsed / 1e3);
|
55202
|
+
const secondsToken = new Token(Type.uint, secondsSinceEpoch);
|
55203
|
+
const millisecondIndex = value.indexOf(".");
|
55204
|
+
if (millisecondIndex === -1) {
|
55205
|
+
const expectedDate2 = new Date(secondsSinceEpoch * 1e3).toISOString().replace(".000Z", "Z");
|
55206
|
+
if (value !== expectedDate2) {
|
55207
|
+
return new Token(Type.string, value);
|
55208
|
+
}
|
55209
|
+
return secondsToken;
|
55210
|
+
}
|
55211
|
+
const milliseconds = parseInt(value.substr(millisecondIndex + 1), 10);
|
55212
|
+
const expectedDate = new Date(secondsSinceEpoch * 1e3 + milliseconds).toISOString();
|
55213
|
+
if (value !== expectedDate) {
|
55214
|
+
return new Token(Type.string, value);
|
55215
|
+
}
|
55216
|
+
const entries = [
|
55217
|
+
secondsToken,
|
55218
|
+
new Token(Type.uint, milliseconds)
|
55219
|
+
];
|
55220
|
+
return [new Token(Type.array, entries.length), entries];
|
55221
|
+
}
|
55222
|
+
static createEncoder({ value } = {}) {
|
55223
|
+
if (!value.includes("T")) {
|
55224
|
+
return false;
|
55225
|
+
}
|
55226
|
+
const parsed = Date.parse(value);
|
55227
|
+
if (isNaN(parsed)) {
|
55228
|
+
return false;
|
55229
|
+
}
|
55230
|
+
return new XsdDateTimeEncoder({ value, parsed });
|
55231
|
+
}
|
55232
|
+
};
|
55233
|
+
__name(XsdDateTimeEncoder, "XsdDateTimeEncoder");
|
55234
|
+
|
55235
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/Compressor.js
|
55236
|
+
var TYPE_ENCODERS = /* @__PURE__ */ new Map([
|
55237
|
+
["@id", UriEncoder],
|
55238
|
+
["@vocab", VocabTermEncoder],
|
55239
|
+
["https://w3id.org/security#multibase", MultibaseEncoder],
|
55240
|
+
["http://www.w3.org/2001/XMLSchema#date", XsdDateEncoder],
|
55241
|
+
["http://www.w3.org/2001/XMLSchema#dateTime", XsdDateTimeEncoder]
|
55242
|
+
]);
|
55243
|
+
var CONTEXT_TERM_ID2 = KEYWORDS.get("@context");
|
55244
|
+
var CONTEXT_TERM_ID_PLURAL2 = CONTEXT_TERM_ID2 + 1;
|
55245
|
+
var typeEncoders2 = {
|
55246
|
+
Object(obj) {
|
55247
|
+
if (obj instanceof CborldEncoder) {
|
55248
|
+
return obj.encode({ obj });
|
55249
|
+
}
|
55250
|
+
}
|
55251
|
+
};
|
55252
|
+
var Compressor = class extends Transformer {
|
55253
|
+
constructor({ documentLoader, appContextMap } = {}) {
|
55254
|
+
super({ documentLoader, appContextMap });
|
55255
|
+
}
|
55256
|
+
compress() {
|
55257
|
+
return __async(this, arguments, function* ({ jsonldDocument, diagnose } = {}) {
|
55258
|
+
const transformMaps = yield this._createTransformMaps({ jsonldDocument });
|
55259
|
+
if (diagnose) {
|
55260
|
+
diagnose("Diagnostic CBOR-LD compression transform map(s):");
|
55261
|
+
diagnose(inspect4(transformMaps, { depth: null, colors: true }));
|
55262
|
+
}
|
55263
|
+
return encode8(transformMaps, { typeEncoders: typeEncoders2 });
|
55264
|
+
});
|
55265
|
+
}
|
55266
|
+
_createTransformMaps(_0) {
|
55267
|
+
return __async(this, arguments, function* ({ jsonldDocument }) {
|
55268
|
+
this.contextMap = /* @__PURE__ */ new Map();
|
55269
|
+
this.termToId = new Map(KEYWORDS);
|
55270
|
+
this.nextTermId = FIRST_CUSTOM_TERM_ID;
|
55271
|
+
const transformMaps = [];
|
55272
|
+
const isArray2 = Array.isArray(jsonldDocument);
|
55273
|
+
const docs = isArray2 ? jsonldDocument : [jsonldDocument];
|
55274
|
+
for (const obj of docs) {
|
55275
|
+
const transformMap = /* @__PURE__ */ new Map();
|
55276
|
+
yield this._transform({ obj, transformMap });
|
55277
|
+
transformMaps.push(transformMap);
|
55278
|
+
}
|
55279
|
+
return isArray2 ? transformMaps : transformMaps[0];
|
55280
|
+
});
|
55281
|
+
}
|
55282
|
+
_afterObjectContexts({ obj, transformMap }) {
|
55283
|
+
const context2 = obj["@context"];
|
55284
|
+
if (!context2) {
|
55285
|
+
return;
|
55286
|
+
}
|
55287
|
+
const entries = [];
|
55288
|
+
const isArray2 = Array.isArray(context2);
|
55289
|
+
const contexts = isArray2 ? context2 : [context2];
|
55290
|
+
for (const value of contexts) {
|
55291
|
+
const encoder = ContextEncoder.createEncoder({ value, transformer: this });
|
55292
|
+
entries.push(encoder || value);
|
55293
|
+
}
|
55294
|
+
const id = isArray2 ? CONTEXT_TERM_ID_PLURAL2 : CONTEXT_TERM_ID2;
|
55295
|
+
transformMap.set(id, isArray2 ? entries : entries[0]);
|
55296
|
+
}
|
55297
|
+
_getEntries({ obj, termMap }) {
|
55298
|
+
const entries = [];
|
55299
|
+
const keys = Object.keys(obj).sort();
|
55300
|
+
for (const key2 of keys) {
|
55301
|
+
if (key2 === "@context") {
|
55302
|
+
continue;
|
55303
|
+
}
|
55304
|
+
const def = termMap.get(key2);
|
55305
|
+
if (def === void 0 && !(key2.startsWith("@") && KEYWORDS.has(key2))) {
|
55306
|
+
throw new CborldError("ERR_UNKNOWN_CBORLD_TERM", `Unknown term '${key2}' was detected in the JSON-LD input.`);
|
55307
|
+
}
|
55308
|
+
const value = obj[key2];
|
55309
|
+
const plural = Array.isArray(value);
|
55310
|
+
const termId = this._getIdForTerm({ term: key2, plural });
|
55311
|
+
entries.push([{ term: key2, termId, plural, def }, value]);
|
55312
|
+
}
|
55313
|
+
return entries;
|
55314
|
+
}
|
55315
|
+
_transformObjectId({ transformMap, termInfo, value }) {
|
55316
|
+
const { termId } = termInfo;
|
55317
|
+
const encoder = UriEncoder.createEncoder({ value, transformer: this, termInfo });
|
55318
|
+
transformMap.set(termId, encoder || value);
|
55319
|
+
}
|
55320
|
+
_transformObjectType({ transformMap, termInfo, value }) {
|
55321
|
+
const { termId, plural } = termInfo;
|
55322
|
+
const values = plural ? value : [value];
|
55323
|
+
const entries = [];
|
55324
|
+
for (const value2 of values) {
|
55325
|
+
const encoder = VocabTermEncoder.createEncoder({ value: value2, transformer: this, termInfo });
|
55326
|
+
entries.push(encoder || value2);
|
55327
|
+
}
|
55328
|
+
transformMap.set(termId, plural ? entries : entries[0]);
|
55329
|
+
}
|
55330
|
+
_transformTypedValue({ entries, termType, value, termInfo }) {
|
55331
|
+
const EncoderClass = TYPE_ENCODERS.get(termType);
|
55332
|
+
const encoder = EncoderClass && EncoderClass.createEncoder({ value, transformer: this, termInfo });
|
55333
|
+
if (encoder) {
|
55334
|
+
entries.push(encoder);
|
55335
|
+
return true;
|
55336
|
+
}
|
55337
|
+
}
|
55338
|
+
_transformArray(_0) {
|
55339
|
+
return __async(this, arguments, function* ({ entries, contextStack, value }) {
|
55340
|
+
const children = [];
|
55341
|
+
for (const obj of value) {
|
55342
|
+
const childMap = /* @__PURE__ */ new Map();
|
55343
|
+
children.push(childMap);
|
55344
|
+
yield this._transform({ obj, transformMap: childMap, contextStack });
|
55345
|
+
}
|
55346
|
+
entries.push(children);
|
55347
|
+
});
|
55348
|
+
}
|
55349
|
+
_transformObject(_0) {
|
55350
|
+
return __async(this, arguments, function* ({ entries, contextStack, value }) {
|
55351
|
+
const transformMap = /* @__PURE__ */ new Map();
|
55352
|
+
entries.push(transformMap);
|
55353
|
+
yield this._transform({ obj: value, transformMap, contextStack });
|
55354
|
+
});
|
55355
|
+
}
|
55356
|
+
_assignEntries({ entries, transformMap, termInfo }) {
|
55357
|
+
const { termId, plural } = termInfo;
|
55358
|
+
transformMap.set(termId, plural ? entries : entries[0]);
|
55359
|
+
}
|
55360
|
+
};
|
55361
|
+
__name(Compressor, "Compressor");
|
55362
|
+
|
55363
|
+
// ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/encode.js
|
55364
|
+
function encode14() {
|
55365
|
+
return __async(this, arguments, function* ({
|
55366
|
+
jsonldDocument,
|
55367
|
+
documentLoader,
|
55368
|
+
appContextMap = /* @__PURE__ */ new Map(),
|
55369
|
+
compressionMode = 1,
|
55370
|
+
diagnose
|
55371
|
+
} = {}) {
|
55372
|
+
if (!(compressionMode === 0 || compressionMode === 1)) {
|
55373
|
+
throw new TypeError('"compressionMode" must be "0" (no compression) or "1" for compression mode version 1.');
|
55374
|
+
}
|
55375
|
+
const prefix = new Uint8Array([217, 5, compressionMode]);
|
55376
|
+
let suffix;
|
55377
|
+
if (compressionMode === 0) {
|
55378
|
+
suffix = encode8(jsonldDocument);
|
55379
|
+
} else {
|
55380
|
+
const compressor = new Compressor({ documentLoader, appContextMap });
|
55381
|
+
suffix = yield compressor.compress({ jsonldDocument, diagnose });
|
55382
|
+
}
|
55383
|
+
const length2 = prefix.length + suffix.length;
|
55384
|
+
const bytes = new Uint8Array(length2);
|
55385
|
+
bytes.set(prefix);
|
55386
|
+
bytes.set(suffix, prefix.length);
|
55387
|
+
if (diagnose) {
|
55388
|
+
diagnose("Diagnostic CBOR-LD result:");
|
55389
|
+
diagnose(inspect4(bytes, { depth: null, colors: true }));
|
55390
|
+
}
|
55391
|
+
return bytes;
|
55392
|
+
});
|
55393
|
+
}
|
55394
|
+
__name(encode14, "encode");
|
55395
|
+
|
55396
|
+
// ../../node_modules/.pnpm/to-data-view@2.0.0/node_modules/to-data-view/index.js
|
55397
|
+
function toDataView(data) {
|
55398
|
+
if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray) {
|
55399
|
+
return new DataView(data.buffer, data.byteOffset, data.byteLength);
|
55400
|
+
}
|
55401
|
+
if (data instanceof ArrayBuffer) {
|
55402
|
+
return new DataView(data);
|
55403
|
+
}
|
55404
|
+
throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray");
|
55405
|
+
}
|
55406
|
+
__name(toDataView, "toDataView");
|
55407
|
+
|
55408
|
+
// ../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js
|
55409
|
+
var RFC4648 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
55410
|
+
var RFC4648_HEX = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
55411
|
+
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
55412
|
+
function base32Encode(data, variant, options) {
|
55413
|
+
options = options || {};
|
55414
|
+
let alphabet3, defaultPadding;
|
55415
|
+
switch (variant) {
|
55416
|
+
case "RFC3548":
|
55417
|
+
case "RFC4648":
|
55418
|
+
alphabet3 = RFC4648;
|
55419
|
+
defaultPadding = true;
|
55420
|
+
break;
|
55421
|
+
case "RFC4648-HEX":
|
55422
|
+
alphabet3 = RFC4648_HEX;
|
55423
|
+
defaultPadding = true;
|
55424
|
+
break;
|
55425
|
+
case "Crockford":
|
55426
|
+
alphabet3 = CROCKFORD;
|
55427
|
+
defaultPadding = false;
|
55428
|
+
break;
|
55429
|
+
default:
|
55430
|
+
throw new Error("Unknown base32 variant: " + variant);
|
55431
|
+
}
|
55432
|
+
const padding = options.padding !== void 0 ? options.padding : defaultPadding;
|
55433
|
+
const view = toDataView(data);
|
55434
|
+
let bits = 0;
|
55435
|
+
let value = 0;
|
55436
|
+
let output = "";
|
55437
|
+
for (let i = 0; i < view.byteLength; i++) {
|
55438
|
+
value = value << 8 | view.getUint8(i);
|
55439
|
+
bits += 8;
|
55440
|
+
while (bits >= 5) {
|
55441
|
+
output += alphabet3[value >>> bits - 5 & 31];
|
55442
|
+
bits -= 5;
|
55443
|
+
}
|
55444
|
+
}
|
55445
|
+
if (bits > 0) {
|
55446
|
+
output += alphabet3[value << 5 - bits & 31];
|
55447
|
+
}
|
55448
|
+
if (padding) {
|
55449
|
+
while (output.length % 8 !== 0) {
|
55450
|
+
output += "=";
|
55451
|
+
}
|
55452
|
+
}
|
55453
|
+
return output;
|
55454
|
+
}
|
55455
|
+
__name(base32Encode, "base32Encode");
|
55456
|
+
|
55457
|
+
// ../../node_modules/.pnpm/@digitalbazaar+vpqr@3.0.0/node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
55458
|
+
var import_base32_decode = __toESM(require_base32_decode(), 1);
|
55459
|
+
|
55460
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/common/Mode.js
|
55461
|
+
var Mode;
|
55462
|
+
(function(Mode2) {
|
55463
|
+
Mode2[Mode2["Terminator"] = 0] = "Terminator";
|
55464
|
+
Mode2[Mode2["Numeric"] = 1] = "Numeric";
|
55465
|
+
Mode2[Mode2["Alphanumeric"] = 2] = "Alphanumeric";
|
55466
|
+
Mode2[Mode2["StructuredAppend"] = 3] = "StructuredAppend";
|
55467
|
+
Mode2[Mode2["Byte"] = 4] = "Byte";
|
55468
|
+
Mode2[Mode2["Kanji"] = 8] = "Kanji";
|
55469
|
+
Mode2[Mode2["ECI"] = 7] = "ECI";
|
55470
|
+
})(Mode || (Mode = {}));
|
55471
|
+
|
55472
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRData.js
|
55473
|
+
var QRData = /* @__PURE__ */ function() {
|
55474
|
+
function QRData2(mode, data) {
|
55475
|
+
this.bytes = [];
|
55476
|
+
this.mode = mode;
|
55477
|
+
this.data = data;
|
55478
|
+
}
|
55479
|
+
__name(QRData2, "QRData");
|
55480
|
+
QRData2.prototype.getLength = function() {
|
55481
|
+
return this.bytes.length;
|
55482
|
+
};
|
55483
|
+
QRData2.prototype.getLengthInBits = function(version12) {
|
55484
|
+
var mode = this.mode;
|
55485
|
+
var error = new Error("illegal mode: ".concat(mode));
|
55486
|
+
if (1 <= version12 && version12 < 10) {
|
55487
|
+
switch (mode) {
|
55488
|
+
case Mode.Numeric:
|
55489
|
+
return 10;
|
55490
|
+
case Mode.Alphanumeric:
|
55491
|
+
return 9;
|
55492
|
+
case Mode.Byte:
|
55493
|
+
return 8;
|
55494
|
+
case Mode.Kanji:
|
55495
|
+
return 8;
|
55496
|
+
default:
|
55497
|
+
throw error;
|
55498
|
+
}
|
55499
|
+
} else if (version12 < 27) {
|
55500
|
+
switch (mode) {
|
55501
|
+
case Mode.Numeric:
|
55502
|
+
return 12;
|
55503
|
+
case Mode.Alphanumeric:
|
55504
|
+
return 11;
|
55505
|
+
case Mode.Byte:
|
55506
|
+
return 16;
|
55507
|
+
case Mode.Kanji:
|
55508
|
+
return 10;
|
55509
|
+
default:
|
55510
|
+
throw error;
|
55511
|
+
}
|
55512
|
+
} else if (version12 < 41) {
|
55513
|
+
switch (mode) {
|
55514
|
+
case Mode.Numeric:
|
55515
|
+
return 14;
|
55516
|
+
case Mode.Alphanumeric:
|
55517
|
+
return 13;
|
55518
|
+
case Mode.Byte:
|
55519
|
+
return 16;
|
55520
|
+
case Mode.Kanji:
|
55521
|
+
return 12;
|
55522
|
+
default:
|
55523
|
+
throw error;
|
55524
|
+
}
|
55525
|
+
} else {
|
55526
|
+
throw new Error("illegal version: ".concat(version12));
|
55527
|
+
}
|
55528
|
+
};
|
55529
|
+
return QRData2;
|
55530
|
+
}();
|
55531
|
+
|
55532
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/encoding/UTF8.js
|
55533
|
+
function encode15(text) {
|
55534
|
+
var pos = 0;
|
55535
|
+
var length2 = text.length;
|
55536
|
+
var bytes = [];
|
55537
|
+
for (var i = 0; i < length2; i++) {
|
55538
|
+
var code5 = text.charCodeAt(i);
|
55539
|
+
if (code5 < 128) {
|
55540
|
+
bytes[pos++] = code5;
|
55541
|
+
} else if (code5 < 2048) {
|
55542
|
+
bytes[pos++] = code5 >> 6 | 192;
|
55543
|
+
bytes[pos++] = code5 & 63 | 128;
|
55544
|
+
} else if ((code5 & 64512) === 55296 && i + 1 < length2 && (text.charCodeAt(i + 1) & 64512) === 56320) {
|
55545
|
+
code5 = 65536 + ((code5 & 1023) << 10) + (text.charCodeAt(++i) & 1023);
|
55546
|
+
bytes[pos++] = code5 >> 18 | 240;
|
55547
|
+
bytes[pos++] = code5 >> 12 & 63 | 128;
|
55548
|
+
bytes[pos++] = code5 >> 6 & 63 | 128;
|
55549
|
+
bytes[pos++] = code5 & 63 | 128;
|
55550
|
+
} else {
|
55551
|
+
bytes[pos++] = code5 >> 12 | 224;
|
55552
|
+
bytes[pos++] = code5 >> 6 & 63 | 128;
|
55553
|
+
bytes[pos++] = code5 & 63 | 128;
|
55554
|
+
}
|
55555
|
+
}
|
55556
|
+
return bytes;
|
55557
|
+
}
|
55558
|
+
__name(encode15, "encode");
|
55559
|
+
|
55560
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRByte.js
|
55561
|
+
var QRByte = /* @__PURE__ */ function(_super) {
|
55562
|
+
__extends2(QRByte2, _super);
|
55563
|
+
function QRByte2(data, encode$1) {
|
55564
|
+
var _this = _super.call(this, Mode.Byte, data) || this;
|
55565
|
+
_this.encoding = -1;
|
55566
|
+
if (typeof encode$1 === "function") {
|
55567
|
+
var _a = encode$1(data), encoding = _a.encoding, bytes = _a.bytes;
|
55568
|
+
_this.bytes = bytes;
|
55569
|
+
_this.encoding = encoding;
|
55570
|
+
} else {
|
55571
|
+
_this.bytes = encode15(data);
|
55572
|
+
_this.encoding = 26;
|
55573
|
+
}
|
55574
|
+
return _this;
|
55575
|
+
}
|
55576
|
+
__name(QRByte2, "QRByte");
|
55577
|
+
QRByte2.prototype.writeTo = function(buffer2) {
|
55578
|
+
var bytes = this.bytes;
|
55579
|
+
for (var _i = 0, bytes_1 = bytes; _i < bytes_1.length; _i++) {
|
55580
|
+
var byte = bytes_1[_i];
|
55581
|
+
buffer2.put(byte, 8);
|
55582
|
+
}
|
55583
|
+
};
|
55584
|
+
return QRByte2;
|
55585
|
+
}(QRData);
|
55586
|
+
|
55587
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRMath.js
|
55588
|
+
var EXP_TABLE = [];
|
55589
|
+
var LOG_TABLE = [];
|
55590
|
+
for (i = 0; i < 256; i++) {
|
55591
|
+
LOG_TABLE[i] = 0;
|
55592
|
+
EXP_TABLE[i] = i < 8 ? 1 << i : EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
|
55593
|
+
}
|
55594
|
+
var i;
|
55595
|
+
for (i = 0; i < 255; i++) {
|
55596
|
+
LOG_TABLE[EXP_TABLE[i]] = i;
|
55597
|
+
}
|
55598
|
+
var i;
|
55599
|
+
function glog(n) {
|
55600
|
+
if (n < 1) {
|
55601
|
+
throw new Error("illegal log: ".concat(n));
|
55602
|
+
}
|
55603
|
+
return LOG_TABLE[n];
|
55604
|
+
}
|
55605
|
+
__name(glog, "glog");
|
55606
|
+
function gexp(n) {
|
55607
|
+
while (n < 0) {
|
55608
|
+
n += 255;
|
55609
|
+
}
|
55610
|
+
while (n >= 256) {
|
55611
|
+
n -= 255;
|
55612
|
+
}
|
55613
|
+
return EXP_TABLE[n];
|
55614
|
+
}
|
55615
|
+
__name(gexp, "gexp");
|
55616
|
+
|
55617
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/Polynomial.js
|
55618
|
+
var Polynomial = /* @__PURE__ */ function() {
|
55619
|
+
function Polynomial2(num, shift) {
|
55620
|
+
if (shift === void 0) {
|
55621
|
+
shift = 0;
|
55622
|
+
}
|
55623
|
+
var offset = 0;
|
55624
|
+
var length2 = num.length;
|
55625
|
+
while (offset < length2 && num[offset] === 0) {
|
55626
|
+
offset++;
|
55627
|
+
}
|
55628
|
+
length2 -= offset;
|
55629
|
+
var numbers = [];
|
55630
|
+
for (var i = 0; i < length2; i++) {
|
55631
|
+
numbers.push(num[offset + i]);
|
55632
|
+
}
|
55633
|
+
for (var i = 0; i < shift; i++) {
|
55634
|
+
numbers.push(0);
|
55635
|
+
}
|
55636
|
+
this.num = numbers;
|
55637
|
+
}
|
55638
|
+
__name(Polynomial2, "Polynomial");
|
55639
|
+
Polynomial2.prototype.getAt = function(index) {
|
55640
|
+
return this.num[index];
|
55641
|
+
};
|
55642
|
+
Polynomial2.prototype.getLength = function() {
|
55643
|
+
return this.num.length;
|
55644
|
+
};
|
55645
|
+
Polynomial2.prototype.multiply = function(e) {
|
55646
|
+
var num = [];
|
55647
|
+
var eLength = e.getLength();
|
55648
|
+
var tLength = this.getLength();
|
55649
|
+
var dLength = tLength + eLength - 1;
|
55650
|
+
for (var i = 0; i < dLength; i++) {
|
55651
|
+
num.push(0);
|
55652
|
+
}
|
55653
|
+
for (var i = 0; i < tLength; i++) {
|
55654
|
+
for (var j = 0; j < eLength; j++) {
|
55655
|
+
num[i + j] ^= gexp(glog(this.getAt(i)) + glog(e.getAt(j)));
|
55656
|
+
}
|
55657
|
+
}
|
55658
|
+
return new Polynomial2(num);
|
55659
|
+
};
|
55660
|
+
Polynomial2.prototype.mod = function(e) {
|
55661
|
+
var eLength = e.getLength();
|
55662
|
+
var tLength = this.getLength();
|
55663
|
+
if (tLength - eLength < 0) {
|
55664
|
+
return this;
|
55665
|
+
}
|
55666
|
+
var ratio = glog(this.getAt(0)) - glog(e.getAt(0));
|
55667
|
+
var num = [];
|
55668
|
+
for (var i = 0; i < tLength; i++) {
|
55669
|
+
num.push(this.getAt(i));
|
55670
|
+
}
|
55671
|
+
for (var i = 0; i < eLength; i++) {
|
55672
|
+
num[i] ^= gexp(glog(e.getAt(i)) + ratio);
|
55673
|
+
}
|
55674
|
+
return new Polynomial2(num).mod(e);
|
55675
|
+
};
|
55676
|
+
return Polynomial2;
|
55677
|
+
}();
|
55678
|
+
|
55679
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRUtil.js
|
55680
|
+
var N12 = 3;
|
55681
|
+
var N22 = 3;
|
55682
|
+
var N32 = 40;
|
55683
|
+
var N42 = 10;
|
55684
|
+
var ALIGNMENT_PATTERN_TABLE = [
|
55685
|
+
[],
|
55686
|
+
[6, 18],
|
55687
|
+
[6, 22],
|
55688
|
+
[6, 26],
|
55689
|
+
[6, 30],
|
55690
|
+
[6, 34],
|
55691
|
+
[6, 22, 38],
|
55692
|
+
[6, 24, 42],
|
55693
|
+
[6, 26, 46],
|
55694
|
+
[6, 28, 50],
|
55695
|
+
[6, 30, 54],
|
55696
|
+
[6, 32, 58],
|
55697
|
+
[6, 34, 62],
|
55698
|
+
[6, 26, 46, 66],
|
55699
|
+
[6, 26, 48, 70],
|
55700
|
+
[6, 26, 50, 74],
|
55701
|
+
[6, 30, 54, 78],
|
55702
|
+
[6, 30, 56, 82],
|
55703
|
+
[6, 30, 58, 86],
|
55704
|
+
[6, 34, 62, 90],
|
55705
|
+
[6, 28, 50, 72, 94],
|
55706
|
+
[6, 26, 50, 74, 98],
|
55707
|
+
[6, 30, 54, 78, 102],
|
55708
|
+
[6, 28, 54, 80, 106],
|
55709
|
+
[6, 32, 58, 84, 110],
|
55710
|
+
[6, 30, 58, 86, 114],
|
55711
|
+
[6, 34, 62, 90, 118],
|
55712
|
+
[6, 26, 50, 74, 98, 122],
|
55713
|
+
[6, 30, 54, 78, 102, 126],
|
55714
|
+
[6, 26, 52, 78, 104, 130],
|
55715
|
+
[6, 30, 56, 82, 108, 134],
|
55716
|
+
[6, 34, 60, 86, 112, 138],
|
55717
|
+
[6, 30, 58, 86, 114, 142],
|
55718
|
+
[6, 34, 62, 90, 118, 146],
|
55719
|
+
[6, 30, 54, 78, 102, 126, 150],
|
55720
|
+
[6, 24, 50, 76, 102, 128, 154],
|
55721
|
+
[6, 28, 54, 80, 106, 132, 158],
|
55722
|
+
[6, 32, 58, 84, 110, 136, 162],
|
55723
|
+
[6, 26, 54, 82, 110, 138, 166],
|
55724
|
+
[6, 30, 58, 86, 114, 142, 170]
|
55725
|
+
];
|
55726
|
+
var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
|
55727
|
+
var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
|
55728
|
+
var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
|
55729
|
+
function getAlignmentPattern(version12) {
|
55730
|
+
return ALIGNMENT_PATTERN_TABLE[version12 - 1];
|
55731
|
+
}
|
55732
|
+
__name(getAlignmentPattern, "getAlignmentPattern");
|
55733
|
+
function getErrorCorrectionPolynomial(errorCorrectionLength) {
|
55734
|
+
var e = new Polynomial([1]);
|
55735
|
+
for (var i = 0; i < errorCorrectionLength; i++) {
|
55736
|
+
e = e.multiply(new Polynomial([1, gexp(i)]));
|
55737
|
+
}
|
55738
|
+
return e;
|
55739
|
+
}
|
55740
|
+
__name(getErrorCorrectionPolynomial, "getErrorCorrectionPolynomial");
|
55741
|
+
function getBCHDigit(data) {
|
55742
|
+
var digit = 0;
|
55743
|
+
while (data !== 0) {
|
55744
|
+
digit++;
|
55745
|
+
data >>>= 1;
|
55746
|
+
}
|
55747
|
+
return digit;
|
55748
|
+
}
|
55749
|
+
__name(getBCHDigit, "getBCHDigit");
|
55750
|
+
var G18_BCH = getBCHDigit(G18);
|
55751
|
+
function getBCHVersion(data) {
|
55752
|
+
var offset = data << 12;
|
55753
|
+
while (getBCHDigit(offset) - G18_BCH >= 0) {
|
55754
|
+
offset ^= G18 << getBCHDigit(offset) - G18_BCH;
|
55755
|
+
}
|
55756
|
+
return data << 12 | offset;
|
55757
|
+
}
|
55758
|
+
__name(getBCHVersion, "getBCHVersion");
|
55759
|
+
var G15_BCH = getBCHDigit(G15);
|
55760
|
+
function getBCHVersionInfo(data) {
|
55761
|
+
var offset = data << 10;
|
55762
|
+
while (getBCHDigit(offset) - G15_BCH >= 0) {
|
55763
|
+
offset ^= G15 << getBCHDigit(offset) - G15_BCH;
|
55764
|
+
}
|
55765
|
+
return (data << 10 | offset) ^ G15_MASK;
|
55766
|
+
}
|
55767
|
+
__name(getBCHVersionInfo, "getBCHVersionInfo");
|
55768
|
+
function applyMaskPenaltyRule1Internal(qrcode, isHorizontal) {
|
55769
|
+
var matrixSize = qrcode.getMatrixSize();
|
55770
|
+
var penalty = 0;
|
55771
|
+
for (var i = 0; i < matrixSize; i++) {
|
55772
|
+
var prevBit = false;
|
55773
|
+
var numSameBitCells = 0;
|
55774
|
+
for (var j = 0; j < matrixSize; j++) {
|
55775
|
+
var bit = isHorizontal ? qrcode.isDark(i, j) : qrcode.isDark(j, i);
|
55776
|
+
if (bit === prevBit) {
|
55777
|
+
numSameBitCells++;
|
55778
|
+
if (numSameBitCells === 5) {
|
55779
|
+
penalty += N12;
|
55780
|
+
} else if (numSameBitCells > 5) {
|
55781
|
+
penalty++;
|
55782
|
+
}
|
55783
|
+
} else {
|
55784
|
+
prevBit = bit;
|
55785
|
+
numSameBitCells = 1;
|
55786
|
+
}
|
55787
|
+
}
|
55788
|
+
}
|
55789
|
+
return penalty;
|
55790
|
+
}
|
55791
|
+
__name(applyMaskPenaltyRule1Internal, "applyMaskPenaltyRule1Internal");
|
55792
|
+
function applyMaskPenaltyRule1(qrcode) {
|
55793
|
+
return applyMaskPenaltyRule1Internal(qrcode, true) + applyMaskPenaltyRule1Internal(qrcode, false);
|
55794
|
+
}
|
55795
|
+
__name(applyMaskPenaltyRule1, "applyMaskPenaltyRule1");
|
55796
|
+
function applyMaskPenaltyRule2(qrcode) {
|
55797
|
+
var matrixSize = qrcode.getMatrixSize();
|
55798
|
+
var penalty = 0;
|
55799
|
+
for (var y = 0; y < matrixSize - 1; y++) {
|
55800
|
+
for (var x = 0; x < matrixSize - 1; x++) {
|
55801
|
+
var value = qrcode.isDark(y, x);
|
55802
|
+
if (value === qrcode.isDark(y, x + 1) && value === qrcode.isDark(y + 1, x) && value === qrcode.isDark(y + 1, x + 1)) {
|
55803
|
+
penalty += N22;
|
55804
|
+
}
|
55805
|
+
}
|
55806
|
+
}
|
55807
|
+
return penalty;
|
55808
|
+
}
|
55809
|
+
__name(applyMaskPenaltyRule2, "applyMaskPenaltyRule2");
|
55810
|
+
function isFourWhite(qrcode, rangeIndex, from4, to, isHorizontal) {
|
55811
|
+
from4 = Math.max(from4, 0);
|
55812
|
+
to = Math.min(to, qrcode.getMatrixSize());
|
55813
|
+
for (var i = from4; i < to; i++) {
|
55814
|
+
var value = isHorizontal ? qrcode.isDark(rangeIndex, i) : qrcode.isDark(i, rangeIndex);
|
55815
|
+
if (value) {
|
55816
|
+
return false;
|
55817
|
+
}
|
55818
|
+
}
|
55819
|
+
return true;
|
55820
|
+
}
|
55821
|
+
__name(isFourWhite, "isFourWhite");
|
55822
|
+
function applyMaskPenaltyRule3(qrcode) {
|
55823
|
+
var matrixSize = qrcode.getMatrixSize();
|
55824
|
+
var penalty = 0;
|
55825
|
+
for (var y = 0; y < matrixSize; y++) {
|
55826
|
+
for (var x = 0; x < matrixSize; x++) {
|
55827
|
+
if (x + 6 < matrixSize && qrcode.isDark(y, x) && !qrcode.isDark(y, x + 1) && qrcode.isDark(y, x + 2) && qrcode.isDark(y, x + 3) && qrcode.isDark(y, x + 4) && !qrcode.isDark(y, x + 5) && qrcode.isDark(y, x + 6) && (isFourWhite(qrcode, y, x - 4, x, true) || isFourWhite(qrcode, y, x + 7, x + 11, true))) {
|
55828
|
+
penalty += N32;
|
55829
|
+
}
|
55830
|
+
if (y + 6 < matrixSize && qrcode.isDark(y, x) && !qrcode.isDark(y + 1, x) && qrcode.isDark(y + 2, x) && qrcode.isDark(y + 3, x) && qrcode.isDark(y + 4, x) && !qrcode.isDark(y + 5, x) && qrcode.isDark(y + 6, x) && (isFourWhite(qrcode, x, y - 4, y, false) || isFourWhite(qrcode, x, y + 7, y + 11, false))) {
|
55831
|
+
penalty += N32;
|
55832
|
+
}
|
55833
|
+
}
|
55834
|
+
}
|
55835
|
+
return penalty;
|
55836
|
+
}
|
55837
|
+
__name(applyMaskPenaltyRule3, "applyMaskPenaltyRule3");
|
55838
|
+
function applyMaskPenaltyRule4(qrcode) {
|
55839
|
+
var matrixSize = qrcode.getMatrixSize();
|
55840
|
+
var numDarkCells = 0;
|
55841
|
+
for (var y = 0; y < matrixSize; y++) {
|
55842
|
+
for (var x = 0; x < matrixSize; x++) {
|
55843
|
+
if (qrcode.isDark(y, x)) {
|
55844
|
+
numDarkCells++;
|
55845
|
+
}
|
55846
|
+
}
|
55847
|
+
}
|
55848
|
+
var numTotalCells = matrixSize * matrixSize;
|
55849
|
+
var fivePercentVariances = Math.floor(Math.abs(numDarkCells * 20 - numTotalCells * 10) / numTotalCells);
|
55850
|
+
return fivePercentVariances * N42;
|
55851
|
+
}
|
55852
|
+
__name(applyMaskPenaltyRule4, "applyMaskPenaltyRule4");
|
55853
|
+
function calculateMaskPenalty(qrcode) {
|
55854
|
+
return applyMaskPenaltyRule1(qrcode) + applyMaskPenaltyRule2(qrcode) + applyMaskPenaltyRule3(qrcode) + applyMaskPenaltyRule4(qrcode);
|
55855
|
+
}
|
55856
|
+
__name(calculateMaskPenalty, "calculateMaskPenalty");
|
55857
|
+
|
55858
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/common/ErrorCorrectionLevel.js
|
55859
|
+
var ErrorCorrectionLevel;
|
55860
|
+
(function(ErrorCorrectionLevel2) {
|
55861
|
+
ErrorCorrectionLevel2[ErrorCorrectionLevel2["L"] = 1] = "L";
|
55862
|
+
ErrorCorrectionLevel2[ErrorCorrectionLevel2["M"] = 0] = "M";
|
55863
|
+
ErrorCorrectionLevel2[ErrorCorrectionLevel2["Q"] = 3] = "Q";
|
55864
|
+
ErrorCorrectionLevel2[ErrorCorrectionLevel2["H"] = 2] = "H";
|
55865
|
+
})(ErrorCorrectionLevel || (ErrorCorrectionLevel = {}));
|
55866
|
+
|
55867
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/RSBlock.js
|
55868
|
+
var RSBlock = /* @__PURE__ */ function() {
|
55869
|
+
function RSBlock2(totalCount, dataCount) {
|
55870
|
+
this.dataCount = dataCount;
|
55871
|
+
this.totalCount = totalCount;
|
55872
|
+
}
|
55873
|
+
__name(RSBlock2, "RSBlock");
|
55874
|
+
RSBlock2.prototype.getDataCount = function() {
|
55875
|
+
return this.dataCount;
|
55876
|
+
};
|
55877
|
+
RSBlock2.prototype.getTotalCount = function() {
|
55878
|
+
return this.totalCount;
|
55879
|
+
};
|
55880
|
+
RSBlock2.getRSBlocks = function(version12, errorCorrectionLevel) {
|
55881
|
+
var rsBlocks = [];
|
55882
|
+
var rsBlock = RSBlock2.getRSBlockTable(version12, errorCorrectionLevel);
|
55883
|
+
var length2 = rsBlock.length / 3;
|
55884
|
+
for (var i = 0; i < length2; i++) {
|
55885
|
+
var count = rsBlock[i * 3 + 0];
|
55886
|
+
var totalCount = rsBlock[i * 3 + 1];
|
55887
|
+
var dataCount = rsBlock[i * 3 + 2];
|
55888
|
+
for (var j = 0; j < count; j++) {
|
55889
|
+
rsBlocks.push(new RSBlock2(totalCount, dataCount));
|
55890
|
+
}
|
55891
|
+
}
|
55892
|
+
return rsBlocks;
|
55893
|
+
};
|
55894
|
+
RSBlock2.getRSBlockTable = function(version12, errorCorrectionLevel) {
|
55895
|
+
switch (errorCorrectionLevel) {
|
55896
|
+
case ErrorCorrectionLevel.L:
|
55897
|
+
return RSBlock2.RS_BLOCK_TABLE[(version12 - 1) * 4 + 0];
|
55898
|
+
case ErrorCorrectionLevel.M:
|
55899
|
+
return RSBlock2.RS_BLOCK_TABLE[(version12 - 1) * 4 + 1];
|
55900
|
+
case ErrorCorrectionLevel.Q:
|
55901
|
+
return RSBlock2.RS_BLOCK_TABLE[(version12 - 1) * 4 + 2];
|
55902
|
+
case ErrorCorrectionLevel.H:
|
55903
|
+
return RSBlock2.RS_BLOCK_TABLE[(version12 - 1) * 4 + 3];
|
55904
|
+
default:
|
55905
|
+
throw new Error("illegal error correction level: ".concat(errorCorrectionLevel));
|
55906
|
+
}
|
55907
|
+
};
|
55908
|
+
RSBlock2.RS_BLOCK_TABLE = [
|
55909
|
+
[1, 26, 19],
|
55910
|
+
[1, 26, 16],
|
55911
|
+
[1, 26, 13],
|
55912
|
+
[1, 26, 9],
|
55913
|
+
[1, 44, 34],
|
55914
|
+
[1, 44, 28],
|
55915
|
+
[1, 44, 22],
|
55916
|
+
[1, 44, 16],
|
55917
|
+
[1, 70, 55],
|
55918
|
+
[1, 70, 44],
|
55919
|
+
[2, 35, 17],
|
55920
|
+
[2, 35, 13],
|
55921
|
+
[1, 100, 80],
|
55922
|
+
[2, 50, 32],
|
55923
|
+
[2, 50, 24],
|
55924
|
+
[4, 25, 9],
|
55925
|
+
[1, 134, 108],
|
55926
|
+
[2, 67, 43],
|
55927
|
+
[2, 33, 15, 2, 34, 16],
|
55928
|
+
[2, 33, 11, 2, 34, 12],
|
55929
|
+
[2, 86, 68],
|
55930
|
+
[4, 43, 27],
|
55931
|
+
[4, 43, 19],
|
55932
|
+
[4, 43, 15],
|
55933
|
+
[2, 98, 78],
|
55934
|
+
[4, 49, 31],
|
55935
|
+
[2, 32, 14, 4, 33, 15],
|
55936
|
+
[4, 39, 13, 1, 40, 14],
|
55937
|
+
[2, 121, 97],
|
55938
|
+
[2, 60, 38, 2, 61, 39],
|
55939
|
+
[4, 40, 18, 2, 41, 19],
|
55940
|
+
[4, 40, 14, 2, 41, 15],
|
55941
|
+
[2, 146, 116],
|
55942
|
+
[3, 58, 36, 2, 59, 37],
|
55943
|
+
[4, 36, 16, 4, 37, 17],
|
55944
|
+
[4, 36, 12, 4, 37, 13],
|
55945
|
+
[2, 86, 68, 2, 87, 69],
|
55946
|
+
[4, 69, 43, 1, 70, 44],
|
55947
|
+
[6, 43, 19, 2, 44, 20],
|
55948
|
+
[6, 43, 15, 2, 44, 16],
|
55949
|
+
[4, 101, 81],
|
55950
|
+
[1, 80, 50, 4, 81, 51],
|
55951
|
+
[4, 50, 22, 4, 51, 23],
|
55952
|
+
[3, 36, 12, 8, 37, 13],
|
55953
|
+
[2, 116, 92, 2, 117, 93],
|
55954
|
+
[6, 58, 36, 2, 59, 37],
|
55955
|
+
[4, 46, 20, 6, 47, 21],
|
55956
|
+
[7, 42, 14, 4, 43, 15],
|
55957
|
+
[4, 133, 107],
|
55958
|
+
[8, 59, 37, 1, 60, 38],
|
55959
|
+
[8, 44, 20, 4, 45, 21],
|
55960
|
+
[12, 33, 11, 4, 34, 12],
|
55961
|
+
[3, 145, 115, 1, 146, 116],
|
55962
|
+
[4, 64, 40, 5, 65, 41],
|
55963
|
+
[11, 36, 16, 5, 37, 17],
|
55964
|
+
[11, 36, 12, 5, 37, 13],
|
55965
|
+
[5, 109, 87, 1, 110, 88],
|
55966
|
+
[5, 65, 41, 5, 66, 42],
|
55967
|
+
[5, 54, 24, 7, 55, 25],
|
55968
|
+
[11, 36, 12, 7, 37, 13],
|
55969
|
+
[5, 122, 98, 1, 123, 99],
|
55970
|
+
[7, 73, 45, 3, 74, 46],
|
55971
|
+
[15, 43, 19, 2, 44, 20],
|
55972
|
+
[3, 45, 15, 13, 46, 16],
|
55973
|
+
[1, 135, 107, 5, 136, 108],
|
55974
|
+
[10, 74, 46, 1, 75, 47],
|
55975
|
+
[1, 50, 22, 15, 51, 23],
|
55976
|
+
[2, 42, 14, 17, 43, 15],
|
55977
|
+
[5, 150, 120, 1, 151, 121],
|
55978
|
+
[9, 69, 43, 4, 70, 44],
|
55979
|
+
[17, 50, 22, 1, 51, 23],
|
55980
|
+
[2, 42, 14, 19, 43, 15],
|
55981
|
+
[3, 141, 113, 4, 142, 114],
|
55982
|
+
[3, 70, 44, 11, 71, 45],
|
55983
|
+
[17, 47, 21, 4, 48, 22],
|
55984
|
+
[9, 39, 13, 16, 40, 14],
|
55985
|
+
[3, 135, 107, 5, 136, 108],
|
55986
|
+
[3, 67, 41, 13, 68, 42],
|
55987
|
+
[15, 54, 24, 5, 55, 25],
|
55988
|
+
[15, 43, 15, 10, 44, 16],
|
55989
|
+
[4, 144, 116, 4, 145, 117],
|
55990
|
+
[17, 68, 42],
|
55991
|
+
[17, 50, 22, 6, 51, 23],
|
55992
|
+
[19, 46, 16, 6, 47, 17],
|
55993
|
+
[2, 139, 111, 7, 140, 112],
|
55994
|
+
[17, 74, 46],
|
55995
|
+
[7, 54, 24, 16, 55, 25],
|
55996
|
+
[34, 37, 13],
|
55997
|
+
[4, 151, 121, 5, 152, 122],
|
55998
|
+
[4, 75, 47, 14, 76, 48],
|
55999
|
+
[11, 54, 24, 14, 55, 25],
|
56000
|
+
[16, 45, 15, 14, 46, 16],
|
56001
|
+
[6, 147, 117, 4, 148, 118],
|
56002
|
+
[6, 73, 45, 14, 74, 46],
|
56003
|
+
[11, 54, 24, 16, 55, 25],
|
56004
|
+
[30, 46, 16, 2, 47, 17],
|
56005
|
+
[8, 132, 106, 4, 133, 107],
|
56006
|
+
[8, 75, 47, 13, 76, 48],
|
56007
|
+
[7, 54, 24, 22, 55, 25],
|
56008
|
+
[22, 45, 15, 13, 46, 16],
|
56009
|
+
[10, 142, 114, 2, 143, 115],
|
56010
|
+
[19, 74, 46, 4, 75, 47],
|
56011
|
+
[28, 50, 22, 6, 51, 23],
|
56012
|
+
[33, 46, 16, 4, 47, 17],
|
56013
|
+
[8, 152, 122, 4, 153, 123],
|
56014
|
+
[22, 73, 45, 3, 74, 46],
|
56015
|
+
[8, 53, 23, 26, 54, 24],
|
56016
|
+
[12, 45, 15, 28, 46, 16],
|
56017
|
+
[3, 147, 117, 10, 148, 118],
|
56018
|
+
[3, 73, 45, 23, 74, 46],
|
56019
|
+
[4, 54, 24, 31, 55, 25],
|
56020
|
+
[11, 45, 15, 31, 46, 16],
|
56021
|
+
[7, 146, 116, 7, 147, 117],
|
56022
|
+
[21, 73, 45, 7, 74, 46],
|
56023
|
+
[1, 53, 23, 37, 54, 24],
|
56024
|
+
[19, 45, 15, 26, 46, 16],
|
56025
|
+
[5, 145, 115, 10, 146, 116],
|
56026
|
+
[19, 75, 47, 10, 76, 48],
|
56027
|
+
[15, 54, 24, 25, 55, 25],
|
56028
|
+
[23, 45, 15, 25, 46, 16],
|
56029
|
+
[13, 145, 115, 3, 146, 116],
|
56030
|
+
[2, 74, 46, 29, 75, 47],
|
56031
|
+
[42, 54, 24, 1, 55, 25],
|
56032
|
+
[23, 45, 15, 28, 46, 16],
|
56033
|
+
[17, 145, 115],
|
56034
|
+
[10, 74, 46, 23, 75, 47],
|
56035
|
+
[10, 54, 24, 35, 55, 25],
|
56036
|
+
[19, 45, 15, 35, 46, 16],
|
56037
|
+
[17, 145, 115, 1, 146, 116],
|
56038
|
+
[14, 74, 46, 21, 75, 47],
|
56039
|
+
[29, 54, 24, 19, 55, 25],
|
56040
|
+
[11, 45, 15, 46, 46, 16],
|
56041
|
+
[13, 145, 115, 6, 146, 116],
|
56042
|
+
[14, 74, 46, 23, 75, 47],
|
56043
|
+
[44, 54, 24, 7, 55, 25],
|
56044
|
+
[59, 46, 16, 1, 47, 17],
|
56045
|
+
[12, 151, 121, 7, 152, 122],
|
56046
|
+
[12, 75, 47, 26, 76, 48],
|
56047
|
+
[39, 54, 24, 14, 55, 25],
|
56048
|
+
[22, 45, 15, 41, 46, 16],
|
56049
|
+
[6, 151, 121, 14, 152, 122],
|
56050
|
+
[6, 75, 47, 34, 76, 48],
|
56051
|
+
[46, 54, 24, 10, 55, 25],
|
56052
|
+
[2, 45, 15, 64, 46, 16],
|
56053
|
+
[17, 152, 122, 4, 153, 123],
|
56054
|
+
[29, 74, 46, 14, 75, 47],
|
56055
|
+
[49, 54, 24, 10, 55, 25],
|
56056
|
+
[24, 45, 15, 46, 46, 16],
|
56057
|
+
[4, 152, 122, 18, 153, 123],
|
56058
|
+
[13, 74, 46, 32, 75, 47],
|
56059
|
+
[48, 54, 24, 14, 55, 25],
|
56060
|
+
[42, 45, 15, 32, 46, 16],
|
56061
|
+
[20, 147, 117, 4, 148, 118],
|
56062
|
+
[40, 75, 47, 7, 76, 48],
|
56063
|
+
[43, 54, 24, 22, 55, 25],
|
56064
|
+
[10, 45, 15, 67, 46, 16],
|
56065
|
+
[19, 148, 118, 6, 149, 119],
|
56066
|
+
[18, 75, 47, 31, 76, 48],
|
56067
|
+
[34, 54, 24, 34, 55, 25],
|
56068
|
+
[20, 45, 15, 61, 46, 16]
|
56069
|
+
];
|
56070
|
+
return RSBlock2;
|
56071
|
+
}();
|
56072
|
+
|
56073
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/BitBuffer.js
|
56074
|
+
var BitBuffer = /* @__PURE__ */ function() {
|
56075
|
+
function BitBuffer2() {
|
56076
|
+
this.length = 0;
|
56077
|
+
this.buffer = [];
|
56078
|
+
}
|
56079
|
+
__name(BitBuffer2, "BitBuffer");
|
56080
|
+
BitBuffer2.prototype.getBuffer = function() {
|
56081
|
+
return this.buffer;
|
56082
|
+
};
|
56083
|
+
BitBuffer2.prototype.getLengthInBits = function() {
|
56084
|
+
return this.length;
|
56085
|
+
};
|
56086
|
+
BitBuffer2.prototype.getBit = function(index) {
|
56087
|
+
return (this.buffer[index / 8 >> 0] >>> 7 - index % 8 & 1) === 1;
|
56088
|
+
};
|
56089
|
+
BitBuffer2.prototype.put = function(num, length2) {
|
56090
|
+
for (var i = 0; i < length2; i++) {
|
56091
|
+
this.putBit((num >>> length2 - i - 1 & 1) === 1);
|
56092
|
+
}
|
56093
|
+
};
|
56094
|
+
BitBuffer2.prototype.putBit = function(bit) {
|
56095
|
+
var buffer2 = this.buffer;
|
56096
|
+
if (this.length === buffer2.length * 8) {
|
56097
|
+
buffer2.push(0);
|
56098
|
+
}
|
56099
|
+
if (bit) {
|
56100
|
+
buffer2[this.length / 8 >> 0] |= 128 >>> this.length % 8;
|
56101
|
+
}
|
56102
|
+
this.length++;
|
56103
|
+
};
|
56104
|
+
return BitBuffer2;
|
56105
|
+
}();
|
56106
|
+
|
56107
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/io/OutputStream.js
|
56108
|
+
var OutputStream = /* @__PURE__ */ function() {
|
56109
|
+
function OutputStream2() {
|
56110
|
+
}
|
56111
|
+
__name(OutputStream2, "OutputStream");
|
56112
|
+
OutputStream2.prototype.writeBytes = function(bytes, offset, length2) {
|
56113
|
+
if (offset === void 0) {
|
56114
|
+
offset = 0;
|
56115
|
+
}
|
56116
|
+
if (length2 === void 0) {
|
56117
|
+
length2 = bytes.length;
|
56118
|
+
}
|
56119
|
+
for (var i = 0; i < length2; i++) {
|
56120
|
+
this.writeByte(bytes[i + offset]);
|
56121
|
+
}
|
56122
|
+
};
|
56123
|
+
OutputStream2.prototype.flush = function() {
|
56124
|
+
};
|
56125
|
+
OutputStream2.prototype.close = function() {
|
56126
|
+
this.flush();
|
56127
|
+
};
|
56128
|
+
return OutputStream2;
|
56129
|
+
}();
|
56130
|
+
|
56131
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/io/ByteArrayOutputStream.js
|
56132
|
+
var ByteArrayOutputStream = /* @__PURE__ */ function(_super) {
|
56133
|
+
__extends2(ByteArrayOutputStream2, _super);
|
56134
|
+
function ByteArrayOutputStream2() {
|
56135
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
56136
|
+
_this.bytes = [];
|
56137
|
+
return _this;
|
56138
|
+
}
|
56139
|
+
__name(ByteArrayOutputStream2, "ByteArrayOutputStream");
|
56140
|
+
ByteArrayOutputStream2.prototype.writeByte = function(byte) {
|
56141
|
+
this.bytes.push(byte);
|
56142
|
+
};
|
56143
|
+
ByteArrayOutputStream2.prototype.writeInt16 = function(byte) {
|
56144
|
+
this.bytes.push(byte, byte >>> 8);
|
56145
|
+
};
|
56146
|
+
ByteArrayOutputStream2.prototype.toByteArray = function() {
|
56147
|
+
return this.bytes;
|
56148
|
+
};
|
56149
|
+
return ByteArrayOutputStream2;
|
56150
|
+
}(OutputStream);
|
56151
|
+
|
56152
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/io/Base64EncodeOutputStream.js
|
56153
|
+
function encode16(ch) {
|
56154
|
+
if (ch >= 0) {
|
56155
|
+
if (ch < 26) {
|
56156
|
+
return 65 + ch;
|
56157
|
+
} else if (ch < 52) {
|
56158
|
+
return 97 + (ch - 26);
|
56159
|
+
} else if (ch < 62) {
|
56160
|
+
return 48 + (ch - 52);
|
56161
|
+
} else if (ch === 62) {
|
56162
|
+
return 43;
|
56163
|
+
} else if (ch === 63) {
|
56164
|
+
return 47;
|
56165
|
+
}
|
56166
|
+
}
|
56167
|
+
throw new Error("illegal char: ".concat(String.fromCharCode(ch)));
|
56168
|
+
}
|
56169
|
+
__name(encode16, "encode");
|
56170
|
+
var Base64EncodeOutputStream = /* @__PURE__ */ function(_super) {
|
56171
|
+
__extends2(Base64EncodeOutputStream2, _super);
|
56172
|
+
function Base64EncodeOutputStream2(stream) {
|
56173
|
+
var _this = _super.call(this) || this;
|
56174
|
+
_this.buffer = 0;
|
56175
|
+
_this.length = 0;
|
56176
|
+
_this.bufLength = 0;
|
56177
|
+
_this.stream = stream;
|
56178
|
+
return _this;
|
56179
|
+
}
|
56180
|
+
__name(Base64EncodeOutputStream2, "Base64EncodeOutputStream");
|
56181
|
+
Base64EncodeOutputStream2.prototype.writeByte = function(byte) {
|
56182
|
+
this.buffer = this.buffer << 8 | byte & 255;
|
56183
|
+
this.bufLength += 8;
|
56184
|
+
this.length++;
|
56185
|
+
while (this.bufLength >= 6) {
|
56186
|
+
this.writeEncoded(this.buffer >>> this.bufLength - 6);
|
56187
|
+
this.bufLength -= 6;
|
56188
|
+
}
|
56189
|
+
};
|
56190
|
+
Base64EncodeOutputStream2.prototype.flush = function() {
|
56191
|
+
if (this.bufLength > 0) {
|
56192
|
+
this.writeEncoded(this.buffer << 6 - this.bufLength);
|
56193
|
+
this.buffer = 0;
|
56194
|
+
this.bufLength = 0;
|
56195
|
+
}
|
56196
|
+
var stream = this.stream;
|
56197
|
+
if (this.length % 3 != 0) {
|
56198
|
+
var pad2 = 3 - this.length % 3;
|
56199
|
+
for (var i = 0; i < pad2; i++) {
|
56200
|
+
stream.writeByte(61);
|
56201
|
+
}
|
56202
|
+
}
|
56203
|
+
};
|
56204
|
+
Base64EncodeOutputStream2.prototype.writeEncoded = function(byte) {
|
56205
|
+
this.stream.writeByte(encode16(byte & 63));
|
56206
|
+
};
|
56207
|
+
return Base64EncodeOutputStream2;
|
56208
|
+
}(OutputStream);
|
56209
|
+
|
56210
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/image/GIFImage.js
|
56211
|
+
function encodeToBase64(data) {
|
56212
|
+
var output = new ByteArrayOutputStream();
|
56213
|
+
var stream = new Base64EncodeOutputStream(output);
|
56214
|
+
stream.writeBytes(data);
|
56215
|
+
stream.close();
|
56216
|
+
output.close();
|
56217
|
+
return output.toByteArray();
|
56218
|
+
}
|
56219
|
+
__name(encodeToBase64, "encodeToBase64");
|
56220
|
+
var LZWTable = /* @__PURE__ */ function() {
|
56221
|
+
function LZWTable2() {
|
56222
|
+
this.size = 0;
|
56223
|
+
this.map = {};
|
56224
|
+
}
|
56225
|
+
__name(LZWTable2, "LZWTable");
|
56226
|
+
LZWTable2.prototype.add = function(key2) {
|
56227
|
+
if (!this.contains(key2)) {
|
56228
|
+
this.map[key2] = this.size++;
|
56229
|
+
}
|
56230
|
+
};
|
56231
|
+
LZWTable2.prototype.getSize = function() {
|
56232
|
+
return this.size;
|
56233
|
+
};
|
56234
|
+
LZWTable2.prototype.indexOf = function(key2) {
|
56235
|
+
return this.map[key2];
|
56236
|
+
};
|
56237
|
+
LZWTable2.prototype.contains = function(key2) {
|
56238
|
+
return this.map[key2] >= 0;
|
56239
|
+
};
|
56240
|
+
return LZWTable2;
|
56241
|
+
}();
|
56242
|
+
var BitOutputStream = /* @__PURE__ */ function() {
|
56243
|
+
function BitOutputStream2(output) {
|
56244
|
+
this.output = output;
|
56245
|
+
this.bitLength = 0;
|
56246
|
+
this.bitBuffer = 0;
|
56247
|
+
}
|
56248
|
+
__name(BitOutputStream2, "BitOutputStream");
|
56249
|
+
BitOutputStream2.prototype.write = function(data, length2) {
|
56250
|
+
if (data >>> length2 !== 0) {
|
56251
|
+
throw new Error("length overflow");
|
56252
|
+
}
|
56253
|
+
var output = this.output;
|
56254
|
+
while (this.bitLength + length2 >= 8) {
|
56255
|
+
output.writeByte(255 & (data << this.bitLength | this.bitBuffer));
|
56256
|
+
length2 -= 8 - this.bitLength;
|
56257
|
+
data >>>= 8 - this.bitLength;
|
56258
|
+
this.bitBuffer = 0;
|
56259
|
+
this.bitLength = 0;
|
56260
|
+
}
|
56261
|
+
this.bitBuffer = data << this.bitLength | this.bitBuffer;
|
56262
|
+
this.bitLength = this.bitLength + length2;
|
56263
|
+
};
|
56264
|
+
BitOutputStream2.prototype.flush = function() {
|
56265
|
+
var output = this.output;
|
56266
|
+
if (this.bitLength > 0) {
|
56267
|
+
output.writeByte(this.bitBuffer);
|
56268
|
+
}
|
56269
|
+
output.flush();
|
56270
|
+
};
|
56271
|
+
BitOutputStream2.prototype.close = function() {
|
56272
|
+
this.flush();
|
56273
|
+
this.output.close();
|
56274
|
+
};
|
56275
|
+
return BitOutputStream2;
|
56276
|
+
}();
|
56277
|
+
var GIFImage = /* @__PURE__ */ function() {
|
56278
|
+
function GIFImage2(width, height) {
|
56279
|
+
this.data = [];
|
56280
|
+
this.width = width;
|
56281
|
+
this.height = height;
|
56282
|
+
var size = width * height;
|
56283
|
+
for (var i = 0; i < size; i++) {
|
56284
|
+
this.data[i] = 0;
|
56285
|
+
}
|
56286
|
+
}
|
56287
|
+
__name(GIFImage2, "GIFImage");
|
56288
|
+
GIFImage2.prototype.getLZWRaster = function(lzwMinCodeSize) {
|
56289
|
+
var table = new LZWTable();
|
56290
|
+
var fromCharCode = String.fromCharCode;
|
56291
|
+
var clearCode = 1 << lzwMinCodeSize;
|
56292
|
+
var endCode = (1 << lzwMinCodeSize) + 1;
|
56293
|
+
for (var i = 0; i < clearCode; i++) {
|
56294
|
+
table.add(fromCharCode(i));
|
56295
|
+
}
|
56296
|
+
table.add(fromCharCode(clearCode));
|
56297
|
+
table.add(fromCharCode(endCode));
|
56298
|
+
var bitLength = lzwMinCodeSize + 1;
|
56299
|
+
var byteOutput = new ByteArrayOutputStream();
|
56300
|
+
var bitOutput = new BitOutputStream(byteOutput);
|
56301
|
+
try {
|
56302
|
+
var data = this.data;
|
56303
|
+
var length_1 = data.length;
|
56304
|
+
var fromCharCode_1 = String.fromCharCode;
|
56305
|
+
bitOutput.write(clearCode, bitLength);
|
56306
|
+
var dataIndex = 0;
|
56307
|
+
var words = fromCharCode_1(data[dataIndex++]);
|
56308
|
+
while (dataIndex < length_1) {
|
56309
|
+
var char = fromCharCode_1(data[dataIndex++]);
|
56310
|
+
if (table.contains(words + char)) {
|
56311
|
+
words += char;
|
56312
|
+
} else {
|
56313
|
+
bitOutput.write(table.indexOf(words), bitLength);
|
56314
|
+
if (table.getSize() < 4095) {
|
56315
|
+
if (table.getSize() === 1 << bitLength) {
|
56316
|
+
bitLength++;
|
56317
|
+
}
|
56318
|
+
table.add(words + char);
|
56319
|
+
}
|
56320
|
+
words = char;
|
56321
|
+
}
|
56322
|
+
}
|
56323
|
+
bitOutput.write(table.indexOf(words), bitLength);
|
56324
|
+
bitOutput.write(endCode, bitLength);
|
56325
|
+
} finally {
|
56326
|
+
bitOutput.close();
|
56327
|
+
}
|
56328
|
+
return byteOutput.toByteArray();
|
56329
|
+
};
|
56330
|
+
GIFImage2.prototype.setPixel = function(x, y, pixel) {
|
56331
|
+
var _a = this, width = _a.width, height = _a.height;
|
56332
|
+
if (x < 0 || width <= x)
|
56333
|
+
throw new Error("illegal x axis: ".concat(x));
|
56334
|
+
if (y < 0 || height <= y)
|
56335
|
+
throw new Error("illegal y axis: ".concat(y));
|
56336
|
+
this.data[y * width + x] = pixel;
|
56337
|
+
};
|
56338
|
+
GIFImage2.prototype.getPixel = function(x, y) {
|
56339
|
+
var _a = this, width = _a.width, height = _a.height;
|
56340
|
+
if (x < 0 || width <= x)
|
56341
|
+
throw new Error("illegal x axis: ".concat(x));
|
56342
|
+
if (y < 0 || height <= y)
|
56343
|
+
throw new Error("illegal y axis: ".concat(y));
|
56344
|
+
return this.data[y * width + x];
|
56345
|
+
};
|
56346
|
+
GIFImage2.prototype.write = function(output) {
|
56347
|
+
var _a = this, width = _a.width, height = _a.height;
|
56348
|
+
output.writeByte(71);
|
56349
|
+
output.writeByte(73);
|
56350
|
+
output.writeByte(70);
|
56351
|
+
output.writeByte(56);
|
56352
|
+
output.writeByte(55);
|
56353
|
+
output.writeByte(97);
|
56354
|
+
output.writeInt16(width);
|
56355
|
+
output.writeInt16(height);
|
56356
|
+
output.writeByte(128);
|
56357
|
+
output.writeByte(0);
|
56358
|
+
output.writeByte(0);
|
56359
|
+
output.writeByte(0);
|
56360
|
+
output.writeByte(0);
|
56361
|
+
output.writeByte(0);
|
56362
|
+
output.writeByte(255);
|
56363
|
+
output.writeByte(255);
|
56364
|
+
output.writeByte(255);
|
56365
|
+
output.writeByte(44);
|
56366
|
+
output.writeInt16(0);
|
56367
|
+
output.writeInt16(0);
|
56368
|
+
output.writeInt16(width);
|
56369
|
+
output.writeInt16(height);
|
56370
|
+
output.writeByte(0);
|
56371
|
+
var lzwMinCodeSize = 2;
|
56372
|
+
var raster = this.getLZWRaster(lzwMinCodeSize);
|
56373
|
+
var raLength = raster.length;
|
56374
|
+
output.writeByte(lzwMinCodeSize);
|
56375
|
+
var offset = 0;
|
56376
|
+
while (raLength - offset > 255) {
|
56377
|
+
output.writeByte(255);
|
56378
|
+
output.writeBytes(raster, offset, 255);
|
56379
|
+
offset += 255;
|
56380
|
+
}
|
56381
|
+
var length2 = raLength - offset;
|
56382
|
+
output.writeByte(length2);
|
56383
|
+
output.writeBytes(raster, offset, length2);
|
56384
|
+
output.writeByte(0);
|
56385
|
+
output.writeByte(59);
|
56386
|
+
};
|
56387
|
+
GIFImage2.prototype.toDataURL = function() {
|
56388
|
+
var output = new ByteArrayOutputStream();
|
56389
|
+
this.write(output);
|
56390
|
+
var bytes = encodeToBase64(output.toByteArray());
|
56391
|
+
output.close();
|
56392
|
+
var length2 = bytes.length;
|
56393
|
+
var fromCharCode = String.fromCharCode;
|
56394
|
+
var url = "data:image/gif;base64,";
|
56395
|
+
for (var i = 0; i < length2; i++) {
|
56396
|
+
url += fromCharCode(bytes[i]);
|
56397
|
+
}
|
56398
|
+
return url;
|
56399
|
+
};
|
56400
|
+
return GIFImage2;
|
56401
|
+
}();
|
56402
|
+
|
56403
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/common/MaskPattern.js
|
56404
|
+
function getMaskFunc(maskPattern) {
|
56405
|
+
switch (maskPattern) {
|
56406
|
+
case 0:
|
56407
|
+
return function(x, y) {
|
56408
|
+
return (x + y & 1) === 0;
|
56409
|
+
};
|
56410
|
+
case 1:
|
56411
|
+
return function(_x, y) {
|
56412
|
+
return (y & 1) === 0;
|
56413
|
+
};
|
56414
|
+
case 2:
|
56415
|
+
return function(x, _y) {
|
56416
|
+
return x % 3 === 0;
|
56417
|
+
};
|
56418
|
+
case 3:
|
56419
|
+
return function(x, y) {
|
56420
|
+
return (x + y) % 3 === 0;
|
56421
|
+
};
|
56422
|
+
case 4:
|
56423
|
+
return function(x, y) {
|
56424
|
+
return ((x / 3 >> 0) + (y / 2 >> 0) & 1) === 0;
|
56425
|
+
};
|
56426
|
+
case 5:
|
56427
|
+
return function(x, y) {
|
56428
|
+
return (x * y & 1) + x * y % 3 === 0;
|
56429
|
+
};
|
56430
|
+
case 6:
|
56431
|
+
return function(x, y) {
|
56432
|
+
return ((x * y & 1) + x * y % 3 & 1) === 0;
|
56433
|
+
};
|
56434
|
+
case 7:
|
56435
|
+
return function(x, y) {
|
56436
|
+
return (x * y % 3 + (x + y & 1) & 1) === 0;
|
56437
|
+
};
|
56438
|
+
default:
|
56439
|
+
throw new Error("illegal mask: ".concat(maskPattern));
|
56440
|
+
}
|
56441
|
+
}
|
56442
|
+
__name(getMaskFunc, "getMaskFunc");
|
56443
|
+
|
56444
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/Writer.js
|
56445
|
+
var PAD0 = 236;
|
56446
|
+
var PAD1 = 17;
|
56447
|
+
var toString5 = Object.prototype.toString;
|
56448
|
+
function appendECI(encoding, buffer2) {
|
56449
|
+
if (encoding < 0 || encoding >= 1e6) {
|
56450
|
+
throw new Error("byte mode encoding hint out of range");
|
56451
|
+
}
|
56452
|
+
buffer2.put(Mode.ECI, 4);
|
56453
|
+
if (encoding < 1 << 7) {
|
56454
|
+
buffer2.put(encoding, 8);
|
56455
|
+
} else if (encoding < 1 << 14) {
|
56456
|
+
buffer2.put(2, 2);
|
56457
|
+
buffer2.put(encoding, 14);
|
56458
|
+
} else {
|
56459
|
+
buffer2.put(6, 3);
|
56460
|
+
buffer2.put(encoding, 21);
|
56461
|
+
}
|
56462
|
+
}
|
56463
|
+
__name(appendECI, "appendECI");
|
56464
|
+
function prepareData(version12, errorCorrectionLevel, encodingHint, chunks) {
|
56465
|
+
var buffer2 = new BitBuffer();
|
56466
|
+
var rsBlocks = RSBlock.getRSBlocks(version12, errorCorrectionLevel);
|
56467
|
+
for (var _i = 0, chunks_1 = chunks; _i < chunks_1.length; _i++) {
|
56468
|
+
var data = chunks_1[_i];
|
56469
|
+
var mode = data.mode;
|
56470
|
+
if (encodingHint && mode === Mode.Byte) {
|
56471
|
+
appendECI(data.encoding, buffer2);
|
56472
|
+
}
|
56473
|
+
buffer2.put(mode, 4);
|
56474
|
+
buffer2.put(data.getLength(), data.getLengthInBits(version12));
|
56475
|
+
data.writeTo(buffer2);
|
56476
|
+
}
|
56477
|
+
var maxDataCount = 0;
|
56478
|
+
for (var _a = 0, rsBlocks_1 = rsBlocks; _a < rsBlocks_1.length; _a++) {
|
56479
|
+
var rsBlock = rsBlocks_1[_a];
|
56480
|
+
maxDataCount += rsBlock.getDataCount();
|
56481
|
+
}
|
56482
|
+
maxDataCount *= 8;
|
56483
|
+
return [buffer2, rsBlocks, maxDataCount];
|
56484
|
+
}
|
56485
|
+
__name(prepareData, "prepareData");
|
56486
|
+
function createBytes(buffer2, rsBlocks) {
|
56487
|
+
var offset = 0;
|
56488
|
+
var maxDcCount = 0;
|
56489
|
+
var maxEcCount = 0;
|
56490
|
+
var dcData = [];
|
56491
|
+
var ecData = [];
|
56492
|
+
var rsLength = rsBlocks.length;
|
56493
|
+
var bufferData = buffer2.getBuffer();
|
56494
|
+
for (var r = 0; r < rsLength; r++) {
|
56495
|
+
var rsBlock = rsBlocks[r];
|
56496
|
+
var dcCount = rsBlock.getDataCount();
|
56497
|
+
var ecCount = rsBlock.getTotalCount() - dcCount;
|
56498
|
+
maxDcCount = Math.max(maxDcCount, dcCount);
|
56499
|
+
maxEcCount = Math.max(maxEcCount, ecCount);
|
56500
|
+
dcData[r] = [];
|
56501
|
+
for (var i = 0; i < dcCount; i++) {
|
56502
|
+
dcData[r][i] = 255 & bufferData[i + offset];
|
56503
|
+
}
|
56504
|
+
offset += dcCount;
|
56505
|
+
var rsPoly = getErrorCorrectionPolynomial(ecCount);
|
56506
|
+
var ecLength = rsPoly.getLength() - 1;
|
56507
|
+
var rawPoly = new Polynomial(dcData[r], ecLength);
|
56508
|
+
var modPoly = rawPoly.mod(rsPoly);
|
56509
|
+
var mpLength = modPoly.getLength();
|
56510
|
+
ecData[r] = [];
|
56511
|
+
for (var i = 0; i < ecLength; i++) {
|
56512
|
+
var modIndex = i + mpLength - ecLength;
|
56513
|
+
ecData[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
|
56514
|
+
}
|
56515
|
+
}
|
56516
|
+
buffer2 = new BitBuffer();
|
56517
|
+
for (var i = 0; i < maxDcCount; i++) {
|
56518
|
+
for (var r = 0; r < rsLength; r++) {
|
56519
|
+
if (i < dcData[r].length) {
|
56520
|
+
buffer2.put(dcData[r][i], 8);
|
56521
|
+
}
|
56522
|
+
}
|
56523
|
+
}
|
56524
|
+
for (var i = 0; i < maxEcCount; i++) {
|
56525
|
+
for (var r = 0; r < rsLength; r++) {
|
56526
|
+
if (i < ecData[r].length) {
|
56527
|
+
buffer2.put(ecData[r][i], 8);
|
56528
|
+
}
|
56529
|
+
}
|
56530
|
+
}
|
56531
|
+
return buffer2;
|
56532
|
+
}
|
56533
|
+
__name(createBytes, "createBytes");
|
56534
|
+
function createData(buffer2, rsBlocks, maxDataCount) {
|
56535
|
+
if (buffer2.getLengthInBits() + 4 <= maxDataCount) {
|
56536
|
+
buffer2.put(0, 4);
|
56537
|
+
}
|
56538
|
+
while (buffer2.getLengthInBits() % 8 !== 0) {
|
56539
|
+
buffer2.putBit(false);
|
56540
|
+
}
|
56541
|
+
while (true) {
|
56542
|
+
if (buffer2.getLengthInBits() >= maxDataCount) {
|
56543
|
+
break;
|
56544
|
+
}
|
56545
|
+
buffer2.put(PAD0, 8);
|
56546
|
+
if (buffer2.getLengthInBits() >= maxDataCount) {
|
56547
|
+
break;
|
56548
|
+
}
|
56549
|
+
buffer2.put(PAD1, 8);
|
56550
|
+
}
|
56551
|
+
return createBytes(buffer2, rsBlocks);
|
56552
|
+
}
|
56553
|
+
__name(createData, "createData");
|
56554
|
+
var Encoder2 = /* @__PURE__ */ function() {
|
56555
|
+
function Encoder3(options) {
|
56556
|
+
if (options === void 0) {
|
56557
|
+
options = {};
|
56558
|
+
}
|
56559
|
+
this.matrixSize = 0;
|
56560
|
+
this.chunks = [];
|
56561
|
+
this.matrix = [];
|
56562
|
+
var _a = options.version, version12 = _a === void 0 ? 0 : _a, _b = options.encodingHint, encodingHint = _b === void 0 ? false : _b, _c = options.errorCorrectionLevel, errorCorrectionLevel = _c === void 0 ? ErrorCorrectionLevel.L : _c;
|
56563
|
+
this.setVersion(version12);
|
56564
|
+
this.setEncodingHint(encodingHint);
|
56565
|
+
this.setErrorCorrectionLevel(errorCorrectionLevel);
|
56566
|
+
}
|
56567
|
+
__name(Encoder3, "Encoder");
|
56568
|
+
Encoder3.prototype.getMatrix = function() {
|
56569
|
+
return this.matrix;
|
56570
|
+
};
|
56571
|
+
Encoder3.prototype.getMatrixSize = function() {
|
56572
|
+
return this.matrixSize;
|
56573
|
+
};
|
56574
|
+
Encoder3.prototype.getVersion = function() {
|
56575
|
+
return this.version;
|
56576
|
+
};
|
56577
|
+
Encoder3.prototype.setVersion = function(version12) {
|
56578
|
+
this.version = Math.min(40, Math.max(0, version12 >> 0));
|
56579
|
+
this.auto = this.version === 0;
|
56580
|
+
return this;
|
56581
|
+
};
|
56582
|
+
Encoder3.prototype.getErrorCorrectionLevel = function() {
|
56583
|
+
return this.errorCorrectionLevel;
|
56584
|
+
};
|
56585
|
+
Encoder3.prototype.setErrorCorrectionLevel = function(errorCorrectionLevel) {
|
56586
|
+
switch (errorCorrectionLevel) {
|
56587
|
+
case ErrorCorrectionLevel.L:
|
56588
|
+
case ErrorCorrectionLevel.M:
|
56589
|
+
case ErrorCorrectionLevel.Q:
|
56590
|
+
case ErrorCorrectionLevel.H:
|
56591
|
+
this.errorCorrectionLevel = errorCorrectionLevel;
|
56592
|
+
}
|
56593
|
+
return this;
|
56594
|
+
};
|
56595
|
+
Encoder3.prototype.getEncodingHint = function() {
|
56596
|
+
return this.encodingHint;
|
56597
|
+
};
|
56598
|
+
Encoder3.prototype.setEncodingHint = function(encodingHint) {
|
56599
|
+
this.encodingHint = encodingHint;
|
56600
|
+
return this;
|
56601
|
+
};
|
56602
|
+
Encoder3.prototype.write = function(data) {
|
56603
|
+
var chunks = this.chunks;
|
56604
|
+
if (data instanceof QRData) {
|
56605
|
+
chunks.push(data);
|
56606
|
+
} else {
|
56607
|
+
var type = toString5.call(data);
|
56608
|
+
if (type === "[object String]") {
|
56609
|
+
chunks.push(new QRByte(data));
|
56610
|
+
} else {
|
56611
|
+
throw new Error("illegal data: ".concat(data));
|
56612
|
+
}
|
56613
|
+
}
|
56614
|
+
return this;
|
56615
|
+
};
|
56616
|
+
Encoder3.prototype.isDark = function(row, col) {
|
56617
|
+
return this.matrix[row][col] === true;
|
56618
|
+
};
|
56619
|
+
Encoder3.prototype.setupFinderPattern = function(row, col) {
|
56620
|
+
var matrix = this.matrix;
|
56621
|
+
var matrixSize = this.matrixSize;
|
56622
|
+
for (var r = -1; r <= 7; r++) {
|
56623
|
+
for (var c = -1; c <= 7; c++) {
|
56624
|
+
if (row + r <= -1 || matrixSize <= row + r || col + c <= -1 || matrixSize <= col + c) {
|
56625
|
+
continue;
|
56626
|
+
}
|
56627
|
+
if (0 <= r && r <= 6 && (c === 0 || c === 6) || 0 <= c && c <= 6 && (r === 0 || r === 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
|
56628
|
+
matrix[row + r][col + c] = true;
|
56629
|
+
} else {
|
56630
|
+
matrix[row + r][col + c] = false;
|
56631
|
+
}
|
56632
|
+
}
|
56633
|
+
}
|
56634
|
+
};
|
56635
|
+
Encoder3.prototype.setupAlignmentPattern = function() {
|
56636
|
+
var matrix = this.matrix;
|
56637
|
+
var pos = getAlignmentPattern(this.version);
|
56638
|
+
var length2 = pos.length;
|
56639
|
+
for (var i = 0; i < length2; i++) {
|
56640
|
+
for (var j = 0; j < length2; j++) {
|
56641
|
+
var row = pos[i];
|
56642
|
+
var col = pos[j];
|
56643
|
+
if (matrix[row][col] !== null) {
|
56644
|
+
continue;
|
56645
|
+
}
|
56646
|
+
for (var r = -2; r <= 2; r++) {
|
56647
|
+
for (var c = -2; c <= 2; c++) {
|
56648
|
+
if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) {
|
56649
|
+
matrix[row + r][col + c] = true;
|
56650
|
+
} else {
|
56651
|
+
matrix[row + r][col + c] = false;
|
56652
|
+
}
|
56653
|
+
}
|
56654
|
+
}
|
56655
|
+
}
|
56656
|
+
}
|
56657
|
+
};
|
56658
|
+
Encoder3.prototype.setupTimingPattern = function() {
|
56659
|
+
var matrix = this.matrix;
|
56660
|
+
var count = this.matrixSize - 8;
|
56661
|
+
for (var i = 8; i < count; i++) {
|
56662
|
+
var bit = i % 2 === 0;
|
56663
|
+
if (matrix[i][6] === null) {
|
56664
|
+
matrix[i][6] = bit;
|
56665
|
+
}
|
56666
|
+
if (matrix[6][i] === null) {
|
56667
|
+
matrix[6][i] = bit;
|
56668
|
+
}
|
56669
|
+
}
|
56670
|
+
};
|
56671
|
+
Encoder3.prototype.setupFormatInfo = function(maskPattern) {
|
56672
|
+
var matrix = this.matrix;
|
56673
|
+
var data = this.errorCorrectionLevel << 3 | maskPattern;
|
56674
|
+
var bits = getBCHVersionInfo(data);
|
56675
|
+
var matrixSize = this.matrixSize;
|
56676
|
+
for (var i = 0; i < 15; i++) {
|
56677
|
+
var bit = (bits >> i & 1) === 1;
|
56678
|
+
if (i < 6) {
|
56679
|
+
matrix[i][8] = bit;
|
56680
|
+
} else if (i < 8) {
|
56681
|
+
matrix[i + 1][8] = bit;
|
56682
|
+
} else {
|
56683
|
+
matrix[matrixSize - 15 + i][8] = bit;
|
56684
|
+
}
|
56685
|
+
if (i < 8) {
|
56686
|
+
matrix[8][matrixSize - i - 1] = bit;
|
56687
|
+
} else if (i < 9) {
|
56688
|
+
matrix[8][15 - i - 1 + 1] = bit;
|
56689
|
+
} else {
|
56690
|
+
matrix[8][15 - i - 1] = bit;
|
56691
|
+
}
|
56692
|
+
}
|
56693
|
+
matrix[matrixSize - 8][8] = true;
|
56694
|
+
};
|
56695
|
+
Encoder3.prototype.setupVersionInfo = function() {
|
56696
|
+
if (this.version >= 7) {
|
56697
|
+
var matrix = this.matrix;
|
56698
|
+
var matrixSize = this.matrixSize;
|
56699
|
+
var bits = getBCHVersion(this.version);
|
56700
|
+
for (var i = 0; i < 18; i++) {
|
56701
|
+
var bit = (bits >> i & 1) === 1;
|
56702
|
+
matrix[i / 3 >> 0][i % 3 + matrixSize - 8 - 3] = bit;
|
56703
|
+
matrix[i % 3 + matrixSize - 8 - 3][i / 3 >> 0] = bit;
|
56704
|
+
}
|
56705
|
+
}
|
56706
|
+
};
|
56707
|
+
Encoder3.prototype.setupCodewords = function(data, maskPattern) {
|
56708
|
+
var matrix = this.matrix;
|
56709
|
+
var matrixSize = this.matrixSize;
|
56710
|
+
var bitLength = data.getLengthInBits();
|
56711
|
+
var maskFunc = getMaskFunc(maskPattern);
|
56712
|
+
var bitIndex = 0;
|
56713
|
+
for (var right = matrixSize - 1; right >= 1; right -= 2) {
|
56714
|
+
if (right === 6) {
|
56715
|
+
right = 5;
|
56716
|
+
}
|
56717
|
+
for (var vert = 0; vert < matrixSize; vert++) {
|
56718
|
+
for (var j = 0; j < 2; j++) {
|
56719
|
+
var x = right - j;
|
56720
|
+
var upward = (right + 1 & 2) === 0;
|
56721
|
+
var y = upward ? matrixSize - 1 - vert : vert;
|
56722
|
+
if (matrix[y][x] !== null) {
|
56723
|
+
continue;
|
56724
|
+
}
|
56725
|
+
var bit = false;
|
56726
|
+
if (bitIndex < bitLength) {
|
56727
|
+
bit = data.getBit(bitIndex++);
|
56728
|
+
}
|
56729
|
+
var invert = maskFunc(x, y);
|
56730
|
+
if (invert) {
|
56731
|
+
bit = !bit;
|
56732
|
+
}
|
56733
|
+
matrix[y][x] = bit;
|
56734
|
+
}
|
56735
|
+
}
|
56736
|
+
}
|
56737
|
+
};
|
56738
|
+
Encoder3.prototype.buildMatrix = function(data, maskPattern) {
|
56739
|
+
var matrix = [];
|
56740
|
+
var matrixSize = this.matrixSize;
|
56741
|
+
for (var row = 0; row < matrixSize; row++) {
|
56742
|
+
matrix[row] = [];
|
56743
|
+
for (var col = 0; col < matrixSize; col++) {
|
56744
|
+
matrix[row][col] = null;
|
56745
|
+
}
|
56746
|
+
}
|
56747
|
+
this.matrix = matrix;
|
56748
|
+
this.setupFinderPattern(0, 0);
|
56749
|
+
this.setupFinderPattern(matrixSize - 7, 0);
|
56750
|
+
this.setupFinderPattern(0, matrixSize - 7);
|
56751
|
+
this.setupAlignmentPattern();
|
56752
|
+
this.setupTimingPattern();
|
56753
|
+
this.setupFormatInfo(maskPattern);
|
56754
|
+
this.setupVersionInfo();
|
56755
|
+
this.setupCodewords(data, maskPattern);
|
56756
|
+
};
|
56757
|
+
Encoder3.prototype.make = function() {
|
56758
|
+
var _a, _b;
|
56759
|
+
var buffer2;
|
56760
|
+
var rsBlocks;
|
56761
|
+
var maxDataCount;
|
56762
|
+
var _c = this, chunks = _c.chunks, errorCorrectionLevel = _c.errorCorrectionLevel;
|
56763
|
+
if (this.auto) {
|
56764
|
+
var version12 = 1;
|
56765
|
+
for (; version12 <= 40; version12++) {
|
56766
|
+
_a = prepareData(version12, errorCorrectionLevel, this.encodingHint, chunks), buffer2 = _a[0], rsBlocks = _a[1], maxDataCount = _a[2];
|
56767
|
+
if (buffer2.getLengthInBits() <= maxDataCount)
|
56768
|
+
break;
|
56769
|
+
}
|
56770
|
+
var dataLengthInBits = buffer2.getLengthInBits();
|
56771
|
+
if (dataLengthInBits > maxDataCount) {
|
56772
|
+
throw new Error("data overflow: ".concat(dataLengthInBits, " > ").concat(maxDataCount));
|
56773
|
+
}
|
56774
|
+
this.version = version12;
|
56775
|
+
} else {
|
56776
|
+
_b = prepareData(this.version, errorCorrectionLevel, this.encodingHint, chunks), buffer2 = _b[0], rsBlocks = _b[1], maxDataCount = _b[2];
|
56777
|
+
}
|
56778
|
+
this.matrixSize = this.version * 4 + 17;
|
56779
|
+
var matrices = [];
|
56780
|
+
var data = createData(buffer2, rsBlocks, maxDataCount);
|
56781
|
+
var bestMaskPattern = -1;
|
56782
|
+
var minPenalty = Number.MAX_VALUE;
|
56783
|
+
for (var maskPattern = 0; maskPattern < 8; maskPattern++) {
|
56784
|
+
this.buildMatrix(data, maskPattern);
|
56785
|
+
matrices.push(this.matrix);
|
56786
|
+
var penalty = calculateMaskPenalty(this);
|
56787
|
+
if (penalty < minPenalty) {
|
56788
|
+
minPenalty = penalty;
|
56789
|
+
bestMaskPattern = maskPattern;
|
56790
|
+
}
|
56791
|
+
}
|
56792
|
+
this.matrix = matrices[bestMaskPattern];
|
56793
|
+
return this;
|
56794
|
+
};
|
56795
|
+
Encoder3.prototype.toDataURL = function(moduleSize, margin) {
|
56796
|
+
if (moduleSize === void 0) {
|
56797
|
+
moduleSize = 2;
|
56798
|
+
}
|
56799
|
+
if (margin === void 0) {
|
56800
|
+
margin = moduleSize * 4;
|
56801
|
+
}
|
56802
|
+
moduleSize = Math.max(1, moduleSize >> 0);
|
56803
|
+
margin = Math.max(0, margin >> 0);
|
56804
|
+
var matrixSize = this.matrixSize;
|
56805
|
+
var size = moduleSize * matrixSize + margin * 2;
|
56806
|
+
var min = margin;
|
56807
|
+
var max = size - margin;
|
56808
|
+
var gif = new GIFImage(size, size);
|
56809
|
+
for (var y = 0; y < size; y++) {
|
56810
|
+
for (var x = 0; x < size; x++) {
|
56811
|
+
if (min <= x && x < max && min <= y && y < max) {
|
56812
|
+
var row = (y - min) / moduleSize >> 0;
|
56813
|
+
var col = (x - min) / moduleSize >> 0;
|
56814
|
+
gif.setPixel(x, y, this.isDark(row, col) ? 0 : 1);
|
56815
|
+
} else {
|
56816
|
+
gif.setPixel(x, y, 1);
|
56817
|
+
}
|
56818
|
+
}
|
56819
|
+
}
|
56820
|
+
return gif.toDataURL();
|
56821
|
+
};
|
56822
|
+
Encoder3.prototype.clear = function() {
|
56823
|
+
this.chunks = [];
|
56824
|
+
};
|
56825
|
+
return Encoder3;
|
56826
|
+
}();
|
56827
|
+
|
56828
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/encoding/UTF16.js
|
56829
|
+
function encode17(text) {
|
56830
|
+
var length2 = text.length;
|
56831
|
+
var bytes = [];
|
56832
|
+
for (var i = 0; i < length2; i++) {
|
56833
|
+
bytes.push(text.charCodeAt(i));
|
56834
|
+
}
|
56835
|
+
return bytes;
|
56836
|
+
}
|
56837
|
+
__name(encode17, "encode");
|
56838
|
+
|
56839
|
+
// ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRAlphanumeric.js
|
56840
|
+
function getByte(byte) {
|
56841
|
+
if (48 <= byte && byte <= 57) {
|
56842
|
+
return byte - 48;
|
56843
|
+
} else if (65 <= byte && byte <= 90) {
|
56844
|
+
return byte - 65 + 10;
|
56845
|
+
} else {
|
56846
|
+
switch (byte) {
|
56847
|
+
case 32:
|
56848
|
+
return 36;
|
56849
|
+
case 36:
|
56850
|
+
return 37;
|
56851
|
+
case 37:
|
56852
|
+
return 38;
|
56853
|
+
case 42:
|
56854
|
+
return 39;
|
56855
|
+
case 43:
|
56856
|
+
return 40;
|
56857
|
+
case 45:
|
56858
|
+
return 41;
|
56859
|
+
case 46:
|
56860
|
+
return 42;
|
56861
|
+
case 47:
|
56862
|
+
return 43;
|
56863
|
+
case 58:
|
56864
|
+
return 44;
|
56865
|
+
default:
|
56866
|
+
throw new Error("illegal char: ".concat(String.fromCharCode(byte)));
|
56867
|
+
}
|
56868
|
+
}
|
56869
|
+
}
|
56870
|
+
__name(getByte, "getByte");
|
56871
|
+
var QRAlphanumeric = /* @__PURE__ */ function(_super) {
|
56872
|
+
__extends2(QRAlphanumeric2, _super);
|
56873
|
+
function QRAlphanumeric2(data) {
|
56874
|
+
var _this = _super.call(this, Mode.Alphanumeric, data) || this;
|
56875
|
+
_this.bytes = encode17(data);
|
56876
|
+
return _this;
|
56877
|
+
}
|
56878
|
+
__name(QRAlphanumeric2, "QRAlphanumeric");
|
56879
|
+
QRAlphanumeric2.prototype.writeTo = function(buffer2) {
|
56880
|
+
var i = 0;
|
56881
|
+
var bytes = this.bytes;
|
56882
|
+
var length2 = bytes.length;
|
56883
|
+
while (i + 1 < length2) {
|
56884
|
+
buffer2.put(getByte(bytes[i]) * 45 + getByte(bytes[i + 1]), 11);
|
56885
|
+
i += 2;
|
56886
|
+
}
|
56887
|
+
if (i < length2) {
|
56888
|
+
buffer2.put(getByte(bytes[i]), 6);
|
56889
|
+
}
|
56890
|
+
};
|
56891
|
+
return QRAlphanumeric2;
|
56892
|
+
}(QRData);
|
56893
|
+
|
56894
|
+
// ../../node_modules/.pnpm/@digitalbazaar+vpqr@3.0.0/node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
56895
|
+
var VP_QR_VERSION = "VP1";
|
56896
|
+
var BASE_32_UPPERCASE_MULTIBASE_PREFIX = "B";
|
56897
|
+
function _bytesToQrCodeDataUrl({ bytes, size }) {
|
56898
|
+
const qrcode = new Encoder2();
|
56899
|
+
qrcode.setEncodingHint(true);
|
56900
|
+
const encoded = base32Encode(bytes, "RFC4648", { padding: false });
|
56901
|
+
const vpPayload = `${VP_QR_VERSION}-${BASE_32_UPPERCASE_MULTIBASE_PREFIX}${encoded}`;
|
56902
|
+
qrcode.write(new QRAlphanumeric(vpPayload));
|
56903
|
+
qrcode.make();
|
56904
|
+
return {
|
56905
|
+
payload: vpPayload,
|
56906
|
+
encodedCborld: encoded,
|
56907
|
+
version: qrcode.getVersion(),
|
56908
|
+
imageDataUrl: qrcode.toDataURL(size)
|
56909
|
+
};
|
56910
|
+
}
|
56911
|
+
__name(_bytesToQrCodeDataUrl, "_bytesToQrCodeDataUrl");
|
56912
|
+
function toQrCode() {
|
56913
|
+
return __async(this, arguments, function* ({
|
56914
|
+
vp,
|
56915
|
+
documentLoader,
|
56916
|
+
size,
|
56917
|
+
diagnose
|
56918
|
+
} = {}) {
|
56919
|
+
const cborldBytes = yield encode14({
|
56920
|
+
jsonldDocument: vp,
|
56921
|
+
documentLoader,
|
56922
|
+
diagnose
|
56923
|
+
});
|
56924
|
+
const {
|
56925
|
+
payload,
|
56926
|
+
imageDataUrl,
|
56927
|
+
encodedCborld,
|
56928
|
+
version: version12
|
56929
|
+
} = _bytesToQrCodeDataUrl({
|
56930
|
+
bytes: cborldBytes,
|
56931
|
+
size
|
56932
|
+
});
|
56933
|
+
return {
|
56934
|
+
payload,
|
56935
|
+
imageDataUrl,
|
56936
|
+
encodedCborld,
|
56937
|
+
rawCborldBytes: cborldBytes,
|
56938
|
+
version: version12
|
56939
|
+
};
|
56940
|
+
});
|
56941
|
+
}
|
56942
|
+
__name(toQrCode, "toQrCode");
|
56943
|
+
function fromQrCode() {
|
56944
|
+
return __async(this, arguments, function* ({
|
56945
|
+
text,
|
56946
|
+
documentLoader,
|
56947
|
+
diagnose
|
56948
|
+
} = {}) {
|
56949
|
+
const header = VP_QR_VERSION + "-";
|
56950
|
+
if (!(text && text.startsWith(header))) {
|
56951
|
+
throw TypeError("Unsupported VP QR format.");
|
56952
|
+
}
|
56953
|
+
const multibasePayload = text.slice(header.length);
|
56954
|
+
if (!multibasePayload.startsWith(BASE_32_UPPERCASE_MULTIBASE_PREFIX)) {
|
56955
|
+
throw TypeError("Payload must be multibase base32 (RFC4648) encoded.");
|
56956
|
+
}
|
56957
|
+
const cborldArrayBuffer = (0, import_base32_decode.default)(multibasePayload.slice(1), "RFC4648");
|
56958
|
+
const cborldBytes = new Uint8Array(cborldArrayBuffer);
|
56959
|
+
const vp = yield decode13({
|
56960
|
+
cborldBytes,
|
56961
|
+
documentLoader,
|
56962
|
+
diagnose
|
56963
|
+
});
|
56964
|
+
return { vp };
|
56965
|
+
});
|
56966
|
+
}
|
56967
|
+
__name(fromQrCode, "fromQrCode");
|
56968
|
+
|
56969
|
+
// src/wallet/plugins/vpqr/index.ts
|
56970
|
+
var getVpqrPlugin = /* @__PURE__ */ __name((wallet) => {
|
56971
|
+
return {
|
56972
|
+
pluginMethods: {
|
56973
|
+
vpFromQrCode: (_wallet, text) => __async(void 0, null, function* () {
|
56974
|
+
var _a;
|
56975
|
+
return (_a = yield fromQrCode({
|
56976
|
+
text,
|
56977
|
+
documentLoader: (url) => __async(void 0, null, function* () {
|
56978
|
+
return {
|
56979
|
+
document: yield wallet.pluginMethods.contextLoader(url)
|
56980
|
+
};
|
56981
|
+
})
|
56982
|
+
})) == null ? void 0 : _a.vp;
|
56983
|
+
}),
|
56984
|
+
vpToQrCode: (_wallet, vp) => __async(void 0, null, function* () {
|
56985
|
+
var _a;
|
56986
|
+
return (_a = yield toQrCode({
|
56987
|
+
vp,
|
56988
|
+
documentLoader: (url) => __async(void 0, null, function* () {
|
56989
|
+
return {
|
56990
|
+
document: yield wallet.pluginMethods.contextLoader(url)
|
56991
|
+
};
|
56992
|
+
})
|
56993
|
+
})) == null ? void 0 : _a.imageDataUrl;
|
56994
|
+
})
|
56995
|
+
}
|
56996
|
+
};
|
56997
|
+
}, "getVpqrPlugin");
|
56998
|
+
|
53784
56999
|
// src/wallet/defaults.ts
|
53785
57000
|
var defaultCeramicIDXArgs = {
|
53786
57001
|
modelData: {
|
@@ -53814,7 +57029,8 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
|
|
53814
57029
|
const didkeyAndVCWallet = yield didkeyWallet.addPlugin(yield getVCPlugin(didkeyWallet));
|
53815
57030
|
const idxWallet = yield didkeyAndVCWallet.addPlugin(yield getIDXPlugin(didkeyAndVCWallet, ceramicIdx));
|
53816
57031
|
const expirationWallet = yield idxWallet.addPlugin(ExpirationPlugin(idxWallet));
|
53817
|
-
const
|
57032
|
+
const ethWallet = yield expirationWallet.addPlugin(getEthereumPlugin(expirationWallet, ethereumConfig));
|
57033
|
+
const wallet = yield ethWallet.addPlugin(getVpqrPlugin(ethWallet));
|
53818
57034
|
return {
|
53819
57035
|
_wallet: wallet,
|
53820
57036
|
did: (type = "key") => wallet.pluginMethods.getSubjectDid(type),
|
@@ -53838,6 +57054,8 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
|
|
53838
57054
|
readFromCeramic: wallet.pluginMethods.readContentFromCeramic,
|
53839
57055
|
getTestVc: wallet.pluginMethods.getTestVc,
|
53840
57056
|
getTestVp: wallet.pluginMethods.getTestVp,
|
57057
|
+
vpFromQrCode: wallet.pluginMethods.vpFromQrCode,
|
57058
|
+
vpToQrCode: wallet.pluginMethods.vpToQrCode,
|
53841
57059
|
getEthereumAddress: wallet.pluginMethods.getEthereumAddress,
|
53842
57060
|
getBalance: wallet.pluginMethods.getBalance,
|
53843
57061
|
getBalanceForAddress: wallet.pluginMethods.getBalanceForAddress,
|
@@ -53859,6 +57077,18 @@ function initLearnCard() {
|
|
53859
57077
|
});
|
53860
57078
|
}
|
53861
57079
|
__name(initLearnCard, "initLearnCard");
|
57080
|
+
/*!
|
57081
|
+
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
57082
|
+
*/
|
57083
|
+
/*!
|
57084
|
+
* Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved.
|
57085
|
+
*/
|
57086
|
+
/*!
|
57087
|
+
* Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved.
|
57088
|
+
*/
|
57089
|
+
/*!
|
57090
|
+
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
|
57091
|
+
*/
|
53862
57092
|
/*!
|
53863
57093
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
53864
57094
|
* (c) 2017-2021 Joachim Wester
|
@@ -53869,6 +57099,15 @@ __name(initLearnCard, "initLearnCard");
|
|
53869
57099
|
* (c) 2017-2022 Joachim Wester
|
53870
57100
|
* MIT licensed
|
53871
57101
|
*/
|
57102
|
+
/**
|
57103
|
+
* @module QRCode
|
57104
|
+
* @package @nuintun/qrcode
|
57105
|
+
* @license MIT
|
57106
|
+
* @version 3.3.0
|
57107
|
+
* @author nuintun <nuintun@qq.com>
|
57108
|
+
* @description A pure JavaScript QRCode encode and decode library.
|
57109
|
+
* @see https://github.com/nuintun/qrcode#readme
|
57110
|
+
*/
|
53872
57111
|
/**
|
53873
57112
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
53874
57113
|
*
|