🏠 

Greasy Fork is available in English.

dmzjDecrypt

解析 dmzj v4 api 返回数据

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.org/scripts/467177/1207199/dmzjDecrypt.js

  1. !function(e, r) {
  2. "object" == typeof exports && "undefined" != typeof module ? module.exports = r() : "function" == typeof define && define.amd ? define(r) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dmzjDecrypt = r();
  3. }(this, (function() {
  4. var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz", dbits;
  5. function int2char(e) {
  6. return BI_RM.charAt(e);
  7. }
  8. function op_and(e, r) {
  9. return e & r;
  10. }
  11. function op_or(e, r) {
  12. return e | r;
  13. }
  14. function op_xor(e, r) {
  15. return e ^ r;
  16. }
  17. function op_andnot(e, r) {
  18. return e & ~r;
  19. }
  20. function lbit(e) {
  21. if (0 == e) return -1;
  22. var r = 0;
  23. return 0 == (65535 & e) && (e >>= 16, r += 16), 0 == (255 & e) && (e >>= 8, r += 8),
  24. 0 == (15 & e) && (e >>= 4, r += 4), 0 == (3 & e) && (e >>= 2, r += 2), 0 == (1 & e) && ++r,
  25. r;
  26. }
  27. function cbit(e) {
  28. for (var r = 0; 0 != e; ) e &= e - 1, ++r;
  29. return r;
  30. }
  31. var canary = 0xdeadbeefcafe, j_lm = 15715070 == (16777215 & canary), lowprimes = [ 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 ], lplim = (1 << 26) / lowprimes[lowprimes.length - 1], BigInteger = function() {
  32. function BigInteger(e, r, i) {
  33. null != e && ("number" == typeof e ? this.fromNumber(e, r, i) : null == r && "string" != typeof e ? this.fromString(e, 256) : this.fromString(e, r));
  34. }
  35. return BigInteger.prototype.toString = function(e) {
  36. if (this.s < 0) return "-" + this.negate().toString(e);
  37. var r;
  38. if (16 == e) r = 4; else if (8 == e) r = 3; else if (2 == e) r = 1; else if (32 == e) r = 5; else {
  39. if (4 != e) return this.toRadix(e);
  40. r = 2;
  41. }
  42. var i, n = (1 << r) - 1, o = !1, s = "", a = this.t, u = this.DB - a * this.DB % r;
  43. if (a-- > 0) for (u < this.DB && (i = this[a] >> u) > 0 && (o = !0, s = int2char(i)); a >= 0; ) u < r ? (i = (this[a] & (1 << u) - 1) << r - u,
  44. i |= this[--a] >> (u += this.DB - r)) : (i = this[a] >> (u -= r) & n, u <= 0 && (u += this.DB,
  45. --a)), i > 0 && (o = !0), o && (s += int2char(i));
  46. return o ? s : "0";
  47. }, BigInteger.prototype.negate = function() {
  48. var e = nbi();
  49. return BigInteger.ZERO.subTo(this, e), e;
  50. }, BigInteger.prototype.abs = function() {
  51. return this.s < 0 ? this.negate() : this;
  52. }, BigInteger.prototype.compareTo = function(e) {
  53. var r = this.s - e.s;
  54. if (0 != r) return r;
  55. var i = this.t;
  56. if (0 != (r = i - e.t)) return this.s < 0 ? -r : r;
  57. for (;--i >= 0; ) if (0 != (r = this[i] - e[i])) return r;
  58. return 0;
  59. }, BigInteger.prototype.bitLength = function() {
  60. return this.t <= 0 ? 0 : this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);
  61. }, BigInteger.prototype.mod = function(e) {
  62. var r = nbi();
  63. return this.abs().divRemTo(e, null, r), this.s < 0 && r.compareTo(BigInteger.ZERO) > 0 && e.subTo(r, r),
  64. r;
  65. }, BigInteger.prototype.modPowInt = function(e, r) {
  66. var i;
  67. return i = e < 256 || r.isEven() ? new Classic(r) : new Montgomery(r), this.exp(e, i);
  68. }, BigInteger.prototype.clone = function() {
  69. var e = nbi();
  70. return this.copyTo(e), e;
  71. }, BigInteger.prototype.intValue = function() {
  72. if (this.s < 0) {
  73. if (1 == this.t) return this[0] - this.DV;
  74. if (0 == this.t) return -1;
  75. } else {
  76. if (1 == this.t) return this[0];
  77. if (0 == this.t) return 0;
  78. }
  79. return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
  80. }, BigInteger.prototype.byteValue = function() {
  81. return 0 == this.t ? this.s : this[0] << 24 >> 24;
  82. }, BigInteger.prototype.shortValue = function() {
  83. return 0 == this.t ? this.s : this[0] << 16 >> 16;
  84. }, BigInteger.prototype.signum = function() {
  85. return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1;
  86. }, BigInteger.prototype.toByteArray = function() {
  87. var e = this.t, r = [];
  88. r[0] = this.s;
  89. var i, n = this.DB - e * this.DB % 8, o = 0;
  90. if (e-- > 0) for (n < this.DB && (i = this[e] >> n) != (this.s & this.DM) >> n && (r[o++] = i | this.s << this.DB - n); e >= 0; ) n < 8 ? (i = (this[e] & (1 << n) - 1) << 8 - n,
  91. i |= this[--e] >> (n += this.DB - 8)) : (i = this[e] >> (n -= 8) & 255, n <= 0 && (n += this.DB,
  92. --e)), 0 != (128 & i) && (i |= -256), 0 == o && (128 & this.s) != (128 & i) && ++o,
  93. (o > 0 || i != this.s) && (r[o++] = i);
  94. return r;
  95. }, BigInteger.prototype.equals = function(e) {
  96. return 0 == this.compareTo(e);
  97. }, BigInteger.prototype.min = function(e) {
  98. return this.compareTo(e) < 0 ? this : e;
  99. }, BigInteger.prototype.max = function(e) {
  100. return this.compareTo(e) > 0 ? this : e;
  101. }, BigInteger.prototype.and = function(e) {
  102. var r = nbi();
  103. return this.bitwiseTo(e, op_and, r), r;
  104. }, BigInteger.prototype.or = function(e) {
  105. var r = nbi();
  106. return this.bitwiseTo(e, op_or, r), r;
  107. }, BigInteger.prototype.xor = function(e) {
  108. var r = nbi();
  109. return this.bitwiseTo(e, op_xor, r), r;
  110. }, BigInteger.prototype.andNot = function(e) {
  111. var r = nbi();
  112. return this.bitwiseTo(e, op_andnot, r), r;
  113. }, BigInteger.prototype.not = function() {
  114. for (var e = nbi(), r = 0; r < this.t; ++r) e[r] = this.DM & ~this[r];
  115. return e.t = this.t, e.s = ~this.s, e;
  116. }, BigInteger.prototype.shiftLeft = function(e) {
  117. var r = nbi();
  118. return e < 0 ? this.rShiftTo(-e, r) : this.lShiftTo(e, r), r;
  119. }, BigInteger.prototype.shiftRight = function(e) {
  120. var r = nbi();
  121. return e < 0 ? this.lShiftTo(-e, r) : this.rShiftTo(e, r), r;
  122. }, BigInteger.prototype.getLowestSetBit = function() {
  123. for (var e = 0; e < this.t; ++e) if (0 != this[e]) return e * this.DB + lbit(this[e]);
  124. return this.s < 0 ? this.t * this.DB : -1;
  125. }, BigInteger.prototype.bitCount = function() {
  126. for (var e = 0, r = this.s & this.DM, i = 0; i < this.t; ++i) e += cbit(this[i] ^ r);
  127. return e;
  128. }, BigInteger.prototype.testBit = function(e) {
  129. var r = Math.floor(e / this.DB);
  130. return r >= this.t ? 0 != this.s : 0 != (this[r] & 1 << e % this.DB);
  131. }, BigInteger.prototype.setBit = function(e) {
  132. return this.changeBit(e, op_or);
  133. }, BigInteger.prototype.clearBit = function(e) {
  134. return this.changeBit(e, op_andnot);
  135. }, BigInteger.prototype.flipBit = function(e) {
  136. return this.changeBit(e, op_xor);
  137. }, BigInteger.prototype.add = function(e) {
  138. var r = nbi();
  139. return this.addTo(e, r), r;
  140. }, BigInteger.prototype.subtract = function(e) {
  141. var r = nbi();
  142. return this.subTo(e, r), r;
  143. }, BigInteger.prototype.multiply = function(e) {
  144. var r = nbi();
  145. return this.multiplyTo(e, r), r;
  146. }, BigInteger.prototype.divide = function(e) {
  147. var r = nbi();
  148. return this.divRemTo(e, r, null), r;
  149. }, BigInteger.prototype.remainder = function(e) {
  150. var r = nbi();
  151. return this.divRemTo(e, null, r), r;
  152. }, BigInteger.prototype.divideAndRemainder = function(e) {
  153. var r = nbi(), i = nbi();
  154. return this.divRemTo(e, r, i), [ r, i ];
  155. }, BigInteger.prototype.modPow = function(e, r) {
  156. var i, n, o = e.bitLength(), s = nbv(1);
  157. if (o <= 0) return s;
  158. i = o < 18 ? 1 : o < 48 ? 3 : o < 144 ? 4 : o < 768 ? 5 : 6, n = o < 8 ? new Classic(r) : r.isEven() ? new Barrett(r) : new Montgomery(r);
  159. var a = [], u = 3, l = i - 1, f = (1 << i) - 1;
  160. if (a[1] = n.convert(this), i > 1) {
  161. var h = nbi();
  162. for (n.sqrTo(a[1], h); u <= f; ) a[u] = nbi(), n.mulTo(h, a[u - 2], a[u]), u += 2;
  163. }
  164. var p, c, d = e.t - 1, g = !0, m = nbi();
  165. for (o = nbits(e[d]) - 1; d >= 0; ) {
  166. for (o >= l ? p = e[d] >> o - l & f : (p = (e[d] & (1 << o + 1) - 1) << l - o, d > 0 && (p |= e[d - 1] >> this.DB + o - l)),
  167. u = i; 0 == (1 & p); ) p >>= 1, --u;
  168. if ((o -= u) < 0 && (o += this.DB, --d), g) a[p].copyTo(s), g = !1; else {
  169. for (;u > 1; ) n.sqrTo(s, m), n.sqrTo(m, s), u -= 2;
  170. u > 0 ? n.sqrTo(s, m) : (c = s, s = m, m = c), n.mulTo(m, a[p], s);
  171. }
  172. for (;d >= 0 && 0 == (e[d] & 1 << o); ) n.sqrTo(s, m), c = s, s = m, m = c, --o < 0 && (o = this.DB - 1,
  173. --d);
  174. }
  175. return n.revert(s);
  176. }, BigInteger.prototype.modInverse = function(e) {
  177. var r = e.isEven();
  178. if (this.isEven() && r || 0 == e.signum()) return BigInteger.ZERO;
  179. for (var i = e.clone(), n = this.clone(), o = nbv(1), s = nbv(0), a = nbv(0), u = nbv(1); 0 != i.signum(); ) {
  180. for (;i.isEven(); ) i.rShiftTo(1, i), r ? (o.isEven() && s.isEven() || (o.addTo(this, o),
  181. s.subTo(e, s)), o.rShiftTo(1, o)) : s.isEven() || s.subTo(e, s), s.rShiftTo(1, s);
  182. for (;n.isEven(); ) n.rShiftTo(1, n), r ? (a.isEven() && u.isEven() || (a.addTo(this, a),
  183. u.subTo(e, u)), a.rShiftTo(1, a)) : u.isEven() || u.subTo(e, u), u.rShiftTo(1, u);
  184. i.compareTo(n) >= 0 ? (i.subTo(n, i), r && o.subTo(a, o), s.subTo(u, s)) : (n.subTo(i, n),
  185. r && a.subTo(o, a), u.subTo(s, u));
  186. }
  187. return 0 != n.compareTo(BigInteger.ONE) ? BigInteger.ZERO : u.compareTo(e) >= 0 ? u.subtract(e) : u.signum() < 0 ? (u.addTo(e, u),
  188. u.signum() < 0 ? u.add(e) : u) : u;
  189. }, BigInteger.prototype.pow = function(e) {
  190. return this.exp(e, new NullExp);
  191. }, BigInteger.prototype.gcd = function(e) {
  192. var r = this.s < 0 ? this.negate() : this.clone(), i = e.s < 0 ? e.negate() : e.clone();
  193. if (r.compareTo(i) < 0) {
  194. var n = r;
  195. r = i, i = n;
  196. }
  197. var o = r.getLowestSetBit(), s = i.getLowestSetBit();
  198. if (s < 0) return r;
  199. for (o < s && (s = o), s > 0 && (r.rShiftTo(s, r), i.rShiftTo(s, i)); r.signum() > 0; ) (o = r.getLowestSetBit()) > 0 && r.rShiftTo(o, r),
  200. (o = i.getLowestSetBit()) > 0 && i.rShiftTo(o, i), r.compareTo(i) >= 0 ? (r.subTo(i, r),
  201. r.rShiftTo(1, r)) : (i.subTo(r, i), i.rShiftTo(1, i));
  202. return s > 0 && i.lShiftTo(s, i), i;
  203. }, BigInteger.prototype.isProbablePrime = function(e) {
  204. var r, i = this.abs();
  205. if (1 == i.t && i[0] <= lowprimes[lowprimes.length - 1]) {
  206. for (r = 0; r < lowprimes.length; ++r) if (i[0] == lowprimes[r]) return !0;
  207. return !1;
  208. }
  209. if (i.isEven()) return !1;
  210. for (r = 1; r < lowprimes.length; ) {
  211. for (var n = lowprimes[r], o = r + 1; o < lowprimes.length && n < lplim; ) n *= lowprimes[o++];
  212. for (n = i.modInt(n); r < o; ) if (n % lowprimes[r++] == 0) return !1;
  213. }
  214. return i.millerRabin(e);
  215. }, BigInteger.prototype.copyTo = function(e) {
  216. for (var r = this.t - 1; r >= 0; --r) e[r] = this[r];
  217. e.t = this.t, e.s = this.s;
  218. }, BigInteger.prototype.fromInt = function(e) {
  219. this.t = 1, this.s = e < 0 ? -1 : 0, e > 0 ? this[0] = e : e < -1 ? this[0] = e + this.DV : this.t = 0;
  220. }, BigInteger.prototype.fromString = function(e, r) {
  221. var i;
  222. if (16 == r) i = 4; else if (8 == r) i = 3; else if (256 == r) i = 8; else if (2 == r) i = 1; else if (32 == r) i = 5; else {
  223. if (4 != r) return void this.fromRadix(e, r);
  224. i = 2;
  225. }
  226. this.t = 0, this.s = 0;
  227. for (var n = e.length, o = !1, s = 0; --n >= 0; ) {
  228. var a = 8 == i ? 255 & +e[n] : intAt(e, n);
  229. a < 0 ? "-" == e.charAt(n) && (o = !0) : (o = !1, 0 == s ? this[this.t++] = a : s + i > this.DB ? (this[this.t - 1] |= (a & (1 << this.DB - s) - 1) << s,
  230. this[this.t++] = a >> this.DB - s) : this[this.t - 1] |= a << s, (s += i) >= this.DB && (s -= this.DB));
  231. }
  232. 8 == i && 0 != (128 & +e[0]) && (this.s = -1, s > 0 && (this[this.t - 1] |= (1 << this.DB - s) - 1 << s)),
  233. this.clamp(), o && BigInteger.ZERO.subTo(this, this);
  234. }, BigInteger.prototype.clamp = function() {
  235. for (var e = this.s & this.DM; this.t > 0 && this[this.t - 1] == e; ) --this.t;
  236. }, BigInteger.prototype.dlShiftTo = function(e, r) {
  237. var i;
  238. for (i = this.t - 1; i >= 0; --i) r[i + e] = this[i];
  239. for (i = e - 1; i >= 0; --i) r[i] = 0;
  240. r.t = this.t + e, r.s = this.s;
  241. }, BigInteger.prototype.drShiftTo = function(e, r) {
  242. for (var i = e; i < this.t; ++i) r[i - e] = this[i];
  243. r.t = Math.max(this.t - e, 0), r.s = this.s;
  244. }, BigInteger.prototype.lShiftTo = function(e, r) {
  245. for (var i = e % this.DB, n = this.DB - i, o = (1 << n) - 1, s = Math.floor(e / this.DB), a = this.s << i & this.DM, u = this.t - 1; u >= 0; --u) r[u + s + 1] = this[u] >> n | a,
  246. a = (this[u] & o) << i;
  247. for (u = s - 1; u >= 0; --u) r[u] = 0;
  248. r[s] = a, r.t = this.t + s + 1, r.s = this.s, r.clamp();
  249. }, BigInteger.prototype.rShiftTo = function(e, r) {
  250. r.s = this.s;
  251. var i = Math.floor(e / this.DB);
  252. if (i >= this.t) r.t = 0; else {
  253. var n = e % this.DB, o = this.DB - n, s = (1 << n) - 1;
  254. r[0] = this[i] >> n;
  255. for (var a = i + 1; a < this.t; ++a) r[a - i - 1] |= (this[a] & s) << o, r[a - i] = this[a] >> n;
  256. n > 0 && (r[this.t - i - 1] |= (this.s & s) << o), r.t = this.t - i, r.clamp();
  257. }
  258. }, BigInteger.prototype.subTo = function(e, r) {
  259. for (var i = 0, n = 0, o = Math.min(e.t, this.t); i < o; ) n += this[i] - e[i],
  260. r[i++] = n & this.DM, n >>= this.DB;
  261. if (e.t < this.t) {
  262. for (n -= e.s; i < this.t; ) n += this[i], r[i++] = n & this.DM, n >>= this.DB;
  263. n += this.s;
  264. } else {
  265. for (n += this.s; i < e.t; ) n -= e[i], r[i++] = n & this.DM, n >>= this.DB;
  266. n -= e.s;
  267. }
  268. r.s = n < 0 ? -1 : 0, n < -1 ? r[i++] = this.DV + n : n > 0 && (r[i++] = n), r.t = i,
  269. r.clamp();
  270. }, BigInteger.prototype.multiplyTo = function(e, r) {
  271. var i = this.abs(), n = e.abs(), o = i.t;
  272. for (r.t = o + n.t; --o >= 0; ) r[o] = 0;
  273. for (o = 0; o < n.t; ++o) r[o + i.t] = i.am(0, n[o], r, o, 0, i.t);
  274. r.s = 0, r.clamp(), this.s != e.s && BigInteger.ZERO.subTo(r, r);
  275. }, BigInteger.prototype.squareTo = function(e) {
  276. for (var r = this.abs(), i = e.t = 2 * r.t; --i >= 0; ) e[i] = 0;
  277. for (i = 0; i < r.t - 1; ++i) {
  278. var n = r.am(i, r[i], e, 2 * i, 0, 1);
  279. (e[i + r.t] += r.am(i + 1, 2 * r[i], e, 2 * i + 1, n, r.t - i - 1)) >= r.DV && (e[i + r.t] -= r.DV,
  280. e[i + r.t + 1] = 1);
  281. }
  282. e.t > 0 && (e[e.t - 1] += r.am(i, r[i], e, 2 * i, 0, 1)), e.s = 0, e.clamp();
  283. }, BigInteger.prototype.divRemTo = function(e, r, i) {
  284. var n = e.abs();
  285. if (!(n.t <= 0)) {
  286. var o = this.abs();
  287. if (o.t < n.t) return null != r && r.fromInt(0), void (null != i && this.copyTo(i));
  288. null == i && (i = nbi());
  289. var s = nbi(), a = this.s, u = e.s, l = this.DB - nbits(n[n.t - 1]);
  290. l > 0 ? (n.lShiftTo(l, s), o.lShiftTo(l, i)) : (n.copyTo(s), o.copyTo(i));
  291. var f = s.t, h = s[f - 1];
  292. if (0 != h) {
  293. var p = h * (1 << this.F1) + (f > 1 ? s[f - 2] >> this.F2 : 0), c = this.FV / p, d = (1 << this.F1) / p, g = 1 << this.F2, m = i.t, y = m - f, v = null == r ? nbi() : r;
  294. for (s.dlShiftTo(y, v), i.compareTo(v) >= 0 && (i[i.t++] = 1, i.subTo(v, i)), BigInteger.ONE.dlShiftTo(f, v),
  295. v.subTo(s, s); s.t < f; ) s[s.t++] = 0;
  296. for (;--y >= 0; ) {
  297. var b = i[--m] == h ? this.DM : Math.floor(i[m] * c + (i[m - 1] + g) * d);
  298. if ((i[m] += s.am(0, b, i, y, 0, f)) < b) for (s.dlShiftTo(y, v), i.subTo(v, i); i[m] < --b; ) i.subTo(v, i);
  299. }
  300. null != r && (i.drShiftTo(f, r), a != u && BigInteger.ZERO.subTo(r, r)), i.t = f,
  301. i.clamp(), l > 0 && i.rShiftTo(l, i), a < 0 && BigInteger.ZERO.subTo(i, i);
  302. }
  303. }
  304. }, BigInteger.prototype.invDigit = function() {
  305. if (this.t < 1) return 0;
  306. var e = this[0];
  307. if (0 == (1 & e)) return 0;
  308. var r = 3 & e;
  309. return (r = (r = (r = (r = r * (2 - (15 & e) * r) & 15) * (2 - (255 & e) * r) & 255) * (2 - ((65535 & e) * r & 65535)) & 65535) * (2 - e * r % this.DV) % this.DV) > 0 ? this.DV - r : -r;
  310. }, BigInteger.prototype.isEven = function() {
  311. return 0 == (this.t > 0 ? 1 & this[0] : this.s);
  312. }, BigInteger.prototype.exp = function(e, r) {
  313. if (e > 4294967295 || e < 1) return BigInteger.ONE;
  314. var i = nbi(), n = nbi(), o = r.convert(this), s = nbits(e) - 1;
  315. for (o.copyTo(i); --s >= 0; ) if (r.sqrTo(i, n), (e & 1 << s) > 0) r.mulTo(n, o, i); else {
  316. var a = i;
  317. i = n, n = a;
  318. }
  319. return r.revert(i);
  320. }, BigInteger.prototype.chunkSize = function(e) {
  321. return Math.floor(Math.LN2 * this.DB / Math.log(e));
  322. }, BigInteger.prototype.toRadix = function(e) {
  323. if (null == e && (e = 10), 0 == this.signum() || e < 2 || e > 36) return "0";
  324. var r = this.chunkSize(e), i = Math.pow(e, r), n = nbv(i), o = nbi(), s = nbi(), a = "";
  325. for (this.divRemTo(n, o, s); o.signum() > 0; ) a = (i + s.intValue()).toString(e).substr(1) + a,
  326. o.divRemTo(n, o, s);
  327. return s.intValue().toString(e) + a;
  328. }, BigInteger.prototype.fromRadix = function(e, r) {
  329. this.fromInt(0), null == r && (r = 10);
  330. for (var i = this.chunkSize(r), n = Math.pow(r, i), o = !1, s = 0, a = 0, u = 0; u < e.length; ++u) {
  331. var l = intAt(e, u);
  332. l < 0 ? "-" == e.charAt(u) && 0 == this.signum() && (o = !0) : (a = r * a + l, ++s >= i && (this.dMultiply(n),
  333. this.dAddOffset(a, 0), s = 0, a = 0));
  334. }
  335. s > 0 && (this.dMultiply(Math.pow(r, s)), this.dAddOffset(a, 0)), o && BigInteger.ZERO.subTo(this, this);
  336. }, BigInteger.prototype.fromNumber = function(e, r, i) {
  337. if ("number" == typeof r) if (e < 2) this.fromInt(1); else for (this.fromNumber(e, i),
  338. this.testBit(e - 1) || this.bitwiseTo(BigInteger.ONE.shiftLeft(e - 1), op_or, this),
  339. this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(r); ) this.dAddOffset(2, 0),
  340. this.bitLength() > e && this.subTo(BigInteger.ONE.shiftLeft(e - 1), this); else {
  341. var n = [], o = 7 & e;
  342. n.length = 1 + (e >> 3), r.nextBytes(n), o > 0 ? n[0] &= (1 << o) - 1 : n[0] = 0,
  343. this.fromString(n, 256);
  344. }
  345. }, BigInteger.prototype.bitwiseTo = function(e, r, i) {
  346. var n, o, s = Math.min(e.t, this.t);
  347. for (n = 0; n < s; ++n) i[n] = r(this[n], e[n]);
  348. if (e.t < this.t) {
  349. for (o = e.s & this.DM, n = s; n < this.t; ++n) i[n] = r(this[n], o);
  350. i.t = this.t;
  351. } else {
  352. for (o = this.s & this.DM, n = s; n < e.t; ++n) i[n] = r(o, e[n]);
  353. i.t = e.t;
  354. }
  355. i.s = r(this.s, e.s), i.clamp();
  356. }, BigInteger.prototype.changeBit = function(e, r) {
  357. var i = BigInteger.ONE.shiftLeft(e);
  358. return this.bitwiseTo(i, r, i), i;
  359. }, BigInteger.prototype.addTo = function(e, r) {
  360. for (var i = 0, n = 0, o = Math.min(e.t, this.t); i < o; ) n += this[i] + e[i],
  361. r[i++] = n & this.DM, n >>= this.DB;
  362. if (e.t < this.t) {
  363. for (n += e.s; i < this.t; ) n += this[i], r[i++] = n & this.DM, n >>= this.DB;
  364. n += this.s;
  365. } else {
  366. for (n += this.s; i < e.t; ) n += e[i], r[i++] = n & this.DM, n >>= this.DB;
  367. n += e.s;
  368. }
  369. r.s = n < 0 ? -1 : 0, n > 0 ? r[i++] = n : n < -1 && (r[i++] = this.DV + n), r.t = i,
  370. r.clamp();
  371. }, BigInteger.prototype.dMultiply = function(e) {
  372. this[this.t] = this.am(0, e - 1, this, 0, 0, this.t), ++this.t, this.clamp();
  373. }, BigInteger.prototype.dAddOffset = function(e, r) {
  374. if (0 != e) {
  375. for (;this.t <= r; ) this[this.t++] = 0;
  376. for (this[r] += e; this[r] >= this.DV; ) this[r] -= this.DV, ++r >= this.t && (this[this.t++] = 0),
  377. ++this[r];
  378. }
  379. }, BigInteger.prototype.multiplyLowerTo = function(e, r, i) {
  380. var n = Math.min(this.t + e.t, r);
  381. for (i.s = 0, i.t = n; n > 0; ) i[--n] = 0;
  382. for (var o = i.t - this.t; n < o; ++n) i[n + this.t] = this.am(0, e[n], i, n, 0, this.t);
  383. for (o = Math.min(e.t, r); n < o; ++n) this.am(0, e[n], i, n, 0, r - n);
  384. i.clamp();
  385. }, BigInteger.prototype.multiplyUpperTo = function(e, r, i) {
  386. --r;
  387. var n = i.t = this.t + e.t - r;
  388. for (i.s = 0; --n >= 0; ) i[n] = 0;
  389. for (n = Math.max(r - this.t, 0); n < e.t; ++n) i[this.t + n - r] = this.am(r - n, e[n], i, 0, 0, this.t + n - r);
  390. i.clamp(), i.drShiftTo(1, i);
  391. }, BigInteger.prototype.modInt = function(e) {
  392. if (e <= 0) return 0;
  393. var r = this.DV % e, i = this.s < 0 ? e - 1 : 0;
  394. if (this.t > 0) if (0 == r) i = this[0] % e; else for (var n = this.t - 1; n >= 0; --n) i = (r * i + this[n]) % e;
  395. return i;
  396. }, BigInteger.prototype.millerRabin = function(e) {
  397. var r = this.subtract(BigInteger.ONE), i = r.getLowestSetBit();
  398. if (i <= 0) return !1;
  399. var n = r.shiftRight(i);
  400. (e = e + 1 >> 1) > lowprimes.length && (e = lowprimes.length);
  401. for (var o = nbi(), s = 0; s < e; ++s) {
  402. o.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);
  403. var a = o.modPow(n, this);
  404. if (0 != a.compareTo(BigInteger.ONE) && 0 != a.compareTo(r)) {
  405. for (var u = 1; u++ < i && 0 != a.compareTo(r); ) if (0 == (a = a.modPowInt(2, this)).compareTo(BigInteger.ONE)) return !1;
  406. if (0 != a.compareTo(r)) return !1;
  407. }
  408. }
  409. return !0;
  410. }, BigInteger.prototype.square = function() {
  411. var e = nbi();
  412. return this.squareTo(e), e;
  413. }, BigInteger.prototype.gcda = function(e, r) {
  414. var i = this.s < 0 ? this.negate() : this.clone(), n = e.s < 0 ? e.negate() : e.clone();
  415. if (i.compareTo(n) < 0) {
  416. var o = i;
  417. i = n, n = o;
  418. }
  419. var s = i.getLowestSetBit(), a = n.getLowestSetBit();
  420. if (a < 0) r(i); else {
  421. s < a && (a = s), a > 0 && (i.rShiftTo(a, i), n.rShiftTo(a, n));
  422. var gcda1 = function() {
  423. (s = i.getLowestSetBit()) > 0 && i.rShiftTo(s, i), (s = n.getLowestSetBit()) > 0 && n.rShiftTo(s, n),
  424. i.compareTo(n) >= 0 ? (i.subTo(n, i), i.rShiftTo(1, i)) : (n.subTo(i, n), n.rShiftTo(1, n)),
  425. i.signum() > 0 ? setTimeout(gcda1, 0) : (a > 0 && n.lShiftTo(a, n), setTimeout((function() {
  426. r(n);
  427. }), 0));
  428. };
  429. setTimeout(gcda1, 10);
  430. }
  431. }, BigInteger.prototype.fromNumberAsync = function(e, r, i, n) {
  432. if ("number" == typeof r) if (e < 2) this.fromInt(1); else {
  433. this.fromNumber(e, i), this.testBit(e - 1) || this.bitwiseTo(BigInteger.ONE.shiftLeft(e - 1), op_or, this),
  434. this.isEven() && this.dAddOffset(1, 0);
  435. var o = this, bnpfn1_1 = function() {
  436. o.dAddOffset(2, 0), o.bitLength() > e && o.subTo(BigInteger.ONE.shiftLeft(e - 1), o),
  437. o.isProbablePrime(r) ? setTimeout((function() {
  438. n();
  439. }), 0) : setTimeout(bnpfn1_1, 0);
  440. };
  441. setTimeout(bnpfn1_1, 0);
  442. } else {
  443. var s = [], a = 7 & e;
  444. s.length = 1 + (e >> 3), r.nextBytes(s), a > 0 ? s[0] &= (1 << a) - 1 : s[0] = 0,
  445. this.fromString(s, 256);
  446. }
  447. }, BigInteger;
  448. }(), NullExp = function() {
  449. function NullExp() {}
  450. return NullExp.prototype.convert = function(e) {
  451. return e;
  452. }, NullExp.prototype.revert = function(e) {
  453. return e;
  454. }, NullExp.prototype.mulTo = function(e, r, i) {
  455. e.multiplyTo(r, i);
  456. }, NullExp.prototype.sqrTo = function(e, r) {
  457. e.squareTo(r);
  458. }, NullExp;
  459. }(), Classic = function() {
  460. function Classic(e) {
  461. this.m = e;
  462. }
  463. return Classic.prototype.convert = function(e) {
  464. return e.s < 0 || e.compareTo(this.m) >= 0 ? e.mod(this.m) : e;
  465. }, Classic.prototype.revert = function(e) {
  466. return e;
  467. }, Classic.prototype.reduce = function(e) {
  468. e.divRemTo(this.m, null, e);
  469. }, Classic.prototype.mulTo = function(e, r, i) {
  470. e.multiplyTo(r, i), this.reduce(i);
  471. }, Classic.prototype.sqrTo = function(e, r) {
  472. e.squareTo(r), this.reduce(r);
  473. }, Classic;
  474. }(), Montgomery = function() {
  475. function Montgomery(e) {
  476. this.m = e, this.mp = e.invDigit(), this.mpl = 32767 & this.mp, this.mph = this.mp >> 15,
  477. this.um = (1 << e.DB - 15) - 1, this.mt2 = 2 * e.t;
  478. }
  479. return Montgomery.prototype.convert = function(e) {
  480. var r = nbi();
  481. return e.abs().dlShiftTo(this.m.t, r), r.divRemTo(this.m, null, r), e.s < 0 && r.compareTo(BigInteger.ZERO) > 0 && this.m.subTo(r, r),
  482. r;
  483. }, Montgomery.prototype.revert = function(e) {
  484. var r = nbi();
  485. return e.copyTo(r), this.reduce(r), r;
  486. }, Montgomery.prototype.reduce = function(e) {
  487. for (;e.t <= this.mt2; ) e[e.t++] = 0;
  488. for (var r = 0; r < this.m.t; ++r) {
  489. var i = 32767 & e[r], n = i * this.mpl + ((i * this.mph + (e[r] >> 15) * this.mpl & this.um) << 15) & e.DM;
  490. for (e[i = r + this.m.t] += this.m.am(0, n, e, r, 0, this.m.t); e[i] >= e.DV; ) e[i] -= e.DV,
  491. e[++i]++;
  492. }
  493. e.clamp(), e.drShiftTo(this.m.t, e), e.compareTo(this.m) >= 0 && e.subTo(this.m, e);
  494. }, Montgomery.prototype.mulTo = function(e, r, i) {
  495. e.multiplyTo(r, i), this.reduce(i);
  496. }, Montgomery.prototype.sqrTo = function(e, r) {
  497. e.squareTo(r), this.reduce(r);
  498. }, Montgomery;
  499. }(), Barrett = function() {
  500. function Barrett(e) {
  501. this.m = e, this.r2 = nbi(), this.q3 = nbi(), BigInteger.ONE.dlShiftTo(2 * e.t, this.r2),
  502. this.mu = this.r2.divide(e);
  503. }
  504. return Barrett.prototype.convert = function(e) {
  505. if (e.s < 0 || e.t > 2 * this.m.t) return e.mod(this.m);
  506. if (e.compareTo(this.m) < 0) return e;
  507. var r = nbi();
  508. return e.copyTo(r), this.reduce(r), r;
  509. }, Barrett.prototype.revert = function(e) {
  510. return e;
  511. }, Barrett.prototype.reduce = function(e) {
  512. for (e.drShiftTo(this.m.t - 1, this.r2), e.t > this.m.t + 1 && (e.t = this.m.t + 1,
  513. e.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); e.compareTo(this.r2) < 0; ) e.dAddOffset(1, this.m.t + 1);
  514. for (e.subTo(this.r2, e); e.compareTo(this.m) >= 0; ) e.subTo(this.m, e);
  515. }, Barrett.prototype.mulTo = function(e, r, i) {
  516. e.multiplyTo(r, i), this.reduce(i);
  517. }, Barrett.prototype.sqrTo = function(e, r) {
  518. e.squareTo(r), this.reduce(r);
  519. }, Barrett;
  520. }();
  521. function nbi() {
  522. return new BigInteger(null);
  523. }
  524. function parseBigInt(e, r) {
  525. return new BigInteger(e, r);
  526. }
  527. var inBrowser = "undefined" != typeof navigator;
  528. inBrowser && j_lm && "Microsoft Internet Explorer" == navigator.appName ? (BigInteger.prototype.am = function am2(e, r, i, n, o, s) {
  529. for (var a = 32767 & r, u = r >> 15; --s >= 0; ) {
  530. var l = 32767 & this[e], f = this[e++] >> 15, h = u * l + f * a;
  531. o = ((l = a * l + ((32767 & h) << 15) + i[n] + (1073741823 & o)) >>> 30) + (h >>> 15) + u * f + (o >>> 30),
  532. i[n++] = 1073741823 & l;
  533. }
  534. return o;
  535. }, dbits = 30) : inBrowser && j_lm && "Netscape" != navigator.appName ? (BigInteger.prototype.am = function am1(e, r, i, n, o, s) {
  536. for (;--s >= 0; ) {
  537. var a = r * this[e++] + i[n] + o;
  538. o = Math.floor(a / 67108864), i[n++] = 67108863 & a;
  539. }
  540. return o;
  541. }, dbits = 26) : (BigInteger.prototype.am = function am3(e, r, i, n, o, s) {
  542. for (var a = 16383 & r, u = r >> 14; --s >= 0; ) {
  543. var l = 16383 & this[e], f = this[e++] >> 14, h = u * l + f * a;
  544. o = ((l = a * l + ((16383 & h) << 14) + i[n] + o) >> 28) + (h >> 14) + u * f, i[n++] = 268435455 & l;
  545. }
  546. return o;
  547. }, dbits = 28), BigInteger.prototype.DB = dbits, BigInteger.prototype.DM = (1 << dbits) - 1,
  548. BigInteger.prototype.DV = 1 << dbits;
  549. var BI_FP = 52;
  550. BigInteger.prototype.FV = Math.pow(2, BI_FP), BigInteger.prototype.F1 = BI_FP - dbits,
  551. BigInteger.prototype.F2 = 2 * dbits - BI_FP;
  552. var BI_RC = [], rr, vv;
  553. for (rr = "0".charCodeAt(0), vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
  554. for (rr = "a".charCodeAt(0), vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
  555. for (rr = "A".charCodeAt(0), vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
  556. function intAt(e, r) {
  557. var i = BI_RC[e.charCodeAt(r)];
  558. return null == i ? -1 : i;
  559. }
  560. function nbv(e) {
  561. var r = nbi();
  562. return r.fromInt(e), r;
  563. }
  564. function nbits(e) {
  565. var r, i = 1;
  566. return 0 != (r = e >>> 16) && (e = r, i += 16), 0 != (r = e >> 8) && (e = r, i += 8),
  567. 0 != (r = e >> 4) && (e = r, i += 4), 0 != (r = e >> 2) && (e = r, i += 2), 0 != (r = e >> 1) && (e = r,
  568. i += 1), i;
  569. }
  570. BigInteger.ZERO = nbv(0), BigInteger.ONE = nbv(1);
  571. var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", b64pad = "=", decoder$1;
  572. function hex2b64(e) {
  573. var r, i, n = "";
  574. for (r = 0; r + 3 <= e.length; r += 3) i = parseInt(e.substring(r, r + 3), 16),
  575. n += b64map.charAt(i >> 6) + b64map.charAt(63 & i);
  576. for (r + 1 == e.length ? (i = parseInt(e.substring(r, r + 1), 16), n += b64map.charAt(i << 2)) : r + 2 == e.length && (i = parseInt(e.substring(r, r + 2), 16),
  577. n += b64map.charAt(i >> 2) + b64map.charAt((3 & i) << 4)); (3 & n.length) > 0; ) n += b64pad;
  578. return n;
  579. }
  580. function b64tohex(e) {
  581. var r, i = "", n = 0, o = 0;
  582. for (r = 0; r < e.length && e.charAt(r) != b64pad; ++r) {
  583. var s = b64map.indexOf(e.charAt(r));
  584. s < 0 || (0 == n ? (i += int2char(s >> 2), o = 3 & s, n = 1) : 1 == n ? (i += int2char(o << 2 | s >> 4),
  585. o = 15 & s, n = 2) : 2 == n ? (i += int2char(o), i += int2char(s >> 2), o = 3 & s,
  586. n = 3) : (i += int2char(o << 2 | s >> 4), i += int2char(15 & s), n = 0));
  587. }
  588. return 1 == n && (i += int2char(o << 2)), i;
  589. }
  590. var Hex = {
  591. decode: function(e) {
  592. var r;
  593. if (void 0 === decoder$1) {
  594. var i = "0123456789ABCDEF", n = " \f\n\r\t \u2028\u2029";
  595. for (decoder$1 = {}, r = 0; r < 16; ++r) decoder$1[i.charAt(r)] = r;
  596. for (i = i.toLowerCase(), r = 10; r < 16; ++r) decoder$1[i.charAt(r)] = r;
  597. for (r = 0; r < 8; ++r) decoder$1[n.charAt(r)] = -1;
  598. }
  599. var o = [], s = 0, a = 0;
  600. for (r = 0; r < e.length; ++r) {
  601. var u = e.charAt(r);
  602. if ("=" == u) break;
  603. if (-1 != (u = decoder$1[u])) {
  604. if (void 0 === u) throw new Error("Illegal character at offset " + r);
  605. s |= u, ++a >= 2 ? (o[o.length] = s, s = 0, a = 0) : s <<= 4;
  606. }
  607. }
  608. if (a) throw new Error("Hex encoding incomplete: 4 bits missing");
  609. return o;
  610. }
  611. }, decoder, Base64 = {
  612. decode: function(e) {
  613. var r;
  614. if (void 0 === decoder) {
  615. var i = "= \f\n\r\t \u2028\u2029";
  616. for (decoder = Object.create(null), r = 0; r < 64; ++r) decoder["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r)] = r;
  617. for (decoder["-"] = 62, decoder._ = 63, r = 0; r < 9; ++r) decoder[i.charAt(r)] = -1;
  618. }
  619. var n = [], o = 0, s = 0;
  620. for (r = 0; r < e.length; ++r) {
  621. var a = e.charAt(r);
  622. if ("=" == a) break;
  623. if (-1 != (a = decoder[a])) {
  624. if (void 0 === a) throw new Error("Illegal character at offset " + r);
  625. o |= a, ++s >= 4 ? (n[n.length] = o >> 16, n[n.length] = o >> 8 & 255, n[n.length] = 255 & o,
  626. o = 0, s = 0) : o <<= 6;
  627. }
  628. }
  629. switch (s) {
  630. case 1:
  631. throw new Error("Base64 encoding incomplete: at least 2 bits missing");
  632. case 2:
  633. n[n.length] = o >> 10;
  634. break;
  635. case 3:
  636. n[n.length] = o >> 16, n[n.length] = o >> 8 & 255;
  637. }
  638. return n;
  639. },
  640. re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
  641. unarmor: function(e) {
  642. var r = Base64.re.exec(e);
  643. if (r) if (r[1]) e = r[1]; else {
  644. if (!r[2]) throw new Error("RegExp out of sync");
  645. e = r[2];
  646. }
  647. return Base64.decode(e);
  648. }
  649. }, max = 1e13, Int10 = function() {
  650. function Int10(e) {
  651. this.buf = [ +e || 0 ];
  652. }
  653. return Int10.prototype.mulAdd = function(e, r) {
  654. var i, n, o = this.buf, s = o.length;
  655. for (i = 0; i < s; ++i) (n = o[i] * e + r) < max ? r = 0 : n -= (r = 0 | n / max) * max,
  656. o[i] = n;
  657. r > 0 && (o[i] = r);
  658. }, Int10.prototype.sub = function(e) {
  659. var r, i, n = this.buf, o = n.length;
  660. for (r = 0; r < o; ++r) (i = n[r] - e) < 0 ? (i += max, e = 1) : e = 0, n[r] = i;
  661. for (;0 === n[n.length - 1]; ) n.pop();
  662. }, Int10.prototype.toString = function(e) {
  663. if (10 != (e || 10)) throw new Error("only base 10 is supported");
  664. for (var r = this.buf, i = r[r.length - 1].toString(), n = r.length - 2; n >= 0; --n) i += (max + r[n]).toString().substring(1);
  665. return i;
  666. }, Int10.prototype.valueOf = function() {
  667. for (var e = this.buf, r = 0, i = e.length - 1; i >= 0; --i) r = r * max + e[i];
  668. return r;
  669. }, Int10.prototype.simplify = function() {
  670. var e = this.buf;
  671. return 1 == e.length ? e[0] : this;
  672. }, Int10;
  673. }(), ellipsis = "…", reTimeS = /^(\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)?)?$/, reTimeL = /^(\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)?)?$/;
  674. function stringCut(e, r) {
  675. return e.length > r && (e = e.substring(0, r) + ellipsis), e;
  676. }
  677. var Stream = function() {
  678. function Stream(e, r) {
  679. this.hexDigits = "0123456789ABCDEF", e instanceof Stream ? (this.enc = e.enc, this.pos = e.pos) : (this.enc = e,
  680. this.pos = r);
  681. }
  682. return Stream.prototype.get = function(e) {
  683. if (void 0 === e && (e = this.pos++), e >= this.enc.length) throw new Error("Requesting byte offset ".concat(e, " on a stream of length ").concat(this.enc.length));
  684. return "string" == typeof this.enc ? this.enc.charCodeAt(e) : this.enc[e];
  685. }, Stream.prototype.hexByte = function(e) {
  686. return this.hexDigits.charAt(e >> 4 & 15) + this.hexDigits.charAt(15 & e);
  687. }, Stream.prototype.hexDump = function(e, r, i) {
  688. for (var n = "", o = e; o < r; ++o) if (n += this.hexByte(this.get(o)), !0 !== i) switch (15 & o) {
  689. case 7:
  690. n += " ";
  691. break;
  692. case 15:
  693. n += "\n";
  694. break;
  695. default:
  696. n += " ";
  697. }
  698. return n;
  699. }, Stream.prototype.isASCII = function(e, r) {
  700. for (var i = e; i < r; ++i) {
  701. var n = this.get(i);
  702. if (n < 32 || n > 176) return !1;
  703. }
  704. return !0;
  705. }, Stream.prototype.parseStringISO = function(e, r) {
  706. for (var i = "", n = e; n < r; ++n) i += String.fromCharCode(this.get(n));
  707. return i;
  708. }, Stream.prototype.parseStringUTF = function(e, r) {
  709. for (var i = "", n = e; n < r; ) {
  710. var o = this.get(n++);
  711. i += o < 128 ? String.fromCharCode(o) : o > 191 && o < 224 ? String.fromCharCode((31 & o) << 6 | 63 & this.get(n++)) : String.fromCharCode((15 & o) << 12 | (63 & this.get(n++)) << 6 | 63 & this.get(n++));
  712. }
  713. return i;
  714. }, Stream.prototype.parseStringBMP = function(e, r) {
  715. for (var i, n, o = "", s = e; s < r; ) i = this.get(s++), n = this.get(s++), o += String.fromCharCode(i << 8 | n);
  716. return o;
  717. }, Stream.prototype.parseTime = function(e, r, i) {
  718. var n = this.parseStringISO(e, r), o = (i ? reTimeS : reTimeL).exec(n);
  719. return o ? (i && (o[1] = +o[1], o[1] += +o[1] < 70 ? 2e3 : 1900), n = o[1] + "-" + o[2] + "-" + o[3] + " " + o[4],
  720. o[5] && (n += ":" + o[5], o[6] && (n += ":" + o[6], o[7] && (n += "." + o[7]))),
  721. o[8] && (n += " UTC", "Z" != o[8] && (n += o[8], o[9] && (n += ":" + o[9]))), n) : "Unrecognized time: " + n;
  722. }, Stream.prototype.parseInteger = function(e, r) {
  723. for (var i, n = this.get(e), o = n > 127, s = o ? 255 : 0, a = ""; n == s && ++e < r; ) n = this.get(e);
  724. if (0 === (i = r - e)) return o ? -1 : 0;
  725. if (i > 4) {
  726. for (a = n, i <<= 3; 0 == (128 & (+a ^ s)); ) a = +a << 1, --i;
  727. a = "(" + i + " bit)\n";
  728. }
  729. o && (n -= 256);
  730. for (var u = new Int10(n), l = e + 1; l < r; ++l) u.mulAdd(256, this.get(l));
  731. return a + u.toString();
  732. }, Stream.prototype.parseBitString = function(e, r, i) {
  733. for (var n = this.get(e), o = "(" + ((r - e - 1 << 3) - n) + " bit)\n", s = "", a = e + 1; a < r; ++a) {
  734. for (var u = this.get(a), l = a == r - 1 ? n : 0, f = 7; f >= l; --f) s += u >> f & 1 ? "1" : "0";
  735. if (s.length > i) return o + stringCut(s, i);
  736. }
  737. return o + s;
  738. }, Stream.prototype.parseOctetString = function(e, r, i) {
  739. if (this.isASCII(e, r)) return stringCut(this.parseStringISO(e, r), i);
  740. var n = r - e, o = "(" + n + " byte)\n";
  741. n > (i /= 2) && (r = e + i);
  742. for (var s = e; s < r; ++s) o += this.hexByte(this.get(s));
  743. return n > i && (o += ellipsis), o;
  744. }, Stream.prototype.parseOID = function(e, r, i) {
  745. for (var n = "", o = new Int10, s = 0, a = e; a < r; ++a) {
  746. var u = this.get(a);
  747. if (o.mulAdd(128, 127 & u), s += 7, !(128 & u)) {
  748. if ("" === n) if ((o = o.simplify()) instanceof Int10) o.sub(80), n = "2." + o.toString(); else {
  749. var l = o < 80 ? o < 40 ? 0 : 1 : 2;
  750. n = l + "." + (o - 40 * l);
  751. } else n += "." + o.toString();
  752. if (n.length > i) return stringCut(n, i);
  753. o = new Int10, s = 0;
  754. }
  755. }
  756. return s > 0 && (n += ".incomplete"), n;
  757. }, Stream;
  758. }(), ASN1 = function() {
  759. function ASN1(e, r, i, n, o) {
  760. if (!(n instanceof ASN1Tag)) throw new Error("Invalid tag value.");
  761. this.stream = e, this.header = r, this.length = i, this.tag = n, this.sub = o;
  762. }
  763. return ASN1.prototype.typeName = function() {
  764. switch (this.tag.tagClass) {
  765. case 0:
  766. switch (this.tag.tagNumber) {
  767. case 0:
  768. return "EOC";
  769. case 1:
  770. return "BOOLEAN";
  771. case 2:
  772. return "INTEGER";
  773. case 3:
  774. return "BIT_STRING";
  775. case 4:
  776. return "OCTET_STRING";
  777. case 5:
  778. return "NULL";
  779. case 6:
  780. return "OBJECT_IDENTIFIER";
  781. case 7:
  782. return "ObjectDescriptor";
  783. case 8:
  784. return "EXTERNAL";
  785. case 9:
  786. return "REAL";
  787. case 10:
  788. return "ENUMERATED";
  789. case 11:
  790. return "EMBEDDED_PDV";
  791. case 12:
  792. return "UTF8String";
  793. case 16:
  794. return "SEQUENCE";
  795. case 17:
  796. return "SET";
  797. case 18:
  798. return "NumericString";
  799. case 19:
  800. return "PrintableString";
  801. case 20:
  802. return "TeletexString";
  803. case 21:
  804. return "VideotexString";
  805. case 22:
  806. return "IA5String";
  807. case 23:
  808. return "UTCTime";
  809. case 24:
  810. return "GeneralizedTime";
  811. case 25:
  812. return "GraphicString";
  813. case 26:
  814. return "VisibleString";
  815. case 27:
  816. return "GeneralString";
  817. case 28:
  818. return "UniversalString";
  819. case 30:
  820. return "BMPString";
  821. }
  822. return "Universal_" + this.tag.tagNumber.toString();
  823. case 1:
  824. return "Application_" + this.tag.tagNumber.toString();
  825. case 2:
  826. return "[" + this.tag.tagNumber.toString() + "]";
  827. case 3:
  828. return "Private_" + this.tag.tagNumber.toString();
  829. }
  830. }, ASN1.prototype.content = function(e) {
  831. if (void 0 === this.tag) return null;
  832. void 0 === e && (e = 1 / 0);
  833. var r = this.posContent(), i = Math.abs(this.length);
  834. if (!this.tag.isUniversal()) return null !== this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(r, r + i, e);
  835. switch (this.tag.tagNumber) {
  836. case 1:
  837. return 0 === this.stream.get(r) ? "false" : "true";
  838. case 2:
  839. return this.stream.parseInteger(r, r + i);
  840. case 3:
  841. return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(r, r + i, e);
  842. case 4:
  843. return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(r, r + i, e);
  844. case 6:
  845. return this.stream.parseOID(r, r + i, e);
  846. case 16:
  847. case 17:
  848. return null !== this.sub ? "(" + this.sub.length + " elem)" : "(no elem)";
  849. case 12:
  850. return stringCut(this.stream.parseStringUTF(r, r + i), e);
  851. case 18:
  852. case 19:
  853. case 20:
  854. case 21:
  855. case 22:
  856. case 26:
  857. return stringCut(this.stream.parseStringISO(r, r + i), e);
  858. case 30:
  859. return stringCut(this.stream.parseStringBMP(r, r + i), e);
  860. case 23:
  861. case 24:
  862. return this.stream.parseTime(r, r + i, 23 == this.tag.tagNumber);
  863. }
  864. return null;
  865. }, ASN1.prototype.toString = function() {
  866. return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null" : this.sub.length) + "]";
  867. }, ASN1.prototype.toPrettyString = function(e) {
  868. void 0 === e && (e = "");
  869. var r = e + this.typeName() + " @" + this.stream.pos;
  870. if (this.length >= 0 && (r += "+"), r += this.length, this.tag.tagConstructed ? r += " (constructed)" : !this.tag.isUniversal() || 3 != this.tag.tagNumber && 4 != this.tag.tagNumber || null === this.sub || (r += " (encapsulates)"),
  871. r += "\n", null !== this.sub) {
  872. e += " ";
  873. for (var i = 0, n = this.sub.length; i < n; ++i) r += this.sub[i].toPrettyString(e);
  874. }
  875. return r;
  876. }, ASN1.prototype.posStart = function() {
  877. return this.stream.pos;
  878. }, ASN1.prototype.posContent = function() {
  879. return this.stream.pos + this.header;
  880. }, ASN1.prototype.posEnd = function() {
  881. return this.stream.pos + this.header + Math.abs(this.length);
  882. }, ASN1.prototype.toHexString = function() {
  883. return this.stream.hexDump(this.posStart(), this.posEnd(), !0);
  884. }, ASN1.decodeLength = function(e) {
  885. var r = e.get(), i = 127 & r;
  886. if (i == r) return i;
  887. if (i > 6) throw new Error("Length over 48 bits not supported at position " + (e.pos - 1));
  888. if (0 === i) return null;
  889. r = 0;
  890. for (var n = 0; n < i; ++n) r = 256 * r + e.get();
  891. return r;
  892. }, ASN1.prototype.getHexStringValue = function() {
  893. var e = this.toHexString(), r = 2 * this.header, i = 2 * this.length;
  894. return e.substr(r, i);
  895. }, ASN1.decode = function(e) {
  896. var r;
  897. r = e instanceof Stream ? e : new Stream(e, 0);
  898. var i = new Stream(r), n = new ASN1Tag(r), o = ASN1.decodeLength(r), s = r.pos, a = s - i.pos, u = null, getSub = function() {
  899. var e = [];
  900. if (null !== o) {
  901. for (var i = s + o; r.pos < i; ) e[e.length] = ASN1.decode(r);
  902. if (r.pos != i) throw new Error("Content size is not correct for container starting at offset " + s);
  903. } else try {
  904. for (;;) {
  905. var n = ASN1.decode(r);
  906. if (n.tag.isEOC()) break;
  907. e[e.length] = n;
  908. }
  909. o = s - r.pos;
  910. } catch (e) {
  911. throw new Error("Exception while decoding undefined length content: " + e);
  912. }
  913. return e;
  914. };
  915. if (n.tagConstructed) u = getSub(); else if (n.isUniversal() && (3 == n.tagNumber || 4 == n.tagNumber)) try {
  916. if (3 == n.tagNumber && 0 != r.get()) throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
  917. u = getSub();
  918. for (var l = 0; l < u.length; ++l) if (u[l].tag.isEOC()) throw new Error("EOC is not supposed to be actual content.");
  919. } catch (e) {
  920. u = null;
  921. }
  922. if (null === u) {
  923. if (null === o) throw new Error("We can't skip over an invalid tag with undefined length at offset " + s);
  924. r.pos = s + Math.abs(o);
  925. }
  926. return new ASN1(i, a, o, n, u);
  927. }, ASN1;
  928. }(), ASN1Tag = function() {
  929. function ASN1Tag(e) {
  930. var r = e.get();
  931. if (this.tagClass = r >> 6, this.tagConstructed = 0 != (32 & r), this.tagNumber = 31 & r,
  932. 31 == this.tagNumber) {
  933. var i = new Int10;
  934. do {
  935. r = e.get(), i.mulAdd(128, 127 & r);
  936. } while (128 & r);
  937. this.tagNumber = i.simplify();
  938. }
  939. }
  940. return ASN1Tag.prototype.isUniversal = function() {
  941. return 0 === this.tagClass;
  942. }, ASN1Tag.prototype.isEOC = function() {
  943. return 0 === this.tagClass && 0 === this.tagNumber;
  944. }, ASN1Tag;
  945. }(), Arcfour = function() {
  946. function Arcfour() {
  947. this.i = 0, this.j = 0, this.S = [];
  948. }
  949. return Arcfour.prototype.init = function(e) {
  950. var r, i, n;
  951. for (r = 0; r < 256; ++r) this.S[r] = r;
  952. for (i = 0, r = 0; r < 256; ++r) i = i + this.S[r] + e[r % e.length] & 255, n = this.S[r],
  953. this.S[r] = this.S[i], this.S[i] = n;
  954. this.i = 0, this.j = 0;
  955. }, Arcfour.prototype.next = function() {
  956. var e;
  957. return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, e = this.S[this.i],
  958. this.S[this.i] = this.S[this.j], this.S[this.j] = e, this.S[e + this.S[this.i] & 255];
  959. }, Arcfour;
  960. }();
  961. function prng_newstate() {
  962. return new Arcfour;
  963. }
  964. var rng_psize = 256, rng_state, rng_pool = null, rng_pptr;
  965. if (null == rng_pool) {
  966. rng_pool = [], rng_pptr = 0;
  967. var t = void 0;
  968. if ("undefined" != typeof window && window.crypto && window.crypto.getRandomValues) {
  969. var z = new Uint32Array(256);
  970. for (window.crypto.getRandomValues(z), t = 0; t < z.length; ++t) rng_pool[rng_pptr++] = 255 & z[t];
  971. }
  972. var count = 0, onMouseMoveListener_1 = function(e) {
  973. if ((count = count || 0) >= 256 || rng_pptr >= rng_psize) window.removeEventListener ? window.removeEventListener("mousemove", onMouseMoveListener_1, !1) : window.detachEvent && window.detachEvent("onmousemove", onMouseMoveListener_1); else try {
  974. var r = e.x + e.y;
  975. rng_pool[rng_pptr++] = 255 & r, count += 1;
  976. } catch (e) {}
  977. };
  978. "undefined" != typeof window && (window.addEventListener ? window.addEventListener("mousemove", onMouseMoveListener_1, !1) : window.attachEvent && window.attachEvent("onmousemove", onMouseMoveListener_1));
  979. }
  980. function rng_get_byte() {
  981. if (null == rng_state) {
  982. for (rng_state = prng_newstate(); rng_pptr < rng_psize; ) {
  983. var e = Math.floor(65536 * Math.random());
  984. rng_pool[rng_pptr++] = 255 & e;
  985. }
  986. for (rng_state.init(rng_pool), rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) rng_pool[rng_pptr] = 0;
  987. rng_pptr = 0;
  988. }
  989. return rng_state.next();
  990. }
  991. var SecureRandom = function() {
  992. function SecureRandom() {}
  993. return SecureRandom.prototype.nextBytes = function(e) {
  994. for (var r = 0; r < e.length; ++r) e[r] = rng_get_byte();
  995. }, SecureRandom;
  996. }();
  997. function pkcs1pad1(e, r) {
  998. if (r < e.length + 22) return console.error("Message too long for RSA"), null;
  999. for (var i = r - e.length - 6, n = "", o = 0; o < i; o += 2) n += "ff";
  1000. return parseBigInt("0001" + n + "00" + e, 16);
  1001. }
  1002. function pkcs1pad2(e, r) {
  1003. if (r < e.length + 11) return console.error("Message too long for RSA"), null;
  1004. for (var i = [], n = e.length - 1; n >= 0 && r > 0; ) {
  1005. var o = e.charCodeAt(n--);
  1006. o < 128 ? i[--r] = o : o > 127 && o < 2048 ? (i[--r] = 63 & o | 128, i[--r] = o >> 6 | 192) : (i[--r] = 63 & o | 128,
  1007. i[--r] = o >> 6 & 63 | 128, i[--r] = o >> 12 | 224);
  1008. }
  1009. i[--r] = 0;
  1010. for (var s = new SecureRandom, a = []; r > 2; ) {
  1011. for (a[0] = 0; 0 == a[0]; ) s.nextBytes(a);
  1012. i[--r] = a[0];
  1013. }
  1014. return i[--r] = 2, i[--r] = 0, new BigInteger(i);
  1015. }
  1016. var RSAKey = function() {
  1017. function RSAKey() {
  1018. this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null,
  1019. this.dmq1 = null, this.coeff = null;
  1020. }
  1021. return RSAKey.prototype.doPublic = function(e) {
  1022. return e.modPowInt(this.e, this.n);
  1023. }, RSAKey.prototype.doPrivate = function(e) {
  1024. if (null == this.p || null == this.q) return e.modPow(this.d, this.n);
  1025. for (var r = e.mod(this.p).modPow(this.dmp1, this.p), i = e.mod(this.q).modPow(this.dmq1, this.q); r.compareTo(i) < 0; ) r = r.add(this.p);
  1026. return r.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i);
  1027. }, RSAKey.prototype.setPublic = function(e, r) {
  1028. null != e && null != r && e.length > 0 && r.length > 0 ? (this.n = parseBigInt(e, 16),
  1029. this.e = parseInt(r, 16)) : console.error("Invalid RSA public key");
  1030. }, RSAKey.prototype.encrypt = function(e) {
  1031. var r = this.n.bitLength() + 7 >> 3, i = pkcs1pad2(e, r);
  1032. if (null == i) return null;
  1033. var n = this.doPublic(i);
  1034. if (null == n) return null;
  1035. for (var o = n.toString(16), s = o.length, a = 0; a < 2 * r - s; a++) o = "0" + o;
  1036. return o;
  1037. }, RSAKey.prototype.setPrivate = function(e, r, i) {
  1038. null != e && null != r && e.length > 0 && r.length > 0 ? (this.n = parseBigInt(e, 16),
  1039. this.e = parseInt(r, 16), this.d = parseBigInt(i, 16)) : console.error("Invalid RSA private key");
  1040. }, RSAKey.prototype.setPrivateEx = function(e, r, i, n, o, s, a, u) {
  1041. null != e && null != r && e.length > 0 && r.length > 0 ? (this.n = parseBigInt(e, 16),
  1042. this.e = parseInt(r, 16), this.d = parseBigInt(i, 16), this.p = parseBigInt(n, 16),
  1043. this.q = parseBigInt(o, 16), this.dmp1 = parseBigInt(s, 16), this.dmq1 = parseBigInt(a, 16),
  1044. this.coeff = parseBigInt(u, 16)) : console.error("Invalid RSA private key");
  1045. }, RSAKey.prototype.generate = function(e, r) {
  1046. var i = new SecureRandom, n = e >> 1;
  1047. this.e = parseInt(r, 16);
  1048. for (var o = new BigInteger(r, 16); ;) {
  1049. for (;this.p = new BigInteger(e - n, 1, i), 0 != this.p.subtract(BigInteger.ONE).gcd(o).compareTo(BigInteger.ONE) || !this.p.isProbablePrime(10); ) ;
  1050. for (;this.q = new BigInteger(n, 1, i), 0 != this.q.subtract(BigInteger.ONE).gcd(o).compareTo(BigInteger.ONE) || !this.q.isProbablePrime(10); ) ;
  1051. if (this.p.compareTo(this.q) <= 0) {
  1052. var s = this.p;
  1053. this.p = this.q, this.q = s;
  1054. }
  1055. var a = this.p.subtract(BigInteger.ONE), u = this.q.subtract(BigInteger.ONE), l = a.multiply(u);
  1056. if (0 == l.gcd(o).compareTo(BigInteger.ONE)) {
  1057. this.n = this.p.multiply(this.q), this.d = o.modInverse(l), this.dmp1 = this.d.mod(a),
  1058. this.dmq1 = this.d.mod(u), this.coeff = this.q.modInverse(this.p);
  1059. break;
  1060. }
  1061. }
  1062. }, RSAKey.prototype.decrypt = function(e) {
  1063. var r = parseBigInt(e, 16), i = this.doPrivate(r);
  1064. return null == i ? null : pkcs1unpad2$1(i, this.n.bitLength() + 7 >> 3);
  1065. }, RSAKey.prototype.generateAsync = function(e, r, i) {
  1066. var n = new SecureRandom, o = e >> 1;
  1067. this.e = parseInt(r, 16);
  1068. var s = new BigInteger(r, 16), a = this, loop1 = function() {
  1069. var loop4 = function() {
  1070. if (a.p.compareTo(a.q) <= 0) {
  1071. var e = a.p;
  1072. a.p = a.q, a.q = e;
  1073. }
  1074. var r = a.p.subtract(BigInteger.ONE), n = a.q.subtract(BigInteger.ONE), o = r.multiply(n);
  1075. 0 == o.gcd(s).compareTo(BigInteger.ONE) ? (a.n = a.p.multiply(a.q), a.d = s.modInverse(o),
  1076. a.dmp1 = a.d.mod(r), a.dmq1 = a.d.mod(n), a.coeff = a.q.modInverse(a.p), setTimeout((function() {
  1077. i();
  1078. }), 0)) : setTimeout(loop1, 0);
  1079. }, loop3 = function() {
  1080. a.q = nbi(), a.q.fromNumberAsync(o, 1, n, (function() {
  1081. a.q.subtract(BigInteger.ONE).gcda(s, (function(e) {
  1082. 0 == e.compareTo(BigInteger.ONE) && a.q.isProbablePrime(10) ? setTimeout(loop4, 0) : setTimeout(loop3, 0);
  1083. }));
  1084. }));
  1085. }, loop2 = function() {
  1086. a.p = nbi(), a.p.fromNumberAsync(e - o, 1, n, (function() {
  1087. a.p.subtract(BigInteger.ONE).gcda(s, (function(e) {
  1088. 0 == e.compareTo(BigInteger.ONE) && a.p.isProbablePrime(10) ? setTimeout(loop3, 0) : setTimeout(loop2, 0);
  1089. }));
  1090. }));
  1091. };
  1092. setTimeout(loop2, 0);
  1093. };
  1094. setTimeout(loop1, 0);
  1095. }, RSAKey.prototype.sign = function(e, r, i) {
  1096. var n = pkcs1pad1(getDigestHeader(i) + r(e).toString(), this.n.bitLength() / 4);
  1097. if (null == n) return null;
  1098. var o = this.doPrivate(n);
  1099. if (null == o) return null;
  1100. var s = o.toString(16);
  1101. return 0 == (1 & s.length) ? s : "0" + s;
  1102. }, RSAKey.prototype.verify = function(e, r, i) {
  1103. var n = parseBigInt(r, 16), o = this.doPublic(n);
  1104. return null == o ? null : removeDigestHeader(o.toString(16).replace(/^1f+00/, "")) == i(e).toString();
  1105. }, RSAKey;
  1106. }();
  1107. function pkcs1unpad2$1(e, r) {
  1108. for (var i = e.toByteArray(), n = 0; n < i.length && 0 == i[n]; ) ++n;
  1109. if (i.length - n != r - 1 || 2 != i[n]) return null;
  1110. for (++n; 0 != i[n]; ) if (++n >= i.length) return null;
  1111. for (var o = ""; ++n < i.length; ) {
  1112. var s = 255 & i[n];
  1113. s < 128 ? o += String.fromCharCode(s) : s > 191 && s < 224 ? (o += String.fromCharCode((31 & s) << 6 | 63 & i[n + 1]),
  1114. ++n) : (o += String.fromCharCode((15 & s) << 12 | (63 & i[n + 1]) << 6 | 63 & i[n + 2]),
  1115. n += 2);
  1116. }
  1117. return o;
  1118. }
  1119. var DIGEST_HEADERS = {
  1120. md2: "3020300c06082a864886f70d020205000410",
  1121. md5: "3020300c06082a864886f70d020505000410",
  1122. sha1: "3021300906052b0e03021a05000414",
  1123. sha224: "302d300d06096086480165030402040500041c",
  1124. sha256: "3031300d060960864801650304020105000420",
  1125. sha384: "3041300d060960864801650304020205000430",
  1126. sha512: "3051300d060960864801650304020305000440",
  1127. ripemd160: "3021300906052b2403020105000414"
  1128. };
  1129. function getDigestHeader(e) {
  1130. return DIGEST_HEADERS[e] || "";
  1131. }
  1132. function removeDigestHeader(e) {
  1133. for (var r in DIGEST_HEADERS) if (DIGEST_HEADERS.hasOwnProperty(r)) {
  1134. var i = DIGEST_HEADERS[r], n = i.length;
  1135. if (e.substr(0, n) == i) return e.substr(n);
  1136. }
  1137. return e;
  1138. }
  1139. /*!
  1140. Copyright (c) 2011, Yahoo! Inc. All rights reserved.
  1141. Code licensed under the BSD License:
  1142. http://developer.yahoo.com/yui/license.html
  1143. version: 2.9.0
  1144. */ var YAHOO = {};
  1145. YAHOO.lang = {
  1146. extend: function(e, r, i) {
  1147. if (!r || !e) throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");
  1148. var F = function() {};
  1149. if (F.prototype = r.prototype, e.prototype = new F, e.prototype.constructor = e,
  1150. e.superclass = r.prototype, r.prototype.constructor == Object.prototype.constructor && (r.prototype.constructor = r),
  1151. i) {
  1152. var n;
  1153. for (n in i) e.prototype[n] = i[n];
  1154. var _IEEnumFix = function() {}, o = [ "toString", "valueOf" ];
  1155. try {
  1156. /MSIE/.test(navigator.userAgent) && (_IEEnumFix = function(e, r) {
  1157. for (n = 0; n < o.length; n += 1) {
  1158. var i = o[n], s = r[i];
  1159. "function" == typeof s && s != Object.prototype[i] && (e[i] = s);
  1160. }
  1161. });
  1162. } catch (e) {}
  1163. _IEEnumFix(e.prototype, i);
  1164. }
  1165. }
  1166. };
  1167. /**
  1168. * @fileOverview
  1169. * @name asn1-1.0.js
  1170. * @author Kenji Urushima kenji.urushima@gmail.com
  1171. * @version asn1 1.0.13 (2017-Jun-02)
  1172. * @since jsrsasign 2.1
  1173. * @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
  1174. */
  1175. var KJUR = {};
  1176. void 0 !== KJUR.asn1 && KJUR.asn1 || (KJUR.asn1 = {}), KJUR.asn1.ASN1Util = new function() {
  1177. this.integerToByteHex = function(e) {
  1178. var r = e.toString(16);
  1179. return r.length % 2 == 1 && (r = "0" + r), r;
  1180. }, this.bigIntToMinTwosComplementsHex = function(e) {
  1181. var r = e.toString(16);
  1182. if ("-" != r.substr(0, 1)) r.length % 2 == 1 ? r = "0" + r : r.match(/^[0-7]/) || (r = "00" + r); else {
  1183. var i = r.substr(1).length;
  1184. i % 2 == 1 ? i += 1 : r.match(/^[0-7]/) || (i += 2);
  1185. for (var n = "", o = 0; o < i; o++) n += "f";
  1186. r = new BigInteger(n, 16).xor(e).add(BigInteger.ONE).toString(16).replace(/^-/, "");
  1187. }
  1188. return r;
  1189. }, this.getPEMStringFromHex = function(e, r) {
  1190. return hextopem(e, r);
  1191. }, this.newObject = function(e) {
  1192. var r = KJUR.asn1, i = r.DERBoolean, n = r.DERInteger, o = r.DERBitString, s = r.DEROctetString, a = r.DERNull, u = r.DERObjectIdentifier, l = r.DEREnumerated, f = r.DERUTF8String, h = r.DERNumericString, p = r.DERPrintableString, c = r.DERTeletexString, d = r.DERIA5String, g = r.DERUTCTime, m = r.DERGeneralizedTime, y = r.DERSequence, v = r.DERSet, b = r.DERTaggedObject, S = r.ASN1Util.newObject, w = Object.keys(e);
  1193. if (1 != w.length) throw "key of param shall be only one.";
  1194. var R = w[0];
  1195. if (-1 == ":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + R + ":")) throw "undefined key: " + R;
  1196. if ("bool" == R) return new i(e[R]);
  1197. if ("int" == R) return new n(e[R]);
  1198. if ("bitstr" == R) return new o(e[R]);
  1199. if ("octstr" == R) return new s(e[R]);
  1200. if ("null" == R) return new a(e[R]);
  1201. if ("oid" == R) return new u(e[R]);
  1202. if ("enum" == R) return new l(e[R]);
  1203. if ("utf8str" == R) return new f(e[R]);
  1204. if ("numstr" == R) return new h(e[R]);
  1205. if ("prnstr" == R) return new p(e[R]);
  1206. if ("telstr" == R) return new c(e[R]);
  1207. if ("ia5str" == R) return new d(e[R]);
  1208. if ("utctime" == R) return new g(e[R]);
  1209. if ("gentime" == R) return new m(e[R]);
  1210. if ("seq" == R) {
  1211. for (var O = e[R], B = [], T = 0; T < O.length; T++) {
  1212. var E = S(O[T]);
  1213. B.push(E);
  1214. }
  1215. return new y({
  1216. array: B
  1217. });
  1218. }
  1219. if ("set" == R) {
  1220. for (O = e[R], B = [], T = 0; T < O.length; T++) {
  1221. E = S(O[T]);
  1222. B.push(E);
  1223. }
  1224. return new v({
  1225. array: B
  1226. });
  1227. }
  1228. if ("tag" == R) {
  1229. var A = e[R];
  1230. if ("[object Array]" === Object.prototype.toString.call(A) && 3 == A.length) {
  1231. var _ = S(A[2]);
  1232. return new b({
  1233. tag: A[0],
  1234. explicit: A[1],
  1235. obj: _
  1236. });
  1237. }
  1238. var I = {};
  1239. if (void 0 !== A.explicit && (I.explicit = A.explicit), void 0 !== A.tag && (I.tag = A.tag),
  1240. void 0 === A.obj) throw "obj shall be specified for 'tag'.";
  1241. return I.obj = S(A.obj), new b(I);
  1242. }
  1243. }, this.jsonToASN1HEX = function(e) {
  1244. return this.newObject(e).getEncodedHex();
  1245. };
  1246. }, KJUR.asn1.ASN1Util.oidHexToInt = function(e) {
  1247. for (var r = "", i = parseInt(e.substr(0, 2), 16), n = (r = Math.floor(i / 40) + "." + i % 40,
  1248. ""), o = 2; o < e.length; o += 2) {
  1249. var s = ("00000000" + parseInt(e.substr(o, 2), 16).toString(2)).slice(-8);
  1250. if (n += s.substr(1, 7), "0" == s.substr(0, 1)) r = r + "." + new BigInteger(n, 2).toString(10),
  1251. n = "";
  1252. }
  1253. return r;
  1254. }, KJUR.asn1.ASN1Util.oidIntToHex = function(e) {
  1255. var itox = function(e) {
  1256. var r = e.toString(16);
  1257. return 1 == r.length && (r = "0" + r), r;
  1258. }, roidtox = function(e) {
  1259. var r = "", i = new BigInteger(e, 10).toString(2), n = 7 - i.length % 7;
  1260. 7 == n && (n = 0);
  1261. for (var o = "", s = 0; s < n; s++) o += "0";
  1262. i = o + i;
  1263. for (s = 0; s < i.length - 1; s += 7) {
  1264. var a = i.substr(s, 7);
  1265. s != i.length - 7 && (a = "1" + a), r += itox(parseInt(a, 2));
  1266. }
  1267. return r;
  1268. };
  1269. if (!e.match(/^[0-9.]+$/)) throw "malformed oid string: " + e;
  1270. var r = "", i = e.split("."), n = 40 * parseInt(i[0]) + parseInt(i[1]);
  1271. r += itox(n), i.splice(0, 2);
  1272. for (var o = 0; o < i.length; o++) r += roidtox(i[o]);
  1273. return r;
  1274. }, KJUR.asn1.ASN1Object = function() {
  1275. this.getLengthHexFromValue = function() {
  1276. if (void 0 === this.hV || null == this.hV) throw "this.hV is null or undefined.";
  1277. if (this.hV.length % 2 == 1) throw "value hex must be even length: n=0,v=" + this.hV;
  1278. var e = this.hV.length / 2, r = e.toString(16);
  1279. if (r.length % 2 == 1 && (r = "0" + r), e < 128) return r;
  1280. var i = r.length / 2;
  1281. if (i > 15) throw "ASN.1 length too long to represent by 8x: n = " + e.toString(16);
  1282. return (128 + i).toString(16) + r;
  1283. }, this.getEncodedHex = function() {
  1284. return (null == this.hTLV || this.isModified) && (this.hV = this.getFreshValueHex(),
  1285. this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV,
  1286. this.isModified = !1), this.hTLV;
  1287. }, this.getValueHex = function() {
  1288. return this.getEncodedHex(), this.hV;
  1289. }, this.getFreshValueHex = function() {
  1290. return "";
  1291. };
  1292. }, KJUR.asn1.DERAbstractString = function(e) {
  1293. KJUR.asn1.DERAbstractString.superclass.constructor.call(this), this.getString = function() {
  1294. return this.s;
  1295. }, this.setString = function(e) {
  1296. this.hTLV = null, this.isModified = !0, this.s = e, this.hV = stohex(this.s);
  1297. }, this.setStringHex = function(e) {
  1298. this.hTLV = null, this.isModified = !0, this.s = null, this.hV = e;
  1299. }, this.getFreshValueHex = function() {
  1300. return this.hV;
  1301. }, void 0 !== e && ("string" == typeof e ? this.setString(e) : void 0 !== e.str ? this.setString(e.str) : void 0 !== e.hex && this.setStringHex(e.hex));
  1302. }, YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object), KJUR.asn1.DERAbstractTime = function(e) {
  1303. KJUR.asn1.DERAbstractTime.superclass.constructor.call(this), this.localDateToUTC = function(e) {
  1304. return utc = e.getTime() + 6e4 * e.getTimezoneOffset(), new Date(utc);
  1305. }, this.formatDate = function(e, r, i) {
  1306. var n = this.zeroPadding, o = this.localDateToUTC(e), s = String(o.getFullYear());
  1307. "utc" == r && (s = s.substr(2, 2));
  1308. var a = s + n(String(o.getMonth() + 1), 2) + n(String(o.getDate()), 2) + n(String(o.getHours()), 2) + n(String(o.getMinutes()), 2) + n(String(o.getSeconds()), 2);
  1309. if (!0 === i) {
  1310. var u = o.getMilliseconds();
  1311. if (0 != u) {
  1312. var l = n(String(u), 3);
  1313. a = a + "." + (l = l.replace(/[0]+$/, ""));
  1314. }
  1315. }
  1316. return a + "Z";
  1317. }, this.zeroPadding = function(e, r) {
  1318. return e.length >= r ? e : new Array(r - e.length + 1).join("0") + e;
  1319. }, this.getString = function() {
  1320. return this.s;
  1321. }, this.setString = function(e) {
  1322. this.hTLV = null, this.isModified = !0, this.s = e, this.hV = stohex(e);
  1323. }, this.setByDateValue = function(e, r, i, n, o, s) {
  1324. var a = new Date(Date.UTC(e, r - 1, i, n, o, s, 0));
  1325. this.setByDate(a);
  1326. }, this.getFreshValueHex = function() {
  1327. return this.hV;
  1328. };
  1329. }, YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object), KJUR.asn1.DERAbstractStructured = function(e) {
  1330. KJUR.asn1.DERAbstractString.superclass.constructor.call(this), this.setByASN1ObjectArray = function(e) {
  1331. this.hTLV = null, this.isModified = !0, this.asn1Array = e;
  1332. }, this.appendASN1Object = function(e) {
  1333. this.hTLV = null, this.isModified = !0, this.asn1Array.push(e);
  1334. }, this.asn1Array = new Array, void 0 !== e && void 0 !== e.array && (this.asn1Array = e.array);
  1335. }, YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object), KJUR.asn1.DERBoolean = function() {
  1336. KJUR.asn1.DERBoolean.superclass.constructor.call(this), this.hT = "01", this.hTLV = "0101ff";
  1337. }, YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object), KJUR.asn1.DERInteger = function(e) {
  1338. KJUR.asn1.DERInteger.superclass.constructor.call(this), this.hT = "02", this.setByBigInteger = function(e) {
  1339. this.hTLV = null, this.isModified = !0, this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e);
  1340. }, this.setByInteger = function(e) {
  1341. var r = new BigInteger(String(e), 10);
  1342. this.setByBigInteger(r);
  1343. }, this.setValueHex = function(e) {
  1344. this.hV = e;
  1345. }, this.getFreshValueHex = function() {
  1346. return this.hV;
  1347. }, void 0 !== e && (void 0 !== e.bigint ? this.setByBigInteger(e.bigint) : void 0 !== e.int ? this.setByInteger(e.int) : "number" == typeof e ? this.setByInteger(e) : void 0 !== e.hex && this.setValueHex(e.hex));
  1348. }, YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object), KJUR.asn1.DERBitString = function(e) {
  1349. if (void 0 !== e && void 0 !== e.obj) {
  1350. var r = KJUR.asn1.ASN1Util.newObject(e.obj);
  1351. e.hex = "00" + r.getEncodedHex();
  1352. }
  1353. KJUR.asn1.DERBitString.superclass.constructor.call(this), this.hT = "03", this.setHexValueIncludingUnusedBits = function(e) {
  1354. this.hTLV = null, this.isModified = !0, this.hV = e;
  1355. }, this.setUnusedBitsAndHexValue = function(e, r) {
  1356. if (e < 0 || 7 < e) throw "unused bits shall be from 0 to 7: u = " + e;
  1357. var i = "0" + e;
  1358. this.hTLV = null, this.isModified = !0, this.hV = i + r;
  1359. }, this.setByBinaryString = function(e) {
  1360. var r = 8 - (e = e.replace(/0+$/, "")).length % 8;
  1361. 8 == r && (r = 0);
  1362. for (var i = 0; i <= r; i++) e += "0";
  1363. var n = "";
  1364. for (i = 0; i < e.length - 1; i += 8) {
  1365. var o = e.substr(i, 8), s = parseInt(o, 2).toString(16);
  1366. 1 == s.length && (s = "0" + s), n += s;
  1367. }
  1368. this.hTLV = null, this.isModified = !0, this.hV = "0" + r + n;
  1369. }, this.setByBooleanArray = function(e) {
  1370. for (var r = "", i = 0; i < e.length; i++) 1 == e[i] ? r += "1" : r += "0";
  1371. this.setByBinaryString(r);
  1372. }, this.newFalseArray = function(e) {
  1373. for (var r = new Array(e), i = 0; i < e; i++) r[i] = !1;
  1374. return r;
  1375. }, this.getFreshValueHex = function() {
  1376. return this.hV;
  1377. }, void 0 !== e && ("string" == typeof e && e.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(e) : void 0 !== e.hex ? this.setHexValueIncludingUnusedBits(e.hex) : void 0 !== e.bin ? this.setByBinaryString(e.bin) : void 0 !== e.array && this.setByBooleanArray(e.array));
  1378. }, YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object), KJUR.asn1.DEROctetString = function(e) {
  1379. if (void 0 !== e && void 0 !== e.obj) {
  1380. var r = KJUR.asn1.ASN1Util.newObject(e.obj);
  1381. e.hex = r.getEncodedHex();
  1382. }
  1383. KJUR.asn1.DEROctetString.superclass.constructor.call(this, e), this.hT = "04";
  1384. }, YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERNull = function() {
  1385. KJUR.asn1.DERNull.superclass.constructor.call(this), this.hT = "05", this.hTLV = "0500";
  1386. }, YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object), KJUR.asn1.DERObjectIdentifier = function(e) {
  1387. var itox = function(e) {
  1388. var r = e.toString(16);
  1389. return 1 == r.length && (r = "0" + r), r;
  1390. }, roidtox = function(e) {
  1391. var r = "", i = new BigInteger(e, 10).toString(2), n = 7 - i.length % 7;
  1392. 7 == n && (n = 0);
  1393. for (var o = "", s = 0; s < n; s++) o += "0";
  1394. i = o + i;
  1395. for (s = 0; s < i.length - 1; s += 7) {
  1396. var a = i.substr(s, 7);
  1397. s != i.length - 7 && (a = "1" + a), r += itox(parseInt(a, 2));
  1398. }
  1399. return r;
  1400. };
  1401. KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = "06",
  1402. this.setValueHex = function(e) {
  1403. this.hTLV = null, this.isModified = !0, this.s = null, this.hV = e;
  1404. }, this.setValueOidString = function(e) {
  1405. if (!e.match(/^[0-9.]+$/)) throw "malformed oid string: " + e;
  1406. var r = "", i = e.split("."), n = 40 * parseInt(i[0]) + parseInt(i[1]);
  1407. r += itox(n), i.splice(0, 2);
  1408. for (var o = 0; o < i.length; o++) r += roidtox(i[o]);
  1409. this.hTLV = null, this.isModified = !0, this.s = null, this.hV = r;
  1410. }, this.setValueName = function(e) {
  1411. var r = KJUR.asn1.x509.OID.name2oid(e);
  1412. if ("" === r) throw "DERObjectIdentifier oidName undefined: " + e;
  1413. this.setValueOidString(r);
  1414. }, this.getFreshValueHex = function() {
  1415. return this.hV;
  1416. }, void 0 !== e && ("string" == typeof e ? e.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(e) : this.setValueName(e) : void 0 !== e.oid ? this.setValueOidString(e.oid) : void 0 !== e.hex ? this.setValueHex(e.hex) : void 0 !== e.name && this.setValueName(e.name));
  1417. }, YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object), KJUR.asn1.DEREnumerated = function(e) {
  1418. KJUR.asn1.DEREnumerated.superclass.constructor.call(this), this.hT = "0a", this.setByBigInteger = function(e) {
  1419. this.hTLV = null, this.isModified = !0, this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e);
  1420. }, this.setByInteger = function(e) {
  1421. var r = new BigInteger(String(e), 10);
  1422. this.setByBigInteger(r);
  1423. }, this.setValueHex = function(e) {
  1424. this.hV = e;
  1425. }, this.getFreshValueHex = function() {
  1426. return this.hV;
  1427. }, void 0 !== e && (void 0 !== e.int ? this.setByInteger(e.int) : "number" == typeof e ? this.setByInteger(e) : void 0 !== e.hex && this.setValueHex(e.hex));
  1428. }, YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object), KJUR.asn1.DERUTF8String = function(e) {
  1429. KJUR.asn1.DERUTF8String.superclass.constructor.call(this, e), this.hT = "0c";
  1430. }, YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString), KJUR.asn1.DERNumericString = function(e) {
  1431. KJUR.asn1.DERNumericString.superclass.constructor.call(this, e), this.hT = "12";
  1432. }, YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERPrintableString = function(e) {
  1433. KJUR.asn1.DERPrintableString.superclass.constructor.call(this, e), this.hT = "13";
  1434. }, YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString),
  1435. KJUR.asn1.DERTeletexString = function(e) {
  1436. KJUR.asn1.DERTeletexString.superclass.constructor.call(this, e), this.hT = "14";
  1437. }, YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERIA5String = function(e) {
  1438. KJUR.asn1.DERIA5String.superclass.constructor.call(this, e), this.hT = "16";
  1439. }, YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString), KJUR.asn1.DERUTCTime = function(e) {
  1440. KJUR.asn1.DERUTCTime.superclass.constructor.call(this, e), this.hT = "17", this.setByDate = function(e) {
  1441. this.hTLV = null, this.isModified = !0, this.date = e, this.s = this.formatDate(this.date, "utc"),
  1442. this.hV = stohex(this.s);
  1443. }, this.getFreshValueHex = function() {
  1444. return void 0 === this.date && void 0 === this.s && (this.date = new Date, this.s = this.formatDate(this.date, "utc"),
  1445. this.hV = stohex(this.s)), this.hV;
  1446. }, void 0 !== e && (void 0 !== e.str ? this.setString(e.str) : "string" == typeof e && e.match(/^[0-9]{12}Z$/) ? this.setString(e) : void 0 !== e.hex ? this.setStringHex(e.hex) : void 0 !== e.date && this.setByDate(e.date));
  1447. }, YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime), KJUR.asn1.DERGeneralizedTime = function(e) {
  1448. KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, e), this.hT = "18",
  1449. this.withMillis = !1, this.setByDate = function(e) {
  1450. this.hTLV = null, this.isModified = !0, this.date = e, this.s = this.formatDate(this.date, "gen", this.withMillis),
  1451. this.hV = stohex(this.s);
  1452. }, this.getFreshValueHex = function() {
  1453. return void 0 === this.date && void 0 === this.s && (this.date = new Date, this.s = this.formatDate(this.date, "gen", this.withMillis),
  1454. this.hV = stohex(this.s)), this.hV;
  1455. }, void 0 !== e && (void 0 !== e.str ? this.setString(e.str) : "string" == typeof e && e.match(/^[0-9]{14}Z$/) ? this.setString(e) : void 0 !== e.hex ? this.setStringHex(e.hex) : void 0 !== e.date && this.setByDate(e.date),
  1456. !0 === e.millis && (this.withMillis = !0));
  1457. }, YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime), KJUR.asn1.DERSequence = function(e) {
  1458. KJUR.asn1.DERSequence.superclass.constructor.call(this, e), this.hT = "30", this.getFreshValueHex = function() {
  1459. for (var e = "", r = 0; r < this.asn1Array.length; r++) {
  1460. e += this.asn1Array[r].getEncodedHex();
  1461. }
  1462. return this.hV = e, this.hV;
  1463. };
  1464. }, YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured), KJUR.asn1.DERSet = function(e) {
  1465. KJUR.asn1.DERSet.superclass.constructor.call(this, e), this.hT = "31", this.sortFlag = !0,
  1466. this.getFreshValueHex = function() {
  1467. for (var e = new Array, r = 0; r < this.asn1Array.length; r++) {
  1468. var i = this.asn1Array[r];
  1469. e.push(i.getEncodedHex());
  1470. }
  1471. return 1 == this.sortFlag && e.sort(), this.hV = e.join(""), this.hV;
  1472. }, void 0 !== e && void 0 !== e.sortflag && 0 == e.sortflag && (this.sortFlag = !1);
  1473. }, YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured), KJUR.asn1.DERTaggedObject = function(e) {
  1474. KJUR.asn1.DERTaggedObject.superclass.constructor.call(this), this.hT = "a0", this.hV = "",
  1475. this.isExplicit = !0, this.asn1Object = null, this.setASN1Object = function(e, r, i) {
  1476. this.hT = r, this.isExplicit = e, this.asn1Object = i, this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(),
  1477. this.hTLV = null, this.isModified = !0) : (this.hV = null, this.hTLV = i.getEncodedHex(),
  1478. this.hTLV = this.hTLV.replace(/^../, r), this.isModified = !1);
  1479. }, this.getFreshValueHex = function() {
  1480. return this.hV;
  1481. }, void 0 !== e && (void 0 !== e.tag && (this.hT = e.tag), void 0 !== e.explicit && (this.isExplicit = e.explicit),
  1482. void 0 !== e.obj && (this.asn1Object = e.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));
  1483. }, YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);
  1484. var __extends = (extendStatics = function(e, r) {
  1485. return extendStatics = Object.setPrototypeOf || {
  1486. __proto__: []
  1487. } instanceof Array && function(e, r) {
  1488. e.__proto__ = r;
  1489. } || function(e, r) {
  1490. for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (e[i] = r[i]);
  1491. }, extendStatics(e, r);
  1492. }, function(e, r) {
  1493. if ("function" != typeof r && null !== r) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
  1494. function __() {
  1495. this.constructor = e;
  1496. }
  1497. extendStatics(e, r), e.prototype = null === r ? Object.create(r) : (__.prototype = r.prototype,
  1498. new __);
  1499. }), extendStatics, JSEncryptRSAKey = function(e) {
  1500. function JSEncryptRSAKey(r) {
  1501. var i = e.call(this) || this;
  1502. return r && ("string" == typeof r ? i.parseKey(r) : (JSEncryptRSAKey.hasPrivateKeyProperty(r) || JSEncryptRSAKey.hasPublicKeyProperty(r)) && i.parsePropertiesFrom(r)),
  1503. i;
  1504. }
  1505. return __extends(JSEncryptRSAKey, e), JSEncryptRSAKey.prototype.parseKey = function(e) {
  1506. try {
  1507. var r = 0, i = 0, n = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e) ? Hex.decode(e) : Base64.unarmor(e), o = ASN1.decode(n);
  1508. if (3 === o.sub.length && (o = o.sub[2].sub[0]), 9 === o.sub.length) {
  1509. r = o.sub[1].getHexStringValue(), this.n = parseBigInt(r, 16), i = o.sub[2].getHexStringValue(),
  1510. this.e = parseInt(i, 16);
  1511. var s = o.sub[3].getHexStringValue();
  1512. this.d = parseBigInt(s, 16);
  1513. var a = o.sub[4].getHexStringValue();
  1514. this.p = parseBigInt(a, 16);
  1515. var u = o.sub[5].getHexStringValue();
  1516. this.q = parseBigInt(u, 16);
  1517. var l = o.sub[6].getHexStringValue();
  1518. this.dmp1 = parseBigInt(l, 16);
  1519. var f = o.sub[7].getHexStringValue();
  1520. this.dmq1 = parseBigInt(f, 16);
  1521. var h = o.sub[8].getHexStringValue();
  1522. this.coeff = parseBigInt(h, 16);
  1523. } else {
  1524. if (2 !== o.sub.length) return !1;
  1525. if (o.sub[0].sub) {
  1526. var p = o.sub[1].sub[0];
  1527. r = p.sub[0].getHexStringValue(), this.n = parseBigInt(r, 16), i = p.sub[1].getHexStringValue(),
  1528. this.e = parseInt(i, 16);
  1529. } else r = o.sub[0].getHexStringValue(), this.n = parseBigInt(r, 16), i = o.sub[1].getHexStringValue(),
  1530. this.e = parseInt(i, 16);
  1531. }
  1532. return !0;
  1533. } catch (e) {
  1534. return !1;
  1535. }
  1536. }, JSEncryptRSAKey.prototype.getPrivateBaseKey = function() {
  1537. var e = {
  1538. array: [ new KJUR.asn1.DERInteger({
  1539. int: 0
  1540. }), new KJUR.asn1.DERInteger({
  1541. bigint: this.n
  1542. }), new KJUR.asn1.DERInteger({
  1543. int: this.e
  1544. }), new KJUR.asn1.DERInteger({
  1545. bigint: this.d
  1546. }), new KJUR.asn1.DERInteger({
  1547. bigint: this.p
  1548. }), new KJUR.asn1.DERInteger({
  1549. bigint: this.q
  1550. }), new KJUR.asn1.DERInteger({
  1551. bigint: this.dmp1
  1552. }), new KJUR.asn1.DERInteger({
  1553. bigint: this.dmq1
  1554. }), new KJUR.asn1.DERInteger({
  1555. bigint: this.coeff
  1556. }) ]
  1557. };
  1558. return new KJUR.asn1.DERSequence(e).getEncodedHex();
  1559. }, JSEncryptRSAKey.prototype.getPrivateBaseKeyB64 = function() {
  1560. return hex2b64(this.getPrivateBaseKey());
  1561. }, JSEncryptRSAKey.prototype.getPublicBaseKey = function() {
  1562. var e = new KJUR.asn1.DERSequence({
  1563. array: [ new KJUR.asn1.DERObjectIdentifier({
  1564. oid: "1.2.840.113549.1.1.1"
  1565. }), new KJUR.asn1.DERNull ]
  1566. }), r = new KJUR.asn1.DERSequence({
  1567. array: [ new KJUR.asn1.DERInteger({
  1568. bigint: this.n
  1569. }), new KJUR.asn1.DERInteger({
  1570. int: this.e
  1571. }) ]
  1572. }), i = new KJUR.asn1.DERBitString({
  1573. hex: "00" + r.getEncodedHex()
  1574. });
  1575. return new KJUR.asn1.DERSequence({
  1576. array: [ e, i ]
  1577. }).getEncodedHex();
  1578. }, JSEncryptRSAKey.prototype.getPublicBaseKeyB64 = function() {
  1579. return hex2b64(this.getPublicBaseKey());
  1580. }, JSEncryptRSAKey.wordwrap = function(e, r) {
  1581. if (!e) return e;
  1582. var i = "(.{1," + (r = r || 64) + "})( +|$\n?)|(.{1," + r + "})";
  1583. return e.match(RegExp(i, "g")).join("\n");
  1584. }, JSEncryptRSAKey.prototype.getPrivateKey = function() {
  1585. var e = "-----BEGIN RSA PRIVATE KEY-----\n";
  1586. return e += JSEncryptRSAKey.wordwrap(this.getPrivateBaseKeyB64()) + "\n", e += "-----END RSA PRIVATE KEY-----";
  1587. }, JSEncryptRSAKey.prototype.getPublicKey = function() {
  1588. var e = "-----BEGIN PUBLIC KEY-----\n";
  1589. return e += JSEncryptRSAKey.wordwrap(this.getPublicBaseKeyB64()) + "\n", e += "-----END PUBLIC KEY-----";
  1590. }, JSEncryptRSAKey.hasPublicKeyProperty = function(e) {
  1591. return (e = e || {}).hasOwnProperty("n") && e.hasOwnProperty("e");
  1592. }, JSEncryptRSAKey.hasPrivateKeyProperty = function(e) {
  1593. return (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");
  1594. }, JSEncryptRSAKey.prototype.parsePropertiesFrom = function(e) {
  1595. this.n = e.n, this.e = e.e, e.hasOwnProperty("d") && (this.d = e.d, this.p = e.p,
  1596. this.q = e.q, this.dmp1 = e.dmp1, this.dmq1 = e.dmq1, this.coeff = e.coeff);
  1597. }, JSEncryptRSAKey;
  1598. }(RSAKey), commonjsGlobal = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}, src = {
  1599. exports: {}
  1600. }, indexLight = {
  1601. exports: {}
  1602. }, indexMinimal = {}, minimal = {}, aspromise, hasRequiredAspromise;
  1603. function requireAspromise() {
  1604. if (hasRequiredAspromise) return aspromise;
  1605. return hasRequiredAspromise = 1, aspromise = function asPromise(e, r) {
  1606. var i = new Array(arguments.length - 1), n = 0, o = 2, s = !0;
  1607. for (;o < arguments.length; ) i[n++] = arguments[o++];
  1608. return new Promise((function executor(o, a) {
  1609. i[n] = function callback(e) {
  1610. if (s) if (s = !1, e) a(e); else {
  1611. for (var r = new Array(arguments.length - 1), i = 0; i < r.length; ) r[i++] = arguments[i];
  1612. o.apply(null, r);
  1613. }
  1614. };
  1615. try {
  1616. e.apply(r || null, i);
  1617. } catch (e) {
  1618. s && (s = !1, a(e));
  1619. }
  1620. }));
  1621. }, aspromise;
  1622. }
  1623. var base64$1 = {}, hasRequiredBase64, eventemitter, hasRequiredEventemitter, float, hasRequiredFloat, inquire_1, hasRequiredInquire;
  1624. function requireBase64() {
  1625. return hasRequiredBase64 || (hasRequiredBase64 = 1, function(e) {
  1626. var r = e;
  1627. r.length = function length(e) {
  1628. var r = e.length;
  1629. if (!r) return 0;
  1630. for (var i = 0; --r % 4 > 1 && "=" === e.charAt(r); ) ++i;
  1631. return Math.ceil(3 * e.length) / 4 - i;
  1632. };
  1633. for (var i = new Array(64), n = new Array(123), o = 0; o < 64; ) n[i[o] = o < 26 ? o + 65 : o < 52 ? o + 71 : o < 62 ? o - 4 : o - 59 | 43] = o++;
  1634. r.encode = function encode(e, r, n) {
  1635. for (var o, s = null, a = [], u = 0, l = 0; r < n; ) {
  1636. var f = e[r++];
  1637. switch (l) {
  1638. case 0:
  1639. a[u++] = i[f >> 2], o = (3 & f) << 4, l = 1;
  1640. break;
  1641. case 1:
  1642. a[u++] = i[o | f >> 4], o = (15 & f) << 2, l = 2;
  1643. break;
  1644. case 2:
  1645. a[u++] = i[o | f >> 6], a[u++] = i[63 & f], l = 0;
  1646. }
  1647. u > 8191 && ((s || (s = [])).push(String.fromCharCode.apply(String, a)), u = 0);
  1648. }
  1649. return l && (a[u++] = i[o], a[u++] = 61, 1 === l && (a[u++] = 61)), s ? (u && s.push(String.fromCharCode.apply(String, a.slice(0, u))),
  1650. s.join("")) : String.fromCharCode.apply(String, a.slice(0, u));
  1651. };
  1652. var s = "invalid encoding";
  1653. r.decode = function decode(e, r, i) {
  1654. for (var o, a = i, u = 0, l = 0; l < e.length; ) {
  1655. var f = e.charCodeAt(l++);
  1656. if (61 === f && u > 1) break;
  1657. if (void 0 === (f = n[f])) throw Error(s);
  1658. switch (u) {
  1659. case 0:
  1660. o = f, u = 1;
  1661. break;
  1662. case 1:
  1663. r[i++] = o << 2 | (48 & f) >> 4, o = f, u = 2;
  1664. break;
  1665. case 2:
  1666. r[i++] = (15 & o) << 4 | (60 & f) >> 2, o = f, u = 3;
  1667. break;
  1668. case 3:
  1669. r[i++] = (3 & o) << 6 | f, u = 0;
  1670. }
  1671. }
  1672. if (1 === u) throw Error(s);
  1673. return i - a;
  1674. }, r.test = function test(e) {
  1675. return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e);
  1676. };
  1677. }(base64$1)), base64$1;
  1678. }
  1679. function requireEventemitter() {
  1680. if (hasRequiredEventemitter) return eventemitter;
  1681. function EventEmitter() {
  1682. this._listeners = {};
  1683. }
  1684. return hasRequiredEventemitter = 1, eventemitter = EventEmitter, EventEmitter.prototype.on = function on(e, r, i) {
  1685. return (this._listeners[e] || (this._listeners[e] = [])).push({
  1686. fn: r,
  1687. ctx: i || this
  1688. }), this;
  1689. }, EventEmitter.prototype.off = function off(e, r) {
  1690. if (void 0 === e) this._listeners = {}; else if (void 0 === r) this._listeners[e] = []; else for (var i = this._listeners[e], n = 0; n < i.length; ) i[n].fn === r ? i.splice(n, 1) : ++n;
  1691. return this;
  1692. }, EventEmitter.prototype.emit = function emit(e) {
  1693. var r = this._listeners[e];
  1694. if (r) {
  1695. for (var i = [], n = 1; n < arguments.length; ) i.push(arguments[n++]);
  1696. for (n = 0; n < r.length; ) r[n].fn.apply(r[n++].ctx, i);
  1697. }
  1698. return this;
  1699. }, eventemitter;
  1700. }
  1701. function requireFloat() {
  1702. if (hasRequiredFloat) return float;
  1703. function factory(e) {
  1704. return "undefined" != typeof Float32Array ? function() {
  1705. var r = new Float32Array([ -0 ]), i = new Uint8Array(r.buffer), n = 128 === i[3];
  1706. function writeFloat_f32_cpy(e, n, o) {
  1707. r[0] = e, n[o] = i[0], n[o + 1] = i[1], n[o + 2] = i[2], n[o + 3] = i[3];
  1708. }
  1709. function writeFloat_f32_rev(e, n, o) {
  1710. r[0] = e, n[o] = i[3], n[o + 1] = i[2], n[o + 2] = i[1], n[o + 3] = i[0];
  1711. }
  1712. function readFloat_f32_cpy(e, n) {
  1713. return i[0] = e[n], i[1] = e[n + 1], i[2] = e[n + 2], i[3] = e[n + 3], r[0];
  1714. }
  1715. function readFloat_f32_rev(e, n) {
  1716. return i[3] = e[n], i[2] = e[n + 1], i[1] = e[n + 2], i[0] = e[n + 3], r[0];
  1717. }
  1718. e.writeFloatLE = n ? writeFloat_f32_cpy : writeFloat_f32_rev, e.writeFloatBE = n ? writeFloat_f32_rev : writeFloat_f32_cpy,
  1719. e.readFloatLE = n ? readFloat_f32_cpy : readFloat_f32_rev, e.readFloatBE = n ? readFloat_f32_rev : readFloat_f32_cpy;
  1720. }() : function() {
  1721. function writeFloat_ieee754(e, r, i, n) {
  1722. var o = r < 0 ? 1 : 0;
  1723. if (o && (r = -r), 0 === r) e(1 / r > 0 ? 0 : 2147483648, i, n); else if (isNaN(r)) e(2143289344, i, n); else if (r > 34028234663852886e22) e((o << 31 | 2139095040) >>> 0, i, n); else if (r < 11754943508222875e-54) e((o << 31 | Math.round(r / 1401298464324817e-60)) >>> 0, i, n); else {
  1724. var s = Math.floor(Math.log(r) / Math.LN2);
  1725. e((o << 31 | s + 127 << 23 | 8388607 & Math.round(r * Math.pow(2, -s) * 8388608)) >>> 0, i, n);
  1726. }
  1727. }
  1728. function readFloat_ieee754(e, r, i) {
  1729. var n = e(r, i), o = 2 * (n >> 31) + 1, s = n >>> 23 & 255, a = 8388607 & n;
  1730. return 255 === s ? a ? NaN : o * (1 / 0) : 0 === s ? 1401298464324817e-60 * o * a : o * Math.pow(2, s - 150) * (a + 8388608);
  1731. }
  1732. e.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE), e.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE),
  1733. e.readFloatLE = readFloat_ieee754.bind(null, readUintLE), e.readFloatBE = readFloat_ieee754.bind(null, readUintBE);
  1734. }(), "undefined" != typeof Float64Array ? function() {
  1735. var r = new Float64Array([ -0 ]), i = new Uint8Array(r.buffer), n = 128 === i[7];
  1736. function writeDouble_f64_cpy(e, n, o) {
  1737. r[0] = e, n[o] = i[0], n[o + 1] = i[1], n[o + 2] = i[2], n[o + 3] = i[3], n[o + 4] = i[4],
  1738. n[o + 5] = i[5], n[o + 6] = i[6], n[o + 7] = i[7];
  1739. }
  1740. function writeDouble_f64_rev(e, n, o) {
  1741. r[0] = e, n[o] = i[7], n[o + 1] = i[6], n[o + 2] = i[5], n[o + 3] = i[4], n[o + 4] = i[3],
  1742. n[o + 5] = i[2], n[o + 6] = i[1], n[o + 7] = i[0];
  1743. }
  1744. function readDouble_f64_cpy(e, n) {
  1745. return i[0] = e[n], i[1] = e[n + 1], i[2] = e[n + 2], i[3] = e[n + 3], i[4] = e[n + 4],
  1746. i[5] = e[n + 5], i[6] = e[n + 6], i[7] = e[n + 7], r[0];
  1747. }
  1748. function readDouble_f64_rev(e, n) {
  1749. return i[7] = e[n], i[6] = e[n + 1], i[5] = e[n + 2], i[4] = e[n + 3], i[3] = e[n + 4],
  1750. i[2] = e[n + 5], i[1] = e[n + 6], i[0] = e[n + 7], r[0];
  1751. }
  1752. e.writeDoubleLE = n ? writeDouble_f64_cpy : writeDouble_f64_rev, e.writeDoubleBE = n ? writeDouble_f64_rev : writeDouble_f64_cpy,
  1753. e.readDoubleLE = n ? readDouble_f64_cpy : readDouble_f64_rev, e.readDoubleBE = n ? readDouble_f64_rev : readDouble_f64_cpy;
  1754. }() : function() {
  1755. function writeDouble_ieee754(e, r, i, n, o, s) {
  1756. var a = n < 0 ? 1 : 0;
  1757. if (a && (n = -n), 0 === n) e(0, o, s + r), e(1 / n > 0 ? 0 : 2147483648, o, s + i); else if (isNaN(n)) e(0, o, s + r),
  1758. e(2146959360, o, s + i); else if (n > 17976931348623157e292) e(0, o, s + r), e((a << 31 | 2146435072) >>> 0, o, s + i); else {
  1759. var u;
  1760. if (n < 22250738585072014e-324) e((u = n / 5e-324) >>> 0, o, s + r), e((a << 31 | u / 4294967296) >>> 0, o, s + i); else {
  1761. var l = Math.floor(Math.log(n) / Math.LN2);
  1762. 1024 === l && (l = 1023), e(4503599627370496 * (u = n * Math.pow(2, -l)) >>> 0, o, s + r),
  1763. e((a << 31 | l + 1023 << 20 | 1048576 * u & 1048575) >>> 0, o, s + i);
  1764. }
  1765. }
  1766. }
  1767. function readDouble_ieee754(e, r, i, n, o) {
  1768. var s = e(n, o + r), a = e(n, o + i), u = 2 * (a >> 31) + 1, l = a >>> 20 & 2047, f = 4294967296 * (1048575 & a) + s;
  1769. return 2047 === l ? f ? NaN : u * (1 / 0) : 0 === l ? 5e-324 * u * f : u * Math.pow(2, l - 1075) * (f + 4503599627370496);
  1770. }
  1771. e.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4), e.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0),
  1772. e.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4), e.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);
  1773. }(), e;
  1774. }
  1775. function writeUintLE(e, r, i) {
  1776. r[i] = 255 & e, r[i + 1] = e >>> 8 & 255, r[i + 2] = e >>> 16 & 255, r[i + 3] = e >>> 24;
  1777. }
  1778. function writeUintBE(e, r, i) {
  1779. r[i] = e >>> 24, r[i + 1] = e >>> 16 & 255, r[i + 2] = e >>> 8 & 255, r[i + 3] = 255 & e;
  1780. }
  1781. function readUintLE(e, r) {
  1782. return (e[r] | e[r + 1] << 8 | e[r + 2] << 16 | e[r + 3] << 24) >>> 0;
  1783. }
  1784. function readUintBE(e, r) {
  1785. return (e[r] << 24 | e[r + 1] << 16 | e[r + 2] << 8 | e[r + 3]) >>> 0;
  1786. }
  1787. return hasRequiredFloat = 1, float = factory(factory);
  1788. }
  1789. function requireInquire() {
  1790. if (hasRequiredInquire) return inquire_1;
  1791. function inquire(moduleName) {
  1792. try {
  1793. var mod = eval("quire".replace(/^/, "re"))(moduleName);
  1794. if (mod && (mod.length || Object.keys(mod).length)) return mod;
  1795. } catch (e) {}
  1796. return null;
  1797. }
  1798. return hasRequiredInquire = 1, inquire_1 = inquire, inquire_1;
  1799. }
  1800. var utf8$2 = {}, hasRequiredUtf8, pool_1, hasRequiredPool, longbits, hasRequiredLongbits, hasRequiredMinimal;
  1801. function requireUtf8() {
  1802. return hasRequiredUtf8 || (hasRequiredUtf8 = 1, function(e) {
  1803. var r = e;
  1804. r.length = function utf8_length(e) {
  1805. for (var r = 0, i = 0, n = 0; n < e.length; ++n) (i = e.charCodeAt(n)) < 128 ? r += 1 : i < 2048 ? r += 2 : 55296 == (64512 & i) && 56320 == (64512 & e.charCodeAt(n + 1)) ? (++n,
  1806. r += 4) : r += 3;
  1807. return r;
  1808. }, r.read = function utf8_read(e, r, i) {
  1809. if (i - r < 1) return "";
  1810. for (var n, o = null, s = [], a = 0; r < i; ) (n = e[r++]) < 128 ? s[a++] = n : n > 191 && n < 224 ? s[a++] = (31 & n) << 6 | 63 & e[r++] : n > 239 && n < 365 ? (n = ((7 & n) << 18 | (63 & e[r++]) << 12 | (63 & e[r++]) << 6 | 63 & e[r++]) - 65536,
  1811. s[a++] = 55296 + (n >> 10), s[a++] = 56320 + (1023 & n)) : s[a++] = (15 & n) << 12 | (63 & e[r++]) << 6 | 63 & e[r++],
  1812. a > 8191 && ((o || (o = [])).push(String.fromCharCode.apply(String, s)), a = 0);
  1813. return o ? (a && o.push(String.fromCharCode.apply(String, s.slice(0, a))), o.join("")) : String.fromCharCode.apply(String, s.slice(0, a));
  1814. }, r.write = function utf8_write(e, r, i) {
  1815. for (var n, o, s = i, a = 0; a < e.length; ++a) (n = e.charCodeAt(a)) < 128 ? r[i++] = n : n < 2048 ? (r[i++] = n >> 6 | 192,
  1816. r[i++] = 63 & n | 128) : 55296 == (64512 & n) && 56320 == (64512 & (o = e.charCodeAt(a + 1))) ? (n = 65536 + ((1023 & n) << 10) + (1023 & o),
  1817. ++a, r[i++] = n >> 18 | 240, r[i++] = n >> 12 & 63 | 128, r[i++] = n >> 6 & 63 | 128,
  1818. r[i++] = 63 & n | 128) : (r[i++] = n >> 12 | 224, r[i++] = n >> 6 & 63 | 128, r[i++] = 63 & n | 128);
  1819. return i - s;
  1820. };
  1821. }(utf8$2)), utf8$2;
  1822. }
  1823. function requirePool() {
  1824. if (hasRequiredPool) return pool_1;
  1825. return hasRequiredPool = 1, pool_1 = function pool(e, r, i) {
  1826. var n = i || 8192, o = n >>> 1, s = null, a = n;
  1827. return function pool_alloc(i) {
  1828. if (i < 1 || i > o) return e(i);
  1829. a + i > n && (s = e(n), a = 0);
  1830. var u = r.call(s, a, a += i);
  1831. return 7 & a && (a = 1 + (7 | a)), u;
  1832. };
  1833. };
  1834. }
  1835. function requireLongbits() {
  1836. if (hasRequiredLongbits) return longbits;
  1837. hasRequiredLongbits = 1, longbits = LongBits;
  1838. var e = requireMinimal();
  1839. function LongBits(e, r) {
  1840. this.lo = e >>> 0, this.hi = r >>> 0;
  1841. }
  1842. var r = LongBits.zero = new LongBits(0, 0);
  1843. r.toNumber = function() {
  1844. return 0;
  1845. }, r.zzEncode = r.zzDecode = function() {
  1846. return this;
  1847. }, r.length = function() {
  1848. return 1;
  1849. };
  1850. var i = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";
  1851. LongBits.fromNumber = function fromNumber(e) {
  1852. if (0 === e) return r;
  1853. var i = e < 0;
  1854. i && (e = -e);
  1855. var n = e >>> 0, o = (e - n) / 4294967296 >>> 0;
  1856. return i && (o = ~o >>> 0, n = ~n >>> 0, ++n > 4294967295 && (n = 0, ++o > 4294967295 && (o = 0))),
  1857. new LongBits(n, o);
  1858. }, LongBits.from = function from(i) {
  1859. if ("number" == typeof i) return LongBits.fromNumber(i);
  1860. if (e.isString(i)) {
  1861. if (!e.Long) return LongBits.fromNumber(parseInt(i, 10));
  1862. i = e.Long.fromString(i);
  1863. }
  1864. return i.low || i.high ? new LongBits(i.low >>> 0, i.high >>> 0) : r;
  1865. }, LongBits.prototype.toNumber = function toNumber(e) {
  1866. if (!e && this.hi >>> 31) {
  1867. var r = 1 + ~this.lo >>> 0, i = ~this.hi >>> 0;
  1868. return r || (i = i + 1 >>> 0), -(r + 4294967296 * i);
  1869. }
  1870. return this.lo + 4294967296 * this.hi;
  1871. }, LongBits.prototype.toLong = function toLong(r) {
  1872. return e.Long ? new e.Long(0 | this.lo, 0 | this.hi, Boolean(r)) : {
  1873. low: 0 | this.lo,
  1874. high: 0 | this.hi,
  1875. unsigned: Boolean(r)
  1876. };
  1877. };
  1878. var n = String.prototype.charCodeAt;
  1879. return LongBits.fromHash = function fromHash(e) {
  1880. return e === i ? r : new LongBits((n.call(e, 0) | n.call(e, 1) << 8 | n.call(e, 2) << 16 | n.call(e, 3) << 24) >>> 0, (n.call(e, 4) | n.call(e, 5) << 8 | n.call(e, 6) << 16 | n.call(e, 7) << 24) >>> 0);
  1881. }, LongBits.prototype.toHash = function toHash() {
  1882. return String.fromCharCode(255 & this.lo, this.lo >>> 8 & 255, this.lo >>> 16 & 255, this.lo >>> 24, 255 & this.hi, this.hi >>> 8 & 255, this.hi >>> 16 & 255, this.hi >>> 24);
  1883. }, LongBits.prototype.zzEncode = function zzEncode() {
  1884. var e = this.hi >> 31;
  1885. return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ e) >>> 0, this.lo = (this.lo << 1 ^ e) >>> 0,
  1886. this;
  1887. }, LongBits.prototype.zzDecode = function zzDecode() {
  1888. var e = -(1 & this.lo);
  1889. return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ e) >>> 0, this.hi = (this.hi >>> 1 ^ e) >>> 0,
  1890. this;
  1891. }, LongBits.prototype.length = function length() {
  1892. var e = this.lo, r = (this.lo >>> 28 | this.hi << 4) >>> 0, i = this.hi >>> 24;
  1893. return 0 === i ? 0 === r ? e < 16384 ? e < 128 ? 1 : 2 : e < 2097152 ? 3 : 4 : r < 16384 ? r < 128 ? 5 : 6 : r < 2097152 ? 7 : 8 : i < 128 ? 9 : 10;
  1894. }, longbits;
  1895. }
  1896. function requireMinimal() {
  1897. return hasRequiredMinimal || (hasRequiredMinimal = 1, function(e) {
  1898. var r = e;
  1899. function merge(e, r, i) {
  1900. for (var n = Object.keys(r), o = 0; o < n.length; ++o) void 0 !== e[n[o]] && i || (e[n[o]] = r[n[o]]);
  1901. return e;
  1902. }
  1903. function newError(e) {
  1904. function CustomError(e, r) {
  1905. if (!(this instanceof CustomError)) return new CustomError(e, r);
  1906. Object.defineProperty(this, "message", {
  1907. get: function() {
  1908. return e;
  1909. }
  1910. }), Error.captureStackTrace ? Error.captureStackTrace(this, CustomError) : Object.defineProperty(this, "stack", {
  1911. value: (new Error).stack || ""
  1912. }), r && merge(this, r);
  1913. }
  1914. return CustomError.prototype = Object.create(Error.prototype, {
  1915. constructor: {
  1916. value: CustomError,
  1917. writable: !0,
  1918. enumerable: !1,
  1919. configurable: !0
  1920. },
  1921. name: {
  1922. get: function get() {
  1923. return e;
  1924. },
  1925. set: void 0,
  1926. enumerable: !1,
  1927. configurable: !0
  1928. },
  1929. toString: {
  1930. value: function value() {
  1931. return this.name + ": " + this.message;
  1932. },
  1933. writable: !0,
  1934. enumerable: !1,
  1935. configurable: !0
  1936. }
  1937. }), CustomError;
  1938. }
  1939. r.asPromise = requireAspromise(), r.base64 = requireBase64(), r.EventEmitter = requireEventemitter(),
  1940. r.float = requireFloat(), r.inquire = requireInquire(), r.utf8 = requireUtf8(),
  1941. r.pool = requirePool(), r.LongBits = requireLongbits(), r.isNode = Boolean(void 0 !== commonjsGlobal && commonjsGlobal && commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node),
  1942. r.global = r.isNode && commonjsGlobal || "undefined" != typeof window && window || "undefined" != typeof self && self || commonjsGlobal,
  1943. r.emptyArray = Object.freeze ? Object.freeze([]) : [], r.emptyObject = Object.freeze ? Object.freeze({}) : {},
  1944. r.isInteger = Number.isInteger || function isInteger(e) {
  1945. return "number" == typeof e && isFinite(e) && Math.floor(e) === e;
  1946. }, r.isString = function isString(e) {
  1947. return "string" == typeof e || e instanceof String;
  1948. }, r.isObject = function isObject(e) {
  1949. return e && "object" == typeof e;
  1950. }, r.isset = r.isSet = function isSet(e, r) {
  1951. var i = e[r];
  1952. return !(null == i || !e.hasOwnProperty(r)) && ("object" != typeof i || (Array.isArray(i) ? i.length : Object.keys(i).length) > 0);
  1953. }, r.Buffer = function() {
  1954. try {
  1955. var e = r.inquire("buffer").Buffer;
  1956. return e.prototype.utf8Write ? e : null;
  1957. } catch (e) {
  1958. return null;
  1959. }
  1960. }(), r._Buffer_from = null, r._Buffer_allocUnsafe = null, r.newBuffer = function newBuffer(e) {
  1961. return "number" == typeof e ? r.Buffer ? r._Buffer_allocUnsafe(e) : new r.Array(e) : r.Buffer ? r._Buffer_from(e) : "undefined" == typeof Uint8Array ? e : new Uint8Array(e);
  1962. }, r.Array = "undefined" != typeof Uint8Array ? Uint8Array : Array, r.Long = r.global.dcodeIO && r.global.dcodeIO.Long || r.global.Long || r.inquire("long"),
  1963. r.key2Re = /^true|false|0|1$/, r.key32Re = /^-?(?:0|[1-9][0-9]*)$/, r.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,
  1964. r.longToHash = function longToHash(e) {
  1965. return e ? r.LongBits.from(e).toHash() : r.LongBits.zeroHash;
  1966. }, r.longFromHash = function longFromHash(e, i) {
  1967. var n = r.LongBits.fromHash(e);
  1968. return r.Long ? r.Long.fromBits(n.lo, n.hi, i) : n.toNumber(Boolean(i));
  1969. }, r.merge = merge, r.lcFirst = function lcFirst(e) {
  1970. return e.charAt(0).toLowerCase() + e.substring(1);
  1971. }, r.newError = newError, r.ProtocolError = newError("ProtocolError"), r.oneOfGetter = function getOneOf(e) {
  1972. for (var r = {}, i = 0; i < e.length; ++i) r[e[i]] = 1;
  1973. return function() {
  1974. for (var e = Object.keys(this), i = e.length - 1; i > -1; --i) if (1 === r[e[i]] && void 0 !== this[e[i]] && null !== this[e[i]]) return e[i];
  1975. };
  1976. }, r.oneOfSetter = function setOneOf(e) {
  1977. return function(r) {
  1978. for (var i = 0; i < e.length; ++i) e[i] !== r && delete this[e[i]];
  1979. };
  1980. }, r.toJSONOptions = {
  1981. longs: String,
  1982. enums: String,
  1983. bytes: String,
  1984. json: !0
  1985. }, r._configure = function() {
  1986. var e = r.Buffer;
  1987. e ? (r._Buffer_from = e.from !== Uint8Array.from && e.from || function Buffer_from(r, i) {
  1988. return new e(r, i);
  1989. }, r._Buffer_allocUnsafe = e.allocUnsafe || function Buffer_allocUnsafe(r) {
  1990. return new e(r);
  1991. }) : r._Buffer_from = r._Buffer_allocUnsafe = null;
  1992. };
  1993. }(minimal)), minimal;
  1994. }
  1995. var writer = Writer$1, util$7 = requireMinimal(), BufferWriter$1, LongBits$1 = util$7.LongBits, base64 = util$7.base64, utf8$1 = util$7.utf8;
  1996. function Op(e, r, i) {
  1997. this.fn = e, this.len = r, this.next = void 0, this.val = i;
  1998. }
  1999. function noop() {}
  2000. function State(e) {
  2001. this.head = e.head, this.tail = e.tail, this.len = e.len, this.next = e.states;
  2002. }
  2003. function Writer$1() {
  2004. this.len = 0, this.head = new Op(noop, 0, 0), this.tail = this.head, this.states = null;
  2005. }
  2006. var create$1 = function create() {
  2007. return util$7.Buffer ? function create_buffer_setup() {
  2008. return (Writer$1.create = function create_buffer() {
  2009. return new BufferWriter$1;
  2010. })();
  2011. } : function create_array() {
  2012. return new Writer$1;
  2013. };
  2014. };
  2015. function writeByte(e, r, i) {
  2016. r[i] = 255 & e;
  2017. }
  2018. function writeVarint32(e, r, i) {
  2019. for (;e > 127; ) r[i++] = 127 & e | 128, e >>>= 7;
  2020. r[i] = e;
  2021. }
  2022. function VarintOp(e, r) {
  2023. this.len = e, this.next = void 0, this.val = r;
  2024. }
  2025. function writeVarint64(e, r, i) {
  2026. for (;e.hi; ) r[i++] = 127 & e.lo | 128, e.lo = (e.lo >>> 7 | e.hi << 25) >>> 0,
  2027. e.hi >>>= 7;
  2028. for (;e.lo > 127; ) r[i++] = 127 & e.lo | 128, e.lo = e.lo >>> 7;
  2029. r[i++] = e.lo;
  2030. }
  2031. function writeFixed32(e, r, i) {
  2032. r[i] = 255 & e, r[i + 1] = e >>> 8 & 255, r[i + 2] = e >>> 16 & 255, r[i + 3] = e >>> 24;
  2033. }
  2034. Writer$1.create = create$1(), Writer$1.alloc = function alloc(e) {
  2035. return new util$7.Array(e);
  2036. }, util$7.Array !== Array && (Writer$1.alloc = util$7.pool(Writer$1.alloc, util$7.Array.prototype.subarray)),
  2037. Writer$1.prototype._push = function push(e, r, i) {
  2038. return this.tail = this.tail.next = new Op(e, r, i), this.len += r, this;
  2039. }, VarintOp.prototype = Object.create(Op.prototype), VarintOp.prototype.fn = writeVarint32,
  2040. Writer$1.prototype.uint32 = function write_uint32(e) {
  2041. return this.len += (this.tail = this.tail.next = new VarintOp((e >>>= 0) < 128 ? 1 : e < 16384 ? 2 : e < 2097152 ? 3 : e < 268435456 ? 4 : 5, e)).len,
  2042. this;
  2043. }, Writer$1.prototype.int32 = function write_int32(e) {
  2044. return e < 0 ? this._push(writeVarint64, 10, LongBits$1.fromNumber(e)) : this.uint32(e);
  2045. }, Writer$1.prototype.sint32 = function write_sint32(e) {
  2046. return this.uint32((e << 1 ^ e >> 31) >>> 0);
  2047. }, Writer$1.prototype.uint64 = function write_uint64(e) {
  2048. var r = LongBits$1.from(e);
  2049. return this._push(writeVarint64, r.length(), r);
  2050. }, Writer$1.prototype.int64 = Writer$1.prototype.uint64, Writer$1.prototype.sint64 = function write_sint64(e) {
  2051. var r = LongBits$1.from(e).zzEncode();
  2052. return this._push(writeVarint64, r.length(), r);
  2053. }, Writer$1.prototype.bool = function write_bool(e) {
  2054. return this._push(writeByte, 1, e ? 1 : 0);
  2055. }, Writer$1.prototype.fixed32 = function write_fixed32(e) {
  2056. return this._push(writeFixed32, 4, e >>> 0);
  2057. }, Writer$1.prototype.sfixed32 = Writer$1.prototype.fixed32, Writer$1.prototype.fixed64 = function write_fixed64(e) {
  2058. var r = LongBits$1.from(e);
  2059. return this._push(writeFixed32, 4, r.lo)._push(writeFixed32, 4, r.hi);
  2060. }, Writer$1.prototype.sfixed64 = Writer$1.prototype.fixed64, Writer$1.prototype.float = function write_float(e) {
  2061. return this._push(util$7.float.writeFloatLE, 4, e);
  2062. }, Writer$1.prototype.double = function write_double(e) {
  2063. return this._push(util$7.float.writeDoubleLE, 8, e);
  2064. };
  2065. var writeBytes = util$7.Array.prototype.set ? function writeBytes_set(e, r, i) {
  2066. r.set(e, i);
  2067. } : function writeBytes_for(e, r, i) {
  2068. for (var n = 0; n < e.length; ++n) r[i + n] = e[n];
  2069. };
  2070. Writer$1.prototype.bytes = function write_bytes(e) {
  2071. var r = e.length >>> 0;
  2072. if (!r) return this._push(writeByte, 1, 0);
  2073. if (util$7.isString(e)) {
  2074. var i = Writer$1.alloc(r = base64.length(e));
  2075. base64.decode(e, i, 0), e = i;
  2076. }
  2077. return this.uint32(r)._push(writeBytes, r, e);
  2078. }, Writer$1.prototype.string = function write_string(e) {
  2079. var r = utf8$1.length(e);
  2080. return r ? this.uint32(r)._push(utf8$1.write, r, e) : this._push(writeByte, 1, 0);
  2081. }, Writer$1.prototype.fork = function fork() {
  2082. return this.states = new State(this), this.head = this.tail = new Op(noop, 0, 0),
  2083. this.len = 0, this;
  2084. }, Writer$1.prototype.reset = function reset() {
  2085. return this.states ? (this.head = this.states.head, this.tail = this.states.tail,
  2086. this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new Op(noop, 0, 0),
  2087. this.len = 0), this;
  2088. }, Writer$1.prototype.ldelim = function ldelim() {
  2089. var e = this.head, r = this.tail, i = this.len;
  2090. return this.reset().uint32(i), i && (this.tail.next = e.next, this.tail = r, this.len += i),
  2091. this;
  2092. }, Writer$1.prototype.finish = function finish() {
  2093. for (var e = this.head.next, r = this.constructor.alloc(this.len), i = 0; e; ) e.fn(e.val, r, i),
  2094. i += e.len, e = e.next;
  2095. return r;
  2096. }, Writer$1._configure = function(e) {
  2097. BufferWriter$1 = e, Writer$1.create = create$1(), BufferWriter$1._configure();
  2098. };
  2099. var writer_buffer = BufferWriter, Writer = writer;
  2100. (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
  2101. var util$6 = requireMinimal();
  2102. function BufferWriter() {
  2103. Writer.call(this);
  2104. }
  2105. function writeStringBuffer(e, r, i) {
  2106. e.length < 40 ? util$6.utf8.write(e, r, i) : r.utf8Write ? r.utf8Write(e, i) : r.write(e, i);
  2107. }
  2108. BufferWriter._configure = function() {
  2109. BufferWriter.alloc = util$6._Buffer_allocUnsafe, BufferWriter.writeBytesBuffer = util$6.Buffer && util$6.Buffer.prototype instanceof Uint8Array && "set" === util$6.Buffer.prototype.set.name ? function writeBytesBuffer_set(e, r, i) {
  2110. r.set(e, i);
  2111. } : function writeBytesBuffer_copy(e, r, i) {
  2112. if (e.copy) e.copy(r, i, 0, e.length); else for (var n = 0; n < e.length; ) r[i++] = e[n++];
  2113. };
  2114. }, BufferWriter.prototype.bytes = function write_bytes_buffer(e) {
  2115. util$6.isString(e) && (e = util$6._Buffer_from(e, "base64"));
  2116. var r = e.length >>> 0;
  2117. return this.uint32(r), r && this._push(BufferWriter.writeBytesBuffer, r, e), this;
  2118. }, BufferWriter.prototype.string = function write_string_buffer(e) {
  2119. var r = util$6.Buffer.byteLength(e);
  2120. return this.uint32(r), r && this._push(writeStringBuffer, r, e), this;
  2121. }, BufferWriter._configure();
  2122. var reader = Reader$1, util$5 = requireMinimal(), BufferReader$1, LongBits = util$5.LongBits, utf8 = util$5.utf8;
  2123. function indexOutOfRange(e, r) {
  2124. return RangeError("index out of range: " + e.pos + " + " + (r || 1) + " > " + e.len);
  2125. }
  2126. function Reader$1(e) {
  2127. this.buf = e, this.pos = 0, this.len = e.length;
  2128. }
  2129. var create_array = "undefined" != typeof Uint8Array ? function create_typed_array(e) {
  2130. if (e instanceof Uint8Array || Array.isArray(e)) return new Reader$1(e);
  2131. throw Error("illegal buffer");
  2132. } : function create_array(e) {
  2133. if (Array.isArray(e)) return new Reader$1(e);
  2134. throw Error("illegal buffer");
  2135. }, create = function create() {
  2136. return util$5.Buffer ? function create_buffer_setup(e) {
  2137. return (Reader$1.create = function create_buffer(e) {
  2138. return util$5.Buffer.isBuffer(e) ? new BufferReader$1(e) : create_array(e);
  2139. })(e);
  2140. } : create_array;
  2141. };
  2142. function readLongVarint() {
  2143. var e = new LongBits(0, 0), r = 0;
  2144. if (!(this.len - this.pos > 4)) {
  2145. for (;r < 3; ++r) {
  2146. if (this.pos >= this.len) throw indexOutOfRange(this);
  2147. if (e.lo = (e.lo | (127 & this.buf[this.pos]) << 7 * r) >>> 0, this.buf[this.pos++] < 128) return e;
  2148. }
  2149. return e.lo = (e.lo | (127 & this.buf[this.pos++]) << 7 * r) >>> 0, e;
  2150. }
  2151. for (;r < 4; ++r) if (e.lo = (e.lo | (127 & this.buf[this.pos]) << 7 * r) >>> 0,
  2152. this.buf[this.pos++] < 128) return e;
  2153. if (e.lo = (e.lo | (127 & this.buf[this.pos]) << 28) >>> 0, e.hi = (e.hi | (127 & this.buf[this.pos]) >> 4) >>> 0,
  2154. this.buf[this.pos++] < 128) return e;
  2155. if (r = 0, this.len - this.pos > 4) {
  2156. for (;r < 5; ++r) if (e.hi = (e.hi | (127 & this.buf[this.pos]) << 7 * r + 3) >>> 0,
  2157. this.buf[this.pos++] < 128) return e;
  2158. } else for (;r < 5; ++r) {
  2159. if (this.pos >= this.len) throw indexOutOfRange(this);
  2160. if (e.hi = (e.hi | (127 & this.buf[this.pos]) << 7 * r + 3) >>> 0, this.buf[this.pos++] < 128) return e;
  2161. }
  2162. throw Error("invalid varint encoding");
  2163. }
  2164. function readFixed32_end(e, r) {
  2165. return (e[r - 4] | e[r - 3] << 8 | e[r - 2] << 16 | e[r - 1] << 24) >>> 0;
  2166. }
  2167. function readFixed64() {
  2168. if (this.pos + 8 > this.len) throw indexOutOfRange(this, 8);
  2169. return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
  2170. }
  2171. Reader$1.create = create(), Reader$1.prototype._slice = util$5.Array.prototype.subarray || util$5.Array.prototype.slice,
  2172. Reader$1.prototype.uint32 = function read_uint32_setup() {
  2173. var e = 4294967295;
  2174. return function read_uint32() {
  2175. if (e = (127 & this.buf[this.pos]) >>> 0, this.buf[this.pos++] < 128) return e;
  2176. if (e = (e | (127 & this.buf[this.pos]) << 7) >>> 0, this.buf[this.pos++] < 128) return e;
  2177. if (e = (e | (127 & this.buf[this.pos]) << 14) >>> 0, this.buf[this.pos++] < 128) return e;
  2178. if (e = (e | (127 & this.buf[this.pos]) << 21) >>> 0, this.buf[this.pos++] < 128) return e;
  2179. if (e = (e | (15 & this.buf[this.pos]) << 28) >>> 0, this.buf[this.pos++] < 128) return e;
  2180. if ((this.pos += 5) > this.len) throw this.pos = this.len, indexOutOfRange(this, 10);
  2181. return e;
  2182. };
  2183. }(), Reader$1.prototype.int32 = function read_int32() {
  2184. return 0 | this.uint32();
  2185. }, Reader$1.prototype.sint32 = function read_sint32() {
  2186. var e = this.uint32();
  2187. return e >>> 1 ^ -(1 & e) | 0;
  2188. }, Reader$1.prototype.bool = function read_bool() {
  2189. return 0 !== this.uint32();
  2190. }, Reader$1.prototype.fixed32 = function read_fixed32() {
  2191. if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4);
  2192. return readFixed32_end(this.buf, this.pos += 4);
  2193. }, Reader$1.prototype.sfixed32 = function read_sfixed32() {
  2194. if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4);
  2195. return 0 | readFixed32_end(this.buf, this.pos += 4);
  2196. }, Reader$1.prototype.float = function read_float() {
  2197. if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4);
  2198. var e = util$5.float.readFloatLE(this.buf, this.pos);
  2199. return this.pos += 4, e;
  2200. }, Reader$1.prototype.double = function read_double() {
  2201. if (this.pos + 8 > this.len) throw indexOutOfRange(this, 4);
  2202. var e = util$5.float.readDoubleLE(this.buf, this.pos);
  2203. return this.pos += 8, e;
  2204. }, Reader$1.prototype.bytes = function read_bytes() {
  2205. var e = this.uint32(), r = this.pos, i = this.pos + e;
  2206. if (i > this.len) throw indexOutOfRange(this, e);
  2207. return this.pos += e, Array.isArray(this.buf) ? this.buf.slice(r, i) : r === i ? new this.buf.constructor(0) : this._slice.call(this.buf, r, i);
  2208. }, Reader$1.prototype.string = function read_string() {
  2209. var e = this.bytes();
  2210. return utf8.read(e, 0, e.length);
  2211. }, Reader$1.prototype.skip = function skip(e) {
  2212. if ("number" == typeof e) {
  2213. if (this.pos + e > this.len) throw indexOutOfRange(this, e);
  2214. this.pos += e;
  2215. } else do {
  2216. if (this.pos >= this.len) throw indexOutOfRange(this);
  2217. } while (128 & this.buf[this.pos++]);
  2218. return this;
  2219. }, Reader$1.prototype.skipType = function(e) {
  2220. switch (e) {
  2221. case 0:
  2222. this.skip();
  2223. break;
  2224. case 1:
  2225. this.skip(8);
  2226. break;
  2227. case 2:
  2228. this.skip(this.uint32());
  2229. break;
  2230. case 3:
  2231. for (;4 != (e = 7 & this.uint32()); ) this.skipType(e);
  2232. break;
  2233. case 5:
  2234. this.skip(4);
  2235. break;
  2236. default:
  2237. throw Error("invalid wire type " + e + " at offset " + this.pos);
  2238. }
  2239. return this;
  2240. }, Reader$1._configure = function(e) {
  2241. BufferReader$1 = e, Reader$1.create = create(), BufferReader$1._configure();
  2242. var r = util$5.Long ? "toLong" : "toNumber";
  2243. util$5.merge(Reader$1.prototype, {
  2244. int64: function read_int64() {
  2245. return readLongVarint.call(this)[r](!1);
  2246. },
  2247. uint64: function read_uint64() {
  2248. return readLongVarint.call(this)[r](!0);
  2249. },
  2250. sint64: function read_sint64() {
  2251. return readLongVarint.call(this).zzDecode()[r](!1);
  2252. },
  2253. fixed64: function read_fixed64() {
  2254. return readFixed64.call(this)[r](!0);
  2255. },
  2256. sfixed64: function read_sfixed64() {
  2257. return readFixed64.call(this)[r](!1);
  2258. }
  2259. });
  2260. };
  2261. var reader_buffer = BufferReader, Reader = reader;
  2262. (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
  2263. var util$4 = requireMinimal();
  2264. function BufferReader(e) {
  2265. Reader.call(this, e);
  2266. }
  2267. BufferReader._configure = function() {
  2268. util$4.Buffer && (BufferReader.prototype._slice = util$4.Buffer.prototype.slice);
  2269. }, BufferReader.prototype.string = function read_string_buffer() {
  2270. var e = this.uint32();
  2271. return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + e, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + e, this.len));
  2272. }, BufferReader._configure();
  2273. var rpc = {}, service$1 = Service$1, util$3 = requireMinimal();
  2274. function Service$1(e, r, i) {
  2275. if ("function" != typeof e) throw TypeError("rpcImpl must be a function");
  2276. util$3.EventEmitter.call(this), this.rpcImpl = e, this.requestDelimited = Boolean(r),
  2277. this.responseDelimited = Boolean(i);
  2278. }
  2279. (Service$1.prototype = Object.create(util$3.EventEmitter.prototype)).constructor = Service$1,
  2280. Service$1.prototype.rpcCall = function rpcCall(e, r, i, n, o) {
  2281. if (!n) throw TypeError("request must be specified");
  2282. var s = this;
  2283. if (!o) return util$3.asPromise(rpcCall, s, e, r, i, n);
  2284. if (s.rpcImpl) try {
  2285. return s.rpcImpl(e, r[s.requestDelimited ? "encodeDelimited" : "encode"](n).finish(), (function rpcCallback(r, n) {
  2286. if (r) return s.emit("error", r, e), o(r);
  2287. if (null !== n) {
  2288. if (!(n instanceof i)) try {
  2289. n = i[s.responseDelimited ? "decodeDelimited" : "decode"](n);
  2290. } catch (r) {
  2291. return s.emit("error", r, e), o(r);
  2292. }
  2293. return s.emit("data", n, e), o(null, n);
  2294. }
  2295. s.end(!0);
  2296. }));
  2297. } catch (r) {
  2298. return s.emit("error", r, e), void setTimeout((function() {
  2299. o(r);
  2300. }), 0);
  2301. } else setTimeout((function() {
  2302. o(Error("already ended"));
  2303. }), 0);
  2304. }, Service$1.prototype.end = function end(e) {
  2305. return this.rpcImpl && (e || this.rpcImpl(null, null, null), this.rpcImpl = null,
  2306. this.emit("end").off()), this;
  2307. }, function(e) {
  2308. e.Service = service$1;
  2309. }(rpc);
  2310. var roots = {};
  2311. !function(e) {
  2312. var r = e;
  2313. function configure() {
  2314. r.util._configure(), r.Writer._configure(r.BufferWriter), r.Reader._configure(r.BufferReader);
  2315. }
  2316. r.build = "minimal", r.Writer = writer, r.BufferWriter = writer_buffer, r.Reader = reader,
  2317. r.BufferReader = reader_buffer, r.util = requireMinimal(), r.rpc = rpc, r.roots = roots,
  2318. r.configure = configure, configure();
  2319. }(indexMinimal);
  2320. var util$2 = {
  2321. exports: {}
  2322. }, codegen_1 = codegen;
  2323. function codegen(e, r) {
  2324. "string" == typeof e && (r = e, e = void 0);
  2325. var i = [];
  2326. function Codegen(e) {
  2327. if ("string" != typeof e) {
  2328. var r = toString();
  2329. if (codegen.verbose && console.log("codegen: " + r), r = "return " + r, e) {
  2330. for (var n = Object.keys(e), o = new Array(n.length + 1), s = new Array(n.length), a = 0; a < n.length; ) o[a] = n[a],
  2331. s[a] = e[n[a++]];
  2332. return o[a] = r, Function.apply(null, o).apply(null, s);
  2333. }
  2334. return Function(r)();
  2335. }
  2336. for (var u = new Array(arguments.length - 1), l = 0; l < u.length; ) u[l] = arguments[++l];
  2337. if (l = 0, e = e.replace(/%([%dfijs])/g, (function replace(e, r) {
  2338. var i = u[l++];
  2339. switch (r) {
  2340. case "d":
  2341. case "f":
  2342. return String(Number(i));
  2343. case "i":
  2344. return String(Math.floor(i));
  2345. case "j":
  2346. return JSON.stringify(i);
  2347. case "s":
  2348. return String(i);
  2349. }
  2350. return "%";
  2351. })), l !== u.length) throw Error("parameter count mismatch");
  2352. return i.push(e), Codegen;
  2353. }
  2354. function toString(n) {
  2355. return "function " + (n || r || "") + "(" + (e && e.join(",") || "") + "){\n " + i.join("\n ") + "\n}";
  2356. }
  2357. return Codegen.toString = toString, Codegen;
  2358. }
  2359. codegen.verbose = !1;
  2360. var fetch_1 = fetch, asPromise = requireAspromise(), inquire = requireInquire(), fs = inquire("fs");
  2361. function fetch(e, r, i) {
  2362. return "function" == typeof r ? (i = r, r = {}) : r || (r = {}), i ? !r.xhr && fs && fs.readFile ? fs.readFile(e, (function fetchReadFileCallback(n, o) {
  2363. return n && "undefined" != typeof XMLHttpRequest ? fetch.xhr(e, r, i) : n ? i(n) : i(null, r.binary ? o : o.toString("utf8"));
  2364. })) : fetch.xhr(e, r, i) : asPromise(fetch, this, e, r);
  2365. }
  2366. fetch.xhr = function fetch_xhr(e, r, i) {
  2367. var n = new XMLHttpRequest;
  2368. n.onreadystatechange = function fetchOnReadyStateChange() {
  2369. if (4 === n.readyState) {
  2370. if (0 !== n.status && 200 !== n.status) return i(Error("status " + n.status));
  2371. if (r.binary) {
  2372. var e = n.response;
  2373. if (!e) {
  2374. e = [];
  2375. for (var o = 0; o < n.responseText.length; ++o) e.push(255 & n.responseText.charCodeAt(o));
  2376. }
  2377. return i(null, "undefined" != typeof Uint8Array ? new Uint8Array(e) : e);
  2378. }
  2379. return i(null, n.responseText);
  2380. }
  2381. }, r.binary && ("overrideMimeType" in n && n.overrideMimeType("text/plain; charset=x-user-defined"),
  2382. n.responseType = "arraybuffer"), n.open("GET", e), n.send();
  2383. };
  2384. var path = {};
  2385. !function(e) {
  2386. var r = e, i = r.isAbsolute = function isAbsolute(e) {
  2387. return /^(?:\/|\w+:)/.test(e);
  2388. }, n = r.normalize = function normalize(e) {
  2389. var r = (e = e.replace(/\\/g, "/").replace(/\/{2,}/g, "/")).split("/"), n = i(e), o = "";
  2390. n && (o = r.shift() + "/");
  2391. for (var s = 0; s < r.length; ) ".." === r[s] ? s > 0 && ".." !== r[s - 1] ? r.splice(--s, 2) : n ? r.splice(s, 1) : ++s : "." === r[s] ? r.splice(s, 1) : ++s;
  2392. return o + r.join("/");
  2393. };
  2394. r.resolve = function resolve(e, r, o) {
  2395. return o || (r = n(r)), i(r) ? r : (o || (e = n(e)), (e = e.replace(/(?:\/|^)[^/]+$/, "")).length ? n(e + "/" + r) : r);
  2396. };
  2397. }(path);
  2398. var types$1 = {}, hasRequiredTypes, field, hasRequiredField, oneof, hasRequiredOneof, namespace, hasRequiredNamespace, mapfield, hasRequiredMapfield, method, hasRequiredMethod, service, hasRequiredService;
  2399. function requireTypes() {
  2400. return hasRequiredTypes || (hasRequiredTypes = 1, function(e) {
  2401. var r = e, i = requireUtil(), n = [ "double", "float", "int32", "uint32", "sint32", "fixed32", "sfixed32", "int64", "uint64", "sint64", "fixed64", "sfixed64", "bool", "string", "bytes" ];
  2402. function bake(e, r) {
  2403. var i = 0, o = {};
  2404. for (r |= 0; i < e.length; ) o[n[i + r]] = e[i++];
  2405. return o;
  2406. }
  2407. r.basic = bake([ 1, 5, 0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0, 2, 2 ]), r.defaults = bake([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, !1, "", i.emptyArray, null ]),
  2408. r.long = bake([ 0, 0, 0, 1, 1 ], 7), r.mapKey = bake([ 0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0, 2 ], 2),
  2409. r.packed = bake([ 1, 5, 0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0 ]);
  2410. }(types$1)), types$1;
  2411. }
  2412. function requireField() {
  2413. if (hasRequiredField) return field;
  2414. hasRequiredField = 1, field = Field;
  2415. var e = requireObject();
  2416. ((Field.prototype = Object.create(e.prototype)).constructor = Field).className = "Field";
  2417. var r, i = require_enum(), n = requireTypes(), o = requireUtil(), s = /^required|optional|repeated$/;
  2418. function Field(r, i, a, u, l, f, h) {
  2419. if (o.isObject(u) ? (h = l, f = u, u = l = void 0) : o.isObject(l) && (h = f, f = l,
  2420. l = void 0), e.call(this, r, f), !o.isInteger(i) || i < 0) throw TypeError("id must be a non-negative integer");
  2421. if (!o.isString(a)) throw TypeError("type must be a string");
  2422. if (void 0 !== u && !s.test(u = u.toString().toLowerCase())) throw TypeError("rule must be a string rule");
  2423. if (void 0 !== l && !o.isString(l)) throw TypeError("extend must be a string");
  2424. "proto3_optional" === u && (u = "optional"), this.rule = u && "optional" !== u ? u : void 0,
  2425. this.type = a, this.id = i, this.extend = l || void 0, this.required = "required" === u,
  2426. this.optional = !this.required, this.repeated = "repeated" === u, this.map = !1,
  2427. this.message = null, this.partOf = null, this.typeDefault = null, this.defaultValue = null,
  2428. this.long = !!o.Long && void 0 !== n.long[a], this.bytes = "bytes" === a, this.resolvedType = null,
  2429. this.extensionField = null, this.declaringField = null, this._packed = null, this.comment = h;
  2430. }
  2431. return Field.fromJSON = function fromJSON(e, r) {
  2432. return new Field(e, r.id, r.type, r.rule, r.extend, r.options, r.comment);
  2433. }, Object.defineProperty(Field.prototype, "packed", {
  2434. get: function() {
  2435. return null === this._packed && (this._packed = !1 !== this.getOption("packed")),
  2436. this._packed;
  2437. }
  2438. }), Field.prototype.setOption = function setOption(r, i, n) {
  2439. return "packed" === r && (this._packed = null), e.prototype.setOption.call(this, r, i, n);
  2440. }, Field.prototype.toJSON = function toJSON(e) {
  2441. var r = !!e && Boolean(e.keepComments);
  2442. return o.toObject([ "rule", "optional" !== this.rule && this.rule || void 0, "type", this.type, "id", this.id, "extend", this.extend, "options", this.options, "comment", r ? this.comment : void 0 ]);
  2443. }, Field.prototype.resolve = function resolve() {
  2444. if (this.resolved) return this;
  2445. if (void 0 === (this.typeDefault = n.defaults[this.type]) ? (this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type),
  2446. this.resolvedType instanceof r ? this.typeDefault = null : this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]) : this.options && this.options.proto3_optional && (this.typeDefault = null),
  2447. this.options && null != this.options.default && (this.typeDefault = this.options.default,
  2448. this.resolvedType instanceof i && "string" == typeof this.typeDefault && (this.typeDefault = this.resolvedType.values[this.typeDefault])),
  2449. this.options && (!0 !== this.options.packed && (void 0 === this.options.packed || !this.resolvedType || this.resolvedType instanceof i) || delete this.options.packed,
  2450. Object.keys(this.options).length || (this.options = void 0)), this.long) this.typeDefault = o.Long.fromNumber(this.typeDefault, "u" === this.type.charAt(0)),
  2451. Object.freeze && Object.freeze(this.typeDefault); else if (this.bytes && "string" == typeof this.typeDefault) {
  2452. var s;
  2453. o.base64.test(this.typeDefault) ? o.base64.decode(this.typeDefault, s = o.newBuffer(o.base64.length(this.typeDefault)), 0) : o.utf8.write(this.typeDefault, s = o.newBuffer(o.utf8.length(this.typeDefault)), 0),
  2454. this.typeDefault = s;
  2455. }
  2456. return this.map ? this.defaultValue = o.emptyObject : this.repeated ? this.defaultValue = o.emptyArray : this.defaultValue = this.typeDefault,
  2457. this.parent instanceof r && (this.parent.ctor.prototype[this.name] = this.defaultValue),
  2458. e.prototype.resolve.call(this);
  2459. }, Field.d = function decorateField(e, r, i, n) {
  2460. return "function" == typeof r ? r = o.decorateType(r).name : r && "object" == typeof r && (r = o.decorateEnum(r).name),
  2461. function fieldDecorator(s, a) {
  2462. o.decorateType(s.constructor).add(new Field(a, e, r, i, {
  2463. default: n
  2464. }));
  2465. };
  2466. }, Field._configure = function configure(e) {
  2467. r = e;
  2468. }, field;
  2469. }
  2470. function requireOneof() {
  2471. if (hasRequiredOneof) return oneof;
  2472. hasRequiredOneof = 1, oneof = OneOf;
  2473. var e = requireObject();
  2474. ((OneOf.prototype = Object.create(e.prototype)).constructor = OneOf).className = "OneOf";
  2475. var r = requireField(), i = requireUtil();
  2476. function OneOf(r, i, n, o) {
  2477. if (Array.isArray(i) || (n = i, i = void 0), e.call(this, r, n), void 0 !== i && !Array.isArray(i)) throw TypeError("fieldNames must be an Array");
  2478. this.oneof = i || [], this.fieldsArray = [], this.comment = o;
  2479. }
  2480. function addFieldsToParent(e) {
  2481. if (e.parent) for (var r = 0; r < e.fieldsArray.length; ++r) e.fieldsArray[r].parent || e.parent.add(e.fieldsArray[r]);
  2482. }
  2483. return OneOf.fromJSON = function fromJSON(e, r) {
  2484. return new OneOf(e, r.oneof, r.options, r.comment);
  2485. }, OneOf.prototype.toJSON = function toJSON(e) {
  2486. var r = !!e && Boolean(e.keepComments);
  2487. return i.toObject([ "options", this.options, "oneof", this.oneof, "comment", r ? this.comment : void 0 ]);
  2488. }, OneOf.prototype.add = function add(e) {
  2489. if (!(e instanceof r)) throw TypeError("field must be a Field");
  2490. return e.parent && e.parent !== this.parent && e.parent.remove(e), this.oneof.push(e.name),
  2491. this.fieldsArray.push(e), e.partOf = this, addFieldsToParent(this), this;
  2492. }, OneOf.prototype.remove = function remove(e) {
  2493. if (!(e instanceof r)) throw TypeError("field must be a Field");
  2494. var i = this.fieldsArray.indexOf(e);
  2495. if (i < 0) throw Error(e + " is not a member of " + this);
  2496. return this.fieldsArray.splice(i, 1), (i = this.oneof.indexOf(e.name)) > -1 && this.oneof.splice(i, 1),
  2497. e.partOf = null, this;
  2498. }, OneOf.prototype.onAdd = function onAdd(r) {
  2499. e.prototype.onAdd.call(this, r);
  2500. for (var i = 0; i < this.oneof.length; ++i) {
  2501. var n = r.get(this.oneof[i]);
  2502. n && !n.partOf && (n.partOf = this, this.fieldsArray.push(n));
  2503. }
  2504. addFieldsToParent(this);
  2505. }, OneOf.prototype.onRemove = function onRemove(r) {
  2506. for (var i, n = 0; n < this.fieldsArray.length; ++n) (i = this.fieldsArray[n]).parent && i.parent.remove(i);
  2507. e.prototype.onRemove.call(this, r);
  2508. }, OneOf.d = function decorateOneOf() {
  2509. for (var e = new Array(arguments.length), r = 0; r < arguments.length; ) e[r] = arguments[r++];
  2510. return function oneOfDecorator(r, n) {
  2511. i.decorateType(r.constructor).add(new OneOf(n, e)), Object.defineProperty(r, n, {
  2512. get: i.oneOfGetter(e),
  2513. set: i.oneOfSetter(e)
  2514. });
  2515. };
  2516. }, oneof;
  2517. }
  2518. function requireNamespace() {
  2519. if (hasRequiredNamespace) return namespace;
  2520. hasRequiredNamespace = 1, namespace = Namespace;
  2521. var e = requireObject();
  2522. ((Namespace.prototype = Object.create(e.prototype)).constructor = Namespace).className = "Namespace";
  2523. var r, i, n, o = requireField(), s = requireUtil(), a = requireOneof();
  2524. function arrayToJSON(e, r) {
  2525. if (e && e.length) {
  2526. for (var i = {}, n = 0; n < e.length; ++n) i[e[n].name] = e[n].toJSON(r);
  2527. return i;
  2528. }
  2529. }
  2530. function Namespace(r, i) {
  2531. e.call(this, r, i), this.nested = void 0, this._nestedArray = null;
  2532. }
  2533. function clearCache(e) {
  2534. return e._nestedArray = null, e;
  2535. }
  2536. return Namespace.fromJSON = function fromJSON(e, r) {
  2537. return new Namespace(e, r.options).addJSON(r.nested);
  2538. }, Namespace.arrayToJSON = arrayToJSON, Namespace.isReservedId = function isReservedId(e, r) {
  2539. if (e) for (var i = 0; i < e.length; ++i) if ("string" != typeof e[i] && e[i][0] <= r && e[i][1] > r) return !0;
  2540. return !1;
  2541. }, Namespace.isReservedName = function isReservedName(e, r) {
  2542. if (e) for (var i = 0; i < e.length; ++i) if (e[i] === r) return !0;
  2543. return !1;
  2544. }, Object.defineProperty(Namespace.prototype, "nestedArray", {
  2545. get: function() {
  2546. return this._nestedArray || (this._nestedArray = s.toArray(this.nested));
  2547. }
  2548. }), Namespace.prototype.toJSON = function toJSON(e) {
  2549. return s.toObject([ "options", this.options, "nested", arrayToJSON(this.nestedArray, e) ]);
  2550. }, Namespace.prototype.addJSON = function addJSON(e) {
  2551. if (e) for (var s, a = Object.keys(e), u = 0; u < a.length; ++u) s = e[a[u]], this.add((void 0 !== s.fields ? r.fromJSON : void 0 !== s.values ? n.fromJSON : void 0 !== s.methods ? i.fromJSON : void 0 !== s.id ? o.fromJSON : Namespace.fromJSON)(a[u], s));
  2552. return this;
  2553. }, Namespace.prototype.get = function get(e) {
  2554. return this.nested && this.nested[e] || null;
  2555. }, Namespace.prototype.getEnum = function getEnum(e) {
  2556. if (this.nested && this.nested[e] instanceof n) return this.nested[e].values;
  2557. throw Error("no such enum: " + e);
  2558. }, Namespace.prototype.add = function add(e) {
  2559. if (!(e instanceof o && void 0 !== e.extend || e instanceof r || e instanceof a || e instanceof n || e instanceof i || e instanceof Namespace)) throw TypeError("object must be a valid nested object");
  2560. if (this.nested) {
  2561. var s = this.get(e.name);
  2562. if (s) {
  2563. if (!(s instanceof Namespace && e instanceof Namespace) || s instanceof r || s instanceof i) throw Error("duplicate name '" + e.name + "' in " + this);
  2564. for (var u = s.nestedArray, l = 0; l < u.length; ++l) e.add(u[l]);
  2565. this.remove(s), this.nested || (this.nested = {}), e.setOptions(s.options, !0);
  2566. }
  2567. } else this.nested = {};
  2568. return this.nested[e.name] = e, e.onAdd(this), clearCache(this);
  2569. }, Namespace.prototype.remove = function remove(r) {
  2570. if (!(r instanceof e)) throw TypeError("object must be a ReflectionObject");
  2571. if (r.parent !== this) throw Error(r + " is not a member of " + this);
  2572. return delete this.nested[r.name], Object.keys(this.nested).length || (this.nested = void 0),
  2573. r.onRemove(this), clearCache(this);
  2574. }, Namespace.prototype.define = function define(e, r) {
  2575. if (s.isString(e)) e = e.split("."); else if (!Array.isArray(e)) throw TypeError("illegal path");
  2576. if (e && e.length && "" === e[0]) throw Error("path must be relative");
  2577. for (var i = this; e.length > 0; ) {
  2578. var n = e.shift();
  2579. if (i.nested && i.nested[n]) {
  2580. if (!((i = i.nested[n]) instanceof Namespace)) throw Error("path conflicts with non-namespace objects");
  2581. } else i.add(i = new Namespace(n));
  2582. }
  2583. return r && i.addJSON(r), i;
  2584. }, Namespace.prototype.resolveAll = function resolveAll() {
  2585. for (var e = this.nestedArray, r = 0; r < e.length; ) e[r] instanceof Namespace ? e[r++].resolveAll() : e[r++].resolve();
  2586. return this.resolve();
  2587. }, Namespace.prototype.lookup = function lookup(e, r, i) {
  2588. if ("boolean" == typeof r ? (i = r, r = void 0) : r && !Array.isArray(r) && (r = [ r ]),
  2589. s.isString(e) && e.length) {
  2590. if ("." === e) return this.root;
  2591. e = e.split(".");
  2592. } else if (!e.length) return this;
  2593. if ("" === e[0]) return this.root.lookup(e.slice(1), r);
  2594. var n = this.get(e[0]);
  2595. if (n) {
  2596. if (1 === e.length) {
  2597. if (!r || r.indexOf(n.constructor) > -1) return n;
  2598. } else if (n instanceof Namespace && (n = n.lookup(e.slice(1), r, !0))) return n;
  2599. } else for (var o = 0; o < this.nestedArray.length; ++o) if (this._nestedArray[o] instanceof Namespace && (n = this._nestedArray[o].lookup(e, r, !0))) return n;
  2600. return null === this.parent || i ? null : this.parent.lookup(e, r);
  2601. }, Namespace.prototype.lookupType = function lookupType(e) {
  2602. var i = this.lookup(e, [ r ]);
  2603. if (!i) throw Error("no such type: " + e);
  2604. return i;
  2605. }, Namespace.prototype.lookupEnum = function lookupEnum(e) {
  2606. var r = this.lookup(e, [ n ]);
  2607. if (!r) throw Error("no such Enum '" + e + "' in " + this);
  2608. return r;
  2609. }, Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(e) {
  2610. var i = this.lookup(e, [ r, n ]);
  2611. if (!i) throw Error("no such Type or Enum '" + e + "' in " + this);
  2612. return i;
  2613. }, Namespace.prototype.lookupService = function lookupService(e) {
  2614. var r = this.lookup(e, [ i ]);
  2615. if (!r) throw Error("no such Service '" + e + "' in " + this);
  2616. return r;
  2617. }, Namespace._configure = function(e, o, s) {
  2618. r = e, i = o, n = s;
  2619. }, namespace;
  2620. }
  2621. function requireMapfield() {
  2622. if (hasRequiredMapfield) return mapfield;
  2623. hasRequiredMapfield = 1, mapfield = MapField;
  2624. var e = requireField();
  2625. ((MapField.prototype = Object.create(e.prototype)).constructor = MapField).className = "MapField";
  2626. var r = requireTypes(), i = requireUtil();
  2627. function MapField(r, n, o, s, a, u) {
  2628. if (e.call(this, r, n, s, void 0, void 0, a, u), !i.isString(o)) throw TypeError("keyType must be a string");
  2629. this.keyType = o, this.resolvedKeyType = null, this.map = !0;
  2630. }
  2631. return MapField.fromJSON = function fromJSON(e, r) {
  2632. return new MapField(e, r.id, r.keyType, r.type, r.options, r.comment);
  2633. }, MapField.prototype.toJSON = function toJSON(e) {
  2634. var r = !!e && Boolean(e.keepComments);
  2635. return i.toObject([ "keyType", this.keyType, "type", this.type, "id", this.id, "extend", this.extend, "options", this.options, "comment", r ? this.comment : void 0 ]);
  2636. }, MapField.prototype.resolve = function resolve() {
  2637. if (this.resolved) return this;
  2638. if (void 0 === r.mapKey[this.keyType]) throw Error("invalid key type: " + this.keyType);
  2639. return e.prototype.resolve.call(this);
  2640. }, MapField.d = function decorateMapField(e, r, n) {
  2641. return "function" == typeof n ? n = i.decorateType(n).name : n && "object" == typeof n && (n = i.decorateEnum(n).name),
  2642. function mapFieldDecorator(o, s) {
  2643. i.decorateType(o.constructor).add(new MapField(s, e, r, n));
  2644. };
  2645. }, mapfield;
  2646. }
  2647. function requireMethod() {
  2648. if (hasRequiredMethod) return method;
  2649. hasRequiredMethod = 1, method = Method;
  2650. var e = requireObject();
  2651. ((Method.prototype = Object.create(e.prototype)).constructor = Method).className = "Method";
  2652. var r = requireUtil();
  2653. function Method(i, n, o, s, a, u, l, f, h) {
  2654. if (r.isObject(a) ? (l = a, a = u = void 0) : r.isObject(u) && (l = u, u = void 0),
  2655. void 0 !== n && !r.isString(n)) throw TypeError("type must be a string");
  2656. if (!r.isString(o)) throw TypeError("requestType must be a string");
  2657. if (!r.isString(s)) throw TypeError("responseType must be a string");
  2658. e.call(this, i, l), this.type = n || "rpc", this.requestType = o, this.requestStream = !!a || void 0,
  2659. this.responseType = s, this.responseStream = !!u || void 0, this.resolvedRequestType = null,
  2660. this.resolvedResponseType = null, this.comment = f, this.parsedOptions = h;
  2661. }
  2662. return Method.fromJSON = function fromJSON(e, r) {
  2663. return new Method(e, r.type, r.requestType, r.responseType, r.requestStream, r.responseStream, r.options, r.comment, r.parsedOptions);
  2664. }, Method.prototype.toJSON = function toJSON(e) {
  2665. var i = !!e && Boolean(e.keepComments);
  2666. return r.toObject([ "type", "rpc" !== this.type && this.type || void 0, "requestType", this.requestType, "requestStream", this.requestStream, "responseType", this.responseType, "responseStream", this.responseStream, "options", this.options, "comment", i ? this.comment : void 0, "parsedOptions", this.parsedOptions ]);
  2667. }, Method.prototype.resolve = function resolve() {
  2668. return this.resolved ? this : (this.resolvedRequestType = this.parent.lookupType(this.requestType),
  2669. this.resolvedResponseType = this.parent.lookupType(this.responseType), e.prototype.resolve.call(this));
  2670. }, method;
  2671. }
  2672. function requireService() {
  2673. if (hasRequiredService) return service;
  2674. hasRequiredService = 1, service = Service;
  2675. var e = requireNamespace();
  2676. ((Service.prototype = Object.create(e.prototype)).constructor = Service).className = "Service";
  2677. var r = requireMethod(), i = requireUtil(), n = rpc;
  2678. function Service(r, i) {
  2679. e.call(this, r, i), this.methods = {}, this._methodsArray = null;
  2680. }
  2681. function clearCache(e) {
  2682. return e._methodsArray = null, e;
  2683. }
  2684. return Service.fromJSON = function fromJSON(e, i) {
  2685. var n = new Service(e, i.options);
  2686. if (i.methods) for (var o = Object.keys(i.methods), s = 0; s < o.length; ++s) n.add(r.fromJSON(o[s], i.methods[o[s]]));
  2687. return i.nested && n.addJSON(i.nested), n.comment = i.comment, n;
  2688. }, Service.prototype.toJSON = function toJSON(r) {
  2689. var n = e.prototype.toJSON.call(this, r), o = !!r && Boolean(r.keepComments);
  2690. return i.toObject([ "options", n && n.options || void 0, "methods", e.arrayToJSON(this.methodsArray, r) || {}, "nested", n && n.nested || void 0, "comment", o ? this.comment : void 0 ]);
  2691. }, Object.defineProperty(Service.prototype, "methodsArray", {
  2692. get: function() {
  2693. return this._methodsArray || (this._methodsArray = i.toArray(this.methods));
  2694. }
  2695. }), Service.prototype.get = function get(r) {
  2696. return this.methods[r] || e.prototype.get.call(this, r);
  2697. }, Service.prototype.resolveAll = function resolveAll() {
  2698. for (var r = this.methodsArray, i = 0; i < r.length; ++i) r[i].resolve();
  2699. return e.prototype.resolve.call(this);
  2700. }, Service.prototype.add = function add(i) {
  2701. if (this.get(i.name)) throw Error("duplicate name '" + i.name + "' in " + this);
  2702. return i instanceof r ? (this.methods[i.name] = i, i.parent = this, clearCache(this)) : e.prototype.add.call(this, i);
  2703. }, Service.prototype.remove = function remove(i) {
  2704. if (i instanceof r) {
  2705. if (this.methods[i.name] !== i) throw Error(i + " is not a member of " + this);
  2706. return delete this.methods[i.name], i.parent = null, clearCache(this);
  2707. }
  2708. return e.prototype.remove.call(this, i);
  2709. }, Service.prototype.create = function create(e, r, o) {
  2710. for (var s, a = new n.Service(e, r, o), u = 0; u < this.methodsArray.length; ++u) {
  2711. var l = i.lcFirst((s = this._methodsArray[u]).resolve().name).replace(/[^$\w_]/g, "");
  2712. a[l] = i.codegen([ "r", "c" ], i.isReserved(l) ? l + "_" : l)("return this.rpcCall(m,q,s,r,c)")({
  2713. m: s,
  2714. q: s.resolvedRequestType.ctor,
  2715. s: s.resolvedResponseType.ctor
  2716. });
  2717. }
  2718. return a;
  2719. }, service;
  2720. }
  2721. var message$1 = Message, util$1 = requireMinimal(), decoder_1, hasRequiredDecoder, verifier_1, hasRequiredVerifier;
  2722. function Message(e) {
  2723. if (e) for (var r = Object.keys(e), i = 0; i < r.length; ++i) this[r[i]] = e[r[i]];
  2724. }
  2725. function requireDecoder() {
  2726. if (hasRequiredDecoder) return decoder_1;
  2727. hasRequiredDecoder = 1, decoder_1 = function decoder(n) {
  2728. var o = i.codegen([ "r", "l" ], n.name + "$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (n.fieldsArray.filter((function(e) {
  2729. return e.map;
  2730. })).length ? ",k,value" : ""))("while(r.pos<c){")("var t=r.uint32()");
  2731. n.group && o("if((t&7)===4)")("break");
  2732. o("switch(t>>>3){");
  2733. for (var s = 0; s < n.fieldsArray.length; ++s) {
  2734. var a = n._fieldsArray[s].resolve(), u = a.resolvedType instanceof e ? "int32" : a.type, l = "m" + i.safeProp(a.name);
  2735. o("case %i: {", a.id), a.map ? (o("if(%s===util.emptyObject)", l)("%s={}", l)("var c2 = r.uint32()+r.pos"),
  2736. void 0 !== r.defaults[a.keyType] ? o("k=%j", r.defaults[a.keyType]) : o("k=null"),
  2737. void 0 !== r.defaults[u] ? o("value=%j", r.defaults[u]) : o("value=null"), o("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break", a.keyType)("case 2:"),
  2738. void 0 === r.basic[u] ? o("value=types[%i].decode(r,r.uint32())", s) : o("value=r.%s()", u),
  2739. o("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"), void 0 !== r.long[a.keyType] ? o('%s[typeof k==="object"?util.longToHash(k):k]=value', l) : o("%s[k]=value", l)) : a.repeated ? (o("if(!(%s&&%s.length))", l, l)("%s=[]", l),
  2740. void 0 !== r.packed[u] && o("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())", l, u)("}else"),
  2741. void 0 === r.basic[u] ? o(a.resolvedType.group ? "%s.push(types[%i].decode(r))" : "%s.push(types[%i].decode(r,r.uint32()))", l, s) : o("%s.push(r.%s())", l, u)) : void 0 === r.basic[u] ? o(a.resolvedType.group ? "%s=types[%i].decode(r)" : "%s=types[%i].decode(r,r.uint32())", l, s) : o("%s=r.%s()", l, u),
  2742. o("break")("}");
  2743. }
  2744. for (o("default:")("r.skipType(t&7)")("break")("}")("}"), s = 0; s < n._fieldsArray.length; ++s) {
  2745. var f = n._fieldsArray[s];
  2746. f.required && o("if(!m.hasOwnProperty(%j))", f.name)("throw util.ProtocolError(%j,{instance:m})", missing(f));
  2747. }
  2748. return o("return m");
  2749. };
  2750. var e = require_enum(), r = requireTypes(), i = requireUtil();
  2751. function missing(e) {
  2752. return "missing required '" + e.name + "'";
  2753. }
  2754. return decoder_1;
  2755. }
  2756. function requireVerifier() {
  2757. if (hasRequiredVerifier) return verifier_1;
  2758. hasRequiredVerifier = 1, verifier_1 = function verifier(e) {
  2759. var i = r.codegen([ "m" ], e.name + "$verify")('if(typeof m!=="object"||m===null)')("return%j", "object expected"), n = e.oneofsArray, o = {};
  2760. n.length && i("var p={}");
  2761. for (var s = 0; s < e.fieldsArray.length; ++s) {
  2762. var a = e._fieldsArray[s].resolve(), u = "m" + r.safeProp(a.name);
  2763. if (a.optional && i("if(%s!=null&&m.hasOwnProperty(%j)){", u, a.name), a.map) i("if(!util.isObject(%s))", u)("return%j", invalid(a, "object"))("var k=Object.keys(%s)", u)("for(var i=0;i<k.length;++i){"),
  2764. genVerifyKey(i, a, "k[i]"), genVerifyValue(i, a, s, u + "[k[i]]")("}"); else if (a.repeated) i("if(!Array.isArray(%s))", u)("return%j", invalid(a, "array"))("for(var i=0;i<%s.length;++i){", u),
  2765. genVerifyValue(i, a, s, u + "[i]")("}"); else {
  2766. if (a.partOf) {
  2767. var l = r.safeProp(a.partOf.name);
  2768. 1 === o[a.partOf.name] && i("if(p%s===1)", l)("return%j", a.partOf.name + ": multiple values"),
  2769. o[a.partOf.name] = 1, i("p%s=1", l);
  2770. }
  2771. genVerifyValue(i, a, s, u);
  2772. }
  2773. a.optional && i("}");
  2774. }
  2775. return i("return null");
  2776. };
  2777. var e = require_enum(), r = requireUtil();
  2778. function invalid(e, r) {
  2779. return e.name + ": " + r + (e.repeated && "array" !== r ? "[]" : e.map && "object" !== r ? "{k:" + e.keyType + "}" : "") + " expected";
  2780. }
  2781. function genVerifyValue(r, i, n, o) {
  2782. if (i.resolvedType) if (i.resolvedType instanceof e) {
  2783. r("switch(%s){", o)("default:")("return%j", invalid(i, "enum value"));
  2784. for (var s = Object.keys(i.resolvedType.values), a = 0; a < s.length; ++a) r("case %i:", i.resolvedType.values[s[a]]);
  2785. r("break")("}");
  2786. } else r("{")("var e=types[%i].verify(%s);", n, o)("if(e)")("return%j+e", i.name + ".")("}"); else switch (i.type) {
  2787. case "int32":
  2788. case "uint32":
  2789. case "sint32":
  2790. case "fixed32":
  2791. case "sfixed32":
  2792. r("if(!util.isInteger(%s))", o)("return%j", invalid(i, "integer"));
  2793. break;
  2794. case "int64":
  2795. case "uint64":
  2796. case "sint64":
  2797. case "fixed64":
  2798. case "sfixed64":
  2799. r("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", o, o, o, o)("return%j", invalid(i, "integer|Long"));
  2800. break;
  2801. case "float":
  2802. case "double":
  2803. r('if(typeof %s!=="number")', o)("return%j", invalid(i, "number"));
  2804. break;
  2805. case "bool":
  2806. r('if(typeof %s!=="boolean")', o)("return%j", invalid(i, "boolean"));
  2807. break;
  2808. case "string":
  2809. r("if(!util.isString(%s))", o)("return%j", invalid(i, "string"));
  2810. break;
  2811. case "bytes":
  2812. r('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))', o, o, o)("return%j", invalid(i, "buffer"));
  2813. }
  2814. return r;
  2815. }
  2816. function genVerifyKey(e, r, i) {
  2817. switch (r.keyType) {
  2818. case "int32":
  2819. case "uint32":
  2820. case "sint32":
  2821. case "fixed32":
  2822. case "sfixed32":
  2823. e("if(!util.key32Re.test(%s))", i)("return%j", invalid(r, "integer key"));
  2824. break;
  2825. case "int64":
  2826. case "uint64":
  2827. case "sint64":
  2828. case "fixed64":
  2829. case "sfixed64":
  2830. e("if(!util.key64Re.test(%s))", i)("return%j", invalid(r, "integer|Long key"));
  2831. break;
  2832. case "bool":
  2833. e("if(!util.key2Re.test(%s))", i)("return%j", invalid(r, "boolean key"));
  2834. }
  2835. return e;
  2836. }
  2837. return verifier_1;
  2838. }
  2839. Message.create = function create(e) {
  2840. return this.$type.create(e);
  2841. }, Message.encode = function encode(e, r) {
  2842. return this.$type.encode(e, r);
  2843. }, Message.encodeDelimited = function encodeDelimited(e, r) {
  2844. return this.$type.encodeDelimited(e, r);
  2845. }, Message.decode = function decode(e) {
  2846. return this.$type.decode(e);
  2847. }, Message.decodeDelimited = function decodeDelimited(e) {
  2848. return this.$type.decodeDelimited(e);
  2849. }, Message.verify = function verify(e) {
  2850. return this.$type.verify(e);
  2851. }, Message.fromObject = function fromObject(e) {
  2852. return this.$type.fromObject(e);
  2853. }, Message.toObject = function toObject(e, r) {
  2854. return this.$type.toObject(e, r);
  2855. }, Message.prototype.toJSON = function toJSON() {
  2856. return this.$type.toObject(this, util$1.toJSONOptions);
  2857. };
  2858. var converter = {}, hasRequiredConverter;
  2859. function requireConverter() {
  2860. return hasRequiredConverter || (hasRequiredConverter = 1, function(e) {
  2861. var r = e, i = require_enum(), n = requireUtil();
  2862. function genValuePartial_fromObject(e, r, n, o) {
  2863. var s = !1;
  2864. if (r.resolvedType) if (r.resolvedType instanceof i) {
  2865. e("switch(d%s){", o);
  2866. for (var a = r.resolvedType.values, u = Object.keys(a), l = 0; l < u.length; ++l) a[u[l]] !== r.typeDefault || s || (e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}', o, o, o),
  2867. r.repeated || e("break"), s = !0), e("case%j:", u[l])("case %i:", a[u[l]])("m%s=%j", o, a[u[l]])("break");
  2868. e("}");
  2869. } else e('if(typeof d%s!=="object")', o)("throw TypeError(%j)", r.fullName + ": object expected")("m%s=types[%i].fromObject(d%s)", o, n, o); else {
  2870. var f = !1;
  2871. switch (r.type) {
  2872. case "double":
  2873. case "float":
  2874. e("m%s=Number(d%s)", o, o);
  2875. break;
  2876. case "uint32":
  2877. case "fixed32":
  2878. e("m%s=d%s>>>0", o, o);
  2879. break;
  2880. case "int32":
  2881. case "sint32":
  2882. case "sfixed32":
  2883. e("m%s=d%s|0", o, o);
  2884. break;
  2885. case "uint64":
  2886. f = !0;
  2887. case "int64":
  2888. case "sint64":
  2889. case "fixed64":
  2890. case "sfixed64":
  2891. e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j", o, o, f)('else if(typeof d%s==="string")', o)("m%s=parseInt(d%s,10)", o, o)('else if(typeof d%s==="number")', o)("m%s=d%s", o, o)('else if(typeof d%s==="object")', o)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", o, o, o, f ? "true" : "");
  2892. break;
  2893. case "bytes":
  2894. e('if(typeof d%s==="string")', o)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", o, o, o)("else if(d%s.length >= 0)", o)("m%s=d%s", o, o);
  2895. break;
  2896. case "string":
  2897. e("m%s=String(d%s)", o, o);
  2898. break;
  2899. case "bool":
  2900. e("m%s=Boolean(d%s)", o, o);
  2901. }
  2902. }
  2903. return e;
  2904. }
  2905. function genValuePartial_toObject(e, r, n, o) {
  2906. if (r.resolvedType) r.resolvedType instanceof i ? e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s", o, n, o, o, n, o, o) : e("d%s=types[%i].toObject(m%s,o)", o, n, o); else {
  2907. var s = !1;
  2908. switch (r.type) {
  2909. case "double":
  2910. case "float":
  2911. e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", o, o, o, o);
  2912. break;
  2913. case "uint64":
  2914. s = !0;
  2915. case "int64":
  2916. case "sint64":
  2917. case "fixed64":
  2918. case "sfixed64":
  2919. e('if(typeof m%s==="number")', o)("d%s=o.longs===String?String(m%s):m%s", o, o, o)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", o, o, o, o, s ? "true" : "", o);
  2920. break;
  2921. case "bytes":
  2922. e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", o, o, o, o, o);
  2923. break;
  2924. default:
  2925. e("d%s=m%s", o, o);
  2926. }
  2927. }
  2928. return e;
  2929. }
  2930. r.fromObject = function fromObject(e) {
  2931. var r = e.fieldsArray, o = n.codegen([ "d" ], e.name + "$fromObject")("if(d instanceof this.ctor)")("return d");
  2932. if (!r.length) return o("return new this.ctor");
  2933. o("var m=new this.ctor");
  2934. for (var s = 0; s < r.length; ++s) {
  2935. var a = r[s].resolve(), u = n.safeProp(a.name);
  2936. a.map ? (o("if(d%s){", u)('if(typeof d%s!=="object")', u)("throw TypeError(%j)", a.fullName + ": object expected")("m%s={}", u)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", u),
  2937. genValuePartial_fromObject(o, a, s, u + "[ks[i]]")("}")("}")) : a.repeated ? (o("if(d%s){", u)("if(!Array.isArray(d%s))", u)("throw TypeError(%j)", a.fullName + ": array expected")("m%s=[]", u)("for(var i=0;i<d%s.length;++i){", u),
  2938. genValuePartial_fromObject(o, a, s, u + "[i]")("}")("}")) : (a.resolvedType instanceof i || o("if(d%s!=null){", u),
  2939. genValuePartial_fromObject(o, a, s, u), a.resolvedType instanceof i || o("}"));
  2940. }
  2941. return o("return m");
  2942. }, r.toObject = function toObject(e) {
  2943. var r = e.fieldsArray.slice().sort(n.compareFieldsById);
  2944. if (!r.length) return n.codegen()("return {}");
  2945. for (var o = n.codegen([ "m", "o" ], e.name + "$toObject")("if(!o)")("o={}")("var d={}"), s = [], a = [], u = [], l = 0; l < r.length; ++l) r[l].partOf || (r[l].resolve().repeated ? s : r[l].map ? a : u).push(r[l]);
  2946. if (s.length) {
  2947. for (o("if(o.arrays||o.defaults){"), l = 0; l < s.length; ++l) o("d%s=[]", n.safeProp(s[l].name));
  2948. o("}");
  2949. }
  2950. if (a.length) {
  2951. for (o("if(o.objects||o.defaults){"), l = 0; l < a.length; ++l) o("d%s={}", n.safeProp(a[l].name));
  2952. o("}");
  2953. }
  2954. if (u.length) {
  2955. for (o("if(o.defaults){"), l = 0; l < u.length; ++l) {
  2956. var f = u[l], h = n.safeProp(f.name);
  2957. if (f.resolvedType instanceof i) o("d%s=o.enums===String?%j:%j", h, f.resolvedType.valuesById[f.typeDefault], f.typeDefault); else if (f.long) o("if(util.Long){")("var n=new util.Long(%i,%i,%j)", f.typeDefault.low, f.typeDefault.high, f.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", h)("}else")("d%s=o.longs===String?%j:%i", h, f.typeDefault.toString(), f.typeDefault.toNumber()); else if (f.bytes) {
  2958. var p = "[" + Array.prototype.slice.call(f.typeDefault).join(",") + "]";
  2959. o("if(o.bytes===String)d%s=%j", h, String.fromCharCode.apply(String, f.typeDefault))("else{")("d%s=%s", h, p)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", h, h)("}");
  2960. } else o("d%s=%j", h, f.typeDefault);
  2961. }
  2962. o("}");
  2963. }
  2964. var c = !1;
  2965. for (l = 0; l < r.length; ++l) {
  2966. f = r[l];
  2967. var d = e._fieldsArray.indexOf(f);
  2968. h = n.safeProp(f.name);
  2969. f.map ? (c || (c = !0, o("var ks2")), o("if(m%s&&(ks2=Object.keys(m%s)).length){", h, h)("d%s={}", h)("for(var j=0;j<ks2.length;++j){"),
  2970. genValuePartial_toObject(o, f, d, h + "[ks2[j]]")("}")) : f.repeated ? (o("if(m%s&&m%s.length){", h, h)("d%s=[]", h)("for(var j=0;j<m%s.length;++j){", h),
  2971. genValuePartial_toObject(o, f, d, h + "[j]")("}")) : (o("if(m%s!=null&&m.hasOwnProperty(%j)){", h, f.name),
  2972. genValuePartial_toObject(o, f, d, h), f.partOf && o("if(o.oneofs)")("d%s=%j", n.safeProp(f.partOf.name), f.name)),
  2973. o("}");
  2974. }
  2975. return o("return d");
  2976. };
  2977. }(converter)), converter;
  2978. }
  2979. var wrappers = {}, type, hasRequiredType, root, hasRequiredRoot, hasRequiredUtil, object, hasRequiredObject, _enum, hasRequired_enum, encoder_1, hasRequiredEncoder;
  2980. function requireType() {
  2981. if (hasRequiredType) return type;
  2982. hasRequiredType = 1, type = Type;
  2983. var e = requireNamespace();
  2984. ((Type.prototype = Object.create(e.prototype)).constructor = Type).className = "Type";
  2985. var r = require_enum(), i = requireOneof(), n = requireField(), o = requireMapfield(), s = requireService(), a = message$1, u = reader, l = writer, f = requireUtil(), h = requireEncoder(), p = requireDecoder(), c = requireVerifier(), d = requireConverter(), g = wrappers;
  2986. function Type(r, i) {
  2987. e.call(this, r, i), this.fields = {}, this.oneofs = void 0, this.extensions = void 0,
  2988. this.reserved = void 0, this.group = void 0, this._fieldsById = null, this._fieldsArray = null,
  2989. this._oneofsArray = null, this._ctor = null;
  2990. }
  2991. function clearCache(e) {
  2992. return e._fieldsById = e._fieldsArray = e._oneofsArray = null, delete e.encode,
  2993. delete e.decode, delete e.verify, e;
  2994. }
  2995. return Object.defineProperties(Type.prototype, {
  2996. fieldsById: {
  2997. get: function() {
  2998. if (this._fieldsById) return this._fieldsById;
  2999. this._fieldsById = {};
  3000. for (var e = Object.keys(this.fields), r = 0; r < e.length; ++r) {
  3001. var i = this.fields[e[r]], n = i.id;
  3002. if (this._fieldsById[n]) throw Error("duplicate id " + n + " in " + this);
  3003. this._fieldsById[n] = i;
  3004. }
  3005. return this._fieldsById;
  3006. }
  3007. },
  3008. fieldsArray: {
  3009. get: function() {
  3010. return this._fieldsArray || (this._fieldsArray = f.toArray(this.fields));
  3011. }
  3012. },
  3013. oneofsArray: {
  3014. get: function() {
  3015. return this._oneofsArray || (this._oneofsArray = f.toArray(this.oneofs));
  3016. }
  3017. },
  3018. ctor: {
  3019. get: function() {
  3020. return this._ctor || (this.ctor = Type.generateConstructor(this)());
  3021. },
  3022. set: function(e) {
  3023. var r = e.prototype;
  3024. r instanceof a || ((e.prototype = new a).constructor = e, f.merge(e.prototype, r)),
  3025. e.$type = e.prototype.$type = this, f.merge(e, a, !0), this._ctor = e;
  3026. for (var i = 0; i < this.fieldsArray.length; ++i) this._fieldsArray[i].resolve();
  3027. var n = {};
  3028. for (i = 0; i < this.oneofsArray.length; ++i) n[this._oneofsArray[i].resolve().name] = {
  3029. get: f.oneOfGetter(this._oneofsArray[i].oneof),
  3030. set: f.oneOfSetter(this._oneofsArray[i].oneof)
  3031. };
  3032. i && Object.defineProperties(e.prototype, n);
  3033. }
  3034. }
  3035. }), Type.generateConstructor = function generateConstructor(e) {
  3036. for (var r, i = f.codegen([ "p" ], e.name), n = 0; n < e.fieldsArray.length; ++n) (r = e._fieldsArray[n]).map ? i("this%s={}", f.safeProp(r.name)) : r.repeated && i("this%s=[]", f.safeProp(r.name));
  3037. return i("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]");
  3038. }, Type.fromJSON = function fromJSON(a, u) {
  3039. var l = new Type(a, u.options);
  3040. l.extensions = u.extensions, l.reserved = u.reserved;
  3041. for (var f = Object.keys(u.fields), h = 0; h < f.length; ++h) l.add((void 0 !== u.fields[f[h]].keyType ? o.fromJSON : n.fromJSON)(f[h], u.fields[f[h]]));
  3042. if (u.oneofs) for (f = Object.keys(u.oneofs), h = 0; h < f.length; ++h) l.add(i.fromJSON(f[h], u.oneofs[f[h]]));
  3043. if (u.nested) for (f = Object.keys(u.nested), h = 0; h < f.length; ++h) {
  3044. var p = u.nested[f[h]];
  3045. l.add((void 0 !== p.id ? n.fromJSON : void 0 !== p.fields ? Type.fromJSON : void 0 !== p.values ? r.fromJSON : void 0 !== p.methods ? s.fromJSON : e.fromJSON)(f[h], p));
  3046. }
  3047. return u.extensions && u.extensions.length && (l.extensions = u.extensions), u.reserved && u.reserved.length && (l.reserved = u.reserved),
  3048. u.group && (l.group = !0), u.comment && (l.comment = u.comment), l;
  3049. }, Type.prototype.toJSON = function toJSON(r) {
  3050. var i = e.prototype.toJSON.call(this, r), n = !!r && Boolean(r.keepComments);
  3051. return f.toObject([ "options", i && i.options || void 0, "oneofs", e.arrayToJSON(this.oneofsArray, r), "fields", e.arrayToJSON(this.fieldsArray.filter((function(e) {
  3052. return !e.declaringField;
  3053. })), r) || {}, "extensions", this.extensions && this.extensions.length ? this.extensions : void 0, "reserved", this.reserved && this.reserved.length ? this.reserved : void 0, "group", this.group || void 0, "nested", i && i.nested || void 0, "comment", n ? this.comment : void 0 ]);
  3054. }, Type.prototype.resolveAll = function resolveAll() {
  3055. for (var r = this.fieldsArray, i = 0; i < r.length; ) r[i++].resolve();
  3056. var n = this.oneofsArray;
  3057. for (i = 0; i < n.length; ) n[i++].resolve();
  3058. return e.prototype.resolveAll.call(this);
  3059. }, Type.prototype.get = function get(e) {
  3060. return this.fields[e] || this.oneofs && this.oneofs[e] || this.nested && this.nested[e] || null;
  3061. }, Type.prototype.add = function add(r) {
  3062. if (this.get(r.name)) throw Error("duplicate name '" + r.name + "' in " + this);
  3063. if (r instanceof n && void 0 === r.extend) {
  3064. if (this._fieldsById ? this._fieldsById[r.id] : this.fieldsById[r.id]) throw Error("duplicate id " + r.id + " in " + this);
  3065. if (this.isReservedId(r.id)) throw Error("id " + r.id + " is reserved in " + this);
  3066. if (this.isReservedName(r.name)) throw Error("name '" + r.name + "' is reserved in " + this);
  3067. return r.parent && r.parent.remove(r), this.fields[r.name] = r, r.message = this,
  3068. r.onAdd(this), clearCache(this);
  3069. }
  3070. return r instanceof i ? (this.oneofs || (this.oneofs = {}), this.oneofs[r.name] = r,
  3071. r.onAdd(this), clearCache(this)) : e.prototype.add.call(this, r);
  3072. }, Type.prototype.remove = function remove(r) {
  3073. if (r instanceof n && void 0 === r.extend) {
  3074. if (!this.fields || this.fields[r.name] !== r) throw Error(r + " is not a member of " + this);
  3075. return delete this.fields[r.name], r.parent = null, r.onRemove(this), clearCache(this);
  3076. }
  3077. if (r instanceof i) {
  3078. if (!this.oneofs || this.oneofs[r.name] !== r) throw Error(r + " is not a member of " + this);
  3079. return delete this.oneofs[r.name], r.parent = null, r.onRemove(this), clearCache(this);
  3080. }
  3081. return e.prototype.remove.call(this, r);
  3082. }, Type.prototype.isReservedId = function isReservedId(r) {
  3083. return e.isReservedId(this.reserved, r);
  3084. }, Type.prototype.isReservedName = function isReservedName(r) {
  3085. return e.isReservedName(this.reserved, r);
  3086. }, Type.prototype.create = function create(e) {
  3087. return new this.ctor(e);
  3088. }, Type.prototype.setup = function setup() {
  3089. for (var e = this.fullName, r = [], i = 0; i < this.fieldsArray.length; ++i) r.push(this._fieldsArray[i].resolve().resolvedType);
  3090. this.encode = h(this)({
  3091. Writer: l,
  3092. types: r,
  3093. util: f
  3094. }), this.decode = p(this)({
  3095. Reader: u,
  3096. types: r,
  3097. util: f
  3098. }), this.verify = c(this)({
  3099. types: r,
  3100. util: f
  3101. }), this.fromObject = d.fromObject(this)({
  3102. types: r,
  3103. util: f
  3104. }), this.toObject = d.toObject(this)({
  3105. types: r,
  3106. util: f
  3107. });
  3108. var n = g[e];
  3109. if (n) {
  3110. var o = Object.create(this);
  3111. o.fromObject = this.fromObject, this.fromObject = n.fromObject.bind(o), o.toObject = this.toObject,
  3112. this.toObject = n.toObject.bind(o);
  3113. }
  3114. return this;
  3115. }, Type.prototype.encode = function encode_setup(e, r) {
  3116. return this.setup().encode(e, r);
  3117. }, Type.prototype.encodeDelimited = function encodeDelimited(e, r) {
  3118. return this.encode(e, r && r.len ? r.fork() : r).ldelim();
  3119. }, Type.prototype.decode = function decode_setup(e, r) {
  3120. return this.setup().decode(e, r);
  3121. }, Type.prototype.decodeDelimited = function decodeDelimited(e) {
  3122. return e instanceof u || (e = u.create(e)), this.decode(e, e.uint32());
  3123. }, Type.prototype.verify = function verify_setup(e) {
  3124. return this.setup().verify(e);
  3125. }, Type.prototype.fromObject = function fromObject(e) {
  3126. return this.setup().fromObject(e);
  3127. }, Type.prototype.toObject = function toObject(e, r) {
  3128. return this.setup().toObject(e, r);
  3129. }, Type.d = function decorateType(e) {
  3130. return function typeDecorator(r) {
  3131. f.decorateType(r, e);
  3132. };
  3133. }, type;
  3134. }
  3135. function requireRoot() {
  3136. if (hasRequiredRoot) return root;
  3137. hasRequiredRoot = 1, root = Root;
  3138. var e = requireNamespace();
  3139. ((Root.prototype = Object.create(e.prototype)).constructor = Root).className = "Root";
  3140. var r, i, n, o = requireField(), s = require_enum(), a = requireOneof(), u = requireUtil();
  3141. function Root(r) {
  3142. e.call(this, "", r), this.deferred = [], this.files = [];
  3143. }
  3144. function SYNC() {}
  3145. Root.fromJSON = function fromJSON(e, r) {
  3146. return r || (r = new Root), e.options && r.setOptions(e.options), r.addJSON(e.nested);
  3147. }, Root.prototype.resolvePath = u.path.resolve, Root.prototype.fetch = u.fetch,
  3148. Root.prototype.load = function load(e, r, o) {
  3149. "function" == typeof r && (o = r, r = void 0);
  3150. var s = this;
  3151. if (!o) return u.asPromise(load, s, e, r);
  3152. var a = o === SYNC;
  3153. function finish(e, r) {
  3154. if (o) {
  3155. var i = o;
  3156. if (o = null, a) throw e;
  3157. i(e, r);
  3158. }
  3159. }
  3160. function getBundledFileName(e) {
  3161. var r = e.lastIndexOf("google/protobuf/");
  3162. if (r > -1) {
  3163. var i = e.substring(r);
  3164. if (i in n) return i;
  3165. }
  3166. return null;
  3167. }
  3168. function process(e, n) {
  3169. try {
  3170. if (u.isString(n) && "{" === n.charAt(0) && (n = JSON.parse(n)), u.isString(n)) {
  3171. i.filename = e;
  3172. var o, f = i(n, s, r), h = 0;
  3173. if (f.imports) for (;h < f.imports.length; ++h) (o = getBundledFileName(f.imports[h]) || s.resolvePath(e, f.imports[h])) && fetch(o);
  3174. if (f.weakImports) for (h = 0; h < f.weakImports.length; ++h) (o = getBundledFileName(f.weakImports[h]) || s.resolvePath(e, f.weakImports[h])) && fetch(o, !0);
  3175. } else s.setOptions(n.options).addJSON(n.nested);
  3176. } catch (e) {
  3177. finish(e);
  3178. }
  3179. a || l || finish(null, s);
  3180. }
  3181. function fetch(e, r) {
  3182. if (e = getBundledFileName(e) || e, !(s.files.indexOf(e) > -1)) if (s.files.push(e),
  3183. e in n) a ? process(e, n[e]) : (++l, setTimeout((function() {
  3184. --l, process(e, n[e]);
  3185. }))); else if (a) {
  3186. var i;
  3187. try {
  3188. i = u.fs.readFileSync(e).toString("utf8");
  3189. } catch (e) {
  3190. return void (r || finish(e));
  3191. }
  3192. process(e, i);
  3193. } else ++l, s.fetch(e, (function(i, n) {
  3194. --l, o && (i ? r ? l || finish(null, s) : finish(i) : process(e, n));
  3195. }));
  3196. }
  3197. var l = 0;
  3198. u.isString(e) && (e = [ e ]);
  3199. for (var f, h = 0; h < e.length; ++h) (f = s.resolvePath("", e[h])) && fetch(f);
  3200. if (a) return s;
  3201. l || finish(null, s);
  3202. }, Root.prototype.loadSync = function loadSync(e, r) {
  3203. if (!u.isNode) throw Error("not supported");
  3204. return this.load(e, r, SYNC);
  3205. }, Root.prototype.resolveAll = function resolveAll() {
  3206. if (this.deferred.length) throw Error("unresolvable extensions: " + this.deferred.map((function(e) {
  3207. return "'extend " + e.extend + "' in " + e.parent.fullName;
  3208. })).join(", "));
  3209. return e.prototype.resolveAll.call(this);
  3210. };
  3211. var l = /^[A-Z]/;
  3212. function tryHandleExtension(e, r) {
  3213. var i = r.parent.lookup(r.extend);
  3214. if (i) {
  3215. var n = new o(r.fullName, r.id, r.type, r.rule, void 0, r.options);
  3216. return i.get(n.name) || (n.declaringField = r, r.extensionField = n, i.add(n)),
  3217. !0;
  3218. }
  3219. return !1;
  3220. }
  3221. return Root.prototype._handleAdd = function _handleAdd(e) {
  3222. if (e instanceof o) void 0 === e.extend || e.extensionField || tryHandleExtension(0, e) || this.deferred.push(e); else if (e instanceof s) l.test(e.name) && (e.parent[e.name] = e.values); else if (!(e instanceof a)) {
  3223. if (e instanceof r) for (var i = 0; i < this.deferred.length; ) tryHandleExtension(0, this.deferred[i]) ? this.deferred.splice(i, 1) : ++i;
  3224. for (var n = 0; n < e.nestedArray.length; ++n) this._handleAdd(e._nestedArray[n]);
  3225. l.test(e.name) && (e.parent[e.name] = e);
  3226. }
  3227. }, Root.prototype._handleRemove = function _handleRemove(r) {
  3228. if (r instanceof o) {
  3229. if (void 0 !== r.extend) if (r.extensionField) r.extensionField.parent.remove(r.extensionField),
  3230. r.extensionField = null; else {
  3231. var i = this.deferred.indexOf(r);
  3232. i > -1 && this.deferred.splice(i, 1);
  3233. }
  3234. } else if (r instanceof s) l.test(r.name) && delete r.parent[r.name]; else if (r instanceof e) {
  3235. for (var n = 0; n < r.nestedArray.length; ++n) this._handleRemove(r._nestedArray[n]);
  3236. l.test(r.name) && delete r.parent[r.name];
  3237. }
  3238. }, Root._configure = function(e, o, s) {
  3239. r = e, i = o, n = s;
  3240. }, root;
  3241. }
  3242. function requireUtil() {
  3243. if (hasRequiredUtil) return util$2.exports;
  3244. hasRequiredUtil = 1;
  3245. var e, r, i = util$2.exports = requireMinimal(), n = roots;
  3246. i.codegen = codegen_1, i.fetch = fetch_1, i.path = path, i.fs = i.inquire("fs"),
  3247. i.toArray = function toArray(e) {
  3248. if (e) {
  3249. for (var r = Object.keys(e), i = new Array(r.length), n = 0; n < r.length; ) i[n] = e[r[n++]];
  3250. return i;
  3251. }
  3252. return [];
  3253. }, i.toObject = function toObject(e) {
  3254. for (var r = {}, i = 0; i < e.length; ) {
  3255. var n = e[i++], o = e[i++];
  3256. void 0 !== o && (r[n] = o);
  3257. }
  3258. return r;
  3259. };
  3260. var o = /\\/g, s = /"/g;
  3261. i.isReserved = function isReserved(e) {
  3262. return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e);
  3263. }, i.safeProp = function safeProp(e) {
  3264. return !/^[$\w_]+$/.test(e) || i.isReserved(e) ? '["' + e.replace(o, "\\\\").replace(s, '\\"') + '"]' : "." + e;
  3265. }, i.ucFirst = function ucFirst(e) {
  3266. return e.charAt(0).toUpperCase() + e.substring(1);
  3267. };
  3268. var a = /_([a-z])/g;
  3269. i.camelCase = function camelCase(e) {
  3270. return e.substring(0, 1) + e.substring(1).replace(a, (function(e, r) {
  3271. return r.toUpperCase();
  3272. }));
  3273. }, i.compareFieldsById = function compareFieldsById(e, r) {
  3274. return e.id - r.id;
  3275. }, i.decorateType = function decorateType(r, n) {
  3276. if (r.$type) return n && r.$type.name !== n && (i.decorateRoot.remove(r.$type),
  3277. r.$type.name = n, i.decorateRoot.add(r.$type)), r.$type;
  3278. e || (e = requireType());
  3279. var o = new e(n || r.name);
  3280. return i.decorateRoot.add(o), o.ctor = r, Object.defineProperty(r, "$type", {
  3281. value: o,
  3282. enumerable: !1
  3283. }), Object.defineProperty(r.prototype, "$type", {
  3284. value: o,
  3285. enumerable: !1
  3286. }), o;
  3287. };
  3288. var u = 0;
  3289. return i.decorateEnum = function decorateEnum(e) {
  3290. if (e.$type) return e.$type;
  3291. r || (r = require_enum());
  3292. var n = new r("Enum" + u++, e);
  3293. return i.decorateRoot.add(n), Object.defineProperty(e, "$type", {
  3294. value: n,
  3295. enumerable: !1
  3296. }), n;
  3297. }, i.setProperty = function setProperty(e, r, i) {
  3298. if ("object" != typeof e) throw TypeError("dst must be an object");
  3299. if (!r) throw TypeError("path must be specified");
  3300. return function setProp(e, r, i) {
  3301. var n = r.shift();
  3302. if ("__proto__" === n) return e;
  3303. if (r.length > 0) e[n] = setProp(e[n] || {}, r, i); else {
  3304. var o = e[n];
  3305. o && (i = [].concat(o).concat(i)), e[n] = i;
  3306. }
  3307. return e;
  3308. }(e, r = r.split("."), i);
  3309. }, Object.defineProperty(i, "decorateRoot", {
  3310. get: function() {
  3311. return n.decorated || (n.decorated = new (requireRoot()));
  3312. }
  3313. }), util$2.exports;
  3314. }
  3315. function requireObject() {
  3316. if (hasRequiredObject) return object;
  3317. hasRequiredObject = 1, object = ReflectionObject, ReflectionObject.className = "ReflectionObject";
  3318. var e, r = requireUtil();
  3319. function ReflectionObject(e, i) {
  3320. if (!r.isString(e)) throw TypeError("name must be a string");
  3321. if (i && !r.isObject(i)) throw TypeError("options must be an object");
  3322. this.options = i, this.parsedOptions = null, this.name = e, this.parent = null,
  3323. this.resolved = !1, this.comment = null, this.filename = null;
  3324. }
  3325. return Object.defineProperties(ReflectionObject.prototype, {
  3326. root: {
  3327. get: function() {
  3328. for (var e = this; null !== e.parent; ) e = e.parent;
  3329. return e;
  3330. }
  3331. },
  3332. fullName: {
  3333. get: function() {
  3334. for (var e = [ this.name ], r = this.parent; r; ) e.unshift(r.name), r = r.parent;
  3335. return e.join(".");
  3336. }
  3337. }
  3338. }), ReflectionObject.prototype.toJSON = function toJSON() {
  3339. throw Error();
  3340. }, ReflectionObject.prototype.onAdd = function onAdd(r) {
  3341. this.parent && this.parent !== r && this.parent.remove(this), this.parent = r, this.resolved = !1;
  3342. var i = r.root;
  3343. i instanceof e && i._handleAdd(this);
  3344. }, ReflectionObject.prototype.onRemove = function onRemove(r) {
  3345. var i = r.root;
  3346. i instanceof e && i._handleRemove(this), this.parent = null, this.resolved = !1;
  3347. }, ReflectionObject.prototype.resolve = function resolve() {
  3348. return this.resolved || this.root instanceof e && (this.resolved = !0), this;
  3349. }, ReflectionObject.prototype.getOption = function getOption(e) {
  3350. if (this.options) return this.options[e];
  3351. }, ReflectionObject.prototype.setOption = function setOption(e, r, i) {
  3352. return i && this.options && void 0 !== this.options[e] || ((this.options || (this.options = {}))[e] = r),
  3353. this;
  3354. }, ReflectionObject.prototype.setParsedOption = function setParsedOption(e, i, n) {
  3355. this.parsedOptions || (this.parsedOptions = []);
  3356. var o = this.parsedOptions;
  3357. if (n) {
  3358. var s = o.find((function(r) {
  3359. return Object.prototype.hasOwnProperty.call(r, e);
  3360. }));
  3361. if (s) {
  3362. var a = s[e];
  3363. r.setProperty(a, n, i);
  3364. } else (s = {})[e] = r.setProperty({}, n, i), o.push(s);
  3365. } else {
  3366. var u = {};
  3367. u[e] = i, o.push(u);
  3368. }
  3369. return this;
  3370. }, ReflectionObject.prototype.setOptions = function setOptions(e, r) {
  3371. if (e) for (var i = Object.keys(e), n = 0; n < i.length; ++n) this.setOption(i[n], e[i[n]], r);
  3372. return this;
  3373. }, ReflectionObject.prototype.toString = function toString() {
  3374. var e = this.constructor.className, r = this.fullName;
  3375. return r.length ? e + " " + r : e;
  3376. }, ReflectionObject._configure = function(r) {
  3377. e = r;
  3378. }, object;
  3379. }
  3380. function require_enum() {
  3381. if (hasRequired_enum) return _enum;
  3382. hasRequired_enum = 1, _enum = Enum;
  3383. var e = requireObject();
  3384. ((Enum.prototype = Object.create(e.prototype)).constructor = Enum).className = "Enum";
  3385. var r = requireNamespace(), i = requireUtil();
  3386. function Enum(r, i, n, o, s, a) {
  3387. if (e.call(this, r, n), i && "object" != typeof i) throw TypeError("values must be an object");
  3388. if (this.valuesById = {}, this.values = Object.create(this.valuesById), this.comment = o,
  3389. this.comments = s || {}, this.valuesOptions = a, this.reserved = void 0, i) for (var u = Object.keys(i), l = 0; l < u.length; ++l) "number" == typeof i[u[l]] && (this.valuesById[this.values[u[l]] = i[u[l]]] = u[l]);
  3390. }
  3391. return Enum.fromJSON = function fromJSON(e, r) {
  3392. var i = new Enum(e, r.values, r.options, r.comment, r.comments);
  3393. return i.reserved = r.reserved, i;
  3394. }, Enum.prototype.toJSON = function toJSON(e) {
  3395. var r = !!e && Boolean(e.keepComments);
  3396. return i.toObject([ "options", this.options, "valuesOptions", this.valuesOptions, "values", this.values, "reserved", this.reserved && this.reserved.length ? this.reserved : void 0, "comment", r ? this.comment : void 0, "comments", r ? this.comments : void 0 ]);
  3397. }, Enum.prototype.add = function add(e, r, n, o) {
  3398. if (!i.isString(e)) throw TypeError("name must be a string");
  3399. if (!i.isInteger(r)) throw TypeError("id must be an integer");
  3400. if (void 0 !== this.values[e]) throw Error("duplicate name '" + e + "' in " + this);
  3401. if (this.isReservedId(r)) throw Error("id " + r + " is reserved in " + this);
  3402. if (this.isReservedName(e)) throw Error("name '" + e + "' is reserved in " + this);
  3403. if (void 0 !== this.valuesById[r]) {
  3404. if (!this.options || !this.options.allow_alias) throw Error("duplicate id " + r + " in " + this);
  3405. this.values[e] = r;
  3406. } else this.valuesById[this.values[e] = r] = e;
  3407. return o && (void 0 === this.valuesOptions && (this.valuesOptions = {}), this.valuesOptions[e] = o || null),
  3408. this.comments[e] = n || null, this;
  3409. }, Enum.prototype.remove = function remove(e) {
  3410. if (!i.isString(e)) throw TypeError("name must be a string");
  3411. var r = this.values[e];
  3412. if (null == r) throw Error("name '" + e + "' does not exist in " + this);
  3413. return delete this.valuesById[r], delete this.values[e], delete this.comments[e],
  3414. this.valuesOptions && delete this.valuesOptions[e], this;
  3415. }, Enum.prototype.isReservedId = function isReservedId(e) {
  3416. return r.isReservedId(this.reserved, e);
  3417. }, Enum.prototype.isReservedName = function isReservedName(e) {
  3418. return r.isReservedName(this.reserved, e);
  3419. }, _enum;
  3420. }
  3421. function requireEncoder() {
  3422. if (hasRequiredEncoder) return encoder_1;
  3423. hasRequiredEncoder = 1, encoder_1 = function encoder(n) {
  3424. for (var o, s = i.codegen([ "m", "w" ], n.name + "$encode")("if(!w)")("w=Writer.create()"), a = n.fieldsArray.slice().sort(i.compareFieldsById), u = 0; u < a.length; ++u) {
  3425. var l = a[u].resolve(), f = n._fieldsArray.indexOf(l), h = l.resolvedType instanceof e ? "int32" : l.type, p = r.basic[h];
  3426. o = "m" + i.safeProp(l.name), l.map ? (s("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", o, l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", o)("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (l.id << 3 | 2) >>> 0, 8 | r.mapKey[l.keyType], l.keyType),
  3427. void 0 === p ? s("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", f, o) : s(".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | p, h, o),
  3428. s("}")("}")) : l.repeated ? (s("if(%s!=null&&%s.length){", o, o), l.packed && void 0 !== r.packed[h] ? s("w.uint32(%i).fork()", (l.id << 3 | 2) >>> 0)("for(var i=0;i<%s.length;++i)", o)("w.%s(%s[i])", h, o)("w.ldelim()") : (s("for(var i=0;i<%s.length;++i)", o),
  3429. void 0 === p ? genTypePartial(s, l, f, o + "[i]") : s("w.uint32(%i).%s(%s[i])", (l.id << 3 | p) >>> 0, h, o)),
  3430. s("}")) : (l.optional && s("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", o, l.name),
  3431. void 0 === p ? genTypePartial(s, l, f, o) : s("w.uint32(%i).%s(%s)", (l.id << 3 | p) >>> 0, h, o));
  3432. }
  3433. return s("return w");
  3434. };
  3435. var e = require_enum(), r = requireTypes(), i = requireUtil();
  3436. function genTypePartial(e, r, i, n) {
  3437. return r.resolvedType.group ? e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", i, n, (r.id << 3 | 3) >>> 0, (r.id << 3 | 4) >>> 0) : e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", i, n, (r.id << 3 | 2) >>> 0);
  3438. }
  3439. return encoder_1;
  3440. }
  3441. !function(e) {
  3442. var r = message$1;
  3443. e[".google.protobuf.Any"] = {
  3444. fromObject: function(e) {
  3445. if (e && e["@type"]) {
  3446. var r = e["@type"].substring(e["@type"].lastIndexOf("/") + 1), i = this.lookup(r);
  3447. if (i) {
  3448. var n = "." === e["@type"].charAt(0) ? e["@type"].slice(1) : e["@type"];
  3449. return -1 === n.indexOf("/") && (n = "/" + n), this.create({
  3450. type_url: n,
  3451. value: i.encode(i.fromObject(e)).finish()
  3452. });
  3453. }
  3454. }
  3455. return this.fromObject(e);
  3456. },
  3457. toObject: function(e, i) {
  3458. var n = "", o = "";
  3459. if (i && i.json && e.type_url && e.value) {
  3460. o = e.type_url.substring(e.type_url.lastIndexOf("/") + 1), n = e.type_url.substring(0, e.type_url.lastIndexOf("/") + 1);
  3461. var s = this.lookup(o);
  3462. s && (e = s.decode(e.value));
  3463. }
  3464. if (!(e instanceof this.ctor) && e instanceof r) {
  3465. var a = e.$type.toObject(e, i);
  3466. return "" === n && (n = "type.googleapis.com/"), o = n + ("." === e.$type.fullName[0] ? e.$type.fullName.slice(1) : e.$type.fullName),
  3467. a["@type"] = o, a;
  3468. }
  3469. return this.toObject(e, i);
  3470. }
  3471. };
  3472. }(wrappers);
  3473. var protobuf$1 = indexLight.exports = indexMinimal;
  3474. function load(e, r, i) {
  3475. return "function" == typeof r ? (i = r, r = new protobuf$1.Root) : r || (r = new protobuf$1.Root),
  3476. r.load(e, i);
  3477. }
  3478. function loadSync(e, r) {
  3479. return r || (r = new protobuf$1.Root), r.loadSync(e);
  3480. }
  3481. protobuf$1.build = "light", protobuf$1.load = load, protobuf$1.loadSync = loadSync,
  3482. protobuf$1.encoder = requireEncoder(), protobuf$1.decoder = requireDecoder(), protobuf$1.verifier = requireVerifier(),
  3483. protobuf$1.converter = requireConverter(), protobuf$1.ReflectionObject = requireObject(),
  3484. protobuf$1.Namespace = requireNamespace(), protobuf$1.Root = requireRoot(), protobuf$1.Enum = require_enum(),
  3485. protobuf$1.Type = requireType(), protobuf$1.Field = requireField(), protobuf$1.OneOf = requireOneof(),
  3486. protobuf$1.MapField = requireMapfield(), protobuf$1.Service = requireService(),
  3487. protobuf$1.Method = requireMethod(), protobuf$1.Message = message$1, protobuf$1.wrappers = wrappers,
  3488. protobuf$1.types = requireTypes(), protobuf$1.util = requireUtil(), protobuf$1.ReflectionObject._configure(protobuf$1.Root),
  3489. protobuf$1.Namespace._configure(protobuf$1.Type, protobuf$1.Service, protobuf$1.Enum),
  3490. protobuf$1.Root._configure(protobuf$1.Type), protobuf$1.Field._configure(protobuf$1.Type);
  3491. var indexLightExports = indexLight.exports, tokenize_1 = tokenize$1, delimRe = /[\s{}=;:[\],'"()<>]/g, stringDoubleRe = /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g, stringSingleRe = /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g, setCommentRe = /^ *[*/]+ */, setCommentAltRe = /^\s*\*?\/*/, setCommentSplitRe = /\n/g, whitespaceRe = /\s/, unescapeRe = /\\(.?)/g, unescapeMap = {
  3492. 0: "\0",
  3493. r: "\r",
  3494. n: "\n",
  3495. t: "\t"
  3496. };
  3497. function unescape(e) {
  3498. return e.replace(unescapeRe, (function(e, r) {
  3499. switch (r) {
  3500. case "\\":
  3501. case "":
  3502. return r;
  3503. default:
  3504. return unescapeMap[r] || "";
  3505. }
  3506. }));
  3507. }
  3508. function tokenize$1(e, r) {
  3509. e = e.toString();
  3510. var i = 0, n = e.length, o = 1, s = 0, a = {}, u = [], l = null;
  3511. function illegal(e) {
  3512. return Error("illegal " + e + " (line " + o + ")");
  3513. }
  3514. function charAt(r) {
  3515. return e.charAt(r);
  3516. }
  3517. function setComment(i, n, u) {
  3518. var l, f = {
  3519. type: e.charAt(i++),
  3520. lineEmpty: !1,
  3521. leading: u
  3522. }, h = i - (r ? 2 : 3);
  3523. do {
  3524. if (--h < 0 || "\n" === (l = e.charAt(h))) {
  3525. f.lineEmpty = !0;
  3526. break;
  3527. }
  3528. } while (" " === l || "\t" === l);
  3529. for (var p = e.substring(i, n).split(setCommentSplitRe), c = 0; c < p.length; ++c) p[c] = p[c].replace(r ? setCommentAltRe : setCommentRe, "").trim();
  3530. f.text = p.join("\n").trim(), a[o] = f, s = o;
  3531. }
  3532. function isDoubleSlashCommentLine(r) {
  3533. var i = findEndOfLine(r), n = e.substring(r, i);
  3534. return /^\s*\/{1,2}/.test(n);
  3535. }
  3536. function findEndOfLine(e) {
  3537. for (var r = e; r < n && "\n" !== charAt(r); ) r++;
  3538. return r;
  3539. }
  3540. function next() {
  3541. if (u.length > 0) return u.shift();
  3542. if (l) return function readString() {
  3543. var r = "'" === l ? stringSingleRe : stringDoubleRe;
  3544. r.lastIndex = i - 1;
  3545. var n = r.exec(e);
  3546. if (!n) throw illegal("string");
  3547. return i = r.lastIndex, push(l), l = null, unescape(n[1]);
  3548. }();
  3549. var s, a, f, h, p, c = 0 === i;
  3550. do {
  3551. if (i === n) return null;
  3552. for (s = !1; whitespaceRe.test(f = charAt(i)); ) if ("\n" === f && (c = !0, ++o),
  3553. ++i === n) return null;
  3554. if ("/" === charAt(i)) {
  3555. if (++i === n) throw illegal("comment");
  3556. if ("/" === charAt(i)) if (r) {
  3557. if (h = i, p = !1, isDoubleSlashCommentLine(i)) {
  3558. p = !0;
  3559. do {
  3560. if ((i = findEndOfLine(i)) === n) break;
  3561. if (i++, !c) break;
  3562. } while (isDoubleSlashCommentLine(i));
  3563. } else i = Math.min(n, findEndOfLine(i) + 1);
  3564. p && (setComment(h, i, c), c = !0), o++, s = !0;
  3565. } else {
  3566. for (p = "/" === charAt(h = i + 1); "\n" !== charAt(++i); ) if (i === n) return null;
  3567. ++i, p && (setComment(h, i - 1, c), c = !0), ++o, s = !0;
  3568. } else {
  3569. if ("*" !== (f = charAt(i))) return "/";
  3570. h = i + 1, p = r || "*" === charAt(h);
  3571. do {
  3572. if ("\n" === f && ++o, ++i === n) throw illegal("comment");
  3573. a = f, f = charAt(i);
  3574. } while ("*" !== a || "/" !== f);
  3575. ++i, p && (setComment(h, i - 2, c), c = !0), s = !0;
  3576. }
  3577. }
  3578. } while (s);
  3579. var d = i;
  3580. if (delimRe.lastIndex = 0, !delimRe.test(charAt(d++))) for (;d < n && !delimRe.test(charAt(d)); ) ++d;
  3581. var g = e.substring(i, i = d);
  3582. return '"' !== g && "'" !== g || (l = g), g;
  3583. }
  3584. function push(e) {
  3585. u.push(e);
  3586. }
  3587. function peek() {
  3588. if (!u.length) {
  3589. var e = next();
  3590. if (null === e) return null;
  3591. push(e);
  3592. }
  3593. return u[0];
  3594. }
  3595. return Object.defineProperty({
  3596. next,
  3597. peek,
  3598. push,
  3599. skip: function skip(e, r) {
  3600. var i = peek();
  3601. if (i === e) return next(), !0;
  3602. if (!r) throw illegal("token '" + i + "', '" + e + "' expected");
  3603. return !1;
  3604. },
  3605. cmnt: function cmnt(e) {
  3606. var i, n = null;
  3607. return void 0 === e ? (i = a[o - 1], delete a[o - 1], i && (r || "*" === i.type || i.lineEmpty) && (n = i.leading ? i.text : null)) : (s < e && peek(),
  3608. i = a[e], delete a[e], !i || i.lineEmpty || !r && "/" !== i.type || (n = i.leading ? null : i.text)),
  3609. n;
  3610. }
  3611. }, "line", {
  3612. get: function() {
  3613. return o;
  3614. }
  3615. });
  3616. }
  3617. tokenize$1.unescape = unescape;
  3618. var parse_1 = parse;
  3619. parse.filename = null, parse.defaults = {
  3620. keepCase: !1
  3621. };
  3622. var tokenize = tokenize_1, Root = requireRoot(), Type = requireType(), Field = requireField(), MapField = requireMapfield(), OneOf = requireOneof(), Enum = require_enum(), Service = requireService(), Method = requireMethod(), types = requireTypes(), util = requireUtil(), base10Re = /^[1-9][0-9]*$/, base10NegRe = /^-?[1-9][0-9]*$/, base16Re = /^0[x][0-9a-fA-F]+$/, base16NegRe = /^-?0[x][0-9a-fA-F]+$/, base8Re = /^0[0-7]+$/, base8NegRe = /^-?0[0-7]+$/, numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/, nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/, typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/, fqTypeRefRe = /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;
  3623. function parse(e, r, i) {
  3624. r instanceof Root || (i = r, r = new Root), i || (i = parse.defaults);
  3625. var n, o, s, a, u, l = i.preferTrailingComment || !1, f = tokenize(e, i.alternateCommentMode || !1), h = f.next, p = f.push, c = f.peek, d = f.skip, g = f.cmnt, m = !0, y = !1, v = r, b = i.keepCase ? function(e) {
  3626. return e;
  3627. } : util.camelCase;
  3628. function illegal(e, r, i) {
  3629. var n = parse.filename;
  3630. return i || (parse.filename = null), Error("illegal " + (r || "token") + " '" + e + "' (" + (n ? n + ", " : "") + "line " + f.line + ")");
  3631. }
  3632. function readString() {
  3633. var e, r = [];
  3634. do {
  3635. if ('"' !== (e = h()) && "'" !== e) throw illegal(e);
  3636. r.push(h()), d(e), e = c();
  3637. } while ('"' === e || "'" === e);
  3638. return r.join("");
  3639. }
  3640. function readValue(e) {
  3641. var r = h();
  3642. switch (r) {
  3643. case "'":
  3644. case '"':
  3645. return p(r), readString();
  3646. case "true":
  3647. case "TRUE":
  3648. return !0;
  3649. case "false":
  3650. case "FALSE":
  3651. return !1;
  3652. }
  3653. try {
  3654. return function parseNumber(e, r) {
  3655. var i = 1;
  3656. "-" === e.charAt(0) && (i = -1, e = e.substring(1));
  3657. switch (e) {
  3658. case "inf":
  3659. case "INF":
  3660. case "Inf":
  3661. return i * (1 / 0);
  3662. case "nan":
  3663. case "NAN":
  3664. case "Nan":
  3665. case "NaN":
  3666. return NaN;
  3667. case "0":
  3668. return 0;
  3669. }
  3670. if (base10Re.test(e)) return i * parseInt(e, 10);
  3671. if (base16Re.test(e)) return i * parseInt(e, 16);
  3672. if (base8Re.test(e)) return i * parseInt(e, 8);
  3673. if (numberRe.test(e)) return i * parseFloat(e);
  3674. throw illegal(e, "number", r);
  3675. }(r, !0);
  3676. } catch (i) {
  3677. if (e && typeRefRe.test(r)) return r;
  3678. throw illegal(r, "value");
  3679. }
  3680. }
  3681. function readRanges(e, r) {
  3682. var i, n;
  3683. do {
  3684. !r || '"' !== (i = c()) && "'" !== i ? e.push([ n = parseId(h()), d("to", !0) ? parseId(h()) : n ]) : e.push(readString());
  3685. } while (d(",", !0));
  3686. d(";");
  3687. }
  3688. function parseId(e, r) {
  3689. switch (e) {
  3690. case "max":
  3691. case "MAX":
  3692. case "Max":
  3693. return 536870911;
  3694. case "0":
  3695. return 0;
  3696. }
  3697. if (!r && "-" === e.charAt(0)) throw illegal(e, "id");
  3698. if (base10NegRe.test(e)) return parseInt(e, 10);
  3699. if (base16NegRe.test(e)) return parseInt(e, 16);
  3700. if (base8NegRe.test(e)) return parseInt(e, 8);
  3701. throw illegal(e, "id");
  3702. }
  3703. function parsePackage() {
  3704. if (void 0 !== n) throw illegal("package");
  3705. if (n = h(), !typeRefRe.test(n)) throw illegal(n, "name");
  3706. v = v.define(n), d(";");
  3707. }
  3708. function parseImport() {
  3709. var e, r = c();
  3710. switch (r) {
  3711. case "weak":
  3712. e = s || (s = []), h();
  3713. break;
  3714. case "public":
  3715. h();
  3716. default:
  3717. e = o || (o = []);
  3718. }
  3719. r = readString(), d(";"), e.push(r);
  3720. }
  3721. function parseSyntax() {
  3722. if (d("="), a = readString(), !(y = "proto3" === a) && "proto2" !== a) throw illegal(a, "syntax");
  3723. d(";");
  3724. }
  3725. function parseCommon(e, r) {
  3726. switch (r) {
  3727. case "option":
  3728. return parseOption(e, r), d(";"), !0;
  3729. case "message":
  3730. return parseType(e, r), !0;
  3731. case "enum":
  3732. return parseEnum(e, r), !0;
  3733. case "service":
  3734. return function parseService(e, r) {
  3735. if (!nameRe.test(r = h())) throw illegal(r, "service name");
  3736. var i = new Service(r);
  3737. ifBlock(i, (function parseService_block(e) {
  3738. if (!parseCommon(i, e)) {
  3739. if ("rpc" !== e) throw illegal(e);
  3740. !function parseMethod(e, r) {
  3741. var i = g(), n = r;
  3742. if (!nameRe.test(r = h())) throw illegal(r, "name");
  3743. var o, s, a, u, l = r;
  3744. d("("), d("stream", !0) && (s = !0);
  3745. if (!typeRefRe.test(r = h())) throw illegal(r);
  3746. o = r, d(")"), d("returns"), d("("), d("stream", !0) && (u = !0);
  3747. if (!typeRefRe.test(r = h())) throw illegal(r);
  3748. a = r, d(")");
  3749. var f = new Method(l, n, o, a, s, u);
  3750. f.comment = i, ifBlock(f, (function parseMethod_block(e) {
  3751. if ("option" !== e) throw illegal(e);
  3752. parseOption(f, e), d(";");
  3753. })), e.add(f);
  3754. }(i, e);
  3755. }
  3756. })), e.add(i);
  3757. }(e, r), !0;
  3758. case "extend":
  3759. return function parseExtension(e, r) {
  3760. if (!typeRefRe.test(r = h())) throw illegal(r, "reference");
  3761. var i = r;
  3762. ifBlock(null, (function parseExtension_block(r) {
  3763. switch (r) {
  3764. case "required":
  3765. case "repeated":
  3766. parseField(e, r, i);
  3767. break;
  3768. case "optional":
  3769. parseField(e, y ? "proto3_optional" : "optional", i);
  3770. break;
  3771. default:
  3772. if (!y || !typeRefRe.test(r)) throw illegal(r);
  3773. p(r), parseField(e, "optional", i);
  3774. }
  3775. }));
  3776. }(e, r), !0;
  3777. }
  3778. return !1;
  3779. }
  3780. function ifBlock(e, r, i) {
  3781. var n = f.line;
  3782. if (e && ("string" != typeof e.comment && (e.comment = g()), e.filename = parse.filename),
  3783. d("{", !0)) {
  3784. for (var o; "}" !== (o = h()); ) r(o);
  3785. d(";", !0);
  3786. } else i && i(), d(";"), e && ("string" != typeof e.comment || l) && (e.comment = g(n) || e.comment);
  3787. }
  3788. function parseType(e, r) {
  3789. if (!nameRe.test(r = h())) throw illegal(r, "type name");
  3790. var i = new Type(r);
  3791. ifBlock(i, (function parseType_block(e) {
  3792. if (!parseCommon(i, e)) switch (e) {
  3793. case "map":
  3794. !function parseMapField(e) {
  3795. d("<");
  3796. var r = h();
  3797. if (void 0 === types.mapKey[r]) throw illegal(r, "type");
  3798. d(",");
  3799. var i = h();
  3800. if (!typeRefRe.test(i)) throw illegal(i, "type");
  3801. d(">");
  3802. var n = h();
  3803. if (!nameRe.test(n)) throw illegal(n, "name");
  3804. d("=");
  3805. var o = new MapField(b(n), parseId(h()), r, i);
  3806. ifBlock(o, (function parseMapField_block(e) {
  3807. if ("option" !== e) throw illegal(e);
  3808. parseOption(o, e), d(";");
  3809. }), (function parseMapField_line() {
  3810. parseInlineOptions(o);
  3811. })), e.add(o);
  3812. }(i);
  3813. break;
  3814. case "required":
  3815. case "repeated":
  3816. parseField(i, e);
  3817. break;
  3818. case "optional":
  3819. parseField(i, y ? "proto3_optional" : "optional");
  3820. break;
  3821. case "oneof":
  3822. !function parseOneOf(e, r) {
  3823. if (!nameRe.test(r = h())) throw illegal(r, "name");
  3824. var i = new OneOf(b(r));
  3825. ifBlock(i, (function parseOneOf_block(e) {
  3826. "option" === e ? (parseOption(i, e), d(";")) : (p(e), parseField(i, "optional"));
  3827. })), e.add(i);
  3828. }(i, e);
  3829. break;
  3830. case "extensions":
  3831. readRanges(i.extensions || (i.extensions = []));
  3832. break;
  3833. case "reserved":
  3834. readRanges(i.reserved || (i.reserved = []), !0);
  3835. break;
  3836. default:
  3837. if (!y || !typeRefRe.test(e)) throw illegal(e);
  3838. p(e), parseField(i, "optional");
  3839. }
  3840. })), e.add(i);
  3841. }
  3842. function parseField(e, r, i) {
  3843. var n = h();
  3844. if ("group" !== n) {
  3845. for (;n.endsWith(".") || c().startsWith("."); ) n += h();
  3846. if (!typeRefRe.test(n)) throw illegal(n, "type");
  3847. var o = h();
  3848. if (!nameRe.test(o)) throw illegal(o, "name");
  3849. o = b(o), d("=");
  3850. var s = new Field(o, parseId(h()), n, r, i);
  3851. if (ifBlock(s, (function parseField_block(e) {
  3852. if ("option" !== e) throw illegal(e);
  3853. parseOption(s, e), d(";");
  3854. }), (function parseField_line() {
  3855. parseInlineOptions(s);
  3856. })), "proto3_optional" === r) {
  3857. var a = new OneOf("_" + o);
  3858. s.setOption("proto3_optional", !0), a.add(s), e.add(a);
  3859. } else e.add(s);
  3860. y || !s.repeated || void 0 === types.packed[n] && void 0 !== types.basic[n] || s.setOption("packed", !1, !0);
  3861. } else (function parseGroup(e, r) {
  3862. var i = h();
  3863. if (!nameRe.test(i)) throw illegal(i, "name");
  3864. var n = util.lcFirst(i);
  3865. i === n && (i = util.ucFirst(i));
  3866. d("=");
  3867. var o = parseId(h()), s = new Type(i);
  3868. s.group = !0;
  3869. var a = new Field(n, o, i, r);
  3870. a.filename = parse.filename, ifBlock(s, (function parseGroup_block(e) {
  3871. switch (e) {
  3872. case "option":
  3873. parseOption(s, e), d(";");
  3874. break;
  3875. case "required":
  3876. case "repeated":
  3877. parseField(s, e);
  3878. break;
  3879. case "optional":
  3880. parseField(s, y ? "proto3_optional" : "optional");
  3881. break;
  3882. case "message":
  3883. parseType(s, e);
  3884. break;
  3885. case "enum":
  3886. parseEnum(s, e);
  3887. break;
  3888. default:
  3889. throw illegal(e);
  3890. }
  3891. })), e.add(s).add(a);
  3892. })(e, r);
  3893. }
  3894. function parseEnum(e, r) {
  3895. if (!nameRe.test(r = h())) throw illegal(r, "name");
  3896. var i = new Enum(r);
  3897. ifBlock(i, (function parseEnum_block(e) {
  3898. switch (e) {
  3899. case "option":
  3900. parseOption(i, e), d(";");
  3901. break;
  3902. case "reserved":
  3903. readRanges(i.reserved || (i.reserved = []), !0);
  3904. break;
  3905. default:
  3906. !function parseEnumValue(e, r) {
  3907. if (!nameRe.test(r)) throw illegal(r, "name");
  3908. d("=");
  3909. var i = parseId(h(), !0), n = {
  3910. options: void 0,
  3911. setOption: function(e, r) {
  3912. void 0 === this.options && (this.options = {}), this.options[e] = r;
  3913. }
  3914. };
  3915. ifBlock(n, (function parseEnumValue_block(e) {
  3916. if ("option" !== e) throw illegal(e);
  3917. parseOption(n, e), d(";");
  3918. }), (function parseEnumValue_line() {
  3919. parseInlineOptions(n);
  3920. })), e.add(r, i, n.comment, n.options);
  3921. }(i, e);
  3922. }
  3923. })), e.add(i);
  3924. }
  3925. function parseOption(e, r) {
  3926. var i = d("(", !0);
  3927. if (!typeRefRe.test(r = h())) throw illegal(r, "name");
  3928. var n, o = r, s = o;
  3929. i && (d(")"), s = o = "(" + o + ")", r = c(), fqTypeRefRe.test(r) && (n = r.slice(1),
  3930. o += r, h())), d("="), function setParsedOption(e, r, i, n) {
  3931. e.setParsedOption && e.setParsedOption(r, i, n);
  3932. }(e, s, parseOptionValue(e, o), n);
  3933. }
  3934. function parseOptionValue(e, r) {
  3935. if (d("{", !0)) {
  3936. for (var i = {}; !d("}", !0); ) {
  3937. if (!nameRe.test(u = h())) throw illegal(u, "name");
  3938. var n, o = u;
  3939. if (d(":", !0), "{" === c()) n = parseOptionValue(e, r + "." + u); else if ("[" === c()) {
  3940. var s;
  3941. if (n = [], d("[", !0)) {
  3942. do {
  3943. s = readValue(!0), n.push(s);
  3944. } while (d(",", !0));
  3945. d("]"), void 0 !== s && setOption(e, r + "." + u, s);
  3946. }
  3947. } else n = readValue(!0), setOption(e, r + "." + u, n);
  3948. var a = i[o];
  3949. a && (n = [].concat(a).concat(n)), i[o] = n, d(",", !0), d(";", !0);
  3950. }
  3951. return i;
  3952. }
  3953. var l = readValue(!0);
  3954. return setOption(e, r, l), l;
  3955. }
  3956. function setOption(e, r, i) {
  3957. e.setOption && e.setOption(r, i);
  3958. }
  3959. function parseInlineOptions(e) {
  3960. if (d("[", !0)) {
  3961. do {
  3962. parseOption(e, "option");
  3963. } while (d(",", !0));
  3964. d("]");
  3965. }
  3966. return e;
  3967. }
  3968. for (;null !== (u = h()); ) switch (u) {
  3969. case "package":
  3970. if (!m) throw illegal(u);
  3971. parsePackage();
  3972. break;
  3973. case "import":
  3974. if (!m) throw illegal(u);
  3975. parseImport();
  3976. break;
  3977. case "syntax":
  3978. if (!m) throw illegal(u);
  3979. parseSyntax();
  3980. break;
  3981. case "option":
  3982. parseOption(v, u), d(";");
  3983. break;
  3984. default:
  3985. if (parseCommon(v, u)) {
  3986. m = !1;
  3987. continue;
  3988. }
  3989. throw illegal(u);
  3990. }
  3991. return parse.filename = null, {
  3992. package: n,
  3993. imports: o,
  3994. weakImports: s,
  3995. syntax: a,
  3996. root: r
  3997. };
  3998. }
  3999. var common_1 = common, commonRe = /\/|\./, timeType;
  4000. function common(e, r) {
  4001. commonRe.test(e) || (e = "google/protobuf/" + e + ".proto", r = {
  4002. nested: {
  4003. google: {
  4004. nested: {
  4005. protobuf: {
  4006. nested: r
  4007. }
  4008. }
  4009. }
  4010. }
  4011. }), common[e] = r;
  4012. }
  4013. common("any", {
  4014. Any: {
  4015. fields: {
  4016. type_url: {
  4017. type: "string",
  4018. id: 1
  4019. },
  4020. value: {
  4021. type: "bytes",
  4022. id: 2
  4023. }
  4024. }
  4025. }
  4026. }), common("duration", {
  4027. Duration: timeType = {
  4028. fields: {
  4029. seconds: {
  4030. type: "int64",
  4031. id: 1
  4032. },
  4033. nanos: {
  4034. type: "int32",
  4035. id: 2
  4036. }
  4037. }
  4038. }
  4039. }), common("timestamp", {
  4040. Timestamp: timeType
  4041. }), common("empty", {
  4042. Empty: {
  4043. fields: {}
  4044. }
  4045. }), common("struct", {
  4046. Struct: {
  4047. fields: {
  4048. fields: {
  4049. keyType: "string",
  4050. type: "Value",
  4051. id: 1
  4052. }
  4053. }
  4054. },
  4055. Value: {
  4056. oneofs: {
  4057. kind: {
  4058. oneof: [ "nullValue", "numberValue", "stringValue", "boolValue", "structValue", "listValue" ]
  4059. }
  4060. },
  4061. fields: {
  4062. nullValue: {
  4063. type: "NullValue",
  4064. id: 1
  4065. },
  4066. numberValue: {
  4067. type: "double",
  4068. id: 2
  4069. },
  4070. stringValue: {
  4071. type: "string",
  4072. id: 3
  4073. },
  4074. boolValue: {
  4075. type: "bool",
  4076. id: 4
  4077. },
  4078. structValue: {
  4079. type: "Struct",
  4080. id: 5
  4081. },
  4082. listValue: {
  4083. type: "ListValue",
  4084. id: 6
  4085. }
  4086. }
  4087. },
  4088. NullValue: {
  4089. values: {
  4090. NULL_VALUE: 0
  4091. }
  4092. },
  4093. ListValue: {
  4094. fields: {
  4095. values: {
  4096. rule: "repeated",
  4097. type: "Value",
  4098. id: 1
  4099. }
  4100. }
  4101. }
  4102. }), common("wrappers", {
  4103. DoubleValue: {
  4104. fields: {
  4105. value: {
  4106. type: "double",
  4107. id: 1
  4108. }
  4109. }
  4110. },
  4111. FloatValue: {
  4112. fields: {
  4113. value: {
  4114. type: "float",
  4115. id: 1
  4116. }
  4117. }
  4118. },
  4119. Int64Value: {
  4120. fields: {
  4121. value: {
  4122. type: "int64",
  4123. id: 1
  4124. }
  4125. }
  4126. },
  4127. UInt64Value: {
  4128. fields: {
  4129. value: {
  4130. type: "uint64",
  4131. id: 1
  4132. }
  4133. }
  4134. },
  4135. Int32Value: {
  4136. fields: {
  4137. value: {
  4138. type: "int32",
  4139. id: 1
  4140. }
  4141. }
  4142. },
  4143. UInt32Value: {
  4144. fields: {
  4145. value: {
  4146. type: "uint32",
  4147. id: 1
  4148. }
  4149. }
  4150. },
  4151. BoolValue: {
  4152. fields: {
  4153. value: {
  4154. type: "bool",
  4155. id: 1
  4156. }
  4157. }
  4158. },
  4159. StringValue: {
  4160. fields: {
  4161. value: {
  4162. type: "string",
  4163. id: 1
  4164. }
  4165. }
  4166. },
  4167. BytesValue: {
  4168. fields: {
  4169. value: {
  4170. type: "bytes",
  4171. id: 1
  4172. }
  4173. }
  4174. }
  4175. }), common("field_mask", {
  4176. FieldMask: {
  4177. fields: {
  4178. paths: {
  4179. rule: "repeated",
  4180. type: "string",
  4181. id: 1
  4182. }
  4183. }
  4184. }
  4185. }), common.get = function get(e) {
  4186. return common[e] || null;
  4187. };
  4188. var protobuf = src.exports = indexLightExports;
  4189. protobuf.build = "full", protobuf.tokenize = tokenize_1, protobuf.parse = parse_1,
  4190. protobuf.common = common_1, protobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common);
  4191. var srcExports = src.exports, protobufjs = srcExports;
  4192. const V4_PRIVATE_KEY = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAK8nNR1lTnIfIes6oRWJNj3mB6OssDGx0uGMpgpbVCpf6+VwnuI2stmhZNoQcM417Iz7WqlPzbUmu9R4dEKmLGEEqOhOdVaeh9Xk2IPPjqIu5TbkLZRxkY3dJM1htbz57d/roesJLkZXqssfG5EJauNc+RcABTfLb4IiFjSMlTsnAgMBAAECgYEAiz/pi2hKOJKlvcTL4jpHJGjn8+lL3wZX+LeAHkXDoTjHa47g0knYYQteCbv+YwMeAGupBWiLy5RyyhXFoGNKbbnvftMYK56hH+iqxjtDLnjSDKWnhcB7089sNKaEM9Ilil6uxWMrMMBH9v2PLdYsqMBHqPutKu/SigeGPeiB7VECQQDizVlNv67go99QAIv2n/ga4e0wLizVuaNBXE88AdOnaZ0LOTeniVEqvPtgUk63zbjl0P/pzQzyjitwe6HoCAIpAkEAxbOtnCm1uKEp5HsNaXEJTwE7WQf7PrLD4+BpGtNKkgja6f6F4ld4QZ2TQ6qvsCizSGJrjOpNdjVGJ7bgYMcczwJBALvJWPLmDi7ToFfGTB0EsNHZVKE66kZ/8Stx+ezueke4S556XplqOflQBjbnj2PigwBN/0afT+QZUOBOjWzoDJkCQClzo+oDQMvGVs9GEajS/32mJ3hiWQZrWvEzgzYRqSf3XVcEe7PaXSd8z3y3lACeeACsShqQoc8wGlaHXIJOHTcCQQCZw5127ZGs8ZDTSrogrH73Kw/HvX55wGAeirKYcv28eauveCG7iyFR0PFB/P/EDZnyb+ifvyEFlucPUI0+Y87F", ComicDetailInfoProto = {
  4193. nested: {
  4194. proto: {
  4195. fields: {
  4196. comicInfo: {
  4197. type: "ComicInfo",
  4198. id: 3
  4199. }
  4200. }
  4201. },
  4202. ComicInfo: {
  4203. fields: {
  4204. id: {
  4205. type: "int64",
  4206. id: 1
  4207. },
  4208. title: {
  4209. type: "string",
  4210. id: 2
  4211. },
  4212. direction: {
  4213. type: "int64",
  4214. id: 3
  4215. },
  4216. islong: {
  4217. type: "int64",
  4218. id: 4
  4219. },
  4220. cover: {
  4221. type: "string",
  4222. id: 6
  4223. },
  4224. description: {
  4225. type: "string",
  4226. id: 7
  4227. },
  4228. last_updatetime: {
  4229. type: "int64",
  4230. id: 8
  4231. },
  4232. last_update_chapter_name: {
  4233. type: "string",
  4234. id: 9
  4235. },
  4236. first_letter: {
  4237. type: "string",
  4238. id: 11
  4239. },
  4240. comic_py: {
  4241. type: "string",
  4242. id: 12
  4243. },
  4244. hidden: {
  4245. type: "int64",
  4246. id: 13
  4247. },
  4248. hot_num: {
  4249. type: "int64",
  4250. id: 14
  4251. },
  4252. hit_num: {
  4253. type: "int64",
  4254. id: 15
  4255. },
  4256. last_update_chapter_id: {
  4257. type: "int64",
  4258. id: 18
  4259. },
  4260. types: {
  4261. type: "Types",
  4262. id: 19,
  4263. rule: "repeated"
  4264. },
  4265. status: {
  4266. type: "Status",
  4267. id: 20
  4268. },
  4269. authors: {
  4270. type: "Authors",
  4271. id: 21,
  4272. rule: "repeated"
  4273. },
  4274. subscribe_num: {
  4275. type: "int64",
  4276. id: 22
  4277. },
  4278. chapters: {
  4279. type: "Chapters",
  4280. id: 23,
  4281. rule: "repeated"
  4282. },
  4283. is_need_login: {
  4284. type: "int64",
  4285. id: 24
  4286. },
  4287. dh_url_links: {
  4288. type: "DhUrlLink",
  4289. id: 27,
  4290. rule: "repeated"
  4291. }
  4292. }
  4293. },
  4294. Types: {
  4295. fields: {
  4296. tag_id: {
  4297. type: "int64",
  4298. id: 1
  4299. },
  4300. tag_name: {
  4301. type: "string",
  4302. id: 2
  4303. }
  4304. }
  4305. },
  4306. Status: {
  4307. fields: {
  4308. tag_id: {
  4309. type: "int64",
  4310. id: 1
  4311. },
  4312. tag_name: {
  4313. type: "string",
  4314. id: 2
  4315. }
  4316. }
  4317. },
  4318. Authors: {
  4319. fields: {
  4320. tag_id: {
  4321. type: "int64",
  4322. id: 1
  4323. },
  4324. tag_name: {
  4325. type: "string",
  4326. id: 2
  4327. }
  4328. }
  4329. },
  4330. Data: {
  4331. fields: {
  4332. chapter_id: {
  4333. type: "int64",
  4334. id: 1
  4335. },
  4336. chapter_title: {
  4337. type: "string",
  4338. id: 2
  4339. },
  4340. updatetime: {
  4341. type: "int64",
  4342. id: 3
  4343. },
  4344. filesize: {
  4345. type: "int64",
  4346. id: 4
  4347. },
  4348. chapter_order: {
  4349. type: "int64",
  4350. id: 5
  4351. }
  4352. }
  4353. },
  4354. Chapters: {
  4355. fields: {
  4356. title: {
  4357. type: "string",
  4358. id: 1
  4359. },
  4360. data: {
  4361. type: "Data",
  4362. id: 2,
  4363. rule: "repeated"
  4364. }
  4365. }
  4366. },
  4367. DhUrlLink: {
  4368. fields: {
  4369. title: {
  4370. type: "string",
  4371. id: 1
  4372. }
  4373. }
  4374. }
  4375. }
  4376. }, key = new JSEncryptRSAKey(V4_PRIVATE_KEY), message = protobufjs.Root.fromJSON(ComicDetailInfoProto).lookupType("proto"), base64ToArrayBuffer = e => {
  4377. const r = window.atob(e), i = new Uint8Array(r.length);
  4378. for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
  4379. return i;
  4380. }, arrayBufferToBase64 = e => {
  4381. let r = "";
  4382. const i = new Uint8Array(e), n = i.byteLength;
  4383. for (let e = 0; e < n; e++) r += String.fromCharCode(i[e]);
  4384. return window.btoa(r);
  4385. }, pkcs1unpad2 = (e, r) => {
  4386. const i = e.toByteArray();
  4387. let n = 0;
  4388. for (;n < i.length && 0 === i[n]; ) ++n;
  4389. if (i.length - n != r - 1 || 2 !== i[n]) return null;
  4390. for (++n; 0 !== i[n]; ) if (++n >= i.length) return null;
  4391. const o = [];
  4392. for (;++n < i.length; ) o.push(i[n]);
  4393. return o;
  4394. }, customDecrypt = e => {
  4395. const r = parseBigInt(e, 16), i = key.doPrivate(r);
  4396. return null == i ? null : pkcs1unpad2(i, key.n.bitLength() + 7 >> 3);
  4397. }, utilsDmzjDecrypt = e => {
  4398. const r = base64ToArrayBuffer(e), {length: i} = r;
  4399. let n = 0, o = 0, s = [];
  4400. for (;i - n > 0; ) s = s.concat(customDecrypt(b64tohex(arrayBufferToBase64(r.slice(n, n + 128))))),
  4401. o++, n = 128 * o;
  4402. return Uint8Array.from(s);
  4403. }, dmzjDecrypt = e => {
  4404. const r = utilsDmzjDecrypt(e);
  4405. return message.decode(r);
  4406. };
  4407. return dmzjDecrypt;
  4408. }));