ss-component-new 1.3.619 → 1.3.621

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 (69) hide show
  1. package/dist/{MTLLoader-5pQpbMEZ.js → MTLLoader-Cg9LEvNr.js} +2 -2
  2. package/dist/{URDFLoader-BO26K5-d.js → URDFLoader-mPVZjSIW.js} +589 -584
  3. package/dist/{animationData-rL2nYHqW.js → animationData-CDdaleGB.js} +3 -3
  4. package/dist/{array-DtIbnYgx.js → array-HJsOOS05.js} +13 -14
  5. package/dist/{clone-ESeDvnJv.js → clone-MyfSNInd.js} +1 -1
  6. package/dist/{eleIcon-C7Pz9jha.js → eleIcon-BoKZ_PzU.js} +2 -2
  7. package/dist/{iconfont-BIrta5vE.js → iconfont-BBJ_Xa7g.js} +91 -91
  8. package/dist/{index-BvkIoiVW.js → index-6qXeMn6b.js} +3 -3
  9. package/dist/{index-BXh02EAd.js → index-B2LYEScO.js} +4 -4
  10. package/dist/{index-YvUJL9Us.js → index-B4NcYIuS.js} +1 -1
  11. package/dist/{index-ZdNvgZn9.js → index-B86vVYuK.js} +3 -3
  12. package/dist/{index-D8UY4uNQ.js → index-B8NQAdR4.js} +966 -967
  13. package/dist/{index-rlStojTL.js → index-BFqUz4pN.js} +1 -1
  14. package/dist/index-BGVDfril.js +2623 -0
  15. package/dist/{index-Dj2f3bb5.js → index-BVcc8kay.js} +18 -20
  16. package/dist/{index-CPW7tdrA.js → index-BkkvdZXm.js} +17 -20
  17. package/dist/{index-B0M1YCUY.js → index-BvtOLltL.js} +7 -7
  18. package/dist/{index-DsdWSuDi.js → index-BvyM6d06.js} +482 -483
  19. package/dist/{index-CX8Apbo7.js → index-BybrpYzx.js} +1 -1
  20. package/dist/{index-tMqKF2l6.js → index-CM6aWexA.js} +2 -2
  21. package/dist/{index-CHhMgqcG.js → index-CRUkYvae.js} +4 -4
  22. package/dist/{index-BBBCr4Oo.js → index-CT1LWsrT.js} +2 -2
  23. package/dist/{index-D9xMYIes.js → index-CYjsE5Gs.js} +3 -3
  24. package/dist/{index-B_fRppeJ.js → index-CkO7j_i1.js} +8 -8
  25. package/dist/{index-Bk8b7svu.js → index-CpF3wYnE.js} +28389 -29302
  26. package/dist/{index-DlQXFCw8.js → index-CvZcm-Tt.js} +7 -8
  27. package/dist/{index-Bh9xfMUe.js → index-D1vR2n9D.js} +5 -5
  28. package/dist/{index-XvX6TMzr.js → index-DCY5J8nu.js} +1 -1
  29. package/dist/{index-C3pboX9W.js → index-DIVct0z6.js} +5 -5
  30. package/dist/{index-11kpzK0A.js → index-DJrzqi4-.js} +17 -17
  31. package/dist/{index-DMzOSLH7.js → index-DMUuZJrY.js} +3 -3
  32. package/dist/{index-DppGK-cl.js → index-DMkEL6P5.js} +6 -6
  33. package/dist/{index-CEdE_NSq.js → index-DagRVVUS.js} +4 -4
  34. package/dist/{index-BUqviBFi.js → index-DcPtyCDm.js} +29 -35
  35. package/dist/{index-CwzrUS8I.js → index-DibHtT3s.js} +570 -605
  36. package/dist/{index-CjAdUy4n.js → index-DjyxFjoY.js} +60 -62
  37. package/dist/{index-D1E8EPxn.js → index-DmILGKv9.js} +57 -61
  38. package/dist/{index-j9f77uCm.js → index-DneXSBUw.js} +8 -8
  39. package/dist/{index-B8XrhVMF.js → index-QpbdZ-N-.js} +36 -40
  40. package/dist/{index-BHtNKL1L.js → index-dD-mKgue.js} +2 -2
  41. package/dist/{index-DU8bIzXR.js → index-vITXyWii.js} +6973 -6531
  42. package/dist/{index--n0LF76p.js → index-xWwc0MvD.js} +148 -157
  43. package/dist/{index.vue_vue_type_script_setup_true_lang-DRzriV-s.js → index.vue_vue_type_script_setup_true_lang-DwbHXtUp.js} +2 -2
  44. package/dist/{index.vue_vue_type_style_index_0_scoped_39e1db95_lang-CoMb-4Xy.js → index.vue_vue_type_style_index_0_scoped_39e1db95_lang-VCheSKQF.js} +27760 -27735
  45. package/dist/isString-Dxm3W5iX.js +8 -0
  46. package/dist/{localIcon-D5UoFBU5.js → localIcon-CoJHw5ss.js} +1 -1
  47. package/dist/{main-D8iFsrPY.js → main-BuQcSVmx.js} +9 -9
  48. package/dist/{menuIndex-DAW9B-9g.js → menuIndex-BiUB7t5q.js} +1 -1
  49. package/dist/{request-B1c8BUkR.js → request-BfrhYBTM.js} +3480 -3062
  50. package/dist/ss-component.css +3 -3
  51. package/dist/ss-component.js +14 -14
  52. package/dist/ss-component2.js +13 -13
  53. package/dist/ss-component3.js +1 -1
  54. package/dist/{threeModel-C5B-Ckb-.js → threeModel-Br3xFMq_.js} +174 -174
  55. package/dist/{threePreview-CVU8RHxm.js → threePreview-BjOjXzmX.js} +12 -12
  56. package/dist/{threeSceneView-C1egE4vX.js → threeSceneView-Arn9K2ca.js} +23 -24
  57. package/dist/{threeSceneViewForCPMPIP-_x0AIoTZ.js → threeSceneViewForCPMPIP-DyBpZbxn.js} +16 -17
  58. package/dist/{threeTrackPathView-DB61-HKo.js → threeTrackPathView-DuL77ZaW.js} +7 -7
  59. package/dist/{threeViewerHost-OzpVrArR.js → threeViewerHost-BYzW22O3.js} +4 -4
  60. package/dist/{urdfTree-BTnijMjA.js → urdfTree-xJWz0AN3.js} +9 -9
  61. package/dist/{workpieceTreePanel-Cmcj8MOA.js → workpieceTreePanel-Cfj81zvc.js} +56 -60
  62. package/package.json +1 -1
  63. package/dist/JSEncrypt-B36c1iN5.js +0 -1983
  64. package/dist/index-Bgkzdkye.js +0 -572
  65. package/dist/isString-BlNsHiyU.js +0 -8
  66. package/dist/obj/model.mtl +0 -42
  67. package/dist/obj/model.obj +0 -26110
  68. package/public/obj/model.mtl +0 -42
  69. package/public/obj/model.obj +0 -26110
