@learncard/core 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -8
- package/dist/core.cjs.development.js +1747 -226
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +175 -175
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +17 -37
- package/dist/core.esm.js +1747 -226
- package/dist/core.esm.js.map +3 -3
- package/package.json +3 -3
package/dist/core.esm.js
CHANGED
@@ -26471,17 +26471,17 @@ var require_decode_uri_component = __commonJS({
|
|
26471
26471
|
"%FE%FF": "\uFFFD\uFFFD",
|
26472
26472
|
"%FF%FE": "\uFFFD\uFFFD"
|
26473
26473
|
};
|
26474
|
-
var
|
26475
|
-
while (
|
26474
|
+
var match2 = multiMatcher.exec(input);
|
26475
|
+
while (match2) {
|
26476
26476
|
try {
|
26477
|
-
replaceMap[
|
26477
|
+
replaceMap[match2[0]] = decodeURIComponent(match2[0]);
|
26478
26478
|
} catch (err) {
|
26479
|
-
var result = decode9(
|
26480
|
-
if (result !==
|
26481
|
-
replaceMap[
|
26479
|
+
var result = decode9(match2[0]);
|
26480
|
+
if (result !== match2[0]) {
|
26481
|
+
replaceMap[match2[0]] = result;
|
26482
26482
|
}
|
26483
26483
|
}
|
26484
|
-
|
26484
|
+
match2 = multiMatcher.exec(input);
|
26485
26485
|
}
|
26486
26486
|
replaceMap["%C2"] = "\uFFFD";
|
26487
26487
|
var entries = Object.keys(replaceMap);
|
@@ -26909,19 +26909,6 @@ var require_query_string = __commonJS({
|
|
26909
26909
|
}
|
26910
26910
|
});
|
26911
26911
|
|
26912
|
-
// ../../node_modules/.pnpm/hex-lite@1.5.0/node_modules/hex-lite/dist/hex-lite.mjs
|
26913
|
-
function toUint8Array(str) {
|
26914
|
-
var s = 0, sl = str.length, bytes = [];
|
26915
|
-
if (sl % 2) {
|
26916
|
-
throw new Error("invalid hex:" + str);
|
26917
|
-
}
|
26918
|
-
for (; s < sl; s += 2) {
|
26919
|
-
bytes.push(parseInt(str.substr(s, 2), 16));
|
26920
|
-
}
|
26921
|
-
return new Uint8Array(bytes);
|
26922
|
-
}
|
26923
|
-
__name(toUint8Array, "toUint8Array");
|
26924
|
-
|
26925
26912
|
// src/didkit/pkg/didkit_wasm.js
|
26926
26913
|
var wasm;
|
26927
26914
|
var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
@@ -32110,14 +32097,14 @@ var ProviderCrypto = class {
|
|
32110
32097
|
return this.onExportKey.apply(this, args);
|
32111
32098
|
});
|
32112
32099
|
}
|
32113
|
-
checkExportKey(
|
32114
|
-
this.checkKeyFormat(
|
32100
|
+
checkExportKey(format2, key2, ...args) {
|
32101
|
+
this.checkKeyFormat(format2);
|
32115
32102
|
this.checkCryptoKey(key2);
|
32116
32103
|
if (!key2.extractable) {
|
32117
32104
|
throw new CryptoError("key: Is not extractable");
|
32118
32105
|
}
|
32119
32106
|
}
|
32120
|
-
onExportKey(
|
32107
|
+
onExportKey(format2, key2, ...args) {
|
32121
32108
|
return __async(this, null, function* () {
|
32122
32109
|
throw new UnsupportedOperationError("exportKey");
|
32123
32110
|
});
|
@@ -32128,16 +32115,16 @@ var ProviderCrypto = class {
|
|
32128
32115
|
return this.onImportKey.apply(this, args);
|
32129
32116
|
});
|
32130
32117
|
}
|
32131
|
-
checkImportKey(
|
32132
|
-
this.checkKeyFormat(
|
32133
|
-
this.checkKeyData(
|
32118
|
+
checkImportKey(format2, keyData, algorithm, extractable, keyUsages, ...args) {
|
32119
|
+
this.checkKeyFormat(format2);
|
32120
|
+
this.checkKeyData(format2, keyData);
|
32134
32121
|
this.checkAlgorithmName(algorithm);
|
32135
32122
|
this.checkImportParams(algorithm);
|
32136
32123
|
if (Array.isArray(this.usages)) {
|
32137
32124
|
this.checkKeyUsages(keyUsages, this.usages);
|
32138
32125
|
}
|
32139
32126
|
}
|
32140
|
-
onImportKey(
|
32127
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages, ...args) {
|
32141
32128
|
return __async(this, null, function* () {
|
32142
32129
|
throw new UnsupportedOperationError("importKey");
|
32143
32130
|
});
|
@@ -32179,8 +32166,8 @@ var ProviderCrypto = class {
|
|
32179
32166
|
}
|
32180
32167
|
checkImportParams(algorithm) {
|
32181
32168
|
}
|
32182
|
-
checkKeyFormat(
|
32183
|
-
switch (
|
32169
|
+
checkKeyFormat(format2) {
|
32170
|
+
switch (format2) {
|
32184
32171
|
case "raw":
|
32185
32172
|
case "pkcs8":
|
32186
32173
|
case "spki":
|
@@ -32190,11 +32177,11 @@ var ProviderCrypto = class {
|
|
32190
32177
|
throw new TypeError("format: Is invalid value. Must be 'jwk', 'raw', 'spki', or 'pkcs8'");
|
32191
32178
|
}
|
32192
32179
|
}
|
32193
|
-
checkKeyData(
|
32180
|
+
checkKeyData(format2, keyData) {
|
32194
32181
|
if (!keyData) {
|
32195
32182
|
throw new TypeError("keyData: Cannot be empty on empty on key importing");
|
32196
32183
|
}
|
32197
|
-
if (
|
32184
|
+
if (format2 === "jwk") {
|
32198
32185
|
if (!isJWK(keyData)) {
|
32199
32186
|
throw new TypeError("keyData: Is not JsonWebToken");
|
32200
32187
|
}
|
@@ -33121,8 +33108,8 @@ var Pbkdf2Provider = class extends ProviderCrypto {
|
|
33121
33108
|
throw new TypeError("iterations: Is less than 1");
|
33122
33109
|
}
|
33123
33110
|
}
|
33124
|
-
checkImportKey(
|
33125
|
-
super.checkImportKey(
|
33111
|
+
checkImportKey(format2, keyData, algorithm, extractable, keyUsages, ...args) {
|
33112
|
+
super.checkImportKey(format2, keyData, algorithm, extractable, keyUsages);
|
33126
33113
|
if (extractable) {
|
33127
33114
|
throw new SyntaxError("extractable: Must be 'false'");
|
33128
33115
|
}
|
@@ -33148,8 +33135,8 @@ var HkdfProvider = class extends ProviderCrypto {
|
|
33148
33135
|
throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'");
|
33149
33136
|
}
|
33150
33137
|
}
|
33151
|
-
checkImportKey(
|
33152
|
-
super.checkImportKey(
|
33138
|
+
checkImportKey(format2, keyData, algorithm, extractable, keyUsages, ...args) {
|
33139
|
+
super.checkImportKey(format2, keyData, algorithm, extractable, keyUsages);
|
33153
33140
|
if (extractable) {
|
33154
33141
|
throw new SyntaxError("extractable: Must be 'false'");
|
33155
33142
|
}
|
@@ -33348,34 +33335,34 @@ var SubtleCrypto = class {
|
|
33348
33335
|
exportKey(...args) {
|
33349
33336
|
return __async(this, null, function* () {
|
33350
33337
|
this.checkRequiredArguments(args, 2, "exportKey");
|
33351
|
-
const [
|
33338
|
+
const [format2, key2, ...params] = args;
|
33352
33339
|
this.checkCryptoKey(key2);
|
33353
33340
|
const provider = this.getProvider(key2.algorithm.name);
|
33354
|
-
const result = yield provider.exportKey(
|
33341
|
+
const result = yield provider.exportKey(format2, key2, ...params);
|
33355
33342
|
return result;
|
33356
33343
|
});
|
33357
33344
|
}
|
33358
33345
|
importKey(...args) {
|
33359
33346
|
return __async(this, null, function* () {
|
33360
33347
|
this.checkRequiredArguments(args, 5, "importKey");
|
33361
|
-
const [
|
33348
|
+
const [format2, keyData, algorithm, extractable, keyUsages, ...params] = args;
|
33362
33349
|
const preparedAlgorithm = this.prepareAlgorithm(algorithm);
|
33363
33350
|
const provider = this.getProvider(preparedAlgorithm.name);
|
33364
|
-
if (["pkcs8", "spki", "raw"].indexOf(
|
33351
|
+
if (["pkcs8", "spki", "raw"].indexOf(format2) !== -1) {
|
33365
33352
|
const preparedData = import_pvtsutils4.BufferSourceConverter.toArrayBuffer(keyData);
|
33366
|
-
return provider.importKey(
|
33353
|
+
return provider.importKey(format2, preparedData, __spreadProps(__spreadValues({}, preparedAlgorithm), { name: provider.name }), extractable, keyUsages, ...params);
|
33367
33354
|
} else {
|
33368
33355
|
if (!keyData.kty) {
|
33369
33356
|
throw new TypeError("keyData: Is not JSON");
|
33370
33357
|
}
|
33371
33358
|
}
|
33372
|
-
return provider.importKey(
|
33359
|
+
return provider.importKey(format2, keyData, __spreadProps(__spreadValues({}, preparedAlgorithm), { name: provider.name }), extractable, keyUsages, ...params);
|
33373
33360
|
});
|
33374
33361
|
}
|
33375
|
-
wrapKey(
|
33362
|
+
wrapKey(format2, key2, wrappingKey, wrapAlgorithm, ...args) {
|
33376
33363
|
return __async(this, null, function* () {
|
33377
|
-
let keyData = yield this.exportKey(
|
33378
|
-
if (
|
33364
|
+
let keyData = yield this.exportKey(format2, key2, ...args);
|
33365
|
+
if (format2 === "jwk") {
|
33379
33366
|
const json = JSON.stringify(keyData);
|
33380
33367
|
keyData = import_pvtsutils4.Convert.FromUtf8String(json);
|
33381
33368
|
}
|
@@ -33385,13 +33372,13 @@ var SubtleCrypto = class {
|
|
33385
33372
|
return provider.encrypt(__spreadProps(__spreadValues({}, preparedAlgorithm), { name: provider.name }), wrappingKey, preparedData, { keyUsage: false }, ...args);
|
33386
33373
|
});
|
33387
33374
|
}
|
33388
|
-
unwrapKey(
|
33375
|
+
unwrapKey(format2, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages, ...args) {
|
33389
33376
|
return __async(this, null, function* () {
|
33390
33377
|
const preparedAlgorithm = this.prepareAlgorithm(unwrapAlgorithm);
|
33391
33378
|
const preparedData = import_pvtsutils4.BufferSourceConverter.toArrayBuffer(wrappedKey);
|
33392
33379
|
const provider = this.getProvider(preparedAlgorithm.name);
|
33393
33380
|
let keyData = yield provider.decrypt(__spreadProps(__spreadValues({}, preparedAlgorithm), { name: provider.name }), unwrappingKey, preparedData, { keyUsage: false }, ...args);
|
33394
|
-
if (
|
33381
|
+
if (format2 === "jwk") {
|
33395
33382
|
try {
|
33396
33383
|
keyData = JSON.parse(import_pvtsutils4.Convert.ToUtf8String(keyData));
|
33397
33384
|
} catch (e) {
|
@@ -33400,7 +33387,7 @@ var SubtleCrypto = class {
|
|
33400
33387
|
throw error;
|
33401
33388
|
}
|
33402
33389
|
}
|
33403
|
-
return this.importKey(
|
33390
|
+
return this.importKey(format2, keyData, unwrappedKeyAlgorithm, extractable, keyUsages, ...args);
|
33404
33391
|
});
|
33405
33392
|
}
|
33406
33393
|
checkRequiredArguments(args, size, methodName) {
|
@@ -33534,12 +33521,12 @@ var AesCrypto = class {
|
|
33534
33521
|
return key2;
|
33535
33522
|
});
|
33536
33523
|
}
|
33537
|
-
static exportKey(
|
33524
|
+
static exportKey(format2, key2) {
|
33538
33525
|
return __async(this, null, function* () {
|
33539
33526
|
if (!(key2 instanceof AesCryptoKey)) {
|
33540
33527
|
throw new Error("key: Is not AesCryptoKey");
|
33541
33528
|
}
|
33542
|
-
switch (
|
33529
|
+
switch (format2.toLowerCase()) {
|
33543
33530
|
case "jwk":
|
33544
33531
|
return JsonSerializer.toJSON(key2);
|
33545
33532
|
case "raw":
|
@@ -33549,10 +33536,10 @@ var AesCrypto = class {
|
|
33549
33536
|
}
|
33550
33537
|
});
|
33551
33538
|
}
|
33552
|
-
static importKey(
|
33539
|
+
static importKey(format2, keyData, algorithm, extractable, keyUsages) {
|
33553
33540
|
return __async(this, null, function* () {
|
33554
33541
|
let key2;
|
33555
|
-
switch (
|
33542
|
+
switch (format2.toLowerCase()) {
|
33556
33543
|
case "jwk":
|
33557
33544
|
key2 = JsonParser.fromJSON(keyData, { targetSchema: AesCryptoKey });
|
33558
33545
|
break;
|
@@ -33736,14 +33723,14 @@ var AesCbcProvider2 = class extends AesCbcProvider {
|
|
33736
33723
|
return AesCrypto.decrypt(algorithm, getCryptoKey(key2), new Uint8Array(data));
|
33737
33724
|
});
|
33738
33725
|
}
|
33739
|
-
onExportKey(
|
33726
|
+
onExportKey(format2, key2) {
|
33740
33727
|
return __async(this, null, function* () {
|
33741
|
-
return AesCrypto.exportKey(
|
33728
|
+
return AesCrypto.exportKey(format2, getCryptoKey(key2));
|
33742
33729
|
});
|
33743
33730
|
}
|
33744
|
-
onImportKey(
|
33731
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
33745
33732
|
return __async(this, null, function* () {
|
33746
|
-
const key2 = yield AesCrypto.importKey(
|
33733
|
+
const key2 = yield AesCrypto.importKey(format2, keyData, { name: algorithm.name }, extractable, keyUsages);
|
33747
33734
|
return setCryptoKey(key2);
|
33748
33735
|
});
|
33749
33736
|
}
|
@@ -33867,14 +33854,14 @@ var AesCmacProvider2 = class extends AesCmacProvider {
|
|
33867
33854
|
return Buffer.from(signature2).compare(Buffer.from(signature22)) === 0;
|
33868
33855
|
});
|
33869
33856
|
}
|
33870
|
-
onExportKey(
|
33857
|
+
onExportKey(format2, key2) {
|
33871
33858
|
return __async(this, null, function* () {
|
33872
|
-
return AesCrypto.exportKey(
|
33859
|
+
return AesCrypto.exportKey(format2, getCryptoKey(key2));
|
33873
33860
|
});
|
33874
33861
|
}
|
33875
|
-
onImportKey(
|
33862
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
33876
33863
|
return __async(this, null, function* () {
|
33877
|
-
const res = yield AesCrypto.importKey(
|
33864
|
+
const res = yield AesCrypto.importKey(format2, keyData, { name: algorithm.name }, extractable, keyUsages);
|
33878
33865
|
return setCryptoKey(res);
|
33879
33866
|
});
|
33880
33867
|
}
|
@@ -33906,14 +33893,14 @@ var AesCtrProvider2 = class extends AesCtrProvider {
|
|
33906
33893
|
return AesCrypto.decrypt(algorithm, getCryptoKey(key2), new Uint8Array(data));
|
33907
33894
|
});
|
33908
33895
|
}
|
33909
|
-
onExportKey(
|
33896
|
+
onExportKey(format2, key2) {
|
33910
33897
|
return __async(this, null, function* () {
|
33911
|
-
return AesCrypto.exportKey(
|
33898
|
+
return AesCrypto.exportKey(format2, getCryptoKey(key2));
|
33912
33899
|
});
|
33913
33900
|
}
|
33914
|
-
onImportKey(
|
33901
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
33915
33902
|
return __async(this, null, function* () {
|
33916
|
-
const res = yield AesCrypto.importKey(
|
33903
|
+
const res = yield AesCrypto.importKey(format2, keyData, { name: algorithm.name }, extractable, keyUsages);
|
33917
33904
|
return setCryptoKey(res);
|
33918
33905
|
});
|
33919
33906
|
}
|
@@ -33945,14 +33932,14 @@ var AesGcmProvider2 = class extends AesGcmProvider {
|
|
33945
33932
|
return AesCrypto.decrypt(algorithm, getCryptoKey(key2), new Uint8Array(data));
|
33946
33933
|
});
|
33947
33934
|
}
|
33948
|
-
onExportKey(
|
33935
|
+
onExportKey(format2, key2) {
|
33949
33936
|
return __async(this, null, function* () {
|
33950
|
-
return AesCrypto.exportKey(
|
33937
|
+
return AesCrypto.exportKey(format2, getCryptoKey(key2));
|
33951
33938
|
});
|
33952
33939
|
}
|
33953
|
-
onImportKey(
|
33940
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
33954
33941
|
return __async(this, null, function* () {
|
33955
|
-
const res = yield AesCrypto.importKey(
|
33942
|
+
const res = yield AesCrypto.importKey(format2, keyData, { name: algorithm.name }, extractable, keyUsages);
|
33956
33943
|
return setCryptoKey(res);
|
33957
33944
|
});
|
33958
33945
|
}
|
@@ -33974,14 +33961,14 @@ var AesKwProvider2 = class extends AesKwProvider {
|
|
33974
33961
|
return setCryptoKey(res);
|
33975
33962
|
});
|
33976
33963
|
}
|
33977
|
-
onExportKey(
|
33964
|
+
onExportKey(format2, key2) {
|
33978
33965
|
return __async(this, null, function* () {
|
33979
|
-
return AesCrypto.exportKey(
|
33966
|
+
return AesCrypto.exportKey(format2, getCryptoKey(key2));
|
33980
33967
|
});
|
33981
33968
|
}
|
33982
|
-
onImportKey(
|
33969
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
33983
33970
|
return __async(this, null, function* () {
|
33984
|
-
const res = yield AesCrypto.importKey(
|
33971
|
+
const res = yield AesCrypto.importKey(format2, keyData, { name: algorithm.name }, extractable, keyUsages);
|
33985
33972
|
return setCryptoKey(res);
|
33986
33973
|
});
|
33987
33974
|
}
|
@@ -34023,14 +34010,14 @@ var AesEcbProvider2 = class extends AesEcbProvider {
|
|
34023
34010
|
return AesCrypto.decrypt(algorithm, getCryptoKey(key2), new Uint8Array(data));
|
34024
34011
|
});
|
34025
34012
|
}
|
34026
|
-
onExportKey(
|
34013
|
+
onExportKey(format2, key2) {
|
34027
34014
|
return __async(this, null, function* () {
|
34028
|
-
return AesCrypto.exportKey(
|
34015
|
+
return AesCrypto.exportKey(format2, getCryptoKey(key2));
|
34029
34016
|
});
|
34030
34017
|
}
|
34031
|
-
onImportKey(
|
34018
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
34032
34019
|
return __async(this, null, function* () {
|
34033
|
-
const res = yield AesCrypto.importKey(
|
34020
|
+
const res = yield AesCrypto.importKey(format2, keyData, { name: algorithm.name }, extractable, keyUsages);
|
34034
34021
|
return setCryptoKey(res);
|
34035
34022
|
});
|
34036
34023
|
}
|
@@ -34071,9 +34058,9 @@ var DesCrypto = class {
|
|
34071
34058
|
return key2;
|
34072
34059
|
});
|
34073
34060
|
}
|
34074
|
-
static exportKey(
|
34061
|
+
static exportKey(format2, key2) {
|
34075
34062
|
return __async(this, null, function* () {
|
34076
|
-
switch (
|
34063
|
+
switch (format2.toLowerCase()) {
|
34077
34064
|
case "jwk":
|
34078
34065
|
return JsonSerializer.toJSON(key2);
|
34079
34066
|
case "raw":
|
@@ -34083,10 +34070,10 @@ var DesCrypto = class {
|
|
34083
34070
|
}
|
34084
34071
|
});
|
34085
34072
|
}
|
34086
|
-
static importKey(
|
34073
|
+
static importKey(format2, keyData, algorithm, extractable, keyUsages) {
|
34087
34074
|
return __async(this, null, function* () {
|
34088
34075
|
let key2;
|
34089
|
-
switch (
|
34076
|
+
switch (format2.toLowerCase()) {
|
34090
34077
|
case "jwk":
|
34091
34078
|
key2 = JsonParser.fromJSON(keyData, { targetSchema: DesCryptoKey });
|
34092
34079
|
break;
|
@@ -34192,14 +34179,14 @@ var DesCbcProvider = class extends DesProvider {
|
|
34192
34179
|
return DesCrypto.decrypt(algorithm, getCryptoKey(key2), new Uint8Array(data));
|
34193
34180
|
});
|
34194
34181
|
}
|
34195
|
-
onExportKey(
|
34182
|
+
onExportKey(format2, key2) {
|
34196
34183
|
return __async(this, null, function* () {
|
34197
|
-
return DesCrypto.exportKey(
|
34184
|
+
return DesCrypto.exportKey(format2, getCryptoKey(key2));
|
34198
34185
|
});
|
34199
34186
|
}
|
34200
|
-
onImportKey(
|
34187
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
34201
34188
|
return __async(this, null, function* () {
|
34202
|
-
const key2 = yield DesCrypto.importKey(
|
34189
|
+
const key2 = yield DesCrypto.importKey(format2, keyData, { name: this.name, length: this.keySizeBits }, extractable, keyUsages);
|
34203
34190
|
if (key2.data.length !== this.keySizeBits >> 3) {
|
34204
34191
|
throw new OperationError("keyData: Wrong key size");
|
34205
34192
|
}
|
@@ -34240,14 +34227,14 @@ var DesEde3CbcProvider = class extends DesProvider {
|
|
34240
34227
|
return DesCrypto.decrypt(algorithm, getCryptoKey(key2), new Uint8Array(data));
|
34241
34228
|
});
|
34242
34229
|
}
|
34243
|
-
onExportKey(
|
34230
|
+
onExportKey(format2, key2) {
|
34244
34231
|
return __async(this, null, function* () {
|
34245
|
-
return DesCrypto.exportKey(
|
34232
|
+
return DesCrypto.exportKey(format2, getCryptoKey(key2));
|
34246
34233
|
});
|
34247
34234
|
}
|
34248
|
-
onImportKey(
|
34235
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
34249
34236
|
return __async(this, null, function* () {
|
34250
|
-
const key2 = yield DesCrypto.importKey(
|
34237
|
+
const key2 = yield DesCrypto.importKey(format2, keyData, { name: this.name, length: this.keySizeBits }, extractable, keyUsages);
|
34251
34238
|
if (key2.data.length !== this.keySizeBits >> 3) {
|
34252
34239
|
throw new OperationError("keyData: Wrong key size");
|
34253
34240
|
}
|
@@ -34373,9 +34360,9 @@ var RsaCrypto = class {
|
|
34373
34360
|
return res;
|
34374
34361
|
});
|
34375
34362
|
}
|
34376
|
-
static exportKey(
|
34363
|
+
static exportKey(format2, key2) {
|
34377
34364
|
return __async(this, null, function* () {
|
34378
|
-
switch (
|
34365
|
+
switch (format2.toLowerCase()) {
|
34379
34366
|
case "jwk":
|
34380
34367
|
return JsonSerializer.toJSON(key2);
|
34381
34368
|
case "pkcs8":
|
@@ -34386,9 +34373,9 @@ var RsaCrypto = class {
|
|
34386
34373
|
}
|
34387
34374
|
});
|
34388
34375
|
}
|
34389
|
-
static importKey(
|
34376
|
+
static importKey(format2, keyData, algorithm, extractable, keyUsages) {
|
34390
34377
|
return __async(this, null, function* () {
|
34391
|
-
switch (
|
34378
|
+
switch (format2.toLowerCase()) {
|
34392
34379
|
case "jwk": {
|
34393
34380
|
const jwk = keyData;
|
34394
34381
|
if (jwk.d) {
|
@@ -34604,14 +34591,14 @@ var RsaSsaProvider2 = class extends RsaSsaProvider {
|
|
34604
34591
|
return RsaCrypto.verify(algorithm, getCryptoKey(key2), new Uint8Array(signature2), new Uint8Array(data));
|
34605
34592
|
});
|
34606
34593
|
}
|
34607
|
-
onExportKey(
|
34594
|
+
onExportKey(format2, key2) {
|
34608
34595
|
return __async(this, null, function* () {
|
34609
|
-
return RsaCrypto.exportKey(
|
34596
|
+
return RsaCrypto.exportKey(format2, getCryptoKey(key2));
|
34610
34597
|
});
|
34611
34598
|
}
|
34612
|
-
onImportKey(
|
34599
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
34613
34600
|
return __async(this, null, function* () {
|
34614
|
-
const key2 = yield RsaCrypto.importKey(
|
34601
|
+
const key2 = yield RsaCrypto.importKey(format2, keyData, __spreadProps(__spreadValues({}, algorithm), { name: this.name }), extractable, keyUsages);
|
34615
34602
|
return setCryptoKey(key2);
|
34616
34603
|
});
|
34617
34604
|
}
|
@@ -34660,14 +34647,14 @@ var RsaPssProvider2 = class extends RsaPssProvider {
|
|
34660
34647
|
return RsaCrypto.verify(algorithm, getCryptoKey(key2), new Uint8Array(signature2), new Uint8Array(data));
|
34661
34648
|
});
|
34662
34649
|
}
|
34663
|
-
onExportKey(
|
34650
|
+
onExportKey(format2, key2) {
|
34664
34651
|
return __async(this, null, function* () {
|
34665
|
-
return RsaCrypto.exportKey(
|
34652
|
+
return RsaCrypto.exportKey(format2, getCryptoKey(key2));
|
34666
34653
|
});
|
34667
34654
|
}
|
34668
|
-
onImportKey(
|
34655
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
34669
34656
|
return __async(this, null, function* () {
|
34670
|
-
const key2 = yield RsaCrypto.importKey(
|
34657
|
+
const key2 = yield RsaCrypto.importKey(format2, keyData, __spreadProps(__spreadValues({}, algorithm), { name: this.name }), extractable, keyUsages);
|
34671
34658
|
return setCryptoKey(key2);
|
34672
34659
|
});
|
34673
34660
|
}
|
@@ -34831,14 +34818,14 @@ ${internalKey.data.toString("base64")}
|
|
34831
34818
|
return new Uint8Array(pkcs0).buffer;
|
34832
34819
|
});
|
34833
34820
|
}
|
34834
|
-
onExportKey(
|
34821
|
+
onExportKey(format2, key2) {
|
34835
34822
|
return __async(this, null, function* () {
|
34836
|
-
return RsaCrypto.exportKey(
|
34823
|
+
return RsaCrypto.exportKey(format2, getCryptoKey(key2));
|
34837
34824
|
});
|
34838
34825
|
}
|
34839
|
-
onImportKey(
|
34826
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
34840
34827
|
return __async(this, null, function* () {
|
34841
|
-
const key2 = yield RsaCrypto.importKey(
|
34828
|
+
const key2 = yield RsaCrypto.importKey(format2, keyData, __spreadProps(__spreadValues({}, algorithm), { name: this.name }), extractable, keyUsages);
|
34842
34829
|
return setCryptoKey(key2);
|
34843
34830
|
});
|
34844
34831
|
}
|
@@ -34923,14 +34910,14 @@ var RsaEsProvider = class extends ProviderCrypto {
|
|
34923
34910
|
return new Uint8Array(dec).buffer;
|
34924
34911
|
});
|
34925
34912
|
}
|
34926
|
-
onExportKey(
|
34913
|
+
onExportKey(format2, key2) {
|
34927
34914
|
return __async(this, null, function* () {
|
34928
|
-
return RsaCrypto.exportKey(
|
34915
|
+
return RsaCrypto.exportKey(format2, getCryptoKey(key2));
|
34929
34916
|
});
|
34930
34917
|
}
|
34931
|
-
onImportKey(
|
34918
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
34932
34919
|
return __async(this, null, function* () {
|
34933
|
-
const key2 = yield RsaCrypto.importKey(
|
34920
|
+
const key2 = yield RsaCrypto.importKey(format2, keyData, __spreadProps(__spreadValues({}, algorithm), { name: this.name }), extractable, keyUsages);
|
34934
34921
|
return setCryptoKey(key2);
|
34935
34922
|
});
|
34936
34923
|
}
|
@@ -35240,9 +35227,9 @@ ${key2.data.toString("base64")}
|
|
35240
35227
|
return new Uint8Array(bits).buffer.slice(0, length2 >> 3);
|
35241
35228
|
});
|
35242
35229
|
}
|
35243
|
-
static exportKey(
|
35230
|
+
static exportKey(format2, key2) {
|
35244
35231
|
return __async(this, null, function* () {
|
35245
|
-
switch (
|
35232
|
+
switch (format2.toLowerCase()) {
|
35246
35233
|
case "jwk":
|
35247
35234
|
return JsonSerializer.toJSON(key2);
|
35248
35235
|
case "pkcs8":
|
@@ -35257,9 +35244,9 @@ ${key2.data.toString("base64")}
|
|
35257
35244
|
}
|
35258
35245
|
});
|
35259
35246
|
}
|
35260
|
-
static importKey(
|
35247
|
+
static importKey(format2, keyData, algorithm, extractable, keyUsages) {
|
35261
35248
|
return __async(this, null, function* () {
|
35262
|
-
switch (
|
35249
|
+
switch (format2.toLowerCase()) {
|
35263
35250
|
case "jwk": {
|
35264
35251
|
const jwk = keyData;
|
35265
35252
|
if (jwk.d) {
|
@@ -35389,14 +35376,14 @@ var EcdsaProvider2 = class extends EcdsaProvider {
|
|
35389
35376
|
return EcCrypto.verify(algorithm, getCryptoKey(key2), new Uint8Array(signature2), new Uint8Array(data));
|
35390
35377
|
});
|
35391
35378
|
}
|
35392
|
-
onExportKey(
|
35379
|
+
onExportKey(format2, key2) {
|
35393
35380
|
return __async(this, null, function* () {
|
35394
|
-
return EcCrypto.exportKey(
|
35381
|
+
return EcCrypto.exportKey(format2, getCryptoKey(key2));
|
35395
35382
|
});
|
35396
35383
|
}
|
35397
|
-
onImportKey(
|
35384
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
35398
35385
|
return __async(this, null, function* () {
|
35399
|
-
const key2 = yield EcCrypto.importKey(
|
35386
|
+
const key2 = yield EcCrypto.importKey(format2, keyData, __spreadProps(__spreadValues({}, algorithm), { name: this.name }), extractable, keyUsages);
|
35400
35387
|
return setCryptoKey(key2);
|
35401
35388
|
});
|
35402
35389
|
}
|
@@ -35425,14 +35412,14 @@ var EcdhProvider2 = class extends EcdhProvider {
|
|
35425
35412
|
};
|
35426
35413
|
});
|
35427
35414
|
}
|
35428
|
-
onExportKey(
|
35415
|
+
onExportKey(format2, key2) {
|
35429
35416
|
return __async(this, null, function* () {
|
35430
|
-
return EcCrypto.exportKey(
|
35417
|
+
return EcCrypto.exportKey(format2, getCryptoKey(key2));
|
35431
35418
|
});
|
35432
35419
|
}
|
35433
|
-
onImportKey(
|
35420
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
35434
35421
|
return __async(this, null, function* () {
|
35435
|
-
const key2 = yield EcCrypto.importKey(
|
35422
|
+
const key2 = yield EcCrypto.importKey(format2, keyData, __spreadProps(__spreadValues({}, algorithm), { name: this.name }), extractable, keyUsages);
|
35436
35423
|
return setCryptoKey(key2);
|
35437
35424
|
});
|
35438
35425
|
}
|
@@ -35615,9 +35602,9 @@ ${key2.data.toString("base64")}
|
|
35615
35602
|
return new Uint8Array(bits).buffer.slice(0, length2 >> 3);
|
35616
35603
|
});
|
35617
35604
|
}
|
35618
|
-
static exportKey(
|
35605
|
+
static exportKey(format2, key2) {
|
35619
35606
|
return __async(this, null, function* () {
|
35620
|
-
switch (
|
35607
|
+
switch (format2.toLowerCase()) {
|
35621
35608
|
case "jwk":
|
35622
35609
|
return JsonSerializer.toJSON(key2);
|
35623
35610
|
case "pkcs8":
|
@@ -35632,9 +35619,9 @@ ${key2.data.toString("base64")}
|
|
35632
35619
|
}
|
35633
35620
|
});
|
35634
35621
|
}
|
35635
|
-
static importKey(
|
35622
|
+
static importKey(format2, keyData, algorithm, extractable, keyUsages) {
|
35636
35623
|
return __async(this, null, function* () {
|
35637
|
-
switch (
|
35624
|
+
switch (format2.toLowerCase()) {
|
35638
35625
|
case "jwk": {
|
35639
35626
|
const jwk = keyData;
|
35640
35627
|
if (jwk.d) {
|
@@ -35715,14 +35702,14 @@ var EdDsaProvider2 = class extends EdDsaProvider {
|
|
35715
35702
|
return EdCrypto.verify(algorithm, getCryptoKey(key2), new Uint8Array(signature2), new Uint8Array(data));
|
35716
35703
|
});
|
35717
35704
|
}
|
35718
|
-
onExportKey(
|
35705
|
+
onExportKey(format2, key2) {
|
35719
35706
|
return __async(this, null, function* () {
|
35720
|
-
return EdCrypto.exportKey(
|
35707
|
+
return EdCrypto.exportKey(format2, getCryptoKey(key2));
|
35721
35708
|
});
|
35722
35709
|
}
|
35723
|
-
onImportKey(
|
35710
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
35724
35711
|
return __async(this, null, function* () {
|
35725
|
-
const key2 = yield EdCrypto.importKey(
|
35712
|
+
const key2 = yield EdCrypto.importKey(format2, keyData, __spreadProps(__spreadValues({}, algorithm), { name: this.name }), extractable, keyUsages);
|
35726
35713
|
return setCryptoKey(key2);
|
35727
35714
|
});
|
35728
35715
|
}
|
@@ -35747,14 +35734,14 @@ var EcdhEsProvider2 = class extends EcdhEsProvider {
|
|
35747
35734
|
return bits;
|
35748
35735
|
});
|
35749
35736
|
}
|
35750
|
-
onExportKey(
|
35737
|
+
onExportKey(format2, key2) {
|
35751
35738
|
return __async(this, null, function* () {
|
35752
|
-
return EdCrypto.exportKey(
|
35739
|
+
return EdCrypto.exportKey(format2, getCryptoKey(key2));
|
35753
35740
|
});
|
35754
35741
|
}
|
35755
|
-
onImportKey(
|
35742
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
35756
35743
|
return __async(this, null, function* () {
|
35757
|
-
const key2 = yield EdCrypto.importKey(
|
35744
|
+
const key2 = yield EdCrypto.importKey(format2, keyData, __spreadProps(__spreadValues({}, algorithm), { name: this.name }), extractable, keyUsages);
|
35758
35745
|
return setCryptoKey(key2);
|
35759
35746
|
});
|
35760
35747
|
}
|
@@ -35779,9 +35766,9 @@ var Pbkdf2Provider2 = class extends Pbkdf2Provider {
|
|
35779
35766
|
});
|
35780
35767
|
});
|
35781
35768
|
}
|
35782
|
-
onImportKey(
|
35769
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
35783
35770
|
return __async(this, null, function* () {
|
35784
|
-
if (
|
35771
|
+
if (format2 === "raw") {
|
35785
35772
|
const key2 = new PbkdfCryptoKey();
|
35786
35773
|
key2.data = Buffer.from(keyData);
|
35787
35774
|
key2.algorithm = { name: this.name };
|
@@ -35841,10 +35828,10 @@ var HmacProvider2 = class extends HmacProvider {
|
|
35841
35828
|
return hmac2.compare(Buffer.from(signature2)) === 0;
|
35842
35829
|
});
|
35843
35830
|
}
|
35844
|
-
onImportKey(
|
35831
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
35845
35832
|
return __async(this, null, function* () {
|
35846
35833
|
let key2;
|
35847
|
-
switch (
|
35834
|
+
switch (format2.toLowerCase()) {
|
35848
35835
|
case "jwk":
|
35849
35836
|
key2 = JsonParser.fromJSON(keyData, { targetSchema: HmacCryptoKey });
|
35850
35837
|
break;
|
@@ -35865,9 +35852,9 @@ var HmacProvider2 = class extends HmacProvider {
|
|
35865
35852
|
return setCryptoKey(key2);
|
35866
35853
|
});
|
35867
35854
|
}
|
35868
|
-
onExportKey(
|
35855
|
+
onExportKey(format2, key2) {
|
35869
35856
|
return __async(this, null, function* () {
|
35870
|
-
switch (
|
35857
|
+
switch (format2.toLowerCase()) {
|
35871
35858
|
case "jwk":
|
35872
35859
|
return JsonSerializer.toJSON(getCryptoKey(key2));
|
35873
35860
|
case "raw":
|
@@ -35889,9 +35876,9 @@ var HkdfCryptoKey = class extends CryptoKey2 {
|
|
35889
35876
|
};
|
35890
35877
|
__name(HkdfCryptoKey, "HkdfCryptoKey");
|
35891
35878
|
var HkdfProvider2 = class extends HkdfProvider {
|
35892
|
-
onImportKey(
|
35879
|
+
onImportKey(format2, keyData, algorithm, extractable, keyUsages) {
|
35893
35880
|
return __async(this, null, function* () {
|
35894
|
-
if (
|
35881
|
+
if (format2.toLowerCase() !== "raw") {
|
35895
35882
|
throw new OperationError("Operation not supported");
|
35896
35883
|
}
|
35897
35884
|
const key2 = new HkdfCryptoKey();
|
@@ -36022,7 +36009,6 @@ if (isNodejs()) {
|
|
36022
36009
|
} else {
|
36023
36010
|
crypto3 = window.crypto;
|
36024
36011
|
}
|
36025
|
-
var crypto_default = crypto3;
|
36026
36012
|
|
36027
36013
|
// src/wallet/base/wallet.ts
|
36028
36014
|
var addPluginToWallet = /* @__PURE__ */ __name((wallet, plugin) => __async(void 0, null, function* () {
|
@@ -36041,11 +36027,10 @@ var removeFromWallet = /* @__PURE__ */ __name((wallet, contentId) => __async(voi
|
|
36041
36027
|
var bindMethods = /* @__PURE__ */ __name((wallet, pluginMethods) => Object.fromEntries(Object.entries(pluginMethods).map(([key2, method]) => [key2, method.bind(wallet, wallet)])), "bindMethods");
|
36042
36028
|
var generateWallet = /* @__PURE__ */ __name((..._0) => __async(void 0, [..._0], function* (contents = [], _wallet = {}) {
|
36043
36029
|
const { plugins = [] } = _wallet;
|
36044
|
-
const
|
36045
|
-
const newPluginMethods = __spreadValues(__spreadValues({},
|
36046
|
-
|
36047
|
-
|
36048
|
-
}, { pluginMethods: {}, pluginConstants: {} });
|
36030
|
+
const pluginMethods = plugins.reduce((cumulativePluginMethods, plugin) => {
|
36031
|
+
const newPluginMethods = __spreadValues(__spreadValues({}, cumulativePluginMethods), plugin.pluginMethods);
|
36032
|
+
return newPluginMethods;
|
36033
|
+
}, {});
|
36049
36034
|
const wallet = {
|
36050
36035
|
contents: [...contents],
|
36051
36036
|
add: function(content) {
|
@@ -36057,7 +36042,6 @@ var generateWallet = /* @__PURE__ */ __name((..._0) => __async(void 0, [..._0],
|
|
36057
36042
|
status: "UNLOCKED" /* Unlocked */,
|
36058
36043
|
plugins,
|
36059
36044
|
pluginMethods,
|
36060
|
-
pluginConstants,
|
36061
36045
|
addPlugin: function(plugin) {
|
36062
36046
|
return addPluginToWallet(this, plugin);
|
36063
36047
|
}
|
@@ -39550,7 +39534,7 @@ var ChainId = /* @__PURE__ */ function() {
|
|
39550
39534
|
}
|
39551
39535
|
return new ChainId2(getParams(id, this.spec)).toJSON();
|
39552
39536
|
}, "parse");
|
39553
|
-
ChainId2.format = /* @__PURE__ */ __name(function
|
39537
|
+
ChainId2.format = /* @__PURE__ */ __name(function format2(params) {
|
39554
39538
|
return joinParams(params, this.spec);
|
39555
39539
|
}, "format");
|
39556
39540
|
var _proto = ChainId2.prototype;
|
@@ -39589,7 +39573,7 @@ var AccountId = /* @__PURE__ */ function() {
|
|
39589
39573
|
address
|
39590
39574
|
}).toJSON();
|
39591
39575
|
}, "parse");
|
39592
|
-
AccountId2.format = /* @__PURE__ */ __name(function
|
39576
|
+
AccountId2.format = /* @__PURE__ */ __name(function format2(params) {
|
39593
39577
|
var chainId = new ChainId(params.chainId);
|
39594
39578
|
var splitParams2 = _extends({}, chainId.toJSON(), {
|
39595
39579
|
address: params.address
|
@@ -39624,7 +39608,7 @@ var AssetName = /* @__PURE__ */ function() {
|
|
39624
39608
|
}
|
39625
39609
|
return new AssetName2(getParams(id, this.spec)).toJSON();
|
39626
39610
|
}, "parse");
|
39627
|
-
AssetName2.format = /* @__PURE__ */ __name(function
|
39611
|
+
AssetName2.format = /* @__PURE__ */ __name(function format2(params) {
|
39628
39612
|
return joinParams(params, this.spec);
|
39629
39613
|
}, "format");
|
39630
39614
|
var _proto = AssetName2.prototype;
|
@@ -39655,7 +39639,7 @@ var AssetType = /* @__PURE__ */ function() {
|
|
39655
39639
|
}
|
39656
39640
|
return new AssetType2(getParams(id, this.spec)).toJSON();
|
39657
39641
|
}, "parse");
|
39658
|
-
AssetType2.format = /* @__PURE__ */ __name(function
|
39642
|
+
AssetType2.format = /* @__PURE__ */ __name(function format2(params) {
|
39659
39643
|
return joinParams(params, this.spec);
|
39660
39644
|
}, "format");
|
39661
39645
|
var _proto = AssetType2.prototype;
|
@@ -39687,7 +39671,7 @@ var AssetId = /* @__PURE__ */ function() {
|
|
39687
39671
|
}
|
39688
39672
|
return new AssetId2(getParams(id, this.spec)).toJSON();
|
39689
39673
|
}, "parse");
|
39690
|
-
AssetId2.format = /* @__PURE__ */ __name(function
|
39674
|
+
AssetId2.format = /* @__PURE__ */ __name(function format2(params) {
|
39691
39675
|
return joinParams(params, this.spec);
|
39692
39676
|
}, "format");
|
39693
39677
|
var _proto = AssetId2.prototype;
|
@@ -43332,6 +43316,19 @@ var DID = class {
|
|
43332
43316
|
};
|
43333
43317
|
__name(DID, "DID");
|
43334
43318
|
|
43319
|
+
// ../../node_modules/.pnpm/hex-lite@1.5.0/node_modules/hex-lite/dist/hex-lite.mjs
|
43320
|
+
function toUint8Array(str) {
|
43321
|
+
var s = 0, sl = str.length, bytes = [];
|
43322
|
+
if (sl % 2) {
|
43323
|
+
throw new Error("invalid hex:" + str);
|
43324
|
+
}
|
43325
|
+
for (; s < sl; s += 2) {
|
43326
|
+
bytes.push(parseInt(str.substr(s, 2), 16));
|
43327
|
+
}
|
43328
|
+
return new Uint8Array(bytes);
|
43329
|
+
}
|
43330
|
+
__name(toUint8Array, "toUint8Array");
|
43331
|
+
|
43335
43332
|
// src/wallet/plugins/idx/idx.ts
|
43336
43333
|
var import_key_did_resolver = __toESM(require_lib());
|
43337
43334
|
|
@@ -48356,13 +48353,11 @@ __name(CeramicClient, "CeramicClient");
|
|
48356
48353
|
|
48357
48354
|
// src/wallet/plugins/idx/idx.ts
|
48358
48355
|
var getCeramicClientFromWalletSuite = /* @__PURE__ */ __name((wallet, ceramicEndpoint) => __async(void 0, null, function* () {
|
48359
|
-
var _a2, _b;
|
48360
48356
|
const client = new CeramicClient(ceramicEndpoint);
|
48361
48357
|
const resolver = __spreadValues({}, import_key_did_resolver.default.getResolver());
|
48362
48358
|
const did = new DID({ resolver });
|
48363
48359
|
client.did = did;
|
48364
|
-
const
|
48365
|
-
const key2 = (_b = (_a2 = contents == null ? void 0 : contents.find((c) => (c == null ? void 0 : c.name) === "DID Key Secret")) == null ? void 0 : _a2.value) != null ? _b : "";
|
48360
|
+
const key2 = wallet.pluginMethods.getKey();
|
48366
48361
|
const ceramicProvider = new Ed25519Provider(toUint8Array(key2));
|
48367
48362
|
client.did.setProvider(ceramicProvider);
|
48368
48363
|
yield client.did.authenticate();
|
@@ -48432,81 +48427,36 @@ var getIDXPlugin = /* @__PURE__ */ __name((_0, _1) => __async(void 0, [_0, _1],
|
|
48432
48427
|
addVerifiableCredentialInIdx: (_02, _12) => __async(void 0, [_02, _12], function* (_wallet, { title, id }) {
|
48433
48428
|
return addCredentialStreamIdToIndex({ title, id });
|
48434
48429
|
})
|
48435
|
-
}
|
48436
|
-
pluginConstants: {}
|
48430
|
+
}
|
48437
48431
|
};
|
48438
48432
|
}), "getIDXPlugin");
|
48439
48433
|
|
48440
|
-
// src/wallet/plugins/didkey/generateContentFromSeed.ts
|
48441
|
-
var seedToId = /* @__PURE__ */ __name((seed) => __async(void 0, null, function* () {
|
48442
|
-
const buffer2 = yield crypto_default.subtle.digest("SHA-256", seed);
|
48443
|
-
return `urn:digest:${Buffer.from(new Uint8Array(buffer2)).toString("hex")}`;
|
48444
|
-
}), "seedToId");
|
48445
|
-
var generateContentFromSeed = /* @__PURE__ */ __name((seed) => __async(void 0, null, function* () {
|
48446
|
-
const privateKeyJwk = JSON.parse(generateEd25519KeyFromBytes(seed));
|
48447
|
-
const controller = keyToDID("key", JSON.stringify(privateKeyJwk));
|
48448
|
-
const _a2 = privateKeyJwk, { d } = _a2, publicKeyJwk = __objRest(_a2, ["d"]);
|
48449
|
-
const signingKey = {
|
48450
|
-
controller,
|
48451
|
-
id: `${controller}#${controller.split(":").at(-1)}`,
|
48452
|
-
privateKeyJwk,
|
48453
|
-
publicKeyJwk,
|
48454
|
-
type: "JsonWebKey2020"
|
48455
|
-
};
|
48456
|
-
const seedId = yield seedToId(seed);
|
48457
|
-
const secret = {
|
48458
|
-
"@context": ["http://w3id.org/wallet/v1"],
|
48459
|
-
id: seedId,
|
48460
|
-
name: "DID Key Secret",
|
48461
|
-
image: "https://via.placeholder.com/150",
|
48462
|
-
description: "Used to generate a DID with a signing and encryption key.",
|
48463
|
-
tags: ["inception"],
|
48464
|
-
type: "Entropy",
|
48465
|
-
value: Buffer.from(seed).toString("hex")
|
48466
|
-
};
|
48467
|
-
const key0 = __spreadProps(__spreadValues({}, signingKey), {
|
48468
|
-
"@context": ["http://w3id.org/wallet/v1"],
|
48469
|
-
name: "Signing Key",
|
48470
|
-
image: "https://via.placeholder.com/150",
|
48471
|
-
description: "Used to produce digital signatures.",
|
48472
|
-
tags: ["inception"],
|
48473
|
-
generatedFrom: [secret.id]
|
48474
|
-
});
|
48475
|
-
return [secret, key0];
|
48476
|
-
}), "generateContentFromSeed");
|
48477
|
-
|
48478
48434
|
// src/wallet/plugins/didkey/index.ts
|
48479
|
-
var
|
48480
|
-
|
48481
|
-
|
48482
|
-
|
48483
|
-
|
48484
|
-
|
48485
|
-
|
48486
|
-
|
48487
|
-
return (_a2 = wallet.contents.find((content) => content.name === "Signing Key")) == null ? void 0 : _a2.privateKeyJwk;
|
48435
|
+
var getDidKeyPlugin = /* @__PURE__ */ __name((key2) => __async(void 0, null, function* () {
|
48436
|
+
const keypair = JSON.parse(generateEd25519KeyFromBytes(toUint8Array(key2.padStart(64, "0"))));
|
48437
|
+
const did = keyToDID("key", JSON.stringify(keypair));
|
48438
|
+
return {
|
48439
|
+
pluginMethods: {
|
48440
|
+
getSubjectDid: () => did,
|
48441
|
+
getSubjectKeypair: () => keypair,
|
48442
|
+
getKey: () => key2.padStart(64, "0")
|
48488
48443
|
}
|
48489
|
-
}
|
48490
|
-
|
48491
|
-
generateContentFromSeed
|
48492
|
-
}
|
48493
|
-
};
|
48444
|
+
};
|
48445
|
+
}), "getDidKeyPlugin");
|
48494
48446
|
|
48495
48447
|
// src/wallet/plugins/expiration/index.ts
|
48496
48448
|
var ExpirationPlugin = /* @__PURE__ */ __name((wallet) => ({
|
48497
48449
|
pluginMethods: {
|
48498
48450
|
verifyCredential: (_wallet, credential) => __async(void 0, null, function* () {
|
48499
48451
|
const verificationCheck = yield wallet.pluginMethods.verifyCredential(credential);
|
48500
|
-
if (credential.expirationDate) {
|
48452
|
+
if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {
|
48453
|
+
verificationCheck.errors.push("expiration error: Credential is expired");
|
48454
|
+
} else {
|
48501
48455
|
verificationCheck.checks.push("expiration");
|
48502
|
-
if (new Date() > new Date(credential.expirationDate)) {
|
48503
|
-
verificationCheck.errors.push("expiration error: Credential is expired");
|
48504
|
-
}
|
48505
48456
|
}
|
48506
48457
|
return verificationCheck;
|
48507
48458
|
})
|
48508
|
-
}
|
48509
|
-
pluginConstants: {}
|
48459
|
+
}
|
48510
48460
|
}), "ExpirationPlugin");
|
48511
48461
|
|
48512
48462
|
// src/wallet/plugins/vc/issueCredential.ts
|
@@ -48578,8 +48528,7 @@ var getVCPlugin = /* @__PURE__ */ __name((wallet) => __async(void 0, null, funct
|
|
48578
48528
|
credentialSubject: { id: subject }
|
48579
48529
|
};
|
48580
48530
|
}
|
48581
|
-
})
|
48582
|
-
pluginConstants: {}
|
48531
|
+
})
|
48583
48532
|
};
|
48584
48533
|
}), "getVCPlugin");
|
48585
48534
|
|
@@ -48591,7 +48540,1581 @@ var VerificationStatus = /* @__PURE__ */ ((VerificationStatus2) => {
|
|
48591
48540
|
return VerificationStatus2;
|
48592
48541
|
})(VerificationStatus || {});
|
48593
48542
|
|
48543
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/toInteger/index.js
|
48544
|
+
function toInteger(dirtyNumber) {
|
48545
|
+
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
48546
|
+
return NaN;
|
48547
|
+
}
|
48548
|
+
var number = Number(dirtyNumber);
|
48549
|
+
if (isNaN(number)) {
|
48550
|
+
return number;
|
48551
|
+
}
|
48552
|
+
return number < 0 ? Math.ceil(number) : Math.floor(number);
|
48553
|
+
}
|
48554
|
+
__name(toInteger, "toInteger");
|
48555
|
+
|
48556
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/requiredArgs/index.js
|
48557
|
+
function requiredArgs(required, args) {
|
48558
|
+
if (args.length < required) {
|
48559
|
+
throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present");
|
48560
|
+
}
|
48561
|
+
}
|
48562
|
+
__name(requiredArgs, "requiredArgs");
|
48563
|
+
|
48564
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/toDate/index.js
|
48565
|
+
function toDate(argument) {
|
48566
|
+
requiredArgs(1, arguments);
|
48567
|
+
var argStr = Object.prototype.toString.call(argument);
|
48568
|
+
if (argument instanceof Date || typeof argument === "object" && argStr === "[object Date]") {
|
48569
|
+
return new Date(argument.getTime());
|
48570
|
+
} else if (typeof argument === "number" || argStr === "[object Number]") {
|
48571
|
+
return new Date(argument);
|
48572
|
+
} else {
|
48573
|
+
if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") {
|
48574
|
+
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule");
|
48575
|
+
console.warn(new Error().stack);
|
48576
|
+
}
|
48577
|
+
return new Date(NaN);
|
48578
|
+
}
|
48579
|
+
}
|
48580
|
+
__name(toDate, "toDate");
|
48581
|
+
|
48582
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/addMilliseconds/index.js
|
48583
|
+
function addMilliseconds(dirtyDate, dirtyAmount) {
|
48584
|
+
requiredArgs(2, arguments);
|
48585
|
+
var timestamp = toDate(dirtyDate).getTime();
|
48586
|
+
var amount = toInteger(dirtyAmount);
|
48587
|
+
return new Date(timestamp + amount);
|
48588
|
+
}
|
48589
|
+
__name(addMilliseconds, "addMilliseconds");
|
48590
|
+
|
48591
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js
|
48592
|
+
function getTimezoneOffsetInMilliseconds(date) {
|
48593
|
+
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
48594
|
+
utcDate.setUTCFullYear(date.getFullYear());
|
48595
|
+
return date.getTime() - utcDate.getTime();
|
48596
|
+
}
|
48597
|
+
__name(getTimezoneOffsetInMilliseconds, "getTimezoneOffsetInMilliseconds");
|
48598
|
+
|
48599
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/isDate/index.js
|
48600
|
+
function isDate(value) {
|
48601
|
+
requiredArgs(1, arguments);
|
48602
|
+
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
48603
|
+
}
|
48604
|
+
__name(isDate, "isDate");
|
48605
|
+
|
48606
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/isValid/index.js
|
48607
|
+
function isValid(dirtyDate) {
|
48608
|
+
requiredArgs(1, arguments);
|
48609
|
+
if (!isDate(dirtyDate) && typeof dirtyDate !== "number") {
|
48610
|
+
return false;
|
48611
|
+
}
|
48612
|
+
var date = toDate(dirtyDate);
|
48613
|
+
return !isNaN(Number(date));
|
48614
|
+
}
|
48615
|
+
__name(isValid, "isValid");
|
48616
|
+
|
48617
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js
|
48618
|
+
var formatDistanceLocale = {
|
48619
|
+
lessThanXSeconds: {
|
48620
|
+
one: "less than a second",
|
48621
|
+
other: "less than {{count}} seconds"
|
48622
|
+
},
|
48623
|
+
xSeconds: {
|
48624
|
+
one: "1 second",
|
48625
|
+
other: "{{count}} seconds"
|
48626
|
+
},
|
48627
|
+
halfAMinute: "half a minute",
|
48628
|
+
lessThanXMinutes: {
|
48629
|
+
one: "less than a minute",
|
48630
|
+
other: "less than {{count}} minutes"
|
48631
|
+
},
|
48632
|
+
xMinutes: {
|
48633
|
+
one: "1 minute",
|
48634
|
+
other: "{{count}} minutes"
|
48635
|
+
},
|
48636
|
+
aboutXHours: {
|
48637
|
+
one: "about 1 hour",
|
48638
|
+
other: "about {{count}} hours"
|
48639
|
+
},
|
48640
|
+
xHours: {
|
48641
|
+
one: "1 hour",
|
48642
|
+
other: "{{count}} hours"
|
48643
|
+
},
|
48644
|
+
xDays: {
|
48645
|
+
one: "1 day",
|
48646
|
+
other: "{{count}} days"
|
48647
|
+
},
|
48648
|
+
aboutXWeeks: {
|
48649
|
+
one: "about 1 week",
|
48650
|
+
other: "about {{count}} weeks"
|
48651
|
+
},
|
48652
|
+
xWeeks: {
|
48653
|
+
one: "1 week",
|
48654
|
+
other: "{{count}} weeks"
|
48655
|
+
},
|
48656
|
+
aboutXMonths: {
|
48657
|
+
one: "about 1 month",
|
48658
|
+
other: "about {{count}} months"
|
48659
|
+
},
|
48660
|
+
xMonths: {
|
48661
|
+
one: "1 month",
|
48662
|
+
other: "{{count}} months"
|
48663
|
+
},
|
48664
|
+
aboutXYears: {
|
48665
|
+
one: "about 1 year",
|
48666
|
+
other: "about {{count}} years"
|
48667
|
+
},
|
48668
|
+
xYears: {
|
48669
|
+
one: "1 year",
|
48670
|
+
other: "{{count}} years"
|
48671
|
+
},
|
48672
|
+
overXYears: {
|
48673
|
+
one: "over 1 year",
|
48674
|
+
other: "over {{count}} years"
|
48675
|
+
},
|
48676
|
+
almostXYears: {
|
48677
|
+
one: "almost 1 year",
|
48678
|
+
other: "almost {{count}} years"
|
48679
|
+
}
|
48680
|
+
};
|
48681
|
+
var formatDistance = /* @__PURE__ */ __name(function(token, count, options) {
|
48682
|
+
var result;
|
48683
|
+
var tokenValue = formatDistanceLocale[token];
|
48684
|
+
if (typeof tokenValue === "string") {
|
48685
|
+
result = tokenValue;
|
48686
|
+
} else if (count === 1) {
|
48687
|
+
result = tokenValue.one;
|
48688
|
+
} else {
|
48689
|
+
result = tokenValue.other.replace("{{count}}", count.toString());
|
48690
|
+
}
|
48691
|
+
if (options !== null && options !== void 0 && options.addSuffix) {
|
48692
|
+
if (options.comparison && options.comparison > 0) {
|
48693
|
+
return "in " + result;
|
48694
|
+
} else {
|
48695
|
+
return result + " ago";
|
48696
|
+
}
|
48697
|
+
}
|
48698
|
+
return result;
|
48699
|
+
}, "formatDistance");
|
48700
|
+
var formatDistance_default = formatDistance;
|
48701
|
+
|
48702
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js
|
48703
|
+
function buildFormatLongFn(args) {
|
48704
|
+
return function() {
|
48705
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
48706
|
+
var width = options.width ? String(options.width) : args.defaultWidth;
|
48707
|
+
var format2 = args.formats[width] || args.formats[args.defaultWidth];
|
48708
|
+
return format2;
|
48709
|
+
};
|
48710
|
+
}
|
48711
|
+
__name(buildFormatLongFn, "buildFormatLongFn");
|
48712
|
+
|
48713
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js
|
48714
|
+
var dateFormats = {
|
48715
|
+
full: "EEEE, MMMM do, y",
|
48716
|
+
long: "MMMM do, y",
|
48717
|
+
medium: "MMM d, y",
|
48718
|
+
short: "MM/dd/yyyy"
|
48719
|
+
};
|
48720
|
+
var timeFormats = {
|
48721
|
+
full: "h:mm:ss a zzzz",
|
48722
|
+
long: "h:mm:ss a z",
|
48723
|
+
medium: "h:mm:ss a",
|
48724
|
+
short: "h:mm a"
|
48725
|
+
};
|
48726
|
+
var dateTimeFormats = {
|
48727
|
+
full: "{{date}} 'at' {{time}}",
|
48728
|
+
long: "{{date}} 'at' {{time}}",
|
48729
|
+
medium: "{{date}}, {{time}}",
|
48730
|
+
short: "{{date}}, {{time}}"
|
48731
|
+
};
|
48732
|
+
var formatLong = {
|
48733
|
+
date: buildFormatLongFn({
|
48734
|
+
formats: dateFormats,
|
48735
|
+
defaultWidth: "full"
|
48736
|
+
}),
|
48737
|
+
time: buildFormatLongFn({
|
48738
|
+
formats: timeFormats,
|
48739
|
+
defaultWidth: "full"
|
48740
|
+
}),
|
48741
|
+
dateTime: buildFormatLongFn({
|
48742
|
+
formats: dateTimeFormats,
|
48743
|
+
defaultWidth: "full"
|
48744
|
+
})
|
48745
|
+
};
|
48746
|
+
var formatLong_default = formatLong;
|
48747
|
+
|
48748
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js
|
48749
|
+
var formatRelativeLocale = {
|
48750
|
+
lastWeek: "'last' eeee 'at' p",
|
48751
|
+
yesterday: "'yesterday at' p",
|
48752
|
+
today: "'today at' p",
|
48753
|
+
tomorrow: "'tomorrow at' p",
|
48754
|
+
nextWeek: "eeee 'at' p",
|
48755
|
+
other: "P"
|
48756
|
+
};
|
48757
|
+
var formatRelative = /* @__PURE__ */ __name(function(token, _date, _baseDate, _options) {
|
48758
|
+
return formatRelativeLocale[token];
|
48759
|
+
}, "formatRelative");
|
48760
|
+
var formatRelative_default = formatRelative;
|
48761
|
+
|
48762
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js
|
48763
|
+
function buildLocalizeFn(args) {
|
48764
|
+
return function(dirtyIndex, dirtyOptions) {
|
48765
|
+
var options = dirtyOptions || {};
|
48766
|
+
var context2 = options.context ? String(options.context) : "standalone";
|
48767
|
+
var valuesArray;
|
48768
|
+
if (context2 === "formatting" && args.formattingValues) {
|
48769
|
+
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
48770
|
+
var width = options.width ? String(options.width) : defaultWidth;
|
48771
|
+
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
48772
|
+
} else {
|
48773
|
+
var _defaultWidth = args.defaultWidth;
|
48774
|
+
var _width = options.width ? String(options.width) : args.defaultWidth;
|
48775
|
+
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
48776
|
+
}
|
48777
|
+
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
|
48778
|
+
return valuesArray[index];
|
48779
|
+
};
|
48780
|
+
}
|
48781
|
+
__name(buildLocalizeFn, "buildLocalizeFn");
|
48782
|
+
|
48783
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js
|
48784
|
+
var eraValues = {
|
48785
|
+
narrow: ["B", "A"],
|
48786
|
+
abbreviated: ["BC", "AD"],
|
48787
|
+
wide: ["Before Christ", "Anno Domini"]
|
48788
|
+
};
|
48789
|
+
var quarterValues = {
|
48790
|
+
narrow: ["1", "2", "3", "4"],
|
48791
|
+
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
48792
|
+
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
48793
|
+
};
|
48794
|
+
var monthValues = {
|
48795
|
+
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
48796
|
+
abbreviated: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
48797
|
+
wide: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
|
48798
|
+
};
|
48799
|
+
var dayValues = {
|
48800
|
+
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
48801
|
+
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
48802
|
+
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
48803
|
+
wide: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
48804
|
+
};
|
48805
|
+
var dayPeriodValues = {
|
48806
|
+
narrow: {
|
48807
|
+
am: "a",
|
48808
|
+
pm: "p",
|
48809
|
+
midnight: "mi",
|
48810
|
+
noon: "n",
|
48811
|
+
morning: "morning",
|
48812
|
+
afternoon: "afternoon",
|
48813
|
+
evening: "evening",
|
48814
|
+
night: "night"
|
48815
|
+
},
|
48816
|
+
abbreviated: {
|
48817
|
+
am: "AM",
|
48818
|
+
pm: "PM",
|
48819
|
+
midnight: "midnight",
|
48820
|
+
noon: "noon",
|
48821
|
+
morning: "morning",
|
48822
|
+
afternoon: "afternoon",
|
48823
|
+
evening: "evening",
|
48824
|
+
night: "night"
|
48825
|
+
},
|
48826
|
+
wide: {
|
48827
|
+
am: "a.m.",
|
48828
|
+
pm: "p.m.",
|
48829
|
+
midnight: "midnight",
|
48830
|
+
noon: "noon",
|
48831
|
+
morning: "morning",
|
48832
|
+
afternoon: "afternoon",
|
48833
|
+
evening: "evening",
|
48834
|
+
night: "night"
|
48835
|
+
}
|
48836
|
+
};
|
48837
|
+
var formattingDayPeriodValues = {
|
48838
|
+
narrow: {
|
48839
|
+
am: "a",
|
48840
|
+
pm: "p",
|
48841
|
+
midnight: "mi",
|
48842
|
+
noon: "n",
|
48843
|
+
morning: "in the morning",
|
48844
|
+
afternoon: "in the afternoon",
|
48845
|
+
evening: "in the evening",
|
48846
|
+
night: "at night"
|
48847
|
+
},
|
48848
|
+
abbreviated: {
|
48849
|
+
am: "AM",
|
48850
|
+
pm: "PM",
|
48851
|
+
midnight: "midnight",
|
48852
|
+
noon: "noon",
|
48853
|
+
morning: "in the morning",
|
48854
|
+
afternoon: "in the afternoon",
|
48855
|
+
evening: "in the evening",
|
48856
|
+
night: "at night"
|
48857
|
+
},
|
48858
|
+
wide: {
|
48859
|
+
am: "a.m.",
|
48860
|
+
pm: "p.m.",
|
48861
|
+
midnight: "midnight",
|
48862
|
+
noon: "noon",
|
48863
|
+
morning: "in the morning",
|
48864
|
+
afternoon: "in the afternoon",
|
48865
|
+
evening: "in the evening",
|
48866
|
+
night: "at night"
|
48867
|
+
}
|
48868
|
+
};
|
48869
|
+
var ordinalNumber = /* @__PURE__ */ __name(function(dirtyNumber, _options) {
|
48870
|
+
var number = Number(dirtyNumber);
|
48871
|
+
var rem100 = number % 100;
|
48872
|
+
if (rem100 > 20 || rem100 < 10) {
|
48873
|
+
switch (rem100 % 10) {
|
48874
|
+
case 1:
|
48875
|
+
return number + "st";
|
48876
|
+
case 2:
|
48877
|
+
return number + "nd";
|
48878
|
+
case 3:
|
48879
|
+
return number + "rd";
|
48880
|
+
}
|
48881
|
+
}
|
48882
|
+
return number + "th";
|
48883
|
+
}, "ordinalNumber");
|
48884
|
+
var localize = {
|
48885
|
+
ordinalNumber,
|
48886
|
+
era: buildLocalizeFn({
|
48887
|
+
values: eraValues,
|
48888
|
+
defaultWidth: "wide"
|
48889
|
+
}),
|
48890
|
+
quarter: buildLocalizeFn({
|
48891
|
+
values: quarterValues,
|
48892
|
+
defaultWidth: "wide",
|
48893
|
+
argumentCallback: function(quarter) {
|
48894
|
+
return quarter - 1;
|
48895
|
+
}
|
48896
|
+
}),
|
48897
|
+
month: buildLocalizeFn({
|
48898
|
+
values: monthValues,
|
48899
|
+
defaultWidth: "wide"
|
48900
|
+
}),
|
48901
|
+
day: buildLocalizeFn({
|
48902
|
+
values: dayValues,
|
48903
|
+
defaultWidth: "wide"
|
48904
|
+
}),
|
48905
|
+
dayPeriod: buildLocalizeFn({
|
48906
|
+
values: dayPeriodValues,
|
48907
|
+
defaultWidth: "wide",
|
48908
|
+
formattingValues: formattingDayPeriodValues,
|
48909
|
+
defaultFormattingWidth: "wide"
|
48910
|
+
})
|
48911
|
+
};
|
48912
|
+
var localize_default = localize;
|
48913
|
+
|
48914
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js
|
48915
|
+
function buildMatchFn(args) {
|
48916
|
+
return function(string2) {
|
48917
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
48918
|
+
var width = options.width;
|
48919
|
+
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
48920
|
+
var matchResult = string2.match(matchPattern);
|
48921
|
+
if (!matchResult) {
|
48922
|
+
return null;
|
48923
|
+
}
|
48924
|
+
var matchedString = matchResult[0];
|
48925
|
+
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
48926
|
+
var key2 = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) {
|
48927
|
+
return pattern.test(matchedString);
|
48928
|
+
}) : findKey(parsePatterns, function(pattern) {
|
48929
|
+
return pattern.test(matchedString);
|
48930
|
+
});
|
48931
|
+
var value;
|
48932
|
+
value = args.valueCallback ? args.valueCallback(key2) : key2;
|
48933
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
48934
|
+
var rest = string2.slice(matchedString.length);
|
48935
|
+
return {
|
48936
|
+
value,
|
48937
|
+
rest
|
48938
|
+
};
|
48939
|
+
};
|
48940
|
+
}
|
48941
|
+
__name(buildMatchFn, "buildMatchFn");
|
48942
|
+
function findKey(object, predicate) {
|
48943
|
+
for (var key2 in object) {
|
48944
|
+
if (object.hasOwnProperty(key2) && predicate(object[key2])) {
|
48945
|
+
return key2;
|
48946
|
+
}
|
48947
|
+
}
|
48948
|
+
return void 0;
|
48949
|
+
}
|
48950
|
+
__name(findKey, "findKey");
|
48951
|
+
function findIndex(array, predicate) {
|
48952
|
+
for (var key2 = 0; key2 < array.length; key2++) {
|
48953
|
+
if (predicate(array[key2])) {
|
48954
|
+
return key2;
|
48955
|
+
}
|
48956
|
+
}
|
48957
|
+
return void 0;
|
48958
|
+
}
|
48959
|
+
__name(findIndex, "findIndex");
|
48960
|
+
|
48961
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js
|
48962
|
+
function buildMatchPatternFn(args) {
|
48963
|
+
return function(string2) {
|
48964
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
48965
|
+
var matchResult = string2.match(args.matchPattern);
|
48966
|
+
if (!matchResult)
|
48967
|
+
return null;
|
48968
|
+
var matchedString = matchResult[0];
|
48969
|
+
var parseResult = string2.match(args.parsePattern);
|
48970
|
+
if (!parseResult)
|
48971
|
+
return null;
|
48972
|
+
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
48973
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
48974
|
+
var rest = string2.slice(matchedString.length);
|
48975
|
+
return {
|
48976
|
+
value,
|
48977
|
+
rest
|
48978
|
+
};
|
48979
|
+
};
|
48980
|
+
}
|
48981
|
+
__name(buildMatchPatternFn, "buildMatchPatternFn");
|
48982
|
+
|
48983
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js
|
48984
|
+
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
48985
|
+
var parseOrdinalNumberPattern = /\d+/i;
|
48986
|
+
var matchEraPatterns = {
|
48987
|
+
narrow: /^(b|a)/i,
|
48988
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
48989
|
+
wide: /^(before christ|before common era|anno domini|common era)/i
|
48990
|
+
};
|
48991
|
+
var parseEraPatterns = {
|
48992
|
+
any: [/^b/i, /^(a|c)/i]
|
48993
|
+
};
|
48994
|
+
var matchQuarterPatterns = {
|
48995
|
+
narrow: /^[1234]/i,
|
48996
|
+
abbreviated: /^q[1234]/i,
|
48997
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i
|
48998
|
+
};
|
48999
|
+
var parseQuarterPatterns = {
|
49000
|
+
any: [/1/i, /2/i, /3/i, /4/i]
|
49001
|
+
};
|
49002
|
+
var matchMonthPatterns = {
|
49003
|
+
narrow: /^[jfmasond]/i,
|
49004
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
49005
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
49006
|
+
};
|
49007
|
+
var parseMonthPatterns = {
|
49008
|
+
narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
|
49009
|
+
any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
|
49010
|
+
};
|
49011
|
+
var matchDayPatterns = {
|
49012
|
+
narrow: /^[smtwf]/i,
|
49013
|
+
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
49014
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
49015
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
49016
|
+
};
|
49017
|
+
var parseDayPatterns = {
|
49018
|
+
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
49019
|
+
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
49020
|
+
};
|
49021
|
+
var matchDayPeriodPatterns = {
|
49022
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
49023
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
49024
|
+
};
|
49025
|
+
var parseDayPeriodPatterns = {
|
49026
|
+
any: {
|
49027
|
+
am: /^a/i,
|
49028
|
+
pm: /^p/i,
|
49029
|
+
midnight: /^mi/i,
|
49030
|
+
noon: /^no/i,
|
49031
|
+
morning: /morning/i,
|
49032
|
+
afternoon: /afternoon/i,
|
49033
|
+
evening: /evening/i,
|
49034
|
+
night: /night/i
|
49035
|
+
}
|
49036
|
+
};
|
49037
|
+
var match = {
|
49038
|
+
ordinalNumber: buildMatchPatternFn({
|
49039
|
+
matchPattern: matchOrdinalNumberPattern,
|
49040
|
+
parsePattern: parseOrdinalNumberPattern,
|
49041
|
+
valueCallback: function(value) {
|
49042
|
+
return parseInt(value, 10);
|
49043
|
+
}
|
49044
|
+
}),
|
49045
|
+
era: buildMatchFn({
|
49046
|
+
matchPatterns: matchEraPatterns,
|
49047
|
+
defaultMatchWidth: "wide",
|
49048
|
+
parsePatterns: parseEraPatterns,
|
49049
|
+
defaultParseWidth: "any"
|
49050
|
+
}),
|
49051
|
+
quarter: buildMatchFn({
|
49052
|
+
matchPatterns: matchQuarterPatterns,
|
49053
|
+
defaultMatchWidth: "wide",
|
49054
|
+
parsePatterns: parseQuarterPatterns,
|
49055
|
+
defaultParseWidth: "any",
|
49056
|
+
valueCallback: function(index) {
|
49057
|
+
return index + 1;
|
49058
|
+
}
|
49059
|
+
}),
|
49060
|
+
month: buildMatchFn({
|
49061
|
+
matchPatterns: matchMonthPatterns,
|
49062
|
+
defaultMatchWidth: "wide",
|
49063
|
+
parsePatterns: parseMonthPatterns,
|
49064
|
+
defaultParseWidth: "any"
|
49065
|
+
}),
|
49066
|
+
day: buildMatchFn({
|
49067
|
+
matchPatterns: matchDayPatterns,
|
49068
|
+
defaultMatchWidth: "wide",
|
49069
|
+
parsePatterns: parseDayPatterns,
|
49070
|
+
defaultParseWidth: "any"
|
49071
|
+
}),
|
49072
|
+
dayPeriod: buildMatchFn({
|
49073
|
+
matchPatterns: matchDayPeriodPatterns,
|
49074
|
+
defaultMatchWidth: "any",
|
49075
|
+
parsePatterns: parseDayPeriodPatterns,
|
49076
|
+
defaultParseWidth: "any"
|
49077
|
+
})
|
49078
|
+
};
|
49079
|
+
var match_default = match;
|
49080
|
+
|
49081
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/locale/en-US/index.js
|
49082
|
+
var locale = {
|
49083
|
+
code: "en-US",
|
49084
|
+
formatDistance: formatDistance_default,
|
49085
|
+
formatLong: formatLong_default,
|
49086
|
+
formatRelative: formatRelative_default,
|
49087
|
+
localize: localize_default,
|
49088
|
+
match: match_default,
|
49089
|
+
options: {
|
49090
|
+
weekStartsOn: 0,
|
49091
|
+
firstWeekContainsDate: 1
|
49092
|
+
}
|
49093
|
+
};
|
49094
|
+
var en_US_default = locale;
|
49095
|
+
|
49096
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/subMilliseconds/index.js
|
49097
|
+
function subMilliseconds(dirtyDate, dirtyAmount) {
|
49098
|
+
requiredArgs(2, arguments);
|
49099
|
+
var amount = toInteger(dirtyAmount);
|
49100
|
+
return addMilliseconds(dirtyDate, -amount);
|
49101
|
+
}
|
49102
|
+
__name(subMilliseconds, "subMilliseconds");
|
49103
|
+
|
49104
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js
|
49105
|
+
var MILLISECONDS_IN_DAY = 864e5;
|
49106
|
+
function getUTCDayOfYear(dirtyDate) {
|
49107
|
+
requiredArgs(1, arguments);
|
49108
|
+
var date = toDate(dirtyDate);
|
49109
|
+
var timestamp = date.getTime();
|
49110
|
+
date.setUTCMonth(0, 1);
|
49111
|
+
date.setUTCHours(0, 0, 0, 0);
|
49112
|
+
var startOfYearTimestamp = date.getTime();
|
49113
|
+
var difference = timestamp - startOfYearTimestamp;
|
49114
|
+
return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
|
49115
|
+
}
|
49116
|
+
__name(getUTCDayOfYear, "getUTCDayOfYear");
|
49117
|
+
|
49118
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js
|
49119
|
+
function startOfUTCISOWeek(dirtyDate) {
|
49120
|
+
requiredArgs(1, arguments);
|
49121
|
+
var weekStartsOn = 1;
|
49122
|
+
var date = toDate(dirtyDate);
|
49123
|
+
var day = date.getUTCDay();
|
49124
|
+
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
49125
|
+
date.setUTCDate(date.getUTCDate() - diff);
|
49126
|
+
date.setUTCHours(0, 0, 0, 0);
|
49127
|
+
return date;
|
49128
|
+
}
|
49129
|
+
__name(startOfUTCISOWeek, "startOfUTCISOWeek");
|
49130
|
+
|
49131
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js
|
49132
|
+
function getUTCISOWeekYear(dirtyDate) {
|
49133
|
+
requiredArgs(1, arguments);
|
49134
|
+
var date = toDate(dirtyDate);
|
49135
|
+
var year = date.getUTCFullYear();
|
49136
|
+
var fourthOfJanuaryOfNextYear = new Date(0);
|
49137
|
+
fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
|
49138
|
+
fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
|
49139
|
+
var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
|
49140
|
+
var fourthOfJanuaryOfThisYear = new Date(0);
|
49141
|
+
fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
|
49142
|
+
fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
|
49143
|
+
var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
|
49144
|
+
if (date.getTime() >= startOfNextYear.getTime()) {
|
49145
|
+
return year + 1;
|
49146
|
+
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
49147
|
+
return year;
|
49148
|
+
} else {
|
49149
|
+
return year - 1;
|
49150
|
+
}
|
49151
|
+
}
|
49152
|
+
__name(getUTCISOWeekYear, "getUTCISOWeekYear");
|
49153
|
+
|
49154
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js
|
49155
|
+
function startOfUTCISOWeekYear(dirtyDate) {
|
49156
|
+
requiredArgs(1, arguments);
|
49157
|
+
var year = getUTCISOWeekYear(dirtyDate);
|
49158
|
+
var fourthOfJanuary = new Date(0);
|
49159
|
+
fourthOfJanuary.setUTCFullYear(year, 0, 4);
|
49160
|
+
fourthOfJanuary.setUTCHours(0, 0, 0, 0);
|
49161
|
+
var date = startOfUTCISOWeek(fourthOfJanuary);
|
49162
|
+
return date;
|
49163
|
+
}
|
49164
|
+
__name(startOfUTCISOWeekYear, "startOfUTCISOWeekYear");
|
49165
|
+
|
49166
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js
|
49167
|
+
var MILLISECONDS_IN_WEEK = 6048e5;
|
49168
|
+
function getUTCISOWeek(dirtyDate) {
|
49169
|
+
requiredArgs(1, arguments);
|
49170
|
+
var date = toDate(dirtyDate);
|
49171
|
+
var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
|
49172
|
+
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
|
49173
|
+
}
|
49174
|
+
__name(getUTCISOWeek, "getUTCISOWeek");
|
49175
|
+
|
49176
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js
|
49177
|
+
function startOfUTCWeek(dirtyDate, dirtyOptions) {
|
49178
|
+
requiredArgs(1, arguments);
|
49179
|
+
var options = dirtyOptions || {};
|
49180
|
+
var locale2 = options.locale;
|
49181
|
+
var localeWeekStartsOn = locale2 && locale2.options && locale2.options.weekStartsOn;
|
49182
|
+
var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
|
49183
|
+
var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);
|
49184
|
+
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
49185
|
+
throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
|
49186
|
+
}
|
49187
|
+
var date = toDate(dirtyDate);
|
49188
|
+
var day = date.getUTCDay();
|
49189
|
+
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
49190
|
+
date.setUTCDate(date.getUTCDate() - diff);
|
49191
|
+
date.setUTCHours(0, 0, 0, 0);
|
49192
|
+
return date;
|
49193
|
+
}
|
49194
|
+
__name(startOfUTCWeek, "startOfUTCWeek");
|
49195
|
+
|
49196
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js
|
49197
|
+
function getUTCWeekYear(dirtyDate, dirtyOptions) {
|
49198
|
+
requiredArgs(1, arguments);
|
49199
|
+
var date = toDate(dirtyDate);
|
49200
|
+
var year = date.getUTCFullYear();
|
49201
|
+
var options = dirtyOptions || {};
|
49202
|
+
var locale2 = options.locale;
|
49203
|
+
var localeFirstWeekContainsDate = locale2 && locale2.options && locale2.options.firstWeekContainsDate;
|
49204
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
49205
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
|
49206
|
+
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
49207
|
+
throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
|
49208
|
+
}
|
49209
|
+
var firstWeekOfNextYear = new Date(0);
|
49210
|
+
firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
|
49211
|
+
firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
|
49212
|
+
var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
|
49213
|
+
var firstWeekOfThisYear = new Date(0);
|
49214
|
+
firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
|
49215
|
+
firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
|
49216
|
+
var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
|
49217
|
+
if (date.getTime() >= startOfNextYear.getTime()) {
|
49218
|
+
return year + 1;
|
49219
|
+
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
49220
|
+
return year;
|
49221
|
+
} else {
|
49222
|
+
return year - 1;
|
49223
|
+
}
|
49224
|
+
}
|
49225
|
+
__name(getUTCWeekYear, "getUTCWeekYear");
|
49226
|
+
|
49227
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js
|
49228
|
+
function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
|
49229
|
+
requiredArgs(1, arguments);
|
49230
|
+
var options = dirtyOptions || {};
|
49231
|
+
var locale2 = options.locale;
|
49232
|
+
var localeFirstWeekContainsDate = locale2 && locale2.options && locale2.options.firstWeekContainsDate;
|
49233
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
49234
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
|
49235
|
+
var year = getUTCWeekYear(dirtyDate, dirtyOptions);
|
49236
|
+
var firstWeek = new Date(0);
|
49237
|
+
firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
|
49238
|
+
firstWeek.setUTCHours(0, 0, 0, 0);
|
49239
|
+
var date = startOfUTCWeek(firstWeek, dirtyOptions);
|
49240
|
+
return date;
|
49241
|
+
}
|
49242
|
+
__name(startOfUTCWeekYear, "startOfUTCWeekYear");
|
49243
|
+
|
49244
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/getUTCWeek/index.js
|
49245
|
+
var MILLISECONDS_IN_WEEK2 = 6048e5;
|
49246
|
+
function getUTCWeek(dirtyDate, options) {
|
49247
|
+
requiredArgs(1, arguments);
|
49248
|
+
var date = toDate(dirtyDate);
|
49249
|
+
var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
|
49250
|
+
return Math.round(diff / MILLISECONDS_IN_WEEK2) + 1;
|
49251
|
+
}
|
49252
|
+
__name(getUTCWeek, "getUTCWeek");
|
49253
|
+
|
49254
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/addLeadingZeros/index.js
|
49255
|
+
function addLeadingZeros(number, targetLength) {
|
49256
|
+
var sign5 = number < 0 ? "-" : "";
|
49257
|
+
var output = Math.abs(number).toString();
|
49258
|
+
while (output.length < targetLength) {
|
49259
|
+
output = "0" + output;
|
49260
|
+
}
|
49261
|
+
return sign5 + output;
|
49262
|
+
}
|
49263
|
+
__name(addLeadingZeros, "addLeadingZeros");
|
49264
|
+
|
49265
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/format/lightFormatters/index.js
|
49266
|
+
var formatters = {
|
49267
|
+
y: function(date, token) {
|
49268
|
+
var signedYear = date.getUTCFullYear();
|
49269
|
+
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
49270
|
+
return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
49271
|
+
},
|
49272
|
+
M: function(date, token) {
|
49273
|
+
var month = date.getUTCMonth();
|
49274
|
+
return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
49275
|
+
},
|
49276
|
+
d: function(date, token) {
|
49277
|
+
return addLeadingZeros(date.getUTCDate(), token.length);
|
49278
|
+
},
|
49279
|
+
a: function(date, token) {
|
49280
|
+
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? "pm" : "am";
|
49281
|
+
switch (token) {
|
49282
|
+
case "a":
|
49283
|
+
case "aa":
|
49284
|
+
return dayPeriodEnumValue.toUpperCase();
|
49285
|
+
case "aaa":
|
49286
|
+
return dayPeriodEnumValue;
|
49287
|
+
case "aaaaa":
|
49288
|
+
return dayPeriodEnumValue[0];
|
49289
|
+
case "aaaa":
|
49290
|
+
default:
|
49291
|
+
return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
|
49292
|
+
}
|
49293
|
+
},
|
49294
|
+
h: function(date, token) {
|
49295
|
+
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
|
49296
|
+
},
|
49297
|
+
H: function(date, token) {
|
49298
|
+
return addLeadingZeros(date.getUTCHours(), token.length);
|
49299
|
+
},
|
49300
|
+
m: function(date, token) {
|
49301
|
+
return addLeadingZeros(date.getUTCMinutes(), token.length);
|
49302
|
+
},
|
49303
|
+
s: function(date, token) {
|
49304
|
+
return addLeadingZeros(date.getUTCSeconds(), token.length);
|
49305
|
+
},
|
49306
|
+
S: function(date, token) {
|
49307
|
+
var numberOfDigits = token.length;
|
49308
|
+
var milliseconds = date.getUTCMilliseconds();
|
49309
|
+
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
|
49310
|
+
return addLeadingZeros(fractionalSeconds, token.length);
|
49311
|
+
}
|
49312
|
+
};
|
49313
|
+
var lightFormatters_default = formatters;
|
49314
|
+
|
49315
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/format/formatters/index.js
|
49316
|
+
var dayPeriodEnum = {
|
49317
|
+
am: "am",
|
49318
|
+
pm: "pm",
|
49319
|
+
midnight: "midnight",
|
49320
|
+
noon: "noon",
|
49321
|
+
morning: "morning",
|
49322
|
+
afternoon: "afternoon",
|
49323
|
+
evening: "evening",
|
49324
|
+
night: "night"
|
49325
|
+
};
|
49326
|
+
var formatters2 = {
|
49327
|
+
G: function(date, token, localize2) {
|
49328
|
+
var era = date.getUTCFullYear() > 0 ? 1 : 0;
|
49329
|
+
switch (token) {
|
49330
|
+
case "G":
|
49331
|
+
case "GG":
|
49332
|
+
case "GGG":
|
49333
|
+
return localize2.era(era, {
|
49334
|
+
width: "abbreviated"
|
49335
|
+
});
|
49336
|
+
case "GGGGG":
|
49337
|
+
return localize2.era(era, {
|
49338
|
+
width: "narrow"
|
49339
|
+
});
|
49340
|
+
case "GGGG":
|
49341
|
+
default:
|
49342
|
+
return localize2.era(era, {
|
49343
|
+
width: "wide"
|
49344
|
+
});
|
49345
|
+
}
|
49346
|
+
},
|
49347
|
+
y: function(date, token, localize2) {
|
49348
|
+
if (token === "yo") {
|
49349
|
+
var signedYear = date.getUTCFullYear();
|
49350
|
+
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
49351
|
+
return localize2.ordinalNumber(year, {
|
49352
|
+
unit: "year"
|
49353
|
+
});
|
49354
|
+
}
|
49355
|
+
return lightFormatters_default.y(date, token);
|
49356
|
+
},
|
49357
|
+
Y: function(date, token, localize2, options) {
|
49358
|
+
var signedWeekYear = getUTCWeekYear(date, options);
|
49359
|
+
var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
49360
|
+
if (token === "YY") {
|
49361
|
+
var twoDigitYear = weekYear % 100;
|
49362
|
+
return addLeadingZeros(twoDigitYear, 2);
|
49363
|
+
}
|
49364
|
+
if (token === "Yo") {
|
49365
|
+
return localize2.ordinalNumber(weekYear, {
|
49366
|
+
unit: "year"
|
49367
|
+
});
|
49368
|
+
}
|
49369
|
+
return addLeadingZeros(weekYear, token.length);
|
49370
|
+
},
|
49371
|
+
R: function(date, token) {
|
49372
|
+
var isoWeekYear = getUTCISOWeekYear(date);
|
49373
|
+
return addLeadingZeros(isoWeekYear, token.length);
|
49374
|
+
},
|
49375
|
+
u: function(date, token) {
|
49376
|
+
var year = date.getUTCFullYear();
|
49377
|
+
return addLeadingZeros(year, token.length);
|
49378
|
+
},
|
49379
|
+
Q: function(date, token, localize2) {
|
49380
|
+
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
|
49381
|
+
switch (token) {
|
49382
|
+
case "Q":
|
49383
|
+
return String(quarter);
|
49384
|
+
case "QQ":
|
49385
|
+
return addLeadingZeros(quarter, 2);
|
49386
|
+
case "Qo":
|
49387
|
+
return localize2.ordinalNumber(quarter, {
|
49388
|
+
unit: "quarter"
|
49389
|
+
});
|
49390
|
+
case "QQQ":
|
49391
|
+
return localize2.quarter(quarter, {
|
49392
|
+
width: "abbreviated",
|
49393
|
+
context: "formatting"
|
49394
|
+
});
|
49395
|
+
case "QQQQQ":
|
49396
|
+
return localize2.quarter(quarter, {
|
49397
|
+
width: "narrow",
|
49398
|
+
context: "formatting"
|
49399
|
+
});
|
49400
|
+
case "QQQQ":
|
49401
|
+
default:
|
49402
|
+
return localize2.quarter(quarter, {
|
49403
|
+
width: "wide",
|
49404
|
+
context: "formatting"
|
49405
|
+
});
|
49406
|
+
}
|
49407
|
+
},
|
49408
|
+
q: function(date, token, localize2) {
|
49409
|
+
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
|
49410
|
+
switch (token) {
|
49411
|
+
case "q":
|
49412
|
+
return String(quarter);
|
49413
|
+
case "qq":
|
49414
|
+
return addLeadingZeros(quarter, 2);
|
49415
|
+
case "qo":
|
49416
|
+
return localize2.ordinalNumber(quarter, {
|
49417
|
+
unit: "quarter"
|
49418
|
+
});
|
49419
|
+
case "qqq":
|
49420
|
+
return localize2.quarter(quarter, {
|
49421
|
+
width: "abbreviated",
|
49422
|
+
context: "standalone"
|
49423
|
+
});
|
49424
|
+
case "qqqqq":
|
49425
|
+
return localize2.quarter(quarter, {
|
49426
|
+
width: "narrow",
|
49427
|
+
context: "standalone"
|
49428
|
+
});
|
49429
|
+
case "qqqq":
|
49430
|
+
default:
|
49431
|
+
return localize2.quarter(quarter, {
|
49432
|
+
width: "wide",
|
49433
|
+
context: "standalone"
|
49434
|
+
});
|
49435
|
+
}
|
49436
|
+
},
|
49437
|
+
M: function(date, token, localize2) {
|
49438
|
+
var month = date.getUTCMonth();
|
49439
|
+
switch (token) {
|
49440
|
+
case "M":
|
49441
|
+
case "MM":
|
49442
|
+
return lightFormatters_default.M(date, token);
|
49443
|
+
case "Mo":
|
49444
|
+
return localize2.ordinalNumber(month + 1, {
|
49445
|
+
unit: "month"
|
49446
|
+
});
|
49447
|
+
case "MMM":
|
49448
|
+
return localize2.month(month, {
|
49449
|
+
width: "abbreviated",
|
49450
|
+
context: "formatting"
|
49451
|
+
});
|
49452
|
+
case "MMMMM":
|
49453
|
+
return localize2.month(month, {
|
49454
|
+
width: "narrow",
|
49455
|
+
context: "formatting"
|
49456
|
+
});
|
49457
|
+
case "MMMM":
|
49458
|
+
default:
|
49459
|
+
return localize2.month(month, {
|
49460
|
+
width: "wide",
|
49461
|
+
context: "formatting"
|
49462
|
+
});
|
49463
|
+
}
|
49464
|
+
},
|
49465
|
+
L: function(date, token, localize2) {
|
49466
|
+
var month = date.getUTCMonth();
|
49467
|
+
switch (token) {
|
49468
|
+
case "L":
|
49469
|
+
return String(month + 1);
|
49470
|
+
case "LL":
|
49471
|
+
return addLeadingZeros(month + 1, 2);
|
49472
|
+
case "Lo":
|
49473
|
+
return localize2.ordinalNumber(month + 1, {
|
49474
|
+
unit: "month"
|
49475
|
+
});
|
49476
|
+
case "LLL":
|
49477
|
+
return localize2.month(month, {
|
49478
|
+
width: "abbreviated",
|
49479
|
+
context: "standalone"
|
49480
|
+
});
|
49481
|
+
case "LLLLL":
|
49482
|
+
return localize2.month(month, {
|
49483
|
+
width: "narrow",
|
49484
|
+
context: "standalone"
|
49485
|
+
});
|
49486
|
+
case "LLLL":
|
49487
|
+
default:
|
49488
|
+
return localize2.month(month, {
|
49489
|
+
width: "wide",
|
49490
|
+
context: "standalone"
|
49491
|
+
});
|
49492
|
+
}
|
49493
|
+
},
|
49494
|
+
w: function(date, token, localize2, options) {
|
49495
|
+
var week = getUTCWeek(date, options);
|
49496
|
+
if (token === "wo") {
|
49497
|
+
return localize2.ordinalNumber(week, {
|
49498
|
+
unit: "week"
|
49499
|
+
});
|
49500
|
+
}
|
49501
|
+
return addLeadingZeros(week, token.length);
|
49502
|
+
},
|
49503
|
+
I: function(date, token, localize2) {
|
49504
|
+
var isoWeek = getUTCISOWeek(date);
|
49505
|
+
if (token === "Io") {
|
49506
|
+
return localize2.ordinalNumber(isoWeek, {
|
49507
|
+
unit: "week"
|
49508
|
+
});
|
49509
|
+
}
|
49510
|
+
return addLeadingZeros(isoWeek, token.length);
|
49511
|
+
},
|
49512
|
+
d: function(date, token, localize2) {
|
49513
|
+
if (token === "do") {
|
49514
|
+
return localize2.ordinalNumber(date.getUTCDate(), {
|
49515
|
+
unit: "date"
|
49516
|
+
});
|
49517
|
+
}
|
49518
|
+
return lightFormatters_default.d(date, token);
|
49519
|
+
},
|
49520
|
+
D: function(date, token, localize2) {
|
49521
|
+
var dayOfYear = getUTCDayOfYear(date);
|
49522
|
+
if (token === "Do") {
|
49523
|
+
return localize2.ordinalNumber(dayOfYear, {
|
49524
|
+
unit: "dayOfYear"
|
49525
|
+
});
|
49526
|
+
}
|
49527
|
+
return addLeadingZeros(dayOfYear, token.length);
|
49528
|
+
},
|
49529
|
+
E: function(date, token, localize2) {
|
49530
|
+
var dayOfWeek = date.getUTCDay();
|
49531
|
+
switch (token) {
|
49532
|
+
case "E":
|
49533
|
+
case "EE":
|
49534
|
+
case "EEE":
|
49535
|
+
return localize2.day(dayOfWeek, {
|
49536
|
+
width: "abbreviated",
|
49537
|
+
context: "formatting"
|
49538
|
+
});
|
49539
|
+
case "EEEEE":
|
49540
|
+
return localize2.day(dayOfWeek, {
|
49541
|
+
width: "narrow",
|
49542
|
+
context: "formatting"
|
49543
|
+
});
|
49544
|
+
case "EEEEEE":
|
49545
|
+
return localize2.day(dayOfWeek, {
|
49546
|
+
width: "short",
|
49547
|
+
context: "formatting"
|
49548
|
+
});
|
49549
|
+
case "EEEE":
|
49550
|
+
default:
|
49551
|
+
return localize2.day(dayOfWeek, {
|
49552
|
+
width: "wide",
|
49553
|
+
context: "formatting"
|
49554
|
+
});
|
49555
|
+
}
|
49556
|
+
},
|
49557
|
+
e: function(date, token, localize2, options) {
|
49558
|
+
var dayOfWeek = date.getUTCDay();
|
49559
|
+
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
49560
|
+
switch (token) {
|
49561
|
+
case "e":
|
49562
|
+
return String(localDayOfWeek);
|
49563
|
+
case "ee":
|
49564
|
+
return addLeadingZeros(localDayOfWeek, 2);
|
49565
|
+
case "eo":
|
49566
|
+
return localize2.ordinalNumber(localDayOfWeek, {
|
49567
|
+
unit: "day"
|
49568
|
+
});
|
49569
|
+
case "eee":
|
49570
|
+
return localize2.day(dayOfWeek, {
|
49571
|
+
width: "abbreviated",
|
49572
|
+
context: "formatting"
|
49573
|
+
});
|
49574
|
+
case "eeeee":
|
49575
|
+
return localize2.day(dayOfWeek, {
|
49576
|
+
width: "narrow",
|
49577
|
+
context: "formatting"
|
49578
|
+
});
|
49579
|
+
case "eeeeee":
|
49580
|
+
return localize2.day(dayOfWeek, {
|
49581
|
+
width: "short",
|
49582
|
+
context: "formatting"
|
49583
|
+
});
|
49584
|
+
case "eeee":
|
49585
|
+
default:
|
49586
|
+
return localize2.day(dayOfWeek, {
|
49587
|
+
width: "wide",
|
49588
|
+
context: "formatting"
|
49589
|
+
});
|
49590
|
+
}
|
49591
|
+
},
|
49592
|
+
c: function(date, token, localize2, options) {
|
49593
|
+
var dayOfWeek = date.getUTCDay();
|
49594
|
+
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
49595
|
+
switch (token) {
|
49596
|
+
case "c":
|
49597
|
+
return String(localDayOfWeek);
|
49598
|
+
case "cc":
|
49599
|
+
return addLeadingZeros(localDayOfWeek, token.length);
|
49600
|
+
case "co":
|
49601
|
+
return localize2.ordinalNumber(localDayOfWeek, {
|
49602
|
+
unit: "day"
|
49603
|
+
});
|
49604
|
+
case "ccc":
|
49605
|
+
return localize2.day(dayOfWeek, {
|
49606
|
+
width: "abbreviated",
|
49607
|
+
context: "standalone"
|
49608
|
+
});
|
49609
|
+
case "ccccc":
|
49610
|
+
return localize2.day(dayOfWeek, {
|
49611
|
+
width: "narrow",
|
49612
|
+
context: "standalone"
|
49613
|
+
});
|
49614
|
+
case "cccccc":
|
49615
|
+
return localize2.day(dayOfWeek, {
|
49616
|
+
width: "short",
|
49617
|
+
context: "standalone"
|
49618
|
+
});
|
49619
|
+
case "cccc":
|
49620
|
+
default:
|
49621
|
+
return localize2.day(dayOfWeek, {
|
49622
|
+
width: "wide",
|
49623
|
+
context: "standalone"
|
49624
|
+
});
|
49625
|
+
}
|
49626
|
+
},
|
49627
|
+
i: function(date, token, localize2) {
|
49628
|
+
var dayOfWeek = date.getUTCDay();
|
49629
|
+
var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
49630
|
+
switch (token) {
|
49631
|
+
case "i":
|
49632
|
+
return String(isoDayOfWeek);
|
49633
|
+
case "ii":
|
49634
|
+
return addLeadingZeros(isoDayOfWeek, token.length);
|
49635
|
+
case "io":
|
49636
|
+
return localize2.ordinalNumber(isoDayOfWeek, {
|
49637
|
+
unit: "day"
|
49638
|
+
});
|
49639
|
+
case "iii":
|
49640
|
+
return localize2.day(dayOfWeek, {
|
49641
|
+
width: "abbreviated",
|
49642
|
+
context: "formatting"
|
49643
|
+
});
|
49644
|
+
case "iiiii":
|
49645
|
+
return localize2.day(dayOfWeek, {
|
49646
|
+
width: "narrow",
|
49647
|
+
context: "formatting"
|
49648
|
+
});
|
49649
|
+
case "iiiiii":
|
49650
|
+
return localize2.day(dayOfWeek, {
|
49651
|
+
width: "short",
|
49652
|
+
context: "formatting"
|
49653
|
+
});
|
49654
|
+
case "iiii":
|
49655
|
+
default:
|
49656
|
+
return localize2.day(dayOfWeek, {
|
49657
|
+
width: "wide",
|
49658
|
+
context: "formatting"
|
49659
|
+
});
|
49660
|
+
}
|
49661
|
+
},
|
49662
|
+
a: function(date, token, localize2) {
|
49663
|
+
var hours = date.getUTCHours();
|
49664
|
+
var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
49665
|
+
switch (token) {
|
49666
|
+
case "a":
|
49667
|
+
case "aa":
|
49668
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49669
|
+
width: "abbreviated",
|
49670
|
+
context: "formatting"
|
49671
|
+
});
|
49672
|
+
case "aaa":
|
49673
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49674
|
+
width: "abbreviated",
|
49675
|
+
context: "formatting"
|
49676
|
+
}).toLowerCase();
|
49677
|
+
case "aaaaa":
|
49678
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49679
|
+
width: "narrow",
|
49680
|
+
context: "formatting"
|
49681
|
+
});
|
49682
|
+
case "aaaa":
|
49683
|
+
default:
|
49684
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49685
|
+
width: "wide",
|
49686
|
+
context: "formatting"
|
49687
|
+
});
|
49688
|
+
}
|
49689
|
+
},
|
49690
|
+
b: function(date, token, localize2) {
|
49691
|
+
var hours = date.getUTCHours();
|
49692
|
+
var dayPeriodEnumValue;
|
49693
|
+
if (hours === 12) {
|
49694
|
+
dayPeriodEnumValue = dayPeriodEnum.noon;
|
49695
|
+
} else if (hours === 0) {
|
49696
|
+
dayPeriodEnumValue = dayPeriodEnum.midnight;
|
49697
|
+
} else {
|
49698
|
+
dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
49699
|
+
}
|
49700
|
+
switch (token) {
|
49701
|
+
case "b":
|
49702
|
+
case "bb":
|
49703
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49704
|
+
width: "abbreviated",
|
49705
|
+
context: "formatting"
|
49706
|
+
});
|
49707
|
+
case "bbb":
|
49708
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49709
|
+
width: "abbreviated",
|
49710
|
+
context: "formatting"
|
49711
|
+
}).toLowerCase();
|
49712
|
+
case "bbbbb":
|
49713
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49714
|
+
width: "narrow",
|
49715
|
+
context: "formatting"
|
49716
|
+
});
|
49717
|
+
case "bbbb":
|
49718
|
+
default:
|
49719
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49720
|
+
width: "wide",
|
49721
|
+
context: "formatting"
|
49722
|
+
});
|
49723
|
+
}
|
49724
|
+
},
|
49725
|
+
B: function(date, token, localize2) {
|
49726
|
+
var hours = date.getUTCHours();
|
49727
|
+
var dayPeriodEnumValue;
|
49728
|
+
if (hours >= 17) {
|
49729
|
+
dayPeriodEnumValue = dayPeriodEnum.evening;
|
49730
|
+
} else if (hours >= 12) {
|
49731
|
+
dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
49732
|
+
} else if (hours >= 4) {
|
49733
|
+
dayPeriodEnumValue = dayPeriodEnum.morning;
|
49734
|
+
} else {
|
49735
|
+
dayPeriodEnumValue = dayPeriodEnum.night;
|
49736
|
+
}
|
49737
|
+
switch (token) {
|
49738
|
+
case "B":
|
49739
|
+
case "BB":
|
49740
|
+
case "BBB":
|
49741
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49742
|
+
width: "abbreviated",
|
49743
|
+
context: "formatting"
|
49744
|
+
});
|
49745
|
+
case "BBBBB":
|
49746
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49747
|
+
width: "narrow",
|
49748
|
+
context: "formatting"
|
49749
|
+
});
|
49750
|
+
case "BBBB":
|
49751
|
+
default:
|
49752
|
+
return localize2.dayPeriod(dayPeriodEnumValue, {
|
49753
|
+
width: "wide",
|
49754
|
+
context: "formatting"
|
49755
|
+
});
|
49756
|
+
}
|
49757
|
+
},
|
49758
|
+
h: function(date, token, localize2) {
|
49759
|
+
if (token === "ho") {
|
49760
|
+
var hours = date.getUTCHours() % 12;
|
49761
|
+
if (hours === 0)
|
49762
|
+
hours = 12;
|
49763
|
+
return localize2.ordinalNumber(hours, {
|
49764
|
+
unit: "hour"
|
49765
|
+
});
|
49766
|
+
}
|
49767
|
+
return lightFormatters_default.h(date, token);
|
49768
|
+
},
|
49769
|
+
H: function(date, token, localize2) {
|
49770
|
+
if (token === "Ho") {
|
49771
|
+
return localize2.ordinalNumber(date.getUTCHours(), {
|
49772
|
+
unit: "hour"
|
49773
|
+
});
|
49774
|
+
}
|
49775
|
+
return lightFormatters_default.H(date, token);
|
49776
|
+
},
|
49777
|
+
K: function(date, token, localize2) {
|
49778
|
+
var hours = date.getUTCHours() % 12;
|
49779
|
+
if (token === "Ko") {
|
49780
|
+
return localize2.ordinalNumber(hours, {
|
49781
|
+
unit: "hour"
|
49782
|
+
});
|
49783
|
+
}
|
49784
|
+
return addLeadingZeros(hours, token.length);
|
49785
|
+
},
|
49786
|
+
k: function(date, token, localize2) {
|
49787
|
+
var hours = date.getUTCHours();
|
49788
|
+
if (hours === 0)
|
49789
|
+
hours = 24;
|
49790
|
+
if (token === "ko") {
|
49791
|
+
return localize2.ordinalNumber(hours, {
|
49792
|
+
unit: "hour"
|
49793
|
+
});
|
49794
|
+
}
|
49795
|
+
return addLeadingZeros(hours, token.length);
|
49796
|
+
},
|
49797
|
+
m: function(date, token, localize2) {
|
49798
|
+
if (token === "mo") {
|
49799
|
+
return localize2.ordinalNumber(date.getUTCMinutes(), {
|
49800
|
+
unit: "minute"
|
49801
|
+
});
|
49802
|
+
}
|
49803
|
+
return lightFormatters_default.m(date, token);
|
49804
|
+
},
|
49805
|
+
s: function(date, token, localize2) {
|
49806
|
+
if (token === "so") {
|
49807
|
+
return localize2.ordinalNumber(date.getUTCSeconds(), {
|
49808
|
+
unit: "second"
|
49809
|
+
});
|
49810
|
+
}
|
49811
|
+
return lightFormatters_default.s(date, token);
|
49812
|
+
},
|
49813
|
+
S: function(date, token) {
|
49814
|
+
return lightFormatters_default.S(date, token);
|
49815
|
+
},
|
49816
|
+
X: function(date, token, _localize, options) {
|
49817
|
+
var originalDate = options._originalDate || date;
|
49818
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
49819
|
+
if (timezoneOffset === 0) {
|
49820
|
+
return "Z";
|
49821
|
+
}
|
49822
|
+
switch (token) {
|
49823
|
+
case "X":
|
49824
|
+
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
49825
|
+
case "XXXX":
|
49826
|
+
case "XX":
|
49827
|
+
return formatTimezone(timezoneOffset);
|
49828
|
+
case "XXXXX":
|
49829
|
+
case "XXX":
|
49830
|
+
default:
|
49831
|
+
return formatTimezone(timezoneOffset, ":");
|
49832
|
+
}
|
49833
|
+
},
|
49834
|
+
x: function(date, token, _localize, options) {
|
49835
|
+
var originalDate = options._originalDate || date;
|
49836
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
49837
|
+
switch (token) {
|
49838
|
+
case "x":
|
49839
|
+
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
49840
|
+
case "xxxx":
|
49841
|
+
case "xx":
|
49842
|
+
return formatTimezone(timezoneOffset);
|
49843
|
+
case "xxxxx":
|
49844
|
+
case "xxx":
|
49845
|
+
default:
|
49846
|
+
return formatTimezone(timezoneOffset, ":");
|
49847
|
+
}
|
49848
|
+
},
|
49849
|
+
O: function(date, token, _localize, options) {
|
49850
|
+
var originalDate = options._originalDate || date;
|
49851
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
49852
|
+
switch (token) {
|
49853
|
+
case "O":
|
49854
|
+
case "OO":
|
49855
|
+
case "OOO":
|
49856
|
+
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
49857
|
+
case "OOOO":
|
49858
|
+
default:
|
49859
|
+
return "GMT" + formatTimezone(timezoneOffset, ":");
|
49860
|
+
}
|
49861
|
+
},
|
49862
|
+
z: function(date, token, _localize, options) {
|
49863
|
+
var originalDate = options._originalDate || date;
|
49864
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
49865
|
+
switch (token) {
|
49866
|
+
case "z":
|
49867
|
+
case "zz":
|
49868
|
+
case "zzz":
|
49869
|
+
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
49870
|
+
case "zzzz":
|
49871
|
+
default:
|
49872
|
+
return "GMT" + formatTimezone(timezoneOffset, ":");
|
49873
|
+
}
|
49874
|
+
},
|
49875
|
+
t: function(date, token, _localize, options) {
|
49876
|
+
var originalDate = options._originalDate || date;
|
49877
|
+
var timestamp = Math.floor(originalDate.getTime() / 1e3);
|
49878
|
+
return addLeadingZeros(timestamp, token.length);
|
49879
|
+
},
|
49880
|
+
T: function(date, token, _localize, options) {
|
49881
|
+
var originalDate = options._originalDate || date;
|
49882
|
+
var timestamp = originalDate.getTime();
|
49883
|
+
return addLeadingZeros(timestamp, token.length);
|
49884
|
+
}
|
49885
|
+
};
|
49886
|
+
function formatTimezoneShort(offset, dirtyDelimiter) {
|
49887
|
+
var sign5 = offset > 0 ? "-" : "+";
|
49888
|
+
var absOffset = Math.abs(offset);
|
49889
|
+
var hours = Math.floor(absOffset / 60);
|
49890
|
+
var minutes = absOffset % 60;
|
49891
|
+
if (minutes === 0) {
|
49892
|
+
return sign5 + String(hours);
|
49893
|
+
}
|
49894
|
+
var delimiter = dirtyDelimiter || "";
|
49895
|
+
return sign5 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
49896
|
+
}
|
49897
|
+
__name(formatTimezoneShort, "formatTimezoneShort");
|
49898
|
+
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
|
49899
|
+
if (offset % 60 === 0) {
|
49900
|
+
var sign5 = offset > 0 ? "-" : "+";
|
49901
|
+
return sign5 + addLeadingZeros(Math.abs(offset) / 60, 2);
|
49902
|
+
}
|
49903
|
+
return formatTimezone(offset, dirtyDelimiter);
|
49904
|
+
}
|
49905
|
+
__name(formatTimezoneWithOptionalMinutes, "formatTimezoneWithOptionalMinutes");
|
49906
|
+
function formatTimezone(offset, dirtyDelimiter) {
|
49907
|
+
var delimiter = dirtyDelimiter || "";
|
49908
|
+
var sign5 = offset > 0 ? "-" : "+";
|
49909
|
+
var absOffset = Math.abs(offset);
|
49910
|
+
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
|
49911
|
+
var minutes = addLeadingZeros(absOffset % 60, 2);
|
49912
|
+
return sign5 + hours + delimiter + minutes;
|
49913
|
+
}
|
49914
|
+
__name(formatTimezone, "formatTimezone");
|
49915
|
+
var formatters_default = formatters2;
|
49916
|
+
|
49917
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/format/longFormatters/index.js
|
49918
|
+
function dateLongFormatter(pattern, formatLong2) {
|
49919
|
+
switch (pattern) {
|
49920
|
+
case "P":
|
49921
|
+
return formatLong2.date({
|
49922
|
+
width: "short"
|
49923
|
+
});
|
49924
|
+
case "PP":
|
49925
|
+
return formatLong2.date({
|
49926
|
+
width: "medium"
|
49927
|
+
});
|
49928
|
+
case "PPP":
|
49929
|
+
return formatLong2.date({
|
49930
|
+
width: "long"
|
49931
|
+
});
|
49932
|
+
case "PPPP":
|
49933
|
+
default:
|
49934
|
+
return formatLong2.date({
|
49935
|
+
width: "full"
|
49936
|
+
});
|
49937
|
+
}
|
49938
|
+
}
|
49939
|
+
__name(dateLongFormatter, "dateLongFormatter");
|
49940
|
+
function timeLongFormatter(pattern, formatLong2) {
|
49941
|
+
switch (pattern) {
|
49942
|
+
case "p":
|
49943
|
+
return formatLong2.time({
|
49944
|
+
width: "short"
|
49945
|
+
});
|
49946
|
+
case "pp":
|
49947
|
+
return formatLong2.time({
|
49948
|
+
width: "medium"
|
49949
|
+
});
|
49950
|
+
case "ppp":
|
49951
|
+
return formatLong2.time({
|
49952
|
+
width: "long"
|
49953
|
+
});
|
49954
|
+
case "pppp":
|
49955
|
+
default:
|
49956
|
+
return formatLong2.time({
|
49957
|
+
width: "full"
|
49958
|
+
});
|
49959
|
+
}
|
49960
|
+
}
|
49961
|
+
__name(timeLongFormatter, "timeLongFormatter");
|
49962
|
+
function dateTimeLongFormatter(pattern, formatLong2) {
|
49963
|
+
var matchResult = pattern.match(/(P+)(p+)?/) || [];
|
49964
|
+
var datePattern = matchResult[1];
|
49965
|
+
var timePattern = matchResult[2];
|
49966
|
+
if (!timePattern) {
|
49967
|
+
return dateLongFormatter(pattern, formatLong2);
|
49968
|
+
}
|
49969
|
+
var dateTimeFormat;
|
49970
|
+
switch (datePattern) {
|
49971
|
+
case "P":
|
49972
|
+
dateTimeFormat = formatLong2.dateTime({
|
49973
|
+
width: "short"
|
49974
|
+
});
|
49975
|
+
break;
|
49976
|
+
case "PP":
|
49977
|
+
dateTimeFormat = formatLong2.dateTime({
|
49978
|
+
width: "medium"
|
49979
|
+
});
|
49980
|
+
break;
|
49981
|
+
case "PPP":
|
49982
|
+
dateTimeFormat = formatLong2.dateTime({
|
49983
|
+
width: "long"
|
49984
|
+
});
|
49985
|
+
break;
|
49986
|
+
case "PPPP":
|
49987
|
+
default:
|
49988
|
+
dateTimeFormat = formatLong2.dateTime({
|
49989
|
+
width: "full"
|
49990
|
+
});
|
49991
|
+
break;
|
49992
|
+
}
|
49993
|
+
return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
|
49994
|
+
}
|
49995
|
+
__name(dateTimeLongFormatter, "dateTimeLongFormatter");
|
49996
|
+
var longFormatters = {
|
49997
|
+
p: timeLongFormatter,
|
49998
|
+
P: dateTimeLongFormatter
|
49999
|
+
};
|
50000
|
+
var longFormatters_default = longFormatters;
|
50001
|
+
|
50002
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/protectedTokens/index.js
|
50003
|
+
var protectedDayOfYearTokens = ["D", "DD"];
|
50004
|
+
var protectedWeekYearTokens = ["YY", "YYYY"];
|
50005
|
+
function isProtectedDayOfYearToken(token) {
|
50006
|
+
return protectedDayOfYearTokens.indexOf(token) !== -1;
|
50007
|
+
}
|
50008
|
+
__name(isProtectedDayOfYearToken, "isProtectedDayOfYearToken");
|
50009
|
+
function isProtectedWeekYearToken(token) {
|
50010
|
+
return protectedWeekYearTokens.indexOf(token) !== -1;
|
50011
|
+
}
|
50012
|
+
__name(isProtectedWeekYearToken, "isProtectedWeekYearToken");
|
50013
|
+
function throwProtectedError(token, format2, input) {
|
50014
|
+
if (token === "YYYY") {
|
50015
|
+
throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
|
50016
|
+
} else if (token === "YY") {
|
50017
|
+
throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
|
50018
|
+
} else if (token === "D") {
|
50019
|
+
throw new RangeError("Use `d` instead of `D` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
|
50020
|
+
} else if (token === "DD") {
|
50021
|
+
throw new RangeError("Use `dd` instead of `DD` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
|
50022
|
+
}
|
50023
|
+
}
|
50024
|
+
__name(throwProtectedError, "throwProtectedError");
|
50025
|
+
|
50026
|
+
// ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/format/index.js
|
50027
|
+
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
50028
|
+
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
50029
|
+
var escapedStringRegExp = /^'([^]*?)'?$/;
|
50030
|
+
var doubleQuoteRegExp = /''/g;
|
50031
|
+
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
50032
|
+
function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
|
50033
|
+
requiredArgs(2, arguments);
|
50034
|
+
var formatStr = String(dirtyFormatStr);
|
50035
|
+
var options = dirtyOptions || {};
|
50036
|
+
var locale2 = options.locale || en_US_default;
|
50037
|
+
var localeFirstWeekContainsDate = locale2.options && locale2.options.firstWeekContainsDate;
|
50038
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
50039
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
|
50040
|
+
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
50041
|
+
throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
|
50042
|
+
}
|
50043
|
+
var localeWeekStartsOn = locale2.options && locale2.options.weekStartsOn;
|
50044
|
+
var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
|
50045
|
+
var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);
|
50046
|
+
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
50047
|
+
throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
|
50048
|
+
}
|
50049
|
+
if (!locale2.localize) {
|
50050
|
+
throw new RangeError("locale must contain localize property");
|
50051
|
+
}
|
50052
|
+
if (!locale2.formatLong) {
|
50053
|
+
throw new RangeError("locale must contain formatLong property");
|
50054
|
+
}
|
50055
|
+
var originalDate = toDate(dirtyDate);
|
50056
|
+
if (!isValid(originalDate)) {
|
50057
|
+
throw new RangeError("Invalid time value");
|
50058
|
+
}
|
50059
|
+
var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
|
50060
|
+
var utcDate = subMilliseconds(originalDate, timezoneOffset);
|
50061
|
+
var formatterOptions = {
|
50062
|
+
firstWeekContainsDate,
|
50063
|
+
weekStartsOn,
|
50064
|
+
locale: locale2,
|
50065
|
+
_originalDate: originalDate
|
50066
|
+
};
|
50067
|
+
var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
|
50068
|
+
var firstCharacter = substring[0];
|
50069
|
+
if (firstCharacter === "p" || firstCharacter === "P") {
|
50070
|
+
var longFormatter = longFormatters_default[firstCharacter];
|
50071
|
+
return longFormatter(substring, locale2.formatLong, formatterOptions);
|
50072
|
+
}
|
50073
|
+
return substring;
|
50074
|
+
}).join("").match(formattingTokensRegExp).map(function(substring) {
|
50075
|
+
if (substring === "''") {
|
50076
|
+
return "'";
|
50077
|
+
}
|
50078
|
+
var firstCharacter = substring[0];
|
50079
|
+
if (firstCharacter === "'") {
|
50080
|
+
return cleanEscapedString(substring);
|
50081
|
+
}
|
50082
|
+
var formatter = formatters_default[firstCharacter];
|
50083
|
+
if (formatter) {
|
50084
|
+
if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
|
50085
|
+
throwProtectedError(substring, dirtyFormatStr, dirtyDate);
|
50086
|
+
}
|
50087
|
+
if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
|
50088
|
+
throwProtectedError(substring, dirtyFormatStr, dirtyDate);
|
50089
|
+
}
|
50090
|
+
return formatter(utcDate, substring, locale2.localize, formatterOptions);
|
50091
|
+
}
|
50092
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
50093
|
+
throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
|
50094
|
+
}
|
50095
|
+
return substring;
|
50096
|
+
}).join("");
|
50097
|
+
return result;
|
50098
|
+
}
|
50099
|
+
__name(format, "format");
|
50100
|
+
function cleanEscapedString(input) {
|
50101
|
+
return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
|
50102
|
+
}
|
50103
|
+
__name(cleanEscapedString, "cleanEscapedString");
|
50104
|
+
|
48594
50105
|
// src/wallet/verify.ts
|
50106
|
+
var transformErrorMessage = /* @__PURE__ */ __name((error, credential) => {
|
50107
|
+
if (error.startsWith("expiration")) {
|
50108
|
+
return credential.expirationDate ? `Invalid \u2022 Expired ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Invalid \u2022 Expired";
|
50109
|
+
}
|
50110
|
+
return error;
|
50111
|
+
}, "transformErrorMessage");
|
50112
|
+
var transformCheckMessage = /* @__PURE__ */ __name((check, credential) => {
|
50113
|
+
return {
|
50114
|
+
proof: "Valid",
|
50115
|
+
expiration: credential.expirationDate ? `Valid \u2022 Expires ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Valid \u2022 Does Not Expire"
|
50116
|
+
}[check] || check;
|
50117
|
+
}, "transformCheckMessage");
|
48595
50118
|
var verifyCredential3 = /* @__PURE__ */ __name((wallet) => {
|
48596
50119
|
return (credential) => __async(void 0, null, function* () {
|
48597
50120
|
const rawVerificationCheck = yield wallet.pluginMethods.verifyCredential(credential);
|
@@ -48600,7 +50123,7 @@ var verifyCredential3 = /* @__PURE__ */ __name((wallet) => {
|
|
48600
50123
|
verificationItems.push({
|
48601
50124
|
status: VerificationStatus.Failed,
|
48602
50125
|
check: "hmm",
|
48603
|
-
details: error
|
50126
|
+
details: transformErrorMessage(error, credential)
|
48604
50127
|
});
|
48605
50128
|
});
|
48606
50129
|
rawVerificationCheck.warnings.forEach((warning) => {
|
@@ -48614,7 +50137,7 @@ var verifyCredential3 = /* @__PURE__ */ __name((wallet) => {
|
|
48614
50137
|
verificationItems.push({
|
48615
50138
|
status: VerificationStatus.Success,
|
48616
50139
|
check,
|
48617
|
-
message: check
|
50140
|
+
message: transformCheckMessage(check, credential)
|
48618
50141
|
});
|
48619
50142
|
});
|
48620
50143
|
return verificationItems;
|
@@ -48639,9 +50162,13 @@ var defaultCeramicIDXArgs = {
|
|
48639
50162
|
};
|
48640
50163
|
|
48641
50164
|
// src/wallet/init.ts
|
48642
|
-
var
|
50165
|
+
var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, ..._1], function* (key2, {
|
50166
|
+
ceramicIdx = defaultCeramicIDXArgs,
|
50167
|
+
didkit,
|
50168
|
+
defaultContents = []
|
50169
|
+
} = {}) {
|
48643
50170
|
yield didkit_default(didkit);
|
48644
|
-
const didkeyWallet = yield (yield generateWallet(defaultContents)).addPlugin(
|
50171
|
+
const didkeyWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getDidKeyPlugin(key2));
|
48645
50172
|
const didkeyAndVCWallet = yield didkeyWallet.addPlugin(yield getVCPlugin(didkeyWallet));
|
48646
50173
|
const idxWallet = yield didkeyAndVCWallet.addPlugin(yield getIDXPlugin(didkeyAndVCWallet, ceramicIdx));
|
48647
50174
|
const wallet = yield idxWallet.addPlugin(ExpirationPlugin(idxWallet));
|
@@ -48666,14 +50193,8 @@ var createWallet = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, ..
|
|
48666
50193
|
readFromCeramic: wallet.pluginMethods.readContentFromCeramic,
|
48667
50194
|
getTestVc: wallet.pluginMethods.getTestVc
|
48668
50195
|
};
|
48669
|
-
}), "createWallet");
|
48670
|
-
var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, ..._1], function* (key2, { ceramicIdx = defaultCeramicIDXArgs, didkit } = {}) {
|
48671
|
-
yield didkit_default(didkit);
|
48672
|
-
const didDocuments = yield DidKeyPlugin.pluginConstants.generateContentFromSeed(toUint8Array(key2.padStart(64, "0")));
|
48673
|
-
return createWallet(didDocuments, { ceramicIdx, didkit });
|
48674
50196
|
}), "walletFromKey");
|
48675
50197
|
export {
|
48676
|
-
createWallet,
|
48677
50198
|
walletFromKey
|
48678
50199
|
};
|
48679
50200
|
/*!
|