@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
|
@@ -31,9 +31,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
));
|
|
32
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
33
|
|
|
34
|
-
// ../../../node_modules
|
|
34
|
+
// ../../../node_modules/base32-decode/index.js
|
|
35
35
|
var require_base32_decode = __commonJS({
|
|
36
|
-
"../../../node_modules
|
|
36
|
+
"../../../node_modules/base32-decode/index.js"(exports, module2) {
|
|
37
37
|
"use strict";
|
|
38
38
|
var RFC46482 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
39
39
|
var RFC4648_HEX2 = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
@@ -90,24 +90,10 @@ __export(index_exports, {
|
|
|
90
90
|
});
|
|
91
91
|
module.exports = __toCommonJS(index_exports);
|
|
92
92
|
|
|
93
|
-
// ../../../node_modules
|
|
94
|
-
var typeofs = [
|
|
95
|
-
"string",
|
|
96
|
-
"number",
|
|
97
|
-
"bigint",
|
|
98
|
-
"symbol"
|
|
99
|
-
];
|
|
93
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/is.js
|
|
100
94
|
var objectTypeNames = [
|
|
101
|
-
"Function",
|
|
102
|
-
"Generator",
|
|
103
|
-
"AsyncGenerator",
|
|
104
|
-
"GeneratorFunction",
|
|
105
|
-
"AsyncGeneratorFunction",
|
|
106
|
-
"AsyncFunction",
|
|
107
|
-
"Observable",
|
|
108
|
-
"Array",
|
|
109
|
-
"Buffer",
|
|
110
95
|
"Object",
|
|
96
|
+
// for Object.create(null) and other non-plain objects
|
|
111
97
|
"RegExp",
|
|
112
98
|
"Date",
|
|
113
99
|
"Error",
|
|
@@ -122,7 +108,6 @@ var objectTypeNames = [
|
|
|
122
108
|
"URL",
|
|
123
109
|
"HTMLElement",
|
|
124
110
|
"Int8Array",
|
|
125
|
-
"Uint8Array",
|
|
126
111
|
"Uint8ClampedArray",
|
|
127
112
|
"Int16Array",
|
|
128
113
|
"Uint16Array",
|
|
@@ -144,7 +129,7 @@ function is(value) {
|
|
|
144
129
|
return "boolean";
|
|
145
130
|
}
|
|
146
131
|
const typeOf = typeof value;
|
|
147
|
-
if (
|
|
132
|
+
if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") {
|
|
148
133
|
return typeOf;
|
|
149
134
|
}
|
|
150
135
|
if (typeOf === "function") {
|
|
@@ -153,8 +138,11 @@ function is(value) {
|
|
|
153
138
|
if (Array.isArray(value)) {
|
|
154
139
|
return "Array";
|
|
155
140
|
}
|
|
156
|
-
if (
|
|
157
|
-
return "
|
|
141
|
+
if (value instanceof Uint8Array) {
|
|
142
|
+
return "Uint8Array";
|
|
143
|
+
}
|
|
144
|
+
if (value.constructor === Object) {
|
|
145
|
+
return "Object";
|
|
158
146
|
}
|
|
159
147
|
const objectType = getObjectType(value);
|
|
160
148
|
if (objectType) {
|
|
@@ -163,10 +151,6 @@ function is(value) {
|
|
|
163
151
|
return "Object";
|
|
164
152
|
}
|
|
165
153
|
__name(is, "is");
|
|
166
|
-
function isBuffer(value) {
|
|
167
|
-
return value && value.constructor && value.constructor.isBuffer && value.constructor.isBuffer.call(null, value);
|
|
168
|
-
}
|
|
169
|
-
__name(isBuffer, "isBuffer");
|
|
170
154
|
function getObjectType(value) {
|
|
171
155
|
const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
|
|
172
156
|
if (objectTypeNames.includes(objectTypeName)) {
|
|
@@ -176,7 +160,7 @@ function getObjectType(value) {
|
|
|
176
160
|
}
|
|
177
161
|
__name(getObjectType, "getObjectType");
|
|
178
162
|
|
|
179
|
-
// ../../../node_modules
|
|
163
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/token.js
|
|
180
164
|
var _Type = class _Type {
|
|
181
165
|
/**
|
|
182
166
|
* @param {number} major
|
|
@@ -200,6 +184,17 @@ var _Type = class _Type {
|
|
|
200
184
|
compare(typ) {
|
|
201
185
|
return this.major < typ.major ? -1 : this.major > typ.major ? 1 : 0;
|
|
202
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Check equality between two Type instances. Safe to use across different
|
|
189
|
+
* copies of the Type class (e.g., when bundlers duplicate the module).
|
|
190
|
+
* (major, name) uniquely identifies a Type; terminal is implied by these.
|
|
191
|
+
* @param {Type} a
|
|
192
|
+
* @param {Type} b
|
|
193
|
+
* @returns {boolean}
|
|
194
|
+
*/
|
|
195
|
+
static equals(a, b) {
|
|
196
|
+
return a === b || a.major === b.major && a.name === b.name;
|
|
197
|
+
}
|
|
203
198
|
};
|
|
204
199
|
__name(_Type, "Type");
|
|
205
200
|
var Type = _Type;
|
|
@@ -237,56 +232,32 @@ var _Token = class _Token {
|
|
|
237
232
|
__name(_Token, "Token");
|
|
238
233
|
var Token = _Token;
|
|
239
234
|
|
|
240
|
-
// ../../../node_modules
|
|
235
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/byte-utils.js
|
|
241
236
|
var useBuffer = globalThis.process && // @ts-ignore
|
|
242
237
|
!globalThis.process.browser && // @ts-ignore
|
|
243
238
|
globalThis.Buffer && // @ts-ignore
|
|
244
239
|
typeof globalThis.Buffer.isBuffer === "function";
|
|
245
|
-
var textDecoder = new TextDecoder();
|
|
246
240
|
var textEncoder = new TextEncoder();
|
|
247
|
-
function
|
|
248
|
-
return useBuffer && globalThis.Buffer.isBuffer(
|
|
241
|
+
function isBuffer(buf) {
|
|
242
|
+
return useBuffer && globalThis.Buffer.isBuffer(buf);
|
|
249
243
|
}
|
|
250
|
-
__name(
|
|
251
|
-
function asU8A(
|
|
252
|
-
if (!(
|
|
253
|
-
return Uint8Array.from(
|
|
244
|
+
__name(isBuffer, "isBuffer");
|
|
245
|
+
function asU8A(buf) {
|
|
246
|
+
if (!(buf instanceof Uint8Array)) {
|
|
247
|
+
return Uint8Array.from(buf);
|
|
254
248
|
}
|
|
255
|
-
return
|
|
249
|
+
return isBuffer(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
|
|
256
250
|
}
|
|
257
251
|
__name(asU8A, "asU8A");
|
|
258
|
-
var
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* @param {Uint8Array} bytes
|
|
262
|
-
* @param {number} start
|
|
263
|
-
* @param {number} end
|
|
264
|
-
*/
|
|
265
|
-
(bytes, start, end) => {
|
|
266
|
-
return end - start > 64 ? (
|
|
267
|
-
// eslint-disable-line operator-linebreak
|
|
268
|
-
// @ts-ignore
|
|
269
|
-
globalThis.Buffer.from(bytes.subarray(start, end)).toString("utf8")
|
|
270
|
-
) : utf8Slice(bytes, start, end);
|
|
271
|
-
}
|
|
272
|
-
) : (
|
|
273
|
-
// eslint-disable-line operator-linebreak
|
|
274
|
-
/**
|
|
275
|
-
* @param {Uint8Array} bytes
|
|
276
|
-
* @param {number} start
|
|
277
|
-
* @param {number} end
|
|
278
|
-
*/
|
|
279
|
-
(bytes, start, end) => {
|
|
280
|
-
return end - start > 64 ? textDecoder.decode(bytes.subarray(start, end)) : utf8Slice(bytes, start, end);
|
|
281
|
-
}
|
|
282
|
-
);
|
|
252
|
+
var FROM_STRING_THRESHOLD_BUFFER = 24;
|
|
253
|
+
var FROM_STRING_THRESHOLD_TEXTENCODER = 200;
|
|
283
254
|
var fromString = useBuffer ? (
|
|
284
255
|
// eslint-disable-line operator-linebreak
|
|
285
256
|
/**
|
|
286
257
|
* @param {string} string
|
|
287
258
|
*/
|
|
288
259
|
(string) => {
|
|
289
|
-
return string.length
|
|
260
|
+
return string.length >= FROM_STRING_THRESHOLD_BUFFER ? (
|
|
290
261
|
// eslint-disable-line operator-linebreak
|
|
291
262
|
// @ts-ignore
|
|
292
263
|
globalThis.Buffer.from(string)
|
|
@@ -298,7 +269,7 @@ var fromString = useBuffer ? (
|
|
|
298
269
|
* @param {string} string
|
|
299
270
|
*/
|
|
300
271
|
(string) => {
|
|
301
|
-
return string.length
|
|
272
|
+
return string.length >= FROM_STRING_THRESHOLD_TEXTENCODER ? textEncoder.encode(string) : utf8ToBytes(string);
|
|
302
273
|
}
|
|
303
274
|
);
|
|
304
275
|
var fromArray = /* @__PURE__ */ __name((arr) => {
|
|
@@ -311,8 +282,9 @@ var slice = useBuffer ? (
|
|
|
311
282
|
* @param {number} start
|
|
312
283
|
* @param {number} end
|
|
313
284
|
*/
|
|
285
|
+
// Buffer.slice() returns a view, not a copy, so we need special handling
|
|
314
286
|
(bytes, start, end) => {
|
|
315
|
-
if (
|
|
287
|
+
if (isBuffer(bytes)) {
|
|
316
288
|
return new Uint8Array(bytes.subarray(start, end));
|
|
317
289
|
}
|
|
318
290
|
return bytes.slice(start, end);
|
|
@@ -383,7 +355,7 @@ var alloc = useBuffer ? (
|
|
|
383
355
|
}
|
|
384
356
|
);
|
|
385
357
|
function compare(b1, b2) {
|
|
386
|
-
if (
|
|
358
|
+
if (isBuffer(b1) && isBuffer(b2)) {
|
|
387
359
|
return b1.compare(b2);
|
|
388
360
|
}
|
|
389
361
|
for (let i = 0; i < b1.length; i++) {
|
|
@@ -412,6 +384,9 @@ function utf8ToBytes(str) {
|
|
|
412
384
|
out[p++] = c >> 6 & 63 | 128;
|
|
413
385
|
out[p++] = c & 63 | 128;
|
|
414
386
|
} else {
|
|
387
|
+
if (c >= 55296 && c <= 57343) {
|
|
388
|
+
c = 65533;
|
|
389
|
+
}
|
|
415
390
|
out[p++] = c >> 12 | 224;
|
|
416
391
|
out[p++] = c >> 6 & 63 | 128;
|
|
417
392
|
out[p++] = c & 63 | 128;
|
|
@@ -420,84 +395,8 @@ function utf8ToBytes(str) {
|
|
|
420
395
|
return out;
|
|
421
396
|
}
|
|
422
397
|
__name(utf8ToBytes, "utf8ToBytes");
|
|
423
|
-
function utf8Slice(buf2, offset, end) {
|
|
424
|
-
const res = [];
|
|
425
|
-
while (offset < end) {
|
|
426
|
-
const firstByte = buf2[offset];
|
|
427
|
-
let codePoint = null;
|
|
428
|
-
let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
429
|
-
if (offset + bytesPerSequence <= end) {
|
|
430
|
-
let secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
431
|
-
switch (bytesPerSequence) {
|
|
432
|
-
case 1:
|
|
433
|
-
if (firstByte < 128) {
|
|
434
|
-
codePoint = firstByte;
|
|
435
|
-
}
|
|
436
|
-
break;
|
|
437
|
-
case 2:
|
|
438
|
-
secondByte = buf2[offset + 1];
|
|
439
|
-
if ((secondByte & 192) === 128) {
|
|
440
|
-
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
441
|
-
if (tempCodePoint > 127) {
|
|
442
|
-
codePoint = tempCodePoint;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
break;
|
|
446
|
-
case 3:
|
|
447
|
-
secondByte = buf2[offset + 1];
|
|
448
|
-
thirdByte = buf2[offset + 2];
|
|
449
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
450
|
-
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
451
|
-
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
452
|
-
codePoint = tempCodePoint;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
break;
|
|
456
|
-
case 4:
|
|
457
|
-
secondByte = buf2[offset + 1];
|
|
458
|
-
thirdByte = buf2[offset + 2];
|
|
459
|
-
fourthByte = buf2[offset + 3];
|
|
460
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
461
|
-
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
462
|
-
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
463
|
-
codePoint = tempCodePoint;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
if (codePoint === null) {
|
|
469
|
-
codePoint = 65533;
|
|
470
|
-
bytesPerSequence = 1;
|
|
471
|
-
} else if (codePoint > 65535) {
|
|
472
|
-
codePoint -= 65536;
|
|
473
|
-
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
474
|
-
codePoint = 56320 | codePoint & 1023;
|
|
475
|
-
}
|
|
476
|
-
res.push(codePoint);
|
|
477
|
-
offset += bytesPerSequence;
|
|
478
|
-
}
|
|
479
|
-
return decodeCodePointsArray(res);
|
|
480
|
-
}
|
|
481
|
-
__name(utf8Slice, "utf8Slice");
|
|
482
|
-
var MAX_ARGUMENTS_LENGTH = 4096;
|
|
483
|
-
function decodeCodePointsArray(codePoints) {
|
|
484
|
-
const len = codePoints.length;
|
|
485
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
486
|
-
return String.fromCharCode.apply(String, codePoints);
|
|
487
|
-
}
|
|
488
|
-
let res = "";
|
|
489
|
-
let i = 0;
|
|
490
|
-
while (i < len) {
|
|
491
|
-
res += String.fromCharCode.apply(
|
|
492
|
-
String,
|
|
493
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
494
|
-
);
|
|
495
|
-
}
|
|
496
|
-
return res;
|
|
497
|
-
}
|
|
498
|
-
__name(decodeCodePointsArray, "decodeCodePointsArray");
|
|
499
398
|
|
|
500
|
-
// ../../../node_modules
|
|
399
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/bl.js
|
|
501
400
|
var defaultChunkSize = 256;
|
|
502
401
|
var _Bl = class _Bl {
|
|
503
402
|
/**
|
|
@@ -579,8 +478,44 @@ var _Bl = class _Bl {
|
|
|
579
478
|
};
|
|
580
479
|
__name(_Bl, "Bl");
|
|
581
480
|
var Bl = _Bl;
|
|
481
|
+
var _U8Bl = class _U8Bl {
|
|
482
|
+
/**
|
|
483
|
+
* @param {Uint8Array} dest
|
|
484
|
+
*/
|
|
485
|
+
constructor(dest) {
|
|
486
|
+
this.dest = dest;
|
|
487
|
+
this.cursor = 0;
|
|
488
|
+
this.chunks = [dest];
|
|
489
|
+
}
|
|
490
|
+
reset() {
|
|
491
|
+
this.cursor = 0;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* @param {Uint8Array|number[]} bytes
|
|
495
|
+
*/
|
|
496
|
+
push(bytes) {
|
|
497
|
+
if (this.cursor + bytes.length > this.dest.length) {
|
|
498
|
+
throw new Error("write out of bounds, destination buffer is too small");
|
|
499
|
+
}
|
|
500
|
+
this.dest.set(bytes, this.cursor);
|
|
501
|
+
this.cursor += bytes.length;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* @param {boolean} [reset]
|
|
505
|
+
* @returns {Uint8Array}
|
|
506
|
+
*/
|
|
507
|
+
toBytes(reset = false) {
|
|
508
|
+
const byts = this.dest.subarray(0, this.cursor);
|
|
509
|
+
if (reset) {
|
|
510
|
+
this.reset();
|
|
511
|
+
}
|
|
512
|
+
return byts;
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
__name(_U8Bl, "U8Bl");
|
|
516
|
+
var U8Bl = _U8Bl;
|
|
582
517
|
|
|
583
|
-
// ../../../node_modules
|
|
518
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/common.js
|
|
584
519
|
var decodeErrPrefix = "CBOR decode error:";
|
|
585
520
|
var encodeErrPrefix = "CBOR encode error:";
|
|
586
521
|
var uintMinorPrefixBytes = [];
|
|
@@ -596,7 +531,7 @@ function assertEnoughData(data, pos, need) {
|
|
|
596
531
|
}
|
|
597
532
|
__name(assertEnoughData, "assertEnoughData");
|
|
598
533
|
|
|
599
|
-
// ../../../node_modules
|
|
534
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/0uint.js
|
|
600
535
|
var uintBoundaries = [24, 256, 65536, 4294967296, BigInt("18446744073709551616")];
|
|
601
536
|
function readUint8(data, offset, options) {
|
|
602
537
|
assertEnoughData(data, offset, 1);
|
|
@@ -658,23 +593,23 @@ function decodeUint64(data, pos, _minor, options) {
|
|
|
658
593
|
return new Token(Type.uint, readUint64(data, pos + 1, options), 9);
|
|
659
594
|
}
|
|
660
595
|
__name(decodeUint64, "decodeUint64");
|
|
661
|
-
function encodeUint(
|
|
662
|
-
return encodeUintValue(
|
|
596
|
+
function encodeUint(writer, token) {
|
|
597
|
+
return encodeUintValue(writer, 0, token.value);
|
|
663
598
|
}
|
|
664
599
|
__name(encodeUint, "encodeUint");
|
|
665
|
-
function encodeUintValue(
|
|
600
|
+
function encodeUintValue(writer, major, uint) {
|
|
666
601
|
if (uint < uintBoundaries[0]) {
|
|
667
602
|
const nuint = Number(uint);
|
|
668
|
-
|
|
603
|
+
writer.push([major | nuint]);
|
|
669
604
|
} else if (uint < uintBoundaries[1]) {
|
|
670
605
|
const nuint = Number(uint);
|
|
671
|
-
|
|
606
|
+
writer.push([major | 24, nuint]);
|
|
672
607
|
} else if (uint < uintBoundaries[2]) {
|
|
673
608
|
const nuint = Number(uint);
|
|
674
|
-
|
|
609
|
+
writer.push([major | 25, nuint >>> 8, nuint & 255]);
|
|
675
610
|
} else if (uint < uintBoundaries[3]) {
|
|
676
611
|
const nuint = Number(uint);
|
|
677
|
-
|
|
612
|
+
writer.push([major | 26, nuint >>> 24 & 255, nuint >>> 16 & 255, nuint >>> 8 & 255, nuint & 255]);
|
|
678
613
|
} else {
|
|
679
614
|
const buint = BigInt(uint);
|
|
680
615
|
if (buint < uintBoundaries[4]) {
|
|
@@ -695,7 +630,7 @@ function encodeUintValue(buf2, major, uint) {
|
|
|
695
630
|
set[2] = hi & 255;
|
|
696
631
|
hi = hi >> 8;
|
|
697
632
|
set[1] = hi & 255;
|
|
698
|
-
|
|
633
|
+
writer.push(set);
|
|
699
634
|
} else {
|
|
700
635
|
throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
|
|
701
636
|
}
|
|
@@ -727,7 +662,7 @@ encodeUint.compareTokens = /* @__PURE__ */ __name(function compareTokens(tok1, t
|
|
|
727
662
|
);
|
|
728
663
|
}, "compareTokens");
|
|
729
664
|
|
|
730
|
-
// ../../../node_modules
|
|
665
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/1negint.js
|
|
731
666
|
function decodeNegint8(data, pos, _minor, options) {
|
|
732
667
|
return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
|
|
733
668
|
}
|
|
@@ -756,10 +691,10 @@ function decodeNegint64(data, pos, _minor, options) {
|
|
|
756
691
|
return new Token(Type.negint, neg1b - BigInt(int), 9);
|
|
757
692
|
}
|
|
758
693
|
__name(decodeNegint64, "decodeNegint64");
|
|
759
|
-
function encodeNegint(
|
|
694
|
+
function encodeNegint(writer, token) {
|
|
760
695
|
const negint = token.value;
|
|
761
696
|
const unsigned = typeof negint === "bigint" ? negint * neg1b - pos1b : negint * -1 - 1;
|
|
762
|
-
encodeUintValue(
|
|
697
|
+
encodeUintValue(writer, token.type.majorEncoded, unsigned);
|
|
763
698
|
}
|
|
764
699
|
__name(encodeNegint, "encodeNegint");
|
|
765
700
|
encodeNegint.encodedSize = /* @__PURE__ */ __name(function encodedSize3(token) {
|
|
@@ -786,11 +721,11 @@ encodeNegint.compareTokens = /* @__PURE__ */ __name(function compareTokens2(tok1
|
|
|
786
721
|
);
|
|
787
722
|
}, "compareTokens");
|
|
788
723
|
|
|
789
|
-
// ../../../node_modules
|
|
724
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/2bytes.js
|
|
790
725
|
function toToken(data, pos, prefix, length) {
|
|
791
726
|
assertEnoughData(data, pos, prefix + length);
|
|
792
|
-
const
|
|
793
|
-
return new Token(Type.bytes,
|
|
727
|
+
const buf = data.slice(pos + prefix, pos + prefix + length);
|
|
728
|
+
return new Token(Type.bytes, buf, prefix + length);
|
|
794
729
|
}
|
|
795
730
|
__name(toToken, "toToken");
|
|
796
731
|
function decodeBytesCompact(data, pos, minor, _options) {
|
|
@@ -819,15 +754,15 @@ function decodeBytes64(data, pos, _minor, options) {
|
|
|
819
754
|
__name(decodeBytes64, "decodeBytes64");
|
|
820
755
|
function tokenBytes(token) {
|
|
821
756
|
if (token.encodedBytes === void 0) {
|
|
822
|
-
token.encodedBytes = token.type
|
|
757
|
+
token.encodedBytes = Type.equals(token.type, Type.string) ? fromString(token.value) : token.value;
|
|
823
758
|
}
|
|
824
759
|
return token.encodedBytes;
|
|
825
760
|
}
|
|
826
761
|
__name(tokenBytes, "tokenBytes");
|
|
827
|
-
function encodeBytes(
|
|
762
|
+
function encodeBytes(writer, token) {
|
|
828
763
|
const bytes = tokenBytes(token);
|
|
829
|
-
encodeUintValue(
|
|
830
|
-
|
|
764
|
+
encodeUintValue(writer, token.type.majorEncoded, bytes.length);
|
|
765
|
+
writer.push(bytes);
|
|
831
766
|
}
|
|
832
767
|
__name(encodeBytes, "encodeBytes");
|
|
833
768
|
encodeBytes.encodedSize = /* @__PURE__ */ __name(function encodedSize4(token) {
|
|
@@ -842,13 +777,31 @@ function compareBytes(b1, b2) {
|
|
|
842
777
|
}
|
|
843
778
|
__name(compareBytes, "compareBytes");
|
|
844
779
|
|
|
845
|
-
// ../../../node_modules
|
|
780
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/3string.js
|
|
781
|
+
var textDecoder = new TextDecoder();
|
|
782
|
+
var ASCII_THRESHOLD = 32;
|
|
783
|
+
function toStr(bytes, start, end) {
|
|
784
|
+
const len = end - start;
|
|
785
|
+
if (len < ASCII_THRESHOLD) {
|
|
786
|
+
let str = "";
|
|
787
|
+
for (let i = start; i < end; i++) {
|
|
788
|
+
const c = bytes[i];
|
|
789
|
+
if (c & 128) {
|
|
790
|
+
return textDecoder.decode(bytes.subarray(start, end));
|
|
791
|
+
}
|
|
792
|
+
str += String.fromCharCode(c);
|
|
793
|
+
}
|
|
794
|
+
return str;
|
|
795
|
+
}
|
|
796
|
+
return textDecoder.decode(bytes.subarray(start, end));
|
|
797
|
+
}
|
|
798
|
+
__name(toStr, "toStr");
|
|
846
799
|
function toToken2(data, pos, prefix, length, options) {
|
|
847
800
|
const totLength = prefix + length;
|
|
848
801
|
assertEnoughData(data, pos, totLength);
|
|
849
|
-
const tok = new Token(Type.string,
|
|
802
|
+
const tok = new Token(Type.string, toStr(data, pos + prefix, pos + totLength), totLength);
|
|
850
803
|
if (options.retainStringBytes === true) {
|
|
851
|
-
tok.byteValue = slice(
|
|
804
|
+
tok.byteValue = data.slice(pos + prefix, pos + totLength);
|
|
852
805
|
}
|
|
853
806
|
return tok;
|
|
854
807
|
}
|
|
@@ -879,7 +832,7 @@ function decodeString64(data, pos, _minor, options) {
|
|
|
879
832
|
__name(decodeString64, "decodeString64");
|
|
880
833
|
var encodeString = encodeBytes;
|
|
881
834
|
|
|
882
|
-
// ../../../node_modules
|
|
835
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/4array.js
|
|
883
836
|
function toToken3(_data, _pos, prefix, length) {
|
|
884
837
|
return new Token(Type.array, length, prefix);
|
|
885
838
|
}
|
|
@@ -915,8 +868,8 @@ function decodeArrayIndefinite(data, pos, _minor, options) {
|
|
|
915
868
|
return toToken3(data, pos, 1, Infinity);
|
|
916
869
|
}
|
|
917
870
|
__name(decodeArrayIndefinite, "decodeArrayIndefinite");
|
|
918
|
-
function encodeArray(
|
|
919
|
-
encodeUintValue(
|
|
871
|
+
function encodeArray(writer, token) {
|
|
872
|
+
encodeUintValue(writer, Type.array.majorEncoded, token.value);
|
|
920
873
|
}
|
|
921
874
|
__name(encodeArray, "encodeArray");
|
|
922
875
|
encodeArray.compareTokens = encodeUint.compareTokens;
|
|
@@ -924,7 +877,7 @@ encodeArray.encodedSize = /* @__PURE__ */ __name(function encodedSize5(token) {
|
|
|
924
877
|
return encodeUintValue.encodedSize(token.value);
|
|
925
878
|
}, "encodedSize");
|
|
926
879
|
|
|
927
|
-
// ../../../node_modules
|
|
880
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/5map.js
|
|
928
881
|
function toToken4(_data, _pos, prefix, length) {
|
|
929
882
|
return new Token(Type.map, length, prefix);
|
|
930
883
|
}
|
|
@@ -960,8 +913,8 @@ function decodeMapIndefinite(data, pos, _minor, options) {
|
|
|
960
913
|
return toToken4(data, pos, 1, Infinity);
|
|
961
914
|
}
|
|
962
915
|
__name(decodeMapIndefinite, "decodeMapIndefinite");
|
|
963
|
-
function encodeMap(
|
|
964
|
-
encodeUintValue(
|
|
916
|
+
function encodeMap(writer, token) {
|
|
917
|
+
encodeUintValue(writer, Type.map.majorEncoded, token.value);
|
|
965
918
|
}
|
|
966
919
|
__name(encodeMap, "encodeMap");
|
|
967
920
|
encodeMap.compareTokens = encodeUint.compareTokens;
|
|
@@ -969,7 +922,7 @@ encodeMap.encodedSize = /* @__PURE__ */ __name(function encodedSize6(token) {
|
|
|
969
922
|
return encodeUintValue.encodedSize(token.value);
|
|
970
923
|
}, "encodedSize");
|
|
971
924
|
|
|
972
|
-
// ../../../node_modules
|
|
925
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/6tag.js
|
|
973
926
|
function decodeTagCompact(_data, _pos, minor, _options) {
|
|
974
927
|
return new Token(Type.tag, minor, 1);
|
|
975
928
|
}
|
|
@@ -990,8 +943,8 @@ function decodeTag64(data, pos, _minor, options) {
|
|
|
990
943
|
return new Token(Type.tag, readUint64(data, pos + 1, options), 9);
|
|
991
944
|
}
|
|
992
945
|
__name(decodeTag64, "decodeTag64");
|
|
993
|
-
function encodeTag(
|
|
994
|
-
encodeUintValue(
|
|
946
|
+
function encodeTag(writer, token) {
|
|
947
|
+
encodeUintValue(writer, Type.tag.majorEncoded, token.value);
|
|
995
948
|
}
|
|
996
949
|
__name(encodeTag, "encodeTag");
|
|
997
950
|
encodeTag.compareTokens = encodeUint.compareTokens;
|
|
@@ -999,7 +952,7 @@ encodeTag.encodedSize = /* @__PURE__ */ __name(function encodedSize7(token) {
|
|
|
999
952
|
return encodeUintValue.encodedSize(token.value);
|
|
1000
953
|
}, "encodedSize");
|
|
1001
954
|
|
|
1002
|
-
// ../../../node_modules
|
|
955
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/7float.js
|
|
1003
956
|
var MINOR_FALSE = 20;
|
|
1004
957
|
var MINOR_TRUE = 21;
|
|
1005
958
|
var MINOR_NULL = 22;
|
|
@@ -1044,16 +997,16 @@ function decodeFloat64(data, pos, _minor, options) {
|
|
|
1044
997
|
return createToken(readFloat64(data, pos + 1), 9, options);
|
|
1045
998
|
}
|
|
1046
999
|
__name(decodeFloat64, "decodeFloat64");
|
|
1047
|
-
function encodeFloat(
|
|
1000
|
+
function encodeFloat(writer, token, options) {
|
|
1048
1001
|
const float = token.value;
|
|
1049
1002
|
if (float === false) {
|
|
1050
|
-
|
|
1003
|
+
writer.push([Type.float.majorEncoded | MINOR_FALSE]);
|
|
1051
1004
|
} else if (float === true) {
|
|
1052
|
-
|
|
1005
|
+
writer.push([Type.float.majorEncoded | MINOR_TRUE]);
|
|
1053
1006
|
} else if (float === null) {
|
|
1054
|
-
|
|
1007
|
+
writer.push([Type.float.majorEncoded | MINOR_NULL]);
|
|
1055
1008
|
} else if (float === void 0) {
|
|
1056
|
-
|
|
1009
|
+
writer.push([Type.float.majorEncoded | MINOR_UNDEFINED]);
|
|
1057
1010
|
} else {
|
|
1058
1011
|
let decoded;
|
|
1059
1012
|
let success = false;
|
|
@@ -1062,14 +1015,14 @@ function encodeFloat(buf2, token, options) {
|
|
|
1062
1015
|
decoded = readFloat16(ui8a, 1);
|
|
1063
1016
|
if (float === decoded || Number.isNaN(float)) {
|
|
1064
1017
|
ui8a[0] = 249;
|
|
1065
|
-
|
|
1018
|
+
writer.push(ui8a.slice(0, 3));
|
|
1066
1019
|
success = true;
|
|
1067
1020
|
} else {
|
|
1068
1021
|
encodeFloat32(float);
|
|
1069
1022
|
decoded = readFloat32(ui8a, 1);
|
|
1070
1023
|
if (float === decoded) {
|
|
1071
1024
|
ui8a[0] = 250;
|
|
1072
|
-
|
|
1025
|
+
writer.push(ui8a.slice(0, 5));
|
|
1073
1026
|
success = true;
|
|
1074
1027
|
}
|
|
1075
1028
|
}
|
|
@@ -1078,7 +1031,7 @@ function encodeFloat(buf2, token, options) {
|
|
|
1078
1031
|
encodeFloat64(float);
|
|
1079
1032
|
decoded = readFloat64(ui8a, 1);
|
|
1080
1033
|
ui8a[0] = 251;
|
|
1081
|
-
|
|
1034
|
+
writer.push(ui8a.slice(0, 9));
|
|
1082
1035
|
}
|
|
1083
1036
|
}
|
|
1084
1037
|
}
|
|
@@ -1188,7 +1141,7 @@ function readFloat64(ui8a2, pos) {
|
|
|
1188
1141
|
__name(readFloat64, "readFloat64");
|
|
1189
1142
|
encodeFloat.compareTokens = encodeUint.compareTokens;
|
|
1190
1143
|
|
|
1191
|
-
// ../../../node_modules
|
|
1144
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/jump.js
|
|
1192
1145
|
function invalidMinor(data, pos, minor) {
|
|
1193
1146
|
throw new Error(`${decodeErrPrefix} encountered invalid minor (${minor}) for major ${data[pos] >>> 5}`);
|
|
1194
1147
|
}
|
|
@@ -1347,7 +1300,7 @@ function quickEncodeToken(token) {
|
|
|
1347
1300
|
}
|
|
1348
1301
|
__name(quickEncodeToken, "quickEncodeToken");
|
|
1349
1302
|
|
|
1350
|
-
// ../../../node_modules
|
|
1303
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/encode.js
|
|
1351
1304
|
var defaultEncodeOptions = {
|
|
1352
1305
|
float64: false,
|
|
1353
1306
|
mapSorter,
|
|
@@ -1372,7 +1325,7 @@ function makeCborEncoders() {
|
|
|
1372
1325
|
}
|
|
1373
1326
|
__name(makeCborEncoders, "makeCborEncoders");
|
|
1374
1327
|
var cborEncoders = makeCborEncoders();
|
|
1375
|
-
var
|
|
1328
|
+
var defaultWriter = new Bl();
|
|
1376
1329
|
var _Ref = class _Ref {
|
|
1377
1330
|
/**
|
|
1378
1331
|
* @param {object|any[]} obj
|
|
@@ -1553,27 +1506,38 @@ var typeEncoders = {
|
|
|
1553
1506
|
Object(obj, typ, options, refStack) {
|
|
1554
1507
|
const isMap = typ !== "Object";
|
|
1555
1508
|
const keys = isMap ? obj.keys() : Object.keys(obj);
|
|
1556
|
-
const
|
|
1557
|
-
|
|
1509
|
+
const maxLength = isMap ? obj.size : keys.length;
|
|
1510
|
+
let entries;
|
|
1511
|
+
if (maxLength) {
|
|
1512
|
+
entries = new Array(maxLength);
|
|
1513
|
+
refStack = Ref.createCheck(refStack, obj);
|
|
1514
|
+
const skipUndefined = !isMap && options.ignoreUndefinedProperties;
|
|
1515
|
+
let i = 0;
|
|
1516
|
+
for (const key of keys) {
|
|
1517
|
+
const value = isMap ? obj.get(key) : obj[key];
|
|
1518
|
+
if (skipUndefined && value === void 0) {
|
|
1519
|
+
continue;
|
|
1520
|
+
}
|
|
1521
|
+
entries[i++] = [
|
|
1522
|
+
objectToTokens(key, options, refStack),
|
|
1523
|
+
objectToTokens(value, options, refStack)
|
|
1524
|
+
];
|
|
1525
|
+
}
|
|
1526
|
+
if (i < maxLength) {
|
|
1527
|
+
entries.length = i;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
if (!entries?.length) {
|
|
1558
1531
|
if (options.addBreakTokens === true) {
|
|
1559
1532
|
return [simpleTokens.emptyMap, new Token(Type.break)];
|
|
1560
1533
|
}
|
|
1561
1534
|
return simpleTokens.emptyMap;
|
|
1562
1535
|
}
|
|
1563
|
-
refStack = Ref.createCheck(refStack, obj);
|
|
1564
|
-
const entries = [];
|
|
1565
|
-
let i = 0;
|
|
1566
|
-
for (const key of keys) {
|
|
1567
|
-
entries[i++] = [
|
|
1568
|
-
objectToTokens(key, options, refStack),
|
|
1569
|
-
objectToTokens(isMap ? obj.get(key) : obj[key], options, refStack)
|
|
1570
|
-
];
|
|
1571
|
-
}
|
|
1572
1536
|
sortMapEntries(entries, options);
|
|
1573
1537
|
if (options.addBreakTokens) {
|
|
1574
|
-
return [new Token(Type.map, length), entries, new Token(Type.break)];
|
|
1538
|
+
return [new Token(Type.map, entries.length), entries, new Token(Type.break)];
|
|
1575
1539
|
}
|
|
1576
|
-
return [new Token(Type.map, length), entries];
|
|
1540
|
+
return [new Token(Type.map, entries.length), entries];
|
|
1577
1541
|
}
|
|
1578
1542
|
};
|
|
1579
1543
|
typeEncoders.Map = typeEncoders.Object;
|
|
@@ -1643,46 +1607,149 @@ function encodeRfc8949(data) {
|
|
|
1643
1607
|
return encodeCustom(data, cborEncoders, rfc8949EncodeOptions);
|
|
1644
1608
|
}
|
|
1645
1609
|
__name(encodeRfc8949, "encodeRfc8949");
|
|
1646
|
-
function tokensToEncoded(
|
|
1610
|
+
function tokensToEncoded(writer, tokens, encoders, options) {
|
|
1647
1611
|
if (Array.isArray(tokens)) {
|
|
1648
1612
|
for (const token of tokens) {
|
|
1649
|
-
tokensToEncoded(
|
|
1613
|
+
tokensToEncoded(writer, token, encoders, options);
|
|
1650
1614
|
}
|
|
1651
1615
|
} else {
|
|
1652
|
-
encoders[tokens.type.major](
|
|
1616
|
+
encoders[tokens.type.major](writer, tokens, options);
|
|
1653
1617
|
}
|
|
1654
1618
|
}
|
|
1655
1619
|
__name(tokensToEncoded, "tokensToEncoded");
|
|
1656
|
-
|
|
1620
|
+
var MAJOR_UINT = Type.uint.majorEncoded;
|
|
1621
|
+
var MAJOR_NEGINT = Type.negint.majorEncoded;
|
|
1622
|
+
var MAJOR_BYTES = Type.bytes.majorEncoded;
|
|
1623
|
+
var MAJOR_STRING = Type.string.majorEncoded;
|
|
1624
|
+
var MAJOR_ARRAY = Type.array.majorEncoded;
|
|
1625
|
+
var SIMPLE_FALSE = Type.float.majorEncoded | MINOR_FALSE;
|
|
1626
|
+
var SIMPLE_TRUE = Type.float.majorEncoded | MINOR_TRUE;
|
|
1627
|
+
var SIMPLE_NULL = Type.float.majorEncoded | MINOR_NULL;
|
|
1628
|
+
var SIMPLE_UNDEFINED = Type.float.majorEncoded | MINOR_UNDEFINED;
|
|
1629
|
+
var neg1b2 = BigInt(-1);
|
|
1630
|
+
var pos1b2 = BigInt(1);
|
|
1631
|
+
function canDirectEncode(options) {
|
|
1632
|
+
return options.addBreakTokens !== true;
|
|
1633
|
+
}
|
|
1634
|
+
__name(canDirectEncode, "canDirectEncode");
|
|
1635
|
+
function directEncode(writer, data, options, refStack) {
|
|
1636
|
+
const typ = is(data);
|
|
1637
|
+
const customEncoder = options.typeEncoders && options.typeEncoders[typ];
|
|
1638
|
+
if (customEncoder) {
|
|
1639
|
+
const tokens = customEncoder(data, typ, options, refStack);
|
|
1640
|
+
if (tokens != null) {
|
|
1641
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
switch (typ) {
|
|
1646
|
+
case "null":
|
|
1647
|
+
writer.push([SIMPLE_NULL]);
|
|
1648
|
+
return;
|
|
1649
|
+
case "undefined":
|
|
1650
|
+
writer.push([SIMPLE_UNDEFINED]);
|
|
1651
|
+
return;
|
|
1652
|
+
case "boolean":
|
|
1653
|
+
writer.push([data ? SIMPLE_TRUE : SIMPLE_FALSE]);
|
|
1654
|
+
return;
|
|
1655
|
+
case "number":
|
|
1656
|
+
if (!Number.isInteger(data) || !Number.isSafeInteger(data)) {
|
|
1657
|
+
encodeFloat(writer, new Token(Type.float, data), options);
|
|
1658
|
+
} else if (data >= 0) {
|
|
1659
|
+
encodeUintValue(writer, MAJOR_UINT, data);
|
|
1660
|
+
} else {
|
|
1661
|
+
encodeUintValue(writer, MAJOR_NEGINT, data * -1 - 1);
|
|
1662
|
+
}
|
|
1663
|
+
return;
|
|
1664
|
+
case "bigint":
|
|
1665
|
+
if (data >= BigInt(0)) {
|
|
1666
|
+
encodeUintValue(writer, MAJOR_UINT, data);
|
|
1667
|
+
} else {
|
|
1668
|
+
encodeUintValue(writer, MAJOR_NEGINT, data * neg1b2 - pos1b2);
|
|
1669
|
+
}
|
|
1670
|
+
return;
|
|
1671
|
+
case "string": {
|
|
1672
|
+
const bytes = fromString(data);
|
|
1673
|
+
encodeUintValue(writer, MAJOR_STRING, bytes.length);
|
|
1674
|
+
writer.push(bytes);
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
case "Uint8Array":
|
|
1678
|
+
encodeUintValue(writer, MAJOR_BYTES, data.length);
|
|
1679
|
+
writer.push(data);
|
|
1680
|
+
return;
|
|
1681
|
+
case "Array":
|
|
1682
|
+
if (!data.length) {
|
|
1683
|
+
writer.push([MAJOR_ARRAY]);
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
refStack = Ref.createCheck(refStack, data);
|
|
1687
|
+
encodeUintValue(writer, MAJOR_ARRAY, data.length);
|
|
1688
|
+
for (const elem of data) {
|
|
1689
|
+
directEncode(writer, elem, options, refStack);
|
|
1690
|
+
}
|
|
1691
|
+
return;
|
|
1692
|
+
case "Object":
|
|
1693
|
+
case "Map":
|
|
1694
|
+
{
|
|
1695
|
+
const tokens = typeEncoders.Object(data, typ, options, refStack);
|
|
1696
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1697
|
+
}
|
|
1698
|
+
return;
|
|
1699
|
+
default: {
|
|
1700
|
+
const typeEncoder = typeEncoders[typ];
|
|
1701
|
+
if (!typeEncoder) {
|
|
1702
|
+
throw new Error(`${encodeErrPrefix} unsupported type: ${typ}`);
|
|
1703
|
+
}
|
|
1704
|
+
const tokens = typeEncoder(data, typ, options, refStack);
|
|
1705
|
+
tokensToEncoded(writer, tokens, cborEncoders, options);
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
__name(directEncode, "directEncode");
|
|
1710
|
+
function encodeCustom(data, encoders, options, destination) {
|
|
1711
|
+
const hasDest = destination instanceof Uint8Array;
|
|
1712
|
+
let writeTo = hasDest ? new U8Bl(destination) : defaultWriter;
|
|
1657
1713
|
const tokens = objectToTokens(data, options);
|
|
1658
1714
|
if (!Array.isArray(tokens) && options.quickEncodeToken) {
|
|
1659
1715
|
const quickBytes = options.quickEncodeToken(tokens);
|
|
1660
1716
|
if (quickBytes) {
|
|
1717
|
+
if (hasDest) {
|
|
1718
|
+
writeTo.push(quickBytes);
|
|
1719
|
+
return writeTo.toBytes();
|
|
1720
|
+
}
|
|
1661
1721
|
return quickBytes;
|
|
1662
1722
|
}
|
|
1663
1723
|
const encoder = encoders[tokens.type.major];
|
|
1664
1724
|
if (encoder.encodedSize) {
|
|
1665
1725
|
const size = encoder.encodedSize(tokens, options);
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1726
|
+
if (!hasDest) {
|
|
1727
|
+
writeTo = new Bl(size);
|
|
1728
|
+
}
|
|
1729
|
+
encoder(writeTo, tokens, options);
|
|
1730
|
+
if (writeTo.chunks.length !== 1) {
|
|
1669
1731
|
throw new Error(`Unexpected error: pre-calculated length for ${tokens} was wrong`);
|
|
1670
1732
|
}
|
|
1671
|
-
return asU8A(
|
|
1733
|
+
return hasDest ? writeTo.toBytes() : asU8A(writeTo.chunks[0]);
|
|
1672
1734
|
}
|
|
1673
1735
|
}
|
|
1674
|
-
|
|
1675
|
-
tokensToEncoded(
|
|
1676
|
-
return
|
|
1736
|
+
writeTo.reset();
|
|
1737
|
+
tokensToEncoded(writeTo, tokens, encoders, options);
|
|
1738
|
+
return writeTo.toBytes(true);
|
|
1677
1739
|
}
|
|
1678
1740
|
__name(encodeCustom, "encodeCustom");
|
|
1679
1741
|
function encode(data, options) {
|
|
1680
1742
|
options = Object.assign({}, defaultEncodeOptions, options);
|
|
1743
|
+
if (canDirectEncode(options)) {
|
|
1744
|
+
defaultWriter.reset();
|
|
1745
|
+
directEncode(defaultWriter, data, options, void 0);
|
|
1746
|
+
return defaultWriter.toBytes(true);
|
|
1747
|
+
}
|
|
1681
1748
|
return encodeCustom(data, cborEncoders, options);
|
|
1682
1749
|
}
|
|
1683
1750
|
__name(encode, "encode");
|
|
1684
1751
|
|
|
1685
|
-
// ../../../node_modules
|
|
1752
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/cborg/lib/decode.js
|
|
1686
1753
|
var defaultDecodeOptions = {
|
|
1687
1754
|
strict: false,
|
|
1688
1755
|
allowIndefinite: true,
|
|
@@ -1744,6 +1811,7 @@ function tokenToArray(token, tokeniser, options) {
|
|
|
1744
1811
|
__name(tokenToArray, "tokenToArray");
|
|
1745
1812
|
function tokenToMap(token, tokeniser, options) {
|
|
1746
1813
|
const useMaps = options.useMaps === true;
|
|
1814
|
+
const rejectDuplicateMapKeys = options.rejectDuplicateMapKeys === true;
|
|
1747
1815
|
const obj = useMaps ? void 0 : {};
|
|
1748
1816
|
const m = useMaps ? /* @__PURE__ */ new Map() : void 0;
|
|
1749
1817
|
for (let i = 0; i < token.value; i++) {
|
|
@@ -1757,11 +1825,11 @@ function tokenToMap(token, tokeniser, options) {
|
|
|
1757
1825
|
if (key === DONE) {
|
|
1758
1826
|
throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no key], expected ${token.value})`);
|
|
1759
1827
|
}
|
|
1760
|
-
if (useMaps
|
|
1828
|
+
if (!useMaps && typeof key !== "string") {
|
|
1761
1829
|
throw new Error(`${decodeErrPrefix} non-string keys not supported (got ${typeof key})`);
|
|
1762
1830
|
}
|
|
1763
|
-
if (
|
|
1764
|
-
if (useMaps && m.has(key) || !useMaps && key
|
|
1831
|
+
if (rejectDuplicateMapKeys) {
|
|
1832
|
+
if (useMaps && m.has(key) || !useMaps && Object.hasOwn(obj, key)) {
|
|
1765
1833
|
throw new Error(`${decodeErrPrefix} found repeat map key "${key}"`);
|
|
1766
1834
|
}
|
|
1767
1835
|
}
|
|
@@ -1783,19 +1851,19 @@ function tokensToObject(tokeniser, options) {
|
|
|
1783
1851
|
return DONE;
|
|
1784
1852
|
}
|
|
1785
1853
|
const token = tokeniser.next();
|
|
1786
|
-
if (token.type
|
|
1854
|
+
if (Type.equals(token.type, Type.break)) {
|
|
1787
1855
|
return BREAK;
|
|
1788
1856
|
}
|
|
1789
1857
|
if (token.type.terminal) {
|
|
1790
1858
|
return token.value;
|
|
1791
1859
|
}
|
|
1792
|
-
if (token.type
|
|
1860
|
+
if (Type.equals(token.type, Type.array)) {
|
|
1793
1861
|
return tokenToArray(token, tokeniser, options);
|
|
1794
1862
|
}
|
|
1795
|
-
if (token.type
|
|
1863
|
+
if (Type.equals(token.type, Type.map)) {
|
|
1796
1864
|
return tokenToMap(token, tokeniser, options);
|
|
1797
1865
|
}
|
|
1798
|
-
if (token.type
|
|
1866
|
+
if (Type.equals(token.type, Type.tag)) {
|
|
1799
1867
|
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
1800
1868
|
const tagged = tokensToObject(tokeniser, options);
|
|
1801
1869
|
return options.tags[token.value](tagged);
|
|
@@ -1810,7 +1878,8 @@ function decodeFirst(data, options) {
|
|
|
1810
1878
|
throw new Error(`${decodeErrPrefix} data to decode must be a Uint8Array`);
|
|
1811
1879
|
}
|
|
1812
1880
|
options = Object.assign({}, defaultDecodeOptions, options);
|
|
1813
|
-
const
|
|
1881
|
+
const u8aData = asU8A(data);
|
|
1882
|
+
const tokeniser = options.tokenizer || new Tokeniser(u8aData, options);
|
|
1814
1883
|
const decoded = tokensToObject(tokeniser, options);
|
|
1815
1884
|
if (decoded === DONE) {
|
|
1816
1885
|
throw new Error(`${decodeErrPrefix} did not find any content to decode`);
|
|
@@ -1830,7 +1899,7 @@ function decode(data, options) {
|
|
|
1830
1899
|
}
|
|
1831
1900
|
__name(decode, "decode");
|
|
1832
1901
|
|
|
1833
|
-
// ../../../node_modules
|
|
1902
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/CborldError.js
|
|
1834
1903
|
var _CborldError = class _CborldError extends Error {
|
|
1835
1904
|
constructor(value, message) {
|
|
1836
1905
|
super();
|
|
@@ -1843,7 +1912,7 @@ var _CborldError = class _CborldError extends Error {
|
|
|
1843
1912
|
__name(_CborldError, "CborldError");
|
|
1844
1913
|
var CborldError = _CborldError;
|
|
1845
1914
|
|
|
1846
|
-
// ../../../node_modules
|
|
1915
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/keywords.js
|
|
1847
1916
|
var KEYWORDS = /* @__PURE__ */ new Map([
|
|
1848
1917
|
// ordered is important, do not change
|
|
1849
1918
|
["@context", 0],
|
|
@@ -1879,7 +1948,7 @@ var KEYWORDS = /* @__PURE__ */ new Map([
|
|
|
1879
1948
|
]);
|
|
1880
1949
|
var FIRST_CUSTOM_TERM_ID = 100;
|
|
1881
1950
|
|
|
1882
|
-
// ../../../node_modules
|
|
1951
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/CborldDecoder.js
|
|
1883
1952
|
var _CborldDecoder = class _CborldDecoder {
|
|
1884
1953
|
// eslint-disable-next-line no-unused-vars
|
|
1885
1954
|
decode({ value } = {}) {
|
|
@@ -1893,7 +1962,7 @@ var _CborldDecoder = class _CborldDecoder {
|
|
|
1893
1962
|
__name(_CborldDecoder, "CborldDecoder");
|
|
1894
1963
|
var CborldDecoder = _CborldDecoder;
|
|
1895
1964
|
|
|
1896
|
-
// ../../../node_modules
|
|
1965
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/registeredContexts.js
|
|
1897
1966
|
var ID_TO_URL = /* @__PURE__ */ new Map();
|
|
1898
1967
|
var URL_TO_ID = /* @__PURE__ */ new Map();
|
|
1899
1968
|
_addRegistration(16, "https://www.w3.org/ns/activitystreams");
|
|
@@ -1923,7 +1992,7 @@ function _addRegistration(id, url) {
|
|
|
1923
1992
|
}
|
|
1924
1993
|
__name(_addRegistration, "_addRegistration");
|
|
1925
1994
|
|
|
1926
|
-
// ../../../node_modules
|
|
1995
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/ContextDecoder.js
|
|
1927
1996
|
var _ContextDecoder = class _ContextDecoder extends CborldDecoder {
|
|
1928
1997
|
constructor({ reverseAppContextMap } = {}) {
|
|
1929
1998
|
super();
|
|
@@ -1964,17 +2033,17 @@ function _mapToObject(map) {
|
|
|
1964
2033
|
}
|
|
1965
2034
|
__name(_mapToObject, "_mapToObject");
|
|
1966
2035
|
|
|
1967
|
-
// ../../../node_modules
|
|
2036
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/util-browser.js
|
|
1968
2037
|
function inspect(data, options) {
|
|
1969
2038
|
return JSON.stringify(data, null, 2);
|
|
1970
2039
|
}
|
|
1971
2040
|
__name(inspect, "inspect");
|
|
1972
2041
|
|
|
1973
|
-
// ../../../node_modules
|
|
1974
|
-
var version = "3.
|
|
2042
|
+
// ../../../node_modules/js-base64/base64.mjs
|
|
2043
|
+
var version = "3.8.0";
|
|
1975
2044
|
var VERSION = version;
|
|
1976
2045
|
var _hasBuffer = typeof Buffer === "function";
|
|
1977
|
-
var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
|
2046
|
+
var _TD = typeof TextDecoder === "function" ? new TextDecoder("utf-8", { ignoreBOM: true }) : void 0;
|
|
1978
2047
|
var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
|
1979
2048
|
var b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
1980
2049
|
var b64chs = Array.prototype.slice.call(b64ch);
|
|
@@ -2132,7 +2201,7 @@ var gBase64 = {
|
|
|
2132
2201
|
extendBuiltins
|
|
2133
2202
|
};
|
|
2134
2203
|
|
|
2135
|
-
// ../../../node_modules
|
|
2204
|
+
// ../../../node_modules/base58-universal/lib/baseN.js
|
|
2136
2205
|
var _reverseAlphabets = {};
|
|
2137
2206
|
function encode3(input, alphabet2, maxline) {
|
|
2138
2207
|
if (!(input instanceof Uint8Array)) {
|
|
@@ -2221,7 +2290,7 @@ function decode3(input, alphabet2) {
|
|
|
2221
2290
|
}
|
|
2222
2291
|
__name(decode3, "decode");
|
|
2223
2292
|
|
|
2224
|
-
// ../../../node_modules
|
|
2293
|
+
// ../../../node_modules/base58-universal/lib/index.js
|
|
2225
2294
|
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2226
2295
|
function encode4(input, maxline) {
|
|
2227
2296
|
return encode3(input, alphabet, maxline);
|
|
@@ -2232,7 +2301,7 @@ function decode4(input) {
|
|
|
2232
2301
|
}
|
|
2233
2302
|
__name(decode4, "decode");
|
|
2234
2303
|
|
|
2235
|
-
// ../../../node_modules
|
|
2304
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseDecoder.js
|
|
2236
2305
|
var _MultibaseDecoder = class _MultibaseDecoder extends CborldDecoder {
|
|
2237
2306
|
decode({ value } = {}) {
|
|
2238
2307
|
const { buffer: buffer2, byteOffset, length } = value;
|
|
@@ -2257,7 +2326,7 @@ var _MultibaseDecoder = class _MultibaseDecoder extends CborldDecoder {
|
|
|
2257
2326
|
__name(_MultibaseDecoder, "MultibaseDecoder");
|
|
2258
2327
|
var MultibaseDecoder = _MultibaseDecoder;
|
|
2259
2328
|
|
|
2260
|
-
// ../../../node_modules
|
|
2329
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Transformer.js
|
|
2261
2330
|
var _Transformer = class _Transformer {
|
|
2262
2331
|
/**
|
|
2263
2332
|
* Creates a new Transformer for transforming CBOR-LD <=> JSON-LD.
|
|
@@ -2637,7 +2706,7 @@ var _Transformer = class _Transformer {
|
|
|
2637
2706
|
__name(_Transformer, "Transformer");
|
|
2638
2707
|
var Transformer = _Transformer;
|
|
2639
2708
|
|
|
2640
|
-
// ../../../node_modules
|
|
2709
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlDecoder.js
|
|
2641
2710
|
var ID_TO_SCHEME = /* @__PURE__ */ new Map([
|
|
2642
2711
|
// Note: only v1 mainnet is supported
|
|
2643
2712
|
[1024, "did:v1:nym:"],
|
|
@@ -2673,7 +2742,7 @@ var _Base58DidUrlDecoder = class _Base58DidUrlDecoder extends CborldDecoder {
|
|
|
2673
2742
|
__name(_Base58DidUrlDecoder, "Base58DidUrlDecoder");
|
|
2674
2743
|
var Base58DidUrlDecoder = _Base58DidUrlDecoder;
|
|
2675
2744
|
|
|
2676
|
-
// ../../../node_modules
|
|
2745
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlDecoder.js
|
|
2677
2746
|
var _HttpUrlDecoder = class _HttpUrlDecoder extends CborldDecoder {
|
|
2678
2747
|
constructor({ secure } = {}) {
|
|
2679
2748
|
super();
|
|
@@ -2693,17 +2762,17 @@ var _HttpUrlDecoder = class _HttpUrlDecoder extends CborldDecoder {
|
|
|
2693
2762
|
__name(_HttpUrlDecoder, "HttpUrlDecoder");
|
|
2694
2763
|
var HttpUrlDecoder = _HttpUrlDecoder;
|
|
2695
2764
|
|
|
2696
|
-
// ../../../node_modules
|
|
2765
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/regex.js
|
|
2697
2766
|
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;
|
|
2698
2767
|
|
|
2699
|
-
// ../../../node_modules
|
|
2768
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/validate.js
|
|
2700
2769
|
function validate(uuid) {
|
|
2701
2770
|
return typeof uuid === "string" && regex_default.test(uuid);
|
|
2702
2771
|
}
|
|
2703
2772
|
__name(validate, "validate");
|
|
2704
2773
|
var validate_default = validate;
|
|
2705
2774
|
|
|
2706
|
-
// ../../../node_modules
|
|
2775
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/stringify.js
|
|
2707
2776
|
var byteToHex = [];
|
|
2708
2777
|
for (let i = 0; i < 256; ++i) {
|
|
2709
2778
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -2722,7 +2791,7 @@ function stringify(arr, offset = 0) {
|
|
|
2722
2791
|
__name(stringify, "stringify");
|
|
2723
2792
|
var stringify_default = stringify;
|
|
2724
2793
|
|
|
2725
|
-
// ../../../node_modules
|
|
2794
|
+
// ../../../node_modules/@digitalbazaar/cborld/node_modules/uuid/dist/esm-browser/parse.js
|
|
2726
2795
|
function parse(uuid) {
|
|
2727
2796
|
if (!validate_default(uuid)) {
|
|
2728
2797
|
throw TypeError("Invalid UUID");
|
|
@@ -2750,7 +2819,7 @@ function parse(uuid) {
|
|
|
2750
2819
|
__name(parse, "parse");
|
|
2751
2820
|
var parse_default = parse;
|
|
2752
2821
|
|
|
2753
|
-
// ../../../node_modules
|
|
2822
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnDecoder.js
|
|
2754
2823
|
var _UuidUrnDecoder = class _UuidUrnDecoder extends CborldDecoder {
|
|
2755
2824
|
decode({ value } = {}) {
|
|
2756
2825
|
const uuid = typeof value[1] === "string" ? value[1] : stringify_default(value[1]);
|
|
@@ -2765,7 +2834,7 @@ var _UuidUrnDecoder = class _UuidUrnDecoder extends CborldDecoder {
|
|
|
2765
2834
|
__name(_UuidUrnDecoder, "UuidUrnDecoder");
|
|
2766
2835
|
var UuidUrnDecoder = _UuidUrnDecoder;
|
|
2767
2836
|
|
|
2768
|
-
// ../../../node_modules
|
|
2837
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UriDecoder.js
|
|
2769
2838
|
var SCHEME_ID_TO_DECODER = /* @__PURE__ */ new Map([
|
|
2770
2839
|
[1, HttpUrlDecoder],
|
|
2771
2840
|
[2, HttpUrlDecoder],
|
|
@@ -2785,7 +2854,7 @@ var _UriDecoder = class _UriDecoder extends CborldDecoder {
|
|
|
2785
2854
|
__name(_UriDecoder, "UriDecoder");
|
|
2786
2855
|
var UriDecoder = _UriDecoder;
|
|
2787
2856
|
|
|
2788
|
-
// ../../../node_modules
|
|
2857
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermDecoder.js
|
|
2789
2858
|
var _VocabTermDecoder = class _VocabTermDecoder extends CborldDecoder {
|
|
2790
2859
|
constructor({ term } = {}) {
|
|
2791
2860
|
super();
|
|
@@ -2807,7 +2876,7 @@ var _VocabTermDecoder = class _VocabTermDecoder extends CborldDecoder {
|
|
|
2807
2876
|
__name(_VocabTermDecoder, "VocabTermDecoder");
|
|
2808
2877
|
var VocabTermDecoder = _VocabTermDecoder;
|
|
2809
2878
|
|
|
2810
|
-
// ../../../node_modules
|
|
2879
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateDecoder.js
|
|
2811
2880
|
var _XsdDateDecoder = class _XsdDateDecoder extends CborldDecoder {
|
|
2812
2881
|
decode({ value } = {}) {
|
|
2813
2882
|
const dateString = new Date(value * 1e3).toISOString();
|
|
@@ -2822,7 +2891,7 @@ var _XsdDateDecoder = class _XsdDateDecoder extends CborldDecoder {
|
|
|
2822
2891
|
__name(_XsdDateDecoder, "XsdDateDecoder");
|
|
2823
2892
|
var XsdDateDecoder = _XsdDateDecoder;
|
|
2824
2893
|
|
|
2825
|
-
// ../../../node_modules
|
|
2894
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeDecoder.js
|
|
2826
2895
|
var _XsdDateTimeDecoder = class _XsdDateTimeDecoder extends CborldDecoder {
|
|
2827
2896
|
constructor({ value } = {}) {
|
|
2828
2897
|
super();
|
|
@@ -2846,7 +2915,7 @@ var _XsdDateTimeDecoder = class _XsdDateTimeDecoder extends CborldDecoder {
|
|
|
2846
2915
|
__name(_XsdDateTimeDecoder, "XsdDateTimeDecoder");
|
|
2847
2916
|
var XsdDateTimeDecoder = _XsdDateTimeDecoder;
|
|
2848
2917
|
|
|
2849
|
-
// ../../../node_modules
|
|
2918
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Decompressor.js
|
|
2850
2919
|
var TYPE_DECODERS = /* @__PURE__ */ new Map([
|
|
2851
2920
|
["@id", UriDecoder],
|
|
2852
2921
|
["@vocab", VocabTermDecoder],
|
|
@@ -3063,7 +3132,7 @@ function _sortEntriesByTerm([{ term: t1 }], [{ term: t2 }]) {
|
|
|
3063
3132
|
}
|
|
3064
3133
|
__name(_sortEntriesByTerm, "_sortEntriesByTerm");
|
|
3065
3134
|
|
|
3066
|
-
// ../../../node_modules
|
|
3135
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/decode.js
|
|
3067
3136
|
async function decode5({
|
|
3068
3137
|
cborldBytes,
|
|
3069
3138
|
documentLoader,
|
|
@@ -3117,7 +3186,7 @@ async function decode5({
|
|
|
3117
3186
|
}
|
|
3118
3187
|
__name(decode5, "decode");
|
|
3119
3188
|
|
|
3120
|
-
// ../../../node_modules
|
|
3189
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/CborldEncoder.js
|
|
3121
3190
|
var _CborldEncoder = class _CborldEncoder {
|
|
3122
3191
|
encode() {
|
|
3123
3192
|
throw new Error("Must be implemented by derived class.");
|
|
@@ -3130,7 +3199,7 @@ var _CborldEncoder = class _CborldEncoder {
|
|
|
3130
3199
|
__name(_CborldEncoder, "CborldEncoder");
|
|
3131
3200
|
var CborldEncoder = _CborldEncoder;
|
|
3132
3201
|
|
|
3133
|
-
// ../../../node_modules
|
|
3202
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/ContextEncoder.js
|
|
3134
3203
|
var _ContextEncoder = class _ContextEncoder extends CborldEncoder {
|
|
3135
3204
|
constructor({ context, appContextMap } = {}) {
|
|
3136
3205
|
super();
|
|
@@ -3156,7 +3225,7 @@ var _ContextEncoder = class _ContextEncoder extends CborldEncoder {
|
|
|
3156
3225
|
__name(_ContextEncoder, "ContextEncoder");
|
|
3157
3226
|
var ContextEncoder = _ContextEncoder;
|
|
3158
3227
|
|
|
3159
|
-
// ../../../node_modules
|
|
3228
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseEncoder.js
|
|
3160
3229
|
var _MultibaseEncoder = class _MultibaseEncoder extends CborldEncoder {
|
|
3161
3230
|
constructor({ value } = {}) {
|
|
3162
3231
|
super();
|
|
@@ -3190,7 +3259,7 @@ var _MultibaseEncoder = class _MultibaseEncoder extends CborldEncoder {
|
|
|
3190
3259
|
__name(_MultibaseEncoder, "MultibaseEncoder");
|
|
3191
3260
|
var MultibaseEncoder = _MultibaseEncoder;
|
|
3192
3261
|
|
|
3193
|
-
// ../../../node_modules
|
|
3262
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlEncoder.js
|
|
3194
3263
|
var SCHEME_TO_ID = /* @__PURE__ */ new Map([
|
|
3195
3264
|
["did:v1:nym:", 1024],
|
|
3196
3265
|
["did:key:", 1025]
|
|
@@ -3236,7 +3305,7 @@ function _multibase58ToToken(str) {
|
|
|
3236
3305
|
}
|
|
3237
3306
|
__name(_multibase58ToToken, "_multibase58ToToken");
|
|
3238
3307
|
|
|
3239
|
-
// ../../../node_modules
|
|
3308
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlEncoder.js
|
|
3240
3309
|
var _HttpUrlEncoder = class _HttpUrlEncoder extends CborldEncoder {
|
|
3241
3310
|
constructor({ value, secure } = {}) {
|
|
3242
3311
|
super();
|
|
@@ -3264,7 +3333,7 @@ var _HttpUrlEncoder = class _HttpUrlEncoder extends CborldEncoder {
|
|
|
3264
3333
|
__name(_HttpUrlEncoder, "HttpUrlEncoder");
|
|
3265
3334
|
var HttpUrlEncoder = _HttpUrlEncoder;
|
|
3266
3335
|
|
|
3267
|
-
// ../../../node_modules
|
|
3336
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnEncoder.js
|
|
3268
3337
|
var _UuidUrnEncoder = class _UuidUrnEncoder extends CborldEncoder {
|
|
3269
3338
|
constructor({ value } = {}) {
|
|
3270
3339
|
super();
|
|
@@ -3291,7 +3360,7 @@ var _UuidUrnEncoder = class _UuidUrnEncoder extends CborldEncoder {
|
|
|
3291
3360
|
__name(_UuidUrnEncoder, "UuidUrnEncoder");
|
|
3292
3361
|
var UuidUrnEncoder = _UuidUrnEncoder;
|
|
3293
3362
|
|
|
3294
|
-
// ../../../node_modules
|
|
3363
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/UriEncoder.js
|
|
3295
3364
|
var SCHEME_TO_ENCODER = /* @__PURE__ */ new Map([
|
|
3296
3365
|
["http", HttpUrlEncoder],
|
|
3297
3366
|
["https", HttpUrlEncoder],
|
|
@@ -3324,7 +3393,7 @@ var _UriEncoder = class _UriEncoder extends CborldEncoder {
|
|
|
3324
3393
|
__name(_UriEncoder, "UriEncoder");
|
|
3325
3394
|
var UriEncoder = _UriEncoder;
|
|
3326
3395
|
|
|
3327
|
-
// ../../../node_modules
|
|
3396
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermEncoder.js
|
|
3328
3397
|
var _VocabTermEncoder = class _VocabTermEncoder extends CborldEncoder {
|
|
3329
3398
|
constructor({ termId } = {}) {
|
|
3330
3399
|
super();
|
|
@@ -3345,7 +3414,7 @@ var _VocabTermEncoder = class _VocabTermEncoder extends CborldEncoder {
|
|
|
3345
3414
|
__name(_VocabTermEncoder, "VocabTermEncoder");
|
|
3346
3415
|
var VocabTermEncoder = _VocabTermEncoder;
|
|
3347
3416
|
|
|
3348
|
-
// ../../../node_modules
|
|
3417
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateEncoder.js
|
|
3349
3418
|
var _XsdDateEncoder = class _XsdDateEncoder extends CborldEncoder {
|
|
3350
3419
|
constructor({ value, parsed } = {}) {
|
|
3351
3420
|
super();
|
|
@@ -3376,7 +3445,7 @@ var _XsdDateEncoder = class _XsdDateEncoder extends CborldEncoder {
|
|
|
3376
3445
|
__name(_XsdDateEncoder, "XsdDateEncoder");
|
|
3377
3446
|
var XsdDateEncoder = _XsdDateEncoder;
|
|
3378
3447
|
|
|
3379
|
-
// ../../../node_modules
|
|
3448
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeEncoder.js
|
|
3380
3449
|
var _XsdDateTimeEncoder = class _XsdDateTimeEncoder extends CborldEncoder {
|
|
3381
3450
|
constructor({ value, parsed } = {}) {
|
|
3382
3451
|
super();
|
|
@@ -3424,7 +3493,7 @@ var _XsdDateTimeEncoder = class _XsdDateTimeEncoder extends CborldEncoder {
|
|
|
3424
3493
|
__name(_XsdDateTimeEncoder, "XsdDateTimeEncoder");
|
|
3425
3494
|
var XsdDateTimeEncoder = _XsdDateTimeEncoder;
|
|
3426
3495
|
|
|
3427
|
-
// ../../../node_modules
|
|
3496
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/Compressor.js
|
|
3428
3497
|
var TYPE_ENCODERS = /* @__PURE__ */ new Map([
|
|
3429
3498
|
["@id", UriEncoder],
|
|
3430
3499
|
["@vocab", VocabTermEncoder],
|
|
@@ -3580,7 +3649,7 @@ var _Compressor = class _Compressor extends Transformer {
|
|
|
3580
3649
|
__name(_Compressor, "Compressor");
|
|
3581
3650
|
var Compressor = _Compressor;
|
|
3582
3651
|
|
|
3583
|
-
// ../../../node_modules
|
|
3652
|
+
// ../../../node_modules/@digitalbazaar/cborld/lib/encode.js
|
|
3584
3653
|
async function encode5({
|
|
3585
3654
|
jsonldDocument,
|
|
3586
3655
|
documentLoader,
|
|
@@ -3613,7 +3682,7 @@ async function encode5({
|
|
|
3613
3682
|
}
|
|
3614
3683
|
__name(encode5, "encode");
|
|
3615
3684
|
|
|
3616
|
-
// ../../../node_modules
|
|
3685
|
+
// ../../../node_modules/to-data-view/index.js
|
|
3617
3686
|
function toDataView(data) {
|
|
3618
3687
|
if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray) {
|
|
3619
3688
|
return new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
@@ -3625,7 +3694,7 @@ function toDataView(data) {
|
|
|
3625
3694
|
}
|
|
3626
3695
|
__name(toDataView, "toDataView");
|
|
3627
3696
|
|
|
3628
|
-
// ../../../node_modules
|
|
3697
|
+
// ../../../node_modules/base32-encode/index.js
|
|
3629
3698
|
var RFC4648 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
3630
3699
|
var RFC4648_HEX = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
3631
3700
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
@@ -3674,10 +3743,10 @@ function base32Encode(data, variant, options) {
|
|
|
3674
3743
|
}
|
|
3675
3744
|
__name(base32Encode, "base32Encode");
|
|
3676
3745
|
|
|
3677
|
-
// ../../../node_modules
|
|
3746
|
+
// ../../../node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
|
3678
3747
|
var import_base32_decode = __toESM(require_base32_decode(), 1);
|
|
3679
3748
|
|
|
3680
|
-
// ../../../node_modules
|
|
3749
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/Mode.js
|
|
3681
3750
|
var Mode;
|
|
3682
3751
|
(function(Mode2) {
|
|
3683
3752
|
Mode2[Mode2["Terminator"] = 0] = "Terminator";
|
|
@@ -3689,7 +3758,7 @@ var Mode;
|
|
|
3689
3758
|
Mode2[Mode2["ECI"] = 7] = "ECI";
|
|
3690
3759
|
})(Mode || (Mode = {}));
|
|
3691
3760
|
|
|
3692
|
-
// ../../../node_modules
|
|
3761
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRData.js
|
|
3693
3762
|
var _QRData = class _QRData {
|
|
3694
3763
|
constructor(mode, data) {
|
|
3695
3764
|
this.bytes = [];
|
|
@@ -3749,7 +3818,7 @@ var _QRData = class _QRData {
|
|
|
3749
3818
|
__name(_QRData, "QRData");
|
|
3750
3819
|
var QRData = _QRData;
|
|
3751
3820
|
|
|
3752
|
-
// ../../../node_modules
|
|
3821
|
+
// ../../../node_modules/@nuintun/qrcode/esm/encoding/UTF8.js
|
|
3753
3822
|
function encode6(text) {
|
|
3754
3823
|
let pos = 0;
|
|
3755
3824
|
const { length } = text;
|
|
@@ -3777,7 +3846,7 @@ function encode6(text) {
|
|
|
3777
3846
|
}
|
|
3778
3847
|
__name(encode6, "encode");
|
|
3779
3848
|
|
|
3780
|
-
// ../../../node_modules
|
|
3849
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRByte.js
|
|
3781
3850
|
var _QRByte = class _QRByte extends QRData {
|
|
3782
3851
|
/**
|
|
3783
3852
|
* @constructor
|
|
@@ -3810,7 +3879,7 @@ var _QRByte = class _QRByte extends QRData {
|
|
|
3810
3879
|
__name(_QRByte, "QRByte");
|
|
3811
3880
|
var QRByte = _QRByte;
|
|
3812
3881
|
|
|
3813
|
-
// ../../../node_modules
|
|
3882
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRMath.js
|
|
3814
3883
|
var EXP_TABLE = [];
|
|
3815
3884
|
var LOG_TABLE = [];
|
|
3816
3885
|
for (let i = 0; i < 256; i++) {
|
|
@@ -3838,7 +3907,7 @@ function gexp(n) {
|
|
|
3838
3907
|
}
|
|
3839
3908
|
__name(gexp, "gexp");
|
|
3840
3909
|
|
|
3841
|
-
// ../../../node_modules
|
|
3910
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/Polynomial.js
|
|
3842
3911
|
var _Polynomial = class _Polynomial {
|
|
3843
3912
|
constructor(num, shift = 0) {
|
|
3844
3913
|
let offset = 0;
|
|
@@ -3897,7 +3966,7 @@ var _Polynomial = class _Polynomial {
|
|
|
3897
3966
|
__name(_Polynomial, "Polynomial");
|
|
3898
3967
|
var Polynomial = _Polynomial;
|
|
3899
3968
|
|
|
3900
|
-
// ../../../node_modules
|
|
3969
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRUtil.js
|
|
3901
3970
|
var N1 = 3;
|
|
3902
3971
|
var N2 = 3;
|
|
3903
3972
|
var N3 = 40;
|
|
@@ -4076,7 +4145,7 @@ function calculateMaskPenalty(qrcode) {
|
|
|
4076
4145
|
}
|
|
4077
4146
|
__name(calculateMaskPenalty, "calculateMaskPenalty");
|
|
4078
4147
|
|
|
4079
|
-
// ../../../node_modules
|
|
4148
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/ErrorCorrectionLevel.js
|
|
4080
4149
|
var ErrorCorrectionLevel;
|
|
4081
4150
|
(function(ErrorCorrectionLevel2) {
|
|
4082
4151
|
ErrorCorrectionLevel2[ErrorCorrectionLevel2["L"] = 1] = "L";
|
|
@@ -4085,7 +4154,7 @@ var ErrorCorrectionLevel;
|
|
|
4085
4154
|
ErrorCorrectionLevel2[ErrorCorrectionLevel2["H"] = 2] = "H";
|
|
4086
4155
|
})(ErrorCorrectionLevel || (ErrorCorrectionLevel = {}));
|
|
4087
4156
|
|
|
4088
|
-
// ../../../node_modules
|
|
4157
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/RSBlock.js
|
|
4089
4158
|
var _RSBlock = class _RSBlock {
|
|
4090
4159
|
constructor(totalCount, dataCount) {
|
|
4091
4160
|
this.dataCount = dataCount;
|
|
@@ -4335,7 +4404,7 @@ RSBlock.RS_BLOCK_TABLE = [
|
|
|
4335
4404
|
[20, 45, 15, 61, 46, 16]
|
|
4336
4405
|
];
|
|
4337
4406
|
|
|
4338
|
-
// ../../../node_modules
|
|
4407
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/BitBuffer.js
|
|
4339
4408
|
var _BitBuffer = class _BitBuffer {
|
|
4340
4409
|
constructor() {
|
|
4341
4410
|
this.length = 0;
|
|
@@ -4369,7 +4438,7 @@ var _BitBuffer = class _BitBuffer {
|
|
|
4369
4438
|
__name(_BitBuffer, "BitBuffer");
|
|
4370
4439
|
var BitBuffer = _BitBuffer;
|
|
4371
4440
|
|
|
4372
|
-
// ../../../node_modules
|
|
4441
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/Dict.js
|
|
4373
4442
|
var MAX_CODE = (1 << 12) - 1;
|
|
4374
4443
|
var _Dict = class _Dict {
|
|
4375
4444
|
constructor(depth) {
|
|
@@ -4409,7 +4478,7 @@ var _Dict = class _Dict {
|
|
|
4409
4478
|
__name(_Dict, "Dict");
|
|
4410
4479
|
var Dict = _Dict;
|
|
4411
4480
|
|
|
4412
|
-
// ../../../node_modules
|
|
4481
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/DictStream.js
|
|
4413
4482
|
var _DictStream = class _DictStream {
|
|
4414
4483
|
constructor(dict) {
|
|
4415
4484
|
this.bits = 0;
|
|
@@ -4455,7 +4524,7 @@ var _DictStream = class _DictStream {
|
|
|
4455
4524
|
__name(_DictStream, "DictStream");
|
|
4456
4525
|
var DictStream = _DictStream;
|
|
4457
4526
|
|
|
4458
|
-
// ../../../node_modules
|
|
4527
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/lzw/index.js
|
|
4459
4528
|
function compress(pixels, depth, stream) {
|
|
4460
4529
|
const dict = new Dict(depth);
|
|
4461
4530
|
const buffer2 = new DictStream(dict);
|
|
@@ -4484,7 +4553,7 @@ function compress(pixels, depth, stream) {
|
|
|
4484
4553
|
}
|
|
4485
4554
|
__name(compress, "compress");
|
|
4486
4555
|
|
|
4487
|
-
// ../../../node_modules
|
|
4556
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/ByteStream.js
|
|
4488
4557
|
var _ByteStream = class _ByteStream {
|
|
4489
4558
|
constructor() {
|
|
4490
4559
|
this.bytes = [];
|
|
@@ -4505,7 +4574,7 @@ var _ByteStream = class _ByteStream {
|
|
|
4505
4574
|
__name(_ByteStream, "ByteStream");
|
|
4506
4575
|
var ByteStream = _ByteStream;
|
|
4507
4576
|
|
|
4508
|
-
// ../../../node_modules
|
|
4577
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/Base64Stream.js
|
|
4509
4578
|
var { fromCharCode } = String;
|
|
4510
4579
|
function encode7(byte) {
|
|
4511
4580
|
byte &= 63;
|
|
@@ -4565,7 +4634,7 @@ var _Base64Stream = class _Base64Stream {
|
|
|
4565
4634
|
__name(_Base64Stream, "Base64Stream");
|
|
4566
4635
|
var Base64Stream = _Base64Stream;
|
|
4567
4636
|
|
|
4568
|
-
// ../../../node_modules
|
|
4637
|
+
// ../../../node_modules/@nuintun/qrcode/esm/image/GIFImage.js
|
|
4569
4638
|
var _GIFImage = class _GIFImage {
|
|
4570
4639
|
constructor(width, height, { foreground = [0, 0, 0], background = [255, 255, 255] } = {}) {
|
|
4571
4640
|
this.pixels = [];
|
|
@@ -4614,7 +4683,7 @@ var _GIFImage = class _GIFImage {
|
|
|
4614
4683
|
__name(_GIFImage, "GIFImage");
|
|
4615
4684
|
var GIFImage = _GIFImage;
|
|
4616
4685
|
|
|
4617
|
-
// ../../../node_modules
|
|
4686
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/common/MaskPattern.js
|
|
4618
4687
|
function getMaskFunc(maskPattern) {
|
|
4619
4688
|
switch (maskPattern) {
|
|
4620
4689
|
case 0:
|
|
@@ -4639,10 +4708,10 @@ function getMaskFunc(maskPattern) {
|
|
|
4639
4708
|
}
|
|
4640
4709
|
__name(getMaskFunc, "getMaskFunc");
|
|
4641
4710
|
|
|
4642
|
-
// ../../../node_modules
|
|
4711
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/Writer.js
|
|
4643
4712
|
var PAD0 = 236;
|
|
4644
4713
|
var PAD1 = 17;
|
|
4645
|
-
var { toString
|
|
4714
|
+
var { toString } = Object.prototype;
|
|
4646
4715
|
function appendECI(encoding, buffer2) {
|
|
4647
4716
|
if (encoding < 0 || encoding >= 1e6) {
|
|
4648
4717
|
throw new Error("byte mode encoding hint out of range");
|
|
@@ -4844,7 +4913,7 @@ var _Encoder = class _Encoder {
|
|
|
4844
4913
|
if (data instanceof QRData) {
|
|
4845
4914
|
chunks.push(data);
|
|
4846
4915
|
} else {
|
|
4847
|
-
const type =
|
|
4916
|
+
const type = toString.call(data);
|
|
4848
4917
|
if (type === "[object String]") {
|
|
4849
4918
|
chunks.push(new QRByte(data));
|
|
4850
4919
|
} else {
|
|
@@ -5082,7 +5151,7 @@ var _Encoder = class _Encoder {
|
|
|
5082
5151
|
__name(_Encoder, "Encoder");
|
|
5083
5152
|
var Encoder = _Encoder;
|
|
5084
5153
|
|
|
5085
|
-
// ../../../node_modules
|
|
5154
|
+
// ../../../node_modules/@nuintun/qrcode/esm/encoding/UTF16.js
|
|
5086
5155
|
function encode8(text) {
|
|
5087
5156
|
const { length } = text;
|
|
5088
5157
|
const bytes = [];
|
|
@@ -5093,7 +5162,7 @@ function encode8(text) {
|
|
|
5093
5162
|
}
|
|
5094
5163
|
__name(encode8, "encode");
|
|
5095
5164
|
|
|
5096
|
-
// ../../../node_modules
|
|
5165
|
+
// ../../../node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRAlphanumeric.js
|
|
5097
5166
|
function getByte(byte) {
|
|
5098
5167
|
if (48 <= byte && byte <= 57) {
|
|
5099
5168
|
return byte - 48;
|
|
@@ -5164,7 +5233,7 @@ var _QRAlphanumeric = class _QRAlphanumeric extends QRData {
|
|
|
5164
5233
|
__name(_QRAlphanumeric, "QRAlphanumeric");
|
|
5165
5234
|
var QRAlphanumeric = _QRAlphanumeric;
|
|
5166
5235
|
|
|
5167
|
-
// ../../../node_modules
|
|
5236
|
+
// ../../../node_modules/@digitalbazaar/vpqr/lib/vpqr.js
|
|
5168
5237
|
var VP_QR_VERSION = "VP1";
|
|
5169
5238
|
var BASE_32_UPPERCASE_MULTIBASE_PREFIX = "B";
|
|
5170
5239
|
function _bytesToQrCodeDataUrl({ bytes, size }) {
|