@learncard/core 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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
package/dist/core.esm.js
CHANGED
@@ -130,7 +130,7 @@ function base(ALPHABET, name5) {
|
|
130
130
|
var LEADER = ALPHABET.charAt(0);
|
131
131
|
var FACTOR = Math.log(BASE) / Math.log(256);
|
132
132
|
var iFACTOR = Math.log(256) / Math.log(BASE);
|
133
|
-
function
|
133
|
+
function encode18(source) {
|
134
134
|
if (source instanceof Uint8Array)
|
135
135
|
;
|
136
136
|
else if (ArrayBuffer.isView(source)) {
|
@@ -178,7 +178,7 @@ function base(ALPHABET, name5) {
|
|
178
178
|
}
|
179
179
|
return str;
|
180
180
|
}
|
181
|
-
__name(
|
181
|
+
__name(encode18, "encode");
|
182
182
|
function decodeUnsafe(source) {
|
183
183
|
if (typeof source !== "string") {
|
184
184
|
throw new TypeError("Expected String");
|
@@ -230,18 +230,18 @@ function base(ALPHABET, name5) {
|
|
230
230
|
return vch;
|
231
231
|
}
|
232
232
|
__name(decodeUnsafe, "decodeUnsafe");
|
233
|
-
function
|
233
|
+
function decode14(string2) {
|
234
234
|
var buffer2 = decodeUnsafe(string2);
|
235
235
|
if (buffer2) {
|
236
236
|
return buffer2;
|
237
237
|
}
|
238
238
|
throw new Error(`Non-${name5} character`);
|
239
239
|
}
|
240
|
-
__name(
|
240
|
+
__name(decode14, "decode");
|
241
241
|
return {
|
242
|
-
encode:
|
242
|
+
encode: encode18,
|
243
243
|
decodeUnsafe,
|
244
|
-
decode:
|
244
|
+
decode: decode14
|
245
245
|
};
|
246
246
|
}
|
247
247
|
var src, _brrp__multiformats_scope_baseX, base_x_default;
|
@@ -386,20 +386,20 @@ var init_base = __esm({
|
|
386
386
|
}
|
387
387
|
};
|
388
388
|
__name(Codec, "Codec");
|
389
|
-
from = /* @__PURE__ */ __name(({ name: name5, prefix, encode:
|
390
|
-
baseX = /* @__PURE__ */ __name(({ prefix, name: name5, alphabet:
|
391
|
-
const { encode:
|
389
|
+
from = /* @__PURE__ */ __name(({ name: name5, prefix, encode: encode18, decode: decode14 }) => new Codec(name5, prefix, encode18, decode14), "from");
|
390
|
+
baseX = /* @__PURE__ */ __name(({ prefix, name: name5, alphabet: alphabet3 }) => {
|
391
|
+
const { encode: encode18, decode: decode14 } = base_x_default(alphabet3, name5);
|
392
392
|
return from({
|
393
393
|
prefix,
|
394
394
|
name: name5,
|
395
|
-
encode:
|
396
|
-
decode: (text) => coerce(
|
395
|
+
encode: encode18,
|
396
|
+
decode: (text) => coerce(decode14(text))
|
397
397
|
});
|
398
398
|
}, "baseX");
|
399
|
-
decode = /* @__PURE__ */ __name((string2,
|
399
|
+
decode = /* @__PURE__ */ __name((string2, alphabet3, bitsPerChar, name5) => {
|
400
400
|
const codes = {};
|
401
|
-
for (let i = 0; i <
|
402
|
-
codes[
|
401
|
+
for (let i = 0; i < alphabet3.length; ++i) {
|
402
|
+
codes[alphabet3[i]] = i;
|
403
403
|
}
|
404
404
|
let end = string2.length;
|
405
405
|
while (string2[end - 1] === "=") {
|
@@ -426,8 +426,8 @@ var init_base = __esm({
|
|
426
426
|
}
|
427
427
|
return out;
|
428
428
|
}, "decode");
|
429
|
-
encode = /* @__PURE__ */ __name((data,
|
430
|
-
const pad2 =
|
429
|
+
encode = /* @__PURE__ */ __name((data, alphabet3, bitsPerChar) => {
|
430
|
+
const pad2 = alphabet3[alphabet3.length - 1] === "=";
|
431
431
|
const mask = (1 << bitsPerChar) - 1;
|
432
432
|
let out = "";
|
433
433
|
let bits = 0;
|
@@ -437,11 +437,11 @@ var init_base = __esm({
|
|
437
437
|
bits += 8;
|
438
438
|
while (bits > bitsPerChar) {
|
439
439
|
bits -= bitsPerChar;
|
440
|
-
out +=
|
440
|
+
out += alphabet3[mask & buffer2 >> bits];
|
441
441
|
}
|
442
442
|
}
|
443
443
|
if (bits) {
|
444
|
-
out +=
|
444
|
+
out += alphabet3[mask & buffer2 << bitsPerChar - bits];
|
445
445
|
}
|
446
446
|
if (pad2) {
|
447
447
|
while (out.length * bitsPerChar & 7) {
|
@@ -450,15 +450,15 @@ var init_base = __esm({
|
|
450
450
|
}
|
451
451
|
return out;
|
452
452
|
}, "encode");
|
453
|
-
rfc4648 = /* @__PURE__ */ __name(({ name: name5, prefix, bitsPerChar, alphabet:
|
453
|
+
rfc4648 = /* @__PURE__ */ __name(({ name: name5, prefix, bitsPerChar, alphabet: alphabet3 }) => {
|
454
454
|
return from({
|
455
455
|
prefix,
|
456
456
|
name: name5,
|
457
457
|
encode(input) {
|
458
|
-
return encode(input,
|
458
|
+
return encode(input, alphabet3, bitsPerChar);
|
459
459
|
},
|
460
460
|
decode(input) {
|
461
|
-
return decode(input,
|
461
|
+
return decode(input, alphabet3, bitsPerChar, name5);
|
462
462
|
}
|
463
463
|
});
|
464
464
|
}, "rfc4648");
|
@@ -923,12 +923,12 @@ var from2, Hasher;
|
|
923
923
|
var init_hasher = __esm({
|
924
924
|
"../../node_modules/.pnpm/multiformats@9.7.0/node_modules/multiformats/esm/src/hashes/hasher.js"() {
|
925
925
|
init_digest();
|
926
|
-
from2 = /* @__PURE__ */ __name(({ name: name5, code: code5, encode:
|
926
|
+
from2 = /* @__PURE__ */ __name(({ name: name5, code: code5, encode: encode18 }) => new Hasher(name5, code5, encode18), "from");
|
927
927
|
Hasher = class {
|
928
|
-
constructor(name5, code5,
|
928
|
+
constructor(name5, code5, encode18) {
|
929
929
|
this.name = name5;
|
930
930
|
this.code = code5;
|
931
|
-
this.encode =
|
931
|
+
this.encode = encode18;
|
932
932
|
}
|
933
933
|
digest(input) {
|
934
934
|
if (input instanceof Uint8Array) {
|
@@ -1041,9 +1041,9 @@ var init_cid = __esm({
|
|
1041
1041
|
init_base32();
|
1042
1042
|
init_bytes();
|
1043
1043
|
CID = class {
|
1044
|
-
constructor(
|
1044
|
+
constructor(version12, code5, multihash, bytes) {
|
1045
1045
|
this.code = code5;
|
1046
|
-
this.version =
|
1046
|
+
this.version = version12;
|
1047
1047
|
this.multihash = multihash;
|
1048
1048
|
this.bytes = bytes;
|
1049
1049
|
this.byteOffset = bytes.byteOffset;
|
@@ -1097,8 +1097,8 @@ var init_cid = __esm({
|
|
1097
1097
|
return other && this.code === other.code && this.version === other.version && equals2(this.multihash, other.multihash);
|
1098
1098
|
}
|
1099
1099
|
toString(base4) {
|
1100
|
-
const { bytes, version:
|
1101
|
-
switch (
|
1100
|
+
const { bytes, version: version12, _baseCache } = this;
|
1101
|
+
switch (version12) {
|
1102
1102
|
case 0:
|
1103
1103
|
return toStringV0(bytes, _baseCache, base4 || base58btc.encoder);
|
1104
1104
|
default:
|
@@ -1141,31 +1141,31 @@ var init_cid = __esm({
|
|
1141
1141
|
if (value instanceof CID) {
|
1142
1142
|
return value;
|
1143
1143
|
} else if (value != null && value.asCID === value) {
|
1144
|
-
const { version:
|
1145
|
-
return new CID(
|
1144
|
+
const { version: version12, code: code5, multihash, bytes } = value;
|
1145
|
+
return new CID(version12, code5, multihash, bytes || encodeCID(version12, code5, multihash.bytes));
|
1146
1146
|
} else if (value != null && value[cidSymbol] === true) {
|
1147
|
-
const { version:
|
1147
|
+
const { version: version12, multihash, code: code5 } = value;
|
1148
1148
|
const digest2 = decode5(multihash);
|
1149
|
-
return CID.create(
|
1149
|
+
return CID.create(version12, code5, digest2);
|
1150
1150
|
} else {
|
1151
1151
|
return null;
|
1152
1152
|
}
|
1153
1153
|
}
|
1154
|
-
static create(
|
1154
|
+
static create(version12, code5, digest2) {
|
1155
1155
|
if (typeof code5 !== "number") {
|
1156
1156
|
throw new Error("String codecs are no longer supported");
|
1157
1157
|
}
|
1158
|
-
switch (
|
1158
|
+
switch (version12) {
|
1159
1159
|
case 0: {
|
1160
1160
|
if (code5 !== DAG_PB_CODE) {
|
1161
1161
|
throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
|
1162
1162
|
} else {
|
1163
|
-
return new CID(
|
1163
|
+
return new CID(version12, code5, digest2, digest2.bytes);
|
1164
1164
|
}
|
1165
1165
|
}
|
1166
1166
|
case 1: {
|
1167
|
-
const bytes = encodeCID(
|
1168
|
-
return new CID(
|
1167
|
+
const bytes = encodeCID(version12, code5, digest2.bytes);
|
1168
|
+
return new CID(version12, code5, digest2, bytes);
|
1169
1169
|
}
|
1170
1170
|
default: {
|
1171
1171
|
throw new Error("Invalid version");
|
@@ -1207,16 +1207,16 @@ var init_cid = __esm({
|
|
1207
1207
|
offset += length2;
|
1208
1208
|
return i;
|
1209
1209
|
}, "next");
|
1210
|
-
let
|
1210
|
+
let version12 = next();
|
1211
1211
|
let codec = DAG_PB_CODE;
|
1212
|
-
if (
|
1213
|
-
|
1212
|
+
if (version12 === 18) {
|
1213
|
+
version12 = 0;
|
1214
1214
|
offset = 0;
|
1215
|
-
} else if (
|
1215
|
+
} else if (version12 === 1) {
|
1216
1216
|
codec = next();
|
1217
1217
|
}
|
1218
|
-
if (
|
1219
|
-
throw new RangeError(`Invalid CID version ${
|
1218
|
+
if (version12 !== 0 && version12 !== 1) {
|
1219
|
+
throw new RangeError(`Invalid CID version ${version12}`);
|
1220
1220
|
}
|
1221
1221
|
const prefixSize = offset;
|
1222
1222
|
const multihashCode = next();
|
@@ -1224,7 +1224,7 @@ var init_cid = __esm({
|
|
1224
1224
|
const size = offset + digestSize;
|
1225
1225
|
const multihashSize = size - prefixSize;
|
1226
1226
|
return {
|
1227
|
-
version:
|
1227
|
+
version: version12,
|
1228
1228
|
codec,
|
1229
1229
|
multihashCode,
|
1230
1230
|
digestSize,
|
@@ -1301,11 +1301,11 @@ var init_cid = __esm({
|
|
1301
1301
|
}, "toStringV1");
|
1302
1302
|
DAG_PB_CODE = 112;
|
1303
1303
|
SHA_256_CODE = 18;
|
1304
|
-
encodeCID = /* @__PURE__ */ __name((
|
1305
|
-
const codeOffset = encodingLength(
|
1304
|
+
encodeCID = /* @__PURE__ */ __name((version12, code5, multihash) => {
|
1305
|
+
const codeOffset = encodingLength(version12);
|
1306
1306
|
const hashOffset = codeOffset + encodingLength(code5);
|
1307
1307
|
const bytes = new Uint8Array(hashOffset + multihash.byteLength);
|
1308
|
-
encodeTo(
|
1308
|
+
encodeTo(version12, bytes, 0);
|
1309
1309
|
encodeTo(code5, bytes, codeOffset);
|
1310
1310
|
bytes.set(multihash, hashOffset);
|
1311
1311
|
return bytes;
|
@@ -1398,16 +1398,16 @@ var init_basics = __esm({
|
|
1398
1398
|
});
|
1399
1399
|
|
1400
1400
|
// ../../node_modules/.pnpm/uint8arrays@3.0.0/node_modules/uint8arrays/esm/src/util/bases.js
|
1401
|
-
function createCodec(name5, prefix,
|
1401
|
+
function createCodec(name5, prefix, encode18, decode14) {
|
1402
1402
|
return {
|
1403
1403
|
name: name5,
|
1404
1404
|
prefix,
|
1405
1405
|
encoder: {
|
1406
1406
|
name: name5,
|
1407
1407
|
prefix,
|
1408
|
-
encode:
|
1408
|
+
encode: encode18
|
1409
1409
|
},
|
1410
|
-
decoder: { decode:
|
1410
|
+
decoder: { decode: decode14 }
|
1411
1411
|
};
|
1412
1412
|
}
|
1413
1413
|
var string, ascii, BASES, bases_default;
|
@@ -3197,7 +3197,7 @@ var require_bn = __commonJS({
|
|
3197
3197
|
}
|
3198
3198
|
return this;
|
3199
3199
|
}, "_normSign");
|
3200
|
-
BN3.prototype.inspect = /* @__PURE__ */ __name(function
|
3200
|
+
BN3.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
3201
3201
|
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
|
3202
3202
|
}, "inspect");
|
3203
3203
|
var zeros = [
|
@@ -3306,7 +3306,7 @@ var require_bn = __commonJS({
|
|
3306
3306
|
52521875,
|
3307
3307
|
60466176
|
3308
3308
|
];
|
3309
|
-
BN3.prototype.toString = /* @__PURE__ */ __name(function
|
3309
|
+
BN3.prototype.toString = /* @__PURE__ */ __name(function toString6(base4, padding) {
|
3310
3310
|
base4 = base4 || 10;
|
3311
3311
|
padding = padding | 0 || 1;
|
3312
3312
|
var out;
|
@@ -5815,7 +5815,7 @@ var require_utils = __commonJS({
|
|
5815
5815
|
}
|
5816
5816
|
__name(toHex2, "toHex");
|
5817
5817
|
utils.toHex = toHex2;
|
5818
|
-
utils.encode = /* @__PURE__ */ __name(function
|
5818
|
+
utils.encode = /* @__PURE__ */ __name(function encode18(arr, enc) {
|
5819
5819
|
if (enc === "hex")
|
5820
5820
|
return toHex2(arr);
|
5821
5821
|
else
|
@@ -6026,7 +6026,7 @@ var require_base = __commonJS({
|
|
6026
6026
|
BaseCurve2.prototype.point = /* @__PURE__ */ __name(function point3() {
|
6027
6027
|
throw new Error("Not implemented");
|
6028
6028
|
}, "point");
|
6029
|
-
BaseCurve2.prototype.validate = /* @__PURE__ */ __name(function
|
6029
|
+
BaseCurve2.prototype.validate = /* @__PURE__ */ __name(function validate7() {
|
6030
6030
|
throw new Error("Not implemented");
|
6031
6031
|
}, "validate");
|
6032
6032
|
BaseCurve2.prototype._fixedNafMul = /* @__PURE__ */ __name(function _fixedNafMul2(p, k) {
|
@@ -6205,7 +6205,7 @@ var require_base = __commonJS({
|
|
6205
6205
|
BasePoint2.prototype.eq = /* @__PURE__ */ __name(function eq4() {
|
6206
6206
|
throw new Error("Not implemented");
|
6207
6207
|
}, "eq");
|
6208
|
-
BasePoint2.prototype.validate = /* @__PURE__ */ __name(function
|
6208
|
+
BasePoint2.prototype.validate = /* @__PURE__ */ __name(function validate7() {
|
6209
6209
|
return this.curve.validate(this);
|
6210
6210
|
}, "validate");
|
6211
6211
|
BaseCurve2.prototype.decodePoint = /* @__PURE__ */ __name(function decodePoint2(bytes, enc) {
|
@@ -6226,14 +6226,14 @@ var require_base = __commonJS({
|
|
6226
6226
|
BasePoint2.prototype.encodeCompressed = /* @__PURE__ */ __name(function encodeCompressed2(enc) {
|
6227
6227
|
return this.encode(enc, true);
|
6228
6228
|
}, "encodeCompressed");
|
6229
|
-
BasePoint2.prototype._encode = /* @__PURE__ */ __name(function
|
6229
|
+
BasePoint2.prototype._encode = /* @__PURE__ */ __name(function _encode3(compact) {
|
6230
6230
|
var len = this.curve.p.byteLength();
|
6231
6231
|
var x = this.getX().toArray("be", len);
|
6232
6232
|
if (compact)
|
6233
6233
|
return [this.getY().isEven() ? 2 : 3].concat(x);
|
6234
6234
|
return [4].concat(x, this.getY().toArray("be", len));
|
6235
6235
|
}, "_encode");
|
6236
|
-
BasePoint2.prototype.encode = /* @__PURE__ */ __name(function
|
6236
|
+
BasePoint2.prototype.encode = /* @__PURE__ */ __name(function encode18(enc, compact) {
|
6237
6237
|
return utils.encode(this._encode(compact), enc);
|
6238
6238
|
}, "encode");
|
6239
6239
|
BasePoint2.prototype.precompute = /* @__PURE__ */ __name(function precompute2(power) {
|
@@ -6489,7 +6489,7 @@ var require_short = __commonJS({
|
|
6489
6489
|
y = y.redNeg();
|
6490
6490
|
return this.point(x, y);
|
6491
6491
|
}, "pointFromX");
|
6492
|
-
ShortCurve2.prototype.validate = /* @__PURE__ */ __name(function
|
6492
|
+
ShortCurve2.prototype.validate = /* @__PURE__ */ __name(function validate7(point3) {
|
6493
6493
|
if (point3.inf)
|
6494
6494
|
return true;
|
6495
6495
|
var x = point3.x;
|
@@ -6618,7 +6618,7 @@ var require_short = __commonJS({
|
|
6618
6618
|
};
|
6619
6619
|
return res;
|
6620
6620
|
}, "fromJSON");
|
6621
|
-
Point2.prototype.inspect = /* @__PURE__ */ __name(function
|
6621
|
+
Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
6622
6622
|
if (this.isInfinity())
|
6623
6623
|
return "<EC Point Infinity>";
|
6624
6624
|
return "<EC Point x: " + this.x.fromRed().toString(16, 2) + " y: " + this.y.fromRed().toString(16, 2) + ">";
|
@@ -7021,7 +7021,7 @@ var require_short = __commonJS({
|
|
7021
7021
|
return true;
|
7022
7022
|
}
|
7023
7023
|
}, "eqXToP");
|
7024
|
-
JPoint2.prototype.inspect = /* @__PURE__ */ __name(function
|
7024
|
+
JPoint2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
7025
7025
|
if (this.isInfinity())
|
7026
7026
|
return "<EC JPoint Infinity>";
|
7027
7027
|
return "<EC JPoint x: " + this.x.toString(16, 2) + " y: " + this.y.toString(16, 2) + " z: " + this.z.toString(16, 2) + ">";
|
@@ -7051,7 +7051,7 @@ var require_mont = __commonJS({
|
|
7051
7051
|
__name(MontCurve, "MontCurve");
|
7052
7052
|
inherits(MontCurve, Base);
|
7053
7053
|
module2.exports = MontCurve;
|
7054
|
-
MontCurve.prototype.validate = /* @__PURE__ */ __name(function
|
7054
|
+
MontCurve.prototype.validate = /* @__PURE__ */ __name(function validate7(point3) {
|
7055
7055
|
var x = point3.normalize().x;
|
7056
7056
|
var x2 = x.redSqr();
|
7057
7057
|
var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
|
@@ -7085,13 +7085,13 @@ var require_mont = __commonJS({
|
|
7085
7085
|
}, "pointFromJSON");
|
7086
7086
|
Point2.prototype.precompute = /* @__PURE__ */ __name(function precompute2() {
|
7087
7087
|
}, "precompute");
|
7088
|
-
Point2.prototype._encode = /* @__PURE__ */ __name(function
|
7088
|
+
Point2.prototype._encode = /* @__PURE__ */ __name(function _encode3() {
|
7089
7089
|
return this.getX().toArray("be", this.curve.p.byteLength());
|
7090
7090
|
}, "_encode");
|
7091
7091
|
Point2.fromJSON = /* @__PURE__ */ __name(function fromJSON2(curve, obj) {
|
7092
7092
|
return new Point2(curve, obj[0], obj[1] || curve.one);
|
7093
7093
|
}, "fromJSON");
|
7094
|
-
Point2.prototype.inspect = /* @__PURE__ */ __name(function
|
7094
|
+
Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
7095
7095
|
if (this.isInfinity())
|
7096
7096
|
return "<EC Point Infinity>";
|
7097
7097
|
return "<EC Point x: " + this.x.fromRed().toString(16, 2) + " z: " + this.z.fromRed().toString(16, 2) + ">";
|
@@ -7240,7 +7240,7 @@ var require_edwards = __commonJS({
|
|
7240
7240
|
x = x.redNeg();
|
7241
7241
|
return this.point(x, y);
|
7242
7242
|
}, "pointFromY");
|
7243
|
-
EdwardsCurve.prototype.validate = /* @__PURE__ */ __name(function
|
7243
|
+
EdwardsCurve.prototype.validate = /* @__PURE__ */ __name(function validate7(point3) {
|
7244
7244
|
if (point3.isInfinity())
|
7245
7245
|
return true;
|
7246
7246
|
point3.normalize();
|
@@ -7290,7 +7290,7 @@ var require_edwards = __commonJS({
|
|
7290
7290
|
Point2.fromJSON = /* @__PURE__ */ __name(function fromJSON2(curve, obj) {
|
7291
7291
|
return new Point2(curve, obj[0], obj[1], obj[2]);
|
7292
7292
|
}, "fromJSON");
|
7293
|
-
Point2.prototype.inspect = /* @__PURE__ */ __name(function
|
7293
|
+
Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
7294
7294
|
if (this.isInfinity())
|
7295
7295
|
return "<EC Point Infinity>";
|
7296
7296
|
return "<EC Point x: " + this.x.fromRed().toString(16, 2) + " y: " + this.y.fromRed().toString(16, 2) + " z: " + this.z.fromRed().toString(16, 2) + ">";
|
@@ -10186,7 +10186,7 @@ var require_key = __commonJS({
|
|
10186
10186
|
privEnc: enc
|
10187
10187
|
});
|
10188
10188
|
}, "fromPrivate");
|
10189
|
-
KeyPair2.prototype.validate = /* @__PURE__ */ __name(function
|
10189
|
+
KeyPair2.prototype.validate = /* @__PURE__ */ __name(function validate7() {
|
10190
10190
|
var pub = this.getPublic();
|
10191
10191
|
if (pub.isInfinity())
|
10192
10192
|
return { result: false, reason: "Invalid public key" };
|
@@ -10241,7 +10241,7 @@ var require_key = __commonJS({
|
|
10241
10241
|
KeyPair2.prototype.verify = /* @__PURE__ */ __name(function verify4(msg, signature2) {
|
10242
10242
|
return this.ec.verify(msg, signature2, this);
|
10243
10243
|
}, "verify");
|
10244
|
-
KeyPair2.prototype.inspect = /* @__PURE__ */ __name(function
|
10244
|
+
KeyPair2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
10245
10245
|
return "<Key priv: " + (this.priv && this.priv.toString(16, 2)) + " pub: " + (this.pub && this.pub.inspect()) + " >";
|
10246
10246
|
}, "inspect");
|
10247
10247
|
}
|
@@ -15306,7 +15306,7 @@ var require_transformers = __commonJS({
|
|
15306
15306
|
return void 0;
|
15307
15307
|
},
|
15308
15308
|
decode(codes) {
|
15309
|
-
function
|
15309
|
+
function validate7(buf3) {
|
15310
15310
|
const chars = [];
|
15311
15311
|
let tail2 = 0;
|
15312
15312
|
for (let i2 = 0; i2 < buf3.length; i2 += 1) {
|
@@ -15365,11 +15365,11 @@ var require_transformers = __commonJS({
|
|
15365
15365
|
}
|
15366
15366
|
return { tail: tail2, buf: Buffer.from(chars) };
|
15367
15367
|
}
|
15368
|
-
__name(
|
15368
|
+
__name(validate7, "validate");
|
15369
15369
|
if (codes.length === 0) {
|
15370
15370
|
return Buffer.alloc(0);
|
15371
15371
|
}
|
15372
|
-
const val =
|
15372
|
+
const val = validate7(codes);
|
15373
15373
|
const { tail } = val;
|
15374
15374
|
const base642 = val.buf;
|
15375
15375
|
let i;
|
@@ -15440,7 +15440,7 @@ ${c4}`;
|
|
15440
15440
|
}
|
15441
15441
|
}
|
15442
15442
|
__name(buildLine, "buildLine");
|
15443
|
-
function
|
15443
|
+
function validate7(c) {
|
15444
15444
|
if (c >= 65 && c <= 90) {
|
15445
15445
|
return true;
|
15446
15446
|
}
|
@@ -15461,10 +15461,10 @@ ${c4}`;
|
|
15461
15461
|
}
|
15462
15462
|
return false;
|
15463
15463
|
}
|
15464
|
-
__name(
|
15464
|
+
__name(validate7, "validate");
|
15465
15465
|
for (let i = 0; i < buf2.length; i += 4) {
|
15466
15466
|
for (let j = i; j < i + 4; j += 1) {
|
15467
|
-
if (!
|
15467
|
+
if (!validate7(buf2[j])) {
|
15468
15468
|
throw new RangeError(`base64.toString: buf[${j}]: ${buf2[j]} : not valid base64 character code`);
|
15469
15469
|
}
|
15470
15470
|
}
|
@@ -15763,7 +15763,7 @@ var require_converter = __commonJS({
|
|
15763
15763
|
}
|
15764
15764
|
return ret;
|
15765
15765
|
}, "validateDst");
|
15766
|
-
var
|
15766
|
+
var encode18 = /* @__PURE__ */ __name(function encode19(type, chars) {
|
15767
15767
|
switch (type) {
|
15768
15768
|
case UTF8:
|
15769
15769
|
return trans.utf8.encode(chars);
|
@@ -15795,7 +15795,7 @@ var require_converter = __commonJS({
|
|
15795
15795
|
throw new TypeError(`encode type "${type}" not recognized`);
|
15796
15796
|
}
|
15797
15797
|
}, "encode");
|
15798
|
-
var
|
15798
|
+
var decode14 = /* @__PURE__ */ __name(function decode15(src2) {
|
15799
15799
|
switch (src2.type) {
|
15800
15800
|
case UTF8:
|
15801
15801
|
return trans.utf8.decode(src2.data, src2.bom);
|
@@ -15829,7 +15829,7 @@ var require_converter = __commonJS({
|
|
15829
15829
|
}, "decode");
|
15830
15830
|
exports.decode = /* @__PURE__ */ __name(function exportsDecode(type, data) {
|
15831
15831
|
const src2 = validateSrc(type, data);
|
15832
|
-
return
|
15832
|
+
return decode14(src2);
|
15833
15833
|
}, "exportsDecode");
|
15834
15834
|
exports.encode = /* @__PURE__ */ __name(function exportsEncode(type, chars) {
|
15835
15835
|
let c;
|
@@ -15837,12 +15837,12 @@ var require_converter = __commonJS({
|
|
15837
15837
|
const dst = validateDst(type, chars);
|
15838
15838
|
if (dst.crlf) {
|
15839
15839
|
c = trans.lineEnds.crlf(chars);
|
15840
|
-
buf2 =
|
15840
|
+
buf2 = encode18(dst.type, c);
|
15841
15841
|
} else if (dst.lf) {
|
15842
15842
|
c = trans.lineEnds.lf(chars);
|
15843
|
-
buf2 =
|
15843
|
+
buf2 = encode18(dst.type, c);
|
15844
15844
|
} else {
|
15845
|
-
buf2 =
|
15845
|
+
buf2 = encode18(dst.type, chars);
|
15846
15846
|
}
|
15847
15847
|
if (dst.base64) {
|
15848
15848
|
buf2 = trans.base64.encode(buf2);
|
@@ -17052,7 +17052,7 @@ var require_parser = __commonJS({
|
|
17052
17052
|
initializeInputChars(inputChars, inputIndex, inputLength);
|
17053
17053
|
return privateParse(grammar, startRule, callbackData);
|
17054
17054
|
}, "parseSubstring");
|
17055
|
-
this.parse = /* @__PURE__ */ __name(function
|
17055
|
+
this.parse = /* @__PURE__ */ __name(function parse3(grammar, startRule, inputChars, callbackData) {
|
17056
17056
|
clear();
|
17057
17057
|
initializeInputChars(inputChars, 0, inputChars.length);
|
17058
17058
|
return privateParse(grammar, startRule, callbackData);
|
@@ -18034,7 +18034,7 @@ var require_stats = __commonJS({
|
|
18034
18034
|
}
|
18035
18035
|
return html;
|
18036
18036
|
}, "displayRules");
|
18037
|
-
this.validate = /* @__PURE__ */ __name(function
|
18037
|
+
this.validate = /* @__PURE__ */ __name(function validate7(name5) {
|
18038
18038
|
let ret = false;
|
18039
18039
|
if (typeof name5 === "string" && nameId === name5) {
|
18040
18040
|
ret = true;
|
@@ -18666,9 +18666,9 @@ var require_trace = __commonJS({
|
|
18666
18666
|
obj.tree = display(root, root.depth, false);
|
18667
18667
|
return obj;
|
18668
18668
|
}, "toTreeObj");
|
18669
|
-
this.toTree = function(
|
18669
|
+
this.toTree = function(stringify3) {
|
18670
18670
|
const obj = toTreeObj();
|
18671
|
-
if (
|
18671
|
+
if (stringify3) {
|
18672
18672
|
return JSON.stringify(obj);
|
18673
18673
|
}
|
18674
18674
|
return obj;
|
@@ -19242,7 +19242,7 @@ var require_scanner_grammar = __commonJS({
|
|
19242
19242
|
this.rules[8].opcodes[0] = { type: 6, string: [10] };
|
19243
19243
|
this.rules[9].opcodes = [];
|
19244
19244
|
this.rules[9].opcodes[0] = { type: 6, string: [13] };
|
19245
|
-
this.toString = /* @__PURE__ */ __name(function
|
19245
|
+
this.toString = /* @__PURE__ */ __name(function toString6() {
|
19246
19246
|
let str = "";
|
19247
19247
|
str += "file = *line [last-line]\n";
|
19248
19248
|
str += "line = line-text end\n";
|
@@ -21455,7 +21455,7 @@ var require_sabnf_grammar = __commonJS({
|
|
21455
21455
|
this.rules[94].opcodes[5] = { type: 1, children: [6, 7] };
|
21456
21456
|
this.rules[94].opcodes[6] = { type: 6, string: [32] };
|
21457
21457
|
this.rules[94].opcodes[7] = { type: 6, string: [9] };
|
21458
|
-
this.toString = /* @__PURE__ */ __name(function
|
21458
|
+
this.toString = /* @__PURE__ */ __name(function toString6() {
|
21459
21459
|
let str = "";
|
21460
21460
|
str += ";\n";
|
21461
21461
|
str += "; ABNF for JavaScript APG 2.0 SABNF\n";
|
@@ -23270,7 +23270,7 @@ var require_api = __commonJS({
|
|
23270
23270
|
this.lines = scanner(this.chars, this.errors, strict, trace);
|
23271
23271
|
isScanned = true;
|
23272
23272
|
}, "scan");
|
23273
|
-
this.parse = /* @__PURE__ */ __name(function
|
23273
|
+
this.parse = /* @__PURE__ */ __name(function parse3(strict, trace) {
|
23274
23274
|
if (!isScanned) {
|
23275
23275
|
throw new Error(`${thisFileName}grammar not scanned`);
|
23276
23276
|
}
|
@@ -23697,17 +23697,17 @@ var require_bn2 = __commonJS({
|
|
23697
23697
|
}, "_normSign");
|
23698
23698
|
if (typeof Symbol !== "undefined" && typeof Symbol.for === "function") {
|
23699
23699
|
try {
|
23700
|
-
BN3.prototype[Symbol.for("nodejs.util.inspect.custom")] =
|
23700
|
+
BN3.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect5;
|
23701
23701
|
} catch (e) {
|
23702
|
-
BN3.prototype.inspect =
|
23702
|
+
BN3.prototype.inspect = inspect5;
|
23703
23703
|
}
|
23704
23704
|
} else {
|
23705
|
-
BN3.prototype.inspect =
|
23705
|
+
BN3.prototype.inspect = inspect5;
|
23706
23706
|
}
|
23707
|
-
function
|
23707
|
+
function inspect5() {
|
23708
23708
|
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
|
23709
23709
|
}
|
23710
|
-
__name(
|
23710
|
+
__name(inspect5, "inspect");
|
23711
23711
|
var zeros = [
|
23712
23712
|
"",
|
23713
23713
|
"0",
|
@@ -23814,7 +23814,7 @@ var require_bn2 = __commonJS({
|
|
23814
23814
|
52521875,
|
23815
23815
|
60466176
|
23816
23816
|
];
|
23817
|
-
BN3.prototype.toString = /* @__PURE__ */ __name(function
|
23817
|
+
BN3.prototype.toString = /* @__PURE__ */ __name(function toString6(base4, padding) {
|
23818
23818
|
base4 = base4 || 10;
|
23819
23819
|
padding = padding | 0 || 1;
|
23820
23820
|
var out;
|
@@ -26317,14 +26317,14 @@ var require_bn2 = __commonJS({
|
|
26317
26317
|
// ../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js
|
26318
26318
|
var require_encode = __commonJS({
|
26319
26319
|
"../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(exports, module2) {
|
26320
|
-
module2.exports =
|
26320
|
+
module2.exports = encode18;
|
26321
26321
|
var MSB2 = 128;
|
26322
26322
|
var REST2 = 127;
|
26323
26323
|
var MSBALL2 = ~REST2;
|
26324
26324
|
var INT2 = Math.pow(2, 31);
|
26325
|
-
function
|
26325
|
+
function encode18(num, out, offset) {
|
26326
26326
|
if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
|
26327
|
-
|
26327
|
+
encode18.bytes = 0;
|
26328
26328
|
throw new RangeError("Could not encode varint");
|
26329
26329
|
}
|
26330
26330
|
out = out || [];
|
@@ -26339,10 +26339,10 @@ var require_encode = __commonJS({
|
|
26339
26339
|
num >>>= 7;
|
26340
26340
|
}
|
26341
26341
|
out[offset] = num | 0;
|
26342
|
-
|
26342
|
+
encode18.bytes = offset - oldOffset + 1;
|
26343
26343
|
return out;
|
26344
26344
|
}
|
26345
|
-
__name(
|
26345
|
+
__name(encode18, "encode");
|
26346
26346
|
}
|
26347
26347
|
});
|
26348
26348
|
|
@@ -26373,17 +26373,17 @@ var require_decode = __commonJS({
|
|
26373
26373
|
// ../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js
|
26374
26374
|
var require_length = __commonJS({
|
26375
26375
|
"../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(exports, module2) {
|
26376
|
-
var
|
26377
|
-
var
|
26378
|
-
var
|
26379
|
-
var
|
26376
|
+
var N13 = Math.pow(2, 7);
|
26377
|
+
var N23 = Math.pow(2, 14);
|
26378
|
+
var N33 = Math.pow(2, 21);
|
26379
|
+
var N43 = Math.pow(2, 28);
|
26380
26380
|
var N52 = Math.pow(2, 35);
|
26381
26381
|
var N62 = Math.pow(2, 42);
|
26382
26382
|
var N72 = Math.pow(2, 49);
|
26383
26383
|
var N82 = Math.pow(2, 56);
|
26384
26384
|
var N92 = Math.pow(2, 63);
|
26385
26385
|
module2.exports = function(value) {
|
26386
|
-
return value <
|
26386
|
+
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;
|
26387
26387
|
};
|
26388
26388
|
}
|
26389
26389
|
});
|
@@ -26423,7 +26423,7 @@ var require_src = __commonJS({
|
|
26423
26423
|
var LEADER = ALPHABET.charAt(0);
|
26424
26424
|
var FACTOR = Math.log(BASE) / Math.log(256);
|
26425
26425
|
var iFACTOR = Math.log(256) / Math.log(BASE);
|
26426
|
-
function
|
26426
|
+
function encode18(source) {
|
26427
26427
|
if (source instanceof Uint8Array) {
|
26428
26428
|
} else if (ArrayBuffer.isView(source)) {
|
26429
26429
|
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
@@ -26470,7 +26470,7 @@ var require_src = __commonJS({
|
|
26470
26470
|
}
|
26471
26471
|
return str;
|
26472
26472
|
}
|
26473
|
-
__name(
|
26473
|
+
__name(encode18, "encode");
|
26474
26474
|
function decodeUnsafe(source) {
|
26475
26475
|
if (typeof source !== "string") {
|
26476
26476
|
throw new TypeError("Expected String");
|
@@ -26522,18 +26522,18 @@ var require_src = __commonJS({
|
|
26522
26522
|
return vch;
|
26523
26523
|
}
|
26524
26524
|
__name(decodeUnsafe, "decodeUnsafe");
|
26525
|
-
function
|
26525
|
+
function decode14(string2) {
|
26526
26526
|
var buffer2 = decodeUnsafe(string2);
|
26527
26527
|
if (buffer2) {
|
26528
26528
|
return buffer2;
|
26529
26529
|
}
|
26530
26530
|
throw new Error("Non-base" + BASE + " character");
|
26531
26531
|
}
|
26532
|
-
__name(
|
26532
|
+
__name(decode14, "decode");
|
26533
26533
|
return {
|
26534
|
-
encode:
|
26534
|
+
encode: encode18,
|
26535
26535
|
decodeUnsafe,
|
26536
|
-
decode:
|
26536
|
+
decode: decode14
|
26537
26537
|
};
|
26538
26538
|
}
|
26539
26539
|
__name(base4, "base");
|
@@ -26569,12 +26569,12 @@ var require_base2 = __commonJS({
|
|
26569
26569
|
"use strict";
|
26570
26570
|
var { encodeText } = require_util();
|
26571
26571
|
var Base = class {
|
26572
|
-
constructor(name5, code5, factory,
|
26572
|
+
constructor(name5, code5, factory, alphabet3) {
|
26573
26573
|
this.name = name5;
|
26574
26574
|
this.code = code5;
|
26575
26575
|
this.codeBuf = encodeText(this.code);
|
26576
|
-
this.alphabet =
|
26577
|
-
this.codec = factory(
|
26576
|
+
this.alphabet = alphabet3;
|
26577
|
+
this.codec = factory(alphabet3);
|
26578
26578
|
}
|
26579
26579
|
encode(buf2) {
|
26580
26580
|
return this.codec.encode(buf2);
|
@@ -26597,10 +26597,10 @@ var require_base2 = __commonJS({
|
|
26597
26597
|
var require_rfc4648 = __commonJS({
|
26598
26598
|
"../../node_modules/.pnpm/multibase@4.0.6/node_modules/multibase/src/rfc4648.js"(exports, module2) {
|
26599
26599
|
"use strict";
|
26600
|
-
var
|
26600
|
+
var decode14 = /* @__PURE__ */ __name((string2, alphabet3, bitsPerChar) => {
|
26601
26601
|
const codes = {};
|
26602
|
-
for (let i = 0; i <
|
26603
|
-
codes[
|
26602
|
+
for (let i = 0; i < alphabet3.length; ++i) {
|
26603
|
+
codes[alphabet3[i]] = i;
|
26604
26604
|
}
|
26605
26605
|
let end = string2.length;
|
26606
26606
|
while (string2[end - 1] === "=") {
|
@@ -26627,8 +26627,8 @@ var require_rfc4648 = __commonJS({
|
|
26627
26627
|
}
|
26628
26628
|
return out;
|
26629
26629
|
}, "decode");
|
26630
|
-
var
|
26631
|
-
const pad2 =
|
26630
|
+
var encode18 = /* @__PURE__ */ __name((data, alphabet3, bitsPerChar) => {
|
26631
|
+
const pad2 = alphabet3[alphabet3.length - 1] === "=";
|
26632
26632
|
const mask = (1 << bitsPerChar) - 1;
|
26633
26633
|
let out = "";
|
26634
26634
|
let bits = 0;
|
@@ -26638,11 +26638,11 @@ var require_rfc4648 = __commonJS({
|
|
26638
26638
|
bits += 8;
|
26639
26639
|
while (bits > bitsPerChar) {
|
26640
26640
|
bits -= bitsPerChar;
|
26641
|
-
out +=
|
26641
|
+
out += alphabet3[mask & buffer2 >> bits];
|
26642
26642
|
}
|
26643
26643
|
}
|
26644
26644
|
if (bits) {
|
26645
|
-
out +=
|
26645
|
+
out += alphabet3[mask & buffer2 << bitsPerChar - bits];
|
26646
26646
|
}
|
26647
26647
|
if (pad2) {
|
26648
26648
|
while (out.length * bitsPerChar & 7) {
|
@@ -26651,13 +26651,13 @@ var require_rfc4648 = __commonJS({
|
|
26651
26651
|
}
|
26652
26652
|
return out;
|
26653
26653
|
}, "encode");
|
26654
|
-
var rfc46482 = /* @__PURE__ */ __name((bitsPerChar) => (
|
26654
|
+
var rfc46482 = /* @__PURE__ */ __name((bitsPerChar) => (alphabet3) => {
|
26655
26655
|
return {
|
26656
26656
|
encode(input) {
|
26657
|
-
return
|
26657
|
+
return encode18(input, alphabet3, bitsPerChar);
|
26658
26658
|
},
|
26659
26659
|
decode(input) {
|
26660
|
-
return
|
26660
|
+
return decode14(input, alphabet3, bitsPerChar);
|
26661
26661
|
}
|
26662
26662
|
};
|
26663
26663
|
}, "rfc4648");
|
@@ -26734,13 +26734,13 @@ var require_src2 = __commonJS({
|
|
26734
26734
|
return concat4([codeBuf, buf2], codeBuf.length + buf2.length);
|
26735
26735
|
}
|
26736
26736
|
__name(multibase, "multibase");
|
26737
|
-
function
|
26737
|
+
function encode18(nameOrCode, buf2) {
|
26738
26738
|
const enc = encoding(nameOrCode);
|
26739
26739
|
const data = encodeText(enc.encode(buf2));
|
26740
26740
|
return concat4([enc.codeBuf, data], enc.codeBuf.length + data.length);
|
26741
26741
|
}
|
26742
|
-
__name(
|
26743
|
-
function
|
26742
|
+
__name(encode18, "encode");
|
26743
|
+
function decode14(data) {
|
26744
26744
|
if (data instanceof Uint8Array) {
|
26745
26745
|
data = decodeText(data);
|
26746
26746
|
}
|
@@ -26751,7 +26751,7 @@ var require_src2 = __commonJS({
|
|
26751
26751
|
const enc = encoding(data[0]);
|
26752
26752
|
return enc.decode(data.substring(1));
|
26753
26753
|
}
|
26754
|
-
__name(
|
26754
|
+
__name(decode14, "decode");
|
26755
26755
|
function isEncoded(data) {
|
26756
26756
|
if (data instanceof Uint8Array) {
|
26757
26757
|
data = decodeText(data);
|
@@ -26790,8 +26790,8 @@ var require_src2 = __commonJS({
|
|
26790
26790
|
}
|
26791
26791
|
__name(encodingFromData, "encodingFromData");
|
26792
26792
|
exports = module2.exports = multibase;
|
26793
|
-
exports.encode =
|
26794
|
-
exports.decode =
|
26793
|
+
exports.encode = encode18;
|
26794
|
+
exports.decode = decode14;
|
26795
26795
|
exports.isEncoded = isEncoded;
|
26796
26796
|
exports.encoding = encoding;
|
26797
26797
|
exports.encodingFromData = encodingFromData;
|
@@ -26877,17 +26877,17 @@ var require_bases = __commonJS({
|
|
26877
26877
|
"../../node_modules/.pnpm/uint8arrays@2.1.10/node_modules/uint8arrays/util/bases.js"(exports, module2) {
|
26878
26878
|
"use strict";
|
26879
26879
|
var { bases: bases2 } = (init_basics(), __toCommonJS(basics_exports));
|
26880
|
-
function createCodec2(name5, prefix,
|
26880
|
+
function createCodec2(name5, prefix, encode18, decode14) {
|
26881
26881
|
return {
|
26882
26882
|
name: name5,
|
26883
26883
|
prefix,
|
26884
26884
|
encoder: {
|
26885
26885
|
name: name5,
|
26886
26886
|
prefix,
|
26887
|
-
encode:
|
26887
|
+
encode: encode18
|
26888
26888
|
},
|
26889
26889
|
decoder: {
|
26890
|
-
decode:
|
26890
|
+
decode: decode14
|
26891
26891
|
}
|
26892
26892
|
};
|
26893
26893
|
}
|
@@ -26947,15 +26947,15 @@ var require_to_string = __commonJS({
|
|
26947
26947
|
"../../node_modules/.pnpm/uint8arrays@2.1.10/node_modules/uint8arrays/to-string.js"(exports, module2) {
|
26948
26948
|
"use strict";
|
26949
26949
|
var bases2 = require_bases();
|
26950
|
-
function
|
26950
|
+
function toString6(array, encoding = "utf8") {
|
26951
26951
|
const base4 = bases2[encoding];
|
26952
26952
|
if (!base4) {
|
26953
26953
|
throw new Error(`Unsupported encoding "${encoding}"`);
|
26954
26954
|
}
|
26955
26955
|
return base4.encoder.encode(array).substring(1);
|
26956
26956
|
}
|
26957
|
-
__name(
|
26958
|
-
module2.exports =
|
26957
|
+
__name(toString6, "toString");
|
26958
|
+
module2.exports = toString6;
|
26959
26959
|
}
|
26960
26960
|
});
|
26961
26961
|
|
@@ -26986,14 +26986,14 @@ var require_uint8arrays = __commonJS({
|
|
26986
26986
|
var concat4 = require_concat();
|
26987
26987
|
var equals4 = require_equals();
|
26988
26988
|
var fromString6 = require_from_string();
|
26989
|
-
var
|
26989
|
+
var toString6 = require_to_string();
|
26990
26990
|
var xor2 = require_xor();
|
26991
26991
|
module2.exports = {
|
26992
26992
|
compare: compare4,
|
26993
26993
|
concat: concat4,
|
26994
26994
|
equals: equals4,
|
26995
26995
|
fromString: fromString6,
|
26996
|
-
toString:
|
26996
|
+
toString: toString6,
|
26997
26997
|
xor: xor2
|
26998
26998
|
};
|
26999
26999
|
}
|
@@ -27240,7 +27240,7 @@ var require_fast_json_stable_stringify = __commonJS({
|
|
27240
27240
|
};
|
27241
27241
|
}(opts.cmp);
|
27242
27242
|
var seen = [];
|
27243
|
-
return (/* @__PURE__ */ __name(function
|
27243
|
+
return (/* @__PURE__ */ __name(function stringify3(node) {
|
27244
27244
|
if (node && node.toJSON && typeof node.toJSON === "function") {
|
27245
27245
|
node = node.toJSON();
|
27246
27246
|
}
|
@@ -27256,7 +27256,7 @@ var require_fast_json_stable_stringify = __commonJS({
|
|
27256
27256
|
for (i = 0; i < node.length; i++) {
|
27257
27257
|
if (i)
|
27258
27258
|
out += ",";
|
27259
|
-
out +=
|
27259
|
+
out += stringify3(node[i]) || "null";
|
27260
27260
|
}
|
27261
27261
|
return out + "]";
|
27262
27262
|
}
|
@@ -27272,7 +27272,7 @@ var require_fast_json_stable_stringify = __commonJS({
|
|
27272
27272
|
out = "";
|
27273
27273
|
for (i = 0; i < keys.length; i++) {
|
27274
27274
|
var key2 = keys[i];
|
27275
|
-
var value =
|
27275
|
+
var value = stringify3(node[key2]);
|
27276
27276
|
if (!value)
|
27277
27277
|
continue;
|
27278
27278
|
if (out)
|
@@ -28685,12 +28685,12 @@ var require_dataloader = __commonJS({
|
|
28685
28685
|
// ../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/encode.js
|
28686
28686
|
var require_encode2 = __commonJS({
|
28687
28687
|
"../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/encode.js"(exports, module2) {
|
28688
|
-
module2.exports =
|
28688
|
+
module2.exports = encode18;
|
28689
28689
|
var MSB2 = 128;
|
28690
28690
|
var REST2 = 127;
|
28691
28691
|
var MSBALL2 = ~REST2;
|
28692
28692
|
var INT2 = Math.pow(2, 31);
|
28693
|
-
function
|
28693
|
+
function encode18(num, out, offset) {
|
28694
28694
|
out = out || [];
|
28695
28695
|
offset = offset || 0;
|
28696
28696
|
var oldOffset = offset;
|
@@ -28703,10 +28703,10 @@ var require_encode2 = __commonJS({
|
|
28703
28703
|
num >>>= 7;
|
28704
28704
|
}
|
28705
28705
|
out[offset] = num | 0;
|
28706
|
-
|
28706
|
+
encode18.bytes = offset - oldOffset + 1;
|
28707
28707
|
return out;
|
28708
28708
|
}
|
28709
|
-
__name(
|
28709
|
+
__name(encode18, "encode");
|
28710
28710
|
}
|
28711
28711
|
});
|
28712
28712
|
|
@@ -28737,17 +28737,17 @@ var require_decode2 = __commonJS({
|
|
28737
28737
|
// ../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/length.js
|
28738
28738
|
var require_length2 = __commonJS({
|
28739
28739
|
"../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/length.js"(exports, module2) {
|
28740
|
-
var
|
28741
|
-
var
|
28742
|
-
var
|
28743
|
-
var
|
28740
|
+
var N13 = Math.pow(2, 7);
|
28741
|
+
var N23 = Math.pow(2, 14);
|
28742
|
+
var N33 = Math.pow(2, 21);
|
28743
|
+
var N43 = Math.pow(2, 28);
|
28744
28744
|
var N52 = Math.pow(2, 35);
|
28745
28745
|
var N62 = Math.pow(2, 42);
|
28746
28746
|
var N72 = Math.pow(2, 49);
|
28747
28747
|
var N82 = Math.pow(2, 56);
|
28748
28748
|
var N92 = Math.pow(2, 63);
|
28749
28749
|
module2.exports = function(value) {
|
28750
|
-
return value <
|
28750
|
+
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;
|
28751
28751
|
};
|
28752
28752
|
}
|
28753
28753
|
});
|
@@ -29163,7 +29163,7 @@ var require_src3 = __commonJS({
|
|
29163
29163
|
return multibase.decode("z" + encoded);
|
29164
29164
|
}
|
29165
29165
|
__name(fromB58String, "fromB58String");
|
29166
|
-
function
|
29166
|
+
function decode14(bytes) {
|
29167
29167
|
if (!(bytes instanceof Uint8Array)) {
|
29168
29168
|
throw new Error("multihash must be a Uint8Array");
|
29169
29169
|
}
|
@@ -29190,8 +29190,8 @@ var require_src3 = __commonJS({
|
|
29190
29190
|
digest: bytes
|
29191
29191
|
};
|
29192
29192
|
}
|
29193
|
-
__name(
|
29194
|
-
function
|
29193
|
+
__name(decode14, "decode");
|
29194
|
+
function encode18(digest2, code5, length2) {
|
29195
29195
|
if (!digest2 || code5 === void 0) {
|
29196
29196
|
throw new Error("multihash encode requires at least two args: digest, code");
|
29197
29197
|
}
|
@@ -29209,7 +29209,7 @@ var require_src3 = __commonJS({
|
|
29209
29209
|
const len = varint5.encode(length2);
|
29210
29210
|
return uint8ArrayConcat([hash3, len, digest2], hash3.length + len.length + digest2.length);
|
29211
29211
|
}
|
29212
|
-
__name(
|
29212
|
+
__name(encode18, "encode");
|
29213
29213
|
function coerceCode(name5) {
|
29214
29214
|
let code5 = name5;
|
29215
29215
|
if (typeof name5 === "string") {
|
@@ -29241,12 +29241,12 @@ var require_src3 = __commonJS({
|
|
29241
29241
|
return false;
|
29242
29242
|
}
|
29243
29243
|
__name(isValidCode, "isValidCode");
|
29244
|
-
function
|
29245
|
-
|
29244
|
+
function validate7(multihash) {
|
29245
|
+
decode14(multihash);
|
29246
29246
|
}
|
29247
|
-
__name(
|
29247
|
+
__name(validate7, "validate");
|
29248
29248
|
function prefix(multihash) {
|
29249
|
-
|
29249
|
+
validate7(multihash);
|
29250
29250
|
return multihash.subarray(0, 2);
|
29251
29251
|
}
|
29252
29252
|
__name(prefix, "prefix");
|
@@ -29257,11 +29257,11 @@ var require_src3 = __commonJS({
|
|
29257
29257
|
fromHexString,
|
29258
29258
|
toB58String,
|
29259
29259
|
fromB58String,
|
29260
|
-
decode:
|
29261
|
-
encode:
|
29260
|
+
decode: decode14,
|
29261
|
+
encode: encode18,
|
29262
29262
|
coerceCode,
|
29263
29263
|
isAppCode,
|
29264
|
-
validate:
|
29264
|
+
validate: validate7,
|
29265
29265
|
prefix,
|
29266
29266
|
isValidCode
|
29267
29267
|
};
|
@@ -35219,6 +35219,57 @@ var require_uniswap_default_tokenlist = __commonJS({
|
|
35219
35219
|
}
|
35220
35220
|
});
|
35221
35221
|
|
35222
|
+
// ../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js
|
35223
|
+
var require_base32_decode = __commonJS({
|
35224
|
+
"../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js"(exports, module2) {
|
35225
|
+
var RFC46482 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
35226
|
+
var RFC4648_HEX2 = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
35227
|
+
var CROCKFORD2 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
35228
|
+
function readChar(alphabet3, char) {
|
35229
|
+
var idx = alphabet3.indexOf(char);
|
35230
|
+
if (idx === -1) {
|
35231
|
+
throw new Error("Invalid character found: " + char);
|
35232
|
+
}
|
35233
|
+
return idx;
|
35234
|
+
}
|
35235
|
+
__name(readChar, "readChar");
|
35236
|
+
module2.exports = /* @__PURE__ */ __name(function base32Decode2(input, variant) {
|
35237
|
+
var alphabet3;
|
35238
|
+
switch (variant) {
|
35239
|
+
case "RFC3548":
|
35240
|
+
case "RFC4648":
|
35241
|
+
alphabet3 = RFC46482;
|
35242
|
+
input = input.replace(/=+$/, "");
|
35243
|
+
break;
|
35244
|
+
case "RFC4648-HEX":
|
35245
|
+
alphabet3 = RFC4648_HEX2;
|
35246
|
+
input = input.replace(/=+$/, "");
|
35247
|
+
break;
|
35248
|
+
case "Crockford":
|
35249
|
+
alphabet3 = CROCKFORD2;
|
35250
|
+
input = input.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1");
|
35251
|
+
break;
|
35252
|
+
default:
|
35253
|
+
throw new Error("Unknown base32 variant: " + variant);
|
35254
|
+
}
|
35255
|
+
var length2 = input.length;
|
35256
|
+
var bits = 0;
|
35257
|
+
var value = 0;
|
35258
|
+
var index = 0;
|
35259
|
+
var output = new Uint8Array(length2 * 5 / 8 | 0);
|
35260
|
+
for (var i = 0; i < length2; i++) {
|
35261
|
+
value = value << 5 | readChar(alphabet3, input[i]);
|
35262
|
+
bits += 5;
|
35263
|
+
if (bits >= 8) {
|
35264
|
+
output[index++] = value >>> bits - 8 & 255;
|
35265
|
+
bits -= 8;
|
35266
|
+
}
|
35267
|
+
}
|
35268
|
+
return output.buffer;
|
35269
|
+
}, "base32Decode");
|
35270
|
+
}
|
35271
|
+
});
|
35272
|
+
|
35222
35273
|
// src/index.ts
|
35223
35274
|
import "isomorphic-fetch";
|
35224
35275
|
import "abort-controller/polyfill";
|
@@ -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,
|
@@ -53864,6 +57082,18 @@ export {
|
|
53864
57082
|
initLearnCard,
|
53865
57083
|
walletFromKey
|
53866
57084
|
};
|
57085
|
+
/*!
|
57086
|
+
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
57087
|
+
*/
|
57088
|
+
/*!
|
57089
|
+
* Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved.
|
57090
|
+
*/
|
57091
|
+
/*!
|
57092
|
+
* Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved.
|
57093
|
+
*/
|
57094
|
+
/*!
|
57095
|
+
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
|
57096
|
+
*/
|
53867
57097
|
/*!
|
53868
57098
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
53869
57099
|
* (c) 2017-2021 Joachim Wester
|
@@ -53874,6 +57104,15 @@ export {
|
|
53874
57104
|
* (c) 2017-2022 Joachim Wester
|
53875
57105
|
* MIT licensed
|
53876
57106
|
*/
|
57107
|
+
/**
|
57108
|
+
* @module QRCode
|
57109
|
+
* @package @nuintun/qrcode
|
57110
|
+
* @license MIT
|
57111
|
+
* @version 3.3.0
|
57112
|
+
* @author nuintun <nuintun@qq.com>
|
57113
|
+
* @description A pure JavaScript QRCode encode and decode library.
|
57114
|
+
* @see https://github.com/nuintun/qrcode#readme
|
57115
|
+
*/
|
53877
57116
|
/**
|
53878
57117
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
53879
57118
|
*
|