module-develop-kit 1.3.0 → 1.4.0

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.
Files changed (43) hide show
  1. package/dist/commonjs-virtual-dir/index.js +5 -3
  2. package/dist/commonjs-virtual-dir/index2.js +3 -3
  3. package/dist/commonjs-virtual-dir/index3.js +2 -7
  4. package/dist/commonjs-virtual-dir/index4.js +4 -2
  5. package/dist/commonjs-virtual-dir/index5.js +2 -2
  6. package/dist/main.d.ts +74 -28
  7. package/dist/main.js +40 -35
  8. package/dist/src/outside-call/utils.js +1 -1
  9. package/dist/src/shield/crypto/const.js +2 -2
  10. package/dist/src/shield/crypto/sm2.js +4 -4
  11. package/dist/src/shield/crypto/util.js +11 -23
  12. package/dist/src/shield/gcm-crypto/gcm.service.js +29 -0
  13. package/dist/src/shield/gcm-crypto/hex.js +18 -0
  14. package/dist/src/shield/gcm-crypto/index.js +40 -0
  15. package/dist/src/shield/gcm-crypto/init.js +61 -0
  16. package/dist/src/shield/gcm-crypto/string.js +10 -0
  17. package/dist/src/utils/is.js +4 -0
  18. package/dist/src/vite-plugins/vite-plugin-sri/index.js +4 -1
  19. package/dist/src/vite-plugins/vite-plugin-sri/internal.js +52 -53
  20. package/dist/types/axios.d.ts +16 -0
  21. package/dist/vendor/@noble/ciphers/esm/_polyval.js +116 -0
  22. package/dist/vendor/@noble/ciphers/esm/utils.js +68 -0
  23. package/dist/vendor/@noble/curves/esm/abstract/curve.js +203 -0
  24. package/dist/vendor/@noble/curves/esm/abstract/modular.js +240 -0
  25. package/dist/vendor/@noble/curves/esm/abstract/utils.js +10 -0
  26. package/dist/vendor/@noble/curves/esm/abstract/weierstrass.js +791 -0
  27. package/dist/vendor/@noble/curves/esm/utils.js +154 -0
  28. package/dist/vendor/@noble/hashes/esm/crypto.js +4 -0
  29. package/dist/vendor/@noble/hashes/esm/hmac.js +45 -0
  30. package/dist/vendor/@noble/hashes/esm/utils.js +112 -0
  31. package/dist/vendor/ieee754/index.js +1 -1
  32. package/dist/vendor/sdp-transform/lib/index.js +1 -1
  33. package/dist/vendor/sm-crypto-v2/dist/index.js +1004 -0
  34. package/dist/vendor/token-types/lib/index.js +1 -1
  35. package/package.json +3 -2
  36. package/dist/commonjs-virtual-dir/index7.js +0 -4
  37. package/dist/commonjs-virtual-dir/index8.js +0 -4
  38. package/dist/src/shield/crypto/index.js +0 -53
  39. package/dist/src/shield/crypto/sm4.js +0 -15
  40. package/dist/vendor/base64-js/index.js +0 -52
  41. package/dist/vendor/gm-crypt/index.js +0 -10
  42. package/dist/vendor/gm-crypt/src/crypt.js +0 -60
  43. package/dist/vendor/gm-crypt/src/sm4.js +0 -513
