@learncard/vpqr-plugin 1.1.23 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -7
- package/dist/vpqr-plugin.cjs.development.cjs +352 -283
- package/dist/vpqr-plugin.cjs.development.cjs.map +4 -4
- package/dist/vpqr-plugin.cjs.production.min.cjs +2 -2
- package/dist/vpqr-plugin.cjs.production.min.cjs.map +4 -4
- package/dist/vpqr-plugin.esm.js +352 -283
- package/dist/vpqr-plugin.esm.js.map +4 -4
- package/package.json +58 -56
- package/src/global.d.ts +23 -0
- package/src/index.ts +41 -0
- package/src/types.ts +15 -0
package/dist/vpqr-plugin.esm.js
CHANGED
|
@@ -25,9 +25,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
|
|
28
|
-
// ../../../node_modules
|
|
28
|
+
// ../../../node_modules/base32-decode/index.js
|
|
29
29
|
var require_base32_decode = __commonJS({
|
|
30
|
-
"../../../node_modules
|
|
30
|
+
"../../../node_modules/base32-decode/index.js"(exports, module) {
|
|
31
31
|
"use strict";
|
|
32
32
|
var RFC46482 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
33
33
|
var RFC4648_HEX2 = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
@@ -77,24 +77,10 @@ var require_base32_decode = __commonJS({
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
// ../../../node_modules
|
|
81
|
-
var typeofs = [
|
|
82
|
-
"string",
|
|
83
|
-
"number",
|
|
84
|
-
"bigint",
|
|
85
|
-
"symbol"
|
|
86
|
-
];
|
|
80
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/is.js
|
|
87
81
|
var objectTypeNames = [
|
|
88
|
-
"Function",
|
|
89
|
-
"Generator",
|
|
90
|
-
"AsyncGenerator",
|
|
91
|
-
"GeneratorFunction",
|
|
92
|
-
"AsyncGeneratorFunction",
|
|
93
|
-
"AsyncFunction",
|
|
94
|
-
"Observable",
|
|
95
|
-
"Array",
|
|
96
|
-
"Buffer",
|
|
97
82
|
"Object",
|
|
83
|
+
// for Object.create(null) and other non-plain objects
|
|
98
84
|
"RegExp",
|
|
99
85
|
"Date",
|
|
100
86
|
"Error",
|
|
@@ -109,7 +95,6 @@ var objectTypeNames = [
|
|
|
109
95
|
"URL",
|
|
110
96
|
"HTMLElement",
|
|
111
97
|
"Int8Array",
|
|
112
|
-
"Uint8Array",
|
|
113
98
|
"Uint8ClampedArray",
|
|
114
99
|
"Int16Array",
|
|
115
100
|
"Uint16Array",
|
|
@@ -131,7 +116,7 @@ function is(value) {
|
|
|
131
116
|
return "boolean";
|
|
132
117
|
}
|
|
133
118
|
const typeOf = typeof value;
|
|
134
|
-
if (
|
|
119
|
+
if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") {
|
|
135
120
|
return typeOf;
|
|
136
121
|
}
|
|
137
122
|
if (typeOf === "function") {
|
|
@@ -140,8 +125,11 @@ function is(value) {
|
|
|
140
125
|
if (Array.isArray(value)) {
|
|
141
126
|
return "Array";
|
|
142
127
|
}
|
|
143
|
-
if (
|
|
144
|
-
return "
|
|
128
|
+
if (value instanceof Uint8Array) {
|
|
129
|
+
return "Uint8Array";
|
|
130
|
+
}
|
|
131
|
+
if (value.constructor === Object) {
|
|
132
|
+
return "Object";
|
|
145
133
|
}
|
|
146
134
|
const objectType = getObjectType(value);
|
|
147
135
|
if (objectType) {
|
|
@@ -150,10 +138,6 @@ function is(value) {
|
|
|
150
138
|
return "Object";
|
|
151
139
|
}
|
|
152
140
|
__name(is, "is");
|
|
153
|
-
function isBuffer(value) {
|
|
154
|
-
return value && value.constructor && value.constructor.isBuffer && value.constructor.isBuffer.call(null, value);
|
|
155
|
-
}
|
|
156
|
-
__name(isBuffer, "isBuffer");
|
|
157
141
|
function getObjectType(value) {
|
|
158
142
|
const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
|
|
159
143
|
if (objectTypeNames.includes(objectTypeName)) {
|
|
@@ -163,7 +147,7 @@ function getObjectType(value) {
|
|
|
163
147
|
}
|
|
164
148
|
__name(getObjectType, "getObjectType");
|
|
165
149
|
|
|
166
|
-
// ../../../node_modules
|
|
150
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/token.js
|
|
167
151
|
var _Type = class _Type {
|
|
168
152
|
/**
|
|
169
153
|
* @param {number} major
|
|
@@ -187,6 +171,17 @@ var _Type = class _Type {
|
|
|
187
171
|
compare(typ) {
|
|
188
172
|
return this.major < typ.major ? -1 : this.major > typ.major ? 1 : 0;
|
|
189
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Check equality between two Type instances. Safe to use across different
|
|
176
|
+
* copies of the Type class (e.g., when bundlers duplicate the module).
|
|
177
|
+
* (major, name) uniquely identifies a Type; terminal is implied by these.
|
|
178
|
+
* @param {Type} a
|
|
179
|
+
* @param {Type} b
|
|
180
|
+
* @returns {boolean}
|
|
181
|
+
*/
|
|
182
|
+
static equals(a, b) {
|
|
183
|
+
return a === b || a.major === b.major && a.name === b.name;
|
|
184
|
+
}
|
|
190
185
|
};
|
|
191
186
|
__name(_Type, "Type");
|
|
192
187
|
var Type = _Type;
|
|
@@ -224,56 +219,32 @@ var _Token = class _Token {
|
|
|
224
219
|
__name(_Token, "Token");
|
|
225
220
|
var Token = _Token;
|
|
226
221
|
|
|
227
|
-
// ../../../node_modules
|
|
222
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/byte-utils.js
|
|
228
223
|
var useBuffer = globalThis.process && // @ts-ignore
|
|
229
224
|
!globalThis.process.browser && // @ts-ignore
|
|
230
225
|
globalThis.Buffer && // @ts-ignore
|
|
231
226
|
typeof globalThis.Buffer.isBuffer === "function";
|
|
232
|
-
var textDecoder = new TextDecoder();
|
|
233
227
|
var textEncoder = new TextEncoder();
|
|
234
|
-
function
|
|
235
|
-
return useBuffer && globalThis.Buffer.isBuffer(
|
|
228
|
+
function isBuffer(buf) {
|
|
229
|
+
return useBuffer && globalThis.Buffer.isBuffer(buf);
|
|
236
230
|
}
|
|
237
|
-
__name(
|
|
238
|
-
function asU8A(
|
|
239
|
-
if (!(
|
|
240
|
-
return Uint8Array.from(
|
|
231
|
+
__name(isBuffer, "isBuffer");
|
|
232
|
+
function asU8A(buf) {
|
|
233
|
+
if (!(buf instanceof Uint8Array)) {
|
|
234
|
+
return Uint8Array.from(buf);
|
|
241
235
|
}
|
|
242
|
-
return
|
|
236
|
+
return isBuffer(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
|
|
243
237
|
}
|
|
244
238
|
__name(asU8A, "asU8A");
|
|
245
|
-
var
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* @param {Uint8Array} bytes
|
|
249
|
-
* @param {number} start
|
|
250
|
-
* @param {number} end
|
|
251
|
-
*/
|
|
252
|
-
(bytes, start, end) => {
|
|
253
|
-
return end - start > 64 ? (
|
|
254
|
-
// eslint-disable-line operator-linebreak
|
|
255
|
-
// @ts-ignore
|
|
256
|
-
globalThis.Buffer.from(bytes.subarray(start, end)).toString("utf8")
|
|
257
|
-
) : utf8Slice(bytes, start, end);
|
|
258
|
-
}
|
|
259
|
-
) : (
|
|
260
|
-
// eslint-disable-line operator-linebreak
|
|
261
|
-
/**
|
|
262
|
-
* @param {Uint8Array} bytes
|
|
263
|
-
* @param {number} start
|
|
264
|
-
* @param {number} end
|
|
265
|
-
*/
|
|
266
|
-
(bytes, start, end) => {
|
|
267
|
-
return end - start > 64 ? textDecoder.decode(bytes.subarray(start, end)) : utf8Slice(bytes, start, end);
|
|
268
|
-
}
|
|
269
|
-
);
|
|
239
|
+
var FROM_STRING_THRESHOLD_BUFFER = 24;
|
|
240
|
+
var FROM_STRING_THRESHOLD_TEXTENCODER = 200;
|
|
270
241
|
var fromString = useBuffer ? (
|
|
271
242
|
// eslint-disable-line operator-linebreak
|
|
272
243
|
/**
|
|
273
244
|
* @param {string} string
|
|
274
245
|
*/
|
|
275
246
|
(string) => {
|
|
276
|
-
return string.length
|
|
247
|
+
return string.length >= FROM_STRING_THRESHOLD_BUFFER ? (
|
|
277
248
|
// eslint-disable-line operator-linebreak
|
|
278
249
|
// @ts-ignore
|
|
279
250
|
globalThis.Buffer.from(string)
|
|
@@ -285,7 +256,7 @@ var fromString = useBuffer ? (
|
|
|
285
256
|
* @param {string} string
|
|
286
257
|
*/
|
|
287
258
|
(string) => {
|
|
288
|
-
return string.length
|
|
259
|
+
return string.length >= FROM_STRING_THRESHOLD_TEXTENCODER ? textEncoder.encode(string) : utf8ToBytes(string);
|
|
289
260
|
}
|
|
290
261
|
);
|
|
291
262
|
var fromArray = /* @__PURE__ */ __name((arr) => {
|
|
@@ -298,8 +269,9 @@ var slice = useBuffer ? (
|
|
|
298
269
|
* @param {number} start
|
|
299
270
|
* @param {number} end
|
|
300
271
|
*/
|
|
272
|
+
// Buffer.slice() returns a view, not a copy, so we need special handling
|
|
301
273
|
(bytes, start, end) => {
|
|
302
|
-
if (
|
|
274
|
+
if (isBuffer(bytes)) {
|
|
303
275
|
return new Uint8Array(bytes.subarray(start, end));
|
|
304
276
|
}
|
|
305
277
|
return bytes.slice(start, end);
|
|
@@ -370,7 +342,7 @@ var alloc = useBuffer ? (
|
|
|
370
342
|
}
|
|
371
343
|
);
|
|
372
344
|
function compare(b1, b2) {
|
|
373
|
-
if (
|
|
345
|
+
if (isBuffer(b1) && isBuffer(b2)) {
|
|
374
346
|
return b1.compare(b2);
|
|
375
347
|
}
|
|
376
348
|
for (let i = 0; i < b1.length; i++) {
|
|
@@ -399,6 +371,9 @@ function utf8ToBytes(str) {
|
|
|
399
371
|
out[p++] = c >> 6 & 63 | 128;
|
|
400
372
|
out[p++] = c & 63 | 128;
|
|
401
373
|
} else {
|
|
374
|
+
if (c >= 55296 && c <= 57343) {
|
|
375
|
+
c = 65533;
|
|
376
|
+
}
|
|
402
377
|
out[p++] = c >> 12 | 224;
|
|
403
378
|
out[p++] = c >> 6 & 63 | 128;
|
|
404
379
|
out[p++] = c & 63 | 128;
|
|
@@ -407,84 +382,8 @@ function utf8ToBytes(str) {
|
|
|
407
382
|
return out;
|
|
408
383
|
}
|
|
409
384
|
__name(utf8ToBytes, "utf8ToBytes");
|
|
410
|
-
function utf8Slice(buf2, offset, end) {
|
|
411
|
-
const res = [];
|
|
412
|
-
while (offset < end) {
|
|
413
|
-
const firstByte = buf2[offset];
|
|
414
|
-
let codePoint = null;
|
|
415
|
-
let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
416
|
-
if (offset + bytesPerSequence <= end) {
|
|
417
|
-
let secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
418
|
-
switch (bytesPerSequence) {
|
|
419
|
-
case 1:
|
|
420
|
-
if (firstByte < 128) {
|
|
421
|
-
codePoint = firstByte;
|
|
422
|
-
}
|
|
423
|
-
break;
|
|
424
|
-
case 2:
|
|
425
|
-
secondByte = buf2[offset + 1];
|
|
426
|
-
if ((secondByte & 192) === 128) {
|
|
427
|
-
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
428
|
-
if (tempCodePoint > 127) {
|
|
429
|
-
codePoint = tempCodePoint;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
break;
|
|
433
|
-
case 3:
|
|
434
|
-
secondByte = buf2[offset + 1];
|
|
435
|
-
thirdByte = buf2[offset + 2];
|
|
436
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
437
|
-
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
438
|
-
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
439
|
-
codePoint = tempCodePoint;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
break;
|
|
443
|
-
case 4:
|
|
444
|
-
secondByte = buf2[offset + 1];
|
|
445
|
-
thirdByte = buf2[offset + 2];
|
|
446
|
-
fourthByte = buf2[offset + 3];
|
|
447
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
448
|
-
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
449
|
-
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
450
|
-
codePoint = tempCodePoint;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
if (codePoint === null) {
|
|
456
|
-
codePoint = 65533;
|
|
457
|
-
bytesPerSequence = 1;
|
|
458
|
-
} else if (codePoint > 65535) {
|
|
459
|
-
codePoint -= 65536;
|
|
460
|
-
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
461
|
-
codePoint = 56320 | codePoint & 1023;
|
|
462
|
-
}
|
|
463
|
-
res.push(codePoint);
|
|
464
|
-
offset += bytesPerSequence;
|
|
465
|
-
}
|
|
466
|
-
return decodeCodePointsArray(res);
|
|
467
|
-
}
|
|
468
|
-
__name(utf8Slice, "utf8Slice");
|
|
469
|
-
var MAX_ARGUMENTS_LENGTH = 4096;
|
|
470
|
-
function decodeCodePointsArray(codePoints) {
|
|
471
|
-
const len = codePoints.length;
|
|
472
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
473
|
-
return String.fromCharCode.apply(String, codePoints);
|
|
474
|
-
}
|
|
475
|
-
let res = "";
|
|
476
|
-
let i = 0;
|
|
477
|
-
while (i < len) {
|
|
478
|
-
res += String.fromCharCode.apply(
|
|
479
|
-
String,
|
|
480
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
|
-
return res;
|
|
484
|
-
}
|
|
485
|
-
__name(decodeCodePointsArray, "decodeCodePointsArray");
|
|
486
385
|
|
|
487
|
-
// ../../../node_modules
|
|
386
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/bl.js
|
|
488
387
|
var defaultChunkSize = 256;
|
|
489
388
|
var _Bl = class _Bl {
|
|
490
389
|
/**
|
|
@@ -566,8 +465,44 @@ var _Bl = class _Bl {
|
|
|
566
465
|
};
|
|
567
466
|
__name(_Bl, "Bl");
|
|
568
467
|
var Bl = _Bl;
|
|
468
|
+
var _U8Bl = class _U8Bl {
|
|
469
|
+
/**
|
|
470
|
+
* @param {Uint8Array} dest
|
|
471
|
+
*/
|
|
472
|
+
constructor(dest) {
|
|
473
|
+
this.dest = dest;
|
|
474
|
+
this.cursor = 0;
|
|
475
|
+
this.chunks = [dest];
|
|
476
|
+
}
|
|
477
|
+
reset() {
|
|
478
|
+
this.cursor = 0;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* @param {Uint8Array|number[]} bytes
|
|
482
|
+
*/
|
|
483
|
+
push(bytes) {
|
|
484
|
+
if (this.cursor + bytes.length > this.dest.length) {
|
|
485
|
+
throw new Error("write out of bounds, destination buffer is too small");
|
|
486
|
+
}
|
|
487
|
+
this.dest.set(bytes, this.cursor);
|
|
488
|
+
this.cursor += bytes.length;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* @param {boolean} [reset]
|
|
492
|
+
* @returns {Uint8Array}
|
|
493
|
+
*/
|
|
494
|
+
toBytes(reset = false) {
|
|
495
|
+
const byts = this.dest.subarray(0, this.cursor);
|
|
496
|
+
if (reset) {
|
|
497
|
+
this.reset();
|
|
498
|
+
}
|
|
499
|
+
return byts;
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
__name(_U8Bl, "U8Bl");
|
|
503
|
+
var U8Bl = _U8Bl;
|
|
569
504
|
|
|
570
|
-
// ../../../node_modules
|
|
505
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/common.js
|
|
571
506
|
var decodeErrPrefix = "CBOR decode error:";
|
|
572
507
|
var encodeErrPrefix = "CBOR encode error:";
|
|
573
508
|
var uintMinorPrefixBytes = [];
|
|
@@ -583,7 +518,7 @@ function assertEnoughData(data, pos, need) {
|
|
|
583
518
|
}
|
|
584
519
|
__name(assertEnoughData, "assertEnoughData");
|
|
585
520
|
|
|
586
|
-
// ../../../node_modules
|
|
521
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/0uint.js
|
|
587
522
|
var uintBoundaries = [24, 256, 65536, 4294967296, BigInt("18446744073709551616")];
|
|
588
523
|
function readUint8(data, offset, options) {
|
|
589
524
|
assertEnoughData(data, offset, 1);
|
|
@@ -645,23 +580,23 @@ function decodeUint64(data, pos, _minor, options) {
|
|
|
645
580
|
return new Token(Type.uint, readUint64(data, pos + 1, options), 9);
|
|
646
581
|
}
|
|
647
582
|
__name(decodeUint64, "decodeUint64");
|
|
648
|
-
function encodeUint(
|
|
649
|
-
return encodeUintValue(
|
|
583
|
+
function encodeUint(writer, token) {
|
|
584
|
+
return encodeUintValue(writer, 0, token.value);
|
|
650
585
|
}
|
|
651
586
|
__name(encodeUint, "encodeUint");
|
|
652
|
-
function encodeUintValue(
|
|
587
|
+
function encodeUintValue(writer, major, uint) {
|
|
653
588
|
if (uint < uintBoundaries[0]) {
|
|
654
589
|
const nuint = Number(uint);
|
|
655
|
-
|
|
590
|
+
writer.push([major | nuint]);
|
|
656
591
|
} else if (uint < uintBoundaries[1]) {
|
|
657
592
|
const nuint = Number(uint);
|
|
658
|
-
|
|
593
|
+
writer.push([major | 24, nuint]);
|
|
659
594
|
} else if (uint < uintBoundaries[2]) {
|
|
660
595
|
const nuint = Number(uint);
|
|
661
|
-
|
|
596
|
+
writer.push([major | 25, nuint >>> 8, nuint & 255]);
|
|
662
597
|
} else if (uint < uintBoundaries[3]) {
|
|
663
598
|
const nuint = Number(uint);
|
|
664
|
-
|
|
599
|
+
writer.push([major | 26, nuint >>> 24 & 255, nuint >>> 16 & 255, nuint >>> 8 & 255, nuint & 255]);
|
|
665
600
|
} else {
|
|
666
601
|
const buint = BigInt(uint);
|
|
667
602
|
if (buint < uintBoundaries[4]) {
|
|
@@ -682,7 +617,7 @@ function encodeUintValue(buf2, major, uint) {
|
|
|
682
617
|
set[2] = hi & 255;
|
|
683
618
|
hi = hi >> 8;
|
|
684
619
|
set[1] = hi & 255;
|
|
685
|
-
|
|
620
|
+
writer.push(set);
|
|
686
621
|
} else {
|
|
687
622
|
throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
|
|
688
623
|
}
|
|
@@ -714,7 +649,7 @@ encodeUint.compareTokens = /* @__PURE__ */ __name(function compareTokens(tok1, t
|
|
|
714
649
|
);
|
|
715
650
|
}, "compareTokens");
|
|
716
651
|
|
|
717
|
-
// ../../../node_modules
|
|
652
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/1negint.js
|
|
718
653
|
function decodeNegint8(data, pos, _minor, options) {
|
|
719
654
|
return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
|
|
720
655
|
}
|
|
@@ -743,10 +678,10 @@ function decodeNegint64(data, pos, _minor, options) {
|
|
|
743
678
|
return new Token(Type.negint, neg1b - BigInt(int), 9);
|
|
744
679
|
}
|
|
745
680
|
__name(decodeNegint64, "decodeNegint64");
|
|
746
|
-
function encodeNegint(
|
|
681
|
+
function encodeNegint(writer, token) {
|
|
747
682
|
const negint = token.value;
|
|
748
683
|
const unsigned = typeof negint === "bigint" ? negint * neg1b - pos1b : negint * -1 - 1;
|
|
749
|
-
encodeUintValue(
|
|
684
|
+
encodeUintValue(writer, token.type.majorEncoded, unsigned);
|
|
750
685
|
}
|
|
751
686
|
__name(encodeNegint, "encodeNegint");
|
|
752
687
|
encodeNegint.encodedSize = /* @__PURE__ */ __name(function encodedSize3(token) {
|
|
@@ -773,11 +708,11 @@ encodeNegint.compareTokens = /* @__PURE__ */ __name(function compareTokens2(tok1
|
|
|
773
708
|
);
|
|
774
709
|
}, "compareTokens");
|
|
775
710
|
|
|
776
|
-
// ../../../node_modules
|
|
711
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/2bytes.js
|
|
777
712
|
function toToken(data, pos, prefix, length) {
|
|
778
713
|
assertEnoughData(data, pos, prefix + length);
|
|
779
|
-
const
|
|
780
|
-
return new Token(Type.bytes,
|
|
714
|
+
const buf = data.slice(pos + prefix, pos + prefix + length);
|
|
715
|
+
return new Token(Type.bytes, buf, prefix + length);
|
|
781
716
|
}
|
|
782
717
|
__name(toToken, "toToken");
|
|
783
718
|
function decodeBytesCompact(data, pos, minor, _options) {
|
|
@@ -806,15 +741,15 @@ function decodeBytes64(data, pos, _minor, options) {
|
|
|
806
741
|
__name(decodeBytes64, "decodeBytes64");
|
|
807
742
|
function tokenBytes(token) {
|
|
808
743
|
if (token.encodedBytes === void 0) {
|
|
809
|
-
token.encodedBytes = token.type
|
|
744
|
+
token.encodedBytes = Type.equals(token.type, Type.string) ? fromString(token.value) : token.value;
|
|
810
745
|
}
|
|
811
746
|
return token.encodedBytes;
|
|
812
747
|
}
|
|
813
748
|
__name(tokenBytes, "tokenBytes");
|
|
814
|
-
function encodeBytes(
|
|
749
|
+
function encodeBytes(writer, token) {
|
|
815
750
|
const bytes = tokenBytes(token);
|
|
816
|
-
encodeUintValue(
|
|
817
|
-
|
|
751
|
+
encodeUintValue(writer, token.type.majorEncoded, bytes.length);
|
|
752
|
+
writer.push(bytes);
|
|
818
753
|
}
|
|
819
754
|
__name(encodeBytes, "encodeBytes");
|
|
820
755
|
encodeBytes.encodedSize = /* @__PURE__ */ __name(function encodedSize4(token) {
|
|
@@ -829,13 +764,31 @@ function compareBytes(b1, b2) {
|
|
|
829
764
|
}
|
|
830
765
|
__name(compareBytes, "compareBytes");
|
|
831
766
|
|
|
832
|
-
// ../../../node_modules
|
|
767
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/3string.js
|
|
768
|
+
var textDecoder = new TextDecoder();
|
|
769
|
+
var ASCII_THRESHOLD = 32;
|
|
770
|
+
function toStr(bytes, start, end) {
|
|
771
|
+
const len = end - start;
|
|
772
|
+
if (len < ASCII_THRESHOLD) {
|
|
773
|
+
let str = "";
|
|
774
|
+
for (let i = start; i < end; i++) {
|
|
775
|
+
const c = bytes[i];
|
|
776
|
+
if (c & 128) {
|
|
777
|
+
return textDecoder.decode(bytes.subarray(start, end));
|
|
778
|
+
}
|
|
779
|
+
str += String.fromCharCode(c);
|
|
780
|
+
}
|
|
781
|
+
return str;
|
|
782
|
+
}
|
|
783
|
+
return textDecoder.decode(bytes.subarray(start, end));
|
|
784
|
+
}
|
|
785
|
+
__name(toStr, "toStr");
|
|
833
786
|
function toToken2(data, pos, prefix, length, options) {
|
|
834
787
|
const totLength = prefix + length;
|
|
835
788
|
assertEnoughData(data, pos, totLength);
|
|
836
|
-
const tok = new Token(Type.string,
|
|
789
|
+
const tok = new Token(Type.string, toStr(data, pos + prefix, pos + totLength), totLength);
|
|
837
790
|
if (options.retainStringBytes === true) {
|
|
838
|
-
tok.byteValue = slice(
|
|
791
|
+
tok.byteValue = data.slice(pos + prefix, pos + totLength);
|
|
839
792
|
}
|
|
840
793
|
return tok;
|
|
841
794
|
}
|
|
@@ -866,7 +819,7 @@ function decodeString64(data, pos, _minor, options) {
|
|
|
866
819
|
__name(decodeString64, "decodeString64");
|
|
867
820
|
var encodeString = encodeBytes;
|
|
868
821
|
|
|
869
|
-
// ../../../node_modules
|
|
822
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/4array.js
|
|
870
823
|
function toToken3(_data, _pos, prefix, length) {
|
|
871
824
|
return new Token(Type.array, length, prefix);
|
|
872
825
|
}
|
|
@@ -902,8 +855,8 @@ function decodeArrayIndefinite(data, pos, _minor, options) {
|
|
|
902
855
|
return toToken3(data, pos, 1, Infinity);
|
|
903
856
|
}
|
|
904
857
|
__name(decodeArrayIndefinite, "decodeArrayIndefinite");
|
|
905
|
-
function encodeArray(
|
|
906
|
-
encodeUintValue(
|
|
858
|
+
function encodeArray(writer, token) {
|
|
859
|
+
encodeUintValue(writer, Type.array.majorEncoded, token.value);
|
|
907
860
|
}
|
|
908
861
|
__name(encodeArray, "encodeArray");
|
|
909
862
|
encodeArray.compareTokens = encodeUint.compareTokens;
|
|
@@ -911,7 +864,7 @@ encodeArray.encodedSize = /* @__PURE__ */ __name(function encodedSize5(token) {
|
|
|
911
864
|
return encodeUintValue.encodedSize(token.value);
|
|
912
865
|
}, "encodedSize");
|
|
913
866
|
|
|
914
|
-
// ../../../node_modules
|
|
867
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/5map.js
|
|
915
868
|
function toToken4(_data, _pos, prefix, length) {
|
|
916
869
|
return new Token(Type.map, length, prefix);
|
|
917
870
|
}
|
|
@@ -947,8 +900,8 @@ function decodeMapIndefinite(data, pos, _minor, options) {
|
|
|
947
900
|
return toToken4(data, pos, 1, Infinity);
|
|
948
901
|
}
|
|
949
902
|
__name(decodeMapIndefinite, "decodeMapIndefinite");
|
|
950
|
-
function encodeMap(
|
|
951
|
-
encodeUintValue(
|
|
903
|
+
function encodeMap(writer, token) {
|
|
904
|
+
encodeUintValue(writer, Type.map.majorEncoded, token.value);
|
|
952
905
|
}
|
|
953
906
|
__name(encodeMap, "encodeMap");
|
|
954
907
|
encodeMap.compareTokens = encodeUint.compareTokens;
|
|
@@ -956,7 +909,7 @@ encodeMap.encodedSize = /* @__PURE__ */ __name(function encodedSize6(token) {
|
|
|
956
909
|
return encodeUintValue.encodedSize(token.value);
|
|
957
910
|
}, "encodedSize");
|
|
958
911
|
|
|
959
|
-
// ../../../node_modules
|
|
912
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/6tag.js
|
|
960
913
|
function decodeTagCompact(_data, _pos, minor, _options) {
|
|
961
914
|
return new Token(Type.tag, minor, 1);
|
|
962
915
|
}
|
|
@@ -977,8 +930,8 @@ function decodeTag64(data, pos, _minor, options) {
|
|
|
977
930
|
return new Token(Type.tag, readUint64(data, pos + 1, options), 9);
|
|
978
931
|
}
|
|
979
932
|
__name(decodeTag64, "decodeTag64");
|
|
980
|
-
function encodeTag(
|
|
981
|
-
encodeUintValue(
|
|
933
|
+
function encodeTag(writer, token) {
|
|
934
|
+
encodeUintValue(writer, Type.tag.majorEncoded, token.value);
|
|
982
935
|
}
|
|
983
936
|
__name(encodeTag, "encodeTag");
|
|
984
937
|
encodeTag.compareTokens = encodeUint.compareTokens;
|
|
@@ -986,7 +939,7 @@ encodeTag.encodedSize = /* @__PURE__ */ __name(function encodedSize7(token) {
|
|
|
986
939
|
return encodeUintValue.encodedSize(token.value);
|
|
987
940
|
}, "encodedSize");
|
|
988
941
|
|
|
989
|
-
// ../../../node_modules
|
|
942
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/7float.js
|
|
990
943
|
var MINOR_FALSE = 20;
|
|
991
944
|
var MINOR_TRUE = 21;
|
|
992
945
|
var MINOR_NULL = 22;
|
|
@@ -1031,16 +984,16 @@ function decodeFloat64(data, pos, _minor, options) {
|
|
|
1031
984
|
return createToken(readFloat64(data, pos + 1), 9, options);
|
|
1032
985
|
}
|
|
1033
986
|
__name(decodeFloat64, "decodeFloat64");
|
|
1034
|
-
function encodeFloat(
|
|
987
|
+
function encodeFloat(writer, token, options) {
|
|
1035
988
|
const float = token.value;
|
|
1036
989
|
if (float === false) {
|
|
1037
|
-
|
|
990
|
+
writer.push([Type.float.majorEncoded | MINOR_FALSE]);
|
|
1038
991
|
} else if (float === true) {
|
|
1039
|
-
|
|
992
|
+
writer.push([Type.float.majorEncoded | MINOR_TRUE]);
|
|
1040
993
|
} else if (float === null) {
|
|
1041
|
-
|
|
994
|
+
writer.push([Type.float.majorEncoded | MINOR_NULL]);
|
|
1042
995
|
} else if (float === void 0) {
|
|
1043
|
-
|
|
996
|
+
writer.push([Type.float.majorEncoded | MINOR_UNDEFINED]);
|
|
1044
997
|
} else {
|
|
1045
998
|
let decoded;
|
|
1046
999
|
let success = false;
|
|
@@ -1049,14 +1002,14 @@ function encodeFloat(buf2, token, options) {
|
|
|
1049
1002
|
decoded = readFloat16(ui8a, 1);
|
|
1050
1003
|
if (float === decoded || Number.isNaN(float)) {
|
|
1051
1004
|
ui8a[0] = 249;
|
|
1052
|
-
|
|
1005
|
+
writer.push(ui8a.slice(0, 3));
|
|
1053
1006
|
success = true;
|
|
1054
1007
|
} else {
|
|
1055
1008
|
encodeFloat32(float);
|
|
1056
1009
|
decoded = readFloat32(ui8a, 1);
|
|
1057
1010
|
if (float === decoded) {
|
|
1058
1011
|
ui8a[0] = 250;
|
|
1059
|
-
|
|
1012
|
+
writer.push(ui8a.slice(0, 5));
|
|
1060
1013
|
success = true;
|
|
1061
1014
|
}
|
|
1062
1015
|
}
|
|
@@ -1065,7 +1018,7 @@ function encodeFloat(buf2, token, options) {
|
|
|
1065
1018
|
encodeFloat64(float);
|
|
1066
1019
|
decoded = readFloat64(ui8a, 1);
|
|
1067
1020
|
ui8a[0] = 251;
|
|
1068
|
-
|
|
1021
|
+
writer.push(ui8a.slice(0, 9));
|
|
1069
1022
|
}
|
|
1070
1023
|
}
|
|
1071
1024
|
}
|
|
@@ -1175,7 +1128,7 @@ function readFloat64(ui8a2, pos) {
|
|
|
1175
1128
|
__name(readFloat64, "readFloat64");
|
|
1176
1129
|
encodeFloat.compareTokens = encodeUint.compareTokens;
|
|
1177
1130
|
|
|
1178
|
-
// ../../../node_modules
|
|
1131
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/jump.js
|
|
1179
1132
|
function invalidMinor(data, pos, minor) {
|
|
1180
1133
|
throw new Error(`${decodeErrPrefix} encountered invalid minor (${minor}) for major ${data[pos] >>> 5}`);
|
|
1181
1134
|
}
|
|
@@ -1334,7 +1287,7 @@ function quickEncodeToken(token) {
|
|
|
1334
1287
|
}
|
|
1335
1288
|
__name(quickEncodeToken, "quickEncodeToken");
|
|
1336
1289
|
|
|
1337
|
-
// ../../../node_modules
|
|
1290
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/encode.js
|
|
1338
1291
|
var defaultEncodeOptions = {
|
|
1339
1292
|
float64: false,
|
|
1340
1293
|
mapSorter,
|
|
@@ -1359,7 +1312,7 @@ function makeCborEncoders() {
|
|
|
1359
1312
|
}
|
|
1360
1313
|
__name(makeCborEncoders, "makeCborEncoders");
|
|
1361
1314
|
var cborEncoders = makeCborEncoders();
|
|
1362
|
-
var
|
|
1315
|
+
var defaultWriter = new Bl();
|
|
1363
1316
|
var _Ref = class _Ref {
|
|
1364
1317
|
/**
|
|
1365
1318
|
* @param {object|any[]} obj
|
|
@@ -1540,27 +1493,38 @@ var typeEncoders = {
|
|
|
1540
1493
|
Object(obj, typ, options, refStack) {
|
|
1541
1494
|
const isMap = typ !== "Object";
|
|
1542
1495
|
const keys = isMap ? obj.keys() : Object.keys(obj);
|
|
1543
|
-
const
|
|
1544
|
-
|
|
1496
|
+
const maxLength = isMap ? obj.size : keys.length;
|
|
1497
|
+
let entries;
|
|
1498
|
+
if (maxLength) {
|
|
1499
|
+
entries = new Array(maxLength);
|
|
1500
|
+
refStack = Ref.createCheck(refStack, obj);
|
|
1501
|
+
const skipUndefined = !isMap && options.ignoreUndefinedProperties;
|
|
1502
|
+
let i = 0;
|
|
1503
|
+
for (const key of keys) {
|
|
1504
|
+
const value = isMap ? obj.get(key) : obj[key];
|
|
1505
|
+
if (skipUndefined && value === void 0) {
|
|
1506
|
+
continue;
|
|
1507
|
+
}
|
|
1508
|
+
entries[i++] = [
|
|
1509
|
+
objectToTokens(key, options, refStack),
|
|
1510
|
+
objectToTokens(value, options, refStack)
|
|
1511
|
+
];
|
|
1512
|
+
}
|
|
1513
|
+
if (i < maxLength) {
|
|
1514
|
+
entries.length = i;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
if (!entries?.length) {
|
|
1545
1518
|
if (options.addBreakTokens === true) {
|
|
1546
1519
|
return [simpleTokens.emptyMap, new Token(Type.break)];
|
|
1547
1520
|
}
|
|
1548
1521
|
return simpleTokens.emptyMap;
|
|
1549
1522
|
}
|
|
1550
|
-
refStack = Ref.createCheck(refStack, obj);
|
|
1551
|
-
const entries = [];
|
|
1552
|
-
let i = 0;
|
|
1553
|
-
for (const key of keys) {
|
|
1554
|
-
entries[i++] = [
|
|
1555
|
-
objectToTokens(key, options, refStack),
|
|
1556
|
-
objectToTokens(isMap ? obj.get(key) : obj[key], options, refStack)
|
|
1557
|
-
];
|
|
1558
|
-
}
|
|
1559
1523
|
sortMapEntries(entries, options);
|
|
1560
1524
|
if (options.addBreakTokens) {
|
|
1561
|
-
return [new Token(Type.map, length), entries, new Token(Type.break)];
|
|
1525
|
+
return [new Token(Type.map, entries.length), entries, new Token(Type.break)];
|
|
1562
1526
|
}
|
|
1563
|
-
return [new Token(Type.map, length), entries];
|
|
1527
|
+
return [new Token(Type.map, entries.length), entries];
|
|
1564
1528
|
}
|
|
1565
1529
|
};
|
|
1566
1530
|
typeEncoders.Map = typeEncoders.Object;
|
|
@@ -1630,46 +1594,149 @@ function encodeRfc8949(data) {
|
|
|
1630
1594
|
return encodeCustom(data, cborEncoders, rfc8949EncodeOptions);
|
|
1631
1595
|
}
|
|
1632
1596
|
__name(encodeRfc8949, "encodeRfc8949");
|
|
1633
|
-
function tokensToEncoded(
|
|
1597
|
+
function tokensToEncoded(writer, tokens, encoders, options) {
|
|
1634
1598
|
if (Array.isArray(tokens)) {
|
|
1635
1599
|
for (const token of tokens) {
|
|
1636
|
-
tokensToEncoded(
|
|
1600
|
+
tokensToEncoded(writer, token, encoders, options);
|
|
1637
1601
|
}
|
|
1638
1602
|
} else {
|
|
1639
|
-
encoders[tokens.type.major](
|
|
1603
|
+
encoders[tokens.type.major](writer, tokens, options);
|
|
1640
1604
|
}
|
|
1641
1605
|
}
|
|
1642
1606
|
__name(tokensToEncoded, "tokensToEncoded");
|
|
1643
|
-
|
|
1607
|
+
var MAJOR_UINT = Type.uint.majorEncoded;
|
|
1608
|
+
var MAJOR_NEGINT = Type.negint.majorEncoded;
|
|
1609
|
+
var MAJOR_BYTES = Type.bytes.majorEncoded;
|
|
1610
|
+
var MAJOR_STRING = Type.string.majorEncoded;
|
|
1611
|
+
var MAJOR_ARRAY = Type.array.majorEncoded;
|
|
1612
|
+
var SIMPLE_FALSE = Type.float.majorEncoded | MINOR_FALSE;
|
|
1613
|
+
var SIMPLE_TRUE = Type.float.majorEncoded | MINOR_TRUE;
|
|
1614
|
+
var SIMPLE_NULL = Type.float.majorEncoded | MINOR_NULL;
|
|
1615
|
+
var SIMPLE_UNDEFINED = Type.float.majorEncoded | MINOR_UNDEFINED;
|
|
1616
|
+
var neg1b2 = BigInt(-1);
|
|
1617
|
+
var pos1b2 = BigInt(1);
|
|
1618
|
+
function canDirectEncode(options) {
|
|
1619
|
+
return options.addBreakTokens !== true;
|
|
1620
|
+
}
|
|
1621
|
+
__name(canDirectEncode, "canDirectEncode");
|
|
1622
|
+
function directEncode(writer, data, options, refStack) {
|
|
1623
|
+
const typ = is(data);
|
|
1624
|
+
const customEncoder = options.typeEncoders && options.typeEncoders[typ];
|
|
1625
|
+
if (customEncoder) {
|
|
1626
|
+
const tokens = customEncoder(data, typ, options, refStack);
|
|
1627
|
+
if (tokens != null) {
|
|
1628
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
switch (typ) {
|
|
1633
|
+
case "null":
|
|
1634
|
+
writer.push([SIMPLE_NULL]);
|
|
1635
|
+
return;
|
|
1636
|
+
case "undefined":
|
|
1637
|
+
writer.push([SIMPLE_UNDEFINED]);
|
|
1638
|
+
return;
|
|
1639
|
+
case "boolean":
|
|
1640
|
+
writer.push([data ? SIMPLE_TRUE : SIMPLE_FALSE]);
|
|
1641
|
+
return;
|
|
1642
|
+
case "number":
|
|
1643
|
+
if (!Number.isInteger(data) || !Number.isSafeInteger(data)) {
|
|
1644
|
+
encodeFloat(writer, new Token(Type.float, data), options);
|
|
1645
|
+
} else if (data >= 0) {
|
|
1646
|
+
encodeUintValue(writer, MAJOR_UINT, data);
|
|
1647
|
+
} else {
|
|
1648
|
+
encodeUintValue(writer, MAJOR_NEGINT, data * -1 - 1);
|
|
1649
|
+
}
|
|
1650
|
+
return;
|
|
1651
|
+
case "bigint":
|
|
1652
|
+
if (data >= BigInt(0)) {
|
|
1653
|
+
encodeUintValue(writer, MAJOR_UINT, data);
|
|
1654
|
+
} else {
|
|
1655
|
+
encodeUintValue(writer, MAJOR_NEGINT, data * neg1b2 - pos1b2);
|
|
1656
|
+
}
|
|
1657
|
+
return;
|
|
1658
|
+
case "string": {
|
|
1659
|
+
const bytes = fromString(data);
|
|
1660
|
+
encodeUintValue(writer, MAJOR_STRING, bytes.length);
|
|
1661
|
+
writer.push(bytes);
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
case "Uint8Array":
|
|
1665
|
+
encodeUintValue(writer, MAJOR_BYTES, data.length);
|
|
1666
|
+
writer.push(data);
|
|
1667
|
+
return;
|
|
1668
|
+
case "Array":
|
|
1669
|
+
if (!data.length) {
|
|
1670
|
+
writer.push([MAJOR_ARRAY]);
|
|
1671
|
+
return;
|
|
1672
|
+
}
|
|
1673
|
+
refStack = Ref.createCheck(refStack, data);
|
|
1674
|
+
encodeUintValue(writer, MAJOR_ARRAY, data.length);
|
|
1675
|
+
for (const elem of data) {
|
|
1676
|
+
directEncode(writer, elem, options, refStack);
|
|
1677
|
+
}
|
|
1678
|
+
return;
|
|
1679
|
+
case "Object":
|
|
1680
|
+
case "Map":
|
|
1681
|
+
{
|
|
1682
|
+
const tokens = typeEncoders.Object(data, typ, options, refStack);
|
|
1683
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1684
|
+
}
|
|
1685
|
+
return;
|
|
1686
|
+
default: {
|
|
1687
|
+
const typeEncoder = typeEncoders[typ];
|
|
1688
|
+
if (!typeEncoder) {
|
|
1689
|
+
throw new Error(`${encodeErrPrefix} unsupported type: ${typ}`);
|
|
1690
|
+
}
|
|
1691
|
+
const tokens = typeEncoder(data, typ, options, refStack);
|
|
1692
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
__name(directEncode, "directEncode");
|
|
1697
|
+
function encodeCustom(data, encoders, options, destination) {
|
|
1698
|
+
const hasDest = destination instanceof Uint8Array;
|
|
1699
|
+
let writeTo = hasDest ? new U8Bl(destination) : defaultWriter;
|
|
1644
1700
|
const tokens = objectToTokens(data, options);
|
|
1645
1701
|
if (!Array.isArray(tokens) && options.quickEncodeToken) {
|
|
1646
1702
|
const quickBytes = options.quickEncodeToken(tokens);
|
|
1647
1703
|
if (quickBytes) {
|
|
1704
|
+
if (hasDest) {
|
|
1705
|
+
writeTo.push(quickBytes);
|
|
1706
|
+
return writeTo.toBytes();
|
|
1707
|
+
}
|
|
1648
1708
|
return quickBytes;
|
|
1649
1709
|
}
|
|
1650
1710
|
const encoder = encoders[tokens.type.major];
|
|
1651
1711
|
if (encoder.encodedSize) {
|
|
1652
1712
|
const size = encoder.encodedSize(tokens, options);
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1713
|
+
if (!hasDest) {
|
|
1714
|
+
writeTo = new Bl(size);
|
|
1715
|
+
}
|
|
1716
|
+
encoder(writeTo, tokens, options);
|
|
1717
|
+
if (writeTo.chunks.length !== 1) {
|
|
1656
1718
|
throw new Error(`Unexpected error: pre-calculated length for ${tokens} was wrong`);
|
|
1657
1719
|
}
|
|
1658
|
-
return asU8A(
|
|
1720
|
+
return hasDest ? writeTo.toBytes() : asU8A(writeTo.chunks[0]);
|
|
1659
1721
|
}
|
|
1660
1722
|
}
|
|
1661
|
-
|
|
1662
|
-
tokensToEncoded(
|
|
1663
|
-
return
|
|
1723
|
+
writeTo.reset();
|
|
1724
|
+
tokensToEncoded(writeTo, tokens, encoders, options);
|
|
1725
|
+
return writeTo.toBytes(true);
|
|
1664
1726
|
}
|
|
1665
1727
|
__name(encodeCustom, "encodeCustom");
|
|
1666
1728
|
function encode(data, options) {
|
|
1667
1729
|
options = Object.assign({}, defaultEncodeOptions, options);
|
|
1730
|
+
if (canDirectEncode(options)) {
|
|
1731
|
+
defaultWriter.reset();
|
|
1732
|
+
directEncode(defaultWriter, data, options, void 0);
|
|
1733
|
+
return defaultWriter.toBytes(true);
|
|
1734
|
+
}
|
|
1668
1735
|
return encodeCustom(data, cborEncoders, options);
|
|
1669
1736
|
}
|
|
1670
1737
|
__name(encode, "encode");
|
|
1671
1738
|
|
|
1672
|
-
// ../../../node_modules
|
|
1739
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/decode.js
|
|
1673
1740
|
var defaultDecodeOptions = {
|
|
1674
1741
|
strict: false,
|
|
1675
1742
|
allowIndefinite: true,
|
|
@@ -1731,6 +1798,7 @@ function tokenToArray(token, tokeniser, options) {
|
|
|
1731
1798
|
__name(tokenToArray, "tokenToArray");
|
|
1732
1799
|
function tokenToMap(token, tokeniser, options) {
|
|
1733
1800
|
const useMaps = options.useMaps === true;
|
|
1801
|
+
const rejectDuplicateMapKeys = options.rejectDuplicateMapKeys === true;
|
|
1734
1802
|
const obj = useMaps ? void 0 : {};
|
|
1735
1803
|
const m = useMaps ? /* @__PURE__ */ new Map() : void 0;
|
|
1736
1804
|
for (let i = 0; i < token.value; i++) {
|
|
@@ -1744,11 +1812,11 @@ function tokenToMap(token, tokeniser, options) {
|
|
|
1744
1812
|
if (key === DONE) {
|
|
1745
1813
|
throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no key], expected ${token.value})`);
|
|
1746
1814
|
}
|
|
1747
|
-
if (useMaps
|
|
1815
|
+
if (!useMaps && typeof key !== "string") {
|
|
1748
1816
|
throw new Error(`${decodeErrPrefix} non-string keys not supported (got ${typeof key})`);
|
|
1749
1817
|
}
|
|
1750
|
-
if (
|
|
1751
|
-
if (useMaps && m.has(key) || !useMaps && key
|
|
1818
|
+
if (rejectDuplicateMapKeys) {
|
|
1819
|
+
if (useMaps && m.has(key) || !useMaps && Object.hasOwn(obj, key)) {
|
|
1752
1820
|
throw new Error(`${decodeErrPrefix} found repeat map key "${key}"`);
|
|
1753
1821
|
}
|
|
1754
1822
|
}
|
|
@@ -1770,19 +1838,19 @@ function tokensToObject(tokeniser, options) {
|
|
|
1770
1838
|
return DONE;
|
|
1771
1839
|
}
|
|
1772
1840
|
const token = tokeniser.next();
|
|
1773
|
-
if (token.type
|
|
1841
|
+
if (Type.equals(token.type, Type.break)) {
|
|
1774
1842
|
return BREAK;
|
|
1775
1843
|
}
|
|
1776
1844
|
if (token.type.terminal) {
|
|
1777
1845
|
return token.value;
|
|
1778
1846
|
}
|
|
1779
|
-
if (token.type
|
|
1847
|
+
if (Type.equals(token.type, Type.array)) {
|
|
1780
1848
|
return tokenToArray(token, tokeniser, options);
|
|
1781
1849
|
}
|
|
1782
|
-
if (token.type
|
|
1850
|
+
if (Type.equals(token.type, Type.map)) {
|
|
1783
1851
|
return tokenToMap(token, tokeniser, options);
|
|
1784
1852
|
}
|
|
1785
|
-
if (token.type
|
|
1853
|
+
if (Type.equals(token.type, Type.tag)) {
|
|
1786
1854
|
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
1787
1855
|
const tagged = tokensToObject(tokeniser, options);
|
|
1788
1856
|
return options.tags[token.value](tagged);
|
|
@@ -1797,7 +1865,8 @@ function decodeFirst(data, options) {
|
|
|
1797
1865
|
throw new Error(`${decodeErrPrefix} data to decode must be a Uint8Array`);
|
|
1798
1866
|
}
|
|
1799
1867
|
options = Object.assign({}, defaultDecodeOptions, options);
|
|
1800
|
-
const
|
|
1868
|
+
const u8aData = asU8A(data);
|
|
1869
|
+
const tokeniser = options.tokenizer || new Tokeniser(u8aData, options);
|
|
1801
1870
|
const decoded = tokensToObject(tokeniser, options);
|
|
1802
1871
|
if (decoded === DONE) {
|
|
1803
1872
|
throw new Error(`${decodeErrPrefix} did not find any content to decode`);
|
|
@@ -1817,7 +1886,7 @@ function decode(data, options) {
|
|
|
1817
1886
|
}
|
|
1818
1887
|
__name(decode, "decode");
|
|
1819
1888
|
|
|
1820
|
-
// ../../../node_modules
|
|
1889
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/CborldError.js
|
|
1821
1890
|
var _CborldError = class _CborldError extends Error {
|
|
1822
1891
|
constructor(value, message) {
|
|
1823
1892
|
super();
|
|
@@ -1830,7 +1899,7 @@ var _CborldError = class _CborldError extends Error {
|
|
|
1830
1899
|
__name(_CborldError, "CborldError");
|
|
1831
1900
|
var CborldError = _CborldError;
|
|
1832
1901
|
|
|
1833
|
-
// ../../../node_modules
|
|
1902
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/keywords.js
|
|
1834
1903
|
var KEYWORDS = /* @__PURE__ */ new Map([
|
|
1835
1904
|
// ordered is important, do not change
|
|
1836
1905
|
["@context", 0],
|
|
@@ -1866,7 +1935,7 @@ var KEYWORDS = /* @__PURE__ */ new Map([
|
|
|
1866
1935
|
]);
|
|
1867
1936
|
var FIRST_CUSTOM_TERM_ID = 100;
|
|
1868
1937
|
|
|
1869
|
-
// ../../../node_modules
|
|
1938
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/CborldDecoder.js
|
|
1870
1939
|
var _CborldDecoder = class _CborldDecoder {
|
|
1871
1940
|
// eslint-disable-next-line no-unused-vars
|
|
1872
1941
|
decode({ value } = {}) {
|
|
@@ -1880,7 +1949,7 @@ var _CborldDecoder = class _CborldDecoder {
|
|
|
1880
1949
|
__name(_CborldDecoder, "CborldDecoder");
|
|
1881
1950
|
var CborldDecoder = _CborldDecoder;
|
|
1882
1951
|
|
|
1883
|
-
// ../../../node_modules
|
|
1952
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/registeredContexts.js
|
|
1884
1953
|
var ID_TO_URL = /* @__PURE__ */ new Map();
|
|
1885
1954
|
var URL_TO_ID = /* @__PURE__ */ new Map();
|
|
1886
1955
|
_addRegistration(16, "https://www.w3.org/ns/activitystreams");
|
|
@@ -1910,7 +1979,7 @@ function _addRegistration(id, url) {
|
|
|
1910
1979
|
}
|
|
1911
1980
|
__name(_addRegistration, "_addRegistration");
|
|
1912
1981
|
|
|
1913
|
-
// ../../../node_modules
|
|
1982
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/ContextDecoder.js
|
|
1914
1983
|
var _ContextDecoder = class _ContextDecoder extends CborldDecoder {
|
|
1915
1984
|
constructor({ reverseAppContextMap } = {}) {
|
|
1916
1985
|
super();
|
|
@@ -1951,17 +2020,17 @@ function _mapToObject(map) {
|
|
|
1951
2020
|
}
|
|
1952
2021
|
__name(_mapToObject, "_mapToObject");
|
|
1953
2022
|
|
|
1954
|
-
// ../../../node_modules
|
|
2023
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/util-browser.js
|
|
1955
2024
|
function inspect(data, options) {
|
|
1956
2025
|
return JSON.stringify(data, null, 2);
|
|
1957
2026
|
}
|
|
1958
2027
|
__name(inspect, "inspect");
|
|
1959
2028
|
|
|
1960
|
-
// ../../../node_modules
|
|
1961
|
-
var version = "3.
|
|
2029
|
+
// ../../../node_modules/js-base64/base64.mjs
|
|
2030
|
+
var version = "3.8.0";
|
|
1962
2031
|
var VERSION = version;
|
|
1963
2032
|
var _hasBuffer = typeof Buffer === "function";
|
|
1964
|
-
var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
|
2033
|
+
var _TD = typeof TextDecoder === "function" ? new TextDecoder("utf-8", { ignoreBOM: true }) : void 0;
|
|
1965
2034
|
var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
|
1966
2035
|
var b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
1967
2036
|
var b64chs = Array.prototype.slice.call(b64ch);
|
|
@@ -2119,7 +2188,7 @@ var gBase64 = {
|
|
|
2119
2188
|
extendBuiltins
|
|
2120
2189
|
};
|
|
2121
2190
|
|
|
2122
|
-
// ../../../node_modules
|
|
2191
|
+
// ../../../node_modules/base58-universal/lib/baseN.js
|
|
2123
2192
|
var _reverseAlphabets = {};
|
|
2124
2193
|
function encode3(input, alphabet2, maxline) {
|
|
2125
2194
|
if (!(input instanceof Uint8Array)) {
|
|
@@ -2208,7 +2277,7 @@ function decode3(input, alphabet2) {
|
|
|
2208
2277
|
}
|
|
2209
2278
|
__name(decode3, "decode");
|
|
2210
2279
|
|
|
2211
|
-
// ../../../node_modules
|
|
2280
|
+
// ../../../node_modules/base58-universal/lib/index.js
|
|
2212
2281
|
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2213
2282
|
function encode4(input, maxline) {
|
|
2214
2283
|
return encode3(input, alphabet, maxline);
|
|
@@ -2219,7 +2288,7 @@ function decode4(input) {
|
|
|
2219
2288
|
}
|
|
2220
2289
|
__name(decode4, "decode");
|
|
2221
2290
|
|
|
2222
|
-
// ../../../node_modules
|
|
2291
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseDecoder.js
|
|
2223
2292
|
var _MultibaseDecoder = class _MultibaseDecoder extends CborldDecoder {
|
|
2224
2293
|
decode({ value } = {}) {
|
|
2225
2294
|
const { buffer: buffer2, byteOffset, length } = value;
|
|
@@ -2244,7 +2313,7 @@ var _MultibaseDecoder = class _MultibaseDecoder extends CborldDecoder {
|
|
|
2244
2313
|
__name(_MultibaseDecoder, "MultibaseDecoder");
|
|
2245
2314
|
var MultibaseDecoder = _MultibaseDecoder;
|
|
2246
2315
|
|
|
2247
|
-
// ../../../node_modules
|
|
2316
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Transformer.js
|
|
2248
2317
|
var _Transformer = class _Transformer {
|
|
2249
2318
|
/**
|
|
2250
2319
|
* Creates a new Transformer for transforming CBOR-LD <=> JSON-LD.
|
|
@@ -2624,7 +2693,7 @@ var _Transformer = class _Transformer {
|
|
|
2624
2693
|
__name(_Transformer, "Transformer");
|
|
2625
2694
|
var Transformer = _Transformer;
|
|
2626
2695
|
|
|
2627
|
-
// ../../../node_modules
|
|
2696
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlDecoder.js
|
|
2628
2697
|
var ID_TO_SCHEME = /* @__PURE__ */ new Map([
|
|
2629
2698
|
// Note: only v1 mainnet is supported
|
|
2630
2699
|
[1024, "did:v1:nym:"],
|
|
@@ -2660,7 +2729,7 @@ var _Base58DidUrlDecoder = class _Base58DidUrlDecoder extends CborldDecoder {
|
|
|
2660
2729
|
__name(_Base58DidUrlDecoder, "Base58DidUrlDecoder");
|
|
2661
2730
|
var Base58DidUrlDecoder = _Base58DidUrlDecoder;
|
|
2662
2731
|
|
|
2663
|
-
// ../../../node_modules
|
|
2732
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlDecoder.js
|
|
2664
2733
|
var _HttpUrlDecoder = class _HttpUrlDecoder extends CborldDecoder {
|
|
2665
2734
|
constructor({ secure } = {}) {
|
|
2666
2735
|
super();
|
|
@@ -2680,17 +2749,17 @@ var _HttpUrlDecoder = class _HttpUrlDecoder extends CborldDecoder {
|
|
|
2680
2749
|
__name(_HttpUrlDecoder, "HttpUrlDecoder");
|
|
2681
2750
|
var HttpUrlDecoder = _HttpUrlDecoder;
|
|
2682
2751
|
|
|
2683
|
-
// ../../../node_modules
|
|
2752
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/regex.js
|
|
2684
2753
|
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;
|
|
2685
2754
|
|
|
2686
|
-
// ../../../node_modules
|
|
2755
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/validate.js
|
|
2687
2756
|
function validate(uuid) {
|
|
2688
2757
|
return typeof uuid === "string" && regex_default.test(uuid);
|
|
2689
2758
|
}
|
|
2690
2759
|
__name(validate, "validate");
|
|
2691
2760
|
var validate_default = validate;
|
|
2692
2761
|
|
|
2693
|
-
// ../../../node_modules
|
|
2762
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/stringify.js
|
|
2694
2763
|
var byteToHex = [];
|
|
2695
2764
|
for (let i = 0; i < 256; ++i) {
|
|
2696
2765
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -2709,7 +2778,7 @@ function stringify(arr, offset = 0) {
|
|
|
2709
2778
|
__name(stringify, "stringify");
|
|
2710
2779
|
var stringify_default = stringify;
|
|
2711
2780
|
|
|
2712
|
-
// ../../../node_modules
|
|
2781
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/parse.js
|
|
2713
2782
|
function parse(uuid) {
|
|
2714
2783
|
if (!validate_default(uuid)) {
|
|
2715
2784
|
throw TypeError("Invalid UUID");
|
|
@@ -2737,7 +2806,7 @@ function parse(uuid) {
|
|
|
2737
2806
|
__name(parse, "parse");
|
|
2738
2807
|
var parse_default = parse;
|
|
2739
2808
|
|
|
2740
|
-
// ../../../node_modules
|
|
2809
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnDecoder.js
|
|
2741
2810
|
var _UuidUrnDecoder = class _UuidUrnDecoder extends CborldDecoder {
|
|
2742
2811
|
decode({ value } = {}) {
|
|
2743
2812
|
const uuid = typeof value[1] === "string" ? value[1] : stringify_default(value[1]);
|
|
@@ -2752,7 +2821,7 @@ var _UuidUrnDecoder = class _UuidUrnDecoder extends CborldDecoder {
|
|
|
2752
2821
|
__name(_UuidUrnDecoder, "UuidUrnDecoder");
|
|
2753
2822
|
var UuidUrnDecoder = _UuidUrnDecoder;
|
|
2754
2823
|
|
|
2755
|
-
// ../../../node_modules
|
|
2824
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UriDecoder.js
|
|
2756
2825
|
var SCHEME_ID_TO_DECODER = /* @__PURE__ */ new Map([
|
|
2757
2826
|
[1, HttpUrlDecoder],
|
|
2758
2827
|
[2, HttpUrlDecoder],
|
|
@@ -2772,7 +2841,7 @@ var _UriDecoder = class _UriDecoder extends CborldDecoder {
|
|
|
2772
2841
|
__name(_UriDecoder, "UriDecoder");
|
|
2773
2842
|
var UriDecoder = _UriDecoder;
|
|
2774
2843
|
|
|
2775
|
-
// ../../../node_modules
|
|
2844
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermDecoder.js
|
|
2776
2845
|
var _VocabTermDecoder = class _VocabTermDecoder extends CborldDecoder {
|
|
2777
2846
|
constructor({ term } = {}) {
|
|
2778
2847
|
super();
|
|
@@ -2794,7 +2863,7 @@ var _VocabTermDecoder = class _VocabTermDecoder extends CborldDecoder {
|
|
|
2794
2863
|
__name(_VocabTermDecoder, "VocabTermDecoder");
|
|
2795
2864
|
var VocabTermDecoder = _VocabTermDecoder;
|
|
2796
2865
|
|
|
2797
|
-
// ../../../node_modules
|
|
2866
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateDecoder.js
|
|
2798
2867
|
var _XsdDateDecoder = class _XsdDateDecoder extends CborldDecoder {
|
|
2799
2868
|
decode({ value } = {}) {
|
|
2800
2869
|
const dateString = new Date(value * 1e3).toISOString();
|
|
@@ -2809,7 +2878,7 @@ var _XsdDateDecoder = class _XsdDateDecoder extends CborldDecoder {
|
|
|
2809
2878
|
__name(_XsdDateDecoder, "XsdDateDecoder");
|
|
2810
2879
|
var XsdDateDecoder = _XsdDateDecoder;
|
|
2811
2880
|
|
|
2812
|
-
// ../../../node_modules
|
|
2881
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeDecoder.js
|
|
2813
2882
|
var _XsdDateTimeDecoder = class _XsdDateTimeDecoder extends CborldDecoder {
|
|
2814
2883
|
constructor({ value } = {}) {
|
|
2815
2884
|
super();
|
|
@@ -2833,7 +2902,7 @@ var _XsdDateTimeDecoder = class _XsdDateTimeDecoder extends CborldDecoder {
|
|
|
2833
2902
|
__name(_XsdDateTimeDecoder, "XsdDateTimeDecoder");
|
|
2834
2903
|
var XsdDateTimeDecoder = _XsdDateTimeDecoder;
|
|
2835
2904
|
|
|
2836
|
-
// ../../../node_modules
|
|
2905
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Decompressor.js
|
|
2837
2906
|
var TYPE_DECODERS = /* @__PURE__ */ new Map([
|
|
2838
2907
|
["@id", UriDecoder],
|
|
2839
2908
|
["@vocab", VocabTermDecoder],
|
|
@@ -3050,7 +3119,7 @@ function _sortEntriesByTerm([{ term: t1 }], [{ term: t2 }]) {
|
|
|
3050
3119
|
}
|
|
3051
3120
|
__name(_sortEntriesByTerm, "_sortEntriesByTerm");
|
|
3052
3121
|
|
|
3053
|
-
// ../../../node_modules
|
|
3122
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/decode.js
|
|
3054
3123
|
async function decode5({
|
|
3055
3124
|
cborldBytes,
|
|
3056
3125
|
documentLoader,
|
|
@@ -3104,7 +3173,7 @@ async function decode5({
|
|
|
3104
3173
|
}
|
|
3105
3174
|
__name(decode5, "decode");
|
|
3106
3175
|
|
|
3107
|
-
// ../../../node_modules
|
|
3176
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/CborldEncoder.js
|
|
3108
3177
|
var _CborldEncoder = class _CborldEncoder {
|
|
3109
3178
|
encode() {
|
|
3110
3179
|
throw new Error("Must be implemented by derived class.");
|
|
@@ -3117,7 +3186,7 @@ var _CborldEncoder = class _CborldEncoder {
|
|
|
3117
3186
|
__name(_CborldEncoder, "CborldEncoder");
|
|
3118
3187
|
var CborldEncoder = _CborldEncoder;
|
|
3119
3188
|
|
|
3120
|
-
// ../../../node_modules
|
|
3189
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/ContextEncoder.js
|
|
3121
3190
|
var _ContextEncoder = class _ContextEncoder extends CborldEncoder {
|
|
3122
3191
|
constructor({ context, appContextMap } = {}) {
|
|
3123
3192
|
super();
|
|
@@ -3143,7 +3212,7 @@ var _ContextEncoder = class _ContextEncoder extends CborldEncoder {
|
|
|
3143
3212
|
__name(_ContextEncoder, "ContextEncoder");
|
|
3144
3213
|
var ContextEncoder = _ContextEncoder;
|
|
3145
3214
|
|
|
3146
|
-
// ../../../node_modules
|
|
3215
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseEncoder.js
|
|
3147
3216
|
var _MultibaseEncoder = class _MultibaseEncoder extends CborldEncoder {
|
|
3148
3217
|
constructor({ value } = {}) {
|
|
3149
3218
|
super();
|
|
@@ -3177,7 +3246,7 @@ var _MultibaseEncoder = class _MultibaseEncoder extends CborldEncoder {
|
|
|
3177
3246
|
__name(_MultibaseEncoder, "MultibaseEncoder");
|
|
3178
3247
|
var MultibaseEncoder = _MultibaseEncoder;
|
|
3179
3248
|
|
|
3180
|
-
// ../../../node_modules
|
|
3249
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlEncoder.js
|
|
3181
3250
|
var SCHEME_TO_ID = /* @__PURE__ */ new Map([
|
|
3182
3251
|
["did:v1:nym:", 1024],
|
|
3183
3252
|
["did:key:", 1025]
|
|
@@ -3223,7 +3292,7 @@ function _multibase58ToToken(str) {
|
|
|
3223
3292
|
}
|
|
3224
3293
|
__name(_multibase58ToToken, "_multibase58ToToken");
|
|
3225
3294
|
|
|
3226
|
-
// ../../../node_modules
|
|
3295
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlEncoder.js
|
|
3227
3296
|
var _HttpUrlEncoder = class _HttpUrlEncoder extends CborldEncoder {
|
|
3228
3297
|
constructor({ value, secure } = {}) {
|
|
3229
3298
|
super();
|
|
@@ -3251,7 +3320,7 @@ var _HttpUrlEncoder = class _HttpUrlEncoder extends CborldEncoder {
|
|
|
3251
3320
|
__name(_HttpUrlEncoder, "HttpUrlEncoder");
|
|
3252
3321
|
var HttpUrlEncoder = _HttpUrlEncoder;
|
|
3253
3322
|
|
|
3254
|
-
// ../../../node_modules
|
|
3323
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnEncoder.js
|
|
3255
3324
|
var _UuidUrnEncoder = class _UuidUrnEncoder extends CborldEncoder {
|
|
3256
3325
|
constructor({ value } = {}) {
|
|
3257
3326
|
super();
|
|
@@ -3278,7 +3347,7 @@ var _UuidUrnEncoder = class _UuidUrnEncoder extends CborldEncoder {
|
|
|
3278
3347
|
__name(_UuidUrnEncoder, "UuidUrnEncoder");
|
|
3279
3348
|
var UuidUrnEncoder = _UuidUrnEncoder;
|
|
3280
3349
|
|
|
3281
|
-
// ../../../node_modules
|
|
3350
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UriEncoder.js
|
|
3282
3351
|
var SCHEME_TO_ENCODER = /* @__PURE__ */ new Map([
|
|
3283
3352
|
["http", HttpUrlEncoder],
|
|
3284
3353
|
["https", HttpUrlEncoder],
|
|
@@ -3311,7 +3380,7 @@ var _UriEncoder = class _UriEncoder extends CborldEncoder {
|
|
|
3311
3380
|
__name(_UriEncoder, "UriEncoder");
|
|
3312
3381
|
var UriEncoder = _UriEncoder;
|
|
3313
3382
|
|
|
3314
|
-
// ../../../node_modules
|
|
3383
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermEncoder.js
|
|
3315
3384
|
var _VocabTermEncoder = class _VocabTermEncoder extends CborldEncoder {
|
|
3316
3385
|
constructor({ termId } = {}) {
|
|
3317
3386
|
super();
|
|
@@ -3332,7 +3401,7 @@ var _VocabTermEncoder = class _VocabTermEncoder extends CborldEncoder {
|
|
|
3332
3401
|
__name(_VocabTermEncoder, "VocabTermEncoder");
|
|
3333
3402
|
var VocabTermEncoder = _VocabTermEncoder;
|
|
3334
3403
|
|
|
3335
|
-
// ../../../node_modules
|
|
3404
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateEncoder.js
|
|
3336
3405
|
var _XsdDateEncoder = class _XsdDateEncoder extends CborldEncoder {
|
|
3337
3406
|
constructor({ value, parsed } = {}) {
|
|
3338
3407
|
super();
|
|
@@ -3363,7 +3432,7 @@ var _XsdDateEncoder = class _XsdDateEncoder extends CborldEncoder {
|
|
|
3363
3432
|
__name(_XsdDateEncoder, "XsdDateEncoder");
|
|
3364
3433
|
var XsdDateEncoder = _XsdDateEncoder;
|
|
3365
3434
|
|
|
3366
|
-
// ../../../node_modules
|
|
3435
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeEncoder.js
|
|
3367
3436
|
var _XsdDateTimeEncoder = class _XsdDateTimeEncoder extends CborldEncoder {
|
|
3368
3437
|
constructor({ value, parsed } = {}) {
|
|
3369
3438
|
super();
|
|
@@ -3411,7 +3480,7 @@ var _XsdDateTimeEncoder = class _XsdDateTimeEncoder extends CborldEncoder {
|
|
|
3411
3480
|
__name(_XsdDateTimeEncoder, "XsdDateTimeEncoder");
|
|
3412
3481
|
var XsdDateTimeEncoder = _XsdDateTimeEncoder;
|
|
3413
3482
|
|
|
3414
|
-
// ../../../node_modules
|
|
3483
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Compressor.js
|
|
3415
3484
|
var TYPE_ENCODERS = /* @__PURE__ */ new Map([
|
|
3416
3485
|
["@id", UriEncoder],
|
|
3417
3486
|
["@vocab", VocabTermEncoder],
|
|
@@ -3567,7 +3636,7 @@ var _Compressor = class _Compressor extends Transformer {
|
|
|
3567
3636
|
__name(_Compressor, "Compressor");
|
|
3568
3637
|
var Compressor = _Compressor;
|
|
3569
3638
|
|
|
3570
|
-
// ../../../node_modules
|
|
3639
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/encode.js
|
|
3571
3640
|
async function encode5({
|
|
3572
3641
|
jsonldDocument,
|
|
3573
3642
|
documentLoader,
|
|
@@ -3600,7 +3669,7 @@ async function encode5({
|
|
|
3600
3669
|
}
|
|
3601
3670
|
__name(encode5, "encode");
|
|
3602
3671
|
|
|
3603
|
-
// ../../../node_modules
|
|
3672
|
+
// ../../../node_modules/to-data-view/index.js
|
|
3604
3673
|
function toDataView(data) {
|
|
3605
3674
|
if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray) {
|
|
3606
3675
|
return new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
@@ -3612,7 +3681,7 @@ function toDataView(data) {
|
|
|
3612
3681
|
}
|
|
3613
3682
|
__name(toDataView, "toDataView");
|
|
3614
3683
|
|
|
3615
|
-
// ../../../node_modules
|
|
3684
|
+
// ../../../node_modules/base32-encode/index.js
|
|
3616
3685
|
var RFC4648 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
3617
3686
|
var RFC4648_HEX = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
3618
3687
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
@@ -3661,10 +3730,10 @@ function base32Encode(data, variant, options) {
|
|
|
3661
3730
|
}
|
|
3662
3731
|
__name(base32Encode, "base32Encode");
|
|
3663
3732
|
|
|
3664
|
-
// ../../../node_modules
|
|
3733
|
+
// ../../../node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
|
3665
3734
|
var import_base32_decode = __toESM(require_base32_decode(), 1);
|
|
3666
3735
|
|
|
3667
|
-
// ../../../node_modules
|
|
3736
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/Mode.js
|
|
3668
3737
|
var Mode;
|
|
3669
3738
|
(function(Mode2) {
|
|
3670
3739
|
Mode2[Mode2["Terminator"] = 0] = "Terminator";
|
|
@@ -3676,7 +3745,7 @@ var Mode;
|
|
|
3676
3745
|
Mode2[Mode2["ECI"] = 7] = "ECI";
|
|
3677
3746
|
})(Mode || (Mode = {}));
|
|
3678
3747
|
|
|
3679
|
-
// ../../../node_modules
|
|
3748
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRData.js
|
|
3680
3749
|
var _QRData = class _QRData {
|
|
3681
3750
|
constructor(mode, data) {
|
|
3682
3751
|
this.bytes = [];
|
|
@@ -3736,7 +3805,7 @@ var _QRData = class _QRData {
|
|
|
3736
3805
|
__name(_QRData, "QRData");
|
|
3737
3806
|
var QRData = _QRData;
|
|
3738
3807
|
|
|
3739
|
-
// ../../../node_modules
|
|
3808
|
+
// ../../../node_modules/@nuintun/qrcode/esm/encoding/UTF8.js
|
|
3740
3809
|
function encode6(text) {
|
|
3741
3810
|
let pos = 0;
|
|
3742
3811
|
const { length } = text;
|
|
@@ -3764,7 +3833,7 @@ function encode6(text) {
|
|
|
3764
3833
|
}
|
|
3765
3834
|
__name(encode6, "encode");
|
|
3766
3835
|
|
|
3767
|
-
// ../../../node_modules
|
|
3836
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRByte.js
|
|
3768
3837
|
var _QRByte = class _QRByte extends QRData {
|
|
3769
3838
|
/**
|
|
3770
3839
|
* @constructor
|
|
@@ -3797,7 +3866,7 @@ var _QRByte = class _QRByte extends QRData {
|
|
|
3797
3866
|
__name(_QRByte, "QRByte");
|
|
3798
3867
|
var QRByte = _QRByte;
|
|
3799
3868
|
|
|
3800
|
-
// ../../../node_modules
|
|
3869
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRMath.js
|
|
3801
3870
|
var EXP_TABLE = [];
|
|
3802
3871
|
var LOG_TABLE = [];
|
|
3803
3872
|
for (let i = 0; i < 256; i++) {
|
|
@@ -3825,7 +3894,7 @@ function gexp(n) {
|
|
|
3825
3894
|
}
|
|
3826
3895
|
__name(gexp, "gexp");
|
|
3827
3896
|
|
|
3828
|
-
// ../../../node_modules
|
|
3897
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/Polynomial.js
|
|
3829
3898
|
var _Polynomial = class _Polynomial {
|
|
3830
3899
|
constructor(num, shift = 0) {
|
|
3831
3900
|
let offset = 0;
|
|
@@ -3884,7 +3953,7 @@ var _Polynomial = class _Polynomial {
|
|
|
3884
3953
|
__name(_Polynomial, "Polynomial");
|
|
3885
3954
|
var Polynomial = _Polynomial;
|
|
3886
3955
|
|
|
3887
|
-
// ../../../node_modules
|
|
3956
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRUtil.js
|
|
3888
3957
|
var N1 = 3;
|
|
3889
3958
|
var N2 = 3;
|
|
3890
3959
|
var N3 = 40;
|
|
@@ -4063,7 +4132,7 @@ function calculateMaskPenalty(qrcode) {
|
|
|
4063
4132
|
}
|
|
4064
4133
|
__name(calculateMaskPenalty, "calculateMaskPenalty");
|
|
4065
4134
|
|
|
4066
|
-
// ../../../node_modules
|
|
4135
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/ErrorCorrectionLevel.js
|
|
4067
4136
|
var ErrorCorrectionLevel;
|
|
4068
4137
|
(function(ErrorCorrectionLevel2) {
|
|
4069
4138
|
ErrorCorrectionLevel2[ErrorCorrectionLevel2["L"] = 1] = "L";
|
|
@@ -4072,7 +4141,7 @@ var ErrorCorrectionLevel;
|
|
|
4072
4141
|
ErrorCorrectionLevel2[ErrorCorrectionLevel2["H"] = 2] = "H";
|
|
4073
4142
|
})(ErrorCorrectionLevel || (ErrorCorrectionLevel = {}));
|
|
4074
4143
|
|
|
4075
|
-
// ../../../node_modules
|
|
4144
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/RSBlock.js
|
|
4076
4145
|
var _RSBlock = class _RSBlock {
|
|
4077
4146
|
constructor(totalCount, dataCount) {
|
|
4078
4147
|
this.dataCount = dataCount;
|
|
@@ -4322,7 +4391,7 @@ RSBlock.RS_BLOCK_TABLE = [
|
|
|
4322
4391
|
[20, 45, 15, 61, 46, 16]
|
|
4323
4392
|
];
|
|
4324
4393
|
|
|
4325
|
-
// ../../../node_modules
|
|
4394
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/BitBuffer.js
|
|
4326
4395
|
var _BitBuffer = class _BitBuffer {
|
|
4327
4396
|
constructor() {
|
|
4328
4397
|
this.length = 0;
|
|
@@ -4356,7 +4425,7 @@ var _BitBuffer = class _BitBuffer {
|
|
|
4356
4425
|
__name(_BitBuffer, "BitBuffer");
|
|
4357
4426
|
var BitBuffer = _BitBuffer;
|
|
4358
4427
|
|
|
4359
|
-
// ../../../node_modules
|
|
4428
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/Dict.js
|
|
4360
4429
|
var MAX_CODE = (1 << 12) - 1;
|
|
4361
4430
|
var _Dict = class _Dict {
|
|
4362
4431
|
constructor(depth) {
|
|
@@ -4396,7 +4465,7 @@ var _Dict = class _Dict {
|
|
|
4396
4465
|
__name(_Dict, "Dict");
|
|
4397
4466
|
var Dict = _Dict;
|
|
4398
4467
|
|
|
4399
|
-
// ../../../node_modules
|
|
4468
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/DictStream.js
|
|
4400
4469
|
var _DictStream = class _DictStream {
|
|
4401
4470
|
constructor(dict) {
|
|
4402
4471
|
this.bits = 0;
|
|
@@ -4442,7 +4511,7 @@ var _DictStream = class _DictStream {
|
|
|
4442
4511
|
__name(_DictStream, "DictStream");
|
|
4443
4512
|
var DictStream = _DictStream;
|
|
4444
4513
|
|
|
4445
|
-
// ../../../node_modules
|
|
4514
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/index.js
|
|
4446
4515
|
function compress(pixels, depth, stream) {
|
|
4447
4516
|
const dict = new Dict(depth);
|
|
4448
4517
|
const buffer2 = new DictStream(dict);
|
|
@@ -4471,7 +4540,7 @@ function compress(pixels, depth, stream) {
|
|
|
4471
4540
|
}
|
|
4472
4541
|
__name(compress, "compress");
|
|
4473
4542
|
|
|
4474
|
-
// ../../../node_modules
|
|
4543
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/ByteStream.js
|
|
4475
4544
|
var _ByteStream = class _ByteStream {
|
|
4476
4545
|
constructor() {
|
|
4477
4546
|
this.bytes = [];
|
|
@@ -4492,7 +4561,7 @@ var _ByteStream = class _ByteStream {
|
|
|
4492
4561
|
__name(_ByteStream, "ByteStream");
|
|
4493
4562
|
var ByteStream = _ByteStream;
|
|
4494
4563
|
|
|
4495
|
-
// ../../../node_modules
|
|
4564
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/Base64Stream.js
|
|
4496
4565
|
var { fromCharCode } = String;
|
|
4497
4566
|
function encode7(byte) {
|
|
4498
4567
|
byte &= 63;
|
|
@@ -4552,7 +4621,7 @@ var _Base64Stream = class _Base64Stream {
|
|
|
4552
4621
|
__name(_Base64Stream, "Base64Stream");
|
|
4553
4622
|
var Base64Stream = _Base64Stream;
|
|
4554
4623
|
|
|
4555
|
-
// ../../../node_modules
|
|
4624
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/GIFImage.js
|
|
4556
4625
|
var _GIFImage = class _GIFImage {
|
|
4557
4626
|
constructor(width, height, { foreground = [0, 0, 0], background = [255, 255, 255] } = {}) {
|
|
4558
4627
|
this.pixels = [];
|
|
@@ -4601,7 +4670,7 @@ var _GIFImage = class _GIFImage {
|
|
|
4601
4670
|
__name(_GIFImage, "GIFImage");
|
|
4602
4671
|
var GIFImage = _GIFImage;
|
|
4603
4672
|
|
|
4604
|
-
// ../../../node_modules
|
|
4673
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/MaskPattern.js
|
|
4605
4674
|
function getMaskFunc(maskPattern) {
|
|
4606
4675
|
switch (maskPattern) {
|
|
4607
4676
|
case 0:
|
|
@@ -4626,10 +4695,10 @@ function getMaskFunc(maskPattern) {
|
|
|
4626
4695
|
}
|
|
4627
4696
|
__name(getMaskFunc, "getMaskFunc");
|
|
4628
4697
|
|
|
4629
|
-
// ../../../node_modules
|
|
4698
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/Writer.js
|
|
4630
4699
|
var PAD0 = 236;
|
|
4631
4700
|
var PAD1 = 17;
|
|
4632
|
-
var { toString
|
|
4701
|
+
var { toString } = Object.prototype;
|
|
4633
4702
|
function appendECI(encoding, buffer2) {
|
|
4634
4703
|
if (encoding < 0 || encoding >= 1e6) {
|
|
4635
4704
|
throw new Error("byte mode encoding hint out of range");
|
|
@@ -4831,7 +4900,7 @@ var _Encoder = class _Encoder {
|
|
|
4831
4900
|
if (data instanceof QRData) {
|
|
4832
4901
|
chunks.push(data);
|
|
4833
4902
|
} else {
|
|
4834
|
-
const type =
|
|
4903
|
+
const type = toString.call(data);
|
|
4835
4904
|
if (type === "[object String]") {
|
|
4836
4905
|
chunks.push(new QRByte(data));
|
|
4837
4906
|
} else {
|
|
@@ -5069,7 +5138,7 @@ var _Encoder = class _Encoder {
|
|
|
5069
5138
|
__name(_Encoder, "Encoder");
|
|
5070
5139
|
var Encoder = _Encoder;
|
|
5071
5140
|
|
|
5072
|
-
// ../../../node_modules
|
|
5141
|
+
// ../../../node_modules/@nuintun/qrcode/esm/encoding/UTF16.js
|
|
5073
5142
|
function encode8(text) {
|
|
5074
5143
|
const { length } = text;
|
|
5075
5144
|
const bytes = [];
|
|
@@ -5080,7 +5149,7 @@ function encode8(text) {
|
|
|
5080
5149
|
}
|
|
5081
5150
|
__name(encode8, "encode");
|
|
5082
5151
|
|
|
5083
|
-
// ../../../node_modules
|
|
5152
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRAlphanumeric.js
|
|
5084
5153
|
function getByte(byte) {
|
|
5085
5154
|
if (48 <= byte && byte <= 57) {
|
|
5086
5155
|
return byte - 48;
|
|
@@ -5151,7 +5220,7 @@ var _QRAlphanumeric = class _QRAlphanumeric extends QRData {
|
|
|
5151
5220
|
__name(_QRAlphanumeric, "QRAlphanumeric");
|
|
5152
5221
|
var QRAlphanumeric = _QRAlphanumeric;
|
|
5153
5222
|
|
|
5154
|
-
// ../../../node_modules
|
|
5223
|
+
// ../../../node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
|
5155
5224
|
var VP_QR_VERSION = "VP1";
|
|
5156
5225
|
var BASE_32_UPPERCASE_MULTIBASE_PREFIX = "B";
|
|
5157
5226
|
function _bytesToQrCodeDataUrl({ bytes, size }) {
|