@learncard/core 6.1.0 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core.cjs.development.js +3390 -155
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +196 -120
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +213 -42
- package/dist/core.esm.js +3390 -155
- package/dist/core.esm.js.map +3 -3
- package/package.json +4 -1
@@ -2881,9 +2881,9 @@ var require_package = __commonJS({
|
|
2881
2881
|
}
|
2882
2882
|
});
|
2883
2883
|
|
2884
|
-
// (disabled):../../node_modules/.pnpm/buffer@5.
|
2884
|
+
// (disabled):../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js
|
2885
2885
|
var require_buffer = __commonJS({
|
2886
|
-
"(disabled):../../node_modules/.pnpm/buffer@5.
|
2886
|
+
"(disabled):../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js"() {
|
2887
2887
|
}
|
2888
2888
|
});
|
2889
2889
|
|
@@ -2930,12 +2930,12 @@ var require_bn = __commonJS({
|
|
2930
2930
|
}
|
2931
2931
|
BN3.BN = BN3;
|
2932
2932
|
BN3.wordSize = 26;
|
2933
|
-
var
|
2933
|
+
var Buffer3;
|
2934
2934
|
try {
|
2935
2935
|
if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") {
|
2936
|
-
|
2936
|
+
Buffer3 = window.Buffer;
|
2937
2937
|
} else {
|
2938
|
-
|
2938
|
+
Buffer3 = require_buffer().Buffer;
|
2939
2939
|
}
|
2940
2940
|
} catch (e) {
|
2941
2941
|
}
|
@@ -3376,8 +3376,8 @@ var require_bn = __commonJS({
|
|
3376
3376
|
return this.toString(16);
|
3377
3377
|
}, "toJSON");
|
3378
3378
|
BN3.prototype.toBuffer = /* @__PURE__ */ __name(function toBuffer(endian, length2) {
|
3379
|
-
assert2(typeof
|
3380
|
-
return this.toArrayLike(
|
3379
|
+
assert2(typeof Buffer3 !== "undefined");
|
3380
|
+
return this.toArrayLike(Buffer3, endian, length2);
|
3381
3381
|
}, "toBuffer");
|
3382
3382
|
BN3.prototype.toArray = /* @__PURE__ */ __name(function toArray(endian, length2) {
|
3383
3383
|
return this.toArrayLike(Array, endian, length2);
|
@@ -23413,12 +23413,12 @@ var require_bn2 = __commonJS({
|
|
23413
23413
|
}
|
23414
23414
|
BN3.BN = BN3;
|
23415
23415
|
BN3.wordSize = 26;
|
23416
|
-
var
|
23416
|
+
var Buffer3;
|
23417
23417
|
try {
|
23418
23418
|
if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") {
|
23419
|
-
|
23419
|
+
Buffer3 = window.Buffer;
|
23420
23420
|
} else {
|
23421
|
-
|
23421
|
+
Buffer3 = require_buffer().Buffer;
|
23422
23422
|
}
|
23423
23423
|
} catch (e) {
|
23424
23424
|
}
|
@@ -23883,9 +23883,9 @@ var require_bn2 = __commonJS({
|
|
23883
23883
|
BN3.prototype.toJSON = /* @__PURE__ */ __name(function toJSON2() {
|
23884
23884
|
return this.toString(16, 2);
|
23885
23885
|
}, "toJSON");
|
23886
|
-
if (
|
23886
|
+
if (Buffer3) {
|
23887
23887
|
BN3.prototype.toBuffer = /* @__PURE__ */ __name(function toBuffer(endian, length2) {
|
23888
|
-
return this.toArrayLike(
|
23888
|
+
return this.toArrayLike(Buffer3, endian, length2);
|
23889
23889
|
}, "toBuffer");
|
23890
23890
|
}
|
23891
23891
|
BN3.prototype.toArray = /* @__PURE__ */ __name(function toArray(endian, length2) {
|
@@ -27421,7 +27421,7 @@ var require_lodash = __commonJS({
|
|
27421
27421
|
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
27422
27422
|
var objectToString = objectProto.toString;
|
27423
27423
|
var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
27424
|
-
var
|
27424
|
+
var Buffer3 = moduleExports ? root.Buffer : void 0;
|
27425
27425
|
var Symbol2 = root.Symbol;
|
27426
27426
|
var Uint8Array2 = root.Uint8Array;
|
27427
27427
|
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
@@ -27429,7 +27429,7 @@ var require_lodash = __commonJS({
|
|
27429
27429
|
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
27430
27430
|
var splice = arrayProto.splice;
|
27431
27431
|
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
27432
|
-
var nativeIsBuffer =
|
27432
|
+
var nativeIsBuffer = Buffer3 ? Buffer3.isBuffer : void 0;
|
27433
27433
|
var nativeKeys = overArg(Object.keys, Object);
|
27434
27434
|
var DataView2 = getNative(root, "DataView");
|
27435
27435
|
var Map2 = getNative(root, "Map");
|
@@ -28453,7 +28453,7 @@ var require_dataloader = __commonJS({
|
|
28453
28453
|
}
|
28454
28454
|
__name(DataLoader3, "DataLoader");
|
28455
28455
|
var _proto = DataLoader3.prototype;
|
28456
|
-
_proto.load = /* @__PURE__ */ __name(function
|
28456
|
+
_proto.load = /* @__PURE__ */ __name(function load3(key2) {
|
28457
28457
|
if (key2 === null || key2 === void 0) {
|
28458
28458
|
throw new TypeError("The loader.load() function must be called with a value, " + ("but got: " + String(key2) + "."));
|
28459
28459
|
}
|
@@ -29261,6 +29261,1667 @@ var require_src3 = __commonJS({
|
|
29261
29261
|
}
|
29262
29262
|
});
|
29263
29263
|
|
29264
|
+
// ../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
|
29265
|
+
var require_base64_js = __commonJS({
|
29266
|
+
"../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js"(exports) {
|
29267
|
+
"use strict";
|
29268
|
+
exports.byteLength = byteLength;
|
29269
|
+
exports.toByteArray = toByteArray;
|
29270
|
+
exports.fromByteArray = fromByteArray;
|
29271
|
+
var lookup = [];
|
29272
|
+
var revLookup = [];
|
29273
|
+
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
29274
|
+
var code5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
29275
|
+
for (i = 0, len = code5.length; i < len; ++i) {
|
29276
|
+
lookup[i] = code5[i];
|
29277
|
+
revLookup[code5.charCodeAt(i)] = i;
|
29278
|
+
}
|
29279
|
+
var i;
|
29280
|
+
var len;
|
29281
|
+
revLookup["-".charCodeAt(0)] = 62;
|
29282
|
+
revLookup["_".charCodeAt(0)] = 63;
|
29283
|
+
function getLens(b64) {
|
29284
|
+
var len2 = b64.length;
|
29285
|
+
if (len2 % 4 > 0) {
|
29286
|
+
throw new Error("Invalid string. Length must be a multiple of 4");
|
29287
|
+
}
|
29288
|
+
var validLen = b64.indexOf("=");
|
29289
|
+
if (validLen === -1)
|
29290
|
+
validLen = len2;
|
29291
|
+
var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
|
29292
|
+
return [validLen, placeHoldersLen];
|
29293
|
+
}
|
29294
|
+
__name(getLens, "getLens");
|
29295
|
+
function byteLength(b64) {
|
29296
|
+
var lens = getLens(b64);
|
29297
|
+
var validLen = lens[0];
|
29298
|
+
var placeHoldersLen = lens[1];
|
29299
|
+
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
29300
|
+
}
|
29301
|
+
__name(byteLength, "byteLength");
|
29302
|
+
function _byteLength(b64, validLen, placeHoldersLen) {
|
29303
|
+
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
29304
|
+
}
|
29305
|
+
__name(_byteLength, "_byteLength");
|
29306
|
+
function toByteArray(b64) {
|
29307
|
+
var tmp;
|
29308
|
+
var lens = getLens(b64);
|
29309
|
+
var validLen = lens[0];
|
29310
|
+
var placeHoldersLen = lens[1];
|
29311
|
+
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
|
29312
|
+
var curByte = 0;
|
29313
|
+
var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
|
29314
|
+
var i2;
|
29315
|
+
for (i2 = 0; i2 < len2; i2 += 4) {
|
29316
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];
|
29317
|
+
arr[curByte++] = tmp >> 16 & 255;
|
29318
|
+
arr[curByte++] = tmp >> 8 & 255;
|
29319
|
+
arr[curByte++] = tmp & 255;
|
29320
|
+
}
|
29321
|
+
if (placeHoldersLen === 2) {
|
29322
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;
|
29323
|
+
arr[curByte++] = tmp & 255;
|
29324
|
+
}
|
29325
|
+
if (placeHoldersLen === 1) {
|
29326
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;
|
29327
|
+
arr[curByte++] = tmp >> 8 & 255;
|
29328
|
+
arr[curByte++] = tmp & 255;
|
29329
|
+
}
|
29330
|
+
return arr;
|
29331
|
+
}
|
29332
|
+
__name(toByteArray, "toByteArray");
|
29333
|
+
function tripletToBase64(num) {
|
29334
|
+
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
|
29335
|
+
}
|
29336
|
+
__name(tripletToBase64, "tripletToBase64");
|
29337
|
+
function encodeChunk(uint8, start, end) {
|
29338
|
+
var tmp;
|
29339
|
+
var output = [];
|
29340
|
+
for (var i2 = start; i2 < end; i2 += 3) {
|
29341
|
+
tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
|
29342
|
+
output.push(tripletToBase64(tmp));
|
29343
|
+
}
|
29344
|
+
return output.join("");
|
29345
|
+
}
|
29346
|
+
__name(encodeChunk, "encodeChunk");
|
29347
|
+
function fromByteArray(uint8) {
|
29348
|
+
var tmp;
|
29349
|
+
var len2 = uint8.length;
|
29350
|
+
var extraBytes = len2 % 3;
|
29351
|
+
var parts = [];
|
29352
|
+
var maxChunkLength = 16383;
|
29353
|
+
for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {
|
29354
|
+
parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));
|
29355
|
+
}
|
29356
|
+
if (extraBytes === 1) {
|
29357
|
+
tmp = uint8[len2 - 1];
|
29358
|
+
parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");
|
29359
|
+
} else if (extraBytes === 2) {
|
29360
|
+
tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
|
29361
|
+
parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");
|
29362
|
+
}
|
29363
|
+
return parts.join("");
|
29364
|
+
}
|
29365
|
+
__name(fromByteArray, "fromByteArray");
|
29366
|
+
}
|
29367
|
+
});
|
29368
|
+
|
29369
|
+
// ../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
|
29370
|
+
var require_ieee754 = __commonJS({
|
29371
|
+
"../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js"(exports) {
|
29372
|
+
exports.read = function(buffer2, offset, isLE, mLen, nBytes) {
|
29373
|
+
var e, m;
|
29374
|
+
var eLen = nBytes * 8 - mLen - 1;
|
29375
|
+
var eMax = (1 << eLen) - 1;
|
29376
|
+
var eBias = eMax >> 1;
|
29377
|
+
var nBits = -7;
|
29378
|
+
var i = isLE ? nBytes - 1 : 0;
|
29379
|
+
var d = isLE ? -1 : 1;
|
29380
|
+
var s = buffer2[offset + i];
|
29381
|
+
i += d;
|
29382
|
+
e = s & (1 << -nBits) - 1;
|
29383
|
+
s >>= -nBits;
|
29384
|
+
nBits += eLen;
|
29385
|
+
for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d, nBits -= 8) {
|
29386
|
+
}
|
29387
|
+
m = e & (1 << -nBits) - 1;
|
29388
|
+
e >>= -nBits;
|
29389
|
+
nBits += mLen;
|
29390
|
+
for (; nBits > 0; m = m * 256 + buffer2[offset + i], i += d, nBits -= 8) {
|
29391
|
+
}
|
29392
|
+
if (e === 0) {
|
29393
|
+
e = 1 - eBias;
|
29394
|
+
} else if (e === eMax) {
|
29395
|
+
return m ? NaN : (s ? -1 : 1) * Infinity;
|
29396
|
+
} else {
|
29397
|
+
m = m + Math.pow(2, mLen);
|
29398
|
+
e = e - eBias;
|
29399
|
+
}
|
29400
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
29401
|
+
};
|
29402
|
+
exports.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
29403
|
+
var e, m, c;
|
29404
|
+
var eLen = nBytes * 8 - mLen - 1;
|
29405
|
+
var eMax = (1 << eLen) - 1;
|
29406
|
+
var eBias = eMax >> 1;
|
29407
|
+
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
29408
|
+
var i = isLE ? 0 : nBytes - 1;
|
29409
|
+
var d = isLE ? 1 : -1;
|
29410
|
+
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
29411
|
+
value = Math.abs(value);
|
29412
|
+
if (isNaN(value) || value === Infinity) {
|
29413
|
+
m = isNaN(value) ? 1 : 0;
|
29414
|
+
e = eMax;
|
29415
|
+
} else {
|
29416
|
+
e = Math.floor(Math.log(value) / Math.LN2);
|
29417
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
29418
|
+
e--;
|
29419
|
+
c *= 2;
|
29420
|
+
}
|
29421
|
+
if (e + eBias >= 1) {
|
29422
|
+
value += rt / c;
|
29423
|
+
} else {
|
29424
|
+
value += rt * Math.pow(2, 1 - eBias);
|
29425
|
+
}
|
29426
|
+
if (value * c >= 2) {
|
29427
|
+
e++;
|
29428
|
+
c /= 2;
|
29429
|
+
}
|
29430
|
+
if (e + eBias >= eMax) {
|
29431
|
+
m = 0;
|
29432
|
+
e = eMax;
|
29433
|
+
} else if (e + eBias >= 1) {
|
29434
|
+
m = (value * c - 1) * Math.pow(2, mLen);
|
29435
|
+
e = e + eBias;
|
29436
|
+
} else {
|
29437
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
29438
|
+
e = 0;
|
29439
|
+
}
|
29440
|
+
}
|
29441
|
+
for (; mLen >= 8; buffer2[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
|
29442
|
+
}
|
29443
|
+
e = e << mLen | m;
|
29444
|
+
eLen += mLen;
|
29445
|
+
for (; eLen > 0; buffer2[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
|
29446
|
+
}
|
29447
|
+
buffer2[offset + i - d] |= s * 128;
|
29448
|
+
};
|
29449
|
+
}
|
29450
|
+
});
|
29451
|
+
|
29452
|
+
// ../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js
|
29453
|
+
var require_buffer2 = __commonJS({
|
29454
|
+
"../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js"(exports) {
|
29455
|
+
"use strict";
|
29456
|
+
var base642 = require_base64_js();
|
29457
|
+
var ieee754 = require_ieee754();
|
29458
|
+
var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
29459
|
+
exports.Buffer = Buffer3;
|
29460
|
+
exports.SlowBuffer = SlowBuffer;
|
29461
|
+
exports.INSPECT_MAX_BYTES = 50;
|
29462
|
+
var K_MAX_LENGTH = 2147483647;
|
29463
|
+
exports.kMaxLength = K_MAX_LENGTH;
|
29464
|
+
Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
29465
|
+
if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
|
29466
|
+
console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
|
29467
|
+
}
|
29468
|
+
function typedArraySupport() {
|
29469
|
+
try {
|
29470
|
+
var arr = new Uint8Array(1);
|
29471
|
+
var proto = { foo: function() {
|
29472
|
+
return 42;
|
29473
|
+
} };
|
29474
|
+
Object.setPrototypeOf(proto, Uint8Array.prototype);
|
29475
|
+
Object.setPrototypeOf(arr, proto);
|
29476
|
+
return arr.foo() === 42;
|
29477
|
+
} catch (e) {
|
29478
|
+
return false;
|
29479
|
+
}
|
29480
|
+
}
|
29481
|
+
__name(typedArraySupport, "typedArraySupport");
|
29482
|
+
Object.defineProperty(Buffer3.prototype, "parent", {
|
29483
|
+
enumerable: true,
|
29484
|
+
get: function() {
|
29485
|
+
if (!Buffer3.isBuffer(this))
|
29486
|
+
return void 0;
|
29487
|
+
return this.buffer;
|
29488
|
+
}
|
29489
|
+
});
|
29490
|
+
Object.defineProperty(Buffer3.prototype, "offset", {
|
29491
|
+
enumerable: true,
|
29492
|
+
get: function() {
|
29493
|
+
if (!Buffer3.isBuffer(this))
|
29494
|
+
return void 0;
|
29495
|
+
return this.byteOffset;
|
29496
|
+
}
|
29497
|
+
});
|
29498
|
+
function createBuffer(length2) {
|
29499
|
+
if (length2 > K_MAX_LENGTH) {
|
29500
|
+
throw new RangeError('The value "' + length2 + '" is invalid for option "size"');
|
29501
|
+
}
|
29502
|
+
var buf2 = new Uint8Array(length2);
|
29503
|
+
Object.setPrototypeOf(buf2, Buffer3.prototype);
|
29504
|
+
return buf2;
|
29505
|
+
}
|
29506
|
+
__name(createBuffer, "createBuffer");
|
29507
|
+
function Buffer3(arg, encodingOrOffset, length2) {
|
29508
|
+
if (typeof arg === "number") {
|
29509
|
+
if (typeof encodingOrOffset === "string") {
|
29510
|
+
throw new TypeError('The "string" argument must be of type string. Received type number');
|
29511
|
+
}
|
29512
|
+
return allocUnsafe(arg);
|
29513
|
+
}
|
29514
|
+
return from4(arg, encodingOrOffset, length2);
|
29515
|
+
}
|
29516
|
+
__name(Buffer3, "Buffer");
|
29517
|
+
Buffer3.poolSize = 8192;
|
29518
|
+
function from4(value, encodingOrOffset, length2) {
|
29519
|
+
if (typeof value === "string") {
|
29520
|
+
return fromString6(value, encodingOrOffset);
|
29521
|
+
}
|
29522
|
+
if (ArrayBuffer.isView(value)) {
|
29523
|
+
return fromArrayView(value);
|
29524
|
+
}
|
29525
|
+
if (value == null) {
|
29526
|
+
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
|
29527
|
+
}
|
29528
|
+
if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
|
29529
|
+
return fromArrayBuffer(value, encodingOrOffset, length2);
|
29530
|
+
}
|
29531
|
+
if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
|
29532
|
+
return fromArrayBuffer(value, encodingOrOffset, length2);
|
29533
|
+
}
|
29534
|
+
if (typeof value === "number") {
|
29535
|
+
throw new TypeError('The "value" argument must not be of type number. Received type number');
|
29536
|
+
}
|
29537
|
+
var valueOf = value.valueOf && value.valueOf();
|
29538
|
+
if (valueOf != null && valueOf !== value) {
|
29539
|
+
return Buffer3.from(valueOf, encodingOrOffset, length2);
|
29540
|
+
}
|
29541
|
+
var b = fromObject(value);
|
29542
|
+
if (b)
|
29543
|
+
return b;
|
29544
|
+
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
|
29545
|
+
return Buffer3.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length2);
|
29546
|
+
}
|
29547
|
+
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
|
29548
|
+
}
|
29549
|
+
__name(from4, "from");
|
29550
|
+
Buffer3.from = function(value, encodingOrOffset, length2) {
|
29551
|
+
return from4(value, encodingOrOffset, length2);
|
29552
|
+
};
|
29553
|
+
Object.setPrototypeOf(Buffer3.prototype, Uint8Array.prototype);
|
29554
|
+
Object.setPrototypeOf(Buffer3, Uint8Array);
|
29555
|
+
function assertSize(size) {
|
29556
|
+
if (typeof size !== "number") {
|
29557
|
+
throw new TypeError('"size" argument must be of type number');
|
29558
|
+
} else if (size < 0) {
|
29559
|
+
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
29560
|
+
}
|
29561
|
+
}
|
29562
|
+
__name(assertSize, "assertSize");
|
29563
|
+
function alloc2(size, fill, encoding) {
|
29564
|
+
assertSize(size);
|
29565
|
+
if (size <= 0) {
|
29566
|
+
return createBuffer(size);
|
29567
|
+
}
|
29568
|
+
if (fill !== void 0) {
|
29569
|
+
return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
|
29570
|
+
}
|
29571
|
+
return createBuffer(size);
|
29572
|
+
}
|
29573
|
+
__name(alloc2, "alloc");
|
29574
|
+
Buffer3.alloc = function(size, fill, encoding) {
|
29575
|
+
return alloc2(size, fill, encoding);
|
29576
|
+
};
|
29577
|
+
function allocUnsafe(size) {
|
29578
|
+
assertSize(size);
|
29579
|
+
return createBuffer(size < 0 ? 0 : checked(size) | 0);
|
29580
|
+
}
|
29581
|
+
__name(allocUnsafe, "allocUnsafe");
|
29582
|
+
Buffer3.allocUnsafe = function(size) {
|
29583
|
+
return allocUnsafe(size);
|
29584
|
+
};
|
29585
|
+
Buffer3.allocUnsafeSlow = function(size) {
|
29586
|
+
return allocUnsafe(size);
|
29587
|
+
};
|
29588
|
+
function fromString6(string2, encoding) {
|
29589
|
+
if (typeof encoding !== "string" || encoding === "") {
|
29590
|
+
encoding = "utf8";
|
29591
|
+
}
|
29592
|
+
if (!Buffer3.isEncoding(encoding)) {
|
29593
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
29594
|
+
}
|
29595
|
+
var length2 = byteLength(string2, encoding) | 0;
|
29596
|
+
var buf2 = createBuffer(length2);
|
29597
|
+
var actual = buf2.write(string2, encoding);
|
29598
|
+
if (actual !== length2) {
|
29599
|
+
buf2 = buf2.slice(0, actual);
|
29600
|
+
}
|
29601
|
+
return buf2;
|
29602
|
+
}
|
29603
|
+
__name(fromString6, "fromString");
|
29604
|
+
function fromArrayLike2(array) {
|
29605
|
+
var length2 = array.length < 0 ? 0 : checked(array.length) | 0;
|
29606
|
+
var buf2 = createBuffer(length2);
|
29607
|
+
for (var i = 0; i < length2; i += 1) {
|
29608
|
+
buf2[i] = array[i] & 255;
|
29609
|
+
}
|
29610
|
+
return buf2;
|
29611
|
+
}
|
29612
|
+
__name(fromArrayLike2, "fromArrayLike");
|
29613
|
+
function fromArrayView(arrayView) {
|
29614
|
+
if (isInstance(arrayView, Uint8Array)) {
|
29615
|
+
var copy = new Uint8Array(arrayView);
|
29616
|
+
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
|
29617
|
+
}
|
29618
|
+
return fromArrayLike2(arrayView);
|
29619
|
+
}
|
29620
|
+
__name(fromArrayView, "fromArrayView");
|
29621
|
+
function fromArrayBuffer(array, byteOffset, length2) {
|
29622
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
29623
|
+
throw new RangeError('"offset" is outside of buffer bounds');
|
29624
|
+
}
|
29625
|
+
if (array.byteLength < byteOffset + (length2 || 0)) {
|
29626
|
+
throw new RangeError('"length" is outside of buffer bounds');
|
29627
|
+
}
|
29628
|
+
var buf2;
|
29629
|
+
if (byteOffset === void 0 && length2 === void 0) {
|
29630
|
+
buf2 = new Uint8Array(array);
|
29631
|
+
} else if (length2 === void 0) {
|
29632
|
+
buf2 = new Uint8Array(array, byteOffset);
|
29633
|
+
} else {
|
29634
|
+
buf2 = new Uint8Array(array, byteOffset, length2);
|
29635
|
+
}
|
29636
|
+
Object.setPrototypeOf(buf2, Buffer3.prototype);
|
29637
|
+
return buf2;
|
29638
|
+
}
|
29639
|
+
__name(fromArrayBuffer, "fromArrayBuffer");
|
29640
|
+
function fromObject(obj) {
|
29641
|
+
if (Buffer3.isBuffer(obj)) {
|
29642
|
+
var len = checked(obj.length) | 0;
|
29643
|
+
var buf2 = createBuffer(len);
|
29644
|
+
if (buf2.length === 0) {
|
29645
|
+
return buf2;
|
29646
|
+
}
|
29647
|
+
obj.copy(buf2, 0, 0, len);
|
29648
|
+
return buf2;
|
29649
|
+
}
|
29650
|
+
if (obj.length !== void 0) {
|
29651
|
+
if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
|
29652
|
+
return createBuffer(0);
|
29653
|
+
}
|
29654
|
+
return fromArrayLike2(obj);
|
29655
|
+
}
|
29656
|
+
if (obj.type === "Buffer" && Array.isArray(obj.data)) {
|
29657
|
+
return fromArrayLike2(obj.data);
|
29658
|
+
}
|
29659
|
+
}
|
29660
|
+
__name(fromObject, "fromObject");
|
29661
|
+
function checked(length2) {
|
29662
|
+
if (length2 >= K_MAX_LENGTH) {
|
29663
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
|
29664
|
+
}
|
29665
|
+
return length2 | 0;
|
29666
|
+
}
|
29667
|
+
__name(checked, "checked");
|
29668
|
+
function SlowBuffer(length2) {
|
29669
|
+
if (+length2 != length2) {
|
29670
|
+
length2 = 0;
|
29671
|
+
}
|
29672
|
+
return Buffer3.alloc(+length2);
|
29673
|
+
}
|
29674
|
+
__name(SlowBuffer, "SlowBuffer");
|
29675
|
+
Buffer3.isBuffer = /* @__PURE__ */ __name(function isBuffer3(b) {
|
29676
|
+
return b != null && b._isBuffer === true && b !== Buffer3.prototype;
|
29677
|
+
}, "isBuffer");
|
29678
|
+
Buffer3.compare = /* @__PURE__ */ __name(function compare4(a, b) {
|
29679
|
+
if (isInstance(a, Uint8Array))
|
29680
|
+
a = Buffer3.from(a, a.offset, a.byteLength);
|
29681
|
+
if (isInstance(b, Uint8Array))
|
29682
|
+
b = Buffer3.from(b, b.offset, b.byteLength);
|
29683
|
+
if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b)) {
|
29684
|
+
throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
|
29685
|
+
}
|
29686
|
+
if (a === b)
|
29687
|
+
return 0;
|
29688
|
+
var x = a.length;
|
29689
|
+
var y = b.length;
|
29690
|
+
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
29691
|
+
if (a[i] !== b[i]) {
|
29692
|
+
x = a[i];
|
29693
|
+
y = b[i];
|
29694
|
+
break;
|
29695
|
+
}
|
29696
|
+
}
|
29697
|
+
if (x < y)
|
29698
|
+
return -1;
|
29699
|
+
if (y < x)
|
29700
|
+
return 1;
|
29701
|
+
return 0;
|
29702
|
+
}, "compare");
|
29703
|
+
Buffer3.isEncoding = /* @__PURE__ */ __name(function isEncoding(encoding) {
|
29704
|
+
switch (String(encoding).toLowerCase()) {
|
29705
|
+
case "hex":
|
29706
|
+
case "utf8":
|
29707
|
+
case "utf-8":
|
29708
|
+
case "ascii":
|
29709
|
+
case "latin1":
|
29710
|
+
case "binary":
|
29711
|
+
case "base64":
|
29712
|
+
case "ucs2":
|
29713
|
+
case "ucs-2":
|
29714
|
+
case "utf16le":
|
29715
|
+
case "utf-16le":
|
29716
|
+
return true;
|
29717
|
+
default:
|
29718
|
+
return false;
|
29719
|
+
}
|
29720
|
+
}, "isEncoding");
|
29721
|
+
Buffer3.concat = /* @__PURE__ */ __name(function concat4(list, length2) {
|
29722
|
+
if (!Array.isArray(list)) {
|
29723
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
29724
|
+
}
|
29725
|
+
if (list.length === 0) {
|
29726
|
+
return Buffer3.alloc(0);
|
29727
|
+
}
|
29728
|
+
var i;
|
29729
|
+
if (length2 === void 0) {
|
29730
|
+
length2 = 0;
|
29731
|
+
for (i = 0; i < list.length; ++i) {
|
29732
|
+
length2 += list[i].length;
|
29733
|
+
}
|
29734
|
+
}
|
29735
|
+
var buffer2 = Buffer3.allocUnsafe(length2);
|
29736
|
+
var pos = 0;
|
29737
|
+
for (i = 0; i < list.length; ++i) {
|
29738
|
+
var buf2 = list[i];
|
29739
|
+
if (isInstance(buf2, Uint8Array)) {
|
29740
|
+
if (pos + buf2.length > buffer2.length) {
|
29741
|
+
Buffer3.from(buf2).copy(buffer2, pos);
|
29742
|
+
} else {
|
29743
|
+
Uint8Array.prototype.set.call(buffer2, buf2, pos);
|
29744
|
+
}
|
29745
|
+
} else if (!Buffer3.isBuffer(buf2)) {
|
29746
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
29747
|
+
} else {
|
29748
|
+
buf2.copy(buffer2, pos);
|
29749
|
+
}
|
29750
|
+
pos += buf2.length;
|
29751
|
+
}
|
29752
|
+
return buffer2;
|
29753
|
+
}, "concat");
|
29754
|
+
function byteLength(string2, encoding) {
|
29755
|
+
if (Buffer3.isBuffer(string2)) {
|
29756
|
+
return string2.length;
|
29757
|
+
}
|
29758
|
+
if (ArrayBuffer.isView(string2) || isInstance(string2, ArrayBuffer)) {
|
29759
|
+
return string2.byteLength;
|
29760
|
+
}
|
29761
|
+
if (typeof string2 !== "string") {
|
29762
|
+
throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string2);
|
29763
|
+
}
|
29764
|
+
var len = string2.length;
|
29765
|
+
var mustMatch = arguments.length > 2 && arguments[2] === true;
|
29766
|
+
if (!mustMatch && len === 0)
|
29767
|
+
return 0;
|
29768
|
+
var loweredCase = false;
|
29769
|
+
for (; ; ) {
|
29770
|
+
switch (encoding) {
|
29771
|
+
case "ascii":
|
29772
|
+
case "latin1":
|
29773
|
+
case "binary":
|
29774
|
+
return len;
|
29775
|
+
case "utf8":
|
29776
|
+
case "utf-8":
|
29777
|
+
return utf8ToBytes2(string2).length;
|
29778
|
+
case "ucs2":
|
29779
|
+
case "ucs-2":
|
29780
|
+
case "utf16le":
|
29781
|
+
case "utf-16le":
|
29782
|
+
return len * 2;
|
29783
|
+
case "hex":
|
29784
|
+
return len >>> 1;
|
29785
|
+
case "base64":
|
29786
|
+
return base64ToBytes2(string2).length;
|
29787
|
+
default:
|
29788
|
+
if (loweredCase) {
|
29789
|
+
return mustMatch ? -1 : utf8ToBytes2(string2).length;
|
29790
|
+
}
|
29791
|
+
encoding = ("" + encoding).toLowerCase();
|
29792
|
+
loweredCase = true;
|
29793
|
+
}
|
29794
|
+
}
|
29795
|
+
}
|
29796
|
+
__name(byteLength, "byteLength");
|
29797
|
+
Buffer3.byteLength = byteLength;
|
29798
|
+
function slowToString(encoding, start, end) {
|
29799
|
+
var loweredCase = false;
|
29800
|
+
if (start === void 0 || start < 0) {
|
29801
|
+
start = 0;
|
29802
|
+
}
|
29803
|
+
if (start > this.length) {
|
29804
|
+
return "";
|
29805
|
+
}
|
29806
|
+
if (end === void 0 || end > this.length) {
|
29807
|
+
end = this.length;
|
29808
|
+
}
|
29809
|
+
if (end <= 0) {
|
29810
|
+
return "";
|
29811
|
+
}
|
29812
|
+
end >>>= 0;
|
29813
|
+
start >>>= 0;
|
29814
|
+
if (end <= start) {
|
29815
|
+
return "";
|
29816
|
+
}
|
29817
|
+
if (!encoding)
|
29818
|
+
encoding = "utf8";
|
29819
|
+
while (true) {
|
29820
|
+
switch (encoding) {
|
29821
|
+
case "hex":
|
29822
|
+
return hexSlice(this, start, end);
|
29823
|
+
case "utf8":
|
29824
|
+
case "utf-8":
|
29825
|
+
return utf8Slice2(this, start, end);
|
29826
|
+
case "ascii":
|
29827
|
+
return asciiSlice(this, start, end);
|
29828
|
+
case "latin1":
|
29829
|
+
case "binary":
|
29830
|
+
return latin1Slice(this, start, end);
|
29831
|
+
case "base64":
|
29832
|
+
return base64Slice(this, start, end);
|
29833
|
+
case "ucs2":
|
29834
|
+
case "ucs-2":
|
29835
|
+
case "utf16le":
|
29836
|
+
case "utf-16le":
|
29837
|
+
return utf16leSlice(this, start, end);
|
29838
|
+
default:
|
29839
|
+
if (loweredCase)
|
29840
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
29841
|
+
encoding = (encoding + "").toLowerCase();
|
29842
|
+
loweredCase = true;
|
29843
|
+
}
|
29844
|
+
}
|
29845
|
+
}
|
29846
|
+
__name(slowToString, "slowToString");
|
29847
|
+
Buffer3.prototype._isBuffer = true;
|
29848
|
+
function swap(b, n, m) {
|
29849
|
+
var i = b[n];
|
29850
|
+
b[n] = b[m];
|
29851
|
+
b[m] = i;
|
29852
|
+
}
|
29853
|
+
__name(swap, "swap");
|
29854
|
+
Buffer3.prototype.swap16 = /* @__PURE__ */ __name(function swap16() {
|
29855
|
+
var len = this.length;
|
29856
|
+
if (len % 2 !== 0) {
|
29857
|
+
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
29858
|
+
}
|
29859
|
+
for (var i = 0; i < len; i += 2) {
|
29860
|
+
swap(this, i, i + 1);
|
29861
|
+
}
|
29862
|
+
return this;
|
29863
|
+
}, "swap16");
|
29864
|
+
Buffer3.prototype.swap32 = /* @__PURE__ */ __name(function swap32() {
|
29865
|
+
var len = this.length;
|
29866
|
+
if (len % 4 !== 0) {
|
29867
|
+
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
29868
|
+
}
|
29869
|
+
for (var i = 0; i < len; i += 4) {
|
29870
|
+
swap(this, i, i + 3);
|
29871
|
+
swap(this, i + 1, i + 2);
|
29872
|
+
}
|
29873
|
+
return this;
|
29874
|
+
}, "swap32");
|
29875
|
+
Buffer3.prototype.swap64 = /* @__PURE__ */ __name(function swap64() {
|
29876
|
+
var len = this.length;
|
29877
|
+
if (len % 8 !== 0) {
|
29878
|
+
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
29879
|
+
}
|
29880
|
+
for (var i = 0; i < len; i += 8) {
|
29881
|
+
swap(this, i, i + 7);
|
29882
|
+
swap(this, i + 1, i + 6);
|
29883
|
+
swap(this, i + 2, i + 5);
|
29884
|
+
swap(this, i + 3, i + 4);
|
29885
|
+
}
|
29886
|
+
return this;
|
29887
|
+
}, "swap64");
|
29888
|
+
Buffer3.prototype.toString = /* @__PURE__ */ __name(function toString6() {
|
29889
|
+
var length2 = this.length;
|
29890
|
+
if (length2 === 0)
|
29891
|
+
return "";
|
29892
|
+
if (arguments.length === 0)
|
29893
|
+
return utf8Slice2(this, 0, length2);
|
29894
|
+
return slowToString.apply(this, arguments);
|
29895
|
+
}, "toString");
|
29896
|
+
Buffer3.prototype.toLocaleString = Buffer3.prototype.toString;
|
29897
|
+
Buffer3.prototype.equals = /* @__PURE__ */ __name(function equals4(b) {
|
29898
|
+
if (!Buffer3.isBuffer(b))
|
29899
|
+
throw new TypeError("Argument must be a Buffer");
|
29900
|
+
if (this === b)
|
29901
|
+
return true;
|
29902
|
+
return Buffer3.compare(this, b) === 0;
|
29903
|
+
}, "equals");
|
29904
|
+
Buffer3.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
29905
|
+
var str = "";
|
29906
|
+
var max = exports.INSPECT_MAX_BYTES;
|
29907
|
+
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
29908
|
+
if (this.length > max)
|
29909
|
+
str += " ... ";
|
29910
|
+
return "<Buffer " + str + ">";
|
29911
|
+
}, "inspect");
|
29912
|
+
if (customInspectSymbol) {
|
29913
|
+
Buffer3.prototype[customInspectSymbol] = Buffer3.prototype.inspect;
|
29914
|
+
}
|
29915
|
+
Buffer3.prototype.compare = /* @__PURE__ */ __name(function compare4(target, start, end, thisStart, thisEnd) {
|
29916
|
+
if (isInstance(target, Uint8Array)) {
|
29917
|
+
target = Buffer3.from(target, target.offset, target.byteLength);
|
29918
|
+
}
|
29919
|
+
if (!Buffer3.isBuffer(target)) {
|
29920
|
+
throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target);
|
29921
|
+
}
|
29922
|
+
if (start === void 0) {
|
29923
|
+
start = 0;
|
29924
|
+
}
|
29925
|
+
if (end === void 0) {
|
29926
|
+
end = target ? target.length : 0;
|
29927
|
+
}
|
29928
|
+
if (thisStart === void 0) {
|
29929
|
+
thisStart = 0;
|
29930
|
+
}
|
29931
|
+
if (thisEnd === void 0) {
|
29932
|
+
thisEnd = this.length;
|
29933
|
+
}
|
29934
|
+
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
29935
|
+
throw new RangeError("out of range index");
|
29936
|
+
}
|
29937
|
+
if (thisStart >= thisEnd && start >= end) {
|
29938
|
+
return 0;
|
29939
|
+
}
|
29940
|
+
if (thisStart >= thisEnd) {
|
29941
|
+
return -1;
|
29942
|
+
}
|
29943
|
+
if (start >= end) {
|
29944
|
+
return 1;
|
29945
|
+
}
|
29946
|
+
start >>>= 0;
|
29947
|
+
end >>>= 0;
|
29948
|
+
thisStart >>>= 0;
|
29949
|
+
thisEnd >>>= 0;
|
29950
|
+
if (this === target)
|
29951
|
+
return 0;
|
29952
|
+
var x = thisEnd - thisStart;
|
29953
|
+
var y = end - start;
|
29954
|
+
var len = Math.min(x, y);
|
29955
|
+
var thisCopy = this.slice(thisStart, thisEnd);
|
29956
|
+
var targetCopy = target.slice(start, end);
|
29957
|
+
for (var i = 0; i < len; ++i) {
|
29958
|
+
if (thisCopy[i] !== targetCopy[i]) {
|
29959
|
+
x = thisCopy[i];
|
29960
|
+
y = targetCopy[i];
|
29961
|
+
break;
|
29962
|
+
}
|
29963
|
+
}
|
29964
|
+
if (x < y)
|
29965
|
+
return -1;
|
29966
|
+
if (y < x)
|
29967
|
+
return 1;
|
29968
|
+
return 0;
|
29969
|
+
}, "compare");
|
29970
|
+
function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) {
|
29971
|
+
if (buffer2.length === 0)
|
29972
|
+
return -1;
|
29973
|
+
if (typeof byteOffset === "string") {
|
29974
|
+
encoding = byteOffset;
|
29975
|
+
byteOffset = 0;
|
29976
|
+
} else if (byteOffset > 2147483647) {
|
29977
|
+
byteOffset = 2147483647;
|
29978
|
+
} else if (byteOffset < -2147483648) {
|
29979
|
+
byteOffset = -2147483648;
|
29980
|
+
}
|
29981
|
+
byteOffset = +byteOffset;
|
29982
|
+
if (numberIsNaN(byteOffset)) {
|
29983
|
+
byteOffset = dir ? 0 : buffer2.length - 1;
|
29984
|
+
}
|
29985
|
+
if (byteOffset < 0)
|
29986
|
+
byteOffset = buffer2.length + byteOffset;
|
29987
|
+
if (byteOffset >= buffer2.length) {
|
29988
|
+
if (dir)
|
29989
|
+
return -1;
|
29990
|
+
else
|
29991
|
+
byteOffset = buffer2.length - 1;
|
29992
|
+
} else if (byteOffset < 0) {
|
29993
|
+
if (dir)
|
29994
|
+
byteOffset = 0;
|
29995
|
+
else
|
29996
|
+
return -1;
|
29997
|
+
}
|
29998
|
+
if (typeof val === "string") {
|
29999
|
+
val = Buffer3.from(val, encoding);
|
30000
|
+
}
|
30001
|
+
if (Buffer3.isBuffer(val)) {
|
30002
|
+
if (val.length === 0) {
|
30003
|
+
return -1;
|
30004
|
+
}
|
30005
|
+
return arrayIndexOf(buffer2, val, byteOffset, encoding, dir);
|
30006
|
+
} else if (typeof val === "number") {
|
30007
|
+
val = val & 255;
|
30008
|
+
if (typeof Uint8Array.prototype.indexOf === "function") {
|
30009
|
+
if (dir) {
|
30010
|
+
return Uint8Array.prototype.indexOf.call(buffer2, val, byteOffset);
|
30011
|
+
} else {
|
30012
|
+
return Uint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset);
|
30013
|
+
}
|
30014
|
+
}
|
30015
|
+
return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir);
|
30016
|
+
}
|
30017
|
+
throw new TypeError("val must be string, number or Buffer");
|
30018
|
+
}
|
30019
|
+
__name(bidirectionalIndexOf, "bidirectionalIndexOf");
|
30020
|
+
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
30021
|
+
var indexSize = 1;
|
30022
|
+
var arrLength = arr.length;
|
30023
|
+
var valLength = val.length;
|
30024
|
+
if (encoding !== void 0) {
|
30025
|
+
encoding = String(encoding).toLowerCase();
|
30026
|
+
if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
|
30027
|
+
if (arr.length < 2 || val.length < 2) {
|
30028
|
+
return -1;
|
30029
|
+
}
|
30030
|
+
indexSize = 2;
|
30031
|
+
arrLength /= 2;
|
30032
|
+
valLength /= 2;
|
30033
|
+
byteOffset /= 2;
|
30034
|
+
}
|
30035
|
+
}
|
30036
|
+
function read2(buf2, i2) {
|
30037
|
+
if (indexSize === 1) {
|
30038
|
+
return buf2[i2];
|
30039
|
+
} else {
|
30040
|
+
return buf2.readUInt16BE(i2 * indexSize);
|
30041
|
+
}
|
30042
|
+
}
|
30043
|
+
__name(read2, "read");
|
30044
|
+
var i;
|
30045
|
+
if (dir) {
|
30046
|
+
var foundIndex = -1;
|
30047
|
+
for (i = byteOffset; i < arrLength; i++) {
|
30048
|
+
if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
30049
|
+
if (foundIndex === -1)
|
30050
|
+
foundIndex = i;
|
30051
|
+
if (i - foundIndex + 1 === valLength)
|
30052
|
+
return foundIndex * indexSize;
|
30053
|
+
} else {
|
30054
|
+
if (foundIndex !== -1)
|
30055
|
+
i -= i - foundIndex;
|
30056
|
+
foundIndex = -1;
|
30057
|
+
}
|
30058
|
+
}
|
30059
|
+
} else {
|
30060
|
+
if (byteOffset + valLength > arrLength)
|
30061
|
+
byteOffset = arrLength - valLength;
|
30062
|
+
for (i = byteOffset; i >= 0; i--) {
|
30063
|
+
var found = true;
|
30064
|
+
for (var j = 0; j < valLength; j++) {
|
30065
|
+
if (read2(arr, i + j) !== read2(val, j)) {
|
30066
|
+
found = false;
|
30067
|
+
break;
|
30068
|
+
}
|
30069
|
+
}
|
30070
|
+
if (found)
|
30071
|
+
return i;
|
30072
|
+
}
|
30073
|
+
}
|
30074
|
+
return -1;
|
30075
|
+
}
|
30076
|
+
__name(arrayIndexOf, "arrayIndexOf");
|
30077
|
+
Buffer3.prototype.includes = /* @__PURE__ */ __name(function includes(val, byteOffset, encoding) {
|
30078
|
+
return this.indexOf(val, byteOffset, encoding) !== -1;
|
30079
|
+
}, "includes");
|
30080
|
+
Buffer3.prototype.indexOf = /* @__PURE__ */ __name(function indexOf(val, byteOffset, encoding) {
|
30081
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
30082
|
+
}, "indexOf");
|
30083
|
+
Buffer3.prototype.lastIndexOf = /* @__PURE__ */ __name(function lastIndexOf(val, byteOffset, encoding) {
|
30084
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
30085
|
+
}, "lastIndexOf");
|
30086
|
+
function hexWrite(buf2, string2, offset, length2) {
|
30087
|
+
offset = Number(offset) || 0;
|
30088
|
+
var remaining = buf2.length - offset;
|
30089
|
+
if (!length2) {
|
30090
|
+
length2 = remaining;
|
30091
|
+
} else {
|
30092
|
+
length2 = Number(length2);
|
30093
|
+
if (length2 > remaining) {
|
30094
|
+
length2 = remaining;
|
30095
|
+
}
|
30096
|
+
}
|
30097
|
+
var strLen = string2.length;
|
30098
|
+
if (length2 > strLen / 2) {
|
30099
|
+
length2 = strLen / 2;
|
30100
|
+
}
|
30101
|
+
for (var i = 0; i < length2; ++i) {
|
30102
|
+
var parsed = parseInt(string2.substr(i * 2, 2), 16);
|
30103
|
+
if (numberIsNaN(parsed))
|
30104
|
+
return i;
|
30105
|
+
buf2[offset + i] = parsed;
|
30106
|
+
}
|
30107
|
+
return i;
|
30108
|
+
}
|
30109
|
+
__name(hexWrite, "hexWrite");
|
30110
|
+
function utf8Write(buf2, string2, offset, length2) {
|
30111
|
+
return blitBuffer(utf8ToBytes2(string2, buf2.length - offset), buf2, offset, length2);
|
30112
|
+
}
|
30113
|
+
__name(utf8Write, "utf8Write");
|
30114
|
+
function asciiWrite(buf2, string2, offset, length2) {
|
30115
|
+
return blitBuffer(asciiToBytes(string2), buf2, offset, length2);
|
30116
|
+
}
|
30117
|
+
__name(asciiWrite, "asciiWrite");
|
30118
|
+
function base64Write(buf2, string2, offset, length2) {
|
30119
|
+
return blitBuffer(base64ToBytes2(string2), buf2, offset, length2);
|
30120
|
+
}
|
30121
|
+
__name(base64Write, "base64Write");
|
30122
|
+
function ucs2Write(buf2, string2, offset, length2) {
|
30123
|
+
return blitBuffer(utf16leToBytes(string2, buf2.length - offset), buf2, offset, length2);
|
30124
|
+
}
|
30125
|
+
__name(ucs2Write, "ucs2Write");
|
30126
|
+
Buffer3.prototype.write = /* @__PURE__ */ __name(function write(string2, offset, length2, encoding) {
|
30127
|
+
if (offset === void 0) {
|
30128
|
+
encoding = "utf8";
|
30129
|
+
length2 = this.length;
|
30130
|
+
offset = 0;
|
30131
|
+
} else if (length2 === void 0 && typeof offset === "string") {
|
30132
|
+
encoding = offset;
|
30133
|
+
length2 = this.length;
|
30134
|
+
offset = 0;
|
30135
|
+
} else if (isFinite(offset)) {
|
30136
|
+
offset = offset >>> 0;
|
30137
|
+
if (isFinite(length2)) {
|
30138
|
+
length2 = length2 >>> 0;
|
30139
|
+
if (encoding === void 0)
|
30140
|
+
encoding = "utf8";
|
30141
|
+
} else {
|
30142
|
+
encoding = length2;
|
30143
|
+
length2 = void 0;
|
30144
|
+
}
|
30145
|
+
} else {
|
30146
|
+
throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
|
30147
|
+
}
|
30148
|
+
var remaining = this.length - offset;
|
30149
|
+
if (length2 === void 0 || length2 > remaining)
|
30150
|
+
length2 = remaining;
|
30151
|
+
if (string2.length > 0 && (length2 < 0 || offset < 0) || offset > this.length) {
|
30152
|
+
throw new RangeError("Attempt to write outside buffer bounds");
|
30153
|
+
}
|
30154
|
+
if (!encoding)
|
30155
|
+
encoding = "utf8";
|
30156
|
+
var loweredCase = false;
|
30157
|
+
for (; ; ) {
|
30158
|
+
switch (encoding) {
|
30159
|
+
case "hex":
|
30160
|
+
return hexWrite(this, string2, offset, length2);
|
30161
|
+
case "utf8":
|
30162
|
+
case "utf-8":
|
30163
|
+
return utf8Write(this, string2, offset, length2);
|
30164
|
+
case "ascii":
|
30165
|
+
case "latin1":
|
30166
|
+
case "binary":
|
30167
|
+
return asciiWrite(this, string2, offset, length2);
|
30168
|
+
case "base64":
|
30169
|
+
return base64Write(this, string2, offset, length2);
|
30170
|
+
case "ucs2":
|
30171
|
+
case "ucs-2":
|
30172
|
+
case "utf16le":
|
30173
|
+
case "utf-16le":
|
30174
|
+
return ucs2Write(this, string2, offset, length2);
|
30175
|
+
default:
|
30176
|
+
if (loweredCase)
|
30177
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
30178
|
+
encoding = ("" + encoding).toLowerCase();
|
30179
|
+
loweredCase = true;
|
30180
|
+
}
|
30181
|
+
}
|
30182
|
+
}, "write");
|
30183
|
+
Buffer3.prototype.toJSON = /* @__PURE__ */ __name(function toJSON2() {
|
30184
|
+
return {
|
30185
|
+
type: "Buffer",
|
30186
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
30187
|
+
};
|
30188
|
+
}, "toJSON");
|
30189
|
+
function base64Slice(buf2, start, end) {
|
30190
|
+
if (start === 0 && end === buf2.length) {
|
30191
|
+
return base642.fromByteArray(buf2);
|
30192
|
+
} else {
|
30193
|
+
return base642.fromByteArray(buf2.slice(start, end));
|
30194
|
+
}
|
30195
|
+
}
|
30196
|
+
__name(base64Slice, "base64Slice");
|
30197
|
+
function utf8Slice2(buf2, start, end) {
|
30198
|
+
end = Math.min(buf2.length, end);
|
30199
|
+
var res = [];
|
30200
|
+
var i = start;
|
30201
|
+
while (i < end) {
|
30202
|
+
var firstByte = buf2[i];
|
30203
|
+
var codePoint = null;
|
30204
|
+
var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
30205
|
+
if (i + bytesPerSequence <= end) {
|
30206
|
+
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
30207
|
+
switch (bytesPerSequence) {
|
30208
|
+
case 1:
|
30209
|
+
if (firstByte < 128) {
|
30210
|
+
codePoint = firstByte;
|
30211
|
+
}
|
30212
|
+
break;
|
30213
|
+
case 2:
|
30214
|
+
secondByte = buf2[i + 1];
|
30215
|
+
if ((secondByte & 192) === 128) {
|
30216
|
+
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
30217
|
+
if (tempCodePoint > 127) {
|
30218
|
+
codePoint = tempCodePoint;
|
30219
|
+
}
|
30220
|
+
}
|
30221
|
+
break;
|
30222
|
+
case 3:
|
30223
|
+
secondByte = buf2[i + 1];
|
30224
|
+
thirdByte = buf2[i + 2];
|
30225
|
+
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
30226
|
+
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
30227
|
+
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
30228
|
+
codePoint = tempCodePoint;
|
30229
|
+
}
|
30230
|
+
}
|
30231
|
+
break;
|
30232
|
+
case 4:
|
30233
|
+
secondByte = buf2[i + 1];
|
30234
|
+
thirdByte = buf2[i + 2];
|
30235
|
+
fourthByte = buf2[i + 3];
|
30236
|
+
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
30237
|
+
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
30238
|
+
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
30239
|
+
codePoint = tempCodePoint;
|
30240
|
+
}
|
30241
|
+
}
|
30242
|
+
}
|
30243
|
+
}
|
30244
|
+
if (codePoint === null) {
|
30245
|
+
codePoint = 65533;
|
30246
|
+
bytesPerSequence = 1;
|
30247
|
+
} else if (codePoint > 65535) {
|
30248
|
+
codePoint -= 65536;
|
30249
|
+
res.push(codePoint >>> 10 & 1023 | 55296);
|
30250
|
+
codePoint = 56320 | codePoint & 1023;
|
30251
|
+
}
|
30252
|
+
res.push(codePoint);
|
30253
|
+
i += bytesPerSequence;
|
30254
|
+
}
|
30255
|
+
return decodeCodePointsArray2(res);
|
30256
|
+
}
|
30257
|
+
__name(utf8Slice2, "utf8Slice");
|
30258
|
+
var MAX_ARGUMENTS_LENGTH2 = 4096;
|
30259
|
+
function decodeCodePointsArray2(codePoints) {
|
30260
|
+
var len = codePoints.length;
|
30261
|
+
if (len <= MAX_ARGUMENTS_LENGTH2) {
|
30262
|
+
return String.fromCharCode.apply(String, codePoints);
|
30263
|
+
}
|
30264
|
+
var res = "";
|
30265
|
+
var i = 0;
|
30266
|
+
while (i < len) {
|
30267
|
+
res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH2));
|
30268
|
+
}
|
30269
|
+
return res;
|
30270
|
+
}
|
30271
|
+
__name(decodeCodePointsArray2, "decodeCodePointsArray");
|
30272
|
+
function asciiSlice(buf2, start, end) {
|
30273
|
+
var ret = "";
|
30274
|
+
end = Math.min(buf2.length, end);
|
30275
|
+
for (var i = start; i < end; ++i) {
|
30276
|
+
ret += String.fromCharCode(buf2[i] & 127);
|
30277
|
+
}
|
30278
|
+
return ret;
|
30279
|
+
}
|
30280
|
+
__name(asciiSlice, "asciiSlice");
|
30281
|
+
function latin1Slice(buf2, start, end) {
|
30282
|
+
var ret = "";
|
30283
|
+
end = Math.min(buf2.length, end);
|
30284
|
+
for (var i = start; i < end; ++i) {
|
30285
|
+
ret += String.fromCharCode(buf2[i]);
|
30286
|
+
}
|
30287
|
+
return ret;
|
30288
|
+
}
|
30289
|
+
__name(latin1Slice, "latin1Slice");
|
30290
|
+
function hexSlice(buf2, start, end) {
|
30291
|
+
var len = buf2.length;
|
30292
|
+
if (!start || start < 0)
|
30293
|
+
start = 0;
|
30294
|
+
if (!end || end < 0 || end > len)
|
30295
|
+
end = len;
|
30296
|
+
var out = "";
|
30297
|
+
for (var i = start; i < end; ++i) {
|
30298
|
+
out += hexSliceLookupTable[buf2[i]];
|
30299
|
+
}
|
30300
|
+
return out;
|
30301
|
+
}
|
30302
|
+
__name(hexSlice, "hexSlice");
|
30303
|
+
function utf16leSlice(buf2, start, end) {
|
30304
|
+
var bytes = buf2.slice(start, end);
|
30305
|
+
var res = "";
|
30306
|
+
for (var i = 0; i < bytes.length - 1; i += 2) {
|
30307
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
30308
|
+
}
|
30309
|
+
return res;
|
30310
|
+
}
|
30311
|
+
__name(utf16leSlice, "utf16leSlice");
|
30312
|
+
Buffer3.prototype.slice = /* @__PURE__ */ __name(function slice2(start, end) {
|
30313
|
+
var len = this.length;
|
30314
|
+
start = ~~start;
|
30315
|
+
end = end === void 0 ? len : ~~end;
|
30316
|
+
if (start < 0) {
|
30317
|
+
start += len;
|
30318
|
+
if (start < 0)
|
30319
|
+
start = 0;
|
30320
|
+
} else if (start > len) {
|
30321
|
+
start = len;
|
30322
|
+
}
|
30323
|
+
if (end < 0) {
|
30324
|
+
end += len;
|
30325
|
+
if (end < 0)
|
30326
|
+
end = 0;
|
30327
|
+
} else if (end > len) {
|
30328
|
+
end = len;
|
30329
|
+
}
|
30330
|
+
if (end < start)
|
30331
|
+
end = start;
|
30332
|
+
var newBuf = this.subarray(start, end);
|
30333
|
+
Object.setPrototypeOf(newBuf, Buffer3.prototype);
|
30334
|
+
return newBuf;
|
30335
|
+
}, "slice");
|
30336
|
+
function checkOffset(offset, ext, length2) {
|
30337
|
+
if (offset % 1 !== 0 || offset < 0)
|
30338
|
+
throw new RangeError("offset is not uint");
|
30339
|
+
if (offset + ext > length2)
|
30340
|
+
throw new RangeError("Trying to access beyond buffer length");
|
30341
|
+
}
|
30342
|
+
__name(checkOffset, "checkOffset");
|
30343
|
+
Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = /* @__PURE__ */ __name(function readUIntLE(offset, byteLength2, noAssert) {
|
30344
|
+
offset = offset >>> 0;
|
30345
|
+
byteLength2 = byteLength2 >>> 0;
|
30346
|
+
if (!noAssert)
|
30347
|
+
checkOffset(offset, byteLength2, this.length);
|
30348
|
+
var val = this[offset];
|
30349
|
+
var mul3 = 1;
|
30350
|
+
var i = 0;
|
30351
|
+
while (++i < byteLength2 && (mul3 *= 256)) {
|
30352
|
+
val += this[offset + i] * mul3;
|
30353
|
+
}
|
30354
|
+
return val;
|
30355
|
+
}, "readUIntLE");
|
30356
|
+
Buffer3.prototype.readUintBE = Buffer3.prototype.readUIntBE = /* @__PURE__ */ __name(function readUIntBE(offset, byteLength2, noAssert) {
|
30357
|
+
offset = offset >>> 0;
|
30358
|
+
byteLength2 = byteLength2 >>> 0;
|
30359
|
+
if (!noAssert) {
|
30360
|
+
checkOffset(offset, byteLength2, this.length);
|
30361
|
+
}
|
30362
|
+
var val = this[offset + --byteLength2];
|
30363
|
+
var mul3 = 1;
|
30364
|
+
while (byteLength2 > 0 && (mul3 *= 256)) {
|
30365
|
+
val += this[offset + --byteLength2] * mul3;
|
30366
|
+
}
|
30367
|
+
return val;
|
30368
|
+
}, "readUIntBE");
|
30369
|
+
Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = /* @__PURE__ */ __name(function readUInt8(offset, noAssert) {
|
30370
|
+
offset = offset >>> 0;
|
30371
|
+
if (!noAssert)
|
30372
|
+
checkOffset(offset, 1, this.length);
|
30373
|
+
return this[offset];
|
30374
|
+
}, "readUInt8");
|
30375
|
+
Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = /* @__PURE__ */ __name(function readUInt16LE(offset, noAssert) {
|
30376
|
+
offset = offset >>> 0;
|
30377
|
+
if (!noAssert)
|
30378
|
+
checkOffset(offset, 2, this.length);
|
30379
|
+
return this[offset] | this[offset + 1] << 8;
|
30380
|
+
}, "readUInt16LE");
|
30381
|
+
Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = /* @__PURE__ */ __name(function readUInt16BE(offset, noAssert) {
|
30382
|
+
offset = offset >>> 0;
|
30383
|
+
if (!noAssert)
|
30384
|
+
checkOffset(offset, 2, this.length);
|
30385
|
+
return this[offset] << 8 | this[offset + 1];
|
30386
|
+
}, "readUInt16BE");
|
30387
|
+
Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = /* @__PURE__ */ __name(function readUInt32LE(offset, noAssert) {
|
30388
|
+
offset = offset >>> 0;
|
30389
|
+
if (!noAssert)
|
30390
|
+
checkOffset(offset, 4, this.length);
|
30391
|
+
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
30392
|
+
}, "readUInt32LE");
|
30393
|
+
Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = /* @__PURE__ */ __name(function readUInt32BE(offset, noAssert) {
|
30394
|
+
offset = offset >>> 0;
|
30395
|
+
if (!noAssert)
|
30396
|
+
checkOffset(offset, 4, this.length);
|
30397
|
+
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
30398
|
+
}, "readUInt32BE");
|
30399
|
+
Buffer3.prototype.readIntLE = /* @__PURE__ */ __name(function readIntLE(offset, byteLength2, noAssert) {
|
30400
|
+
offset = offset >>> 0;
|
30401
|
+
byteLength2 = byteLength2 >>> 0;
|
30402
|
+
if (!noAssert)
|
30403
|
+
checkOffset(offset, byteLength2, this.length);
|
30404
|
+
var val = this[offset];
|
30405
|
+
var mul3 = 1;
|
30406
|
+
var i = 0;
|
30407
|
+
while (++i < byteLength2 && (mul3 *= 256)) {
|
30408
|
+
val += this[offset + i] * mul3;
|
30409
|
+
}
|
30410
|
+
mul3 *= 128;
|
30411
|
+
if (val >= mul3)
|
30412
|
+
val -= Math.pow(2, 8 * byteLength2);
|
30413
|
+
return val;
|
30414
|
+
}, "readIntLE");
|
30415
|
+
Buffer3.prototype.readIntBE = /* @__PURE__ */ __name(function readIntBE(offset, byteLength2, noAssert) {
|
30416
|
+
offset = offset >>> 0;
|
30417
|
+
byteLength2 = byteLength2 >>> 0;
|
30418
|
+
if (!noAssert)
|
30419
|
+
checkOffset(offset, byteLength2, this.length);
|
30420
|
+
var i = byteLength2;
|
30421
|
+
var mul3 = 1;
|
30422
|
+
var val = this[offset + --i];
|
30423
|
+
while (i > 0 && (mul3 *= 256)) {
|
30424
|
+
val += this[offset + --i] * mul3;
|
30425
|
+
}
|
30426
|
+
mul3 *= 128;
|
30427
|
+
if (val >= mul3)
|
30428
|
+
val -= Math.pow(2, 8 * byteLength2);
|
30429
|
+
return val;
|
30430
|
+
}, "readIntBE");
|
30431
|
+
Buffer3.prototype.readInt8 = /* @__PURE__ */ __name(function readInt8(offset, noAssert) {
|
30432
|
+
offset = offset >>> 0;
|
30433
|
+
if (!noAssert)
|
30434
|
+
checkOffset(offset, 1, this.length);
|
30435
|
+
if (!(this[offset] & 128))
|
30436
|
+
return this[offset];
|
30437
|
+
return (255 - this[offset] + 1) * -1;
|
30438
|
+
}, "readInt8");
|
30439
|
+
Buffer3.prototype.readInt16LE = /* @__PURE__ */ __name(function readInt16LE(offset, noAssert) {
|
30440
|
+
offset = offset >>> 0;
|
30441
|
+
if (!noAssert)
|
30442
|
+
checkOffset(offset, 2, this.length);
|
30443
|
+
var val = this[offset] | this[offset + 1] << 8;
|
30444
|
+
return val & 32768 ? val | 4294901760 : val;
|
30445
|
+
}, "readInt16LE");
|
30446
|
+
Buffer3.prototype.readInt16BE = /* @__PURE__ */ __name(function readInt16BE(offset, noAssert) {
|
30447
|
+
offset = offset >>> 0;
|
30448
|
+
if (!noAssert)
|
30449
|
+
checkOffset(offset, 2, this.length);
|
30450
|
+
var val = this[offset + 1] | this[offset] << 8;
|
30451
|
+
return val & 32768 ? val | 4294901760 : val;
|
30452
|
+
}, "readInt16BE");
|
30453
|
+
Buffer3.prototype.readInt32LE = /* @__PURE__ */ __name(function readInt32LE(offset, noAssert) {
|
30454
|
+
offset = offset >>> 0;
|
30455
|
+
if (!noAssert)
|
30456
|
+
checkOffset(offset, 4, this.length);
|
30457
|
+
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
30458
|
+
}, "readInt32LE");
|
30459
|
+
Buffer3.prototype.readInt32BE = /* @__PURE__ */ __name(function readInt32BE(offset, noAssert) {
|
30460
|
+
offset = offset >>> 0;
|
30461
|
+
if (!noAssert)
|
30462
|
+
checkOffset(offset, 4, this.length);
|
30463
|
+
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
30464
|
+
}, "readInt32BE");
|
30465
|
+
Buffer3.prototype.readFloatLE = /* @__PURE__ */ __name(function readFloatLE(offset, noAssert) {
|
30466
|
+
offset = offset >>> 0;
|
30467
|
+
if (!noAssert)
|
30468
|
+
checkOffset(offset, 4, this.length);
|
30469
|
+
return ieee754.read(this, offset, true, 23, 4);
|
30470
|
+
}, "readFloatLE");
|
30471
|
+
Buffer3.prototype.readFloatBE = /* @__PURE__ */ __name(function readFloatBE(offset, noAssert) {
|
30472
|
+
offset = offset >>> 0;
|
30473
|
+
if (!noAssert)
|
30474
|
+
checkOffset(offset, 4, this.length);
|
30475
|
+
return ieee754.read(this, offset, false, 23, 4);
|
30476
|
+
}, "readFloatBE");
|
30477
|
+
Buffer3.prototype.readDoubleLE = /* @__PURE__ */ __name(function readDoubleLE(offset, noAssert) {
|
30478
|
+
offset = offset >>> 0;
|
30479
|
+
if (!noAssert)
|
30480
|
+
checkOffset(offset, 8, this.length);
|
30481
|
+
return ieee754.read(this, offset, true, 52, 8);
|
30482
|
+
}, "readDoubleLE");
|
30483
|
+
Buffer3.prototype.readDoubleBE = /* @__PURE__ */ __name(function readDoubleBE(offset, noAssert) {
|
30484
|
+
offset = offset >>> 0;
|
30485
|
+
if (!noAssert)
|
30486
|
+
checkOffset(offset, 8, this.length);
|
30487
|
+
return ieee754.read(this, offset, false, 52, 8);
|
30488
|
+
}, "readDoubleBE");
|
30489
|
+
function checkInt(buf2, value, offset, ext, max, min) {
|
30490
|
+
if (!Buffer3.isBuffer(buf2))
|
30491
|
+
throw new TypeError('"buffer" argument must be a Buffer instance');
|
30492
|
+
if (value > max || value < min)
|
30493
|
+
throw new RangeError('"value" argument is out of bounds');
|
30494
|
+
if (offset + ext > buf2.length)
|
30495
|
+
throw new RangeError("Index out of range");
|
30496
|
+
}
|
30497
|
+
__name(checkInt, "checkInt");
|
30498
|
+
Buffer3.prototype.writeUintLE = Buffer3.prototype.writeUIntLE = /* @__PURE__ */ __name(function writeUIntLE(value, offset, byteLength2, noAssert) {
|
30499
|
+
value = +value;
|
30500
|
+
offset = offset >>> 0;
|
30501
|
+
byteLength2 = byteLength2 >>> 0;
|
30502
|
+
if (!noAssert) {
|
30503
|
+
var maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
30504
|
+
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
30505
|
+
}
|
30506
|
+
var mul3 = 1;
|
30507
|
+
var i = 0;
|
30508
|
+
this[offset] = value & 255;
|
30509
|
+
while (++i < byteLength2 && (mul3 *= 256)) {
|
30510
|
+
this[offset + i] = value / mul3 & 255;
|
30511
|
+
}
|
30512
|
+
return offset + byteLength2;
|
30513
|
+
}, "writeUIntLE");
|
30514
|
+
Buffer3.prototype.writeUintBE = Buffer3.prototype.writeUIntBE = /* @__PURE__ */ __name(function writeUIntBE(value, offset, byteLength2, noAssert) {
|
30515
|
+
value = +value;
|
30516
|
+
offset = offset >>> 0;
|
30517
|
+
byteLength2 = byteLength2 >>> 0;
|
30518
|
+
if (!noAssert) {
|
30519
|
+
var maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
30520
|
+
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
30521
|
+
}
|
30522
|
+
var i = byteLength2 - 1;
|
30523
|
+
var mul3 = 1;
|
30524
|
+
this[offset + i] = value & 255;
|
30525
|
+
while (--i >= 0 && (mul3 *= 256)) {
|
30526
|
+
this[offset + i] = value / mul3 & 255;
|
30527
|
+
}
|
30528
|
+
return offset + byteLength2;
|
30529
|
+
}, "writeUIntBE");
|
30530
|
+
Buffer3.prototype.writeUint8 = Buffer3.prototype.writeUInt8 = /* @__PURE__ */ __name(function writeUInt8(value, offset, noAssert) {
|
30531
|
+
value = +value;
|
30532
|
+
offset = offset >>> 0;
|
30533
|
+
if (!noAssert)
|
30534
|
+
checkInt(this, value, offset, 1, 255, 0);
|
30535
|
+
this[offset] = value & 255;
|
30536
|
+
return offset + 1;
|
30537
|
+
}, "writeUInt8");
|
30538
|
+
Buffer3.prototype.writeUint16LE = Buffer3.prototype.writeUInt16LE = /* @__PURE__ */ __name(function writeUInt16LE(value, offset, noAssert) {
|
30539
|
+
value = +value;
|
30540
|
+
offset = offset >>> 0;
|
30541
|
+
if (!noAssert)
|
30542
|
+
checkInt(this, value, offset, 2, 65535, 0);
|
30543
|
+
this[offset] = value & 255;
|
30544
|
+
this[offset + 1] = value >>> 8;
|
30545
|
+
return offset + 2;
|
30546
|
+
}, "writeUInt16LE");
|
30547
|
+
Buffer3.prototype.writeUint16BE = Buffer3.prototype.writeUInt16BE = /* @__PURE__ */ __name(function writeUInt16BE(value, offset, noAssert) {
|
30548
|
+
value = +value;
|
30549
|
+
offset = offset >>> 0;
|
30550
|
+
if (!noAssert)
|
30551
|
+
checkInt(this, value, offset, 2, 65535, 0);
|
30552
|
+
this[offset] = value >>> 8;
|
30553
|
+
this[offset + 1] = value & 255;
|
30554
|
+
return offset + 2;
|
30555
|
+
}, "writeUInt16BE");
|
30556
|
+
Buffer3.prototype.writeUint32LE = Buffer3.prototype.writeUInt32LE = /* @__PURE__ */ __name(function writeUInt32LE(value, offset, noAssert) {
|
30557
|
+
value = +value;
|
30558
|
+
offset = offset >>> 0;
|
30559
|
+
if (!noAssert)
|
30560
|
+
checkInt(this, value, offset, 4, 4294967295, 0);
|
30561
|
+
this[offset + 3] = value >>> 24;
|
30562
|
+
this[offset + 2] = value >>> 16;
|
30563
|
+
this[offset + 1] = value >>> 8;
|
30564
|
+
this[offset] = value & 255;
|
30565
|
+
return offset + 4;
|
30566
|
+
}, "writeUInt32LE");
|
30567
|
+
Buffer3.prototype.writeUint32BE = Buffer3.prototype.writeUInt32BE = /* @__PURE__ */ __name(function writeUInt32BE(value, offset, noAssert) {
|
30568
|
+
value = +value;
|
30569
|
+
offset = offset >>> 0;
|
30570
|
+
if (!noAssert)
|
30571
|
+
checkInt(this, value, offset, 4, 4294967295, 0);
|
30572
|
+
this[offset] = value >>> 24;
|
30573
|
+
this[offset + 1] = value >>> 16;
|
30574
|
+
this[offset + 2] = value >>> 8;
|
30575
|
+
this[offset + 3] = value & 255;
|
30576
|
+
return offset + 4;
|
30577
|
+
}, "writeUInt32BE");
|
30578
|
+
Buffer3.prototype.writeIntLE = /* @__PURE__ */ __name(function writeIntLE(value, offset, byteLength2, noAssert) {
|
30579
|
+
value = +value;
|
30580
|
+
offset = offset >>> 0;
|
30581
|
+
if (!noAssert) {
|
30582
|
+
var limit = Math.pow(2, 8 * byteLength2 - 1);
|
30583
|
+
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
30584
|
+
}
|
30585
|
+
var i = 0;
|
30586
|
+
var mul3 = 1;
|
30587
|
+
var sub = 0;
|
30588
|
+
this[offset] = value & 255;
|
30589
|
+
while (++i < byteLength2 && (mul3 *= 256)) {
|
30590
|
+
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
30591
|
+
sub = 1;
|
30592
|
+
}
|
30593
|
+
this[offset + i] = (value / mul3 >> 0) - sub & 255;
|
30594
|
+
}
|
30595
|
+
return offset + byteLength2;
|
30596
|
+
}, "writeIntLE");
|
30597
|
+
Buffer3.prototype.writeIntBE = /* @__PURE__ */ __name(function writeIntBE(value, offset, byteLength2, noAssert) {
|
30598
|
+
value = +value;
|
30599
|
+
offset = offset >>> 0;
|
30600
|
+
if (!noAssert) {
|
30601
|
+
var limit = Math.pow(2, 8 * byteLength2 - 1);
|
30602
|
+
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
30603
|
+
}
|
30604
|
+
var i = byteLength2 - 1;
|
30605
|
+
var mul3 = 1;
|
30606
|
+
var sub = 0;
|
30607
|
+
this[offset + i] = value & 255;
|
30608
|
+
while (--i >= 0 && (mul3 *= 256)) {
|
30609
|
+
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
30610
|
+
sub = 1;
|
30611
|
+
}
|
30612
|
+
this[offset + i] = (value / mul3 >> 0) - sub & 255;
|
30613
|
+
}
|
30614
|
+
return offset + byteLength2;
|
30615
|
+
}, "writeIntBE");
|
30616
|
+
Buffer3.prototype.writeInt8 = /* @__PURE__ */ __name(function writeInt8(value, offset, noAssert) {
|
30617
|
+
value = +value;
|
30618
|
+
offset = offset >>> 0;
|
30619
|
+
if (!noAssert)
|
30620
|
+
checkInt(this, value, offset, 1, 127, -128);
|
30621
|
+
if (value < 0)
|
30622
|
+
value = 255 + value + 1;
|
30623
|
+
this[offset] = value & 255;
|
30624
|
+
return offset + 1;
|
30625
|
+
}, "writeInt8");
|
30626
|
+
Buffer3.prototype.writeInt16LE = /* @__PURE__ */ __name(function writeInt16LE(value, offset, noAssert) {
|
30627
|
+
value = +value;
|
30628
|
+
offset = offset >>> 0;
|
30629
|
+
if (!noAssert)
|
30630
|
+
checkInt(this, value, offset, 2, 32767, -32768);
|
30631
|
+
this[offset] = value & 255;
|
30632
|
+
this[offset + 1] = value >>> 8;
|
30633
|
+
return offset + 2;
|
30634
|
+
}, "writeInt16LE");
|
30635
|
+
Buffer3.prototype.writeInt16BE = /* @__PURE__ */ __name(function writeInt16BE(value, offset, noAssert) {
|
30636
|
+
value = +value;
|
30637
|
+
offset = offset >>> 0;
|
30638
|
+
if (!noAssert)
|
30639
|
+
checkInt(this, value, offset, 2, 32767, -32768);
|
30640
|
+
this[offset] = value >>> 8;
|
30641
|
+
this[offset + 1] = value & 255;
|
30642
|
+
return offset + 2;
|
30643
|
+
}, "writeInt16BE");
|
30644
|
+
Buffer3.prototype.writeInt32LE = /* @__PURE__ */ __name(function writeInt32LE(value, offset, noAssert) {
|
30645
|
+
value = +value;
|
30646
|
+
offset = offset >>> 0;
|
30647
|
+
if (!noAssert)
|
30648
|
+
checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
30649
|
+
this[offset] = value & 255;
|
30650
|
+
this[offset + 1] = value >>> 8;
|
30651
|
+
this[offset + 2] = value >>> 16;
|
30652
|
+
this[offset + 3] = value >>> 24;
|
30653
|
+
return offset + 4;
|
30654
|
+
}, "writeInt32LE");
|
30655
|
+
Buffer3.prototype.writeInt32BE = /* @__PURE__ */ __name(function writeInt32BE(value, offset, noAssert) {
|
30656
|
+
value = +value;
|
30657
|
+
offset = offset >>> 0;
|
30658
|
+
if (!noAssert)
|
30659
|
+
checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
30660
|
+
if (value < 0)
|
30661
|
+
value = 4294967295 + value + 1;
|
30662
|
+
this[offset] = value >>> 24;
|
30663
|
+
this[offset + 1] = value >>> 16;
|
30664
|
+
this[offset + 2] = value >>> 8;
|
30665
|
+
this[offset + 3] = value & 255;
|
30666
|
+
return offset + 4;
|
30667
|
+
}, "writeInt32BE");
|
30668
|
+
function checkIEEE754(buf2, value, offset, ext, max, min) {
|
30669
|
+
if (offset + ext > buf2.length)
|
30670
|
+
throw new RangeError("Index out of range");
|
30671
|
+
if (offset < 0)
|
30672
|
+
throw new RangeError("Index out of range");
|
30673
|
+
}
|
30674
|
+
__name(checkIEEE754, "checkIEEE754");
|
30675
|
+
function writeFloat(buf2, value, offset, littleEndian, noAssert) {
|
30676
|
+
value = +value;
|
30677
|
+
offset = offset >>> 0;
|
30678
|
+
if (!noAssert) {
|
30679
|
+
checkIEEE754(buf2, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
|
30680
|
+
}
|
30681
|
+
ieee754.write(buf2, value, offset, littleEndian, 23, 4);
|
30682
|
+
return offset + 4;
|
30683
|
+
}
|
30684
|
+
__name(writeFloat, "writeFloat");
|
30685
|
+
Buffer3.prototype.writeFloatLE = /* @__PURE__ */ __name(function writeFloatLE(value, offset, noAssert) {
|
30686
|
+
return writeFloat(this, value, offset, true, noAssert);
|
30687
|
+
}, "writeFloatLE");
|
30688
|
+
Buffer3.prototype.writeFloatBE = /* @__PURE__ */ __name(function writeFloatBE(value, offset, noAssert) {
|
30689
|
+
return writeFloat(this, value, offset, false, noAssert);
|
30690
|
+
}, "writeFloatBE");
|
30691
|
+
function writeDouble(buf2, value, offset, littleEndian, noAssert) {
|
30692
|
+
value = +value;
|
30693
|
+
offset = offset >>> 0;
|
30694
|
+
if (!noAssert) {
|
30695
|
+
checkIEEE754(buf2, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
|
30696
|
+
}
|
30697
|
+
ieee754.write(buf2, value, offset, littleEndian, 52, 8);
|
30698
|
+
return offset + 8;
|
30699
|
+
}
|
30700
|
+
__name(writeDouble, "writeDouble");
|
30701
|
+
Buffer3.prototype.writeDoubleLE = /* @__PURE__ */ __name(function writeDoubleLE(value, offset, noAssert) {
|
30702
|
+
return writeDouble(this, value, offset, true, noAssert);
|
30703
|
+
}, "writeDoubleLE");
|
30704
|
+
Buffer3.prototype.writeDoubleBE = /* @__PURE__ */ __name(function writeDoubleBE(value, offset, noAssert) {
|
30705
|
+
return writeDouble(this, value, offset, false, noAssert);
|
30706
|
+
}, "writeDoubleBE");
|
30707
|
+
Buffer3.prototype.copy = /* @__PURE__ */ __name(function copy(target, targetStart, start, end) {
|
30708
|
+
if (!Buffer3.isBuffer(target))
|
30709
|
+
throw new TypeError("argument should be a Buffer");
|
30710
|
+
if (!start)
|
30711
|
+
start = 0;
|
30712
|
+
if (!end && end !== 0)
|
30713
|
+
end = this.length;
|
30714
|
+
if (targetStart >= target.length)
|
30715
|
+
targetStart = target.length;
|
30716
|
+
if (!targetStart)
|
30717
|
+
targetStart = 0;
|
30718
|
+
if (end > 0 && end < start)
|
30719
|
+
end = start;
|
30720
|
+
if (end === start)
|
30721
|
+
return 0;
|
30722
|
+
if (target.length === 0 || this.length === 0)
|
30723
|
+
return 0;
|
30724
|
+
if (targetStart < 0) {
|
30725
|
+
throw new RangeError("targetStart out of bounds");
|
30726
|
+
}
|
30727
|
+
if (start < 0 || start >= this.length)
|
30728
|
+
throw new RangeError("Index out of range");
|
30729
|
+
if (end < 0)
|
30730
|
+
throw new RangeError("sourceEnd out of bounds");
|
30731
|
+
if (end > this.length)
|
30732
|
+
end = this.length;
|
30733
|
+
if (target.length - targetStart < end - start) {
|
30734
|
+
end = target.length - targetStart + start;
|
30735
|
+
}
|
30736
|
+
var len = end - start;
|
30737
|
+
if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
|
30738
|
+
this.copyWithin(targetStart, start, end);
|
30739
|
+
} else {
|
30740
|
+
Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
|
30741
|
+
}
|
30742
|
+
return len;
|
30743
|
+
}, "copy");
|
30744
|
+
Buffer3.prototype.fill = /* @__PURE__ */ __name(function fill(val, start, end, encoding) {
|
30745
|
+
if (typeof val === "string") {
|
30746
|
+
if (typeof start === "string") {
|
30747
|
+
encoding = start;
|
30748
|
+
start = 0;
|
30749
|
+
end = this.length;
|
30750
|
+
} else if (typeof end === "string") {
|
30751
|
+
encoding = end;
|
30752
|
+
end = this.length;
|
30753
|
+
}
|
30754
|
+
if (encoding !== void 0 && typeof encoding !== "string") {
|
30755
|
+
throw new TypeError("encoding must be a string");
|
30756
|
+
}
|
30757
|
+
if (typeof encoding === "string" && !Buffer3.isEncoding(encoding)) {
|
30758
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
30759
|
+
}
|
30760
|
+
if (val.length === 1) {
|
30761
|
+
var code5 = val.charCodeAt(0);
|
30762
|
+
if (encoding === "utf8" && code5 < 128 || encoding === "latin1") {
|
30763
|
+
val = code5;
|
30764
|
+
}
|
30765
|
+
}
|
30766
|
+
} else if (typeof val === "number") {
|
30767
|
+
val = val & 255;
|
30768
|
+
} else if (typeof val === "boolean") {
|
30769
|
+
val = Number(val);
|
30770
|
+
}
|
30771
|
+
if (start < 0 || this.length < start || this.length < end) {
|
30772
|
+
throw new RangeError("Out of range index");
|
30773
|
+
}
|
30774
|
+
if (end <= start) {
|
30775
|
+
return this;
|
30776
|
+
}
|
30777
|
+
start = start >>> 0;
|
30778
|
+
end = end === void 0 ? this.length : end >>> 0;
|
30779
|
+
if (!val)
|
30780
|
+
val = 0;
|
30781
|
+
var i;
|
30782
|
+
if (typeof val === "number") {
|
30783
|
+
for (i = start; i < end; ++i) {
|
30784
|
+
this[i] = val;
|
30785
|
+
}
|
30786
|
+
} else {
|
30787
|
+
var bytes = Buffer3.isBuffer(val) ? val : Buffer3.from(val, encoding);
|
30788
|
+
var len = bytes.length;
|
30789
|
+
if (len === 0) {
|
30790
|
+
throw new TypeError('The value "' + val + '" is invalid for argument "value"');
|
30791
|
+
}
|
30792
|
+
for (i = 0; i < end - start; ++i) {
|
30793
|
+
this[i + start] = bytes[i % len];
|
30794
|
+
}
|
30795
|
+
}
|
30796
|
+
return this;
|
30797
|
+
}, "fill");
|
30798
|
+
var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
30799
|
+
function base64clean(str) {
|
30800
|
+
str = str.split("=")[0];
|
30801
|
+
str = str.trim().replace(INVALID_BASE64_RE, "");
|
30802
|
+
if (str.length < 2)
|
30803
|
+
return "";
|
30804
|
+
while (str.length % 4 !== 0) {
|
30805
|
+
str = str + "=";
|
30806
|
+
}
|
30807
|
+
return str;
|
30808
|
+
}
|
30809
|
+
__name(base64clean, "base64clean");
|
30810
|
+
function utf8ToBytes2(string2, units) {
|
30811
|
+
units = units || Infinity;
|
30812
|
+
var codePoint;
|
30813
|
+
var length2 = string2.length;
|
30814
|
+
var leadSurrogate = null;
|
30815
|
+
var bytes = [];
|
30816
|
+
for (var i = 0; i < length2; ++i) {
|
30817
|
+
codePoint = string2.charCodeAt(i);
|
30818
|
+
if (codePoint > 55295 && codePoint < 57344) {
|
30819
|
+
if (!leadSurrogate) {
|
30820
|
+
if (codePoint > 56319) {
|
30821
|
+
if ((units -= 3) > -1)
|
30822
|
+
bytes.push(239, 191, 189);
|
30823
|
+
continue;
|
30824
|
+
} else if (i + 1 === length2) {
|
30825
|
+
if ((units -= 3) > -1)
|
30826
|
+
bytes.push(239, 191, 189);
|
30827
|
+
continue;
|
30828
|
+
}
|
30829
|
+
leadSurrogate = codePoint;
|
30830
|
+
continue;
|
30831
|
+
}
|
30832
|
+
if (codePoint < 56320) {
|
30833
|
+
if ((units -= 3) > -1)
|
30834
|
+
bytes.push(239, 191, 189);
|
30835
|
+
leadSurrogate = codePoint;
|
30836
|
+
continue;
|
30837
|
+
}
|
30838
|
+
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
30839
|
+
} else if (leadSurrogate) {
|
30840
|
+
if ((units -= 3) > -1)
|
30841
|
+
bytes.push(239, 191, 189);
|
30842
|
+
}
|
30843
|
+
leadSurrogate = null;
|
30844
|
+
if (codePoint < 128) {
|
30845
|
+
if ((units -= 1) < 0)
|
30846
|
+
break;
|
30847
|
+
bytes.push(codePoint);
|
30848
|
+
} else if (codePoint < 2048) {
|
30849
|
+
if ((units -= 2) < 0)
|
30850
|
+
break;
|
30851
|
+
bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
|
30852
|
+
} else if (codePoint < 65536) {
|
30853
|
+
if ((units -= 3) < 0)
|
30854
|
+
break;
|
30855
|
+
bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
|
30856
|
+
} else if (codePoint < 1114112) {
|
30857
|
+
if ((units -= 4) < 0)
|
30858
|
+
break;
|
30859
|
+
bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
|
30860
|
+
} else {
|
30861
|
+
throw new Error("Invalid code point");
|
30862
|
+
}
|
30863
|
+
}
|
30864
|
+
return bytes;
|
30865
|
+
}
|
30866
|
+
__name(utf8ToBytes2, "utf8ToBytes");
|
30867
|
+
function asciiToBytes(str) {
|
30868
|
+
var byteArray = [];
|
30869
|
+
for (var i = 0; i < str.length; ++i) {
|
30870
|
+
byteArray.push(str.charCodeAt(i) & 255);
|
30871
|
+
}
|
30872
|
+
return byteArray;
|
30873
|
+
}
|
30874
|
+
__name(asciiToBytes, "asciiToBytes");
|
30875
|
+
function utf16leToBytes(str, units) {
|
30876
|
+
var c, hi, lo;
|
30877
|
+
var byteArray = [];
|
30878
|
+
for (var i = 0; i < str.length; ++i) {
|
30879
|
+
if ((units -= 2) < 0)
|
30880
|
+
break;
|
30881
|
+
c = str.charCodeAt(i);
|
30882
|
+
hi = c >> 8;
|
30883
|
+
lo = c % 256;
|
30884
|
+
byteArray.push(lo);
|
30885
|
+
byteArray.push(hi);
|
30886
|
+
}
|
30887
|
+
return byteArray;
|
30888
|
+
}
|
30889
|
+
__name(utf16leToBytes, "utf16leToBytes");
|
30890
|
+
function base64ToBytes2(str) {
|
30891
|
+
return base642.toByteArray(base64clean(str));
|
30892
|
+
}
|
30893
|
+
__name(base64ToBytes2, "base64ToBytes");
|
30894
|
+
function blitBuffer(src2, dst, offset, length2) {
|
30895
|
+
for (var i = 0; i < length2; ++i) {
|
30896
|
+
if (i + offset >= dst.length || i >= src2.length)
|
30897
|
+
break;
|
30898
|
+
dst[i + offset] = src2[i];
|
30899
|
+
}
|
30900
|
+
return i;
|
30901
|
+
}
|
30902
|
+
__name(blitBuffer, "blitBuffer");
|
30903
|
+
function isInstance(obj, type) {
|
30904
|
+
return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
|
30905
|
+
}
|
30906
|
+
__name(isInstance, "isInstance");
|
30907
|
+
function numberIsNaN(obj) {
|
30908
|
+
return obj !== obj;
|
30909
|
+
}
|
30910
|
+
__name(numberIsNaN, "numberIsNaN");
|
30911
|
+
var hexSliceLookupTable = function() {
|
30912
|
+
var alphabet3 = "0123456789abcdef";
|
30913
|
+
var table = new Array(256);
|
30914
|
+
for (var i = 0; i < 16; ++i) {
|
30915
|
+
var i16 = i * 16;
|
30916
|
+
for (var j = 0; j < 16; ++j) {
|
30917
|
+
table[i16 + j] = alphabet3[i] + alphabet3[j];
|
30918
|
+
}
|
30919
|
+
}
|
30920
|
+
return table;
|
30921
|
+
}();
|
30922
|
+
}
|
30923
|
+
});
|
30924
|
+
|
29264
30925
|
// src/wallet/plugins/EthereumPlugin/erc20.abi.json
|
29265
30926
|
var require_erc20_abi = __commonJS({
|
29266
30927
|
"src/wallet/plugins/EthereumPlugin/erc20.abi.json"(exports, module2) {
|
@@ -35270,6 +36931,7 @@ __export(src_exports2, {
|
|
35270
36931
|
ExpirationPlugin: () => ExpirationPlugin,
|
35271
36932
|
emptyWallet: () => emptyWallet,
|
35272
36933
|
generateWallet: () => generateWallet,
|
36934
|
+
getCHAPIPlugin: () => getCHAPIPlugin,
|
35273
36935
|
getDidKeyPlugin: () => getDidKeyPlugin,
|
35274
36936
|
getDidKitPlugin: () => getDidKitPlugin,
|
35275
36937
|
getEthereumPlugin: () => getEthereumPlugin,
|
@@ -36092,20 +37754,20 @@ var getDidKitPlugin = /* @__PURE__ */ __name((input) => __async(void 0, null, fu
|
|
36092
37754
|
issueCredential: (_wallet, credential, options, keypair) => __async(void 0, null, function* () {
|
36093
37755
|
return JSON.parse(yield issueCredential(JSON.stringify(credential), JSON.stringify(options), JSON.stringify(keypair)));
|
36094
37756
|
}),
|
36095
|
-
verifyCredential: (
|
36096
|
-
return JSON.parse(yield verifyCredential(JSON.stringify(credential),
|
37757
|
+
verifyCredential: (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, credential, options = {}) {
|
37758
|
+
return JSON.parse(yield verifyCredential(JSON.stringify(credential), JSON.stringify(options)));
|
36097
37759
|
}),
|
36098
37760
|
issuePresentation: (_wallet, presentation, options, keypair) => __async(void 0, null, function* () {
|
36099
37761
|
return JSON.parse(yield issuePresentation(JSON.stringify(presentation), JSON.stringify(options), JSON.stringify(keypair)));
|
36100
37762
|
}),
|
36101
|
-
verifyPresentation: (
|
36102
|
-
return JSON.parse(yield verifyPresentation(JSON.stringify(presentation),
|
37763
|
+
verifyPresentation: (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, presentation, options = {}) {
|
37764
|
+
return JSON.parse(yield verifyPresentation(JSON.stringify(presentation), JSON.stringify(options)));
|
36103
37765
|
}),
|
36104
37766
|
contextLoader: (_wallet, url) => __async(void 0, null, function* () {
|
36105
37767
|
return JSON.parse(yield contextLoader(url));
|
36106
37768
|
}),
|
36107
|
-
resolveDid: (
|
36108
|
-
return JSON.parse(yield resolveDID(did,
|
37769
|
+
resolveDid: (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, did, inputMetadata = {}) {
|
37770
|
+
return JSON.parse(yield resolveDID(did, JSON.stringify(inputMetadata)));
|
36109
37771
|
})
|
36110
37772
|
}
|
36111
37773
|
};
|
@@ -36126,8 +37788,1492 @@ var ExpirationPlugin = /* @__PURE__ */ __name((wallet) => ({
|
|
36126
37788
|
}
|
36127
37789
|
}), "ExpirationPlugin");
|
36128
37790
|
|
36129
|
-
//
|
36130
|
-
var
|
37791
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/utils.js
|
37792
|
+
var RPC_ERRORS = {
|
37793
|
+
ParseError: {
|
37794
|
+
message: "Parse error",
|
37795
|
+
code: -32700
|
37796
|
+
},
|
37797
|
+
InvalidRequest: {
|
37798
|
+
message: "Invalid Request",
|
37799
|
+
code: -32600
|
37800
|
+
},
|
37801
|
+
MethodNotFound: {
|
37802
|
+
message: "Method not found",
|
37803
|
+
code: -32601
|
37804
|
+
},
|
37805
|
+
InvalidParams: {
|
37806
|
+
message: "Invalid params",
|
37807
|
+
code: -32602
|
37808
|
+
},
|
37809
|
+
InternalError: {
|
37810
|
+
message: "Internal Error",
|
37811
|
+
code: -32603
|
37812
|
+
},
|
37813
|
+
ServerError: {
|
37814
|
+
message: "Server error",
|
37815
|
+
code: -32e3
|
37816
|
+
}
|
37817
|
+
};
|
37818
|
+
function parseUrl(url, base4) {
|
37819
|
+
if (base4 === void 0) {
|
37820
|
+
base4 = window.location.href;
|
37821
|
+
}
|
37822
|
+
if (typeof URL === "function") {
|
37823
|
+
return new URL(url, base4);
|
37824
|
+
}
|
37825
|
+
if (typeof url !== "string") {
|
37826
|
+
throw new TypeError('"url" must be a string.');
|
37827
|
+
}
|
37828
|
+
if (!url.includes(":")) {
|
37829
|
+
if (base4.startsWith("http") && !url.startsWith("/")) {
|
37830
|
+
url = base4 + "/" + url;
|
37831
|
+
} else {
|
37832
|
+
url = base4 + url;
|
37833
|
+
}
|
37834
|
+
}
|
37835
|
+
const parser = document.createElement("a");
|
37836
|
+
parser.href = url;
|
37837
|
+
let origin = (parser.protocol || window.location.protocol) + "//";
|
37838
|
+
if (parser.host) {
|
37839
|
+
if (parser.protocol === "http:" && parser.port === "80" || parser.protocol === "https:" && parser.port === "443") {
|
37840
|
+
origin += parser.hostname;
|
37841
|
+
} else {
|
37842
|
+
origin += parser.host;
|
37843
|
+
}
|
37844
|
+
} else {
|
37845
|
+
origin += window.location.host;
|
37846
|
+
}
|
37847
|
+
let pathname = parser.pathname;
|
37848
|
+
if (!pathname.startsWith("/")) {
|
37849
|
+
pathname = "/" + pathname;
|
37850
|
+
}
|
37851
|
+
return {
|
37852
|
+
host: parser.host || window.location.host,
|
37853
|
+
hostname: parser.hostname,
|
37854
|
+
origin,
|
37855
|
+
protocol: parser.protocol,
|
37856
|
+
pathname
|
37857
|
+
};
|
37858
|
+
}
|
37859
|
+
__name(parseUrl, "parseUrl");
|
37860
|
+
function uuidv4(a, b) {
|
37861
|
+
for (b = a = ""; a++ < 36; b += a * 51 & 52 ? (a ^ 15 ? 8 ^ Math.random() * (a ^ 20 ? 16 : 4) : 4).toString(16) : "-")
|
37862
|
+
;
|
37863
|
+
return b;
|
37864
|
+
}
|
37865
|
+
__name(uuidv4, "uuidv4");
|
37866
|
+
function isValidMessage(message) {
|
37867
|
+
return message && typeof message === "object" && message.jsonrpc === "2.0" && message.id && typeof message.id === "string";
|
37868
|
+
}
|
37869
|
+
__name(isValidMessage, "isValidMessage");
|
37870
|
+
function isValidRequest(message) {
|
37871
|
+
return isValidMessage(message) && Array.isArray(message.params);
|
37872
|
+
}
|
37873
|
+
__name(isValidRequest, "isValidRequest");
|
37874
|
+
function isValidResponse(message) {
|
37875
|
+
return isValidMessage(message) && !!("result" in message ^ "error" in message) && (!("error" in message) || isValidError(message.error));
|
37876
|
+
}
|
37877
|
+
__name(isValidResponse, "isValidResponse");
|
37878
|
+
function isValidError(error) {
|
37879
|
+
return error && typeof error === "object" && typeof error.code === "number" && typeof error.message === "string";
|
37880
|
+
}
|
37881
|
+
__name(isValidError, "isValidError");
|
37882
|
+
function serializeError(error) {
|
37883
|
+
const err = {
|
37884
|
+
message: error.message
|
37885
|
+
};
|
37886
|
+
if (error.constructor.name !== "Error") {
|
37887
|
+
err.constructor = error.constructor.name;
|
37888
|
+
}
|
37889
|
+
if ("name" in error) {
|
37890
|
+
err.name = error.name;
|
37891
|
+
}
|
37892
|
+
if ("code" in error) {
|
37893
|
+
err.code = error.code;
|
37894
|
+
} else {
|
37895
|
+
err.code = RPC_ERRORS.ServerError.code;
|
37896
|
+
}
|
37897
|
+
if ("details" in error) {
|
37898
|
+
err.details = error.details;
|
37899
|
+
}
|
37900
|
+
return err;
|
37901
|
+
}
|
37902
|
+
__name(serializeError, "serializeError");
|
37903
|
+
function deserializeError(error) {
|
37904
|
+
let err;
|
37905
|
+
if (error.constructor === "DOMException") {
|
37906
|
+
err = new DOMException(error.message, error.name);
|
37907
|
+
} else {
|
37908
|
+
err = new Error(error.message);
|
37909
|
+
if ("code" in error) {
|
37910
|
+
err.code = error.code;
|
37911
|
+
}
|
37912
|
+
}
|
37913
|
+
if (error.details) {
|
37914
|
+
err.details = error.details;
|
37915
|
+
}
|
37916
|
+
return err;
|
37917
|
+
}
|
37918
|
+
__name(deserializeError, "deserializeError");
|
37919
|
+
function createMessageListener({ listener: listener2, origin, handle, expectRequest }) {
|
37920
|
+
if (isHandlePromise(handle)) {
|
37921
|
+
const promise = handle;
|
37922
|
+
handle = false;
|
37923
|
+
promise.then((h) => handle = h);
|
37924
|
+
}
|
37925
|
+
return (e) => {
|
37926
|
+
if (!(e.source === handle && e.origin === origin && (expectRequest && isValidRequest(e.data) || !expectRequest && isValidResponse(e.data)))) {
|
37927
|
+
return;
|
37928
|
+
}
|
37929
|
+
listener2(e.data, e);
|
37930
|
+
};
|
37931
|
+
}
|
37932
|
+
__name(createMessageListener, "createMessageListener");
|
37933
|
+
function destructureMethodName(fqMethodName) {
|
37934
|
+
let [name5, ...rest] = fqMethodName.split(".");
|
37935
|
+
const method = rest.pop();
|
37936
|
+
name5 = [name5, ...rest].join(".");
|
37937
|
+
return { name: name5, method };
|
37938
|
+
}
|
37939
|
+
__name(destructureMethodName, "destructureMethodName");
|
37940
|
+
function isHandlePromise(handle) {
|
37941
|
+
try {
|
37942
|
+
return typeof handle.then === "function";
|
37943
|
+
} catch (e) {
|
37944
|
+
}
|
37945
|
+
return false;
|
37946
|
+
}
|
37947
|
+
__name(isHandlePromise, "isHandlePromise");
|
37948
|
+
|
37949
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/Client.js
|
37950
|
+
var RPC_CLIENT_CALL_TIMEOUT = 3e4;
|
37951
|
+
var Client = class {
|
37952
|
+
constructor() {
|
37953
|
+
this.origin = null;
|
37954
|
+
this._handle = null;
|
37955
|
+
this._listener = null;
|
37956
|
+
this._pending = /* @__PURE__ */ new Map();
|
37957
|
+
}
|
37958
|
+
connect(origin, options) {
|
37959
|
+
return __async(this, null, function* () {
|
37960
|
+
if (this._listener) {
|
37961
|
+
throw new Error("Already connected.");
|
37962
|
+
}
|
37963
|
+
options = options || {};
|
37964
|
+
const self2 = this;
|
37965
|
+
self2.origin = parseUrl(origin).origin;
|
37966
|
+
self2._handle = options.handle || window.opener || window.parent;
|
37967
|
+
const pending = self2._pending;
|
37968
|
+
self2._listener = createMessageListener({
|
37969
|
+
origin: self2.origin,
|
37970
|
+
handle: self2._handle,
|
37971
|
+
expectRequest: false,
|
37972
|
+
listener: (message) => {
|
37973
|
+
if (!pending.has(message.id)) {
|
37974
|
+
return;
|
37975
|
+
}
|
37976
|
+
const { resolve, reject, cancelTimeout } = pending.get(message.id);
|
37977
|
+
cancelTimeout();
|
37978
|
+
if ("result" in message) {
|
37979
|
+
return resolve(message.result);
|
37980
|
+
}
|
37981
|
+
reject(deserializeError(message.error));
|
37982
|
+
}
|
37983
|
+
});
|
37984
|
+
window.addEventListener("message", self2._listener);
|
37985
|
+
return new Injector(self2);
|
37986
|
+
});
|
37987
|
+
}
|
37988
|
+
send(_0, _1, _2) {
|
37989
|
+
return __async(this, arguments, function* (qualifiedMethodName, parameters, {
|
37990
|
+
timeout = RPC_CLIENT_CALL_TIMEOUT
|
37991
|
+
}) {
|
37992
|
+
if (!this._listener) {
|
37993
|
+
throw new Error("RPC client not connected.");
|
37994
|
+
}
|
37995
|
+
const self2 = this;
|
37996
|
+
const message = {
|
37997
|
+
jsonrpc: "2.0",
|
37998
|
+
id: uuidv4(),
|
37999
|
+
method: qualifiedMethodName,
|
38000
|
+
params: parameters
|
38001
|
+
};
|
38002
|
+
if (isHandlePromise(self2._handle)) {
|
38003
|
+
const handle = yield self2._handle;
|
38004
|
+
handle.postMessage(message, self2.origin);
|
38005
|
+
} else {
|
38006
|
+
self2._handle.postMessage(message, self2.origin);
|
38007
|
+
}
|
38008
|
+
return new Promise((resolve, reject) => {
|
38009
|
+
const pending = self2._pending;
|
38010
|
+
let cancelTimeout;
|
38011
|
+
if (timeout > 0) {
|
38012
|
+
const timeoutId = setTimeout(() => {
|
38013
|
+
pending.delete(message.id);
|
38014
|
+
reject(new Error("RPC call timed out."));
|
38015
|
+
}, timeout);
|
38016
|
+
cancelTimeout = /* @__PURE__ */ __name(() => {
|
38017
|
+
pending.delete(message.id);
|
38018
|
+
clearTimeout(timeoutId);
|
38019
|
+
}, "cancelTimeout");
|
38020
|
+
} else {
|
38021
|
+
cancelTimeout = /* @__PURE__ */ __name(() => {
|
38022
|
+
pending.delete(message.id);
|
38023
|
+
}, "cancelTimeout");
|
38024
|
+
}
|
38025
|
+
pending.set(message.id, { resolve, reject, cancelTimeout });
|
38026
|
+
});
|
38027
|
+
});
|
38028
|
+
}
|
38029
|
+
close() {
|
38030
|
+
if (this._listener) {
|
38031
|
+
window.removeEventListener("message", this._listener);
|
38032
|
+
this._handle = this.origin = this._listener = null;
|
38033
|
+
for (const value of this._pending.values()) {
|
38034
|
+
value.reject(new Error("RPC client closed."));
|
38035
|
+
}
|
38036
|
+
this._pending = /* @__PURE__ */ new Map();
|
38037
|
+
}
|
38038
|
+
}
|
38039
|
+
};
|
38040
|
+
__name(Client, "Client");
|
38041
|
+
var Injector = class {
|
38042
|
+
constructor(client) {
|
38043
|
+
this.client = client;
|
38044
|
+
this._apis = /* @__PURE__ */ new Map();
|
38045
|
+
}
|
38046
|
+
define(name5, definition) {
|
38047
|
+
if (!(name5 && typeof name5 === "string")) {
|
38048
|
+
throw new TypeError("`name` must be a non-empty string.");
|
38049
|
+
}
|
38050
|
+
if (!(definition && typeof definition === "object" && Array.isArray(definition.functions))) {
|
38051
|
+
throw new TypeError("`definition.function` must be an array of function names or function definition objects to be defined.");
|
38052
|
+
}
|
38053
|
+
const self2 = this;
|
38054
|
+
const api = {};
|
38055
|
+
definition.functions.forEach((fn) => {
|
38056
|
+
if (typeof fn === "string") {
|
38057
|
+
fn = { name: fn, options: {} };
|
38058
|
+
}
|
38059
|
+
api[fn.name] = function() {
|
38060
|
+
return __async(this, arguments, function* () {
|
38061
|
+
return self2.client.send(name5 + "." + fn.name, [...arguments], fn.options);
|
38062
|
+
});
|
38063
|
+
};
|
38064
|
+
});
|
38065
|
+
self2._apis[name5] = api;
|
38066
|
+
return api;
|
38067
|
+
}
|
38068
|
+
get(name5, definition) {
|
38069
|
+
const api = this._apis[name5];
|
38070
|
+
if (!api) {
|
38071
|
+
if (definition) {
|
38072
|
+
return this.define(name5, definition);
|
38073
|
+
}
|
38074
|
+
throw new Error(`API "${name5}" has not been defined.`);
|
38075
|
+
}
|
38076
|
+
return this._apis[name5];
|
38077
|
+
}
|
38078
|
+
};
|
38079
|
+
__name(Injector, "Injector");
|
38080
|
+
|
38081
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/EventEmitter.js
|
38082
|
+
var EventEmitter = class {
|
38083
|
+
constructor({ deserialize = /* @__PURE__ */ __name((e) => e, "deserialize"), waitUntil = /* @__PURE__ */ __name(() => __async(this, null, function* () {
|
38084
|
+
}), "waitUntil") } = {}) {
|
38085
|
+
this._listeners = [];
|
38086
|
+
this._deserialize = deserialize;
|
38087
|
+
this._waitUntil = waitUntil;
|
38088
|
+
}
|
38089
|
+
emit(event) {
|
38090
|
+
return __async(this, null, function* () {
|
38091
|
+
event = this._deserialize(event);
|
38092
|
+
(this._listeners[event.type] || []).forEach((l) => l(event));
|
38093
|
+
return this._waitUntil(event);
|
38094
|
+
});
|
38095
|
+
}
|
38096
|
+
addEventListener(eventType, fn) {
|
38097
|
+
if (!this._listeners[eventType]) {
|
38098
|
+
this._listeners[eventType] = [fn];
|
38099
|
+
} else {
|
38100
|
+
this._listeners[eventType].push(fn);
|
38101
|
+
}
|
38102
|
+
}
|
38103
|
+
removeEventListener(eventType, fn) {
|
38104
|
+
const listeners = this._listeners[eventType];
|
38105
|
+
if (!listeners) {
|
38106
|
+
return;
|
38107
|
+
}
|
38108
|
+
const idx = listeners.indexOf(fn);
|
38109
|
+
if (idx !== -1) {
|
38110
|
+
listeners.splice(idx, 1);
|
38111
|
+
}
|
38112
|
+
}
|
38113
|
+
};
|
38114
|
+
__name(EventEmitter, "EventEmitter");
|
38115
|
+
|
38116
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/Server.js
|
38117
|
+
var Server = class {
|
38118
|
+
constructor() {
|
38119
|
+
this.origin = null;
|
38120
|
+
this._handle = null;
|
38121
|
+
this._apis = /* @__PURE__ */ new Map();
|
38122
|
+
}
|
38123
|
+
define(name5, api) {
|
38124
|
+
if (!(name5 && typeof name5 === "string")) {
|
38125
|
+
throw new TypeError("`name` must be a non-empty string.");
|
38126
|
+
}
|
38127
|
+
if (!(api && api !== "object")) {
|
38128
|
+
throw new TypeError("`api` must be an object.");
|
38129
|
+
}
|
38130
|
+
if (name5 in this._apis) {
|
38131
|
+
throw new Error(`The "${name5}" API is already defined.`);
|
38132
|
+
}
|
38133
|
+
this._apis[name5] = api;
|
38134
|
+
}
|
38135
|
+
listen(origin, options) {
|
38136
|
+
return __async(this, null, function* () {
|
38137
|
+
if (this._listener) {
|
38138
|
+
throw new Error("Already listening.");
|
38139
|
+
}
|
38140
|
+
options = options || {};
|
38141
|
+
const self2 = this;
|
38142
|
+
self2.origin = parseUrl(origin).origin;
|
38143
|
+
self2._handle = options.handle || window.opener || window.parent;
|
38144
|
+
const ignoreUnknownApi = options.ignoreUnknownApi === "true" || false;
|
38145
|
+
self2._listener = createMessageListener({
|
38146
|
+
origin: self2.origin,
|
38147
|
+
handle: self2._handle,
|
38148
|
+
expectRequest: true,
|
38149
|
+
listener: (message) => {
|
38150
|
+
const { name: name5, method } = destructureMethodName(message.method);
|
38151
|
+
const api = self2._apis[name5];
|
38152
|
+
if (method && method.startsWith("_")) {
|
38153
|
+
return sendMethodNotFound(self2._handle, self2.origin, message);
|
38154
|
+
}
|
38155
|
+
if (!api && ignoreUnknownApi) {
|
38156
|
+
return;
|
38157
|
+
}
|
38158
|
+
if (!api || typeof api[method] !== "function") {
|
38159
|
+
return sendMethodNotFound(self2._handle, self2.origin, message);
|
38160
|
+
}
|
38161
|
+
const fn = api[method];
|
38162
|
+
(() => __async(this, null, function* () {
|
38163
|
+
const response = {
|
38164
|
+
jsonrpc: "2.0",
|
38165
|
+
id: message.id
|
38166
|
+
};
|
38167
|
+
try {
|
38168
|
+
response.result = yield fn.apply(api, message.params);
|
38169
|
+
} catch (e) {
|
38170
|
+
response.error = serializeError(e);
|
38171
|
+
}
|
38172
|
+
if (self2._handle) {
|
38173
|
+
if (isHandlePromise(self2._handle)) {
|
38174
|
+
self2._handle.then((h) => h.postMessage(response, self2.origin));
|
38175
|
+
} else {
|
38176
|
+
self2._handle.postMessage(response, self2.origin);
|
38177
|
+
}
|
38178
|
+
}
|
38179
|
+
}))();
|
38180
|
+
}
|
38181
|
+
});
|
38182
|
+
window.addEventListener("message", self2._listener);
|
38183
|
+
});
|
38184
|
+
}
|
38185
|
+
close() {
|
38186
|
+
if (this._listener) {
|
38187
|
+
window.removeEventListener("message", this._listener);
|
38188
|
+
this._handle = this.origin = this._listener = null;
|
38189
|
+
}
|
38190
|
+
}
|
38191
|
+
};
|
38192
|
+
__name(Server, "Server");
|
38193
|
+
function sendMethodNotFound(handle, origin, message) {
|
38194
|
+
const response = {
|
38195
|
+
jsonrpc: "2.0",
|
38196
|
+
id: message.id,
|
38197
|
+
error: Object.assign({}, RPC_ERRORS.MethodNotFound)
|
38198
|
+
};
|
38199
|
+
if (isHandlePromise(handle)) {
|
38200
|
+
return handle.then((h) => h.postMessage(response, origin));
|
38201
|
+
} else {
|
38202
|
+
return handle.postMessage(response, origin);
|
38203
|
+
}
|
38204
|
+
}
|
38205
|
+
__name(sendMethodNotFound, "sendMethodNotFound");
|
38206
|
+
|
38207
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebApp.js
|
38208
|
+
var WebApp = class {
|
38209
|
+
constructor(relyingOrigin) {
|
38210
|
+
this.relyingOrigin = parseUrl(relyingOrigin).origin;
|
38211
|
+
this.client = null;
|
38212
|
+
this.injector = null;
|
38213
|
+
this.client = new Client();
|
38214
|
+
this.server = new Server();
|
38215
|
+
this._control = null;
|
38216
|
+
this._connected = false;
|
38217
|
+
}
|
38218
|
+
connect() {
|
38219
|
+
return __async(this, null, function* () {
|
38220
|
+
this.injector = yield this.client.connect(this.relyingOrigin);
|
38221
|
+
this._connected = true;
|
38222
|
+
this._control = this.injector.define("core.control", {
|
38223
|
+
functions: ["ready", "show", "hide"]
|
38224
|
+
});
|
38225
|
+
this.server.listen(this.relyingOrigin);
|
38226
|
+
return this.injector;
|
38227
|
+
});
|
38228
|
+
}
|
38229
|
+
ready() {
|
38230
|
+
return __async(this, null, function* () {
|
38231
|
+
if (!this._connected) {
|
38232
|
+
throw new Error('WebApp not connected. Did you call ".connect()"?');
|
38233
|
+
}
|
38234
|
+
yield this._control.ready();
|
38235
|
+
return this;
|
38236
|
+
});
|
38237
|
+
}
|
38238
|
+
close() {
|
38239
|
+
if (this._connected) {
|
38240
|
+
this.server.close();
|
38241
|
+
this.client.close();
|
38242
|
+
this._connected = false;
|
38243
|
+
}
|
38244
|
+
}
|
38245
|
+
show() {
|
38246
|
+
return __async(this, null, function* () {
|
38247
|
+
if (!this._connected) {
|
38248
|
+
throw new Error('Cannot "show" yet; not connected. Did you call ".connect()"?');
|
38249
|
+
}
|
38250
|
+
return this._control.show();
|
38251
|
+
});
|
38252
|
+
}
|
38253
|
+
hide() {
|
38254
|
+
return __async(this, null, function* () {
|
38255
|
+
if (!this._connected) {
|
38256
|
+
throw new Error('Cannot "hide" yet; not connected. Did you call ".connect()?"');
|
38257
|
+
}
|
38258
|
+
return this._control.hide();
|
38259
|
+
});
|
38260
|
+
}
|
38261
|
+
};
|
38262
|
+
__name(WebApp, "WebApp");
|
38263
|
+
|
38264
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebAppWindowDialog.js
|
38265
|
+
var WebAppWindowDialog = class {
|
38266
|
+
constructor() {
|
38267
|
+
this._closeEventListeners = /* @__PURE__ */ new Set();
|
38268
|
+
}
|
38269
|
+
addEventListener(name5, listener2) {
|
38270
|
+
if (name5 !== "close") {
|
38271
|
+
throw new Error(`Unknown event "${name5}".`);
|
38272
|
+
}
|
38273
|
+
if (typeof listener2 !== "function") {
|
38274
|
+
throw new TypeError('"listener" must be a function.');
|
38275
|
+
}
|
38276
|
+
this._closeEventListeners.add(listener2);
|
38277
|
+
}
|
38278
|
+
removeEventListener(name5, listener2) {
|
38279
|
+
if (name5 !== "close") {
|
38280
|
+
throw new Error(`Unknown event "${name5}".`);
|
38281
|
+
}
|
38282
|
+
if (typeof listener2 !== "function") {
|
38283
|
+
throw new TypeError('"listener" must be a function.');
|
38284
|
+
}
|
38285
|
+
this._closeEventListeners.delete(listener2);
|
38286
|
+
}
|
38287
|
+
show() {
|
38288
|
+
}
|
38289
|
+
close() {
|
38290
|
+
for (const listener2 of this._closeEventListeners) {
|
38291
|
+
listener2({});
|
38292
|
+
}
|
38293
|
+
}
|
38294
|
+
destroy() {
|
38295
|
+
this._closeEventListeners.clear();
|
38296
|
+
}
|
38297
|
+
};
|
38298
|
+
__name(WebAppWindowDialog, "WebAppWindowDialog");
|
38299
|
+
|
38300
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebAppWindowInlineDialog.js
|
38301
|
+
var WebAppWindowInlineDialog = class extends WebAppWindowDialog {
|
38302
|
+
constructor({ url, handle, className }) {
|
38303
|
+
super();
|
38304
|
+
this.url = url;
|
38305
|
+
this.handle = handle;
|
38306
|
+
this.dialog = document.createElement("dialog");
|
38307
|
+
applyStyle(this.dialog, {
|
38308
|
+
position: "fixed",
|
38309
|
+
top: 0,
|
38310
|
+
left: 0,
|
38311
|
+
width: "100%",
|
38312
|
+
height: "100%",
|
38313
|
+
"max-width": "100%",
|
38314
|
+
"max-height": "100%",
|
38315
|
+
display: "none",
|
38316
|
+
margin: 0,
|
38317
|
+
padding: 0,
|
38318
|
+
border: "none",
|
38319
|
+
background: "transparent",
|
38320
|
+
color: "black",
|
38321
|
+
"box-sizing": "border-box",
|
38322
|
+
overflow: "hidden",
|
38323
|
+
"z-index": 1e6
|
38324
|
+
});
|
38325
|
+
this.dialog.className = "web-app-window";
|
38326
|
+
if (typeof className === "string") {
|
38327
|
+
this.dialog.className = this.dialog.className + " " + className;
|
38328
|
+
}
|
38329
|
+
const style = document.createElement("style");
|
38330
|
+
style.appendChild(document.createTextNode(`dialog.web-app-window::backdrop {
|
38331
|
+
background-color: transparent;
|
38332
|
+
}`));
|
38333
|
+
this.container = document.createElement("div");
|
38334
|
+
applyStyle(this.container, {
|
38335
|
+
position: "relative",
|
38336
|
+
width: "100%",
|
38337
|
+
height: "100%",
|
38338
|
+
margin: 0,
|
38339
|
+
padding: 0,
|
38340
|
+
display: "flex",
|
38341
|
+
"flex-direction": "column"
|
38342
|
+
});
|
38343
|
+
this.container.className = "web-app-window-backdrop";
|
38344
|
+
this.iframe = document.createElement("iframe");
|
38345
|
+
this.iframe.src = url;
|
38346
|
+
this.iframe.scrolling = "auto";
|
38347
|
+
applyStyle(this.iframe, {
|
38348
|
+
position: "fixed",
|
38349
|
+
top: 0,
|
38350
|
+
left: 0,
|
38351
|
+
width: "100%",
|
38352
|
+
height: "100%",
|
38353
|
+
border: "none",
|
38354
|
+
background: "transparent",
|
38355
|
+
overflow: "hidden",
|
38356
|
+
margin: 0,
|
38357
|
+
padding: 0,
|
38358
|
+
"flex-grow": 1
|
38359
|
+
});
|
38360
|
+
this.dialog.appendChild(style);
|
38361
|
+
this.container.appendChild(this.iframe);
|
38362
|
+
this.dialog.appendChild(this.container);
|
38363
|
+
this.dialog.addEventListener("cancel", (e) => {
|
38364
|
+
e.preventDefault();
|
38365
|
+
this.hide();
|
38366
|
+
});
|
38367
|
+
document.body.appendChild(this.dialog);
|
38368
|
+
this.handle = this.iframe.contentWindow;
|
38369
|
+
}
|
38370
|
+
show() {
|
38371
|
+
this.dialog.style.display = "block";
|
38372
|
+
if (this.dialog.showModal) {
|
38373
|
+
this.dialog.showModal();
|
38374
|
+
}
|
38375
|
+
}
|
38376
|
+
close() {
|
38377
|
+
this.dialog.style.display = "none";
|
38378
|
+
if (this.dialog.close) {
|
38379
|
+
try {
|
38380
|
+
this.dialog.close();
|
38381
|
+
} catch (e) {
|
38382
|
+
console.error(e);
|
38383
|
+
}
|
38384
|
+
}
|
38385
|
+
super.close();
|
38386
|
+
}
|
38387
|
+
destroy() {
|
38388
|
+
this.dialog.parentNode.removeChild(this.dialog);
|
38389
|
+
super.destroy();
|
38390
|
+
}
|
38391
|
+
};
|
38392
|
+
__name(WebAppWindowInlineDialog, "WebAppWindowInlineDialog");
|
38393
|
+
function applyStyle(element, style) {
|
38394
|
+
for (const name5 in style) {
|
38395
|
+
element.style[name5] = style[name5];
|
38396
|
+
}
|
38397
|
+
}
|
38398
|
+
__name(applyStyle, "applyStyle");
|
38399
|
+
|
38400
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebAppWindowPopupDialog.js
|
38401
|
+
var WebAppWindowPopupDialog = class extends WebAppWindowDialog {
|
38402
|
+
constructor({ url, handle, bounds = { width: 500, height: 400 } }) {
|
38403
|
+
super();
|
38404
|
+
this.url = url;
|
38405
|
+
this.handle = handle;
|
38406
|
+
this._locationChanging = false;
|
38407
|
+
if (!handle) {
|
38408
|
+
this._openWindow({ url, name: "web-app-window", bounds });
|
38409
|
+
}
|
38410
|
+
this.destroyed = false;
|
38411
|
+
this._removeListeners = () => {
|
38412
|
+
};
|
38413
|
+
}
|
38414
|
+
show() {
|
38415
|
+
}
|
38416
|
+
close() {
|
38417
|
+
this.destroy();
|
38418
|
+
}
|
38419
|
+
destroy() {
|
38420
|
+
if (this.handle && !this.destroyed) {
|
38421
|
+
this.handle.close();
|
38422
|
+
super.close();
|
38423
|
+
this.handle = null;
|
38424
|
+
this.destroyed = true;
|
38425
|
+
this._removeListeners();
|
38426
|
+
super.destroy();
|
38427
|
+
}
|
38428
|
+
}
|
38429
|
+
isClosed() {
|
38430
|
+
return !this.handle || this.handle.closed;
|
38431
|
+
}
|
38432
|
+
_openWindow({ url, name: name5, bounds }) {
|
38433
|
+
const { x, y } = bounds;
|
38434
|
+
let { width = 500, height = 400 } = bounds;
|
38435
|
+
width = Math.min(width, window.innerWidth);
|
38436
|
+
height = Math.min(height, window.innerHeight);
|
38437
|
+
const left = x !== void 0 ? x : window.screenX + (window.innerWidth - width) / 2;
|
38438
|
+
const top = y !== void 0 ? y : window.screenY + (window.innerHeight - height) / 2;
|
38439
|
+
const features = `popup=yes,menubar=no,location=no,resizable=no,scrollbars=no,status=no,width=${width},height=${height},left=${left},top=${top}`;
|
38440
|
+
this._locationChanging = true;
|
38441
|
+
this.handle = window.open(url, name5, features);
|
38442
|
+
this._addListeners();
|
38443
|
+
}
|
38444
|
+
setLocation(url) {
|
38445
|
+
this.url = url;
|
38446
|
+
this._locationChanging = true;
|
38447
|
+
this.handle.location.replace(url);
|
38448
|
+
}
|
38449
|
+
_addListeners() {
|
38450
|
+
const destroyDialog = /* @__PURE__ */ __name(() => this.destroy(), "destroyDialog");
|
38451
|
+
const loadDialog = /* @__PURE__ */ __name(() => {
|
38452
|
+
this._locationChanging = false;
|
38453
|
+
}, "loadDialog");
|
38454
|
+
const unloadDialog = /* @__PURE__ */ __name(() => {
|
38455
|
+
if (this._locationChanging) {
|
38456
|
+
return;
|
38457
|
+
}
|
38458
|
+
this.destroy();
|
38459
|
+
}, "unloadDialog");
|
38460
|
+
this.handle.addEventListener("unload", unloadDialog);
|
38461
|
+
this.handle.addEventListener("load", loadDialog);
|
38462
|
+
window.addEventListener("beforeUnload", destroyDialog, { once: true });
|
38463
|
+
const intervalId = setInterval(() => {
|
38464
|
+
if (this.isClosed()) {
|
38465
|
+
this.destroy();
|
38466
|
+
clearInterval(intervalId);
|
38467
|
+
}
|
38468
|
+
}, 250);
|
38469
|
+
this._removeListeners = () => {
|
38470
|
+
clearInterval(intervalId);
|
38471
|
+
this.handle.removeListener("unload", unloadDialog);
|
38472
|
+
this.handle.removeListener("load", loadDialog);
|
38473
|
+
window.removeEventListener("beforeUnload", destroyDialog);
|
38474
|
+
};
|
38475
|
+
}
|
38476
|
+
};
|
38477
|
+
__name(WebAppWindowPopupDialog, "WebAppWindowPopupDialog");
|
38478
|
+
|
38479
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebAppWindow.js
|
38480
|
+
var LOAD_WINDOW_TIMEOUT = 6e4;
|
38481
|
+
var WebAppWindow = class {
|
38482
|
+
constructor(url, {
|
38483
|
+
timeout = LOAD_WINDOW_TIMEOUT,
|
38484
|
+
dialog = null,
|
38485
|
+
handle,
|
38486
|
+
popup = false,
|
38487
|
+
className = null,
|
38488
|
+
customize = null,
|
38489
|
+
bounds
|
38490
|
+
} = {}) {
|
38491
|
+
this.visible = false;
|
38492
|
+
this.dialog = dialog;
|
38493
|
+
this.handle = null;
|
38494
|
+
this.popup = popup;
|
38495
|
+
this.windowControl = null;
|
38496
|
+
this._destroyed = false;
|
38497
|
+
this._ready = false;
|
38498
|
+
this._private = {};
|
38499
|
+
this._timeoutId = null;
|
38500
|
+
if (handle && handle._dialog) {
|
38501
|
+
this.dialog = dialog = handle._dialog;
|
38502
|
+
}
|
38503
|
+
this._private._readyPromise = new Promise((resolve, reject) => {
|
38504
|
+
this._timeoutId = setTimeout(() => reject(new DOMException("Loading Web application window timed out.", "TimeoutError")), timeout);
|
38505
|
+
this._private._resolveReady = (value) => {
|
38506
|
+
clearTimeout(this.timeoutId);
|
38507
|
+
this._timeoutId = null;
|
38508
|
+
resolve(value);
|
38509
|
+
};
|
38510
|
+
this._private._rejectReady = (err) => {
|
38511
|
+
clearTimeout(this.timeoutId);
|
38512
|
+
this._timeoutId = null;
|
38513
|
+
reject(err);
|
38514
|
+
};
|
38515
|
+
});
|
38516
|
+
this._private.isReady = () => __async(this, null, function* () {
|
38517
|
+
return this._private._readyPromise;
|
38518
|
+
});
|
38519
|
+
this._private.destroy = () => {
|
38520
|
+
if (this._timeoutId) {
|
38521
|
+
this._private._rejectReady(new DOMException("Web application window closed before ready.", "AbortError"));
|
38522
|
+
}
|
38523
|
+
if (!this._destroyed) {
|
38524
|
+
this.dialog.destroy();
|
38525
|
+
this.dialog = null;
|
38526
|
+
this._destroyed = true;
|
38527
|
+
}
|
38528
|
+
};
|
38529
|
+
if (customize) {
|
38530
|
+
if (!typeof customize === "function") {
|
38531
|
+
throw new TypeError("`options.customize` must be a function.");
|
38532
|
+
}
|
38533
|
+
}
|
38534
|
+
if (!this.dialog) {
|
38535
|
+
if (this.popup) {
|
38536
|
+
this.dialog = new WebAppWindowPopupDialog({ url, handle, bounds });
|
38537
|
+
} else {
|
38538
|
+
this.dialog = new WebAppWindowInlineDialog({ url, handle, className });
|
38539
|
+
}
|
38540
|
+
} else if (this.popup && bounds) {
|
38541
|
+
if (bounds) {
|
38542
|
+
const { top: y, left: x, width, height } = bounds;
|
38543
|
+
if (x !== void 0 && y !== void 0) {
|
38544
|
+
this.dialog.handle.moveTo(x, y);
|
38545
|
+
}
|
38546
|
+
if (width !== void 0 && height !== void 0) {
|
38547
|
+
this.dialog.handle.resizeTo(width, height);
|
38548
|
+
}
|
38549
|
+
}
|
38550
|
+
}
|
38551
|
+
this.handle = this.dialog.handle;
|
38552
|
+
if (customize) {
|
38553
|
+
try {
|
38554
|
+
customize({
|
38555
|
+
dialog: this.dialog.dialog,
|
38556
|
+
container: this.dialog.container,
|
38557
|
+
iframe: this.dialog.iframe,
|
38558
|
+
webAppWindow: this
|
38559
|
+
});
|
38560
|
+
} catch (e) {
|
38561
|
+
console.error(e);
|
38562
|
+
}
|
38563
|
+
}
|
38564
|
+
}
|
38565
|
+
ready() {
|
38566
|
+
this._ready = true;
|
38567
|
+
this._private._resolveReady(true);
|
38568
|
+
}
|
38569
|
+
show() {
|
38570
|
+
if (!this.visible) {
|
38571
|
+
this.visible = true;
|
38572
|
+
const body = document.querySelector("body");
|
38573
|
+
this._bodyOverflowStyle = body.style.overflow;
|
38574
|
+
body.style.overflow = "hidden";
|
38575
|
+
if (!this._destroyed) {
|
38576
|
+
this.dialog.show();
|
38577
|
+
} else if (this.windowControl.show) {
|
38578
|
+
this.windowControl.show();
|
38579
|
+
}
|
38580
|
+
}
|
38581
|
+
}
|
38582
|
+
hide() {
|
38583
|
+
if (this.visible) {
|
38584
|
+
this.visible = false;
|
38585
|
+
const body = document.querySelector("body");
|
38586
|
+
if (this._bodyOverflowStyle) {
|
38587
|
+
body.style.overflow = this._bodyOverflowStyle;
|
38588
|
+
} else {
|
38589
|
+
body.style.overflow = "";
|
38590
|
+
}
|
38591
|
+
if (!this._destroyed) {
|
38592
|
+
this.dialog.close();
|
38593
|
+
} else if (this.windowControl.hide) {
|
38594
|
+
this.windowControl.hide();
|
38595
|
+
}
|
38596
|
+
}
|
38597
|
+
}
|
38598
|
+
};
|
38599
|
+
__name(WebAppWindow, "WebAppWindow");
|
38600
|
+
|
38601
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebAppContext.js
|
38602
|
+
var WEB_APP_CONTEXT_LOAD_TIMEOUT = 1e4;
|
38603
|
+
var WebAppContext = class {
|
38604
|
+
constructor() {
|
38605
|
+
this.client = new Client();
|
38606
|
+
this.server = new Server();
|
38607
|
+
this.injector = null;
|
38608
|
+
this.control = null;
|
38609
|
+
this.loaded = false;
|
38610
|
+
this.closed = false;
|
38611
|
+
}
|
38612
|
+
createWindow(_0) {
|
38613
|
+
return __async(this, arguments, function* (url, {
|
38614
|
+
timeout = WEB_APP_CONTEXT_LOAD_TIMEOUT,
|
38615
|
+
iframe,
|
38616
|
+
dialog = null,
|
38617
|
+
popup = false,
|
38618
|
+
handle,
|
38619
|
+
windowControl,
|
38620
|
+
className,
|
38621
|
+
customize,
|
38622
|
+
bounds
|
38623
|
+
} = {}) {
|
38624
|
+
if (this.loaded) {
|
38625
|
+
throw new Error("AppContext already loaded.");
|
38626
|
+
}
|
38627
|
+
this.loaded = true;
|
38628
|
+
this.control = new WebAppWindow(url, {
|
38629
|
+
timeout,
|
38630
|
+
dialog,
|
38631
|
+
iframe,
|
38632
|
+
popup,
|
38633
|
+
handle,
|
38634
|
+
windowControl,
|
38635
|
+
className,
|
38636
|
+
customize,
|
38637
|
+
bounds
|
38638
|
+
});
|
38639
|
+
window.addEventListener("pagehide", () => this.close(), { once: true });
|
38640
|
+
this.server.define("core.control", this.control);
|
38641
|
+
const origin = parseUrl(url).origin;
|
38642
|
+
this.server.listen(origin, {
|
38643
|
+
handle: this.control.handle,
|
38644
|
+
ignoreUnknownApi: true
|
38645
|
+
});
|
38646
|
+
yield this.control._private.isReady();
|
38647
|
+
this.injector = yield this.client.connect(origin, {
|
38648
|
+
handle: this.control.handle
|
38649
|
+
});
|
38650
|
+
return this.injector;
|
38651
|
+
});
|
38652
|
+
}
|
38653
|
+
close() {
|
38654
|
+
if (!this.closed) {
|
38655
|
+
this.closed = true;
|
38656
|
+
this.control._private.destroy();
|
38657
|
+
this.server.close();
|
38658
|
+
this.client.close();
|
38659
|
+
}
|
38660
|
+
}
|
38661
|
+
};
|
38662
|
+
__name(WebAppContext, "WebAppContext");
|
38663
|
+
|
38664
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialRequestEvent.js
|
38665
|
+
var CredentialRequestEvent = class {
|
38666
|
+
constructor({
|
38667
|
+
credentialHandler,
|
38668
|
+
credentialRequestOrigin,
|
38669
|
+
credentialRequestOptions,
|
38670
|
+
hintKey
|
38671
|
+
}) {
|
38672
|
+
this.type = "credentialrequest";
|
38673
|
+
this._credentialHandler = credentialHandler;
|
38674
|
+
this.credentialRequestOrigin = credentialRequestOrigin;
|
38675
|
+
this.credentialRequestOptions = credentialRequestOptions;
|
38676
|
+
this.hintKey = hintKey;
|
38677
|
+
}
|
38678
|
+
openWindow(url) {
|
38679
|
+
return __async(this, null, function* () {
|
38680
|
+
yield this._credentialHandler.show();
|
38681
|
+
const appWindow = new WebAppWindow(url, {
|
38682
|
+
className: "credential-handler"
|
38683
|
+
});
|
38684
|
+
appWindow.ready();
|
38685
|
+
appWindow.show();
|
38686
|
+
appWindow.handle._dialog = appWindow.dialog;
|
38687
|
+
return appWindow.handle;
|
38688
|
+
});
|
38689
|
+
}
|
38690
|
+
respondWith(handlerResponse) {
|
38691
|
+
this._promise = handlerResponse;
|
38692
|
+
}
|
38693
|
+
};
|
38694
|
+
__name(CredentialRequestEvent, "CredentialRequestEvent");
|
38695
|
+
|
38696
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialStoreEvent.js
|
38697
|
+
var CredentialStoreEvent = class {
|
38698
|
+
constructor({
|
38699
|
+
credentialHandler,
|
38700
|
+
credentialRequestOrigin,
|
38701
|
+
credential,
|
38702
|
+
hintKey
|
38703
|
+
}) {
|
38704
|
+
this.type = "credentialstore";
|
38705
|
+
this._credentialHandler = credentialHandler;
|
38706
|
+
this.credentialRequestOrigin = credentialRequestOrigin;
|
38707
|
+
this.credential = credential;
|
38708
|
+
this.hintKey = hintKey;
|
38709
|
+
}
|
38710
|
+
openWindow(url) {
|
38711
|
+
return __async(this, null, function* () {
|
38712
|
+
yield this._credentialHandler.show();
|
38713
|
+
const appWindow = new WebAppWindow(url);
|
38714
|
+
appWindow.ready();
|
38715
|
+
appWindow.show();
|
38716
|
+
appWindow.handle._dialog = appWindow.dialog;
|
38717
|
+
return appWindow.handle;
|
38718
|
+
});
|
38719
|
+
}
|
38720
|
+
respondWith(handlerResponse) {
|
38721
|
+
this._promise = handlerResponse;
|
38722
|
+
}
|
38723
|
+
};
|
38724
|
+
__name(CredentialStoreEvent, "CredentialStoreEvent");
|
38725
|
+
|
38726
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialHandlerService.js
|
38727
|
+
var CredentialHandlerService = class {
|
38728
|
+
constructor(credentialHandler) {
|
38729
|
+
this._credentialHandler = credentialHandler;
|
38730
|
+
}
|
38731
|
+
request(credentialRequestEvent) {
|
38732
|
+
return __async(this, null, function* () {
|
38733
|
+
return yield this._credentialHandler._emitter.emit(new CredentialRequestEvent(Object.assign({ credentialHandler: this._credentialHandler }, credentialRequestEvent)));
|
38734
|
+
});
|
38735
|
+
}
|
38736
|
+
store(credentialStoreEvent) {
|
38737
|
+
return __async(this, null, function* () {
|
38738
|
+
return yield this._credentialHandler._emitter.emit(new CredentialStoreEvent(Object.assign({ credentialHandler: this._credentialHandler }, credentialStoreEvent)));
|
38739
|
+
});
|
38740
|
+
}
|
38741
|
+
};
|
38742
|
+
__name(CredentialHandlerService, "CredentialHandlerService");
|
38743
|
+
|
38744
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialHandler.js
|
38745
|
+
var EVENT_TYPES = ["credentialrequest", "credentialstore"];
|
38746
|
+
var CredentialHandler = class extends WebApp {
|
38747
|
+
constructor(mediatorOrigin, inline = false) {
|
38748
|
+
if (typeof mediatorOrigin !== "string") {
|
38749
|
+
throw new TypeError('"mediatorOrigin" must be a string.');
|
38750
|
+
}
|
38751
|
+
super(mediatorOrigin, inline);
|
38752
|
+
this._emitter = new EventEmitter({
|
38753
|
+
waitUntil(event) {
|
38754
|
+
return __async(this, null, function* () {
|
38755
|
+
return event._promise || Promise.reject(new DOMException('No "credentialrequest" event handler found.', "NotFoundError"));
|
38756
|
+
});
|
38757
|
+
}
|
38758
|
+
});
|
38759
|
+
}
|
38760
|
+
connect() {
|
38761
|
+
return __async(this, null, function* () {
|
38762
|
+
const injector = yield __superGet(CredentialHandler.prototype, this, "connect").call(this);
|
38763
|
+
this.server.define("credentialHandler", new CredentialHandlerService(this));
|
38764
|
+
yield this.ready();
|
38765
|
+
return injector;
|
38766
|
+
});
|
38767
|
+
}
|
38768
|
+
addEventListener(eventType, fn) {
|
38769
|
+
if (!EVENT_TYPES.includes(eventType)) {
|
38770
|
+
throw new DOMException(`Unsupported event type "${eventType}"`, "NotSupportedError");
|
38771
|
+
}
|
38772
|
+
return this._emitter.addEventListener(eventType, fn);
|
38773
|
+
}
|
38774
|
+
removeEventListener(eventType, fn) {
|
38775
|
+
if (!EVENT_TYPES.includes(eventType)) {
|
38776
|
+
throw new DOMException(`Unsupported event type "${eventType}"`, "NotSupportedError");
|
38777
|
+
}
|
38778
|
+
return this._emitter.removeEventListener(eventType, fn);
|
38779
|
+
}
|
38780
|
+
};
|
38781
|
+
__name(CredentialHandler, "CredentialHandler");
|
38782
|
+
|
38783
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialHints.js
|
38784
|
+
var CredentialHints = class {
|
38785
|
+
constructor(url, injector) {
|
38786
|
+
const remote = injector.get("credentialHints", {
|
38787
|
+
functions: ["delete", "get", "keys", "has", "set", "clear"]
|
38788
|
+
});
|
38789
|
+
for (let methodName in remote) {
|
38790
|
+
if (methodName !== "set") {
|
38791
|
+
const method = remote[methodName].bind(this, url);
|
38792
|
+
this[methodName] = function(...args) {
|
38793
|
+
this._deprecateNotice();
|
38794
|
+
return method(...args);
|
38795
|
+
};
|
38796
|
+
}
|
38797
|
+
}
|
38798
|
+
this._remoteSet = remote.set.bind(this, url);
|
38799
|
+
}
|
38800
|
+
set(hintKey, credentialHint) {
|
38801
|
+
return __async(this, null, function* () {
|
38802
|
+
this._deprecateNotice();
|
38803
|
+
credentialHint.icons = credentialHint.icons || [];
|
38804
|
+
const promises = credentialHint.icons.map((icon) => imageToDataUrl(icon.src).then((fetchedImage) => {
|
38805
|
+
icon.fetchedImage = fetchedImage;
|
38806
|
+
}));
|
38807
|
+
yield Promise.all(promises);
|
38808
|
+
return this._remoteSet(hintKey, credentialHint);
|
38809
|
+
});
|
38810
|
+
}
|
38811
|
+
_deprecateNotice() {
|
38812
|
+
console.warn("Credential hints are deprecated and no longer used.");
|
38813
|
+
}
|
38814
|
+
};
|
38815
|
+
__name(CredentialHints, "CredentialHints");
|
38816
|
+
function imageToDataUrl(url) {
|
38817
|
+
return new Promise((resolve) => {
|
38818
|
+
const img = new Image();
|
38819
|
+
img.crossOrigin = "Anonymous";
|
38820
|
+
img.onload = () => {
|
38821
|
+
let canvas = document.createElement("canvas");
|
38822
|
+
const ctx = canvas.getContext("2d");
|
38823
|
+
canvas.height = img.height;
|
38824
|
+
canvas.width = img.width;
|
38825
|
+
ctx.drawImage(img, 0, 0);
|
38826
|
+
const dataUrl = canvas.toDataURL();
|
38827
|
+
resolve(dataUrl);
|
38828
|
+
canvas = null;
|
38829
|
+
};
|
38830
|
+
img.onerror = () => resolve(null);
|
38831
|
+
img.src = url;
|
38832
|
+
});
|
38833
|
+
}
|
38834
|
+
__name(imageToDataUrl, "imageToDataUrl");
|
38835
|
+
|
38836
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialManager.js
|
38837
|
+
var CredentialManager = class {
|
38838
|
+
constructor(url, injector) {
|
38839
|
+
if (!(url && typeof url === "string")) {
|
38840
|
+
throw new TypeError('"url" must be a non-empty string.');
|
38841
|
+
}
|
38842
|
+
this.hints = new CredentialHints(url, injector);
|
38843
|
+
}
|
38844
|
+
static requestPermission() {
|
38845
|
+
return __async(this, null, function* () {
|
38846
|
+
const status = yield navigator.credentialsPolyfill.permissions.request({ name: "credentialhandler" });
|
38847
|
+
return status.state;
|
38848
|
+
});
|
38849
|
+
}
|
38850
|
+
};
|
38851
|
+
__name(CredentialManager, "CredentialManager");
|
38852
|
+
|
38853
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialHandlerRegistration.js
|
38854
|
+
var CredentialHandlerRegistration = class {
|
38855
|
+
constructor(url, injector) {
|
38856
|
+
if (!(url && typeof url === "string")) {
|
38857
|
+
throw new TypeError('"url" must be a non-empty string.');
|
38858
|
+
}
|
38859
|
+
this.credentialManager = new CredentialManager(url, injector);
|
38860
|
+
}
|
38861
|
+
};
|
38862
|
+
__name(CredentialHandlerRegistration, "CredentialHandlerRegistration");
|
38863
|
+
|
38864
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialHandlers.js
|
38865
|
+
var CredentialHandlers = class {
|
38866
|
+
constructor(injector) {
|
38867
|
+
this._init = (() => __async(this, null, function* () {
|
38868
|
+
this._injector = yield injector;
|
38869
|
+
this._remote = this._injector.get("credentialHandlers", {
|
38870
|
+
functions: [
|
38871
|
+
"register",
|
38872
|
+
"unregister",
|
38873
|
+
"getRegistration",
|
38874
|
+
"hasRegistration"
|
38875
|
+
]
|
38876
|
+
});
|
38877
|
+
}))();
|
38878
|
+
}
|
38879
|
+
register(url) {
|
38880
|
+
return __async(this, null, function* () {
|
38881
|
+
this._deprecateNotice();
|
38882
|
+
yield this._init;
|
38883
|
+
url = yield this._remote.register("credential", url);
|
38884
|
+
return new CredentialHandlerRegistration(url, this._injector);
|
38885
|
+
});
|
38886
|
+
}
|
38887
|
+
unregister(url) {
|
38888
|
+
return __async(this, null, function* () {
|
38889
|
+
this._deprecateNotice();
|
38890
|
+
yield this._init;
|
38891
|
+
return this._remote.unregister("credential", url);
|
38892
|
+
});
|
38893
|
+
}
|
38894
|
+
getRegistration(url) {
|
38895
|
+
return __async(this, null, function* () {
|
38896
|
+
this._deprecateNotice();
|
38897
|
+
yield this._init;
|
38898
|
+
url = yield this._remote.getRegistration("credential", url);
|
38899
|
+
if (!url) {
|
38900
|
+
return null;
|
38901
|
+
}
|
38902
|
+
return new CredentialHandlerRegistration(url, this._injector);
|
38903
|
+
});
|
38904
|
+
}
|
38905
|
+
hasRegistration(url) {
|
38906
|
+
return __async(this, null, function* () {
|
38907
|
+
this._deprecateNotice();
|
38908
|
+
yield this._init;
|
38909
|
+
return yield this._remote.hasRegistration("credential", url);
|
38910
|
+
});
|
38911
|
+
}
|
38912
|
+
_deprecateNotice() {
|
38913
|
+
console.warn('Credential handler registration APIs are deprecated. The credential handler specified in "manifest.json" is now automatically registered when a user grants permission to install a credential handler via "CredentialManager.requestPermission()".');
|
38914
|
+
}
|
38915
|
+
};
|
38916
|
+
__name(CredentialHandlers, "CredentialHandlers");
|
38917
|
+
|
38918
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/WebCredential.js
|
38919
|
+
var WebCredential2 = class {
|
38920
|
+
constructor(dataType, data, { recommendedHandlerOrigins = [] } = {}) {
|
38921
|
+
if (typeof dataType !== "string") {
|
38922
|
+
throw new TypeError('"dataType" must be a string.');
|
38923
|
+
}
|
38924
|
+
this.type = "web";
|
38925
|
+
this.dataType = dataType;
|
38926
|
+
this.data = data;
|
38927
|
+
this.options = { recommendedHandlerOrigins };
|
38928
|
+
}
|
38929
|
+
};
|
38930
|
+
__name(WebCredential2, "WebCredential");
|
38931
|
+
|
38932
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialsContainer.js
|
38933
|
+
var CREDENTIAL_GET_TIMEOUT = 0;
|
38934
|
+
var CREDENTIAL_STORE_TIMEOUT = 0;
|
38935
|
+
var CredentialsContainer = class {
|
38936
|
+
constructor(injector) {
|
38937
|
+
this._nativeCredentialsContainer = {
|
38938
|
+
get: navigator.credentials && navigator.credentials.get && navigator.credentials.get.bind(navigator.credentials),
|
38939
|
+
store: navigator.credentials && navigator.credentials.store && navigator.credentials.store.bind(navigator.credentials)
|
38940
|
+
};
|
38941
|
+
this._init = (() => __async(this, null, function* () {
|
38942
|
+
this._remote = (yield injector).get("credentialsContainer", {
|
38943
|
+
functions: [
|
38944
|
+
{ name: "get", options: { timeout: CREDENTIAL_GET_TIMEOUT } },
|
38945
|
+
{ name: "store", options: { timeout: CREDENTIAL_STORE_TIMEOUT } }
|
38946
|
+
]
|
38947
|
+
});
|
38948
|
+
}))();
|
38949
|
+
}
|
38950
|
+
get() {
|
38951
|
+
return __async(this, arguments, function* (options = {}) {
|
38952
|
+
if (options.web) {
|
38953
|
+
yield this._init;
|
38954
|
+
const credential = yield this._remote.get(options);
|
38955
|
+
if (!credential) {
|
38956
|
+
return null;
|
38957
|
+
}
|
38958
|
+
return new WebCredential2(credential.dataType, credential.data);
|
38959
|
+
}
|
38960
|
+
if (this._nativeCredentialsContainer.get) {
|
38961
|
+
return this._nativeCredentialsContainer.get(options);
|
38962
|
+
}
|
38963
|
+
throw new DOMException("Not implemented.", "NotSupportedError");
|
38964
|
+
});
|
38965
|
+
}
|
38966
|
+
store(credential) {
|
38967
|
+
return __async(this, null, function* () {
|
38968
|
+
if (credential instanceof WebCredential2) {
|
38969
|
+
yield this._init;
|
38970
|
+
const result = yield this._remote.store(credential);
|
38971
|
+
if (!result) {
|
38972
|
+
return null;
|
38973
|
+
}
|
38974
|
+
return new WebCredential2(result.dataType, result.data);
|
38975
|
+
}
|
38976
|
+
if (this._nativeCredentialsContainer.store) {
|
38977
|
+
return this._nativeCredentialsContainer.store(credential);
|
38978
|
+
}
|
38979
|
+
throw new DOMException("Not implemented.", "NotSupportedError");
|
38980
|
+
});
|
38981
|
+
}
|
38982
|
+
};
|
38983
|
+
__name(CredentialsContainer, "CredentialsContainer");
|
38984
|
+
|
38985
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/PermissionManager.js
|
38986
|
+
var PERMISSION_REQUEST_TIMEOUT = 0;
|
38987
|
+
var PermissionManager = class {
|
38988
|
+
constructor(injector) {
|
38989
|
+
this._init = (() => __async(this, null, function* () {
|
38990
|
+
this._remote = (yield injector).get("permissionManager", {
|
38991
|
+
functions: [
|
38992
|
+
"query",
|
38993
|
+
{ name: "request", options: { timeout: PERMISSION_REQUEST_TIMEOUT } },
|
38994
|
+
"revoke"
|
38995
|
+
]
|
38996
|
+
});
|
38997
|
+
}))();
|
38998
|
+
}
|
38999
|
+
query(permissionDesc) {
|
39000
|
+
return __async(this, null, function* () {
|
39001
|
+
yield this._init;
|
39002
|
+
return yield this._remote.query(permissionDesc);
|
39003
|
+
});
|
39004
|
+
}
|
39005
|
+
request(permissionDesc) {
|
39006
|
+
return __async(this, null, function* () {
|
39007
|
+
yield this._init;
|
39008
|
+
return yield this._remote.request(permissionDesc);
|
39009
|
+
});
|
39010
|
+
}
|
39011
|
+
revoke(permissionDesc) {
|
39012
|
+
return __async(this, null, function* () {
|
39013
|
+
yield this._init;
|
39014
|
+
return yield this._remote.revoke(permissionDesc);
|
39015
|
+
});
|
39016
|
+
}
|
39017
|
+
};
|
39018
|
+
__name(PermissionManager, "PermissionManager");
|
39019
|
+
|
39020
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/index.js
|
39021
|
+
var DEFAULT_MEDIATOR_ORIGIN = "https://authn.io";
|
39022
|
+
var loaded;
|
39023
|
+
function loadOnce(options) {
|
39024
|
+
return __async(this, null, function* () {
|
39025
|
+
if (loaded) {
|
39026
|
+
return loaded;
|
39027
|
+
}
|
39028
|
+
loaded = true;
|
39029
|
+
return load2(options);
|
39030
|
+
});
|
39031
|
+
}
|
39032
|
+
__name(loadOnce, "loadOnce");
|
39033
|
+
function load2() {
|
39034
|
+
return __async(this, arguments, function* (options = {
|
39035
|
+
mediatorOrigin: DEFAULT_MEDIATOR_ORIGIN
|
39036
|
+
}) {
|
39037
|
+
let mediatorUrl;
|
39038
|
+
if (typeof options === "string") {
|
39039
|
+
mediatorUrl = options;
|
39040
|
+
} else if (options && typeof options === "object" && typeof options.mediatorOrigin === "string") {
|
39041
|
+
mediatorUrl = `${options.mediatorOrigin}/mediator`;
|
39042
|
+
} else {
|
39043
|
+
throw new Error('"options.mediatorOrigin" must be a string expressing the origin of the mediator.');
|
39044
|
+
}
|
39045
|
+
const appContext = new WebAppContext();
|
39046
|
+
const injector = appContext.createWindow(mediatorUrl, {
|
39047
|
+
className: "credential-mediator",
|
39048
|
+
timeout: 3e4
|
39049
|
+
});
|
39050
|
+
const style = document.createElement("style");
|
39051
|
+
style.appendChild(document.createTextNode(`dialog.web-app-window.credential-mediator > .web-app-window-backdrop {
|
39052
|
+
background-color: rgba(0, 0, 0, 0.25);
|
39053
|
+
}`));
|
39054
|
+
document.body.appendChild(style);
|
39055
|
+
const polyfill = {};
|
39056
|
+
polyfill.permissions = new PermissionManager(injector);
|
39057
|
+
polyfill.CredentialHandlers = new CredentialHandlers(injector);
|
39058
|
+
polyfill.CredentialHandler = CredentialHandler;
|
39059
|
+
polyfill.CredentialManager = CredentialManager;
|
39060
|
+
polyfill.credentials = new CredentialsContainer(injector);
|
39061
|
+
polyfill.WebCredential = WebCredential2;
|
39062
|
+
navigator.credentialsPolyfill = polyfill;
|
39063
|
+
if ("credentials" in navigator) {
|
39064
|
+
navigator.credentials.get = polyfill.credentials.get.bind(polyfill.credentials);
|
39065
|
+
navigator.credentials.store = polyfill.credentials.store.bind(polyfill.credentials);
|
39066
|
+
} else {
|
39067
|
+
navigator.credentials = polyfill.credentials;
|
39068
|
+
}
|
39069
|
+
window.CredentialManager = CredentialManager;
|
39070
|
+
window.WebCredential = WebCredential2;
|
39071
|
+
return polyfill;
|
39072
|
+
});
|
39073
|
+
}
|
39074
|
+
__name(load2, "load");
|
39075
|
+
|
39076
|
+
// ../../node_modules/.pnpm/web-credential-handler@2.0.0/node_modules/web-credential-handler/CredentialEventProxy.js
|
39077
|
+
var PROXY_EVENT_TIMEOUT = 6e4;
|
39078
|
+
var CredentialEventProxy = class extends WebApp {
|
39079
|
+
constructor() {
|
39080
|
+
super(window.location.origin);
|
39081
|
+
}
|
39082
|
+
receive() {
|
39083
|
+
return __async(this, null, function* () {
|
39084
|
+
const self2 = this;
|
39085
|
+
yield self2.connect();
|
39086
|
+
return new Promise((resolveReceive, rejectReceive) => {
|
39087
|
+
const timeoutId = setTimeout(() => {
|
39088
|
+
rejectReceive(new Error("Timed out waiting to receive event."));
|
39089
|
+
}, PROXY_EVENT_TIMEOUT);
|
39090
|
+
self2.server.define("credentialEventProxy", {
|
39091
|
+
send(event) {
|
39092
|
+
return __async(this, null, function* () {
|
39093
|
+
resolveReceive(event);
|
39094
|
+
clearTimeout(timeoutId);
|
39095
|
+
return new Promise((resolveSend, rejectSend) => {
|
39096
|
+
event.respondWith = (promise) => {
|
39097
|
+
try {
|
39098
|
+
resolveSend(promise);
|
39099
|
+
} catch (e) {
|
39100
|
+
rejectSend(e);
|
39101
|
+
}
|
39102
|
+
};
|
39103
|
+
});
|
39104
|
+
});
|
39105
|
+
}
|
39106
|
+
});
|
39107
|
+
self2.ready();
|
39108
|
+
});
|
39109
|
+
});
|
39110
|
+
}
|
39111
|
+
};
|
39112
|
+
__name(CredentialEventProxy, "CredentialEventProxy");
|
39113
|
+
|
39114
|
+
// ../../node_modules/.pnpm/web-credential-handler@2.0.0/node_modules/web-credential-handler/index.js
|
39115
|
+
var DEFAULT_MEDIATOR = "https://authn.io";
|
39116
|
+
function installHandler() {
|
39117
|
+
return __async(this, null, function* () {
|
39118
|
+
const CredentialManager2 = navigator.credentialsPolyfill.CredentialManager;
|
39119
|
+
const result = yield CredentialManager2.requestPermission();
|
39120
|
+
if (result !== "granted") {
|
39121
|
+
throw new Error("Permission denied.");
|
39122
|
+
}
|
39123
|
+
});
|
39124
|
+
}
|
39125
|
+
__name(installHandler, "installHandler");
|
39126
|
+
function activateHandler(_0) {
|
39127
|
+
return __async(this, arguments, function* ({
|
39128
|
+
mediatorOrigin = DEFAULT_MEDIATOR,
|
39129
|
+
get: get2,
|
39130
|
+
store
|
39131
|
+
}) {
|
39132
|
+
if (!(get2 || store)) {
|
39133
|
+
throw new Error('"get" or "store" function(s) must be specified.');
|
39134
|
+
}
|
39135
|
+
const CredentialHandler2 = navigator.credentialsPolyfill.CredentialHandler;
|
39136
|
+
const self2 = new CredentialHandler2(mediatorOrigin);
|
39137
|
+
if (get2) {
|
39138
|
+
if (typeof get2 !== "function") {
|
39139
|
+
throw new TypeError('"get" must be a function.');
|
39140
|
+
}
|
39141
|
+
self2.addEventListener("credentialrequest", (event) => listener({ event, get: get2 }));
|
39142
|
+
}
|
39143
|
+
if (store) {
|
39144
|
+
if (typeof store !== "function") {
|
39145
|
+
throw new TypeError('"store" must be a function.');
|
39146
|
+
}
|
39147
|
+
self2.addEventListener("credentialstore", (event) => listener({ event, store }));
|
39148
|
+
}
|
39149
|
+
yield self2.connect();
|
39150
|
+
});
|
39151
|
+
}
|
39152
|
+
__name(activateHandler, "activateHandler");
|
39153
|
+
function receiveCredentialEvent() {
|
39154
|
+
return __async(this, null, function* () {
|
39155
|
+
const proxy = new CredentialEventProxy();
|
39156
|
+
return proxy.receive();
|
39157
|
+
});
|
39158
|
+
}
|
39159
|
+
__name(receiveCredentialEvent, "receiveCredentialEvent");
|
39160
|
+
function listener({ event, get: get2, store }) {
|
39161
|
+
event.respondWith(createResponse({ event, get: get2, store }));
|
39162
|
+
}
|
39163
|
+
__name(listener, "listener");
|
39164
|
+
function createResponse(_0) {
|
39165
|
+
return __async(this, arguments, function* ({ event, get: get2, store }) {
|
39166
|
+
const result = yield (get2 || store)({ event });
|
39167
|
+
if (!(result && typeof result === "object")) {
|
39168
|
+
throw new TypeError('Return value of "get" or "store" hook must be an object.');
|
39169
|
+
}
|
39170
|
+
if (result.type === "response") {
|
39171
|
+
return { dataType: result.dataType, data: result.data };
|
39172
|
+
}
|
39173
|
+
if (result.type === "redirect") {
|
39174
|
+
const appContext = new WebAppContext();
|
39175
|
+
const handle = yield event.openWindow(result.url);
|
39176
|
+
const windowReady = appContext.createWindow(result.url, {
|
39177
|
+
handle,
|
39178
|
+
popup: false,
|
39179
|
+
timeout: 6e5
|
39180
|
+
});
|
39181
|
+
const injector = yield windowReady;
|
39182
|
+
const proxy = injector.get("credentialEventProxy", {
|
39183
|
+
functions: [{ name: "send", options: { timeout: 0 } }]
|
39184
|
+
});
|
39185
|
+
return proxy.send({
|
39186
|
+
type: event.type,
|
39187
|
+
credentialRequestOptions: event.credentialRequestOptions,
|
39188
|
+
credentialRequestOrigin: event.credentialRequestOrigin,
|
39189
|
+
credential: event.credential,
|
39190
|
+
hintKey: event.hintKey
|
39191
|
+
});
|
39192
|
+
}
|
39193
|
+
throw new Error('Return value of "get" or "store" must have a type of "response" or "redirect".');
|
39194
|
+
});
|
39195
|
+
}
|
39196
|
+
__name(createResponse, "createResponse");
|
39197
|
+
|
39198
|
+
// src/wallet/plugins/chapi/chapi.ts
|
39199
|
+
var getCHAPIPlugin = /* @__PURE__ */ __name(() => __async(void 0, null, function* () {
|
39200
|
+
if (typeof window === "undefined") {
|
39201
|
+
return {
|
39202
|
+
pluginMethods: {
|
39203
|
+
installChapiHandler: () => __async(void 0, null, function* () {
|
39204
|
+
throw new Error("CHAPI is only available inside of a browser!");
|
39205
|
+
}),
|
39206
|
+
activateChapiHandler: () => __async(void 0, null, function* () {
|
39207
|
+
throw new Error("CHAPI is only available inside of a browser!");
|
39208
|
+
}),
|
39209
|
+
receiveChapiEvent: () => __async(void 0, null, function* () {
|
39210
|
+
throw new Error("CHAPI is only available inside of a browser!");
|
39211
|
+
}),
|
39212
|
+
storeCredentialViaChapiDidAuth: () => __async(void 0, null, function* () {
|
39213
|
+
throw new Error("CHAPI is only available inside of a browser!");
|
39214
|
+
}),
|
39215
|
+
storePresentationViaChapi: () => __async(void 0, null, function* () {
|
39216
|
+
throw new Error("CHAPI is only available inside of a browser!");
|
39217
|
+
})
|
39218
|
+
}
|
39219
|
+
};
|
39220
|
+
}
|
39221
|
+
yield loadOnce();
|
39222
|
+
return {
|
39223
|
+
pluginMethods: {
|
39224
|
+
installChapiHandler: () => __async(void 0, null, function* () {
|
39225
|
+
return installHandler();
|
39226
|
+
}),
|
39227
|
+
activateChapiHandler: (_0, _1) => __async(void 0, [_0, _1], function* (_wallet, {
|
39228
|
+
mediatorOrigin = `https://authn.io/mediator?${encodeURIComponent(window.location.origin)}`,
|
39229
|
+
get: get2,
|
39230
|
+
store
|
39231
|
+
}) {
|
39232
|
+
return activateHandler({ mediatorOrigin, get: get2, store });
|
39233
|
+
}),
|
39234
|
+
receiveChapiEvent: () => __async(void 0, null, function* () {
|
39235
|
+
return receiveCredentialEvent();
|
39236
|
+
}),
|
39237
|
+
storeCredentialViaChapiDidAuth: (wallet, credential) => __async(void 0, null, function* () {
|
39238
|
+
var _a, _b, _c;
|
39239
|
+
const challenge = crypto.randomUUID();
|
39240
|
+
const domain = window.location.origin;
|
39241
|
+
const vpr = {
|
39242
|
+
web: {
|
39243
|
+
VerifiablePresentation: {
|
39244
|
+
query: { type: "DIDAuthentication" },
|
39245
|
+
challenge,
|
39246
|
+
domain
|
39247
|
+
}
|
39248
|
+
}
|
39249
|
+
};
|
39250
|
+
const res = yield navigator.credentials.get(vpr);
|
39251
|
+
if (!res)
|
39252
|
+
return { success: false, reason: "did not auth" };
|
39253
|
+
const verification = yield wallet.pluginMethods.verifyPresentation(res.data, {
|
39254
|
+
challenge,
|
39255
|
+
domain
|
39256
|
+
});
|
39257
|
+
if (verification.warnings.length > 0 || verification.errors.length > 0) {
|
39258
|
+
return { success: false, reason: "auth failed verification" };
|
39259
|
+
}
|
39260
|
+
const subject = (_c = (_b = (_a = res.data) == null ? void 0 : _a.proof) == null ? void 0 : _b.verificationMethod) == null ? void 0 : _c.split("#")[0];
|
39261
|
+
if (!Array.isArray(credential.credentialSubject)) {
|
39262
|
+
credential.credentialSubject.id = subject;
|
39263
|
+
}
|
39264
|
+
const vp = yield wallet.pluginMethods.issuePresentation(yield wallet.pluginMethods.getTestVp(yield wallet.pluginMethods.issueCredential(credential)));
|
39265
|
+
const success = yield wallet.pluginMethods.storePresentationViaChapi(vp);
|
39266
|
+
if (success)
|
39267
|
+
return { success: true };
|
39268
|
+
return { success: false, reason: "did not store" };
|
39269
|
+
}),
|
39270
|
+
storePresentationViaChapi: (_wallet, presentation) => __async(void 0, null, function* () {
|
39271
|
+
const wc = new WebCredential("VerifiablePresentation", presentation);
|
39272
|
+
return window.navigator.credentials.store(wc);
|
39273
|
+
})
|
39274
|
+
}
|
39275
|
+
};
|
39276
|
+
}), "getCHAPIPlugin");
|
36131
39277
|
|
36132
39278
|
// src/wallet/plugins/vc-templates/templates.ts
|
36133
39279
|
var VC_TEMPLATES = {
|
@@ -36176,9 +39322,9 @@ var VC_TEMPLATES = {
|
|
36176
39322
|
};
|
36177
39323
|
|
36178
39324
|
// src/wallet/plugins/vc-templates/vc-templates.ts
|
36179
|
-
var getVCTemplatesPlugin = /* @__PURE__ */ __name((
|
39325
|
+
var getVCTemplatesPlugin = /* @__PURE__ */ __name(() => {
|
36180
39326
|
return {
|
36181
|
-
pluginMethods:
|
39327
|
+
pluginMethods: {
|
36182
39328
|
newCredential: (_wallet, args = { type: "basic" }) => {
|
36183
39329
|
var _a, _b;
|
36184
39330
|
const did = args.did || ((_b = (_a = _wallet.pluginMethods).getSubjectDid) == null ? void 0 : _b.call(_a, "key"));
|
@@ -36206,7 +39352,7 @@ var getVCTemplatesPlugin = /* @__PURE__ */ __name((wallet) => {
|
|
36206
39352
|
verifiableCredential: credential
|
36207
39353
|
};
|
36208
39354
|
})
|
36209
|
-
}
|
39355
|
+
}
|
36210
39356
|
};
|
36211
39357
|
}, "getVCTemplatesPlugin");
|
36212
39358
|
|
@@ -40879,14 +44025,20 @@ var verifyCredential2 = /* @__PURE__ */ __name((wallet) => {
|
|
40879
44025
|
var emptyWallet = /* @__PURE__ */ __name((..._0) => __async(void 0, [..._0], function* ({ didkit } = {}) {
|
40880
44026
|
const didkitWallet = yield (yield generateWallet()).addPlugin(yield getDidKitPlugin(didkit));
|
40881
44027
|
const expirationWallet = yield didkitWallet.addPlugin(ExpirationPlugin(didkitWallet));
|
40882
|
-
const
|
44028
|
+
const templatesWallet = yield expirationWallet.addPlugin(getVCTemplatesPlugin());
|
44029
|
+
const wallet = yield templatesWallet.addPlugin(yield getCHAPIPlugin());
|
40883
44030
|
return {
|
40884
44031
|
_wallet: wallet,
|
40885
44032
|
newCredential: wallet.pluginMethods.newCredential,
|
40886
44033
|
newPresentation: wallet.pluginMethods.newPresentation,
|
40887
44034
|
verifyCredential: verifyCredential2(wallet),
|
40888
44035
|
verifyPresentation: wallet.pluginMethods.verifyPresentation,
|
40889
|
-
resolveDid: wallet.pluginMethods.resolveDid
|
44036
|
+
resolveDid: wallet.pluginMethods.resolveDid,
|
44037
|
+
installChapiHandler: wallet.pluginMethods.installChapiHandler,
|
44038
|
+
activateChapiHandler: wallet.pluginMethods.activateChapiHandler,
|
44039
|
+
receiveChapiEvent: wallet.pluginMethods.receiveChapiEvent,
|
44040
|
+
storePresentationViaChapi: wallet.pluginMethods.storePresentationViaChapi,
|
44041
|
+
storeCredentialViaChapiDidAuth: wallet.pluginMethods.storeCredentialViaChapiDidAuth
|
40890
44042
|
};
|
40891
44043
|
}), "emptyWallet");
|
40892
44044
|
|
@@ -48889,75 +52041,75 @@ var PatchError = function(_super) {
|
|
48889
52041
|
var JsonPatchError = PatchError;
|
48890
52042
|
var deepClone = _deepClone;
|
48891
52043
|
var objOps = {
|
48892
|
-
add: function(obj, key2,
|
52044
|
+
add: function(obj, key2, document2) {
|
48893
52045
|
obj[key2] = this.value;
|
48894
|
-
return { newDocument:
|
52046
|
+
return { newDocument: document2 };
|
48895
52047
|
},
|
48896
|
-
remove: function(obj, key2,
|
52048
|
+
remove: function(obj, key2, document2) {
|
48897
52049
|
var removed = obj[key2];
|
48898
52050
|
delete obj[key2];
|
48899
|
-
return { newDocument:
|
52051
|
+
return { newDocument: document2, removed };
|
48900
52052
|
},
|
48901
|
-
replace: function(obj, key2,
|
52053
|
+
replace: function(obj, key2, document2) {
|
48902
52054
|
var removed = obj[key2];
|
48903
52055
|
obj[key2] = this.value;
|
48904
|
-
return { newDocument:
|
52056
|
+
return { newDocument: document2, removed };
|
48905
52057
|
},
|
48906
|
-
move: function(obj, key2,
|
48907
|
-
var removed = getValueByPointer(
|
52058
|
+
move: function(obj, key2, document2) {
|
52059
|
+
var removed = getValueByPointer(document2, this.path);
|
48908
52060
|
if (removed) {
|
48909
52061
|
removed = _deepClone(removed);
|
48910
52062
|
}
|
48911
|
-
var originalValue = applyOperation(
|
48912
|
-
applyOperation(
|
48913
|
-
return { newDocument:
|
52063
|
+
var originalValue = applyOperation(document2, { op: "remove", path: this.from }).removed;
|
52064
|
+
applyOperation(document2, { op: "add", path: this.path, value: originalValue });
|
52065
|
+
return { newDocument: document2, removed };
|
48914
52066
|
},
|
48915
|
-
copy: function(obj, key2,
|
48916
|
-
var valueToCopy = getValueByPointer(
|
48917
|
-
applyOperation(
|
48918
|
-
return { newDocument:
|
52067
|
+
copy: function(obj, key2, document2) {
|
52068
|
+
var valueToCopy = getValueByPointer(document2, this.from);
|
52069
|
+
applyOperation(document2, { op: "add", path: this.path, value: _deepClone(valueToCopy) });
|
52070
|
+
return { newDocument: document2 };
|
48919
52071
|
},
|
48920
|
-
test: function(obj, key2,
|
48921
|
-
return { newDocument:
|
52072
|
+
test: function(obj, key2, document2) {
|
52073
|
+
return { newDocument: document2, test: _areEquals(obj[key2], this.value) };
|
48922
52074
|
},
|
48923
|
-
_get: function(obj, key2,
|
52075
|
+
_get: function(obj, key2, document2) {
|
48924
52076
|
this.value = obj[key2];
|
48925
|
-
return { newDocument:
|
52077
|
+
return { newDocument: document2 };
|
48926
52078
|
}
|
48927
52079
|
};
|
48928
52080
|
var arrOps = {
|
48929
|
-
add: function(arr, i,
|
52081
|
+
add: function(arr, i, document2) {
|
48930
52082
|
if (isInteger2(i)) {
|
48931
52083
|
arr.splice(i, 0, this.value);
|
48932
52084
|
} else {
|
48933
52085
|
arr[i] = this.value;
|
48934
52086
|
}
|
48935
|
-
return { newDocument:
|
52087
|
+
return { newDocument: document2, index: i };
|
48936
52088
|
},
|
48937
|
-
remove: function(arr, i,
|
52089
|
+
remove: function(arr, i, document2) {
|
48938
52090
|
var removedList = arr.splice(i, 1);
|
48939
|
-
return { newDocument:
|
52091
|
+
return { newDocument: document2, removed: removedList[0] };
|
48940
52092
|
},
|
48941
|
-
replace: function(arr, i,
|
52093
|
+
replace: function(arr, i, document2) {
|
48942
52094
|
var removed = arr[i];
|
48943
52095
|
arr[i] = this.value;
|
48944
|
-
return { newDocument:
|
52096
|
+
return { newDocument: document2, removed };
|
48945
52097
|
},
|
48946
52098
|
move: objOps.move,
|
48947
52099
|
copy: objOps.copy,
|
48948
52100
|
test: objOps.test,
|
48949
52101
|
_get: objOps._get
|
48950
52102
|
};
|
48951
|
-
function getValueByPointer(
|
52103
|
+
function getValueByPointer(document2, pointer) {
|
48952
52104
|
if (pointer == "") {
|
48953
|
-
return
|
52105
|
+
return document2;
|
48954
52106
|
}
|
48955
52107
|
var getOriginalDestination = { op: "_get", path: pointer };
|
48956
|
-
applyOperation(
|
52108
|
+
applyOperation(document2, getOriginalDestination);
|
48957
52109
|
return getOriginalDestination.value;
|
48958
52110
|
}
|
48959
52111
|
__name(getValueByPointer, "getValueByPointer");
|
48960
|
-
function applyOperation(
|
52112
|
+
function applyOperation(document2, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {
|
48961
52113
|
if (validateOperation === void 0) {
|
48962
52114
|
validateOperation = false;
|
48963
52115
|
}
|
@@ -48972,54 +52124,54 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
48972
52124
|
}
|
48973
52125
|
if (validateOperation) {
|
48974
52126
|
if (typeof validateOperation == "function") {
|
48975
|
-
validateOperation(operation, 0,
|
52127
|
+
validateOperation(operation, 0, document2, operation.path);
|
48976
52128
|
} else {
|
48977
52129
|
validator(operation, 0);
|
48978
52130
|
}
|
48979
52131
|
}
|
48980
52132
|
if (operation.path === "") {
|
48981
|
-
var returnValue = { newDocument:
|
52133
|
+
var returnValue = { newDocument: document2 };
|
48982
52134
|
if (operation.op === "add") {
|
48983
52135
|
returnValue.newDocument = operation.value;
|
48984
52136
|
return returnValue;
|
48985
52137
|
} else if (operation.op === "replace") {
|
48986
52138
|
returnValue.newDocument = operation.value;
|
48987
|
-
returnValue.removed =
|
52139
|
+
returnValue.removed = document2;
|
48988
52140
|
return returnValue;
|
48989
52141
|
} else if (operation.op === "move" || operation.op === "copy") {
|
48990
|
-
returnValue.newDocument = getValueByPointer(
|
52142
|
+
returnValue.newDocument = getValueByPointer(document2, operation.from);
|
48991
52143
|
if (operation.op === "move") {
|
48992
|
-
returnValue.removed =
|
52144
|
+
returnValue.removed = document2;
|
48993
52145
|
}
|
48994
52146
|
return returnValue;
|
48995
52147
|
} else if (operation.op === "test") {
|
48996
|
-
returnValue.test = _areEquals(
|
52148
|
+
returnValue.test = _areEquals(document2, operation.value);
|
48997
52149
|
if (returnValue.test === false) {
|
48998
|
-
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation,
|
52150
|
+
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document2);
|
48999
52151
|
}
|
49000
|
-
returnValue.newDocument =
|
52152
|
+
returnValue.newDocument = document2;
|
49001
52153
|
return returnValue;
|
49002
52154
|
} else if (operation.op === "remove") {
|
49003
|
-
returnValue.removed =
|
52155
|
+
returnValue.removed = document2;
|
49004
52156
|
returnValue.newDocument = null;
|
49005
52157
|
return returnValue;
|
49006
52158
|
} else if (operation.op === "_get") {
|
49007
|
-
operation.value =
|
52159
|
+
operation.value = document2;
|
49008
52160
|
return returnValue;
|
49009
52161
|
} else {
|
49010
52162
|
if (validateOperation) {
|
49011
|
-
throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation,
|
52163
|
+
throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation, document2);
|
49012
52164
|
} else {
|
49013
52165
|
return returnValue;
|
49014
52166
|
}
|
49015
52167
|
}
|
49016
52168
|
} else {
|
49017
52169
|
if (!mutateDocument) {
|
49018
|
-
|
52170
|
+
document2 = _deepClone(document2);
|
49019
52171
|
}
|
49020
52172
|
var path = operation.path || "";
|
49021
52173
|
var keys = path.split("/");
|
49022
|
-
var obj =
|
52174
|
+
var obj = document2;
|
49023
52175
|
var t = 1;
|
49024
52176
|
var len = keys.length;
|
49025
52177
|
var existingPathFragment = void 0;
|
@@ -49046,7 +52198,7 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
49046
52198
|
existingPathFragment = operation.path;
|
49047
52199
|
}
|
49048
52200
|
if (existingPathFragment !== void 0) {
|
49049
|
-
validateFunction(operation, 0,
|
52201
|
+
validateFunction(operation, 0, document2, existingPathFragment);
|
49050
52202
|
}
|
49051
52203
|
}
|
49052
52204
|
}
|
@@ -49056,39 +52208,39 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
49056
52208
|
key2 = obj.length;
|
49057
52209
|
} else {
|
49058
52210
|
if (validateOperation && !isInteger2(key2)) {
|
49059
|
-
throw new JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation,
|
52211
|
+
throw new JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation, document2);
|
49060
52212
|
} else if (isInteger2(key2)) {
|
49061
52213
|
key2 = ~~key2;
|
49062
52214
|
}
|
49063
52215
|
}
|
49064
52216
|
if (t >= len) {
|
49065
52217
|
if (validateOperation && operation.op === "add" && key2 > obj.length) {
|
49066
|
-
throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", index, operation,
|
52218
|
+
throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", index, operation, document2);
|
49067
52219
|
}
|
49068
|
-
var returnValue = arrOps[operation.op].call(operation, obj, key2,
|
52220
|
+
var returnValue = arrOps[operation.op].call(operation, obj, key2, document2);
|
49069
52221
|
if (returnValue.test === false) {
|
49070
|
-
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation,
|
52222
|
+
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document2);
|
49071
52223
|
}
|
49072
52224
|
return returnValue;
|
49073
52225
|
}
|
49074
52226
|
} else {
|
49075
52227
|
if (t >= len) {
|
49076
|
-
var returnValue = objOps[operation.op].call(operation, obj, key2,
|
52228
|
+
var returnValue = objOps[operation.op].call(operation, obj, key2, document2);
|
49077
52229
|
if (returnValue.test === false) {
|
49078
|
-
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation,
|
52230
|
+
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document2);
|
49079
52231
|
}
|
49080
52232
|
return returnValue;
|
49081
52233
|
}
|
49082
52234
|
}
|
49083
52235
|
obj = obj[key2];
|
49084
52236
|
if (validateOperation && t < len && (!obj || typeof obj !== "object")) {
|
49085
|
-
throw new JsonPatchError("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", index, operation,
|
52237
|
+
throw new JsonPatchError("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", index, operation, document2);
|
49086
52238
|
}
|
49087
52239
|
}
|
49088
52240
|
}
|
49089
52241
|
}
|
49090
52242
|
__name(applyOperation, "applyOperation");
|
49091
|
-
function applyPatch(
|
52243
|
+
function applyPatch(document2, patch, validateOperation, mutateDocument, banPrototypeModifications) {
|
49092
52244
|
if (mutateDocument === void 0) {
|
49093
52245
|
mutateDocument = true;
|
49094
52246
|
}
|
@@ -49101,72 +52253,72 @@ function applyPatch(document, patch, validateOperation, mutateDocument, banProto
|
|
49101
52253
|
}
|
49102
52254
|
}
|
49103
52255
|
if (!mutateDocument) {
|
49104
|
-
|
52256
|
+
document2 = _deepClone(document2);
|
49105
52257
|
}
|
49106
52258
|
var results = new Array(patch.length);
|
49107
52259
|
for (var i = 0, length_1 = patch.length; i < length_1; i++) {
|
49108
|
-
results[i] = applyOperation(
|
49109
|
-
|
52260
|
+
results[i] = applyOperation(document2, patch[i], validateOperation, true, banPrototypeModifications, i);
|
52261
|
+
document2 = results[i].newDocument;
|
49110
52262
|
}
|
49111
|
-
results.newDocument =
|
52263
|
+
results.newDocument = document2;
|
49112
52264
|
return results;
|
49113
52265
|
}
|
49114
52266
|
__name(applyPatch, "applyPatch");
|
49115
|
-
function applyReducer(
|
49116
|
-
var operationResult = applyOperation(
|
52267
|
+
function applyReducer(document2, operation, index) {
|
52268
|
+
var operationResult = applyOperation(document2, operation);
|
49117
52269
|
if (operationResult.test === false) {
|
49118
|
-
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation,
|
52270
|
+
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document2);
|
49119
52271
|
}
|
49120
52272
|
return operationResult.newDocument;
|
49121
52273
|
}
|
49122
52274
|
__name(applyReducer, "applyReducer");
|
49123
|
-
function validator(operation, index,
|
52275
|
+
function validator(operation, index, document2, existingPathFragment) {
|
49124
52276
|
if (typeof operation !== "object" || operation === null || Array.isArray(operation)) {
|
49125
|
-
throw new JsonPatchError("Operation is not an object", "OPERATION_NOT_AN_OBJECT", index, operation,
|
52277
|
+
throw new JsonPatchError("Operation is not an object", "OPERATION_NOT_AN_OBJECT", index, operation, document2);
|
49126
52278
|
} else if (!objOps[operation.op]) {
|
49127
|
-
throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation,
|
52279
|
+
throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation, document2);
|
49128
52280
|
} else if (typeof operation.path !== "string") {
|
49129
|
-
throw new JsonPatchError("Operation `path` property is not a string", "OPERATION_PATH_INVALID", index, operation,
|
52281
|
+
throw new JsonPatchError("Operation `path` property is not a string", "OPERATION_PATH_INVALID", index, operation, document2);
|
49130
52282
|
} else if (operation.path.indexOf("/") !== 0 && operation.path.length > 0) {
|
49131
|
-
throw new JsonPatchError('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", index, operation,
|
52283
|
+
throw new JsonPatchError('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", index, operation, document2);
|
49132
52284
|
} else if ((operation.op === "move" || operation.op === "copy") && typeof operation.from !== "string") {
|
49133
|
-
throw new JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", index, operation,
|
52285
|
+
throw new JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", index, operation, document2);
|
49134
52286
|
} else if ((operation.op === "add" || operation.op === "replace" || operation.op === "test") && operation.value === void 0) {
|
49135
|
-
throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", index, operation,
|
52287
|
+
throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", index, operation, document2);
|
49136
52288
|
} else if ((operation.op === "add" || operation.op === "replace" || operation.op === "test") && hasUndefined(operation.value)) {
|
49137
|
-
throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", index, operation,
|
49138
|
-
} else if (
|
52289
|
+
throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", index, operation, document2);
|
52290
|
+
} else if (document2) {
|
49139
52291
|
if (operation.op == "add") {
|
49140
52292
|
var pathLen = operation.path.split("/").length;
|
49141
52293
|
var existingPathLen = existingPathFragment.split("/").length;
|
49142
52294
|
if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {
|
49143
|
-
throw new JsonPatchError("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", index, operation,
|
52295
|
+
throw new JsonPatchError("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", index, operation, document2);
|
49144
52296
|
}
|
49145
52297
|
} else if (operation.op === "replace" || operation.op === "remove" || operation.op === "_get") {
|
49146
52298
|
if (operation.path !== existingPathFragment) {
|
49147
|
-
throw new JsonPatchError("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", index, operation,
|
52299
|
+
throw new JsonPatchError("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", index, operation, document2);
|
49148
52300
|
}
|
49149
52301
|
} else if (operation.op === "move" || operation.op === "copy") {
|
49150
52302
|
var existingValue = { op: "_get", path: operation.from, value: void 0 };
|
49151
|
-
var error = validate5([existingValue],
|
52303
|
+
var error = validate5([existingValue], document2);
|
49152
52304
|
if (error && error.name === "OPERATION_PATH_UNRESOLVABLE") {
|
49153
|
-
throw new JsonPatchError("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", index, operation,
|
52305
|
+
throw new JsonPatchError("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", index, operation, document2);
|
49154
52306
|
}
|
49155
52307
|
}
|
49156
52308
|
}
|
49157
52309
|
}
|
49158
52310
|
__name(validator, "validator");
|
49159
|
-
function validate5(sequence,
|
52311
|
+
function validate5(sequence, document2, externalValidator) {
|
49160
52312
|
try {
|
49161
52313
|
if (!Array.isArray(sequence)) {
|
49162
52314
|
throw new JsonPatchError("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
|
49163
52315
|
}
|
49164
|
-
if (
|
49165
|
-
applyPatch(_deepClone(
|
52316
|
+
if (document2) {
|
52317
|
+
applyPatch(_deepClone(document2), _deepClone(sequence), externalValidator || true);
|
49166
52318
|
} else {
|
49167
52319
|
externalValidator = externalValidator || validator;
|
49168
52320
|
for (var i = 0; i < sequence.length; i++) {
|
49169
|
-
externalValidator(sequence[i], i,
|
52321
|
+
externalValidator(sequence[i], i, document2, void 0);
|
49170
52322
|
}
|
49171
52323
|
}
|
49172
52324
|
} catch (e) {
|
@@ -49394,11 +52546,11 @@ var fast_json_patch_default = Object.assign({}, core_exports, duplex_exports, {
|
|
49394
52546
|
unescapePathComponent
|
49395
52547
|
});
|
49396
52548
|
|
49397
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.3.0/node_modules/@ceramicnetwork/stream-tile/lib/tile-document.js
|
52549
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/stream-tile/lib/tile-document.js
|
49398
52550
|
var import_lodash3 = __toESM(require_lodash(), 1);
|
49399
52551
|
var import_random3 = __toESM(require_random(), 1);
|
49400
52552
|
|
49401
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/streamopts.js
|
52553
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/streamopts.js
|
49402
52554
|
var SyncOptions;
|
49403
52555
|
(function(SyncOptions2) {
|
49404
52556
|
SyncOptions2[SyncOptions2["PREFER_CACHE"] = 0] = "PREFER_CACHE";
|
@@ -49406,7 +52558,7 @@ var SyncOptions;
|
|
49406
52558
|
SyncOptions2[SyncOptions2["NEVER_SYNC"] = 2] = "NEVER_SYNC";
|
49407
52559
|
})(SyncOptions || (SyncOptions = {}));
|
49408
52560
|
|
49409
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
52561
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
49410
52562
|
var import_lodash = __toESM(require_lodash(), 1);
|
49411
52563
|
|
49412
52564
|
// ../../node_modules/.pnpm/tslib@2.4.0/node_modules/tslib/modules/index.js
|
@@ -51300,7 +54452,7 @@ function throttle(durationSelector, config2) {
|
|
51300
54452
|
}
|
51301
54453
|
__name(throttle, "throttle");
|
51302
54454
|
|
51303
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
54455
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
51304
54456
|
var SignatureStatus;
|
51305
54457
|
(function(SignatureStatus2) {
|
51306
54458
|
SignatureStatus2[SignatureStatus2["GENESIS"] = 0] = "GENESIS";
|
@@ -51379,10 +54531,10 @@ function StreamStatic() {
|
|
51379
54531
|
}
|
51380
54532
|
__name(StreamStatic, "StreamStatic");
|
51381
54533
|
|
51382
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/http-utils.js
|
54534
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/http-utils.js
|
51383
54535
|
var import_cross_fetch = __toESM(require("cross-fetch"), 1);
|
51384
54536
|
|
51385
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/abort-signal-utils.js
|
54537
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/abort-signal-utils.js
|
51386
54538
|
function mergeAbortSignals(signals) {
|
51387
54539
|
const controller = new AbortController();
|
51388
54540
|
if (signals.length === 0) {
|
@@ -51432,7 +54584,7 @@ function abortable2(original, fn) {
|
|
51432
54584
|
}
|
51433
54585
|
__name(abortable2, "abortable");
|
51434
54586
|
|
51435
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/http-utils.js
|
54587
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/http-utils.js
|
51436
54588
|
var DEFAULT_FETCH_TIMEOUT = 60 * 1e3 * 3;
|
51437
54589
|
function fetchJson(_0) {
|
51438
54590
|
return __async(this, arguments, function* (url, opts = {}) {
|
@@ -51457,10 +54609,10 @@ function fetchJson(_0) {
|
|
51457
54609
|
}
|
51458
54610
|
__name(fetchJson, "fetchJson");
|
51459
54611
|
|
51460
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/stream-utils.js
|
54612
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/stream-utils.js
|
51461
54613
|
var import_lodash2 = __toESM(require_lodash(), 1);
|
51462
54614
|
|
51463
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/cid-utils.js
|
54615
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/cid-utils.js
|
51464
54616
|
init_cid();
|
51465
54617
|
function toCID(givenCid) {
|
51466
54618
|
const cid = CID.asCID(givenCid);
|
@@ -51477,7 +54629,7 @@ function toCID(givenCid) {
|
|
51477
54629
|
}
|
51478
54630
|
__name(toCID, "toCID");
|
51479
54631
|
|
51480
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/stream-utils.js
|
54632
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/stream-utils.js
|
51481
54633
|
var TILE_TYPE_ID = 0;
|
51482
54634
|
var StreamUtils = class {
|
51483
54635
|
static streamIdFromState(state) {
|
@@ -51657,7 +54809,7 @@ var StreamUtils = class {
|
|
51657
54809
|
};
|
51658
54810
|
__name(StreamUtils, "StreamUtils");
|
51659
54811
|
|
51660
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/accountid-utils.js
|
54812
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/accountid-utils.js
|
51661
54813
|
function normalizeAccountId(accountId) {
|
51662
54814
|
if (typeof accountId === "string" && accountId.includes("@")) {
|
51663
54815
|
const [address, chainId] = accountId.split("@");
|
@@ -51670,7 +54822,7 @@ function normalizeAccountId(accountId) {
|
|
51670
54822
|
}
|
51671
54823
|
__name(normalizeAccountId, "normalizeAccountId");
|
51672
54824
|
|
51673
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/stream-state-subject.js
|
54825
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/stream-state-subject.js
|
51674
54826
|
var StreamStateSubject = class extends BehaviorSubject {
|
51675
54827
|
next(next) {
|
51676
54828
|
const current = this.value;
|
@@ -51681,7 +54833,7 @@ var StreamStateSubject = class extends BehaviorSubject {
|
|
51681
54833
|
};
|
51682
54834
|
__name(StreamStateSubject, "StreamStateSubject");
|
51683
54835
|
|
51684
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.3.0/node_modules/@ceramicnetwork/stream-tile/lib/tile-document.js
|
54836
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/stream-tile/lib/tile-document.js
|
51685
54837
|
var __decorate4 = function(decorators, target, key2, desc) {
|
51686
54838
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d;
|
51687
54839
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
@@ -51917,7 +55069,7 @@ TileDocument = TileDocument_1 = __decorate4([
|
|
51917
55069
|
StreamStatic()
|
51918
55070
|
], TileDocument);
|
51919
55071
|
|
51920
|
-
// ../../node_modules/.pnpm/@glazed+tile-loader@0.2.1/node_modules/@glazed/tile-loader/dist/index.js
|
55072
|
+
// ../../node_modules/.pnpm/@glazed+tile-loader@0.2.1_@opentelemetry+api@1.1.0/node_modules/@glazed/tile-loader/dist/index.js
|
51921
55073
|
var import_dataloader = __toESM(require_dataloader(), 1);
|
51922
55074
|
function _checkPrivateRedeclaration2(obj, privateCollection) {
|
51923
55075
|
if (privateCollection.has(obj)) {
|
@@ -52076,7 +55228,7 @@ var TileLoader = class extends import_dataloader.default {
|
|
52076
55228
|
};
|
52077
55229
|
__name(TileLoader, "TileLoader");
|
52078
55230
|
|
52079
|
-
// ../../node_modules/.pnpm/@glazed+datamodel@0.3.1/node_modules/@glazed/datamodel/dist/index.js
|
55231
|
+
// ../../node_modules/.pnpm/@glazed+datamodel@0.3.1_@opentelemetry+api@1.1.0/node_modules/@glazed/datamodel/dist/index.js
|
52080
55232
|
function _checkPrivateRedeclaration3(obj, privateCollection) {
|
52081
55233
|
if (privateCollection.has(obj)) {
|
52082
55234
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
@@ -52196,7 +55348,7 @@ var DataModel = class {
|
|
52196
55348
|
};
|
52197
55349
|
__name(DataModel, "DataModel");
|
52198
55350
|
|
52199
|
-
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.
|
55351
|
+
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.2_@opentelemetry+api@1.1.0/node_modules/@glazed/did-datastore/dist/proxy.js
|
52200
55352
|
function _checkPrivateRedeclaration4(obj, privateCollection) {
|
52201
55353
|
if (privateCollection.has(obj)) {
|
52202
55354
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
@@ -52342,7 +55494,7 @@ var TileProxy = class {
|
|
52342
55494
|
};
|
52343
55495
|
__name(TileProxy, "TileProxy");
|
52344
55496
|
|
52345
|
-
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.
|
55497
|
+
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.2_@opentelemetry+api@1.1.0/node_modules/@glazed/did-datastore/dist/utils.js
|
52346
55498
|
var didRegex = /^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;
|
52347
55499
|
function isDIDstring(did) {
|
52348
55500
|
return didRegex.test(did);
|
@@ -52365,7 +55517,7 @@ function getIDXMetadata(did) {
|
|
52365
55517
|
}
|
52366
55518
|
__name(getIDXMetadata, "getIDXMetadata");
|
52367
55519
|
|
52368
|
-
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.
|
55520
|
+
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.2_@opentelemetry+api@1.1.0/node_modules/@glazed/did-datastore/dist/index.js
|
52369
55521
|
function _checkPrivateRedeclaration5(obj, privateCollection) {
|
52370
55522
|
if (privateCollection.has(obj)) {
|
52371
55523
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
@@ -52762,13 +55914,13 @@ var DIDDataStore = class {
|
|
52762
55914
|
};
|
52763
55915
|
__name(DIDDataStore, "DIDDataStore");
|
52764
55916
|
|
52765
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0/node_modules/@ceramicnetwork/http-client/lib/utils.js
|
55917
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/http-client/lib/utils.js
|
52766
55918
|
function typeStreamID(streamId) {
|
52767
55919
|
return typeof streamId === "string" ? StreamID.fromString(streamId) : streamId;
|
52768
55920
|
}
|
52769
55921
|
__name(typeStreamID, "typeStreamID");
|
52770
55922
|
|
52771
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0/node_modules/@ceramicnetwork/http-client/lib/document.js
|
55923
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/http-client/lib/document.js
|
52772
55924
|
var Document = class extends Observable {
|
52773
55925
|
constructor(initial, _apiUrl, syncInterval) {
|
52774
55926
|
super((subscriber) => {
|
@@ -52867,7 +56019,7 @@ var Document = class extends Observable {
|
|
52867
56019
|
};
|
52868
56020
|
__name(Document, "Document");
|
52869
56021
|
|
52870
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-caip10-link@2.1.0/node_modules/@ceramicnetwork/stream-caip10-link/lib/caip10-link.js
|
56022
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-caip10-link@2.1.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/stream-caip10-link/lib/caip10-link.js
|
52871
56023
|
var import_lodash4 = __toESM(require_lodash(), 1);
|
52872
56024
|
var __decorate5 = function(decorators, target, key2, desc) {
|
52873
56025
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d;
|
@@ -52986,7 +56138,7 @@ Caip10Link = Caip10Link_1 = __decorate5([
|
|
52986
56138
|
StreamStatic()
|
52987
56139
|
], Caip10Link);
|
52988
56140
|
|
52989
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-model@0.3.0/node_modules/@ceramicnetwork/stream-model/lib/model.js
|
56141
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-model@0.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/stream-model/lib/model.js
|
52990
56142
|
var import_random4 = __toESM(require_random(), 1);
|
52991
56143
|
init_cid();
|
52992
56144
|
init_digest();
|
@@ -53187,7 +56339,7 @@ Model = Model_1 = __decorate6([
|
|
53187
56339
|
StreamStatic()
|
53188
56340
|
], Model);
|
53189
56341
|
|
53190
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-model-instance@0.3.0/node_modules/@ceramicnetwork/stream-model-instance/lib/model-instance-document.js
|
56342
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-model-instance@0.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/stream-model-instance/lib/model-instance-document.js
|
53191
56343
|
var import_random5 = __toESM(require_random(), 1);
|
53192
56344
|
var __decorate7 = function(decorators, target, key2, desc) {
|
53193
56345
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d;
|
@@ -53342,7 +56494,7 @@ ModelInstanceDocument = ModelInstanceDocument_1 = __decorate7([
|
|
53342
56494
|
StreamStatic()
|
53343
56495
|
], ModelInstanceDocument);
|
53344
56496
|
|
53345
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0/node_modules/@ceramicnetwork/http-client/lib/remote-pin-api.js
|
56497
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/http-client/lib/remote-pin-api.js
|
53346
56498
|
var RemotePinApi = class {
|
53347
56499
|
constructor(_apiUrl) {
|
53348
56500
|
this._apiUrl = _apiUrl;
|
@@ -53395,7 +56547,7 @@ var RemotePinApi = class {
|
|
53395
56547
|
};
|
53396
56548
|
__name(RemotePinApi, "RemotePinApi");
|
53397
56549
|
|
53398
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0/node_modules/@ceramicnetwork/http-client/lib/remote-index-api.js
|
56550
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/http-client/lib/remote-index-api.js
|
53399
56551
|
var RemoteIndexApi = class {
|
53400
56552
|
constructor(apiUrl) {
|
53401
56553
|
this._fetchJson = fetchJson;
|
@@ -53423,7 +56575,7 @@ var RemoteIndexApi = class {
|
|
53423
56575
|
};
|
53424
56576
|
__name(RemoteIndexApi, "RemoteIndexApi");
|
53425
56577
|
|
53426
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0/node_modules/@ceramicnetwork/http-client/lib/ceramic-http-client.js
|
56578
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/http-client/lib/ceramic-http-client.js
|
53427
56579
|
var API_PATH = "/api/v0/";
|
53428
56580
|
var CERAMIC_HOST = "http://localhost:7007";
|
53429
56581
|
var DEFAULT_CLIENT_CONFIG = {
|
@@ -53517,14 +56669,14 @@ var CeramicClient = class {
|
|
53517
56669
|
return __async(this, arguments, function* (streamId, commit, opts = {}) {
|
53518
56670
|
opts = __spreadValues(__spreadValues({}, DEFAULT_APPLY_COMMIT_OPTS), opts);
|
53519
56671
|
const effectiveStreamId = typeStreamID(streamId);
|
53520
|
-
const
|
56672
|
+
const document2 = yield Document.applyCommit(this._apiUrl, effectiveStreamId, commit, opts, this._config.syncInterval);
|
53521
56673
|
const fromCache = this._streamCache.get(effectiveStreamId.toString());
|
53522
56674
|
if (fromCache) {
|
53523
|
-
fromCache.next(
|
53524
|
-
return this.buildStreamFromDocument(
|
56675
|
+
fromCache.next(document2.state);
|
56676
|
+
return this.buildStreamFromDocument(document2);
|
53525
56677
|
} else {
|
53526
|
-
this._streamCache.set(effectiveStreamId.toString(),
|
53527
|
-
return this.buildStreamFromDocument(
|
56678
|
+
this._streamCache.set(effectiveStreamId.toString(), document2);
|
56679
|
+
return this.buildStreamFromDocument(document2);
|
53528
56680
|
}
|
53529
56681
|
});
|
53530
56682
|
}
|
@@ -53691,6 +56843,11 @@ var getIDXPlugin = /* @__PURE__ */ __name((_0, _1) => __async(void 0, [_0, _1],
|
|
53691
56843
|
};
|
53692
56844
|
}), "getIDXPlugin");
|
53693
56845
|
|
56846
|
+
// ../learn-card-helpers/dist/helpers.esm.js
|
56847
|
+
var __defProp2 = Object.defineProperty;
|
56848
|
+
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
56849
|
+
var isHex = /* @__PURE__ */ __name2((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
56850
|
+
|
53694
56851
|
// src/wallet/plugins/didkey/helpers.ts
|
53695
56852
|
var ED25519_METHODS = ["key", "tz", "pkh:tz", "pkh:tezos", "pkh:sol", "pkh:solana"];
|
53696
56853
|
var SECP256K1_METHODS = [
|
@@ -53707,7 +56864,6 @@ var SECP256K1_METHODS = [
|
|
53707
56864
|
"pkh:eip155",
|
53708
56865
|
"pkh:bip122"
|
53709
56866
|
];
|
53710
|
-
var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
53711
56867
|
var getAlgorithmForDidMethod = /* @__PURE__ */ __name((didMethod) => {
|
53712
56868
|
if (ED25519_METHODS.includes(didMethod))
|
53713
56869
|
return "ed25519";
|
@@ -53758,50 +56914,50 @@ var getDidKeyPlugin = /* @__PURE__ */ __name((wallet, key2) => __async(void 0, n
|
|
53758
56914
|
|
53759
56915
|
// src/wallet/plugins/vc/issueCredential.ts
|
53760
56916
|
var issueCredential2 = /* @__PURE__ */ __name((initWallet) => {
|
53761
|
-
return (
|
56917
|
+
return (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (wallet, credential, signingOptions = {}) {
|
53762
56918
|
const kp = wallet.pluginMethods.getSubjectKeypair();
|
53763
56919
|
if (!kp)
|
53764
56920
|
throw new Error("Cannot issue credential: Could not get subject keypair");
|
53765
|
-
const options = {
|
56921
|
+
const options = __spreadValues({
|
53766
56922
|
verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
|
53767
56923
|
proofPurpose: "assertionMethod"
|
53768
|
-
};
|
56924
|
+
}, signingOptions);
|
53769
56925
|
return initWallet.pluginMethods.issueCredential(credential, options, kp);
|
53770
56926
|
});
|
53771
56927
|
}, "issueCredential");
|
53772
56928
|
|
53773
56929
|
// src/wallet/plugins/vc/verifyCredential.ts
|
53774
56930
|
var verifyCredential3 = /* @__PURE__ */ __name((initWallet) => {
|
53775
|
-
return (
|
53776
|
-
return initWallet.pluginMethods.verifyCredential(credential);
|
56931
|
+
return (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, credential, options = {}) {
|
56932
|
+
return initWallet.pluginMethods.verifyCredential(credential, options);
|
53777
56933
|
});
|
53778
56934
|
}, "verifyCredential");
|
53779
56935
|
|
53780
56936
|
// src/wallet/plugins/vc/issuePresentation.ts
|
53781
56937
|
var issuePresentation2 = /* @__PURE__ */ __name((initWallet) => {
|
53782
|
-
return (
|
56938
|
+
return (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (wallet, presentation, signingOptions = {}) {
|
53783
56939
|
const kp = wallet.pluginMethods.getSubjectKeypair();
|
53784
56940
|
if (!kp)
|
53785
56941
|
throw new Error("Cannot issue credential: Could not get subject keypair");
|
53786
|
-
const options = {
|
56942
|
+
const options = __spreadValues({
|
53787
56943
|
verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
|
53788
56944
|
proofPurpose: "assertionMethod"
|
53789
|
-
};
|
56945
|
+
}, signingOptions);
|
53790
56946
|
return initWallet.pluginMethods.issuePresentation(presentation, options, kp);
|
53791
56947
|
});
|
53792
56948
|
}, "issuePresentation");
|
53793
56949
|
|
53794
56950
|
// src/wallet/plugins/vc/verifyPresentation.ts
|
53795
56951
|
var verifyPresentation2 = /* @__PURE__ */ __name((initWallet) => {
|
53796
|
-
return (
|
53797
|
-
return initWallet.pluginMethods.verifyPresentation(presentation);
|
56952
|
+
return (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, presentation, options = {}) {
|
56953
|
+
return initWallet.pluginMethods.verifyPresentation(presentation, options);
|
53798
56954
|
});
|
53799
56955
|
}, "verifyPresentation");
|
53800
56956
|
|
53801
56957
|
// src/wallet/plugins/vc/vc.ts
|
53802
56958
|
var getVCPlugin = /* @__PURE__ */ __name((wallet) => {
|
53803
56959
|
return {
|
53804
|
-
pluginMethods:
|
56960
|
+
pluginMethods: {
|
53805
56961
|
issueCredential: issueCredential2(wallet),
|
53806
56962
|
verifyCredential: verifyCredential3(wallet),
|
53807
56963
|
issuePresentation: issuePresentation2(wallet),
|
@@ -53827,11 +56983,12 @@ var getVCPlugin = /* @__PURE__ */ __name((wallet) => {
|
|
53827
56983
|
verifiableCredential: credential
|
53828
56984
|
};
|
53829
56985
|
})
|
53830
|
-
}
|
56986
|
+
}
|
53831
56987
|
};
|
53832
56988
|
}, "getVCPlugin");
|
53833
56989
|
|
53834
56990
|
// src/wallet/plugins/EthereumPlugin/index.ts
|
56991
|
+
var import_buffer = __toESM(require_buffer2());
|
53835
56992
|
var import_ethers2 = require("ethers");
|
53836
56993
|
|
53837
56994
|
// src/wallet/plugins/EthereumPlugin/helpers.ts
|
@@ -53899,7 +57056,7 @@ var ERC20ABI = require_erc20_abi();
|
|
53899
57056
|
var getEthereumPlugin = /* @__PURE__ */ __name((initWallet, config2) => {
|
53900
57057
|
let { infuraProjectId, network = "mainnet" } = config2;
|
53901
57058
|
const secpKeypair = initWallet.pluginMethods.getSubjectKeypair("secp256k1");
|
53902
|
-
const privateKey = Buffer.from(secpKeypair.d, "base64").toString("hex");
|
57059
|
+
const privateKey = import_buffer.Buffer.from(secpKeypair.d, "base64").toString("hex");
|
53903
57060
|
let ethersWallet = new import_ethers2.ethers.Wallet(privateKey);
|
53904
57061
|
const publicKey = ethersWallet.address;
|
53905
57062
|
const getProvider = /* @__PURE__ */ __name(() => {
|
@@ -54638,11 +57795,11 @@ var Transformer = class {
|
|
54638
57795
|
}
|
54639
57796
|
_getDocument(_0) {
|
54640
57797
|
return __async(this, arguments, function* ({ url }) {
|
54641
|
-
const { document } = yield this.documentLoader(url);
|
54642
|
-
if (typeof
|
54643
|
-
return JSON.parse(
|
57798
|
+
const { document: document2 } = yield this.documentLoader(url);
|
57799
|
+
if (typeof document2 === "string") {
|
57800
|
+
return JSON.parse(document2);
|
54644
57801
|
}
|
54645
|
-
return
|
57802
|
+
return document2;
|
54646
57803
|
});
|
54647
57804
|
}
|
54648
57805
|
_getTermType({ activeCtx, def }) {
|
@@ -57181,11 +60338,12 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
|
|
57181
60338
|
const didkitWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getDidKitPlugin(didkit));
|
57182
60339
|
const didkeyWallet = yield didkitWallet.addPlugin(yield getDidKeyPlugin(didkitWallet, key2));
|
57183
60340
|
const didkeyAndVCWallet = yield didkeyWallet.addPlugin(getVCPlugin(didkeyWallet));
|
57184
|
-
const templateWallet = yield didkeyAndVCWallet.addPlugin(getVCTemplatesPlugin(
|
60341
|
+
const templateWallet = yield didkeyAndVCWallet.addPlugin(getVCTemplatesPlugin());
|
57185
60342
|
const idxWallet = yield templateWallet.addPlugin(yield getIDXPlugin(templateWallet, ceramicIdx));
|
57186
60343
|
const expirationWallet = yield idxWallet.addPlugin(ExpirationPlugin(idxWallet));
|
57187
60344
|
const ethWallet = yield expirationWallet.addPlugin(getEthereumPlugin(expirationWallet, ethereumConfig));
|
57188
|
-
const
|
60345
|
+
const vpqrWallet = yield ethWallet.addPlugin(getVpqrPlugin(ethWallet));
|
60346
|
+
const wallet = yield vpqrWallet.addPlugin(yield getCHAPIPlugin());
|
57189
60347
|
return {
|
57190
60348
|
_wallet: wallet,
|
57191
60349
|
did: (type = "key") => wallet.pluginMethods.getSubjectDid(type),
|
@@ -57220,7 +60378,12 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
|
|
57220
60378
|
transferTokens: wallet.pluginMethods.transferTokens,
|
57221
60379
|
getCurrentNetwork: wallet.pluginMethods.getCurrentNetwork,
|
57222
60380
|
changeNetwork: wallet.pluginMethods.changeNetwork,
|
57223
|
-
addInfuraProjectId: wallet.pluginMethods.addInfuraProjectId
|
60381
|
+
addInfuraProjectId: wallet.pluginMethods.addInfuraProjectId,
|
60382
|
+
installChapiHandler: wallet.pluginMethods.installChapiHandler,
|
60383
|
+
activateChapiHandler: wallet.pluginMethods.activateChapiHandler,
|
60384
|
+
receiveChapiEvent: wallet.pluginMethods.receiveChapiEvent,
|
60385
|
+
storePresentationViaChapi: wallet.pluginMethods.storePresentationViaChapi,
|
60386
|
+
storeCredentialViaChapiDidAuth: wallet.pluginMethods.storeCredentialViaChapiDidAuth
|
57224
60387
|
};
|
57225
60388
|
}), "walletFromKey");
|
57226
60389
|
|
@@ -57235,6 +60398,47 @@ function initLearnCard() {
|
|
57235
60398
|
});
|
57236
60399
|
}
|
57237
60400
|
__name(initLearnCard, "initLearnCard");
|
60401
|
+
/*!
|
60402
|
+
* A CredentialHandlerRegistration provides a CredentialManager to enable Web
|
60403
|
+
* apps to register Profiles that can be presented to websites.
|
60404
|
+
*
|
60405
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60406
|
+
*/
|
60407
|
+
/*!
|
60408
|
+
* A CredentialRequestEvent is emitted when a request has been made for
|
60409
|
+
* credentials.
|
60410
|
+
*
|
60411
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60412
|
+
*/
|
60413
|
+
/*!
|
60414
|
+
* A CredentialStoreEvent is emitted when a request has been made to
|
60415
|
+
* store a credential.
|
60416
|
+
*
|
60417
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60418
|
+
*/
|
60419
|
+
/*!
|
60420
|
+
* A WebApp is a remote application that runs in a WebAppContext.
|
60421
|
+
*
|
60422
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60423
|
+
*/
|
60424
|
+
/*!
|
60425
|
+
* A WebCredential is a Credential that can be retrieved from or stored by a
|
60426
|
+
* "credential handler" that runs in a third party Web application.
|
60427
|
+
*
|
60428
|
+
* Copyright (c) 2017-2021 Digital Bazaar, Inc. All rights reserved.
|
60429
|
+
*/
|
60430
|
+
/*!
|
60431
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60432
|
+
*/
|
60433
|
+
/*!
|
60434
|
+
* Copyright (c) 2017-2018 Digital Bazaar, Inc. All rights reserved.
|
60435
|
+
*/
|
60436
|
+
/*!
|
60437
|
+
* Copyright (c) 2017-2022 Digital Bazaar, Inc. All rights reserved.
|
60438
|
+
*/
|
60439
|
+
/*!
|
60440
|
+
* Copyright (c) 2018-2022 Digital Bazaar, Inc. All rights reserved.
|
60441
|
+
*/
|
57238
60442
|
/*!
|
57239
60443
|
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
57240
60444
|
*/
|
@@ -57247,6 +60451,36 @@ __name(initLearnCard, "initLearnCard");
|
|
57247
60451
|
/*!
|
57248
60452
|
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
|
57249
60453
|
*/
|
60454
|
+
/*!
|
60455
|
+
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
|
60456
|
+
*/
|
60457
|
+
/*!
|
60458
|
+
* JSON-RPC for Web Request Polyfills.
|
60459
|
+
*
|
60460
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60461
|
+
*/
|
60462
|
+
/*!
|
60463
|
+
* The buffer module from node.js, for the browser.
|
60464
|
+
*
|
60465
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
60466
|
+
* @license MIT
|
60467
|
+
*/
|
60468
|
+
/*!
|
60469
|
+
* The core CredentialHandler class.
|
60470
|
+
*
|
60471
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60472
|
+
*/
|
60473
|
+
/*!
|
60474
|
+
* Utilities for Web Request RPC.
|
60475
|
+
*
|
60476
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60477
|
+
*/
|
60478
|
+
/*!
|
60479
|
+
* Wrapper for native CredentialsContainer that uses remote Credential Mediator
|
60480
|
+
* for WebCredential-related operations.
|
60481
|
+
*
|
60482
|
+
* Copyright (c) 2017-2018 Digital Bazaar, Inc. All rights reserved.
|
60483
|
+
*/
|
57250
60484
|
/*!
|
57251
60485
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
57252
60486
|
* (c) 2017-2021 Joachim Wester
|
@@ -57257,6 +60491,7 @@ __name(initLearnCard, "initLearnCard");
|
|
57257
60491
|
* (c) 2017-2022 Joachim Wester
|
57258
60492
|
* MIT licensed
|
57259
60493
|
*/
|
60494
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
57260
60495
|
/**
|
57261
60496
|
* @module QRCode
|
57262
60497
|
* @package @nuintun/qrcode
|