@@ -0,0 +1,1004 @@
1
+ import { hexToNumber as b, concatBytes as K, numberToBytesBE as Dt, bytesToHex as Y, numberToHexUnpadded as E } from "../../@noble/curves/esm/abstract/utils.js";
2
+ import { weierstrass as Gt } from "../../@noble/curves/esm/abstract/weierstrass.js";
3
+ import { Field as Ht, mod as At } from "../../@noble/curves/esm/abstract/modular.js";
4
+ import { ghash as dt } from "../../@noble/ciphers/esm/_polyval.js";
5
+ import { createView as pt, setBigUint64 as et } from "../../@noble/ciphers/esm/utils.js";
6
+ var St = Object.defineProperty, Mt = (t, e, n) => e in t ? St(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Et = (t, e) => {
7
+ for (var n in e)
8
+ St(t, n, { get: e[n], enumerable: !0 });
9
+ }, x = (t, e, n) => (Mt(t, typeof e != "symbol" ? e + "" : e, n), n), qt = {};
10
+ Et(qt, {
11
+ EmptyArray: () => it,
12
+ arrayToHex: () => tt,
13
+ arrayToUtf8: () => z,
14
+ calculateSharedKey: () => pe,
15
+ comparePublicKeyHex: () => de,
16
+ compressPublicKeyHex: () => ue,
17
+ doDecrypt: () => we,
18
+ doEncrypt: () => ve,
19
+ doSignature: () => me,
20
+ doVerifySignature: () => xe,
21
+ ecdh: () => ye,
22
+ generateKeyPairHex: () => at,
23
+ getHash: () => ht,
24
+ getPoint: () => Ot,
25
+ getPublicKeyFromPrivateKey: () => Rt,
26
+ getZ: () => X,
27
+ hexToArray: () => P,
28
+ initRNGPool: () => lt,
29
+ leftPad: () => U,
30
+ precomputePublicKey: () => be,
31
+ utf8ToHex: () => N,
32
+ verifyPublicKey: () => ge
33
+ });
34
+ var J = BigInt(0), M = BigInt(1), Zt = BigInt(2);
35
+ BigInt(3);
36
+ function $t(t) {
37
+ let e = t.toString(16);
38
+ if (e[0] !== "-")
39
+ e.length % 2 === 1 ? e = "0" + e : e.match(/^[0-7]/) || (e = "00" + e);
40
+ else {
41
+ e = e.substring(1);
42
+ let n = e.length;
43
+ n % 2 === 1 ? n += 1 : e.match(/^[0-7]/) || (n += 2);
44
+ let s = "";
45
+ for (let c = 0; c < n; c++)
46
+ s += "f";
47
+ e = ((b(s) ^ t) + M).toString(16).replace(/^-/, "");
48
+ }
49
+ return e;
50
+ }
51
+ var ct = class {
52
+ constructor(t = null, e = "00", n = "00", s = "") {
53
+ this.tlv = t, this.t = e, this.l = n, this.v = s;
54
+ }
55
+ /**
56
+ * 获取 der 编码比特流16进制串
57
+ */
58
+ getEncodedHex() {
59
+ return this.tlv || (this.v = this.getValue(), this.l = this.getLength(), this.tlv = this.t + this.l + this.v), this.tlv;
60
+ }
61
+ getLength() {
62
+ const t = this.v.length / 2;
63
+ let e = t.toString(16);
64
+ return e.length % 2 === 1 && (e = "0" + e), t < 128 ? e : (128 + e.length / 2).toString(16) + e;
65
+ }
66
+ getValue() {
67
+ return "";
68
+ }
69
+ }, Q = class extends ct {
70
+ constructor(t) {
71
+ super(), this.t = "02", t && (this.v = $t(t));
72
+ }
73
+ getValue() {
74
+ return this.v;
75
+ }
76
+ }, yt = class extends ct {
77
+ constructor(t) {
78
+ super(), this.s = t, x(this, "hV", ""), this.t = "04", t && (this.v = t.toLowerCase());
79
+ }
80
+ getValue() {
81
+ return this.v;
82
+ }
83
+ }, Lt = class extends ct {
84
+ constructor(t) {
85
+ super(), this.asn1Array = t, x(this, "t", "30");
86
+ }
87
+ getValue() {
88
+ return this.v = this.asn1Array.map((t) => t.getEncodedHex()).join(""), this.v;
89
+ }
90
+ };
91
+ function Bt(t, e) {
92
+ if (+t[e + 2] < 8)
93
+ return 1;
94
+ const s = t.slice(e + 2, e + 6).slice(0, 2);
95
+ return 1 + (parseInt(s, 16) - 128);
96
+ }
97
+ function st(t, e) {
98
+ const n = Bt(t, e), s = t.substring(e + 2, e + 2 + n * 2);
99
+ return s ? +(+s[0] < 8 ? b(s) : b(s.substring(2))).toString() : -1;
100
+ }
101
+ function G(t, e) {
102
+ const n = Bt(t, e);
103
+ return e + (n + 1) * 2;
104
+ }
105
+ function Wt(t, e) {
106
+ const n = new Q(t), s = new Q(e);
107
+ return new Lt([n, s]).getEncodedHex();
108
+ }
109
+ function vt(t, e, n, s) {
110
+ const r = new Q(t), i = new Q(e), c = new yt(n), o = new yt(s);
111
+ return new Lt([r, i, c, o]).getEncodedHex();
112
+ }
113
+ function Yt(t) {
114
+ const e = G(t, 0), n = G(t, e), s = st(t, e), r = t.substring(n, n + s * 2), i = n + r.length, c = G(t, i), o = st(t, i), l = t.substring(c, c + o * 2), a = b(r), f = b(l);
115
+ return { r: a, s: f };
116
+ }
117
+ function Jt(t) {
118
+ function e(g, p) {
119
+ const v = G(g, p), y = st(g, p), h = g.substring(v, v + y * 2), u = v + h.length;
120
+ return { value: h, nextStart: u };
121
+ }
122
+ const n = G(t, 0), { value: s, nextStart: r } = e(t, n), { value: i, nextStart: c } = e(t, r), { value: o, nextStart: l } = e(t, c), { value: a } = e(t, l), f = b(s), d = b(i);
123
+ return { x: f, y: d, hash: o, cipher: a };
124
+ }
125
+ var nt = 16384, R = new Uint8Array(0), k;
126
+ async function lt() {
127
+ if ("crypto" in globalThis) {
128
+ k = globalThis.crypto;
129
+ return;
130
+ }
131
+ if (!(R.length > nt / 2))
132
+ if ("wx" in globalThis && "getRandomValues" in globalThis.wx)
133
+ R = await new Promise((t) => {
134
+ wx.getRandomValues({
135
+ length: nt,
136
+ success(e) {
137
+ t(new Uint8Array(e.randomValues));
138
+ }
139
+ });
140
+ });
141
+ else
142
+ try {
143
+ globalThis.crypto ? k = globalThis.crypto : k = (await import(
144
+ /* webpackIgnore: true */
145
+ "crypto"
146
+ )).webcrypto;
147
+ const t = new Uint8Array(nt);
148
+ k.getRandomValues(t), R = t;
149
+ } catch {
150
+ throw new Error("no available csprng, abort.");
151
+ }
152
+ }
153
+ lt();
154
+ function Qt(t) {
155
+ if (R.length > t) {
156
+ const e = R.slice(0, t);
157
+ return R = R.slice(t), lt(), e;
158
+ } else
159
+ throw new Error("random number pool is not ready or insufficient, prevent getting too long random values or too often.");
160
+ }
161
+ function zt(t = 0) {
162
+ const e = new Uint8Array(t);
163
+ return k ? k.getRandomValues(e) : Qt(t);
164
+ }
165
+ var It = (t) => t instanceof Uint8Array, rt = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), Ft = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
166
+ if (!Ft)
167
+ throw new Error("Non little-endian hardware is not supported");
168
+ var Xt = Array.from(
169
+ { length: 256 },
170
+ (t, e) => e.toString(16).padStart(2, "0")
171
+ );
172
+ function _(t) {
173
+ if (!It(t))
174
+ throw new Error("Uint8Array expected");
175
+ let e = "";
176
+ for (let n = 0; n < t.length; n++)
177
+ e += Xt[t[n]];
178
+ return e;
179
+ }
180
+ var wt = typeof TextEncoder < "u" && /* @__PURE__ */ new TextEncoder(), te = (t, e, n) => ((n == null || n > t.length) && (n = t.length), new Uint8Array(t.subarray(e, n)));
181
+ function Tt(t) {
182
+ if (wt)
183
+ return wt.encode(t);
184
+ const e = t.length;
185
+ let n = new Uint8Array(t.length + (t.length >> 1)), s = 0;
186
+ const r = (i) => {
187
+ n[s++] = i;
188
+ };
189
+ for (let i = 0; i < e; ++i) {
190
+ if (s + 5 > n.length) {
191
+ const o = new Uint8Array(s + 8 + (e - i << 1));
192
+ o.set(n), n = o;
193
+ }
194
+ let c = t.charCodeAt(i);
195
+ c < 128 ? r(c) : c < 2048 ? (r(192 | c >> 6), r(128 | c & 63)) : c > 55295 && c < 57344 ? (c = 65536 + (c & 1047552) | t.charCodeAt(++i) & 1023, r(240 | c >> 18), r(128 | c >> 12 & 63), r(128 | c >> 6 & 63), r(128 | c & 63)) : (r(224 | c >> 12), r(128 | c >> 6 & 63), r(128 | c & 63));
196
+ }
197
+ return te(n, 0, s);
198
+ }
199
+ function ft(t) {
200
+ if (typeof t == "string" && (t = Tt(t)), !It(t))
201
+ throw new Error(`expected Uint8Array, got ${typeof t}`);
202
+ return t;
203
+ }
204
+ var Ct = class {
205
+ // Safe version that clones internal state
206
+ clone() {
207
+ return this._cloneInto();
208
+ }
209
+ };
210
+ function ee(t) {
211
+ const e = (s) => t().update(ft(s)).digest(), n = t();
212
+ return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
213
+ }
214
+ var ne = (t, e, n) => t & e | t & n | e & n, mt = (t, e, n) => t ^ e ^ n, re = (t, e, n) => t & e | ~t & n;
215
+ function se(t, e, n, s) {
216
+ if (typeof t.setBigUint64 == "function")
217
+ return t.setBigUint64(e, n, s);
218
+ const r = BigInt(32), i = BigInt(4294967295), c = Number(n >> r & i), o = Number(n & i), l = s ? 4 : 0, a = s ? 0 : 4;
219
+ t.setUint32(e + l, c, s), t.setUint32(e + a, o, s);
220
+ }
221
+ function B(t, e) {
222
+ const n = e & 31;
223
+ return t << n | t >>> 32 - n;
224
+ }
225
+ function oe(t) {
226
+ return t ^ B(t, 9) ^ B(t, 17);
227
+ }
228
+ function ie(t) {
229
+ return t ^ B(t, 15) ^ B(t, 23);
230
+ }
231
+ var ce = class extends Ct {
232
+ constructor(t, e, n, s) {
233
+ super(), this.blockLen = t, this.outputLen = e, this.padOffset = n, this.isLE = s, x(this, "buffer"), x(this, "view"), x(this, "finished", !1), x(this, "length", 0), x(this, "pos", 0), x(this, "destroyed", !1), this.buffer = new Uint8Array(t), this.view = rt(this.buffer);
234
+ }
235
+ update(t) {
236
+ const { view: e, buffer: n, blockLen: s } = this;
237
+ t = ft(t);
238
+ const r = t.length;
239
+ for (let i = 0; i < r; ) {
240
+ const c = Math.min(s - this.pos, r - i);
241
+ if (c === s) {
242
+ const o = rt(t);
243
+ for (; s <= r - i; i += s)
244
+ this.process(o, i);
245
+ continue;
246
+ }
247
+ n.set(t.subarray(i, i + c), this.pos), this.pos += c, i += c, this.pos === s && (this.process(e, 0), this.pos = 0);
248
+ }
249
+ return this.length += t.length, this.roundClean(), this;
250
+ }
251
+ digestInto(t) {
252
+ this.finished = !0;
253
+ const { buffer: e, view: n, blockLen: s, isLE: r } = this;
254
+ let { pos: i } = this;
255
+ e[i++] = 128, this.buffer.subarray(i).fill(0), this.padOffset > s - i && (this.process(n, 0), i = 0);
256
+ for (let f = i; f < s; f++)
257
+ e[f] = 0;
258
+ se(n, s - 8, BigInt(this.length * 8), r), this.process(n, 0);
259
+ const c = rt(t), o = this.outputLen;
260
+ if (o % 4)
261
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
262
+ const l = o / 4, a = this.get();
263
+ if (l > a.length)
264
+ throw new Error("_sha2: outputLen bigger than state");
265
+ for (let f = 0; f < l; f++)
266
+ c.setUint32(4 * f, a[f], r);
267
+ }
268
+ digest() {
269
+ const { buffer: t, outputLen: e } = this;
270
+ this.digestInto(t);
271
+ const n = t.slice(0, e);
272
+ return this.destroy(), n;
273
+ }
274
+ _cloneInto(t) {
275
+ t || (t = new this.constructor()), t.set(...this.get());
276
+ const { blockLen: e, buffer: n, length: s, finished: r, destroyed: i, pos: c } = this;
277
+ return t.length = s, t.pos = c, t.finished = r, t.destroyed = i, s % e && t.buffer.set(n), t;
278
+ }
279
+ }, V = new Uint32Array([1937774191, 1226093241, 388252375, 3666478592, 2842636476, 372324522, 3817729613, 2969243214]), I = new Uint32Array(68), xt = new Uint32Array(64), le = 2043430169, fe = 2055708042, ae = class extends ce {
280
+ constructor() {
281
+ super(64, 32, 8, !1), x(this, "A", V[0] | 0), x(this, "B", V[1] | 0), x(this, "C", V[2] | 0), x(this, "D", V[3] | 0), x(this, "E", V[4] | 0), x(this, "F", V[5] | 0), x(this, "G", V[6] | 0), x(this, "H", V[7] | 0);
282
+ }
283
+ get() {
284
+ const { A: t, B: e, C: n, D: s, E: r, F: i, G: c, H: o } = this;
285
+ return [t, e, n, s, r, i, c, o];
286
+ }
287
+ // prettier-ignore
288
+ set(t, e, n, s, r, i, c, o) {
289
+ this.A = t | 0, this.B = e | 0, this.C = n | 0, this.D = s | 0, this.E = r | 0, this.F = i | 0, this.G = c | 0, this.H = o | 0;
290
+ }
291
+ process(t, e) {
292
+ for (let f = 0; f < 16; f++, e += 4)
293
+ I[f] = t.getUint32(e, !1);
294
+ for (let f = 16; f < 68; f++)
295
+ I[f] = ie(I[f - 16] ^ I[f - 9] ^ B(I[f - 3], 15)) ^ B(I[f - 13], 7) ^ I[f - 6];
296
+ for (let f = 0; f < 64; f++)
297
+ xt[f] = I[f] ^ I[f + 4];
298
+ let { A: n, B: s, C: r, D: i, E: c, F: o, G: l, H: a } = this;
299
+ for (let f = 0; f < 64; f++) {
300
+ let d = f >= 0 && f <= 15, g = d ? le : fe, p = B(B(n, 12) + c + B(g, f), 7), v = p ^ B(n, 12), y = (d ? mt(n, s, r) : ne(n, s, r)) + i + v + xt[f] | 0, h = (d ? mt(c, o, l) : re(c, o, l)) + a + p + I[f] | 0;
301
+ i = r, r = B(s, 9), s = n, n = y, a = l, l = B(o, 19), o = c, c = oe(h);
302
+ }
303
+ n = n ^ this.A | 0, s = s ^ this.B | 0, r = r ^ this.C | 0, i = i ^ this.D | 0, c = c ^ this.E | 0, o = o ^ this.F | 0, l = l ^ this.G | 0, a = a ^ this.H | 0, this.set(n, s, r, i, c, o, l, a);
304
+ }
305
+ roundClean() {
306
+ I.fill(0);
307
+ }
308
+ destroy() {
309
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
310
+ }
311
+ }, O = ee(() => new ae()), Vt = class extends Ct {
312
+ constructor(t, e) {
313
+ super(), x(this, "oHash"), x(this, "iHash"), x(this, "blockLen"), x(this, "outputLen"), x(this, "finished", !1), x(this, "destroyed", !1);
314
+ const n = ft(e);
315
+ if (this.iHash = t.create(), typeof this.iHash.update != "function")
316
+ throw new Error("Expected instance of class which extends utils.Hash");
317
+ this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
318
+ const s = this.blockLen, r = new Uint8Array(s);
319
+ r.set(n.length > s ? t.create().update(n).digest() : n);
320
+ for (let i = 0; i < r.length; i++)
321
+ r[i] ^= 54;
322
+ this.iHash.update(r), this.oHash = t.create();
323
+ for (let i = 0; i < r.length; i++)
324
+ r[i] ^= 106;
325
+ this.oHash.update(r), r.fill(0);
326
+ }
327
+ update(t) {
328
+ return this.iHash.update(t), this;
329
+ }
330
+ digestInto(t) {
331
+ this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
332
+ }
333
+ digest() {
334
+ const t = new Uint8Array(this.oHash.outputLen);
335
+ return this.digestInto(t), t;
336
+ }
337
+ _cloneInto(t) {
338
+ t || (t = Object.create(Object.getPrototypeOf(this), {}));
339
+ const { oHash: e, iHash: n, finished: s, destroyed: r, blockLen: i, outputLen: c } = this;
340
+ return t = t, t.finished = s, t.destroyed = r, t.blockLen = i, t.outputLen = c, t.oHash = e._cloneInto(t.oHash), t.iHash = n._cloneInto(t.iHash), t;
341
+ }
342
+ destroy() {
343
+ this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
344
+ }
345
+ }, _t = (t, e, n) => new Vt(t, e).update(n).digest();
346
+ _t.create = (t, e) => new Vt(t, e);
347
+ var he = Ht(BigInt("115792089210356248756420345214020892766250353991924191454421193933289684991999")), w = Gt({
348
+ // sm2: short weierstrass.
349
+ a: BigInt("115792089210356248756420345214020892766250353991924191454421193933289684991996"),
350
+ b: BigInt("18505919022281880113072981827955639221458448578012075254857346196103069175443"),
351
+ Fp: he,
352
+ h: M,
353
+ n: BigInt("115792089210356248756420345214020892766061623724957744567843809356293439045923"),
354
+ Gx: BigInt("22963146547237050559479531362550074578802567295341616970375194840604139615431"),
355
+ Gy: BigInt("85132369209828568825618990617112496413088388631904505083283536607588877201568"),
356
+ hash: O,
357
+ hmac: (t, ...e) => _t(O, t, K(...e)),
358
+ randomBytes: zt
359
+ }), T = Ht(BigInt(w.CURVE.n));
360
+ function at(t) {
361
+ const e = t ? Dt(At(BigInt(t), M) + M, 32) : w.utils.randomPrivateKey(), n = w.getPublicKey(e, !1), s = U(Y(e), 64), r = U(Y(n), 64);
362
+ return { privateKey: s, publicKey: r };
363
+ }
364
+ function ue(t) {
365
+ if (t.length !== 130)
366
+ throw new Error("Invalid public key to compress");
367
+ const e = (t.length - 2) / 2, n = t.substring(2, 2 + e), s = b(t.substring(e + 2, e + e + 2));
368
+ let r = "03";
369
+ return At(s, Zt) === J && (r = "02"), r + n;
370
+ }
371
+ function N(t) {
372
+ const e = Tt(t);
373
+ return Y(e);
374
+ }
375
+ function U(t, e) {
376
+ return t.length >= e ? t : new Array(e - t.length + 1).join("0") + t;
377
+ }
378
+ function tt(t) {
379
+ return t.map((e) => {
380
+ const n = e.toString(16);
381
+ return n.length === 1 ? "0" + n : n;
382
+ }).join("");
383
+ }
384
+ function z(t) {
385
+ const e = [];
386
+ for (let n = 0, s = t.length; n < s; n++)
387
+ t[n] >= 240 && t[n] <= 247 ? (e.push(String.fromCodePoint(((t[n] & 7) << 18) + ((t[n + 1] & 63) << 12) + ((t[n + 2] & 63) << 6) + (t[n + 3] & 63))), n += 3) : t[n] >= 224 && t[n] <= 239 ? (e.push(String.fromCodePoint(((t[n] & 15) << 12) + ((t[n + 1] & 63) << 6) + (t[n + 2] & 63))), n += 2) : t[n] >= 192 && t[n] <= 223 ? (e.push(String.fromCodePoint(((t[n] & 31) << 6) + (t[n + 1] & 63))), n++) : e.push(String.fromCodePoint(t[n]));
388
+ return e.join("");
389
+ }
390
+ function P(t) {
391
+ let e = t.length;
392
+ e % 2 !== 0 && (t = U(t, e + 1)), e = t.length;
393
+ const n = e / 2, s = new Uint8Array(n);
394
+ for (let r = 0; r < n; r++)
395
+ s[r] = parseInt(t.substring(r * 2, r * 2 + 2), 16);
396
+ return s;
397
+ }
398
+ function ge(t) {
399
+ const e = w.ProjectivePoint.fromHex(t);
400
+ if (!e)
401
+ return !1;
402
+ try {
403
+ return e.assertValidity(), !0;
404
+ } catch {
405
+ return !1;
406
+ }
407
+ }
408
+ function de(t, e) {
409
+ const n = w.ProjectivePoint.fromHex(t);
410
+ if (!n)
411
+ return !1;
412
+ const s = w.ProjectivePoint.fromHex(e);
413
+ return s ? n.equals(s) : !1;
414
+ }
415
+ function ot(t) {
416
+ const e = [];
417
+ for (let n = 0, s = t.length; n < s; n++) {
418
+ const r = t.codePointAt(n);
419
+ if (r <= 127)
420
+ e.push(r);
421
+ else if (r <= 2047)
422
+ e.push(192 | r >>> 6), e.push(128 | r & 63);
423
+ else if (r <= 55295 || r >= 57344 && r <= 65535)
424
+ e.push(224 | r >>> 12), e.push(128 | r >>> 6 & 63), e.push(128 | r & 63);
425
+ else if (r >= 65536 && r <= 1114111)
426
+ n++, e.push(240 | r >>> 18 & 28), e.push(128 | r >>> 12 & 63), e.push(128 | r >>> 6 & 63), e.push(128 | r & 63);
427
+ else
428
+ throw e.push(r), new Error("input is not supported");
429
+ }
430
+ return new Uint8Array(e);
431
+ }
432
+ function jt(t, e, n) {
433
+ t = typeof t == "string" ? ot(t) : t;
434
+ const s = it;
435
+ let r = new Uint8Array(e), i = 1, c = 0, o = it;
436
+ const l = new Uint8Array(4), a = () => {
437
+ l[0] = i >> 24 & 255, l[1] = i >> 16 & 255, l[2] = i >> 8 & 255, l[3] = i & 255, o = O(K(t, l, s)), i++, c = 0;
438
+ };
439
+ a();
440
+ for (let f = 0, d = r.length; f < d; f++)
441
+ c === o.length && a(), r[f] = o[c++] & 255;
442
+ return r;
443
+ }
444
+ var bt = b("80000000000000000000000000000000"), Pt = b("7fffffffffffffffffffffffffffffff");
445
+ function pe(t, e, n, s, r, i = !1, c = "1234567812345678", o = "1234567812345678") {
446
+ const l = w.ProjectivePoint.fromHex(e.publicKey), a = w.ProjectivePoint.fromHex(s), f = w.ProjectivePoint.fromHex(n);
447
+ let d = X(t.publicKey, c), g = X(n, o);
448
+ i && ([d, g] = [g, d]);
449
+ const p = b(e.privateKey), v = b(t.privateKey), y = l.x, h = bt + (y & Pt), u = T.add(v, T.mulN(h, p)), m = a.x, A = T.add(bt, m & Pt), C = a.multiply(A).add(f).multiply(u), H = P(U(E(C.x), 64)), q = P(U(E(C.y), 64));
450
+ return jt(K(H, q, d, g), r);
451
+ }
452
+ var { getSharedSecret: ye } = w;
453
+ function Kt(t, e, n) {
454
+ const s = jt(K(t, e), n.length);
455
+ for (let r = 0, i = n.length; r < i; r++)
456
+ n[r] ^= s[r] & 255;
457
+ }
458
+ var F = 0, it = new Uint8Array();
459
+ function ve(t, e, n = 1, s) {
460
+ const r = typeof t == "string" ? P(N(t)) : Uint8Array.from(t), i = typeof e == "string" ? w.ProjectivePoint.fromHex(e) : e, c = at(), o = b(c.privateKey);
461
+ let l = c.publicKey;
462
+ l.length > 128 && (l = l.substring(l.length - 128));
463
+ const a = i.multiply(o), f = P(U(E(a.x), 64)), d = P(U(E(a.y), 64)), g = _(O(K(f, r, d)));
464
+ Kt(f, d, r);
465
+ const p = _(r);
466
+ if (s?.asn1) {
467
+ const v = w.ProjectivePoint.fromHex(c.publicKey);
468
+ return n === F ? vt(v.x, v.y, p, g) : vt(v.x, v.y, g, p);
469
+ }
470
+ return n === F ? l + p + g : l + g + p;
471
+ }
472
+ function we(t, e, n = 1, s) {
473
+ const { output: r = "string", asn1: i = !1 } = s || {}, c = b(e);
474
+ let o, l, a;
475
+ if (i) {
476
+ const { x: y, y: h, cipher: u, hash: m } = Jt(t);
477
+ o = w.ProjectivePoint.fromAffine({ x: y, y: h }), a = m, l = u, n === F && ([l, a] = [a, l]);
478
+ } else
479
+ o = w.ProjectivePoint.fromHex("04" + t.substring(0, 128)), a = t.substring(128, 192), l = t.substring(192), n === F && (a = t.substring(t.length - 64), l = t.substring(128, t.length - 64));
480
+ const f = P(l), d = o.multiply(c), g = P(U(E(d.x), 64)), p = P(U(E(d.y), 64));
481
+ return Kt(g, p, f), tt(Array.from(O(K(g, f, p)))) === a.toLowerCase() ? r === "array" ? f : z(f) : r === "array" ? [] : "";
482
+ }
483
+ function me(t, e, n = {}) {
484
+ let {
485
+ pointPool: s,
486
+ der: r,
487
+ hash: i,
488
+ publicKey: c,
489
+ userId: o
490
+ } = n, l = typeof t == "string" ? N(t) : tt(Array.from(t));
491
+ i && (c = c || Rt(e), l = ht(l, c, o));
492
+ const a = b(e), f = b(l);
493
+ let d = null, g = null, p = null;
494
+ do {
495
+ do {
496
+ let v;
497
+ s && s.length ? v = s.pop() : v = Ot(), d = v.k, g = T.add(f, v.x1);
498
+ } while (g === J || g + d === w.CURVE.n);
499
+ p = T.mul(T.inv(T.addN(a, M)), T.subN(d, T.mulN(g, a)));
500
+ } while (p === J);
501
+ return r ? Wt(g, p) : U(E(g), 64) + U(E(p), 64);
502
+ }
503
+ function xe(t, e, n, s = {}) {
504
+ let r;
505
+ const {
506
+ hash: i,
507
+ der: c,
508
+ userId: o
509
+ } = s, l = typeof n == "string" ? n : n.toHex(!1);
510
+ i ? r = ht(typeof t == "string" ? N(t) : t, l, o) : r = typeof t == "string" ? N(t) : tt(Array.from(t));
511
+ let a, f;
512
+ if (c) {
513
+ const h = Yt(e);
514
+ a = h.r, f = h.s;
515
+ } else
516
+ a = b(e.substring(0, 64)), f = b(e.substring(64));
517
+ const d = typeof n == "string" ? w.ProjectivePoint.fromHex(n) : n, g = b(r), p = T.add(a, f);
518
+ if (p === J)
519
+ return !1;
520
+ const v = w.ProjectivePoint.BASE.multiply(f).add(d.multiply(p)), y = T.add(g, v.x);
521
+ return a === y;
522
+ }
523
+ function X(t, e = "1234567812345678") {
524
+ e = N(e);
525
+ const n = U(E(w.CURVE.a), 64), s = U(E(w.CURVE.b), 64), r = U(E(w.ProjectivePoint.BASE.x), 64), i = U(E(w.ProjectivePoint.BASE.y), 64);
526
+ let c, o;
527
+ if (t.length === 128)
528
+ c = t.substring(0, 64), o = t.substring(64, 128);
529
+ else {
530
+ const d = w.ProjectivePoint.fromHex(t);
531
+ c = U(E(d.x), 64), o = U(E(d.y), 64);
532
+ }
533
+ const l = P(e + n + s + r + i + c + o), a = e.length * 4;
534
+ return O(K(new Uint8Array([a >> 8 & 255, a & 255]), l));
535
+ }
536
+ function ht(t, e, n = "1234567812345678") {
537
+ const s = X(e, n);
538
+ return _(O(K(s, typeof t == "string" ? P(t) : t)));
539
+ }
540
+ function be(t, e) {
541
+ const n = w.ProjectivePoint.fromHex(t);
542
+ return w.utils.precompute(e, n);
543
+ }
544
+ function Rt(t) {
545
+ const e = w.getPublicKey(t, !1);
546
+ return U(Y(e), 64);
547
+ }
548
+ function Ot() {
549
+ const t = at(), e = w.ProjectivePoint.fromHex(t.publicKey), n = b(t.privateKey);
550
+ return {
551
+ ...t,
552
+ k: n,
553
+ x1: e.x
554
+ };
555
+ }
556
+ var Pe = {};
557
+ Et(Pe, {
558
+ decrypt: () => Ae,
559
+ encrypt: () => He,
560
+ sm4: () => ut
561
+ });
562
+ var S = 0, kt = 32, L = 16, Z = Uint8Array.from([
563
+ 214,
564
+ 144,
565
+ 233,
566
+ 254,
567
+ 204,
568
+ 225,
569
+ 61,
570
+ 183,
571
+ 22,
572
+ 182,
573
+ 20,
574
+ 194,
575
+ 40,
576
+ 251,
577
+ 44,
578
+ 5,
579
+ 43,
580
+ 103,
581
+ 154,
582
+ 118,
583
+ 42,
584
+ 190,
585
+ 4,
586
+ 195,
587
+ 170,
588
+ 68,
589
+ 19,
590
+ 38,
591
+ 73,
592
+ 134,
593
+ 6,
594
+ 153,
595
+ 156,
596
+ 66,
597
+ 80,
598
+ 244,
599
+ 145,
600
+ 239,
601
+ 152,
602
+ 122,
603
+ 51,
604
+ 84,
605
+ 11,
606
+ 67,
607
+ 237,
608
+ 207,
609
+ 172,
610
+ 98,
611
+ 228,
612
+ 179,
613
+ 28,
614
+ 169,
615
+ 201,
616
+ 8,
617
+ 232,
618
+ 149,
619
+ 128,
620
+ 223,
621
+ 148,
622
+ 250,
623
+ 117,
624
+ 143,
625
+ 63,
626
+ 166,
627
+ 71,
628
+ 7,
629
+ 167,
630
+ 252,
631
+ 243,
632
+ 115,
633
+ 23,
634
+ 186,
635
+ 131,
636
+ 89,
637
+ 60,
638
+ 25,
639
+ 230,
640
+ 133,
641
+ 79,
642
+ 168,
643
+ 104,
644
+ 107,
645
+ 129,
646
+ 178,
647
+ 113,
648
+ 100,
649
+ 218,
650
+ 139,
651
+ 248,
652
+ 235,
653
+ 15,
654
+ 75,
655
+ 112,
656
+ 86,
657
+ 157,
658
+ 53,
659
+ 30,
660
+ 36,
661
+ 14,
662
+ 94,
663
+ 99,
664
+ 88,
665
+ 209,
666
+ 162,
667
+ 37,
668
+ 34,
669
+ 124,
670
+ 59,
671
+ 1,
672
+ 33,
673
+ 120,
674
+ 135,
675
+ 212,
676
+ 0,
677
+ 70,
678
+ 87,
679
+ 159,
680
+ 211,
681
+ 39,
682
+ 82,
683
+ 76,
684
+ 54,
685
+ 2,
686
+ 231,
687
+ 160,
688
+ 196,
689
+ 200,
690
+ 158,
691
+ 234,
692
+ 191,
693
+ 138,
694
+ 210,
695
+ 64,
696
+ 199,
697
+ 56,
698
+ 181,
699
+ 163,
700
+ 247,
701
+ 242,
702
+ 206,
703
+ 249,
704
+ 97,
705
+ 21,
706
+ 161,
707
+ 224,
708
+ 174,
709
+ 93,
710
+ 164,
711
+ 155,
712
+ 52,
713
+ 26,
714
+ 85,
715
+ 173,
716
+ 147,
717
+ 50,
718
+ 48,
719
+ 245,
720
+ 140,
721
+ 177,
722
+ 227,
723
+ 29,
724
+ 246,
725
+ 226,
726
+ 46,
727
+ 130,
728
+ 102,
729
+ 202,
730
+ 96,
731
+ 192,
732
+ 41,
733
+ 35,
734
+ 171,
735
+ 13,
736
+ 83,
737
+ 78,
738
+ 111,
739
+ 213,
740
+ 219,
741
+ 55,
742
+ 69,
743
+ 222,
744
+ 253,
745
+ 142,
746
+ 47,
747
+ 3,
748
+ 255,
749
+ 106,
750
+ 114,
751
+ 109,
752
+ 108,
753
+ 91,
754
+ 81,
755
+ 141,
756
+ 27,
757
+ 175,
758
+ 146,
759
+ 187,
760
+ 221,
761
+ 188,
762
+ 127,
763
+ 17,
764
+ 217,
765
+ 92,
766
+ 65,
767
+ 31,
768
+ 16,
769
+ 90,
770
+ 216,
771
+ 10,
772
+ 193,
773
+ 49,
774
+ 136,
775
+ 165,
776
+ 205,
777
+ 123,
778
+ 189,
779
+ 45,
780
+ 116,
781
+ 208,
782
+ 18,
783
+ 184,
784
+ 229,
785
+ 180,
786
+ 176,
787
+ 137,
788
+ 105,
789
+ 151,
790
+ 74,
791
+ 12,
792
+ 150,
793
+ 119,
794
+ 126,
795
+ 101,
796
+ 185,
797
+ 241,
798
+ 9,
799
+ 197,
800
+ 110,
801
+ 198,
802
+ 132,
803
+ 24,
804
+ 240,
805
+ 125,
806
+ 236,
807
+ 58,
808
+ 220,
809
+ 77,
810
+ 32,
811
+ 121,
812
+ 238,
813
+ 95,
814
+ 62,
815
+ 215,
816
+ 203,
817
+ 57,
818
+ 72
819
+ ]), $ = new Uint32Array([
820
+ 462357,
821
+ 472066609,
822
+ 943670861,
823
+ 1415275113,
824
+ 1886879365,
825
+ 2358483617,
826
+ 2830087869,
827
+ 3301692121,
828
+ 3773296373,
829
+ 4228057617,
830
+ 404694573,
831
+ 876298825,
832
+ 1347903077,
833
+ 1819507329,
834
+ 2291111581,
835
+ 2762715833,
836
+ 3234320085,
837
+ 3705924337,
838
+ 4177462797,
839
+ 337322537,
840
+ 808926789,
841
+ 1280531041,
842
+ 1752135293,
843
+ 2223739545,
844
+ 2695343797,
845
+ 3166948049,
846
+ 3638552301,
847
+ 4110090761,
848
+ 269950501,
849
+ 741554753,
850
+ 1213159005,
851
+ 1684763257
852
+ ]);
853
+ function j(t) {
854
+ return (Z[t >>> 24 & 255] & 255) << 24 | (Z[t >>> 16 & 255] & 255) << 16 | (Z[t >>> 8 & 255] & 255) << 8 | Z[t & 255] & 255;
855
+ }
856
+ function D(t, e, n) {
857
+ let s = 0, r = 0, i = 0, c = 0, o = 0, l = 0, a = 0, f = 0;
858
+ o = t[0] & 255, l = t[1] & 255, a = t[2] & 255, f = t[3] & 255, s = o << 24 | l << 16 | a << 8 | f, o = t[4] & 255, l = t[5] & 255, a = t[6] & 255, f = t[7] & 255, r = o << 24 | l << 16 | a << 8 | f, o = t[8] & 255, l = t[9] & 255, a = t[10] & 255, f = t[11] & 255, i = o << 24 | l << 16 | a << 8 | f, o = t[12] & 255, l = t[13] & 255, a = t[14] & 255, f = t[15] & 255, c = o << 24 | l << 16 | a << 8 | f;
859
+ for (let d = 0; d < 32; d += 4)
860
+ o = r ^ i ^ c ^ n[d], o = j(o), s ^= o ^ (o << 2 | o >>> 30) ^ (o << 10 | o >>> 22) ^ (o << 18 | o >>> 14) ^ (o << 24 | o >>> 8), l = i ^ c ^ s ^ n[d + 1], l = j(l), r ^= l ^ (l << 2 | l >>> 30) ^ (l << 10 | l >>> 22) ^ (l << 18 | l >>> 14) ^ (l << 24 | l >>> 8), a = c ^ s ^ r ^ n[d + 2], a = j(a), i ^= a ^ (a << 2 | a >>> 30) ^ (a << 10 | a >>> 22) ^ (a << 18 | a >>> 14) ^ (a << 24 | a >>> 8), f = s ^ r ^ i ^ n[d + 3], f = j(f), c ^= f ^ (f << 2 | f >>> 30) ^ (f << 10 | f >>> 22) ^ (f << 18 | f >>> 14) ^ (f << 24 | f >>> 8);
861
+ e[0] = c >>> 24 & 255, e[1] = c >>> 16 & 255, e[2] = c >>> 8 & 255, e[3] = c & 255, e[4] = i >>> 24 & 255, e[5] = i >>> 16 & 255, e[6] = i >>> 8 & 255, e[7] = i & 255, e[8] = r >>> 24 & 255, e[9] = r >>> 16 & 255, e[10] = r >>> 8 & 255, e[11] = r & 255, e[12] = s >>> 24 & 255, e[13] = s >>> 16 & 255, e[14] = s >>> 8 & 255, e[15] = s & 255;
862
+ }
863
+ function Nt(t, e, n) {
864
+ let s = 0, r = 0, i = 0, c = 0, o = 0;
865
+ s = (t[0] & 255) << 24 | (t[1] & 255) << 16 | (t[2] & 255) << 8 | t[3] & 255, r = (t[4] & 255) << 24 | (t[5] & 255) << 16 | (t[6] & 255) << 8 | t[7] & 255, i = (t[8] & 255) << 24 | (t[9] & 255) << 16 | (t[10] & 255) << 8 | t[11] & 255, c = (t[12] & 255) << 24 | (t[13] & 255) << 16 | (t[14] & 255) << 8 | t[15] & 255, s ^= 2746333894, r ^= 1453994832, i ^= 1736282519, c ^= 2993693404;
866
+ for (let l = 0; l < 32; l += 4)
867
+ o = r ^ i ^ c ^ $[l + 0], o = j(o), s ^= o ^ (o << 13 | o >>> 19) ^ (o << 23 | o >>> 9), e[l + 0] = s, o = i ^ c ^ s ^ $[l + 1], o = j(o), r ^= o ^ (o << 13 | o >>> 19) ^ (o << 23 | o >>> 9), e[l + 1] = r, o = c ^ s ^ r ^ $[l + 2], o = j(o), i ^= o ^ (o << 13 | o >>> 19) ^ (o << 23 | o >>> 9), e[l + 2] = i, o = s ^ r ^ i ^ $[l + 3], o = j(o), c ^= o ^ (o << 13 | o >>> 19) ^ (o << 23 | o >>> 9), e[l + 3] = c;
868
+ if (n === S)
869
+ for (let l = 0; l < 16; l++)
870
+ [e[l], e[31 - l]] = [e[31 - l], e[l]];
871
+ }
872
+ function Ut(t) {
873
+ for (let e = t.length - 1; e >= 0 && (t[e]++, t[e] === 0); e--)
874
+ ;
875
+ }
876
+ function Ue(t, e, n, s, r, i) {
877
+ function c() {
878
+ const y = new Uint32Array(kt);
879
+ Nt(e, y, 1);
880
+ const h = new Uint8Array(16).fill(0), u = new Uint8Array(16);
881
+ D(h, u, y);
882
+ let m;
883
+ if (n.length === 12)
884
+ m = new Uint8Array(16), m.set(n, 0), m[15] = 1;
885
+ else {
886
+ const H = dt.create(u);
887
+ H.update(n);
888
+ const q = new Uint8Array(16), gt = pt(q);
889
+ et(gt, 8, BigInt(n.length * 8), !1), H.update(q), m = H.digest();
890
+ }
891
+ const A = new Uint8Array(m);
892
+ Ut(A);
893
+ const C = new Uint8Array(16);
894
+ return D(m, C, y), { roundKey: y, h: u, j0: m, counter: A, tagMask: C };
895
+ }
896
+ function o(y, h) {
897
+ const u = s.length, m = h.length, A = dt.create(y);
898
+ u > 0 && A.update(s), A.update(h);
899
+ const C = new Uint8Array(16), H = pt(C);
900
+ return et(H, 0, BigInt(u * 8), !1), et(H, 8, BigInt(m * 8), !1), A.update(C), A.digest();
901
+ }
902
+ const { roundKey: l, h: a, counter: f, tagMask: d } = c();
903
+ if (r === S && i) {
904
+ const y = o(a, t);
905
+ for (let u = 0; u < 16; u++)
906
+ y[u] ^= d[u];
907
+ let h = 0;
908
+ for (let u = 0; u < 16; u++)
909
+ h |= y[u] ^ i[u];
910
+ if (h !== 0)
911
+ throw new Error("authentication tag mismatch");
912
+ }
913
+ const g = new Uint8Array(t.length);
914
+ let p = 0, v = t.length;
915
+ for (; v >= L; ) {
916
+ const y = new Uint8Array(L);
917
+ D(f, y, l);
918
+ for (let h = 0; h < L && h < v; h++)
919
+ g[p + h] = t[p + h] ^ y[h];
920
+ Ut(f), p += L, v -= L;
921
+ }
922
+ if (v > 0) {
923
+ const y = new Uint8Array(L);
924
+ D(f, y, l);
925
+ for (let h = 0; h < v; h++)
926
+ g[p + h] = t[p + h] ^ y[h];
927
+ }
928
+ if (r !== S) {
929
+ const y = o(a, g);
930
+ for (let h = 0; h < 16; h++)
931
+ y[h] ^= d[h];
932
+ return { output: g, tag: y };
933
+ }
934
+ return { output: g };
935
+ }
936
+ var W = new Uint8Array(16);
937
+ function ut(t, e, n, s = {}) {
938
+ let {
939
+ padding: r = "pkcs#7",
940
+ mode: i,
941
+ iv: c = new Uint8Array(16),
942
+ output: o,
943
+ associatedData: l,
944
+ outputTag: a,
945
+ tag: f
946
+ } = s;
947
+ if (i === "gcm") {
948
+ const h = typeof e == "string" ? P(e) : Uint8Array.from(e), u = typeof c == "string" ? P(c) : Uint8Array.from(c), m = l ? typeof l == "string" ? P(l) : Uint8Array.from(l) : new Uint8Array(0);
949
+ let A;
950
+ typeof t == "string" ? n !== S ? A = ot(t) : A = P(t) : A = Uint8Array.from(t);
951
+ const C = f ? typeof f == "string" ? P(f) : Uint8Array.from(f) : void 0, H = Ue(A, h, u, m, n, C);
952
+ return o === "array" ? a && n !== S ? H : H.output : a && n !== S ? {
953
+ output: _(H.output),
954
+ tag: H.tag ? _(H.tag) : void 0
955
+ } : n !== S ? {
956
+ output: _(H.output),
957
+ tag: H.tag ? _(H.tag) : void 0
958
+ } : z(H.output);
959
+ }
960
+ if (i === "cbc" && (typeof c == "string" && (c = P(c)), c.length !== 128 / 8))
961
+ throw new Error("iv is invalid");
962
+ if (typeof e == "string" && (e = P(e)), e.length !== 128 / 8)
963
+ throw new Error("key is invalid");
964
+ if (typeof t == "string" ? n !== S ? t = ot(t) : t = P(t) : t = Uint8Array.from(t), (r === "pkcs#5" || r === "pkcs#7") && n !== S) {
965
+ const h = L - t.length % L, u = new Uint8Array(t.length + h);
966
+ u.set(t, 0);
967
+ for (let m = 0; m < h; m++)
968
+ u[t.length + m] = h;
969
+ t = u;
970
+ }
971
+ const d = new Uint32Array(kt);
972
+ Nt(e, d, n);
973
+ let g = new Uint8Array(t.length), p = c, v = t.length, y = 0;
974
+ for (; v >= L; ) {
975
+ const h = t.subarray(y, y + 16);
976
+ if (i === "cbc")
977
+ for (let u = 0; u < L; u++)
978
+ n !== S && (h[u] ^= p[u]);
979
+ D(h, W, d);
980
+ for (let u = 0; u < L; u++)
981
+ i === "cbc" && n === S && (W[u] ^= p[u]), g[y + u] = W[u];
982
+ i === "cbc" && (n !== S ? p = W : p = h), v -= L, y += L;
983
+ }
984
+ if ((r === "pkcs#5" || r === "pkcs#7") && n === S) {
985
+ const h = g.length, u = g[h - 1];
986
+ for (let m = 1; m <= u; m++)
987
+ if (g[h - m] !== u)
988
+ throw new Error("padding is invalid");
989
+ g = g.slice(0, h - u);
990
+ }
991
+ return o !== "array" ? n !== S ? _(g) : z(g) : g;
992
+ }
993
+ function He(t, e, n = {}) {
994
+ return ut(t, e, 1, n);
995
+ }
996
+ function Ae(t, e, n = {}) {
997
+ return ut(t, e, 0, n);
998
+ }
999
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1000
+ export {
1001
+ jt as kdf,
1002
+ qt as sm2,
1003
+ Pe as sm4
1004
+ };