UNPKG

533 kBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory(require("vendor"));
4 else if(typeof define === 'function' && define.amd)
5 define(["vendor"], factory);
6 else if(typeof exports === 'object')
7 exports["mtproto"] = factory(require("vendor"));
8 else
9 root["mtproto"] = factory(root["vendor"]);
10})(this, function(__WEBPACK_EXTERNAL_MODULE_6__) {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId])
20/******/ return installedModules[moduleId].exports;
21/******/
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // identity function for calling harmony imports with the correct context
47/******/ __webpack_require__.i = function(value) { return value; };
48/******/
49/******/ // define getter function for harmony exports
50/******/ __webpack_require__.d = function(exports, name, getter) {
51/******/ if(!__webpack_require__.o(exports, name)) {
52/******/ Object.defineProperty(exports, name, {
53/******/ configurable: false,
54/******/ enumerable: true,
55/******/ get: getter
56/******/ });
57/******/ }
58/******/ };
59/******/
60/******/ // getDefaultExport function for compatibility with non-harmony modules
61/******/ __webpack_require__.n = function(module) {
62/******/ var getter = module && module.__esModule ?
63/******/ function getDefault() { return module['default']; } :
64/******/ function getModuleExports() { return module; };
65/******/ __webpack_require__.d(getter, 'a', getter);
66/******/ return getter;
67/******/ };
68/******/
69/******/ // Object.prototype.hasOwnProperty.call
70/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
71/******/
72/******/ // __webpack_public_path__
73/******/ __webpack_require__.p = "";
74/******/
75/******/ // Load entry module and return exports
76/******/ return __webpack_require__(__webpack_require__.s = 42);
77/******/ })
78/************************************************************************/
79/******/ ([
80/* 0 */
81/***/ (function(module, __webpack_exports__, __webpack_require__) {
82
83"use strict";
84/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jsbn__ = __webpack_require__(14);
85/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jsbn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jsbn__);
86/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rusha__ = __webpack_require__(36);
87/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rusha___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_rusha__);
88/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__goodmind_node_cryptojs_aes__ = __webpack_require__(19);
89/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__goodmind_node_cryptojs_aes___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__goodmind_node_cryptojs_aes__);
90/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_pako_lib_inflate__ = __webpack_require__(41);
91/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_pako_lib_inflate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_pako_lib_inflate__);
92/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__leemon__ = __webpack_require__(28);
93/* harmony export (immutable) */ __webpack_exports__["x"] = bigint;
94/* harmony export (immutable) */ __webpack_exports__["k"] = bigStringInt;
95/* unused harmony export dHexDump */
96/* harmony export (immutable) */ __webpack_exports__["f"] = bytesToHex;
97/* harmony export (immutable) */ __webpack_exports__["u"] = bytesFromHex;
98/* unused harmony export bytesToBase64 */
99/* unused harmony export uint6ToBase64 */
100/* harmony export (immutable) */ __webpack_exports__["e"] = bytesCmp;
101/* harmony export (immutable) */ __webpack_exports__["w"] = bytesXor;
102/* unused harmony export bytesToWords */
103/* unused harmony export bytesFromWords */
104/* unused harmony export bytesFromBigInt */
105/* unused harmony export bytesFromLeemonBigInt */
106/* harmony export (immutable) */ __webpack_exports__["h"] = bytesToArrayBuffer;
107/* harmony export (immutable) */ __webpack_exports__["c"] = convertToArrayBuffer;
108/* harmony export (immutable) */ __webpack_exports__["b"] = convertToUint8Array;
109/* harmony export (immutable) */ __webpack_exports__["q"] = convertToByteArray;
110/* harmony export (immutable) */ __webpack_exports__["g"] = bytesFromArrayBuffer;
111/* unused harmony export bufferConcat */
112/* unused harmony export longToInts */
113/* harmony export (immutable) */ __webpack_exports__["i"] = longToBytes;
114/* harmony export (immutable) */ __webpack_exports__["t"] = longFromInts;
115/* harmony export (immutable) */ __webpack_exports__["y"] = intToUint;
116/* harmony export (immutable) */ __webpack_exports__["j"] = uintToInt;
117/* harmony export (immutable) */ __webpack_exports__["m"] = sha1HashSync;
118/* harmony export (immutable) */ __webpack_exports__["d"] = sha1BytesSync;
119/* harmony export (immutable) */ __webpack_exports__["n"] = sha256HashSync;
120/* harmony export (immutable) */ __webpack_exports__["v"] = rsaEncrypt;
121/* unused harmony export addPadding */
122/* harmony export (immutable) */ __webpack_exports__["o"] = aesEncryptSync;
123/* harmony export (immutable) */ __webpack_exports__["p"] = aesDecryptSync;
124/* harmony export (immutable) */ __webpack_exports__["z"] = gzipUncompress;
125/* harmony export (immutable) */ __webpack_exports__["l"] = nextRandomInt;
126/* harmony export (immutable) */ __webpack_exports__["r"] = pqPrimeFactorization;
127/* unused harmony export pqPrimeJsbn */
128/* unused harmony export pqPrimeLeemon */
129/* harmony export (immutable) */ __webpack_exports__["s"] = bytesModPow;
130
131
132
133const { CryptoJS } = __WEBPACK_IMPORTED_MODULE_2__goodmind_node_cryptojs_aes__;
134
135
136
137// import Int from 'big-integer'
138
139// import BN from 'bn.js'
140
141
142
143// import { bigInt2str } from 'BigInt'
144
145// const { BigInteger } = jsbn
146
147const rushaInstance = new __WEBPACK_IMPORTED_MODULE_1_rusha___default.a(1024 * 1024);
148
149function bigint(num) {
150 return new __WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"](num.toString(16), 16);
151}
152
153function bigStringInt(strNum) {
154 return new __WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"](strNum, 10);
155}
156
157function dHexDump(bytes) {
158 const arr = [];
159 for (let i = 0; i < bytes.length; i++) {
160 if (i && !(i % 2)) {
161 if (!(i % 16)) {
162 arr.push('\n');
163 } else if (!(i % 4)) {
164 arr.push(' ');
165 } else {
166 arr.push(' ');
167 }
168 }
169 arr.push((bytes[i] < 16 ? '0' : '') + bytes[i].toString(16));
170 }
171
172 console.log(arr.join(''));
173}
174
175function bytesToHex(bytes = []) {
176 const arr = [];
177 for (let i = 0; i < bytes.length; i++) {
178 arr.push((bytes[i] < 16 ? '0' : '') + (bytes[i] || 0).toString(16));
179 }
180 return arr.join('');
181}
182
183function bytesFromHex(hexString) {
184 const len = hexString.length;
185 let start = 0;
186 const bytes = [];
187
188 if (hexString.length % 2) {
189 bytes.push(parseInt(hexString.charAt(0), 16));
190 start++;
191 }
192
193 for (let i = start; i < len; i += 2) {
194 bytes.push(parseInt(hexString.substr(i, 2), 16));
195 }
196
197 return bytes;
198}
199
200function bytesToBase64(bytes) {
201 let mod3;
202 let result = '';
203
204 for (let nLen = bytes.length, nUint24 = 0, nIdx = 0; nIdx < nLen; nIdx++) {
205 mod3 = nIdx % 3;
206 nUint24 |= bytes[nIdx] << (16 >>> mod3 & 24);
207 if (mod3 === 2 || nLen - nIdx === 1) {
208 result += String.fromCharCode(uint6ToBase64(nUint24 >>> 18 & 63), uint6ToBase64(nUint24 >>> 12 & 63), uint6ToBase64(nUint24 >>> 6 & 63), uint6ToBase64(nUint24 & 63));
209 nUint24 = 0;
210 }
211 }
212
213 return result.replace(/A(?=A$|$)/g, '=');
214}
215
216function uint6ToBase64(nUint6) {
217 return nUint6 < 26 ? nUint6 + 65 : nUint6 < 52 ? nUint6 + 71 : nUint6 < 62 ? nUint6 - 4 : nUint6 === 62 ? 43 : nUint6 === 63 ? 47 : 65;
218}
219
220// export function base64ToBlob(base64str, mimeType) {
221// const sliceSize = 1024
222// const byteCharacters = atob(base64str)
223// const bytesLength = byteCharacters.length
224// const slicesCount = Math.ceil(bytesLength / sliceSize)
225// const byteArrays = new Array(slicesCount)
226
227// for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
228// const begin = sliceIndex * sliceSize
229// const end = Math.min(begin + sliceSize, bytesLength)
230
231// const bytes = new Array(end - begin)
232// for (let offset = begin, i = 0; offset < end; ++i, ++offset) {
233// bytes[i] = byteCharacters[offset].charCodeAt(0)
234// }
235// byteArrays[sliceIndex] = new Uint8Array(bytes)
236// }
237
238// return blobConstruct(byteArrays, mimeType)
239// }
240
241// export function dataUrlToBlob(url) {
242// // var name = 'b64blob ' + url.length
243// // console.time(name)
244// const urlParts = url.split(',')
245// const base64str = urlParts[1]
246// const mimeType = urlParts[0].split(':')[1].split(';')[0]
247// const blob = base64ToBlob(base64str, mimeType)
248// // console.timeEnd(name)
249// return blob
250// }
251
252// export function blobConstruct(blobParts, mimeType) {
253// let blob
254// try {
255// blob = new Blob(blobParts, { type: mimeType })
256// } catch (e) {
257// const bb = new BlobBuilder
258// angular.forEach(blobParts, function(blobPart) {
259// bb.append(blobPart)
260// })
261// blob = bb.getBlob(mimeType)
262// }
263// return blob
264// }
265
266function bytesCmp(bytes1, bytes2) {
267 const len = bytes1.length;
268 if (len !== bytes2.length) {
269 return false;
270 }
271
272 for (let i = 0; i < len; i++) {
273 if (bytes1[i] !== bytes2[i]) return false;
274 }
275 return true;
276}
277
278function bytesXor(bytes1, bytes2) {
279 const len = bytes1.length;
280 const bytes = [];
281
282 for (let i = 0; i < len; ++i) {
283 bytes[i] = bytes1[i] ^ bytes2[i];
284 }
285
286 return bytes;
287}
288
289function bytesToWords(bytes) {
290 if (bytes instanceof ArrayBuffer) {
291 bytes = new Uint8Array(bytes);
292 }
293 const len = bytes.length;
294 const words = [];
295 let i;
296 for (i = 0; i < len; i++) {
297 words[i >>> 2] |= bytes[i] << 24 - i % 4 * 8;
298 }
299
300 return new CryptoJS.lib.WordArray.init(words, len);
301}
302
303function bytesFromWords(wordArray) {
304 const words = wordArray.words;
305 const sigBytes = wordArray.sigBytes;
306 const bytes = [];
307
308 for (let i = 0; i < sigBytes; i++) {
309 bytes.push(words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff);
310 }
311
312 return bytes;
313}
314
315function bytesFromBigInt(bigInt, len) {
316 let bytes = bigInt.toByteArray();
317
318 if (len && bytes.length < len) {
319 const padding = [];
320 for (let i = 0, needPadding = len - bytes.length; i < needPadding; i++) {
321 padding[i] = 0;
322 }
323 if (bytes instanceof ArrayBuffer) {
324 bytes = bufferConcat(padding, bytes);
325 } else {
326 bytes = padding.concat(bytes);
327 }
328 } else {
329 while (!bytes[0] && (!len || bytes.length > len)) {
330 bytes = bytes.slice(1);
331 }
332 }
333
334 return bytes;
335}
336
337function bytesFromLeemonBigInt(bigInt, len) {
338 const str = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["a" /* bigInt2str */])(bigInt, 16);
339 return bytesFromHex(str);
340}
341
342function bytesToArrayBuffer(b) {
343 return new Uint8Array(b).buffer;
344}
345
346function convertToArrayBuffer(bytes) {
347 // Be careful with converting subarrays!!
348 if (bytes instanceof ArrayBuffer) {
349 return bytes;
350 }
351 if (bytes.buffer !== undefined && bytes.buffer.byteLength == bytes.length * bytes.BYTES_PER_ELEMENT) {
352 return bytes.buffer;
353 }
354 return bytesToArrayBuffer(bytes);
355}
356
357function convertToUint8Array(bytes) {
358 if (bytes.buffer !== undefined) {
359 return bytes;
360 }
361 return new Uint8Array(bytes);
362}
363
364function convertToByteArray(bytes) {
365 if (Array.isArray(bytes)) {
366 return bytes;
367 }
368 bytes = convertToUint8Array(bytes);
369 const newBytes = [];
370 for (let i = 0, len = bytes.length; i < len; i++) {
371 newBytes.push(bytes[i]);
372 }
373 return newBytes;
374}
375
376function bytesFromArrayBuffer(buffer) {
377 const byteView = new Uint8Array(buffer);
378 const bytes = Array.from(byteView);
379 return bytes;
380}
381
382function bufferConcat(buffer1, buffer2) {
383 const l1 = buffer1.byteLength || buffer1.length;
384 const l2 = buffer2.byteLength || buffer2.length;
385 const tmp = new Uint8Array(l1 + l2);
386 tmp.set(buffer1 instanceof ArrayBuffer ? new Uint8Array(buffer1) : buffer1, 0);
387 tmp.set(buffer2 instanceof ArrayBuffer ? new Uint8Array(buffer2) : buffer2, l1);
388
389 return tmp.buffer;
390}
391
392function longToInts(sLong) {
393 const divRem = bigStringInt(sLong).divideAndRemainder(bigint(0x100000000));
394
395 return [divRem[0].intValue(), divRem[1].intValue()];
396}
397
398function longToBytes(sLong) {
399 return bytesFromWords({ words: longToInts(sLong), sigBytes: 8 }).reverse();
400}
401
402function longFromInts(high, low) {
403 return bigint(high).shiftLeft(32).add(bigint(low)).toString(10);
404}
405
406function intToUint(val) {
407 val = parseInt(val);
408 if (val < 0) {
409 val = val + 4294967296;
410 }
411 return val;
412}
413
414function uintToInt(val) {
415 if (val > 2147483647) {
416 val = val - 4294967296;
417 }
418 return val;
419}
420
421function sha1HashSync(bytes) {
422 // console.log(dT(), 'SHA-1 hash start', bytes.byteLength || bytes.length)
423 const hashBytes = rushaInstance.rawDigest(bytes).buffer;
424 // console.log(dT(), 'SHA-1 hash finish')
425
426 return hashBytes;
427}
428
429function sha1BytesSync(bytes) {
430 return bytesFromArrayBuffer(sha1HashSync(bytes));
431}
432
433function sha256HashSync(bytes) {
434 // console.log(dT(), 'SHA-2 hash start', bytes.byteLength || bytes.length)
435 const hashWords = CryptoJS.SHA256(bytesToWords(bytes));
436 // console.log(dT(), 'SHA-2 hash finish')
437
438 const hashBytes = bytesFromWords(hashWords);
439
440 return hashBytes;
441}
442
443function rsaEncrypt(publicKey, bytes) {
444 bytes = addPadding(bytes, 255);
445
446 // console.log('RSA encrypt start')
447 const N = new __WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"](publicKey.modulus, 16);
448 const E = new __WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"](publicKey.exponent, 16);
449 const X = new __WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"](bytes);
450 const encryptedBigInt = X.modPowInt(E, N),
451 encryptedBytes = bytesFromBigInt(encryptedBigInt, 256);
452 // console.log('RSA encrypt finish')
453
454 return encryptedBytes;
455}
456
457function addPadding(bytes, blockSize, zeroes) {
458 blockSize = blockSize || 16;
459 const len = bytes.byteLength || bytes.length;
460 const needPadding = blockSize - len % blockSize;
461 if (needPadding > 0 && needPadding < blockSize) {
462 const padding = new Array(needPadding);
463 if (zeroes) {
464 for (let i = 0; i < needPadding; i++) {
465 padding[i] = 0;
466 }
467 } else {
468 new __WEBPACK_IMPORTED_MODULE_0_jsbn__["SecureRandom"]().nextBytes(padding);
469 }
470
471 if (bytes instanceof ArrayBuffer) {
472 bytes = bufferConcat(bytes, padding);
473 } else {
474 bytes = bytes.concat(padding);
475 }
476 }
477
478 return bytes;
479}
480
481function aesEncryptSync(bytes, keyBytes, ivBytes) {
482 const len = bytes.byteLength || bytes.length;
483
484 // console.log(dT(), 'AES encrypt start', len/*, bytesToHex(keyBytes), bytesToHex(ivBytes)*/)
485 bytes = addPadding(bytes);
486
487 const encryptedWords = CryptoJS.AES.encrypt(bytesToWords(bytes), bytesToWords(keyBytes), {
488 iv: bytesToWords(ivBytes),
489 padding: CryptoJS.pad.NoPadding,
490 mode: CryptoJS.mode.IGE
491 }).ciphertext;
492
493 const encryptedBytes = bytesFromWords(encryptedWords);
494 // console.log(dT(), 'AES encrypt finish')
495
496 return encryptedBytes;
497}
498
499function aesDecryptSync(encryptedBytes, keyBytes, ivBytes) {
500
501 // console.log(dT(), 'AES decrypt start', encryptedBytes.length)
502 const decryptedWords = CryptoJS.AES.decrypt({ ciphertext: bytesToWords(encryptedBytes) }, bytesToWords(keyBytes), {
503 iv: bytesToWords(ivBytes),
504 padding: CryptoJS.pad.NoPadding,
505 mode: CryptoJS.mode.IGE
506 });
507
508 const bytes = bytesFromWords(decryptedWords);
509 // console.log(dT(), 'AES decrypt finish')
510
511 return bytes;
512}
513
514function gzipUncompress(bytes) {
515 // console.log('Gzip uncompress start')
516 const result = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3_pako_lib_inflate__["inflate"])(bytes);
517 // console.log('Gzip uncompress finish')
518 return result;
519}
520
521function nextRandomInt(maxValue) {
522 return Math.floor(Math.random() * maxValue);
523}
524
525// const bytesToInt = bytes => Int(bytesToHex(bytes), 16)
526// const bytesFromInt = int => bytesFromHex(int.toString(16))
527
528function pqPrimeFactorization(pqBytes) {
529 const what = new __WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"](pqBytes);
530 // const whatInt = bytesToInt(pqBytes)
531 // const whatBn = new BN(bytesToHex(pqBytes), 16)
532 let result = false;
533 // let intRes = []
534 // const bnRes = []
535 // console.log(dT(), 'PQ start', pqBytes, what.toString(16), what.bitLength())
536
537 // try {
538 // console.time('pq leemon')
539 // const toHex = bytesToHex(pqBytes)
540 result = pqPrimeLeemon(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["b" /* str2bigInt */])(what.toString(16), 16, Math.ceil(64 / __WEBPACK_IMPORTED_MODULE_4__leemon__["c" /* bpe */]) + 1));
541 // console.timeEnd('pq leemon')
542 // } catch (e) {
543 // console.error('Pq leemon Exception', e)
544 // }
545
546 /*if (result === false && what.bitLength() <= 64) {
547 // console.time('PQ long')
548 try {
549 result = pqPrimeLong(goog.math.Long.fromString(what.toString(16), 16))
550 } catch (e) {
551 console.error('Pq long Exception', e)
552 }
553 // console.timeEnd('PQ long')
554 }*/
555 // console.log(result)
556
557 // if (result === false) {
558 // console.time('pq BigInt')
559 // intRes = pqPrimeJsbn(what)
560 // console.timeEnd('pq BigInt')
561
562 // console.time('pq bn')
563 // bnRes = pqPrimeBN(whatBn)
564 // console.timeEnd('pq bn')
565 // }
566 // console.log(...result, ...bnRes)
567 // console.log(dT(), 'PQ finish')
568
569 return result;
570 //intRes//result//bnRes
571}
572
573/*export function pqPrimeBN(what) {
574 let it = 0,
575 g
576 const nOne = new BN(1)
577 for (let i = 0; i < 3; i++) {
578 const q = (nextRandomInt(128) & 15) + 17
579 let x = new BN(nextRandomInt(1000000000) + 1)
580 let y = x.clone()
581 const lim = 1 << (i + 18)
582
583 for (let j = 1; j < lim; j++) {
584 ++it
585 let a = x.clone()
586 let b = x.clone()
587 let c = new BN(q)
588
589 while (!b.isZero()) {
590 if (!b.and(nOne).isZero()) {
591 c = c.add(a)
592 if (c.gt(what)) {
593 c = c.sub(what)
594 }
595 }
596 a = a.add(a)
597 if (a.gt(what)) {
598 a = a.sub(what)
599 }
600 b = b.shrn(1)
601 }
602
603 x = c.clone()
604 const z = x.lt(y)
605 ? y.sub(x)
606 : x.sub(y)
607 g = z.gcd(what)
608 if (!g.eq(nOne)) {
609 break
610 }
611 if ((j & (j - 1)) == 0) {
612 y = x.clone()
613 }
614 }
615 if (g.gt(nOne)) {
616 break
617 }
618 }
619
620 let f = what.div(g), P, Q
621
622 if (g.gt(f)) {
623 P = f
624 Q = g
625 } else {
626 P = g
627 Q = f
628 }
629
630 return [P.toArray(), Q.toArray(), it]
631}*/
632
633function pqPrimeJsbn(what) {
634 let it = 0,
635 g;
636 for (let i = 0; i < 3; i++) {
637 const q = (nextRandomInt(128) & 15) + 17;
638 let x = bigint(nextRandomInt(1000000000) + 1);
639 let y = x.clone();
640 const lim = 1 << i + 18;
641
642 for (let j = 1; j < lim; j++) {
643 ++it;
644 let a = x.clone();
645 let b = x.clone();
646 let c = bigint(q);
647
648 while (!b.equals(__WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"].ZERO)) {
649 if (!b.and(__WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"].ONE).equals(__WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"].ZERO)) {
650 c = c.add(a);
651 if (c.compareTo(what) > 0) {
652 c = c.subtract(what);
653 }
654 }
655 a = a.add(a);
656 if (a.compareTo(what) > 0) {
657 a = a.subtract(what);
658 }
659 b = b.shiftRight(1);
660 }
661
662 x = c.clone();
663 const z = x.compareTo(y) < 0 ? y.subtract(x) : x.subtract(y);
664 g = z.gcd(what);
665 if (!g.equals(__WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"].ONE)) {
666 break;
667 }
668 if ((j & j - 1) == 0) {
669 y = x.clone();
670 }
671 }
672 if (g.compareTo(__WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"].ONE) > 0) {
673 break;
674 }
675 }
676
677 let f = what.divide(g),
678 P,
679 Q;
680
681 if (g.compareTo(f) > 0) {
682 P = f;
683 Q = g;
684 } else {
685 P = g;
686 Q = f;
687 }
688
689 return [bytesFromBigInt(P), bytesFromBigInt(Q), it];
690}
691
692/*export function pqPrimeBigInteger(what) {
693 let it = 0,
694 g
695 for (let i = 0; i < 3; i++) {
696 const q = (nextRandomInt(128) & 15) + 17
697 let x = Int(nextRandomInt(1000000000) + 1)
698 let y = Int(x)
699 const lim = 1 << (i + 18)
700
701 for (let j = 1; j < lim; j++) {
702 ++it
703 let a = Int(x)
704 let b = Int(x)
705 let c = Int(q)
706
707 while (!b.isZero()) {
708 if (!b.and(Int.one).isZero()) {
709 c = c.add(a)
710 if (c.greater(what))
711 c = c.subtract(what)
712 }
713 a = a.add(a)
714 if (a.greater(what))
715 a = a.subtract(what)
716 b = b.shiftRight(1)
717 }
718
719 x = Int(c)
720 const z = x.lesser(y)
721 ? y.subtract(x)
722 : x.subtract(y)
723 g = Int.gcd(z, what)
724 if (g.notEquals(Int.one))
725 break
726 if ((j & (j - 1)) == 0)
727 y = Int(x)
728 }
729 if (g.greater(Int.one))
730 break
731 }
732
733 const f = what.divide(g)
734 let P, Q
735
736 if (g.greater(f)) {
737 P = f
738 Q = g
739 } else {
740 P = g
741 Q = f
742 }
743
744 return [bytesFromInt(P), bytesFromInt(Q), it]
745}*/
746
747/*export function gcdLong(a, b) {
748 while (a.notEquals(goog.math.Long.ZERO) && b.notEquals(goog.math.Long.ZERO)) {
749 while (b.and(goog.math.Long.ONE).equals(goog.math.Long.ZERO)) {
750 b = b.shiftRight(1)
751 }
752 while (a.and(goog.math.Long.ONE).equals(goog.math.Long.ZERO)) {
753 a = a.shiftRight(1)
754 }
755 if (a.compare(b) > 0) {
756 a = a.subtract(b)
757 } else {
758 b = b.subtract(a)
759 }
760 }
761 return b.equals(goog.math.Long.ZERO) ? a : b
762}
763
764export function pqPrimeLong(what) {
765 let it = 0,
766 g
767 for (let i = 0; i < 3; i++) {
768 const q = goog.math.Long.fromInt((nextRandomInt(128) & 15) + 17)
769 let x = goog.math.Long.fromInt(nextRandomInt(1000000000) + 1)
770 let y = x
771 const lim = 1 << (i + 18)
772
773 for (let j = 1; j < lim; j++) {
774 ++it
775 let a = x
776 let b = x
777 let c = q
778
779 while (b.notEquals(goog.math.Long.ZERO)) {
780 if (b.and(goog.math.Long.ONE).notEquals(goog.math.Long.ZERO)) {
781 c = c.add(a)
782 if (c.compare(what) > 0) {
783 c = c.subtract(what)
784 }
785 }
786 a = a.add(a)
787 if (a.compare(what) > 0) {
788 a = a.subtract(what)
789 }
790 b = b.shiftRight(1)
791 }
792
793 x = c
794 const z = x.compare(y) < 0 ? y.subtract(x) : x.subtract(y)
795 g = gcdLong(z, what)
796 if (g.notEquals(goog.math.Long.ONE)) {
797 break
798 }
799 if ((j & (j - 1)) == 0) {
800 y = x
801 }
802 }
803 if (g.compare(goog.math.Long.ONE) > 0) {
804 break
805 }
806 }
807
808 let f = what.div(g), P, Q
809
810 if (g.compare(f) > 0) {
811 P = f
812 Q = g
813 } else {
814 P = g
815 Q = f
816 }
817
818 return [bytesFromHex(P.toString(16)), bytesFromHex(Q.toString(16)), it]
819}*/
820
821/*//is bigint x equal to integer y?
822//y must have less than bpe bits
823function equalsInt(x,y) {
824 var i;
825 if (x[0]!=y)
826 return 0;
827 for (i=1;i<x.length;i++)
828 if (x[i])
829 return 0;
830 return 1;
831}*/
832
833function pqPrimeLeemon(what) {
834 const minBits = 64;
835 const minLen = Math.ceil(minBits / __WEBPACK_IMPORTED_MODULE_4__leemon__["c" /* bpe */]) + 1;
836 let it = 0;
837 let q, lim;
838 const a = new Array(minLen);
839 const b = new Array(minLen);
840 const c = new Array(minLen);
841 const g = new Array(minLen);
842 const z = new Array(minLen);
843 const x = new Array(minLen);
844 const y = new Array(minLen);
845
846 for (let i = 0; i < 3; i++) {
847 q = (nextRandomInt(128) & 15) + 17;
848 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["d" /* copyInt_ */])(x, nextRandomInt(1000000000) + 1);
849 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["e" /* copy_ */])(y, x);
850 lim = 1 << i + 18;
851
852 for (let j = 1; j < lim; j++) {
853 ++it;
854 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["e" /* copy_ */])(a, x);
855 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["e" /* copy_ */])(b, x);
856 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["d" /* copyInt_ */])(c, q);
857
858 while (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["f" /* isZero */])(b)) {
859 if (b[0] & 1) {
860 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["g" /* add_ */])(c, a);
861 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["h" /* greater */])(c, what)) {
862 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["i" /* sub_ */])(c, what);
863 }
864 }
865 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["g" /* add_ */])(a, a);
866 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["h" /* greater */])(a, what)) {
867 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["i" /* sub_ */])(a, what);
868 }
869 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["j" /* rightShift_ */])(b, 1);
870 }
871
872 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["e" /* copy_ */])(x, c);
873 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["h" /* greater */])(x, y)) {
874 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["e" /* copy_ */])(z, x);
875 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["i" /* sub_ */])(z, y);
876 } else {
877 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["e" /* copy_ */])(z, y);
878 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["i" /* sub_ */])(z, x);
879 }
880 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["k" /* eGCD_ */])(z, what, g, a, b);
881 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["l" /* equalsInt */])(g, 1)) {
882 break;
883 }
884 if ((j & j - 1) === 0) {
885 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["e" /* copy_ */])(y, x);
886 }
887 }
888 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["h" /* greater */])(g, __WEBPACK_IMPORTED_MODULE_4__leemon__["m" /* one */])) {
889 break;
890 }
891 }
892
893 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["n" /* divide_ */])(what, g, x, y);
894
895 const [P, Q] = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["h" /* greater */])(g, x) ? [x, g] : [g, x];
896
897 // console.log(dT(), 'done', bigInt2str(what, 10), bigInt2str(P, 10), bigInt2str(Q, 10))
898
899 return [bytesFromLeemonBigInt(P), bytesFromLeemonBigInt(Q), it];
900}
901
902function bytesModPow(x, y, m) {
903 try {
904 const xBigInt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["b" /* str2bigInt */])(bytesToHex(x), 16);
905 const yBigInt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["b" /* str2bigInt */])(bytesToHex(y), 16);
906 const mBigInt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["b" /* str2bigInt */])(bytesToHex(m), 16);
907 const resBigInt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["o" /* powMod */])(xBigInt, yBigInt, mBigInt);
908
909 return bytesFromHex(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__leemon__["a" /* bigInt2str */])(resBigInt, 16));
910 } catch (e) {
911 console.error('mod pow error', e);
912 }
913
914 return bytesFromBigInt(new __WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"](x).modPow(new __WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"](y), new __WEBPACK_IMPORTED_MODULE_0_jsbn__["BigInteger"](m)), 256);
915}
916
917/***/ }),
918/* 1 */
919/***/ (function(module, exports) {
920
921/*
922CryptoJS v3.1.2
923code.google.com/p/crypto-js
924(c) 2009-2013 by Jeff Mott. All rights reserved.
925code.google.com/p/crypto-js/wiki/License
926*/
927/**
928 * CryptoJS core components.
929 */
930var CryptoJS = CryptoJS || (function (Math, undefined) {
931 /**
932 * CryptoJS namespace.
933 */
934 var C = {};
935
936 /**
937 * Library namespace.
938 */
939 var C_lib = C.lib = {};
940
941 /**
942 * Base object for prototypal inheritance.
943 */
944 var Base = C_lib.Base = (function () {
945 function F() {}
946
947 return {
948 /**
949 * Creates a new object that inherits from this object.
950 *
951 * @param {Object} overrides Properties to copy into the new object.
952 *
953 * @return {Object} The new object.
954 *
955 * @static
956 *
957 * @example
958 *
959 * var MyType = CryptoJS.lib.Base.extend({
960 * field: 'value',
961 *
962 * method: function () {
963 * }
964 * });
965 */
966 extend: function (overrides) {
967 // Spawn
968 F.prototype = this;
969 var subtype = new F();
970
971 // Augment
972 if (overrides) {
973 subtype.mixIn(overrides);
974 }
975
976 // Create default initializer
977 if (!subtype.hasOwnProperty('init')) {
978 subtype.init = function () {
979 subtype.$super.init.apply(this, arguments);
980 };
981 }
982
983 // Initializer's prototype is the subtype object
984 subtype.init.prototype = subtype;
985
986 // Reference supertype
987 subtype.$super = this;
988
989 return subtype;
990 },
991
992 /**
993 * Extends this object and runs the init method.
994 * Arguments to create() will be passed to init().
995 *
996 * @return {Object} The new object.
997 *
998 * @static
999 *
1000 * @example
1001 *
1002 * var instance = MyType.create();
1003 */
1004 create: function () {
1005 var instance = this.extend();
1006 instance.init.apply(instance, arguments);
1007
1008 return instance;
1009 },
1010
1011 /**
1012 * Initializes a newly created object.
1013 * Override this method to add some logic when your objects are created.
1014 *
1015 * @example
1016 *
1017 * var MyType = CryptoJS.lib.Base.extend({
1018 * init: function () {
1019 * // ...
1020 * }
1021 * });
1022 */
1023 init: function () {
1024 },
1025
1026 /**
1027 * Copies properties into this object.
1028 *
1029 * @param {Object} properties The properties to mix in.
1030 *
1031 * @example
1032 *
1033 * MyType.mixIn({
1034 * field: 'value'
1035 * });
1036 */
1037 mixIn: function (properties) {
1038 for (var propertyName in properties) {
1039 if (properties.hasOwnProperty(propertyName)) {
1040 this[propertyName] = properties[propertyName];
1041 }
1042 }
1043
1044 // IE won't copy toString using the loop above
1045 if (properties.hasOwnProperty('toString')) {
1046 this.toString = properties.toString;
1047 }
1048 },
1049
1050 /**
1051 * Creates a copy of this object.
1052 *
1053 * @return {Object} The clone.
1054 *
1055 * @example
1056 *
1057 * var clone = instance.clone();
1058 */
1059 clone: function () {
1060 return this.init.prototype.extend(this);
1061 }
1062 };
1063 }());
1064
1065 /**
1066 * An array of 32-bit words.
1067 *
1068 * @property {Array} words The array of 32-bit words.
1069 * @property {number} sigBytes The number of significant bytes in this word array.
1070 */
1071 var WordArray = C_lib.WordArray = Base.extend({
1072 /**
1073 * Initializes a newly created word array.
1074 *
1075 * @param {Array} words (Optional) An array of 32-bit words.
1076 * @param {number} sigBytes (Optional) The number of significant bytes in the words.
1077 *
1078 * @example
1079 *
1080 * var wordArray = CryptoJS.lib.WordArray.create();
1081 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
1082 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
1083 */
1084 init: function (words, sigBytes) {
1085 words = this.words = words || [];
1086
1087 if (sigBytes != undefined) {
1088 this.sigBytes = sigBytes;
1089 } else {
1090 this.sigBytes = words.length * 4;
1091 }
1092 },
1093
1094 /**
1095 * Converts this word array to a string.
1096 *
1097 * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
1098 *
1099 * @return {string} The stringified word array.
1100 *
1101 * @example
1102 *
1103 * var string = wordArray + '';
1104 * var string = wordArray.toString();
1105 * var string = wordArray.toString(CryptoJS.enc.Utf8);
1106 */
1107 toString: function (encoder) {
1108 return (encoder || Hex).stringify(this);
1109 },
1110
1111 /**
1112 * Concatenates a word array to this word array.
1113 *
1114 * @param {WordArray} wordArray The word array to append.
1115 *
1116 * @return {WordArray} This word array.
1117 *
1118 * @example
1119 *
1120 * wordArray1.concat(wordArray2);
1121 */
1122 concat: function (wordArray) {
1123 // Shortcuts
1124 var thisWords = this.words;
1125 var thatWords = wordArray.words;
1126 var thisSigBytes = this.sigBytes;
1127 var thatSigBytes = wordArray.sigBytes;
1128
1129 // Clamp excess bits
1130 this.clamp();
1131
1132 // Concat
1133 if (thisSigBytes % 4) {
1134 // Copy one byte at a time
1135 for (var i = 0; i < thatSigBytes; i++) {
1136 var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
1137 thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
1138 }
1139 } else if (thatWords.length > 0xffff) {
1140 // Copy one word at a time
1141 for (var i = 0; i < thatSigBytes; i += 4) {
1142 thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
1143 }
1144 } else {
1145 // Copy all words at once
1146 thisWords.push.apply(thisWords, thatWords);
1147 }
1148 this.sigBytes += thatSigBytes;
1149
1150 // Chainable
1151 return this;
1152 },
1153
1154 /**
1155 * Removes insignificant bits.
1156 *
1157 * @example
1158 *
1159 * wordArray.clamp();
1160 */
1161 clamp: function () {
1162 // Shortcuts
1163 var words = this.words;
1164 var sigBytes = this.sigBytes;
1165
1166 // Clamp
1167 words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
1168 words.length = Math.ceil(sigBytes / 4);
1169 },
1170
1171 /**
1172 * Creates a copy of this word array.
1173 *
1174 * @return {WordArray} The clone.
1175 *
1176 * @example
1177 *
1178 * var clone = wordArray.clone();
1179 */
1180 clone: function () {
1181 var clone = Base.clone.call(this);
1182 clone.words = this.words.slice(0);
1183
1184 return clone;
1185 },
1186
1187 /**
1188 * Creates a word array filled with random bytes.
1189 *
1190 * @param {number} nBytes The number of random bytes to generate.
1191 *
1192 * @return {WordArray} The random word array.
1193 *
1194 * @static
1195 *
1196 * @example
1197 *
1198 * var wordArray = CryptoJS.lib.WordArray.random(16);
1199 */
1200 random: function (nBytes) {
1201 var words = [];
1202 for (var i = 0; i < nBytes; i += 4) {
1203 words.push((Math.random() * 0x100000000) | 0);
1204 }
1205
1206 return new WordArray.init(words, nBytes);
1207 }
1208 });
1209
1210 /**
1211 * Encoder namespace.
1212 */
1213 var C_enc = C.enc = {};
1214
1215 /**
1216 * Hex encoding strategy.
1217 */
1218 var Hex = C_enc.Hex = {
1219 /**
1220 * Converts a word array to a hex string.
1221 *
1222 * @param {WordArray} wordArray The word array.
1223 *
1224 * @return {string} The hex string.
1225 *
1226 * @static
1227 *
1228 * @example
1229 *
1230 * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
1231 */
1232 stringify: function (wordArray) {
1233 // Shortcuts
1234 var words = wordArray.words;
1235 var sigBytes = wordArray.sigBytes;
1236
1237 // Convert
1238 var hexChars = [];
1239 for (var i = 0; i < sigBytes; i++) {
1240 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
1241 hexChars.push((bite >>> 4).toString(16));
1242 hexChars.push((bite & 0x0f).toString(16));
1243 }
1244
1245 return hexChars.join('');
1246 },
1247
1248 /**
1249 * Converts a hex string to a word array.
1250 *
1251 * @param {string} hexStr The hex string.
1252 *
1253 * @return {WordArray} The word array.
1254 *
1255 * @static
1256 *
1257 * @example
1258 *
1259 * var wordArray = CryptoJS.enc.Hex.parse(hexString);
1260 */
1261 parse: function (hexStr) {
1262 // Shortcut
1263 var hexStrLength = hexStr.length;
1264
1265 // Convert
1266 var words = [];
1267 for (var i = 0; i < hexStrLength; i += 2) {
1268 words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
1269 }
1270
1271 return new WordArray.init(words, hexStrLength / 2);
1272 }
1273 };
1274
1275 /**
1276 * Latin1 encoding strategy.
1277 */
1278 var Latin1 = C_enc.Latin1 = {
1279 /**
1280 * Converts a word array to a Latin1 string.
1281 *
1282 * @param {WordArray} wordArray The word array.
1283 *
1284 * @return {string} The Latin1 string.
1285 *
1286 * @static
1287 *
1288 * @example
1289 *
1290 * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
1291 */
1292 stringify: function (wordArray) {
1293 // Shortcuts
1294 var words = wordArray.words;
1295 var sigBytes = wordArray.sigBytes;
1296
1297 // Convert
1298 var latin1Chars = [];
1299 for (var i = 0; i < sigBytes; i++) {
1300 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
1301 latin1Chars.push(String.fromCharCode(bite));
1302 }
1303
1304 return latin1Chars.join('');
1305 },
1306
1307 /**
1308 * Converts a Latin1 string to a word array.
1309 *
1310 * @param {string} latin1Str The Latin1 string.
1311 *
1312 * @return {WordArray} The word array.
1313 *
1314 * @static
1315 *
1316 * @example
1317 *
1318 * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
1319 */
1320 parse: function (latin1Str) {
1321 // Shortcut
1322 var latin1StrLength = latin1Str.length;
1323
1324 // Convert
1325 var words = [];
1326 for (var i = 0; i < latin1StrLength; i++) {
1327 words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
1328 }
1329
1330 return new WordArray.init(words, latin1StrLength);
1331 }
1332 };
1333
1334 /**
1335 * UTF-8 encoding strategy.
1336 */
1337 var Utf8 = C_enc.Utf8 = {
1338 /**
1339 * Converts a word array to a UTF-8 string.
1340 *
1341 * @param {WordArray} wordArray The word array.
1342 *
1343 * @return {string} The UTF-8 string.
1344 *
1345 * @static
1346 *
1347 * @example
1348 *
1349 * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
1350 */
1351 stringify: function (wordArray) {
1352 try {
1353 return decodeURIComponent(escape(Latin1.stringify(wordArray)));
1354 } catch (e) {
1355 throw new Error('Malformed UTF-8 data');
1356 }
1357 },
1358
1359 /**
1360 * Converts a UTF-8 string to a word array.
1361 *
1362 * @param {string} utf8Str The UTF-8 string.
1363 *
1364 * @return {WordArray} The word array.
1365 *
1366 * @static
1367 *
1368 * @example
1369 *
1370 * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
1371 */
1372 parse: function (utf8Str) {
1373 return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
1374 }
1375 };
1376
1377 /**
1378 * Abstract buffered block algorithm template.
1379 *
1380 * The property blockSize must be implemented in a concrete subtype.
1381 *
1382 * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
1383 */
1384 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
1385 /**
1386 * Resets this block algorithm's data buffer to its initial state.
1387 *
1388 * @example
1389 *
1390 * bufferedBlockAlgorithm.reset();
1391 */
1392 reset: function () {
1393 // Initial values
1394 this._data = new WordArray.init();
1395 this._nDataBytes = 0;
1396 },
1397
1398 /**
1399 * Adds new data to this block algorithm's buffer.
1400 *
1401 * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
1402 *
1403 * @example
1404 *
1405 * bufferedBlockAlgorithm._append('data');
1406 * bufferedBlockAlgorithm._append(wordArray);
1407 */
1408 _append: function (data) {
1409 // Convert string to WordArray, else assume WordArray already
1410 if (typeof data == 'string') {
1411 data = Utf8.parse(data);
1412 }
1413
1414 // Append
1415 this._data.concat(data);
1416 this._nDataBytes += data.sigBytes;
1417 },
1418
1419 /**
1420 * Processes available data blocks.
1421 *
1422 * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
1423 *
1424 * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
1425 *
1426 * @return {WordArray} The processed data.
1427 *
1428 * @example
1429 *
1430 * var processedData = bufferedBlockAlgorithm._process();
1431 * var processedData = bufferedBlockAlgorithm._process(!!'flush');
1432 */
1433 _process: function (doFlush) {
1434 // Shortcuts
1435 var data = this._data;
1436 var dataWords = data.words;
1437 var dataSigBytes = data.sigBytes;
1438 var blockSize = this.blockSize;
1439 var blockSizeBytes = blockSize * 4;
1440
1441 // Count blocks ready
1442 var nBlocksReady = dataSigBytes / blockSizeBytes;
1443 if (doFlush) {
1444 // Round up to include partial blocks
1445 nBlocksReady = Math.ceil(nBlocksReady);
1446 } else {
1447 // Round down to include only full blocks,
1448 // less the number of blocks that must remain in the buffer
1449 nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
1450 }
1451
1452 // Count words ready
1453 var nWordsReady = nBlocksReady * blockSize;
1454
1455 // Count bytes ready
1456 var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
1457
1458 // Process blocks
1459 if (nWordsReady) {
1460 for (var offset = 0; offset < nWordsReady; offset += blockSize) {
1461 // Perform concrete-algorithm logic
1462 this._doProcessBlock(dataWords, offset);
1463 }
1464
1465 // Remove processed words
1466 var processedWords = dataWords.splice(0, nWordsReady);
1467 data.sigBytes -= nBytesReady;
1468 }
1469
1470 // Return processed words
1471 return new WordArray.init(processedWords, nBytesReady);
1472 },
1473
1474 /**
1475 * Creates a copy of this object.
1476 *
1477 * @return {Object} The clone.
1478 *
1479 * @example
1480 *
1481 * var clone = bufferedBlockAlgorithm.clone();
1482 */
1483 clone: function () {
1484 var clone = Base.clone.call(this);
1485 clone._data = this._data.clone();
1486
1487 return clone;
1488 },
1489
1490 _minBufferSize: 0
1491 });
1492
1493 /**
1494 * Abstract hasher template.
1495 *
1496 * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
1497 */
1498 var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
1499 /**
1500 * Configuration options.
1501 */
1502 cfg: Base.extend(),
1503
1504 /**
1505 * Initializes a newly created hasher.
1506 *
1507 * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
1508 *
1509 * @example
1510 *
1511 * var hasher = CryptoJS.algo.SHA256.create();
1512 */
1513 init: function (cfg) {
1514 // Apply config defaults
1515 this.cfg = this.cfg.extend(cfg);
1516
1517 // Set initial values
1518 this.reset();
1519 },
1520
1521 /**
1522 * Resets this hasher to its initial state.
1523 *
1524 * @example
1525 *
1526 * hasher.reset();
1527 */
1528 reset: function () {
1529 // Reset data buffer
1530 BufferedBlockAlgorithm.reset.call(this);
1531
1532 // Perform concrete-hasher logic
1533 this._doReset();
1534 },
1535
1536 /**
1537 * Updates this hasher with a message.
1538 *
1539 * @param {WordArray|string} messageUpdate The message to append.
1540 *
1541 * @return {Hasher} This hasher.
1542 *
1543 * @example
1544 *
1545 * hasher.update('message');
1546 * hasher.update(wordArray);
1547 */
1548 update: function (messageUpdate) {
1549 // Append
1550 this._append(messageUpdate);
1551
1552 // Update the hash
1553 this._process();
1554
1555 // Chainable
1556 return this;
1557 },
1558
1559 /**
1560 * Finalizes the hash computation.
1561 * Note that the finalize operation is effectively a destructive, read-once operation.
1562 *
1563 * @param {WordArray|string} messageUpdate (Optional) A final message update.
1564 *
1565 * @return {WordArray} The hash.
1566 *
1567 * @example
1568 *
1569 * var hash = hasher.finalize();
1570 * var hash = hasher.finalize('message');
1571 * var hash = hasher.finalize(wordArray);
1572 */
1573 finalize: function (messageUpdate) {
1574 // Final message update
1575 if (messageUpdate) {
1576 this._append(messageUpdate);
1577 }
1578
1579 // Perform concrete-hasher logic
1580 var hash = this._doFinalize();
1581
1582 return hash;
1583 },
1584
1585 blockSize: 512/32,
1586
1587 /**
1588 * Creates a shortcut function to a hasher's object interface.
1589 *
1590 * @param {Hasher} hasher The hasher to create a helper for.
1591 *
1592 * @return {Function} The shortcut function.
1593 *
1594 * @static
1595 *
1596 * @example
1597 *
1598 * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
1599 */
1600 _createHelper: function (hasher) {
1601 return function (message, cfg) {
1602 return new hasher.init(cfg).finalize(message);
1603 };
1604 },
1605
1606 /**
1607 * Creates a shortcut function to the HMAC's object interface.
1608 *
1609 * @param {Hasher} hasher The hasher to use in this HMAC helper.
1610 *
1611 * @return {Function} The shortcut function.
1612 *
1613 * @static
1614 *
1615 * @example
1616 *
1617 * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
1618 */
1619 _createHmacHelper: function (hasher) {
1620 return function (message, key) {
1621 return new C_algo.HMAC.init(hasher, key).finalize(message);
1622 };
1623 }
1624 });
1625
1626 /**
1627 * Algorithm namespace.
1628 */
1629 var C_algo = C.algo = {};
1630
1631 return C;
1632}(Math));
1633
1634exports.CryptoJS = CryptoJS;
1635
1636
1637/***/ }),
1638/* 2 */
1639/***/ (function(module, exports, __webpack_require__) {
1640
1641module.exports = (__webpack_require__(6))(125);
1642
1643/***/ }),
1644/* 3 */
1645/***/ (function(module, exports, __webpack_require__) {
1646
1647module.exports = (__webpack_require__(6))(128);
1648
1649/***/ }),
1650/* 4 */
1651/***/ (function(module, __webpack_exports__, __webpack_require__) {
1652
1653"use strict";
1654/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(2);
1655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
1656
1657/**
1658 * Defered promise like in Q and $q
1659 *
1660 * @returns {{ resolve: (res: any) => void, reject: (res: any) => void, promise: Promise<{}> }}
1661 */
1662const blueDefer = () => {
1663 let resolve, reject;
1664 const promise = new __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a((rs, rj) => {
1665 resolve = rs;
1666 reject = rj;
1667 });
1668 return {
1669 resolve,
1670 reject,
1671 promise
1672 };
1673};
1674/* harmony export (immutable) */ __webpack_exports__["a"] = blueDefer;
1675
1676
1677/* harmony default export */ __webpack_exports__["b"] = blueDefer;
1678
1679/***/ }),
1680/* 5 */
1681/***/ (function(module, __webpack_exports__, __webpack_require__) {
1682
1683"use strict";
1684Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1685/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_detect_node__ = __webpack_require__(13);
1686/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_detect_node___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_detect_node__);
1687/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__store__ = __webpack_require__(7);
1688/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bin__ = __webpack_require__(0);
1689/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generateID", function() { return generateMessageID; });
1690
1691
1692
1693
1694
1695const tsNow = seconds => {
1696 let t = +new Date();
1697 //eslint-disable-next-line
1698 if (!__WEBPACK_IMPORTED_MODULE_0_detect_node___default.a) t += window.tsOffset || 0;
1699 return seconds ? Math.floor(t / 1000) : t;
1700};
1701/* harmony export (immutable) */ __webpack_exports__["tsNow"] = tsNow;
1702
1703
1704const logTimer = new Date().getTime();
1705
1706const dTime = () => `[${((new Date().getTime() - logTimer) / 1000).toFixed(3)}]`;
1707/* harmony export (immutable) */ __webpack_exports__["dTime"] = dTime;
1708
1709
1710let lastMessageID = [0, 0];
1711let timerOffset = 0;
1712
1713const offset = __WEBPACK_IMPORTED_MODULE_1__store__["b" /* TimeOffset */].get();
1714if (offset) timerOffset = offset;
1715
1716const generateMessageID = () => {
1717 const timeTicks = tsNow(),
1718 timeSec = Math.floor(timeTicks / 1000) + timerOffset,
1719 timeMSec = timeTicks % 1000,
1720 random = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["l" /* nextRandomInt */])(0xFFFF);
1721
1722 let messageID = [timeSec, timeMSec << 21 | random << 3 | 4];
1723 if (lastMessageID[0] > messageID[0] || lastMessageID[0] == messageID[0] && lastMessageID[1] >= messageID[1]) {
1724 messageID = [lastMessageID[0], lastMessageID[1] + 4];
1725 }
1726
1727 lastMessageID = messageID;
1728
1729 // console.log('generated msg id', messageID, timerOffset)
1730
1731 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["t" /* longFromInts */])(messageID[0], messageID[1]);
1732};
1733
1734const applyServerTime = (serverTime, localTime) => {
1735 const newTimeOffset = serverTime - Math.floor((localTime || tsNow()) / 1000);
1736 const changed = Math.abs(timerOffset - newTimeOffset) > 10;
1737 __WEBPACK_IMPORTED_MODULE_1__store__["b" /* TimeOffset */].set(newTimeOffset);
1738
1739 lastMessageID = [0, 0];
1740 timerOffset = newTimeOffset;
1741 console.log(dTime(), 'Apply server time', serverTime, localTime, newTimeOffset, changed);
1742
1743 return changed;
1744};
1745/* harmony export (immutable) */ __webpack_exports__["applyServerTime"] = applyServerTime;
1746
1747
1748
1749
1750/***/ }),
1751/* 6 */
1752/***/ (function(module, exports) {
1753
1754module.exports = vendor;
1755
1756/***/ }),
1757/* 7 */
1758/***/ (function(module, __webpack_exports__, __webpack_require__) {
1759
1760"use strict";
1761/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(2);
1762/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
1763/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda__ = __webpack_require__(3);
1764/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_ramda__);
1765
1766
1767
1768
1769const ValueStore = () => {
1770 let val = null;
1771
1772 return {
1773 get: () => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["clone"])(val),
1774 set: newVal => val = newVal
1775 };
1776};
1777/* unused harmony export ValueStore */
1778
1779
1780const ValueStoreMap = () => {
1781 const val = new Map();
1782
1783 return {
1784 get: key => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["clone"])(val.get(key)),
1785 set: (key, newVal) => val.set(key, newVal)
1786 };
1787};
1788/* unused harmony export ValueStoreMap */
1789
1790
1791const TimeOffset = ValueStore();
1792/* harmony export (immutable) */ __webpack_exports__["b"] = TimeOffset;
1793
1794const dcList = ValueStoreMap();
1795/* unused harmony export dcList */
1796
1797
1798const flatProps = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["pipe"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["flip"])(__WEBPACK_IMPORTED_MODULE_1_ramda__["props"]), __WEBPACK_IMPORTED_MODULE_1_ramda__["unapply"]);
1799
1800const AsyncStorage = () => {
1801 let store = {};
1802
1803 const flatGet = flatProps(store);
1804 const set = obj => store = Object.assign({}, store, obj);
1805 const remove = keys => store = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["omit"])(keys, store);
1806 const clr = () => store = {};
1807 return {
1808 get: (...keys) => __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve(flatGet(...keys)),
1809 set: obj => __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve(set(obj)),
1810 remove: (...keys) => __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve(remove(keys)),
1811 clear: () => __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve(clr()),
1812 noPrefix: () => ({})
1813 };
1814};
1815/* unused harmony export AsyncStorage */
1816
1817
1818const PureStorage = AsyncStorage();
1819/* harmony export (immutable) */ __webpack_exports__["a"] = PureStorage;
1820 /*{
1821 get : (...keys) => new Promise(rs => ConfigStorage.get(keys, rs)),
1822 set : obj => new Promise(rs => ConfigStorage.set(obj, rs)),
1823 remove : (...keys) => new Promise(rs => ConfigStorage.remove(...keys, rs)),
1824 noPrefix: () => ConfigStorage.noPrefix(),
1825 clear : () => new Promise(rs => ConfigStorage.clear(rs))
1826 }*/
1827
1828/***/ }),
1829/* 8 */
1830/***/ (function(module, __webpack_exports__, __webpack_require__) {
1831
1832"use strict";
1833/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(2);
1834/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
1835
1836
1837const cancelToken = Symbol('cancel token');
1838
1839const timeoutRefs = new WeakSet();
1840
1841const pause = delay => new __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a(r => setTimeout(r, delay));
1842
1843const smartTimeout = (fn, delay = 0, ...args) => {
1844 const newToken = Symbol('cancel id');
1845 const checkRun = () => {
1846 if (timeoutRefs.has(newToken)) {
1847 timeoutRefs.delete(newToken);
1848 return fn(...args);
1849 } else return false;
1850 };
1851 const promise = pause(delay).then(checkRun);
1852 promise[cancelToken] = newToken;
1853 return promise;
1854};
1855/* harmony export (immutable) */ __webpack_exports__["a"] = smartTimeout;
1856
1857
1858smartTimeout.cancel = promise => {
1859 if (!promise || !promise[cancelToken]) return false;
1860 const token = promise[cancelToken];
1861 return timeoutRefs.has(token) ? timeoutRefs.delete(token) : false;
1862};
1863
1864smartTimeout.immediate = (fn, ...args) => __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve().then(() => fn(...args));
1865
1866smartTimeout.promise = (fn, delay = 0, ...args) => pause(delay).then(() => fn(...args));
1867
1868/* harmony default export */ __webpack_exports__["b"] = smartTimeout;
1869
1870/***/ }),
1871/* 9 */
1872/***/ (function(module, __webpack_exports__, __webpack_require__) {
1873
1874"use strict";
1875/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda__ = __webpack_require__(3);
1876/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_ramda__);
1877/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_detect_node__ = __webpack_require__(13);
1878/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_detect_node___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_detect_node__);
1879/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__defer__ = __webpack_require__(4);
1880/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__smart_timeout__ = __webpack_require__(8);
1881/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__bin__ = __webpack_require__(0);
1882
1883
1884
1885__webpack_require__(37);
1886
1887
1888
1889
1890
1891const convertIfArray = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["when"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["is"])(Array), __WEBPACK_IMPORTED_MODULE_4__bin__["b" /* convertToUint8Array */]);
1892let webWorker = !__WEBPACK_IMPORTED_MODULE_1_detect_node___default.a;
1893let taskID = 0;
1894const awaiting = {};
1895const webCrypto = __WEBPACK_IMPORTED_MODULE_1_detect_node___default.a ? false
1896//eslint-disable-next-line
1897: window.crypto.subtle || window.crypto.webkitSubtle //TODO remove browser depends
1898//eslint-disable-next-line
1899|| window.msCrypto && window.msCrypto.subtle;
1900const useWebCrypto = webCrypto && !!webCrypto.digest;
1901let useSha1Crypto = useWebCrypto;
1902let useSha256Crypto = useWebCrypto;
1903const finalizeTask = (taskID, result) => {
1904 const deferred = awaiting[taskID];
1905 if (deferred) {
1906 // console.log(rework_d_T(), 'CW done')
1907 deferred.resolve(result); //TODO Possibly, can be used as
1908 delete awaiting[taskID]; //
1909 } // deferred = Promise.resolve()
1910}; // deferred.resolve( result )
1911
1912const isCryptoTask = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["both"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["has"])('taskID'), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["has"])('result'));
1913
1914//eslint-disable-next-line
1915const workerEnable = !__WEBPACK_IMPORTED_MODULE_1_detect_node___default.a && window.Worker;
1916if (workerEnable) {
1917 const tmpWorker = new Worker('./bundle/hash.worker.js');
1918 // tmpWorker.onmessage = function(event) {
1919 // console.info('CW tmpWorker.onmessage', event && event.data)
1920 // }
1921 tmpWorker.onmessage = e => {
1922 if (e.data === 'ready') {
1923 console.info('CW ready');
1924 } else if (!isCryptoTask(e.data)) {
1925 console.info('Not crypto task', e, e.data);
1926 return e;
1927 } else return webWorker ? finalizeTask(e.data.taskID, e.data.result) : webWorker = tmpWorker;
1928 };
1929
1930 tmpWorker.onerror = function (error) {
1931 console.error('CW error', error, error.stack);
1932 webWorker = false;
1933 };
1934 tmpWorker.postMessage('b');
1935 webWorker = tmpWorker;
1936}
1937
1938const performTaskWorker = (task, params, embed) => {
1939 // console.log(rework_d_T(), 'CW start', task)
1940 const deferred = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__defer__["b" /* default */])();
1941
1942 awaiting[taskID] = deferred;
1943
1944 params.task = task;
1945 params.taskID = taskID;(embed || webWorker).postMessage(params);
1946
1947 taskID++;
1948
1949 return deferred.promise;
1950};
1951
1952const sha1Hash = bytes => {
1953 if (useSha1Crypto) {
1954 // We don't use buffer since typedArray.subarray(...).buffer gives the whole buffer and not sliced one.
1955 // webCrypto.digest supports typed array
1956 const bytesTyped = convertIfArray(bytes);
1957 // console.log(rework_d_T(), 'Native sha1 start')
1958 return webCrypto.digest({ name: 'SHA-1' }, bytesTyped).then(digest =>
1959 // console.log(rework_d_T(), 'Native sha1 done')
1960 digest, e => {
1961 console.error('Crypto digest error', e);
1962 useSha1Crypto = false;
1963 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["m" /* sha1HashSync */])(bytes);
1964 });
1965 }
1966 return __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(__WEBPACK_IMPORTED_MODULE_4__bin__["m" /* sha1HashSync */], bytes);
1967};
1968
1969const sha256Hash = bytes => {
1970 if (useSha256Crypto) {
1971 const bytesTyped = convertIfArray(bytes);
1972 // console.log(rework_d_T(), 'Native sha1 start')
1973 return webCrypto.digest({ name: 'SHA-256' }, bytesTyped).then(__WEBPACK_IMPORTED_MODULE_0_ramda__["identity"]
1974 // console.log(rework_d_T(), 'Native sha1 done')
1975 , e => {
1976 console.error('Crypto digest error', e);
1977 useSha256Crypto = false;
1978 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["n" /* sha256HashSync */])(bytes);
1979 });
1980 }
1981 return __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(__WEBPACK_IMPORTED_MODULE_4__bin__["n" /* sha256HashSync */], bytes);
1982};
1983
1984const aesEncrypt = (bytes, keyBytes, ivBytes) => __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(() => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["c" /* convertToArrayBuffer */])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["o" /* aesEncryptSync */])(bytes, keyBytes, ivBytes)));
1985
1986const aesDecrypt = (encryptedBytes, keyBytes, ivBytes) => __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(() => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["c" /* convertToArrayBuffer */])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["p" /* aesDecryptSync */])(encryptedBytes, keyBytes, ivBytes)));
1987
1988const factorize = bytes => {
1989 bytes = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__bin__["q" /* convertToByteArray */])(bytes);
1990 return webWorker ? performTaskWorker('factorize', { bytes }) : __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(__WEBPACK_IMPORTED_MODULE_4__bin__["r" /* pqPrimeFactorization */], bytes);
1991};
1992
1993const modPow = (x, y, m) => webWorker ? performTaskWorker('mod-pow', {
1994 x,
1995 y,
1996 m
1997}) : __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["b" /* default */].immediate(__WEBPACK_IMPORTED_MODULE_4__bin__["s" /* bytesModPow */], x, y, m);
1998
1999const CryptoWorker = {
2000 sha1Hash,
2001 sha256Hash,
2002 aesEncrypt,
2003 aesDecrypt,
2004 factorize,
2005 modPow
2006};
2007/* harmony export (immutable) */ __webpack_exports__["a"] = CryptoWorker;
2008
2009
2010/* harmony default export */ __webpack_exports__["b"] = CryptoWorker;
2011
2012/***/ }),
2013/* 10 */
2014/***/ (function(module, __webpack_exports__, __webpack_require__) {
2015
2016"use strict";
2017/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_axios__ = __webpack_require__(40);
2018/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_axios___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_axios__);
2019
2020
2021const httpClient = __WEBPACK_IMPORTED_MODULE_0_axios___default.a.create();
2022/* harmony export (immutable) */ __webpack_exports__["a"] = httpClient;
2023
2024delete httpClient.defaults.headers.post['Content-Type'];
2025delete httpClient.defaults.headers.common['Accept'];
2026
2027/* harmony default export */ __webpack_exports__["b"] = httpClient;
2028
2029/***/ }),
2030/* 11 */
2031/***/ (function(module, __webpack_exports__, __webpack_require__) {
2032
2033"use strict";
2034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jsbn__ = __webpack_require__(14);
2035/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jsbn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jsbn__);
2036
2037
2038const random = new __WEBPACK_IMPORTED_MODULE_0_jsbn__["SecureRandom"]();
2039/* unused harmony export random */
2040
2041
2042/* harmony default export */ __webpack_exports__["a"] = random;
2043
2044/***/ }),
2045/* 12 */
2046/***/ (function(module, __webpack_exports__, __webpack_require__) {
2047
2048"use strict";
2049/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(2);
2050/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
2051/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_eventemitter2__ = __webpack_require__(35);
2052/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_eventemitter2___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_eventemitter2__);
2053/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_ramda__ = __webpack_require__(3);
2054/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_ramda__);
2055/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__networker__ = __webpack_require__(17);
2056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__authorizer__ = __webpack_require__(30);
2057/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__store__ = __webpack_require__(7);
2058/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__defer__ = __webpack_require__(4);
2059/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__time_manager__ = __webpack_require__(5);
2060/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__dc_configurator__ = __webpack_require__(16);
2061/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__tl__ = __webpack_require__(34);
2062/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__rsa_keys_manger__ = __webpack_require__(32);
2063/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__bin__ = __webpack_require__(0);
2064/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__error_cases__ = __webpack_require__(29);
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083const api57 = __webpack_require__(38);
2084const mtproto57 = __webpack_require__(39);
2085
2086const hasPath = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["pathSatisfies"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["complement"])(__WEBPACK_IMPORTED_MODULE_2_ramda__["isNil"]));
2087const defDc = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["unless"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["is"])(Number), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["always"])(2));
2088const withoutNil = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["reject"])(__WEBPACK_IMPORTED_MODULE_2_ramda__["isNil"]);
2089
2090const baseDcID = 2;
2091
2092const Ln = (length, obj) => obj && __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["propEq"])('length', length, obj);
2093
2094class ApiManager {
2095
2096 constructor({
2097 server = {},
2098 api = {},
2099 app: {
2100 debug = false,
2101 storage = __WEBPACK_IMPORTED_MODULE_5__store__["a" /* PureStorage */]
2102 } = {},
2103 schema = api57,
2104 mtSchema = mtproto57
2105 } = {}) {
2106 this.emitter = new __WEBPACK_IMPORTED_MODULE_1_eventemitter2___default.a({
2107 wildcard: true
2108 });
2109 this.on = this.emitter.on.bind(this.emitter);
2110 this.emit = this.emitter.emit.bind(this.emitter);
2111 this.cache = {
2112 uploader: {},
2113 downloader: {},
2114 auth: {},
2115 servers: {}
2116 };
2117
2118 this.mtpGetNetworker = (dcID, options = {}) => {
2119 const isUpload = options.fileUpload || options.fileDownload;
2120 const cache = isUpload ? this.cache.uploader : this.cache.downloader;
2121 if (!dcID) throw new Error('get Networker without dcID');
2122
2123 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["isNil"])(cache[dcID])) return cache[dcID];
2124
2125 const akk = `dc${dcID}_auth_key`;
2126 const ssk = `dc${dcID}_server_salt`;
2127
2128 const dcUrl = this.chooseServer(dcID, isUpload);
2129
2130 const networkGetter = result => {
2131 if (cache[dcID]) return cache[dcID];
2132
2133 const authKeyHex = result[0];
2134 let serverSaltHex = result[1];
2135 // console.log('ass', dcID, authKeyHex, serverSaltHex)
2136 if (Ln(512, authKeyHex)) {
2137 if (!serverSaltHex || serverSaltHex.length !== 16) serverSaltHex = 'AAAAAAAAAAAAAAAA';
2138 const authKey = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_11__bin__["u" /* bytesFromHex */])(authKeyHex);
2139 const serverSalt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_11__bin__["u" /* bytesFromHex */])(serverSaltHex);
2140
2141 return cache[dcID] = new this.networkFabric(dcID, authKey, serverSalt, options);
2142 }
2143
2144 if (!options.createNetworker) return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject({ type: 'AUTH_KEY_EMPTY', code: 401 });
2145
2146 const onDcAuth = ({ authKey, serverSalt }) => {
2147 const storeObj = {
2148 [akk]: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_11__bin__["f" /* bytesToHex */])(authKey),
2149 [ssk]: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_11__bin__["f" /* bytesToHex */])(serverSalt)
2150 };
2151 this.storage.set(storeObj);
2152
2153 return cache[dcID] = new this.networkFabric(dcID, authKey, serverSalt, options);
2154 };
2155
2156 return this.auth(dcID, this.cache.auth, dcUrl).then(onDcAuth, netError);
2157 };
2158
2159 return this.storage.get(akk, ssk).then(networkGetter);
2160 };
2161
2162 this.mtpClearStorage = function () {
2163 const saveKeys = [];
2164 for (let dcID = 1; dcID <= 5; dcID++) {
2165 saveKeys.push(`dc${dcID}_auth_key`);
2166 saveKeys.push(`t_dc${dcID}_auth_key`);
2167 }
2168 this.storage.noPrefix(); //TODO Remove noPrefix
2169 return this.storage.get(saveKeys).tap(this.storage.clear).then(values => {
2170 const restoreObj = {};
2171 saveKeys.forEach((key, i) => {
2172 const value = values[i];
2173 if (value !== false && value !== undefined) restoreObj[key] = value;
2174 });
2175 this.storage.noPrefix();
2176 return restoreObj;
2177 }).then(this.storage.set);
2178 };
2179
2180 this.storage = storage;
2181 this.serverConfig = server;
2182 this.debug = debug;
2183 this.schema = schema;
2184 this.mtSchema = mtSchema;
2185 this.chooseServer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__dc_configurator__["chooseServer"])(this.cache.servers, server);
2186 this.mtpInvokeApi = this.mtpInvokeApi.bind(this);
2187 this.setUserAuth = this.setUserAuth.bind(this);
2188
2189 this.TL = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__tl__["a" /* default */])(schema, mtSchema);
2190 this.keyManager = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_10__rsa_keys_manger__["a" /* default */])(this.TL.Serialization);
2191 this.auth = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__authorizer__["a" /* default */])(this.TL, this.keyManager);
2192 this.apiConfig = Object.assign({}, ApiManager.apiConfig, withoutNil(api));
2193 this.networkFabric = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__networker__["default"])(this.apiConfig, this.chooseServer, this.TL, storage, this.emit, debug);
2194
2195 // return new Proxy(this, {
2196 // get(ctx, name) {
2197 // const result = Reflect.get(ctx, name)
2198 // console.info('get', name, type(result))
2199 // return result
2200 // }
2201 // })
2202 }
2203
2204 mtpInvokeApi(method, params, options = {}) {
2205 // const self = this
2206 const deferred = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__defer__["b" /* default */])();
2207 const rejectPromise = error => {
2208 if (!error) error = { type: 'ERROR_EMPTY' };else if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_ramda__["is"])(Object, error)) error = { message: error };
2209 deferred.reject(error);
2210
2211 if (!options.noErrorBox) {
2212 //TODO weird code. `error` changed after `.reject`?
2213 error.input = method;
2214 error.stack = stack || hasPath(['originalError', 'stack'], error) || error.stack || new Error().stack;
2215 this.emit('error.invoke', error);
2216 }
2217 };
2218 let dcID, cachedNetworker;
2219
2220 const cachedNetThunk = () => performRequest(cachedNetworker);
2221 const requestThunk = waitTime => setTimeout(cachedNetThunk, waitTime * 1e3);
2222
2223 const defError = new Error();
2224 const stack = defError.stack || 'empty stack';
2225 const performRequest = networker => (cachedNetworker = networker).wrapApiCall(method, params, options).then(deferred.resolve, error => {
2226 const deferResolve = deferred.resolve;
2227 const apiSavedNet = () => cachedNetworker = networker;
2228 const apiRecall = networker => networker.wrapApiCall(method, params, options);
2229 console.error(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__time_manager__["dTime"])(), 'Error', error.code, error.type, baseDcID, dcID);
2230
2231 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_12__error_cases__["a" /* switchErrors */])(error, options, dcID, baseDcID)(error, options, this.emit, rejectPromise, requestThunk, apiSavedNet, apiRecall, deferResolve, this.mtpInvokeApi, this.mtpGetNetworker, this.storage);
2232 });
2233 const getDcNetworker = (baseDcID = 2) => this.mtpGetNetworker(dcID = defDc(baseDcID), options);
2234
2235 dcID = options.dcID || baseDcID;
2236 if (dcID) __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve(this.mtpGetNetworker(dcID, options)).then(performRequest).catch(rejectPromise);else this.storage.get('dc').then(getDcNetworker).then(performRequest).catch(rejectPromise);
2237
2238 return deferred.promise;
2239 }
2240 setUserAuth(dcID, userAuth) {
2241 const fullUserAuth = Object.assign({ dcID }, userAuth);
2242 this.storage.set({
2243 dc: dcID,
2244 user_auth: fullUserAuth
2245 });
2246 this.emit('auth.dc', { dc: dcID, auth: userAuth });
2247 }
2248}
2249/* harmony export (immutable) */ __webpack_exports__["a"] = ApiManager;
2250
2251
2252ApiManager.apiConfig = {
2253 invokeWithLayer: 0xda9b0d0d,
2254 layer: NaN,
2255 initConnection: 0x69796de9,
2256 api_id: '',
2257 device_model: 'Unknown UserAgent',
2258 system_version: 'Unknown Platform',
2259 app_version: '',
2260 lang_code: 'en'
2261};
2262const netError = error => {
2263 console.log('Get networker error', error, error.stack);
2264 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(error);
2265};
2266
2267/***/ }),
2268/* 13 */
2269/***/ (function(module, exports, __webpack_require__) {
2270
2271/* WEBPACK VAR INJECTION */(function(global) {module.exports = false;
2272
2273// Only Node.JS has a process variable that is of [[Class]] process
2274try {
2275 module.exports = Object.prototype.toString.call(global.process) === '[object process]'
2276} catch(e) {}
2277
2278/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18)))
2279
2280/***/ }),
2281/* 14 */
2282/***/ (function(module, exports, __webpack_require__) {
2283
2284module.exports = (__webpack_require__(6))(126);
2285
2286/***/ }),
2287/* 15 */
2288/***/ (function(module, __webpack_exports__, __webpack_require__) {
2289
2290"use strict";
2291/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda__ = __webpack_require__(3);
2292/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_ramda__);
2293
2294
2295const indexedMap = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["addIndex"])(__WEBPACK_IMPORTED_MODULE_0_ramda__["map"]);
2296const forEach = (data, func) => __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["pipe"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["reject"])(__WEBPACK_IMPORTED_MODULE_0_ramda__["isNil"]), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["ifElse"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["is"])(Array), indexedMap(func), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["mapObjIndexed"])(func)))(data);
2297/* harmony export (immutable) */ __webpack_exports__["a"] = forEach;
2298
2299
2300/* harmony default export */ __webpack_exports__["b"] = forEach;
2301
2302/***/ }),
2303/* 16 */
2304/***/ (function(module, __webpack_exports__, __webpack_require__) {
2305
2306"use strict";
2307Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
2308/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda__ = __webpack_require__(3);
2309/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_ramda__);
2310
2311
2312const sslSubdomains = ['pluto', 'venus', 'aurora', 'vesta', 'flora'];
2313
2314const devDC = [{ id: 1, host: '149.154.175.10', port: 80 }, { id: 2, host: '149.154.167.40', port: 80 }, { id: 3, host: '149.154.175.117', port: 80 }];
2315
2316const prodDC = [{ id: 1, host: '149.154.175.50', port: 80 }, { id: 2, host: '149.154.167.51', port: 80 }, { id: 3, host: '149.154.175.100', port: 80 }, { id: 4, host: '149.154.167.91', port: 80 }, { id: 5, host: '149.154.171.5', port: 80 }];
2317
2318const portString = ({ port = 80 }) => port === 80 ? '' : `:${port}`;
2319
2320const findById = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["pipe"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["propEq"])('id'), __WEBPACK_IMPORTED_MODULE_0_ramda__["find"]);
2321
2322const chooseServer = (chosenServers, {
2323 dev = false,
2324 webogram = false,
2325 dcList = dev ? devDC : prodDC
2326} = {}) => (dcID, upload = false) => {
2327 const choosen = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["prop"])(dcID);
2328 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_ramda__["has"])(dcID, chosenServers)) return choosen(chosenServers);
2329 let chosenServer = false;
2330
2331 if (webogram) {
2332 const subdomain = sslSubdomains[dcID - 1] + (upload ? '-1' : '');
2333 const path = dev ? 'apiw_test1' : 'apiw1';
2334 chosenServer = `https://${subdomain}.web.telegram.org/${path}`;
2335 return chosenServer; //TODO Possibly bug. Isn't it necessary? chosenServers[dcID] = chosenServer
2336 }
2337 const dcOption = findById(dcID)(dcList);
2338 if (dcOption) chosenServer = `http://${dcOption.host}${portString(dcOption)}/apiw1`;
2339 chosenServers[dcID] = chosenServer;
2340
2341 return choosen(chosenServers);
2342};
2343/* harmony export (immutable) */ __webpack_exports__["chooseServer"] = chooseServer;
2344
2345
2346/***/ }),
2347/* 17 */
2348/***/ (function(module, __webpack_exports__, __webpack_require__) {
2349
2350"use strict";
2351Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
2352/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(2);
2353/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
2354/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda__ = __webpack_require__(3);
2355/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_ramda__);
2356/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__crypto__ = __webpack_require__(9);
2357/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__time_manager__ = __webpack_require__(5);
2358/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__secure_random__ = __webpack_require__(11);
2359/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__for_each__ = __webpack_require__(15);
2360/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__smart_timeout__ = __webpack_require__(8);
2361/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__defer__ = __webpack_require__(4);
2362/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__http__ = __webpack_require__(10);
2363/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__bin__ = __webpack_require__(0);
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378let updatesProcessor;
2379let iii = 0;
2380let offlineInited = false;
2381let akStopped = false;
2382// const chromeMatches = navigator.userAgent.match(/Chrome\/(\d+(\.\d+)?)/)
2383// const chromeVersion = chromeMatches && parseFloat(chromeMatches[1]) || false
2384// const xhrSendBuffer = !('ArrayBufferView' in window) && (!chromeVersion || chromeVersion < 30)
2385
2386
2387const NetworkerFabric = (appConfig, chooseServer, { Serialization, Deserialization }, storage, emit, debug) => {
2388 var _class, _temp, _initialiseProps;
2389
2390 return _temp = _class = class NetworkerThread {
2391 constructor(dc, authKey, serverSalt, options = {}) {
2392 _initialiseProps.call(this);
2393
2394 this.dcID = dc;
2395 this.iii = iii++;
2396
2397 this.authKey = authKey;
2398 this.authKeyUint8 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["b" /* convertToUint8Array */])(authKey);
2399 this.authKeyBuffer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["c" /* convertToArrayBuffer */])(authKey);
2400 this.authKeyID = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["d" /* sha1BytesSync */])(authKey).slice(-8);
2401
2402 this.serverSalt = serverSalt;
2403
2404 this.upload = options.fileUpload || options.fileDownload || false;
2405
2406 this.updateSession();
2407
2408 this.lastServerMessages = [];
2409
2410 this.currentRequests = 0;
2411 this.checkConnectionPeriod = 0;
2412
2413 this.sentMessages = {};
2414 this.clientMessages = [];
2415
2416 this.pendingMessages = {};
2417 this.pendingAcks = [];
2418 this.pendingResends = [];
2419 this.connectionInited = false;
2420
2421 this.pendingTimeouts = [];
2422
2423 setInterval(this.checkLongPoll, 10000);
2424 this.checkLongPoll();
2425
2426 if (!offlineInited) offlineInited = true;
2427 }
2428 updateSession() {
2429 this.seqNo = 0;
2430 this.prevSessionID = this.sessionID;
2431 this.sessionID = new Array(8);
2432 __WEBPACK_IMPORTED_MODULE_4__secure_random__["a" /* default */].nextBytes(this.sessionID);
2433 }
2434
2435 updateSentMessage(sentMessageID) {
2436 const sentMessage = this.sentMessages[sentMessageID];
2437 if (!sentMessage) return false;
2438
2439 if (sentMessage.container) {
2440 const newInner = [];
2441 const updateInner = innerSentMessageID => {
2442 const innerSentMessage = this.updateSentMessage(innerSentMessageID);
2443 if (innerSentMessage) newInner.push(innerSentMessage.msg_id);
2444 };
2445 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(sentMessage.inner, updateInner);
2446 sentMessage.inner = newInner;
2447 }
2448
2449 sentMessage.msg_id = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])();
2450 sentMessage.seq_no = this.generateSeqNo(sentMessage.notContentRelated || sentMessage.container);
2451 this.sentMessages[sentMessage.msg_id] = sentMessage;
2452 delete this.sentMessages[sentMessageID];
2453
2454 return sentMessage;
2455 }
2456
2457 generateSeqNo(notContentRelated) {
2458 let seqNo = this.seqNo * 2;
2459
2460 if (!notContentRelated) {
2461 seqNo++;
2462 this.seqNo++;
2463 }
2464
2465 return seqNo;
2466 }
2467
2468 wrapMtpCall(method, params, options) {
2469 const serializer = new Serialization({ mtproto: true });
2470
2471 serializer.storeMethod(method, params);
2472
2473 const messageID = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])();
2474 const seqNo = this.generateSeqNo();
2475 const message = {
2476 msg_id: messageID,
2477 seq_no: seqNo,
2478 body: serializer.getBytes()
2479 };
2480
2481 if (debug) console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'MT call', method, params, messageID, seqNo);
2482
2483 return this.pushMessage(message, options);
2484 }
2485
2486 wrapMtpMessage(object, options = {}) {
2487
2488 const serializer = new Serialization({ mtproto: true });
2489 serializer.storeObject(object, 'Object');
2490
2491 const messageID = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])();
2492 const seqNo = this.generateSeqNo(options.notContentRelated);
2493 const message = {
2494 msg_id: messageID,
2495 seq_no: seqNo,
2496 body: serializer.getBytes()
2497 };
2498
2499 if (debug) console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'MT message', object, messageID, seqNo);
2500
2501 return this.pushMessage(message, options);
2502 }
2503
2504 wrapApiCall(method, params, options) {
2505 const serializer = new Serialization(options);
2506
2507 if (!this.connectionInited) {
2508 // serializer.storeInt(0xda9b0d0d, 'invokeWithLayer')
2509 // serializer.storeInt(Config.Schema.API.layer, 'layer')
2510 // serializer.storeInt(0x69796de9, 'initConnection')
2511 // serializer.storeInt(Config.App.id, 'api_id')
2512 // serializer.storeString(navigator.userAgent || 'Unknown UserAgent', 'device_model')
2513 // serializer.storeString(navigator.platform || 'Unknown Platform', 'system_version')
2514 // serializer.storeString(Config.App.version, 'app_version')
2515 // serializer.storeString(navigator.language || 'en', 'lang_code')
2516 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["mapObjIndexed"])(serializer.storeIntString, appConfig);
2517 }
2518
2519 if (options.afterMessageID) {
2520 serializer.storeInt(0xcb9f372d, 'invokeAfterMsg');
2521 serializer.storeLong(options.afterMessageID, 'msg_id');
2522 }
2523
2524 options.resultType = serializer.storeMethod(method, params);
2525
2526 const messageID = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])();
2527 const seqNo = this.generateSeqNo();
2528 const message = {
2529 msg_id: messageID,
2530 seq_no: seqNo,
2531 body: serializer.getBytes(true),
2532 isAPI: true
2533 };
2534
2535 if (debug) console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Api call', method, params, messageID, seqNo, options);else console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Api call', method);
2536
2537 return this.pushMessage(message, options);
2538 }
2539
2540 pushMessage(message, options = {}) {
2541 const deferred = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__defer__["b" /* default */])();
2542
2543 this.sentMessages[message.msg_id] = Object.assign({}, message, options, { deferred });
2544 this.pendingMessages[message.msg_id] = 0;
2545
2546 if (!options || !options.noShedule) this.sheduleRequest();
2547 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(Object, options)) options.messageID = message.msg_id;
2548
2549 return deferred.promise;
2550 }
2551
2552 pushResend(messageID, delay) {
2553 const value = delay ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])() + delay : 0;
2554 const innerMap = innerMsg => this.pendingMessages[innerMsg] = value;
2555 const sentMessage = this.sentMessages[messageID];
2556 if (sentMessage.container) sentMessage.inner.forEach(innerMap);else this.pendingMessages[messageID] = value;
2557
2558 // console.log('Resend due', messageID, this.pendingMessages)
2559
2560 this.sheduleRequest(delay);
2561 }
2562
2563 getMsgKeyIv(msgKey, isOut) {
2564 const authKey = this.authKeyUint8;
2565 const x = isOut ? 0 : 8;
2566 const sha1aText = new Uint8Array(48);
2567 const sha1bText = new Uint8Array(48);
2568 const sha1cText = new Uint8Array(48);
2569 const sha1dText = new Uint8Array(48);
2570 const promises = {};
2571
2572 sha1aText.set(msgKey, 0);
2573 sha1aText.set(authKey.subarray(x, x + 32), 16);
2574 promises.sha1a = __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash(sha1aText);
2575
2576 sha1bText.set(authKey.subarray(x + 32, x + 48), 0);
2577 sha1bText.set(msgKey, 16);
2578 sha1bText.set(authKey.subarray(x + 48, x + 64), 32);
2579 promises.sha1b = __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash(sha1bText);
2580
2581 sha1cText.set(authKey.subarray(x + 64, x + 96), 0);
2582 sha1cText.set(msgKey, 32);
2583 promises.sha1c = __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash(sha1cText);
2584
2585 sha1dText.set(msgKey, 0);
2586 sha1dText.set(authKey.subarray(x + 96, x + 128), 16);
2587 promises.sha1d = __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash(sha1dText);
2588
2589 const onAll = result => {
2590 const aesKey = new Uint8Array(32),
2591 aesIv = new Uint8Array(32),
2592 sha1a = new Uint8Array(result[0]),
2593 sha1b = new Uint8Array(result[1]),
2594 sha1c = new Uint8Array(result[2]),
2595 sha1d = new Uint8Array(result[3]);
2596
2597 aesKey.set(sha1a.subarray(0, 8));
2598 aesKey.set(sha1b.subarray(8, 20), 8);
2599 aesKey.set(sha1c.subarray(4, 16), 20);
2600
2601 aesIv.set(sha1a.subarray(8, 20));
2602 aesIv.set(sha1b.subarray(0, 8), 12);
2603 aesIv.set(sha1c.subarray(16, 20), 20);
2604 aesIv.set(sha1d.subarray(0, 8), 24);
2605
2606 return [aesKey, aesIv];
2607 };
2608
2609 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.all(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["values"])(promises)).then(onAll);
2610 }
2611
2612 toggleOffline(enabled) {
2613 // console.log('toggle ', enabled, this.dcID, this.iii)
2614 if (this.offline !== undefined && this.offline == enabled) return false;
2615
2616 this.offline = enabled;
2617
2618 if (this.offline) {
2619 __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].cancel(this.nextReqPromise);
2620 delete this.nextReq;
2621
2622 if (this.checkConnectionPeriod < 1.5) this.checkConnectionPeriod = 0;
2623
2624 this.checkConnectionPromise = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */])(this.checkConnection, parseInt(this.checkConnectionPeriod * 1000));
2625 this.checkConnectionPeriod = Math.min(30, (1 + this.checkConnectionPeriod) * 1.5);
2626
2627 this.onOnlineCb = this.checkConnection;
2628 emit('net.offline', this.onOnlineCb);
2629 } else {
2630 delete this.longPollPending;
2631 this.checkLongPoll();
2632 this.sheduleRequest();
2633
2634 if (this.onOnlineCb) emit('net.online', this.onOnlineCb);
2635
2636 __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].cancel(this.checkConnectionPromise);
2637 }
2638 }
2639
2640
2641 getEncryptedMessage(bytes) {
2642 let msgKey;
2643 const f1 = __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash;
2644 const f2 = bytesHash => {
2645 msgKey = new Uint8Array(bytesHash).subarray(4, 20);
2646 return this.getMsgKeyIv(msgKey, true);
2647 };
2648 const f3 = keyIv => __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].aesEncrypt(bytes, keyIv[0], keyIv[1]);
2649 const f4 = encryptedBytes => ({
2650 bytes: encryptedBytes,
2651 msgKey
2652 });
2653 const encryptFlow = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["pipeP"])(f1, f2, f3, f4);
2654 return encryptFlow(bytes);
2655 }
2656
2657 getDecryptedMessage(msgKey, encryptedData) {
2658 const getKeyCurry = key => this.getMsgKeyIv(key, false);
2659 const cryptoAesCurry = keyIv => __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].aesDecrypt(encryptedData, keyIv[0], keyIv[1]);
2660 const decryptFlow = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["pipeP"])(getKeyCurry, cryptoAesCurry);
2661 return decryptFlow(msgKey);
2662 }
2663
2664 parseResponse(responseBuffer) {
2665 // console.log(dTime(), 'Start parsing response')
2666 // const self = this
2667
2668 const deserializer = new Deserialization(responseBuffer);
2669
2670 const authKeyID = deserializer.fetchIntBytes(64, false, 'auth_key_id');
2671 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["e" /* bytesCmp */])(authKeyID, this.authKeyID)) {
2672 throw new Error(`[MT] Invalid server auth_key_id: ${__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["f" /* bytesToHex */])(authKeyID)}`);
2673 }
2674 const msgKey = deserializer.fetchIntBytes(128, true, 'msg_key');
2675 const encryptedData = deserializer.fetchRawBytes(responseBuffer.byteLength - deserializer.getOffset(), true, 'encrypted_data');
2676
2677 const afterDecrypt = dataWithPadding => {
2678 // console.log(dTime(), 'after decrypt')
2679 const deserializer = new Deserialization(dataWithPadding, { mtproto: true });
2680
2681 const salt = deserializer.fetchIntBytes(64, false, 'salt');
2682 const sessionID = deserializer.fetchIntBytes(64, false, 'session_id');
2683 const messageID = deserializer.fetchLong('message_id');
2684
2685 const isInvalidSession = !__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["e" /* bytesCmp */])(sessionID, this.sessionID) && (!this.prevSessionID || !__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["e" /* bytesCmp */])(sessionID, this.prevSessionID));
2686 if (isInvalidSession) {
2687 console.warn('Sessions', sessionID, this.sessionID, this.prevSessionID);
2688 throw new Error(`[MT] Invalid server session_id: ${__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["f" /* bytesToHex */])(sessionID)}`);
2689 }
2690
2691 const seqNo = deserializer.fetchInt('seq_no');
2692
2693 let offset = deserializer.getOffset();
2694 const totalLength = dataWithPadding.byteLength;
2695
2696 const messageBodyLength = deserializer.fetchInt('message_data[length]');
2697 if (messageBodyLength % 4 || messageBodyLength > totalLength - offset) {
2698 throw new Error(`[MT] Invalid body length: ${messageBodyLength}`);
2699 }
2700 const messageBody = deserializer.fetchRawBytes(messageBodyLength, true, 'message_data');
2701
2702 offset = deserializer.getOffset();
2703 const paddingLength = totalLength - offset;
2704 if (paddingLength < 0 || paddingLength > 15) throw new Error(`[MT] Invalid padding length: ${paddingLength}`);
2705 const hashData = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["b" /* convertToUint8Array */])(dataWithPadding).subarray(0, offset);
2706
2707 const afterShaHash = dataHash => {
2708 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["e" /* bytesCmp */])(msgKey, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["g" /* bytesFromArrayBuffer */])(dataHash).slice(-16))) {
2709 console.warn(msgKey, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["g" /* bytesFromArrayBuffer */])(dataHash));
2710 throw new Error('[MT] server msgKey mismatch');
2711 }
2712
2713 const buffer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["h" /* bytesToArrayBuffer */])(messageBody);
2714 const deserializerOptions = getDeserializeOpts(this.getMsgById);
2715 const deserializer = new Deserialization(buffer, deserializerOptions);
2716 const response = deserializer.fetchObject('', 'INPUT');
2717
2718 return {
2719 response,
2720 messageID,
2721 sessionID,
2722 seqNo
2723 };
2724 };
2725 return __WEBPACK_IMPORTED_MODULE_2__crypto__["b" /* default */].sha1Hash(hashData).then(afterShaHash);
2726 };
2727
2728 return this.getDecryptedMessage(msgKey, encryptedData).then(afterDecrypt);
2729 }
2730
2731 applyServerSalt(newServerSalt) {
2732 const serverSalt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["i" /* longToBytes */])(newServerSalt);
2733
2734 const storeObj = {
2735 [`dc${this.dcID}_server_salt`]: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["f" /* bytesToHex */])(serverSalt)
2736 };
2737 storage.set(storeObj);
2738
2739 this.serverSalt = serverSalt;
2740 return true;
2741 }
2742
2743 sheduleRequest(delay = 0) {
2744 if (this.offline) this.checkConnection('forced shedule');
2745 const nextReq = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])() + delay;
2746
2747 if (delay && this.nextReq && this.nextReq <= nextReq) return false;
2748
2749 // console.log(dTime(), 'shedule req', delay)
2750 // console.trace()
2751 __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].cancel(this.nextReqPromise);
2752 if (delay > 0) this.nextReqPromise = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */])(this.performSheduledRequest, delay);else __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].immediate(this.performSheduledRequest);
2753
2754 this.nextReq = nextReq;
2755 }
2756
2757 ackMessage(msgID) {
2758 // console.log('ack message', msgID)
2759 this.pendingAcks.push(msgID);
2760 this.sheduleRequest(30000);
2761 }
2762
2763 reqResendMessage(msgID) {
2764 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Req resend', msgID);
2765 this.pendingResends.push(msgID);
2766 this.sheduleRequest(100);
2767 }
2768
2769 cleanupSent() {
2770 let notEmpty = false;
2771 // console.log('clean start', this.dcID/*, this.sentMessages*/)
2772 const cleanMessages = (message, msgID) => {
2773 // console.log('clean iter', msgID, message)
2774 if (message.notContentRelated && this.pendingMessages[msgID] === undefined) {
2775 // console.log('clean notContentRelated', msgID)
2776 delete this.sentMessages[msgID];
2777 } else if (message.container) {
2778 for (let i = 0; i < message.inner.length; i++) {
2779 if (this.sentMessages[message.inner[i]] !== undefined) {
2780 // console.log('clean failed, found', msgID, message.inner[i], this.sentMessages[message.inner[i]].seq_no)
2781 notEmpty = true;
2782 return;
2783 }
2784 }
2785 // console.log('clean container', msgID)
2786 delete this.sentMessages[msgID];
2787 } else {
2788 notEmpty = true;
2789 }
2790 };
2791 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(this.sentMessages, cleanMessages);
2792
2793 return !notEmpty;
2794 }
2795
2796 processError(rawError) {
2797 const matches = (rawError.error_message || '').match(/^([A-Z_0-9]+\b)(: (.+))?/) || [];
2798 rawError.error_code = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["j" /* uintToInt */])(rawError.error_code);
2799
2800 return {
2801 code: !rawError.error_code || rawError.error_code <= 0 ? 500 : rawError.error_code,
2802 type: matches[1] || 'UNKNOWN',
2803 description: matches[3] || `CODE#${rawError.error_code} ${rawError.error_message}`,
2804 originalError: rawError
2805 };
2806 }
2807
2808 processMessage(message, messageID, sessionID) {
2809 const msgidInt = parseInt(messageID.toString(10).substr(0, -10), 10);
2810 if (msgidInt % 2) {
2811 console.warn('[MT] Server even message id: ', messageID, message);
2812 return;
2813 }
2814 // console.log('process message', message, messageID, sessionID)
2815 switch (message._) {
2816 case 'msg_container':
2817 {
2818 const len = message.messages.length;
2819 for (let i = 0; i < len; i++) {
2820 this.processMessage(message.messages[i], message.messages[i].msg_id, sessionID);
2821 }
2822 break;
2823 }
2824 case 'bad_server_salt':
2825 {
2826 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Bad server salt', message);
2827 const sentMessage = this.sentMessages[message.bad_msg_id];
2828 if (!sentMessage || sentMessage.seq_no != message.bad_msg_seqno) {
2829 console.log(message.bad_msg_id, message.bad_msg_seqno);
2830 throw new Error('[MT] Bad server salt for invalid message');
2831 }
2832
2833 this.applyServerSalt(message.new_server_salt);
2834 this.pushResend(message.bad_msg_id);
2835 this.ackMessage(messageID);
2836 break;
2837 }
2838 case 'bad_msg_notification':
2839 {
2840 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Bad msg notification', message);
2841 const sentMessage = this.sentMessages[message.bad_msg_id];
2842 if (!sentMessage || sentMessage.seq_no != message.bad_msg_seqno) {
2843 console.log(message.bad_msg_id, message.bad_msg_seqno);
2844 throw new Error('[MT] Bad msg notification for invalid message');
2845 }
2846
2847 if (message.error_code == 16 || message.error_code == 17) {
2848 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["applyServerTime"])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["k" /* bigStringInt */])(messageID).shiftRight(32).toString(10))) {
2849 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Update session');
2850 this.updateSession();
2851 }
2852 const badMessage = this.updateSentMessage(message.bad_msg_id);
2853 this.pushResend(badMessage.msg_id);
2854 this.ackMessage(messageID);
2855 }
2856 break;
2857 }
2858 case 'message':
2859 {
2860 if (this.lastServerMessages.indexOf(messageID) != -1) {
2861 // console.warn('[MT] Server same messageID: ', messageID)
2862 this.ackMessage(messageID);
2863 return;
2864 }
2865 this.lastServerMessages.push(messageID);
2866 if (this.lastServerMessages.length > 100) {
2867 this.lastServerMessages.shift();
2868 }
2869 this.processMessage(message.body, message.msg_id, sessionID);
2870 break;
2871 }
2872 case 'new_session_created':
2873 {
2874 this.ackMessage(messageID);
2875
2876 this.processMessageAck(message.first_msg_id);
2877 this.applyServerSalt(message.server_salt);
2878
2879 const onBaseDc = baseDcID => {
2880 const updateCond = baseDcID === this.dcID && !this.upload && updatesProcessor;
2881 if (updateCond) updatesProcessor(message, true);
2882 };
2883 storage.get('dc').then(onBaseDc);
2884 break;
2885 }
2886 case 'msgs_ack':
2887 {
2888 message.msg_ids.forEach(this.processMessageAck);
2889 break;
2890 }
2891 case 'msg_detailed_info':
2892 {
2893 if (!this.sentMessages[message.msg_id]) {
2894 this.ackMessage(message.answer_msg_id);
2895 break;
2896 }
2897 break;
2898 }
2899 case 'msg_new_detailed_info':
2900 {
2901 // this.ackMessage(message.answer_msg_id)
2902 this.reqResendMessage(message.answer_msg_id);
2903 break;
2904 }
2905 case 'msgs_state_info':
2906 {
2907 this.ackMessage(message.answer_msg_id);
2908 const spliceCond = this.lastResendReq && this.lastResendReq.req_msg_id == message.req_msg_id && this.pendingResends.length;
2909 if (spliceCond) this.lastResendReq.resend_msg_ids.forEach(this.spliceMessage);
2910 break;
2911 }
2912 case 'rpc_result':
2913 {
2914 this.ackMessage(messageID);
2915
2916 const sentMessageID = message.req_msg_id;
2917 const sentMessage = this.sentMessages[sentMessageID];
2918
2919 this.processMessageAck(sentMessageID);
2920 if (!sentMessage) break;
2921
2922 const deferred = sentMessage.deferred;
2923 if (message.result._ == 'rpc_error') {
2924 const error = this.processError(message.result);
2925 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Rpc error', error);
2926 if (deferred) {
2927 deferred.reject(error);
2928 }
2929 } else {
2930 if (deferred) {
2931 if (debug) {
2932 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Rpc response', message.result);
2933 } else {
2934 let dRes = message.result._;
2935 if (!dRes) dRes = message.result.length > 5 ? `[..${message.result.length}..]` : message.result;
2936 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Rpc response', dRes);
2937 }
2938 sentMessage.deferred.resolve(message.result);
2939 }
2940 if (sentMessage.isAPI) this.connectionInited = true;
2941 }
2942
2943 delete this.sentMessages[sentMessageID];
2944 break;
2945 }
2946 default:
2947 {
2948 this.ackMessage(messageID);
2949
2950 // console.log('Update', message)
2951 if (updatesProcessor) updatesProcessor(message, true);
2952 break;
2953 }
2954 }
2955 }
2956 }, _initialiseProps = function () {
2957 this.checkLongPollCond = () => this.longPollPending && this.longPollPending > __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])() || !!this.offline || akStopped;
2958
2959 this.checkLongPollAfterDcCond = (isClean, baseDc) => isClean && (this.dcID !== baseDc || this.upload || this.sleepAfter && this.sleepAfter < __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])());
2960
2961 this.checkLongPoll = force => {
2962 const isClean = this.cleanupSent();
2963 // console.log('Check lp', this.longPollPending, tsNow(), this.dcID, isClean)
2964 if (this.checkLongPollCond()) return false;
2965
2966 const afterGetDc = baseDc => {
2967 if (this.checkLongPollAfterDcCond(isClean, baseDc))
2968 // console.warn(dTime(), 'Send long-poll for DC is delayed', this.dcID, this.sleepAfter)
2969 return;
2970
2971 return this.sendLongPoll();
2972 };
2973
2974 storage.get('dc').then(afterGetDc);
2975 };
2976
2977 this.onHttpWait = () => {
2978 delete this.longPollPending;
2979 return __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].immediate(this.checkLongPoll);
2980 };
2981
2982 this.sendLongPoll = () => {
2983 const maxWait = 25000;
2984 this.longPollPending = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])() + maxWait;
2985 // console.log('Set lp', this.longPollPending, tsNow())
2986
2987 return this.wrapMtpCall('http_wait', {
2988 max_delay: 500,
2989 wait_after: 150,
2990 max_wait: maxWait
2991 }, {
2992 noResponse: true,
2993 longPoll: true
2994 }).then(this.onHttpWait, () => {
2995 console.log('Long-poll failed');
2996 });
2997 };
2998
2999 this.checkConnection = event => {
3000 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Check connection', event);
3001 __WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */].cancel(this.checkConnectionPromise);
3002
3003 const serializer = new Serialization({ mtproto: true });
3004 const pingID = [__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["l" /* nextRandomInt */])(0xFFFFFFFF), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_9__bin__["l" /* nextRandomInt */])(0xFFFFFFFF)];
3005
3006 serializer.storeMethod('ping', { ping_id: pingID });
3007
3008 const pingMessage = {
3009 msg_id: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])(),
3010 seq_no: this.generateSeqNo(true),
3011 body: serializer.getBytes()
3012 };
3013
3014 this.sendEncryptedRequest(pingMessage, { timeout: 15000 }).then(result => this.toggleOffline(false), () => {
3015 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Delay ', this.checkConnectionPeriod * 1000);
3016 this.checkConnectionPromise = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__smart_timeout__["b" /* default */])(this.checkConnection, parseInt(this.checkConnectionPeriod * 1000));
3017 this.checkConnectionPeriod = Math.min(60, this.checkConnectionPeriod * 1.5);
3018 });
3019 };
3020
3021 this.onNoResponseMsg = msgID => {
3022 if (this.sentMessages[msgID]) {
3023 const deferred = this.sentMessages[msgID].deferred;
3024 delete this.sentMessages[msgID];
3025 return deferred.resolve();
3026 }
3027 };
3028
3029 this.onNoResponseMsgReject = msgID => {
3030 if (this.sentMessages[msgID]) {
3031 const deferred = this.sentMessages[msgID].deferred;
3032 delete this.sentMessages[msgID];
3033 delete this.pendingMessages[msgID];
3034 return deferred.reject();
3035 }
3036 };
3037
3038 this.resetPendingMessage = msgID => this.pendingMessages[msgID] = 0;
3039
3040 this.performSheduledRequest = () => {
3041 //TODO extract huge method
3042 // console.log(dTime(), 'sheduled', this.dcID, this.iii)
3043 if (this.offline || akStopped) {
3044 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Cancel sheduled');
3045 return false;
3046 }
3047 delete this.nextReq;
3048 if (this.pendingAcks.length) {
3049 const ackMsgIDs = [];
3050 for (let i = 0; i < this.pendingAcks.length; i++) {
3051 ackMsgIDs.push(this.pendingAcks[i]);
3052 }
3053 // console.log('acking messages', ackMsgIDs)
3054 this.wrapMtpMessage({ _: 'msgs_ack', msg_ids: ackMsgIDs }, { notContentRelated: true, noShedule: true });
3055 }
3056
3057 if (this.pendingResends.length) {
3058 const resendMsgIDs = [];
3059 const resendOpts = { noShedule: true, notContentRelated: true };
3060 for (let i = 0; i < this.pendingResends.length; i++) {
3061 resendMsgIDs.push(this.pendingResends[i]);
3062 }
3063 // console.log('resendReq messages', resendMsgIDs)
3064 this.wrapMtpMessage({ _: 'msg_resend_req', msg_ids: resendMsgIDs }, resendOpts);
3065 this.lastResendReq = { req_msg_id: resendOpts.messageID, resend_msg_ids: resendMsgIDs };
3066 }
3067
3068 const messages = [];
3069 let message,
3070 messagesByteLen = 0;
3071 const currentTime = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["tsNow"])();
3072 let hasApiCall = false;
3073 let hasHttpWait = false;
3074 let lengthOverflow = false;
3075 let singlesCount = 0;
3076
3077 const onPendingMessage = (value, messageID) => {
3078 if (!(!value || value >= currentTime)) return;
3079 message = this.sentMessages[messageID];
3080 if (message) {
3081 const messageByteLength = (message.body.byteLength || message.body.length) + 32;
3082 const cond1 = !message.notContentRelated && lengthOverflow;
3083 const cond2 = !message.notContentRelated && messagesByteLen && messagesByteLen + messageByteLength > 655360; // 640 Kb
3084 if (cond1) return;
3085 if (cond2) {
3086 lengthOverflow = true;
3087 return;
3088 }
3089 if (message.singleInRequest) {
3090 singlesCount++;
3091 if (singlesCount > 1) return;
3092 }
3093 messages.push(message);
3094 messagesByteLen += messageByteLength;
3095 if (message.isAPI) hasApiCall = true;else if (message.longPoll) hasHttpWait = true;
3096 } else {
3097 // console.log(message, messageID)
3098 }
3099 delete this.pendingMessages[messageID];
3100 };
3101
3102 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(this.pendingMessages, onPendingMessage);
3103
3104 if (hasApiCall && !hasHttpWait) {
3105 const serializer = new Serialization({ mtproto: true });
3106 serializer.storeMethod('http_wait', {
3107 max_delay: 500,
3108 wait_after: 150,
3109 max_wait: 3000
3110 });
3111 messages.push({
3112 msg_id: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])(),
3113 seq_no: this.generateSeqNo(),
3114 body: serializer.getBytes()
3115 });
3116 }
3117
3118 if (!messages.length) {
3119 // console.log('no sheduled messages')
3120 return;
3121 }
3122
3123 const noResponseMsgs = [];
3124
3125 if (messages.length > 1) {
3126 const container = new Serialization({ mtproto: true, startMaxLength: messagesByteLen + 64 });
3127 container.storeInt(0x73f1f8dc, 'CONTAINER[id]');
3128 container.storeInt(messages.length, 'CONTAINER[count]');
3129 const onloads = [];
3130 const innerMessages = [];
3131 for (let i = 0; i < messages.length; i++) {
3132 container.storeLong(messages[i].msg_id, `CONTAINER[${i}][msg_id]`);
3133 innerMessages.push(messages[i].msg_id);
3134 container.storeInt(messages[i].seq_no, `CONTAINER[${i}][seq_no]`);
3135 container.storeInt(messages[i].body.length, `CONTAINER[${i}][bytes]`);
3136 container.storeRawBytes(messages[i].body, `CONTAINER[${i}][body]`);
3137 if (messages[i].noResponse) {
3138 noResponseMsgs.push(messages[i].msg_id);
3139 }
3140 }
3141
3142 const containerSentMessage = {
3143 msg_id: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["generateID"])(),
3144 seq_no: this.generateSeqNo(true),
3145 container: true,
3146 inner: innerMessages
3147 };
3148
3149 message = Object.assign({ body: container.getBytes(true) }, containerSentMessage);
3150
3151 this.sentMessages[message.msg_id] = containerSentMessage;
3152
3153 if (debug) console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Container', innerMessages, message.msg_id, message.seq_no);
3154 } else {
3155 if (message.noResponse) noResponseMsgs.push(message.msg_id);
3156 this.sentMessages[message.msg_id] = message;
3157 }
3158
3159 this.pendingAcks = [];
3160 const afterSendRequest = result => {
3161 this.toggleOffline(false);
3162 // console.log('parse for', message)
3163 this.parseResponse(result.data).then(afterResponseParse);
3164 };
3165 const afterResponseParse = response => {
3166 if (debug) console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'Server response', this.dcID, response);
3167
3168 this.processMessage(response.response, response.messageID, response.sessionID);
3169
3170 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(noResponseMsgs, this.onNoResponseMsg);
3171
3172 this.checkLongPoll();
3173
3174 this.checkConnectionPeriod = Math.max(1.1, Math.sqrt(this.checkConnectionPeriod));
3175 };
3176 const onRequestFail = error => {
3177 console.log('Encrypted request failed', error);
3178
3179 if (message.container) {
3180 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(message.inner, this.resetPendingMessage);
3181 delete this.sentMessages[message.msg_id];
3182 } else this.pendingMessages[message.msg_id] = 0;
3183
3184 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__for_each__["b" /* default */])(noResponseMsgs, this.onNoResponseMsgReject);
3185
3186 this.toggleOffline(true);
3187 };
3188 this.sendEncryptedRequest(message).then(afterSendRequest).catch(onRequestFail);
3189
3190 if (lengthOverflow || singlesCount > 1) this.sheduleRequest();
3191 };
3192
3193 this.getRequestUrl = () => chooseServer(this.dcID, this.upload);
3194
3195 this.sendEncryptedRequest = (message, options = {}) => {
3196 // console.log(dTime(), 'Send encrypted'/*, message*/)
3197 // console.trace()
3198 const data = new Serialization({ startMaxLength: message.body.length + 64 });
3199
3200 data.storeIntBytes(this.serverSalt, 64, 'salt');
3201 data.storeIntBytes(this.sessionID, 64, 'session_id');
3202
3203 data.storeLong(message.msg_id, 'message_id');
3204 data.storeInt(message.seq_no, 'seq_no');
3205
3206 data.storeInt(message.body.length, 'message_data_length');
3207 data.storeRawBytes(message.body, 'message_data');
3208
3209 const url = this.getRequestUrl();
3210 const baseError = { code: 406, type: 'NETWORK_BAD_RESPONSE', url };
3211
3212 const afterRequestData = result => {
3213 if (!result.data || !result.data.byteLength) return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(baseError);
3214 return result;
3215 };
3216
3217 const afterRequestReject = error => {
3218 if (!error.message && !error.type) error = Object.assign({ type: 'NETWORK_BAD_REQUEST', originalError: error }, baseError);
3219 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(error);
3220 };
3221
3222 const onEncryptedResult = encryptedResult => {
3223 // console.log(dTime(), 'Got encrypted out message'/*, encryptedResult*/)
3224 const request = new Serialization({ startMaxLength: encryptedResult.bytes.byteLength + 256 });
3225 request.storeIntBytes(this.authKeyID, 64, 'auth_key_id');
3226 request.storeIntBytes(encryptedResult.msgKey, 128, 'msg_key');
3227 request.storeRawBytes(encryptedResult.bytes, 'encrypted_data');
3228
3229 const requestData = /*xhrSendBuffer
3230 ? request.getBuffer()
3231 : */request.getArray();
3232
3233 try {
3234 options = Object.assign({ responseType: 'arraybuffer' }, options);
3235 return __WEBPACK_IMPORTED_MODULE_8__http__["a" /* httpClient */].post(url, requestData, options);
3236 } catch (e) {
3237 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(e);
3238 }
3239 };
3240
3241 return this.getEncryptedMessage(data.getBuffer()).then(onEncryptedResult).then(afterRequestData, afterRequestReject);
3242 };
3243
3244 this.getMsgById = ({ req_msg_id }) => this.sentMessages[req_msg_id];
3245
3246 this.processMessageAck = messageID => {
3247 const sentMessage = this.sentMessages[messageID];
3248 if (sentMessage && !sentMessage.acked) {
3249 delete sentMessage.body;
3250 sentMessage.acked = true;
3251
3252 return true;
3253 }
3254
3255 return false;
3256 };
3257
3258 this.spliceMessage = badMsgID => {
3259 const pos = this.pendingResends.indexOf(badMsgID);
3260 if (pos !== -1) this.pendingResends.splice(pos, 1);
3261 };
3262 }, _temp;
3263};
3264/* harmony export (immutable) */ __webpack_exports__["NetworkerFabric"] = NetworkerFabric;
3265
3266
3267const getDeserializeOpts = msgGetter => ({
3268 mtproto: true,
3269 override: {
3270 mt_message(result, field) {
3271 result.msg_id = this.fetchLong(`${field}[msg_id]`);
3272 result.seqno = this.fetchInt(`${field}[seqno]`);
3273 result.bytes = this.fetchInt(`${field}[bytes]`);
3274
3275 const offset = this.getOffset();
3276
3277 try {
3278 result.body = this.fetchObject('Object', `${field}[body]`);
3279 } catch (e) {
3280 console.error(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__time_manager__["dTime"])(), 'parse error', e.message, e.stack);
3281 result.body = { _: 'parse_error', error: e };
3282 }
3283 if (this.offset != offset + result.bytes) {
3284 // console.warn(dTime(), 'set offset', this.offset, offset, result.bytes)
3285 // console.log(dTime(), result)
3286 this.offset = offset + result.bytes;
3287 }
3288 // console.log(dTime(), 'override message', result)
3289 },
3290 mt_rpc_result(result, field) {
3291 result.req_msg_id = this.fetchLong(`${field}[req_msg_id]`);
3292
3293 const sentMessage = msgGetter(result);
3294 const type = sentMessage && sentMessage.resultType || 'Object';
3295
3296 if (result.req_msg_id && !sentMessage) {
3297 // console.warn(dTime(), 'Result for unknown message', result)
3298 return;
3299 }
3300 result.result = this.fetchObject(type, `${field}[result]`);
3301 // console.log(dTime(), 'override rpc_result', sentMessage, type, result)
3302 }
3303 }
3304});
3305
3306const startAll = () => {
3307 if (akStopped) {
3308 akStopped = false;
3309 updatesProcessor({ _: 'new_session_created' }, true);
3310 }
3311};
3312/* harmony export (immutable) */ __webpack_exports__["startAll"] = startAll;
3313
3314
3315const stopAll = () => akStopped = true;
3316/* harmony export (immutable) */ __webpack_exports__["stopAll"] = stopAll;
3317
3318
3319const setUpdatesProcessor = callback => updatesProcessor = callback;
3320/* harmony export (immutable) */ __webpack_exports__["setUpdatesProcessor"] = setUpdatesProcessor;
3321
3322
3323/* harmony default export */ __webpack_exports__["default"] = NetworkerFabric;
3324
3325/***/ }),
3326/* 18 */
3327/***/ (function(module, exports, __webpack_require__) {
3328
3329module.exports = (__webpack_require__(6))(123);
3330
3331/***/ }),
3332/* 19 */
3333/***/ (function(module, exports, __webpack_require__) {
3334
3335var CryptoJS = __webpack_require__(1).CryptoJS;
3336__webpack_require__(22);
3337__webpack_require__(25);
3338__webpack_require__(23);
3339__webpack_require__(21);
3340__webpack_require__(20);
3341__webpack_require__(26);
3342var JsonFormatter = __webpack_require__(24).JsonFormatter;
3343
3344exports.CryptoJS = CryptoJS;
3345exports.JsonFormatter = JsonFormatter;
3346
3347/***/ }),
3348/* 20 */
3349/***/ (function(module, exports, __webpack_require__) {
3350
3351var CryptoJS = __webpack_require__(1).CryptoJS;
3352
3353/*
3354CryptoJS v3.1.2
3355code.google.com/p/crypto-js
3356(c) 2009-2013 by Jeff Mott. All rights reserved.
3357code.google.com/p/crypto-js/wiki/License
3358*/
3359(function () {
3360 // Shortcuts
3361 var C = CryptoJS;
3362 var C_lib = C.lib;
3363 var BlockCipher = C_lib.BlockCipher;
3364 var C_algo = C.algo;
3365
3366 // Lookup tables
3367 var SBOX = [];
3368 var INV_SBOX = [];
3369 var SUB_MIX_0 = [];
3370 var SUB_MIX_1 = [];
3371 var SUB_MIX_2 = [];
3372 var SUB_MIX_3 = [];
3373 var INV_SUB_MIX_0 = [];
3374 var INV_SUB_MIX_1 = [];
3375 var INV_SUB_MIX_2 = [];
3376 var INV_SUB_MIX_3 = [];
3377
3378 // Compute lookup tables
3379 (function () {
3380 // Compute double table
3381 var d = [];
3382 for (var i = 0; i < 256; i++) {
3383 if (i < 128) {
3384 d[i] = i << 1;
3385 } else {
3386 d[i] = (i << 1) ^ 0x11b;
3387 }
3388 }
3389
3390 // Walk GF(2^8)
3391 var x = 0;
3392 var xi = 0;
3393 for (var i = 0; i < 256; i++) {
3394 // Compute sbox
3395 var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
3396 sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
3397 SBOX[x] = sx;
3398 INV_SBOX[sx] = x;
3399
3400 // Compute multiplication
3401 var x2 = d[x];
3402 var x4 = d[x2];
3403 var x8 = d[x4];
3404
3405 // Compute sub bytes, mix columns tables
3406 var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
3407 SUB_MIX_0[x] = (t << 24) | (t >>> 8);
3408 SUB_MIX_1[x] = (t << 16) | (t >>> 16);
3409 SUB_MIX_2[x] = (t << 8) | (t >>> 24);
3410 SUB_MIX_3[x] = t;
3411
3412 // Compute inv sub bytes, inv mix columns tables
3413 var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
3414 INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
3415 INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
3416 INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
3417 INV_SUB_MIX_3[sx] = t;
3418
3419 // Compute next counter
3420 if (!x) {
3421 x = xi = 1;
3422 } else {
3423 x = x2 ^ d[d[d[x8 ^ x2]]];
3424 xi ^= d[d[xi]];
3425 }
3426 }
3427 }());
3428
3429 // Precomputed Rcon lookup
3430 var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
3431
3432 /**
3433 * AES block cipher algorithm.
3434 */
3435 var AES = C_algo.AES = BlockCipher.extend({
3436 _doReset: function () {
3437 // Shortcuts
3438 var key = this._key;
3439 var keyWords = key.words;
3440 var keySize = key.sigBytes / 4;
3441
3442 // Compute number of rounds
3443 var nRounds = this._nRounds = keySize + 6
3444
3445 // Compute number of key schedule rows
3446 var ksRows = (nRounds + 1) * 4;
3447
3448 // Compute key schedule
3449 var keySchedule = this._keySchedule = [];
3450 for (var ksRow = 0; ksRow < ksRows; ksRow++) {
3451 if (ksRow < keySize) {
3452 keySchedule[ksRow] = keyWords[ksRow];
3453 } else {
3454 var t = keySchedule[ksRow - 1];
3455
3456 if (!(ksRow % keySize)) {
3457 // Rot word
3458 t = (t << 8) | (t >>> 24);
3459
3460 // Sub word
3461 t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
3462
3463 // Mix Rcon
3464 t ^= RCON[(ksRow / keySize) | 0] << 24;
3465 } else if (keySize > 6 && ksRow % keySize == 4) {
3466 // Sub word
3467 t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
3468 }
3469
3470 keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
3471 }
3472 }
3473
3474 // Compute inv key schedule
3475 var invKeySchedule = this._invKeySchedule = [];
3476 for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
3477 var ksRow = ksRows - invKsRow;
3478
3479 if (invKsRow % 4) {
3480 var t = keySchedule[ksRow];
3481 } else {
3482 var t = keySchedule[ksRow - 4];
3483 }
3484
3485 if (invKsRow < 4 || ksRow <= 4) {
3486 invKeySchedule[invKsRow] = t;
3487 } else {
3488 invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
3489 INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
3490 }
3491 }
3492 },
3493
3494 encryptBlock: function (M, offset) {
3495 this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
3496 },
3497
3498 decryptBlock: function (M, offset) {
3499 // Swap 2nd and 4th rows
3500 var t = M[offset + 1];
3501 M[offset + 1] = M[offset + 3];
3502 M[offset + 3] = t;
3503
3504 this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
3505
3506 // Inv swap 2nd and 4th rows
3507 var t = M[offset + 1];
3508 M[offset + 1] = M[offset + 3];
3509 M[offset + 3] = t;
3510 },
3511
3512 _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
3513 // Shortcut
3514 var nRounds = this._nRounds;
3515
3516 // Get input, add round key
3517 var s0 = M[offset] ^ keySchedule[0];
3518 var s1 = M[offset + 1] ^ keySchedule[1];
3519 var s2 = M[offset + 2] ^ keySchedule[2];
3520 var s3 = M[offset + 3] ^ keySchedule[3];
3521
3522 // Key schedule row counter
3523 var ksRow = 4;
3524
3525 // Rounds
3526 for (var round = 1; round < nRounds; round++) {
3527 // Shift rows, sub bytes, mix columns, add round key
3528 var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
3529 var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
3530 var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
3531 var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
3532
3533 // Update state
3534 s0 = t0;
3535 s1 = t1;
3536 s2 = t2;
3537 s3 = t3;
3538 }
3539
3540 // Shift rows, sub bytes, add round key
3541 var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
3542 var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
3543 var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
3544 var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
3545
3546 // Set output
3547 M[offset] = t0;
3548 M[offset + 1] = t1;
3549 M[offset + 2] = t2;
3550 M[offset + 3] = t3;
3551 },
3552
3553 keySize: 256/32
3554 });
3555
3556 /**
3557 * Shortcut functions to the cipher's object interface.
3558 *
3559 * @example
3560 *
3561 * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
3562 * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
3563 */
3564 C.AES = BlockCipher._createHelper(AES);
3565}());
3566
3567
3568/***/ }),
3569/* 21 */
3570/***/ (function(module, exports, __webpack_require__) {
3571
3572var CryptoJS = __webpack_require__(1).CryptoJS;
3573
3574/*
3575CryptoJS v3.1.2
3576code.google.com/p/crypto-js
3577(c) 2009-2013 by Jeff Mott. All rights reserved.
3578code.google.com/p/crypto-js/wiki/License
3579*/
3580/**
3581 * Cipher core components.
3582 */
3583CryptoJS.lib.Cipher || (function (undefined) {
3584 // Shortcuts
3585 var C = CryptoJS;
3586 var C_lib = C.lib;
3587 var Base = C_lib.Base;
3588 var WordArray = C_lib.WordArray;
3589 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
3590 var C_enc = C.enc;
3591 var Utf8 = C_enc.Utf8;
3592 var Base64 = C_enc.Base64;
3593 var C_algo = C.algo;
3594 var EvpKDF = C_algo.EvpKDF;
3595
3596 /**
3597 * Abstract base cipher template.
3598 *
3599 * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
3600 * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
3601 * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
3602 * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
3603 */
3604 var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
3605 /**
3606 * Configuration options.
3607 *
3608 * @property {WordArray} iv The IV to use for this operation.
3609 */
3610 cfg: Base.extend(),
3611
3612 /**
3613 * Creates this cipher in encryption mode.
3614 *
3615 * @param {WordArray} key The key.
3616 * @param {Object} cfg (Optional) The configuration options to use for this operation.
3617 *
3618 * @return {Cipher} A cipher instance.
3619 *
3620 * @static
3621 *
3622 * @example
3623 *
3624 * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
3625 */
3626 createEncryptor: function (key, cfg) {
3627 return this.create(this._ENC_XFORM_MODE, key, cfg);
3628 },
3629
3630 /**
3631 * Creates this cipher in decryption mode.
3632 *
3633 * @param {WordArray} key The key.
3634 * @param {Object} cfg (Optional) The configuration options to use for this operation.
3635 *
3636 * @return {Cipher} A cipher instance.
3637 *
3638 * @static
3639 *
3640 * @example
3641 *
3642 * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
3643 */
3644 createDecryptor: function (key, cfg) {
3645 return this.create(this._DEC_XFORM_MODE, key, cfg);
3646 },
3647
3648 /**
3649 * Initializes a newly created cipher.
3650 *
3651 * @param {number} xformMode Either the encryption or decryption transormation mode constant.
3652 * @param {WordArray} key The key.
3653 * @param {Object} cfg (Optional) The configuration options to use for this operation.
3654 *
3655 * @example
3656 *
3657 * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
3658 */
3659 init: function (xformMode, key, cfg) {
3660 // Apply config defaults
3661 this.cfg = this.cfg.extend(cfg);
3662
3663 // Store transform mode and key
3664 this._xformMode = xformMode;
3665 this._key = key;
3666
3667 // Set initial values
3668 this.reset();
3669 },
3670
3671 /**
3672 * Resets this cipher to its initial state.
3673 *
3674 * @example
3675 *
3676 * cipher.reset();
3677 */
3678 reset: function () {
3679 // Reset data buffer
3680 BufferedBlockAlgorithm.reset.call(this);
3681
3682 // Perform concrete-cipher logic
3683 this._doReset();
3684 },
3685
3686 /**
3687 * Adds data to be encrypted or decrypted.
3688 *
3689 * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
3690 *
3691 * @return {WordArray} The data after processing.
3692 *
3693 * @example
3694 *
3695 * var encrypted = cipher.process('data');
3696 * var encrypted = cipher.process(wordArray);
3697 */
3698 process: function (dataUpdate) {
3699 // Append
3700 this._append(dataUpdate);
3701
3702 // Process available blocks
3703 return this._process();
3704 },
3705
3706 /**
3707 * Finalizes the encryption or decryption process.
3708 * Note that the finalize operation is effectively a destructive, read-once operation.
3709 *
3710 * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
3711 *
3712 * @return {WordArray} The data after final processing.
3713 *
3714 * @example
3715 *
3716 * var encrypted = cipher.finalize();
3717 * var encrypted = cipher.finalize('data');
3718 * var encrypted = cipher.finalize(wordArray);
3719 */
3720 finalize: function (dataUpdate) {
3721 // Final data update
3722 if (dataUpdate) {
3723 this._append(dataUpdate);
3724 }
3725
3726 // Perform concrete-cipher logic
3727 var finalProcessedData = this._doFinalize();
3728
3729 return finalProcessedData;
3730 },
3731
3732 keySize: 128/32,
3733
3734 ivSize: 128/32,
3735
3736 _ENC_XFORM_MODE: 1,
3737
3738 _DEC_XFORM_MODE: 2,
3739
3740 /**
3741 * Creates shortcut functions to a cipher's object interface.
3742 *
3743 * @param {Cipher} cipher The cipher to create a helper for.
3744 *
3745 * @return {Object} An object with encrypt and decrypt shortcut functions.
3746 *
3747 * @static
3748 *
3749 * @example
3750 *
3751 * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
3752 */
3753 _createHelper: (function () {
3754 function selectCipherStrategy(key) {
3755 if (typeof key == 'string') {
3756 return PasswordBasedCipher;
3757 } else {
3758 return SerializableCipher;
3759 }
3760 }
3761
3762 return function (cipher) {
3763 return {
3764 encrypt: function (message, key, cfg) {
3765 return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
3766 },
3767
3768 decrypt: function (ciphertext, key, cfg) {
3769 return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
3770 }
3771 };
3772 };
3773 }())
3774 });
3775
3776 /**
3777 * Abstract base stream cipher template.
3778 *
3779 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
3780 */
3781 var StreamCipher = C_lib.StreamCipher = Cipher.extend({
3782 _doFinalize: function () {
3783 // Process partial blocks
3784 var finalProcessedBlocks = this._process(!!'flush');
3785
3786 return finalProcessedBlocks;
3787 },
3788
3789 blockSize: 1
3790 });
3791
3792 /**
3793 * Mode namespace.
3794 */
3795 var C_mode = C.mode = {};
3796
3797 /**
3798 * Abstract base block cipher mode template.
3799 */
3800 var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
3801 /**
3802 * Creates this mode for encryption.
3803 *
3804 * @param {Cipher} cipher A block cipher instance.
3805 * @param {Array} iv The IV words.
3806 *
3807 * @static
3808 *
3809 * @example
3810 *
3811 * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
3812 */
3813 createEncryptor: function (cipher, iv) {
3814 return this.Encryptor.create(cipher, iv);
3815 },
3816
3817 /**
3818 * Creates this mode for decryption.
3819 *
3820 * @param {Cipher} cipher A block cipher instance.
3821 * @param {Array} iv The IV words.
3822 *
3823 * @static
3824 *
3825 * @example
3826 *
3827 * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
3828 */
3829 createDecryptor: function (cipher, iv) {
3830 return this.Decryptor.create(cipher, iv);
3831 },
3832
3833 /**
3834 * Initializes a newly created mode.
3835 *
3836 * @param {Cipher} cipher A block cipher instance.
3837 * @param {Array} iv The IV words.
3838 *
3839 * @example
3840 *
3841 * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
3842 */
3843 init: function (cipher, iv) {
3844 this._cipher = cipher;
3845 this._iv = iv;
3846 }
3847 });
3848
3849 /**
3850 * Cipher Block Chaining mode.
3851 */
3852 var CBC = C_mode.CBC = (function () {
3853 /**
3854 * Abstract base CBC mode.
3855 */
3856 var CBC = BlockCipherMode.extend();
3857
3858 /**
3859 * CBC encryptor.
3860 */
3861 CBC.Encryptor = CBC.extend({
3862 /**
3863 * Processes the data block at offset.
3864 *
3865 * @param {Array} words The data words to operate on.
3866 * @param {number} offset The offset where the block starts.
3867 *
3868 * @example
3869 *
3870 * mode.processBlock(data.words, offset);
3871 */
3872 processBlock: function (words, offset) {
3873 // Shortcuts
3874 var cipher = this._cipher;
3875 var blockSize = cipher.blockSize;
3876
3877 // XOR and encrypt
3878 xorBlock.call(this, words, offset, blockSize);
3879 cipher.encryptBlock(words, offset);
3880
3881 // Remember this block to use with next block
3882 this._prevBlock = words.slice(offset, offset + blockSize);
3883 }
3884 });
3885
3886 /**
3887 * CBC decryptor.
3888 */
3889 CBC.Decryptor = CBC.extend({
3890 /**
3891 * Processes the data block at offset.
3892 *
3893 * @param {Array} words The data words to operate on.
3894 * @param {number} offset The offset where the block starts.
3895 *
3896 * @example
3897 *
3898 * mode.processBlock(data.words, offset);
3899 */
3900 processBlock: function (words, offset) {
3901 // Shortcuts
3902 var cipher = this._cipher;
3903 var blockSize = cipher.blockSize;
3904
3905 // Remember this block to use with next block
3906 var thisBlock = words.slice(offset, offset + blockSize);
3907
3908 // Decrypt and XOR
3909 cipher.decryptBlock(words, offset);
3910 xorBlock.call(this, words, offset, blockSize);
3911
3912 // This block becomes the previous block
3913 this._prevBlock = thisBlock;
3914 }
3915 });
3916
3917 function xorBlock(words, offset, blockSize) {
3918 // Shortcut
3919 var iv = this._iv;
3920
3921 // Choose mixing block
3922 if (iv) {
3923 var block = iv;
3924
3925 // Remove IV for subsequent blocks
3926 this._iv = undefined;
3927 } else {
3928 var block = this._prevBlock;
3929 }
3930
3931 // XOR blocks
3932 for (var i = 0; i < blockSize; i++) {
3933 words[offset + i] ^= block[i];
3934 }
3935 }
3936
3937 return CBC;
3938 }());
3939
3940 /**
3941 * Infinite Garble Extension mode.
3942 */
3943 var IGE = C_mode.IGE = (function () {
3944 /**
3945 * Abstract base IGE mode.
3946 */
3947 var IGE = BlockCipherMode.extend();
3948
3949 /**
3950 * IGE encryptor.
3951 */
3952 IGE.Encryptor = IGE.extend({
3953 /**
3954 * Processes the data block at offset.
3955 *
3956 * @param {Array} words The data words to operate on.
3957 * @param {number} offset The offset where the block starts.
3958 *
3959 * @example
3960 *
3961 * mode.processBlock(data.words, offset);
3962 */
3963 processBlock: function (words, offset) {
3964 // Shortcuts
3965 var cipher = this._cipher;
3966 var blockSize = cipher.blockSize;
3967
3968 if (this._ivp === undefined) {
3969 this._ivp = this._iv.slice(0, blockSize);
3970 this._iv2p = this._iv.slice(blockSize, blockSize + blockSize);
3971 }
3972
3973
3974 // Remember this block to use with next block
3975 var nextIv2p = words.slice(offset, offset + blockSize);
3976
3977 // XOR with previous ciphertext
3978 xorBlock(words, this._ivp, offset, blockSize);
3979
3980 // Block cipher
3981 cipher.encryptBlock(words, offset);
3982
3983 // XOR with previous plaintext
3984 xorBlock(words, this._iv2p, offset, blockSize);
3985
3986 this._ivp = words.slice(offset, offset + blockSize);
3987 this._iv2p = nextIv2p;
3988 }
3989 });
3990
3991 /**
3992 * IGE decryptor.
3993 */
3994 IGE.Decryptor = IGE.extend({
3995 /**
3996 * Processes the data block at offset.
3997 *
3998 * @param {Array} words The data words to operate on.
3999 * @param {number} offset The offset where the block starts.
4000 *
4001 * @example
4002 *
4003 * mode.processBlock(data.words, offset);
4004 */
4005 processBlock: function (words, offset) {
4006 // Shortcuts
4007 var cipher = this._cipher;
4008 var blockSize = cipher.blockSize;
4009
4010 if (this._ivp === undefined) {
4011 this._ivp = this._iv.slice(0, blockSize);
4012 this._iv2p = this._iv.slice(blockSize, 2 * blockSize);
4013 }
4014
4015 // Remember this block to use with next block
4016 var nextIvp = words.slice(offset, offset + blockSize);
4017
4018 // XOR with previous ciphertext
4019 xorBlock(words, this._iv2p, offset, blockSize);
4020
4021 // Block cipher
4022 cipher.decryptBlock(words, offset);
4023
4024 // XOR with previous plaintext
4025 xorBlock(words, this._ivp, offset, blockSize);
4026
4027 this._ivp = nextIvp;
4028 this._iv2p = words.slice(offset, offset + blockSize);
4029 }
4030 });
4031
4032 function xorBlock(words, block, offset, blockSize) {
4033 for (var i = 0; i < blockSize; i++) {
4034 words[offset + i] ^= block[i];
4035 }
4036 }
4037
4038 return IGE;
4039 }());
4040
4041 /**
4042 * Padding namespace.
4043 */
4044 var C_pad = C.pad = {};
4045
4046 /**
4047 * PKCS #5/7 padding strategy.
4048 */
4049 var Pkcs7 = C_pad.Pkcs7 = {
4050 /**
4051 * Pads data using the algorithm defined in PKCS #5/7.
4052 *
4053 * @param {WordArray} data The data to pad.
4054 * @param {number} blockSize The multiple that the data should be padded to.
4055 *
4056 * @static
4057 *
4058 * @example
4059 *
4060 * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
4061 */
4062 pad: function (data, blockSize) {
4063 // Shortcut
4064 var blockSizeBytes = blockSize * 4;
4065
4066 // Count padding bytes
4067 var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
4068
4069 // Create padding word
4070 var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
4071
4072 // Create padding
4073 var paddingWords = [];
4074 for (var i = 0; i < nPaddingBytes; i += 4) {
4075 paddingWords.push(paddingWord);
4076 }
4077 var padding = WordArray.create(paddingWords, nPaddingBytes);
4078
4079 // Add padding
4080 data.concat(padding);
4081 },
4082
4083 /**
4084 * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
4085 *
4086 * @param {WordArray} data The data to unpad.
4087 *
4088 * @static
4089 *
4090 * @example
4091 *
4092 * CryptoJS.pad.Pkcs7.unpad(wordArray);
4093 */
4094 unpad: function (data) {
4095 // Get number of padding bytes from last byte
4096 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
4097
4098 // Remove padding
4099 data.sigBytes -= nPaddingBytes;
4100 }
4101 };
4102
4103 var NoPadding = C_pad.NoPadding = {
4104 pad: function () {
4105 },
4106
4107 unpad: function () {
4108 }
4109 };
4110
4111
4112 /**
4113 * Abstract base block cipher template.
4114 *
4115 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
4116 */
4117 var BlockCipher = C_lib.BlockCipher = Cipher.extend({
4118 /**
4119 * Configuration options.
4120 *
4121 * @property {Mode} mode The block mode to use. Default: CBC
4122 * @property {Padding} padding The padding strategy to use. Default: Pkcs7
4123 */
4124 cfg: Cipher.cfg.extend({
4125 mode: CBC,
4126 padding: Pkcs7
4127 }),
4128
4129 reset: function () {
4130 // Reset cipher
4131 Cipher.reset.call(this);
4132
4133 // Shortcuts
4134 var cfg = this.cfg;
4135 var iv = cfg.iv;
4136 var mode = cfg.mode;
4137
4138 // Reset block mode
4139 if (this._xformMode == this._ENC_XFORM_MODE) {
4140 var modeCreator = mode.createEncryptor;
4141 } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
4142 var modeCreator = mode.createDecryptor;
4143
4144 // Keep at least one block in the buffer for unpadding
4145 this._minBufferSize = 1;
4146 }
4147 this._mode = modeCreator.call(mode, this, iv && iv.words);
4148 },
4149
4150 _doProcessBlock: function (words, offset) {
4151 this._mode.processBlock(words, offset);
4152 },
4153
4154 _doFinalize: function () {
4155 // Shortcut
4156 var padding = this.cfg.padding;
4157
4158 // Finalize
4159 if (this._xformMode == this._ENC_XFORM_MODE) {
4160 // Pad data
4161 padding.pad(this._data, this.blockSize);
4162
4163 // Process final blocks
4164 var finalProcessedBlocks = this._process(!!'flush');
4165 } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
4166 // Process final blocks
4167 var finalProcessedBlocks = this._process(!!'flush');
4168
4169 // Unpad data
4170 padding.unpad(finalProcessedBlocks);
4171 }
4172
4173 return finalProcessedBlocks;
4174 },
4175
4176 blockSize: 128/32
4177 });
4178
4179 /**
4180 * A collection of cipher parameters.
4181 *
4182 * @property {WordArray} ciphertext The raw ciphertext.
4183 * @property {WordArray} key The key to this ciphertext.
4184 * @property {WordArray} iv The IV used in the ciphering operation.
4185 * @property {WordArray} salt The salt used with a key derivation function.
4186 * @property {Cipher} algorithm The cipher algorithm.
4187 * @property {Mode} mode The block mode used in the ciphering operation.
4188 * @property {Padding} padding The padding scheme used in the ciphering operation.
4189 * @property {number} blockSize The block size of the cipher.
4190 * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
4191 */
4192 var CipherParams = C_lib.CipherParams = Base.extend({
4193 /**
4194 * Initializes a newly created cipher params object.
4195 *
4196 * @param {Object} cipherParams An object with any of the possible cipher parameters.
4197 *
4198 * @example
4199 *
4200 * var cipherParams = CryptoJS.lib.CipherParams.create({
4201 * ciphertext: ciphertextWordArray,
4202 * key: keyWordArray,
4203 * iv: ivWordArray,
4204 * salt: saltWordArray,
4205 * algorithm: CryptoJS.algo.AES,
4206 * mode: CryptoJS.mode.CBC,
4207 * padding: CryptoJS.pad.PKCS7,
4208 * blockSize: 4,
4209 * formatter: CryptoJS.format.OpenSSL
4210 * });
4211 */
4212 init: function (cipherParams) {
4213 this.mixIn(cipherParams);
4214 },
4215
4216 /**
4217 * Converts this cipher params object to a string.
4218 *
4219 * @param {Format} formatter (Optional) The formatting strategy to use.
4220 *
4221 * @return {string} The stringified cipher params.
4222 *
4223 * @throws Error If neither the formatter nor the default formatter is set.
4224 *
4225 * @example
4226 *
4227 * var string = cipherParams + '';
4228 * var string = cipherParams.toString();
4229 * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
4230 */
4231 toString: function (formatter) {
4232 return (formatter || this.formatter).stringify(this);
4233 }
4234 });
4235
4236 /**
4237 * Format namespace.
4238 */
4239 var C_format = C.format = {};
4240
4241 /**
4242 * OpenSSL formatting strategy.
4243 */
4244 var OpenSSLFormatter = C_format.OpenSSL = {
4245 /**
4246 * Converts a cipher params object to an OpenSSL-compatible string.
4247 *
4248 * @param {CipherParams} cipherParams The cipher params object.
4249 *
4250 * @return {string} The OpenSSL-compatible string.
4251 *
4252 * @static
4253 *
4254 * @example
4255 *
4256 * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
4257 */
4258 stringify: function (cipherParams) {
4259 // Shortcuts
4260 var ciphertext = cipherParams.ciphertext;
4261 var salt = cipherParams.salt;
4262
4263 // Format
4264 if (salt) {
4265 var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
4266 } else {
4267 var wordArray = ciphertext;
4268 }
4269
4270 return wordArray.toString(Base64);
4271 },
4272
4273 /**
4274 * Converts an OpenSSL-compatible string to a cipher params object.
4275 *
4276 * @param {string} openSSLStr The OpenSSL-compatible string.
4277 *
4278 * @return {CipherParams} The cipher params object.
4279 *
4280 * @static
4281 *
4282 * @example
4283 *
4284 * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
4285 */
4286 parse: function (openSSLStr) {
4287 // Parse base64
4288 var ciphertext = Base64.parse(openSSLStr);
4289
4290 // Shortcut
4291 var ciphertextWords = ciphertext.words;
4292
4293 // Test for salt
4294 if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
4295 // Extract salt
4296 var salt = WordArray.create(ciphertextWords.slice(2, 4));
4297
4298 // Remove salt from ciphertext
4299 ciphertextWords.splice(0, 4);
4300 ciphertext.sigBytes -= 16;
4301 }
4302
4303 return CipherParams.create({ ciphertext: ciphertext, salt: salt });
4304 }
4305 };
4306
4307 /**
4308 * A cipher wrapper that returns ciphertext as a serializable cipher params object.
4309 */
4310 var SerializableCipher = C_lib.SerializableCipher = Base.extend({
4311 /**
4312 * Configuration options.
4313 *
4314 * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
4315 */
4316 cfg: Base.extend({
4317 format: OpenSSLFormatter
4318 }),
4319
4320 /**
4321 * Encrypts a message.
4322 *
4323 * @param {Cipher} cipher The cipher algorithm to use.
4324 * @param {WordArray|string} message The message to encrypt.
4325 * @param {WordArray} key The key.
4326 * @param {Object} cfg (Optional) The configuration options to use for this operation.
4327 *
4328 * @return {CipherParams} A cipher params object.
4329 *
4330 * @static
4331 *
4332 * @example
4333 *
4334 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
4335 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
4336 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
4337 */
4338 encrypt: function (cipher, message, key, cfg) {
4339 // Apply config defaults
4340 cfg = this.cfg.extend(cfg);
4341
4342 // Encrypt
4343 var encryptor = cipher.createEncryptor(key, cfg);
4344 var ciphertext = encryptor.finalize(message);
4345
4346 // Shortcut
4347 var cipherCfg = encryptor.cfg;
4348
4349 // Create and return serializable cipher params
4350 return CipherParams.create({
4351 ciphertext: ciphertext,
4352 key: key,
4353 iv: cipherCfg.iv,
4354 algorithm: cipher,
4355 mode: cipherCfg.mode,
4356 padding: cipherCfg.padding,
4357 blockSize: cipher.blockSize,
4358 formatter: cfg.format
4359 });
4360 },
4361
4362 /**
4363 * Decrypts serialized ciphertext.
4364 *
4365 * @param {Cipher} cipher The cipher algorithm to use.
4366 * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
4367 * @param {WordArray} key The key.
4368 * @param {Object} cfg (Optional) The configuration options to use for this operation.
4369 *
4370 * @return {WordArray} The plaintext.
4371 *
4372 * @static
4373 *
4374 * @example
4375 *
4376 * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
4377 * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
4378 */
4379 decrypt: function (cipher, ciphertext, key, cfg) {
4380 // Apply config defaults
4381 cfg = this.cfg.extend(cfg);
4382
4383 // Convert string to CipherParams
4384 ciphertext = this._parse(ciphertext, cfg.format);
4385
4386 // Decrypt
4387 var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
4388
4389 return plaintext;
4390 },
4391
4392 /**
4393 * Converts serialized ciphertext to CipherParams,
4394 * else assumed CipherParams already and returns ciphertext unchanged.
4395 *
4396 * @param {CipherParams|string} ciphertext The ciphertext.
4397 * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
4398 *
4399 * @return {CipherParams} The unserialized ciphertext.
4400 *
4401 * @static
4402 *
4403 * @example
4404 *
4405 * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
4406 */
4407 _parse: function (ciphertext, format) {
4408 if (typeof ciphertext == 'string') {
4409 return format.parse(ciphertext, this);
4410 } else {
4411 return ciphertext;
4412 }
4413 }
4414 });
4415
4416 /**
4417 * Key derivation function namespace.
4418 */
4419 var C_kdf = C.kdf = {};
4420
4421 /**
4422 * OpenSSL key derivation function.
4423 */
4424 var OpenSSLKdf = C_kdf.OpenSSL = {
4425 /**
4426 * Derives a key and IV from a password.
4427 *
4428 * @param {string} password The password to derive from.
4429 * @param {number} keySize The size in words of the key to generate.
4430 * @param {number} ivSize The size in words of the IV to generate.
4431 * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
4432 *
4433 * @return {CipherParams} A cipher params object with the key, IV, and salt.
4434 *
4435 * @static
4436 *
4437 * @example
4438 *
4439 * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
4440 * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
4441 */
4442 execute: function (password, keySize, ivSize, salt) {
4443 // Generate random salt
4444 if (!salt) {
4445 salt = WordArray.random(64/8);
4446 }
4447
4448 // Derive key and IV
4449 var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
4450
4451 // Separate key and IV
4452 var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
4453 key.sigBytes = keySize * 4;
4454
4455 // Return params
4456 return CipherParams.create({ key: key, iv: iv, salt: salt });
4457 }
4458 };
4459
4460 /**
4461 * A serializable cipher wrapper that derives the key from a password,
4462 * and returns ciphertext as a serializable cipher params object.
4463 */
4464 var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
4465 /**
4466 * Configuration options.
4467 *
4468 * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
4469 */
4470 cfg: SerializableCipher.cfg.extend({
4471 kdf: OpenSSLKdf
4472 }),
4473
4474 /**
4475 * Encrypts a message using a password.
4476 *
4477 * @param {Cipher} cipher The cipher algorithm to use.
4478 * @param {WordArray|string} message The message to encrypt.
4479 * @param {string} password The password.
4480 * @param {Object} cfg (Optional) The configuration options to use for this operation.
4481 *
4482 * @return {CipherParams} A cipher params object.
4483 *
4484 * @static
4485 *
4486 * @example
4487 *
4488 * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
4489 * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
4490 */
4491 encrypt: function (cipher, message, password, cfg) {
4492 // Apply config defaults
4493 cfg = this.cfg.extend(cfg);
4494
4495 // Derive key and other params
4496 var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
4497
4498 // Add IV to config
4499 cfg.iv = derivedParams.iv;
4500
4501 // Encrypt
4502 var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
4503
4504 // Mix in derived params
4505 ciphertext.mixIn(derivedParams);
4506
4507 return ciphertext;
4508 },
4509
4510 /**
4511 * Decrypts serialized ciphertext using a password.
4512 *
4513 * @param {Cipher} cipher The cipher algorithm to use.
4514 * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
4515 * @param {string} password The password.
4516 * @param {Object} cfg (Optional) The configuration options to use for this operation.
4517 *
4518 * @return {WordArray} The plaintext.
4519 *
4520 * @static
4521 *
4522 * @example
4523 *
4524 * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
4525 * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
4526 */
4527 decrypt: function (cipher, ciphertext, password, cfg) {
4528 // Apply config defaults
4529 cfg = this.cfg.extend(cfg);
4530
4531 // Convert string to CipherParams
4532 ciphertext = this._parse(ciphertext, cfg.format);
4533
4534 // Derive key and other params
4535 var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
4536
4537 // Add IV to config
4538 cfg.iv = derivedParams.iv;
4539
4540 // Decrypt
4541 var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
4542
4543 return plaintext;
4544 }
4545 });
4546}());
4547
4548
4549/***/ }),
4550/* 22 */
4551/***/ (function(module, exports, __webpack_require__) {
4552
4553var CryptoJS = __webpack_require__(1).CryptoJS;
4554
4555/*
4556CryptoJS v3.1.2
4557code.google.com/p/crypto-js
4558(c) 2009-2013 by Jeff Mott. All rights reserved.
4559code.google.com/p/crypto-js/wiki/License
4560*/
4561(function () {
4562 // Shortcuts
4563 var C = CryptoJS;
4564 var C_lib = C.lib;
4565 var WordArray = C_lib.WordArray;
4566 var C_enc = C.enc;
4567
4568 /**
4569 * Base64 encoding strategy.
4570 */
4571 var Base64 = C_enc.Base64 = {
4572 /**
4573 * Converts a word array to a Base64 string.
4574 *
4575 * @param {WordArray} wordArray The word array.
4576 *
4577 * @return {string} The Base64 string.
4578 *
4579 * @static
4580 *
4581 * @example
4582 *
4583 * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
4584 */
4585 stringify: function (wordArray) {
4586 // Shortcuts
4587 var words = wordArray.words;
4588 var sigBytes = wordArray.sigBytes;
4589 var map = this._map;
4590
4591 // Clamp excess bits
4592 wordArray.clamp();
4593
4594 // Convert
4595 var base64Chars = [];
4596 for (var i = 0; i < sigBytes; i += 3) {
4597 var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
4598 var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
4599 var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
4600
4601 var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
4602
4603 for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
4604 base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
4605 }
4606 }
4607
4608 // Add padding
4609 var paddingChar = map.charAt(64);
4610 if (paddingChar) {
4611 while (base64Chars.length % 4) {
4612 base64Chars.push(paddingChar);
4613 }
4614 }
4615
4616 return base64Chars.join('');
4617 },
4618
4619 /**
4620 * Converts a Base64 string to a word array.
4621 *
4622 * @param {string} base64Str The Base64 string.
4623 *
4624 * @return {WordArray} The word array.
4625 *
4626 * @static
4627 *
4628 * @example
4629 *
4630 * var wordArray = CryptoJS.enc.Base64.parse(base64String);
4631 */
4632 parse: function (base64Str) {
4633 // Shortcuts
4634 var base64StrLength = base64Str.length;
4635 var map = this._map;
4636
4637 // Ignore padding
4638 var paddingChar = map.charAt(64);
4639 if (paddingChar) {
4640 var paddingIndex = base64Str.indexOf(paddingChar);
4641 if (paddingIndex != -1) {
4642 base64StrLength = paddingIndex;
4643 }
4644 }
4645
4646 // Convert
4647 var words = [];
4648 var nBytes = 0;
4649 for (var i = 0; i < base64StrLength; i++) {
4650 if (i % 4) {
4651 var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2);
4652 var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2);
4653 words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);
4654 nBytes++;
4655 }
4656 }
4657
4658 return WordArray.create(words, nBytes);
4659 },
4660
4661 _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
4662 };
4663}());
4664
4665
4666/***/ }),
4667/* 23 */
4668/***/ (function(module, exports, __webpack_require__) {
4669
4670var CryptoJS = __webpack_require__(1).CryptoJS;
4671
4672/*
4673CryptoJS v3.1.2
4674code.google.com/p/crypto-js
4675(c) 2009-2013 by Jeff Mott. All rights reserved.
4676code.google.com/p/crypto-js/wiki/License
4677*/
4678(function () {
4679 // Shortcuts
4680 var C = CryptoJS;
4681 var C_lib = C.lib;
4682 var Base = C_lib.Base;
4683 var WordArray = C_lib.WordArray;
4684 var C_algo = C.algo;
4685 var MD5 = C_algo.MD5;
4686
4687 /**
4688 * This key derivation function is meant to conform with EVP_BytesToKey.
4689 * www.openssl.org/docs/crypto/EVP_BytesToKey.html
4690 */
4691 var EvpKDF = C_algo.EvpKDF = Base.extend({
4692 /**
4693 * Configuration options.
4694 *
4695 * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
4696 * @property {Hasher} hasher The hash algorithm to use. Default: MD5
4697 * @property {number} iterations The number of iterations to perform. Default: 1
4698 */
4699 cfg: Base.extend({
4700 keySize: 128/32,
4701 hasher: MD5,
4702 iterations: 1
4703 }),
4704
4705 /**
4706 * Initializes a newly created key derivation function.
4707 *
4708 * @param {Object} cfg (Optional) The configuration options to use for the derivation.
4709 *
4710 * @example
4711 *
4712 * var kdf = CryptoJS.algo.EvpKDF.create();
4713 * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
4714 * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
4715 */
4716 init: function (cfg) {
4717 this.cfg = this.cfg.extend(cfg);
4718 },
4719
4720 /**
4721 * Derives a key from a password.
4722 *
4723 * @param {WordArray|string} password The password.
4724 * @param {WordArray|string} salt A salt.
4725 *
4726 * @return {WordArray} The derived key.
4727 *
4728 * @example
4729 *
4730 * var key = kdf.compute(password, salt);
4731 */
4732 compute: function (password, salt) {
4733 // Shortcut
4734 var cfg = this.cfg;
4735
4736 // Init hasher
4737 var hasher = cfg.hasher.create();
4738
4739 // Initial values
4740 var derivedKey = WordArray.create();
4741
4742 // Shortcuts
4743 var derivedKeyWords = derivedKey.words;
4744 var keySize = cfg.keySize;
4745 var iterations = cfg.iterations;
4746
4747 // Generate key
4748 while (derivedKeyWords.length < keySize) {
4749 if (block) {
4750 hasher.update(block);
4751 }
4752 var block = hasher.update(password).finalize(salt);
4753 hasher.reset();
4754
4755 // Iterations
4756 for (var i = 1; i < iterations; i++) {
4757 block = hasher.finalize(block);
4758 hasher.reset();
4759 }
4760
4761 derivedKey.concat(block);
4762 }
4763 derivedKey.sigBytes = keySize * 4;
4764
4765 return derivedKey;
4766 }
4767 });
4768
4769 /**
4770 * Derives a key from a password.
4771 *
4772 * @param {WordArray|string} password The password.
4773 * @param {WordArray|string} salt A salt.
4774 * @param {Object} cfg (Optional) The configuration options to use for this computation.
4775 *
4776 * @return {WordArray} The derived key.
4777 *
4778 * @static
4779 *
4780 * @example
4781 *
4782 * var key = CryptoJS.EvpKDF(password, salt);
4783 * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
4784 * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
4785 */
4786 C.EvpKDF = function (password, salt, cfg) {
4787 return EvpKDF.create(cfg).compute(password, salt);
4788 };
4789}());
4790
4791
4792/***/ }),
4793/* 24 */
4794/***/ (function(module, exports, __webpack_require__) {
4795
4796var CryptoJS = __webpack_require__(1).CryptoJS;
4797
4798// create custom json serialization format
4799var JsonFormatter = {
4800 stringify: function (cipherParams) {
4801 // create json object with ciphertext
4802 var jsonObj = {
4803 ct: cipherParams.ciphertext.toString(CryptoJS.enc.Base64)
4804 };
4805
4806 // optionally add iv and salt
4807 if (cipherParams.iv) {
4808 jsonObj.iv = cipherParams.iv.toString();
4809 }
4810
4811 if (cipherParams.salt) {
4812 jsonObj.s = cipherParams.salt.toString();
4813 }
4814
4815 // stringify json object
4816 return JSON.stringify(jsonObj)
4817 },
4818
4819 parse: function (jsonStr) {
4820 // parse json string
4821 var jsonObj = JSON.parse(jsonStr);
4822
4823 // extract ciphertext from json object, and create cipher params object
4824 var cipherParams = CryptoJS.lib.CipherParams.create({
4825 ciphertext: CryptoJS.enc.Base64.parse(jsonObj.ct)
4826 });
4827
4828 // optionally extract iv and salt
4829 if (jsonObj.iv) {
4830 cipherParams.iv = CryptoJS.enc.Hex.parse(jsonObj.iv);
4831 }
4832
4833 if (jsonObj.s) {
4834 cipherParams.salt = CryptoJS.enc.Hex.parse(jsonObj.s);
4835 }
4836
4837 return cipherParams;
4838 }
4839};
4840
4841exports.JsonFormatter = JsonFormatter;
4842
4843/***/ }),
4844/* 25 */
4845/***/ (function(module, exports, __webpack_require__) {
4846
4847var CryptoJS = __webpack_require__(1).CryptoJS;
4848
4849/*
4850CryptoJS v3.1.2
4851code.google.com/p/crypto-js
4852(c) 2009-2013 by Jeff Mott. All rights reserved.
4853code.google.com/p/crypto-js/wiki/License
4854*/
4855(function (Math) {
4856 // Shortcuts
4857 var C = CryptoJS;
4858 var C_lib = C.lib;
4859 var WordArray = C_lib.WordArray;
4860 var Hasher = C_lib.Hasher;
4861 var C_algo = C.algo;
4862
4863 // Constants table
4864 var T = [];
4865
4866 // Compute constants
4867 (function () {
4868 for (var i = 0; i < 64; i++) {
4869 T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
4870 }
4871 }());
4872
4873 /**
4874 * MD5 hash algorithm.
4875 */
4876 var MD5 = C_algo.MD5 = Hasher.extend({
4877 _doReset: function () {
4878 this._hash = new WordArray.init([
4879 0x67452301, 0xefcdab89,
4880 0x98badcfe, 0x10325476
4881 ]);
4882 },
4883
4884 _doProcessBlock: function (M, offset) {
4885 // Swap endian
4886 for (var i = 0; i < 16; i++) {
4887 // Shortcuts
4888 var offset_i = offset + i;
4889 var M_offset_i = M[offset_i];
4890
4891 M[offset_i] = (
4892 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
4893 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
4894 );
4895 }
4896
4897 // Shortcuts
4898 var H = this._hash.words;
4899
4900 var M_offset_0 = M[offset + 0];
4901 var M_offset_1 = M[offset + 1];
4902 var M_offset_2 = M[offset + 2];
4903 var M_offset_3 = M[offset + 3];
4904 var M_offset_4 = M[offset + 4];
4905 var M_offset_5 = M[offset + 5];
4906 var M_offset_6 = M[offset + 6];
4907 var M_offset_7 = M[offset + 7];
4908 var M_offset_8 = M[offset + 8];
4909 var M_offset_9 = M[offset + 9];
4910 var M_offset_10 = M[offset + 10];
4911 var M_offset_11 = M[offset + 11];
4912 var M_offset_12 = M[offset + 12];
4913 var M_offset_13 = M[offset + 13];
4914 var M_offset_14 = M[offset + 14];
4915 var M_offset_15 = M[offset + 15];
4916
4917 // Working varialbes
4918 var a = H[0];
4919 var b = H[1];
4920 var c = H[2];
4921 var d = H[3];
4922
4923 // Computation
4924 a = FF(a, b, c, d, M_offset_0, 7, T[0]);
4925 d = FF(d, a, b, c, M_offset_1, 12, T[1]);
4926 c = FF(c, d, a, b, M_offset_2, 17, T[2]);
4927 b = FF(b, c, d, a, M_offset_3, 22, T[3]);
4928 a = FF(a, b, c, d, M_offset_4, 7, T[4]);
4929 d = FF(d, a, b, c, M_offset_5, 12, T[5]);
4930 c = FF(c, d, a, b, M_offset_6, 17, T[6]);
4931 b = FF(b, c, d, a, M_offset_7, 22, T[7]);
4932 a = FF(a, b, c, d, M_offset_8, 7, T[8]);
4933 d = FF(d, a, b, c, M_offset_9, 12, T[9]);
4934 c = FF(c, d, a, b, M_offset_10, 17, T[10]);
4935 b = FF(b, c, d, a, M_offset_11, 22, T[11]);
4936 a = FF(a, b, c, d, M_offset_12, 7, T[12]);
4937 d = FF(d, a, b, c, M_offset_13, 12, T[13]);
4938 c = FF(c, d, a, b, M_offset_14, 17, T[14]);
4939 b = FF(b, c, d, a, M_offset_15, 22, T[15]);
4940
4941 a = GG(a, b, c, d, M_offset_1, 5, T[16]);
4942 d = GG(d, a, b, c, M_offset_6, 9, T[17]);
4943 c = GG(c, d, a, b, M_offset_11, 14, T[18]);
4944 b = GG(b, c, d, a, M_offset_0, 20, T[19]);
4945 a = GG(a, b, c, d, M_offset_5, 5, T[20]);
4946 d = GG(d, a, b, c, M_offset_10, 9, T[21]);
4947 c = GG(c, d, a, b, M_offset_15, 14, T[22]);
4948 b = GG(b, c, d, a, M_offset_4, 20, T[23]);
4949 a = GG(a, b, c, d, M_offset_9, 5, T[24]);
4950 d = GG(d, a, b, c, M_offset_14, 9, T[25]);
4951 c = GG(c, d, a, b, M_offset_3, 14, T[26]);
4952 b = GG(b, c, d, a, M_offset_8, 20, T[27]);
4953 a = GG(a, b, c, d, M_offset_13, 5, T[28]);
4954 d = GG(d, a, b, c, M_offset_2, 9, T[29]);
4955 c = GG(c, d, a, b, M_offset_7, 14, T[30]);
4956 b = GG(b, c, d, a, M_offset_12, 20, T[31]);
4957
4958 a = HH(a, b, c, d, M_offset_5, 4, T[32]);
4959 d = HH(d, a, b, c, M_offset_8, 11, T[33]);
4960 c = HH(c, d, a, b, M_offset_11, 16, T[34]);
4961 b = HH(b, c, d, a, M_offset_14, 23, T[35]);
4962 a = HH(a, b, c, d, M_offset_1, 4, T[36]);
4963 d = HH(d, a, b, c, M_offset_4, 11, T[37]);
4964 c = HH(c, d, a, b, M_offset_7, 16, T[38]);
4965 b = HH(b, c, d, a, M_offset_10, 23, T[39]);
4966 a = HH(a, b, c, d, M_offset_13, 4, T[40]);
4967 d = HH(d, a, b, c, M_offset_0, 11, T[41]);
4968 c = HH(c, d, a, b, M_offset_3, 16, T[42]);
4969 b = HH(b, c, d, a, M_offset_6, 23, T[43]);
4970 a = HH(a, b, c, d, M_offset_9, 4, T[44]);
4971 d = HH(d, a, b, c, M_offset_12, 11, T[45]);
4972 c = HH(c, d, a, b, M_offset_15, 16, T[46]);
4973 b = HH(b, c, d, a, M_offset_2, 23, T[47]);
4974
4975 a = II(a, b, c, d, M_offset_0, 6, T[48]);
4976 d = II(d, a, b, c, M_offset_7, 10, T[49]);
4977 c = II(c, d, a, b, M_offset_14, 15, T[50]);
4978 b = II(b, c, d, a, M_offset_5, 21, T[51]);
4979 a = II(a, b, c, d, M_offset_12, 6, T[52]);
4980 d = II(d, a, b, c, M_offset_3, 10, T[53]);
4981 c = II(c, d, a, b, M_offset_10, 15, T[54]);
4982 b = II(b, c, d, a, M_offset_1, 21, T[55]);
4983 a = II(a, b, c, d, M_offset_8, 6, T[56]);
4984 d = II(d, a, b, c, M_offset_15, 10, T[57]);
4985 c = II(c, d, a, b, M_offset_6, 15, T[58]);
4986 b = II(b, c, d, a, M_offset_13, 21, T[59]);
4987 a = II(a, b, c, d, M_offset_4, 6, T[60]);
4988 d = II(d, a, b, c, M_offset_11, 10, T[61]);
4989 c = II(c, d, a, b, M_offset_2, 15, T[62]);
4990 b = II(b, c, d, a, M_offset_9, 21, T[63]);
4991
4992 // Intermediate hash value
4993 H[0] = (H[0] + a) | 0;
4994 H[1] = (H[1] + b) | 0;
4995 H[2] = (H[2] + c) | 0;
4996 H[3] = (H[3] + d) | 0;
4997 },
4998
4999 _doFinalize: function () {
5000 // Shortcuts
5001 var data = this._data;
5002 var dataWords = data.words;
5003
5004 var nBitsTotal = this._nDataBytes * 8;
5005 var nBitsLeft = data.sigBytes * 8;
5006
5007 // Add padding
5008 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
5009
5010 var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
5011 var nBitsTotalL = nBitsTotal;
5012 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
5013 (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
5014 (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
5015 );
5016 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
5017 (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
5018 (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
5019 );
5020
5021 data.sigBytes = (dataWords.length + 1) * 4;
5022
5023 // Hash final blocks
5024 this._process();
5025
5026 // Shortcuts
5027 var hash = this._hash;
5028 var H = hash.words;
5029
5030 // Swap endian
5031 for (var i = 0; i < 4; i++) {
5032 // Shortcut
5033 var H_i = H[i];
5034
5035 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
5036 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
5037 }
5038
5039 // Return final computed hash
5040 return hash;
5041 },
5042
5043 clone: function () {
5044 var clone = Hasher.clone.call(this);
5045 clone._hash = this._hash.clone();
5046
5047 return clone;
5048 }
5049 });
5050
5051 function FF(a, b, c, d, x, s, t) {
5052 var n = a + ((b & c) | (~b & d)) + x + t;
5053 return ((n << s) | (n >>> (32 - s))) + b;
5054 }
5055
5056 function GG(a, b, c, d, x, s, t) {
5057 var n = a + ((b & d) | (c & ~d)) + x + t;
5058 return ((n << s) | (n >>> (32 - s))) + b;
5059 }
5060
5061 function HH(a, b, c, d, x, s, t) {
5062 var n = a + (b ^ c ^ d) + x + t;
5063 return ((n << s) | (n >>> (32 - s))) + b;
5064 }
5065
5066 function II(a, b, c, d, x, s, t) {
5067 var n = a + (c ^ (b | ~d)) + x + t;
5068 return ((n << s) | (n >>> (32 - s))) + b;
5069 }
5070
5071 /**
5072 * Shortcut function to the hasher's object interface.
5073 *
5074 * @param {WordArray|string} message The message to hash.
5075 *
5076 * @return {WordArray} The hash.
5077 *
5078 * @static
5079 *
5080 * @example
5081 *
5082 * var hash = CryptoJS.MD5('message');
5083 * var hash = CryptoJS.MD5(wordArray);
5084 */
5085 C.MD5 = Hasher._createHelper(MD5);
5086
5087 /**
5088 * Shortcut function to the HMAC's object interface.
5089 *
5090 * @param {WordArray|string} message The message to hash.
5091 * @param {WordArray|string} key The secret key.
5092 *
5093 * @return {WordArray} The HMAC.
5094 *
5095 * @static
5096 *
5097 * @example
5098 *
5099 * var hmac = CryptoJS.HmacMD5(message, key);
5100 */
5101 C.HmacMD5 = Hasher._createHmacHelper(MD5);
5102}(Math));
5103
5104
5105/***/ }),
5106/* 26 */
5107/***/ (function(module, exports, __webpack_require__) {
5108
5109var CryptoJS = __webpack_require__(1).CryptoJS;
5110
5111(function (Math) {
5112 // Shortcuts
5113 var C = CryptoJS;
5114 var C_lib = C.lib;
5115 var WordArray = C_lib.WordArray;
5116 var Hasher = C_lib.Hasher;
5117 var C_algo = C.algo;
5118
5119 // Initialization and round constants tables
5120 var H = [];
5121 var K = [];
5122
5123 // Compute constants
5124 (function () {
5125 function isPrime(n) {
5126 var sqrtN = Math.sqrt(n);
5127 for (var factor = 2; factor <= sqrtN; factor++) {
5128 if (!(n % factor)) {
5129 return false;
5130 }
5131 }
5132
5133 return true;
5134 }
5135
5136 function getFractionalBits(n) {
5137 return ((n - (n | 0)) * 0x100000000) | 0;
5138 }
5139
5140 var n = 2;
5141 var nPrime = 0;
5142 while (nPrime < 64) {
5143 if (isPrime(n)) {
5144 if (nPrime < 8) {
5145 H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
5146 }
5147 K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
5148
5149 nPrime++;
5150 }
5151
5152 n++;
5153 }
5154 }());
5155
5156 // Reusable object
5157 var W = [];
5158
5159 /**
5160 * SHA-256 hash algorithm.
5161 */
5162 var SHA256 = C_algo.SHA256 = Hasher.extend({
5163 _doReset: function () {
5164 this._hash = new WordArray.init(H.slice(0));
5165 },
5166
5167 _doProcessBlock: function (M, offset) {
5168 // Shortcut
5169 var H = this._hash.words;
5170
5171 // Working variables
5172 var a = H[0];
5173 var b = H[1];
5174 var c = H[2];
5175 var d = H[3];
5176 var e = H[4];
5177 var f = H[5];
5178 var g = H[6];
5179 var h = H[7];
5180
5181 // Computation
5182 for (var i = 0; i < 64; i++) {
5183 if (i < 16) {
5184 W[i] = M[offset + i] | 0;
5185 } else {
5186 var gamma0x = W[i - 15];
5187 var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
5188 ((gamma0x << 14) | (gamma0x >>> 18)) ^
5189 (gamma0x >>> 3);
5190
5191 var gamma1x = W[i - 2];
5192 var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
5193 ((gamma1x << 13) | (gamma1x >>> 19)) ^
5194 (gamma1x >>> 10);
5195
5196 W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
5197 }
5198
5199 var ch = (e & f) ^ (~e & g);
5200 var maj = (a & b) ^ (a & c) ^ (b & c);
5201
5202 var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
5203 var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));
5204
5205 var t1 = h + sigma1 + ch + K[i] + W[i];
5206 var t2 = sigma0 + maj;
5207
5208 h = g;
5209 g = f;
5210 f = e;
5211 e = (d + t1) | 0;
5212 d = c;
5213 c = b;
5214 b = a;
5215 a = (t1 + t2) | 0;
5216 }
5217
5218 // Intermediate hash value
5219 H[0] = (H[0] + a) | 0;
5220 H[1] = (H[1] + b) | 0;
5221 H[2] = (H[2] + c) | 0;
5222 H[3] = (H[3] + d) | 0;
5223 H[4] = (H[4] + e) | 0;
5224 H[5] = (H[5] + f) | 0;
5225 H[6] = (H[6] + g) | 0;
5226 H[7] = (H[7] + h) | 0;
5227 },
5228
5229 _doFinalize: function () {
5230 // Shortcuts
5231 var data = this._data;
5232 var dataWords = data.words;
5233
5234 var nBitsTotal = this._nDataBytes * 8;
5235 var nBitsLeft = data.sigBytes * 8;
5236
5237 // Add padding
5238 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
5239 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
5240 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
5241 data.sigBytes = dataWords.length * 4;
5242
5243 // Hash final blocks
5244 this._process();
5245
5246 // Return final computed hash
5247 return this._hash;
5248 },
5249
5250 clone: function () {
5251 var clone = Hasher.clone.call(this);
5252 clone._hash = this._hash.clone();
5253
5254 return clone;
5255 }
5256 });
5257
5258 /**
5259 * Shortcut function to the hasher's object interface.
5260 *
5261 * @param {WordArray|string} message The message to hash.
5262 *
5263 * @return {WordArray} The hash.
5264 *
5265 * @static
5266 *
5267 * @example
5268 *
5269 * var hash = CryptoJS.SHA256('message');
5270 * var hash = CryptoJS.SHA256(wordArray);
5271 */
5272 C.SHA256 = Hasher._createHelper(SHA256);
5273
5274 /**
5275 * Shortcut function to the HMAC's object interface.
5276 *
5277 * @param {WordArray|string} message The message to hash.
5278 * @param {WordArray|string} key The secret key.
5279 *
5280 * @return {WordArray} The HMAC.
5281 *
5282 * @static
5283 *
5284 * @example
5285 *
5286 * var hmac = CryptoJS.HmacSHA256(message, key);
5287 */
5288 C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
5289}(Math));
5290
5291/***/ }),
5292/* 27 */
5293/***/ (function(module, __webpack_exports__, __webpack_require__) {
5294
5295"use strict";
5296
5297class MTError extends Error {
5298 static getMessage(code, type, message) {
5299 return `MT[${code}] ${type}: ${message}`;
5300 }
5301 constructor(code, type, message) {
5302 const fullMessage = MTError.getMessage(code, type, message);
5303 super(fullMessage);
5304 this.code = code;
5305 this.type = type;
5306 }
5307}
5308/* unused harmony export MTError */
5309
5310
5311class ErrorBadResponse extends MTError {
5312 constructor(url, originalError = null) {
5313 super(406, 'NETWORK_BAD_RESPONSE', url);
5314 if (originalError) this.originalError = originalError;
5315 }
5316}
5317/* harmony export (immutable) */ __webpack_exports__["a"] = ErrorBadResponse;
5318
5319
5320class ErrorNotFound extends MTError {
5321 constructor(err) {
5322 super(404, 'REQUEST_FAILED', err.config.url);
5323 this.originalError = err;
5324 }
5325}
5326/* harmony export (immutable) */ __webpack_exports__["b"] = ErrorNotFound;
5327
5328
5329/***/ }),
5330/* 28 */
5331/***/ (function(module, __webpack_exports__, __webpack_require__) {
5332
5333"use strict";
5334/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return bpe; });
5335/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return one; });
5336/* harmony export (immutable) */ __webpack_exports__["o"] = powMod;
5337/* harmony export (immutable) */ __webpack_exports__["k"] = eGCD_;
5338/* harmony export (immutable) */ __webpack_exports__["h"] = greater;
5339/* harmony export (immutable) */ __webpack_exports__["n"] = divide_;
5340/* harmony export (immutable) */ __webpack_exports__["b"] = str2bigInt;
5341/* harmony export (immutable) */ __webpack_exports__["l"] = equalsInt;
5342/* harmony export (immutable) */ __webpack_exports__["f"] = isZero;
5343/* harmony export (immutable) */ __webpack_exports__["a"] = bigInt2str;
5344/* harmony export (immutable) */ __webpack_exports__["e"] = copy_;
5345/* harmony export (immutable) */ __webpack_exports__["d"] = copyInt_;
5346/* harmony export (immutable) */ __webpack_exports__["j"] = rightShift_;
5347/* harmony export (immutable) */ __webpack_exports__["i"] = sub_;
5348/* harmony export (immutable) */ __webpack_exports__["g"] = add_;
5349////////////////////////////////////////////////////////////////////////////////////////
5350// Big Integer Library v. 5.5
5351// Created 2000, last modified 2013
5352// Leemon Baird
5353// www.leemon.com
5354//
5355// Version history:
5356// v 5.5 17 Mar 2013
5357// - two lines of a form like "if (x<0) x+=n" had the "if" changed to "while" to
5358// handle the case when x<-n. (Thanks to James Ansell for finding that bug)
5359// v 5.4 3 Oct 2009
5360// - added "var i" to greaterShift() so i is not global. (Thanks to PŽter Szab— for finding that bug)
5361//
5362// v 5.3 21 Sep 2009
5363// - added randProbPrime(k) for probable primes
5364// - unrolled loop in mont_ (slightly faster)
5365// - millerRabin now takes a bigInt parameter rather than an int
5366//
5367// v 5.2 15 Sep 2009
5368// - fixed capitalization in call to int2bigInt in randBigInt
5369// (thanks to Emili Evripidou, Reinhold Behringer, and Samuel Macaleese for finding that bug)
5370//
5371// v 5.1 8 Oct 2007
5372// - renamed inverseModInt_ to inverseModInt since it doesn't change its parameters
5373// - added functions GCD and randBigInt, which call GCD_ and randBigInt_
5374// - fixed a bug found by Rob Visser (see comment with his name below)
5375// - improved comments
5376//
5377// This file is public domain. You can use it for any purpose without restriction.
5378// I do not guarantee that it is correct, so use it at your own risk. If you use
5379// it for something interesting, I'd appreciate hearing about it. If you find
5380// any bugs or make any improvements, I'd appreciate hearing about those too.
5381// It would also be nice if my name and URL were left in the comments. But none
5382// of that is required.
5383//
5384// This code defines a bigInt library for arbitrary-precision integers.
5385// A bigInt is an array of integers storing the value in chunks of bpe bits,
5386// little endian (buff[0] is the least significant word).
5387// Negative bigInts are stored two's complement. Almost all the functions treat
5388// bigInts as nonnegative. The few that view them as two's complement say so
5389// in their comments. Some functions assume their parameters have at least one
5390// leading zero element. Functions with an underscore at the end of the name put
5391// their answer into one of the arrays passed in, and have unpredictable behavior
5392// in case of overflow, so the caller must make sure the arrays are big enough to
5393// hold the answer. But the average user should never have to call any of the
5394// underscored functions. Each important underscored function has a wrapper function
5395// of the same name without the underscore that takes care of the details for you.
5396// For each underscored function where a parameter is modified, that same variable
5397// must not be used as another argument too. So, you cannot square x by doing
5398// multMod_(x,x,n). You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n).
5399// Or simply use the multMod(x,x,n) function without the underscore, where
5400// such issues never arise, because non-underscored functions never change
5401// their parameters; they always allocate new memory for the answer that is returned.
5402//
5403// These functions are designed to avoid frequent dynamic memory allocation in the inner loop.
5404// For most functions, if it needs a BigInt as a local variable it will actually use
5405// a global, and will only allocate to it only when it's not the right size. This ensures
5406// that when a function is called repeatedly with same-sized parameters, it only allocates
5407// memory on the first call.
5408//
5409// Note that for cryptographic purposes, the calls to Math.random() must
5410// be replaced with calls to a better pseudorandom number generator.
5411//
5412// In the following, "bigInt" means a bigInt with at least one leading zero element,
5413// and "integer" means a nonnegative integer less than radix. In some cases, integer
5414// can be negative. Negative bigInts are 2s complement.
5415//
5416// The following functions do not modify their inputs.
5417// Those returning a bigInt, string, or Array will dynamically allocate memory for that value.
5418// Those returning a boolean will return the integer 0 (false) or 1 (true).
5419// Those returning boolean or int will not allocate memory except possibly on the first
5420// time they're called with a given parameter size.
5421//
5422// bigInt add(x,y) //return (x+y) for bigInts x and y.
5423// bigInt addInt(x,n) //return (x+n) where x is a bigInt and n is an integer.
5424// string bigInt2str(x,base) //return a string form of bigInt x in a given base, with 2 <= base <= 95
5425// int bitSize(x) //return how many bits long the bigInt x is, not counting leading zeros
5426// bigInt dup(x) //return a copy of bigInt x
5427// boolean equals(x,y) //is the bigInt x equal to the bigint y?
5428// boolean equalsInt(x,y) //is bigint x equal to integer y?
5429// bigInt expand(x,n) //return a copy of x with at least n elements, adding leading zeros if needed
5430// Array findPrimes(n) //return array of all primes less than integer n
5431// bigInt GCD(x,y) //return greatest common divisor of bigInts x and y (each with same number of elements).
5432// boolean greater(x,y) //is x>y? (x and y are nonnegative bigInts)
5433// boolean greaterShift(x,y,shift)//is (x <<(shift*bpe)) > y?
5434// bigInt int2bigInt(t,n,m) //return a bigInt equal to integer t, with at least n bits and m array elements
5435// bigInt inverseMod(x,n) //return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
5436// int inverseModInt(x,n) //return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
5437// boolean isZero(x) //is the bigInt x equal to zero?
5438// boolean millerRabin(x,b) //does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is bigInt, 1<b<x)
5439// boolean millerRabinInt(x,b) //does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is int, 1<b<x)
5440// bigInt mod(x,n) //return a new bigInt equal to (x mod n) for bigInts x and n.
5441// int modInt(x,n) //return x mod n for bigInt x and integer n.
5442// bigInt mult(x,y) //return x*y for bigInts x and y. This is faster when y<x.
5443// bigInt multMod(x,y,n) //return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
5444// boolean negative(x) //is bigInt x negative?
5445// bigInt powMod(x,y,n) //return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
5446// bigInt randBigInt(n,s) //return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1.
5447// bigInt randTruePrime(k) //return a new, random, k-bit, true prime bigInt using Maurer's algorithm.
5448// bigInt randProbPrime(k) //return a new, random, k-bit, probable prime bigInt (probability it's composite less than 2^-80).
5449// bigInt str2bigInt(s,b,n,m) //return a bigInt for number represented in string s in base b with at least n bits and m array elements
5450// bigInt sub(x,y) //return (x-y) for bigInts x and y. Negative answers will be 2s complement
5451// bigInt trim(x,k) //return a copy of x with exactly k leading zero elements
5452//
5453//
5454// The following functions each have a non-underscored version, which most users should call instead.
5455// These functions each write to a single parameter, and the caller is responsible for ensuring the array
5456// passed in is large enough to hold the result.
5457//
5458// void addInt_(x,n) //do x=x+n where x is a bigInt and n is an integer
5459// void add_(x,y) //do x=x+y for bigInts x and y
5460// void copy_(x,y) //do x=y on bigInts x and y
5461// void copyInt_(x,n) //do x=n on bigInt x and integer n
5462// void GCD_(x,y) //set x to the greatest common divisor of bigInts x and y, (y is destroyed). (This never overflows its array).
5463// boolean inverseMod_(x,n) //do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist
5464// void mod_(x,n) //do x=x mod n for bigInts x and n. (This never overflows its array).
5465// void mult_(x,y) //do x=x*y for bigInts x and y.
5466// void multMod_(x,y,n) //do x=x*y mod n for bigInts x,y,n.
5467// void powMod_(x,y,n) //do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1.
5468// void randBigInt_(b,n,s) //do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1.
5469// void randTruePrime_(ans,k) //do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb.
5470// void sub_(x,y) //do x=x-y for bigInts x and y. Negative answers will be 2s complement.
5471//
5472// The following functions do NOT have a non-underscored version.
5473// They each write a bigInt result to one or more parameters. The caller is responsible for
5474// ensuring the arrays passed in are large enough to hold the results.
5475//
5476// void addShift_(x,y,ys) //do x=x+(y<<(ys*bpe))
5477// void carry_(x) //do carries and borrows so each element of the bigInt x fits in bpe bits.
5478// void divide_(x,y,q,r) //divide x by y giving quotient q and remainder r
5479// int divInt_(x,n) //do x=floor(x/n) for bigInt x and integer n, and return the remainder. (This never overflows its array).
5480// int eGCD_(x,y,d,a,b) //sets a,b,d to positive bigInts such that d = GCD_(x,y) = a*x-b*y
5481// void halve_(x) //do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement. (This never overflows its array).
5482// void leftShift_(x,n) //left shift bigInt x by n bits. n<bpe.
5483// void linComb_(x,y,a,b) //do x=a*x+b*y for bigInts x and y and integers a and b
5484// void linCombShift_(x,y,b,ys) //do x=x+b*(y<<(ys*bpe)) for bigInts x and y, and integers b and ys
5485// void mont_(x,y,n,np) //Montgomery multiplication (see comments where the function is defined)
5486// void multInt_(x,n) //do x=x*n where x is a bigInt and n is an integer.
5487// void rightShift_(x,n) //right shift bigInt x by n bits. 0 <= n < bpe. (This never overflows its array).
5488// void squareMod_(x,n) //do x=x*x mod n for bigInts x,n
5489// void subShift_(x,y,ys) //do x=x-(y<<(ys*bpe)). Negative answers will be 2s complement.
5490//
5491// The following functions are based on algorithms from the _Handbook of Applied Cryptography_
5492// powMod_() = algorithm 14.94, Montgomery exponentiation
5493// eGCD_,inverseMod_() = algorithm 14.61, Binary extended GCD_
5494// GCD_() = algorothm 14.57, Lehmer's algorithm
5495// mont_() = algorithm 14.36, Montgomery multiplication
5496// divide_() = algorithm 14.20 Multiple-precision division
5497// squareMod_() = algorithm 14.16 Multiple-precision squaring
5498// randTruePrime_() = algorithm 4.62, Maurer's algorithm
5499// millerRabin() = algorithm 4.24, Miller-Rabin algorithm
5500//
5501// Profiling shows:
5502// randTruePrime_() spends:
5503// 10% of its time in calls to powMod_()
5504// 85% of its time in calls to millerRabin()
5505// millerRabin() spends:
5506// 99% of its time in calls to powMod_() (always with a base of 2)
5507// powMod_() spends:
5508// 94% of its time in calls to mont_() (almost always with x==y)
5509//
5510// This suggests there are several ways to speed up this library slightly:
5511// - convert powMod_ to use a Montgomery form of k-ary window (or maybe a Montgomery form of sliding window)
5512// -- this should especially focus on being fast when raising 2 to a power mod n
5513// - convert randTruePrime_() to use a minimum r of 1/3 instead of 1/2 with the appropriate change to the test
5514// - tune the parameters in randTruePrime_(), including c, m, and recLimit
5515// - speed up the single loop in mont_() that takes 95% of the runtime, perhaps by reducing checking
5516// within the loop when all the parameters are the same length.
5517//
5518// There are several ideas that look like they wouldn't help much at all:
5519// - replacing trial division in randTruePrime_() with a sieve (that speeds up something taking almost no time anyway)
5520// - increase bpe from 15 to 30 (that would help if we had a 32*32->64 multiplier, but not with JavaScript's 32*32->32)
5521// - speeding up mont_(x,y,n,np) when x==y by doing a non-modular, non-Montgomery square
5522// followed by a Montgomery reduction. The intermediate answer will be twice as long as x, so that
5523// method would be slower. This is unfortunate because the code currently spends almost all of its time
5524// doing mont_(x,x,...), both for randTruePrime_() and powMod_(). A faster method for Montgomery squaring
5525// would have a large impact on the speed of randTruePrime_() and powMod_(). HAC has a couple of poorly-worded
5526// sentences that seem to imply it's faster to do a non-modular square followed by a single
5527// Montgomery reduction, but that's obviously wrong.
5528////////////////////////////////////////////////////////////////////////////////////////
5529
5530//globals
5531var bpe = 0; //bits stored per array element
5532var mask = 0; //AND this with an array element to chop it down to bpe bits
5533var radix = mask + 1; //equals 2^bpe. A single 1 bit to the left of the last bit of mask.
5534
5535//the digits for converting to different bases
5536var digitsStr = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_=!@#$%^&*()[]{}|;:,.<>/?`~ \\\'\"+-';
5537
5538//initialize the global variables
5539for (bpe = 0; 1 << bpe + 1 > 1 << bpe; bpe++); //bpe=number of bits in the mantissa on this platform
5540bpe >>= 1; //bpe=number of bits in one element of the array representing the bigInt
5541mask = (1 << bpe) - 1; //AND the mask with an integer to get its bpe least significant bits
5542radix = mask + 1; //2^bpe. a single 1 bit to the left of the first bit of mask
5543var one = int2bigInt(1, 1, 1); //constant used in powMod_()
5544
5545//the following global variables are scratchpad memory to
5546//reduce dynamic memory allocation in the inner loop
5547var t = new Array(0);
5548var ss = t; //used in mult_()
5549var s0 = t; //used in multMod_(), squareMod_()
5550var s1 = t; //used in powMod_(), multMod_(), squareMod_()
5551var s2 = t; //used in powMod_(), multMod_()
5552var s3 = t; //used in powMod_()
5553var s4 = t,
5554 s5 = t; //used in mod_()
5555var s6 = t; //used in bigInt2str()
5556var s7 = t; //used in powMod_()
5557var T = t; //used in GCD_()
5558var sa = t; //used in mont_()
5559var mr_x1 = t,
5560 mr_r = t,
5561 mr_a = t,
5562 //used in millerRabin()
5563eg_v = t,
5564 eg_u = t,
5565 eg_A = t,
5566 eg_B = t,
5567 eg_C = t,
5568 eg_D = t,
5569 //used in eGCD_(), inverseMod_()
5570md_q1 = t,
5571 md_q2 = t,
5572 md_q3 = t,
5573 md_r = t,
5574 md_r1 = t,
5575 md_r2 = t,
5576 md_tt = t,
5577 //used in mod_()
5578
5579primes = t,
5580 pows = t,
5581 s_i = t,
5582 s_i2 = t,
5583 s_R = t,
5584 s_rm = t,
5585 s_q = t,
5586 s_n1 = t,
5587 s_a = t,
5588 s_r2 = t,
5589 s_n = t,
5590 s_b = t,
5591 s_d = t,
5592 s_x1 = t,
5593 s_x2 = t,
5594 s_aa = t,
5595 //used in randTruePrime_()
5596
5597rpprb = t; //used in randProbPrimeRounds() (which also uses "primes")
5598
5599////////////////////////////////////////////////////////////////////////////////////////
5600
5601var k, buff;
5602
5603//return array of all primes less than integer n
5604function findPrimes(n) {
5605 var i, s, p, ans;
5606 s = new Array(n);
5607 for (i = 0; i < n; i++) s[i] = 0;
5608 s[0] = 2;
5609 p = 0; //first p elements of s are primes, the rest are a sieve
5610 for (; s[p] < n;) {
5611 //s[p] is the pth prime
5612 for (i = s[p] * s[p]; i < n; i += s[p]) //mark multiples of s[p]
5613 s[i] = 1;
5614 p++;
5615 s[p] = s[p - 1] + 1;
5616 for (; s[p] < n && s[s[p]]; s[p]++); //find next prime (where s[p]==0)
5617 }
5618 ans = new Array(p);
5619 for (i = 0; i < p; i++) ans[i] = s[i];
5620 return ans;
5621}
5622
5623//does a single round of Miller-Rabin base b consider x to be a possible prime?
5624//x is a bigInt, and b is an integer, with b<x
5625function millerRabinInt(x, b) {
5626 if (mr_x1.length != x.length) {
5627 mr_x1 = dup(x);
5628 mr_r = dup(x);
5629 mr_a = dup(x);
5630 }
5631
5632 copyInt_(mr_a, b);
5633 return millerRabin(x, mr_a);
5634}
5635
5636//does a single round of Miller-Rabin base b consider x to be a possible prime?
5637//x and b are bigInts with b<x
5638function millerRabin(x, b) {
5639 var i, j, k, s;
5640
5641 if (mr_x1.length != x.length) {
5642 mr_x1 = dup(x);
5643 mr_r = dup(x);
5644 mr_a = dup(x);
5645 }
5646
5647 copy_(mr_a, b);
5648 copy_(mr_r, x);
5649 copy_(mr_x1, x);
5650
5651 addInt_(mr_r, -1);
5652 addInt_(mr_x1, -1);
5653
5654 //s=the highest power of two that divides mr_r
5655 k = 0;
5656 for (i = 0; i < mr_r.length; i++) for (j = 1; j < mask; j <<= 1) if (x[i] & j) {
5657 s = k < mr_r.length + bpe ? k : 0;
5658 i = mr_r.length;
5659 j = mask;
5660 } else k++;
5661
5662 if (s) rightShift_(mr_r, s);
5663
5664 powMod_(mr_a, mr_r, x);
5665
5666 if (!equalsInt(mr_a, 1) && !equals(mr_a, mr_x1)) {
5667 j = 1;
5668 while (j <= s - 1 && !equals(mr_a, mr_x1)) {
5669 squareMod_(mr_a, x);
5670 if (equalsInt(mr_a, 1)) {
5671 return 0;
5672 }
5673 j++;
5674 }
5675 if (!equals(mr_a, mr_x1)) {
5676 return 0;
5677 }
5678 }
5679 return 1;
5680}
5681
5682//returns how many bits long the bigInt is, not counting leading zeros.
5683function bitSize(x) {
5684 var j, z, w;
5685 for (j = x.length - 1; x[j] == 0 && j > 0; j--);
5686 for (z = 0, w = x[j]; w; w >>= 1, z++);
5687 z += bpe * j;
5688 return z;
5689}
5690
5691//return a copy of x with at least n elements, adding leading zeros if needed
5692function expand(x, n) {
5693 var ans = int2bigInt(0, (x.length > n ? x.length : n) * bpe, 0);
5694 copy_(ans, x);
5695 return ans;
5696}
5697
5698//return a k-bit true random prime using Maurer's algorithm.
5699function randTruePrime(k) {
5700 var ans = int2bigInt(0, k, 0);
5701 randTruePrime_(ans, k);
5702 return trim(ans, 1);
5703}
5704
5705//return a k-bit random probable prime with probability of error < 2^-80
5706function randProbPrime(k) {
5707 if (k >= 600) return randProbPrimeRounds(k, 2); //numbers from HAC table 4.3
5708 if (k >= 550) return randProbPrimeRounds(k, 4);
5709 if (k >= 500) return randProbPrimeRounds(k, 5);
5710 if (k >= 400) return randProbPrimeRounds(k, 6);
5711 if (k >= 350) return randProbPrimeRounds(k, 7);
5712 if (k >= 300) return randProbPrimeRounds(k, 9);
5713 if (k >= 250) return randProbPrimeRounds(k, 12); //numbers from HAC table 4.4
5714 if (k >= 200) return randProbPrimeRounds(k, 15);
5715 if (k >= 150) return randProbPrimeRounds(k, 18);
5716 if (k >= 100) return randProbPrimeRounds(k, 27);
5717 return randProbPrimeRounds(k, 40); //number from HAC remark 4.26 (only an estimate)
5718}
5719
5720//return a k-bit probable random prime using n rounds of Miller Rabin (after trial division with small primes)
5721function randProbPrimeRounds(k, n) {
5722 var ans, i, divisible, B;
5723 B = 30000; //B is largest prime to use in trial division
5724 ans = int2bigInt(0, k, 0);
5725
5726 //optimization: try larger and smaller B to find the best limit.
5727
5728 if (primes.length == 0) primes = findPrimes(30000); //check for divisibility by primes <=30000
5729
5730 if (rpprb.length != ans.length) rpprb = dup(ans);
5731
5732 for (;;) {
5733 //keep trying random values for ans until one appears to be prime
5734 //optimization: pick a random number times L=2*3*5*...*p, plus a
5735 // random element of the list of all numbers in [0,L) not divisible by any prime up to p.
5736 // This can reduce the amount of random number generation.
5737
5738 randBigInt_(ans, k, 0); //ans = a random odd number to check
5739 ans[0] |= 1;
5740 divisible = 0;
5741
5742 //check ans for divisibility by small primes up to B
5743 for (i = 0; i < primes.length && primes[i] <= B; i++) if (modInt(ans, primes[i]) == 0 && !equalsInt(ans, primes[i])) {
5744 divisible = 1;
5745 break;
5746 }
5747
5748 //optimization: change millerRabin so the base can be bigger than the number being checked, then eliminate the while here.
5749
5750 //do n rounds of Miller Rabin, with random bases less than ans
5751 for (i = 0; i < n && !divisible; i++) {
5752 randBigInt_(rpprb, k, 0);
5753 while (!greater(ans, rpprb)) //pick a random rpprb that's < ans
5754 randBigInt_(rpprb, k, 0);
5755 if (!millerRabin(ans, rpprb)) divisible = 1;
5756 }
5757
5758 if (!divisible) return ans;
5759 }
5760}
5761
5762//return a new bigInt equal to (x mod n) for bigInts x and n.
5763function mod(x, n) {
5764 var ans = dup(x);
5765 mod_(ans, n);
5766 return trim(ans, 1);
5767}
5768
5769//return (x+n) where x is a bigInt and n is an integer.
5770function addInt(x, n) {
5771 var ans = expand(x, x.length + 1);
5772 addInt_(ans, n);
5773 return trim(ans, 1);
5774}
5775
5776//return x*y for bigInts x and y. This is faster when y<x.
5777function mult(x, y) {
5778 var ans = expand(x, x.length + y.length);
5779 mult_(ans, y);
5780 return trim(ans, 1);
5781}
5782
5783//return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
5784function powMod(x, y, n) {
5785 var ans = expand(x, n.length);
5786 powMod_(ans, trim(y, 2), trim(n, 2), 0); //this should work without the trim, but doesn't
5787 return trim(ans, 1);
5788}
5789
5790//return (x-y) for bigInts x and y. Negative answers will be 2s complement
5791function sub(x, y) {
5792 var ans = expand(x, x.length > y.length ? x.length + 1 : y.length + 1);
5793 sub_(ans, y);
5794 return trim(ans, 1);
5795}
5796
5797//return (x+y) for bigInts x and y.
5798function add(x, y) {
5799 var ans = expand(x, x.length > y.length ? x.length + 1 : y.length + 1);
5800 add_(ans, y);
5801 return trim(ans, 1);
5802}
5803
5804//return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
5805function inverseMod(x, n) {
5806 var ans = expand(x, n.length);
5807 var s;
5808 s = inverseMod_(ans, n);
5809 return s ? trim(ans, 1) : null;
5810}
5811
5812//return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
5813function multMod(x, y, n) {
5814 var ans = expand(x, n.length);
5815 multMod_(ans, y, n);
5816 return trim(ans, 1);
5817}
5818
5819//generate a k-bit true random prime using Maurer's algorithm,
5820//and put it into ans. The bigInt ans must be large enough to hold it.
5821function randTruePrime_(ans, k) {
5822 var c, m, pm, dd, j, r, B, divisible, z, zz, recSize;
5823
5824 if (primes.length == 0) primes = findPrimes(30000); //check for divisibility by primes <=30000
5825
5826 if (pows.length == 0) {
5827 pows = new Array(512);
5828 for (j = 0; j < 512; j++) {
5829 pows[j] = Math.pow(2, j / 511. - 1.);
5830 }
5831 }
5832
5833 //c and m should be tuned for a particular machine and value of k, to maximize speed
5834 c = 0.1; //c=0.1 in HAC
5835 m = 20; //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits
5836 recLimit = 20; //stop recursion when k <=recLimit. Must have recLimit >= 2
5837
5838 if (s_i2.length != ans.length) {
5839 s_i2 = dup(ans);
5840 s_R = dup(ans);
5841 s_n1 = dup(ans);
5842 s_r2 = dup(ans);
5843 s_d = dup(ans);
5844 s_x1 = dup(ans);
5845 s_x2 = dup(ans);
5846 s_b = dup(ans);
5847 s_n = dup(ans);
5848 s_i = dup(ans);
5849 s_rm = dup(ans);
5850 s_q = dup(ans);
5851 s_a = dup(ans);
5852 s_aa = dup(ans);
5853 }
5854
5855 if (k <= recLimit) {
5856 //generate small random primes by trial division up to its square root
5857 pm = (1 << (k + 2 >> 1)) - 1; //pm is binary number with all ones, just over sqrt(2^k)
5858 copyInt_(ans, 0);
5859 for (dd = 1; dd;) {
5860 dd = 0;
5861 ans[0] = 1 | 1 << k - 1 | Math.floor(Math.random() * (1 << k)); //random, k-bit, odd integer, with msb 1
5862 for (j = 1; j < primes.length && (primes[j] & pm) == primes[j]; j++) {
5863 //trial division by all primes 3...sqrt(2^k)
5864 if (0 == ans[0] % primes[j]) {
5865 dd = 1;
5866 break;
5867 }
5868 }
5869 }
5870 carry_(ans);
5871 return;
5872 }
5873
5874 B = c * k * k; //try small primes up to B (or all the primes[] array if the largest is less than B).
5875 if (k > 2 * m) //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits
5876 for (r = 1; k - k * r <= m;) r = pows[Math.floor(Math.random() * 512)]; //r=Math.pow(2,Math.random()-1);
5877 else r = .5;
5878
5879 //simulation suggests the more complex algorithm using r=.333 is only slightly faster.
5880
5881 recSize = Math.floor(r * k) + 1;
5882
5883 randTruePrime_(s_q, recSize);
5884 copyInt_(s_i2, 0);
5885 s_i2[Math.floor((k - 2) / bpe)] |= 1 << (k - 2) % bpe; //s_i2=2^(k-2)
5886 divide_(s_i2, s_q, s_i, s_rm); //s_i=floor((2^(k-1))/(2q))
5887
5888 z = bitSize(s_i);
5889
5890 for (;;) {
5891 for (;;) {
5892 //generate z-bit numbers until one falls in the range [0,s_i-1]
5893 randBigInt_(s_R, z, 0);
5894 if (greater(s_i, s_R)) break;
5895 } //now s_R is in the range [0,s_i-1]
5896 addInt_(s_R, 1); //now s_R is in the range [1,s_i]
5897 add_(s_R, s_i); //now s_R is in the range [s_i+1,2*s_i]
5898
5899 copy_(s_n, s_q);
5900 mult_(s_n, s_R);
5901 multInt_(s_n, 2);
5902 addInt_(s_n, 1); //s_n=2*s_R*s_q+1
5903
5904 copy_(s_r2, s_R);
5905 multInt_(s_r2, 2); //s_r2=2*s_R
5906
5907 //check s_n for divisibility by small primes up to B
5908 for (divisible = 0, j = 0; j < primes.length && primes[j] < B; j++) if (modInt(s_n, primes[j]) == 0 && !equalsInt(s_n, primes[j])) {
5909 divisible = 1;
5910 break;
5911 }
5912
5913 if (!divisible) //if it passes small primes check, then try a single Miller-Rabin base 2
5914 if (!millerRabinInt(s_n, 2)) //this line represents 75% of the total runtime for randTruePrime_
5915 divisible = 1;
5916
5917 if (!divisible) {
5918 //if it passes that test, continue checking s_n
5919 addInt_(s_n, -3);
5920 for (j = s_n.length - 1; s_n[j] == 0 && j > 0; j--); //strip leading zeros
5921 for (zz = 0, w = s_n[j]; w; w >>= 1, zz++);
5922 zz += bpe * j; //zz=number of bits in s_n, ignoring leading zeros
5923 for (;;) {
5924 //generate z-bit numbers until one falls in the range [0,s_n-1]
5925 randBigInt_(s_a, zz, 0);
5926 if (greater(s_n, s_a)) break;
5927 } //now s_a is in the range [0,s_n-1]
5928 addInt_(s_n, 3); //now s_a is in the range [0,s_n-4]
5929 addInt_(s_a, 2); //now s_a is in the range [2,s_n-2]
5930 copy_(s_b, s_a);
5931 copy_(s_n1, s_n);
5932 addInt_(s_n1, -1);
5933 powMod_(s_b, s_n1, s_n); //s_b=s_a^(s_n-1) modulo s_n
5934 addInt_(s_b, -1);
5935 if (isZero(s_b)) {
5936 copy_(s_b, s_a);
5937 powMod_(s_b, s_r2, s_n);
5938 addInt_(s_b, -1);
5939 copy_(s_aa, s_n);
5940 copy_(s_d, s_b);
5941 GCD_(s_d, s_n); //if s_b and s_n are relatively prime, then s_n is a prime
5942 if (equalsInt(s_d, 1)) {
5943 copy_(ans, s_aa);
5944 return; //if we've made it this far, then s_n is absolutely guaranteed to be prime
5945 }
5946 }
5947 }
5948 }
5949}
5950
5951//Return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1.
5952function randBigInt(n, s) {
5953 var a, b;
5954 a = Math.floor((n - 1) / bpe) + 2; //# array elements to hold the BigInt with a leading 0 element
5955 b = int2bigInt(0, 0, a);
5956 randBigInt_(b, n, s);
5957 return b;
5958}
5959
5960//Set b to an n-bit random BigInt. If s=1, then the most significant of those n bits is set to 1.
5961//Array b must be big enough to hold the result. Must have n>=1
5962function randBigInt_(b, n, s) {
5963 var i, a;
5964 for (i = 0; i < b.length; i++) b[i] = 0;
5965 a = Math.floor((n - 1) / bpe) + 1; //# array elements to hold the BigInt
5966 for (i = 0; i < a; i++) {
5967 b[i] = Math.floor(Math.random() * (1 << bpe - 1));
5968 }
5969 b[a - 1] &= (2 << (n - 1) % bpe) - 1;
5970 if (s == 1) b[a - 1] |= 1 << (n - 1) % bpe;
5971}
5972
5973//Return the greatest common divisor of bigInts x and y (each with same number of elements).
5974function GCD(x, y) {
5975 var xc, yc;
5976 xc = dup(x);
5977 yc = dup(y);
5978 GCD_(xc, yc);
5979 return xc;
5980}
5981
5982//set x to the greatest common divisor of bigInts x and y (each with same number of elements).
5983//y is destroyed.
5984function GCD_(x, y) {
5985 var i, xp, yp, A, B, C, D, q, sing;
5986 if (T.length != x.length) T = dup(x);
5987
5988 sing = 1;
5989 while (sing) {
5990 //while y has nonzero elements other than y[0]
5991 sing = 0;
5992 for (i = 1; i < y.length; i++) //check if y has nonzero elements other than 0
5993 if (y[i]) {
5994 sing = 1;
5995 break;
5996 }
5997 if (!sing) break; //quit when y all zero elements except possibly y[0]
5998
5999 for (i = x.length; !x[i] && i >= 0; i--); //find most significant element of x
6000 xp = x[i];
6001 yp = y[i];
6002 A = 1;B = 0;C = 0;D = 1;
6003 while (yp + C && yp + D) {
6004 q = Math.floor((xp + A) / (yp + C));
6005 qp = Math.floor((xp + B) / (yp + D));
6006 if (q != qp) break;
6007 t = A - q * C;A = C;C = t; // do (A,B,xp, C,D,yp) = (C,D,yp, A,B,xp) - q*(0,0,0, C,D,yp)
6008 t = B - q * D;B = D;D = t;
6009 t = xp - q * yp;xp = yp;yp = t;
6010 }
6011 if (B) {
6012 copy_(T, x);
6013 linComb_(x, y, A, B); //x=A*x+B*y
6014 linComb_(y, T, D, C); //y=D*y+C*T
6015 } else {
6016 mod_(x, y);
6017 copy_(T, x);
6018 copy_(x, y);
6019 copy_(y, T);
6020 }
6021 }
6022 if (y[0] == 0) return;
6023 t = modInt(x, y[0]);
6024 copyInt_(x, y[0]);
6025 y[0] = t;
6026 while (y[0]) {
6027 x[0] %= y[0];
6028 t = x[0];x[0] = y[0];y[0] = t;
6029 }
6030}
6031
6032//do x=x**(-1) mod n, for bigInts x and n.
6033//If no inverse exists, it sets x to zero and returns 0, else it returns 1.
6034//The x array must be at least as large as the n array.
6035function inverseMod_(x, n) {
6036 var k = 1 + 2 * Math.max(x.length, n.length);
6037
6038 if (!(x[0] & 1) && !(n[0] & 1)) {
6039 //if both inputs are even, then inverse doesn't exist
6040 copyInt_(x, 0);
6041 return 0;
6042 }
6043
6044 if (eg_u.length != k) {
6045 eg_u = new Array(k);
6046 eg_v = new Array(k);
6047 eg_A = new Array(k);
6048 eg_B = new Array(k);
6049 eg_C = new Array(k);
6050 eg_D = new Array(k);
6051 }
6052
6053 copy_(eg_u, x);
6054 copy_(eg_v, n);
6055 copyInt_(eg_A, 1);
6056 copyInt_(eg_B, 0);
6057 copyInt_(eg_C, 0);
6058 copyInt_(eg_D, 1);
6059 for (;;) {
6060 while (!(eg_u[0] & 1)) {
6061 //while eg_u is even
6062 halve_(eg_u);
6063 if (!(eg_A[0] & 1) && !(eg_B[0] & 1)) {
6064 //if eg_A==eg_B==0 mod 2
6065 halve_(eg_A);
6066 halve_(eg_B);
6067 } else {
6068 add_(eg_A, n);halve_(eg_A);
6069 sub_(eg_B, x);halve_(eg_B);
6070 }
6071 }
6072
6073 while (!(eg_v[0] & 1)) {
6074 //while eg_v is even
6075 halve_(eg_v);
6076 if (!(eg_C[0] & 1) && !(eg_D[0] & 1)) {
6077 //if eg_C==eg_D==0 mod 2
6078 halve_(eg_C);
6079 halve_(eg_D);
6080 } else {
6081 add_(eg_C, n);halve_(eg_C);
6082 sub_(eg_D, x);halve_(eg_D);
6083 }
6084 }
6085
6086 if (!greater(eg_v, eg_u)) {
6087 //eg_v <= eg_u
6088 sub_(eg_u, eg_v);
6089 sub_(eg_A, eg_C);
6090 sub_(eg_B, eg_D);
6091 } else {
6092 //eg_v > eg_u
6093 sub_(eg_v, eg_u);
6094 sub_(eg_C, eg_A);
6095 sub_(eg_D, eg_B);
6096 }
6097
6098 if (equalsInt(eg_u, 0)) {
6099 while (negative(eg_C)) //make sure answer is nonnegative
6100 add_(eg_C, n);
6101 copy_(x, eg_C);
6102
6103 if (!equalsInt(eg_v, 1)) {
6104 //if GCD_(x,n)!=1, then there is no inverse
6105 copyInt_(x, 0);
6106 return 0;
6107 }
6108 return 1;
6109 }
6110 }
6111}
6112
6113//return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
6114function inverseModInt(x, n) {
6115 var a = 1,
6116 b = 0,
6117 t;
6118 for (;;) {
6119 if (x == 1) return a;
6120 if (x == 0) return 0;
6121 b -= a * Math.floor(n / x);
6122 n %= x;
6123
6124 if (n == 1) return b; //to avoid negatives, change this b to n-b, and each -= to +=
6125 if (n == 0) return 0;
6126 a -= b * Math.floor(x / n);
6127 x %= n;
6128 }
6129}
6130
6131//this deprecated function is for backward compatibility only.
6132function inverseModInt_(x, n) {
6133 return inverseModInt(x, n);
6134}
6135
6136//Given positive bigInts x and y, change the bigints v, a, and b to positive bigInts such that:
6137// v = GCD_(x,y) = a*x-b*y
6138//The bigInts v, a, b, must have exactly as many elements as the larger of x and y.
6139function eGCD_(x, y, v, a, b) {
6140 var g = 0;
6141 var k = Math.max(x.length, y.length);
6142 if (eg_u.length != k) {
6143 eg_u = new Array(k);
6144 eg_A = new Array(k);
6145 eg_B = new Array(k);
6146 eg_C = new Array(k);
6147 eg_D = new Array(k);
6148 }
6149 while (!(x[0] & 1) && !(y[0] & 1)) {
6150 //while x and y both even
6151 halve_(x);
6152 halve_(y);
6153 g++;
6154 }
6155 copy_(eg_u, x);
6156 copy_(v, y);
6157 copyInt_(eg_A, 1);
6158 copyInt_(eg_B, 0);
6159 copyInt_(eg_C, 0);
6160 copyInt_(eg_D, 1);
6161 for (;;) {
6162 while (!(eg_u[0] & 1)) {
6163 //while u is even
6164 halve_(eg_u);
6165 if (!(eg_A[0] & 1) && !(eg_B[0] & 1)) {
6166 //if A==B==0 mod 2
6167 halve_(eg_A);
6168 halve_(eg_B);
6169 } else {
6170 add_(eg_A, y);halve_(eg_A);
6171 sub_(eg_B, x);halve_(eg_B);
6172 }
6173 }
6174
6175 while (!(v[0] & 1)) {
6176 //while v is even
6177 halve_(v);
6178 if (!(eg_C[0] & 1) && !(eg_D[0] & 1)) {
6179 //if C==D==0 mod 2
6180 halve_(eg_C);
6181 halve_(eg_D);
6182 } else {
6183 add_(eg_C, y);halve_(eg_C);
6184 sub_(eg_D, x);halve_(eg_D);
6185 }
6186 }
6187
6188 if (!greater(v, eg_u)) {
6189 //v<=u
6190 sub_(eg_u, v);
6191 sub_(eg_A, eg_C);
6192 sub_(eg_B, eg_D);
6193 } else {
6194 //v>u
6195 sub_(v, eg_u);
6196 sub_(eg_C, eg_A);
6197 sub_(eg_D, eg_B);
6198 }
6199 if (equalsInt(eg_u, 0)) {
6200 while (negative(eg_C)) {
6201 //make sure a (C) is nonnegative
6202 add_(eg_C, y);
6203 sub_(eg_D, x);
6204 }
6205 multInt_(eg_D, -1); ///make sure b (D) is nonnegative
6206 copy_(a, eg_C);
6207 copy_(b, eg_D);
6208 leftShift_(v, g);
6209 return;
6210 }
6211 }
6212}
6213
6214//is bigInt x negative?
6215function negative(x) {
6216 return x[x.length - 1] >> bpe - 1 & 1;
6217}
6218
6219//is (x << (shift*bpe)) > y?
6220//x and y are nonnegative bigInts
6221//shift is a nonnegative integer
6222function greaterShift(x, y, shift) {
6223 var i,
6224 kx = x.length,
6225 ky = y.length;
6226 k = kx + shift < ky ? kx + shift : ky;
6227 for (i = ky - 1 - shift; i < kx && i >= 0; i++) if (x[i] > 0) return 1; //if there are nonzeros in x to the left of the first column of y, then x is bigger
6228 for (i = kx - 1 + shift; i < ky; i++) if (y[i] > 0) return 0; //if there are nonzeros in y to the left of the first column of x, then x is not bigger
6229 for (i = k - 1; i >= shift; i--) if (x[i - shift] > y[i]) return 1;else if (x[i - shift] < y[i]) return 0;
6230 return 0;
6231}
6232
6233//is x > y? (x and y both nonnegative)
6234function greater(x, y) {
6235 var i;
6236 var k = x.length < y.length ? x.length : y.length;
6237
6238 for (i = x.length; i < y.length; i++) if (y[i]) return 0; //y has more digits
6239
6240 for (i = y.length; i < x.length; i++) if (x[i]) return 1; //x has more digits
6241
6242 for (i = k - 1; i >= 0; i--) if (x[i] > y[i]) return 1;else if (x[i] < y[i]) return 0;
6243 return 0;
6244}
6245
6246//divide x by y giving quotient q and remainder r. (q=floor(x/y), r=x mod y). All 4 are bigints.
6247//x must have at least one leading zero element.
6248//y must be nonzero.
6249//q and r must be arrays that are exactly the same length as x. (Or q can have more).
6250//Must have x.length >= y.length >= 2.
6251function divide_(x, y, q, r) {
6252 var kx, ky;
6253 var i, j, y1, y2, c, a, b;
6254 copy_(r, x);
6255 for (ky = y.length; y[ky - 1] == 0; ky--); //ky is number of elements in y, not including leading zeros
6256
6257 //normalize: ensure the most significant element of y has its highest bit set
6258 b = y[ky - 1];
6259 for (a = 0; b; a++) b >>= 1;
6260 a = bpe - a; //a is how many bits to shift so that the high order bit of y is leftmost in its array element
6261 leftShift_(y, a); //multiply both by 1<<a now, then divide both by that at the end
6262 leftShift_(r, a);
6263
6264 //Rob Visser discovered a bug: the following line was originally just before the normalization.
6265 for (kx = r.length; r[kx - 1] == 0 && kx > ky; kx--); //kx is number of elements in normalized x, not including leading zeros
6266
6267 copyInt_(q, 0); // q=0
6268 while (!greaterShift(y, r, kx - ky)) {
6269 // while (leftShift_(y,kx-ky) <= r) {
6270 subShift_(r, y, kx - ky); // r=r-leftShift_(y,kx-ky)
6271 q[kx - ky]++; // q[kx-ky]++;
6272 } // }
6273
6274 for (i = kx - 1; i >= ky; i--) {
6275 if (r[i] == y[ky - 1]) q[i - ky] = mask;else q[i - ky] = Math.floor((r[i] * radix + r[i - 1]) / y[ky - 1]);
6276
6277 //The following for(;;) loop is equivalent to the commented while loop,
6278 //except that the uncommented version avoids overflow.
6279 //The commented loop comes from HAC, which assumes r[-1]==y[-1]==0
6280 // while (q[i-ky]*(y[ky-1]*radix+y[ky-2]) > r[i]*radix*radix+r[i-1]*radix+r[i-2])
6281 // q[i-ky]--;
6282 for (;;) {
6283 y2 = (ky > 1 ? y[ky - 2] : 0) * q[i - ky];
6284 c = y2 >> bpe;
6285 y2 = y2 & mask;
6286 y1 = c + q[i - ky] * y[ky - 1];
6287 c = y1 >> bpe;
6288 y1 = y1 & mask;
6289
6290 if (c == r[i] ? y1 == r[i - 1] ? y2 > (i > 1 ? r[i - 2] : 0) : y1 > r[i - 1] : c > r[i]) q[i - ky]--;else break;
6291 }
6292
6293 linCombShift_(r, y, -q[i - ky], i - ky); //r=r-q[i-ky]*leftShift_(y,i-ky)
6294 if (negative(r)) {
6295 addShift_(r, y, i - ky); //r=r+leftShift_(y,i-ky)
6296 q[i - ky]--;
6297 }
6298 }
6299
6300 rightShift_(y, a); //undo the normalization step
6301 rightShift_(r, a); //undo the normalization step
6302}
6303
6304//do carries and borrows so each element of the bigInt x fits in bpe bits.
6305function carry_(x) {
6306 var i, k, c, b;
6307 k = x.length;
6308 c = 0;
6309 for (i = 0; i < k; i++) {
6310 c += x[i];
6311 b = 0;
6312 if (c < 0) {
6313 b = -(c >> bpe);
6314 c += b * radix;
6315 }
6316 x[i] = c & mask;
6317 c = (c >> bpe) - b;
6318 }
6319}
6320
6321//return x mod n for bigInt x and integer n.
6322function modInt(x, n) {
6323 var i,
6324 c = 0;
6325 for (i = x.length - 1; i >= 0; i--) c = (c * radix + x[i]) % n;
6326 return c;
6327}
6328
6329//convert the integer t into a bigInt with at least the given number of bits.
6330//the returned array stores the bigInt in bpe-bit chunks, little endian (buff[0] is least significant word)
6331//Pad the array with leading zeros so that it has at least minSize elements.
6332//There will always be at least one leading 0 element.
6333function int2bigInt(t, bits, minSize) {
6334 var i, k;
6335 k = Math.ceil(bits / bpe) + 1;
6336 k = minSize > k ? minSize : k;
6337 var buff = new Array(k);
6338 copyInt_(buff, t);
6339 return buff;
6340}
6341
6342//return the bigInt given a string representation in a given base.
6343//Pad the array with leading zeros so that it has at least minSize elements.
6344//If base=-1, then it reads in a space-separated list of array elements in decimal.
6345//The array will always have at least one leading zero, unless base=-1.
6346function str2bigInt(s, base, minSize) {
6347 var d, i, j, x, y, kk;
6348 var k = s.length;
6349 if (base == -1) {
6350 //comma-separated list of array elements in decimal
6351 x = new Array(0);
6352 for (;;) {
6353 y = new Array(x.length + 1);
6354 for (i = 0; i < x.length; i++) y[i + 1] = x[i];
6355 y[0] = parseInt(s, 10);
6356 x = y;
6357 d = s.indexOf(',', 0);
6358 if (d < 1) break;
6359 s = s.substring(d + 1);
6360 if (s.length == 0) break;
6361 }
6362 if (x.length < minSize) {
6363 y = new Array(minSize);
6364 copy_(y, x);
6365 return y;
6366 }
6367 return x;
6368 }
6369
6370 x = int2bigInt(0, base * k, 0);
6371 for (i = 0; i < k; i++) {
6372 d = digitsStr.indexOf(s.substring(i, i + 1), 0);
6373 if (base <= 36 && d >= 36) //convert lowercase to uppercase if base<=36
6374 d -= 26;
6375 if (d >= base || d < 0) {
6376 //stop at first illegal character
6377 break;
6378 }
6379 multInt_(x, base);
6380 addInt_(x, d);
6381 }
6382
6383 for (k = x.length; k > 0 && !x[k - 1]; k--); //strip off leading zeros
6384 k = minSize > k + 1 ? minSize : k + 1;
6385 y = new Array(k);
6386 kk = k < x.length ? k : x.length;
6387 for (i = 0; i < kk; i++) y[i] = x[i];
6388 for (; i < k; i++) y[i] = 0;
6389 return y;
6390}
6391
6392//is bigint x equal to integer y?
6393//y must have less than bpe bits
6394function equalsInt(x, y) {
6395 var i;
6396 if (x[0] != y) return 0;
6397 for (i = 1; i < x.length; i++) if (x[i]) return 0;
6398 return 1;
6399}
6400
6401//are bigints x and y equal?
6402//this works even if x and y are different lengths and have arbitrarily many leading zeros
6403function equals(x, y) {
6404 var i;
6405 var k = x.length < y.length ? x.length : y.length;
6406 for (i = 0; i < k; i++) if (x[i] != y[i]) return 0;
6407 if (x.length > y.length) {
6408 for (; i < x.length; i++) if (x[i]) return 0;
6409 } else {
6410 for (; i < y.length; i++) if (y[i]) return 0;
6411 }
6412 return 1;
6413}
6414
6415//is the bigInt x equal to zero?
6416function isZero(x) {
6417 var i;
6418 for (i = 0; i < x.length; i++) if (x[i]) return 0;
6419 return 1;
6420}
6421
6422//convert a bigInt into a string in a given base, from base 2 up to base 95.
6423//Base -1 prints the contents of the array representing the number.
6424function bigInt2str(x, base) {
6425 var i,
6426 t,
6427 s = "";
6428
6429 if (s6.length != x.length) s6 = dup(x);else copy_(s6, x);
6430
6431 if (base == -1) {
6432 //return the list of array contents
6433 for (i = x.length - 1; i > 0; i--) s += x[i] + ',';
6434 s += x[0];
6435 } else {
6436 //return it in the given base
6437 while (!isZero(s6)) {
6438 t = divInt_(s6, base); //t=s6 % base; s6=floor(s6/base);
6439 s = digitsStr.substring(t, t + 1) + s;
6440 }
6441 }
6442 if (s.length == 0) s = "0";
6443 return s;
6444}
6445
6446//returns a duplicate of bigInt x
6447function dup(x) {
6448 var i;
6449 buff = new Array(x.length);
6450 copy_(buff, x);
6451 return buff;
6452}
6453
6454//do x=y on bigInts x and y. x must be an array at least as big as y (not counting the leading zeros in y).
6455function copy_(x, y) {
6456 var i;
6457 var k = x.length < y.length ? x.length : y.length;
6458 for (i = 0; i < k; i++) x[i] = y[i];
6459 for (i = k; i < x.length; i++) x[i] = 0;
6460}
6461
6462//do x=y on bigInt x and integer y.
6463function copyInt_(x, n) {
6464 var i, c;
6465 for (c = n, i = 0; i < x.length; i++) {
6466 x[i] = c & mask;
6467 c >>= bpe;
6468 }
6469}
6470
6471//do x=x+n where x is a bigInt and n is an integer.
6472//x must be large enough to hold the result.
6473function addInt_(x, n) {
6474 var i, k, c, b;
6475 x[0] += n;
6476 k = x.length;
6477 c = 0;
6478 for (i = 0; i < k; i++) {
6479 c += x[i];
6480 b = 0;
6481 if (c < 0) {
6482 b = -(c >> bpe);
6483 c += b * radix;
6484 }
6485 x[i] = c & mask;
6486 c = (c >> bpe) - b;
6487 if (!c) return; //stop carrying as soon as the carry is zero
6488 }
6489}
6490
6491//right shift bigInt x by n bits. 0 <= n < bpe.
6492function rightShift_(x, n) {
6493 var i;
6494 var k = Math.floor(n / bpe);
6495 if (k) {
6496 for (i = 0; i < x.length - k; i++) //right shift x by k elements
6497 x[i] = x[i + k];
6498 for (; i < x.length; i++) x[i] = 0;
6499 n %= bpe;
6500 }
6501 for (i = 0; i < x.length - 1; i++) {
6502 x[i] = mask & (x[i + 1] << bpe - n | x[i] >> n);
6503 }
6504 x[i] >>= n;
6505}
6506
6507//do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement
6508function halve_(x) {
6509 var i;
6510 for (i = 0; i < x.length - 1; i++) {
6511 x[i] = mask & (x[i + 1] << bpe - 1 | x[i] >> 1);
6512 }
6513 x[i] = x[i] >> 1 | x[i] & radix >> 1; //most significant bit stays the same
6514}
6515
6516//left shift bigInt x by n bits.
6517function leftShift_(x, n) {
6518 var i;
6519 var k = Math.floor(n / bpe);
6520 if (k) {
6521 for (i = x.length; i >= k; i--) //left shift x by k elements
6522 x[i] = x[i - k];
6523 for (; i >= 0; i--) x[i] = 0;
6524 n %= bpe;
6525 }
6526 if (!n) return;
6527 for (i = x.length - 1; i > 0; i--) {
6528 x[i] = mask & (x[i] << n | x[i - 1] >> bpe - n);
6529 }
6530 x[i] = mask & x[i] << n;
6531}
6532
6533//do x=x*n where x is a bigInt and n is an integer.
6534//x must be large enough to hold the result.
6535function multInt_(x, n) {
6536 var i, k, c, b;
6537 if (!n) return;
6538 k = x.length;
6539 c = 0;
6540 for (i = 0; i < k; i++) {
6541 c += x[i] * n;
6542 b = 0;
6543 if (c < 0) {
6544 b = -(c >> bpe);
6545 c += b * radix;
6546 }
6547 x[i] = c & mask;
6548 c = (c >> bpe) - b;
6549 }
6550}
6551
6552//do x=floor(x/n) for bigInt x and integer n, and return the remainder
6553function divInt_(x, n) {
6554 var i,
6555 r = 0,
6556 s;
6557 for (i = x.length - 1; i >= 0; i--) {
6558 s = r * radix + x[i];
6559 x[i] = Math.floor(s / n);
6560 r = s % n;
6561 }
6562 return r;
6563}
6564
6565//do the linear combination x=a*x+b*y for bigInts x and y, and integers a and b.
6566//x must be large enough to hold the answer.
6567function linComb_(x, y, a, b) {
6568 var i, c, k, kk;
6569 k = x.length < y.length ? x.length : y.length;
6570 kk = x.length;
6571 for (c = 0, i = 0; i < k; i++) {
6572 c += a * x[i] + b * y[i];
6573 x[i] = c & mask;
6574 c >>= bpe;
6575 }
6576 for (i = k; i < kk; i++) {
6577 c += a * x[i];
6578 x[i] = c & mask;
6579 c >>= bpe;
6580 }
6581}
6582
6583//do the linear combination x=a*x+b*(y<<(ys*bpe)) for bigInts x and y, and integers a, b and ys.
6584//x must be large enough to hold the answer.
6585function linCombShift_(x, y, b, ys) {
6586 var i, c, k, kk;
6587 k = x.length < ys + y.length ? x.length : ys + y.length;
6588 kk = x.length;
6589 for (c = 0, i = ys; i < k; i++) {
6590 c += x[i] + b * y[i - ys];
6591 x[i] = c & mask;
6592 c >>= bpe;
6593 }
6594 for (i = k; c && i < kk; i++) {
6595 c += x[i];
6596 x[i] = c & mask;
6597 c >>= bpe;
6598 }
6599}
6600
6601//do x=x+(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys.
6602//x must be large enough to hold the answer.
6603function addShift_(x, y, ys) {
6604 var i, c, k, kk;
6605 k = x.length < ys + y.length ? x.length : ys + y.length;
6606 kk = x.length;
6607 for (c = 0, i = ys; i < k; i++) {
6608 c += x[i] + y[i - ys];
6609 x[i] = c & mask;
6610 c >>= bpe;
6611 }
6612 for (i = k; c && i < kk; i++) {
6613 c += x[i];
6614 x[i] = c & mask;
6615 c >>= bpe;
6616 }
6617}
6618
6619//do x=x-(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys.
6620//x must be large enough to hold the answer.
6621function subShift_(x, y, ys) {
6622 var i, c, k, kk;
6623 k = x.length < ys + y.length ? x.length : ys + y.length;
6624 kk = x.length;
6625 for (c = 0, i = ys; i < k; i++) {
6626 c += x[i] - y[i - ys];
6627 x[i] = c & mask;
6628 c >>= bpe;
6629 }
6630 for (i = k; c && i < kk; i++) {
6631 c += x[i];
6632 x[i] = c & mask;
6633 c >>= bpe;
6634 }
6635}
6636
6637//do x=x-y for bigInts x and y.
6638//x must be large enough to hold the answer.
6639//negative answers will be 2s complement
6640function sub_(x, y) {
6641 var i, c, k, kk;
6642 k = x.length < y.length ? x.length : y.length;
6643 for (c = 0, i = 0; i < k; i++) {
6644 c += x[i] - y[i];
6645 x[i] = c & mask;
6646 c >>= bpe;
6647 }
6648 for (i = k; c && i < x.length; i++) {
6649 c += x[i];
6650 x[i] = c & mask;
6651 c >>= bpe;
6652 }
6653}
6654
6655//do x=x+y for bigInts x and y.
6656//x must be large enough to hold the answer.
6657function add_(x, y) {
6658 var i, c, k, kk;
6659 k = x.length < y.length ? x.length : y.length;
6660 for (c = 0, i = 0; i < k; i++) {
6661 c += x[i] + y[i];
6662 x[i] = c & mask;
6663 c >>= bpe;
6664 }
6665 for (i = k; c && i < x.length; i++) {
6666 c += x[i];
6667 x[i] = c & mask;
6668 c >>= bpe;
6669 }
6670}
6671
6672//do x=x*y for bigInts x and y. This is faster when y<x.
6673function mult_(x, y) {
6674 var i;
6675 if (ss.length != 2 * x.length) ss = new Array(2 * x.length);
6676 copyInt_(ss, 0);
6677 for (i = 0; i < y.length; i++) if (y[i]) linCombShift_(ss, x, y[i], i); //ss=1*ss+y[i]*(x<<(i*bpe))
6678 copy_(x, ss);
6679}
6680
6681//do x=x mod n for bigInts x and n.
6682function mod_(x, n) {
6683 if (s4.length != x.length) s4 = dup(x);else copy_(s4, x);
6684 if (s5.length != x.length) s5 = dup(x);
6685 divide_(s4, n, s5, x); //x = remainder of s4 / n
6686}
6687
6688//do x=x*y mod n for bigInts x,y,n.
6689//for greater speed, let y<x.
6690function multMod_(x, y, n) {
6691 var i;
6692 if (s0.length != 2 * x.length) s0 = new Array(2 * x.length);
6693 copyInt_(s0, 0);
6694 for (i = 0; i < y.length; i++) if (y[i]) linCombShift_(s0, x, y[i], i); //s0=1*s0+y[i]*(x<<(i*bpe))
6695 mod_(s0, n);
6696 copy_(x, s0);
6697}
6698
6699//do x=x*x mod n for bigInts x,n.
6700function squareMod_(x, n) {
6701 var i, j, d, c, kx, kn, k;
6702 for (kx = x.length; kx > 0 && !x[kx - 1]; kx--); //ignore leading zeros in x
6703 k = kx > n.length ? 2 * kx : 2 * n.length; //k=# elements in the product, which is twice the elements in the larger of x and n
6704 if (s0.length != k) s0 = new Array(k);
6705 copyInt_(s0, 0);
6706 for (i = 0; i < kx; i++) {
6707 c = s0[2 * i] + x[i] * x[i];
6708 s0[2 * i] = c & mask;
6709 c >>= bpe;
6710 for (j = i + 1; j < kx; j++) {
6711 c = s0[i + j] + 2 * x[i] * x[j] + c;
6712 s0[i + j] = c & mask;
6713 c >>= bpe;
6714 }
6715 s0[i + kx] = c;
6716 }
6717 mod_(s0, n);
6718 copy_(x, s0);
6719}
6720
6721//return x with exactly k leading zero elements
6722function trim(x, k) {
6723 var i, y;
6724 for (i = x.length; i > 0 && !x[i - 1]; i--);
6725 y = new Array(i + k);
6726 copy_(y, x);
6727 return y;
6728}
6729
6730//do x=x**y mod n, where x,y,n are bigInts and ** is exponentiation. 0**0=1.
6731//this is faster when n is odd. x usually needs to have as many elements as n.
6732function powMod_(x, y, n) {
6733 var k1, k2, kn, np;
6734 if (s7.length != n.length) s7 = dup(n);
6735
6736 //for even modulus, use a simple square-and-multiply algorithm,
6737 //rather than using the more complex Montgomery algorithm.
6738 if ((n[0] & 1) == 0) {
6739 copy_(s7, x);
6740 copyInt_(x, 1);
6741 while (!equalsInt(y, 0)) {
6742 if (y[0] & 1) multMod_(x, s7, n);
6743 divInt_(y, 2);
6744 squareMod_(s7, n);
6745 }
6746 return;
6747 }
6748
6749 //calculate np from n for the Montgomery multiplications
6750 copyInt_(s7, 0);
6751 for (kn = n.length; kn > 0 && !n[kn - 1]; kn--);
6752 np = radix - inverseModInt(modInt(n, radix), radix);
6753 s7[kn] = 1;
6754 multMod_(x, s7, n); // x = x * 2**(kn*bp) mod n
6755
6756 if (s3.length != x.length) s3 = dup(x);else copy_(s3, x);
6757
6758 for (k1 = y.length - 1; k1 > 0 & !y[k1]; k1--); //k1=first nonzero element of y
6759 if (y[k1] == 0) {
6760 //anything to the 0th power is 1
6761 copyInt_(x, 1);
6762 return;
6763 }
6764 for (k2 = 1 << bpe - 1; k2 && !(y[k1] & k2); k2 >>= 1); //k2=position of first 1 bit in y[k1]
6765 for (;;) {
6766 if (!(k2 >>= 1)) {
6767 //look at next bit of y
6768 k1--;
6769 if (k1 < 0) {
6770 mont_(x, one, n, np);
6771 return;
6772 }
6773 k2 = 1 << bpe - 1;
6774 }
6775 mont_(x, x, n, np);
6776
6777 if (k2 & y[k1]) //if next bit is a 1
6778 mont_(x, s3, n, np);
6779 }
6780}
6781
6782//do x=x*y*Ri mod n for bigInts x,y,n,
6783// where Ri = 2**(-kn*bpe) mod n, and kn is the
6784// number of elements in the n array, not
6785// counting leading zeros.
6786//x array must have at least as many elemnts as the n array
6787//It's OK if x and y are the same variable.
6788//must have:
6789// x,y < n
6790// n is odd
6791// np = -(n^(-1)) mod radix
6792function mont_(x, y, n, np) {
6793 var i, j, c, ui, t, ks;
6794 var kn = n.length;
6795 var ky = y.length;
6796
6797 if (sa.length != kn) sa = new Array(kn);
6798
6799 copyInt_(sa, 0);
6800
6801 for (; kn > 0 && n[kn - 1] == 0; kn--); //ignore leading zeros of n
6802 for (; ky > 0 && y[ky - 1] == 0; ky--); //ignore leading zeros of y
6803 ks = sa.length - 1; //sa will never have more than this many nonzero elements.
6804
6805 //the following loop consumes 95% of the runtime for randTruePrime_() and powMod_() for large numbers
6806 for (i = 0; i < kn; i++) {
6807 t = sa[0] + x[i] * y[0];
6808 ui = (t & mask) * np & mask; //the inner "& mask" was needed on Safari (but not MSIE) at one time
6809 c = t + ui * n[0] >> bpe;
6810 t = x[i];
6811
6812 //do sa=(sa+x[i]*y+ui*n)/b where b=2**bpe. Loop is unrolled 5-fold for speed
6813 j = 1;
6814 for (; j < ky - 4;) {
6815 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6816 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6817 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6818 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6819 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6820 }
6821 for (; j < ky;) {
6822 c += sa[j] + ui * n[j] + t * y[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6823 }
6824 for (; j < kn - 4;) {
6825 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6826 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6827 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6828 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6829 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6830 }
6831 for (; j < kn;) {
6832 c += sa[j] + ui * n[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6833 }
6834 for (; j < ks;) {
6835 c += sa[j];sa[j - 1] = c & mask;c >>= bpe;j++;
6836 }
6837 sa[j - 1] = c & mask;
6838 }
6839
6840 if (!greater(n, sa)) sub_(sa, n);
6841 copy_(x, sa);
6842}
6843
6844/***/ }),
6845/* 29 */
6846/***/ (function(module, __webpack_exports__, __webpack_require__) {
6847
6848"use strict";
6849/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(2);
6850/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
6851/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda__ = __webpack_require__(3);
6852/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_ramda__);
6853/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__defer__ = __webpack_require__(4);
6854/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__switch__ = __webpack_require__(33);
6855/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__time_manager__ = __webpack_require__(5);
6856
6857
6858
6859
6860
6861
6862
6863
6864const cachedExportPromise = {};
6865
6866const protect = ({ code = NaN, type = '' }, { rawError = null }, dcID, baseDcID) => ({
6867 base: baseDcID,
6868 errR: rawError,
6869 code,
6870 type,
6871 dcID
6872});
6873
6874const patterns = {
6875 noBaseAuth: ({ code, dcID, base }) => code === 401 && dcID === base,
6876 noDcAuth: ({ code, dcID, base }) => code === 401 && dcID !== base,
6877 migrate: ({ code }) => code === 303,
6878 floodWait: ({ code, errR }) => !errR && code === 420,
6879 waitFail: ({ code, type, errR }) => !errR && (code === 500 || type === 'MSG_WAIT_FAILED'),
6880 _: () => true
6881};
6882
6883const matchProtect = matched => (error, options, emit, rejectPromise, requestThunk, apiSavedNet, apiRecall, deferResolve, mtpInvokeApi, mtpGetNetworker, storage) => matched({
6884 invoke: mtpInvokeApi,
6885 throwNext: () => rejectPromise(error),
6886 reject: rejectPromise,
6887 getNet: mtpGetNetworker,
6888 error,
6889 options,
6890 emit,
6891 requestThunk,
6892 apiRecall,
6893 deferResolve,
6894 apiSavedNet,
6895 storage
6896});
6897
6898const noBaseAuth = ({ emit, throwNext, storage }) => {
6899 storage.remove('dc', 'user_auth');
6900 emit('error.401.base');
6901 throwNext();
6902};
6903
6904const noDcAuth = ({ dcID, reject, apiSavedNet, apiRecall, deferResolve, invoke }) => {
6905 const importAuth = ({ id, bytes }) => invoke('auth.importAuthorization', { id, bytes }, { dcID, noErrorBox: true });
6906
6907 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["isNil"])(cachedExportPromise[dcID])) {
6908 const exportDeferred = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__defer__["b" /* default */])();
6909
6910 invoke('auth.exportAuthorization', { dc_id: dcID }, { noErrorBox: true }).then(importAuth).then(exportDeferred.resolve).catch(exportDeferred.reject);
6911
6912 cachedExportPromise[dcID] = exportDeferred.promise;
6913 }
6914
6915 cachedExportPromise[dcID].then(apiSavedNet).then(apiRecall).then(deferResolve).catch(reject);
6916};
6917
6918const migrate = ({ error, dcID, options, reject,
6919 apiRecall, deferResolve, getNet, storage
6920}) => {
6921 const newDcID = error.type.match(/^(PHONE_MIGRATE_|NETWORK_MIGRATE_|USER_MIGRATE_)(\d+)/)[2];
6922 if (newDcID === dcID) return;
6923 if (options.dcID) options.dcID = newDcID;else storage.set({ dc: /*baseDcID =*/newDcID });
6924
6925 getNet(newDcID, options).then(apiRecall).then(deferResolve).catch(reject);
6926};
6927
6928const floodWait = ({ error, options, throwNext, requestThunk }) => {
6929 const waitTime = error.type.match(/^FLOOD_WAIT_(\d+)/)[1] || 10;
6930 if (waitTime > (options.timeout || 60)) return throwNext();
6931 requestThunk(waitTime);
6932};
6933
6934const waitFail = ({ options, throwNext, requestThunk }) => {
6935 const now = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__time_manager__["tsNow"])();
6936 if (options.stopTime) {
6937 if (now >= options.stopTime) return throwNext();
6938 } else options.stopTime = now + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["propOr"])(10, 'timeout', options) * 1000;
6939 options.waitTime = options.waitTime ? Math.min(60, options.waitTime * 1.5) : 1;
6940 requestThunk(options.waitTime);
6941};
6942
6943const def = ({ throwNext }) => throwNext();
6944
6945const switchErrors = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__switch__["a" /* default */])(patterns, protect)({
6946 noBaseAuth,
6947 noDcAuth,
6948 migrate,
6949 floodWait,
6950 waitFail,
6951 _: def
6952}, matchProtect);
6953/* harmony export (immutable) */ __webpack_exports__["a"] = switchErrors;
6954
6955
6956/***/ }),
6957/* 30 */
6958/***/ (function(module, __webpack_exports__, __webpack_require__) {
6959
6960"use strict";
6961/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(2);
6962/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
6963/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_jsbn__ = __webpack_require__(14);
6964/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_jsbn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_jsbn__);
6965/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__defer__ = __webpack_require__(4);
6966/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__smart_timeout__ = __webpack_require__(8);
6967/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__crypto__ = __webpack_require__(9);
6968/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__secure_random__ = __webpack_require__(11);
6969/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__time_manager__ = __webpack_require__(5);
6970/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__bin__ = __webpack_require__(0);
6971/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__send_plain_req__ = __webpack_require__(31);
6972
6973
6974const { BigInteger } = __WEBPACK_IMPORTED_MODULE_1_jsbn___default.a;
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985// import { ErrorBadResponse } from '../../error'
6986
6987
6988
6989const primeHex = 'c71caeb9c6b1c9048e6c522f70f13f73980d40238e3e21c14934d037563d93' + '0f48198a0aa7c14058229493d22530f4dbfa336f6e0ac925139543aed44cce7c3720fd51f6945' + '8705ac68cd4fe6b6b13abdc9746512969328454f18faf8c595f642477fe96bb2a941d5bcd1d4a' + 'c8cc49880708fa9b378e3c4f3a9060bee67cf9a4a4a695811051907e162753b56b0f6b410dba7' + '4d8a84b2a14b3144e0ef1284754fd17ed950d5965b4b9dd46582db1178d169c6bc465b0d6ff9c' + 'a3928fef5b9ae4e418fc15e83ebea0f87fa9ff5eed70050ded2849f47bf959d956850ce929851' + 'f0d8115f635b105ee2e4e15d04b2454bf6f4fadf034b10403119cd8e3b92fcc5b';
6990
6991const Auth = ({ Serialization, Deserialization }, { select, prepare }) => {
6992 const sendPlainReq = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__send_plain_req__["a" /* default */])({ Serialization, Deserialization });
6993
6994 function mtpSendReqPQ(auth) {
6995 const deferred = auth.deferred;
6996 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["dTime"])(), 'Send req_pq', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["f" /* bytesToHex */])(auth.nonce));
6997
6998 const request = new Serialization({ mtproto: true });
6999
7000 request.storeMethod('req_pq', { nonce: auth.nonce });
7001
7002 const keyFoundCheck = key => key ? auth.publicKey = key : __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(new Error('[MT] No public key found'));
7003
7004 const factorizeThunk = () => __WEBPACK_IMPORTED_MODULE_4__crypto__["b" /* default */].factorize(auth.pq);
7005
7006 const factDone = ([p, q, it]) => {
7007 auth.p = p;
7008 auth.q = q;
7009 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["dTime"])(), 'PQ factorization done', it);
7010 mtpSendReqDhParams(auth);
7011 };
7012
7013 const factFail = error => {
7014 console.log('Worker error', error, error.stack);
7015 deferred.reject(error);
7016 };
7017
7018 const factorizer = deserializer => {
7019 const response = deserializer.fetchObject('ResPQ');
7020
7021 if (response._ !== 'resPQ') throw new Error(`[MT] resPQ response invalid: ${response._}`);
7022
7023 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(auth.nonce, response.nonce)) throw new Error('[MT] resPQ nonce mismatch');
7024
7025 auth.serverNonce = response.server_nonce;
7026 auth.pq = response.pq;
7027 auth.fingerprints = response.server_public_key_fingerprints;
7028
7029 // console.log(dTime(), 'Got ResPQ', bytesToHex(auth.serverNonce), bytesToHex(auth.pq), auth.fingerprints)
7030
7031 select(auth.fingerprints).then(keyFoundCheck).then(factorizeThunk).then(factDone, factFail);
7032
7033 // console.log(dTime(), 'PQ factorization start', auth.pq)
7034 };
7035
7036 const sendPlainThunk = () => sendPlainReq(auth.dcUrl, request.getBuffer());
7037
7038 return prepare().then(sendPlainThunk).then(factorizer, error => {
7039 console.error(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["dTime"])(), 'req_pq error', error.message);
7040 deferred.reject(error);
7041 });
7042 }
7043
7044 function mtpSendReqDhParams(auth) {
7045 const deferred = auth.deferred;
7046
7047 auth.newNonce = new Array(32);
7048 __WEBPACK_IMPORTED_MODULE_5__secure_random__["a" /* default */].nextBytes(auth.newNonce);
7049
7050 const data = new Serialization({ mtproto: true });
7051 data.storeObject({
7052 _: 'p_q_inner_data',
7053 pq: auth.pq,
7054 p: auth.p,
7055 q: auth.q,
7056 nonce: auth.nonce,
7057 server_nonce: auth.serverNonce,
7058 new_nonce: auth.newNonce
7059 }, 'P_Q_inner_data', 'DECRYPTED_DATA');
7060
7061 const dataWithHash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(data.getBuffer()).concat(data.getBytes());
7062
7063 const request = new Serialization({ mtproto: true });
7064 request.storeMethod('req_DH_params', {
7065 nonce: auth.nonce,
7066 server_nonce: auth.serverNonce,
7067 p: auth.p,
7068 q: auth.q,
7069 public_key_fingerprint: auth.publicKey.fingerprint,
7070 encrypted_data: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["v" /* rsaEncrypt */])(auth.publicKey, dataWithHash)
7071 });
7072
7073 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["dTime"])(), 'Send req_DH_params');
7074 sendPlainReq(auth.dcUrl, request.getBuffer()).then(deserializer => {
7075 const response = deserializer.fetchObject('Server_DH_Params', 'RESPONSE');
7076
7077 if (response._ !== 'server_DH_params_fail' && response._ !== 'server_DH_params_ok') {
7078 deferred.reject(new Error(`[MT] Server_DH_Params response invalid: ${response._}`));
7079 return false;
7080 }
7081
7082 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(auth.nonce, response.nonce)) {
7083 deferred.reject(new Error('[MT] Server_DH_Params nonce mismatch'));
7084 return false;
7085 }
7086
7087 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(auth.serverNonce, response.server_nonce)) {
7088 deferred.reject(new Error('[MT] Server_DH_Params server_nonce mismatch'));
7089 return false;
7090 }
7091
7092 if (response._ == 'server_DH_params_fail') {
7093 const newNonceHash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(auth.newNonce).slice(-16);
7094 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(newNonceHash, response.new_nonce_hash)) {
7095 deferred.reject(new Error('[MT] server_DH_params_fail new_nonce_hash mismatch'));
7096 return false;
7097 }
7098 deferred.reject(new Error('[MT] server_DH_params_fail'));
7099 return false;
7100 }
7101
7102 try {
7103 mtpDecryptServerDhDataAnswer(auth, response.encrypted_answer);
7104 } catch (e) {
7105 deferred.reject(e);
7106 return false;
7107 }
7108
7109 mtpSendSetClientDhParams(auth);
7110 }, deferred.reject);
7111 }
7112
7113 function mtpDecryptServerDhDataAnswer(auth, encryptedAnswer) {
7114 auth.localTime = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["tsNow"])();
7115
7116 auth.tmpAesKey = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(auth.newNonce.concat(auth.serverNonce)).concat(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(auth.serverNonce.concat(auth.newNonce)).slice(0, 12));
7117 auth.tmpAesIv = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(auth.serverNonce.concat(auth.newNonce)).slice(12).concat(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])([].concat(auth.newNonce, auth.newNonce)), auth.newNonce.slice(0, 4));
7118
7119 const answerWithHash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["p" /* aesDecryptSync */])(encryptedAnswer, auth.tmpAesKey, auth.tmpAesIv);
7120
7121 const hash = answerWithHash.slice(0, 20);
7122 const answerWithPadding = answerWithHash.slice(20);
7123 const buffer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["h" /* bytesToArrayBuffer */])(answerWithPadding);
7124
7125 const deserializer = new Deserialization(buffer, { mtproto: true });
7126 const response = deserializer.fetchObject('Server_DH_inner_data');
7127
7128 if (response._ != 'server_DH_inner_data') throw new Error(`[MT] server_DH_inner_data response invalid: ${constructor}`);
7129
7130 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(auth.nonce, response.nonce)) throw new Error('[MT] server_DH_inner_data nonce mismatch');
7131
7132 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(auth.serverNonce, response.server_nonce)) throw new Error('[MT] server_DH_inner_data serverNonce mismatch');
7133
7134 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["dTime"])(), 'Done decrypting answer');
7135 auth.g = response.g;
7136 auth.dhPrime = response.dh_prime;
7137 auth.gA = response.g_a;
7138 auth.serverTime = response.server_time;
7139 auth.retry = 0;
7140
7141 mtpVerifyDhParams(auth.g, auth.dhPrime, auth.gA);
7142
7143 const offset = deserializer.getOffset();
7144
7145 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(hash, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(answerWithPadding.slice(0, offset)))) {
7146 throw new Error('[MT] server_DH_inner_data SHA1-hash mismatch');
7147 }
7148
7149 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["applyServerTime"])(auth.serverTime, auth.localTime);
7150 }
7151
7152 function mtpVerifyDhParams(g, dhPrime, gA) {
7153 // console.log(dTime(), 'Verifying DH params')
7154 const dhPrimeHex = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["f" /* bytesToHex */])(dhPrime);
7155 if (g !== 3 || dhPrimeHex !== primeHex)
7156 // The verified value is from https://core.telegram.org/mtproto/security_guidelines
7157 throw new Error('[MT] DH params are not verified: unknown dhPrime');
7158 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["dTime"])(), 'dhPrime cmp OK');
7159
7160 const gABigInt = new BigInteger(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["f" /* bytesToHex */])(gA), 16);
7161 const dhPrimeBigInt = new BigInteger(dhPrimeHex, 16);
7162
7163 if (gABigInt.compareTo(BigInteger.ONE) <= 0) {
7164 throw new Error('[MT] DH params are not verified: gA <= 1');
7165 }
7166
7167 if (gABigInt.compareTo(dhPrimeBigInt.subtract(BigInteger.ONE)) >= 0) {
7168 throw new Error('[MT] DH params are not verified: gA >= dhPrime - 1');
7169 }
7170 // console.log(dTime(), '1 < gA < dhPrime-1 OK')
7171
7172
7173 const two = new BigInteger(null);
7174 two.fromInt(2);
7175 const twoPow = two.pow(2048 - 64);
7176
7177 if (gABigInt.compareTo(twoPow) < 0) {
7178 throw new Error('[MT] DH params are not verified: gA < 2^{2048-64}');
7179 }
7180 if (gABigInt.compareTo(dhPrimeBigInt.subtract(twoPow)) >= 0) {
7181 throw new Error('[MT] DH params are not verified: gA > dhPrime - 2^{2048-64}');
7182 }
7183 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["dTime"])(), '2^{2048-64} < gA < dhPrime-2^{2048-64} OK');
7184
7185 return true;
7186 }
7187
7188 function mtpSendSetClientDhParams(auth) {
7189 const deferred = auth.deferred;
7190 const gBytes = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["u" /* bytesFromHex */])(auth.g.toString(16));
7191
7192 auth.b = new Array(256);
7193 __WEBPACK_IMPORTED_MODULE_5__secure_random__["a" /* default */].nextBytes(auth.b);
7194
7195 const afterPlainRequest = deserializer => {
7196 const response = deserializer.fetchObject('Set_client_DH_params_answer');
7197
7198 if (response._ != 'dh_gen_ok' && response._ != 'dh_gen_retry' && response._ != 'dh_gen_fail') {
7199 deferred.reject(new Error(`[MT] Set_client_DH_params_answer response invalid: ${response._}`));
7200 return false;
7201 }
7202
7203 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(auth.nonce, response.nonce)) {
7204 deferred.reject(new Error('[MT] Set_client_DH_params_answer nonce mismatch'));
7205 return false;
7206 }
7207
7208 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(auth.serverNonce, response.server_nonce)) {
7209 deferred.reject(new Error('[MT] Set_client_DH_params_answer server_nonce mismatch'));
7210 return false;
7211 }
7212
7213 __WEBPACK_IMPORTED_MODULE_4__crypto__["b" /* default */].modPow(auth.gA, auth.b, auth.dhPrime).then(authKey => {
7214 const authKeyHash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(authKey),
7215 authKeyAux = authKeyHash.slice(0, 8),
7216 authKeyID = authKeyHash.slice(-8);
7217
7218 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["dTime"])(), 'Got Set_client_DH_params_answer', response._);
7219 switch (response._) {
7220 case 'dh_gen_ok':
7221 {
7222 const newNonceHash1 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(auth.newNonce.concat([1], authKeyAux)).slice(-16);
7223
7224 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(newNonceHash1, response.new_nonce_hash1)) {
7225 deferred.reject(new Error('[MT] Set_client_DH_params_answer new_nonce_hash1 mismatch'));
7226 return false;
7227 }
7228
7229 const serverSalt = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["w" /* bytesXor */])(auth.newNonce.slice(0, 8), auth.serverNonce.slice(0, 8));
7230 // console.log('Auth successfull!', authKeyID, authKey, serverSalt)
7231
7232 auth.authKeyID = authKeyID;
7233 auth.authKey = authKey;
7234 auth.serverSalt = serverSalt;
7235
7236 deferred.resolve(auth);
7237 break;
7238 }
7239 case 'dh_gen_retry':
7240 {
7241 const newNonceHash2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(auth.newNonce.concat([2], authKeyAux)).slice(-16);
7242 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(newNonceHash2, response.new_nonce_hash2)) {
7243 deferred.reject(new Error('[MT] Set_client_DH_params_answer new_nonce_hash2 mismatch'));
7244 return false;
7245 }
7246
7247 return mtpSendSetClientDhParams(auth);
7248 }
7249 case 'dh_gen_fail':
7250 {
7251 const newNonceHash3 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(auth.newNonce.concat([3], authKeyAux)).slice(-16);
7252 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["e" /* bytesCmp */])(newNonceHash3, response.new_nonce_hash3)) {
7253 deferred.reject(new Error('[MT] Set_client_DH_params_answer new_nonce_hash3 mismatch'));
7254 return false;
7255 }
7256
7257 deferred.reject(new Error('[MT] Set_client_DH_params_answer fail'));
7258 return false;
7259 }
7260 }
7261 }, deferred.reject);
7262 };
7263
7264 __WEBPACK_IMPORTED_MODULE_4__crypto__["b" /* default */].modPow(gBytes, auth.b, auth.dhPrime).then(gB => {
7265 const data = new Serialization({ mtproto: true });
7266 data.storeObject({
7267 _: 'client_DH_inner_data',
7268 nonce: auth.nonce,
7269 server_nonce: auth.serverNonce,
7270 retry_id: [0, auth.retry++],
7271 g_b: gB
7272 }, 'Client_DH_Inner_Data');
7273
7274 const dataWithHash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["d" /* sha1BytesSync */])(data.getBuffer()).concat(data.getBytes());
7275
7276 const encryptedData = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["o" /* aesEncryptSync */])(dataWithHash, auth.tmpAesKey, auth.tmpAesIv);
7277
7278 const request = new Serialization({ mtproto: true });
7279 request.storeMethod('set_client_DH_params', {
7280 nonce: auth.nonce,
7281 server_nonce: auth.serverNonce,
7282 encrypted_data: encryptedData
7283 });
7284
7285 console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__time_manager__["dTime"])(), 'Send set_client_DH_params');
7286 sendPlainReq(auth.dcUrl, request.getBuffer()).then(afterPlainRequest, deferred.reject);
7287 }, deferred.reject);
7288 }
7289
7290 function mtpAuth(dcID, cached, dcUrl) {
7291 if (cached[dcID]) return cached[dcID].promise;
7292 console.warn('mtpAuth');
7293 const nonce = [];
7294 for (let i = 0; i < 16; i++) nonce.push(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__bin__["l" /* nextRandomInt */])(0xFF));
7295
7296 if (!dcUrl) return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(new Error(`[MT] No server found for dc ${dcID} url ${dcUrl}`));
7297
7298 const auth = {
7299 dcID,
7300 dcUrl,
7301 nonce,
7302 deferred: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__defer__["b" /* default */])()
7303 };
7304
7305 __WEBPACK_IMPORTED_MODULE_3__smart_timeout__["a" /* smartTimeout */].immediate(() => mtpSendReqPQ(auth));
7306
7307 cached[dcID] = auth.deferred;
7308
7309 cached[dcID].promise.catch(() => {
7310 delete cached[dcID];
7311 });
7312
7313 return cached[dcID].promise;
7314 }
7315
7316 return mtpAuth;
7317};
7318/* unused harmony export Auth */
7319
7320/* harmony default export */ __webpack_exports__["a"] = Auth;
7321
7322/***/ }),
7323/* 31 */
7324/***/ (function(module, __webpack_exports__, __webpack_require__) {
7325
7326"use strict";
7327/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(2);
7328/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
7329/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda__ = __webpack_require__(3);
7330/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_ramda__);
7331/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__http__ = __webpack_require__(10);
7332/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__error__ = __webpack_require__(27);
7333/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__time_manager__ = __webpack_require__(5);
7334
7335
7336
7337
7338
7339
7340
7341const is404 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["pathEq"])(['response', 'status'], 404);
7342const notError = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["allPass"])([__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["has"])('message'), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["has"])('type')]);
7343
7344const SendPlain = ({ Serialization, Deserialization }) => {
7345 const onlySendPlainReq = (url, requestBuffer) => {
7346 const requestLength = requestBuffer.byteLength,
7347 requestArray = new Int32Array(requestBuffer);
7348
7349 const header = new Serialization();
7350 header.storeLongP(0, 0, 'auth_key_id'); // Auth key
7351 header.storeLong(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__time_manager__["generateID"])(), 'msg_id'); // Msg_id
7352 header.storeInt(requestLength, 'request_length');
7353
7354 const headerBuffer = header.getBuffer(),
7355 headerArray = new Int32Array(headerBuffer);
7356 const headerLength = headerBuffer.byteLength;
7357
7358 const resultBuffer = new ArrayBuffer(headerLength + requestLength),
7359 resultArray = new Int32Array(resultBuffer);
7360
7361 resultArray.set(headerArray);
7362 resultArray.set(requestArray, headerArray.length);
7363
7364 const requestData = resultArray;
7365 let reqPromise;
7366 try {
7367 reqPromise = __WEBPACK_IMPORTED_MODULE_2__http__["b" /* default */].post(url, requestData, {
7368 responseType: 'arraybuffer'
7369 });
7370 } catch (e) {
7371 reqPromise = __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(new __WEBPACK_IMPORTED_MODULE_3__error__["a" /* ErrorBadResponse */](url, e));
7372 }
7373 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.props({ url, req: reqPromise });
7374 };
7375
7376 const onlySendPlainErr = err => {
7377 let error;
7378 switch (true) {
7379 case is404(err):
7380 error = new __WEBPACK_IMPORTED_MODULE_3__error__["b" /* ErrorNotFound */](err);
7381 break;
7382 case notError(err):
7383 error = new __WEBPACK_IMPORTED_MODULE_3__error__["a" /* ErrorBadResponse */]('', err);
7384 break;
7385 default:
7386 error = err;
7387 }
7388 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(error);
7389 };
7390
7391 const onlySendPlainRes = ({ url, req }) => {
7392 if (!req.data || !req.data.byteLength) return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(new __WEBPACK_IMPORTED_MODULE_3__error__["a" /* ErrorBadResponse */](url));
7393 let deserializer;
7394 try {
7395 deserializer = new Deserialization(req.data, { mtproto: true });
7396 const auth_key_id = deserializer.fetchLong('auth_key_id');
7397 const msg_id = deserializer.fetchLong('msg_id');
7398 const msg_len = deserializer.fetchInt('msg_len');
7399 } catch (e) {
7400 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.reject(new __WEBPACK_IMPORTED_MODULE_3__error__["a" /* ErrorBadResponse */](url, e));
7401 }
7402
7403 return deserializer;
7404 };
7405
7406 const sendPlainReq = (url, requestBuffer) => onlySendPlainReq(url, requestBuffer).then(onlySendPlainRes, onlySendPlainErr);
7407
7408 return sendPlainReq;
7409};
7410
7411/* harmony default export */ __webpack_exports__["a"] = SendPlain;
7412
7413/***/ }),
7414/* 32 */
7415/***/ (function(module, __webpack_exports__, __webpack_require__) {
7416
7417"use strict";
7418/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird__ = __webpack_require__(2);
7419/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bluebird___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bluebird__);
7420/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__bin__ = __webpack_require__(0);
7421
7422
7423
7424/**
7425* Server public key, obtained from here: https://core.telegram.org/api/obtaining_api_id
7426*
7427* -----BEGIN RSA PUBLIC KEY-----
7428* MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6
7429* lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS
7430* an9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw
7431* Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+
7432* 8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n
7433* Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
7434* -----END RSA PUBLIC KEY-----
7435*/
7436
7437const publisKeysHex = [{
7438 //eslint-disable-next-line
7439 modulus: 'c150023e2f70db7985ded064759cfecf0af328e69a41daf4d6f01b538135a6f91f8f8b2a0ec9ba9720ce352efcf6c5680ffc424bd634864902de0b4bd6d49f4e580230e3ae97d95c8b19442b3c0a10d8f5633fecedd6926a7f6dab0ddb7d457f9ea81b8465fcd6fffeed114011df91c059caedaf97625f6c96ecc74725556934ef781d866b34f011fce4d835a090196e9a5f0e4449af7eb697ddb9076494ca5f81104a305b6dd27665722c46b60e5df680fb16b210607ef217652e60236c255f6a28315f4083a96791d7214bf64c1df4fd0db1944fb26a2a57031b32eee64ad15a8ba68885cde74a5bfc920f6abf59ba5c75506373e7130f9042da922179251f',
7440 exponent: '010001'
7441}];
7442
7443const publicKeysParsed = {};
7444let prepared = false;
7445
7446const KeyManager = Serialization => {
7447
7448 const mapPrepare = ({ modulus, exponent }) => {
7449 const RSAPublicKey = new Serialization();
7450 RSAPublicKey.storeBytes(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__bin__["u" /* bytesFromHex */])(modulus), 'n');
7451 RSAPublicKey.storeBytes(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__bin__["u" /* bytesFromHex */])(exponent), 'e');
7452
7453 const buffer = RSAPublicKey.getBuffer();
7454
7455 const fingerprintBytes = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__bin__["d" /* sha1BytesSync */])(buffer).slice(-8);
7456 fingerprintBytes.reverse();
7457
7458 publicKeysParsed[__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__bin__["f" /* bytesToHex */])(fingerprintBytes)] = {
7459 modulus,
7460 exponent
7461 };
7462 };
7463
7464 const setPrepared = () => {
7465 prepared = true;
7466 };
7467
7468 const prepareRsaKeys = () => {
7469 if (prepared) return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.resolve();
7470 return __WEBPACK_IMPORTED_MODULE_0_bluebird___default.a.map(publisKeysHex, mapPrepare).then(setPrepared);
7471 };
7472
7473 const selectRsaKey = fingerprints => () => {
7474 let fingerprintHex, foundKey;
7475 for (let i = 0; i < fingerprints.length; i++) {
7476 fingerprintHex = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__bin__["k" /* bigStringInt */])(fingerprints[i]).toString(16);
7477 foundKey = publicKeysParsed[fingerprintHex];
7478 if (foundKey) return Object.assign({ fingerprint: fingerprints[i] }, foundKey);
7479 }
7480
7481 return false;
7482 };
7483
7484 const selectRsaKeyByFingerPrint = fingerprints => prepareRsaKeys().then(selectRsaKey(fingerprints));
7485
7486 return {
7487 prepare: prepareRsaKeys,
7488 select: selectRsaKeyByFingerPrint
7489 };
7490};
7491/* unused harmony export KeyManager */
7492
7493
7494/* harmony default export */ __webpack_exports__["a"] = KeyManager;
7495
7496/***/ }),
7497/* 33 */
7498/***/ (function(module, __webpack_exports__, __webpack_require__) {
7499
7500"use strict";
7501const Switch = (patterns, protector = e => e) => (matches, mProtector = e => e) => (...data) => {
7502 const keyList = Object.keys(patterns);
7503 const normalized = protector(...data);
7504 for (const key of keyList) if (patterns[key](normalized)) return mProtector(matches[key]);
7505};
7506/* unused harmony export Switch */
7507
7508
7509/* harmony default export */ __webpack_exports__["a"] = Switch;
7510
7511/***/ }),
7512/* 34 */
7513/***/ (function(module, __webpack_exports__, __webpack_require__) {
7514
7515"use strict";
7516/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_detect_node__ = __webpack_require__(13);
7517/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_detect_node___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_detect_node__);
7518/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda__ = __webpack_require__(3);
7519/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ramda___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_ramda__);
7520/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bin__ = __webpack_require__(0);
7521
7522
7523
7524
7525const toUint32 = buf => {
7526 let ln, res;
7527 if (!__WEBPACK_IMPORTED_MODULE_0_detect_node___default.a) //TODO browser behavior not equals, why?
7528 return new Uint32Array(buf);
7529 if (buf.readUInt32LE) {
7530 ln = buf.byteLength / 4;
7531 res = new Uint32Array(ln);
7532 for (let i = 0; i < ln; i++) res[i] = buf.readUInt32LE(i * 4);
7533 } else {
7534 const data = new DataView(buf);
7535 ln = data.byteLength / 4;
7536 res = new Uint32Array(ln);
7537 for (let i = 0; i < ln; i++) res[i] = data.getUint32(i * 4, true);
7538 }
7539 return res;
7540};
7541
7542const TL = (api, mtApi) => {
7543
7544 class Serialization {
7545 constructor({ mtproto = false, startMaxLength = 2048 /* 2Kb */ } = {}) {
7546 this.storeIntString = (value, field) => {
7547 const valType = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["type"])(value);
7548 switch (true) {
7549 case __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(String, value):
7550 return this.storeString(value, field);
7551 case __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(Number, value):
7552 return this.storeInt(value, field);
7553 default:
7554 throw new Error(`tl storeIntString field ${field} value type ${valType}`);
7555 }
7556 };
7557
7558 this.storeInt = (i, field = '') => {
7559 this.writeInt(i, `${field}:int`);
7560 };
7561
7562 this.maxLength = startMaxLength;
7563 this.offset = 0; // in bytes
7564
7565 this.createBuffer();
7566 this.mtproto = mtproto;
7567 }
7568
7569 createBuffer() {
7570 this.buffer = new ArrayBuffer(this.maxLength);
7571 this.intView = new Int32Array(this.buffer);
7572 this.byteView = new Uint8Array(this.buffer);
7573 }
7574
7575 getArray() {
7576 const resultBuffer = new ArrayBuffer(this.offset);
7577 const resultArray = new Int32Array(resultBuffer);
7578
7579 resultArray.set(this.intView.subarray(0, this.offset / 4));
7580
7581 return resultArray;
7582 }
7583
7584 getBuffer() {
7585 return this.getArray().buffer;
7586 }
7587
7588 getBytes(typed) {
7589 if (typed) {
7590 const resultBuffer = new ArrayBuffer(this.offset);
7591 const resultArray = new Uint8Array(resultBuffer);
7592
7593 resultArray.set(this.byteView.subarray(0, this.offset));
7594
7595 return resultArray;
7596 }
7597
7598 const bytes = [];
7599 for (let i = 0; i < this.offset; i++) {
7600 bytes.push(this.byteView[i]);
7601 }
7602 return bytes;
7603 }
7604
7605 checkLength(needBytes) {
7606 if (this.offset + needBytes < this.maxLength) {
7607 return;
7608 }
7609
7610 console.trace('Increase buffer', this.offset, needBytes, this.maxLength);
7611 this.maxLength = Math.ceil(Math.max(this.maxLength * 2, this.offset + needBytes + 16) / 4) * 4;
7612 const previousBuffer = this.buffer;
7613 const previousArray = new Int32Array(previousBuffer);
7614
7615 this.createBuffer();
7616
7617 new Int32Array(this.buffer).set(previousArray);
7618 }
7619
7620 writeInt(i, field) {
7621 this.debug && console.log('>>>', i.toString(16), i, field);
7622
7623 this.checkLength(4);
7624 this.intView[this.offset / 4] = i;
7625 this.offset += 4;
7626 }
7627
7628 storeBool(i, field = '') {
7629 if (i) {
7630 this.writeInt(0x997275b5, `${field}:bool`);
7631 } else {
7632 this.writeInt(0xbc799737, `${field}:bool`);
7633 }
7634 }
7635
7636 storeLongP(iHigh, iLow, field) {
7637 this.writeInt(iLow, `${field}:long[low]`);
7638 this.writeInt(iHigh, `${field}:long[high]`);
7639 }
7640
7641 storeLong(sLong, field = '') {
7642 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(Array, sLong)) return sLong.length === 2 ? this.storeLongP(sLong[0], sLong[1], field) : this.storeIntBytes(sLong, 64, field);
7643
7644 if (typeof sLong !== 'string') sLong = sLong ? sLong.toString() : '0';
7645 const divRem = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["k" /* bigStringInt */])(sLong).divideAndRemainder(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["x" /* bigint */])(0x100000000));
7646
7647 this.writeInt(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["y" /* intToUint */])(divRem[1].intValue()), `${field}:long[low]`);
7648 this.writeInt(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["y" /* intToUint */])(divRem[0].intValue()), `${field}:long[high]`);
7649 }
7650
7651 storeDouble(f, field = '') {
7652 const buffer = new ArrayBuffer(8);
7653 const intView = new Int32Array(buffer);
7654 const doubleView = new Float64Array(buffer);
7655
7656 doubleView[0] = f;
7657
7658 this.writeInt(intView[0], `${field}:double[low]`);
7659 this.writeInt(intView[1], `${field}:double[high]`);
7660 }
7661
7662 storeString(s, field = '') {
7663 this.debug && console.log('>>>', s, `${field}:string`);
7664
7665 if (s === undefined) {
7666 s = '';
7667 }
7668 const sUTF8 = unescape(encodeURIComponent(s));
7669
7670 this.checkLength(sUTF8.length + 8);
7671
7672 const len = sUTF8.length;
7673 if (len <= 253) {
7674 this.byteView[this.offset++] = len;
7675 } else {
7676 this.byteView[this.offset++] = 254;
7677 this.byteView[this.offset++] = len & 0xFF;
7678 this.byteView[this.offset++] = (len & 0xFF00) >> 8;
7679 this.byteView[this.offset++] = (len & 0xFF0000) >> 16;
7680 }
7681 for (let i = 0; i < len; i++) {
7682 this.byteView[this.offset++] = sUTF8.charCodeAt(i);
7683 }
7684
7685 // Padding
7686 while (this.offset % 4) {
7687 this.byteView[this.offset++] = 0;
7688 }
7689 }
7690
7691 storeBytes(bytes, field = '') {
7692 if (bytes instanceof ArrayBuffer) {
7693 bytes = new Uint8Array(bytes);
7694 } else if (bytes === undefined) {
7695 bytes = [];
7696 }
7697 this.debug && console.log('>>>', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), `${field}:bytes`);
7698
7699 const len = bytes.byteLength || bytes.length;
7700 this.checkLength(len + 8);
7701 if (len <= 253) {
7702 this.byteView[this.offset++] = len;
7703 } else {
7704 this.byteView[this.offset++] = 254;
7705 this.byteView[this.offset++] = len & 0xFF;
7706 this.byteView[this.offset++] = (len & 0xFF00) >> 8;
7707 this.byteView[this.offset++] = (len & 0xFF0000) >> 16;
7708 }
7709
7710 this.byteView.set(bytes, this.offset);
7711 this.offset += len;
7712
7713 // Padding
7714 while (this.offset % 4) {
7715 this.byteView[this.offset++] = 0;
7716 }
7717 }
7718
7719 storeIntBytes(bytes, bits, field = '') {
7720 if (bytes instanceof ArrayBuffer) {
7721 bytes = new Uint8Array(bytes);
7722 }
7723 const len = bytes.length;
7724 if (bits % 32 || len * 8 != bits) {
7725 throw new Error(`Invalid bits: ${bits}, ${bytes.length}`);
7726 }
7727
7728 this.debug && console.log('>>>', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), `${field}:int${bits}`);
7729 this.checkLength(len);
7730
7731 this.byteView.set(bytes, this.offset);
7732 this.offset += len;
7733 }
7734
7735 storeRawBytes(bytes, field = '') {
7736 if (bytes instanceof ArrayBuffer) {
7737 bytes = new Uint8Array(bytes);
7738 }
7739 const len = bytes.length;
7740
7741 this.debug && console.log('>>>', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), field);
7742 this.checkLength(len);
7743
7744 this.byteView.set(bytes, this.offset);
7745 this.offset += len;
7746 }
7747
7748 storeMethod(methodName, params) {
7749 const schema = this.mtproto ? mtApi : api;
7750 let methodData = false;
7751
7752 for (let i = 0; i < schema.methods.length; i++) {
7753 if (schema.methods[i].method == methodName) {
7754 methodData = schema.methods[i];
7755 break;
7756 }
7757 }
7758 if (!methodData) {
7759 throw new Error(`No method ${methodName} found`);
7760 }
7761
7762 this.storeInt(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["y" /* intToUint */])(methodData.id), `${methodName}[id]`);
7763
7764 let param, type;
7765 let condType;
7766 let fieldBit;
7767 const len = methodData.params.length;
7768 for (let i = 0; i < len; i++) {
7769 param = methodData.params[i];
7770 type = param.type;
7771 if (type.indexOf('?') !== -1) {
7772 condType = type.split('?');
7773 fieldBit = condType[0].split('.');
7774 if (!(params[fieldBit[0]] & 1 << fieldBit[1])) {
7775 continue;
7776 }
7777 type = condType[1];
7778 }
7779
7780 this.storeObject(params[param.name], type, `${methodName}[${param.name}]`);
7781 }
7782
7783 return methodData.type;
7784 }
7785
7786 storeObject(obj, type, field) {
7787 switch (type) {
7788 case '#':
7789 case 'int':
7790 return this.storeInt(obj, field);
7791 case 'long':
7792 return this.storeLong(obj, field);
7793 case 'int128':
7794 return this.storeIntBytes(obj, 128, field);
7795 case 'int256':
7796 return this.storeIntBytes(obj, 256, field);
7797 case 'int512':
7798 return this.storeIntBytes(obj, 512, field);
7799 case 'string':
7800 return this.storeString(obj, field);
7801 case 'bytes':
7802 return this.storeBytes(obj, field);
7803 case 'double':
7804 return this.storeDouble(obj, field);
7805 case 'Bool':
7806 return this.storeBool(obj, field);
7807 case 'true':
7808 return;
7809 }
7810
7811 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(Array, obj)) {
7812 if (type.substr(0, 6) == 'Vector') {
7813 this.writeInt(0x1cb5c415, `${field}[id]`);
7814 } else if (type.substr(0, 6) != 'vector') {
7815 throw new Error(`Invalid vector type ${type}`);
7816 }
7817 const itemType = type.substr(7, type.length - 8); // for "Vector<itemType>"
7818 this.writeInt(obj.length, `${field}[count]`);
7819 for (let i = 0; i < obj.length; i++) {
7820 this.storeObject(obj[i], itemType, `${field}[${i}]`);
7821 }
7822 return true;
7823 } else if (type.substr(0, 6).toLowerCase() == 'vector') {
7824 throw new Error('Invalid vector object');
7825 }
7826
7827 if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["is"])(Object, obj)) throw new Error(`Invalid object for type ${type}`);
7828
7829 const schema = this.mtproto ? mtApi : api;
7830 const predicate = obj['_'];
7831 let isBare = false;
7832 let constructorData = false;
7833
7834 if (isBare = type.charAt(0) == '%') type = type.substr(1);
7835
7836 for (let i = 0; i < schema.constructors.length; i++) {
7837 if (schema.constructors[i].predicate == predicate) {
7838 constructorData = schema.constructors[i];
7839 break;
7840 }
7841 }
7842 if (!constructorData) throw new Error(`No predicate ${predicate} found`);
7843
7844 if (predicate == type) isBare = true;
7845
7846 if (!isBare) this.writeInt(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["y" /* intToUint */])(constructorData.id), `${field}[${predicate}][id]`);
7847
7848 let param;
7849 let condType;
7850 let fieldBit;
7851 const len = constructorData.params.length;
7852 for (let i = 0; i < len; i++) {
7853 param = constructorData.params[i];
7854 type = param.type;
7855 if (type.indexOf('?') !== -1) {
7856 condType = type.split('?');
7857 fieldBit = condType[0].split('.');
7858 if (!(obj[fieldBit[0]] & 1 << fieldBit[1])) {
7859 continue;
7860 }
7861 type = condType[1];
7862 }
7863
7864 this.storeObject(obj[param.name], type, `${field}[${predicate}][${param.name}]`);
7865 }
7866
7867 return constructorData.type;
7868 }
7869
7870 }
7871
7872 class Deserialization {
7873 constructor(buffer, { mtproto = false, override = {} } = {}) {
7874 this.offset = 0; // in bytes
7875 this.override = override;
7876
7877 this.buffer = buffer;
7878 this.intView = toUint32(this.buffer);
7879 this.byteView = new Uint8Array(this.buffer);
7880 this.mtproto = mtproto;
7881 }
7882
7883 readInt(field) {
7884 if (this.offset >= this.intView.length * 4) {
7885 throw new Error(`Nothing to fetch: ${field}`);
7886 }
7887
7888 const i = this.intView[this.offset / 4];
7889
7890 this.debug && console.log('<<<', i.toString(16), i, field);
7891
7892 this.offset += 4;
7893
7894 return i;
7895 }
7896
7897 fetchInt(field = '') {
7898 return this.readInt(`${field}:int`);
7899 }
7900
7901 fetchDouble(field = '') {
7902 const buffer = new ArrayBuffer(8);
7903 const intView = new Int32Array(buffer);
7904 const doubleView = new Float64Array(buffer);
7905
7906 intView[0] = this.readInt(`${field}:double[low]`), intView[1] = this.readInt(`${field}:double[high]`);
7907
7908 return doubleView[0];
7909 }
7910
7911 fetchLong(field = '') {
7912 const iLow = this.readInt(`${field}:long[low]`);
7913 const iHigh = this.readInt(`${field}:long[high]`);
7914
7915 const longDec = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["x" /* bigint */])(iHigh).shiftLeft(32).add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["x" /* bigint */])(iLow)).toString();
7916
7917 return longDec;
7918 }
7919
7920 fetchBool(field = '') {
7921 const i = this.readInt(`${field}:bool`);
7922 if (i == 0x997275b5) {
7923 return true;
7924 } else if (i == 0xbc799737) {
7925 return false;
7926 }
7927
7928 this.offset -= 4;
7929 return this.fetchObject('Object', field);
7930 }
7931
7932 fetchString(field = '') {
7933 let len = this.byteView[this.offset++];
7934
7935 if (len == 254) {
7936 len = this.byteView[this.offset++] | this.byteView[this.offset++] << 8 | this.byteView[this.offset++] << 16;
7937 }
7938
7939 let sUTF8 = '';
7940 for (let i = 0; i < len; i++) {
7941 sUTF8 += String.fromCharCode(this.byteView[this.offset++]);
7942 }
7943
7944 // Padding
7945 while (this.offset % 4) {
7946 this.offset++;
7947 }
7948 let s;
7949 try {
7950 s = decodeURIComponent(escape(sUTF8));
7951 } catch (e) {
7952 s = sUTF8;
7953 }
7954
7955 this.debug && console.log('<<<', s, `${field}:string`);
7956
7957 return s;
7958 }
7959
7960 fetchBytes(field = '') {
7961 let len = this.byteView[this.offset++];
7962
7963 if (len == 254) {
7964 len = this.byteView[this.offset++] | this.byteView[this.offset++] << 8 | this.byteView[this.offset++] << 16;
7965 }
7966
7967 const bytes = this.byteView.subarray(this.offset, this.offset + len);
7968 this.offset += len;
7969
7970 // Padding
7971 while (this.offset % 4) this.offset++;
7972
7973 this.debug && console.log('<<<', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), `${field}:bytes`);
7974
7975 return bytes;
7976 }
7977
7978 fetchIntBytes(bits, typed, field = '') {
7979 if (bits % 32) throw new Error(`Invalid bits: ${bits}`);
7980
7981 const len = bits / 8;
7982 if (typed) {
7983 const result = this.byteView.subarray(this.offset, this.offset + len);
7984 this.offset += len;
7985 return result;
7986 }
7987
7988 const bytes = [];
7989 for (let i = 0; i < len; i++) {
7990 bytes.push(this.byteView[this.offset++]);
7991 }
7992
7993 this.debug && console.log('<<<', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), `${field}:int${bits}`);
7994
7995 return bytes;
7996 }
7997
7998 fetchRawBytes(len, typed, field = '') {
7999 if (len === false) {
8000 len = this.readInt(`${field}_length`);
8001 if (len > this.byteView.byteLength) throw new Error(`Invalid raw bytes length: ${len}, buffer len: ${this.byteView.byteLength}`);
8002 }
8003 let bytes;
8004 if (typed) {
8005 bytes = new Uint8Array(len);
8006 bytes.set(this.byteView.subarray(this.offset, this.offset + len));
8007 this.offset += len;
8008 return bytes;
8009 }
8010
8011 bytes = [];
8012 for (let i = 0; i < len; i++) bytes.push(this.byteView[this.offset++]);
8013
8014 this.debug && console.log('<<<', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["f" /* bytesToHex */])(bytes), field);
8015
8016 return bytes;
8017 }
8018
8019 fetchObject(type, field) {
8020 switch (type) {
8021 case '#':
8022 case 'int':
8023 return this.fetchInt(field);
8024 case 'long':
8025 return this.fetchLong(field);
8026 case 'int128':
8027 return this.fetchIntBytes(128, false, field);
8028 case 'int256':
8029 return this.fetchIntBytes(256, false, field);
8030 case 'int512':
8031 return this.fetchIntBytes(512, false, field);
8032 case 'string':
8033 return this.fetchString(field);
8034 case 'bytes':
8035 return this.fetchBytes(field);
8036 case 'double':
8037 return this.fetchDouble(field);
8038 case 'Bool':
8039 return this.fetchBool(field);
8040 case 'true':
8041 return true;
8042 }
8043 let fallback;
8044 field = field || type || 'Object';
8045 const subpart = type.substr(0, 6);
8046 if (subpart === 'Vector' || subpart === 'vector') {
8047 if (type.charAt(0) === 'V') {
8048 const constructor = this.readInt(`${field}[id]`);
8049 const constructorCmp = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["j" /* uintToInt */])(constructor);
8050
8051 if (constructorCmp === 0x3072cfa1) {
8052 // Gzip packed
8053 const compressed = this.fetchBytes(`${field}[packed_string]`);
8054 const uncompressed = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["z" /* gzipUncompress */])(compressed);
8055 const buffer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["h" /* bytesToArrayBuffer */])(uncompressed);
8056 const newDeserializer = new Deserialization(buffer);
8057
8058 return newDeserializer.fetchObject(type, field);
8059 }
8060 if (constructorCmp !== 0x1cb5c415) throw new Error(`Invalid vector constructor ${constructor}`);
8061 }
8062 const len = this.readInt(`${field}[count]`);
8063 const result = [];
8064 if (len > 0) {
8065 const itemType = type.substr(7, type.length - 8); // for "Vector<itemType>"
8066 for (let i = 0; i < len; i++) result.push(this.fetchObject(itemType, `${field}[${i}]`));
8067 }
8068
8069 return result;
8070 }
8071
8072 const schema = this.mtproto ? mtApi : api;
8073 let predicate = false;
8074 let constructorData = false;
8075
8076 if (type.charAt(0) == '%') {
8077 const checkType = type.substr(1);
8078 for (let i = 0; i < schema.constructors.length; i++) {
8079 if (schema.constructors[i].type == checkType) {
8080 constructorData = schema.constructors[i];
8081 break;
8082 }
8083 }
8084 if (!constructorData) {
8085 throw new Error(`Constructor not found for type: ${type}`);
8086 }
8087 } else if (type.charAt(0) >= 97 && type.charAt(0) <= 122) {
8088 for (let i = 0; i < schema.constructors.length; i++) {
8089 if (schema.constructors[i].predicate == type) {
8090 constructorData = schema.constructors[i];
8091 break;
8092 }
8093 }
8094 if (!constructorData) throw new Error(`Constructor not found for predicate: ${type}`);
8095 } else {
8096 const constructor = this.readInt(`${field}[id]`);
8097 const constructorCmp = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["j" /* uintToInt */])(constructor);
8098
8099 if (constructorCmp == 0x3072cfa1) {
8100 // Gzip packed
8101 const compressed = this.fetchBytes(`${field}[packed_string]`);
8102 const uncompressed = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["z" /* gzipUncompress */])(compressed);
8103 const buffer = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__bin__["h" /* bytesToArrayBuffer */])(uncompressed);
8104 const newDeserializer = new Deserialization(buffer);
8105
8106 return newDeserializer.fetchObject(type, field);
8107 }
8108
8109 let index = schema.constructorsIndex;
8110 if (!index) {
8111 schema.constructorsIndex = index = {};
8112 for (let i = 0; i < schema.constructors.length; i++) index[schema.constructors[i].id] = i;
8113 }
8114 let i = index[constructorCmp];
8115 if (i) constructorData = schema.constructors[i];
8116
8117 fallback = false;
8118 if (!constructorData && this.mtproto) {
8119 const schemaFallback = api;
8120 for (i = 0; i < schemaFallback.constructors.length; i++) {
8121 if (schemaFallback.constructors[i].id == constructorCmp) {
8122 constructorData = schemaFallback.constructors[i];
8123
8124 delete this.mtproto;
8125 fallback = true;
8126 break;
8127 }
8128 }
8129 }
8130 if (!constructorData) {
8131 throw new Error(`Constructor not found: ${constructor} ${this.fetchInt()} ${this.fetchInt()}`);
8132 }
8133 }
8134
8135 predicate = constructorData.predicate;
8136
8137 const result = { '_': predicate };
8138 const overrideKey = (this.mtproto ? 'mt_' : '') + predicate;
8139
8140 if (this.override[overrideKey]) {
8141 this.override[overrideKey].apply(this, [result, `${field}[${predicate}]`]);
8142 } else {
8143 let param, isCond;
8144 let condType, fieldBit;
8145 let value;
8146 const len = constructorData.params.length;
8147 for (let i = 0; i < len; i++) {
8148 param = constructorData.params[i];
8149 type = param.type;
8150 if (type === '#' && __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_ramda__["isNil"])(result.pFlags)) result.pFlags = {};
8151
8152 isCond = type.indexOf('?') !== -1;
8153 if (isCond) {
8154 condType = type.split('?');
8155 fieldBit = condType[0].split('.');
8156 if (!(result[fieldBit[0]] & 1 << fieldBit[1])) continue;
8157 type = condType[1];
8158 }
8159
8160 value = this.fetchObject(type, `${field}[${predicate}][${param.name}]`);
8161
8162 if (isCond && type === 'true') result.pFlags[param.name] = value;else result[param.name] = value;
8163 }
8164 }
8165
8166 if (fallback) this.mtproto = true;
8167
8168 return result;
8169 }
8170
8171 getOffset() {
8172 return this.offset;
8173 }
8174
8175 fetchEnd() {
8176 if (this.offset !== this.byteView.length) throw new Error('Fetch end with non-empty buffer');
8177 return true;
8178 }
8179
8180 }
8181
8182 return { Serialization, Deserialization };
8183};
8184/* unused harmony export TL */
8185
8186
8187/* harmony default export */ __webpack_exports__["a"] = TL;
8188
8189/***/ }),
8190/* 35 */
8191/***/ (function(module, exports, __webpack_require__) {
8192
8193var __WEBPACK_AMD_DEFINE_RESULT__;/*!
8194 * EventEmitter2
8195 * https://github.com/hij1nx/EventEmitter2
8196 *
8197 * Copyright (c) 2013 hij1nx
8198 * Licensed under the MIT license.
8199 */
8200;!function(undefined) {
8201
8202 var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {
8203 return Object.prototype.toString.call(obj) === "[object Array]";
8204 };
8205 var defaultMaxListeners = 10;
8206
8207 function init() {
8208 this._events = {};
8209 if (this._conf) {
8210 configure.call(this, this._conf);
8211 }
8212 }
8213
8214 function configure(conf) {
8215 if (conf) {
8216 this._conf = conf;
8217
8218 conf.delimiter && (this.delimiter = conf.delimiter);
8219 this._events.maxListeners = conf.maxListeners !== undefined ? conf.maxListeners : defaultMaxListeners;
8220 conf.wildcard && (this.wildcard = conf.wildcard);
8221 conf.newListener && (this.newListener = conf.newListener);
8222 conf.verboseMemoryLeak && (this.verboseMemoryLeak = conf.verboseMemoryLeak);
8223
8224 if (this.wildcard) {
8225 this.listenerTree = {};
8226 }
8227 } else {
8228 this._events.maxListeners = defaultMaxListeners;
8229 }
8230 }
8231
8232 function logPossibleMemoryLeak(count, eventName) {
8233 var errorMsg = '(node) warning: possible EventEmitter memory ' +
8234 'leak detected. %d listeners added. ' +
8235 'Use emitter.setMaxListeners() to increase limit.';
8236
8237 if(this.verboseMemoryLeak){
8238 errorMsg += ' Event name: %s.';
8239 console.error(errorMsg, count, eventName);
8240 } else {
8241 console.error(errorMsg, count);
8242 }
8243
8244 if (console.trace){
8245 console.trace();
8246 }
8247 }
8248
8249 function EventEmitter(conf) {
8250 this._events = {};
8251 this.newListener = false;
8252 this.verboseMemoryLeak = false;
8253 configure.call(this, conf);
8254 }
8255 EventEmitter.EventEmitter2 = EventEmitter; // backwards compatibility for exporting EventEmitter property
8256
8257 //
8258 // Attention, function return type now is array, always !
8259 // It has zero elements if no any matches found and one or more
8260 // elements (leafs) if there are matches
8261 //
8262 function searchListenerTree(handlers, type, tree, i) {
8263 if (!tree) {
8264 return [];
8265 }
8266 var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,
8267 typeLength = type.length, currentType = type[i], nextType = type[i+1];
8268 if (i === typeLength && tree._listeners) {
8269 //
8270 // If at the end of the event(s) list and the tree has listeners
8271 // invoke those listeners.
8272 //
8273 if (typeof tree._listeners === 'function') {
8274 handlers && handlers.push(tree._listeners);
8275 return [tree];
8276 } else {
8277 for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {
8278 handlers && handlers.push(tree._listeners[leaf]);
8279 }
8280 return [tree];
8281 }
8282 }
8283
8284 if ((currentType === '*' || currentType === '**') || tree[currentType]) {
8285 //
8286 // If the event emitted is '*' at this part
8287 // or there is a concrete match at this patch
8288 //
8289 if (currentType === '*') {
8290 for (branch in tree) {
8291 if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
8292 listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1));
8293 }
8294 }
8295 return listeners;
8296 } else if(currentType === '**') {
8297 endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*'));
8298 if(endReached && tree._listeners) {
8299 // The next element has a _listeners, add it to the handlers.
8300 listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength));
8301 }
8302
8303 for (branch in tree) {
8304 if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
8305 if(branch === '*' || branch === '**') {
8306 if(tree[branch]._listeners && !endReached) {
8307 listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength));
8308 }
8309 listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
8310 } else if(branch === nextType) {
8311 listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2));
8312 } else {
8313 // No match on this one, shift into the tree but not in the type array.
8314 listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
8315 }
8316 }
8317 }
8318 return listeners;
8319 }
8320
8321 listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1));
8322 }
8323
8324 xTree = tree['*'];
8325 if (xTree) {
8326 //
8327 // If the listener tree will allow any match for this part,
8328 // then recursively explore all branches of the tree
8329 //
8330 searchListenerTree(handlers, type, xTree, i+1);
8331 }
8332
8333 xxTree = tree['**'];
8334 if(xxTree) {
8335 if(i < typeLength) {
8336 if(xxTree._listeners) {
8337 // If we have a listener on a '**', it will catch all, so add its handler.
8338 searchListenerTree(handlers, type, xxTree, typeLength);
8339 }
8340
8341 // Build arrays of matching next branches and others.
8342 for(branch in xxTree) {
8343 if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) {
8344 if(branch === nextType) {
8345 // We know the next element will match, so jump twice.
8346 searchListenerTree(handlers, type, xxTree[branch], i+2);
8347 } else if(branch === currentType) {
8348 // Current node matches, move into the tree.
8349 searchListenerTree(handlers, type, xxTree[branch], i+1);
8350 } else {
8351 isolatedBranch = {};
8352 isolatedBranch[branch] = xxTree[branch];
8353 searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1);
8354 }
8355 }
8356 }
8357 } else if(xxTree._listeners) {
8358 // We have reached the end and still on a '**'
8359 searchListenerTree(handlers, type, xxTree, typeLength);
8360 } else if(xxTree['*'] && xxTree['*']._listeners) {
8361 searchListenerTree(handlers, type, xxTree['*'], typeLength);
8362 }
8363 }
8364
8365 return listeners;
8366 }
8367
8368 function growListenerTree(type, listener) {
8369
8370 type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8371
8372 //
8373 // Looks for two consecutive '**', if so, don't add the event at all.
8374 //
8375 for(var i = 0, len = type.length; i+1 < len; i++) {
8376 if(type[i] === '**' && type[i+1] === '**') {
8377 return;
8378 }
8379 }
8380
8381 var tree = this.listenerTree;
8382 var name = type.shift();
8383
8384 while (name !== undefined) {
8385
8386 if (!tree[name]) {
8387 tree[name] = {};
8388 }
8389
8390 tree = tree[name];
8391
8392 if (type.length === 0) {
8393
8394 if (!tree._listeners) {
8395 tree._listeners = listener;
8396 }
8397 else {
8398 if (typeof tree._listeners === 'function') {
8399 tree._listeners = [tree._listeners];
8400 }
8401
8402 tree._listeners.push(listener);
8403
8404 if (
8405 !tree._listeners.warned &&
8406 this._events.maxListeners > 0 &&
8407 tree._listeners.length > this._events.maxListeners
8408 ) {
8409 tree._listeners.warned = true;
8410 logPossibleMemoryLeak.call(this, tree._listeners.length, name);
8411 }
8412 }
8413 return true;
8414 }
8415 name = type.shift();
8416 }
8417 return true;
8418 }
8419
8420 // By default EventEmitters will print a warning if more than
8421 // 10 listeners are added to it. This is a useful default which
8422 // helps finding memory leaks.
8423 //
8424 // Obviously not all Emitters should be limited to 10. This function allows
8425 // that to be increased. Set to zero for unlimited.
8426
8427 EventEmitter.prototype.delimiter = '.';
8428
8429 EventEmitter.prototype.setMaxListeners = function(n) {
8430 if (n !== undefined) {
8431 this._events || init.call(this);
8432 this._events.maxListeners = n;
8433 if (!this._conf) this._conf = {};
8434 this._conf.maxListeners = n;
8435 }
8436 };
8437
8438 EventEmitter.prototype.event = '';
8439
8440 EventEmitter.prototype.once = function(event, fn) {
8441 this.many(event, 1, fn);
8442 return this;
8443 };
8444
8445 EventEmitter.prototype.many = function(event, ttl, fn) {
8446 var self = this;
8447
8448 if (typeof fn !== 'function') {
8449 throw new Error('many only accepts instances of Function');
8450 }
8451
8452 function listener() {
8453 if (--ttl === 0) {
8454 self.off(event, listener);
8455 }
8456 fn.apply(this, arguments);
8457 }
8458
8459 listener._origin = fn;
8460
8461 this.on(event, listener);
8462
8463 return self;
8464 };
8465
8466 EventEmitter.prototype.emit = function() {
8467
8468 this._events || init.call(this);
8469
8470 var type = arguments[0];
8471
8472 if (type === 'newListener' && !this.newListener) {
8473 if (!this._events.newListener) {
8474 return false;
8475 }
8476 }
8477
8478 var al = arguments.length;
8479 var args,l,i,j;
8480 var handler;
8481
8482 if (this._all && this._all.length) {
8483 handler = this._all.slice();
8484 if (al > 3) {
8485 args = new Array(al);
8486 for (j = 0; j < al; j++) args[j] = arguments[j];
8487 }
8488
8489 for (i = 0, l = handler.length; i < l; i++) {
8490 this.event = type;
8491 switch (al) {
8492 case 1:
8493 handler[i].call(this, type);
8494 break;
8495 case 2:
8496 handler[i].call(this, type, arguments[1]);
8497 break;
8498 case 3:
8499 handler[i].call(this, type, arguments[1], arguments[2]);
8500 break;
8501 default:
8502 handler[i].apply(this, args);
8503 }
8504 }
8505 }
8506
8507 if (this.wildcard) {
8508 handler = [];
8509 var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8510 searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
8511 } else {
8512 handler = this._events[type];
8513 if (typeof handler === 'function') {
8514 this.event = type;
8515 switch (al) {
8516 case 1:
8517 handler.call(this);
8518 break;
8519 case 2:
8520 handler.call(this, arguments[1]);
8521 break;
8522 case 3:
8523 handler.call(this, arguments[1], arguments[2]);
8524 break;
8525 default:
8526 args = new Array(al - 1);
8527 for (j = 1; j < al; j++) args[j - 1] = arguments[j];
8528 handler.apply(this, args);
8529 }
8530 return true;
8531 } else if (handler) {
8532 // need to make copy of handlers because list can change in the middle
8533 // of emit call
8534 handler = handler.slice();
8535 }
8536 }
8537
8538 if (handler && handler.length) {
8539 if (al > 3) {
8540 args = new Array(al - 1);
8541 for (j = 1; j < al; j++) args[j - 1] = arguments[j];
8542 }
8543 for (i = 0, l = handler.length; i < l; i++) {
8544 this.event = type;
8545 switch (al) {
8546 case 1:
8547 handler[i].call(this);
8548 break;
8549 case 2:
8550 handler[i].call(this, arguments[1]);
8551 break;
8552 case 3:
8553 handler[i].call(this, arguments[1], arguments[2]);
8554 break;
8555 default:
8556 handler[i].apply(this, args);
8557 }
8558 }
8559 return true;
8560 } else if (!this._all && type === 'error') {
8561 if (arguments[1] instanceof Error) {
8562 throw arguments[1]; // Unhandled 'error' event
8563 } else {
8564 throw new Error("Uncaught, unspecified 'error' event.");
8565 }
8566 return false;
8567 }
8568
8569 return !!this._all;
8570 };
8571
8572 EventEmitter.prototype.emitAsync = function() {
8573
8574 this._events || init.call(this);
8575
8576 var type = arguments[0];
8577
8578 if (type === 'newListener' && !this.newListener) {
8579 if (!this._events.newListener) { return Promise.resolve([false]); }
8580 }
8581
8582 var promises= [];
8583
8584 var al = arguments.length;
8585 var args,l,i,j;
8586 var handler;
8587
8588 if (this._all) {
8589 if (al > 3) {
8590 args = new Array(al);
8591 for (j = 1; j < al; j++) args[j] = arguments[j];
8592 }
8593 for (i = 0, l = this._all.length; i < l; i++) {
8594 this.event = type;
8595 switch (al) {
8596 case 1:
8597 promises.push(this._all[i].call(this, type));
8598 break;
8599 case 2:
8600 promises.push(this._all[i].call(this, type, arguments[1]));
8601 break;
8602 case 3:
8603 promises.push(this._all[i].call(this, type, arguments[1], arguments[2]));
8604 break;
8605 default:
8606 promises.push(this._all[i].apply(this, args));
8607 }
8608 }
8609 }
8610
8611 if (this.wildcard) {
8612 handler = [];
8613 var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8614 searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
8615 } else {
8616 handler = this._events[type];
8617 }
8618
8619 if (typeof handler === 'function') {
8620 this.event = type;
8621 switch (al) {
8622 case 1:
8623 promises.push(handler.call(this));
8624 break;
8625 case 2:
8626 promises.push(handler.call(this, arguments[1]));
8627 break;
8628 case 3:
8629 promises.push(handler.call(this, arguments[1], arguments[2]));
8630 break;
8631 default:
8632 args = new Array(al - 1);
8633 for (j = 1; j < al; j++) args[j - 1] = arguments[j];
8634 promises.push(handler.apply(this, args));
8635 }
8636 } else if (handler && handler.length) {
8637 if (al > 3) {
8638 args = new Array(al - 1);
8639 for (j = 1; j < al; j++) args[j - 1] = arguments[j];
8640 }
8641 for (i = 0, l = handler.length; i < l; i++) {
8642 this.event = type;
8643 switch (al) {
8644 case 1:
8645 promises.push(handler[i].call(this));
8646 break;
8647 case 2:
8648 promises.push(handler[i].call(this, arguments[1]));
8649 break;
8650 case 3:
8651 promises.push(handler[i].call(this, arguments[1], arguments[2]));
8652 break;
8653 default:
8654 promises.push(handler[i].apply(this, args));
8655 }
8656 }
8657 } else if (!this._all && type === 'error') {
8658 if (arguments[1] instanceof Error) {
8659 return Promise.reject(arguments[1]); // Unhandled 'error' event
8660 } else {
8661 return Promise.reject("Uncaught, unspecified 'error' event.");
8662 }
8663 }
8664
8665 return Promise.all(promises);
8666 };
8667
8668 EventEmitter.prototype.on = function(type, listener) {
8669 if (typeof type === 'function') {
8670 this.onAny(type);
8671 return this;
8672 }
8673
8674 if (typeof listener !== 'function') {
8675 throw new Error('on only accepts instances of Function');
8676 }
8677 this._events || init.call(this);
8678
8679 // To avoid recursion in the case that type == "newListeners"! Before
8680 // adding it to the listeners, first emit "newListeners".
8681 this.emit('newListener', type, listener);
8682
8683 if (this.wildcard) {
8684 growListenerTree.call(this, type, listener);
8685 return this;
8686 }
8687
8688 if (!this._events[type]) {
8689 // Optimize the case of one listener. Don't need the extra array object.
8690 this._events[type] = listener;
8691 }
8692 else {
8693 if (typeof this._events[type] === 'function') {
8694 // Change to array.
8695 this._events[type] = [this._events[type]];
8696 }
8697
8698 // If we've already got an array, just append.
8699 this._events[type].push(listener);
8700
8701 // Check for listener leak
8702 if (
8703 !this._events[type].warned &&
8704 this._events.maxListeners > 0 &&
8705 this._events[type].length > this._events.maxListeners
8706 ) {
8707 this._events[type].warned = true;
8708 logPossibleMemoryLeak.call(this, this._events[type].length, type);
8709 }
8710 }
8711
8712 return this;
8713 };
8714
8715 EventEmitter.prototype.onAny = function(fn) {
8716 if (typeof fn !== 'function') {
8717 throw new Error('onAny only accepts instances of Function');
8718 }
8719
8720 if (!this._all) {
8721 this._all = [];
8722 }
8723
8724 // Add the function to the event listener collection.
8725 this._all.push(fn);
8726 return this;
8727 };
8728
8729 EventEmitter.prototype.addListener = EventEmitter.prototype.on;
8730
8731 EventEmitter.prototype.off = function(type, listener) {
8732 if (typeof listener !== 'function') {
8733 throw new Error('removeListener only takes instances of Function');
8734 }
8735
8736 var handlers,leafs=[];
8737
8738 if(this.wildcard) {
8739 var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8740 leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
8741 }
8742 else {
8743 // does not use listeners(), so no side effect of creating _events[type]
8744 if (!this._events[type]) return this;
8745 handlers = this._events[type];
8746 leafs.push({_listeners:handlers});
8747 }
8748
8749 for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
8750 var leaf = leafs[iLeaf];
8751 handlers = leaf._listeners;
8752 if (isArray(handlers)) {
8753
8754 var position = -1;
8755
8756 for (var i = 0, length = handlers.length; i < length; i++) {
8757 if (handlers[i] === listener ||
8758 (handlers[i].listener && handlers[i].listener === listener) ||
8759 (handlers[i]._origin && handlers[i]._origin === listener)) {
8760 position = i;
8761 break;
8762 }
8763 }
8764
8765 if (position < 0) {
8766 continue;
8767 }
8768
8769 if(this.wildcard) {
8770 leaf._listeners.splice(position, 1);
8771 }
8772 else {
8773 this._events[type].splice(position, 1);
8774 }
8775
8776 if (handlers.length === 0) {
8777 if(this.wildcard) {
8778 delete leaf._listeners;
8779 }
8780 else {
8781 delete this._events[type];
8782 }
8783 }
8784
8785 this.emit("removeListener", type, listener);
8786
8787 return this;
8788 }
8789 else if (handlers === listener ||
8790 (handlers.listener && handlers.listener === listener) ||
8791 (handlers._origin && handlers._origin === listener)) {
8792 if(this.wildcard) {
8793 delete leaf._listeners;
8794 }
8795 else {
8796 delete this._events[type];
8797 }
8798
8799 this.emit("removeListener", type, listener);
8800 }
8801 }
8802
8803 function recursivelyGarbageCollect(root) {
8804 if (root === undefined) {
8805 return;
8806 }
8807 var keys = Object.keys(root);
8808 for (var i in keys) {
8809 var key = keys[i];
8810 var obj = root[key];
8811 if ((obj instanceof Function) || (typeof obj !== "object") || (obj === null))
8812 continue;
8813 if (Object.keys(obj).length > 0) {
8814 recursivelyGarbageCollect(root[key]);
8815 }
8816 if (Object.keys(obj).length === 0) {
8817 delete root[key];
8818 }
8819 }
8820 }
8821 recursivelyGarbageCollect(this.listenerTree);
8822
8823 return this;
8824 };
8825
8826 EventEmitter.prototype.offAny = function(fn) {
8827 var i = 0, l = 0, fns;
8828 if (fn && this._all && this._all.length > 0) {
8829 fns = this._all;
8830 for(i = 0, l = fns.length; i < l; i++) {
8831 if(fn === fns[i]) {
8832 fns.splice(i, 1);
8833 this.emit("removeListenerAny", fn);
8834 return this;
8835 }
8836 }
8837 } else {
8838 fns = this._all;
8839 for(i = 0, l = fns.length; i < l; i++)
8840 this.emit("removeListenerAny", fns[i]);
8841 this._all = [];
8842 }
8843 return this;
8844 };
8845
8846 EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
8847
8848 EventEmitter.prototype.removeAllListeners = function(type) {
8849 if (arguments.length === 0) {
8850 !this._events || init.call(this);
8851 return this;
8852 }
8853
8854 if (this.wildcard) {
8855 var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8856 var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
8857
8858 for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
8859 var leaf = leafs[iLeaf];
8860 leaf._listeners = null;
8861 }
8862 }
8863 else if (this._events) {
8864 this._events[type] = null;
8865 }
8866 return this;
8867 };
8868
8869 EventEmitter.prototype.listeners = function(type) {
8870 if (this.wildcard) {
8871 var handlers = [];
8872 var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
8873 searchListenerTree.call(this, handlers, ns, this.listenerTree, 0);
8874 return handlers;
8875 }
8876
8877 this._events || init.call(this);
8878
8879 if (!this._events[type]) this._events[type] = [];
8880 if (!isArray(this._events[type])) {
8881 this._events[type] = [this._events[type]];
8882 }
8883 return this._events[type];
8884 };
8885
8886 EventEmitter.prototype.listenerCount = function(type) {
8887 return this.listeners(type).length;
8888 };
8889
8890 EventEmitter.prototype.listenersAny = function() {
8891
8892 if(this._all) {
8893 return this._all;
8894 }
8895 else {
8896 return [];
8897 }
8898
8899 };
8900
8901 if (true) {
8902 // AMD. Register as an anonymous module.
8903 !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
8904 return EventEmitter;
8905 }.call(exports, __webpack_require__, exports, module),
8906 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
8907 } else if (typeof exports === 'object') {
8908 // CommonJS
8909 module.exports = EventEmitter;
8910 }
8911 else {
8912 // Browser global.
8913 window.EventEmitter2 = EventEmitter;
8914 }
8915}();
8916
8917
8918/***/ }),
8919/* 36 */
8920/***/ (function(module, exports, __webpack_require__) {
8921
8922/* WEBPACK VAR INJECTION */(function(global) {(function () {
8923 var /*
8924 * Rusha, a JavaScript implementation of the Secure Hash Algorithm, SHA-1,
8925 * as defined in FIPS PUB 180-1, tuned for high performance with large inputs.
8926 * (http://github.com/srijs/rusha)
8927 *
8928 * Inspired by Paul Johnstons implementation (http://pajhome.org.uk/crypt/md5).
8929 *
8930 * Copyright (c) 2013 Sam Rijs (http://awesam.de).
8931 * Released under the terms of the MIT license as follows:
8932 *
8933 * Permission is hereby granted, free of charge, to any person obtaining a
8934 * copy of this software and associated documentation files (the "Software"),
8935 * to deal in the Software without restriction, including without limitation
8936 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8937 * and/or sell copies of the Software, and to permit persons to whom the
8938 * Software is furnished to do so, subject to the following conditions:
8939 *
8940 * The above copyright notice and this permission notice shall be included in
8941 * all copies or substantial portions of the Software.
8942 *
8943 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8944 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8945 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8946 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8947 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
8948 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
8949 * IN THE SOFTWARE.
8950 */
8951 util = {
8952 getDataType: function (data) {
8953 if (typeof data === 'string') {
8954 return 'string';
8955 }
8956 if (data instanceof Array) {
8957 return 'array';
8958 }
8959 if (typeof global !== 'undefined' && global.Buffer && global.Buffer.isBuffer(data)) {
8960 return 'buffer';
8961 }
8962 if (data instanceof ArrayBuffer) {
8963 return 'arraybuffer';
8964 }
8965 if (data.buffer instanceof ArrayBuffer) {
8966 return 'view';
8967 }
8968 if (data instanceof Blob) {
8969 return 'blob';
8970 }
8971 throw new Error('Unsupported data type.');
8972 }
8973 };
8974 function Rusha(chunkSize) {
8975 'use strict';
8976 var // Private object structure.
8977 self$2 = { fill: 0 };
8978 var // Calculate the length of buffer that the sha1 routine uses
8979 // including the padding.
8980 padlen = function (len) {
8981 for (len += 9; len % 64 > 0; len += 1);
8982 return len;
8983 };
8984 var padZeroes = function (bin, len) {
8985 var h8 = new Uint8Array(bin.buffer);
8986 var om = len % 4, align = len - om;
8987 switch (om) {
8988 case 0:
8989 h8[align + 3] = 0;
8990 case 1:
8991 h8[align + 2] = 0;
8992 case 2:
8993 h8[align + 1] = 0;
8994 case 3:
8995 h8[align + 0] = 0;
8996 }
8997 for (var i$2 = (len >> 2) + 1; i$2 < bin.length; i$2++)
8998 bin[i$2] = 0;
8999 };
9000 var padData = function (bin, chunkLen, msgLen) {
9001 bin[chunkLen >> 2] |= 128 << 24 - (chunkLen % 4 << 3);
9002 // To support msgLen >= 2 GiB, use a float division when computing the
9003 // high 32-bits of the big-endian message length in bits.
9004 bin[((chunkLen >> 2) + 2 & ~15) + 14] = msgLen / (1 << 29) | 0;
9005 bin[((chunkLen >> 2) + 2 & ~15) + 15] = msgLen << 3;
9006 };
9007 var // Convert a binary string and write it to the heap.
9008 // A binary string is expected to only contain char codes < 256.
9009 convStr = function (H8, H32, start, len, off) {
9010 var str = this, i$2, om = off % 4, lm = (len + om) % 4, j = len - lm;
9011 switch (om) {
9012 case 0:
9013 H8[off] = str.charCodeAt(start + 3);
9014 case 1:
9015 H8[off + 1 - (om << 1) | 0] = str.charCodeAt(start + 2);
9016 case 2:
9017 H8[off + 2 - (om << 1) | 0] = str.charCodeAt(start + 1);
9018 case 3:
9019 H8[off + 3 - (om << 1) | 0] = str.charCodeAt(start);
9020 }
9021 if (len < lm + om) {
9022 return;
9023 }
9024 for (i$2 = 4 - om; i$2 < j; i$2 = i$2 + 4 | 0) {
9025 H32[off + i$2 >> 2] = str.charCodeAt(start + i$2) << 24 | str.charCodeAt(start + i$2 + 1) << 16 | str.charCodeAt(start + i$2 + 2) << 8 | str.charCodeAt(start + i$2 + 3);
9026 }
9027 switch (lm) {
9028 case 3:
9029 H8[off + j + 1 | 0] = str.charCodeAt(start + j + 2);
9030 case 2:
9031 H8[off + j + 2 | 0] = str.charCodeAt(start + j + 1);
9032 case 1:
9033 H8[off + j + 3 | 0] = str.charCodeAt(start + j);
9034 }
9035 };
9036 var // Convert a buffer or array and write it to the heap.
9037 // The buffer or array is expected to only contain elements < 256.
9038 convBuf = function (H8, H32, start, len, off) {
9039 var buf = this, i$2, om = off % 4, lm = (len + om) % 4, j = len - lm;
9040 switch (om) {
9041 case 0:
9042 H8[off] = buf[start + 3];
9043 case 1:
9044 H8[off + 1 - (om << 1) | 0] = buf[start + 2];
9045 case 2:
9046 H8[off + 2 - (om << 1) | 0] = buf[start + 1];
9047 case 3:
9048 H8[off + 3 - (om << 1) | 0] = buf[start];
9049 }
9050 if (len < lm + om) {
9051 return;
9052 }
9053 for (i$2 = 4 - om; i$2 < j; i$2 = i$2 + 4 | 0) {
9054 H32[off + i$2 >> 2 | 0] = buf[start + i$2] << 24 | buf[start + i$2 + 1] << 16 | buf[start + i$2 + 2] << 8 | buf[start + i$2 + 3];
9055 }
9056 switch (lm) {
9057 case 3:
9058 H8[off + j + 1 | 0] = buf[start + j + 2];
9059 case 2:
9060 H8[off + j + 2 | 0] = buf[start + j + 1];
9061 case 1:
9062 H8[off + j + 3 | 0] = buf[start + j];
9063 }
9064 };
9065 var convBlob = function (H8, H32, start, len, off) {
9066 var blob = this, i$2, om = off % 4, lm = (len + om) % 4, j = len - lm;
9067 var buf = new Uint8Array(reader.readAsArrayBuffer(blob.slice(start, start + len)));
9068 switch (om) {
9069 case 0:
9070 H8[off] = buf[3];
9071 case 1:
9072 H8[off + 1 - (om << 1) | 0] = buf[2];
9073 case 2:
9074 H8[off + 2 - (om << 1) | 0] = buf[1];
9075 case 3:
9076 H8[off + 3 - (om << 1) | 0] = buf[0];
9077 }
9078 if (len < lm + om) {
9079 return;
9080 }
9081 for (i$2 = 4 - om; i$2 < j; i$2 = i$2 + 4 | 0) {
9082 H32[off + i$2 >> 2 | 0] = buf[i$2] << 24 | buf[i$2 + 1] << 16 | buf[i$2 + 2] << 8 | buf[i$2 + 3];
9083 }
9084 switch (lm) {
9085 case 3:
9086 H8[off + j + 1 | 0] = buf[j + 2];
9087 case 2:
9088 H8[off + j + 2 | 0] = buf[j + 1];
9089 case 1:
9090 H8[off + j + 3 | 0] = buf[j];
9091 }
9092 };
9093 var convFn = function (data) {
9094 switch (util.getDataType(data)) {
9095 case 'string':
9096 return convStr.bind(data);
9097 case 'array':
9098 return convBuf.bind(data);
9099 case 'buffer':
9100 return convBuf.bind(data);
9101 case 'arraybuffer':
9102 return convBuf.bind(new Uint8Array(data));
9103 case 'view':
9104 return convBuf.bind(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
9105 case 'blob':
9106 return convBlob.bind(data);
9107 }
9108 };
9109 var slice = function (data, offset) {
9110 switch (util.getDataType(data)) {
9111 case 'string':
9112 return data.slice(offset);
9113 case 'array':
9114 return data.slice(offset);
9115 case 'buffer':
9116 return data.slice(offset);
9117 case 'arraybuffer':
9118 return data.slice(offset);
9119 case 'view':
9120 return data.buffer.slice(offset);
9121 }
9122 };
9123 var // Precompute 00 - ff strings
9124 precomputedHex = new Array(256);
9125 for (var i = 0; i < 256; i++) {
9126 precomputedHex[i] = (i < 16 ? '0' : '') + i.toString(16);
9127 }
9128 var // Convert an ArrayBuffer into its hexadecimal string representation.
9129 hex = function (arrayBuffer) {
9130 var binarray = new Uint8Array(arrayBuffer);
9131 var res = new Array(arrayBuffer.byteLength);
9132 for (var i$2 = 0; i$2 < res.length; i$2++) {
9133 res[i$2] = precomputedHex[binarray[i$2]];
9134 }
9135 return res.join('');
9136 };
9137 var ceilHeapSize = function (v) {
9138 // The asm.js spec says:
9139 // The heap object's byteLength must be either
9140 // 2^n for n in [12, 24) or 2^24 * n for n ≥ 1.
9141 // Also, byteLengths smaller than 2^16 are deprecated.
9142 var p;
9143 if (// If v is smaller than 2^16, the smallest possible solution
9144 // is 2^16.
9145 v <= 65536)
9146 return 65536;
9147 if (// If v < 2^24, we round up to 2^n,
9148 // otherwise we round up to 2^24 * n.
9149 v < 16777216) {
9150 for (p = 1; p < v; p = p << 1);
9151 } else {
9152 for (p = 16777216; p < v; p += 16777216);
9153 }
9154 return p;
9155 };
9156 var // Initialize the internal data structures to a new capacity.
9157 init = function (size) {
9158 if (size % 64 > 0) {
9159 throw new Error('Chunk size must be a multiple of 128 bit');
9160 }
9161 self$2.offset = 0;
9162 self$2.maxChunkLen = size;
9163 self$2.padMaxChunkLen = padlen(size);
9164 // The size of the heap is the sum of:
9165 // 1. The padded input message size
9166 // 2. The extended space the algorithm needs (320 byte)
9167 // 3. The 160 bit state the algoritm uses
9168 self$2.heap = new ArrayBuffer(ceilHeapSize(self$2.padMaxChunkLen + 320 + 20));
9169 self$2.h32 = new Int32Array(self$2.heap);
9170 self$2.h8 = new Int8Array(self$2.heap);
9171 self$2.core = new Rusha._core({
9172 Int32Array: Int32Array,
9173 DataView: DataView
9174 }, {}, self$2.heap);
9175 self$2.buffer = null;
9176 };
9177 // Iinitializethe datastructures according
9178 // to a chunk siyze.
9179 init(chunkSize || 64 * 1024);
9180 var initState = function (heap, padMsgLen) {
9181 self$2.offset = 0;
9182 var io = new Int32Array(heap, padMsgLen + 320, 5);
9183 io[0] = 1732584193;
9184 io[1] = -271733879;
9185 io[2] = -1732584194;
9186 io[3] = 271733878;
9187 io[4] = -1009589776;
9188 };
9189 var padChunk = function (chunkLen, msgLen) {
9190 var padChunkLen = padlen(chunkLen);
9191 var view = new Int32Array(self$2.heap, 0, padChunkLen >> 2);
9192 padZeroes(view, chunkLen);
9193 padData(view, chunkLen, msgLen);
9194 return padChunkLen;
9195 };
9196 var // Write data to the heap.
9197 write = function (data, chunkOffset, chunkLen, off) {
9198 convFn(data)(self$2.h8, self$2.h32, chunkOffset, chunkLen, off || 0);
9199 };
9200 var // Initialize and call the RushaCore,
9201 // assuming an input buffer of length len * 4.
9202 coreCall = function (data, chunkOffset, chunkLen, msgLen, finalize) {
9203 var padChunkLen = chunkLen;
9204 write(data, chunkOffset, chunkLen);
9205 if (finalize) {
9206 padChunkLen = padChunk(chunkLen, msgLen);
9207 }
9208 self$2.core.hash(padChunkLen, self$2.padMaxChunkLen);
9209 };
9210 var getRawDigest = function (heap, padMaxChunkLen) {
9211 var io = new Int32Array(heap, padMaxChunkLen + 320, 5);
9212 var out = new Int32Array(5);
9213 var arr = new DataView(out.buffer);
9214 arr.setInt32(0, io[0], false);
9215 arr.setInt32(4, io[1], false);
9216 arr.setInt32(8, io[2], false);
9217 arr.setInt32(12, io[3], false);
9218 arr.setInt32(16, io[4], false);
9219 return out;
9220 };
9221 var // Calculate the hash digest as an array of 5 32bit integers.
9222 rawDigest = this.rawDigest = function (str) {
9223 var msgLen = str.byteLength || str.length || str.size || 0;
9224 initState(self$2.heap, self$2.padMaxChunkLen);
9225 var chunkOffset = 0, chunkLen = self$2.maxChunkLen, last;
9226 for (chunkOffset = 0; msgLen > chunkOffset + chunkLen; chunkOffset += chunkLen) {
9227 coreCall(str, chunkOffset, chunkLen, msgLen, false);
9228 }
9229 coreCall(str, chunkOffset, msgLen - chunkOffset, msgLen, true);
9230 return getRawDigest(self$2.heap, self$2.padMaxChunkLen);
9231 };
9232 // The digest and digestFrom* interface returns the hash digest
9233 // as a hex string.
9234 this.digest = this.digestFromString = this.digestFromBuffer = this.digestFromArrayBuffer = function (str) {
9235 return hex(rawDigest(str).buffer);
9236 };
9237 this.resetState = function () {
9238 initState(self$2.heap, self$2.padMaxChunkLen);
9239 return this;
9240 };
9241 this.append = function (chunk) {
9242 var chunkOffset = 0;
9243 var chunkLen = chunk.byteLength || chunk.length || chunk.size || 0;
9244 var turnOffset = self$2.offset % self$2.maxChunkLen;
9245 var inputLen;
9246 self$2.offset += chunkLen;
9247 while (chunkOffset < chunkLen) {
9248 inputLen = Math.min(chunkLen - chunkOffset, self$2.maxChunkLen - turnOffset);
9249 write(chunk, chunkOffset, inputLen, turnOffset);
9250 turnOffset += inputLen;
9251 chunkOffset += inputLen;
9252 if (turnOffset === self$2.maxChunkLen) {
9253 self$2.core.hash(self$2.maxChunkLen, self$2.padMaxChunkLen);
9254 turnOffset = 0;
9255 }
9256 }
9257 return this;
9258 };
9259 this.getState = function () {
9260 var turnOffset = self$2.offset % self$2.maxChunkLen;
9261 var heap;
9262 if (!turnOffset) {
9263 var io = new Int32Array(self$2.heap, self$2.padMaxChunkLen + 320, 5);
9264 heap = io.buffer.slice(io.byteOffset, io.byteOffset + io.byteLength);
9265 } else {
9266 heap = self$2.heap.slice(0);
9267 }
9268 return {
9269 offset: self$2.offset,
9270 heap: heap
9271 };
9272 };
9273 this.setState = function (state) {
9274 self$2.offset = state.offset;
9275 if (state.heap.byteLength === 20) {
9276 var io = new Int32Array(self$2.heap, self$2.padMaxChunkLen + 320, 5);
9277 io.set(new Int32Array(state.heap));
9278 } else {
9279 self$2.h32.set(new Int32Array(state.heap));
9280 }
9281 return this;
9282 };
9283 var rawEnd = this.rawEnd = function () {
9284 var msgLen = self$2.offset;
9285 var chunkLen = msgLen % self$2.maxChunkLen;
9286 var padChunkLen = padChunk(chunkLen, msgLen);
9287 self$2.core.hash(padChunkLen, self$2.padMaxChunkLen);
9288 var result = getRawDigest(self$2.heap, self$2.padMaxChunkLen);
9289 initState(self$2.heap, self$2.padMaxChunkLen);
9290 return result;
9291 };
9292 this.end = function () {
9293 return hex(rawEnd().buffer);
9294 };
9295 }
9296 ;
9297 // The low-level RushCore module provides the heart of Rusha,
9298 // a high-speed sha1 implementation working on an Int32Array heap.
9299 // At first glance, the implementation seems complicated, however
9300 // with the SHA1 spec at hand, it is obvious this almost a textbook
9301 // implementation that has a few functions hand-inlined and a few loops
9302 // hand-unrolled.
9303 Rusha._core = function RushaCore(stdlib, foreign, heap) {
9304 'use asm';
9305 var H = new stdlib.Int32Array(heap);
9306 function hash(k, x) {
9307 // k in bytes
9308 k = k | 0;
9309 x = x | 0;
9310 var i = 0, j = 0, y0 = 0, z0 = 0, y1 = 0, z1 = 0, y2 = 0, z2 = 0, y3 = 0, z3 = 0, y4 = 0, z4 = 0, t0 = 0, t1 = 0;
9311 y0 = H[x + 320 >> 2] | 0;
9312 y1 = H[x + 324 >> 2] | 0;
9313 y2 = H[x + 328 >> 2] | 0;
9314 y3 = H[x + 332 >> 2] | 0;
9315 y4 = H[x + 336 >> 2] | 0;
9316 for (i = 0; (i | 0) < (k | 0); i = i + 64 | 0) {
9317 z0 = y0;
9318 z1 = y1;
9319 z2 = y2;
9320 z3 = y3;
9321 z4 = y4;
9322 for (j = 0; (j | 0) < 64; j = j + 4 | 0) {
9323 t1 = H[i + j >> 2] | 0;
9324 t0 = ((y0 << 5 | y0 >>> 27) + (y1 & y2 | ~y1 & y3) | 0) + ((t1 + y4 | 0) + 1518500249 | 0) | 0;
9325 y4 = y3;
9326 y3 = y2;
9327 y2 = y1 << 30 | y1 >>> 2;
9328 y1 = y0;
9329 y0 = t0;
9330 H[k + j >> 2] = t1;
9331 }
9332 for (j = k + 64 | 0; (j | 0) < (k + 80 | 0); j = j + 4 | 0) {
9333 t1 = (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) << 1 | (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) >>> 31;
9334 t0 = ((y0 << 5 | y0 >>> 27) + (y1 & y2 | ~y1 & y3) | 0) + ((t1 + y4 | 0) + 1518500249 | 0) | 0;
9335 y4 = y3;
9336 y3 = y2;
9337 y2 = y1 << 30 | y1 >>> 2;
9338 y1 = y0;
9339 y0 = t0;
9340 H[j >> 2] = t1;
9341 }
9342 for (j = k + 80 | 0; (j | 0) < (k + 160 | 0); j = j + 4 | 0) {
9343 t1 = (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) << 1 | (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) >>> 31;
9344 t0 = ((y0 << 5 | y0 >>> 27) + (y1 ^ y2 ^ y3) | 0) + ((t1 + y4 | 0) + 1859775393 | 0) | 0;
9345 y4 = y3;
9346 y3 = y2;
9347 y2 = y1 << 30 | y1 >>> 2;
9348 y1 = y0;
9349 y0 = t0;
9350 H[j >> 2] = t1;
9351 }
9352 for (j = k + 160 | 0; (j | 0) < (k + 240 | 0); j = j + 4 | 0) {
9353 t1 = (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) << 1 | (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) >>> 31;
9354 t0 = ((y0 << 5 | y0 >>> 27) + (y1 & y2 | y1 & y3 | y2 & y3) | 0) + ((t1 + y4 | 0) - 1894007588 | 0) | 0;
9355 y4 = y3;
9356 y3 = y2;
9357 y2 = y1 << 30 | y1 >>> 2;
9358 y1 = y0;
9359 y0 = t0;
9360 H[j >> 2] = t1;
9361 }
9362 for (j = k + 240 | 0; (j | 0) < (k + 320 | 0); j = j + 4 | 0) {
9363 t1 = (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) << 1 | (H[j - 12 >> 2] ^ H[j - 32 >> 2] ^ H[j - 56 >> 2] ^ H[j - 64 >> 2]) >>> 31;
9364 t0 = ((y0 << 5 | y0 >>> 27) + (y1 ^ y2 ^ y3) | 0) + ((t1 + y4 | 0) - 899497514 | 0) | 0;
9365 y4 = y3;
9366 y3 = y2;
9367 y2 = y1 << 30 | y1 >>> 2;
9368 y1 = y0;
9369 y0 = t0;
9370 H[j >> 2] = t1;
9371 }
9372 y0 = y0 + z0 | 0;
9373 y1 = y1 + z1 | 0;
9374 y2 = y2 + z2 | 0;
9375 y3 = y3 + z3 | 0;
9376 y4 = y4 + z4 | 0;
9377 }
9378 H[x + 320 >> 2] = y0;
9379 H[x + 324 >> 2] = y1;
9380 H[x + 328 >> 2] = y2;
9381 H[x + 332 >> 2] = y3;
9382 H[x + 336 >> 2] = y4;
9383 }
9384 return { hash: hash };
9385 };
9386 if (// If we'e running in Node.JS, export a module.
9387 true) {
9388 module.exports = Rusha;
9389 } else if (// If we're running in a DOM context, export
9390 // the Rusha object to toplevel.
9391 typeof window !== 'undefined') {
9392 window.Rusha = Rusha;
9393 }
9394 if (// If we're running in a webworker, accept
9395 // messages containing a jobid and a buffer
9396 // or blob object, and return the hash result.
9397 typeof FileReaderSync !== 'undefined') {
9398 var reader = new FileReaderSync(), hasher = new Rusha(4 * 1024 * 1024);
9399 self.onmessage = function onMessage(event) {
9400 var hash, data = event.data.data;
9401 try {
9402 hash = hasher.digest(data);
9403 self.postMessage({
9404 id: event.data.id,
9405 hash: hash
9406 });
9407 } catch (e) {
9408 self.postMessage({
9409 id: event.data.id,
9410 error: e.name
9411 });
9412 }
9413 };
9414 }
9415}());
9416/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18)))
9417
9418/***/ }),
9419/* 37 */
9420/***/ (function(module, exports, __webpack_require__) {
9421
9422module.exports = function() {
9423 return new Worker(__webpack_require__.p + "hash.worker.js");
9424};
9425
9426/***/ }),
9427/* 38 */
9428/***/ (function(module, exports) {
9429
9430module.exports = {
9431 "constructors": [
9432 {
9433 "id": "-1132882121",
9434 "predicate": "boolFalse",
9435 "params": [],
9436 "type": "Bool"
9437 },
9438 {
9439 "id": "-1720552011",
9440 "predicate": "boolTrue",
9441 "params": [],
9442 "type": "Bool"
9443 },
9444 {
9445 "id": "1072550713",
9446 "predicate": "true",
9447 "params": [],
9448 "type": "True"
9449 },
9450 {
9451 "id": "481674261",
9452 "predicate": "vector",
9453 "params": [],
9454 "type": "Vector t"
9455 },
9456 {
9457 "id": "-994444869",
9458 "predicate": "error",
9459 "params": [
9460 {
9461 "name": "code",
9462 "type": "int"
9463 },
9464 {
9465 "name": "text",
9466 "type": "string"
9467 }
9468 ],
9469 "type": "Error"
9470 },
9471 {
9472 "id": "1450380236",
9473 "predicate": "null",
9474 "params": [],
9475 "type": "Null"
9476 },
9477 {
9478 "id": "2134579434",
9479 "predicate": "inputPeerEmpty",
9480 "params": [],
9481 "type": "InputPeer"
9482 },
9483 {
9484 "id": "2107670217",
9485 "predicate": "inputPeerSelf",
9486 "params": [],
9487 "type": "InputPeer"
9488 },
9489 {
9490 "id": "396093539",
9491 "predicate": "inputPeerChat",
9492 "params": [
9493 {
9494 "name": "chat_id",
9495 "type": "int"
9496 }
9497 ],
9498 "type": "InputPeer"
9499 },
9500 {
9501 "id": "-1182234929",
9502 "predicate": "inputUserEmpty",
9503 "params": [],
9504 "type": "InputUser"
9505 },
9506 {
9507 "id": "-138301121",
9508 "predicate": "inputUserSelf",
9509 "params": [],
9510 "type": "InputUser"
9511 },
9512 {
9513 "id": "-208488460",
9514 "predicate": "inputPhoneContact",
9515 "params": [
9516 {
9517 "name": "client_id",
9518 "type": "long"
9519 },
9520 {
9521 "name": "phone",
9522 "type": "string"
9523 },
9524 {
9525 "name": "first_name",
9526 "type": "string"
9527 },
9528 {
9529 "name": "last_name",
9530 "type": "string"
9531 }
9532 ],
9533 "type": "InputContact"
9534 },
9535 {
9536 "id": "-181407105",
9537 "predicate": "inputFile",
9538 "params": [
9539 {
9540 "name": "id",
9541 "type": "long"
9542 },
9543 {
9544 "name": "parts",
9545 "type": "int"
9546 },
9547 {
9548 "name": "name",
9549 "type": "string"
9550 },
9551 {
9552 "name": "md5_checksum",
9553 "type": "string"
9554 }
9555 ],
9556 "type": "InputFile"
9557 },
9558 {
9559 "id": "-1771768449",
9560 "predicate": "inputMediaEmpty",
9561 "params": [],
9562 "type": "InputMedia"
9563 },
9564 {
9565 "id": "1661770481",
9566 "predicate": "inputMediaUploadedPhoto",
9567 "params": [
9568 {
9569 "name": "flags",
9570 "type": "#"
9571 },
9572 {
9573 "name": "file",
9574 "type": "InputFile"
9575 },
9576 {
9577 "name": "caption",
9578 "type": "string"
9579 },
9580 {
9581 "name": "stickers",
9582 "type": "flags.0?Vector<InputDocument>"
9583 }
9584 ],
9585 "type": "InputMedia"
9586 },
9587 {
9588 "id": "-373312269",
9589 "predicate": "inputMediaPhoto",
9590 "params": [
9591 {
9592 "name": "id",
9593 "type": "InputPhoto"
9594 },
9595 {
9596 "name": "caption",
9597 "type": "string"
9598 }
9599 ],
9600 "type": "InputMedia"
9601 },
9602 {
9603 "id": "-104578748",
9604 "predicate": "inputMediaGeoPoint",
9605 "params": [
9606 {
9607 "name": "geo_point",
9608 "type": "InputGeoPoint"
9609 }
9610 ],
9611 "type": "InputMedia"
9612 },
9613 {
9614 "id": "-1494984313",
9615 "predicate": "inputMediaContact",
9616 "params": [
9617 {
9618 "name": "phone_number",
9619 "type": "string"
9620 },
9621 {
9622 "name": "first_name",
9623 "type": "string"
9624 },
9625 {
9626 "name": "last_name",
9627 "type": "string"
9628 }
9629 ],
9630 "type": "InputMedia"
9631 },
9632 {
9633 "id": "480546647",
9634 "predicate": "inputChatPhotoEmpty",
9635 "params": [],
9636 "type": "InputChatPhoto"
9637 },
9638 {
9639 "id": "-1837345356",
9640 "predicate": "inputChatUploadedPhoto",
9641 "params": [
9642 {
9643 "name": "file",
9644 "type": "InputFile"
9645 }
9646 ],
9647 "type": "InputChatPhoto"
9648 },
9649 {
9650 "id": "-1991004873",
9651 "predicate": "inputChatPhoto",
9652 "params": [
9653 {
9654 "name": "id",
9655 "type": "InputPhoto"
9656 }
9657 ],
9658 "type": "InputChatPhoto"
9659 },
9660 {
9661 "id": "-457104426",
9662 "predicate": "inputGeoPointEmpty",
9663 "params": [],
9664 "type": "InputGeoPoint"
9665 },
9666 {
9667 "id": "-206066487",
9668 "predicate": "inputGeoPoint",
9669 "params": [
9670 {
9671 "name": "lat",
9672 "type": "double"
9673 },
9674 {
9675 "name": "long",
9676 "type": "double"
9677 }
9678 ],
9679 "type": "InputGeoPoint"
9680 },
9681 {
9682 "id": "483901197",
9683 "predicate": "inputPhotoEmpty",
9684 "params": [],
9685 "type": "InputPhoto"
9686 },
9687 {
9688 "id": "-74070332",
9689 "predicate": "inputPhoto",
9690 "params": [
9691 {
9692 "name": "id",
9693 "type": "long"
9694 },
9695 {
9696 "name": "access_hash",
9697 "type": "long"
9698 }
9699 ],
9700 "type": "InputPhoto"
9701 },
9702 {
9703 "id": "342061462",
9704 "predicate": "inputFileLocation",
9705 "params": [
9706 {
9707 "name": "volume_id",
9708 "type": "long"
9709 },
9710 {
9711 "name": "local_id",
9712 "type": "int"
9713 },
9714 {
9715 "name": "secret",
9716 "type": "long"
9717 }
9718 ],
9719 "type": "InputFileLocation"
9720 },
9721 {
9722 "id": "1996904104",
9723 "predicate": "inputAppEvent",
9724 "params": [
9725 {
9726 "name": "time",
9727 "type": "double"
9728 },
9729 {
9730 "name": "type",
9731 "type": "string"
9732 },
9733 {
9734 "name": "peer",
9735 "type": "long"
9736 },
9737 {
9738 "name": "data",
9739 "type": "string"
9740 }
9741 ],
9742 "type": "InputAppEvent"
9743 },
9744 {
9745 "id": "-1649296275",
9746 "predicate": "peerUser",
9747 "params": [
9748 {
9749 "name": "user_id",
9750 "type": "int"
9751 }
9752 ],
9753 "type": "Peer"
9754 },
9755 {
9756 "id": "-1160714821",
9757 "predicate": "peerChat",
9758 "params": [
9759 {
9760 "name": "chat_id",
9761 "type": "int"
9762 }
9763 ],
9764 "type": "Peer"
9765 },
9766 {
9767 "id": "-1432995067",
9768 "predicate": "storage.fileUnknown",
9769 "params": [],
9770 "type": "storage.FileType"
9771 },
9772 {
9773 "id": "8322574",
9774 "predicate": "storage.fileJpeg",
9775 "params": [],
9776 "type": "storage.FileType"
9777 },
9778 {
9779 "id": "-891180321",
9780 "predicate": "storage.fileGif",
9781 "params": [],
9782 "type": "storage.FileType"
9783 },
9784 {
9785 "id": "172975040",
9786 "predicate": "storage.filePng",
9787 "params": [],
9788 "type": "storage.FileType"
9789 },
9790 {
9791 "id": "-1373745011",
9792 "predicate": "storage.filePdf",
9793 "params": [],
9794 "type": "storage.FileType"
9795 },
9796 {
9797 "id": "1384777335",
9798 "predicate": "storage.fileMp3",
9799 "params": [],
9800 "type": "storage.FileType"
9801 },
9802 {
9803 "id": "1258941372",
9804 "predicate": "storage.fileMov",
9805 "params": [],
9806 "type": "storage.FileType"
9807 },
9808 {
9809 "id": "1086091090",
9810 "predicate": "storage.filePartial",
9811 "params": [],
9812 "type": "storage.FileType"
9813 },
9814 {
9815 "id": "-1278304028",
9816 "predicate": "storage.fileMp4",
9817 "params": [],
9818 "type": "storage.FileType"
9819 },
9820 {
9821 "id": "276907596",
9822 "predicate": "storage.fileWebp",
9823 "params": [],
9824 "type": "storage.FileType"
9825 },
9826 {
9827 "id": "2086234950",
9828 "predicate": "fileLocationUnavailable",
9829 "params": [
9830 {
9831 "name": "volume_id",
9832 "type": "long"
9833 },
9834 {
9835 "name": "local_id",
9836 "type": "int"
9837 },
9838 {
9839 "name": "secret",
9840 "type": "long"
9841 }
9842 ],
9843 "type": "FileLocation"
9844 },
9845 {
9846 "id": "1406570614",
9847 "predicate": "fileLocation",
9848 "params": [
9849 {
9850 "name": "dc_id",
9851 "type": "int"
9852 },
9853 {
9854 "name": "volume_id",
9855 "type": "long"
9856 },
9857 {
9858 "name": "local_id",
9859 "type": "int"
9860 },
9861 {
9862 "name": "secret",
9863 "type": "long"
9864 }
9865 ],
9866 "type": "FileLocation"
9867 },
9868 {
9869 "id": "537022650",
9870 "predicate": "userEmpty",
9871 "params": [
9872 {
9873 "name": "id",
9874 "type": "int"
9875 }
9876 ],
9877 "type": "User"
9878 },
9879 {
9880 "id": "1326562017",
9881 "predicate": "userProfilePhotoEmpty",
9882 "params": [],
9883 "type": "UserProfilePhoto"
9884 },
9885 {
9886 "id": "-715532088",
9887 "predicate": "userProfilePhoto",
9888 "params": [
9889 {
9890 "name": "photo_id",
9891 "type": "long"
9892 },
9893 {
9894 "name": "photo_small",
9895 "type": "FileLocation"
9896 },
9897 {
9898 "name": "photo_big",
9899 "type": "FileLocation"
9900 }
9901 ],
9902 "type": "UserProfilePhoto"
9903 },
9904 {
9905 "id": "164646985",
9906 "predicate": "userStatusEmpty",
9907 "params": [],
9908 "type": "UserStatus"
9909 },
9910 {
9911 "id": "-306628279",
9912 "predicate": "userStatusOnline",
9913 "params": [
9914 {
9915 "name": "expires",
9916 "type": "int"
9917 }
9918 ],
9919 "type": "UserStatus"
9920 },
9921 {
9922 "id": "9203775",
9923 "predicate": "userStatusOffline",
9924 "params": [
9925 {
9926 "name": "was_online",
9927 "type": "int"
9928 }
9929 ],
9930 "type": "UserStatus"
9931 },
9932 {
9933 "id": "-1683826688",
9934 "predicate": "chatEmpty",
9935 "params": [
9936 {
9937 "name": "id",
9938 "type": "int"
9939 }
9940 ],
9941 "type": "Chat"
9942 },
9943 {
9944 "id": "-652419756",
9945 "predicate": "chat",
9946 "params": [
9947 {
9948 "name": "flags",
9949 "type": "#"
9950 },
9951 {
9952 "name": "creator",
9953 "type": "flags.0?true"
9954 },
9955 {
9956 "name": "kicked",
9957 "type": "flags.1?true"
9958 },
9959 {
9960 "name": "left",
9961 "type": "flags.2?true"
9962 },
9963 {
9964 "name": "admins_enabled",
9965 "type": "flags.3?true"
9966 },
9967 {
9968 "name": "admin",
9969 "type": "flags.4?true"
9970 },
9971 {
9972 "name": "deactivated",
9973 "type": "flags.5?true"
9974 },
9975 {
9976 "name": "id",
9977 "type": "int"
9978 },
9979 {
9980 "name": "title",
9981 "type": "string"
9982 },
9983 {
9984 "name": "photo",
9985 "type": "ChatPhoto"
9986 },
9987 {
9988 "name": "participants_count",
9989 "type": "int"
9990 },
9991 {
9992 "name": "date",
9993 "type": "int"
9994 },
9995 {
9996 "name": "version",
9997 "type": "int"
9998 },
9999 {
10000 "name": "migrated_to",
10001 "type": "flags.6?InputChannel"
10002 }
10003 ],
10004 "type": "Chat"
10005 },
10006 {
10007 "id": "120753115",
10008 "predicate": "chatForbidden",
10009 "params": [
10010 {
10011 "name": "id",
10012 "type": "int"
10013 },
10014 {
10015 "name": "title",
10016 "type": "string"
10017 }
10018 ],
10019 "type": "Chat"
10020 },
10021 {
10022 "id": "771925524",
10023 "predicate": "chatFull",
10024 "params": [
10025 {
10026 "name": "id",
10027 "type": "int"
10028 },
10029 {
10030 "name": "participants",
10031 "type": "ChatParticipants"
10032 },
10033 {
10034 "name": "chat_photo",
10035 "type": "Photo"
10036 },
10037 {
10038 "name": "notify_settings",
10039 "type": "PeerNotifySettings"
10040 },
10041 {
10042 "name": "exported_invite",
10043 "type": "ExportedChatInvite"
10044 },
10045 {
10046 "name": "bot_info",
10047 "type": "Vector<BotInfo>"
10048 }
10049 ],
10050 "type": "ChatFull"
10051 },
10052 {
10053 "id": "-925415106",
10054 "predicate": "chatParticipant",
10055 "params": [
10056 {
10057 "name": "user_id",
10058 "type": "int"
10059 },
10060 {
10061 "name": "inviter_id",
10062 "type": "int"
10063 },
10064 {
10065 "name": "date",
10066 "type": "int"
10067 }
10068 ],
10069 "type": "ChatParticipant"
10070 },
10071 {
10072 "id": "-57668565",
10073 "predicate": "chatParticipantsForbidden",
10074 "params": [
10075 {
10076 "name": "flags",
10077 "type": "#"
10078 },
10079 {
10080 "name": "chat_id",
10081 "type": "int"
10082 },
10083 {
10084 "name": "self_participant",
10085 "type": "flags.0?ChatParticipant"
10086 }
10087 ],
10088 "type": "ChatParticipants"
10089 },
10090 {
10091 "id": "1061556205",
10092 "predicate": "chatParticipants",
10093 "params": [
10094 {
10095 "name": "chat_id",
10096 "type": "int"
10097 },
10098 {
10099 "name": "participants",
10100 "type": "Vector<ChatParticipant>"
10101 },
10102 {
10103 "name": "version",
10104 "type": "int"
10105 }
10106 ],
10107 "type": "ChatParticipants"
10108 },
10109 {
10110 "id": "935395612",
10111 "predicate": "chatPhotoEmpty",
10112 "params": [],
10113 "type": "ChatPhoto"
10114 },
10115 {
10116 "id": "1632839530",
10117 "predicate": "chatPhoto",
10118 "params": [
10119 {
10120 "name": "photo_small",
10121 "type": "FileLocation"
10122 },
10123 {
10124 "name": "photo_big",
10125 "type": "FileLocation"
10126 }
10127 ],
10128 "type": "ChatPhoto"
10129 },
10130 {
10131 "id": "-2082087340",
10132 "predicate": "messageEmpty",
10133 "params": [
10134 {
10135 "name": "id",
10136 "type": "int"
10137 }
10138 ],
10139 "type": "Message"
10140 },
10141 {
10142 "id": "-1063525281",
10143 "predicate": "message",
10144 "params": [
10145 {
10146 "name": "flags",
10147 "type": "#"
10148 },
10149 {
10150 "name": "out",
10151 "type": "flags.1?true"
10152 },
10153 {
10154 "name": "mentioned",
10155 "type": "flags.4?true"
10156 },
10157 {
10158 "name": "media_unread",
10159 "type": "flags.5?true"
10160 },
10161 {
10162 "name": "silent",
10163 "type": "flags.13?true"
10164 },
10165 {
10166 "name": "post",
10167 "type": "flags.14?true"
10168 },
10169 {
10170 "name": "id",
10171 "type": "int"
10172 },
10173 {
10174 "name": "from_id",
10175 "type": "flags.8?int"
10176 },
10177 {
10178 "name": "to_id",
10179 "type": "Peer"
10180 },
10181 {
10182 "name": "fwd_from",
10183 "type": "flags.2?MessageFwdHeader"
10184 },
10185 {
10186 "name": "via_bot_id",
10187 "type": "flags.11?int"
10188 },
10189 {
10190 "name": "reply_to_msg_id",
10191 "type": "flags.3?int"
10192 },
10193 {
10194 "name": "date",
10195 "type": "int"
10196 },
10197 {
10198 "name": "message",
10199 "type": "string"
10200 },
10201 {
10202 "name": "media",
10203 "type": "flags.9?MessageMedia"
10204 },
10205 {
10206 "name": "reply_markup",
10207 "type": "flags.6?ReplyMarkup"
10208 },
10209 {
10210 "name": "entities",
10211 "type": "flags.7?Vector<MessageEntity>"
10212 },
10213 {
10214 "name": "views",
10215 "type": "flags.10?int"
10216 },
10217 {
10218 "name": "edit_date",
10219 "type": "flags.15?int"
10220 }
10221 ],
10222 "type": "Message"
10223 },
10224 {
10225 "id": "-1642487306",
10226 "predicate": "messageService",
10227 "params": [
10228 {
10229 "name": "flags",
10230 "type": "#"
10231 },
10232 {
10233 "name": "out",
10234 "type": "flags.1?true"
10235 },
10236 {
10237 "name": "mentioned",
10238 "type": "flags.4?true"
10239 },
10240 {
10241 "name": "media_unread",
10242 "type": "flags.5?true"
10243 },
10244 {
10245 "name": "silent",
10246 "type": "flags.13?true"
10247 },
10248 {
10249 "name": "post",
10250 "type": "flags.14?true"
10251 },
10252 {
10253 "name": "id",
10254 "type": "int"
10255 },
10256 {
10257 "name": "from_id",
10258 "type": "flags.8?int"
10259 },
10260 {
10261 "name": "to_id",
10262 "type": "Peer"
10263 },
10264 {
10265 "name": "reply_to_msg_id",
10266 "type": "flags.3?int"
10267 },
10268 {
10269 "name": "date",
10270 "type": "int"
10271 },
10272 {
10273 "name": "action",
10274 "type": "MessageAction"
10275 }
10276 ],
10277 "type": "Message"
10278 },
10279 {
10280 "id": "1038967584",
10281 "predicate": "messageMediaEmpty",
10282 "params": [],
10283 "type": "MessageMedia"
10284 },
10285 {
10286 "id": "1032643901",
10287 "predicate": "messageMediaPhoto",
10288 "params": [
10289 {
10290 "name": "photo",
10291 "type": "Photo"
10292 },
10293 {
10294 "name": "caption",
10295 "type": "string"
10296 }
10297 ],
10298 "type": "MessageMedia"
10299 },
10300 {
10301 "id": "1457575028",
10302 "predicate": "messageMediaGeo",
10303 "params": [
10304 {
10305 "name": "geo",
10306 "type": "GeoPoint"
10307 }
10308 ],
10309 "type": "MessageMedia"
10310 },
10311 {
10312 "id": "1585262393",
10313 "predicate": "messageMediaContact",
10314 "params": [
10315 {
10316 "name": "phone_number",
10317 "type": "string"
10318 },
10319 {
10320 "name": "first_name",
10321 "type": "string"
10322 },
10323 {
10324 "name": "last_name",
10325 "type": "string"
10326 },
10327 {
10328 "name": "user_id",
10329 "type": "int"
10330 }
10331 ],
10332 "type": "MessageMedia"
10333 },
10334 {
10335 "id": "-1618676578",
10336 "predicate": "messageMediaUnsupported",
10337 "params": [],
10338 "type": "MessageMedia"
10339 },
10340 {
10341 "id": "-1230047312",
10342 "predicate": "messageActionEmpty",
10343 "params": [],
10344 "type": "MessageAction"
10345 },
10346 {
10347 "id": "-1503425638",
10348 "predicate": "messageActionChatCreate",
10349 "params": [
10350 {
10351 "name": "title",
10352 "type": "string"
10353 },
10354 {
10355 "name": "users",
10356 "type": "Vector<int>"
10357 }
10358 ],
10359 "type": "MessageAction"
10360 },
10361 {
10362 "id": "-1247687078",
10363 "predicate": "messageActionChatEditTitle",
10364 "params": [
10365 {
10366 "name": "title",
10367 "type": "string"
10368 }
10369 ],
10370 "type": "MessageAction"
10371 },
10372 {
10373 "id": "2144015272",
10374 "predicate": "messageActionChatEditPhoto",
10375 "params": [
10376 {
10377 "name": "photo",
10378 "type": "Photo"
10379 }
10380 ],
10381 "type": "MessageAction"
10382 },
10383 {
10384 "id": "-1780220945",
10385 "predicate": "messageActionChatDeletePhoto",
10386 "params": [],
10387 "type": "MessageAction"
10388 },
10389 {
10390 "id": "1217033015",
10391 "predicate": "messageActionChatAddUser",
10392 "params": [
10393 {
10394 "name": "users",
10395 "type": "Vector<int>"
10396 }
10397 ],
10398 "type": "MessageAction"
10399 },
10400 {
10401 "id": "-1297179892",
10402 "predicate": "messageActionChatDeleteUser",
10403 "params": [
10404 {
10405 "name": "user_id",
10406 "type": "int"
10407 }
10408 ],
10409 "type": "MessageAction"
10410 },
10411 {
10412 "id": "1728035348",
10413 "predicate": "dialog",
10414 "params": [
10415 {
10416 "name": "flags",
10417 "type": "#"
10418 },
10419 {
10420 "name": "peer",
10421 "type": "Peer"
10422 },
10423 {
10424 "name": "top_message",
10425 "type": "int"
10426 },
10427 {
10428 "name": "read_inbox_max_id",
10429 "type": "int"
10430 },
10431 {
10432 "name": "read_outbox_max_id",
10433 "type": "int"
10434 },
10435 {
10436 "name": "unread_count",
10437 "type": "int"
10438 },
10439 {
10440 "name": "notify_settings",
10441 "type": "PeerNotifySettings"
10442 },
10443 {
10444 "name": "pts",
10445 "type": "flags.0?int"
10446 },
10447 {
10448 "name": "draft",
10449 "type": "flags.1?DraftMessage"
10450 }
10451 ],
10452 "type": "Dialog"
10453 },
10454 {
10455 "id": "590459437",
10456 "predicate": "photoEmpty",
10457 "params": [
10458 {
10459 "name": "id",
10460 "type": "long"
10461 }
10462 ],
10463 "type": "Photo"
10464 },
10465 {
10466 "id": "-1836524247",
10467 "predicate": "photo",
10468 "params": [
10469 {
10470 "name": "flags",
10471 "type": "#"
10472 },
10473 {
10474 "name": "has_stickers",
10475 "type": "flags.0?true"
10476 },
10477 {
10478 "name": "id",
10479 "type": "long"
10480 },
10481 {
10482 "name": "access_hash",
10483 "type": "long"
10484 },
10485 {
10486 "name": "date",
10487 "type": "int"
10488 },
10489 {
10490 "name": "sizes",
10491 "type": "Vector<PhotoSize>"
10492 }
10493 ],
10494 "type": "Photo"
10495 },
10496 {
10497 "id": "236446268",
10498 "predicate": "photoSizeEmpty",
10499 "params": [
10500 {
10501 "name": "type",
10502 "type": "string"
10503 }
10504 ],
10505 "type": "PhotoSize"
10506 },
10507 {
10508 "id": "2009052699",
10509 "predicate": "photoSize",
10510 "params": [
10511 {
10512 "name": "type",
10513 "type": "string"
10514 },
10515 {
10516 "name": "location",
10517 "type": "FileLocation"
10518 },
10519 {
10520 "name": "w",
10521 "type": "int"
10522 },
10523 {
10524 "name": "h",
10525 "type": "int"
10526 },
10527 {
10528 "name": "size",
10529 "type": "int"
10530 }
10531 ],
10532 "type": "PhotoSize"
10533 },
10534 {
10535 "id": "-374917894",
10536 "predicate": "photoCachedSize",
10537 "params": [
10538 {
10539 "name": "type",
10540 "type": "string"
10541 },
10542 {
10543 "name": "location",
10544 "type": "FileLocation"
10545 },
10546 {
10547 "name": "w",
10548 "type": "int"
10549 },
10550 {
10551 "name": "h",
10552 "type": "int"
10553 },
10554 {
10555 "name": "bytes",
10556 "type": "bytes"
10557 }
10558 ],
10559 "type": "PhotoSize"
10560 },
10561 {
10562 "id": "286776671",
10563 "predicate": "geoPointEmpty",
10564 "params": [],
10565 "type": "GeoPoint"
10566 },
10567 {
10568 "id": "541710092",
10569 "predicate": "geoPoint",
10570 "params": [
10571 {
10572 "name": "long",
10573 "type": "double"
10574 },
10575 {
10576 "name": "lat",
10577 "type": "double"
10578 }
10579 ],
10580 "type": "GeoPoint"
10581 },
10582 {
10583 "id": "-2128698738",
10584 "predicate": "auth.checkedPhone",
10585 "params": [
10586 {
10587 "name": "phone_registered",
10588 "type": "Bool"
10589 }
10590 ],
10591 "type": "auth.CheckedPhone"
10592 },
10593 {
10594 "id": "1577067778",
10595 "predicate": "auth.sentCode",
10596 "params": [
10597 {
10598 "name": "flags",
10599 "type": "#"
10600 },
10601 {
10602 "name": "phone_registered",
10603 "type": "flags.0?true"
10604 },
10605 {
10606 "name": "type",
10607 "type": "auth.SentCodeType"
10608 },
10609 {
10610 "name": "phone_code_hash",
10611 "type": "string"
10612 },
10613 {
10614 "name": "next_type",
10615 "type": "flags.1?auth.CodeType"
10616 },
10617 {
10618 "name": "timeout",
10619 "type": "flags.2?int"
10620 }
10621 ],
10622 "type": "auth.SentCode"
10623 },
10624 {
10625 "id": "-855308010",
10626 "predicate": "auth.authorization",
10627 "params": [
10628 {
10629 "name": "flags",
10630 "type": "#"
10631 },
10632 {
10633 "name": "tmp_sessions",
10634 "type": "flags.0?int"
10635 },
10636 {
10637 "name": "user",
10638 "type": "User"
10639 }
10640 ],
10641 "type": "auth.Authorization"
10642 },
10643 {
10644 "id": "-543777747",
10645 "predicate": "auth.exportedAuthorization",
10646 "params": [
10647 {
10648 "name": "id",
10649 "type": "int"
10650 },
10651 {
10652 "name": "bytes",
10653 "type": "bytes"
10654 }
10655 ],
10656 "type": "auth.ExportedAuthorization"
10657 },
10658 {
10659 "id": "-1195615476",
10660 "predicate": "inputNotifyPeer",
10661 "params": [
10662 {
10663 "name": "peer",
10664 "type": "InputPeer"
10665 }
10666 ],
10667 "type": "InputNotifyPeer"
10668 },
10669 {
10670 "id": "423314455",
10671 "predicate": "inputNotifyUsers",
10672 "params": [],
10673 "type": "InputNotifyPeer"
10674 },
10675 {
10676 "id": "1251338318",
10677 "predicate": "inputNotifyChats",
10678 "params": [],
10679 "type": "InputNotifyPeer"
10680 },
10681 {
10682 "id": "-1540769658",
10683 "predicate": "inputNotifyAll",
10684 "params": [],
10685 "type": "InputNotifyPeer"
10686 },
10687 {
10688 "id": "-265263912",
10689 "predicate": "inputPeerNotifyEventsEmpty",
10690 "params": [],
10691 "type": "InputPeerNotifyEvents"
10692 },
10693 {
10694 "id": "-395694988",
10695 "predicate": "inputPeerNotifyEventsAll",
10696 "params": [],
10697 "type": "InputPeerNotifyEvents"
10698 },
10699 {
10700 "id": "949182130",
10701 "predicate": "inputPeerNotifySettings",
10702 "params": [
10703 {
10704 "name": "flags",
10705 "type": "#"
10706 },
10707 {
10708 "name": "show_previews",
10709 "type": "flags.0?true"
10710 },
10711 {
10712 "name": "silent",
10713 "type": "flags.1?true"
10714 },
10715 {
10716 "name": "mute_until",
10717 "type": "int"
10718 },
10719 {
10720 "name": "sound",
10721 "type": "string"
10722 }
10723 ],
10724 "type": "InputPeerNotifySettings"
10725 },
10726 {
10727 "id": "-1378534221",
10728 "predicate": "peerNotifyEventsEmpty",
10729 "params": [],
10730 "type": "PeerNotifyEvents"
10731 },
10732 {
10733 "id": "1830677896",
10734 "predicate": "peerNotifyEventsAll",
10735 "params": [],
10736 "type": "PeerNotifyEvents"
10737 },
10738 {
10739 "id": "1889961234",
10740 "predicate": "peerNotifySettingsEmpty",
10741 "params": [],
10742 "type": "PeerNotifySettings"
10743 },
10744 {
10745 "id": "-1697798976",
10746 "predicate": "peerNotifySettings",
10747 "params": [
10748 {
10749 "name": "flags",
10750 "type": "#"
10751 },
10752 {
10753 "name": "show_previews",
10754 "type": "flags.0?true"
10755 },
10756 {
10757 "name": "silent",
10758 "type": "flags.1?true"
10759 },
10760 {
10761 "name": "mute_until",
10762 "type": "int"
10763 },
10764 {
10765 "name": "sound",
10766 "type": "string"
10767 }
10768 ],
10769 "type": "PeerNotifySettings"
10770 },
10771 {
10772 "id": "-2122045747",
10773 "predicate": "peerSettings",
10774 "params": [
10775 {
10776 "name": "flags",
10777 "type": "#"
10778 },
10779 {
10780 "name": "report_spam",
10781 "type": "flags.0?true"
10782 }
10783 ],
10784 "type": "PeerSettings"
10785 },
10786 {
10787 "id": "-860866985",
10788 "predicate": "wallPaper",
10789 "params": [
10790 {
10791 "name": "id",
10792 "type": "int"
10793 },
10794 {
10795 "name": "title",
10796 "type": "string"
10797 },
10798 {
10799 "name": "sizes",
10800 "type": "Vector<PhotoSize>"
10801 },
10802 {
10803 "name": "color",
10804 "type": "int"
10805 }
10806 ],
10807 "type": "WallPaper"
10808 },
10809 {
10810 "id": "1490799288",
10811 "predicate": "inputReportReasonSpam",
10812 "params": [],
10813 "type": "ReportReason"
10814 },
10815 {
10816 "id": "505595789",
10817 "predicate": "inputReportReasonViolence",
10818 "params": [],
10819 "type": "ReportReason"
10820 },
10821 {
10822 "id": "777640226",
10823 "predicate": "inputReportReasonPornography",
10824 "params": [],
10825 "type": "ReportReason"
10826 },
10827 {
10828 "id": "-512463606",
10829 "predicate": "inputReportReasonOther",
10830 "params": [
10831 {
10832 "name": "text",
10833 "type": "string"
10834 }
10835 ],
10836 "type": "ReportReason"
10837 },
10838 {
10839 "id": "1496513539",
10840 "predicate": "userFull",
10841 "params": [
10842 {
10843 "name": "flags",
10844 "type": "#"
10845 },
10846 {
10847 "name": "blocked",
10848 "type": "flags.0?true"
10849 },
10850 {
10851 "name": "user",
10852 "type": "User"
10853 },
10854 {
10855 "name": "about",
10856 "type": "flags.1?string"
10857 },
10858 {
10859 "name": "link",
10860 "type": "contacts.Link"
10861 },
10862 {
10863 "name": "profile_photo",
10864 "type": "flags.2?Photo"
10865 },
10866 {
10867 "name": "notify_settings",
10868 "type": "PeerNotifySettings"
10869 },
10870 {
10871 "name": "bot_info",
10872 "type": "flags.3?BotInfo"
10873 }
10874 ],
10875 "type": "UserFull"
10876 },
10877 {
10878 "id": "-116274796",
10879 "predicate": "contact",
10880 "params": [
10881 {
10882 "name": "user_id",
10883 "type": "int"
10884 },
10885 {
10886 "name": "mutual",
10887 "type": "Bool"
10888 }
10889 ],
10890 "type": "Contact"
10891 },
10892 {
10893 "id": "-805141448",
10894 "predicate": "importedContact",
10895 "params": [
10896 {
10897 "name": "user_id",
10898 "type": "int"
10899 },
10900 {
10901 "name": "client_id",
10902 "type": "long"
10903 }
10904 ],
10905 "type": "ImportedContact"
10906 },
10907 {
10908 "id": "1444661369",
10909 "predicate": "contactBlocked",
10910 "params": [
10911 {
10912 "name": "user_id",
10913 "type": "int"
10914 },
10915 {
10916 "name": "date",
10917 "type": "int"
10918 }
10919 ],
10920 "type": "ContactBlocked"
10921 },
10922 {
10923 "id": "-748155807",
10924 "predicate": "contactStatus",
10925 "params": [
10926 {
10927 "name": "user_id",
10928 "type": "int"
10929 },
10930 {
10931 "name": "status",
10932 "type": "UserStatus"
10933 }
10934 ],
10935 "type": "ContactStatus"
10936 },
10937 {
10938 "id": "986597452",
10939 "predicate": "contacts.link",
10940 "params": [
10941 {
10942 "name": "my_link",
10943 "type": "ContactLink"
10944 },
10945 {
10946 "name": "foreign_link",
10947 "type": "ContactLink"
10948 },
10949 {
10950 "name": "user",
10951 "type": "User"
10952 }
10953 ],
10954 "type": "contacts.Link"
10955 },
10956 {
10957 "id": "-1219778094",
10958 "predicate": "contacts.contactsNotModified",
10959 "params": [],
10960 "type": "contacts.Contacts"
10961 },
10962 {
10963 "id": "1871416498",
10964 "predicate": "contacts.contacts",
10965 "params": [
10966 {
10967 "name": "contacts",
10968 "type": "Vector<Contact>"
10969 },
10970 {
10971 "name": "users",
10972 "type": "Vector<User>"
10973 }
10974 ],
10975 "type": "contacts.Contacts"
10976 },
10977 {
10978 "id": "-1387117803",
10979 "predicate": "contacts.importedContacts",
10980 "params": [
10981 {
10982 "name": "imported",
10983 "type": "Vector<ImportedContact>"
10984 },
10985 {
10986 "name": "retry_contacts",
10987 "type": "Vector<long>"
10988 },
10989 {
10990 "name": "users",
10991 "type": "Vector<User>"
10992 }
10993 ],
10994 "type": "contacts.ImportedContacts"
10995 },
10996 {
10997 "id": "471043349",
10998 "predicate": "contacts.blocked",
10999 "params": [
11000 {
11001 "name": "blocked",
11002 "type": "Vector<ContactBlocked>"
11003 },
11004 {
11005 "name": "users",
11006 "type": "Vector<User>"
11007 }
11008 ],
11009 "type": "contacts.Blocked"
11010 },
11011 {
11012 "id": "-1878523231",
11013 "predicate": "contacts.blockedSlice",
11014 "params": [
11015 {
11016 "name": "count",
11017 "type": "int"
11018 },
11019 {
11020 "name": "blocked",
11021 "type": "Vector<ContactBlocked>"
11022 },
11023 {
11024 "name": "users",
11025 "type": "Vector<User>"
11026 }
11027 ],
11028 "type": "contacts.Blocked"
11029 },
11030 {
11031 "id": "364538944",
11032 "predicate": "messages.dialogs",
11033 "params": [
11034 {
11035 "name": "dialogs",
11036 "type": "Vector<Dialog>"
11037 },
11038 {
11039 "name": "messages",
11040 "type": "Vector<Message>"
11041 },
11042 {
11043 "name": "chats",
11044 "type": "Vector<Chat>"
11045 },
11046 {
11047 "name": "users",
11048 "type": "Vector<User>"
11049 }
11050 ],
11051 "type": "messages.Dialogs"
11052 },
11053 {
11054 "id": "1910543603",
11055 "predicate": "messages.dialogsSlice",
11056 "params": [
11057 {
11058 "name": "count",
11059 "type": "int"
11060 },
11061 {
11062 "name": "dialogs",
11063 "type": "Vector<Dialog>"
11064 },
11065 {
11066 "name": "messages",
11067 "type": "Vector<Message>"
11068 },
11069 {
11070 "name": "chats",
11071 "type": "Vector<Chat>"
11072 },
11073 {
11074 "name": "users",
11075 "type": "Vector<User>"
11076 }
11077 ],
11078 "type": "messages.Dialogs"
11079 },
11080 {
11081 "id": "-1938715001",
11082 "predicate": "messages.messages",
11083 "params": [
11084 {
11085 "name": "messages",
11086 "type": "Vector<Message>"
11087 },
11088 {
11089 "name": "chats",
11090 "type": "Vector<Chat>"
11091 },
11092 {
11093 "name": "users",
11094 "type": "Vector<User>"
11095 }
11096 ],
11097 "type": "messages.Messages"
11098 },
11099 {
11100 "id": "189033187",
11101 "predicate": "messages.messagesSlice",
11102 "params": [
11103 {
11104 "name": "count",
11105 "type": "int"
11106 },
11107 {
11108 "name": "messages",
11109 "type": "Vector<Message>"
11110 },
11111 {
11112 "name": "chats",
11113 "type": "Vector<Chat>"
11114 },
11115 {
11116 "name": "users",
11117 "type": "Vector<User>"
11118 }
11119 ],
11120 "type": "messages.Messages"
11121 },
11122 {
11123 "id": "1694474197",
11124 "predicate": "messages.chats",
11125 "params": [
11126 {
11127 "name": "chats",
11128 "type": "Vector<Chat>"
11129 }
11130 ],
11131 "type": "messages.Chats"
11132 },
11133 {
11134 "id": "-438840932",
11135 "predicate": "messages.chatFull",
11136 "params": [
11137 {
11138 "name": "full_chat",
11139 "type": "ChatFull"
11140 },
11141 {
11142 "name": "chats",
11143 "type": "Vector<Chat>"
11144 },
11145 {
11146 "name": "users",
11147 "type": "Vector<User>"
11148 }
11149 ],
11150 "type": "messages.ChatFull"
11151 },
11152 {
11153 "id": "-1269012015",
11154 "predicate": "messages.affectedHistory",
11155 "params": [
11156 {
11157 "name": "pts",
11158 "type": "int"
11159 },
11160 {
11161 "name": "pts_count",
11162 "type": "int"
11163 },
11164 {
11165 "name": "offset",
11166 "type": "int"
11167 }
11168 ],
11169 "type": "messages.AffectedHistory"
11170 },
11171 {
11172 "id": "1474492012",
11173 "predicate": "inputMessagesFilterEmpty",
11174 "params": [],
11175 "type": "MessagesFilter"
11176 },
11177 {
11178 "id": "-1777752804",
11179 "predicate": "inputMessagesFilterPhotos",
11180 "params": [],
11181 "type": "MessagesFilter"
11182 },
11183 {
11184 "id": "-1614803355",
11185 "predicate": "inputMessagesFilterVideo",
11186 "params": [],
11187 "type": "MessagesFilter"
11188 },
11189 {
11190 "id": "1458172132",
11191 "predicate": "inputMessagesFilterPhotoVideo",
11192 "params": [],
11193 "type": "MessagesFilter"
11194 },
11195 {
11196 "id": "-648121413",
11197 "predicate": "inputMessagesFilterPhotoVideoDocuments",
11198 "params": [],
11199 "type": "MessagesFilter"
11200 },
11201 {
11202 "id": "-1629621880",
11203 "predicate": "inputMessagesFilterDocument",
11204 "params": [],
11205 "type": "MessagesFilter"
11206 },
11207 {
11208 "id": "2129714567",
11209 "predicate": "inputMessagesFilterUrl",
11210 "params": [],
11211 "type": "MessagesFilter"
11212 },
11213 {
11214 "id": "-3644025",
11215 "predicate": "inputMessagesFilterGif",
11216 "params": [],
11217 "type": "MessagesFilter"
11218 },
11219 {
11220 "id": "522914557",
11221 "predicate": "updateNewMessage",
11222 "params": [
11223 {
11224 "name": "message",
11225 "type": "Message"
11226 },
11227 {
11228 "name": "pts",
11229 "type": "int"
11230 },
11231 {
11232 "name": "pts_count",
11233 "type": "int"
11234 }
11235 ],
11236 "type": "Update"
11237 },
11238 {
11239 "id": "1318109142",
11240 "predicate": "updateMessageID",
11241 "params": [
11242 {
11243 "name": "id",
11244 "type": "int"
11245 },
11246 {
11247 "name": "random_id",
11248 "type": "long"
11249 }
11250 ],
11251 "type": "Update"
11252 },
11253 {
11254 "id": "-1576161051",
11255 "predicate": "updateDeleteMessages",
11256 "params": [
11257 {
11258 "name": "messages",
11259 "type": "Vector<int>"
11260 },
11261 {
11262 "name": "pts",
11263 "type": "int"
11264 },
11265 {
11266 "name": "pts_count",
11267 "type": "int"
11268 }
11269 ],
11270 "type": "Update"
11271 },
11272 {
11273 "id": "1548249383",
11274 "predicate": "updateUserTyping",
11275 "params": [
11276 {
11277 "name": "user_id",
11278 "type": "int"
11279 },
11280 {
11281 "name": "action",
11282 "type": "SendMessageAction"
11283 }
11284 ],
11285 "type": "Update"
11286 },
11287 {
11288 "id": "-1704596961",
11289 "predicate": "updateChatUserTyping",
11290 "params": [
11291 {
11292 "name": "chat_id",
11293 "type": "int"
11294 },
11295 {
11296 "name": "user_id",
11297 "type": "int"
11298 },
11299 {
11300 "name": "action",
11301 "type": "SendMessageAction"
11302 }
11303 ],
11304 "type": "Update"
11305 },
11306 {
11307 "id": "125178264",
11308 "predicate": "updateChatParticipants",
11309 "params": [
11310 {
11311 "name": "participants",
11312 "type": "ChatParticipants"
11313 }
11314 ],
11315 "type": "Update"
11316 },
11317 {
11318 "id": "469489699",
11319 "predicate": "updateUserStatus",
11320 "params": [
11321 {
11322 "name": "user_id",
11323 "type": "int"
11324 },
11325 {
11326 "name": "status",
11327 "type": "UserStatus"
11328 }
11329 ],
11330 "type": "Update"
11331 },
11332 {
11333 "id": "-1489818765",
11334 "predicate": "updateUserName",
11335 "params": [
11336 {
11337 "name": "user_id",
11338 "type": "int"
11339 },
11340 {
11341 "name": "first_name",
11342 "type": "string"
11343 },
11344 {
11345 "name": "last_name",
11346 "type": "string"
11347 },
11348 {
11349 "name": "username",
11350 "type": "string"
11351 }
11352 ],
11353 "type": "Update"
11354 },
11355 {
11356 "id": "-1791935732",
11357 "predicate": "updateUserPhoto",
11358 "params": [
11359 {
11360 "name": "user_id",
11361 "type": "int"
11362 },
11363 {
11364 "name": "date",
11365 "type": "int"
11366 },
11367 {
11368 "name": "photo",
11369 "type": "UserProfilePhoto"
11370 },
11371 {
11372 "name": "previous",
11373 "type": "Bool"
11374 }
11375 ],
11376 "type": "Update"
11377 },
11378 {
11379 "id": "628472761",
11380 "predicate": "updateContactRegistered",
11381 "params": [
11382 {
11383 "name": "user_id",
11384 "type": "int"
11385 },
11386 {
11387 "name": "date",
11388 "type": "int"
11389 }
11390 ],
11391 "type": "Update"
11392 },
11393 {
11394 "id": "-1657903163",
11395 "predicate": "updateContactLink",
11396 "params": [
11397 {
11398 "name": "user_id",
11399 "type": "int"
11400 },
11401 {
11402 "name": "my_link",
11403 "type": "ContactLink"
11404 },
11405 {
11406 "name": "foreign_link",
11407 "type": "ContactLink"
11408 }
11409 ],
11410 "type": "Update"
11411 },
11412 {
11413 "id": "-1895411046",
11414 "predicate": "updateNewAuthorization",
11415 "params": [
11416 {
11417 "name": "auth_key_id",
11418 "type": "long"
11419 },
11420 {
11421 "name": "date",
11422 "type": "int"
11423 },
11424 {
11425 "name": "device",
11426 "type": "string"
11427 },
11428 {
11429 "name": "location",
11430 "type": "string"
11431 }
11432 ],
11433 "type": "Update"
11434 },
11435 {
11436 "id": "-1519637954",
11437 "predicate": "updates.state",
11438 "params": [
11439 {
11440 "name": "pts",
11441 "type": "int"
11442 },
11443 {
11444 "name": "qts",
11445 "type": "int"
11446 },
11447 {
11448 "name": "date",
11449 "type": "int"
11450 },
11451 {
11452 "name": "seq",
11453 "type": "int"
11454 },
11455 {
11456 "name": "unread_count",
11457 "type": "int"
11458 }
11459 ],
11460 "type": "updates.State"
11461 },
11462 {
11463 "id": "1567990072",
11464 "predicate": "updates.differenceEmpty",
11465 "params": [
11466 {
11467 "name": "date",
11468 "type": "int"
11469 },
11470 {
11471 "name": "seq",
11472 "type": "int"
11473 }
11474 ],
11475 "type": "updates.Difference"
11476 },
11477 {
11478 "id": "16030880",
11479 "predicate": "updates.difference",
11480 "params": [
11481 {
11482 "name": "new_messages",
11483 "type": "Vector<Message>"
11484 },
11485 {
11486 "name": "new_encrypted_messages",
11487 "type": "Vector<EncryptedMessage>"
11488 },
11489 {
11490 "name": "other_updates",
11491 "type": "Vector<Update>"
11492 },
11493 {
11494 "name": "chats",
11495 "type": "Vector<Chat>"
11496 },
11497 {
11498 "name": "users",
11499 "type": "Vector<User>"
11500 },
11501 {
11502 "name": "state",
11503 "type": "updates.State"
11504 }
11505 ],
11506 "type": "updates.Difference"
11507 },
11508 {
11509 "id": "-1459938943",
11510 "predicate": "updates.differenceSlice",
11511 "params": [
11512 {
11513 "name": "new_messages",
11514 "type": "Vector<Message>"
11515 },
11516 {
11517 "name": "new_encrypted_messages",
11518 "type": "Vector<EncryptedMessage>"
11519 },
11520 {
11521 "name": "other_updates",
11522 "type": "Vector<Update>"
11523 },
11524 {
11525 "name": "chats",
11526 "type": "Vector<Chat>"
11527 },
11528 {
11529 "name": "users",
11530 "type": "Vector<User>"
11531 },
11532 {
11533 "name": "intermediate_state",
11534 "type": "updates.State"
11535 }
11536 ],
11537 "type": "updates.Difference"
11538 },
11539 {
11540 "id": "-484987010",
11541 "predicate": "updatesTooLong",
11542 "params": [],
11543 "type": "Updates"
11544 },
11545 {
11546 "id": "-1857044719",
11547 "predicate": "updateShortMessage",
11548 "params": [
11549 {
11550 "name": "flags",
11551 "type": "#"
11552 },
11553 {
11554 "name": "out",
11555 "type": "flags.1?true"
11556 },
11557 {
11558 "name": "mentioned",
11559 "type": "flags.4?true"
11560 },
11561 {
11562 "name": "media_unread",
11563 "type": "flags.5?true"
11564 },
11565 {
11566 "name": "silent",
11567 "type": "flags.13?true"
11568 },
11569 {
11570 "name": "id",
11571 "type": "int"
11572 },
11573 {
11574 "name": "user_id",
11575 "type": "int"
11576 },
11577 {
11578 "name": "message",
11579 "type": "string"
11580 },
11581 {
11582 "name": "pts",
11583 "type": "int"
11584 },
11585 {
11586 "name": "pts_count",
11587 "type": "int"
11588 },
11589 {
11590 "name": "date",
11591 "type": "int"
11592 },
11593 {
11594 "name": "fwd_from",
11595 "type": "flags.2?MessageFwdHeader"
11596 },
11597 {
11598 "name": "via_bot_id",
11599 "type": "flags.11?int"
11600 },
11601 {
11602 "name": "reply_to_msg_id",
11603 "type": "flags.3?int"
11604 },
11605 {
11606 "name": "entities",
11607 "type": "flags.7?Vector<MessageEntity>"
11608 }
11609 ],
11610 "type": "Updates"
11611 },
11612 {
11613 "id": "377562760",
11614 "predicate": "updateShortChatMessage",
11615 "params": [
11616 {
11617 "name": "flags",
11618 "type": "#"
11619 },
11620 {
11621 "name": "out",
11622 "type": "flags.1?true"
11623 },
11624 {
11625 "name": "mentioned",
11626 "type": "flags.4?true"
11627 },
11628 {
11629 "name": "media_unread",
11630 "type": "flags.5?true"
11631 },
11632 {
11633 "name": "silent",
11634 "type": "flags.13?true"
11635 },
11636 {
11637 "name": "id",
11638 "type": "int"
11639 },
11640 {
11641 "name": "from_id",
11642 "type": "int"
11643 },
11644 {
11645 "name": "chat_id",
11646 "type": "int"
11647 },
11648 {
11649 "name": "message",
11650 "type": "string"
11651 },
11652 {
11653 "name": "pts",
11654 "type": "int"
11655 },
11656 {
11657 "name": "pts_count",
11658 "type": "int"
11659 },
11660 {
11661 "name": "date",
11662 "type": "int"
11663 },
11664 {
11665 "name": "fwd_from",
11666 "type": "flags.2?MessageFwdHeader"
11667 },
11668 {
11669 "name": "via_bot_id",
11670 "type": "flags.11?int"
11671 },
11672 {
11673 "name": "reply_to_msg_id",
11674 "type": "flags.3?int"
11675 },
11676 {
11677 "name": "entities",
11678 "type": "flags.7?Vector<MessageEntity>"
11679 }
11680 ],
11681 "type": "Updates"
11682 },
11683 {
11684 "id": "2027216577",
11685 "predicate": "updateShort",
11686 "params": [
11687 {
11688 "name": "update",
11689 "type": "Update"
11690 },
11691 {
11692 "name": "date",
11693 "type": "int"
11694 }
11695 ],
11696 "type": "Updates"
11697 },
11698 {
11699 "id": "1918567619",
11700 "predicate": "updatesCombined",
11701 "params": [
11702 {
11703 "name": "updates",
11704 "type": "Vector<Update>"
11705 },
11706 {
11707 "name": "users",
11708 "type": "Vector<User>"
11709 },
11710 {
11711 "name": "chats",
11712 "type": "Vector<Chat>"
11713 },
11714 {
11715 "name": "date",
11716 "type": "int"
11717 },
11718 {
11719 "name": "seq_start",
11720 "type": "int"
11721 },
11722 {
11723 "name": "seq",
11724 "type": "int"
11725 }
11726 ],
11727 "type": "Updates"
11728 },
11729 {
11730 "id": "1957577280",
11731 "predicate": "updates",
11732 "params": [
11733 {
11734 "name": "updates",
11735 "type": "Vector<Update>"
11736 },
11737 {
11738 "name": "users",
11739 "type": "Vector<User>"
11740 },
11741 {
11742 "name": "chats",
11743 "type": "Vector<Chat>"
11744 },
11745 {
11746 "name": "date",
11747 "type": "int"
11748 },
11749 {
11750 "name": "seq",
11751 "type": "int"
11752 }
11753 ],
11754 "type": "Updates"
11755 },
11756 {
11757 "id": "-1916114267",
11758 "predicate": "photos.photos",
11759 "params": [
11760 {
11761 "name": "photos",
11762 "type": "Vector<Photo>"
11763 },
11764 {
11765 "name": "users",
11766 "type": "Vector<User>"
11767 }
11768 ],
11769 "type": "photos.Photos"
11770 },
11771 {
11772 "id": "352657236",
11773 "predicate": "photos.photosSlice",
11774 "params": [
11775 {
11776 "name": "count",
11777 "type": "int"
11778 },
11779 {
11780 "name": "photos",
11781 "type": "Vector<Photo>"
11782 },
11783 {
11784 "name": "users",
11785 "type": "Vector<User>"
11786 }
11787 ],
11788 "type": "photos.Photos"
11789 },
11790 {
11791 "id": "539045032",
11792 "predicate": "photos.photo",
11793 "params": [
11794 {
11795 "name": "photo",
11796 "type": "Photo"
11797 },
11798 {
11799 "name": "users",
11800 "type": "Vector<User>"
11801 }
11802 ],
11803 "type": "photos.Photo"
11804 },
11805 {
11806 "id": "157948117",
11807 "predicate": "upload.file",
11808 "params": [
11809 {
11810 "name": "type",
11811 "type": "storage.FileType"
11812 },
11813 {
11814 "name": "mtime",
11815 "type": "int"
11816 },
11817 {
11818 "name": "bytes",
11819 "type": "bytes"
11820 }
11821 ],
11822 "type": "upload.File"
11823 },
11824 {
11825 "id": "98092748",
11826 "predicate": "dcOption",
11827 "params": [
11828 {
11829 "name": "flags",
11830 "type": "#"
11831 },
11832 {
11833 "name": "ipv6",
11834 "type": "flags.0?true"
11835 },
11836 {
11837 "name": "media_only",
11838 "type": "flags.1?true"
11839 },
11840 {
11841 "name": "tcpo_only",
11842 "type": "flags.2?true"
11843 },
11844 {
11845 "name": "id",
11846 "type": "int"
11847 },
11848 {
11849 "name": "ip_address",
11850 "type": "string"
11851 },
11852 {
11853 "name": "port",
11854 "type": "int"
11855 }
11856 ],
11857 "type": "DcOption"
11858 },
11859 {
11860 "id": "-1704251862",
11861 "predicate": "config",
11862 "params": [
11863 {
11864 "name": "flags",
11865 "type": "#"
11866 },
11867 {
11868 "name": "date",
11869 "type": "int"
11870 },
11871 {
11872 "name": "expires",
11873 "type": "int"
11874 },
11875 {
11876 "name": "test_mode",
11877 "type": "Bool"
11878 },
11879 {
11880 "name": "this_dc",
11881 "type": "int"
11882 },
11883 {
11884 "name": "dc_options",
11885 "type": "Vector<DcOption>"
11886 },
11887 {
11888 "name": "chat_size_max",
11889 "type": "int"
11890 },
11891 {
11892 "name": "megagroup_size_max",
11893 "type": "int"
11894 },
11895 {
11896 "name": "forwarded_count_max",
11897 "type": "int"
11898 },
11899 {
11900 "name": "online_update_period_ms",
11901 "type": "int"
11902 },
11903 {
11904 "name": "offline_blur_timeout_ms",
11905 "type": "int"
11906 },
11907 {
11908 "name": "offline_idle_timeout_ms",
11909 "type": "int"
11910 },
11911 {
11912 "name": "online_cloud_timeout_ms",
11913 "type": "int"
11914 },
11915 {
11916 "name": "notify_cloud_delay_ms",
11917 "type": "int"
11918 },
11919 {
11920 "name": "notify_default_delay_ms",
11921 "type": "int"
11922 },
11923 {
11924 "name": "chat_big_size",
11925 "type": "int"
11926 },
11927 {
11928 "name": "push_chat_period_ms",
11929 "type": "int"
11930 },
11931 {
11932 "name": "push_chat_limit",
11933 "type": "int"
11934 },
11935 {
11936 "name": "saved_gifs_limit",
11937 "type": "int"
11938 },
11939 {
11940 "name": "edit_time_limit",
11941 "type": "int"
11942 },
11943 {
11944 "name": "rating_e_decay",
11945 "type": "int"
11946 },
11947 {
11948 "name": "stickers_recent_limit",
11949 "type": "int"
11950 },
11951 {
11952 "name": "tmp_sessions",
11953 "type": "flags.0?int"
11954 },
11955 {
11956 "name": "disabled_features",
11957 "type": "Vector<DisabledFeature>"
11958 }
11959 ],
11960 "type": "Config"
11961 },
11962 {
11963 "id": "-1910892683",
11964 "predicate": "nearestDc",
11965 "params": [
11966 {
11967 "name": "country",
11968 "type": "string"
11969 },
11970 {
11971 "name": "this_dc",
11972 "type": "int"
11973 },
11974 {
11975 "name": "nearest_dc",
11976 "type": "int"
11977 }
11978 ],
11979 "type": "NearestDc"
11980 },
11981 {
11982 "id": "-1987579119",
11983 "predicate": "help.appUpdate",
11984 "params": [
11985 {
11986 "name": "id",
11987 "type": "int"
11988 },
11989 {
11990 "name": "critical",
11991 "type": "Bool"
11992 },
11993 {
11994 "name": "url",
11995 "type": "string"
11996 },
11997 {
11998 "name": "text",
11999 "type": "string"
12000 }
12001 ],
12002 "type": "help.AppUpdate"
12003 },
12004 {
12005 "id": "-1000708810",
12006 "predicate": "help.noAppUpdate",
12007 "params": [],
12008 "type": "help.AppUpdate"
12009 },
12010 {
12011 "id": "415997816",
12012 "predicate": "help.inviteText",
12013 "params": [
12014 {
12015 "name": "message",
12016 "type": "string"
12017 }
12018 ],
12019 "type": "help.InviteText"
12020 },
12021 {
12022 "id": "1662091044",
12023 "predicate": "wallPaperSolid",
12024 "params": [
12025 {
12026 "name": "id",
12027 "type": "int"
12028 },
12029 {
12030 "name": "title",
12031 "type": "string"
12032 },
12033 {
12034 "name": "bg_color",
12035 "type": "int"
12036 },
12037 {
12038 "name": "color",
12039 "type": "int"
12040 }
12041 ],
12042 "type": "WallPaper"
12043 },
12044 {
12045 "id": "314359194",
12046 "predicate": "updateNewEncryptedMessage",
12047 "params": [
12048 {
12049 "name": "message",
12050 "type": "EncryptedMessage"
12051 },
12052 {
12053 "name": "qts",
12054 "type": "int"
12055 }
12056 ],
12057 "type": "Update"
12058 },
12059 {
12060 "id": "386986326",
12061 "predicate": "updateEncryptedChatTyping",
12062 "params": [
12063 {
12064 "name": "chat_id",
12065 "type": "int"
12066 }
12067 ],
12068 "type": "Update"
12069 },
12070 {
12071 "id": "-1264392051",
12072 "predicate": "updateEncryption",
12073 "params": [
12074 {
12075 "name": "chat",
12076 "type": "EncryptedChat"
12077 },
12078 {
12079 "name": "date",
12080 "type": "int"
12081 }
12082 ],
12083 "type": "Update"
12084 },
12085 {
12086 "id": "956179895",
12087 "predicate": "updateEncryptedMessagesRead",
12088 "params": [
12089 {
12090 "name": "chat_id",
12091 "type": "int"
12092 },
12093 {
12094 "name": "max_date",
12095 "type": "int"
12096 },
12097 {
12098 "name": "date",
12099 "type": "int"
12100 }
12101 ],
12102 "type": "Update"
12103 },
12104 {
12105 "id": "-1417756512",
12106 "predicate": "encryptedChatEmpty",
12107 "params": [
12108 {
12109 "name": "id",
12110 "type": "int"
12111 }
12112 ],
12113 "type": "EncryptedChat"
12114 },
12115 {
12116 "id": "1006044124",
12117 "predicate": "encryptedChatWaiting",
12118 "params": [
12119 {
12120 "name": "id",
12121 "type": "int"
12122 },
12123 {
12124 "name": "access_hash",
12125 "type": "long"
12126 },
12127 {
12128 "name": "date",
12129 "type": "int"
12130 },
12131 {
12132 "name": "admin_id",
12133 "type": "int"
12134 },
12135 {
12136 "name": "participant_id",
12137 "type": "int"
12138 }
12139 ],
12140 "type": "EncryptedChat"
12141 },
12142 {
12143 "id": "-931638658",
12144 "predicate": "encryptedChatRequested",
12145 "params": [
12146 {
12147 "name": "id",
12148 "type": "int"
12149 },
12150 {
12151 "name": "access_hash",
12152 "type": "long"
12153 },
12154 {
12155 "name": "date",
12156 "type": "int"
12157 },
12158 {
12159 "name": "admin_id",
12160 "type": "int"
12161 },
12162 {
12163 "name": "participant_id",
12164 "type": "int"
12165 },
12166 {
12167 "name": "g_a",
12168 "type": "bytes"
12169 }
12170 ],
12171 "type": "EncryptedChat"
12172 },
12173 {
12174 "id": "-94974410",
12175 "predicate": "encryptedChat",
12176 "params": [
12177 {
12178 "name": "id",
12179 "type": "int"
12180 },
12181 {
12182 "name": "access_hash",
12183 "type": "long"
12184 },
12185 {
12186 "name": "date",
12187 "type": "int"
12188 },
12189 {
12190 "name": "admin_id",
12191 "type": "int"
12192 },
12193 {
12194 "name": "participant_id",
12195 "type": "int"
12196 },
12197 {
12198 "name": "g_a_or_b",
12199 "type": "bytes"
12200 },
12201 {
12202 "name": "key_fingerprint",
12203 "type": "long"
12204 }
12205 ],
12206 "type": "EncryptedChat"
12207 },
12208 {
12209 "id": "332848423",
12210 "predicate": "encryptedChatDiscarded",
12211 "params": [
12212 {
12213 "name": "id",
12214 "type": "int"
12215 }
12216 ],
12217 "type": "EncryptedChat"
12218 },
12219 {
12220 "id": "-247351839",
12221 "predicate": "inputEncryptedChat",
12222 "params": [
12223 {
12224 "name": "chat_id",
12225 "type": "int"
12226 },
12227 {
12228 "name": "access_hash",
12229 "type": "long"
12230 }
12231 ],
12232 "type": "InputEncryptedChat"
12233 },
12234 {
12235 "id": "-1038136962",
12236 "predicate": "encryptedFileEmpty",
12237 "params": [],
12238 "type": "EncryptedFile"
12239 },
12240 {
12241 "id": "1248893260",
12242 "predicate": "encryptedFile",
12243 "params": [
12244 {
12245 "name": "id",
12246 "type": "long"
12247 },
12248 {
12249 "name": "access_hash",
12250 "type": "long"
12251 },
12252 {
12253 "name": "size",
12254 "type": "int"
12255 },
12256 {
12257 "name": "dc_id",
12258 "type": "int"
12259 },
12260 {
12261 "name": "key_fingerprint",
12262 "type": "int"
12263 }
12264 ],
12265 "type": "EncryptedFile"
12266 },
12267 {
12268 "id": "406307684",
12269 "predicate": "inputEncryptedFileEmpty",
12270 "params": [],
12271 "type": "InputEncryptedFile"
12272 },
12273 {
12274 "id": "1690108678",
12275 "predicate": "inputEncryptedFileUploaded",
12276 "params": [
12277 {
12278 "name": "id",
12279 "type": "long"
12280 },
12281 {
12282 "name": "parts",
12283 "type": "int"
12284 },
12285 {
12286 "name": "md5_checksum",
12287 "type": "string"
12288 },
12289 {
12290 "name": "key_fingerprint",
12291 "type": "int"
12292 }
12293 ],
12294 "type": "InputEncryptedFile"
12295 },
12296 {
12297 "id": "1511503333",
12298 "predicate": "inputEncryptedFile",
12299 "params": [
12300 {
12301 "name": "id",
12302 "type": "long"
12303 },
12304 {
12305 "name": "access_hash",
12306 "type": "long"
12307 }
12308 ],
12309 "type": "InputEncryptedFile"
12310 },
12311 {
12312 "id": "-182231723",
12313 "predicate": "inputEncryptedFileLocation",
12314 "params": [
12315 {
12316 "name": "id",
12317 "type": "long"
12318 },
12319 {
12320 "name": "access_hash",
12321 "type": "long"
12322 }
12323 ],
12324 "type": "InputFileLocation"
12325 },
12326 {
12327 "id": "-317144808",
12328 "predicate": "encryptedMessage",
12329 "params": [
12330 {
12331 "name": "random_id",
12332 "type": "long"
12333 },
12334 {
12335 "name": "chat_id",
12336 "type": "int"
12337 },
12338 {
12339 "name": "date",
12340 "type": "int"
12341 },
12342 {
12343 "name": "bytes",
12344 "type": "bytes"
12345 },
12346 {
12347 "name": "file",
12348 "type": "EncryptedFile"
12349 }
12350 ],
12351 "type": "EncryptedMessage"
12352 },
12353 {
12354 "id": "594758406",
12355 "predicate": "encryptedMessageService",
12356 "params": [
12357 {
12358 "name": "random_id",
12359 "type": "long"
12360 },
12361 {
12362 "name": "chat_id",
12363 "type": "int"
12364 },
12365 {
12366 "name": "date",
12367 "type": "int"
12368 },
12369 {
12370 "name": "bytes",
12371 "type": "bytes"
12372 }
12373 ],
12374 "type": "EncryptedMessage"
12375 },
12376 {
12377 "id": "-1058912715",
12378 "predicate": "messages.dhConfigNotModified",
12379 "params": [
12380 {
12381 "name": "random",
12382 "type": "bytes"
12383 }
12384 ],
12385 "type": "messages.DhConfig"
12386 },
12387 {
12388 "id": "740433629",
12389 "predicate": "messages.dhConfig",
12390 "params": [
12391 {
12392 "name": "g",
12393 "type": "int"
12394 },
12395 {
12396 "name": "p",
12397 "type": "bytes"
12398 },
12399 {
12400 "name": "version",
12401 "type": "int"
12402 },
12403 {
12404 "name": "random",
12405 "type": "bytes"
12406 }
12407 ],
12408 "type": "messages.DhConfig"
12409 },
12410 {
12411 "id": "1443858741",
12412 "predicate": "messages.sentEncryptedMessage",
12413 "params": [
12414 {
12415 "name": "date",
12416 "type": "int"
12417 }
12418 ],
12419 "type": "messages.SentEncryptedMessage"
12420 },
12421 {
12422 "id": "-1802240206",
12423 "predicate": "messages.sentEncryptedFile",
12424 "params": [
12425 {
12426 "name": "date",
12427 "type": "int"
12428 },
12429 {
12430 "name": "file",
12431 "type": "EncryptedFile"
12432 }
12433 ],
12434 "type": "messages.SentEncryptedMessage"
12435 },
12436 {
12437 "id": "-95482955",
12438 "predicate": "inputFileBig",
12439 "params": [
12440 {
12441 "name": "id",
12442 "type": "long"
12443 },
12444 {
12445 "name": "parts",
12446 "type": "int"
12447 },
12448 {
12449 "name": "name",
12450 "type": "string"
12451 }
12452 ],
12453 "type": "InputFile"
12454 },
12455 {
12456 "id": "767652808",
12457 "predicate": "inputEncryptedFileBigUploaded",
12458 "params": [
12459 {
12460 "name": "id",
12461 "type": "long"
12462 },
12463 {
12464 "name": "parts",
12465 "type": "int"
12466 },
12467 {
12468 "name": "key_fingerprint",
12469 "type": "int"
12470 }
12471 ],
12472 "type": "InputEncryptedFile"
12473 },
12474 {
12475 "id": "-364179876",
12476 "predicate": "updateChatParticipantAdd",
12477 "params": [
12478 {
12479 "name": "chat_id",
12480 "type": "int"
12481 },
12482 {
12483 "name": "user_id",
12484 "type": "int"
12485 },
12486 {
12487 "name": "inviter_id",
12488 "type": "int"
12489 },
12490 {
12491 "name": "date",
12492 "type": "int"
12493 },
12494 {
12495 "name": "version",
12496 "type": "int"
12497 }
12498 ],
12499 "type": "Update"
12500 },
12501 {
12502 "id": "1851755554",
12503 "predicate": "updateChatParticipantDelete",
12504 "params": [
12505 {
12506 "name": "chat_id",
12507 "type": "int"
12508 },
12509 {
12510 "name": "user_id",
12511 "type": "int"
12512 },
12513 {
12514 "name": "version",
12515 "type": "int"
12516 }
12517 ],
12518 "type": "Update"
12519 },
12520 {
12521 "id": "-1906403213",
12522 "predicate": "updateDcOptions",
12523 "params": [
12524 {
12525 "name": "dc_options",
12526 "type": "Vector<DcOption>"
12527 }
12528 ],
12529 "type": "Update"
12530 },
12531 {
12532 "id": "-797904407",
12533 "predicate": "inputMediaUploadedDocument",
12534 "params": [
12535 {
12536 "name": "flags",
12537 "type": "#"
12538 },
12539 {
12540 "name": "file",
12541 "type": "InputFile"
12542 },
12543 {
12544 "name": "mime_type",
12545 "type": "string"
12546 },
12547 {
12548 "name": "attributes",
12549 "type": "Vector<DocumentAttribute>"
12550 },
12551 {
12552 "name": "caption",
12553 "type": "string"
12554 },
12555 {
12556 "name": "stickers",
12557 "type": "flags.0?Vector<InputDocument>"
12558 }
12559 ],
12560 "type": "InputMedia"
12561 },
12562 {
12563 "id": "1356369070",
12564 "predicate": "inputMediaUploadedThumbDocument",
12565 "params": [
12566 {
12567 "name": "flags",
12568 "type": "#"
12569 },
12570 {
12571 "name": "file",
12572 "type": "InputFile"
12573 },
12574 {
12575 "name": "thumb",
12576 "type": "InputFile"
12577 },
12578 {
12579 "name": "mime_type",
12580 "type": "string"
12581 },
12582 {
12583 "name": "attributes",
12584 "type": "Vector<DocumentAttribute>"
12585 },
12586 {
12587 "name": "caption",
12588 "type": "string"
12589 },
12590 {
12591 "name": "stickers",
12592 "type": "flags.0?Vector<InputDocument>"
12593 }
12594 ],
12595 "type": "InputMedia"
12596 },
12597 {
12598 "id": "444068508",
12599 "predicate": "inputMediaDocument",
12600 "params": [
12601 {
12602 "name": "id",
12603 "type": "InputDocument"
12604 },
12605 {
12606 "name": "caption",
12607 "type": "string"
12608 }
12609 ],
12610 "type": "InputMedia"
12611 },
12612 {
12613 "id": "-203411800",
12614 "predicate": "messageMediaDocument",
12615 "params": [
12616 {
12617 "name": "document",
12618 "type": "Document"
12619 },
12620 {
12621 "name": "caption",
12622 "type": "string"
12623 }
12624 ],
12625 "type": "MessageMedia"
12626 },
12627 {
12628 "id": "1928391342",
12629 "predicate": "inputDocumentEmpty",
12630 "params": [],
12631 "type": "InputDocument"
12632 },
12633 {
12634 "id": "410618194",
12635 "predicate": "inputDocument",
12636 "params": [
12637 {
12638 "name": "id",
12639 "type": "long"
12640 },
12641 {
12642 "name": "access_hash",
12643 "type": "long"
12644 }
12645 ],
12646 "type": "InputDocument"
12647 },
12648 {
12649 "id": "1125058340",
12650 "predicate": "inputDocumentFileLocation",
12651 "params": [
12652 {
12653 "name": "id",
12654 "type": "long"
12655 },
12656 {
12657 "name": "access_hash",
12658 "type": "long"
12659 },
12660 {
12661 "name": "version",
12662 "type": "int"
12663 }
12664 ],
12665 "type": "InputFileLocation"
12666 },
12667 {
12668 "id": "922273905",
12669 "predicate": "documentEmpty",
12670 "params": [
12671 {
12672 "name": "id",
12673 "type": "long"
12674 }
12675 ],
12676 "type": "Document"
12677 },
12678 {
12679 "id": "-2027738169",
12680 "predicate": "document",
12681 "params": [
12682 {
12683 "name": "id",
12684 "type": "long"
12685 },
12686 {
12687 "name": "access_hash",
12688 "type": "long"
12689 },
12690 {
12691 "name": "date",
12692 "type": "int"
12693 },
12694 {
12695 "name": "mime_type",
12696 "type": "string"
12697 },
12698 {
12699 "name": "size",
12700 "type": "int"
12701 },
12702 {
12703 "name": "thumb",
12704 "type": "PhotoSize"
12705 },
12706 {
12707 "name": "dc_id",
12708 "type": "int"
12709 },
12710 {
12711 "name": "version",
12712 "type": "int"
12713 },
12714 {
12715 "name": "attributes",
12716 "type": "Vector<DocumentAttribute>"
12717 }
12718 ],
12719 "type": "Document"
12720 },
12721 {
12722 "id": "398898678",
12723 "predicate": "help.support",
12724 "params": [
12725 {
12726 "name": "phone_number",
12727 "type": "string"
12728 },
12729 {
12730 "name": "user",
12731 "type": "User"
12732 }
12733 ],
12734 "type": "help.Support"
12735 },
12736 {
12737 "id": "-1613493288",
12738 "predicate": "notifyPeer",
12739 "params": [
12740 {
12741 "name": "peer",
12742 "type": "Peer"
12743 }
12744 ],
12745 "type": "NotifyPeer"
12746 },
12747 {
12748 "id": "-1261946036",
12749 "predicate": "notifyUsers",
12750 "params": [],
12751 "type": "NotifyPeer"
12752 },
12753 {
12754 "id": "-1073230141",
12755 "predicate": "notifyChats",
12756 "params": [],
12757 "type": "NotifyPeer"
12758 },
12759 {
12760 "id": "1959820384",
12761 "predicate": "notifyAll",
12762 "params": [],
12763 "type": "NotifyPeer"
12764 },
12765 {
12766 "id": "-2131957734",
12767 "predicate": "updateUserBlocked",
12768 "params": [
12769 {
12770 "name": "user_id",
12771 "type": "int"
12772 },
12773 {
12774 "name": "blocked",
12775 "type": "Bool"
12776 }
12777 ],
12778 "type": "Update"
12779 },
12780 {
12781 "id": "-1094555409",
12782 "predicate": "updateNotifySettings",
12783 "params": [
12784 {
12785 "name": "peer",
12786 "type": "NotifyPeer"
12787 },
12788 {
12789 "name": "notify_settings",
12790 "type": "PeerNotifySettings"
12791 }
12792 ],
12793 "type": "Update"
12794 },
12795 {
12796 "id": "381645902",
12797 "predicate": "sendMessageTypingAction",
12798 "params": [],
12799 "type": "SendMessageAction"
12800 },
12801 {
12802 "id": "-44119819",
12803 "predicate": "sendMessageCancelAction",
12804 "params": [],
12805 "type": "SendMessageAction"
12806 },
12807 {
12808 "id": "-1584933265",
12809 "predicate": "sendMessageRecordVideoAction",
12810 "params": [],
12811 "type": "SendMessageAction"
12812 },
12813 {
12814 "id": "-378127636",
12815 "predicate": "sendMessageUploadVideoAction",
12816 "params": [
12817 {
12818 "name": "progress",
12819 "type": "int"
12820 }
12821 ],
12822 "type": "SendMessageAction"
12823 },
12824 {
12825 "id": "-718310409",
12826 "predicate": "sendMessageRecordAudioAction",
12827 "params": [],
12828 "type": "SendMessageAction"
12829 },
12830 {
12831 "id": "-212740181",
12832 "predicate": "sendMessageUploadAudioAction",
12833 "params": [
12834 {
12835 "name": "progress",
12836 "type": "int"
12837 }
12838 ],
12839 "type": "SendMessageAction"
12840 },
12841 {
12842 "id": "-774682074",
12843 "predicate": "sendMessageUploadPhotoAction",
12844 "params": [
12845 {
12846 "name": "progress",
12847 "type": "int"
12848 }
12849 ],
12850 "type": "SendMessageAction"
12851 },
12852 {
12853 "id": "-1441998364",
12854 "predicate": "sendMessageUploadDocumentAction",
12855 "params": [
12856 {
12857 "name": "progress",
12858 "type": "int"
12859 }
12860 ],
12861 "type": "SendMessageAction"
12862 },
12863 {
12864 "id": "393186209",
12865 "predicate": "sendMessageGeoLocationAction",
12866 "params": [],
12867 "type": "SendMessageAction"
12868 },
12869 {
12870 "id": "1653390447",
12871 "predicate": "sendMessageChooseContactAction",
12872 "params": [],
12873 "type": "SendMessageAction"
12874 },
12875 {
12876 "id": "446822276",
12877 "predicate": "contacts.found",
12878 "params": [
12879 {
12880 "name": "results",
12881 "type": "Vector<Peer>"
12882 },
12883 {
12884 "name": "chats",
12885 "type": "Vector<Chat>"
12886 },
12887 {
12888 "name": "users",
12889 "type": "Vector<User>"
12890 }
12891 ],
12892 "type": "contacts.Found"
12893 },
12894 {
12895 "id": "942527460",
12896 "predicate": "updateServiceNotification",
12897 "params": [
12898 {
12899 "name": "type",
12900 "type": "string"
12901 },
12902 {
12903 "name": "message",
12904 "type": "string"
12905 },
12906 {
12907 "name": "media",
12908 "type": "MessageMedia"
12909 },
12910 {
12911 "name": "popup",
12912 "type": "Bool"
12913 }
12914 ],
12915 "type": "Update"
12916 },
12917 {
12918 "id": "-496024847",
12919 "predicate": "userStatusRecently",
12920 "params": [],
12921 "type": "UserStatus"
12922 },
12923 {
12924 "id": "129960444",
12925 "predicate": "userStatusLastWeek",
12926 "params": [],
12927 "type": "UserStatus"
12928 },
12929 {
12930 "id": "2011940674",
12931 "predicate": "userStatusLastMonth",
12932 "params": [],
12933 "type": "UserStatus"
12934 },
12935 {
12936 "id": "-298113238",
12937 "predicate": "updatePrivacy",
12938 "params": [
12939 {
12940 "name": "key",
12941 "type": "PrivacyKey"
12942 },
12943 {
12944 "name": "rules",
12945 "type": "Vector<PrivacyRule>"
12946 }
12947 ],
12948 "type": "Update"
12949 },
12950 {
12951 "id": "1335282456",
12952 "predicate": "inputPrivacyKeyStatusTimestamp",
12953 "params": [],
12954 "type": "InputPrivacyKey"
12955 },
12956 {
12957 "id": "-1137792208",
12958 "predicate": "privacyKeyStatusTimestamp",
12959 "params": [],
12960 "type": "PrivacyKey"
12961 },
12962 {
12963 "id": "218751099",
12964 "predicate": "inputPrivacyValueAllowContacts",
12965 "params": [],
12966 "type": "InputPrivacyRule"
12967 },
12968 {
12969 "id": "407582158",
12970 "predicate": "inputPrivacyValueAllowAll",
12971 "params": [],
12972 "type": "InputPrivacyRule"
12973 },
12974 {
12975 "id": "320652927",
12976 "predicate": "inputPrivacyValueAllowUsers",
12977 "params": [
12978 {
12979 "name": "users",
12980 "type": "Vector<InputUser>"
12981 }
12982 ],
12983 "type": "InputPrivacyRule"
12984 },
12985 {
12986 "id": "195371015",
12987 "predicate": "inputPrivacyValueDisallowContacts",
12988 "params": [],
12989 "type": "InputPrivacyRule"
12990 },
12991 {
12992 "id": "-697604407",
12993 "predicate": "inputPrivacyValueDisallowAll",
12994 "params": [],
12995 "type": "InputPrivacyRule"
12996 },
12997 {
12998 "id": "-1877932953",
12999 "predicate": "inputPrivacyValueDisallowUsers",
13000 "params": [
13001 {
13002 "name": "users",
13003 "type": "Vector<InputUser>"
13004 }
13005 ],
13006 "type": "InputPrivacyRule"
13007 },
13008 {
13009 "id": "-123988",
13010 "predicate": "privacyValueAllowContacts",
13011 "params": [],
13012 "type": "PrivacyRule"
13013 },
13014 {
13015 "id": "1698855810",
13016 "predicate": "privacyValueAllowAll",
13017 "params": [],
13018 "type": "PrivacyRule"
13019 },
13020 {
13021 "id": "1297858060",
13022 "predicate": "privacyValueAllowUsers",
13023 "params": [
13024 {
13025 "name": "users",
13026 "type": "Vector<int>"
13027 }
13028 ],
13029 "type": "PrivacyRule"
13030 },
13031 {
13032 "id": "-125240806",
13033 "predicate": "privacyValueDisallowContacts",
13034 "params": [],
13035 "type": "PrivacyRule"
13036 },
13037 {
13038 "id": "-1955338397",
13039 "predicate": "privacyValueDisallowAll",
13040 "params": [],
13041 "type": "PrivacyRule"
13042 },
13043 {
13044 "id": "209668535",
13045 "predicate": "privacyValueDisallowUsers",
13046 "params": [
13047 {
13048 "name": "users",
13049 "type": "Vector<int>"
13050 }
13051 ],
13052 "type": "PrivacyRule"
13053 },
13054 {
13055 "id": "1430961007",
13056 "predicate": "account.privacyRules",
13057 "params": [
13058 {
13059 "name": "rules",
13060 "type": "Vector<PrivacyRule>"
13061 },
13062 {
13063 "name": "users",
13064 "type": "Vector<User>"
13065 }
13066 ],
13067 "type": "account.PrivacyRules"
13068 },
13069 {
13070 "id": "-1194283041",
13071 "predicate": "accountDaysTTL",
13072 "params": [
13073 {
13074 "name": "days",
13075 "type": "int"
13076 }
13077 ],
13078 "type": "AccountDaysTTL"
13079 },
13080 {
13081 "id": "314130811",
13082 "predicate": "updateUserPhone",
13083 "params": [
13084 {
13085 "name": "user_id",
13086 "type": "int"
13087 },
13088 {
13089 "name": "phone",
13090 "type": "string"
13091 }
13092 ],
13093 "type": "Update"
13094 },
13095 {
13096 "id": "1815593308",
13097 "predicate": "documentAttributeImageSize",
13098 "params": [
13099 {
13100 "name": "w",
13101 "type": "int"
13102 },
13103 {
13104 "name": "h",
13105 "type": "int"
13106 }
13107 ],
13108 "type": "DocumentAttribute"
13109 },
13110 {
13111 "id": "297109817",
13112 "predicate": "documentAttributeAnimated",
13113 "params": [],
13114 "type": "DocumentAttribute"
13115 },
13116 {
13117 "id": "1662637586",
13118 "predicate": "documentAttributeSticker",
13119 "params": [
13120 {
13121 "name": "flags",
13122 "type": "#"
13123 },
13124 {
13125 "name": "mask",
13126 "type": "flags.1?true"
13127 },
13128 {
13129 "name": "alt",
13130 "type": "string"
13131 },
13132 {
13133 "name": "stickerset",
13134 "type": "InputStickerSet"
13135 },
13136 {
13137 "name": "mask_coords",
13138 "type": "flags.0?MaskCoords"
13139 }
13140 ],
13141 "type": "DocumentAttribute"
13142 },
13143 {
13144 "id": "1494273227",
13145 "predicate": "documentAttributeVideo",
13146 "params": [
13147 {
13148 "name": "duration",
13149 "type": "int"
13150 },
13151 {
13152 "name": "w",
13153 "type": "int"
13154 },
13155 {
13156 "name": "h",
13157 "type": "int"
13158 }
13159 ],
13160 "type": "DocumentAttribute"
13161 },
13162 {
13163 "id": "-1739392570",
13164 "predicate": "documentAttributeAudio",
13165 "params": [
13166 {
13167 "name": "flags",
13168 "type": "#"
13169 },
13170 {
13171 "name": "voice",
13172 "type": "flags.10?true"
13173 },
13174 {
13175 "name": "duration",
13176 "type": "int"
13177 },
13178 {
13179 "name": "title",
13180 "type": "flags.0?string"
13181 },
13182 {
13183 "name": "performer",
13184 "type": "flags.1?string"
13185 },
13186 {
13187 "name": "waveform",
13188 "type": "flags.2?bytes"
13189 }
13190 ],
13191 "type": "DocumentAttribute"
13192 },
13193 {
13194 "id": "358154344",
13195 "predicate": "documentAttributeFilename",
13196 "params": [
13197 {
13198 "name": "file_name",
13199 "type": "string"
13200 }
13201 ],
13202 "type": "DocumentAttribute"
13203 },
13204 {
13205 "id": "-244016606",
13206 "predicate": "messages.stickersNotModified",
13207 "params": [],
13208 "type": "messages.Stickers"
13209 },
13210 {
13211 "id": "-1970352846",
13212 "predicate": "messages.stickers",
13213 "params": [
13214 {
13215 "name": "hash",
13216 "type": "string"
13217 },
13218 {
13219 "name": "stickers",
13220 "type": "Vector<Document>"
13221 }
13222 ],
13223 "type": "messages.Stickers"
13224 },
13225 {
13226 "id": "313694676",
13227 "predicate": "stickerPack",
13228 "params": [
13229 {
13230 "name": "emoticon",
13231 "type": "string"
13232 },
13233 {
13234 "name": "documents",
13235 "type": "Vector<long>"
13236 }
13237 ],
13238 "type": "StickerPack"
13239 },
13240 {
13241 "id": "-395967805",
13242 "predicate": "messages.allStickersNotModified",
13243 "params": [],
13244 "type": "messages.AllStickers"
13245 },
13246 {
13247 "id": "-302170017",
13248 "predicate": "messages.allStickers",
13249 "params": [
13250 {
13251 "name": "hash",
13252 "type": "int"
13253 },
13254 {
13255 "name": "sets",
13256 "type": "Vector<StickerSet>"
13257 }
13258 ],
13259 "type": "messages.AllStickers"
13260 },
13261 {
13262 "id": "-1369215196",
13263 "predicate": "disabledFeature",
13264 "params": [
13265 {
13266 "name": "feature",
13267 "type": "string"
13268 },
13269 {
13270 "name": "description",
13271 "type": "string"
13272 }
13273 ],
13274 "type": "DisabledFeature"
13275 },
13276 {
13277 "id": "-1721631396",
13278 "predicate": "updateReadHistoryInbox",
13279 "params": [
13280 {
13281 "name": "peer",
13282 "type": "Peer"
13283 },
13284 {
13285 "name": "max_id",
13286 "type": "int"
13287 },
13288 {
13289 "name": "pts",
13290 "type": "int"
13291 },
13292 {
13293 "name": "pts_count",
13294 "type": "int"
13295 }
13296 ],
13297 "type": "Update"
13298 },
13299 {
13300 "id": "791617983",
13301 "predicate": "updateReadHistoryOutbox",
13302 "params": [
13303 {
13304 "name": "peer",
13305 "type": "Peer"
13306 },
13307 {
13308 "name": "max_id",
13309 "type": "int"
13310 },
13311 {
13312 "name": "pts",
13313 "type": "int"
13314 },
13315 {
13316 "name": "pts_count",
13317 "type": "int"
13318 }
13319 ],
13320 "type": "Update"
13321 },
13322 {
13323 "id": "-2066640507",
13324 "predicate": "messages.affectedMessages",
13325 "params": [
13326 {
13327 "name": "pts",
13328 "type": "int"
13329 },
13330 {
13331 "name": "pts_count",
13332 "type": "int"
13333 }
13334 ],
13335 "type": "messages.AffectedMessages"
13336 },
13337 {
13338 "id": "1599050311",
13339 "predicate": "contactLinkUnknown",
13340 "params": [],
13341 "type": "ContactLink"
13342 },
13343 {
13344 "id": "-17968211",
13345 "predicate": "contactLinkNone",
13346 "params": [],
13347 "type": "ContactLink"
13348 },
13349 {
13350 "id": "646922073",
13351 "predicate": "contactLinkHasPhone",
13352 "params": [],
13353 "type": "ContactLink"
13354 },
13355 {
13356 "id": "-721239344",
13357 "predicate": "contactLinkContact",
13358 "params": [],
13359 "type": "ContactLink"
13360 },
13361 {
13362 "id": "2139689491",
13363 "predicate": "updateWebPage",
13364 "params": [
13365 {
13366 "name": "webpage",
13367 "type": "WebPage"
13368 },
13369 {
13370 "name": "pts",
13371 "type": "int"
13372 },
13373 {
13374 "name": "pts_count",
13375 "type": "int"
13376 }
13377 ],
13378 "type": "Update"
13379 },
13380 {
13381 "id": "-350980120",
13382 "predicate": "webPageEmpty",
13383 "params": [
13384 {
13385 "name": "id",
13386 "type": "long"
13387 }
13388 ],
13389 "type": "WebPage"
13390 },
13391 {
13392 "id": "-981018084",
13393 "predicate": "webPagePending",
13394 "params": [
13395 {
13396 "name": "id",
13397 "type": "long"
13398 },
13399 {
13400 "name": "date",
13401 "type": "int"
13402 }
13403 ],
13404 "type": "WebPage"
13405 },
13406 {
13407 "id": "-897446185",
13408 "predicate": "webPage",
13409 "params": [
13410 {
13411 "name": "flags",
13412 "type": "#"
13413 },
13414 {
13415 "name": "id",
13416 "type": "long"
13417 },
13418 {
13419 "name": "url",
13420 "type": "string"
13421 },
13422 {
13423 "name": "display_url",
13424 "type": "string"
13425 },
13426 {
13427 "name": "type",
13428 "type": "flags.0?string"
13429 },
13430 {
13431 "name": "site_name",
13432 "type": "flags.1?string"
13433 },
13434 {
13435 "name": "title",
13436 "type": "flags.2?string"
13437 },
13438 {
13439 "name": "description",
13440 "type": "flags.3?string"
13441 },
13442 {
13443 "name": "photo",
13444 "type": "flags.4?Photo"
13445 },
13446 {
13447 "name": "embed_url",
13448 "type": "flags.5?string"
13449 },
13450 {
13451 "name": "embed_type",
13452 "type": "flags.5?string"
13453 },
13454 {
13455 "name": "embed_width",
13456 "type": "flags.6?int"
13457 },
13458 {
13459 "name": "embed_height",
13460 "type": "flags.6?int"
13461 },
13462 {
13463 "name": "duration",
13464 "type": "flags.7?int"
13465 },
13466 {
13467 "name": "author",
13468 "type": "flags.8?string"
13469 },
13470 {
13471 "name": "document",
13472 "type": "flags.9?Document"
13473 }
13474 ],
13475 "type": "WebPage"
13476 },
13477 {
13478 "id": "-1557277184",
13479 "predicate": "messageMediaWebPage",
13480 "params": [
13481 {
13482 "name": "webpage",
13483 "type": "WebPage"
13484 }
13485 ],
13486 "type": "MessageMedia"
13487 },
13488 {
13489 "id": "2079516406",
13490 "predicate": "authorization",
13491 "params": [
13492 {
13493 "name": "hash",
13494 "type": "long"
13495 },
13496 {
13497 "name": "flags",
13498 "type": "int"
13499 },
13500 {
13501 "name": "device_model",
13502 "type": "string"
13503 },
13504 {
13505 "name": "platform",
13506 "type": "string"
13507 },
13508 {
13509 "name": "system_version",
13510 "type": "string"
13511 },
13512 {
13513 "name": "api_id",
13514 "type": "int"
13515 },
13516 {
13517 "name": "app_name",
13518 "type": "string"
13519 },
13520 {
13521 "name": "app_version",
13522 "type": "string"
13523 },
13524 {
13525 "name": "date_created",
13526 "type": "int"
13527 },
13528 {
13529 "name": "date_active",
13530 "type": "int"
13531 },
13532 {
13533 "name": "ip",
13534 "type": "string"
13535 },
13536 {
13537 "name": "country",
13538 "type": "string"
13539 },
13540 {
13541 "name": "region",
13542 "type": "string"
13543 }
13544 ],
13545 "type": "Authorization"
13546 },
13547 {
13548 "id": "307276766",
13549 "predicate": "account.authorizations",
13550 "params": [
13551 {
13552 "name": "authorizations",
13553 "type": "Vector<Authorization>"
13554 }
13555 ],
13556 "type": "account.Authorizations"
13557 },
13558 {
13559 "id": "-1764049896",
13560 "predicate": "account.noPassword",
13561 "params": [
13562 {
13563 "name": "new_salt",
13564 "type": "bytes"
13565 },
13566 {
13567 "name": "email_unconfirmed_pattern",
13568 "type": "string"
13569 }
13570 ],
13571 "type": "account.Password"
13572 },
13573 {
13574 "id": "2081952796",
13575 "predicate": "account.password",
13576 "params": [
13577 {
13578 "name": "current_salt",
13579 "type": "bytes"
13580 },
13581 {
13582 "name": "new_salt",
13583 "type": "bytes"
13584 },
13585 {
13586 "name": "hint",
13587 "type": "string"
13588 },
13589 {
13590 "name": "has_recovery",
13591 "type": "Bool"
13592 },
13593 {
13594 "name": "email_unconfirmed_pattern",
13595 "type": "string"
13596 }
13597 ],
13598 "type": "account.Password"
13599 },
13600 {
13601 "id": "-1212732749",
13602 "predicate": "account.passwordSettings",
13603 "params": [
13604 {
13605 "name": "email",
13606 "type": "string"
13607 }
13608 ],
13609 "type": "account.PasswordSettings"
13610 },
13611 {
13612 "id": "-2037289493",
13613 "predicate": "account.passwordInputSettings",
13614 "params": [
13615 {
13616 "name": "flags",
13617 "type": "#"
13618 },
13619 {
13620 "name": "new_salt",
13621 "type": "flags.0?bytes"
13622 },
13623 {
13624 "name": "new_password_hash",
13625 "type": "flags.0?bytes"
13626 },
13627 {
13628 "name": "hint",
13629 "type": "flags.0?string"
13630 },
13631 {
13632 "name": "email",
13633 "type": "flags.1?string"
13634 }
13635 ],
13636 "type": "account.PasswordInputSettings"
13637 },
13638 {
13639 "id": "326715557",
13640 "predicate": "auth.passwordRecovery",
13641 "params": [
13642 {
13643 "name": "email_pattern",
13644 "type": "string"
13645 }
13646 ],
13647 "type": "auth.PasswordRecovery"
13648 },
13649 {
13650 "id": "673687578",
13651 "predicate": "inputMediaVenue",
13652 "params": [
13653 {
13654 "name": "geo_point",
13655 "type": "InputGeoPoint"
13656 },
13657 {
13658 "name": "title",
13659 "type": "string"
13660 },
13661 {
13662 "name": "address",
13663 "type": "string"
13664 },
13665 {
13666 "name": "provider",
13667 "type": "string"
13668 },
13669 {
13670 "name": "venue_id",
13671 "type": "string"
13672 }
13673 ],
13674 "type": "InputMedia"
13675 },
13676 {
13677 "id": "2031269663",
13678 "predicate": "messageMediaVenue",
13679 "params": [
13680 {
13681 "name": "geo",
13682 "type": "GeoPoint"
13683 },
13684 {
13685 "name": "title",
13686 "type": "string"
13687 },
13688 {
13689 "name": "address",
13690 "type": "string"
13691 },
13692 {
13693 "name": "provider",
13694 "type": "string"
13695 },
13696 {
13697 "name": "venue_id",
13698 "type": "string"
13699 }
13700 ],
13701 "type": "MessageMedia"
13702 },
13703 {
13704 "id": "-1551583367",
13705 "predicate": "receivedNotifyMessage",
13706 "params": [
13707 {
13708 "name": "id",
13709 "type": "int"
13710 },
13711 {
13712 "name": "flags",
13713 "type": "int"
13714 }
13715 ],
13716 "type": "ReceivedNotifyMessage"
13717 },
13718 {
13719 "id": "1776236393",
13720 "predicate": "chatInviteEmpty",
13721 "params": [],
13722 "type": "ExportedChatInvite"
13723 },
13724 {
13725 "id": "-64092740",
13726 "predicate": "chatInviteExported",
13727 "params": [
13728 {
13729 "name": "link",
13730 "type": "string"
13731 }
13732 ],
13733 "type": "ExportedChatInvite"
13734 },
13735 {
13736 "id": "1516793212",
13737 "predicate": "chatInviteAlready",
13738 "params": [
13739 {
13740 "name": "chat",
13741 "type": "Chat"
13742 }
13743 ],
13744 "type": "ChatInvite"
13745 },
13746 {
13747 "id": "-613092008",
13748 "predicate": "chatInvite",
13749 "params": [
13750 {
13751 "name": "flags",
13752 "type": "#"
13753 },
13754 {
13755 "name": "channel",
13756 "type": "flags.0?true"
13757 },
13758 {
13759 "name": "broadcast",
13760 "type": "flags.1?true"
13761 },
13762 {
13763 "name": "public",
13764 "type": "flags.2?true"
13765 },
13766 {
13767 "name": "megagroup",
13768 "type": "flags.3?true"
13769 },
13770 {
13771 "name": "title",
13772 "type": "string"
13773 },
13774 {
13775 "name": "photo",
13776 "type": "ChatPhoto"
13777 },
13778 {
13779 "name": "participants_count",
13780 "type": "int"
13781 },
13782 {
13783 "name": "participants",
13784 "type": "flags.4?Vector<User>"
13785 }
13786 ],
13787 "type": "ChatInvite"
13788 },
13789 {
13790 "id": "-123931160",
13791 "predicate": "messageActionChatJoinedByLink",
13792 "params": [
13793 {
13794 "name": "inviter_id",
13795 "type": "int"
13796 }
13797 ],
13798 "type": "MessageAction"
13799 },
13800 {
13801 "id": "1757493555",
13802 "predicate": "updateReadMessagesContents",
13803 "params": [
13804 {
13805 "name": "messages",
13806 "type": "Vector<int>"
13807 },
13808 {
13809 "name": "pts",
13810 "type": "int"
13811 },
13812 {
13813 "name": "pts_count",
13814 "type": "int"
13815 }
13816 ],
13817 "type": "Update"
13818 },
13819 {
13820 "id": "-4838507",
13821 "predicate": "inputStickerSetEmpty",
13822 "params": [],
13823 "type": "InputStickerSet"
13824 },
13825 {
13826 "id": "-1645763991",
13827 "predicate": "inputStickerSetID",
13828 "params": [
13829 {
13830 "name": "id",
13831 "type": "long"
13832 },
13833 {
13834 "name": "access_hash",
13835 "type": "long"
13836 }
13837 ],
13838 "type": "InputStickerSet"
13839 },
13840 {
13841 "id": "-2044933984",
13842 "predicate": "inputStickerSetShortName",
13843 "params": [
13844 {
13845 "name": "short_name",
13846 "type": "string"
13847 }
13848 ],
13849 "type": "InputStickerSet"
13850 },
13851 {
13852 "id": "-852477119",
13853 "predicate": "stickerSet",
13854 "params": [
13855 {
13856 "name": "flags",
13857 "type": "#"
13858 },
13859 {
13860 "name": "installed",
13861 "type": "flags.0?true"
13862 },
13863 {
13864 "name": "archived",
13865 "type": "flags.1?true"
13866 },
13867 {
13868 "name": "official",
13869 "type": "flags.2?true"
13870 },
13871 {
13872 "name": "masks",
13873 "type": "flags.3?true"
13874 },
13875 {
13876 "name": "id",
13877 "type": "long"
13878 },
13879 {
13880 "name": "access_hash",
13881 "type": "long"
13882 },
13883 {
13884 "name": "title",
13885 "type": "string"
13886 },
13887 {
13888 "name": "short_name",
13889 "type": "string"
13890 },
13891 {
13892 "name": "count",
13893 "type": "int"
13894 },
13895 {
13896 "name": "hash",
13897 "type": "int"
13898 }
13899 ],
13900 "type": "StickerSet"
13901 },
13902 {
13903 "id": "-1240849242",
13904 "predicate": "messages.stickerSet",
13905 "params": [
13906 {
13907 "name": "set",
13908 "type": "StickerSet"
13909 },
13910 {
13911 "name": "packs",
13912 "type": "Vector<StickerPack>"
13913 },
13914 {
13915 "name": "documents",
13916 "type": "Vector<Document>"
13917 }
13918 ],
13919 "type": "messages.StickerSet"
13920 },
13921 {
13922 "id": "-787638374",
13923 "predicate": "user",
13924 "params": [
13925 {
13926 "name": "flags",
13927 "type": "#"
13928 },
13929 {
13930 "name": "self",
13931 "type": "flags.10?true"
13932 },
13933 {
13934 "name": "contact",
13935 "type": "flags.11?true"
13936 },
13937 {
13938 "name": "mutual_contact",
13939 "type": "flags.12?true"
13940 },
13941 {
13942 "name": "deleted",
13943 "type": "flags.13?true"
13944 },
13945 {
13946 "name": "bot",
13947 "type": "flags.14?true"
13948 },
13949 {
13950 "name": "bot_chat_history",
13951 "type": "flags.15?true"
13952 },
13953 {
13954 "name": "bot_nochats",
13955 "type": "flags.16?true"
13956 },
13957 {
13958 "name": "verified",
13959 "type": "flags.17?true"
13960 },
13961 {
13962 "name": "restricted",
13963 "type": "flags.18?true"
13964 },
13965 {
13966 "name": "min",
13967 "type": "flags.20?true"
13968 },
13969 {
13970 "name": "bot_inline_geo",
13971 "type": "flags.21?true"
13972 },
13973 {
13974 "name": "id",
13975 "type": "int"
13976 },
13977 {
13978 "name": "access_hash",
13979 "type": "flags.0?long"
13980 },
13981 {
13982 "name": "first_name",
13983 "type": "flags.1?string"
13984 },
13985 {
13986 "name": "last_name",
13987 "type": "flags.2?string"
13988 },
13989 {
13990 "name": "username",
13991 "type": "flags.3?string"
13992 },
13993 {
13994 "name": "phone",
13995 "type": "flags.4?string"
13996 },
13997 {
13998 "name": "photo",
13999 "type": "flags.5?UserProfilePhoto"
14000 },
14001 {
14002 "name": "status",
14003 "type": "flags.6?UserStatus"
14004 },
14005 {
14006 "name": "bot_info_version",
14007 "type": "flags.14?int"
14008 },
14009 {
14010 "name": "restriction_reason",
14011 "type": "flags.18?string"
14012 },
14013 {
14014 "name": "bot_inline_placeholder",
14015 "type": "flags.19?string"
14016 }
14017 ],
14018 "type": "User"
14019 },
14020 {
14021 "id": "-1032140601",
14022 "predicate": "botCommand",
14023 "params": [
14024 {
14025 "name": "command",
14026 "type": "string"
14027 },
14028 {
14029 "name": "description",
14030 "type": "string"
14031 }
14032 ],
14033 "type": "BotCommand"
14034 },
14035 {
14036 "id": "-1729618630",
14037 "predicate": "botInfo",
14038 "params": [
14039 {
14040 "name": "user_id",
14041 "type": "int"
14042 },
14043 {
14044 "name": "description",
14045 "type": "string"
14046 },
14047 {
14048 "name": "commands",
14049 "type": "Vector<BotCommand>"
14050 }
14051 ],
14052 "type": "BotInfo"
14053 },
14054 {
14055 "id": "-1560655744",
14056 "predicate": "keyboardButton",
14057 "params": [
14058 {
14059 "name": "text",
14060 "type": "string"
14061 }
14062 ],
14063 "type": "KeyboardButton"
14064 },
14065 {
14066 "id": "2002815875",
14067 "predicate": "keyboardButtonRow",
14068 "params": [
14069 {
14070 "name": "buttons",
14071 "type": "Vector<KeyboardButton>"
14072 }
14073 ],
14074 "type": "KeyboardButtonRow"
14075 },
14076 {
14077 "id": "-1606526075",
14078 "predicate": "replyKeyboardHide",
14079 "params": [
14080 {
14081 "name": "flags",
14082 "type": "#"
14083 },
14084 {
14085 "name": "selective",
14086 "type": "flags.2?true"
14087 }
14088 ],
14089 "type": "ReplyMarkup"
14090 },
14091 {
14092 "id": "-200242528",
14093 "predicate": "replyKeyboardForceReply",
14094 "params": [
14095 {
14096 "name": "flags",
14097 "type": "#"
14098 },
14099 {
14100 "name": "single_use",
14101 "type": "flags.1?true"
14102 },
14103 {
14104 "name": "selective",
14105 "type": "flags.2?true"
14106 }
14107 ],
14108 "type": "ReplyMarkup"
14109 },
14110 {
14111 "id": "889353612",
14112 "predicate": "replyKeyboardMarkup",
14113 "params": [
14114 {
14115 "name": "flags",
14116 "type": "#"
14117 },
14118 {
14119 "name": "resize",
14120 "type": "flags.0?true"
14121 },
14122 {
14123 "name": "single_use",
14124 "type": "flags.1?true"
14125 },
14126 {
14127 "name": "selective",
14128 "type": "flags.2?true"
14129 },
14130 {
14131 "name": "rows",
14132 "type": "Vector<KeyboardButtonRow>"
14133 }
14134 ],
14135 "type": "ReplyMarkup"
14136 },
14137 {
14138 "id": "2072935910",
14139 "predicate": "inputPeerUser",
14140 "params": [
14141 {
14142 "name": "user_id",
14143 "type": "int"
14144 },
14145 {
14146 "name": "access_hash",
14147 "type": "long"
14148 }
14149 ],
14150 "type": "InputPeer"
14151 },
14152 {
14153 "id": "-668391402",
14154 "predicate": "inputUser",
14155 "params": [
14156 {
14157 "name": "user_id",
14158 "type": "int"
14159 },
14160 {
14161 "name": "access_hash",
14162 "type": "long"
14163 }
14164 ],
14165 "type": "InputUser"
14166 },
14167 {
14168 "id": "-1350696044",
14169 "predicate": "help.appChangelogEmpty",
14170 "params": [],
14171 "type": "help.AppChangelog"
14172 },
14173 {
14174 "id": "1181279933",
14175 "predicate": "help.appChangelog",
14176 "params": [
14177 {
14178 "name": "text",
14179 "type": "string"
14180 }
14181 ],
14182 "type": "help.AppChangelog"
14183 },
14184 {
14185 "id": "-1148011883",
14186 "predicate": "messageEntityUnknown",
14187 "params": [
14188 {
14189 "name": "offset",
14190 "type": "int"
14191 },
14192 {
14193 "name": "length",
14194 "type": "int"
14195 }
14196 ],
14197 "type": "MessageEntity"
14198 },
14199 {
14200 "id": "-100378723",
14201 "predicate": "messageEntityMention",
14202 "params": [
14203 {
14204 "name": "offset",
14205 "type": "int"
14206 },
14207 {
14208 "name": "length",
14209 "type": "int"
14210 }
14211 ],
14212 "type": "MessageEntity"
14213 },
14214 {
14215 "id": "1868782349",
14216 "predicate": "messageEntityHashtag",
14217 "params": [
14218 {
14219 "name": "offset",
14220 "type": "int"
14221 },
14222 {
14223 "name": "length",
14224 "type": "int"
14225 }
14226 ],
14227 "type": "MessageEntity"
14228 },
14229 {
14230 "id": "1827637959",
14231 "predicate": "messageEntityBotCommand",
14232 "params": [
14233 {
14234 "name": "offset",
14235 "type": "int"
14236 },
14237 {
14238 "name": "length",
14239 "type": "int"
14240 }
14241 ],
14242 "type": "MessageEntity"
14243 },
14244 {
14245 "id": "1859134776",
14246 "predicate": "messageEntityUrl",
14247 "params": [
14248 {
14249 "name": "offset",
14250 "type": "int"
14251 },
14252 {
14253 "name": "length",
14254 "type": "int"
14255 }
14256 ],
14257 "type": "MessageEntity"
14258 },
14259 {
14260 "id": "1692693954",
14261 "predicate": "messageEntityEmail",
14262 "params": [
14263 {
14264 "name": "offset",
14265 "type": "int"
14266 },
14267 {
14268 "name": "length",
14269 "type": "int"
14270 }
14271 ],
14272 "type": "MessageEntity"
14273 },
14274 {
14275 "id": "-1117713463",
14276 "predicate": "messageEntityBold",
14277 "params": [
14278 {
14279 "name": "offset",
14280 "type": "int"
14281 },
14282 {
14283 "name": "length",
14284 "type": "int"
14285 }
14286 ],
14287 "type": "MessageEntity"
14288 },
14289 {
14290 "id": "-2106619040",
14291 "predicate": "messageEntityItalic",
14292 "params": [
14293 {
14294 "name": "offset",
14295 "type": "int"
14296 },
14297 {
14298 "name": "length",
14299 "type": "int"
14300 }
14301 ],
14302 "type": "MessageEntity"
14303 },
14304 {
14305 "id": "681706865",
14306 "predicate": "messageEntityCode",
14307 "params": [
14308 {
14309 "name": "offset",
14310 "type": "int"
14311 },
14312 {
14313 "name": "length",
14314 "type": "int"
14315 }
14316 ],
14317 "type": "MessageEntity"
14318 },
14319 {
14320 "id": "1938967520",
14321 "predicate": "messageEntityPre",
14322 "params": [
14323 {
14324 "name": "offset",
14325 "type": "int"
14326 },
14327 {
14328 "name": "length",
14329 "type": "int"
14330 },
14331 {
14332 "name": "language",
14333 "type": "string"
14334 }
14335 ],
14336 "type": "MessageEntity"
14337 },
14338 {
14339 "id": "1990644519",
14340 "predicate": "messageEntityTextUrl",
14341 "params": [
14342 {
14343 "name": "offset",
14344 "type": "int"
14345 },
14346 {
14347 "name": "length",
14348 "type": "int"
14349 },
14350 {
14351 "name": "url",
14352 "type": "string"
14353 }
14354 ],
14355 "type": "MessageEntity"
14356 },
14357 {
14358 "id": "301019932",
14359 "predicate": "updateShortSentMessage",
14360 "params": [
14361 {
14362 "name": "flags",
14363 "type": "#"
14364 },
14365 {
14366 "name": "out",
14367 "type": "flags.1?true"
14368 },
14369 {
14370 "name": "id",
14371 "type": "int"
14372 },
14373 {
14374 "name": "pts",
14375 "type": "int"
14376 },
14377 {
14378 "name": "pts_count",
14379 "type": "int"
14380 },
14381 {
14382 "name": "date",
14383 "type": "int"
14384 },
14385 {
14386 "name": "media",
14387 "type": "flags.9?MessageMedia"
14388 },
14389 {
14390 "name": "entities",
14391 "type": "flags.7?Vector<MessageEntity>"
14392 }
14393 ],
14394 "type": "Updates"
14395 },
14396 {
14397 "id": "-292807034",
14398 "predicate": "inputChannelEmpty",
14399 "params": [],
14400 "type": "InputChannel"
14401 },
14402 {
14403 "id": "-1343524562",
14404 "predicate": "inputChannel",
14405 "params": [
14406 {
14407 "name": "channel_id",
14408 "type": "int"
14409 },
14410 {
14411 "name": "access_hash",
14412 "type": "long"
14413 }
14414 ],
14415 "type": "InputChannel"
14416 },
14417 {
14418 "id": "-1109531342",
14419 "predicate": "peerChannel",
14420 "params": [
14421 {
14422 "name": "channel_id",
14423 "type": "int"
14424 }
14425 ],
14426 "type": "Peer"
14427 },
14428 {
14429 "id": "548253432",
14430 "predicate": "inputPeerChannel",
14431 "params": [
14432 {
14433 "name": "channel_id",
14434 "type": "int"
14435 },
14436 {
14437 "name": "access_hash",
14438 "type": "long"
14439 }
14440 ],
14441 "type": "InputPeer"
14442 },
14443 {
14444 "id": "-1588737454",
14445 "predicate": "channel",
14446 "params": [
14447 {
14448 "name": "flags",
14449 "type": "#"
14450 },
14451 {
14452 "name": "creator",
14453 "type": "flags.0?true"
14454 },
14455 {
14456 "name": "kicked",
14457 "type": "flags.1?true"
14458 },
14459 {
14460 "name": "left",
14461 "type": "flags.2?true"
14462 },
14463 {
14464 "name": "editor",
14465 "type": "flags.3?true"
14466 },
14467 {
14468 "name": "moderator",
14469 "type": "flags.4?true"
14470 },
14471 {
14472 "name": "broadcast",
14473 "type": "flags.5?true"
14474 },
14475 {
14476 "name": "verified",
14477 "type": "flags.7?true"
14478 },
14479 {
14480 "name": "megagroup",
14481 "type": "flags.8?true"
14482 },
14483 {
14484 "name": "restricted",
14485 "type": "flags.9?true"
14486 },
14487 {
14488 "name": "democracy",
14489 "type": "flags.10?true"
14490 },
14491 {
14492 "name": "signatures",
14493 "type": "flags.11?true"
14494 },
14495 {
14496 "name": "min",
14497 "type": "flags.12?true"
14498 },
14499 {
14500 "name": "id",
14501 "type": "int"
14502 },
14503 {
14504 "name": "access_hash",
14505 "type": "flags.13?long"
14506 },
14507 {
14508 "name": "title",
14509 "type": "string"
14510 },
14511 {
14512 "name": "username",
14513 "type": "flags.6?string"
14514 },
14515 {
14516 "name": "photo",
14517 "type": "ChatPhoto"
14518 },
14519 {
14520 "name": "date",
14521 "type": "int"
14522 },
14523 {
14524 "name": "version",
14525 "type": "int"
14526 },
14527 {
14528 "name": "restriction_reason",
14529 "type": "flags.9?string"
14530 }
14531 ],
14532 "type": "Chat"
14533 },
14534 {
14535 "id": "-2059962289",
14536 "predicate": "channelForbidden",
14537 "params": [
14538 {
14539 "name": "flags",
14540 "type": "#"
14541 },
14542 {
14543 "name": "broadcast",
14544 "type": "flags.5?true"
14545 },
14546 {
14547 "name": "megagroup",
14548 "type": "flags.8?true"
14549 },
14550 {
14551 "name": "id",
14552 "type": "int"
14553 },
14554 {
14555 "name": "access_hash",
14556 "type": "long"
14557 },
14558 {
14559 "name": "title",
14560 "type": "string"
14561 }
14562 ],
14563 "type": "Chat"
14564 },
14565 {
14566 "id": "2131196633",
14567 "predicate": "contacts.resolvedPeer",
14568 "params": [
14569 {
14570 "name": "peer",
14571 "type": "Peer"
14572 },
14573 {
14574 "name": "chats",
14575 "type": "Vector<Chat>"
14576 },
14577 {
14578 "name": "users",
14579 "type": "Vector<User>"
14580 }
14581 ],
14582 "type": "contacts.ResolvedPeer"
14583 },
14584 {
14585 "id": "-1009430225",
14586 "predicate": "channelFull",
14587 "params": [
14588 {
14589 "name": "flags",
14590 "type": "#"
14591 },
14592 {
14593 "name": "can_view_participants",
14594 "type": "flags.3?true"
14595 },
14596 {
14597 "name": "can_set_username",
14598 "type": "flags.6?true"
14599 },
14600 {
14601 "name": "id",
14602 "type": "int"
14603 },
14604 {
14605 "name": "about",
14606 "type": "string"
14607 },
14608 {
14609 "name": "participants_count",
14610 "type": "flags.0?int"
14611 },
14612 {
14613 "name": "admins_count",
14614 "type": "flags.1?int"
14615 },
14616 {
14617 "name": "kicked_count",
14618 "type": "flags.2?int"
14619 },
14620 {
14621 "name": "read_inbox_max_id",
14622 "type": "int"
14623 },
14624 {
14625 "name": "read_outbox_max_id",
14626 "type": "int"
14627 },
14628 {
14629 "name": "unread_count",
14630 "type": "int"
14631 },
14632 {
14633 "name": "chat_photo",
14634 "type": "Photo"
14635 },
14636 {
14637 "name": "notify_settings",
14638 "type": "PeerNotifySettings"
14639 },
14640 {
14641 "name": "exported_invite",
14642 "type": "ExportedChatInvite"
14643 },
14644 {
14645 "name": "bot_info",
14646 "type": "Vector<BotInfo>"
14647 },
14648 {
14649 "name": "migrated_from_chat_id",
14650 "type": "flags.4?int"
14651 },
14652 {
14653 "name": "migrated_from_max_id",
14654 "type": "flags.4?int"
14655 },
14656 {
14657 "name": "pinned_msg_id",
14658 "type": "flags.5?int"
14659 }
14660 ],
14661 "type": "ChatFull"
14662 },
14663 {
14664 "id": "182649427",
14665 "predicate": "messageRange",
14666 "params": [
14667 {
14668 "name": "min_id",
14669 "type": "int"
14670 },
14671 {
14672 "name": "max_id",
14673 "type": "int"
14674 }
14675 ],
14676 "type": "MessageRange"
14677 },
14678 {
14679 "id": "-1725551049",
14680 "predicate": "messages.channelMessages",
14681 "params": [
14682 {
14683 "name": "flags",
14684 "type": "#"
14685 },
14686 {
14687 "name": "pts",
14688 "type": "int"
14689 },
14690 {
14691 "name": "count",
14692 "type": "int"
14693 },
14694 {
14695 "name": "messages",
14696 "type": "Vector<Message>"
14697 },
14698 {
14699 "name": "chats",
14700 "type": "Vector<Chat>"
14701 },
14702 {
14703 "name": "users",
14704 "type": "Vector<User>"
14705 }
14706 ],
14707 "type": "messages.Messages"
14708 },
14709 {
14710 "id": "-1781355374",
14711 "predicate": "messageActionChannelCreate",
14712 "params": [
14713 {
14714 "name": "title",
14715 "type": "string"
14716 }
14717 ],
14718 "type": "MessageAction"
14719 },
14720 {
14721 "id": "-352032773",
14722 "predicate": "updateChannelTooLong",
14723 "params": [
14724 {
14725 "name": "flags",
14726 "type": "#"
14727 },
14728 {
14729 "name": "channel_id",
14730 "type": "int"
14731 },
14732 {
14733 "name": "pts",
14734 "type": "flags.0?int"
14735 }
14736 ],
14737 "type": "Update"
14738 },
14739 {
14740 "id": "-1227598250",
14741 "predicate": "updateChannel",
14742 "params": [
14743 {
14744 "name": "channel_id",
14745 "type": "int"
14746 }
14747 ],
14748 "type": "Update"
14749 },
14750 {
14751 "id": "1656358105",
14752 "predicate": "updateNewChannelMessage",
14753 "params": [
14754 {
14755 "name": "message",
14756 "type": "Message"
14757 },
14758 {
14759 "name": "pts",
14760 "type": "int"
14761 },
14762 {
14763 "name": "pts_count",
14764 "type": "int"
14765 }
14766 ],
14767 "type": "Update"
14768 },
14769 {
14770 "id": "1108669311",
14771 "predicate": "updateReadChannelInbox",
14772 "params": [
14773 {
14774 "name": "channel_id",
14775 "type": "int"
14776 },
14777 {
14778 "name": "max_id",
14779 "type": "int"
14780 }
14781 ],
14782 "type": "Update"
14783 },
14784 {
14785 "id": "-1015733815",
14786 "predicate": "updateDeleteChannelMessages",
14787 "params": [
14788 {
14789 "name": "channel_id",
14790 "type": "int"
14791 },
14792 {
14793 "name": "messages",
14794 "type": "Vector<int>"
14795 },
14796 {
14797 "name": "pts",
14798 "type": "int"
14799 },
14800 {
14801 "name": "pts_count",
14802 "type": "int"
14803 }
14804 ],
14805 "type": "Update"
14806 },
14807 {
14808 "id": "-1734268085",
14809 "predicate": "updateChannelMessageViews",
14810 "params": [
14811 {
14812 "name": "channel_id",
14813 "type": "int"
14814 },
14815 {
14816 "name": "id",
14817 "type": "int"
14818 },
14819 {
14820 "name": "views",
14821 "type": "int"
14822 }
14823 ],
14824 "type": "Update"
14825 },
14826 {
14827 "id": "1041346555",
14828 "predicate": "updates.channelDifferenceEmpty",
14829 "params": [
14830 {
14831 "name": "flags",
14832 "type": "#"
14833 },
14834 {
14835 "name": "final",
14836 "type": "flags.0?true"
14837 },
14838 {
14839 "name": "pts",
14840 "type": "int"
14841 },
14842 {
14843 "name": "timeout",
14844 "type": "flags.1?int"
14845 }
14846 ],
14847 "type": "updates.ChannelDifference"
14848 },
14849 {
14850 "id": "1091431943",
14851 "predicate": "updates.channelDifferenceTooLong",
14852 "params": [
14853 {
14854 "name": "flags",
14855 "type": "#"
14856 },
14857 {
14858 "name": "final",
14859 "type": "flags.0?true"
14860 },
14861 {
14862 "name": "pts",
14863 "type": "int"
14864 },
14865 {
14866 "name": "timeout",
14867 "type": "flags.1?int"
14868 },
14869 {
14870 "name": "top_message",
14871 "type": "int"
14872 },
14873 {
14874 "name": "read_inbox_max_id",
14875 "type": "int"
14876 },
14877 {
14878 "name": "read_outbox_max_id",
14879 "type": "int"
14880 },
14881 {
14882 "name": "unread_count",
14883 "type": "int"
14884 },
14885 {
14886 "name": "messages",
14887 "type": "Vector<Message>"
14888 },
14889 {
14890 "name": "chats",
14891 "type": "Vector<Chat>"
14892 },
14893 {
14894 "name": "users",
14895 "type": "Vector<User>"
14896 }
14897 ],
14898 "type": "updates.ChannelDifference"
14899 },
14900 {
14901 "id": "543450958",
14902 "predicate": "updates.channelDifference",
14903 "params": [
14904 {
14905 "name": "flags",
14906 "type": "#"
14907 },
14908 {
14909 "name": "final",
14910 "type": "flags.0?true"
14911 },
14912 {
14913 "name": "pts",
14914 "type": "int"
14915 },
14916 {
14917 "name": "timeout",
14918 "type": "flags.1?int"
14919 },
14920 {
14921 "name": "new_messages",
14922 "type": "Vector<Message>"
14923 },
14924 {
14925 "name": "other_updates",
14926 "type": "Vector<Update>"
14927 },
14928 {
14929 "name": "chats",
14930 "type": "Vector<Chat>"
14931 },
14932 {
14933 "name": "users",
14934 "type": "Vector<User>"
14935 }
14936 ],
14937 "type": "updates.ChannelDifference"
14938 },
14939 {
14940 "id": "-1798033689",
14941 "predicate": "channelMessagesFilterEmpty",
14942 "params": [],
14943 "type": "ChannelMessagesFilter"
14944 },
14945 {
14946 "id": "-847783593",
14947 "predicate": "channelMessagesFilter",
14948 "params": [
14949 {
14950 "name": "flags",
14951 "type": "#"
14952 },
14953 {
14954 "name": "exclude_new_messages",
14955 "type": "flags.1?true"
14956 },
14957 {
14958 "name": "ranges",
14959 "type": "Vector<MessageRange>"
14960 }
14961 ],
14962 "type": "ChannelMessagesFilter"
14963 },
14964 {
14965 "id": "367766557",
14966 "predicate": "channelParticipant",
14967 "params": [
14968 {
14969 "name": "user_id",
14970 "type": "int"
14971 },
14972 {
14973 "name": "date",
14974 "type": "int"
14975 }
14976 ],
14977 "type": "ChannelParticipant"
14978 },
14979 {
14980 "id": "-1557620115",
14981 "predicate": "channelParticipantSelf",
14982 "params": [
14983 {
14984 "name": "user_id",
14985 "type": "int"
14986 },
14987 {
14988 "name": "inviter_id",
14989 "type": "int"
14990 },
14991 {
14992 "name": "date",
14993 "type": "int"
14994 }
14995 ],
14996 "type": "ChannelParticipant"
14997 },
14998 {
14999 "id": "-1861910545",
15000 "predicate": "channelParticipantModerator",
15001 "params": [
15002 {
15003 "name": "user_id",
15004 "type": "int"
15005 },
15006 {
15007 "name": "inviter_id",
15008 "type": "int"
15009 },
15010 {
15011 "name": "date",
15012 "type": "int"
15013 }
15014 ],
15015 "type": "ChannelParticipant"
15016 },
15017 {
15018 "id": "-1743180447",
15019 "predicate": "channelParticipantEditor",
15020 "params": [
15021 {
15022 "name": "user_id",
15023 "type": "int"
15024 },
15025 {
15026 "name": "inviter_id",
15027 "type": "int"
15028 },
15029 {
15030 "name": "date",
15031 "type": "int"
15032 }
15033 ],
15034 "type": "ChannelParticipant"
15035 },
15036 {
15037 "id": "-1933187430",
15038 "predicate": "channelParticipantKicked",
15039 "params": [
15040 {
15041 "name": "user_id",
15042 "type": "int"
15043 },
15044 {
15045 "name": "kicked_by",
15046 "type": "int"
15047 },
15048 {
15049 "name": "date",
15050 "type": "int"
15051 }
15052 ],
15053 "type": "ChannelParticipant"
15054 },
15055 {
15056 "id": "-471670279",
15057 "predicate": "channelParticipantCreator",
15058 "params": [
15059 {
15060 "name": "user_id",
15061 "type": "int"
15062 }
15063 ],
15064 "type": "ChannelParticipant"
15065 },
15066 {
15067 "id": "-566281095",
15068 "predicate": "channelParticipantsRecent",
15069 "params": [],
15070 "type": "ChannelParticipantsFilter"
15071 },
15072 {
15073 "id": "-1268741783",
15074 "predicate": "channelParticipantsAdmins",
15075 "params": [],
15076 "type": "ChannelParticipantsFilter"
15077 },
15078 {
15079 "id": "1010285434",
15080 "predicate": "channelParticipantsKicked",
15081 "params": [],
15082 "type": "ChannelParticipantsFilter"
15083 },
15084 {
15085 "id": "-1299865402",
15086 "predicate": "channelRoleEmpty",
15087 "params": [],
15088 "type": "ChannelParticipantRole"
15089 },
15090 {
15091 "id": "-1776756363",
15092 "predicate": "channelRoleModerator",
15093 "params": [],
15094 "type": "ChannelParticipantRole"
15095 },
15096 {
15097 "id": "-2113143156",
15098 "predicate": "channelRoleEditor",
15099 "params": [],
15100 "type": "ChannelParticipantRole"
15101 },
15102 {
15103 "id": "-177282392",
15104 "predicate": "channels.channelParticipants",
15105 "params": [
15106 {
15107 "name": "count",
15108 "type": "int"
15109 },
15110 {
15111 "name": "participants",
15112 "type": "Vector<ChannelParticipant>"
15113 },
15114 {
15115 "name": "users",
15116 "type": "Vector<User>"
15117 }
15118 ],
15119 "type": "channels.ChannelParticipants"
15120 },
15121 {
15122 "id": "-791039645",
15123 "predicate": "channels.channelParticipant",
15124 "params": [
15125 {
15126 "name": "participant",
15127 "type": "ChannelParticipant"
15128 },
15129 {
15130 "name": "users",
15131 "type": "Vector<User>"
15132 }
15133 ],
15134 "type": "channels.ChannelParticipant"
15135 },
15136 {
15137 "id": "-636267638",
15138 "predicate": "chatParticipantCreator",
15139 "params": [
15140 {
15141 "name": "user_id",
15142 "type": "int"
15143 }
15144 ],
15145 "type": "ChatParticipant"
15146 },
15147 {
15148 "id": "-489233354",
15149 "predicate": "chatParticipantAdmin",
15150 "params": [
15151 {
15152 "name": "user_id",
15153 "type": "int"
15154 },
15155 {
15156 "name": "inviter_id",
15157 "type": "int"
15158 },
15159 {
15160 "name": "date",
15161 "type": "int"
15162 }
15163 ],
15164 "type": "ChatParticipant"
15165 },
15166 {
15167 "id": "1855224129",
15168 "predicate": "updateChatAdmins",
15169 "params": [
15170 {
15171 "name": "chat_id",
15172 "type": "int"
15173 },
15174 {
15175 "name": "enabled",
15176 "type": "Bool"
15177 },
15178 {
15179 "name": "version",
15180 "type": "int"
15181 }
15182 ],
15183 "type": "Update"
15184 },
15185 {
15186 "id": "-1232070311",
15187 "predicate": "updateChatParticipantAdmin",
15188 "params": [
15189 {
15190 "name": "chat_id",
15191 "type": "int"
15192 },
15193 {
15194 "name": "user_id",
15195 "type": "int"
15196 },
15197 {
15198 "name": "is_admin",
15199 "type": "Bool"
15200 },
15201 {
15202 "name": "version",
15203 "type": "int"
15204 }
15205 ],
15206 "type": "Update"
15207 },
15208 {
15209 "id": "1371385889",
15210 "predicate": "messageActionChatMigrateTo",
15211 "params": [
15212 {
15213 "name": "channel_id",
15214 "type": "int"
15215 }
15216 ],
15217 "type": "MessageAction"
15218 },
15219 {
15220 "id": "-1336546578",
15221 "predicate": "messageActionChannelMigrateFrom",
15222 "params": [
15223 {
15224 "name": "title",
15225 "type": "string"
15226 },
15227 {
15228 "name": "chat_id",
15229 "type": "int"
15230 }
15231 ],
15232 "type": "MessageAction"
15233 },
15234 {
15235 "id": "-1328445861",
15236 "predicate": "channelParticipantsBots",
15237 "params": [],
15238 "type": "ChannelParticipantsFilter"
15239 },
15240 {
15241 "id": "-236044656",
15242 "predicate": "help.termsOfService",
15243 "params": [
15244 {
15245 "name": "text",
15246 "type": "string"
15247 }
15248 ],
15249 "type": "help.TermsOfService"
15250 },
15251 {
15252 "id": "1753886890",
15253 "predicate": "updateNewStickerSet",
15254 "params": [
15255 {
15256 "name": "stickerset",
15257 "type": "messages.StickerSet"
15258 }
15259 ],
15260 "type": "Update"
15261 },
15262 {
15263 "id": "196268545",
15264 "predicate": "updateStickerSetsOrder",
15265 "params": [
15266 {
15267 "name": "flags",
15268 "type": "#"
15269 },
15270 {
15271 "name": "masks",
15272 "type": "flags.0?true"
15273 },
15274 {
15275 "name": "order",
15276 "type": "Vector<long>"
15277 }
15278 ],
15279 "type": "Update"
15280 },
15281 {
15282 "id": "1135492588",
15283 "predicate": "updateStickerSets",
15284 "params": [],
15285 "type": "Update"
15286 },
15287 {
15288 "id": "372165663",
15289 "predicate": "foundGif",
15290 "params": [
15291 {
15292 "name": "url",
15293 "type": "string"
15294 },
15295 {
15296 "name": "thumb_url",
15297 "type": "string"
15298 },
15299 {
15300 "name": "content_url",
15301 "type": "string"
15302 },
15303 {
15304 "name": "content_type",
15305 "type": "string"
15306 },
15307 {
15308 "name": "w",
15309 "type": "int"
15310 },
15311 {
15312 "name": "h",
15313 "type": "int"
15314 }
15315 ],
15316 "type": "FoundGif"
15317 },
15318 {
15319 "id": "-1670052855",
15320 "predicate": "foundGifCached",
15321 "params": [
15322 {
15323 "name": "url",
15324 "type": "string"
15325 },
15326 {
15327 "name": "photo",
15328 "type": "Photo"
15329 },
15330 {
15331 "name": "document",
15332 "type": "Document"
15333 }
15334 ],
15335 "type": "FoundGif"
15336 },
15337 {
15338 "id": "1212395773",
15339 "predicate": "inputMediaGifExternal",
15340 "params": [
15341 {
15342 "name": "url",
15343 "type": "string"
15344 },
15345 {
15346 "name": "q",
15347 "type": "string"
15348 }
15349 ],
15350 "type": "InputMedia"
15351 },
15352 {
15353 "id": "1158290442",
15354 "predicate": "messages.foundGifs",
15355 "params": [
15356 {
15357 "name": "next_offset",
15358 "type": "int"
15359 },
15360 {
15361 "name": "results",
15362 "type": "Vector<FoundGif>"
15363 }
15364 ],
15365 "type": "messages.FoundGifs"
15366 },
15367 {
15368 "id": "-402498398",
15369 "predicate": "messages.savedGifsNotModified",
15370 "params": [],
15371 "type": "messages.SavedGifs"
15372 },
15373 {
15374 "id": "772213157",
15375 "predicate": "messages.savedGifs",
15376 "params": [
15377 {
15378 "name": "hash",
15379 "type": "int"
15380 },
15381 {
15382 "name": "gifs",
15383 "type": "Vector<Document>"
15384 }
15385 ],
15386 "type": "messages.SavedGifs"
15387 },
15388 {
15389 "id": "-1821035490",
15390 "predicate": "updateSavedGifs",
15391 "params": [],
15392 "type": "Update"
15393 },
15394 {
15395 "id": "691006739",
15396 "predicate": "inputBotInlineMessageMediaAuto",
15397 "params": [
15398 {
15399 "name": "flags",
15400 "type": "#"
15401 },
15402 {
15403 "name": "caption",
15404 "type": "string"
15405 },
15406 {
15407 "name": "reply_markup",
15408 "type": "flags.2?ReplyMarkup"
15409 }
15410 ],
15411 "type": "InputBotInlineMessage"
15412 },
15413 {
15414 "id": "1036876423",
15415 "predicate": "inputBotInlineMessageText",
15416 "params": [
15417 {
15418 "name": "flags",
15419 "type": "#"
15420 },
15421 {
15422 "name": "no_webpage",
15423 "type": "flags.0?true"
15424 },
15425 {
15426 "name": "message",
15427 "type": "string"
15428 },
15429 {
15430 "name": "entities",
15431 "type": "flags.1?Vector<MessageEntity>"
15432 },
15433 {
15434 "name": "reply_markup",
15435 "type": "flags.2?ReplyMarkup"
15436 }
15437 ],
15438 "type": "InputBotInlineMessage"
15439 },
15440 {
15441 "id": "750510426",
15442 "predicate": "inputBotInlineResult",
15443 "params": [
15444 {
15445 "name": "flags",
15446 "type": "#"
15447 },
15448 {
15449 "name": "id",
15450 "type": "string"
15451 },
15452 {
15453 "name": "type",
15454 "type": "string"
15455 },
15456 {
15457 "name": "title",
15458 "type": "flags.1?string"
15459 },
15460 {
15461 "name": "description",
15462 "type": "flags.2?string"
15463 },
15464 {
15465 "name": "url",
15466 "type": "flags.3?string"
15467 },
15468 {
15469 "name": "thumb_url",
15470 "type": "flags.4?string"
15471 },
15472 {
15473 "name": "content_url",
15474 "type": "flags.5?string"
15475 },
15476 {
15477 "name": "content_type",
15478 "type": "flags.5?string"
15479 },
15480 {
15481 "name": "w",
15482 "type": "flags.6?int"
15483 },
15484 {
15485 "name": "h",
15486 "type": "flags.6?int"
15487 },
15488 {
15489 "name": "duration",
15490 "type": "flags.7?int"
15491 },
15492 {
15493 "name": "send_message",
15494 "type": "InputBotInlineMessage"
15495 }
15496 ],
15497 "type": "InputBotInlineResult"
15498 },
15499 {
15500 "id": "175419739",
15501 "predicate": "botInlineMessageMediaAuto",
15502 "params": [
15503 {
15504 "name": "flags",
15505 "type": "#"
15506 },
15507 {
15508 "name": "caption",
15509 "type": "string"
15510 },
15511 {
15512 "name": "reply_markup",
15513 "type": "flags.2?ReplyMarkup"
15514 }
15515 ],
15516 "type": "BotInlineMessage"
15517 },
15518 {
15519 "id": "-1937807902",
15520 "predicate": "botInlineMessageText",
15521 "params": [
15522 {
15523 "name": "flags",
15524 "type": "#"
15525 },
15526 {
15527 "name": "no_webpage",
15528 "type": "flags.0?true"
15529 },
15530 {
15531 "name": "message",
15532 "type": "string"
15533 },
15534 {
15535 "name": "entities",
15536 "type": "flags.1?Vector<MessageEntity>"
15537 },
15538 {
15539 "name": "reply_markup",
15540 "type": "flags.2?ReplyMarkup"
15541 }
15542 ],
15543 "type": "BotInlineMessage"
15544 },
15545 {
15546 "id": "-1679053127",
15547 "predicate": "botInlineResult",
15548 "params": [
15549 {
15550 "name": "flags",
15551 "type": "#"
15552 },
15553 {
15554 "name": "id",
15555 "type": "string"
15556 },
15557 {
15558 "name": "type",
15559 "type": "string"
15560 },
15561 {
15562 "name": "title",
15563 "type": "flags.1?string"
15564 },
15565 {
15566 "name": "description",
15567 "type": "flags.2?string"
15568 },
15569 {
15570 "name": "url",
15571 "type": "flags.3?string"
15572 },
15573 {
15574 "name": "thumb_url",
15575 "type": "flags.4?string"
15576 },
15577 {
15578 "name": "content_url",
15579 "type": "flags.5?string"
15580 },
15581 {
15582 "name": "content_type",
15583 "type": "flags.5?string"
15584 },
15585 {
15586 "name": "w",
15587 "type": "flags.6?int"
15588 },
15589 {
15590 "name": "h",
15591 "type": "flags.6?int"
15592 },
15593 {
15594 "name": "duration",
15595 "type": "flags.7?int"
15596 },
15597 {
15598 "name": "send_message",
15599 "type": "BotInlineMessage"
15600 }
15601 ],
15602 "type": "BotInlineResult"
15603 },
15604 {
15605 "id": "627509670",
15606 "predicate": "messages.botResults",
15607 "params": [
15608 {
15609 "name": "flags",
15610 "type": "#"
15611 },
15612 {
15613 "name": "gallery",
15614 "type": "flags.0?true"
15615 },
15616 {
15617 "name": "query_id",
15618 "type": "long"
15619 },
15620 {
15621 "name": "next_offset",
15622 "type": "flags.1?string"
15623 },
15624 {
15625 "name": "switch_pm",
15626 "type": "flags.2?InlineBotSwitchPM"
15627 },
15628 {
15629 "name": "results",
15630 "type": "Vector<BotInlineResult>"
15631 }
15632 ],
15633 "type": "messages.BotResults"
15634 },
15635 {
15636 "id": "1417832080",
15637 "predicate": "updateBotInlineQuery",
15638 "params": [
15639 {
15640 "name": "flags",
15641 "type": "#"
15642 },
15643 {
15644 "name": "query_id",
15645 "type": "long"
15646 },
15647 {
15648 "name": "user_id",
15649 "type": "int"
15650 },
15651 {
15652 "name": "query",
15653 "type": "string"
15654 },
15655 {
15656 "name": "geo",
15657 "type": "flags.0?GeoPoint"
15658 },
15659 {
15660 "name": "offset",
15661 "type": "string"
15662 }
15663 ],
15664 "type": "Update"
15665 },
15666 {
15667 "id": "239663460",
15668 "predicate": "updateBotInlineSend",
15669 "params": [
15670 {
15671 "name": "flags",
15672 "type": "#"
15673 },
15674 {
15675 "name": "user_id",
15676 "type": "int"
15677 },
15678 {
15679 "name": "query",
15680 "type": "string"
15681 },
15682 {
15683 "name": "geo",
15684 "type": "flags.0?GeoPoint"
15685 },
15686 {
15687 "name": "id",
15688 "type": "string"
15689 },
15690 {
15691 "name": "msg_id",
15692 "type": "flags.1?InputBotInlineMessageID"
15693 }
15694 ],
15695 "type": "Update"
15696 },
15697 {
15698 "id": "1358283666",
15699 "predicate": "inputMessagesFilterVoice",
15700 "params": [],
15701 "type": "MessagesFilter"
15702 },
15703 {
15704 "id": "928101534",
15705 "predicate": "inputMessagesFilterMusic",
15706 "params": [],
15707 "type": "MessagesFilter"
15708 },
15709 {
15710 "id": "-1107622874",
15711 "predicate": "inputPrivacyKeyChatInvite",
15712 "params": [],
15713 "type": "InputPrivacyKey"
15714 },
15715 {
15716 "id": "1343122938",
15717 "predicate": "privacyKeyChatInvite",
15718 "params": [],
15719 "type": "PrivacyKey"
15720 },
15721 {
15722 "id": "524838915",
15723 "predicate": "exportedMessageLink",
15724 "params": [
15725 {
15726 "name": "link",
15727 "type": "string"
15728 }
15729 ],
15730 "type": "ExportedMessageLink"
15731 },
15732 {
15733 "id": "-947462709",
15734 "predicate": "messageFwdHeader",
15735 "params": [
15736 {
15737 "name": "flags",
15738 "type": "#"
15739 },
15740 {
15741 "name": "from_id",
15742 "type": "flags.0?int"
15743 },
15744 {
15745 "name": "date",
15746 "type": "int"
15747 },
15748 {
15749 "name": "channel_id",
15750 "type": "flags.1?int"
15751 },
15752 {
15753 "name": "channel_post",
15754 "type": "flags.2?int"
15755 }
15756 ],
15757 "type": "MessageFwdHeader"
15758 },
15759 {
15760 "id": "457133559",
15761 "predicate": "updateEditChannelMessage",
15762 "params": [
15763 {
15764 "name": "message",
15765 "type": "Message"
15766 },
15767 {
15768 "name": "pts",
15769 "type": "int"
15770 },
15771 {
15772 "name": "pts_count",
15773 "type": "int"
15774 }
15775 ],
15776 "type": "Update"
15777 },
15778 {
15779 "id": "-1738988427",
15780 "predicate": "updateChannelPinnedMessage",
15781 "params": [
15782 {
15783 "name": "channel_id",
15784 "type": "int"
15785 },
15786 {
15787 "name": "id",
15788 "type": "int"
15789 }
15790 ],
15791 "type": "Update"
15792 },
15793 {
15794 "id": "-1799538451",
15795 "predicate": "messageActionPinMessage",
15796 "params": [],
15797 "type": "MessageAction"
15798 },
15799 {
15800 "id": "1923290508",
15801 "predicate": "auth.codeTypeSms",
15802 "params": [],
15803 "type": "auth.CodeType"
15804 },
15805 {
15806 "id": "1948046307",
15807 "predicate": "auth.codeTypeCall",
15808 "params": [],
15809 "type": "auth.CodeType"
15810 },
15811 {
15812 "id": "577556219",
15813 "predicate": "auth.codeTypeFlashCall",
15814 "params": [],
15815 "type": "auth.CodeType"
15816 },
15817 {
15818 "id": "1035688326",
15819 "predicate": "auth.sentCodeTypeApp",
15820 "params": [
15821 {
15822 "name": "length",
15823 "type": "int"
15824 }
15825 ],
15826 "type": "auth.SentCodeType"
15827 },
15828 {
15829 "id": "-1073693790",
15830 "predicate": "auth.sentCodeTypeSms",
15831 "params": [
15832 {
15833 "name": "length",
15834 "type": "int"
15835 }
15836 ],
15837 "type": "auth.SentCodeType"
15838 },
15839 {
15840 "id": "1398007207",
15841 "predicate": "auth.sentCodeTypeCall",
15842 "params": [
15843 {
15844 "name": "length",
15845 "type": "int"
15846 }
15847 ],
15848 "type": "auth.SentCodeType"
15849 },
15850 {
15851 "id": "-1425815847",
15852 "predicate": "auth.sentCodeTypeFlashCall",
15853 "params": [
15854 {
15855 "name": "pattern",
15856 "type": "string"
15857 }
15858 ],
15859 "type": "auth.SentCodeType"
15860 },
15861 {
15862 "id": "629866245",
15863 "predicate": "keyboardButtonUrl",
15864 "params": [
15865 {
15866 "name": "text",
15867 "type": "string"
15868 },
15869 {
15870 "name": "url",
15871 "type": "string"
15872 }
15873 ],
15874 "type": "KeyboardButton"
15875 },
15876 {
15877 "id": "1748655686",
15878 "predicate": "keyboardButtonCallback",
15879 "params": [
15880 {
15881 "name": "text",
15882 "type": "string"
15883 },
15884 {
15885 "name": "data",
15886 "type": "bytes"
15887 }
15888 ],
15889 "type": "KeyboardButton"
15890 },
15891 {
15892 "id": "-1318425559",
15893 "predicate": "keyboardButtonRequestPhone",
15894 "params": [
15895 {
15896 "name": "text",
15897 "type": "string"
15898 }
15899 ],
15900 "type": "KeyboardButton"
15901 },
15902 {
15903 "id": "-59151553",
15904 "predicate": "keyboardButtonRequestGeoLocation",
15905 "params": [
15906 {
15907 "name": "text",
15908 "type": "string"
15909 }
15910 ],
15911 "type": "KeyboardButton"
15912 },
15913 {
15914 "id": "90744648",
15915 "predicate": "keyboardButtonSwitchInline",
15916 "params": [
15917 {
15918 "name": "flags",
15919 "type": "#"
15920 },
15921 {
15922 "name": "same_peer",
15923 "type": "flags.0?true"
15924 },
15925 {
15926 "name": "text",
15927 "type": "string"
15928 },
15929 {
15930 "name": "query",
15931 "type": "string"
15932 }
15933 ],
15934 "type": "KeyboardButton"
15935 },
15936 {
15937 "id": "1218642516",
15938 "predicate": "replyInlineMarkup",
15939 "params": [
15940 {
15941 "name": "rows",
15942 "type": "Vector<KeyboardButtonRow>"
15943 }
15944 ],
15945 "type": "ReplyMarkup"
15946 },
15947 {
15948 "id": "-1324486149",
15949 "predicate": "messages.botCallbackAnswer",
15950 "params": [
15951 {
15952 "name": "flags",
15953 "type": "#"
15954 },
15955 {
15956 "name": "alert",
15957 "type": "flags.1?true"
15958 },
15959 {
15960 "name": "has_url",
15961 "type": "flags.3?true"
15962 },
15963 {
15964 "name": "message",
15965 "type": "flags.0?string"
15966 },
15967 {
15968 "name": "url",
15969 "type": "flags.2?string"
15970 }
15971 ],
15972 "type": "messages.BotCallbackAnswer"
15973 },
15974 {
15975 "id": "-415938591",
15976 "predicate": "updateBotCallbackQuery",
15977 "params": [
15978 {
15979 "name": "flags",
15980 "type": "#"
15981 },
15982 {
15983 "name": "query_id",
15984 "type": "long"
15985 },
15986 {
15987 "name": "user_id",
15988 "type": "int"
15989 },
15990 {
15991 "name": "peer",
15992 "type": "Peer"
15993 },
15994 {
15995 "name": "msg_id",
15996 "type": "int"
15997 },
15998 {
15999 "name": "chat_instance",
16000 "type": "long"
16001 },
16002 {
16003 "name": "data",
16004 "type": "flags.0?bytes"
16005 },
16006 {
16007 "name": "game_short_name",
16008 "type": "flags.1?string"
16009 }
16010 ],
16011 "type": "Update"
16012 },
16013 {
16014 "id": "649453030",
16015 "predicate": "messages.messageEditData",
16016 "params": [
16017 {
16018 "name": "flags",
16019 "type": "#"
16020 },
16021 {
16022 "name": "caption",
16023 "type": "flags.0?true"
16024 }
16025 ],
16026 "type": "messages.MessageEditData"
16027 },
16028 {
16029 "id": "-469536605",
16030 "predicate": "updateEditMessage",
16031 "params": [
16032 {
16033 "name": "message",
16034 "type": "Message"
16035 },
16036 {
16037 "name": "pts",
16038 "type": "int"
16039 },
16040 {
16041 "name": "pts_count",
16042 "type": "int"
16043 }
16044 ],
16045 "type": "Update"
16046 },
16047 {
16048 "id": "-190472735",
16049 "predicate": "inputBotInlineMessageMediaGeo",
16050 "params": [
16051 {
16052 "name": "flags",
16053 "type": "#"
16054 },
16055 {
16056 "name": "geo_point",
16057 "type": "InputGeoPoint"
16058 },
16059 {
16060 "name": "reply_markup",
16061 "type": "flags.2?ReplyMarkup"
16062 }
16063 ],
16064 "type": "InputBotInlineMessage"
16065 },
16066 {
16067 "id": "-1431327288",
16068 "predicate": "inputBotInlineMessageMediaVenue",
16069 "params": [
16070 {
16071 "name": "flags",
16072 "type": "#"
16073 },
16074 {
16075 "name": "geo_point",
16076 "type": "InputGeoPoint"
16077 },
16078 {
16079 "name": "title",
16080 "type": "string"
16081 },
16082 {
16083 "name": "address",
16084 "type": "string"
16085 },
16086 {
16087 "name": "provider",
16088 "type": "string"
16089 },
16090 {
16091 "name": "venue_id",
16092 "type": "string"
16093 },
16094 {
16095 "name": "reply_markup",
16096 "type": "flags.2?ReplyMarkup"
16097 }
16098 ],
16099 "type": "InputBotInlineMessage"
16100 },
16101 {
16102 "id": "766443943",
16103 "predicate": "inputBotInlineMessageMediaContact",
16104 "params": [
16105 {
16106 "name": "flags",
16107 "type": "#"
16108 },
16109 {
16110 "name": "phone_number",
16111 "type": "string"
16112 },
16113 {
16114 "name": "first_name",
16115 "type": "string"
16116 },
16117 {
16118 "name": "last_name",
16119 "type": "string"
16120 },
16121 {
16122 "name": "reply_markup",
16123 "type": "flags.2?ReplyMarkup"
16124 }
16125 ],
16126 "type": "InputBotInlineMessage"
16127 },
16128 {
16129 "id": "982505656",
16130 "predicate": "botInlineMessageMediaGeo",
16131 "params": [
16132 {
16133 "name": "flags",
16134 "type": "#"
16135 },
16136 {
16137 "name": "geo",
16138 "type": "GeoPoint"
16139 },
16140 {
16141 "name": "reply_markup",
16142 "type": "flags.2?ReplyMarkup"
16143 }
16144 ],
16145 "type": "BotInlineMessage"
16146 },
16147 {
16148 "id": "1130767150",
16149 "predicate": "botInlineMessageMediaVenue",
16150 "params": [
16151 {
16152 "name": "flags",
16153 "type": "#"
16154 },
16155 {
16156 "name": "geo",
16157 "type": "GeoPoint"
16158 },
16159 {
16160 "name": "title",
16161 "type": "string"
16162 },
16163 {
16164 "name": "address",
16165 "type": "string"
16166 },
16167 {
16168 "name": "provider",
16169 "type": "string"
16170 },
16171 {
16172 "name": "venue_id",
16173 "type": "string"
16174 },
16175 {
16176 "name": "reply_markup",
16177 "type": "flags.2?ReplyMarkup"
16178 }
16179 ],
16180 "type": "BotInlineMessage"
16181 },
16182 {
16183 "id": "904770772",
16184 "predicate": "botInlineMessageMediaContact",
16185 "params": [
16186 {
16187 "name": "flags",
16188 "type": "#"
16189 },
16190 {
16191 "name": "phone_number",
16192 "type": "string"
16193 },
16194 {
16195 "name": "first_name",
16196 "type": "string"
16197 },
16198 {
16199 "name": "last_name",
16200 "type": "string"
16201 },
16202 {
16203 "name": "reply_markup",
16204 "type": "flags.2?ReplyMarkup"
16205 }
16206 ],
16207 "type": "BotInlineMessage"
16208 },
16209 {
16210 "id": "-1462213465",
16211 "predicate": "inputBotInlineResultPhoto",
16212 "params": [
16213 {
16214 "name": "id",
16215 "type": "string"
16216 },
16217 {
16218 "name": "type",
16219 "type": "string"
16220 },
16221 {
16222 "name": "photo",
16223 "type": "InputPhoto"
16224 },
16225 {
16226 "name": "send_message",
16227 "type": "InputBotInlineMessage"
16228 }
16229 ],
16230 "type": "InputBotInlineResult"
16231 },
16232 {
16233 "id": "-459324",
16234 "predicate": "inputBotInlineResultDocument",
16235 "params": [
16236 {
16237 "name": "flags",
16238 "type": "#"
16239 },
16240 {
16241 "name": "id",
16242 "type": "string"
16243 },
16244 {
16245 "name": "type",
16246 "type": "string"
16247 },
16248 {
16249 "name": "title",
16250 "type": "flags.1?string"
16251 },
16252 {
16253 "name": "description",
16254 "type": "flags.2?string"
16255 },
16256 {
16257 "name": "document",
16258 "type": "InputDocument"
16259 },
16260 {
16261 "name": "send_message",
16262 "type": "InputBotInlineMessage"
16263 }
16264 ],
16265 "type": "InputBotInlineResult"
16266 },
16267 {
16268 "id": "400266251",
16269 "predicate": "botInlineMediaResult",
16270 "params": [
16271 {
16272 "name": "flags",
16273 "type": "#"
16274 },
16275 {
16276 "name": "id",
16277 "type": "string"
16278 },
16279 {
16280 "name": "type",
16281 "type": "string"
16282 },
16283 {
16284 "name": "photo",
16285 "type": "flags.0?Photo"
16286 },
16287 {
16288 "name": "document",
16289 "type": "flags.1?Document"
16290 },
16291 {
16292 "name": "title",
16293 "type": "flags.2?string"
16294 },
16295 {
16296 "name": "description",
16297 "type": "flags.3?string"
16298 },
16299 {
16300 "name": "send_message",
16301 "type": "BotInlineMessage"
16302 }
16303 ],
16304 "type": "BotInlineResult"
16305 },
16306 {
16307 "id": "-1995686519",
16308 "predicate": "inputBotInlineMessageID",
16309 "params": [
16310 {
16311 "name": "dc_id",
16312 "type": "int"
16313 },
16314 {
16315 "name": "id",
16316 "type": "long"
16317 },
16318 {
16319 "name": "access_hash",
16320 "type": "long"
16321 }
16322 ],
16323 "type": "InputBotInlineMessageID"
16324 },
16325 {
16326 "id": "-103646630",
16327 "predicate": "updateInlineBotCallbackQuery",
16328 "params": [
16329 {
16330 "name": "flags",
16331 "type": "#"
16332 },
16333 {
16334 "name": "query_id",
16335 "type": "long"
16336 },
16337 {
16338 "name": "user_id",
16339 "type": "int"
16340 },
16341 {
16342 "name": "msg_id",
16343 "type": "InputBotInlineMessageID"
16344 },
16345 {
16346 "name": "chat_instance",
16347 "type": "long"
16348 },
16349 {
16350 "name": "data",
16351 "type": "flags.0?bytes"
16352 },
16353 {
16354 "name": "game_short_name",
16355 "type": "flags.1?string"
16356 }
16357 ],
16358 "type": "Update"
16359 },
16360 {
16361 "id": "1008755359",
16362 "predicate": "inlineBotSwitchPM",
16363 "params": [
16364 {
16365 "name": "text",
16366 "type": "string"
16367 },
16368 {
16369 "name": "start_param",
16370 "type": "string"
16371 }
16372 ],
16373 "type": "InlineBotSwitchPM"
16374 },
16375 {
16376 "id": "863093588",
16377 "predicate": "messages.peerDialogs",
16378 "params": [
16379 {
16380 "name": "dialogs",
16381 "type": "Vector<Dialog>"
16382 },
16383 {
16384 "name": "messages",
16385 "type": "Vector<Message>"
16386 },
16387 {
16388 "name": "chats",
16389 "type": "Vector<Chat>"
16390 },
16391 {
16392 "name": "users",
16393 "type": "Vector<User>"
16394 },
16395 {
16396 "name": "state",
16397 "type": "updates.State"
16398 }
16399 ],
16400 "type": "messages.PeerDialogs"
16401 },
16402 {
16403 "id": "-305282981",
16404 "predicate": "topPeer",
16405 "params": [
16406 {
16407 "name": "peer",
16408 "type": "Peer"
16409 },
16410 {
16411 "name": "rating",
16412 "type": "double"
16413 }
16414 ],
16415 "type": "TopPeer"
16416 },
16417 {
16418 "id": "-1419371685",
16419 "predicate": "topPeerCategoryBotsPM",
16420 "params": [],
16421 "type": "TopPeerCategory"
16422 },
16423 {
16424 "id": "344356834",
16425 "predicate": "topPeerCategoryBotsInline",
16426 "params": [],
16427 "type": "TopPeerCategory"
16428 },
16429 {
16430 "id": "104314861",
16431 "predicate": "topPeerCategoryCorrespondents",
16432 "params": [],
16433 "type": "TopPeerCategory"
16434 },
16435 {
16436 "id": "-1122524854",
16437 "predicate": "topPeerCategoryGroups",
16438 "params": [],
16439 "type": "TopPeerCategory"
16440 },
16441 {
16442 "id": "371037736",
16443 "predicate": "topPeerCategoryChannels",
16444 "params": [],
16445 "type": "TopPeerCategory"
16446 },
16447 {
16448 "id": "-75283823",
16449 "predicate": "topPeerCategoryPeers",
16450 "params": [
16451 {
16452 "name": "category",
16453 "type": "TopPeerCategory"
16454 },
16455 {
16456 "name": "count",
16457 "type": "int"
16458 },
16459 {
16460 "name": "peers",
16461 "type": "Vector<TopPeer>"
16462 }
16463 ],
16464 "type": "TopPeerCategoryPeers"
16465 },
16466 {
16467 "id": "-567906571",
16468 "predicate": "contacts.topPeersNotModified",
16469 "params": [],
16470 "type": "contacts.TopPeers"
16471 },
16472 {
16473 "id": "1891070632",
16474 "predicate": "contacts.topPeers",
16475 "params": [
16476 {
16477 "name": "categories",
16478 "type": "Vector<TopPeerCategoryPeers>"
16479 },
16480 {
16481 "name": "chats",
16482 "type": "Vector<Chat>"
16483 },
16484 {
16485 "name": "users",
16486 "type": "Vector<User>"
16487 }
16488 ],
16489 "type": "contacts.TopPeers"
16490 },
16491 {
16492 "id": "892193368",
16493 "predicate": "messageEntityMentionName",
16494 "params": [
16495 {
16496 "name": "offset",
16497 "type": "int"
16498 },
16499 {
16500 "name": "length",
16501 "type": "int"
16502 },
16503 {
16504 "name": "user_id",
16505 "type": "int"
16506 }
16507 ],
16508 "type": "MessageEntity"
16509 },
16510 {
16511 "id": "546203849",
16512 "predicate": "inputMessageEntityMentionName",
16513 "params": [
16514 {
16515 "name": "offset",
16516 "type": "int"
16517 },
16518 {
16519 "name": "length",
16520 "type": "int"
16521 },
16522 {
16523 "name": "user_id",
16524 "type": "InputUser"
16525 }
16526 ],
16527 "type": "MessageEntity"
16528 },
16529 {
16530 "id": "975236280",
16531 "predicate": "inputMessagesFilterChatPhotos",
16532 "params": [],
16533 "type": "MessagesFilter"
16534 },
16535 {
16536 "id": "634833351",
16537 "predicate": "updateReadChannelOutbox",
16538 "params": [
16539 {
16540 "name": "channel_id",
16541 "type": "int"
16542 },
16543 {
16544 "name": "max_id",
16545 "type": "int"
16546 }
16547 ],
16548 "type": "Update"
16549 },
16550 {
16551 "id": "-299124375",
16552 "predicate": "updateDraftMessage",
16553 "params": [
16554 {
16555 "name": "peer",
16556 "type": "Peer"
16557 },
16558 {
16559 "name": "draft",
16560 "type": "DraftMessage"
16561 }
16562 ],
16563 "type": "Update"
16564 },
16565 {
16566 "id": "-1169445179",
16567 "predicate": "draftMessageEmpty",
16568 "params": [],
16569 "type": "DraftMessage"
16570 },
16571 {
16572 "id": "-40996577",
16573 "predicate": "draftMessage",
16574 "params": [
16575 {
16576 "name": "flags",
16577 "type": "#"
16578 },
16579 {
16580 "name": "no_webpage",
16581 "type": "flags.1?true"
16582 },
16583 {
16584 "name": "reply_to_msg_id",
16585 "type": "flags.0?int"
16586 },
16587 {
16588 "name": "message",
16589 "type": "string"
16590 },
16591 {
16592 "name": "entities",
16593 "type": "flags.3?Vector<MessageEntity>"
16594 },
16595 {
16596 "name": "date",
16597 "type": "int"
16598 }
16599 ],
16600 "type": "DraftMessage"
16601 },
16602 {
16603 "id": "-1615153660",
16604 "predicate": "messageActionHistoryClear",
16605 "params": [],
16606 "type": "MessageAction"
16607 },
16608 {
16609 "id": "82699215",
16610 "predicate": "messages.featuredStickersNotModified",
16611 "params": [],
16612 "type": "messages.FeaturedStickers"
16613 },
16614 {
16615 "id": "-123893531",
16616 "predicate": "messages.featuredStickers",
16617 "params": [
16618 {
16619 "name": "hash",
16620 "type": "int"
16621 },
16622 {
16623 "name": "sets",
16624 "type": "Vector<StickerSetCovered>"
16625 },
16626 {
16627 "name": "unread",
16628 "type": "Vector<long>"
16629 }
16630 ],
16631 "type": "messages.FeaturedStickers"
16632 },
16633 {
16634 "id": "1461528386",
16635 "predicate": "updateReadFeaturedStickers",
16636 "params": [],
16637 "type": "Update"
16638 },
16639 {
16640 "id": "186120336",
16641 "predicate": "messages.recentStickersNotModified",
16642 "params": [],
16643 "type": "messages.RecentStickers"
16644 },
16645 {
16646 "id": "1558317424",
16647 "predicate": "messages.recentStickers",
16648 "params": [
16649 {
16650 "name": "hash",
16651 "type": "int"
16652 },
16653 {
16654 "name": "stickers",
16655 "type": "Vector<Document>"
16656 }
16657 ],
16658 "type": "messages.RecentStickers"
16659 },
16660 {
16661 "id": "-1706939360",
16662 "predicate": "updateRecentStickers",
16663 "params": [],
16664 "type": "Update"
16665 },
16666 {
16667 "id": "1338747336",
16668 "predicate": "messages.archivedStickers",
16669 "params": [
16670 {
16671 "name": "count",
16672 "type": "int"
16673 },
16674 {
16675 "name": "sets",
16676 "type": "Vector<StickerSetCovered>"
16677 }
16678 ],
16679 "type": "messages.ArchivedStickers"
16680 },
16681 {
16682 "id": "946083368",
16683 "predicate": "messages.stickerSetInstallResultSuccess",
16684 "params": [],
16685 "type": "messages.StickerSetInstallResult"
16686 },
16687 {
16688 "id": "904138920",
16689 "predicate": "messages.stickerSetInstallResultArchive",
16690 "params": [
16691 {
16692 "name": "sets",
16693 "type": "Vector<StickerSetCovered>"
16694 }
16695 ],
16696 "type": "messages.StickerSetInstallResult"
16697 },
16698 {
16699 "id": "1678812626",
16700 "predicate": "stickerSetCovered",
16701 "params": [
16702 {
16703 "name": "set",
16704 "type": "StickerSet"
16705 },
16706 {
16707 "name": "cover",
16708 "type": "Document"
16709 }
16710 ],
16711 "type": "StickerSetCovered"
16712 },
16713 {
16714 "id": "-1574314746",
16715 "predicate": "updateConfig",
16716 "params": [],
16717 "type": "Update"
16718 },
16719 {
16720 "id": "861169551",
16721 "predicate": "updatePtsChanged",
16722 "params": [],
16723 "type": "Update"
16724 },
16725 {
16726 "id": "-1252045032",
16727 "predicate": "inputMediaPhotoExternal",
16728 "params": [
16729 {
16730 "name": "url",
16731 "type": "string"
16732 },
16733 {
16734 "name": "caption",
16735 "type": "string"
16736 }
16737 ],
16738 "type": "InputMedia"
16739 },
16740 {
16741 "id": "-437690244",
16742 "predicate": "inputMediaDocumentExternal",
16743 "params": [
16744 {
16745 "name": "url",
16746 "type": "string"
16747 },
16748 {
16749 "name": "caption",
16750 "type": "string"
16751 }
16752 ],
16753 "type": "InputMedia"
16754 },
16755 {
16756 "id": "872932635",
16757 "predicate": "stickerSetMultiCovered",
16758 "params": [
16759 {
16760 "name": "set",
16761 "type": "StickerSet"
16762 },
16763 {
16764 "name": "covers",
16765 "type": "Vector<Document>"
16766 }
16767 ],
16768 "type": "StickerSetCovered"
16769 },
16770 {
16771 "id": "-1361650766",
16772 "predicate": "maskCoords",
16773 "params": [
16774 {
16775 "name": "n",
16776 "type": "int"
16777 },
16778 {
16779 "name": "x",
16780 "type": "double"
16781 },
16782 {
16783 "name": "y",
16784 "type": "double"
16785 },
16786 {
16787 "name": "zoom",
16788 "type": "double"
16789 }
16790 ],
16791 "type": "MaskCoords"
16792 },
16793 {
16794 "id": "-1744710921",
16795 "predicate": "documentAttributeHasStickers",
16796 "params": [],
16797 "type": "DocumentAttribute"
16798 },
16799 {
16800 "id": "1251549527",
16801 "predicate": "inputStickeredMediaPhoto",
16802 "params": [
16803 {
16804 "name": "id",
16805 "type": "InputPhoto"
16806 }
16807 ],
16808 "type": "InputStickeredMedia"
16809 },
16810 {
16811 "id": "70813275",
16812 "predicate": "inputStickeredMediaDocument",
16813 "params": [
16814 {
16815 "name": "id",
16816 "type": "InputDocument"
16817 }
16818 ],
16819 "type": "InputStickeredMedia"
16820 },
16821 {
16822 "id": "-1107729093",
16823 "predicate": "game",
16824 "params": [
16825 {
16826 "name": "flags",
16827 "type": "#"
16828 },
16829 {
16830 "name": "id",
16831 "type": "long"
16832 },
16833 {
16834 "name": "access_hash",
16835 "type": "long"
16836 },
16837 {
16838 "name": "short_name",
16839 "type": "string"
16840 },
16841 {
16842 "name": "title",
16843 "type": "string"
16844 },
16845 {
16846 "name": "description",
16847 "type": "string"
16848 },
16849 {
16850 "name": "photo",
16851 "type": "Photo"
16852 },
16853 {
16854 "name": "document",
16855 "type": "flags.0?Document"
16856 }
16857 ],
16858 "type": "Game"
16859 },
16860 {
16861 "id": "1336154098",
16862 "predicate": "inputBotInlineResultGame",
16863 "params": [
16864 {
16865 "name": "id",
16866 "type": "string"
16867 },
16868 {
16869 "name": "short_name",
16870 "type": "string"
16871 },
16872 {
16873 "name": "send_message",
16874 "type": "InputBotInlineMessage"
16875 }
16876 ],
16877 "type": "InputBotInlineResult"
16878 },
16879 {
16880 "id": "1262639204",
16881 "predicate": "inputBotInlineMessageGame",
16882 "params": [
16883 {
16884 "name": "flags",
16885 "type": "#"
16886 },
16887 {
16888 "name": "reply_markup",
16889 "type": "flags.2?ReplyMarkup"
16890 }
16891 ],
16892 "type": "InputBotInlineMessage"
16893 },
16894 {
16895 "id": "-580219064",
16896 "predicate": "sendMessageGamePlayAction",
16897 "params": [],
16898 "type": "SendMessageAction"
16899 },
16900 {
16901 "id": "-38694904",
16902 "predicate": "messageMediaGame",
16903 "params": [
16904 {
16905 "name": "game",
16906 "type": "Game"
16907 }
16908 ],
16909 "type": "MessageMedia"
16910 },
16911 {
16912 "id": "-750828557",
16913 "predicate": "inputMediaGame",
16914 "params": [
16915 {
16916 "name": "id",
16917 "type": "InputGame"
16918 }
16919 ],
16920 "type": "InputMedia"
16921 },
16922 {
16923 "id": "53231223",
16924 "predicate": "inputGameID",
16925 "params": [
16926 {
16927 "name": "id",
16928 "type": "long"
16929 },
16930 {
16931 "name": "access_hash",
16932 "type": "long"
16933 }
16934 ],
16935 "type": "InputGame"
16936 },
16937 {
16938 "id": "-1020139510",
16939 "predicate": "inputGameShortName",
16940 "params": [
16941 {
16942 "name": "bot_id",
16943 "type": "InputUser"
16944 },
16945 {
16946 "name": "short_name",
16947 "type": "string"
16948 }
16949 ],
16950 "type": "InputGame"
16951 },
16952 {
16953 "id": "1358175439",
16954 "predicate": "keyboardButtonGame",
16955 "params": [
16956 {
16957 "name": "text",
16958 "type": "string"
16959 }
16960 ],
16961 "type": "KeyboardButton"
16962 },
16963 {
16964 "id": "-1834538890",
16965 "predicate": "messageActionGameScore",
16966 "params": [
16967 {
16968 "name": "game_id",
16969 "type": "long"
16970 },
16971 {
16972 "name": "score",
16973 "type": "int"
16974 }
16975 ],
16976 "type": "MessageAction"
16977 },
16978 {
16979 "id": "1493171408",
16980 "predicate": "highScore",
16981 "params": [
16982 {
16983 "name": "pos",
16984 "type": "int"
16985 },
16986 {
16987 "name": "user_id",
16988 "type": "int"
16989 },
16990 {
16991 "name": "score",
16992 "type": "int"
16993 }
16994 ],
16995 "type": "HighScore"
16996 },
16997 {
16998 "id": "-1707344487",
16999 "predicate": "messages.highScores",
17000 "params": [
17001 {
17002 "name": "scores",
17003 "type": "Vector<HighScore>"
17004 },
17005 {
17006 "name": "users",
17007 "type": "Vector<User>"
17008 }
17009 ],
17010 "type": "messages.HighScores"
17011 }
17012 ],
17013 "methods": [
17014 {
17015 "id": "-878758099",
17016 "method": "invokeAfterMsg",
17017 "params": [
17018 {
17019 "name": "msg_id",
17020 "type": "long"
17021 },
17022 {
17023 "name": "query",
17024 "type": "!X"
17025 }
17026 ],
17027 "type": "X"
17028 },
17029 {
17030 "id": "1036301552",
17031 "method": "invokeAfterMsgs",
17032 "params": [
17033 {
17034 "name": "msg_ids",
17035 "type": "Vector<long>"
17036 },
17037 {
17038 "name": "query",
17039 "type": "!X"
17040 }
17041 ],
17042 "type": "X"
17043 },
17044 {
17045 "id": "1877286395",
17046 "method": "auth.checkPhone",
17047 "params": [
17048 {
17049 "name": "phone_number",
17050 "type": "string"
17051 }
17052 ],
17053 "type": "auth.CheckedPhone"
17054 },
17055 {
17056 "id": "-2035355412",
17057 "method": "auth.sendCode",
17058 "params": [
17059 {
17060 "name": "flags",
17061 "type": "#"
17062 },
17063 {
17064 "name": "allow_flashcall",
17065 "type": "flags.0?true"
17066 },
17067 {
17068 "name": "phone_number",
17069 "type": "string"
17070 },
17071 {
17072 "name": "current_number",
17073 "type": "flags.0?Bool"
17074 },
17075 {
17076 "name": "api_id",
17077 "type": "int"
17078 },
17079 {
17080 "name": "api_hash",
17081 "type": "string"
17082 }
17083 ],
17084 "type": "auth.SentCode"
17085 },
17086 {
17087 "id": "453408308",
17088 "method": "auth.signUp",
17089 "params": [
17090 {
17091 "name": "phone_number",
17092 "type": "string"
17093 },
17094 {
17095 "name": "phone_code_hash",
17096 "type": "string"
17097 },
17098 {
17099 "name": "phone_code",
17100 "type": "string"
17101 },
17102 {
17103 "name": "first_name",
17104 "type": "string"
17105 },
17106 {
17107 "name": "last_name",
17108 "type": "string"
17109 }
17110 ],
17111 "type": "auth.Authorization"
17112 },
17113 {
17114 "id": "-1126886015",
17115 "method": "auth.signIn",
17116 "params": [
17117 {
17118 "name": "phone_number",
17119 "type": "string"
17120 },
17121 {
17122 "name": "phone_code_hash",
17123 "type": "string"
17124 },
17125 {
17126 "name": "phone_code",
17127 "type": "string"
17128 }
17129 ],
17130 "type": "auth.Authorization"
17131 },
17132 {
17133 "id": "1461180992",
17134 "method": "auth.logOut",
17135 "params": [],
17136 "type": "Bool"
17137 },
17138 {
17139 "id": "-1616179942",
17140 "method": "auth.resetAuthorizations",
17141 "params": [],
17142 "type": "Bool"
17143 },
17144 {
17145 "id": "1998331287",
17146 "method": "auth.sendInvites",
17147 "params": [
17148 {
17149 "name": "phone_numbers",
17150 "type": "Vector<string>"
17151 },
17152 {
17153 "name": "message",
17154 "type": "string"
17155 }
17156 ],
17157 "type": "Bool"
17158 },
17159 {
17160 "id": "-440401971",
17161 "method": "auth.exportAuthorization",
17162 "params": [
17163 {
17164 "name": "dc_id",
17165 "type": "int"
17166 }
17167 ],
17168 "type": "auth.ExportedAuthorization"
17169 },
17170 {
17171 "id": "-470837741",
17172 "method": "auth.importAuthorization",
17173 "params": [
17174 {
17175 "name": "id",
17176 "type": "int"
17177 },
17178 {
17179 "name": "bytes",
17180 "type": "bytes"
17181 }
17182 ],
17183 "type": "auth.Authorization"
17184 },
17185 {
17186 "id": "-841733627",
17187 "method": "auth.bindTempAuthKey",
17188 "params": [
17189 {
17190 "name": "perm_auth_key_id",
17191 "type": "long"
17192 },
17193 {
17194 "name": "nonce",
17195 "type": "long"
17196 },
17197 {
17198 "name": "expires_at",
17199 "type": "int"
17200 },
17201 {
17202 "name": "encrypted_message",
17203 "type": "bytes"
17204 }
17205 ],
17206 "type": "Bool"
17207 },
17208 {
17209 "id": "1669245048",
17210 "method": "account.registerDevice",
17211 "params": [
17212 {
17213 "name": "token_type",
17214 "type": "int"
17215 },
17216 {
17217 "name": "token",
17218 "type": "string"
17219 }
17220 ],
17221 "type": "Bool"
17222 },
17223 {
17224 "id": "1707432768",
17225 "method": "account.unregisterDevice",
17226 "params": [
17227 {
17228 "name": "token_type",
17229 "type": "int"
17230 },
17231 {
17232 "name": "token",
17233 "type": "string"
17234 }
17235 ],
17236 "type": "Bool"
17237 },
17238 {
17239 "id": "-2067899501",
17240 "method": "account.updateNotifySettings",
17241 "params": [
17242 {
17243 "name": "peer",
17244 "type": "InputNotifyPeer"
17245 },
17246 {
17247 "name": "settings",
17248 "type": "InputPeerNotifySettings"
17249 }
17250 ],
17251 "type": "Bool"
17252 },
17253 {
17254 "id": "313765169",
17255 "method": "account.getNotifySettings",
17256 "params": [
17257 {
17258 "name": "peer",
17259 "type": "InputNotifyPeer"
17260 }
17261 ],
17262 "type": "PeerNotifySettings"
17263 },
17264 {
17265 "id": "-612493497",
17266 "method": "account.resetNotifySettings",
17267 "params": [],
17268 "type": "Bool"
17269 },
17270 {
17271 "id": "2018596725",
17272 "method": "account.updateProfile",
17273 "params": [
17274 {
17275 "name": "flags",
17276 "type": "#"
17277 },
17278 {
17279 "name": "first_name",
17280 "type": "flags.0?string"
17281 },
17282 {
17283 "name": "last_name",
17284 "type": "flags.1?string"
17285 },
17286 {
17287 "name": "about",
17288 "type": "flags.2?string"
17289 }
17290 ],
17291 "type": "User"
17292 },
17293 {
17294 "id": "1713919532",
17295 "method": "account.updateStatus",
17296 "params": [
17297 {
17298 "name": "offline",
17299 "type": "Bool"
17300 }
17301 ],
17302 "type": "Bool"
17303 },
17304 {
17305 "id": "-1068696894",
17306 "method": "account.getWallPapers",
17307 "params": [],
17308 "type": "Vector<WallPaper>"
17309 },
17310 {
17311 "id": "-1374118561",
17312 "method": "account.reportPeer",
17313 "params": [
17314 {
17315 "name": "peer",
17316 "type": "InputPeer"
17317 },
17318 {
17319 "name": "reason",
17320 "type": "ReportReason"
17321 }
17322 ],
17323 "type": "Bool"
17324 },
17325 {
17326 "id": "227648840",
17327 "method": "users.getUsers",
17328 "params": [
17329 {
17330 "name": "id",
17331 "type": "Vector<InputUser>"
17332 }
17333 ],
17334 "type": "Vector<User>"
17335 },
17336 {
17337 "id": "-902781519",
17338 "method": "users.getFullUser",
17339 "params": [
17340 {
17341 "name": "id",
17342 "type": "InputUser"
17343 }
17344 ],
17345 "type": "UserFull"
17346 },
17347 {
17348 "id": "-995929106",
17349 "method": "contacts.getStatuses",
17350 "params": [],
17351 "type": "Vector<ContactStatus>"
17352 },
17353 {
17354 "id": "583445000",
17355 "method": "contacts.getContacts",
17356 "params": [
17357 {
17358 "name": "hash",
17359 "type": "string"
17360 }
17361 ],
17362 "type": "contacts.Contacts"
17363 },
17364 {
17365 "id": "-634342611",
17366 "method": "contacts.importContacts",
17367 "params": [
17368 {
17369 "name": "contacts",
17370 "type": "Vector<InputContact>"
17371 },
17372 {
17373 "name": "replace",
17374 "type": "Bool"
17375 }
17376 ],
17377 "type": "contacts.ImportedContacts"
17378 },
17379 {
17380 "id": "-1902823612",
17381 "method": "contacts.deleteContact",
17382 "params": [
17383 {
17384 "name": "id",
17385 "type": "InputUser"
17386 }
17387 ],
17388 "type": "contacts.Link"
17389 },
17390 {
17391 "id": "1504393374",
17392 "method": "contacts.deleteContacts",
17393 "params": [
17394 {
17395 "name": "id",
17396 "type": "Vector<InputUser>"
17397 }
17398 ],
17399 "type": "Bool"
17400 },
17401 {
17402 "id": "858475004",
17403 "method": "contacts.block",
17404 "params": [
17405 {
17406 "name": "id",
17407 "type": "InputUser"
17408 }
17409 ],
17410 "type": "Bool"
17411 },
17412 {
17413 "id": "-448724803",
17414 "method": "contacts.unblock",
17415 "params": [
17416 {
17417 "name": "id",
17418 "type": "InputUser"
17419 }
17420 ],
17421 "type": "Bool"
17422 },
17423 {
17424 "id": "-176409329",
17425 "method": "contacts.getBlocked",
17426 "params": [
17427 {
17428 "name": "offset",
17429 "type": "int"
17430 },
17431 {
17432 "name": "limit",
17433 "type": "int"
17434 }
17435 ],
17436 "type": "contacts.Blocked"
17437 },
17438 {
17439 "id": "-2065352905",
17440 "method": "contacts.exportCard",
17441 "params": [],
17442 "type": "Vector<int>"
17443 },
17444 {
17445 "id": "1340184318",
17446 "method": "contacts.importCard",
17447 "params": [
17448 {
17449 "name": "export_card",
17450 "type": "Vector<int>"
17451 }
17452 ],
17453 "type": "User"
17454 },
17455 {
17456 "id": "1109588596",
17457 "method": "messages.getMessages",
17458 "params": [
17459 {
17460 "name": "id",
17461 "type": "Vector<int>"
17462 }
17463 ],
17464 "type": "messages.Messages"
17465 },
17466 {
17467 "id": "1799878989",
17468 "method": "messages.getDialogs",
17469 "params": [
17470 {
17471 "name": "offset_date",
17472 "type": "int"
17473 },
17474 {
17475 "name": "offset_id",
17476 "type": "int"
17477 },
17478 {
17479 "name": "offset_peer",
17480 "type": "InputPeer"
17481 },
17482 {
17483 "name": "limit",
17484 "type": "int"
17485 }
17486 ],
17487 "type": "messages.Dialogs"
17488 },
17489 {
17490 "id": "-1347868602",
17491 "method": "messages.getHistory",
17492 "params": [
17493 {
17494 "name": "peer",
17495 "type": "InputPeer"
17496 },
17497 {
17498 "name": "offset_id",
17499 "type": "int"
17500 },
17501 {
17502 "name": "offset_date",
17503 "type": "int"
17504 },
17505 {
17506 "name": "add_offset",
17507 "type": "int"
17508 },
17509 {
17510 "name": "limit",
17511 "type": "int"
17512 },
17513 {
17514 "name": "max_id",
17515 "type": "int"
17516 },
17517 {
17518 "name": "min_id",
17519 "type": "int"
17520 }
17521 ],
17522 "type": "messages.Messages"
17523 },
17524 {
17525 "id": "-732523960",
17526 "method": "messages.search",
17527 "params": [
17528 {
17529 "name": "flags",
17530 "type": "#"
17531 },
17532 {
17533 "name": "peer",
17534 "type": "InputPeer"
17535 },
17536 {
17537 "name": "q",
17538 "type": "string"
17539 },
17540 {
17541 "name": "filter",
17542 "type": "MessagesFilter"
17543 },
17544 {
17545 "name": "min_date",
17546 "type": "int"
17547 },
17548 {
17549 "name": "max_date",
17550 "type": "int"
17551 },
17552 {
17553 "name": "offset",
17554 "type": "int"
17555 },
17556 {
17557 "name": "max_id",
17558 "type": "int"
17559 },
17560 {
17561 "name": "limit",
17562 "type": "int"
17563 }
17564 ],
17565 "type": "messages.Messages"
17566 },
17567 {
17568 "id": "238054714",
17569 "method": "messages.readHistory",
17570 "params": [
17571 {
17572 "name": "peer",
17573 "type": "InputPeer"
17574 },
17575 {
17576 "name": "max_id",
17577 "type": "int"
17578 }
17579 ],
17580 "type": "messages.AffectedMessages"
17581 },
17582 {
17583 "id": "469850889",
17584 "method": "messages.deleteHistory",
17585 "params": [
17586 {
17587 "name": "flags",
17588 "type": "#"
17589 },
17590 {
17591 "name": "just_clear",
17592 "type": "flags.0?true"
17593 },
17594 {
17595 "name": "peer",
17596 "type": "InputPeer"
17597 },
17598 {
17599 "name": "max_id",
17600 "type": "int"
17601 }
17602 ],
17603 "type": "messages.AffectedHistory"
17604 },
17605 {
17606 "id": "-1510897371",
17607 "method": "messages.deleteMessages",
17608 "params": [
17609 {
17610 "name": "id",
17611 "type": "Vector<int>"
17612 }
17613 ],
17614 "type": "messages.AffectedMessages"
17615 },
17616 {
17617 "id": "94983360",
17618 "method": "messages.receivedMessages",
17619 "params": [
17620 {
17621 "name": "max_id",
17622 "type": "int"
17623 }
17624 ],
17625 "type": "Vector<ReceivedNotifyMessage>"
17626 },
17627 {
17628 "id": "-1551737264",
17629 "method": "messages.setTyping",
17630 "params": [
17631 {
17632 "name": "peer",
17633 "type": "InputPeer"
17634 },
17635 {
17636 "name": "action",
17637 "type": "SendMessageAction"
17638 }
17639 ],
17640 "type": "Bool"
17641 },
17642 {
17643 "id": "-91733382",
17644 "method": "messages.sendMessage",
17645 "params": [
17646 {
17647 "name": "flags",
17648 "type": "#"
17649 },
17650 {
17651 "name": "no_webpage",
17652 "type": "flags.1?true"
17653 },
17654 {
17655 "name": "silent",
17656 "type": "flags.5?true"
17657 },
17658 {
17659 "name": "background",
17660 "type": "flags.6?true"
17661 },
17662 {
17663 "name": "clear_draft",
17664 "type": "flags.7?true"
17665 },
17666 {
17667 "name": "peer",
17668 "type": "InputPeer"
17669 },
17670 {
17671 "name": "reply_to_msg_id",
17672 "type": "flags.0?int"
17673 },
17674 {
17675 "name": "message",
17676 "type": "string"
17677 },
17678 {
17679 "name": "random_id",
17680 "type": "long"
17681 },
17682 {
17683 "name": "reply_markup",
17684 "type": "flags.2?ReplyMarkup"
17685 },
17686 {
17687 "name": "entities",
17688 "type": "flags.3?Vector<MessageEntity>"
17689 }
17690 ],
17691 "type": "Updates"
17692 },
17693 {
17694 "id": "-923703407",
17695 "method": "messages.sendMedia",
17696 "params": [
17697 {
17698 "name": "flags",
17699 "type": "#"
17700 },
17701 {
17702 "name": "silent",
17703 "type": "flags.5?true"
17704 },
17705 {
17706 "name": "background",
17707 "type": "flags.6?true"
17708 },
17709 {
17710 "name": "clear_draft",
17711 "type": "flags.7?true"
17712 },
17713 {
17714 "name": "peer",
17715 "type": "InputPeer"
17716 },
17717 {
17718 "name": "reply_to_msg_id",
17719 "type": "flags.0?int"
17720 },
17721 {
17722 "name": "media",
17723 "type": "InputMedia"
17724 },
17725 {
17726 "name": "random_id",
17727 "type": "long"
17728 },
17729 {
17730 "name": "reply_markup",
17731 "type": "flags.2?ReplyMarkup"
17732 }
17733 ],
17734 "type": "Updates"
17735 },
17736 {
17737 "id": "1888354709",
17738 "method": "messages.forwardMessages",
17739 "params": [
17740 {
17741 "name": "flags",
17742 "type": "#"
17743 },
17744 {
17745 "name": "silent",
17746 "type": "flags.5?true"
17747 },
17748 {
17749 "name": "background",
17750 "type": "flags.6?true"
17751 },
17752 {
17753 "name": "with_my_score",
17754 "type": "flags.8?true"
17755 },
17756 {
17757 "name": "from_peer",
17758 "type": "InputPeer"
17759 },
17760 {
17761 "name": "id",
17762 "type": "Vector<int>"
17763 },
17764 {
17765 "name": "random_id",
17766 "type": "Vector<long>"
17767 },
17768 {
17769 "name": "to_peer",
17770 "type": "InputPeer"
17771 }
17772 ],
17773 "type": "Updates"
17774 },
17775 {
17776 "id": "-820669733",
17777 "method": "messages.reportSpam",
17778 "params": [
17779 {
17780 "name": "peer",
17781 "type": "InputPeer"
17782 }
17783 ],
17784 "type": "Bool"
17785 },
17786 {
17787 "id": "-1460572005",
17788 "method": "messages.hideReportSpam",
17789 "params": [
17790 {
17791 "name": "peer",
17792 "type": "InputPeer"
17793 }
17794 ],
17795 "type": "Bool"
17796 },
17797 {
17798 "id": "913498268",
17799 "method": "messages.getPeerSettings",
17800 "params": [
17801 {
17802 "name": "peer",
17803 "type": "InputPeer"
17804 }
17805 ],
17806 "type": "PeerSettings"
17807 },
17808 {
17809 "id": "1013621127",
17810 "method": "messages.getChats",
17811 "params": [
17812 {
17813 "name": "id",
17814 "type": "Vector<int>"
17815 }
17816 ],
17817 "type": "messages.Chats"
17818 },
17819 {
17820 "id": "998448230",
17821 "method": "messages.getFullChat",
17822 "params": [
17823 {
17824 "name": "chat_id",
17825 "type": "int"
17826 }
17827 ],
17828 "type": "messages.ChatFull"
17829 },
17830 {
17831 "id": "-599447467",
17832 "method": "messages.editChatTitle",
17833 "params": [
17834 {
17835 "name": "chat_id",
17836 "type": "int"
17837 },
17838 {
17839 "name": "title",
17840 "type": "string"
17841 }
17842 ],
17843 "type": "Updates"
17844 },
17845 {
17846 "id": "-900957736",
17847 "method": "messages.editChatPhoto",
17848 "params": [
17849 {
17850 "name": "chat_id",
17851 "type": "int"
17852 },
17853 {
17854 "name": "photo",
17855 "type": "InputChatPhoto"
17856 }
17857 ],
17858 "type": "Updates"
17859 },
17860 {
17861 "id": "-106911223",
17862 "method": "messages.addChatUser",
17863 "params": [
17864 {
17865 "name": "chat_id",
17866 "type": "int"
17867 },
17868 {
17869 "name": "user_id",
17870 "type": "InputUser"
17871 },
17872 {
17873 "name": "fwd_limit",
17874 "type": "int"
17875 }
17876 ],
17877 "type": "Updates"
17878 },
17879 {
17880 "id": "-530505962",
17881 "method": "messages.deleteChatUser",
17882 "params": [
17883 {
17884 "name": "chat_id",
17885 "type": "int"
17886 },
17887 {
17888 "name": "user_id",
17889 "type": "InputUser"
17890 }
17891 ],
17892 "type": "Updates"
17893 },
17894 {
17895 "id": "164303470",
17896 "method": "messages.createChat",
17897 "params": [
17898 {
17899 "name": "users",
17900 "type": "Vector<InputUser>"
17901 },
17902 {
17903 "name": "title",
17904 "type": "string"
17905 }
17906 ],
17907 "type": "Updates"
17908 },
17909 {
17910 "id": "-304838614",
17911 "method": "updates.getState",
17912 "params": [],
17913 "type": "updates.State"
17914 },
17915 {
17916 "id": "168039573",
17917 "method": "updates.getDifference",
17918 "params": [
17919 {
17920 "name": "pts",
17921 "type": "int"
17922 },
17923 {
17924 "name": "date",
17925 "type": "int"
17926 },
17927 {
17928 "name": "qts",
17929 "type": "int"
17930 }
17931 ],
17932 "type": "updates.Difference"
17933 },
17934 {
17935 "id": "-256159406",
17936 "method": "photos.updateProfilePhoto",
17937 "params": [
17938 {
17939 "name": "id",
17940 "type": "InputPhoto"
17941 }
17942 ],
17943 "type": "UserProfilePhoto"
17944 },
17945 {
17946 "id": "1328726168",
17947 "method": "photos.uploadProfilePhoto",
17948 "params": [
17949 {
17950 "name": "file",
17951 "type": "InputFile"
17952 }
17953 ],
17954 "type": "photos.Photo"
17955 },
17956 {
17957 "id": "-2016444625",
17958 "method": "photos.deletePhotos",
17959 "params": [
17960 {
17961 "name": "id",
17962 "type": "Vector<InputPhoto>"
17963 }
17964 ],
17965 "type": "Vector<long>"
17966 },
17967 {
17968 "id": "-1291540959",
17969 "method": "upload.saveFilePart",
17970 "params": [
17971 {
17972 "name": "file_id",
17973 "type": "long"
17974 },
17975 {
17976 "name": "file_part",
17977 "type": "int"
17978 },
17979 {
17980 "name": "bytes",
17981 "type": "bytes"
17982 }
17983 ],
17984 "type": "Bool"
17985 },
17986 {
17987 "id": "-475607115",
17988 "method": "upload.getFile",
17989 "params": [
17990 {
17991 "name": "location",
17992 "type": "InputFileLocation"
17993 },
17994 {
17995 "name": "offset",
17996 "type": "int"
17997 },
17998 {
17999 "name": "limit",
18000 "type": "int"
18001 }
18002 ],
18003 "type": "upload.File"
18004 },
18005 {
18006 "id": "-990308245",
18007 "method": "help.getConfig",
18008 "params": [],
18009 "type": "Config"
18010 },
18011 {
18012 "id": "531836966",
18013 "method": "help.getNearestDc",
18014 "params": [],
18015 "type": "NearestDc"
18016 },
18017 {
18018 "id": "-1372724842",
18019 "method": "help.getAppUpdate",
18020 "params": [],
18021 "type": "help.AppUpdate"
18022 },
18023 {
18024 "id": "1862465352",
18025 "method": "help.saveAppLog",
18026 "params": [
18027 {
18028 "name": "events",
18029 "type": "Vector<InputAppEvent>"
18030 }
18031 ],
18032 "type": "Bool"
18033 },
18034 {
18035 "id": "1295590211",
18036 "method": "help.getInviteText",
18037 "params": [],
18038 "type": "help.InviteText"
18039 },
18040 {
18041 "id": "-1848823128",
18042 "method": "photos.getUserPhotos",
18043 "params": [
18044 {
18045 "name": "user_id",
18046 "type": "InputUser"
18047 },
18048 {
18049 "name": "offset",
18050 "type": "int"
18051 },
18052 {
18053 "name": "max_id",
18054 "type": "long"
18055 },
18056 {
18057 "name": "limit",
18058 "type": "int"
18059 }
18060 ],
18061 "type": "photos.Photos"
18062 },
18063 {
18064 "id": "865483769",
18065 "method": "messages.forwardMessage",
18066 "params": [
18067 {
18068 "name": "peer",
18069 "type": "InputPeer"
18070 },
18071 {
18072 "name": "id",
18073 "type": "int"
18074 },
18075 {
18076 "name": "random_id",
18077 "type": "long"
18078 }
18079 ],
18080 "type": "Updates"
18081 },
18082 {
18083 "id": "651135312",
18084 "method": "messages.getDhConfig",
18085 "params": [
18086 {
18087 "name": "version",
18088 "type": "int"
18089 },
18090 {
18091 "name": "random_length",
18092 "type": "int"
18093 }
18094 ],
18095 "type": "messages.DhConfig"
18096 },
18097 {
18098 "id": "-162681021",
18099 "method": "messages.requestEncryption",
18100 "params": [
18101 {
18102 "name": "user_id",
18103 "type": "InputUser"
18104 },
18105 {
18106 "name": "random_id",
18107 "type": "int"
18108 },
18109 {
18110 "name": "g_a",
18111 "type": "bytes"
18112 }
18113 ],
18114 "type": "EncryptedChat"
18115 },
18116 {
18117 "id": "1035731989",
18118 "method": "messages.acceptEncryption",
18119 "params": [
18120 {
18121 "name": "peer",
18122 "type": "InputEncryptedChat"
18123 },
18124 {
18125 "name": "g_b",
18126 "type": "bytes"
18127 },
18128 {
18129 "name": "key_fingerprint",
18130 "type": "long"
18131 }
18132 ],
18133 "type": "EncryptedChat"
18134 },
18135 {
18136 "id": "-304536635",
18137 "method": "messages.discardEncryption",
18138 "params": [
18139 {
18140 "name": "chat_id",
18141 "type": "int"
18142 }
18143 ],
18144 "type": "Bool"
18145 },
18146 {
18147 "id": "2031374829",
18148 "method": "messages.setEncryptedTyping",
18149 "params": [
18150 {
18151 "name": "peer",
18152 "type": "InputEncryptedChat"
18153 },
18154 {
18155 "name": "typing",
18156 "type": "Bool"
18157 }
18158 ],
18159 "type": "Bool"
18160 },
18161 {
18162 "id": "2135648522",
18163 "method": "messages.readEncryptedHistory",
18164 "params": [
18165 {
18166 "name": "peer",
18167 "type": "InputEncryptedChat"
18168 },
18169 {
18170 "name": "max_date",
18171 "type": "int"
18172 }
18173 ],
18174 "type": "Bool"
18175 },
18176 {
18177 "id": "-1451792525",
18178 "method": "messages.sendEncrypted",
18179 "params": [
18180 {
18181 "name": "peer",
18182 "type": "InputEncryptedChat"
18183 },
18184 {
18185 "name": "random_id",
18186 "type": "long"
18187 },
18188 {
18189 "name": "data",
18190 "type": "bytes"
18191 }
18192 ],
18193 "type": "messages.SentEncryptedMessage"
18194 },
18195 {
18196 "id": "-1701831834",
18197 "method": "messages.sendEncryptedFile",
18198 "params": [
18199 {
18200 "name": "peer",
18201 "type": "InputEncryptedChat"
18202 },
18203 {
18204 "name": "random_id",
18205 "type": "long"
18206 },
18207 {
18208 "name": "data",
18209 "type": "bytes"
18210 },
18211 {
18212 "name": "file",
18213 "type": "InputEncryptedFile"
18214 }
18215 ],
18216 "type": "messages.SentEncryptedMessage"
18217 },
18218 {
18219 "id": "852769188",
18220 "method": "messages.sendEncryptedService",
18221 "params": [
18222 {
18223 "name": "peer",
18224 "type": "InputEncryptedChat"
18225 },
18226 {
18227 "name": "random_id",
18228 "type": "long"
18229 },
18230 {
18231 "name": "data",
18232 "type": "bytes"
18233 }
18234 ],
18235 "type": "messages.SentEncryptedMessage"
18236 },
18237 {
18238 "id": "1436924774",
18239 "method": "messages.receivedQueue",
18240 "params": [
18241 {
18242 "name": "max_qts",
18243 "type": "int"
18244 }
18245 ],
18246 "type": "Vector<long>"
18247 },
18248 {
18249 "id": "-562337987",
18250 "method": "upload.saveBigFilePart",
18251 "params": [
18252 {
18253 "name": "file_id",
18254 "type": "long"
18255 },
18256 {
18257 "name": "file_part",
18258 "type": "int"
18259 },
18260 {
18261 "name": "file_total_parts",
18262 "type": "int"
18263 },
18264 {
18265 "name": "bytes",
18266 "type": "bytes"
18267 }
18268 ],
18269 "type": "Bool"
18270 },
18271 {
18272 "id": "1769565673",
18273 "method": "initConnection",
18274 "params": [
18275 {
18276 "name": "api_id",
18277 "type": "int"
18278 },
18279 {
18280 "name": "device_model",
18281 "type": "string"
18282 },
18283 {
18284 "name": "system_version",
18285 "type": "string"
18286 },
18287 {
18288 "name": "app_version",
18289 "type": "string"
18290 },
18291 {
18292 "name": "lang_code",
18293 "type": "string"
18294 },
18295 {
18296 "name": "query",
18297 "type": "!X"
18298 }
18299 ],
18300 "type": "X"
18301 },
18302 {
18303 "id": "-1663104819",
18304 "method": "help.getSupport",
18305 "params": [],
18306 "type": "help.Support"
18307 },
18308 {
18309 "id": "916930423",
18310 "method": "messages.readMessageContents",
18311 "params": [
18312 {
18313 "name": "id",
18314 "type": "Vector<int>"
18315 }
18316 ],
18317 "type": "messages.AffectedMessages"
18318 },
18319 {
18320 "id": "655677548",
18321 "method": "account.checkUsername",
18322 "params": [
18323 {
18324 "name": "username",
18325 "type": "string"
18326 }
18327 ],
18328 "type": "Bool"
18329 },
18330 {
18331 "id": "1040964988",
18332 "method": "account.updateUsername",
18333 "params": [
18334 {
18335 "name": "username",
18336 "type": "string"
18337 }
18338 ],
18339 "type": "User"
18340 },
18341 {
18342 "id": "301470424",
18343 "method": "contacts.search",
18344 "params": [
18345 {
18346 "name": "q",
18347 "type": "string"
18348 },
18349 {
18350 "name": "limit",
18351 "type": "int"
18352 }
18353 ],
18354 "type": "contacts.Found"
18355 },
18356 {
18357 "id": "-623130288",
18358 "method": "account.getPrivacy",
18359 "params": [
18360 {
18361 "name": "key",
18362 "type": "InputPrivacyKey"
18363 }
18364 ],
18365 "type": "account.PrivacyRules"
18366 },
18367 {
18368 "id": "-906486552",
18369 "method": "account.setPrivacy",
18370 "params": [
18371 {
18372 "name": "key",
18373 "type": "InputPrivacyKey"
18374 },
18375 {
18376 "name": "rules",
18377 "type": "Vector<InputPrivacyRule>"
18378 }
18379 ],
18380 "type": "account.PrivacyRules"
18381 },
18382 {
18383 "id": "1099779595",
18384 "method": "account.deleteAccount",
18385 "params": [
18386 {
18387 "name": "reason",
18388 "type": "string"
18389 }
18390 ],
18391 "type": "Bool"
18392 },
18393 {
18394 "id": "150761757",
18395 "method": "account.getAccountTTL",
18396 "params": [],
18397 "type": "AccountDaysTTL"
18398 },
18399 {
18400 "id": "608323678",
18401 "method": "account.setAccountTTL",
18402 "params": [
18403 {
18404 "name": "ttl",
18405 "type": "AccountDaysTTL"
18406 }
18407 ],
18408 "type": "Bool"
18409 },
18410 {
18411 "id": "-627372787",
18412 "method": "invokeWithLayer",
18413 "params": [
18414 {
18415 "name": "layer",
18416 "type": "int"
18417 },
18418 {
18419 "name": "query",
18420 "type": "!X"
18421 }
18422 ],
18423 "type": "X"
18424 },
18425 {
18426 "id": "-113456221",
18427 "method": "contacts.resolveUsername",
18428 "params": [
18429 {
18430 "name": "username",
18431 "type": "string"
18432 }
18433 ],
18434 "type": "contacts.ResolvedPeer"
18435 },
18436 {
18437 "id": "149257707",
18438 "method": "account.sendChangePhoneCode",
18439 "params": [
18440 {
18441 "name": "flags",
18442 "type": "#"
18443 },
18444 {
18445 "name": "allow_flashcall",
18446 "type": "flags.0?true"
18447 },
18448 {
18449 "name": "phone_number",
18450 "type": "string"
18451 },
18452 {
18453 "name": "current_number",
18454 "type": "flags.0?Bool"
18455 }
18456 ],
18457 "type": "auth.SentCode"
18458 },
18459 {
18460 "id": "1891839707",
18461 "method": "account.changePhone",
18462 "params": [
18463 {
18464 "name": "phone_number",
18465 "type": "string"
18466 },
18467 {
18468 "name": "phone_code_hash",
18469 "type": "string"
18470 },
18471 {
18472 "name": "phone_code",
18473 "type": "string"
18474 }
18475 ],
18476 "type": "User"
18477 },
18478 {
18479 "id": "479598769",
18480 "method": "messages.getAllStickers",
18481 "params": [
18482 {
18483 "name": "hash",
18484 "type": "int"
18485 }
18486 ],
18487 "type": "messages.AllStickers"
18488 },
18489 {
18490 "id": "954152242",
18491 "method": "account.updateDeviceLocked",
18492 "params": [
18493 {
18494 "name": "period",
18495 "type": "int"
18496 }
18497 ],
18498 "type": "Bool"
18499 },
18500 {
18501 "id": "1738800940",
18502 "method": "auth.importBotAuthorization",
18503 "params": [
18504 {
18505 "name": "flags",
18506 "type": "int"
18507 },
18508 {
18509 "name": "api_id",
18510 "type": "int"
18511 },
18512 {
18513 "name": "api_hash",
18514 "type": "string"
18515 },
18516 {
18517 "name": "bot_auth_token",
18518 "type": "string"
18519 }
18520 ],
18521 "type": "auth.Authorization"
18522 },
18523 {
18524 "id": "623001124",
18525 "method": "messages.getWebPagePreview",
18526 "params": [
18527 {
18528 "name": "message",
18529 "type": "string"
18530 }
18531 ],
18532 "type": "MessageMedia"
18533 },
18534 {
18535 "id": "-484392616",
18536 "method": "account.getAuthorizations",
18537 "params": [],
18538 "type": "account.Authorizations"
18539 },
18540 {
18541 "id": "-545786948",
18542 "method": "account.resetAuthorization",
18543 "params": [
18544 {
18545 "name": "hash",
18546 "type": "long"
18547 }
18548 ],
18549 "type": "Bool"
18550 },
18551 {
18552 "id": "1418342645",
18553 "method": "account.getPassword",
18554 "params": [],
18555 "type": "account.Password"
18556 },
18557 {
18558 "id": "-1131605573",
18559 "method": "account.getPasswordSettings",
18560 "params": [
18561 {
18562 "name": "current_password_hash",
18563 "type": "bytes"
18564 }
18565 ],
18566 "type": "account.PasswordSettings"
18567 },
18568 {
18569 "id": "-92517498",
18570 "method": "account.updatePasswordSettings",
18571 "params": [
18572 {
18573 "name": "current_password_hash",
18574 "type": "bytes"
18575 },
18576 {
18577 "name": "new_settings",
18578 "type": "account.PasswordInputSettings"
18579 }
18580 ],
18581 "type": "Bool"
18582 },
18583 {
18584 "id": "174260510",
18585 "method": "auth.checkPassword",
18586 "params": [
18587 {
18588 "name": "password_hash",
18589 "type": "bytes"
18590 }
18591 ],
18592 "type": "auth.Authorization"
18593 },
18594 {
18595 "id": "-661144474",
18596 "method": "auth.requestPasswordRecovery",
18597 "params": [],
18598 "type": "auth.PasswordRecovery"
18599 },
18600 {
18601 "id": "1319464594",
18602 "method": "auth.recoverPassword",
18603 "params": [
18604 {
18605 "name": "code",
18606 "type": "string"
18607 }
18608 ],
18609 "type": "auth.Authorization"
18610 },
18611 {
18612 "id": "-1080796745",
18613 "method": "invokeWithoutUpdates",
18614 "params": [
18615 {
18616 "name": "query",
18617 "type": "!X"
18618 }
18619 ],
18620 "type": "X"
18621 },
18622 {
18623 "id": "2106086025",
18624 "method": "messages.exportChatInvite",
18625 "params": [
18626 {
18627 "name": "chat_id",
18628 "type": "int"
18629 }
18630 ],
18631 "type": "ExportedChatInvite"
18632 },
18633 {
18634 "id": "1051570619",
18635 "method": "messages.checkChatInvite",
18636 "params": [
18637 {
18638 "name": "hash",
18639 "type": "string"
18640 }
18641 ],
18642 "type": "ChatInvite"
18643 },
18644 {
18645 "id": "1817183516",
18646 "method": "messages.importChatInvite",
18647 "params": [
18648 {
18649 "name": "hash",
18650 "type": "string"
18651 }
18652 ],
18653 "type": "Updates"
18654 },
18655 {
18656 "id": "639215886",
18657 "method": "messages.getStickerSet",
18658 "params": [
18659 {
18660 "name": "stickerset",
18661 "type": "InputStickerSet"
18662 }
18663 ],
18664 "type": "messages.StickerSet"
18665 },
18666 {
18667 "id": "-946871200",
18668 "method": "messages.installStickerSet",
18669 "params": [
18670 {
18671 "name": "stickerset",
18672 "type": "InputStickerSet"
18673 },
18674 {
18675 "name": "archived",
18676 "type": "Bool"
18677 }
18678 ],
18679 "type": "messages.StickerSetInstallResult"
18680 },
18681 {
18682 "id": "-110209570",
18683 "method": "messages.uninstallStickerSet",
18684 "params": [
18685 {
18686 "name": "stickerset",
18687 "type": "InputStickerSet"
18688 }
18689 ],
18690 "type": "Bool"
18691 },
18692 {
18693 "id": "-421563528",
18694 "method": "messages.startBot",
18695 "params": [
18696 {
18697 "name": "bot",
18698 "type": "InputUser"
18699 },
18700 {
18701 "name": "peer",
18702 "type": "InputPeer"
18703 },
18704 {
18705 "name": "random_id",
18706 "type": "long"
18707 },
18708 {
18709 "name": "start_param",
18710 "type": "string"
18711 }
18712 ],
18713 "type": "Updates"
18714 },
18715 {
18716 "id": "-1189013126",
18717 "method": "help.getAppChangelog",
18718 "params": [],
18719 "type": "help.AppChangelog"
18720 },
18721 {
18722 "id": "-993483427",
18723 "method": "messages.getMessagesViews",
18724 "params": [
18725 {
18726 "name": "peer",
18727 "type": "InputPeer"
18728 },
18729 {
18730 "name": "id",
18731 "type": "Vector<int>"
18732 },
18733 {
18734 "name": "increment",
18735 "type": "Bool"
18736 }
18737 ],
18738 "type": "Vector<int>"
18739 },
18740 {
18741 "id": "-871347913",
18742 "method": "channels.readHistory",
18743 "params": [
18744 {
18745 "name": "channel",
18746 "type": "InputChannel"
18747 },
18748 {
18749 "name": "max_id",
18750 "type": "int"
18751 }
18752 ],
18753 "type": "Bool"
18754 },
18755 {
18756 "id": "-2067661490",
18757 "method": "channels.deleteMessages",
18758 "params": [
18759 {
18760 "name": "channel",
18761 "type": "InputChannel"
18762 },
18763 {
18764 "name": "id",
18765 "type": "Vector<int>"
18766 }
18767 ],
18768 "type": "messages.AffectedMessages"
18769 },
18770 {
18771 "id": "-787622117",
18772 "method": "channels.deleteUserHistory",
18773 "params": [
18774 {
18775 "name": "channel",
18776 "type": "InputChannel"
18777 },
18778 {
18779 "name": "user_id",
18780 "type": "InputUser"
18781 }
18782 ],
18783 "type": "messages.AffectedHistory"
18784 },
18785 {
18786 "id": "-32999408",
18787 "method": "channels.reportSpam",
18788 "params": [
18789 {
18790 "name": "channel",
18791 "type": "InputChannel"
18792 },
18793 {
18794 "name": "user_id",
18795 "type": "InputUser"
18796 },
18797 {
18798 "name": "id",
18799 "type": "Vector<int>"
18800 }
18801 ],
18802 "type": "Bool"
18803 },
18804 {
18805 "id": "-1814580409",
18806 "method": "channels.getMessages",
18807 "params": [
18808 {
18809 "name": "channel",
18810 "type": "InputChannel"
18811 },
18812 {
18813 "name": "id",
18814 "type": "Vector<int>"
18815 }
18816 ],
18817 "type": "messages.Messages"
18818 },
18819 {
18820 "id": "618237842",
18821 "method": "channels.getParticipants",
18822 "params": [
18823 {
18824 "name": "channel",
18825 "type": "InputChannel"
18826 },
18827 {
18828 "name": "filter",
18829 "type": "ChannelParticipantsFilter"
18830 },
18831 {
18832 "name": "offset",
18833 "type": "int"
18834 },
18835 {
18836 "name": "limit",
18837 "type": "int"
18838 }
18839 ],
18840 "type": "channels.ChannelParticipants"
18841 },
18842 {
18843 "id": "1416484774",
18844 "method": "channels.getParticipant",
18845 "params": [
18846 {
18847 "name": "channel",
18848 "type": "InputChannel"
18849 },
18850 {
18851 "name": "user_id",
18852 "type": "InputUser"
18853 }
18854 ],
18855 "type": "channels.ChannelParticipant"
18856 },
18857 {
18858 "id": "176122811",
18859 "method": "channels.getChannels",
18860 "params": [
18861 {
18862 "name": "id",
18863 "type": "Vector<InputChannel>"
18864 }
18865 ],
18866 "type": "messages.Chats"
18867 },
18868 {
18869 "id": "141781513",
18870 "method": "channels.getFullChannel",
18871 "params": [
18872 {
18873 "name": "channel",
18874 "type": "InputChannel"
18875 }
18876 ],
18877 "type": "messages.ChatFull"
18878 },
18879 {
18880 "id": "-192332417",
18881 "method": "channels.createChannel",
18882 "params": [
18883 {
18884 "name": "flags",
18885 "type": "#"
18886 },
18887 {
18888 "name": "broadcast",
18889 "type": "flags.0?true"
18890 },
18891 {
18892 "name": "megagroup",
18893 "type": "flags.1?true"
18894 },
18895 {
18896 "name": "title",
18897 "type": "string"
18898 },
18899 {
18900 "name": "about",
18901 "type": "string"
18902 }
18903 ],
18904 "type": "Updates"
18905 },
18906 {
18907 "id": "333610782",
18908 "method": "channels.editAbout",
18909 "params": [
18910 {
18911 "name": "channel",
18912 "type": "InputChannel"
18913 },
18914 {
18915 "name": "about",
18916 "type": "string"
18917 }
18918 ],
18919 "type": "Bool"
18920 },
18921 {
18922 "id": "-344583728",
18923 "method": "channels.editAdmin",
18924 "params": [
18925 {
18926 "name": "channel",
18927 "type": "InputChannel"
18928 },
18929 {
18930 "name": "user_id",
18931 "type": "InputUser"
18932 },
18933 {
18934 "name": "role",
18935 "type": "ChannelParticipantRole"
18936 }
18937 ],
18938 "type": "Updates"
18939 },
18940 {
18941 "id": "1450044624",
18942 "method": "channels.editTitle",
18943 "params": [
18944 {
18945 "name": "channel",
18946 "type": "InputChannel"
18947 },
18948 {
18949 "name": "title",
18950 "type": "string"
18951 }
18952 ],
18953 "type": "Updates"
18954 },
18955 {
18956 "id": "-248621111",
18957 "method": "channels.editPhoto",
18958 "params": [
18959 {
18960 "name": "channel",
18961 "type": "InputChannel"
18962 },
18963 {
18964 "name": "photo",
18965 "type": "InputChatPhoto"
18966 }
18967 ],
18968 "type": "Updates"
18969 },
18970 {
18971 "id": "283557164",
18972 "method": "channels.checkUsername",
18973 "params": [
18974 {
18975 "name": "channel",
18976 "type": "InputChannel"
18977 },
18978 {
18979 "name": "username",
18980 "type": "string"
18981 }
18982 ],
18983 "type": "Bool"
18984 },
18985 {
18986 "id": "890549214",
18987 "method": "channels.updateUsername",
18988 "params": [
18989 {
18990 "name": "channel",
18991 "type": "InputChannel"
18992 },
18993 {
18994 "name": "username",
18995 "type": "string"
18996 }
18997 ],
18998 "type": "Bool"
18999 },
19000 {
19001 "id": "615851205",
19002 "method": "channels.joinChannel",
19003 "params": [
19004 {
19005 "name": "channel",
19006 "type": "InputChannel"
19007 }
19008 ],
19009 "type": "Updates"
19010 },
19011 {
19012 "id": "-130635115",
19013 "method": "channels.leaveChannel",
19014 "params": [
19015 {
19016 "name": "channel",
19017 "type": "InputChannel"
19018 }
19019 ],
19020 "type": "Updates"
19021 },
19022 {
19023 "id": "429865580",
19024 "method": "channels.inviteToChannel",
19025 "params": [
19026 {
19027 "name": "channel",
19028 "type": "InputChannel"
19029 },
19030 {
19031 "name": "users",
19032 "type": "Vector<InputUser>"
19033 }
19034 ],
19035 "type": "Updates"
19036 },
19037 {
19038 "id": "-1502421484",
19039 "method": "channels.kickFromChannel",
19040 "params": [
19041 {
19042 "name": "channel",
19043 "type": "InputChannel"
19044 },
19045 {
19046 "name": "user_id",
19047 "type": "InputUser"
19048 },
19049 {
19050 "name": "kicked",
19051 "type": "Bool"
19052 }
19053 ],
19054 "type": "Updates"
19055 },
19056 {
19057 "id": "-950663035",
19058 "method": "channels.exportInvite",
19059 "params": [
19060 {
19061 "name": "channel",
19062 "type": "InputChannel"
19063 }
19064 ],
19065 "type": "ExportedChatInvite"
19066 },
19067 {
19068 "id": "-1072619549",
19069 "method": "channels.deleteChannel",
19070 "params": [
19071 {
19072 "name": "channel",
19073 "type": "InputChannel"
19074 }
19075 ],
19076 "type": "Updates"
19077 },
19078 {
19079 "id": "-1154295872",
19080 "method": "updates.getChannelDifference",
19081 "params": [
19082 {
19083 "name": "channel",
19084 "type": "InputChannel"
19085 },
19086 {
19087 "name": "filter",
19088 "type": "ChannelMessagesFilter"
19089 },
19090 {
19091 "name": "pts",
19092 "type": "int"
19093 },
19094 {
19095 "name": "limit",
19096 "type": "int"
19097 }
19098 ],
19099 "type": "updates.ChannelDifference"
19100 },
19101 {
19102 "id": "-326379039",
19103 "method": "messages.toggleChatAdmins",
19104 "params": [
19105 {
19106 "name": "chat_id",
19107 "type": "int"
19108 },
19109 {
19110 "name": "enabled",
19111 "type": "Bool"
19112 }
19113 ],
19114 "type": "Updates"
19115 },
19116 {
19117 "id": "-1444503762",
19118 "method": "messages.editChatAdmin",
19119 "params": [
19120 {
19121 "name": "chat_id",
19122 "type": "int"
19123 },
19124 {
19125 "name": "user_id",
19126 "type": "InputUser"
19127 },
19128 {
19129 "name": "is_admin",
19130 "type": "Bool"
19131 }
19132 ],
19133 "type": "Bool"
19134 },
19135 {
19136 "id": "363051235",
19137 "method": "messages.migrateChat",
19138 "params": [
19139 {
19140 "name": "chat_id",
19141 "type": "int"
19142 }
19143 ],
19144 "type": "Updates"
19145 },
19146 {
19147 "id": "-1640190800",
19148 "method": "messages.searchGlobal",
19149 "params": [
19150 {
19151 "name": "q",
19152 "type": "string"
19153 },
19154 {
19155 "name": "offset_date",
19156 "type": "int"
19157 },
19158 {
19159 "name": "offset_peer",
19160 "type": "InputPeer"
19161 },
19162 {
19163 "name": "offset_id",
19164 "type": "int"
19165 },
19166 {
19167 "name": "limit",
19168 "type": "int"
19169 }
19170 ],
19171 "type": "messages.Messages"
19172 },
19173 {
19174 "id": "889286899",
19175 "method": "help.getTermsOfService",
19176 "params": [],
19177 "type": "help.TermsOfService"
19178 },
19179 {
19180 "id": "2016638777",
19181 "method": "messages.reorderStickerSets",
19182 "params": [
19183 {
19184 "name": "flags",
19185 "type": "#"
19186 },
19187 {
19188 "name": "masks",
19189 "type": "flags.0?true"
19190 },
19191 {
19192 "name": "order",
19193 "type": "Vector<long>"
19194 }
19195 ],
19196 "type": "Bool"
19197 },
19198 {
19199 "id": "864953444",
19200 "method": "messages.getDocumentByHash",
19201 "params": [
19202 {
19203 "name": "sha256",
19204 "type": "bytes"
19205 },
19206 {
19207 "name": "size",
19208 "type": "int"
19209 },
19210 {
19211 "name": "mime_type",
19212 "type": "string"
19213 }
19214 ],
19215 "type": "Document"
19216 },
19217 {
19218 "id": "-1080395925",
19219 "method": "messages.searchGifs",
19220 "params": [
19221 {
19222 "name": "q",
19223 "type": "string"
19224 },
19225 {
19226 "name": "offset",
19227 "type": "int"
19228 }
19229 ],
19230 "type": "messages.FoundGifs"
19231 },
19232 {
19233 "id": "-2084618926",
19234 "method": "messages.getSavedGifs",
19235 "params": [
19236 {
19237 "name": "hash",
19238 "type": "int"
19239 }
19240 ],
19241 "type": "messages.SavedGifs"
19242 },
19243 {
19244 "id": "846868683",
19245 "method": "messages.saveGif",
19246 "params": [
19247 {
19248 "name": "id",
19249 "type": "InputDocument"
19250 },
19251 {
19252 "name": "unsave",
19253 "type": "Bool"
19254 }
19255 ],
19256 "type": "Bool"
19257 },
19258 {
19259 "id": "1364105629",
19260 "method": "messages.getInlineBotResults",
19261 "params": [
19262 {
19263 "name": "flags",
19264 "type": "#"
19265 },
19266 {
19267 "name": "bot",
19268 "type": "InputUser"
19269 },
19270 {
19271 "name": "peer",
19272 "type": "InputPeer"
19273 },
19274 {
19275 "name": "geo_point",
19276 "type": "flags.0?InputGeoPoint"
19277 },
19278 {
19279 "name": "query",
19280 "type": "string"
19281 },
19282 {
19283 "name": "offset",
19284 "type": "string"
19285 }
19286 ],
19287 "type": "messages.BotResults"
19288 },
19289 {
19290 "id": "-346119674",
19291 "method": "messages.setInlineBotResults",
19292 "params": [
19293 {
19294 "name": "flags",
19295 "type": "#"
19296 },
19297 {
19298 "name": "gallery",
19299 "type": "flags.0?true"
19300 },
19301 {
19302 "name": "private",
19303 "type": "flags.1?true"
19304 },
19305 {
19306 "name": "query_id",
19307 "type": "long"
19308 },
19309 {
19310 "name": "results",
19311 "type": "Vector<InputBotInlineResult>"
19312 },
19313 {
19314 "name": "cache_time",
19315 "type": "int"
19316 },
19317 {
19318 "name": "next_offset",
19319 "type": "flags.2?string"
19320 },
19321 {
19322 "name": "switch_pm",
19323 "type": "flags.3?InlineBotSwitchPM"
19324 }
19325 ],
19326 "type": "Bool"
19327 },
19328 {
19329 "id": "-1318189314",
19330 "method": "messages.sendInlineBotResult",
19331 "params": [
19332 {
19333 "name": "flags",
19334 "type": "#"
19335 },
19336 {
19337 "name": "silent",
19338 "type": "flags.5?true"
19339 },
19340 {
19341 "name": "background",
19342 "type": "flags.6?true"
19343 },
19344 {
19345 "name": "clear_draft",
19346 "type": "flags.7?true"
19347 },
19348 {
19349 "name": "peer",
19350 "type": "InputPeer"
19351 },
19352 {
19353 "name": "reply_to_msg_id",
19354 "type": "flags.0?int"
19355 },
19356 {
19357 "name": "random_id",
19358 "type": "long"
19359 },
19360 {
19361 "name": "query_id",
19362 "type": "long"
19363 },
19364 {
19365 "name": "id",
19366 "type": "string"
19367 }
19368 ],
19369 "type": "Updates"
19370 },
19371 {
19372 "id": "1231065863",
19373 "method": "channels.toggleInvites",
19374 "params": [
19375 {
19376 "name": "channel",
19377 "type": "InputChannel"
19378 },
19379 {
19380 "name": "enabled",
19381 "type": "Bool"
19382 }
19383 ],
19384 "type": "Updates"
19385 },
19386 {
19387 "id": "-934882771",
19388 "method": "channels.exportMessageLink",
19389 "params": [
19390 {
19391 "name": "channel",
19392 "type": "InputChannel"
19393 },
19394 {
19395 "name": "id",
19396 "type": "int"
19397 }
19398 ],
19399 "type": "ExportedMessageLink"
19400 },
19401 {
19402 "id": "527021574",
19403 "method": "channels.toggleSignatures",
19404 "params": [
19405 {
19406 "name": "channel",
19407 "type": "InputChannel"
19408 },
19409 {
19410 "name": "enabled",
19411 "type": "Bool"
19412 }
19413 ],
19414 "type": "Updates"
19415 },
19416 {
19417 "id": "-1490162350",
19418 "method": "channels.updatePinnedMessage",
19419 "params": [
19420 {
19421 "name": "flags",
19422 "type": "#"
19423 },
19424 {
19425 "name": "silent",
19426 "type": "flags.0?true"
19427 },
19428 {
19429 "name": "channel",
19430 "type": "InputChannel"
19431 },
19432 {
19433 "name": "id",
19434 "type": "int"
19435 }
19436 ],
19437 "type": "Updates"
19438 },
19439 {
19440 "id": "1056025023",
19441 "method": "auth.resendCode",
19442 "params": [
19443 {
19444 "name": "phone_number",
19445 "type": "string"
19446 },
19447 {
19448 "name": "phone_code_hash",
19449 "type": "string"
19450 }
19451 ],
19452 "type": "auth.SentCode"
19453 },
19454 {
19455 "id": "520357240",
19456 "method": "auth.cancelCode",
19457 "params": [
19458 {
19459 "name": "phone_number",
19460 "type": "string"
19461 },
19462 {
19463 "name": "phone_code_hash",
19464 "type": "string"
19465 }
19466 ],
19467 "type": "Bool"
19468 },
19469 {
19470 "id": "-39416522",
19471 "method": "messages.getMessageEditData",
19472 "params": [
19473 {
19474 "name": "peer",
19475 "type": "InputPeer"
19476 },
19477 {
19478 "name": "id",
19479 "type": "int"
19480 }
19481 ],
19482 "type": "messages.MessageEditData"
19483 },
19484 {
19485 "id": "-829299510",
19486 "method": "messages.editMessage",
19487 "params": [
19488 {
19489 "name": "flags",
19490 "type": "#"
19491 },
19492 {
19493 "name": "no_webpage",
19494 "type": "flags.1?true"
19495 },
19496 {
19497 "name": "peer",
19498 "type": "InputPeer"
19499 },
19500 {
19501 "name": "id",
19502 "type": "int"
19503 },
19504 {
19505 "name": "message",
19506 "type": "flags.11?string"
19507 },
19508 {
19509 "name": "reply_markup",
19510 "type": "flags.2?ReplyMarkup"
19511 },
19512 {
19513 "name": "entities",
19514 "type": "flags.3?Vector<MessageEntity>"
19515 }
19516 ],
19517 "type": "Updates"
19518 },
19519 {
19520 "id": "319564933",
19521 "method": "messages.editInlineBotMessage",
19522 "params": [
19523 {
19524 "name": "flags",
19525 "type": "#"
19526 },
19527 {
19528 "name": "no_webpage",
19529 "type": "flags.1?true"
19530 },
19531 {
19532 "name": "id",
19533 "type": "InputBotInlineMessageID"
19534 },
19535 {
19536 "name": "message",
19537 "type": "flags.11?string"
19538 },
19539 {
19540 "name": "reply_markup",
19541 "type": "flags.2?ReplyMarkup"
19542 },
19543 {
19544 "name": "entities",
19545 "type": "flags.3?Vector<MessageEntity>"
19546 }
19547 ],
19548 "type": "Bool"
19549 },
19550 {
19551 "id": "-2130010132",
19552 "method": "messages.getBotCallbackAnswer",
19553 "params": [
19554 {
19555 "name": "flags",
19556 "type": "#"
19557 },
19558 {
19559 "name": "game",
19560 "type": "flags.1?true"
19561 },
19562 {
19563 "name": "peer",
19564 "type": "InputPeer"
19565 },
19566 {
19567 "name": "msg_id",
19568 "type": "int"
19569 },
19570 {
19571 "name": "data",
19572 "type": "flags.0?bytes"
19573 }
19574 ],
19575 "type": "messages.BotCallbackAnswer"
19576 },
19577 {
19578 "id": "-920136629",
19579 "method": "messages.setBotCallbackAnswer",
19580 "params": [
19581 {
19582 "name": "flags",
19583 "type": "#"
19584 },
19585 {
19586 "name": "alert",
19587 "type": "flags.1?true"
19588 },
19589 {
19590 "name": "query_id",
19591 "type": "long"
19592 },
19593 {
19594 "name": "message",
19595 "type": "flags.0?string"
19596 },
19597 {
19598 "name": "url",
19599 "type": "flags.2?string"
19600 }
19601 ],
19602 "type": "Bool"
19603 },
19604 {
19605 "id": "-728224331",
19606 "method": "contacts.getTopPeers",
19607 "params": [
19608 {
19609 "name": "flags",
19610 "type": "#"
19611 },
19612 {
19613 "name": "correspondents",
19614 "type": "flags.0?true"
19615 },
19616 {
19617 "name": "bots_pm",
19618 "type": "flags.1?true"
19619 },
19620 {
19621 "name": "bots_inline",
19622 "type": "flags.2?true"
19623 },
19624 {
19625 "name": "groups",
19626 "type": "flags.10?true"
19627 },
19628 {
19629 "name": "channels",
19630 "type": "flags.15?true"
19631 },
19632 {
19633 "name": "offset",
19634 "type": "int"
19635 },
19636 {
19637 "name": "limit",
19638 "type": "int"
19639 },
19640 {
19641 "name": "hash",
19642 "type": "int"
19643 }
19644 ],
19645 "type": "contacts.TopPeers"
19646 },
19647 {
19648 "id": "451113900",
19649 "method": "contacts.resetTopPeerRating",
19650 "params": [
19651 {
19652 "name": "category",
19653 "type": "TopPeerCategory"
19654 },
19655 {
19656 "name": "peer",
19657 "type": "InputPeer"
19658 }
19659 ],
19660 "type": "Bool"
19661 },
19662 {
19663 "id": "764901049",
19664 "method": "messages.getPeerDialogs",
19665 "params": [
19666 {
19667 "name": "peers",
19668 "type": "Vector<InputPeer>"
19669 }
19670 ],
19671 "type": "messages.PeerDialogs"
19672 },
19673 {
19674 "id": "-1137057461",
19675 "method": "messages.saveDraft",
19676 "params": [
19677 {
19678 "name": "flags",
19679 "type": "#"
19680 },
19681 {
19682 "name": "no_webpage",
19683 "type": "flags.1?true"
19684 },
19685 {
19686 "name": "reply_to_msg_id",
19687 "type": "flags.0?int"
19688 },
19689 {
19690 "name": "peer",
19691 "type": "InputPeer"
19692 },
19693 {
19694 "name": "message",
19695 "type": "string"
19696 },
19697 {
19698 "name": "entities",
19699 "type": "flags.3?Vector<MessageEntity>"
19700 }
19701 ],
19702 "type": "Bool"
19703 },
19704 {
19705 "id": "1782549861",
19706 "method": "messages.getAllDrafts",
19707 "params": [],
19708 "type": "Updates"
19709 },
19710 {
19711 "id": "766298703",
19712 "method": "messages.getFeaturedStickers",
19713 "params": [
19714 {
19715 "name": "hash",
19716 "type": "int"
19717 }
19718 ],
19719 "type": "messages.FeaturedStickers"
19720 },
19721 {
19722 "id": "1527873830",
19723 "method": "messages.readFeaturedStickers",
19724 "params": [
19725 {
19726 "name": "id",
19727 "type": "Vector<long>"
19728 }
19729 ],
19730 "type": "Bool"
19731 },
19732 {
19733 "id": "1587647177",
19734 "method": "messages.getRecentStickers",
19735 "params": [
19736 {
19737 "name": "flags",
19738 "type": "#"
19739 },
19740 {
19741 "name": "attached",
19742 "type": "flags.0?true"
19743 },
19744 {
19745 "name": "hash",
19746 "type": "int"
19747 }
19748 ],
19749 "type": "messages.RecentStickers"
19750 },
19751 {
19752 "id": "958863608",
19753 "method": "messages.saveRecentSticker",
19754 "params": [
19755 {
19756 "name": "flags",
19757 "type": "#"
19758 },
19759 {
19760 "name": "attached",
19761 "type": "flags.0?true"
19762 },
19763 {
19764 "name": "id",
19765 "type": "InputDocument"
19766 },
19767 {
19768 "name": "unsave",
19769 "type": "Bool"
19770 }
19771 ],
19772 "type": "Bool"
19773 },
19774 {
19775 "id": "-1986437075",
19776 "method": "messages.clearRecentStickers",
19777 "params": [
19778 {
19779 "name": "flags",
19780 "type": "#"
19781 },
19782 {
19783 "name": "attached",
19784 "type": "flags.0?true"
19785 }
19786 ],
19787 "type": "Bool"
19788 },
19789 {
19790 "id": "1475442322",
19791 "method": "messages.getArchivedStickers",
19792 "params": [
19793 {
19794 "name": "flags",
19795 "type": "#"
19796 },
19797 {
19798 "name": "masks",
19799 "type": "flags.0?true"
19800 },
19801 {
19802 "name": "offset_id",
19803 "type": "long"
19804 },
19805 {
19806 "name": "limit",
19807 "type": "int"
19808 }
19809 ],
19810 "type": "messages.ArchivedStickers"
19811 },
19812 {
19813 "id": "353818557",
19814 "method": "account.sendConfirmPhoneCode",
19815 "params": [
19816 {
19817 "name": "flags",
19818 "type": "#"
19819 },
19820 {
19821 "name": "allow_flashcall",
19822 "type": "flags.0?true"
19823 },
19824 {
19825 "name": "hash",
19826 "type": "string"
19827 },
19828 {
19829 "name": "current_number",
19830 "type": "flags.0?Bool"
19831 }
19832 ],
19833 "type": "auth.SentCode"
19834 },
19835 {
19836 "id": "1596029123",
19837 "method": "account.confirmPhone",
19838 "params": [
19839 {
19840 "name": "phone_code_hash",
19841 "type": "string"
19842 },
19843 {
19844 "name": "phone_code",
19845 "type": "string"
19846 }
19847 ],
19848 "type": "Bool"
19849 },
19850 {
19851 "id": "-1920105769",
19852 "method": "channels.getAdminedPublicChannels",
19853 "params": [],
19854 "type": "messages.Chats"
19855 },
19856 {
19857 "id": "1706608543",
19858 "method": "messages.getMaskStickers",
19859 "params": [
19860 {
19861 "name": "hash",
19862 "type": "int"
19863 }
19864 ],
19865 "type": "messages.AllStickers"
19866 },
19867 {
19868 "id": "-866424884",
19869 "method": "messages.getAttachedStickers",
19870 "params": [
19871 {
19872 "name": "media",
19873 "type": "InputStickeredMedia"
19874 }
19875 ],
19876 "type": "Vector<StickerSetCovered>"
19877 },
19878 {
19879 "id": "-1907842680",
19880 "method": "auth.dropTempAuthKeys",
19881 "params": [
19882 {
19883 "name": "except_auth_keys",
19884 "type": "Vector<long>"
19885 }
19886 ],
19887 "type": "Bool"
19888 },
19889 {
19890 "id": "-1896289088",
19891 "method": "messages.setGameScore",
19892 "params": [
19893 {
19894 "name": "flags",
19895 "type": "#"
19896 },
19897 {
19898 "name": "edit_message",
19899 "type": "flags.0?true"
19900 },
19901 {
19902 "name": "peer",
19903 "type": "InputPeer"
19904 },
19905 {
19906 "name": "id",
19907 "type": "int"
19908 },
19909 {
19910 "name": "user_id",
19911 "type": "InputUser"
19912 },
19913 {
19914 "name": "score",
19915 "type": "int"
19916 }
19917 ],
19918 "type": "Updates"
19919 },
19920 {
19921 "id": "363700068",
19922 "method": "messages.setInlineGameScore",
19923 "params": [
19924 {
19925 "name": "flags",
19926 "type": "#"
19927 },
19928 {
19929 "name": "edit_message",
19930 "type": "flags.0?true"
19931 },
19932 {
19933 "name": "id",
19934 "type": "InputBotInlineMessageID"
19935 },
19936 {
19937 "name": "user_id",
19938 "type": "InputUser"
19939 },
19940 {
19941 "name": "score",
19942 "type": "int"
19943 }
19944 ],
19945 "type": "Bool"
19946 },
19947 {
19948 "id": "-400399203",
19949 "method": "messages.getGameHighScores",
19950 "params": [
19951 {
19952 "name": "peer",
19953 "type": "InputPeer"
19954 },
19955 {
19956 "name": "id",
19957 "type": "int"
19958 },
19959 {
19960 "name": "user_id",
19961 "type": "InputUser"
19962 }
19963 ],
19964 "type": "messages.HighScores"
19965 },
19966 {
19967 "id": "258170395",
19968 "method": "messages.getInlineGameHighScores",
19969 "params": [
19970 {
19971 "name": "id",
19972 "type": "InputBotInlineMessageID"
19973 },
19974 {
19975 "name": "user_id",
19976 "type": "InputUser"
19977 }
19978 ],
19979 "type": "messages.HighScores"
19980 }
19981 ]
19982};
19983
19984/***/ }),
19985/* 39 */
19986/***/ (function(module, exports) {
19987
19988module.exports = {
19989 "constructors": [
19990 {
19991 "id": "481674261",
19992 "predicate": "vector",
19993 "params": [],
19994 "type": "Vector t"
19995 },
19996 {
19997 "id": "85337187",
19998 "predicate": "resPQ",
19999 "params": [
20000 {
20001 "name": "nonce",
20002 "type": "int128"
20003 },
20004 {
20005 "name": "server_nonce",
20006 "type": "int128"
20007 },
20008 {
20009 "name": "pq",
20010 "type": "bytes"
20011 },
20012 {
20013 "name": "server_public_key_fingerprints",
20014 "type": "Vector<long>"
20015 }
20016 ],
20017 "type": "ResPQ"
20018 },
20019 {
20020 "id": "-2083955988",
20021 "predicate": "p_q_inner_data",
20022 "params": [
20023 {
20024 "name": "pq",
20025 "type": "bytes"
20026 },
20027 {
20028 "name": "p",
20029 "type": "bytes"
20030 },
20031 {
20032 "name": "q",
20033 "type": "bytes"
20034 },
20035 {
20036 "name": "nonce",
20037 "type": "int128"
20038 },
20039 {
20040 "name": "server_nonce",
20041 "type": "int128"
20042 },
20043 {
20044 "name": "new_nonce",
20045 "type": "int256"
20046 }
20047 ],
20048 "type": "P_Q_inner_data"
20049 },
20050 {
20051 "id": "2043348061",
20052 "predicate": "server_DH_params_fail",
20053 "params": [
20054 {
20055 "name": "nonce",
20056 "type": "int128"
20057 },
20058 {
20059 "name": "server_nonce",
20060 "type": "int128"
20061 },
20062 {
20063 "name": "new_nonce_hash",
20064 "type": "int128"
20065 }
20066 ],
20067 "type": "Server_DH_Params"
20068 },
20069 {
20070 "id": "-790100132",
20071 "predicate": "server_DH_params_ok",
20072 "params": [
20073 {
20074 "name": "nonce",
20075 "type": "int128"
20076 },
20077 {
20078 "name": "server_nonce",
20079 "type": "int128"
20080 },
20081 {
20082 "name": "encrypted_answer",
20083 "type": "bytes"
20084 }
20085 ],
20086 "type": "Server_DH_Params"
20087 },
20088 {
20089 "id": "-1249309254",
20090 "predicate": "server_DH_inner_data",
20091 "params": [
20092 {
20093 "name": "nonce",
20094 "type": "int128"
20095 },
20096 {
20097 "name": "server_nonce",
20098 "type": "int128"
20099 },
20100 {
20101 "name": "g",
20102 "type": "int"
20103 },
20104 {
20105 "name": "dh_prime",
20106 "type": "bytes"
20107 },
20108 {
20109 "name": "g_a",
20110 "type": "bytes"
20111 },
20112 {
20113 "name": "server_time",
20114 "type": "int"
20115 }
20116 ],
20117 "type": "Server_DH_inner_data"
20118 },
20119 {
20120 "id": "1715713620",
20121 "predicate": "client_DH_inner_data",
20122 "params": [
20123 {
20124 "name": "nonce",
20125 "type": "int128"
20126 },
20127 {
20128 "name": "server_nonce",
20129 "type": "int128"
20130 },
20131 {
20132 "name": "retry_id",
20133 "type": "long"
20134 },
20135 {
20136 "name": "g_b",
20137 "type": "bytes"
20138 }
20139 ],
20140 "type": "Client_DH_Inner_Data"
20141 },
20142 {
20143 "id": "1003222836",
20144 "predicate": "dh_gen_ok",
20145 "params": [
20146 {
20147 "name": "nonce",
20148 "type": "int128"
20149 },
20150 {
20151 "name": "server_nonce",
20152 "type": "int128"
20153 },
20154 {
20155 "name": "new_nonce_hash1",
20156 "type": "int128"
20157 }
20158 ],
20159 "type": "Set_client_DH_params_answer"
20160 },
20161 {
20162 "id": "1188831161",
20163 "predicate": "dh_gen_retry",
20164 "params": [
20165 {
20166 "name": "nonce",
20167 "type": "int128"
20168 },
20169 {
20170 "name": "server_nonce",
20171 "type": "int128"
20172 },
20173 {
20174 "name": "new_nonce_hash2",
20175 "type": "int128"
20176 }
20177 ],
20178 "type": "Set_client_DH_params_answer"
20179 },
20180 {
20181 "id": "-1499615742",
20182 "predicate": "dh_gen_fail",
20183 "params": [
20184 {
20185 "name": "nonce",
20186 "type": "int128"
20187 },
20188 {
20189 "name": "server_nonce",
20190 "type": "int128"
20191 },
20192 {
20193 "name": "new_nonce_hash3",
20194 "type": "int128"
20195 }
20196 ],
20197 "type": "Set_client_DH_params_answer"
20198 },
20199 {
20200 "id": "-212046591",
20201 "predicate": "rpc_result",
20202 "params": [
20203 {
20204 "name": "req_msg_id",
20205 "type": "long"
20206 },
20207 {
20208 "name": "result",
20209 "type": "Object"
20210 }
20211 ],
20212 "type": "RpcResult"
20213 },
20214 {
20215 "id": "558156313",
20216 "predicate": "rpc_error",
20217 "params": [
20218 {
20219 "name": "error_code",
20220 "type": "int"
20221 },
20222 {
20223 "name": "error_message",
20224 "type": "string"
20225 }
20226 ],
20227 "type": "RpcError"
20228 },
20229 {
20230 "id": "1579864942",
20231 "predicate": "rpc_answer_unknown",
20232 "params": [],
20233 "type": "RpcDropAnswer"
20234 },
20235 {
20236 "id": "-847714938",
20237 "predicate": "rpc_answer_dropped_running",
20238 "params": [],
20239 "type": "RpcDropAnswer"
20240 },
20241 {
20242 "id": "-1539647305",
20243 "predicate": "rpc_answer_dropped",
20244 "params": [
20245 {
20246 "name": "msg_id",
20247 "type": "long"
20248 },
20249 {
20250 "name": "seq_no",
20251 "type": "int"
20252 },
20253 {
20254 "name": "bytes",
20255 "type": "int"
20256 }
20257 ],
20258 "type": "RpcDropAnswer"
20259 },
20260 {
20261 "id": "155834844",
20262 "predicate": "future_salt",
20263 "params": [
20264 {
20265 "name": "valid_since",
20266 "type": "int"
20267 },
20268 {
20269 "name": "valid_until",
20270 "type": "int"
20271 },
20272 {
20273 "name": "salt",
20274 "type": "long"
20275 }
20276 ],
20277 "type": "FutureSalt"
20278 },
20279 {
20280 "id": "-1370486635",
20281 "predicate": "future_salts",
20282 "params": [
20283 {
20284 "name": "req_msg_id",
20285 "type": "long"
20286 },
20287 {
20288 "name": "now",
20289 "type": "int"
20290 },
20291 {
20292 "name": "salts",
20293 "type": "vector<future_salt>"
20294 }
20295 ],
20296 "type": "FutureSalts"
20297 },
20298 {
20299 "id": "880243653",
20300 "predicate": "pong",
20301 "params": [
20302 {
20303 "name": "msg_id",
20304 "type": "long"
20305 },
20306 {
20307 "name": "ping_id",
20308 "type": "long"
20309 }
20310 ],
20311 "type": "Pong"
20312 },
20313 {
20314 "id": "-501201412",
20315 "predicate": "destroy_session_ok",
20316 "params": [
20317 {
20318 "name": "session_id",
20319 "type": "long"
20320 }
20321 ],
20322 "type": "DestroySessionRes"
20323 },
20324 {
20325 "id": "1658015945",
20326 "predicate": "destroy_session_none",
20327 "params": [
20328 {
20329 "name": "session_id",
20330 "type": "long"
20331 }
20332 ],
20333 "type": "DestroySessionRes"
20334 },
20335 {
20336 "id": "-1631450872",
20337 "predicate": "new_session_created",
20338 "params": [
20339 {
20340 "name": "first_msg_id",
20341 "type": "long"
20342 },
20343 {
20344 "name": "unique_id",
20345 "type": "long"
20346 },
20347 {
20348 "name": "server_salt",
20349 "type": "long"
20350 }
20351 ],
20352 "type": "NewSession"
20353 },
20354 {
20355 "id": "1945237724",
20356 "predicate": "msg_container",
20357 "params": [
20358 {
20359 "name": "messages",
20360 "type": "vector<%Message>"
20361 }
20362 ],
20363 "type": "MessageContainer"
20364 },
20365 {
20366 "id": "1538843921",
20367 "predicate": "message",
20368 "params": [
20369 {
20370 "name": "msg_id",
20371 "type": "long"
20372 },
20373 {
20374 "name": "seqno",
20375 "type": "int"
20376 },
20377 {
20378 "name": "bytes",
20379 "type": "int"
20380 },
20381 {
20382 "name": "body",
20383 "type": "Object"
20384 }
20385 ],
20386 "type": "Message"
20387 },
20388 {
20389 "id": "-530561358",
20390 "predicate": "msg_copy",
20391 "params": [
20392 {
20393 "name": "orig_message",
20394 "type": "Message"
20395 }
20396 ],
20397 "type": "MessageCopy"
20398 },
20399 {
20400 "id": "812830625",
20401 "predicate": "gzip_packed",
20402 "params": [
20403 {
20404 "name": "packed_data",
20405 "type": "bytes"
20406 }
20407 ],
20408 "type": "Object"
20409 },
20410 {
20411 "id": "1658238041",
20412 "predicate": "msgs_ack",
20413 "params": [
20414 {
20415 "name": "msg_ids",
20416 "type": "Vector<long>"
20417 }
20418 ],
20419 "type": "MsgsAck"
20420 },
20421 {
20422 "id": "-1477445615",
20423 "predicate": "bad_msg_notification",
20424 "params": [
20425 {
20426 "name": "bad_msg_id",
20427 "type": "long"
20428 },
20429 {
20430 "name": "bad_msg_seqno",
20431 "type": "int"
20432 },
20433 {
20434 "name": "error_code",
20435 "type": "int"
20436 }
20437 ],
20438 "type": "BadMsgNotification"
20439 },
20440 {
20441 "id": "-307542917",
20442 "predicate": "bad_server_salt",
20443 "params": [
20444 {
20445 "name": "bad_msg_id",
20446 "type": "long"
20447 },
20448 {
20449 "name": "bad_msg_seqno",
20450 "type": "int"
20451 },
20452 {
20453 "name": "error_code",
20454 "type": "int"
20455 },
20456 {
20457 "name": "new_server_salt",
20458 "type": "long"
20459 }
20460 ],
20461 "type": "BadMsgNotification"
20462 },
20463 {
20464 "id": "2105940488",
20465 "predicate": "msg_resend_req",
20466 "params": [
20467 {
20468 "name": "msg_ids",
20469 "type": "Vector<long>"
20470 }
20471 ],
20472 "type": "MsgResendReq"
20473 },
20474 {
20475 "id": "-630588590",
20476 "predicate": "msgs_state_req",
20477 "params": [
20478 {
20479 "name": "msg_ids",
20480 "type": "Vector<long>"
20481 }
20482 ],
20483 "type": "MsgsStateReq"
20484 },
20485 {
20486 "id": "81704317",
20487 "predicate": "msgs_state_info",
20488 "params": [
20489 {
20490 "name": "req_msg_id",
20491 "type": "long"
20492 },
20493 {
20494 "name": "info",
20495 "type": "bytes"
20496 }
20497 ],
20498 "type": "MsgsStateInfo"
20499 },
20500 {
20501 "id": "-1933520591",
20502 "predicate": "msgs_all_info",
20503 "params": [
20504 {
20505 "name": "msg_ids",
20506 "type": "Vector<long>"
20507 },
20508 {
20509 "name": "info",
20510 "type": "bytes"
20511 }
20512 ],
20513 "type": "MsgsAllInfo"
20514 },
20515 {
20516 "id": "661470918",
20517 "predicate": "msg_detailed_info",
20518 "params": [
20519 {
20520 "name": "msg_id",
20521 "type": "long"
20522 },
20523 {
20524 "name": "answer_msg_id",
20525 "type": "long"
20526 },
20527 {
20528 "name": "bytes",
20529 "type": "int"
20530 },
20531 {
20532 "name": "status",
20533 "type": "int"
20534 }
20535 ],
20536 "type": "MsgDetailedInfo"
20537 },
20538 {
20539 "id": "-2137147681",
20540 "predicate": "msg_new_detailed_info",
20541 "params": [
20542 {
20543 "name": "answer_msg_id",
20544 "type": "long"
20545 },
20546 {
20547 "name": "bytes",
20548 "type": "int"
20549 },
20550 {
20551 "name": "status",
20552 "type": "int"
20553 }
20554 ],
20555 "type": "MsgDetailedInfo"
20556 }
20557 ],
20558 "methods": [
20559 {
20560 "id": "1615239032",
20561 "method": "req_pq",
20562 "params": [
20563 {
20564 "name": "nonce",
20565 "type": "int128"
20566 }
20567 ],
20568 "type": "ResPQ"
20569 },
20570 {
20571 "id": "-686627650",
20572 "method": "req_DH_params",
20573 "params": [
20574 {
20575 "name": "nonce",
20576 "type": "int128"
20577 },
20578 {
20579 "name": "server_nonce",
20580 "type": "int128"
20581 },
20582 {
20583 "name": "p",
20584 "type": "bytes"
20585 },
20586 {
20587 "name": "q",
20588 "type": "bytes"
20589 },
20590 {
20591 "name": "public_key_fingerprint",
20592 "type": "long"
20593 },
20594 {
20595 "name": "encrypted_data",
20596 "type": "bytes"
20597 }
20598 ],
20599 "type": "Server_DH_Params"
20600 },
20601 {
20602 "id": "-184262881",
20603 "method": "set_client_DH_params",
20604 "params": [
20605 {
20606 "name": "nonce",
20607 "type": "int128"
20608 },
20609 {
20610 "name": "server_nonce",
20611 "type": "int128"
20612 },
20613 {
20614 "name": "encrypted_data",
20615 "type": "bytes"
20616 }
20617 ],
20618 "type": "Set_client_DH_params_answer"
20619 },
20620 {
20621 "id": "1491380032",
20622 "method": "rpc_drop_answer",
20623 "params": [
20624 {
20625 "name": "req_msg_id",
20626 "type": "long"
20627 }
20628 ],
20629 "type": "RpcDropAnswer"
20630 },
20631 {
20632 "id": "-1188971260",
20633 "method": "get_future_salts",
20634 "params": [
20635 {
20636 "name": "num",
20637 "type": "int"
20638 }
20639 ],
20640 "type": "FutureSalts"
20641 },
20642 {
20643 "id": "2059302892",
20644 "method": "ping",
20645 "params": [
20646 {
20647 "name": "ping_id",
20648 "type": "long"
20649 }
20650 ],
20651 "type": "Pong"
20652 },
20653 {
20654 "id": "-213746804",
20655 "method": "ping_delay_disconnect",
20656 "params": [
20657 {
20658 "name": "ping_id",
20659 "type": "long"
20660 },
20661 {
20662 "name": "disconnect_delay",
20663 "type": "int"
20664 }
20665 ],
20666 "type": "Pong"
20667 },
20668 {
20669 "id": "-414113498",
20670 "method": "destroy_session",
20671 "params": [
20672 {
20673 "name": "session_id",
20674 "type": "long"
20675 }
20676 ],
20677 "type": "DestroySessionRes"
20678 },
20679 {
20680 "id": "-1835453025",
20681 "method": "http_wait",
20682 "params": [
20683 {
20684 "name": "max_delay",
20685 "type": "int"
20686 },
20687 {
20688 "name": "wait_after",
20689 "type": "int"
20690 },
20691 {
20692 "name": "max_wait",
20693 "type": "int"
20694 }
20695 ],
20696 "type": "HttpWait"
20697 }
20698 ]
20699};
20700
20701/***/ }),
20702/* 40 */
20703/***/ (function(module, exports, __webpack_require__) {
20704
20705module.exports = (__webpack_require__(6))(124);
20706
20707/***/ }),
20708/* 41 */
20709/***/ (function(module, exports, __webpack_require__) {
20710
20711module.exports = (__webpack_require__(6))(127);
20712
20713/***/ }),
20714/* 42 */
20715/***/ (function(module, __webpack_exports__, __webpack_require__) {
20716
20717"use strict";
20718Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
20719/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__smart_timeout__ = __webpack_require__(8);
20720/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "smartTimeout", function() { return __WEBPACK_IMPORTED_MODULE_0__smart_timeout__["a"]; });
20721/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defer__ = __webpack_require__(4);
20722/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "blueDefer", function() { return __WEBPACK_IMPORTED_MODULE_1__defer__["a"]; });
20723/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__crypto__ = __webpack_require__(9);
20724/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "CryptoWorker", function() { return __WEBPACK_IMPORTED_MODULE_2__crypto__["a"]; });
20725/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__bin__ = __webpack_require__(0);
20726/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bin", function() { return __WEBPACK_IMPORTED_MODULE_3__bin__["bin"]; });
20727/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__for_each__ = __webpack_require__(15);
20728/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_4__for_each__["a"]; });
20729/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__service_api_manager_index_js__ = __webpack_require__(12);
20730/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ApiManager", function() { return __WEBPACK_IMPORTED_MODULE_5__service_api_manager_index_js__["a"]; });
20731/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__store__ = __webpack_require__(7);
20732/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "PureStorage", function() { return __WEBPACK_IMPORTED_MODULE_6__store__["a"]; });
20733/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__service_time_manager__ = __webpack_require__(5);
20734/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "MtpTimeManager", function() { return __WEBPACK_IMPORTED_MODULE_7__service_time_manager__; });
20735/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__service_dc_configurator__ = __webpack_require__(16);
20736/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "MtpDcConfigurator", function() { return __WEBPACK_IMPORTED_MODULE_8__service_dc_configurator__; });
20737/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__service_secure_random__ = __webpack_require__(11);
20738/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MtpSecureRandom", function() { return __WEBPACK_IMPORTED_MODULE_9__service_secure_random__["a"]; });
20739/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__service_networker__ = __webpack_require__(17);
20740/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "MtpNetworker", function() { return __WEBPACK_IMPORTED_MODULE_10__service_networker__; });
20741/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__http__ = __webpack_require__(10);
20742/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "httpClient", function() { return __WEBPACK_IMPORTED_MODULE_11__http__["a"]; });
20743// import 'setimmediate'
20744
20745
20746
20747
20748
20749
20750
20751
20752
20753
20754
20755
20756
20757
20758
20759
20760
20761
20762
20763
20764
20765
20766
20767console.info('source loaded');
20768
20769
20770/* harmony default export */ __webpack_exports__["default"] = __WEBPACK_IMPORTED_MODULE_5__service_api_manager_index_js__["a" /* ApiManager */];
20771
20772/***/ })
20773/******/ ]);
20774});
20775//# sourceMappingURL=mtproto2-browser.js.map
\No newline at end of file