@@ -1,1983 +0,0 @@
1
- var Et = "0123456789abcdefghijklmnopqrstuvwxyz";
2
- function A(r) {
3
- return Et.charAt(r);
4
- }
5
- function Dt(r, t) {
6
- return r & t;
7
- }
8
- function Z(r, t) {
9
- return r | t;
10
- }
11
- function ut(r, t) {
12
- return r ^ t;
13
- }
14
- function at(r, t) {
15
- return r & ~t;
16
- }
17
- function xt(r) {
18
- if (r == 0)
19
- return -1;
20
- var t = 0;
21
- return (r & 65535) == 0 && (r >>= 16, t += 16), (r & 255) == 0 && (r >>= 8, t += 8), (r & 15) == 0 && (r >>= 4, t += 4), (r & 3) == 0 && (r >>= 2, t += 2), (r & 1) == 0 && ++t, t;
22
- }
23
- function Rt(r) {
24
- for (var t = 0; r != 0; )
25
- r &= r - 1, ++t;
26
- return t;
27
- }
28
- var _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Tt = "=";
29
- function W(r) {
30
- var t, e, i = "";
31
- for (t = 0; t + 3 <= r.length; t += 3)
32
- e = parseInt(r.substring(t, t + 3), 16), i += _.charAt(e >> 6) + _.charAt(e & 63);
33
- for (t + 1 == r.length ? (e = parseInt(r.substring(t, t + 1), 16), i += _.charAt(e << 2)) : t + 2 == r.length && (e = parseInt(r.substring(t, t + 2), 16), i += _.charAt(e >> 2) + _.charAt((e & 3) << 4)); (i.length & 3) > 0; )
34
- i += Tt;
35
- return i;
36
- }
37
- function lt(r) {
38
- var t = "", e, i = 0, n = 0;
39
- for (e = 0; e < r.length && r.charAt(e) != Tt; ++e) {
40
- var s = _.indexOf(r.charAt(e));
41
- s < 0 || (i == 0 ? (t += A(s >> 2), n = s & 3, i = 1) : i == 1 ? (t += A(n << 2 | s >> 4), n = s & 15, i = 2) : i == 2 ? (t += A(n), t += A(s >> 2), n = s & 3, i = 3) : (t += A(n << 2 | s >> 4), t += A(s & 15), i = 0));
42
- }
43
- return i == 1 && (t += A(n << 2)), t;
44
- }
45
- var H, Bt = {
46
- decode: function(r) {
47
- var t;
48
- if (H === void 0) {
49
- var e = "0123456789ABCDEF", i = ` \f
50
- \r  \u2028\u2029`;
51
- for (H = {}, t = 0; t < 16; ++t)
52
- H[e.charAt(t)] = t;
53
- for (e = e.toLowerCase(), t = 10; t < 16; ++t)
54
- H[e.charAt(t)] = t;
55
- for (t = 0; t < i.length; ++t)
56
- H[i.charAt(t)] = -1;
57
- }
58
- var n = [], s = 0, h = 0;
59
- for (t = 0; t < r.length; ++t) {
60
- var o = r.charAt(t);
61
- if (o == "=")
62
- break;
63
- if (o = H[o], o != -1) {
64
- if (o === void 0)
65
- throw new Error("Illegal character at offset " + t);
66
- s |= o, ++h >= 2 ? (n[n.length] = s, s = 0, h = 0) : s <<= 4;
67
- }
68
- }
69
- if (h)
70
- throw new Error("Hex encoding incomplete: 4 bits missing");
71
- return n;
72
- }
73
- }, P, st = {
74
- decode: function(r) {
75
- var t;
76
- if (P === void 0) {
77
- var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = `= \f
78
- \r  \u2028\u2029`;
79
- for (P = /* @__PURE__ */ Object.create(null), t = 0; t < 64; ++t)
80
- P[e.charAt(t)] = t;
81
- for (P["-"] = 62, P._ = 63, t = 0; t < i.length; ++t)
82
- P[i.charAt(t)] = -1;
83
- }
84
- var n = [], s = 0, h = 0;
85
- for (t = 0; t < r.length; ++t) {
86
- var o = r.charAt(t);
87
- if (o == "=")
88
- break;
89
- if (o = P[o], o != -1) {
90
- if (o === void 0)
91
- throw new Error("Illegal character at offset " + t);
92
- s |= o, ++h >= 4 ? (n[n.length] = s >> 16, n[n.length] = s >> 8 & 255, n[n.length] = s & 255, s = 0, h = 0) : s <<= 6;
93
- }
94
- }
95
- switch (h) {
96
- case 1:
97
- throw new Error("Base64 encoding incomplete: at least 2 bits missing");
98
- case 2:
99
- n[n.length] = s >> 10;
100
- break;
101
- case 3:
102
- n[n.length] = s >> 16, n[n.length] = s >> 8 & 255;
103
- break;
104
- }
105
- return n;
106
- },
107
- re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
108
- unarmor: function(r) {
109
- var t = st.re.exec(r);
110
- if (t)
111
- if (t[1])
112
- r = t[1];
113
- else if (t[2])
114
- r = t[2];
115
- else
116
- throw new Error("RegExp out of sync");
117
- return st.decode(r);
118
- }
119
- }, C = 1e13, j = (
120
- /** @class */
121
- function() {
122
- function r(t) {
123
- this.buf = [+t || 0];
124
- }
125
- return r.prototype.mulAdd = function(t, e) {
126
- var i = this.buf, n = i.length, s, h;
127
- for (s = 0; s < n; ++s)
128
- h = i[s] * t + e, h < C ? e = 0 : (e = 0 | h / C, h -= e * C), i[s] = h;
129
- e > 0 && (i[s] = e);
130
- }, r.prototype.sub = function(t) {
131
- var e = this.buf, i = e.length, n, s;
132
- for (n = 0; n < i; ++n)
133
- s = e[n] - t, s < 0 ? (s += C, t = 1) : t = 0, e[n] = s;
134
- for (; e[e.length - 1] === 0; )
135
- e.pop();
136
- }, r.prototype.toString = function(t) {
137
- if ((t || 10) != 10)
138
- throw new Error("only base 10 is supported");
139
- for (var e = this.buf, i = e[e.length - 1].toString(), n = e.length - 2; n >= 0; --n)
140
- i += (C + e[n]).toString().substring(1);
141
- return i;
142
- }, r.prototype.valueOf = function() {
143
- for (var t = this.buf, e = 0, i = t.length - 1; i >= 0; --i)
144
- e = e * C + t[i];
145
- return e;
146
- }, r.prototype.simplify = function() {
147
- var t = this.buf;
148
- return t.length == 1 ? t[0] : this;
149
- }, r;
150
- }()
151
- ), mt = "…", At = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, Ot = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
152
- function F(r, t) {
153
- return r.length > t && (r = r.substring(0, t) + mt), r;
154
- }
155
- var it = (
156
- /** @class */
157
- function() {
158
- function r(t, e) {
159
- this.hexDigits = "0123456789ABCDEF", t instanceof r ? (this.enc = t.enc, this.pos = t.pos) : (this.enc = t, this.pos = e);
160
- }
161
- return r.prototype.get = function(t) {
162
- if (t === void 0 && (t = this.pos++), t >= this.enc.length)
163
- throw new Error("Requesting byte offset ".concat(t, " on a stream of length ").concat(this.enc.length));
164
- return typeof this.enc == "string" ? this.enc.charCodeAt(t) : this.enc[t];
165
- }, r.prototype.hexByte = function(t) {
166
- return this.hexDigits.charAt(t >> 4 & 15) + this.hexDigits.charAt(t & 15);
167
- }, r.prototype.hexDump = function(t, e, i) {
168
- for (var n = "", s = t; s < e; ++s)
169
- if (n += this.hexByte(this.get(s)), i !== !0)
170
- switch (s & 15) {
171
- case 7:
172
- n += " ";
173
- break;
174
- case 15:
175
- n += `
176
- `;
177
- break;
178
- default:
179
- n += " ";
180
- }
181
- return n;
182
- }, r.prototype.isASCII = function(t, e) {
183
- for (var i = t; i < e; ++i) {
184
- var n = this.get(i);
185
- if (n < 32 || n > 176)
186
- return !1;
187
- }
188
- return !0;
189
- }, r.prototype.parseStringISO = function(t, e) {
190
- for (var i = "", n = t; n < e; ++n)
191
- i += String.fromCharCode(this.get(n));
192
- return i;
193
- }, r.prototype.parseStringUTF = function(t, e) {
194
- for (var i = "", n = t; n < e; ) {
195
- var s = this.get(n++);
196
- s < 128 ? i += String.fromCharCode(s) : s > 191 && s < 224 ? i += String.fromCharCode((s & 31) << 6 | this.get(n++) & 63) : i += String.fromCharCode((s & 15) << 12 | (this.get(n++) & 63) << 6 | this.get(n++) & 63);
197
- }
198
- return i;
199
- }, r.prototype.parseStringBMP = function(t, e) {
200
- for (var i = "", n, s, h = t; h < e; )
201
- n = this.get(h++), s = this.get(h++), i += String.fromCharCode(n << 8 | s);
202
- return i;
203
- }, r.prototype.parseTime = function(t, e, i) {
204
- var n = this.parseStringISO(t, e), s = (i ? At : Ot).exec(n);
205
- return s ? (i && (s[1] = +s[1], s[1] += +s[1] < 70 ? 2e3 : 1900), n = s[1] + "-" + s[2] + "-" + s[3] + " " + s[4], s[5] && (n += ":" + s[5], s[6] && (n += ":" + s[6], s[7] && (n += "." + s[7]))), s[8] && (n += " UTC", s[8] != "Z" && (n += s[8], s[9] && (n += ":" + s[9]))), n) : "Unrecognized time: " + n;
206
- }, r.prototype.parseInteger = function(t, e) {
207
- for (var i = this.get(t), n = i > 127, s = n ? 255 : 0, h, o = ""; i == s && ++t < e; )
208
- i = this.get(t);
209
- if (h = e - t, h === 0)
210
- return n ? -1 : 0;
211
- if (h > 4) {
212
- for (o = i, h <<= 3; ((+o ^ s) & 128) == 0; )
213
- o = +o << 1, --h;
214
- o = "(" + h + ` bit)
215
- `;
216
- }
217
- n && (i = i - 256);
218
- for (var f = new j(i), a = t + 1; a < e; ++a)
219
- f.mulAdd(256, this.get(a));
220
- return o + f.toString();
221
- }, r.prototype.parseBitString = function(t, e, i) {
222
- for (var n = this.get(t), s = (e - t - 1 << 3) - n, h = "(" + s + ` bit)
223
- `, o = "", f = t + 1; f < e; ++f) {
224
- for (var a = this.get(f), l = f == e - 1 ? n : 0, g = 7; g >= l; --g)
225
- o += a >> g & 1 ? "1" : "0";
226
- if (o.length > i)
227
- return h + F(o, i);
228
- }
229
- return h + o;
230
- }, r.prototype.parseOctetString = function(t, e, i) {
231
- if (this.isASCII(t, e))
232
- return F(this.parseStringISO(t, e), i);
233
- var n = e - t, s = "(" + n + ` byte)
234
- `;
235
- i /= 2, n > i && (e = t + i);
236
- for (var h = t; h < e; ++h)
237
- s += this.hexByte(this.get(h));
238
- return n > i && (s += mt), s;
239
- }, r.prototype.parseOID = function(t, e, i) {
240
- for (var n = "", s = new j(), h = 0, o = t; o < e; ++o) {
241
- var f = this.get(o);
242
- if (s.mulAdd(128, f & 127), h += 7, !(f & 128)) {
243
- if (n === "")
244
- if (s = s.simplify(), s instanceof j)
245
- s.sub(80), n = "2." + s.toString();
246
- else {
247
- var a = s < 80 ? s < 40 ? 0 : 1 : 2;
248
- n = a + "." + (s - a * 40);
249
- }
250
- else
251
- n += "." + s.toString();
252
- if (n.length > i)
253
- return F(n, i);
254
- s = new j(), h = 0;
255
- }
256
- }
257
- return h > 0 && (n += ".incomplete"), n;
258
- }, r;
259
- }()
260
- ), Vt = (
261
- /** @class */
262
- function() {
263
- function r(t, e, i, n, s) {
264
- if (!(n instanceof ct))
265
- throw new Error("Invalid tag value.");
266
- this.stream = t, this.header = e, this.length = i, this.tag = n, this.sub = s;
267
- }
268
- return r.prototype.typeName = function() {
269
- switch (this.tag.tagClass) {
270
- case 0:
271
- switch (this.tag.tagNumber) {
272
- case 0:
273
- return "EOC";
274
- case 1:
275
- return "BOOLEAN";
276
- case 2:
277
- return "INTEGER";
278
- case 3:
279
- return "BIT_STRING";
280
- case 4:
281
- return "OCTET_STRING";
282
- case 5:
283
- return "NULL";
284
- case 6:
285
- return "OBJECT_IDENTIFIER";
286
- case 7:
287
- return "ObjectDescriptor";
288
- case 8:
289
- return "EXTERNAL";
290
- case 9:
291
- return "REAL";
292
- case 10:
293
- return "ENUMERATED";
294
- case 11:
295
- return "EMBEDDED_PDV";
296
- case 12:
297
- return "UTF8String";
298
- case 16:
299
- return "SEQUENCE";
300
- case 17:
301
- return "SET";
302
- case 18:
303
- return "NumericString";
304
- case 19:
305
- return "PrintableString";
306
- // ASCII subset
307
- case 20:
308
- return "TeletexString";
309
- // aka T61String
310
- case 21:
311
- return "VideotexString";
312
- case 22:
313
- return "IA5String";
314
- // ASCII
315
- case 23:
316
- return "UTCTime";
317
- case 24:
318
- return "GeneralizedTime";
319
- case 25:
320
- return "GraphicString";
321
- case 26:
322
- return "VisibleString";
323
- // ASCII subset
324
- case 27:
325
- return "GeneralString";
326
- case 28:
327
- return "UniversalString";
328
- case 30:
329
- return "BMPString";
330
- }
331
- return "Universal_" + this.tag.tagNumber.toString();
332
- case 1:
333
- return "Application_" + this.tag.tagNumber.toString();
334
- case 2:
335
- return "[" + this.tag.tagNumber.toString() + "]";
336
- // Context
337
- case 3:
338
- return "Private_" + this.tag.tagNumber.toString();
339
- }
340
- }, r.prototype.content = function(t) {
341
- if (this.tag === void 0)
342
- return null;
343
- t === void 0 && (t = 1 / 0);
344
- var e = this.posContent(), i = Math.abs(this.length);
345
- if (!this.tag.isUniversal())
346
- return this.sub !== null ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + i, t);
347
- switch (this.tag.tagNumber) {
348
- case 1:
349
- return this.stream.get(e) === 0 ? "false" : "true";
350
- case 2:
351
- return this.stream.parseInteger(e, e + i);
352
- case 3:
353
- return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(e, e + i, t);
354
- case 4:
355
- return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + i, t);
356
- // case 0x05: // NULL
357
- case 6:
358
- return this.stream.parseOID(e, e + i, t);
359
- // case 0x07: // ObjectDescriptor
360
- // case 0x08: // EXTERNAL
361
- // case 0x09: // REAL
362
- // case 0x0A: // ENUMERATED
363
- // case 0x0B: // EMBEDDED_PDV
364
- case 16:
365
- // SEQUENCE
366
- case 17:
367
- return this.sub !== null ? "(" + this.sub.length + " elem)" : "(no elem)";
368
- case 12:
369
- return F(this.stream.parseStringUTF(e, e + i), t);
370
- case 18:
371
- // NumericString
372
- case 19:
373
- // PrintableString
374
- case 20:
375
- // TeletexString
376
- case 21:
377
- // VideotexString
378
- case 22:
379
- // IA5String
380
- // case 0x19: // GraphicString
381
- case 26:
382
- return F(this.stream.parseStringISO(e, e + i), t);
383
- case 30:
384
- return F(this.stream.parseStringBMP(e, e + i), t);
385
- case 23:
386
- // UTCTime
387
- case 24:
388
- return this.stream.parseTime(e, e + i, this.tag.tagNumber == 23);
389
- }
390
- return null;
391
- }, r.prototype.toString = function() {
392
- return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (this.sub === null ? "null" : this.sub.length) + "]";
393
- }, r.prototype.toPrettyString = function(t) {
394
- t === void 0 && (t = "");
395
- var e = t + this.typeName() + " @" + this.stream.pos;
396
- if (this.length >= 0 && (e += "+"), e += this.length, this.tag.tagConstructed ? e += " (constructed)" : this.tag.isUniversal() && (this.tag.tagNumber == 3 || this.tag.tagNumber == 4) && this.sub !== null && (e += " (encapsulates)"), e += `
397
- `, this.sub !== null) {
398
- t += " ";
399
- for (var i = 0, n = this.sub.length; i < n; ++i)
400
- e += this.sub[i].toPrettyString(t);
401
- }
402
- return e;
403
- }, r.prototype.posStart = function() {
404
- return this.stream.pos;
405
- }, r.prototype.posContent = function() {
406
- return this.stream.pos + this.header;
407
- }, r.prototype.posEnd = function() {
408
- return this.stream.pos + this.header + Math.abs(this.length);
409
- }, r.prototype.toHexString = function() {
410
- return this.stream.hexDump(this.posStart(), this.posEnd(), !0);
411
- }, r.decodeLength = function(t) {
412
- var e = t.get(), i = e & 127;
413
- if (i == e)
414
- return i;
415
- if (i > 6)
416
- throw new Error("Length over 48 bits not supported at position " + (t.pos - 1));
417
- if (i === 0)
418
- return null;
419
- e = 0;
420
- for (var n = 0; n < i; ++n)
421
- e = e * 256 + t.get();
422
- return e;
423
- }, r.prototype.getHexStringValue = function() {
424
- var t = this.toHexString(), e = this.header * 2, i = this.length * 2;
425
- return t.substr(e, i);
426
- }, r.decode = function(t) {
427
- var e;
428
- t instanceof it ? e = t : e = new it(t, 0);
429
- var i = new it(e), n = new ct(e), s = r.decodeLength(e), h = e.pos, o = h - i.pos, f = null, a = function() {
430
- var g = [];
431
- if (s !== null) {
432
- for (var d = h + s; e.pos < d; )
433
- g[g.length] = r.decode(e);
434
- if (e.pos != d)
435
- throw new Error("Content size is not correct for container starting at offset " + h);
436
- } else
437
- try {
438
- for (; ; ) {
439
- var y = r.decode(e);
440
- if (y.tag.isEOC())
441
- break;
442
- g[g.length] = y;
443
- }
444
- s = h - e.pos;
445
- } catch (T) {
446
- throw new Error("Exception while decoding undefined length content: " + T);
447
- }
448
- return g;
449
- };
450
- if (n.tagConstructed)
451
- f = a();
452
- else if (n.isUniversal() && (n.tagNumber == 3 || n.tagNumber == 4))
453
- try {
454
- if (n.tagNumber == 3 && e.get() != 0)
455
- throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
456
- f = a();
457
- for (var l = 0; l < f.length; ++l)
458
- if (f[l].tag.isEOC())
459
- throw new Error("EOC is not supposed to be actual content.");
460
- } catch {
461
- f = null;
462
- }
463
- if (f === null) {
464
- if (s === null)
465
- throw new Error("We can't skip over an invalid tag with undefined length at offset " + h);
466
- e.pos = h + Math.abs(s);
467
- }
468
- return new r(i, o, s, n, f);
469
- }, r;
470
- }()
471
- ), ct = (
472
- /** @class */
473
- function() {
474
- function r(t) {
475
- var e = t.get();
476
- if (this.tagClass = e >> 6, this.tagConstructed = (e & 32) !== 0, this.tagNumber = e & 31, this.tagNumber == 31) {
477
- var i = new j();
478
- do
479
- e = t.get(), i.mulAdd(128, e & 127);
480
- while (e & 128);
481
- this.tagNumber = i.simplify();
482
- }
483
- }
484
- return r.prototype.isUniversal = function() {
485
- return this.tagClass === 0;
486
- }, r.prototype.isEOC = function() {
487
- return this.tagClass === 0 && this.tagNumber === 0;
488
- }, r;
489
- }()
490
- ), I, It = 244837814094590, pt = (It & 16777215) == 15715070, w = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], Nt = (1 << 26) / w[w.length - 1], c = (
491
- /** @class */
492
- function() {
493
- function r(t, e, i) {
494
- t != null && (typeof t == "number" ? this.fromNumber(t, e, i) : e == null && typeof t != "string" ? this.fromString(t, 256) : this.fromString(t, e));
495
- }
496
- return r.prototype.toString = function(t) {
497
- if (this.s < 0)
498
- return "-" + this.negate().toString(t);
499
- var e;
500
- if (t == 16)
501
- e = 4;
502
- else if (t == 8)
503
- e = 3;
504
- else if (t == 2)
505
- e = 1;
506
- else if (t == 32)
507
- e = 5;
508
- else if (t == 4)
509
- e = 2;
510
- else
511
- return this.toRadix(t);
512
- var i = (1 << e) - 1, n, s = !1, h = "", o = this.t, f = this.DB - o * this.DB % e;
513
- if (o-- > 0)
514
- for (f < this.DB && (n = this[o] >> f) > 0 && (s = !0, h = A(n)); o >= 0; )
515
- f < e ? (n = (this[o] & (1 << f) - 1) << e - f, n |= this[--o] >> (f += this.DB - e)) : (n = this[o] >> (f -= e) & i, f <= 0 && (f += this.DB, --o)), n > 0 && (s = !0), s && (h += A(n));
516
- return s ? h : "0";
517
- }, r.prototype.negate = function() {
518
- var t = p();
519
- return r.ZERO.subTo(this, t), t;
520
- }, r.prototype.abs = function() {
521
- return this.s < 0 ? this.negate() : this;
522
- }, r.prototype.compareTo = function(t) {
523
- var e = this.s - t.s;
524
- if (e != 0)
525
- return e;
526
- var i = this.t;
527
- if (e = i - t.t, e != 0)
528
- return this.s < 0 ? -e : e;
529
- for (; --i >= 0; )
530
- if ((e = this[i] - t[i]) != 0)
531
- return e;
532
- return 0;
533
- }, r.prototype.bitLength = function() {
534
- return this.t <= 0 ? 0 : this.DB * (this.t - 1) + G(this[this.t - 1] ^ this.s & this.DM);
535
- }, r.prototype.mod = function(t) {
536
- var e = p();
537
- return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(r.ZERO) > 0 && t.subTo(e, e), e;
538
- }, r.prototype.modPowInt = function(t, e) {
539
- var i;
540
- return t < 256 || e.isEven() ? i = new gt(e) : i = new vt(e), this.exp(t, i);
541
- }, r.prototype.clone = function() {
542
- var t = p();
543
- return this.copyTo(t), t;
544
- }, r.prototype.intValue = function() {
545
- if (this.s < 0) {
546
- if (this.t == 1)
547
- return this[0] - this.DV;
548
- if (this.t == 0)
549
- return -1;
550
- } else {
551
- if (this.t == 1)
552
- return this[0];
553
- if (this.t == 0)
554
- return 0;
555
- }
556
- return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
557
- }, r.prototype.byteValue = function() {
558
- return this.t == 0 ? this.s : this[0] << 24 >> 24;
559
- }, r.prototype.shortValue = function() {
560
- return this.t == 0 ? this.s : this[0] << 16 >> 16;
561
- }, r.prototype.signum = function() {
562
- return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
563
- }, r.prototype.toByteArray = function() {
564
- var t = this.t, e = [];
565
- e[0] = this.s;
566
- var i = this.DB - t * this.DB % 8, n, s = 0;
567
- if (t-- > 0)
568
- for (i < this.DB && (n = this[t] >> i) != (this.s & this.DM) >> i && (e[s++] = n | this.s << this.DB - i); t >= 0; )
569
- i < 8 ? (n = (this[t] & (1 << i) - 1) << 8 - i, n |= this[--t] >> (i += this.DB - 8)) : (n = this[t] >> (i -= 8) & 255, i <= 0 && (i += this.DB, --t)), (n & 128) != 0 && (n |= -256), s == 0 && (this.s & 128) != (n & 128) && ++s, (s > 0 || n != this.s) && (e[s++] = n);
570
- return e;
571
- }, r.prototype.equals = function(t) {
572
- return this.compareTo(t) == 0;
573
- }, r.prototype.min = function(t) {
574
- return this.compareTo(t) < 0 ? this : t;
575
- }, r.prototype.max = function(t) {
576
- return this.compareTo(t) > 0 ? this : t;
577
- }, r.prototype.and = function(t) {
578
- var e = p();
579
- return this.bitwiseTo(t, Dt, e), e;
580
- }, r.prototype.or = function(t) {
581
- var e = p();
582
- return this.bitwiseTo(t, Z, e), e;
583
- }, r.prototype.xor = function(t) {
584
- var e = p();
585
- return this.bitwiseTo(t, ut, e), e;
586
- }, r.prototype.andNot = function(t) {
587
- var e = p();
588
- return this.bitwiseTo(t, at, e), e;
589
- }, r.prototype.not = function() {
590
- for (var t = p(), e = 0; e < this.t; ++e)
591
- t[e] = this.DM & ~this[e];
592
- return t.t = this.t, t.s = ~this.s, t;
593
- }, r.prototype.shiftLeft = function(t) {
594
- var e = p();
595
- return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e;
596
- }, r.prototype.shiftRight = function(t) {
597
- var e = p();
598
- return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e;
599
- }, r.prototype.getLowestSetBit = function() {
600
- for (var t = 0; t < this.t; ++t)
601
- if (this[t] != 0)
602
- return t * this.DB + xt(this[t]);
603
- return this.s < 0 ? this.t * this.DB : -1;
604
- }, r.prototype.bitCount = function() {
605
- for (var t = 0, e = this.s & this.DM, i = 0; i < this.t; ++i)
606
- t += Rt(this[i] ^ e);
607
- return t;
608
- }, r.prototype.testBit = function(t) {
609
- var e = Math.floor(t / this.DB);
610
- return e >= this.t ? this.s != 0 : (this[e] & 1 << t % this.DB) != 0;
611
- }, r.prototype.setBit = function(t) {
612
- return this.changeBit(t, Z);
613
- }, r.prototype.clearBit = function(t) {
614
- return this.changeBit(t, at);
615
- }, r.prototype.flipBit = function(t) {
616
- return this.changeBit(t, ut);
617
- }, r.prototype.add = function(t) {
618
- var e = p();
619
- return this.addTo(t, e), e;
620
- }, r.prototype.subtract = function(t) {
621
- var e = p();
622
- return this.subTo(t, e), e;
623
- }, r.prototype.multiply = function(t) {
624
- var e = p();
625
- return this.multiplyTo(t, e), e;
626
- }, r.prototype.divide = function(t) {
627
- var e = p();
628
- return this.divRemTo(t, e, null), e;
629
- }, r.prototype.remainder = function(t) {
630
- var e = p();
631
- return this.divRemTo(t, null, e), e;
632
- }, r.prototype.divideAndRemainder = function(t) {
633
- var e = p(), i = p();
634
- return this.divRemTo(t, e, i), [e, i];
635
- }, r.prototype.modPow = function(t, e) {
636
- var i = t.bitLength(), n, s = O(1), h;
637
- if (i <= 0)
638
- return s;
639
- i < 18 ? n = 1 : i < 48 ? n = 3 : i < 144 ? n = 4 : i < 768 ? n = 5 : n = 6, i < 8 ? h = new gt(e) : e.isEven() ? h = new Mt(e) : h = new vt(e);
640
- var o = [], f = 3, a = n - 1, l = (1 << n) - 1;
641
- if (o[1] = h.convert(this), n > 1) {
642
- var g = p();
643
- for (h.sqrTo(o[1], g); f <= l; )
644
- o[f] = p(), h.mulTo(g, o[f - 2], o[f]), f += 2;
645
- }
646
- var d = t.t - 1, y, T = !0, b = p(), E;
647
- for (i = G(t[d]) - 1; d >= 0; ) {
648
- for (i >= a ? y = t[d] >> i - a & l : (y = (t[d] & (1 << i + 1) - 1) << a - i, d > 0 && (y |= t[d - 1] >> this.DB + i - a)), f = n; (y & 1) == 0; )
649
- y >>= 1, --f;
650
- if ((i -= f) < 0 && (i += this.DB, --d), T)
651
- o[y].copyTo(s), T = !1;
652
- else {
653
- for (; f > 1; )
654
- h.sqrTo(s, b), h.sqrTo(b, s), f -= 2;
655
- f > 0 ? h.sqrTo(s, b) : (E = s, s = b, b = E), h.mulTo(b, o[y], s);
656
- }
657
- for (; d >= 0 && (t[d] & 1 << i) == 0; )
658
- h.sqrTo(s, b), E = s, s = b, b = E, --i < 0 && (i = this.DB - 1, --d);
659
- }
660
- return h.revert(s);
661
- }, r.prototype.modInverse = function(t) {
662
- var e = t.isEven();
663
- if (this.isEven() && e || t.signum() == 0)
664
- return r.ZERO;
665
- for (var i = t.clone(), n = this.clone(), s = O(1), h = O(0), o = O(0), f = O(1); i.signum() != 0; ) {
666
- for (; i.isEven(); )
667
- i.rShiftTo(1, i), e ? ((!s.isEven() || !h.isEven()) && (s.addTo(this, s), h.subTo(t, h)), s.rShiftTo(1, s)) : h.isEven() || h.subTo(t, h), h.rShiftTo(1, h);
668
- for (; n.isEven(); )
669
- n.rShiftTo(1, n), e ? ((!o.isEven() || !f.isEven()) && (o.addTo(this, o), f.subTo(t, f)), o.rShiftTo(1, o)) : f.isEven() || f.subTo(t, f), f.rShiftTo(1, f);
670
- i.compareTo(n) >= 0 ? (i.subTo(n, i), e && s.subTo(o, s), h.subTo(f, h)) : (n.subTo(i, n), e && o.subTo(s, o), f.subTo(h, f));
671
- }
672
- if (n.compareTo(r.ONE) != 0)
673
- return r.ZERO;
674
- if (f.compareTo(t) >= 0)
675
- return f.subtract(t);
676
- if (f.signum() < 0)
677
- f.addTo(t, f);
678
- else
679
- return f;
680
- return f.signum() < 0 ? f.add(t) : f;
681
- }, r.prototype.pow = function(t) {
682
- return this.exp(t, new Pt());
683
- }, r.prototype.gcd = function(t) {
684
- var e = this.s < 0 ? this.negate() : this.clone(), i = t.s < 0 ? t.negate() : t.clone();
685
- if (e.compareTo(i) < 0) {
686
- var n = e;
687
- e = i, i = n;
688
- }
689
- var s = e.getLowestSetBit(), h = i.getLowestSetBit();
690
- if (h < 0)
691
- return e;
692
- for (s < h && (h = s), h > 0 && (e.rShiftTo(h, e), i.rShiftTo(h, i)); e.signum() > 0; )
693
- (s = e.getLowestSetBit()) > 0 && e.rShiftTo(s, e), (s = i.getLowestSetBit()) > 0 && i.rShiftTo(s, i), e.compareTo(i) >= 0 ? (e.subTo(i, e), e.rShiftTo(1, e)) : (i.subTo(e, i), i.rShiftTo(1, i));
694
- return h > 0 && i.lShiftTo(h, i), i;
695
- }, r.prototype.isProbablePrime = function(t) {
696
- var e, i = this.abs();
697
- if (i.t == 1 && i[0] <= w[w.length - 1]) {
698
- for (e = 0; e < w.length; ++e)
699
- if (i[0] == w[e])
700
- return !0;
701
- return !1;
702
- }
703
- if (i.isEven())
704
- return !1;
705
- for (e = 1; e < w.length; ) {
706
- for (var n = w[e], s = e + 1; s < w.length && n < Nt; )
707
- n *= w[s++];
708
- for (n = i.modInt(n); e < s; )
709
- if (n % w[e++] == 0)
710
- return !1;
711
- }
712
- return i.millerRabin(t);
713
- }, r.prototype.copyTo = function(t) {
714
- for (var e = this.t - 1; e >= 0; --e)
715
- t[e] = this[e];
716
- t.t = this.t, t.s = this.s;
717
- }, r.prototype.fromInt = function(t) {
718
- this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0;
719
- }, r.prototype.fromString = function(t, e) {
720
- var i;
721
- if (e == 16)
722
- i = 4;
723
- else if (e == 8)
724
- i = 3;
725
- else if (e == 256)
726
- i = 8;
727
- else if (e == 2)
728
- i = 1;
729
- else if (e == 32)
730
- i = 5;
731
- else if (e == 4)
732
- i = 2;
733
- else {
734
- this.fromRadix(t, e);
735
- return;
736
- }
737
- this.t = 0, this.s = 0;
738
- for (var n = t.length, s = !1, h = 0; --n >= 0; ) {
739
- var o = i == 8 ? +t[n] & 255 : yt(t, n);
740
- if (o < 0) {
741
- t.charAt(n) == "-" && (s = !0);
742
- continue;
743
- }
744
- s = !1, h == 0 ? this[this.t++] = o : h + i > this.DB ? (this[this.t - 1] |= (o & (1 << this.DB - h) - 1) << h, this[this.t++] = o >> this.DB - h) : this[this.t - 1] |= o << h, h += i, h >= this.DB && (h -= this.DB);
745
- }
746
- i == 8 && (+t[0] & 128) != 0 && (this.s = -1, h > 0 && (this[this.t - 1] |= (1 << this.DB - h) - 1 << h)), this.clamp(), s && r.ZERO.subTo(this, this);
747
- }, r.prototype.clamp = function() {
748
- for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; )
749
- --this.t;
750
- }, r.prototype.dlShiftTo = function(t, e) {
751
- var i;
752
- for (i = this.t - 1; i >= 0; --i)
753
- e[i + t] = this[i];
754
- for (i = t - 1; i >= 0; --i)
755
- e[i] = 0;
756
- e.t = this.t + t, e.s = this.s;
757
- }, r.prototype.drShiftTo = function(t, e) {
758
- for (var i = t; i < this.t; ++i)
759
- e[i - t] = this[i];
760
- e.t = Math.max(this.t - t, 0), e.s = this.s;
761
- }, r.prototype.lShiftTo = function(t, e) {
762
- for (var i = t % this.DB, n = this.DB - i, s = (1 << n) - 1, h = Math.floor(t / this.DB), o = this.s << i & this.DM, f = this.t - 1; f >= 0; --f)
763
- e[f + h + 1] = this[f] >> n | o, o = (this[f] & s) << i;
764
- for (var f = h - 1; f >= 0; --f)
765
- e[f] = 0;
766
- e[h] = o, e.t = this.t + h + 1, e.s = this.s, e.clamp();
767
- }, r.prototype.rShiftTo = function(t, e) {
768
- e.s = this.s;
769
- var i = Math.floor(t / this.DB);
770
- if (i >= this.t) {
771
- e.t = 0;
772
- return;
773
- }
774
- var n = t % this.DB, s = this.DB - n, h = (1 << n) - 1;
775
- e[0] = this[i] >> n;
776
- for (var o = i + 1; o < this.t; ++o)
777
- e[o - i - 1] |= (this[o] & h) << s, e[o - i] = this[o] >> n;
778
- n > 0 && (e[this.t - i - 1] |= (this.s & h) << s), e.t = this.t - i, e.clamp();
779
- }, r.prototype.subTo = function(t, e) {
780
- for (var i = 0, n = 0, s = Math.min(t.t, this.t); i < s; )
781
- n += this[i] - t[i], e[i++] = n & this.DM, n >>= this.DB;
782
- if (t.t < this.t) {
783
- for (n -= t.s; i < this.t; )
784
- n += this[i], e[i++] = n & this.DM, n >>= this.DB;
785
- n += this.s;
786
- } else {
787
- for (n += this.s; i < t.t; )
788
- n -= t[i], e[i++] = n & this.DM, n >>= this.DB;
789
- n -= t.s;
790
- }
791
- e.s = n < 0 ? -1 : 0, n < -1 ? e[i++] = this.DV + n : n > 0 && (e[i++] = n), e.t = i, e.clamp();
792
- }, r.prototype.multiplyTo = function(t, e) {
793
- var i = this.abs(), n = t.abs(), s = i.t;
794
- for (e.t = s + n.t; --s >= 0; )
795
- e[s] = 0;
796
- for (s = 0; s < n.t; ++s)
797
- e[s + i.t] = i.am(0, n[s], e, s, 0, i.t);
798
- e.s = 0, e.clamp(), this.s != t.s && r.ZERO.subTo(e, e);
799
- }, r.prototype.squareTo = function(t) {
800
- for (var e = this.abs(), i = t.t = 2 * e.t; --i >= 0; )
801
- t[i] = 0;
802
- for (i = 0; i < e.t - 1; ++i) {
803
- var n = e.am(i, e[i], t, 2 * i, 0, 1);
804
- (t[i + e.t] += e.am(i + 1, 2 * e[i], t, 2 * i + 1, n, e.t - i - 1)) >= e.DV && (t[i + e.t] -= e.DV, t[i + e.t + 1] = 1);
805
- }
806
- t.t > 0 && (t[t.t - 1] += e.am(i, e[i], t, 2 * i, 0, 1)), t.s = 0, t.clamp();
807
- }, r.prototype.divRemTo = function(t, e, i) {
808
- var n = t.abs();
809
- if (!(n.t <= 0)) {
810
- var s = this.abs();
811
- if (s.t < n.t) {
812
- e != null && e.fromInt(0), i != null && this.copyTo(i);
813
- return;
814
- }
815
- i == null && (i = p());
816
- var h = p(), o = this.s, f = t.s, a = this.DB - G(n[n.t - 1]);
817
- a > 0 ? (n.lShiftTo(a, h), s.lShiftTo(a, i)) : (n.copyTo(h), s.copyTo(i));
818
- var l = h.t, g = h[l - 1];
819
- if (g != 0) {
820
- var d = g * (1 << this.F1) + (l > 1 ? h[l - 2] >> this.F2 : 0), y = this.FV / d, T = (1 << this.F1) / d, b = 1 << this.F2, E = i.t, M = E - l, B = e ?? p();
821
- for (h.dlShiftTo(M, B), i.compareTo(B) >= 0 && (i[i.t++] = 1, i.subTo(B, i)), r.ONE.dlShiftTo(l, B), B.subTo(h, h); h.t < l; )
822
- h[h.t++] = 0;
823
- for (; --M >= 0; ) {
824
- var q = i[--E] == g ? this.DM : Math.floor(i[E] * y + (i[E - 1] + b) * T);
825
- if ((i[E] += h.am(0, q, i, M, 0, l)) < q)
826
- for (h.dlShiftTo(M, B), i.subTo(B, i); i[E] < --q; )
827
- i.subTo(B, i);
828
- }
829
- e != null && (i.drShiftTo(l, e), o != f && r.ZERO.subTo(e, e)), i.t = l, i.clamp(), a > 0 && i.rShiftTo(a, i), o < 0 && r.ZERO.subTo(i, i);
830
- }
831
- }
832
- }, r.prototype.invDigit = function() {
833
- if (this.t < 1)
834
- return 0;
835
- var t = this[0];
836
- if ((t & 1) == 0)
837
- return 0;
838
- var e = t & 3;
839
- return e = e * (2 - (t & 15) * e) & 15, e = e * (2 - (t & 255) * e) & 255, e = e * (2 - ((t & 65535) * e & 65535)) & 65535, e = e * (2 - t * e % this.DV) % this.DV, e > 0 ? this.DV - e : -e;
840
- }, r.prototype.isEven = function() {
841
- return (this.t > 0 ? this[0] & 1 : this.s) == 0;
842
- }, r.prototype.exp = function(t, e) {
843
- if (t > 4294967295 || t < 1)
844
- return r.ONE;
845
- var i = p(), n = p(), s = e.convert(this), h = G(t) - 1;
846
- for (s.copyTo(i); --h >= 0; )
847
- if (e.sqrTo(i, n), (t & 1 << h) > 0)
848
- e.mulTo(n, s, i);
849
- else {
850
- var o = i;
851
- i = n, n = o;
852
- }
853
- return e.revert(i);
854
- }, r.prototype.chunkSize = function(t) {
855
- return Math.floor(Math.LN2 * this.DB / Math.log(t));
856
- }, r.prototype.toRadix = function(t) {
857
- if (t == null && (t = 10), this.signum() == 0 || t < 2 || t > 36)
858
- return "0";
859
- var e = this.chunkSize(t), i = Math.pow(t, e), n = O(i), s = p(), h = p(), o = "";
860
- for (this.divRemTo(n, s, h); s.signum() > 0; )
861
- o = (i + h.intValue()).toString(t).substr(1) + o, s.divRemTo(n, s, h);
862
- return h.intValue().toString(t) + o;
863
- }, r.prototype.fromRadix = function(t, e) {
864
- this.fromInt(0), e == null && (e = 10);
865
- for (var i = this.chunkSize(e), n = Math.pow(e, i), s = !1, h = 0, o = 0, f = 0; f < t.length; ++f) {
866
- var a = yt(t, f);
867
- if (a < 0) {
868
- t.charAt(f) == "-" && this.signum() == 0 && (s = !0);
869
- continue;
870
- }
871
- o = e * o + a, ++h >= i && (this.dMultiply(n), this.dAddOffset(o, 0), h = 0, o = 0);
872
- }
873
- h > 0 && (this.dMultiply(Math.pow(e, h)), this.dAddOffset(o, 0)), s && r.ZERO.subTo(this, this);
874
- }, r.prototype.fromNumber = function(t, e, i) {
875
- if (typeof e == "number")
876
- if (t < 2)
877
- this.fromInt(1);
878
- else
879
- for (this.fromNumber(t, i), this.testBit(t - 1) || this.bitwiseTo(r.ONE.shiftLeft(t - 1), Z, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e); )
880
- this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(r.ONE.shiftLeft(t - 1), this);
881
- else {
882
- var n = [], s = t & 7;
883
- n.length = (t >> 3) + 1, e.nextBytes(n), s > 0 ? n[0] &= (1 << s) - 1 : n[0] = 0, this.fromString(n, 256);
884
- }
885
- }, r.prototype.bitwiseTo = function(t, e, i) {
886
- var n, s, h = Math.min(t.t, this.t);
887
- for (n = 0; n < h; ++n)
888
- i[n] = e(this[n], t[n]);
889
- if (t.t < this.t) {
890
- for (s = t.s & this.DM, n = h; n < this.t; ++n)
891
- i[n] = e(this[n], s);
892
- i.t = this.t;
893
- } else {
894
- for (s = this.s & this.DM, n = h; n < t.t; ++n)
895
- i[n] = e(s, t[n]);
896
- i.t = t.t;
897
- }
898
- i.s = e(this.s, t.s), i.clamp();
899
- }, r.prototype.changeBit = function(t, e) {
900
- var i = r.ONE.shiftLeft(t);
901
- return this.bitwiseTo(i, e, i), i;
902
- }, r.prototype.addTo = function(t, e) {
903
- for (var i = 0, n = 0, s = Math.min(t.t, this.t); i < s; )
904
- n += this[i] + t[i], e[i++] = n & this.DM, n >>= this.DB;
905
- if (t.t < this.t) {
906
- for (n += t.s; i < this.t; )
907
- n += this[i], e[i++] = n & this.DM, n >>= this.DB;
908
- n += this.s;
909
- } else {
910
- for (n += this.s; i < t.t; )
911
- n += t[i], e[i++] = n & this.DM, n >>= this.DB;
912
- n += t.s;
913
- }
914
- e.s = n < 0 ? -1 : 0, n > 0 ? e[i++] = n : n < -1 && (e[i++] = this.DV + n), e.t = i, e.clamp();
915
- }, r.prototype.dMultiply = function(t) {
916
- this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp();
917
- }, r.prototype.dAddOffset = function(t, e) {
918
- if (t != 0) {
919
- for (; this.t <= e; )
920
- this[this.t++] = 0;
921
- for (this[e] += t; this[e] >= this.DV; )
922
- this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e];
923
- }
924
- }, r.prototype.multiplyLowerTo = function(t, e, i) {
925
- var n = Math.min(this.t + t.t, e);
926
- for (i.s = 0, i.t = n; n > 0; )
927
- i[--n] = 0;
928
- for (var s = i.t - this.t; n < s; ++n)
929
- i[n + this.t] = this.am(0, t[n], i, n, 0, this.t);
930
- for (var s = Math.min(t.t, e); n < s; ++n)
931
- this.am(0, t[n], i, n, 0, e - n);
932
- i.clamp();
933
- }, r.prototype.multiplyUpperTo = function(t, e, i) {
934
- --e;
935
- var n = i.t = this.t + t.t - e;
936
- for (i.s = 0; --n >= 0; )
937
- i[n] = 0;
938
- for (n = Math.max(e - this.t, 0); n < t.t; ++n)
939
- i[this.t + n - e] = this.am(e - n, t[n], i, 0, 0, this.t + n - e);
940
- i.clamp(), i.drShiftTo(1, i);
941
- }, r.prototype.modInt = function(t) {
942
- if (t <= 0)
943
- return 0;
944
- var e = this.DV % t, i = this.s < 0 ? t - 1 : 0;
945
- if (this.t > 0)
946
- if (e == 0)
947
- i = this[0] % t;
948
- else
949
- for (var n = this.t - 1; n >= 0; --n)
950
- i = (e * i + this[n]) % t;
951
- return i;
952
- }, r.prototype.millerRabin = function(t) {
953
- var e = this.subtract(r.ONE), i = e.getLowestSetBit();
954
- if (i <= 0)
955
- return !1;
956
- var n = e.shiftRight(i);
957
- t = t + 1 >> 1, t > w.length && (t = w.length);
958
- for (var s = p(), h = 0; h < t; ++h) {
959
- s.fromInt(w[Math.floor(Math.random() * w.length)]);
960
- var o = s.modPow(n, this);
961
- if (o.compareTo(r.ONE) != 0 && o.compareTo(e) != 0) {
962
- for (var f = 1; f++ < i && o.compareTo(e) != 0; )
963
- if (o = o.modPowInt(2, this), o.compareTo(r.ONE) == 0)
964
- return !1;
965
- if (o.compareTo(e) != 0)
966
- return !1;
967
- }
968
- }
969
- return !0;
970
- }, r.prototype.square = function() {
971
- var t = p();
972
- return this.squareTo(t), t;
973
- }, r.prototype.gcda = function(t, e) {
974
- var i = this.s < 0 ? this.negate() : this.clone(), n = t.s < 0 ? t.negate() : t.clone();
975
- if (i.compareTo(n) < 0) {
976
- var s = i;
977
- i = n, n = s;
978
- }
979
- var h = i.getLowestSetBit(), o = n.getLowestSetBit();
980
- if (o < 0) {
981
- e(i);
982
- return;
983
- }
984
- h < o && (o = h), o > 0 && (i.rShiftTo(o, i), n.rShiftTo(o, n));
985
- var f = function() {
986
- (h = i.getLowestSetBit()) > 0 && i.rShiftTo(h, i), (h = n.getLowestSetBit()) > 0 && n.rShiftTo(h, n), i.compareTo(n) >= 0 ? (i.subTo(n, i), i.rShiftTo(1, i)) : (n.subTo(i, n), n.rShiftTo(1, n)), i.signum() > 0 ? setTimeout(f, 0) : (o > 0 && n.lShiftTo(o, n), setTimeout(function() {
987
- e(n);
988
- }, 0));
989
- };
990
- setTimeout(f, 10);
991
- }, r.prototype.fromNumberAsync = function(t, e, i, n) {
992
- if (typeof e == "number")
993
- if (t < 2)
994
- this.fromInt(1);
995
- else {
996
- this.fromNumber(t, i), this.testBit(t - 1) || this.bitwiseTo(r.ONE.shiftLeft(t - 1), Z, this), this.isEven() && this.dAddOffset(1, 0);
997
- var s = this, h = function() {
998
- s.dAddOffset(2, 0), s.bitLength() > t && s.subTo(r.ONE.shiftLeft(t - 1), s), s.isProbablePrime(e) ? setTimeout(function() {
999
- n();
1000
- }, 0) : setTimeout(h, 0);
1001
- };
1002
- setTimeout(h, 0);
1003
- }
1004
- else {
1005
- var o = [], f = t & 7;
1006
- o.length = (t >> 3) + 1, e.nextBytes(o), f > 0 ? o[0] &= (1 << f) - 1 : o[0] = 0, this.fromString(o, 256);
1007
- }
1008
- }, r;
1009
- }()
1010
- ), Pt = (
1011
- /** @class */
1012
- function() {
1013
- function r() {
1014
- }
1015
- return r.prototype.convert = function(t) {
1016
- return t;
1017
- }, r.prototype.revert = function(t) {
1018
- return t;
1019
- }, r.prototype.mulTo = function(t, e, i) {
1020
- t.multiplyTo(e, i);
1021
- }, r.prototype.sqrTo = function(t, e) {
1022
- t.squareTo(e);
1023
- }, r;
1024
- }()
1025
- ), gt = (
1026
- /** @class */
1027
- function() {
1028
- function r(t) {
1029
- this.m = t;
1030
- }
1031
- return r.prototype.convert = function(t) {
1032
- return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t;
1033
- }, r.prototype.revert = function(t) {
1034
- return t;
1035
- }, r.prototype.reduce = function(t) {
1036
- t.divRemTo(this.m, null, t);
1037
- }, r.prototype.mulTo = function(t, e, i) {
1038
- t.multiplyTo(e, i), this.reduce(i);
1039
- }, r.prototype.sqrTo = function(t, e) {
1040
- t.squareTo(e), this.reduce(e);
1041
- }, r;
1042
- }()
1043
- ), vt = (
1044
- /** @class */
1045
- function() {
1046
- function r(t) {
1047
- this.m = t, this.mp = t.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t;
1048
- }
1049
- return r.prototype.convert = function(t) {
1050
- var e = p();
1051
- return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(c.ZERO) > 0 && this.m.subTo(e, e), e;
1052
- }, r.prototype.revert = function(t) {
1053
- var e = p();
1054
- return t.copyTo(e), this.reduce(e), e;
1055
- }, r.prototype.reduce = function(t) {
1056
- for (; t.t <= this.mt2; )
1057
- t[t.t++] = 0;
1058
- for (var e = 0; e < this.m.t; ++e) {
1059
- var i = t[e] & 32767, n = i * this.mpl + ((i * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;
1060
- for (i = e + this.m.t, t[i] += this.m.am(0, n, t, e, 0, this.m.t); t[i] >= t.DV; )
1061
- t[i] -= t.DV, t[++i]++;
1062
- }
1063
- t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t);
1064
- }, r.prototype.mulTo = function(t, e, i) {
1065
- t.multiplyTo(e, i), this.reduce(i);
1066
- }, r.prototype.sqrTo = function(t, e) {
1067
- t.squareTo(e), this.reduce(e);
1068
- }, r;
1069
- }()
1070
- ), Mt = (
1071
- /** @class */
1072
- function() {
1073
- function r(t) {
1074
- this.m = t, this.r2 = p(), this.q3 = p(), c.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t);
1075
- }
1076
- return r.prototype.convert = function(t) {
1077
- if (t.s < 0 || t.t > 2 * this.m.t)
1078
- return t.mod(this.m);
1079
- if (t.compareTo(this.m) < 0)
1080
- return t;
1081
- var e = p();
1082
- return t.copyTo(e), this.reduce(e), e;
1083
- }, r.prototype.revert = function(t) {
1084
- return t;
1085
- }, r.prototype.reduce = function(t) {
1086
- for (t.drShiftTo(this.m.t - 1, this.r2), t.t > this.m.t + 1 && (t.t = this.m.t + 1, t.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0; )
1087
- t.dAddOffset(1, this.m.t + 1);
1088
- for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0; )
1089
- t.subTo(this.m, t);
1090
- }, r.prototype.mulTo = function(t, e, i) {
1091
- t.multiplyTo(e, i), this.reduce(i);
1092
- }, r.prototype.sqrTo = function(t, e) {
1093
- t.squareTo(e), this.reduce(e);
1094
- }, r;
1095
- }()
1096
- );
1097
- function p() {
1098
- return new c(null);
1099
- }
1100
- function S(r, t) {
1101
- return new c(r, t);
1102
- }
1103
- var dt = typeof navigator < "u";
1104
- dt && pt && navigator.appName == "Microsoft Internet Explorer" ? (c.prototype.am = function(t, e, i, n, s, h) {
1105
- for (var o = e & 32767, f = e >> 15; --h >= 0; ) {
1106
- var a = this[t] & 32767, l = this[t++] >> 15, g = f * a + l * o;
1107
- a = o * a + ((g & 32767) << 15) + i[n] + (s & 1073741823), s = (a >>> 30) + (g >>> 15) + f * l + (s >>> 30), i[n++] = a & 1073741823;
1108
- }
1109
- return s;
1110
- }, I = 30) : dt && pt && navigator.appName != "Netscape" ? (c.prototype.am = function(t, e, i, n, s, h) {
1111
- for (; --h >= 0; ) {
1112
- var o = e * this[t++] + i[n] + s;
1113
- s = Math.floor(o / 67108864), i[n++] = o & 67108863;
1114
- }
1115
- return s;
1116
- }, I = 26) : (c.prototype.am = function(t, e, i, n, s, h) {
1117
- for (var o = e & 16383, f = e >> 14; --h >= 0; ) {
1118
- var a = this[t] & 16383, l = this[t++] >> 14, g = f * a + l * o;
1119
- a = o * a + ((g & 16383) << 14) + i[n] + s, s = (a >> 28) + (g >> 14) + f * l, i[n++] = a & 268435455;
1120
- }
1121
- return s;
1122
- }, I = 28);
1123
- c.prototype.DB = I;
1124
- c.prototype.DM = (1 << I) - 1;
1125
- c.prototype.DV = 1 << I;
1126
- var ht = 52;
1127
- c.prototype.FV = Math.pow(2, ht);
1128
- c.prototype.F1 = ht - I;
1129
- c.prototype.F2 = 2 * I - ht;
1130
- var tt = [], L, D;
1131
- L = 48;
1132
- for (D = 0; D <= 9; ++D)
1133
- tt[L++] = D;
1134
- L = 97;
1135
- for (D = 10; D < 36; ++D)
1136
- tt[L++] = D;
1137
- L = 65;
1138
- for (D = 10; D < 36; ++D)
1139
- tt[L++] = D;
1140
- function yt(r, t) {
1141
- var e = tt[r.charCodeAt(t)];
1142
- return e ?? -1;
1143
- }
1144
- function O(r) {
1145
- var t = p();
1146
- return t.fromInt(r), t;
1147
- }
1148
- function G(r) {
1149
- var t = 1, e;
1150
- return (e = r >>> 16) != 0 && (r = e, t += 16), (e = r >> 8) != 0 && (r = e, t += 8), (e = r >> 4) != 0 && (r = e, t += 4), (e = r >> 2) != 0 && (r = e, t += 2), (e = r >> 1) != 0 && (r = e, t += 1), t;
1151
- }
1152
- c.ZERO = O(0);
1153
- c.ONE = O(1);
1154
- var qt = (
1155
- /** @class */
1156
- function() {
1157
- function r() {
1158
- this.i = 0, this.j = 0, this.S = [];
1159
- }
1160
- return r.prototype.init = function(t) {
1161
- var e, i, n;
1162
- for (e = 0; e < 256; ++e)
1163
- this.S[e] = e;
1164
- for (i = 0, e = 0; e < 256; ++e)
1165
- i = i + this.S[e] + t[e % t.length] & 255, n = this.S[e], this.S[e] = this.S[i], this.S[i] = n;
1166
- this.i = 0, this.j = 0;
1167
- }, r.prototype.next = function() {
1168
- var t;
1169
- return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, t = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = t, this.S[t + this.S[this.i] & 255];
1170
- }, r;
1171
- }()
1172
- );
1173
- function Ht() {
1174
- return new qt();
1175
- }
1176
- var bt = 256, $, V = null, R;
1177
- if (V == null) {
1178
- V = [], R = 0;
1179
- var J = void 0;
1180
- if (typeof window < "u" && window.crypto && window.crypto.getRandomValues) {
1181
- var rt = new Uint32Array(256);
1182
- for (window.crypto.getRandomValues(rt), J = 0; J < rt.length; ++J)
1183
- V[R++] = rt[J] & 255;
1184
- }
1185
- var Y = 0, X = function(r) {
1186
- if (Y = Y || 0, Y >= 256 || R >= bt) {
1187
- window.removeEventListener ? window.removeEventListener("mousemove", X, !1) : window.detachEvent && window.detachEvent("onmousemove", X);
1188
- return;
1189
- }
1190
- try {
1191
- var t = r.x + r.y;
1192
- V[R++] = t & 255, Y += 1;
1193
- } catch {
1194
- }
1195
- };
1196
- typeof window < "u" && (window.addEventListener ? window.addEventListener("mousemove", X, !1) : window.attachEvent && window.attachEvent("onmousemove", X));
1197
- }
1198
- function Ct() {
1199
- if ($ == null) {
1200
- for ($ = Ht(); R < bt; ) {
1201
- var r = Math.floor(65536 * Math.random());
1202
- V[R++] = r & 255;
1203
- }
1204
- for ($.init(V), R = 0; R < V.length; ++R)
1205
- V[R] = 0;
1206
- R = 0;
1207
- }
1208
- return $.next();
1209
- }
1210
- var ot = (
1211
- /** @class */
1212
- function() {
1213
- function r() {
1214
- }
1215
- return r.prototype.nextBytes = function(t) {
1216
- for (var e = 0; e < t.length; ++e)
1217
- t[e] = Ct();
1218
- }, r;
1219
- }()
1220
- );
1221
- function _t(r, t) {
1222
- if (t < r.length + 22)
1223
- return console.error("Message too long for RSA"), null;
1224
- for (var e = t - r.length - 6, i = "", n = 0; n < e; n += 2)
1225
- i += "ff";
1226
- var s = "0001" + i + "00" + r;
1227
- return S(s, 16);
1228
- }
1229
- function Ft(r, t) {
1230
- if (t < r.length + 11)
1231
- return console.error("Message too long for RSA"), null;
1232
- for (var e = [], i = r.length - 1; i >= 0 && t > 0; ) {
1233
- var n = r.charCodeAt(i--);
1234
- n < 128 ? e[--t] = n : n > 127 && n < 2048 ? (e[--t] = n & 63 | 128, e[--t] = n >> 6 | 192) : (e[--t] = n & 63 | 128, e[--t] = n >> 6 & 63 | 128, e[--t] = n >> 12 | 224);
1235
- }
1236
- e[--t] = 0;
1237
- for (var s = new ot(), h = []; t > 2; ) {
1238
- for (h[0] = 0; h[0] == 0; )
1239
- s.nextBytes(h);
1240
- e[--t] = h[0];
1241
- }
1242
- return e[--t] = 2, e[--t] = 0, new c(e);
1243
- }
1244
- var Lt = (
1245
- /** @class */
1246
- function() {
1247
- function r() {
1248
- this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
1249
- }
1250
- return r.prototype.doPublic = function(t) {
1251
- return t.modPowInt(this.e, this.n);
1252
- }, r.prototype.doPrivate = function(t) {
1253
- if (this.p == null || this.q == null)
1254
- return t.modPow(this.d, this.n);
1255
- for (var e = t.mod(this.p).modPow(this.dmp1, this.p), i = t.mod(this.q).modPow(this.dmq1, this.q); e.compareTo(i) < 0; )
1256
- e = e.add(this.p);
1257
- return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i);
1258
- }, r.prototype.setPublic = function(t, e) {
1259
- t != null && e != null && t.length > 0 && e.length > 0 ? (this.n = S(t, 16), this.e = parseInt(e, 16)) : console.error("Invalid RSA public key");
1260
- }, r.prototype.encrypt = function(t) {
1261
- var e = this.n.bitLength() + 7 >> 3, i = Ft(t, e);
1262
- if (i == null)
1263
- return null;
1264
- var n = this.doPublic(i);
1265
- if (n == null)
1266
- return null;
1267
- for (var s = n.toString(16), h = s.length, o = 0; o < e * 2 - h; o++)
1268
- s = "0" + s;
1269
- return s;
1270
- }, r.prototype.setPrivate = function(t, e, i) {
1271
- t != null && e != null && t.length > 0 && e.length > 0 ? (this.n = S(t, 16), this.e = parseInt(e, 16), this.d = S(i, 16)) : console.error("Invalid RSA private key");
1272
- }, r.prototype.setPrivateEx = function(t, e, i, n, s, h, o, f) {
1273
- t != null && e != null && t.length > 0 && e.length > 0 ? (this.n = S(t, 16), this.e = parseInt(e, 16), this.d = S(i, 16), this.p = S(n, 16), this.q = S(s, 16), this.dmp1 = S(h, 16), this.dmq1 = S(o, 16), this.coeff = S(f, 16)) : console.error("Invalid RSA private key");
1274
- }, r.prototype.generate = function(t, e) {
1275
- var i = new ot(), n = t >> 1;
1276
- this.e = parseInt(e, 16);
1277
- for (var s = new c(e, 16); ; ) {
1278
- for (; this.p = new c(t - n, 1, i), !(this.p.subtract(c.ONE).gcd(s).compareTo(c.ONE) == 0 && this.p.isProbablePrime(10)); )
1279
- ;
1280
- for (; this.q = new c(n, 1, i), !(this.q.subtract(c.ONE).gcd(s).compareTo(c.ONE) == 0 && this.q.isProbablePrime(10)); )
1281
- ;
1282
- if (this.p.compareTo(this.q) <= 0) {
1283
- var h = this.p;
1284
- this.p = this.q, this.q = h;
1285
- }
1286
- var o = this.p.subtract(c.ONE), f = this.q.subtract(c.ONE), a = o.multiply(f);
1287
- if (a.gcd(s).compareTo(c.ONE) == 0) {
1288
- this.n = this.p.multiply(this.q), this.d = s.modInverse(a), this.dmp1 = this.d.mod(o), this.dmq1 = this.d.mod(f), this.coeff = this.q.modInverse(this.p);
1289
- break;
1290
- }
1291
- }
1292
- }, r.prototype.decrypt = function(t) {
1293
- var e = S(t, 16), i = this.doPrivate(e);
1294
- return i == null ? null : Kt(i, this.n.bitLength() + 7 >> 3);
1295
- }, r.prototype.generateAsync = function(t, e, i) {
1296
- var n = new ot(), s = t >> 1;
1297
- this.e = parseInt(e, 16);
1298
- var h = new c(e, 16), o = this, f = function() {
1299
- var a = function() {
1300
- if (o.p.compareTo(o.q) <= 0) {
1301
- var d = o.p;
1302
- o.p = o.q, o.q = d;
1303
- }
1304
- var y = o.p.subtract(c.ONE), T = o.q.subtract(c.ONE), b = y.multiply(T);
1305
- b.gcd(h).compareTo(c.ONE) == 0 ? (o.n = o.p.multiply(o.q), o.d = h.modInverse(b), o.dmp1 = o.d.mod(y), o.dmq1 = o.d.mod(T), o.coeff = o.q.modInverse(o.p), setTimeout(function() {
1306
- i();
1307
- }, 0)) : setTimeout(f, 0);
1308
- }, l = function() {
1309
- o.q = p(), o.q.fromNumberAsync(s, 1, n, function() {
1310
- o.q.subtract(c.ONE).gcda(h, function(d) {
1311
- d.compareTo(c.ONE) == 0 && o.q.isProbablePrime(10) ? setTimeout(a, 0) : setTimeout(l, 0);
1312
- });
1313
- });
1314
- }, g = function() {
1315
- o.p = p(), o.p.fromNumberAsync(t - s, 1, n, function() {
1316
- o.p.subtract(c.ONE).gcda(h, function(d) {
1317
- d.compareTo(c.ONE) == 0 && o.p.isProbablePrime(10) ? setTimeout(l, 0) : setTimeout(g, 0);
1318
- });
1319
- });
1320
- };
1321
- setTimeout(g, 0);
1322
- };
1323
- setTimeout(f, 0);
1324
- }, r.prototype.sign = function(t, e, i) {
1325
- var n = Ut(i), s = n + e(t).toString(), h = _t(s, this.n.bitLength() / 4);
1326
- if (h == null)
1327
- return null;
1328
- var o = this.doPrivate(h);
1329
- if (o == null)
1330
- return null;
1331
- var f = o.toString(16);
1332
- return (f.length & 1) == 0 ? f : "0" + f;
1333
- }, r.prototype.verify = function(t, e, i) {
1334
- var n = S(e, 16), s = this.doPublic(n);
1335
- if (s == null)
1336
- return null;
1337
- var h = s.toString(16).replace(/^1f+00/, ""), o = jt(h);
1338
- return o == i(t).toString();
1339
- }, r;
1340
- }()
1341
- );
1342
- function Kt(r, t) {
1343
- for (var e = r.toByteArray(), i = 0; i < e.length && e[i] == 0; )
1344
- ++i;
1345
- if (e.length - i != t - 1 || e[i] != 2)
1346
- return null;
1347
- for (++i; e[i] != 0; )
1348
- if (++i >= e.length)
1349
- return null;
1350
- for (var n = ""; ++i < e.length; ) {
1351
- var s = e[i] & 255;
1352
- s < 128 ? n += String.fromCharCode(s) : s > 191 && s < 224 ? (n += String.fromCharCode((s & 31) << 6 | e[i + 1] & 63), ++i) : (n += String.fromCharCode((s & 15) << 12 | (e[i + 1] & 63) << 6 | e[i + 2] & 63), i += 2);
1353
- }
1354
- return n;
1355
- }
1356
- var Q = {
1357
- md2: "3020300c06082a864886f70d020205000410",
1358
- md5: "3020300c06082a864886f70d020505000410",
1359
- sha1: "3021300906052b0e03021a05000414",
1360
- sha224: "302d300d06096086480165030402040500041c",
1361
- sha256: "3031300d060960864801650304020105000420",
1362
- sha384: "3041300d060960864801650304020205000430",
1363
- sha512: "3051300d060960864801650304020305000440",
1364
- ripemd160: "3021300906052b2403020105000414"
1365
- };
1366
- function Ut(r) {
1367
- return Q[r] || "";
1368
- }
1369
- function jt(r) {
1370
- for (var t in Q)
1371
- if (Q.hasOwnProperty(t)) {
1372
- var e = Q[t], i = e.length;
1373
- if (r.substr(0, i) == e)
1374
- return r.substr(i);
1375
- }
1376
- return r;
1377
- }
1378
- /*!
1379
- Copyright (c) 2011, Yahoo! Inc. All rights reserved.
1380
- Code licensed under the BSD License:
1381
- http://developer.yahoo.com/yui/license.html
1382
- version: 2.9.0
1383
- */
1384
- var m = {};
1385
- m.lang = {
1386
- /**
1387
- * Utility to set up the prototype, constructor and superclass properties to
1388
- * support an inheritance strategy that can chain constructors and methods.
1389
- * Static members will not be inherited.
1390
- *
1391
- * @method extend
1392
- * @static
1393
- * @param {Function} subc the object to modify
1394
- * @param {Function} superc the object to inherit
1395
- * @param {Object} overrides additional properties/methods to add to the
1396
- * subclass prototype. These will override the
1397
- * matching items obtained from the superclass
1398
- * if present.
1399
- */
1400
- extend: function(r, t, e) {
1401
- if (!t || !r)
1402
- throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");
1403
- var i = function() {
1404
- };
1405
- if (i.prototype = t.prototype, r.prototype = new i(), r.prototype.constructor = r, r.superclass = t.prototype, t.prototype.constructor == Object.prototype.constructor && (t.prototype.constructor = t), e) {
1406
- var n;
1407
- for (n in e)
1408
- r.prototype[n] = e[n];
1409
- var s = function() {
1410
- }, h = ["toString", "valueOf"];
1411
- try {
1412
- /MSIE/.test(navigator.userAgent) && (s = function(o, f) {
1413
- for (n = 0; n < h.length; n = n + 1) {
1414
- var a = h[n], l = f[a];
1415
- typeof l == "function" && l != Object.prototype[a] && (o[a] = l);
1416
- }
1417
- });
1418
- } catch {
1419
- }
1420
- s(r.prototype, e);
1421
- }
1422
- }
1423
- };
1424
- /**
1425
- * @fileOverview
1426
- * @name asn1-1.0.js
1427
- * @author Kenji Urushima kenji.urushima@gmail.com
1428
- * @version asn1 1.0.13 (2017-Jun-02)
1429
- * @since jsrsasign 2.1
1430
- * @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
1431
- */
1432
- var u = {};
1433
- (typeof u.asn1 > "u" || !u.asn1) && (u.asn1 = {});
1434
- u.asn1.ASN1Util = new function() {
1435
- this.integerToByteHex = function(r) {
1436
- var t = r.toString(16);
1437
- return t.length % 2 == 1 && (t = "0" + t), t;
1438
- }, this.bigIntToMinTwosComplementsHex = function(r) {
1439
- var t = r.toString(16);
1440
- if (t.substr(0, 1) != "-")
1441
- t.length % 2 == 1 ? t = "0" + t : t.match(/^[0-7]/) || (t = "00" + t);
1442
- else {
1443
- var e = t.substr(1), i = e.length;
1444
- i % 2 == 1 ? i += 1 : t.match(/^[0-7]/) || (i += 2);
1445
- for (var n = "", s = 0; s < i; s++)
1446
- n += "f";
1447
- var h = new c(n, 16), o = h.xor(r).add(c.ONE);
1448
- t = o.toString(16).replace(/^-/, "");
1449
- }
1450
- return t;
1451
- }, this.getPEMStringFromHex = function(r, t) {
1452
- return hextopem(r, t);
1453
- }, this.newObject = function(r) {
1454
- var t = u, e = t.asn1, i = e.DERBoolean, n = e.DERInteger, s = e.DERBitString, h = e.DEROctetString, o = e.DERNull, f = e.DERObjectIdentifier, a = e.DEREnumerated, l = e.DERUTF8String, g = e.DERNumericString, d = e.DERPrintableString, y = e.DERTeletexString, T = e.DERIA5String, b = e.DERUTCTime, E = e.DERGeneralizedTime, M = e.DERSequence, B = e.DERSet, q = e.DERTaggedObject, k = e.ASN1Util.newObject, ft = Object.keys(r);
1455
- if (ft.length != 1)
1456
- throw "key of param shall be only one.";
1457
- var v = ft[0];
1458
- if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + v + ":") == -1)
1459
- throw "undefined key: " + v;
1460
- if (v == "bool")
1461
- return new i(r[v]);
1462
- if (v == "int")
1463
- return new n(r[v]);
1464
- if (v == "bitstr")
1465
- return new s(r[v]);
1466
- if (v == "octstr")
1467
- return new h(r[v]);
1468
- if (v == "null")
1469
- return new o(r[v]);
1470
- if (v == "oid")
1471
- return new f(r[v]);
1472
- if (v == "enum")
1473
- return new a(r[v]);
1474
- if (v == "utf8str")
1475
- return new l(r[v]);
1476
- if (v == "numstr")
1477
- return new g(r[v]);
1478
- if (v == "prnstr")
1479
- return new d(r[v]);
1480
- if (v == "telstr")
1481
- return new y(r[v]);
1482
- if (v == "ia5str")
1483
- return new T(r[v]);
1484
- if (v == "utctime")
1485
- return new b(r[v]);
1486
- if (v == "gentime")
1487
- return new E(r[v]);
1488
- if (v == "seq") {
1489
- for (var K = r[v], U = [], N = 0; N < K.length; N++) {
1490
- var et = k(K[N]);
1491
- U.push(et);
1492
- }
1493
- return new M({ array: U });
1494
- }
1495
- if (v == "set") {
1496
- for (var K = r[v], U = [], N = 0; N < K.length; N++) {
1497
- var et = k(K[N]);
1498
- U.push(et);
1499
- }
1500
- return new B({ array: U });
1501
- }
1502
- if (v == "tag") {
1503
- var x = r[v];
1504
- if (Object.prototype.toString.call(x) === "[object Array]" && x.length == 3) {
1505
- var wt = k(x[2]);
1506
- return new q({
1507
- tag: x[0],
1508
- explicit: x[1],
1509
- obj: wt
1510
- });
1511
- } else {
1512
- var z = {};
1513
- if (x.explicit !== void 0 && (z.explicit = x.explicit), x.tag !== void 0 && (z.tag = x.tag), x.obj === void 0)
1514
- throw "obj shall be specified for 'tag'.";
1515
- return z.obj = k(x.obj), new q(z);
1516
- }
1517
- }
1518
- }, this.jsonToASN1HEX = function(r) {
1519
- var t = this.newObject(r);
1520
- return t.getEncodedHex();
1521
- };
1522
- }();
1523
- u.asn1.ASN1Util.oidHexToInt = function(r) {
1524
- for (var n = "", t = parseInt(r.substr(0, 2), 16), e = Math.floor(t / 40), i = t % 40, n = e + "." + i, s = "", h = 2; h < r.length; h += 2) {
1525
- var o = parseInt(r.substr(h, 2), 16), f = ("00000000" + o.toString(2)).slice(-8);
1526
- if (s = s + f.substr(1, 7), f.substr(0, 1) == "0") {
1527
- var a = new c(s, 2);
1528
- n = n + "." + a.toString(10), s = "";
1529
- }
1530
- }
1531
- return n;
1532
- };
1533
- u.asn1.ASN1Util.oidIntToHex = function(r) {
1534
- var t = function(o) {
1535
- var f = o.toString(16);
1536
- return f.length == 1 && (f = "0" + f), f;
1537
- }, e = function(o) {
1538
- var f = "", a = new c(o, 10), l = a.toString(2), g = 7 - l.length % 7;
1539
- g == 7 && (g = 0);
1540
- for (var d = "", y = 0; y < g; y++)
1541
- d += "0";
1542
- l = d + l;
1543
- for (var y = 0; y < l.length - 1; y += 7) {
1544
- var T = l.substr(y, 7);
1545
- y != l.length - 7 && (T = "1" + T), f += t(parseInt(T, 2));
1546
- }
1547
- return f;
1548
- };
1549
- if (!r.match(/^[0-9.]+$/))
1550
- throw "malformed oid string: " + r;
1551
- var i = "", n = r.split("."), s = parseInt(n[0]) * 40 + parseInt(n[1]);
1552
- i += t(s), n.splice(0, 2);
1553
- for (var h = 0; h < n.length; h++)
1554
- i += e(n[h]);
1555
- return i;
1556
- };
1557
- u.asn1.ASN1Object = function() {
1558
- var r = "";
1559
- this.getLengthHexFromValue = function() {
1560
- if (typeof this.hV > "u" || this.hV == null)
1561
- throw "this.hV is null or undefined.";
1562
- if (this.hV.length % 2 == 1)
1563
- throw "value hex must be even length: n=" + r.length + ",v=" + this.hV;
1564
- var t = this.hV.length / 2, e = t.toString(16);
1565
- if (e.length % 2 == 1 && (e = "0" + e), t < 128)
1566
- return e;
1567
- var i = e.length / 2;
1568
- if (i > 15)
1569
- throw "ASN.1 length too long to represent by 8x: n = " + t.toString(16);
1570
- var n = 128 + i;
1571
- return n.toString(16) + e;
1572
- }, this.getEncodedHex = function() {
1573
- return (this.hTLV == null || this.isModified) && (this.hV = this.getFreshValueHex(), this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV, this.isModified = !1), this.hTLV;
1574
- }, this.getValueHex = function() {
1575
- return this.getEncodedHex(), this.hV;
1576
- }, this.getFreshValueHex = function() {
1577
- return "";
1578
- };
1579
- };
1580
- u.asn1.DERAbstractString = function(r) {
1581
- u.asn1.DERAbstractString.superclass.constructor.call(this), this.getString = function() {
1582
- return this.s;
1583
- }, this.setString = function(t) {
1584
- this.hTLV = null, this.isModified = !0, this.s = t, this.hV = stohex(this.s);
1585
- }, this.setStringHex = function(t) {
1586
- this.hTLV = null, this.isModified = !0, this.s = null, this.hV = t;
1587
- }, this.getFreshValueHex = function() {
1588
- return this.hV;
1589
- }, typeof r < "u" && (typeof r == "string" ? this.setString(r) : typeof r.str < "u" ? this.setString(r.str) : typeof r.hex < "u" && this.setStringHex(r.hex));
1590
- };
1591
- m.lang.extend(u.asn1.DERAbstractString, u.asn1.ASN1Object);
1592
- u.asn1.DERAbstractTime = function(r) {
1593
- u.asn1.DERAbstractTime.superclass.constructor.call(this), this.localDateToUTC = function(t) {
1594
- utc = t.getTime() + t.getTimezoneOffset() * 6e4;
1595
- var e = new Date(utc);
1596
- return e;
1597
- }, this.formatDate = function(t, e, i) {
1598
- var n = this.zeroPadding, s = this.localDateToUTC(t), h = String(s.getFullYear());
1599
- e == "utc" && (h = h.substr(2, 2));
1600
- var o = n(String(s.getMonth() + 1), 2), f = n(String(s.getDate()), 2), a = n(String(s.getHours()), 2), l = n(String(s.getMinutes()), 2), g = n(String(s.getSeconds()), 2), d = h + o + f + a + l + g;
1601
- if (i === !0) {
1602
- var y = s.getMilliseconds();
1603
- if (y != 0) {
1604
- var T = n(String(y), 3);
1605
- T = T.replace(/[0]+$/, ""), d = d + "." + T;
1606
- }
1607
- }
1608
- return d + "Z";
1609
- }, this.zeroPadding = function(t, e) {
1610
- return t.length >= e ? t : new Array(e - t.length + 1).join("0") + t;
1611
- }, this.getString = function() {
1612
- return this.s;
1613
- }, this.setString = function(t) {
1614
- this.hTLV = null, this.isModified = !0, this.s = t, this.hV = stohex(t);
1615
- }, this.setByDateValue = function(t, e, i, n, s, h) {
1616
- var o = new Date(Date.UTC(t, e - 1, i, n, s, h, 0));
1617
- this.setByDate(o);
1618
- }, this.getFreshValueHex = function() {
1619
- return this.hV;
1620
- };
1621
- };
1622
- m.lang.extend(u.asn1.DERAbstractTime, u.asn1.ASN1Object);
1623
- u.asn1.DERAbstractStructured = function(r) {
1624
- u.asn1.DERAbstractString.superclass.constructor.call(this), this.setByASN1ObjectArray = function(t) {
1625
- this.hTLV = null, this.isModified = !0, this.asn1Array = t;
1626
- }, this.appendASN1Object = function(t) {
1627
- this.hTLV = null, this.isModified = !0, this.asn1Array.push(t);
1628
- }, this.asn1Array = new Array(), typeof r < "u" && typeof r.array < "u" && (this.asn1Array = r.array);
1629
- };
1630
- m.lang.extend(u.asn1.DERAbstractStructured, u.asn1.ASN1Object);
1631
- u.asn1.DERBoolean = function() {
1632
- u.asn1.DERBoolean.superclass.constructor.call(this), this.hT = "01", this.hTLV = "0101ff";
1633
- };
1634
- m.lang.extend(u.asn1.DERBoolean, u.asn1.ASN1Object);
1635
- u.asn1.DERInteger = function(r) {
1636
- u.asn1.DERInteger.superclass.constructor.call(this), this.hT = "02", this.setByBigInteger = function(t) {
1637
- this.hTLV = null, this.isModified = !0, this.hV = u.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t);
1638
- }, this.setByInteger = function(t) {
1639
- var e = new c(String(t), 10);
1640
- this.setByBigInteger(e);
1641
- }, this.setValueHex = function(t) {
1642
- this.hV = t;
1643
- }, this.getFreshValueHex = function() {
1644
- return this.hV;
1645
- }, typeof r < "u" && (typeof r.bigint < "u" ? this.setByBigInteger(r.bigint) : typeof r.int < "u" ? this.setByInteger(r.int) : typeof r == "number" ? this.setByInteger(r) : typeof r.hex < "u" && this.setValueHex(r.hex));
1646
- };
1647
- m.lang.extend(u.asn1.DERInteger, u.asn1.ASN1Object);
1648
- u.asn1.DERBitString = function(r) {
1649
- if (r !== void 0 && typeof r.obj < "u") {
1650
- var t = u.asn1.ASN1Util.newObject(r.obj);
1651
- r.hex = "00" + t.getEncodedHex();
1652
- }
1653
- u.asn1.DERBitString.superclass.constructor.call(this), this.hT = "03", this.setHexValueIncludingUnusedBits = function(e) {
1654
- this.hTLV = null, this.isModified = !0, this.hV = e;
1655
- }, this.setUnusedBitsAndHexValue = function(e, i) {
1656
- if (e < 0 || 7 < e)
1657
- throw "unused bits shall be from 0 to 7: u = " + e;
1658
- var n = "0" + e;
1659
- this.hTLV = null, this.isModified = !0, this.hV = n + i;
1660
- }, this.setByBinaryString = function(e) {
1661
- e = e.replace(/0+$/, "");
1662
- var i = 8 - e.length % 8;
1663
- i == 8 && (i = 0);
1664
- for (var n = 0; n <= i; n++)
1665
- e += "0";
1666
- for (var s = "", n = 0; n < e.length - 1; n += 8) {
1667
- var h = e.substr(n, 8), o = parseInt(h, 2).toString(16);
1668
- o.length == 1 && (o = "0" + o), s += o;
1669
- }
1670
- this.hTLV = null, this.isModified = !0, this.hV = "0" + i + s;
1671
- }, this.setByBooleanArray = function(e) {
1672
- for (var i = "", n = 0; n < e.length; n++)
1673
- e[n] == !0 ? i += "1" : i += "0";
1674
- this.setByBinaryString(i);
1675
- }, this.newFalseArray = function(e) {
1676
- for (var i = new Array(e), n = 0; n < e; n++)
1677
- i[n] = !1;
1678
- return i;
1679
- }, this.getFreshValueHex = function() {
1680
- return this.hV;
1681
- }, typeof r < "u" && (typeof r == "string" && r.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(r) : typeof r.hex < "u" ? this.setHexValueIncludingUnusedBits(r.hex) : typeof r.bin < "u" ? this.setByBinaryString(r.bin) : typeof r.array < "u" && this.setByBooleanArray(r.array));
1682
- };
1683
- m.lang.extend(u.asn1.DERBitString, u.asn1.ASN1Object);
1684
- u.asn1.DEROctetString = function(r) {
1685
- if (r !== void 0 && typeof r.obj < "u") {
1686
- var t = u.asn1.ASN1Util.newObject(r.obj);
1687
- r.hex = t.getEncodedHex();
1688
- }
1689
- u.asn1.DEROctetString.superclass.constructor.call(this, r), this.hT = "04";
1690
- };
1691
- m.lang.extend(u.asn1.DEROctetString, u.asn1.DERAbstractString);
1692
- u.asn1.DERNull = function() {
1693
- u.asn1.DERNull.superclass.constructor.call(this), this.hT = "05", this.hTLV = "0500";
1694
- };
1695
- m.lang.extend(u.asn1.DERNull, u.asn1.ASN1Object);
1696
- u.asn1.DERObjectIdentifier = function(r) {
1697
- var t = function(i) {
1698
- var n = i.toString(16);
1699
- return n.length == 1 && (n = "0" + n), n;
1700
- }, e = function(i) {
1701
- var n = "", s = new c(i, 10), h = s.toString(2), o = 7 - h.length % 7;
1702
- o == 7 && (o = 0);
1703
- for (var f = "", a = 0; a < o; a++)
1704
- f += "0";
1705
- h = f + h;
1706
- for (var a = 0; a < h.length - 1; a += 7) {
1707
- var l = h.substr(a, 7);
1708
- a != h.length - 7 && (l = "1" + l), n += t(parseInt(l, 2));
1709
- }
1710
- return n;
1711
- };
1712
- u.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = "06", this.setValueHex = function(i) {
1713
- this.hTLV = null, this.isModified = !0, this.s = null, this.hV = i;
1714
- }, this.setValueOidString = function(i) {
1715
- if (!i.match(/^[0-9.]+$/))
1716
- throw "malformed oid string: " + i;
1717
- var n = "", s = i.split("."), h = parseInt(s[0]) * 40 + parseInt(s[1]);
1718
- n += t(h), s.splice(0, 2);
1719
- for (var o = 0; o < s.length; o++)
1720
- n += e(s[o]);
1721
- this.hTLV = null, this.isModified = !0, this.s = null, this.hV = n;
1722
- }, this.setValueName = function(i) {
1723
- var n = u.asn1.x509.OID.name2oid(i);
1724
- if (n !== "")
1725
- this.setValueOidString(n);
1726
- else
1727
- throw "DERObjectIdentifier oidName undefined: " + i;
1728
- }, this.getFreshValueHex = function() {
1729
- return this.hV;
1730
- }, r !== void 0 && (typeof r == "string" ? r.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(r) : this.setValueName(r) : r.oid !== void 0 ? this.setValueOidString(r.oid) : r.hex !== void 0 ? this.setValueHex(r.hex) : r.name !== void 0 && this.setValueName(r.name));
1731
- };
1732
- m.lang.extend(u.asn1.DERObjectIdentifier, u.asn1.ASN1Object);
1733
- u.asn1.DEREnumerated = function(r) {
1734
- u.asn1.DEREnumerated.superclass.constructor.call(this), this.hT = "0a", this.setByBigInteger = function(t) {
1735
- this.hTLV = null, this.isModified = !0, this.hV = u.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t);
1736
- }, this.setByInteger = function(t) {
1737
- var e = new c(String(t), 10);
1738
- this.setByBigInteger(e);
1739
- }, this.setValueHex = function(t) {
1740
- this.hV = t;
1741
- }, this.getFreshValueHex = function() {
1742
- return this.hV;
1743
- }, typeof r < "u" && (typeof r.int < "u" ? this.setByInteger(r.int) : typeof r == "number" ? this.setByInteger(r) : typeof r.hex < "u" && this.setValueHex(r.hex));
1744
- };
1745
- m.lang.extend(u.asn1.DEREnumerated, u.asn1.ASN1Object);
1746
- u.asn1.DERUTF8String = function(r) {
1747
- u.asn1.DERUTF8String.superclass.constructor.call(this, r), this.hT = "0c";
1748
- };
1749
- m.lang.extend(u.asn1.DERUTF8String, u.asn1.DERAbstractString);
1750
- u.asn1.DERNumericString = function(r) {
1751
- u.asn1.DERNumericString.superclass.constructor.call(this, r), this.hT = "12";
1752
- };
1753
- m.lang.extend(u.asn1.DERNumericString, u.asn1.DERAbstractString);
1754
- u.asn1.DERPrintableString = function(r) {
1755
- u.asn1.DERPrintableString.superclass.constructor.call(this, r), this.hT = "13";
1756
- };
1757
- m.lang.extend(u.asn1.DERPrintableString, u.asn1.DERAbstractString);
1758
- u.asn1.DERTeletexString = function(r) {
1759
- u.asn1.DERTeletexString.superclass.constructor.call(this, r), this.hT = "14";
1760
- };
1761
- m.lang.extend(u.asn1.DERTeletexString, u.asn1.DERAbstractString);
1762
- u.asn1.DERIA5String = function(r) {
1763
- u.asn1.DERIA5String.superclass.constructor.call(this, r), this.hT = "16";
1764
- };
1765
- m.lang.extend(u.asn1.DERIA5String, u.asn1.DERAbstractString);
1766
- u.asn1.DERUTCTime = function(r) {
1767
- u.asn1.DERUTCTime.superclass.constructor.call(this, r), this.hT = "17", this.setByDate = function(t) {
1768
- this.hTLV = null, this.isModified = !0, this.date = t, this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s);
1769
- }, this.getFreshValueHex = function() {
1770
- return typeof this.date > "u" && typeof this.s > "u" && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s)), this.hV;
1771
- }, r !== void 0 && (r.str !== void 0 ? this.setString(r.str) : typeof r == "string" && r.match(/^[0-9]{12}Z$/) ? this.setString(r) : r.hex !== void 0 ? this.setStringHex(r.hex) : r.date !== void 0 && this.setByDate(r.date));
1772
- };
1773
- m.lang.extend(u.asn1.DERUTCTime, u.asn1.DERAbstractTime);
1774
- u.asn1.DERGeneralizedTime = function(r) {
1775
- u.asn1.DERGeneralizedTime.superclass.constructor.call(this, r), this.hT = "18", this.withMillis = !1, this.setByDate = function(t) {
1776
- this.hTLV = null, this.isModified = !0, this.date = t, this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s);
1777
- }, this.getFreshValueHex = function() {
1778
- return this.date === void 0 && this.s === void 0 && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s)), this.hV;
1779
- }, r !== void 0 && (r.str !== void 0 ? this.setString(r.str) : typeof r == "string" && r.match(/^[0-9]{14}Z$/) ? this.setString(r) : r.hex !== void 0 ? this.setStringHex(r.hex) : r.date !== void 0 && this.setByDate(r.date), r.millis === !0 && (this.withMillis = !0));
1780
- };
1781
- m.lang.extend(u.asn1.DERGeneralizedTime, u.asn1.DERAbstractTime);
1782
- u.asn1.DERSequence = function(r) {
1783
- u.asn1.DERSequence.superclass.constructor.call(this, r), this.hT = "30", this.getFreshValueHex = function() {
1784
- for (var t = "", e = 0; e < this.asn1Array.length; e++) {
1785
- var i = this.asn1Array[e];
1786
- t += i.getEncodedHex();
1787
- }
1788
- return this.hV = t, this.hV;
1789
- };
1790
- };
1791
- m.lang.extend(u.asn1.DERSequence, u.asn1.DERAbstractStructured);
1792
- u.asn1.DERSet = function(r) {
1793
- u.asn1.DERSet.superclass.constructor.call(this, r), this.hT = "31", this.sortFlag = !0, this.getFreshValueHex = function() {
1794
- for (var t = new Array(), e = 0; e < this.asn1Array.length; e++) {
1795
- var i = this.asn1Array[e];
1796
- t.push(i.getEncodedHex());
1797
- }
1798
- return this.sortFlag == !0 && t.sort(), this.hV = t.join(""), this.hV;
1799
- }, typeof r < "u" && typeof r.sortflag < "u" && r.sortflag == !1 && (this.sortFlag = !1);
1800
- };
1801
- m.lang.extend(u.asn1.DERSet, u.asn1.DERAbstractStructured);
1802
- u.asn1.DERTaggedObject = function(r) {
1803
- u.asn1.DERTaggedObject.superclass.constructor.call(this), this.hT = "a0", this.hV = "", this.isExplicit = !0, this.asn1Object = null, this.setASN1Object = function(t, e, i) {
1804
- this.hT = e, this.isExplicit = t, this.asn1Object = i, this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), this.hTLV = null, this.isModified = !0) : (this.hV = null, this.hTLV = i.getEncodedHex(), this.hTLV = this.hTLV.replace(/^../, e), this.isModified = !1);
1805
- }, this.getFreshValueHex = function() {
1806
- return this.hV;
1807
- }, typeof r < "u" && (typeof r.tag < "u" && (this.hT = r.tag), typeof r.explicit < "u" && (this.isExplicit = r.explicit), typeof r.obj < "u" && (this.asn1Object = r.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));
1808
- };
1809
- m.lang.extend(u.asn1.DERTaggedObject, u.asn1.ASN1Object);
1810
- var kt = /* @__PURE__ */ function() {
1811
- var r = function(t, e) {
1812
- return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(i, n) {
1813
- i.__proto__ = n;
1814
- } || function(i, n) {
1815
- for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (i[s] = n[s]);
1816
- }, r(t, e);
1817
- };
1818
- return function(t, e) {
1819
- if (typeof e != "function" && e !== null)
1820
- throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
1821
- r(t, e);
1822
- function i() {
1823
- this.constructor = t;
1824
- }
1825
- t.prototype = e === null ? Object.create(e) : (i.prototype = e.prototype, new i());
1826
- };
1827
- }(), St = (
1828
- /** @class */
1829
- function(r) {
1830
- kt(t, r);
1831
- function t(e) {
1832
- var i = r.call(this) || this;
1833
- return e && (typeof e == "string" ? i.parseKey(e) : (t.hasPrivateKeyProperty(e) || t.hasPublicKeyProperty(e)) && i.parsePropertiesFrom(e)), i;
1834
- }
1835
- return t.prototype.parseKey = function(e) {
1836
- try {
1837
- var i = 0, n = 0, s = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/, h = s.test(e) ? Bt.decode(e) : st.unarmor(e), o = Vt.decode(h);
1838
- if (o.sub.length === 3 && (o = o.sub[2].sub[0]), o.sub.length === 9) {
1839
- i = o.sub[1].getHexStringValue(), this.n = S(i, 16), n = o.sub[2].getHexStringValue(), this.e = parseInt(n, 16);
1840
- var f = o.sub[3].getHexStringValue();
1841
- this.d = S(f, 16);
1842
- var a = o.sub[4].getHexStringValue();
1843
- this.p = S(a, 16);
1844
- var l = o.sub[5].getHexStringValue();
1845
- this.q = S(l, 16);
1846
- var g = o.sub[6].getHexStringValue();
1847
- this.dmp1 = S(g, 16);
1848
- var d = o.sub[7].getHexStringValue();
1849
- this.dmq1 = S(d, 16);
1850
- var y = o.sub[8].getHexStringValue();
1851
- this.coeff = S(y, 16);
1852
- } else if (o.sub.length === 2)
1853
- if (o.sub[0].sub) {
1854
- var T = o.sub[1], b = T.sub[0];
1855
- i = b.sub[0].getHexStringValue(), this.n = S(i, 16), n = b.sub[1].getHexStringValue(), this.e = parseInt(n, 16);
1856
- } else
1857
- i = o.sub[0].getHexStringValue(), this.n = S(i, 16), n = o.sub[1].getHexStringValue(), this.e = parseInt(n, 16);
1858
- else
1859
- return !1;
1860
- return !0;
1861
- } catch {
1862
- return !1;
1863
- }
1864
- }, t.prototype.getPrivateBaseKey = function() {
1865
- var e = {
1866
- array: [
1867
- new u.asn1.DERInteger({ int: 0 }),
1868
- new u.asn1.DERInteger({ bigint: this.n }),
1869
- new u.asn1.DERInteger({ int: this.e }),
1870
- new u.asn1.DERInteger({ bigint: this.d }),
1871
- new u.asn1.DERInteger({ bigint: this.p }),
1872
- new u.asn1.DERInteger({ bigint: this.q }),
1873
- new u.asn1.DERInteger({ bigint: this.dmp1 }),
1874
- new u.asn1.DERInteger({ bigint: this.dmq1 }),
1875
- new u.asn1.DERInteger({ bigint: this.coeff })
1876
- ]
1877
- }, i = new u.asn1.DERSequence(e);
1878
- return i.getEncodedHex();
1879
- }, t.prototype.getPrivateBaseKeyB64 = function() {
1880
- return W(this.getPrivateBaseKey());
1881
- }, t.prototype.getPublicBaseKey = function() {
1882
- var e = new u.asn1.DERSequence({
1883
- array: [
1884
- new u.asn1.DERObjectIdentifier({ oid: "1.2.840.113549.1.1.1" }),
1885
- new u.asn1.DERNull()
1886
- ]
1887
- }), i = new u.asn1.DERSequence({
1888
- array: [
1889
- new u.asn1.DERInteger({ bigint: this.n }),
1890
- new u.asn1.DERInteger({ int: this.e })
1891
- ]
1892
- }), n = new u.asn1.DERBitString({
1893
- hex: "00" + i.getEncodedHex()
1894
- }), s = new u.asn1.DERSequence({
1895
- array: [e, n]
1896
- });
1897
- return s.getEncodedHex();
1898
- }, t.prototype.getPublicBaseKeyB64 = function() {
1899
- return W(this.getPublicBaseKey());
1900
- }, t.wordwrap = function(e, i) {
1901
- if (i = i || 64, !e)
1902
- return e;
1903
- var n = "(.{1," + i + `})( +|$
1904
- ?)|(.{1,` + i + "})";
1905
- return e.match(RegExp(n, "g")).join(`
1906
- `);
1907
- }, t.prototype.getPrivateKey = function() {
1908
- var e = `-----BEGIN RSA PRIVATE KEY-----
1909
- `;
1910
- return e += t.wordwrap(this.getPrivateBaseKeyB64()) + `
1911
- `, e += "-----END RSA PRIVATE KEY-----", e;
1912
- }, t.prototype.getPublicKey = function() {
1913
- var e = `-----BEGIN PUBLIC KEY-----
1914
- `;
1915
- return e += t.wordwrap(this.getPublicBaseKeyB64()) + `
1916
- `, e += "-----END PUBLIC KEY-----", e;
1917
- }, t.hasPublicKeyProperty = function(e) {
1918
- return e = e || {}, e.hasOwnProperty("n") && e.hasOwnProperty("e");
1919
- }, t.hasPrivateKeyProperty = function(e) {
1920
- return e = e || {}, e.hasOwnProperty("n") && e.hasOwnProperty("e") && e.hasOwnProperty("d") && e.hasOwnProperty("p") && e.hasOwnProperty("q") && e.hasOwnProperty("dmp1") && e.hasOwnProperty("dmq1") && e.hasOwnProperty("coeff");
1921
- }, t.prototype.parsePropertiesFrom = function(e) {
1922
- this.n = e.n, this.e = e.e, e.hasOwnProperty("d") && (this.d = e.d, this.p = e.p, this.q = e.q, this.dmp1 = e.dmp1, this.dmq1 = e.dmq1, this.coeff = e.coeff);
1923
- }, t;
1924
- }(Lt)
1925
- ), nt, zt = typeof process < "u" ? (nt = process.env) === null || nt === void 0 ? void 0 : nt.npm_package_version : void 0, Zt = (
1926
- /** @class */
1927
- function() {
1928
- function r(t) {
1929
- t === void 0 && (t = {}), t = t || {}, this.default_key_size = t.default_key_size ? parseInt(t.default_key_size, 10) : 1024, this.default_public_exponent = t.default_public_exponent || "010001", this.log = t.log || !1, this.key = null;
1930
- }
1931
- return r.prototype.setKey = function(t) {
1932
- this.log && this.key && console.warn("A key was already set, overriding existing."), this.key = new St(t);
1933
- }, r.prototype.setPrivateKey = function(t) {
1934
- this.setKey(t);
1935
- }, r.prototype.setPublicKey = function(t) {
1936
- this.setKey(t);
1937
- }, r.prototype.decrypt = function(t) {
1938
- try {
1939
- return this.getKey().decrypt(lt(t));
1940
- } catch {
1941
- return !1;
1942
- }
1943
- }, r.prototype.encrypt = function(t) {
1944
- try {
1945
- return W(this.getKey().encrypt(t));
1946
- } catch {
1947
- return !1;
1948
- }
1949
- }, r.prototype.sign = function(t, e, i) {
1950
- try {
1951
- return W(this.getKey().sign(t, e, i));
1952
- } catch {
1953
- return !1;
1954
- }
1955
- }, r.prototype.verify = function(t, e, i) {
1956
- try {
1957
- return this.getKey().verify(t, lt(e), i);
1958
- } catch {
1959
- return !1;
1960
- }
1961
- }, r.prototype.getKey = function(t) {
1962
- if (!this.key) {
1963
- if (this.key = new St(), t && {}.toString.call(t) === "[object Function]") {
1964
- this.key.generateAsync(this.default_key_size, this.default_public_exponent, t);
1965
- return;
1966
- }
1967
- this.key.generate(this.default_key_size, this.default_public_exponent);
1968
- }
1969
- return this.key;
1970
- }, r.prototype.getPrivateKey = function() {
1971
- return this.getKey().getPrivateKey();
1972
- }, r.prototype.getPrivateKeyB64 = function() {
1973
- return this.getKey().getPrivateBaseKeyB64();
1974
- }, r.prototype.getPublicKey = function() {
1975
- return this.getKey().getPublicKey();
1976
- }, r.prototype.getPublicKeyB64 = function() {
1977
- return this.getKey().getPublicBaseKeyB64();
1978
- }, r.version = zt, r;
1979
- }()
1980
- );
1981
- export {
1982
- Zt as J
1983
- };