mp-front-cli 0.0.38 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-encoder-04bc877a.js +23877 -0
- package/dist/custom-header-89182d9e.js +881 -0
- package/dist/{custom-validator-9ec2d3d0.js → custom-validator-3bb58ece.js} +512 -512
- package/dist/mp-front-cli-all.es.js +15 -14
- package/dist/mp-front-cli-core.es.js +20 -19
- package/dist/mp-front-cli-encoder.es.js +4 -3
- package/dist/mp-front-cli-header.es.js +6 -5
- package/dist/mp-front-cli-logger.es.js +53 -2
- package/dist/mp-front-cli-validator.es.js +5 -4
- package/package.json +2 -3
- package/dist/custom-encoder-50b5eb15.js +0 -43094
- package/dist/custom-header-ef367c86.js +0 -882
- package/dist/custom-logger-a671be8b.js +0 -171
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
1
|
+
import { g as ft, C as zr } from "./custom-encoder-04bc877a.js";
|
|
2
|
+
import { t as qr } from "./index-df4e0539.js";
|
|
3
|
+
import { CustomLogger as Xr } from "./mp-front-cli-logger.es.js";
|
|
4
|
+
const Yr = {
|
|
5
5
|
type: "logger",
|
|
6
6
|
log(t) {
|
|
7
7
|
this.output("log", t);
|
|
@@ -23,7 +23,7 @@ class xe {
|
|
|
23
23
|
}
|
|
24
24
|
init(e) {
|
|
25
25
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
26
|
-
this.prefix = r.prefix || "i18next:", this.logger = e ||
|
|
26
|
+
this.prefix = r.prefix || "i18next:", this.logger = e || Yr, this.options = r, this.debug = r.debug;
|
|
27
27
|
}
|
|
28
28
|
log() {
|
|
29
29
|
for (var e = arguments.length, r = new Array(e), n = 0; n < e; n++)
|
|
@@ -94,15 +94,15 @@ function he() {
|
|
|
94
94
|
});
|
|
95
95
|
return r.resolve = t, r.reject = e, r;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function Kt(t) {
|
|
98
98
|
return t == null ? "" : "" + t;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function Zr(t, e, r) {
|
|
101
101
|
t.forEach((n) => {
|
|
102
102
|
e[n] && (r[n] = e[n]);
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function ht(t, e, r) {
|
|
106
106
|
function n(i) {
|
|
107
107
|
return i && i.indexOf("###") > -1 ? i.replace(/###/g, ".") : i;
|
|
108
108
|
}
|
|
@@ -121,41 +121,41 @@ function pt(t, e, r) {
|
|
|
121
121
|
k: n(s.shift())
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Rt(t, e, r) {
|
|
125
125
|
const {
|
|
126
126
|
obj: n,
|
|
127
127
|
k: a
|
|
128
|
-
} =
|
|
128
|
+
} = ht(t, e, Object);
|
|
129
129
|
n[a] = r;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Qr(t, e, r, n) {
|
|
132
132
|
const {
|
|
133
133
|
obj: a,
|
|
134
134
|
k: s
|
|
135
|
-
} =
|
|
135
|
+
} = ht(t, e, Object);
|
|
136
136
|
a[s] = a[s] || [], n && (a[s] = a[s].concat(r)), n || a[s].push(r);
|
|
137
137
|
}
|
|
138
138
|
function Ce(t, e) {
|
|
139
139
|
const {
|
|
140
140
|
obj: r,
|
|
141
141
|
k: n
|
|
142
|
-
} =
|
|
142
|
+
} = ht(t, e);
|
|
143
143
|
if (r)
|
|
144
144
|
return r[n];
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function jr(t, e, r) {
|
|
147
147
|
const n = Ce(t, r);
|
|
148
148
|
return n !== void 0 ? n : Ce(e, r);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function Qt(t, e, r) {
|
|
151
151
|
for (const n in e)
|
|
152
|
-
n !== "__proto__" && n !== "constructor" && (n in t ? typeof t[n] == "string" || t[n] instanceof String || typeof e[n] == "string" || e[n] instanceof String ? r && (t[n] = e[n]) :
|
|
152
|
+
n !== "__proto__" && n !== "constructor" && (n in t ? typeof t[n] == "string" || t[n] instanceof String || typeof e[n] == "string" || e[n] instanceof String ? r && (t[n] = e[n]) : Qt(t[n], e[n], r) : t[n] = e[n]);
|
|
153
153
|
return t;
|
|
154
154
|
}
|
|
155
155
|
function oe(t) {
|
|
156
156
|
return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
157
157
|
}
|
|
158
|
-
var
|
|
158
|
+
var en = {
|
|
159
159
|
"&": "&",
|
|
160
160
|
"<": "<",
|
|
161
161
|
">": ">",
|
|
@@ -163,13 +163,13 @@ var tn = {
|
|
|
163
163
|
"'": "'",
|
|
164
164
|
"/": "/"
|
|
165
165
|
};
|
|
166
|
-
function
|
|
167
|
-
return typeof t == "string" ? t.replace(/[&<>"'\/]/g, (e) =>
|
|
166
|
+
function tn(t) {
|
|
167
|
+
return typeof t == "string" ? t.replace(/[&<>"'\/]/g, (e) => en[e]) : t;
|
|
168
168
|
}
|
|
169
|
-
const
|
|
170
|
-
function
|
|
169
|
+
const rn = [" ", ",", "?", "!", ";"];
|
|
170
|
+
function nn(t, e, r) {
|
|
171
171
|
e = e || "", r = r || "";
|
|
172
|
-
const n =
|
|
172
|
+
const n = rn.filter((i) => e.indexOf(i) < 0 && r.indexOf(i) < 0);
|
|
173
173
|
if (n.length === 0)
|
|
174
174
|
return !0;
|
|
175
175
|
const a = new RegExp(`(${n.map((i) => i === "?" ? "\\?" : i).join("|")})`);
|
|
@@ -215,7 +215,7 @@ function _e(t, e) {
|
|
|
215
215
|
function Pe(t) {
|
|
216
216
|
return t && t.indexOf("_") > 0 ? t.replace("_", "-") : t;
|
|
217
217
|
}
|
|
218
|
-
class
|
|
218
|
+
class Ot extends Ue {
|
|
219
219
|
constructor(e) {
|
|
220
220
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
221
221
|
ns: ["translation"],
|
|
@@ -244,7 +244,7 @@ class Tt extends Ue {
|
|
|
244
244
|
};
|
|
245
245
|
const i = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator;
|
|
246
246
|
let o = [e, r];
|
|
247
|
-
n && (o = o.concat(i ? n.split(i) : n)), e.indexOf(".") > -1 && (o = e.split("."), a = r, r = o[1]), this.addNamespaces(r),
|
|
247
|
+
n && (o = o.concat(i ? n.split(i) : n)), e.indexOf(".") > -1 && (o = e.split("."), a = r, r = o[1]), this.addNamespaces(r), Rt(this.data, o, a), s.silent || this.emit("added", e, r, n, a);
|
|
248
248
|
}
|
|
249
249
|
addResources(e, r, n) {
|
|
250
250
|
let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
|
|
@@ -262,10 +262,10 @@ class Tt extends Ue {
|
|
|
262
262
|
}, o = [e, r];
|
|
263
263
|
e.indexOf(".") > -1 && (o = e.split("."), a = n, n = r, r = o[1]), this.addNamespaces(r);
|
|
264
264
|
let c = Ce(this.data, o) || {};
|
|
265
|
-
a ?
|
|
265
|
+
a ? Qt(c, n, s) : c = {
|
|
266
266
|
...c,
|
|
267
267
|
...n
|
|
268
|
-
},
|
|
268
|
+
}, Rt(this.data, o, c), i.silent || this.emit("added", e, r, n);
|
|
269
269
|
}
|
|
270
270
|
removeResourceBundle(e, r) {
|
|
271
271
|
this.hasResourceBundle(e, r) && delete this.data[e][r], this.removeNamespaces(r), this.emit("removed", e, r);
|
|
@@ -289,7 +289,7 @@ class Tt extends Ue {
|
|
|
289
289
|
return this.data;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
var
|
|
292
|
+
var jt = {
|
|
293
293
|
processors: {},
|
|
294
294
|
addPostProcessor(t) {
|
|
295
295
|
this.processors[t.name] = t;
|
|
@@ -300,11 +300,11 @@ var er = {
|
|
|
300
300
|
}), e;
|
|
301
301
|
}
|
|
302
302
|
};
|
|
303
|
-
const
|
|
303
|
+
const Tt = {};
|
|
304
304
|
class He extends Ue {
|
|
305
305
|
constructor(e) {
|
|
306
306
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
307
|
-
super(),
|
|
307
|
+
super(), Zr(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = r, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = Z.create("translator");
|
|
308
308
|
}
|
|
309
309
|
changeLanguage(e) {
|
|
310
310
|
e && (this.language = e);
|
|
@@ -323,7 +323,7 @@ class He extends Ue {
|
|
|
323
323
|
n === void 0 && (n = ":");
|
|
324
324
|
const a = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator;
|
|
325
325
|
let s = r.ns || this.options.defaultNS || [];
|
|
326
|
-
const i = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !r.keySeparator && !this.options.userDefinedNsSeparator && !r.nsSeparator && !
|
|
326
|
+
const i = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !r.keySeparator && !this.options.userDefinedNsSeparator && !r.nsSeparator && !nn(e, n, a);
|
|
327
327
|
if (i && !o) {
|
|
328
328
|
const c = e.match(this.interpolator.nestingRegexp);
|
|
329
329
|
if (c && c.length > 0)
|
|
@@ -403,7 +403,7 @@ class He extends Ue {
|
|
|
403
403
|
ordinal: !1
|
|
404
404
|
}) : "", q = _ && !r.ordinal && r.count === 0 && this.pluralResolver.shouldUseIntlApi(), Y = q && r[`defaultValue${this.options.pluralSeparator}zero`] || r[`defaultValue${R}`] || r[`defaultValue${F}`] || r.defaultValue;
|
|
405
405
|
!this.isValidLookup(d) && A && (m = !0, d = Y), this.isValidLookup(d) || (E = !0, d = i);
|
|
406
|
-
const
|
|
406
|
+
const Gr = (r.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && E ? void 0 : d, le = A && Y !== d && this.options.updateMissing;
|
|
407
407
|
if (E || m || le) {
|
|
408
408
|
if (this.logger.log(le ? "updateKey" : "missingKey", u, c, i, le ? Y : d), s) {
|
|
409
409
|
const z = this.resolve(i, {
|
|
@@ -419,16 +419,16 @@ class He extends Ue {
|
|
|
419
419
|
de.push(we[z]);
|
|
420
420
|
else
|
|
421
421
|
this.options.saveMissingTo === "all" ? de = this.languageUtils.toResolveHierarchy(r.lng || this.language) : de.push(r.lng || this.language);
|
|
422
|
-
const
|
|
423
|
-
const
|
|
424
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(z, c, se,
|
|
422
|
+
const Pt = (z, se, fe) => {
|
|
423
|
+
const Ht = A && fe !== d ? fe : Gr;
|
|
424
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(z, c, se, Ht, le, r) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(z, c, se, Ht, le, r), this.emit("missingKey", z, c, se, d);
|
|
425
425
|
};
|
|
426
426
|
this.options.saveMissing && (this.options.saveMissingPlurals && _ ? de.forEach((z) => {
|
|
427
427
|
const se = this.pluralResolver.getSuffixes(z, r);
|
|
428
428
|
q && r[`defaultValue${this.options.pluralSeparator}zero`] && se.indexOf(`${this.options.pluralSeparator}zero`) < 0 && se.push(`${this.options.pluralSeparator}zero`), se.forEach((fe) => {
|
|
429
|
-
|
|
429
|
+
Pt([z], i + fe, r[`defaultValue${fe}`] || Y);
|
|
430
430
|
});
|
|
431
|
-
}) :
|
|
431
|
+
}) : Pt(de, i, Y));
|
|
432
432
|
}
|
|
433
433
|
d = this.extendTranslation(d, e, r, f, n), E && d === i && this.options.appendNamespaceToMissingKey && (d = `${c}:${i}`), (E || m) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? d = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${c}:${i}` : i, m ? d : void 0) : d = this.options.parseMissingKeyHandler(d));
|
|
434
434
|
}
|
|
@@ -472,7 +472,7 @@ class He extends Ue {
|
|
|
472
472
|
}, n)), n.interpolation && this.interpolator.reset();
|
|
473
473
|
}
|
|
474
474
|
const o = n.postProcess || this.options.postProcess, c = typeof o == "string" ? [o] : o;
|
|
475
|
-
return e != null && c && c.length && n.applyPostProcessor !== !1 && (e =
|
|
475
|
+
return e != null && c && c.length && n.applyPostProcessor !== !1 && (e = jt.handle(c, e, r, this.options && this.options.postProcessPassResolved ? {
|
|
476
476
|
i18nResolved: {
|
|
477
477
|
...a,
|
|
478
478
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -491,7 +491,7 @@ class He extends Ue {
|
|
|
491
491
|
this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
|
|
492
492
|
const d = r.count !== void 0 && typeof r.count != "string", p = d && !r.ordinal && r.count === 0 && this.pluralResolver.shouldUseIntlApi(), h = r.context !== void 0 && (typeof r.context == "string" || typeof r.context == "number") && r.context !== "", g = r.lngs ? r.lngs : this.languageUtils.toResolveHierarchy(r.lng || this.language, r.fallbackLng);
|
|
493
493
|
f.forEach((S) => {
|
|
494
|
-
this.isValidLookup(n) || (o = S, !
|
|
494
|
+
this.isValidLookup(n) || (o = S, !Tt[`${g[0]}-${S}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(o) && (Tt[`${g[0]}-${S}`] = !0, this.logger.warn(`key "${a}" for languages "${g.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), g.forEach((C) => {
|
|
495
495
|
if (this.isValidLookup(n))
|
|
496
496
|
return;
|
|
497
497
|
i = C;
|
|
@@ -551,10 +551,10 @@ class He extends Ue {
|
|
|
551
551
|
return !1;
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function Ge(t) {
|
|
555
555
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
556
556
|
}
|
|
557
|
-
class
|
|
557
|
+
class It {
|
|
558
558
|
constructor(e) {
|
|
559
559
|
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = Z.create("languageUtils");
|
|
560
560
|
}
|
|
@@ -574,7 +574,7 @@ class Wt {
|
|
|
574
574
|
if (typeof e == "string" && e.indexOf("-") > -1) {
|
|
575
575
|
const r = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
|
|
576
576
|
let n = e.split("-");
|
|
577
|
-
return this.options.lowerCaseLng ? n = n.map((a) => a.toLowerCase()) : n.length === 2 ? (n[0] = n[0].toLowerCase(), n[1] = n[1].toUpperCase(), r.indexOf(n[1].toLowerCase()) > -1 && (n[1] =
|
|
577
|
+
return this.options.lowerCaseLng ? n = n.map((a) => a.toLowerCase()) : n.length === 2 ? (n[0] = n[0].toLowerCase(), n[1] = n[1].toUpperCase(), r.indexOf(n[1].toLowerCase()) > -1 && (n[1] = Ge(n[1].toLowerCase()))) : n.length === 3 && (n[0] = n[0].toLowerCase(), n[1].length === 2 && (n[1] = n[1].toUpperCase()), n[0] !== "sgn" && n[2].length === 2 && (n[2] = n[2].toUpperCase()), r.indexOf(n[1].toLowerCase()) > -1 && (n[1] = Ge(n[1].toLowerCase())), r.indexOf(n[2].toLowerCase()) > -1 && (n[2] = Ge(n[2].toLowerCase()))), n.join("-");
|
|
578
578
|
}
|
|
579
579
|
return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
|
|
580
580
|
}
|
|
@@ -623,7 +623,7 @@ class Wt {
|
|
|
623
623
|
}), a;
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
let
|
|
626
|
+
let an = [{
|
|
627
627
|
lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"],
|
|
628
628
|
nr: [1, 2],
|
|
629
629
|
fc: 1
|
|
@@ -715,7 +715,7 @@ let sn = [{
|
|
|
715
715
|
lngs: ["he", "iw"],
|
|
716
716
|
nr: [1, 2, 20, 21],
|
|
717
717
|
fc: 22
|
|
718
|
-
}],
|
|
718
|
+
}], sn = {
|
|
719
719
|
1: function(t) {
|
|
720
720
|
return +(t > 1);
|
|
721
721
|
},
|
|
@@ -783,7 +783,7 @@ let sn = [{
|
|
|
783
783
|
return t == 1 ? 0 : t == 2 ? 1 : (t < 0 || t > 10) && t % 10 == 0 ? 2 : 3;
|
|
784
784
|
}
|
|
785
785
|
};
|
|
786
|
-
const
|
|
786
|
+
const on = ["v1", "v2", "v3"], cn = ["v4"], Wt = {
|
|
787
787
|
zero: 0,
|
|
788
788
|
one: 1,
|
|
789
789
|
two: 2,
|
|
@@ -791,21 +791,21 @@ const cn = ["v1", "v2", "v3"], un = ["v4"], Ut = {
|
|
|
791
791
|
many: 4,
|
|
792
792
|
other: 5
|
|
793
793
|
};
|
|
794
|
-
function
|
|
794
|
+
function un() {
|
|
795
795
|
const t = {};
|
|
796
|
-
return
|
|
796
|
+
return an.forEach((e) => {
|
|
797
797
|
e.lngs.forEach((r) => {
|
|
798
798
|
t[r] = {
|
|
799
799
|
numbers: e.nr,
|
|
800
|
-
plurals:
|
|
800
|
+
plurals: sn[e.fc]
|
|
801
801
|
};
|
|
802
802
|
});
|
|
803
803
|
}), t;
|
|
804
804
|
}
|
|
805
|
-
class
|
|
805
|
+
class ln {
|
|
806
806
|
constructor(e) {
|
|
807
807
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
808
|
-
this.languageUtils = e, this.options = r, this.logger = Z.create("pluralResolver"), (!this.options.compatibilityJSON ||
|
|
808
|
+
this.languageUtils = e, this.options = r, this.logger = Z.create("pluralResolver"), (!this.options.compatibilityJSON || cn.includes(this.options.compatibilityJSON)) && (typeof Intl > "u" || !Intl.PluralRules) && (this.options.compatibilityJSON = "v3", this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")), this.rules = un();
|
|
809
809
|
}
|
|
810
810
|
addRule(e, r) {
|
|
811
811
|
this.rules[e] = r;
|
|
@@ -834,7 +834,7 @@ class dn {
|
|
|
834
834
|
getSuffixes(e) {
|
|
835
835
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
836
836
|
const n = this.getRule(e, r);
|
|
837
|
-
return n ? this.shouldUseIntlApi() ? n.resolvedOptions().pluralCategories.sort((a, s) =>
|
|
837
|
+
return n ? this.shouldUseIntlApi() ? n.resolvedOptions().pluralCategories.sort((a, s) => Wt[a] - Wt[s]).map((a) => `${this.options.prepend}${r.ordinal ? `ordinal${this.options.prepend}` : ""}${a}`) : n.numbers.map((a) => this.getSuffix(e, a, r)) : [];
|
|
838
838
|
}
|
|
839
839
|
getSuffix(e, r) {
|
|
840
840
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
@@ -849,14 +849,14 @@ class dn {
|
|
|
849
849
|
return this.options.compatibilityJSON === "v1" ? a === 1 ? "" : typeof a == "number" ? `_plural_${a.toString()}` : s() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 ? s() : this.options.prepend && n.toString() ? this.options.prepend + n.toString() : n.toString();
|
|
850
850
|
}
|
|
851
851
|
shouldUseIntlApi() {
|
|
852
|
-
return !
|
|
852
|
+
return !on.includes(this.options.compatibilityJSON);
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
-
function
|
|
856
|
-
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, s =
|
|
855
|
+
function Ut(t, e, r) {
|
|
856
|
+
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, s = jr(t, e, r);
|
|
857
857
|
return !s && a && typeof r == "string" && (s = _e(t, r, n), s === void 0 && (s = _e(e, r, n))), s;
|
|
858
858
|
}
|
|
859
|
-
class
|
|
859
|
+
class dn {
|
|
860
860
|
constructor() {
|
|
861
861
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
862
862
|
this.logger = Z.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((r) => r), this.init(e);
|
|
@@ -867,7 +867,7 @@ class fn {
|
|
|
867
867
|
escapeValue: !0
|
|
868
868
|
});
|
|
869
869
|
const r = e.interpolation;
|
|
870
|
-
this.escape = r.escape !== void 0 ? r.escape :
|
|
870
|
+
this.escape = r.escape !== void 0 ? r.escape : tn, this.escapeValue = r.escapeValue !== void 0 ? r.escapeValue : !0, this.useRawValueToEscape = r.useRawValueToEscape !== void 0 ? r.useRawValueToEscape : !1, this.prefix = r.prefix ? oe(r.prefix) : r.prefixEscaped || "{{", this.suffix = r.suffix ? oe(r.suffix) : r.suffixEscaped || "}}", this.formatSeparator = r.formatSeparator ? r.formatSeparator : r.formatSeparator || ",", this.unescapePrefix = r.unescapeSuffix ? "" : r.unescapePrefix || "-", this.unescapeSuffix = this.unescapePrefix ? "" : r.unescapeSuffix || "", this.nestingPrefix = r.nestingPrefix ? oe(r.nestingPrefix) : r.nestingPrefixEscaped || oe("$t("), this.nestingSuffix = r.nestingSuffix ? oe(r.nestingSuffix) : r.nestingSuffixEscaped || oe(")"), this.nestingOptionsSeparator = r.nestingOptionsSeparator ? r.nestingOptionsSeparator : r.nestingOptionsSeparator || ",", this.maxReplaces = r.maxReplaces ? r.maxReplaces : 1e3, this.alwaysFormat = r.alwaysFormat !== void 0 ? r.alwaysFormat : !1, this.resetRegExp();
|
|
871
871
|
}
|
|
872
872
|
reset() {
|
|
873
873
|
this.options && this.init(this.options);
|
|
@@ -888,7 +888,7 @@ class fn {
|
|
|
888
888
|
}
|
|
889
889
|
const l = (h) => {
|
|
890
890
|
if (h.indexOf(this.formatSeparator) < 0) {
|
|
891
|
-
const v =
|
|
891
|
+
const v = Ut(r, c, h, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
892
892
|
return this.alwaysFormat ? this.format(v, void 0, n, {
|
|
893
893
|
...a,
|
|
894
894
|
...r,
|
|
@@ -896,7 +896,7 @@ class fn {
|
|
|
896
896
|
}) : v;
|
|
897
897
|
}
|
|
898
898
|
const g = h.split(this.formatSeparator), S = g.shift().trim(), C = g.join(this.formatSeparator).trim();
|
|
899
|
-
return this.format(
|
|
899
|
+
return this.format(Ut(r, c, S, this.options.keySeparator, this.options.ignoreJSONStructure), C, n, {
|
|
900
900
|
...a,
|
|
901
901
|
...r,
|
|
902
902
|
interpolationkey: S
|
|
@@ -925,7 +925,7 @@ class fn {
|
|
|
925
925
|
} else
|
|
926
926
|
this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`), i = "";
|
|
927
927
|
else
|
|
928
|
-
typeof i != "string" && !this.useRawValueToEscape && (i =
|
|
928
|
+
typeof i != "string" && !this.useRawValueToEscape && (i = Kt(i));
|
|
929
929
|
const S = h.safeValue(i);
|
|
930
930
|
if (e = e.replace(s[0], S), d ? (h.regex.lastIndex += i.length, h.regex.lastIndex -= s[0].length) : h.regex.lastIndex = 0, o++, o >= this.maxReplaces)
|
|
931
931
|
break;
|
|
@@ -965,7 +965,7 @@ class fn {
|
|
|
965
965
|
}
|
|
966
966
|
if (s = r(o.call(this, a[1].trim(), i), i), s && a[0] === e && typeof s != "string")
|
|
967
967
|
return s;
|
|
968
|
-
typeof s != "string" && (s =
|
|
968
|
+
typeof s != "string" && (s = Kt(s)), s || (this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`), s = ""), u && (s = c.reduce((l, f) => this.format(l, f, n.lng, {
|
|
969
969
|
...n,
|
|
970
970
|
interpolationkey: a[1].trim()
|
|
971
971
|
}), s.trim())), e = e.replace(a[0], s), this.regexp.lastIndex = 0;
|
|
@@ -973,7 +973,7 @@ class fn {
|
|
|
973
973
|
return e;
|
|
974
974
|
}
|
|
975
975
|
}
|
|
976
|
-
function
|
|
976
|
+
function fn(t) {
|
|
977
977
|
let e = t.toLowerCase().trim();
|
|
978
978
|
const r = {};
|
|
979
979
|
if (t.indexOf("(") > -1) {
|
|
@@ -1000,7 +1000,7 @@ function ce(t) {
|
|
|
1000
1000
|
return o || (o = t(Pe(a), s), e[i] = o), o(n);
|
|
1001
1001
|
};
|
|
1002
1002
|
}
|
|
1003
|
-
class
|
|
1003
|
+
class hn {
|
|
1004
1004
|
constructor() {
|
|
1005
1005
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1006
1006
|
this.logger = Z.create("formatter"), this.options = e, this.formats = {
|
|
@@ -1055,7 +1055,7 @@ class pn {
|
|
|
1055
1055
|
const {
|
|
1056
1056
|
formatName: u,
|
|
1057
1057
|
formatOptions: l
|
|
1058
|
-
} =
|
|
1058
|
+
} = fn(c);
|
|
1059
1059
|
if (this.formats[u]) {
|
|
1060
1060
|
let f = o;
|
|
1061
1061
|
try {
|
|
@@ -1075,10 +1075,10 @@ class pn {
|
|
|
1075
1075
|
}, e);
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function pn(t, e) {
|
|
1079
1079
|
t.pending[e] !== void 0 && (delete t.pending[e], t.pendingCount--);
|
|
1080
1080
|
}
|
|
1081
|
-
class
|
|
1081
|
+
class gn extends Ue {
|
|
1082
1082
|
constructor(e, r, n) {
|
|
1083
1083
|
let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
1084
1084
|
super(), this.backend = e, this.store = r, this.services = n, this.languageUtils = n.languageUtils, this.options = a, this.logger = Z.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = a.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = a.maxRetries >= 0 ? a.maxRetries : 5, this.retryTimeout = a.retryTimeout >= 1 ? a.retryTimeout : 350, this.state = {}, this.queue = [], this.backend && this.backend.init && this.backend.init(n, a.backend, a);
|
|
@@ -1109,7 +1109,7 @@ class mn extends Ue {
|
|
|
1109
1109
|
r && this.emit("failedLoading", s, i, r), n && this.store.addResourceBundle(s, i, n), this.state[e] = r ? -1 : 2;
|
|
1110
1110
|
const o = {};
|
|
1111
1111
|
this.queue.forEach((c) => {
|
|
1112
|
-
|
|
1112
|
+
Qr(c.loaded, [s], i), pn(c, e), r && c.errors.push(r), c.pendingCount === 0 && !c.done && (Object.keys(c.loaded).forEach((u) => {
|
|
1113
1113
|
o[u] || (o[u] = {});
|
|
1114
1114
|
const l = c.loaded[u];
|
|
1115
1115
|
l.length && l.forEach((f) => {
|
|
@@ -1212,7 +1212,7 @@ class mn extends Ue {
|
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
function
|
|
1215
|
+
function Lt() {
|
|
1216
1216
|
return {
|
|
1217
1217
|
debug: !1,
|
|
1218
1218
|
initImmediate: !0,
|
|
@@ -1271,12 +1271,12 @@ function Dt() {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
};
|
|
1273
1273
|
}
|
|
1274
|
-
function
|
|
1274
|
+
function Dt(t) {
|
|
1275
1275
|
return typeof t.ns == "string" && (t.ns = [t.ns]), typeof t.fallbackLng == "string" && (t.fallbackLng = [t.fallbackLng]), typeof t.fallbackNS == "string" && (t.fallbackNS = [t.fallbackNS]), t.supportedLngs && t.supportedLngs.indexOf("cimode") < 0 && (t.supportedLngs = t.supportedLngs.concat(["cimode"])), t;
|
|
1276
1276
|
}
|
|
1277
1277
|
function Se() {
|
|
1278
1278
|
}
|
|
1279
|
-
function
|
|
1279
|
+
function mn(t) {
|
|
1280
1280
|
Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach((r) => {
|
|
1281
1281
|
typeof t[r] == "function" && (t[r] = t[r].bind(t));
|
|
1282
1282
|
});
|
|
@@ -1284,9 +1284,9 @@ function yn(t) {
|
|
|
1284
1284
|
class pe extends Ue {
|
|
1285
1285
|
constructor() {
|
|
1286
1286
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = arguments.length > 1 ? arguments[1] : void 0;
|
|
1287
|
-
if (super(), this.options =
|
|
1287
|
+
if (super(), this.options = Dt(e), this.services = {}, this.logger = Z, this.modules = {
|
|
1288
1288
|
external: []
|
|
1289
|
-
},
|
|
1289
|
+
}, mn(this), r && !this.isInitialized && !e.isClone) {
|
|
1290
1290
|
if (!this.options.initImmediate)
|
|
1291
1291
|
return this.init(e, r), this;
|
|
1292
1292
|
setTimeout(() => {
|
|
@@ -1298,11 +1298,11 @@ class pe extends Ue {
|
|
|
1298
1298
|
var e = this;
|
|
1299
1299
|
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 ? arguments[1] : void 0;
|
|
1300
1300
|
typeof r == "function" && (n = r, r = {}), !r.defaultNS && r.defaultNS !== !1 && r.ns && (typeof r.ns == "string" ? r.defaultNS = r.ns : r.ns.indexOf("translation") < 0 && (r.defaultNS = r.ns[0]));
|
|
1301
|
-
const a =
|
|
1301
|
+
const a = Lt();
|
|
1302
1302
|
this.options = {
|
|
1303
1303
|
...a,
|
|
1304
1304
|
...this.options,
|
|
1305
|
-
...
|
|
1305
|
+
...Dt(r)
|
|
1306
1306
|
}, this.options.compatibilityAPI !== "v1" && (this.options.interpolation = {
|
|
1307
1307
|
...a.interpolation,
|
|
1308
1308
|
...this.options.interpolation
|
|
@@ -1313,17 +1313,17 @@ class pe extends Ue {
|
|
|
1313
1313
|
if (!this.options.isClone) {
|
|
1314
1314
|
this.modules.logger ? Z.init(s(this.modules.logger), this.options) : Z.init(null, this.options);
|
|
1315
1315
|
let l;
|
|
1316
|
-
this.modules.formatter ? l = this.modules.formatter : typeof Intl < "u" && (l =
|
|
1317
|
-
const f = new
|
|
1318
|
-
this.store = new
|
|
1316
|
+
this.modules.formatter ? l = this.modules.formatter : typeof Intl < "u" && (l = hn);
|
|
1317
|
+
const f = new It(this.options);
|
|
1318
|
+
this.store = new Ot(this.options.resources, this.options);
|
|
1319
1319
|
const d = this.services;
|
|
1320
|
-
d.logger = Z, d.resourceStore = this.store, d.languageUtils = f, d.pluralResolver = new
|
|
1320
|
+
d.logger = Z, d.resourceStore = this.store, d.languageUtils = f, d.pluralResolver = new ln(f, {
|
|
1321
1321
|
prepend: this.options.pluralSeparator,
|
|
1322
1322
|
compatibilityJSON: this.options.compatibilityJSON,
|
|
1323
1323
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1324
|
-
}), l && (!this.options.interpolation.format || this.options.interpolation.format === a.interpolation.format) && (d.formatter = s(l), d.formatter.init(d, this.options), this.options.interpolation.format = d.formatter.format.bind(d.formatter)), d.interpolator = new
|
|
1324
|
+
}), l && (!this.options.interpolation.format || this.options.interpolation.format === a.interpolation.format) && (d.formatter = s(l), d.formatter.init(d, this.options), this.options.interpolation.format = d.formatter.format.bind(d.formatter)), d.interpolator = new dn(this.options), d.utils = {
|
|
1325
1325
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1326
|
-
}, d.backendConnector = new
|
|
1326
|
+
}, d.backendConnector = new gn(s(this.modules.backend), d.resourceStore, d, this.options), d.backendConnector.on("*", function(p) {
|
|
1327
1327
|
for (var h = arguments.length, g = new Array(h > 1 ? h - 1 : 0), S = 1; S < h; S++)
|
|
1328
1328
|
g[S - 1] = arguments[S];
|
|
1329
1329
|
e.emit(p, ...g);
|
|
@@ -1388,7 +1388,7 @@ class pe extends Ue {
|
|
|
1388
1388
|
throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1389
1389
|
if (!e.type)
|
|
1390
1390
|
throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1391
|
-
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" &&
|
|
1391
|
+
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && jt.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1392
1392
|
}
|
|
1393
1393
|
setResolvedLanguage(e) {
|
|
1394
1394
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
|
|
@@ -1489,7 +1489,7 @@ class pe extends Ue {
|
|
|
1489
1489
|
dir(e) {
|
|
1490
1490
|
if (e || (e = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language)), !e)
|
|
1491
1491
|
return "rtl";
|
|
1492
|
-
const r = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], n = this.services && this.services.languageUtils || new
|
|
1492
|
+
const r = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], n = this.services && this.services.languageUtils || new It(Lt());
|
|
1493
1493
|
return r.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1494
1494
|
}
|
|
1495
1495
|
static createInstance() {
|
|
@@ -1511,7 +1511,7 @@ class pe extends Ue {
|
|
|
1511
1511
|
...this.services
|
|
1512
1512
|
}, s.services.utils = {
|
|
1513
1513
|
hasLoadedNamespace: s.hasLoadedNamespace.bind(s)
|
|
1514
|
-
}, n && (s.store = new
|
|
1514
|
+
}, n && (s.store = new Ot(this.store.data, a), s.services.resourceStore = s.store), s.translator = new He(s.services, a), s.translator.on("*", function(o) {
|
|
1515
1515
|
for (var c = arguments.length, u = new Array(c > 1 ? c - 1 : 0), l = 1; l < c; l++)
|
|
1516
1516
|
u[l - 1] = arguments[l];
|
|
1517
1517
|
s.emit(o, ...u);
|
|
@@ -1545,15 +1545,15 @@ k.setDefaultNamespace;
|
|
|
1545
1545
|
k.hasLoadedNamespace;
|
|
1546
1546
|
k.loadNamespaces;
|
|
1547
1547
|
k.loadLanguages;
|
|
1548
|
-
const
|
|
1548
|
+
const yn = {
|
|
1549
1549
|
es: {
|
|
1550
1550
|
translation: {
|
|
1551
|
-
...
|
|
1551
|
+
...qr
|
|
1552
1552
|
}
|
|
1553
1553
|
}
|
|
1554
1554
|
};
|
|
1555
1555
|
k.init({
|
|
1556
|
-
resources:
|
|
1556
|
+
resources: yn,
|
|
1557
1557
|
lng: "es",
|
|
1558
1558
|
// language to use, more information here: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources
|
|
1559
1559
|
// you can use the i18n.changeLanguage function to change the language manually: https://www.i18next.com/overview/api#changelanguage
|
|
@@ -1603,7 +1603,7 @@ const j = {
|
|
|
1603
1603
|
level: "warning"
|
|
1604
1604
|
}
|
|
1605
1605
|
};
|
|
1606
|
-
class
|
|
1606
|
+
class wn extends Xr {
|
|
1607
1607
|
get(e = "default", r) {
|
|
1608
1608
|
var s, i;
|
|
1609
1609
|
if (e instanceof Error)
|
|
@@ -1628,7 +1628,7 @@ class Sn extends qr {
|
|
|
1628
1628
|
};
|
|
1629
1629
|
}
|
|
1630
1630
|
}
|
|
1631
|
-
var
|
|
1631
|
+
var er = {}, tr = { exports: {} };
|
|
1632
1632
|
(function(t) {
|
|
1633
1633
|
function e(r) {
|
|
1634
1634
|
return r && r.__esModule ? r : {
|
|
@@ -1636,9 +1636,9 @@ var tr = {}, rr = { exports: {} };
|
|
|
1636
1636
|
};
|
|
1637
1637
|
}
|
|
1638
1638
|
t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
1639
|
-
})(
|
|
1640
|
-
var
|
|
1641
|
-
const b = crypto, G = (t) => t instanceof CryptoKey,
|
|
1639
|
+
})(tr);
|
|
1640
|
+
var rr = tr.exports;
|
|
1641
|
+
const b = crypto, G = (t) => t instanceof CryptoKey, nr = async (t, e) => {
|
|
1642
1642
|
const r = `SHA-${t.slice(-3)}`;
|
|
1643
1643
|
return new Uint8Array(await b.subtle.digest(r, e));
|
|
1644
1644
|
}, K = new TextEncoder(), X = new TextDecoder(), Ke = 2 ** 32;
|
|
@@ -1649,41 +1649,41 @@ function Q(...t) {
|
|
|
1649
1649
|
r.set(a, n), n += a.length;
|
|
1650
1650
|
}), r;
|
|
1651
1651
|
}
|
|
1652
|
-
function
|
|
1652
|
+
function Sn(t, e) {
|
|
1653
1653
|
return Q(K.encode(t), new Uint8Array([0]), e);
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1655
|
+
function it(t, e, r) {
|
|
1656
1656
|
if (e < 0 || e >= Ke)
|
|
1657
1657
|
throw new RangeError(`value must be >= 0 and <= ${Ke - 1}. Received ${e}`);
|
|
1658
1658
|
t.set([e >>> 24, e >>> 16, e >>> 8, e & 255], r);
|
|
1659
1659
|
}
|
|
1660
|
-
function
|
|
1660
|
+
function ar(t) {
|
|
1661
1661
|
const e = Math.floor(t / Ke), r = t % Ke, n = new Uint8Array(8);
|
|
1662
|
-
return
|
|
1662
|
+
return it(n, e, 0), it(n, r, 4), n;
|
|
1663
1663
|
}
|
|
1664
|
-
function
|
|
1664
|
+
function pt(t) {
|
|
1665
1665
|
const e = new Uint8Array(4);
|
|
1666
|
-
return
|
|
1666
|
+
return it(e, t), e;
|
|
1667
1667
|
}
|
|
1668
|
-
function
|
|
1669
|
-
return Q(
|
|
1668
|
+
function ze(t) {
|
|
1669
|
+
return Q(pt(t.length), t);
|
|
1670
1670
|
}
|
|
1671
|
-
async function
|
|
1671
|
+
async function bn(t, e, r) {
|
|
1672
1672
|
const n = Math.ceil((e >> 3) / 32), a = new Uint8Array(n * 32);
|
|
1673
1673
|
for (let s = 0; s < n; s++) {
|
|
1674
1674
|
const i = new Uint8Array(4 + t.length + r.length);
|
|
1675
|
-
i.set(
|
|
1675
|
+
i.set(pt(s + 1)), i.set(t, 4), i.set(r, 4 + t.length), a.set(await nr("sha256", i), s * 32);
|
|
1676
1676
|
}
|
|
1677
1677
|
return a.slice(0, e >> 3);
|
|
1678
1678
|
}
|
|
1679
|
-
const
|
|
1679
|
+
const gt = (t) => {
|
|
1680
1680
|
let e = t;
|
|
1681
1681
|
typeof e == "string" && (e = K.encode(e));
|
|
1682
1682
|
const r = 32768, n = [];
|
|
1683
1683
|
for (let a = 0; a < e.length; a += r)
|
|
1684
1684
|
n.push(String.fromCharCode.apply(null, e.subarray(a, a + r)));
|
|
1685
1685
|
return btoa(n.join(""));
|
|
1686
|
-
}, O = (t) =>
|
|
1686
|
+
}, O = (t) => gt(t).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_"), sr = (t) => {
|
|
1687
1687
|
const e = atob(t), r = new Uint8Array(e.length);
|
|
1688
1688
|
for (let n = 0; n < e.length; n++)
|
|
1689
1689
|
r[n] = e.charCodeAt(n);
|
|
@@ -1692,7 +1692,7 @@ const mt = (t) => {
|
|
|
1692
1692
|
let e = t;
|
|
1693
1693
|
e instanceof Uint8Array && (e = X.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
1694
1694
|
try {
|
|
1695
|
-
return
|
|
1695
|
+
return sr(e);
|
|
1696
1696
|
} catch {
|
|
1697
1697
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
1698
1698
|
}
|
|
@@ -1714,7 +1714,7 @@ class V extends L {
|
|
|
1714
1714
|
super(e), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = r, this.reason = n;
|
|
1715
1715
|
}
|
|
1716
1716
|
}
|
|
1717
|
-
class
|
|
1717
|
+
class ot extends L {
|
|
1718
1718
|
static get code() {
|
|
1719
1719
|
return "ERR_JWT_EXPIRED";
|
|
1720
1720
|
}
|
|
@@ -1770,7 +1770,7 @@ class B extends L {
|
|
|
1770
1770
|
return "ERR_JWT_INVALID";
|
|
1771
1771
|
}
|
|
1772
1772
|
}
|
|
1773
|
-
class
|
|
1773
|
+
class ir extends L {
|
|
1774
1774
|
constructor() {
|
|
1775
1775
|
super(...arguments), this.code = "ERR_JWK_INVALID";
|
|
1776
1776
|
}
|
|
@@ -1786,7 +1786,7 @@ class Le extends L {
|
|
|
1786
1786
|
return "ERR_JWKS_INVALID";
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
|
-
class
|
|
1789
|
+
class mt extends L {
|
|
1790
1790
|
constructor() {
|
|
1791
1791
|
super(...arguments), this.code = "ERR_JWKS_NO_MATCHING_KEY", this.message = "no applicable key found in the JSON Web Key Set";
|
|
1792
1792
|
}
|
|
@@ -1794,7 +1794,7 @@ class yt extends L {
|
|
|
1794
1794
|
return "ERR_JWKS_NO_MATCHING_KEY";
|
|
1795
1795
|
}
|
|
1796
1796
|
}
|
|
1797
|
-
class
|
|
1797
|
+
class or extends L {
|
|
1798
1798
|
constructor() {
|
|
1799
1799
|
super(...arguments), this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS", this.message = "multiple matching keys found in the JSON Web Key Set";
|
|
1800
1800
|
}
|
|
@@ -1802,7 +1802,7 @@ class cr extends L {
|
|
|
1802
1802
|
return "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
1803
1803
|
}
|
|
1804
1804
|
}
|
|
1805
|
-
class
|
|
1805
|
+
class cr extends L {
|
|
1806
1806
|
constructor() {
|
|
1807
1807
|
super(...arguments), this.code = "ERR_JWKS_TIMEOUT", this.message = "request timed out";
|
|
1808
1808
|
}
|
|
@@ -1810,7 +1810,7 @@ class ur extends L {
|
|
|
1810
1810
|
return "ERR_JWKS_TIMEOUT";
|
|
1811
1811
|
}
|
|
1812
1812
|
}
|
|
1813
|
-
class
|
|
1813
|
+
class yt extends L {
|
|
1814
1814
|
constructor() {
|
|
1815
1815
|
super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
|
|
1816
1816
|
}
|
|
@@ -1818,25 +1818,25 @@ class wt extends L {
|
|
|
1818
1818
|
return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
1819
1819
|
}
|
|
1820
1820
|
}
|
|
1821
|
-
const
|
|
1821
|
+
const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1822
1822
|
__proto__: null,
|
|
1823
1823
|
JOSEAlgNotAllowed: Re,
|
|
1824
1824
|
JOSEError: L,
|
|
1825
1825
|
JOSENotSupported: x,
|
|
1826
1826
|
JWEDecryptionFailed: ge,
|
|
1827
1827
|
JWEInvalid: y,
|
|
1828
|
-
JWKInvalid:
|
|
1828
|
+
JWKInvalid: ir,
|
|
1829
1829
|
JWKSInvalid: Le,
|
|
1830
|
-
JWKSMultipleMatchingKeys:
|
|
1831
|
-
JWKSNoMatchingKey:
|
|
1832
|
-
JWKSTimeout:
|
|
1830
|
+
JWKSMultipleMatchingKeys: or,
|
|
1831
|
+
JWKSNoMatchingKey: mt,
|
|
1832
|
+
JWKSTimeout: cr,
|
|
1833
1833
|
JWSInvalid: P,
|
|
1834
|
-
JWSSignatureVerificationFailed:
|
|
1834
|
+
JWSSignatureVerificationFailed: yt,
|
|
1835
1835
|
JWTClaimValidationFailed: V,
|
|
1836
|
-
JWTExpired:
|
|
1836
|
+
JWTExpired: ot,
|
|
1837
1837
|
JWTInvalid: B
|
|
1838
1838
|
}, Symbol.toStringTag, { value: "Module" })), De = b.getRandomValues.bind(b);
|
|
1839
|
-
function
|
|
1839
|
+
function ur(t) {
|
|
1840
1840
|
switch (t) {
|
|
1841
1841
|
case "A128GCM":
|
|
1842
1842
|
case "A128GCMKW":
|
|
@@ -1853,14 +1853,14 @@ function lr(t) {
|
|
|
1853
1853
|
throw new x(`Unsupported JWE Algorithm: ${t}`);
|
|
1854
1854
|
}
|
|
1855
1855
|
}
|
|
1856
|
-
const
|
|
1857
|
-
if (e.length << 3 !==
|
|
1856
|
+
const lr = (t) => De(new Uint8Array(ur(t) >> 3)), dr = (t, e) => {
|
|
1857
|
+
if (e.length << 3 !== ur(t))
|
|
1858
1858
|
throw new y("Invalid Initialization Vector length");
|
|
1859
1859
|
}, Oe = (t, e) => {
|
|
1860
1860
|
const r = t.byteLength << 3;
|
|
1861
1861
|
if (r !== e)
|
|
1862
1862
|
throw new y(`Invalid Content Encryption Key length. Expected ${e} bits, got ${r} bits`);
|
|
1863
|
-
},
|
|
1863
|
+
}, En = (t, e) => {
|
|
1864
1864
|
if (!(t instanceof Uint8Array))
|
|
1865
1865
|
throw new TypeError("First argument must be a buffer");
|
|
1866
1866
|
if (!(e instanceof Uint8Array))
|
|
@@ -1882,7 +1882,7 @@ function re(t, e) {
|
|
|
1882
1882
|
function Ee(t) {
|
|
1883
1883
|
return parseInt(t.name.slice(4), 10);
|
|
1884
1884
|
}
|
|
1885
|
-
function
|
|
1885
|
+
function An(t) {
|
|
1886
1886
|
switch (t) {
|
|
1887
1887
|
case "ES256":
|
|
1888
1888
|
return "P-256";
|
|
@@ -1894,7 +1894,7 @@ function xn(t) {
|
|
|
1894
1894
|
throw new Error("unreachable");
|
|
1895
1895
|
}
|
|
1896
1896
|
}
|
|
1897
|
-
function
|
|
1897
|
+
function fr(t, e) {
|
|
1898
1898
|
if (e.length && !e.some((r) => t.usages.includes(r))) {
|
|
1899
1899
|
let r = "CryptoKey does not support this operation, its usages must include ";
|
|
1900
1900
|
if (e.length > 2) {
|
|
@@ -1905,7 +1905,7 @@ function hr(t, e) {
|
|
|
1905
1905
|
throw new TypeError(r);
|
|
1906
1906
|
}
|
|
1907
1907
|
}
|
|
1908
|
-
function
|
|
1908
|
+
function xn(t, e, ...r) {
|
|
1909
1909
|
switch (e) {
|
|
1910
1910
|
case "HS256":
|
|
1911
1911
|
case "HS384":
|
|
@@ -1947,7 +1947,7 @@ function Cn(t, e, ...r) {
|
|
|
1947
1947
|
case "ES512": {
|
|
1948
1948
|
if (!re(t.algorithm, "ECDSA"))
|
|
1949
1949
|
throw U("ECDSA");
|
|
1950
|
-
const n =
|
|
1950
|
+
const n = An(e);
|
|
1951
1951
|
if (t.algorithm.namedCurve !== n)
|
|
1952
1952
|
throw U(n, "algorithm.namedCurve");
|
|
1953
1953
|
break;
|
|
@@ -1955,7 +1955,7 @@ function Cn(t, e, ...r) {
|
|
|
1955
1955
|
default:
|
|
1956
1956
|
throw new TypeError("CryptoKey does not support this operation");
|
|
1957
1957
|
}
|
|
1958
|
-
|
|
1958
|
+
fr(t, r);
|
|
1959
1959
|
}
|
|
1960
1960
|
function ae(t, e, ...r) {
|
|
1961
1961
|
switch (e) {
|
|
@@ -2010,9 +2010,9 @@ function ae(t, e, ...r) {
|
|
|
2010
2010
|
default:
|
|
2011
2011
|
throw new TypeError("CryptoKey does not support this operation");
|
|
2012
2012
|
}
|
|
2013
|
-
|
|
2013
|
+
fr(t, r);
|
|
2014
2014
|
}
|
|
2015
|
-
function
|
|
2015
|
+
function hr(t, e, ...r) {
|
|
2016
2016
|
if (r.length > 2) {
|
|
2017
2017
|
const n = r.pop();
|
|
2018
2018
|
t += `one of type ${r.join(", ")}, or ${n}.`;
|
|
@@ -2020,21 +2020,21 @@ function pr(t, e, ...r) {
|
|
|
2020
2020
|
r.length === 2 ? t += `one of type ${r[0]} or ${r[1]}.` : t += `of type ${r[0]}.`;
|
|
2021
2021
|
return e == null ? t += ` Received ${e}` : typeof e == "function" && e.name ? t += ` Received function ${e.name}` : typeof e == "object" && e != null && e.constructor && e.constructor.name && (t += ` Received an instance of ${e.constructor.name}`), t;
|
|
2022
2022
|
}
|
|
2023
|
-
const M = (t, ...e) =>
|
|
2024
|
-
function
|
|
2025
|
-
return
|
|
2023
|
+
const M = (t, ...e) => hr("Key must be ", t, ...e);
|
|
2024
|
+
function pr(t, e, ...r) {
|
|
2025
|
+
return hr(`Key for the ${t} algorithm must be `, e, ...r);
|
|
2026
2026
|
}
|
|
2027
|
-
const
|
|
2028
|
-
async function
|
|
2027
|
+
const gr = (t) => G(t), H = ["CryptoKey"];
|
|
2028
|
+
async function Cn(t, e, r, n, a, s) {
|
|
2029
2029
|
if (!(e instanceof Uint8Array))
|
|
2030
2030
|
throw new TypeError(M(e, "Uint8Array"));
|
|
2031
2031
|
const i = parseInt(t.slice(1, 4), 10), o = await b.subtle.importKey("raw", e.subarray(i >> 3), "AES-CBC", !1, ["decrypt"]), c = await b.subtle.importKey("raw", e.subarray(0, i >> 3), {
|
|
2032
2032
|
hash: `SHA-${i << 1}`,
|
|
2033
2033
|
name: "HMAC"
|
|
2034
|
-
}, !1, ["sign"]), u = Q(s, n, r,
|
|
2034
|
+
}, !1, ["sign"]), u = Q(s, n, r, ar(s.length << 3)), l = new Uint8Array((await b.subtle.sign("HMAC", c, u)).slice(0, i >> 3));
|
|
2035
2035
|
let f;
|
|
2036
2036
|
try {
|
|
2037
|
-
f =
|
|
2037
|
+
f = En(a, l);
|
|
2038
2038
|
} catch {
|
|
2039
2039
|
}
|
|
2040
2040
|
if (!f)
|
|
@@ -2048,7 +2048,7 @@ async function _n(t, e, r, n, a, s) {
|
|
|
2048
2048
|
throw new ge();
|
|
2049
2049
|
return d;
|
|
2050
2050
|
}
|
|
2051
|
-
async function
|
|
2051
|
+
async function _n(t, e, r, n, a, s) {
|
|
2052
2052
|
let i;
|
|
2053
2053
|
e instanceof Uint8Array ? i = await b.subtle.importKey("raw", e, "AES-GCM", !1, ["decrypt"]) : (ae(e, t, "decrypt"), i = e);
|
|
2054
2054
|
try {
|
|
@@ -2062,24 +2062,24 @@ async function Pn(t, e, r, n, a, s) {
|
|
|
2062
2062
|
throw new ge();
|
|
2063
2063
|
}
|
|
2064
2064
|
}
|
|
2065
|
-
const
|
|
2065
|
+
const mr = async (t, e, r, n, a, s) => {
|
|
2066
2066
|
if (!G(e) && !(e instanceof Uint8Array))
|
|
2067
2067
|
throw new TypeError(M(e, ...H, "Uint8Array"));
|
|
2068
|
-
switch (
|
|
2068
|
+
switch (dr(t, n), t) {
|
|
2069
2069
|
case "A128CBC-HS256":
|
|
2070
2070
|
case "A192CBC-HS384":
|
|
2071
2071
|
case "A256CBC-HS512":
|
|
2072
|
-
return e instanceof Uint8Array && Oe(e, parseInt(t.slice(-3), 10)),
|
|
2072
|
+
return e instanceof Uint8Array && Oe(e, parseInt(t.slice(-3), 10)), Cn(t, e, r, n, a, s);
|
|
2073
2073
|
case "A128GCM":
|
|
2074
2074
|
case "A192GCM":
|
|
2075
2075
|
case "A256GCM":
|
|
2076
|
-
return e instanceof Uint8Array && Oe(e, parseInt(t.slice(1, 4), 10)),
|
|
2076
|
+
return e instanceof Uint8Array && Oe(e, parseInt(t.slice(1, 4), 10)), _n(t, e, r, n, a, s);
|
|
2077
2077
|
default:
|
|
2078
2078
|
throw new x("Unsupported JWE Content Encryption Algorithm");
|
|
2079
2079
|
}
|
|
2080
|
-
},
|
|
2080
|
+
}, Pn = async () => {
|
|
2081
2081
|
throw new x('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `inflateRaw` decrypt option to provide Inflate Raw implementation.');
|
|
2082
|
-
},
|
|
2082
|
+
}, Hn = async () => {
|
|
2083
2083
|
throw new x('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `deflateRaw` encrypt option to provide Deflate Raw implementation.');
|
|
2084
2084
|
}, me = (...t) => {
|
|
2085
2085
|
const e = t.filter(Boolean);
|
|
@@ -2100,11 +2100,11 @@ const yr = async (t, e, r, n, a, s) => {
|
|
|
2100
2100
|
}
|
|
2101
2101
|
return !0;
|
|
2102
2102
|
};
|
|
2103
|
-
function
|
|
2103
|
+
function Kn(t) {
|
|
2104
2104
|
return typeof t == "object" && t !== null;
|
|
2105
2105
|
}
|
|
2106
2106
|
function I(t) {
|
|
2107
|
-
if (!
|
|
2107
|
+
if (!Kn(t) || Object.prototype.toString.call(t) !== "[object Object]")
|
|
2108
2108
|
return !1;
|
|
2109
2109
|
if (Object.getPrototypeOf(t) === null)
|
|
2110
2110
|
return !0;
|
|
@@ -2118,67 +2118,67 @@ const Je = [
|
|
|
2118
2118
|
!0,
|
|
2119
2119
|
["sign"]
|
|
2120
2120
|
];
|
|
2121
|
-
function
|
|
2121
|
+
function yr(t, e) {
|
|
2122
2122
|
if (t.algorithm.length !== parseInt(e.slice(1, 4), 10))
|
|
2123
2123
|
throw new TypeError(`Invalid key size for alg: ${e}`);
|
|
2124
2124
|
}
|
|
2125
|
-
function
|
|
2125
|
+
function wr(t, e, r) {
|
|
2126
2126
|
if (G(t))
|
|
2127
2127
|
return ae(t, e, r), t;
|
|
2128
2128
|
if (t instanceof Uint8Array)
|
|
2129
2129
|
return b.subtle.importKey("raw", t, "AES-KW", !0, [r]);
|
|
2130
2130
|
throw new TypeError(M(t, ...H, "Uint8Array"));
|
|
2131
2131
|
}
|
|
2132
|
-
const
|
|
2133
|
-
const n = await
|
|
2134
|
-
|
|
2132
|
+
const ct = async (t, e, r) => {
|
|
2133
|
+
const n = await wr(e, t, "wrapKey");
|
|
2134
|
+
yr(n, t);
|
|
2135
2135
|
const a = await b.subtle.importKey("raw", r, ...Je);
|
|
2136
2136
|
return new Uint8Array(await b.subtle.wrapKey("raw", a, n, "AES-KW"));
|
|
2137
|
-
},
|
|
2138
|
-
const n = await
|
|
2139
|
-
|
|
2137
|
+
}, ut = async (t, e, r) => {
|
|
2138
|
+
const n = await wr(e, t, "unwrapKey");
|
|
2139
|
+
yr(n, t);
|
|
2140
2140
|
const a = await b.subtle.unwrapKey("raw", r, n, "AES-KW", ...Je);
|
|
2141
2141
|
return new Uint8Array(await b.subtle.exportKey("raw", a));
|
|
2142
2142
|
};
|
|
2143
|
-
async function
|
|
2143
|
+
async function Sr(t, e, r, n, a = new Uint8Array(0), s = new Uint8Array(0)) {
|
|
2144
2144
|
if (!G(t))
|
|
2145
2145
|
throw new TypeError(M(t, ...H));
|
|
2146
2146
|
if (ae(t, "ECDH"), !G(e))
|
|
2147
2147
|
throw new TypeError(M(e, ...H));
|
|
2148
2148
|
ae(e, "ECDH", "deriveBits");
|
|
2149
|
-
const i = Q(
|
|
2149
|
+
const i = Q(ze(K.encode(r)), ze(a), ze(s), pt(n));
|
|
2150
2150
|
let o;
|
|
2151
2151
|
t.algorithm.name === "X25519" ? o = 256 : t.algorithm.name === "X448" ? o = 448 : o = Math.ceil(parseInt(t.algorithm.namedCurve.substr(-3), 10) / 8) << 3;
|
|
2152
2152
|
const c = new Uint8Array(await b.subtle.deriveBits({
|
|
2153
2153
|
name: t.algorithm.name,
|
|
2154
2154
|
public: t
|
|
2155
2155
|
}, e, o));
|
|
2156
|
-
return
|
|
2156
|
+
return bn(c, n, i);
|
|
2157
2157
|
}
|
|
2158
|
-
async function
|
|
2158
|
+
async function Rn(t) {
|
|
2159
2159
|
if (!G(t))
|
|
2160
2160
|
throw new TypeError(M(t, ...H));
|
|
2161
2161
|
return b.subtle.generateKey(t.algorithm, !0, ["deriveBits"]);
|
|
2162
2162
|
}
|
|
2163
|
-
function
|
|
2163
|
+
function br(t) {
|
|
2164
2164
|
if (!G(t))
|
|
2165
2165
|
throw new TypeError(M(t, ...H));
|
|
2166
2166
|
return ["P-256", "P-384", "P-521"].includes(t.algorithm.namedCurve) || t.algorithm.name === "X25519" || t.algorithm.name === "X448";
|
|
2167
2167
|
}
|
|
2168
|
-
function
|
|
2168
|
+
function On(t) {
|
|
2169
2169
|
if (!(t instanceof Uint8Array) || t.length < 8)
|
|
2170
2170
|
throw new y("PBES2 Salt Input must be 8 or more octets");
|
|
2171
2171
|
}
|
|
2172
|
-
function
|
|
2172
|
+
function Tn(t, e) {
|
|
2173
2173
|
if (t instanceof Uint8Array)
|
|
2174
2174
|
return b.subtle.importKey("raw", t, "PBKDF2", !1, ["deriveBits"]);
|
|
2175
2175
|
if (G(t))
|
|
2176
2176
|
return ae(t, e, "deriveBits", "deriveKey"), t;
|
|
2177
2177
|
throw new TypeError(M(t, ...H, "Uint8Array"));
|
|
2178
2178
|
}
|
|
2179
|
-
async function
|
|
2180
|
-
|
|
2181
|
-
const a =
|
|
2179
|
+
async function vr(t, e, r, n) {
|
|
2180
|
+
On(t);
|
|
2181
|
+
const a = Sn(e, t), s = parseInt(e.slice(13, 16), 10), i = {
|
|
2182
2182
|
hash: `SHA-${e.slice(8, 11)}`,
|
|
2183
2183
|
iterations: r,
|
|
2184
2184
|
name: "PBKDF2",
|
|
@@ -2186,19 +2186,19 @@ async function Er(t, e, r, n) {
|
|
|
2186
2186
|
}, o = {
|
|
2187
2187
|
length: s,
|
|
2188
2188
|
name: "AES-KW"
|
|
2189
|
-
}, c = await
|
|
2189
|
+
}, c = await Tn(n, e);
|
|
2190
2190
|
if (c.usages.includes("deriveBits"))
|
|
2191
2191
|
return new Uint8Array(await b.subtle.deriveBits(i, c, s));
|
|
2192
2192
|
if (c.usages.includes("deriveKey"))
|
|
2193
2193
|
return b.subtle.deriveKey(i, c, o, !1, ["wrapKey", "unwrapKey"]);
|
|
2194
2194
|
throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"');
|
|
2195
2195
|
}
|
|
2196
|
-
const
|
|
2197
|
-
const s = await
|
|
2198
|
-
return { encryptedKey: await
|
|
2199
|
-
},
|
|
2200
|
-
const s = await
|
|
2201
|
-
return
|
|
2196
|
+
const In = async (t, e, r, n = 2048, a = De(new Uint8Array(16))) => {
|
|
2197
|
+
const s = await vr(a, t, n, e);
|
|
2198
|
+
return { encryptedKey: await ct(t.slice(-6), s, r), p2c: n, p2s: O(a) };
|
|
2199
|
+
}, Wn = async (t, e, r, n, a) => {
|
|
2200
|
+
const s = await vr(a, t, n, e);
|
|
2201
|
+
return ut(t.slice(-6), s, r);
|
|
2202
2202
|
};
|
|
2203
2203
|
function Te(t) {
|
|
2204
2204
|
switch (t) {
|
|
@@ -2217,7 +2217,7 @@ const Ne = (t, e) => {
|
|
|
2217
2217
|
if (typeof r != "number" || r < 2048)
|
|
2218
2218
|
throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`);
|
|
2219
2219
|
}
|
|
2220
|
-
},
|
|
2220
|
+
}, Un = async (t, e, r) => {
|
|
2221
2221
|
if (!G(e))
|
|
2222
2222
|
throw new TypeError(M(e, ...H));
|
|
2223
2223
|
if (ae(e, t, "encrypt", "wrapKey"), Ne(t, e), e.usages.includes("encrypt"))
|
|
@@ -2227,7 +2227,7 @@ const Ne = (t, e) => {
|
|
|
2227
2227
|
return new Uint8Array(await b.subtle.wrapKey("raw", n, e, Te(t)));
|
|
2228
2228
|
}
|
|
2229
2229
|
throw new TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation');
|
|
2230
|
-
},
|
|
2230
|
+
}, Ln = async (t, e, r) => {
|
|
2231
2231
|
if (!G(e))
|
|
2232
2232
|
throw new TypeError(M(e, ...H));
|
|
2233
2233
|
if (ae(e, t, "decrypt", "unwrapKey"), Ne(t, e), e.usages.includes("decrypt"))
|
|
@@ -2238,7 +2238,7 @@ const Ne = (t, e) => {
|
|
|
2238
2238
|
}
|
|
2239
2239
|
throw new TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation');
|
|
2240
2240
|
};
|
|
2241
|
-
function
|
|
2241
|
+
function wt(t) {
|
|
2242
2242
|
switch (t) {
|
|
2243
2243
|
case "A128GCM":
|
|
2244
2244
|
return 128;
|
|
@@ -2255,28 +2255,28 @@ function St(t) {
|
|
|
2255
2255
|
throw new x(`Unsupported JWE Algorithm: ${t}`);
|
|
2256
2256
|
}
|
|
2257
2257
|
}
|
|
2258
|
-
const ie = (t) => De(new Uint8Array(
|
|
2258
|
+
const ie = (t) => De(new Uint8Array(wt(t) >> 3)), Er = (t, e) => {
|
|
2259
2259
|
const r = (t.match(/.{1,64}/g) || []).join(`
|
|
2260
2260
|
`);
|
|
2261
2261
|
return `-----BEGIN ${e}-----
|
|
2262
2262
|
${r}
|
|
2263
2263
|
-----END ${e}-----`;
|
|
2264
|
-
},
|
|
2264
|
+
}, Ar = async (t, e, r) => {
|
|
2265
2265
|
if (!G(r))
|
|
2266
2266
|
throw new TypeError(M(r, ...H));
|
|
2267
2267
|
if (!r.extractable)
|
|
2268
2268
|
throw new TypeError("CryptoKey is not extractable");
|
|
2269
2269
|
if (r.type !== t)
|
|
2270
2270
|
throw new TypeError(`key is not a ${t} key`);
|
|
2271
|
-
return
|
|
2272
|
-
},
|
|
2271
|
+
return Er(gt(new Uint8Array(await b.subtle.exportKey(e, r))), `${t.toUpperCase()} KEY`);
|
|
2272
|
+
}, Dn = (t) => Ar("public", "spki", t), Jn = (t) => Ar("private", "pkcs8", t), te = (t, e, r = 0) => {
|
|
2273
2273
|
r === 0 && (e.unshift(e.length), e.unshift(6));
|
|
2274
2274
|
let n = t.indexOf(e[0], r);
|
|
2275
2275
|
if (n === -1)
|
|
2276
2276
|
return !1;
|
|
2277
2277
|
const a = t.subarray(n, n + e.length);
|
|
2278
2278
|
return a.length !== e.length ? !1 : a.every((s, i) => s === e[i]) || te(t, e, n + 1);
|
|
2279
|
-
},
|
|
2279
|
+
}, Jt = (t) => {
|
|
2280
2280
|
switch (!0) {
|
|
2281
2281
|
case te(t, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
2282
2282
|
return "P-256";
|
|
@@ -2295,7 +2295,7 @@ ${r}
|
|
|
2295
2295
|
default:
|
|
2296
2296
|
throw new x("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
|
|
2297
2297
|
}
|
|
2298
|
-
},
|
|
2298
|
+
}, xr = async (t, e, r, n, a) => {
|
|
2299
2299
|
var s;
|
|
2300
2300
|
let i, o;
|
|
2301
2301
|
const c = new Uint8Array(atob(r.replace(t, "")).split("").map((l) => l.charCodeAt(0))), u = e === "spki";
|
|
@@ -2332,27 +2332,27 @@ ${r}
|
|
|
2332
2332
|
case "ECDH-ES+A128KW":
|
|
2333
2333
|
case "ECDH-ES+A192KW":
|
|
2334
2334
|
case "ECDH-ES+A256KW": {
|
|
2335
|
-
const l =
|
|
2335
|
+
const l = Jt(c);
|
|
2336
2336
|
i = l.startsWith("P-") ? { name: "ECDH", namedCurve: l } : { name: l }, o = u ? [] : ["deriveBits"];
|
|
2337
2337
|
break;
|
|
2338
2338
|
}
|
|
2339
2339
|
case "EdDSA":
|
|
2340
|
-
i = { name:
|
|
2340
|
+
i = { name: Jt(c) }, o = u ? ["verify"] : ["sign"];
|
|
2341
2341
|
break;
|
|
2342
2342
|
default:
|
|
2343
2343
|
throw new x('Invalid or unsupported "alg" (Algorithm) value');
|
|
2344
2344
|
}
|
|
2345
2345
|
return b.subtle.importKey(e, c, i, (s = a == null ? void 0 : a.extractable) !== null && s !== void 0 ? s : !1, o);
|
|
2346
|
-
},
|
|
2347
|
-
function
|
|
2346
|
+
}, Nn = (t, e, r) => xr(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, "pkcs8", t, e, r), Cr = (t, e, r) => xr(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", t, e, r);
|
|
2347
|
+
function Nt(t) {
|
|
2348
2348
|
let e = [], r = 0;
|
|
2349
2349
|
for (; r < t.length; ) {
|
|
2350
|
-
let n =
|
|
2350
|
+
let n = _r(t.subarray(r));
|
|
2351
2351
|
e.push(n), r += n.byteLength;
|
|
2352
2352
|
}
|
|
2353
2353
|
return e;
|
|
2354
2354
|
}
|
|
2355
|
-
function
|
|
2355
|
+
function _r(t) {
|
|
2356
2356
|
let e = 0, r = t[0] & 31;
|
|
2357
2357
|
if (e++, r === 31) {
|
|
2358
2358
|
for (r = 0; t[e] >= 128; )
|
|
@@ -2387,24 +2387,24 @@ function Pr(t) {
|
|
|
2387
2387
|
raw: t.subarray(0, a)
|
|
2388
2388
|
};
|
|
2389
2389
|
}
|
|
2390
|
-
function
|
|
2391
|
-
const e =
|
|
2392
|
-
return
|
|
2390
|
+
function $n(t) {
|
|
2391
|
+
const e = Nt(Nt(_r(t).contents)[0].contents);
|
|
2392
|
+
return gt(e[e[0].raw[0] === 160 ? 6 : 5].raw);
|
|
2393
2393
|
}
|
|
2394
|
-
function
|
|
2395
|
-
const e = t.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, ""), r =
|
|
2396
|
-
return
|
|
2394
|
+
function Mn(t) {
|
|
2395
|
+
const e = t.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, ""), r = sr(e);
|
|
2396
|
+
return Er($n(r), "PUBLIC KEY");
|
|
2397
2397
|
}
|
|
2398
|
-
const
|
|
2398
|
+
const kn = (t, e, r) => {
|
|
2399
2399
|
let n;
|
|
2400
2400
|
try {
|
|
2401
|
-
n =
|
|
2401
|
+
n = Mn(t);
|
|
2402
2402
|
} catch (a) {
|
|
2403
2403
|
throw new TypeError("Failed to parse the X.509 certificate", { cause: a });
|
|
2404
2404
|
}
|
|
2405
|
-
return
|
|
2405
|
+
return Cr(n, e, r);
|
|
2406
2406
|
};
|
|
2407
|
-
function
|
|
2407
|
+
function Fn(t) {
|
|
2408
2408
|
let e, r;
|
|
2409
2409
|
switch (t.kty) {
|
|
2410
2410
|
case "oct": {
|
|
@@ -2510,11 +2510,11 @@ function Vn(t) {
|
|
|
2510
2510
|
}
|
|
2511
2511
|
return { algorithm: e, keyUsages: r };
|
|
2512
2512
|
}
|
|
2513
|
-
const
|
|
2513
|
+
const Vn = async (t) => {
|
|
2514
2514
|
var e, r;
|
|
2515
2515
|
if (!t.alg)
|
|
2516
2516
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
2517
|
-
const { algorithm: n, keyUsages: a } =
|
|
2517
|
+
const { algorithm: n, keyUsages: a } = Fn(t), s = [
|
|
2518
2518
|
n,
|
|
2519
2519
|
(e = t.ext) !== null && e !== void 0 ? e : !1,
|
|
2520
2520
|
(r = t.key_ops) !== null && r !== void 0 ? r : a
|
|
@@ -2523,21 +2523,21 @@ const Bn = async (t) => {
|
|
|
2523
2523
|
return b.subtle.importKey("raw", T(t.k), ...s);
|
|
2524
2524
|
const i = { ...t };
|
|
2525
2525
|
return delete i.alg, delete i.use, b.subtle.importKey("jwk", i, ...s);
|
|
2526
|
-
},
|
|
2527
|
-
async function
|
|
2526
|
+
}, $t = Vn;
|
|
2527
|
+
async function Bn(t, e, r) {
|
|
2528
2528
|
if (typeof t != "string" || t.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
2529
2529
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
2530
|
-
return
|
|
2530
|
+
return Cr(t, e, r);
|
|
2531
2531
|
}
|
|
2532
|
-
async function
|
|
2532
|
+
async function Gn(t, e, r) {
|
|
2533
2533
|
if (typeof t != "string" || t.indexOf("-----BEGIN CERTIFICATE-----") !== 0)
|
|
2534
2534
|
throw new TypeError('"x509" must be X.509 formatted string');
|
|
2535
|
-
return
|
|
2535
|
+
return kn(t, e, r);
|
|
2536
2536
|
}
|
|
2537
|
-
async function
|
|
2537
|
+
async function zn(t, e, r) {
|
|
2538
2538
|
if (typeof t != "string" || t.indexOf("-----BEGIN PRIVATE KEY-----") !== 0)
|
|
2539
2539
|
throw new TypeError('"pkcs8" must be PKCS#8 formatted string');
|
|
2540
|
-
return
|
|
2540
|
+
return Nn(t, e, r);
|
|
2541
2541
|
}
|
|
2542
2542
|
async function $e(t, e, r) {
|
|
2543
2543
|
var n;
|
|
@@ -2547,27 +2547,27 @@ async function $e(t, e, r) {
|
|
|
2547
2547
|
case "oct":
|
|
2548
2548
|
if (typeof t.k != "string" || !t.k)
|
|
2549
2549
|
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
2550
|
-
return r ?? (r = t.ext !== !0), r ?
|
|
2550
|
+
return r ?? (r = t.ext !== !0), r ? $t({ ...t, alg: e, ext: (n = t.ext) !== null && n !== void 0 ? n : !1 }) : T(t.k);
|
|
2551
2551
|
case "RSA":
|
|
2552
2552
|
if (t.oth !== void 0)
|
|
2553
2553
|
throw new x('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
2554
2554
|
case "EC":
|
|
2555
2555
|
case "OKP":
|
|
2556
|
-
return
|
|
2556
|
+
return $t({ ...t, alg: e });
|
|
2557
2557
|
default:
|
|
2558
2558
|
throw new x('Unsupported "kty" (Key Type) Parameter value');
|
|
2559
2559
|
}
|
|
2560
2560
|
}
|
|
2561
|
-
const
|
|
2561
|
+
const qn = (t, e) => {
|
|
2562
2562
|
if (!(e instanceof Uint8Array)) {
|
|
2563
|
-
if (!
|
|
2564
|
-
throw new TypeError(
|
|
2563
|
+
if (!gr(e))
|
|
2564
|
+
throw new TypeError(pr(t, e, ...H, "Uint8Array"));
|
|
2565
2565
|
if (e.type !== "secret")
|
|
2566
2566
|
throw new TypeError(`${H.join(" or ")} instances for symmetric algorithms must be of type "secret"`);
|
|
2567
2567
|
}
|
|
2568
|
-
},
|
|
2569
|
-
if (!
|
|
2570
|
-
throw new TypeError(
|
|
2568
|
+
}, Xn = (t, e, r) => {
|
|
2569
|
+
if (!gr(e))
|
|
2570
|
+
throw new TypeError(pr(t, e, ...H));
|
|
2571
2571
|
if (e.type === "secret")
|
|
2572
2572
|
throw new TypeError(`${H.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);
|
|
2573
2573
|
if (r === "sign" && e.type === "public")
|
|
@@ -2579,9 +2579,9 @@ const Xn = (t, e) => {
|
|
|
2579
2579
|
if (e.algorithm && r === "encrypt" && e.type === "private")
|
|
2580
2580
|
throw new TypeError(`${H.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
2581
2581
|
}, Me = (t, e, r) => {
|
|
2582
|
-
t.startsWith("HS") || t === "dir" || t.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(t) ?
|
|
2582
|
+
t.startsWith("HS") || t === "dir" || t.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(t) ? qn(t, e) : Xn(t, e, r);
|
|
2583
2583
|
};
|
|
2584
|
-
async function
|
|
2584
|
+
async function Yn(t, e, r, n, a) {
|
|
2585
2585
|
if (!(r instanceof Uint8Array))
|
|
2586
2586
|
throw new TypeError(M(r, "Uint8Array"));
|
|
2587
2587
|
const s = parseInt(t.slice(1, 4), 10), i = await b.subtle.importKey("raw", r.subarray(s >> 3), "AES-CBC", !1, ["encrypt"]), o = await b.subtle.importKey("raw", r.subarray(0, s >> 3), {
|
|
@@ -2590,10 +2590,10 @@ async function Zn(t, e, r, n, a) {
|
|
|
2590
2590
|
}, !1, ["sign"]), c = new Uint8Array(await b.subtle.encrypt({
|
|
2591
2591
|
iv: n,
|
|
2592
2592
|
name: "AES-CBC"
|
|
2593
|
-
}, i, e)), u = Q(a, n, c,
|
|
2593
|
+
}, i, e)), u = Q(a, n, c, ar(a.length << 3)), l = new Uint8Array((await b.subtle.sign("HMAC", o, u)).slice(0, s >> 3));
|
|
2594
2594
|
return { ciphertext: c, tag: l };
|
|
2595
2595
|
}
|
|
2596
|
-
async function
|
|
2596
|
+
async function Zn(t, e, r, n, a) {
|
|
2597
2597
|
let s;
|
|
2598
2598
|
r instanceof Uint8Array ? s = await b.subtle.importKey("raw", r, "AES-GCM", !1, ["encrypt"]) : (ae(r, t, "encrypt"), s = r);
|
|
2599
2599
|
const i = new Uint8Array(await b.subtle.encrypt({
|
|
@@ -2604,33 +2604,33 @@ async function Qn(t, e, r, n, a) {
|
|
|
2604
2604
|
}, s, e)), o = i.slice(-16);
|
|
2605
2605
|
return { ciphertext: i.slice(0, -16), tag: o };
|
|
2606
2606
|
}
|
|
2607
|
-
const
|
|
2607
|
+
const lt = async (t, e, r, n, a) => {
|
|
2608
2608
|
if (!G(r) && !(r instanceof Uint8Array))
|
|
2609
2609
|
throw new TypeError(M(r, ...H, "Uint8Array"));
|
|
2610
|
-
switch (
|
|
2610
|
+
switch (dr(t, n), t) {
|
|
2611
2611
|
case "A128CBC-HS256":
|
|
2612
2612
|
case "A192CBC-HS384":
|
|
2613
2613
|
case "A256CBC-HS512":
|
|
2614
|
-
return r instanceof Uint8Array && Oe(r, parseInt(t.slice(-3), 10)),
|
|
2614
|
+
return r instanceof Uint8Array && Oe(r, parseInt(t.slice(-3), 10)), Yn(t, e, r, n, a);
|
|
2615
2615
|
case "A128GCM":
|
|
2616
2616
|
case "A192GCM":
|
|
2617
2617
|
case "A256GCM":
|
|
2618
|
-
return r instanceof Uint8Array && Oe(r, parseInt(t.slice(1, 4), 10)),
|
|
2618
|
+
return r instanceof Uint8Array && Oe(r, parseInt(t.slice(1, 4), 10)), Zn(t, e, r, n, a);
|
|
2619
2619
|
default:
|
|
2620
2620
|
throw new x("Unsupported JWE Content Encryption Algorithm");
|
|
2621
2621
|
}
|
|
2622
2622
|
};
|
|
2623
|
-
async function
|
|
2623
|
+
async function Qn(t, e, r, n) {
|
|
2624
2624
|
const a = t.slice(0, 7);
|
|
2625
|
-
n || (n =
|
|
2626
|
-
const { ciphertext: s, tag: i } = await
|
|
2625
|
+
n || (n = lr(a));
|
|
2626
|
+
const { ciphertext: s, tag: i } = await lt(a, r, e, n, new Uint8Array(0));
|
|
2627
2627
|
return { encryptedKey: s, iv: O(n), tag: O(i) };
|
|
2628
2628
|
}
|
|
2629
|
-
async function
|
|
2629
|
+
async function jn(t, e, r, n, a) {
|
|
2630
2630
|
const s = t.slice(0, 7);
|
|
2631
|
-
return
|
|
2631
|
+
return mr(s, e, r, n, a, new Uint8Array(0));
|
|
2632
2632
|
}
|
|
2633
|
-
async function
|
|
2633
|
+
async function ea(t, e, r, n, a) {
|
|
2634
2634
|
switch (Me(t, e, "decrypt"), t) {
|
|
2635
2635
|
case "dir": {
|
|
2636
2636
|
if (r !== void 0)
|
|
@@ -2645,7 +2645,7 @@ async function ta(t, e, r, n, a) {
|
|
|
2645
2645
|
case "ECDH-ES+A256KW": {
|
|
2646
2646
|
if (!I(n.epk))
|
|
2647
2647
|
throw new y('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');
|
|
2648
|
-
if (!
|
|
2648
|
+
if (!br(e))
|
|
2649
2649
|
throw new x("ECDH with the provided key is not allowed or not supported by your javascript runtime");
|
|
2650
2650
|
const s = await $e(n.epk, t);
|
|
2651
2651
|
let i, o;
|
|
@@ -2667,12 +2667,12 @@ async function ta(t, e, r, n, a) {
|
|
|
2667
2667
|
throw new y("Failed to base64url decode the apv");
|
|
2668
2668
|
}
|
|
2669
2669
|
}
|
|
2670
|
-
const c = await
|
|
2670
|
+
const c = await Sr(s, e, t === "ECDH-ES" ? n.enc : t, t === "ECDH-ES" ? wt(n.enc) : parseInt(t.slice(-5, -2), 10), i, o);
|
|
2671
2671
|
if (t === "ECDH-ES")
|
|
2672
2672
|
return c;
|
|
2673
2673
|
if (r === void 0)
|
|
2674
2674
|
throw new y("JWE Encrypted Key missing");
|
|
2675
|
-
return
|
|
2675
|
+
return ut(t.slice(-6), c, r);
|
|
2676
2676
|
}
|
|
2677
2677
|
case "RSA1_5":
|
|
2678
2678
|
case "RSA-OAEP":
|
|
@@ -2681,7 +2681,7 @@ async function ta(t, e, r, n, a) {
|
|
|
2681
2681
|
case "RSA-OAEP-512": {
|
|
2682
2682
|
if (r === void 0)
|
|
2683
2683
|
throw new y("JWE Encrypted Key missing");
|
|
2684
|
-
return
|
|
2684
|
+
return Ln(t, e, r);
|
|
2685
2685
|
}
|
|
2686
2686
|
case "PBES2-HS256+A128KW":
|
|
2687
2687
|
case "PBES2-HS384+A192KW":
|
|
@@ -2701,14 +2701,14 @@ async function ta(t, e, r, n, a) {
|
|
|
2701
2701
|
} catch {
|
|
2702
2702
|
throw new y("Failed to base64url decode the p2s");
|
|
2703
2703
|
}
|
|
2704
|
-
return
|
|
2704
|
+
return Wn(t, e, r, n.p2c, i);
|
|
2705
2705
|
}
|
|
2706
2706
|
case "A128KW":
|
|
2707
2707
|
case "A192KW":
|
|
2708
2708
|
case "A256KW": {
|
|
2709
2709
|
if (r === void 0)
|
|
2710
2710
|
throw new y("JWE Encrypted Key missing");
|
|
2711
|
-
return
|
|
2711
|
+
return ut(t, e, r);
|
|
2712
2712
|
}
|
|
2713
2713
|
case "A128GCMKW":
|
|
2714
2714
|
case "A192GCMKW":
|
|
@@ -2731,7 +2731,7 @@ async function ta(t, e, r, n, a) {
|
|
|
2731
2731
|
} catch {
|
|
2732
2732
|
throw new y("Failed to base64url decode the tag");
|
|
2733
2733
|
}
|
|
2734
|
-
return
|
|
2734
|
+
return jn(t, e, r, s, i);
|
|
2735
2735
|
}
|
|
2736
2736
|
default:
|
|
2737
2737
|
throw new x('Invalid or unsupported "alg" (JWE Algorithm) header value');
|
|
@@ -2756,13 +2756,13 @@ function ye(t, e, r, n, a) {
|
|
|
2756
2756
|
}
|
|
2757
2757
|
return new Set(n.crit);
|
|
2758
2758
|
}
|
|
2759
|
-
const
|
|
2759
|
+
const dt = (t, e) => {
|
|
2760
2760
|
if (e !== void 0 && (!Array.isArray(e) || e.some((r) => typeof r != "string")))
|
|
2761
2761
|
throw new TypeError(`"${t}" option must be an array of strings`);
|
|
2762
2762
|
if (e)
|
|
2763
2763
|
return new Set(e);
|
|
2764
2764
|
};
|
|
2765
|
-
async function
|
|
2765
|
+
async function St(t, e, r) {
|
|
2766
2766
|
var n;
|
|
2767
2767
|
if (!I(t))
|
|
2768
2768
|
throw new y("Flattened JWE must be an object");
|
|
@@ -2810,7 +2810,7 @@ async function bt(t, e, r) {
|
|
|
2810
2810
|
throw new y("missing JWE Algorithm (alg) in JWE Header");
|
|
2811
2811
|
if (typeof o != "string" || !o)
|
|
2812
2812
|
throw new y("missing JWE Encryption Algorithm (enc) in JWE Header");
|
|
2813
|
-
const c = r &&
|
|
2813
|
+
const c = r && dt("keyManagementAlgorithms", r.keyManagementAlgorithms), u = r && dt("contentEncryptionAlgorithms", r.contentEncryptionAlgorithms);
|
|
2814
2814
|
if (c && !c.has(i))
|
|
2815
2815
|
throw new Re('"alg" (Algorithm) Header Parameter not allowed');
|
|
2816
2816
|
if (u && !u.has(o))
|
|
@@ -2826,7 +2826,7 @@ async function bt(t, e, r) {
|
|
|
2826
2826
|
typeof e == "function" && (e = await e(a, t), f = !0);
|
|
2827
2827
|
let d;
|
|
2828
2828
|
try {
|
|
2829
|
-
d = await
|
|
2829
|
+
d = await ea(i, e, l, s, r);
|
|
2830
2830
|
} catch (m) {
|
|
2831
2831
|
if (m instanceof TypeError || m instanceof y || m instanceof x)
|
|
2832
2832
|
throw m;
|
|
@@ -2852,8 +2852,8 @@ async function bt(t, e, r) {
|
|
|
2852
2852
|
} catch {
|
|
2853
2853
|
throw new y("Failed to base64url decode the ciphertext");
|
|
2854
2854
|
}
|
|
2855
|
-
let v = await
|
|
2856
|
-
s.zip === "DEF" && (v = await ((r == null ? void 0 : r.inflateRaw) ||
|
|
2855
|
+
let v = await mr(o, d, C, p, h, S);
|
|
2856
|
+
s.zip === "DEF" && (v = await ((r == null ? void 0 : r.inflateRaw) || Pn)(v));
|
|
2857
2857
|
const w = { plaintext: v };
|
|
2858
2858
|
if (t.protected !== void 0 && (w.protectedHeader = a), t.aad !== void 0)
|
|
2859
2859
|
try {
|
|
@@ -2863,13 +2863,13 @@ async function bt(t, e, r) {
|
|
|
2863
2863
|
}
|
|
2864
2864
|
return t.unprotected !== void 0 && (w.sharedUnprotectedHeader = t.unprotected), t.header !== void 0 && (w.unprotectedHeader = t.header), f ? { ...w, key: e } : w;
|
|
2865
2865
|
}
|
|
2866
|
-
async function
|
|
2866
|
+
async function Pr(t, e, r) {
|
|
2867
2867
|
if (t instanceof Uint8Array && (t = X.decode(t)), typeof t != "string")
|
|
2868
2868
|
throw new y("Compact JWE must be a string or Uint8Array");
|
|
2869
2869
|
const { 0: n, 1: a, 2: s, 3: i, 4: o, length: c } = t.split(".");
|
|
2870
2870
|
if (c !== 5)
|
|
2871
2871
|
throw new y("Invalid Compact JWE");
|
|
2872
|
-
const u = await
|
|
2872
|
+
const u = await St({
|
|
2873
2873
|
ciphertext: i,
|
|
2874
2874
|
iv: s || void 0,
|
|
2875
2875
|
protected: n || void 0,
|
|
@@ -2878,7 +2878,7 @@ async function Hr(t, e, r) {
|
|
|
2878
2878
|
}, e, r), l = { plaintext: u.plaintext, protectedHeader: u.protectedHeader };
|
|
2879
2879
|
return typeof e == "function" ? { ...l, key: u.key } : l;
|
|
2880
2880
|
}
|
|
2881
|
-
async function
|
|
2881
|
+
async function ta(t, e, r) {
|
|
2882
2882
|
if (!I(t))
|
|
2883
2883
|
throw new y("General JWE must be an object");
|
|
2884
2884
|
if (!Array.isArray(t.recipients) || !t.recipients.every(I))
|
|
@@ -2887,7 +2887,7 @@ async function ra(t, e, r) {
|
|
|
2887
2887
|
throw new y("JWE Recipients has no members");
|
|
2888
2888
|
for (const n of t.recipients)
|
|
2889
2889
|
try {
|
|
2890
|
-
return await
|
|
2890
|
+
return await St({
|
|
2891
2891
|
aad: t.aad,
|
|
2892
2892
|
ciphertext: t.ciphertext,
|
|
2893
2893
|
encrypted_key: n.encrypted_key,
|
|
@@ -2901,7 +2901,7 @@ async function ra(t, e, r) {
|
|
|
2901
2901
|
}
|
|
2902
2902
|
throw new ge();
|
|
2903
2903
|
}
|
|
2904
|
-
const
|
|
2904
|
+
const ra = async (t) => {
|
|
2905
2905
|
if (t instanceof Uint8Array)
|
|
2906
2906
|
return {
|
|
2907
2907
|
kty: "oct",
|
|
@@ -2913,17 +2913,17 @@ const na = async (t) => {
|
|
|
2913
2913
|
throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");
|
|
2914
2914
|
const { ext: e, key_ops: r, alg: n, use: a, ...s } = await b.subtle.exportKey("jwk", t);
|
|
2915
2915
|
return s;
|
|
2916
|
-
},
|
|
2916
|
+
}, na = ra;
|
|
2917
|
+
async function aa(t) {
|
|
2918
|
+
return Dn(t);
|
|
2919
|
+
}
|
|
2917
2920
|
async function sa(t) {
|
|
2918
2921
|
return Jn(t);
|
|
2919
2922
|
}
|
|
2920
|
-
async function
|
|
2921
|
-
return
|
|
2923
|
+
async function Hr(t) {
|
|
2924
|
+
return na(t);
|
|
2922
2925
|
}
|
|
2923
|
-
async function Kr(t) {
|
|
2924
|
-
return aa(t);
|
|
2925
|
-
}
|
|
2926
|
-
async function Rr(t, e, r, n, a = {}) {
|
|
2926
|
+
async function Kr(t, e, r, n, a = {}) {
|
|
2927
2927
|
let s, i, o;
|
|
2928
2928
|
switch (Me(t, r, "encrypt"), t) {
|
|
2929
2929
|
case "dir": {
|
|
@@ -2934,19 +2934,19 @@ async function Rr(t, e, r, n, a = {}) {
|
|
|
2934
2934
|
case "ECDH-ES+A128KW":
|
|
2935
2935
|
case "ECDH-ES+A192KW":
|
|
2936
2936
|
case "ECDH-ES+A256KW": {
|
|
2937
|
-
if (!
|
|
2937
|
+
if (!br(r))
|
|
2938
2938
|
throw new x("ECDH with the provided key is not allowed or not supported by your javascript runtime");
|
|
2939
2939
|
const { apu: c, apv: u } = a;
|
|
2940
2940
|
let { epk: l } = a;
|
|
2941
|
-
l || (l = (await
|
|
2942
|
-
const { x: f, y: d, crv: p, kty: h } = await
|
|
2941
|
+
l || (l = (await Rn(r)).privateKey);
|
|
2942
|
+
const { x: f, y: d, crv: p, kty: h } = await Hr(l), g = await Sr(r, l, t === "ECDH-ES" ? e : t, t === "ECDH-ES" ? wt(e) : parseInt(t.slice(-5, -2), 10), c, u);
|
|
2943
2943
|
if (i = { epk: { x: f, crv: p, kty: h } }, h === "EC" && (i.epk.y = d), c && (i.apu = O(c)), u && (i.apv = O(u)), t === "ECDH-ES") {
|
|
2944
2944
|
o = g;
|
|
2945
2945
|
break;
|
|
2946
2946
|
}
|
|
2947
2947
|
o = n || ie(e);
|
|
2948
2948
|
const S = t.slice(-6);
|
|
2949
|
-
s = await
|
|
2949
|
+
s = await ct(S, g, o);
|
|
2950
2950
|
break;
|
|
2951
2951
|
}
|
|
2952
2952
|
case "RSA1_5":
|
|
@@ -2954,7 +2954,7 @@ async function Rr(t, e, r, n, a = {}) {
|
|
|
2954
2954
|
case "RSA-OAEP-256":
|
|
2955
2955
|
case "RSA-OAEP-384":
|
|
2956
2956
|
case "RSA-OAEP-512": {
|
|
2957
|
-
o = n || ie(e), s = await
|
|
2957
|
+
o = n || ie(e), s = await Un(t, r, o);
|
|
2958
2958
|
break;
|
|
2959
2959
|
}
|
|
2960
2960
|
case "PBES2-HS256+A128KW":
|
|
@@ -2962,13 +2962,13 @@ async function Rr(t, e, r, n, a = {}) {
|
|
|
2962
2962
|
case "PBES2-HS512+A256KW": {
|
|
2963
2963
|
o = n || ie(e);
|
|
2964
2964
|
const { p2c: c, p2s: u } = a;
|
|
2965
|
-
({ encryptedKey: s, ...i } = await
|
|
2965
|
+
({ encryptedKey: s, ...i } = await In(t, r, o, c, u));
|
|
2966
2966
|
break;
|
|
2967
2967
|
}
|
|
2968
2968
|
case "A128KW":
|
|
2969
2969
|
case "A192KW":
|
|
2970
2970
|
case "A256KW": {
|
|
2971
|
-
o = n || ie(e), s = await
|
|
2971
|
+
o = n || ie(e), s = await ct(t, r, o);
|
|
2972
2972
|
break;
|
|
2973
2973
|
}
|
|
2974
2974
|
case "A128GCMKW":
|
|
@@ -2976,7 +2976,7 @@ async function Rr(t, e, r, n, a = {}) {
|
|
|
2976
2976
|
case "A256GCMKW": {
|
|
2977
2977
|
o = n || ie(e);
|
|
2978
2978
|
const { iv: c } = a;
|
|
2979
|
-
({ encryptedKey: s, ...i } = await
|
|
2979
|
+
({ encryptedKey: s, ...i } = await Qn(t, r, o, c));
|
|
2980
2980
|
break;
|
|
2981
2981
|
}
|
|
2982
2982
|
default:
|
|
@@ -2984,7 +2984,7 @@ async function Rr(t, e, r, n, a = {}) {
|
|
|
2984
2984
|
}
|
|
2985
2985
|
return { cek: o, encryptedKey: s, parameters: i };
|
|
2986
2986
|
}
|
|
2987
|
-
const
|
|
2987
|
+
const Rr = Symbol();
|
|
2988
2988
|
class Ie {
|
|
2989
2989
|
constructor(e) {
|
|
2990
2990
|
if (!(e instanceof Uint8Array))
|
|
@@ -3054,17 +3054,17 @@ class Ie {
|
|
|
3054
3054
|
let o;
|
|
3055
3055
|
{
|
|
3056
3056
|
let h;
|
|
3057
|
-
({ cek: o, encryptedKey: i, parameters: h } = await
|
|
3057
|
+
({ cek: o, encryptedKey: i, parameters: h } = await Kr(a, s, e, this._cek, this._keyManagementParameters)), h && (r && Rr in r ? this._unprotectedHeader ? this._unprotectedHeader = { ...this._unprotectedHeader, ...h } : this.setUnprotectedHeader(h) : this._protectedHeader ? this._protectedHeader = { ...this._protectedHeader, ...h } : this.setProtectedHeader(h));
|
|
3058
3058
|
}
|
|
3059
|
-
this._iv || (this._iv =
|
|
3059
|
+
this._iv || (this._iv = lr(s));
|
|
3060
3060
|
let c, u, l;
|
|
3061
3061
|
this._protectedHeader ? u = K.encode(O(JSON.stringify(this._protectedHeader))) : u = K.encode(""), this._aad ? (l = O(this._aad), c = Q(u, K.encode("."), K.encode(l))) : c = u;
|
|
3062
3062
|
let f, d;
|
|
3063
3063
|
if (n.zip === "DEF") {
|
|
3064
|
-
const h = await ((r == null ? void 0 : r.deflateRaw) ||
|
|
3065
|
-
({ ciphertext: f, tag: d } = await
|
|
3064
|
+
const h = await ((r == null ? void 0 : r.deflateRaw) || Hn)(this._plaintext);
|
|
3065
|
+
({ ciphertext: f, tag: d } = await lt(s, h, o, this._iv, c));
|
|
3066
3066
|
} else
|
|
3067
|
-
({ ciphertext: f, tag: d } = await
|
|
3067
|
+
({ ciphertext: f, tag: d } = await lt(s, this._plaintext, o, this._iv, c));
|
|
3068
3068
|
const p = {
|
|
3069
3069
|
ciphertext: O(f),
|
|
3070
3070
|
iv: O(this._iv),
|
|
@@ -3073,7 +3073,7 @@ class Ie {
|
|
|
3073
3073
|
return i && (p.encrypted_key = O(i)), l && (p.aad = l), this._protectedHeader && (p.protected = X.decode(u)), this._sharedUnprotectedHeader && (p.unprotected = this._sharedUnprotectedHeader), this._unprotectedHeader && (p.header = this._unprotectedHeader), p;
|
|
3074
3074
|
}
|
|
3075
3075
|
}
|
|
3076
|
-
class
|
|
3076
|
+
class ia {
|
|
3077
3077
|
constructor(e, r, n) {
|
|
3078
3078
|
this.parent = e, this.key = r, this.options = n;
|
|
3079
3079
|
}
|
|
@@ -3092,12 +3092,12 @@ class oa {
|
|
|
3092
3092
|
return this.parent;
|
|
3093
3093
|
}
|
|
3094
3094
|
}
|
|
3095
|
-
class
|
|
3095
|
+
class oa {
|
|
3096
3096
|
constructor(e) {
|
|
3097
3097
|
this._recipients = [], this._plaintext = e;
|
|
3098
3098
|
}
|
|
3099
3099
|
addRecipient(e, r) {
|
|
3100
|
-
const n = new
|
|
3100
|
+
const n = new ia(this, e, { crit: r == null ? void 0 : r.crit });
|
|
3101
3101
|
return this._recipients.push(n), n;
|
|
3102
3102
|
}
|
|
3103
3103
|
setProtectedHeader(e) {
|
|
@@ -3169,18 +3169,18 @@ class ca {
|
|
|
3169
3169
|
const g = await new Ie(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(i).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(u.unprotectedHeader).setKeyManagementParameters({ p2c: d }).encrypt(u.key, {
|
|
3170
3170
|
...u.options,
|
|
3171
3171
|
...e,
|
|
3172
|
-
[
|
|
3172
|
+
[Rr]: !0
|
|
3173
3173
|
});
|
|
3174
3174
|
o.ciphertext = g.ciphertext, o.iv = g.iv, o.tag = g.tag, g.aad && (o.aad = g.aad), g.protected && (o.protected = g.protected), g.unprotected && (o.unprotected = g.unprotected), l.encrypted_key = g.encrypted_key, g.header && (l.header = g.header);
|
|
3175
3175
|
continue;
|
|
3176
3176
|
}
|
|
3177
|
-
const { encryptedKey: p, parameters: h } = await
|
|
3177
|
+
const { encryptedKey: p, parameters: h } = await Kr(((r = u.unprotectedHeader) === null || r === void 0 ? void 0 : r.alg) || ((n = this._protectedHeader) === null || n === void 0 ? void 0 : n.alg) || ((a = this._unprotectedHeader) === null || a === void 0 ? void 0 : a.alg), s, u.key, i, { p2c: d });
|
|
3178
3178
|
l.encrypted_key = O(p), (u.unprotectedHeader || h) && (l.header = { ...u.unprotectedHeader, ...h });
|
|
3179
3179
|
}
|
|
3180
3180
|
return o;
|
|
3181
3181
|
}
|
|
3182
3182
|
}
|
|
3183
|
-
function
|
|
3183
|
+
function Or(t, e) {
|
|
3184
3184
|
const r = `SHA-${t.slice(-3)}`;
|
|
3185
3185
|
switch (t) {
|
|
3186
3186
|
case "HS256":
|
|
@@ -3205,9 +3205,9 @@ function Tr(t, e) {
|
|
|
3205
3205
|
throw new x(`alg ${t} is not supported either by JOSE or your javascript runtime`);
|
|
3206
3206
|
}
|
|
3207
3207
|
}
|
|
3208
|
-
function
|
|
3208
|
+
function Tr(t, e, r) {
|
|
3209
3209
|
if (G(e))
|
|
3210
|
-
return
|
|
3210
|
+
return xn(e, t, r), e;
|
|
3211
3211
|
if (e instanceof Uint8Array) {
|
|
3212
3212
|
if (!t.startsWith("HS"))
|
|
3213
3213
|
throw new TypeError(M(e, ...H));
|
|
@@ -3215,17 +3215,17 @@ function Ir(t, e, r) {
|
|
|
3215
3215
|
}
|
|
3216
3216
|
throw new TypeError(M(e, ...H, "Uint8Array"));
|
|
3217
3217
|
}
|
|
3218
|
-
const
|
|
3219
|
-
const a = await
|
|
3218
|
+
const ca = async (t, e, r, n) => {
|
|
3219
|
+
const a = await Tr(t, e, "verify");
|
|
3220
3220
|
Ne(t, a);
|
|
3221
|
-
const s =
|
|
3221
|
+
const s = Or(t, a.algorithm);
|
|
3222
3222
|
try {
|
|
3223
3223
|
return await b.subtle.verify(s, a, r, n);
|
|
3224
3224
|
} catch {
|
|
3225
3225
|
return !1;
|
|
3226
3226
|
}
|
|
3227
3227
|
};
|
|
3228
|
-
async function
|
|
3228
|
+
async function bt(t, e, r) {
|
|
3229
3229
|
var n;
|
|
3230
3230
|
if (!I(t))
|
|
3231
3231
|
throw new P("Flattened JWS must be an object");
|
|
@@ -3259,7 +3259,7 @@ async function vt(t, e, r) {
|
|
|
3259
3259
|
const { alg: c } = s;
|
|
3260
3260
|
if (typeof c != "string" || !c)
|
|
3261
3261
|
throw new P('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
3262
|
-
const u = r &&
|
|
3262
|
+
const u = r && dt("algorithms", r.algorithms);
|
|
3263
3263
|
if (u && !u.has(c))
|
|
3264
3264
|
throw new Re('"alg" (Algorithm) Header Parameter not allowed');
|
|
3265
3265
|
if (o) {
|
|
@@ -3276,8 +3276,8 @@ async function vt(t, e, r) {
|
|
|
3276
3276
|
} catch {
|
|
3277
3277
|
throw new P("Failed to base64url decode the signature");
|
|
3278
3278
|
}
|
|
3279
|
-
if (!await
|
|
3280
|
-
throw new
|
|
3279
|
+
if (!await ca(c, e, d, f))
|
|
3280
|
+
throw new yt();
|
|
3281
3281
|
let h;
|
|
3282
3282
|
if (o)
|
|
3283
3283
|
try {
|
|
@@ -3290,23 +3290,23 @@ async function vt(t, e, r) {
|
|
|
3290
3290
|
const g = { payload: h };
|
|
3291
3291
|
return t.protected !== void 0 && (g.protectedHeader = a), t.header !== void 0 && (g.unprotectedHeader = t.header), l ? { ...g, key: e } : g;
|
|
3292
3292
|
}
|
|
3293
|
-
async function
|
|
3293
|
+
async function Ir(t, e, r) {
|
|
3294
3294
|
if (t instanceof Uint8Array && (t = X.decode(t)), typeof t != "string")
|
|
3295
3295
|
throw new P("Compact JWS must be a string or Uint8Array");
|
|
3296
3296
|
const { 0: n, 1: a, 2: s, length: i } = t.split(".");
|
|
3297
3297
|
if (i !== 3)
|
|
3298
3298
|
throw new P("Invalid Compact JWS");
|
|
3299
|
-
const o = await
|
|
3299
|
+
const o = await bt({ payload: a, protected: n, signature: s }, e, r), c = { payload: o.payload, protectedHeader: o.protectedHeader };
|
|
3300
3300
|
return typeof e == "function" ? { ...c, key: o.key } : c;
|
|
3301
3301
|
}
|
|
3302
|
-
async function
|
|
3302
|
+
async function ua(t, e, r) {
|
|
3303
3303
|
if (!I(t))
|
|
3304
3304
|
throw new P("General JWS must be an object");
|
|
3305
3305
|
if (!Array.isArray(t.signatures) || !t.signatures.every(I))
|
|
3306
3306
|
throw new P("JWS Signatures missing or incorrect type");
|
|
3307
3307
|
for (const n of t.signatures)
|
|
3308
3308
|
try {
|
|
3309
|
-
return await
|
|
3309
|
+
return await bt({
|
|
3310
3310
|
header: n.header,
|
|
3311
3311
|
payload: t.payload,
|
|
3312
3312
|
protected: n.protected,
|
|
@@ -3314,10 +3314,10 @@ async function la(t, e, r) {
|
|
|
3314
3314
|
}, e, r);
|
|
3315
3315
|
} catch {
|
|
3316
3316
|
}
|
|
3317
|
-
throw new
|
|
3317
|
+
throw new yt();
|
|
3318
3318
|
}
|
|
3319
|
-
const Ae = (t) => Math.floor(t.getTime() / 1e3),
|
|
3320
|
-
const e =
|
|
3319
|
+
const Ae = (t) => Math.floor(t.getTime() / 1e3), Wr = 60, Ur = Wr * 60, vt = Ur * 24, la = vt * 7, da = vt * 365.25, fa = /^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i, We = (t) => {
|
|
3320
|
+
const e = fa.exec(t);
|
|
3321
3321
|
if (!e)
|
|
3322
3322
|
throw new TypeError("Invalid time period format");
|
|
3323
3323
|
const r = parseFloat(e[1]);
|
|
@@ -3333,27 +3333,27 @@ const Ae = (t) => Math.floor(t.getTime() / 1e3), Ur = 60, Lr = Ur * 60, Et = Lr
|
|
|
3333
3333
|
case "min":
|
|
3334
3334
|
case "mins":
|
|
3335
3335
|
case "m":
|
|
3336
|
-
return Math.round(r *
|
|
3336
|
+
return Math.round(r * Wr);
|
|
3337
3337
|
case "hour":
|
|
3338
3338
|
case "hours":
|
|
3339
3339
|
case "hr":
|
|
3340
3340
|
case "hrs":
|
|
3341
3341
|
case "h":
|
|
3342
|
-
return Math.round(r *
|
|
3342
|
+
return Math.round(r * Ur);
|
|
3343
3343
|
case "day":
|
|
3344
3344
|
case "days":
|
|
3345
3345
|
case "d":
|
|
3346
|
-
return Math.round(r *
|
|
3346
|
+
return Math.round(r * vt);
|
|
3347
3347
|
case "week":
|
|
3348
3348
|
case "weeks":
|
|
3349
3349
|
case "w":
|
|
3350
|
-
return Math.round(r *
|
|
3350
|
+
return Math.round(r * la);
|
|
3351
3351
|
default:
|
|
3352
|
-
return Math.round(r *
|
|
3352
|
+
return Math.round(r * da);
|
|
3353
3353
|
}
|
|
3354
|
-
},
|
|
3354
|
+
}, Mt = (t) => t.toLowerCase().replace(/^application\//, ""), ha = (t, e) => typeof t == "string" ? e.includes(t) : Array.isArray(t) ? e.some(Set.prototype.has.bind(new Set(t))) : !1, Et = (t, e, r = {}) => {
|
|
3355
3355
|
const { typ: n } = r;
|
|
3356
|
-
if (n && (typeof t.typ != "string" ||
|
|
3356
|
+
if (n && (typeof t.typ != "string" || Mt(t.typ) !== Mt(n)))
|
|
3357
3357
|
throw new V('unexpected "typ" JWT header value', "typ", "check_failed");
|
|
3358
3358
|
let a;
|
|
3359
3359
|
try {
|
|
@@ -3371,7 +3371,7 @@ const Ae = (t) => Math.floor(t.getTime() / 1e3), Ur = 60, Lr = Ur * 60, Et = Lr
|
|
|
3371
3371
|
throw new V('unexpected "iss" claim value', "iss", "check_failed");
|
|
3372
3372
|
if (o && a.sub !== o)
|
|
3373
3373
|
throw new V('unexpected "sub" claim value', "sub", "check_failed");
|
|
3374
|
-
if (c && !
|
|
3374
|
+
if (c && !ha(a.aud, typeof c == "string" ? [c] : c))
|
|
3375
3375
|
throw new V('unexpected "aud" claim value', "aud", "check_failed");
|
|
3376
3376
|
let l;
|
|
3377
3377
|
switch (typeof r.clockTolerance) {
|
|
@@ -3400,27 +3400,27 @@ const Ae = (t) => Math.floor(t.getTime() / 1e3), Ur = 60, Lr = Ur * 60, Et = Lr
|
|
|
3400
3400
|
if (typeof a.exp != "number")
|
|
3401
3401
|
throw new V('"exp" claim must be a number', "exp", "invalid");
|
|
3402
3402
|
if (a.exp <= d - l)
|
|
3403
|
-
throw new
|
|
3403
|
+
throw new ot('"exp" claim timestamp check failed', "exp", "check_failed");
|
|
3404
3404
|
}
|
|
3405
3405
|
if (u) {
|
|
3406
3406
|
const p = d - a.iat, h = typeof u == "number" ? u : We(u);
|
|
3407
3407
|
if (p - l > h)
|
|
3408
|
-
throw new
|
|
3408
|
+
throw new ot('"iat" claim timestamp check failed (too far in the past)', "iat", "check_failed");
|
|
3409
3409
|
if (p < 0 - l)
|
|
3410
3410
|
throw new V('"iat" claim timestamp check failed (it should be in the past)', "iat", "check_failed");
|
|
3411
3411
|
}
|
|
3412
3412
|
return a;
|
|
3413
3413
|
};
|
|
3414
|
-
async function
|
|
3414
|
+
async function pa(t, e, r) {
|
|
3415
3415
|
var n;
|
|
3416
|
-
const a = await
|
|
3416
|
+
const a = await Ir(t, e, r);
|
|
3417
3417
|
if (!((n = a.protectedHeader.crit) === null || n === void 0) && n.includes("b64") && a.protectedHeader.b64 === !1)
|
|
3418
3418
|
throw new B("JWTs MUST NOT use unencoded payload");
|
|
3419
|
-
const i = { payload:
|
|
3419
|
+
const i = { payload: Et(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
|
|
3420
3420
|
return typeof e == "function" ? { ...i, key: a.key } : i;
|
|
3421
3421
|
}
|
|
3422
|
-
async function
|
|
3423
|
-
const n = await
|
|
3422
|
+
async function ga(t, e, r) {
|
|
3423
|
+
const n = await Pr(t, e, r), a = Et(n.protectedHeader, n.plaintext, r), { protectedHeader: s } = n;
|
|
3424
3424
|
if (s.iss !== void 0 && s.iss !== a.iss)
|
|
3425
3425
|
throw new V('replicated "iss" claim header parameter mismatch', "iss", "mismatch");
|
|
3426
3426
|
if (s.sub !== void 0 && s.sub !== a.sub)
|
|
@@ -3430,7 +3430,7 @@ async function ma(t, e, r) {
|
|
|
3430
3430
|
const i = { payload: a, protectedHeader: s };
|
|
3431
3431
|
return typeof e == "function" ? { ...i, key: n.key } : i;
|
|
3432
3432
|
}
|
|
3433
|
-
class
|
|
3433
|
+
class Lr {
|
|
3434
3434
|
constructor(e) {
|
|
3435
3435
|
this._flattened = new Ie(e);
|
|
3436
3436
|
}
|
|
@@ -3451,13 +3451,13 @@ class Dr {
|
|
|
3451
3451
|
return [n.protected, n.encrypted_key, n.iv, n.ciphertext, n.tag].join(".");
|
|
3452
3452
|
}
|
|
3453
3453
|
}
|
|
3454
|
-
const
|
|
3455
|
-
const n = await
|
|
3454
|
+
const ma = async (t, e, r) => {
|
|
3455
|
+
const n = await Tr(t, e, "sign");
|
|
3456
3456
|
Ne(t, n);
|
|
3457
|
-
const a = await b.subtle.sign(
|
|
3457
|
+
const a = await b.subtle.sign(Or(t, n.algorithm), n, r);
|
|
3458
3458
|
return new Uint8Array(a);
|
|
3459
3459
|
};
|
|
3460
|
-
class
|
|
3460
|
+
class At {
|
|
3461
3461
|
constructor(e) {
|
|
3462
3462
|
if (!(e instanceof Uint8Array))
|
|
3463
3463
|
throw new TypeError("payload must be an instance of Uint8Array");
|
|
@@ -3493,16 +3493,16 @@ class xt {
|
|
|
3493
3493
|
s && (o = K.encode(O(o)));
|
|
3494
3494
|
let c;
|
|
3495
3495
|
this._protectedHeader ? c = K.encode(O(JSON.stringify(this._protectedHeader))) : c = K.encode("");
|
|
3496
|
-
const u = Q(c, K.encode("."), o), l = await
|
|
3496
|
+
const u = Q(c, K.encode("."), o), l = await ma(i, e, u), f = {
|
|
3497
3497
|
signature: O(l),
|
|
3498
3498
|
payload: ""
|
|
3499
3499
|
};
|
|
3500
3500
|
return s && (f.payload = X.decode(o)), this._unprotectedHeader && (f.header = this._unprotectedHeader), this._protectedHeader && (f.protected = X.decode(c)), f;
|
|
3501
3501
|
}
|
|
3502
3502
|
}
|
|
3503
|
-
class
|
|
3503
|
+
class Dr {
|
|
3504
3504
|
constructor(e) {
|
|
3505
|
-
this._flattened = new
|
|
3505
|
+
this._flattened = new At(e);
|
|
3506
3506
|
}
|
|
3507
3507
|
setProtectedHeader(e) {
|
|
3508
3508
|
return this._flattened.setProtectedHeader(e), this;
|
|
@@ -3514,7 +3514,7 @@ class Jr {
|
|
|
3514
3514
|
return `${n.protected}.${n.payload}.${n.signature}`;
|
|
3515
3515
|
}
|
|
3516
3516
|
}
|
|
3517
|
-
class
|
|
3517
|
+
class ya {
|
|
3518
3518
|
constructor(e, r, n) {
|
|
3519
3519
|
this.parent = e, this.key = r, this.options = n;
|
|
3520
3520
|
}
|
|
@@ -3538,12 +3538,12 @@ class wa {
|
|
|
3538
3538
|
return this.parent;
|
|
3539
3539
|
}
|
|
3540
3540
|
}
|
|
3541
|
-
class
|
|
3541
|
+
class wa {
|
|
3542
3542
|
constructor(e) {
|
|
3543
3543
|
this._signatures = [], this._payload = e;
|
|
3544
3544
|
}
|
|
3545
3545
|
addSignature(e, r) {
|
|
3546
|
-
const n = new
|
|
3546
|
+
const n = new ya(this, e, r);
|
|
3547
3547
|
return this._signatures.push(n), n;
|
|
3548
3548
|
}
|
|
3549
3549
|
async sign() {
|
|
@@ -3554,7 +3554,7 @@ class Sa {
|
|
|
3554
3554
|
payload: ""
|
|
3555
3555
|
};
|
|
3556
3556
|
for (let r = 0; r < this._signatures.length; r++) {
|
|
3557
|
-
const n = this._signatures[r], a = new
|
|
3557
|
+
const n = this._signatures[r], a = new At(this._payload);
|
|
3558
3558
|
a.setProtectedHeader(n.protectedHeader), a.setUnprotectedHeader(n.unprotectedHeader);
|
|
3559
3559
|
const { payload: s, ...i } = await a.sign(n.key, n.options);
|
|
3560
3560
|
if (r === 0)
|
|
@@ -3566,7 +3566,7 @@ class Sa {
|
|
|
3566
3566
|
return e;
|
|
3567
3567
|
}
|
|
3568
3568
|
}
|
|
3569
|
-
class
|
|
3569
|
+
class xt {
|
|
3570
3570
|
constructor(e) {
|
|
3571
3571
|
if (!I(e))
|
|
3572
3572
|
throw new TypeError("JWT Claims Set MUST be an object");
|
|
@@ -3594,19 +3594,19 @@ class Ct {
|
|
|
3594
3594
|
return typeof e > "u" ? this._payload = { ...this._payload, iat: Ae(/* @__PURE__ */ new Date()) } : this._payload = { ...this._payload, iat: e }, this;
|
|
3595
3595
|
}
|
|
3596
3596
|
}
|
|
3597
|
-
class
|
|
3597
|
+
class Sa extends xt {
|
|
3598
3598
|
setProtectedHeader(e) {
|
|
3599
3599
|
return this._protectedHeader = e, this;
|
|
3600
3600
|
}
|
|
3601
3601
|
async sign(e, r) {
|
|
3602
3602
|
var n;
|
|
3603
|
-
const a = new
|
|
3603
|
+
const a = new Dr(K.encode(JSON.stringify(this._payload)));
|
|
3604
3604
|
if (a.setProtectedHeader(this._protectedHeader), Array.isArray((n = this._protectedHeader) === null || n === void 0 ? void 0 : n.crit) && this._protectedHeader.crit.includes("b64") && this._protectedHeader.b64 === !1)
|
|
3605
3605
|
throw new B("JWTs MUST NOT use unencoded payload");
|
|
3606
3606
|
return a.sign(e, r);
|
|
3607
3607
|
}
|
|
3608
3608
|
}
|
|
3609
|
-
class
|
|
3609
|
+
class ba extends xt {
|
|
3610
3610
|
setProtectedHeader(e) {
|
|
3611
3611
|
if (this._protectedHeader)
|
|
3612
3612
|
throw new TypeError("setProtectedHeader can only be called once");
|
|
@@ -3637,15 +3637,15 @@ class va extends Ct {
|
|
|
3637
3637
|
return this._replicateAudienceAsHeader = !0, this;
|
|
3638
3638
|
}
|
|
3639
3639
|
async encrypt(e, r) {
|
|
3640
|
-
const n = new
|
|
3640
|
+
const n = new Lr(K.encode(JSON.stringify(this._payload)));
|
|
3641
3641
|
return this._replicateIssuerAsHeader && (this._protectedHeader = { ...this._protectedHeader, iss: this._payload.iss }), this._replicateSubjectAsHeader && (this._protectedHeader = { ...this._protectedHeader, sub: this._payload.sub }), this._replicateAudienceAsHeader && (this._protectedHeader = { ...this._protectedHeader, aud: this._payload.aud }), n.setProtectedHeader(this._protectedHeader), this._iv && n.setInitializationVector(this._iv), this._cek && n.setContentEncryptionKey(this._cek), this._keyManagementParameters && n.setKeyManagementParameters(this._keyManagementParameters), n.encrypt(e, r);
|
|
3642
3642
|
}
|
|
3643
3643
|
}
|
|
3644
3644
|
const ee = (t, e) => {
|
|
3645
3645
|
if (typeof t != "string" || !t)
|
|
3646
|
-
throw new
|
|
3646
|
+
throw new ir(`${e} missing or invalid`);
|
|
3647
3647
|
};
|
|
3648
|
-
async function
|
|
3648
|
+
async function Jr(t, e) {
|
|
3649
3649
|
if (!I(t))
|
|
3650
3650
|
throw new TypeError("JWK must be an object");
|
|
3651
3651
|
if (e ?? (e = "sha256"), e !== "sha256" && e !== "sha384" && e !== "sha512")
|
|
@@ -3668,14 +3668,14 @@ async function Nr(t, e) {
|
|
|
3668
3668
|
throw new x('"kty" (Key Type) Parameter missing or unsupported');
|
|
3669
3669
|
}
|
|
3670
3670
|
const n = K.encode(JSON.stringify(r));
|
|
3671
|
-
return O(await
|
|
3671
|
+
return O(await nr(e, n));
|
|
3672
3672
|
}
|
|
3673
|
-
async function
|
|
3673
|
+
async function va(t, e) {
|
|
3674
3674
|
e ?? (e = "sha256");
|
|
3675
|
-
const r = await
|
|
3675
|
+
const r = await Jr(t, e);
|
|
3676
3676
|
return `urn:ietf:params:oauth:jwk-thumbprint:sha-${e.slice(-3)}:${r}`;
|
|
3677
3677
|
}
|
|
3678
|
-
async function
|
|
3678
|
+
async function Ea(t, e) {
|
|
3679
3679
|
const r = {
|
|
3680
3680
|
...t,
|
|
3681
3681
|
...e == null ? void 0 : e.header
|
|
@@ -3687,7 +3687,7 @@ async function Aa(t, e) {
|
|
|
3687
3687
|
throw new P('"jwk" (JSON Web Key) Header Parameter must be a public key');
|
|
3688
3688
|
return n;
|
|
3689
3689
|
}
|
|
3690
|
-
function
|
|
3690
|
+
function Aa(t) {
|
|
3691
3691
|
switch (typeof t == "string" && t.slice(0, 2)) {
|
|
3692
3692
|
case "RS":
|
|
3693
3693
|
case "PS":
|
|
@@ -3700,23 +3700,23 @@ function xa(t) {
|
|
|
3700
3700
|
throw new x('Unsupported "alg" value for a JSON Web Key Set');
|
|
3701
3701
|
}
|
|
3702
3702
|
}
|
|
3703
|
-
function
|
|
3704
|
-
return t && typeof t == "object" && Array.isArray(t.keys) && t.keys.every(
|
|
3703
|
+
function Nr(t) {
|
|
3704
|
+
return t && typeof t == "object" && Array.isArray(t.keys) && t.keys.every(xa);
|
|
3705
3705
|
}
|
|
3706
|
-
function
|
|
3706
|
+
function xa(t) {
|
|
3707
3707
|
return I(t);
|
|
3708
3708
|
}
|
|
3709
|
-
function
|
|
3709
|
+
function Ca(t) {
|
|
3710
3710
|
return typeof structuredClone == "function" ? structuredClone(t) : JSON.parse(JSON.stringify(t));
|
|
3711
3711
|
}
|
|
3712
|
-
class
|
|
3712
|
+
class $r {
|
|
3713
3713
|
constructor(e) {
|
|
3714
|
-
if (this._cached = /* @__PURE__ */ new WeakMap(),
|
|
3714
|
+
if (this._cached = /* @__PURE__ */ new WeakMap(), !Nr(e))
|
|
3715
3715
|
throw new Le("JSON Web Key Set malformed");
|
|
3716
|
-
this._jwks =
|
|
3716
|
+
this._jwks = Ca(e);
|
|
3717
3717
|
}
|
|
3718
3718
|
async getKey(e, r) {
|
|
3719
|
-
const { alg: n, kid: a } = { ...e, ...r == null ? void 0 : r.header }, s =
|
|
3719
|
+
const { alg: n, kid: a } = { ...e, ...r == null ? void 0 : r.header }, s = Aa(n), i = this._jwks.keys.filter((u) => {
|
|
3720
3720
|
let l = s === u.kty;
|
|
3721
3721
|
if (l && typeof a == "string" && (l = a === u.kid), l && typeof u.alg == "string" && (l = n === u.alg), l && typeof u.use == "string" && (l = u.use === "sig"), l && Array.isArray(u.key_ops) && (l = u.key_ops.includes("verify")), l && n === "EdDSA" && (l = u.crv === "Ed25519" || u.crv === "Ed448"), l)
|
|
3722
3722
|
switch (n) {
|
|
@@ -3736,22 +3736,22 @@ class Mr {
|
|
|
3736
3736
|
return l;
|
|
3737
3737
|
}), { 0: o, length: c } = i;
|
|
3738
3738
|
if (c === 0)
|
|
3739
|
-
throw new
|
|
3739
|
+
throw new mt();
|
|
3740
3740
|
if (c !== 1) {
|
|
3741
|
-
const u = new
|
|
3741
|
+
const u = new or(), { _cached: l } = this;
|
|
3742
3742
|
throw u[Symbol.asyncIterator] = async function* () {
|
|
3743
3743
|
for (const f of i)
|
|
3744
3744
|
try {
|
|
3745
|
-
yield await
|
|
3745
|
+
yield await kt(l, f, n);
|
|
3746
3746
|
} catch {
|
|
3747
3747
|
continue;
|
|
3748
3748
|
}
|
|
3749
3749
|
}, u;
|
|
3750
3750
|
}
|
|
3751
|
-
return
|
|
3751
|
+
return kt(this._cached, o, n);
|
|
3752
3752
|
}
|
|
3753
3753
|
}
|
|
3754
|
-
async function
|
|
3754
|
+
async function kt(t, e, r) {
|
|
3755
3755
|
const n = t.get(e) || t.set(e, {}).get(e);
|
|
3756
3756
|
if (n[r] === void 0) {
|
|
3757
3757
|
const a = await $e({ ...e, ext: !0 }, r);
|
|
@@ -3761,13 +3761,13 @@ async function Ft(t, e, r) {
|
|
|
3761
3761
|
}
|
|
3762
3762
|
return n[r];
|
|
3763
3763
|
}
|
|
3764
|
-
function
|
|
3765
|
-
const e = new
|
|
3764
|
+
function _a(t) {
|
|
3765
|
+
const e = new $r(t);
|
|
3766
3766
|
return async function(r, n) {
|
|
3767
3767
|
return e.getKey(r, n);
|
|
3768
3768
|
};
|
|
3769
3769
|
}
|
|
3770
|
-
const
|
|
3770
|
+
const Pa = async (t, e, r) => {
|
|
3771
3771
|
let n, a, s = !1;
|
|
3772
3772
|
typeof AbortController == "function" && (n = new AbortController(), a = setTimeout(() => {
|
|
3773
3773
|
s = !0, n.abort();
|
|
@@ -3777,7 +3777,7 @@ const Ha = async (t, e, r) => {
|
|
|
3777
3777
|
redirect: "manual",
|
|
3778
3778
|
headers: r.headers
|
|
3779
3779
|
}).catch((o) => {
|
|
3780
|
-
throw s ? new
|
|
3780
|
+
throw s ? new cr() : o;
|
|
3781
3781
|
});
|
|
3782
3782
|
if (a !== void 0 && clearTimeout(a), i.status !== 200)
|
|
3783
3783
|
throw new L("Expected 200 OK from the JSON Web Key Set HTTP response");
|
|
@@ -3787,10 +3787,10 @@ const Ha = async (t, e, r) => {
|
|
|
3787
3787
|
throw new L("Failed to parse the JSON Web Key Set HTTP response as JSON");
|
|
3788
3788
|
}
|
|
3789
3789
|
};
|
|
3790
|
-
function
|
|
3790
|
+
function Ha() {
|
|
3791
3791
|
return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
|
|
3792
3792
|
}
|
|
3793
|
-
class
|
|
3793
|
+
class Ka extends $r {
|
|
3794
3794
|
constructor(e, r) {
|
|
3795
3795
|
if (super({ keys: [] }), this._jwks = void 0, !(e instanceof URL))
|
|
3796
3796
|
throw new TypeError("url must be an instance of URL");
|
|
@@ -3807,14 +3807,14 @@ class Ra extends Mr {
|
|
|
3807
3807
|
try {
|
|
3808
3808
|
return await super.getKey(e, r);
|
|
3809
3809
|
} catch (n) {
|
|
3810
|
-
if (n instanceof
|
|
3810
|
+
if (n instanceof mt && this.coolingDown() === !1)
|
|
3811
3811
|
return await this.reload(), super.getKey(e, r);
|
|
3812
3812
|
throw n;
|
|
3813
3813
|
}
|
|
3814
3814
|
}
|
|
3815
3815
|
async reload() {
|
|
3816
|
-
this._pendingFetch &&
|
|
3817
|
-
if (
|
|
3816
|
+
this._pendingFetch && Ha() && (this._pendingFetch = void 0), this._pendingFetch || (this._pendingFetch = Pa(this._url, this._timeoutDuration, this._options).then((e) => {
|
|
3817
|
+
if (!Nr(e))
|
|
3818
3818
|
throw new Le("JSON Web Key Set malformed");
|
|
3819
3819
|
this._jwks = { keys: e.keys }, this._jwksTimestamp = Date.now(), this._pendingFetch = void 0;
|
|
3820
3820
|
}).catch((e) => {
|
|
@@ -3822,13 +3822,13 @@ class Ra extends Mr {
|
|
|
3822
3822
|
})), await this._pendingFetch;
|
|
3823
3823
|
}
|
|
3824
3824
|
}
|
|
3825
|
-
function
|
|
3826
|
-
const r = new
|
|
3825
|
+
function Ra(t, e) {
|
|
3826
|
+
const r = new Ka(t, e);
|
|
3827
3827
|
return async function(n, a) {
|
|
3828
3828
|
return r.getKey(n, a);
|
|
3829
3829
|
};
|
|
3830
3830
|
}
|
|
3831
|
-
class
|
|
3831
|
+
class Oa extends xt {
|
|
3832
3832
|
encode() {
|
|
3833
3833
|
const e = O(JSON.stringify({ alg: "none" })), r = O(JSON.stringify(this._payload));
|
|
3834
3834
|
return `${e}.${r}.`;
|
|
@@ -3846,15 +3846,15 @@ class Ta extends Ct {
|
|
|
3846
3846
|
} catch {
|
|
3847
3847
|
throw new B("Invalid Unsecured JWT");
|
|
3848
3848
|
}
|
|
3849
|
-
return { payload:
|
|
3849
|
+
return { payload: Et(o, T(a), r), header: o };
|
|
3850
3850
|
}
|
|
3851
3851
|
}
|
|
3852
|
-
const
|
|
3852
|
+
const Ta = O, Ct = T, Ia = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3853
3853
|
__proto__: null,
|
|
3854
|
-
decode:
|
|
3855
|
-
encode:
|
|
3854
|
+
decode: Ct,
|
|
3855
|
+
encode: Ta
|
|
3856
3856
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3857
|
-
function
|
|
3857
|
+
function Wa(t) {
|
|
3858
3858
|
let e;
|
|
3859
3859
|
if (typeof t == "string") {
|
|
3860
3860
|
const r = t.split(".");
|
|
@@ -3867,7 +3867,7 @@ function Ua(t) {
|
|
|
3867
3867
|
try {
|
|
3868
3868
|
if (typeof e != "string" || !e)
|
|
3869
3869
|
throw new Error();
|
|
3870
|
-
const r = JSON.parse(X.decode(
|
|
3870
|
+
const r = JSON.parse(X.decode(Ct(e)));
|
|
3871
3871
|
if (!I(r))
|
|
3872
3872
|
throw new Error();
|
|
3873
3873
|
return r;
|
|
@@ -3875,7 +3875,7 @@ function Ua(t) {
|
|
|
3875
3875
|
throw new TypeError("Invalid Token or Protected Header formatting");
|
|
3876
3876
|
}
|
|
3877
3877
|
}
|
|
3878
|
-
function
|
|
3878
|
+
function Ua(t) {
|
|
3879
3879
|
if (typeof t != "string")
|
|
3880
3880
|
throw new B("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
3881
3881
|
const { 1: e, length: r } = t.split(".");
|
|
@@ -3887,7 +3887,7 @@ function La(t) {
|
|
|
3887
3887
|
throw new B("JWTs must contain a payload");
|
|
3888
3888
|
let n;
|
|
3889
3889
|
try {
|
|
3890
|
-
n =
|
|
3890
|
+
n = Ct(e);
|
|
3891
3891
|
} catch {
|
|
3892
3892
|
throw new B("Failed to base64url decode the payload");
|
|
3893
3893
|
}
|
|
@@ -3901,7 +3901,7 @@ function La(t) {
|
|
|
3901
3901
|
throw new B("Invalid JWT Claims Set");
|
|
3902
3902
|
return a;
|
|
3903
3903
|
}
|
|
3904
|
-
async function
|
|
3904
|
+
async function La(t, e) {
|
|
3905
3905
|
var r;
|
|
3906
3906
|
let n, a, s;
|
|
3907
3907
|
switch (t) {
|
|
@@ -3932,14 +3932,14 @@ async function Da(t, e) {
|
|
|
3932
3932
|
}
|
|
3933
3933
|
return b.subtle.generateKey(a, (r = e == null ? void 0 : e.extractable) !== null && r !== void 0 ? r : !1, s);
|
|
3934
3934
|
}
|
|
3935
|
-
function
|
|
3935
|
+
function qe(t) {
|
|
3936
3936
|
var e;
|
|
3937
3937
|
const r = (e = t == null ? void 0 : t.modulusLength) !== null && e !== void 0 ? e : 2048;
|
|
3938
3938
|
if (typeof r != "number" || r < 2048)
|
|
3939
3939
|
throw new x("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");
|
|
3940
3940
|
return r;
|
|
3941
3941
|
}
|
|
3942
|
-
async function
|
|
3942
|
+
async function Da(t, e) {
|
|
3943
3943
|
var r, n, a;
|
|
3944
3944
|
let s, i;
|
|
3945
3945
|
switch (t) {
|
|
@@ -3950,7 +3950,7 @@ async function Ja(t, e) {
|
|
|
3950
3950
|
name: "RSA-PSS",
|
|
3951
3951
|
hash: `SHA-${t.slice(-3)}`,
|
|
3952
3952
|
publicExponent: new Uint8Array([1, 0, 1]),
|
|
3953
|
-
modulusLength:
|
|
3953
|
+
modulusLength: qe(e)
|
|
3954
3954
|
}, i = ["sign", "verify"];
|
|
3955
3955
|
break;
|
|
3956
3956
|
case "RS256":
|
|
@@ -3960,7 +3960,7 @@ async function Ja(t, e) {
|
|
|
3960
3960
|
name: "RSASSA-PKCS1-v1_5",
|
|
3961
3961
|
hash: `SHA-${t.slice(-3)}`,
|
|
3962
3962
|
publicExponent: new Uint8Array([1, 0, 1]),
|
|
3963
|
-
modulusLength:
|
|
3963
|
+
modulusLength: qe(e)
|
|
3964
3964
|
}, i = ["sign", "verify"];
|
|
3965
3965
|
break;
|
|
3966
3966
|
case "RSA-OAEP":
|
|
@@ -3971,7 +3971,7 @@ async function Ja(t, e) {
|
|
|
3971
3971
|
name: "RSA-OAEP",
|
|
3972
3972
|
hash: `SHA-${parseInt(t.slice(-3), 10) || 1}`,
|
|
3973
3973
|
publicExponent: new Uint8Array([1, 0, 1]),
|
|
3974
|
-
modulusLength:
|
|
3974
|
+
modulusLength: qe(e)
|
|
3975
3975
|
}, i = ["decrypt", "unwrapKey", "encrypt", "wrapKey"];
|
|
3976
3976
|
break;
|
|
3977
3977
|
case "ES256":
|
|
@@ -4022,51 +4022,51 @@ async function Ja(t, e) {
|
|
|
4022
4022
|
}
|
|
4023
4023
|
return b.subtle.generateKey(s, (a = e == null ? void 0 : e.extractable) !== null && a !== void 0 ? a : !1, i);
|
|
4024
4024
|
}
|
|
4025
|
-
async function
|
|
4026
|
-
return Ja(t, e);
|
|
4027
|
-
}
|
|
4028
|
-
async function $a(t, e) {
|
|
4025
|
+
async function Ja(t, e) {
|
|
4029
4026
|
return Da(t, e);
|
|
4030
4027
|
}
|
|
4031
|
-
|
|
4028
|
+
async function Na(t, e) {
|
|
4029
|
+
return La(t, e);
|
|
4030
|
+
}
|
|
4031
|
+
const $a = "WebCryptoAPI", Ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4032
4032
|
__proto__: null,
|
|
4033
|
-
CompactEncrypt:
|
|
4034
|
-
CompactSign:
|
|
4035
|
-
EmbeddedJWK:
|
|
4036
|
-
EncryptJWT:
|
|
4033
|
+
CompactEncrypt: Lr,
|
|
4034
|
+
CompactSign: Dr,
|
|
4035
|
+
EmbeddedJWK: Ea,
|
|
4036
|
+
EncryptJWT: ba,
|
|
4037
4037
|
FlattenedEncrypt: Ie,
|
|
4038
|
-
FlattenedSign:
|
|
4039
|
-
GeneralEncrypt:
|
|
4040
|
-
GeneralSign:
|
|
4041
|
-
SignJWT:
|
|
4042
|
-
UnsecuredJWT:
|
|
4043
|
-
base64url:
|
|
4044
|
-
calculateJwkThumbprint:
|
|
4045
|
-
calculateJwkThumbprintUri:
|
|
4046
|
-
compactDecrypt:
|
|
4047
|
-
compactVerify:
|
|
4048
|
-
createLocalJWKSet:
|
|
4049
|
-
createRemoteJWKSet:
|
|
4050
|
-
cryptoRuntime:
|
|
4051
|
-
decodeJwt:
|
|
4052
|
-
decodeProtectedHeader:
|
|
4053
|
-
errors:
|
|
4054
|
-
exportJWK:
|
|
4055
|
-
exportPKCS8:
|
|
4056
|
-
exportSPKI:
|
|
4057
|
-
flattenedDecrypt:
|
|
4058
|
-
flattenedVerify:
|
|
4059
|
-
generalDecrypt:
|
|
4060
|
-
generalVerify:
|
|
4061
|
-
generateKeyPair:
|
|
4062
|
-
generateSecret:
|
|
4038
|
+
FlattenedSign: At,
|
|
4039
|
+
GeneralEncrypt: oa,
|
|
4040
|
+
GeneralSign: wa,
|
|
4041
|
+
SignJWT: Sa,
|
|
4042
|
+
UnsecuredJWT: Oa,
|
|
4043
|
+
base64url: Ia,
|
|
4044
|
+
calculateJwkThumbprint: Jr,
|
|
4045
|
+
calculateJwkThumbprintUri: va,
|
|
4046
|
+
compactDecrypt: Pr,
|
|
4047
|
+
compactVerify: Ir,
|
|
4048
|
+
createLocalJWKSet: _a,
|
|
4049
|
+
createRemoteJWKSet: Ra,
|
|
4050
|
+
cryptoRuntime: $a,
|
|
4051
|
+
decodeJwt: Ua,
|
|
4052
|
+
decodeProtectedHeader: Wa,
|
|
4053
|
+
errors: vn,
|
|
4054
|
+
exportJWK: Hr,
|
|
4055
|
+
exportPKCS8: sa,
|
|
4056
|
+
exportSPKI: aa,
|
|
4057
|
+
flattenedDecrypt: St,
|
|
4058
|
+
flattenedVerify: bt,
|
|
4059
|
+
generalDecrypt: ta,
|
|
4060
|
+
generalVerify: ua,
|
|
4061
|
+
generateKeyPair: Ja,
|
|
4062
|
+
generateSecret: Na,
|
|
4063
4063
|
importJWK: $e,
|
|
4064
|
-
importPKCS8:
|
|
4065
|
-
importSPKI:
|
|
4066
|
-
importX509:
|
|
4067
|
-
jwtDecrypt:
|
|
4068
|
-
jwtVerify:
|
|
4069
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4064
|
+
importPKCS8: zn,
|
|
4065
|
+
importSPKI: Bn,
|
|
4066
|
+
importX509: Gn,
|
|
4067
|
+
jwtDecrypt: ga,
|
|
4068
|
+
jwtVerify: pa
|
|
4069
|
+
}, Symbol.toStringTag, { value: "Module" })), ka = /* @__PURE__ */ ft(Ma), Fa = () => {
|
|
4070
4070
|
if (typeof globalThis < "u")
|
|
4071
4071
|
return globalThis;
|
|
4072
4072
|
if (typeof self < "u")
|
|
@@ -4074,8 +4074,8 @@ const Ma = "WebCryptoAPI", ka = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Ob
|
|
|
4074
4074
|
if (typeof window < "u")
|
|
4075
4075
|
return window;
|
|
4076
4076
|
throw new Error("unable to locate global object");
|
|
4077
|
-
},
|
|
4078
|
-
const { crypto: { subtle: s } } =
|
|
4077
|
+
}, Va = async (t, e, r, n, a) => {
|
|
4078
|
+
const { crypto: { subtle: s } } = Fa();
|
|
4079
4079
|
return new Uint8Array(await s.deriveBits({
|
|
4080
4080
|
name: "HKDF",
|
|
4081
4081
|
hash: `SHA-${t.substr(3)}`,
|
|
@@ -4083,7 +4083,7 @@ const Ma = "WebCryptoAPI", ka = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Ob
|
|
|
4083
4083
|
info: n
|
|
4084
4084
|
}, await s.importKey("raw", e, "HKDF", !1, ["deriveBits"]), a << 3));
|
|
4085
4085
|
};
|
|
4086
|
-
function
|
|
4086
|
+
function Ba(t) {
|
|
4087
4087
|
switch (t) {
|
|
4088
4088
|
case "sha256":
|
|
4089
4089
|
case "sha384":
|
|
@@ -4094,26 +4094,26 @@ function Ga(t) {
|
|
|
4094
4094
|
throw new TypeError('unsupported "digest" value');
|
|
4095
4095
|
}
|
|
4096
4096
|
}
|
|
4097
|
-
function
|
|
4097
|
+
function _t(t, e) {
|
|
4098
4098
|
if (typeof t == "string")
|
|
4099
4099
|
return new TextEncoder().encode(t);
|
|
4100
4100
|
if (!(t instanceof Uint8Array))
|
|
4101
4101
|
throw new TypeError(`"${e}"" must be an instance of Uint8Array or a string`);
|
|
4102
4102
|
return t;
|
|
4103
4103
|
}
|
|
4104
|
-
function
|
|
4105
|
-
const e =
|
|
4104
|
+
function Ga(t) {
|
|
4105
|
+
const e = _t(t, "ikm");
|
|
4106
4106
|
if (!e.byteLength)
|
|
4107
4107
|
throw new TypeError('"ikm" must be at least one byte in length');
|
|
4108
4108
|
return e;
|
|
4109
4109
|
}
|
|
4110
|
-
function
|
|
4111
|
-
const e =
|
|
4110
|
+
function za(t) {
|
|
4111
|
+
const e = _t(t, "info");
|
|
4112
4112
|
if (e.byteLength > 1024)
|
|
4113
4113
|
throw TypeError('"info" must not contain more than 1024 bytes');
|
|
4114
4114
|
return e;
|
|
4115
4115
|
}
|
|
4116
|
-
function
|
|
4116
|
+
function qa(t, e) {
|
|
4117
4117
|
if (typeof t != "number" || !Number.isInteger(t) || t < 1)
|
|
4118
4118
|
throw new TypeError('"keylen" must be a positive integer');
|
|
4119
4119
|
const r = parseInt(e.substr(3), 10) >> 3 || 20;
|
|
@@ -4121,46 +4121,46 @@ function Xa(t, e) {
|
|
|
4121
4121
|
throw new TypeError('"keylen" too large');
|
|
4122
4122
|
return t;
|
|
4123
4123
|
}
|
|
4124
|
-
async function
|
|
4125
|
-
return Ba(
|
|
4124
|
+
async function Ft(t, e, r, n, a) {
|
|
4125
|
+
return Va(Ba(t), Ga(e), _t(r, "salt"), za(n), qa(a, t));
|
|
4126
4126
|
}
|
|
4127
|
-
const
|
|
4127
|
+
const Xa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4128
4128
|
__proto__: null,
|
|
4129
|
-
default:
|
|
4130
|
-
hkdf:
|
|
4131
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4132
|
-
var ve,
|
|
4133
|
-
function
|
|
4129
|
+
default: Ft,
|
|
4130
|
+
hkdf: Ft
|
|
4131
|
+
}, Symbol.toStringTag, { value: "Module" })), Ya = /* @__PURE__ */ ft(Xa);
|
|
4132
|
+
var ve, Za = new Uint8Array(16);
|
|
4133
|
+
function Mr() {
|
|
4134
4134
|
if (!ve && (ve = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto), !ve))
|
|
4135
4135
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
4136
|
-
return ve(
|
|
4136
|
+
return ve(Za);
|
|
4137
4137
|
}
|
|
4138
|
-
const
|
|
4138
|
+
const Qa = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
4139
4139
|
function ke(t) {
|
|
4140
|
-
return typeof t == "string" &&
|
|
4140
|
+
return typeof t == "string" && Qa.test(t);
|
|
4141
4141
|
}
|
|
4142
4142
|
var W = [];
|
|
4143
|
-
for (var
|
|
4144
|
-
W.push((
|
|
4143
|
+
for (var Xe = 0; Xe < 256; ++Xe)
|
|
4144
|
+
W.push((Xe + 256).toString(16).substr(1));
|
|
4145
4145
|
function Fe(t) {
|
|
4146
4146
|
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, r = (W[t[e + 0]] + W[t[e + 1]] + W[t[e + 2]] + W[t[e + 3]] + "-" + W[t[e + 4]] + W[t[e + 5]] + "-" + W[t[e + 6]] + W[t[e + 7]] + "-" + W[t[e + 8]] + W[t[e + 9]] + "-" + W[t[e + 10]] + W[t[e + 11]] + W[t[e + 12]] + W[t[e + 13]] + W[t[e + 14]] + W[t[e + 15]]).toLowerCase();
|
|
4147
4147
|
if (!ke(r))
|
|
4148
4148
|
throw TypeError("Stringified UUID is invalid");
|
|
4149
4149
|
return r;
|
|
4150
4150
|
}
|
|
4151
|
-
var
|
|
4152
|
-
function
|
|
4151
|
+
var Vt, Ye, Ze = 0, Qe = 0;
|
|
4152
|
+
function ja(t, e, r) {
|
|
4153
4153
|
var n = e && r || 0, a = e || new Array(16);
|
|
4154
4154
|
t = t || {};
|
|
4155
|
-
var s = t.node ||
|
|
4155
|
+
var s = t.node || Vt, i = t.clockseq !== void 0 ? t.clockseq : Ye;
|
|
4156
4156
|
if (s == null || i == null) {
|
|
4157
|
-
var o = t.random || (t.rng ||
|
|
4158
|
-
s == null && (s =
|
|
4157
|
+
var o = t.random || (t.rng || Mr)();
|
|
4158
|
+
s == null && (s = Vt = [o[0] | 1, o[1], o[2], o[3], o[4], o[5]]), i == null && (i = Ye = (o[6] << 8 | o[7]) & 16383);
|
|
4159
4159
|
}
|
|
4160
|
-
var c = t.msecs !== void 0 ? t.msecs : Date.now(), u = t.nsecs !== void 0 ? t.nsecs :
|
|
4161
|
-
if (l < 0 && t.clockseq === void 0 && (i = i + 1 & 16383), (l < 0 || c >
|
|
4160
|
+
var c = t.msecs !== void 0 ? t.msecs : Date.now(), u = t.nsecs !== void 0 ? t.nsecs : Qe + 1, l = c - Ze + (u - Qe) / 1e4;
|
|
4161
|
+
if (l < 0 && t.clockseq === void 0 && (i = i + 1 & 16383), (l < 0 || c > Ze) && t.nsecs === void 0 && (u = 0), u >= 1e4)
|
|
4162
4162
|
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
4163
|
-
|
|
4163
|
+
Ze = c, Qe = u, Ye = i, c += 122192928e5;
|
|
4164
4164
|
var f = ((c & 268435455) * 1e4 + u) % 4294967296;
|
|
4165
4165
|
a[n++] = f >>> 24 & 255, a[n++] = f >>> 16 & 255, a[n++] = f >>> 8 & 255, a[n++] = f & 255;
|
|
4166
4166
|
var d = c / 4294967296 * 1e4 & 268435455;
|
|
@@ -4169,22 +4169,22 @@ function es(t, e, r) {
|
|
|
4169
4169
|
a[n + p] = s[p];
|
|
4170
4170
|
return e || Fe(a);
|
|
4171
4171
|
}
|
|
4172
|
-
function
|
|
4172
|
+
function kr(t) {
|
|
4173
4173
|
if (!ke(t))
|
|
4174
4174
|
throw TypeError("Invalid UUID");
|
|
4175
4175
|
var e, r = new Uint8Array(16);
|
|
4176
4176
|
return r[0] = (e = parseInt(t.slice(0, 8), 16)) >>> 24, r[1] = e >>> 16 & 255, r[2] = e >>> 8 & 255, r[3] = e & 255, r[4] = (e = parseInt(t.slice(9, 13), 16)) >>> 8, r[5] = e & 255, r[6] = (e = parseInt(t.slice(14, 18), 16)) >>> 8, r[7] = e & 255, r[8] = (e = parseInt(t.slice(19, 23), 16)) >>> 8, r[9] = e & 255, r[10] = (e = parseInt(t.slice(24, 36), 16)) / 1099511627776 & 255, r[11] = e / 4294967296 & 255, r[12] = e >>> 24 & 255, r[13] = e >>> 16 & 255, r[14] = e >>> 8 & 255, r[15] = e & 255, r;
|
|
4177
4177
|
}
|
|
4178
|
-
function
|
|
4178
|
+
function es(t) {
|
|
4179
4179
|
t = unescape(encodeURIComponent(t));
|
|
4180
4180
|
for (var e = [], r = 0; r < t.length; ++r)
|
|
4181
4181
|
e.push(t.charCodeAt(r));
|
|
4182
4182
|
return e;
|
|
4183
4183
|
}
|
|
4184
|
-
var
|
|
4185
|
-
function
|
|
4184
|
+
var ts = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", rs = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
4185
|
+
function Fr(t, e, r) {
|
|
4186
4186
|
function n(a, s, i, o) {
|
|
4187
|
-
if (typeof a == "string" && (a =
|
|
4187
|
+
if (typeof a == "string" && (a = es(a)), typeof s == "string" && (s = kr(s)), s.length !== 16)
|
|
4188
4188
|
throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
|
|
4189
4189
|
var c = new Uint8Array(16 + a.length);
|
|
4190
4190
|
if (c.set(s), c.set(a, s.length), c = r(c), c[6] = c[6] & 15 | e, c[8] = c[8] & 63 | 128, i) {
|
|
@@ -4199,39 +4199,39 @@ function Vr(t, e, r) {
|
|
|
4199
4199
|
n.name = t;
|
|
4200
4200
|
} catch {
|
|
4201
4201
|
}
|
|
4202
|
-
return n.DNS =
|
|
4202
|
+
return n.DNS = ts, n.URL = rs, n;
|
|
4203
4203
|
}
|
|
4204
|
-
function
|
|
4204
|
+
function ns(t) {
|
|
4205
4205
|
if (typeof t == "string") {
|
|
4206
4206
|
var e = unescape(encodeURIComponent(t));
|
|
4207
4207
|
t = new Uint8Array(e.length);
|
|
4208
4208
|
for (var r = 0; r < e.length; ++r)
|
|
4209
4209
|
t[r] = e.charCodeAt(r);
|
|
4210
4210
|
}
|
|
4211
|
-
return ss(is(
|
|
4211
|
+
return as(ss(is(t), t.length * 8));
|
|
4212
4212
|
}
|
|
4213
|
-
function
|
|
4213
|
+
function as(t) {
|
|
4214
4214
|
for (var e = [], r = t.length * 32, n = "0123456789abcdef", a = 0; a < r; a += 8) {
|
|
4215
4215
|
var s = t[a >> 5] >>> a % 32 & 255, i = parseInt(n.charAt(s >>> 4 & 15) + n.charAt(s & 15), 16);
|
|
4216
4216
|
e.push(i);
|
|
4217
4217
|
}
|
|
4218
4218
|
return e;
|
|
4219
4219
|
}
|
|
4220
|
-
function
|
|
4220
|
+
function Vr(t) {
|
|
4221
4221
|
return (t + 64 >>> 9 << 4) + 14 + 1;
|
|
4222
4222
|
}
|
|
4223
|
-
function
|
|
4224
|
-
t[e >> 5] |= 128 << e % 32, t[
|
|
4223
|
+
function ss(t, e) {
|
|
4224
|
+
t[e >> 5] |= 128 << e % 32, t[Vr(e) - 1] = e;
|
|
4225
4225
|
for (var r = 1732584193, n = -271733879, a = -1732584194, s = 271733878, i = 0; i < t.length; i += 16) {
|
|
4226
4226
|
var o = r, c = n, u = a, l = s;
|
|
4227
4227
|
r = D(r, n, a, s, t[i], 7, -680876936), s = D(s, r, n, a, t[i + 1], 12, -389564586), a = D(a, s, r, n, t[i + 2], 17, 606105819), n = D(n, a, s, r, t[i + 3], 22, -1044525330), r = D(r, n, a, s, t[i + 4], 7, -176418897), s = D(s, r, n, a, t[i + 5], 12, 1200080426), a = D(a, s, r, n, t[i + 6], 17, -1473231341), n = D(n, a, s, r, t[i + 7], 22, -45705983), r = D(r, n, a, s, t[i + 8], 7, 1770035416), s = D(s, r, n, a, t[i + 9], 12, -1958414417), a = D(a, s, r, n, t[i + 10], 17, -42063), n = D(n, a, s, r, t[i + 11], 22, -1990404162), r = D(r, n, a, s, t[i + 12], 7, 1804603682), s = D(s, r, n, a, t[i + 13], 12, -40341101), a = D(a, s, r, n, t[i + 14], 17, -1502002290), n = D(n, a, s, r, t[i + 15], 22, 1236535329), r = J(r, n, a, s, t[i + 1], 5, -165796510), s = J(s, r, n, a, t[i + 6], 9, -1069501632), a = J(a, s, r, n, t[i + 11], 14, 643717713), n = J(n, a, s, r, t[i], 20, -373897302), r = J(r, n, a, s, t[i + 5], 5, -701558691), s = J(s, r, n, a, t[i + 10], 9, 38016083), a = J(a, s, r, n, t[i + 15], 14, -660478335), n = J(n, a, s, r, t[i + 4], 20, -405537848), r = J(r, n, a, s, t[i + 9], 5, 568446438), s = J(s, r, n, a, t[i + 14], 9, -1019803690), a = J(a, s, r, n, t[i + 3], 14, -187363961), n = J(n, a, s, r, t[i + 8], 20, 1163531501), r = J(r, n, a, s, t[i + 13], 5, -1444681467), s = J(s, r, n, a, t[i + 2], 9, -51403784), a = J(a, s, r, n, t[i + 7], 14, 1735328473), n = J(n, a, s, r, t[i + 12], 20, -1926607734), r = N(r, n, a, s, t[i + 5], 4, -378558), s = N(s, r, n, a, t[i + 8], 11, -2022574463), a = N(a, s, r, n, t[i + 11], 16, 1839030562), n = N(n, a, s, r, t[i + 14], 23, -35309556), r = N(r, n, a, s, t[i + 1], 4, -1530992060), s = N(s, r, n, a, t[i + 4], 11, 1272893353), a = N(a, s, r, n, t[i + 7], 16, -155497632), n = N(n, a, s, r, t[i + 10], 23, -1094730640), r = N(r, n, a, s, t[i + 13], 4, 681279174), s = N(s, r, n, a, t[i], 11, -358537222), a = N(a, s, r, n, t[i + 3], 16, -722521979), n = N(n, a, s, r, t[i + 6], 23, 76029189), r = N(r, n, a, s, t[i + 9], 4, -640364487), s = N(s, r, n, a, t[i + 12], 11, -421815835), a = N(a, s, r, n, t[i + 15], 16, 530742520), n = N(n, a, s, r, t[i + 2], 23, -995338651), r = $(r, n, a, s, t[i], 6, -198630844), s = $(s, r, n, a, t[i + 7], 10, 1126891415), a = $(a, s, r, n, t[i + 14], 15, -1416354905), n = $(n, a, s, r, t[i + 5], 21, -57434055), r = $(r, n, a, s, t[i + 12], 6, 1700485571), s = $(s, r, n, a, t[i + 3], 10, -1894986606), a = $(a, s, r, n, t[i + 10], 15, -1051523), n = $(n, a, s, r, t[i + 1], 21, -2054922799), r = $(r, n, a, s, t[i + 8], 6, 1873313359), s = $(s, r, n, a, t[i + 15], 10, -30611744), a = $(a, s, r, n, t[i + 6], 15, -1560198380), n = $(n, a, s, r, t[i + 13], 21, 1309151649), r = $(r, n, a, s, t[i + 4], 6, -145523070), s = $(s, r, n, a, t[i + 11], 10, -1120210379), a = $(a, s, r, n, t[i + 2], 15, 718787259), n = $(n, a, s, r, t[i + 9], 21, -343485551), r = ne(r, o), n = ne(n, c), a = ne(a, u), s = ne(s, l);
|
|
4228
4228
|
}
|
|
4229
4229
|
return [r, n, a, s];
|
|
4230
4230
|
}
|
|
4231
|
-
function
|
|
4231
|
+
function is(t) {
|
|
4232
4232
|
if (t.length === 0)
|
|
4233
4233
|
return [];
|
|
4234
|
-
for (var e = t.length * 8, r = new Uint32Array(
|
|
4234
|
+
for (var e = t.length * 8, r = new Uint32Array(Vr(e)), n = 0; n < e; n += 8)
|
|
4235
4235
|
r[n >> 5] |= (t[n / 8] & 255) << n % 32;
|
|
4236
4236
|
return r;
|
|
4237
4237
|
}
|
|
@@ -4239,11 +4239,11 @@ function ne(t, e) {
|
|
|
4239
4239
|
var r = (t & 65535) + (e & 65535), n = (t >> 16) + (e >> 16) + (r >> 16);
|
|
4240
4240
|
return n << 16 | r & 65535;
|
|
4241
4241
|
}
|
|
4242
|
-
function
|
|
4242
|
+
function os(t, e) {
|
|
4243
4243
|
return t << e | t >>> 32 - e;
|
|
4244
4244
|
}
|
|
4245
4245
|
function Ve(t, e, r, n, a, s) {
|
|
4246
|
-
return ne(
|
|
4246
|
+
return ne(os(ne(ne(e, t), ne(n, s)), a), r);
|
|
4247
4247
|
}
|
|
4248
4248
|
function D(t, e, r, n, a, s, i) {
|
|
4249
4249
|
return Ve(e & r | ~e & n, t, e, a, s, i);
|
|
@@ -4257,11 +4257,11 @@ function N(t, e, r, n, a, s, i) {
|
|
|
4257
4257
|
function $(t, e, r, n, a, s, i) {
|
|
4258
4258
|
return Ve(r ^ (e | ~n), t, e, a, s, i);
|
|
4259
4259
|
}
|
|
4260
|
-
var
|
|
4261
|
-
const
|
|
4262
|
-
function
|
|
4260
|
+
var cs = Fr("v3", 48, ns);
|
|
4261
|
+
const us = cs;
|
|
4262
|
+
function ls(t, e, r) {
|
|
4263
4263
|
t = t || {};
|
|
4264
|
-
var n = t.random || (t.rng ||
|
|
4264
|
+
var n = t.random || (t.rng || Mr)();
|
|
4265
4265
|
if (n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, e) {
|
|
4266
4266
|
r = r || 0;
|
|
4267
4267
|
for (var a = 0; a < 16; ++a)
|
|
@@ -4270,7 +4270,7 @@ function ds(t, e, r) {
|
|
|
4270
4270
|
}
|
|
4271
4271
|
return Fe(n);
|
|
4272
4272
|
}
|
|
4273
|
-
function
|
|
4273
|
+
function ds(t, e, r, n) {
|
|
4274
4274
|
switch (t) {
|
|
4275
4275
|
case 0:
|
|
4276
4276
|
return e & r ^ ~e & n;
|
|
@@ -4282,10 +4282,10 @@ function fs(t, e, r, n) {
|
|
|
4282
4282
|
return e ^ r ^ n;
|
|
4283
4283
|
}
|
|
4284
4284
|
}
|
|
4285
|
-
function
|
|
4285
|
+
function je(t, e) {
|
|
4286
4286
|
return t << e | t >>> 32 - e;
|
|
4287
4287
|
}
|
|
4288
|
-
function
|
|
4288
|
+
function fs(t) {
|
|
4289
4289
|
var e = [1518500249, 1859775393, 2400959708, 3395469782], r = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
|
|
4290
4290
|
if (typeof t == "string") {
|
|
4291
4291
|
var n = unescape(encodeURIComponent(t));
|
|
@@ -4305,68 +4305,68 @@ function hs(t) {
|
|
|
4305
4305
|
for (var d = new Uint32Array(80), p = 0; p < 16; ++p)
|
|
4306
4306
|
d[p] = o[f][p];
|
|
4307
4307
|
for (var h = 16; h < 80; ++h)
|
|
4308
|
-
d[h] =
|
|
4308
|
+
d[h] = je(d[h - 3] ^ d[h - 8] ^ d[h - 14] ^ d[h - 16], 1);
|
|
4309
4309
|
for (var g = r[0], S = r[1], C = r[2], v = r[3], w = r[4], m = 0; m < 80; ++m) {
|
|
4310
|
-
var E = Math.floor(m / 20), _ =
|
|
4311
|
-
w = v, v = C, C =
|
|
4310
|
+
var E = Math.floor(m / 20), _ = je(g, 5) + ds(E, S, C, v) + w + e[E] + d[m] >>> 0;
|
|
4311
|
+
w = v, v = C, C = je(S, 30) >>> 0, S = g, g = _;
|
|
4312
4312
|
}
|
|
4313
4313
|
r[0] = r[0] + g >>> 0, r[1] = r[1] + S >>> 0, r[2] = r[2] + C >>> 0, r[3] = r[3] + v >>> 0, r[4] = r[4] + w >>> 0;
|
|
4314
4314
|
}
|
|
4315
4315
|
return [r[0] >> 24 & 255, r[0] >> 16 & 255, r[0] >> 8 & 255, r[0] & 255, r[1] >> 24 & 255, r[1] >> 16 & 255, r[1] >> 8 & 255, r[1] & 255, r[2] >> 24 & 255, r[2] >> 16 & 255, r[2] >> 8 & 255, r[2] & 255, r[3] >> 24 & 255, r[3] >> 16 & 255, r[3] >> 8 & 255, r[3] & 255, r[4] >> 24 & 255, r[4] >> 16 & 255, r[4] >> 8 & 255, r[4] & 255];
|
|
4316
4316
|
}
|
|
4317
|
-
var
|
|
4318
|
-
const
|
|
4319
|
-
function
|
|
4317
|
+
var hs = Fr("v5", 80, fs);
|
|
4318
|
+
const ps = hs, gs = "00000000-0000-0000-0000-000000000000";
|
|
4319
|
+
function ms(t) {
|
|
4320
4320
|
if (!ke(t))
|
|
4321
4321
|
throw TypeError("Invalid UUID");
|
|
4322
4322
|
return parseInt(t.substr(14, 1), 16);
|
|
4323
4323
|
}
|
|
4324
|
-
const
|
|
4324
|
+
const ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4325
4325
|
__proto__: null,
|
|
4326
|
-
NIL:
|
|
4327
|
-
parse:
|
|
4326
|
+
NIL: gs,
|
|
4327
|
+
parse: kr,
|
|
4328
4328
|
stringify: Fe,
|
|
4329
|
-
v1:
|
|
4330
|
-
v3:
|
|
4331
|
-
v4:
|
|
4332
|
-
v5:
|
|
4329
|
+
v1: ja,
|
|
4330
|
+
v3: us,
|
|
4331
|
+
v4: ls,
|
|
4332
|
+
v5: ps,
|
|
4333
4333
|
validate: ke,
|
|
4334
|
-
version:
|
|
4335
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4336
|
-
var ue = {},
|
|
4337
|
-
function
|
|
4338
|
-
return
|
|
4334
|
+
version: ms
|
|
4335
|
+
}, Symbol.toStringTag, { value: "Module" })), ws = /* @__PURE__ */ ft(ys);
|
|
4336
|
+
var ue = {}, et = { exports: {} }, tt = { exports: {} }, Bt;
|
|
4337
|
+
function Ss() {
|
|
4338
|
+
return Bt || (Bt = 1, function(t) {
|
|
4339
4339
|
function e(r, n) {
|
|
4340
4340
|
return n.get ? n.get.call(r) : n.value;
|
|
4341
4341
|
}
|
|
4342
4342
|
t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
4343
|
-
}(
|
|
4343
|
+
}(tt)), tt.exports;
|
|
4344
4344
|
}
|
|
4345
|
-
var
|
|
4346
|
-
function
|
|
4347
|
-
return
|
|
4345
|
+
var rt = { exports: {} }, Gt;
|
|
4346
|
+
function Br() {
|
|
4347
|
+
return Gt || (Gt = 1, function(t) {
|
|
4348
4348
|
function e(r, n, a) {
|
|
4349
4349
|
if (!n.has(r))
|
|
4350
4350
|
throw new TypeError("attempted to " + a + " private field on non-instance");
|
|
4351
4351
|
return n.get(r);
|
|
4352
4352
|
}
|
|
4353
4353
|
t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
4354
|
-
}(
|
|
4354
|
+
}(rt)), rt.exports;
|
|
4355
4355
|
}
|
|
4356
|
-
var
|
|
4357
|
-
function
|
|
4358
|
-
return
|
|
4359
|
-
var e =
|
|
4356
|
+
var zt;
|
|
4357
|
+
function bs() {
|
|
4358
|
+
return zt || (zt = 1, function(t) {
|
|
4359
|
+
var e = Ss(), r = Br();
|
|
4360
4360
|
function n(a, s) {
|
|
4361
4361
|
var i = r(a, s, "get");
|
|
4362
4362
|
return e(a, i);
|
|
4363
4363
|
}
|
|
4364
4364
|
t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
4365
|
-
}(
|
|
4365
|
+
}(et)), et.exports;
|
|
4366
4366
|
}
|
|
4367
|
-
var
|
|
4368
|
-
function
|
|
4369
|
-
return
|
|
4367
|
+
var nt = { exports: {} }, at = { exports: {} }, qt;
|
|
4368
|
+
function vs() {
|
|
4369
|
+
return qt || (qt = 1, function(t) {
|
|
4370
4370
|
function e(r, n, a) {
|
|
4371
4371
|
if (n.set)
|
|
4372
4372
|
n.set.call(r, a);
|
|
@@ -4377,29 +4377,29 @@ function Es() {
|
|
|
4377
4377
|
}
|
|
4378
4378
|
}
|
|
4379
4379
|
t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
4380
|
-
}(
|
|
4380
|
+
}(at)), at.exports;
|
|
4381
4381
|
}
|
|
4382
|
-
var
|
|
4383
|
-
function
|
|
4384
|
-
return
|
|
4385
|
-
var e =
|
|
4382
|
+
var Xt;
|
|
4383
|
+
function Es() {
|
|
4384
|
+
return Xt || (Xt = 1, function(t) {
|
|
4385
|
+
var e = vs(), r = Br();
|
|
4386
4386
|
function n(a, s, i) {
|
|
4387
4387
|
var o = r(a, s, "set");
|
|
4388
4388
|
return e(a, o, i), i;
|
|
4389
4389
|
}
|
|
4390
4390
|
t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
4391
|
-
}(
|
|
4391
|
+
}(nt)), nt.exports;
|
|
4392
4392
|
}
|
|
4393
|
-
var
|
|
4394
|
-
function
|
|
4395
|
-
if (
|
|
4393
|
+
var Yt;
|
|
4394
|
+
function As() {
|
|
4395
|
+
if (Yt)
|
|
4396
4396
|
return ue;
|
|
4397
|
-
|
|
4398
|
-
var t =
|
|
4397
|
+
Yt = 1;
|
|
4398
|
+
var t = rr;
|
|
4399
4399
|
Object.defineProperty(ue, "__esModule", {
|
|
4400
4400
|
value: !0
|
|
4401
4401
|
}), ue.SessionStore = void 0, ue.defaultCookies = l;
|
|
4402
|
-
var e = t(
|
|
4402
|
+
var e = t(bs()), r = t(Es());
|
|
4403
4403
|
function n(w, m) {
|
|
4404
4404
|
s(w, m), m.add(w);
|
|
4405
4405
|
}
|
|
@@ -4570,14 +4570,14 @@ function xs() {
|
|
|
4570
4570
|
}
|
|
4571
4571
|
return ue;
|
|
4572
4572
|
}
|
|
4573
|
-
var
|
|
4574
|
-
function
|
|
4575
|
-
return
|
|
4573
|
+
var st = {}, Zt;
|
|
4574
|
+
function xs() {
|
|
4575
|
+
return Zt || (Zt = 1, Object.defineProperty(st, "__esModule", {
|
|
4576
4576
|
value: !0
|
|
4577
|
-
})),
|
|
4577
|
+
})), st;
|
|
4578
4578
|
}
|
|
4579
4579
|
(function(t) {
|
|
4580
|
-
var e =
|
|
4580
|
+
var e = rr;
|
|
4581
4581
|
Object.defineProperty(t, "__esModule", {
|
|
4582
4582
|
value: !0
|
|
4583
4583
|
});
|
|
@@ -4587,7 +4587,7 @@ function Cs() {
|
|
|
4587
4587
|
getToken: !0
|
|
4588
4588
|
};
|
|
4589
4589
|
t.decode = f, t.encode = l, t.getToken = d;
|
|
4590
|
-
var n =
|
|
4590
|
+
var n = ka, a = e(Ya), s = ws, i = As(), o = xs();
|
|
4591
4591
|
Object.keys(o).forEach(function(h) {
|
|
4592
4592
|
h === "default" || h === "__esModule" || Object.prototype.hasOwnProperty.call(r, h) || h in t && t[h] === o[h] || Object.defineProperty(t, h, {
|
|
4593
4593
|
enumerable: !0,
|
|
@@ -4628,12 +4628,12 @@ function Cs() {
|
|
|
4628
4628
|
var g, S, C;
|
|
4629
4629
|
const {
|
|
4630
4630
|
req: v,
|
|
4631
|
-
secureCookie: w = (g = (S =
|
|
4631
|
+
secureCookie: w = (g = (S = process.env.NEXTAUTH_URL) === null || S === void 0 ? void 0 : S.startsWith("https://")) !== null && g !== void 0 ? g : !!process.env.VERCEL,
|
|
4632
4632
|
cookieName: m = w ? "__Secure-next-auth.session-token" : "next-auth.session-token",
|
|
4633
4633
|
raw: E,
|
|
4634
4634
|
decode: _ = f,
|
|
4635
4635
|
logger: A = console,
|
|
4636
|
-
secret: R =
|
|
4636
|
+
secret: R = process.env.NEXTAUTH_SECRET
|
|
4637
4637
|
} = h;
|
|
4638
4638
|
if (!v)
|
|
4639
4639
|
throw new Error("Must pass `req` to JWT getToken()");
|
|
@@ -4667,17 +4667,17 @@ function Cs() {
|
|
|
4667
4667
|
async function p(h, g) {
|
|
4668
4668
|
return await (0, a.default)("sha256", h, g, `NextAuth.js Generated Encryption Key${g ? ` (${g})` : ""}`, 32);
|
|
4669
4669
|
}
|
|
4670
|
-
})(
|
|
4671
|
-
class
|
|
4670
|
+
})(er);
|
|
4671
|
+
class Hs extends zr {
|
|
4672
4672
|
async validateTokenFront(e) {
|
|
4673
4673
|
this.logDebug("entra validate Token Front");
|
|
4674
|
-
const r = await
|
|
4674
|
+
const r = await er.getToken({ req: e });
|
|
4675
4675
|
if (this.logDebug("Token Front", JSON.stringify(r)), !r)
|
|
4676
|
-
throw new
|
|
4676
|
+
throw new wn().get("UNAUTHORIZED");
|
|
4677
4677
|
return e;
|
|
4678
4678
|
}
|
|
4679
4679
|
}
|
|
4680
4680
|
export {
|
|
4681
|
-
|
|
4682
|
-
|
|
4681
|
+
Hs as C,
|
|
4682
|
+
wn as E
|
|
4683
4683
|
};
|