UNPKG

@danidoble/webserial

Version:
1,285 lines 217 kB
import { K as Pn, a as vn, D as de, i as G, b as _e, w as ge } from "./kernel-BRG-vva2.js"; var En = "0123456789abcdefghijklmnopqrstuvwxyz"; function $(i) { return En.charAt(i); } function wn(i, t) { return i & t; } function Tt(i, t) { return i | t; } function me(i, t) { return i ^ t; } function ye(i, t) { return i & ~t; } function Sn(i) { if (i == 0) return -1; var t = 0; return (i & 65535) == 0 && (i >>= 16, t += 16), (i & 255) == 0 && (i >>= 8, t += 8), (i & 15) == 0 && (i >>= 4, t += 4), (i & 3) == 0 && (i >>= 2, t += 2), (i & 1) == 0 && ++t, t; } function Tn(i) { for (var t = 0; i != 0; ) i &= i - 1, ++t; return t; } var lt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Xe = "="; function yt(i) { var t, e, n = ""; for (t = 0; t + 3 <= i.length; t += 3) e = parseInt(i.substring(t, t + 3), 16), n += lt.charAt(e >> 6) + lt.charAt(e & 63); for (t + 1 == i.length ? (e = parseInt(i.substring(t, t + 1), 16), n += lt.charAt(e << 2)) : t + 2 == i.length && (e = parseInt(i.substring(t, t + 2), 16), n += lt.charAt(e >> 2) + lt.charAt((e & 3) << 4)); (n.length & 3) > 0; ) n += Xe; return n; } function be(i) { var t = "", e, n = 0, r = 0; for (e = 0; e < i.length && i.charAt(e) != Xe; ++e) { var s = lt.indexOf(i.charAt(e)); s < 0 || (n == 0 ? (t += $(s >> 2), r = s & 3, n = 1) : n == 1 ? (t += $(r << 2 | s >> 4), r = s & 15, n = 2) : n == 2 ? (t += $(r), t += $(s >> 2), r = s & 3, n = 3) : (t += $(r << 2 | s >> 4), t += $(s & 15), n = 0)); } return n == 1 && (t += $(r << 2)), t; } var ct, An = { decode: function(i) { var t; if (ct === void 0) { var e = "0123456789ABCDEF", n = ` \f \r  \u2028\u2029`; for (ct = {}, t = 0; t < 16; ++t) ct[e.charAt(t)] = t; for (e = e.toLowerCase(), t = 10; t < 16; ++t) ct[e.charAt(t)] = t; for (t = 0; t < n.length; ++t) ct[n.charAt(t)] = -1; } var r = [], s = 0, a = 0; for (t = 0; t < i.length; ++t) { var o = i.charAt(t); if (o == "=") break; if (o = ct[o], o != -1) { if (o === void 0) throw new Error("Illegal character at offset " + t); s |= o, ++a >= 2 ? (r[r.length] = s, s = 0, a = 0) : s <<= 4; } } if (a) throw new Error("Hex encoding incomplete: 4 bits missing"); return r; } }, et, Yt = { decode: function(i) { var t; if (et === void 0) { var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", n = `= \f \r  \u2028\u2029`; for (et = /* @__PURE__ */ Object.create(null), t = 0; t < 64; ++t) et[e.charAt(t)] = t; for (et["-"] = 62, et._ = 63, t = 0; t < n.length; ++t) et[n.charAt(t)] = -1; } var r = [], s = 0, a = 0; for (t = 0; t < i.length; ++t) { var o = i.charAt(t); if (o == "=") break; if (o = et[o], o != -1) { if (o === void 0) throw new Error("Illegal character at offset " + t); s |= o, ++a >= 4 ? (r[r.length] = s >> 16, r[r.length] = s >> 8 & 255, r[r.length] = s & 255, s = 0, a = 0) : s <<= 6; } } switch (a) { case 1: throw new Error("Base64 encoding incomplete: at least 2 bits missing"); case 2: r[r.length] = s >> 10; break; case 3: r[r.length] = s >> 16, r[r.length] = s >> 8 & 255; break; } return r; }, re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/, unarmor: function(i) { var t = Yt.re.exec(i); if (t) if (t[1]) i = t[1]; else if (t[2]) i = t[2]; else throw new Error("RegExp out of sync"); return Yt.decode(i); } }, ut = 1e13, mt = ( /** @class */ (function() { function i(t) { this.buf = [+t || 0]; } return i.prototype.mulAdd = function(t, e) { var n = this.buf, r = n.length, s, a; for (s = 0; s < r; ++s) a = n[s] * t + e, a < ut ? e = 0 : (e = 0 | a / ut, a -= e * ut), n[s] = a; e > 0 && (n[s] = e); }, i.prototype.sub = function(t) { var e = this.buf, n = e.length, r, s; for (r = 0; r < n; ++r) s = e[r] - t, s < 0 ? (s += ut, t = 1) : t = 0, e[r] = s; for (; e[e.length - 1] === 0; ) e.pop(); }, i.prototype.toString = function(t) { if ((t || 10) != 10) throw new Error("only base 10 is supported"); for (var e = this.buf, n = e[e.length - 1].toString(), r = e.length - 2; r >= 0; --r) n += (ut + e[r]).toString().substring(1); return n; }, i.prototype.valueOf = function() { for (var t = this.buf, e = 0, n = t.length - 1; n >= 0; --n) e = e * ut + t[n]; return e; }, i.prototype.simplify = function() { var t = this.buf; return t.length == 1 ? t[0] : this; }, i; })() ), ze = "…", Rn = /^(\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)?)?$/, Cn = /^(\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)?)?$/; function ft(i, t) { return i.length > t && (i = i.substring(0, t) + ze), i; } var Xt = ( /** @class */ (function() { function i(t, e) { this.hexDigits = "0123456789ABCDEF", t instanceof i ? (this.enc = t.enc, this.pos = t.pos) : (this.enc = t, this.pos = e); } return i.prototype.get = function(t) { if (t === void 0 && (t = this.pos++), t >= this.enc.length) throw new Error("Requesting byte offset ".concat(t, " on a stream of length ").concat(this.enc.length)); return typeof this.enc == "string" ? this.enc.charCodeAt(t) : this.enc[t]; }, i.prototype.hexByte = function(t) { return this.hexDigits.charAt(t >> 4 & 15) + this.hexDigits.charAt(t & 15); }, i.prototype.hexDump = function(t, e, n) { for (var r = "", s = t; s < e; ++s) if (r += this.hexByte(this.get(s)), n !== !0) switch (s & 15) { case 7: r += " "; break; case 15: r += ` `; break; default: r += " "; } return r; }, i.prototype.isASCII = function(t, e) { for (var n = t; n < e; ++n) { var r = this.get(n); if (r < 32 || r > 176) return !1; } return !0; }, i.prototype.parseStringISO = function(t, e) { for (var n = "", r = t; r < e; ++r) n += String.fromCharCode(this.get(r)); return n; }, i.prototype.parseStringUTF = function(t, e) { for (var n = "", r = t; r < e; ) { var s = this.get(r++); s < 128 ? n += String.fromCharCode(s) : s > 191 && s < 224 ? n += String.fromCharCode((s & 31) << 6 | this.get(r++) & 63) : n += String.fromCharCode((s & 15) << 12 | (this.get(r++) & 63) << 6 | this.get(r++) & 63); } return n; }, i.prototype.parseStringBMP = function(t, e) { for (var n = "", r, s, a = t; a < e; ) r = this.get(a++), s = this.get(a++), n += String.fromCharCode(r << 8 | s); return n; }, i.prototype.parseTime = function(t, e, n) { var r = this.parseStringISO(t, e), s = (n ? Rn : Cn).exec(r); return s ? (n && (s[1] = +s[1], s[1] += +s[1] < 70 ? 2e3 : 1900), r = s[1] + "-" + s[2] + "-" + s[3] + " " + s[4], s[5] && (r += ":" + s[5], s[6] && (r += ":" + s[6], s[7] && (r += "." + s[7]))), s[8] && (r += " UTC", s[8] != "Z" && (r += s[8], s[9] && (r += ":" + s[9]))), r) : "Unrecognized time: " + r; }, i.prototype.parseInteger = function(t, e) { for (var n = this.get(t), r = n > 127, s = r ? 255 : 0, a, o = ""; n == s && ++t < e; ) n = this.get(t); if (a = e - t, a === 0) return r ? -1 : 0; if (a > 4) { for (o = n, a <<= 3; ((+o ^ s) & 128) == 0; ) o = +o << 1, --a; o = "(" + a + ` bit) `; } r && (n = n - 256); for (var c = new mt(n), h = t + 1; h < e; ++h) c.mulAdd(256, this.get(h)); return o + c.toString(); }, i.prototype.parseBitString = function(t, e, n) { for (var r = this.get(t), s = (e - t - 1 << 3) - r, a = "(" + s + ` bit) `, o = "", c = t + 1; c < e; ++c) { for (var h = this.get(c), u = c == e - 1 ? r : 0, f = 7; f >= u; --f) o += h >> f & 1 ? "1" : "0"; if (o.length > n) return a + ft(o, n); } return a + o; }, i.prototype.parseOctetString = function(t, e, n) { if (this.isASCII(t, e)) return ft(this.parseStringISO(t, e), n); var r = e - t, s = "(" + r + ` byte) `; n /= 2, r > n && (e = t + n); for (var a = t; a < e; ++a) s += this.hexByte(this.get(a)); return r > n && (s += ze), s; }, i.prototype.parseOID = function(t, e, n) { for (var r = "", s = new mt(), a = 0, o = t; o < e; ++o) { var c = this.get(o); if (s.mulAdd(128, c & 127), a += 7, !(c & 128)) { if (r === "") if (s = s.simplify(), s instanceof mt) s.sub(80), r = "2." + s.toString(); else { var h = s < 80 ? s < 40 ? 0 : 1 : 2; r = h + "." + (s - h * 40); } else r += "." + s.toString(); if (r.length > n) return ft(r, n); s = new mt(), a = 0; } } return a > 0 && (r += ".incomplete"), r; }, i; })() ), On = ( /** @class */ (function() { function i(t, e, n, r, s) { if (!(r instanceof Pe)) throw new Error("Invalid tag value."); this.stream = t, this.header = e, this.length = n, this.tag = r, this.sub = s; } return i.prototype.typeName = function() { switch (this.tag.tagClass) { case 0: switch (this.tag.tagNumber) { case 0: return "EOC"; case 1: return "BOOLEAN"; case 2: return "INTEGER"; case 3: return "BIT_STRING"; case 4: return "OCTET_STRING"; case 5: return "NULL"; case 6: return "OBJECT_IDENTIFIER"; case 7: return "ObjectDescriptor"; case 8: return "EXTERNAL"; case 9: return "REAL"; case 10: return "ENUMERATED"; case 11: return "EMBEDDED_PDV"; case 12: return "UTF8String"; case 16: return "SEQUENCE"; case 17: return "SET"; case 18: return "NumericString"; case 19: return "PrintableString"; // ASCII subset case 20: return "TeletexString"; // aka T61String case 21: return "VideotexString"; case 22: return "IA5String"; // ASCII case 23: return "UTCTime"; case 24: return "GeneralizedTime"; case 25: return "GraphicString"; case 26: return "VisibleString"; // ASCII subset case 27: return "GeneralString"; case 28: return "UniversalString"; case 30: return "BMPString"; } return "Universal_" + this.tag.tagNumber.toString(); case 1: return "Application_" + this.tag.tagNumber.toString(); case 2: return "[" + this.tag.tagNumber.toString() + "]"; // Context case 3: return "Private_" + this.tag.tagNumber.toString(); } }, i.prototype.content = function(t) { if (this.tag === void 0) return null; t === void 0 && (t = 1 / 0); var e = this.posContent(), n = Math.abs(this.length); if (!this.tag.isUniversal()) return this.sub !== null ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + n, t); switch (this.tag.tagNumber) { case 1: return this.stream.get(e) === 0 ? "false" : "true"; case 2: return this.stream.parseInteger(e, e + n); case 3: return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(e, e + n, t); case 4: return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + n, t); // case 0x05: // NULL case 6: return this.stream.parseOID(e, e + n, t); // case 0x07: // ObjectDescriptor // case 0x08: // EXTERNAL // case 0x09: // REAL // case 0x0A: // ENUMERATED // case 0x0B: // EMBEDDED_PDV case 16: // SEQUENCE case 17: return this.sub !== null ? "(" + this.sub.length + " elem)" : "(no elem)"; case 12: return ft(this.stream.parseStringUTF(e, e + n), t); case 18: // NumericString case 19: // PrintableString case 20: // TeletexString case 21: // VideotexString case 22: // IA5String // case 0x19: // GraphicString case 26: return ft(this.stream.parseStringISO(e, e + n), t); case 30: return ft(this.stream.parseStringBMP(e, e + n), t); case 23: // UTCTime case 24: return this.stream.parseTime(e, e + n, this.tag.tagNumber == 23); } return null; }, i.prototype.toString = function() { return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (this.sub === null ? "null" : this.sub.length) + "]"; }, i.prototype.toPrettyString = function(t) { t === void 0 && (t = ""); var e = t + this.typeName() + " @" + this.stream.pos; 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 += ` `, this.sub !== null) { t += " "; for (var n = 0, r = this.sub.length; n < r; ++n) e += this.sub[n].toPrettyString(t); } return e; }, i.prototype.posStart = function() { return this.stream.pos; }, i.prototype.posContent = function() { return this.stream.pos + this.header; }, i.prototype.posEnd = function() { return this.stream.pos + this.header + Math.abs(this.length); }, i.prototype.toHexString = function() { return this.stream.hexDump(this.posStart(), this.posEnd(), !0); }, i.decodeLength = function(t) { var e = t.get(), n = e & 127; if (n == e) return n; if (n > 6) throw new Error("Length over 48 bits not supported at position " + (t.pos - 1)); if (n === 0) return null; e = 0; for (var r = 0; r < n; ++r) e = e * 256 + t.get(); return e; }, i.prototype.getHexStringValue = function() { var t = this.toHexString(), e = this.header * 2, n = this.length * 2; return t.substring(e, e + n); }, i.decode = function(t) { var e; t instanceof Xt ? e = t : e = new Xt(t, 0); var n = new Xt(e), r = new Pe(e), s = i.decodeLength(e), a = e.pos, o = a - n.pos, c = null, h = function() { var f = []; if (s !== null) { for (var _ = a + s; e.pos < _; ) f[f.length] = i.decode(e); if (e.pos != _) throw new Error("Content size is not correct for container starting at offset " + a); } else try { for (; ; ) { var y = i.decode(e); if (y.tag.isEOC()) break; f[f.length] = y; } s = a - e.pos; } catch (m) { throw new Error("Exception while decoding undefined length content: " + m); } return f; }; if (r.tagConstructed) c = h(); else if (r.isUniversal() && (r.tagNumber == 3 || r.tagNumber == 4)) try { if (r.tagNumber == 3 && e.get() != 0) throw new Error("BIT STRINGs with unused bits cannot encapsulate."); c = h(); for (var u = 0; u < c.length; ++u) if (c[u].tag.isEOC()) throw new Error("EOC is not supposed to be actual content."); } catch { c = null; } if (c === null) { if (s === null) throw new Error("We can't skip over an invalid tag with undefined length at offset " + a); e.pos = a + Math.abs(s); } return new i(n, o, s, r, c); }, i; })() ), Pe = ( /** @class */ (function() { function i(t) { var e = t.get(); if (this.tagClass = e >> 6, this.tagConstructed = (e & 32) !== 0, this.tagNumber = e & 31, this.tagNumber == 31) { var n = new mt(); do e = t.get(), n.mulAdd(128, e & 127); while (e & 128); this.tagNumber = n.simplify(); } } return i.prototype.isUniversal = function() { return this.tagClass === 0; }, i.prototype.isEOC = function() { return this.tagClass === 0 && this.tagNumber === 0; }, i; })() ), Y, Dn = 244837814094590, ve = (Dn & 16777215) == 15715070, x = [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], In = (1 << 26) / x[x.length - 1], v = ( /** @class */ (function() { function i(t, e, n) { t != null && (typeof t == "number" ? this.fromNumber(t, e, n) : e == null && typeof t != "string" ? this.fromString(t, 256) : this.fromString(t, e)); } return i.prototype.toString = function(t) { if (this.s < 0) return "-" + this.negate().toString(t); var e; if (t == 16) e = 4; else if (t == 8) e = 3; else if (t == 2) e = 1; else if (t == 32) e = 5; else if (t == 4) e = 2; else return this.toRadix(t); var n = (1 << e) - 1, r, s = !1, a = "", o = this.t, c = this.DB - o * this.DB % e; if (o-- > 0) for (c < this.DB && (r = this[o] >> c) > 0 && (s = !0, a = $(r)); o >= 0; ) c < e ? (r = (this[o] & (1 << c) - 1) << e - c, r |= this[--o] >> (c += this.DB - e)) : (r = this[o] >> (c -= e) & n, c <= 0 && (c += this.DB, --o)), r > 0 && (s = !0), s && (a += $(r)); return s ? a : "0"; }, i.prototype.negate = function() { var t = E(); return i.ZERO.subTo(this, t), t; }, i.prototype.abs = function() { return this.s < 0 ? this.negate() : this; }, i.prototype.compareTo = function(t) { var e = this.s - t.s; if (e != 0) return e; var n = this.t; if (e = n - t.t, e != 0) return this.s < 0 ? -e : e; for (; --n >= 0; ) if ((e = this[n] - t[n]) != 0) return e; return 0; }, i.prototype.bitLength = function() { return this.t <= 0 ? 0 : this.DB * (this.t - 1) + At(this[this.t - 1] ^ this.s & this.DM); }, i.prototype.mod = function(t) { var e = E(); return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(i.ZERO) > 0 && t.subTo(e, e), e; }, i.prototype.modPowInt = function(t, e) { var n; return t < 256 || e.isEven() ? n = new Ee(e) : n = new we(e), this.exp(t, n); }, i.prototype.clone = function() { var t = E(); return this.copyTo(t), t; }, i.prototype.intValue = function() { if (this.s < 0) { if (this.t == 1) return this[0] - this.DV; if (this.t == 0) return -1; } else { if (this.t == 1) return this[0]; if (this.t == 0) return 0; } return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0]; }, i.prototype.byteValue = function() { return this.t == 0 ? this.s : this[0] << 24 >> 24; }, i.prototype.shortValue = function() { return this.t == 0 ? this.s : this[0] << 16 >> 16; }, i.prototype.signum = function() { return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1; }, i.prototype.toByteArray = function() { var t = this.t, e = []; e[0] = this.s; var n = this.DB - t * this.DB % 8, r, s = 0; if (t-- > 0) for (n < this.DB && (r = this[t] >> n) != (this.s & this.DM) >> n && (e[s++] = r | this.s << this.DB - n); t >= 0; ) n < 8 ? (r = (this[t] & (1 << n) - 1) << 8 - n, r |= this[--t] >> (n += this.DB - 8)) : (r = this[t] >> (n -= 8) & 255, n <= 0 && (n += this.DB, --t)), (r & 128) != 0 && (r |= -256), s == 0 && (this.s & 128) != (r & 128) && ++s, (s > 0 || r != this.s) && (e[s++] = r); return e; }, i.prototype.equals = function(t) { return this.compareTo(t) == 0; }, i.prototype.min = function(t) { return this.compareTo(t) < 0 ? this : t; }, i.prototype.max = function(t) { return this.compareTo(t) > 0 ? this : t; }, i.prototype.and = function(t) { var e = E(); return this.bitwiseTo(t, wn, e), e; }, i.prototype.or = function(t) { var e = E(); return this.bitwiseTo(t, Tt, e), e; }, i.prototype.xor = function(t) { var e = E(); return this.bitwiseTo(t, me, e), e; }, i.prototype.andNot = function(t) { var e = E(); return this.bitwiseTo(t, ye, e), e; }, i.prototype.not = function() { for (var t = E(), e = 0; e < this.t; ++e) t[e] = this.DM & ~this[e]; return t.t = this.t, t.s = ~this.s, t; }, i.prototype.shiftLeft = function(t) { var e = E(); return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e; }, i.prototype.shiftRight = function(t) { var e = E(); return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e; }, i.prototype.getLowestSetBit = function() { for (var t = 0; t < this.t; ++t) if (this[t] != 0) return t * this.DB + Sn(this[t]); return this.s < 0 ? this.t * this.DB : -1; }, i.prototype.bitCount = function() { for (var t = 0, e = this.s & this.DM, n = 0; n < this.t; ++n) t += Tn(this[n] ^ e); return t; }, i.prototype.testBit = function(t) { var e = Math.floor(t / this.DB); return e >= this.t ? this.s != 0 : (this[e] & 1 << t % this.DB) != 0; }, i.prototype.setBit = function(t) { return this.changeBit(t, Tt); }, i.prototype.clearBit = function(t) { return this.changeBit(t, ye); }, i.prototype.flipBit = function(t) { return this.changeBit(t, me); }, i.prototype.add = function(t) { var e = E(); return this.addTo(t, e), e; }, i.prototype.subtract = function(t) { var e = E(); return this.subTo(t, e), e; }, i.prototype.multiply = function(t) { var e = E(); return this.multiplyTo(t, e), e; }, i.prototype.divide = function(t) { var e = E(); return this.divRemTo(t, e, null), e; }, i.prototype.remainder = function(t) { var e = E(); return this.divRemTo(t, null, e), e; }, i.prototype.divideAndRemainder = function(t) { var e = E(), n = E(); return this.divRemTo(t, e, n), [e, n]; }, i.prototype.modPow = function(t, e) { var n = t.bitLength(), r, s = Q(1), a; if (n <= 0) return s; n < 18 ? r = 1 : n < 48 ? r = 3 : n < 144 ? r = 4 : n < 768 ? r = 5 : r = 6, n < 8 ? a = new Ee(e) : e.isEven() ? a = new Bn(e) : a = new we(e); var o = [], c = 3, h = r - 1, u = (1 << r) - 1; if (o[1] = a.convert(this), r > 1) { var f = E(); for (a.sqrTo(o[1], f); c <= u; ) o[c] = E(), a.mulTo(f, o[c - 2], o[c]), c += 2; } var _ = t.t - 1, y, m = !0, g = E(), d; for (n = At(t[_]) - 1; _ >= 0; ) { for (n >= h ? y = t[_] >> n - h & u : (y = (t[_] & (1 << n + 1) - 1) << h - n, _ > 0 && (y |= t[_ - 1] >> this.DB + n - h)), c = r; (y & 1) == 0; ) y >>= 1, --c; if ((n -= c) < 0 && (n += this.DB, --_), m) o[y].copyTo(s), m = !1; else { for (; c > 1; ) a.sqrTo(s, g), a.sqrTo(g, s), c -= 2; c > 0 ? a.sqrTo(s, g) : (d = s, s = g, g = d), a.mulTo(g, o[y], s); } for (; _ >= 0 && (t[_] & 1 << n) == 0; ) a.sqrTo(s, g), d = s, s = g, g = d, --n < 0 && (n = this.DB - 1, --_); } return a.revert(s); }, i.prototype.modInverse = function(t) { var e = t.isEven(); if (this.isEven() && e || t.signum() == 0) return i.ZERO; for (var n = t.clone(), r = this.clone(), s = Q(1), a = Q(0), o = Q(0), c = Q(1); n.signum() != 0; ) { for (; n.isEven(); ) n.rShiftTo(1, n), e ? ((!s.isEven() || !a.isEven()) && (s.addTo(this, s), a.subTo(t, a)), s.rShiftTo(1, s)) : a.isEven() || a.subTo(t, a), a.rShiftTo(1, a); for (; r.isEven(); ) r.rShiftTo(1, r), e ? ((!o.isEven() || !c.isEven()) && (o.addTo(this, o), c.subTo(t, c)), o.rShiftTo(1, o)) : c.isEven() || c.subTo(t, c), c.rShiftTo(1, c); n.compareTo(r) >= 0 ? (n.subTo(r, n), e && s.subTo(o, s), a.subTo(c, a)) : (r.subTo(n, r), e && o.subTo(s, o), c.subTo(a, c)); } if (r.compareTo(i.ONE) != 0) return i.ZERO; if (c.compareTo(t) >= 0) return c.subtract(t); if (c.signum() < 0) c.addTo(t, c); else return c; return c.signum() < 0 ? c.add(t) : c; }, i.prototype.pow = function(t) { return this.exp(t, new Nn()); }, i.prototype.gcd = function(t) { var e = this.s < 0 ? this.negate() : this.clone(), n = t.s < 0 ? t.negate() : t.clone(); if (e.compareTo(n) < 0) { var r = e; e = n, n = r; } var s = e.getLowestSetBit(), a = n.getLowestSetBit(); if (a < 0) return e; for (s < a && (a = s), a > 0 && (e.rShiftTo(a, e), n.rShiftTo(a, n)); e.signum() > 0; ) (s = e.getLowestSetBit()) > 0 && e.rShiftTo(s, e), (s = n.getLowestSetBit()) > 0 && n.rShiftTo(s, n), e.compareTo(n) >= 0 ? (e.subTo(n, e), e.rShiftTo(1, e)) : (n.subTo(e, n), n.rShiftTo(1, n)); return a > 0 && n.lShiftTo(a, n), n; }, i.prototype.isProbablePrime = function(t) { var e, n = this.abs(); if (n.t == 1 && n[0] <= x[x.length - 1]) { for (e = 0; e < x.length; ++e) if (n[0] == x[e]) return !0; return !1; } if (n.isEven()) return !1; for (e = 1; e < x.length; ) { for (var r = x[e], s = e + 1; s < x.length && r < In; ) r *= x[s++]; for (r = n.modInt(r); e < s; ) if (r % x[e++] == 0) return !1; } return n.millerRabin(t); }, i.prototype.copyTo = function(t) { for (var e = this.t - 1; e >= 0; --e) t[e] = this[e]; t.t = this.t, t.s = this.s; }, i.prototype.fromInt = function(t) { this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0; }, i.prototype.fromString = function(t, e) { var n; if (e == 16) n = 4; else if (e == 8) n = 3; else if (e == 256) n = 8; else if (e == 2) n = 1; else if (e == 32) n = 5; else if (e == 4) n = 2; else { this.fromRadix(t, e); return; } this.t = 0, this.s = 0; for (var r = t.length, s = !1, a = 0; --r >= 0; ) { var o = n == 8 ? +t[r] & 255 : Te(t, r); if (o < 0) { t.charAt(r) == "-" && (s = !0); continue; } s = !1, a == 0 ? this[this.t++] = o : a + n > this.DB ? (this[this.t - 1] |= (o & (1 << this.DB - a) - 1) << a, this[this.t++] = o >> this.DB - a) : this[this.t - 1] |= o << a, a += n, a >= this.DB && (a -= this.DB); } n == 8 && (+t[0] & 128) != 0 && (this.s = -1, a > 0 && (this[this.t - 1] |= (1 << this.DB - a) - 1 << a)), this.clamp(), s && i.ZERO.subTo(this, this); }, i.prototype.clamp = function() { for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; ) --this.t; }, i.prototype.dlShiftTo = function(t, e) { var n; for (n = this.t - 1; n >= 0; --n) e[n + t] = this[n]; for (n = t - 1; n >= 0; --n) e[n] = 0; e.t = this.t + t, e.s = this.s; }, i.prototype.drShiftTo = function(t, e) { for (var n = t; n < this.t; ++n) e[n - t] = this[n]; e.t = Math.max(this.t - t, 0), e.s = this.s; }, i.prototype.lShiftTo = function(t, e) { for (var n = t % this.DB, r = this.DB - n, s = (1 << r) - 1, a = Math.floor(t / this.DB), o = this.s << n & this.DM, c = this.t - 1; c >= 0; --c) e[c + a + 1] = this[c] >> r | o, o = (this[c] & s) << n; for (var c = a - 1; c >= 0; --c) e[c] = 0; e[a] = o, e.t = this.t + a + 1, e.s = this.s, e.clamp(); }, i.prototype.rShiftTo = function(t, e) { e.s = this.s; var n = Math.floor(t / this.DB); if (n >= this.t) { e.t = 0; return; } var r = t % this.DB, s = this.DB - r, a = (1 << r) - 1; e[0] = this[n] >> r; for (var o = n + 1; o < this.t; ++o) e[o - n - 1] |= (this[o] & a) << s, e[o - n] = this[o] >> r; r > 0 && (e[this.t - n - 1] |= (this.s & a) << s), e.t = this.t - n, e.clamp(); }, i.prototype.subTo = function(t, e) { for (var n = 0, r = 0, s = Math.min(t.t, this.t); n < s; ) r += this[n] - t[n], e[n++] = r & this.DM, r >>= this.DB; if (t.t < this.t) { for (r -= t.s; n < this.t; ) r += this[n], e[n++] = r & this.DM, r >>= this.DB; r += this.s; } else { for (r += this.s; n < t.t; ) r -= t[n], e[n++] = r & this.DM, r >>= this.DB; r -= t.s; } e.s = r < 0 ? -1 : 0, r < -1 ? e[n++] = this.DV + r : r > 0 && (e[n++] = r), e.t = n, e.clamp(); }, i.prototype.multiplyTo = function(t, e) { var n = this.abs(), r = t.abs(), s = n.t; for (e.t = s + r.t; --s >= 0; ) e[s] = 0; for (s = 0; s < r.t; ++s) e[s + n.t] = n.am(0, r[s], e, s, 0, n.t); e.s = 0, e.clamp(), this.s != t.s && i.ZERO.subTo(e, e); }, i.prototype.squareTo = function(t) { for (var e = this.abs(), n = t.t = 2 * e.t; --n >= 0; ) t[n] = 0; for (n = 0; n < e.t - 1; ++n) { var r = e.am(n, e[n], t, 2 * n, 0, 1); (t[n + e.t] += e.am(n + 1, 2 * e[n], t, 2 * n + 1, r, e.t - n - 1)) >= e.DV && (t[n + e.t] -= e.DV, t[n + e.t + 1] = 1); } t.t > 0 && (t[t.t - 1] += e.am(n, e[n], t, 2 * n, 0, 1)), t.s = 0, t.clamp(); }, i.prototype.divRemTo = function(t, e, n) { var r = t.abs(); if (!(r.t <= 0)) { var s = this.abs(); if (s.t < r.t) { e?.fromInt(0), n != null && this.copyTo(n); return; } n == null && (n = E()); var a = E(), o = this.s, c = t.s, h = this.DB - At(r[r.t - 1]); h > 0 ? (r.lShiftTo(h, a), s.lShiftTo(h, n)) : (r.copyTo(a), s.copyTo(n)); var u = a.t, f = a[u - 1]; if (f != 0) { var _ = f * (1 << this.F1) + (u > 1 ? a[u - 2] >> this.F2 : 0), y = this.FV / _, m = (1 << this.F1) / _, g = 1 << this.F2, d = n.t, w = d - u, C = e ?? E(); for (a.dlShiftTo(w, C), n.compareTo(C) >= 0 && (n[n.t++] = 1, n.subTo(C, n)), i.ONE.dlShiftTo(u, C), C.subTo(a, a); a.t < u; ) a[a.t++] = 0; for (; --w >= 0; ) { var T = n[--d] == f ? this.DM : Math.floor(n[d] * y + (n[d - 1] + g) * m); if ((n[d] += a.am(0, T, n, w, 0, u)) < T) for (a.dlShiftTo(w, C), n.subTo(C, n); n[d] < --T; ) n.subTo(C, n); } e != null && (n.drShiftTo(u, e), o != c && i.ZERO.subTo(e, e)), n.t = u, n.clamp(), h > 0 && n.rShiftTo(h, n), o < 0 && i.ZERO.subTo(n, n); } } }, i.prototype.invDigit = function() { if (this.t < 1) return 0; var t = this[0]; if ((t & 1) == 0) return 0; var e = t & 3; 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; }, i.prototype.isEven = function() { return (this.t > 0 ? this[0] & 1 : this.s) == 0; }, i.prototype.exp = function(t, e) { if (t > 4294967295 || t < 1) return i.ONE; var n = E(), r = E(), s = e.convert(this), a = At(t) - 1; for (s.copyTo(n); --a >= 0; ) if (e.sqrTo(n, r), (t & 1 << a) > 0) e.mulTo(r, s, n); else { var o = n; n = r, r = o; } return e.revert(n); }, i.prototype.chunkSize = function(t) { return Math.floor(Math.LN2 * this.DB / Math.log(t)); }, i.prototype.toRadix = function(t) { if (t == null && (t = 10), this.signum() == 0 || t < 2 || t > 36) return "0"; var e = this.chunkSize(t), n = Math.pow(t, e), r = Q(n), s = E(), a = E(), o = ""; for (this.divRemTo(r, s, a); s.signum() > 0; ) o = (n + a.intValue()).toString(t).substring(1) + o, s.divRemTo(r, s, a); return a.intValue().toString(t) + o; }, i.prototype.fromRadix = function(t, e) { this.fromInt(0), e == null && (e = 10); for (var n = this.chunkSize(e), r = Math.pow(e, n), s = !1, a = 0, o = 0, c = 0; c < t.length; ++c) { var h = Te(t, c); if (h < 0) { t.charAt(c) == "-" && this.signum() == 0 && (s = !0); continue; } o = e * o + h, ++a >= n && (this.dMultiply(r), this.dAddOffset(o, 0), a = 0, o = 0); } a > 0 && (this.dMultiply(Math.pow(e, a)), this.dAddOffset(o, 0)), s && i.ZERO.subTo(this, this); }, i.prototype.fromNumber = function(t, e, n) { if (typeof e == "number") if (t < 2) this.fromInt(1); else for (this.fromNumber(t, n), this.testBit(t - 1) || this.bitwiseTo(i.ONE.shiftLeft(t - 1), Tt, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e); ) this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(i.ONE.shiftLeft(t - 1), this); else { var r = [], s = t & 7; r.length = (t >> 3) + 1, e.nextBytes(r), s > 0 ? r[0] &= (1 << s) - 1 : r[0] = 0, this.fromString(r, 256); } }, i.prototype.bitwiseTo = function(t, e, n) { var r, s, a = Math.min(t.t, this.t); for (r = 0; r < a; ++r) n[r] = e(this[r], t[r]); if (t.t < this.t) { for (s = t.s & this.DM, r = a; r < this.t; ++r) n[r] = e(this[r], s); n.t = this.t; } else { for (s = this.s & this.DM, r = a; r < t.t; ++r) n[r] = e(s, t[r]); n.t = t.t; } n.s = e(this.s, t.s), n.clamp(); }, i.prototype.changeBit = function(t, e) { var n = i.ONE.shiftLeft(t); return this.bitwiseTo(n, e, n), n; }, i.prototype.addTo = function(t, e) { for (var n = 0, r = 0, s = Math.min(t.t, this.t); n < s; ) r += this[n] + t[n], e[n++] = r & this.DM, r >>= this.DB; if (t.t < this.t) { for (r += t.s; n < this.t; ) r += this[n], e[n++] = r & this.DM, r >>= this.DB; r += this.s; } else { for (r += this.s; n < t.t; ) r += t[n], e[n++] = r & this.DM, r >>= this.DB; r += t.s; } e.s = r < 0 ? -1 : 0, r > 0 ? e[n++] = r : r < -1 && (e[n++] = this.DV + r), e.t = n, e.clamp(); }, i.prototype.dMultiply = function(t) { this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp(); }, i.prototype.dAddOffset = function(t, e) { if (t != 0) { for (; this.t <= e; ) this[this.t++] = 0; for (this[e] += t; this[e] >= this.DV; ) this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e]; } }, i.prototype.multiplyLowerTo = function(t, e, n) { var r = Math.min(this.t + t.t, e); for (n.s = 0, n.t = r; r > 0; ) n[--r] = 0; for (var s = n.t - this.t; r < s; ++r) n[r + this.t] = this.am(0, t[r], n, r, 0, this.t); for (var s = Math.min(t.t, e); r < s; ++r) this.am(0, t[r], n, r, 0, e - r); n.clamp(); }, i.prototype.multiplyUpperTo = function(t, e, n) { --e; var r = n.t = this.t + t.t - e; for (n.s = 0; --r >= 0; ) n[r] = 0; for (r = Math.max(e - this.t, 0); r < t.t; ++r) n[this.t + r - e] = this.am(e - r, t[r], n, 0, 0, this.t + r - e); n.clamp(), n.drShiftTo(1, n); }, i.prototype.modInt = function(t) { if (t <= 0) return 0; var e = this.DV % t, n = this.s < 0 ? t - 1 : 0; if (this.t > 0) if (e == 0) n = this[0] % t; else for (var r = this.t - 1; r >= 0; --r) n = (e * n + this[r]) % t; return n; }, i.prototype.millerRabin = function(t) { var e = this.subtract(i.ONE), n = e.getLowestSetBit(); if (n <= 0) return !1; var r = e.shiftRight(n); t = t + 1 >> 1, t > x.length && (t = x.length); for (var s = E(), a = 0; a < t; ++a) { s.fromInt(x[Math.floor(Math.random() * x.length)]); var o = s.modPow(r, this); if (o.compareTo(i.ONE) != 0 && o.compareTo(e) != 0) { for (var c = 1; c++ < n && o.compareTo(e) != 0; ) if (o = o.modPowInt(2, this), o.compareTo(i.ONE) == 0) return !1; if (o.compareTo(e) != 0) return !1; } } return !0; }, i.prototype.square = function() { var t = E(); return this.squareTo(t), t; }, i.prototype.gcda = function(t, e) { var n = this.s < 0 ? this.negate() : this.clone(), r = t.s < 0 ? t.negate() : t.clone(); if (n.compareTo(r) < 0) { var s = n; n = r, r = s; } var a = n.getLowestSetBit(), o = r.getLowestSetBit(); if (o < 0) { e(n); return; } a < o && (o = a), o > 0 && (n.rShiftTo(o, n), r.rShiftTo(o, r)); var c = function() { (a = n.getLowestSetBit()) > 0 && n.rShiftTo(a, n), (a = r.getLowestSetBit()) > 0 && r.rShiftTo(a, r), n.compareTo(r) >= 0 ? (n.subTo(r, n), n.rShiftTo(1, n)) : (r.subTo(n, r), r.rShiftTo(1, r)), n.signum() > 0 ? setTimeout(c, 0) : (o > 0 && r.lShiftTo(o, r), setTimeout(function() { e(r); }, 0)); }; setTimeout(c, 10); }, i.prototype.fromNumberAsync = function(t, e, n, r) { if (typeof e == "number") if (t < 2) this.fromInt(1); else { this.fromNumber(t, n), this.testBit(t - 1) || this.bitwiseTo(i.ONE.shiftLeft(t - 1), Tt, this), this.isEven() && this.dAddOffset(1, 0); var s = this, a = function() { s.dAddOffset(2, 0), s.bitLength() > t && s.subTo(i.ONE.shiftLeft(t - 1), s), s.isProbablePrime(e) ? setTimeout(function() { r(); }, 0) : setTimeout(a, 0); }; setTimeout(a, 0); } else { var o = [], c = t & 7; o.length = (t >> 3) + 1, e.nextBytes(o), c > 0 ? o[0] &= (1 << c) - 1 : o[0] = 0, this.fromString(o, 256); } }, i; })() ), Nn = ( /** @class */ (function() { function i() { } return i.prototype.convert = function(t) { return t; }, i.prototype.revert = function(t) { return t; }, i.prototype.mulTo = function(t, e, n) { t.multiplyTo(e, n); }, i.prototype.sqrTo = function(t, e) { t.squareTo(e); }, i; })() ), Ee = ( /** @class */ (function() { function i(t) { this.m = t; } return i.prototype.convert = function(t) { return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t; }, i.prototype.revert = function(t) { return t; }, i.prototype.reduce = function(t) { t.divRemTo(this.m, null, t); }, i.prototype.mulTo = function(t, e, n) { t.multiplyTo(e, n), this.reduce(n); }, i.prototype.sqrTo = function(t, e) { t.squareTo(e), this.reduce(e); }, i; })() ), we = ( /** @class */ (function() { function i(t) { 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; } return i.prototype.convert = function(t) { var e = E(); return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(v.ZERO) > 0 && this.m.subTo(e, e), e; }, i.prototype.revert = function(t) { var e = E(); return t.copyTo(e), this.reduce(e), e; }, i.prototype.reduce = function(t) { for (; t.t <= this.mt2; ) t[t.t++] = 0; for (var e = 0; e < this.m.t; ++e) { var n = t[e] & 32767, r = n * this.mpl + ((n * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM; for (n = e + this.m.t, t[n] += this.m.am(0, r, t, e, 0, this.m.t); t[n] >= t.DV; ) t[n] -= t.DV, t[++n]++; } t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t); }, i.prototype.mulTo = function(t, e, n) { t.multiplyTo(e, n), this.reduce(n); }, i.prototype.sqrTo = function(t, e) { t.squareTo(e), this.reduce(e); }, i; })() ), Bn = ( /** @class */ (function() { function i(t) { this.m = t, this.r2 = E(), this.q3 = E(), v.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t); } return i.prototype.convert = function(t) { if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m); if (t.compareTo(this.m) < 0) return t; var e = E(); return t.copyTo(e), this.reduce(e), e; }, i.prototype.revert = function(t) { return t; }, i.prototype.reduce = function(t) { 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; ) t.dAddOffset(1, this.m.t + 1); for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0; ) t.subTo(this.m, t); }, i.prototype.mulTo = function(t, e, n) { t.multiplyTo(e, n), this.reduce(n); }, i.prototype.sqrTo = function(t, e) { t.squareTo(e), this.reduce(e); }, i; })() ); function E() { return new v(null); } function R(i, t) { return new v(i, t); } var Se = typeof navigator < "u"; Se && ve && navigator.appName == "Microsoft Internet Explorer" ? (v.prototype.am = function(t, e, n, r, s, a) { for (var o = e & 32767, c = e >> 15; --a >= 0; ) { var h = this[t] & 32767, u = this[t++] >> 15, f = c * h + u * o; h = o * h + ((f & 32767) << 15) + n[r] + (s & 1073741823), s = (h >>> 30) + (f >>> 15) + c * u + (s >>> 30), n[r++] = h & 1073741823; } return s; }, Y = 30) : Se && ve && navigator.appName != "Netscape" ? (v.prototype.am = function(t, e, n, r, s, a) { for (; --a >= 0; ) { var o = e * this[t++] + n[r] + s; s = Math.floor(o / 67108864), n[r++] = o & 67108863; } return s; }, Y = 26) : (v.prototype.am = function(t, e, n, r, s, a) { for (var o = e & 16383, c = e >> 14; --a >= 0; ) { var h = this[t] & 16383, u = this[t++] >> 14, f = c * h + u * o; h = o * h + ((f & 16383) << 14) + n[r] + s, s = (h >> 28) + (f >> 14) + c * u, n[r++] = h & 268435455; } return s; }, Y = 28); v.prototype.DB = Y; v.prototype.DM = (1 << Y) - 1; v.prototype.DV = 1 << Y; var se = 52; v.prototype.FV = Math.pow(2, se); v.prototype.F1 = se - Y; v.prototype.F2 = 2 * Y - se; var Mt = [], dt, q; dt = 48; for (q = 0; q <= 9; ++q) Mt[dt++] = q; dt = 97; for (q = 10; q < 36; ++q) Mt[dt++] = q; dt = 65; for (q = 10; q < 36; ++q) Mt[dt++] = q; function Te(i, t) { var e = Mt[i.charCodeAt(t)]; return e ?? -1; } function Q(i) { var t = E(); return t.fromInt(i), t; } function At(i) { var t = 1, e; return (e = i >>> 16) != 0 && (i = e, t += 16), (e = i >> 8) != 0 && (i = e, t += 8), (e = i >> 4) != 0 && (i = e, t += 4), (e = i >> 2) != 0 && (i = e, t += 2), (e = i >> 1) != 0 && (i = e, t += 1), t; } v.ZERO = Q(0); v.ONE = Q(1); var xn = ( /** @class */ (function() { function i() { this.i = 0, this.j = 0, this.S = []; } return i.prototype.init = function(t) { var e, n, r; for (e = 0; e < 256; ++e) this.S[e] = e; for (n = 0, e = 0; e < 256; ++e) n = n + this.S[e] + t[e % t.length] & 255, r = this.S[e], this.S[e] = this.S[n], this.S[n] = r; this.i = 0, this.j = 0; }, i.prototype.next = function() { var t; 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]; }, i; })() ); function Vn() { return new xn(); } var Ge = 256, Rt, Z = null, H; if (Z == null) { Z = [], H = 0; var Ct = void 0; if (typeof window < "u" && self.crypto && self.crypto.getRandomValues) { var zt = new Uint32Array(256); for (self.crypto.getRandomValues(zt), Ct = 0; Ct < zt.length; ++Ct) Z[H++] = zt[Ct] & 255; } var Ot = 0, Dt = function(i) { if (Ot = Ot || 0, Ot >= 256 || H >= Ge) { self.removeEventListener ? self.removeEventListener("mousemove", Dt, !1) : self.detachEvent && self.detachEvent("onmousemove", Dt); return; } try { var t = i.x + i.y; Z[H++] = t & 255, Ot += 1; } catch { } }; typeof window < "u" && (self.addEventListener ? self.addEventListener("mousemove", Dt, !1) : self.attachEvent && self.attachEvent("onmousemove", Dt)); } function Un() { if (Rt == null) { for (Rt = Vn(); H < Ge; ) { var i = Math.floor(65536 * Math.random()); Z[H++] = i & 255; } for (Rt.init(Z), H = 0; H < Z.length; ++H) Z[H] = 0; H = 0; } return Rt.next(); } var Ut = ( /** @class */ (function() { function i() { } return i.prototype.nextBytes = function(t) { for (var e = 0; e < t.length; ++e) t[e] = Un(); }, i; })() ); function te(i) { return Mn(Xn(Ln(i), i.length * 8)); } function Ae(i) { for (var t = "0123456789abcdef", e = "", n = 0; n < i.length; n++) { var r = i.charCodeAt(n); e += t.charAt(r >>> 4 & 15) + t.charAt(r & 15); } return e; } function Ln(i) { for (var t = Array(i.length >> 2), e = 0; e < t.length; e++) t[e] = 0; for (var e = 0; e < i.length * 8; e += 8) t[e >> 5] |= (i.charCodeAt(e / 8) & 255) << 24 - e % 32; return t; } function Mn(i) { for (var t = "", e = 0; e < i.length * 32; e += 8) t += String.fromCharCode(i[e >> 5] >>> 24 - e % 32 & 255); return t; } function z(i, t) { return i >>> t | i << 32 - t; } function $e(i, t) { return i >>> t; } function Fn(i, t, e) { return i & t ^ ~i & e; } function kn(i, t, e) { return i & t ^ i & e ^ t & e; } function jn(i) { return z(i, 2) ^ z(i, 13) ^ z(i, 22); } function qn(i) { return z(i, 6) ^ z(i, 11) ^ z(i, 25); } function Kn(i) { return z(i, 7) ^ z(i, 18) ^ $e(i, 3); } function Hn(i) { return z(i, 17) ^ z(i, 19) ^ $e(i, 10); } var Wn = new Array(1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993, -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987, 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885, -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872, -1866530822, -1538233109, -1090935817, -965641998); function Xn(i, t) { var e = new Array(1779033703, -1150833019, 1013904242, -1521486534, 1359893119, -1694144372, 528734635, 1541459225), n = new Array(64), r, s, a, o, c, h, u, f, _, y, m, g; for (i[t >> 5] |= 128 << 24 - t % 32, i[(t + 64 >> 9 << 4) + 15] = t, _ = 0; _ < i.length; _ += 16) { for (r = e[0], s = e[1], a = e[2], o = e[3], c = e[4], h = e[5], u = e[6], f = e[7], y = 0; y < 64; y++) y < 16 ? n[y] = i[y + _] : n[y] = I(I(I(Hn(n[y - 2]), n[y - 7]), Kn(n[y - 15])), n[y - 16]), m = I(I(I(I(f, qn(c)), Fn(c, h, u)), Wn[y]), n[y]), g = I(jn(r), kn(r, s, a)), f = u, u = h, h = c, c = I(o, m), o = a, a = s, s = r, r = I(m, g); e[0] = I(r, e[0]), e[1] = I(s, e[1]), e[2] = I(a, e[2]), e[3] = I(o, e[3]), e[4] = I(c, e[4]), e[5] = I(h, e[5]), e[6] = I(u, e[6]), e[7] = I(f, e[7]); } return e; } function I(i, t) { var e = (i & 65535) + (t & 65535), n = (i >> 16) + (t >> 16) + (e >> 16); return n << 16 | e & 65535; } function zn(i, t) { if (t < i.length + 22) return console.error("Message too long for RSA"), null; for (var e = t - i.length